Browse Source

第三方平台-接口

dev
zhangyongzhangyong 4 years ago
parent
commit
6ceb2eca49
  1. 57
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/ThirdPlatformDTO.java
  2. 18
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CustomerFormDTO.java
  3. 15
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PlatformNameFormDTO.java
  4. 29
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PlatformRegisterFormDTO.java
  5. 27
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PlatformUnregisterFormDTO.java
  6. 118
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ThirdPlatformController.java
  7. 26
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformCustomerRegisterDao.java
  8. 47
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformDao.java
  9. 80
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ThirdPlatformService.java
  10. 65
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ThirdPlatformServiceImpl.java
  11. 42
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformCustomerRegisterDao.xml
  12. 67
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformDao.xml

57
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/ThirdPlatformDTO.java

@ -0,0 +1,57 @@
package com.epmet.dto;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @auther: zhangyong
* @date: 2021-04-08 17:27
*/
@Data
public class ThirdPlatformDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 平台名称
*/
@NotBlank(message = "平台名称 不能为空")
private String platformName;
/**
* 平台唯一KEY
*/
@NotBlank(message = "平台唯一KEY 不能为空")
private String platformKey;
/**
* 平台秘钥
*/
@NotBlank(message = "平台秘钥 不能为空")
private String platformSecret;
/**
* apiservice
*/
@NotBlank(message = "apiservice 不能为空")
private String apiService;
/**
* 基础url
*/
@NotBlank(message = "基础url 不能为空")
private String baseUrl;
/**
* icon
*/
@NotBlank(message = "icon 不能为空")
private String icon;
}

18
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CustomerFormDTO.java

@ -0,0 +1,18 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* 客户 共用入参
**/
@Data
public class CustomerFormDTO {
/**
* 客户id
**/
@NotBlank(message = "客户id 不能为空")
private String customerId;
}

15
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PlatformNameFormDTO.java

@ -0,0 +1,15 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
@Data
public class PlatformNameFormDTO {
/**
* 平台名称用于模糊搜索
**/
@NotBlank(message = "平台名称 不能为空")
private String platformName;
}

29
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PlatformRegisterFormDTO.java

@ -0,0 +1,29 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
* 第三方平台-新增客户接入的第三方平台
*
* @auther: zhangyong
* @date: 2021-04-08 17:27
*/
@Data
public class PlatformRegisterFormDTO {
/**
* 客户id
*/
@NotBlank(message = "客户id 不能为空")
private String customerId;
/**
* 平台id列表
*/
@NotNull(message = "平台id列表 不能为空")
private List<String> platformIdList;
}

27
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PlatformUnregisterFormDTO.java

@ -0,0 +1,27 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* 解除客户接入的平台
*
* @auther: zhangyong
* @date: 2021-04-08 17:27
*/
@Data
public class PlatformUnregisterFormDTO {
/**
* 客户id
*/
@NotBlank(message = "客户id 不能为空")
private String customerId;
/**
* 平台ID
*/
@NotBlank(message = "平台ID 不能为空")
private String platformId;
}

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

