|
@@ -1,8 +1,11 @@
|
|
|
package com.ruoyi.web.controller.zhdd;
|
|
|
|
|
|
+import cn.afterturn.easypoi.entity.ImageEntity;
|
|
|
import cn.afterturn.easypoi.word.WordExportUtil;
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
+import cn.hutool.core.convert.Convert;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
+import cn.hutool.core.io.FileUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.json.JSONArray;
|
|
@@ -12,6 +15,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.ruoyi.common.annotation.Log;
|
|
|
import com.ruoyi.common.annotation.RepeatSubmit;
|
|
|
import com.ruoyi.common.annotation.Security;
|
|
|
+import com.ruoyi.common.config.RuoYiConfig;
|
|
|
import com.ruoyi.common.constant.Constants;
|
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
@@ -25,6 +29,7 @@ import com.ruoyi.common.core.validate.EditGroup;
|
|
|
import com.ruoyi.common.core.validate.QueryGroup;
|
|
|
import com.ruoyi.common.enums.BusinessType;
|
|
|
import com.ruoyi.common.utils.RedisUtils;
|
|
|
+import com.ruoyi.common.utils.StringUtils;
|
|
|
import com.ruoyi.common.utils.UserUtil;
|
|
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
import com.ruoyi.system.service.ISysDeptService;
|
|
@@ -315,11 +320,12 @@ public class IncidentController extends BaseController {
|
|
|
IncidentVo incidentVo = iIncidentService.queryById(id);
|
|
|
if (incidentVo != null) {
|
|
|
map.put("name", incidentVo.getName());
|
|
|
- /*if (ObjectUtil.isNotEmpty(incidentVo.getType())) {
|
|
|
+ map.put("nowDate", DateUtil.today());
|
|
|
+ if (ObjectUtil.isNotEmpty(incidentVo.getType())) {
|
|
|
map.put("type", sysDictDataService.selectDictLabel("zhdd_plan_type", Convert.toStr(incidentVo.getType())));
|
|
|
} else {
|
|
|
map.put("type", "-");
|
|
|
- }*/
|
|
|
+ }
|
|
|
map.put("createTime", DateUtil.formatDateTime(incidentVo.getCreateTime()));
|
|
|
map.put("addr", incidentVo.getAddr());
|
|
|
map.put("commanderText", StrUtil.blankToDefault(incidentVo.getCommanderText(), "无"));
|
|
@@ -347,36 +353,60 @@ public class IncidentController extends BaseController {
|
|
|
map.put("source", sysDictDataService.selectDictLabel("zhdd_incident_source", incidentVo.getSource()));
|
|
|
} else {
|
|
|
map.put("source", "-");
|
|
|
- }
|
|
|
+ }*/
|
|
|
if (ObjectUtil.isNotEmpty(incidentVo.getLevel())) {
|
|
|
- map.put("level", sysDictDataService.selectDictLabel("zhdd_incident_level", Convert.toStr(incidentVo.getLevel())));
|
|
|
+ map.put("level", sysDictDataService.selectDictLabel("zhdd_incident_level", Convert.toStr(incidentVo.getLevel())) + "级");
|
|
|
} else {
|
|
|
map.put("level", "-");
|
|
|
- }*/
|
|
|
+ }
|
|
|
+
|
|
|
+ // 组装事件图片
|
|
|
+ List<String> picList = StrUtil.split(incidentVo.getPic(), ",");
|
|
|
+ List<ImageEntity> pics = new ArrayList<>();
|
|
|
+ for (String s : picList) {
|
|
|
+ ImageEntity imageEntity = new ImageEntity();
|
|
|
+ imageEntity.setType(ImageEntity.Data);
|
|
|
+ imageEntity.setHeight(300);
|
|
|
+ imageEntity.setWidth(550);
|
|
|
+ log.info("图片相对地址:{}", s);
|
|
|
+
|
|
|
+ // 本地资源路径
|
|
|
+ String localPath = RuoYiConfig.getProfile();
|
|
|
+ // 数据库资源地址
|
|
|
+ String downloadPath = localPath + StringUtils.substringAfter(s, Constants.RESOURCE_PREFIX);
|
|
|
+ try {
|
|
|
+ imageEntity.setData(FileUtil.readBytes(downloadPath));
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.info("读取图片失败:{}", e.getMessage());
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ pics.add(imageEntity);
|
|
|
+ }
|
|
|
+ map.put("pics", pics);
|
|
|
+
|
|
|
+ // 查询处置过程
|
|
|
+ List<IncidentProcess> incidentProcess = processService.list(Wrappers.<IncidentProcess>lambdaQuery()
|
|
|
+ .eq(IncidentProcess::getIncidentId, id).orderByAsc(IncidentProcess::getCreateTime));
|
|
|
+ Map<String, List<IncidentProcess>> processCollect = incidentProcess.stream().filter(a -> StrUtil.isNotBlank(a.getTaskId())).collect(Collectors.groupingBy(IncidentProcess::getTaskId));
|
|
|
+
|
|
|
// 查询处置方案
|
|
|
List<IncidentTaskVo> incidentTasks = incidentTaskService.listTaskInfo(id);
|
|
|
if (incidentTasks != null && incidentTasks.size() > 0) {
|
|
|
StringBuilder tasks = new StringBuilder();
|
|
|
for (int i = 0; i < incidentTasks.size(); i++) {
|
|
|
tasks.append(i + 1).append("、").append(incidentTasks.get(i).getTaskName()).append("\r");
|
|
|
+ // 查询指令对应的处置过程
|
|
|
+ List<IncidentProcess> processList = processCollect.get(incidentTasks.get(i).getId());
|
|
|
+ if (processList != null && processList.size() > 0) {
|
|
|
+ String collect = processList.stream().map(IncidentProcess::getDes).collect(Collectors.joining("\r "));
|
|
|
+ tasks.append(" ").append(collect).append("\r ");
|
|
|
+ }
|
|
|
}
|
|
|
map.put("tasks", tasks.toString());
|
|
|
} else {
|
|
|
map.put("tasks", "无");
|
|
|
}
|
|
|
|
|
|
- // 查询处置过程
|
|
|
- List<IncidentProcess> incidentProcess = processService.list(Wrappers.<IncidentProcess>lambdaQuery()
|
|
|
- .eq(IncidentProcess::getIncidentId, id).orderByAsc(IncidentProcess::getCreateTime));
|
|
|
- if (incidentProcess != null && incidentProcess.size() > 0) {
|
|
|
- StringBuilder processs = new StringBuilder();
|
|
|
- for (int i = 0; i < incidentProcess.size(); i++) {
|
|
|
- processs.append(i + 1).append("、").append(incidentProcess.get(i).getDes()).append("\r");
|
|
|
- }
|
|
|
- map.put("processs", processs.toString());
|
|
|
- } else {
|
|
|
- map.put("processs", "无");
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
String fileName = "incident_" + DateUtil.format(new Date(), "yyyyMMddHHmmss") + ".docx";
|
|
@@ -484,4 +514,9 @@ public class IncidentController extends BaseController {
|
|
|
file.delete();
|
|
|
}
|
|
|
|
|
|
+ public static void main(String[] args) {
|
|
|
+ String a = FileUtil.getAbsolutePath("/profile/upload/2022/03/11/9a583b1a3844d664b06f53a92f8bf9b_8856.jpg");
|
|
|
+ System.out.println(a);
|
|
|
+ }
|
|
|
+
|
|
|
}
|