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;
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.PageInfo;
import com.glsx.common.constants.ResultObject;
......@@ -37,13 +43,6 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.request.RequestContextHolder;
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
*
......@@ -392,36 +391,27 @@ public class InsuranceServiceImpl extends BaseOrderService implements InsuranceS
super.logInfo("投保时间在7天内,调用TSP接口退保");
InsuranceResp insuranceResp = new InsuranceResp();
TspRefundReq tspRefundReq = new TspRefundReq();
tspRefundReq.setInsuranceCompany(insurancePolicy.getInsuranceCompany());
tspRefundReq.setFullInsuranceNo(insurancePolicy.getInsuranceNo());
tspRefundReq.setSeqNo(insurancePolicy.getInsuranceSeqNo());
this.taskExecutor.defaultThreadPool().execute(() -> {
int retries = API_INVOKE_RETRIES;
while (retries-- > 0) {
try {
TspResp tspResp = this.tspApiInvoker
.with(this.appKey, this.secret)
.refund(tspRefundReq);
super.logInfo("TSP接口调用结果", tspResp);
// 判断是否调用成功
boolean invokeSuccess = TspResultCode.SUCCESS.getCode().equals(
tspResp.getCode());
if (invokeSuccess) {
// 成功,更新字段状态
this.refundManually(insurancePolicy);
break;
} else {
super.logInfo("TSP退保接口返回失败,等待重试");
Thread.sleep(API_INVOKE_RETRY_DELAY);
}
} catch (Exception e) {
super.logError("TSP接口调用异常", e);
try {
TspResp tspResp = this.tspApiInvoker
.with(this.appKey, this.secret)
.refund(tspRefundReq);
super.logInfo("TSP接口调用结果", tspResp);
// 判断是否调用成功
boolean invokeSuccess = TspResultCode.SUCCESS.getCode().equals(tspResp.getCode());
if (invokeSuccess) {
// 成功,更新字段状态
this.refundManually(insurancePolicy);
} else {
super.logInfo("TSP退保接口返回失败,等待重试");
}
} 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!