Browse Source

新增接口

dev_power_axis
YUJT 3 years ago
parent
commit
e4ea5c6036
  1. 37
      epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/StructLeaderBindFormDTO.java
  2. 16
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisStructLeaderController.java
  3. 15
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/dao/PowerAxisStructLeaderDao.java
  4. 12
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/PowerAxisStructLeaderService.java
  5. 13
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisLeaderServiceImpl.java
  6. 20
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisStructLeaderServiceImpl.java
  7. 3
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/poweraxis/PowerAxisStructLeaderDao.xml

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

@ -0,0 +1,37 @@
package com.epmet.plugin.power.dto.axis.form;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class StructLeaderBindFormDTO implements Serializable {
private static final long serialVersionUID = 523592353978009455L;
/**
* 节点ID
*/
@NotBlank(message = "绑定节点不能为空")
private String axisStructId;
/**
* 负责人ID
*/
@NotBlank(message = "绑定负责人不能为空")
private String leaderId;
/**
* 负责人类别
*/
@NotBlank(message = "负责人类别不能为空")
private String categoryCode;
private String customerId;
}

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

@ -12,6 +12,7 @@ import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.plugin.power.dto.axis.PowerAxisStructLeaderDTO; import com.epmet.plugin.power.dto.axis.PowerAxisStructLeaderDTO;
import com.epmet.plugin.power.dto.axis.form.StructLeaderBindFormDTO;
import com.epmet.plugin.power.dto.axis.form.StructLeaderBriefFormDTO; import com.epmet.plugin.power.dto.axis.form.StructLeaderBriefFormDTO;
import com.epmet.plugin.power.dto.axis.result.PowerAxisSimpleListDTO; 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.excel.PowerAxisStructLeaderExcel;
@ -95,5 +96,20 @@ public class PowerAxisStructLeaderController {
return new Result().ok(powerAxisStructLeaderService.listLeaderByStructId(tokenDto, formDto)); return new Result().ok(powerAxisStructLeaderService.listLeaderByStructId(tokenDto, formDto));
} }
/**
* 绑定节点负责人
*
* @param tokenDto 用户信息
* @param formDto 表单信息
* @return com.epmet.commons.tools.utils.Result
* @author work@yujt.net.cn
* @date 2022/4/25/0025 9:21
*/
@PostMapping("bind")
public Result bindAxisStructLeader(@LoginUser TokenDto tokenDto, @RequestBody StructLeaderBindFormDTO formDto) {
powerAxisStructLeaderService.bindAxisStructLeader(tokenDto, formDto);
return new Result();
}
} }

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

@ -6,6 +6,7 @@ import com.epmet.plugin.power.dto.axis.result.PowerAxisSLeaderResultDTO;
import com.epmet.plugin.power.dto.axis.result.PowerAxisSimpleListDTO; import com.epmet.plugin.power.dto.axis.result.PowerAxisSimpleListDTO;
import com.epmet.plugin.power.modules.axis.entity.PowerAxisStructLeaderEntity; import com.epmet.plugin.power.modules.axis.entity.PowerAxisStructLeaderEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
@ -29,4 +30,18 @@ public interface PowerAxisStructLeaderDao extends BaseDao<PowerAxisStructLeaderE
* @date 2022/4/24/0024 19:35 * @date 2022/4/24/0024 19:35
*/ */
List<PowerAxisSimpleListDTO> listLeaderBriefByRootStructId(StructLeaderBriefFormDTO formDto); List<PowerAxisSimpleListDTO> listLeaderBriefByRootStructId(StructLeaderBriefFormDTO formDto);
/**
* 删除节点负责人
*
* @param customerId 客户ID
* @param axisStructId 节点ID
* @param leaderId 负责人ID
* @return void
* @author work@yujt.net.cn
* @date 2022/4/25/0025 9:16
*/
void deleteStructLeader(@Param("customerId") String customerId,
@Param("axisStructId") String axisStructId,
@Param("leaderId") String leaderId);
} }

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

