Browse Source

对接三方平台修改

master
wxz 5 years ago
parent
commit
9c1a1d89ef
  1. 10
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ThirdPlatformFormDTO.java
  2. 9
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/ThirdplatformResultDTO.java
  3. 28
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ThirdPlatformController.java
  4. 10
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformCustomerRegisterDao.java
  5. 11
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformDao.java
  6. 5
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformEntity.java
  7. 4
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ThirdPlatformService.java
  8. 9
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ThirdPlatformServiceImpl.java
  9. 24
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformCustomerRegisterDao.xml
  10. 27
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformDao.xml

10
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 @Data
public class ThirdPlatformFormDTO { 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; private String customerId;
@NotBlank(message = "客户ID不能为空", groups = { ListRegRelsGroups.class }) @NotBlank(message = "客户ID不能为空", groups = { ListByCustomerAndActionGroup.class, ListByActionGroup.class })
private String actionKey; private String actionKey;
} }

9
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/ThirdplatformCustomerRegisterResultDTO.java → 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; import lombok.Data;
@Data @Data
public class ThirdplatformCustomerRegisterResultDTO { public class ThirdplatformResultDTO {
/**
*
*/
private String customerId;
/** /**
* *
*/ */
private String platformId; private String platformId;
private String platformName; private String platformName;
private String icon;
} }

28
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.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.ThirdPlatformFormDTO; import com.epmet.dto.form.ThirdPlatformFormDTO;
import com.epmet.dto.result.ThirdplatformCustomerRegisterResultDTO; import com.epmet.dto.result.ThirdplatformResultDTO;
import com.epmet.service.ThirdPlatformService; import com.epmet.service.ThirdPlatformService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@ -20,20 +20,32 @@ import java.util.List;
@RequestMapping("thirdplatform") @RequestMapping("thirdplatform")
public class ThirdPlatformController { public class ThirdPlatformController {
@Autowired @Autowired
private ThirdPlatformService thirdPlatformService; private ThirdPlatformService thirdPlatformService;
/** /**
* 列出第三方平台注册关系 * 根据客户id和动作列出客户开通可用的第三方平台
* @param input * @param input
* @return * @return
*/ */
@PostMapping("list-reg-rels") @PostMapping("customer/list-platforms-by-action")
public Result<List<ThirdplatformCustomerRegisterResultDTO>> listRegsteredPlatforms(@RequestBody ThirdPlatformFormDTO input) { public Result<List<ThirdplatformResultDTO>> listPlatformsByCustomerAndAction(@RequestBody ThirdPlatformFormDTO input) {
ValidatorUtils.validateEntity(input); ValidatorUtils.validateEntity(input, ThirdPlatformFormDTO.ListByCustomerAndActionGroup.class);
List<ThirdplatformCustomerRegisterResultDTO> platformRegs = thirdPlatformService.listByCustomerId(input.getCustomerId(), input.getActionKey()); List<ThirdplatformResultDTO> platformRegs = thirdPlatformService.listDTOS(input.getCustomerId(), input.getActionKey());
return new Result<List<ThirdplatformCustomerRegisterResultDTO>>().ok(platformRegs); return new Result<List<ThirdplatformResultDTO>>().ok(platformRegs);
}
/**
* @Description 根据动作列出平台列表
* @return
* @author wxz
* @date 2021.03.18 10:54
*/
@PostMapping("list-platforms-by-action")
public Result<List<ThirdplatformResultDTO >> listPlatformsByAction(@RequestBody ThirdPlatformFormDTO input) {
ValidatorUtils.validateEntity(input, ThirdPlatformFormDTO.ListByActionGroup.class);
List<ThirdplatformResultDTO > platformRegs = thirdPlatformService.listDTOS(null, input.getActionKey());
return new Result<List<ThirdplatformResultDTO >>().ok(platformRegs);
} }
//@PostMapping("register") //@PostMapping("register")

10
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformCustomerRegisterDao.java

@ -18,8 +18,7 @@
package com.epmet.dao; package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.constant.ThirdPlatformConstant; import com.epmet.dto.result.ThirdplatformResultDTO;
import com.epmet.dto.result.ThirdplatformCustomerRegisterResultDTO;
import com.epmet.entity.ThirdplatformCustomerRegisterEntity; import com.epmet.entity.ThirdplatformCustomerRegisterEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -35,12 +34,5 @@ import java.util.List;
@Mapper @Mapper
public interface ThirdplatformCustomerRegisterDao extends BaseDao<ThirdplatformCustomerRegisterEntity> { public interface ThirdplatformCustomerRegisterDao extends BaseDao<ThirdplatformCustomerRegisterEntity> {
/**
* 动态sql查询
* @param customerId
* @return
*/
List<ThirdplatformCustomerRegisterResultDTO> listDTOS(@Param("customerId") String customerId, @Param("actionKey") String actionKey);
ThirdplatformCustomerRegisterEntity getByCustomerIdAndPlatformId(@Param("customerId") String customerId, @Param("platformId") String platformId); ThirdplatformCustomerRegisterEntity getByCustomerIdAndPlatformId(@Param("customerId") String customerId, @Param("platformId") String platformId);
} }

11
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformDao.java

@ -18,8 +18,12 @@
package com.epmet.dao; package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.result.ThirdplatformResultDTO;
import com.epmet.entity.ThirdplatformEntity; import com.epmet.entity.ThirdplatformEntity;
import org.apache.ibatis.annotations.Mapper; 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 @Mapper
public interface ThirdplatformDao extends BaseDao<ThirdplatformEntity> { public interface ThirdplatformDao extends BaseDao<ThirdplatformEntity> {
/**
* 动态sql查询
* @param customerId
* @return
*/
List<ThirdplatformResultDTO> listDTOS(@Param("customerId") String customerId, @Param("actionKey") String actionKey);
} }

5
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; private String baseUrl;
/**
* icon
*/
private String icon;
} }

