From f8419f24cc0205895b3daf9aa60b6becd26f5f59 Mon Sep 17 00:00:00 2001 From: 15036302109 Date: Mon, 5 Feb 2024 09:28:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BA=94=E6=80=A5=E6=95=91=E6=8F=B4=E7=89=A9?= =?UTF-8?q?=E8=B5=84,=E5=85=AC=E6=96=87=E5=8A=9E=E7=90=86,=E9=98=9F?= =?UTF-8?q?=E4=BC=8D=E7=AE=A1=E7=90=86,=E9=98=9F=E4=BC=8D=E4=BA=BA?= =?UTF-8?q?=E5=91=98=E5=AF=BC=E5=85=A5=E5=AF=BC=E5=87=BA=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ehs/EhsMaterialController.java | 36 +++++++++++++++++++ .../ehs/EhsRescueTeamController.java | 22 +++--------- .../ehs/EhsRescueTeamWorkerController.java | 24 +++---------- .../ruoyi/common/core/domain/BaseEntity.java | 1 + .../ruoyi/ehsDocument/domain/EhsDocument.java | 4 +-- .../ehsRescueTeam/domain/EhsRescueTeam.java | 6 ++-- .../service/IEhsRescueTeamService.java | 2 +- .../impl/EhsRescueTeamServiceImpl.java | 20 +++++------ .../domain/EhsRescueTeamWorker.java | 4 +-- .../service/IEhsRescueTeamWorkerService.java | 2 +- .../impl/EhsRescueTeamWorkerServiceImpl.java | 24 ++++++------- 11 files changed, 78 insertions(+), 67 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/ehs/EhsMaterialController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/ehs/EhsMaterialController.java index cde4ccd..257e76a 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/ehs/EhsMaterialController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/ehs/EhsMaterialController.java @@ -2,9 +2,18 @@ package com.ruoyi.ehsMaterial.controller; import java.util.List; import java.util.Arrays; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; import javax.servlet.http.HttpServletResponse; +import com.ruoyi.common.utils.StringUtils; import com.ruoyi.ehsRisk.domain.EhsRisk; +import com.ruoyi.materialClass.domain.MaterialClassMaster; +import com.ruoyi.materialClass.domain.MaterialClassSub; +import com.ruoyi.materialClass.mapper.MaterialClassSubMapper; +import com.ruoyi.materialClass.service.IMaterialClassMasterService; +import com.ruoyi.materialClass.service.IMaterialClassSubService; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -40,6 +49,10 @@ public class EhsMaterialController extends BaseController { @Autowired private IEhsMaterialService ehsMaterialService; + @Autowired + private IMaterialClassMasterService materialClassMastService; + @Autowired + private IMaterialClassSubService materialClassSubService; /** * 查询物资信息包含 通用应急救援装备”“防汛抗旱应急救援装备”“森林防灭火应急救援装备”“救灾物资”列表 @@ -62,6 +75,29 @@ public class EhsMaterialController extends BaseController public void export(HttpServletResponse response, EhsMaterial ehsMaterial) { List list = ehsMaterialService.selectEhsMaterialList(ehsMaterial); + // 类别替换为中文 + MaterialClassMaster msm = new MaterialClassMaster(); + msm.setClassMastType(ehsMaterial.getClassFirst().toString()); + List materialClassMasters = materialClassMastService.selectMaterialClassMastList(msm); + // 物资分类一级分类对象,对应的是"类别"字段;收集为map,key是 v1,v2,v3... value是"常用工具","个人防护物资和装备"... + Map map1 = materialClassMasters.stream().collect(Collectors.toMap(MaterialClassMaster::getClassMastId, MaterialClassMaster::getClassNameMast)); + // 物资名称替换为中文 + MaterialClassSub mcs = new MaterialClassSub(); + mcs.setClassMastType(ehsMaterial.getClassFirst().toString()); + List mlist = materialClassSubService.selectMaterialClassSubList(mcs); + // 物资分类二级分类对象,对应的是"物资名称"字段;收集为map,key是 v1-1,v1-2,v2-1... value是"卫星电话"... + Map map2 = mlist.stream() + .collect(Collectors.toMap(MaterialClassSub::getClassSubId, MaterialClassSub::getClassNameSub)); + list.stream().forEach((item)->{ + String value = map1.get(item.getClassSecond()); + if (StringUtils.isNotBlank(value)) { + item.setClassSecond(value); + } + String val = map2.get(item.getMaterialName()); + if (StringUtils.isNotBlank(val)) { + item.setMaterialName(val); + } + }); ExcelUtil util = new ExcelUtil(EhsMaterial.class); util.exportExcel(response, list, "物资信息包含 通用应急救援装备”“防汛抗旱应急救援装备”“森林防灭火应急救援装备”“救灾物资”数据"); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/ehs/EhsRescueTeamController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/ehs/EhsRescueTeamController.java index 3329799..af9dc4d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/ehs/EhsRescueTeamController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/ehs/EhsRescueTeamController.java @@ -76,21 +76,9 @@ public class EhsRescueTeamController extends BaseController { * 下载批量导入模板 */ @PostMapping("/importTemplate") - public void importTemplate(HttpServletResponse response) throws IOException { - List ehsRescueTeamList = new ArrayList<>(); - String[] header = - {"队伍名称#", - "队伍级别#", - "负责人#", - "联系电话#", - "所属单位#", - "驻地#", - "队伍属性(0-其他,1-政府,2-企业,3-社会)#", - "备注#"}; - ExcelExp e1 = new ExcelExp("应急救援队伍信息", header, ehsRescueTeamList, EhsRescueTeam.class); - List mysheet = new ArrayList<>(); - mysheet.add(e1); - ExcelExportUtil.exportManySheetExcel("应急救援队伍信息批量导入模板", mysheet, response); + public void importTemplate(HttpServletResponse response) throws Exception { + ExcelUtil util = new ExcelUtil(EhsRescueTeam.class); + util.importComboTemplateExcel(response, "应急救援队伍信息数据"); } /** @@ -98,8 +86,8 @@ public class EhsRescueTeamController extends BaseController { */ @PostMapping("/importData") public AjaxResult importHubManage(MultipartFile file, Boolean updateSupport) throws Exception { - ExcelUtil util = new ExcelUtil<>(RescueTeamImportTemplate.class); - List list = util.importExcel(file.getInputStream()); + ExcelUtil util = new ExcelUtil<>(EhsRescueTeam.class); + List list = util.importExcel(file.getInputStream()); String message = ehsRescueTeamService.importRescueTeam(list, updateSupport); return AjaxResult.success(message); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/ehs/EhsRescueTeamWorkerController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/ehs/EhsRescueTeamWorkerController.java index 0be4cb8..d7be150 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/ehs/EhsRescueTeamWorkerController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/ehs/EhsRescueTeamWorkerController.java @@ -120,23 +120,9 @@ public class EhsRescueTeamWorkerController extends BaseController { * 下载批量导入模板 */ @PostMapping("/importTemplate") - public void importTemplate(HttpServletResponse response) throws IOException { - List teamWorkerList = new ArrayList<>(); - String[] header = - {"人员姓名#", - "年龄#", - "性别(0男 1女)#", - "身份证号#", - "联系方式#", - "队内职务#", - "工作年限#", - "救援技能特长#", - "培训次数#", - "备注#"}; - ExcelExp e1 = new ExcelExp("应急救援队伍人员信息", header, teamWorkerList, EhsRescueTeamWorker.class); - List mysheet = new ArrayList<>(); - mysheet.add(e1); - ExcelExportUtil.exportManySheetExcel("应急救援队伍人员信息批量导入模板", mysheet, response); + public void importTemplate(HttpServletResponse response) throws Exception { + ExcelUtil util = new ExcelUtil<>(EhsRescueTeamWorker.class); + util.importComboTemplateExcel(response, "应急救援队伍人员信息"); } @@ -145,8 +131,8 @@ public class EhsRescueTeamWorkerController extends BaseController { */ @PostMapping("/importData") public AjaxResult importData(MultipartFile file, Boolean updateSupport, Long params) throws Exception { - ExcelUtil util = new ExcelUtil<>(RescueTeamWorkerImportTemplate.class); - List list = util.importExcel(file.getInputStream()); + ExcelUtil util = new ExcelUtil<>(EhsRescueTeamWorker.class); + List list = util.importExcel(file.getInputStream()); String message = ehsRescueTeamWorkerService.importRescueTeamWorker(list, updateSupport, params); return AjaxResult.success(message); } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java index d0fe9be..a93ea3f 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java @@ -57,6 +57,7 @@ public class BaseEntity implements Serializable private Date updateTime; /** 备注 */ + @Excel(name = "备注") private String remark; /** 请求参数 */ diff --git a/ruoyi-system/src/main/java/com/ruoyi/ehsDocument/domain/EhsDocument.java b/ruoyi-system/src/main/java/com/ruoyi/ehsDocument/domain/EhsDocument.java index ba9f58a..fa6f21e 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/ehsDocument/domain/EhsDocument.java +++ b/ruoyi-system/src/main/java/com/ruoyi/ehsDocument/domain/EhsDocument.java @@ -55,7 +55,7 @@ public class EhsDocument extends BaseEntity { /** * 公文类型 */ - @Excel(name = "公文类型") + @Excel(name = "公文类型", dictType = "doc_type") private Integer docType; /** @@ -74,6 +74,6 @@ public class EhsDocument extends BaseEntity { /** * 状态 */ - @Excel(name = "状态") + @Excel(name = "状态", dictType = "doc_status") private Integer status; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/ehsRescueTeam/domain/EhsRescueTeam.java b/ruoyi-system/src/main/java/com/ruoyi/ehsRescueTeam/domain/EhsRescueTeam.java index fe5ef06..128abb2 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/ehsRescueTeam/domain/EhsRescueTeam.java +++ b/ruoyi-system/src/main/java/com/ruoyi/ehsRescueTeam/domain/EhsRescueTeam.java @@ -70,13 +70,13 @@ public class EhsRescueTeam extends BaseEntity { /** * 队伍属性 */ - @Excel(name = "队伍属性(0-其他,1-政府,2-企业,3-社会)") - private Integer teamProperty; + @Excel(name = "队伍属性", dictType = "team_property") + private Long teamProperty; /** * 救援人员数量 */ - @Excel(name = "救援人员数量") + @Excel(name = "救援人员数量", type = Excel.Type.EXPORT) @TableField(exist = false) private Long rescueWorkerNum; diff --git a/ruoyi-system/src/main/java/com/ruoyi/ehsRescueTeam/service/IEhsRescueTeamService.java b/ruoyi-system/src/main/java/com/ruoyi/ehsRescueTeam/service/IEhsRescueTeamService.java index 02887e5..f23e09f 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/ehsRescueTeam/service/IEhsRescueTeamService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/ehsRescueTeam/service/IEhsRescueTeamService.java @@ -37,7 +37,7 @@ public interface IEhsRescueTeamService extends IService { * @param updateSupport * @return */ - public String importRescueTeam(List list, Boolean updateSupport) throws Exception; + public String importRescueTeam(List list, Boolean updateSupport) throws Exception; /** * 应急救援:根据队伍id获取队伍信息 diff --git a/ruoyi-system/src/main/java/com/ruoyi/ehsRescueTeam/service/impl/EhsRescueTeamServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/ehsRescueTeam/service/impl/EhsRescueTeamServiceImpl.java index 4e2f25a..45307c0 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/ehsRescueTeam/service/impl/EhsRescueTeamServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/ehsRescueTeam/service/impl/EhsRescueTeamServiceImpl.java @@ -83,7 +83,7 @@ public class EhsRescueTeamServiceImpl extends ServiceImpl list, Boolean updateSupport) throws Exception { + public String importRescueTeam(List list, Boolean updateSupport) throws Exception { if (StringUtils.isNull(list) || list.size() == 0) { throw new Exception("导入救援队伍信息数据不能为空!"); } @@ -92,7 +92,7 @@ public class EhsRescueTeamServiceImpl extends ServiceImpl teamIds); // 批量导入数据 - public String importRescueTeamWorker(List list, Boolean updateSupport, Long params) throws Exception; + public String importRescueTeamWorker(List list, Boolean updateSupport, Long params) throws Exception; // 根据teamId更新应急救援人员信息 public boolean updateWorkerByTeamId(EhsRescueTeam ehsRescueTeam); diff --git a/ruoyi-system/src/main/java/com/ruoyi/ehsRescueTeamWorker/service/impl/EhsRescueTeamWorkerServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/ehsRescueTeamWorker/service/impl/EhsRescueTeamWorkerServiceImpl.java index ed3fde9..b880611 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/ehsRescueTeamWorker/service/impl/EhsRescueTeamWorkerServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/ehsRescueTeamWorker/service/impl/EhsRescueTeamWorkerServiceImpl.java @@ -69,7 +69,7 @@ public class EhsRescueTeamWorkerServiceImpl extends ServiceImpl list, Boolean updateSupport, Long params) throws Exception { + public String importRescueTeamWorker(List list, Boolean updateSupport, Long params) throws Exception { if (StringUtils.isNull(list) || list.size() == 0) { throw new Exception("导入应急救援队伍人员信息数据不能为空!"); } @@ -78,7 +78,7 @@ public class EhsRescueTeamWorkerServiceImpl extends ServiceImpl