应急救援物资,公文办理,队伍管理,队伍人员导入导出功能优化

main
15036302109 10 months ago
parent 7b707fb2f7
commit f8419f24cc

@ -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<EhsMaterial> list = ehsMaterialService.selectEhsMaterialList(ehsMaterial);
// 类别替换为中文
MaterialClassMaster msm = new MaterialClassMaster();
msm.setClassMastType(ehsMaterial.getClassFirst().toString());
List<MaterialClassMaster> materialClassMasters = materialClassMastService.selectMaterialClassMastList(msm);
// 物资分类一级分类对象,对应的是"类别"字段;收集为map,key是 v1,v2,v3... value是"常用工具","个人防护物资和装备"...
Map<String, String> map1 = materialClassMasters.stream().collect(Collectors.toMap(MaterialClassMaster::getClassMastId, MaterialClassMaster::getClassNameMast));
// 物资名称替换为中文
MaterialClassSub mcs = new MaterialClassSub();
mcs.setClassMastType(ehsMaterial.getClassFirst().toString());
List<MaterialClassSub> mlist = materialClassSubService.selectMaterialClassSubList(mcs);
// 物资分类二级分类对象,对应的是"物资名称"字段;收集为map,key是 v1-1,v1-2,v2-1... value是"卫星电话"...
Map<String, String> 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<EhsMaterial> util = new ExcelUtil<EhsMaterial>(EhsMaterial.class);
util.exportExcel(response, list, "物资信息包含 通用应急救援装备”“防汛抗旱应急救援装备”“森林防灭火应急救援装备”“救灾物资”数据");
}

