|  |  |  | 
|---|
|  |  |  | import com.doumee.core.utils.DateUtil; | 
|---|
|  |  |  | import com.doumee.core.utils.SmsConstants; | 
|---|
|  |  |  | import com.doumee.core.utils.Utils; | 
|---|
|  |  |  | import com.doumee.core.wx.wxPlat.WxPlatConstants; | 
|---|
|  |  |  | import com.doumee.core.wx.wxPlat.WxPlatNotice; | 
|---|
|  |  |  | import com.doumee.dao.business.*; | 
|---|
|  |  |  | import com.doumee.dao.business.dao.CompanyMapper; | 
|---|
|  |  |  | import com.doumee.dao.business.dao.MemberMapper; | 
|---|
|  |  |  | import com.doumee.dao.business.dao.SmsConfigMapper; | 
|---|
|  |  |  | import com.doumee.dao.business.dao.SmsEmailMapper; | 
|---|
|  |  |  | import com.doumee.dao.business.dto.ApproveDTO; | 
|---|
|  |  |  | import com.doumee.dao.business.join.ApproveJoinMapper; | 
|---|
|  |  |  | 
|---|
|  |  |  | import com.doumee.dao.business.join.VisitsJoinMapper; | 
|---|
|  |  |  | import com.doumee.dao.business.model.*; | 
|---|
|  |  |  | import com.doumee.dao.business.vo.ApproveDataVO; | 
|---|
|  |  |  | import com.doumee.dao.business.model.Member; | 
|---|
|  |  |  | import com.doumee.dao.system.SystemUserMapper; | 
|---|
|  |  |  | import com.doumee.dao.system.dto.NoticesDTO; | 
|---|
|  |  |  | import com.doumee.dao.system.join.NoticesJoinMapper; | 
|---|
|  |  |  | import com.doumee.dao.system.model.Notices; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SystemDictDataBiz systemDictDataBiz; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private WxNoticeConfigMapper wxNoticeConfigMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private ApproveTemplMapper approveTemplMapper; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private CarUseBookMapper carUseBookMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SystemUserMapper systemUserMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private CarDriverMapper carDriverMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private VisitsMapper visitsMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private VisitsJoinMapper visitsJoinMapper; | 
|---|
|  |  |  | private VisitsJoinMapper visitsMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private CarUseBookJoinMapper carUseBookJoinMapper; | 
|---|
|  |  |  | 
|---|
|  |  |  | private PlatformReasonMapper platformReasonMapper; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private PlatformGroupMapper platformGroupMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private ParksMapper parksMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private ParkBookMapper parkBookMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private VisitParkMapper visitParkMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SmsConfigMapper smsConfigMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SmsEmailMapper smsEmailMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private EmayService emayService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public Integer create(Approve approve) { | 
|---|
|  |  |  | approveMapper.insert(approve); | 
|---|
|  |  |  | return approve.getId(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void deleteById(Integer id) { | 
|---|
|  |  |  | approveMapper.deleteById(id); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void delete(Approve approve) { | 
|---|
|  |  |  | UpdateWrapper<Approve> deleteWrapper = new UpdateWrapper<>(approve); | 
|---|
|  |  |  | approveMapper.delete(deleteWrapper); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void deleteByIdInBatch(List<Integer> ids) { | 
|---|
|  |  |  | if (CollectionUtils.isEmpty(ids)) { | 
|---|
|  |  |  | 
|---|
|  |  |  | approveList.add(createUserApprove); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //查询所有待处理人 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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); | 
|---|
|  |  |  | List<Integer> ids = this.getApproveUserIds(approveParam,createMember); | 
|---|
|  |  |  | List<Member> memberList = memberMapper.selectList(new QueryWrapper<Member>().lambda().in(Member::getId,ids)); | 
|---|
|  |  |  | List<Member> memberList = memberMapper.selectJoinList(Member.class, | 
|---|
|  |  |  | new MPJLambdaWrapper<Member>() | 
|---|
|  |  |  | .selectAll(Member.class) | 
|---|
|  |  |  | .selectAs(SystemUser::getOpenid,Member::getSystemOpenid) | 
|---|
|  |  |  | .leftJoin(SystemUser.class,SystemUser::getMemberId,Member::getId) | 
|---|
|  |  |  | .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()); | 
|---|
|  |  |  | 
|---|
|  |  |  | approve.setType(Constants.ZERO); | 
|---|
|  |  |  | approveList.add(approve); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | WxPlatNotice wxPlatNotice = new WxPlatNotice(); | 
|---|
|  |  |  | if(Constants.equalsInteger(approve.getStatus(),Constants.ONE) && StringUtils.isNotBlank(member.getPhone())){ | 
|---|
|  |  |  | //发送短信通知 | 
|---|
|  |  |  | if(Constants.equalsInteger(noticeType,Constants.noticesObjectType.reason)){ | 
|---|
|  |  |  | 
|---|
|  |  |  | SmsConstants.platformBookContent.platformBookWaitAudit, | 
|---|
|  |  |  | null,Arrays.asList(member.getPhone().split(",")) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | //公众号通知 | 
|---|
|  |  |  | if(StringUtils.isNotBlank(member.getSystemOpenid())){ | 
|---|
|  |  |  | wxPlatNotice.sendPlatformBookTemplateNotice(systemDictDataBiz, | 
|---|
|  |  |  | wxNoticeConfigMapper, | 
|---|
|  |  |  | platformBooksMapper.selectById(businessId), | 
|---|
|  |  |  | WxPlatConstants.platformBookContent.platformBookWaitAudit, | 
|---|
|  |  |  | token, | 
|---|
|  |  |  | Arrays.asList(member.getSystemOpenid().split(",")), | 
|---|
|  |  |  | Constants.ONE); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }else if(Constants.equalsInteger(noticeType,Constants.noticesObjectType.visit)){ | 
|---|
|  |  |  | //访客申请 | 
|---|
|  |  |  | //短信通知 | 
|---|
|  |  |  | SmsEmailServiceImpl.sendVisitSms(systemDictDataBiz, | 
|---|
|  |  |  | emayService,smsEmailMapper,smsConfigMapper,visitsMapper,businessId, | 
|---|
|  |  |  | SmsConstants.visitContent.visitNotice, | 
|---|
|  |  |  | null,Arrays.asList(member.getPhone().split(",")) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | //公众号通知 | 
|---|
|  |  |  | 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, | 
|---|
|  |  |  | 
|---|
|  |  |  | SmsConstants.visitReportingContent.visitReportingNotice, | 
|---|
|  |  |  | null,Arrays.asList(member.getPhone().split(",")) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | //公众号通知 | 
|---|
|  |  |  | if(StringUtils.isNotBlank(member.getSystemOpenid())){ | 
|---|
|  |  |  | wxPlatNotice.sendVisitTemplateNotice(systemDictDataBiz, | 
|---|
|  |  |  | wxNoticeConfigMapper,visitsMapper.selectById(businessId), WxPlatConstants.visitReportContent.visitReportWaitAudit, | 
|---|
|  |  |  | token, | 
|---|
|  |  |  | Arrays.asList(member.getSystemOpenid().split(",")) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }else if(Constants.equalsInteger(noticeType,Constants.noticesObjectType.useCar)){ | 
|---|
|  |  |  | //用车申请 | 
|---|
|  |  |  | SmsEmailServiceImpl.sendCarUseSms(systemDictDataBiz, | 
|---|
|  |  |  | 
|---|
|  |  |  | SmsConstants.carUseBookContent.carUseBookWaitAudit, | 
|---|
|  |  |  | null,Arrays.asList(member.getPhone().split(",")) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | //公众号通知 | 
|---|
|  |  |  | if(StringUtils.isNotBlank(member.getSystemOpenid())){ | 
|---|
|  |  |  | CarUseBook carUseBook = carUseBookMapper.selectById(businessId); | 
|---|
|  |  |  | if(Objects.nonNull(carUseBook)){ | 
|---|
|  |  |  | SystemUser systemUser = systemUserMapper.selectById(carUseBook.getCreator()); | 
|---|
|  |  |  | if(Objects.nonNull(systemUser)){ | 
|---|
|  |  |  | carUseBook.setMemberName(systemUser.getRealname()); | 
|---|
|  |  |  | wxPlatNotice.sendCarUseBookTemplateNotice(systemDictDataBiz, | 
|---|
|  |  |  | wxNoticeConfigMapper, | 
|---|
|  |  |  | carUseBookMapper.selectById(businessId), | 
|---|
|  |  |  | WxPlatConstants.carUseBookContent.carUseBookWaitAudit, | 
|---|
|  |  |  | token, | 
|---|
|  |  |  | Arrays.asList(member.getSystemOpenid().split(",")), | 
|---|
|  |  |  | Constants.ONE); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | if(Constants.equalsInteger(noticeType,Constants.noticesObjectType.visit) | 
|---|
|  |  |  | || Constants.equalsInteger(noticeType,Constants.noticesObjectType.visitReporting)){ | 
|---|
|  |  |  | //访客记录与访客报备 | 
|---|
|  |  |  | Visits visits = visitsJoinMapper.selectJoinOne(Visits.class, | 
|---|
|  |  |  | Visits visits = visitsMapper.selectJoinOne(Visits.class, | 
|---|
|  |  |  | new MPJLambdaWrapper<Visits>().selectAll(Visits.class) | 
|---|
|  |  |  | .selectAs(Member::getName,Visits::getReceptMemberName) | 
|---|
|  |  |  | .selectAs(Company::getName,Visits::getReceptMemberDepartment) | 
|---|
|  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | @Transactional(rollbackFor = {Exception.class,BusinessException.class}) | 
|---|
|  |  |  | public void approved(ApproveDTO approveDTO){ | 
|---|
|  |  |  | WxPlatNotice wxPlatNotice = new WxPlatNotice(); | 
|---|
|  |  |  | if(Objects.isNull(approveDTO) | 
|---|
|  |  |  | || Objects.isNull(approveDTO.getObjId()) | 
|---|
|  |  |  | || Objects.isNull(approveDTO.getObjType()) | 
|---|
|  |  |  | 
|---|
|  |  |  | new MPJLambdaWrapper<Approve>() | 
|---|
|  |  |  | .selectAll(Approve.class) | 
|---|
|  |  |  | .selectAs(Member::getPhone,Approve::getMemberPhone) | 
|---|
|  |  |  | .selectAs(SystemUser::getOpenid,Approve::getSystemOpenid) | 
|---|
|  |  |  | .leftJoin(Member.class,Member::getId,Approve::getChekorId) | 
|---|
|  |  |  | .leftJoin(SystemUser.class,SystemUser::getMemberId,Member::getId) | 
|---|
|  |  |  | .eq(Approve::getStatus,Constants.approveStatus.wait) | 
|---|
|  |  |  | .eq(Approve::getObjId,approve.getObjId()) | 
|---|
|  |  |  | .eq(Approve::getObjType,approve.getObjType()) | 
|---|
|  |  |  | 
|---|
|  |  |  | .eq(Approve::getObjType,approve.getObjType()) | 
|---|
|  |  |  | .eq(Approve::getLevel,(approve.getLevel()+1)) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //发送短信通知  下级审批人 | 
|---|
|  |  |  | List<String> memberPhone = waitAuditList.stream().filter(i->StringUtils.isNotBlank(i.getMemberPhone())).map(i->i.getMemberPhone()).collect(Collectors.toList()); | 
|---|
|  |  |  | //物流车预约 | 
|---|
|  |  |  | if(approveDTO.getObjType().equals(Constants.approveObjectType.reason)){ | 
|---|
|  |  |  | SmsEmailServiceImpl.sendPlatformBookSms(systemDictDataBiz, | 
|---|
|  |  |  | emayService,smsEmailMapper,smsConfigMapper,platformBooksMapper,approveDTO.getObjId(), | 
|---|
|  |  |  | SmsConstants.platformBookContent.platformBookWaitAudit, | 
|---|
|  |  |  | approveDTO.getCheckInfo(),memberPhone | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | List<String> openIdList =waitAuditList.stream().filter(i->StringUtils.isNotBlank(i.getSystemOpenid())).map(i->i.getSystemOpenid()).collect(Collectors.toList()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | else if(approveDTO.getObjType().equals(Constants.approveObjectType.cityUseCar) | 
|---|
|  |  |  | || approveDTO.getObjType().equals(Constants.approveObjectType.unCityUseCar)){ | 
|---|
|  |  |  | SmsEmailServiceImpl.sendCarUseSms(systemDictDataBiz, | 
|---|
|  |  |  | emayService,smsEmailMapper,smsConfigMapper,carUseBookMapper,approveDTO.getObjId(), | 
|---|
|  |  |  | SmsConstants.hiddenDangerContent.hiddenDangerDealUser, | 
|---|
|  |  |  | approveDTO.getCheckInfo(),memberPhone); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | this.sendNextLvSms(approve,approveDTO,memberPhone,openIdList); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //访客申请/报备 | 
|---|
|  |  |  | 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())); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(approveDTO.getObjType().equals(Constants.approveObjectType.cityUseCar)||approveDTO.getObjType().equals( | 
|---|
|  |  |  | Constants.approveObjectType.unCityUseCar)){ | 
|---|
|  |  |  | this.updDriver(approveDTO,approve,false); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //                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)){ | 
|---|
|  |  |  | //会签 且终审 | 
|---|
|  |  |  | //无他人审批的情况 则修改数据状态 | 
|---|
|  |  |  | 
|---|
|  |  |  | }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) | 
|---|
|  |  |  | .selectAs(Member::getPhone,Approve::getMemberPhone) | 
|---|
|  |  |  | .selectAs(SystemUser::getOpenid,Approve::getSystemOpenid) | 
|---|
|  |  |  | .leftJoin(Member.class,Member::getId,Approve::getChekorId) | 
|---|
|  |  |  | .leftJoin(SystemUser.class,SystemUser::getMemberId,Member::getId) | 
|---|
|  |  |  | .eq(Approve::getStatus,Constants.approveStatus.wait) | 
|---|
|  |  |  | .eq(Approve::getObjId,approve.getObjId()) | 
|---|
|  |  |  | .eq(Approve::getObjType,approve.getObjType()) | 
|---|
|  |  |  | .eq(Approve::getLevel,(approve.getLevel()+1))); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | approveJoinMapper.update(null,new UpdateWrapper<Approve>() | 
|---|
|  |  |  | .lambda() | 
|---|
|  |  |  | .set(Approve::getStatus,Constants.approveStatus.auditIng) | 
|---|
|  |  |  | 
|---|
|  |  |  | .eq(Approve::getObjType,approve.getObjType()) | 
|---|
|  |  |  | .eq(Approve::getLevel,(approve.getLevel()+1)) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //发送短信通知  下级审批人 | 
|---|
|  |  |  | 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); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(approveDTO.getObjType().equals(Constants.approveObjectType.cityUseCar)||approveDTO.getObjType().equals( | 
|---|
|  |  |  | Constants.approveObjectType.unCityUseCar)){ | 
|---|
|  |  |  | this.updDriver(approveDTO,approve,false); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //                    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); | 
|---|
|  |  |  | 
|---|
|  |  |  | this.dealBusinessData(approveDTO,approve); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void sendNextLvSms(Approve approve ,ApproveDTO approveDTO , List<String> memberPhone ,List<String> openIdList){ | 
|---|
|  |  |  | WxPlatNotice wxPlatNotice = new WxPlatNotice(); | 
|---|
|  |  |  | //物流车预约 | 
|---|
|  |  |  | if(approveDTO.getObjType().equals(Constants.approveObjectType.reason)){ | 
|---|
|  |  |  | SmsEmailServiceImpl.sendPlatformBookSms(systemDictDataBiz, | 
|---|
|  |  |  | emayService,smsEmailMapper,smsConfigMapper,platformBooksMapper,approveDTO.getObjId(), | 
|---|
|  |  |  | SmsConstants.platformBookContent.platformBookWaitAudit, | 
|---|
|  |  |  | approveDTO.getCheckInfo(),memberPhone | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | //公众号通知 | 
|---|
|  |  |  | if(CollectionUtils.isNotEmpty(openIdList)){ | 
|---|
|  |  |  | wxPlatNotice.sendPlatformBookTemplateNotice(systemDictDataBiz, | 
|---|
|  |  |  | wxNoticeConfigMapper, | 
|---|
|  |  |  | platformBooksMapper.selectById(approveDTO.getObjId()), | 
|---|
|  |  |  | WxPlatConstants.platformBookContent.platformBookWaitAudit, | 
|---|
|  |  |  | systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_ACCESS_TOKEN).getCode(), | 
|---|
|  |  |  | openIdList, | 
|---|
|  |  |  | Constants.ONE); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } else if(approveDTO.getObjType().equals(Constants.approveObjectType.cityUseCar) | 
|---|
|  |  |  | || approveDTO.getObjType().equals(Constants.approveObjectType.unCityUseCar)){ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | this.updDriver(approveDTO,approve,false); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | SmsEmailServiceImpl.sendCarUseSms(systemDictDataBiz, | 
|---|
|  |  |  | emayService,smsEmailMapper,smsConfigMapper,carUseBookMapper,approveDTO.getObjId(), | 
|---|
|  |  |  | SmsConstants.carUseBookContent.carUseBookWaitAudit, | 
|---|
|  |  |  | approveDTO.getCheckInfo(),memberPhone); | 
|---|
|  |  |  | //发送公众号通知 | 
|---|
|  |  |  | if(CollectionUtils.isNotEmpty(openIdList)){ | 
|---|
|  |  |  | CarUseBook carUseBook = carUseBookMapper.selectById(approve.getObjId()); | 
|---|
|  |  |  | if(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(), | 
|---|
|  |  |  | openIdList,1); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }else | 
|---|
|  |  |  | //访客申请/报备 | 
|---|
|  |  |  | 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())); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | SmsEmailServiceImpl.sendVisitSms(systemDictDataBiz, | 
|---|
|  |  |  | emayService,smsEmailMapper,smsConfigMapper,visitsMapper,approveDTO.getObjId(), | 
|---|
|  |  |  | approveDTO.getObjType().equals(Constants.approveObjectType.visitReporting)? | 
|---|
|  |  |  | SmsConstants.visitReportingContent.visitReportingNotice:SmsConstants.visitContent.visitNotice, | 
|---|
|  |  |  | null,memberPhone | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | //公众号通知 | 
|---|
|  |  |  | if(CollectionUtils.isNotEmpty(openIdList)){ | 
|---|
|  |  |  | 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 | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 处理待办信息 | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void dealBusinessData(ApproveDTO approveDTO,Approve approve){ | 
|---|
|  |  |  | WxPlatNotice wxPlatNotice = new WxPlatNotice(); | 
|---|
|  |  |  | if(approveDTO.getObjType().equals(Constants.approveObjectType.unConstructionVisit) | 
|---|
|  |  |  | ||approveDTO.getObjType().equals(Constants.approveObjectType.constructionVisit) | 
|---|
|  |  |  | ||approveDTO.getObjType().equals(Constants.approveObjectType.visitReporting)){ | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //访客报备 | 
|---|
|  |  |  | String objCode = ""; | 
|---|
|  |  |  | if(approveDTO.getObjType().equals(Constants.approveObjectType.visitReporting)){ | 
|---|
|  |  |  | //发送短信通知 | 
|---|
|  |  |  | SmsEmailServiceImpl.sendVisitReportSms(systemDictDataBiz, | 
|---|
|  |  |  | 
|---|
|  |  |  | SmsConstants.visitReportingContent.visitReportingAuditFail, | 
|---|
|  |  |  | approveDTO.getCheckInfo(),null | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | objCode =  Constants.equalsInteger(approveDTO.getStatus(),Constants.TWO)? | 
|---|
|  |  |  | WxPlatConstants.visitReportContent.visitReportAuditSuccess:WxPlatConstants.visitReportContent.visitReportAuditFail; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | }else{ //访客申请 | 
|---|
|  |  |  | //发送短信通知 | 
|---|
|  |  |  | SmsEmailServiceImpl.sendVisitSms(systemDictDataBiz, | 
|---|
|  |  |  | 
|---|
|  |  |  | SmsConstants.visitContent.visitAuditFail, | 
|---|
|  |  |  | approveDTO.getCheckInfo(),null | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | if(Constants.equalsInteger(approveDTO.getStatus(),Constants.TWO)){ | 
|---|
|  |  |  | SmsEmailServiceImpl.sendVisitSms(systemDictDataBiz, | 
|---|
|  |  |  | emayService,smsEmailMapper,smsConfigMapper,visitsMapper,visits.getId(), | 
|---|
|  |  |  | SmsConstants.visitContent.visitAuditSuccessToVisiter, | 
|---|
|  |  |  | approveDTO.getCheckInfo(),null | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | objCode =  Constants.equalsInteger(approveDTO.getStatus(),Constants.TWO)? WxPlatConstants.visitContent.visitAuditSuccess: | 
|---|
|  |  |  | WxPlatConstants.visitContent.visitAuditFail; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | visitsMapper.updateById(visits); | 
|---|
|  |  |  | //发送微信公众号 | 
|---|
|  |  |  | if(StringUtils.isNotBlank(objCode)){ | 
|---|
|  |  |  | 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(",")) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | visitsMapper.updateById(visits); | 
|---|
|  |  |  | }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()); | 
|---|
|  |  |  | if(Objects.nonNull(carUseBook)){ | 
|---|
|  |  |  | Member member = memberMapper.selectById(carUseBook.getMemberId()); | 
|---|
|  |  |  | if(Objects.nonNull(member)&&StringUtils.isNotBlank(member.getPhone())){ | 
|---|
|  |  |  | SystemUser systemUser = systemUserMapper.selectById(carUseBook.getCreator()); | 
|---|
|  |  |  | //发送通知短息 | 
|---|
|  |  |  | if(Objects.nonNull(systemUser)&&StringUtils.isNotBlank(systemUser.getMobile())){ | 
|---|
|  |  |  | SmsEmailServiceImpl.sendCarUseSms(systemDictDataBiz, | 
|---|
|  |  |  | emayService,smsEmailMapper,smsConfigMapper,carUseBookMapper,approveDTO.getObjId(), | 
|---|
|  |  |  | Constants.equalsInteger(approveDTO.getStatus(),Constants.TWO)?SmsConstants.carUseBookContent.carUseBookAuditSuccess: | 
|---|
|  |  |  | SmsConstants.carUseBookContent.carUseBookAuditFail, | 
|---|
|  |  |  | approveDTO.getCheckInfo(),Arrays.asList(member.getPhone().split(",")) | 
|---|
|  |  |  | approveDTO.getCheckInfo(),Arrays.asList(systemUser.getMobile().split(",")) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(Objects.nonNull(systemUser)&&StringUtils.isNotBlank(systemUser.getOpenid())){ | 
|---|
|  |  |  | carUseBook.setMemberName(systemUser.getRealname()); | 
|---|
|  |  |  | //发送微信公众号通知 | 
|---|
|  |  |  | 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); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | approveDTO.getCheckInfo(),null | 
|---|
|  |  |  | ); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //TODO 发送微信公众号消息 | 
|---|
|  |  |  | //发送微信公众号消息 | 
|---|
|  |  |  | SystemUser driver = systemUserMapper.selectOne(new QueryWrapper<SystemUser>().lambda() | 
|---|
|  |  |  | .eq(SystemUser::getDeleted, Constants.ZERO) | 
|---|
|  |  |  | .eq(SystemUser::getType, Constants.ZERO) | 
|---|
|  |  |  | .eq(SystemUser::getMobile,platformBooks.getDriverPhone()) | 
|---|
|  |  |  | .last(" limit 1 ")); | 
|---|
|  |  |  | if(Objects.nonNull(driver) && StringUtils.isNotBlank(driver.getOpenid())){ | 
|---|
|  |  |  | //发送微信公众号通知 | 
|---|
|  |  |  | 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); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.BAD_REQUEST); | 
|---|
|  |  |  | 
|---|
|  |  |  | 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::getStatus,Constants.ZERO) | 
|---|
|  |  |  | .eq(CarDriver::getMemberId,approveDTO.getDriverId())); | 
|---|
|  |  |  | if(Objects.isNull(carDriver)){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"未查询到司机信息"); | 
|---|