src/main/java/com/gk/hotwork/Config/Cors/MyMvcConfigurer.java
@@ -32,7 +32,11 @@ @Value("${emergencyPlanPath}") private String emergencyPlanPath; @Value("${file.path.dcPath}") private String dcPath; @Value("${file.path.urlRootPath}") private String urlRootPath; @Override @@ -70,6 +74,7 @@ .addResourceLocations("file:" + taskPath); registry.addResourceHandler("/upload/emergencyPlan/**") .addResourceLocations("file:" + emergencyPlanPath); registry.addResourceHandler("/uploadfile/**") .addResourceLocations("file:" + dcPath); } } src/main/java/com/gk/hotwork/Controller/AttachmentController.java
@@ -79,7 +79,7 @@ @ApiImplicitParams({ @ApiImplicitParam(name = "id",value = "文件id") }) @DeleteMapping("/delete/{id}") @GetMapping("/delete/{id}") public Msg delete(@PathVariable Long id) { Msg msg = new Msg(); msg.setCode("200"); src/main/java/com/gk/hotwork/Controller/InspectionHiddenDangerController.java
@@ -76,6 +76,7 @@ @ApiImplicitParam(name = "inspectionStartTime",value = "开始时间"), @ApiImplicitParam(name = "inspectionEndTime",value = "结束时间"), @ApiImplicitParam(name = "flag",value = "检查类型"), @ApiImplicitParam(name = "rectificationStatus",value = "整改状态"), }) public Msg selectPage(@RequestBody FilterObject filterObject) { src/main/java/com/gk/hotwork/Controller/SafetySelfInspectionController.java
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.gk.hotwork.Controller.Base.BaseController; import com.gk.hotwork.Domain.AttachmentInfo; import com.gk.hotwork.Domain.SafetySelfInspection; import com.gk.hotwork.Domain.SafetySelfInspectionItem; import com.gk.hotwork.Domain.Utils.FilterObject; @@ -126,6 +127,15 @@ safetySelfInspectionService.addItemExpert(itemList, getUser()); return success(); } @ApiOperation("/添加检查清单附件") @PostMapping("/add/check/attachment") @ApiImplicitParams({ @ApiImplicitParam(name = "attachmentList",value = "附件集合"), }) public Msg addCheckAttachment(@RequestBody List<AttachmentInfo> attachmentList) { safetySelfInspectionService.addCheckAttachment(attachmentList, getUser()); return success(); } @ApiOperation("/新增") src/main/java/com/gk/hotwork/Controller/UserController.java
@@ -180,7 +180,10 @@ if (StringUtils.isNotBlank(job)){ condition.put("job",job.trim()); } Integer type = getUser().getType(); if(type.equals(3)){ condition.put("companyid",getUser().getCompanyid()); } pageInfo.setCondition(condition); userService.selectCompanyUserDataGrid(pageInfo); src/main/java/com/gk/hotwork/Domain/InspectionHiddenDanger.java
@@ -47,7 +47,7 @@ /** 最后更新人 update_by **/ private String updateBy; /** * 整改状态 0未整改,1已整改 * 整改状态 -1未整改,1已整改 */ private Byte status; /** @@ -72,8 +72,11 @@ private String reviewMethod; @TableField(exist = false) private String veto; //附件 //隐患附件 @TableField(exist = false) private List<AttachmentInfo> attachmentList; //整改附件 @TableField(exist = false) private List<AttachmentInfo> rattachmentList; } src/main/java/com/gk/hotwork/Domain/SafetySelfInspection.java
@@ -118,11 +118,23 @@ @TableField(exist = false) private Integer majorCount; /** * 整改状态 0未整改 1部分整改 2全部整改 * 整改状态 -1未整改 1部分整改 2全部整改 */ @TableField(exist = false) private Integer rectificationStatus; //检查清单附件 @TableField(exist = false) private List<AttachmentInfo> attachmentList; public List<AttachmentInfo> getAttachmentList() { return attachmentList; } public void setAttachmentList(List<AttachmentInfo> attachmentList) { this.attachmentList = attachmentList; } public List<InspectionExpert> getExpertList() { return expertList; } src/main/java/com/gk/hotwork/Domain/SafetySelfInspectionDO.java
对比新文件 @@ -0,0 +1,112 @@ package com.gk.hotwork.Domain; 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 com.fasterxml.jackson.annotation.JsonFormat; import com.gk.hotwork.Domain.dto.resp.SafetySelfInspectionElementRespDTO; import lombok.Data; import java.io.Serializable; import java.util.Date; import java.util.List; @Data public class SafetySelfInspectionDO { /** 自查清单名称 inspection_name **/ private String inspectionName; /** 检查时间 inspection_time **/ @JsonFormat(pattern="yyyy-MM-dd",timezone = "GMT+8") private Date inspectionTime; /** 检察人员 inspector **/ private Long inspector; /** 被检查公司id **/ private Long checkedCompanyId; /** 被检查公司名字 **/ private String checkedCompanyName; /** 状态 0:暂存 1:评审中 2:已评审 status **/ private Integer status; /** 不合格项数 **/ @TableField(exist = false) private Integer unqualifiedItem; /** 项数 **/ @TableField(exist = false) private Integer itemSum; /** 合格率 **/ private String qualifiedRate; /** 角色id **/ private Long roleid; /** 检察人员 **/ private String inspectorName; /** 检查开始时间 **/ @JsonFormat(pattern="yyyy-MM-dd",timezone = "GMT+8") private Date inspectionStartTime; /** 检查结束时间 **/ @JsonFormat(pattern="yyyy-MM-dd",timezone = "GMT+8") private Date inspectionEndTime; /** 主键id id **/ @TableId(type = IdType.AUTO) private Long id; /** 有效标识 valid_flag **/ private Boolean validFlag; /** 创建时间 create_time **/ private Date createTime; /** 创建人 create_by **/ private String createBy; /** 最新更新时间 update_time **/ private Date updateTime; /** 最后更新人 update_by **/ private String updateBy; //检查标识 2自查,1监管检查 private Byte flag; /** 检查单位 **/ private String checkUnit; /** * 隐患总数 */ private Integer hdTocalCount; /** * 已整改数量 */ private Integer rectifyCount; /** * 未整改数量 */ private Integer unRectifyCount; /** * 一般隐患数量 */ private Integer sameAsCount; /** * 重大隐患数量 */ private Integer majorCount; /** * 整改状态 -1未整改 1部分整改 2全部整改 */ private Integer rectificationStatus; } src/main/java/com/gk/hotwork/Domain/dto/resp/SafetySelfInspectionRespDTO.java
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.fasterxml.jackson.annotation.JsonFormat; import com.gk.hotwork.Domain.AttachmentInfo; import lombok.Data; import java.util.Date; @@ -81,4 +82,9 @@ private String updateBy; List<SafetySelfInspectionElementRespDTO> elementList; //检查清单附件 private List<AttachmentInfo> attachmentList; } src/main/java/com/gk/hotwork/Mapper/AttachmentInfoMapper.java
@@ -17,4 +17,6 @@ void saveBatch(List<AttachmentInfo> attachmentList); void updateBusinessIdBatch(List<AttachmentInfo> attachmentList); void deleteByBusinessId(Long businessId); } src/main/java/com/gk/hotwork/Mapper/InspectionHiddenDangerMapper.java
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.gk.hotwork.Domain.InspectionHiddenDanger; import com.gk.hotwork.Domain.SafetySelfInspection; import com.gk.hotwork.Domain.SafetySelfInspectionDO; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; @@ -19,11 +20,11 @@ */ @Repository public interface InspectionHiddenDangerMapper extends BaseMapper<InspectionHiddenDanger> { void delByInspectionItemId(InspectionHiddenDanger inspectionHiddenDanger); void delByInspectionItemId(@Param("inspectionHiddenDanger") InspectionHiddenDanger inspectionHiddenDanger); void delByIds(List<Long> idList); IPage<SafetySelfInspection> selectPages(Page<SafetySelfInspection> page, @Param("params") Map<String, Object> params); IPage<SafetySelfInspectionDO> selectPages(Page<SafetySelfInspection> page, @Param("params") Map<String, Object> params); List<InspectionHiddenDanger> inspectionHdangerlist(Long selfInspectionId); } src/main/java/com/gk/hotwork/Mapper/mybatis/AttachmentInfoMapper.xml
@@ -11,11 +11,17 @@ </foreach> </insert> <update id="updateBusinessIdBatch"> <foreach collection="attachmentList" item="attachment"> <foreach collection="attachmentList" item="attachment" separator=";"> update attachment set business_id = #{attachment.id} business_id = #{attachment.businessId} where id = #{attachment.id} </foreach> </update> <update id="deleteByBusinessId"> update attachment set del_flag = 1 where business_id = #{businessId} </update> </mapper> src/main/java/com/gk/hotwork/Mapper/mybatis/CompanyInfoMapper.xml
@@ -86,8 +86,7 @@ <where>1=1 and isdel = 0 and province is null or province = '' and province in(null,'') </where>) c <where> 1=1 src/main/java/com/gk/hotwork/Mapper/mybatis/InspectionHiddenDangerMapper.xml
@@ -16,34 +16,56 @@ </update> <select id="selectPages" resultType="com.gk.hotwork.Domain.SafetySelfInspection"> <select id="selectPages" resultType="com.gk.hotwork.Domain.SafetySelfInspectionDO"> SELECT s.* l.* FROM safety_self_inspection s LEFT JOIN inspection_hidden_danger h ON s.id = h.self_inspection_id left join company as co on s.checked_company_id = co.id ( SELECT t.*, ( CASE WHEN t.unrectifyCount = 0 THEN -1 WHEN t.unrectifyCount = t.hdTocalCount THEN 2 ELSE 1 END ) rectificationStatus FROM ( SELECT s.*, count( h.`status` = -1 OR NULL ) unRectifyCount, count( h.`status` = 1 OR NULL ) rectifyCount, count( h.`status` ) hdTocalCount, count( h.LEVEL = 1 OR NULL ) sameAsCount, count( h.LEVEL = 2 OR NULL ) majorCount FROM safety_self_inspection s LEFT JOIN inspection_hidden_danger h ON s.id = h.self_inspection_id WHERE s.valid_flag = 1 AND h.valid_flag = 1 AND h.id IS NOT NULL s.valid_flag = 1 AND h.valid_flag = 1 AND h.id IS NOT NULL GROUP BY s.id ) t ) l LEFT JOIN company AS co ON l.checked_company_id = co.id where 1=1 <if test="params.inspectionName != null and params.inspectionName != ''"> and s.inspection_name like concat("%",#{params.inspectionName},"%") and l.inspection_name like concat("%",#{params.inspectionName},"%") </if> <if test="params.checkedCompanyId != null and params.checkedCompanyId != ''"> and s.checked_company_id like concat("%",#{params.checkedCompanyId},"%") and l.checked_company_id = #{params.checkedCompanyId} </if> <if test="params.checkedCompanyName != null and params.checkedCompanyName != ''"> and s.checked_company_name like concat("%",#{params.checkedCompanyName},"%") and l.checked_company_name like concat("%",#{params.checkedCompanyName},"%") </if> <if test="params.flag != null and params.flag != '' "> and s.flag = #{params.flag} and l.flag = #{params.flag} </if> <if test="params.rectificationStatus != null and params.rectificationStatus != '' "> and l.rectificationStatus = #{params.rectificationStatus} </if> <if test="params.inspectionStartTime != null and params.inspectionStartTime != ''" > and s.inspection_time <![CDATA[ >= ]]> #{params.inspectionStartTime} and l.inspection_time <![CDATA[ >= ]]> #{params.inspectionStartTime} </if> <if test="params.inspectionEndTime != null and params.inspectionEndTime != ''" > and s.inspection_time <![CDATA[ <= ]]> #{params.inspectionEndTime} and l.inspection_time <![CDATA[ <= ]]> #{params.inspectionEndTime} </if> <if test="params.province != null and params.province != ''" > and co.province = #{params.province} @@ -54,9 +76,7 @@ <if test="params.area != null and params.area != ''" > and co.area = #{params.area} </if> GROUP BY s.id ORDER BY s.create_time ORDER BY l.create_time </select> <select id="inspectionHdangerlist" resultType="com.gk.hotwork.Domain.InspectionHiddenDanger"> SELECT src/main/java/com/gk/hotwork/Mapper/mybatis/UserInfoMapper.xml
@@ -211,6 +211,9 @@ <if test="record.roleId != null"> and r.roleid = #{record.roleId} </if> <if test="record.companyid != null"> and c.id = #{record.companyid} </if> </where> </select> <select id="selectSuperviseUserDataList" resultMap="UserVo"> src/main/java/com/gk/hotwork/Service/AttachmentInfoService.java
@@ -30,4 +30,5 @@ void updateBusinessIdBatch(List<AttachmentInfo> attachmentList); void deleteByBusinessId(Long businessId); } src/main/java/com/gk/hotwork/Service/SafetySelfInspectionService.java
@@ -3,6 +3,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; import com.gk.hotwork.Domain.AttachmentInfo; import com.gk.hotwork.Domain.SafetySelfInspection; import com.gk.hotwork.Domain.SafetySelfInspectionItem; import com.gk.hotwork.Domain.UserInfo; @@ -51,4 +52,6 @@ void addItemExpert(List<SafetySelfInspectionItem> itemList, UserInfo user); void addCheckAttachment(List<AttachmentInfo> attachmentList, UserInfo user); } src/main/java/com/gk/hotwork/Service/ServiceImpl/AttachmentInfoServiceImpl.java
@@ -48,7 +48,7 @@ @Override public List<AttachmentInfo> findByIds(List<Long> ids) { return attachmentInfoMapper.selectList(new LambdaQueryWrapper<AttachmentInfo>() .in(AttachmentInfo::getBusinessId,ids) .in(AttachmentInfo::getId,ids) .eq(AttachmentInfo::getDelFlag,0)); } @@ -79,5 +79,10 @@ public void updateBusinessIdBatch(List<AttachmentInfo> attachmentList) { attachmentInfoMapper.updateBusinessIdBatch(attachmentList); } @Override public void deleteByBusinessId(Long businessId) { attachmentInfoMapper.deleteByBusinessId(businessId); } } src/main/java/com/gk/hotwork/Service/ServiceImpl/InspectionHiddenDangerServiceImpl.java
@@ -53,8 +53,8 @@ StringBuffer stringBuffer = new StringBuffer(); //附件 if(CollectionUtils.isNotEmpty(inspectionHiddenDanger.getAttachmentList())){ for (AttachmentInfo attachmentInfo : inspectionHiddenDanger.getAttachmentList()) { if(CollectionUtils.isNotEmpty(inspectionHiddenDanger.getRattachmentList())){ for (AttachmentInfo attachmentInfo : inspectionHiddenDanger.getRattachmentList()) { attachmentInfo.setBusinessId(inspectionHiddenDanger.getId()); stringBuffer.append(attachmentInfo.getId().toString()).append(","); } @@ -63,12 +63,11 @@ inspectionHiddenDanger.setUpdateTime(new Date()); inspectionHiddenDanger.setUpdateBy(userInfo.getRealname()); inspectionHiddenDanger.setUrl(stringBuffer.toString()); inspectionHiddenDanger.setRectificationUrl(stringBuffer.toString()); inspectionHiddenDangerMapper.updateById(inspectionHiddenDanger); //更新附件 if(CollectionUtils.isNotEmpty(inspectionHiddenDanger.getAttachmentList())){ attachmentInfoService.updateBusinessIdBatch(inspectionHiddenDanger.getAttachmentList()); if(CollectionUtils.isNotEmpty(inspectionHiddenDanger.getRattachmentList())){ attachmentInfoService.updateBusinessIdBatch(inspectionHiddenDanger.getRattachmentList()); } } @@ -82,6 +81,7 @@ inspectionHiddenDanger.setUpdateBy(userInfo.getRealname()); inspectionHiddenDanger.setUpdateTime(new Date()); inspectionHiddenDangerMapper.delByInspectionItemId(inspectionHiddenDanger); } @Override @@ -125,52 +125,36 @@ params.put("city",user.getCity()); params.put("area",user.getCounty()); } IPage<SafetySelfInspection> res = inspectionHiddenDangerMapper.selectPages(page, params); List<SafetySelfInspection> records = res.getRecords(); if (CollectionUtils.isNotEmpty(records)){ for (SafetySelfInspection inspection : records) { List<InspectionHiddenDanger> dangerList = this.getBySafetySelfInspectionId(inspection.getId()); //一般 1 int sameasCount = 0; //重大 2 int majorCount = 0; //总数 int totalCount = 0; //未整改数量 int unRectifyCount = 0; for (InspectionHiddenDanger inspectionHiddenDanger : dangerList) { if (inspectionHiddenDanger.getLevel().equals(1)) { sameasCount += 1; }else { majorCount += 1; } if(inspectionHiddenDanger.getStatus().equals((byte) 0)){ unRectifyCount += 1; } totalCount += 1; } inspection.setSameAsCount(sameasCount); inspection.setMajorCount(majorCount); inspection.setHdTocalCount(totalCount); if(unRectifyCount == 0){ inspection.setRectificationStatus(2); }else if(unRectifyCount == totalCount){ inspection.setRectificationStatus(0); }else { inspection.setRectificationStatus(1); } } res.setRecords(records); } IPage<SafetySelfInspectionDO> res = inspectionHiddenDangerMapper.selectPages(page, params); return res; } @Override public List<InspectionHiddenDanger> inspectionHdangerlist(Long selfInspectionId) { return inspectionHiddenDangerMapper.inspectionHdangerlist(selfInspectionId); List<InspectionHiddenDanger> inspectionHiddenDangerList = inspectionHiddenDangerMapper.inspectionHdangerlist(selfInspectionId); for (InspectionHiddenDanger inspectionHiddenDanger : inspectionHiddenDangerList) { if(StringUtils.isNotBlank(inspectionHiddenDanger.getRectificationUrl())){ List<Long> idList = new ArrayList<>(); String[] split = inspectionHiddenDanger.getRectificationUrl().split(","); for (String s : split) { idList.add(Long.valueOf(s)); } List<AttachmentInfo> byIds = attachmentInfoService.findByIds(idList); inspectionHiddenDanger.setRattachmentList(byIds); } if(StringUtils.isNotBlank(inspectionHiddenDanger.getUrl())){ List<Long> idList = new ArrayList<>(); String[] split = inspectionHiddenDanger.getUrl().split(","); for (String s : split) { idList.add(Long.valueOf(s)); } List<AttachmentInfo> byIds = attachmentInfoService.findByIds(idList); inspectionHiddenDanger.setAttachmentList(byIds); } } return inspectionHiddenDangerList; } private void modrequiredVerification(InspectionHiddenDanger inspectionHiddenDanger){ src/main/java/com/gk/hotwork/Service/ServiceImpl/SafetySelfInspectionImpl.java
@@ -413,6 +413,9 @@ List<SafetySelfInspectionItem> itemList= safetySelfInspectionItemMapper.getDetailBySafetySelfInspectionId(id,unqualified); //获取要素树 List<ElementTree> elementTreeList = elementManagementService.getMenuType1Tree(); //获取附件 List<AttachmentInfo> byBusinessId = attachmentInfoService.findByBusinessId(id); safetySelfInspectionRespDTO.setAttachmentList(byBusinessId); List<SafetySelfInspectionElementRespDTO> arespDTOList = new ArrayList<>(); if (CollectionUtils.isNotEmpty(elementTreeList)) { @@ -622,6 +625,8 @@ safetySelfInspectionItemDeductionMapper.delBySafetySelfInspectionItemId(param.getId(),username,date); //删除隐患 dangerService.delByInspectionItemId(param.getSafetyInspectionItemId(),user); //删除附件 attachmentInfoService.deleteByBusinessId(param.getId()); }else{ //扣分 List<SafetySelfInspectionItemDeduction> list = safetySelfInspectionItemDeductionMapper.getBySafetySelfInspectionItemId(param.getId()); @@ -673,7 +678,7 @@ inspectionHiddenDanger.setCreateTime(new Date()); inspectionHiddenDanger.setUpdateBy(user.getRealname()); inspectionHiddenDanger.setUpdateTime(new Date()); inspectionHiddenDanger.setStatus((byte)0); inspectionHiddenDanger.setStatus((byte)-1); inspectionHiddenDanger.setValidFlag(true); inspectionHiddenDanger.setSelfInspectionId(param.getSafetySelfInspectionId()); inspectionHiddenDanger.setSelfInspectionItemId(param.getId()); @@ -731,6 +736,32 @@ safetySelfInspectionItemMapper.updateBatch(itemList); } @Override public void addCheckAttachment(List<AttachmentInfo> attachmentList, UserInfo user) { requiredAttachmentVerification(attachmentList); for (AttachmentInfo attachmentInfo : attachmentList) { attachmentInfo.setUpdateTime(new Date()); attachmentInfo.setUpdateUid(user.getId()); attachmentInfo.setUpdateUname(user.getRealname()); } attachmentInfoService.updateBusinessIdBatch(attachmentList); } private void requiredAttachmentVerification(List<AttachmentInfo> attachmentList) { if(CollectionUtils.isEmpty(attachmentList)){ throw new BusinessException("附件信息为空"); } for (AttachmentInfo attachmentInfo : attachmentList) { if(attachmentInfo.getId() == null){ throw new BusinessException("附件主键信息不能为空"); } if(attachmentInfo.getBusinessId() == null){ throw new BusinessException("附件信息关联业务id不能为空"); } } } /** * 查询验证 * 验证对象存在