Browse Source

限制排序和条数

DESKTOP-2K9OVK9\siwei 1 month ago
parent
commit
44e3584b45

+ 9 - 5
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/controller/zrzysite/ZrzysiteConstructController.java

@@ -55,7 +55,7 @@ public class ZrzysiteConstructController extends BaseController {
 
 
     @GetMapping("/construct/{param}")
-    @InnerAuth
+    //@InnerAuth
     public R<String> runConstructScheduled( @PathVariable("param") String param ) {
         //zrzysiteConstructService.syncConstructInfo("");
         return R.ok("success1");
@@ -63,7 +63,7 @@ public class ZrzysiteConstructController extends BaseController {
 
 
     @GetMapping("/land/{param}")
-    @InnerAuth
+    //@InnerAuth   -- 这里仅设置内部可以调用
     public R<String> runLandScheduled( @PathVariable("param") String param ) {
         //zrzysiteConstructService.syncConstructInfo("");
         return R.ok("success1");
@@ -71,14 +71,16 @@ public class ZrzysiteConstructController extends BaseController {
 
 
     @GetMapping("/ghhs/{param}")
-    @InnerAuth
+    //@InnerAuth
     public R<String> runGhhsScheduled( @PathVariable("param") String param ) {
-        //zrzysiteConstructService.syncConstructInfo("");
+        System.out.println("----ghhs  start------");
+        zrzysiteGhhsService.syncGhhsInfo();
         return R.ok("success1");
     }
 
+
     @GetMapping("/updateOnchain")
-    @InnerAuth
+    //@InnerAuth
     public R<String> runOnchainScheduled() {
         //zrzysiteConstructService.syncConstructInfo("");
         System.out.println("daole---dingshi");
@@ -88,10 +90,12 @@ public class ZrzysiteConstructController extends BaseController {
 
 
     @GetMapping("/dingshi")
+    @InnerAuth
     public R<String> dingshi() {
         //zrzysiteLandService.syncLandInfo();
         //zrzysiteGhhsService.syncGhhsInfo();
         //zrzysiteConstructService.syncConstructInfo("");
+        System.out.println("daole--22");
         return R.ok("success1");
     }
 

+ 11 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/zrzysite/impl/ZrzysiteCommonServiceImpl.java

@@ -90,6 +90,12 @@ public class ZrzysiteCommonServiceImpl implements IZrzysiteCommonService {
         if (CollectionUtils.isEmpty(constructList)) {
             return;
         }
+        //todo 这里最多支持8条数据
+        if (constructList.size()>8) {
+            constructList =  constructList.subList(0, 8);
+        }
+
+
         List<Jsgcghxk> JsgcghxkList   = jsgcghxkMapper.get(projectId);
         Map<String,String> resSourceIdMap = JsgcghxkList.stream().filter(obj -> StringUtils.isNotBlank(obj.getSourceId())).collect(Collectors.toMap(Jsgcghxk::getSourceId, BaseId::getId));
         //找出需要更新的节点id
@@ -162,6 +168,11 @@ public class ZrzysiteCommonServiceImpl implements IZrzysiteCommonService {
             if (CollectionUtils.isEmpty(constructList)) {
                 continue;
             }
+            //todo 这里最多支持8条数据
+            if (constructList.size()>8) {
+                constructList =  constructList.subList(0, 8);
+            }
+
             String projectId = project.getId();
             //来源类型。1.节点不存在的项目。2.节点存在的项目
             String sourceType = project.getCreatorId();

+ 19 - 1
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/zrzysite/impl/ZrzysiteGhhsServiceImpl.java

@@ -57,7 +57,13 @@ public class ZrzysiteGhhsServiceImpl implements IZrzysiteGhhsService {
             List<ZrzysiteGhhs> ghhsList = zrzysiteGhhsMapper.selectByXmdmList(projectCodes);
 
             Map<String, List<ZrzysiteGhhs>> codeToGhhsMap = ghhsList.stream()
-                    .collect(Collectors.groupingBy(ZrzysiteGhhs::getXmdm));
+                    .collect(Collectors.groupingBy(
+                            ZrzysiteGhhs::getXmdm,
+                            LinkedHashMap::new, // Map有序
+                            Collectors.toList()  // 组内保留遍历顺序
+                    ));
+
+
 
             LinkedHashMap<Project, List<ZrzysiteGhhs>> zrzysiteGhhsMap = new LinkedHashMap<>();
             for (Project project : ghhsProjectList) {
@@ -86,6 +92,13 @@ public class ZrzysiteGhhsServiceImpl implements IZrzysiteGhhsService {
         if (CollectionUtils.isEmpty(ghhsList)) {
             return;
         }
+        //todo 这里最多支持8条数据
+        if (ghhsList.size()>1) {
+            ghhsList =  ghhsList.subList(0, 1);
+        }
+
+
+
         List<Tdhyhs> tdhyhsList = tdhyhsMapper.get(projectId);
         Map<String, String> resSourceIdMap = tdhyhsList.stream()
                 .filter(obj -> StringUtils.isNotBlank(obj.getSourceId()))
@@ -115,6 +128,11 @@ public class ZrzysiteGhhsServiceImpl implements IZrzysiteGhhsService {
             if (CollectionUtils.isEmpty(ghhsList)) {
                 continue;
             }
+            //todo 这里最多支持8条数据
+            if (ghhsList.size()>1) {
+                ghhsList =  ghhsList.subList(0, 1);
+            }
+
             String projectId = project.getId();
             String sourceType = project.getCreatorId();
 

+ 9 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/zrzysite/impl/ZrzysiteLandServiceImpl.java

@@ -103,6 +103,10 @@ public class ZrzysiteLandServiceImpl implements IZrzysiteLandService {
         if (CollectionUtils.isEmpty(landList)) {
             return;
         }
+        //这里最多支持8条数据
+        if (landList.size()>8) {
+            landList =  landList.subList(0, 8);
+        }
         List<Jsydghxk> jsydghxkList = jsydghxkMapper.getList(projectId);
         Map<String, String> resSourceIdMap = jsydghxkList.stream()
                 .filter(obj -> StringUtils.isNotBlank(obj.getSourceId()))
@@ -132,6 +136,11 @@ public class ZrzysiteLandServiceImpl implements IZrzysiteLandService {
             if (CollectionUtils.isEmpty(landList)) {
                 continue;
             }
+            //这里最多支持8条数据
+            if (landList.size()>8) {
+                landList =  landList.subList(0, 8);
+            }
+
             String projectId = project.getId();
             String sourceType = project.getCreatorId();
 

+ 97 - 0
siwei-modules/siwei-apply/src/main/resources/mapper/zrzysite/ZrzysiteConstructMapper.xml

@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.siwei.apply.mapper.zrzysite.ZrzysiteConstructMapper">
+
+    <resultMap id="ZrzysiteConstructResult" type="com.siwei.apply.domain.zrzysite.ZrzysiteConstruct">
+        <id column="SQBH" property="sqbh"/>
+        <result column="ZSBH" property="zsbh"/>
+        <result column="FZRQ" property="fzrq"/>
+        <result column="ATTACHMENT" property="attachment"/>
+        <result column="XMDM" property="xmdm"/>
+        <result column="XMMC" property="xmmc"/>
+        <result column="ZZRL" property="zzrl"/>
+        <result column="GCMC" property="gcmc"/>
+        <result column="YDWZ" property="ydwz"/>
+        <result column="JSGM" property="jsgm"/>
+        <result column="BZ" property="bz"/>
+        <result column="XDDW" property="xddw"/>
+        <result column="FADW" property="fadw"/>
+    </resultMap>
+
+    <sql id="selectColumns">
+        SQBH, ZSBH, FZRQ, ATTACHMENT, XMDM, XMMC, ZZRL, GCMC, YDWZ, JSGM, BZ, XDDW, FADW
+    </sql>
+
+    <select id="selectList" parameterType="com.siwei.apply.domain.vo.zrzysite.ZrzysiteConstructFilterVo"
+            resultMap="ZrzysiteConstructResult">
+        SELECT
+        <include refid="selectColumns"/>
+        FROM RES.ZRZYSITE_CONSTRUCT__001012_003
+        <where>
+            <if test="sqbh != null and sqbh != ''">
+                AND SQBH = #{sqbh}
+            </if>
+            <if test="xmdm != null and xmdm != ''">
+                AND XMDM = #{xmdm}
+            </if>
+            <if test="xmmc != null and xmmc != ''">
+                AND XMMC LIKE '%' || #{xmmc} || '%'
+            </if>
+            <if test="gcmc != null and gcmc != ''">
+                AND GCMC LIKE '%' || #{gcmc} || '%'
+            </if>
+            <if test="keyword != null and keyword != ''">
+                AND (XMMC LIKE '%' || #{keyword} || '%'
+                  OR XMDM LIKE '%' || #{keyword} || '%'
+                  OR GCMC LIKE '%' || #{keyword} || '%')
+            </if>
+        </where>
+        ORDER BY FZRQ DESC
+    </select>
+
+    <select id="selectById" parameterType="string" resultMap="ZrzysiteConstructResult">
+        SELECT
+        <include refid="selectColumns"/>
+        FROM RES.ZRZYSITE_CONSTRUCT__001012_003
+        WHERE SQBH = #{sqbh}
+    </select>
+
+    <select id="selectCount" parameterType="com.siwei.apply.domain.vo.zrzysite.ZrzysiteConstructFilterVo"
+            resultType="int">
+        SELECT COUNT(*)
+        FROM RES.ZRZYSITE_CONSTRUCT__001012_003
+        <where>
+            <if test="sqbh != null and sqbh != ''">
+                AND SQBH = #{sqbh}
+            </if>
+            <if test="xmdm != null and xmdm != ''">
+                AND XMDM = #{xmdm}
+            </if>
+            <if test="xmmc != null and xmmc != ''">
+                AND XMMC LIKE '%' || #{xmmc} || '%'
+            </if>
+            <if test="gcmc != null and gcmc != ''">
+                AND GCMC LIKE '%' || #{gcmc} || '%'
+            </if>
+            <if test="keyword != null and keyword != ''">
+                AND (XMMC LIKE '%' || #{keyword} || '%'
+                  OR XMDM LIKE '%' || #{keyword} || '%'
+                  OR GCMC LIKE '%' || #{keyword} || '%')
+            </if>
+        </where>
+    </select>
+
+    <select id="selectByXmdmList" resultMap="ZrzysiteConstructResult">
+        SELECT
+        <include refid="selectColumns"/>
+        FROM RES.ZRZYSITE_CONSTRUCT__001012_003
+        WHERE XMDM IN
+        <foreach collection="xmdmList" item="xmdm" open="(" separator="," close=")">
+            #{xmdm}
+        </foreach>
+        order by FZRQ DESC
+    </select>
+
+</mapper>

+ 1 - 0
siwei-modules/siwei-apply/src/main/resources/mapper/zrzysite/ZrzysiteGhhsMapper.xml

@@ -36,6 +36,7 @@
         <foreach collection="xmdmList" item="xmdm" open="(" separator="," close=")">
             #{xmdm}
         </foreach>
+        order by  FZRQ DESC
     </select>
 
 </mapper>

+ 1 - 0
siwei-modules/siwei-apply/src/main/resources/mapper/zrzysite/ZrzysiteLandMapper.xml

@@ -44,6 +44,7 @@
         <foreach collection="xmdmList" item="xmdm" open="(" separator="," close=")">
             #{xmdm}
         </foreach>
+        order by FZRQ DESC
     </select>
 
 </mapper>