|
|
@@ -7,8 +7,7 @@ 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; |
|
|
|
import cn.com.taiji.core.entity.issue.IssueOrderinfo; |
|
|
|
import cn.com.taiji.core.model.comm.protocol.ats.weiXin.AtsVehicleUserStateRequest; |
|
|
|
import cn.com.taiji.core.model.comm.protocol.ats.weiXin.AtsVehicleUserStateResponse; |
|
|
|
import cn.com.taiji.core.model.comm.protocol.ats.weiXin.*; |
|
|
|
import cn.com.taiji.core.model.comm.protocol.ias.order.SignQueryRequest; |
|
|
|
import cn.com.taiji.core.model.comm.protocol.ias.order.SignQueryResponse; |
|
|
|
import cn.com.taiji.core.model.comm.protocol.valid.ErrorMsgBuilder; |
|
|
@@ -68,12 +67,11 @@ public class SignQueryManager extends AbstractOrderManager<SignQueryRequest> { |
|
|
|
case GREEN: |
|
|
|
carSignV2(request, order, dataStream); |
|
|
|
break; |
|
|
|
// case YELLOW: |
|
|
|
// carSignV3(request, order); |
|
|
|
// break; |
|
|
|
case YELLOW: |
|
|
|
carSignV3(request, order,dataStream); |
|
|
|
break; |
|
|
|
default: |
|
|
|
// throw newBusinessException("微信签约只支持,蓝、渐变绿、黄,三种车牌签约"); |
|
|
|
throw newBusinessException("微信签约只支持,蓝、渐变绿,两种车牌签约"); |
|
|
|
throw newBusinessException("微信签约只支持,蓝、渐变绿、黄,三种车牌签约"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@@ -88,14 +86,15 @@ public class SignQueryManager extends AbstractOrderManager<SignQueryRequest> { |
|
|
|
request.setPlateNumber(order.getVehiclePlate()); |
|
|
|
request.setSubOpenId(req.getSubOpenId()); |
|
|
|
AtsVehicleUserStateResponse response = jsonPostRepeat(request); |
|
|
|
//签约过但是不是当前用户,重新签约 |
|
|
|
if (!"UNAUTHORIZED".equals(response.getUserState()) && !req.getSubOpenId().equals(response.getOpenId())) { |
|
|
|
//没有签约的要签约,签约过但是不是当前用户,重新签约 |
|
|
|
if (!req.getSubOpenId().equals(response.getOpenId())) { |
|
|
|
response.setUserState("UNAUTHORIZED"); |
|
|
|
SignQueryResponse signRes = copyProperties(response, new SignQueryResponse()); |
|
|
|
dataStream.put(RES, signRes); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
// 签约过 |
|
|
|
if (!"UNAUTHORIZED".equals(response.getUserState())) { |
|
|
|
order.setAgreementId(response.getOpenId()); |
|
|
|
order.setAgreementEnableTime(LocalDateTime.now()); |
|
|
@@ -105,11 +104,58 @@ public class SignQueryManager extends AbstractOrderManager<SignQueryRequest> { |
|
|
|
order.setOrderStep(ShippingStatus.WAIT_SHIPPING.equals(order.getShippingStatus()) ? |
|
|
|
IssueOrderStep.WAITING_SEND : IssueOrderStep.WAITING_ACTIVE); |
|
|
|
} |
|
|
|
dataStream.put(RES, new SignQueryResponse().setUserState(response.getUserState())); |
|
|
|
} |
|
|
|
orderInfoRepo.merge(order); |
|
|
|
} |
|
|
|
|
|
|
|
private void carSignV3(SignQueryRequest request, IssueOrderinfo order) { |
|
|
|
private void carSignV3(SignQueryRequest request, IssueOrderinfo order,Map<String, Object> dataStream) throws ServiceHandleException { |
|
|
|
|
|
|
|
|
|
|
|
CommonWxSignConfig signConfig = commonWxSignConfigRepo.findByAgencyIdAndVersion(order.getAgencyId(), 3); |
|
|
|
|
|
|
|
//查询状态 |
|
|
|
AtsVehicleSignV3ResultRequest resultRequest = new AtsVehicleSignV3ResultRequest(); |
|
|
|
resultRequest.setOpenId(request.getSubOpenId()); |
|
|
|
resultRequest.setPlateNumber(order.getVehiclePlate()); |
|
|
|
resultRequest.setMchid(signConfig.getMchId()); |
|
|
|
resultRequest.setApiV3Key(signConfig.getSignKey()); |
|
|
|
resultRequest.setPrivateKey(signConfig.getPrivateKey()); |
|
|
|
resultRequest.setSerialNo(signConfig.getSerialNo()); |
|
|
|
resultRequest.setPlanId(signConfig.getPlanId()); |
|
|
|
AtsVehicleSignV3ResultResponse resultResponse = jsonPostRepeat(resultRequest); |
|
|
|
|
|
|
|
if ("OPENED".equals(resultResponse.getBindState())) { |
|
|
|
//已签约 |
|
|
|
order.setAgreementId(request.getSubOpenId()); |
|
|
|
order.setAgreementEnableTime(LocalDateTime.now()); |
|
|
|
if (order.getOrderSource().equals(SourceType.CHANNEL)) { //渠道签约完成待激活 |
|
|
|
order.setOrderStep(IssueOrderStep.WAITING_ACTIVE); |
|
|
|
} else { |
|
|
|
order.setOrderStep(ShippingStatus.WAIT_SHIPPING.equals(order.getShippingStatus()) ? |
|
|
|
IssueOrderStep.WAITING_SEND : IssueOrderStep.WAITING_ACTIVE); |
|
|
|
} |
|
|
|
dataStream.put(RES, new SignQueryResponse().setUserState(resultResponse.getBindState())); |
|
|
|
} else { |
|
|
|
//没有签约 |
|
|
|
AtsVehicleSignV3Request v3Request = new AtsVehicleSignV3Request(); |
|
|
|
v3Request.setAppId(signConfig.getAppId()); |
|
|
|
v3Request.setMchid(signConfig.getMchId()); |
|
|
|
v3Request.setApiV3Key(signConfig.getSignKey()); |
|
|
|
v3Request.setPrivateKey(signConfig.getPrivateKey()); |
|
|
|
v3Request.setSerialNo(signConfig.getSerialNo()); |
|
|
|
v3Request.setPlanId(signConfig.getPlanId()); |
|
|
|
v3Request.setOpenId(request.getSubOpenId()); |
|
|
|
v3Request.setPlateNumber(order.getVehiclePlate()); |
|
|
|
v3Request.setUserName(order.getCustomerName()); |
|
|
|
v3Request.setIdNum(order.getCustomerIdNum()); |
|
|
|
AtsVehicleSignV3Response response = jsonPostRepeat(v3Request); |
|
|
|
SignQueryResponse signRes = copyProperties(response, new SignQueryResponse()); |
|
|
|
signRes.setUserState("UNAUTHORIZED"); |
|
|
|
dataStream.put(RES, signRes); |
|
|
|
return; |
|
|
|
} |
|
|
|
orderInfoRepo.merge(order); |
|
|
|
|
|
|
|
} |
|
|
|
|