瀏覽代碼

合规性分析

LAPTOP-BJJ3IV5R\SIWEI 10 月之前
父節點
當前提交
5f16872bd6

+ 44 - 0
onemap-api/onemap-api-system/src/main/java/com/onemap/system/api/AnalyseService.java

@@ -0,0 +1,44 @@
+package com.onemap.system.api;
+
+import com.onemap.common.core.constant.ServiceNameConstants;
+import com.onemap.common.core.domain.R;
+import com.onemap.common.core.web.domain.RequestResult;
+import com.onemap.system.api.factory.AnalyseFallbackFactory;
+import com.onemap.system.api.factory.RemoteAuthFallbackFactory;
+import com.onemap.system.api.factory.RemoteLogFallbackFactory;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.util.List;
+
+/**
+ * 分析服务
+ */
+@FeignClient(contextId = "analyseService", value = ServiceNameConstants.ANALYSE_SERVICE, fallbackFactory = AnalyseFallbackFactory.class)
+public interface AnalyseService {
+
+    /**
+     * table中与wkt数据是否有交集
+     */
+    @PostMapping("/analyse/db/intersects/table_wkt")
+    public RequestResult intersectsTableWkt(
+            @RequestParam(value = "inputTable") String inputTable,
+            @RequestParam(value = "inputSRID", required = false) Integer inputSRID,
+            @RequestParam(value = "inputIds", required = false) List<String> inputIds,
+            @RequestParam(value = "intersectsWkt") String intersectsWkt,
+            @RequestParam(value = "intersectsWktSRID", required = false) Integer intersectsWktSRID);
+
+
+    @PostMapping("/analyse/db/intersection/table_wkt")
+    public RequestResult intersectionTableWkt(
+            @RequestParam(value = "inputTable") String inputTable,
+            @RequestParam(value = "inputSRID", required = false) Integer inputSRID,
+            @RequestParam(value = "inputIds", required = false) List<String> inputIds,
+            @RequestParam(value = "intersectionWkt") String intersectionWkt,
+            @RequestParam(value = "intersectionWktSRID", required = false) Integer intersectionWktSRID,
+            @RequestParam(value = "outputColumn", required = false) List<String> outputColumn);
+
+}

+ 33 - 0
onemap-api/onemap-api-system/src/main/java/com/onemap/system/api/factory/AnalyseFallbackFactory.java

@@ -0,0 +1,33 @@
+package com.onemap.system.api.factory;
+
+import com.onemap.common.core.domain.R;
+import com.onemap.common.core.web.domain.RequestResult;
+import com.onemap.system.api.AnalyseService;
+import com.onemap.system.api.RemoteAuthService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.cloud.openfeign.FallbackFactory;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+@Component
+public class AnalyseFallbackFactory implements FallbackFactory<AnalyseService> {
+    private static final Logger log = LoggerFactory.getLogger(AnalyseFallbackFactory.class);
+
+    @Override
+    public AnalyseService create(Throwable throwable) {
+        log.error("分析服务调用失败:{}", throwable.getMessage());
+        return new AnalyseService() {
+            @Override
+            public RequestResult intersectsTableWkt(String inputTable, Integer inputSRID, List<String> inputIds, String intersectsWkt, Integer intersectsWktSRID) {
+                return RequestResult.error("内部错误");
+            }
+
+            @Override
+            public RequestResult intersectionTableWkt(String inputTable, Integer inputSRID, List<String> inputIds, String intersectionWkt, Integer intersectionWktSRID, List<String> outputColumn) {
+                return RequestResult.error("内部错误");
+            }
+        };
+    }
+}

+ 5 - 0
onemap-common/onemap-common-core/src/main/java/com/onemap/common/core/constant/ServiceNameConstants.java

@@ -21,4 +21,9 @@ public class ServiceNameConstants
      * 文件服务的serviceid
      */
     public static final String FILE_SERVICE = "onemap-file";
+
+    /**
+     * 分析服务的serviceid
+     */
+    public static final String ANALYSE_SERVICE = "onemap-analyse";
 }

+ 1 - 1
onemap-modules/onemap-analyse/src/main/resources/mapper/oracle/fzss/AnalyseUtilsDBMapper.xml

@@ -43,7 +43,7 @@
     </select>
 
     <select id="intersectionTableWkt" resultType="map">
-        SELECT ret_tab.id,ret_tab.ret_geom_vv geom,public.st_area(ret_tab.ret_geom_vv) geom_area
+        SELECT ret_tab.id,public.st_asewkt(ret_tab.ret_geom_vv) geom,public.st_area(ret_tab.ret_geom_vv) geom_area
         <if test="outputColumn != null and outputColumn.size()>0 ">
             <foreach collection="outputColumn" item="columnValue" open="," separator=",">
                 "${columnValue}"

+ 1 - 1
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/controller/fzss/HgxfxController.java

