Browse Source

fix:数据趋势翻译

master
wangguangyuan 8 months ago
parent
commit
86823a18ed
5 changed files with 244 additions and 25 deletions
  1. +6
    -0
      inspect-main/inspect-main-statistics/pom.xml
  2. +110
    -3
      inspect-main/inspect-main-statistics/src/main/java/com/inspect/statistics/controller/PatrolStatisticsController.java
  3. +23
    -18
      inspect-main/inspect-main-statistics/src/main/java/com/inspect/statistics/service/impl/PatrolStatisticsServiceImpl.java
  4. +23
    -4
      inspect-main/inspect-main-statistics/src/main/resources/mapper/PatrolResultMapper.xml
  5. +82
    -0
      inspect-main/inspect-main-task/src/main/java/com/inspect/message/MessageUtils.java

+ 6
- 0
inspect-main/inspect-main-statistics/pom.xml View File

@ -39,5 +39,11 @@
<groupId>com.inspect</groupId>
<artifactId>inspect-base-swagger</artifactId>
</dependency>
<dependency>
<groupId>com.inspect</groupId>
<artifactId>inspect-main-task</artifactId>
</dependency>
</dependencies>
</project>

+ 110
- 3
inspect-main/inspect-main-statistics/src/main/java/com/inspect/statistics/controller/PatrolStatisticsController.java View File

