Browse Source

对接三方平台修改

dev_shibei_match
wxz 4 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
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;
}

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;
@Data
public class ThirdplatformCustomerRegisterResultDTO {
/**
*
*/
private String customerId;
public class ThirdplatformResultDTO {
/**
*
*/
private String platformId;
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.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<List<ThirdplatformCustomerRegisterResultDTO>> listRegsteredPlatforms(@RequestBody ThirdPlatformFormDTO input) {
ValidatorUtils.validateEntity(input);
List<ThirdplatformCustomerRegisterResultDTO> platformRegs = thirdPlatformService.listByCustomerId(input.getCustomerId(), input.getActionKey());
return new Result<List<ThirdplatformCustomerRegisterResultDTO>>().ok(platformRegs);
@PostMapping("customer/list-platforms-by-action")
public Result<List<ThirdplatformResultDTO>> listPlatformsByCustomerAndAction(@RequestBody ThirdPlatformFormDTO input) {
ValidatorUtils.validateEntity(input, ThirdPlatformFormDTO.ListByCustomerAndActionGroup.class);
List<ThirdplatformResultDTO> platformRegs = thirdPlatformService.listDTOS(input.getCustomerId(), input.getActionKey());
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")

10
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<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);
}

11
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<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;
/**
* 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;
import com.epmet.dto.result.ThirdplatformCustomerRegisterResultDTO;
import com.epmet.dto.result.ThirdplatformResultDTO;
import java.util.List;
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;
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<ThirdplatformCustomerRegisterResultDTO> listByCustomerId(String customerId, String actionKey) {
return thirdplatformCustomerRegisterDao.listDTOS(customerId, actionKey);
public List<ThirdplatformResultDTO> listDTOS(String customerId, String 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 DEL_FLAG = 0
</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>

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="platformSecret" column="PLATFORM_SECRET"/>
<result property="apiService" column="API_SERVICE"/>
<result property="icon" column="ICON"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
@ -17,5 +18,31 @@
<result property="updatedTime" column="UPDATED_TIME"/>
</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>
Loading…
Cancel
Save