| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.gk.hotwork.Domain.*; |
| | | import com.gk.hotwork.Domain.Do.CompanyInspectionCountDO; |
| | | import com.gk.hotwork.Domain.Do.SafetySelfInspectionItemQualifiedCountDO; |
| | | import com.gk.hotwork.Domain.Exception.BusinessException; |
| | | import com.gk.hotwork.Domain.Utils.PageInfo; |
| | | import com.gk.hotwork.Domain.Utils.StringUtils; |
| | | import com.gk.hotwork.Domain.dto.resp.InspectionHiddenDangerRespDTO; |
| | | import com.gk.hotwork.Domain.query.CountQuery; |
| | | import com.gk.hotwork.Mapper.InspectionExpertMapper; |
| | | import com.gk.hotwork.Mapper.InspectionHiddenDangerMapper; |
| | | import com.gk.hotwork.Service.AttachmentInfoService; |
| | |
| | | |
| | | 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(","); |
| | | } |
| | |
| | | |
| | | 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()); |
| | | } |
| | | } |
| | | |
| | |
| | | inspectionHiddenDanger.setUpdateBy(userInfo.getRealname()); |
| | | inspectionHiddenDanger.setUpdateTime(new Date()); |
| | | inspectionHiddenDangerMapper.delByInspectionItemId(inspectionHiddenDanger); |
| | | |
| | | } |
| | | |
| | | @Override |
| | |
| | | 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; |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 统计 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<CompanyInspectionCountDO> getStatisticHiddenDanger(CountQuery query) { |
| | | |
| | | return inspectionHiddenDangerMapper.getStatisticHiddenDanger(query); |
| | | } |
| | | |
| | | private void modrequiredVerification(InspectionHiddenDanger inspectionHiddenDanger){ |