@ -1,11 +1,14 @@
package com.epmet.controller; package com.epmet.controller;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException;
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.SaveOrUpdateCustSelPlatformFormDTO; import com.epmet.dto.ThirdPlatformDTO;
import com.epmet.dto.form.ThirdPlatformFormDTO; import com.epmet.dto.form.*;
import com.epmet.dto.result.ThirdplatformResultDTO; import com.epmet.dto.result.ThirdplatformResultDTO;
import com.epmet.service.ThirdPlatformService; import com.epmet.service.ThirdPlatformService;
import org.apache.commons.lang3.StringUtils;
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;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
@ -89,4 +92,115 @@ public class ThirdPlatformController {
thirdPlatformService.saveOrUpdateSelectedPlatformInfo(input.getCustomerId(), input.getActionKey(), input.getPlatforms()); thirdPlatformService.saveOrUpdateSelectedPlatformInfo(input.getCustomerId(), input.getActionKey(), input.getPlatforms());
return new Result(); return new Result();
} }
/**
* 第三方平台-平台列表模糊查询
*
* @param formsDTO
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.ThirdPlatformDTO>>
* @Author zhangyong
* @Date 17:13 2021-04-08
**/
@PostMapping("list-platforms")
public Result<List<ThirdPlatformDTO>> listPlatforms(@RequestBody PlatformNameFormDTO formsDTO) {
ValidatorUtils.validateEntity(formsDTO);
return new Result<List<ThirdPlatformDTO>>().ok(thirdPlatformService.listPlatforms(formsDTO.getPlatformName()));
}
/**
* 第三方平台-修改平台
*
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
* @Author zhangyong
* @Date 17:31 2021-04-08
**/
@PostMapping("update-platform")
public Result updatePlatform(@RequestBody ThirdPlatformDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
if (StringUtils.isBlank(formDTO.getId())) {
throw new RenException("主键不能为空");
}
thirdPlatformService.updatePlatform(formDTO);
return new Result();
}
/**
* 第三方平台-新增平台
*
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.ThirdPlatformDTO>
* @Author zhangyong
* @Date 17:31 2021-04-08
**/
@PostMapping("add-platform")
public Result<ThirdPlatformDTO> addPlatform(@RequestBody ThirdPlatformDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
return new Result<ThirdPlatformDTO>().ok(thirdPlatformService.addPlatform(formDTO));
}
/**
* 第三方平台-客户可接入的平台列表
* 该客户还没有注册的平台列表从thirdplatform表中找该客户没注册的不在thirdplatform_customer_register中或者在其中但是del_flag为1的返回
*
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.ThirdPlatformDTO>>
* @Author zhangyong
* @Date 09:46 2021-04-09
**/
@PostMapping("customer/registrable-platform-list")
public Result<List<ThirdPlatformDTO>> registrablePlatformList(@RequestBody CustomerFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
return new Result<List<ThirdPlatformDTO>>().ok(thirdPlatformService.listRegistrablePlatform(formDTO));
}
/**
* 第三方平台-客户已经接入的平台列表
* 在thirdplatform_customer_register中的记录
*
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.ThirdPlatformDTO>>
* @Author zhangyong
* @Date 09:46 2021-04-09
**/
@PostMapping("customer/registered-platform-list")
public Result<List<ThirdPlatformDTO>> registeredPlatformList(@RequestBody CustomerFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
return new Result<List<ThirdPlatformDTO>>().ok(thirdPlatformService.listRegisteredPlatform(formDTO));
}
/**
* 第三方平台-解除客户接入的平台
* 单个解除thirdplatform_customer_register表del_flag状态置为1
*
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
* @Author zhangyong
* @Date 09:46 2021-04-09
**/
@PostMapping("customer/unregister-platform")
public Result unregisterPlatform(@RequestBody PlatformUnregisterFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
thirdPlatformService.unregisterPlatformCustomer(formDTO);
return new Result();
}
/**
* 第三方平台-新增客户接入的第三方平台
* 新增该客户要接入的第三方平台thirdplatform_customer_register表新增数据customized_xxx默认从thirdplatform表取过来
*
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
* @Author zhangyong
* @Date 10:34 2021-04-09
**/
@PostMapping("customer/register-platform")
public Result registerPlatform(@RequestBody PlatformRegisterFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
if (formDTO.getPlatformIdList().size() == NumConstant.ZERO) {
throw new RenException("formDTO.getPlatformIdList().size() == 0;平台id列表不能为空");
}
thirdPlatformService.registerThirdPlatformCustomer(formDTO);
return new Result();
}
} }

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

@ -18,7 +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.dto.result.ThirdplatformResultDTO; import com.epmet.dto.form.PlatformUnregisterFormDTO;
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;
@ -26,7 +26,7 @@ import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
/** /**
* *
* *
* @author generator generator@elink-cn.com * @author generator generator@elink-cn.com
* @since v1.0.0 2021-03-15 * @since v1.0.0 2021-03-15
@ -35,4 +35,24 @@ import java.util.List;
public interface ThirdplatformCustomerRegisterDao extends BaseDao<ThirdplatformCustomerRegisterEntity> { public interface ThirdplatformCustomerRegisterDao extends BaseDao<ThirdplatformCustomerRegisterEntity> {
ThirdplatformCustomerRegisterEntity getByCustomerIdAndPlatformId(@Param("customerId") String customerId, @Param("platformId") String platformId); ThirdplatformCustomerRegisterEntity getByCustomerIdAndPlatformId(@Param("customerId") String customerId, @Param("platformId") String platformId);
}
/**
* 批量新增
* @param list
* @return int
* @Author zhangyong
* @Date 11:05 2021-04-09
**/
int batchInsertThirdplatformCustomerRegister(@Param("list") List<ThirdplatformCustomerRegisterEntity> list);
/**
* 第三方平台-解除客户接入的平台
* 单个解除.thirdplatform_customer_register表del_flag状态置为1
*
* @param formDTO
* @return void
* @Author zhangyong
* @Date 10:15 2021-04-09
**/
void unregisterPlatformCustomer(PlatformUnregisterFormDTO formDTO);
}

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

