|
|
@@ -1,16 +1,20 @@ |
|
|
|
package cn.com.taiji.ias.manager.order; |
|
|
|
|
|
|
|
import cn.com.taiji.common.manager.net.http.ServiceHandleException; |
|
|
|
import cn.com.taiji.core.entity.ass.AssAgencyConfig; |
|
|
|
import cn.com.taiji.core.entity.basic.QtkCardInfo; |
|
|
|
import cn.com.taiji.core.entity.basic.QtkCustomerInfo; |
|
|
|
import cn.com.taiji.core.entity.basic.QtkVehicleInfo; |
|
|
|
import cn.com.taiji.core.entity.dict.basic.PlateColorType; |
|
|
|
import cn.com.taiji.core.entity.dict.basic.UserType; |
|
|
|
import cn.com.taiji.core.model.comm.protocol.ias.ass.ResignRequest; |
|
|
|
import cn.com.taiji.core.model.comm.protocol.ias.order.IssueWxSignInfoRequest; |
|
|
|
import cn.com.taiji.core.model.comm.protocol.ias.order.IssueWxSignInfoResponse; |
|
|
|
import cn.com.taiji.core.model.comm.protocol.ias.order.SignQueryResponse; |
|
|
|
import cn.com.taiji.core.model.comm.protocol.valid.ErrorMsgBuilder; |
|
|
|
import cn.com.taiji.core.model.comm.protocol.valid.GlyServiceError; |
|
|
|
import cn.com.taiji.core.repo.jpa.ass.AssAgencyConfigRepo; |
|
|
|
import cn.com.taiji.core.repo.jpa.basic.QtkCardInfoRepo; |
|
|
|
import cn.com.taiji.ias.dict.DataType; |
|
|
|
import cn.com.taiji.ias.manager.ass.resign.ResignManager; |
|
|
|
import cn.com.taiji.ias.model.ServiceLogEvent; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
@@ -25,10 +29,15 @@ import java.util.Map; |
|
|
|
|
|
|
|
@Service |
|
|
|
public class OrderWxSignInfoManager extends AbstractOrderManager<IssueWxSignInfoRequest> { |
|
|
|
private static final String RES = "res"; |
|
|
|
@Autowired |
|
|
|
private SignCommonManager signCommonManager; |
|
|
|
@Autowired |
|
|
|
private QtkCardInfoRepo qtkCardInfoRepo; |
|
|
|
@Autowired |
|
|
|
private ResignManager resignManager; |
|
|
|
@Autowired |
|
|
|
private AssAgencyConfigRepo assAgencyConfigRepo; |
|
|
|
public OrderWxSignInfoManager() { |
|
|
|
super(DataType.WX_SIGN_INFO); |
|
|
|
} |
|
|
@@ -41,11 +50,45 @@ public class OrderWxSignInfoManager extends AbstractOrderManager<IssueWxSignInfo |
|
|
|
@Override |
|
|
|
protected void formatValidateInternal(ErrorMsgBuilder builder, IssueWxSignInfoRequest req, |
|
|
|
ServiceLogEvent event, Map<String, Object> dataStream) throws ServiceHandleException { |
|
|
|
logger.info("恢复签约request:{}",req.toJson()); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
protected void businessValidateInternal(ErrorMsgBuilder builder, IssueWxSignInfoRequest req, |
|
|
|
ServiceLogEvent event, Map<String, Object> dataStream) throws ServiceHandleException { |
|
|
|
QtkVehicleInfo vehicle = vehicleInfoRepo.findByVehicleId(req.getVehicleId()); |
|
|
|
if (vehicle == null) throw newBusinessException("未找到车辆信息"); |
|
|
|
QtkCardInfo card = qtkCardInfoRepo.findByVehicleIdAndCardStatus(vehicle.getVehicleId()); |
|
|
|
if (card == null) throw newBusinessException("未找到车辆对应的卡"); |
|
|
|
//渠道订单没有渠道配置或签约地址默认和黔通签约 |
|
|
|
AssAgencyConfig agencyConfig = assAgencyConfigRepo.findByAgencyId(card.getAgencyId()); |
|
|
|
if (agencyConfig != null && !agencyConfig.getQtSign()){ |
|
|
|
throw newBusinessException("需要渠道自己签约!"); |
|
|
|
} |
|
|
|
|
|
|
|
String[] split = req.getVehicleId().split("_"); |
|
|
|
if (split[1].equals("1")) {// |
|
|
|
throw newBusinessException("暂不支持黄牌签约!"); |
|
|
|
} |
|
|
|
ResignRequest request = new ResignRequest(); |
|
|
|
request.setWxOpenId(req.getOpenid()); |
|
|
|
request.setProductId(card.getPackageId()); |
|
|
|
request.setVehicleId(req.getVehicleId()); |
|
|
|
if (request.getFlag() != null){ |
|
|
|
request.setFlag(request.getFlag()); |
|
|
|
}else { |
|
|
|
request.setFlag(2); |
|
|
|
} |
|
|
|
QtkCustomerInfo customerInfo = customerInfoRepo.findByCustomerId(vehicle.getCustomerId()); |
|
|
|
if (customerInfo.getUserType() == UserType.PERSONAL_USER){ |
|
|
|
request.setName(customerInfo.getCustomerName()); |
|
|
|
request.setIdNum(customerInfo.getCustomerIdNum()); |
|
|
|
}else { |
|
|
|
request.setName(customerInfo.getAgentName()); |
|
|
|
request.setIdNum(customerInfo.getAgentIdNum()); |
|
|
|
} |
|
|
|
SignQueryResponse response = resignManager.serviceHandle(request); |
|
|
|
dataStream.put(RES,response); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
@@ -56,22 +99,7 @@ public class OrderWxSignInfoManager extends AbstractOrderManager<IssueWxSignInfo |
|
|
|
@Override |
|
|
|
protected IssueWxSignInfoResponse getRes(IssueWxSignInfoRequest reqDto, ServiceLogEvent event, |
|
|
|
Map<String, Object> dataStream) throws ServiceHandleException { |
|
|
|
logger.info("恢复签约request:{}",reqDto.toJson()); |
|
|
|
QtkVehicleInfo vehicle = vehicleInfoRepo.findByVehicleId(reqDto.getVehicleId()); |
|
|
|
if (vehicle == null) throw newBusinessException("未找到车辆信息"); |
|
|
|
QtkCardInfo card = qtkCardInfoRepo.findByVehicleIdAndCardStatus(vehicle.getVehicleId()); |
|
|
|
if (card == null) throw newBusinessException("未找到车辆对应的卡"); |
|
|
|
String[] split = reqDto.getVehicleId().split("_"); |
|
|
|
int color = Integer.parseInt(split[1]); |
|
|
|
SignQueryResponse res = new SignQueryResponse(); |
|
|
|
switch (PlateColorType.valueOfCode(color)) { |
|
|
|
case BLUE: |
|
|
|
case GREEN: |
|
|
|
res = signCommonManager.carSignV2(reqDto.getOpenid(), card.getPackageId(), reqDto.getVehicleId()); |
|
|
|
break; |
|
|
|
default: |
|
|
|
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("微信恢复签约只支持,蓝、渐变绿,车牌签约"); |
|
|
|
} |
|
|
|
SignQueryResponse res = (SignQueryResponse) dataStream.get(RES); |
|
|
|
IssueWxSignInfoResponse issueWxSignInfoResponse = new IssueWxSignInfoResponse(); |
|
|
|
issueWxSignInfoResponse.setAppid(res.getAppId()); |
|
|
|
issueWxSignInfoResponse.setSubAppid(res.getSubAppId()); |
|
|
@@ -84,6 +112,17 @@ public class OrderWxSignInfoManager extends AbstractOrderManager<IssueWxSignInfo |
|
|
|
issueWxSignInfoResponse.setPlateNumber(res.getPlateNumber()); |
|
|
|
issueWxSignInfoResponse.setSubOpenid(res.getSubOpenId()); |
|
|
|
issueWxSignInfoResponse.setChannelType(res.getChannelType()); |
|
|
|
|
|
|
|
// =============20250929新增插件需要参数============== |
|
|
|
issueWxSignInfoResponse.setUserState(res.getUserState()); |
|
|
|
issueWxSignInfoResponse.setDeductMode(res.getDeductMode()); |
|
|
|
issueWxSignInfoResponse.setPlateNumberInfo(res.getPlateNumberInfo()); |
|
|
|
issueWxSignInfoResponse.setAppId(res.getAppId()); |
|
|
|
issueWxSignInfoResponse.setSubAppId(res.getSubAppId()); |
|
|
|
issueWxSignInfoResponse.setOpenId(res.getOpenId()); |
|
|
|
issueWxSignInfoResponse.setSubOpenId(res.getSubOpenId()); |
|
|
|
issueWxSignInfoResponse.setPath(res.getPath()); |
|
|
|
issueWxSignInfoResponse.setPreopenId(res.getPreopenId()); |
|
|
|
return issueWxSignInfoResponse; |
|
|
|
} |
|
|
|
} |