Browse Source

修改第三方平台对接的设计

dev_shibei_match
wxz 4 years ago
parent
commit
c5fd4f60ad
  1. 8
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ThirdPlatformFormDTO.java
  2. 26
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ThirdPlatformController.java
  3. 33
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformCustomerActionDao.java
  4. 4
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformDao.java
  5. 56
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformCustomerActionEntity.java
  6. 4
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformCustomerRegisterEntity.java
  7. 3
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ThirdPlatformService.java
  8. 10
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ThirdPlatformServiceImpl.java
  9. 20
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformCustomerActionDao.xml
  10. 4
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformCustomerRegisterDao.xml
  11. 42
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformDao.xml

8
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ThirdPlatformFormDTO.java

@ -8,14 +8,14 @@ import javax.validation.constraints.NotBlank;
public class ThirdPlatformFormDTO {
// 根据客户和动作查询分组
public interface ListByCustomerAndActionGroup {}
public interface ListAvailableByCustomerAndActionGroup {}
// 根据动作查询分组
public interface ListByActionGroup {}
public interface ListSelectableByCustomerAndActionGroup {}
@NotBlank(message = "客户ID不能为空", groups = { ListByCustomerAndActionGroup.class })
@NotBlank(message = "客户ID不能为空", groups = { ListAvailableByCustomerAndActionGroup.class })
private String customerId;
@NotBlank(message = "客户ID不能为空", groups = { ListByCustomerAndActionGroup.class, ListByActionGroup.class })
@NotBlank(message = "客户ID不能为空", groups = { ListAvailableByCustomerAndActionGroup.class, ListSelectableByCustomerAndActionGroup.class })
private String actionKey;
}

26
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ThirdPlatformController.java

@ -24,32 +24,32 @@ public class ThirdPlatformController {
private ThirdPlatformService thirdPlatformService;
/**
* 根据客户id和动作列出客户开通可用的第三方平台
* 根据客户id和动作列出客户登记可用的第三方平台
*
* @param input
* @return
*/
@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());
@PostMapping("customer/list-available-platforms-by-action")
public Result<List<ThirdplatformResultDTO>> listAvailablePlatformsByCustomerAndAction(@RequestBody ThirdPlatformFormDTO input) {
ValidatorUtils.validateEntity(input, ThirdPlatformFormDTO.ListAvailableByCustomerAndActionGroup.class);
List<ThirdplatformResultDTO> platformRegs = thirdPlatformService.listAvailablePlatformsByCustomerAndAction(input.getCustomerId(), input.getActionKey());
return new Result<List<ThirdplatformResultDTO>>().ok(platformRegs);
}
/**
* @Description 根据动作列出平台列表
* @return
* @Description 根据客户id和动作列出客户可选的第三方系统
* @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("customer/list-selectable-platforms-by-action")
public Result<List<ThirdplatformResultDTO>> listSelectablePlatformsByAction(@RequestBody ThirdPlatformFormDTO input) {
ValidatorUtils.validateEntity(input, ThirdPlatformFormDTO.ListSelectableByCustomerAndActionGroup.class);
List<ThirdplatformResultDTO> platformRegs = thirdPlatformService.listSelectableByCustomerAndActionGroup(input.getCustomerId(), input.getActionKey());
return new Result<List<ThirdplatformResultDTO>>().ok(platformRegs);
}
//@PostMapping("register")
}

33
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformCustomerActionDao.java

@ -0,0 +1,33 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.ThirdplatformCustomerActionEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 客户针对指定操作所选用的第三方平台列表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-03-18
*/
@Mapper
public interface ThirdplatformCustomerActionDao extends BaseDao<ThirdplatformCustomerActionEntity> {
}

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

@ -39,4 +39,8 @@ public interface ThirdplatformDao extends BaseDao<ThirdplatformEntity> {
* @return
*/
List<ThirdplatformResultDTO> listDTOS(@Param("customerId") String customerId, @Param("actionKey") String actionKey);
List<ThirdplatformResultDTO> listAvailablePlatformsByCustomerAndAction(@Param("customerId") String customerId, @Param("actionKey") String actionKey);
List<ThirdplatformResultDTO> listSelectableByCustomerAndActionGroup(@Param("customerId") String customerId, @Param("actionKey") String actionKey);
}

56
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformCustomerActionEntity.java

