Browse Source

新增:

1.查询客户第三方平台配置接口
master
wxz 4 years ago
parent
commit
ef7e198e12
  1. 14
      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. 9
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ThirdPlatformConfigFormDTO.java
  4. 21
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ThirdPlatformConfigResultDTO.java
  5. 15
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/CustomerProjectParameterController.java
  6. 3
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/CustomerProjectParameterService.java
  7. 44
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/CustomerProjectParameterServiceImpl.java

14
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;
@ -10,8 +11,8 @@ import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
@FeignClient(name = ServiceConstant.EPMET_THIRD_SERVER, fallback = ThirdOpenFeignClientFallback.class)
//@FeignClient(name = ServiceConstant.EPMET_THIRD_SERVER, fallback = ThirdOpenFeignClientFallback.class, url = "http://localhost:8110")
//@FeignClient(name = ServiceConstant.EPMET_THIRD_SERVER, fallback = ThirdOpenFeignClientFallback.class)
@FeignClient(name = ServiceConstant.EPMET_THIRD_SERVER, fallback = ThirdOpenFeignClientFallback.class, url = "http://localhost:8110")
public interface ThirdOpenFeignClient {
/**
@ -23,4 +24,13 @@ 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);
}
}

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

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

@ -25,10 +25,12 @@ 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;
@ -161,4 +163,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