From c2aed9a9ae52b929a5e56f0ce167d055753f8bd3 Mon Sep 17 00:00:00 2001
From: wr <1754607820@qq.com>
Date: Fri, 25 Aug 2023 15:52:50 +0800
Subject: [PATCH] =?UTF-8?q?=E7=9B=91=E6=B5=8B=E7=82=B9=E6=9D=83=E9=87=8D?=
=?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../controller/PqsLineWeightController.java | 24 ++++---
.../device/pq/mapper/PqsLineWeightMapper.java | 13 +++-
.../pq/mapper/mapping/PqsLineWeightMapper.xml | 71 ++++++++++++++++++-
.../pq/service/IPqsLineWeightService.java | 13 +++-
.../impl/PqsLineWeightServiceImpl.java | 21 +++---
5 files changed, 118 insertions(+), 24 deletions(-)
diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/PqsLineWeightController.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/PqsLineWeightController.java
index c33b177aa..88aa2a61f 100644
--- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/PqsLineWeightController.java
+++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/PqsLineWeightController.java
@@ -1,12 +1,14 @@
package com.njcn.device.pq.controller;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.OperateType;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
+import com.njcn.device.pq.pojo.param.TerminalMainQueryParam;
import com.njcn.device.pq.pojo.po.PqsLineWeight;
import com.njcn.device.pq.pojo.vo.PqsLineWeightVo;
import com.njcn.device.pq.service.IPqsLineWeightService;
@@ -22,7 +24,6 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
-import java.util.*;
/**
*
@@ -43,18 +44,18 @@ public class PqsLineWeightController extends BaseController {
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/LineWeightList")
@ApiOperation("查询监测点权重")
- public HttpResult> LineWeightList() {
- String methodDescribe = getMethodDescribe("nodeTree");
- List pqsLineWeightVos = iPqsLineWeightService.LineWeightList();
- return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pqsLineWeightVos, methodDescribe);
+ public HttpResult> LineWeightList(@RequestBody TerminalMainQueryParam terminalMainQueryParam) {
+ String methodDescribe = getMethodDescribe("LineWeightList");
+ Page pqsLineWeightVoPage = iPqsLineWeightService.LineWeightList(terminalMainQueryParam);
+ return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pqsLineWeightVoPage, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/addLineWeight")
@ApiOperation("监测点评分权重修改")
- public HttpResult LineWeightList(@RequestBody PqsLineWeight lineWeight) {
- String methodDescribe = getMethodDescribe("nodeTree");
+ public HttpResult addLineWeight(@RequestBody PqsLineWeight lineWeight) {
+ String methodDescribe = getMethodDescribe("addLineWeight");
Boolean aBoolean = iPqsLineWeightService.addLineWeight(lineWeight);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, aBoolean, methodDescribe);
@@ -70,9 +71,16 @@ public class PqsLineWeightController extends BaseController {
@ApiOperation("批量导入监测点评分权重")
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD)
public HttpResult batchTerminal(@ApiParam(value = "文件", required = true) @RequestPart("file") MultipartFile file, HttpServletResponse response) {
- String methodDescribe = getMethodDescribe("batchTerminal");
+ String methodDescribe = getMethodDescribe("batchWeight");
iPqsLineWeightService.batchWeight(file, response);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
+
+ @OperateInfo(info = LogEnum.BUSINESS_COMMON)
+ @PostMapping("/exportList")
+ @ApiOperation("监测点评分权重信息导出")
+ public void export(@RequestBody TerminalMainQueryParam terminalMainQueryParam) throws IOException {
+ iPqsLineWeightService.exportWeight(terminalMainQueryParam);
+ }
}
diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/PqsLineWeightMapper.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/PqsLineWeightMapper.java
index 928305ea0..188197fda 100644
--- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/PqsLineWeightMapper.java
+++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/PqsLineWeightMapper.java
@@ -9,6 +9,7 @@ import org.apache.ibatis.annotations.Param;
import java.util.List;
+
/**
*
* Mapper 接口
@@ -26,7 +27,8 @@ public interface PqsLineWeightMapper extends BaseMapper {
* @Author: wr
* @Date: 2023/8/24 10:45
*/
- List selectWeight();
+ Page selectWeight(Page page,@Param("param") TerminalMainQueryParam terminalMainQueryParam
+ );
/**
* @Description: 根据区域/供电公司/终端等查询监测点id
@@ -37,4 +39,13 @@ public interface PqsLineWeightMapper extends BaseMapper {
*/
String getLineID( @Param("param") PqsLineWeightVo.WeightExcel param);
+
+ /**
+ * @Description: 批量导出查询列表
+ * @param terminalMainQueryParam
+ * @return: java.util.List
+ * @Author: wr
+ * @Date: 2023/8/25 9:15
+ */
+ List selectWeights(@Param("param") TerminalMainQueryParam terminalMainQueryParam);
}
diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/mapping/PqsLineWeightMapper.xml b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/mapping/PqsLineWeightMapper.xml
index 08a119f3a..2bd462be2 100644
--- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/mapping/PqsLineWeightMapper.xml
+++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/mapping/PqsLineWeightMapper.xml
@@ -4,7 +4,7 @@
+
diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/IPqsLineWeightService.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/IPqsLineWeightService.java
index 9f46a8a44..eb6fbd2fb 100644
--- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/IPqsLineWeightService.java
+++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/IPqsLineWeightService.java
@@ -1,6 +1,8 @@
package com.njcn.device.pq.service;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
+import com.njcn.device.pq.pojo.param.TerminalMainQueryParam;
import com.njcn.device.pq.pojo.po.PqsLineWeight;
import com.njcn.device.pq.pojo.vo.PqsLineWeightVo;
import org.springframework.core.io.InputStreamResource;
@@ -8,7 +10,6 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
-import java.util.List;
/**
@@ -37,7 +38,7 @@ public interface IPqsLineWeightService extends IService {
* @Author: wr
* @Date: 2023/8/24 10:44
*/
- List LineWeightList();
+ Page LineWeightList(TerminalMainQueryParam terminalMainQueryParam);
/**
* @Description: 导出模板
@@ -56,4 +57,12 @@ public interface IPqsLineWeightService extends IService {
* @Date: 2023/8/24 15:00
*/
void batchWeight(MultipartFile file, HttpServletResponse response);
+
+ /**
+ * @Description: 导出模板
+ * @param
+ * @Author: wr
+ * @Date: 2023/8/24 11:47
+ */
+ void exportWeight(TerminalMainQueryParam terminalMainQueryParam) throws IOException;
}
diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/PqsLineWeightServiceImpl.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/PqsLineWeightServiceImpl.java
index 777e19383..f23dbfd54 100644
--- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/PqsLineWeightServiceImpl.java
+++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/PqsLineWeightServiceImpl.java
@@ -10,8 +10,10 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.device.pq.mapper.LineMapper;
import com.njcn.device.pq.mapper.PqsLineWeightMapper;
+import com.njcn.device.pq.pojo.param.TerminalMainQueryParam;
import com.njcn.device.pq.pojo.po.PqsLineWeight;
import com.njcn.device.pq.pojo.vo.PqsLineWeightVo;
import com.njcn.device.pq.pojo.vo.TerminalTree;
@@ -61,17 +63,8 @@ public class PqsLineWeightServiceImpl extends ServiceImpl LineWeightList() {
- List lines = this.baseMapper.selectWeight();
- List provinceList = lineMapper.getProvinceList(null, 0);
- Map areaMap = provinceList.stream().collect(Collectors.toMap(TerminalTree::getId, TerminalTree::getName));
- lines.stream().forEach(x -> {
- if (areaMap.containsKey(x.getAreaName())) {
- x.setAreaName(areaMap.get(x.getAreaName()));
- }
- }
- );
- return lines;
+ public Page LineWeightList(TerminalMainQueryParam param) {
+ return this.baseMapper.selectWeight(new Page(param.getPageNum(), param.getPageSize()),param);
}
@Override
@@ -112,6 +105,12 @@ public class PqsLineWeightServiceImpl extends ServiceImpl weightExcels = this.baseMapper.selectWeights(terminalMainQueryParam);
+ ExcelUtil.exportExcel("监测点权重信息.xlsx",PqsLineWeightVo.WeightExcel.class,weightExcels);
+ }
+
private void saveWeightBase(List weightList) {
List weightExcelMsg = new ArrayList<>();
List info = new ArrayList<>();