|  |  | 
 |  |  | import com.alibaba.fastjson.JSONObject; | 
 |  |  | import com.doumee.biz.system.SystemDictDataBiz; | 
 |  |  | import com.doumee.core.constants.ResponseStatus; | 
 |  |  | import com.doumee.core.dingTalk.DingTalk; | 
 |  |  | import com.doumee.core.exception.BusinessException; | 
 |  |  | import com.doumee.core.haikang.model.HKConstants; | 
 |  |  | import com.doumee.core.haikang.model.param.BaseResponse; | 
 |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private CarDriverMapper carDriverMapper; | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private DdNoticeConfigMapper ddNoticeConfigMapper; | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private VisitsJoinMapper visitsMapper; | 
 |  |  | 
 |  |  |     private SmsEmailMapper smsEmailMapper; | 
 |  |  |     @Autowired | 
 |  |  |     private EmayService emayService; | 
 |  |  |     @Autowired | 
 |  |  |     private DingTalk dingTalk; | 
 |  |  |     @Override | 
 |  |  |     public Integer create(Approve approve) { | 
 |  |  |         approveMapper.insert(approve); | 
 |  |  | 
 |  |  |                                 Constants.equalsInteger(i.getUserId(),memberId) | 
 |  |  |                                 &&Constants.equalsInteger(i.getStatus(),Constants.ZERO) | 
 |  |  |                                 &&Constants.equalsInteger(i.getSendacopy(),Constants.ZERO) | 
 |  |  |                                         &&StringUtils.equals(i.getParam2(),"0") | 
 |  |  |                         ).count() | 
 |  |  |                 ); | 
 |  |  |                 //已处理数据 | 
 |  |  | 
 |  |  |                         noticesJoinMapper.selectCount(new QueryWrapper<Notices>().lambda().eq(Notices::getParam3,memberId)) | 
 |  |  |                 ); | 
 |  |  |                 //抄送我的数据 | 
 |  |  |                  internalHomeVO.setNoticeCopyNum( | 
 |  |  |                 internalHomeVO.setNoticeCopyNum( | 
 |  |  |                         noticesList.stream().filter(i->Constants.equalsInteger(i.getUserId(),memberId) | 
 |  |  |                                 &&Constants.equalsInteger(i.getSendacopy(),Constants.ONE) | 
 |  |  |                                 &&Constants.equalsInteger(i.getReaded(),Constants.ZERO) | 
 |  |  | 
 |  |  |                     noticesList.stream().filter(i->Constants.equalsInteger(i.getUserId(),noticesDTO.getMemberId()) | 
 |  |  |                             &&Constants.equalsInteger(i.getStatus(),Constants.ZERO) | 
 |  |  |                             &&Constants.equalsInteger(i.getSendacopy(),Constants.ZERO) | 
 |  |  |                             &&StringUtils.equals(i.getParam2(),"0") | 
 |  |  |                     ).count() | 
 |  |  |             ); | 
 |  |  |             internalHomeVO.setNoticeDealNum( | 
 |  |  | 
 |  |  |         approveList.add(createUserApprove); | 
 |  |  |  | 
 |  |  |         //查询所有待处理人 | 
 |  |  |         String token = systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_ACCESS_TOKEN).getCode(); | 
 |  |  | //        String token = systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_ACCESS_TOKEN).getCode(); | 
 |  |  |         //审批业务数据 | 
 |  |  |         for (int i = 0; i < approveParamList.size(); i++) { | 
 |  |  |             ApproveParam approveParam = approveParamList.get(i); | 
 |  |  | 
 |  |  |                     } | 
 |  |  |                     if(j==0){ | 
 |  |  |                         //访客人员不生成此记录 | 
 |  |  |                        if(!(Constants.equalsInteger(noticeType,Constants.noticesObjectType.visit)&&Constants.equalsInteger(createMember.getType(),Constants.ONE))){ | 
 |  |  |                        if(!(Constants.equalsInteger(noticeType,Constants.noticesObjectType.visit)&&Constants.equalsInteger(applyMember.getType(),Constants.ONE))){ | 
 |  |  |                             //默认生成一条 申请人的数据 标记删除状态用于处理到 任务中心(我发起)使用 | 
 |  |  |                             Notices notices = new Notices(); | 
 |  |  |                             notices.setCreateDate(new Date()); | 
 |  |  | 
 |  |  |                             wxPlatNotice.sendPlatformBookTemplateNotice(systemDictDataBiz, | 
 |  |  |                                     wxNoticeConfigMapper, | 
 |  |  |                                     platformBooksMapper.selectById(businessId), | 
 |  |  |                                     WxPlatConstants.platformBookContent.platformBookWaitAudit, | 
 |  |  |                                     token, | 
 |  |  |                                     WxPlatConstants.platformBookContent.platformBookWaitAudit,  | 
 |  |  |                                     Arrays.asList(member.getSystemOpenid().split(",")), | 
 |  |  |                                     Constants.ONE); | 
 |  |  |                         } | 
 |  |  | 
 |  |  |                         if(StringUtils.isNotBlank(member.getSystemOpenid())){ | 
 |  |  |                             wxPlatNotice.sendVisitTemplateNotice(systemDictDataBiz, | 
 |  |  |                                     wxNoticeConfigMapper,visitsMapper.selectById(businessId), WxPlatConstants.visitContent.visitWaitAudit, | 
 |  |  |                                     token, | 
 |  |  |                                     Arrays.asList(member.getSystemOpenid().split(",")) | 
 |  |  |                             ); | 
 |  |  |                         } | 
 |  |  |                          | 
 |  |  |                     }else if(Constants.equalsInteger(noticeType,Constants.noticesObjectType.visitReporting)){ | 
 |  |  |                         //访客报备 | 
 |  |  |                         SmsEmailServiceImpl.sendVisitReportSms(systemDictDataBiz, | 
 |  |  | 
 |  |  |                         if(StringUtils.isNotBlank(member.getSystemOpenid())){ | 
 |  |  |                             wxPlatNotice.sendVisitTemplateNotice(systemDictDataBiz, | 
 |  |  |                                     wxNoticeConfigMapper,visitsMapper.selectById(businessId), WxPlatConstants.visitReportContent.visitReportWaitAudit, | 
 |  |  |                                     token, | 
 |  |  |                                     Arrays.asList(member.getSystemOpenid().split(",")) | 
 |  |  |                             ); | 
 |  |  |                         } | 
 |  |  | 
 |  |  |                                             wxNoticeConfigMapper, | 
 |  |  |                                             carUseBookMapper.selectById(businessId), | 
 |  |  |                                             WxPlatConstants.carUseBookContent.carUseBookWaitAudit, | 
 |  |  |                                             token, | 
 |  |  |                                             Arrays.asList(member.getSystemOpenid().split(",")), | 
 |  |  |                                             Constants.ONE); | 
 |  |  |                                 } | 
 |  |  |                             } | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                 }  | 
 |  |  |             } | 
 |  |  |             if(Constants.equalsInteger(i,Constants.ZERO) && CollectionUtils.isNotEmpty(memberList)){ | 
 |  |  |                 //生成第一批钉钉审批通知信息 | 
 |  |  |                 List<String> erpId = memberList.stream().filter(m->StringUtils.isNotBlank(m.getErpId())).map(m->m.getErpId()).collect(Collectors.toList()); | 
 |  |  |                 if(CollectionUtils.isNotEmpty(erpId)){ | 
 |  |  |                     if(Constants.equalsInteger(noticeType,Constants.noticesObjectType.useCar)){ | 
 |  |  |                         CarUseBook carUseBook = carUseBookMapper.selectJoinOne(CarUseBook.class, | 
 |  |  |                                 new MPJLambdaWrapper<CarUseBook>() | 
 |  |  |                                         .selectAll(CarUseBook.class) | 
 |  |  |                                         .selectAs(Member::getName,CarUseBook::getMemberName) | 
 |  |  |                                         .leftJoin(Member.class,Member::getId,CarUseBook::getMemberId) | 
 |  |  |                                         .eq(CarUseBook::getId,businessId) | 
 |  |  |                                         .last(" limit 1 ") | 
 |  |  |                         ); | 
 |  |  |                         if(Objects.nonNull(carUseBook)){ | 
 |  |  |                             if(CollectionUtils.isNotEmpty(erpId)){ | 
 |  |  |                                 String ddTalkId = dingTalk.toDoNotice(StringUtils.isNotBlank(carUseBook.getMemberName())?(carUseBook.getMemberName()+"提交的公务用车申请"):"公务车用车申请", | 
 |  |  |                                         erpId , | 
 |  |  |                                         ddNoticeConfigMapper.selectCount(new QueryWrapper<DdNoticeConfig>().lambda() | 
 |  |  |                                                 .eq(DdNoticeConfig::getIsdeleted,Constants.ZERO).eq(DdNoticeConfig::getStatus,Constants.ZERO) | 
 |  |  |                                                 .eq(DdNoticeConfig::getObjType,9))>Constants.ZERO? | 
 |  |  |                                         dingTalk.getToDoCarUseBookFiledInfo(carUseBook):null,"pages/staff/vehicle/sendACarDetail?id="+carUseBook.getId()); | 
 |  |  |                                 carUseBookMapper.update(new UpdateWrapper<CarUseBook>().lambda() | 
 |  |  |                                         .set(CarUseBook::getDdBelongToUnionId,erpId.get(Constants.ZERO)) | 
 |  |  |                                         .set(CarUseBook::getDdToDoId,ddTalkId).eq(CarUseBook::getId,carUseBook.getId())); | 
 |  |  |                             } | 
 |  |  |                         } | 
 |  |  |                     }else if(Constants.equalsInteger(noticeType,Constants.noticesObjectType.visit) || Constants.equalsInteger(noticeType,Constants.noticesObjectType.visitReporting)) { | 
 |  |  |                         Visits visits = visitsMapper.selectById(businessId); | 
 |  |  |                         if (Objects.nonNull(visits)) { | 
 |  |  |                             //TODO 缺少域名前缀内容 | 
 |  |  |                             String ddTalkId = dingTalk.toDoNotice(visits.getName() + (Constants.equalsInteger(visits.getType(),Constants.TWO)?"的访客报备":"的访客申请"), | 
 |  |  |                                     erpId, | 
 |  |  |                                     ddNoticeConfigMapper.selectCount(new QueryWrapper<DdNoticeConfig>().lambda() | 
 |  |  |                                             .eq(DdNoticeConfig::getIsdeleted,Constants.ZERO).eq(DdNoticeConfig::getStatus,Constants.ZERO) | 
 |  |  |                                             .eq(DdNoticeConfig::getObjType,Constants.equalsInteger(visits.getType(),Constants.TWO)?5:1))>Constants.ZERO? | 
 |  |  |                                     dingTalk.getToDoVisitFiledInfo(visits):null, | 
 |  |  |                                     "pages/appointmentDetails/appointmentDetails?id=" + visits.getId()); | 
 |  |  |                             visitsMapper.update(new UpdateWrapper<Visits>().lambda() | 
 |  |  |                                             .set(Visits::getDdBelongToUnionId,erpId.get(Constants.ZERO)) | 
 |  |  |                                     .set(Visits::getDdToDoId, ddTalkId).eq(Visits::getId, visits.getId())); | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  | 
 |  |  |             if(Objects.isNull(platformBooks)){ | 
 |  |  |                 throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"未查询到业务数据信息"); | 
 |  |  |             } | 
 |  |  |             title = "[物流车入园预约]申请人-" + platformBooks.getDriverName(); | 
 |  |  |             jsonMap.put("inType", "入库类型:"+(Constants.equalsInteger(platformBooks.getInType(),Constants.ZERO)?"整托盘":"件烟")); | 
 |  |  |             jsonMap.put("totalNum", "总运输量:"+platformBooks.getTotalNum()+"万支"); | 
 |  |  |             jsonMap.put("arriveDate", "到场时间:" + DateUtil.DateToStr(platformBooks.getArriveDate() , "yyyy-MM-dd HH:mm")); | 
 |  |  |             jsonMap.put("carNum", "车牌照:"+platformBooks.getCarCodeFront()); | 
 |  |  |             title = ApproveServiceImpl.creatPlatformBookNotice(platformBooks,jsonMap); | 
 |  |  | //            title = "[物流车入园预约]申请人-" + platformBooks.getDriverName(); | 
 |  |  | //            jsonMap.put("inType", "入库类型:"+(Constants.equalsInteger(platformBooks.getInType(),Constants.ZERO)?"整托盘":"件烟")); | 
 |  |  | //            jsonMap.put("totalNum", "总运输量:"+platformBooks.getTotalNum()+"万支"); | 
 |  |  | //            jsonMap.put("arriveDate", "到场时间:" + DateUtil.DateToStr(platformBooks.getArriveDate() , "yyyy-MM-dd HH:mm")); | 
 |  |  | //            jsonMap.put("carNum", "车牌照:"+platformBooks.getCarCodeFront()); | 
 |  |  |         } | 
 |  |  |         return title; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public static String creatPlatformBookNotice(PlatformBooks platformBooks,Map<String,Object> jsonMap){ | 
 |  |  |         jsonMap.put("inType", "作业类型:"+(Constants.equalsInteger(platformBooks.getInType(),Constants.ZERO)?"整托盘":"件烟")); | 
 |  |  |         jsonMap.put("totalNum", "总运输量:"+platformBooks.getTotalNum()+"万支"); | 
 |  |  |         jsonMap.put("arriveDate", "到场时间:" + DateUtil.DateToStr(platformBooks.getArriveDate() , "yyyy-MM-dd HH:mm")); | 
 |  |  |         jsonMap.put("carNum", "车牌照:"+platformBooks.getCarCodeFront()); | 
 |  |  |         return  "[物流车入园预约]申请人-" + platformBooks.getDriverName() ; | 
 |  |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  | 
 |  |  |                 || Objects.isNull(approveDTO.getLoginUserInfo())){ | 
 |  |  |             throw new BusinessException(ResponseStatus.BAD_REQUEST); | 
 |  |  |         } | 
 |  |  |         if(approveDTO.getStatus().equals(Constants.THREE)&&StringUtils.isBlank(approveDTO.getCheckInfo())){ | 
 |  |  |             throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"请输入拒绝说明"); | 
 |  |  |         if(!(Constants.equalsInteger(approveDTO.getObjType(),Constants.THREE)||Constants.equalsInteger(approveDTO.getObjType(),Constants.FOUR))){ | 
 |  |  |             if(approveDTO.getStatus().equals(Constants.THREE)&&StringUtils.isBlank(approveDTO.getCheckInfo())){ | 
 |  |  |                 throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"请输入拒绝说明"); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         Approve approve = approveMapper.selectOne(new QueryWrapper<Approve>() | 
 |  |  |                 .lambda() | 
 |  |  | 
 |  |  |         approveMapper.updateById(approve); | 
 |  |  |         //是否处理 业务数据 | 
 |  |  |         Boolean dealBusinessBean = false; | 
 |  |  |         Boolean dealDDToDo = false; | 
 |  |  |         //审批驳回情况 | 
 |  |  |         if(approveDTO.getStatus().equals(Constants.THREE)){ | 
 |  |  |             dealBusinessBean = true; | 
 |  |  | 
 |  |  |                             .in(Approve::getId,approveList.stream().map(m->m.getId()).collect(Collectors.toList()))); | 
 |  |  |                 } | 
 |  |  |                 /**开启下一级别的数据为待审核**/ | 
 |  |  |  | 
 |  |  |                 List<Approve> waitAuditList = approveJoinMapper.selectJoinList(Approve.class, | 
 |  |  |                         new MPJLambdaWrapper<Approve>() | 
 |  |  |                                 .selectAll(Approve.class) | 
 |  |  | 
 |  |  | //                } | 
 |  |  |             }else if(approve.getApproveType().equals(Constants.ONE)){ | 
 |  |  |                 //会签 且终审 | 
 |  |  |                 if(!Constants.equalsInteger(approveList.size(),Constants.ZERO)&&Constants.equalsInteger(approve.getIsEndCheck(),Constants.ZERO)){ | 
 |  |  |                     //标记钉钉通知自己已处理 | 
 |  |  |                     dealDDToDo = true; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 //无他人审批的情况 则修改数据状态 | 
 |  |  |                 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)){ | 
 |  |  |                         /**开启下一级别的数据为待审核**/ | 
 |  |  |  | 
 |  |  |                         List<Approve> waitAuditList = approveJoinMapper.selectJoinList(Approve.class, | 
 |  |  |                                 new MPJLambdaWrapper<Approve>() | 
 |  |  |                                         .selectAll(Approve.class) | 
 |  |  | 
 |  |  |                         List<String> memberPhone = waitAuditList.stream().filter(i->StringUtils.isNotBlank(i.getMemberPhone())).map(i->i.getMemberPhone()).collect(Collectors.toList()); | 
 |  |  |                         List<String> openIdList =waitAuditList.stream().filter(i->StringUtils.isNotBlank(i.getSystemOpenid())).map(i->i.getSystemOpenid()).collect(Collectors.toList()); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                         this.sendNextLvSms(approve,approveDTO,memberPhone,openIdList); | 
 |  |  |  | 
 |  |  |                     } | 
 |  |  | 
 |  |  | //                    } | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |             this.passNextNotices(dealBusinessBean,notices,approve,approveList,approveCopyList,approveDTO); | 
 |  |  |             this.passNextNotices(dealBusinessBean,notices,approve,approveList,approveCopyList,approveDTO,dealDDToDo); | 
 |  |  |         } | 
 |  |  |         //处理业务数据 | 
 |  |  |         if(dealBusinessBean){ | 
 |  |  | 
 |  |  |     public void sendNextLvSms(Approve approve ,ApproveDTO approveDTO , List<String> memberPhone ,List<String> openIdList){ | 
 |  |  |         WxPlatNotice wxPlatNotice = new WxPlatNotice(); | 
 |  |  |         //物流车预约 | 
 |  |  |         List<Member> memberList = memberMapper.selectList(new QueryWrapper<Member>().lambda() | 
 |  |  |                 .in(Member::getPhone,memberPhone) | 
 |  |  |                 .eq(Member::getIsdeleted,Constants.ZERO) | 
 |  |  |                 .eq(Member::getStatus,Constants.ZERO) | 
 |  |  |                 .isNotNull(Member::getErpId) | 
 |  |  |          ); | 
 |  |  |         if(approveDTO.getObjType().equals(Constants.approveObjectType.reason)){ | 
 |  |  |             SmsEmailServiceImpl.sendPlatformBookSms(systemDictDataBiz, | 
 |  |  |                     emayService,smsEmailMapper,smsConfigMapper,platformBooksMapper,approveDTO.getObjId(), | 
 |  |  | 
 |  |  |                         wxNoticeConfigMapper, | 
 |  |  |                         platformBooksMapper.selectById(approveDTO.getObjId()), | 
 |  |  |                         WxPlatConstants.platformBookContent.platformBookWaitAudit, | 
 |  |  |                         systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_ACCESS_TOKEN).getCode(), | 
 |  |  |                         openIdList, | 
 |  |  |                         Constants.ONE); | 
 |  |  |             } | 
 |  |  | 
 |  |  |                     SmsConstants.carUseBookContent.carUseBookWaitAudit, | 
 |  |  |                     approveDTO.getCheckInfo(),memberPhone); | 
 |  |  |             //发送公众号通知 | 
 |  |  |             if(CollectionUtils.isNotEmpty(openIdList)){ | 
 |  |  |                 CarUseBook carUseBook = carUseBookMapper.selectById(approve.getObjId()); | 
 |  |  |                 if(Objects.nonNull(carUseBook)){ | 
 |  |  |             CarUseBook carUseBook = carUseBookMapper.selectJoinOne(CarUseBook.class, | 
 |  |  |                     new MPJLambdaWrapper<CarUseBook>() | 
 |  |  |                             .selectAll(CarUseBook.class) | 
 |  |  |                             .selectAs(Member::getName,CarUseBook::getMemberName) | 
 |  |  |                             .leftJoin(Member.class,Member::getId,CarUseBook::getMemberId) | 
 |  |  |                             .eq(CarUseBook::getId,approve.getObjId()) | 
 |  |  |                             .last(" limit 1 ") | 
 |  |  |             ); | 
 |  |  |             if(CollectionUtils.isNotEmpty(openIdList)&&Objects.nonNull(carUseBook)){  | 
 |  |  |                     SystemUser systemUser = systemUserMapper.selectById(carUseBook.getCreator()); | 
 |  |  |                     if(Objects.nonNull(systemUser)){ | 
 |  |  |                         carUseBook.setMemberName(systemUser.getRealname()); | 
 |  |  |                         //发送微信公众号通知 | 
 |  |  |                         wxPlatNotice.sendCarUseBookTemplateNotice(systemDictDataBiz, | 
 |  |  |                                 wxNoticeConfigMapper,carUseBook, | 
 |  |  |                                 WxPlatConstants.carUseBookContent.carUseBookWaitAudit, | 
 |  |  |                                 systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_ACCESS_TOKEN).getCode(), | 
 |  |  |                                 WxPlatConstants.carUseBookContent.carUseBookWaitAudit,  | 
 |  |  |                                 openIdList,1); | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |                     }  | 
 |  |  |             } | 
 |  |  |             //发送钉钉待办 公务车申请 | 
 |  |  |             if(Objects.nonNull(carUseBook)&&Objects.nonNull(memberList)){ | 
 |  |  |                 //标记当前审批人已完成 | 
 |  |  |                 dingTalk.updToDoNoticeInfoStatus(carUseBook.getDdBelongToUnionId(),carUseBook.getDdToDoId()); | 
 |  |  |                 //TODO 缺少域名前缀内容 | 
 |  |  |                 String ddTalkId = dingTalk.toDoNotice(StringUtils.isNotBlank(carUseBook.getMemberName())?(carUseBook.getMemberName()+"提交的公务用车申请"):"公务车用车申请", | 
 |  |  |                         memberList.stream().map(i->i.getErpId()).collect(Collectors.toList()) , | 
 |  |  |                         ddNoticeConfigMapper.selectCount(new QueryWrapper<DdNoticeConfig>().lambda() | 
 |  |  |                                 .eq(DdNoticeConfig::getIsdeleted,Constants.ZERO).eq(DdNoticeConfig::getStatus,Constants.ZERO) | 
 |  |  |                                 .eq(DdNoticeConfig::getObjType,9))>Constants.ZERO? | 
 |  |  |                         dingTalk.getToDoCarUseBookFiledInfo(carUseBook):null,"pages/staff/vehicle/sendACarDetail?id="+carUseBook.getId()); | 
 |  |  |                 carUseBookMapper.update(new UpdateWrapper<CarUseBook>().lambda() | 
 |  |  |                         .set(CarUseBook::getDdToDoId,ddTalkId).eq(CarUseBook::getId,carUseBook.getId())); | 
 |  |  |             }  | 
 |  |  |         }else | 
 |  |  |             //访客申请/报备 | 
 |  |  |             if(approveDTO.getObjType().equals(Constants.approveObjectType.unConstructionVisit) | 
 |  |  | 
 |  |  |                         wxPlatNotice.sendVisitTemplateNotice(systemDictDataBiz, | 
 |  |  |                                 wxNoticeConfigMapper,visitsMapper.selectById(approveDTO.getObjId()), | 
 |  |  |                                 approveDTO.getObjType().equals(Constants.approveObjectType.visitReporting)?WxPlatConstants.visitReportContent.visitReportWaitAudit:WxPlatConstants.visitContent.visitWaitAudit, | 
 |  |  |                                 systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_ACCESS_TOKEN).getCode(), | 
 |  |  |                                 openIdList | 
 |  |  |                         ); | 
 |  |  |                     } | 
 |  |  |                     if(Objects.nonNull(visits)&&Objects.nonNull(memberList)){ | 
 |  |  |                         //标记当前审批人已完成 | 
 |  |  |                         dingTalk.updToDoNoticeInfoStatus(visits.getDdBelongToUnionId(),visits.getDdToDoId()); | 
 |  |  |                         //TODO 缺少域名前缀内容 | 
 |  |  |                         String ddTalkId = dingTalk.toDoNotice(visits.getName()+"的访客申请", | 
 |  |  |                                 memberList.stream().map(i->i.getErpId()).collect(Collectors.toList()) , | 
 |  |  |                                 dingTalk.getToDoVisitFiledInfo(visits),"pages/appointmentDetails/appointmentDetails?id="+visits.getId()); | 
 |  |  |                         visitsMapper.update(new UpdateWrapper<Visits>().lambda() | 
 |  |  |                                 .set(Visits::getDdToDoId,ddTalkId).eq(Visits::getId,visits.getId())); | 
 |  |  |                     } | 
 |  |  |  | 
 |  |  |                 } | 
 |  |  | 
 |  |  |      * @param dealBusinessBean  是否需要进行更新业务数据状态 | 
 |  |  |      * @param approve  审批记录 | 
 |  |  |      * @param approveList  同级待审批数据 | 
 |  |  |      * @param dealDDToDo  是否处理 当前审批信息人的钉钉的工作通知 | 
 |  |  |      * | 
 |  |  |      */ | 
 |  |  |     public void passNextNotices(Boolean dealBusinessBean,Notices notices,Approve approve,List<Approve> approveList,List<Approve> copyList,ApproveDTO approveDTO){ | 
 |  |  |     public void passNextNotices(Boolean dealBusinessBean,Notices notices,Approve approve,List<Approve> approveList,List<Approve> copyList,ApproveDTO approveDTO,Boolean dealDDToDo){ | 
 |  |  |         //未开启下一级时,操作后的待审批人 | 
 |  |  |         String memberNames =notices.getParam5() | 
 |  |  |                 .replaceAll(","+notices.getRemark(),"") | 
 |  |  |                 .replaceAll(notices.getRemark()+",","") | 
 |  |  |                 .replaceAll(notices.getRemark(),""); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         //1、修改自己的数据记录 | 
 |  |  |         noticesJoinMapper.update(null,new UpdateWrapper<Notices>().lambda() | 
 |  |  | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         if(dealDDToDo){ | 
 |  |  |             if(approveDTO.getObjType().equals(Constants.approveObjectType.unConstructionVisit) | 
 |  |  |                     ||approveDTO.getObjType().equals(Constants.approveObjectType.constructionVisit) | 
 |  |  |                     ||approveDTO.getObjType().equals(Constants.approveObjectType.visitReporting)) { | 
 |  |  |                 Member member = memberMapper.selectById(approve.getChekorId()); | 
 |  |  |                 // 访客 三类业务数据 | 
 |  |  |                 Visits visits = visitsMapper.selectById(approveDTO.getObjId()); | 
 |  |  |                 if(Objects.nonNull(member)&&Objects.nonNull(member.getErpId()) | 
 |  |  |                         &&Objects.nonNull(visits)&&Objects.nonNull(visits.getDdToDoId())&&Objects.nonNull(visits.getDdBelongToUnionId())){ | 
 |  |  |                     dingTalk.updUserToDoNoticeInfoStatus(visits.getDdBelongToUnionId(),visits.getDdToDoId(),member.getErpId()); | 
 |  |  |                 } | 
 |  |  |             }else if(approveDTO.getObjType().equals(Constants.approveObjectType.cityUseCar)||approveDTO.getObjType().equals( | 
 |  |  |                     Constants.approveObjectType.unCityUseCar)){ | 
 |  |  |                 Member member = memberMapper.selectById(approve.getChekorId()); | 
 |  |  |                 CarUseBook carUseBook = carUseBookJoinMapper.selectById(approveDTO.getObjId()); | 
 |  |  |                 if(Objects.nonNull(member)&&Objects.nonNull(member.getErpId()) | 
 |  |  |                         &&Objects.nonNull(carUseBook)&&Objects.nonNull(carUseBook.getDdToDoId())&&Objects.nonNull(carUseBook.getDdBelongToUnionId())){ | 
 |  |  |                     dingTalk.updUserToDoNoticeInfoStatus(carUseBook.getDdBelongToUnionId(),carUseBook.getDdToDoId(),member.getErpId()); | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  | 
 |  |  |  | 
 |  |  |     public void dealBusinessData(ApproveDTO approveDTO,Approve approve){ | 
 |  |  |         WxPlatNotice wxPlatNotice = new WxPlatNotice(); | 
 |  |  |         Visits visits = new Visits(); | 
 |  |  |         CarUseBook carUseBook = new CarUseBook(); | 
 |  |  |         if(approveDTO.getObjType().equals(Constants.approveObjectType.unConstructionVisit) | 
 |  |  |                 ||approveDTO.getObjType().equals(Constants.approveObjectType.constructionVisit) | 
 |  |  |                 ||approveDTO.getObjType().equals(Constants.approveObjectType.visitReporting)){ | 
 |  |  |             // 访客 三类业务数据 | 
 |  |  |             Visits visits = visitsMapper.selectById(approveDTO.getObjId()); | 
 |  |  |             visits = visitsMapper.selectById(approveDTO.getObjId()); | 
 |  |  |             if(Objects.isNull(visits)){ | 
 |  |  |                 throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到申请记录"); | 
 |  |  |             } | 
 |  |  | 
 |  |  |                 if(Objects.nonNull(visits) && StringUtils.isNotBlank(visits.getOpenid())){ | 
 |  |  |                     wxPlatNotice.sendVisitTemplateNotice(systemDictDataBiz, | 
 |  |  |                             wxNoticeConfigMapper,visits, objCode, | 
 |  |  |                             systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_ACCESS_TOKEN).getCode(), | 
 |  |  |                             Arrays.asList(visits.getOpenid().split(",")) | 
 |  |  |                     ); | 
 |  |  |                 } | 
 |  |  |                 //钉钉通知 访客被访人或报备提交人 | 
 |  |  |                 Member beVisitMember = memberMapper.selectById(Constants.equalsInteger(visits.getType(),Constants.TWO)?visits.getMemberId():visits.getReceptMemberId()); | 
 |  |  |                 if(Objects.nonNull(beVisitMember)&&StringUtils.isNotBlank(beVisitMember.getDdId())){ | 
 |  |  |                     dingTalk.workInfoOANotice(Long.valueOf(systemDictDataBiz.queryByCode(Constants.DD_TALK,Constants.AGENT_ID).getCode()), | 
 |  |  |                             beVisitMember.getDdId(), | 
 |  |  |                             ddNoticeConfigMapper.selectCount(new QueryWrapper<DdNoticeConfig>().lambda() | 
 |  |  |                                     .eq(DdNoticeConfig::getIsdeleted,Constants.ZERO).eq(DdNoticeConfig::getStatus,Constants.ZERO) | 
 |  |  |                                     .eq(DdNoticeConfig::getObjType, Constants.equalsInteger(visits.getType(),Constants.TWO)?(Constants.equalsInteger(approveDTO.getStatus(),Constants.TWO)?6:7):(Constants.equalsInteger(approveDTO.getStatus(),Constants.TWO)?2:3)))>Constants.ZERO? | 
 |  |  |                             dingTalk.getVisitNoticeMsg(visits,visits.getName()+"的"+(Constants.equalsInteger(visits.getType(),Constants.TWO)?"访客报备":"访客申请")+","+ | 
 |  |  |                                     (Constants.equalsInteger(approveDTO.getStatus(),Constants.TWO)? "已审批通过":"已审批驳回")):null | 
 |  |  |                     ); | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             if(StringUtils.isNotBlank(visits.getDdBelongToUnionId()) | 
 |  |  |                     && StringUtils.isNotBlank(visits.getDdToDoId())){ | 
 |  |  |                 //标记当前钉钉审批已完成 | 
 |  |  |                 dingTalk.updToDoNoticeInfoStatus(visits.getDdBelongToUnionId(),visits.getDdToDoId()); | 
 |  |  |             } | 
 |  |  |         }else if(approveDTO.getObjType().equals(Constants.approveObjectType.cityUseCar)||approveDTO.getObjType().equals( | 
 |  |  |                 Constants.approveObjectType.unCityUseCar)){ | 
 |  |  |             this.updDriver(approveDTO,approve,true); | 
 |  |  |             CarUseBook carUseBook = carUseBookJoinMapper.selectById(approveDTO.getObjId()); | 
 |  |  |             carUseBook = carUseBookJoinMapper.selectById(approveDTO.getObjId()); | 
 |  |  |             if(Objects.nonNull(carUseBook)){ | 
 |  |  |                 SystemUser systemUser = systemUserMapper.selectById(carUseBook.getCreator()); | 
 |  |  |                 //发送通知短息 | 
 |  |  | 
 |  |  |                     wxPlatNotice.sendCarUseBookTemplateNotice(systemDictDataBiz, | 
 |  |  |                             wxNoticeConfigMapper,carUseBook, | 
 |  |  |                             Constants.equalsInteger(approveDTO.getStatus(),Constants.TWO)?WxPlatConstants.carUseBookContent.carUseBookAuditSuccess: WxPlatConstants.carUseBookContent.carUseBookAuditFail, | 
 |  |  |                             systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_ACCESS_TOKEN).getCode(), | 
 |  |  |                             Arrays.asList(systemUser.getOpenid().split(",")),0); | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |             //钉钉通知发起人 | 
 |  |  |             Member creatMember = memberMapper.selectById(carUseBook.getMemberId()); | 
 |  |  |             if(Objects.nonNull(creatMember)&&StringUtils.isNotBlank(creatMember.getDdId())){ | 
 |  |  |                 dingTalk.workInfoOANotice(Long.valueOf(systemDictDataBiz.queryByCode(Constants.DD_TALK,Constants.AGENT_ID).getCode()), | 
 |  |  |                         creatMember.getErpId(), | 
 |  |  |                         ddNoticeConfigMapper.selectCount(new QueryWrapper<DdNoticeConfig>().lambda() | 
 |  |  |                                 .eq(DdNoticeConfig::getIsdeleted,Constants.ZERO).eq(DdNoticeConfig::getStatus,Constants.ZERO) | 
 |  |  |                                 .eq(DdNoticeConfig::getObjType,Constants.equalsInteger(approveDTO.getStatus(),Constants.TWO)?10:11))>Constants.ZERO? | 
 |  |  |                                 dingTalk.getCarUseNoticeMsg(carUseBook,carUseBook.getMemberName() + "提交的公务用车,"+ | 
 |  |  |                                         (Constants.equalsInteger(approveDTO.getStatus(),Constants.TWO)? "已审批通过":"已审批驳回")):null | 
 |  |  |                 ); | 
 |  |  |             } | 
 |  |  |             if(StringUtils.isNotBlank(carUseBook.getDdBelongToUnionId()) | 
 |  |  |                 && StringUtils.isNotBlank(carUseBook.getDdToDoId())){ | 
 |  |  |                 //标记当前钉钉审批已完成 | 
 |  |  |                 dingTalk.updToDoNoticeInfoStatus(carUseBook.getDdBelongToUnionId(),carUseBook.getDdToDoId()); | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |         }else if(approveDTO.getObjType().equals(Constants.approveObjectType.reason)){ | 
 |  |  | 
 |  |  |                 wxPlatNotice.sendPlatformBookTemplateNotice(systemDictDataBiz, | 
 |  |  |                         wxNoticeConfigMapper, platformBooks, | 
 |  |  |                         Constants.equalsInteger(approveDTO.getStatus(),Constants.TWO)?WxPlatConstants.platformBookContent.platformBookAuditSuccess: WxPlatConstants.platformBookContent.platformBookAuditFail, | 
 |  |  |                         systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_ACCESS_TOKEN).getCode(), | 
 |  |  |                         Arrays.asList(driver.getOpenid().split(",")),0); | 
 |  |  |             } | 
 |  |  |  | 
 |  |  | 
 |  |  |             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()) | 
 |  |  |             List<Approve> approveList = approveMapper.selectList(new QueryWrapper<Approve>().lambda().eq(Approve::getObjId,approve.getObjId()) | 
 |  |  |                     .eq(Approve::getObjType,approve.getObjType()) | 
 |  |  |                     .eq(Approve::getType,Constants.ONE) | 
 |  |  |             ); | 
 |  |  |                     .eq(Approve::getType,Constants.ONE)); | 
 |  |  |             if(CollectionUtils.isNotEmpty(approveList)){ | 
 |  |  |                 //处理通过 显示所有的抄送记录 | 
 |  |  |                 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) | 
 |  |  |                 ); | 
 |  |  |                 List<Member> memberList = memberMapper.selectList(new QueryWrapper<Member>().lambda() | 
 |  |  |                         .eq(Member::getIsdeleted,Constants.ZERO) | 
 |  |  |                         .eq(Member::getStatus,Constants.ZERO) | 
 |  |  |                         .isNotNull(Member::getDdId) | 
 |  |  |                         .in(Member::getId,approveList.stream().map(i->i.getChekorId()).collect(Collectors.toList()))); | 
 |  |  |                 if(CollectionUtils.isNotEmpty(memberList)){ | 
 |  |  |                     if(Objects.nonNull(visits)||Objects.nonNull(carUseBook)){ | 
 |  |  |                         dingTalk.workInfoOANotice(Long.valueOf(systemDictDataBiz.queryByCode(Constants.DD_TALK,Constants.AGENT_ID).getCode()), | 
 |  |  |                                 StringUtils.join(memberList.stream().map(i->i.getDdId()).collect(Collectors.toList()),","), | 
 |  |  |                                 ddNoticeConfigMapper.selectCount(new QueryWrapper<DdNoticeConfig>().lambda() | 
 |  |  |                                                 .eq(DdNoticeConfig::getIsdeleted,Constants.ZERO).eq(DdNoticeConfig::getStatus,Constants.ZERO) | 
 |  |  |                                                 .eq(DdNoticeConfig::getObjType, Objects.nonNull(visits)?(Constants.equalsInteger(visits.getType(),Constants.TWO)?8:4):12))>Constants.ZERO? | 
 |  |  |                                         Objects.nonNull(visits)? | 
 |  |  |                                                 dingTalk.getVisitNoticeMsg(visits,visits.getName()+"的"+(Constants.equalsInteger(visits.getType(),Constants.TWO)?"访客报备":"访客申请")+",抄送给您,请知晓"): | 
 |  |  |                                                 dingTalk.getCarUseNoticeMsg(carUseBook,carUseBook.getMemberName() + "提交的公务用车,抄送给您,请知晓"):null | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                         ); | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  |