Преглед на файлове

1.国任增加特别约定
2.华泰修改生产配置信息

wks преди 2 години
родител
ревизия
de72feae5d

+ 4 - 1
src/main/java/com/ydtech/modules/order/components/ConfigureParametersComponents.java

@@ -6,6 +6,7 @@ import com.ydtech.modules.order.entity.config.ConfigureParameters;
 import com.ydtech.modules.protocol.entity.dto.PtlAttributionTemplateDto;
 import com.ydtech.modules.protocol.entity.po.PtlAgreementAttribution;
 import com.ydtech.modules.protocol.service.PtlAgreementAttributionService;
+import com.ydtech.modules.protocol.utils.AssertionUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Component;
 import org.springframework.util.ReflectionUtils;
@@ -36,7 +37,8 @@ public class ConfigureParametersComponents {
     private <T extends ConfigureParameters> void conversionEntity(T t, PtlAgreementAttribution ptlAgreementAttribution) {
         JSONArray fields = ptlAgreementAttribution.getFields();
         List<PtlAttributionTemplateDto> ptlAttributionTemplateDtos = fields.toJavaList(PtlAttributionTemplateDto.class);
-        Map<String, String> collect = ptlAttributionTemplateDtos.stream().collect(LinkedHashMap::new, (m, v) -> m.put(v.getField(), v.getValue()), LinkedHashMap::putAll);
+        Map<String, String> collect = ptlAttributionTemplateDtos.stream().collect(LinkedHashMap::new, (m, v) -> m.put(v.getField(),
+                v.getValue()), LinkedHashMap::putAll);
         Field[] fieldsList = t.getClass().getDeclaredFields();
 
         for (Field field : fieldsList) {
@@ -59,6 +61,7 @@ public class ConfigureParametersComponents {
      */
     public <T extends ConfigureParameters> void toEntity(T t, String agreementId) {
         PtlAgreementAttribution ptlAgreementAttribution = ptlAgreementAttributionService.getById(agreementId);
+        AssertionUtils.isEmpty(ptlAgreementAttribution, "此协议未查询到配置信息");
         this.conversionEntity(t, ptlAgreementAttribution);
     }
 

+ 9 - 1
src/main/java/com/ydtech/modules/order/constants/OrderCacheConstant.java

@@ -52,7 +52,6 @@ public class OrderCacheConstant {
      */
     public static final long YC_ACCIDENTAL_DRIVING_TIME = 1L;
 
-
     /**
      * 永城协议存储key
      */
@@ -63,6 +62,15 @@ public class OrderCacheConstant {
      */
     public static final String YC_AGREEMENT_INFO_KEY = "yc:agreement:info:";
 
+    /**
+     * 国任特别约定 key
+     */
+    public static final String GR_SPECIAL_AGREEMENT_KEY = "gr:specialAgreement:";
+
+    /**
+     * 国任特别约定 存储时间
+     */
+    public static final long GR_SPECIAL_AGREEMENT_TIME = 1L;
 
     /**
      * 紫金财险 为接入方提供获取token

+ 1 - 1
src/main/java/com/ydtech/modules/order/service/impl/DaJiaOrderServiceImpl.java

@@ -205,7 +205,7 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
             ODR1009Request odr1009Request = new ODR1009Request(orderNo, kindList, riskList,quoteInfoVo,odr1016Response,accidentalDriving,listByAccId,daJiaConfigureParameters,isEnergy);
             ODR1009Response odr1009Response = daJiaRequestApiComponents.newPremiumXnyCalculation(odr1009Request);
             NVHLODR1001Response nvhlodr1001Response = null;
-            if(!Objects.isNull(accidentalDrivingVo) && accidentalDrivingVo.size() > 0){
+            if(!Objects.isNull(accidentalDrivingVo) && !accidentalDrivingVo.isEmpty()){
                 //6.驾意险报价
                 NVHLODR1001Request nvhlodr1001Request = new NVHLODR1001Request(daJiaConfigureParameters,odr1009Response,
                         quoteInfoVo,accidentalDriving,accidentalDrivingVo.getString("quantity"),policyHolderPersonArea,insuredPersonArea);

+ 23 - 0
src/main/java/com/ydtech/modules/order/service/impl/GuorenOrderApiServiceImpl.java

@@ -52,6 +52,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.ObjectUtils;
@@ -62,8 +63,12 @@ import java.io.FileNotFoundException;
 import java.math.BigDecimal;
 import java.time.LocalDateTime;
 import java.util.*;
+import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 
+import static com.ydtech.modules.order.constants.OrderCacheConstant.GR_SPECIAL_AGREEMENT_KEY;
+import static com.ydtech.modules.order.constants.OrderCacheConstant.GR_SPECIAL_AGREEMENT_TIME;
+
 
 @Service
 @RequiredArgsConstructor
@@ -96,6 +101,7 @@ public class GuorenOrderApiServiceImpl implements GuorenOrderApiService {
 
     private final GuorenRequestApiComponent guorenRequestApiComponent;
 
+    private final StringRedisTemplate redisTemplate;
 
     /**
      * 获取渠道信息
@@ -124,6 +130,15 @@ public class GuorenOrderApiServiceImpl implements GuorenOrderApiService {
     @Override
     public HttpResult<List<GuoRenSpecialAgreement>> queryClauseData(String agreementId) {
         // 获取协议配置信息
+        String specialAgreementKey = GR_SPECIAL_AGREEMENT_KEY + agreementId;
+
+        // 从缓存中获取数据
+        String info = redisTemplate.opsForValue().get(specialAgreementKey);
+        if (!StringUtils.isEmpty(info)) {
+            List<GuoRenSpecialAgreement> list = JSON.parseArray(info, GuoRenSpecialAgreement.class);
+            return HttpResult.ok(list);
+        }
+
         ChannelInfoDto channelInfo = gainChannelConfigInfo(agreementId);
         List<GuoRenSpecialAgreement> list = new ArrayList<>();
         for (InsuranceRisk insuranceRisk : InsuranceRisk.getInsuranceRisk()) {
@@ -131,12 +146,20 @@ public class GuorenOrderApiServiceImpl implements GuorenOrderApiService {
             SpecialAgreementRequest specialAgreementRequest = new SpecialAgreementRequest(channelInfo.getComCode(), riskCode);
             SpecialAgreementResponse response = guorenRequestApiComponent.request(specialAgreementRequest,
                     PlatformInterfaceCode.API_IIRBT00005, SpecialAgreementResponse.class);
+
+            AssertionUtils.isSucceed("1".equals(response.getResultCode().toString()), response.getResultMsg());
+
             List<GuoRenSpecialAgreement> collect = response.getData().stream()
                     .map(x -> new GuoRenSpecialAgreement(x, insuranceRisk))
                     .collect(Collectors.toList());
             list.addAll(collect);
         }
 
+        // 数据存入缓存
+        if (!list.isEmpty()) {
+            redisTemplate.opsForValue().set(specialAgreementKey, JSON.toJSONString(list), GR_SPECIAL_AGREEMENT_TIME, TimeUnit.DAYS);
+        }
+
         return HttpResult.ok(list);
     }
 

+ 4 - 10
src/main/java/com/ydtech/modules/order/service/impl/InsCrawlerOrderServiceImpl.java

@@ -32,6 +32,7 @@ import com.ydtech.modules.protocol.utils.AssertionUtils;
 import com.ydtech.utils.CalculateUtils;
 import com.ydtech.utils.StringUtils;
 import com.ydtech.utils.baidu.FileUtil;
+import lombok.RequiredArgsConstructor;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
@@ -45,6 +46,7 @@ import java.util.stream.Collectors;
 
 
 @Service
+@RequiredArgsConstructor
 public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
 
     private final PtlCrawlerApiService ptlCrawlerApiService;
@@ -56,7 +58,9 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
     private final InsAreaCompanyService insAreaCompanyService;
 
     private final InsTaskImagesService insTaskImagesService;
+
     private final InsOrdersService insOrdersService;
+
     private final FeeRuleSchemeService feeRuleSchemeService;
 
     private final PtlAgreementService ptlAgreementService;
@@ -70,16 +74,6 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
     @Value("${api.url}")
     private String apiUrl;
 
-    public InsCrawlerOrderServiceImpl(PtlCrawlerApiService ptlCrawlerApiService, InsCrawlerOrderComponents insCrawlerOrderComponents, PtlAgreementAttributionService ptlAgreementAttributionService, InsAreaCompanyService insAreaCompanyService, InsTaskImagesService insTaskImagesService, InsOrdersService insOrdersService, PtlAgreementService ptlAgreementService, FeeRuleSchemeService feeRuleSchemeService) {
-        this.ptlCrawlerApiService = ptlCrawlerApiService;
-        this.insCrawlerOrderComponents = insCrawlerOrderComponents;
-        this.ptlAgreementAttributionService = ptlAgreementAttributionService;
-        this.insAreaCompanyService = insAreaCompanyService;
-        this.insTaskImagesService = insTaskImagesService;
-        this.insOrdersService = insOrdersService;
-        this.feeRuleSchemeService = feeRuleSchemeService;
-        this.ptlAgreementService = ptlAgreementService;
-    }
 
     @Override
     public void isLogin(PtlAgreementAttributionDto attribution, String companyId, String insCompanyName) {

+ 1 - 1
src/main/resources/application-prod.yml

@@ -240,7 +240,7 @@ huatai:
     baseUrl: https://gears.pc.ehuatai.com:9040/interFaces/common/AutoInsuranceQuotation.do
     selfPublicKey: MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCYUuKVmeF5N66v6MQmOR8pt4o33yrio/ZrDf2ehk/kHJ2BYdI+xE9dLrZW5dm0y8yPpIHN39JaLuYOlWz5DVsWJTSPj9eaq0hOiY9BGAHJ3yMHdX3wygpcD11BVc5v4wbX/kyAhmatK69sb4zzAtEve1NS/YwZVuGch0CrkGw3YQIDAQAB
     selfPrivateKey: MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBAJhS4pWZ4Xk3rq/oxCY5Hym3ijffKuKj9msN/Z6GT+QcnYFh0j7ET10utlbl2bTLzI+kgc3f0lou5g6VbPkNWxYlNI+P15qrSE6Jj0EYAcnfIwd1ffDKClwPXUFVzm/jBtf+TICGZq0rr2xvjPMC0S97U1L9jBlW4ZyHQKuQbDdhAgMBAAECgYAktOyXYoK8RFfbWjtSfrdsxScQub3K6foq6C8y8Wj1LpQiJqGUsJfze5tDK5agA/CiuODy7LnzM5QK9aVSCw7k0r8EeGpHcYRdLYZM0vXVFK2gIQctFemK4c6sg5p0Bn1LNRbJG7rgMMEA/OxcF6vyQahhFtPVtAQwc+dT0PV51QJBANd66rfTuxSRvIC/RE4W6iqzed2YZtx+0kd7KiN78Y4X6spposFCH4ALf4jUeRRXZAm+Qu71cq21m2GsQZ8bZdMCQQC096ilZXEjmEuvopQR3JvPbgAF+MtItusyDDsMR1CWwXq9XGMmxi6GhFY7r7C8b40j1IchVAEY5BcwxJwfjql7AkAp5QYZs5reBu/FgGqBXEcvAjIheW4WVLoBl9q7h2+RlujZbexs8rQ5KwMi0VyxLcSPeGR/HU2spHCPbvRbQPJtAkBANK4tIHSnwFz6D6ChRbg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