Browse Source

update

dev_power_axis
YUJT 3 years ago
parent
commit
f00a0fdb9d
  1. 5
      epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/result/PowerAxisStructLeaderResultDTO.java
  2. 29
      epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/enums/PowerTagCategoryEnum.java
  3. 34
      epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/enums/PowerTagLevelEnum.java
  4. 10
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisStructController.java
  5. 2
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/PowerAxisStructService.java
  6. 12
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/PowerAxisTagService.java
  7. 44
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisStructServiceImpl.java
  8. 19
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisTagServiceImpl.java
  9. 13
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/logback-spring.xml
  10. 4
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/poweraxis/PowerAxisStructDao.xml

5
epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/result/PowerAxisStructLeaderResultDTO.java

@ -67,4 +67,9 @@ public class PowerAxisStructLeaderResultDTO implements Serializable {
*/ */
private String leaderMobile; private String leaderMobile;
/**
* 对应节点等级 0,1,2
*/
private Integer structLevel;
} }

29
epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/enums/PowerTagCategoryEnum.java

@ -0,0 +1,29 @@
package com.epmet.plugin.power.enums;
/***
* 动力主轴相关标签类别
* @author work@yujt.net.cn
* @date 2022/4/21/0021 17:11
*/
public enum PowerTagCategoryEnum {
/**
* 动力主轴负责人
*/
LEADER("leader"),
/**
* 动力主轴节点
*/
STRUCT("struct");
private String category;
PowerTagCategoryEnum(String category) {
this.category = category;
}
public String category() {
return category;
}
}

34
epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/enums/PowerTagLevelEnum.java

@ -0,0 +1,34 @@
package com.epmet.plugin.power.enums;
import com.epmet.commons.tools.constant.NumConstant;
/***
* 动力主轴相关节点级别
* @author work@yujt.net.cn
* @date 2022/4/21/0021 17:11
*/
public enum PowerTagLevelEnum {
/**
* 顶级节点
*/
ROOT(NumConstant.ZERO),
/**
* 二级节点
*/
CHILD_FIRST(NumConstant.ONE),
/**
* 三级节点
*/
CHILD_SECOND(NumConstant.TWO);
private int level;
PowerTagLevelEnum(int level) {
this.level = level;
}
public int level() {
return level;
}
}

10
epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisStructController.java

@ -17,12 +17,10 @@ import com.epmet.plugin.power.dto.axis.PowerAxisStructDTO;
import com.epmet.plugin.power.dto.axis.form.PowerAxisStructLeaderFormDTO; import com.epmet.plugin.power.dto.axis.form.PowerAxisStructLeaderFormDTO;
import com.epmet.plugin.power.dto.axis.form.PowerAxisStructListByCategoryCodeFormDTO; import com.epmet.plugin.power.dto.axis.form.PowerAxisStructListByCategoryCodeFormDTO;
import com.epmet.plugin.power.dto.axis.result.*; import com.epmet.plugin.power.dto.axis.result.*;
import com.epmet.plugin.power.dto.axis.form.PowerAxisStructAddFormDTO;
import com.epmet.plugin.power.dto.axis.form.PowerAxisStructFormDTO; import com.epmet.plugin.power.dto.axis.form.PowerAxisStructFormDTO;
import com.epmet.plugin.power.modules.axis.entity.PowerAxisStructEntity; import com.epmet.plugin.power.modules.axis.entity.PowerAxisStructEntity;
import com.epmet.plugin.power.modules.axis.excel.PowerAxisStructExcel; import com.epmet.plugin.power.modules.axis.excel.PowerAxisStructExcel;
import com.epmet.plugin.power.modules.axis.service.PowerAxisStructService; import com.epmet.plugin.power.modules.axis.service.PowerAxisStructService;
import oracle.jdbc.proxy.annotation.Post;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -122,13 +120,7 @@ public class PowerAxisStructController {
*/ */
@PostMapping("/addOrg") @PostMapping("/addOrg")
public Result addOrg(@RequestBody PowerAxisStructEntity form){ public Result addOrg(@RequestBody PowerAxisStructEntity form){
int i = powerAxisStructService.addOrg(form); powerAxisStructService.addOrg(form);
if(i == -1){
return new Result().error(1,"名字重复");
}
if(i == -2){
return new Result().error(1,"同一组织下只允许存在一个党委");
}
return new Result(); return new Result();
} }
/** /**

2
epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/PowerAxisStructService.java

@ -102,7 +102,7 @@ public interface PowerAxisStructService extends BaseService<PowerAxisStructEntit
/** /**
* 添加组织 * 添加组织
*/ */
int addOrg(PowerAxisStructEntity form); void addOrg(PowerAxisStructEntity form);
/** /**
* 修改组织 * 修改组织

12
epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/PowerAxisTagService.java

@ -97,4 +97,16 @@ public interface PowerAxisTagService extends BaseService<PowerAxisTagEntity> {
* @date 2022/4/19/0019 9:23 * @date 2022/4/19/0019 9:23
*/ */
List<PowerAxisAllTagCategoryResultDTO> listSimpleAll(); List<PowerAxisAllTagCategoryResultDTO> listSimpleAll();
/**
* 根据标签编码查询节点级别
*
* @param customerId 客户ID
* @param tagCategory 标签类型
* @param categoryCode 标签编码
* @return int
* @author work@yujt.net.cn
* @date 2022/4/21/0021 17:21
*/
int selectStructLevelByCode(String customerId, String tagCategory, String categoryCode);
} }

