榕图bug修复

This commit is contained in:
guo 2023-12-21 15:52:28 +08:00
parent ae4bd6bc38
commit 0eb850c8f1
15 changed files with 254 additions and 965 deletions

View File

@ -1,142 +0,0 @@
package com.zhgd.xmgl.modules.rt.controller;
import com.zhgd.annotation.OperLog;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.xmgl.modules.rt.entity.RtRiskInventoryConcrete;
import com.zhgd.xmgl.modules.rt.service.IRtRiskInventoryTypeConcreteService;
import com.zhgd.xmgl.util.MessageUtil;
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.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* @Title: Controller
* @Description: 榕图-风险清册具体项
* @author pds
* @date 2020-10-21
* @version V1.0
*/
@RestController
@RequestMapping("/xmgl/rtRiskInventoryConcrete")
@Slf4j
@Api(tags = "榕图-风险清册具体项")
public class RtRiskInventoryConcreteController {
@Autowired
private IRtRiskInventoryTypeConcreteService rtRiskInventoryConcreteService;
/**
* 分页列表查询
*
* @return
*/
@ApiOperation(value = "列表查询榕图-风险安全库-作业风险及条件具体项信息", notes = "列表查询榕图-风险安全库-作业风险及条件具体项信息—子项信息", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "projectSn", value = "项目唯一标识", paramType = "query", required = true, dataType = "String"),
@ApiImplicitParam(name = "rtRiskInventoryTypeId", value = "榕图-风险安全库-作业类型、工序及部位ID", paramType = "榕图-风险安全库-作业类型、工序及部位ID", required = true, dataType = "String"),
@ApiImplicitParam(name = "recordStatus", value = "是否仅显示启用的1是0否", paramType = "query", required = false, dataType = "String"),
})
@PostMapping(value = "/list")
public Result<List<RtRiskInventoryConcrete>> selectRtRiskInventoryConcreteList(@RequestBody Map<String, Object> map) {
List<RtRiskInventoryConcrete> pageList = rtRiskInventoryConcreteService.selectRtRiskInventoryConcreteList(map);
return Result.success(pageList);
}
/**
* 分页列表查询
*
* @return
*/
@ApiOperation(value = "列表查询榕图-风险安全库-作业风险及条件具体项信息", notes = "列表查询榕图-风险安全库-作业风险及条件具体项信息", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "rtRiskInventoryTypeId", value = "榕图-风险安全库-作业类型、工序及部位ID", paramType = "榕图-风险安全库-作业类型、工序及部位ID", required = true, dataType = "String"),
})
@PostMapping(value = "/selectCompanyRtRiskInventoryConcreteList")
public Result<List<RtRiskInventoryConcrete>> selectCompanyRtRiskInventoryConcreteList(@RequestBody Map<String, Object> map) {
List<RtRiskInventoryConcrete> pageList = rtRiskInventoryConcreteService.selectCompanyRtRiskInventoryConcreteList(map);
return Result.success(pageList);
}
/**
* 添加
*
* @param rtRiskInventoryConcrete
* @return
*/
@OperLog(operModul = "质量管理", operType = "添加榕图-风险安全库-作业风险及条件具体项", operDesc = "添加榕图-风险安全库-作业风险及条件具体项信息")
@ApiOperation(value = "添加榕图-风险安全库-作业风险及条件具体项信息", notes = "添加榕图-风险安全库-作业风险及条件具体项信息", httpMethod = "POST")
@PostMapping(value = "/add")
public Result<RtRiskInventoryConcrete> add(@RequestBody RtRiskInventoryConcrete rtRiskInventoryConcrete) {
Result<RtRiskInventoryConcrete> result = new Result<RtRiskInventoryConcrete>();
try {
rtRiskInventoryConcrete.setCreateTime(new Date());
rtRiskInventoryConcreteService.save(rtRiskInventoryConcrete);
result.successMsg(MessageUtil.get("addSucess"));
} catch (Exception e) {
e.printStackTrace();
log.info(e.getMessage());
result.error500(MessageUtil.get("failErr"));
}
return result;
}
/**
* 编辑
*
* @param rtRiskInventoryConcrete
* @return
*/
@OperLog(operModul = "质量管理", operType = "编辑榕图-风险安全库-作业风险及条件具体项", operDesc = "编辑榕图-风险安全库-作业风险及条件具体项信息")
@ApiOperation(value = "编辑榕图-风险安全库-作业风险及条件具体项信息", notes = "编辑榕图-风险安全库-作业风险及条件具体项信息", httpMethod = "POST")
@PostMapping(value = "/edit")
public Result<RtRiskInventoryConcrete> edit(@RequestBody RtRiskInventoryConcrete rtRiskInventoryConcrete) {
Result<RtRiskInventoryConcrete> result = new Result<RtRiskInventoryConcrete>();
RtRiskInventoryConcrete rtRiskInventoryConcreteEntity = rtRiskInventoryConcreteService.getById(rtRiskInventoryConcrete.getId());
if (rtRiskInventoryConcreteEntity == null) {
result.error500(MessageUtil.get("notFindErr"));
} else {
boolean ok = rtRiskInventoryConcreteService.updateById(rtRiskInventoryConcrete);
if (ok) {
result.successMsg(MessageUtil.get("editSucess"));
}
}
return result;
}
/**
* 通过id删除
*
* @param
* @return
*/
@OperLog(operModul = "质量管理", operType = "删除榕图-风险安全库-作业风险及条件具体项", operDesc = "删除榕图-风险安全库-作业风险及条件具体项信息")
@ApiOperation(value = "删除榕图-风险安全库-作业风险及条件具体项信息", notes = "删除榕图-风险安全库-作业风险及条件具体项信息", httpMethod = "POST")
@ApiImplicitParam(name = "id", value = "榕图-风险安全库-作业风险及条件具体项ID", paramType = "query", required = true, dataType = "Integer")
@PostMapping(value = "/delete")
public Result<RtRiskInventoryConcrete> delete(@RequestBody Map<String, Object> map) {
Result<RtRiskInventoryConcrete> result = new Result<RtRiskInventoryConcrete>();
RtRiskInventoryConcrete rtRiskInventoryConcrete = rtRiskInventoryConcreteService.getById(MapUtils.getString(map, "id"));
if (rtRiskInventoryConcrete == null) {
result.error500(MessageUtil.get("notFindErr"));
} else {
boolean ok = rtRiskInventoryConcreteService.removeById(MapUtils.getString(map, "id"));
if (ok) {
result.successMsg(MessageUtil.get("deleteSucess"));
}
}
return result;
}
}

