1
0
DESKTOP-2K9OVK9\siwei 1 месяц назад
Родитель
Сommit
2a120bd731

+ 1 - 0
siwei-api/pom.xml

@@ -11,6 +11,7 @@
     <modules>
         <module>siwei-api-system</module>
         <module>siwei-api-spatial</module>
+        <module>siwei-api-apply</module>
     </modules>
 
     <artifactId>siwei-api</artifactId>

+ 28 - 0
siwei-api/siwei-api-apply/pom.xml

@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xmlns="http://maven.apache.org/POM/4.0.0"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>com.siwei</groupId>
+        <artifactId>siwei-api</artifactId>
+        <version>3.6.5</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    
+    <artifactId>siwei-api-apply</artifactId>
+
+    <description>
+        siwei-api-apply系统接口模块
+    </description>
+
+    <dependencies>
+
+        <!-- siwei Common Core-->
+        <dependency>
+            <groupId>com.siwei</groupId>
+            <artifactId>siwei-common-core</artifactId>
+        </dependency>
+
+    </dependencies>
+
+</project>

+ 36 - 0
siwei-api/siwei-api-apply/src/main/java/com/siwei/apply/api/RemoteZrzysiteService.java

@@ -0,0 +1,36 @@
+package com.siwei.apply.api;
+
+import com.siwei.apply.api.factory.RemoteZrzysiteFallbackFactory;
+import com.siwei.common.core.constant.SecurityConstants;
+import com.siwei.common.core.constant.ServiceNameConstants;
+import com.siwei.common.core.domain.R;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * 用户服务
+ * 
+ * @author siwei-zhx
+ */
+@FeignClient(contextId = "remoteZrzysiteService", value = ServiceNameConstants.APPLY_SERVICE, fallbackFactory = RemoteZrzysiteFallbackFactory.class)
+public interface RemoteZrzysiteService
+{
+
+    @GetMapping("/zrzysite/construct/{param}")
+    R<String> runConstructScheduled(@PathVariable("param") String param, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
+
+
+    @GetMapping("/zrzysite/land/{param}")
+    R<String> runLandScheduled(@PathVariable("param") String param, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
+
+
+    @GetMapping("/zrzysite/ghhs/{param}")
+    R<String> runGhhsScheduled(@PathVariable("param") String param, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
+
+
+    @GetMapping("/zrzysite/updateOnchain")
+    R<String> runOnchainScheduled(@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
+
+
+
+}

+ 50 - 0
siwei-api/siwei-api-apply/src/main/java/com/siwei/apply/api/factory/RemoteZrzysiteFallbackFactory.java

@@ -0,0 +1,50 @@
+package com.siwei.apply.api.factory;
+
+import com.siwei.apply.api.RemoteZrzysiteService;
+import com.siwei.common.core.domain.R;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.cloud.openfeign.FallbackFactory;
+import org.springframework.stereotype.Component;
+
+/**
+ * 用户服务降级处理
+ * 
+ * @author siwei-zhx
+ */
+@Component
+public class RemoteZrzysiteFallbackFactory implements FallbackFactory<RemoteZrzysiteService>
+{
+    private static final Logger log = LoggerFactory.getLogger(RemoteZrzysiteFallbackFactory.class);
+
+    @Override
+    public RemoteZrzysiteService create(Throwable throwable)
+    {
+        log.error("用户服务调用失败:{}", throwable.getMessage());
+        return new RemoteZrzysiteService()
+        {
+            @Override
+            public R<String> runConstructScheduled(String param, String source) {
+                return R.fail("执行工程规划许可数据同步失败:" + throwable.getMessage());
+            }
+
+            @Override
+            public R<String> runLandScheduled(String param, String source) {
+                return R.fail("执行土地规划许可数据同步失败:" + throwable.getMessage());
+
+            }
+
+            @Override
+            public R<String> runGhhsScheduled(String param, String source) {
+                return R.fail("执行规划核验信息数据同步失败:" + throwable.getMessage());
+
+            }
+
+            @Override
+            public R<String> runOnchainScheduled(String source) {
+                return R.fail("执行批量上链失败:" + throwable.getMessage());
+            }
+
+        };
+    }
+}

+ 1 - 0
siwei-api/siwei-api-apply/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports

@@ -0,0 +1 @@
+com.siwei.apply.api.factory.RemoteZrzysiteFallbackFactory

+ 6 - 0
siwei-common/siwei-common-core/src/main/java/com/siwei/common/core/constant/ServiceNameConstants.java

@@ -25,4 +25,10 @@ public class ServiceNameConstants
      * 空间处理服务的serviceid
      */
     public static final String SPATIAL_SERVICE = "siwei-spatial";
+
+
+    public static final String APPLY_SERVICE = "siwei-apply";
+
+
+
 }

+ 42 - 3
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/controller/zrzysite/ZrzysiteConstructController.java

@@ -8,13 +8,14 @@ import com.siwei.apply.service.zrzysite.IZrzysiteLandService;
 import com.siwei.common.core.domain.R;
 import com.siwei.common.core.web.controller.BaseController;
 import com.siwei.common.core.web.page.TableDataInfo;
+import com.siwei.common.security.annotation.InnerAuth;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
 
 @RestController
-@RequestMapping("/zrzysite/construct")
+@RequestMapping("/zrzysite")
 public class ZrzysiteConstructController extends BaseController {
 
     @Autowired
@@ -30,7 +31,6 @@ public class ZrzysiteConstructController extends BaseController {
 
 
 
-
     @GetMapping("/list")
     public TableDataInfo list(ZrzysiteConstructFilterVo filterVo) {
         startPage();
@@ -54,15 +54,54 @@ public class ZrzysiteConstructController extends BaseController {
 
 
 
+    @GetMapping("/construct/{param}")
+    @InnerAuth
+    public R<String> runConstructScheduled( @PathVariable("param") String param ) {
+        //zrzysiteConstructService.syncConstructInfo("");
+        return R.ok("success1");
+    }
+
+
+    @GetMapping("/land/{param}")
+    @InnerAuth
+    public R<String> runLandScheduled( @PathVariable("param") String param ) {
+        //zrzysiteConstructService.syncConstructInfo("");
+        return R.ok("success1");
+    }
+
+
+    @GetMapping("/ghhs/{param}")
+    @InnerAuth
+    public R<String> runGhhsScheduled( @PathVariable("param") String param ) {
+        //zrzysiteConstructService.syncConstructInfo("");
+        return R.ok("success1");
+    }
+
+    @GetMapping("/updateOnchain")
+    @InnerAuth
+    public R<String> runOnchainScheduled() {
+        //zrzysiteConstructService.syncConstructInfo("");
+        System.out.println("daole---dingshi");
+        return R.ok("修改上链:success1");
+    }
+
+
+
     @GetMapping("/dingshi")
     public R<String> dingshi() {
         //zrzysiteLandService.syncLandInfo();
-        zrzysiteGhhsService.syncGhhsInfo();
+        //zrzysiteGhhsService.syncGhhsInfo();
         //zrzysiteConstructService.syncConstructInfo("");
         return R.ok("success1");
     }
 
 
+    @GetMapping("/dingshiyi/{projectId}")
+    public R<String> dingshiyi(@PathVariable String projectId) {
+        String projectId2 = projectId;
+        zrzysiteGhhsService.syncCurrentNodeInfo(projectId2,"");
+        return R.ok("success1");
+    }
 
 
 

+ 1 - 2
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/zrzysite/IZrzysiteLandService.java

@@ -5,12 +5,11 @@ package com.siwei.apply.service.zrzysite;
 public interface IZrzysiteLandService {
 
 
-
     void syncLandInfo();
 
 
     void syncCurrentNodeInfo(String projectId,String nodeTableName);
 
-
+    String getTdytCodeByName(String useName);
 
 }

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

@@ -251,8 +251,8 @@ public class ZrzysiteCommonServiceImpl implements IZrzysiteCommonService {
     }
 
 
-    /*
-    1.先拿到例id
+    /**
+    1.先拿到例id
     2.根据实例id,获取所有的附件材料条数。
     3.把数据下载到当前目录。
     4.获取当前附件的json

+ 63 - 10
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/zrzysite/impl/ZrzysiteLandServiceImpl.java

@@ -1,11 +1,13 @@
 package com.siwei.apply.service.zrzysite.impl;
 
 import com.siwei.apply.domain.Jsydghxk;
+import com.siwei.apply.domain.LandType;
 import com.siwei.apply.domain.Project;
 import com.siwei.apply.domain.vo.JsydghxkUpdateVo;
 import com.siwei.apply.domain.vo.JsydghxkVo;
 import com.siwei.apply.domain.zrzysite.ZrzysiteLand;
 import com.siwei.apply.mapper.JsydghxkMapper;
+import com.siwei.apply.mapper.LandTypeMapper;
 import com.siwei.apply.mapper.ProjectMapper;
 import com.siwei.apply.mapper.zrzysite.ZrzysiteLandMapper;
 import com.siwei.apply.service.JsydghxkService;
@@ -22,8 +24,11 @@ import org.springframework.stereotype.Service;
 
 import java.text.SimpleDateFormat;
 import java.util.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 
+
 @Slf4j
 @Service
 public class ZrzysiteLandServiceImpl implements IZrzysiteLandService {
@@ -40,11 +45,24 @@ public class ZrzysiteLandServiceImpl implements IZrzysiteLandService {
     @Autowired
     private JsydghxkService jsydghxkService;
 
+
+    @Autowired
+    private LandTypeMapper landTypeMapper;
+
+
     @Autowired
     private IZrzysiteCommonService zrzysiteCommonService;
 
     private final SimpleDateFormat sdf = new SimpleDateFormat(DateUtils.YYYY_MM_DD);
 
+    private static final Pattern YDMJ_PATTERN = Pattern.compile("([\\d.]+)\\s*(.+)");
+
+
+    private static List<LandType> allLandTypeList = new ArrayList<>();
+
+
+
+
     @Override
     public void syncLandInfo() {
         List<Project> landProjectList = projectMapper.getZrzysiteProjectList("t_jsydghxk");
@@ -170,13 +188,18 @@ public class ZrzysiteLandServiceImpl implements IZrzysiteLandService {
             updateVo.setYddw(land.getXddw());
             updateVo.setYdwz(land.getYdwz());
             if (StringUtils.isNotBlank(land.getYdmj())) {
-                try {
-                    updateVo.setYdArea(Float.parseFloat(land.getYdmj()));
-                } catch (NumberFormatException e) {
-                    log.warn("用地面积转换失败: {}", land.getYdmj());
+                Matcher m = YDMJ_PATTERN.matcher(land.getYdmj().trim());
+                if (m.find()) {
+                    try {
+                        updateVo.setYdArea(Float.parseFloat(m.group(1)));
+                        updateVo.setYdUnit(m.group(2).trim());
+                    } catch (NumberFormatException e) {
+                        log.warn("用地面积转换失败: {}", land.getYdmj());
+                    }
                 }
             }
-            updateVo.setTdyt(land.getTdyt());
+
+            updateVo.setTdyt(getTdytCodeByName(land.getTdyt()));
             updateVo.setTdhqfs(land.getTdhqfs());
             updateVo.setPzydjg(land.getPzydjg());
             updateVo.setPzydwh(land.getPzydwh());
@@ -195,13 +218,17 @@ public class ZrzysiteLandServiceImpl implements IZrzysiteLandService {
             vo.setYddw(land.getXddw());
             vo.setYdwz(land.getYdwz());
             if (StringUtils.isNotBlank(land.getYdmj())) {
-                try {
-                    vo.setYdArea(Float.parseFloat(land.getYdmj()));
-                } catch (NumberFormatException e) {
-                    log.warn("用地面积转换失败: {}", land.getYdmj());
+                Matcher m = YDMJ_PATTERN.matcher(land.getYdmj().trim());
+                if (m.find()) {
+                    try {
+                        vo.setYdArea(Float.parseFloat(m.group(1)));
+                        vo.setYdUnit(m.group(2).trim());
+                    } catch (NumberFormatException e) {
+                        log.warn("用地面积转换失败: {}", land.getYdmj());
+                    }
                 }
             }
-            vo.setTdyt(land.getTdyt());
+            vo.setTdyt(getTdytCodeByName(land.getTdyt()));
             vo.setTdhqfs(land.getTdhqfs());
             vo.setPzydjg(land.getPzydjg());
             vo.setPzydwh(land.getPzydwh());
@@ -216,4 +243,30 @@ public class ZrzysiteLandServiceImpl implements IZrzysiteLandService {
         }
         return addNodeId;
     }
+
+
+
+    /**
+     * 根据名称获取编码
+     * @param useName
+     * @return
+     */
+    @Override
+    public String getTdytCodeByName(String useName) {
+        if (allLandTypeList.isEmpty()) {
+            List<LandType> all = landTypeMapper.selectAll();
+            allLandTypeList.addAll(all);
+        }
+        String code = "23";
+        // 转换为节点
+        Optional<LandType> filterRes = allLandTypeList.stream().filter(s -> s.getName().equalsIgnoreCase(useName)).findFirst();
+        if (filterRes.isPresent()) {
+            code = filterRes.get().getCode();
+        }
+        return code;
+    }
+
+
+
+
 }

+ 7 - 1
siwei-modules/siwei-job/pom.xml

@@ -75,7 +75,13 @@
             <groupId>com.siwei</groupId>
             <artifactId>siwei-common-swagger</artifactId>
         </dependency>
-        
+        <dependency>
+            <groupId>com.siwei</groupId>
+            <artifactId>siwei-api-apply</artifactId>
+            <version>3.6.5</version>
+            <scope>compile</scope>
+        </dependency>
+
     </dependencies>
 
     <build>

+ 45 - 0
siwei-modules/siwei-job/src/main/java/com/siwei/job/task/ZrzysiteTask.java

@@ -0,0 +1,45 @@
+package com.siwei.job.task;
+
+import com.siwei.apply.api.RemoteZrzysiteService;
+import com.siwei.common.core.constant.SecurityConstants;
+import com.siwei.common.core.utils.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ *  工改数据同步调度类
+ * 
+ * @author siwei-zhx
+ */
+@Component("zrzysiteTask")
+public class ZrzysiteTask
+{
+
+
+    @Autowired
+    private RemoteZrzysiteService remoteZrzysiteService;
+
+
+
+    public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i)
+    {
+        System.out.println(StringUtils.format("执行多参方法: 字符串类型{},布尔类型{},长整型{},浮点型{},整形{}", s, b, l, d, i));
+    }
+
+    public void ryParams(String params)
+    {
+        remoteZrzysiteService.runOnchainScheduled(SecurityConstants.INNER);
+        System.out.println("执行有参方法:" + params);
+    }
+
+
+
+
+    public void ryNoParams()
+    {
+        System.out.println("执行无参方法");
+    }
+
+
+
+}