44
epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisStructServiceImpl.java

@ -5,15 +5,21 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
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.page.PageData;
import com.epmet.commons.tools.security.user.LoginUserUtil;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.plugin.power.dto.axis.PowerAxisStructDTO; import com.epmet.plugin.power.dto.axis.PowerAxisStructDTO;
import com.epmet.plugin.power.dto.axis.form.*; import com.epmet.plugin.power.dto.axis.form.*;
import com.epmet.plugin.power.dto.axis.result.*; import com.epmet.plugin.power.dto.axis.result.*;
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.dao.PowerAxisStructDao;
import com.epmet.plugin.power.modules.axis.entity.PowerAxisStructEntity; import com.epmet.plugin.power.modules.axis.entity.PowerAxisStructEntity;
import com.epmet.plugin.power.modules.axis.redis.PowerAxisStructRedis;
import com.epmet.plugin.power.modules.axis.service.PowerAxisStructService; import com.epmet.plugin.power.modules.axis.service.PowerAxisStructService;
import com.epmet.plugin.power.modules.axis.service.PowerAxisTagService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -34,7 +40,10 @@ import java.util.Map;
public class PowerAxisStructServiceImpl extends BaseServiceImpl<PowerAxisStructDao, PowerAxisStructEntity> implements PowerAxisStructService { public class PowerAxisStructServiceImpl extends BaseServiceImpl<PowerAxisStructDao, PowerAxisStructEntity> implements PowerAxisStructService {
@Autowired @Autowired
private PowerAxisStructRedis powerAxisStructRedis; private PowerAxisTagService powerAxisTagService;
@Autowired
private LoginUserUtil loginUserUtil;
@Resource @Resource
private PowerAxisStructDao powerAxisStructDao; private PowerAxisStructDao powerAxisStructDao;
@ -55,8 +64,8 @@ public class PowerAxisStructServiceImpl extends BaseServiceImpl<PowerAxisStructD
return ConvertUtils.sourceToTarget(entityList, PowerAxisStructDTO.class); return ConvertUtils.sourceToTarget(entityList, PowerAxisStructDTO.class);
} }
private QueryWrapper<PowerAxisStructEntity> getWrapper(Map<String, Object> params){ private QueryWrapper<PowerAxisStructEntity> getWrapper(Map<String, Object> params) {
String id = (String)params.get(FieldConstant.ID_HUMP); String id = (String) params.get(FieldConstant.ID_HUMP);
QueryWrapper<PowerAxisStructEntity> wrapper = new QueryWrapper<>(); QueryWrapper<PowerAxisStructEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
@ -104,43 +113,42 @@ public class PowerAxisStructServiceImpl extends BaseServiceImpl<PowerAxisStructD
} }
@Override @Override
public List<PowerAxisStructLeaderResultDTO> selectAllForTree(PowerAxisStructLeaderFormDTO formDto) { public List<PowerAxisStructLeaderResultDTO> selectAllForTree(PowerAxisStructLeaderFormDTO formDto) {
return baseDao.selectAllForTree(formDto); return baseDao.selectAllForTree(formDto);
} }
@Override @Override
public int addOrg(PowerAxisStructEntity form) { public void addOrg(PowerAxisStructEntity form) {
if(form.getCategoryCode().equals("community_party")){ int structLevel = powerAxisTagService.selectStructLevelByCode(loginUserUtil.getLoginUserCustomerId(), PowerTagCategoryEnum.LEADER.category(), form.getCategoryCode());
if (PowerTagLevelEnum.ROOT.level() == structLevel) {
int y = baseDao.queryCategory(form); int y = baseDao.queryCategory(form);
if(y != 0){ if (y > NumConstant.ZERO) {
return -2; throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), StringUtils.EMPTY, "同一组织下只允许存在一个顶级节点");
} }
} }
int x = baseDao.queryName(form); int x = baseDao.queryName(form);
if(x == 0){ if (x > NumConstant.ZERO) {
int i = baseDao.insert(form); throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), StringUtils.EMPTY, "同一组织下不允许存在重名的节点");
return i;
} }
return -1; baseDao.insert(form);
} }
@Override @Override
public int modifyRog(PowerAxisStructEntity form) { public int modifyRog(PowerAxisStructEntity form) {
if(form.getId().equals( form.getPid())){ if (form.getId().equals(form.getPid())) {
return 0; return 0;
} }
if(form.getCategoryCode().equals("community_party")){ if (form.getCategoryCode().equals("community_party")) {
int y = baseDao.queryCategory(form); int y = baseDao.queryCategory(form);
y = y-1; y = y - 1;
if(y != 0){ if (y != 0) {
return -2; return -2;
} }
} }
int x = baseDao.queryName(form); int x = baseDao.queryName(form);
x = x - 1; x = x - 1;
if(x != 0){ if (x != 0) {
return -3; return -3;
} }
int i = baseDao.updateById(form); int i = baseDao.updateById(form);

19
epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisTagServiceImpl.java

@ -1,13 +1,14 @@
package com.epmet.plugin.power.modules.axis.service.impl; 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.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.enums.EpmetDelFlagEnum; import com.epmet.commons.mybatis.enums.EpmetDelFlagEnum;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.user.LoginUserUtil; import com.epmet.commons.tools.security.user.LoginUserUtil;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
@ -16,7 +17,6 @@ import com.epmet.plugin.power.dto.axis.result.PowerAxisAllTagCategoryResultDTO;
import com.epmet.plugin.power.dto.axis.result.PowerAxisTagCategoryResultDTO; import com.epmet.plugin.power.dto.axis.result.PowerAxisTagCategoryResultDTO;
import com.epmet.plugin.power.modules.axis.dao.PowerAxisTagDao; import com.epmet.plugin.power.modules.axis.dao.PowerAxisTagDao;
import com.epmet.plugin.power.modules.axis.entity.PowerAxisTagEntity; import com.epmet.plugin.power.modules.axis.entity.PowerAxisTagEntity;
import com.epmet.plugin.power.modules.axis.redis.PowerAxisTagRedis;
import com.epmet.plugin.power.modules.axis.service.PowerAxisTagService; import com.epmet.plugin.power.modules.axis.service.PowerAxisTagService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -115,4 +115,19 @@ public class PowerAxisTagServiceImpl extends BaseServiceImpl<PowerAxisTagDao, Po
public List<PowerAxisAllTagCategoryResultDTO> listSimpleAll() { public List<PowerAxisAllTagCategoryResultDTO> listSimpleAll() {
return baseDao.listSimpleAll(); return baseDao.listSimpleAll();
} }
@Override
public int selectStructLevelByCode(String customerId, String tagCategory, String categoryCode) {
LambdaQueryWrapper<PowerAxisTagEntity> lqw = new LambdaQueryWrapper<>();
lqw.eq(PowerAxisTagEntity::getTagCategory, tagCategory)
.eq(PowerAxisTagEntity::getCategoryCode, categoryCode)
.eq(PowerAxisTagEntity::getCustomerId, customerId)
.eq(PowerAxisTagEntity::getDelFlag, EpmetDelFlagEnum.NORMAL.value())
.select(PowerAxisTagEntity::getStructLevel);
List<PowerAxisTagEntity> list = baseDao.selectList(lqw);
if (list.size() != NumConstant.ONE) {
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "动力主轴标签配置出错", EpmetErrorCode.SERVER_ERROR.getMsg());
}
return list.get(NumConstant.ZERO).getStructLevel();
}
} }

