Browse Source

Merge branch 'develop' into dev_contract

develop
zhangyuan 4 years ago
parent
commit
503684799e
  1. 16
      README.md
  2. 30
      epmet-plugins-common/src/main/java/com/epmet/plugin/commons/utils/NumUtils.java
  3. 9
      epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerAxisServiceStationFormDTO.java
  4. 3
      epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerAxisStructViewFormDTO.java
  5. 15
      epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerKernelHouseHoldViewListFormDTO.java
  6. 7
      epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerKernelListPostitionFormDTO.java
  7. 4
      epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/result/PowerAxisStructViewResultDTO.java
  8. 19
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisDataVisualController.java
  9. 5
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerServiceStationController.java
  10. 24
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/dao/PowerAxisStructDao.java
  11. 15
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/PowerAxisStructService.java
  12. 38
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisStructServiceImpl.java
  13. 25
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerKernelHouseholdServiceImpl.java
  14. 18
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerServiceStationServiceImpl.java
  15. 39
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/db/migration/V0.0.3__kernelmember.sql
  16. 123
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/poweraxis/PowerAxisStructDao.xml
  17. 4
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/poweraxis/PowerKernelHouseholdDao.xml

16
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文件,在<servers>标签下新建子元素,在account与password处,填入私服的账号密码
> 本地maven的settings.xml文件,在<**servers**>标签下新建子元素,在account与password处,填入私服的账号密码
```xml
<server>
<id>epmet</id>
@ -17,7 +27,7 @@
<password>${password}</password>
</server>
```
> 本地maven的settings.xml文件,在<mirrors>标签下新建子元素
> 本地maven的settings.xml文件,在<**mirrors**>标签下新建子元素
```xml
<mirror>
<id>epmet</id>

30
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;
}
}

9
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;
}

3
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;
}

15
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;
}

7
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;
}

4
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;
}

19
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<List<PowerAxisServiceStationResultDTO>> getListPostition(@RequestBody PowerAxisServiceStationFormDTO form) {
public Result<List<PowerAxisServiceStationResultDTO>> 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<PowerKernelHouseHoldViewListResultDTO> 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<List<PowerKernelListPostitionResultDTO>> getListPosition(@RequestBody PowerKernelListPostitionFormDTO form) {
public Result<List<PowerKernelListPostitionResultDTO>> getListPosition(@RequestBody PowerKernelListPostitionFormDTO form, @LoginUser TokenDto tokenDto) {
form.setCustomerId(tokenDto.getCustomerId());
ValidatorUtils.validateEntity(form);
return new Result().ok(powerKernelHouseholdService.getListPosition(form));
}

5
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);

24
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<PowerAxisStructEntity> {
List<String> 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<PowerAxisStructTreeResultDTO> getStructTree(PowerAxisStructStructTreeFormDTO form);
String queryCategoryCode(PowerAxisListPositionFormDTO form);
List<PowerAxisListPositionResultDTO> querylistPosition(@Param("customerId") String customerId,@Param("code") String code ,@Param("agencyId") String agencyId);
List<PowerAxisListPositionResultDTO> querylistPosition(@Param("customerId") String customerId, @Param("code") String code, @Param("agencyId") String agencyId);
/**
* 根据节点接报组装其上级节点树
@ -111,4 +111,18 @@ public interface PowerAxisStructDao extends BaseDao<PowerAxisStructEntity> {
* @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);
}

15
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<PowerAxisStructEntit
List<String> getIdByAgencyId(String agencyId);
/**
*
* 关键指标统计
*
* @param form
@ -142,7 +141,7 @@ public interface PowerAxisStructService extends BaseService<PowerAxisStructEntit
*/
List<PowerAxisStructTreeResultDTO> getStructTree(PowerAxisStructStructTreeFormDTO form);
List<PowerAxisListPositionResultDTO> getListPosition(int structLevel,PowerAxisDataListPositionFormDTO form);
List<PowerAxisListPositionResultDTO> getListPosition(int structLevel, PowerAxisDataListPositionFormDTO form);
/**
* 根据节点接报组装其上级节点树
@ -154,4 +153,16 @@ public interface PowerAxisStructService extends BaseService<PowerAxisStructEntit
* @date 2022/4/23/0023 14:37
*/
List<PowerAxisStructTreeResultDTO> 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);
}

38
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<PowerAxisStructDao, PowerAxisStructEntity> implements PowerAxisStructService {
@Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Autowired
private PowerAxisTagService powerAxisTagService;
@ -185,11 +181,7 @@ public class PowerAxisStructServiceImpl extends BaseServiceImpl<PowerAxisStructD
}
if (NumConstant.ZERO_STR.equals(pid)) {
// 新增顶级节点
Result<CustomerAgencyDTO> 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<PowerAxisStructD
@Override
public PowerAxisStructViewResultDTO getStatistics(PowerAxisStructViewFormDTO form) {
form.setCustomerId(loginUserUtil.getLoginUserCustomerId());
String customerId = form.getCustomerId();
String agencyId = form.getAgencyId();
// 查网格党支部数 grid_party
String gridCateGoryCode = baseDao.getCateGoryCode(form.getCustomerId(), PowerTagLevelEnum.CHILD_FIRST.level(), PowerTagCategoryEnum.STRUCT.category());
int gridParty = baseDao.queryGridParty(form.getAgencyId(), form.getCustomerId(), gridCateGoryCode);
String gridCateGoryCode = baseDao.getCateGoryCode(customerId, PowerTagLevelEnum.CHILD_FIRST.level(), PowerTagCategoryEnum.STRUCT.category());
int gridParty = baseDao.queryGridParty(agencyId, customerId, gridCateGoryCode);
// 查楼院党小组数 group_party
String groupCateGoryCode = baseDao.getCateGoryCode(form.getCustomerId(), PowerTagLevelEnum.CHILD_SECOND.level(), PowerTagCategoryEnum.STRUCT.category());
int groupParty = baseDao.queryGroupParty(form.getAgencyId(), form.getCustomerId(), groupCateGoryCode);
String groupCateGoryCode = baseDao.getCateGoryCode(customerId, PowerTagLevelEnum.CHILD_SECOND.level(), PowerTagCategoryEnum.STRUCT.category());
int groupParty = baseDao.queryGroupParty(agencyId, customerId, groupCateGoryCode);
// 查询党员中心户数
int kernelHouseHold = baseDao.getKernelHouseHold(form);
int kernelHouseHold = baseDao.getKernelHouseHold(agencyId, customerId);
// 查询服务站数
int serviceStation = baseDao.getServiceStation(form);
int serviceStation = baseDao.getServiceStation(agencyId, customerId);
PowerAxisStructViewResultDTO result = new PowerAxisStructViewResultDTO();
result.setGridNum(gridParty);
@ -274,4 +266,12 @@ public class PowerAxisStructServiceImpl extends BaseServiceImpl<PowerAxisStructD
List<PowerAxisStructTreeResultDTO> 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());
}
}

25
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<PowerKernel
@Autowired
private PowerKernelHouseholdService powerKernelHouseholdService;
@Autowired
private PowerAxisStructService powerAxisStructService;
@Override
public PageData<PowerKernelHouseholdDTO> page(Map<String, Object> params) {
@ -123,8 +128,12 @@ public class PowerKernelHouseholdServiceImpl extends BaseServiceImpl<PowerKernel
*/
@Override
public List<PowerKernelHouseHoldViewListResultDTO> 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<PowerKernelHouseHoldViewListResultDTO> list = baseDao.getList(form);
for (PowerKernelHouseHoldViewListResultDTO dto : list) {
List<String> nameList = dto.getKernelMemberList().stream().map(PowerkernelMemberListResultDTO::getKernelMemberName).distinct().collect(Collectors.toList());
@ -135,13 +144,17 @@ public class PowerKernelHouseholdServiceImpl extends BaseServiceImpl<PowerKernel
@Override
public long getTotal(PowerKernelHouseHoldViewListFormDTO form) {
form.setCustomerId(loginUserUtil.getLoginUserCustomerId());
return baseDao.getTotal(form);
}
@Override
public List<PowerKernelListPostitionResultDTO> 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

18
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<PowerServiceStationDao, PowerServiceStationEntity> implements PowerServiceStationService {
@Autowired
private LoginUserUtil loginUser;
private PowerAxisStructService powerAxisStructService;
@Override
public PageData<PowerServiceStationDTO> page(Map<String, Object> params) {
@ -74,7 +75,6 @@ public class PowerServiceStationServiceImpl extends BaseServiceImpl<PowerService
@Override
@Transactional(rollbackFor = Exception.class)
public void save(PowerServiceStationDTO dto) {
dto.setCustomerId(loginUser.getLoginUserCustomerId());
PowerServiceStationEntity entity = ConvertUtils.sourceToTarget(dto, PowerServiceStationEntity.class);
insert(entity);
}
@ -95,9 +95,13 @@ public class PowerServiceStationServiceImpl extends BaseServiceImpl<PowerService
@Override
public List<PowerAxisServiceStationResultDTO> getListPosition(PowerAxisServiceStationFormDTO form) {
form.setCustomerId(loginUser.getLoginUserCustomerId());
List<PowerAxisServiceStationResultDTO> 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);
}
}

39
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;

123
epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/poweraxis/PowerAxisStructDao.xml

@ -35,17 +35,17 @@
<select id="selectAllForTree"
resultType="com.epmet.plugin.power.dto.axis.result.PowerAxisStructLeaderResultDTO">
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 id="queryDeptByName" resultType="com.epmet.plugin.power.dto.axis.result.PowerAxisStructResultDTO">
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
<where>
1 = 1
<if test="name != null and name != ''">
@ -84,38 +84,38 @@
<if test="agencyId != null and agencyId != ''">
and AGENCY_ID = #{agencyId}
</if>
and del_flag = 0
and customer_id = #{customerId}
and del_flag = 0
and customer_id = #{customerId}
</where>
</select>
<select id="countRepeatStructByName" resultType="java.lang.Integer">
SELECT
count(*)
count(*)
FROM
pli_power_axis_struct s
pli_power_axis_struct s
WHERE
s.CUSTOMER_ID = #{customerId}
AND s.`NAME` = #{name}
<choose>
<when test="agencyId != null and agencyId != ''">AND s.AGENCY_ID = #{agencyId}</when>
<otherwise>
<if test="pid != null and pid != '' and pid != '0'">
AND s.AGENCY_ID = (SELECT t.agency_id FROM pli_power_axis_struct t WHERE t.ID = #{pid})
</if>
</otherwise>
</choose>
<if test="id != null and id != ''">AND s.ID != #{id}</if>
<if test="pid != null and pid != ''">AND s.pid = #{pid}</if>
s.CUSTOMER_ID = #{customerId}
AND s.`NAME` = #{name}
<choose>
<when test="agencyId != null and agencyId != ''">AND s.AGENCY_ID = #{agencyId}</when>
<otherwise>
<if test="pid != null and pid != '' and pid != '0'">
AND s.AGENCY_ID = (SELECT t.agency_id FROM pli_power_axis_struct t WHERE t.ID = #{pid})
</if>
</otherwise>
</choose>
<if test="id != null and id != ''">AND s.ID != #{id}</if>
<if test="pid != null and pid != ''">AND s.pid = #{pid}</if>
</select>
<select id="countRepeatStructByCategory" resultType="java.lang.Integer">
SELECT
count(*)
count(*)
FROM
pli_power_axis_struct
pli_power_axis_struct
WHERE
AGENCY_ID = #{agencyId} and CUSTOMER_ID = #{customerId} and CATEGORY_CODE = #{categoryCode}
<if test="id != null and id != ''">AND id != #{id}</if>
AGENCY_ID = #{agencyId} and CUSTOMER_ID = #{customerId} and CATEGORY_CODE = #{categoryCode}
<if test="id != null and id != ''">AND id != #{id}</if>
</select>
<select id="getIdsByAgencyId" resultType="java.lang.String">
select id from pli_power_axis_struct where agency_id = #{agencyId} and customer_id = #{customerId}
@ -131,6 +131,7 @@
CATEGORY_CODE = #{gridCateGoryCode}
AND
customer_id = #{customerId}
AND del_flag = '0'
</select>
<select id="queryGroupParty" resultType="java.lang.Integer">
SELECT
@ -143,17 +144,20 @@
CATEGORY_CODE = #{groupCateGoryCode}
AND
customer_id = #{customerId}
AND del_flag = '0'
</select>
<select id="getKernelHouseHold" resultType="java.lang.Integer">
<select id="getServiceStation" resultType="java.lang.Integer">
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'
</select>
<select id="getServiceStation" resultType="java.lang.Integer">
select count(*) from pli_power_service_station where del_flag = '0'
h.del_flag = '0'
AND s.AGENCY_ID = #{agencyId}
AND h.CUSTOMER_ID = #{customerId}
</select>
<select id="getStructTree"
resultType="com.epmet.plugin.power.dto.axis.result.PowerAxisStructTreeResultDTO">
@ -228,6 +232,31 @@
AND
STRUCT_LEVEL = #{level}
</select>
<select id="getKernelHouseHold" resultType="java.lang.Integer">
SELECT
count( DISTINCT HOUSE_ID )
FROM
pli_power_kernel_household h
LEFT JOIN pli_power_axis_struct s ON h.STRUCT_REFERENCE_ID = s.ID
AND s.DEL_FLAG = '0'
WHERE
h.del_flag = '0'
AND s.AGENCY_ID = #{agencyId}
AND h.CUSTOMER_ID = #{customerId}
</select>
<select id="getRootAxisStructId" resultType="java.lang.String">
SELECT
s.ID
FROM
pli_power_axis_struct s
LEFT JOIN pli_power_axis_tag t ON s.CATEGORY_CODE = t.CATEGORY_CODE
AND s.CUSTOMER_ID = t.CUSTOMER_ID
WHERE
s.CUSTOMER_ID = #{customerId}
AND s.AGENCY_ID = #{agencyId}
AND s.DEL_FLAG = '0'
AND t.STRUCT_LEVEL = #{structLevel}
</select>
</mapper>

4
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}
</select>
<resultMap id="getPageList" type="com.epmet.plugin.power.dto.axis.PowerKernelHouseholdDTO">
<result property="ownerName" column="OWNER_NAME" />
@ -172,5 +173,4 @@
h.CREATED_TIME
</select>
</mapper>
Loading…
Cancel
Save