Browse Source

客户方部署优化修改

chenendian 3 tuần trước cách đây
mục cha
commit
1ed6ebeead
17 tập tin đã thay đổi với 215 bổ sung36 xóa
  1. 2 0
      siwei-modules/siwei-apply/src/main/java/com/siwei/apply/controller/cadastre/CadastreManageController.java
  2. 1 0
      siwei-modules/siwei-apply/src/main/java/com/siwei/apply/domain/Jsgcghxk.java
  3. 1 0
      siwei-modules/siwei-apply/src/main/java/com/siwei/apply/domain/Jsydghxk.java
  4. 1 0
      siwei-modules/siwei-apply/src/main/java/com/siwei/apply/domain/Tdhyhs.java
  5. 1 0
      siwei-modules/siwei-apply/src/main/java/com/siwei/apply/domain/vo/JsgcghxkVo.java
  6. 1 0
      siwei-modules/siwei-apply/src/main/java/com/siwei/apply/domain/vo/JsydghxkVo.java
  7. 1 0
      siwei-modules/siwei-apply/src/main/java/com/siwei/apply/domain/vo/TdhyhsVo.java
  8. 10 0
      siwei-modules/siwei-apply/src/main/java/com/siwei/apply/mapper/JsgcghxkMapper.java
  9. 4 0
      siwei-modules/siwei-apply/src/main/java/com/siwei/apply/mapper/JsydghxkMapper.java
  10. 13 0
      siwei-modules/siwei-apply/src/main/java/com/siwei/apply/mapper/ProjectMapper.java
  11. 17 8
      siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/impl/NodeAttachmentImpl.java
  12. 36 13
      siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/impl/ProjectImpl.java
  13. 59 9
      siwei-modules/siwei-apply/src/main/java/com/siwei/apply/utils/ServiceFileUtil.java
  14. 33 2
      siwei-modules/siwei-apply/src/main/resources/mapper/JsgcghxkMapper.xml
  15. 13 2
      siwei-modules/siwei-apply/src/main/resources/mapper/JsydghxkMapper.xml
  16. 16 0
      siwei-modules/siwei-apply/src/main/resources/mapper/ProjectMapper.xml
  17. 6 2
      siwei-modules/siwei-apply/src/main/resources/mapper/TdhyhsMapper.xml

+ 2 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/controller/cadastre/CadastreManageController.java

@@ -340,6 +340,8 @@ public class CadastreManageController extends BaseController {
                 String qlrWhere = cadastreManageService.getQlrList(qlr);
                 if(StringUtils.isNotBlank(qlrWhere)){
                     ywh +=  " AND "+qlrWhere;
+                }else{
+                    ywh +=  " AND 1=2 ";
                 }
             }
             List<Map<String, Object>> res = cadastreManageService.selectTableRow(tableName, geomFlag, bsm, ywh);

+ 1 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/domain/Jsgcghxk.java

@@ -28,4 +28,5 @@ public class Jsgcghxk extends BaseId {
     private Date createdAt; // 创建时间
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date updatedAt; // 更新时间
+    private String sourceId; // 同步表id
 }

+ 1 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/domain/Jsydghxk.java

@@ -31,4 +31,5 @@ public class Jsydghxk extends BaseId {
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date updatedAt;            // 更新时间
     private String ydUnit;             // 用地面积单位(对应列:yd_unit)
+    private String sourceId;           // 同步表id
 }

+ 1 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/domain/Tdhyhs.java

@@ -31,4 +31,5 @@ public class Tdhyhs extends BaseId {
     private Date createdAt;             // 创建时间
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date updatedAt;             // 更新时间
+    private String sourceId;           // 同步表id
 }

+ 1 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/domain/vo/JsgcghxkVo.java

@@ -16,4 +16,5 @@ public class JsgcghxkVo {
     private String zsbh; // 证书编号
     private String fzjg; // 发证机关
     private String fzDate; // 发证日期
+    private String sourceId; // 同步表id
 }

+ 1 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/domain/vo/JsydghxkVo.java

@@ -20,4 +20,5 @@ public class JsydghxkVo {
     private String zsbh;               // 证书编号
     private String fzjg;               // 发证机关
     private String fzDate;               // 发证日期
+    private String sourceId;            // 同步表id
 }