@ -18,6 +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.dto.ThirdPlatformDTO;
import com.epmet.dto.result.ThirdplatformResultDTO; 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;
@ -26,7 +27,7 @@ import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
/** /**
* *
* *
* @author generator generator@elink-cn.com * @author generator generator@elink-cn.com
* @since v1.0.0 2021-03-15 * @since v1.0.0 2021-03-15
@ -43,4 +44,46 @@ public interface ThirdplatformDao extends BaseDao<ThirdplatformEntity> {
List<ThirdplatformResultDTO> listAvailablePlatformsByCustomerAndAction(@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); List<ThirdplatformResultDTO> listSelectableByCustomerAndActionGroup(@Param("customerId") String customerId, @Param("actionKey") String actionKey);
}
/**
* 第三方平台-平台列表模糊查询
*
* @param platformName 平台名称用于模糊搜索
* @return java.util.List<com.epmet.dto.ThirdPlatformDTO>
* @Author zhangyong
* @Date 17:14 2021-04-08
**/
List<ThirdPlatformDTO> selectListPlatforms(@Param("platformName") String platformName);
/**
* 第三方平台-客户可接入的平台列表
* 该客户还没有注册的平台列表从thirdplatform表中找该客户没注册的不在thirdplatform_customer_register中或者在其中但是del_flag为1的返回
*
* @param customerId
* @return java.util.List<com.epmet.dto.ThirdPlatformDTO>
* @Author zhangyong
* @Date 09:47 2021-04-09
**/
List<ThirdPlatformDTO> selectListRegistrablePlatform(@Param("customerId") String customerId);
/**
* 第三方平台-客户已经接入的平台列表
* 在thirdplatform_customer_register中的记录
*
* @param customerId
* @return java.util.List<com.epmet.dto.ThirdPlatformDTO>
* @Author zhangyong
* @Date 09:47 2021-04-09
**/
List<ThirdPlatformDTO> selectListRegisteredPlatform(@Param("customerId") String customerId);
/**
* 查询第三方平台
*
* @param platformIds
* @return java.util.List<com.epmet.dto.ThirdPlatformDTO>
* @Author zhangyong
* @Date 10:51 2021-04-09
**/
List<ThirdPlatformDTO> selectListThirdPlatform(@Param("platformIds") List<String> platformIds);
}

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

@ -1,6 +1,10 @@
package com.epmet.service; package com.epmet.service;
import com.epmet.dto.ThirdPlatformDTO;
import com.epmet.dto.form.CustomerFormDTO;
import com.epmet.dto.form.ThirdPlatformFormDTO; import com.epmet.dto.form.ThirdPlatformFormDTO;
import com.epmet.dto.form.PlatformRegisterFormDTO;
import com.epmet.dto.form.PlatformUnregisterFormDTO;
import com.epmet.dto.result.ThirdplatformResultDTO; import com.epmet.dto.result.ThirdplatformResultDTO;
import java.util.List; import java.util.List;
@ -22,4 +26,78 @@ public interface ThirdPlatformService {
void updateCustomizePlatformInfo(ThirdPlatformFormDTO input); void updateCustomizePlatformInfo(ThirdPlatformFormDTO input);
void saveOrUpdateSelectedPlatformInfo(String customerId, String actionKey, List<ThirdPlatformFormDTO> platforms); void saveOrUpdateSelectedPlatformInfo(String customerId, String actionKey, List<ThirdPlatformFormDTO> platforms);
}
/**
* 第三方平台-平台列表模糊查询
*
* @param platformName 平台名称用于模糊搜索
* @return java.util.List<com.epmet.dto.ThirdPlatformDTO>
* @Author zhangyong
* @Date 17:14 2021-04-08
**/
List<ThirdPlatformDTO> listPlatforms(String platformName);
/**
* 第三方平台-修改平台
*
* @param formDTO
* @return void
* @Author zhangyong
* @Date 17:43 2021-04-08
**/
void updatePlatform(ThirdPlatformDTO formDTO);
/**
* 第三方平台-新增平台
*
* @param formDTO
* @return com.epmet.dto.ThirdPlatformDTO
* @Author zhangyong
* @Date 17:43 2021-04-08
**/
ThirdPlatformDTO addPlatform(ThirdPlatformDTO formDTO);
/**
* 第三方平台-客户可接入的平台列表
* 该客户还没有注册的平台列表从thirdplatform表中找该客户没注册的不在thirdplatform_customer_register中或者在其中但是del_flag为1的返回
*
* @param formDTO
* @return java.util.List<com.epmet.dto.ThirdPlatformDTO>
* @Author zhangyong
* @Date 09:47 2021-04-09
**/
List<ThirdPlatformDTO> listRegistrablePlatform(CustomerFormDTO formDTO);
/**
* 第三方平台-客户已经接入的平台列表
* 在thirdplatform_customer_register中的记录
*
* @param formDTO
* @return java.util.List<com.epmet.dto.ThirdPlatformDTO>
* @Author zhangyong
* @Date 09:47 2021-04-09
**/
List<ThirdPlatformDTO> listRegisteredPlatform(CustomerFormDTO formDTO);
/**
* 第三方平台-解除客户接入的平台
* 单个解除.thirdplatform_customer_register表del_flag状态置为1
*
* @param formDTO
* @return void
* @Author zhangyong
* @Date 10:15 2021-04-09
**/
void unregisterPlatformCustomer(PlatformUnregisterFormDTO formDTO);
/**
* 第三方平台-新增客户接入的第三方平台
* 新增该客户要接入的第三方平台thirdplatform_customer_register表新增数据customized_xxx默认从thirdplatform表取过来
*
* @param formDTO
* @return void
* @Author zhangyong
* @Date 10:15 2021-04-09
**/
void registerThirdPlatformCustomer(PlatformRegisterFormDTO formDTO);
}

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

