| package com.doumee.service.business.impl; | 
|   | 
| import com.alibaba.fastjson.JSONObject; | 
| import com.doumee.biz.system.SystemDictDataBiz; | 
| import com.doumee.core.constants.ResponseStatus; | 
| import com.doumee.core.exception.BusinessException; | 
| import com.doumee.dao.business.dao.UserActionMapper; | 
| import com.doumee.service.business.third.model.LoginUserInfo; | 
| 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.MemberMapper; | 
| import com.doumee.dao.business.dao.SmsConfigMapper; | 
| import com.doumee.dao.business.dao.SmsEmailMapper; | 
| import com.doumee.dao.business.join.ApproveJoinMapper; | 
| 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.join.NoticesJoinMapper; | 
| import com.doumee.dao.system.model.Notices; | 
| import com.doumee.dao.system.model.SystemUser; | 
| import com.doumee.dao.web.reqeust.PlatformBooksApplyDTO; | 
| import com.doumee.dao.web.reqeust.PlatformBooksCheckNumDTO; | 
| import com.doumee.dao.web.reqeust.RevokeDTO; | 
| import com.doumee.service.business.ApproveService; | 
| import com.doumee.service.business.PlatformBooksService; | 
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
| 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.business.third.EmayService; | 
| import com.github.yulichang.wrapper.MPJLambdaWrapper; | 
| import org.apache.commons.lang3.StringUtils; | 
| import org.springframework.beans.BeanUtils; | 
| import org.springframework.beans.factory.annotation.Autowired; | 
| import org.springframework.stereotype.Service; | 
| import org.springframework.transaction.annotation.Transactional; | 
| import org.springframework.util.CollectionUtils; | 
|   | 
| import java.math.BigDecimal; | 
| import java.util.*; | 
|   | 
| /** | 
|  * 月台入园预约信息表Service实现 | 
|  * @author 江蹄蹄 | 
|  * @date 2024/06/28 10:03 | 
|  */ | 
| @Service | 
| public class PlatformBooksServiceImpl implements PlatformBooksService { | 
|   | 
|     @Autowired | 
|     private PlatformBooksMapper platformBooksMapper; | 
|     @Autowired | 
|     private UserActionMapper userActionMapper; | 
|     @Autowired | 
|     private PlatformJobMapper platformJobMapper; | 
|   | 
|     @Autowired | 
|     private NoticesJoinMapper noticesJoinMapper; | 
|   | 
|     @Autowired | 
|     private ApproveTemplMapper approveTemplMapper; | 
|   | 
|     @Autowired | 
|     private PlatformReasonMapper platformReasonMapper; | 
|   | 
|     @Autowired | 
|     private PlatformGroupMapper platformGroupMapper; | 
|   | 
|     @Autowired | 
|     private SystemDictDataBiz systemDictDataBiz; | 
|   | 
|     @Autowired | 
|     private SystemUserMapper systemUserMapper; | 
|   | 
|     @Autowired | 
|     private ApproveService approveService; | 
|   | 
|     @Autowired | 
|     private MemberMapper memberMapper; | 
|   | 
|     @Autowired | 
|     private ApproveJoinMapper approveJoinMapper; | 
|   | 
|     @Autowired | 
|     private CarsMapper carsMapper; | 
|   | 
|     @Autowired | 
|     private SmsConfigMapper smsConfigMapper; | 
|   | 
|     @Autowired | 
|     private SmsEmailMapper smsEmailMapper; | 
|   | 
|     @Autowired | 
|     private EmayService emayService; | 
|   | 
|     @Autowired | 
|     private WxNoticeConfigMapper wxNoticeConfigMapper; | 
|   | 
|     @Autowired | 
|     private ApproveMapper approveMapper; | 
|   | 
|     @Override | 
|     public Integer create(PlatformBooks platformBooks) { | 
|   | 
|   | 
|         platformBooksMapper.insert(platformBooks); | 
|         return platformBooks.getId(); | 
|     } | 
|   | 
|     @Override | 
|     public void deleteById(Integer id) { | 
|         platformBooksMapper.deleteById(id); | 
|     } | 
|     @Override | 
|     @Transactional(rollbackFor = {BusinessException.class,Exception.class}) | 
|     public void deleteById(Integer id,LoginUserInfo user) { | 
|         PlatformBooks model =findById(id); | 
|         if(model ==null || Constants.equalsInteger(model.getIsdeleted(),Constants.ONE)){ | 
|             throw  new BusinessException(ResponseStatus.DATA_EMPTY); | 
|         } | 
|         Date date =new Date(); | 
|         platformBooksMapper.update(null,new UpdateWrapper<PlatformBooks>().lambda() | 
|                 .set(PlatformBooks::getIsdeleted,Constants.ONE) | 
|                 .set(PlatformBooks::getEditDate,date) | 
|                 .set(PlatformBooks::getEditor,user.getId()) | 
|                 .eq(PlatformBooks::getId,id)); | 
|         if(model.getJobId()!=null){ | 
|             platformJobMapper.update(null,new UpdateWrapper<PlatformJob>().lambda() | 
|                     .set(PlatformJob::getIsdeleted,Constants.ONE) | 
|                     .set(PlatformJob::getEditDate,new Date()) | 
|                     .set(PlatformJob::getEditor,user.getId()) | 
|                     .eq(PlatformJob::getId,model.getJobId()) | 
|                     .eq(PlatformJob::getIsdeleted,Constants.ZERO)); | 
|         } | 
|         String[] params = new String[3]; | 
|         params[0] = user.getRealname(); | 
|         params[1]=DateUtil.getPlusTime2(date); | 
|         params[2]="【合同号:"+model.getContractNum()+"】-【司机:"+model.getDriverName()+" "+model.getDriverPhone()+"】-【车牌好: "+model.getPlateNum()+"】"; | 
|         //记录删除日志 | 
|         UserActionServiceImpl.saveUserActionBiz(user,id,Constants.UserActionType.PLATFROM_BOOK_DEL,userActionMapper,date,params, JSONObject.toJSONString(model)); | 
|         //标记任务记录 | 
|         VisitsServiceImpl.dealCancelNoticesData(noticesJoinMapper,approveMapper,"系统删除",model.getId(), | 
|                 Constants.approveObjectType.reason, | 
|                 Constants.noticesObjectType.reason | 
|         ); | 
|     } | 
|     @Override | 
|     public void delete(PlatformBooks platformBooks) { | 
|         UpdateWrapper<PlatformBooks> deleteWrapper = new UpdateWrapper<>(platformBooks); | 
|         platformBooksMapper.delete(deleteWrapper); | 
|     } | 
|   | 
|     @Override | 
|     public void deleteByIdInBatch(List<Integer> ids) { | 
|         if (CollectionUtils.isEmpty(ids)) { | 
|             return; | 
|         } | 
|         platformBooksMapper.deleteBatchIds(ids); | 
|     } | 
|   | 
|     @Override | 
|     public void updateById(PlatformBooks platformBooks) { | 
|         platformBooksMapper.updateById(platformBooks); | 
|     } | 
|   | 
|     @Override | 
|     public void updateByIdInBatch(List<PlatformBooks> platformBookss) { | 
|         if (CollectionUtils.isEmpty(platformBookss)) { | 
|             return; | 
|         } | 
|         for (PlatformBooks platformBooks: platformBookss) { | 
|             this.updateById(platformBooks); | 
|         } | 
|     } | 
|   | 
|     @Override | 
|     public PlatformBooks findById(Integer id) { | 
|         return platformBooksMapper.selectById(id); | 
|     } | 
|   | 
|     @Override | 
|     public PlatformBooks findOne(PlatformBooks platformBooks) { | 
|         QueryWrapper<PlatformBooks> wrapper = new QueryWrapper<>(platformBooks); | 
|         return platformBooksMapper.selectOne(wrapper); | 
|     } | 
|   | 
|     @Override | 
|     public List<PlatformBooks> findList(PlatformBooks platformBooks) { | 
|         QueryWrapper<PlatformBooks> wrapper = new QueryWrapper<>(platformBooks); | 
|         return platformBooksMapper.selectList(wrapper); | 
|     } | 
|   | 
|     @Override | 
|     public PageData<PlatformBooks> findPage(PageWrap<PlatformBooks> pageWrap) { | 
|         IPage<PlatformBooks> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); | 
|         MPJLambdaWrapper<PlatformBooks> queryWrapper = new MPJLambdaWrapper<>(); | 
|         pageWrap.getModel().setIsdeleted(Constants.ZERO); | 
|         Utils.MP.blankToNull(pageWrap.getModel()); | 
|         queryWrapper | 
|                 .selectAll(PlatformBooks.class) | 
|                 .selectAs(PlatformJob::getStatus,PlatformBooks::getJobStatus) | 
|                 .selectAs(SystemUser::getRealname,PlatformBooks::getEditUserName) | 
|                 .leftJoin(PlatformJob.class,PlatformJob::getId,PlatformBooks::getJobId) | 
|                 .leftJoin(SystemUser.class,SystemUser::getId,PlatformJob::getEditDate) | 
|                 .eq(pageWrap.getModel().getId() != null, PlatformBooks::getId, pageWrap.getModel().getId()) | 
|                 .eq(pageWrap.getModel().getCreator() != null, PlatformBooks::getCreator, pageWrap.getModel().getCreator()) | 
|                 .ge(pageWrap.getModel().getCreateDate() != null, PlatformBooks::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getCreateDate())) | 
|                 .le(pageWrap.getModel().getCreateDate() != null, PlatformBooks::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getCreateDate())) | 
|                 .eq(pageWrap.getModel().getEditor() != null, PlatformBooks::getEditor, pageWrap.getModel().getEditor()) | 
|                 .ge(pageWrap.getModel().getEditDate() != null, PlatformBooks::getEditDate, Utils.Date.getStart(pageWrap.getModel().getEditDate())) | 
|                 .le(pageWrap.getModel().getEditDate() != null, PlatformBooks::getEditDate, Utils.Date.getEnd(pageWrap.getModel().getEditDate())) | 
|                 .eq(pageWrap.getModel().getIsdeleted() != null, PlatformBooks::getIsdeleted, pageWrap.getModel().getIsdeleted()) | 
|                 .eq(pageWrap.getModel().getName() != null, PlatformBooks::getName, pageWrap.getModel().getName()) | 
|                 .eq(pageWrap.getModel().getRemark() != null, PlatformBooks::getRemark, pageWrap.getModel().getRemark()) | 
|                 .eq(pageWrap.getModel().getStatus() != null, PlatformBooks::getStatus, pageWrap.getModel().getStatus()) | 
|                 .like(pageWrap.getModel().getContractNum() != null, PlatformBooks::getContractNum, pageWrap.getModel().getContractNum()) | 
|                 .ge(pageWrap.getModel().getArriveDate() != null, PlatformBooks::getArriveDate, Utils.Date.getStart(pageWrap.getModel().getArriveDate())) | 
|                 .le(pageWrap.getModel().getArriveDate() != null, PlatformBooks::getArriveDate, Utils.Date.getEnd(pageWrap.getModel().getArriveDate())) | 
|                 .eq(pageWrap.getModel().getInType() != null, PlatformBooks::getInType, pageWrap.getModel().getInType()) | 
|                 .eq(pageWrap.getModel().getTotalNum() != null, PlatformBooks::getTotalNum, pageWrap.getModel().getTotalNum()) | 
|                 .eq(pageWrap.getModel().getCarCodeFront() != null, PlatformBooks::getCarCodeFront, pageWrap.getModel().getCarCodeFront()) | 
|                 .eq(pageWrap.getModel().getCarCodeBack() != null, PlatformBooks::getCarCodeBack, pageWrap.getModel().getCarCodeBack()) | 
|                 .eq(pageWrap.getModel().getDriverId() != null, PlatformBooks::getDriverId, pageWrap.getModel().getDriverId()) | 
|                 .eq(pageWrap.getModel().getDriverName() != null, PlatformBooks::getDriverName, pageWrap.getModel().getDriverName()) | 
|                 .eq(pageWrap.getModel().getPlateNum() != null, PlatformBooks::getPlateNum, pageWrap.getModel().getPlateNum()) | 
|                 .eq(pageWrap.getModel().getDriverPhone() != null, PlatformBooks::getDriverPhone, pageWrap.getModel().getDriverPhone()) | 
|                 .ge(pageWrap.getModel().getQueryDate() != null, PlatformBooks::getCreateDate, pageWrap.getModel().getQueryDate()) | 
|                 .ge(pageWrap.getModel().getArriveDateStart() != null, PlatformBooks::getArriveDate, pageWrap.getModel().getArriveDateStart()) | 
|                 .le(pageWrap.getModel().getArriveDateEnd() != null, PlatformBooks::getArriveDate, pageWrap.getModel().getArriveDateEnd()) | 
|                 .eq(pageWrap.getModel().getReasonId() != null, PlatformBooks::getReasonId, pageWrap.getModel().getReasonId()) | 
|                 .eq(pageWrap.getModel().getJobStatus() != null, PlatformJob::getStatus, pageWrap.getModel().getJobStatus()) | 
|                 .orderByDesc(PlatformBooks::getCreateDate) | 
|         ; | 
|         PageData<PlatformBooks> pageData = PageData.from(platformBooksMapper.selectJoinPage(page,PlatformBooks.class, queryWrapper)); | 
|         for (PlatformBooks platformBooks:pageData.getRecords()) { | 
|             if(Constants.equalsInteger(platformBooks.getStatus(),Constants.ONE)||Constants.equalsInteger(platformBooks.getStatus(),Constants.ZERO)){ | 
|                 String auditName = approveService.getApproveUserName(platformBooks.getId(),Constants.approveObjectType.reason); | 
|                 platformBooks.setAuditName(auditName); | 
|             } | 
|         } | 
|   | 
|         return pageData; | 
|     } | 
|   | 
|   | 
|   | 
|   | 
|   | 
|     @Override | 
|     public long count(PlatformBooks platformBooks) { | 
|         QueryWrapper<PlatformBooks> wrapper = new QueryWrapper<>(platformBooks); | 
|         return platformBooksMapper.selectCount(wrapper); | 
|     } | 
|   | 
|   | 
|     @Override | 
|     public BigDecimal checkNum(PlatformBooksCheckNumDTO platformBooksCheckNumDTO){ | 
|         if(Objects.isNull(platformBooksCheckNumDTO) | 
|         || Objects.isNull(platformBooksCheckNumDTO.getTotalNum()) | 
|         || Objects.isNull(platformBooksCheckNumDTO.getReasonId()) | 
|         || Objects.isNull(platformBooksCheckNumDTO.getArriveDate())){ | 
|             return BigDecimal.ZERO; | 
|         } | 
|         //查询每日配置的总预约量 | 
|         PlatformReason platformReason = platformReasonMapper.selectById(platformBooksCheckNumDTO.getReasonId()); | 
|         if(Objects.isNull(platformReason)|| !Constants.equalsInteger(platformReason.getIsdeleted(),Constants.ZERO)){ | 
|             throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"入园原因信息异常,请刷新重试"); | 
|         } | 
|         List<PlatformBooks> platformBooksList = platformBooksMapper.selectList(new QueryWrapper<PlatformBooks>().lambda() | 
|                 .eq(PlatformBooks::getReasonId,platformBooksCheckNumDTO.getReasonId()) | 
|                 .ne(PlatformBooks::getStatus,Constants.THREE) | 
|                 .eq(PlatformBooks::getIsdeleted,Constants.ZERO) | 
|                 .like(PlatformBooks::getCreateDate, DateUtil.getDate(platformBooksCheckNumDTO.getArriveDate(),"yyyy-MM-dd")) | 
|         ); | 
|         if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(platformBooksList)){ | 
|            BigDecimal countNum =  platformBooksList.stream().map(m->m.getTotalNum()).reduce(BigDecimal.ZERO,BigDecimal::add); | 
|            if(countNum.compareTo(platformReason.getLimitNum())>=Constants.ZERO){ | 
|                return BigDecimal.ZERO; | 
|            } | 
|            return platformReason.getLimitNum().subtract(countNum); | 
|         } | 
|         return platformReason.getLimitNum(); | 
|     } | 
|   | 
|   | 
|     @Override | 
|     @Transactional(rollbackFor = {BusinessException.class,Exception.class}) | 
|     public Integer apply(PlatformBooksApplyDTO platformBooksApplyDTO){ | 
|         if(Objects.isNull(platformBooksApplyDTO) | 
|             || StringUtils.isBlank(platformBooksApplyDTO.getContractNum()) | 
|             || Objects.isNull(platformBooksApplyDTO.getArriveDate()) | 
|             || Objects.isNull(platformBooksApplyDTO.getInType()) | 
|             || Objects.isNull(platformBooksApplyDTO.getTotalNum()) | 
|             || StringUtils.isBlank(platformBooksApplyDTO.getCarCodeFront()) | 
|             || StringUtils.isBlank(platformBooksApplyDTO.getCarCodeBack()) | 
|             || Objects.isNull(platformBooksApplyDTO.getDriverId()) | 
|             || StringUtils.isBlank(platformBooksApplyDTO.getDriverPhone()) | 
|             || StringUtils.isBlank(platformBooksApplyDTO.getDriverName()) | 
|             || StringUtils.isBlank(platformBooksApplyDTO.getTransportImg()) | 
|             || Objects.isNull(platformBooksApplyDTO.getReasonId()) | 
|             || StringUtils.isBlank(platformBooksApplyDTO.getInReason()) | 
|         ){ | 
|             throw new BusinessException(ResponseStatus.BAD_REQUEST); | 
|         } | 
|         PlatformReason platformReason = platformReasonMapper.selectById(platformBooksApplyDTO.getReasonId()); | 
|         if(Objects.isNull(platformReason)|| !Constants.equalsInteger(platformReason.getIsdeleted(),Constants.ZERO)){ | 
|             throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"入园原因信息异常,请刷新重试"); | 
|         } | 
|         if(platformBooksApplyDTO.getTotalNum().compareTo(platformReason.getLimitNum())>Constants.ZERO){ | 
|             throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"任务量超出单日可作业量,请修改后重新输入!"); | 
|         } | 
|         PlatformGroup platformGroup= platformGroupMapper.selectById(platformReason.getGroupId()); | 
|         if(Objects.isNull(platformGroup)){ | 
|             throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到绑定月台组数据"); | 
|         } | 
|         if(!Constants.equalsInteger(platformGroup.getIsdeleted(),Constants.ZERO)){ | 
|             throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"绑定月台组数据异常,请联系管理员"); | 
|         } | 
|         if(!Constants.checkCarNo(platformBooksApplyDTO.getCarCodeFront())){ | 
|             throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"请输入正确的车牌!"); | 
|         }; | 
|         //查询车辆是否为自有车 | 
|         if(carsMapper.selectCount(new QueryWrapper<Cars>().lambda().eq(Cars::getIsdeleted,Constants.ZERO).eq(Cars::getCode,platformBooksApplyDTO.getCarCodeFront()))>Constants.ZERO){ | 
|             throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"["+platformBooksApplyDTO.getCarCodeFront()+"]属于内部车辆,无法预约"); | 
|         }; | 
|         ApproveTempl approveTempl = approveTemplMapper.selectById(platformReason.getApproveTemplId()); | 
|         if(Objects.isNull(approveTempl)){ | 
|             throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"未配置审批流,请联系管理员"); | 
|         } | 
|         if(!Constants.equalsInteger(approveTempl.getIsdeleted(),Constants.ZERO)){ | 
|             throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"审批流已停用,请联系管理员"); | 
|         } | 
|         PlatformBooks platformBooks = new PlatformBooks(); | 
|         BeanUtils.copyProperties(platformBooksApplyDTO,platformBooks); | 
|         platformBooks.setCreateDate(new Date()); | 
|         platformBooks.setIsdeleted(Constants.ZERO); | 
|         platformBooks.setStatus(Constants.ZERO); | 
|         platformBooks.setDriverId(platformBooksApplyDTO.getUserId()); | 
|         platformBooks.setEditDate(new Date()); | 
|         platformBooksMapper.insert(platformBooks); | 
|   | 
|         //创建审批流信息 | 
|         approveService.createApproveForPlatfrom(approveTempl.getId(),platformBooks.getId(),platformBooks.getDriverId()); | 
|         //发送公众号通知 给提交人 | 
|         SystemUser driver = systemUserMapper.selectOne(new QueryWrapper<SystemUser>().lambda() | 
|                 .eq(SystemUser::getDeleted, Constants.ZERO) | 
|                 .eq(SystemUser::getType, Constants.ZERO) | 
|                 .eq(SystemUser::getMobile,platformBooks.getDriverPhone()) | 
|                 .isNotNull(SystemUser::getOpenid) | 
|                 .last(" limit 1 ")); | 
|   | 
|         if(Objects.nonNull(driver)&&StringUtils.isNotBlank(driver.getOpenid())){ | 
|             WxPlatNotice wxPlatNotice = new WxPlatNotice(); | 
|             wxPlatNotice.sendPlatformBookTemplateNotice(systemDictDataBiz, | 
|                     wxNoticeConfigMapper, platformBooks, | 
|                     WxPlatConstants.platformBookContent.platformBookUpload, | 
|                     Arrays.asList(driver.getOpenid().split(",")),0); | 
|         } | 
|         return platformBooks.getId(); | 
|     } | 
|   | 
|   | 
|   | 
|     @Override | 
|     @Transactional(rollbackFor = {BusinessException.class,Exception.class}) | 
|     public Integer edit(PlatformBooksApplyDTO platformBooksApplyDTO){ | 
|         if(Objects.isNull(platformBooksApplyDTO) | 
|                 || Objects.isNull(platformBooksApplyDTO.getId()) | 
|                 || StringUtils.isBlank(platformBooksApplyDTO.getContractNum()) | 
|                 || Objects.isNull(platformBooksApplyDTO.getArriveDate()) | 
|                 || Objects.isNull(platformBooksApplyDTO.getInType()) | 
|                 || Objects.isNull(platformBooksApplyDTO.getTotalNum()) | 
|                 || StringUtils.isBlank(platformBooksApplyDTO.getCarCodeFront()) | 
|                 || StringUtils.isBlank(platformBooksApplyDTO.getCarCodeBack()) | 
|                 || Objects.isNull(platformBooksApplyDTO.getDriverId()) | 
|                 || StringUtils.isBlank(platformBooksApplyDTO.getDriverPhone()) | 
|                 || StringUtils.isBlank(platformBooksApplyDTO.getDriverName()) | 
|                 || StringUtils.isBlank(platformBooksApplyDTO.getTransportImg())){ | 
|             throw new BusinessException(ResponseStatus.BAD_REQUEST); | 
|         } | 
|         //查询车辆是否为自有车 | 
|         if(carsMapper.selectCount(new QueryWrapper<Cars>().lambda().eq(Cars::getIsdeleted,Constants.ZERO).eq(Cars::getCode,platformBooksApplyDTO.getCarCodeFront()))>Constants.ZERO){ | 
|             throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"["+platformBooksApplyDTO.getCarCodeFront()+"]属于内部车辆,无法预约"); | 
|         }; | 
|         PlatformBooks platformBooks = platformBooksMapper.selectById(platformBooksApplyDTO.getId()); | 
|         if(Objects.isNull(platformBooks)||Constants.equalsInteger(platformBooks.getIsdeleted(),Constants.ONE)){ | 
|             throw new BusinessException(ResponseStatus.DATA_EMPTY); | 
|         } | 
|         if(!Constants.equalsInteger(platformBooks.getStatus(),Constants.ZERO)){ | 
|             throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"业务状态已流转"); | 
|         } | 
|         BeanUtils.copyProperties(platformBooksApplyDTO,platformBooks); | 
|         platformBooks.setEditDate(new Date()); | 
|         platformBooks.setReasonId(null); | 
|         platformBooks.setInReason(null); | 
|         platformBooksMapper.updateById(platformBooks); | 
|   | 
|   | 
|   | 
|         Map<String,Object> jsonMap = new HashMap<>(); | 
|         String title = ApproveServiceImpl.creatPlatformBookNotice(platformBooks,jsonMap); | 
|         noticesJoinMapper.update(null,new UpdateWrapper<Notices>().lambda() | 
|                 .set(Notices::getParam1,JSONObject.toJSONString(jsonMap)) | 
|                 .set(Notices::getTitle,title) | 
|                 .eq(Notices::getObjType,Constants.noticesObjectType.reason) | 
|                 .eq(Notices::getTitle,title) | 
|                 .eq(Notices::getObjId,platformBooks.getId()) | 
|         ); | 
|   | 
|         return platformBooks.getId(); | 
|     } | 
|   | 
|   | 
|   | 
|     @Override | 
|     public PlatformBooks getDetail(Integer id,Integer memberId){ | 
|         PlatformBooks model = platformBooksMapper.selectById(id); | 
|         if(Objects.isNull(model)||Constants.equalsInteger(model.getIsdeleted(),Constants.ONE)){ | 
|             throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到预约记录"); | 
|         } | 
|         String prefixUrl = systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_RESOURCE_PATH).getCode() + | 
|                 systemDictDataBiz.queryByCode(Constants.FTP,Constants.PLATFORM).getCode(); | 
|         model.setPrefixUrl(prefixUrl); | 
|   | 
|         ApproveDataVO approveDataVO = approveService.arrangeApprovedData(id, | 
|                6, | 
|                 memberId); | 
|         model.setApproveDateVO(approveDataVO); | 
|         List<Approve> approveList = approveDataVO.getApproveList(); | 
|         if(Constants.equalsInteger(model.getStatus(),Constants.FOUR)){ | 
|             String path = systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_RESOURCE_PATH).getCode() | 
|                     +systemDictDataBiz.queryByCode(Constants.FTP,Constants.MEMBER_IMG).getCode(); | 
|             Member member = memberMapper.selectById(model.getDriverId()); | 
|   | 
|             Approve approve = new Approve(); | 
|             approve.setApproveType(Constants.ZERO); | 
|             approve.setCreateDate(model.getCancelTime()); | 
|             approve.setTitle("撤销人"); | 
|             approve.setStatusInfo("已撤销"); | 
|             approve.setStatus(Constants.FOUR); | 
|             approve.setType(Constants.ZERO); | 
|             if(member!=null) { | 
|                 approve.setMemberName(member.getName()); | 
|                 if (StringUtils.isNotBlank(member.getFaceImg())) { | 
|                     approve.setFaceImg(path + member.getFaceImg()); | 
|                 } | 
|             } | 
|             approve.setCheckInfo(model.getCancelInfo()); | 
|             approve.setCheckDate(model.getCancelTime()); | 
|             approveList.add(approve); | 
|         } | 
|   | 
|         Notices notices = noticesJoinMapper.selectOne(new QueryWrapper<Notices>().lambda() | 
|                 .eq(Notices::getObjId,id) | 
|                 .eq(Notices::getType,Constants.noticesObjectType.reason) | 
|                 .eq(Notices::getUserId,memberId) | 
|                 .eq(Notices::getSendacopy,Constants.ZERO) | 
|                 .orderByDesc(Notices::getId).last(" limit 1 ")); | 
|         if(Objects.nonNull(notices)){ | 
|             if(Constants.equalsInteger(notices.getStatus(),Constants.ZERO)){ | 
|                 model.setInfo("待我处理"); | 
|             }else{ | 
|                 model.setInfo(notices.getInfo()); | 
|             } | 
|         } | 
|         return model; | 
|     } | 
|   | 
|   | 
|   | 
|     @Override | 
|     public void revoke(RevokeDTO revokeDTO, LoginUserInfo loginUserInfo){ | 
|         if(Objects.isNull(revokeDTO) | 
|                 || Objects.isNull(revokeDTO.getId()) | 
|         ){ | 
|             throw new BusinessException(ResponseStatus.BAD_REQUEST); | 
|         } | 
|         PlatformBooks model = platformBooksMapper.selectById(revokeDTO.getId()); | 
|         if(Objects.isNull(model)||Constants.equalsInteger(model.getIsdeleted(),Constants.ONE)){ | 
|             throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到预约记录"); | 
|         } | 
|         if(!(Constants.equalsInteger(model.getStatus(),Constants.ZERO)||Constants.equalsInteger(model.getStatus(),Constants.ONE))){ | 
|             throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"业务状态已流转,无法进行该操作"); | 
|         } | 
|         model.setCancelUser(loginUserInfo.getId()); | 
|         model.setCancelInfo(revokeDTO.getInfo()); | 
|         model.setCancelTime(new Date()); | 
|         model.setStatus(Constants.FOUR); | 
|         platformBooksMapper.updateById(model); | 
|         //处理审批记录 | 
|         approveJoinMapper.update(null,new UpdateWrapper<Approve>() | 
|                 .lambda() | 
|                 .set(Approve::getIsdeleted,Constants.ONE) | 
|                 .set(Approve::getStatus,Constants.FOUR) | 
|                 .set(Approve::getCheckInfo,"物流车预约申请取消") | 
|                 .in(Approve::getStatus,Constants.ZERO,Constants.ONE) | 
|                 .eq(Approve::getObjType,Constants.approveObjectType.logisticsCarUse) | 
|                 .eq(Approve::getObjId,revokeDTO.getId()) | 
|         ); | 
|   | 
|         noticesJoinMapper.update(null,new UpdateWrapper<Notices>().lambda() | 
|                 .set(Notices::getEditDate,new Date()) | 
|                 .set(Notices::getInfo,"物流车预约申请取消") | 
|                 .set(Notices::getReaded,Constants.ONE) | 
|                 .set(Notices::getParam2,Constants.TWO) | 
|                 .set(Notices::getStatus,Constants.ONE) | 
|                 .eq(Notices::getType,Constants.noticesObjectType.reason) | 
|                 .eq(Notices::getObjId,model.getId()) | 
|         ); | 
|   | 
|         //发送短信通知 | 
|         SmsEmailServiceImpl.sendPlatformBookSms(systemDictDataBiz, | 
|                 emayService,smsEmailMapper,smsConfigMapper,platformBooksMapper,model.getId(), | 
|                         SmsConstants.platformBookContent.platformBookCancel, | 
|                 null,null | 
|         ); | 
|   | 
|   | 
|     } | 
|   | 
|   | 
| } |