From ff310a4c2545b3384e6c3245bfcc8a1c81ac5f54 Mon Sep 17 00:00:00 2001 From: 15036302109 Date: Mon, 5 Feb 2024 10:12:24 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=8C=E6=94=BF=E6=89=A7=E6=B3=95=E5=8F=B0?= =?UTF-8?q?=E8=B4=A6=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 --- .../ehs/EhsLawEnforcementController.java | 33 +++---------------- .../domain/EhsLawEnforcement.java | 10 +++--- .../service/IEhsLawEnforcementService.java | 2 +- .../impl/EhsLawEnforcementServiceImpl.java | 32 +++++++++--------- 4 files changed, 27 insertions(+), 50 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/ehs/EhsLawEnforcementController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/ehs/EhsLawEnforcementController.java index 161c0ff..756f232 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/ehs/EhsLawEnforcementController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/ehs/EhsLawEnforcementController.java @@ -118,39 +118,16 @@ public class EhsLawEnforcementController extends BaseController { * 下载批量导入模板 */ @PostMapping("/importTemplate") - public void importTemplate(HttpServletResponse response) throws IOException { - List teamWorkerList = new ArrayList<>(); - // 获取企业类别字典数据 - List enterpriseTypeData = dictTypeService.selectDictDataByType("enterprise_category"); - String[] header = - {"单位名称#", - "地址#", - "负责人#", - "联系电话#", - "存在隐患#", - "是否是重大隐患(Y是,N否)#", - "整改措施#", - "整改责任人#", - "企业类别(输入1,2,3..参考企业类别信息sheet)#", - "企业人数#", - "是否建立双预防(Y是,N否)#", - "时间(格式为2023-12-12)#", - "其他#", - "备注#"}; - ExcelExp e1 = new ExcelExp("行政公文台账信息", header, teamWorkerList, EhsLawEnforcement.class); - header = new String[]{"行业值#dictValue", "行业名称#dictLabel"}; - ExcelExp e2 = new ExcelExp("企业类别信息", header, enterpriseTypeData, SysDictData.class); - List mysheet = new ArrayList<>(); - mysheet.add(e1); - mysheet.add(e2); - ExcelExportUtil.exportManySheetExcel("行政公文台账信息批量导入模板", mysheet, response); + public void importTemplate(HttpServletResponse response) throws Exception { + ExcelUtil util = new ExcelUtil<>(EhsLawEnforcement.class); + util.importComboTemplateExcel(response, "行政公文台账信息批量导入模板"); } //批量导入 params是classFirst的值 @PostMapping("/importData") public AjaxResult importHubManage(MultipartFile file, Boolean updateSupport, Long params) throws Exception { - ExcelUtil util = new ExcelUtil<>(LawEnforceImportTemplate.class); - List list = util.importExcel(file.getInputStream()); + ExcelUtil util = new ExcelUtil<>(EhsLawEnforcement.class); + List list = util.importExcel(file.getInputStream()); String message = ehsLawEnforcementService.importData(list, updateSupport, params); return AjaxResult.success(message); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/ehsLawEnforce/domain/EhsLawEnforcement.java b/ruoyi-system/src/main/java/com/ruoyi/ehsLawEnforce/domain/EhsLawEnforcement.java index 09c24bb..39e9cdd 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/ehsLawEnforce/domain/EhsLawEnforcement.java +++ b/ruoyi-system/src/main/java/com/ruoyi/ehsLawEnforce/domain/EhsLawEnforcement.java @@ -67,7 +67,7 @@ public class EhsLawEnforcement extends BaseEntity { /** * 是否重大隐患 */ - @Excel(name = "是否重大隐患") + @Excel(name = "是否重大隐患", dictType = "sys_yes_no") private String isLargeRisk; /** @@ -85,7 +85,7 @@ public class EhsLawEnforcement extends BaseEntity { /** * 企业类别 */ - @Excel(name = "企业类别") + @Excel(name = "企业类别", dictType = "enterprise_category") private Integer enterpriseCategory; /** @@ -97,14 +97,14 @@ public class EhsLawEnforcement extends BaseEntity { /** * 是否建立双预防 */ - @Excel(name = "是否建立双预防") + @Excel(name = "是否建立双预防", dictType = "sys_yes_no") private String isEstablishPrevention; /** * 时间 */ @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "时间", width = 30, dateFormat = "yyyy-MM-dd") + @Excel(name = "时间(yyyy-MM-dd格式)", width = 30, dateFormat = "yyyy-MM-dd") private Date time; /** @@ -116,7 +116,7 @@ public class EhsLawEnforcement extends BaseEntity { /** * 类别 */ - @Excel(name = "类别") + //@Excel(name = "类别") private Long classFirst; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/ehsLawEnforce/service/IEhsLawEnforcementService.java b/ruoyi-system/src/main/java/com/ruoyi/ehsLawEnforce/service/IEhsLawEnforcementService.java index 1cd9a24..c4f8850 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/ehsLawEnforce/service/IEhsLawEnforcementService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/ehsLawEnforce/service/IEhsLawEnforcementService.java @@ -38,5 +38,5 @@ public interface IEhsLawEnforcementService extends IService { * @param params 这里是classFirst的值 * @return */ - public String importData(List list, Boolean updateSupport, Long params) throws Exception; + public String importData(List list, Boolean updateSupport, Long params) throws Exception; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/ehsLawEnforce/service/impl/EhsLawEnforcementServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/ehsLawEnforce/service/impl/EhsLawEnforcementServiceImpl.java index 8687c9a..d99231a 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/ehsLawEnforce/service/impl/EhsLawEnforcementServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/ehsLawEnforce/service/impl/EhsLawEnforcementServiceImpl.java @@ -58,7 +58,7 @@ public class EhsLawEnforcementServiceImpl extends ServiceImpl list, Boolean updateSupport, Long params) throws Exception { + public String importData(List list, Boolean updateSupport, Long params) throws Exception { if (StringUtils.isNull(list) || list.size() == 0) { throw new Exception("导入行政执法台账数据不能为空!"); } @@ -67,7 +67,7 @@ public class EhsLawEnforcementServiceImpl extends ServiceImpl