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

Merge remote-tracking branch 'origin/master'

liub пре 3 месеци
родитељ
комит
34b49320cd
26 измењених фајлова са 333 додато и 153 уклоњено
  1. 4 1
      authentication/src/main/java/com/jzg/config/JzgAuthenticationProvider.java
  2. 20 0
      commons/src/main/java/com/jzg/commons/entity/finance/vo/InvoiceRecordResult.java
  3. 9 0
      commons/src/main/java/com/jzg/commons/entity/po/InsFeeOrders.java
  4. 3 0
      commons/src/main/java/com/jzg/commons/entity/po/SysUserJzgInfo.java
  5. 17 2
      commons/src/main/java/com/jzg/commons/util/MinioUtils.java
  6. 6 6
      tenant/insurance/quotation-commons/src/main/java/com/jzg/quotation/commons/client/OrgClient.java
  7. 28 8
      tenant/insurance/quotation-huatai/src/main/java/com/jzg/quotation/huatai/crawler/service/Impl/HuaTaiCrawlerRequestImpl.java
  8. 4 1
      tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/aop/aspect/QuoteVerificationAspect.java
  9. 8 2
      tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/service/impl/InsFeeAuditServiceImpl.java
  10. 25 4
      tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/service/impl/InsFeeOrdersServiceImpl.java
  11. 3 1
      tenant/insurance/quotation-summary/src/main/resources/mapper/InsFeeAuditMapper.xml
  12. 38 44
      tenant/insurance/quotation-taishan/src/main/java/com/jzg/quotation/taishan/crawler/service/impl/TaiShanCrawlerQuoteProcessServiceImpl.java
  13. 2 1
      tenant/insurance/quotation-zijin/src/main/java/com/jzg/quotation/zijin/crawler/build/ZiJinCrawlerQuoteRequestBuild.java
  14. 4 2
      tenant/insurance/quotation-zijin/src/main/java/com/jzg/quotation/zijin/crawler/entity/request/ZiJinCrawlerCarRequest.java
  15. 2 0
      tenant/insurance/quotation-zijin/src/main/java/com/jzg/quotation/zijin/crawler/entity/request/ZiJinCrawlerSaveProposalRequest.java
  16. 12 16
      tenant/insurance/quotation-zijin/src/main/java/com/jzg/quotation/zijin/crawler/service/impl/ZiJinCrawlerRequestImpl.java
  17. 7 0
      tenant/organization/src/main/java/com/jzg/organization/controller/ReceivableController.java
  18. 5 0
      tenant/organization/src/main/java/com/jzg/organization/mapper/ReceivableMapper.java
  19. 2 0
      tenant/organization/src/main/java/com/jzg/organization/service/SysUserJzgInfoService.java
  20. 43 53
      tenant/organization/src/main/java/com/jzg/organization/service/impl/ReceivableServiceImpl.java
  21. 5 1
      tenant/organization/src/main/java/com/jzg/organization/service/impl/SysDistributionSettingServiceImpl.java
  22. 3 0
      tenant/organization/src/main/java/com/jzg/organization/service/impl/SysUserAccountServiceImpl.java
  23. 8 0
      tenant/organization/src/main/java/com/jzg/organization/service/impl/SysUserJzgInfoServiceImpl.java
  24. 2 2
      tenant/organization/src/main/java/com/jzg/organization/service/impl/SysUserServiceImpl.java
  25. 73 8
      tenant/organization/src/main/resources/mapper/ReceivableMapper.xml
  26. 0 1
      tenant/organization/src/main/resources/mapper/SysDistributionSettingMapper.xml

+ 4 - 1
authentication/src/main/java/com/jzg/config/JzgAuthenticationProvider.java

@@ -406,7 +406,10 @@ public class JzgAuthenticationProvider implements AuthenticationProvider {
                 log.info("租户登录异常:用户不存在。 userId=[{}]",userId);
                 throw new SystemException("业务员不存在");
             }
