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 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/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/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-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..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 @@ -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 @@ -17,10 +18,14 @@ public class PowerKernelListPostitionFormDTO implements Serializable { /** * 条数 */ - private int limit; + private Integer limit; /** * 客户id */ + @NotBlank(message = "所属客户不能为空") private String customerId; + + @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/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 3e246c2..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 @@ -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.*; @@ -43,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)); } @@ -56,7 +61,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); } @@ -112,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)); } @@ -126,7 +135,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) { + form.setCustomerId(tokenDto.getCustomerId()); + ValidatorUtils.validateEntity(form); 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/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 401925c..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 @@ -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); /** * 根据节点接报,组装其上级节点树 @@ -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/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 cddd027..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.*; @@ -44,9 +43,6 @@ import java.util.Map; @Service public class PowerAxisStructServiceImpl extends BaseServiceImpl implements PowerAxisStructService { - @Autowired - private GovOrgOpenFeignClient govOrgOpenFeignClient; - @Autowired private PowerAxisTagService powerAxisTagService; @@ -185,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()); @@ -227,19 +219,19 @@ 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 4938dfb..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 @@ -5,8 +5,8 @@ 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.NumConstant; import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.user.LoginUserUtil; @@ -15,9 +15,9 @@ 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.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; @@ -25,8 +25,10 @@ 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; @@ -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,13 +144,17 @@ public class PowerKernelHouseholdServiceImpl extends BaseServiceImpl getListPosition(PowerKernelListPostitionFormDTO form) { - return baseDao.queryListPosition(form.getAxisStructId(), form.getCustomerId(), form.getLimit()); + String customerId = form.getCustomerId(); + String axisStructId = powerAxisStructService.getRootAxisStructId(form.getAxisStructId(), customerId, form.getAgencyId()); + if (StringUtils.isBlank(axisStructId)) { + return Lists.newArrayList(); + } + 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/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..db7b625 --- /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,39 @@ +/* + 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: 05/05/2022 09:56:08 +*/ + +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; 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 33ce62f..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 @@ -35,17 +35,17 @@ SELECT - CUSTOMER_ID, - NAME, - AGENCY_ID, - AGENCY_NAME, - AGENCY_TYPE, - PID, - PIDS, - CATEGORY_CODE + CUSTOMER_ID, + NAME, + AGENCY_ID, + AGENCY_NAME, + AGENCY_TYPE, + PID, + PIDS, + CATEGORY_CODE FROM - pli_power_axis_struct + pli_power_axis_struct 1 = 1 @@ -84,38 +84,38 @@ and AGENCY_ID = #{agencyId} - and del_flag = 0 - and customer_id = #{customerId} + and del_flag = 0 + and customer_id = #{customerId} - SELECT - count( DISTINCT HOUSE_ID ) + count(*) FROM - pli_power_kernel_household + pli_power_service_station h + LEFT JOIN pli_power_axis_struct s ON h.STRUCT_REFERENCE_ID = s.ID + AND s.DEL_FLAG = '0' WHERE - del_flag = '0' - - + + \ 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 39fa97e..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} @@ -172,5 +173,4 @@ h.CREATED_TIME - \ No newline at end of file