+ 1 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/domain/vo/TdhyhsVo.java

@@ -15,5 +15,6 @@ public class TdhyhsVo {
     private String jsdw;                // 建设单位
     private String gljsgcghxkh;         // 关联建设工程规划许可号
     private String hyyj;                // 核验意见
+    private String sourceId;            // 同步表id
 
 }

+ 10 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/mapper/JsgcghxkMapper.java

@@ -6,6 +6,7 @@ import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
+import java.util.Map;
 
 // 建设工程规划许可 Mapper 接口
 @Mapper
@@ -48,4 +49,13 @@ public interface JsgcghxkMapper {
      * @param hasOnchain 是否上链
      */
     void updateHasOnchain(@Param("id") String id, @Param("hasOnchain") Boolean hasOnchain);
+
+
+    List<Map<String,String>> getNoShipNode(@Param("nodeTableName") String nodeTableName);
+
+
+    List<Map<String,String>> getNoOnchainNodeList(@Param("nodeTableName") String nodeTableName);
+
+
+
 }

+ 4 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/mapper/JsydghxkMapper.java

@@ -5,6 +5,8 @@ import com.siwei.apply.domain.vo.JsydghxkUpdateVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
+
 // 建设用地规划许可 Mapper 接口
 @Mapper
 public interface JsydghxkMapper {
@@ -28,6 +30,8 @@ public interface JsydghxkMapper {
      */
     Jsydghxk get(String projectId);
 
+    List<Jsydghxk> getList(String projectId);
+
     /**
      * 获取建设用地规划许可信息(按主键ID)
      */

+ 13 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/mapper/ProjectMapper.java

@@ -87,6 +87,19 @@ public interface ProjectMapper {
     Integer getSearchGraphicLayerCount(ProjectFilterVo projectFilterVo);
 
 
+    /**
+     * 获取工改同步项目信息
+     * @param nodeTableName
+     * @return
+     */
+    List<Project> getZrzysiteProjectList(String nodeTableName);
+
+
+
+    String getNodeSourceIdByTable(@Param("nodeId")String nodeId,@Param("tableName") String tableName);
+
+
+
 
 
 }

+ 17 - 8
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/impl/NodeAttachmentImpl.java

@@ -448,16 +448,25 @@ public class NodeAttachmentImpl implements NodeAttachmentService {
                     nodeAttachment = this.assemblyAttachment(projectId,GyjsydscdjAttachmentNameEnum.NAME_3,nodeAttachment);
                     nodeAttachment = this.assemblyAttachment(projectId,GyjsydscdjAttachmentNameEnum.NAME_4,nodeAttachment);
                 } else if(AloneWorkFlowEnum.NODE_4.getTableName().equalsIgnoreCase(nodeTableName)){
-                    nodeAttachment = this.assemblyAttachment(projectId,JsydghxkAttachmentNameEnum.NAME_3,nodeAttachment);
-                    nodeAttachment = this.assemblyAttachment(projectId,JsydghxkAttachmentNameEnum.NAME_4,nodeAttachment);
-                    nodeAttachment = this.assemblyAttachment(projectId,JsydghxkAttachmentNameEnum.NAME_5,nodeAttachment);
+                    String sourceId =  projectMapper.getNodeSourceIdByTable(nodeId,nodeTableName);
+                    if(StringUtils.isBlank(sourceId)){
+                        nodeAttachment = this.assemblyAttachment(projectId,JsydghxkAttachmentNameEnum.NAME_3,nodeAttachment);
+                        nodeAttachment = this.assemblyAttachment(projectId,JsydghxkAttachmentNameEnum.NAME_4,nodeAttachment);
+                        nodeAttachment = this.assemblyAttachment(projectId,JsydghxkAttachmentNameEnum.NAME_5,nodeAttachment);
+                    }
                 }else if(AloneWorkFlowEnum.NODE_5.getTableName().equalsIgnoreCase(nodeTableName)){
-                    nodeAttachment = this.assemblyAttachment(projectId,JsgcghxkAttachmentNameEnum.NAME_2,nodeAttachment);
-                    nodeAttachment = this.assemblyAttachment(projectId,JsgcghxkAttachmentNameEnum.NAME_3,nodeAttachment);
-                    nodeAttachment = this.assemblyAttachment(projectId,JsgcghxkAttachmentNameEnum.NAME_5,nodeAttachment);
+                    String sourceId =  projectMapper.getNodeSourceIdByTable(nodeId,nodeTableName);
+                    if(StringUtils.isBlank(sourceId)) {
+                        nodeAttachment = this.assemblyAttachment(projectId, JsgcghxkAttachmentNameEnum.NAME_2, nodeAttachment);
+                        nodeAttachment = this.assemblyAttachment(projectId, JsgcghxkAttachmentNameEnum.NAME_3, nodeAttachment);
+                        nodeAttachment = this.assemblyAttachment(projectId, JsgcghxkAttachmentNameEnum.NAME_5, nodeAttachment);
+                    }
                 }else if(AloneWorkFlowEnum.NODE_6.getTableName().equalsIgnoreCase(nodeTableName)){
-                    nodeAttachment = this.assemblyAttachment(projectId,TdhyhsAttachmentNameEnum.NAME_3,nodeAttachment);
-                    nodeAttachment = this.assemblyAttachment(projectId,TdhyhsAttachmentNameEnum.NAME_5,nodeAttachment);
+                    String sourceId =  projectMapper.getNodeSourceIdByTable(nodeId,nodeTableName);
+                    if(StringUtils.isBlank(sourceId)) {
+                        nodeAttachment = this.assemblyAttachment(projectId, TdhyhsAttachmentNameEnum.NAME_3, nodeAttachment);
+                        nodeAttachment = this.assemblyAttachment(projectId, TdhyhsAttachmentNameEnum.NAME_5, nodeAttachment);
+                    }
                 }else if(AloneWorkFlowEnum.NODE_7.getTableName().equalsIgnoreCase(nodeTableName)){
                     nodeAttachment = this.assemblyAttachment(projectId,GyjsydjfwscdjAttachmentNameEnum.NAME_1,nodeAttachment);
                     nodeAttachment = this.assemblyAttachment(projectId,GyjsydjfwscdjAttachmentNameEnum.NAME_2,nodeAttachment);

+ 36 - 13
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/impl/ProjectImpl.java

@@ -42,11 +42,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.servlet.http.HttpServletResponse;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.Serializable;
+import java.io.*;
 import java.math.BigDecimal;
 import java.net.URLEncoder;
 import java.nio.charset.Charset;
@@ -1960,18 +1956,45 @@ public class ProjectImpl implements ProjectService {
         return currentProjectWorkflow;
     }
 
+
+
+
+//    @Override
+//    public JSONArray getResourceData() throws IOException {
+//        java.net.URL fileURL = this.getClass().getResource("/one_code_index_v1.json");
+//        // String fileName = "classpath:reportConfig.txt";
+//        String fileName = fileURL.getPath();
+//        String configStr = FileUtils.readFileToString(new File(fileName), StandardCharsets.UTF_8);
+//        JSONArray aa = JSON.parseArray(configStr);
+//        enrichCycleResourceData(aa);
+//        log.info("------------" + aa.toJSONString());
+//        return aa;
+//    }
+
+
     @Override
     public JSONArray getResourceData() throws IOException {
-        java.net.URL fileURL = this.getClass().getResource("/one_code_index_v1.json");
-        // String fileName = "classpath:reportConfig.txt";
-        String fileName = fileURL.getPath();
-        String configStr = FileUtils.readFileToString(new File(fileName), StandardCharsets.UTF_8);
-        JSONArray aa = JSON.parseArray(configStr);
-        enrichCycleResourceData(aa);
-        log.info("------------" + aa.toJSONString());
-        return aa;
+        // 获取资源输入流,兼容开发环境 + jar包环境
+        try (BufferedReader reader = new BufferedReader(
+                new InputStreamReader(
+                        this.getClass().getResourceAsStream("/one_code_index_v1.json"),
+                        StandardCharsets.UTF_8
+                )
+        )) {
+            StringBuilder sb = new StringBuilder();
+            String line;
+            while ((line = reader.readLine()) != null) {
+                sb.append(line);
+            }
+            String configStr = sb.toString();
+            JSONArray aa = JSON.parseArray(configStr);
+            enrichCycleResourceData(aa);
+            log.info("------------" + aa.toJSONString());
+            return aa;
+        }
     }
 
+
     private void enrichCycleResourceData(JSONArray nodes) {
         if (nodes == null) {
             return;

+ 59 - 9
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/utils/ServiceFileUtil.java

@@ -8,10 +8,11 @@ import org.apache.commons.io.FilenameUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
+import java.io.*;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
 import java.nio.file.*;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -48,7 +49,7 @@ public class ServiceFileUtil {
             directoryPathAndName = createFilePath + "/" + extractFilename(directoryName);
             Path file = Paths.get(directoryPathAndName);
             if (Files.exists(file)) {
-                logger.warn("处理文件失败:文件存在: {}", directoryPathAndName);
+                logger.warn("处理文件失败:文件存在: {}", directoryPathAndName);
             } else {
                 //直接创建目录
                 Path extractPath = Paths.get(directoryPathAndName);
@@ -72,14 +73,14 @@ public class ServiceFileUtil {
     }
 
 
-    //给定一个名称创建一个目录,返回路径
+    //创建子目录
     public static String createDirectory(String directoryPath, String directoryName) {
         String directoryPathAndName = null;
         try {
             directoryPathAndName = directoryPath + "/" + directoryName;
             Path file = Paths.get(directoryPathAndName);
             if (Files.exists(file)) {
-                logger.warn("处理文件失败:文件存在: {}", directoryPathAndName);
+                logger.warn("处理文件失败:文件已经存在: {}", directoryPathAndName);
             } else {
                 //直接创建目录
                 Path extractPath = Paths.get(directoryPathAndName);
@@ -125,7 +126,8 @@ public class ServiceFileUtil {
         Path dirPath = Paths.get(directoryPath);
         if (!Files.exists(dirPath)) {
             logger.warn("目录不存在: {}", directoryPath);
-            throw new ServiceException("目录不存在: " + directoryPath);
+            //throw new ServiceException("目录不存在: " + directoryPath);
+            return;
         }
         Files.walk(dirPath)
                 .sorted(Comparator.reverseOrder())
@@ -305,6 +307,47 @@ public class ServiceFileUtil {
     }
 
 
+    /**
+     * 下载远程网络文件
+     * @param fileURL
+     * @param destinationPath
+     * @throws IOException
+     */
+    public static void downloadFile(String fileURL,String fileName, String destinationPath) throws IOException {
+        String encodeFileName = URLEncoder.encode(fileName, StandardCharsets.UTF_8.name());
+        String newUrl = fileURL.replaceAll("&fileName=[^&]*$", "");
+        // 拼接合法URL
+        String fullUrl = newUrl + "&fileName=" + encodeFileName;
+        URL url = new URL(fullUrl);
+        HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+        connection.setRequestMethod("GET");
+        connection.setConnectTimeout(5000); // 设置连接超时时间
+        connection.setReadTimeout(5000); // 设置读取超时时间
+        int contentLength = connection.getContentLength(); // 获取文件大小
+
+        System.out.println("Downloading file of size: " + contentLength + " bytes");
+
+        //目录路径许哟啊拼接文件名称
+        destinationPath += "/"+ fileName;
+
+        try (BufferedInputStream in = new BufferedInputStream(connection.getInputStream());
+             FileOutputStream out = new FileOutputStream(destinationPath)) {
+
+            byte[] buffer = new byte[1024];
+            int bytesRead;
+
+            while ((bytesRead = in.read(buffer)) != -1) {
+                out.write(buffer, 0, bytesRead);
+            }
+
+            System.out.println("Download completed.");
+        } finally {
+            connection.disconnect();
+        }
+    }
+
+
+
 
 
 
@@ -322,7 +365,14 @@ public class ServiceFileUtil {
     public static void main(String[] args) {
         System.out.println("==========start=============");
         try {
-            test();
+
+            String baseUrl = "http://10.224.130.138:7071/aplanmis-rest/province/downDzzzFileByFileId?fileId=605028ecf919500a380acc5a&fileName=阳光三路工程规划许可证申请表.pdf";
+            String fileName = "阳光三路工程规划许可证申请表.pdf";
+
+            String savePath = "C:\\home\\siwei\\uploadPath\\2026\\06\\13\\建设用地规划许可_20260613182743A035_20260613182743A036\\建设工程规划许可证申请表";
+            downloadFile(baseUrl, fileName, savePath);
+
+            downloadFile(baseUrl,fileName,savePath);
         } catch (Exception e) {
             throw new RuntimeException(e);
         }

+ 33 - 2
siwei-modules/siwei-apply/src/main/resources/mapper/JsgcghxkMapper.xml

@@ -22,6 +22,7 @@
         <result property="creatorId" column="creator_id"/>
         <result property="createdAt" column="created_at"/>
         <result property="updatedAt" column="updated_at"/>
+        <result property="sourceId" column="source_id"/>
     </resultMap>
 
     <select id="isExit" resultType="Boolean">
@@ -33,9 +34,9 @@
     <!-- 新增 -->
     <insert id="add" parameterType="com.siwei.apply.domain.Jsgcghxk">
         INSERT INTO t_jsgcghxk (id, project_id, ydwz, yddw, qs, djq, jsgm, zsbh, fzjg, fz_date, has_onchain,
-                                creator_id, created_at, updated_at)
+                                creator_id, created_at, updated_at,source_id)
         VALUES (#{id}, #{projectId}, #{ydwz}, #{yddw}, #{qs}, #{djq}, #{jsgm}, #{zsbh}, #{fzjg}, #{fzDate},
-                false, #{creatorId}, now(), now())
+                false, #{creatorId}, now(), now(),#{sourceId})
     </insert>
 
     <!-- 根据项目ID获取记录 -->
@@ -67,6 +68,7 @@
             <if test="fzjg != null">fzjg = #{fzjg},</if>
             <if test="fzDate != null">fz_date = #{fzDate},</if>
             <if test="hasOnchain != null">has_onchain = #{hasOnchain},</if>
+            <if test="sourceId != null">source_id = #{sourceId},</if>
             updated_at = now()
         </set>
         WHERE id = #{id}
@@ -79,4 +81,33 @@
         WHERE id = #{id}
     </update>
 
+
+    <!-- 关联查询所有的未上链的,并且同步过来的数据,并且项目存在的,没有进行上传矢量的节点 -->
+    <select id="getNoShipNode" resultType="Map" parameterType="String">
+        SELECT
+            node.id,node.project_id
+        FROM  ${nodeTableName}  node
+                LEFT JOIN t_project P ON node.project_id = P.ID
+                LEFT JOIN t_node_land land ON node.ID = land.node_id
+        WHERE  node.has_onchain = false  and node.source_id is not null and p.id is not null and land.id is null;
+    </select>
+
+
+
+    <!-- 关联查询所有的未上链的,并且同步过来的数据,并且项目存在的-->
+    <select id="getNoOnchainNodeList" resultType="Map" parameterType="String">
+        SELECT
+            node.id,node.project_id
+        FROM  ${nodeTableName}  node
+                  LEFT JOIN t_project P ON node.project_id = P.ID
+        WHERE  node.has_onchain = false  and node.source_id is not null and p.id is not null
+    </select>
+
+
+
+
+
+
+
+
 </mapper>

+ 13 - 2
siwei-modules/siwei-apply/src/main/resources/mapper/JsydghxkMapper.xml

@@ -25,6 +25,7 @@
         <result property="creatorId" column="creator_id"/>
         <result property="createdAt" column="created_at"/>
         <result property="updatedAt" column="updated_at"/>
+        <result property="sourceId" column="source_id"/>
     </resultMap>
 
     <select id="isExit" resultType="Boolean">
@@ -36,9 +37,9 @@
     <!-- 添加记录 -->
     <insert id="add" parameterType="com.siwei.apply.domain.Jsydghxk">
         INSERT INTO t_jsydghxk (id, project_id, yddw, ydwz, yd_area, yd_unit, tdyt, tdhqfs, pzydjg, pzydwh,
-                                jsgm, zsbh, fzjg, fz_date, has_onchain, creator_id, created_at, updated_at)
+                                jsgm, zsbh, fzjg, fz_date, has_onchain, creator_id, created_at, updated_at, source_id)
         VALUES (#{id}, #{projectId}, #{yddw}, #{ydwz}, #{ydArea}, #{ydUnit}, #{tdyt}, #{tdhqfs}, #{pzydjg}, #{pzydwh},
-                #{jsgm}, #{zsbh}, #{fzjg}, #{fzDate}, false, #{creatorId}, now(), now())
+                #{jsgm}, #{zsbh}, #{fzjg}, #{fzDate}, false, #{creatorId}, now(), now(), #{sourceId})
     </insert>
 
     <!-- 根据项目ID获取记录 -->
@@ -46,6 +47,15 @@
         SELECT *
         FROM t_jsydghxk
         WHERE project_id = #{projectId}
+        LIMIT 1
+    </select>
+
+    <!-- 根据项目ID获取记录列表 -->
+    <select id="getList" resultMap="BaseResultMap" parameterType="String">
+        SELECT *
+        FROM t_jsydghxk
+        WHERE project_id = #{projectId}
+        ORDER BY created_at ASC
     </select>
 
     <!-- 新增:根据主键ID获取记录 -->
@@ -73,6 +83,7 @@
             <if test="fzjg != null">fzjg = #{fzjg},</if>
             <if test="fzDate != null">fz_date = #{fzDate},</if>
             <if test="hasOnchain != null">has_onchain = #{hasOnchain},</if>
+            <if test="sourceId != null">source_id = #{sourceId},</if>
             updated_at = now()
         </set>
         WHERE id = #{id}

+ 16 - 0
siwei-modules/siwei-apply/src/main/resources/mapper/ProjectMapper.xml

@@ -815,5 +815,21 @@
     </delete>
 
 
+    <select id="getNodeSourceIdByTable"   resultType="string" >
+        SELECT source_id FROM ${tableName}
+        WHERE id = #{nodeId}
+    </select>
+
+
+    <!-- 1.查询项目代码存在的所有项目,并且工程建设环节无新增数据的条数。2.查询当前环节已经新增数据但是未上链并且未同步过的数据(source_id-同步数据id)) -->
+    <select id="getZrzysiteProjectList" resultMap="projectMap">
+        SELECT    p.id,p.name,p.code ,p.project_type,  '1'  as creator_id
+        from "public"."t_project" p  LEFT JOIN  "public"."t_project_workflow"  w on p.id = w.project_id     and w.node_table_name=#{tableName}
+        where    LENGTH(TRIM(p.code))>0   and   w.id is  null
+        union
+        SELECT DISTINCT  p.id,p.name,p.code ,p.project_type ,'2' as  creator_id
+        from "public"."t_project"  p  LEFT JOIN "public".${tableName}  node  on  p.id=node.project_id
+        where  LENGTH(TRIM(p.code))>0   and  node.has_onchain=false  and  node.source_id is null
+    </select>
 
 </mapper>

+ 6 - 2
siwei-modules/siwei-apply/src/main/resources/mapper/TdhyhsMapper.xml

@@ -18,6 +18,8 @@
         <result property="creatorId" column="creator_id"/>
         <result property="createdAt" column="created_at"/>
         <result property="updatedAt" column="updated_at"/>
+        <result property="hyyj" column="hyyj"/>
+        <result property="sourceId" column="source_id"/>
     </resultMap>
 
     <select id="isExit" resultType="Boolean">
@@ -31,11 +33,11 @@
         INSERT INTO t_tdhyhs (id, project_id, ydwz, hgzh, fzjg, fz_date,
                                jsdw, gljsgcghxkh,hyyj,
                                has_onchain, creator_id,
-                               created_at, updated_at)
+                               created_at, updated_at, source_id)
         VALUES (#{id}, #{projectId}, #{ydwz}, #{hgzh}, #{fzjg}, #{fzDate},
                 #{jsdw}, #{gljsgcghxkh},#{hyyj},
                 false, #{creatorId},
-                now(), now())
+                now(), now(), #{sourceId})
     </insert>
 
     <!-- 根据项目ID获取记录(返回全部,按创建时间升序) -->
@@ -64,7 +66,9 @@
             <if test="fzDate != null">fz_date = #{fzDate},</if>
             <if test="jsdw != null">jsdw = #{jsdw},</if>
             <if test="gljsgcghxkh != null">gljsgcghxkh = #{gljsgcghxkh},</if>
+            <if test="hyyj != null">hyyj = #{hyyj},</if>
             <if test="hasOnchain != null">has_onchain = #{hasOnchain},</if>
+            <if test="sourceId != null">source_id = #{sourceId},</if>
             updated_at = now()
         </set>
         WHERE id = #{id}