From 3c8f3a7b74f62a9053cd9d860d8f1d37454712eb Mon Sep 17 00:00:00 2001 From: 郑永安 <zyazyz250@sina.com> Date: 星期一, 04 九月 2023 17:53:59 +0800 Subject: [PATCH] back --- src/main/java/com/gk/hotwork/Service/ServiceImpl/SafetySelfInspectionImpl.java | 70 +++++++++++++++++++++++++++++++++-- 1 files changed, 66 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/gk/hotwork/Service/ServiceImpl/SafetySelfInspectionImpl.java b/src/main/java/com/gk/hotwork/Service/ServiceImpl/SafetySelfInspectionImpl.java index eeab821..1a8b085 100644 --- a/src/main/java/com/gk/hotwork/Service/ServiceImpl/SafetySelfInspectionImpl.java +++ b/src/main/java/com/gk/hotwork/Service/ServiceImpl/SafetySelfInspectionImpl.java @@ -5,6 +5,7 @@ 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.CompanyStatisticInspectionDO; import com.gk.hotwork.Domain.Do.SafetySelfInspectionItemQualifiedCountDO; import com.gk.hotwork.Domain.Exception.BusinessException; import com.gk.hotwork.Domain.Utils.BeanUtils; @@ -413,12 +414,19 @@ 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)) { for (ElementTree elementA : elementTreeList) { - List<SafetySelfInspectionItem> selectElementList = itemList.stream().filter(item -> item.getElementA().equals(elementA.getValue())).collect(Collectors.toList()); + List<SafetySelfInspectionItem> selectElementList = itemList + .stream() + .filter(item -> item.getElementA() != null && + item.getElementA().equals(elementA.getValue())) + .collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(selectElementList)) { SafetySelfInspectionElementRespDTO elementARespDTO = new SafetySelfInspectionElementRespDTO(); elementARespDTO.setElementId(elementA.getValue()); @@ -446,7 +454,9 @@ //无三级要素过滤出二级要素检查内容 List<SafetySelfInspectionItem> sItemList = itemList .stream() - .filter(item -> item.getElementC() == null && item.getElementB().equals(stree.getValue())) + .filter(item -> item.getElementC() == null + && item.getElementB() != null + && item.getElementB().equals(stree.getValue())) .collect(Collectors.toList()); //填充检查项 elementBRespDTO.setItemList(assemblyDeduction(sItemList)); @@ -621,7 +631,9 @@ //否决 合格--删除扣分记录 safetySelfInspectionItemDeductionMapper.delBySafetySelfInspectionItemId(param.getId(),username,date); //删除隐患 - dangerService.delByInspectionItemId(param.getSafetyInspectionItemId(),user); + dangerService.delByInspectionItemId(param.getId(),user); + //删除附件 + attachmentInfoService.deleteByBusinessId(param.getId()); }else{ //扣分 List<SafetySelfInspectionItemDeduction> list = safetySelfInspectionItemDeductionMapper.getBySafetySelfInspectionItemId(param.getId()); @@ -673,7 +685,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()); @@ -719,6 +731,7 @@ safetySelfInspection.setStatus(2); safetySelfInspection.setUpdateTime(date); safetySelfInspection.setUpdateBy(username); + safetySelfInspection.setInspectionEndTime(new Date()); safetySelfInspectionMapper.updateById(safetySelfInspection); } @@ -731,6 +744,55 @@ 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); + } + + @Override + public Date selectLastTimeByCompanyId(Long companyId,Date startTime,Date endTime) { + SafetySelfInspection inspection = safetySelfInspectionMapper.selectOne(new LambdaQueryWrapper<SafetySelfInspection>() + .eq(SafetySelfInspection::getValidFlag,1) + .eq(SafetySelfInspection::getFlag, 2) + .eq(SafetySelfInspection::getCheckedCompanyId, companyId) + .ge(startTime != null,SafetySelfInspection::getInspectionTime,startTime) + .le(endTime != null,SafetySelfInspection::getInspectionTime,endTime) + .orderByDesc(SafetySelfInspection::getInspectionTime) + .last("limit 1")); + if(inspection != null){ + return inspection.getInspectionTime(); + } + return null; + + } + + @Override + public CompanyStatisticInspectionDO companyStatisticInspection(Map<String, Object> params) { + + return safetySelfInspectionMapper.companyStatisticInspection(params); + } + + 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不能为空"); + } + } + + } + /** * 查询验证 * 验证对象存在 -- Gitblit v1.9.2