Browse Source

增加一次性保存客户-第三方平台-action的接口

dev
wxz 4 years ago
parent
commit
7b3c63a2e2
  1. 17
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ThirdPlatformFormDTO.java
  2. 26
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/ThirdOpenFeignClient.java
  3. 18
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/fallback/ThirdOpenFeignClientFallback.java
  4. 12
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ThirdPlatformController.java
  5. 2
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformCustomerActionDao.java
  6. 2
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ThirdPlatformService.java
  7. 52
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ThirdPlatformServiceImpl.java
  8. 7
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformCustomerActionDao.xml
  9. 7
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ParameterFormDTO.java
  10. 30
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ThirdPlatformConfigFormDTO.java
  11. 5
      epmet-module/gov-project/gov-project-server/pom.xml
  12. 6
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ParameterKeyConstant.java
  13. 26
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/CustomerProjectParameterController.java
  14. 7
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/CustomerProjectParameterService.java
  15. 56
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/CustomerProjectParameterServiceImpl.java

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

@ -21,26 +21,33 @@ public class ThirdPlatformFormDTO {
// 更新客户自定义的平台信息 // 更新客户自定义的平台信息
public interface UpdateCustomizePlatformInfo {} public interface UpdateCustomizePlatformInfo {}
public interface SaveOrUpdateSelectedPlatformInfo {}
@NotBlank(message = "客户ID不能为空", groups = { ListAvailableByCustomerAndActionGroup.class, @NotBlank(message = "客户ID不能为空", groups = { ListAvailableByCustomerAndActionGroup.class,
ListSelectableByCustomerAndActionGroup.class, ListSelectableByCustomerAndActionGroup.class,
SaveCustomerSelectedPlatformGroup.class, SaveCustomerSelectedPlatformGroup.class,
ListSelectedPlatforms.class, ListSelectedPlatforms.class,
UpdateCustomizePlatformInfo.class }) UpdateCustomizePlatformInfo.class,
SaveOrUpdateSelectedPlatformInfo.class })
private String customerId; private String customerId;
@NotBlank(message = "动作不能为空", groups = { ListAvailableByCustomerAndActionGroup.class, @NotBlank(message = "动作不能为空", groups = { ListAvailableByCustomerAndActionGroup.class,
ListSelectableByCustomerAndActionGroup.class, ListSelectableByCustomerAndActionGroup.class,
SaveCustomerSelectedPlatformGroup.class }) SaveCustomerSelectedPlatformGroup.class,
SaveOrUpdateSelectedPlatformInfo.class })
private String actionKey; private String actionKey;
@NotBlank(message = "平台ID不能为空", groups = { SaveCustomerSelectedPlatformGroup.class, @NotBlank(message = "平台ID不能为空", groups = { SaveCustomerSelectedPlatformGroup.class,
UpdateCustomizePlatformInfo.class }) UpdateCustomizePlatformInfo.class,
SaveOrUpdateSelectedPlatformInfo.class })
private String platformId; private String platformId;
@NotBlank(message = "平台名称不能为空", groups = { UpdateCustomizePlatformInfo.class }) @NotBlank(message = "平台名称不能为空", groups = { UpdateCustomizePlatformInfo.class,
SaveOrUpdateSelectedPlatformInfo.class })
private String platformName; private String platformName;
@NotBlank(message = "平台图标不能为空", groups = { UpdateCustomizePlatformInfo.class }) @NotBlank(message = "平台图标不能为空", groups = { UpdateCustomizePlatformInfo.class,
SaveOrUpdateSelectedPlatformInfo.class })
private String icon; private String icon;
} }

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

@ -0,0 +1,26 @@
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.feign.fallback.ThirdOpenFeignClientFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
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")
public interface ThirdOpenFeignClient {
/**
* @Description 保存或修改客户选中的第三方平台信息
* @return
* @author wxz
* @date 2021.03.19 15:25
*/
@PostMapping("/third/thirdplatform/customer/saveorupdate-selected-platforms")
Result saveOrUpdateSelectedPlatformsInfo(@RequestBody List<ThirdPlatformFormDTO> input);
}

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

@ -0,0 +1,18 @@
package com.epmet.feign.fallback;
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.feign.ThirdOpenFeignClient;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
public class ThirdOpenFeignClientFallback implements ThirdOpenFeignClient {
@Override
public Result saveOrUpdateSelectedPlatformsInfo(List<ThirdPlatformFormDTO> input) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_THIRD_SERVER, "saveOrUpdateSelectedPlatformsInfo", input);
}
}

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

@ -76,4 +76,16 @@ public class ThirdPlatformController {
return new Result(); return new Result();
} }
/**
* @Description 保存或修改客户选中的第三方平台信息
* @return
* @author wxz
* @date 2021.03.19 15:25
*/
@PostMapping("customer/saveorupdate-selected-platforms")
public Result saveOrUpdateSelectedPlatformsInfo(@RequestBody List<ThirdPlatformFormDTO> input) {
input.stream().forEach(i -> ValidatorUtils.validateEntity(i, ThirdPlatformFormDTO.SaveOrUpdateSelectedPlatformInfo.class));
thirdPlatformService.saveOrUpdateSelectedPlatformInfo(input);
return new Result();
}
} }

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

@ -33,4 +33,6 @@ public interface ThirdplatformCustomerActionDao extends BaseDao<ThirdplatformCus
ThirdplatformCustomerActionEntity selectOneEntity(@Param("customerId") String customerId, ThirdplatformCustomerActionEntity selectOneEntity(@Param("customerId") String customerId,
@Param("platformId") String platformId, @Param("platformId") String platformId,
@Param("actionKey") String actionKey); @Param("actionKey") String actionKey);
int deleteByCustomerIdAndActionKey(@Param("customerId") String customerId, @Param("actionKey") String actionKey);
} }

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

@ -20,4 +20,6 @@ public interface ThirdPlatformService {
void saveSelectedPlatforms(List<ThirdPlatformFormDTO> platforms); void saveSelectedPlatforms(List<ThirdPlatformFormDTO> platforms);
void updateCustomizePlatformInfo(ThirdPlatformFormDTO input); void updateCustomizePlatformInfo(ThirdPlatformFormDTO input);
void saveOrUpdateSelectedPlatformInfo(List<ThirdPlatformFormDTO> platforms);
} }

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

@ -1,18 +1,25 @@
package com.epmet.service.impl; package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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.form.ThirdPlatformFormDTO; import com.epmet.dto.form.ThirdPlatformFormDTO;
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.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.List; import java.util.List;
import java.util.stream.Collectors;
@Service @Service
public class ThirdPlatformServiceImpl implements ThirdPlatformService { public class ThirdPlatformServiceImpl implements ThirdPlatformService {
@ -60,4 +67,49 @@ public class ThirdPlatformServiceImpl implements ThirdPlatformService {
thirdplatformCustomerRegisterDao.updateById(exist); thirdplatformCustomerRegisterDao.updateById(exist);
} }
} }
@Transactional(rollbackFor = Exception.class)
@Override
public void saveOrUpdateSelectedPlatformInfo(List<ThirdPlatformFormDTO> platforms) {
if (CollectionUtils.isEmpty(platforms)) {
return;
}
// 1.物理删除客户-action所有对应关系
int deletedCount = thirdplatformCustomerActionDao.deleteByCustomerIdAndActionKey(platforms.get(0).getCustomerId(), platforms.get(0).getActionKey());
platforms.stream().forEach(pt -> {
String customerId = pt.getCustomerId();
String platformId = pt.getPlatformId();
// 2.更新用户自定义的平台信息
updateThirdPlatformCustomerRegInfo(pt);
// 3.重新建立customer-platform-action对应关系
ThirdplatformCustomerActionEntity tpcaEntity = new ThirdplatformCustomerActionEntity();
tpcaEntity.setPlatformId(platformId);
tpcaEntity.setCustomerId(customerId);
tpcaEntity.setActionKey(pt.getActionKey());
thirdplatformCustomerActionDao.insert(tpcaEntity);
});
}
/**
* @Description 更新第三方品台客户对应关系
* @return
* @author wxz
* @date 2021.03.19 15:22
*/
private void updateThirdPlatformCustomerRegInfo(ThirdPlatformFormDTO platformFormDTO) {
LambdaQueryWrapper<ThirdplatformCustomerRegisterEntity> conditions = new QueryWrapper<ThirdplatformCustomerRegisterEntity>()
.lambda()
.eq(ThirdplatformCustomerRegisterEntity::getCustomerId, platformFormDTO.getCustomerId())
.eq(ThirdplatformCustomerRegisterEntity::getPlatformId, platformFormDTO.getPlatformId());
ThirdplatformCustomerRegisterEntity entity = new ThirdplatformCustomerRegisterEntity();
entity.setCustomizedPlatformName(platformFormDTO.getPlatformName());
entity.setCustomizedPlatformIcon(platformFormDTO.getIcon());
thirdplatformCustomerRegisterDao.update(entity, conditions);
}
} }

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

@ -16,6 +16,13 @@
<result property="updatedTime" column="UPDATED_TIME"/> <result property="updatedTime" column="UPDATED_TIME"/>
</resultMap> </resultMap>
<delete id="deleteByCustomerIdAndActionKey">
delete
from thirdplatform_customer_action
where CUSTOMER_ID = #{customerId}
and ACTION_KEY = #{actionKey}
</delete>
<select id="selectOneEntity" resultType="com.epmet.entity.ThirdplatformCustomerActionEntity"> <select id="selectOneEntity" resultType="com.epmet.entity.ThirdplatformCustomerActionEntity">
select tca.id, select tca.id,
tca.customer_id, tca.customer_id,

7
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ParameterFormDTO.java

@ -18,6 +18,10 @@ import java.io.Serializable;
public class ParameterFormDTO implements Serializable { public class ParameterFormDTO implements Serializable {
private static final long serialVersionUID = 6943367994919967821L; private static final long serialVersionUID = 6943367994919967821L;
// 保存第三方平台发送项目协助开关
public interface SaveThirdPlatformSendProjectSwitchGroup {}
/** /**
* 客户ID * 客户ID
*/ */
@ -53,4 +57,7 @@ public class ParameterFormDTO implements Serializable {
*/ */
@NotBlank(message = "设定核算单位天结束时间不能为空", groups = AddGroup.class) @NotBlank(message = "设定核算单位天结束时间不能为空", groups = AddGroup.class)
private String endTime; private String endTime;
@NotBlank(message = "客户发送第三方平台协助请求开关不能为空", groups = SaveThirdPlatformSendProjectSwitchGroup.class)
private String sendProjectSwitch;
} }

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

@ -0,0 +1,30 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import java.util.List;
@Data
public class ThirdPlatformConfigFormDTO {
public interface SaveThirdplatformConfig {
}
@NotBlank(message = "客户ID不能为空", groups = {SaveThirdplatformConfig.class})
private String customerId;
@NotBlank(message = "项目协助发送开关状态不能为空", groups = {SaveThirdplatformConfig.class})
private String sendProjectSwitch;
private List<CustomerSelectedPlatform> customerSelectedPlatformList;
@Data
public static class CustomerSelectedPlatform {
private String customerId;
private String platformId;
private String platformName;
private String icon;
}
}

5
epmet-module/gov-project/gov-project-server/pom.xml

@ -19,6 +19,11 @@
<artifactId>gov-project-client</artifactId> <artifactId>gov-project-client</artifactId>
<version>2.0.0</version> <version>2.0.0</version>
</dependency> </dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-third-client</artifactId>
<version>2.0.0</version>
</dependency>
<dependency> <dependency>
<groupId>com.epmet</groupId> <groupId>com.epmet</groupId>
<artifactId>epmet-commons-tools</artifactId> <artifactId>epmet-commons-tools</artifactId>

6
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ParameterKeyConstant.java

@ -53,4 +53,10 @@ public interface ParameterKeyConstant {
*/ */
String END_TIME = "end_time"; String END_TIME = "end_time";
String END_TIME_NAME = "设定核算单位天结束时间"; String END_TIME_NAME = "设定核算单位天结束时间";
/**
* 发送项目协助到第三方平台开关
*/
String THIRD_PLATFORM_PROJECT_SEND = "third_platform_project_send";
String THIRD_PLATFORM_PROJECT_SEND_NAME = "发送外部系统项目协助开关";
} }

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

@ -27,6 +27,7 @@ import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.CustomerProjectParameterDTO; import com.epmet.dto.CustomerProjectParameterDTO;
import com.epmet.dto.form.ParameterFormDTO; import com.epmet.dto.form.ParameterFormDTO;
import com.epmet.dto.form.ThirdPlatformConfigFormDTO;
import com.epmet.dto.result.ParameterResultDTO; import com.epmet.dto.result.ParameterResultDTO;
import com.epmet.excel.CustomerProjectParameterExcel; import com.epmet.excel.CustomerProjectParameterExcel;
import com.epmet.service.CustomerProjectParameterService; import com.epmet.service.CustomerProjectParameterService;
@ -34,6 +35,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotBlank;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -135,4 +137,28 @@ public class CustomerProjectParameterController {
return new Result(); return new Result();
} }
/**
* @Description 保存"发送项目协助到第三方平台"开关参数
* @return
* @author wxz
* @date 2021.03.19 13:50
*/
@PostMapping("save-thirdplatform-send-switch")
public Result saveThirdPlatformSendProjectSwitch(@RequestBody ParameterFormDTO input) {
ValidatorUtils.validateEntity(input, ParameterFormDTO.SaveThirdPlatformSendProjectSwitchGroup.class);
String customerId = input.getCustomerId();
String sendProjectSwitch = input.getSendProjectSwitch();
customerProjectParameterService.saveThirdPlatformSendProjectSwitch(customerId, sendProjectSwitch);
return new Result();
}
@PostMapping("save-thirdplatform-config")
public Result saveThirdplatformConfig(@RequestBody ThirdPlatformConfigFormDTO input) {
ValidatorUtils.validateEntity(input, ThirdPlatformConfigFormDTO.SaveThirdplatformConfig.class);
String customerId = input.getCustomerId();
String sendProjectSwitch = input.getSendProjectSwitch();
List<ThirdPlatformConfigFormDTO.CustomerSelectedPlatform> platformList = input.getCustomerSelectedPlatformList();
customerProjectParameterService.saveThirdplatformConfig(customerId, sendProjectSwitch, platformList);
return new Result();
}
} }

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

@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.CustomerProjectParameterDTO; import com.epmet.dto.CustomerProjectParameterDTO;
import com.epmet.dto.form.ParameterFormDTO; import com.epmet.dto.form.ParameterFormDTO;
import com.epmet.dto.form.ThirdPlatformConfigFormDTO;
import com.epmet.dto.result.ParameterResultDTO; import com.epmet.dto.result.ParameterResultDTO;
import com.epmet.entity.CustomerProjectParameterEntity; import com.epmet.entity.CustomerProjectParameterEntity;
@ -166,4 +167,10 @@ public interface CustomerProjectParameterService extends BaseService<CustomerPro
* @return void * @return void
*/ */
void remindDefault(ParameterFormDTO formDTO); void remindDefault(ParameterFormDTO formDTO);
void saveThirdPlatformSendProjectSwitch(String customerId, String sendProjectSwitch);
void saveThirdplatformConfig(String customerId,
String sendProjectSwitch,
List<ThirdPlatformConfigFormDTO.CustomerSelectedPlatform> platformList);
} }

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

@ -17,22 +17,23 @@
package com.epmet.service.impl; package com.epmet.service.impl;
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.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.constant.ParameterKeyConstant; import com.epmet.constant.ParameterKeyConstant;
import com.epmet.constant.ThirdPlatformActions;
import com.epmet.dao.CustomerProjectParameterDao; import com.epmet.dao.CustomerProjectParameterDao;
import com.epmet.dto.CustomerProjectParameterDTO; import com.epmet.dto.CustomerProjectParameterDTO;
import com.epmet.dto.form.ParameterFormDTO; 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.ParameterResultDTO;
import com.epmet.entity.CustomerProjectParameterEntity; import com.epmet.entity.CustomerProjectParameterEntity;
import com.epmet.feign.ThirdOpenFeignClient;
import com.epmet.redis.CustomerProjectParameterRedis; import com.epmet.redis.CustomerProjectParameterRedis;
import com.epmet.service.CustomerProjectParameterService; import com.epmet.service.CustomerProjectParameterService;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
@ -40,13 +41,12 @@ import org.apache.commons.lang3.StringUtils;
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.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
* 项目客户参数订制表 * 项目客户参数订制表
@ -60,6 +60,9 @@ public class CustomerProjectParameterServiceImpl extends BaseServiceImpl<Custome
@Autowired @Autowired
private CustomerProjectParameterRedis customerProjectParameterRedis; private CustomerProjectParameterRedis customerProjectParameterRedis;
@Autowired
private ThirdOpenFeignClient thirdOpenFeignClient;
@Override @Override
public PageData<CustomerProjectParameterDTO> page(Map<String, Object> params) { public PageData<CustomerProjectParameterDTO> page(Map<String, Object> params) {
IPage<CustomerProjectParameterEntity> page = baseDao.selectPage( IPage<CustomerProjectParameterEntity> page = baseDao.selectPage(
@ -290,4 +293,45 @@ public class CustomerProjectParameterServiceImpl extends BaseServiceImpl<Custome
baseDao.deleteByCustomer(formDTO.getCustomerId()); baseDao.deleteByCustomer(formDTO.getCustomerId());
} }
@Override
public void saveThirdPlatformSendProjectSwitch(String customerId, String sendProjectSwitch) {
// 构造条件
LambdaQueryWrapper<CustomerProjectParameterEntity> queryWrapper = new QueryWrapper<CustomerProjectParameterEntity>()
.lambda()
.eq(CustomerProjectParameterEntity::getCustomerId, customerId)
.eq(CustomerProjectParameterEntity::getParameterKey, ParameterKeyConstant.THIRD_PLATFORM_PROJECT_SEND);
CustomerProjectParameterEntity configExists = baseDao.selectOne(queryWrapper);
if (configExists == null) {
CustomerProjectParameterEntity entity = new CustomerProjectParameterEntity();
entity.setDescription("0:关,1:开");
entity.setParameterName(ParameterKeyConstant.THIRD_PLATFORM_PROJECT_SEND_NAME);
entity.setParameterValue(sendProjectSwitch);
entity.setCustomerId(customerId);
entity.setParameterKey(ParameterKeyConstant.THIRD_PLATFORM_PROJECT_SEND);
baseDao.insert(entity);
} else {
configExists.setParameterValue(sendProjectSwitch);
baseDao.updateById(configExists);
}
}
@Transactional(rollbackFor = Exception.class)
@Override
public void saveThirdplatformConfig(String customerId, String sendProjectSwitch, List<ThirdPlatformConfigFormDTO.CustomerSelectedPlatform> platformList) {
// 1.本地执行配置更新
saveThirdPlatformSendProjectSwitch(customerId, sendProjectSwitch);
// 2.调用远程third服务,更新或新增客户-平台-等信息 ThirdPlatformFormDTO thirdPlatformFormDTO = new ThirdPlatformFormDTO();
List<ThirdPlatformFormDTO> formDTOS = platformList.stream().map(p -> {
ThirdPlatformFormDTO thirdPlatformFormDTO = new ThirdPlatformFormDTO();
thirdPlatformFormDTO.setActionKey(ThirdPlatformActions.PROJECT_ASSIST);
thirdPlatformFormDTO.setCustomerId(customerId);
thirdPlatformFormDTO.setIcon(p.getIcon());
thirdPlatformFormDTO.setPlatformId(p.getPlatformId());
thirdPlatformFormDTO.setPlatformName(p.getPlatformName());
return thirdPlatformFormDTO;
}).collect(Collectors.toList());
thirdOpenFeignClient.saveOrUpdateSelectedPlatformsInfo(formDTOS);
}
} }
Loading…
Cancel
Save