From ce187f458ff64bc2701db6159fe3c9244d3c84c7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=8E=8B=E5=85=B4=E7=90=B3?= <1911390090@qq.com>
Date: Tue, 20 Feb 2024 10:36:18 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=8B=E4=BB=B6=E5=AF=BC?=
=?UTF-8?q?=E5=87=BAExcel=E6=A0=BC=E5=BC=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
zc-business/pom.xml | 4 ++++
.../main/java/com/zc/business/domain/DcEvent.java | 14 +++++++++-----
.../business/service/impl/DcEventServiceImpl.java | 14 ++++++++++++++
.../resources/mapper/business/DcEventMapper.xml | 3 ++-
4 files changed, 29 insertions(+), 6 deletions(-)
diff --git a/zc-business/pom.xml b/zc-business/pom.xml
index e83ad99b..275f2980 100644
--- a/zc-business/pom.xml
+++ b/zc-business/pom.xml
@@ -39,6 +39,10 @@
+
+ com.ruoyi
+ ruoyi-system
+
com.zc
1.0.0
diff --git a/zc-business/src/main/java/com/zc/business/domain/DcEvent.java b/zc-business/src/main/java/com/zc/business/domain/DcEvent.java
index a48aec33..1bb5a05b 100644
--- a/zc-business/src/main/java/com/zc/business/domain/DcEvent.java
+++ b/zc-business/src/main/java/com/zc/business/domain/DcEvent.java
@@ -40,8 +40,10 @@ public class DcEvent extends BaseEntity {
* 所属部门
*/
@ApiModelProperty("所属部门")
- @Excel(name = "所属部门")
private Long deptId;
+ @Excel(name = "所属部门")
+ private String deptName;
+
/**
* 所在桩号
*/
@@ -59,7 +61,8 @@ public class DcEvent extends BaseEntity {
* 2-中
* 3-下
*/
- @Excel(name = "方向")
+ @Excel(name = "方向", readConverterExp = "1=上行,3=下行")
+ //@Excel(name = "方向")
@ApiModelProperty("方向")
private String direction;
/**
@@ -196,10 +199,10 @@ public class DcEvent extends BaseEntity {
/**
* 是否处在隧道
*/
- @Excel(name = "是否处在隧道")
+ @Excel(name = "是否处在隧道" , readConverterExp = "0=否,1=是")
@ApiModelProperty("是否处在隧道 0 表示 false,1 表示 true")
private Integer inTunnel;
- @Excel(name = "高速")
+ //@Excel(name = "高速")
@ApiModelProperty("高速公路")
private Long roadId;
@@ -210,9 +213,10 @@ public class DcEvent extends BaseEntity {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("发生时间")
private Date occurrenceTime;
- @Excel(name = "是否是感知事件")
+ @Excel(name = "是否是感知事件" , readConverterExp = "0=否,1=是")
@ApiModelProperty("是否是感知事件 0 表示 false,1 表示 true")
private Integer isPerceived;
+
@Excel(name = "影响车道")
@ApiModelProperty("影响车道 车道占用:0-应急1-行1,2-行2,3-行3,4-行4")
private String lang;
diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java
index 2d18296f..ca48c068 100644
--- a/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java
+++ b/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java
@@ -8,6 +8,7 @@ import java.util.Map;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
+import com.ruoyi.system.service.ISysDeptService;
import com.zc.business.domain.*;
import com.zc.business.mapper.*;
import com.zc.business.service.IDcEventService;
@@ -54,6 +55,9 @@ private DcEventAbnormalWeatherMapper dcEventAbnormalWeatherMapper;
private DcProcessConfigMapper dcProcessConfigMapper;
@Autowired
private DcWarningMapper dcWarningMapper;
+ //部门信息
+ @Autowired
+ private ISysDeptService deptService;
@@ -89,6 +93,16 @@ private DcEventAbnormalWeatherMapper dcEventAbnormalWeatherMapper;
String replace1 = dcEvent.getEndStakeMark().replace(" ", "+");
dcEvent.setEndStakeMark(replace1);
}
+ List dcEventList = dcEventMapper.selectDcEventList(dcEvent);
+
+ for (DcEvent dcEvents : dcEventList) {
+ // 根据 deptId 获取部门名称
+ Long deptId = dcEvents.getDeptId();
+ String deptName = deptService.selectDeptById(deptId).getDeptName();
+
+ // 将部门名称赋值给 deptName 字段
+ dcEvents.setDeptName(deptName);
+ }
return dcEventMapper.selectDcEventList(dcEvent);
}
diff --git a/zc-business/src/main/resources/mapper/business/DcEventMapper.xml b/zc-business/src/main/resources/mapper/business/DcEventMapper.xml
index bb4e6d2b..0cfd9128 100644
--- a/zc-business/src/main/resources/mapper/business/DcEventMapper.xml
+++ b/zc-business/src/main/resources/mapper/business/DcEventMapper.xml
@@ -246,7 +246,8 @@
event_source_tips,
occurrence_time,
in_tunnel,
- road_id
+ road_id,
+ lang
FROM
dc_event
LEFT JOIN sys_user on dc_event.user_id = sys_user.user_id