diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/StructLeaderBindFormDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/StructLeaderBindFormDTO.java new file mode 100644 index 0000000..942c29d --- /dev/null +++ b/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; +} diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisStructLeaderController.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisStructLeaderController.java index cb45e25..213d2d4 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisStructLeaderController.java +++ b/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.DefaultGroup; 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.result.PowerAxisSimpleListDTO; import com.epmet.plugin.power.modules.axis.excel.PowerAxisStructLeaderExcel; @@ -95,5 +96,20 @@ public class PowerAxisStructLeaderController { 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(); + } + } diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/dao/PowerAxisStructLeaderDao.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/dao/PowerAxisStructLeaderDao.java index f95a615..db7c98a 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/dao/PowerAxisStructLeaderDao.java +++ b/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.modules.axis.entity.PowerAxisStructLeaderEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -29,4 +30,18 @@ public interface PowerAxisStructLeaderDao extends BaseDao 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); } \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/PowerAxisStructLeaderService.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/PowerAxisStructLeaderService.java index 4bf5a11..d650592 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/PowerAxisStructLeaderService.java +++ b/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.security.dto.TokenDto; 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.result.PowerAxisSLeaderResultDTO; import com.epmet.plugin.power.dto.axis.result.PowerAxisSimpleListDTO; @@ -100,4 +101,15 @@ public interface PowerAxisStructLeaderService extends BaseService 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); } \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisLeaderServiceImpl.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisLeaderServiceImpl.java index 7d8b8d6..70b91c6 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisLeaderServiceImpl.java +++ b/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 getSimpleList(List ids) { String customerId = loginUserUtil.getLoginUserCustomerId(); - return baseDao.getSimpleList(ids,customerId); + return baseDao.getSimpleList(ids, customerId); } @Override @@ -119,13 +121,6 @@ public class PowerAxisLeaderServiceImpl extends BaseServiceImpl 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) { PowerAxisStructLeaderEntity structLeader = new PowerAxisStructLeaderEntity(); structLeader.setCustomerId(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/PowerAxisStructLeaderServiceImpl.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisStructLeaderServiceImpl.java index 5d67ea5..df73902 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisStructLeaderServiceImpl.java +++ b/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.utils.ConvertUtils; 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.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; @@ -43,15 +43,9 @@ import java.util.Map; @Service public class PowerAxisStructLeaderServiceImpl extends BaseServiceImpl implements PowerAxisStructLeaderService { -// @Autowired -// private PowerAxisStructLeaderRedis powerAxisStructLeaderRedis; - @Autowired private LoginUserUtil loginUserUtil; - @Autowired - private PowerAxisLeaderDao powerAxisLeaderDao; - @Autowired private PowerAxisStructDao powerAxisStructDao; @@ -141,4 +135,16 @@ public class PowerAxisStructLeaderServiceImpl extends BaseServiceImpl + + delete from pli_power_axis_struct_leader where CUSTOMER_ID = #{customerId} and STRUCT_REFERENCE_ID = #{axisStructId} and LEADER_ID = #{leaderId} +