郑永安
2023-08-23 41cb87d6749d744ddd4e21d1aa47bb363cf5678b
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不能为空");
            }
        }
    }
    /**
     * 查询验证
     * 验证对象存在