|
|
@@ -6,6 +6,7 @@ import cn.hutool.core.map.MapUtil;
|
|
|
import cn.hutool.http.HttpUtil;
|
|
|
import cn.hutool.json.JSONObject;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
@@ -237,7 +238,6 @@ public class InsuranceServiceImpl implements InsuranceService {
|
|
|
/**
|
|
|
* 退保
|
|
|
*
|
|
|
- * @param orderId
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional
|
|
|
@@ -324,13 +324,72 @@ public class InsuranceServiceImpl implements InsuranceService {
|
|
|
if (!commonResult.isSuccess()) {
|
|
|
throw exception0(commonResult.getCode(), commonResult.getMsg());
|
|
|
}
|
|
|
+ //{"phase":"INSURE","externalOrderNo":"tys-20261001-YC-14",
|
|
|
+ // "paiedAmount":"10.00","total":"1","insuredCount":"1","insureProcessingCount":"0",
|
|
|
+ // "cancelledCount":"0","cancelProcessingCount":"0","refundedAmount":"0.0",
|
|
|
+ // "cipher":"26e2e422d370653274ee74ef3edc7f93","policies":[{"externalPolicyNumber":"2037220248460828673",
|
|
|
+ // "service":"applyTeam","status":"SUCCESS","msg":"投保成功","policyNo":"HW61927008L7JB7J8Q00"}]}
|
|
|
+ String checkedData = (String) commonResult.getCheckedData();
|
|
|
+ com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(checkedData);
|
|
|
+ BigDecimal paiedAmount = jsonObject.getBigDecimal("paiedAmount");
|
|
|
+ JSONArray policies = jsonObject.getJSONArray("policies");
|
|
|
+ if(policies == null) {
|
|
|
+ handleInsuranceQuery(paiedAmount, "", insuranceDO.getOrderId(), "FAIL");
|
|
|
+ }
|
|
|
+ com.alibaba.fastjson.JSONObject policy = policies.getJSONObject(0);
|
|
|
+ if(policy == null) {
|
|
|
+ handleInsuranceQuery(paiedAmount, "", insuranceDO.getOrderId(), "FAIL");
|
|
|
+ }
|
|
|
+ String status = policy.getString("status");
|
|
|
+ if("PROCESSING".equals(status)) {
|
|
|
+ log.error("保险查询结果,投保中,继续查询"+insuranceDO.getInsuranceNo());
|
|
|
+ } else if("FAIL".equals(status)) {
|
|
|
+ log.error("保险查询结果,投保失败,不再查询"+insuranceDO.getInsuranceNo());
|
|
|
+ } else if("SUCCESS".equals(status)) {
|
|
|
+ log.error("保险查询结果,投保成功,不再查询"+insuranceDO.getInsuranceNo());
|
|
|
+ Long externalPolicyNumber = policy.getLong("externalPolicyNumber");
|
|
|
+ String policyNo = policy.getString("policyNo");
|
|
|
+ handleInsuranceQuery(paiedAmount, policyNo, externalPolicyNumber, status);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
|
@Override
|
|
|
public void queryInsuranceQuey() {
|
|
|
List<InsuranceDO> list = insuranceMapper.selectList(new LambdaQueryWrapper<InsuranceDO>().eq(InsuranceDO::getInsuranceStatus, 0).ge(InsuranceDO::getCreateTime, DateUtil.yesterday()));
|
|
|
- list.forEach(insuranceDO -> insuranceUtil.queryInsurance(insuranceDO.getInsuranceNo()));
|
|
|
+ for (InsuranceDO insuranceDO : list) {
|
|
|
+ CommonResult commonResult = insuranceUtil.queryInsuranceNew(insuranceDO.getInsuranceNo(), insuranceDO.getOrderId());
|
|
|
+ if (!commonResult.isSuccess()) {
|
|
|
+ throw exception0(commonResult.getCode(), commonResult.getMsg());
|
|
|
+ }
|
|
|
+ //{"phase":"INSURE","externalOrderNo":"tys-20261001-YC-14",
|
|
|
+ // "paiedAmount":"10.00","total":"1","insuredCount":"1","insureProcessingCount":"0",
|
|
|
+ // "cancelledCount":"0","cancelProcessingCount":"0","refundedAmount":"0.0",
|
|
|
+ // "cipher":"26e2e422d370653274ee74ef3edc7f93","policies":[{"externalPolicyNumber":"2037220248460828673",
|
|
|
+ // "service":"applyTeam","status":"SUCCESS","msg":"投保成功","policyNo":"HW61927008L7JB7J8Q00"}]}
|
|
|
+ String checkedData = (String) commonResult.getCheckedData();
|
|
|
+ com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(checkedData);
|
|
|
+ BigDecimal paiedAmount = jsonObject.getBigDecimal("paiedAmount");
|
|
|
+ JSONArray policies = jsonObject.getJSONArray("policies");
|
|
|
+ if(policies == null) {
|
|
|
+ handleInsuranceQuery(paiedAmount, "", insuranceDO.getOrderId(), "FAIL");
|
|
|
+ }
|
|
|
+ com.alibaba.fastjson.JSONObject policy = policies.getJSONObject(0);
|
|
|
+ if(policy == null) {
|
|
|
+ handleInsuranceQuery(paiedAmount, "", insuranceDO.getOrderId(), "FAIL");
|
|
|
+ }
|
|
|
+ String status = policy.getString("status");
|
|
|
+ if("PROCESSING".equals(status)) {
|
|
|
+ log.error("保险查询结果,投保中,继续查询"+insuranceDO.getInsuranceNo());
|
|
|
+ } else if("FAIL".equals(status)) {
|
|
|
+ log.error("保险查询结果,投保失败,不再查询"+insuranceDO.getInsuranceNo());
|
|
|
+ } else if("SUCCESS".equals(status)) {
|
|
|
+ log.error("保险查询结果,投保成功,不再查询"+insuranceDO.getInsuranceNo());
|
|
|
+ Long externalPolicyNumber = policy.getLong("externalPolicyNumber");
|
|
|
+ String policyNo = policy.getString("policyNo");
|
|
|
+ handleInsuranceQuery(paiedAmount, policyNo, externalPolicyNumber, status);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|