From e2380fc99bb36cadfa8e2b5c22fcf17310a8dbfd Mon Sep 17 00:00:00 2001
From: songhuangfeng123 <shf18767906695@163.com>
Date: 星期四, 28 七月 2022 16:18:27 +0800
Subject: [PATCH] 覆盖fix
---
incident-manage/incident-manage-service/src/main/resources/config/mapper/incidentManage/AccidentReportInfoMapper.xml | 2
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/KeypointEquipmentInfoController.java | 139 ++++++++++++-
goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/service/impl/RewardPunishmentDetailServiceImpl.java | 6
goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/controller/RewardPunishmentDetailController.java | 62 +++++
goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/repository/RewardPunishmentDetailRepository.java | 7
goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/utils/poihelper/ExcelUtil.java | 8
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/EquipmentInfoController.java | 190 ++++++++++++++++++
goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/controller/RewardPunishmentStandardController.java | 117 ++++++++++-
goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/entity/BaseDomain.java | 11
goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/utils/QueryHelpPlus.java | 4
goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/service/RewardPunishmentDetailService.java | 1
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/BaseDomain.java | 11
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/utils/QueryHelpPlus.java | 4
13 files changed, 509 insertions(+), 53 deletions(-)
diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/EquipmentInfoController.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/EquipmentInfoController.java
index 8b9a9e1..23f46ee 100644
--- a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/EquipmentInfoController.java
+++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/EquipmentInfoController.java
@@ -1,26 +1,38 @@
package com.gkhy.safePlatform.equipment.controller;
import com.alibaba.fastjson.JSONObject;
+import com.gkhy.safePlatform.commons.utils.BeanCopyUtils;
import com.gkhy.safePlatform.equipment.entity.*;
+import com.gkhy.safePlatform.equipment.model.dto.req.EquipmentInfoImportExcel;
import com.gkhy.safePlatform.equipment.model.dto.req.EquipmentInfoSaveOrUpdate;
+import com.gkhy.safePlatform.equipment.model.dto.resp.EquipmentInfoExcel;
+import com.gkhy.safePlatform.equipment.utils.DateUtils;
+import com.gkhy.safePlatform.equipment.utils.poihelper.ExcelLogs;
+import com.gkhy.safePlatform.equipment.utils.poihelper.ExcelUtil;
import com.google.common.collect.Lists;
+
+import java.io.IOException;
+import java.net.URLEncoder;
import java.sql.Timestamp;
import com.gkhy.safePlatform.equipment.model.dto.resp.EquipmentInfoDto;
import com.gkhy.safePlatform.equipment.service.EquipmentInfoService;
+import org.apache.commons.collections.CollectionUtils;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.gkhy.safePlatform.commons.query.PageQuery;
import com.gkhy.safePlatform.commons.utils.PageUtils;
import com.gkhy.safePlatform.commons.vo.ResultVO;
import com.gkhy.safePlatform.commons.enums.ResultCodes;
import com.gkhy.safePlatform.equipment.model.dto.req.EquipmentInfoQueryCriteria;
+import org.springframework.web.multipart.MultipartFile;
-import java.util.ArrayList;
-import java.util.Arrays;
+import java.util.*;
import java.util.stream.Collectors;
import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import java.io.Serializable;
-import java.util.List;
/**
* 设备设施详细信息(EquipmentInfo)表控制层
@@ -36,6 +48,12 @@
*/
@Resource
private EquipmentInfoService equipmentInfoService;
+
+ @Autowired
+ public HttpServletRequest request;
+
+ @Autowired
+ public HttpServletResponse response;
/**
* 分页查询所有数据
@@ -109,6 +127,172 @@
return new ResultVO<>(ResultCodes.OK,this.equipmentInfoService.statistics());
}
+
+
+
+ /**
+ * 下载模板
+ *
+ */
+ @GetMapping(value = "/exportTemplate")
+ public void exportTemplate() throws IOException {
+ Map<String,String> map = new LinkedHashMap<>();
+ map.put("1", "类型/类别外键");
+ map.put("2", "具体类型(页面左侧的导航栏使用) 0:仪器仪表信息 1:生产设备设施 2:安全设备设施 ");
+ map.put("3", "名称");
+ map.put("4", "位号");
+ map.put("5", "用途");
+ map.put("6", "型号");
+ map.put("7", "单位部门外键");
+ map.put("8", "设置部位");
+ map.put("9", "生产日期(yyyy-MM-dd HH:mm:ss)");
+ map.put("10", "使用期限(天)");
+ map.put("11", "生命周期 1:已使用 2:库存中 3:报废");
+ map.put("12", "投用日期(yyyy-MM-dd HH:mm:ss)");
+ map.put("13", "维修状态 1:维修中 2:已修好");
+ map.put("14", "停用状态 1:停用 2.在用 3.维修 4.报废");
+ map.put("15", "上次检查日期(yyyy-MM-dd HH:mm:ss)");
+ map.put("16", "上次检测日期(yyyy-MM-dd HH:mm:ss)");
+ map.put("17", "上次保养日期(yyyy-MM-dd HH:mm:ss)");
+ map.put("18", "下次检查日期(yyyy-MM-dd HH:mm:ss)");
+ map.put("19", "下次检测日期(yyyy-MM-dd HH:mm:ss)");
+ map.put("20", "下次保养日期(yyyy-MM-dd HH:mm:ss)");
+ map.put("21", "负责人ID外键");
+ map.put("22", "负责人部门外键");
+ map.put("23", "供应商");
+ map.put("24", "使用说明");
+ map.put("25", "是否检查 1:是 2:否");
+ map.put("26", "检查周期");
+ map.put("27", "检查提前提醒");
+ map.put("28", "是否检测 1:是 2:否");
+ map.put("29", "检测周期");
+ map.put("30", "检测提前提醒");
+ map.put("31", "是否保养 1:是 2:否");
+ map.put("32", "检查内容");
+ map.put("33", "负责部门/外键");
+ map.put("34", "检查指标");
+ map.put("35", "预警值");
+ map.put("36", "联锁值");
+ map.put("37", "停用理由");
+ map.put("38", "停用后措施");
+ map.put("39", "实际停用日期(yyyy-MM-dd HH:mm:ss)");
+ map.put("40", "停用提交人/外键");
+ map.put("41", "停用提交日期(yyyy-MM-dd HH:mm:ss)");
+ map.put("42", "恢复理由");
+ map.put("43", "恢复填报日期(yyyy-MM-dd HH:mm:ss)");
+ map.put("44", "实际恢复日期(yyyy-MM-dd HH:mm:ss)");
+ map.put("45", "报废理由");
+ map.put("46", "报废填报日期(yyyy-MM-dd HH:mm:ss)");
+ map.put("47", "实际报废日期(yyyy-MM-dd HH:mm:ss)");
+ String fileName = URLEncoder.encode("设备设施管理数据导入模板.xls", "UTF-8");
+ response.setContentType("application/vnd.ms-excel");
+ response.setHeader("Content-Disposition", "attachment;filename=" + fileName + ".xlsx");
+ response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
+
+ ExcelUtil.exportExcel(map,new ArrayList<>() , response.getOutputStream());
+ response.getOutputStream().close();
+ }
+
+
+ /**
+ * 导入数据
+ *
+ */
+ @RequestMapping(value = "/importData")
+ public ResultVO importData(MultipartFile file) throws IOException {
+ String contentType = file.getContentType();
+ if(!"application/vnd.ms-excel".equals(contentType)
+ && !"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet".equals(contentType)) {
+ return new ResultVO<>(ResultCodes.CLIENT_PARAM_ILLEGAL, "上传的excel格式错误");
+ }
+
+ Collection<EquipmentInfoImportExcel> importExcel = ExcelUtil.importExcel(EquipmentInfoImportExcel.class, file.getInputStream(), "yyyy-MM-dd HH:mm:ss", new ExcelLogs() , 0);
+
+ if (CollectionUtils.isEmpty(importExcel)) {
+ return new ResultVO<>(ResultCodes.OK);
+ }
+
+ List<EquipmentInfo> respList = BeanCopyUtils.copyBeanList((List<EquipmentInfoImportExcel>)importExcel, EquipmentInfo.class);
+
+ equipmentInfoService.saveBatch(respList);
+ return new ResultVO<>(ResultCodes.OK);
+ }
+
+
+
+
+ /**
+ * 导出一览数据
+ *
+ */
+ @GetMapping(value = "/exportData")
+ public void exportData(EquipmentInfoQueryCriteria queryCriteria) throws IOException {
+ Map<String,String> map = new LinkedHashMap<>();
+ map.put("0", "ID");
+ map.put("1", "类型/类别外键");
+ map.put("2", "具体类型(页面左侧的导航栏使用) 0:仪器仪表信息 1:生产设备设施 2:安全设备设施 ");
+ map.put("3", "名称");
+ map.put("4", "位号");
+ map.put("5", "用途");
+ map.put("6", "型号");
+ map.put("7", "单位部门外键");
+ map.put("8", "设置部位");
+ map.put("9", "生产日期(yyyy-MM-dd HH:mm:ss)");
+ map.put("10", "使用期限(天)");
+ map.put("11", "生命周期 1:已使用 2:库存中 3:报废");
+ map.put("12", "投用日期(yyyy-MM-dd HH:mm:ss)");
+ map.put("13", "维修状态 1:维修中 2:已修好");
+ map.put("14", "停用状态 1:停用 2.在用 3.维修 4.报废");
+ map.put("15", "上次检查日期(yyyy-MM-dd HH:mm:ss)");
+ map.put("16", "上次检测日期(yyyy-MM-dd HH:mm:ss)");
+ map.put("17", "上次保养日期(yyyy-MM-dd HH:mm:ss)");
+ map.put("18", "下次检查日期(yyyy-MM-dd HH:mm:ss)");
+ map.put("19", "下次检测日期(yyyy-MM-dd HH:mm:ss)");
+ map.put("20", "下次保养日期(yyyy-MM-dd HH:mm:ss)");
+ map.put("21", "负责人ID外键");
+ map.put("22", "负责人部门外键");
+ map.put("23", "供应商");
+ map.put("24", "使用说明");
+ map.put("25", "是否检查 1:是 2:否");
+ map.put("26", "检查周期");
+ map.put("27", "检查提前提醒");
+ map.put("28", "是否检测 1:是 2:否");
+ map.put("29", "检测周期");
+ map.put("30", "检测提前提醒");
+ map.put("31", "是否保养 1:是 2:否");
+ map.put("32", "检查内容");
+ map.put("33", "负责部门/外键");
+ map.put("34", "检查指标");
+ map.put("35", "预警值");
+ map.put("36", "联锁值");
+ map.put("37", "停用理由");
+ map.put("38", "停用后措施");
+ map.put("39", "实际停用日期(yyyy-MM-dd HH:mm:ss)");
+ map.put("40", "停用提交人/外键");
+ map.put("41", "停用提交日期(yyyy-MM-dd HH:mm:ss)");
+ map.put("42", "恢复理由");
+ map.put("43", "恢复填报日期(yyyy-MM-dd HH:mm:ss)");
+ map.put("44", "实际恢复日期(yyyy-MM-dd HH:mm:ss)");
+ map.put("45", "报废理由");
+ map.put("46", "报废填报日期(yyyy-MM-dd HH:mm:ss)");
+ map.put("47", "实际报废日期(yyyy-MM-dd HH:mm:ss)");
+
+ String key = DateUtils.date2String(new Date(), DateUtils.PATTERN_ALLTIME_NOSIGN) ;
+ String fileName = URLEncoder.encode("设备设施管理"+key+".xls", "UTF-8");
+ response.setContentType("application/vnd.ms-excel");
+ response.setHeader("Content-Disposition", "attachment;filename=" + fileName + ".xlsx");
+ response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
+
+
+ List<EquipmentInfoExcel> respList = BeanCopyUtils.copyBeanList(equipmentInfoService.queryAll(queryCriteria), EquipmentInfoExcel.class);
+
+ ExcelUtil.exportExcel(map,respList , response.getOutputStream(),DateUtils.PATTERN_STANDARD);
+ response.getOutputStream().close();
+ }
+
+
+
+
public static void main(String[] args) {
EquipmentInfoDto infoDto = new EquipmentInfoDto();
List<EquipmentRepairDetail> repairDetails = Lists.newArrayList();
diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/KeypointEquipmentInfoController.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/KeypointEquipmentInfoController.java
index b3b561c..5a967a1 100644
--- a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/KeypointEquipmentInfoController.java
+++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/KeypointEquipmentInfoController.java
@@ -2,24 +2,35 @@
import com.alibaba.fastjson.JSONObject;
-import com.gkhy.safePlatform.equipment.entity.*;
-import com.gkhy.safePlatform.equipment.model.dto.resp.KeypointEquipmentInfoDto;
-import com.gkhy.safePlatform.equipment.service.KeypointEquipmentInfoService;
-import com.google.common.collect.Lists;
-import org.springframework.web.bind.annotation.*;
+import com.gkhy.safePlatform.commons.enums.ResultCodes;
import com.gkhy.safePlatform.commons.query.PageQuery;
+import com.gkhy.safePlatform.commons.utils.BeanCopyUtils;
import com.gkhy.safePlatform.commons.utils.PageUtils;
import com.gkhy.safePlatform.commons.vo.ResultVO;
-import com.gkhy.safePlatform.commons.enums.ResultCodes;
+import com.gkhy.safePlatform.equipment.entity.*;
+import com.gkhy.safePlatform.equipment.model.dto.req.KeypointEquipmentInfoImportExcel;
import com.gkhy.safePlatform.equipment.model.dto.req.KeypointEquipmentInfoQueryCriteria;
+import com.gkhy.safePlatform.equipment.model.dto.resp.KeypointEquipmentInfoDto;
+import com.gkhy.safePlatform.equipment.model.dto.resp.KeypointEquipmentInfoExcel;
+import com.gkhy.safePlatform.equipment.service.KeypointEquipmentInfoService;
+import com.gkhy.safePlatform.equipment.utils.DateUtils;
+import com.gkhy.safePlatform.equipment.utils.poihelper.ExcelLogs;
+import com.gkhy.safePlatform.equipment.utils.poihelper.ExcelUtil;
+import com.google.common.collect.Lists;
+import org.apache.commons.collections.CollectionUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.stream.Collectors;
import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
import java.io.Serializable;
-import java.util.List;
+import java.net.URLEncoder;
+import java.sql.Timestamp;
+import java.util.*;
+import java.util.stream.Collectors;
/**
* 重点监管装置/设备 详细信息(KeypointEquipmentInfo)表控制层
@@ -35,6 +46,13 @@
*/
@Resource
private KeypointEquipmentInfoService keypointEquipmentInfoService;
+
+
+ @Autowired
+ public HttpServletRequest request;
+
+ @Autowired
+ public HttpServletResponse response;
/**
* 分页查询所有数据
@@ -91,6 +109,105 @@
}
+ /**
+ * 下载模板
+ *
+ */
+ @GetMapping(value = "/exportTemplate")
+ public void exportTemplate() throws IOException {
+ Map<String,String> map = new LinkedHashMap<>();
+ map.put("1","类型/类别外键 ");
+ map.put("2","装置/部位名称");
+ map.put("3","所属单位部门/外键");
+ map.put("4","具体位置");
+ map.put("5","负责人姓名");
+ map.put("6","联系人/外键");
+ map.put("7","录入人/外键");
+ map.put("8","责任人/外键");
+ map.put("9","装置部位分类 1:关键装置 2:重点部位");
+ map.put("10","检查周期");
+ map.put("11","应急预案/外键");
+ map.put("12","主要危险有害因素");
+ map.put("13","易导致风险");
+ map.put("14","应急处置措施");
+ map.put("15","现场图片地址路径");
+
+
+ String fileName = URLEncoder.encode("重点监管装置设备数据导入模板.xls", "UTF-8");
+ response.setContentType("application/vnd.ms-excel");
+ response.setHeader("Content-Disposition", "attachment;filename=" + fileName + ".xlsx");
+ response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
+
+ ExcelUtil.exportExcel(map,new ArrayList<>() , response.getOutputStream());
+ response.getOutputStream().close();
+ }
+
+
+ /**
+ * 导入数据
+ *
+ */
+ @RequestMapping(value = "/importData")
+ public ResultVO importData(MultipartFile file) throws IOException {
+ String contentType = file.getContentType();
+ if(!"application/vnd.ms-excel".equals(contentType)
+ && !"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet".equals(contentType)) {
+ return new ResultVO<>(ResultCodes.CLIENT_PARAM_ILLEGAL, "上传的excel格式错误");
+ }
+
+ Collection<KeypointEquipmentInfoImportExcel> importExcel = ExcelUtil.importExcel(KeypointEquipmentInfoImportExcel.class, file.getInputStream(), "yyyy-MM-dd HH:mm:ss", new ExcelLogs() , 0);
+
+ if (CollectionUtils.isEmpty(importExcel)) {
+ return new ResultVO<>(ResultCodes.OK);
+ }
+
+ List<KeypointEquipmentInfo> respList = BeanCopyUtils.copyBeanList((List<KeypointEquipmentInfoImportExcel>)importExcel, KeypointEquipmentInfo.class);
+
+ keypointEquipmentInfoService.saveBatch(respList);
+ return new ResultVO<>(ResultCodes.OK);
+ }
+
+
+
+
+ /**
+ * 导出一览数据
+ *
+ */
+ @GetMapping(value = "/exportData")
+ public void exportData(KeypointEquipmentInfoQueryCriteria queryCriteria) throws IOException {
+ Map<String,String> map = new LinkedHashMap<>();
+ map.put("0","ID");
+ map.put("1","类型/类别外键");
+ map.put("2","装置/部位名称");
+ map.put("3","所属单位部门/外键");
+ map.put("4","具体位置");
+ map.put("5","负责人姓名");
+ map.put("6","联系人/外键");
+ map.put("7","录入人/外键");
+ map.put("8","责任人/外键");
+ map.put("9","装置部位分类 1:关键装置 2:重点部位");
+ map.put("10","检查周期");
+ map.put("11","应急预案/外键");
+ map.put("12","主要危险有害因素");
+ map.put("13","易导致风险");
+ map.put("14","应急处置措施");
+ map.put("15","现场图片地址路径");
+
+ String key = DateUtils.date2String(new Date(), DateUtils.PATTERN_ALLTIME_NOSIGN) ;
+ String fileName = URLEncoder.encode("重点监管装置设备"+key+".xls", "UTF-8");
+ response.setContentType("application/vnd.ms-excel");
+ response.setHeader("Content-Disposition", "attachment;filename=" + fileName + ".xlsx");
+ response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
+
+
+ List<KeypointEquipmentInfoExcel> respList = BeanCopyUtils.copyBeanList(keypointEquipmentInfoService.queryAll(queryCriteria), KeypointEquipmentInfoExcel.class);
+
+ ExcelUtil.exportExcel(map,respList , response.getOutputStream(),DateUtils.PATTERN_STANDARD);
+ response.getOutputStream().close();
+ }
+
+
public static void main(String[] args) {
KeypointEquipmentInfoDto infoDto = new KeypointEquipmentInfoDto();
diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/BaseDomain.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/BaseDomain.java
index 3640c29..924c582 100644
--- a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/BaseDomain.java
+++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/BaseDomain.java
@@ -24,9 +24,10 @@
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateTime;
- public static long getSerialVersionUID() {
- return serialVersionUID;
- }
+// @TableLogic
+// @JsonIgnore
+// private Integer isDel;
+
public Date getCreateTime() {
return createTime;
@@ -43,8 +44,4 @@
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
-
- // @TableLogic
-// @JsonIgnore
-// private Integer isDel;
}
diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/utils/QueryHelpPlus.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/utils/QueryHelpPlus.java
index fe4fff7..24d51fc 100644
--- a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/utils/QueryHelpPlus.java
+++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/utils/QueryHelpPlus.java
@@ -6,8 +6,8 @@
*/
package com.gkhy.safePlatform.equipment.utils;
-import com.alibaba.nacos.common.utils.CollectionUtils;
-import com.alibaba.nacos.common.utils.StringUtils;
+import org.apache.commons.collections.CollectionUtils;
+import org.springframework.util.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.gkhy.safePlatform.equipment.annotation.Query;
diff --git a/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/controller/RewardPunishmentDetailController.java b/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/controller/RewardPunishmentDetailController.java
index 7c91f6a..8b63da6 100644
--- a/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/controller/RewardPunishmentDetailController.java
+++ b/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/controller/RewardPunishmentDetailController.java
@@ -5,8 +5,14 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.gkhy.safePlatform.commons.utils.BeanCopyUtils;
import com.gkhy.safePlatform.targetDuty.entity.RewardPunishmentDetail;
+import com.gkhy.safePlatform.targetDuty.model.dto.resp.ExamineTemplateDto;
+import com.gkhy.safePlatform.targetDuty.model.dto.resp.RewardPunishmentDetailExcel;
import com.gkhy.safePlatform.targetDuty.service.RewardPunishmentDetailService;
+import com.gkhy.safePlatform.targetDuty.utils.DateUtils;
+import com.gkhy.safePlatform.targetDuty.utils.poihelper.ExcelUtil;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.gkhy.safePlatform.commons.query.PageQuery;
import com.gkhy.safePlatform.commons.utils.PageUtils;
@@ -14,11 +20,14 @@
import com.gkhy.safePlatform.commons.enums.ResultCodes;
import com.gkhy.safePlatform.targetDuty.model.dto.req.RewardPunishmentDetailQueryCriteria;
-import java.util.Arrays;
+import java.io.IOException;
+import java.net.URLEncoder;
+import java.util.*;
import java.util.stream.Collectors;
import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import java.io.Serializable;
-import java.util.List;
/**
* 奖惩记录(RewardPunishmentDetail)表控制层
@@ -34,6 +43,12 @@
*/
@Resource
private RewardPunishmentDetailService rewardPunishmentDetailService;
+
+ @Autowired
+ public HttpServletRequest request;
+
+ @Autowired
+ public HttpServletResponse response;
/**
* 分页查询所有数据
@@ -73,10 +88,20 @@
if(rewardPunishmentDetail.getRewardPunishmentStandardId() == null){
return new ResultVO<>(ResultCodes.CLIENT_PARAM_ILLEGAL,"缺少rewardPunishmentStandardId");
}
+
+ List<Long> pIdList = Arrays.stream(rewardPunishmentDetail.getPersonId().split(",")).map(s-> Long.parseLong(s.trim()))
+ .collect(Collectors.toList());
+
+ List<RewardPunishmentDetail> list = new ArrayList<>();
+ pIdList.forEach(f->{
+ RewardPunishmentDetail new1 = BeanCopyUtils.copyBean(rewardPunishmentDetail, RewardPunishmentDetail.class);
+ new1.setPersonId(f+"");
+ list.add(new1);
+ });
if (rewardPunishmentDetail.getId() == null) {
- return new ResultVO<>(ResultCodes.OK,rewardPunishmentDetailService.save(rewardPunishmentDetail));
+ return new ResultVO<>(ResultCodes.OK,rewardPunishmentDetailService.saveBatch(list));
} else {
- rewardPunishmentDetailService.update(rewardPunishmentDetail,new UpdateWrapper<RewardPunishmentDetail>().eq("id",rewardPunishmentDetail.getId()));
+ rewardPunishmentDetailService.updateBatchById(list);
return new ResultVO<>(ResultCodes.OK);
}
}
@@ -94,4 +119,33 @@
this.rewardPunishmentDetailService.removeByIds(idList);
return new ResultVO<>(ResultCodes.OK);
}
+
+
+
+ /**
+ * 导出一览数据
+ *
+ */
+ @GetMapping(value = "/exportData")
+ public void exportData(RewardPunishmentDetailQueryCriteria queryCriteria) throws IOException {
+ Map<String,String> map = new LinkedHashMap<>();
+ map.put("1","奖惩日期");
+ map.put("2","奖惩类型");
+ map.put("3","被奖惩者");
+ map.put("4","奖惩内容");
+ map.put("5","奖惩依据");
+
+ String key = DateUtils.date2String(new Date(), DateUtils.PATTERN_ALLTIME_NOSIGN) ;
+ String fileName = URLEncoder.encode("奖惩记录"+key+".xls", "UTF-8");
+ response.setContentType("application/vnd.ms-excel");
+ response.setHeader("Content-Disposition", "attachment;filename=" + fileName + ".xlsx");
+ response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
+
+
+ List<RewardPunishmentDetailExcel> respList = BeanCopyUtils.copyBeanList(rewardPunishmentDetailService.queryAllRelation(queryCriteria), RewardPunishmentDetailExcel.class);
+
+ ExcelUtil.exportExcel(map,respList , response.getOutputStream(),DateUtils.PATTERN_STANDARD);
+ response.getOutputStream().close();
+ }
+
}
\ No newline at end of file
diff --git a/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/controller/RewardPunishmentStandardController.java b/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/controller/RewardPunishmentStandardController.java
index 48b7899..dedb75f 100644
--- a/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/controller/RewardPunishmentStandardController.java
+++ b/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/controller/RewardPunishmentStandardController.java
@@ -1,29 +1,34 @@
package com.gkhy.safePlatform.targetDuty.controller;
-import java.util.Date;
-
-
import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.gkhy.safePlatform.targetDuty.entity.RewardPunishmentStandard;
-import com.gkhy.safePlatform.targetDuty.entity.TargetMng;
-import com.gkhy.safePlatform.targetDuty.service.RewardPunishmentStandardService;
-import org.springframework.util.StringUtils;
-import org.springframework.web.bind.annotation.*;
+import com.gkhy.safePlatform.commons.enums.ResultCodes;
import com.gkhy.safePlatform.commons.query.PageQuery;
+import com.gkhy.safePlatform.commons.utils.BeanCopyUtils;
import com.gkhy.safePlatform.commons.utils.PageUtils;
import com.gkhy.safePlatform.commons.vo.ResultVO;
-import com.gkhy.safePlatform.commons.enums.ResultCodes;
+import com.gkhy.safePlatform.targetDuty.entity.RewardPunishmentStandard;
+import com.gkhy.safePlatform.targetDuty.model.dto.req.RewardPunishmentStandardImportExcel;
import com.gkhy.safePlatform.targetDuty.model.dto.req.RewardPunishmentStandardQueryCriteria;
+import com.gkhy.safePlatform.targetDuty.model.dto.resp.RewardPunishmentStandardExcel;
+import com.gkhy.safePlatform.targetDuty.service.RewardPunishmentStandardService;
+import com.gkhy.safePlatform.targetDuty.utils.DateUtils;
+import com.gkhy.safePlatform.targetDuty.utils.poihelper.ExcelLogs;
+import com.gkhy.safePlatform.targetDuty.utils.poihelper.ExcelUtil;
+import org.apache.commons.collections.CollectionUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
-import java.sql.Timestamp;
-import java.util.Arrays;
-import java.util.stream.Collectors;
import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
import java.io.Serializable;
-import java.util.List;
+import java.net.URLEncoder;
+import java.util.*;
+import java.util.stream.Collectors;
/**
* (RewardPunishmentStandard)表控制层
@@ -39,6 +44,12 @@
*/
@Resource
private RewardPunishmentStandardService rewardPunishmentStandardService;
+
+ @Autowired
+ public HttpServletRequest request;
+
+ @Autowired
+ public HttpServletResponse response;
/**
* 分页查询所有数据
@@ -101,6 +112,82 @@
}
+
+
+ /**
+ * 下载模板
+ *
+ */
+ @GetMapping(value = "/exportTemplate")
+ public void exportTemplate() throws IOException {
+ Map<String,String> map = new LinkedHashMap<>();
+ map.put("1","奖惩名称");
+ map.put("2","奖惩类型 1:奖励 2:惩罚");
+ map.put("3","奖惩内容");
+ map.put("4","依据");
+ map.put("5","备注");
+
+ String fileName = URLEncoder.encode("奖惩标准设定数据导入模板.xls", "UTF-8");
+ response.setContentType("application/vnd.ms-excel");
+ response.setHeader("Content-Disposition", "attachment;filename=" + fileName + ".xlsx");
+ response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
+
+ ExcelUtil.exportExcel(map,new ArrayList<>() , response.getOutputStream());
+ response.getOutputStream().close();
+ }
+
+ /**
+ * 导出一览数据
+ *
+ */
+ @GetMapping(value = "/exportData")
+ public void exportData(RewardPunishmentStandardQueryCriteria queryCriteria) throws IOException {
+ Map<String,String> map = new LinkedHashMap<>();
+ map.put("1","奖惩名称");
+ map.put("2","奖惩类型");
+ map.put("3","奖惩内容");
+ map.put("4","依据");
+ map.put("5","备注");
+
+ String key = DateUtils.date2String(new Date(), DateUtils.PATTERN_ALLTIME_NOSIGN) ;
+ String fileName = URLEncoder.encode("奖惩标准设定"+key+".xls", "UTF-8");
+ response.setContentType("application/vnd.ms-excel");
+ response.setHeader("Content-Disposition", "attachment;filename=" + fileName + ".xlsx");
+ response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
+
+
+ List<RewardPunishmentStandardExcel> respList = BeanCopyUtils.copyBeanList(rewardPunishmentStandardService.queryAll(queryCriteria), RewardPunishmentStandardExcel.class);
+
+ ExcelUtil.exportExcel(map,respList , response.getOutputStream(),DateUtils.PATTERN_STANDARD);
+ response.getOutputStream().close();
+ }
+
+ /**
+ * 导入数据
+ *
+ */
+ @RequestMapping(value = "/importData")
+ public ResultVO importData(MultipartFile file) throws IOException {
+ String contentType = file.getContentType();
+ if(!"application/vnd.ms-excel".equals(contentType)
+ && !"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet".equals(contentType)) {
+ return new ResultVO<>(ResultCodes.CLIENT_PARAM_ILLEGAL, "上传的excel格式错误");
+ }
+
+ Collection<RewardPunishmentStandardImportExcel> importExcel = ExcelUtil.importExcel(RewardPunishmentStandardImportExcel.class, file.getInputStream(), "yyyy-MM-dd HH:mm:ss", new ExcelLogs() , 0);
+
+ if (CollectionUtils.isEmpty(importExcel)) {
+ return new ResultVO<>(ResultCodes.OK);
+ }
+
+ List<RewardPunishmentStandard> respList = BeanCopyUtils.copyBeanList((List<RewardPunishmentStandardImportExcel>)importExcel, RewardPunishmentStandard.class);
+
+ rewardPunishmentStandardService.saveBatch(respList);
+ return new ResultVO<>(ResultCodes.OK);
+ }
+
+
+
public static void main(String[] args) {
RewardPunishmentStandard mng = new RewardPunishmentStandard();
mng.setStandardType(1);
diff --git a/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/entity/BaseDomain.java b/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/entity/BaseDomain.java
index ea18fe5..f45dd38 100644
--- a/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/entity/BaseDomain.java
+++ b/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/entity/BaseDomain.java
@@ -24,9 +24,10 @@
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateTime;
- public static long getSerialVersionUID() {
- return serialVersionUID;
- }
+// @TableLogic
+// @JsonIgnore
+// private Integer isDel;
+
public Date getCreateTime() {
return createTime;
@@ -43,8 +44,4 @@
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
-
- // @TableLogic
-// @JsonIgnore
-// private Integer isDel;
}
diff --git a/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/repository/RewardPunishmentDetailRepository.java b/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/repository/RewardPunishmentDetailRepository.java
index 587e7e7..e7c6d7d 100644
--- a/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/repository/RewardPunishmentDetailRepository.java
+++ b/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/repository/RewardPunishmentDetailRepository.java
@@ -9,6 +9,8 @@
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
+import java.util.List;
+
/**
* 奖惩记录(RewardPunishmentDetail)表数据库访问层
*
@@ -22,4 +24,9 @@
"from reward_punishment_detail a left join reward_punishment_standard b on a.reward_punishment_standard_id=b.id where 1=1 " +
"<if test =\"personId !='' and personId !=null\">and a.person_id =#{personId}</if> </script> ")
IPage<RewardPunishmentDetailDto> queryAll(IPage<RewardPunishmentDetailDto> page, @Param("personId") String personId);
+
+ @Select("<script> select a.id,a.person_id,a.create_time ,b.standard_type ,b.content ,b.q_name ,b.reason " +
+ "from reward_punishment_detail a left join reward_punishment_standard b on a.reward_punishment_standard_id=b.id where 1=1 " +
+ "<if test =\"personId !='' and personId !=null\">and a.person_id =#{personId}</if> </script> ")
+ List<RewardPunishmentDetail> queryAll( @Param("personId")String personId);
}
\ No newline at end of file
diff --git a/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/service/RewardPunishmentDetailService.java b/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/service/RewardPunishmentDetailService.java
index 52123fa..36080ba 100644
--- a/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/service/RewardPunishmentDetailService.java
+++ b/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/service/RewardPunishmentDetailService.java
@@ -20,4 +20,5 @@
List<RewardPunishmentDetail> queryAll(RewardPunishmentDetailQueryCriteria criteria);
+ List<RewardPunishmentDetail> queryAllRelation(RewardPunishmentDetailQueryCriteria criteria);
}
\ No newline at end of file
diff --git a/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/service/impl/RewardPunishmentDetailServiceImpl.java b/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/service/impl/RewardPunishmentDetailServiceImpl.java
index 9ce657c..248bfad 100644
--- a/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/service/impl/RewardPunishmentDetailServiceImpl.java
+++ b/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/service/impl/RewardPunishmentDetailServiceImpl.java
@@ -58,4 +58,10 @@
public List<RewardPunishmentDetail> queryAll(RewardPunishmentDetailQueryCriteria criteria) {
return baseMapper.selectList(QueryHelpPlus.getPredicate(RewardPunishmentDetail.class, criteria));
}
+
+
+ @Override
+ public List<RewardPunishmentDetail> queryAllRelation(RewardPunishmentDetailQueryCriteria criteria) {
+ return baseMapper.queryAll(criteria.getPersonId());
+ }
}
\ No newline at end of file
diff --git a/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/utils/QueryHelpPlus.java b/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/utils/QueryHelpPlus.java
index 12ab941..83c4f7f 100644
--- a/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/utils/QueryHelpPlus.java
+++ b/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/utils/QueryHelpPlus.java
@@ -6,10 +6,10 @@
*/
package com.gkhy.safePlatform.targetDuty.utils;
-import com.alibaba.nacos.common.utils.CollectionUtils;
-import com.alibaba.nacos.common.utils.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.gkhy.safePlatform.targetDuty.annotation.Query;
+import org.apache.commons.collections.CollectionUtils;
+import org.springframework.util.StringUtils;
import java.lang.reflect.Field;
import java.text.SimpleDateFormat;
diff --git a/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/utils/poihelper/ExcelUtil.java b/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/utils/poihelper/ExcelUtil.java
index a8f9759..1b8b195 100644
--- a/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/utils/poihelper/ExcelUtil.java
+++ b/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/utils/poihelper/ExcelUtil.java
@@ -19,6 +19,7 @@
import java.lang.reflect.Field;
import java.sql.Timestamp;
import java.text.MessageFormat;
+import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
@@ -557,7 +558,12 @@
if(data != null){
value = Integer.parseInt(String.valueOf(data));
}
- } else {
+ }else if (field.getType().equals(Long.class)) {
+ Object data = getCellValue(cell);
+ if(data != null){
+ value = Long.parseLong(String.valueOf(data));
+ }
+ } else {
value = getCellValue(cell);
// 处理特殊情况,excel的value为String,且bean中为其他,且defaultValue不为空,那就=defaultValue
ExcelCell annoCell = field.getAnnotation(ExcelCell.class);
diff --git a/incident-manage/incident-manage-service/src/main/resources/config/mapper/incidentManage/AccidentReportInfoMapper.xml b/incident-manage/incident-manage-service/src/main/resources/config/mapper/incidentManage/AccidentReportInfoMapper.xml
index d46e54a..6b1a340 100644
--- a/incident-manage/incident-manage-service/src/main/resources/config/mapper/incidentManage/AccidentReportInfoMapper.xml
+++ b/incident-manage/incident-manage-service/src/main/resources/config/mapper/incidentManage/AccidentReportInfoMapper.xml
@@ -149,7 +149,7 @@
FROM
accident_report a
LEFT JOIN accident_express b ON a.accident_express_id = b.id
- WHERE del_flag = 0 and id = #{id}
+ WHERE a.del_flag = 0 and a.id = #{id}
</select>
<update id="updateAccidentReport" parameterType="com.gkhy.safePlatform.incidentManage.entity.AccidentReportInfo">
--
Gitblit v1.9.2