Просмотр исходного кода

Merge remote-tracking branch 'origin/dev_jzg_lipf_v20260622' into dev_jzg_lipf_v20260622

lipf 1 месяц назад
Родитель
Сommit
62f3632826

+ 1 - 0
commons/src/main/java/com/jzg/commons/entity/orders/po/InsOrdersCarInfo.java

@@ -119,6 +119,7 @@ public class InsOrdersCarInfo extends BaseModel {
 
     @Schema(description = "过户日期")
     @DiffProperty(name = "过户日期")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private LocalDateTime transferDate;
 
     @Schema(description = "是否过户")

+ 2 - 2
tenant/insurance/quotation-summary/src/main/resources/mapper/InsOrdersMapper.xml

@@ -1599,9 +1599,9 @@
 
 
     <select id="selectListOrderQuotationCompany" resultType="com.jzg.quotation.summary.entity.vo.OrderQuotationCompany">
-        SELECT id,parent_id,quote_no,company_id,company_name,order_status,fee.total_premium
+        SELECT id,parent_id,quote_no,company_id,company_name,order_status,ioc.sum_premium as totalPremium
         FROM ins_orders
-        LEFT JOIN ins_fee_orders fee ON fee.order_no = ins_orders.id
+        LEFT JOIN ins_orders_costs ioc ON ioc.order_no = ins_orders.id
         <where>
             and ins_orders.is_delete = 0
             and parent_id != 0

+ 42 - 9
tenant/insurance/quotation-zijin/src/main/java/com/jzg/quotation/zijin/crawler/util/RS6Item.java

@@ -13,12 +13,15 @@ import org.jsoup.select.Elements;
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.InputStreamReader;
+import java.io.UncheckedIOException;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.FileSystemException;
 import java.nio.file.Path;
 import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.LinkedHashMap;
@@ -49,17 +52,45 @@ public class RS6Item {
         this.headers = new HashMap<>();
         this.headersForApi = new HashMap<>();
         this.cookies = new LinkedHashMap<>();
-        // 设置scriptDir为项目根目录的绝对路径
-        this.scriptDir = getProjectRootPath();
+        // 从classpath提取JS文件到临时目录,兼容本地开发和Docker容器环境
+        this.scriptDir = initScriptDir();
         initializeHeaders();
     }
 
-    private String getProjectRootPath() {
+    /**
+     * 创建临时目录并从classpath提取JS静态资源文件
+     * 解决Docker容器中无源码目录导致的NoSuchFileException
+     * @return 临时目录的绝对路径
+     */
+    private String initScriptDir() {
         try {
-            File projectRoot = new File("tenant/insurance/quotation-zijin/src/main/resources/js");
-            return projectRoot.getAbsolutePath();
-        } catch (Exception e) {
-            return ".";
+            Path tempDir = Files.createTempDirectory("zijin-js-");
+            // 确保JVM退出时清理临时目录
+            tempDir.toFile().deleteOnExit();
+
+            // 从classpath复制所有JS文件到临时目录
+            String[] jsFiles = {"main.js", "auto.js", "content.js", "tsssss.js", "ts.js"};
+            for (String fileName : jsFiles) {
+                copyResourceToTemp("js/" + fileName, tempDir.resolve(fileName));
+            }
+
+            log.info("紫金JS脚本目录已初始化: {}", tempDir);
+            return tempDir.toString();
+        } catch (IOException e) {
+            throw new UncheckedIOException("初始化紫金JS脚本临时目录失败", e);
+        }
+    }
+
+    /**
+     * 从classpath复制单个资源文件到目标路径
+     */
+    private void copyResourceToTemp(String resourcePath, Path targetPath) throws IOException {
+        try (InputStream is = getClass().getClassLoader().getResourceAsStream(resourcePath)) {
+            if (is == null) {
+                log.warn("classpath中未找到资源: {}, 跳过复制", resourcePath);
+                return;
+            }
+            Files.copy(is, targetPath, StandardCopyOption.REPLACE_EXISTING);
         }
     }
 
@@ -309,6 +340,8 @@ public class RS6Item {
      */
     private void writeJsFile(String filename, String content) throws IOException {
         Path filePath = Paths.get(scriptDir, filename);
+        // 确保父目录存在
+        Files.createDirectories(filePath.getParent());
         int maxRetries = 3;
         long retryDelayMs = 500;
         
@@ -379,7 +412,7 @@ public class RS6Item {
         }
 
         /*RS6Item rs6Item = createRS6Instance();
-        String projectRootPath = rs6Item.getProjectRootPath();
-        System.out.println(projectRootPath);*/
+        String scriptDir = rs6Item.scriptDir;
+        System.out.println(scriptDir);*/
     }
 }

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

@@ -17,12 +17,12 @@ import com.jzg.commons.exception.SystemException;
 import com.jzg.commons.util.AssertionUtils;
 import com.jzg.commons.util.MinioUtils;
 import com.jzg.commons.util.StringUtils;
+import com.jzg.commons.util.idgen.IdGenerate;
 import com.jzg.organization.client.EsmInsCompanyClient;
 import com.jzg.organization.mapper.PtlAgreementMapper;
 import com.jzg.organization.mapper.SysUploadFilesMapper;
 import com.jzg.organization.mapper.SysUserMapper;
 import com.jzg.organization.service.*;
-import io.seata.spring.annotation.GlobalTransactional;
 import org.apache.commons.lang3.ObjectUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -436,7 +436,7 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
 
         // 查询所有承保规则明细
         LambdaQueryWrapper<PtlAgreementUndwrtRulesAttrLink> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.in(PtlAgreementUndwrtRulesAttrLink::getId, rulesIds);
+        queryWrapper.in(PtlAgreementUndwrtRulesAttrLink::getRulesId, rulesIds);
         List<PtlAgreementUndwrtRulesAttrLink> linkList = agreementUndwrtRulesAttrLinkService.list(queryWrapper);
         Map<String, List<PtlAgreementUndwrtRulesAttrLink>> linkMap = linkList.stream().collect(
                 Collectors.groupingBy(PtlAgreementUndwrtRulesAttrLink::getRulesId));
@@ -469,6 +469,7 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
             PtlAgreementUndwrtRules maxRules = agreementRulesService.getOne(undwrtRulesLambdaQueryWrapper);
             newAgreementUndwrtRules.setOrderNum(Objects.nonNull(maxRules) ? maxRules.getOrderNum() + 1 : 1);
             newAgreementUndwrtRules.setAgreementId(newAgreement.getId());
+            newAgreementUndwrtRules.setParentId(IdGenerate.nextId());
             agreementRulesService.save(newAgreementUndwrtRules);
 
             // 复制承保规则因子

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

@@ -590,8 +590,8 @@ public class PtlAgreementUndwrtRulesServiceImpl extends ServiceImpl<PtlAgreement
             sourceRuleIds = List.of(ruleId);
         }
 
-        // 批量复制:多条规则共享同一个新 parentId
-        String newParentId = sourceRuleIds.size() > 1 ? IdGenerate.nextId() : null;
+        // 复制时给新规则重新生成 parentId,避免与原规则共享 parent_id
+        String newParentId = IdGenerate.nextId();
         List<RulesGroupParam> groups = new ArrayList<>();
 
         // 获取属性映射(用于组装返回结果)

+ 10 - 14
tenant/organization/src/main/java/com/jzg/organization/service/impl/PtlSchemeServiceImpl.java

@@ -438,27 +438,22 @@ public class PtlSchemeServiceImpl extends ServiceImpl<PtlSchemeMapper, PtlScheme
         //   3. 关联账号必须可用 (useStatus == "0") 且可报价 (quoteStatus == "0")
         // 过滤后如果某保司没有任何有效协议,会被下面的 removeIf 自动排除
         if (CollUtil.isNotEmpty(companyList)) {
-            // 1. 收集所有需要校验的归属账号 id(去重)
+            // 1. 收集所有需要校验的归属账号 id
             List<String> attributionIds = companyList.stream()
                     .flatMap(c -> Optional.ofNullable(c.getAgreements()).orElse(Collections.emptyList()).stream())
                     .map(PtlAgreement::getAttributionId)
                     .filter(StrUtil::isNotBlank)
-                    .distinct()
                     .collect(Collectors.toList());
 
             // 2. 并行批量查询归属账号,构建 id -> 账号信息 索引(避免逐协议串行 RPC)
-            Map<String, PtlAgreementAttribution> attributionMap;
+            Map<String, PtlAgreementAttribution> attributionMap = Map.of();
             if (CollUtil.isNotEmpty(attributionIds)) {
-                attributionMap = attributionIds.parallelStream().collect(HashMap::new, (map, id) -> {
-                    try {
-                        HttpResult<PtlAgreementAttribution> res = platformClient.getAgreementAttribution2(id);
-                        if (res.getCode() == 200 && res.getData() != null) {
-                            map.put(id, res.getData());
-                        }
-                    } catch (Exception e) {
-                        log.warn("批量查询协议归属账号[{}]异常,默认保留", id, e);
+                HttpResult<List<PtlAgreementAttribution>> batchRes = platformClient.getAgreementAttributionByIds(attributionIds);
+                for (PtlAgreementAttribution attr : batchRes.getData()) {
+                    if (attr != null && StrUtil.isBlank(attr.getId())) {
+                        attributionMap.put(attr.getId(), attr);
                     }
-                }, HashMap::putAll);
+                }
             } else {
                 attributionMap = Collections.emptyMap();
             }
@@ -469,6 +464,7 @@ public class PtlSchemeServiceImpl extends ServiceImpl<PtlSchemeMapper, PtlScheme
                 if (CollUtil.isEmpty(agreements)) {
                     continue;
                 }
+                Map<String, PtlAgreementAttribution> finalAttributionMap = attributionMap;
                 List<PtlAgreement> validAgreements = agreements.stream()
                         // 协议自身状态
                         .filter(a -> a.getIsEnable() != null && a.getIsEnable() == 0)
@@ -479,7 +475,7 @@ public class PtlSchemeServiceImpl extends ServiceImpl<PtlSchemeMapper, PtlScheme
                             if (StrUtil.isBlank(attributionId)) {
                                 return true; // 没有关联账号,不做账号校验
                             }
-                            PtlAgreementAttribution attr = attributionMap.get(attributionId);
+                            PtlAgreementAttribution attr = finalAttributionMap.get(attributionId);
                             if (attr == null) {
                                 return true; // 查不到账号信息,默认保留
                             }
@@ -560,8 +556,8 @@ public class PtlSchemeServiceImpl extends ServiceImpl<PtlSchemeMapper, PtlScheme
                     dispatchAttrVo.setCompanyId(vo.getCompanyId());
                     dispatchAttrVo.setSectionGroups(grouped);
                     dispatchAttrVos.add(dispatchAttrVo);
+                    dispatchRuleVos.getDispatchAttrVos().addAll(dispatchAttrVos);
                 }
-                dispatchRuleVos.getDispatchAttrVos().addAll(dispatchAttrVos);
             }
         } catch (Exception e) {
             log.warn("批量查询协议调度异常", e);

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

@@ -6,7 +6,7 @@
 
     <resultMap id="ActionMap" type="com.jzg.commons.entity.agreement.dispatch.dto.PtlAgreementDispatchAfterAction">
         <id property="id" column="id"/>
-        <result property="companyId" column="companyId"/>
+        <result property="companyId" column="company_id"/>
         <result property="actionCode" column="action_code"/>
         <result property="actionJson" column="action_json"
                 typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"/>