@ -4,6 +4,7 @@ import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.plugin.power.dto.axis.PowerAxisStructLeaderDTO; import com.epmet.plugin.power.dto.axis.PowerAxisStructLeaderDTO;
import com.epmet.plugin.power.dto.axis.form.StructLeaderBindFormDTO;
import com.epmet.plugin.power.dto.axis.form.StructLeaderBriefFormDTO; 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.PowerAxisSLeaderResultDTO;
import com.epmet.plugin.power.dto.axis.result.PowerAxisSimpleListDTO; import com.epmet.plugin.power.dto.axis.result.PowerAxisSimpleListDTO;
@ -100,4 +101,15 @@ public interface PowerAxisStructLeaderService extends BaseService<PowerAxisStruc
* @date 2022/4/24/0024 19:35 * @date 2022/4/24/0024 19:35
*/ */
List<PowerAxisSimpleListDTO> listLeaderByStructId(TokenDto tokenDto, StructLeaderBriefFormDTO formDto); List<PowerAxisSimpleListDTO> listLeaderByStructId(TokenDto tokenDto, StructLeaderBriefFormDTO formDto);
/**
* 绑定节点负责人
*
* @param tokenDto 用户信息
* @param formDto 表单信息
* @return void
* @author work@yujt.net.cn
* @date 2022/4/25/0025 9:21
*/
void bindAxisStructLeader(TokenDto tokenDto, StructLeaderBindFormDTO formDto);
} }

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