@ -2,24 +2,27 @@ package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.ThirdplatformCustomerActionDao; import com.epmet.dao.ThirdplatformCustomerActionDao;
import com.epmet.dao.ThirdplatformCustomerRegisterDao; import com.epmet.dao.ThirdplatformCustomerRegisterDao;
import com.epmet.dao.ThirdplatformDao; import com.epmet.dao.ThirdplatformDao;
import com.epmet.dto.ThirdPlatformDTO;
import com.epmet.dto.form.CustomerFormDTO;
import com.epmet.dto.form.ThirdPlatformFormDTO; import com.epmet.dto.form.ThirdPlatformFormDTO;
import com.epmet.dto.form.PlatformRegisterFormDTO;
import com.epmet.dto.form.PlatformUnregisterFormDTO;
import com.epmet.dto.result.ThirdplatformResultDTO; import com.epmet.dto.result.ThirdplatformResultDTO;
import com.epmet.entity.ThirdplatformActionEntity;
import com.epmet.entity.ThirdplatformCustomerActionEntity; import com.epmet.entity.ThirdplatformCustomerActionEntity;
import com.epmet.entity.ThirdplatformCustomerRegisterEntity; import com.epmet.entity.ThirdplatformCustomerRegisterEntity;
import com.epmet.entity.ThirdplatformEntity;
import com.epmet.service.ThirdPlatformService; import com.epmet.service.ThirdPlatformService;
import jodd.util.CollectionUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.validation.constraints.NotBlank; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
@Service @Service
public class ThirdPlatformServiceImpl implements ThirdPlatformService { public class ThirdPlatformServiceImpl implements ThirdPlatformService {
@ -105,4 +108,56 @@ public class ThirdPlatformServiceImpl implements ThirdPlatformService {
entity.setCustomizedPlatformIcon(platformFormDTO.getIcon()); entity.setCustomizedPlatformIcon(platformFormDTO.getIcon());
thirdplatformCustomerRegisterDao.update(entity, conditions); thirdplatformCustomerRegisterDao.update(entity, conditions);
} }
@Override
public List<ThirdPlatformDTO> listPlatforms(String platformName) {
return thirdplatformDao.selectListPlatforms(platformName);
}
@Override
public void updatePlatform(ThirdPlatformDTO formDTO) {
ThirdplatformEntity entity = ConvertUtils.sourceToTarget(formDTO, ThirdplatformEntity.class);
thirdplatformDao.updateById(entity);
}
@Override
public ThirdPlatformDTO addPlatform(ThirdPlatformDTO formDTO) {
ThirdplatformEntity entity = ConvertUtils.sourceToTarget(formDTO, ThirdplatformEntity.class);
thirdplatformDao.insert(entity);
formDTO.setId(entity.getId());
return formDTO;
}
@Override
public List<ThirdPlatformDTO> listRegistrablePlatform(CustomerFormDTO formDTO) {
return thirdplatformDao.selectListRegistrablePlatform(formDTO.getCustomerId());
}
@Override
public List<ThirdPlatformDTO> listRegisteredPlatform(CustomerFormDTO formDTO) {
return thirdplatformDao.selectListRegisteredPlatform(formDTO.getCustomerId());
}
@Override
public void unregisterPlatformCustomer(PlatformUnregisterFormDTO formDTO) {
thirdplatformCustomerRegisterDao.unregisterPlatformCustomer(formDTO);
}
@Override
public void registerThirdPlatformCustomer(PlatformRegisterFormDTO formDTO) {
List<ThirdplatformCustomerRegisterEntity> entityList = new ArrayList<>();
List<ThirdPlatformDTO> thirdPlatforms = thirdplatformDao.selectListThirdPlatform(formDTO.getPlatformIdList());
for (ThirdPlatformDTO dto : thirdPlatforms) {
ThirdplatformCustomerRegisterEntity entity = new ThirdplatformCustomerRegisterEntity();
entity.setCustomerId(formDTO.getCustomerId());
entity.setPlatformId(dto.getId());
entity.setCustomizedPlatformName(dto.getPlatformName());
entity.setCustomizedPlatformIcon(dto.getIcon());
entityList.add(entity);
}
if (entityList.size() > NumConstant.ZERO) {
thirdplatformCustomerRegisterDao.batchInsertThirdplatformCustomerRegister(entityList);
}
}
} }

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

