Commit 968bdd82 by wubh

包活干V1.9.0-修改:去除TSP退保重试机制

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@27329 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent 3b022e7b
package com.glsx.ordercenter.service.impl; package com.glsx.ordercenter.service.impl;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Semaphore;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.glsx.common.constants.ResultObject; import com.glsx.common.constants.ResultObject;
...@@ -37,13 +43,6 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -37,13 +43,6 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes; import org.springframework.web.context.request.ServletRequestAttributes;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Semaphore;
/** /**
* <p>Description: 保险Service * <p>Description: 保险Service
* *
...@@ -392,36 +391,27 @@ public class InsuranceServiceImpl extends BaseOrderService implements InsuranceS ...@@ -392,36 +391,27 @@ public class InsuranceServiceImpl extends BaseOrderService implements InsuranceS
super.logInfo("投保时间在7天内,调用TSP接口退保"); super.logInfo("投保时间在7天内,调用TSP接口退保");
InsuranceResp insuranceResp = new InsuranceResp(); InsuranceResp insuranceResp = new InsuranceResp();
TspRefundReq tspRefundReq = new TspRefundReq(); TspRefundReq tspRefundReq = new TspRefundReq();
tspRefundReq.setInsuranceCompany(insurancePolicy.getInsuranceCompany()); tspRefundReq.setInsuranceCompany(insurancePolicy.getInsuranceCompany());
tspRefundReq.setFullInsuranceNo(insurancePolicy.getInsuranceNo()); tspRefundReq.setFullInsuranceNo(insurancePolicy.getInsuranceNo());
tspRefundReq.setSeqNo(insurancePolicy.getInsuranceSeqNo()); tspRefundReq.setSeqNo(insurancePolicy.getInsuranceSeqNo());
this.taskExecutor.defaultThreadPool().execute(() -> { this.taskExecutor.defaultThreadPool().execute(() -> {
int retries = API_INVOKE_RETRIES; try {
TspResp tspResp = this.tspApiInvoker
while (retries-- > 0) { .with(this.appKey, this.secret)
try { .refund(tspRefundReq);
TspResp tspResp = this.tspApiInvoker super.logInfo("TSP接口调用结果", tspResp);
.with(this.appKey, this.secret) // 判断是否调用成功
.refund(tspRefundReq); boolean invokeSuccess = TspResultCode.SUCCESS.getCode().equals(tspResp.getCode());
super.logInfo("TSP接口调用结果", tspResp);
// 判断是否调用成功 if (invokeSuccess) {
boolean invokeSuccess = TspResultCode.SUCCESS.getCode().equals( // 成功,更新字段状态
tspResp.getCode()); this.refundManually(insurancePolicy);
} else {
if (invokeSuccess) { super.logInfo("TSP退保接口返回失败,等待重试");
// 成功,更新字段状态
this.refundManually(insurancePolicy);
break;
} else {
super.logInfo("TSP退保接口返回失败,等待重试");
Thread.sleep(API_INVOKE_RETRY_DELAY);
}
} catch (Exception e) {
super.logError("TSP接口调用异常", e);
} }
} catch (RuntimeException e) {
super.logError("TSP接口调用异常", e);
} }
}); });
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!