diff --git a/riis-system/src/main/java/com/yfd/platform/modules/algorithm/controller/AlgorithmArrangeController.java b/riis-system/src/main/java/com/yfd/platform/modules/algorithm/controller/AlgorithmArrangeController.java
index f8e0bd6..4ace801 100644
--- a/riis-system/src/main/java/com/yfd/platform/modules/algorithm/controller/AlgorithmArrangeController.java
+++ b/riis-system/src/main/java/com/yfd/platform/modules/algorithm/controller/AlgorithmArrangeController.java
@@ -1,21 +1,43 @@
package com.yfd.platform.modules.algorithm.controller;
+import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
+import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
+import cn.hutool.json.JSONObject;
+import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.deepoove.poi.XWPFTemplate;
+import com.deepoove.poi.config.Configure;
+import com.deepoove.poi.data.Pictures;
+import com.deepoove.poi.plugin.table.HackLoopTableRenderPolicy;
+import com.deepoove.poi.util.PoitlIOUtils;
+import com.yfd.platform.config.HttpServerConfig;
import com.yfd.platform.config.ResponseResult;
import com.yfd.platform.modules.algorithm.domain.AlgorithmArrange;
+import com.yfd.platform.modules.algorithm.service.IAlgorithmArrangeDeviceService;
import com.yfd.platform.modules.algorithm.service.IAlgorithmArrangeService;
+import com.yfd.platform.modules.basedata.domain.Substation;
+import com.yfd.platform.system.service.ISysDictionaryItemsService;
+import com.yfd.platform.utils.FileUtil;
import com.yfd.platform.utils.SecurityUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.util.ClassUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+import java.io.*;
+import java.net.URLDecoder;
+import java.nio.file.Files;
import java.time.LocalDateTime;
-import java.util.List;
+import java.util.*;
+import java.util.stream.Collectors;
/**
*
@@ -28,10 +50,17 @@ import java.util.List;
@RestController
@RequestMapping("/algorithm/algorithm-arrange")
@Api(value = "AlgorithmArrangeController", tags = "算法布点模块")
+@Slf4j
public class AlgorithmArrangeController {
@Resource
private IAlgorithmArrangeService algorithmArrangeService;
+ @Resource
+ private IAlgorithmArrangeDeviceService algorithmArrangeDeviceService;
+ @Resource
+ private ISysDictionaryItemsService sysDictionaryItemsService;
+ @Resource
+ private HttpServerConfig httpServerConfig;
@GetMapping("/getAlgorithmArrangePage")
@ApiOperation("查询算法布点")
@@ -88,6 +117,24 @@ public class AlgorithmArrangeController {
return ResponseResult.successData(algorithmArrange);
}
+ @PostMapping("/saveArrangeImage")
+ @ApiOperation("保存布点图片")
+ public ResponseResult saveArrangeImage(String id, MultipartFile file) {
+ // 文件上传逻辑
+ if (file != null && !file.isEmpty()) {
+ try {
+ // 上传文件
+ String fileUrl = algorithmArrangeService.uploadImage(file);
+ LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>();
+ updateWrapper.eq(AlgorithmArrange::getId, id).set(AlgorithmArrange::getArrangeImageUrl, fileUrl);
+ algorithmArrangeService.update(updateWrapper);
+ } catch (Exception e) {
+ return ResponseResult.error("文件上传失败:" + e.getMessage());
+ }
+ }
+ return ResponseResult.success();
+ }
+
@PostMapping("/updateAlgorithmArrange")
@ApiOperation("修改算法布点")
public ResponseResult updateAlgorithmArrange(AlgorithmArrange algorithmArrange, MultipartFile file) {
@@ -129,9 +176,9 @@ public class AlgorithmArrangeController {
}
}
- @PostMapping("/deleteAlgorithmArrange")
+ @PostMapping("/deleteAlgorithmArrangeByIds")
@ApiOperation("删除布点数据")
- public ResponseResult deleteAlgorithmArrange(@RequestBody List ids) {
+ public ResponseResult deleteAlgorithmArrangeByIds(@RequestBody List ids) {
boolean b = algorithmArrangeService.removeByIds(ids);
if (b) {
return ResponseResult.success();
@@ -147,4 +194,77 @@ public class AlgorithmArrangeController {
return ResponseResult.successData(algorithmArrange);
}
+ @GetMapping("/exportArrangeById")
+ @ApiOperation("导出报告")
+ public void exportArrangeById(String id, HttpServletResponse response) throws IOException {
+ Map map = new HashMap<>();
+ AlgorithmArrange algorithmArrange = algorithmArrangeService.getById(id);
+ map.put("arrangeName", algorithmArrange.getArrangeName());
+ map.put("stationName", algorithmArrange.getStationName());
+ Map businessTypeMap = sysDictionaryItemsService.getDeviceMapByType("businessType");
+ Map stationTypeMap = sysDictionaryItemsService.getDeviceMapByType("stationType");
+ JSONObject businessTypeJSON= JSONUtil.parseObj(businessTypeMap.get("resultMap"));
+ JSONObject stationTypeJSON= JSONUtil.parseObj(stationTypeMap.get("resultMap"));
+ String businessType = StrUtil.isNotBlank(algorithmArrange.getBusinessType()) ? businessTypeJSON.getStr(algorithmArrange.getBusinessType()) : "";
+ String stationType = StrUtil.isNotBlank(algorithmArrange.getStationType()) ? stationTypeJSON.getStr(algorithmArrange.getStationType()) : "";
+ map.put("stationType", stationType);
+ map.put("businessType",businessType);
+ map.put("voltLevel", algorithmArrange.getVoltLevel());
+ map.put("status", "完成");
+ map.put("date", DateUtil.now());
+ List