Browse Source

新增:

1.运营端查询第三方平台项目协助配置接口
dev_shibei_match
wxz 4 years ago
parent
commit
41e37f6a69
  1. 11
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/ThirdOpenFeignClient.java
  2. 6
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/fallback/ThirdOpenFeignClientFallback.java
  3. 2
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ThirdPlatformController.java
  4. 9
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ThirdPlatformConfigFormDTO.java
  5. 21
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ThirdPlatformConfigResultDTO.java
  6. 22
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/CustomerProjectParameterController.java
  7. 3
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/CustomerProjectParameterService.java
  8. 44
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/CustomerProjectParameterServiceImpl.java

11
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/ThirdOpenFeignClient.java

@ -3,6 +3,7 @@ package com.epmet.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.ThirdPlatformFormDTO;
import com.epmet.dto.result.ThirdplatformResultDTO;
import com.epmet.feign.fallback.ThirdOpenFeignClientFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
@ -23,4 +24,14 @@ public interface ThirdOpenFeignClient {
@PostMapping("/third/thirdplatform/customer/saveorupdate-selected-platforms")
Result saveOrUpdateSelectedPlatformsInfo(@RequestBody List<ThirdPlatformFormDTO> input);
/**
* 根据客户id和动作列出客户在指定动作下可用的第三方平台
* 用途工作端运营端配置界面
*
* @param input
* @return
*/
@PostMapping("/third/thirdplatform/customer/list-available-platforms-by-action")
Result<List<ThirdplatformResultDTO>> listAvailablePlatformsByCustomerAndAction(@RequestBody ThirdPlatformFormDTO input);
}

6
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/fallback/ThirdOpenFeignClientFallback.java

@ -4,6 +4,7 @@ import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.ThirdPlatformFormDTO;
import com.epmet.dto.result.ThirdplatformResultDTO;
import com.epmet.feign.ThirdOpenFeignClient;
import org.springframework.stereotype.Component;
@ -15,4 +16,9 @@ public class ThirdOpenFeignClientFallback implements ThirdOpenFeignClient {
public Result saveOrUpdateSelectedPlatformsInfo(List<ThirdPlatformFormDTO> input) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_THIRD_SERVER, "saveOrUpdateSelectedPlatformsInfo", input);
}
@Override
public Result<List<ThirdplatformResultDTO>> listAvailablePlatformsByCustomerAndAction(ThirdPlatformFormDTO input) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_THIRD_SERVER, "listAvailablePlatformsByCustomerAndAction", input);
}
}

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

@ -24,7 +24,7 @@ public class ThirdPlatformController {
private ThirdPlatformService thirdPlatformService;
/**
* 根据客户id和动作列出客户登记可用的第三方平台
* 根据客户id和动作列出客户在指定动作下可用的第三方平台
* 用途工作端运营端配置界面
*
* @param input

9
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ThirdPlatformConfigFormDTO.java

@ -12,10 +12,15 @@ public class ThirdPlatformConfigFormDTO {
public interface SaveThirdplatformConfig {
}
@NotBlank(message = "客户ID不能为空", groups = {SaveThirdplatformConfig.class})
public interface LoadThirdplatformConfig { }
@NotBlank(message = "客户ID不能为空", groups = {
SaveThirdplatformConfig.class,
LoadThirdplatformConfig.class})
private String customerId;
@NotBlank(message = "项目协助发送开关状态不能为空", groups = {SaveThirdplatformConfig.class})
@NotBlank(message = "项目协助发送开关状态不能为空", groups = {
SaveThirdplatformConfig.class})
private String sendProjectSwitch;
private List<CustomerSelectedPlatform> customerSelectedPlatformList;

21
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ThirdPlatformConfigResultDTO.java

@ -0,0 +1,21 @@
package com.epmet.dto.result;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@Data
public class ThirdPlatformConfigResultDTO {
private String sendProjectSwitch;
private List<CustomerSelectedPlatform> customerSelectedPlatformList = new ArrayList<CustomerSelectedPlatform>();
@Data
public static class CustomerSelectedPlatform {
private String customerId;
private String platformId;
private String platformName;
private String icon;
}
}

22
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/CustomerProjectParameterController.java

@ -25,17 +25,18 @@ import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.constant.ParameterKeyConstant;
import com.epmet.dto.CustomerProjectParameterDTO;
import com.epmet.dto.form.ParameterFormDTO;
import com.epmet.dto.form.ThirdPlatformConfigFormDTO;
import com.epmet.dto.result.ParameterResultDTO;
import com.epmet.dto.result.ThirdPlatformConfigResultDTO;
import com.epmet.excel.CustomerProjectParameterExcel;
import com.epmet.service.CustomerProjectParameterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotBlank;
import java.util.List;
import java.util.Map;
@ -152,6 +153,12 @@ public class CustomerProjectParameterController {
return new Result();
}
/**
* @Description 保存项目第三方平台的配置
* @return
* @author wxz
* @date 2021.03.19 17:10
*/
@PostMapping("save-thirdplatform-config")
public Result saveThirdplatformConfig(@RequestBody ThirdPlatformConfigFormDTO input) {
ValidatorUtils.validateEntity(input, ThirdPlatformConfigFormDTO.SaveThirdplatformConfig.class);
@ -161,4 +168,17 @@ public class CustomerProjectParameterController {
customerProjectParameterService.saveThirdplatformConfig(customerId, sendProjectSwitch, platformList);
return new Result();
}
/**
* @Description 保存项目第三方平台的配置
* @return
* @author wxz
* @date 2021.03.19 17:10
*/
@PostMapping("load-thirdplatform-config")
public Result<ThirdPlatformConfigResultDTO> loadThirdplatformConfig(@RequestBody ThirdPlatformConfigFormDTO input) {
ValidatorUtils.validateEntity(input, ThirdPlatformConfigFormDTO.LoadThirdplatformConfig.class);
ThirdPlatformConfigResultDTO resultDTO = customerProjectParameterService.loadThirdplatformConfig(input.getCustomerId(), ParameterKeyConstant.THIRD_PLATFORM_PROJECT_SEND);
return new Result<ThirdPlatformConfigResultDTO>().ok(resultDTO);
}
}

3
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/CustomerProjectParameterService.java

@ -23,6 +23,7 @@ import com.epmet.dto.CustomerProjectParameterDTO;
import com.epmet.dto.form.ParameterFormDTO;
import com.epmet.dto.form.ThirdPlatformConfigFormDTO;
import com.epmet.dto.result.ParameterResultDTO;
import com.epmet.dto.result.ThirdPlatformConfigResultDTO;
import com.epmet.entity.CustomerProjectParameterEntity;
import java.util.List;
@ -173,4 +174,6 @@ public interface CustomerProjectParameterService extends BaseService<CustomerPro
void saveThirdplatformConfig(String customerId,
String sendProjectSwitch,
List<ThirdPlatformConfigFormDTO.CustomerSelectedPlatform> platformList);
ThirdPlatformConfigResultDTO loadThirdplatformConfig(String customerId, String parameterKey);
}

