chenendian 7 сар өмнө
parent
commit
62dedef141

+ 18 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/controller/supervise/TSuperviseYwlxController.java

@@ -109,4 +109,22 @@ public class TSuperviseYwlxController extends BaseController {
         }
         return toAjax(tSuperviseYwlxService.deleteTSuperviseYwlxByYwlxs(ywlxs));
     }
+
+    /**
+     * 获取数据模板类型详细信息
+     */
+    @GetMapping(value = "/name/{fileName}")
+    public AjaxResult getInfoByFileName(@PathVariable("fileName") String fileName) {
+        TSuperviseYwlxDo obj = null;
+        if(StringUtils.isNotBlank(fileName)){
+            String ywlx = fileName.substring(0, 2);
+            obj = tSuperviseYwlxService.selectTSuperviseYwlxByYwlx(ywlx);
+        }
+        return success(obj);
+    }
+
+
+
+
+
 }

+ 9 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/domain/supervise/TSuperviseYwlxDo.java

@@ -10,6 +10,7 @@ public class TSuperviseYwlxDo extends BaseEntity {
     private String ywlx;
     private String ywlxmc;
     private Integer sort;
+    private Integer sjlx; //区分年度,1是年度, 0为其他
     private String sjy; //数据源
     private List<TSuperviseYwlxFieldDo> fieldDoList;
     private Map<String, TSuperviseYwlxFieldDo> fieldDoMap;
@@ -40,6 +41,14 @@ public class TSuperviseYwlxDo extends BaseEntity {
         this.sort = sort;
     }
 
+    public Integer getSjlx() {
+        return sjlx;
+    }
+
+    public void setSjlx(Integer sjlx) {
+        this.sjlx = sjlx;
+    }
+
     public String getSjy() {
         return sjy;
     }

+ 29 - 12
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/supervise/impl/TShpFileHandleServiceImpl.java

@@ -7,6 +7,7 @@ import com.onemap.common.core.utils.StringUtils;
 import com.onemap.common.core.web.domain.AjaxResult;
 import com.onemap.common.redis.service.RedisService;
 import com.onemap.apply.domain.supervise.TSupervisePcsj;
+import lombok.extern.slf4j.Slf4j;
 import org.geotools.data.FeatureSource;
 import org.geotools.data.shapefile.ShapefileDataStore;
 import org.geotools.data.simple.SimpleFeatureCollection;
@@ -29,6 +30,7 @@ import java.nio.charset.Charset;
 import java.util.*;
 import java.util.concurrent.TimeUnit;
 
+@Slf4j
 @Service
 public class TShpFileHandleServiceImpl implements ITShpFileHandleService {
 
@@ -108,6 +110,13 @@ public class TShpFileHandleServiceImpl implements ITShpFileHandleService {
             return null;
         }
 
+        String ywlx = name.substring(0, 2);
+        TSuperviseYwlxDo ywlxDo = tSuperviseYwlxService.selectTSuperviseYwlxMapperByYwlx(ywlx);
+        if (ywlxDo == null) {
+            return null;
+        }
+
+
         //验证shp
         String shpPath = tSupervisePcsj.getShppath();
         File FShpFile_0 = new File(shpPath);
@@ -118,20 +127,25 @@ public class TShpFileHandleServiceImpl implements ITShpFileHandleService {
         //获取文件夹
         String paremtFilePath = FShpFile_0.getParentFile().getAbsolutePath();
 
-        //验证QDOM
-        if (!(new File(paremtFilePath + "/QDOM").exists())) {
-            return null;
-        }
+        if(ywlxDo.getSjlx()==1){ //年度类型,只校验一个目录
+            //验证DOM
+            if (!(new File(paremtFilePath + "/DOM").exists())) {
+                log.info("当前上传文件中不存在DOM目录,文件名:{}",tSupervisePcsj.getName());
+                return null;
+            }
+        }else {
+            //验证QDOM
+            if (!(new File(paremtFilePath + "/QDOM").exists())) {
+                log.info("当前上传文件中不存在QDOM目录,文件名:{}",tSupervisePcsj.getName());
+                return null;
+            }
 
-        if (!(new File(paremtFilePath + "/DDOM").exists())) {
-            return null;
+            if (!(new File(paremtFilePath + "/DDOM").exists())) {
+                log.info("当前上传文件中不存在DDOM目录,文件名:{}",tSupervisePcsj.getName());
+                return null;
+            }
         }
 
-        String ywlx = name.substring(0, 2);
-        TSuperviseYwlxDo ywlxDo = tSuperviseYwlxService.selectTSuperviseYwlxMapperByYwlx(ywlx);
-        if (ywlxDo == null) {
-            return null;
-        }
         TSuperviseYwlxFieldDo queryDo = new TSuperviseYwlxFieldDo();
         queryDo.setYwlx(ywlx);
         List<TSuperviseYwlxFieldDo> listField = tSuperviseYwlxFiledService.selectTSuperviseYwlxFieldList(queryDo);
@@ -184,7 +198,6 @@ public class TShpFileHandleServiceImpl implements ITShpFileHandleService {
             //这个typeNamae不传递,默认是文件名称
             FeatureSource featuresource = shapefileDataStore.getFeatureSource(shapefileDataStore.getTypeNames()[0]);
 
-
             // 获取 srid
             CoordinateReferenceSystem crs = featuresource.getSchema().getCoordinateReferenceSystem();
             Integer srid = CRS.lookupEpsgCode(crs, true);
@@ -209,6 +222,7 @@ public class TShpFileHandleServiceImpl implements ITShpFileHandleService {
             Set<String> shpFieldSet = mapField_0.keySet();
 
             //TODO 新版本存储
+            int i=0;
             while (simpleFeatureIterator.hasNext()) {
                 Map<String, Object> jg_filed = new HashMap<>();
                 jg_filed.put("id", StringUtils.getUUID());
@@ -244,6 +258,9 @@ public class TShpFileHandleServiceImpl implements ITShpFileHandleService {
                     jg_filed.put(mapField_0.get(metadataShpField).getFieldname(), valueInsertData);
                 }
                 tSupervisePcsjXqService.insertTableByMap(jg_filed, tableName_data_0);
+
+                //TODO 需要删除操作
+                if(++i>10)break;
             }
 
             tSupervisePcsj.setReadtime(new Date());

+ 24 - 12
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/supervise/impl/TSupervisePcsjXqServiceImpl.java

@@ -10,6 +10,7 @@ import com.onemap.apply.service.supervise.ITSuperviseYwlxService;
 import com.onemap.common.core.constant.HttpStatus;
 import com.onemap.common.core.utils.StringUtils;
 import com.onemap.common.core.web.page.TableDataInfo;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -24,6 +25,7 @@ import static com.onemap.common.core.utils.PageUtils.startPage;
  * @author zhx
  * @date 2024-09-26
  */
+@Slf4j
 @Service
 public class TSupervisePcsjXqServiceImpl implements ITSupervisePcsjXqService {
     @Autowired
@@ -167,23 +169,33 @@ public class TSupervisePcsjXqServiceImpl implements ITSupervisePcsjXqService {
             return null;
         }
 
-        //获取文件夹
-        String paremtFilePath = FShpFile_0.getParentFile().getAbsolutePath();
-
-        //验证QDOM
-        if (!(new File(paremtFilePath + "/QDOM").exists())) {
-            return null;
-        }
-
-        if (!(new File(paremtFilePath + "/DDOM").exists())) {
-            return null;
-        }
-
         String ywlx = name.substring(0, 2);
         TSuperviseYwlxDo ywlxDo = tSuperviseYwlxService.selectTSuperviseYwlxMapperByYwlx(ywlx);
         if (ywlxDo == null) {
             return null;
         }
+
+        //获取文件夹
+        String paremtFilePath = FShpFile_0.getParentFile().getAbsolutePath();
+
+        if(ywlxDo.getSjlx()==1){ //年度类型,只校验一个目录
+            //验证DOM
+            if (!(new File(paremtFilePath + "/DOM").exists())) {
+                log.info("当前上传文件中不存在DOM目录,文件名:{}",tSupervisePcsj.getName());
+                return null;
+            }
+        }else {
+            //验证QDOM
+            if (!(new File(paremtFilePath + "/QDOM").exists())) {
+                log.info("当前上传文件中不存在QDOM目录,文件名:{}",tSupervisePcsj.getName());
+                return null;
+            }
+            if (!(new File(paremtFilePath + "/DDOM").exists())) {
+                log.info("当前上传文件中不存在DDOM目录,文件名:{}",tSupervisePcsj.getName());
+                return null;
+            }
+        }
+
         TSuperviseYwlxFieldDo queryDo = new TSuperviseYwlxFieldDo();
         queryDo.setYwlx(ywlx);
         queryDo.setListdisplay(listdisplay);

+ 6 - 1
onemap-modules/onemap-apply/src/main/resources/mapper/postgresql/supervise/TSuperviseYwlxMapper.xml

@@ -7,12 +7,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <resultMap type="TSuperviseYwlxDo" id="TSuperviseYwlxDoResult">
         <result property="ywlx"    column="ywlx"    />
         <result property="ywlxmc"    column="ywlxmc"    />
+        <result property="sjlx"    column="sjlx"    />
         <result property="sort"    column="sort"    />
         <result property="sjy"    column="sjy"    />
     </resultMap>
 
     <sql id="selectTSuperviseYwlxVo">
-        select ywlx, ywlxmc, sort, sjy from t_supervise_ywlx
+        select ywlx, ywlxmc,sjlx, sort, sjy from t_supervise_ywlx
     </sql>
 
     <select id="selectTSuperviseYwlxMapperByYwlx" parameterType="String" resultMap="TSuperviseYwlxDoResult">
@@ -25,6 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <where>
             <if test="ywlx != null  and ywlx != ''"> and ywlx like concat('%', #{ywlx}, '%') </if>
             <if test="ywlxmc != null  and ywlxmc != ''"> and yelxmc like concat('%', #{ywlxmc}, '%')</if>
+            <if test="sjlx != null "> and sjlx = #{sjlx}</if>
             <if test="sort != null "> and sort = #{sort}</if>
             <if test="sjy != null  and sjy != ''"> and sjy = #{sjy}</if>
         </where>
@@ -41,11 +43,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="ywlx != null">ywlx,</if>
             <if test="ywlxmc != null and ywlxmc != ''">ywlxmc,</if>
             <if test="sort != null">sort,</if>
+            <if test="sjlx != null">sjlx,</if>
             <if test="sjy != null and sjy != ''">sjy,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="ywlx != null">#{ywlx},</if>
             <if test="ywlxmc != null and ywlxmc != ''">#{ywlxmc},</if>
+            <if test="sjlx != null">#{sjlx},</if>
             <if test="sort != null">#{sort},</if>
             <if test="sjy != null and sjy != ''">#{sjy},</if>
         </trim>
@@ -55,6 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         update t_supervise_ywlx
         <trim prefix="SET" suffixOverrides=",">
             <if test="ywlxmc != null and ywlxmc != ''">ywlxmc = #{ywlxmc},</if>
+            <if test="sjlx != null">sjlx = #{sjlx},</if>
             <if test="sort != null">sort = #{sort},</if>
             <if test="sjy != null and sjy != ''">sjy = #{sjy},</if>
         </trim>