|
|
@@ -1,8 +1,21 @@
|
|
1
|
1
|
package com.chinaitop.depot.agent.temperature.controller;
|
|
2
|
2
|
|
|
|
3
|
+import java.util.ArrayList;
|
|
|
4
|
+import java.util.HashMap;
|
|
|
5
|
+import java.util.List;
|
|
|
6
|
+import java.util.Map;
|
|
|
7
|
+
|
|
|
8
|
+import javax.annotation.Resource;
|
|
|
9
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
10
|
+
|
|
|
11
|
+import org.apache.commons.lang.StringUtils;
|
|
|
12
|
+import org.springframework.http.MediaType;
|
|
|
13
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
14
|
+import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
15
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
16
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
17
|
+
|
|
3
|
18
|
import com.alibaba.fastjson.JSON;
|
|
4
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
5
|
|
-import com.chinaitop.depot.agent.basic.model.BusinessAgentTank;
|
|
6
|
19
|
import com.chinaitop.depot.agent.basic.service.agentService;
|
|
7
|
20
|
import com.chinaitop.depot.agent.temperature.model.BusinessAgentTemperature;
|
|
8
|
21
|
import com.chinaitop.depot.agent.temperature.model.TPoints;
|
|
|
@@ -12,20 +25,11 @@ import com.chinaitop.utils.ParameterUtil;
|
|
12
|
25
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
13
|
26
|
import com.github.pagehelper.PageHelper;
|
|
14
|
27
|
import com.github.pagehelper.PageInfo;
|
|
|
28
|
+
|
|
15
|
29
|
import io.swagger.annotations.Api;
|
|
16
|
30
|
import io.swagger.annotations.ApiImplicitParam;
|
|
17
|
31
|
import io.swagger.annotations.ApiImplicitParams;
|
|
18
|
32
|
import io.swagger.annotations.ApiOperation;
|
|
19
|
|
-import org.apache.commons.lang.StringUtils;
|
|
20
|
|
-import org.springframework.http.MediaType;
|
|
21
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
22
|
|
-import org.springframework.web.bind.annotation.RequestMethod;
|
|
23
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
24
|
|
-import org.springframework.web.multipart.MultipartFile;
|
|
25
|
|
-
|
|
26
|
|
-import javax.annotation.Resource;
|
|
27
|
|
-import javax.servlet.http.HttpServletRequest;
|
|
28
|
|
-import java.util.*;
|
|
29
|
33
|
|
|
30
|
34
|
@RestController
|
|
31
|
35
|
@RequestMapping(value = "/agentTemperature")
|
|
|
@@ -152,18 +156,20 @@ public class AgentTemperatureController {
|
|
152
|
156
|
public Map<String, Object> getAgentTemperatureEdit(Integer id) {
|
|
153
|
157
|
Map<String, Object> modelMap = new HashMap<>();
|
|
154
|
158
|
List<TPoints> tPointsList = new ArrayList<TPoints>();
|
|
155
|
|
- BusinessAgentTemperature agentTemper;
|
|
|
159
|
+ BusinessAgentTemperature agentTemper = null;
|
|
156
|
160
|
if (id != null) {
|
|
157
|
161
|
agentTemper = agentTemperatureService.findById(id);
|
|
158
|
|
- modelMap.put("agentTemper", agentTemper);
|
|
159
|
162
|
String[] points = agentTemper.gettPoints().substring(2, agentTemper.gettPoints().length() - 2).split("\\},\\{");
|
|
160
|
163
|
ObjectMapper mapper = new ObjectMapper();
|
|
161
|
164
|
for (String point : points) {
|
|
162
|
165
|
TPoints tPoints = JSON.parseObject(JSON.parse("{" + point + "}").toString(), TPoints.class);
|
|
163
|
166
|
tPointsList.add(tPoints);
|
|
164
|
167
|
}
|
|
165
|
|
- modelMap.put("tPoints", tPointsList);
|
|
|
168
|
+ } else {
|
|
|
169
|
+ agentTemper = new BusinessAgentTemperature();
|
|
166
|
170
|
}
|
|
|
171
|
+ modelMap.put("agentTemper", agentTemper);
|
|
|
172
|
+ modelMap.put("tPoints", tPointsList);
|
|
167
|
173
|
return modelMap;
|
|
168
|
174
|
}
|
|
169
|
175
|
|