| | |
| | | package com.doumee.service.business.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.extension.api.R; |
| | | 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.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.core.haikang.model.HKConstants; |
| | | import com.doumee.core.haikang.model.param.BaseResponse; |
| | | import com.doumee.core.haikang.model.param.request.ParkReservationAddRequest; |
| | | import com.doumee.core.haikang.model.param.respose.ParkReservationAddResponse; |
| | | import com.doumee.core.haikang.service.HKService; |
| | | import com.doumee.service.business.third.model.PageData; |
| | | import com.doumee.service.business.third.model.PageWrap; |
| | | import com.doumee.core.utils.Constants; |
| | | 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.CarUseBookJoinMapper; |
| | | 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; |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.doumee.service.system.NoticesService; |
| | | import com.doumee.service.business.third.EmayService; |
| | | import com.github.xiaoymin.knife4j.core.util.CollectionUtils; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import io.swagger.models.auth.In; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.xpath.operations.Bool; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | |
| | | @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; |
| | | @Autowired |
| | | private NoticesJoinMapper noticesJoinMapper; |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | private PlatformBooksMapper platformBooksMapper; |
| | | @Autowired |
| | | private PlatformJobMapper platformJobMapper; |
| | | @Autowired |
| | | private PlatformLogMapper platformLogMapper; |
| | | @Autowired |
| | | 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; |
| | | @Autowired |
| | | private DingTalk dingTalk; |
| | | @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)) { |
| | |
| | | if(CollectionUtils.isNotEmpty(noticesList)){ |
| | | //待我处理的数据 |
| | | internalHomeVO.setNoticeWaitNum( |
| | | noticesList.stream().filter(i->Constants.equalsInteger(i.getUserId(),memberId) |
| | | noticesList.stream().filter(i-> |
| | | Constants.equalsInteger(i.getUserId(),memberId) |
| | | &&Constants.equalsInteger(i.getStatus(),Constants.ZERO) |
| | | &&Constants.equalsInteger(i.getSendacopy(),Constants.ZERO) |
| | | &&StringUtils.equals(i.getParam2(),"0") |
| | | ).count() |
| | | ); |
| | | //已处理数据 |
| | | internalHomeVO.setNoticeDealNum( |
| | | noticesList.stream().filter(i->Constants.equalsInteger(i.getUserId(),memberId) |
| | | 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) |
| | | &&Constants.equalsInteger(i.getReaded(),Constants.ZERO) |
| | | ).count() |
| | | ); |
| | | } |
| | |
| | | selectList(new QueryWrapper<Notices>().lambda() |
| | | .ge(noticesDTO.getStartDate() != null, Notices::getCreateDate, Utils.Date.getStart(noticesDTO.getStartDate() )) |
| | | .le(noticesDTO.getEndDate() != null, Notices::getCreateDate, Utils.Date.getEnd(noticesDTO.getEndDate() )) |
| | | .eq(Notices::getUserId,noticesDTO.getMemberId()).orderByDesc(Notices::getCreateDate) |
| | | .eq(noticesDTO.getType() != null, Notices::getType, noticesDTO.getType()) |
| | | .eq(Notices::getUserId,noticesDTO.getMemberId()) |
| | | .orderByDesc(Notices::getCreateDate) |
| | | ); |
| | | internalHomeVO.setTaskNum(noticesList.size()); |
| | | if(CollectionUtils.isNotEmpty(noticesList)){ |
| | | //待我处理的数据 |
| | | internalHomeVO.setNoticeWaitNum( |
| | | noticesList.stream().filter(i->Constants.equalsInteger(i.getUserId(),noticesDTO.getMemberId()) |
| | | &&Constants.equalsInteger(i.getStatus(),Constants.ZERO) |
| | | &&Constants.equalsInteger(i.getSendacopy(),Constants.ZERO) |
| | | ).count() |
| | | ); |
| | | internalHomeVO.setNoticeDealNum( |
| | | noticesList.stream().filter(i->Constants.equalsInteger(i.getUserId(),noticesDTO.getMemberId()) |
| | | &&Constants.equalsInteger(i.getStatus(),Constants.ONE) |
| | | &&Constants.equalsInteger(i.getSendacopy(),Constants.ZERO) |
| | | ).count() |
| | | ); |
| | | if(CollectionUtils.isNotEmpty(noticesList)){ |
| | | //待我处理的数据 |
| | | internalHomeVO.setNoticeWaitNum( |
| | | 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( |
| | | noticesList.stream().filter(i->Constants.equalsInteger(i.getUserId(),noticesDTO.getMemberId()) |
| | | &&Constants.equalsInteger(i.getStatus(),Constants.ONE) |
| | | &&Constants.equalsInteger(i.getSendacopy(),Constants.ZERO) |
| | | ).count() |
| | | ); |
| | | |
| | | internalHomeVO.setNoticeCreateNum( |
| | | noticesJoinMapper.selectCount(new QueryWrapper<Notices>().lambda().eq(Notices::getParam3,noticesDTO.getMemberId())) |
| | | ); |
| | | internalHomeVO.setNoticeCreateNum( |
| | | noticesJoinMapper.selectCount(new QueryWrapper<Notices>().lambda().eq(Notices::getParam3,noticesDTO.getMemberId())) |
| | | ); |
| | | |
| | | internalHomeVO.setNoticeCopyNum( |
| | | noticesList.stream().filter(i->Constants.equalsInteger(i.getUserId(),noticesDTO.getMemberId()) |
| | | &&Constants.equalsInteger(i.getSendacopy(),Constants.ONE) |
| | | ).count() |
| | | ); |
| | | } |
| | | internalHomeVO.setNoticeCopyNum( |
| | | noticesList.stream().filter(i->Constants.equalsInteger(i.getUserId(),noticesDTO.getMemberId()) |
| | | &&Constants.equalsInteger(i.getSendacopy(),Constants.ONE) |
| | | &&Constants.equalsInteger(i.getReaded(),Constants.ZERO) |
| | | ).count() |
| | | ); |
| | | } |
| | | |
| | | return internalHomeVO; |
| | | } |
| | |
| | | * @param tempType 模板类型 0非施工人员访客申请 1施工人员访客申请 2访客报备 3公车市内用车 4公车室外用车 5市公司物流车预约 |
| | | * @param businessId 业务主键 根据 tempType |
| | | * @param createMemberId 提交流程人员 |
| | | * @param applyMember 申请人对象(如果为空,默认为提交人) |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class,BusinessException.class}) |
| | | public void createApproveFlow(Integer tempType,Integer businessId,Integer createMemberId){ |
| | | public void createApproveFlow(Integer tempType,Integer businessId,Integer createMemberId,Member applyMember){ |
| | | //查询处理模板 |
| | | ApproveTempl approveTempl = approveTemplMapper.selectOne(new QueryWrapper<ApproveTempl>().lambda() |
| | | .eq(ApproveTempl::getType,tempType) |
| | |
| | | } |
| | | List<ApproveParam> approveCopyList = approveParamAllList.stream().filter(i->i.getType().equals(Constants.ONE)).collect(Collectors.toList()); |
| | | |
| | | Member createMember = memberMapper.selectById(createMemberId); |
| | | Member createMember = memberMapper.selectById(createMemberId); |
| | | if(Objects.isNull(createMember)|| Objects.isNull(createMember.getCompanyId())){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"申请人组织信息异常"); |
| | | } |
| | | List<Approve> approveList = new ArrayList<>(); |
| | | this.organizeApproveData(approveTempl,approveParamList,createMember,applyMember,businessId,approveList); |
| | | if(CollectionUtils.isEmpty(approveList)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"审批流配置错误"); |
| | | } |
| | | //处理抄送数据 |
| | | if(CollectionUtils.isNotEmpty(approveCopyList)){ |
| | | this.organizeApproveCopyData(approveTempl,approveCopyList,businessId,approveList); |
| | | } |
| | | approveJoinMapper.insert(approveList); |
| | | |
| | | this.organizeApproveData(approveTempl,approveParamList,createMember,businessId,approveList); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class,BusinessException.class}) |
| | | public void createApproveForPlatfrom(Integer tempId,Integer businessId,Integer createMemberId ){ |
| | | //查询处理模板 |
| | | ApproveTempl approveTempl = approveTemplMapper.selectById(tempId); |
| | | if(Objects.isNull(approveTempl)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到审批流配置模板"); |
| | | } |
| | | //查询配置流程 |
| | | List<ApproveParam> approveParamAllList = approveParamMapper.selectList(new QueryWrapper<ApproveParam>() |
| | | .lambda().eq(ApproveParam::getIsdeleted,Constants.ZERO) |
| | | .eq(ApproveParam::getTemplId,approveTempl.getId()) |
| | | .orderByAsc(ApproveParam::getType) |
| | | .orderByAsc(ApproveParam::getLevel) |
| | | ); |
| | | if(Objects.isNull(approveParamAllList)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未配置审批流程"); |
| | | } |
| | | //审批配置 |
| | | List<ApproveParam> approveParamList = approveParamAllList.stream().filter(i->i.getType().equals(Constants.ZERO)).collect(Collectors.toList()); |
| | | if(Objects.isNull(approveParamList)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未配置审批流程"); |
| | | } |
| | | List<ApproveParam> approveCopyList = approveParamAllList.stream().filter(i->i.getType().equals(Constants.ONE)).collect(Collectors.toList()); |
| | | |
| | | Member createMember = memberMapper.selectById(createMemberId); |
| | | if(Objects.isNull(createMember)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"申请人组织信息异常"); |
| | | } |
| | | List<Approve> approveList = new ArrayList<>(); |
| | | |
| | | this.organizeApproveData(approveTempl,approveParamList,createMember,null,businessId,approveList); |
| | | |
| | | if(CollectionUtils.isEmpty(approveList)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"审批流配置错误"); |
| | |
| | | |
| | | //处理抄送数据 |
| | | if(CollectionUtils.isNotEmpty(approveCopyList)){ |
| | | this.organizeApproveCopyData(approveTempl,approveParamList,businessId,approveList); |
| | | this.organizeApproveCopyData(approveTempl,approveCopyList,businessId,approveList); |
| | | } |
| | | approveMapper.insertBatchSomeColumn(approveList); |
| | | |
| | | approveJoinMapper.insert(approveList); |
| | | } |
| | | |
| | | |
| | |
| | | * @param businessId |
| | | * @param approveList |
| | | */ |
| | | public void organizeApproveData(ApproveTempl approveTempl,List<ApproveParam> approveParamList,Member createMember,Integer businessId,List<Approve> approveList){ |
| | | public void organizeApproveData(ApproveTempl approveTempl,List<ApproveParam> approveParamList,Member createMember,Member applyMember,Integer businessId,List<Approve> approveList){ |
| | | |
| | | if(applyMember ==null){ |
| | | applyMember = createMember; |
| | | } |
| | | //创建默认人信息 |
| | | Approve createUserApprove = new Approve(); |
| | | createUserApprove.setRemark("发起申请"); |
| | | createUserApprove.setCreateDate(new Date()); |
| | | createUserApprove.setIsdeleted(Constants.ZERO); |
| | | createUserApprove.setTemplatId(approveTempl.getId()); |
| | | createUserApprove.setChekorId(createMember.getId()); |
| | | createUserApprove.setChekorId(applyMember.getId()); |
| | | createUserApprove.setCheckDate(createUserApprove.getCreateDate()); |
| | | createUserApprove.setStatus(Constants.approveStatus.pass); |
| | | createUserApprove.setTitle("发起申请"); |
| | | createUserApprove.setStatusInfo(""); |
| | |
| | | createUserApprove.setType(Constants.ZERO); |
| | | 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.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()); |
| | | String title = "【访客申请】申请人 - "; |
| | | 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()){ |
| | | title = this.createNoticesData(noticeType,businessId,title,jsonMap); |
| | | } |
| | | if(j==0){ |
| | | //默认生成一条 申请人的数据 标记删除状态用于处理到 任务中心(我发起)使用 |
| | | Notices notices = new Notices(); |
| | | notices.setCreateDate(new Date()); |
| | | notices.setIsdeleted(Constants.ONE); |
| | | notices.setObjId(businessId); |
| | | notices.setObjType(noticeType); |
| | | notices.setType(noticeType); |
| | | notices.setTitle(title); |
| | | notices.setParam1(JSONObject.toJSONString(jsonMap)); |
| | | notices.setStatus(Constants.ZERO); |
| | | notices.setReaded(Constants.ZERO); |
| | | notices.setSendacopy(Constants.ZERO); |
| | | notices.setParam2("0"); |
| | | notices.setParam3(createMember.getId().toString()); |
| | | notices.setInfo("处理中"); |
| | | noticesJoinMapper.insert(notices); |
| | | //访客人员不生成此记录 |
| | | if(!(Constants.equalsInteger(noticeType,Constants.noticesObjectType.visit)&&Constants.equalsInteger(applyMember.getType(),Constants.ONE))){ |
| | | //默认生成一条 申请人的数据 标记删除状态用于处理到 任务中心(我发起)使用 |
| | | Notices notices = new Notices(); |
| | | notices.setCreateDate(new Date()); |
| | | notices.setIsdeleted(Constants.ONE); |
| | | notices.setObjId(businessId); |
| | | notices.setObjType(noticeType); |
| | | notices.setType(noticeType); |
| | | notices.setTitle(title); |
| | | notices.setParam1(JSONObject.toJSONString(jsonMap)); |
| | | notices.setStatus(Constants.ZERO); |
| | | notices.setReaded(Constants.ZERO); |
| | | notices.setSendacopy(Constants.ZERO); |
| | | notices.setParam2("0"); |
| | | notices.setParam3(createMember.getId().toString()); |
| | | 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.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.setTemplatId(approveTempl.getId()); |
| | | approve.setChekorId(memberId); |
| | | approve.setStatus(i==0?Constants.ONE:Constants.ZERO); |
| | | approve.setStatusInfo(i==0?"审批中":"待审批"); |
| | | approve.setStatusInfo(i==0?"审批中":"待处理"); |
| | | approve.setTitle(StringUtils.isBlank(approveParam.getRemark())?"审批中":approveParam.getRemark()); |
| | | approve.setIsEndCheck((i+1) == approveParamList.size()?Constants.ONE:Constants.ZERO); |
| | | approve.setObjId(businessId); |
| | | approve.setLevel(i+1); |
| | |
| | | approve.setAddrParam(approveParam.getAddrParam()); |
| | | 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)){ |
| | | //物流车预约 |
| | | SmsEmailServiceImpl.sendPlatformBookSms(systemDictDataBiz, |
| | | emayService,smsEmailMapper,smsConfigMapper,platformBooksMapper,businessId, |
| | | SmsConstants.platformBookContent.platformBookWaitAudit, |
| | | null,Arrays.asList(member.getPhone().split(",")) |
| | | ); |
| | | //公众号通知 |
| | | if(StringUtils.isNotBlank(member.getSystemOpenid())){ |
| | | wxPlatNotice.sendPlatformBookTemplateNotice(systemDictDataBiz, |
| | | wxNoticeConfigMapper, |
| | | platformBooksMapper.selectById(businessId), |
| | | WxPlatConstants.platformBookContent.platformBookWaitAudit, |
| | | 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, |
| | | Arrays.asList(member.getSystemOpenid().split(",")) |
| | | ); |
| | | } |
| | | |
| | | }else if(Constants.equalsInteger(noticeType,Constants.noticesObjectType.visitReporting)){ |
| | | //访客报备 |
| | | SmsEmailServiceImpl.sendVisitReportSms(systemDictDataBiz, |
| | | emayService,smsEmailMapper,smsConfigMapper,visitsMapper,businessId, |
| | | SmsConstants.visitReportingContent.visitReportingNotice, |
| | | null,Arrays.asList(member.getPhone().split(",")) |
| | | ); |
| | | //公众号通知 |
| | | if(StringUtils.isNotBlank(member.getSystemOpenid())){ |
| | | wxPlatNotice.sendVisitTemplateNotice(systemDictDataBiz, |
| | | wxNoticeConfigMapper,visitsMapper.selectById(businessId), WxPlatConstants.visitReportContent.visitReportWaitAudit, |
| | | Arrays.asList(member.getSystemOpenid().split(",")) |
| | | ); |
| | | } |
| | | }else if(Constants.equalsInteger(noticeType,Constants.noticesObjectType.useCar)){ |
| | | //用车申请 |
| | | SmsEmailServiceImpl.sendCarUseSms(systemDictDataBiz, |
| | | emayService,smsEmailMapper,smsConfigMapper,carUseBookMapper,businessId, |
| | | 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, |
| | | 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 , |
| | | dingTalk.getToDoCarUseBookFiledInfo(carUseBook),"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() + "的访客申请", |
| | | erpId, |
| | | dingTalk.getToDoVisitFiledInfo(visits), "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(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) |
| | |
| | | if(Constants.equalsInteger(noticeType,Constants.noticesObjectType.visit)){ |
| | | title = title + visits.getName(); |
| | | }else{ |
| | | title = "【访客报备】申请人 - " + visits.getName(); |
| | | title = "[访客报备]申请人-" + visits.getName(); |
| | | } |
| | | jsonMap.put("name", "访问人:" + visits.getCompanyName() + " - " + visits.getReceptMemberName()); |
| | | jsonMap.put("sTime", "入园时间:" + DateUtil.DateToStr(visits.getStarttime() , "yyyy-MM-dd HH:mm")); |
| | |
| | | if(Objects.isNull(carUseBook)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"未查询到业务数据信息"); |
| | | } |
| | | title = "【用车申请】申请人 - " + carUseBook.getMemberName(); |
| | | title = "[用车申请]申请人-" + carUseBook.getMemberName(); |
| | | jsonMap.put("name", "申请人:" + carUseBook.getCompanyName() + " - " + carUseBook.getMemberName()); |
| | | jsonMap.put("sTime", "开始时间:" + DateUtil.DateToStr(carUseBook.getStartTime() , "yyyy-MM-dd HH:mm")); |
| | | jsonMap.put("eTime", "结束时间:" + DateUtil.DateToStr(carUseBook.getEndTime() , "yyyy-MM-dd HH:mm")); |
| | | jsonMap.put("usrNum", StringUtils.isBlank(carUseBook.getMemberIds())?"乘车人数: 0人": "乘车人数: " +carUseBook.getMemberIds().split(",").length +"人"); |
| | | jsonMap.put("mdd", StringUtils.isBlank(carUseBook.getAddr())?"目的地: - ": "目的地:" +carUseBook.getAddr()); |
| | | }else { |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED); |
| | | }else if(Constants.equalsInteger(noticeType,Constants.noticesObjectType.reason)){ |
| | | //物流车预约 |
| | | PlatformBooks platformBooks = platformBooksMapper.selectById(businessId); |
| | | if(Objects.isNull(platformBooks)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"未查询到业务数据信息"); |
| | | } |
| | | 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() ; |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | if(CollectionUtils.isNotEmpty(memberList)){ |
| | | userIds.addAll(memberList.stream().map(m->m.getId()).collect(Collectors.toList())); |
| | | } |
| | | //公务用车 默认加入 司机抄送 |
| | | if(approveTempl.getType()==Constants.THREE||approveTempl.getType()==Constants.FOUR){ |
| | | CarUseBook carUseBook = carUseBookMapper.selectById(businessId); |
| | | if(Objects.isNull(carUseBook)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"为查询到用车申请信息"); |
| | | } |
| | | CarDriver carDriver = carDriverMapper.selectById(carUseBook.getDriverId()); |
| | | if(Objects.isNull(carDriver)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"为查询到司机信息"); |
| | | } |
| | | userIds.add(carDriver.getMemberId()); |
| | | } |
| | | //公务用车 默认加入 司机抄送 2024年6月28日16:49:08 司机抄送修改到 审批业务时进行发送 |
| | | // if(approveTempl.getType()==Constants.THREE||approveTempl.getType()==Constants.FOUR){ |
| | | // CarUseBook carUseBook = carUseBookMapper.selectById(businessId); |
| | | // if(Objects.isNull(carUseBook)){ |
| | | // throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"为查询到用车申请信息"); |
| | | // } |
| | | // CarDriver carDriver = carDriverMapper.selectById(carUseBook.getDriverId()); |
| | | // if(Objects.isNull(carDriver)){ |
| | | // throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"为查询到司机信息"); |
| | | // } |
| | | // userIds.add(carDriver.getMemberId()); |
| | | // } |
| | | |
| | | if(CollectionUtils.isNotEmpty(userIds)){ |
| | | for (Integer memberId:userIds) { |
| | |
| | | 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; |
| | | if(Objects.isNull(objLevel)||Objects.isNull(companyId)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"审批流配置异常,请联系管理员"); |
| | | } |
| | | 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; |
| | | } |
| | | |
| | |
| | | private List<Approve> getLevelInfoFromList(Approve level,List<Approve> approveGroupList) { |
| | | List<Approve> list = new ArrayList<>(); |
| | | if(Constants.equalsInteger(level.getApproveType(),Constants.TWO)){ |
| | | level.setApproveType(Constants.ZERO); |
| | | level.setApproveType(Constants.TWO); |
| | | //如果是单人审批 |
| | | list.add(level); |
| | | return list; |
| | |
| | | waitModel.setType(Constants.ZERO); |
| | | waitModel.setTitle(StringUtils.defaultString(level.getTitle(),"审批人")); |
| | | waitModel.setStatus(Constants.equalsInteger(waitList.get(Constants.ZERO).getStatus(),Constants.ONE)?Constants.ONE:Constants.ZERO); |
| | | waitModel.setStatusInfo("处理中"); |
| | | if(Constants.equalsInteger(level.getStatus(),Constants.approveStatus.auditIng) |
| | | ||Constants.equalsInteger(level.getStatus(),Constants.approveStatus.pass)){ |
| | | waitModel.setMemberName(waitList.size() +"人会签"); |
| | | if(Constants.equalsInteger(waitModel.getStatus(),Constants.approveStatus.wait)){ |
| | | waitModel.setStatusInfo("待处理"); |
| | | }else if(Constants.equalsInteger(waitModel.getStatus(),Constants.approveStatus.auditIng)){ |
| | | waitModel.setStatusInfo("处理中"); |
| | | } |
| | | |
| | | waitModel.setMemberName(waitList.size() +"人会签"); |
| | | // if(Constants.equalsInteger(level.getStatus(),Constants.approveStatus.auditIng) |
| | | // ||Constants.equalsInteger(level.getStatus(),Constants.approveStatus.pass)){ |
| | | // waitModel.setMemberName(waitList.size() +"人会签"); |
| | | // } |
| | | if(CollectionUtils.isNotEmpty(waitList)){ |
| | | waitModel.setCreateDate(waitList.get(Constants.ZERO).getCreateDate()); |
| | | } |
| | | waitModel.setApproveList(waitList); |
| | | list.add(waitModel); |
| | |
| | | }else { |
| | | if((waitList.size()> 0 || otherPassList.size()>0)){ |
| | | Approve waitModel = new Approve(); |
| | | waitModel.setApproveType(Constants.ONE); |
| | | waitModel.setApproveType(Constants.ZERO); |
| | | if(Constants.equalsInteger(level.getStatus(),Constants.approveStatus.pass)){ |
| | | waitModel.setStatus(Constants.approveStatus.pass); |
| | | waitModel.setStatus(level.getStatus()); |
| | | waitModel.setType(Constants.ONE); |
| | | waitModel.setTitle("审批人(抄送或签审批人)"); |
| | | waitModel.setCheckDate(level.getCheckDate()); |
| | | waitModel.setTitle(StringUtils.defaultString(level.getTitle(),"审批人")); |
| | | }else{ |
| | | waitModel.setStatus(level.getStatus()); |
| | | waitModel.setType(Constants.ZERO); |
| | | waitModel.setStatusInfo(passList.size()<=0?StringUtils.defaultString(level.getTitle(),"审批人"):"抄送或签审批人"); |
| | | waitModel.setStatus(passList.size()>0?Constants.ONE:Constants.ZERO); |
| | | waitModel.setTitle(passList.size()<=0?StringUtils.defaultString(level.getTitle(),"审批人"):"抄送或签审批人"); |
| | | |
| | | } |
| | | List<Approve> approveList = new ArrayList<>(); |
| | | approveList.addAll(waitList); |
| | |
| | | if(passList.size()>0){ |
| | | approveList.addAll(otherPassList); |
| | | } |
| | | waitModel.setMemberName("已抄送"+ approveList.size() +"人"); |
| | | if(CollectionUtils.isNotEmpty(approveList)){ |
| | | waitModel.setCreateDate(approveList.get(Constants.ZERO).getCreateDate()); |
| | | } |
| | | if(Constants.equalsInteger(waitModel.getStatus(),Constants.approveStatus.pass)){ |
| | | waitModel.setMemberName("已抄送"+ approveList.size() +"人"); |
| | | }else if(Constants.equalsInteger(waitModel.getStatus(),Constants.approveStatus.wait)){ |
| | | waitModel.setMemberName(waitList.size() +"人或签"); |
| | | waitModel.setStatusInfo("待处理"); |
| | | }else{ |
| | | waitModel.setMemberName(waitList.size() +"人或签"); |
| | | waitModel.setStatusInfo("处理中"); |
| | | } |
| | | 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); |
| | | } |
| | | } |
| | | } |
| | |
| | | return Constants.ZERO; |
| | | } |
| | | |
| | | @Override |
| | | public String getApproveUserName(Integer businessId,Integer businessType){ |
| | | List<Approve> approveList = 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,businessId) |
| | | .eq(Approve::getObjType,businessType) |
| | | .eq(Approve::getType,Constants.ZERO) |
| | | .eq(Approve::getStatus,Constants.approveStatus.auditIng) |
| | | ); |
| | | if(CollectionUtils.isNotEmpty(approveList)){ |
| | | List<String> names = approveList.stream().map(m->m.getMemberName()).collect(Collectors.toList()); |
| | | return String.join(",",names); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | @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()) |
| | |
| | | || 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() |
| | |
| | | .last(" limit 1") |
| | | ); |
| | | if(Objects.isNull(approve)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到审批数据"); |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"申请已被他人审批"); |
| | | } |
| | | if(!approve.getStatus().equals(Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"审批记录状态错误!"); |
| | |
| | | .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>() |
| | |
| | | approveMapper.updateById(approve); |
| | | //是否处理 业务数据 |
| | | Boolean dealBusinessBean = false; |
| | | Boolean dealDDToDo = 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::getReaded,Constants.ONE) |
| | | .set(Notices::getParam2,approve.getStatus()) |
| | | .eq(Notices::getId,notices.getId()) |
| | | .set(Notices::getSendacopy,Constants.ONE) |
| | | .set(Notices::getStatus,Constants.ONE) |
| | | .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::getParam2,approve.getStatus()) |
| | | .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) |
| | | || Constants.equalsInteger( approve.getApproveType(),Constants.TWO)) && Constants.equalsInteger(approve.getIsEndCheck(),Constants.ONE)){ |
| | | //或签 / 单人审 且 终审 |
| | | approveJoinMapper.update(null,new UpdateWrapper<Approve>() |
| | | .lambda() |
| | | .set(Approve::getStatus,Constants.approveStatus.otherDeal) |
| | | .in(Approve::getId,approveList.stream().map(m->m.getId()).collect(Collectors.toList()))); |
| | | if(CollectionUtils.isNotEmpty(approveList)){ |
| | | 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; |
| | | }else if((approve.getApproveType().equals(Constants.ZERO) |
| | | || approve.getApproveType().equals(Constants.TWO)) &&approve.getIsEndCheck()!=Constants.ONE){ |
| | | //或签 / 单人审 非终审 则开启下一步业务流程 |
| | | /**处理本级数据**/ |
| | | approveJoinMapper.update(null,new UpdateWrapper<Approve>() |
| | | .lambda() |
| | | .set(Approve::getStatus,Constants.approveStatus.otherDeal) |
| | | .in(Approve::getId,approveList.stream().map(m->m.getId()).collect(Collectors.toList()))); |
| | | if(CollectionUtils.isNotEmpty(approveList)){ |
| | | 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()))); |
| | | } |
| | | /**开启下一级别的数据为待审核**/ |
| | | 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) |
| | | .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)) |
| | | ); |
| | | |
| | | //发送短信通知 下级审批人 |
| | | 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); |
| | | // } |
| | | }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) |
| | | .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) |
| | | .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)) |
| | | ); |
| | | |
| | | |
| | | //发送短信通知 下级审批人 |
| | | 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); |
| | | // } |
| | | } |
| | | } |
| | | this.passNextNotices(dealBusinessBean,notices,approve,approveList,approveCopyList); |
| | | 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(), |
| | | SmsConstants.platformBookContent.platformBookWaitAudit, |
| | | approveDTO.getCheckInfo(),memberPhone |
| | | ); |
| | | //公众号通知 |
| | | if(CollectionUtils.isNotEmpty(openIdList)){ |
| | | wxPlatNotice.sendPlatformBookTemplateNotice(systemDictDataBiz, |
| | | wxNoticeConfigMapper, |
| | | platformBooksMapper.selectById(approveDTO.getObjId()), |
| | | WxPlatConstants.platformBookContent.platformBookWaitAudit, |
| | | 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); |
| | | //发送公众号通知 |
| | | 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, |
| | | 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()) , |
| | | dingTalk.getToDoCarUseBookFiledInfo(carUseBook),"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) |
| | | ||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, |
| | | 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){ |
| | | 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() |
| | | .set(Notices::getEditDate,new Date()) |
| | | .set(Notices::getReaded,Constants.ONE) |
| | | .set(dealBusinessBean,Notices::getParam2,approve.getStatus()) |
| | | .set(Notices::getStatus,Constants.ONE) |
| | | .set(Notices::getInfo,Constants.equalsInteger(approveDTO.getStatus(),Constants.TWO)?"已通过":"已拒绝") |
| | | .set(dealBusinessBean,Notices::getParam2,Constants.ONE) |
| | | .set(Notices::getParam4,approveDTO.getLoginUserInfo().getMemberId()) |
| | | .eq(Notices::getId,notices.getId()) |
| | | ); |
| | | 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(dealBusinessBean,Notices::getParam2,approve.getStatus()) |
| | | .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); |
| | | } |
| | | } |
| | | } |
| | | 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 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){ |
| | | 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(),"未查询到申请记录"); |
| | | } |
| | | visits.setStatus(approveDTO.getStatus()); |
| | | visits.setEditDate(new Date()); |
| | | visits.setEditor(approveDTO.getLoginUserInfo().getMemberId()); |
| | | //下发访客报备车辆信息 |
| | | if(Constants.equalsInteger(approveDTO.getStatus(),Constants.TWO)&&approveDTO.getObjType().equals(Constants.approveObjectType.visitReporting)){ |
| | | Boolean sendStatus = true; |
| | | //查询当前启用的停车场 |
| | | List<Parks> parksList = parksMapper.selectList(new QueryWrapper<Parks>() |
| | | .lambda() |
| | | .isNotNull(Parks::getHkId) |
| | | .eq(Parks::getIsdeleted,Constants.ZERO)); |
| | | List<VisitPark> parkBookList = new ArrayList<>(); |
| | | if(CollectionUtils.isNotEmpty(parksList)){ |
| | | for (Parks parks:parksList) { |
| | | VisitPark visitPark = new VisitPark(); |
| | | visitPark.setIsdeleted(Constants.ZERO); |
| | | visitPark.setCreateDate(new Date()); |
| | | visitPark.setVisitApplyId(visits.getId().toString()); |
| | | visitPark.setCarCode(visits.getCarNos()); |
| | | visitPark.setParkId(parks.getId().toString()); |
| | | visitPark.setStartTime(visits.getStarttime()); |
| | | visitPark.setEndTime(visits.getEndtime()); |
| | | visitPark.setParkHkId(parks.getHkId()); |
| | | visitPark.setObjType(Constants.ZERO); |
| | | |
| | | ParkReservationAddRequest request = new ParkReservationAddRequest(); |
| | | request.setPlateNo(visitPark.getCarCode()); |
| | | request.setParkSyscode(visitPark.getParkHkId()); |
| | | request.setPhoneNo(visits.getPhone()); |
| | | request.setOwner(visits.getName()); |
| | | request.setAllowTimes(Constants.ONE+""); |
| | | request.setIsCharge(Constants.ONE+""); |
| | | request.setStartTime(Objects.isNull(visitPark.getStartTime())?DateUtil.getISO8601Timestamp2(new Date()):DateUtil.getISO8601Timestamp2(visitPark.getStartTime())); |
| | | request.setEndTime(Objects.isNull(visitPark.getEndTime())?"2999-12-31T00:00:00+08:00":DateUtil.getISO8601Timestamp2(visitPark.getEndTime())); |
| | | BaseResponse response = HKService.parkReservationAddition(request); |
| | | |
| | | visitPark.setHkDate(new Date()); |
| | | if(response!=null |
| | | && StringUtils.equals(response.getCode(), HKConstants.RESPONSE_SUCCEE)){ |
| | | ParkReservationAddResponse parkReservationAddResponse = (ParkReservationAddResponse) response.getData(); |
| | | visitPark.setHkId(parkReservationAddResponse.getReserveOrderNo()); |
| | | visitPark.setHkStatus(Constants.ONE); |
| | | visitPark.setRemark("包期成功"); |
| | | }else{ |
| | | visitPark.setHkStatus(Constants.TWO); |
| | | visitPark.setRemark("包期失败~"); |
| | | //下发失败 标记主业务状态为下发失败 |
| | | sendStatus = false; |
| | | } |
| | | parkBookList.add(visitPark); |
| | | |
| | | } |
| | | visitParkMapper.insert(parkBookList); |
| | | } |
| | | if(sendStatus){ |
| | | visits.setStatus(Constants.VisitStatus.xfSuccess); |
| | | }else{ |
| | | visits.setStatus(Constants.VisitStatus.xfFail); |
| | | } |
| | | } |
| | | //访客报备 |
| | | String objCode = ""; |
| | | if(approveDTO.getObjType().equals(Constants.approveObjectType.visitReporting)){ |
| | | //发送短信通知 |
| | | SmsEmailServiceImpl.sendVisitReportSms(systemDictDataBiz, |
| | | emayService,smsEmailMapper,smsConfigMapper,visitsMapper,visits.getId(), |
| | | Constants.equalsInteger(approveDTO.getStatus(),Constants.TWO)?SmsConstants.visitReportingContent.visitReportingAuditSuccess: |
| | | SmsConstants.visitReportingContent.visitReportingAuditFail, |
| | | approveDTO.getCheckInfo(),null |
| | | ); |
| | | objCode = Constants.equalsInteger(approveDTO.getStatus(),Constants.TWO)? |
| | | WxPlatConstants.visitReportContent.visitReportAuditSuccess:WxPlatConstants.visitReportContent.visitReportAuditFail; |
| | | |
| | | }else{ //访客申请 |
| | | //发送短信通知 |
| | | SmsEmailServiceImpl.sendVisitSms(systemDictDataBiz, |
| | | emayService,smsEmailMapper,smsConfigMapper,visitsMapper,visits.getId(), |
| | | Constants.equalsInteger(approveDTO.getStatus(),Constants.TWO)?SmsConstants.visitContent.visitAuditSuccess: |
| | | 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, |
| | | 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(), |
| | | dingTalk.getVisitNoticeMsg(visits,visits.getName()+"的"+(Constants.equalsInteger(visits.getType(),Constants.TWO)?"访客报备":"访客申请")+","+ |
| | | (Constants.equalsInteger(approveDTO.getStatus(),Constants.TWO)? "已审批通过":"已审批驳回")) |
| | | ); |
| | | } |
| | | } |
| | | 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)){ |
| | | // 市内外用车申请 |
| | | 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(),"未查询到司机信息"); |
| | | this.updDriver(approveDTO,approve,true); |
| | | carUseBook = carUseBookJoinMapper.selectById(approveDTO.getObjId()); |
| | | if(Objects.nonNull(carUseBook)){ |
| | | 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(systemUser.getMobile().split(",")) |
| | | ); |
| | | } |
| | | carUseBook.setDriverId(carDriver.getId()); |
| | | 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, |
| | | Arrays.asList(systemUser.getOpenid().split(",")),0); |
| | | } |
| | | } |
| | | carUseBookMapper.updateById(carUseBook); |
| | | }else if(approveDTO.getObjType().equals(Constants.approveObjectType.logisticsCarUse)){ |
| | | //TODO 物流车预约 |
| | | //钉钉通知发起人 |
| | | 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(), |
| | | dingTalk.getCarUseNoticeMsg(carUseBook,carUseBook.getMemberName() + "提交的公务用车,"+ |
| | | (Constants.equalsInteger(approveDTO.getStatus(),Constants.TWO)? "已审批通过":"已审批驳回")) |
| | | ); |
| | | } |
| | | if(StringUtils.isNotBlank(carUseBook.getDdBelongToUnionId()) |
| | | && StringUtils.isNotBlank(carUseBook.getDdToDoId())){ |
| | | //标记当前钉钉审批已完成 |
| | | dingTalk.updToDoNoticeInfoStatus(carUseBook.getDdBelongToUnionId(),carUseBook.getDdToDoId()); |
| | | } |
| | | |
| | | }else if(approveDTO.getObjType().equals(Constants.approveObjectType.reason)){ |
| | | //物流车预约 |
| | | 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()); |
| | | platformBooksMapper.updateById(platformBooks); |
| | | if(Constants.equalsInteger(approveDTO.getStatus(),Constants.TWO)){ |
| | | PlatformReason platformReason = platformReasonMapper.selectById(platformBooks.getReasonId()); |
| | | if(Objects.isNull(platformReason)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到入园原因数据"); |
| | | } |
| | | PlatformGroup platformGroup = platformGroupMapper.selectById(platformReason.getGroupId()); |
| | | if(Objects.isNull(platformGroup)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到入园原因配置月台组数据"); |
| | | } |
| | | |
| | | //生成任务记录 |
| | | PlatformJob platformJob = platformBooks.toPlatformJob(); |
| | | platformJob.setId(null); |
| | | platformJob.setPlatformGroupId(platformReason.getGroupId().intValue()); |
| | | if(Constants.equalsInteger(platformGroup.getType(),Constants.ZERO)){ |
| | | platformJob.setType(Constants.platformJobType.wxcxh); |
| | | }else if(Constants.equalsInteger(platformGroup.getType(),Constants.ONE)){ |
| | | platformJob.setType(Constants.platformJobType.wxczh); |
| | | }else{ |
| | | platformJob.setType(Constants.platformJobType.sgscxh); |
| | | } |
| | | platformJob.setStatus(Constants.PlatformJobStatus.WART_SIGN_IN.getKey()); |
| | | 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.setParam4(platformJob.getCarCodeFront()); |
| | | platformLog.setContent(Constants.PlatformJobLogType.CREATE.getInfo()); |
| | | platformLog.setObjType(Constants.PlatformJobLogType.CREATE.getKey()); |
| | | platformLog.setObjId(platformJob.getId().toString()); |
| | | platformLog.setAfterContent(JSONObject.toJSONString(platformJob)); |
| | | platformLogMapper.insert(platformLog); |
| | | } |
| | | //发送短信通知 |
| | | SmsEmailServiceImpl.sendPlatformBookSms(systemDictDataBiz, |
| | | emayService,smsEmailMapper,smsConfigMapper,platformBooksMapper,platformBooks.getId(), |
| | | Constants.equalsInteger(approveDTO.getStatus(),Constants.TWO)?SmsConstants.platformBookContent.platformBookAuditSuccess: |
| | | SmsConstants.platformBookContent.platformBookAuditFail, |
| | | approveDTO.getCheckInfo(),null |
| | | ); |
| | | |
| | | //发送微信公众号消息 |
| | | 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, |
| | | Arrays.asList(driver.getOpenid().split(",")),0); |
| | | } |
| | | |
| | | }else{ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | if(Constants.equalsInteger(approveDTO.getStatus(),Constants.TWO)){ |
| | | List<Approve> approveList = approveMapper.selectList(new QueryWrapper<Approve>().lambda().eq(Approve::getObjId,approve.getObjId()) |
| | | .eq(Approve::getObjType,approve.getObjType()) |
| | | .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()),","), |
| | | Objects.nonNull(visits)? |
| | | dingTalk.getVisitNoticeMsg(visits,visits.getName()+"的"+(Constants.equalsInteger(visits.getType(),Constants.TWO)?"访客报备":"访客申请")+",抄送给您,请知晓"): |
| | | dingTalk.getCarUseNoticeMsg(carUseBook,carUseBook.getMemberName() + "提交的公务用车,抄送给您,请知晓") |
| | | ); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | 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); |
| | | } |
| | | |
| | | |