bihuisong пре 1 година
родитељ
комит
779057391f

+ 17 - 19
src/main/java/com/sooka/sponest/dataexchange/sendChange/controller/EngineeringController.java

@@ -5,36 +5,27 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.ruoyi.common.core.domain.R;
-import com.ruoyi.common.core.utils.file.FilePrefixUtils;
-import com.ruoyi.common.security.service.TokenService;
+import com.ruoyi.common.log.annotation.Log;
+import com.ruoyi.common.log.enums.BusinessType;
 import com.ruoyi.common.security.utils.SecurityUtils;
 import com.ruoyi.system.api.RemoteConfigService;
-import com.ruoyi.system.api.RemoteFileService;
-import com.ruoyi.system.api.domain.SysFile;
-import com.ruoyi.system.api.model.LoginUser;
-import com.sooka.sponest.dataexchange.exchange.domian.DataExchangeEntity;
 import com.sooka.sponest.dataexchange.remoteapi.service.center.data.RemoteDataBaseService;
-import com.sooka.sponest.dataexchange.remoteapi.service.center.event.RemoteEventBaseService;
 import com.sooka.sponest.dataexchange.sendChange.domian.CenterdataTKeyProjects;
 import com.sooka.sponest.dataexchange.sendChange.domian.CenterdataTKeyProjectsPictures;
 import com.sooka.sponest.dataexchange.util.RestUtil;
-import com.sooka.sponest.dataexchange.util.spring.SpringUtils;
+import org.springframework.beans.factory.annotation.Value;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.http.HttpHeaders;
 import org.springframework.stereotype.Controller;
-import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.ResponseBody;
-import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 @Slf4j
 @Controller
@@ -45,8 +36,14 @@ public class EngineeringController {
     private RemoteDataBaseService remoteDataBaseService;
     @Resource
     private RemoteConfigService remoteConfigService;
-    //    @Value("${}")
-    private String url;
+    @Value("${engineering.ip}")
+    private String ip;
+    @Value("${engineering.port}")
+    private String port;
+    @Value("${engineering.username}")
+    private String username;
+    @Value("${engineering.password}")
+    private String password;
 
 
     /**
@@ -73,14 +70,15 @@ public class EngineeringController {
 
     @PostMapping("/receiveEngineeringData")
     @ResponseBody
+    @Log(title = "向重点工程推送事件图片", businessType = BusinessType.OTHER)
     public R<?> receiveEngineeringData(@RequestBody List<CenterdataTKeyProjectsPictures> list) {
         // 获取token
         JSONObject params = new JSONObject();
-        params.put("username", "tsgz");
-        params.put("password", "Tsgz@123");
+        params.put("username", username);
+        params.put("password", password);
         JSONObject result;
         try {
-            result = RestUtil.post("http://192.168.7.72:18880/api/getToken", params);
+            result = RestUtil.post(ip + ":" + port + "/api/getToken", params);
         } catch (Exception e) {
             log.info("获取token报错:" + e.getMessage());
             return R.fail("获取token报错");
@@ -98,12 +96,12 @@ public class EngineeringController {
             centerdataTKeyProjectsPictures.setSchedulePictures(pictureList);
             requestList.add(var);
         }
-        // TODO: 2024/1/16 0016 待修改
         JSONObject variables = new JSONObject();
         variables.put(HttpHeaders.COOKIE, result.getString("data"));
         try {
             JSONArray array = JSONArray.parseArray(JSON.toJSONString(requestList));
-            result = RestUtil.post("http://192.168.7.72:18880/api/receiveEngineeringPictures", variables, array);
+            result = RestUtil.post(ip + ":" + port + "/api/receiveEngineeringPictures", variables, array);
+            log.info(result+"");
         } catch (Exception e) {
             log.info("重点工程报错:" + e.getMessage());
             return R.fail("重点工程报错");