|  |  |  | 
|---|
|  |  |  | import com.doumee.core.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.dao.business.ApproveTemplMapper; | 
|---|
|  |  |  | import com.doumee.dao.business.MemberMapper; | 
|---|
|  |  |  | import com.doumee.dao.business.PlatformBooksMapper; | 
|---|
|  |  |  | import com.doumee.dao.business.PlatformReasonMapper; | 
|---|
|  |  |  | import com.doumee.dao.business.*; | 
|---|
|  |  |  | import com.doumee.dao.business.join.ApproveJoinMapper; | 
|---|
|  |  |  | import com.doumee.dao.business.model.*; | 
|---|
|  |  |  | import com.doumee.dao.business.vo.ApproveDataVO; | 
|---|
|  |  |  | import com.doumee.dao.system.join.NoticesJoinMapper; | 
|---|
|  |  |  | import com.doumee.dao.web.reqeust.ConfirmTaskDTO; | 
|---|
|  |  |  | import com.doumee.dao.web.reqeust.PlatformBooksApplyDTO; | 
|---|
|  |  |  | import com.doumee.dao.web.reqeust.PlatformBooksCheckNumDTO; | 
|---|
|  |  |  | 
|---|
|  |  |  | 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 org.apache.commons.lang3.StringUtils; | 
|---|
|  |  |  | import org.apache.tomcat.util.bcel.Const; | 
|---|
|  |  |  | import org.springframework.beans.BeanUtils; | 
|---|
|  |  |  | 
|---|
|  |  |  | private PlatformBooksMapper platformBooksMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private NoticesJoinMapper noticesJoinMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private ApproveTemplMapper approveTemplMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private PlatformReasonMapper platformReasonMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private PlatformGroupMapper platformGroupMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SystemDictDataBiz systemDictDataBiz; | 
|---|
|  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private ApproveJoinMapper approveJoinMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private CarsMapper carsMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SmsConfigMapper smsConfigMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SmsEmailMapper smsEmailMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private EmayService emayService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public Integer create(PlatformBooks platformBooks) { | 
|---|
|  |  |  | 
|---|
|  |  |  | .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, Utils.Date.getStart(pageWrap.getModel().getArriveDateStart())) | 
|---|
|  |  |  | .le(pageWrap.getModel().getArriveDateEnd() != null, PlatformBooks::getArriveDate, Utils.Date.getEnd(pageWrap.getModel().getArriveDateEnd())) | 
|---|
|  |  |  | .orderByDesc(PlatformBooks::getCreateDate) | 
|---|
|  |  |  | ; | 
|---|
|  |  |  | return PageData.from(platformBooksMapper.selectPage(page, queryWrapper)); | 
|---|
|  |  |  | PageData<PlatformBooks> pageData = PageData.from(platformBooksMapper.selectPage(page, 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) { | 
|---|
|  |  |  | 
|---|
|  |  |  | if(Objects.isNull(platformReason)|| !Constants.equalsInteger(platformReason.getIsdeleted(),Constants.ZERO)){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"入园原因信息异常,请刷新重试"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | ApproveTempl approveTempl = approveTemplMapper.selectById(platformReason.getId()); | 
|---|
|  |  |  | 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(),"未配置审批流,请联系管理员"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | platformBooks.setIsdeleted(Constants.ZERO); | 
|---|
|  |  |  | platformBooks.setStatus(Constants.ZERO); | 
|---|
|  |  |  | platformBooks.setDriverId(platformBooksApplyDTO.getUserId()); | 
|---|
|  |  |  | platformBooks.setEditDate(new Date()); | 
|---|
|  |  |  | platformBooksMapper.insert(platformBooks); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //创建审批流信息 | 
|---|
|  |  |  | approveService.createApproveForPlatfrom(platformReason.getApproveTemplId(),platformBooks.getId(),platformBooks.getDriverId()); | 
|---|
|  |  |  | approveService.createApproveForPlatfrom(approveTempl.getId(),platformBooks.getId(),platformBooks.getDriverId()); | 
|---|
|  |  |  | return platformBooks.getId(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | ){ | 
|---|
|  |  |  | 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)){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.DATA_EMPTY); | 
|---|
|  |  |  | 
|---|
|  |  |  | .eq(Approve::getObjType,Constants.approveObjectType.logisticsCarUse) | 
|---|
|  |  |  | .eq(Approve::getObjId,revokeDTO.getId()) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //发送短信通知 | 
|---|
|  |  |  | SmsEmailServiceImpl.sendPlatformBookSms(systemDictDataBiz, | 
|---|
|  |  |  | emayService,smsEmailMapper,smsConfigMapper,platformBooksMapper,model.getId(), | 
|---|
|  |  |  | SmsConstants.platformBookContent.platformBookCancel, | 
|---|
|  |  |  | null,null | 
|---|
|  |  |  | ); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|