-            SysUserJzgInfo sysUserJzgInfo = sysUserJzgInfos.get(0);
+            SysUserJzgInfo sysUserJzgInfo = sysUserJzgInfos.stream()
+                    .filter(x -> Objects.equals(x.getSystemCode(), system))
+                    .findFirst()
+                    .orElse(null);
             // 租户系统才会校验这个, 后台管理系统,没有租户的概念
             if(this.isTenantLogin(system)){
                 if (sysUserJzgInfo.cannotLogin()) {

+ 20 - 0
commons/src/main/java/com/jzg/commons/entity/finance/vo/InvoiceRecordResult.java

@@ -128,4 +128,24 @@ public class InvoiceRecordResult extends PageRequest {
      * 开票日期
      */
     private String createTime;
+
+    /**
+     * 跟单费的年份
+     */
+    private String year;
+
+    /**
+     * 跟单费的月份
+     */
+    private String month;
+
+    /**
+     * 分支公司id
+     */
+    private String partnerCompanyId;
+
+    /**
+     * 分支公司名称
+     */
+    private String partnerCompanyName;
 }

+ 9 - 0
commons/src/main/java/com/jzg/commons/entity/po/InsFeeOrders.java

@@ -222,18 +222,27 @@ public class InsFeeOrders {
     @Schema(description = "一级分销员id")
     private String firstDistributorId;
 
+    @Schema(description = "一级分销比例")
+    private BigDecimal firstDistributionRatio;
+
     @Schema(description = "二级分销费")
     private BigDecimal secondDistributionFee;
 
     @Schema(description = "二级分销员id")
     private String secondDistributorId;
 
+    @Schema(description = "二级分销比例")
+    private BigDecimal secondDistributionRatio;
+
     @Schema(description = "三级分销费")
     private BigDecimal thirdDistributionFee;
 
     @Schema(description = "三级分销员id")
     private String thirdDistributorId;
 
+    @Schema(description = "三级分销比例")
+    private BigDecimal thirdDistributionRatio;
+
     @Schema(description = "车牌号")
     @TableField(exist = false)
     private String licenseNo;

+ 3 - 0
commons/src/main/java/com/jzg/commons/entity/po/SysUserJzgInfo.java

@@ -147,6 +147,9 @@ public class SysUserJzgInfo extends BaseModel implements Serializable {
     @Schema(description = "邮政编码")
     private String postalCode;
 
+    @TableField(value = "email")
+    private String email;
+
     @TableField(value = "blood_type")
     @Schema(description = "血型")
     private String bloodType;

+ 17 - 2
commons/src/main/java/com/jzg/commons/util/MinioUtils.java

@@ -12,6 +12,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.compress.utils.IOUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
 import org.springframework.stereotype.Component;
@@ -43,6 +44,14 @@ public class MinioUtils {
         log.info("MinioClient has been initialized: {}", minioClient);
     }
 
+
+    private static String minioPublicUrl;
+
+    @Value("${minio.url:https://minio.baoxianzhanggui.com}")
+    public void setMinioPublicUrl(String minioPublicUrl) {
+        MinioUtils.minioPublicUrl = minioPublicUrl;
+    }
+
     public static MinioClient getMinioClient() {
         return MinioUtils.minioClient;
     }
@@ -399,9 +408,15 @@ public class MinioUtils {
      */
     @SneakyThrows(Exception.class)
     public static String getPresignedObjectUrl(String bucketName, String objectName) {
+//        try {
+//            GetPresignedObjectUrlArgs args = GetPresignedObjectUrlArgs.builder().bucket(bucketName).object(objectName).method(Method.GET).build();
+//            return minioClient.getPresignedObjectUrl(args);
+//        } catch (Exception e) {
+//            return null;
+//        }
+        // 重新调整方法  minio 设置公开权限
         try {
-            GetPresignedObjectUrlArgs args = GetPresignedObjectUrlArgs.builder().bucket(bucketName).object(objectName).method(Method.GET).build();
-            return minioClient.getPresignedObjectUrl(args);
+            return minioPublicUrl + "/" + bucketName + "/" + objectName;
         } catch (Exception e) {
             return null;
         }

+ 6 - 6
tenant/insurance/quotation-commons/src/main/java/com/jzg/quotation/commons/client/OrgClient.java

@@ -122,36 +122,36 @@ public interface OrgClient {
     /**
      * 获取租户分销设置
      */
-    @PostMapping(value = "/sysDistributionSetting/getSettingBySystemCode")
+    @GetMapping(value = "/sysDistributionSetting/getSettingBySystemCode")
     HttpResult<SysDistributionSetting> getSettingBySystemCode();
 
     /**
      * 获取机构
      */
     @GetMapping(value = "/dept/deptGet")
-    HttpResult<SysDeptVo> deptGet(String id);
+    HttpResult<SysDeptVo> deptGet(@RequestParam String id);
 
     /**
      * 获取租户用户
      */
     @GetMapping(value = "userInfo/getUserInfoByMobile")
-    HttpResult<SysUserJzgInfo> getUserInfoByMobile(String mobile);
+    HttpResult<SysUserJzgInfo> getUserInfoByMobile(@RequestParam String mobile);
 
     /**
      * 获取上级推荐人
      */
     @GetMapping(value = "esmUserReferrer/getReferrer")
-    HttpResult<EsmUserReferrer> getReferrer(String id);
+    HttpResult<EsmUserReferrer> getReferrer(@RequestParam String id);
 
 
     /**
      * 获取租户用户
      */
     @GetMapping(value = "userInfo/getUserInfo")
-    HttpResult<SysUserJzgInfo> getUserInfo(String id);
+    HttpResult<SysUserJzgInfo> getUserInfo(@RequestParam String id);
 
     @GetMapping(value = "userInfo/getUserInfoById")
-    HttpResult<SysUserJzgInfo> getUserInfoById(String id);
+    HttpResult<SysUserJzgInfo> getUserInfoById(@RequestParam String id);
 
     @PostMapping(value = "receivable/restockInsPlyIncome")
     void restockInsPlyIncome(@RequestBody InsOrderAdjust insOrderAdjust);

+ 28 - 8
tenant/insurance/quotation-huatai/src/main/java/com/jzg/quotation/huatai/crawler/service/Impl/HuaTaiCrawlerRequestImpl.java

@@ -1,10 +1,13 @@
 package com.jzg.quotation.huatai.crawler.service.Impl;
 
 import com.alibaba.fastjson.JSONObject;
+import com.fasterxml.jackson.core.JsonParser;
 import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.json.JsonReadFeature;
 import com.fasterxml.jackson.core.type.TypeReference;
 import com.fasterxml.jackson.databind.DeserializationFeature;
 import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.ObjectReader;
 import com.jzg.commons.constants.ProductsType;
 import com.jzg.commons.constants.dict.InsOrderStatusEnum;
 import com.jzg.commons.entity.po.jyxSetting;
@@ -238,17 +241,19 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
     // ====================== 报价主流程 ======================
     @Override
     public QuoteResultsVo quote(QuoteVo quoteVo) throws Exception {
+        // 构造登录参数
         AttributionInformationVo attr = quoteVo.getOrder().getAttributionInformationVo();
         LoginDTO dto = buildLoginDTO(attr);
+        // 获取登录相关信息
         Map<String, Object> mmap = login(dto);
-        //归属信息
+        // 归属信息
         Map<String, Object> gsInfo = parseToMap(mmap.get("gsInfo").toString());
         log.info("gsInfo: {}", JSONObject.toJSONString(mmap));
 
         String cookie = extractCookie(mmap);
         CarInfoVo car = quoteVo.getCarInfoVo();
 
-        //带重试的获取报价编号、车型型号
+        // 带重试的获取报价编号、车型型号
         Map<String, Object> xbResult = retry(() -> {
             try { return xbQuery(dto.getUsername(), cookie, car); }
             catch (Exception e) { refreshLogin(dto); throw new Exception(e); }
@@ -256,14 +261,14 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
 
         String quotationNo = str(xbResult, "quotationNo");
         String modelcodexh = str(xbResult, "modelcodexh");
-        //报价前预处理-保存车辆信息、过滤车型等处理
+        // 报价前预处理-保存车辆信息、过滤车型等处理
         PreResult pre = prepareQuote(attr, mmap, car, modelcodexh, cookie, quotationNo);
-        //报价
+        // 报价
         CoreResult core = executeQuote(quoteVo, quotationNo, dto, cookie, pre, gsInfo, attr);
         if (!core.success()) throw new SystemException("报价失败");
-        //保存订单到MongoDB
+        // 保存订单到MongoDB
         saveOrder(quoteVo, core);
-        //组装费用
+        // 组装费用
         return HuaTaiCrawlerQuoteResultsVoBuild.buildQuoteResultsVo(quoteVo, core.data(), core.fcPrice());
     }
 
@@ -836,12 +841,27 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
 
         Map<String, Object> map = new HashMap<>();
         try {
-            map = MAPPER.readValue(res, Map.class);
+            // 忽略未知字段
+            MAPPER.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+            // 空字符串转null
+            MAPPER.configure(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT, true);
+            // 允许单引号、宽松JSON格式(第三方不规范返回必备)
+            MAPPER.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true);
+            MAPPER.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true);
+            // 允许换行符、回车符存在于字符串值中
+            // MAPPER.configure(JsonParser.Feature.ALLOW_UNESCAPED_CONTROL_CHARS, true);
+
+            ObjectReader reader = MAPPER.readerFor(Map.class)
+                    .with(JsonReadFeature.ALLOW_UNESCAPED_CONTROL_CHARS)
+                    .with(JsonReadFeature.ALLOW_SINGLE_QUOTES)
+                    .with(JsonReadFeature.ALLOW_UNQUOTED_FIELD_NAMES);
+
+            map = reader.readValue(res);
         } catch (JsonProcessingException e) {
             throw new SystemException("核保失败, {}", convertResponseMsg(res));
         }
 
-        if (!"1,2,3,4".contains(order.getCiCategory()) || "Y".equals(str(map, "isOver")) || "Y".equals(str(map, "isOver1"))
+        if (!"1,2,3,4,Y1,Y2,Y3".contains(order.getCiCategory()) || "Y".equals(str(map, "isOver")) || "Y".equals(str(map, "isOver1"))
                 || "重新计算保费".equals(str(map, "MSG")) || (res.contains("下发修改意见") && !res.contains("isPassHB")) || res.contains("转人工意见")) {
             throw new SystemException("核保失败-------" + convertResponseMsg(res));
         }

+ 4 - 1
tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/aop/aspect/QuoteVerificationAspect.java

@@ -600,7 +600,7 @@ public class QuoteVerificationAspect {
                         }
                         break;
                     case "3":
-                        String level1Id = calculateLevel1Distribution(insFeeOrders, totalPremium, currentUser.getUserId(), sysDistributionSetting);
+                        String level1Id = calculateLevel1Distribution(insFeeOrders, totalPremium, currentUser.getId(), sysDistributionSetting);
                         if (level1Id != null) {
                             String level2Id = calculateLevel2Distribution(insFeeOrders, totalPremium, level1Id, sysDistributionSetting);
                             if (level2Id != null) {
@@ -627,6 +627,7 @@ public class QuoteVerificationAspect {
                 String distributorId = referrer.getReferrerId();
                 insFeeOrders.setFirstDistributorId(distributorId);
                 insFeeOrders.setFirstDistributionFee(totalPremium.multiply(setting.getCommissionRatioLevel1()));
+                insFeeOrders.setFirstDistributionRatio(setting.getCommissionRatioLevel1());
                 return distributorId;
             }
         }
@@ -647,6 +648,7 @@ public class QuoteVerificationAspect {
                 String distributorId = referrer.getReferrerId();
                 insFeeOrders.setSecondDistributorId(distributorId);
                 insFeeOrders.setSecondDistributionFee(totalPremium.multiply(setting.getCommissionRatioLevel2()));
+                insFeeOrders.setSecondDistributionRatio(setting.getCommissionRatioLevel2());
                 return distributorId;
             }
         }
@@ -666,6 +668,7 @@ public class QuoteVerificationAspect {
                     && "1".equals(referrerInfoResult.getData().getIsDistribution())) {
                 insFeeOrders.setThirdDistributorId(referrer.getReferrerId());
                 insFeeOrders.setThirdDistributionFee(totalPremium.multiply(setting.getCommissionRatioLevel3()));
+                insFeeOrders.setThirdDistributionRatio(setting.getCommissionRatioLevel3());
             }
         }
     }

+ 8 - 2
tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/service/impl/InsFeeAuditServiceImpl.java

@@ -167,7 +167,7 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
         return page;
     }
 
-    public List<FeeAuditVo> queryList(FeeAuditParam param) {
+      public List<FeeAuditVo> queryList(FeeAuditParam param) {
         log.info("订单审核-任务中心,查询待审核任务。 param=[{}]", JSONUtil.toJsonStr(param));
         // 获取选中的保险公司条件
         String companyId = param.getCompanyId();
@@ -883,7 +883,13 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
      */
     @Override
     public String exportAuditList(FeeAuditParam param) {
-        List<FeeAuditVo> result = queryList(param);
+        param.getPage().setPages(1);
+        param.getPage().setSize(Integer.MAX_VALUE);
+        param.setPages(1);
+        param.setSize(Integer.MAX_VALUE);
+        Page<FeeAuditVo> feeAuditVoPage = this.queryPage(param);
+        List<FeeAuditVo> result = feeAuditVoPage.getRecords();
+        log.info("审核记录导出。导出[{}]条记录。param=[{}]",CollUtil.size(result), JSONUtil.toJsonStr(param));
         for (FeeAuditVo feeAuditVo : result) {
             feeAuditVo.setTotalPayablePremium(feeAuditVo.getTotalPayablePremium().setScale(2, RoundingMode.HALF_UP));
             feeAuditVo.setJyPayablePremium(feeAuditVo.getJyPayablePremium().setScale(2, RoundingMode.HALF_UP));

+ 25 - 4
tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/service/impl/InsFeeOrdersServiceImpl.java

@@ -92,6 +92,18 @@ public class InsFeeOrdersServiceImpl extends ServiceImpl<InsFeeOrdersMapper, Ins
         return insFeeOrders;
     }
 
+    /**
+     * 获取并计算保险费用订单的完整信息
+     * 主要流程:
+     * 1. 查询订单、费用、协议等基础数据
+     * 2. 校验并调整手续费比例(手续费比例不能大于入口比例,超出时强制调整为入口比例)
+     * 3. 保存各项比例信息(手续费、入口、跟单、加投、出口、留点)
+     * 4. 按险种(交强险、商业险、驾乘险)重新计算所有费用
+     * 5. 汇总总应收和总应付金额
+     *
+     * @param ptlAgreementCostRatioVo 协议成本比例VO对象,包含订单号和各险种的比例配置
+     * @return 计算后的保险费用订单对象
+     */
     private InsFeeOrders getInsFeeOrders(PtlAgreementCostRatioVo ptlAgreementCostRatioVo) {
         // 常量定义 保留小数5位
         final int SCALE = 5;
@@ -440,6 +452,15 @@ public class InsFeeOrdersServiceImpl extends ServiceImpl<InsFeeOrdersMapper, Ins
         return insFeeOrdersMapper.getInsFeeOrderByOrderNo(orderNo);
     }
 
+    /**
+     * 更新订单的可用金额,同时调整剩余金额
+     * 更新前会校验:订单存在性、出口留点比例必须为0、新可用金额不能大于当前金额
+     * 剩余金额调整规则:剩余金额 = 原剩余金额 + (原可用金额 - 新可用金额)
+     *
+     * @param orderNo 订单号
+     * @param availableAmount 新的可用金额,必须大于等于0且小于等于当前可用金额
+     * @return 更新结果,成功返回"更新成功"
+     */
     @Override
     public HttpResult updateAvailableAmount(String orderNo, BigDecimal availableAmount) {
         // 1. 参数校验
@@ -479,11 +500,11 @@ public class InsFeeOrdersServiceImpl extends ServiceImpl<InsFeeOrdersMapper, Ins
     }
 
     /**
-     * 查询指定订单的应收总额
+     * 查询指定订单列表的应收保费总额
+     * 支持批量查询,内部按3000个订单分批处理以避免SQL参数过多
      *
-     * @param orderNos 订单编号
-     * @author lipf
-     * @date 2026/6/4 10:17
+     * @param orderNos 订单号列表
+     * @return 所有订单的应收保费总和,无数据时返回0
      */
     @Override
     public BigDecimal queryAllTotalReceivablePremiumByOrderNo(List<String> orderNos) {

+ 3 - 1
tenant/insurance/quotation-summary/src/main/resources/mapper/InsFeeAuditMapper.xml

@@ -67,7 +67,8 @@
         ELSE ''
         END AS isProblem,
         io.order_source,
-        ioci.vin_no
+        ioci.vin_no,
+        ifo.*
         FROM ins_fee_audit ifa
         LEFT JOIN ins_orders io on ifa.order_no = io.id AND io.is_delete=0
         LEFT JOIN ins_orders_car_info ioci on io.id = ioci.order_no AND ioci.is_delete=0
@@ -79,6 +80,7 @@
         LEFT JOIN sys_user sua on sua.id = pa.custodian_id AND sua.is_delete=0
         LEFT JOIN ins_orders_costs ioc on ioc.order_no = io.id AND ioc.is_delete=0
         LEFT JOIN ins_orders_external_policy ioep on ioep.order_no = io.id AND ioep.is_delete=0
+        LEFT JOIN ins_fee_orders ifo on ifo.order_no  = ifa.order_no  and ifo.is_delete = 0
         <where>
             and ifa.is_delete=0 and ifa.system_code = #{param.systemCode}
             <if test="param.vinNo != null and param.vinNo !=''">

+ 38 - 44
tenant/insurance/quotation-taishan/src/main/java/com/jzg/quotation/taishan/crawler/service/impl/TaiShanCrawlerQuoteProcessServiceImpl.java

@@ -117,16 +117,28 @@ public class TaiShanCrawlerQuoteProcessServiceImpl implements TaiShanCrawlerQuot
                 TaiShanExternalSendCodeResponse externalResponse = JSON.parseObject(externalResponseBody, TaiShanExternalSendCodeResponse.class);
                 log.info("externalSendCodeResponse参数的值:{}", JSON.toJSONString(externalResponse));
 
-                // 从外部响应中获取数据并缓存
-                TaiShanExternalSendCodeResponse.DataDTO externalData = externalResponse.getData();
-                Map<String, Object> tokenMap = new HashMap<>();
-                tokenMap.put("token", externalData.getToken());
-                tokenMap.put("secretKey", externalData.getSecretKey());
-                tokenMap.put("pointJson", externalData.getPointJson());
-                log.info("TaiShan-tokenMap参数的值(从外部接口获取):{}", JSON.toJSONString(tokenMap));
-                taiShanCrawlerCacheComponent.cacheToken(username, tokenMap);
-
-                getCaptchaResponse.setIdentifyId(externalData.getToken());
+                if(externalResponse != null){
+                    if (externalResponse.getCode() != null && externalResponse.getCode().equals(200)) {
+                        TaiShanExternalSendCodeResponse.DataDTO externalData = externalResponse.getData();
+                        if (externalData != null && StringUtils.isNotBlank(externalData.getToken())) {
+                            Map<String, Object> tokenMap = new HashMap<>();
+                            tokenMap.put("token", externalData.getToken());
+                            tokenMap.put("secretKey", externalData.getSecretKey());
+                            tokenMap.put("pointJson", externalData.getPointJson());
+                            log.info("TaiShan-tokenMap参数的值(从外部接口获取):{}", JSON.toJSONString(tokenMap));
+                            taiShanCrawlerCacheComponent.cacheToken(username, tokenMap);
+
+                            getCaptchaResponse.setIdentifyId(externalData.getToken());
+                        } else {
+                            log.warn("外部发送验证码接口响应数据为空或token缺失");
+                        }
+                    } else {
+                        log.warn("外部发送验证码接口调用失败,code={}, message={}",
+                                externalResponse.getCode(), externalResponse.getMessage());
+                    }
+                } else {
+                    log.warn("外部发送验证码接口返回空响应");
+                }
             }
         }
 
@@ -152,14 +164,24 @@ public class TaiShanCrawlerQuoteProcessServiceImpl implements TaiShanCrawlerQuot
         TaiShanExternalSendCodeResponse externalResponse = JSON.parseObject(externalResponseBody, TaiShanExternalSendCodeResponse.class);
         log.info("externalSendCodeResponse参数的值:{}", JSON.toJSONString(externalResponse));
 
-//        if (externalResponse == null || externalResponse.getCode() != 200) {
-//            String message = externalResponse != null ? externalResponse.getMessage() : "未知错误";
-//            log.warn("外部发送验证码接口调用失败,错误信息:{}", message);
-//            throw new RuntimeException("外部发送验证码失败:" + message);
-//        }
+        if (externalResponse == null) {
+            log.warn("外部发送验证码接口返回空响应");
+            throw new RuntimeException("外部发送验证码失败:响应为空");
+        }
+
+        if (externalResponse.getCode() == null || !externalResponse.getCode().equals("200")) {
+            String message = externalResponse.getMessage() != null ? externalResponse.getMessage() : "未知错误";
+            log.warn("外部发送验证码接口调用失败,错误信息:{}", message);
+            throw new RuntimeException("外部发送验证码失败:" + message);
+        }
 
-        // 从外部响应中获取数据并缓存
         TaiShanExternalSendCodeResponse.DataDTO externalData = externalResponse.getData();
+        if (externalData == null) {
+            log.warn("外部发送验证码接口响应数据为空");
+            throw new RuntimeException("外部发送验证码失败:响应数据为空");
+        }
+
+        // 从外部响应中获取数据并缓存
         Map<String, Object> tokenMap = new HashMap<>();
         tokenMap.put("token", externalData.getToken());
         tokenMap.put("secretKey", externalData.getSecretKey());
@@ -203,34 +225,6 @@ public class TaiShanCrawlerQuoteProcessServiceImpl implements TaiShanCrawlerQuot
             token = (String) tokenMap.get("token");
         }
         return StringUtils.hasText(token);
-
-
-//        log.info("TaiShan-detectLoginRequest参数的值:{}", JSON.toJSONString(detectLoginRequest));
-//        String username = detectLoginRequest.getUsername();
-//        String password = detectLoginRequest.getPassword();
-//        LoginBase loginBase = new LoginBase();
-//        loginBase.setUsername(username);
-//        loginBase.setPassword(password);
-//        log.info("TaiShan-loginBase参数的值:{}", JSON.toJSONString(loginBase));
-//
-//        HttpHeaders httpHeaders = new HttpHeaders();
-//        getVerifyHeader(httpHeaders);
-//
-//        sendCode(username, password);
-//
-//        Map<String, Object> tokenMap = taiShanCrawlerCacheComponent.getToken(username);
-//        log.info("TaiShan-tokenMap参数的值:{}", JSON.toJSONString(tokenMap));
-
-
-//        TaiShanCrawlerLoginRequest loginRequest = new TaiShanCrawlerLoginRequest(loginBase,tokenMap);
-//        TaiShanCrawlerLoginResponse loginResponse = taiShanCrawlerRequestComponent.login(loginRequest, httpHeaders);
-//        log.info("TaiShan-loginResponse参数的值:{}", JSON.toJSONString(loginResponse));
-//        if(loginResponse.getCode().equals("200")){
-//            String authorization = loginResponse.getResult().getIdToken();
-//            //缓存登录的信息
-//            taiShanCrawlerCacheComponent.cacheAuthorization(loginBase.getUsername(), authorization);
-//        }
-//        return true;
     }
 
 

+ 2 - 1
tenant/insurance/quotation-zijin/src/main/java/com/jzg/quotation/zijin/crawler/build/ZiJinCrawlerQuoteRequestBuild.java

@@ -480,10 +480,11 @@ public class ZiJinCrawlerQuoteRequestBuild {
             carPolicySubInfo.setPlanName(accidentalDriving.getProductName());
             carPolicySubInfo.setRiskCode(accidentalDriving.getRiskCode());
             carPolicySubInfo.setRiskName(accidentalDriving.getProductName());
-            carPolicySubInfo.setSumAmount(ObjectUtils.isEmpty(accidentalDriving.getSumAmount()) ? 0 : (int) Double.parseDouble(accidentalDriving.getSumAmount()));
+            carPolicySubInfo.setSumAmount(ObjectUtils.isEmpty(accidentalDriving.getSumAmount()) ? 0 : (int) Double.parseDouble(accidentalDriving.getSumAmount()));// 空值,前端没传
             carPolicySubInfo.setQuantity(accidentalDriving.getQuantity() == 0 ? "0" : String.valueOf(accidentalDriving.getQuantity()));
             carPolicySubInfo.setIsUseInsured("1");
             carPolicySubInfo.setSumPremium(ObjectUtils.isEmpty(accidentalDriving.getPremium()) ? 0 : (int) Double.parseDouble(accidentalDriving.getPremium()));
+            carPolicySubInfo.setActualPremium(accidentalDriving.getPremium());
             carPolicySubInfoList.add(carPolicySubInfo);
         }
         return carPolicySubInfoList;

+ 4 - 2
tenant/insurance/quotation-zijin/src/main/java/com/jzg/quotation/zijin/crawler/entity/request/ZiJinCrawlerCarRequest.java

@@ -1,8 +1,8 @@
 package com.jzg.quotation.zijin.crawler.entity.request;
 
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.jzg.commons.entity.quote.vo.CarInfoVo;
+import lombok.AllArgsConstructor;
 import lombok.Data;
+import lombok.NoArgsConstructor;
 
 import java.io.Serial;
 import java.io.Serializable;
@@ -14,6 +14,8 @@ import java.io.Serializable;
  * @date 2025/09/28
  */
 @Data
+@NoArgsConstructor
+@AllArgsConstructor
 public class ZiJinCrawlerCarRequest implements Serializable {
 
     @Serial

+ 2 - 0
tenant/insurance/quotation-zijin/src/main/java/com/jzg/quotation/zijin/crawler/entity/request/ZiJinCrawlerSaveProposalRequest.java

@@ -2,6 +2,7 @@ package com.jzg.quotation.zijin.crawler.entity.request;
 
 import com.alibaba.fastjson.annotation.JSONField;
 import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.AllArgsConstructor;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 
@@ -13,6 +14,7 @@ import java.io.Serializable;
  */
 @Data
 @NoArgsConstructor
+@AllArgsConstructor
 public class ZiJinCrawlerSaveProposalRequest implements Serializable {
 
     @Serial

+ 12 - 16
tenant/insurance/quotation-zijin/src/main/java/com/jzg/quotation/zijin/crawler/service/impl/ZiJinCrawlerRequestImpl.java

@@ -122,11 +122,7 @@ public class ZiJinCrawlerRequestImpl implements ZiJinCrawlerRequest {
 
         try {
             // 查询车辆信息
-            ZiJinCrawlerCarRequest ziJinCrawlerCarRequest = new ZiJinCrawlerCarRequest();
-            ziJinCrawlerCarRequest.setChannelCode("KSCD_PROD");
-            ziJinCrawlerCarRequest.setComCode(parameters.getComCode());
-            ziJinCrawlerCarRequest.setLicenseNo(quoteVo.getCarInfoVo().getLicenseNo());
-            ziJinCrawlerCarRequest.setVin(quoteVo.getCarInfoVo().getVinNo());
+            ZiJinCrawlerCarRequest ziJinCrawlerCarRequest = new ZiJinCrawlerCarRequest("KSCD_PROD", parameters.getComCode(), quoteVo.getCarInfoVo().getLicenseNo(), quoteVo.getCarInfoVo().getVinNo());
             ZiJinCrawlerCarResponse ziJinCrawlerCarResponse = ziJinCrawlerRequestComponent.car(ziJinCrawlerCarRequest, headers);
             log.info("ziJinCrawlerCarResponse参数的值:{}", JSON.toJSONString(ziJinCrawlerCarResponse));
 
@@ -152,16 +148,18 @@ public class ZiJinCrawlerRequestImpl implements ZiJinCrawlerRequest {
 
             // 重复投保,延保
             if (ResponseCode.R_0002.getCode().equals(ziJinCrawlerQuotationResponse.getRtnCode()) && ziJinCrawlerQuotationResponse.getRtnMsg() != null && ziJinCrawlerQuotationResponse.getRtnMsg().contains("重复投保")) {
-                String endTime = extractDuplicateEndTime(ziJinCrawlerQuotationResponse.getRtnMsg());
-                if (StringUtils.hasLength(endTime)) {
-                    String startTime = endTime;
+                // 提取重复投保消息中的结束时间为起保时间
+                String startTime = extractDuplicateEndTime(ziJinCrawlerQuotationResponse.getRtnMsg());
+                if (StringUtils.hasLength(startTime)) {
                     String newEndTime = TimeProcessing.minusOneSecondAfterYear(startTime);
-                    // 修改商业险起保时间(后端接口期望日期格式为 yyyy-MM-dd)
-                    ziJinCrawlerQuotationRequest.getBaseInfo().setStartDate(TimeProcessing.dateTimeToDate(startTime));
-                    ziJinCrawlerQuotationRequest.getBaseInfo().setEndDate(TimeProcessing.minusDays(TimeProcessing.dateTimeToDate(newEndTime), 1));
+                    // 修改商业险起保时间(保司接口期望日期格式为 yyyy-MM-dd)
+                    String startDate = TimeProcessing.dateTimeToDate(startTime);
+                    String endDate = TimeProcessing.minusDays(TimeProcessing.dateTimeToDate(newEndTime), 1);
+                    ziJinCrawlerQuotationRequest.getBaseInfo().setStartDate(startDate);
+                    ziJinCrawlerQuotationRequest.getBaseInfo().setEndDate(endDate);
                     // 修改交强险起保时间
-                    ziJinCrawlerQuotationRequest.getBaseInfo().setStartDateCI(TimeProcessing.dateTimeToDate(startTime));
-                    ziJinCrawlerQuotationRequest.getBaseInfo().setEndDateCI(TimeProcessing.minusDays(TimeProcessing.dateTimeToDate(newEndTime), 1));
+                    ziJinCrawlerQuotationRequest.getBaseInfo().setStartDateCI(startDate);
+                    ziJinCrawlerQuotationRequest.getBaseInfo().setEndDateCI(endDate);
                     log.info("紫金报价重复投保日期参数: startTime={}, endTime={}", startTime, newEndTime);
                     ziJinCrawlerQuotationResponse = ziJinCrawlerRequestComponent.quotation(ziJinCrawlerQuotationRequest, headers);
                     log.info("紫金报价重复投保后响应: {}", JSON.toJSONString(ziJinCrawlerQuotationResponse));
@@ -195,9 +193,7 @@ public class ZiJinCrawlerRequestImpl implements ZiJinCrawlerRequest {
                 log.info("ziJinCrawlerSaveQuoteInfoResponse响应:{}", JSON.toJSONString(ziJinCrawlerSaveQuoteInfoResponse));
 
                 // 保存投保单
-                ZiJinCrawlerSaveProposalRequest ziJinCrawlerSaveProposalRequest = new ZiJinCrawlerSaveProposalRequest();
-                ziJinCrawlerSaveProposalRequest.setOrderNo(ziJinCrawlerGetOrderNoResponse.getOrderNo());
-                ziJinCrawlerSaveProposalRequest.setProposalCheckNo(ziJinCrawlerQuotationResponse.getBasePart().getProposalCheckNo());
+                ZiJinCrawlerSaveProposalRequest ziJinCrawlerSaveProposalRequest = new ZiJinCrawlerSaveProposalRequest(ziJinCrawlerGetOrderNoResponse.getOrderNo(), ziJinCrawlerQuotationResponse.getBasePart().getProposalCheckNo());
                 log.info("ziJinCrawlerSaveProposalRequest参数的值:{}", JSON.toJSONString(ziJinCrawlerSaveProposalRequest));
                 ZiJinCrawlerSaveProposalResponse ziJinCrawlerSaveProposalResponse = ziJinCrawlerRequestComponent.saveProposal(ziJinCrawlerSaveProposalRequest, headers);
                 log.info("ziJinCrawlerSaveProposalResponse参数的值:{}", JSON.toJSONString(ziJinCrawlerSaveProposalResponse));

+ 7 - 0
tenant/organization/src/main/java/com/jzg/organization/controller/ReceivableController.java

@@ -487,6 +487,13 @@ public class ReceivableController {
     @PostMapping("/exportPlatFormReceivable")
     @Operation(summary = "导出平台协议数据")
     public HttpResult exportPlatFormReceivable(@RequestBody ReceivableQueryVo receivableQueryVo) throws IOException {
+        if (StrUtil.isBlank(receivableQueryVo.getQueryType())){
+            receivableQueryVo.setQueryType("1");
+        }
+        // 协议类型 1 平台协议  2 私有协议
+        if (StrUtil.isBlank(receivableQueryVo.getAgreementType())){
+            receivableQueryVo.setAgreementType("1");
+        }
         return HttpResult.ok(receivableService.exportPlatFormReceivable(receivableQueryVo));
     }
 

+ 5 - 0
tenant/organization/src/main/java/com/jzg/organization/mapper/ReceivableMapper.java

@@ -214,6 +214,11 @@ public interface ReceivableMapper extends BaseMapper<InsPlyIncome> {
      */
     Page<InvoiceRecordResult> getInvoiceRecordList(Page page, @Param("invoiceRecordQueryVo") InvoiceRecordQueryVo invoiceRecordQueryVo);
 
+    /**
+     * 获取开票记录
+     */
+    Page<InvoiceRecordResult> getFollowInvoiceRecordList(Page page, @Param("invoiceRecordQueryVo") InvoiceRecordQueryVo invoiceRecordQueryVo);
+
     List<CompanySuperviseSettlementReportDto> selectAllCompanyReports(@Param("queryVo") SettlementReportQueryVo queryVo);
 
     /**

+ 2 - 0
tenant/organization/src/main/java/com/jzg/organization/service/SysUserJzgInfoService.java

@@ -20,6 +20,8 @@ public interface SysUserJzgInfoService extends IService<SysUserJzgInfo> {
      */
     List<SysUserJzgInfo> getUserInfoByIdentity(String identity,String userId);
 
+    SysUserJzgInfo getByUserIdOrId(String id);
+
     /**
      * 通过userId查询用户信息
      * @param userId 用户序号

+ 43 - 53
tenant/organization/src/main/java/com/jzg/organization/service/impl/ReceivableServiceImpl.java

@@ -573,13 +573,14 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
         queryWrapper.lambda().eq(InsPlyFollowInvoiceLink::getIsDelete, 0);
         List<InsPlyFollowInvoiceLink> insPlyFollowInvoiceLinks = insPlyFollowInvoiceLinkMapper.selectList(queryWrapper);
 
-        if (CollUtil.isNotEmpty(insPlyFollowInvoiceLinks)){
-            List<String> ids = insPlyFollowInvoiceLinks.stream().map(InsPlyFollowInvoiceLink::getId).toList();
-            List<String> followIds = insPlyFollowInvoiceLinks.stream().map(InsPlyFollowInvoiceLink::getFollowId).toList();
-            insPlyFollowInvoiceLinkMapper.deleteByIds(ids);
-            return insFeeFollowOrderMapper.deleteByIds(followIds) > 0;
+        if (CollUtil.isEmpty(insPlyFollowInvoiceLinks)){
+            return false;
         }
-        return Boolean.FALSE;
+        List<String> ids = insPlyFollowInvoiceLinks.stream().map(InsPlyFollowInvoiceLink::getId).toList();
+        List<String> followIds = insPlyFollowInvoiceLinks.stream().map(InsPlyFollowInvoiceLink::getFollowId).toList();
+        insPlyFollowInvoiceLinkMapper.deleteByIds(ids);
+        insFeeFollowOrderMapper.deleteByIds(followIds);
+        return insPlyIncomeInvoiceMapper.deleteById(invoiceId) > 0;
     }
 
     @Override
@@ -1631,20 +1632,20 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
                         .set(InsPlyIncomeInvoice::getStatus,"0").eq(InsPlyIncomeInvoice::getId,invoiceId));
 
         // 查询中间表:使用 QueryWrapper,增加逻辑删除过滤
-        LambdaQueryWrapper<InsPlyFollowInvoiceLink> linkQueryWrapper = new LambdaQueryWrapper<>();
-        linkQueryWrapper.eq(InsPlyFollowInvoiceLink::getInvoiceId, invoiceId);
-        linkQueryWrapper.eq(InsPlyFollowInvoiceLink::getIsDelete, SETTLE_STATUS_RESET);
-        List<InsPlyFollowInvoiceLink> linkList = insPlyFollowInvoiceLinkMapper.selectList(linkQueryWrapper);
-
-        if (CollUtil.isNotEmpty(linkList)){
-            // 删除中间表
-            List<String> followLinkIds = linkList.stream().map(InsPlyFollowInvoiceLink::getId).collect(Collectors.toList());
-            insPlyFollowInvoiceLinkMapper.deleteByIds(followLinkIds);
-
-            // 删除跟单表
-            List<String> followIds = linkList.stream().map(InsPlyFollowInvoiceLink::getFollowId).collect(Collectors.toList());
-            insFeeFollowOrderMapper.deleteByIds(followIds);
-        }
+//        LambdaQueryWrapper<InsPlyFollowInvoiceLink> linkQueryWrapper = new LambdaQueryWrapper<>();
+//        linkQueryWrapper.eq(InsPlyFollowInvoiceLink::getInvoiceId, invoiceId);
+//        linkQueryWrapper.eq(InsPlyFollowInvoiceLink::getIsDelete, SETTLE_STATUS_RESET);
+//        List<InsPlyFollowInvoiceLink> linkList = insPlyFollowInvoiceLinkMapper.selectList(linkQueryWrapper);
+
+//        if (CollUtil.isNotEmpty(linkList)){
+//            // 删除中间表
+//            List<String> followLinkIds = linkList.stream().map(InsPlyFollowInvoiceLink::getId).collect(Collectors.toList());
+//            insPlyFollowInvoiceLinkMapper.deleteByIds(followLinkIds);
+//
+//            // 删除跟单表
+//            List<String> followIds = linkList.stream().map(InsPlyFollowInvoiceLink::getFollowId).collect(Collectors.toList());
+//            insFeeFollowOrderMapper.deleteByIds(followIds);
+//        }
         return insPlyIncomeInvoiceSettlementMapper.deleteById(id) > 0;
     }
 
@@ -2900,12 +2901,7 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
         Integer endYear = Integer.parseInt(searchYear.getSearch().split(",")[1]);
 
         // 获取所有年份
-        List<Integer> yearList = new ArrayList<>();
-        if (startYear <= endYear) {
-            for (int year = startYear; year <= endYear; year++) {
-                yearList.add(year);
-            }
-        }
+        Map<String, List<Integer>> companyYearMap = new HashMap<>();
 
         // 获取当前用户的系统编码
         String systemCode = baseController.getUserSystemCode();
@@ -2949,42 +2945,30 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
                     }
                     return true;
                 };
-                // 签单年份
-                Predicate<InsPlyIncomeDto> signYearPredicate = insPlyIncome -> {
-                    if (!names.contains(FollowInvoicePageListVo.SearchVO.signYear)) {
-                        return true;
-                    }
-                    FollowInvoicePageListVo.SearchVO searchVO = searchVOMap.get(FollowInvoicePageListVo.SearchVO.signYear);
-                    String type = searchVO.getType();
-                    String search = searchVO.getSearch();
-                    if ("为空".equals(type) || "不为空".equals(type)) {
-                        return true;
-                    }
-                    if (StrUtil.isEmpty(search)) {
-                        return true;
-                    }
-                    if ("等于".equalsIgnoreCase(type) || "包含".equalsIgnoreCase(type)) {
-                        List<String> signYears = Arrays.asList(search.split(","));
-                        return signYears.contains(insPlyIncome.getSignYear());
-                    }
-                    if ("不等于".equalsIgnoreCase(type) || "不包含".equalsIgnoreCase(type)) {
-                        List<String> signYears = Arrays.asList(search.split(","));
-                        return !signYears.contains(insPlyIncome.getSignYear());
-                    }
-                    return true;
-                };
 
                 // AND / OR 组合逻辑(和代码A完全一致)
                 if ("and".equalsIgnoreCase(followInvoicePageListVo.getLogicJudge())) {
-                    Predicate<InsPlyIncomeDto> and = companyIdPredicate.and(signYearPredicate);
+                    Predicate<InsPlyIncomeDto> and = companyIdPredicate;
                     filterIncomes = incomes.stream().filter(and).toList();
                 } else if ("or".equalsIgnoreCase(followInvoicePageListVo.getLogicJudge())) {
-                    Predicate<InsPlyIncomeDto> or = companyIdPredicate.or(signYearPredicate);
+                    Predicate<InsPlyIncomeDto> or = companyIdPredicate;
                     filterIncomes = incomes.stream().filter(or).toList();
                 }
             }
         }
         // ======================条件过滤结束======================
+        for (InsPlyIncomeDto filterIncome : filterIncomes) {
+            List<Integer> years = companyYearMap.get(filterIncome.getPartnerCompanyId());
+            // 否则新建
+            if (CollUtil.isEmpty(years)) {
+                years = new ArrayList<>();
+            }
+            // 如果不包含当前公司id的年份,则添加
+            if (!years.contains(filterIncome.getSigningTime().getYear())) {
+                years.add(filterIncome.getSigningTime().getYear());
+            }
+            companyYearMap.put(filterIncome.getPartnerCompanyId(), years);
+        }
 
         // 按合作方分组(使用过滤后的数据)
         Map<String, List<InsPlyIncomeDto>> groupMap = filterIncomes.stream()
@@ -3009,6 +2993,7 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
 
             // 遍历12个月份,组装VO对象
             InsPlyIncomeDto firstItem = list.get(0);
+            List<Integer> yearList = companyYearMap.get(partnerCompanyId);
             for (Integer year : yearList) {
                 for (int month = 1; month <= 12; month++) {
                     InsFeeFollowOrderVo vo = buildFollowOrderVo(
@@ -3228,7 +3213,12 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
             invoiceRecordQueryVo.setSettlementStatus(null);
         }
         invoiceRecordQueryVo.setSystemCode(baseController.getSystemCode());
-        Page<InvoiceRecordResult> invoiceRecordList = baseMapper.getInvoiceRecordList(invoiceRecordQueryVo.getPage(), invoiceRecordQueryVo);
+        Page<InvoiceRecordResult> invoiceRecordList = null;
+        if ("2".equals(invoiceRecordQueryVo.getInvoiceType())){
+            invoiceRecordList = baseMapper.getFollowInvoiceRecordList(invoiceRecordQueryVo.getPage(), invoiceRecordQueryVo);
+        }else if ("1".equals(invoiceRecordQueryVo.getInvoiceType())){
+            invoiceRecordList = baseMapper.getInvoiceRecordList(invoiceRecordQueryVo.getPage(), invoiceRecordQueryVo);
+        }
         List<InvoiceRecordResult> records = invoiceRecordList.getRecords();
         if(CollUtil.isNotEmpty(records)){
             Map<String, String> allCompanyHierarchyPaths = esmInsCompanyClient.getAllCompanyHierarchyPaths();

+ 5 - 1
tenant/organization/src/main/java/com/jzg/organization/service/impl/SysDistributionSettingServiceImpl.java

@@ -28,6 +28,7 @@ import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Objects;
 import java.util.Set;
 
 /**
@@ -191,6 +192,7 @@ public class SysDistributionSettingServiceImpl extends ServiceImpl<SysDistributi
             // 审核通过 改为分销员身份
             sysDistributionAudit.setAuditApprovalTime(LocalDateTime.now());
             sysUserJzgInfo.setIsDistribution("1");
+            sysUserJzgInfo.setDistributionTime(LocalDateTime.now());
             sysUserJzgInfoMapper.updateById(sysUserJzgInfo);
             // 添加分销推荐关系
             SysUserJzgInfo inviter = sysUserJzgInfoMapper.selectById(sysUserJzgInfo.getReferrerId());
@@ -321,7 +323,9 @@ public class SysDistributionSettingServiceImpl extends ServiceImpl<SysDistributi
                 pendingAmount = pendingAmount.add(fee);
             }
         }
-        resultVo.setAuditApprovalTime(sysDistributionAudit.getAuditApprovalTime() != null ? sysDistributionAudit.getAuditApprovalTime() : null);
+        if(Objects.nonNull(sysDistributionAudit)) {
+            resultVo.setAuditApprovalTime(sysDistributionAudit.getAuditApprovalTime() != null ? sysDistributionAudit.getAuditApprovalTime() : null);
+        }
         resultVo.setTotalAmount(totalFee); // 累计佣金
         resultVo.setPendingAmount(pendingAmount); // 待结算佣金
         resultVo.setTotalPremium(totalPremium); // 累计保费

+ 3 - 0
tenant/organization/src/main/java/com/jzg/organization/service/impl/SysUserAccountServiceImpl.java

@@ -102,6 +102,9 @@ public class SysUserAccountServiceImpl extends ServiceImpl<SysUserAccountMapper,
         // 获取个人中心信息
         String mobile = baseController.getUserName();
         String systemCode = baseController.getSystemCode();
+        if (systemCode == null) {
+            systemCode = baseController.getAppSystemCode();
+        }
         String userId  = baseController.getUserId();
         log.info("查询用户的钱包信息:mobile=[{}], systemCode=[{}],userId=[{}]", mobile, systemCode, userId);
         SysUser sysUser = sysUserService.getOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getMobile, mobile));

+ 8 - 0
tenant/organization/src/main/java/com/jzg/organization/service/impl/SysUserJzgInfoServiceImpl.java

@@ -38,6 +38,14 @@ public class SysUserJzgInfoServiceImpl extends ServiceImpl<SysUserJzgInfoMapper,
         return baseMapper.getUserInfoByIdentity(identity, userId);
     }
 
+    @Override
+    public SysUserJzgInfo getByUserIdOrId(String id) {
+        return baseMapper.selectOne(new LambdaQueryWrapper<SysUserJzgInfo>()
+                .eq(SysUserJzgInfo::getUserId,id)
+                .or()
+                .eq(SysUserJzgInfo::getId,id));
+    }
+
     @Override
     public SysUserJzgInfo getUserByUserId(String userId) {
         return baseMapper.getUserJzgInfoByUserId(userId);

+ 2 - 2
tenant/organization/src/main/java/com/jzg/organization/service/impl/SysUserServiceImpl.java

@@ -218,7 +218,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
             }
             log.info("查看成员下的业务员信息:成员的序号:jzgInfoId=[{}]", jzgInfoId);
             // modify by lipf 查询成员下业务员的时候,不进行分页
-            page.setSize(Long.MAX_VALUE);
+//            page.setSize(Long.MAX_VALUE);
             userInfoList = sysUserJzgInfoMapper.queryYwy(page, sysUserInfoListVo, systemCode, jzgInfoId
             );
         }else if("1".equals(sysUserInfoListVo.getIsMember())){
@@ -1041,7 +1041,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
      */
     @Override
     public HttpResult<SysUserJzgInfo> getUserInfoByUserId(String id) {
-        SysUserJzgInfo sysUserJzgInfo = sysUserJzgInfoService.getUserByUserId(id);
+        SysUserJzgInfo sysUserJzgInfo = sysUserJzgInfoService.getByUserIdOrId(id);
         log.info("根据id=[{}]查询用户信息sysUserJzgInfo=[{}]",id, JSONUtil.toJsonStr(sysUserJzgInfo));
         if (sysUserJzgInfo == null) {
             throw new SystemException("该用户不存在");

+ 73 - 8
tenant/organization/src/main/resources/mapper/ReceivableMapper.xml

@@ -334,12 +334,6 @@
                 #{id}
             </foreach>
         </if>
-        <if test="receivableQueryVo.queryType != null and receivableQueryVo.queryType == 1">
-            AND ipi.supervise_settlement = 0
-        </if>
-        <if test="receivableQueryVo.queryType!= null and receivableQueryVo.queryType == 2">
-            AND ipi.other_settlement = 0
-        </if>
         <if test="receivableQueryVo.queryType!= null and (receivableQueryVo.queryType == 3 or receivableQueryVo.queryType == 4)">
             AND ipi.jy_premium != 0
             AND ipi.jy_supervise_settlement = 0
@@ -1378,6 +1372,77 @@
         ORDER BY ipii.create_time DESC
     </select>
 
+    <select id="getFollowInvoiceRecordList" resultType="com.jzg.commons.entity.finance.vo.InvoiceRecordResult">
+        SELECT
+        ipii.id,
+        ipii.company_id,
+        ipii.invoice_no,
+        ipii.invoice_type,
+        ipii.invoice_risk_type,
+        CASE
+        WHEN ipii.invoice_party = '1' THEN
+        '我方开票' ELSE '保司开票'
+        END as invoice_party,
+        ipii.overinflated_amount,
+        ipii.receivable_supervise_premium,
+        ipii.tax_point,
+        ipii.create_time,
+        ipii.create_by,
+        ipii.update_time,
+        ipii.update_by,
+        eic.name as company_name,
+        eic.name_simple as companyNameSimple,
+        sum( ipiis.actual_received_amount ) AS actual_received_amount,
+        ipii.status,
+        ipii.payment_reason,
+        GROUP_CONCAT(DISTINCT iffo.year SEPARATOR ',') AS year,
+        GROUP_CONCAT(DISTINCT iffo.month SEPARATOR ',') AS month,
+        iffo.partner_company_id,
+        ( select cp.name from  esm_ins_company cp  where cp.id = iffo.partner_company_id) as partner_company_name
+        FROM
+        ins_ply_income_invoice ipii
+        LEFT JOIN ins_ply_follow_invoice_link ipfii ON ipii.id = ipfii.invoice_id  AND ipfii.is_delete = 0
+        LEFT JOIN ins_fee_follow_order iffo ON iffo.id = ipfii.follow_id  AND iffo.is_delete = 0
+        LEFT JOIN ins_ply_income_invoice_settlement ipiis ON ipii.id = ipiis.invoice_id AND ipiis.is_delete = 0
+        LEFT JOIN esm_ins_company eic on eic.id = ipii.company_id AND eic.is_delete = 0
+        <where>
+            ipii.is_delete = 0
+            AND ipii.system_code = #{invoiceRecordQueryVo.systemCode}
+            <if test="invoiceRecordQueryVo.invoiceType != null and invoiceRecordQueryVo.invoiceType != ''">
+                AND ipii.invoice_type = #{invoiceRecordQueryVo.invoiceType}
+            </if>
+            <if test="invoiceRecordQueryVo.accountsReceivable != null and invoiceRecordQueryVo.accountsReceivable != ''">
+                AND ipii.invoice_risk_type = #{invoiceRecordQueryVo.accountsReceivable}
+            </if>
+            <if test="invoiceRecordQueryVo.recordId != null and invoiceRecordQueryVo.recordId != ''">
+                AND ipii.id = #{invoiceRecordQueryVo.recordId}
+            </if>
+            <if test="invoiceRecordQueryVo.companyId != null and invoiceRecordQueryVo.companyId != ''">
+                AND ipii.company_id = #{invoiceRecordQueryVo.companyId}
+            </if>
+            <if test="invoiceRecordQueryVo.invoiceParty != null and invoiceRecordQueryVo.invoiceParty != ''">
+                AND ipii.invoice_party = #{invoiceRecordQueryVo.invoiceParty}
+            </if>
+            <if test="invoiceRecordQueryVo.companyNameSimple != null and invoiceRecordQueryVo.companyNameSimple != ''">
+                AND eic.id = #{invoiceRecordQueryVo.companyNameSimple}
+            </if>
+        </where>
+        <if test="invoiceRecordQueryVo.settlementStatus != null and invoiceRecordQueryVo.settlementStatus != ''">
+            HAVING CASE
+            WHEN ipii.receivable_supervise_premium = SUM(ipiis.actual_received_amount) THEN '1'
+            ELSE '0'
+            END = #{invoiceRecordQueryVo.settlementStatus}
+        </if>
+        GROUP BY
+        ipii.id,
+        ipii.receivable_supervise_premium,
+        ipii.invoice_type,
+        ipii.company_id,
+        ipii.invoice_party,
+        iffo.partner_company_id
+        ORDER BY ipii.create_time DESC
+    </select>
+
     <!-- 基础结果集映射 -->
     <resultMap id="BaseResultMap" type="com.jzg.commons.entity.finance.dto.CompanySuperviseSettlementReportDto">
         <result column="company_id" property="companyId"/>
@@ -1780,14 +1845,14 @@
         ) a
         group by  a.company_id
     </select>
-    <!-- 查询已结算金额 lipf 2026年6月1日18:12:08  -->
+    <!-- 查询已结算金额 lipf 2026年6月1日18:12:08 modify by lipf 2026年6月24日19:10:53 添加distinct ins.id 按照结算记录的值进行去重。 因为私有开票是按照公司维度开票,的所以 同一个 ins.id 关联的 ipi.icompany_id 肯定是一样的 -->
     <select id="querySettledAmount" resultType="com.jzg.organization.entity.dto.CalRes">
         select
         a.company_id ,
         sum(COALESCE(a.actual_received_amount, 0)) as settlement
         from
         (
-        select
+        select distinct ins.id,
         ipi.company_id ,
         COALESCE(ins.actual_received_amount, 0) as actual_received_amount
         from ins_ply_income_invoice_settlement ins

+ 0 - 1
tenant/organization/src/main/resources/mapper/SysDistributionSettingMapper.xml

@@ -240,7 +240,6 @@
             and sda.audit_status = '1'
             AND suji3.id IS NOT NULL
         </if>
-        ORDER BY eur1.id DESC
     </select>
 
     <select id="getDistributionOrder" resultType="com.jzg.commons.entity.vo.DistributionOrder">