Explorar o código

泰山python代码的提交

dongxin hai 1 ano
pai
achega
2f6cd716df

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

@@ -114,4 +114,13 @@ public class OrderCacheConstant {
      */
     public static final String WECHAT_CUSTOMER_TOKEN = "wechat:customer:token";
 
+    /**
+     * 泰山财险 验证码token
+     */
+    public static final String TS_ACCESS_TOKEN = "ts:access:token:";
+
+    /**
+     * 泰山财险 验证码token
+     */
+    public static final long TS_ACCESS_TOKEN_TIME = 60L * 5 - 10L;
 }

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

@@ -17,10 +17,8 @@ import com.ydtech.modules.order.service.InsOrdersService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.web.bind.annotation.*;
 
 @Api(tags = "爬虫对接")
 @RequestMapping("/insurance/crawler")
@@ -81,4 +79,34 @@ public class InsCrawlerOrderController extends BaseController {
         return insuranceCrawlerOrderService.auditStatusQuery(companyId);
     }
 
+
+    // 泰山获取验证码处理接口
+
+    /**
+     * 泰山发送验证码
+     * @param agreementId
+     * @return
+     */
+    @PostMapping(value = "/sendcode")
+    @ApiOperation(value = "泰山发送验证码")
+    public HttpResult sendcode(@RequestSingleParam(value = "agreementId") String agreementId) {
+        insuranceCrawlerOrderService.sendcode(agreementId);
+        return HttpResult.ok("发送成功!");
+    }
+
+    /**
+     * 泰山登录
+     * @param agreementId
+     * @param smscode
+     * @return
+     */
+    @PostMapping(value = "/login")
+    @ApiOperation(value = "泰山登录")
+    public HttpResult login(String agreementId, String smscode) {
+        insuranceCrawlerOrderService.taishanLogin(agreementId,smscode);
+        return HttpResult.ok("登录成功!");
+    }
+
+
+
 }

+ 6 - 0
src/main/java/com/ydtech/modules/order/entity/crawler/request/CrawlerBaseRequest.java

@@ -20,4 +20,10 @@ public class CrawlerBaseRequest implements Serializable {
     @JsonProperty(value = "plyappno")
     private String orderNo;
 
+    /**
+     * 保险公司平台账号
+     */
+    @JsonProperty(value = "username")
+    private String username;
+
 }

+ 2 - 2
src/main/java/com/ydtech/modules/order/entity/crawler/request/CrawlerImageRequest.java