@ -76,21 +76,9 @@ public class EhsRescueTeamController extends BaseController {
*
*/
@PostMapping("/importTemplate")
public void importTemplate(HttpServletResponse response) throws IOException {
List<EhsRescueTeam> ehsRescueTeamList = new ArrayList<>();
String[] header =
{"队伍名称#",
"队伍级别#",
"负责人#",
"联系电话#",
"所属单位#",
"驻地#",
"队伍属性(0-其他,1-政府,2-企业,3-社会)#",
"备注#"};
ExcelExp e1 = new ExcelExp("应急救援队伍信息", header, ehsRescueTeamList, EhsRescueTeam.class);
List<ExcelExp> mysheet = new ArrayList<>();
mysheet.add(e1);
ExcelExportUtil.exportManySheetExcel("应急救援队伍信息批量导入模板", mysheet, response);
public void importTemplate(HttpServletResponse response) throws Exception {
ExcelUtil<EhsRescueTeam> util = new ExcelUtil<EhsRescueTeam>(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<RescueTeamImportTemplate> util = new ExcelUtil<>(RescueTeamImportTemplate.class);
List<RescueTeamImportTemplate> list = util.importExcel(file.getInputStream());
ExcelUtil<EhsRescueTeam> util = new ExcelUtil<>(EhsRescueTeam.class);
List<EhsRescueTeam> list = util.importExcel(file.getInputStream());
String message = ehsRescueTeamService.importRescueTeam(list, updateSupport);
return AjaxResult.success(message);
}

@ -120,23 +120,9 @@ public class EhsRescueTeamWorkerController extends BaseController {
*
*/
@PostMapping("/importTemplate")
public void importTemplate(HttpServletResponse response) throws IOException {
List<EhsRescueTeamWorker> teamWorkerList = new ArrayList<>();
String[] header =
{"人员姓名#",
"年龄#",
"性别(0男 1女)#",
"身份证号#",
"联系方式#",
"队内职务#",
"工作年限#",
"救援技能特长#",
"培训次数#",
"备注#"};
ExcelExp e1 = new ExcelExp("应急救援队伍人员信息", header, teamWorkerList, EhsRescueTeamWorker.class);
List<ExcelExp> mysheet = new ArrayList<>();
mysheet.add(e1);
ExcelExportUtil.exportManySheetExcel("应急救援队伍人员信息批量导入模板", mysheet, response);
public void importTemplate(HttpServletResponse response) throws Exception {
ExcelUtil<EhsRescueTeamWorker> 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<RescueTeamWorkerImportTemplate> util = new ExcelUtil<>(RescueTeamWorkerImportTemplate.class);
List<RescueTeamWorkerImportTemplate> list = util.importExcel(file.getInputStream());
ExcelUtil<EhsRescueTeamWorker> util = new ExcelUtil<>(EhsRescueTeamWorker.class);
List<EhsRescueTeamWorker> list = util.importExcel(file.getInputStream());
String message = ehsRescueTeamWorkerService.importRescueTeamWorker(list, updateSupport, params);
return AjaxResult.success(message);
}

@ -57,6 +57,7 @@ public class BaseEntity implements Serializable
private Date updateTime;
/** 备注 */
@Excel(name = "备注")
private String remark;
/** 请求参数 */

@ -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;
}

@ -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;

@ -37,7 +37,7 @@ public interface IEhsRescueTeamService extends IService<EhsRescueTeam> {
* @param updateSupport
* @return
*/
public String importRescueTeam(List<RescueTeamImportTemplate> list, Boolean updateSupport) throws Exception;
public String importRescueTeam(List<EhsRescueTeam> list, Boolean updateSupport) throws Exception;
/**
* :id

@ -83,7 +83,7 @@ public class EhsRescueTeamServiceImpl extends ServiceImpl<EhsRescueTeamMapper, E
* @return
*/
@Override
public String importRescueTeam(List<RescueTeamImportTemplate> list, Boolean updateSupport) throws Exception {
public String importRescueTeam(List<EhsRescueTeam> list, Boolean updateSupport) throws Exception {
if (StringUtils.isNull(list) || list.size() == 0) {
throw new Exception("导入救援队伍信息数据不能为空!");
}
@ -92,7 +92,7 @@ public class EhsRescueTeamServiceImpl extends ServiceImpl<EhsRescueTeamMapper, E
StringBuilder successMsg = new StringBuilder();
StringBuilder failureMsg = new StringBuilder();
for (RescueTeamImportTemplate rescueTeamTemplate : list) {
for (EhsRescueTeam team : list) {
EhsRescueTeam temp = new EhsRescueTeam();
/**
@ -100,14 +100,14 @@ public class EhsRescueTeamServiceImpl extends ServiceImpl<EhsRescueTeamMapper, E
* id,,id
*/
// temp.setId(IdUtils.fastSimpleUUID());
temp.setTeamName(rescueTeamTemplate.getTeamName()); //队伍名称
temp.setTeamLevel(rescueTeamTemplate.getTeamLevel()); //队伍级别
temp.setDutyer(rescueTeamTemplate.getDutyer());// 负责人
temp.setPhone(rescueTeamTemplate.getPhone());// 联系电话
temp.setUnit(rescueTeamTemplate.getUnit());// 所属单位
temp.setStation(rescueTeamTemplate.getStation());// 驻地
temp.setTeamProperty(rescueTeamTemplate.getTeamProperty());// 队伍属性
temp.setRemark(rescueTeamTemplate.getRemark()); // 备注
temp.setTeamName(team.getTeamName()); //队伍名称
temp.setTeamLevel(team.getTeamLevel()); //队伍级别
temp.setDutyer(team.getDutyer());// 负责人
temp.setPhone(team.getPhone());// 联系电话
temp.setUnit(team.getUnit());// 所属单位
temp.setStation(team.getStation());// 驻地
temp.setTeamProperty(team.getTeamProperty());// 队伍属性
temp.setRemark(team.getRemark()); // 备注
try {
//插入数据
this.save(temp);

@ -43,7 +43,7 @@ public class EhsRescueTeamWorker extends BaseEntity {
/**
*
*/
@Excel(name = "应急救援队伍名称")
@Excel(name = "应急救援队伍名称", type = Excel.Type.EXPORT)
private String rescueTeamName;
/**
@ -59,7 +59,7 @@ public class EhsRescueTeamWorker extends BaseEntity {
/**
*
*/
@Excel(name = "性别(0男 1女)")
@Excel(name = "性别", dictType = "sys_user_sex")
private Integer gender;

@ -35,7 +35,7 @@ public interface IEhsRescueTeamWorkerService extends IService<EhsRescueTeamWorke
boolean removeWorkerByTeamIds(List<Long> teamIds);
// 批量导入数据
public String importRescueTeamWorker(List<RescueTeamWorkerImportTemplate> list, Boolean updateSupport, Long params) throws Exception;
public String importRescueTeamWorker(List<EhsRescueTeamWorker> list, Boolean updateSupport, Long params) throws Exception;
// 根据teamId更新应急救援人员信息
public boolean updateWorkerByTeamId(EhsRescueTeam ehsRescueTeam);

@ -69,7 +69,7 @@ public class EhsRescueTeamWorkerServiceImpl extends ServiceImpl<EhsRescueTeamWor
* @return
*/
@Override
public String importRescueTeamWorker(List<RescueTeamWorkerImportTemplate> list, Boolean updateSupport, Long params) throws Exception {
public String importRescueTeamWorker(List<EhsRescueTeamWorker> 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<EhsRescueTeamWor
StringBuilder successMsg = new StringBuilder();
StringBuilder failureMsg = new StringBuilder();
for (RescueTeamWorkerImportTemplate rescueTeamWorkerTemplate : list) {
for (EhsRescueTeamWorker item : list) {
EhsRescueTeamWorker temp = new EhsRescueTeamWorker();
/**
@ -90,16 +90,16 @@ public class EhsRescueTeamWorkerServiceImpl extends ServiceImpl<EhsRescueTeamWor
TeamResponseVo teamResponseVo = ehsRescueTeamMapper.getTeamInfoByTeamId(params);
temp.setRescueTeamId(teamResponseVo.getRescueTeamId());// 队伍id
temp.setRescueTeamName(teamResponseVo.getRescueTeamName());// 队伍名称
temp.setWorkerName(rescueTeamWorkerTemplate.getWorkerName());// 人员姓名
temp.setGender(rescueTeamWorkerTemplate.getGender());// 性别(0男 1女)
temp.setIdCard(rescueTeamWorkerTemplate.getIdCard());// 身份证号
temp.setPhone(rescueTeamWorkerTemplate.getPhone());// 联系方式
temp.setWorkYear(rescueTeamWorkerTemplate.getWorkYear());// 工作年限
temp.setSpeciality(rescueTeamWorkerTemplate.getSpeciality());// 救援技能特长
temp.setRemark(rescueTeamWorkerTemplate.getRemark());// 备注
temp.setWorkerAge(rescueTeamWorkerTemplate.getWorkerAge());// 年龄
temp.setTeamPost(rescueTeamWorkerTemplate.getTeamPost());// 队内职务
temp.setTrainNum(rescueTeamWorkerTemplate.getTrainNum());// 培训次数
temp.setWorkerName(item.getWorkerName());// 人员姓名
temp.setGender(item.getGender());// 性别(0男 1女)
temp.setIdCard(item.getIdCard());// 身份证号
temp.setPhone(item.getPhone());// 联系方式
temp.setWorkYear(item.getWorkYear());// 工作年限
temp.setSpeciality(item.getSpeciality());// 救援技能特长
temp.setRemark(item.getRemark());// 备注
temp.setWorkerAge(item.getWorkerAge());// 年龄
temp.setTeamPost(item.getTeamPost());// 队内职务
temp.setTrainNum(item.getTrainNum());// 培训次数
try {
//插入数据

Loading…
Cancel
Save