@ -93,7 +93,9 @@ public class PowerAxisLeaderServiceImpl extends BaseServiceImpl<PowerAxisLeaderD
boolean i = updateById(entity); boolean i = updateById(entity);
if (i) { if (i) {
// 关联表,先删除(by structReferenceId),再插入 // 关联表,先删除(by structReferenceId),再插入
delStructLeaderRelation(dto.getCustomerId(), dto.getStructReferenceId()); powerAxisStructLeaderDao.deleteStructLeader(
dto.getCustomerId(), dto.getStructReferenceId(), dto.getId()
);
addStructLeaderRelation( addStructLeaderRelation(
dto.getCustomerId(), dto.getStructReferenceId(), entity.getId(), dto.getCategoryCode() dto.getCustomerId(), dto.getStructReferenceId(), entity.getId(), dto.getCategoryCode()
); );
@ -110,7 +112,7 @@ public class PowerAxisLeaderServiceImpl extends BaseServiceImpl<PowerAxisLeaderD
@Override @Override
public List<PowerAxisSimpleListDTO> getSimpleList(List<String> ids) { public List<PowerAxisSimpleListDTO> getSimpleList(List<String> ids) {
String customerId = loginUserUtil.getLoginUserCustomerId(); String customerId = loginUserUtil.getLoginUserCustomerId();
return baseDao.getSimpleList(ids,customerId); return baseDao.getSimpleList(ids, customerId);
} }
@Override @Override
@ -119,13 +121,6 @@ public class PowerAxisLeaderServiceImpl extends BaseServiceImpl<PowerAxisLeaderD
return baseDao.getLeaderDetail(form); return baseDao.getLeaderDetail(form);
} }
private void delStructLeaderRelation(String customerId, String structId) {
LambdaQueryWrapper<PowerAxisStructLeaderEntity> lqw = new LambdaQueryWrapper<>();
lqw.eq(PowerAxisStructLeaderEntity::getStructReferenceId, structId)
.eq(PowerAxisStructLeaderEntity::getCustomerId, customerId);
powerAxisStructLeaderDao.delete(lqw);
}
private void addStructLeaderRelation(String customerId, String structId, String leaderId, String categoryCode) { private void addStructLeaderRelation(String customerId, String structId, String leaderId, String categoryCode) {
PowerAxisStructLeaderEntity structLeader = new PowerAxisStructLeaderEntity(); PowerAxisStructLeaderEntity structLeader = new PowerAxisStructLeaderEntity();
structLeader.setCustomerId(customerId); structLeader.setCustomerId(customerId);

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

@ -14,11 +14,11 @@ import com.epmet.commons.tools.security.dto.TokenDto;
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;
import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.plugin.power.dto.axis.form.StructLeaderBindFormDTO;
import com.epmet.plugin.power.dto.axis.form.StructLeaderBriefFormDTO; 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.PowerAxisSLeaderResultDTO;
import com.epmet.plugin.power.dto.axis.result.PowerAxisSimpleListDTO; import com.epmet.plugin.power.dto.axis.result.PowerAxisSimpleListDTO;
import com.epmet.plugin.power.enums.PowerTagLevelEnum; 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.PowerAxisStructDao;
import com.epmet.plugin.power.modules.axis.dao.PowerAxisStructLeaderDao; import com.epmet.plugin.power.modules.axis.dao.PowerAxisStructLeaderDao;
import com.epmet.plugin.power.dto.axis.PowerAxisStructLeaderDTO; import com.epmet.plugin.power.dto.axis.PowerAxisStructLeaderDTO;
@ -43,15 +43,9 @@ import java.util.Map;
@Service @Service
public class PowerAxisStructLeaderServiceImpl extends BaseServiceImpl<PowerAxisStructLeaderDao, PowerAxisStructLeaderEntity> implements PowerAxisStructLeaderService { public class PowerAxisStructLeaderServiceImpl extends BaseServiceImpl<PowerAxisStructLeaderDao, PowerAxisStructLeaderEntity> implements PowerAxisStructLeaderService {
// @Autowired
// private PowerAxisStructLeaderRedis powerAxisStructLeaderRedis;
@Autowired @Autowired
private LoginUserUtil loginUserUtil; private LoginUserUtil loginUserUtil;
@Autowired
private PowerAxisLeaderDao powerAxisLeaderDao;
@Autowired @Autowired
private PowerAxisStructDao powerAxisStructDao; private PowerAxisStructDao powerAxisStructDao;
@ -141,4 +135,16 @@ public class PowerAxisStructLeaderServiceImpl extends BaseServiceImpl<PowerAxisS
formDto.setAxisStructId(rootId); formDto.setAxisStructId(rootId);
return baseDao.listLeaderBriefByRootStructId(formDto); return baseDao.listLeaderBriefByRootStructId(formDto);
} }
@Override
public void bindAxisStructLeader(TokenDto tokenDto, StructLeaderBindFormDTO formDto) {
baseDao.deleteStructLeader(formDto.getCustomerId(), formDto.getAxisStructId(), formDto.getLeaderId());
PowerAxisStructLeaderEntity structLeader = new PowerAxisStructLeaderEntity();
structLeader.setCustomerId(formDto.getCustomerId());
structLeader.setLeaderId(formDto.getLeaderId());
structLeader.setStructReferenceId(formDto.getAxisStructId());
structLeader.setCategoryCode(formDto.getCategoryCode());
baseDao.insert(structLeader);
}
} }

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

@ -16,6 +16,9 @@
<result property="updatedBy" column="UPDATED_BY"/> <result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/> <result property="updatedTime" column="UPDATED_TIME"/>
</resultMap> </resultMap>
<delete id="deleteStructLeader">
delete from pli_power_axis_struct_leader where CUSTOMER_ID = #{customerId} and STRUCT_REFERENCE_ID = #{axisStructId} and LEADER_ID = #{leaderId}
</delete>
<select id="queryLeaderDetailById" <select id="queryLeaderDetailById"
resultType="com.epmet.plugin.power.dto.axis.result.PowerAxisSLeaderResultDTO"> resultType="com.epmet.plugin.power.dto.axis.result.PowerAxisSLeaderResultDTO">
SELECT SELECT

Loading…
Cancel
Save