@@ -21,8 +21,8 @@ public class CrawlerImageRequest extends CrawlerBaseRequest {
     @JsonProperty("b64pho_list")
     private List<B64phoListDTO> b64phoList;
 
-    public CrawlerImageRequest(String insOrderNo, List<B64phoListDTO> b64phoListDTO) {
-        super(insOrderNo);
+    public CrawlerImageRequest(String insOrderNo, List<B64phoListDTO> b64phoListDTO, String username) {
+        super(insOrderNo,username);
         this.b64phoList = b64phoListDTO;
     }
 

+ 8 - 1
src/main/java/com/ydtech/modules/order/entity/crawler/request/CrawlerLoginRequest.java

@@ -1,5 +1,6 @@
 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 lombok.Data;
@@ -35,12 +36,18 @@ public class CrawlerLoginRequest implements Serializable {
     @JsonProperty(value = "other")
     private LinkedHashMap<String, String> other;
 
+
+
     public CrawlerLoginRequest(PtlAgreementAttributionDto attribution) {
         this.username = attribution.getUsername();
         this.password = attribution.getPassword();
         // 环境 新增变量
         this.check = attribution.getCheck();
-        this.other = attribution.getFields().stream().collect(LinkedHashMap::new, (m, v) -> m.put(v.getField(), v.getValue()), LinkedHashMap::putAll);
+        if(CollUtil.isNotEmpty(attribution.getFields())){
+            this.other = attribution.getFields().stream().collect(LinkedHashMap::new, (m, v) -> m.put(v.getField(), v.getValue()), LinkedHashMap::putAll);
+        }
     }
 
+
+
 }

+ 72 - 0
src/main/java/com/ydtech/modules/order/entity/crawler/request/TsCrawlerLoginRequest.java

@@ -0,0 +1,72 @@
+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 lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+import java.util.LinkedHashMap;
+
+@Data
+@NoArgsConstructor
+public class TsCrawlerLoginRequest  implements Serializable {
+
+    private static final long serialVersionUID = 01404102263425770704305L;
+
+    /**
+     * 账号
+     */
+    @JsonProperty(value = "username")
+    private String username;
+
+    /**
+     * 密码
+     */
+    @JsonProperty(value = "pwd")
+    private String pwd;
+
+    /**
+     * 验证码
+     */
+    @JsonProperty(value = "smscode")
+    private String smscode;
+
+    /**
+     * 验证码
+     */
+    @JsonProperty(value = "token")
+    private String token;
+
+    /**
+     * 验证码
+     */
+    @JsonProperty(value = "secretKey")
+    private String secretKey;
+
+
+    /**
+     * 验证码
+     */
+    @JsonProperty(value = "pointJson")
+    private String pointJson;
+
+    @JsonProperty(value = "other")
+    private String other;
+
+    public TsCrawlerLoginRequest(PtlAgreementAttributionDto attribution) {
+        this.username = attribution.getUsername();
+        this.pwd = attribution.getPassword();
+        this.other = "";
+    }
+
+    public TsCrawlerLoginRequest(PtlAgreementAttributionDto attribution, String sendcode,TsCrawlerLoginRequest request) {
+        this.username = attribution.getUsername();
+        this.pwd = attribution.getPassword();
+        this.smscode = sendcode;
+        this.token = request.getToken();
+        this.secretKey = request.getSecretKey();
+        this.pointJson = request.getPointJson();
+    }
+}

+ 28 - 0
src/main/java/com/ydtech/modules/order/entity/crawler/response/TsCrawlerBaseResponse.java

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

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

@@ -93,4 +93,16 @@ public interface InsCrawlerOrderService extends BaseOrderService<Object> {
      */
     ReadPdfUrlListDto getPolicyByCompanyIdPdfList(InsAreaCompany insAreaCompany, InsOrders insOrders,boolean flag);
 
+    /**
+     * 泰山发送验证码
+     * @param agreementId
+     */
+    void sendcode(String agreementId);
+
+    /**
+     * 泰山登录
+     * @param agreementId
+     * @param smscode
+     */
+    void taishanLogin(String agreementId, String smscode);
 }

+ 103 - 39
src/main/java/com/ydtech/modules/order/service/impl/InsCrawlerOrderServiceImpl.java

@@ -12,6 +12,7 @@ import com.ydtech.modules.ins.model.vo.*;
 import com.ydtech.modules.order.components.InsCrawlerOrderComponents;
 import com.ydtech.modules.order.components.InsImagesUploadCacheComponents;
 import com.ydtech.modules.order.components.huatai.HuaTaiUploadImageComponents;
+import com.ydtech.modules.order.constants.OrderCacheConstant;
 import com.ydtech.modules.order.constants.QuoteNumberConstant;
 import com.ydtech.modules.order.constants.UnderwritingStatus;
 import com.ydtech.modules.order.dao.SysQuoteRecordMapper;
@@ -42,6 +43,7 @@ import lombok.RequiredArgsConstructor;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 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;
@@ -49,14 +51,14 @@ import org.springframework.util.ObjectUtils;
 import java.math.BigDecimal;
 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.GR_SPECIAL_AGREEMENT_TIME;
+
 
 @Service
 @RequiredArgsConstructor
@@ -79,6 +81,9 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
 
     private final InsDrivingIntentionInsuranceService insDrivingIntentionInsuranceService;
 
+    @Autowired
+    private StringRedisTemplate redisTemplate;
+
     @Value("${upload.file.path}")
     private String uploadFilePath;
 
@@ -161,33 +166,34 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
         if (response.getCode() != 200) {
 
             //判断错误订单是否是重复投保
-            InsOrderStatusEnum insOrderStatusEnum = InsOrderStatusEnum.QUOTE_FAILED;
-            if (response.getMessage()
-                        .contains("重复投保")) {
-                insOrderStatusEnum = InsOrderStatusEnum.REPEAT_INSURE;
-            }
-            String subOrderNo = insOrdersService.responseFailedOrder(t, quoteInfoVo, ptlAgreementAttribution, order, response.getMessage(), insOrderStatusEnum);
-            if (!Objects.isNull(response.getOther()
-                                        .getMaxQuoteNum())) {
-                int quoteNum = maxQuoteNum - Integer.parseInt(response.getOther()
-                                                                      .getMaxQuoteNum());
-                for (int i = 0; i < quoteNum; i++) {
-                    SysQuoteRecord sysQuoteRecord = new SysQuoteRecord(quoteInfoVo.getUserid(), t.getCompanyId(), quoteInfoVo.getCarInfo()
-                                                                                                                             .getLicenseNo(),
-                            QuoteNumberConstant.QuoteAction.QUOTE_FAILED.getCode()
-                                                                        .toString(), QuoteNumberConstant.QuoteResult.FAIL.getCode()
-                                                                                                                         .toString());
-                    sysQuoteRecords.add(sysQuoteRecord);
-                }
-                sysQuoteRecords.forEach(item -> {
-                    item.setSubOrderNo(subOrderNo);
-                });
-                if (sysQuoteRecords.size() > 0) {
-                    sysQuoteRecordMapper.insertBatch(sysQuoteRecords);
-                    //刷新redis中的报价次数
-                    sysQuoteRedisService.refreshQuoteNum(t.getCompanyId(), quoteInfoVo.getUserid(), sysQuoteRecords);
-                }
-            }
+//            InsOrderStatusEnum insOrderStatusEnum = InsOrderStatusEnum.QUOTE_FAILED;
+//            if (response.getMessage()
+//                        .contains("重复投保")) {
+//                insOrderStatusEnum = InsOrderStatusEnum.REPEAT_INSURE;
+//            }
+//            String subOrderNo = insOrdersService.responseFailedOrder(t, quoteInfoVo, ptlAgreementAttribution, order, response.getMessage(), insOrderStatusEnum);
+//            if (!Objects.isNull(response.getOther()
+//                    .getMaxQuoteNum())) {
+//                int quoteNum = maxQuoteNum - Integer.parseInt(response.getOther()
+//                        .getMaxQuoteNum());
+//                for (int i = 0; i < quoteNum; i++) {
+//                    SysQuoteRecord sysQuoteRecord = new SysQuoteRecord(quoteInfoVo.getUserid(), t.getCompanyId(), quoteInfoVo.getCarInfo()
+//                            .getLicenseNo(),
+//                            QuoteNumberConstant.QuoteAction.QUOTE_FAILED.getCode()
+//                                    .toString(), QuoteNumberConstant.QuoteResult.FAIL.getCode()
+//                            .toString());
+//                    sysQuoteRecords.add(sysQuoteRecord);
+//                }
+//                sysQuoteRecords.forEach(item -> {
+//                    item.setSubOrderNo(subOrderNo);
+//                });
+//                if (sysQuoteRecords.size() > 0) {
+//                    sysQuoteRecordMapper.insertBatch(sysQuoteRecords);
+//                    //刷新redis中的报价次数
+//                    sysQuoteRedisService.refreshQuoteNum(t.getCompanyId(), quoteInfoVo.getUserid(), sysQuoteRecords);
+//                }
+//            }
+
             throw new SystemException(response.getMessage());
         }
 
@@ -265,6 +271,9 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
             //泰康
             return HttpResult.ok("上传成功");
         }
+
+        // 账号信息
+        PtlAgreementAttribution ptlAgreementAttribution = ptlAgreementAttributionService.getById(insAreaCompany.getAgreementId());
         // 请求地址
         String apiUrl = ptlCrawlerApiService.getApiUrl(insAreaCompany.getAgreementId(), PtlCrawlerApiType.API_3);
         // 获取缓存中的影像信息
@@ -276,7 +285,7 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
         }
 
         CrawlerImageRequest crawlerImageRequest = new CrawlerImageRequest(insAreaCompany.getInsOrderNo(),
-                CrawlerImageRequest.toB64phoListDTO(insTaskImagesBase64s));
+                CrawlerImageRequest.toB64phoListDTO(insTaskImagesBase64s),ptlAgreementAttribution.getUsername());
         // 发送请求
         CrawlerBaseResponse response = insCrawlerOrderComponents.request(apiUrl, insAreaCompany.getCompanyId(),
                 PtlCrawlerApiType.API_3.getDesc(), crawlerImageRequest, CrawlerBaseResponse.class);
