+
-
-
+ };
+ $.treeTable.init(options);
+ });
+
+
+
\ No newline at end of file
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeEntity.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeEntity.java
index 1e21460..cc91f04 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeEntity.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeEntity.java
@@ -1,5 +1,7 @@
package com.ruoyi.common.core.domain;
+import com.ruoyi.common.annotation.Excel;
+
/**
* Tree基类
*
@@ -13,6 +15,7 @@ public class TreeEntity extends BaseEntity
private String parentName;
/** 父菜单ID */
+ @Excel(name = "父级编号")
private String parentId;
/** 显示顺序 */
diff --git a/ruoyi-system/pom.xml b/ruoyi-system/pom.xml
index bad780f..ec2518b 100644
--- a/ruoyi-system/pom.xml
+++ b/ruoyi-system/pom.xml
@@ -22,6 +22,10 @@
com.ruoyi
ruoyi-common
+
+ org.projectlombok
+ lombok
+
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/BaseMonitorunitInfo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/BaseMonitorunitInfo.java
index 2620911..1e58509 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/BaseMonitorunitInfo.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/BaseMonitorunitInfo.java
@@ -15,6 +15,13 @@ public class BaseMonitorunitInfo extends TreeEntity
{
private static final long serialVersionUID = 1L;
+ public BaseMonitorunitInfo() {
+ }
+
+ public BaseMonitorunitInfo(String monitorunitId) {
+ this.monitorunitId = monitorunitId;
+ }
+
/** 主键标识 */
private Long objId;
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/BaseMonitorunitInfoDto.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/BaseMonitorunitInfoDto.java
new file mode 100644
index 0000000..adca0b2
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/BaseMonitorunitInfoDto.java
@@ -0,0 +1,18 @@
+package com.ruoyi.system.domain.dto;
+
+import com.ruoyi.system.domain.BaseMonitorunitInfo;
+import lombok.Data;
+
+/**
+ * @author WenJY
+ * @date 2022年02月07日 10:12
+ */
+@Data
+public class BaseMonitorunitInfoDto extends BaseMonitorunitInfo {
+
+ private String monitorunitTypeName;
+
+ private String substationName;
+
+ private String parentName;
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/BaseMonitorunitInfoMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/BaseMonitorunitInfoMapper.java
index cdf3ce8..ea21529 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/BaseMonitorunitInfoMapper.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/BaseMonitorunitInfoMapper.java
@@ -2,6 +2,7 @@ package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.BaseMonitorunitInfo;
+import com.ruoyi.system.domain.dto.BaseMonitorunitInfoDto;
/**
* 监控单元信息Mapper接口
@@ -27,6 +28,15 @@ public interface BaseMonitorunitInfoMapper
*/
public List
selectBaseMonitorunitInfoList(BaseMonitorunitInfo baseMonitorunitInfo);
+ /**
+ * 查询监控单元信息列表
+ * @author WenJY
+ * @date 2022/2/7 10:23
+ * @param baseMonitorunitInfo
+ * @return java.util.List
+ */
+ public List selectBaseMonitorunitInfoDtoList(BaseMonitorunitInfo baseMonitorunitInfo);
+
/**
* 新增监控单元信息
*
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/IBaseMonitorunitInfoService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/IBaseMonitorunitInfoService.java
index 9472d61..5d533a0 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/IBaseMonitorunitInfoService.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/IBaseMonitorunitInfoService.java
@@ -3,6 +3,7 @@ package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.BaseMonitorunitInfo;
import com.ruoyi.common.core.domain.Ztree;
+import com.ruoyi.system.domain.dto.BaseMonitorunitInfoDto;
/**
* 监控单元信息Service接口
@@ -28,6 +29,24 @@ public interface IBaseMonitorunitInfoService
*/
public List selectBaseMonitorunitInfoList(BaseMonitorunitInfo baseMonitorunitInfo);
+ /**
+ * 查询监控单元信息列表
+ *
+ * @param baseMonitorunitInfo 监控单元信息
+ * @return 监控单元信息集合
+ */
+ public List selectBaseMonitorunitInfoDtoList(BaseMonitorunitInfo baseMonitorunitInfo);
+
+ /**
+ * 导入监控单元信息
+ * @author WenJY
+ * @date 2022/2/7 9:53
+ * @param baseMonitorunitInfos
+ * @param updateSupport
+ * @return java.lang.String
+ */
+ public String importMould(List baseMonitorunitInfos, boolean updateSupport);
+
/**
* 新增监控单元信息
*
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BaseMonitorunitInfoServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BaseMonitorunitInfoServiceImpl.java
index 4870f90..26f1ff8 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BaseMonitorunitInfoServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BaseMonitorunitInfoServiceImpl.java
@@ -1,9 +1,15 @@
package com.ruoyi.system.service.impl;
+import java.util.Date;
import java.util.List;
import java.util.ArrayList;
import com.ruoyi.common.core.domain.Ztree;
+import com.ruoyi.common.exception.BusinessException;
import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.ShiroUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.system.domain.BaseMonitorunitType;
+import com.ruoyi.system.domain.dto.BaseMonitorunitInfoDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.BaseMonitorunitInfoMapper;
@@ -47,6 +53,74 @@ public class BaseMonitorunitInfoServiceImpl implements IBaseMonitorunitInfoServi
return baseMonitorunitInfoMapper.selectBaseMonitorunitInfoList(baseMonitorunitInfo);
}
+ /**
+ * 查询监控单元信息列表
+ *
+ * @param baseMonitorunitInfo 监控单元信息
+ * @return 监控单元信息
+ */
+ @Override
+ public List selectBaseMonitorunitInfoDtoList(BaseMonitorunitInfo baseMonitorunitInfo)
+ {
+ return baseMonitorunitInfoMapper.selectBaseMonitorunitInfoDtoList(baseMonitorunitInfo);
+ }
+
+ /**
+ * 导入监控单元信息
+ * @author WenJY
+ * @date 2022/2/7 9:53
+ * @param baseMonitorunitInfos
+ * @param updateSupport
+ * @return java.lang.String
+ */
+ @Override
+ public String importMould(List baseMonitorunitInfos, boolean updateSupport) {
+ if (StringUtils.isNull(baseMonitorunitInfos) || baseMonitorunitInfos.size() == 0) {
+ throw new BusinessException("导入标准数据不能为空!");
+ }
+ int successNum = 0;
+ int failureNum = 0;
+ StringBuilder successMsg = new StringBuilder();
+ StringBuilder failureMsg = new StringBuilder();
+ for (BaseMonitorunitInfo baseMonitorunitInfo : baseMonitorunitInfos) {
+ try {
+ List baseMonitorunitInfoList =
+ baseMonitorunitInfoMapper.selectBaseMonitorunitInfoList(new BaseMonitorunitInfo(baseMonitorunitInfo.getMonitorunitId()));
+
+ if (baseMonitorunitInfoList.size() == 0) {
+ baseMonitorunitInfo.setCreateBy(ShiroUtils.getLoginName());
+ baseMonitorunitInfo.setCreateTime(new Date());
+ baseMonitorunitInfoMapper.insertBaseMonitorunitInfo(baseMonitorunitInfo);
+ successNum++;
+ successMsg.append("
" + successNum + "、 " + baseMonitorunitInfo.getMonitorunitName() + " 导入成功");
+ } else if (updateSupport) {
+ for (BaseMonitorunitInfo unitInfo : baseMonitorunitInfoList) {
+ baseMonitorunitInfo.setObjId(unitInfo.getObjId());
+ baseMonitorunitInfo.setUpdateBy(ShiroUtils.getLoginName());
+ baseMonitorunitInfo.setUpdateTime(new Date());
+ baseMonitorunitInfoMapper.updateBaseMonitorunitInfo(baseMonitorunitInfo);
+ successNum++;
+ }
+ successMsg.append("
" + successNum + "、" + baseMonitorunitInfo.getMonitorunitName() + " 更新成功");
+ } else {
+ failureNum++;
+ failureMsg.append("
" + failureNum + "、" + baseMonitorunitInfo.getMonitorunitId() + "、" + baseMonitorunitInfo.getMonitorunitName() + " 已存在");
+ }
+ } catch (Exception e) {
+ failureNum++;
+ String msg = "
" + failureNum + "、标准: " + baseMonitorunitInfo.getMonitorunitId() + "、" + baseMonitorunitInfo.getMonitorunitName() + " 导入失败:";
+ failureMsg.append(msg + e.getMessage());
+ }
+ }
+ if (failureNum > 0) {
+ failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
+ throw new BusinessException(failureMsg.toString());
+ } else {
+ successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
+ }
+ return successMsg.toString();
+ }
+
/**
* 新增监控单元信息
*
diff --git a/ruoyi-system/src/main/resources/mapper/system/BaseMonitorunitInfoMapper.xml b/ruoyi-system/src/main/resources/mapper/system/BaseMonitorunitInfoMapper.xml
index b3a4b3e..9105a28 100644
--- a/ruoyi-system/src/main/resources/mapper/system/BaseMonitorunitInfoMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/BaseMonitorunitInfoMapper.xml
@@ -19,6 +19,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
select ObjId, MonitorUnit_Id, MonitorUnit_Name, Parent_Id, MonitorUnit_Type, Substation_Id, Enable_Flag, Create_By, Create_Time, Update_By, Update_Time from base_monitorunit_info
@@ -36,6 +53,24 @@
order by Parent_Id
+
+