@ -0,0 +1,56 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 客户针对指定操作所选用的第三方平台列表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-03-18
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("thirdplatform_customer_action")
public class ThirdplatformCustomerActionEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* 平台ID
*/
private String platformId;
/**
* 动作key
*/
private String actionKey;
}

4
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformCustomerRegisterEntity.java

@ -48,4 +48,8 @@ public class ThirdplatformCustomerRegisterEntity extends BaseEpmetEntity {
*/
private String platformId;
private String customizedPlatformName;
private String customizedPlatformIcon;
}

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

@ -6,6 +6,7 @@ import java.util.List;
public interface ThirdPlatformService {
List<ThirdplatformResultDTO> listDTOS(String customerId, String actionKey);
List<ThirdplatformResultDTO> listAvailablePlatformsByCustomerAndAction(String customerId, String actionKey);
List<ThirdplatformResultDTO> listSelectableByCustomerAndActionGroup(String customerId, String actionKey);
}

10
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ThirdPlatformServiceImpl.java

@ -1,6 +1,5 @@
package com.epmet.service.impl;
import com.epmet.dao.ThirdplatformCustomerRegisterDao;
import com.epmet.dao.ThirdplatformDao;
import com.epmet.dto.result.ThirdplatformResultDTO;
import com.epmet.service.ThirdPlatformService;
@ -16,7 +15,12 @@ public class ThirdPlatformServiceImpl implements ThirdPlatformService {
private ThirdplatformDao thirdplatformDao;
@Override
public List<ThirdplatformResultDTO> listDTOS(String customerId, String actionKey) {
return thirdplatformDao.listDTOS(customerId, actionKey);
public List<ThirdplatformResultDTO> listAvailablePlatformsByCustomerAndAction(String customerId, String actionKey) {
return thirdplatformDao.listAvailablePlatformsByCustomerAndAction(customerId, actionKey);
}
@Override
public List<ThirdplatformResultDTO> listSelectableByCustomerAndActionGroup(String customerId, String actionKey) {
return thirdplatformDao.listSelectableByCustomerAndActionGroup(customerId, actionKey);
}
}

20
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformCustomerActionDao.xml

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.ThirdplatformCustomerActionDao">
<resultMap type="com.epmet.entity.ThirdplatformCustomerActionEntity" id="thirdplatformCustomerActionMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="platformId" column="PLATFORM_ID"/>
<result property="actionKey" column="ACTION_KEY"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
</mapper>

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

@ -7,6 +7,8 @@
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="platformId" column="PLATFORM_ID"/>
<result property="customizedPlatformName" column="CUSTOMIZED_PLATFORM_NAME"/>
<result property="customizedPlatformIcon" column="CUSTOMIZED_PLATFORM_ICON"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
@ -20,6 +22,8 @@
select tcr.id,
customer_id,
platform_id,
customized_platform_name,
customized_platform_icon,
del_flag,
revision,
created_by,

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

@ -45,4 +45,46 @@
</where>
</select>
<select id="listAvailablePlatformsByCustomerAndAction"
resultType="com.epmet.dto.result.ThirdplatformResultDTO">
select tca.id,
tca.customer_id,
tca.platform_id,
tca.action_key,
tca.del_flag,
tca.revision,
tca.created_by,
tca.created_time,
tca.updated_by,
tca.updated_time,
tcr.CUSTOMIZED_PLATFORM_NAME platformName,
tcr.CUSTOMIZED_PLATFORM_ICON icon
from thirdplatform_customer_action tca
inner join thirdplatform_customer_register tcr
on (tca.CUSTOMER_ID = tcr.CUSTOMER_ID and tca.PLATFORM_ID = tcr.PLATFORM_ID)
where tca.CUSTOMER_ID = #{customerId}
and tca.ACTION_KEY = #{actionKey}
and tca.DEL_FLAG = 0
and tcr.DEL_FLAG = 0
</select>
<select id="listSelectableByCustomerAndActionGroup"
resultType="com.epmet.dto.result.ThirdplatformResultDTO">
select tcr.id,
tcr.customer_id,
tcr.platform_id,
tcr.customized_platform_name platformName,
tcr.customized_platform_icon 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_action ta on (tcr.PLATFORM_ID = ta.PLATFORM_ID)
where tcr.CUSTOMER_ID = #{customerId}
and ta.ACTION_KEY = #{actionKey}
and tcr.DEL_FLAG = 0
</select>
</mapper>
Loading…
Cancel
Save