|
|
@@ -4,6 +4,8 @@ import cn.com.taiji.common.manager.ManagerException; |
|
|
|
import cn.com.taiji.common.model.dao.Pagination; |
|
|
|
|
|
|
|
import cn.com.taiji.core.entity.basic.QtkBrandInfo; |
|
|
|
import cn.com.taiji.core.entity.comm.QudaoCallbackResult; |
|
|
|
import cn.com.taiji.core.entity.dict.basic.CallQuDaoType; |
|
|
|
import cn.com.taiji.core.entity.dict.basic.SourceType; |
|
|
|
import cn.com.taiji.core.entity.dict.issue.IssueOrderStep; |
|
|
|
import cn.com.taiji.core.entity.dict.issue.ShippingStatus; |
|
|
@@ -12,7 +14,13 @@ import cn.com.taiji.core.entity.issue.IssueOrderinfoExt; |
|
|
|
import cn.com.taiji.core.entity.issue.IssueProduct; |
|
|
|
import cn.com.taiji.core.entity.user.Staff; |
|
|
|
|
|
|
|
import cn.com.taiji.core.model.comm.protocol.ats.model.CallbackModel; |
|
|
|
import cn.com.taiji.core.model.comm.protocol.ats.notice.AtsChannelNoticeRequest; |
|
|
|
import cn.com.taiji.core.model.comm.protocol.ats.notice.AtsChannelNoticeResponse; |
|
|
|
import cn.com.taiji.core.model.comm.protocol.ifmw.GetKeyRequest; |
|
|
|
import cn.com.taiji.core.model.comm.protocol.ifmw.GetKeyResponse; |
|
|
|
import cn.com.taiji.core.repo.jpa.basic.QtkBrandInfoRepo; |
|
|
|
import cn.com.taiji.core.repo.jpa.comm.QudaoCallbackResultRepo; |
|
|
|
import cn.com.taiji.core.repo.jpa.issue.IssueOrderinfoExtRepo; |
|
|
|
import cn.com.taiji.core.repo.jpa.issue.IssueOrderinfoRepo; |
|
|
|
import cn.com.taiji.core.repo.jpa.issue.IssueProductRepo; |
|
|
@@ -21,6 +29,7 @@ import cn.com.taiji.managew.dto.issueOrder.OrderDetailReqDTO; |
|
|
|
import cn.com.taiji.managew.dto.issueOrder.OrderExaminePageReqDTO; |
|
|
|
import cn.com.taiji.managew.dto.issueOrder.OrderExamineReqDTO; |
|
|
|
import cn.com.taiji.managew.manager.AbstractCommManager; |
|
|
|
import cn.com.taiji.managew.manager.AbstractManagewManager; |
|
|
|
import cn.com.taiji.managew.repo.jpa.request.IssueOrderExaminePageRequest; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.context.ApplicationContext; |
|
|
@@ -38,7 +47,7 @@ import java.util.regex.Pattern; |
|
|
|
* @description: 发行订单审核 |
|
|
|
*/ |
|
|
|
@Service |
|
|
|
public class IssueOrderExamineManageImpl extends AbstractCommManager implements IssueOrderExamineManage { |
|
|
|
public class IssueOrderExamineManageImpl extends AbstractManagewManager implements IssueOrderExamineManage { |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private IssueOrderinfoRepo issueOrderinfoRepo; |
|
|
@@ -50,6 +59,8 @@ public class IssueOrderExamineManageImpl extends AbstractCommManager implements |
|
|
|
private IssueOrderinfoExtRepo issueOrderinfoExtRepo; |
|
|
|
@Autowired |
|
|
|
private QtkBrandInfoRepo qtkBrandinfoRepo; |
|
|
|
@Autowired |
|
|
|
private QudaoCallbackResultRepo qudaoCallbackResultRepo; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private ApplicationContext applicationContext; |
|
|
@@ -128,6 +139,7 @@ public class IssueOrderExamineManageImpl extends AbstractCommManager implements |
|
|
|
IssueOrderinfoExt ext = issueOrderinfoExtRepo.findByOrderNo(order.getOrderNo()); |
|
|
|
ext.setAuditFailureCase(reqDto.getReason()); |
|
|
|
issueOrderinfoExtRepo.merge(ext); |
|
|
|
//不影响业务流程,全部异步执行 |
|
|
|
//新增公告表 |
|
|
|
String auditFailureCase = hasText(ext.getAuditReason()) ? ext.getAuditReason() : ""; |
|
|
|
if (reqDto.getAuditStatus() && auditFailureCase.contains("申办车型未找到匹配范围")) { |
|
|
@@ -136,22 +148,26 @@ public class IssueOrderExamineManageImpl extends AbstractCommManager implements |
|
|
|
brandinfo.setVehicleType(order.getVehicleType()); |
|
|
|
String vehicleModel = extractFirstEnAlphabetNumberStr(ext.getVehicleModel()); |
|
|
|
brandinfo.setVehicleModel(vehicleModel); |
|
|
|
brandinfo.setVin(ext.getVehicleVin().substring(0,8)); |
|
|
|
brandinfo.setVin(ext.getVehicleVin().substring(0, 8)); |
|
|
|
brandinfo.setCaculateStatus(1); |
|
|
|
Integer vehicleClass = order.getVehicleClass();//车型 |
|
|
|
if (order.getVanType()==1){ |
|
|
|
if (order.getVanType() == 1) { |
|
|
|
brandinfo.setPassengerChargeTypeMax(vehicleClass); |
|
|
|
brandinfo.setPassengerChargeTypeMin(vehicleClass); |
|
|
|
}else { |
|
|
|
} else { |
|
|
|
brandinfo.setVanChargeTypeMax(vehicleClass); |
|
|
|
brandinfo.setVanChargeTypeMin(vehicleClass); |
|
|
|
} |
|
|
|
logger.info("车辆model {},车型{},vin {}",vehicleModel,vehicleClass,ext.getVehicleVin()); |
|
|
|
logger.info("车辆model {},车型{},vin {}", vehicleModel, vehicleClass, ext.getVehicleVin()); |
|
|
|
qtkBrandinfoRepo.persist(brandinfo); |
|
|
|
}); |
|
|
|
} |
|
|
|
//通知渠道 todo |
|
|
|
|
|
|
|
//通知渠道 |
|
|
|
if (SourceType.CHANNEL.equals(order.getOrderSource())) { |
|
|
|
executor.execute(() -> { |
|
|
|
callBackQd(order, ext); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@@ -168,4 +184,52 @@ public class IssueOrderExamineManageImpl extends AbstractCommManager implements |
|
|
|
return ""; |
|
|
|
} |
|
|
|
|
|
|
|
private void callBackQd(IssueOrderinfo order, IssueOrderinfoExt ext) { |
|
|
|
//通知内容 |
|
|
|
CallbackModel callbackModel = new CallbackModel(); |
|
|
|
callbackModel.setOrderNo(order.getOrderNo()) |
|
|
|
.setOrderStep(order.getOrderStep().getCode()) |
|
|
|
.setOrderStatus(order.getOrderStatus().getCode()) |
|
|
|
.setMsg(ext.getAuditFailureCase()) |
|
|
|
.setCardId(order.getCardId()) |
|
|
|
.setObuId(order.getObuId()) |
|
|
|
.setPlateNum(order.getVehiclePlate()) |
|
|
|
.setPlateColor(order.getVehiclePlateColor()); |
|
|
|
//获取密钥 |
|
|
|
GetKeyRequest keyRequest = new GetKeyRequest(); |
|
|
|
keyRequest.setAgencyId(order.getAgencyId()); |
|
|
|
GetKeyResponse keyResponse = null; |
|
|
|
try { |
|
|
|
keyResponse = jsonPostRepeat(keyRequest); |
|
|
|
} catch (Exception e) { |
|
|
|
logger.error("通知渠道,获取密钥异常:{}", e.getMessage()); |
|
|
|
return; |
|
|
|
} |
|
|
|
//通知请求参数 |
|
|
|
AtsChannelNoticeRequest req = new AtsChannelNoticeRequest(); |
|
|
|
req.setCallbackModel(callbackModel); |
|
|
|
req.setAppId(keyResponse.getAppId()); |
|
|
|
req.setKey(keyResponse.getKey()); |
|
|
|
req.setSingKey(keyResponse.getSingKey()); |
|
|
|
req.setUrl(order.getReturnUrl()); |
|
|
|
|
|
|
|
String exceMsg = "";//异常信息 |
|
|
|
AtsChannelNoticeResponse response = null;//响应体 |
|
|
|
try { |
|
|
|
response = jsonPostRepeat(req); |
|
|
|
} catch (Exception e) { |
|
|
|
exceMsg = e.getMessage(); |
|
|
|
logger.error("通知渠道异常:{}", exceMsg); |
|
|
|
} |
|
|
|
//回调结果入库 |
|
|
|
QudaoCallbackResult quDaoCallBackResult = new QudaoCallbackResult(); |
|
|
|
quDaoCallBackResult.setOrderNo(order.getOrderNo()); |
|
|
|
quDaoCallBackResult.setReqUrl(order.getReturnUrl()); |
|
|
|
quDaoCallBackResult.setType(CallQuDaoType.ISSUES); |
|
|
|
quDaoCallBackResult.setReqJson(callbackModel.toJson()); |
|
|
|
quDaoCallBackResult.setRespJson(response == null ? "" : response.toJson()); |
|
|
|
quDaoCallBackResult.setExceptionMsg(exceMsg); |
|
|
|
qudaoCallbackResultRepo.persist(quDaoCallBackResult); |
|
|
|
} |
|
|
|
|
|
|
|
} |