| | |
| | | import com.doumee.dao.business.model.Member; |
| | | import com.doumee.dao.web.reqeust.SavePlatformWarnEventDTO; |
| | | import com.doumee.service.business.impl.PlatformWarnEventServiceImpl; |
| | | import com.doumee.service.business.third.TmsService; |
| | | import com.doumee.service.business.third.model.request.TmsOrderInfoRequest; |
| | | import com.doumee.service.business.third.model.response.TmsOrderInfoResponse; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.checkerframework.checker.units.qual.C; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | private PlatformBroadcastLogMapper platformBroadcastLogMapper; |
| | | @Autowired |
| | | private PlatformJobMapper platformJobMapper; |
| | | @Autowired |
| | | private TmsService tmsService; |
| | | @Autowired |
| | | private PlatformWmsDetailMapper platformWmsDetailMapper; |
| | | @Autowired |
| | |
| | | Constants.PlatformJobStatus.TRANSFERING.getKey(), |
| | | Constants.PlatformJobStatus.EXCEPTION.getKey() |
| | | ) |
| | | )==Constants.ZERO){ |
| | | )==Constants.ZERO){//如果没进行中任务 |
| | | PlatformJob platformJob = platformJobMapper.selectOne(new QueryWrapper<PlatformJob>().lambda() |
| | | .eq(PlatformJob::getCarCodeFront,event.getPlateNos()) |
| | | .eq(PlatformJob::getIsdeleted,Constants.ZERO) |
| | |
| | | .last(" limit 1") |
| | | ); |
| | | if(Objects.nonNull(platformJob)){ |
| | | platformJob.setStatus(Constants.PlatformJobStatus.WAIT_CALL.getKey()); |
| | | platformJob.setArriveDate(new Date()); |
| | | platformJob.setSingType(Constants.TWO); |
| | | platformJob.setSignDate(new Date()); |
| | | List<PlatformJob> signList = platformJobMapper.selectList(new QueryWrapper<PlatformJob>().lambda().apply(" DATE(SIGN_DATE) = DATE(NOW()) and sign_date is not null ")); |
| | | if(CollectionUtils.isEmpty(signList)){ |
| | | platformJob.setSignNum(Constants.ONE); |
| | | } else{ |
| | | int maxNumber = Collections.max(signList.stream().map(i->i.getSignNum()).collect(Collectors.toList())); |
| | | platformJob.setSignNum(maxNumber + Constants.ONE); |
| | | if(Constants.equalsInteger(platformJob.getType(),Constants.ONE)){ |
| | | //如果是自有车装货自动签到 |
| | | jobAutoSignBiz(platformJob); |
| | | }else if(Constants.equalsInteger(platformJob.getType(),Constants.ZERO)){ |
| | | //如果是自有车卸货 查询TMS合同状态,决定是否自动签到 |
| | | checkTmsContractStatusBiz(platformJob); |
| | | } |
| | | platformJobMapper.updateById(platformJob); |
| | | |
| | | } |
| | | } |
| | | }; |
| | |
| | | return event; |
| | | } |
| | | |
| | | /** |
| | | * ;如果是卸货任务,需要通过TMS提供的“2.2合同列表接口”接口查询车辆对应的合同状态是否为在途状态(对应orderStatus值为3/4/5/6), |
| | | * 如果是自动签到,否则不自动签到;如果一个车辆对应多个合同号,则取运单下任一合同查询对应在途信息 |
| | | * @param platformJob |
| | | */ |
| | | private void checkTmsContractStatusBiz(PlatformJob platformJob) { |
| | | PlatformWmsDetail detail = platformWmsDetailMapper.selectOne(new QueryWrapper<PlatformWmsDetail>().lambda() |
| | | .eq(PlatformWmsDetail::getIsdeleted, Constants.ZERO) |
| | | .eq(PlatformWmsDetail::getJobId, platformJob.getId()) |
| | | .isNotNull(PlatformWmsDetail::getContractNum) |
| | | .last("limit 1") |
| | | ); |
| | | if(detail!=null && StringUtils.isNotBlank(detail.getContractNum())){ |
| | | TmsOrderInfoRequest param = new TmsOrderInfoRequest(); |
| | | param.setContractNumber(detail.getContractNum()); |
| | | TmsOrderInfoResponse response = tmsService.orderInfo(param); |
| | | if(response!=null &&( StringUtils.equals(response.getOrderStatus(),"3") ) |
| | | ||StringUtils.equals(response.getOrderStatus(),"4") |
| | | ||StringUtils.equals(response.getOrderStatus(),"5") |
| | | ||StringUtils.equals(response.getOrderStatus(),"6")){ |
| | | //如果合同在途,则自动签到 |
| | | jobAutoSignBiz(platformJob); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | private void jobAutoSignBiz(PlatformJob platformJob) { |
| | | platformJob.setStatus(Constants.PlatformJobStatus.WAIT_CALL.getKey()); |
| | | platformJob.setArriveDate(new Date()); |
| | | platformJob.setSingType(Constants.TWO); |
| | | platformJob.setSignDate(new Date()); |
| | | List<PlatformJob> signList = platformJobMapper.selectList(new QueryWrapper<PlatformJob>().lambda().apply(" DATE(SIGN_DATE) = DATE(NOW()) and sign_date is not null ")); |
| | | if(CollectionUtils.isEmpty(signList)){ |
| | | platformJob.setSignNum(Constants.ONE); |
| | | } else{ |
| | | int maxNumber = Collections.max(signList.stream().map(i->i.getSignNum()).collect(Collectors.toList())); |
| | | platformJob.setSignNum(maxNumber + Constants.ONE); |
| | | } |
| | | platformJobMapper.updateById(platformJob); |
| | | } |
| | | |
| | | private Retention getRetentionModelByParkRequest(EventParkInfoRequest request,CarEvent event) { |
| | | Retention retention = new Retention(); |
| | | retention.setIsdeleted(Constants.ZERO); |