风险点、危险源、月度、隐患排查、排查执行bug修复
This commit is contained in:
parent
783232ca11
commit
62f4aa4096
@ -23,6 +23,7 @@ import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -146,4 +147,20 @@ public class RiskListMonthlyController {
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "批量删除月度清单", notes = "批量删除月度清单", httpMethod = "POST")
|
||||
@ApiImplicitParam(name = "ids", value = "月度清单ID字符串(多个以,分割)", paramType = "body", required = true, dataType = "String")
|
||||
@PostMapping(value = "/deleteBatch")
|
||||
public Result deleteBatch(@ApiIgnore @RequestBody HashMap<String, Object> paramMap) {
|
||||
String ids = MapUtils.getString(paramMap, "ids");
|
||||
Result result = new Result<>();
|
||||
if (ids == null || "".equals(ids.trim())) {
|
||||
result.error500("参数不识别!");
|
||||
} else {
|
||||
riskListMonthlyService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
Result.success("删除成功!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -319,10 +319,13 @@ public class RiskListPointController {
|
||||
.eq(StrUtil.isNotBlank(monthlyId), RiskListPoint::getMonthlyId, monthlyId)
|
||||
).stream().map(RiskListPoint::getId).collect(Collectors.toList());
|
||||
int pointCount = (int) pointIds.size();
|
||||
int sourceCount = riskListSourceService.count(new LambdaQueryWrapper<RiskListSource>()
|
||||
.eq(RiskListSource::getProjectSn, projectSn)
|
||||
.in(StrUtil.isNotBlank(monthlyId), RiskListSource::getPointId, pointIds)
|
||||
);
|
||||
int sourceCount = 0;
|
||||
if (CollUtil.isNotEmpty(pointIds)) {
|
||||
sourceCount = riskListSourceService.count(new LambdaQueryWrapper<RiskListSource>()
|
||||
.eq(RiskListSource::getProjectSn, projectSn)
|
||||
.in(StrUtil.isNotBlank(monthlyId), RiskListSource::getPointId, pointIds)
|
||||
);
|
||||
}
|
||||
CountRiskNumVo vo = new CountRiskNumVo();
|
||||
vo.setRiskPointNum(pointCount);
|
||||
vo.setHazardSourceNum(sourceCount);
|
||||
|
||||
@ -12,17 +12,16 @@ import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.core.util.ZipUtil;
|
||||
import cn.hutool.extra.qrcode.QrCodeUtil;
|
||||
import cn.hutool.extra.qrcode.QrConfig;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.gexin.fastjson.serializer.SerializerFeature;
|
||||
import com.zhgd.annotation.OperLog;
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||
import com.zhgd.xmgl.modules.risk.entity.RiskListDetail;
|
||||
import com.zhgd.xmgl.modules.risk.entity.RiskListPoint;
|
||||
import com.zhgd.xmgl.modules.risk.entity.RiskListSource;
|
||||
import com.zhgd.xmgl.modules.risk.entity.vo.RegionV2Vo;
|
||||
import com.zhgd.xmgl.modules.risk.entity.vo.RiskListDetailVo;
|
||||
import com.zhgd.xmgl.modules.risk.entity.vo.RiskListSourceVo;
|
||||
import com.zhgd.xmgl.modules.risk.entity.vo.RiskUndoneVo;
|
||||
import com.zhgd.xmgl.modules.risk.service.*;
|
||||
@ -283,7 +282,7 @@ public class RiskListSourceController {
|
||||
* @param param
|
||||
* @param dir
|
||||
*/
|
||||
public void generateRegionQrCode(HashMap<String, Object> param, String dir) {
|
||||
private void generateRegionQrCode(HashMap<String, Object> param, String dir) {
|
||||
String projectSn = MapUtils.getString(param, "projectSn");
|
||||
List<String> regionIds = StrUtil.split(MapUtils.getString(param, "regionIds"), ",");
|
||||
List<RegionV2Vo> regionV2Vos = regionV2Service.queryList(new MapBuilder<String, Object>()
|
||||
@ -291,8 +290,8 @@ public class RiskListSourceController {
|
||||
.build());
|
||||
regionV2Vos.stream().filter(regionV2Vo -> regionIds.contains(regionV2Vo.getId() + "")).forEach(regionV2Vo -> {
|
||||
// 1. 创建空白图片 (白底)
|
||||
int width = 600;
|
||||
int height = 800;
|
||||
int width = 1200;
|
||||
int height = 1067;
|
||||
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
|
||||
Graphics2D g = image.createGraphics();
|
||||
|
||||
@ -308,7 +307,7 @@ public class RiskListSourceController {
|
||||
String title = "【" + regionV2Vo.getRegionName() + "】风险分级管控清单";
|
||||
Font titleFont = new Font("微软雅黑", Font.BOLD, 48);
|
||||
g.setFont(titleFont);
|
||||
g.setColor(Color.BLACK);
|
||||
g.setColor(Color.BLACK); // 标题保持黑色
|
||||
|
||||
// 计算标题居中位置
|
||||
int titleWidth = g.getFontMetrics().stringWidth(title);
|
||||
@ -318,8 +317,9 @@ public class RiskListSourceController {
|
||||
|
||||
// 3. 绘制小号字体居中说明文字
|
||||
String description = "区域:" + regionV2Vo.getFullPath();
|
||||
Font descFont = new Font("宋体", Font.PLAIN, 28);
|
||||
Font descFont = new Font("宋体", Font.BOLD, 32);
|
||||
g.setFont(descFont);
|
||||
g.setColor(Color.BLACK); // 说明文字保持黑色
|
||||
|
||||
// 处理多行文本
|
||||
String[] lines = description.split("\n");
|
||||
@ -333,9 +333,27 @@ public class RiskListSourceController {
|
||||
}
|
||||
|
||||
// 4. 生成并绘制居中二维码
|
||||
int qrSize = 200; // 二维码尺寸
|
||||
int qrSize = 600; // 二维码尺寸
|
||||
int qrX = (width - qrSize) / 2;
|
||||
int qrY = startY + (lines.length * lineHeight) + 50;
|
||||
int qrY = startY + (lines.length * lineHeight) + 100;
|
||||
|
||||
// 计算虚线位置(在描述文字和二维码之间)
|
||||
int dashY = startY + (lines.length * lineHeight) + 25; // 位于文字和二维码中间位置
|
||||
|
||||
// --- 虚线颜色修改在这里 ---
|
||||
g.setColor(Color.GRAY); // 将绘制颜色设置为灰色
|
||||
// --- 虚线颜色修改结束 ---
|
||||
|
||||
// 设置虚线样式(10像素实线 + 10像素空白)
|
||||
Stroke dashed = new BasicStroke(3, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL,
|
||||
0, new float[]{10, 10}, 0);
|
||||
g.setStroke(dashed);
|
||||
g.drawLine(0, dashY, width, dashY);
|
||||
|
||||
// 恢复实线样式和黑色(避免影响后续绘制,如二维码如果还有边框等)
|
||||
g.setStroke(new BasicStroke());
|
||||
g.setColor(Color.BLACK); // 恢复黑色,因为二维码默认是黑色的
|
||||
// --- 虚线绘制结束 ---
|
||||
|
||||
// 使用Hutool生成二维码图片
|
||||
QrConfig config = new QrConfig(qrSize, qrSize);
|
||||
@ -349,9 +367,15 @@ public class RiskListSourceController {
|
||||
g.drawImage(qrImage, qrX, qrY, null);
|
||||
|
||||
// 6. 保存图片
|
||||
File outputFile = new File(dir, description + ".png");
|
||||
// 确保目录存在,否则可能报错
|
||||
File outputDir = new File(dir);
|
||||
if (!outputDir.exists()) {
|
||||
outputDir.mkdirs(); // 创建所有不存在的父目录
|
||||
}
|
||||
File outputFile = new File(outputDir, regionV2Vo.getFullPath() + ".png");
|
||||
ImgUtil.write(image, outputFile);
|
||||
|
||||
|
||||
// 释放资源
|
||||
g.dispose();
|
||||
System.out.println("模板图片已生成: " + outputFile.getAbsolutePath());
|
||||
@ -367,14 +391,15 @@ public class RiskListSourceController {
|
||||
@PostMapping(value = "/identifySource")
|
||||
public Result identifySource(@RequestBody @Validate HashMap<String, Object> param) {
|
||||
List<RiskListSource> addList = new ArrayList<>();
|
||||
List<RiskListDetail> details = riskListDetailService.list(new LambdaQueryWrapper<RiskListDetail>()
|
||||
.in(RiskListDetail::getId, StrUtil.split(MapUtils.getString(param, "detailIds"), ",")));
|
||||
List<RiskListDetailVo> details = riskListDetailService.queryList(new MapBuilder<String, Object>()
|
||||
.put("detailIds", MapUtils.getString(param, "detailIds"))
|
||||
.build());
|
||||
Long pointId = MapUtils.getLong(param, "pointId");
|
||||
RiskListPoint point = riskListPointService.getById(pointId);
|
||||
if (point == null) {
|
||||
throw new OpenAlertException("管控清单风险点不存在");
|
||||
}
|
||||
for (RiskListDetail detail : details) {
|
||||
for (RiskListDetailVo detail : details) {
|
||||
RiskListSource source = new RiskListSource();
|
||||
BeanUtils.copyProperties(detail, source);
|
||||
source.setId(null);
|
||||
@ -386,6 +411,11 @@ public class RiskListSourceController {
|
||||
source.setEffectiveTimeEnd(source.getEffectiveTimeEnd());
|
||||
source.setIdentificationTime(new Date());
|
||||
source.setProjectSn(point.getProjectSn());
|
||||
String[] pathSplit = detail.getFullPath().split("/");
|
||||
if (pathSplit.length >= 4) {
|
||||
source.setSubProjectWorkTask(pathSplit[3]);
|
||||
}
|
||||
source.setWorkNameContent(StrUtils.getLastSegments(detail.getFullPath(), 4));
|
||||
addList.add(source);
|
||||
}
|
||||
if (CollUtil.isNotEmpty(addList)) {
|
||||
|
||||
@ -236,14 +236,14 @@ public class RiskListSource implements Serializable {
|
||||
@ApiModelProperty(value = "规格型号")
|
||||
private java.lang.String specificationsModel;
|
||||
/**
|
||||
* 分部分项工程/作业任务
|
||||
* 分部分项工程/作业任务(第4项)
|
||||
*/
|
||||
@ApiModelProperty(value = "分部分项工程/作业任务")
|
||||
@ApiModelProperty(value = "分部分项工程/作业任务(第4项)")
|
||||
private java.lang.String subProjectWorkTask;
|
||||
/**
|
||||
* 作业活动名称及内容
|
||||
* 作业活动名称及内容(第5项及以后)
|
||||
*/
|
||||
@ApiModelProperty(value = "作业活动名称及内容")
|
||||
@ApiModelProperty(value = "作业活动名称及内容(第5项及以后)")
|
||||
private java.lang.String workNameContent;
|
||||
/**
|
||||
* 辨识人名称
|
||||
|
||||
@ -12,6 +12,9 @@
|
||||
and t.library_id in (select id from risk_list_library where find_in_set(#{param.containLibraryId},ancestors)
|
||||
or id=#{param.containLibraryId})
|
||||
</if>
|
||||
<if test="param.detailIds != null and param.detailIds != ''">
|
||||
and find_in_set(t.id , #{param.detailIds})
|
||||
</if>
|
||||
)t
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user