|
|
@@ -0,0 +1,89 @@ |
|
|
|
package cn.com.taiji.ias.manager.order; |
|
|
|
|
|
|
|
import cn.com.taiji.common.manager.net.http.ServiceHandleException; |
|
|
|
import cn.com.taiji.core.entity.basic.QtkCardInfo; |
|
|
|
import cn.com.taiji.core.entity.basic.QtkVehicleInfo; |
|
|
|
import cn.com.taiji.core.entity.dict.basic.PlateColorType; |
|
|
|
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.basic.QtkCardInfoRepo; |
|
|
|
import cn.com.taiji.ias.dict.DataType; |
|
|
|
import cn.com.taiji.ias.model.ServiceLogEvent; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
/** |
|
|
|
* @Author : cehnchaod |
|
|
|
* @Date: 2025/2/20 23:37 |
|
|
|
* @Description: |
|
|
|
*/ |
|
|
|
|
|
|
|
@Service |
|
|
|
public class OrderWxSignInfoManager extends AbstractOrderManager<IssueWxSignInfoRequest> { |
|
|
|
@Autowired |
|
|
|
private SignCommonManager signCommonManager; |
|
|
|
@Autowired |
|
|
|
private QtkCardInfoRepo qtkCardInfoRepo; |
|
|
|
public OrderWxSignInfoManager() { |
|
|
|
super(DataType.WX_SIGN_INFO); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
protected String getDataId(IssueWxSignInfoRequest req) { |
|
|
|
return ""; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
protected void formatValidateInternal(ErrorMsgBuilder builder, IssueWxSignInfoRequest req, |
|
|
|
ServiceLogEvent event, Map<String, Object> dataStream) throws ServiceHandleException { |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
protected void businessValidateInternal(ErrorMsgBuilder builder, IssueWxSignInfoRequest req, |
|
|
|
ServiceLogEvent event, Map<String, Object> dataStream) throws ServiceHandleException { |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
protected void persistInternal(IssueWxSignInfoRequest req, ServiceLogEvent event, |
|
|
|
Map<String, Object> dataStream) throws ServiceHandleException { |
|
|
|
} |
|
|
|
|
|
|
|
@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("微信恢复签约只支持,蓝、渐变绿,车牌签约"); |
|
|
|
} |
|
|
|
IssueWxSignInfoResponse issueWxSignInfoResponse = new IssueWxSignInfoResponse(); |
|
|
|
issueWxSignInfoResponse.setAppid(res.getAppId()); |
|
|
|
issueWxSignInfoResponse.setSubAppid(res.getSubAppId()); |
|
|
|
issueWxSignInfoResponse.setMchId(res.getMchId()); |
|
|
|
issueWxSignInfoResponse.setSubMchId(res.getSubMchId()); |
|
|
|
issueWxSignInfoResponse.setNonceStr(res.getNonceStr()); |
|
|
|
issueWxSignInfoResponse.setSignType(res.getSignType()); |
|
|
|
issueWxSignInfoResponse.setSign(res.getSign()); |
|
|
|
issueWxSignInfoResponse.setTradeScene(res.getTradeScene()); |
|
|
|
issueWxSignInfoResponse.setPlateNumber(res.getPlateNumber()); |
|
|
|
issueWxSignInfoResponse.setSubOpenid(res.getSubOpenId()); |
|
|
|
issueWxSignInfoResponse.setChannelType(res.getChannelType()); |
|
|
|
return issueWxSignInfoResponse; |
|
|
|
} |
|
|
|
} |