diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ThirdPlatformFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ThirdPlatformFormDTO.java
index 6e39ddfbc9..f1793c1fb3 100644
--- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ThirdPlatformFormDTO.java
+++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ThirdPlatformFormDTO.java
@@ -12,10 +12,35 @@ public class ThirdPlatformFormDTO {
// 根据动作查询分组
public interface ListSelectableByCustomerAndActionGroup {}
- @NotBlank(message = "客户ID不能为空", groups = { ListAvailableByCustomerAndActionGroup.class, ListSelectableByCustomerAndActionGroup.class })
+ // 保存客户选中的平台列表
+ public interface SaveCustomerSelectedPlatformGroup {}
+
+ // 列出客户选中的平台列表
+ public interface ListSelectedPlatforms {}
+
+ // 更新客户自定义的平台信息
+ public interface UpdateCustomizePlatformInfo {}
+
+ @NotBlank(message = "客户ID不能为空", groups = { ListAvailableByCustomerAndActionGroup.class,
+ ListSelectableByCustomerAndActionGroup.class,
+ SaveCustomerSelectedPlatformGroup.class,
+ ListSelectedPlatforms.class,
+ UpdateCustomizePlatformInfo.class })
private String customerId;
- @NotBlank(message = "客户ID不能为空", groups = { ListAvailableByCustomerAndActionGroup.class, ListSelectableByCustomerAndActionGroup.class })
+ @NotBlank(message = "动作不能为空", groups = { ListAvailableByCustomerAndActionGroup.class,
+ ListSelectableByCustomerAndActionGroup.class,
+ SaveCustomerSelectedPlatformGroup.class })
private String actionKey;
+ @NotBlank(message = "平台ID不能为空", groups = { SaveCustomerSelectedPlatformGroup.class,
+ UpdateCustomizePlatformInfo.class })
+ private String platformId;
+
+ @NotBlank(message = "平台名称不能为空", groups = { UpdateCustomizePlatformInfo.class })
+ private String platformName;
+
+ @NotBlank(message = "平台图标不能为空", groups = { UpdateCustomizePlatformInfo.class })
+ private String icon;
+
}
diff --git a/epmet-module/epmet-third/epmet-third-server/pom.xml b/epmet-module/epmet-third/epmet-third-server/pom.xml
index fdd764c6e0..87fd48048b 100644
--- a/epmet-module/epmet-third/epmet-third-server/pom.xml
+++ b/epmet-module/epmet-third/epmet-third-server/pom.xml
@@ -221,14 +221,14 @@
-
+
epmet_third_user
EpmEt-db-UsEr
0
- 192.168.1.130
- 6379
+ 118.190.150.119
+ 47379
123456
false
diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ThirdPlatformController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ThirdPlatformController.java
index 92976c57e1..e3f1998793 100644
--- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ThirdPlatformController.java
+++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ThirdPlatformController.java
@@ -25,6 +25,7 @@ public class ThirdPlatformController {
/**
* 根据客户id和动作,列出客户登记可用的第三方平台
+ * 用途:工作端,运营端配置界面
*
* @param input
* @return
@@ -49,7 +50,30 @@ public class ThirdPlatformController {
return new Result>().ok(platformRegs);
}
- //@PostMapping("register")
+ /**
+ * @Description 保存客户选中的平台列表
+ * @return
+ * @author wxz
+ * @date 2021.03.18 18:04
+ */
+ @PostMapping("customer/save-selected-platforms")
+ public Result saveSelectedPlatforms(@RequestBody List input) {
+ input.stream().forEach(c -> ValidatorUtils.validateEntity(c, ThirdPlatformFormDTO.SaveCustomerSelectedPlatformGroup.class));
+ thirdPlatformService.saveSelectedPlatforms(input);
+ return new Result();
+ }
+ /**
+ * @Description 更新客户自定义的平台信息
+ * @return
+ * @author wxz
+ * @date 2021.03.18 23:45
+ */
+ @PostMapping("customer/update-customize-platform-info")
+ public Result updateCustomizePlatformInfo(@RequestBody ThirdPlatformFormDTO input) {
+ ValidatorUtils.validateEntity(input, ThirdPlatformFormDTO.UpdateCustomizePlatformInfo.class);
+ thirdPlatformService.updateCustomizePlatformInfo(input);
+ return new Result();
+ }
}
diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformCustomerActionDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformCustomerActionDao.java
index 4b937061fd..49ac3a5431 100644
--- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformCustomerActionDao.java
+++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformCustomerActionDao.java
@@ -20,6 +20,7 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.ThirdplatformCustomerActionEntity;
import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
/**
* 客户针对指定操作所选用的第三方平台列表
@@ -29,5 +30,7 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface ThirdplatformCustomerActionDao extends BaseDao {
-
+ ThirdplatformCustomerActionEntity selectOneEntity(@Param("customerId") String customerId,
+ @Param("platformId") String platformId,
+ @Param("actionKey") String actionKey);
}
\ No newline at end of file
diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ThirdPlatformService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ThirdPlatformService.java
index aa86027db9..45ccb90354 100644
--- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ThirdPlatformService.java
+++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ThirdPlatformService.java
@@ -1,5 +1,6 @@
package com.epmet.service;
+import com.epmet.dto.form.ThirdPlatformFormDTO;
import com.epmet.dto.result.ThirdplatformResultDTO;
import java.util.List;
@@ -9,4 +10,14 @@ public interface ThirdPlatformService {
List listAvailablePlatformsByCustomerAndAction(String customerId, String actionKey);
List listSelectableByCustomerAndActionGroup(String customerId, String actionKey);
+
+ /**
+ * @Description 保存客户选择的平台列表
+ * @return
+ * @author wxz
+ * @date 2021.03.18 22:06
+ */
+ void saveSelectedPlatforms(List platforms);
+
+ void updateCustomizePlatformInfo(ThirdPlatformFormDTO input);
}
\ No newline at end of file
diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ThirdPlatformServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ThirdPlatformServiceImpl.java
index 9a7ed8bb3c..ad4e81254e 100644
--- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ThirdPlatformServiceImpl.java
+++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ThirdPlatformServiceImpl.java
@@ -1,10 +1,16 @@
package com.epmet.service.impl;
+import com.epmet.dao.ThirdplatformCustomerActionDao;
+import com.epmet.dao.ThirdplatformCustomerRegisterDao;
import com.epmet.dao.ThirdplatformDao;
+import com.epmet.dto.form.ThirdPlatformFormDTO;
import com.epmet.dto.result.ThirdplatformResultDTO;
+import com.epmet.entity.ThirdplatformCustomerActionEntity;
+import com.epmet.entity.ThirdplatformCustomerRegisterEntity;
import com.epmet.service.ThirdPlatformService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@@ -14,6 +20,12 @@ public class ThirdPlatformServiceImpl implements ThirdPlatformService {
@Autowired
private ThirdplatformDao thirdplatformDao;
+ @Autowired
+ private ThirdplatformCustomerActionDao thirdplatformCustomerActionDao;
+
+ @Autowired
+ private ThirdplatformCustomerRegisterDao thirdplatformCustomerRegisterDao;
+
@Override
public List listAvailablePlatformsByCustomerAndAction(String customerId, String actionKey) {
return thirdplatformDao.listAvailablePlatformsByCustomerAndAction(customerId, actionKey);
@@ -23,4 +35,29 @@ public class ThirdPlatformServiceImpl implements ThirdPlatformService {
public List listSelectableByCustomerAndActionGroup(String customerId, String actionKey) {
return thirdplatformDao.listSelectableByCustomerAndActionGroup(customerId, actionKey);
}
+
+ @Transactional(rollbackFor = Exception.class)
+ @Override
+ public void saveSelectedPlatforms(List platforms) {
+ platforms.forEach(p -> {
+ ThirdplatformCustomerActionEntity thirdplatformCustomerActionEntity = thirdplatformCustomerActionDao.selectOneEntity(p.getCustomerId(), p.getPlatformId(), p.getActionKey());
+ if (thirdplatformCustomerActionEntity == null) {
+ ThirdplatformCustomerActionEntity insert = new ThirdplatformCustomerActionEntity();
+ insert.setActionKey(p.getActionKey());
+ insert.setCustomerId(p.getCustomerId());
+ insert.setPlatformId(p.getPlatformId());
+ thirdplatformCustomerActionDao.insert(insert);
+ }
+ });
+ }
+
+ @Override
+ public void updateCustomizePlatformInfo(ThirdPlatformFormDTO input) {
+ ThirdplatformCustomerRegisterEntity exist = thirdplatformCustomerRegisterDao.getByCustomerIdAndPlatformId(input.getCustomerId(), input.getPlatformId());
+ if (exist != null) {
+ exist.setCustomizedPlatformName(input.getPlatformName());
+ exist.setCustomizedPlatformIcon(input.getIcon());
+ thirdplatformCustomerRegisterDao.updateById(exist);
+ }
+ }
}
diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformCustomerActionDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformCustomerActionDao.xml
index 33c76cfd7a..4decbb7c0f 100644
--- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformCustomerActionDao.xml
+++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformCustomerActionDao.xml
@@ -16,5 +16,23 @@
+
+
\ No newline at end of file