管控清单危险源绑定的的责任区域改成中间表方式
This commit is contained in:
parent
0dc7d79eaa
commit
f03f122aac
@ -120,7 +120,7 @@ public class QualityRegionController {
|
||||
@ApiOperation(value = "通过id查询区域信息", notes = "通过id查询区域信息", httpMethod = "POST")
|
||||
@ApiImplicitParam(name = "id", value = "区域ID", paramType = "body", required = true, dataType = "String")
|
||||
@PostMapping(value = "/queryById")
|
||||
public Result<QualityRegion> queryById(@RequestBody Map<String, Object> map) {
|
||||
public Result<QualityRegionVo> queryById(@RequestBody Map<String, Object> map) {
|
||||
return Result.success(qualityRegionService.queryById(map));
|
||||
}
|
||||
|
||||
|
||||
@ -68,6 +68,9 @@
|
||||
left join project_enterprise pe on pe.enterprise_id = ei.id and pe.project_sn = qr.project_sn
|
||||
left join enterprise_type et on et.id = pe.enterprise_type_id
|
||||
WHERE 1=1
|
||||
<if test="id != null and id != ''">
|
||||
and qr.id = #{id}
|
||||
</if>
|
||||
<if test="projectSn != null and projectSn != ''">
|
||||
and qr.project_sn = #{projectSn}
|
||||
</if>
|
||||
|
||||
@ -59,7 +59,7 @@ public interface IQualityRegionService extends IService<QualityRegion> {
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
QualityRegion queryById(Map<String, Object> map);
|
||||
QualityRegionVo queryById(Map<String, Object> map);
|
||||
|
||||
/**
|
||||
* 查询项目子账号绑定的唯一区域
|
||||
|
||||
@ -395,11 +395,12 @@ public class QualityRegionServiceImpl extends ServiceImpl<QualityRegionMapper, Q
|
||||
}
|
||||
|
||||
@Override
|
||||
public QualityRegion queryById(Map<String, Object> map) {
|
||||
QualityRegion qualityRegion = getById(MapUtils.getString(map, "id"));
|
||||
if (qualityRegion == null) {
|
||||
public QualityRegionVo queryById(Map<String, Object> map) {
|
||||
List<QualityRegionVo> qualityRegions = this.queryList(map);
|
||||
if (CollUtil.isEmpty(qualityRegions)) {
|
||||
throw new OpenAlertException(MessageUtil.get("notFindErr"));
|
||||
}
|
||||
QualityRegionVo qualityRegion = CollUtil.getFirst(qualityRegions);
|
||||
qualityRegion.setSystemUsers(systemUserService.getUsersByRegionId(qualityRegion.getId()));
|
||||
qualityRegion.setEnterpriseInfos(enterpriseInfoService.getEnterpriseInfoByRegionId(qualityRegion.getId()));
|
||||
return qualityRegion;
|
||||
|
||||
@ -1,185 +0,0 @@
|
||||
package com.zhgd.xmgl.modules.risk.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.zhgd.annotation.OperLog;
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import com.zhgd.xmgl.modules.risk.entity.RegionV2;
|
||||
import com.zhgd.xmgl.modules.risk.entity.dto.RegionV2Dto;
|
||||
import com.zhgd.xmgl.modules.risk.entity.vo.RegionV2Vo;
|
||||
import com.zhgd.xmgl.modules.risk.service.IRegionV2Service;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.simpleframework.xml.core.Validate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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.Objects;
|
||||
|
||||
|
||||
/**
|
||||
* @Title: Controller
|
||||
* @Description: 区域v2
|
||||
* @author: pds
|
||||
* @date: 2025-06-10
|
||||
* @version: V1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/xmgl/regionV2")
|
||||
@Slf4j
|
||||
@Api(tags = "区域v2相关Api")
|
||||
public class RegionV2Controller {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private IRegionV2Service regionV2Service;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "区域v2管理", operType = "分页查询", operDesc = "分页列表查询区域v2信息")
|
||||
@ApiOperation(value = "分页列表查询区域v2信息", notes = "分页列表查询区域v2信息", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "query", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "query", required = true, dataType = "Integer"),
|
||||
})
|
||||
@GetMapping(value = "/page")
|
||||
public Result<IPage<RegionV2Vo>> queryPageList(@ApiIgnore @RequestParam HashMap<String, Object> param) {
|
||||
return Result.success(regionV2Service.queryPageList(param));
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "区域v2管理", operType = "列表查询", operDesc = "列表查询区域v2信息")
|
||||
@ApiOperation(value = "列表查询区域v2信息", notes = "列表查询区域v2信息", httpMethod = "GET")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<RegionV2Vo>> queryList(@ApiIgnore @RequestParam HashMap<String, Object> param) {
|
||||
return Result.success(regionV2Service.queryList(param));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param regionV2
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "区域v2管理", operType = "添加", operDesc = "添加区域v2信息")
|
||||
@ApiOperation(value = "添加区域v2信息", notes = "添加区域v2信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<RegionV2> add(@RequestBody @Validate RegionV2 regionV2) {
|
||||
regionV2Service.add(regionV2);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param regionV2
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "区域v2管理", operType = "编辑", operDesc = "编辑区域v2信息")
|
||||
@ApiOperation(value = "编辑区域v2信息", notes = "编辑区域v2信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<RegionV2> edit(@RequestBody RegionV2 regionV2) {
|
||||
regionV2Service.edit(regionV2);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "区域v2管理", operType = "删除", operDesc = "删除区域v2信息")
|
||||
@ApiOperation(value = "删除区域v2信息", notes = "删除区域v2信息", httpMethod = "POST")
|
||||
@ApiImplicitParam(name = "id", value = "区域v2ID", paramType = "body", required = true, dataType = "String", example = "{\"id\":\"1\"}")
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<RegionV2> delete(@ApiIgnore @RequestBody HashMap<String, Object> map) {
|
||||
regionV2Service.delete(MapUtils.getString(map, "id"));
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "区域v2管理", operType = "通过id查询", operDesc = "通过id查询区域v2信息")
|
||||
@ApiOperation(value = "通过id查询区域v2信息", notes = "通过id查询区域v2信息", httpMethod = "GET")
|
||||
@ApiImplicitParam(name = "id", value = "区域v2ID", paramType = "query", required = true, dataType = "Integer")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<RegionV2> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
return Result.success(regionV2Service.queryById(id));
|
||||
}
|
||||
|
||||
@OperLog(operModul = "区域v2管理", operType = "查询", operDesc = "分页树形列表查询区域v2信息")
|
||||
@ApiOperation(value = "分页树形列表查询区域v2信息", notes = "分页树形列表查询区域v2信息", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "query", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "query", required = true, dataType = "Integer"),
|
||||
})
|
||||
@GetMapping(value = "tree/page")
|
||||
public Result<IPage<RegionV2Vo>> treePage(@ApiIgnore @RequestParam HashMap<String, Object> paramMap) {
|
||||
return Result.success(regionV2Service.treePage(paramMap));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "批量删除区域v2", notes = "批量删除区域v2", httpMethod = "POST")
|
||||
@ApiImplicitParam(name = "ids", value = "区域v2ID字符串(多个以,分割)", paramType = "body", required = true, dataType = "String")
|
||||
@PostMapping(value = "/deleteBatch")
|
||||
public Result deleteBatch(@ApiIgnore @RequestBody HashMap<String, Object> paramMap) {
|
||||
String ids = org.apache.commons.collections4.MapUtils.getString(paramMap, "ids");
|
||||
Result result = new Result<>();
|
||||
if (ids == null || "".equals(ids.trim())) {
|
||||
result.error500("参数不识别!");
|
||||
} else {
|
||||
List<String> idList = Arrays.asList(ids.split(","));
|
||||
regionV2Service.removeByIds(idList);
|
||||
Result.success("删除成功!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@OperLog(operModul = "区域v2管理", operType = "", operDesc = "批量修改单位和人员数据")
|
||||
@ApiOperation(value = "批量修改单位和人员数据", notes = "批量修改单位和人员数据", httpMethod = "POST")
|
||||
@PostMapping(value = "/batch/editEnterprisesAndUsers")
|
||||
public Result editEnterprisesAndUsers(@RequestBody RegionV2Dto qualityRegion) {
|
||||
regionV2Service.updateById(qualityRegion);
|
||||
List<RegionV2> children = regionV2Service.getChildren(qualityRegion.getId());
|
||||
if (Objects.equals(qualityRegion.getCopyEnterpriseIds(), 1)) {
|
||||
for (RegionV2 child : children) {
|
||||
child.setSecurityEnterpriseIds(qualityRegion.getSecurityEnterpriseIds());
|
||||
}
|
||||
}
|
||||
if (Objects.equals(qualityRegion.getCopyDutyIds(), 1)) {
|
||||
for (RegionV2 child : children) {
|
||||
child.setSecurityDutyIds(qualityRegion.getSecurityDutyIds());
|
||||
}
|
||||
}
|
||||
if (Objects.equals(qualityRegion.getCopyReviewIds(), 1)) {
|
||||
for (RegionV2 child : children) {
|
||||
child.setSecurityReviewIds(qualityRegion.getSecurityReviewIds());
|
||||
}
|
||||
}
|
||||
if (Objects.equals(qualityRegion.getCopyRiskAssessors(), 1)) {
|
||||
for (RegionV2 child : children) {
|
||||
child.setSecurityRiskAssessors(qualityRegion.getSecurityRiskAssessors());
|
||||
}
|
||||
}
|
||||
regionV2Service.updateBatchById(children);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
}
|
||||
@ -12,6 +12,7 @@ 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;
|
||||
@ -22,13 +23,12 @@ import com.zhgd.xmgl.modules.quality.entity.vo.QualityRegionVo;
|
||||
import com.zhgd.xmgl.modules.quality.service.IQualityRegionService;
|
||||
import com.zhgd.xmgl.modules.risk.entity.RiskListPoint;
|
||||
import com.zhgd.xmgl.modules.risk.entity.RiskListSource;
|
||||
import com.zhgd.xmgl.modules.risk.entity.RiskListSourceResponsibilityRegion;
|
||||
import com.zhgd.xmgl.modules.risk.entity.dto.RiskListSourceDto;
|
||||
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.IRiskListDetailService;
|
||||
import com.zhgd.xmgl.modules.risk.service.IRiskListPointService;
|
||||
import com.zhgd.xmgl.modules.risk.service.IRiskListPotentialAccidentTypeService;
|
||||
import com.zhgd.xmgl.modules.risk.service.IRiskListSourceService;
|
||||
import com.zhgd.xmgl.modules.risk.service.*;
|
||||
import com.zhgd.xmgl.modules.xz.security.service.IXzSecurityQualityInspectionRecordService;
|
||||
import com.zhgd.xmgl.util.*;
|
||||
import io.swagger.annotations.Api;
|
||||
@ -44,6 +44,7 @@ import org.simpleframework.xml.core.Validate;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
@ -88,6 +89,9 @@ public class RiskListSourceController {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private IXzSecurityQualityInspectionRecordService qualityInspectionRecordService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private IRiskListSourceResponsibilityRegionService riskListSourceResponsibilityRegionService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
@ -136,7 +140,7 @@ public class RiskListSourceController {
|
||||
@OperLog(operModul = "管控清单危险源管理", operType = "添加", operDesc = "添加管控清单危险源信息")
|
||||
@ApiOperation(value = "添加管控清单危险源信息", notes = "添加管控清单危险源信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<RiskListSource> add(@RequestBody @Validate RiskListSource riskListSource) {
|
||||
public Result<RiskListSource> add(@RequestBody @Validate RiskListSourceDto riskListSource) {
|
||||
riskListSourceService.add(riskListSource);
|
||||
return Result.ok();
|
||||
}
|
||||
@ -150,7 +154,7 @@ public class RiskListSourceController {
|
||||
@OperLog(operModul = "管控清单危险源管理", operType = "编辑", operDesc = "编辑管控清单危险源信息")
|
||||
@ApiOperation(value = "编辑管控清单危险源信息", notes = "编辑管控清单危险源信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<RiskListSource> edit(@RequestBody RiskListSource riskListSource) {
|
||||
public Result<RiskListSource> edit(@RequestBody RiskListSourceDto riskListSource) {
|
||||
riskListSourceService.edit(riskListSource);
|
||||
return Result.ok();
|
||||
}
|
||||
@ -186,13 +190,19 @@ public class RiskListSourceController {
|
||||
@ApiOperation(value = "批量删除管控清单危险源", notes = "批量删除管控清单危险源", httpMethod = "POST")
|
||||
@ApiImplicitParam(name = "ids", value = "管控清单危险源ID字符串(多个以,分割)", paramType = "body", required = true, dataType = "String")
|
||||
@PostMapping(value = "/deleteBatch")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
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 {
|
||||
riskListSourceService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
List<String> idList = Arrays.asList(ids.split(","));
|
||||
riskListSourceService.removeByIds(idList);
|
||||
for (String id : idList) {
|
||||
riskListSourceResponsibilityRegionService.remove(new LambdaQueryWrapper<RiskListSourceResponsibilityRegion>()
|
||||
.eq(RiskListSourceResponsibilityRegion::getSourceId, id));
|
||||
}
|
||||
Result.success("删除成功!");
|
||||
}
|
||||
return result;
|
||||
@ -201,7 +211,7 @@ public class RiskListSourceController {
|
||||
@OperLog(operModul = "管控清单危险源管理", operType = "", operDesc = "复制管控清单危险源信息")
|
||||
@ApiOperation(value = "复制管控清单危险源信息", notes = "复制管控清单危险源信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/copy")
|
||||
public Result<RiskListSource> copy(@RequestBody @Validate RiskListSource riskListPoint) {
|
||||
public Result<RiskListSource> copy(@RequestBody @Validate RiskListSourceDto riskListPoint) {
|
||||
RiskListSource target = new RiskListSource();
|
||||
BeanUtils.copyProperties(riskListPoint, target);
|
||||
target.setId(null);
|
||||
@ -216,6 +226,7 @@ public class RiskListSourceController {
|
||||
@ApiImplicitParam(name = "updates", value = "对象数组", paramType = "body", required = true, dataType = "Integer"),
|
||||
})
|
||||
@PostMapping(value = "/batchSetField")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result batchSetField(@RequestBody Map<String, Object> param) {
|
||||
List<Map<String, Object>> updates = com.gexin.fastjson.JSON.parseObject(com.gexin.fastjson.JSON.toJSONString(param.get("updates"), SerializerFeature.WriteMapNullValue), new com.gexin.fastjson.TypeReference<List<Map<String, Object>>>() {
|
||||
});
|
||||
@ -232,18 +243,19 @@ public class RiskListSourceController {
|
||||
.build());
|
||||
}
|
||||
for (Map<String, Object> map : updates) {
|
||||
UpdateWrapper<RiskListSource> updateWrapper = new UpdateWrapper<RiskListSource>().eq("id", MapUtils.getString(map, "id"));
|
||||
String id = MapUtils.getString(map, "id");
|
||||
UpdateWrapper<RiskListSource> updateWrapper = new UpdateWrapper<RiskListSource>().eq("id", id);
|
||||
for (Map.Entry<String, Object> entry : map.entrySet()) {
|
||||
String column = StrUtil.toUnderlineCase(entry.getKey());
|
||||
if (Objects.equals(column, RefUtil.fieldNameUlc(RiskListSource::getSpecificResponsibilityAreaNames))) {
|
||||
continue;
|
||||
}
|
||||
if (fieldNames.contains(column)) {
|
||||
if (Objects.equals(column, RefUtil.fieldNameUlc(RiskListSourceVo::getSpecificResponsibilityAreaIds))) {
|
||||
riskListSourceService.saveBindData(Long.valueOf(id), Convert.toStr(entry.getValue()));
|
||||
} else if (fieldNames.contains(column) && !Objects.equals(column, RefUtil.fieldNameUlc(RiskListSourceVo::getSpecificResponsibilityAreaNames))) {
|
||||
updateWrapper.set(column, entry.getValue());
|
||||
if (Objects.equals(column, RefUtil.fieldNameUlc(RiskListSource::getSpecificResponsibilityAreaIds))) {
|
||||
if (Objects.equals(column, RefUtil.fieldNameUlc(RiskListSourceVo::getSpecificResponsibilityAreaIds))) {
|
||||
List<String> areaIds = StrUtil.split(Convert.toStr(entry.getValue()), ",");
|
||||
String areaNames = regions.stream().filter(regionV2Vo -> areaIds.contains(regionV2Vo.getId() + "")).map(QualityRegionVo::getFullPath).collect(Collectors.joining(","));
|
||||
updateWrapper.set(RefUtil.fieldNameUlc(RiskListSource::getSpecificResponsibilityAreaNames), areaNames);
|
||||
updateWrapper.set(RefUtil.fieldNameUlc(RiskListSourceVo::getSpecificResponsibilityAreaNames), areaNames);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -143,16 +143,6 @@ public class RiskListSource implements Serializable {
|
||||
*/
|
||||
@ApiModelProperty(value = "排查责任人ids(多个,分割)")
|
||||
private java.lang.String checkWorkerIds;
|
||||
/**
|
||||
* 具体责任区域ids(多个,分割)
|
||||
*/
|
||||
@ApiModelProperty(value = "具体责任区域ids(多个,分割)")
|
||||
private java.lang.String specificResponsibilityAreaIds;
|
||||
/**
|
||||
* 具体责任区域名称(多个,分割)
|
||||
*/
|
||||
@ApiModelProperty(value = "具体责任区域名称(多个,分割)")
|
||||
private java.lang.String specificResponsibilityAreaNames;
|
||||
/**
|
||||
* 辨识时间
|
||||
*/
|
||||
|
||||
@ -0,0 +1,44 @@
|
||||
package com.zhgd.xmgl.modules.risk.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* @Description: 管控清单危险源绑定的具体责任区域
|
||||
* @author: pds
|
||||
* @date: 2025-08-07
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("risk_list_source_responsibility_region")
|
||||
@ApiModel(value = "RiskListSourceResponsibilityRegion实体类", description = "RiskListSourceResponsibilityRegion")
|
||||
public class RiskListSourceResponsibilityRegion implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键id")
|
||||
private java.lang.Long id;
|
||||
/**
|
||||
* 区域id
|
||||
*/
|
||||
@ApiModelProperty(value = "区域id")
|
||||
private java.lang.Long regionId;
|
||||
/**
|
||||
* 管控清单危险源id
|
||||
*/
|
||||
@ApiModelProperty(value = "管控清单危险源id")
|
||||
private java.lang.Long sourceId;
|
||||
}
|
||||
@ -1,29 +0,0 @@
|
||||
package com.zhgd.xmgl.modules.risk.entity.dto;
|
||||
|
||||
import com.zhgd.xmgl.modules.risk.entity.RegionV2;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class RegionV2Dto extends RegionV2 {
|
||||
/**
|
||||
* 1勾选复制到下级(责任单位ids)
|
||||
*/
|
||||
@ApiModelProperty(value = "1勾选复制到下级(责任单位ids)")
|
||||
private java.lang.Integer copyEnterpriseIds;
|
||||
/**
|
||||
* 1勾选复制到下级(整改人IDs)
|
||||
*/
|
||||
@ApiModelProperty(value = "1勾选复制到下级(整改人IDs)")
|
||||
private java.lang.Integer copyDutyIds;
|
||||
/**
|
||||
* 1勾选复制到下级(复查人s)
|
||||
*/
|
||||
@ApiModelProperty(value = "1勾选复制到下级(复查人s)")
|
||||
private java.lang.Integer copyReviewIds;
|
||||
/**
|
||||
* 1勾选复制到下级(风险排查责任人s)
|
||||
*/
|
||||
@ApiModelProperty(value = "1勾选复制到下级(风险排查责任人s)")
|
||||
private java.lang.Integer copyRiskAssessors;
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.zhgd.xmgl.modules.risk.entity.dto;
|
||||
|
||||
import com.zhgd.xmgl.modules.risk.entity.RiskListSource;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class RiskListSourceDto extends RiskListSource {
|
||||
/**
|
||||
* 具体责任区域ids(多个,分割)
|
||||
*/
|
||||
@ApiModelProperty(value = "具体责任区域ids(多个,分割)")
|
||||
private java.lang.String specificResponsibilityAreaIds;
|
||||
/**
|
||||
* 具体责任区域名称(多个,分割)
|
||||
*/
|
||||
@ApiModelProperty(value = "具体责任区域名称(多个,分割)")
|
||||
private java.lang.String specificResponsibilityAreaNames;
|
||||
}
|
||||
@ -1,38 +0,0 @@
|
||||
package com.zhgd.xmgl.modules.risk.entity.vo;
|
||||
|
||||
import com.zhgd.xmgl.modules.risk.entity.RegionV2;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class RegionV2Vo extends RegionV2 {
|
||||
@ApiModelProperty(value = "子节点列表")
|
||||
private List<RegionV2Vo> children;
|
||||
/**
|
||||
* 责任单位名称s
|
||||
*/
|
||||
@ApiModelProperty(value = "责任单位名称s")
|
||||
private java.lang.String enterpriseNames;
|
||||
/**
|
||||
* 整改人名称s
|
||||
*/
|
||||
@ApiModelProperty(value = "整改人名称s")
|
||||
private java.lang.String dutyNames;
|
||||
/**
|
||||
* 复查人名称s
|
||||
*/
|
||||
@ApiModelProperty(value = "复查人名称s")
|
||||
private java.lang.String reviewNames;
|
||||
/**
|
||||
* 风险排查责任人名称s
|
||||
*/
|
||||
@ApiModelProperty(value = "风险排查责任人名称s")
|
||||
private java.lang.String riskAssessorNames;
|
||||
/**
|
||||
* 全路径名(/划分)
|
||||
*/
|
||||
@ApiModelProperty(value = "全路径名(/划分)")
|
||||
private java.lang.String fullPath;
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
package com.zhgd.xmgl.modules.risk.entity.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.zhgd.xmgl.modules.risk.entity.RiskListSource;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@ -105,4 +106,16 @@ public class RiskListSourceVo extends RiskListSource {
|
||||
@ApiModelProperty(value = "待排查区域idList")
|
||||
private List<Long> unCheckAreaIdList;
|
||||
|
||||
/**
|
||||
* 具体责任区域ids(多个,分割)
|
||||
*/
|
||||
@ApiModelProperty(value = "具体责任区域ids(多个,分割)")
|
||||
@TableField(exist = false)
|
||||
private java.lang.String specificResponsibilityAreaIds;
|
||||
/**
|
||||
* 具体责任区域名称(多个,分割)
|
||||
*/
|
||||
@ApiModelProperty(value = "具体责任区域名称(多个,分割)")
|
||||
@TableField(exist = false)
|
||||
private java.lang.String specificResponsibilityAreaNames;
|
||||
}
|
||||
|
||||
@ -1,56 +0,0 @@
|
||||
package com.zhgd.xmgl.modules.risk.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zhgd.xmgl.modules.risk.entity.RegionV2;
|
||||
import com.zhgd.xmgl.modules.risk.entity.vo.RegionV2Vo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 区域v2
|
||||
* @author: pds
|
||||
* @date: 2025-06-10
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface RegionV2Mapper extends BaseMapper<RegionV2> {
|
||||
|
||||
/**
|
||||
* 分页列表查询区域v2信息
|
||||
*
|
||||
* @param page
|
||||
* @param queryWrapper
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
IPage<RegionV2Vo> queryList(Page<RegionV2Vo> page, @Param(Constants.WRAPPER) QueryWrapper<RegionV2Vo> queryWrapper, @Param("param") HashMap<String, Object> param);
|
||||
|
||||
/**
|
||||
* 列表查询区域v2信息
|
||||
*
|
||||
* @param queryWrapper
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
List<RegionV2Vo> queryList(@Param(Constants.WRAPPER) QueryWrapper<RegionV2Vo> queryWrapper, @Param("param") HashMap<String, Object> param);
|
||||
|
||||
|
||||
/**
|
||||
* 通过id查询区域v2信息
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
RegionV2 queryById(String id);
|
||||
|
||||
List<RegionV2> getChildren(Long id);
|
||||
|
||||
void updateAncestors(@Param("oldAncestor") String oldAncestor, @Param("newAncestor") String newAncestor, @Param("projectSn") String projectSn, @Param("id") Long id);
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package com.zhgd.xmgl.modules.risk.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zhgd.xmgl.modules.risk.entity.RiskListSourceResponsibilityRegion;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @Description: 管控清单危险源绑定的具体责任区域
|
||||
* @author: pds
|
||||
* @date: 2025-08-07
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface RiskListSourceResponsibilityRegionMapper extends BaseMapper<RiskListSourceResponsibilityRegion> {
|
||||
}
|
||||
@ -1,33 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zhgd.xmgl.modules.risk.mapper.RegionV2Mapper">
|
||||
<select id="queryList" resultType="com.zhgd.xmgl.modules.risk.entity.vo.RegionV2Vo">
|
||||
select * from (
|
||||
select t.*
|
||||
from region_v2 t
|
||||
where 1=1
|
||||
<if test="param.regionIds != null and param.regionIds != ''">
|
||||
and find_in_set(t.id,#{param.regionIds})
|
||||
</if>
|
||||
)t
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
<select id="queryById" resultType="com.zhgd.xmgl.modules.risk.entity.vo.RegionV2Vo">
|
||||
select * from (
|
||||
select t.*
|
||||
from region_v2 t
|
||||
)t
|
||||
where t.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="getChildren" resultType="com.zhgd.xmgl.modules.risk.entity.RegionV2">
|
||||
select * from region_v2
|
||||
where find_in_set(#{id}, ancestors)
|
||||
</select>
|
||||
|
||||
<update id="updateAncestors">
|
||||
UPDATE region_v2
|
||||
SET ancestors=REPLACE(ancestors, #{oldAncestor}, #{newAncestor})
|
||||
WHERE ancestors LIKE N'${oldAncestor},${id}%' and project_sn = #{projectSn}
|
||||
</update>
|
||||
</mapper>
|
||||
@ -9,10 +9,14 @@
|
||||
,rll.node_name as list_library_name
|
||||
,#{param.workable} as workable
|
||||
,rll.id as library_id
|
||||
,group_concat(distinct rlsrr.region_id) as specific_responsibility_area_ids
|
||||
,group_concat(distinct qr.region_name) as specific_responsibility_area_names
|
||||
from risk_list_source t
|
||||
join risk_list_point rlp on rlp.id=t.point_id
|
||||
left join risk_list_library rll on rll.id=rlp.risk_list_library_id
|
||||
left join risk_list_potential_accident_type rlpat on rlpat.id=t.accident_type_id
|
||||
left join risk_list_source_responsibility_region rlsrr on rlsrr.source_id=t.id
|
||||
left join quality_region qr on qr.id=rlsrr.region_id
|
||||
where 1=1
|
||||
<if test="param.id != null and param.id != ''">
|
||||
and t.id = #{param.id}
|
||||
@ -36,7 +40,7 @@
|
||||
<if test="param.regionIdList != null and param.regionIdList != ''">
|
||||
and
|
||||
<foreach collection="param.regionIdList" item="regionId" separator="OR" open="(" close=")">
|
||||
find_in_set(#{regionId},t.specific_responsibility_area_ids)
|
||||
rlsrr.region_id = #{regionId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="param.duringTheTask == '1'.toString()">
|
||||
@ -52,6 +56,7 @@
|
||||
<if test="param.isMySourceToDoForWorkable == '1'.toString()">
|
||||
and find_in_set(#{param.controlWorkerId},t.control_worker_ids)
|
||||
</if>
|
||||
group by t.id
|
||||
)t
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zhgd.xmgl.modules.risk.mapper.RiskListSourceResponsibilityRegionMapper">
|
||||
</mapper>
|
||||
@ -1,69 +0,0 @@
|
||||
package com.zhgd.xmgl.modules.risk.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zhgd.xmgl.modules.risk.entity.RegionV2;
|
||||
import com.zhgd.xmgl.modules.risk.entity.vo.RegionV2Vo;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 区域v2
|
||||
* @author: pds
|
||||
* @date: 2025-06-10
|
||||
* @version: V1.0
|
||||
*/
|
||||
public interface IRegionV2Service extends IService<RegionV2> {
|
||||
/**
|
||||
* 分页列表查询区域v2信息
|
||||
*
|
||||
* @param param 参数map
|
||||
* @return
|
||||
*/
|
||||
IPage<RegionV2Vo> queryPageList(HashMap<String, Object> param);
|
||||
|
||||
/**
|
||||
* 列表查询区域v2信息
|
||||
*
|
||||
* @param param 参数map
|
||||
* @return
|
||||
*/
|
||||
List<RegionV2Vo> queryList(HashMap<String, Object> param);
|
||||
|
||||
/**
|
||||
* 添加区域v2信息
|
||||
*
|
||||
* @param regionV2 区域v2
|
||||
* @return
|
||||
*/
|
||||
void add(RegionV2 regionV2);
|
||||
|
||||
/**
|
||||
* 编辑区域v2信息
|
||||
*
|
||||
* @param regionV2 区域v2
|
||||
* @return
|
||||
*/
|
||||
void edit(RegionV2 regionV2);
|
||||
|
||||
/**
|
||||
* 根据id删除区域v2信息
|
||||
*
|
||||
* @param id 区域v2的id
|
||||
* @return
|
||||
*/
|
||||
void delete(String id);
|
||||
|
||||
/**
|
||||
* 根据id查询区域v2信息
|
||||
*
|
||||
* @param id 区域v2的id
|
||||
* @return
|
||||
*/
|
||||
RegionV2 queryById(String id);
|
||||
|
||||
IPage<RegionV2Vo> treePage(HashMap<String, Object> paramMap);
|
||||
|
||||
List<RegionV2> getChildren(Long id);
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package com.zhgd.xmgl.modules.risk.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zhgd.xmgl.modules.risk.entity.RiskListSourceResponsibilityRegion;
|
||||
|
||||
/**
|
||||
* @Description: 管控清单危险源绑定的具体责任区域
|
||||
* @author: pds
|
||||
* @date: 2025-08-07
|
||||
* @version: V1.0
|
||||
*/
|
||||
public interface IRiskListSourceResponsibilityRegionService extends IService<RiskListSourceResponsibilityRegion> {
|
||||
}
|
||||
@ -3,8 +3,8 @@ package com.zhgd.xmgl.modules.risk.service;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zhgd.xmgl.base.entity.vo.SectorOneVo;
|
||||
import com.zhgd.xmgl.base.entity.vo.TrendOneVo;
|
||||
import com.zhgd.xmgl.modules.risk.entity.RiskListSource;
|
||||
import com.zhgd.xmgl.modules.risk.entity.dto.RiskListSourceDto;
|
||||
import com.zhgd.xmgl.modules.risk.entity.vo.CountRisksByLevelVo;
|
||||
import com.zhgd.xmgl.modules.risk.entity.vo.RiskListSourceVo;
|
||||
import com.zhgd.xmgl.modules.risk.entity.vo.RiskUndoneVo;
|
||||
@ -41,7 +41,9 @@ public interface IRiskListSourceService extends IService<RiskListSource> {
|
||||
* @param riskListSource 管控清单危险源
|
||||
* @return
|
||||
*/
|
||||
void add(RiskListSource riskListSource);
|
||||
void add(RiskListSourceDto riskListSource);
|
||||
|
||||
void saveBindData(Long sourceId, String specificResponsibilityAreaIds);
|
||||
|
||||
/**
|
||||
* 编辑管控清单危险源信息
|
||||
@ -49,7 +51,7 @@ public interface IRiskListSourceService extends IService<RiskListSource> {
|
||||
* @param riskListSource 管控清单危险源
|
||||
* @return
|
||||
*/
|
||||
void edit(RiskListSource riskListSource);
|
||||
void edit(RiskListSourceDto riskListSource);
|
||||
|
||||
/**
|
||||
* 根据id删除管控清单危险源信息
|
||||
|
||||
@ -1,205 +0,0 @@
|
||||
package com.zhgd.xmgl.modules.risk.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.ISystemUserService;
|
||||
import com.zhgd.xmgl.modules.risk.entity.RegionV2;
|
||||
import com.zhgd.xmgl.modules.risk.entity.vo.RegionV2Vo;
|
||||
import com.zhgd.xmgl.modules.risk.mapper.RegionV2Mapper;
|
||||
import com.zhgd.xmgl.modules.risk.service.IRegionV2Service;
|
||||
import com.zhgd.xmgl.modules.worker.entity.EnterpriseInfo;
|
||||
import com.zhgd.xmgl.modules.worker.service.impl.EnterpriseInfoServiceImpl;
|
||||
import com.zhgd.xmgl.util.ListUtils;
|
||||
import com.zhgd.xmgl.util.PageUtil;
|
||||
import com.zhgd.xmgl.util.RefUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Description: 区域v2
|
||||
* @author: pds
|
||||
* @date: 2025-06-10
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class RegionV2ServiceImpl extends ServiceImpl<RegionV2Mapper, RegionV2> implements IRegionV2Service {
|
||||
@Lazy
|
||||
@Autowired
|
||||
ISystemUserService systemUserService;
|
||||
@Autowired
|
||||
private RegionV2Mapper regionV2Mapper;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private EnterpriseInfoServiceImpl enterpriseInfoService;
|
||||
|
||||
@Override
|
||||
public IPage<RegionV2Vo> queryPageList(HashMap<String, Object> param) {
|
||||
QueryWrapper<RegionV2Vo> queryWrapper = this.getQueryWrapper(param);
|
||||
Page<RegionV2Vo> page = PageUtil.getPage(param);
|
||||
IPage<RegionV2Vo> pageList = baseMapper.queryList(page, queryWrapper, param);
|
||||
pageList.setRecords(this.dealList(pageList.getRecords()));
|
||||
return pageList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RegionV2Vo> queryList(HashMap<String, Object> param) {
|
||||
QueryWrapper<RegionV2Vo> queryWrapper = getQueryWrapper(param);
|
||||
return dealList(baseMapper.queryList(queryWrapper, param));
|
||||
}
|
||||
|
||||
private QueryWrapper<RegionV2Vo> getQueryWrapper(HashMap<String, Object> param) {
|
||||
QueryWrapper<RegionV2Vo> queryWrapper = QueryGenerator.initPageQueryWrapper(RegionV2Vo.class, param, true);
|
||||
queryWrapper.orderByDesc(RefUtil.fieldNameUlc(RegionV2Vo::getId));
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
private List<RegionV2Vo> dealList(List<RegionV2Vo> list) {
|
||||
Map<Long, SystemUser> userIdMap = systemUserService.list(new LambdaQueryWrapper<SystemUser>()
|
||||
.eq(SystemUser::getAccountType, 6)).stream().collect(Collectors.toMap(SystemUser::getUserId, Function.identity(), (o1, o2) -> o1));
|
||||
Map<Long, EnterpriseInfo> enterpriseIdMap = enterpriseInfoService.list(new LambdaQueryWrapper<EnterpriseInfo>()).stream().collect(Collectors.toMap(EnterpriseInfo::getId, Function.identity(), (o1, o2) -> o1));
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
List<RegionV2> allList = this.list(new LambdaQueryWrapper<RegionV2>()
|
||||
.eq(RegionV2::getProjectSn, list.get(0).getProjectSn()));
|
||||
Map<Long, RegionV2> idMap = allList.stream().collect(Collectors.toMap(RegionV2::getId, Function.identity(), (o1, o2) -> o1));
|
||||
for (RegionV2Vo regionV2Vo : list) {
|
||||
//设置全路径名
|
||||
RegionV2 library = idMap.get(regionV2Vo.getId());
|
||||
if (library != null) {
|
||||
String fullPath = "";
|
||||
if (!library.getAncestors().equals("0")) {
|
||||
fullPath = StrUtil.join("/", StrUtil.split(library.getAncestors().substring(2), ",").stream().map(id -> idMap.get(Long.valueOf(id)).getRegionName()).collect(Collectors.toList()));
|
||||
fullPath += "/";
|
||||
}
|
||||
regionV2Vo.setFullPath(fullPath + library.getRegionName());
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(regionV2Vo.getSecurityEnterpriseIds())) {
|
||||
regionV2Vo.setEnterpriseNames(StrUtil.split(regionV2Vo.getSecurityEnterpriseIds(), ",").stream().map(key -> enterpriseIdMap.get(Convert.toLong(key))).filter(Objects::nonNull).map(EnterpriseInfo::getEnterpriseName).collect(Collectors.joining(",")));
|
||||
}
|
||||
if (StrUtil.isNotBlank(regionV2Vo.getSecurityDutyIds())) {
|
||||
regionV2Vo.setDutyNames(StrUtil.split(regionV2Vo.getSecurityDutyIds(), ",").stream().map(key -> userIdMap.get(Convert.toLong(key))).filter(Objects::nonNull).map(SystemUser::getRealName).collect(Collectors.joining(",")));
|
||||
}
|
||||
if (StrUtil.isNotBlank(regionV2Vo.getSecurityReviewIds())) {
|
||||
regionV2Vo.setReviewNames(StrUtil.split(regionV2Vo.getSecurityReviewIds(), ",").stream().map(key -> userIdMap.get(Convert.toLong(key))).filter(Objects::nonNull).map(SystemUser::getRealName).collect(Collectors.joining(",")));
|
||||
}
|
||||
if (StrUtil.isNotBlank(regionV2Vo.getSecurityRiskAssessors())) {
|
||||
regionV2Vo.setRiskAssessorNames(StrUtil.split(regionV2Vo.getSecurityRiskAssessors(), ",").stream().map(key -> userIdMap.get(Convert.toLong(key))).filter(Objects::nonNull).map(SystemUser::getRealName).collect(Collectors.joining(",")));
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(RegionV2 regionV2) {
|
||||
regionV2.setId(null);
|
||||
boolean top = regionV2.getParentRegion() == null || regionV2.getParentRegion() == 0;
|
||||
if (top) {
|
||||
regionV2.setParentRegion(0L);
|
||||
regionV2.setAncestors("0");
|
||||
} else {
|
||||
RegionV2 pOrg = regionV2Mapper.selectOne(new LambdaQueryWrapper<RegionV2>()
|
||||
.eq(RegionV2::getId, regionV2.getParentRegion()));
|
||||
regionV2.setAncestors(pOrg.getAncestors() + "," + pOrg.getId());
|
||||
}
|
||||
baseMapper.insert(regionV2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void edit(RegionV2 regionV2) {
|
||||
RegionV2 oldPo = baseMapper.selectById(regionV2.getId());
|
||||
if (oldPo == null) {
|
||||
throw new OpenAlertException("区域不存在");
|
||||
}
|
||||
if (!Objects.equals(oldPo.getParentRegion(), regionV2.getParentRegion())) {
|
||||
if (Objects.equals(regionV2.getId(), regionV2.getParentRegion())) {
|
||||
throw new OpenAlertException("不能将区域移动到其自身");
|
||||
}
|
||||
List<RegionV2> children = baseMapper.getChildren(regionV2.getId());
|
||||
for (RegionV2 child : children) {
|
||||
if (child.getId().equals(regionV2.getParentRegion())) {
|
||||
throw new OpenAlertException("不能将区域移动到其自身下级");
|
||||
}
|
||||
}
|
||||
RegionV2 pOrg = regionV2Mapper.selectById(regionV2.getParentRegion());
|
||||
// 修改子区域
|
||||
boolean top = regionV2.getParentRegion() == null || regionV2.getParentRegion() == 0;
|
||||
if (top) {
|
||||
regionV2.setParentRegion(0L);
|
||||
regionV2.setAncestors("0");
|
||||
} else {
|
||||
if (pOrg == null) {
|
||||
throw new OpenAlertException("上级区域不存在");
|
||||
}
|
||||
regionV2.setAncestors(pOrg.getAncestors() + "," + pOrg.getId());
|
||||
}
|
||||
baseMapper.updateAncestors(oldPo.getAncestors(), regionV2.getAncestors(), regionV2.getProjectSn(), regionV2.getId());
|
||||
baseMapper.updateById(regionV2);
|
||||
} else {
|
||||
regionV2.setAncestors(null);
|
||||
baseMapper.updateById(regionV2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(String id) {
|
||||
RegionV2 regionV2 = baseMapper.selectById(id);
|
||||
if (regionV2 == null) {
|
||||
throw new OpenAlertException("未找到对应实体");
|
||||
}
|
||||
baseMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RegionV2 queryById(String id) {
|
||||
RegionV2 entity = baseMapper.queryById(id);
|
||||
if (entity == null) {
|
||||
throw new OpenAlertException("未找到对应实体");
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<RegionV2Vo> treePage(HashMap<String, Object> paramMap) {
|
||||
int pageNo = Integer.parseInt(paramMap.getOrDefault("pageNo", 1).toString());
|
||||
int pageSize = Integer.parseInt(paramMap.getOrDefault("pageSize", 10).toString());
|
||||
if (pageSize < 0) {
|
||||
pageSize = Integer.MAX_VALUE;
|
||||
}
|
||||
List<RegionV2Vo> list = this.queryList(paramMap);
|
||||
List<RegionV2Vo> vos = BeanUtil.copyToList(ListUtils.listToTree(JSONArray.parseArray(JSON.toJSONString(list)), "id", "parentRegion", "children"), RegionV2Vo.class);
|
||||
IPage<RegionV2Vo> p = new Page<>();
|
||||
int i = cn.hutool.core.util.PageUtil.getStart(pageNo - 1, pageSize);
|
||||
p.setTotal(vos.size());
|
||||
p.setRecords(CollUtil.sub(vos, i, i + pageSize));
|
||||
p.setCurrent(pageNo);
|
||||
p.setSize(pageSize);
|
||||
return p;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RegionV2> getChildren(Long id) {
|
||||
return baseMapper.getChildren(id);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.zhgd.xmgl.modules.risk.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zhgd.xmgl.modules.risk.entity.RiskListSourceResponsibilityRegion;
|
||||
import com.zhgd.xmgl.modules.risk.mapper.RiskListSourceResponsibilityRegionMapper;
|
||||
import com.zhgd.xmgl.modules.risk.service.IRiskListSourceResponsibilityRegionService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Description: 管控清单危险源绑定的具体责任区域
|
||||
* @author: pds
|
||||
* @date: 2025-08-07
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class RiskListSourceResponsibilityRegionServiceImpl extends ServiceImpl<RiskListSourceResponsibilityRegionMapper, RiskListSourceResponsibilityRegion> implements IRiskListSourceResponsibilityRegionService {
|
||||
}
|
||||
@ -19,10 +19,8 @@ import com.zhgd.xmgl.modules.basicdata.service.INoticeService;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.ISystemUserService;
|
||||
import com.zhgd.xmgl.modules.quality.entity.vo.QualityRegionVo;
|
||||
import com.zhgd.xmgl.modules.quality.service.IQualityRegionService;
|
||||
import com.zhgd.xmgl.modules.risk.entity.RiskListPoint;
|
||||
import com.zhgd.xmgl.modules.risk.entity.RiskListSource;
|
||||
import com.zhgd.xmgl.modules.risk.entity.RiskListSourceUnbuilt;
|
||||
import com.zhgd.xmgl.modules.risk.entity.RiskListWorkable;
|
||||
import com.zhgd.xmgl.modules.risk.entity.*;
|
||||
import com.zhgd.xmgl.modules.risk.entity.dto.RiskListSourceDto;
|
||||
import com.zhgd.xmgl.modules.risk.entity.vo.CountRisksByLevelVo;
|
||||
import com.zhgd.xmgl.modules.risk.entity.vo.RiskListLibraryVo;
|
||||
import com.zhgd.xmgl.modules.risk.entity.vo.RiskListSourceVo;
|
||||
@ -59,6 +57,9 @@ public class RiskListSourceServiceImpl extends ServiceImpl<RiskListSourceMapper,
|
||||
private RiskListSourceMapper riskListSourceMapper;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private IRiskListSourceResponsibilityRegionService riskListSourceResponsibilityRegionService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private IXzSecurityQualityInspectionRecordService xzSecurityQualityInspectionRecordService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
@ -291,13 +292,34 @@ public class RiskListSourceServiceImpl extends ServiceImpl<RiskListSourceMapper,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(RiskListSource riskListSource) {
|
||||
public void add(RiskListSourceDto riskListSource) {
|
||||
riskListSource.setId(null);
|
||||
baseMapper.insert(riskListSource);
|
||||
saveBindData(riskListSource.getId(), riskListSource.getSpecificResponsibilityAreaIds());
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存绑定的数据
|
||||
*
|
||||
* @param sourceId
|
||||
* @param specificResponsibilityAreaIds
|
||||
*/
|
||||
@Override
|
||||
public void saveBindData(Long sourceId, String specificResponsibilityAreaIds) {
|
||||
riskListSourceResponsibilityRegionService.remove(new LambdaQueryWrapper<RiskListSourceResponsibilityRegion>()
|
||||
.eq(RiskListSourceResponsibilityRegion::getSourceId, sourceId));
|
||||
if (StrUtil.isNotBlank(specificResponsibilityAreaIds)) {
|
||||
for (String rid : StrUtil.split(specificResponsibilityAreaIds, ",")) {
|
||||
RiskListSourceResponsibilityRegion region = new RiskListSourceResponsibilityRegion();
|
||||
region.setRegionId(Long.valueOf(rid));
|
||||
region.setSourceId(sourceId);
|
||||
riskListSourceResponsibilityRegionService.save(region);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void edit(RiskListSource source) {
|
||||
public void edit(RiskListSourceDto source) {
|
||||
RiskListSource oldRiskListSource = baseMapper.selectById(source.getId());
|
||||
if (oldRiskListSource == null) {
|
||||
throw new OpenAlertException("未找到对应实体");
|
||||
@ -316,6 +338,7 @@ public class RiskListSourceServiceImpl extends ServiceImpl<RiskListSourceMapper,
|
||||
.set(RiskListSource::getEffectiveTimeEnd, source.getEffectiveTimeEnd())
|
||||
.eq(RiskListSource::getId, source.getId())
|
||||
);
|
||||
saveBindData(source.getId(), source.getSpecificResponsibilityAreaIds());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -341,7 +364,7 @@ public class RiskListSourceServiceImpl extends ServiceImpl<RiskListSourceMapper,
|
||||
@Override
|
||||
public List<RiskUndoneVo> getUndoneList(HashMap<String, Object> param) {
|
||||
String sourceId = MapUtils.getString(param, "sourceId");
|
||||
RiskListSource source = this.getById(sourceId);
|
||||
RiskListSourceVo source = this.queryById(sourceId);
|
||||
List<XzSecurityQualityInspectionRecordVo> securityList = xzSecurityQualityInspectionRecordService.selectQualityInspectionRecordPage(new MapBuilder<String, Object>()
|
||||
.put("type", 10)
|
||||
.put("engineeringId", sourceId)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user