Преглед изворни кода

Merge branch 'refs/heads/test' into test-fee

# Conflicts:
#	src/main/java/com/ydtech/modules/order/service/impl/InsOrdersServiceImpl.java
wks пре 2 година
родитељ
комит
9009bde1e2
45 измењених фајлова са 1713 додато и 314 уклоњено
  1. 32 0
      src/main/java/com/ydtech/config/properties/UnionPayApiConfigurationProperties.java
  2. 1 0
      src/main/java/com/ydtech/config/resttemplate/CustomResponseErrorHandler.java
  3. 81 61
      src/main/java/com/ydtech/modules/admin/components/UnionPayRequestApiComponent.java
  4. 13 0
      src/main/java/com/ydtech/modules/admin/controller/AlipayController.java
  5. 14 1
      src/main/java/com/ydtech/modules/admin/controller/financialReceivables/FinancialReceivablesController.java
  6. 2 2
      src/main/java/com/ydtech/modules/admin/model/report/financialReceivables/FinancialReceivablesAllMonthVo.java
  7. 23 0
      src/main/java/com/ydtech/modules/admin/model/report/financialReceivables/FinancialReceivablesMonthSignleVo.java
  8. 46 2
      src/main/java/com/ydtech/modules/admin/model/report/financialReceivables/FinancialReceivablesMonthVo.java
  9. 3 0
      src/main/java/com/ydtech/modules/admin/model/report/financialReceivables/FinancialReceivablesQueryMonthVo.java
  10. 4 0
      src/main/java/com/ydtech/modules/admin/model/report/financialReceivables/FinancialReceivablesQueryVo.java
  11. 7 0
      src/main/java/com/ydtech/modules/admin/service/impl/SysAmountAuditingServiceImpl.java
  12. 60 0
      src/main/java/com/ydtech/modules/admin/utils/UnionPayUtils.java
  13. 4 0
      src/main/java/com/ydtech/modules/fnc/controller/CarSettleController.java
  14. 12 3
      src/main/java/com/ydtech/modules/fnc/controller/InsPlyIncomeController.java
  15. 10 2
      src/main/java/com/ydtech/modules/fnc/dao/InsPlyIncomeMapper.java
  16. 17 0
      src/main/java/com/ydtech/modules/fnc/service/InsPlyIncomeService.java
  17. 10 6
      src/main/java/com/ydtech/modules/fnc/service/impl/InsFeeAuditServiceImpl.java
  18. 188 12
      src/main/java/com/ydtech/modules/fnc/service/impl/InsPlyIncomeServiceImpl.java
  19. 22 0
      src/main/java/com/ydtech/modules/fnc/vo/InsPlyIncomeIdsVo.java
  20. 13 0
      src/main/java/com/ydtech/modules/ins/model/pingan/respose/PingAnQuoteRespVo.java
  21. 3 0
      src/main/java/com/ydtech/modules/ins/model/ya/YaQuoteInfoVo.java
  22. 1 1
      src/main/java/com/ydtech/modules/order/controller/PingAnOrderApiController.java
  23. 6 0
      src/main/java/com/ydtech/modules/order/entity/api/pingan/log/PinganApiLog.java
  24. 29 12
      src/main/java/com/ydtech/modules/order/entity/api/pingan/request/PayReturnRequest.java
  25. 190 26
      src/main/java/com/ydtech/modules/order/entity/api/pingan/request/QuoteRequest.java
  26. 40 0
      src/main/java/com/ydtech/modules/order/entity/api/pingan/response/QuoteResponse.java
  27. 3 0
      src/main/java/com/ydtech/modules/order/entity/vo/AuditOrderFeeVo.java
  28. 1 0
      src/main/java/com/ydtech/modules/order/entity/vo/BaseQuoteInfoVo.java
  29. 56 18
      src/main/java/com/ydtech/modules/order/entity/vo/pingan/InsDrivingIntentionInsuranceSonVo.java
  30. 1 2
      src/main/java/com/ydtech/modules/order/service/PingAnOrderApiService.java
  31. 4 4
      src/main/java/com/ydtech/modules/order/service/impl/BoHaiOrderApiServiceImpl.java
  32. 3 3
      src/main/java/com/ydtech/modules/order/service/impl/DaJiaOrderServiceImpl.java
  33. 1 1
      src/main/java/com/ydtech/modules/order/service/impl/GuorenOrderApiServiceImpl.java
  34. 3 3
      src/main/java/com/ydtech/modules/order/service/impl/HuaTaiOrderApiServiceImpl.java
  35. 4 4
      src/main/java/com/ydtech/modules/order/service/impl/InsCrawlerOrderServiceImpl.java
  36. 31 30
      src/main/java/com/ydtech/modules/order/service/impl/InsOrdersServiceImpl.java
  37. 323 88
      src/main/java/com/ydtech/modules/order/service/impl/PingAnOrderApiServiceImpl.java
  38. 4 4
      src/main/java/com/ydtech/modules/order/service/impl/YongchengOrderApiServiceImpl.java
  39. 1 1
      src/main/java/com/ydtech/modules/order/service/impl/ZhongMeiOrderApiServiceImpl.java
  40. 1 1
      src/main/java/com/ydtech/modules/order/service/impl/ZijinOrderApiServiceImpl.java
  41. 131 0
      src/main/java/com/ydtech/modules/order/utils/MD5Util.java
  42. 8 8
      src/main/resources/application-pre.yml
  43. 8 7
      src/main/resources/application-prod.yml
  44. 8 7
      src/main/resources/application-test.yml
  45. 291 5
      src/main/resources/mapper/modules/fnc/InsPlyIncomeMapper.xml

+ 32 - 0
src/main/java/com/ydtech/config/properties/UnionPayApiConfigurationProperties.java

@@ -0,0 +1,32 @@
+package com.ydtech.config.properties;
+
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+/**
+ * @description: 银联支付 配置文件
+ * @author: wenks
+ * @date: 2024/8/8 16:33
+ **/
+@Data
+@Component
+@ConfigurationProperties(prefix = "unionpay.api")
+public class UnionPayApiConfigurationProperties {
+
+    private String appId;
+
+    private String appKey;
+
+    private String accessTokenUrl;
+
+    private String factorVerifyUrl;
+
+    private String bankCardVerifyUrl;
+
+    private String publicKey;
+
+    private String privateKey;
+
+}

+ 1 - 0
src/main/java/com/ydtech/config/resttemplate/CustomResponseErrorHandler.java

@@ -6,6 +6,7 @@ import org.springframework.http.client.ClientHttpResponse;
 import org.springframework.web.client.ResponseErrorHandler;
 
 import java.io.IOException;
