|
@@ -15,6 +15,7 @@ import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
+import org.springframework.util.StringUtils;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
@@ -49,6 +50,34 @@ public class ShowDataController {
|
|
|
@Autowired
|
|
|
SohResultMapper sohResultMapper;
|
|
|
|
|
|
+ @ApiOperation(value = "获取汇总数据")
|
|
|
+ @PostMapping("/getTotal")
|
|
|
+ public ApiDTO getTotal(@RequestBody QueryParam param) {
|
|
|
+ List<Response> responses = new ArrayList<>();
|
|
|
+ List<String> sns = new ArrayList<>();
|
|
|
+ QueryWrapper<ResultOriginData> resultOriginDataQueryWrapper = new QueryWrapper<>();
|
|
|
+ if (StringUtils.hasLength(param.getSn())) {
|
|
|
+ resultOriginDataQueryWrapper.like("device_id", param.getSn());
|
|
|
+ }
|
|
|
+ if (param.getTableId() != null) {
|
|
|
+ resultOriginDataQueryWrapper.eq("type", param.getTableId());
|
|
|
+ }
|
|
|
+ if (param.getBatchNum() != null) {
|
|
|
+ resultOriginDataQueryWrapper.like("batch_num", param.getBatchNum());
|
|
|
+ }
|
|
|
+ List<ResultOriginData> resultOriginDataList = resultOriginDataService.list(resultOriginDataQueryWrapper);
|
|
|
+ resultOriginDataList.forEach(p -> sns.add(p.getDeviceId()));
|
|
|
+ sns.forEach(p -> {
|
|
|
+ QueryParam param1 = new QueryParam();
|
|
|
+ param1.setSn(p);
|
|
|
+
|
|
|
+ ApiDTO apiDTO = getRight(param1);
|
|
|
+ responses.add((Response) apiDTO.getData());
|
|
|
+ });
|
|
|
+ return ApiDTO.ok(responses);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
@ApiOperation(value = "获取右侧数据")
|
|
|
@PostMapping("/getRight")
|
|
|
public ApiDTO getRight(@RequestBody QueryParam param) {
|
|
@@ -58,6 +87,7 @@ public class ShowDataController {
|
|
|
Response response = new Response();
|
|
|
ResultInfo resultInfo = new ResultInfo();
|
|
|
// 诊断信息
|
|
|
+
|
|
|
resultInfo = resultInfoService.getOne(new QueryWrapper<ResultInfo>().eq("sn", param.getSn()));
|
|
|
if (resultInfo != null) {
|
|
|
if (resultInfo.getSafety() != null) {
|
|
@@ -69,6 +99,11 @@ public class ShowDataController {
|
|
|
response.setSafetyAdvice(Arrays.asList(resultInfo.getSafetyAdvice().split(";")));
|
|
|
}
|
|
|
|
|
|
+ if (resultInfo.getSafetyText() != null) {
|
|
|
+ resultInfo.setSafetyText(resultInfo.getSafetyText().replace(";", ";"));
|
|
|
+ response.setSafetyText(Arrays.asList(resultInfo.getSafetyText().split(";")));
|
|
|
+ }
|
|
|
+
|
|
|
if (resultInfo.getSafetyAdvice() != null) {
|
|
|
resultInfo.setSafetyAdvice(resultInfo.getSafetyAdvice().replace(";", ";"));
|
|
|
response.setSafetyAdvice(Arrays.asList(resultInfo.getSafetyAdvice().split(";")));
|
|
@@ -99,7 +134,6 @@ public class ShowDataController {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
// if (param.getTableId().equals(1)) {
|
|
|
// if (resultInfo.getAlarmTime() != null) {
|
|
|
// response.setAlarmTime(new SimpleDateFormat("yyyy-MM-dd").format(resultInfo.getAlarmTime()));
|
|
@@ -117,6 +151,7 @@ public class ShowDataController {
|
|
|
|
|
|
// 当前信息
|
|
|
ResultOriginData resultOriginData = resultOriginDataService.getOne(new QueryWrapper<ResultOriginData>().eq("device_id", param.getSn()));
|
|
|
+ response.setTableId(resultOriginData.getType());
|
|
|
response.setTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(resultOriginData.getDate()));
|
|
|
response.setSoc(resultOriginData.getSoc());
|
|
|
response.setVoltage(resultOriginData.getVoltage());
|
|
@@ -141,7 +176,6 @@ public class ShowDataController {
|
|
|
response.setVoltThreshold(new ArrayList<Object>() {{
|
|
|
add(r.getThresholdDown());
|
|
|
add(r.getThresholdUp());
|
|
|
-
|
|
|
}});
|
|
|
response.setVoltLevel(r.getLevel());
|
|
|
} else if (r.getType().equals("压差离群报警")) {
|
|
@@ -151,7 +185,6 @@ public class ShowDataController {
|
|
|
response.setVoltDiffThreshold(new ArrayList<Object>() {{
|
|
|
add(r.getThresholdDown());
|
|
|
add(r.getThresholdUp());
|
|
|
-
|
|
|
}});
|
|
|
response.setVoltDiffLevel(r.getLevel());
|
|
|
} else if (r.getType().equals("内短路报警")) {
|
|
@@ -161,7 +194,6 @@ public class ShowDataController {
|
|
|
response.setInnershortThreshold(new ArrayList<Object>() {{
|
|
|
add(r.getThresholdDown());
|
|
|
add(r.getThresholdUp());
|
|
|
-
|
|
|
}});
|
|
|
response.setInnershortLevel(r.getLevel());
|
|
|
}
|