Selaa lähdekoodia

诚泰加入验证码登录
永安添加商业折扣

785834757 1 vuosi sitten
vanhempi
commit
2284314e23

+ 3 - 0
src/main/java/com/ydtech/modules/ins/model/vo/QuoteRespVo.java

@@ -238,6 +238,9 @@ public class QuoteRespVo {
     @ApiModelProperty("永安商业费用浮动")
     private String bifeeFloat;
 
+    @ApiModelProperty("永安商业折扣")
+    private String yaBusinessDiscount;
+
     @ApiModelProperty("人保商业折扣")
     private String preDiscount;
 

+ 1 - 1
src/main/java/com/ydtech/modules/order/controller/InsCrawlerOrderController.java

@@ -187,7 +187,7 @@ public class InsCrawlerOrderController extends BaseController {
     @ApiOperation(value = "统一发送登录验证码")
     public HttpResult sendLoginSmsCode(@RequestBody PtlAgreementAttributionDto agreementAttributionDto) {
         JSONObject response = insuranceCrawlerOrderService.sendLoginSmsCode(agreementAttributionDto);
-        if (response.getInteger("code") == 200){
+        if (response.getInteger("code") == 400){
             return HttpResult.ok(response.getString("message"),response.getString("secretKey"));
         }else{
             return HttpResult.error("验证码发送失败");

+ 5 - 0
src/main/java/com/ydtech/modules/order/entity/crawler/request/CrawlerQuoteRequest.java

@@ -76,6 +76,11 @@ public class CrawlerQuoteRequest extends BaseQuoteInfoVo {
      */
     private String carChecker;
 
+    /**
+     * 永安商业折扣
+     */
+    private String yaBusinessDiscount;
+
     /**
      * 人保赔付优化申请
      */

+ 53 - 0
src/main/java/com/ydtech/modules/order/entity/crawler/request/CtCrawlerLoginRequest.java

@@ -0,0 +1,53 @@
+package com.ydtech.modules.order.entity.crawler.request;
+
+import cn.hutool.core.collection.CollUtil;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.ydtech.modules.protocol.entity.dto.PtlAgreementAttributionDto;
+import com.ydtech.utils.StringUtils;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+import java.util.LinkedHashMap;
+
+@Data
+@NoArgsConstructor
+public class CtCrawlerLoginRequest implements Serializable {
+
+    private static final long serialVersionUID = 01404102263425770704305L;
+
+    /**
+     * 账号
+     */
+    @JsonProperty(value = "username")
+    private String username;
+
+    /**
+     * 密码
+     */
+    @JsonProperty(value = "pwd")
+    private String pwd;
+
+    /**
+     * 归属信息
+     */
+    @JsonProperty(value = "other")
+    private LinkedHashMap<String, String> other;
+
+    @JsonProperty(value = "check")
+    private String check;
+
+    public CtCrawlerLoginRequest(PtlAgreementAttributionDto attribution) {
+        this.username = attribution.getUsername();
+        this.pwd = attribution.getPassword();
+
+    }
+
+    public CtCrawlerLoginRequest(PtlAgreementAttributionDto attribution, String sendcode, CtCrawlerLoginRequest request) {
+        this.username = attribution.getUsername();
+        this.pwd = attribution.getPassword();
+        if(CollUtil.isNotEmpty(attribution.getFields())){
+            this.other = attribution.getFields().stream().collect(LinkedHashMap::new, (m, v) -> m.put(v.getField(), v.getValue()), LinkedHashMap::putAll);
+        }
+    }
+}

+ 27 - 0
src/main/java/com/ydtech/modules/order/entity/crawler/response/CtCrawlerBaseResponse.java

@@ -0,0 +1,27 @@
+package com.ydtech.modules.order.entity.crawler.response;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class CtCrawlerBaseResponse implements Serializable {
+
+    private static final long serialVersionUID = 0436050477325473777054L;
+
+    /**
+     * 状态码
+     */
+    @JsonProperty("code")
+    private Integer code;
+    /**
+     * 返回信息
+     */
+    @JsonProperty("message")
+    private String message;
+
+    @JsonProperty("data")
+    private Object data;
+
+}

+ 42 - 2
src/main/java/com/ydtech/modules/order/service/impl/InsCrawlerOrderServiceImpl.java

@@ -155,6 +155,8 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
         crawlerQuoteRequest.setDiscount(t.getDiscount());
         // 是否需要验车
         crawlerQuoteRequest.setIsInspect(t.getIsInspect());
+        // 永安商业折扣
+        crawlerQuoteRequest.setYaBusinessDiscount(t.getDiscount());
         // 上次订单
         if (StringUtils.isNotEmpty(t.getLastCompanyId())) {
             InsAreaCompany insAreaCompany = insAreaCompanyService.getById(t.getLastCompanyId());
@@ -578,6 +580,8 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
         quoteRespVo.setCifeeFloat(other.getCifeeFloat());
         // 商业费用浮动
         quoteRespVo.setBifeeFloat(other.getBifeeFloat());
+        // 永安商业折扣
+        quoteRespVo.setYaBusinessDiscount(other.getSyDiscount());
 
         quoteRespVo.setTotalAdjustRate(StringUtils.toDouble(other.getDiscount()));
         quoteRespVo.setJqAdjustRate(other.getJqDiscount());
@@ -1041,7 +1045,7 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
     public JSONObject sendLoginSmsCode(PtlAgreementAttributionDto agreementAttributionDto) {
 //        InsAreaCompany insAreaCompany = insAreaCompanyService.getById(companyId);
         PtlAgreementAttribution attribution = ptlAgreementAttributionService.getOne(new LambdaQueryWrapper<PtlAgreementAttribution>()
-                .eq(PtlAgreementAttribution::getTemplateId,agreementAttributionDto.getTemplateId()));
+                .eq(PtlAgreementAttribution::getId,agreementAttributionDto.getId()));
 
         PtlAgreementAttributionDto attributionDto = new PtlAgreementAttributionDto();
         BeanUtils.copyProperties(attribution, attributionDto);
@@ -1064,6 +1068,7 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
         // 泰山发送验证码
         if (attribution.getInsCompanyId().equals("TSBX1000000")){
             TsCrawlerLoginRequest crawlerLoginRequest = new TsCrawlerLoginRequest(attributionDto);
+
             TsCrawlerBaseResponse tsResponse = insCrawlerOrderComponents.request(apiUrl, InsuranceEnum.TSBX.getCode(), "获取验证码",
                     crawlerLoginRequest, TsCrawlerBaseResponse.class);
             if (!tsResponse.getCode().equals(200)) {
@@ -1073,7 +1078,22 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
             redisTemplate.opsForValue().set(InsuranceEnum.TSBX.getCode()+OrderCacheConstant.BS_ACCESS_TOKEN + attributionDto.getUsername(), JSON.toJSONString(tsResponse.getData()), OrderCacheConstant.TS_ACCESS_TOKEN_TIME,
                     TimeUnit.SECONDS);
         }
-//        if (attribution.getInsCompanyId().equals(""))
+        // 诚泰发送验证码
+        if (attribution.getInsCompanyId().equals("CHAC1000000")){
+            CtCrawlerLoginRequest crawlerLoginRequest = new CtCrawlerLoginRequest(attributionDto);
+            LinkedHashMap<String,String> other = new LinkedHashMap<>();
+            other.put("phone",agreementAttributionDto.getPhone());
+            crawlerLoginRequest.setOther(other);
+            crawlerLoginRequest.setCheck("zs");
+            response = insCrawlerOrderComponents.request(apiUrl, InsuranceEnum.CHAC.getCode(), "获取验证码",
+                    crawlerLoginRequest, JSONObject.class);
+            if (!response.getInteger("code").equals(400)) {
+                throw new SystemException(response.getString("message"));
+            }
+            // 将返回参数放入redis
+            redisTemplate.opsForValue().set(InsuranceEnum.CHAC.getCode()+OrderCacheConstant.BS_ACCESS_TOKEN + attributionDto.getUsername(), JSON.toJSONString(response.getString("data")), OrderCacheConstant.TS_ACCESS_TOKEN_TIME,
+                    TimeUnit.SECONDS);
+        }
         return response;
     }
 
@@ -1123,6 +1143,26 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
                 throw new SystemException("验证码已失效!请重新发送!");
             }
         }
+        else if(companyCode.equals(InsuranceEnum.CHAC.getCode())){
+            CtCrawlerLoginRequest ctCrawlerLoginRequest = new CtCrawlerLoginRequest();
+            ctCrawlerLoginRequest.setUsername(agreement.getAttribution().getUsername());
+            ctCrawlerLoginRequest.setPwd(agreement.getAttribution().getPassword());
+            ctCrawlerLoginRequest.setOther(new LinkedHashMap<>());
+            ctCrawlerLoginRequest.getOther().put("phone",agreement.getAttribution().getPhone());
+            ctCrawlerLoginRequest.getOther().put("mescoed",agreement.getAgreement().getSmsCode());
+            ctCrawlerLoginRequest.setCheck("zs");
+            // 组装 Other 信息
+            Map<String,String> otherMap = new HashMap<>();
+            agreement.getAttribution().getFields().forEach(item->{
+                otherMap.put(item.getField(),item.getValue());
+            });
+            JSONObject response = insCrawlerOrderComponents.request(apiUrl, agreement.getAgreement().getPartnerCompaniesId(), "登录",
+                    ctCrawlerLoginRequest, JSONObject.class);
+            if (response.getInteger("code") != 200) {
+                throw new SystemException("登录失败:" + response.getString("token"));
+            }
+
+        }
         else{
             // 正常登录流程
         }

+ 5 - 0
src/main/java/com/ydtech/modules/protocol/entity/dto/PtlAgreementAttributionDto.java

@@ -18,6 +18,8 @@ public class PtlAgreementAttributionDto implements Serializable {
 
     private static final long serialVersionUID = 5438498729372152816L;
 
+    private String id;
+
     /**
      * 模板id
      */
@@ -48,6 +50,9 @@ public class PtlAgreementAttributionDto implements Serializable {
     @ApiModelProperty("保险公司密码")
     private String password;
 
+    @ApiModelProperty("手机号 用于验证码登录")
+    private String phone;
+
     @ApiModelProperty("环境?")
     private String check;
 }