diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ThirdPlatformFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ThirdPlatformFormDTO.java index 3f488e75c1..c2ff1a3666 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ThirdPlatformFormDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ThirdPlatformFormDTO.java @@ -7,13 +7,15 @@ import javax.validation.constraints.NotBlank; @Data public class ThirdPlatformFormDTO { - // 列出注册关系分组 - public static interface ListRegRelsGroups {} + // 根据客户和动作查询分组 + public interface ListByCustomerAndActionGroup {} + // 根据动作查询分组 + public interface ListByActionGroup {} - @NotBlank(message = "客户ID不能为空", groups = { ListRegRelsGroups.class }) + @NotBlank(message = "客户ID不能为空", groups = { ListByCustomerAndActionGroup.class }) private String customerId; - @NotBlank(message = "客户ID不能为空", groups = { ListRegRelsGroups.class }) + @NotBlank(message = "客户ID不能为空", groups = { ListByCustomerAndActionGroup.class, ListByActionGroup.class }) private String actionKey; } diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/ThirdplatformCustomerRegisterResultDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/ThirdplatformResultDTO.java similarity index 57% rename from epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/ThirdplatformCustomerRegisterResultDTO.java rename to epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/ThirdplatformResultDTO.java index d637837fbc..6b0b163048 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/ThirdplatformCustomerRegisterResultDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/ThirdplatformResultDTO.java @@ -3,16 +3,13 @@ package com.epmet.dto.result; import lombok.Data; @Data -public class ThirdplatformCustomerRegisterResultDTO { - /** - * - */ - private String customerId; - +public class ThirdplatformResultDTO { /** * */ private String platformId; private String platformName; + + private String icon; } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ThirdPlatformController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ThirdPlatformController.java index 64c7f0e7f0..a8196d2520 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ThirdPlatformController.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ThirdPlatformController.java @@ -3,7 +3,7 @@ package com.epmet.controller; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.ThirdPlatformFormDTO; -import com.epmet.dto.result.ThirdplatformCustomerRegisterResultDTO; +import com.epmet.dto.result.ThirdplatformResultDTO; import com.epmet.service.ThirdPlatformService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -20,20 +20,32 @@ import java.util.List; @RequestMapping("thirdplatform") public class ThirdPlatformController { - @Autowired private ThirdPlatformService thirdPlatformService; /** - * 列出第三方平台注册关系 + * 根据客户id和动作,列出客户开通可用的第三方平台 * @param input * @return */ - @PostMapping("list-reg-rels") - public Result> listRegsteredPlatforms(@RequestBody ThirdPlatformFormDTO input) { - ValidatorUtils.validateEntity(input); - List platformRegs = thirdPlatformService.listByCustomerId(input.getCustomerId(), input.getActionKey()); - return new Result>().ok(platformRegs); + @PostMapping("customer/list-platforms-by-action") + public Result> listPlatformsByCustomerAndAction(@RequestBody ThirdPlatformFormDTO input) { + ValidatorUtils.validateEntity(input, ThirdPlatformFormDTO.ListByCustomerAndActionGroup.class); + List platformRegs = thirdPlatformService.listDTOS(input.getCustomerId(), input.getActionKey()); + return new Result>().ok(platformRegs); + } + + /** + * @Description 根据动作列出平台列表 + * @return + * @author wxz + * @date 2021.03.18 10:54 + */ + @PostMapping("list-platforms-by-action") + public Result> listPlatformsByAction(@RequestBody ThirdPlatformFormDTO input) { + ValidatorUtils.validateEntity(input, ThirdPlatformFormDTO.ListByActionGroup.class); + List platformRegs = thirdPlatformService.listDTOS(null, input.getActionKey()); + return new Result>().ok(platformRegs); } //@PostMapping("register") diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformCustomerRegisterDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformCustomerRegisterDao.java index b5ffe5cf82..cbae094292 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformCustomerRegisterDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformCustomerRegisterDao.java @@ -18,8 +18,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.constant.ThirdPlatformConstant; -import com.epmet.dto.result.ThirdplatformCustomerRegisterResultDTO; +import com.epmet.dto.result.ThirdplatformResultDTO; import com.epmet.entity.ThirdplatformCustomerRegisterEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -35,12 +34,5 @@ import java.util.List; @Mapper public interface ThirdplatformCustomerRegisterDao extends BaseDao { - /** - * 动态sql查询 - * @param customerId - * @return - */ - List listDTOS(@Param("customerId") String customerId, @Param("actionKey") String actionKey); - ThirdplatformCustomerRegisterEntity getByCustomerIdAndPlatformId(@Param("customerId") String customerId, @Param("platformId") String platformId); } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformDao.java index 593d20923f..e86e63b7f2 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformDao.java @@ -18,8 +18,12 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.result.ThirdplatformResultDTO; import com.epmet.entity.ThirdplatformEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * @@ -29,5 +33,10 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface ThirdplatformDao extends BaseDao { - + /** + * 动态sql查询 + * @param customerId + * @return + */ + List listDTOS(@Param("customerId") String customerId, @Param("actionKey") String actionKey); } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformEntity.java index d756c81b88..d5b20b8eab 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformEntity.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformEntity.java @@ -63,4 +63,9 @@ public class ThirdplatformEntity extends BaseEpmetEntity { */ private String baseUrl; + /** + * icon + */ + private String icon; + } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ThirdPlatformService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ThirdPlatformService.java index 74b4cab44f..8110c4b5b3 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ThirdPlatformService.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ThirdPlatformService.java @@ -1,11 +1,11 @@ package com.epmet.service; -import com.epmet.dto.result.ThirdplatformCustomerRegisterResultDTO; +import com.epmet.dto.result.ThirdplatformResultDTO; import java.util.List; public interface ThirdPlatformService { - List listByCustomerId(String customerId, String actionKey); + List listDTOS(String customerId, String actionKey); } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ThirdPlatformServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ThirdPlatformServiceImpl.java index 40556ebaca..5e23671983 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ThirdPlatformServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ThirdPlatformServiceImpl.java @@ -1,7 +1,8 @@ package com.epmet.service.impl; import com.epmet.dao.ThirdplatformCustomerRegisterDao; -import com.epmet.dto.result.ThirdplatformCustomerRegisterResultDTO; +import com.epmet.dao.ThirdplatformDao; +import com.epmet.dto.result.ThirdplatformResultDTO; import com.epmet.service.ThirdPlatformService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -12,10 +13,10 @@ import java.util.List; public class ThirdPlatformServiceImpl implements ThirdPlatformService { @Autowired - private ThirdplatformCustomerRegisterDao thirdplatformCustomerRegisterDao; + private ThirdplatformDao thirdplatformDao; @Override - public List listByCustomerId(String customerId, String actionKey) { - return thirdplatformCustomerRegisterDao.listDTOS(customerId, actionKey); + public List listDTOS(String customerId, String actionKey) { + return thirdplatformDao.listDTOS(customerId, actionKey); } } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformCustomerRegisterDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformCustomerRegisterDao.xml index 10edc458e3..4e5577228e 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformCustomerRegisterDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformCustomerRegisterDao.xml @@ -31,28 +31,4 @@ and PLATFORM_ID = #{platformId} and DEL_FLAG = 0 - - - - \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformDao.xml index 0bc68d7af2..0db6eba1f2 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformDao.xml @@ -9,6 +9,7 @@ + @@ -17,5 +18,31 @@ + \ No newline at end of file