44
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/CustomerProjectParameterServiceImpl.java

@ -21,9 +21,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.ParameterKeyConstant;
import com.epmet.constant.ThirdPlatformActions;
import com.epmet.dao.CustomerProjectParameterDao;
@ -32,6 +34,8 @@ import com.epmet.dto.form.ParameterFormDTO;
import com.epmet.dto.form.ThirdPlatformConfigFormDTO;
import com.epmet.dto.form.ThirdPlatformFormDTO;
import com.epmet.dto.result.ParameterResultDTO;
import com.epmet.dto.result.ThirdPlatformConfigResultDTO;
import com.epmet.dto.result.ThirdplatformResultDTO;
import com.epmet.entity.CustomerProjectParameterEntity;
import com.epmet.feign.ThirdOpenFeignClient;
import com.epmet.redis.CustomerProjectParameterRedis;
@ -332,6 +336,44 @@ public class CustomerProjectParameterServiceImpl extends BaseServiceImpl<Custome
thirdPlatformFormDTO.setPlatformName(p.getPlatformName());
return thirdPlatformFormDTO;
}).collect(Collectors.toList());
thirdOpenFeignClient.saveOrUpdateSelectedPlatformsInfo(formDTOS);
Result result = thirdOpenFeignClient.saveOrUpdateSelectedPlatformsInfo(formDTOS);
if (result == null || !result.success()) {
throw new RenException("调用Third服务,保存第三方平台列表失败");
}
}
@Override
public ThirdPlatformConfigResultDTO loadThirdplatformConfig(String customerId, String parameterKey) {
//1.去third取第三方平台列表
ThirdPlatformFormDTO form = new ThirdPlatformFormDTO();
form.setCustomerId(customerId);
form.setActionKey(ThirdPlatformActions.PROJECT_ASSIST);
Result<List<ThirdplatformResultDTO>> listResult = thirdOpenFeignClient.listAvailablePlatformsByCustomerAndAction(form);
if (listResult == null || !listResult.success()) {
throw new RenException("调用Third服务,获取第三方平台列表失败");
}
List<ThirdplatformResultDTO> platforms = listResult.getData();
// 2.本地查询
CustomerProjectParameterEntity params = new CustomerProjectParameterEntity();
params.setCustomerId(customerId);
params.setParameterKey(parameterKey);
String value = baseDao.selectParameterValueByKey(params);
value = StringUtils.isBlank(value) ? "0" : value;
ThirdPlatformConfigResultDTO result = new ThirdPlatformConfigResultDTO();
result.setSendProjectSwitch(value);
platforms.forEach(p -> {
ThirdPlatformConfigResultDTO.CustomerSelectedPlatform platform = new ThirdPlatformConfigResultDTO.CustomerSelectedPlatform();
platform.setCustomerId(customerId);
platform.setIcon(p.getIcon());
platform.setPlatformId(p.getPlatformId());
platform.setPlatformName(p.getPlatformName());
result.getCustomerSelectedPlatformList().add(platform);
});
return result;
}
}
Loading…
Cancel
Save