@@ -69,7 +69,7 @@ public class HgxfxController extends BaseController {
             String xmmc, Integer limit, Integer allpage) {
         String username = SecurityUtils.getUsername();
         startRecordPage();
-        List<HgxfxDTO> list = hgxfxService.GetPage(kssj, jssj, xmmc,username);
+        List<HgxfxDTO> list = hgxfxService.GetPage(kssj, jssj, xmmc, username);
         return RequestResult.success(list);
     }
 

+ 88 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/domain/config/fzss/HgxfxScxTableDTO.java

@@ -0,0 +1,88 @@
+package com.onemap.apply.domain.config.fzss;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+
+@TableName("t_fzss_hgxfx_scx_table")
+public class HgxfxScxTableDTO {
+    private String bsm;
+    private String ysdm;
+    private String ysmc;
+    private String sjy;
+    private Integer srid;
+    private Integer xssx;
+    private String tjzd;
+    private Integer status;
+    private Integer rwsrid;
+
+    public String getBsm() {
+        return bsm;
+    }
+
+    public void setBsm(String bsm) {
+        this.bsm = bsm;
+    }
+
+    public String getYsdm() {
+        return ysdm;
+    }
+
+    public void setYsdm(String ysdm) {
+        this.ysdm = ysdm;
+    }
+
+    public String getYsmc() {
+        return ysmc;
+    }
+
+    public void setYsmc(String ysmc) {
+        this.ysmc = ysmc;
+    }
+
+    public String getSjy() {
+        return sjy;
+    }
+
+    public void setSjy(String sjy) {
+        this.sjy = sjy;
+    }
+
+    public Integer getSrid() {
+        return srid;
+    }
+
+    public void setSrid(Integer srid) {
+        this.srid = srid;
+    }
+
+    public Integer getXssx() {
+        return xssx;
+    }
+
+    public void setXssx(Integer xssx) {
+        this.xssx = xssx;
+    }
+
+    public String getTjzd() {
+        return tjzd;
+    }
+
+    public void setTjzd(String tjzd) {
+        this.tjzd = tjzd;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public Integer getRwsrid() {
+        return rwsrid;
+    }
+
+    public void setRwsrid(Integer rwsrid) {
+        this.rwsrid = rwsrid;
+    }
+}

+ 12 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/mapper/fzss/HgxfxScxTableMapper.java

@@ -0,0 +1,12 @@
+package com.onemap.apply.mapper.fzss;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.onemap.apply.domain.config.fzss.HgxfxScxTableDTO;
+
+/**
+ * 数据层
+ *
+ * @author onemap
+ */
+public interface HgxfxScxTableMapper extends BaseMapper<HgxfxScxTableDTO> {
+}

+ 83 - 5
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/impl/fzss/HgxfxServiceImpl.java

@@ -4,18 +4,19 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.onemap.apply.domain.config.fzss.*;
 import com.onemap.apply.mapper.fzss.*;
 import com.onemap.apply.service.fzss.IHgxfxService;
+import com.onemap.common.core.domain.R;
 import com.onemap.common.core.utils.StringUtils;
 import com.onemap.common.core.web.domain.RequestResult;
 import com.onemap.common.security.utils.SecurityUtils;
+import com.onemap.system.api.AnalyseService;
+import com.onemap.system.api.RemoteAuthService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.RequestParam;
 
 import javax.annotation.Resource;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 @Service
 public class HgxfxServiceImpl implements IHgxfxService {
@@ -24,9 +25,15 @@ public class HgxfxServiceImpl implements IHgxfxService {
     @Autowired
     private HgxfxScxRwMapper hgxfxScxRwMapper;
     @Autowired
+    private HgxfxScxTableMapper hgxfxScxTableMapper;
+    @Autowired
     private HgxfxMapper hgxfxMapper;
     @Autowired
     private FxrwrzMapper fxrwrzMapper;
+    @Autowired
+    private RemoteAuthService remoteAuthService;
+    @Autowired
+    private AnalyseService analyseService;
 
     @Override
     public RequestResult GetScxList(String param) {
@@ -70,9 +77,80 @@ public class HgxfxServiceImpl implements IHgxfxService {
             scxRw.setBsm(StringUtils.getUUID());
             hgxfxScxRwMapper.insert(scxRw);
         }
+        hgxfxHandle(hgxfxDTO.getBsm());
         return RequestResult.success(hgxfxDTO.getBsm());
     }
 
+    public void hgxfxHandle(String bsm) {
+        String ewkt = "SRID=4525;MULTIPOLYGON(((37342998.802186266 2026355.2598068258,37342865.92545163 2026357.1014534528,37342817.87560371 2026357.767365824,37342802.97989663 2026372.974932678,37342803.898728564 2026506.9421275943,37342819.00023294 2026521.733922014,37342900.08195203 2026520.6101232516,37342911.12435312 2026520.139866627,37342921.978652984 2026519.0511605758,37342932.75255981 2026517.3415217374,37342943.41078094 2026515.0165252725,37342953.9178506 2026512.0838249521,37342964.23945906 2026508.5530478982,37342974.34150494 2026504.4360855871,37342984.190657474 2026499.7461450424,37342993.75455573 2026494.4988803158,37343003.123444214 2026488.6354845203,37343042.17791849 2026462.6041323764,37343046.33985531 2026441.8032885736,37343039.5553245 2026431.6244374511,37343033.89487493 2026422.4690548987,37343028.79298549 2026412.7975274948,37343024.36349438 2026402.800136831,37343020.62692146 2026392.523455117,37343017.60047662 2026382.0158757505,37343014.53736561 2026367.7884403756,37342998.802186266 2026355.2598068258)),((37342684.474113196 2026681.7678619213,37342697.86007041 2026684.1221921882,37342780.41605009 2026697.5276640216,37342785.17736046 2026693.44891586,37342784.243153 2026557.2187332094,37342769.141550235 2026542.4269937698,37342683.52653461 2026543.613566511,37342684.474113196 2026681.7678619213)))";
+        QueryWrapper<HgxfxDTO> hgxfxWrapper = new QueryWrapper<HgxfxDTO>();
+        hgxfxWrapper.eq("bsm", bsm);
+        HgxfxDTO hgxfxDTO = hgxfxMapper.selectOne(hgxfxWrapper);
+        if (StringUtils.isNull(hgxfxDTO)) {
+            return;
+        }
+        //更新任务开始时间
+//        hgxfxDTO.setRwkssj(new Date());
+//        hgxfxMapper.updateById(hgxfxDTO);
+
+        //查询审查项
+        QueryWrapper<HgxfxScxRwDTO> scxRwWrapper = new QueryWrapper<HgxfxScxRwDTO>();
+        scxRwWrapper.eq("rwbsm", bsm);
+        List<HgxfxScxRwDTO> scxRwDTOList = hgxfxScxRwMapper.selectList(scxRwWrapper);
+        if (scxRwDTOList.size() > 0) {
+            //查询审查项对应的数据库表
+            for (HgxfxScxRwDTO scxRwDTO : scxRwDTOList) {
+
+                FxrwrzDTO fxrwrzDTO = new FxrwrzDTO();
+                fxrwrzDTO.setBsm(scxRwDTO.getBsm());
+                fxrwrzDTO.setRwbsm(scxRwDTO.getRwbsm());
+                fxrwrzDTO.setRzsj(new Date());
+
+                QueryWrapper<HgxfxScxTableDTO> scxTableWrapper = new QueryWrapper<HgxfxScxTableDTO>();
+                scxTableWrapper.eq("bsm", scxRwDTO.getScxbsm());
+                scxTableWrapper.orderByDesc("xssx");
+                List<HgxfxScxTableDTO> hgxfxScxTableDTOList = hgxfxScxTableMapper.selectList(scxTableWrapper);
+                if (hgxfxScxTableDTOList.size() > 0) {
+                    for (HgxfxScxTableDTO scxTable : hgxfxScxTableDTOList) {
+                        fxrwrzDTO.setRzlx("info");
+                        fxrwrzDTO.setRwlx(scxTable.getYsmc());
+                        fxrwrzDTO.setRzlr(scxTable.getYsmc() + "完成");
+                        String v_sjy = scxTable.getSjy();
+                        Integer v_srid = scxTable.getSrid();
+                        Integer v_rwsrid = scxTable.getRwsrid();
+                        RequestResult result = analyseService.intersectsTableWkt(v_sjy, v_srid, null, ewkt, v_rwsrid);
+                        int resultCode = (int) result.get("statuscode");
+                        if (resultCode == 200) {
+                            System.out.println("************");
+                            Object resultData = result.get("data");
+                            if (StringUtils.isNotNull(resultData)) {
+                                List<String> resultList = (List<String>) resultData;
+                                for (Object gg : resultList) {
+                                    System.out.println(gg.toString());
+                                }
+                                if (resultList.size() > 0) {
+                                    String v_tjzd = scxTable.getTjzd();
+                                    List<String> outputColumn = Arrays.asList(v_tjzd.split(","));
+                                    RequestResult result2 = analyseService.intersectionTableWkt(v_sjy, v_srid, resultList, ewkt, v_rwsrid, outputColumn);
+                                    System.out.println(result2);
+                                }
+                            }
+
+
+                        }
+
+                    }
+                }
+                fxrwrzMapper.insert(fxrwrzDTO);
+            }
+        }
+
+        //更新任务截止时间
+//        hgxfxDTO.setRwjssj(new Date());
+//        hgxfxMapper.updateById(hgxfxDTO);
+    }
+
+
     @Override
     public RequestResult GetLog(String bsm) {
         if (StringUtils.isEmpty(bsm)) {
@@ -91,7 +169,7 @@ public class HgxfxServiceImpl implements IHgxfxService {
     }
 
     @Override
-    public List<HgxfxDTO> GetPage(String kssj, String jssj, String xmmc,String username) {
+    public List<HgxfxDTO> GetPage(String kssj, String jssj, String xmmc, String username) {
         List<HgxfxDTO> res = hgxfxMapper.GetPage(kssj, jssj, xmmc, username);
         return res;
     }