|
@@ -17,12 +17,14 @@ import com.yh.saas.plugin.yiliangyiyun.util.EntityAnalyse;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
+import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
import java.text.ParseException;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
@@ -44,6 +46,86 @@ public class DriverInfoServiceImpl extends ServiceImpl<DriverInfoMapper, HyDrive
|
|
|
private INewsInfoService newsInfoService;
|
|
|
@Autowired
|
|
|
private ICommonUserService commonUserService;
|
|
|
+ @Autowired
|
|
|
+ private IOrderInfoService orderInfoService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询上报结果(每分钟执行一次)
|
|
|
+ */
|
|
|
+ @Transactional
|
|
|
+ @Scheduled(cron = "0 */1 * * * ?")
|
|
|
+ public void queryResults() throws IOException {
|
|
|
+
|
|
|
+ //查询司机上报结果
|
|
|
+ List<HyDriverInfo> hyDriverInfoList = this.selectList(new EntityWrapper<HyDriverInfo>()
|
|
|
+ .eq("escalation_status_key","5").eq("delete_flag","0"));
|
|
|
+ if (!CollectionUtils.isEmpty(hyDriverInfoList)){
|
|
|
+ //获取token
|
|
|
+ String token = EntityAnalyse.GetJTToken();
|
|
|
+ for (HyDriverInfo hyDriverInfo : hyDriverInfoList){
|
|
|
+ //上报司机信息校验结果查询
|
|
|
+ hyDriverInfo.setToken(token);
|
|
|
+ if ("通过".equals(EntityAnalyse.driverInfoCheck(hyDriverInfo))){
|
|
|
+ hyDriverInfo.setEscalationStatusKey(StatusEnum.PASSED.getFlag());
|
|
|
+ hyDriverInfo.setEscalationStatus(StatusEnum.PASSED.getName());
|
|
|
+ }else if ("待校验".equals(EntityAnalyse.driverInfoCheck(hyDriverInfo))){
|
|
|
+ hyDriverInfo.setEscalationStatusKey(StatusEnum.PARK_UNDER_REVIEW.getFlag());
|
|
|
+ hyDriverInfo.setEscalationStatus(StatusEnum.PARK_UNDER_REVIEW.getName());
|
|
|
+ }else {
|
|
|
+ hyDriverInfo.setEscalationStatusKey(StatusEnum.FAIL.getFlag());
|
|
|
+ hyDriverInfo.setEscalationStatus(StatusEnum.FAIL.getName());
|
|
|
+ hyDriverInfo.setEscalationFailureReason(EntityAnalyse.driverInfoCheck(hyDriverInfo));
|
|
|
+ }
|
|
|
+ this.updateById(hyDriverInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //查询车辆上报结果
|
|
|
+ List<HyDriverCarInfo> hyDriverCarInfoList = driverCarInfoService.selectList(new EntityWrapper<HyDriverCarInfo>()
|
|
|
+ .eq("escalation_status_key","5").eq("delete_flag","0"));
|
|
|
+ if (!CollectionUtils.isEmpty(hyDriverCarInfoList)){
|
|
|
+ //获取token
|
|
|
+ String token = EntityAnalyse.GetJTToken();
|
|
|
+ for (HyDriverCarInfo hyDriverCarInfo : hyDriverCarInfoList){
|
|
|
+ //上报车辆信息校验结果查询
|
|
|
+ hyDriverCarInfo.setToken(token);
|
|
|
+ if ("通过".equals(EntityAnalyse.driverCarInfoCheck(hyDriverCarInfo))){
|
|
|
+ hyDriverCarInfo.setEscalationStatusKey(StatusEnum.PASSED.getFlag());
|
|
|
+ hyDriverCarInfo.setEscalationStatus(StatusEnum.PASSED.getName());
|
|
|
+ }else if ("待校验".equals(EntityAnalyse.driverCarInfoCheck(hyDriverCarInfo))){
|
|
|
+ hyDriverCarInfo.setEscalationStatusKey(StatusEnum.PARK_UNDER_REVIEW.getFlag());
|
|
|
+ hyDriverCarInfo.setEscalationStatus(StatusEnum.PARK_UNDER_REVIEW.getName());
|
|
|
+ }else {
|
|
|
+ hyDriverCarInfo.setEscalationStatusKey(StatusEnum.FAIL.getFlag());
|
|
|
+ hyDriverCarInfo.setEscalationStatus(StatusEnum.FAIL.getName());
|
|
|
+ hyDriverCarInfo.setEscalationFailureReason(EntityAnalyse.driverCarInfoCheck(hyDriverCarInfo));
|
|
|
+ }
|
|
|
+ driverCarInfoService.updateById(hyDriverCarInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //查询运单上报结果
|
|
|
+ List<OrderInfo> orderInfoList = orderInfoService.selectList(new EntityWrapper<OrderInfo>()
|
|
|
+ .eq("escalation_status_key","5").eq("delete_flag","0"));
|
|
|
+ if (!CollectionUtils.isEmpty(orderInfoList)){
|
|
|
+ //获取token
|
|
|
+ String token = EntityAnalyse.GetJTToken();
|
|
|
+ for (OrderInfo orderInfo : orderInfoList){
|
|
|
+ //上报车辆信息校验结果查询
|
|
|
+ orderInfo.setToken(token);
|
|
|
+ if ("通过".equals(EntityAnalyse.waybillCheck(orderInfo))){
|
|
|
+ orderInfo.setEscalationStatusKey(StatusEnum.ADOPTED.getFlag());
|
|
|
+ orderInfo.setEscalationStatus(StatusEnum.ADOPTED.getName());
|
|
|
+ }else if ("待校验".equals(EntityAnalyse.waybillCheck(orderInfo))){
|
|
|
+ orderInfo.setEscalationStatusKey(StatusEnum.UNDER_REVIEW.getFlag());
|
|
|
+ orderInfo.setEscalationStatus(StatusEnum.UNDER_REVIEW.getName());
|
|
|
+ }else {
|
|
|
+ orderInfo.setEscalationStatusKey(StatusEnum.NOT_ADOPT.getFlag());
|
|
|
+ orderInfo.setEscalationStatus(StatusEnum.NOT_ADOPT.getName());
|
|
|
+ orderInfo.setEscalationFailureReason(EntityAnalyse.waybillCheck(orderInfo));
|
|
|
+ }
|
|
|
+ orderInfoService.updateById(orderInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -187,6 +269,28 @@ public class DriverInfoServiceImpl extends ServiceImpl<DriverInfoMapper, HyDrive
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public String editInfo(HyDriverInfo hyDriverInfo) throws IOException , ParseException {
|
|
|
+ //获取当前年月日
|
|
|
+ SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd");//设置日期格式
|
|
|
+ String date = f.format(new Date(System.currentTimeMillis()));
|
|
|
+ //获取当前日期
|
|
|
+ Date date1 = new Date();
|
|
|
+ //判断身份证有效期
|
|
|
+ if (!"长期".equals(hyDriverInfo.getCardValidityDate())) {
|
|
|
+ int result1 = hyDriverInfo.getCardValidityDate().compareTo(date);
|
|
|
+ if (result1 == 0){
|
|
|
+ throw new YException(YExceptionEnum.TERM_OF_VALIDITY);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //驾驶证
|
|
|
+ int result2 = hyDriverInfo.getDriverLicenseValidityDate().compareTo(date);
|
|
|
+ if (result2 == 0){
|
|
|
+ throw new YException(YExceptionEnum.DRIVER_TERM_OF_VALIDITY);
|
|
|
+ }
|
|
|
+ //从业资格证
|
|
|
+ int result3 = hyDriverInfo.getQualificationCertificateValidityDate().compareTo(date1);
|
|
|
+ if (result3 < 0){
|
|
|
+ throw new YException(YExceptionEnum.CONG_TERM_OF_VALIDITY);
|
|
|
+ }
|
|
|
hyDriverInfo.setAuthenticationStatusKey(StatusEnum.IDENTITY_REVIEWED.getFlag());
|
|
|
hyDriverInfo.setAuthenticationStatus(StatusEnum.IDENTITY_REVIEWED.getName());
|
|
|
hyDriverInfo.setBackStageStatusKey(StatusEnum.TO_BE_REVIEWED.getFlag());
|
|
@@ -285,7 +389,7 @@ public class DriverInfoServiceImpl extends ServiceImpl<DriverInfoMapper, HyDrive
|
|
|
//发送消息
|
|
|
NewsInfo newsInfo = new NewsInfo();
|
|
|
newsInfo.setReCommonId(hyDriverInfo1.getCommonId());
|
|
|
- newsInfo.setNewsContent("身份认证已驳回!驳回原因:" + hyDriverInfo.getRejectReason());
|
|
|
+ newsInfo.setNewsContent("身份认证已驳回!" + "\n" + "驳回原因:" + hyDriverInfo.getRejectReason() + "\n" + "驳回原因描述:" + hyDriverInfo.getRejectReasonDescription());
|
|
|
newsInfo.setBussId(hyDriverInfo1.getId());
|
|
|
newsInfo.setNewsTypeKey("1");
|
|
|
newsInfo.setNewsType("系统消息");
|