22e8d044 张雷

设备台账导入功能

1 个父辈 b242b3bf
......@@ -312,7 +312,7 @@ public class EmergencyEventsController {
lastYearData.add(String.valueOf(lastYearMap.getOrDefault(type, "0")));
}
}
Map<String, String> eventType = sysDictService.getDictMap("emergency_event_type").get("emergency_event_type");
Map<String, String> eventType = sysDictService.getDictMap("emergency_event_type","export").get("emergency_event_type");
for (int i = 0; i < types.size(); i++) {
types.set(i, eventType.getOrDefault(types.get(i), ""));
}
......
......@@ -671,6 +671,23 @@ public class EquipmentController {
@AutoLog(value = "设备台账-excel导入")
@ApiOperation(value = "设备台账-excel导入", notes = "设备台账-excel导入")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(String departId,HttpServletRequest request) {
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
try {
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile file = entity.getValue();// 获取上传文件对象
equipmentInfoService.importExcel(file,departId);
}
return Result.ok("设备台账导入完成");
} catch (Exception e) {
return Result.error("设备台账导入失败");
}
}
@AutoLog(value = "设备台账-excel导入")
@ApiOperation(value = "设备台账-excel导入", notes = "设备台账-excel导入")
@RequestMapping(value = "/importData", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) throws Exception {
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
......
package com.skua.modules.equipment.service;
import java.io.IOException;
import java.util.List;
import java.util.Map;
......@@ -10,6 +11,7 @@ import com.skua.modules.equipment.dto.EquipmentDTO;
import com.skua.modules.equipment.entity.EquipmentInfo;
import com.skua.modules.equipment.vo.EquipmentInfoForMonitorVO;
import com.skua.modules.equipment.vo.EquipmentVO;
import org.springframework.web.multipart.MultipartFile;
/**
* 设备信息
......@@ -22,7 +24,7 @@ public interface IEquipmentInfoService extends IService<EquipmentInfo> {
* @param result
* @param equipmentDTO
* @author Li Yuanyuan, 2022年6月27日 下午2:24:14
* @throws Exception
* @throws Exception
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
void addData(Result<EquipmentVO> result, EquipmentDTO equipmentDTO) throws Exception;
......@@ -55,7 +57,7 @@ public interface IEquipmentInfoService extends IService<EquipmentInfo> {
* @param result
* @param equipmentDTO
* @author Li Yuanyuan, 2022年6月28日 上午10:00:31
* @throws Exception
* @throws Exception
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
void editData(Result<EquipmentVO> result, EquipmentDTO equipmentDTO) throws Exception;
......@@ -64,7 +66,7 @@ public interface IEquipmentInfoService extends IService<EquipmentInfo> {
* 自定义查询
* </pre>
* @param pageList
* @param equipmentInfoVO
* @param equipmentInfoForMonitorVO
* @return
* @author Li Yuanyuan, 2022年6月28日 下午3:30:33
* @Description: TODO(这里描述这个方法的需求变更情况)
......@@ -78,4 +80,6 @@ public interface IEquipmentInfoService extends IService<EquipmentInfo> {
* @return
*/
List<Map<String, Object>> getEquipmentLifeTree(String id, String eventType);
void importExcel(MultipartFile file, String departId) throws Exception;
}
......
......@@ -105,7 +105,7 @@ public class DictAspect {
if(!org.apache.commons.lang3.StringUtils.isBlank(table)){
if (!businessMap.containsKey(table)){
//获取table的集合
Map<String, Map<String,String>> map = dictService.getBusinessMap(code,table,text);
Map<String, Map<String,String>> map = dictService.getBusinessMap(code,table,text,"export");
businessMap.putAll(map);
}
......@@ -120,7 +120,7 @@ public class DictAspect {
textValue = textValueStringBuilder.toString().replaceFirst(",","");
}else{
if (!dictMap.containsKey(code)){
Map<String, Map<String,String>> map = dictService.getDictMap(code);
Map<String, Map<String,String>> map = dictService.getDictMap(code,"export");
dictMap.putAll(map);
}
String[] keys = key.split(",");
......
......@@ -343,17 +343,13 @@ public class PipenetworkTubewellController {
/**
* 分页列表查询
*
* @param pipenetworkTubewell
* @param pageNo
* @param pageSize
* @param req
* @return
*/
@AutoLog(value = "排水管网-管井-获取所有管井数据")
@ApiOperation(value = "排水管网-管井-获取所有管井数据", notes = "排水管网-管井--获取所有管井数据")
@GetMapping(value = "/queryAllList")
public Result<List<PipenetworkTubewell>> queryAllList(
HttpServletRequest req) {
public Result<List<PipenetworkTubewell>> queryAllList(HttpServletRequest req) {
Result<List<PipenetworkTubewell>> result = new Result<List<PipenetworkTubewell>>();
QueryWrapper<PipenetworkTubewell> pipenetworkTubewell = new QueryWrapper<>();
pipenetworkTubewell.eq("del_flag", 0);
......@@ -375,22 +371,19 @@ public class PipenetworkTubewellController {
}
private Map<String, String> setDictText(String table) {
Map<String, String> type = sysDictService.getDictMap(table).get(table);
Map<String, String> type = sysDictService.getDictMap(table,"export").get(table);
return type;
}
/**
* 根据管径查询管线
*
* @param gjID[]
* @param req
* @param gjID
* @return
*/
@AutoLog(value = "排水管网-管线-分页列表查询")
@ApiOperation(value = "排水管网-管线-分页列表查询", notes = "排水管网-管线-分页列表查询")
@GetMapping(value = "/queryPipelineBytubWells")
public Result<List<PipenetworkPipeline>> queryPipelineBytubWells(String[] gjID,
HttpServletRequest req) {
public Result<List<PipenetworkPipeline>> queryPipelineBytubWells(String[] gjID) {
Result<List<PipenetworkPipeline>> result = new Result<List<PipenetworkPipeline>>();
String ids = "";
for (String id : gjID) {
......
......@@ -99,9 +99,9 @@ public interface ISysDictService extends IService<SysDict> {
<T> List<JSONObject> translateListDictValue(List<T> list);
Map<String, Map<String, String>> getDictMap(String code);
Map<String, Map<String, String>> getDictMap(String code, String type);
Map<String, Map<String, String>> getBusinessMap(String code, String table, String text);
Map<String, Map<String, String>> getBusinessMap(String code, String table, String text, String type);
String queryDictIdByCode(String code);
......
......@@ -23,6 +23,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.lang.reflect.Field;
import java.text.SimpleDateFormat;
import java.util.*;
......@@ -35,9 +36,9 @@ import java.util.stream.Collectors;
@Slf4j
public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> implements ISysDictService {
@Autowired
@Resource
private SysDictMapper sysDictMapper;
@Autowired
@Resource
private SysDictItemMapper sysDictItemMapper;
@Override
......@@ -221,7 +222,7 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
@Override
public Map<String, String> getDictMapByCode(String code) {
return this.getDictMap(code).get(code);
return this.getDictMap(code,"export").get(code);
}
@Override
public <T> List<JSONObject> translateListDictValue(List<T> list) {
......@@ -250,13 +251,13 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
if (!org.apache.commons.lang3.StringUtils.isBlank(table)) {
if (!businessMap.containsKey(table)) {
//获取table的集合
Map<String, Map<String, String>> map = getBusinessMap(code, table, text);
Map<String, Map<String, String>> map = getBusinessMap(code, table, text,"export");
businessMap.putAll(map);
}
textValue = businessMap.get(table).get(key);
} else {
if (!dictMap.containsKey(code)) {
Map<String, Map<String, String>> map = getDictMap(code);
Map<String, Map<String, String>> map = getDictMap(code,"export");
dictMap.putAll(map);
}
if (!StringUtils.isEmpty(key)&&key.split(",").length > 1) {
......@@ -291,24 +292,32 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
}
@Override
public Map<String, Map<String, String>> getDictMap(String code) {
public Map<String, Map<String, String>> getDictMap(String code,String type) {
Map<String, Map<String, String>> dictMap = new HashMap<>();
List<Map<String, String>> listMap = sysDictMapper.getDictMapByCode(code);
Map<String, String> map = new HashMap<>();
listMap.forEach(map1 -> {
map.put(map1.get("item_value"), map1.get("item_text"));
if("export".equals(type)) {
map.put(map1.get("item_value"), map1.get("item_text"));
}else {
map.put(map1.get("item_text"), map1.get("item_value"));
}
});
dictMap.put(code, map);
return dictMap;
}
@Override
public Map<String, Map<String, String>> getBusinessMap(String code, String table, String text) {
public Map<String, Map<String, String>> getBusinessMap(String code, String table, String text,String type) {
Map<String, Map<String, String>> businessMap = new HashMap<>();
List<Map<String, String>> listMap = sysDictMapper.getBusinessMapByTable(code, table, text);
Map<String, String> map = new HashMap<>();
listMap.forEach(map1 -> {
map.put(String.valueOf(map1.get(code)), map1.get(text));
if("export".equals(type)) {
map.put(String.valueOf(map1.get(code)), map1.get(text));
}else {
map.put(map1.get(text),String.valueOf(map1.get(code)));
}
});
businessMap.put(table, map);
return businessMap;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!