Pārlūkot izejas kodu

getInfo 重写hot.json

lyhzzz 3 gadi atpakaļ
vecāks
revīzija
9afb8baa05

+ 1 - 1
pom.xml

@@ -48,7 +48,7 @@
         <dependency>
         <dependency>
             <groupId>com.alibaba</groupId>
             <groupId>com.alibaba</groupId>
             <artifactId>fastjson</artifactId>
             <artifactId>fastjson</artifactId>
-            <version>1.2.79</version>
+            <version>1.2.83</version>
         </dependency>
         </dependency>
 
 
         <dependency>
         <dependency>

+ 9 - 0
src/main/java/com/cdf/controller/service/FdkkSceneController.java

@@ -2,6 +2,8 @@ package com.cdf.controller.service;
 
 
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.cdf.httpClient.client.FdkkClient;
 import com.cdf.httpClient.client.FdkkClient;
+import com.cdf.service.impl.FdkkSceneEditService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
@@ -13,11 +15,18 @@ public class FdkkSceneController {
 
 
     @Resource
     @Resource
     private FdkkClient fdkkClient;
     private FdkkClient fdkkClient;
+    @Autowired
+    private FdkkSceneEditService fdkkSceneEditService;
 
 
     @GetMapping("/getInfo")
     @GetMapping("/getInfo")
     public JSONObject getInfo(@RequestParam(required = false) String num){
     public JSONObject getInfo(@RequestParam(required = false) String num){
         HashMap<String, String> map = new HashMap<>();
         HashMap<String, String> map = new HashMap<>();
         map.put("num",num);
         map.put("num",num);
+        try {
+            fdkkSceneEditService.writeHotJson(num);
+        }catch (Exception e){
+            e.printStackTrace();
+        }
         return fdkkClient.getInfo(map);
         return fdkkClient.getInfo(map);
     }
     }
 }
 }

+ 7 - 4
src/main/java/com/cdf/service/impl/FdkkSceneEditService.java

@@ -157,13 +157,16 @@ public class FdkkSceneEditService {
         if(fdkkResponse.getCode() !=0){
         if(fdkkResponse.getCode() !=0){
             throw new BusinessException(fdkkResponse.getCode(),fdkkResponse.getMsg());
             throw new BusinessException(fdkkResponse.getCode(),fdkkResponse.getMsg());
         }
         }
-        JSONArray hotJson = getHotJson(fdkkHotRequest.getNum());
-        String path = String.format(hotLocalPath, fdkkHotRequest.getNum())+"/"+"hot.json";
+        writeHotJson(fdkkHotRequest.getNum());
+    }
+
+    public void writeHotJson(String num) throws IOException {
+        JSONArray hotJson = getHotJson(num);
+        String path = String.format(hotLocalPath,num)+"/"+"hot.json";
         String json = JSONUtil.toJsonStr(hotJson);
         String json = JSONUtil.toJsonStr(hotJson);
         FileUtils.writeFile(path,json );
         FileUtils.writeFile(path,json );
-        uploadToOssUtil.upload(path,String.format(hotCdfPath, fdkkHotRequest.getNum()));
+        uploadToOssUtil.upload(path,String.format(hotCdfPath, num));
     }
     }
-
     public FdkkResponse uploadFiles(FdkkUploadRequest fdkkUploadRequest, MultipartFile[] files, String token) throws IOException {
     public FdkkResponse uploadFiles(FdkkUploadRequest fdkkUploadRequest, MultipartFile[] files, String token) throws IOException {
         List<MultipartFile> multipartFiles = new ArrayList<>();
         List<MultipartFile> multipartFiles = new ArrayList<>();
         if(StringUtils.isNotBlank(fdkkUploadRequest.getBase64())){
         if(StringUtils.isNotBlank(fdkkUploadRequest.getBase64())){