1
0
chenendian 2 недель назад
Родитель
Сommit
7934d8f38b

+ 32 - 54
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/controller/third/OfferDataController.java

@@ -44,14 +44,13 @@ public class OfferDataController extends BaseController {
     @Autowired
     private RedisService redisService;
 
-
     /**
      * 新增
      */
     @PostMapping("/bb")
     public R<Map<String, String>> add(@RequestBody LandOneCode body) {
         try {
-            Map<String,String>  map = offerDataService.getById("11");
+            Map<String, String> map = offerDataService.getById("11");
             map.put("id", map.get("id"));
             return R.ok(map);
         } catch (Exception e) {
@@ -71,12 +70,10 @@ public class OfferDataController extends BaseController {
         }
     }
 
-
-
     @PostMapping("/addEntity")
     public R<String> addEntity(@RequestBody LandOneCode body) {
         try {
-            return R.fail(502,"土地统一编码信息已自动生成,无需手动添加");
+            return R.fail(502, "土地统一编码信息已自动生成,无需手动添加");
         } catch (Exception e) {
             return R.fail(e.getMessage());
         }
@@ -95,25 +92,22 @@ public class OfferDataController extends BaseController {
             String projectId = paramVo.getYwbh();
             String immobileCode = paramVo.getYfbdcdyh();
             String dqjd = paramVo.getDqjd();
-            if(StringUtils.isBlank(immobileCode)){
-                return R.fail(502,"不动产号为空,请填充");
+            if (StringUtils.isBlank(immobileCode)) {
+                return R.fail(502, "不动产号为空,请填充");
             }
-            if(StringUtils.isBlank(dqjd)){
-                return R.fail(502,"标识阶段为空,请填充");
+            if (StringUtils.isBlank(dqjd)) {
+                return R.fail(502, "标识阶段为空,请填充");
             }
-            if(StringUtils.isBlank(projectId)){
-                return R.fail(502,"项目id为空,请填充");
+            if (StringUtils.isBlank(projectId)) {
+                return R.fail(502, "项目id为空,请填充");
             }
-            NodeAttachment nodeAttachment = offerDataService.getThirdNodeAttachment(immobileCode,projectId,dqjd);
+            NodeAttachment nodeAttachment = offerDataService.getThirdNodeAttachment(immobileCode, projectId, dqjd);
             return R.ok(nodeAttachment);
         } catch (Exception e) {
-            return R.fail(502,"获取附件材料失败");
+            return R.fail(502, "获取附件材料失败");
         }
     }
 
-
-
-
     /**
      * 文件下载
      *
@@ -122,31 +116,33 @@ public class OfferDataController extends BaseController {
      * @return
      */
     @GetMapping("/download/{signature}/{expireTime}/{attachmentId}/{dirName}/{fileName}")
-    public ResponseEntity<Resource> uploadAttachment(@PathVariable("signature") String signature,@PathVariable("expireTime") String expireTime,
-                                                     @PathVariable("attachmentId") String attachmentId,@PathVariable("dirName") String dirName,
-                                                     @PathVariable("fileName") String fileName,
-                                                     HttpServletRequest request, HttpServletResponse response) {
+    public ResponseEntity<Resource> uploadAttachment(@PathVariable("signature") String signature,
+            @PathVariable("expireTime") String expireTime,
+            @PathVariable("attachmentId") String attachmentId, @PathVariable("dirName") String dirName,
+            @PathVariable("fileName") String fileName,
+            HttpServletRequest request, HttpServletResponse response) {
 
         try {
-            if(StringUtils.isBlank(signature) || Objects.isNull(expireTime) || StringUtils.isBlank(attachmentId)
-                    ||StringUtils.isBlank(dirName) ||StringUtils.isBlank(fileName)){
+            if (StringUtils.isBlank(signature) || Objects.isNull(expireTime) || StringUtils.isBlank(attachmentId)
+                    || StringUtils.isBlank(dirName) || StringUtils.isBlank(fileName)) {
                 return ResponseEntity.status(HttpStatus.BAD_REQUEST).build();
             }
 
-            //过期时间和签名校验
-            String signaturePath = attachmentId+"/"+dirName+"/"+fileName;
-            if(!ServiceUtil.isUrlValid(signaturePath,signature,Long.valueOf(expireTime))){
+            // 过期时间和签名校验
+            String signaturePath = attachmentId + "/" + dirName + "/" + fileName;
+            if (!ServiceUtil.isUrlValid(signaturePath, signature, Long.valueOf(expireTime))) {
                 return ResponseEntity.status(HttpStatus.BAD_REQUEST).build();
             }
 
             // 写一个方法,通过id,和文件名称,文件目录,获取当前文件路径。
-            String fullFilePath = offerDataService.getTheFile(attachmentId,dirName,fileName);
-            if(StringUtils.isBlank(fullFilePath)){
+            String fullFilePath = offerDataService.getTheFile(attachmentId, dirName, fileName);
+            if (StringUtils.isBlank(fullFilePath)) {
                 return ResponseEntity.status(HttpStatus.BAD_REQUEST).build();
             }
 
-            //获取地址:
-            //String uploadFile = "D:\\home\\siwei\\uploadPath\\2025\\11\\26\\测试工具列表222_20251106083212A098.xls";
+            // 获取地址:
+            // String uploadFile =
+            // "D:\\home\\siwei\\uploadPath\\2025\\11\\26\\测试工具列表222_20251106083212A098.xls";
             // 构建文件的完整路径
             Path filePath = Paths.get(fullFilePath);
             File file = filePath.toFile();
@@ -167,9 +163,9 @@ public class OfferDataController extends BaseController {
             HttpHeaders headers = new HttpHeaders();
             headers.add(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + d1_name);
             headers.setContentType(MediaType.parseMediaType(contentType));
-//            headers.setAccessControlAllowOrigin("*");
+            // headers.setAccessControlAllowOrigin("*");
             // 返回文件资源
-            return ResponseEntity.ok().headers(headers).contentLength(Files.size(filePath))  // 可选:设置内容长度
+            return ResponseEntity.ok().headers(headers).contentLength(Files.size(filePath)) // 可选:设置内容长度
                     .body(resource);
         } catch (Exception e) {
             // 处理IO异常,例如文件不存在或无法读取
@@ -177,15 +173,6 @@ public class OfferDataController extends BaseController {
         }
     }
 
-
-
-
-
-
-
-
-
-
     /**
      * 文件下载
      *
@@ -194,7 +181,8 @@ public class OfferDataController extends BaseController {
      * @return
      */
     @GetMapping("/download/file222/{id}/{uploadId}")
-    public ResponseEntity<Resource> uploadAttachment222(@PathVariable("id") String id, @PathVariable("uploadId") String uploadId, HttpServletRequest request, HttpServletResponse response) {
+    public ResponseEntity<Resource> uploadAttachment222(@PathVariable("id") String id,
+            @PathVariable("uploadId") String uploadId, HttpServletRequest request, HttpServletResponse response) {
         try {
             String upload_id = "upliad_" + id + "_" + uploadId;
             String uploadFile = redisService.getCacheObject(upload_id);
@@ -221,25 +209,15 @@ public class OfferDataController extends BaseController {
             HttpHeaders headers = new HttpHeaders();
             headers.add(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + d1_name);
             headers.setContentType(MediaType.parseMediaType(contentType));
-//            headers.setAccessControlAllowOrigin("*");
+            // headers.setAccessControlAllowOrigin("*");
             // 返回文件资源
-            return ResponseEntity.ok().headers(headers).contentLength(Files.size(filePath))  // 可选:设置内容长度
+            return ResponseEntity.ok().headers(headers).contentLength(Files.size(filePath)) // 可选:设置内容长度
                     .body(resource);
         } catch (Exception e) {
             // 处理IO异常,例如文件不存在或无法读取
-//            e.printStackTrace();
+            // e.printStackTrace();
             return ResponseEntity.status(HttpStatus.FORBIDDEN).build();
         }
     }
 
-
-
-
-
-
-
-
-
-
-
 }

+ 23 - 5
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/controller/third/TakeDataController.java

@@ -1,6 +1,7 @@
 package com.siwei.apply.controller.third;
 
 import com.siwei.apply.domain.LandOneCode;
+import com.siwei.apply.domain.vo.TakeDataAddVo;
 import com.siwei.apply.service.third.TakeDataService;
 import com.siwei.common.core.domain.R;
 import com.siwei.common.core.utils.StringUtils;
@@ -10,6 +11,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.HashMap;
 import java.util.Map;
 
 /**
@@ -32,17 +34,16 @@ public class TakeDataController extends BaseController {
     @GetMapping("immobileCode/{projectId}")
     public R<Map<String, String>> getImmobileCode(@PathVariable String projectId) {
         try {
-            if(StringUtils.isBlank(projectId)){
-                return R.fail(502,"项目id为空,请填充");
+            if (StringUtils.isBlank(projectId)) {
+                return R.fail(502, "项目id为空,请填充");
             }
             Map<String, String> map = takeDataService.getImmobileCode(projectId);
             return R.ok(map);
         } catch (Exception e) {
-            return R.fail(502,"服务出错:"+e.getMessage());
+            return R.fail(502, "服务出错:" + e.getMessage());
         }
     }
 
-
     /**
      * 按ID查询
      */
@@ -70,11 +71,28 @@ public class TakeDataController extends BaseController {
     @PostMapping("addEntity")
     public R<String> addEntity(@RequestBody LandOneCode body) {
         try {
-            return R.fail(502,"土地统一编码信息已自动生成,无需手动添加");
+            return R.fail(502, "土地统一编码信息已自动生成,无需手动添加");
         } catch (Exception e) {
             return R.fail(e.getMessage());
         }
     }
 
+    /**
+     * 添加数据
+     *
+     * @param takeDataAddVo
+     * @return
+     */
+    @PostMapping("add")
+    public R<Map<String, String>> add(@RequestBody TakeDataAddVo takeDataAddVo) {
+        try {
+            String id = takeDataService.add(takeDataAddVo);
+            Map<String, String> map = new HashMap<>();
+            map.put("id", id);
+            return R.ok(map);
+        } catch (Exception e) {
+            return R.fail(e.getMessage());
+        }
+    }
 
 }

+ 9 - 8
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/third/TakeDataService.java

@@ -5,6 +5,7 @@ import com.siwei.apply.domain.res.GyjsydscdjSinglRes;
 import com.siwei.apply.domain.vo.GyjsydscdjUpdateVo;
 import com.siwei.apply.domain.vo.GyjsydscdjVo;
 
+import com.siwei.apply.domain.vo.TakeDataAddVo;
 import java.util.Map;
 
 /**
@@ -12,9 +13,15 @@ import java.util.Map;
  */
 public interface TakeDataService {
 
+    Map<String, String> getImmobileCode(String projectId);
 
-    Map<String,String> getImmobileCode(String projectId);
-
+    /**
+     * 添加数据
+     * 
+     * @param takeDataAddVo
+     * @return
+     */
+    String add(TakeDataAddVo takeDataAddVo);
 
     /**
      * 获取国有建设用地使用权首次登记信息
@@ -24,11 +31,6 @@ public interface TakeDataService {
      */
     GyjsydscdjRes get(String projectId);
 
-
-
-
-
-
     /**
      * 根据主键id获取国有建设用地使用权首次登记信息,返回结构与 get(projectId) 一致
      */
@@ -41,5 +43,4 @@ public interface TakeDataService {
      */
     void update(GyjsydscdjUpdateVo gyjsydscdjUpdateVo);
 
-
 }

+ 20 - 14
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/third/impl/TakeDataServiceImpl.java

@@ -5,6 +5,7 @@ import com.siwei.apply.domain.ProjectWorkflow;
 import com.siwei.apply.domain.res.GyjsydscdjRes;
 import com.siwei.apply.domain.res.GyjsydscdjSinglRes;
 import com.siwei.apply.domain.vo.GyjsydscdjUpdateVo;
+import com.siwei.apply.domain.vo.TakeDataAddVo;
 import com.siwei.apply.enums.AloneWorkFlowEnum;
 
 import com.siwei.apply.mapper.ProjectWorkflowMapper;
@@ -22,9 +23,8 @@ import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 
-
 /**
- *  获取三方数据服务实现类
+ * 获取三方数据服务实现类
  */
 @Slf4j
 @Service
@@ -39,6 +39,12 @@ public class TakeDataServiceImpl implements TakeDataService {
     @Autowired
     private NodeLandService nodeLandService;
 
+    @Override
+    public String add(TakeDataAddVo takeDataAddVo) {
+        // TODO: Implement add logic
+        return "1";
+    }
+
     @Override
     public Map<String, String> getImmobileCode(String projectId) {
         Map<String, String> retMap = new LinkedHashMap<>();
@@ -46,32 +52,32 @@ public class TakeDataServiceImpl implements TakeDataService {
         Project project = projectService.get(projectId);
         String firstPlotCode = project.getFirstPlotCode();
         String secondPlotCode = project.getSecondPlotCode();
-        String tableName = AloneWorkFlowEnum.NODE_2.getTableName(); //土地供应图斑
+        String tableName = AloneWorkFlowEnum.NODE_2.getTableName(); // 土地供应图斑
 
-        List<ProjectWorkflow> projectWorkflows = projectWorkflowMapper.selectByProjectIdAndNodeTableName(projectId,tableName);
+        List<ProjectWorkflow> projectWorkflows = projectWorkflowMapper.selectByProjectIdAndNodeTableName(projectId,
+                tableName);
         if (CollectionUtils.isNotEmpty(projectWorkflows)) {
             String nodeId = projectWorkflows.get(0).getNodeId();
             Map<String, Object> paramMap = new LinkedHashMap<>();
             paramMap.put("batchId", projectId);
-            paramMap.put("plotCode", firstPlotCode+secondPlotCode);
+            paramMap.put("plotCode", firstPlotCode + secondPlotCode);
             paramMap.put("geoms", "");
             Map<String, Object> geomInfo = nodeLandService.getGeomByNodeId(nodeId);
-            if( geomInfo.get("geoms") instanceof  List){
+            if (geomInfo.get("geoms") instanceof List) {
                 List<String> geoms = (List<String>) geomInfo.get("geoms");
                 paramMap.put("geoms", geoms);
             }
-            //todo 这里调用 httpClient 进行远程调用
-            String result = HttpClientUtil.doGet("https://www.baidu.com",paramMap);
-            //log.error("解析节点附件json失败",e);
-            log.info("获取解析数据为:{}",result);
-            //构造结果进行入库
+            // todo 这里调用 httpClient 进行远程调用
+            String result = HttpClientUtil.doGet("https://www.baidu.com", paramMap);
+            // log.error("解析节点附件json失败",e);
+            log.info("获取解析数据为:{}", result);
+            // 构造结果进行入库
         }
-        retMap.put("code","12345678");
-        retMap.put("projectId",projectId);
+        retMap.put("code", "12345678");
+        retMap.put("projectId", projectId);
         return retMap;
     }
 
-
     @Override
     public GyjsydscdjRes get(String projectId) {
         return null;