Browse Source

【第三方平台】1.新增客户保存所选平台接口

2.新增客户自定义平台名称等信息接口
dev
wxz 4 years ago
parent
commit
98319993a1
  1. 29
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ThirdPlatformFormDTO.java
  2. 6
      epmet-module/epmet-third/epmet-third-server/pom.xml
  3. 26
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ThirdPlatformController.java
  4. 5
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformCustomerActionDao.java
  5. 11
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ThirdPlatformService.java
  6. 37
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ThirdPlatformServiceImpl.java
  7. 18
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformCustomerActionDao.xml

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

6
epmet-module/epmet-third/epmet-third-server/pom.xml

@ -221,14 +221,14 @@
<!-- 数据库配置-->
<spring.datasource.druid.url>
<![CDATA[jdbc:mysql://192.168.1.130:3306/epmet_third?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
<![CDATA[jdbc:mysql://118.190.150.119:47306/epmet_third?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</spring.datasource.druid.url>
<spring.datasource.druid.username>epmet_third_user</spring.datasource.druid.username>
<spring.datasource.druid.password>EpmEt-db-UsEr</spring.datasource.druid.password>
<!-- redis配置 -->
<spring.redis.index>0</spring.redis.index>
<spring.redis.host>192.168.1.130</spring.redis.host>
<spring.redis.port>6379</spring.redis.port>
<spring.redis.host>118.190.150.119</spring.redis.host>
<spring.redis.port>47379</spring.redis.port>
<spring.redis.password>123456</spring.redis.password>
<!-- nacos -->
<nacos.register-enabled>false</nacos.register-enabled>

26
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<List<ThirdplatformResultDTO>>().ok(platformRegs);
}
//@PostMapping("register")
/**
* @Description 保存客户选中的平台列表
* @return
* @author wxz
* @date 2021.03.18 18:04
*/
@PostMapping("customer/save-selected-platforms")
public Result saveSelectedPlatforms(@RequestBody List<ThirdPlatformFormDTO> 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();
}
}

5
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> {
ThirdplatformCustomerActionEntity selectOneEntity(@Param("customerId") String customerId,
@Param("platformId") String platformId,
@Param("actionKey") String actionKey);
}

11
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<ThirdplatformResultDTO> listAvailablePlatformsByCustomerAndAction(String customerId, String actionKey);
List<ThirdplatformResultDTO> listSelectableByCustomerAndActionGroup(String customerId, String actionKey);
/**
* @Description 保存客户选择的平台列表
* @return
* @author wxz
* @date 2021.03.18 22:06
*/
void saveSelectedPlatforms(List<ThirdPlatformFormDTO> platforms);
void updateCustomizePlatformInfo(ThirdPlatformFormDTO input);
}

37
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<ThirdplatformResultDTO> listAvailablePlatformsByCustomerAndAction(String customerId, String actionKey) {
return thirdplatformDao.listAvailablePlatformsByCustomerAndAction(customerId, actionKey);
@ -23,4 +35,29 @@ public class ThirdPlatformServiceImpl implements ThirdPlatformService {
public List<ThirdplatformResultDTO> listSelectableByCustomerAndActionGroup(String customerId, String actionKey) {
return thirdplatformDao.listSelectableByCustomerAndActionGroup(customerId, actionKey);
}
@Transactional(rollbackFor = Exception.class)
@Override
public void saveSelectedPlatforms(List<ThirdPlatformFormDTO> 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);
}
}
}

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

@ -16,5 +16,23 @@
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<select id="selectOneEntity" resultType="com.epmet.entity.ThirdplatformCustomerActionEntity">
select tca.id,
tca.customer_id,
tca.platform_id,
tca.action_key,
tca.del_flag,
tca.revision,
tca.created_by,
tca.created_time,
tca.updated_by,
tca.updated_time
from thirdplatform_customer_action tca
where tca.CUSTOMER_ID = #{customerId}
and tca.PLATFORM_ID = #{platformId}
and tca.ACTION_KEY = #{actionKey}
and tca.DEL_FLAG = 0
</select>
</mapper>
Loading…
Cancel
Save