22e8d044 张雷

设备台账导入功能

1 个父辈 b242b3bf
...@@ -312,7 +312,7 @@ public class EmergencyEventsController { ...@@ -312,7 +312,7 @@ public class EmergencyEventsController {
312 lastYearData.add(String.valueOf(lastYearMap.getOrDefault(type, "0"))); 312 lastYearData.add(String.valueOf(lastYearMap.getOrDefault(type, "0")));
313 } 313 }
314 } 314 }
315 Map<String, String> eventType = sysDictService.getDictMap("emergency_event_type").get("emergency_event_type"); 315 Map<String, String> eventType = sysDictService.getDictMap("emergency_event_type","export").get("emergency_event_type");
316 for (int i = 0; i < types.size(); i++) { 316 for (int i = 0; i < types.size(); i++) {
317 types.set(i, eventType.getOrDefault(types.get(i), "")); 317 types.set(i, eventType.getOrDefault(types.get(i), ""));
318 } 318 }
......
...@@ -671,6 +671,23 @@ public class EquipmentController { ...@@ -671,6 +671,23 @@ public class EquipmentController {
671 @AutoLog(value = "设备台账-excel导入") 671 @AutoLog(value = "设备台账-excel导入")
672 @ApiOperation(value = "设备台账-excel导入", notes = "设备台账-excel导入") 672 @ApiOperation(value = "设备台账-excel导入", notes = "设备台账-excel导入")
673 @RequestMapping(value = "/importExcel", method = RequestMethod.POST) 673 @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
674 public Result<?> importExcel(String departId,HttpServletRequest request) {
675 MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
676 Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
677 try {
678 for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
679 MultipartFile file = entity.getValue();// 获取上传文件对象
680 equipmentInfoService.importExcel(file,departId);
681 }
682 return Result.ok("设备台账导入完成");
683 } catch (Exception e) {
684 return Result.error("设备台账导入失败");
685 }
686 }
687
688 @AutoLog(value = "设备台账-excel导入")
689 @ApiOperation(value = "设备台账-excel导入", notes = "设备台账-excel导入")
690 @RequestMapping(value = "/importData", method = RequestMethod.POST)
674 public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) throws Exception { 691 public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) throws Exception {
675 MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; 692 MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
676 Map<String, MultipartFile> fileMap = multipartRequest.getFileMap(); 693 Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
......
1 package com.skua.modules.equipment.service; 1 package com.skua.modules.equipment.service;
2 2
3 import java.io.IOException;
3 import java.util.List; 4 import java.util.List;
4 import java.util.Map; 5 import java.util.Map;
5 6
...@@ -10,6 +11,7 @@ import com.skua.modules.equipment.dto.EquipmentDTO; ...@@ -10,6 +11,7 @@ import com.skua.modules.equipment.dto.EquipmentDTO;
10 import com.skua.modules.equipment.entity.EquipmentInfo; 11 import com.skua.modules.equipment.entity.EquipmentInfo;
11 import com.skua.modules.equipment.vo.EquipmentInfoForMonitorVO; 12 import com.skua.modules.equipment.vo.EquipmentInfoForMonitorVO;
12 import com.skua.modules.equipment.vo.EquipmentVO; 13 import com.skua.modules.equipment.vo.EquipmentVO;
14 import org.springframework.web.multipart.MultipartFile;
13 15
14 /** 16 /**
15 * 设备信息 17 * 设备信息
...@@ -22,7 +24,7 @@ public interface IEquipmentInfoService extends IService<EquipmentInfo> { ...@@ -22,7 +24,7 @@ public interface IEquipmentInfoService extends IService<EquipmentInfo> {
22 * @param result 24 * @param result
23 * @param equipmentDTO 25 * @param equipmentDTO
24 * @author Li Yuanyuan, 2022年6月27日 下午2:24:14 26 * @author Li Yuanyuan, 2022年6月27日 下午2:24:14
25 * @throws Exception 27 * @throws Exception
26 * @Description: TODO(这里描述这个方法的需求变更情况) 28 * @Description: TODO(这里描述这个方法的需求变更情况)
27 */ 29 */
28 void addData(Result<EquipmentVO> result, EquipmentDTO equipmentDTO) throws Exception; 30 void addData(Result<EquipmentVO> result, EquipmentDTO equipmentDTO) throws Exception;
...@@ -55,7 +57,7 @@ public interface IEquipmentInfoService extends IService<EquipmentInfo> { ...@@ -55,7 +57,7 @@ public interface IEquipmentInfoService extends IService<EquipmentInfo> {
55 * @param result 57 * @param result
56 * @param equipmentDTO 58 * @param equipmentDTO
57 * @author Li Yuanyuan, 2022年6月28日 上午10:00:31 59 * @author Li Yuanyuan, 2022年6月28日 上午10:00:31
58 * @throws Exception 60 * @throws Exception
59 * @Description: TODO(这里描述这个方法的需求变更情况) 61 * @Description: TODO(这里描述这个方法的需求变更情况)
60 */ 62 */
61 void editData(Result<EquipmentVO> result, EquipmentDTO equipmentDTO) throws Exception; 63 void editData(Result<EquipmentVO> result, EquipmentDTO equipmentDTO) throws Exception;
...@@ -64,7 +66,7 @@ public interface IEquipmentInfoService extends IService<EquipmentInfo> { ...@@ -64,7 +66,7 @@ public interface IEquipmentInfoService extends IService<EquipmentInfo> {
64 * 自定义查询 66 * 自定义查询
65 * </pre> 67 * </pre>
66 * @param pageList 68 * @param pageList
67 * @param equipmentInfoVO 69 * @param equipmentInfoForMonitorVO
68 * @return 70 * @return
69 * @author Li Yuanyuan, 2022年6月28日 下午3:30:33 71 * @author Li Yuanyuan, 2022年6月28日 下午3:30:33
70 * @Description: TODO(这里描述这个方法的需求变更情况) 72 * @Description: TODO(这里描述这个方法的需求变更情况)
...@@ -78,4 +80,6 @@ public interface IEquipmentInfoService extends IService<EquipmentInfo> { ...@@ -78,4 +80,6 @@ public interface IEquipmentInfoService extends IService<EquipmentInfo> {
78 * @return 80 * @return
79 */ 81 */
80 List<Map<String, Object>> getEquipmentLifeTree(String id, String eventType); 82 List<Map<String, Object>> getEquipmentLifeTree(String id, String eventType);
83
84 void importExcel(MultipartFile file, String departId) throws Exception;
81 } 85 }
......
...@@ -105,7 +105,7 @@ public class DictAspect { ...@@ -105,7 +105,7 @@ public class DictAspect {
105 if(!org.apache.commons.lang3.StringUtils.isBlank(table)){ 105 if(!org.apache.commons.lang3.StringUtils.isBlank(table)){
106 if (!businessMap.containsKey(table)){ 106 if (!businessMap.containsKey(table)){
107 //获取table的集合 107 //获取table的集合
108 Map<String, Map<String,String>> map = dictService.getBusinessMap(code,table,text); 108 Map<String, Map<String,String>> map = dictService.getBusinessMap(code,table,text,"export");
109 businessMap.putAll(map); 109 businessMap.putAll(map);
110 } 110 }
111 111
...@@ -120,7 +120,7 @@ public class DictAspect { ...@@ -120,7 +120,7 @@ public class DictAspect {
120 textValue = textValueStringBuilder.toString().replaceFirst(",",""); 120 textValue = textValueStringBuilder.toString().replaceFirst(",","");
121 }else{ 121 }else{
122 if (!dictMap.containsKey(code)){ 122 if (!dictMap.containsKey(code)){
123 Map<String, Map<String,String>> map = dictService.getDictMap(code); 123 Map<String, Map<String,String>> map = dictService.getDictMap(code,"export");
124 dictMap.putAll(map); 124 dictMap.putAll(map);
125 } 125 }
126 String[] keys = key.split(","); 126 String[] keys = key.split(",");
......
...@@ -343,17 +343,13 @@ public class PipenetworkTubewellController { ...@@ -343,17 +343,13 @@ public class PipenetworkTubewellController {
343 /** 343 /**
344 * 分页列表查询 344 * 分页列表查询
345 * 345 *
346 * @param pipenetworkTubewell
347 * @param pageNo
348 * @param pageSize
349 * @param req 346 * @param req
350 * @return 347 * @return
351 */ 348 */
352 @AutoLog(value = "排水管网-管井-获取所有管井数据") 349 @AutoLog(value = "排水管网-管井-获取所有管井数据")
353 @ApiOperation(value = "排水管网-管井-获取所有管井数据", notes = "排水管网-管井--获取所有管井数据") 350 @ApiOperation(value = "排水管网-管井-获取所有管井数据", notes = "排水管网-管井--获取所有管井数据")
354 @GetMapping(value = "/queryAllList") 351 @GetMapping(value = "/queryAllList")
355 public Result<List<PipenetworkTubewell>> queryAllList( 352 public Result<List<PipenetworkTubewell>> queryAllList(HttpServletRequest req) {
356 HttpServletRequest req) {
357 Result<List<PipenetworkTubewell>> result = new Result<List<PipenetworkTubewell>>(); 353 Result<List<PipenetworkTubewell>> result = new Result<List<PipenetworkTubewell>>();
358 QueryWrapper<PipenetworkTubewell> pipenetworkTubewell = new QueryWrapper<>(); 354 QueryWrapper<PipenetworkTubewell> pipenetworkTubewell = new QueryWrapper<>();
359 pipenetworkTubewell.eq("del_flag", 0); 355 pipenetworkTubewell.eq("del_flag", 0);
...@@ -375,22 +371,19 @@ public class PipenetworkTubewellController { ...@@ -375,22 +371,19 @@ public class PipenetworkTubewellController {
375 } 371 }
376 372
377 private Map<String, String> setDictText(String table) { 373 private Map<String, String> setDictText(String table) {
378 Map<String, String> type = sysDictService.getDictMap(table).get(table); 374 Map<String, String> type = sysDictService.getDictMap(table,"export").get(table);
379 return type; 375 return type;
380 } 376 }
381 377
382 /** 378 /**
383 * 根据管径查询管线 379 * 根据管径查询管线
384 * 380 * @param gjID
385 * @param gjID[]
386 * @param req
387 * @return 381 * @return
388 */ 382 */
389 @AutoLog(value = "排水管网-管线-分页列表查询") 383 @AutoLog(value = "排水管网-管线-分页列表查询")
390 @ApiOperation(value = "排水管网-管线-分页列表查询", notes = "排水管网-管线-分页列表查询") 384 @ApiOperation(value = "排水管网-管线-分页列表查询", notes = "排水管网-管线-分页列表查询")
391 @GetMapping(value = "/queryPipelineBytubWells") 385 @GetMapping(value = "/queryPipelineBytubWells")
392 public Result<List<PipenetworkPipeline>> queryPipelineBytubWells(String[] gjID, 386 public Result<List<PipenetworkPipeline>> queryPipelineBytubWells(String[] gjID) {
393 HttpServletRequest req) {
394 Result<List<PipenetworkPipeline>> result = new Result<List<PipenetworkPipeline>>(); 387 Result<List<PipenetworkPipeline>> result = new Result<List<PipenetworkPipeline>>();
395 String ids = ""; 388 String ids = "";
396 for (String id : gjID) { 389 for (String id : gjID) {
......
...@@ -99,9 +99,9 @@ public interface ISysDictService extends IService<SysDict> { ...@@ -99,9 +99,9 @@ public interface ISysDictService extends IService<SysDict> {
99 <T> List<JSONObject> translateListDictValue(List<T> list); 99 <T> List<JSONObject> translateListDictValue(List<T> list);
100 100
101 101
102 Map<String, Map<String, String>> getDictMap(String code); 102 Map<String, Map<String, String>> getDictMap(String code, String type);
103 103
104 Map<String, Map<String, String>> getBusinessMap(String code, String table, String text); 104 Map<String, Map<String, String>> getBusinessMap(String code, String table, String text, String type);
105 105
106 String queryDictIdByCode(String code); 106 String queryDictIdByCode(String code);
107 107
......
...@@ -23,6 +23,7 @@ import org.springframework.stereotype.Service; ...@@ -23,6 +23,7 @@ import org.springframework.stereotype.Service;
23 import org.springframework.transaction.annotation.Transactional; 23 import org.springframework.transaction.annotation.Transactional;
24 import org.springframework.util.StringUtils; 24 import org.springframework.util.StringUtils;
25 25
26 import javax.annotation.Resource;
26 import java.lang.reflect.Field; 27 import java.lang.reflect.Field;
27 import java.text.SimpleDateFormat; 28 import java.text.SimpleDateFormat;
28 import java.util.*; 29 import java.util.*;
...@@ -35,9 +36,9 @@ import java.util.stream.Collectors; ...@@ -35,9 +36,9 @@ import java.util.stream.Collectors;
35 @Slf4j 36 @Slf4j
36 public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> implements ISysDictService { 37 public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> implements ISysDictService {
37 38
38 @Autowired 39 @Resource
39 private SysDictMapper sysDictMapper; 40 private SysDictMapper sysDictMapper;
40 @Autowired 41 @Resource
41 private SysDictItemMapper sysDictItemMapper; 42 private SysDictItemMapper sysDictItemMapper;
42 43
43 @Override 44 @Override
...@@ -221,7 +222,7 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl ...@@ -221,7 +222,7 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
221 222
222 @Override 223 @Override
223 public Map<String, String> getDictMapByCode(String code) { 224 public Map<String, String> getDictMapByCode(String code) {
224 return this.getDictMap(code).get(code); 225 return this.getDictMap(code,"export").get(code);
225 } 226 }
226 @Override 227 @Override
227 public <T> List<JSONObject> translateListDictValue(List<T> list) { 228 public <T> List<JSONObject> translateListDictValue(List<T> list) {
...@@ -250,13 +251,13 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl ...@@ -250,13 +251,13 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
250 if (!org.apache.commons.lang3.StringUtils.isBlank(table)) { 251 if (!org.apache.commons.lang3.StringUtils.isBlank(table)) {
251 if (!businessMap.containsKey(table)) { 252 if (!businessMap.containsKey(table)) {
252 //获取table的集合 253 //获取table的集合
253 Map<String, Map<String, String>> map = getBusinessMap(code, table, text); 254 Map<String, Map<String, String>> map = getBusinessMap(code, table, text,"export");
254 businessMap.putAll(map); 255 businessMap.putAll(map);
255 } 256 }
256 textValue = businessMap.get(table).get(key); 257 textValue = businessMap.get(table).get(key);
257 } else { 258 } else {
258 if (!dictMap.containsKey(code)) { 259 if (!dictMap.containsKey(code)) {
259 Map<String, Map<String, String>> map = getDictMap(code); 260 Map<String, Map<String, String>> map = getDictMap(code,"export");
260 dictMap.putAll(map); 261 dictMap.putAll(map);
261 } 262 }
262 if (!StringUtils.isEmpty(key)&&key.split(",").length > 1) { 263 if (!StringUtils.isEmpty(key)&&key.split(",").length > 1) {
...@@ -291,24 +292,32 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl ...@@ -291,24 +292,32 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
291 } 292 }
292 293
293 @Override 294 @Override
294 public Map<String, Map<String, String>> getDictMap(String code) { 295 public Map<String, Map<String, String>> getDictMap(String code,String type) {
295 Map<String, Map<String, String>> dictMap = new HashMap<>(); 296 Map<String, Map<String, String>> dictMap = new HashMap<>();
296 List<Map<String, String>> listMap = sysDictMapper.getDictMapByCode(code); 297 List<Map<String, String>> listMap = sysDictMapper.getDictMapByCode(code);
297 Map<String, String> map = new HashMap<>(); 298 Map<String, String> map = new HashMap<>();
298 listMap.forEach(map1 -> { 299 listMap.forEach(map1 -> {
299 map.put(map1.get("item_value"), map1.get("item_text")); 300 if("export".equals(type)) {
301 map.put(map1.get("item_value"), map1.get("item_text"));
302 }else {
303 map.put(map1.get("item_text"), map1.get("item_value"));
304 }
300 }); 305 });
301 dictMap.put(code, map); 306 dictMap.put(code, map);
302 return dictMap; 307 return dictMap;
303 } 308 }
304 309
305 @Override 310 @Override
306 public Map<String, Map<String, String>> getBusinessMap(String code, String table, String text) { 311 public Map<String, Map<String, String>> getBusinessMap(String code, String table, String text,String type) {
307 Map<String, Map<String, String>> businessMap = new HashMap<>(); 312 Map<String, Map<String, String>> businessMap = new HashMap<>();
308 List<Map<String, String>> listMap = sysDictMapper.getBusinessMapByTable(code, table, text); 313 List<Map<String, String>> listMap = sysDictMapper.getBusinessMapByTable(code, table, text);
309 Map<String, String> map = new HashMap<>(); 314 Map<String, String> map = new HashMap<>();
310 listMap.forEach(map1 -> { 315 listMap.forEach(map1 -> {
311 map.put(String.valueOf(map1.get(code)), map1.get(text)); 316 if("export".equals(type)) {
317 map.put(String.valueOf(map1.get(code)), map1.get(text));
318 }else {
319 map.put(map1.get(text),String.valueOf(map1.get(code)));
320 }
312 }); 321 });
313 businessMap.put(table, map); 322 businessMap.put(table, map);
314 return businessMap; 323 return businessMap;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!