4
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ThirdPlatformService.java

@ -1,11 +1,11 @@
package com.epmet.service; package com.epmet.service;
import com.epmet.dto.result.ThirdplatformCustomerRegisterResultDTO; import com.epmet.dto.result.ThirdplatformResultDTO;
import java.util.List; import java.util.List;
public interface ThirdPlatformService { public interface ThirdPlatformService {
List<ThirdplatformCustomerRegisterResultDTO> listByCustomerId(String customerId, String actionKey); List<ThirdplatformResultDTO> listDTOS(String customerId, String actionKey);
} }

9
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; package com.epmet.service.impl;
import com.epmet.dao.ThirdplatformCustomerRegisterDao; 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 com.epmet.service.ThirdPlatformService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -12,10 +13,10 @@ import java.util.List;
public class ThirdPlatformServiceImpl implements ThirdPlatformService { public class ThirdPlatformServiceImpl implements ThirdPlatformService {
@Autowired @Autowired
private ThirdplatformCustomerRegisterDao thirdplatformCustomerRegisterDao; private ThirdplatformDao thirdplatformDao;
@Override @Override
public List<ThirdplatformCustomerRegisterResultDTO> listByCustomerId(String customerId, String actionKey) { public List<ThirdplatformResultDTO> listDTOS(String customerId, String actionKey) {
return thirdplatformCustomerRegisterDao.listDTOS(customerId, actionKey); return thirdplatformDao.listDTOS(customerId, actionKey);
} }
} }

24
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformCustomerRegisterDao.xml

@ -31,28 +31,4 @@
and PLATFORM_ID = #{platformId} and PLATFORM_ID = #{platformId}
and DEL_FLAG = 0 and DEL_FLAG = 0
</select> </select>
<select id="listDTOS" resultType="com.epmet.dto.result.ThirdplatformCustomerRegisterResultDTO">
select tcr.id,
tcr.customer_id,
tcr.platform_id,
tpf.PLATFORM_NAME,
tcr.del_flag,
tcr.revision,
tcr.created_by,
tcr.created_time,
tcr.updated_by,
tcr.updated_time
from thirdplatform_customer_register tcr
inner join thirdplatform tpf on (tcr.PLATFORM_ID = tpf.ID)
inner join thirdplatform_action ta on (tpf.ID = ta.PLATFORM_ID)
<where>
tcr.CUSTOMER_ID = #{customerId}
and ta.ACTION_KEY = #{actionKey}
and tcr.DEL_FLAG = 0
and tpf.DEL_FLAG = 0
</where>
</select>
</mapper> </mapper>

27
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformDao.xml

@ -9,6 +9,7 @@
<result property="platformKey" column="PLATFORM_KEY"/> <result property="platformKey" column="PLATFORM_KEY"/>
<result property="platformSecret" column="PLATFORM_SECRET"/> <result property="platformSecret" column="PLATFORM_SECRET"/>
<result property="apiService" column="API_SERVICE"/> <result property="apiService" column="API_SERVICE"/>
<result property="icon" column="ICON"/>
<result property="delFlag" column="DEL_FLAG"/> <result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/> <result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/> <result property="createdBy" column="CREATED_BY"/>
@ -17,5 +18,31 @@
<result property="updatedTime" column="UPDATED_TIME"/> <result property="updatedTime" column="UPDATED_TIME"/>
</resultMap> </resultMap>
<select id="listDTOS" resultType="com.epmet.dto.result.ThirdplatformResultDTO">
select tcr.id,
tcr.customer_id,
tcr.platform_id,
tpf.PLATFORM_NAME,
tpf.ICON,
tcr.del_flag,
tcr.revision,
tcr.created_by,
tcr.created_time,
tcr.updated_by,
tcr.updated_time
from thirdplatform_customer_register tcr
inner join thirdplatform tpf on (tcr.PLATFORM_ID = tpf.ID)
inner join thirdplatform_action ta on (tpf.ID = ta.PLATFORM_ID)
<where>
<if test="customerId != null and customerId != ''">
tcr.CUSTOMER_ID = #{customerId}
</if>
<if test="actionKey != null and actionKey != ''">
and ta.ACTION_KEY = #{actionKey}
</if>
and tcr.DEL_FLAG = 0
and tpf.DEL_FLAG = 0
</where>
</select>
</mapper> </mapper>
Loading…
Cancel
Save