+import java.io.InputStream;
 
 public class CustomResponseErrorHandler implements ResponseErrorHandler {
 

+ 81 - 61
src/main/java/com/ydtech/modules/admin/components/UnionPayRequestApiComponent.java

@@ -1,10 +1,11 @@
 package com.ydtech.modules.admin.components;
 
 import com.alibaba.fastjson.JSONObject;
+import com.ydtech.config.properties.UnionPayApiConfigurationProperties;
 import com.ydtech.exception.SystemException;
 import com.ydtech.modules.admin.components.request.UnionPayRequest;
 import com.ydtech.modules.admin.components.response.UnionPayResponse;
-import com.ydtech.utils.HMAC256Uitil;
+import com.ydtech.modules.admin.utils.UnionPayUtils;
 import com.ydtech.utils.SM2Utils;
 import com.ydtech.utils.StringUtils;
 import lombok.RequiredArgsConstructor;
@@ -12,8 +13,6 @@ import org.redisson.api.RLock;
 import org.redisson.api.RedissonClient;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.env.Environment;
 import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.http.HttpEntity;
 import org.springframework.http.HttpHeaders;
@@ -26,7 +25,10 @@ import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.security.InvalidParameterException;
 import java.text.SimpleDateFormat;
-import java.util.*;
+import java.util.Base64;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
 import java.util.concurrent.TimeUnit;
 
 /**
@@ -37,32 +39,38 @@ import java.util.concurrent.TimeUnit;
 public class UnionPayRequestApiComponent {
 
     private final static Logger LOGGER = LoggerFactory.getLogger(UnionPayRequestApiComponent.class);
-    @Autowired
-    Environment environment;
 
-    @Autowired
-    private  RedissonClient redissonClient;
-    @Autowired
-    private  StringRedisTemplate redisTemplate;
+    private final UnionPayApiConfigurationProperties unionPayApiConfigurationProperties;
+
+    private final RedissonClient redissonClient;
+
+    private final StringRedisTemplate redisTemplate;
 
     private final RestTemplate restTemplate;
 
-    private  final String UNION_PAY_MAP = "unionPay";
-    private  final String UNION_PAY_ACCESS_TOKEN_KEY = "unionPayAccessToken";
-    private  final String UNION_PAY_ACCESS_TOKEN_LOCK = "unionPayAccessTokenLock";
-    private  final int UNION_PAY_LOCK_TIME = 10000;
-    private  final int UNION_PAY_SLEEP_TIME = 5000;
-    private  final int RANDOM_MAX = 999999999;
-    private  final int RANDOM_MIN = 100000000;
+    private final static String UNION_PAY_MAP = "unionPay";
+
+    private final static String UNION_PAY_ACCESS_TOKEN_KEY = "unionPayAccessToken";
+
+    private final static String UNION_PAY_ACCESS_TOKEN_LOCK = "unionPayAccessTokenLock";
+
+    private final static int UNION_PAY_LOCK_TIME = 10000;
+
+    private final static int UNION_PAY_SLEEP_TIME = 5000;
 
+    private final static int RANDOM_MAX = 999999999;
+
+    private final static int RANDOM_MIN = 100000000;
 
     /**
      * 运营商二要素验证接口
+     *
      * @param request
      */
     public UnionPayResponse twoFactorVerifyRequest(UnionPayRequest request) {
-        String url = environment.getProperty("unionPay.2FactorVerifyUrl");
-        JSONObject params=new JSONObject();
+        String url = unionPayApiConfigurationProperties.getFactorVerifyUrl();
+
+        JSONObject params = new JSONObject();
         if (StringUtils.isBlank(request.getPhoneNo())) {
             throw new InvalidParameterException("手机号不允许为空!");
         }
@@ -84,11 +92,13 @@ public class UnionPayRequestApiComponent {
 
     /**
      * 银行卡验证接口
+     *
      * @param request
      */
-    public UnionPayResponse bankCardVerifyRequest(UnionPayRequest request)  {
-        String url = environment.getProperty("unionPay.2FactorVerifyUrl");
-        JSONObject params=new JSONObject();
+    public UnionPayResponse bankCardVerifyRequest(UnionPayRequest request) {
+        String url = unionPayApiConfigurationProperties.getFactorVerifyUrl();
+
+        JSONObject params = new JSONObject();
         if (StringUtils.isBlank(request.getCardNo())) {
             throw new InvalidParameterException("卡号不允许为空!");
         }
@@ -114,8 +124,8 @@ public class UnionPayRequestApiComponent {
         try {
             params.put("sourceIp", InetAddress.getLocalHost().getHostAddress()); // ip
         } catch (UnknownHostException e) {
-            LOGGER.error("获取ipv4地址异常",e);
-            throw new RuntimeException("获取ipv4地址异常:",e);
+            LOGGER.error("获取ipv4地址异常", e);
+            throw new RuntimeException("获取ipv4地址异常:", e);
         }
         params.put("protocolVersion", ""); // 用户授权协议版本号 //TODO
         params.put("protocolNo", ""); // 用户授权协议流水号
@@ -125,52 +135,56 @@ public class UnionPayRequestApiComponent {
 
     /**
      * 调用银联接口
-     * @param url 地址
+     *
+     * @param url    地址
      * @param params 入参
      * @return 返参
      */
-    private UnionPayResponse commonRequest(String url,JSONObject params)  {
+    private UnionPayResponse commonRequest(String url, JSONObject params) {
         try {
-            String publicKey = environment.getProperty("unionPay.publicKey");
-            JSONObject data=new JSONObject();
+            String publicKey = unionPayApiConfigurationProperties.getPublicKey();
+
+            JSONObject data = new JSONObject();
             String dataValue = Base64.getEncoder().encodeToString(SM2Utils.encrypt(params.toString(),
                     publicKey).getBytes());
             data.put("data", dataValue);
 
             HttpHeaders httpHeaders = new HttpHeaders();
-            httpHeaders.set("Content-Type","application/json;charset=UTF-8");
-            httpHeaders.set("Accept","application/json");
-            httpHeaders.set("Authorization",getAccessToken());
+            httpHeaders.set("Content-Type", "application/json;charset=UTF-8");
+            httpHeaders.set("Accept", "application/json");
+            httpHeaders.set("Authorization", getAccessToken());
             // 请求
             HttpEntity<String> httpEntity = new HttpEntity<>(params.toString(), httpHeaders);
             ResponseEntity<String> response = restTemplate.postForEntity(url, httpEntity, String.class);
             JSONObject resp = JSONObject.parseObject(response.getBody());
 
             if ("20000000".equals(resp.getString("errCode"))) {
-                String privateKey = environment.getProperty("unionPay.privateKey");
+                String privateKey = unionPayApiConfigurationProperties.getPrivateKey();
+
                 String respData = SM2Utils.decrypt(new String(Base64.getDecoder().decode(resp.getString("data"))),
                         privateKey);
                 return JSONObject.parseObject(respData, UnionPayResponse.class);
             } else {
-                throw new SystemException("银联信息验证异常["+resp.getString("errCode")+":"+
-                        resp.getString("errInfo")+"]");
+                throw new SystemException("银联信息验证异常[" + resp.getString("errCode") + ":" +
+                        resp.getString("errInfo") + "]");
             }
         } catch (Exception e) {
-            LOGGER.error("银联接口调用异常",e);
-            throw new RuntimeException("银联接口调用异常:",e);
+            LOGGER.error("银联接口调用异常", e);
+            throw new RuntimeException("银联接口调用异常:", e);
         }
     }
 
     /**
      * 获取银联token
+     *
      * @return
      */
     private String getAccessToken() {
 
-        Object token = redisTemplate.opsForHash().get(UNION_PAY_MAP,UNION_PAY_ACCESS_TOKEN_KEY);
+        Object token = redisTemplate.opsForHash().get(UNION_PAY_MAP, UNION_PAY_ACCESS_TOKEN_KEY);
         // 缓存中不存在就去请求token
         if (!ObjectUtils.isEmpty(token)) {
-            return (String)token;
+            return (String) token;
         }
 
         // 使用分布式锁 只有一个人可以访问登录
@@ -186,7 +200,7 @@ public class UnionPayRequestApiComponent {
             }
 
         } catch (InterruptedException e) {
-            LOGGER.error("getAccessToken InterruptedException",e);
+            LOGGER.error("getAccessToken InterruptedException", e);
             lock.unlock();
             Thread.currentThread().interrupt();
             throw new RuntimeException("获取银联Token异常,请重试!");
@@ -196,7 +210,7 @@ public class UnionPayRequestApiComponent {
         try {
             Thread.sleep(UNION_PAY_SLEEP_TIME);
         } catch (InterruptedException e) {
-            LOGGER.error("getAccessToken InterruptedException",e);
+            LOGGER.error("getAccessToken InterruptedException", e);
             Thread.currentThread().interrupt();
             throw new RuntimeException("获取银联Token异常,请重试!");
         }
@@ -205,49 +219,55 @@ public class UnionPayRequestApiComponent {
 
     /**
      * 调用银联接口获取token
+     *
      * @return token
      */
-    private String invokeToken() {
-        String appId = environment.getProperty("unionPay.appId");
-        String appKey = environment.getProperty("unionPay.appKey");
-        String accessTokenUrl = environment.getProperty("unionPay.accessTokenUrl");
+    public String invokeToken() {
+        String appId = unionPayApiConfigurationProperties.getAppId();
+        String appKey = unionPayApiConfigurationProperties.getAppKey();
+        String accessTokenUrl = unionPayApiConfigurationProperties.getAccessTokenUrl();
+
         SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
         String timestamp = sdf.format(new Date());
-        Random rand = new Random();
-        String randNumber = String.valueOf(rand.nextInt(RANDOM_MAX - RANDOM_MIN + 1) + RANDOM_MIN);
+        String randNumber = UnionPayUtils.createData(3);
 
-        String signature = HMAC256Uitil.hmac256(appId+timestamp+randNumber,appKey);//TODO
+        String signature = UnionPayUtils.SHA256(appId + timestamp + randNumber + appKey);
 
-        JSONObject params=new JSONObject();
+        JSONObject params = new JSONObject();
         params.put("appId", appId);
         params.put("timestamp", timestamp);
         params.put("nonce", randNumber);
         params.put("signMethod", "SHA256");
         params.put("signature", signature);
-        try{
-            HttpHeaders httpHeaders = new HttpHeaders();
-            httpHeaders.set("Content-Type","application/json;charset=UTF-8");
-            httpHeaders.set("Accept","application/json");
 
+        try {
+            HttpHeaders httpHeaders = new HttpHeaders();
+            httpHeaders.set("Content-Type", "application/json;charset=UTF-8");
+            httpHeaders.set("Accept", "application/json");
             // 请求
-            HttpEntity<String> httpEntity = new HttpEntity<>(params.toString(), httpHeaders);
+            HttpEntity<JSONObject> httpEntity = new HttpEntity<>(params, httpHeaders);
             ResponseEntity<String> response = restTemplate.postForEntity(accessTokenUrl, httpEntity, String.class);
             JSONObject resp = JSONObject.parseObject(response.getBody());
-            if ("20000000".equals(resp.getString("errCode"))) {
+
+            if ("0000".equals(resp.getString("errCode"))) {
                 String token = resp.getString("accessToken");
                 int expiresIn = resp.getIntValue("expiresIn"); //失效时间
                 Map<String, String> map = new HashMap<>();
-                map.put(UNION_PAY_MAP, "OPEN-ACCESS-TOKEN AccessToken=\""+token+"\", appId=\""+appId+"\"");
+                map.put(UNION_PAY_MAP, "OPEN-ACCESS-TOKEN AccessToken=\"" + token + "\", appId=\"" + appId + "\"");
                 redisTemplate.opsForHash().putAll(UNION_PAY_ACCESS_TOKEN_KEY, map);
-                redisTemplate.expire(UNION_PAY_ACCESS_TOKEN_KEY, expiresIn-30, TimeUnit.SECONDS);
+                redisTemplate.expire(UNION_PAY_ACCESS_TOKEN_KEY, expiresIn - 30, TimeUnit.SECONDS);
                 return token;
             } else {
-                throw new SystemException("获取银联Token异常["+resp.getString("errCode")+":"+
-                        resp.getString("errInfo")+"]");
+                throw new SystemException("获取银联Token异常[" + resp.getString("errCode") + ":" +
+                        resp.getString("errInfo") + "]");
             }
-        }catch(Exception e){
-            LOGGER.error("获取银联Token异常",e);
-            throw new RuntimeException("获取银联Token异常,请重试!",e);
+
+        } catch (Exception e) {
+            LOGGER.error("获取银联Token异常", e);
+            throw new SystemException("获取银联Token异常,请重试!");
         }
+
     }
+
+
 }

+ 13 - 0
src/main/java/com/ydtech/modules/admin/controller/AlipayController.java

@@ -3,6 +3,7 @@ package com.ydtech.modules.admin.controller;
 import com.alipay.api.AlipayApiException;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.exception.SystemException;
+import com.ydtech.modules.admin.components.UnionPayRequestApiComponent;
 import com.ydtech.modules.admin.model.SysUser;
 import com.ydtech.modules.admin.model.vo.*;
 import com.ydtech.modules.admin.service.AlipayService;
@@ -15,6 +16,7 @@ import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import me.chanjar.weixin.common.error.WxErrorException;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 @Api(tags = "支付宝业务")
@@ -60,4 +62,15 @@ public class AlipayController extends BaseController {
         AssertionUtils.isStringEmpty(alipayId, "未绑定支付宝");
         return HttpResult.ok();
     }
+
+    @Autowired
+    private UnionPayRequestApiComponent unionPayRequestApiComponent;
+
+    @GetMapping(value = "/test")
+    public HttpResult<Object> test() {
+        unionPayRequestApiComponent.invokeToken();
+        return HttpResult.ok();
+    }
+
+
 }

+ 14 - 1
src/main/java/com/ydtech/modules/admin/controller/financialReceivables/FinancialReceivablesController.java

@@ -47,12 +47,25 @@ public class FinancialReceivablesController {
         return HttpResult.ok(insPlyIncomeService.queryDateByType(financialReceivablesQueryVo));
     }
 
+    /**
+     *  @version
+     *  @author: whp
+     *  @Date: 2024/8/7 9:20
+     *  @Description:  私有 车险
+     */
+    @PostMapping("/queryPrivateCar")
+    @ApiModelProperty(value = "私有车险列表")
+    public HttpResult<FinancialReceivablesAllVo> queryPrivateCar(@RequestBody FinancialReceivablesQueryVo financialReceivablesQueryVo) {
+        return HttpResult.ok(insPlyIncomeService.queryPrivateCar(financialReceivablesQueryVo));
+    }
+
 
     @PostMapping("/queryDateByTypeByMonth")
-    @ApiModelProperty(value = "获取平台私有数据列表")
+    @ApiModelProperty(value = "获取详情列表")
     public HttpResult<FinancialReceivablesAllMonthVo> queryDateByTypeByMonth(@RequestBody FinancialReceivablesQueryMonthVo financialReceivablesQueryVo) {
         return HttpResult.ok(insPlyIncomeService.queryDateByTypeByMonth(financialReceivablesQueryVo));
     }
+
     /**
      *
      * @param insPlyIncomeVo

+ 2 - 2
src/main/java/com/ydtech/modules/admin/model/report/financialReceivables/FinancialReceivablesAllMonthVo.java

@@ -31,12 +31,12 @@ public class FinancialReceivablesAllMonthVo {
     private  String  wsSumAmount;
 
     @ApiModelProperty("数据列表")
-    private List<FinancialReceivablesMonthVo> list =new ArrayList<>();
+    private List<FinancialReceivablesMonthSignleVo> list =new ArrayList<>();
 
     public FinancialReceivablesAllMonthVo() {
     }
 
-    public FinancialReceivablesAllMonthVo(String ysSumAmount, String  yisSumAmount,String  wsSumAmount,  String yearAndMonth, List<FinancialReceivablesMonthVo> list) {
+    public FinancialReceivablesAllMonthVo(String ysSumAmount, String  yisSumAmount,String  wsSumAmount,  String yearAndMonth, List<FinancialReceivablesMonthSignleVo> list) {
         this.ysSumAmount = ysSumAmount;
         this.yisSumAmount = yisSumAmount;
         this.wsSumAmount = wsSumAmount;

+ 23 - 0
src/main/java/com/ydtech/modules/admin/model/report/financialReceivables/FinancialReceivablesMonthSignleVo.java

@@ -0,0 +1,23 @@
+package com.ydtech.modules.admin.model.report.financialReceivables;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Data
+@ApiModel("应收月份查询参数")
+public class FinancialReceivablesMonthSignleVo {
+
+    @ApiModelProperty("公司名称")
+    private  String  companyName;
+
+    @ApiModelProperty("地区名称")
+    private  String  areaName;
+
+
+    @ApiModelProperty("数据列表")
+    private List<FinancialReceivablesMonthVo> list =new ArrayList<>();
+}

+ 46 - 2
src/main/java/com/ydtech/modules/admin/model/report/financialReceivables/FinancialReceivablesMonthVo.java

@@ -4,6 +4,10 @@ package com.ydtech.modules.admin.model.report.financialReceivables;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  *  @version 
@@ -13,6 +17,7 @@ import lombok.Data;
  */
 @Data
 @ApiModel("应收月份返回参数")
+@NoArgsConstructor
 public class FinancialReceivablesMonthVo {
 
     @ApiModelProperty("年份")
@@ -27,10 +32,10 @@ public class FinancialReceivablesMonthVo {
     @ApiModelProperty("应收")
     private String  commissionFeevalue;
 
-    @ApiModelProperty("收")
+    @ApiModelProperty("收")
     private String  noInvoicCommissionFeevalue;
 
-    @ApiModelProperty("收")
+    @ApiModelProperty("收")
     private String  readyCommissionFeevalue;
 
     @ApiModelProperty("开票未结算")
@@ -39,4 +44,43 @@ public class FinancialReceivablesMonthVo {
     @ApiModelProperty("未开票金额")
     private String  noSettlementAmount;
 
+    @ApiModelProperty("手续费应收")
+    private String  handlingReceivable;
+
+    @ApiModelProperty("跟单应收")
+    private String  documentaryReceivable;
+
+    @ApiModelProperty("合作公司id")
+    private String  partnerCompaniesId;
+
+    @ApiModelProperty("地区编号")
+    private String  subPartnerCompaniesId;
+
+    @ApiModelProperty("保险公司名称")
+    private String  insuranceCompany;
+
+
+    @ApiModelProperty("未开票手续费")
+    private String  unlicensedHandlingFee;
+
+    @ApiModelProperty("未结算手续费")
+    private String  unsettledHandlingFees;
+
+    @ApiModelProperty("是否是手续费")
+    private String  isHand;
+
+
+
+
+    public FinancialReceivablesMonthVo(String yearAndMonth, String companyName, String areaName, String commissionFeevalue, String noInvoicCommissionFeevalue, String readyCommissionFeevalue, String settlementAmount, String noSettlementAmount) {
+        this.yearAndMonth = yearAndMonth;
+        this.companyName = companyName;
+        this.areaName = areaName;
+        this.commissionFeevalue = commissionFeevalue;
+        this.noInvoicCommissionFeevalue = noInvoicCommissionFeevalue;
+        this.readyCommissionFeevalue = readyCommissionFeevalue;
+        this.settlementAmount = settlementAmount;
+        this.noSettlementAmount = noSettlementAmount;
+    }
+
 }

+ 3 - 0
src/main/java/com/ydtech/modules/admin/model/report/financialReceivables/FinancialReceivablesQueryMonthVo.java

@@ -26,4 +26,7 @@ public class FinancialReceivablesQueryMonthVo {
 
     @ApiModelProperty("前台不需要传递后台使用")
     private String endDate;
+
+    @ApiModelProperty("是否是非车")
+    private String isNoCar;
 }

+ 4 - 0
src/main/java/com/ydtech/modules/admin/model/report/financialReceivables/FinancialReceivablesQueryVo.java

@@ -26,4 +26,8 @@ public class FinancialReceivablesQueryVo {
 
     @ApiModelProperty("前台不需要传递后台使用")
     private String endDate;
+
+    @ApiModelProperty("是否是非车  0  不是 1 是")
+    private String  isNotCar;
+
 }

+ 7 - 0
src/main/java/com/ydtech/modules/admin/service/impl/SysAmountAuditingServiceImpl.java

@@ -387,6 +387,13 @@ public class SysAmountAuditingServiceImpl extends ServiceImpl<SysAmountAuditingM
         if(StringUtils.isNotEmpty(sysAmountAuditingVo.getLeaderName())){
             params.put("leaderName",sysAmountAuditingVo.getLeaderName());
         }
+        if(StringUtils.isNotEmpty(sysAmountAuditingVo.getStartAuditingTime())){
+            params.put("startAuditingTime",sysAmountAuditingVo.getStartAuditingTime());
+        }
+        if(StringUtils.isNotEmpty(sysAmountAuditingVo.getEndAuditingTime())){
+            params.put("endAuditingTime",sysAmountAuditingVo.getEndAuditingTime());
+        }
+
         List<SysAmountAuditingEntity> list = baseMapper.queryPageOrderNew(params);
         return list;
     }

+ 60 - 0
src/main/java/com/ydtech/modules/admin/utils/UnionPayUtils.java

@@ -0,0 +1,60 @@
+package com.ydtech.modules.admin.utils;
+
+import java.nio.charset.StandardCharsets;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.Random;
+
+public class UnionPayUtils {
+
+
+    /**
+     * 生成定长的随机数
+     *
+     * @param length
+     * @return
+     */
+    public static String createData(int length) {
+        StringBuilder sb = new StringBuilder();
+        Random rand = new Random();
+        for (int i = 0; i < length; i++) {
+            sb.append(rand.nextInt(10));
+        }
+        return sb.toString();
+    }
+
+    /**
+     * SHA256算法
+     *
+     * @param value 需要加密的值
+     * @return 加密后的字符
+     */
+    public static String SHA256(String value) {
+        try {
+            // 创建SHA-256哈希算法的MessageDigest对象
+            MessageDigest sha256 = MessageDigest.getInstance("SHA-256");
+
+            // 使用SHA-256计算字符串的哈希值
+            byte[] hash = sha256.digest(value.getBytes(StandardCharsets.UTF_8));
+
+            // 将哈希值转换为十六进制字符串
+            StringBuilder hexString = new StringBuilder();
+            for (byte b : hash) {
+                String hex = Integer.toHexString(0xff & b);
+                if (hex.length() == 1) {
+                    hexString.append('0');
+                }
+                hexString.append(hex);
+            }
+            return hexString.toString();
+        } catch (NoSuchAlgorithmException e) {
+            e.printStackTrace();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        return "ERROR";
+    }
+
+
+}

+ 4 - 0
src/main/java/com/ydtech/modules/fnc/controller/CarSettleController.java

@@ -91,9 +91,12 @@ public class CarSettleController extends BaseController {
     public HttpResult auditFee(@RequestBody @Valid AuditOrderFeeVo auditOrderFeeVo) {
 //        订单号
         String orderNo = auditOrderFeeVo.getOrderNo();
+        String insOrderNo = auditOrderFeeVo.getInsOrderNo();
+
         //查询改订单是已审核
         List<InsFeeAudit> feeList = insFeeAuditService.lambdaQuery()
                 .eq(InsFeeAudit::getOrderno, orderNo)
+                .eq(InsFeeAudit::getInsOrderNo, insOrderNo)
                 .eq(InsFeeAudit::getAuditstatus, FeeAuditAuditstatus.PASSED.getCode())
                 .list();
 
@@ -104,6 +107,7 @@ public class CarSettleController extends BaseController {
         //查询已承保的子订单号
         List<InsAreaCompany> areaList = insAreaCompanyService.lambdaQuery()
                 .eq(StringUtils.isNotEmpty(orderNo), InsAreaCompany::getOrderno, orderNo)
+                .eq(StringUtils.isNotEmpty(insOrderNo),InsAreaCompany::getId,insOrderNo)
                 .eq(InsAreaCompany::getOrderstatus, InsOrderStatusEnum.ACCEPT_INSURANCE.getCode())
                 .list();//3已承保
 

+ 12 - 3
src/main/java/com/ydtech/modules/fnc/controller/InsPlyIncomeController.java

@@ -3,17 +3,16 @@ package com.ydtech.modules.fnc.controller;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.modules.base.controller.BaseController;
 import com.ydtech.modules.fnc.dto.PlatformSettlementRecordDto;
-import com.ydtech.modules.fnc.dto.SumAllAmountSettlementDto;
 import com.ydtech.modules.fnc.entity.InsPlyIncome;
 import com.ydtech.modules.fnc.entity.SettlementDocumentaryFeesEntity;
 import com.ydtech.modules.fnc.service.ImportAsyncService;
 import com.ydtech.modules.fnc.service.InsPlyIncomeService;
+import com.ydtech.modules.fnc.vo.InsPlyIncomeIdsVo;
 import com.ydtech.modules.fnc.vo.InsPlyIncomeVo;
 import com.ydtech.modules.inv.model.dto.InsBxNoPlyIncomeExcelDto;
 import com.ydtech.modules.inv.model.dto.InsBxOtherExcelDto;
 import com.ydtech.modules.inv.model.dto.InsBxPlyIncomeExcelDto;
 import com.ydtech.modules.inv.model.dto.InsNoBxOtherExcelDto;
-import com.ydtech.modules.inv.utils.EasyExcelUtils;
 import com.ydtech.modules.order.entity.BasePageResult;
 import com.ydtech.utils.SnowFlakeUtil;
 import com.ydtech.utils.StringUtils;
@@ -28,7 +27,6 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
 import java.io.IOException;
-import java.io.InputStream;
 import java.time.Period;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -501,6 +499,17 @@ public class InsPlyIncomeController extends BaseController {
     public HttpResult<List<HashMap<String,Object>>> monthTotalReceivables(@RequestBody InsPlyIncomeVo insPlyIncomeVo) {
         return insPlyIncomeService.monthTotalReceivables(insPlyIncomeVo);
     }
+
+    /**
+     *  添加修正数据的逻辑
+     * @param
+     * @return
+     */
+    @PostMapping("/createData")
+    @ApiModelProperty(value = "添加修正数据的逻辑")
+    public HttpResult<List<InsPlyIncome>> createData(@RequestBody InsPlyIncomeIdsVo insPlyIncomeIdsVo) {
+        return insPlyIncomeService.createData(insPlyIncomeIdsVo);
+    }
 }
 
 

+ 10 - 2
src/main/java/com/ydtech/modules/fnc/dao/InsPlyIncomeMapper.java

@@ -177,12 +177,20 @@ public interface InsPlyIncomeMapper extends BaseMapper<InsPlyIncome> {
      *  @Date: 2024/8/5 10:06
      *  @Description:  查询月份的统计数据
      */
-    FinancialReceivablesAllMonthVo queryDateByTypeByMonth(FinancialReceivablesQueryMonthVo financialReceivablesQueryVo);
+    FinancialReceivablesAllMonthVo queryDateByTypeByMonth(@Param("vo") FinancialReceivablesQueryMonthVo financialReceivablesQueryVo);
     /**
      *  @version
      *  @author: hxl
      *  @Date: 2024/8/5 10:32
      *  @Description:  查询月份统计集合数据
      */
-    List<FinancialReceivablesMonthVo> queryDateByTypeByMonthList(FinancialReceivablesQueryMonthVo financialReceivablesQueryVo);
+    List<FinancialReceivablesMonthVo> queryDateByTypeByMonthList(@Param("vo") FinancialReceivablesQueryMonthVo financialReceivablesQueryVo);
+
+    List<FinancialReceivablesMonthVo> queryDateByTypeByMonthOtherList(@Param("vo") FinancialReceivablesQueryMonthVo financialReceivablesQueryVo);
+
+    List<FinancialReceivablesMonthVo> queryPlatHanding(@Param("vo") FinancialReceivablesQueryMonthVo financialReceivablesQueryVo);
+
+
+    List<FinancialReceivablesVo> queryPrivateCar(@Param("vo") FinancialReceivablesQueryVo financialReceivablesQueryVo);
+
 }

+ 17 - 0
src/main/java/com/ydtech/modules/fnc/service/InsPlyIncomeService.java

@@ -10,6 +10,7 @@ import com.ydtech.modules.fnc.dto.PlatformSettlementRecordDto;
 import com.ydtech.modules.fnc.entity.InsAreaCompany;
 import com.ydtech.modules.fnc.entity.InsPlyIncome;
 import com.ydtech.modules.fnc.entity.SettlementDocumentaryFeesEntity;
+import com.ydtech.modules.fnc.vo.InsPlyIncomeIdsVo;
 import com.ydtech.modules.fnc.vo.InsPlyIncomeVo;
 import com.ydtech.modules.order.entity.BasePageResult;
 import com.ydtech.modules.order.entity.InsOrders;
@@ -195,4 +196,20 @@ public interface InsPlyIncomeService extends IService<InsPlyIncome> {
      *  @Description:
      */
     FinancialReceivablesAllMonthVo queryDateByTypeByMonth(FinancialReceivablesQueryMonthVo financialReceivablesQueryVo);
+    /**
+     *  @version
+     *  @author: whp
+     *  @Date: 2024/8/7 9:20
+     *  @Description:  私有 车险
+     */
+    FinancialReceivablesAllVo queryPrivateCar(FinancialReceivablesQueryVo financialReceivablesQueryVo);
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/8/7 11:20
+     *  @Description: 添加修正协议修改类型重新生成数据的逻辑
+     */
+    HttpResult<List<InsPlyIncome>> createData(InsPlyIncomeIdsVo insPlyIncomeIdsVo);
+
 }

+ 10 - 6
src/main/java/com/ydtech/modules/fnc/service/impl/InsFeeAuditServiceImpl.java

@@ -816,7 +816,9 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
     @Override
     public InsFeeAudit saveDefaultInsFeeAuditAndHistory(String orderNo, String insOrderNo, String auditstatus, String rejectInfo) {
         //查询费用审核表
-        InsFeeAudit insFeeAudit = getOne(new LambdaQueryWrapper<InsFeeAudit>().eq(InsFeeAudit::getOrderno, orderNo));
+        InsFeeAudit insFeeAudit = getOne(new LambdaQueryWrapper<InsFeeAudit>()
+                .eq(InsFeeAudit::getOrderno, orderNo)
+                .eq(InsFeeAudit::getInsOrderNo, insOrderNo));
 
         //添加审核轨迹表
         InsFeeAuditHistory insFeeAuditHistory = new InsFeeAuditHistory();
@@ -829,16 +831,18 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
             this.save(insFeeAudit);
         } else {
             //状态码为已审核且数据不为空,则更新审核状态
-            //如果传入的为审核驳回 则将审核状态至为0
-            if(auditstatus.equals("2")) {
-                insFeeAudit.setAuditstatus("0");
-            }else{
+            //如果审核状态为已审核则一直都是已审核
+            if(insFeeAudit.getAuditstatus().equals("1")) {
                 insFeeAudit.setAuditstatus(insFeeAudit.getAuditstatus());
+            }else{
+                insFeeAudit.setAuditstatus(auditstatus);
             }
             insFeeAudit.setAudituser(BaseController.getUser().getName());
             insFeeAudit.setAudittime(LocalDateTime.now());
             insFeeAudit.setRejectinfo(rejectInfo);
-            this.update(insFeeAudit, new LambdaUpdateWrapper<InsFeeAudit>().eq(InsFeeAudit::getOrderno, orderNo));
+            this.update(insFeeAudit, new LambdaUpdateWrapper<InsFeeAudit>()
+                    .eq(InsFeeAudit::getOrderno, orderNo)
+                    .eq(InsFeeAudit::getInsOrderNo, insOrderNo));
         }
         //复制审核对象的属性
         BeanUtils.copyProperties(insFeeAudit, insFeeAuditHistory);

+ 188 - 12
src/main/java/com/ydtech/modules/fnc/service/impl/InsPlyIncomeServiceImpl.java

@@ -4,6 +4,8 @@ import cn.afterturn.easypoi.excel.entity.ExportParams;
 import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
+import com.alipay.api.domain.VehicleIovData;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.github.pagehelper.PageHelper;
@@ -17,10 +19,12 @@ import com.ydtech.modules.admin.utils.SliceUpDateUtil;
 import com.ydtech.modules.base.controller.BaseController;
 import com.ydtech.modules.esm.model.EsmInsCompany;
 import com.ydtech.modules.esm.service.EsmInsCompanyService;
+import com.ydtech.modules.fnc.dao.FncInsAreaCompanyMapper;
 import com.ydtech.modules.fnc.dao.InsPlyIncomeMapper;
 import com.ydtech.modules.fnc.dto.PlatformSettlementRecordDto;
 import com.ydtech.modules.fnc.entity.*;
 import com.ydtech.modules.fnc.service.*;
+import com.ydtech.modules.fnc.vo.InsPlyIncomeIdsVo;
 import com.ydtech.modules.fnc.vo.InsPlyIncomeVo;
 import com.ydtech.modules.fnc.vo.SettlementDocumentaryFeesVo;
 import com.ydtech.modules.ins.model.vo.res.*;
@@ -61,6 +65,8 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.math.BigDecimal;
+import java.math.MathContext;
+import java.math.RoundingMode;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
@@ -70,6 +76,8 @@ import java.time.LocalTime;
 import java.time.YearMonth;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
+import java.util.function.Function;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -115,6 +123,9 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
     @Value("${upload.file.url}")
     private String uploadUrl;
 
+    @Autowired
+    private FncInsAreaCompanyMapper fncInsAreaCompanyMapper;
+
 
     public HttpResult<BasePageResult<InsPlyIncome>> queryplyIncome(InsPlyIncomeVo insPlyIncomeVo) {
 
@@ -192,6 +203,7 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         insPlyIncome.setJqEndDate(StringOperations.emptyStringToNull(insAreaCompany.getJqEndDate()));
         insPlyIncome.setSyStartDate(StringOperations.emptyStringToNull(insAreaCompany.getSyStartDate()));
         insPlyIncome.setSyEndDate(StringOperations.emptyStringToNull(insAreaCompany.getSyEndDate()));
+        insPlyIncome.setReceivableAmount(insFeeOrderNew.getNoOtherCostsPremiums());
         insPlyIncome.setAllFeeValue(insFeeOrderNew.getNoOtherCostsPremiums());
         insPlyIncome.setNoOtherCostsPremium(insFeeOrderNew.getNoOtherCostsPremiums());
         insPlyIncome.setNoOtherCostsProportion(insFeeOrderNew.getNoOtherCostsProportion());
@@ -216,7 +228,6 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         if (StringUtils.isNotEmpty(noPolicyno)) {
             insPlyIncome.setNoPolicyno(noPolicyno); // 非车保单号
         }
-
 //        insPlyIncome.setDeptId(insFeeOrderNew.getDeptId());
         //add by hxl  2024-07-31  修改插入结算表中险种信息错误的bug  将大订单中的险种信息改为小订单的险种信息
         this.saveRiskCode(insAreaCompany.getProductid(), insPlyIncome);
@@ -245,7 +256,7 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         insPlyIncome.setNoSuperviseCostsProportion(insFeeOrderNew.getNoSuperviseCostsProportion());
         this.getDeptId(insPlyIncome);
         this.saveByCompanyId(insFeeOrderNew, insAreaCompany.getCompanyId(), insPlyIncome);
-
+        insPlyIncome.setReceivableAmount(insFeeOrderNew.getNoSuperviseCostsPremiums());
         baseMapper.insert(insPlyIncome);
         InsPlyIncomeLog insPlyIncomeLog = new InsPlyIncomeLog();
         insPlyIncomeLog.setIncomeId(insPlyIncome.getId());
@@ -309,6 +320,7 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         insPlyIncome.setSyEndDate(StringOperations.emptyStringToNull(insAreaCompany.getSyEndDate()));
         insPlyIncome.setUserId(insFeeOrderNew.getUserId());
         insPlyIncome.setInsuredName(order.getInsuredname());
+        insPlyIncome.setReceivableAmount(otherAmount);
         this.getDeptId(insPlyIncome);
         this.saveByCompanyId(insFeeOrderNew, insAreaCompany.getCompanyId(), insPlyIncome);
 
@@ -354,6 +366,7 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         insPlyIncome.setJqEndDate(StringOperations.emptyStringToNull(insAreaCompany.getJqEndDate()));
         insPlyIncome.setSyStartDate(StringOperations.emptyStringToNull(insAreaCompany.getSyStartDate()));
         insPlyIncome.setSyEndDate(StringOperations.emptyStringToNull(insAreaCompany.getSyEndDate()));
+        insPlyIncome.setReceivableAmount(handlingAmount);
         this.saveByCompanyId(insFeeOrderNew, insAreaCompany.getCompanyId(), insPlyIncome);
         this.getDeptId(insPlyIncome);
         baseMapper.insert(insPlyIncome);
@@ -3302,6 +3315,35 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
 
         return new FinancialReceivablesAllVo(ptSumAmount.toString(),sySumAmount.toString(),year+"",list);
     }
+    /**
+     *  @version
+     *  @author: whp
+     *  @Date: 2024/8/7
+     *  @Description:  私有 车险
+     */
+    @Override
+    public FinancialReceivablesAllVo queryPrivateCar(FinancialReceivablesQueryVo financialReceivablesQueryVo) {
+        int year =0;
+        if(StringUtils.isBlank(financialReceivablesQueryVo.getYear())){
+            Calendar cale = Calendar.getInstance();
+            year = cale.get(Calendar.YEAR);
+        }else{
+            year = Integer.parseInt(financialReceivablesQueryVo.getYear());
+        }
+
+        FinancialReceivablesAllVo resultVo = new FinancialReceivablesAllVo();
+//      私有总金额
+        financialReceivablesQueryVo.setBeginDate(SliceUpDateUtil.getYearBeginDateStr(year)+" 00:00:00");
+        financialReceivablesQueryVo.setEndDate(SliceUpDateUtil.getYearEndDateStr(year)+" 23:59:59");
+//      私有应收
+        BigDecimal syAmount = baseMapper.queryDateByTypeSumAmount(financialReceivablesQueryVo);
+        resultVo.setSySumAmount(syAmount.toString());
+        resultVo.setYear(year+"");
+
+        List<FinancialReceivablesVo> result=  baseMapper.queryPrivateCar(financialReceivablesQueryVo);
+        resultVo.setList(result);
+        return resultVo;
+    }
     /**
      *  @version
      *  @author: hxl
@@ -3311,30 +3353,164 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
     @Override
     public FinancialReceivablesAllMonthVo queryDateByTypeByMonth(FinancialReceivablesQueryMonthVo financialReceivablesQueryVo) {
         //检查参数
-        if(StringUtils.isBlank(financialReceivablesQueryVo.getType())){
+        if (StringUtils.isBlank(financialReceivablesQueryVo.getType())) {
             throw new SystemException("应收类型不能为空,1为平台2为私有,默认传1");
         }
         //检查参数
-        if(StringUtils.isBlank(financialReceivablesQueryVo.getYearAndMonth())){
+        if (StringUtils.isBlank(financialReceivablesQueryVo.getYearAndMonth())) {
             throw new SystemException("月份不能为空");
         }
         String yearAndMonth = financialReceivablesQueryVo.getYearAndMonth();
         int year = Integer.parseInt(yearAndMonth.split("-")[0]);
         int month = Integer.parseInt(yearAndMonth.split("-")[1]);
 
-        financialReceivablesQueryVo.setBeginDate(SliceUpDateUtil.getStartOfMonth(year,month));
-        financialReceivablesQueryVo.setEndDate(SliceUpDateUtil.getEndOfMonth(year,month));
+        financialReceivablesQueryVo.setBeginDate(SliceUpDateUtil.getStartOfMonth(year, month));
+        financialReceivablesQueryVo.setEndDate(SliceUpDateUtil.getEndOfMonth(year, month));
         //查询总数
-        FinancialReceivablesAllMonthVo  vo= baseMapper.queryDateByTypeByMonth(financialReceivablesQueryVo);
+        FinancialReceivablesAllMonthVo vo = baseMapper.queryDateByTypeByMonth(financialReceivablesQueryVo);
+//      第二层数据
+        List<FinancialReceivablesMonthSignleVo> resultData = vo.getList();
         vo.setYearAndMonth(yearAndMonth);
-        //查询列表
-        List<FinancialReceivablesMonthVo> list = baseMapper.queryDateByTypeByMonthList(financialReceivablesQueryVo);
 
-        //按区域
-        //if()
+        HashMap<String, BigDecimal> amountMap;
+        if ("2".equals(financialReceivablesQueryVo.getType())) {
+             amountMap = this.privateSett(resultData, financialReceivablesQueryVo);
+        } else {
+             amountMap = this.platformSett(resultData, financialReceivablesQueryVo);
+        }
+        vo.setYisSumAmount(amountMap.get("yishouAmount").toString());
+        vo.setYsSumAmount(amountMap.get("yinshouAmount").toString());
+        vo.setWsSumAmount(amountMap.get("weishouAmount").toString());
+        return vo;
+    }
+
 
 
+    private HashMap<String, BigDecimal> platformSett(List<FinancialReceivablesMonthSignleVo> resultData, FinancialReceivablesQueryMonthVo financialReceivablesQueryVo) {
+        List<BigDecimal> yinShouAmountList = new ArrayList<>();
+        List<BigDecimal> yishouAmountList = new ArrayList<>();
+        List<BigDecimal> weishouAmountList = new ArrayList<>();
 
-        return null;
+        BigDecimal yinshouAmount = new BigDecimal("0.00");
+        BigDecimal yishouAmount = new BigDecimal("0.00");
+        BigDecimal weishouAmount = new BigDecimal("0.00");
+
+        HashMap<String, BigDecimal> resultMap = new HashMap<>();
+
+
+        //平台手续费
+        List<FinancialReceivablesMonthVo> handList = baseMapper.queryPlatHanding(financialReceivablesQueryVo);
+
+        Map<String, FinancialReceivablesMonthVo> collect = handList.stream().collect(Collectors.toMap(FinancialReceivablesMonthVo::getPartnerCompaniesId, Function.identity()));
+
+        handList.stream().filter(item -> collect.containsKey(item.getPartnerCompaniesId()))
+                .forEach(item ->{
+                    FinancialReceivablesMonthVo otherItem = collect.get(item.getPartnerCompaniesId());
+
+                    FinancialReceivablesMonthSignleVo financialReceivablesMonthSignleVo = new FinancialReceivablesMonthSignleVo();
+                    List<FinancialReceivablesMonthVo> financialReceivablesMonthVos = financialReceivablesMonthSignleVo.getList();
+                    financialReceivablesMonthSignleVo.setCompanyName(item.getCompanyName());
+                    financialReceivablesMonthSignleVo.setAreaName(item.getAreaName());
+                    financialReceivablesMonthVos.add(otherItem);
+                    financialReceivablesMonthVos.add(item);
+                    if("合计".equals(item.getIsHand())){
+                        yinShouAmountList.add(this.stringToBigdecimal(item.getCommissionFeevalue()));
+                        yishouAmountList.add(this.stringToBigdecimal(item.getReadyCommissionFeevalue()));
+                        weishouAmountList.add(this.stringToBigdecimal(item.getNoInvoicCommissionFeevalue()));
+
+                    }
+                    resultData.add(financialReceivablesMonthSignleVo);
+                });
+        yinshouAmount = yinshouAmount.add(yinShouAmountList.stream().reduce(BigDecimal.ZERO, BigDecimal::add));
+        yishouAmount = yishouAmount.add(yishouAmountList.stream().reduce(BigDecimal.ZERO, BigDecimal::add));
+        weishouAmount = weishouAmount.add(weishouAmountList.stream().reduce(BigDecimal.ZERO, BigDecimal::add));
+        resultMap.put("yinshouAmount",yinshouAmount);
+        resultMap.put("yishouAmount",yishouAmount);
+        resultMap.put("weishouAmount",weishouAmount);
+        return resultMap;
+
+    }
+
+    private HashMap<String, BigDecimal> privateSett(List<FinancialReceivablesMonthSignleVo> resultData, FinancialReceivablesQueryMonthVo financialReceivablesQueryVo) {
+        List<BigDecimal> yinShouAmountList = new ArrayList<>();
+        List<BigDecimal> yishouAmountList = new ArrayList<>();
+        List<BigDecimal> weishouAmountList = new ArrayList<>();
+
+        BigDecimal yinshouAmount = new BigDecimal("0.00");
+        BigDecimal yishouAmount = new BigDecimal("0.00");
+        BigDecimal weishouAmount = new BigDecimal("0.00");
+
+        HashMap<String, BigDecimal> resultMap = new HashMap<>();
+
+
+        //手续费未接应收
+        List<FinancialReceivablesMonthVo> list = baseMapper.queryDateByTypeByMonthList(financialReceivablesQueryVo);
+        //跟单统计
+        List<FinancialReceivablesMonthVo> otherList = baseMapper.queryDateByTypeByMonthOtherList(financialReceivablesQueryVo);
+
+        Map<String, FinancialReceivablesMonthVo> collect = otherList.stream().collect(Collectors.toMap(FinancialReceivablesMonthVo::getPartnerCompaniesId, Function.identity()));
+        list.stream()
+                .filter(item -> collect.containsKey(item.getPartnerCompaniesId()))
+                .forEach(
+                        item -> {
+                            FinancialReceivablesMonthVo otherItem = collect.get(item.getPartnerCompaniesId());
+                            FinancialReceivablesMonthSignleVo financialReceivablesMonthSignleVo = new FinancialReceivablesMonthSignleVo();
+                            List<FinancialReceivablesMonthVo> financialReceivablesMonthVos = financialReceivablesMonthSignleVo.getList();
+                            financialReceivablesMonthSignleVo.setCompanyName(item.getCompanyName());
+                            financialReceivablesMonthSignleVo.setAreaName(item.getAreaName());
+//                          合计信息
+                            FinancialReceivablesMonthVo financialReceivablesMonthVo = new FinancialReceivablesMonthVo();
+                            financialReceivablesMonthVo.setCommissionFeevalue(this.calculateTotal(this.stringToBigdecimal(item.getCommissionFeevalue()), new BigDecimal(otherItem.getCommissionFeevalue()), null).toString());
+                            financialReceivablesMonthVo.setNoInvoicCommissionFeevalue(this.calculateTotal(this.stringToBigdecimal(item.getNoInvoicCommissionFeevalue()), new BigDecimal(otherItem.getNoInvoicCommissionFeevalue()), null).toString());
+                            financialReceivablesMonthVo.setReadyCommissionFeevalue(this.calculateTotal(this.stringToBigdecimal(item.getReadyCommissionFeevalue()), new BigDecimal(otherItem.getReadyCommissionFeevalue()), null).toString());
+                            financialReceivablesMonthVo.setSettlementAmount(this.calculateTotal(this.stringToBigdecimal(item.getSettlementAmount()), new BigDecimal(otherItem.getSettlementAmount()), null).toString());
+                            financialReceivablesMonthVo.setNoSettlementAmount(this.calculateTotal(this.stringToBigdecimal(item.getNoSettlementAmount()), new BigDecimal(otherItem.getNoSettlementAmount()), null).toString());
+                            financialReceivablesMonthVo.setIsHand("合计");
+                            financialReceivablesMonthVos.add(otherItem);
+                            financialReceivablesMonthVos.add(item);
+                            financialReceivablesMonthVos.add(financialReceivablesMonthVo);
+                            yishouAmountList.add(this.stringToBigdecimal(financialReceivablesMonthVo.getReadyCommissionFeevalue()));
+                            yinShouAmountList.add(this.stringToBigdecimal(financialReceivablesMonthVo.getCommissionFeevalue()));
+                            weishouAmountList.add(this.stringToBigdecimal(financialReceivablesMonthVo.getNoInvoicCommissionFeevalue()));
+                            resultData.add(financialReceivablesMonthSignleVo);
+                        }
+                );
+        yinshouAmount = yinshouAmount.add(yinShouAmountList.stream().reduce(BigDecimal.ZERO, BigDecimal::add));
+        yishouAmount = yishouAmount.add(yishouAmountList.stream().reduce(BigDecimal.ZERO, BigDecimal::add));
+        weishouAmount = weishouAmount.add(weishouAmountList.stream().reduce(BigDecimal.ZERO, BigDecimal::add));
+        resultMap.put("yinshouAmount",yinshouAmount);
+        resultMap.put("yishouAmount",yishouAmount);
+        resultMap.put("weishouAmount",weishouAmount);
+        return resultMap;
+    }
+    private BigDecimal stringToBigdecimal(String value) {
+        return new BigDecimal(value).setScale(5, RoundingMode.DOWN);
+    }
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/8/7 11:20
+     *  @Description: 修正协议变动重新生成数据逻辑
+     */
+    @Override
+    public HttpResult<List<InsPlyIncome>> createData(InsPlyIncomeIdsVo insPlyIncomeIdsVo) {
+        if(insPlyIncomeIdsVo.getIds()==null || insPlyIncomeIdsVo.getIds().size()==0){
+            throw new SystemException("子订单id不能为空!!");
+        }
+        List<String> ids = insPlyIncomeIdsVo.getIds();
+        List<InsPlyIncome>  newList=new ArrayList<>();
+        for(String  subOrderId:ids){
+            //查询子订单对象   com.ydtech.modules.order.entity
+            InsAreaCompany insAreaCompany = fncInsAreaCompanyMapper.selectById(subOrderId);
+            //大订单对象
+            InsOrders order = insOrdersService.existOrder(insAreaCompany.getOrderno());
+
+            //获取该订单的费用
+            InsFeeOrderNew insFeeOrderNew = insFeeOrderNewService.getOne(new LambdaQueryWrapper<InsFeeOrderNew>()
+                    .eq(InsFeeOrderNew::getInsOrderNo, insAreaCompany.getId()));
+            saveBalanceNew(order, insFeeOrderNew,insAreaCompany) ;
+        }
+        return HttpResult.ok(newList);
     }
 }

+ 22 - 0
src/main/java/com/ydtech/modules/fnc/vo/InsPlyIncomeIdsVo.java

@@ -0,0 +1,22 @@
+package com.ydtech.modules.fnc.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/8/7 11:18
+ *  @Description:   修正数据vo
+ */
+@Data
+@ApiModel("修正数据vo")
+public class InsPlyIncomeIdsVo implements Serializable {
+
+    @ApiModelProperty("子订单id")
+    private List<String> ids;
+}

+ 13 - 0
src/main/java/com/ydtech/modules/ins/model/pingan/respose/PingAnQuoteRespVo.java

@@ -13,4 +13,17 @@ public class PingAnQuoteRespVo extends QuoteRespVo {
     // 小微险保费
     QuoteResponse.XwActualPremiumDTO xwActualPremium = new QuoteResponse.XwActualPremiumDTO();
 
+    /***
+     * 财意险
+     */
+    double cyPremium=0;
+    /***
+     *  小微险
+     */
+    double xwPremium=0;
+    /***
+     * 组合
+     */
+    double zhPremium=0;
+
 }

+ 3 - 0
src/main/java/com/ydtech/modules/ins/model/ya/YaQuoteInfoVo.java

@@ -51,6 +51,8 @@ public class YaQuoteInfoVo implements Serializable {
     @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private LocalDateTime startDate;
 
+    private String userid;
+
     public YaQuoteInfoVo() {
     }
 
@@ -62,6 +64,7 @@ public class YaQuoteInfoVo implements Serializable {
         this.riskList = JSON.parseArray(JSON.toJSONString(insOrders.getRisk()), RiskInfoVo.class);
         this.kindList = JSON.parseArray(JSON.toJSONString(insOrders.getKing()), KindInfoVo.class);
         this.quoteno = insOrders.getQuoteno();
+        //this.userid = insOrders.getUserid();
     }
 
 }

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

@@ -47,7 +47,7 @@ public class PingAnOrderApiController {
     @QuoteVerification("报价授权")
     @PostMapping("/quote")
     @ApiOperation("1报价-标的查询-车型查询-车辆确认-报价")
-    public HttpResult<QuoteRespVo> quote(@RequestBody PingAnQuoteVo<InsDrivingIntentionInsuranceSonVo> quoteVo) throws Exception {
+    public HttpResult<QuoteRespVo> quote(@RequestBody PingAnQuoteVo<Map<String,Object>> quoteVo) throws Exception {
         BaseQuoteInfoVo quoteInfo = this.insOrdersComponents.getQuoteInfo(quoteVo.getOrderNo(), quoteVo.getAgreementId());
         return this.pingAnOrderApiService.quote(quoteInfo, quoteVo);
     }

+ 6 - 0
src/main/java/com/ydtech/modules/order/entity/api/pingan/log/PinganApiLog.java

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
 
 import java.io.Serializable;
+import java.util.Date;
 
 /**
  * 
@@ -61,6 +62,11 @@ public class PinganApiLog implements Serializable {
      */
     private String responseType;
 
+    /***
+     * 创建时间
+     */
+    private Date createTime;
+
     @TableField(exist = false)
     private static final long serialVersionUID = 1L;
 

+ 29 - 12
src/main/java/com/ydtech/modules/order/entity/api/pingan/request/PayReturnRequest.java

@@ -3,6 +3,8 @@ package com.ydtech.modules.order.entity.api.pingan.request;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
+import java.io.Serializable;
+
 /**
  *  @version
  *  @author: hxl
@@ -25,7 +27,7 @@ public class PayReturnRequest extends PingAnBaseRequest {
     /***
      *O	备注
      */
-    private String remark;
+    private RemarkInfoDto remark;
 
 
     /***
@@ -66,16 +68,31 @@ public class PayReturnRequest extends PingAnBaseRequest {
     public PayReturnRequest() {
     }
 
-    public PayReturnRequest(String businessNo, String bankOrderNo, String remark, String paymentDate, String paymentSum, String payType, String paymentState, String resultMsg, String errorMsg, String signMsg) {
-        this.businessNo = businessNo;
-        this.bankOrderNo = bankOrderNo;
-        this.remark = remark;
-        this.paymentDate = paymentDate;
-        this.paymentSum = paymentSum;
-        this.payType = payType;
-        this.paymentState = paymentState;
-        this.resultMsg = resultMsg;
-        this.errorMsg = errorMsg;
-        this.signMsg = signMsg;
+    /***
+     * 车辆信息
+     */
+    @Data
+    public static class RemarkInfoDto implements Serializable {
+        /***
+         * C	实名认证标志(Y需要实名认证N不需要实名认证。默认为Y需要认证)
+         */
+        private String autonymAuthFlag;
+        /**
+         * M	缴费方式代码
+         * POS  移动POS机
+         * EPO  EPOS机
+         * WXP  微信
+         * ALP  支付宝
+         * SCP  银行卡快捷
+         * EBK  网银
+         * NCP  无卡
+         * PPY  预付费
+         */
+        private String appType;
+        /**
+         * C
+         * (江苏)缴费方式非支付宝、微信时(其他地区传支付宝或微信ID)	银行卡号
+         */
+        private String channelSourceCode;
     }
 }

+ 190 - 26
src/main/java/com/ydtech/modules/order/entity/api/pingan/request/QuoteRequest.java

@@ -1,10 +1,10 @@
 package com.ydtech.modules.order.entity.api.pingan.request;
 
+import cn.hutool.core.bean.BeanUtil;
 import com.ydtech.constants.enums.InsurKind;
 import com.ydtech.modules.ins.model.vo.KindInfoVo;
 import com.ydtech.modules.order.entity.InsOrders;
 import com.ydtech.modules.order.entity.api.pingan.response.CarConfirmResponse;
-import com.ydtech.modules.order.entity.api.pingan.response.SearchPAVehicleListResponse;
 import com.ydtech.modules.order.entity.api.pingan.utils.checkNull.CheckNotEmpty;
 import com.ydtech.modules.order.entity.api.pingan.utils.checkNull.FieldEmptyException;
 import com.ydtech.modules.order.entity.api.pingan.utils.checkNull.Validate;
@@ -13,12 +13,11 @@ import com.ydtech.modules.order.entity.config.PingAnConfigureParameters;
 import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
 import com.ydtech.modules.order.entity.vo.pingan.InsDrivingIntentionInsuranceSonVo;
 import lombok.Data;
-import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.collections4.CollectionUtils;
 
 import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
+import java.util.*;
+
 /**
  *  @version
  *  @author: hxl
@@ -454,6 +453,16 @@ public class QuoteRequest extends PingAnBaseRequest {
      */
     //@CheckNotEmpty(fieldName = "是否投保小微险", message = "是否投保小微险不能为空")
     private String applyXiaoWei;
+
+
+    /***
+     * 是否投保组合产品
+     * true,false
+     * M
+     */
+    //@CheckNotEmpty(fieldName = "是否投保组合产品", message = "是否投保组合产品不能为空")
+    private String applyCombination;
+
     /***
      * 财意险列表
      */
@@ -464,6 +473,13 @@ public class QuoteRequest extends PingAnBaseRequest {
      */
     //@CheckNotEmpty(fieldName = "小微险列表")
     private List<UnAutoListInfoDTO> xiaoWeiListInfo=new ArrayList<UnAutoListInfoDTO>();
+
+    /***
+     *  组合险种
+     */
+    private List<CombinationInfoDTO> combinationInfoList=new ArrayList<CombinationInfoDTO>();
+
+
     /***
      * 非车代理人编码
      * (投保车驾意,且需要使用网点自己的非车代理需要传入。如下协议、子协议号都需要传入。)
@@ -750,8 +766,12 @@ public class QuoteRequest extends PingAnBaseRequest {
      * 【自用充电桩设备信息列表,最多3个桩】
      */
     private List<Amount23XNYChargingPostListDTO> amount23XNYChargingPostList=new ArrayList<Amount23XNYChargingPostListDTO>();
+
+    public QuoteRequest() {
+    }
+
     //todo
-    public QuoteRequest(PingAnConfigureParameters parameters, BaseQuoteInfoVo quoteInfo, SearchPAVehicleListResponse.ModelsDto modelsDto, String flowid,String accommodationFlag,String applyUnAuto,String applyXiaoWei,List<UnAutoListInfoDTO> unAutoListInfo,List<UnAutoListInfoDTO> xiaoWeiListInfo,List<Amount22XNYChargingPostListDTO> amount22XNYChargingPostList, List<Amount23XNYChargingPostListDTO> amount23XNYChargingPostList) {
+    public QuoteRequest(PingAnConfigureParameters parameters, BaseQuoteInfoVo quoteInfo,String flowid,String accommodationFlag,List<Amount22XNYChargingPostListDTO> amount22XNYChargingPostList, List<Amount23XNYChargingPostListDTO> amount23XNYChargingPostList,Map<String,Object> jymap) {
         this.setUserId(parameters.getUserId());
         this.setFlowid(flowid);
         InsOrders insOrders = new InsOrders();
@@ -764,37 +784,137 @@ public class QuoteRequest extends PingAnBaseRequest {
         this.setApplyBiz(String.valueOf(map.get("syFlag")));
         this.bizQuote=bizQuoteDto;
         this.setAccommodationFlag(accommodationFlag);
-        this.setApplyUnAuto(applyUnAuto);
-        this.setApplyXiaoWei(applyXiaoWei);
-
-        this.setIsOnlineProducts("N");
+        //处理驾意险信息
+        List<UnAutoListInfoDTO> unAutoListInfoList = getUnAutoListInfoDTOS(jymap);
+        List<UnAutoListInfoDTO> xiaoWeiListInfoList = getXiaoWeiListInfoList(jymap);
+        List<CombinationInfoDTO> combinationInfoList = getCombinationInfoDTOS(jymap);
+        if(unAutoListInfoList!=null && unAutoListInfoList.size()>0){
+            this.setApplyUnAuto("true");
+        }else{
+            this.setApplyUnAuto("false");
+        }
+        if(xiaoWeiListInfoList!=null && xiaoWeiListInfoList.size()>0){
+            this.setApplyXiaoWei("true");
+        }else{
+            this.setApplyXiaoWei("false");
+        }
+        if(xiaoWeiListInfoList!=null && xiaoWeiListInfoList.size()>0){
+            this.setApplyXiaoWei("true");
+        }else{
+            this.setApplyXiaoWei("false");
+        }
+        if(combinationInfoList!=null && combinationInfoList.size()>0){
+            this.setApplyCombination("true");
+        }else{
+            this.setApplyCombination("false");
+        }
         // 财意险列表
+        this.setUnAutoListInfo(unAutoListInfoList);
         // 小微险列表
-        this.setUnAutoListInfo(unAutoListInfo);
-        this.setXiaoWeiListInfo(xiaoWeiListInfo);
+        this.setXiaoWeiListInfo(unAutoListInfoList);
+        // 组合险列表
+        this.setCombinationInfoList(combinationInfoList);
+        this.setIsOnlineProducts("N");
         this.setAmount22XNYChargingPostList(amount22XNYChargingPostList);
         this.setAmount23XNYChargingPostList(amount23XNYChargingPostList);
     }
     /**
      *  @version
      *  @author: hxl
-     *  @Date: 2024/7/19 16:17
-     *  @Description:  处理财意险列表、小微险列表、组合险
+     *  @Date: 2024/8/8 11:21
+     *  @Description: 获取驾意险的险种信息
+     */
+    public List<Map<String,Object>> getJsonList(Map<String,Object> map,Double cyPremium,Double xwPremium,Double zhPremium){
+        List<Map<String,Object>>  list=new ArrayList<Map<String,Object>>();
+        List<QuoteRequest.UnAutoListInfoDTO> unAutoListInfoList = getUnAutoListInfoDTOS(map);
+        List<QuoteRequest.UnAutoListInfoDTO> xiaoWeiListInfoList = getXiaoWeiListInfoList(map);
+        List<QuoteRequest.CombinationInfoDTO> combinationInfoList = getCombinationInfoDTOS(map);
+
+        //赋值驾意险信息
+        Map<String,Object> jyMap=new HashMap<>();
+        Map<String,Object> xwMap=new HashMap<>();
+        Map<String,Object> zhMap=new HashMap<>();
+        if(CollectionUtils.isNotEmpty(unAutoListInfoList)){
+            jyMap.put("sumAmount",cyPremium);
+            jyMap.put("list",unAutoListInfoList);
+        }
+        if(CollectionUtils.isNotEmpty(xiaoWeiListInfoList)){
+            xwMap.put("sumAmount",xwPremium);
+            xwMap.put("list",xiaoWeiListInfoList);
+        }
+        if(CollectionUtils.isNotEmpty(combinationInfoList)){
+            zhMap.put("sumAmount",zhPremium);
+            zhMap.put("list",combinationInfoList);
+        }
+        if(jyMap!=null && jyMap.size()>0){
+            list.add(jyMap);
+        }
+        if(xwMap!=null && xwMap.size()>0){
+            list.add(xwMap);
+        }
+        if(zhMap!=null && zhMap.size()>0){
+            list.add(zhMap);
+        }
+        return list;
+    }
+
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/8/8 11:06
+     *  @Description:  获取组合险信息
+     */
+    public static List<CombinationInfoDTO> getCombinationInfoDTOS(Map<String, Object> jymap) {
+        List<CombinationInfoDTO>  combinationInfoList=new ArrayList<>();
+        if(jymap !=null && jymap.get("2")!=null ){;
+            List<InsDrivingIntentionInsuranceSonVo> zhlist = (List<InsDrivingIntentionInsuranceSonVo>) jymap.get("2");
+            if(zhlist!=null && zhlist.size()>0){
+                for(InsDrivingIntentionInsuranceSonVo zhVo : zhlist ){
+                    CombinationInfoDTO combinationInfo =new CombinationInfoDTO(zhVo.getProductCode(),zhVo.getCode(),zhVo.getQuantity(),zhVo.getCombineProductType());
+                    combinationInfoList.add(combinationInfo);
+                }
+            }
+        }
+        return combinationInfoList;
+    }
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/8/8 11:05
+     *  @Description:  获取小微险信息
+     */
+    public static List<UnAutoListInfoDTO> getXiaoWeiListInfoList(Map<String, Object> jymap) {
+        List<UnAutoListInfoDTO>  xiaoWeiListInfoList=new ArrayList<>();
+        if(jymap !=null && jymap.get("1")!=null ){
+            LinkedHashMap<String,Object> linkedMap = (LinkedHashMap<String,Object>) jymap.get("1");
+            if(linkedMap!=null && linkedMap.size()>0){
+                InsDrivingIntentionInsuranceSonVo vo = BeanUtil.mapToBean(linkedMap, InsDrivingIntentionInsuranceSonVo.class, true);
+                UnAutoListInfoDTO unAutoListInfoDTO =new UnAutoListInfoDTO(vo.getProductCode(),vo.getCode(),vo.getQuantity());
+                xiaoWeiListInfoList.add(unAutoListInfoDTO);
+            }
+        }
+        return xiaoWeiListInfoList;
+    }
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/8/8 11:04
+     *  @Description: 获取财意险信息
      */
-    public QuoteRequest transYJPingAnRequestMsg(InsDrivingIntentionInsuranceSonVo vo, QuoteRequest quoteRequest, String type) {
-        //处理
+    public static List<UnAutoListInfoDTO> getUnAutoListInfoDTOS(Map<String, Object> jymap) {
         List<UnAutoListInfoDTO>  unAutoListInfoList=new ArrayList<>();
-        if(vo!=null && StringUtils.isNotBlank(vo.getProductCode()) ){
-              UnAutoListInfoDTO  unAutoListInfoDTO =new  UnAutoListInfoDTO(vo.getProductCode(),vo.getCode(),"1");
-              unAutoListInfoList.add(unAutoListInfoDTO);
-        }
-        if(unAutoListInfoList!=null && unAutoListInfoList.size()>0){
-            quoteRequest.setApplyUnAuto("true");
-        }else{
-            quoteRequest.setApplyUnAuto("false");
+        if(jymap !=null && jymap.get("0")!=null ){
+            LinkedHashMap<String,Object> linkedMap = (LinkedHashMap<String,Object>) jymap.get("0");
+            if(linkedMap!=null && linkedMap.size()>0){
+                InsDrivingIntentionInsuranceSonVo vo = BeanUtil.mapToBean(linkedMap, InsDrivingIntentionInsuranceSonVo.class, true);
+                UnAutoListInfoDTO unAutoListInfoDTO =new UnAutoListInfoDTO(vo.getProductCode(),vo.getCode(),vo.getQuantity());
+                unAutoListInfoList.add(unAutoListInfoDTO);
+            }
         }
-        quoteRequest.setUnAutoListInfo(unAutoListInfoList);
-        return quoteRequest;
+        return unAutoListInfoList;
     }
 
     public QuoteRequest transferPingAnRequestMsgNY(List<KindInfoVo> kinds, QuoteRequest quoteRequest, CarConfirmResponse.BizQuoteConfigDTO bizQuoteConfig) {
@@ -1023,6 +1143,50 @@ public class QuoteRequest extends PingAnBaseRequest {
             this.sellListSize = sellListSize;
         }
     }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/8/6 15:58
+     *  @Description:  组合险
+     */
+    @Data
+    public static class CombinationInfoDTO implements Serializable {
+
+        /***
+         * 产品编码
+         * M
+         */
+        @CheckNotEmpty(fieldName = "产品编码", message = "产品编码不能为空")
+        private String productCode;
+        /***
+         * 套餐编码
+         * M
+         */
+        @CheckNotEmpty(fieldName = "套餐编码", message = "套餐编码不能为空")
+        private String setMeal;
+        /***
+         * 购买份数
+         * M
+         */
+        @CheckNotEmpty(fieldName = "购买份数", message = "购买份数不能为空")
+        private String policyAmount;
+
+        /***
+         * 组合产品类型
+         * 11组合产品
+         * M
+         */
+        @CheckNotEmpty(fieldName = "组合产品类型", message = "组合产品类型不能为空")
+        private String productType;
+
+
+        public CombinationInfoDTO(String productCode, String setMeal, String policyAmount,String productType) {
+            this.productCode = productCode;
+            this.setMeal = setMeal;
+            this.policyAmount = policyAmount;
+            this.productType = productType;
+        }
+    }
     /***
      * 新增加设备损失险设备信息列表
      */

+ 40 - 0
src/main/java/com/ydtech/modules/order/entity/api/pingan/response/QuoteResponse.java

@@ -5,6 +5,7 @@ import lombok.Data;
 import lombok.EqualsAndHashCode;
 
 import java.io.Serializable;
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -88,6 +89,11 @@ public class QuoteResponse extends PingAnBaseResponse {
      */
     private XwActualPremiumDTO xwActualPremium;
 
+    /***
+     * 财产险保费
+     */
+    private CombinationPremiumDTO combinationPremium;
+
     /***
      * 商业险信息
      */
@@ -1533,5 +1539,39 @@ public class QuoteResponse extends PingAnBaseResponse {
 
     }
 
+    /***
+     * 组合险保费
+     */
+    @Data
+    public static class CombinationPremiumDTO implements Serializable {
+        /***
+         * 小微险保费
+         */
+        private List<CombinationPremiumDetaillDTO> premiumList =new ArrayList<CombinationPremiumDetaillDTO>();
+
+    }
+    @Data
+    public static class CombinationPremiumDetaillDTO implements Serializable {
+
+        /***
+         * 财意险类型
+         */
+        private String productType;
+        /***
+         * 产品编码
+         */
+        private String productCode;
+        /***
+         * 套餐编码
+         */
+        private String setMeal;
+        /***
+         * 保费
+         */
+        private String premium;
+
+    }
+
+
 
 }

+ 3 - 0
src/main/java/com/ydtech/modules/order/entity/vo/AuditOrderFeeVo.java

@@ -15,6 +15,9 @@ public class AuditOrderFeeVo {
     @ApiModelProperty(value = "订单号")
     private String orderNo;
 
+    @ApiModelProperty(value = "子订单号")
+    private String insOrderNo;
+
     @ApiModelProperty(value = "交强总费用比例")
     private String jqCostsProportionStr;
 

+ 1 - 0
src/main/java/com/ydtech/modules/order/entity/vo/BaseQuoteInfoVo.java

@@ -32,6 +32,7 @@ public class BaseQuoteInfoVo extends YaQuoteInfoVo {
 
     public BaseQuoteInfoVo(InsOrders insOrders) {
         super(insOrders);
+        this.userId = insOrders.getUserid();
         this.orderNo = insOrders.getOrderno();
         this.vehicleAndVesselTax = insOrders.getVehicleAndVesselTax().toJavaObject(VehicleAndVesselTax.class);
     }

+ 56 - 18
src/main/java/com/ydtech/modules/order/entity/vo/pingan/InsDrivingIntentionInsuranceSonVo.java

@@ -1,5 +1,6 @@
 package com.ydtech.modules.order.entity.vo.pingan;
 
+import io.swagger.annotations.ApiModel;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -9,41 +10,78 @@ import java.io.Serializable;
  */
 
 @Data
+@ApiModel(value = "驾意险")
 public class InsDrivingIntentionInsuranceSonVo implements Serializable {
 
 
     private Integer id;
-
+    /***
+     *
+     * 02财产险
+     * 03意外险
+     * 10 小微险
+     */
     private String drivingCodeId;
-
+    /***
+     * 保险公司id
+     */
     private String companyId;
-
+    /***
+     *  packageCode   套餐编码
+     */
     private String code;
-
-    private String name;
-
+    /***
+     *  套餐名称
+     */
+    private String projectName;
+    /***
+     *  保额
+     */
     private String amount;
-
+    /***
+     *  保费
+     */
     private String premium;
-
+    /***
+     *  折扣
+     */
     private String discount;
-
+    /***
+     *   保费说明   每份保费或每份保费*座位数
+     */
     private String insuredAmountTips;
-
+    /***
+     * 最小购买年龄
+     */
     private String leastAcceptInsureAge;
-
+    /***
+     * 最大购买年龄
+     */
     private String topAcceptInsureAge;
-
+    /***
+     * 版本
+     */
     private String version;
-
+    /***
+     * 最大购买次数
+     */
     private String sellListSize;
-
+    /***
+     * 组合产品标识	02-组合必选
+     * 01-不可单独销售
+     */
     private String  combineProductType;
-
+    /***
+     * 产品编码
+     */
     private String productCode;
 
-    private String projectName;
-
+    /***
+     *  产品名称
+     */
+    private String name;
+    /***
+     *  份数
+     */
     private String quantity;
-
 }

+ 1 - 2
src/main/java/com/ydtech/modules/order/service/PingAnOrderApiService.java

@@ -10,7 +10,6 @@ import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
 import com.ydtech.modules.order.entity.vo.InsDrivingIntentionInsuranceVo;
 import com.ydtech.modules.order.entity.vo.SpecialAuditVo;
 import com.ydtech.modules.order.entity.vo.bohai.ProductDetailsQueryVo;
-import com.ydtech.modules.order.entity.vo.pingan.InsDrivingIntentionInsuranceSonVo;
 import com.ydtech.modules.order.entity.vo.pingan.PingAnQuoteVo;
 import com.ydtech.modules.order.entity.vo.pingan.RenewalConfirmVo;
 import com.ydtech.modules.order.entity.vo.pingan.StorefrontQueryVo;
@@ -40,7 +39,7 @@ public interface PingAnOrderApiService {
      * @param quoteVo
      * @return
      */
-    HttpResult<QuoteRespVo> quote(BaseQuoteInfoVo quoteInfo, PingAnQuoteVo<InsDrivingIntentionInsuranceSonVo> quoteVo) throws Exception;
+    HttpResult<QuoteRespVo> quote(BaseQuoteInfoVo quoteInfo, PingAnQuoteVo<Map<String,Object>> quoteVo) throws Exception;
 
     /**
      * 提交影像

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

@@ -404,21 +404,21 @@ public class BoHaiOrderApiServiceImpl implements BoHaiOrderApiService {
         String licenseno = insOrders.getLicenseno();
         if (StringUtils.isNotEmpty(data.getTrafficEPolicyUrl())) {
             crawlerPolicyPrintVo.setJqxPolicyUrl(fileComponents.gainCarInsPolicy(data.getTrafficEPolicyUrl(),
-                    licenseno + "-" + insAreaCompany.getJqpolicyno() + "-交强险保单.pdf", licenseno, customerInfoVo.getIdentifyNumber()));
+                    licenseno + "-" + insAreaCompany.getJqpolicyno() + "-交强险保单.pdf", insAreaCompany.getId(), customerInfoVo.getIdentifyNumber()));
             crawlerPolicyPrintVo.setJqxFlagUrl(fileComponents.gainCarInsPolicy(data.getTrafficEFlagUrl(),
-                    licenseno + "-" + insAreaCompany.getJqpolicyno() + "-交强险标志.pdf", licenseno, customerInfoVo.getIdentifyNumber()));
+                    licenseno + "-" + insAreaCompany.getJqpolicyno() + "-交强险标志.pdf", insAreaCompany.getId(), customerInfoVo.getIdentifyNumber()));
 
         }
         if (StringUtils.isNotEmpty(data.getBusinessEPolicyUrl())) {
             crawlerPolicyPrintVo.setSyxPolicyUrl(fileComponents.gainCarInsPolicy(data.getBusinessEPolicyUrl(),
-                    licenseno + "-" + insAreaCompany.getSypolicyno() + "-商业险保单.pdf", licenseno, customerInfoVo.getIdentifyNumber()));
+                    licenseno + "-" + insAreaCompany.getSypolicyno() + "-商业险保单.pdf", insAreaCompany.getId(), customerInfoVo.getIdentifyNumber()));
         }
 
         if (StringUtils.isNotEmpty(data.getAcciEPolicyUrl())) {
             List<CrawlerPolicyPrintVo.JyxInfoListDTO> jyxInfoListDTOS = new ArrayList<>();
             CrawlerPolicyPrintVo.JyxInfoListDTO jyxInfoListDTO = new CrawlerPolicyPrintVo.JyxInfoListDTO();
             jyxInfoListDTO.setJyxPolicyUrl(fileComponents.gainCarInsPolicy(data.getAcciEPolicyUrl(),
-                    licenseno + "-" + insAreaCompany.getSypolicyno() + "-非车险保单.pdf", licenseno, customerInfoVo.getIdentifyNumber()));
+                    licenseno + "-" + insAreaCompany.getSypolicyno() + "-非车险保单.pdf", insAreaCompany.getId(), customerInfoVo.getIdentifyNumber()));
             jyxInfoListDTOS.add(jyxInfoListDTO);
             crawlerPolicyPrintVo.setJyxInfoList(jyxInfoListDTOS);
         }

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

@@ -872,7 +872,7 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
                     NVHLODR2007Response nvhlodr2007Response = daJiaRequestApiComponents.accidentPremiumWarranty(nvhlodr2007Request);
                     if ("2000".equals(nvhlodr2007Response.getStatus())) {
                         url = gainCarInsPolicy(nvhlodr2007Response.getPolicyInfos().get(0).getCPdfUrl(),
-                                insOrders.getLicenseno() + templateName, identifyNo);
+                                insOrders.getLicenseno() + templateName, insAreaCompany.getId());
                     }
                 }
             } else {
@@ -884,7 +884,7 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
                         //下载标志
                         if (vhlins2005Response.getResult().size() > 0) {
                             VHLINS2005Response.ResultDTO resultDTO = vhlins2005Response.getResult().get(0);
-                            url = gainCarInsPolicy(resultDTO.getReturnBzUrl(), insOrders.getLicenseno() + templateName, identifyNo);
+                            url = gainCarInsPolicy(resultDTO.getReturnBzUrl(), insOrders.getLicenseno() + templateName, insAreaCompany.getId());
                         } else {
                             return HttpResult.error("获取保单失败");
                         }
@@ -892,7 +892,7 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
                         //获取保单
                         if (vhlins2005Response.getResult().size() > 0) {
                             VHLINS2005Response.ResultDTO resultDTO = vhlins2005Response.getResult().get(0);
-                            url = gainCarInsPolicy(resultDTO.getReturnUrl(), insOrders.getLicenseno() + templateName, identifyNo);
+                            url = gainCarInsPolicy(resultDTO.getReturnUrl(), insOrders.getLicenseno() + templateName, insAreaCompany.getId());
                         } else {
                             return HttpResult.error("获取保单失败");
                         }

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

@@ -541,7 +541,7 @@ public class GuorenOrderApiServiceImpl implements GuorenOrderApiService {
                 throw new SystemException("保险编号异常");
         }
 
-        String transferUrl = gainCarInsPolicy(url, licensePlate + templateName, licensePlate);
+        String transferUrl = gainCarInsPolicy(url, licensePlate + templateName, insAreaCompany.getId());
         return HttpResult.ok("成功", transferUrl);
 
     }

+ 3 - 3
src/main/java/com/ydtech/modules/order/service/impl/HuaTaiOrderApiServiceImpl.java

@@ -457,10 +457,10 @@ public class HuaTaiOrderApiServiceImpl implements HuaTaiOrderApiService {
                 for (HuaTaiInsurancePolicyPrintResponse.ElecDownLoadResultDto elecDownLoadResultDto : urlList) {
                     String url = elecDownLoadResultDto.getDownURL();
                     if (InsuranceRisk.TRAFFIC.getCode().equals(riskCode)) {
-                        crawlerPolicyPrintVo.setJqxPolicyUrl(gainCarInsPolicy(url, licensePlate + "-交强险保单.pdf", licensePlate, password));
-                        crawlerPolicyPrintVo.setJqxFlagUrl(gainCarInsPolicy(url, licensePlate + "-交强险标志.pdf", licensePlate, password));
+                        crawlerPolicyPrintVo.setJqxPolicyUrl(gainCarInsPolicy(url, licensePlate + "-交强险保单.pdf", insAreaCompany.getId(), password));
+                        crawlerPolicyPrintVo.setJqxFlagUrl(gainCarInsPolicy(url, licensePlate + "-交强险标志.pdf", insAreaCompany.getId(), password));
                     } else if (InsuranceRisk.BUSINESS.getCode().equals(riskCode)) {
-                        crawlerPolicyPrintVo.setSyxPolicyUrl(gainCarInsPolicy(url, licensePlate + "-商业险保单.pdf", licensePlate, password));
+                        crawlerPolicyPrintVo.setSyxPolicyUrl(gainCarInsPolicy(url, licensePlate + "-商业险保单.pdf", insAreaCompany.getId(), password));
                     }
                     /**
                      * 先下载到本地,然后再解压到固定路径

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

@@ -262,14 +262,14 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
         }
 
         CrawlerPolicyPrintVo crawlerPolicyPrintVo = new CrawlerPolicyPrintVo();
-        crawlerPolicyPrintVo.setJqxFlagUrl(gainCarInsPolicy(response.getJqxFlagUrl(), licensePlate + "-交强险标志.pdf", licensePlate));
-        crawlerPolicyPrintVo.setJqxPolicyUrl(gainCarInsPolicy(response.getJqxPolicyUrl(), licensePlate + "-交强险保单.pdf", licensePlate));
-        crawlerPolicyPrintVo.setSyxPolicyUrl(gainCarInsPolicy(response.getSyxPolicyUrl(), licensePlate + "-商业险保单.pdf", licensePlate));
+        crawlerPolicyPrintVo.setJqxFlagUrl(gainCarInsPolicy(response.getJqxFlagUrl(), licensePlate + "-交强险标志.pdf", insAreaCompany.getId()));
+        crawlerPolicyPrintVo.setJqxPolicyUrl(gainCarInsPolicy(response.getJqxPolicyUrl(), licensePlate + "-交强险保单.pdf", insAreaCompany.getId()));
+        crawlerPolicyPrintVo.setSyxPolicyUrl(gainCarInsPolicy(response.getSyxPolicyUrl(), licensePlate + "-商业险保单.pdf", insAreaCompany.getId()));
         crawlerPolicyPrintVo.setJyxInfoList(response.getJyxInfoList().stream().map(x -> {
             CrawlerPolicyPrintVo.JyxInfoListDTO jyxInfoListDTO = new CrawlerPolicyPrintVo.JyxInfoListDTO();
             jyxInfoListDTO.setApplication(x.getApplication());
             jyxInfoListDTO.setJyxPolicyUrl(gainCarInsPolicy(x.getJyxPolicyUrl(), licensePlate + "-" + x.getApplication() + "-非车险保单.pdf",
-                    licensePlate));
+                    insAreaCompany.getId()));
             return jyxInfoListDTO;
         }).collect(Collectors.toList()));
         return HttpResult.ok(crawlerPolicyPrintVo);

+ 31 - 30
src/main/java/com/ydtech/modules/order/service/impl/InsOrdersServiceImpl.java

@@ -258,7 +258,7 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
     }
 
     /**
-     * @param user        当前登录人
+     * @param user      当前登录人
      * @param quoteInfoVo 报价信息
      * @return
      */
@@ -339,7 +339,7 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
             // 将报价号返回
             long l = new SnowFlakeUtil().nextId();
             insOrders.setQuoteno(String.valueOf(l));
-            boolean save = this.saveAndTrajectories(sysUser, insOrders);
+            boolean save = this.saveAndTrajectories( sysUser, insOrders);
             if (!save) {
                 throw new SystemException("订单生成失败");
             }
@@ -394,15 +394,15 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
         SysUserRole userRole = sysUserRoleService.selectByUserId(orderQueryVo.getUserId());
         SysUser user = sysUserService.getById(orderQueryVo.getUserId());
         SysDept dept = sysDeptService.getById(user.getDeptId());
-        String deptId = "";
-        boolean isCdy = false;
+        String deptId="";
+        boolean isCdy =false;
         //机构类型为1  角色id=21是渠道团队长
-        if (dept != null && "1".equals(dept.getManagementSource()) && userRole != null && userRole.getRoleId() == 21) {
-            deptId = dept.getId();
+        if(dept!=null && "1".equals(dept.getManagementSource()) && userRole!=null && userRole.getRoleId()==21){
+            deptId=dept.getId();
             isCdy = true;
         }
-        Page<InsOrders> orderVoPage = baseMapper.queryPageOrder(page, orderQueryVo, adminFalg, isCdy, deptId);
-        Long total = baseMapper.queryPageOrderCount(orderQueryVo, adminFalg, isCdy, deptId);
+        Page<InsOrders> orderVoPage = baseMapper.queryPageOrder(page, orderQueryVo, adminFalg, isCdy,deptId);
+        Long total = baseMapper.queryPageOrderCount(orderQueryVo, adminFalg, isCdy,deptId);
         orderVoPage.setTotal(total);
         return new BasePageResult<>(orderQueryVo.getPageNum(), orderQueryVo.getPageSize(), orderVoPage.getTotal(),
                 orderVoPage.getPages()
@@ -752,9 +752,9 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
         if (insAreaCompanyList.size() > 0 && insOrders.getIsExternal() == 1) {
             insAreaCompanyExternalFee = insAreaCompanyExternalFeeService.getById(insAreaCompanyList.get(0).getId());
             insOrdersEditingVo.setSigningTime(insAreaCompanyList.get(0).getSigningTime());
-            insOrdersEditingVo.setJqpremium(insAreaCompanyList.get(0).getJqpremium().compareTo(BigDecimal.ZERO) == 0 ? "" : insAreaCompanyList.get(0).getJqpremium().toString());
-            insOrdersEditingVo.setSypremium(insAreaCompanyList.get(0).getSypremium().compareTo(BigDecimal.ZERO) == 0 ? "" : insAreaCompanyList.get(0).getSypremium().toString());
-            insOrdersEditingVo.setJypremium(insAreaCompanyList.get(0).getJypremium().compareTo(BigDecimal.ZERO) == 0 ? "" : insAreaCompanyList.get(0).getJypremium().toString());
+            insOrdersEditingVo.setJqpremium(insAreaCompanyList.get(0).getJqpremium().compareTo(BigDecimal.ZERO)==0?"":insAreaCompanyList.get(0).getJqpremium() .toString());
+            insOrdersEditingVo.setSypremium(insAreaCompanyList.get(0).getSypremium().compareTo(BigDecimal.ZERO)==0?"":insAreaCompanyList.get(0).getSypremium().toString());
+            insOrdersEditingVo.setJypremium(insAreaCompanyList.get(0).getJypremium().compareTo(BigDecimal.ZERO)==0?"":insAreaCompanyList.get(0).getJypremium().toString());
             insOrdersEditingVo.setTaxamount(insAreaCompanyList.get(0).getTaxamount().toString());
             insOrdersEditingVo.setJqpolicyno(insAreaCompanyList.get(0).getJqpolicyno());
             insOrdersEditingVo.setSypolicyno(insAreaCompanyList.get(0).getSypolicyno());
@@ -765,8 +765,8 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
             //设置签单时间和非车保单号
             insOrdersEditingVo.setSignDate(insAreaCompanyList.get(0).getSigningTime());
             JSONArray crossInsurance = insAreaCompanyList.get(0).getCrossInsurance();
-            String application = "";
-            if (crossInsurance != null && crossInsurance.size() > 0) {
+            String application ="";
+            if(crossInsurance!=null && crossInsurance.size() > 0) {
                 application = crossInsurance.getJSONObject(0).getString("application");
             }
             insOrdersEditingVo.setJypolicyno(application);
@@ -853,13 +853,13 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
             });
 
         });
-        if (insAreaCompanyEditingDtos != null && insAreaCompanyEditingDtos.size() > 0) {
+        if(insAreaCompanyEditingDtos!=null && insAreaCompanyEditingDtos.size()>0){
             //根据出单员判断  编辑查看
             //add  by  hxl   添加出单员不能查看优惠的限制    2024-07-16
             String userId = new BaseController().getUserId();
             SysUserRole sysUserRole = sysUserRoleService.selectByUserId(userId);
-            if (sysUserRole != null && sysUserRole.getRoleId() == 19) {
-                insAreaCompanyEditingDtos.forEach(item -> {
+            if(sysUserRole!=null && sysUserRole.getRoleId()==19){
+                insAreaCompanyEditingDtos.forEach(item ->{
                             item.setJqExportFee(null);
                             item.setSyExportFee(null);
                             item.setNoExportFee(null);
@@ -931,9 +931,7 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
         return true;
     }
 
-    /**
-     * user
-     *
+    /**user
      * @version
      * @author: hxl
      * @Date: 2024/4/17 15:38
@@ -1384,21 +1382,24 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
         LocalDateTime currentTime = LocalDateTime.now();
         LocalDateTime oneYearAgo = currentTime.plus(1, ChronoUnit.YEARS);
         DateTimeFormatter datePat = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
-        if (orderExpirationQueryVo.getJqEnable() && (StringUtils.isEmpty(orderExpirationQueryVo.getJqStartDate()) ||
+        if (orderExpirationQueryVo.getJqEnable() &&( StringUtils.isEmpty(orderExpirationQueryVo.getJqStartDate()) ||
                 StringUtils.isEmpty(orderExpirationQueryVo.getJqEndDate()))) {
-            throw new InvalidPropertyException(getClass(), "jqStartDate/jqEndDate", "请输入交强查询起止日期!");
+            throw new InvalidPropertyException(getClass(),"jqStartDate/jqEndDate","请输入交强查询起止日期!");
 
-        } else {
-            orderExpirationQueryVo.setJqStartDate(currentTime.format(datePat));
-            orderExpirationQueryVo.setJqEndDate(oneYearAgo.format(datePat));
         }
 
-        if (orderExpirationQueryVo.getSyEnable() && (StringUtils.isEmpty(orderExpirationQueryVo.getSyStartDate()) ||
-                StringUtils.isEmpty(orderExpirationQueryVo.getSyEndDate()))) {
-            throw new InvalidPropertyException(getClass(), "syStartDate/syEndDate", "请输入商业查询起止日期!");
-        } else {
+        if (!orderExpirationQueryVo.getJqEnable()){
+            orderExpirationQueryVo.setJqStartDate(currentTime.format(datePat) );
+            orderExpirationQueryVo.setJqEndDate(oneYearAgo.format(datePat) );
+        }
+
+        if (orderExpirationQueryVo.getSyEnable() &&(StringUtils.isEmpty(orderExpirationQueryVo.getSyStartDate()) ||
+                StringUtils.isEmpty(orderExpirationQueryVo.getSyEndDate() ))) {
+            throw new InvalidPropertyException(getClass(),"syStartDate/syEndDate","请输入商业查询起止日期!");
+        }
+        if (!orderExpirationQueryVo.getSyEnable()){
             orderExpirationQueryVo.setSyStartDate(currentTime.format(datePat));
-            orderExpirationQueryVo.setSyEndDate(oneYearAgo.format(datePat));
+            orderExpirationQueryVo.setSyEndDate(oneYearAgo.format(datePat)  );
         }
         Page<OrderExpirationVo> expirationInsure = baseMapper.getExpirationInsure(page, orderExpirationQueryVo);
         List<OrderExpirationVo> records = expirationInsure.getRecords();
@@ -1486,7 +1487,7 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
             }
             Set<BigDecimal> set = new HashSet<BigDecimal>(yhhbjList);
             //判断是否相等
-            if (set.size() > 1) {
+            if (set.size()>1) {
                 //最优惠公司
                 int index = getCompanyNameByMinAmount(yhhbjList);
                 companyName = companyAllList.get(index);

+ 323 - 88
src/main/java/com/ydtech/modules/order/service/impl/PingAnOrderApiServiceImpl.java

@@ -1,8 +1,11 @@
 package com.ydtech.modules.order.service.impl;
 
+import cn.hutool.core.bean.BeanUtil;
 import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.google.gson.Gson;
 import com.ydtech.config.properties.PingAnApiConfigurationProperties;
+import com.ydtech.constants.enums.InsurKind;
 import com.ydtech.constants.enums.dict.InsOrderStatusEnum;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.exception.SystemException;
@@ -44,12 +47,14 @@ import com.ydtech.modules.order.entity.vo.pingan.PingAnQuoteVo;
 import com.ydtech.modules.order.entity.vo.pingan.RenewalConfirmVo;
 import com.ydtech.modules.order.entity.vo.pingan.StorefrontQueryVo;
 import com.ydtech.modules.order.service.*;
+import com.ydtech.modules.order.utils.MD5Util;
 import com.ydtech.modules.order.utils.PingAnUpLoadUtils;
 import com.ydtech.modules.protocol.entity.po.PtlAgreementAttribution;
 import com.ydtech.modules.protocol.service.PtlAgreementAttributionService;
 import com.ydtech.utils.CalculateUtils;
 import com.ydtech.utils.StringUtils;
 import lombok.RequiredArgsConstructor;
+import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.util.ObjectUtils;
 
@@ -197,8 +202,10 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
      * @Exception
      */
     @Override
-    public HttpResult<QuoteRespVo> quote(BaseQuoteInfoVo quoteInfo, PingAnQuoteVo<InsDrivingIntentionInsuranceSonVo> quoteVo) throws Exception {
+    public HttpResult<QuoteRespVo> quote(BaseQuoteInfoVo quoteInfo, PingAnQuoteVo<Map<String,Object>> quoteVo) throws Exception {
 
+        //验证参数
+        checkData(quoteVo);
         // 车型查询
         CarInfoVo carInfo = quoteInfo.getCarInfo();
         PinganApiLog pinganApiLog = new PinganApiLog(quoteVo.getOrderNo(),null,quoteVo.getAgreementId());
@@ -207,8 +214,6 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
         // 通过 协议id获取配置实体
         PingAnConfigureParameters parameters = configureParametersComponents.toEntity(PingAnConfigureParameters.class,
                 ptlAgreementAttribution);
-
-
         try {
             // 1. 标的信息
             IndexRequest indexRequest = new IndexRequest(parameters, carInfo);
@@ -248,15 +253,15 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
             }
             //4.报价  使用车辆确认返回的流程id
             pinganApiLog.setId(null);
-            QuoteRequest quoteRequest = new QuoteRequest(parameters, quoteInfo, model, carConfirmResponse.getFlowid(), quoteVo.getAccommodationFlag(), quoteVo.getApplyUnAuto(), quoteVo.getApplyXiaoWei(), quoteVo.getUnAutoListInfo(), quoteVo.getXiaoWeiListInfo(), quoteVo.getAmount22XNYChargingPostList(), quoteVo.getAmount23XNYChargingPostList());
+            QuoteRequest quoteRequest = new QuoteRequest(parameters, quoteInfo,carConfirmResponse.getFlowid(), quoteVo.getAccommodationFlag(), quoteVo.getAmount22XNYChargingPostList(), quoteVo.getAmount23XNYChargingPostList(),quoteVo.getAccidentalDrivingVo());
             //能源车 判断 赋值能源参数
             if("1,2,3,".contains(carInfo.getEnergyType())){
+                //新能源参数传递
                 quoteRequest = quoteRequest.transferPingAnRequestMsgNY(quoteInfo.getKindList(), quoteRequest,carConfirmResponse.getBizQuoteConfig());
             }else{
+                //客车、货车传递
                 quoteRequest = quoteRequest.transferPingAnRequestMsg(quoteInfo.getKindList(), quoteRequest,carConfirmResponse.getBizQuoteConfig());
             }
-
-            quoteRequest = quoteRequest.transYJPingAnRequestMsg(quoteVo.getAccidentalDrivingVo(), quoteRequest,"1");
             QuoteResponse quoteResponse = null;
             try {
                 quoteResponse = pinganRequestApiComponents.quote(quoteRequest,pinganApiLog);
@@ -265,7 +270,7 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
             }
             if (quoteResponse != null && "0".equals(quoteResponse.getResultCode())) {
                 //5.组装返回的报价信息
-                return getQuoteRespVo(quoteResponse, quoteInfo, ptlAgreementAttribution, model,parameters.getUserId(),pinganApiLog,carConfirmResponse);
+                return getQuoteRespVo(quoteResponse, quoteInfo, ptlAgreementAttribution, model,parameters.getUserId(),pinganApiLog,carConfirmResponse,quoteVo);
             }else{
                 throw new SystemException(quoteResponse.getResultMessage());
             }
@@ -273,13 +278,41 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
             throw new SystemException(e.getMessage());
         }
     }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/8/6 16:21
+     *  @Description:  验证参数是否正确
+     */
+    private static void checkData(PingAnQuoteVo<Map<String, Object>> quoteVo) {
+        String agreementId = quoteVo.getAgreementId();
+        if(StringUtils.isBlank(agreementId)){
+            throw new SystemException("未选择协议不能报价");
+        }
+        Map<String, Object> map = quoteVo.getAccidentalDrivingVo();
+        if(map!=null && map.get("2")!=null){
+            List<InsDrivingIntentionInsuranceSonVo> zhlist = (List<InsDrivingIntentionInsuranceSonVo>) map.get("2");
+            int  count =0;
+            if(zhlist!=null && zhlist.size()>0){
+                for(InsDrivingIntentionInsuranceSonVo zhVo : zhlist ){
+                    if("01".equals(zhVo.getCombineProductType())){
+                        count++;
+                    }
+                }
+            }
+            if(count==1){
+                throw new SystemException("组合险不能只选择不可单独销售的产品");
+            }
+        }
+    }
 
     public HttpResult<QuoteRespVo> getQuoteRespVo(QuoteResponse response,
                                                   BaseQuoteInfoVo yaQuoteInfoVo,
                                                   PtlAgreementAttribution ptlAgreementAttribution,
                                                   SearchPAVehicleListResponse.ModelsDto modelsDto,String userId,
                                                   PinganApiLog pinganApiLog,
-                                                  CarConfirmResponse carConfirmResponse
+                                                  CarConfirmResponse carConfirmResponse,
+                                                  PingAnQuoteVo<Map<String,Object>> quoteVo
     ) {
 
         PingAnQuoteRespVo quoteRespVo = new PingAnQuoteRespVo();
@@ -319,8 +352,6 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
             syPremium = Double.parseDouble(bizQuoteResult.getPremiumTotal() == null ? "0" : bizQuoteResult.getPremiumTotal());
             //商业险保费
             quoteRespVo.setSyPremium(syPremium);
-            //商业险保单号
-            quoteRespVo.setSyApplyNo(bizQuoteResult.getQueryRequestCode());
             QuoteResponse.QuoteDTO bizQuote = response.getBizQuote();
             // 交强
             quoteRespVo.setStartDateJq(forceQuote.getBeginDate());
@@ -329,19 +360,20 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
             quoteRespVo.setStartDateSy(bizQuote.getBeginDate());
             quoteRespVo.setEndDateSy(bizQuote.getEndDate());
             // 商业险险种
-            List<QuoteResponse.ClauseCaseListDTO> clauseCaseList = bizQuoteResult.getClauseCaseList();
+            List<KindInfoVo> kindList = yaQuoteInfoVo.getKindList();
             QuoteKindRespVo kind;
-            if(clauseCaseList!=null && clauseCaseList.size()>0){
-                for (QuoteResponse.ClauseCaseListDTO clauseCaseListDTO : clauseCaseList) {
+            if(kindList!=null && kindList.size()>0){
+                for (KindInfoVo kindInfoVo : kindList) {
                     kind = new QuoteKindRespVo();
-                    kind.setKindCode(clauseCaseListDTO.getProductCode());
-                    kind.setKindName(clauseCaseListDTO.getProductName());
-                    double amount = Double.parseDouble(clauseCaseListDTO.getAmount() == null ? "0" : clauseCaseListDTO.getAmount());
-                    kind.setAmount(amount);
-                    double count = Double.parseDouble(clauseCaseListDTO.getCount() == null ? "0" : clauseCaseListDTO.getCount());
-                    kind.setUnitAmount(count);
-                    //保费
-                    kind.setCoveragePremium(amount * count);
+                    kind.setKindCode(kindInfoVo.getKindCode());
+                    kind.setKindName(kindInfoVo.getKindName());
+                    kind.setAmount(kindInfoVo.getAmount());
+                    kind.setCoveragePremium(getPremium(bizQuoteResult,xnyFlag,kindInfoVo.getKindCode()));
+                    kind.setUnitAmount(kindInfoVo.getUnitAmount());
+                    kind.setServiceTimes(String.valueOf(kindInfoVo.getServiceTimes()));
+                    if (!ObjectUtils.isEmpty(kindInfoVo.getDeductibleRate())) {
+                        kind.setDeductibleRate(Double.parseDouble(kindInfoVo.getDeductibleRate()));
+                    }
                     kindList1.add(kind);
                 }
             }
@@ -351,6 +383,15 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
         QuoteResponse.AhsUpcActualPremiumDTO ahsUpcActualPremium = response.getAhsUpcActualPremium();
         // 小微险保费
         QuoteResponse.XwActualPremiumDTO xwActualPremium = response.getXwActualPremium();
+        double zhAmount=0;
+        //组合险保费
+        QuoteResponse.CombinationPremiumDTO combinationPremium = response.getCombinationPremium();
+        if(combinationPremium!=null && combinationPremium.getPremiumList()!=null && combinationPremium.getPremiumList().size()>0){
+            List<QuoteResponse.CombinationPremiumDetaillDTO> premiumList = combinationPremium.getPremiumList();
+            for(QuoteResponse.CombinationPremiumDetaillDTO vo :premiumList){
+                zhAmount+=StringUtils.isBlank(vo.getPremium())?0:Double.parseDouble(vo.getPremium());
+            }
+        }
         //小微险保费
         quoteRespVo.setAhsUpcActualPremium(ahsUpcActualPremium);
         quoteRespVo.setXwActualPremium(xwActualPremium);
@@ -361,14 +402,17 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
             //   财意险总保费
             double ahsUpcTotalPremium = Double.parseDouble(ahsUpcActualPremium.getAhsUpcTotalPremium() == null ? "0" : ahsUpcActualPremium.getAhsUpcTotalPremium());;
             jyPremium += ahsUpcTotalPremium;
+            quoteRespVo.setCyPremium(ahsUpcTotalPremium);
         }
         if (!ObjectUtils.isEmpty(xwActualPremium)) {
             double xwPremium = Double.parseDouble(xwActualPremium.getXwPremium() == null ? "0" : xwActualPremium.getXwPremium());
             jyPremium += xwPremium;
+            quoteRespVo.setXwPremium(xwPremium);
         }
+        jyPremium += zhAmount;
+        quoteRespVo.setZhPremium(zhAmount);
         //  报价险种放入保费
         List<QuoteRiskRespVo> riskList1 = QuoteRiskRespVo.toQuoteRiskRespVoList(riskList, jqPremium, syPremium);
-
         quoteRespVo.setRiskList(riskList1);
         quoteRespVo.setJqPremium(jqPremium);
         quoteRespVo.setSyPremium(syPremium);
@@ -382,40 +426,197 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
         //订单号
         quoteRespVo.setOrderno(yaQuoteInfoVo.getOrderNo());
         quoteRespVo.setCoreModels(modelsDto.toCoreModelsVo());
-        String orderId = yaQuoteInfoVo.getOrderNo();
-        return responseOrder(response, quoteRespVo, ptlAgreementAttribution, orderId,userId,pinganApiLog,carConfirmResponse);
+        return responseOrder(response, quoteRespVo, ptlAgreementAttribution, carConfirmResponse,quoteVo);
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/8/6 17:46
+     *  @Description:  赋值新能源、非新能源的商业险信息
+     */
+    private double getPremium(QuoteResponse.BizQuoteResultDTO bizQuoteResult, Boolean xnyFlag,String code) {
+        double val=0;
+        //机动车损失保险保费
+        if (InsurKind.A.getCode().equalsIgnoreCase(code)) {
+            //能源车
+            if(xnyFlag){
+                //premium01XNY	C	新能源汽车损失保险保费
+                val = StringUtils.isBlank(bizQuoteResult.getPremium01XNY())?0:Double.parseDouble(bizQuoteResult.getPremium01XNY());
+            }else{
+                // premium01	C	机动车损失保险保费
+                val = StringUtils.isBlank(bizQuoteResult.getPremium01())?0:Double.parseDouble(bizQuoteResult.getPremium01());
+            }
+        }
+        //三者险
+        if (InsurKind.B.getCode().equalsIgnoreCase(code)) {
+            if(xnyFlag){
+                //premium02XNY	C	新能源汽车第三者责任保险保费
+                val = StringUtils.isBlank(bizQuoteResult.getPremium02XNY())?0:Double.parseDouble(bizQuoteResult.getPremium02XNY());
+            }else{
+                // premium02	C	机动车第三者责任保险保费
+                val = StringUtils.isBlank(bizQuoteResult.getPremium02())?0:Double.parseDouble(bizQuoteResult.getPremium02());
+            }
+        }
+        //乘客责任险
+        if (InsurKind.D4.getCode().equalsIgnoreCase(code)) {
+            if(xnyFlag){
+                //premium03XNY	C	新能源汽车车上人员责任保险(司机)保费
+                val = StringUtils.isBlank(bizQuoteResult.getPremium03XNY())?0:Double.parseDouble(bizQuoteResult.getPremium03XNY());
+            }else{
+                //premium04	C	机动车车上人员责任保险(司机)保费
+                val = StringUtils.isBlank(bizQuoteResult.getPremium04())?0:Double.parseDouble(bizQuoteResult.getPremium04());
+            }
+        }
+        //司机责任险
+        if (InsurKind.D3.getCode().equalsIgnoreCase(code)) {
+            if(xnyFlag){
+                // premium04XNY	C单座保费*乘客座位数	新能源汽车车上人员责任保险(乘客)保费
+                val = StringUtils.isBlank(bizQuoteResult.getPremium04XNY())?0:Double.parseDouble(bizQuoteResult.getPremium04XNY());
+            }else{
+                //premium05	C单座保费*乘客座位数	机动车车上人员责任保险(乘客)保费
+                val = StringUtils.isBlank(bizQuoteResult.getPremium05())?0:Double.parseDouble(bizQuoteResult.getPremium05());
+            }
+        }
+        //  客车  premium06	C      * 	附加车上货物责任险保费   能源无
+        //  附加医保外用药责任险(第三者责任保险)
+        if (InsurKind.SY_FJ_YBW1.getCode().equalsIgnoreCase(code)) {
+            if(xnyFlag){
+                //  premium18XNY	C	附加医保外用药责任险保额(三者)保费
+                val = StringUtils.isBlank(bizQuoteResult.getPremium18XNY())?0:Double.parseDouble(bizQuoteResult.getPremium18XNY());
+            }else{
+                // premium07	C	附加医保外用药责任险保费(三者)
+                val = StringUtils.isBlank(bizQuoteResult.getPremium07())?0:Double.parseDouble(bizQuoteResult.getPremium07());
+            }
+        }
+        // 附加医保外用药责任险(车上人员责任保险(乘客))
+        if (InsurKind.SY_FJ_YBW2.getCode().equalsIgnoreCase(code)) {
+            if(xnyFlag){
+                //  premium19XNY	C	附加医保外用药责任险保额(司机)保费
+                val = StringUtils.isBlank(bizQuoteResult.getPremium19XNY())?0:Double.parseDouble(bizQuoteResult.getPremium19XNY());
+            }else{
+                // premium08	C	附加医保外用药责任险保费(司机)
+                val = StringUtils.isBlank(bizQuoteResult.getPremium08())?0:Double.parseDouble(bizQuoteResult.getPremium08());
+            }
+        }
+        // 附加医保外用药责任险(车上人员责任保险(司机))
+        if (InsurKind.SY_FJ_YBW3.getCode().equalsIgnoreCase(code)) {
+            if(xnyFlag){
+                //   premium20XNY	C	附加医保外用药责任险保额(乘客)保费
+                val = StringUtils.isBlank(bizQuoteResult.getPremium20XNY())?0:Double.parseDouble(bizQuoteResult.getPremium20XNY());
+            }else{
+                // premium09	C	附加医保外用药责任险保费(乘客)
+                val = StringUtils.isBlank(bizQuoteResult.getPremium09())?0:Double.parseDouble(bizQuoteResult.getPremium09());
+            }
+        }
+        // 附加绝对免赔率特约条款(车损)
+        if (InsurKind.MJ1.getCode().equalsIgnoreCase(code)) {
+            if(xnyFlag){
+                // premium05XNY	C     * 	附加绝对免赔率特约险(车损)保费   能源车
+                val = StringUtils.isBlank(bizQuoteResult.getPremium05XNY())?0:Double.parseDouble(bizQuoteResult.getPremium05XNY());
+            }else{
+                //premium53	C	附加绝对免赔率特约险(车损)保费
+                val = StringUtils.isBlank(bizQuoteResult.getPremium53())?0:Double.parseDouble(bizQuoteResult.getPremium53());
+            }
+        }
+        // 附加绝对免赔率特约条款(机动车第三者责任保险)
+        if (InsurKind.MJ2.getCode().equalsIgnoreCase(code)) {
+            if(xnyFlag){
+                //   premium06XNY	C	附加绝对免赔率特约险(三者)保费
+                val = StringUtils.isBlank(bizQuoteResult.getPremium06XNY())?0:Double.parseDouble(bizQuoteResult.getPremium06XNY());
+            }else{
+                // premium54	C	附加绝对免赔率特约险(三者)保费
+                val = StringUtils.isBlank(bizQuoteResult.getPremium54())?0:Double.parseDouble(bizQuoteResult.getPremium54());
+            }
+        }
+        // 附加绝对免赔率特约条款(机动车车上人员责任保险(司机))
+        if (InsurKind.MJ3.getCode().equalsIgnoreCase(code)) {
+            if(xnyFlag){
+                //  //premium07XNY	C	附加绝对免赔率特约险(车上人员司机)保费
+                val = StringUtils.isBlank(bizQuoteResult.getPremium07XNY())?0:Double.parseDouble(bizQuoteResult.getPremium07XNY());
+            }else{
+                //premium55	C	附加绝对免赔率特约险(车上人员司机)保费
+                val = StringUtils.isBlank(bizQuoteResult.getPremium55())?0:Double.parseDouble(bizQuoteResult.getPremium55());
+            }
+        }
+
+
+        // 附加绝对免赔率特约条款(机动车车上人员责任保险(乘客))
+        if (InsurKind.MJ4.getCode().equalsIgnoreCase(code)) {
+            if(xnyFlag){
+                //   premium08XNY	C	附加绝对免赔率特约险(车上人员乘客)保费
+                val = StringUtils.isBlank(bizQuoteResult.getPremium08XNY())?0:Double.parseDouble(bizQuoteResult.getPremium08XNY());
+            }else{
+                // * premium56	C	附加绝对免赔率特约险(车上人员乘客)保费
+                val = StringUtils.isBlank(bizQuoteResult.getPremium56())?0:Double.parseDouble(bizQuoteResult.getPremium56());
+            }
+        }
+        //附加修理期间费用补偿险  premium10	C	附加修理期间费用补偿险保费   非能源  无
+        // premium09XNY	C	附加车轮单独损失险保费   能源车  无
+        // premium10XNY	C	附加新增加设备损失险保费    能源车  无
+        //  premium11	C	附加新增加设备损失险保费    非能源  无
+        // 附加新增加设备损失险   暂时没有
+        //附加车身划痕损失险
+        if (InsurKind.L.getCode().equalsIgnoreCase(code)) {
+            if(xnyFlag){
+                //premium11XNY	C	附加车身划痕损失险保费
+                val = StringUtils.isBlank(bizQuoteResult.getPremium11XNY())?0:Double.parseDouble(bizQuoteResult.getPremium11XNY());
+            }else{
+                //premium17	C	附加车身划痕损失险保费
+                val = StringUtils.isBlank(bizQuoteResult.getPremium17())?0:Double.parseDouble(bizQuoteResult.getPremium17());
+            }
+        }
+        //附加法定节假日限额翻倍险
+        if (InsurKind.BD.getCode().equalsIgnoreCase(code)) {
+            if(xnyFlag){
+                //        * premium17XNY	C	附加法定节假日限额翻倍险保费
+                val = StringUtils.isBlank(bizQuoteResult.getPremium17XNY())?0:Double.parseDouble(bizQuoteResult.getPremium17XNY());
+            }else{
+                //premium74	C	附加法定节假日限额翻倍险保费    能源无
+                val = StringUtils.isBlank(bizQuoteResult.getPremium74())?0:Double.parseDouble(bizQuoteResult.getPremium74());
+            }
+        }
+        //premium32	C	附加精神损害抚慰金责任险(三者)保费    能源无
+        //premium30	C	附加精神损害抚慰金责任险(司机)保费      能源无
+        //         * premium31	C	附加精神损害抚慰金责任险(乘客)保费   能源无
+        //         * premium52	C	附加车轮单独损失险保费      能源无
+        //         * premium73	C	机动车钥匙丢失或损坏费用补偿险保费   能源无
+        //         *
+        //         * premium75	C	附加发动机损坏除外特约条款保费    能源无
+        // premium12XNY	C	附加修理期间费用补偿险保费    新能源  无
+        //premium13XNY	C	附加车上货物责任险保费
+        // * premium14XNY	C	附加精神损害抚慰金责任险(三者保费
+        // * premium15XNY	C	附加精神损害抚慰金责任险(司机保费
+        //* premium16XNY	C	附加精神损害抚慰金责任险(乘客保费
+        //* premium21XNY	C	附加外部电网故障损失险保费
+        //  * premium22XNY	C	附加自用充电桩损失保险保费
+        // * premium23XNY	C	附加自用充电桩责任保险保费
+        return val;
     }
 
     public HttpResult<QuoteRespVo> responseOrder(QuoteResponse response,
-                                                 QuoteRespVo quoteRespVo,
+                                                 PingAnQuoteRespVo quoteRespVo,
                                                  PtlAgreementAttribution ptlAgreementAttribution,
-                                                 String orderId,
-                                                 String userId,
-                                                 PinganApiLog pinganApiLog,
-                                                 CarConfirmResponse carConfirmResponse
+                                                 CarConfirmResponse carConfirmResponse,
+                                                 PingAnQuoteVo<Map<String,Object>> quoteVo
+
     ) {
         // 保存订单信息
         InsAreaCompany insAreaCompany = new InsAreaCompany(quoteRespVo, ptlAgreementAttribution);
-        //平安业务id
-        String flowid = response.getFlowid();
-        insAreaCompany.setReptxt(JSON.parseObject(JSON.toJSONString(response)));
+        //报价状态
         insAreaCompany.setOrderstatus(InsOrderStatusEnum.QUOTE_ING.getCode());
-        insAreaCompany.setInsOrderNo(flowid);
-        Map<String, Object> map = new HashMap<>();
-        QuoteResponse.AhsUpcActualPremiumDTO ahsUpcActualPremium = response.getAhsUpcActualPremium();
-        // 小微险保费
-        QuoteResponse.XwActualPremiumDTO xwActualPremium = response.getXwActualPremium();
-        map.put("xwActualPremium", xwActualPremium);
-        map.put("ahsUpcActualPremium", ahsUpcActualPremium);
-        //赋值驾意险信息
-        //insAreaCompany.setPingAnAccidentInfo(JSON.parseObject(JSON.toJSONString(map)));
+        //流程id
+        insAreaCompany.setFlowid(response.getFlowid());
+        //获取驾意险列表
+        List<Map<String, Object>> yjList = new QuoteRequest().getJsonList(quoteVo.getAccidentalDrivingVo(), quoteRespVo.getCyPremium(), quoteRespVo.getXwPremium(), quoteRespVo.getZhPremium());
+        if(CollectionUtils.isNotEmpty(yjList)){
+            insAreaCompany.setAccidentInfo(JSON.parseArray(JSON.toJSONString(yjList)));
+        }
         // 车船税
         QuoteResponse.ForceQuoteResultDTO.TaxDTO tax = response.getForceQuoteResult().getTax();
         TaxArrears taxArrears = new TaxArrears("往年欠税", Double.parseDouble(tax.getLastYearPay()),
                 Double.parseDouble(tax.getDelayPayMoney()));
         List<TaxArrears> taxArrearsList = Collections.singletonList(taxArrears);
         insAreaCompany.setTaxArrears(JSON.parseArray(JSON.toJSONString(taxArrearsList)));
-        insAreaCompany.setFlowid(flowid);
         // centile  商业险评分      商业险出现次数
         //商业出险次数
         if(response.getBizQuoteResult()!=null && response.getBizQuoteResult().getClaimNumber()!=null){
@@ -428,7 +629,6 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
         insAreaCompany.setSyRenewal("2".equals(carConfirmResponse.getBizRenewalType())?"1":carConfirmResponse.getBizRenewalType());
         insAreaCompanyService.insertCompanyAndOrders(insAreaCompany);
         quoteRespVo.setCompanyId(insAreaCompany.getId());
-
         return HttpResult.ok("报价成功", quoteRespVo);
     }
 
@@ -455,8 +655,8 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
         //图片
         List<InsUploadImagesDto> imgList = insTaskImagesMapper.getByOrderNoInsUploadImagesDtoList(insAreaCompany.getOrderno());
 
-       // List<InsTaskImagesBase64> insTaskImagesBase64s = insTaskImagesService.findByOrderNo(insOrders.getOrderno(),
-       //         insAreaCompany.getId(), true);
+        // List<InsTaskImagesBase64> insTaskImagesBase64s = insTaskImagesService.findByOrderNo(insOrders.getOrderno(),
+        //         insAreaCompany.getId(), true);
         if (imgList.isEmpty()) {
             return HttpResult.error("影像集合为空");
         } else {
@@ -482,7 +682,7 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
                 String documentFormat = fileName.split("\\.")[1];
                 boolean upLoadFileFlag = PingAnUpLoadUtils.getUpLoadFile(properties.getHost(), properties.getBucket(), properties.getAk(), properties.getSk(), file, key);
                 if(!upLoadFileFlag){
-                    throw new SystemException("上传影像文件失败");
+                    // throw new SystemException("上传影像文件失败");
                 }
                 UploadFilesRequest.DocListDTO docListDTO = new UploadFilesRequest.DocListDTO(key, documentClass, documentType, documentName,documentFormat ,
                         null, insAreaCompany.getJqapplyno(),null, parameters.getUserId(), "openApi");
@@ -749,8 +949,8 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
         PingAnConfigureParameters parameters = configureParametersComponents.toEntity(PingAnConfigureParameters.class,
                 ptlAgreementAttribution);
         List<String> list=new ArrayList<>();
-        String bizApplyNo = insAreaCompany.getJqpolicyno();
-        String forceApplyNo = insAreaCompany.getSypolicyno();
+        String bizApplyNo = insAreaCompany.getSyapplyno();
+        String forceApplyNo = insAreaCompany.getJqapplyno();
         if (StringUtils.isNotBlank(bizApplyNo)) {
             list.add(bizApplyNo);
         }
@@ -1081,16 +1281,18 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
                 } else if (("单商".equals(insAreaCompany.getProduct()) || "单三".equals(insAreaCompany.getProduct())) && sqflag) {
                     insAreaCompany.setSypolicyno(sypolicyno);
                 }
-                if(OrderStatusCodeEnum.ORDER_STATUS_CODE_B2.getCode().equals(status)){
+                String orderstatus = insAreaCompany.getOrderstatus();
+                if(OrderStatusCodeEnum.ORDER_STATUS_CODE_B2.getCode().equals(status)  && ("0".equals(orderstatus) || "1".equals(orderstatus))  ){
                     //已核保待缴费
                     insAreaCompany.setOrderstatus(InsOrderStatusEnum.WAIT_PAY.getCode());
-                }else if(OrderStatusCodeEnum.ORDER_STATUS_CODE_B5.getCode().equals(status)){
+                }else if(OrderStatusCodeEnum.ORDER_STATUS_CODE_B5.getCode().equals(status) && ("0".equals(orderstatus) || "1".equals(orderstatus) || "2".equals(orderstatus))  ){
                     //说明核保成功,更新大订单和小订单的状态为3  更新为已承保
                     if(StringUtils.isNotBlank(noticeNo)){
                         insAreaCompany.setNoticeNo(noticeNo);
                     }
                     insAreaCompany.setOrderstatus(InsOrderStatusEnum.ACCEPT_INSURANCE.getCode());
                 }
+
                 insAreaCompanyService.updateCompanyAndOrders(insAreaCompany);
                 return HttpResult.ok("更新状态成功");
 
@@ -1269,7 +1471,7 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
         } catch (Exception e) {
             throw new SystemException(e.getMessage());
         }
-        if (recoverApplyVerifyCodeResponse != null && "0".equals(recoverApplyVerifyCodeResponse.getResultCode())) {
+        if (recoverApplyVerifyCodeResponse != null && "0".equals(recoverApplyVerifyCodeResponse.getResultCode())  || (recoverApplyVerifyCodeResponse != null  && recoverApplyVerifyCodeResponse.getResultMessage().contains("已成功采集验证码"))) {
             return createNotice(companyId);
         }else{
             throw new SystemException(recoverApplyVerifyCodeResponse.getResultMessage());
@@ -1289,51 +1491,74 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
         // 通过 协议id获取配置实体
         PingAnConfigureParameters parameters = configureParametersComponents.toEntity(PingAnConfigureParameters.class,
                 ptlAgreementAttribution);
-        String forceApplyNo= insAreaCompany.getJqapplyno();
-        String  bizApplyNo = insAreaCompany.getSyapplyno();
         //生成通知单号
         ArrayList<String>  noticelist =new ArrayList<String>();
+        String bizApplyNo = insAreaCompany.getSyapplyno();
+        String forceApplyNo = insAreaCompany.getJqapplyno();
         if (StringUtils.isNotBlank(bizApplyNo)) {
             noticelist.add(bizApplyNo);
         }
         if (StringUtils.isNotBlank(forceApplyNo)) {
             noticelist.add(forceApplyNo);
         }
-        //生成通知单号
-        NoticeDoRequest noticeDoRequest = new NoticeDoRequest(parameters.getUserId(), noticelist);
-        NoticeDoResponse noticeDoResponse = null;
+        String noticeNo="";
         PinganApiLog pinganApiLog = new PinganApiLog(insAreaCompany.getOrderno(),companyId,insAreaCompany.getAgreementId());
-        try {
-            noticeDoResponse = pinganRequestApiComponents.createNoticeNo(noticeDoRequest,pinganApiLog);
-        } catch (Exception e) {
-            throw new SystemException(e.getMessage());
-        }
-        String noticeNo = noticeDoResponse.getNoticeNo();
-        ScanCodeURLRequest.DocumentDTO  noticeNoeDto=new  ScanCodeURLRequest.DocumentDTO(noticeNo,"07");
-        ArrayList<ScanCodeURLRequest.DocumentDTO>  scancodelist =new ArrayList<ScanCodeURLRequest.DocumentDTO>();
-        if (StringUtils.isNotBlank(noticeNo)) {
-            scancodelist.add(noticeNoeDto);
+        if(StringUtils.isNotBlank(insAreaCompany.getNoticeNo())){
+            noticeNo = insAreaCompany.getNoticeNo();
+        }else{
+            //生成通知单号
+            NoticeDoRequest noticeDoRequest = new NoticeDoRequest(parameters.getUserId(), noticelist);
+            NoticeDoResponse noticeDoResponse = null;
+            try {
+                noticeDoResponse = pinganRequestApiComponents.createNoticeNo(noticeDoRequest,pinganApiLog);
+            } catch (Exception e) {
+                throw new SystemException(e.getMessage());
+            }
+            noticeNo = noticeDoResponse.getNoticeNo();
         }
+
         // 获取支付的链接 只支持通知单号类型07    单证类型(01投保单02保单03批改申请单04批单05赔案号06报案号07通知单号)
         pinganApiLog.setId(null);
-        ScanCodeURLRequest scanCodeURLRequest = new ScanCodeURLRequest(scancodelist, "68",parameters.getUserId());
-        ScanCodeURLResponse scanCodeURLResponse = null;
+        ChexianStandardPrePaymentResponse chexianStandardPrePaymentResponse = null;
+        long currentTimeMillis = System.currentTimeMillis();
+        // 转换为秒,并去掉前10位(即 Tue Aug 20 18:26:39 GMT+08:00 2019 对应的秒数)
+        long seconds = currentTimeMillis / 1000L;
+        // 保留后13位
+        long l = seconds % 1000000000000L;
+        String tradeNo=properties.getClientId()+l ;
+        String clientId=properties.getClientId();
+        String mingwen=clientId +noticeNo+"CNY" +insAreaCompany.getSumpremium();
+        String signMsg = MD5Util.sha256Hex(mingwen);
+
+        ChexianStandardPrePaymentRequest  chexianStandardPrePaymentRequest =new ChexianStandardPrePaymentRequest(insAreaCompany.getSumpremium().toString(),null,null,noticeNo,null,null,tradeNo,signMsg,clientId,"CNY", properties.getClientId()+"车险保费",null);
         try {
-            scanCodeURLResponse = pinganRequestApiComponents.getScanCodeURL(scanCodeURLRequest,pinganApiLog);
+            chexianStandardPrePaymentResponse = pinganRequestApiComponents.chexianStandardPrePayment(chexianStandardPrePaymentRequest,pinganApiLog);
         } catch (Exception e) {
             throw new SystemException(e.getMessage());
         }
-        String payUrl = "";
-        //成功将支付的url链接赋值
-        if (scanCodeURLResponse != null && ScanCodeURLResponseCodeEnum.SCAN_CODE_URL_CODE_MSG_Y.getCode().equals(scanCodeURLResponse.getResultCode())) {
-            payUrl = scanCodeURLResponse.getScanCodeURLList().get(0).getScanCodeURL();
-        } else {
-            return HttpResult.error("二维码支付接口报错");
-        }
-        insAreaCompany.setPaymentLink(payUrl);
-        return HttpResult.ok(payUrl);
+        return HttpResult.ok(chexianStandardPrePaymentResponse.getPayUrl());
     }
     /**
+     *
+     *  ScanCodeURLRequest scanCodeURLRequest = new ScanCodeURLRequest(scancodelist, "68",parameters.getUserId());
+     *         ScanCodeURLResponse scanCodeURLResponse = null;
+     *         try {
+     *             scanCodeURLResponse = pinganRequestApiComponents.getScanCodeURL(scanCodeURLRequest,pinganApiLog);
+     *         } catch (Exception e) {
+     *             throw new SystemException(e.getMessage());
+     *         }
+     *         String payUrl = "";
+     *         //成功将支付的url链接赋值
+     *         if (scanCodeURLResponse != null && ScanCodeURLResponseCodeEnum.SCAN_CODE_URL_CODE_MSG_Y.getCode().equals(scanCodeURLResponse.getResultCode())) {
+     *             payUrl = scanCodeURLResponse.getScanCodeURLList().get(0).getScanCodeURL();
+     *         } else {
+     *             return HttpResult.error("二维码支付接口报错");
+     *         }
+     *         insAreaCompany.setPaymentLink(payUrl);
+     *
+     * /
+
+     /**
      *  @version
      *  @author: hxl
      *  @Date: 2024/7/22 18:57
@@ -1348,10 +1573,10 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
         PingAnConfigureParameters parameters = configureParametersComponents.toEntity(PingAnConfigureParameters.class,
                 ptlAgreementAttribution);
         PinganApiLog pinganApiLog = new PinganApiLog(insAreaCompany.getOrderno(),companyId,insAreaCompany.getAgreementId());
-        String bizApplyNo = insAreaCompany.getJqpolicyno();
-        String forceApplyNo = insAreaCompany.getSypolicyno();
         //生成通知单号
         ArrayList<String>  noticelist =new ArrayList<String>();
+        String bizApplyNo = insAreaCompany.getSyapplyno();
+        String forceApplyNo = insAreaCompany.getJqapplyno();
         if (StringUtils.isNotBlank(bizApplyNo)) {
             noticelist.add(bizApplyNo);
         }
@@ -1563,8 +1788,8 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
             pinganApiLog.setId(null);
             pinganApiLog.setRequestUrl("/payReturn");
             pinganApiLog.setRequestType("支付回调");
-            pinganApiLog.setRequestParam(payReturnRequest.toString());
-            pinganApiLog.setResponseBody(null);
+            pinganApiLog.setRequestParam(new Gson().toJson(payReturnRequest));
+            pinganApiLog.setResponseBody(payReturnRequest.getResultMsg()+"-"+payReturnRequest.getErrorMsg());
             pinganApiLogService.save(pinganApiLog);
             // 账号信息
             PtlAgreementAttribution ptlAgreementAttribution = ptlAgreementAttributionService.getById(insAreaCompany.getAgreementId());
@@ -1572,8 +1797,8 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
             PingAnConfigureParameters parameters = configureParametersComponents.toEntity(PingAnConfigureParameters.class,
                     ptlAgreementAttribution);
             List<String> list = new ArrayList<>();
-            String bizApplyNo = insAreaCompany.getJqpolicyno();
-            String forceApplyNo = insAreaCompany.getSypolicyno();
+            String bizApplyNo = insAreaCompany.getSyapplyno();
+            String forceApplyNo = insAreaCompany.getJqapplyno();
             if (StringUtils.isNotBlank(bizApplyNo)) {
                 list.add(bizApplyNo);
             }
@@ -1592,24 +1817,34 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
                 if (documentStatusListResponse != null && "0".equals(documentStatusListResponse.getResultCode())) {
                     ArrayList<DocumentStatusListResponse.DocumentDTO> documentList = documentStatusListResponse.getDocumentList();
                     String status = "";
+                    String policyNo ="";
                     if (documentList != null && documentList.size() > 0) {
                         Boolean flag = false;
-                        //B2 为 未缴费
                         for (DocumentStatusListResponse.DocumentDTO dto : documentList) {
                             status = dto.getStatus();
-                            if (!OrderStatusCodeEnum.ORDER_STATUS_CODE_B5.getCode().equals(dto.getStatus())) {
+                            policyNo = dto.getPolicyNo();
+                            if (OrderStatusCodeEnum.ORDER_STATUS_CODE_B5.getCode().equals(dto.getStatus())) {
                                 flag = false;
                             }
                         }
+                        insAreaCompany.setJqpolicyno(policyNo);
                         //已承保更新承保状态
-                        if (!flag && OrderStatusCodeEnum.ORDER_STATUS_CODE_B5.getCode().equals(status)) {
+                        if (OrderStatusCodeEnum.ORDER_STATUS_CODE_B5.getCode().equals(status) && ("0".equals(insAreaCompany.getOrderstatus()) || "1".equals(insAreaCompany.getOrderstatus()) || "2".equals(insAreaCompany.getOrderstatus())) ) {
                             insAreaCompany.setOrderstatus(InsOrderStatusEnum.ACCEPT_INSURANCE.getCode());
                             insAreaCompanyService.updateCompanyAndOrders(insAreaCompany);
-                            return HttpResult.ok("承保成功");
+                            return HttpResult.ok("支付成功");
                         }
                     }
                 }
             }
+        }else{
+            PinganApiLog pinganApiLog = new PinganApiLog(null,null,null);
+            pinganApiLog.setId(null);
+            pinganApiLog.setRequestUrl("/payReturn");
+            pinganApiLog.setRequestType("支付回调");
+            pinganApiLog.setRequestParam(new Gson().toJson(payReturnRequest));
+            pinganApiLog.setResponseBody(payReturnRequest.getResultMsg()+"-"+payReturnRequest.getErrorMsg());
+            pinganApiLogService.save(pinganApiLog);
         }
         return HttpResult.error("支付失败");
     }

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

@@ -972,21 +972,21 @@ public class YongchengOrderApiServiceImpl implements YongchengOrderApiService {
                 //标志
                 if (StringUtils.isNotEmpty(pResp.getPolicyBZUrl())) {
                     String bzInsUrl = pResp.getPolicyBZUrl().replaceAll(";pkid", "&pkid");
-                    String jqFlagUrl = gainCarInsPolicy(bzInsUrl, licensePlate + policyNo + jqbz, licensePlate);
+                    String jqFlagUrl = gainCarInsPolicy(bzInsUrl, licensePlate + policyNo + jqbz, iac.getId());
                     cipDto.setJqFlagUrl(jqFlagUrl);
                 }
 
                 //交强
                 if (StringUtils.isNotEmpty(pResp.getJqpolicyUrl())) {
                     String jqInsUrl = pResp.getJqpolicyUrl().replace(";pkid", "&pkid");
-                    String jqUrl = gainCarInsPolicy(jqInsUrl, licensePlate + policyNo + jqbd, licensePlate);
+                    String jqUrl = gainCarInsPolicy(jqInsUrl, licensePlate + policyNo + jqbd, iac.getId());
                     cipDto.setJqUrl(jqUrl);
                 }
 
                 //商业
                 if (StringUtils.isNotEmpty(pResp.getSypolicyUrl())) {
                     String syInsUrl = pResp.getSypolicyUrl().replace(";pkid", "&pkid");
-                    String syUrl = gainCarInsPolicy(syInsUrl, licensePlate + policyNo + sybd, licensePlate);
+                    String syUrl = gainCarInsPolicy(syInsUrl, licensePlate + policyNo + sybd, iac.getId());
                     cipDto.setSyUrl(syUrl);
 
                 }
@@ -994,7 +994,7 @@ public class YongchengOrderApiServiceImpl implements YongchengOrderApiService {
                 // 非车险
                 if (StringUtils.isNotEmpty(pResp.getYwpolicUrl())) {
                     String jyInsUrl = pResp.getYwpolicUrl().replace(";pkid", "&pkid");
-                    String jyUrl = gainCarInsPolicy(jyInsUrl, licensePlate + policyNo + jybd, licensePlate);
+                    String jyUrl = gainCarInsPolicy(jyInsUrl, licensePlate + policyNo + jybd, iac.getId());
                     cipDto.setJyUrl(jyUrl);
                 }
 

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

@@ -433,7 +433,7 @@ public class ZhongMeiOrderApiServiceImpl implements ZhongMeiOrderApiService {
                     }
 
                 }
-                String transferUrl = gainCarInsPolicy(url, licensePlate + templateName, licensePlate);
+                String transferUrl = gainCarInsPolicy(url, licensePlate + templateName, insAreaCompany.getId());
                 List<String> transferUrlList = new ArrayList<>();
                 transferUrlList.add(transferUrl);
                 response.setDownloadUrl(transferUrlList);

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

@@ -326,7 +326,7 @@ public class ZijinOrderApiServiceImpl implements ZijinOrderApiService {
 
         String code = busType.getCode();
         String url = zijinRequestApiComponents.getDownLoadDocumentUrl(busNo, code, identifyNo);
-        String transferUrl = gainCarInsPolicy(url, licensePlate + templateName, licensePlate);
+        String transferUrl = gainCarInsPolicy(url, licensePlate + templateName, insAreaCompany.getId());
         return HttpResult.ok("生成成功", transferUrl);
     }
 

+ 131 - 0
src/main/java/com/ydtech/modules/order/utils/MD5Util.java

@@ -0,0 +1,131 @@
+package com.ydtech.modules.order.utils;
+
+
+import java.io.UnsupportedEncodingException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+public class MD5Util {
+
+    private static final String HEX_CHARS = "0123456789abcdef";
+    private MD5Util() {}
+
+   /**
+     * 返回 MessageDigest MD5
+     */
+   private static MessageDigest getDigest() {
+	   try {
+           return MessageDigest.getInstance("MD5");
+       } catch (NoSuchAlgorithmException e) {
+           throw new RuntimeException(e);
+       }
+    }
+   
+   /**
+    * 返回 MessageDigest MD5
+    */
+  private static MessageDigest getDigestBySha() {
+	   try {
+          return MessageDigest.getInstance("SHA-256");
+      } catch (NoSuchAlgorithmException e) {
+          throw new RuntimeException(e);
+      }
+   }
+
+    /**
+     * MD5加密,并返回作为一个十六进制字节
+     */
+    public static byte[] md5(byte[] data) {
+        return getDigest().digest(data);
+    }
+
+    /**
+     * SHA-256加密,并返回作为一个十六进制字节
+     */
+    public static byte[] sha256(byte[] data) {
+        return getDigestBySha().digest(data);
+    }
+
+    /**
+     * MD5加密,并返回作为一个十六进制字节
+     * <code>byte[]</code>.
+     * 
+     * @param data
+     *            Data to digest
+     * @return MD5 digest
+     */
+    public static byte[] md5(String data) {
+    	byte[] bytes = null;
+        try {
+        	bytes = md5(data.getBytes("UTF-8"));
+		} catch (UnsupportedEncodingException e) {
+			//LogUtil.error("MD5加密出错。",e);
+		}
+		return bytes;
+    }
+
+    /**
+     * MD5加密,并返回一个32字符的十六进制值
+     */
+    public static String md5Hex(byte[] data) {
+        return toHexString(md5(data));
+    }
+
+    /**
+     * MD5加密,并返回一个32字符的十六进制值
+     */
+    public static String md5Hex(String data) {
+        return toHexString(md5(data));
+    }
+    /**
+     * SHA256加密
+     */
+    public static String sha256Hex(String data) {
+        try {
+			return toHexString(sha256(data.getBytes("UTF-8")));
+		} catch (UnsupportedEncodingException e) {
+			//LogUtil.error("MD5加密出错。",e);
+			return null;
+		}
+    }
+    
+    private static String toHexString(byte[] b) {
+        StringBuffer stringbuffer = new StringBuffer();
+        for (int i = 0; i < b.length; i++) {
+        	stringbuffer.append(HEX_CHARS.charAt(b[i] >>> 4 & 0x0F));
+        	stringbuffer.append(HEX_CHARS.charAt(b[i] & 0x0F));
+        }
+        return stringbuffer.toString();
+    }
+
+	/**
+	 * MD5加密
+	 * @param s
+	 * @return
+	 */
+	public static String MD5(String s) {
+		char hexDigits[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9','A', 'B', 'C', 'D', 'E', 'F' };
+		try {
+			byte[] btInput = s.getBytes("UTF-8");
+			// 获得MD5摘要算法的 MessageDigest 对象
+			MessageDigest mdInst = MessageDigest.getInstance("MD5");
+			// 使用指定的字节更新摘要
+			mdInst.update(btInput);
+			// 获得密文
+			byte[] md = mdInst.digest();
+			// 把密文转换成十六进制的字符串形式
+			int j = md.length;
+			char str[] = new char[j * 2];
+			int k = 0;
+			for (int i = 0; i < j; i++) {
+				byte byte0 = md[i];
+				str[k++] = hexDigits[byte0 >>> 4 & 0xf];
+				str[k++] = hexDigits[byte0 & 0xf];
+			}
+			return new String(str);
+		} catch (Exception e) {
+			
+			return null;
+		}
+	}
+}

+ 8 - 8
src/main/resources/application-pre.yml

@@ -22,14 +22,14 @@ baidu:
 
 #银联API参数配置
 unionPay:
-  appId: 111
-  appKey: 1111
-  accessTokenUrl: https://test-api-open.chinaums.com/v2/token/acces
-  2FactorVerifyUrl: https://test-api-open.chinaums.com/v1/datacenter/smartverification/encrypted/mobile/2factor/verify
-  bankCardVerifyUrl: https://test-api-open.chinaums.com/v1/datacenter/smartverification/encrypted/bankcard/verify
-  publicKey: 0414bb7e9c3914bb65b85079b1dc6e1ca2a0ee04dd9bb55b2f8d31704a6dec0cca695739e128f9c931330e1c0f493be4d56244236434c9d344c4716ba64a4470ba
-  privateKey:
-
+  api:
+    appId: 111
+    appKey: 1111
+    accessTokenUrl: https://test-api-open.chinaums.com/v2/token/acces
+    factorVerifyUrl: https://test-api-open.chinaums.com/v1/datacenter/smartverification/encrypted/mobile/2factor/verify
+    bankCardVerifyUrl: https://test-api-open.chinaums.com/v1/datacenter/smartverification/encrypted/bankcard/verify
+    publicKey: 0414bb7e9c3914bb65b85079b1dc6e1ca2a0ee04dd9bb55b2f8d31704a6dec0cca695739e128f9c931330e1c0f493be4d56244236434c9d344c4716ba64a4470ba
+    privateKey:
 aly:
   cbit:
     url_pre: http://223.70.186.115:80/CBIT/API/insCBIT

+ 8 - 7
src/main/resources/application-prod.yml

@@ -22,13 +22,14 @@ baidu:
 
 #银联API参数配置
 unionPay:
-  appId: 111
-  appKey: 1111
-  accessTokenUrl: https://test-api-open.chinaums.com/v2/token/acces
-  2FactorVerifyUrl: https://test-api-open.chinaums.com/v1/datacenter/smartverification/encrypted/mobile/2factor/verify
-  bankCardVerifyUrl: https://test-api-open.chinaums.com/v1/datacenter/smartverification/encrypted/bankcard/verify
-  publicKey: 0414bb7e9c3914bb65b85079b1dc6e1ca2a0ee04dd9bb55b2f8d31704a6dec0cca695739e128f9c931330e1c0f493be4d56244236434c9d344c4716ba64a4470ba
-  privateKey:
+  api:
+    appId: 111
+    appKey: 1111
+    accessTokenUrl: https://test-api-open.chinaums.com/v2/token/acces
+    factorVerifyUrl: https://test-api-open.chinaums.com/v1/datacenter/smartverification/encrypted/mobile/2factor/verify
+    bankCardVerifyUrl: https://test-api-open.chinaums.com/v1/datacenter/smartverification/encrypted/bankcard/verify
+    publicKey: 0414bb7e9c3914bb65b85079b1dc6e1ca2a0ee04dd9bb55b2f8d31704a6dec0cca695739e128f9c931330e1c0f493be4d56244236434c9d344c4716ba64a4470ba
+    privateKey:
 
 aly:
   cbit:

+ 8 - 7
src/main/resources/application-test.yml

@@ -24,13 +24,14 @@ baidu:
 
 #银联API参数配置
 unionPay:
-  appId: 111
-  appKey: 1111
-  accessTokenUrl: https://test-api-open.chinaums.com/v2/token/acces
-  2FactorVerifyUrl: https://test-api-open.chinaums.com/v1/datacenter/smartverification/encrypted/mobile/2factor/verify
-  bankCardVerifyUrl: https://test-api-open.chinaums.com/v1/datacenter/smartverification/encrypted/bankcard/verify
-  publicKey: 0414bb7e9c3914bb65b85079b1dc6e1ca2a0ee04dd9bb55b2f8d31704a6dec0cca695739e128f9c931330e1c0f493be4d56244236434c9d344c4716ba64a4470ba
-  privateKey:
+  api:
+    appId: 111
+    appKey: 1111
+    accessTokenUrl: https://test-api-open.chinaums.com/v2/token/acces
+    factorVerifyUrl: https://test-api-open.chinaums.com/v1/datacenter/smartverification/encrypted/mobile/2factor/verify
+    bankCardVerifyUrl: https://test-api-open.chinaums.com/v1/datacenter/smartverification/encrypted/bankcard/verify
+    publicKey: 0414bb7e9c3914bb65b85079b1dc6e1ca2a0ee04dd9bb55b2f8d31704a6dec0cca695739e128f9c931330e1c0f493be4d56244236434c9d344c4716ba64a4470ba
+    privateKey:
 
 aly:
   cbit:

+ 291 - 5
src/main/resources/mapper/modules/fnc/InsPlyIncomeMapper.xml

@@ -2451,6 +2451,9 @@
             <if test="vo.type !=null  and  vo.type  !=''">
                 and pa.agreement_type =#{vo.type}
             </if>
+            <if test="vo.isNotCar !=null  and  vo.isNotCar  !=''">
+                and a.is_not_car =#{vo.isNotCar}
+            </if>
             <if test="vo.beginDate  != null  and  vo.beginDate!=''  and vo.endDate  != null  and  vo.endDate!=''">
                 AND  a.create_time  BETWEEN #{vo.beginDate} AND #{vo.endDate}
             </if>
@@ -2529,14 +2532,14 @@
             resultType="com.ydtech.modules.admin.model.report.financialReceivables.FinancialReceivablesAllMonthVo">
         SELECT
             SUM(IFNULL(a.commission_feevalue ,0 ) + IFNULL(a.other_feevalue ,0 )) AS ysSumAmount,
-            SUM(CASE WHEN a.handling_fees_status = '0' THEN IFNULL(a.commission_feevalue ,0 ) + IFNULL(a.other_feevalue ,0 ) ELSE 0 END ) AS "ysSumAmount",
+            SUM(CASE WHEN a.handling_fees_status = '0' THEN IFNULL(a.commission_feevalue ,0 ) + IFNULL(a.other_feevalue ,0 ) ELSE 0 END ) AS "yisSumAmount",
             SUM(CASE WHEN a.handling_fees_status = '1' THEN IFNULL(a.commission_feevalue ,0 ) + IFNULL(a.other_feevalue ,0 ) ELSE 0 END) AS "wsSumAmount"
         FROM
             ins_ply_income a
-                LEFT JOIN
+            LEFT JOIN
             ptl_agreement pa ON pa.id = a.agreement_id
-        where
         <where>
+            1=1
             <if test="vo.type !=null  and  vo.type  !=''">
                 and pa.agreement_type =#{vo.type}
             </if>
@@ -2545,11 +2548,294 @@
             </if>
         </where>
     </select>
-    <select id="queryDateByTypeByMonthList"
-            resultType="com.ydtech.modules.admin.model.report.financialReceivables.FinancialReceivablesMonthVo">
 
+    <select id="queryDateByTypeByMonthList"  resultType="com.ydtech.modules.admin.model.report.financialReceivables.FinancialReceivablesMonthVo">
+        SELECT
+            a.subPathner,
+            sa.area_cname as "areaName",
+            eic.namesimple as "companyName",
+            a.handlingReceivable  as "commissionFeevalue",
+            a.partnerCompaniesId  as "partnerCompaniesId",
+            a.companyId as "companyId",
+            IFNULL(a.settleAmount ,0 )   as "settlementAmount",
+            a.unlicensedHandlingFee  as "noSettlementAmount",
+            IFNULL(a.unlicensedHandlingFee ,0 ) + IFNULL(a.settleAmount,0 ) as  "noInvoicCommissionFeevalue",
+            "手续费" as  "isHand",
+            IFNULL(a.handlingReceivable ,0 ) - IFNULL((IFNULL(a.unlicensedHandlingFee ,0 ) + IFNULL(a.settleAmount,0 )),0 ) as  "readyCommissionFeevalue"
+        FROM
+            (SELECT
+                 SUBSTRING( a.partner_companies_id, 6, 11 ) AS "subPathner",
+                 a.company_id as "companyId",
+                 a.partner_companies_id as "partnerCompaniesId",
+                 sum( a.commission_feevalue ) as "handlingReceivable",
+                 SUM( CASE WHEN a.handling_fees_status = '0' THEN a.commission_feevalue ELSE 0 END ) AS "unlicensedHandlingFee",
+                 MAX(b.noSettHandlingFee) AS "settleAmount"
+             FROM
+                 ins_ply_income a
+                     LEFT JOIN ptl_agreement pa ON a.agreement_id = pa.id
+                     LEFT JOIN (
+                     SELECT
+                         sum(a.commission_feevalue)  as "invoicAmount",
+                         IFNULL(sum(a.commission_feevalue) ,0 ) - IFNULL(max(b.settlementAmount) ,0 ) as  "noSettHandlingFee",
+                         a.signdate,
+                         a.task_id as "taskId" ,
+                        a.partner_companies_id  as "subPathner"
+                     FROM
+                         ins_ply_income a
+                             LEFT JOIN ptl_agreement pa ON a.agreement_id = pa.id
+                             LEFT JOIN (
+                             select sum(settlement_amount) as "settlementAmount", a.task_id  as "taskId" from settlement_documentary_fees   a
+                             <where>
+                                 a.task_id IS NOT NULL
+                                 and a.settlement_status ='2'
+                                 <if test="vo.isNoCar !=null  and  vo.isNoCar  !=''">
+                                     and a.handling_fees_status =#{vo.isNoCar}
+                                 </if>
+                             </where>
+                             GROUP BY  a.task_id
+                         ) b  on  a.task_id=b.taskId
+                     <where>
+                         pa.agreement_type = '2'
+                         AND a.is_not_documentary = '0'
+                         AND a.task_id  is not  null
+                         <if test="vo.beginDate  != null  and  vo.beginDate!=''  and vo.endDate  != null  and  vo.endDate!=''">
+                             AND  a.signdate  BETWEEN #{vo.beginDate} AND #{vo.endDate}
+                         </if>
+                         <if test="vo.isNoCar !=null  and  vo.isNoCar  !=''">
+                             and a.is_not_car =#{vo.isNoCar}
+                         </if>
+                     </where>
+                     GROUP BY
+                         a.task_id , a.signdate,a.partner_companies_id
+                 ) b  on  b.subPathner = a.partner_companies_id
+             <where>
+                 pa.agreement_type = '2'
+                 AND a.is_not_documentary = '0'
+                 <if test="vo.beginDate  != null  and  vo.beginDate!=''  and vo.endDate  != null  and  vo.endDate!=''">
+                     AND  a.signdate  BETWEEN #{vo.beginDate} AND #{vo.endDate}
+                 </if>
+                 <if test="vo.isNoCar !=null  and  vo.isNoCar  !=''">
+                     and a.is_not_car =#{vo.isNoCar}
+                 </if>
+             </where>
+             GROUP BY
+        a.partner_companies_id ,a.company_id) a
+        LEFT JOIN esm_ins_company  eic  on eic.id = a.companyId
+        LEFT JOIN sys_area  sa  on sa.area_code = a.subPathner
+    </select>
+
+
+    <select id="queryDateByTypeByMonthOtherList"  resultType="com.ydtech.modules.admin.model.report.financialReceivables.FinancialReceivablesMonthVo">
+        SELECT
+            a.partner_companies_id,
+            sa.area_cname as "areaName",
+            eic.namesimple as "companyName",
+            sum(a.other_feevalue) as "commissionFeevalue",
+            IFNULL(max(b.invoicedSettledAmount) ,0 ) as "readyCommissionFeevalue",
+            sum(a.other_feevalue) -IFNULL(max(b.invoicedSettledAmount) ,0 ) as "noInvoicCommissionFeevalue",
+            IFNULL(max(b.invoicedNotSettledAmount) ,0 )  as "settlementAmount",
+            sum(a.other_feevalue) -IFNULL(max(b.invoicedSettledAmount) ,0 )-IFNULL(max(b.invoicedNotSettledAmount) ,0 ) as "noSettlementAmount",
+            SUBSTRING( a.partner_companies_id, 6, 11 ) AS "subPathner",
+            "跟单费" as  "isHand",
+            a.company_id AS "companyId"
+        FROM
+            ins_ply_income a
+                LEFT JOIN ptl_agreement pa ON a.agreement_id = pa.id
+                LEFT JOIN (
+                SELECT
+                    a.partner_companies_id,
+                    sum(a.invoiced_settled_amount)  as  "invoicedSettledAmount",
+                    sum(a.Invoiced_not_settled_amount)  as  "invoicedNotSettledAmount"
+                FROM
+                    settlement_documentary_fees a
+                <where>
+                    a.settlement_sum_id IS NOT NULL
+                    AND settlement_status = '1'
+                    <if test="vo.beginDate  != null  and  vo.beginDate!=''  and vo.endDate  != null  and  vo.endDate!=''">
+                        AND  a.signing_time  BETWEEN #{vo.beginDate} AND #{vo.endDate}
+                    </if>
+                    <if test="vo.isNoCar !=null  and  vo.isNoCar  !=''">
+                        and a.is_not_car =#{vo.isNoCar}
+                    </if>
+                </where>
+                GROUP BY
+                    a.partner_companies_id
+            )  b  on b.partner_companies_id =a.partner_companies_id
+                LEFT JOIN esm_ins_company  eic  on eic.id = a.company_Id
+                LEFT JOIN sys_area  sa  on sa.area_code = SUBSTRING( a.partner_companies_id, 6, 11 )
+        <where>
+            pa.agreement_type = '2'
+            AND a.is_not_documentary = '1'
+            <if test="vo.beginDate  != null  and  vo.beginDate!=''  and vo.endDate  != null  and  vo.endDate!=''">
+                AND  a.signdate  BETWEEN #{vo.beginDate} AND #{vo.endDate}
+            </if>
+            <if test="vo.isNoCar !=null  and  vo.isNoCar  !=''">
+                and a.is_not_car =#{vo.isNoCar}
+            </if>
+        </where>
+        group by
+            a.partner_companies_id,a.company_id,sa.area_cname
+    </select>
+
+
+    <select id="queryPlatHanding"  resultType="com.ydtech.modules.admin.model.report.financialReceivables.FinancialReceivablesMonthVo">
+        SELECT
+            1  as  orderNumber,
+            '手续费' AS isHand,
+            sa.area_cname AS areaName,
+            eic.namesimple AS companyName,
+            a.partner_companies_id AS partnerCompaniesId,
+            SUM(a.commission_feevalue) AS commissionFeevalue,
+            SUBSTRING( a.partner_companies_id, 6, 11 ) AS "subPathner",
+            SUM(CASE WHEN a.handling_fees_status = '1' THEN a.commission_feevalue ELSE 0 END) AS "readyCommissionFeevalue",
+            SUM(CASE WHEN a.handling_fees_status = '0' THEN a.commission_feevalue ELSE 0 END) AS "noInvoicCommissionFeevalue"
+        FROM
+            ins_ply_income a
+                LEFT JOIN ptl_agreement pa ON a.agreement_id = pa.id
+                LEFT JOIN sys_area sa ON sa.area_code = SUBSTRING(a.partner_companies_id, 6, 11)
+                LEFT JOIN esm_ins_company eic ON eic.id = a.company_id
+        <where>
+            pa.agreement_type = '1'
+            AND a.is_not_documentary = '1'
+            <if test="vo.beginDate  != null  and  vo.beginDate!=''  and vo.endDate  != null  and  vo.endDate!=''">
+                AND  a.signdate  BETWEEN #{vo.beginDate} AND #{vo.endDate}
+            </if>
+            <if test="vo.isNoCar !=null  and  vo.isNoCar  !=''">
+                and a.is_not_car =#{vo.isNoCar}
+            </if>
+        </where>
+        GROUP BY
+            a.partner_companies_id, eic.namesimple, sa.area_cname
 
+        UNION ALL
 
+        SELECT
+            2  as  orderNumber,
+            '跟单费' AS isHand,
+            sa.area_cname AS areaName,
+            eic.namesimple AS companyName,
+            a.partner_companies_id AS partnerCompaniesId,
+            SUM(a.other_feevalue) AS commissionFeevalue,
+            SUBSTRING( a.partner_companies_id, 6, 11 ) AS "subPathner",
+            SUM(CASE WHEN a.handling_fees_status = '1' THEN a.other_feevalue ELSE 0 END) AS "readyCommissionFeevalue",
+            SUM(CASE WHEN a.handling_fees_status = '0' THEN a.other_feevalue ELSE 0 END) AS "noInvoicCommissionFeevalue"
+        FROM
+            ins_ply_income a
+                LEFT JOIN ptl_agreement pa ON a.agreement_id = pa.id
+                LEFT JOIN sys_area sa ON sa.area_code = SUBSTRING(a.partner_companies_id, 6, 11)
+                LEFT JOIN esm_ins_company eic ON eic.id = a.company_id
+        <where>
+            pa.agreement_type = '1'
+            <if test="vo.beginDate  != null  and  vo.beginDate!=''  and vo.endDate  != null  and  vo.endDate!=''">
+                AND  a.signdate  BETWEEN #{vo.beginDate} AND #{vo.endDate}
+            </if>
+            <if test="vo.isNoCar !=null  and  vo.isNoCar  !=''">
+                and a.is_not_car =#{vo.isNoCar}
+            </if>
+        </where>
+        GROUP BY
+            a.partner_companies_id, eic.namesimple, sa.area_cname
+        UNION ALL
+        SELECT
+            3  as  orderNumber,
+            '合计' AS isHand,
+            sa.area_cname AS areaName,
+            eic.namesimple AS companyName,
+            a.partner_companies_id AS partnerCompaniesId,
+            SUM(a.all_fee_value) AS commissionFeevalue,
+            SUBSTRING( a.partner_companies_id, 6, 11 ) AS "subPathner",
+            SUM(CASE WHEN a.handling_fees_status = '1' THEN a.all_fee_value ELSE 0 END) AS "readyCommissionFeevalue",
+            SUM(CASE WHEN a.handling_fees_status = '0' THEN a.all_fee_value ELSE 0 END) AS "noInvoicCommissionFeevalue"
+        FROM
+            ins_ply_income a
+                LEFT JOIN ptl_agreement pa ON a.agreement_id = pa.id
+                LEFT JOIN sys_area sa ON sa.area_code = SUBSTRING(a.partner_companies_id, 6, 11)
+                LEFT JOIN esm_ins_company eic ON eic.id = a.company_id
+        <where>
+            pa.agreement_type = '1'
+            <if test="vo.beginDate  != null  and  vo.beginDate!=''  and vo.endDate  != null  and  vo.endDate!=''">
+                AND  a.signdate  BETWEEN #{vo.beginDate} AND #{vo.endDate}
+            </if>
+            <if test="vo.isNoCar !=null  and  vo.isNoCar  !=''">
+                and a.is_not_car =#{vo.isNoCar}
+            </if>
+        </where>
+        GROUP BY
+            a.partner_companies_id, eic.namesimple, sa.area_cname
+        ORDER BY
+            companyName,
+            areaName,
+            orderNumber;
+    </select>
 
+    <select id="queryPrivateCar" resultType="com.ydtech.modules.admin.model.report.financialReceivables.FinancialReceivablesVo">
+        SELECT
+            DATE_FORMAT( a.signdate, '%Y-%m' )  as "yearAndMonth" ,
+            sum(a.all_fee_value)  as "commissionFeevalue",
+            IFNULL(max(b.readyCommissionFeevalue),0) + IFNULL(max(c.readyCommissionFeevalue1),0)  as  "noInvoicCommissionFeevalue",
+            sum(a.all_fee_value) -(IFNULL(max(b.readyCommissionFeevalue),0) + IFNULL(max(c.readyCommissionFeevalue1),0)) as "readyCommissionFeevalue",
+            (IFNULL(max(b.inSettlementAmount),0) -IFNULL(sum(b.readyCommissionFeevalue),0)) +IFNULL(max(c.settlementAmount),0)  as "settlementAmount",
+            IFNULL(max(c.noInvoicCommissionFeevalue),0)  + ((SUM( CASE WHEN a.handling_fees_status = '0' and a.is_not_documentary ='0' THEN a.all_fee_value ELSE 0 END ))) as "noSettlementAmount"
+        FROM
+            ins_ply_income a
+                LEFT JOIN ptl_agreement pa ON a.agreement_id = pa.id
+                left join (
+                SELECT
+                    SUM( CASE WHEN settlement_status = '2' THEN a.settlement_amount ELSE 0 END )  as "readyCommissionFeevalue",
+                    SUM( CASE WHEN settlement_status = '1' THEN a.settlement_amount ELSE 0 END )  as "inSettlementAmount",
+                    a.task_id AS "taskId"
+                FROM
+                    settlement_documentary_fees a
+                <where>
+                    a.task_id IS NOT NULL
+                    <if test="vo.isNotCar !=null  and  vo.isNotCar  !=''">
+                        and a.is_not_car =#{vo.isNotCar}
+                    </if>
+                </where>
+                GROUP BY
+                    a.task_id
+            )  b   on  b .taskId =a.task_id
+                left  join (
+                SELECT
+                    DATE_FORMAT( a.signing_time, '%Y-%m' ) as "singDateYear",
+                    sum( a.invoiced_settled_amount ) AS "readyCommissionFeevalue1",
+                    sum( a.Invoiced_not_settled_amount ) AS "settlementAmount",
+                    SUM( CASE WHEN settlement_status = '1' THEN a.settlement_amount ELSE 0 END )  as "invoiceAmount",
+                    IFNULL(sum(b.otherallFeeValue),0) -sum( a.invoiced_settled_amount ) as "noInvoicCommissionFeevalue",
+                    IFNULL(sum(b.otherallFeeValue),0) -sum( a.invoiced_settled_amount ) - SUM( CASE WHEN settlement_status = '1' THEN a.settlement_amount ELSE 0 END ) as "noSettlementAmount"
+                FROM
+                    settlement_documentary_fees a
+                        left join  (
+                        select sum(a.all_fee_value) as "otherallFeeValue", DATE_FORMAT( a.signdate, '%Y-%m' ) as "singDateYear"  from  ins_ply_income a
+                        LEFT JOIN ptl_agreement pa ON a.agreement_id = pa.id
+                        <where>
+                            pa.agreement_type= '2'
+                            and a.is_not_documentary='1'
+                            <if test="vo.isNotCar !=null  and  vo.isNotCar  !=''">
+                                and a.is_not_car =#{vo.isNotCar}
+                            </if>
+                            <if test="vo.beginDate  != null  and  vo.beginDate!=''  and vo.endDate  != null  and  vo.endDate!=''">
+                                AND  a.signdate  BETWEEN #{vo.beginDate} AND #{vo.endDate}
+                            </if>
+                        </where>
+
+                        GROUP BY DATE_FORMAT( a.signdate, '%Y-%m' )
+                    )  b  on b.singDateYear = DATE_FORMAT( a.signing_time, '%Y-%m' )
+                <where>
+                    a.settlement_sum_id IS NOT NULL
+                    AND settlement_status = '1'
+                </where>
+                GROUP BY DATE_FORMAT( a.signing_time, '%Y-%m' )
+            )  c  on  c.singDateYear=DATE_FORMAT( a.signdate, '%Y-%m' )
+        <where>
+            pa.agreement_type ='2'
+            <if test="vo.isNotCar !=null  and  vo.isNotCar  !=''">
+                and a.is_not_car =#{vo.isNotCar}
+            </if>
+            <if test="vo.beginDate  != null  and  vo.beginDate!=''  and vo.endDate  != null  and  vo.endDate!=''">
+                AND  a.signdate  BETWEEN #{vo.beginDate} AND #{vo.endDate}
+            </if>
+        </where>
+        GROUP BY DATE_FORMAT( a.signdate, '%Y-%m' )
     </select>
 </mapper>