فهرست منبع

1.修改python发送验证码登录
2.紫金新能源险种问题
3.财务新增操作人方案

785834757 1 سال پیش
والد
کامیت
ff43486918

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

@@ -117,7 +117,7 @@ public class OrderCacheConstant {
     /**
      * 泰山财险 验证码token
      */
-    public static final String TS_ACCESS_TOKEN = "ts:access:token:";
+    public static final String BS_ACCESS_TOKEN = ":access:token:";
 
     /**
      * 泰山财险 验证码token

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

@@ -183,6 +183,28 @@ public class InsCrawlerOrderController extends BaseController {
         }
     }
 
+    @PostMapping(value = "/sendLoginSmsCode")
+    @ApiOperation(value = "统一发送登录验证码")
+    public HttpResult sendLoginSmsCode(@RequestBody PtlAgreementAttributionDto agreementAttributionDto) {
+        JSONObject response = insuranceCrawlerOrderService.sendLoginSmsCode(agreementAttributionDto);
+        if (response.getInteger("code") == 200){
+            return HttpResult.ok(response.getString("message"),response.getString("secretKey"));
+        }else{
+            return HttpResult.error("验证码发送失败");
+        }
+    }
+
+    @PostMapping(value = "/verifyLoginSmsCode")
+    @ApiOperation(value = "统一校验登录验证码")
+    public HttpResult verifyLoginSmsCode(@RequestBody PtlAgreementSaveVo agreement) {
+        boolean result = insuranceCrawlerOrderService.verifyLoginSmsCode(agreement);
+        if (result){
+            return HttpResult.ok("登录成功");
+        }else{
+            return HttpResult.error("登录失败");
+        }
+    }
+
     @GetMapping(value = "getYaCarDamageVerificationDict")
     @ApiOperation(value = "永安车损验证字典获取")
     public HttpResult getYaCarDamageVerificationDict() {

+ 5 - 1
src/main/java/com/ydtech/modules/order/entity/api/zijin/constants/enums/MotorVehicleInsuranceEnum.java

@@ -41,7 +41,11 @@ public enum MotorVehicleInsuranceEnum {
     MVI_A3("A3", "新能源汽车损失保险", " 商业险主险, 保额同车辆实际价值"),
     MVI_B3("B3", "新能源汽车第三者责任保险", "商业险主险,10万、15万、20万、30万、50万、100万,超过100万的校验“保额/限额”必须为50万的整数倍"),
     MVI_D5("D5", "新能源汽车车上人员责任保险(司机)", " 商业险主险"),
-    MVI_D6("D6", "新能源汽车车上人员责任保险(乘客)", " 商业险主险");
+    MVI_D6("D6", "新能源汽车车上人员责任保险(乘客)", " 商业险主险"),
+    MVI_T5("T5", "新能源道路救援服务特约条款", "必须大于0, 且在(2、7、12、17、22)之内"),
+    MVI_T6("T6", "新能源车辆安全检测特约条款", "必须大于0"),
+    MVI_T7("T7", "新能源代为驾驶服务特约条款", "必须大于0"),
+    MVI_T8("T8", "新能源代为送检服务特约条款", "必须大于0");
 
 
 

+ 30 - 0
src/main/java/com/ydtech/modules/order/entity/crawler/request/CrawlerBaseSendSmsCodeRequest.java

@@ -0,0 +1,30 @@
+package com.ydtech.modules.order.entity.crawler.request;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.ydtech.modules.protocol.entity.dto.PtlAgreementAttributionDto;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+
+@Data
+@NoArgsConstructor
+public class CrawlerBaseSendSmsCodeRequest implements Serializable {
+
+    private static final long serialVersionUID = 01404102263425770704306L;
+
+    /**
+     * 账号
+     */
+    @JsonProperty(value = "username")
+    private String username;
+
+    @JsonProperty(value = "pwd")
+    private String password;
+
+
+    public CrawlerBaseSendSmsCodeRequest(String username,String password){
+        this.username = username;
+        this.password = password;
+    }
+}

