Explorar o código

泰山修改新增协议增加登录功能

dongxin hai 1 ano
pai
achega
4496e14ec3

+ 1 - 0
src/main/java/com/ydtech/modules/fnc/service/impl/InsFeeAuditServiceImpl.java

@@ -439,6 +439,7 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
             // 审核完成之后 清空锁
             // 审核完成之后 清空锁
             redisTemplate.delete("FEE_AUDIT:"+insOrderNo);
             redisTemplate.delete("FEE_AUDIT:"+insOrderNo);
         } catch (Exception e) {
         } catch (Exception e) {
+            e.printStackTrace();
             throw new SystemException("当前业务繁忙,请稍后重试");
             throw new SystemException("当前业务繁忙,请稍后重试");
         } finally {
         } finally {
             //释放锁
             //释放锁

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

@@ -14,6 +14,8 @@ import com.ydtech.modules.order.entity.vo.BaseQuoteVo;
 import com.ydtech.modules.order.entity.vo.QuoteAccidentalDrivingVo;
 import com.ydtech.modules.order.entity.vo.QuoteAccidentalDrivingVo;
 import com.ydtech.modules.order.service.InsCrawlerOrderService;
 import com.ydtech.modules.order.service.InsCrawlerOrderService;
 import com.ydtech.modules.order.service.InsOrdersService;
 import com.ydtech.modules.order.service.InsOrdersService;
+import com.ydtech.modules.protocol.entity.dto.PtlAgreementAttributionDto;
+import com.ydtech.modules.protocol.entity.vo.PtlAgreementSaveVo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
 import lombok.RequiredArgsConstructor;
@@ -94,6 +96,18 @@ public class InsCrawlerOrderController extends BaseController {
         return HttpResult.ok("发送成功!");
         return HttpResult.ok("发送成功!");
     }
     }
 
 
+    /**
+     * 泰山发送验证码
+     * @param attributionDto
+     * @return
+     */
+    @PostMapping(value = "/sendTscode")
+    @ApiOperation(value = "泰山发送验证码")
+    public HttpResult sendTscode(@RequestBody PtlAgreementAttributionDto attributionDto) {
+        insuranceCrawlerOrderService.sendcode(attributionDto);
+        return HttpResult.ok("发送成功!");
+    }
+
     /**
     /**
      * 泰山登录
      * 泰山登录
      * @param agreementId
      * @param agreementId
@@ -107,6 +121,18 @@ public class InsCrawlerOrderController extends BaseController {
         return HttpResult.ok("登录成功!");
         return HttpResult.ok("登录成功!");
     }
     }
 
 
+    /**
+     * 泰山登录
+     * @param agreement
+     * @return
+     */
+    @PostMapping(value = "/loginTs")
+    @ApiOperation(value = "泰山登录")
+    public HttpResult loginTs(@RequestBody PtlAgreementSaveVo agreement) {
+        insuranceCrawlerOrderService.taishanLogin(agreement);
+        return HttpResult.ok("登录成功!");
+    }
+
 
 
 
 
 }
 }

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

@@ -6,6 +6,7 @@ import com.ydtech.modules.order.entity.InsOrders;
 import com.ydtech.modules.order.entity.crawler.vo.CrawlerPolicyPrintVo;
 import com.ydtech.modules.order.entity.crawler.vo.CrawlerPolicyPrintVo;
 import com.ydtech.modules.order.entity.dto.ReadPdfUrlListDto;
 import com.ydtech.modules.order.entity.dto.ReadPdfUrlListDto;
 import com.ydtech.modules.protocol.entity.dto.PtlAgreementAttributionDto;
 import com.ydtech.modules.protocol.entity.dto.PtlAgreementAttributionDto;
