zf
2023-08-30 9ca0dc6e7833715b875cc9b6b91d5c497b2bae8b
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("附件信息为空");