13
epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/logback-spring.xml

@ -35,7 +35,8 @@
<file>${log.path}/debug.log</file> <file>${log.path}/debug.log</file>
<!--日志文档输出格式--> <!--日志文档输出格式-->
<encoder> <encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%X{Transaction-Serial}] %-5level %logger{50} - %msg%n</pattern> <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%X{Transaction-Serial}] %-5level %logger{50} - %msg%n
</pattern>
<charset>UTF-8</charset> <!-- 设置字符集 --> <charset>UTF-8</charset> <!-- 设置字符集 -->
</encoder> </encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 --> <!-- 日志记录器的滚动策略,按日期,按大小记录 -->
@ -62,7 +63,8 @@
<file>${log.path}/info.log</file> <file>${log.path}/info.log</file>
<!--日志文档输出格式--> <!--日志文档输出格式-->
<encoder> <encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%X{Transaction-Serial}] %-5level %logger{50} - %msg%n</pattern> <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%X{Transaction-Serial}] %-5level %logger{50} - %msg%n
</pattern>
<charset>UTF-8</charset> <charset>UTF-8</charset>
</encoder> </encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 --> <!-- 日志记录器的滚动策略,按日期,按大小记录 -->
@ -89,7 +91,8 @@
<file>${log.path}/warn.log</file> <file>${log.path}/warn.log</file>
<!--日志文档输出格式--> <!--日志文档输出格式-->
<encoder> <encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%X{Transaction-Serial}] %-5level %logger{50} - %msg%n</pattern> <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%X{Transaction-Serial}] %-5level %logger{50} - %msg%n
</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 --> <charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder> </encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 --> <!-- 日志记录器的滚动策略,按日期,按大小记录 -->
@ -115,7 +118,8 @@
<file>${log.path}/error.log</file> <file>${log.path}/error.log</file>
<!--日志文档输出格式--> <!--日志文档输出格式-->
<encoder> <encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%X{Transaction-Serial}] %-5level %logger{50} - %msg%n</pattern> <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%X{Transaction-Serial}] %-5level %logger{50} - %msg%n
</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 --> <charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder> </encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 --> <!-- 日志记录器的滚动策略,按日期,按大小记录 -->
@ -142,6 +146,7 @@
<springProfile name="dev,test"> <springProfile name="dev,test">
<logger name="org.springframework.web" level="INFO"/> <logger name="org.springframework.web" level="INFO"/>
<logger name="org.springboot.sample" level="INFO"/> <logger name="org.springboot.sample" level="INFO"/>
<logger name="com.epmet.plugin.power.modules.axis.dao" level="DEBUG"/>
<root level="INFO"> <root level="INFO">
<appender-ref ref="DEBUG_FILE"/> <appender-ref ref="DEBUG_FILE"/>
<appender-ref ref="INFO_FILE"/> <appender-ref ref="INFO_FILE"/>

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

@ -44,10 +44,12 @@
s.CREATED_TIME, s.CREATED_TIME,
sl.LEADER_ID, sl.LEADER_ID,
l.NAME as LEADER_NAME, l.NAME as LEADER_NAME,
l.MOBILE as LEADER_MOBILE l.MOBILE as LEADER_MOBILE,
t.STRUCT_LEVEL
from pli_power_axis_struct s from pli_power_axis_struct s
left join pli_power_axis_struct_leader sl on s.ID = sl.STRUCT_REFERENCE_ID left join pli_power_axis_struct_leader sl on s.ID = sl.STRUCT_REFERENCE_ID
left join pli_power_axis_leader l on l.ID = sl.LEADER_ID left join pli_power_axis_leader l on l.ID = sl.LEADER_ID
left join pli_power_axis_tag t on s.CATEGORY_CODE = t.CATEGORY_CODE
where s.DEL_FLAG = '0' where s.DEL_FLAG = '0'
<if test="agencyId != null and agencyId != ''"> <if test="agencyId != null and agencyId != ''">
and s.AGENCY_ID = #{agencyId} and s.AGENCY_ID = #{agencyId}

Loading…
Cancel
Save