+ 26 - 0
src/main/java/com/ydtech/modules/order/entity/crawler/request/GuoRenCrawlerSendSmsCodeRequest.java

@@ -0,0 +1,26 @@
+package com.ydtech.modules.order.entity.crawler.request;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+@Data
+@NoArgsConstructor
+public class GuoRenCrawlerSendSmsCodeRequest extends CrawlerBaseSendSmsCodeRequest {
+
+    private static final long serialVersionUID = 01404102263425770704306L;
+
+    @JsonProperty(value = "other")
+    private List<String> other;
+
+
+    public GuoRenCrawlerSendSmsCodeRequest(String username, String password){
+        this.setUsername(username);
+        this.setPassword(password);
+        this.setOther(new ArrayList<>());
+    }
+}

+ 4 - 0
src/main/java/com/ydtech/modules/order/entity/dto/TaskPoolDataExcelDto.java

@@ -36,6 +36,9 @@ public class TaskPoolDataExcelDto {
     @ExcelProperty("录入来源")
     private String entryStatus;
 
+    @ExcelProperty("操作人")
+    private String operatorName;
+
     @ExcelProperty("保险公司")
     private String insCompany;
 
@@ -98,6 +101,7 @@ public class TaskPoolDataExcelDto {
         this.taxAmount = insOrder.getTaxamount();
         this.jyPremium = insOrder.getJypremium();
         this.insuredName = insOrder.getInsuredname();
+        this.operatorName = insOrder.getOperatorName();
         /**
         try {
             UnderwritingStatus status = UnderwritingStatus.valueOf("US_" + insOrder.getUnderwritingStatus());

+ 11 - 0
src/main/java/com/ydtech/modules/order/service/InsCrawlerOrderService.java

@@ -1,5 +1,6 @@
 package com.ydtech.modules.order.service;
 
+import com.alibaba.fastjson.JSONObject;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.modules.order.entity.InsAreaCompany;
 import com.ydtech.modules.order.entity.InsOrders;
@@ -135,4 +136,14 @@ public interface InsCrawlerOrderService extends BaseOrderService<Object> {
      * @return
      */
     YaCrawlerVerifyCodeResponse yaVerifyCode(String companyId, String smsCode) throws Exception;
+
+
+    JSONObject sendLoginSmsCode(PtlAgreementAttributionDto agreementAttributionDto);
+
+    /**
+     * 校验登录验证码
+     * @param agreement
+     * @return
+     */
+    Boolean verifyLoginSmsCode(PtlAgreementSaveVo agreement);
 }

+ 99 - 8
src/main/java/com/ydtech/modules/order/service/impl/InsCrawlerOrderServiceImpl.java

@@ -59,15 +59,14 @@ import java.math.RoundingMode;
 import java.net.URL;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
+import java.util.*;
 import java.util.concurrent.TimeUnit;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 
+import static com.ydtech.modules.order.constants.OrderCacheConstant.BS_ACCESS_TOKEN;
+
 
 @Service
 @RequiredArgsConstructor
@@ -929,7 +928,7 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
         }
         // 将返回参数放入redis
         redisTemplate.opsForValue()
-                .set(OrderCacheConstant.TS_ACCESS_TOKEN + attributionDto.getUsername(), JSON.toJSONString(response.getData()), OrderCacheConstant.TS_ACCESS_TOKEN_TIME,
+                .set("TSBX"+OrderCacheConstant.BS_ACCESS_TOKEN + attributionDto.getUsername(), JSON.toJSONString(response.getData()), OrderCacheConstant.TS_ACCESS_TOKEN_TIME,
                         TimeUnit.SECONDS);
     }
 
@@ -943,7 +942,7 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
             throw new SystemException(response.getMessage());
         }
         // 将返回参数放入redis
