| | |
| | | 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.SmsConfigMapper; |
| | |
| | | |
| | | @Autowired |
| | | private SystemDictDataBiz systemDictDataBiz; |
| | | @Autowired |
| | | private WxNoticeConfigMapper wxNoticeConfigMapper; |
| | | |
| | | @Autowired |
| | | private ApproveTemplMapper approveTemplMapper; |
| | |
| | | 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); |
| | |
| | | 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.getOpenid())){ |
| | | wxPlatNotice.sendPlatformBookTemplateNotice( |
| | | wxNoticeConfigMapper, |
| | | platformBooksMapper.selectById(businessId), |
| | | WxPlatConstants.platformBookContent.platformBookWaitAudit, |
| | | token, |
| | | Arrays.asList(member.getOpenid().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.getOpenid())){ |
| | | wxPlatNotice.sendVisitTemplateNotice( |
| | | wxNoticeConfigMapper,visitsMapper.selectById(businessId), WxPlatConstants.visitContent.visitWaitAudit, |
| | | token, |
| | | Arrays.asList(member.getOpenid().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.getOpenid())){ |
| | | wxPlatNotice.sendVisitTemplateNotice( |
| | | wxNoticeConfigMapper,visitsMapper.selectById(businessId), WxPlatConstants.visitReportContent.visitReportWaitAudit, |
| | | token, |
| | | Arrays.asList(member.getOpenid().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.getOpenid())){ |
| | | wxPlatNotice.sendCarUseBookTemplateNotice( |
| | | wxNoticeConfigMapper, |
| | | carUseBookMapper.selectById(businessId), |
| | | WxPlatConstants.carUseBookContent.carUseBookWaitAudit, |
| | | token, |
| | | Arrays.asList(member.getOpenid().split(",")), |
| | | Constants.ONE); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | 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 |
| | | ); |
| | | objCode = Constants.equalsInteger(approveDTO.getStatus(),Constants.TWO)? WxPlatConstants.visitContent.visitAuditSuccess:WxPlatConstants.visitContent.visitAuditFail; |
| | | } |
| | | visitsMapper.updateById(visits); |
| | | //发送微信公众号 |
| | | if(StringUtils.isNotBlank(objCode)){ |
| | | Member member = memberMapper.selectById(visits.getCreateMemberId()); |
| | | if(Objects.nonNull(member) && StringUtils.isNotBlank(member.getOpenid())){ |
| | | wxPlatNotice.sendVisitTemplateNotice( |
| | | wxNoticeConfigMapper,visits, objCode, |
| | | systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_ACCESS_TOKEN).getCode(), |
| | | Arrays.asList(member.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())){ |
| | | SmsEmailServiceImpl.sendCarUseSms(systemDictDataBiz, |
| | | emayService,smsEmailMapper,smsConfigMapper,carUseBookMapper,approveDTO.getObjId(), |
| | |
| | | SmsConstants.carUseBookContent.carUseBookAuditFail, |
| | | approveDTO.getCheckInfo(),Arrays.asList(member.getPhone().split(",")) |
| | | ); |
| | | } |
| | | if(StringUtils.isNotBlank(member.getOpenid())){ |
| | | //发送微信公众号通知 |
| | | wxPlatNotice.sendCarUseBookTemplateNotice( |
| | | 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(member.getOpenid().split(",")),0); |
| | | } |
| | | } |
| | | |
| | |
| | | approveDTO.getCheckInfo(),null |
| | | ); |
| | | |
| | | //TODO 发送微信公众号消息 |
| | | //发送微信公众号消息 |
| | | Member member = memberMapper.selectById(platformBooks.getDriverId() ); |
| | | if(Objects.nonNull(member) && StringUtils.isNotBlank(member.getOpenid())){ |
| | | //发送微信公众号通知 |
| | | wxPlatNotice.sendPlatformBookTemplateNotice( |
| | | 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(member.getOpenid().split(",")),0); |
| | | } |
| | | |
| | | }else{ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |