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