@@ -293,10 +302,12 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
     @Override
     public HttpResult<Object> audit(String subOrderNo) {
         InsAreaCompany insAreaCompany = insAreaCompanyService.getById(subOrderNo);
+        // 账号信息
+        PtlAgreementAttribution ptlAgreementAttribution = ptlAgreementAttributionService.getById(insAreaCompany.getAgreementId());
         // 请求地址
         String apiUrl = ptlCrawlerApiService.getApiUrl(insAreaCompany.getAgreementId(), PtlCrawlerApiType.API_4);
         //组装参数
-        CrawlerBaseRequest crawlerBaseRequest = new CrawlerBaseRequest(insAreaCompany.getInsOrderNo());
+        CrawlerBaseRequest crawlerBaseRequest = new CrawlerBaseRequest(insAreaCompany.getInsOrderNo(),ptlAgreementAttribution.getUsername());
         CrawlerAuditResponse crawlerAuditResponse = insCrawlerOrderComponents.request(apiUrl, insAreaCompany.getCompanyId(),
                 PtlCrawlerApiType.API_4.getDesc(), crawlerBaseRequest, CrawlerAuditResponse.class);
 
@@ -335,7 +346,9 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
         // 请求地址
         String apiUrl = ptlCrawlerApiService.getApiUrl(insAreaCompany.getAgreementId(), PtlCrawlerApiType.API_5);
         //组装参数
-        CrawlerBaseRequest crawlerBaseRequest = new CrawlerBaseRequest(insAreaCompany.getInsOrderNo());
+        // 账号信息
+        PtlAgreementAttribution ptlAgreementAttribution = ptlAgreementAttributionService.getById(insAreaCompany.getAgreementId());
+        CrawlerBaseRequest crawlerBaseRequest = new CrawlerBaseRequest(insAreaCompany.getInsOrderNo(),ptlAgreementAttribution.getUsername());
         CrawlerVerifyPaymentResponse crawlerAuditResponse = insCrawlerOrderComponents.request(apiUrl, insAreaCompany.getCompanyId(),
                 PtlCrawlerApiType.API_5.getDesc(), crawlerBaseRequest, CrawlerVerifyPaymentResponse.class);
 
@@ -368,8 +381,10 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
 
         // 请求地址
         String apiUrl = ptlCrawlerApiService.getApiUrl(insAreaCompany.getAgreementId(), PtlCrawlerApiType.API_6);
+        // 账号信息
+        PtlAgreementAttribution ptlAgreementAttribution = ptlAgreementAttributionService.getById(insAreaCompany.getAgreementId());
         //组装参数
-        CrawlerBaseRequest crawlerBaseRequest = new CrawlerBaseRequest(insAreaCompany.getInsOrderNo());
+        CrawlerBaseRequest crawlerBaseRequest = new CrawlerBaseRequest(insAreaCompany.getInsOrderNo(),ptlAgreementAttribution.getUsername());
         CrawlerPolicyPrintResponse response = insCrawlerOrderComponents.request(apiUrl, insAreaCompany.getCompanyId(),
                 PtlCrawlerApiType.API_6.getDesc(), crawlerBaseRequest, CrawlerPolicyPrintResponse.class);
 
@@ -625,8 +640,10 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
         InsAreaCompany insAreaCompany = insAreaCompanyService.getById(subOrderNo);
         String agreementId = insAreaCompany.getAgreementId();
         String apiUrl = ptlCrawlerApiService.getApiUrl(agreementId, PtlCrawlerApiType.API_8);
+        // 账号信息
+        PtlAgreementAttribution ptlAgreementAttribution = ptlAgreementAttributionService.getById(insAreaCompany.getAgreementId());
         //组装参数
-        CrawlerBaseRequest crawlerBaseRequest = new CrawlerBaseRequest(insAreaCompany.getInsOrderNo());
+        CrawlerBaseRequest crawlerBaseRequest = new CrawlerBaseRequest(insAreaCompany.getInsOrderNo(),ptlAgreementAttribution.getUsername());
 
         CrawlerAuditResponse crawlerAuditResponse = insCrawlerOrderComponents.request(apiUrl, insAreaCompany.getCompanyId(),
                 PtlCrawlerApiType.API_8.getDesc(), crawlerBaseRequest, CrawlerAuditResponse.class);
@@ -661,8 +678,10 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
         InsAreaCompany insAreaCompany = insAreaCompanyService.getById(insAreaCompanyId);
         // 请求地址
         String apiUrl = ptlCrawlerApiService.getApiUrl(insAreaCompany.getAgreementId(), PtlCrawlerApiType.API_5);
+        // 账号信息
+        PtlAgreementAttribution ptlAgreementAttribution = ptlAgreementAttributionService.getById(insAreaCompany.getAgreementId());
         //组装参数
-        CrawlerBaseRequest crawlerBaseRequest = new CrawlerBaseRequest(insAreaCompany.getInsOrderNo());
+        CrawlerBaseRequest crawlerBaseRequest = new CrawlerBaseRequest(insAreaCompany.getInsOrderNo(),ptlAgreementAttribution.getUsername());
         CrawlerVerifyPaymentResponse crawlerAuditResponse = insCrawlerOrderComponents.request(apiUrl, insAreaCompany.getCompanyId(),
                 PtlCrawlerApiType.API_5.getDesc(), crawlerBaseRequest, CrawlerVerifyPaymentResponse.class);
 
@@ -703,7 +722,9 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
     }
 
     private boolean quashOrder(InsAreaCompany insAreaCompany) {
-        CrawlerBaseRequest crawlerBaseRequest = new CrawlerBaseRequest(insAreaCompany.getInsOrderNo());
+        // 账号信息
+        PtlAgreementAttribution ptlAgreementAttribution = ptlAgreementAttributionService.getById(insAreaCompany.getAgreementId());
+        CrawlerBaseRequest crawlerBaseRequest = new CrawlerBaseRequest(insAreaCompany.getInsOrderNo(),ptlAgreementAttribution.getUsername());
         CrawlerBaseResponse request = insCrawlerOrderComponents.request(apiUrl, insAreaCompany.getCompanyId(),
                 PtlCrawlerApiType.API_9.getDesc(), crawlerBaseRequest, CrawlerBaseResponse.class);
         if (request.getCode() == CrawlerAuditStatus.CAS_200.getCode()) {
@@ -742,8 +763,11 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
         String pathPrefix = insAreaCompany.getInscompany() + "-" + insOrders.getLicenseno() + "-" + insAreaCompany.getId() + "-";
         // 请求地址
         String apiUrl = ptlCrawlerApiService.getApiUrl(insAreaCompany.getAgreementId(), PtlCrawlerApiType.API_6);
+        // 账号信息
+        PtlAgreementAttribution ptlAgreementAttribution = ptlAgreementAttributionService.getById(insAreaCompany.getAgreementId());
+
         //组装参数
-        CrawlerBaseRequest crawlerBaseRequest = new CrawlerBaseRequest(insAreaCompany.getInsOrderNo());
+        CrawlerBaseRequest crawlerBaseRequest = new CrawlerBaseRequest(insAreaCompany.getInsOrderNo(),ptlAgreementAttribution.getUsername());
         CrawlerPolicyPrintResponse response = insCrawlerOrderComponents.request(apiUrl, insAreaCompany.getCompanyId(), PtlCrawlerApiType.API_6.getDesc(), crawlerBaseRequest, CrawlerPolicyPrintResponse.class);
         if (response.getCode() == 200) {
             //交强险标志地址
@@ -787,4 +811,44 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
         return FileUtil.netUrlToFileNew(url, dir, fileName, uploadFilePath, apiUrl + showFileUrl, flag);
     }
 
+
+    @Override
+    public void sendcode(String agreementId) {
+        // 获取协议的用户名密码
+        PtlAgreementAttribution attribution = ptlAgreementAttributionService.getById(agreementId);
+        PtlAgreementAttributionDto attributionDto = new PtlAgreementAttributionDto();
+        BeanUtils.copyProperties(attribution, attributionDto);
+        String apiUrl = attribution.getFields().getJSONObject(0).getString("value");
+        TsCrawlerLoginRequest crawlerLoginRequest = new TsCrawlerLoginRequest(attributionDto);
+        TsCrawlerBaseResponse response = insCrawlerOrderComponents.request(apiUrl, attribution.getInsCompanyId(), "获取验证码",
+                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(String agreementId, String smscode) {
+        // 获取协议的用户名密码
+        PtlAgreementAttribution attribution = ptlAgreementAttributionService.getById(agreementId);
+        PtlAgreementAttributionDto attributionDto = new PtlAgreementAttributionDto();
+        BeanUtils.copyProperties(attribution, attributionDto);
+        String apiUrl = ptlCrawlerApiService.getByTemplateId(attribution.getTemplateId(), PtlCrawlerApiType.API_1);
+        String token = redisTemplate.opsForValue().get(OrderCacheConstant.TS_ACCESS_TOKEN + attributionDto.getUsername());
+        if(StringUtils.isNotBlank(token)){
+            TsCrawlerLoginRequest request = JSON.parseObject(token).toJavaObject(TsCrawlerLoginRequest.class);
+            TsCrawlerLoginRequest tsRequest = new TsCrawlerLoginRequest(attributionDto,smscode,request);
+            TsCrawlerBaseResponse response = insCrawlerOrderComponents.request(apiUrl, attribution.getInsCompanyId(), "登录",
+                    tsRequest, TsCrawlerBaseResponse.class);
+            if(!response.getCode().equals(200)){
+                throw new SystemException("泰山登录失败:" + response.getMessage());
+            }
+        }else{
+            throw new SystemException("验证码已失效!请重新发送!");
+        }
+
+    }
 }

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

@@ -81,4 +81,7 @@ public class PtlAgreementPageVo extends PageRequest {
     @ApiModelProperty("是否有效")
     private String isValid;
 
+    @ApiModelProperty("请求类型 1:api 2:python")
+    private Integer apiType;
+
 }

+ 21 - 2
src/main/java/com/ydtech/modules/protocol/service/impl/PtlAgreementServiceImpl.java

@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapp
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ydtech.config.DictEnumConfig;
+import com.ydtech.constants.InsuranceEnum;
 import com.ydtech.constants.enums.dict.DictionaryData;
 import com.ydtech.constants.enums.dict.DictionaryManagement;
 import com.ydtech.core.page.HttpResult;
@@ -634,6 +635,8 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
         // 审核状态
         wrapper.eq(!ObjectUtils.isEmpty(ptlAgreementPageVo.getAuditStatus()), PtlAgreement::getAuditStatus,
                         ptlAgreementPageVo.getAuditStatus())
+                .eq(!ObjectUtils.isEmpty(ptlAgreementPageVo.getAuditStatus()), PtlAgreement::getAgreementType,
+                        ptlAgreementPageVo.getAuditStatus())
                 //是否有效
                 .eq(!ObjectUtils.isEmpty(ptlAgreementPageVo.getValidStatus()), PtlAgreement::getValidStatus,
                         ptlAgreementPageVo.getValidStatus())
@@ -647,7 +650,22 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
                         ptlAgreementPageVo.getIsExternal())
         ;
         List<PtlAgreement> agreementPage = list(wrapper);
-        return HttpResult.ok(agreementPage);
+        List<PtlAgreement> ptlAgreements = new ArrayList<>();
+        if(CollUtil.isNotEmpty(agreementPage)) {
+            for (PtlAgreement ptlAgreement : agreementPage) {
+                PtlAgreementAttribution attribution = ptlAgreementAttributionService.getById(ptlAgreement);
+                if(Objects.nonNull(attribution)) {
+                    if(Objects.nonNull(ptlAgreementPageVo.getApiType())) {
+                        if(ptlAgreementPageVo.getApiType().equals(attribution.getApiType())){
+                            ptlAgreements.add(ptlAgreement);
+                        }
+                    }else{
+                        ptlAgreements.add(ptlAgreement);
+                    }
+                }
+            }
+        }
+        return HttpResult.ok(ptlAgreements);
     }
 
     @Override
@@ -887,8 +905,9 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
 
         esmInsCompany = esmInsCompanyService.getBySubsidiary(agreementSaveDto.getPartnerCompaniesId());
 
+
         // 验证用户名密码 python api 对接需要验证用户名
-        if (!ObjectUtils.isEmpty(attribution.getApiType()) && PtlApiType.PTL_API_2.getCode() == attribution.getApiType() && verificationLogin) {
+        if (!ObjectUtils.isEmpty(attribution.getApiType()) && PtlApiType.PTL_API_2.getCode() == attribution.getApiType() && verificationLogin && !InsuranceEnum.TSBX.getCode().equals(esmInsCompany.getCode())) {
             String nameSimple = esmInsCompany.getNamesimple();
             String id = esmInsCompany.getId();
             insCrawlerOrderController.isLogin(attribution, id, nameSimple);

+ 2 - 1
src/main/java/com/ydtech/modules/xxl/factory/QueryStatusFactory.java

@@ -71,7 +71,8 @@ public class QueryStatusFactory {
                     (ConfigureParametersComponents) map.get("configureParametersComponents"),
                     (PtlCrawlerApiService) map.get("ptlCrawlerApiService"),
                     (InsCrawlerOrderComponents) map.get("insCrawlerOrderComponents"),
-                    (InsCrawlerOrderService) map.get("insCrawlerOrderService"));
+                    (InsCrawlerOrderService) map.get("insCrawlerOrderService"),
+                    (PtlAgreementAttributionService) map.get("ptlAgreementAttributionService"));
         } else if(companyId.startsWith("BPIC1000000")){
             //渤海
             return new BoHaiQueryStatusService((BoHaiOrderApiService) map.get("boHaiOrderApiService"));

+ 6 - 1
src/main/java/com/ydtech/modules/xxl/service/impl/InsCrawlerQueryStatusService.java

@@ -7,6 +7,8 @@ import com.ydtech.modules.order.entity.crawler.request.CrawlerBaseRequest;
 import com.ydtech.modules.order.entity.crawler.response.CrawlerVerifyPaymentResponse;
 import com.ydtech.modules.order.service.InsCrawlerOrderService;
 import com.ydtech.modules.protocol.entity.constants.PtlCrawlerApiType;
+import com.ydtech.modules.protocol.entity.po.PtlAgreementAttribution;
+import com.ydtech.modules.protocol.service.PtlAgreementAttributionService;
 import com.ydtech.modules.protocol.service.PtlCrawlerApiService;
 import com.ydtech.modules.xxl.model.InsAreaCompany;
 import com.ydtech.modules.xxl.model.QueryStatusResult;
@@ -31,6 +33,7 @@ public class InsCrawlerQueryStatusService implements BaseQueryStatusService {
     private final PtlCrawlerApiService ptlCrawlerApiService;
     private final InsCrawlerOrderComponents insCrawlerOrderComponents;
     private final InsCrawlerOrderService insCrawlerOrderService;
+    private final PtlAgreementAttributionService ptlAgreementAttributionService;
 
 
     /**
@@ -42,10 +45,12 @@ public class InsCrawlerQueryStatusService implements BaseQueryStatusService {
     public QueryStatusResult queryStatus(InsAreaCompany insAreaCompany) {
         QueryStatusResult queryStatusResult = new QueryStatusResult();
         queryStatusResult.setStatus(false);
+        // 账号信息
+        PtlAgreementAttribution ptlAgreementAttribution = ptlAgreementAttributionService.getById(insAreaCompany.getAgreementId());
         // 请求地址
         String apiUrl = ptlCrawlerApiService.getApiUrl(insAreaCompany.getAgreementId(), PtlCrawlerApiType.API_5);
         //组装参数
-        CrawlerBaseRequest crawlerBaseRequest = new CrawlerBaseRequest(insAreaCompany.getInsOrderNo());
+        CrawlerBaseRequest crawlerBaseRequest = new CrawlerBaseRequest(insAreaCompany.getInsOrderNo(),ptlAgreementAttribution.getUsername());
         CrawlerVerifyPaymentResponse crawlerAuditResponse = insCrawlerOrderComponents.request(apiUrl, insAreaCompany.getCompanyId(),
                 PtlCrawlerApiType.API_5.getDesc(), crawlerBaseRequest, CrawlerVerifyPaymentResponse.class);