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 | 37 ++++++++++++++++++++++++++++++++++--- 1 files changed, 34 insertions(+), 3 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 c8548a1..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; @@ -421,7 +422,11 @@ 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()); @@ -449,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)); @@ -624,7 +631,7 @@ //否决 合格--删除扣分记录 safetySelfInspectionItemDeductionMapper.delBySafetySelfInspectionItemId(param.getId(),username,date); //删除隐患 - dangerService.delByInspectionItemId(param.getSafetyInspectionItemId(),user); + dangerService.delByInspectionItemId(param.getId(),user); //删除附件 attachmentInfoService.deleteByBusinessId(param.getId()); }else{ @@ -724,6 +731,7 @@ safetySelfInspection.setStatus(2); safetySelfInspection.setUpdateTime(date); safetySelfInspection.setUpdateBy(username); + safetySelfInspection.setInspectionEndTime(new Date()); safetySelfInspectionMapper.updateById(safetySelfInspection); } @@ -747,6 +755,29 @@ 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("附件信息为空"); -- Gitblit v1.9.2