Browse Source

新增接口;其他

dev_power_axis
YUJT 4 years ago
parent
commit
5904152ea9
  1. 2
      epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerAxisStructFormDTO.java
  2. 23
      epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/StructLeaderBriefFormDTO.java
  3. 4
      epmet-plugins-module/pli-power-base/pli-power-base-server/pom.xml
  4. 22
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisStructLeaderController.java
  5. 7
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/dao/PowerAxisStructLeaderDao.java
  6. 5
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/PowerAxisStructLeaderService.java
  7. 55
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisStructLeaderServiceImpl.java
  8. 3
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerKernelHouseholdServiceImpl.java
  9. 22
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/poweraxis/PowerAxisStructLeaderDao.xml

2
epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerAxisStructFormDTO.java

@ -7,7 +7,7 @@ import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class PowerAxisStructFormDTO{
public class PowerAxisStructFormDTO {
private String agencyId;
private String name;
private String customerId;

23
epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/StructLeaderBriefFormDTO.java

@ -0,0 +1,23 @@
package com.epmet.plugin.power.dto.axis.form;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class StructLeaderBriefFormDTO implements Serializable {
private static final long serialVersionUID = 523592353978009455L;
private int structLevel;
private String axisStructId;
private String keyWord;
private String customerId;
}

4
epmet-plugins-module/pli-power-base/pli-power-base-server/pom.xml

@ -223,8 +223,8 @@
<spring.datasource.druid.url>
<![CDATA[jdbc:mysql://rm-m5ef9t617j6o5eup7.mysql.rds.aliyuncs.com:3306/epmet_pli_power?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</spring.datasource.druid.url>
<spring.datasource.druid.username>epmet</spring.datasource.druid.username>
<spring.datasource.druid.password>elink@833066</spring.datasource.druid.password>
<spring.datasource.druid.username>epmet_pli_power_user</spring.datasource.druid.username>
<spring.datasource.druid.password>EpmEt-db-UsEr</spring.datasource.druid.password>
<!-- redis配置 -->
<spring.redis.index>0</spring.redis.index>
<spring.redis.host>r-m5eoz5b6tkx09y6bpz.redis.rds.aliyuncs.com</spring.redis.host>

22
epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisStructLeaderController.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;
@ -10,6 +12,8 @@ import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.plugin.power.dto.axis.PowerAxisStructLeaderDTO;
import com.epmet.plugin.power.dto.axis.form.StructLeaderBriefFormDTO;
import com.epmet.plugin.power.dto.axis.result.PowerAxisSimpleListDTO;
import com.epmet.plugin.power.modules.axis.excel.PowerAxisStructLeaderExcel;
import com.epmet.plugin.power.modules.axis.service.PowerAxisStructLeaderService;
import org.springframework.beans.factory.annotation.Autowired;
@ -27,27 +31,27 @@ import java.util.Map;
* @since v1.0.0 2022-04-19
*/
@RestController
@RequestMapping("powerAxisStructLeader")
@RequestMapping("axisstructleader")
public class PowerAxisStructLeaderController {
@Autowired
private PowerAxisStructLeaderService powerAxisStructLeaderService;
@RequestMapping("page")
public Result<PageData<PowerAxisStructLeaderDTO>> page(@RequestParam Map<String, Object> params){
public Result<PageData<PowerAxisStructLeaderDTO>> page(@RequestParam Map<String, Object> params) {
PageData<PowerAxisStructLeaderDTO> page = powerAxisStructLeaderService.page(params);
return new Result<PageData<PowerAxisStructLeaderDTO>>().ok(page);
}
@RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET})
public Result<PowerAxisStructLeaderDTO> get(@PathVariable("id") String id){
@RequestMapping(value = "{id}", method = {RequestMethod.POST, RequestMethod.GET})
public Result<PowerAxisStructLeaderDTO> get(@PathVariable("id") String id) {
PowerAxisStructLeaderDTO data = powerAxisStructLeaderService.get(id);
return new Result<PowerAxisStructLeaderDTO>().ok(data);
}
@NoRepeatSubmit
@PostMapping("save")
public Result save(@RequestBody PowerAxisStructLeaderDTO dto){
public Result save(@RequestBody PowerAxisStructLeaderDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
powerAxisStructLeaderService.save(dto);
@ -56,7 +60,7 @@ public class PowerAxisStructLeaderController {
@NoRepeatSubmit
@PostMapping("update")
public Result update(@RequestBody PowerAxisStructLeaderDTO dto){
public Result update(@RequestBody PowerAxisStructLeaderDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
powerAxisStructLeaderService.update(dto);
@ -64,7 +68,7 @@ public class PowerAxisStructLeaderController {
}
@PostMapping("delete")
public Result delete(@RequestBody String[] ids){
public Result delete(@RequestBody String[] ids) {
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
powerAxisStructLeaderService.delete(ids);
@ -77,6 +81,10 @@ public class PowerAxisStructLeaderController {
ExcelUtils.exportExcelToTarget(response, null, list, PowerAxisStructLeaderExcel.class);
}
@PostMapping("listbrief")
public Result<List<PowerAxisSimpleListDTO>> listLeaderByStructId(@LoginUser TokenDto tokenDto, @RequestBody StructLeaderBriefFormDTO formDto) {
return new Result().ok(powerAxisStructLeaderService.listLeaderByStructId(tokenDto, formDto));
}
}

7
epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/dao/PowerAxisStructLeaderDao.java

@ -1,10 +1,14 @@
package com.epmet.plugin.power.modules.axis.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.plugin.power.dto.axis.form.StructLeaderBriefFormDTO;
import com.epmet.plugin.power.dto.axis.result.PowerAxisSLeaderResultDTO;
import com.epmet.plugin.power.dto.axis.result.PowerAxisSimpleListDTO;
import com.epmet.plugin.power.modules.axis.entity.PowerAxisStructLeaderEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 动力主轴负责人关系
*
@ -15,4 +19,7 @@ import org.apache.ibatis.annotations.Mapper;
public interface PowerAxisStructLeaderDao extends BaseDao<PowerAxisStructLeaderEntity> {
PowerAxisSLeaderResultDTO queryLeaderDetailById(String axisStructId,String customerId);
List<PowerAxisSimpleListDTO> listLeaderBriefByRootStructId(StructLeaderBriefFormDTO formDto);
}

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

@ -2,8 +2,11 @@ package com.epmet.plugin.power.modules.axis.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.plugin.power.dto.axis.PowerAxisStructLeaderDTO;
import com.epmet.plugin.power.dto.axis.form.StructLeaderBriefFormDTO;
import com.epmet.plugin.power.dto.axis.result.PowerAxisSLeaderResultDTO;
import com.epmet.plugin.power.dto.axis.result.PowerAxisSimpleListDTO;
import com.epmet.plugin.power.modules.axis.entity.PowerAxisStructLeaderEntity;
import java.util.List;
@ -81,4 +84,6 @@ public interface PowerAxisStructLeaderService extends BaseService<PowerAxisStruc
* 查询节点负责人信息
*/
PowerAxisSLeaderResultDTO queryLeaderDetailById(String axisStructId);
List<PowerAxisSimpleListDTO> listLeaderByStructId(TokenDto tokenDto, StructLeaderBriefFormDTO formDto);
}

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

@ -1,15 +1,28 @@
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.NumConstant;
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.security.dto.TokenDto;
import com.epmet.commons.tools.security.user.LoginUserUtil;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.plugin.power.dto.axis.form.StructLeaderBriefFormDTO;
import com.epmet.plugin.power.dto.axis.result.PowerAxisSLeaderResultDTO;
import com.epmet.plugin.power.dto.axis.result.PowerAxisSimpleListDTO;
import com.epmet.plugin.power.enums.PowerTagLevelEnum;
import com.epmet.plugin.power.modules.axis.dao.PowerAxisLeaderDao;
import com.epmet.plugin.power.modules.axis.dao.PowerAxisStructDao;
import com.epmet.plugin.power.modules.axis.dao.PowerAxisStructLeaderDao;
import com.epmet.plugin.power.dto.axis.PowerAxisStructLeaderDTO;
import com.epmet.plugin.power.modules.axis.entity.PowerAxisStructEntity;
import com.epmet.plugin.power.modules.axis.entity.PowerAxisStructLeaderEntity;
import com.epmet.plugin.power.modules.axis.service.PowerAxisStructLeaderService;
import org.apache.commons.lang3.StringUtils;
@ -34,7 +47,13 @@ public class PowerAxisStructLeaderServiceImpl extends BaseServiceImpl<PowerAxisS
// private PowerAxisStructLeaderRedis powerAxisStructLeaderRedis;
@Autowired
LoginUserUtil loginUserUtil;
private LoginUserUtil loginUserUtil;
@Autowired
private PowerAxisLeaderDao powerAxisLeaderDao;
@Autowired
private PowerAxisStructDao powerAxisStructDao;
@Override
public PageData<PowerAxisStructLeaderDTO> page(Map<String, Object> params) {
@ -52,8 +71,8 @@ public class PowerAxisStructLeaderServiceImpl extends BaseServiceImpl<PowerAxisS
return ConvertUtils.sourceToTarget(entityList, PowerAxisStructLeaderDTO.class);
}
private QueryWrapper<PowerAxisStructLeaderEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
private QueryWrapper<PowerAxisStructLeaderEntity> getWrapper(Map<String, Object> params) {
String id = (String) params.get(FieldConstant.ID_HUMP);
QueryWrapper<PowerAxisStructLeaderEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
@ -91,7 +110,35 @@ public class PowerAxisStructLeaderServiceImpl extends BaseServiceImpl<PowerAxisS
@Override
public PowerAxisSLeaderResultDTO queryLeaderDetailById(String axisStructId) {
String customerId = loginUserUtil.getLoginUserCustomerId();
return baseDao.queryLeaderDetailById(axisStructId,customerId);
return baseDao.queryLeaderDetailById(axisStructId, customerId);
}
@Override
public List<PowerAxisSimpleListDTO> listLeaderByStructId(TokenDto tokenDto, StructLeaderBriefFormDTO formDto) {
int structLevel = formDto.getStructLevel();
String axisStructId = formDto.getAxisStructId();
String customerId = tokenDto.getCustomerId();
String rootId;
if (PowerTagLevelEnum.ROOT.level() == structLevel) {
rootId = axisStructId;
} else {
LambdaQueryWrapper<PowerAxisStructEntity> lqw = new LambdaQueryWrapper<>();
lqw.eq(PowerAxisStructEntity::getCustomerId, customerId)
.eq(PowerAxisStructEntity::getPid, axisStructId)
.eq(PowerAxisStructEntity::getDelFlag, EpmetDelFlagEnum.NORMAL.value());
PowerAxisStructEntity axisStructEntity = powerAxisStructDao.selectOne(lqw);
if (null == axisStructEntity) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "节点匹配错误");
}
rootId = StringUtils.split(axisStructEntity.getPids(), StrConstant.COLON)[NumConstant.ZERO];
}
formDto.setCustomerId(customerId);
formDto.setAxisStructId(rootId);
return baseDao.listLeaderBriefByRootStructId(formDto);
}
}

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

@ -163,7 +163,6 @@ public class PowerKernelHouseholdServiceImpl extends BaseServiceImpl<PowerKernel
return;
}
List<HouseInfoDTO> houseList = listResult.getData();
List<PowerKernelHouseholdEntity> list = Lists.newArrayList();
PowerKernelHouseholdEntity entity;
for (HouseInfoDTO houseInfo : houseList) {
@ -175,7 +174,7 @@ public class PowerKernelHouseholdServiceImpl extends BaseServiceImpl<PowerKernel
entity = new PowerKernelHouseholdEntity();
entity.setHouseId(houseInfo.getHomeId());
if (!org.springframework.util.StringUtils.isEmpty(houseInfo.getBuildingLatitude()) && !org.springframework.util.StringUtils.isEmpty(houseInfo.getBuildingLongitude())) {
if (StringUtils.isNotBlank(houseInfo.getBuildingLatitude()) && StringUtils.isNotBlank(houseInfo.getBuildingLongitude())) {
entity.setLatitude(new BigDecimal(houseInfo.getBuildingLatitude()));
entity.setLongitude(new BigDecimal(houseInfo.getBuildingLongitude()));
} else {

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

@ -33,6 +33,28 @@
AND sl.DEL_FLAG = '0' AND l.DEL_FLAG = '0'
and l.customer_id = #{customerId}
</select>
<select id="listLeaderBriefByRootStructId"
resultType="com.epmet.plugin.power.dto.axis.result.PowerAxisSimpleListDTO">
SELECT
l.ID,
l.`NAME` ,
l.MOBILE
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_leader l ON sl.LEADER_ID = l.ID
WHERE
s.DEL_FLAG = '0'
AND sl.DEL_FLAG = '0'
AND s.CUSTOMER_ID = #{customerId}
AND ( s.ID = #{axisStructId} OR PIDS LIKE '%${axisStructId}%' )
AND (l.`NAME` LIKE '%${keyWord}%' OR l.MOBILE LIKE '%${keyWord}%')
GROUP BY
l.ID
ORDER BY
s.CREATED_TIME,
s.SORT
</select>
</mapper>
Loading…
Cancel
Save