Procházet zdrojové kódy

更新日志信息

wuweihao před 4 roky
rodič
revize
1e5f522454

+ 5 - 4
README.md

@@ -26,15 +26,15 @@ http://localhost:8085/xiaoan-web/#/login
 	root
 	admin123
 	端口:9999
-	/root/user/java/tomcat-8011-xiaoan/webapps
+	/root/user/java/apache-tomcat-8.0.52-4dkankan/webapps
 	url:
 	访问:
     1.使用向日葵连接
     569648266
     7902
     访问url:
-    前端:192.168.1.8:8011/dist
-    后端:192.1.68.1.8:8011/doc.html
+    前端:192.168.1.8:8088/dist
+    后端:192.1.68.1.8:8088/doc.html
     
     对外访问:
         更新到8088端口后
@@ -76,7 +76,8 @@ server
 server: 
 tomcat: /本地消安/root/user/java/apache-tomcat-8.0.52-4dkankan-xiaoan/webapps/xiaoan
 doc: http://192.168.0.163:8088/xiaoan/doc.html
-web: http://192.168.0.163:8088/dist/#/login    
+web: http://192.168.0.163:8088/dist/#/login 
+下载文件存在地址: /消安控制/mnt/4Dkankan/scene/result   
     
 ## 需求修改日志
    20200519

+ 2 - 2
xiaoan-application/src/main/resources/application-uat.properties

@@ -55,8 +55,8 @@ camera.version.path=/oss/4Dkankan/camera_version/
 server.domian=http://218.17.126.170:9997
 
 # 打包文件文件存放地址
-server.package.result=${server.domian}/scene/result/
+server.package.result=/mnt/4Dkankan/scene/result/
 
 # 远程服务器地址(用来接收文件)
-remote.domian=http://127.0.0.1:8088
+remote.domian=http://221.4.210.172:18088
 remote.api=${remote.domian}/api/scene/uploadSceneHtmlData

+ 44 - 15
xiaoan-service/src/main/java/com/xiaoan/service/backend/listener/AsyncTask.java

@@ -1,8 +1,10 @@
 package com.xiaoan.service.backend.listener;
 
+import cn.hutool.core.io.FileUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.xiaoan.common.constant.ConfigConstant;
+import com.xiaoan.common.exception.BaseRuntimeException;
 import com.xiaoan.common.util.HttpRequestorUtil;
 import com.xiaoan.domain.backend.SceneProEditEntity;
 import com.xiaoan.domain.backend.SceneProEntity;
@@ -10,6 +12,7 @@ import com.xiaoan.service.backend.SceneProEditService;
 import com.xiaoan.service.backend.SceneService;
 import lombok.extern.log4j.Log4j2;
 import org.apache.commons.lang3.StringUtils;
