5b869242 sonin

维保标准库模板 修改

1 个父辈 76ef4da1
......@@ -192,17 +192,17 @@ public class EquipmentMaintainStandardController {
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
//构造机构字典
List<Map<String,Object>> departList = iEquipmentMaintainStandardService.getDepartList("group");
Map<String,String> departDictMap = new HashMap<String,String>();
departList.forEach(depart ->{
departDictMap.put(ConvertUtils.getString(depart.get("depart_name")), ConvertUtils.getString(depart.get("id")));
List<Map<String, Object>> departList = iEquipmentMaintainStandardService.getDepartList("group");
Map<String, String> departDictMap = new HashMap<String, String>();
departList.forEach(depart -> {
departDictMap.put(ConvertUtils.getString(depart.get("depart_name")), ConvertUtils.getString(depart.get("id")));
});
//构造设备类别字典
List<EquipmentCategory> equipmentCategoryList = equipmentCategoryService.list();
Map<String,String> equipmentCategoryDictMap = new HashMap<String,String>();
equipmentCategoryList.forEach(equipmentCategory ->{
equipmentCategoryDictMap.put(equipmentCategory.getTreePathName(), equipmentCategory.getId());
Map<String, String> equipmentCategoryDictMap = new HashMap<String, String>();
equipmentCategoryList.forEach(equipmentCategory -> {
equipmentCategoryDictMap.put(equipmentCategory.getTreePathName(), equipmentCategory.getId());
});
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
// 获取上传文件对象
......@@ -215,28 +215,11 @@ public class EquipmentMaintainStandardController {
List<EquipmentMaintainStandard> listsdEquipFailureRepairs = ExcelImportUtil.importExcel(multipartFile.getInputStream(), EquipmentMaintainStandard.class, params);
//根据设备类型查出对应id
listsdEquipFailureRepairs.forEach(e -> {
//获取一级类型
String top = e.getEquipmentTopType();
//获取二级类型
String second = e.getEquipmentSecondType();
//获取三级类型
String third = e.getEquipmentType();
StringBuffer sb = new StringBuffer();
if(StringUtils.isNotBlank(top)) {
sb.append("/"+top);
}
if(StringUtils.isNotBlank(second)) {
sb.append("/"+second);
}
if(StringUtils.isNotBlank(third)) {
sb.append("/"+third);
}
String key = sb.substring(1);
//机构字典翻译,并设置到保养库对象
e.setDepartId(departDictMap.get(e.getDepartId()));
//设备类型字典翻译,并设置到保养库对象
e.setEquipmentType(equipmentCategoryDictMap.get(key));
String third = e.getEquipmentType();
//机构字典翻译,并设置到保养库对象
e.setDepartId(departDictMap.get(e.getDepartId()));
//设备类型字典翻译,并设置到保养库对象
e.setEquipmentType(equipmentCategoryDictMap.get(third));
});
iEquipmentMaintainStandardService.addList(listsdEquipFailureRepairs);
return Result.ok("文件导入成功!数据行数:" + listsdEquipFailureRepairs.size());
......
......@@ -33,7 +33,7 @@ public class EquipmentMaintainStandard {
@Excel(name = "保养项", width = 15)
@ApiModelProperty(value = "保养项")
private String maintenanceType;
@Excel(name = "设备三级类型", width = 15)
@Excel(name = "设备类型", width = 15)
@ApiModelProperty(value = "设备类型")
private String equipmentType;
......@@ -41,8 +41,7 @@ public class EquipmentMaintainStandard {
@ApiModelProperty(value = "设备二级类型")
@TableField(exist = false)
private String equipmentSecondType;
@Excel(name = "设备类型", width = 15)
@ApiModelProperty(value = "设备一级类型")
@TableField(exist = false)
private String equipmentTopType;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!