|  |  | 
 |  |  | import org.apache.xpath.operations.Bool; | 
 |  |  | import org.springframework.beans.BeanUtils; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.context.annotation.Bean; | 
 |  |  | import org.springframework.stereotype.Service; | 
 |  |  | import org.springframework.transaction.annotation.Transactional; | 
 |  |  |  | 
 |  |  | 
 |  |  |     private CarUseBookJoinMapper carUseBookJoinMapper; | 
 |  |  |     @Autowired | 
 |  |  |     private NoticesJoinMapper noticesJoinMapper; | 
 |  |  |     @Autowired | 
 |  |  |     private PlatformBooksMapper platformBooksMapper; | 
 |  |  |     @Autowired | 
 |  |  |     private PlatformJobMapper platformJobMapper; | 
 |  |  |     @Autowired | 
 |  |  |     private PlatformLogMapper platformLogMapper; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  | 
 |  |  |                                 &&Constants.equalsInteger(i.getSendacopy(),Constants.ZERO) | 
 |  |  |                         ).count() | 
 |  |  |                 ); | 
 |  |  |                 //已处理数据 | 
 |  |  |                 internalHomeVO.setNoticeDealNum( | 
 |  |  |                         noticesList.stream().filter(i->Constants.equalsInteger(i.getUserId(),memberId) | 
 |  |  |                                 &&StringUtils.equals(i.getParam4(),i.getUserId().toString()) | 
 |  |  |                                 &&Constants.equalsInteger(i.getStatus(),Constants.ONE) | 
 |  |  |                                 &&Constants.equalsInteger(i.getSendacopy(),Constants.ZERO) | 
 |  |  |                         ).count() | 
 |  |  |                 ); | 
 |  |  |  | 
 |  |  |                 //我发起的数据 | 
 |  |  |                 internalHomeVO.setNoticeCreateNum( | 
 |  |  |                         noticesJoinMapper.selectCount(new QueryWrapper<Notices>().lambda().eq(Notices::getParam3,memberId)) | 
 |  |  |                 ); | 
 |  |  |  | 
 |  |  |                 //抄送我的数据 | 
 |  |  |                 internalHomeVO.setNoticeCopyNum( | 
 |  |  |                         noticesList.stream().filter(i->Constants.equalsInteger(i.getUserId(),memberId) | 
 |  |  |                                 &&Constants.equalsInteger(i.getSendacopy(),Constants.ONE) | 
 |  |  | 
 |  |  |  | 
 |  |  |         //处理抄送数据 | 
 |  |  |         if(CollectionUtils.isNotEmpty(approveCopyList)){ | 
 |  |  |             this.organizeApproveCopyData(approveTempl,approveParamList,businessId,approveList); | 
 |  |  |             this.organizeApproveCopyData(approveTempl,approveCopyList,businessId,approveList); | 
 |  |  |         } | 
 |  |  |         approveMapper.insertBatchSomeColumn(approveList); | 
 |  |  |         approveJoinMapper.insert(approveList); | 
 |  |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | 
 |  |  |         createUserApprove.setIsdeleted(Constants.ZERO); | 
 |  |  |         createUserApprove.setTemplatId(approveTempl.getId()); | 
 |  |  |         createUserApprove.setChekorId(createMember.getId()); | 
 |  |  |         createUserApprove.setCheckDate(createUserApprove.getCreateDate()); | 
 |  |  |         createUserApprove.setStatus(Constants.approveStatus.pass); | 
 |  |  |         createUserApprove.setTitle("发起申请"); | 
 |  |  |         createUserApprove.setStatusInfo(""); | 
 |  |  | 
 |  |  |         createUserApprove.setType(Constants.ZERO); | 
 |  |  |         approveList.add(createUserApprove); | 
 |  |  |  | 
 |  |  |         //查询所有待处理人 | 
 |  |  |  | 
 |  |  |         //审批业务数据 | 
 |  |  |         for (int i = 0; i < approveParamList.size(); i++) { | 
 |  |  |             ApproveParam approveParam = approveParamList.get(i); | 
 |  |  |             List<Integer> ids = this.getApproveUserIds(approveParam,createMember); | 
 |  |  |             List<Member> memberList = memberMapper.selectList(new QueryWrapper<Member>().lambda().in(Member::getId,ids)); | 
 |  |  |             List<String> memberNameList =memberList.stream().map(m->m.getName()).collect(Collectors.toList()); | 
 |  |  |             String memberNames = String.join(",",memberNameList); | 
 |  |  |             Integer noticeType = Constants.approveTypeToNoticeType(approveTempl.getType()); | 
 |  |  |             String title = "【访客申请】申请人 - "; | 
 |  |  |             Map<String,Object> jsonMap = new HashMap<>(); | 
 |  |  |             for (int j = 0; j < ids.size(); j++) { | 
 |  |  |                 Integer memberId = ids.get(j); | 
 |  |  |             for (int j = 0; j < memberList.size(); j++) { | 
 |  |  |                 Member member = memberList.get(j); | 
 |  |  |                 Integer memberId = member.getId(); | 
 |  |  |                 //生成待办 notices 表数据 | 
 |  |  |                 if(i==0){ | 
 |  |  |                     if(jsonMap.isEmpty()){ | 
 |  |  | 
 |  |  |                         notices.setInfo("处理中"); | 
 |  |  |                         noticesJoinMapper.insert(notices); | 
 |  |  |                     } | 
 |  |  |                     if(CollectionUtils.isEmpty(memberList)){ | 
 |  |  |                         throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"未查询到审批人信息"); | 
 |  |  |                     } | 
 |  |  |                     Notices notices = new Notices(); | 
 |  |  |                     notices.setCreateDate(new Date()); | 
 |  |  |                     notices.setIsdeleted(Constants.ZERO); | 
 |  |  | 
 |  |  |                     notices.setSendacopy(Constants.ZERO); | 
 |  |  |                     notices.setParam2("0"); | 
 |  |  |                     notices.setParam3(""); | 
 |  |  |                     notices.setInfo("待处理"); | 
 |  |  |                     notices.setParam5(memberNames); | 
 |  |  |                     notices.setRemark(member.getName()); | 
 |  |  |                     if(Constants.equalsInteger(memberNameList.size(),Constants.ONE)){ | 
 |  |  |                         notices.setInfo("待"+memberNameList.get(0)+"处理中"); | 
 |  |  |                     }else{ | 
 |  |  |                         notices.setInfo("待"+memberNameList.get(0)+"等"+memberList.size()+"人处理中"); | 
 |  |  |                     } | 
 |  |  |                     noticesJoinMapper.insert(notices); | 
 |  |  |                 } | 
 |  |  |                 Approve approve = new Approve(); | 
 |  |  | 
 |  |  |                 approve.setChekorId(memberId); | 
 |  |  |                 approve.setStatus(i==0?Constants.ONE:Constants.ZERO); | 
 |  |  |                 approve.setStatusInfo(i==0?"审批中":"待审批"); | 
 |  |  |                 approve.setTitle("审批人"); | 
 |  |  |                 approve.setIsEndCheck((i+1) == approveParamList.size()?Constants.ONE:Constants.ZERO); | 
 |  |  |                 approve.setObjId(businessId); | 
 |  |  |                 approve.setLevel(i+1); | 
 |  |  | 
 |  |  |                     approve.setIsdeleted(Constants.ZERO); | 
 |  |  |                     approve.setTemplatId(approveTempl.getId()); | 
 |  |  |                     approve.setChekorId(memberId); | 
 |  |  |                     approve.setObjType(approveTempl.getType()); | 
 |  |  |                     approve.setObjId(businessId); | 
 |  |  |                     approve.setType(Constants.ONE); | 
 |  |  |                     approveList.add(approve); | 
 |  |  | 
 |  |  |             if(Objects.isNull(memberCompany)){ | 
 |  |  |                 throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"审批流配置错误[指定审批部门未查询到]"); | 
 |  |  |             } | 
 |  |  |             Company auditCompany = this.getAuditCompanyHead(memberCompany.getParentId(),approveParam.getObjLevel()); | 
 |  |  |             Company auditCompany = this.getAuditCompanyHead(memberCompany.getId(),approveParam.getObjLevel()); | 
 |  |  |             if(Objects.isNull(auditCompany)){ | 
 |  |  |                 //审批部门为空 自动流转下一级审批配置 | 
 |  |  |                 throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"审批流配置错误[指定审批部门未查询到]"); | 
 |  |  | 
 |  |  |                 Member headMember = memberMapper.selectById(auditCompany.getHeadId()); | 
 |  |  |                 if(Objects.isNull(headMember)){ | 
 |  |  |                     //未查询到部门负责人  根据配置处理   由上级主管代替审核/直接结束流程 | 
 |  |  |                     if(approveParam.getNoleaderOpt().equals(Constants.ONE)&&!Objects.isNull(auditCompany.getParentId())){ | 
 |  |  |                     if(Constants.equalsInteger(approveParam.getNoleaderOpt(),Constants.ONE)&&Objects.nonNull(auditCompany.getParentId())){ | 
 |  |  |                         auditCompany = companyMapper.selectOne(new QueryWrapper<Company>().lambda().eq(Company::getId,auditCompany.getParentId())); | 
 |  |  |                         //无父级 直接流传下一级审批 | 
 |  |  |                         if(Objects.isNull(auditCompany)){ | 
 |  |  | 
 |  |  |                             userIds.add(headMember.getId()); | 
 |  |  |                         } | 
 |  |  |                     }else{ | 
 |  |  |                         //添加审批人 | 
 |  |  |                         userIds.add(headMember.getId()); | 
 |  |  |                         throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"审批流配置错误[指定审批部门主管未查询到]"); | 
 |  |  |                     } | 
 |  |  |                 }else{ | 
 |  |  |                     //添加审批人 | 
 |  |  |                     userIds.add(headMember.getId()); | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  | 
 |  |  |      * @param objLevel  查询级别 | 
 |  |  |      */ | 
 |  |  |     public Company getAuditCompanyHead(Integer companyId, Integer objLevel){ | 
 |  |  |         Integer queryLevel = Constants.ZERO; | 
 |  |  |         Company auditCompany =  companyMapper.selectById(companyId); | 
 |  |  |         while(queryLevel.equals(objLevel)){ | 
 |  |  |         Integer queryLevel = Constants.ONE; | 
 |  |  |         while(queryLevel<objLevel){ | 
 |  |  |             auditCompany = companyMapper.selectById(auditCompany.getParentId()); | 
 |  |  |             if(Objects.isNull(auditCompany)){ | 
 |  |  |                 return null; | 
 |  |  | 
 |  |  |                         .eq(Approve::getObjId,businessId) | 
 |  |  |                         .eq(Approve::getObjType,businessType) | 
 |  |  |                         .orderByAsc(Approve::getLevel) | 
 |  |  |                         .orderByAsc(Approve::getStatus) | 
 |  |  |  | 
 |  |  |         ); | 
 |  |  |  | 
 |  |  |         //查找全部levelList | 
 |  |  | 
 |  |  |             for(Approve level:levelList){ | 
 |  |  |                 List<Approve> tlist = getLevelInfoFromList(level,approveGroupList); | 
 |  |  |                 approveDateVO.getApproveList().addAll(tlist); | 
 |  |  |                 if(tlist.size() ==0 | 
 |  |  |                         ||Constants.equalsInteger(Constants.approveStatus.unPass,  tlist.get(0).getStatus()) | 
 |  |  |                         ||Constants.equalsInteger(Constants.approveStatus.cancel,  tlist.get(0).getStatus())){ | 
 |  |  |                     break; | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  | 
 |  |  |         if (CollectionUtils.isNotEmpty(copyList)) { | 
 |  |  |             Approve waitModel = new Approve(); | 
 |  |  |             waitModel.setApproveType(Constants.ONE); | 
 |  |  |             waitModel.setCheckDate(copyList.get(Constants.ZERO).getCheckDate()); | 
 |  |  |             waitModel.setTitle("抄送人"); | 
 |  |  |             waitModel.setStatus(copyList.get(Constants.ZERO).getStatus()); | 
 |  |  |             waitModel.setType(Constants.ONE); | 
 |  |  |             waitModel.setApproveList(copyList); | 
 |  |  |             approveDateVO.getApproveList().add(waitModel); | 
 |  |  |         } | 
 |  |  |         System.out.println(JSONObject.toJSONString(approveDateVO)); | 
 |  |  |         return approveDateVO; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | 
 |  |  |                 if(CollectionUtils.isNotEmpty(approveList)){ | 
 |  |  |                     waitModel.setCreateDate(approveList.get(Constants.ZERO).getCreateDate()); | 
 |  |  |                 } | 
 |  |  |                 waitModel.setMemberName("已抄送"+ approveList.size() +"人"); | 
 |  |  |                 if(Constants.equalsInteger(waitModel.getStatus(),Constants.approveStatus.pass)){ | 
 |  |  |                     waitModel.setMemberName("已抄送"+ approveList.size() +"人"); | 
 |  |  |                 }else if(Constants.equalsInteger(waitModel.getStatus(),Constants.approveStatus.wait)){ | 
 |  |  |                     waitModel.setMemberName("处理中"); | 
 |  |  |                 } | 
 |  |  |                 waitModel.setApproveList(approveList); | 
 |  |  |                 list.add(waitModel); | 
 |  |  |             } | 
 |  |  |             //如果是或签 | 
 |  |  | //            if(otherPassList.size()>0){ | 
 |  |  | //                Approve waitModel = new Approve(); | 
 |  |  | //                waitModel.setApproveType(Constants.ONE); | 
 |  |  | //                waitModel.setStatusInfo(StringUtils.defaultString(level.getTitle(),"审批人")+"(抄送或签审批人)"); | 
 |  |  | //                waitModel.setStatus(Constants.ONE); | 
 |  |  | //                waitModel.setApproveList(otherPassList); | 
 |  |  | //                list.add(waitModel); | 
 |  |  | //            } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |  | 
 |  |  | 
 |  |  |             }else if(Constants.equalsInteger(Constants.approveStatus.auditIng,approve.getStatus())||Constants.equalsInteger(Constants.approveStatus.wait,approve.getStatus())){ | 
 |  |  |                 waitList.add(approve); | 
 |  |  |             }else if(Constants.equalsInteger(Constants.approveStatus.unPass,approve.getStatus())){ | 
 |  |  |                 refuseModel = approve; | 
 |  |  |                 BeanUtils.copyProperties(approve,refuseModel); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  | 
 |  |  |                 .eq(Notices::getUserId,approve.getChekorId()) | 
 |  |  |                 .eq(Notices::getSendacopy,Constants.ZERO) | 
 |  |  |                 .eq(Notices::getIsdeleted,Constants.ZERO) | 
 |  |  |                 .eq(Notices::getStatus,Constants.ZERO) | 
 |  |  |                 .last(" limit 1 ") | 
 |  |  |         ); | 
 |  |  |         if(Objects.isNull(notices)){ | 
 |  |  |             log.info("未查询到通知记录"); | 
 |  |  | 
 |  |  |         approve.setCheorId(approveDTO.getLoginUserInfo().getMemberId().toString()); | 
 |  |  |         approve.setCheckorName(approveDTO.getLoginUserInfo().getRealname()); | 
 |  |  |         approve.setCheckDate(new Date()); | 
 |  |  |         approve.setStatusInfo(approveDTO.getStatus()==Constants.TWO?"已同意":approveDTO.getCheckInfo()); | 
 |  |  |         approve.setStatusInfo(approveDTO.getStatus()==Constants.TWO?"已同意":"已驳回"); | 
 |  |  |         //本级所有 待审批记录 | 
 |  |  |         List<Approve> approveList = approveJoinMapper.selectJoinList(Approve.class, | 
 |  |  |                 new MPJLambdaWrapper<Approve>() | 
 |  |  | 
 |  |  |         Boolean dealBusinessBean = false; | 
 |  |  |         //审批驳回情况 | 
 |  |  |         if(approveDTO.getStatus().equals(Constants.THREE)){ | 
 |  |  |             dealBusinessBean = true; | 
 |  |  |             //修改其他所有待审批和审批中记录数据 | 
 |  |  |             approveJoinMapper.update(null,new UpdateWrapper<Approve>() | 
 |  |  |                     .lambda() | 
 |  |  |                     .set(Approve::getStatus,Constants.approveStatus.otherUnPass) | 
 |  |  |                     .set(Approve::getCheckDate,new Date()) | 
 |  |  |                     .in(Approve::getStatus,Constants.approveStatus.auditIng,Constants.approveStatus.wait) | 
 |  |  |                     .eq(Approve::getObjId,approve.getObjId()) | 
 |  |  |                     .eq(Approve::getObjType,approve.getObjType()) | 
 |  |  |                     .ne(Approve::getId,approve.getId())); | 
 |  |  |             //处理所有Notice通知为已处理 | 
 |  |  |             if(approve.getApproveType().equals(Constants.ZERO)){ | 
 |  |  |                 //修改自己的通知记录 | 
 |  |  |             //修改自己的通知记录 | 
 |  |  |             noticesJoinMapper.update(null,new UpdateWrapper<Notices>().lambda() | 
 |  |  |                     .set(Notices::getEditDate,new Date()) | 
 |  |  |                     .set(Notices::getParam4,approveDTO.getLoginUserInfo().getMemberId()) | 
 |  |  |                     .set(Notices::getInfo,"审批未通过") | 
 |  |  |                     .set(Notices::getReaded,Constants.ONE) | 
 |  |  |                     .set(Notices::getParam2,Constants.TWO) | 
 |  |  |                     .set(Notices::getStatus,Constants.ONE) | 
 |  |  |                     .eq(Notices::getId,notices.getId()) | 
 |  |  |             ); | 
 |  |  |             //修改 未处理的 通知数据 为抄送 | 
 |  |  |             if (!Constants.equalsInteger(approve.getApproveType(),Constants.TWO)){ | 
 |  |  |                 noticesJoinMapper.update(null,new UpdateWrapper<Notices>().lambda() | 
 |  |  |                         .set(Notices::getEditDate,new Date()) | 
 |  |  |                         .set(Notices::getParam4,approveDTO.getLoginUserInfo().getMemberId()) | 
 |  |  |                         .set(Notices::getReaded,Constants.ONE) | 
 |  |  |                         .set(Notices::getParam2,Constants.TWO) | 
 |  |  |                         .set(Notices::getSendacopy,Constants.ONE) | 
 |  |  |                         .set(Notices::getStatus,Constants.ONE) | 
 |  |  |                         .eq(Notices::getId,notices.getId()) | 
 |  |  |                         .set(Notices::getParam2,Constants.TWO) | 
 |  |  |                         .set(Notices::getInfo,"审批未通过") | 
 |  |  |                         .eq(Notices::getObjId,notices.getObjId()) | 
 |  |  |                         .eq(Notices::getObjType,notices.getObjType()) | 
 |  |  |                         .eq(Notices::getReaded,Constants.ZERO) | 
 |  |  |                         .ne(Notices::getId,notices.getId()) | 
 |  |  |                 ); | 
 |  |  |                 //修改 未处理的 通知数据 为抄送 | 
 |  |  |                 if (!Constants.equalsInteger(approve.getApproveType(),Constants.TWO)){ | 
 |  |  |                     noticesJoinMapper.update(null,new UpdateWrapper<Notices>().lambda() | 
 |  |  |                             .set(Notices::getEditDate,new Date()) | 
 |  |  |                             .set(Notices::getSendacopy,Constants.ONE) | 
 |  |  |                             .set(Notices::getStatus,Constants.ONE) | 
 |  |  |                             .set(Notices::getParam2,Constants.TWO) | 
 |  |  |                             .eq(Notices::getObjId,notices.getObjId()) | 
 |  |  |                             .eq(Notices::getObjType,notices.getObjType()) | 
 |  |  |                             .eq(Notices::getReaded,Constants.ZERO) | 
 |  |  |                             .ne(Notices::getId,notices.getId()) | 
 |  |  |                     ); | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |             return; | 
 |  |  |         }else{ | 
 |  |  |             //处理其他业务数据 | 
 |  |  |             if((Constants.equalsInteger(approve.getApproveType(),Constants.ZERO) | 
 |  |  | 
 |  |  |                     approveJoinMapper.update(null,new UpdateWrapper<Approve>() | 
 |  |  |                             .lambda() | 
 |  |  |                             .set(Approve::getStatus,Constants.approveStatus.otherDeal) | 
 |  |  |                             .set(Approve::getCheckDate,new Date()) | 
 |  |  |                             .in(Approve::getId,approveList.stream().map(m->m.getId()).collect(Collectors.toList()))); | 
 |  |  |                 } | 
 |  |  |                 dealBusinessBean = true; | 
 |  |  | 
 |  |  |                     approveJoinMapper.update(null,new UpdateWrapper<Approve>() | 
 |  |  |                             .lambda() | 
 |  |  |                             .set(Approve::getStatus,Constants.approveStatus.otherDeal) | 
 |  |  |                             .set(Approve::getCheckDate,new Date()) | 
 |  |  |                             .in(Approve::getId,approveList.stream().map(m->m.getId()).collect(Collectors.toList()))); | 
 |  |  |                 } | 
 |  |  |                 /**开启下一级别的数据为待审核**/ | 
 |  |  |                 approveJoinMapper.update(null,new UpdateWrapper<Approve>() | 
 |  |  |                         .lambda() | 
 |  |  |                         .set(Approve::getStatus,Constants.approveStatus.auditIng) | 
 |  |  |                         .set(Approve::getTitle,"审批人") | 
 |  |  |                         .set(Approve::getCheckDate,new Date()) | 
 |  |  |                         .eq(Approve::getStatus,Constants.approveStatus.wait) | 
 |  |  |                         .eq(Approve::getObjId,approve.getObjId()) | 
 |  |  |                         .eq(Approve::getObjType,approve.getObjType()) | 
 |  |  |                         .eq(Approve::getLevel,(approve.getLevel()+1)) | 
 |  |  |                 ); | 
 |  |  |                 if(approveDTO.getObjType().equals(Constants.approveObjectType.unConstructionVisit) | 
 |  |  |                         ||approveDTO.getObjType().equals(Constants.approveObjectType.constructionVisit) | 
 |  |  |                         ||approveDTO.getObjType().equals(Constants.approveObjectType.visitReporting)) { | 
 |  |  |                     Visits visits = visitsMapper.selectById(approve.getObjId()); | 
 |  |  |                     if(Objects.nonNull(visits)){ | 
 |  |  |                         if(Constants.equalsInteger(visits.getStatus(),Constants.ZERO)){ | 
 |  |  |                              visitsMapper.update(null,new UpdateWrapper<Visits>().lambda().set(Visits::getStatus,Constants.ONE).eq(Visits::getId,visits.getId())); | 
 |  |  |                         }else{ | 
 |  |  |                             throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到业务数据对象!请刷新重试"); | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                 }else if(approveDTO.getObjType().equals(Constants.approveObjectType.cityUseCar)||approveDTO.getObjType().equals( | 
 |  |  |                         Constants.approveObjectType.unCityUseCar)){ | 
 |  |  |                     this.updDriver(approveDTO,approve,false); | 
 |  |  |                 } | 
 |  |  |             }else if(approve.getApproveType().equals(Constants.ONE)){ | 
 |  |  |                 //会签 且终审 | 
 |  |  |                 //无他人审批的情况 则修改数据状态 | 
 |  |  |                 if(Constants.equalsInteger(approveList.size(),Constants.ZERO)&&Constants.equalsInteger(approve.getIsEndCheck(),Constants.ONE)){ | 
 |  |  |                     dealBusinessBean = true; | 
 |  |  |                 }else{ | 
 |  |  |                     if(Constants.equalsInteger(approveList.size(),Constants.ZERO)&&Constants.equalsInteger(approve.getIsEndCheck(),Constants.ZERO)){ | 
 |  |  |                         /**开启下一级别的数据为待审核**/ | 
 |  |  |                         approveJoinMapper.update(null,new UpdateWrapper<Approve>() | 
 |  |  |                                 .lambda() | 
 |  |  |                                 .set(Approve::getStatus,Constants.approveStatus.auditIng) | 
 |  |  |                                 .set(Approve::getTitle,"审批人") | 
 |  |  |                                 .set(Approve::getCheckDate,new Date()) | 
 |  |  |                                 .eq(Approve::getStatus,Constants.approveStatus.wait) | 
 |  |  |                                 .eq(Approve::getObjId,approve.getObjId()) | 
 |  |  |                                 .eq(Approve::getObjType,approve.getObjType()) | 
 |  |  |                                 .eq(Approve::getLevel,(approve.getLevel()+1)) | 
 |  |  |                         ); | 
 |  |  |                     } | 
 |  |  |                     if(approveDTO.getObjType().equals(Constants.approveObjectType.cityUseCar)||approveDTO.getObjType().equals( | 
 |  |  |                             Constants.approveObjectType.unCityUseCar)){ | 
 |  |  |                         this.updDriver(approveDTO,approve,false); | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |             this.passNextNotices(dealBusinessBean,notices,approve,approveList,approveCopyList,approveDTO); | 
 |  |  | 
 |  |  |      * @param approveList  同级待审批数据 | 
 |  |  |      */ | 
 |  |  |     public void passNextNotices(Boolean dealBusinessBean,Notices notices,Approve approve,List<Approve> approveList,List<Approve> copyList,ApproveDTO approveDTO){ | 
 |  |  |         //未开启下一级时,操作后的待审批人 | 
 |  |  |         String memberNames =notices.getParam5() | 
 |  |  |                 .replaceAll(","+notices.getRemark(),"") | 
 |  |  |                 .replaceAll(notices.getRemark()+",","") | 
 |  |  |                 .replaceAll(notices.getRemark(),""); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         //1、修改自己的数据记录 | 
 |  |  |         noticesJoinMapper.update(null,new UpdateWrapper<Notices>().lambda() | 
 |  |  |                 .set(Notices::getEditDate,new Date()) | 
 |  |  | 
 |  |  |         ); | 
 |  |  |         if(Constants.equalsInteger(approve.getApproveType(),Constants.ZERO)){ | 
 |  |  |             //或签 | 
 |  |  |             //2、更新他人的同级记录 为抄送 | 
 |  |  |             //2、更新他人的同级记录 为抄送  并更新 info 信息 | 
 |  |  |             noticesJoinMapper.update(null,new UpdateWrapper<Notices>().lambda() | 
 |  |  |                     .set(Notices::getEditDate,new Date()) | 
 |  |  |                     .set(Notices::getReaded,Constants.ONE) | 
 |  |  |                     .set(Notices::getReaded,Constants.ZERO) | 
 |  |  |                     .set(Notices::getSendacopy,Constants.ONE) | 
 |  |  |                     .set(Notices::getStatus,Constants.ONE) | 
 |  |  |                     .set(Notices::getParam4,approveDTO.getLoginUserInfo().getMemberId()) | 
 |  |  |                     .set(dealBusinessBean,Notices::getParam2,Constants.ONE) | 
 |  |  |                     .eq(Notices::getObjId,notices.getObjId()) | 
 |  |  |                     .eq(Notices::getStatus,Constants.ZERO) | 
 |  |  |                     .eq(Notices::getObjType,notices.getObjType()) | 
 |  |  |                     .ne(Notices::getId,notices.getId()) | 
 |  |  |             ); | 
 |  |  |             //3、如果不是终审生成下一级的数据记录 | 
 |  |  |             if(Constants.equalsInteger(approve.getIsEndCheck(),Constants.ZERO)&&!dealBusinessBean){ | 
 |  |  |               this.saveNextNotice(notices,approve); | 
 |  |  |                 memberNames = this.saveNextNotice(notices,approve); | 
 |  |  |             } | 
 |  |  |         }else if(Constants.equalsInteger(approve.getApproveType(),Constants.ONE)){ | 
 |  |  |             //会签 | 
 |  |  |             //2、如果是最后一位审批人 且不是终审开启下一级数据 | 
 |  |  |             if(Constants.equalsInteger(Constants.ZERO,approveList.size())){ | 
 |  |  |                 if(Constants.equalsInteger(approve.getIsEndCheck(),Constants.ZERO)){ | 
 |  |  |                     this.saveNextNotice(notices,approve); | 
 |  |  |                     memberNames = this.saveNextNotice(notices,approve); | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         }else{ | 
 |  |  |             //单人签 | 
 |  |  |             //2、 是否是终审 开启下一级数据 | 
 |  |  |             if(Constants.equalsInteger(approve.getIsEndCheck(),Constants.ZERO)){ | 
 |  |  |                 this.saveNextNotice(notices,approve); | 
 |  |  |                 memberNames = this.saveNextNotice(notices,approve); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         String info = ""; | 
 |  |  |         List<String> memberNameList = Arrays.asList(memberNames.split(",")); | 
 |  |  |         if(Constants.equalsInteger(memberNameList.size(),Constants.ONE)){ | 
 |  |  |             info = "待 "+memberNameList.get(0)+" 处理中"; | 
 |  |  |         }else{ | 
 |  |  |             info = "待 "+memberNameList.get(0)+" 等"+memberNameList.size()+"人处理中"; | 
 |  |  |         } | 
 |  |  |         //更新该业务数据的所有记录信息 | 
 |  |  |         noticesJoinMapper.update(null,new UpdateWrapper<Notices>().lambda() | 
 |  |  |                         .set(!dealBusinessBean,Notices::getInfo,info) | 
 |  |  |                         .set(dealBusinessBean,Notices::getInfo,"审批通过") | 
 |  |  |                         .set(Notices::getParam5,memberNames) | 
 |  |  |                         .eq(Notices::getObjId,notices.getObjId()) | 
 |  |  |                         .eq(Notices::getObjType,notices.getObjType())); | 
 |  |  |  | 
 |  |  |         //终审业务 且 处理数据  进行抄送发送 | 
 |  |  |         if (Constants.equalsInteger(approve.getIsEndCheck(),Constants.ONE) && dealBusinessBean) { | 
 |  |  |             if(CollectionUtils.isNotEmpty(copyList)){ | 
 |  |  |                 Notices copyNotices = new Notices(); | 
 |  |  |                 for (Approve copyApprove:copyList) { | 
 |  |  |                     if(Objects.isNull(copyNotices)){ | 
 |  |  |                         BeanUtils.copyProperties(notices,copyNotices); | 
 |  |  |                         notices.setId(null); | 
 |  |  |                         notices.setCreateDate(new Date()); | 
 |  |  |                         notices.setEditDate(new Date()); | 
 |  |  |                         notices.setParam2("2"); | 
 |  |  |                         notices.setParam3(""); | 
 |  |  |                         notices.setUserId(copyApprove.getChekorId()); | 
 |  |  |                         notices.setStatus(Constants.ZERO); | 
 |  |  |                         notices.setSendacopy(Constants.ONE); | 
 |  |  |                         notices.setReaded(Constants.ZERO); | 
 |  |  |                         noticesJoinMapper.insert(notices); | 
 |  |  |                     }else{ | 
 |  |  |                         notices.setId(null); | 
 |  |  |                         notices.setUserId(copyApprove.getChekorId()); | 
 |  |  |                         noticesJoinMapper.insert(notices); | 
 |  |  |                     } | 
 |  |  |                     Notices copyNotices = new Notices(); | 
 |  |  |                     BeanUtils.copyProperties(notices,copyNotices); | 
 |  |  |                     copyNotices.setId(null); | 
 |  |  |                     copyNotices.setCreateDate(new Date()); | 
 |  |  |                     copyNotices.setEditDate(new Date()); | 
 |  |  |                     copyNotices.setParam2("2"); | 
 |  |  |                     copyNotices.setParam3(""); | 
 |  |  |                     copyNotices.setInfo("审批通过"); | 
 |  |  |                     copyNotices.setUserId(copyApprove.getChekorId()); | 
 |  |  |                     copyNotices.setStatus(Constants.ZERO); | 
 |  |  |                     copyNotices.setSendacopy(Constants.ONE); | 
 |  |  |                     copyNotices.setReaded(Constants.ZERO); | 
 |  |  |                     noticesJoinMapper.insert(copyNotices); | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     public void saveNextNotice(Notices notices,Approve approve){ | 
 |  |  |         List<Approve> nextApproveList = approveJoinMapper.selectList(new QueryWrapper<Approve>() | 
 |  |  |                 .lambda() | 
 |  |  |  | 
 |  |  |     public String saveNextNotice(Notices notices,Approve approve){ | 
 |  |  |         List<Approve> nextApproveList = approveJoinMapper.selectJoinList(Approve.class,new MPJLambdaWrapper<Approve>() | 
 |  |  |                 .selectAll(Approve.class) | 
 |  |  |                 .selectAs(Member::getName,Approve::getMemberName) | 
 |  |  |                 .leftJoin(Member.class,Member::getId,Approve::getChekorId) | 
 |  |  |                 .eq(Approve::getObjId,approve.getObjId()) | 
 |  |  |                 .eq(Approve::getObjType,approve.getObjType()) | 
 |  |  |                 .eq(Approve::getType,Constants.ZERO) | 
 |  |  |                 .eq(Approve::getLevel,(approve.getLevel() + Constants.ONE)) | 
 |  |  |         ); | 
 |  |  |         if(CollectionUtils.isNotEmpty(nextApproveList)){ | 
 |  |  |         if(CollectionUtils.isEmpty(nextApproveList)){ | 
 |  |  |             throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"审批流数据异常"); | 
 |  |  |         } | 
 |  |  |         Notices newNotices = new Notices(); | 
 |  |  |         List<String> memberNameList =nextApproveList.stream().map(m->m.getMemberName()).collect(Collectors.toList()); | 
 |  |  |         String memberNames = String.join(",",memberNameList); | 
 |  |  |         for (Approve nextDealApprove:nextApproveList) { | 
 |  |  |             if(Objects.isNull(newNotices)){ | 
 |  |  |                 BeanUtils.copyProperties(notices,newNotices); | 
 |  |  |                 notices.setId(null); | 
 |  |  |                 notices.setCreateDate(new Date()); | 
 |  |  |                 notices.setParam2("0"); | 
 |  |  |                 notices.setParam3(""); | 
 |  |  |                 notices.setEditDate(new Date()); | 
 |  |  |                 notices.setUserId(nextDealApprove.getChekorId()); | 
 |  |  |                 notices.setStatus(Constants.ZERO); | 
 |  |  |                 notices.setSendacopy(Constants.ZERO); | 
 |  |  |                 notices.setReaded(Constants.ZERO); | 
 |  |  |                 noticesJoinMapper.insert(notices); | 
 |  |  |             Notices newNotices = new Notices(); | 
 |  |  |             BeanUtils.copyProperties(notices,newNotices); | 
 |  |  |             newNotices.setId(null); | 
 |  |  |             newNotices.setCreateDate(new Date()); | 
 |  |  |             newNotices.setParam2("0"); | 
 |  |  |             newNotices.setParam3(""); | 
 |  |  |             newNotices.setEditDate(new Date()); | 
 |  |  |             newNotices.setUserId(nextDealApprove.getChekorId()); | 
 |  |  |             newNotices.setStatus(Constants.ZERO); | 
 |  |  |             newNotices.setSendacopy(Constants.ZERO); | 
 |  |  |             newNotices.setReaded(Constants.ZERO); | 
 |  |  |             notices.setParam5(memberNames); | 
 |  |  |             notices.setRemark(nextDealApprove.getMemberName()); | 
 |  |  |             if(Constants.equalsInteger(memberNameList.size(),Constants.ONE)){ | 
 |  |  |                 notices.setInfo("待 "+memberNameList.get(0)+" 处理中"); | 
 |  |  |             }else{ | 
 |  |  |                 notices.setId(null); | 
 |  |  |                 notices.setUserId(nextDealApprove.getChekorId()); | 
 |  |  |                 noticesJoinMapper.insert(notices); | 
 |  |  |                 notices.setInfo("待 "+memberNameList.get(0)+" 等"+memberNameList.size()+"人处理中"); | 
 |  |  |             } | 
 |  |  |             noticesJoinMapper.insert(newNotices); | 
 |  |  |         } | 
 |  |  |         return memberNames; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void dealBusinessData(ApproveDTO approveDTO,Approve approve){ | 
 |  |  | 
 |  |  |             visitsMapper.updateById(visits); | 
 |  |  |         }else if(approveDTO.getObjType().equals(Constants.approveObjectType.cityUseCar)||approveDTO.getObjType().equals( | 
 |  |  |                 Constants.approveObjectType.unCityUseCar)){ | 
 |  |  |             // 市内外用车申请 | 
 |  |  |             CarUseBook carUseBook = carUseBookMapper.selectById(approveDTO.getObjId()); | 
 |  |  |             if(Objects.isNull(carUseBook)){ | 
 |  |  |                 throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"未查询到用车记录"); | 
 |  |  |             } | 
 |  |  |             carUseBook.setStatus(approveDTO.getStatus()); | 
 |  |  |             carUseBook.setEditDate(new Date()); | 
 |  |  |             carUseBook.setEditor(approveDTO.getLoginUserInfo().getMemberId()); | 
 |  |  |             //如果配置修改司机 且 入参了更换后司机信息 | 
 |  |  |             if(approveDTO.getStatus()==Constants.TWO&&Constants.equalsInteger(approve.getDriverParam(),Constants.ONE)){ | 
 |  |  |                 CarDriver carDriver = carDriverMapper.selectById(approveDTO.getDriverId()); | 
 |  |  |                 if(Objects.isNull(carDriver)){ | 
 |  |  |                     throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"未查询到司机信息"); | 
 |  |  |                 } | 
 |  |  |                 carUseBook.setDriverId(carDriver.getId()); | 
 |  |  |             } | 
 |  |  |             carUseBookMapper.updateById(carUseBook); | 
 |  |  |             this.updDriver(approveDTO,approve,true); | 
 |  |  |         }else if(approveDTO.getObjType().equals(Constants.approveObjectType.logisticsCarUse)){ | 
 |  |  |             //TODO  物流车预约 | 
 |  |  |             //物流车预约 | 
 |  |  |             PlatformBooks platformBooks = platformBooksMapper.selectById(approveDTO.getObjId()); | 
 |  |  |             if(Objects.isNull(platformBooks)){ | 
 |  |  |                 throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到物流车预约记录"); | 
 |  |  |             } | 
 |  |  |             platformBooks.setStatus(approveDTO.getStatus()); | 
 |  |  |             platformBooks.setEditDate(new Date()); | 
 |  |  |             platformBooks.setEditor(approveDTO.getLoginUserInfo().getMemberId()); | 
 |  |  |  | 
 |  |  |             //生成任务记录 | 
 |  |  |             PlatformJob platformJob = platformBooks.toPlatformJob(); | 
 |  |  |             platformJobMapper.insert(platformJob); | 
 |  |  |             platformBooks.setJobId(platformJob.getId()); | 
 |  |  |             platformBooksMapper.updateById(platformBooks); | 
 |  |  |             //生成任务操作记录 | 
 |  |  |             PlatformLog platformLog = new PlatformLog(); | 
 |  |  |             platformLog.setCreateDate(new Date()); | 
 |  |  |             platformLog.setJobId(platformJob.getId()); | 
 |  |  |             platformLog.setIsdeleted(Constants.ZERO); | 
 |  |  |             platformLog.setObjType(Constants.PlatformJobStatus.WART_SIGN_IN.getKey()); | 
 |  |  |             platformLog.setObjId(platformJob.getId().toString()); | 
 |  |  |             platformLog.setAfterContent(JSONObject.toJSONString(platformJob)); | 
 |  |  |             platformLogMapper.insert(platformLog); | 
 |  |  |  | 
 |  |  |         }else{ | 
 |  |  |             throw new BusinessException(ResponseStatus.BAD_REQUEST); | 
 |  |  |         } | 
 |  |  |         if(Constants.equalsInteger(approveDTO.getStatus(),Constants.TWO)){ | 
 |  |  |             //处理通过 显示所有的抄送记录 | 
 |  |  |             approveMapper.update(null,new UpdateWrapper<Approve>().lambda().set(Approve::getStatus,Constants.TWO) | 
 |  |  |                     .set(Approve::getCheckDate,new Date()) | 
 |  |  |                     .eq(Approve::getObjId,approve.getObjId()) | 
 |  |  |                     .eq(Approve::getObjType,approve.getObjType()) | 
 |  |  |                     .eq(Approve::getType,Constants.ONE) | 
 |  |  |             ); | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     public void updDriver(ApproveDTO approveDTO,Approve approve,Boolean dealBusinessBean){ | 
 |  |  |         // 市内外用车申请 | 
 |  |  |         CarUseBook carUseBook = carUseBookMapper.selectById(approveDTO.getObjId()); | 
 |  |  |         if(Objects.isNull(carUseBook)){ | 
 |  |  |             throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"未查询到用车记录"); | 
 |  |  |         } | 
 |  |  |         if(dealBusinessBean){ | 
 |  |  |             carUseBook.setStatus(approveDTO.getStatus()); | 
 |  |  |         }else{ | 
 |  |  |             if(Constants.equalsInteger(approveDTO.getStatus(),Constants.TWO)){ | 
 |  |  |                 carUseBook.setStatus(Constants.ONE); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         carUseBook.setEditDate(new Date()); | 
 |  |  |         carUseBook.setEditor(approveDTO.getLoginUserInfo().getMemberId()); | 
 |  |  |         //如果配置修改司机 且 入参了更换后司机信息 | 
 |  |  |         if(approveDTO.getStatus()==Constants.TWO&&Constants.equalsInteger(approve.getDriverParam(),Constants.ONE)){ | 
 |  |  |             CarDriver carDriver = carDriverMapper.selectOne(new QueryWrapper<CarDriver>().lambda() | 
 |  |  |                     .eq(CarDriver::getIsdeleted,Constants.ZERO) | 
 |  |  |                     .eq(CarDriver::getStatus,Constants.ZERO) | 
 |  |  |                     .eq(CarDriver::getMemberId,approveDTO.getDriverId())); | 
 |  |  |             if(Objects.isNull(carDriver)){ | 
 |  |  |                 throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"未查询到司机信息"); | 
 |  |  |             } | 
 |  |  |              carUseBook.setDriverId(carDriver.getMemberId()); | 
 |  |  |         } | 
 |  |  |         carUseBookMapper.updateById(carUseBook); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  |