+import org.junit.Test;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Async;
@@ -46,15 +49,19 @@ public class AsyncTask {
             if (!Variable.queue.isEmpty()) {
                 String poll = Variable.queue.poll();
                 String id = StringUtils.substringAfterLast(poll, ",");
+                SceneProEntity proEntity = sceneProService.findById(Long.valueOf(id));
                 try {
                     log.info("start process ");
-                    this.process(Long.valueOf(id));
+                    this.process(proEntity);
                     log.info("end process ");
                 } catch (Exception e) {
+                    proEntity.setDownloadStatus(3);
+                    proEntity.setUpdateTime(new Date());
+                    sceneProService.update(proEntity);
                     log.error("文件发送失败");
                     e.printStackTrace();
                 }
-                log.info("poll消费: {}", poll);
+                log.info("poll消费完成: {}", poll);
 
                 // 队列为空, 休眠
             } else {
@@ -73,13 +80,10 @@ public class AsyncTask {
 
     /**
      * 处理逻辑
-     * @param id
+     * @param
      * @throws Exception
      */
-    public void process(Long id) throws Exception {
-
-        SceneProEntity proEntity = sceneProService.findById(id);
-
+    public void process(SceneProEntity proEntity) throws Exception {
 
         if (proEntity == null) {
             log.error("对象为空");
@@ -88,7 +92,12 @@ public class AsyncTask {
 
         if (proEntity.getDownloadStatus() >= 1) {
             String api = configConstant.REMOTE_API + "?sceneNum=" + proEntity.getNum();
-            int i = HttpRequestorUtil.fileRemote(api, configConstant.SERVER_PACKAGE_RESULT + proEntity.getNum() + ".zip");
+            String filePath = configConstant.SERVER_PACKAGE_RESULT + proEntity.getNum() + ".zip";
+            if (!FileUtil.isFile(filePath)) {
+                log.error("文件不存在:{}", filePath);
+                new BaseRuntimeException("文件不存在");
+            }
+            int i = HttpRequestorUtil.fileRemote(api, filePath);
             if (i == 200) {
                 log.info("文件发送成功");
 
@@ -106,8 +115,9 @@ public class AsyncTask {
                     log.error("发送insertSceneProInfo接口失败");
                     proEntity.setDownloadStatus(3);
                 } else {
+                    log.info("insertSceneProInfo 请求完成");
                     // 成功
-                    SceneProEditEntity proEditEntity = sceneProEditService.findByProId(id);
+                    SceneProEditEntity proEditEntity = sceneProEditService.findByProId(proEntity.getId());
                     // 将返回值id更新
                     log.info("proId 准备更新");
                     JSONObject dataJson = proJson.getJSONObject("data");
@@ -118,6 +128,8 @@ public class AsyncTask {
                     if (!"0".equals(s)){
                         log.error("发送insertSceneProEditInfo接口失败");
                         proEntity.setDownloadStatus(3);
+                    } else {
+                        log.info("insertSceneProEditInfo 请求完成");
                     }
                 }
 
@@ -140,6 +152,7 @@ public class AsyncTask {
 
         proEntity.setWebSite(editDomain(proEntity.getWebSite()));
         proEntity.setThumb(editDomain(proEntity.getThumb()));
+        proEntity.setVideos(editVideos(proEntity.getVideos()));
         proEntity.setDownloadStatus(-1);
 
         log.info("send proEntity: {}", proEntity.toString());
@@ -152,7 +165,7 @@ public class AsyncTask {
 
     private String insertSceneProEditInfo(SceneProEditEntity proEditEntity) throws Exception {
         // /api/scene/insertSceneProEditInfo
-        String api = configConstant.SERVER_DOMIAN + "/api/scene/insertSceneProEditInfo";
+        String api = configConstant.REMOTE_DOMIAN + "/api/scene/insertSceneProEditInfo";
         log.info("send proEditEntity: {}", proEditEntity.toString());
         String post = HttpRequestorUtil.postJson(api, JSON.toJSONString(proEditEntity), "POST");
         log.info("response proEditEntity: {}", post);
@@ -164,10 +177,26 @@ public class AsyncTask {
 
     // 编辑远程域名
     private String editDomain(String url){
-//        log.info("url input: {}", url);
-        url = StringUtils.substringAfterLast(url, ":");
-        url = StringUtils.substringAfter(url, "/");
-//        log.info("url output: {}", url);
-        return configConstant.REMOTE_DOMIAN + "/" + url;
+        // 需要注意weiSite的url
+        url = StringUtils.substringAfterLast(url, "icloud3d.net");
+        return configConstant.REMOTE_DOMIAN + url;
     }
+
+
+    private String editVideos(String str){
+        String replace = str.replace("http://icloud3d.net/", configConstant.REMOTE_DOMIAN);
+        return replace;
+    }
+
+
+
+    @Test
+    public void tes(){
+        String url = "{\"data\":[],\"upPath\":\"http://icloud3d.net/scene/data/dataxa-7Rg2CA0T0/Up.xml\",\"version\":3}";
+        System.out.println(editVideos(url));
+
+
+    }
+
+
 }