-        redisTemplate.opsForValue().set(OrderCacheConstant.TS_ACCESS_TOKEN + attributionDto.getUsername(), JSON.toJSONString(response.getData()), OrderCacheConstant.TS_ACCESS_TOKEN_TIME,
+        redisTemplate.opsForValue().set("TSBX"+OrderCacheConstant.BS_ACCESS_TOKEN + attributionDto.getUsername(), JSON.toJSONString(response.getData()), OrderCacheConstant.TS_ACCESS_TOKEN_TIME,
                 TimeUnit.SECONDS);
     }
 
@@ -952,7 +951,7 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
         // 获取协议的用户名密码
 
         String apiUrl = ptlCrawlerApiService.getByTemplateId(agreement.getAttribution().getTemplateId(), PtlCrawlerApiType.API_1);
-        String token = redisTemplate.opsForValue().get(OrderCacheConstant.TS_ACCESS_TOKEN + agreement.getAttribution().getUsername());
+        String token = redisTemplate.opsForValue().get("TSBX"+OrderCacheConstant.BS_ACCESS_TOKEN + agreement.getAttribution().getUsername());
         if (StringUtils.isNotBlank(token)) {
             TsCrawlerLoginRequest request = JSON.parseObject(token).toJavaObject(TsCrawlerLoginRequest.class);
             TsCrawlerLoginRequest tsRequest = new TsCrawlerLoginRequest(agreement.getAttribution(), agreement.getAgreement().getSmsCode(), request);
@@ -978,7 +977,7 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
         attributionDto.setFields(attributionTemplateDtos);
         String apiUrl = ptlCrawlerApiService.getByTemplateId(attribution.getTemplateId(), PtlCrawlerApiType.API_1);
         String token = redisTemplate.opsForValue()
-                .get(OrderCacheConstant.TS_ACCESS_TOKEN + attributionDto.getUsername());
+                .get("TSBX"+OrderCacheConstant.BS_ACCESS_TOKEN + attributionDto.getUsername());
         if (StringUtils.isNotBlank(token)) {
             TsCrawlerLoginRequest request = JSON.parseObject(token).toJavaObject(TsCrawlerLoginRequest.class);
             TsCrawlerLoginRequest tsRequest = new TsCrawlerLoginRequest(attributionDto, smscode, request);
@@ -1031,6 +1030,98 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
         return response;
     }
 
+    @Override
+    public JSONObject sendLoginSmsCode(PtlAgreementAttributionDto agreementAttributionDto) {
+//        InsAreaCompany insAreaCompany = insAreaCompanyService.getById(companyId);
+        PtlAgreementAttribution attribution = ptlAgreementAttributionService.getOne(new LambdaQueryWrapper<PtlAgreementAttribution>()
+                .eq(PtlAgreementAttribution::getTemplateId,agreementAttributionDto.getTemplateId()));
+
+        PtlAgreementAttributionDto attributionDto = new PtlAgreementAttributionDto();
+        BeanUtils.copyProperties(attribution, attributionDto);
+
+        String apiUrl = ptlCrawlerApiService.getByTemplateId(attribution.getTemplateId(), PtlCrawlerApiType.API_11);
+        JSONObject response = new JSONObject();
+        // 国任发送验证码
+        if (attribution.getInsCompanyId().equals("XDCX1000000")) {
+            GuoRenCrawlerSendSmsCodeRequest crawlerSendSmsCodeRequest = new GuoRenCrawlerSendSmsCodeRequest(attribution.getUsername(),attribution.getPassword());
+            response = insCrawlerOrderComponents.request(apiUrl, InsuranceEnum.XDCX.getCode(), "校验验证码",
+                    crawlerSendSmsCodeRequest, JSONObject.class);
+            // 返回失败
+            if (response.getInteger("code") != 200){
+                throw new SystemException(response.getString("message"));
+            }
+            // 将返回参数放入redis
+            redisTemplate.opsForValue().set(InsuranceEnum.XDCX.getCode()+ BS_ACCESS_TOKEN + attribution.getUsername(), response.getString("secretKey"), OrderCacheConstant.TS_ACCESS_TOKEN_TIME,
+                    TimeUnit.SECONDS);
+        }
+        // 泰山发送验证码
+        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)) {
+                throw new SystemException(tsResponse.getMessage());
+            }
+            // 将返回参数放入redis
+            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(""))
+        return response;
+    }
+
+    @Override
+    public Boolean verifyLoginSmsCode(PtlAgreementSaveVo agreement) {
+        // 获取协议的用户名密码
+        String apiUrl = ptlCrawlerApiService.getByTemplateId(agreement.getAttribution().getTemplateId(), PtlCrawlerApiType.API_1);
+
+        String companyCode = agreement.getAgreement().getPartnerCompaniesId().substring(0,4);
+
+        // 泰山登录
+        if (companyCode.equals(InsuranceEnum.TSBX.getCode())){
+            String token = redisTemplate.opsForValue().get(InsuranceEnum.TSBX.getCode()+OrderCacheConstant.BS_ACCESS_TOKEN + agreement.getAttribution().getUsername());
+            if (StringUtils.isNotBlank(token)) {
+                TsCrawlerLoginRequest request = JSON.parseObject(token).toJavaObject(TsCrawlerLoginRequest.class);
+                TsCrawlerLoginRequest tsRequest = new TsCrawlerLoginRequest(agreement.getAttribution(), agreement.getAgreement().getSmsCode(), request);
+                TsCrawlerBaseResponse response = insCrawlerOrderComponents.request(apiUrl, agreement.getAgreement().getPartnerCompaniesId(), "登录",
+                        tsRequest, TsCrawlerBaseResponse.class);
+                if (!response.getCode().equals(200)) {
+                    throw new SystemException("泰山登录失败:" + response.getMessage());
+                }
+            } else {
+                throw new SystemException("验证码已失效!请重新发送!");
+            }
+        }
+        // 国任登录
+        else if (companyCode.equals(InsuranceEnum.XDCX.getCode())){
+            String secretKey = redisTemplate.opsForValue().get(InsuranceEnum.XDCX.getCode()+OrderCacheConstant.BS_ACCESS_TOKEN + agreement.getAttribution().getUsername());
+            if (StringUtils.isNotBlank(secretKey)) {
+                JSONObject grRequest = new JSONObject();
+                grRequest.put("username",agreement.getAttribution().getUsername());
+                grRequest.put("pwd",agreement.getAttribution().getPassword());
+                grRequest.put("smscode",agreement.getAgreement().getSmsCode());
+                grRequest.put("secretKey",secretKey);
+                // 组装 Other 信息
+                Map<String,String> otherMap = new HashMap<>();
+                agreement.getAttribution().getFields().forEach(item->{
+                    otherMap.put(item.getField(),item.getValue());
+                });
+                grRequest.put("other",otherMap);
+                JSONObject response = insCrawlerOrderComponents.request(apiUrl, agreement.getAgreement().getPartnerCompaniesId(), "登录",
+                        grRequest, JSONObject.class);
+                if (response.getInteger("code") != 200) {
+                    throw new SystemException("登录失败:" + response.getString("message"));
+                }
+            } else {
+                throw new SystemException("验证码已失效!请重新发送!");
+            }
+        }
+        else{
+            // 正常登录流程
+        }
+        return true;
+    }
+
 
     public BufferedImage ImageFromUrl(String urlAddr) {
         try {

+ 3 - 0
src/main/java/com/ydtech/modules/protocol/entity/vo/PtlAgreementSaveVo.java

@@ -15,6 +15,9 @@ import java.util.List;
 @ApiModel("协议信息上传")
 public class PtlAgreementSaveVo {
 
+    //协议id
+    private String id;
+
     @ApiModelProperty("协议id")
     private String agreementId;