From 7bfaacaa93d9723aa390aa78acaa9932c04090c6 Mon Sep 17 00:00:00 2001 From: YUJT Date: Fri, 22 Apr 2022 19:56:41 +0800 Subject: [PATCH] update --- .../controller/PowerAxisTagController.java | 6 ++- .../modules/axis/dao/PowerAxisStructDao.java | 4 +- .../axis/service/PowerAxisTagService.java | 2 +- .../impl/PowerAxisStructServiceImpl.java | 44 +++++++++++++++++-- .../service/impl/PowerAxisTagServiceImpl.java | 4 +- .../impl/PowerServiceStationServiceImpl.java | 10 +++-- .../mapper/poweraxis/PowerAxisStructDao.xml | 6 +-- 7 files changed, 59 insertions(+), 17 deletions(-) diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisTagController.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisTagController.java index 7cc8a9d..38379a3 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisTagController.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisTagController.java @@ -1,7 +1,9 @@ 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; @@ -88,8 +90,8 @@ public class PowerAxisTagController { * @date 2022/4/18/0018 18:12 */ @PostMapping("listSimple/{tagCategory}") - public Result> listSimple(@PathVariable("tagCategory") String tagCategory) { - return new Result().ok(powerAxisTagService.listSimple(tagCategory)); + public Result> listSimple(@PathVariable("tagCategory") String tagCategory, @LoginUser TokenDto tokenDto) { + return new Result().ok(powerAxisTagService.listSimple(tagCategory, tokenDto.getCustomerId())); } /** 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 85abb87..7660104 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 @@ -60,9 +60,9 @@ public interface PowerAxisStructDao extends BaseDao { List getPartyCommList(); - int countByRepeatStruct(PowerAxisStructEntity form); + int countRepeatStructByName(PowerAxisStructEntity form); - int queryCategory(PowerAxisStructEntity form); + int countRepeatStructByCategory(PowerAxisStructEntity form); List getIdsByAgencyId(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/PowerAxisTagService.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/PowerAxisTagService.java index 3fd1d7a..994b2b1 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/PowerAxisTagService.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/PowerAxisTagService.java @@ -87,7 +87,7 @@ public interface PowerAxisTagService extends BaseService { * @author work@yujt.net.cn * @date 2022/4/18/0018 17:24 */ - List listSimple(String tagCategory); + List listSimple(String tagCategory, String customerId); /** * 查询所有标签 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 b44f13b..2739fde 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 @@ -1,8 +1,10 @@ package com.epmet.plugin.power.modules.axis.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.enums.EpmetDelFlagEnum; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; @@ -23,6 +25,7 @@ import com.epmet.plugin.power.enums.PowerTagCategoryEnum; import com.epmet.plugin.power.enums.PowerTagLevelEnum; import com.epmet.plugin.power.modules.axis.dao.PowerAxisStructDao; import com.epmet.plugin.power.modules.axis.entity.PowerAxisStructEntity; +import com.epmet.plugin.power.modules.axis.entity.PowerAxisTagEntity; import com.epmet.plugin.power.modules.axis.service.PowerAxisStructService; import com.epmet.plugin.power.modules.axis.service.PowerAxisTagService; import org.apache.commons.lang3.StringUtils; @@ -153,11 +156,11 @@ public class PowerAxisStructServiceImpl extends BaseServiceImpl NumConstant.ZERO) { + if (baseDao.countRepeatStructByCategory(struct) > NumConstant.ZERO) { throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "同一组织下只允许存在一个顶级节点"); } } - if (baseDao.countByRepeatStruct(struct) > NumConstant.ZERO) { + if (baseDao.countRepeatStructByName(struct) > NumConstant.ZERO) { throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "同一组织下不允许存在重名的节点"); } } @@ -265,6 +268,7 @@ public class PowerAxisStructServiceImpl extends BaseServiceImpl tagList = powerAxisTagService.listSimple(PowerTagCategoryEnum.PARAM.category(), loginUserUtil.getLoginUserCustomerId()); + tagList.forEach( + item -> { + int numTemp; + switch (item.getCategoryCode()) { + case "volunteerTeamNum": + numTemp = Integer.parseInt(item.getCategoryName()); + if (numTemp > NumConstant.ZERO) { + result.setVolunteerTeamNum(numTemp); + } + break; + case "partyMemberNum": + numTemp = Integer.parseInt(item.getCategoryName()); + if (numTemp > NumConstant.ZERO) { + result.setPartyMemberNum(numTemp); + } + break; + case "kernelHouseHoldNum": + numTemp = Integer.parseInt(item.getCategoryName()); + if (numTemp > NumConstant.ZERO) { + result.setKernelHouseHoldNum(numTemp); + } + break; + default: + break; + } + } + ); + return result; } diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisTagServiceImpl.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisTagServiceImpl.java index f7bd21e..52e0c29 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisTagServiceImpl.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisTagServiceImpl.java @@ -96,7 +96,7 @@ public class PowerAxisTagServiceImpl extends BaseServiceImpl listSimple(String tagCategory) { + public List listSimple(String tagCategory, String customerId) { if (StringUtils.isBlank(tagCategory)) { throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "缺少参数"); @@ -105,7 +105,7 @@ public class PowerAxisTagServiceImpl extends BaseServiceImpl wrapper = new QueryWrapper<>(); wrapper.eq("TAG_CATEGORY", tagCategory) .eq("FORBIDDEN_FLAG", EpmetDelFlagEnum.NORMAL.value()) - .eq(FieldConstant.CUSTOMER_ID, loginUserUtil.getLoginUserCustomerId()) + .eq(FieldConstant.CUSTOMER_ID, customerId) .orderByAsc("STRUCT_LEVEL", FieldConstant.CREATED_TIME); return ConvertUtils.sourceToTarget(baseDao.selectList(wrapper), PowerAxisTagCategoryResultDTO.class); 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 f8d9de1..5143eef 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 @@ -49,11 +49,15 @@ public class PowerServiceStationServiceImpl extends BaseServiceImpl getWrapper(Map params){ - String id = (String)params.get(FieldConstant.ID_HUMP); + private QueryWrapper getWrapper(Map params) { + String id = (String) params.get(FieldConstant.ID_HUMP); + String name = (String) params.get("name"); + String axisStructId = (String) params.get("axisStructId"); QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id) + .eq(StringUtils.isNotBlank(name), "NAME", name) + .eq(StringUtils.isNotBlank(axisStructId), "STRUCT_REFERENCE_ID", name); return wrapper; } 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 86cce05..f70bb55 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 @@ -129,7 +129,7 @@ AND del_flag = 0 - SELECT count(*) FROM @@ -146,13 +146,13 @@ - SELECT count(*) FROM pli_power_axis_struct WHERE - AGENCY_ID = #{agencyId} + AGENCY_ID = #{agencyId} and CUSTOMER_ID = #{customerId} and CATEGORY_CODE = #{categoryCode}