1
0
chenendian 1 день назад
Родитель
Сommit
9a637531b3

+ 27 - 2
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/controller/cadastre/StorageController.java

@@ -6,6 +6,7 @@ import com.siwei.apply.domain.res.StorageYearStatisticsRes;
 import com.siwei.apply.domain.res.TrendStatisticsData;
 import com.siwei.apply.domain.res.TrendStatisticsRes;
 import com.siwei.apply.domain.res.TrendUseStatisticsData;
+import com.siwei.apply.domain.vo.IdsVo;
 import com.siwei.apply.domain.vo.LandSupplyProjectVO;
 import com.siwei.apply.service.cadastre.impl.StorageServiceImpl;
 import com.siwei.common.core.domain.R;
@@ -614,11 +615,12 @@ public class StorageController extends BaseController {
     @GetMapping("/schedule/list")
     public  R<?> scheduleList(
             @RequestParam(value = "sourceType") String sourceType,
+            @RequestParam(value = "nf") String nf,
             @RequestParam(value = "pageNum", required = false) Integer pageNum,
             @RequestParam(value = "pageSize", required = false) Integer pageSize) {
         try {
             startPage();
-            List<Map<String, Object>>  resList = storageServiceImpl.actualList("gj_shouchu_xiangmu",sourceType);
+            List<Map<String, Object>>  resList = storageServiceImpl.actualList("gj_shouchu_xiangmu",sourceType,"",nf);
             return R.ok(getDataTable(resList));
         } catch (Exception e) {
             e.printStackTrace();
@@ -647,11 +649,12 @@ public class StorageController extends BaseController {
 
     @GetMapping("/actual/list")
     public  R<?> actualList(
+            @RequestParam(value = "year", required = false) String year,
             @RequestParam(value = "pageNum", required = false) Integer pageNum,
             @RequestParam(value = "pageSize", required = false) Integer pageSize) {
         try {
             startPage();
-            List<Map<String, Object>>  resList = storageServiceImpl.actualList("gj_shouchu_xiangmu_shiji","");
+            List<Map<String, Object>>  resList = storageServiceImpl.actualList("gj_shouchu_xiangmu_shiji","",year,"");
             return R.ok(getDataTable(resList));
         } catch (Exception e) {
             e.printStackTrace();
@@ -660,6 +663,28 @@ public class StorageController extends BaseController {
     }
 
 
+    /**
+     * type  storage  planType schedule
+     * 根据年份进行删除
+     * @param
+     * @return
+     */
+    @DeleteMapping("")
+    public R<Void> Delete( @RequestParam(value = "type", required = true) String type,
+            @RequestParam(value = "planType", required = true) String planType,
+            @RequestParam(value = "year", required = true) String year) {
+        try {
+            if (year == null || year.isEmpty()) {
+                return R.fail("年份不能为空");
+            }
+            storageServiceImpl.deleteByYear(type,planType,year);
+            return R.ok();
+        } catch (Exception e) {
+            return R.fail(e.getMessage());
+        }
+    }
+
+
 
 
 

+ 2 - 1
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/controller/cadastre/SupplyController.java

@@ -575,11 +575,12 @@ public class SupplyController extends BaseController {
 
     @GetMapping("/schedule/list")
     public  R<?> supplyList(
+            @RequestParam(value = "year", required = false) String year,
             @RequestParam(value = "pageNum", required = false) Integer pageNum,
             @RequestParam(value = "pageSize", required = false) Integer pageSize) {
         try {
             startPage();
-            List<Map<String, Object>>  resList = supplyService.supplyList("gj_gongdi_xiangmu_jihua","");
+            List<Map<String, Object>>  resList = supplyService.supplyList("gj_gongdi_xiangmu_jihua","",year);
             return R.ok(getDataTable(resList));
         } catch (Exception e) {
             e.printStackTrace();

+ 2 - 2
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/mapper/GjShouchuJihuaMapper.java

@@ -27,8 +27,8 @@ public interface GjShouchuJihuaMapper {
 
     int insertTableActualData(@Param("tableName") String tableName, @Param("data") Map<String, Object> data, @Param("shpDbSRID") Integer shpDbSRID);
 
+    List<Map<String, Object>> actualList(@Param("tableName") String tableName,@Param("sourceType") String sourceType,@Param("year") String year,@Param("nf") String nf);
 
-    List<Map<String, Object>> actualList(@Param("tableName") String tableName,@Param("sourceType") String sourceType,@Param("year") String year);
-
+    int deleteByTableYear(@Param("tableName") String tableName,@Param("type") String type, @Param("year") String year);
 
 }

+ 5 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/mapper/GongdiJihuaMapper.java

@@ -37,4 +37,9 @@ public interface GongdiJihuaMapper {
 
     int deleteByTable(@Param("tableName") String tableName, @Param("gid") String gid);
 
+    int deleteByTableYear(@Param("tableName") String tableName,@Param("type") String type, @Param("year") String year);
+
+
+
+
 }

+ 1 - 1
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/cadastre/ISupplyService.java

@@ -34,6 +34,6 @@ public interface ISupplyService {
 
     Map<String, Object> importSupplySchedule(String shpFilePath,String addType);
 
-    List<Map<String, Object>> supplyList(String tableName,String sourceType);
+    List<Map<String, Object>> supplyList(String tableName,String sourceType,String year);
 
 }

+ 21 - 3
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/cadastre/impl/StorageServiceImpl.java

@@ -7,6 +7,7 @@ import com.siwei.apply.domain.res.*;
 import com.siwei.apply.domain.vo.LandSupplyProjectVO;
 import com.siwei.apply.mapper.GjShijiShouchuMapper;
 import com.siwei.apply.mapper.GjShouchuJihuaMapper;
+import com.siwei.apply.mapper.GongdiJihuaMapper;
 import com.siwei.apply.mapper.TdgyMapper;
 import com.siwei.common.core.constant.SecurityConstants;
 import com.siwei.common.core.domain.R;
@@ -59,6 +60,10 @@ public class StorageServiceImpl {
     private RemoteSpatialFilesDbService remoteSpatialFilesDbService;
 
 
+    @Autowired
+    private GongdiJihuaMapper gongdiJihuaMapper;
+
+
 
     public LandStorageInOutReportDTO inOutDetails() {
         LandStorageInOutReportDTO report = new LandStorageInOutReportDTO();
@@ -903,13 +908,26 @@ public class StorageServiceImpl {
         return retMap;
     }
 
-
     //导入实际的数据
-    public List<Map<String, Object>> actualList(String tableName,String sourceType) {
-        List<Map<String, Object>> actualList = gjShouchuJihuaMapper.actualList(tableName,sourceType,"");
+    public List<Map<String, Object>> actualList(String tableName,String sourceType,String year,String nf) {
+        List<Map<String, Object>> actualList = gjShouchuJihuaMapper.actualList(tableName,sourceType,year,nf);
         return actualList;
     }
 
+    //删除指定年份的数据
+    public void deleteByYear(String type,String planType,String year) {
+        if(type.equalsIgnoreCase("storage")){
+            if(planType.equalsIgnoreCase("schedule")){
+                gjShouchuJihuaMapper.deleteByTableYear("gj_shouchu_xiangmu","0",year);
+            }else if(planType.equalsIgnoreCase("transfer")){
+                gjShouchuJihuaMapper.deleteByTableYear("gj_shouchu_xiangmu","1",year);
+            }else if(planType.equalsIgnoreCase("actual")){
+                gjShouchuJihuaMapper.deleteByTableYear("gj_shouchu_xiangmu_shiji","2",year);
+            }
+        }else if(type.equalsIgnoreCase("supply")){
+            gongdiJihuaMapper.deleteByTableYear("gj_gongdi_xiangmu_jihua","2",year);
+        }
+    }
 
 
 }

+ 2 - 3
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/cadastre/impl/SupplyServiceImpl.java

@@ -849,10 +849,9 @@ public class SupplyServiceImpl implements ISupplyService {
     }
 
 
-
     @Override
-    public List<Map<String, Object>> supplyList(String tableName,String sourceType) {
-        List<Map<String, Object>> list = gongdiJihuaMapper.supplyList(tableName,"");
+    public List<Map<String, Object>> supplyList(String tableName,String sourceType,String year) {
+        List<Map<String, Object>> list = gongdiJihuaMapper.supplyList(tableName,year);
         return list;
     }
 

+ 22 - 1
siwei-modules/siwei-apply/src/main/resources/mapper/GjShouchuJihuaMapper.xml

@@ -216,6 +216,9 @@
         <if test="year != null and year != '' and year != '0'">
             AND scnd = #{year}
         </if>
+        <if test="nf != null and nf != '' and nf != '0'">
+            AND scnf = #{nf}
+        </if>
         <if test="sourceType != null and sourceType != ''">
             AND source_type = #{sourceType}
         </if>
@@ -223,7 +226,6 @@
     </select>
 
 
-
     <!-- 根据gid删除记录 -->
     <delete id="deleteByTable" parameterType="String">
         DELETE FROM vector.${tableName}
@@ -236,4 +238,23 @@
         </if>
     </delete>
 
+    <delete id="deleteByTableYear">
+        DELETE FROM vector.${tableName}
+        WHERE 1=1
+        <choose>
+            <when test="'0'.toString().equals(type) and (year != null and year != '' and year != '0')">
+                AND scnf = #{year} and source_type = '0'
+            </when>
+            <when test="'1'.toString().equals(type) and (year != null and year != '' and year != '0')">
+                AND scnf = #{year} and source_type = '1'
+            </when>
+            <when test="'2'.toString().equals(type) and (year != null and year != '' and year != '0')">
+                AND scnd = #{year}
+            </when>
+            <otherwise>
+                AND gid = 0
+            </otherwise>
+        </choose>
+    </delete>
+
 </mapper>

+ 15 - 0
siwei-modules/siwei-apply/src/main/resources/mapper/GongdiJihuaMapper.xml

@@ -241,4 +241,19 @@
         </if>
     </delete>
 
+    <delete id="deleteByTableYear" parameterType="String">
+        DELETE FROM vector.${tableName}
+        WHERE 1=1
+        <choose>
+            <when test="'1'.toString().equals(type) and year != null and year != '' and year != '0'">
+                AND scnf = #{year}
+            </when>
+            <otherwise>
+                AND gid = 0
+            </otherwise>
+        </choose>
+    </delete>
+
+
+
 </mapper>