|
@@ -75,6 +75,7 @@ import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
+import org.springframework.data.redis.core.RedisTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
@@ -83,9 +84,12 @@ import java.math.BigDecimal;
|
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
+import static com.ydtech.modules.order.constants.OrderCacheConstant.*;
|
|
|
|
|
+
|
|
|
|
|
|
|
|
@Service
|
|
@Service
|
|
|
public class YongchengOrderApiServiceImpl implements YongchengOrderApiService {
|
|
public class YongchengOrderApiServiceImpl implements YongchengOrderApiService {
|
|
@@ -101,6 +105,9 @@ public class YongchengOrderApiServiceImpl implements YongchengOrderApiService {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private InsOrdersComponents insOrdersComponents;
|
|
private InsOrdersComponents insOrdersComponents;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private RedisTemplate redisTemplate;
|
|
|
|
|
+
|
|
|
//请求信息列表
|
|
//请求信息列表
|
|
|
List<String> requestInfoList = new ArrayList<>();
|
|
List<String> requestInfoList = new ArrayList<>();
|
|
|
|
|
|
|
@@ -851,6 +858,98 @@ public class YongchengOrderApiServiceImpl implements YongchengOrderApiService {
|
|
|
return httpResult;
|
|
return httpResult;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 驾意外险 查询
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public HttpResult accidentQuery(AccidentalDrivingQueryVo accidentalDrivingVo){
|
|
|
|
|
+ //初始化redisKey
|
|
|
|
|
+ StringBuilder redisKey = new StringBuilder();
|
|
|
|
|
+ redisKey.append(YC_AGREEMENT_KEY);
|
|
|
|
|
+ redisKey.append(accidentalDrivingVo.getCompanyCode());
|
|
|
|
|
+ redisKey.append(accidentalDrivingVo.getSeatNum());
|
|
|
|
|
+
|
|
|
|
|
+ //查询redis
|
|
|
|
|
+ if(!Objects.isNull(redisTemplate.opsForValue().get(redisKey.toString()))){
|
|
|
|
|
+ String redisValue = String.valueOf(redisTemplate.opsForValue().get(redisKey.toString()));
|
|
|
|
|
+ if(StringUtils.isNotEmpty(redisValue)){
|
|
|
|
|
+ List<EsmInsAttachInsure> esmInsAttachInsureList = JSON.parseArray(redisValue,EsmInsAttachInsure.class);
|
|
|
|
|
+ return HttpResult.ok(esmInsAttachInsureList);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ //查询接口
|
|
|
|
|
+ List<EsmInsAttachInsure> insAttachInsureList = new ArrayList<>();
|
|
|
|
|
+ AccidentResponse ar = gainAccidentInsure(accidentalDrivingVo, null);
|
|
|
|
|
+ if(ar.getHead().getResponseCompleteMessageStatus().getMessageStatusCode().equals("E0000")){
|
|
|
|
|
+ List<ResponseYwCvrg.CvrgList> cList = ar.getResponseYwCvrg().getCvrgList();
|
|
|
|
|
+ cList.forEach(item->{
|
|
|
|
|
+ EsmInsAttachInsure ati = new EsmInsAttachInsure();
|
|
|
|
|
+ ati.setCode(item.getCInsuranceTypeCode());
|
|
|
|
|
+ ati.setName(item.getCInsuranceType());
|
|
|
|
|
+ ati.setSeating(accidentalDrivingVo.getSeatNum() + "");
|
|
|
|
|
+ ati.setCompanyId(accidentalDrivingVo.getCompanyCode());
|
|
|
|
|
+ ati.setType(AttachInsureEnum.AI001.getCode());
|
|
|
|
|
+ ati.setEnable(WhetherEnum.YES.getCode());
|
|
|
|
|
+ ati.setRestrictNum(StringUtils.toInt(item.getNPurchaseLimitsNum()));
|
|
|
|
|
+ insAttachInsureList.add(ati);
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //将insAttachInsureList存入redis
|
|
|
|
|
+ if(!insAttachInsureList.isEmpty()){
|
|
|
|
|
+ redisTemplate.opsForValue().set(redisKey.toString(),JSON.toJSONString(insAttachInsureList),YC_ACCIDENTAL_DRIVING_TIME, TimeUnit.DAYS);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return HttpResult.ok(insAttachInsureList);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 驾意外险详情 查询
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public HttpResult accidentSchemeList(AccidentalDrivingQueryVo accidentalDrivingVo){
|
|
|
|
|
+ //初始化redisKey
|
|
|
|
|
+ StringBuilder redisKey = new StringBuilder();
|
|
|
|
|
+ redisKey.append(YC_AGREEMENT_INFO_KEY);
|
|
|
|
|
+ redisKey.append(accidentalDrivingVo.getCompanyCode());
|
|
|
|
|
+ redisKey.append(accidentalDrivingVo.getSeatNum());
|
|
|
|
|
+ redisKey.append(accidentalDrivingVo.getCompanyCode());
|
|
|
|
|
+
|
|
|
|
|
+ //查询redis
|
|
|
|
|
+ if(!Objects.isNull(redisTemplate.opsForValue().get(redisKey.toString()))){
|
|
|
|
|
+ String redisValue = String.valueOf(redisTemplate.opsForValue().get(redisKey.toString()));
|
|
|
|
|
+ if(StringUtils.isNotEmpty(redisValue)){
|
|
|
|
|
+ List<EsmInsAttachInsureDetails> esmInsAttachInsureDetails = JSON.parseArray(redisValue,EsmInsAttachInsureDetails.class);
|
|
|
|
|
+ return HttpResult.ok(esmInsAttachInsureDetails);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //查询接口
|
|
|
|
|
+ AccidentResponse arCode = gainAccidentInsure(accidentalDrivingVo, accidentalDrivingVo.getCode());
|
|
|
|
|
+ List<EsmInsAttachInsureDetails> esmInsAttachInsureDetails = new ArrayList<>();
|
|
|
|
|
+ if (arCode.getHead().getResponseCompleteMessageStatus().getMessageStatusCode().equals("E0000")) {
|
|
|
|
|
+ List<ResponseYwCvrg.CvrgList> cListDetails = arCode.getResponseYwCvrg().getCvrgList();
|
|
|
|
|
+ cListDetails.stream().forEach(d -> {
|
|
|
|
|
+
|
|
|
|
|
+ EsmInsAttachInsureDetails atiDetails = new EsmInsAttachInsureDetails();
|
|
|
|
|
+ atiDetails.setName(d.getCInsuranceLiability());
|
|
|
|
|
+ atiDetails.setCarSum(d.getNInsuranceAmountCar());
|
|
|
|
|
+ atiDetails.setSeatSum(d.getNInsuranceAmountSeat());
|
|
|
|
|
+ atiDetails.setPremium(d.getNLiabilityPremium());
|
|
|
|
|
+ esmInsAttachInsureDetails.add(atiDetails);
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //将esmInsAttachInsureDetails存入redis
|
|
|
|
|
+ if(!esmInsAttachInsureDetails.isEmpty()){
|
|
|
|
|
+ redisTemplate.opsForValue().set(redisKey.toString(),JSON.toJSONString(esmInsAttachInsureDetails),YC_ACCIDENTAL_DRIVING_TIME, TimeUnit.DAYS);
|
|
|
|
|
+ }
|
|
|
|
|
+ return HttpResult.ok(esmInsAttachInsureDetails);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 驾意外险 同步
|
|
* 驾意外险 同步
|
|
@@ -1333,6 +1432,7 @@ public class YongchengOrderApiServiceImpl implements YongchengOrderApiService {
|
|
|
return ycConfigureParameters;
|
|
return ycConfigureParameters;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 获取车险保单
|
|
* 获取车险保单
|
|
|
*
|
|
*
|