|
@@ -1,6 +1,8 @@
|
|
|
package com.sooka.sponest.dataexchange.sendChange.controller;
|
|
|
|
|
|
|
|
|
+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;
|
|
@@ -19,6 +21,7 @@ import com.sooka.sponest.dataexchange.util.RestUtil;
|
|
|
import com.sooka.sponest.dataexchange.util.spring.SpringUtils;
|
|
|
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;
|
|
@@ -71,6 +74,17 @@ public class EngineeringController {
|
|
|
@PostMapping("/receiveEngineeringData")
|
|
|
@ResponseBody
|
|
|
public R<?> receiveEngineeringData(@RequestBody List<CenterdataTKeyProjectsPictures> list) {
|
|
|
+ // 获取token
|
|
|
+ JSONObject params = new JSONObject();
|
|
|
+ params.put("username", "tsgz");
|
|
|
+ params.put("password", "Tsgz@123");
|
|
|
+ JSONObject result;
|
|
|
+ try {
|
|
|
+ result = RestUtil.post("http://192.168.7.72:18880/api/getToken", params);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.info("获取token报错:" + e.getMessage());
|
|
|
+ return R.fail("获取token报错");
|
|
|
+ }
|
|
|
log.info("List<CenterdataTKeyProjectsPictures>:{}",list);
|
|
|
R<String> appUrl = remoteConfigService.remotegetConfigKey("appUrl");
|
|
|
List<CenterdataTKeyProjectsPictures> requestList = new ArrayList<>();
|
|
@@ -84,28 +98,17 @@ public class EngineeringController {
|
|
|
centerdataTKeyProjectsPictures.setSchedulePictures(pictureList);
|
|
|
requestList.add(var);
|
|
|
}
|
|
|
- // 获取token
|
|
|
- JSONObject params = new JSONObject();
|
|
|
- params.put("username", "tsgz");
|
|
|
- params.put("password", "Tsgz@123");
|
|
|
- JSONObject result = new JSONObject();
|
|
|
- try {
|
|
|
- result = RestUtil.post("http://192.168.7.72:18880/api/getToken", params);
|
|
|
- } catch (Exception e) {
|
|
|
- log.info("获取token报错");
|
|
|
- }
|
|
|
// TODO: 2024/1/16 0016 待修改
|
|
|
- JSONObject headers = new JSONObject();
|
|
|
- headers.put("cookie", result.getString("data"));
|
|
|
- JSONObject jsonObject = new JSONObject();
|
|
|
- jsonObject.put("", requestList);
|
|
|
+ JSONObject variables = new JSONObject();
|
|
|
+ variables.put(HttpHeaders.COOKIE, result.getString("data"));
|
|
|
try {
|
|
|
- result = RestUtil.post("http://192.168.7.72:18880/api/receiveEngineeringPictures", headers, jsonObject);
|
|
|
- log.info(result+"");
|
|
|
+ JSONArray array = JSONArray.parseArray(JSON.toJSONString(requestList));
|
|
|
+ result = RestUtil.post("http://192.168.7.72:18880/api/receiveEngineeringPictures", variables, array);
|
|
|
} catch (Exception e) {
|
|
|
- log.info("重点工程报错");
|
|
|
+ log.info("重点工程报错:" + e.getMessage());
|
|
|
+ return R.fail("重点工程报错");
|
|
|
}
|
|
|
- return R.ok(null,"接收成功");
|
|
|
+ return R.ok(result,"接收成功");
|
|
|
}
|
|
|
|
|
|
/**
|