+import com.ydtech.modules.protocol.entity.vo.PtlAgreementSaveVo;
 
 
 public interface InsCrawlerOrderService extends BaseOrderService<Object> {
 public interface InsCrawlerOrderService extends BaseOrderService<Object> {
 
 
@@ -99,6 +100,19 @@ public interface InsCrawlerOrderService extends BaseOrderService<Object> {
      */
      */
     void sendcode(String agreementId);
     void sendcode(String agreementId);
 
 
+    /**
+     * 泰山发送验证码
+     * @param attributionDto
+     */
+    void sendcode(PtlAgreementAttributionDto attributionDto);
+
+    /**
+     * 泰山登录
+     *
+     * @param agreement
+     */
+    void taishanLogin(PtlAgreementSaveVo agreement);
+
     /**
     /**
      * 泰山登录
      * 泰山登录
      * @param agreementId
      * @param agreementId

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

@@ -3,6 +3,7 @@ package com.ydtech.modules.order.service.impl;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.ydtech.constants.InsuranceEnum;
 import com.ydtech.constants.enums.InsurKind;
 import com.ydtech.constants.enums.InsurKind;
 import com.ydtech.constants.enums.InsuranceOrderPdf;
 import com.ydtech.constants.enums.InsuranceOrderPdf;
 import com.ydtech.constants.enums.dict.InsOrderStatusEnum;
 import com.ydtech.constants.enums.dict.InsOrderStatusEnum;
@@ -22,7 +23,6 @@ import com.ydtech.modules.order.entity.crawler.constants.CrawlerVerifyPaymentCon
 import com.ydtech.modules.order.entity.crawler.request.*;
 import com.ydtech.modules.order.entity.crawler.request.*;
 import com.ydtech.modules.order.entity.crawler.response.*;
 import com.ydtech.modules.order.entity.crawler.response.*;
 import com.ydtech.modules.order.entity.crawler.vo.CrawlerPolicyPrintVo;
 import com.ydtech.modules.order.entity.crawler.vo.CrawlerPolicyPrintVo;
-import com.ydtech.modules.order.entity.dto.InsUploadImagesDto;
 import com.ydtech.modules.order.entity.dto.ReadPdfUrlListDto;
 import com.ydtech.modules.order.entity.dto.ReadPdfUrlListDto;
 import com.ydtech.modules.order.entity.po.InsTaskImagesBase64;
 import com.ydtech.modules.order.entity.po.InsTaskImagesBase64;
 import com.ydtech.modules.order.entity.po.SysQuoteRecord;
 import com.ydtech.modules.order.entity.po.SysQuoteRecord;
@@ -33,6 +33,7 @@ import com.ydtech.modules.protocol.entity.constants.PtlCrawlerApiType;
 import com.ydtech.modules.protocol.entity.dto.PtlAgreementAttributionDto;
 import com.ydtech.modules.protocol.entity.dto.PtlAgreementAttributionDto;
 import com.ydtech.modules.protocol.entity.dto.PtlAttributionTemplateDto;
 import com.ydtech.modules.protocol.entity.dto.PtlAttributionTemplateDto;
 import com.ydtech.modules.protocol.entity.po.PtlAgreementAttribution;
 import com.ydtech.modules.protocol.entity.po.PtlAgreementAttribution;
+import com.ydtech.modules.protocol.entity.vo.PtlAgreementSaveVo;
 import com.ydtech.modules.protocol.service.PtlAgreementAttributionService;
 import com.ydtech.modules.protocol.service.PtlAgreementAttributionService;
 import com.ydtech.modules.protocol.service.PtlCrawlerApiService;
 import com.ydtech.modules.protocol.service.PtlCrawlerApiService;
 import com.ydtech.modules.protocol.utils.AssertionUtils;
 import com.ydtech.modules.protocol.utils.AssertionUtils;
@@ -58,8 +59,6 @@ import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
 
 
-import static com.ydtech.modules.order.constants.OrderCacheConstant.GR_SPECIAL_AGREEMENT_TIME;
-
 
 
 @Service
 @Service
 @RequiredArgsConstructor
 @RequiredArgsConstructor
@@ -846,6 +845,39 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
                 TimeUnit.SECONDS);
                 TimeUnit.SECONDS);
     }
     }
 
 
+    @Override
+    public void sendcode(PtlAgreementAttributionDto attributionDto) {
+        String apiUrl = ptlCrawlerApiService.getByTemplateId(attributionDto.getTemplateId(), PtlCrawlerApiType.API_11);
+        TsCrawlerLoginRequest crawlerLoginRequest = new TsCrawlerLoginRequest(attributionDto);
+        TsCrawlerBaseResponse response = insCrawlerOrderComponents.request(apiUrl, InsuranceEnum.TSBX.getCode(), "获取验证码",
+                crawlerLoginRequest, TsCrawlerBaseResponse.class);
+        if (!response.getCode().equals(200)) {
+            throw new SystemException(response.getMessage());
+        }
+        // 将返回参数放入redis
+        redisTemplate.opsForValue().set(OrderCacheConstant.TS_ACCESS_TOKEN + attributionDto.getUsername(), JSON.toJSONString(response.getData()), OrderCacheConstant.TS_ACCESS_TOKEN_TIME,
+                TimeUnit.SECONDS);
+    }
+
+    @Override
+    public void taishanLogin(PtlAgreementSaveVo agreement) {
+        // 获取协议的用户名密码
+
+        String apiUrl = ptlCrawlerApiService.getByTemplateId(agreement.getAttribution().getTemplateId(), PtlCrawlerApiType.API_1);
+        String token = redisTemplate.opsForValue().get(OrderCacheConstant.TS_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("验证码已失效!请重新发送!");
+        }
+    }
+
     @Override
     @Override
     public void taishanLogin(String agreementId, String smscode) {
     public void taishanLogin(String agreementId, String smscode) {
         // 获取协议的用户名密码
         // 获取协议的用户名密码
@@ -868,6 +900,5 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
         } else {
         } else {
             throw new SystemException("验证码已失效!请重新发送!");
             throw new SystemException("验证码已失效!请重新发送!");
         }
         }
-
     }
     }
 }
 }

+ 3 - 0
src/main/java/com/ydtech/modules/protocol/entity/dto/PtlAgreementSaveDto.java

@@ -89,4 +89,7 @@ public class PtlAgreementSaveDto implements Serializable {
 
 
     @ApiModelProperty("对接管理人")
     @ApiModelProperty("对接管理人")
     private String custodianId;
     private String custodianId;
+
+    @ApiModelProperty("验证码")
+    private String smsCode;
 }
 }

+ 10 - 1
src/main/java/com/ydtech/modules/protocol/service/impl/PtlAgreementServiceImpl.java

@@ -125,6 +125,9 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
     @Autowired
     @Autowired
     private InsUploadFilesService insUploadFilesService;
     private InsUploadFilesService insUploadFilesService;
 
 
+    @Autowired
+    private InsCrawlerOrderService insCrawlerOrderService;
+
 
 
     public PtlAgreementServiceImpl(PtlAgreementProductCostsService ptlAgreementProductCostsService,
     public PtlAgreementServiceImpl(PtlAgreementProductCostsService ptlAgreementProductCostsService,
                                    PtlAgreementAttributionService ptlAgreementAttributionService,
                                    PtlAgreementAttributionService ptlAgreementAttributionService,
@@ -907,11 +910,17 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
 
 
 
 
         // 验证用户名密码 python api 对接需要验证用户名
         // 验证用户名密码 python api 对接需要验证用户名
-        if (!ObjectUtils.isEmpty(attribution.getApiType()) && PtlApiType.PTL_API_2.getCode() == attribution.getApiType() && verificationLogin && !InsuranceEnum.TSBX.getCode().equals(esmInsCompany.getCode())) {
+        if (!ObjectUtils.isEmpty(attribution.getApiType()) && PtlApiType.PTL_API_2.getCode() == attribution.getApiType() && verificationLogin
+                && !InsuranceEnum.TSBX.getCode().equals(esmInsCompany.getCode())) {
             String nameSimple = esmInsCompany.getNamesimple();
             String nameSimple = esmInsCompany.getNamesimple();
             String id = esmInsCompany.getId();
             String id = esmInsCompany.getId();
             insCrawlerOrderController.isLogin(attribution, id, nameSimple);
             insCrawlerOrderController.isLogin(attribution, id, nameSimple);
         }
         }
+//        else if(!ObjectUtils.isEmpty(attribution.getApiType()) && PtlApiType.PTL_API_2.getCode() == attribution.getApiType() && verificationLogin
+//                && InsuranceEnum.TSBX.getCode().equals(esmInsCompany.getCode())){
+//            String id = esmInsCompany.getId();
+//            insCrawlerOrderService.taishanLogin(attribution,agreementSaveDto.getSmsCode(),id);
+//        }
 
 
         ptlAgreement.setCompaniesType(esmInsCompany.getType());
         ptlAgreement.setCompaniesType(esmInsCompany.getType());
         ptlAgreement.setInsuranceCompanyId(esmInsCompany.getId());
         ptlAgreement.setInsuranceCompanyId(esmInsCompany.getId());