From a8e6ebe0244e931be5b24c6d85d7c044a5b13027 Mon Sep 17 00:00:00 2001 From: YUJT Date: Fri, 29 Apr 2022 09:53:06 +0800 Subject: [PATCH 01/10] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=A1=A5=E5=85=85custo?= =?UTF-8?q?merid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/axis/form/PowerKernelListPostitionFormDTO.java | 2 ++ .../axis/controller/PowerAxisDataVisualController.java | 7 ++++++- .../axis/service/impl/PowerKernelHouseholdServiceImpl.java | 2 -- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerKernelListPostitionFormDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerKernelListPostitionFormDTO.java index 623b9b9..b2eb8ee 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerKernelListPostitionFormDTO.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerKernelListPostitionFormDTO.java @@ -2,6 +2,7 @@ package com.epmet.plugin.power.dto.axis.form; import lombok.Data; +import javax.validation.constraints.NotBlank; import java.io.Serializable; @Data @@ -12,6 +13,7 @@ public class PowerKernelListPostitionFormDTO implements Serializable { /** * 动力主轴id */ + @NotBlank(message = "动力主轴节点不能为空") private String axisStructId; /** diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisDataVisualController.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisDataVisualController.java index 3e246c2..d1c1615 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisDataVisualController.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisDataVisualController.java @@ -1,6 +1,9 @@ package com.epmet.plugin.power.modules.axis.controller; +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.plugin.power.dto.axis.ResultDTO; import com.epmet.plugin.power.dto.axis.form.*; import com.epmet.plugin.power.dto.axis.result.*; @@ -126,7 +129,9 @@ public class PowerAxisDataVisualController { * @date 2022/4/23 10:20 */ @PostMapping("kernelHousehold/listPosition") - public Result> getListPosition(@RequestBody PowerKernelListPostitionFormDTO form) { + public Result> getListPosition(@RequestBody PowerKernelListPostitionFormDTO form, @LoginUser TokenDto tokenDto) { + ValidatorUtils.validateEntity(form); + form.setCustomerId(tokenDto.getCustomerId()); return new Result().ok(powerKernelHouseholdService.getListPosition(form)); } diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerKernelHouseholdServiceImpl.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerKernelHouseholdServiceImpl.java index 4938dfb..d4ad420 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerKernelHouseholdServiceImpl.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerKernelHouseholdServiceImpl.java @@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; -import com.epmet.commons.tools.constant.Constant; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.page.PageData; @@ -17,7 +16,6 @@ import com.epmet.dto.result.HouseInfoDTO; import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.plugin.power.dto.axis.PowerKernelHouseholdDTO; import com.epmet.plugin.power.dto.axis.form.PowerKernelHouseFormDTO; -import com.epmet.plugin.power.dto.axis.form.PowerKernelHouseFromDTO; import com.epmet.plugin.power.dto.axis.form.PowerKernelHouseHoldViewListFormDTO; import com.epmet.plugin.power.dto.axis.form.PowerKernelListPostitionFormDTO; import com.epmet.plugin.power.dto.axis.result.PowerKernelHouseHoldViewListResultDTO; From f778d51148aacf02da558cb19286a8f05235eed1 Mon Sep 17 00:00:00 2001 From: YUJT Date: Fri, 29 Apr 2022 10:07:00 +0800 Subject: [PATCH 02/10] update --- .../db/migration/V0.0.3__kernelmember.sql | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/db/migration/V0.0.3__kernelmember.sql diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/db/migration/V0.0.3__kernelmember.sql b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/db/migration/V0.0.3__kernelmember.sql new file mode 100644 index 0000000..f722a20 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/db/migration/V0.0.3__kernelmember.sql @@ -0,0 +1,40 @@ +/* + Navicat Premium Data Transfer + + Source Server : prod[市北党群]--Elink@833066 + Source Server Type : MySQL + Source Server Version : 50728 + Source Host : epdc-shibei.mysql.rds.aliyuncs.com:3306 + Source Schema : epmet_pli_power + + Target Server Type : MySQL + Target Server Version : 50728 + File Encoding : 65001 + + Date: 29/04/2022 09:59:27 +*/ + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for pli_power_kernel_member +-- ---------------------------- +-- DROP TABLE IF EXISTS `pli_power_kernel_member`; + +CREATE TABLE `pli_power_kernel_member` ( + `ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主键', + `CUSTOMER_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '客户ID', + `HOUSE_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '房屋ID', + `KERNEL_MEMBER_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '中心党员ID', + `KERNEL_MEMBER_NAME` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '中心党员名称', + `DEL_FLAG` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '删除标识 0.未删除 1.已删除', + `REVISION` int(11) NULL DEFAULT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人', + `CREATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人', + `UPDATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '动力主轴中心党员 ' ROW_FORMAT = Dynamic; + +SET FOREIGN_KEY_CHECKS = 1; From 6c3ef92cfd1ab85cab075d3b807e9bec5a97171f Mon Sep 17 00:00:00 2001 From: YUJT Date: Thu, 5 May 2022 10:09:18 +0800 Subject: [PATCH 03/10] update sql --- .../src/main/resources/db/migration/V0.0.3__kernelmember.sql | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/db/migration/V0.0.3__kernelmember.sql b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/db/migration/V0.0.3__kernelmember.sql index f722a20..db7b625 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/db/migration/V0.0.3__kernelmember.sql +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/db/migration/V0.0.3__kernelmember.sql @@ -11,7 +11,7 @@ Target Server Version : 50728 File Encoding : 65001 - Date: 29/04/2022 09:59:27 + Date: 05/05/2022 09:56:08 */ SET NAMES utf8mb4; @@ -20,8 +20,7 @@ SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for pli_power_kernel_member -- ---------------------------- --- DROP TABLE IF EXISTS `pli_power_kernel_member`; - +DROP TABLE IF EXISTS `pli_power_kernel_member`; CREATE TABLE `pli_power_kernel_member` ( `ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主键', `CUSTOMER_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '客户ID', From 747b1486a1788d977ddd772f93a2d37d1feaeff4 Mon Sep 17 00:00:00 2001 From: YUJT Date: Mon, 9 May 2022 09:46:45 +0800 Subject: [PATCH 04/10] =?UTF-8?q?=E8=A1=A5=E5=85=85readme=E5=86=85?= =?UTF-8?q?=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a7fa5e2..7825a20 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,17 @@ ## epmet-plugins -党群e事通插件/外挂服务模块后端代码库 +**代码仓库描述:党群e事通插件/外挂服务模块后端代码库** + ### 代码库分支操作说明 + + #### 开发 + - _从**master**分支上,创建新的分支,分支名一般以dev_为前缀。e.g. dev_example(以此为例进行说明)_ + #### 开发环境部署 + - _将dev_example分支的提交合并到**develop**分支上_ + #### 测试环境部署 + - _将dev_example分支的提交合并到**test**分支上_ + #### 生产环境部署 + - _将dev_example分支的提交合并到**master**分支上_ ### 新建插件建议: > 建议在epmet-plugins-module模块下新建插件模块 @@ -9,7 +19,7 @@ >>> 建议新模块的context-path以'/pli/'为前缀 ### 私服依赖下载 - > 本地maven的settings.xml文件,在标签下新建子元素,在account与password处,填入私服的账号密码 + > 本地maven的settings.xml文件,在<**servers**>标签下新建子元素,在account与password处,填入私服的账号密码 ```xml epmet @@ -17,7 +27,7 @@ ${password} ``` - > 本地maven的settings.xml文件,在标签下新建子元素 + > 本地maven的settings.xml文件,在<**mirrors**>标签下新建子元素 ```xml epmet From 0351a453e8993036d89d9cffa8265622320cf3db Mon Sep 17 00:00:00 2001 From: HAHA Date: Mon, 9 May 2022 14:27:26 +0800 Subject: [PATCH 05/10] =?UTF-8?q?message:=20=E4=B8=BA=E5=85=9A=E5=91=98?= =?UTF-8?q?=E4=B8=AD=E5=BF=83=E6=88=B7=E5=9D=90=E6=A0=87=E9=9B=86=E5=90=88?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B3=A8=E8=A7=A3=20=E4=B8=BA=E5=85=9A?= =?UTF-8?q?=E5=91=98=E4=B8=AD=E5=BF=83=E6=88=B7=E6=95=B0=E5=92=8C=E5=85=9A?= =?UTF-8?q?=E7=BE=A4=E6=9C=8D=E5=8A=A1=E7=AB=99=E6=95=B0=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PowerAxisDataVisualController.java | 3 +- .../modules/axis/dao/PowerAxisStructDao.java | 10 +- .../impl/PowerAxisStructServiceImpl.java | 4 +- .../mapper/poweraxis/PowerAxisStructDao.xml | 106 ++++++++++-------- 4 files changed, 69 insertions(+), 54 deletions(-) diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisDataVisualController.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisDataVisualController.java index d1c1615..63c9820 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisDataVisualController.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisDataVisualController.java @@ -14,6 +14,7 @@ import com.epmet.plugin.power.modules.axis.service.PowerServiceStationService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import javax.validation.Valid; import java.util.List; /*** @@ -129,7 +130,7 @@ public class PowerAxisDataVisualController { * @date 2022/4/23 10:20 */ @PostMapping("kernelHousehold/listPosition") - public Result> getListPosition(@RequestBody PowerKernelListPostitionFormDTO form, @LoginUser TokenDto tokenDto) { + public Result> getListPosition(@Valid @RequestBody PowerKernelListPostitionFormDTO form, @LoginUser TokenDto tokenDto) { ValidatorUtils.validateEntity(form); form.setCustomerId(tokenDto.getCustomerId()); return new Result().ok(powerKernelHouseholdService.getListPosition(form)); diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/dao/PowerAxisStructDao.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/dao/PowerAxisStructDao.java index 401925c..33f6571 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/dao/PowerAxisStructDao.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/dao/PowerAxisStructDao.java @@ -75,19 +75,19 @@ public interface PowerAxisStructDao extends BaseDao { List getIdsByAgencyId(String agencyId, String customerId); - int queryGridParty(@Param("agencyId") String agencyId,@Param("customerId") String customerId,@Param("gridCateGoryCode") String gridCateGoryCode); + int queryGridParty(@Param("agencyId") String agencyId, @Param("customerId") String customerId, @Param("gridCateGoryCode") String gridCateGoryCode); - int queryGroupParty(@Param("agencyId") String agencyId,@Param("customerId") String customerId,@Param("groupCateGoryCode") String groupCateGoryCode); + int queryGroupParty(@Param("agencyId") String agencyId, @Param("customerId") String customerId, @Param("groupCateGoryCode") String groupCateGoryCode); - int getKernelHouseHold(PowerAxisStructViewFormDTO form); + int getKernelHouseHold(@Param("agencyId") String agencyId, @Param("customerId") String customerId); - int getServiceStation(PowerAxisStructViewFormDTO form); + int getServiceStation(@Param("agencyId") String agencyId,@Param("customerId") String customerId); List getStructTree(PowerAxisStructStructTreeFormDTO form); String queryCategoryCode(PowerAxisListPositionFormDTO form); - List querylistPosition(@Param("customerId") String customerId,@Param("code") String code ,@Param("agencyId") String agencyId); + List querylistPosition(@Param("customerId") String customerId, @Param("code") String code, @Param("agencyId") String agencyId); /** * 根据节点接报,组装其上级节点树 diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisStructServiceImpl.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisStructServiceImpl.java index cddd027..5e14c34 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisStructServiceImpl.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisStructServiceImpl.java @@ -237,9 +237,9 @@ public class PowerAxisStructServiceImpl extends BaseServiceImpl select - s.ID, - s.NAME, - s.PID, - s.PIDS, - s.CATEGORY_CODE, - s.SORT, - s.CREATED_TIME, - sl.LEADER_ID, - l.NAME as LEADER_NAME, - l.MOBILE as LEADER_MOBILE, - t.STRUCT_LEVEL + s.ID, + s.NAME, + s.PID, + s.PIDS, + s.CATEGORY_CODE, + s.SORT, + s.CREATED_TIME, + sl.LEADER_ID, + l.NAME as LEADER_NAME, + l.MOBILE as LEADER_MOBILE, + t.STRUCT_LEVEL from pli_power_axis_struct s left join pli_power_axis_struct_leader sl on s.ID = sl.STRUCT_REFERENCE_ID and sl.del_flag = '0' left join pli_power_axis_leader l on l.ID = sl.LEADER_ID and l.del_flag = '0' @@ -66,16 +66,16 @@ - SELECT - count( DISTINCT HOUSE_ID ) + count(*) FROM - pli_power_kernel_household + pli_power_service_station WHERE del_flag = '0' - - + \ No newline at end of file From a5002f1379c08fa7520a8e06232e9a008d83114f Mon Sep 17 00:00:00 2001 From: YUJT Date: Wed, 11 May 2022 09:45:56 +0800 Subject: [PATCH 06/10] update --- .../axis/form/PowerAxisStructViewFormDTO.java | 3 +++ .../form/PowerKernelListPostitionFormDTO.java | 2 +- .../result/PowerAxisStructViewResultDTO.java | 4 ++-- .../PowerAxisDataVisualController.java | 6 ++++-- .../impl/PowerAxisStructServiceImpl.java | 17 +++++++++-------- .../impl/PowerKernelHouseholdServiceImpl.java | 7 ++++++- .../mapper/poweraxis/PowerAxisStructDao.xml | 2 ++ 7 files changed, 27 insertions(+), 14 deletions(-) diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerAxisStructViewFormDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerAxisStructViewFormDTO.java index c22c881..a597f68 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerAxisStructViewFormDTO.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerAxisStructViewFormDTO.java @@ -2,6 +2,7 @@ package com.epmet.plugin.power.dto.axis.form; import lombok.Data; +import javax.validation.constraints.NotBlank; import java.io.Serializable; @Data @@ -11,10 +12,12 @@ public class PowerAxisStructViewFormDTO implements Serializable { /** * 客户id */ + @NotBlank(message = "所属客户不能为空") private String customerId; /** * 组织id */ + @NotBlank(message = "所属组织不能为空") private String agencyId; } diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerKernelListPostitionFormDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerKernelListPostitionFormDTO.java index b2eb8ee..72923d7 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerKernelListPostitionFormDTO.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerKernelListPostitionFormDTO.java @@ -19,7 +19,7 @@ public class PowerKernelListPostitionFormDTO implements Serializable { /** * 条数 */ - private int limit; + private Integer limit; /** * 客户id diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/result/PowerAxisStructViewResultDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/result/PowerAxisStructViewResultDTO.java index 5944990..fafb304 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/result/PowerAxisStructViewResultDTO.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/result/PowerAxisStructViewResultDTO.java @@ -22,7 +22,7 @@ public class PowerAxisStructViewResultDTO implements Serializable { /** * 党员数 */ - private int partyMemberNum; +// private int partyMemberNum; /** * 党员中心户数 @@ -37,5 +37,5 @@ public class PowerAxisStructViewResultDTO implements Serializable { /** * 志愿队伍数 */ - private int volunteerTeamNum; +// private int volunteerTeamNum; } diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisDataVisualController.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisDataVisualController.java index 63c9820..a9de19f 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisDataVisualController.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisDataVisualController.java @@ -60,7 +60,9 @@ public class PowerAxisDataVisualController { * @date 2022/4/23 10:20 */ @PostMapping("axis/statistics") - public Result getStatistics(@RequestBody PowerAxisStructViewFormDTO form) { + public Result getStatistics(@RequestBody PowerAxisStructViewFormDTO form, @LoginUser TokenDto tokenDto) { + form.setCustomerId(tokenDto.getCustomerId()); + ValidatorUtils.validateEntity(form); PowerAxisStructViewResultDTO result = powerAxisStructService.getStatistics(form); return new Result().ok(result); } @@ -130,7 +132,7 @@ public class PowerAxisDataVisualController { * @date 2022/4/23 10:20 */ @PostMapping("kernelHousehold/listPosition") - public Result> getListPosition(@Valid @RequestBody PowerKernelListPostitionFormDTO form, @LoginUser TokenDto tokenDto) { + public Result> getListPosition(@RequestBody PowerKernelListPostitionFormDTO form, @LoginUser TokenDto tokenDto) { ValidatorUtils.validateEntity(form); form.setCustomerId(tokenDto.getCustomerId()); return new Result().ok(powerKernelHouseholdService.getListPosition(form)); diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisStructServiceImpl.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisStructServiceImpl.java index 5e14c34..df6c554 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisStructServiceImpl.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisStructServiceImpl.java @@ -31,6 +31,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import javax.validation.constraints.NotBlank; import java.util.Arrays; import java.util.List; import java.util.Map; @@ -227,19 +228,19 @@ public class PowerAxisStructServiceImpl extends BaseServiceImpl getListPosition(PowerKernelListPostitionFormDTO form) { - return baseDao.queryListPosition(form.getAxisStructId(), form.getCustomerId(), form.getLimit()); + Integer limit = form.getLimit(); + if (null == limit || NumConstant.ZERO_L == limit) { + limit = 999; + } + return baseDao.queryListPosition(form.getAxisStructId(), form.getCustomerId(), limit); } @Override diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/poweraxis/PowerAxisStructDao.xml b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/poweraxis/PowerAxisStructDao.xml index 7b8d66f..a3e9c5e 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/poweraxis/PowerAxisStructDao.xml +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/poweraxis/PowerAxisStructDao.xml @@ -131,6 +131,7 @@ CATEGORY_CODE = #{gridCateGoryCode} AND customer_id = #{customerId} + AND del_flag = '0' From af4e96f2873a2db803d908c0109d31e08f6d2513 Mon Sep 17 00:00:00 2001 From: YUJT Date: Wed, 11 May 2022 15:14:48 +0800 Subject: [PATCH 08/10] update --- .../power/dto/axis/form/PowerKernelListPostitionFormDTO.java | 1 + .../modules/axis/controller/PowerAxisDataVisualController.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerKernelListPostitionFormDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerKernelListPostitionFormDTO.java index 72923d7..3468172 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerKernelListPostitionFormDTO.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerKernelListPostitionFormDTO.java @@ -24,5 +24,6 @@ public class PowerKernelListPostitionFormDTO implements Serializable { /** * 客户id */ + @NotBlank(message = "所属客户不能为空") private String customerId; } diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisDataVisualController.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisDataVisualController.java index a9de19f..34a69fe 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisDataVisualController.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisDataVisualController.java @@ -133,8 +133,8 @@ public class PowerAxisDataVisualController { */ @PostMapping("kernelHousehold/listPosition") public Result> getListPosition(@RequestBody PowerKernelListPostitionFormDTO form, @LoginUser TokenDto tokenDto) { - ValidatorUtils.validateEntity(form); form.setCustomerId(tokenDto.getCustomerId()); + ValidatorUtils.validateEntity(form); return new Result().ok(powerKernelHouseholdService.getListPosition(form)); } From 717f5f82fa2d1ef4c0d6413efa7b3682d5ed6ffb Mon Sep 17 00:00:00 2001 From: HAHA Date: Wed, 11 May 2022 15:51:51 +0800 Subject: [PATCH 09/10] =?UTF-8?q?message:=E4=BF=AE=E6=94=B9=E5=85=9A?= =?UTF-8?q?=E5=91=98=E4=B8=AD=E5=BF=83=E6=88=B7=E5=9D=90=E6=A0=87=E9=9B=86?= =?UTF-8?q?=E5=90=88=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../axis/form/PowerKernelListPostitionFormDTO.java | 4 +++- .../modules/axis/dao/PowerKernelHouseholdDao.java | 2 ++ .../service/impl/PowerKernelHouseholdServiceImpl.java | 8 +++++++- .../mapper/poweraxis/PowerKernelHouseholdDao.xml | 11 +++++++++++ 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerKernelListPostitionFormDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerKernelListPostitionFormDTO.java index 3468172..3486538 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerKernelListPostitionFormDTO.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerKernelListPostitionFormDTO.java @@ -13,7 +13,6 @@ public class PowerKernelListPostitionFormDTO implements Serializable { /** * 动力主轴id */ - @NotBlank(message = "动力主轴节点不能为空") private String axisStructId; /** @@ -26,4 +25,7 @@ public class PowerKernelListPostitionFormDTO implements Serializable { */ @NotBlank(message = "所属客户不能为空") private String customerId; + + @NotBlank(message = "所属组织不能为空") + private String agencyId; } diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/dao/PowerKernelHouseholdDao.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/dao/PowerKernelHouseholdDao.java index 1509ff5..d77247e 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/dao/PowerKernelHouseholdDao.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/dao/PowerKernelHouseholdDao.java @@ -54,4 +54,6 @@ public interface PowerKernelHouseholdDao extends BaseDao getPage(Map params); + String queryAxisStructId(@Param("agencyId") String agencyId, + @Param("customerId") String customerId); } \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerKernelHouseholdServiceImpl.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerKernelHouseholdServiceImpl.java index 198ead8..453bd88 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerKernelHouseholdServiceImpl.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerKernelHouseholdServiceImpl.java @@ -31,6 +31,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import javax.validation.constraints.NotBlank; import java.math.BigDecimal; import java.util.*; import java.util.stream.Collectors; @@ -144,7 +145,12 @@ public class PowerKernelHouseholdServiceImpl extends BaseServiceImpl + \ No newline at end of file From 85811157ef4ef26950eadc969d75148c68093f80 Mon Sep 17 00:00:00 2001 From: YUJT Date: Thu, 12 May 2022 10:46:57 +0800 Subject: [PATCH 10/10] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=83=A8=E5=88=86?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/plugin/commons/utils/NumUtils.java | 30 +++++++++++++++++++ .../form/PowerAxisServiceStationFormDTO.java | 9 +++++- .../PowerKernelHouseHoldViewListFormDTO.java | 15 ++++++++-- .../PowerAxisDataVisualController.java | 9 ++++-- .../PowerServiceStationController.java | 5 +++- .../modules/axis/dao/PowerAxisStructDao.java | 16 +++++++++- .../axis/dao/PowerKernelHouseholdDao.java | 2 -- .../axis/service/PowerAxisStructService.java | 15 ++++++++-- .../impl/PowerAxisStructServiceImpl.java | 23 +++++++------- .../impl/PowerKernelHouseholdServiceImpl.java | 28 +++++++++-------- .../impl/PowerServiceStationServiceImpl.java | 18 ++++++----- .../mapper/poweraxis/PowerAxisStructDao.xml | 13 ++++++++ .../poweraxis/PowerKernelHouseholdDao.xml | 15 ++-------- 13 files changed, 142 insertions(+), 56 deletions(-) create mode 100644 epmet-plugins-common/src/main/java/com/epmet/plugin/commons/utils/NumUtils.java diff --git a/epmet-plugins-common/src/main/java/com/epmet/plugin/commons/utils/NumUtils.java b/epmet-plugins-common/src/main/java/com/epmet/plugin/commons/utils/NumUtils.java new file mode 100644 index 0000000..58dfec3 --- /dev/null +++ b/epmet-plugins-common/src/main/java/com/epmet/plugin/commons/utils/NumUtils.java @@ -0,0 +1,30 @@ +package com.epmet.plugin.commons.utils; + +import com.epmet.commons.tools.constant.NumConstant; + +/*** + * 数字处理相关通用方法 + * @author work@yujt.net.cn + * @date 2022/5/12/0012 10:02 + */ +public class NumUtils { + + public final static int ONE_THOUSAND = 1000; + + /** + * 获取数值 + * + * @param number 数值,可能为空 + * @param excludeZero 数字不能为0 + * @param defaultNumber 默认值(数字为空值时 或 数值为0但excludeZero == true 时,使用默认值) + * @return int + * @author work@yujt.net.cn + * @date 2022/5/12/0012 10:11 + */ + public static int getNumberInt(Integer number, boolean excludeZero, int defaultNumber) { + if (null == number || (excludeZero && NumConstant.ZERO == number)) { + return defaultNumber; + } + return number; + } +} diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerAxisServiceStationFormDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerAxisServiceStationFormDTO.java index eb088e2..86cd108 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerAxisServiceStationFormDTO.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerAxisServiceStationFormDTO.java @@ -2,6 +2,7 @@ package com.epmet.plugin.power.dto.axis.form; import lombok.Data; +import javax.validation.constraints.NotBlank; import java.io.Serializable; @Data @@ -9,7 +10,7 @@ public class PowerAxisServiceStationFormDTO implements Serializable { private static final long serialVersionUID = -8446905334792655596L; /** - *动力主轴节点id + * 动力主轴节点id */ private String axisStructId; /** @@ -19,5 +20,11 @@ public class PowerAxisServiceStationFormDTO implements Serializable { /** * 客户id */ + @NotBlank(message = "所属客户不能为空") private String customerId; + /** + * 组织id + */ + @NotBlank(message = "所属组织不能为空") + private String agencyId; } diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerKernelHouseHoldViewListFormDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerKernelHouseHoldViewListFormDTO.java index c6ef16e..6f68885 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerKernelHouseHoldViewListFormDTO.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerKernelHouseHoldViewListFormDTO.java @@ -2,6 +2,8 @@ package com.epmet.plugin.power.dto.axis.form; import lombok.Data; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; import java.io.Serializable; @Data @@ -17,15 +19,24 @@ public class PowerKernelHouseHoldViewListFormDTO implements Serializable { /** * 页码 */ - private int pageNo; + @NotNull(message = "页码不能为空") + private Integer pageNo; /** * 条数 */ - private int pageSize; + @NotNull(message = "页容量不能为空") + private Integer pageSize; + + /** + * 组织id + */ + @NotBlank(message = "所属组织不能为空") + private String agencyId; /** * 客户id */ + @NotBlank(message = "所属客户不能为空") private String customerId; } diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisDataVisualController.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisDataVisualController.java index 34a69fe..8242c23 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisDataVisualController.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisDataVisualController.java @@ -14,7 +14,6 @@ import com.epmet.plugin.power.modules.axis.service.PowerServiceStationService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; -import javax.validation.Valid; import java.util.List; /*** @@ -47,7 +46,9 @@ public class PowerAxisDataVisualController { * @date 2022/4/22 19:53 */ @PostMapping("serviceStation/listPosition") - public Result> getListPostition(@RequestBody PowerAxisServiceStationFormDTO form) { + public Result> getListPostition(@RequestBody PowerAxisServiceStationFormDTO form, @LoginUser TokenDto tokenDto) { + form.setCustomerId(tokenDto.getCustomerId()); + ValidatorUtils.validateEntity(form); return new Result().ok(powerServiceStationService.getListPosition(form)); } @@ -118,7 +119,9 @@ public class PowerAxisDataVisualController { * @date 2022/4/23 10:20 */ @PostMapping("kernelHousehold/list") - public ResultDTO getList(@RequestBody PowerKernelHouseHoldViewListFormDTO form) { + public ResultDTO getList(@RequestBody PowerKernelHouseHoldViewListFormDTO form, @LoginUser TokenDto tokenDto) { + form.setCustomerId(tokenDto.getCustomerId()); + ValidatorUtils.validateEntity(form); List dto = powerKernelHouseholdService.getList(form); return ResultDTO.success("查询成功", dto, powerKernelHouseholdService.getTotal(form)); } diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerServiceStationController.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerServiceStationController.java index cc183e1..61d5ba9 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerServiceStationController.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerServiceStationController.java @@ -1,8 +1,10 @@ package com.epmet.plugin.power.modules.axis.controller; +import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.aop.NoRepeatSubmit; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.AssertUtils; @@ -48,7 +50,8 @@ public class PowerServiceStationController { @NoRepeatSubmit @PostMapping("save") - public Result save(@RequestBody PowerServiceStationDTO dto){ + public Result save(@RequestBody PowerServiceStationDTO dto, @LoginUser TokenDto tokenDto){ + dto.setCustomerId(tokenDto.getCustomerId()); //效验数据 ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); powerServiceStationService.save(dto); diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/dao/PowerAxisStructDao.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/dao/PowerAxisStructDao.java index 33f6571..d4831d5 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/dao/PowerAxisStructDao.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/dao/PowerAxisStructDao.java @@ -81,7 +81,7 @@ public interface PowerAxisStructDao extends BaseDao { int getKernelHouseHold(@Param("agencyId") String agencyId, @Param("customerId") String customerId); - int getServiceStation(@Param("agencyId") String agencyId,@Param("customerId") String customerId); + int getServiceStation(@Param("agencyId") String agencyId, @Param("customerId") String customerId); List getStructTree(PowerAxisStructStructTreeFormDTO form); @@ -111,4 +111,18 @@ public interface PowerAxisStructDao extends BaseDao { * @date 2022/4/24 19:29 */ String getCateGoryCode(String customerId, int level, String tagCateGory); + + /** + * 查询动力主轴跟节点 + * + * @param customerId 客户 + * @param agencyId 组织 + * @param structLevel 级别 {@link com.epmet.plugin.power.enums.PowerTagLevelEnum#ROOT} + * @return java.lang.String + * @author work@yujt.net.cn + * @date 2022/5/12/0012 9:52 + */ + String getRootAxisStructId(@Param("customerId") String customerId, + @Param("agencyId") String agencyId, + @Param("structLevel") int structLevel); } \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/dao/PowerKernelHouseholdDao.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/dao/PowerKernelHouseholdDao.java index d77247e..1509ff5 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/dao/PowerKernelHouseholdDao.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/dao/PowerKernelHouseholdDao.java @@ -54,6 +54,4 @@ public interface PowerKernelHouseholdDao extends BaseDao getPage(Map params); - String queryAxisStructId(@Param("agencyId") String agencyId, - @Param("customerId") String customerId); } \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/PowerAxisStructService.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/PowerAxisStructService.java index 29a10ef..557dd09 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/PowerAxisStructService.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/PowerAxisStructService.java @@ -122,7 +122,6 @@ public interface PowerAxisStructService extends BaseService getIdByAgencyId(String agencyId); /** - * * 关键指标统计 * * @param form @@ -142,7 +141,7 @@ public interface PowerAxisStructService extends BaseService getStructTree(PowerAxisStructStructTreeFormDTO form); - List getListPosition(int structLevel,PowerAxisDataListPositionFormDTO form); + List getListPosition(int structLevel, PowerAxisDataListPositionFormDTO form); /** * 根据节点接报,组装其上级节点树 @@ -154,4 +153,16 @@ public interface PowerAxisStructService extends BaseService listParentTreeByLevel(String structLevel, String customerId); + + /** + * 获取动力主轴根节点ID + * + * @param rootStructId 根节点ID,不为空直接返回该值 + * @param customerId 客户 + * @param agencyId 组织 + * @return java.lang.String + * @author work@yujt.net.cn + * @date 2022/5/12/0012 10:26 + */ + String getRootAxisStructId(String rootStructId, String customerId, String agencyId); } \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisStructServiceImpl.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisStructServiceImpl.java index df6c554..34bad4f 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisStructServiceImpl.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisStructServiceImpl.java @@ -10,12 +10,11 @@ import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.redis.common.CustomerOrgRedis; +import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; import com.epmet.commons.tools.security.user.LoginUserUtil; import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.TreeUtils; -import com.epmet.dto.CustomerAgencyDTO; -import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.plugin.power.dto.axis.PowerAxisStructDTO; import com.epmet.plugin.power.dto.axis.form.*; import com.epmet.plugin.power.dto.axis.result.*; @@ -31,7 +30,6 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; -import javax.validation.constraints.NotBlank; import java.util.Arrays; import java.util.List; import java.util.Map; @@ -45,9 +43,6 @@ import java.util.Map; @Service public class PowerAxisStructServiceImpl extends BaseServiceImpl implements PowerAxisStructService { - @Autowired - private GovOrgOpenFeignClient govOrgOpenFeignClient; - @Autowired private PowerAxisTagService powerAxisTagService; @@ -186,11 +181,7 @@ public class PowerAxisStructServiceImpl extends BaseServiceImpl agencyInfoResult = govOrgOpenFeignClient.getAgencyById(agencyId); - if (!agencyInfoResult.success()) { - throw new EpmetException(agencyInfoResult.getCode(), agencyInfoResult.getMsg()); - } - CustomerAgencyDTO agencyInfo = agencyInfoResult.getData(); + AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(agencyId); struct.setAgencyId(agencyInfo.getId()); struct.setAgencyName(agencyInfo.getOrganizationName()); struct.setAgencyType(agencyInfo.getLevel()); @@ -275,4 +266,12 @@ public class PowerAxisStructServiceImpl extends BaseServiceImpl result = baseDao.listParentTreeByLevel(Integer.parseInt(structLevel), customerId); return TreeUtils.build(result); } + + @Override + public String getRootAxisStructId(String rootStructId, String customerId, String agencyId) { + if (StringUtils.isNotBlank(rootStructId)) { + return rootStructId; + } + return baseDao.getRootAxisStructId(customerId, agencyId, PowerTagLevelEnum.ROOT.level()); + } } \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerKernelHouseholdServiceImpl.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerKernelHouseholdServiceImpl.java index 453bd88..579b5b5 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerKernelHouseholdServiceImpl.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerKernelHouseholdServiceImpl.java @@ -15,6 +15,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.dto.IcHouseDTO; import com.epmet.dto.result.HouseInfoDTO; import com.epmet.feign.GovOrgOpenFeignClient; +import com.epmet.plugin.commons.utils.NumUtils; import com.epmet.plugin.power.dto.axis.PowerKernelHouseholdDTO; import com.epmet.plugin.power.dto.axis.form.PowerKernelHouseFormDTO; import com.epmet.plugin.power.dto.axis.form.PowerKernelHouseHoldViewListFormDTO; @@ -24,14 +25,15 @@ import com.epmet.plugin.power.dto.axis.result.PowerKernelListPostitionResultDTO; import com.epmet.plugin.power.dto.axis.result.PowerkernelMemberListResultDTO; import com.epmet.plugin.power.modules.axis.dao.PowerKernelHouseholdDao; import com.epmet.plugin.power.modules.axis.entity.PowerKernelHouseholdEntity; +import com.epmet.plugin.power.modules.axis.service.PowerAxisStructService; import com.epmet.plugin.power.modules.axis.service.PowerKernelHouseholdService; import com.google.common.collect.Sets; +import org.apache.commons.compress.utils.Lists; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import javax.validation.constraints.NotBlank; import java.math.BigDecimal; import java.util.*; import java.util.stream.Collectors; @@ -54,6 +56,9 @@ public class PowerKernelHouseholdServiceImpl extends BaseServiceImpl page(Map params) { @@ -123,8 +128,12 @@ public class PowerKernelHouseholdServiceImpl extends BaseServiceImpl getList(PowerKernelHouseHoldViewListFormDTO form) { - form.setPageNo((form.getPageNo() - 1) * form.getPageSize()); - form.setCustomerId(loginUserUtil.getLoginUserCustomerId()); + String axisStructId = powerAxisStructService.getRootAxisStructId(form.getAxisStructId(), form.getCustomerId(), form.getAgencyId()); + if (StringUtils.isBlank(axisStructId)) { + return Lists.newArrayList(); + } + form.setAxisStructId(axisStructId); + form.setPageNo((form.getPageNo() - NumConstant.ONE) * form.getPageSize()); List list = baseDao.getList(form); for (PowerKernelHouseHoldViewListResultDTO dto : list) { List nameList = dto.getKernelMemberList().stream().map(PowerkernelMemberListResultDTO::getKernelMemberName).distinct().collect(Collectors.toList()); @@ -135,22 +144,17 @@ public class PowerKernelHouseholdServiceImpl extends BaseServiceImpl getListPosition(PowerKernelListPostitionFormDTO form) { - Integer limit = form.getLimit(); - if (null == limit || NumConstant.ZERO_L == limit) { - limit = 999; - } - String axisStructId = form.getAxisStructId(); + String customerId = form.getCustomerId(); + String axisStructId = powerAxisStructService.getRootAxisStructId(form.getAxisStructId(), customerId, form.getAgencyId()); if (StringUtils.isBlank(axisStructId)) { - String agencyId = form.getAgencyId(); - axisStructId = baseDao.queryAxisStructId(agencyId,form.getCustomerId()); + return Lists.newArrayList(); } - return baseDao.queryListPosition(axisStructId, form.getCustomerId(), limit); + return baseDao.queryListPosition(axisStructId, customerId, NumUtils.getNumberInt(form.getLimit(), true, NumUtils.ONE_THOUSAND)); } @Override diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerServiceStationServiceImpl.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerServiceStationServiceImpl.java index 41268f5..379cf79 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerServiceStationServiceImpl.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerServiceStationServiceImpl.java @@ -6,14 +6,16 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.page.PageData; -import com.epmet.commons.tools.security.user.LoginUserUtil; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.plugin.commons.utils.NumUtils; import com.epmet.plugin.power.dto.axis.PowerServiceStationDTO; import com.epmet.plugin.power.dto.axis.form.PowerAxisServiceStationFormDTO; import com.epmet.plugin.power.dto.axis.result.PowerAxisServiceStationResultDTO; import com.epmet.plugin.power.modules.axis.dao.PowerServiceStationDao; import com.epmet.plugin.power.modules.axis.entity.PowerServiceStationEntity; +import com.epmet.plugin.power.modules.axis.service.PowerAxisStructService; import com.epmet.plugin.power.modules.axis.service.PowerServiceStationService; +import org.apache.commons.compress.utils.Lists; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -32,9 +34,8 @@ import java.util.Map; @Service public class PowerServiceStationServiceImpl extends BaseServiceImpl implements PowerServiceStationService { - @Autowired - private LoginUserUtil loginUser; + private PowerAxisStructService powerAxisStructService; @Override public PageData page(Map params) { @@ -74,7 +75,6 @@ public class PowerServiceStationServiceImpl extends BaseServiceImpl getListPosition(PowerAxisServiceStationFormDTO form) { - form.setCustomerId(loginUser.getLoginUserCustomerId()); - List list = baseDao.getListPosition(form); - return list; + String axisStructId = powerAxisStructService.getRootAxisStructId(form.getAxisStructId(), form.getCustomerId(), form.getAgencyId()); + if (StringUtils.isBlank(axisStructId)) { + return Lists.newArrayList(); + } + form.setAxisStructId(axisStructId); + form.setLimit(NumUtils.getNumberInt(form.getLimit(), true, NumUtils.ONE_THOUSAND)); + return baseDao.getListPosition(form); } } \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/poweraxis/PowerAxisStructDao.xml b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/poweraxis/PowerAxisStructDao.xml index 7dc6687..3db8a0e 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/poweraxis/PowerAxisStructDao.xml +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/poweraxis/PowerAxisStructDao.xml @@ -244,6 +244,19 @@ AND s.AGENCY_ID = #{agencyId} AND h.CUSTOMER_ID = #{customerId} + \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/poweraxis/PowerKernelHouseholdDao.xml b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/poweraxis/PowerKernelHouseholdDao.xml index de66e46..ae3fce4 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/poweraxis/PowerKernelHouseholdDao.xml +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/poweraxis/PowerKernelHouseholdDao.xml @@ -128,7 +128,8 @@ GROUP BY h.HOUSE_ID ORDER BY - s.SORT + s.SORT,h.CREATED_TIME + LIMIT #{limit} @@ -171,17 +172,5 @@ ORDER BY h.CREATED_TIME - - \ No newline at end of file