@ -1,5 +1,6 @@
package com.inspect.statistics.controller;
import cn.hutool.poi.excel.ExcelWriter;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.inspect.base.core.exception.ServiceException;
@ -10,11 +11,13 @@ import com.inspect.base.core.web.domain.AjaxResult;
import com.inspect.base.core.web.page.TableDataInfo;
import com.inspect.common.log.annotation.Log;
import com.inspect.common.log.enums.BizType;
import com.inspect.message.MessageUtils;
import com.inspect.statistics.domain.StatisticsPatrolResult;
import com.inspect.statistics.service.PatrolStatisticsService;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.List;
import javax.annotation.Resource;
@ -22,6 +25,7 @@ import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@ -35,6 +39,9 @@ public class PatrolStatisticsController extends BaseController {
@Resource
PatrolStatisticsService statisticsService;
@Autowired
MessageUtils messageUtils;
@GetMapping({"/list"})
public TableDataInfo queryPatrolResult(StatisticsPatrolResult result) {
this.statisticsService.verifyParam(result);
@ -107,11 +114,30 @@ public class PatrolStatisticsController extends BaseController {
businessType = BizType.EXPORT
)
@GetMapping({"/export"})
public void exportExcel(StatisticsPatrolResult result, HttpServletResponse response) throws UnsupportedEncodingException {
public void exportExcel(StatisticsPatrolResult result, HttpServletResponse response) throws IOException {
this.statisticsService.verifyParam(result);
List<StatisticsPatrolResult> patrolResults = this.statisticsService.queryPatrolResultMulti(result);
ExcelUtil<StatisticsPatrolResult> util = new ExcelUtil<>(StatisticsPatrolResult.class);
util.exportExcelWithFileName(response, patrolResults, "巡视结果", "数据对比分析");
// ExcelUtil<StatisticsPatrolResult> util = new ExcelUtil<>(StatisticsPatrolResult.class);
// util.exportExcelWithFileName(response, patrolResults, "巡视结果", "数据对比分析");
ExcelWriter writer = new ExcelWriter();
String[] configColArr = new String[]{"deviceName", "time", "value", "patrolStatus", "checkResult"};
HashMap<String, String> colMap = this.statisticsService.colMap();
for (String col : configColArr) {
if (StringUtils.isNotBlank(colMap.get(col))) {
writer.addHeaderAlias(col, colMap.get(col));
}
}
long now = System.currentTimeMillis();
String filename = messageUtils.get("巡视结果") + "_" + messageUtils.get("数据对比分析") + "_" + now;
filename = URLEncoder.encode(filename, "utf8");
response.setContentType("application/vnd.ms-excel;charset=utf-8");
response.setHeader("Content-Disposition", "attachment;filename=" + filename + ".xls");
response.setCharacterEncoding("utf-8");
writer.setOnlyAlias(true);
writer.write(patrolResults, true);
writer.flush(response.getOutputStream());
writer.close();
}
@Log(
@ -120,9 +146,90 @@ public class PatrolStatisticsController extends BaseController {
)
@GetMapping({"/configExport"})
public void configExport(StatisticsPatrolResult result, HttpServletResponse response) throws IOException {
logger.info("----------自定义字段导出,result:{}", result);
this.statisticsService.verifyParam(result);
List<StatisticsPatrolResult> patrolResults = this.statisticsService.queryPatrolResultMultiExport(result);
for (StatisticsPatrolResult patrolResult : patrolResults) {
String dataType = patrolResult.getDataType();
if ("1".equals(dataType)) {
patrolResult.setDataType(messageUtils.get("摄像机"));
} else if ("2".equals(dataType)) {
patrolResult.setDataType(messageUtils.get("机器人"));
} else if ("3".equals(dataType)) {
patrolResult.setDataType(messageUtils.get("无人机"));
} else if ("4".equals(dataType)) {
patrolResult.setDataType(messageUtils.get("声纹"));
} else if ("5".equals(dataType)) {
patrolResult.setDataType(messageUtils.get("在线监测"));
}
String recognitionType = patrolResult.getRecognitionType();
if (StringUtils.isNotEmpty(recognitionType)) {
if ("1".equals(recognitionType)) {
patrolResult.setRecognitionType(messageUtils.get("表计读取"));
} else if ("2".equals(recognitionType)) {
patrolResult.setRecognitionType(messageUtils.get("位置状态识别"));
} else if ("4".equals(recognitionType)) {
patrolResult.setRecognitionType(messageUtils.get("红外测温"));
} else if ("52".equals(recognitionType)) {
patrolResult.setRecognitionType(messageUtils.get("仪表读数"));
} else if ("118".equals(recognitionType)) {
patrolResult.setRecognitionType(messageUtils.get("形变"));
} else if ("119".equals(recognitionType)) {
patrolResult.setRecognitionType(messageUtils.get("红外1800"));
} else if ("120".equals(recognitionType)) {
patrolResult.setRecognitionType(messageUtils.get("无人机红外"));
} else if ("121".equals(recognitionType)) {
patrolResult.setRecognitionType(messageUtils.get("摄像头红外"));
} else if ("122".equals(recognitionType)) {
patrolResult.setRecognitionType(messageUtils.get("摄像头红外灰度反算"));
}
}
Integer patrolStatus = patrolResult.getPatrolStatus();
if (patrolStatus != null) {
if (patrolStatus == 0) {
patrolResult.setPatrolStatusName(messageUtils.get("未审核"));
} else if (patrolStatus == 1) {
patrolResult.setPatrolStatusName(messageUtils.get("已审核"));
}
}
String fileType = patrolResult.getFileType();
if (StringUtils.isNotEmpty(fileType)) {
StringBuilder stringBuilder = new StringBuilder();
String[] fileTypeArr = fileType.split(",");
for (String s : fileTypeArr) {
if ("1".equals(s)) {
stringBuilder.append(messageUtils.get("红外图谱")).append(",");
} else if ("2".equals(s)) {
stringBuilder.append(messageUtils.get("可见光照片")).append(",");
} else if ("3".equals(s)) {
stringBuilder.append(messageUtils.get("音频")).append(",");
} else if ("4".equals(s)) {
stringBuilder.append(messageUtils.get("视频")).append(",");
}
}
String fileTypeStr = stringBuilder.toString();
if (fileTypeStr.endsWith(",")) {
fileTypeStr = fileTypeStr.substring(0, fileTypeStr.length() - 1);
}
patrolResult.setFileType(fileTypeStr);
}
String valid = patrolResult.getValid();
if (StringUtils.isNotEmpty(valid)) {
if ("0".equals(valid)) {
patrolResult.setValid(messageUtils.get("失败"));
} else if ("2".equals(valid)) {
patrolResult.setValid(messageUtils.get("成功"));
} else {
patrolResult.setValid(messageUtils.get("判别异常"));
}
}
}
this.statisticsService.configExport(patrolResults, result, response);
}
@GetMapping({"/colMap"})


+ 23
- 18
inspect-main/inspect-main-statistics/src/main/java/com/inspect/statistics/service/impl/PatrolStatisticsServiceImpl.java View File

@ -25,7 +25,9 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.ArrayUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.inspect.message.MessageUtils;
@Service
public class PatrolStatisticsServiceImpl implements PatrolStatisticsService {
@ -33,6 +35,9 @@ public class PatrolStatisticsServiceImpl implements PatrolStatisticsService {
@Resource
StatisticsPatrolResultMapper resultMapper;
@Autowired
private MessageUtils messageUtils;
public List<StatisticsPatrolResult> queryPatrolResult(StatisticsPatrolResult result) {
return this.resultMapper.queryPatrolResult(result);
}
@ -175,7 +180,7 @@ public class PatrolStatisticsServiceImpl implements PatrolStatisticsService {
}
long now = System.currentTimeMillis();
String filename = "巡视结果表格_" + now;
String filename = messageUtils.get("巡视结果") + now;
filename = URLEncoder.encode(filename, "utf8");
response.setContentType("application/vnd.ms-excel;charset=utf-8");
response.setHeader("Content-Disposition", "attachment;filename=" + filename + ".xls");
@ -189,23 +194,23 @@ public class PatrolStatisticsServiceImpl implements PatrolStatisticsService {
public HashMap<String, String> colMap() {
HashMap<String, String> colMap = new HashMap<>();
colMap.put("lineId", "巡视结果ID");
colMap.put("patrolDeviceName", "巡视设备名称");
colMap.put("patrolDeviceCode", "巡视设备编码");
colMap.put("taskName", "任务名称");
colMap.put("taskCode", "任务编码");
colMap.put("deviceName", "设备点位");
colMap.put("deviceId", "设备点位ID");
colMap.put("value", "识别结果");
colMap.put("value_unit", "识别结果带单位");
colMap.put("time", "巡视时间");
colMap.put("recognitionType", "识别类型");
colMap.put("fileType", "识别结果");
colMap.put("taskPatrolledId", "巡视任务执行ID");
colMap.put("valid", "结论");
colMap.put("patrolStatusName", "审核状态");
colMap.put("checkResult", "审核结果");
colMap.put("dataType", "巡视结果数据来源");
colMap.put("lineId", messageUtils.get("线路名称"));
colMap.put("patrolDeviceName", messageUtils.get("巡视设备名称"));
colMap.put("patrolDeviceCode", messageUtils.get("巡视设备编码"));
colMap.put("taskName", messageUtils.get("任务名称"));
colMap.put("taskCode", messageUtils.get("任务编码"));
colMap.put("deviceName", messageUtils.get("设备点位"));
colMap.put("deviceId", messageUtils.get("设备点位ID"));
colMap.put("value", messageUtils.get("识别结果"));
colMap.put("valueUnit", messageUtils.get("识别结果带单位"));
colMap.put("time", messageUtils.get("巡视时间"));
colMap.put("recognitionType", messageUtils.get("识别类型"));
colMap.put("fileType", messageUtils.get("文件类型"));
colMap.put("taskPatrolledId", messageUtils.get("巡视任务执行ID"));
colMap.put("valid", messageUtils.get("结论"));
colMap.put("patrolStatusName", messageUtils.get("归档状态"));
colMap.put("checkResult", messageUtils.get("审核结果"));
colMap.put("dataType", messageUtils.get("巡视结果数据来源"));
return colMap;
}
}

+ 23
- 4
inspect-main/inspect-main-statistics/src/main/resources/mapper/PatrolResultMapper.xml View File

@ -44,19 +44,38 @@
</sql>
<sql id="selectPatrolResultJoinExport">
select result.line_id,result.patrol_device_name,result.patrol_device_code,result.task_name,result.task_code,result.device_name,result.device_id,result.value_type,result.material_id,result.data_type,
<sql id="selectPatrolResultJoinExport1">
select result.line_id,result.patrol_device_name,result.patrol_device_code,result.task_name,result.task_code,result.device_name,result.device_id,result.value_type,result.material_id,
case result.data_type when 1 then '摄像机' when 2 then '机器人' when 3 then '无人机' when 4 then '声纹' when 5 then '在线监测'else data_type end data_type,
result.value,result.value_unit,result.unit,result.time,result.check_result,
case result.recognition_type when 1 then '表计读取' when 2 then '位置状态识别' when 4 then '红外测温' end recognition_type,
result.file_type,result.file_path,result.rectangle,result.task_patrolled_id,
case result.file_type when 1 then '红外图谱' when 2 then ' 可见光照片' when 3 then '音频' when 4 then '视频' else file_type end file_type,
result.file_path,result.rectangle,result.task_patrolled_id,
case result.valid when 0 then '失败' when 1 then '成功' when 2 then '判别异常' end valid,
case result.patrol_status when 0 then '未审核' when 1 then '已审核' end patrolStatusName
case result.patrol_status when 0 then '未审核' when 1 then '已审核' end patrolStatusName,
result.patrol_status patrol_status
from basedata_patrolpoint point
left join patrol_result result
on point.patrol_point_id = result.device_id
</sql>
<sql id="selectPatrolResultJoinExport">
select result.line_id,result.patrol_device_name,result.patrol_device_code,result.task_name,result.task_code,result.device_name,result.device_id,result.value_type,result.material_id,
result.data_type data_type,
result.value,result.value_unit,result.unit,result.time,result.check_result,
result.recognition_type recognition_type,
result.file_type file_type,
result.file_path,result.rectangle,result.task_patrolled_id,
result.valid valid,
result.patrol_status patrolStatusName,
result.patrol_status patrol_status
from basedata_patrolpoint point
left join patrol_result result
on point.patrol_point_id = result.device_id
</sql>
<select id="queryPatrolResult" resultMap="PatrolResult">
<include refid="selectPatrolResultJoin"/>
<where>


+ 82
- 0
inspect-main/inspect-main-task/src/main/java/com/inspect/message/MessageUtils.java View File

@ -100,6 +100,88 @@ public class MessageUtils {
return "Analysis results";
case "任务详情":
return "Task details";
case "线路名称":
return "LineId";
case "巡视设备名称":
return "patrolDeviceName";
case "巡视设备编码":
return "patrolDeviceCode";
case "任务名称":
return "taskName";
case "任务编码":
return "taskCode";
case "设备点位":
return "deviceName";
case "设备点位ID":
return "deviceId";
case "识别结果":
return "value";
case "识别结果带单位":
return "valueUnit";
case "巡视时间":
return "time";
case "识别类型":
return "recognitionType";
case "文件类型":
return "fileType";
case "巡视任务执行ID":
return "taskPatrolledId";
case "结论":
return "conclusion";
case "归档状态":
return "patrolStatusName";
case "审核结果":
return "checkResult";
case "巡视结果数据来源":
return "dataType";
case "摄像机":
return "camera";
case "机器人":
return "robot";
case "无人机":
return "drone";
case "声纹":
return "voiceprint";
case "在线监测":
return "onlineMonitoring";
case "表计读取":
return "bjdq";
case "位置状态识别":
return "positionStatusRecognition";
case "红外测温":
return "infrared";
case "仪表读数":
return "meter";
case "形变":
return "xb";
case "红外1800":
return "infra_1800";
case "无人机红外":
return "infra_yu3";
case "摄像头红外":
return "infra_camera";
case "摄像头红外灰度反算":
return "infra_camera_reverse";
case "未审核":
return "unreviewed";
case "已审核":
return "reviewed";
case "红外图谱":
return "infra_spectrum";
case "可见光照片":
return "visible_photo";
case "音频":
return "audio";
case "视频":
return "video";
case "失败":
return "fail";
case "成功":
return "success";
case "判别异常":
return "judgeAbnormal";
case "数据对比分析":
return "analysis";
default:
return key;
}


Loading…
Cancel
Save