View File

@ -1,98 +1,68 @@
package com.zhgd.xmgl.modules.rt.controller;
import com.zhgd.annotation.OperLog;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.xmgl.modules.rt.entity.RtRiskInventoryType;
import com.zhgd.xmgl.modules.rt.service.IRtRiskInventoryTypeConcreteService;
import com.zhgd.xmgl.modules.rt.service.IRtRiskInventoryTypeService;
import com.zhgd.xmgl.util.MessageUtil;
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.poi.util.IOUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ClassPathResource;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import io.swagger.annotations.ApiImplicitParams;
import java.util.HashMap;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.util.List;
import java.util.Map;
import com.zhgd.jeecg.common.api.vo.Result;
import org.apache.commons.collections.MapUtils;
import org.simpleframework.xml.core.Validate;
import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* @Title: Controller
* @Description: 榕图-风险清册类型
* @author pds
* @date 2020-10-21
* @date 2023-12-21
* @version V1.0
*/
@RestController
@RequestMapping("/xmgl/rtRiskInventoryType")
@Slf4j
@Api(tags = "榕图-风险清册类型")
@Api(tags = "榕图-风险清册类型相关Api")
public class RtRiskInventoryTypeController {
@Autowired
private IRtRiskInventoryTypeService rtRiskInventoryTypeService;
@Autowired
private IRtRiskInventoryTypeConcreteService rtRiskInventoryConcreteService;
/**
* 分页列表查询
*
* @return
*/
@ApiOperation(value = "分组查询榕图-风险安全库-作业类型、工序及部位信息", notes = "分组查询榕图-风险安全库-作业类型、工序及部位信息", httpMethod = "POST")
@ApiOperation(value = "分页列表查询榕图-风险清册类型信息", notes = "分页列表查询榕图-风险清册类型信息", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "projectSn", value = "项目唯一标识", paramType = "query", required = true, dataType = "String"),
@ApiImplicitParam(name = "name", value = "名称", paramType = "query", required = false, dataType = "String"),
@ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "query", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "query", required = true, dataType = "Integer"),
})
@PostMapping(value = "/list")
public Result<List<RtRiskInventoryType>> selectDangerTypeList(@RequestBody Map<String, Object> map) {
return Result.success(rtRiskInventoryTypeService.selectDangerTypeList(map));
@GetMapping(value = "/page")
public Result<IPage<RtRiskInventoryType>> queryPageList(@ApiIgnore @RequestParam HashMap<String, Object> paramMap) {
return Result.success(rtRiskInventoryTypeService.queryPageList(paramMap));
}
@ApiOperation(value = "分组查询榕图-风险安全库-作业类型、工序及部位以及子项", notes = "分组查询榕图-风险安全库-作业类型、工序及部位以及子项", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "projectSn", value = "项目唯一标识", paramType = "query", required = true, dataType = "String"),
@ApiImplicitParam(name = "name", value = "质量问题名称", paramType = "榕图-风险安全库-作业类型、工序及部位ID", required = false, dataType = "String"),
})
@PostMapping(value = "/selectRtRiskInventoryTypeAndItemList")
public Result<List<RtRiskInventoryType>> selectDangerTypeAndItemList(@RequestBody Map<String, Object> map) {
return Result.success(rtRiskInventoryTypeService.selectDangerTypeAndItemList(map));
}
@ApiOperation(value = "质量管理——榕图-风险清册类型,获取大项列表", notes = "质量管理——榕图-风险清册类型,获取大项列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String")
})
@GetMapping(value = "/getBigList")
public Result<List<RtRiskInventoryType>> getBigList(String projectSn) {
return Result.success(rtRiskInventoryTypeService.getBigList(projectSn));
}
/**
* 分页列表查询
* 列表查询
*
* @return
*/
@ApiOperation(value = "分组查询榕图-风险安全库-作业类型、工序及部位信息", notes = "分组查询榕图-风险安全库-作业类型、工序及部位信息", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "query", required = true, dataType = "String"),
@ApiImplicitParam(name = "name", value = "质量问题名称", paramType = "榕图-风险安全库-作业类型、工序及部位ID", required = false, dataType = "String"),
})
@PostMapping(value = "/selectRtRiskInventoryTypeList")
public Result<List<RtRiskInventoryType>> selectCompanyDangerTypeList(@RequestBody Map<String, Object> map) {
return Result.success(rtRiskInventoryTypeService.selectCompanyDangerTypeList(map));
@ApiOperation(value = "列表查询榕图-风险清册类型信息", notes = "列表查询榕图-风险清册类型信息", httpMethod = "GET")
@GetMapping(value = "/list")
public Result<List<RtRiskInventoryType>> queryList(@ApiIgnore @RequestParam HashMap<String, Object> paramMap) {
return Result.success(rtRiskInventoryTypeService.queryList(paramMap));
}
/**
@ -101,20 +71,11 @@ public class RtRiskInventoryTypeController {
* @param rtRiskInventoryType
* @return
*/
@OperLog(operModul = "质量管理", operType = "添加榕图-风险安全库-作业类型、工序及部位信息", operDesc = "添加榕图-风险安全库-作业类型、工序及部位信息")
@ApiOperation(value = "添加榕图-风险安全库-作业类型、工序及部位信息", notes = "添加榕图-风险安全库-作业类型、工序及部位信息", httpMethod = "POST")
@ApiOperation(value = "添加榕图-风险清册类型信息", notes = "添加榕图-风险清册类型信息", httpMethod = "POST")
@PostMapping(value = "/add")
public Result<RtRiskInventoryType> add(@RequestBody RtRiskInventoryType rtRiskInventoryType) {
Result<RtRiskInventoryType> result = new Result<RtRiskInventoryType>();
try {
rtRiskInventoryTypeService.save(rtRiskInventoryType);
result.successMsg(MessageUtil.get("addSucess"));
} catch (Exception e) {
e.printStackTrace();
log.info(e.getMessage());
result.error500(MessageUtil.get("failErr"));
}
return result;
public Result<RtRiskInventoryType> add(@RequestBody @Validate RtRiskInventoryType rtRiskInventoryType) {
rtRiskInventoryTypeService.add(rtRiskInventoryType);
return Result.ok();
}
/**
@ -123,18 +84,31 @@ public class RtRiskInventoryTypeController {
* @param rtRiskInventoryType
* @return
*/
@OperLog(operModul = "质量管理", operType = "编辑榕图-风险安全库-作业类型、工序及部位信息", operDesc = "编辑榕图-风险安全库-作业类型、工序及部位信息")
@ApiOperation(value = "编辑榕图-风险安全库-作业类型、工序及部位信息", notes = "编辑榕图-风险安全库-作业类型、工序及部位信息", httpMethod = "POST")
@ApiOperation(value = "编辑榕图-风险清册类型信息", notes = "编辑榕图-风险清册类型信息", httpMethod = "POST")
@PostMapping(value = "/edit")
public Result<RtRiskInventoryType> edit(@RequestBody RtRiskInventoryType rtRiskInventoryType) {
rtRiskInventoryTypeService.edit(rtRiskInventoryType);
return Result.ok();
}
/**
* 通过id删除
*
* @return
*/
@ApiOperation(value = "删除榕图-风险清册类型信息", notes = "删除榕图-风险清册类型信息", httpMethod = "POST")
@ApiImplicitParam(name = "id", value = "榕图-风险清册类型ID", paramType = "body", required = true, dataType = "String", example = "{\"id\":\"1\"}")
@PostMapping(value = "/delete")
public Result<RtRiskInventoryType> delete(@ApiIgnore @RequestBody HashMap<String, Object> map) {
String id = MapUtils.getString(map, "id");
Result<RtRiskInventoryType> result = new Result<RtRiskInventoryType>();
RtRiskInventoryType rtRiskInventoryTypeEntity = rtRiskInventoryTypeService.getById(rtRiskInventoryType.getId());
if (rtRiskInventoryTypeEntity == null) {
result.error500(MessageUtil.get("notFindErr"));
RtRiskInventoryType rtRiskInventoryType = rtRiskInventoryTypeService.getById(id);
if (rtRiskInventoryType == null) {
result.error500("未找到对应实体");
} else {
boolean ok = rtRiskInventoryTypeService.updateById(rtRiskInventoryType);
boolean ok = rtRiskInventoryTypeService.removeById(id);
if (ok) {
result.successMsg(MessageUtil.get("editSucess"));
result.success("删除成功!");
}
}
@ -142,45 +116,24 @@ public class RtRiskInventoryTypeController {
}
/**
* 删除检查库节点
* 通过id查询
*
* @param id
* @return
*/
@ApiOperation(value = "删除检查库节点", notes = "删除检查库节点")
@ApiImplicitParam(name = "id", value = "类型id", paramType = "query", required = true, dataType = "long")
@GetMapping(value = "/deleteByRtRiskInventoryTypeId")
public Result<RtRiskInventoryType> deleteByrtRiskInventoryTypeId(Long id) {
rtRiskInventoryTypeService.deleteRecordById(id);
return Result.ok();
@ApiOperation(value = "通过id查询榕图-风险清册类型信息", notes = "通过id查询榕图-风险清册类型信息", httpMethod = "GET")
@ApiImplicitParam(name = "id", value = "榕图-风险清册类型ID", paramType = "query", required = true, dataType = "Integer")
@GetMapping(value = "/queryById")
public Result<RtRiskInventoryType> queryById(@RequestParam(name = "id", required = true) String id) {
Result<RtRiskInventoryType> result = new Result<RtRiskInventoryType>();
RtRiskInventoryType rtRiskInventoryType = rtRiskInventoryTypeService.getById(id);
if (rtRiskInventoryType == null) {
result.error500("未找到对应实体");
} else {
result.setResult(rtRiskInventoryType);
result.setSuccess(true);
}
return result;
}
@ApiOperation(value = "模板导入下载", notes = "模板导入下载")
@GetMapping("/downloadRtRiskInventoryTypeExcelTemplate")
public void downloadRtRiskInventoryTypeExcelTemplate(HttpServletResponse response) {
try {
OutputStream out = response.getOutputStream();
response.setCharacterEncoding("UTF-8");
response.setContentType("application/vnd.ms-excel;charset=gb2312");
response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode("质量检查模板_导入模板.xlsx", "UTF-8"));
InputStream fis = new ClassPathResource("excel/风险安全库导入模板.xlsx").getInputStream();
IOUtils.copy(fis, out);
out.flush();
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
@ApiOperation(value = "模板导入", notes = "模板导入")
@ApiImplicitParams({
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "query", required = true, dataType = "String"),
@ApiImplicitParam(name = "excelFile", value = "导入文件", paramType = "query", required = true, dataType = "String"),
})
@PostMapping(value = "/importRtRiskInventoryTypeExcelTemplate")
public Result importRtRiskInventoryTypeExcelTemplate(MultipartFile excelFile, String projectSn) throws Exception {
rtRiskInventoryTypeService.importRtRiskInventoryTypeExcelTemplate(excelFile, projectSn);
return Result.ok();
}
}

View File

@ -1,83 +0,0 @@
package com.zhgd.xmgl.modules.rt.entity;
import java.io.Serializable;
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 2020-10-21
* @version V1.0
*/
@Data
@TableName("rt_risk_inventory_concrete")
@ApiModel(value = "RtRiskInventoryConcrete实体类", description = "RtRiskInventoryConcrete")
public class RtRiskInventoryConcrete implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "id")
private java.lang.Long id;
/**
* 榕图-风险清册类型ID
*/
@Excel(name = "榕图-风险清册类型ID", width = 15)
@ApiModelProperty(value = "榕图-风险清册类型ID")
private java.lang.Long rtRiskInventoryTypeId;
/**
* 编码
*/
@Excel(name = "编码", width = 15)
@ApiModelProperty(value = "编码")
private java.lang.String itemCode;
/**
* 风险可能导致的后果
*/
@Excel(name = "风险可能导致的后果", width = 15)
@ApiModelProperty(value = "风险可能导致的后果")
private java.lang.String riskPossibleConsequence;
/**
* 风险评定值D
*/
@Excel(name = "风险评定值D", width = 15)
@ApiModelProperty(value = "风险评定值D")
private java.lang.String riskAssessmentValueD;
/**
* 风险级别
*/
@Excel(name = "风险级别", width = 15)
@ApiModelProperty(value = "风险级别")
private java.lang.String riskLevel;
/**
* 风险控制关键因素
*/
@Excel(name = "风险控制关键因素", width = 15)
@ApiModelProperty(value = "风险控制关键因素")
private java.lang.String keyFactorsInRiskControl;
/**
* 预防措施
*/
@Excel(name = "预防措施", width = 15)
@ApiModelProperty(value = "预防措施")
private java.lang.String precaution;
/**
* 创建时间
*/
@Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间")
private java.util.Date createTime;
}

View File

@ -1,10 +1,9 @@
package com.zhgd.xmgl.modules.rt.entity;
import java.io.Serializable;
import java.util.List;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@ -17,7 +16,7 @@ import io.swagger.annotations.ApiModelProperty;
/**
* @Description: 榕图-风险清册类型
* @author pds
* @date 2020-10-21
* @date 2023-12-21
* @version V1.0
*/
@Data
@ -82,14 +81,34 @@ public class RtRiskInventoryType implements Serializable {
@Excel(name = "排序", width = 15)
@ApiModelProperty(value = "排序")
private java.lang.Integer orderSort;
@TableField(exist = false)
private List<RtRiskInventoryType> list;
@TableField(exist = false)
private List<RtRiskInventoryType> children;
@TableField(exist = false)
private List<RtRiskInventoryConcrete> itemList;
/**
* 风险可能导致的后果
*/
@Excel(name = "风险可能导致的后果", width = 15)
@ApiModelProperty(value = "风险可能导致的后果")
private java.lang.String riskPossibleConsequence;
/**
* 风险评定值D
*/
@Excel(name = "风险评定值D", width = 15)
@ApiModelProperty(value = "风险评定值D")
private java.lang.String riskAssessmentValueD;
/**
* 风险级别
*/
@Excel(name = "风险级别", width = 15)
@ApiModelProperty(value = "风险级别")
private java.lang.String riskLevel;
/**
* 风险控制关键因素
*/
@Excel(name = "风险控制关键因素", width = 15)
@ApiModelProperty(value = "风险控制关键因素")
private java.lang.String keyFactorsInRiskControl;
/**
* 预防措施
*/
@Excel(name = "预防措施", width = 15)
@ApiModelProperty(value = "预防措施")
private java.lang.Object precaution;
}

View File

@ -187,6 +187,9 @@ public class RtWorkTicket implements Serializable {
@ApiModelProperty(value = "项目sn")
private java.lang.String projectSn;
@ApiModelProperty(value = "榕图-风险安全库-作业类型、工序及部位Json")
private String rtRiskSecurityLibraryTypeJson;
@TableField(exist = false)
@ApiModelProperty(value = "榕图-风险安全库-作业类型、工序及部位idList")
private List<String> rtRiskSecurityLibraryTypeIdList;

View File

@ -1,15 +0,0 @@
package com.zhgd.xmgl.modules.rt.entity.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
@Data
@ApiModel(value = "DepartmentRectifiedRankDto")
public class DepartmentRectifiedRankDto {
@ApiModelProperty(value = "项目sn")
@NotBlank
private String projectSn;
}

View File

@ -1,25 +0,0 @@
package com.zhgd.xmgl.modules.rt.mapper;
import java.util.List;
import java.util.Map;
import com.zhgd.xmgl.modules.rt.entity.RtRiskInventoryConcrete;
import org.apache.ibatis.annotations.Mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: 榕图-风险清册具体项
* @author pds
* @date 2020-10-21
* @version V1.0
*/
@Mapper
public interface RtRiskInventoryConcreteMapper extends BaseMapper<RtRiskInventoryConcrete> {
List<RtRiskInventoryConcrete> selectRtRiskInventoryConcreteList(Map<String, Object> map);
List<RtRiskInventoryConcrete> selectCompanyRtRiskInventoryConcreteList(Map<String, Object> map);
List<RtRiskInventoryConcrete> selectProjectDangerItemList(Map<String, Object> map);
}

View File

@ -1,32 +1,16 @@
package com.zhgd.xmgl.modules.rt.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhgd.xmgl.modules.rt.entity.RtRiskInventoryType;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: 质量问题库
* @Description: 榕图-风险清册类型
* @author pds
* @date 2020-10-21
* @date 2023-12-21
* @version V1.0
*/
@Mapper
public interface RtRiskInventoryTypeMapper extends BaseMapper<RtRiskInventoryType> {
List<RtRiskInventoryType> selectChildDangerTypeList(Map<String, Object> map);
List<RtRiskInventoryType> selectCompanyDangerTypeList(Map<String, Object> map);
List<RtRiskInventoryType> selectCompanyChildDangerTypeList(Map<String, Object> map);
List<RtRiskInventoryType> getBigList(Map<String, Object> map);
int deleteRecordById(Long id);
void updateRtRiskInventoryTypeFullName(@Param("oldFullName") String oldFullName, @Param("newFullName") String fullName, @Param("projectSn") String projectSn);
}

View File

@ -1,34 +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.rt.mapper.RtRiskInventoryConcreteMapper">
<select id="selectRtRiskInventoryConcreteList"
resultType="com.zhgd.xmgl.modules.rt.entity.RtRiskInventoryConcrete">
SELECT IFNULL(b.record_status,0) record_status,a.*
from rt_risk_inventory_concrete a LEFT JOIN
(SELECT * FROM project_danger_type_disable WHERE project_sn=#{projectSn} and type=2) b ON b.danger_type_id=a.id
WHERE a.rt_risk_inventory_type_id=#{rtRiskInventoryTypeId}
<if test="recordStatus == '1'.toString()">
and IFNULL(b.record_status,0)=0
</if>
ORDER BY a.order_sort
</select>
<select id="selectCompanyRtRiskInventoryConcreteList"
resultType="com.zhgd.xmgl.modules.rt.entity.RtRiskInventoryConcrete">
SELECT a.*
from rt_risk_inventory_concrete a
WHERE a.rt_risk_inventory_type_id=#{rtRiskInventoryTypeId}
ORDER BY a.order_sort
</select>
<select id="selectProjectDangerItemList"
resultType="com.zhgd.xmgl.modules.rt.entity.RtRiskInventoryConcrete">
SELECT a.*,
IFNULL(b.record_status, 0) record_status
from rt_risk_inventory_concrete a
INNER JOIN rt_risk_inventory_type t ON a.rt_risk_inventory_type_id = t.id
LEFT JOIN
(SELECT * FROM project_danger_type_disable WHERE project_sn = #{projectSn} and type = 2) b
ON b.danger_type_id = a.id
WHERE t.project_sn = #{headquartersSn}
and IFNULL(b.record_status, 0) = 0
</select>
</mapper>

View File

@ -1,91 +1,5 @@
<?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.rt.mapper.RtRiskInventoryTypeMapper">
<delete id="deleteRecordById">
delete dtr,dtr2,dir
from rt_risk_inventory_type as dtr
left join rt_risk_inventory_type dtr2 on dtr2.parent_id = dtr.id
left join rt_risk_inventory_concrete as dir on dtr.id = dir.rt_risk_inventory_type_id or
dir.rt_risk_inventory_type_id =
dtr2.id
where dtr.id = #{id}
</delete>
<select id="selectChildDangerTypeList" resultType="com.zhgd.xmgl.modules.rt.entity.RtRiskInventoryType">
SELECT a.id,
a.`code`,
a.create_time,
a.name,
a.`level`,
a.order_sort,
a.parent_id,
IFNULL(b.record_status, 0) record_status
from rt_risk_inventory_type a
LEFT JOIN (SELECT *
FROM project_danger_type_disable
WHERE project_sn = #{projectSn}
and type = 1) b ON b.danger_type_id = a.id
WHERE a.parent_id != 0
and a.project_sn = #{projectSn}
<if test="recordStatus == '0'.toString()">
and b.record_status IS null
</if>
ORDER BY a.parent_id, a.order_sort
</select>
<select id="selectCompanyDangerTypeList" resultType="com.zhgd.xmgl.modules.rt.entity.RtRiskInventoryType">
SELECT a.id,
a.`code`,
a.create_time,
a.name,
a.`level`,
a.order_sort,
a.parent_id
from rt_risk_inventory_type a
WHERE a.parent_id = 0
and a.project_sn = #{projectSn}
ORDER BY a.parent_id, a.order_sort
</select>
<select id="selectCompanyChildDangerTypeList"
resultType="com.zhgd.xmgl.modules.rt.entity.RtRiskInventoryType">
SELECT a.id,
a.`code`,
a.create_time,
a.name,
a.`level`,
a.order_sort,
a.parent_id
from rt_risk_inventory_type a
WHERE a.parent_id != 0
and a.project_sn = #{projectSn}
ORDER BY a.parent_id, a.order_sort
</select>
<select id="getBigList" resultType="com.zhgd.xmgl.modules.rt.entity.RtRiskInventoryType">
SELECT a.id,
a.`code`,
a.create_time,
a.name,
a.`level`,
a.order_sort,
a.parent_id,
IFNULL(b.record_status, 0) record_status
from rt_risk_inventory_type a
LEFT JOIN (SELECT *
FROM project_danger_type_disable
WHERE project_sn = #{projectSn}
and type = 1) b ON b.danger_type_id = a.id
WHERE a.parent_id = 0
and a.project_sn = #{projectSn}
<if test="recordStatus == '0'.toString()">
and b.record_status IS null
</if>
ORDER BY a.parent_id, a.order_sort
</select>
<update id="updateRtRiskInventoryTypeFullName">
UPDATE rt_risk_inventory_type
SET full_name=REPLACE(full_name, #{oldFullName}, #{newFullName})
WHERE full_name LIKE N'${oldFullName}%'
and project_sn = #{projectSn};
</update>
</mapper>

View File

@ -1,22 +0,0 @@
package com.zhgd.xmgl.modules.rt.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zhgd.xmgl.modules.rt.entity.RtRiskInventoryConcrete;
import java.util.List;
import java.util.Map;
/**
* @Description: 榕图-风险清册具体项
* @author pds
* @date 2020-10-21
* @version V1.0
*/
public interface IRtRiskInventoryTypeConcreteService extends IService<RtRiskInventoryConcrete> {
List<RtRiskInventoryConcrete> selectRtRiskInventoryConcreteList(Map<String, Object> map);
List<RtRiskInventoryConcrete> selectCompanyRtRiskInventoryConcreteList(Map<String, Object> map);
}

View File

@ -1,29 +1,25 @@
package com.zhgd.xmgl.modules.rt.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zhgd.xmgl.modules.rt.entity.RtRiskInventoryType;
import org.springframework.web.multipart.MultipartFile;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Description: 质量问题库
* @Description: 榕图-风险清册类型
* @author pds
* @date 2020-10-21
* @date 2023-12-21
* @version V1.0
*/
public interface IRtRiskInventoryTypeService extends IService<RtRiskInventoryType> {
List<RtRiskInventoryType> selectDangerTypeList(Map<String, Object> map);
IPage<RtRiskInventoryType> queryPageList(HashMap<String, Object> paramMap);
List<RtRiskInventoryType> selectCompanyDangerTypeList(Map<String, Object> map);
List<RtRiskInventoryType> queryList(HashMap<String, Object> paramMap);
List<RtRiskInventoryType> selectDangerTypeAndItemList(Map<String, Object> map);
void add(RtRiskInventoryType rtRiskInventoryType);
List<RtRiskInventoryType> getBigList(String projectSn);
void deleteRecordById(Long id);
void importRtRiskInventoryTypeExcelTemplate(MultipartFile excelFile, String projectSn) throws Exception;
void edit(RtRiskInventoryType rtRiskInventoryType);
}

View File

@ -1,40 +0,0 @@
package com.zhgd.xmgl.modules.rt.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhgd.xmgl.modules.rt.entity.RtRiskInventoryConcrete;
import com.zhgd.xmgl.modules.rt.mapper.RtRiskInventoryConcreteMapper;
import com.zhgd.xmgl.modules.rt.mapper.RtRiskInventoryTypeMapper;
import com.zhgd.xmgl.modules.rt.service.IRtRiskInventoryTypeConcreteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
/**
* @Description: 榕图-风险清册具体项
* @author pds
* @date 2020-10-21
* @version V1.0
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class RtRiskInventoryTypeConcreteServiceImpl extends ServiceImpl<RtRiskInventoryConcreteMapper, RtRiskInventoryConcrete> implements IRtRiskInventoryTypeConcreteService {
@Autowired
private RtRiskInventoryTypeMapper rtRiskInventoryTypeMapper;
@Autowired
private RtRiskInventoryConcreteMapper rtRiskInventoryConcreteMapper;
@Override
public List<RtRiskInventoryConcrete> selectRtRiskInventoryConcreteList(Map<String, Object> map) {
return rtRiskInventoryConcreteMapper.selectRtRiskInventoryConcreteList(map);
}
@Override
public List<RtRiskInventoryConcrete> selectCompanyRtRiskInventoryConcreteList(Map<String, Object> map) {
return rtRiskInventoryConcreteMapper.selectCompanyRtRiskInventoryConcreteList(map);
}
}

View File

@ -1,32 +1,27 @@
package com.zhgd.xmgl.modules.rt.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhgd.jeecg.common.execption.OpenAlertException;
import com.zhgd.xmgl.modules.project.mapper.ProjectMapper;
import com.zhgd.xmgl.modules.rt.entity.RtRiskInventoryConcrete;
import com.zhgd.xmgl.modules.rt.entity.RtRiskInventoryType;
import com.zhgd.xmgl.modules.rt.mapper.RtRiskInventoryConcreteMapper;
import com.zhgd.xmgl.modules.rt.mapper.RtRiskInventoryTypeMapper;
import com.zhgd.xmgl.modules.rt.service.IRtRiskInventoryTypeService;
import com.zhgd.xmgl.util.ExcelUtils;
import com.zhgd.xmgl.util.MessageUtil;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
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.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.xmgl.util.PageUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.io.InputStream;
import java.util.*;
import java.util.stream.Collectors;
import java.util.HashMap;
import java.util.List;
import com.zhgd.xmgl.util.RefUtil;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
/**
* @Description: 质量问题库
* @Description: 榕图-风险清册类型
* @author pds
* @date 2020-10-21
* @date 2023-12-21
* @version V1.0
*/
@Service
@ -34,255 +29,41 @@ import java.util.stream.Collectors;
public class RtRiskInventoryTypeServiceImpl extends ServiceImpl<RtRiskInventoryTypeMapper, RtRiskInventoryType> implements IRtRiskInventoryTypeService {
@Autowired
private RtRiskInventoryTypeMapper rtRiskInventoryTypeMapper;
@Autowired
private RtRiskInventoryConcreteMapper rtRiskInventoryConcreteMapper;
@Autowired
private ProjectMapper projectMapper;
@Override
public List<RtRiskInventoryType> selectDangerTypeList(Map<String, Object> map) {
String name = MapUtils.getString(map, "name");
List<RtRiskInventoryType> list = rtRiskInventoryTypeMapper.getBigList(map);
List<RtRiskInventoryType> childList = rtRiskInventoryTypeMapper.selectChildDangerTypeList(map);
list = getChildrenList(list, childList, name);
public IPage<RtRiskInventoryType> queryPageList(HashMap<String, Object> paramMap) {
QueryWrapper<RtRiskInventoryType> queryWrapper = getQueryWrapper(paramMap);
Page<RtRiskInventoryType> page = PageUtil.getPage(paramMap);
IPage<RtRiskInventoryType> pageList = this.page(page, queryWrapper);
pageList.setRecords(dealList(pageList.getRecords()));
return pageList;
}
@Override
public List<RtRiskInventoryType> queryList(HashMap<String, Object> paramMap) {
QueryWrapper<RtRiskInventoryType> queryWrapper = getQueryWrapper(paramMap);
return dealList(this.list(queryWrapper));
}
private QueryWrapper<RtRiskInventoryType> getQueryWrapper(HashMap<String, Object> paramMap) {
String alias = "";
QueryWrapper<RtRiskInventoryType> queryWrapper = QueryGenerator.initPageQueryWrapper(RtRiskInventoryType.class, paramMap, alias);
queryWrapper.orderByDesc(alias + RefUtil.fieldNameUlc(RtRiskInventoryType::getId));
return queryWrapper;
}
private List<RtRiskInventoryType> dealList(List<RtRiskInventoryType> list) {
return list;
}
@Override
public List<RtRiskInventoryType> selectDangerTypeAndItemList(Map<String, Object> map) {
String name = MapUtils.getString(map, "name");
//Integer recordStatus = MapUtils.getInteger(map, "recordStatus");
//只显示开启的状态的
//if (Objects.equal(recordStatus, 0)) {
// map.put("open", 1);
//}
List<RtRiskInventoryType> list = rtRiskInventoryTypeMapper.getBigList(map);
List<RtRiskInventoryType> childList = rtRiskInventoryTypeMapper.selectChildDangerTypeList(map);
String headquartersSn = projectMapper.getHeadquartersSnByProject(MapUtils.getString(map, "projectSn"));
map.put("headquartersSn", headquartersSn);
List<RtRiskInventoryConcrete> itemList = rtRiskInventoryConcreteMapper.selectProjectDangerItemList(map);
if (childList.size() > 0) {
for (RtRiskInventoryType data : childList) {
List<RtRiskInventoryConcrete> tempList = new ArrayList<>();
if (itemList != null && itemList.size() > 0) {
for (RtRiskInventoryConcrete itemRecord : itemList) {
if (data.getId().equals(itemRecord.getRtRiskInventoryTypeId())) {
tempList.add(itemRecord);
}
}
}
data.setItemList(tempList);
}
}
list = getChildrenList(list, childList, name);
//排序
list = list.stream().sorted((o1, o2) -> o1.getId().compareTo(o2.getId())).collect(Collectors.toList());
for (RtRiskInventoryType entityMap : list) {
List<RtRiskInventoryType> children = entityMap.getChildren();
if (children != null) {
entityMap.setChildren(children.stream().sorted((o1, o2) -> o1.getId().compareTo(o2.getId())).collect(Collectors.toList()));
}
}
return list;
public void add(RtRiskInventoryType rtRiskInventoryType) {
rtRiskInventoryType.setId(null);
baseMapper.insert(rtRiskInventoryType);
}
@Override
public List<RtRiskInventoryType> getBigList(String projectSn) {
HashMap<String, Object> map = new HashMap<>();
map.put("projectSn", projectSn);
return rtRiskInventoryTypeMapper.getBigList(map);
}
@Override
public void deleteRecordById(Long id) {
rtRiskInventoryTypeMapper.deleteRecordById(id);
}
@Override
public void importRtRiskInventoryTypeExcelTemplate(MultipartFile excelFile, String projectSn) throws Exception {
InputStream is = excelFile.getInputStream();
List<Map<String, String>> list = ExcelUtils.jxlExlToList(is, 0);
if (list == null || list.size() == 0) {
throw new OpenAlertException(MessageUtil.get("excelNotDataErr"));
}
Map<String, RtRiskInventoryType> libraryObj = new HashMap<>();
//for (Map<String, String> importInfo : list) {
// if (importInfo == null || importInfo.get("编码") == null || importInfo.get("编码").equals("")) {
// continue;
// }
// String code = importInfo.get("编码").trim();
// String typeName = importInfo.get("作业类型、工序及部位");
// String newCode = CodeUtils.subCode(code);
// if (StringUtils.isNotEmpty(typeName)) {
// //榕图-风险清册类型
// QueryWrapper<RtRiskInventoryType> queryWrapper = new QueryWrapper<>();
// queryWrapper.lambda().eq(RtRiskInventoryType::getProjectSn, projectSn)
// .eq(RtRiskInventoryType::getCode, code);
// RtRiskInventoryType type = rtRiskInventoryTypeMapper.selectOne(queryWrapper);
// if (type != null) {
// if (!type.getName().equals(typeName)) {
// String oldFullName = type.getFullName();
// if (type.getParentId() != 0) {
// RtRiskInventoryType parentHiddenDangerLibrary = rtRiskInventoryTypeMapper.selectById(type.getParentId());
// type.setFullName(parentHiddenDangerLibrary.getFullName() + "/" + type.getName());
// type.setLevel(2);
// } else {
// type.setFullName(type.getName());
// type.setLevel(1);
// }
// rtRiskInventoryTypeMapper.updateById(type);
// //更新子级层级名称
// rtRiskInventoryTypeMapper.updateRtRiskInventoryTypeFullName(oldFullName, type.getFullName(), type.getProjectSn());
// }
// libraryObj.put(type.getCode(), type);
// } else {
// RtRiskInventoryType newHiddenDangerLibrary = new RtRiskInventoryType();
// newHiddenDangerLibrary.setCreateTime(new Date());
// newHiddenDangerLibrary.setCode(code);
// newHiddenDangerLibrary.setProjectSn(projectSn);
// newHiddenDangerLibrary.setName(typeName);
// RtRiskInventoryType parentHiddenDangerLibrary = libraryObj.get(newCode);
// if (parentHiddenDangerLibrary == null) {
// newHiddenDangerLibrary.setParentId(0L);
// newHiddenDangerLibrary.setFullName(typeName);
// newHiddenDangerLibrary.setLevel(1);
// } else {
// newHiddenDangerLibrary.setParentId(parentHiddenDangerLibrary.getId());
// newHiddenDangerLibrary.setFullName(parentHiddenDangerLibrary.getFullName() + "/" + typeName);
// newHiddenDangerLibrary.setLevel(2);
// }
// rtRiskInventoryTypeMapper.insert(newHiddenDangerLibrary);
// libraryObj.put(code, newHiddenDangerLibrary);
// }
// } else {
// //榕图-风险清册具体项
// String jobPrerequisite = importInfo.get("作业必备条件");
// String operationProcessRiskControlMeasure = importInfo.get("作业过程风险控制措施");
// String changeLimit = importInfo.get("整改时限(天)");
// if (StringUtils.isEmpty(changeLimit)) {
// changeLimit = "0";
// }
// String rectifyRequire = importInfo.get("整改要求");
// RtRiskInventoryType hiddenDangerLibrary = libraryObj.get(newCode);
// QueryWrapper<RtRiskInventoryConcrete> queryWrapper = new QueryWrapper<>();
// queryWrapper.lambda().eq(RtRiskInventoryConcrete::getRtRiskInventoryTypeId, hiddenDangerLibrary.getId())
// .eq(RtRiskInventoryConcrete::getItemCode, code);
// RtRiskInventoryConcrete itemRecord = rtRiskInventoryTypeConcreteMapper.selectOne(queryWrapper);
// if (itemRecord == null) {
// itemRecord = new RtRiskInventoryConcrete();
// itemRecord.setRtRiskInventoryTypeId();
// itemRecord.setRiskPossibleConsequence();
// itemRecord.setRiskAssessmentValueD();
// itemRecord.setRiskLevel();
// itemRecord.setKeyFactorsInRiskControl();
// itemRecord.setPrecaution();
// itemRecord.setItemCode(code);
// rtRiskInventoryTypeConcreteMapper.insert(itemRecord);
// } else {
// itemRecord.setItemCode(code);
// rtRiskInventoryTypeConcreteMapper.updateById(itemRecord);
// }
// }
//}
}
private List<RtRiskInventoryType> getChildrenList(List<RtRiskInventoryType> list, List<RtRiskInventoryType> childList, String name) {
List<RtRiskInventoryType> dataList = new ArrayList<>();
for (RtRiskInventoryType map1 : list) {
List<RtRiskInventoryType> tempList = new ArrayList<>();
for (RtRiskInventoryType map2 : childList) {
if (map1.getId().equals(map2.getParentId())) {
List<RtRiskInventoryType> typeList = getChildList(String.valueOf(map2.getId()), childList, name);
map2.setChildren(typeList);
if (StringUtils.isNotEmpty(name)) {
if (map2.getName().indexOf(name) > -1) {
tempList.add(map2);
} else {
if (typeList.size() > 0) {
tempList.add(map2);
}
}
} else {
tempList.add(map2);
}
}
}
map1.setChildren(tempList);
if (StringUtils.isNotEmpty(name)) {
if (map1.getName().indexOf(name) > -1) {
dataList.add(map1);
} else {
if (tempList.size() > 0) {
dataList.add(map1);
}
}
} else {
dataList.add(map1);
}
}
return dataList;
}
@Override
public List<RtRiskInventoryType> selectCompanyDangerTypeList(Map<String, Object> map) {
String name = MapUtils.getString(map, "name");
List<RtRiskInventoryType> list = rtRiskInventoryTypeMapper.selectCompanyDangerTypeList(map);
List<RtRiskInventoryType> childList = rtRiskInventoryTypeMapper.selectCompanyChildDangerTypeList(map);
list = groupList(list, childList, name);
return list;
}
private List<RtRiskInventoryType> groupList(List<RtRiskInventoryType> list, List<RtRiskInventoryType> childList, String name) {
List<RtRiskInventoryType> dataList = new ArrayList<>();
for (RtRiskInventoryType map1 : list) {
List<RtRiskInventoryType> tempList = new ArrayList<>();
for (RtRiskInventoryType map2 : childList) {
if (map1.getId().equals(map2.getParentId())) {
List<RtRiskInventoryType> typeList = getChildList(String.valueOf(map2.getId()), childList, name);
map2.setList(typeList);
if (StringUtils.isNotEmpty(name)) {
if (map2.getName().indexOf(name) > -1) {
tempList.add(map2);
} else {
if (typeList.size() > 0) {
tempList.add(map2);
}
}
} else {
tempList.add(map2);
}
}
}
map1.setList(tempList);
if (StringUtils.isNotEmpty(name)) {
if (map1.getName().indexOf(name) > -1) {
dataList.add(map1);
} else {
if (tempList.size() > 0) {
dataList.add(map1);
}
}
} else {
dataList.add(map1);
}
}
return dataList;
}
private List<RtRiskInventoryType> getChildList(String id, List<RtRiskInventoryType> childList, String name) {
List<RtRiskInventoryType> tempList = new ArrayList<>();
for (RtRiskInventoryType map2 : childList) {
if (id.equals(map2.getParentId())) {
if (StringUtils.isNotEmpty(name)) {
if (map2.getName().indexOf(name) > -1) {
tempList.add(map2);
}
} else {
tempList.add(map2);
}
}
}
return tempList;
public void edit(RtRiskInventoryType rtRiskInventoryType) {
baseMapper.updateById(rtRiskInventoryType);
}
}