@ -35,4 +35,44 @@
and PLATFORM_ID = #{platformId} and PLATFORM_ID = #{platformId}
and DEL_FLAG = 0 and DEL_FLAG = 0
</select> </select>
</mapper>
<insert id="batchInsertThirdplatformCustomerRegister" parameterType="map">
insert into thirdplatform_customer_register
(
ID,
CUSTOMER_ID,
PLATFORM_ID,
CUSTOMIZED_PLATFORM_NAME,
CUSTOMIZED_PLATFORM_ICON,
DEL_FLAG,
REVISION,
CREATED_BY,
CREATED_TIME,
UPDATED_BY,
UPDATED_TIME
) values
<foreach collection="list" item="item" index="index" separator=",">
(
(SELECT REPLACE(UUID(), '-', '') AS id),
#{item.customerId},
#{item.platformId},
#{item.customizedPlatformName},
#{item.customizedPlatformIcon},
'0',
0,
'APP_USER',
now(),
'APP_USER',
now()
)
</foreach>
</insert>
<update id="unregisterPlatformCustomer">
UPDATE thirdplatform_customer_register
SET DEL_FLAG = '1'
WHERE
DEL_FLAG = '0'
AND CUSTOMER_ID = #{customerId} AND PLATFORM_ID = #{platformId}
</update>
</mapper>

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

@ -87,4 +87,69 @@
and ta.ACTION_KEY = #{actionKey} and ta.ACTION_KEY = #{actionKey}
and tcr.DEL_FLAG = 0 and tcr.DEL_FLAG = 0
</select> </select>
</mapper>
<select id="selectListPlatforms" resultType="com.epmet.dto.ThirdPlatformDTO">
SELECT
ID,
PLATFORM_NAME,
PLATFORM_KEY,
PLATFORM_SECRET,
ICON,
API_SERVICE,
BASE_URL
FROM `thirdplatform`
WHERE DEL_FLAG = '0'
AND PLATFORM_NAME LIKE concat('%', #{platformName}, '%')
</select>
<select id="selectListRegistrablePlatform" resultType="com.epmet.dto.ThirdPlatformDTO">
SELECT
ID,
PLATFORM_NAME,
PLATFORM_KEY,
PLATFORM_SECRET,
ICON,
API_SERVICE,
BASE_URL
FROM thirdplatform
WHERE DEL_FLAG = '0'
AND ID NOT IN (
SELECT PLATFORM_ID FROM thirdplatform_customer_register WHERE DEL_FLAG = '0' AND CUSTOMER_ID = #{customerId}
)
</select>
<select id="selectListRegisteredPlatform" resultType="com.epmet.dto.ThirdPlatformDTO">
SELECT
ID,
PLATFORM_NAME,
PLATFORM_KEY,
PLATFORM_SECRET,
ICON,
API_SERVICE,
BASE_URL
FROM thirdplatform
WHERE DEL_FLAG = '0'
AND ID IN (
SELECT PLATFORM_ID FROM thirdplatform_customer_register WHERE DEL_FLAG = '0' AND CUSTOMER_ID = #{customerId}
)
</select>
<select id="selectListThirdPlatform" resultType="com.epmet.dto.ThirdPlatformDTO">
SELECT
ID,
PLATFORM_NAME,
PLATFORM_KEY,
PLATFORM_SECRET,
ICON,
API_SERVICE,
BASE_URL
FROM thirdplatform
WHERE DEL_FLAG = '0'
<if test="platformIds != null and platformIds.size() != 0">
AND ID IN
<foreach collection="platformIds" item="platformId" open="(" close=")" separator=",">
#{platformId}
</foreach>
</if>
</select>
</mapper>

Loading…
Cancel
Save