提交 377820b2 作者: 典文龙

修改权限校验

上级 1d76bfbd
......@@ -17,7 +17,7 @@ import java.util.Map;
* @author darker
* @date 2022/10/21 16:04
*/
@Configuration
//@Configuration
public class RabbitConfig {
/* @Bean
......
......@@ -44,4 +44,8 @@ public class DistributeDTO {
public Integer getTargetAuthListSize() {
return this.targetAuthList.size();
}
public List<String> appIds() {
return this.getTargetAuthList().stream().map(AuthInfoVO::getAppId).collect(Collectors.toList());
}
}
......@@ -48,13 +48,13 @@ public class DistributeServiceImpl extends ServiceImpl<AccountDistributeLogMappe
log.info("开始执行复用任务....");
AuthInfoVO sourceAuth = distributeDTO.getSourceAuth();
Integer targetAuthListSize = distributeDTO.getTargetAuthListSize();
if (ObjectUtil.isNotNull(sourceAuth.getAppId())) {
/*if (ObjectUtil.isNotNull(sourceAuth.getAppId())) {
List<AccountSetupVO> accountSetupVOList = kanbanCommonMapper.getRole(userId, distributeDTO.getAccountId());
int size = accountSetupVOList.size();
if (targetAuthListSize != size) {
return new BaseResult().error("暂无权限");
}
}
}*/
myExecutorDistributeService.myExecutorDistribute(distributeDTO, userId, distributeLogList, sourceAuth);
return new BaseResult().success("复用进行中, 请等待");
......
......@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yaoyaozw.customer.entity.MaterialMenuConfig;
import com.yaoyaozw.customer.mapper.MaterialMenuConfigMapper;
import com.yaoyaozw.customer.service.MaterialMenuConfigService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.List;
......@@ -16,11 +17,13 @@ import java.util.List;
* @Version: V3.2.0
* @Description:
*/
@Slf4j
@Service
public class MaterialMenuConfigServiceImpl extends ServiceImpl<MaterialMenuConfigMapper, MaterialMenuConfig> implements MaterialMenuConfigService {
@Override
public void removeById(List<Long> authIds) {
LambdaQueryWrapper<MaterialMenuConfig> queryWrapper = new LambdaQueryWrapper<MaterialMenuConfig>().in(MaterialMenuConfig::getAuthId, authIds);
this.baseMapper.delete(queryWrapper);
int count = this.baseMapper.delete(queryWrapper);
log.info("删除目标公众号配置_{}", count);
}
}
package com.yaoyaozw.customer.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yaoyaozw.customer.dto.DistributeDTO;
import com.yaoyaozw.customer.dto.MenuMainCopyDTO;
import com.yaoyaozw.customer.dto.follow.FollowReplyCopyDTO;
import com.yaoyaozw.customer.dto.keyword.CustomerKeywordCopyDTO;
import com.yaoyaozw.customer.entity.AccountDistributeRecord;
import com.yaoyaozw.customer.entity.MaterialMenuMain;
import com.yaoyaozw.customer.entity.*;
import com.yaoyaozw.customer.feigns.MenuFeignClient;
import com.yaoyaozw.customer.service.*;
import com.yaoyaozw.customer.vo.AuthInfoVO;
......@@ -66,8 +66,11 @@ public class MyExecutorDistributeServiceImpl implements MyExecutorDistributeServ
case "1":
//关回复用
try {
log.info("开始关回复用");
//removeBatch(distributeDTO.appIds(), type);
FollowReplyCopyDTO followReplyCopyDTO = new FollowReplyCopyDTO(sourceAuth, targetAuthList);
followReplyService.copy(followReplyCopyDTO);
log.info("关回复用结束");
} catch (Exception e) {
log.error("Off reply failed: {}", e.getMessage(), e);
}
......@@ -76,9 +79,12 @@ public class MyExecutorDistributeServiceImpl implements MyExecutorDistributeServ
case "2":
//关键词复用
try {
log.info("开始关键词复用");
//removeBatch(distributeDTO.appIds(), type);
CustomerKeywordCopyDTO customerKeywordCopyDTO = new CustomerKeywordCopyDTO();
customerKeywordCopyDTO.replace(sourceAuth, targetAuthList, targetAppList);
keywordService.copy(customerKeywordCopyDTO);
log.info("关键词复用结束");
} catch (Exception e) {
log.error("Keyword reuse failure: {}", e.getMessage(), e);
}
......@@ -86,7 +92,10 @@ public class MyExecutorDistributeServiceImpl implements MyExecutorDistributeServ
case "3":
//延时客服复用
try {
log.info("开始延时客服复用");
removeBatch(distributeDTO.appIds(), type);
customerGraphicsDelayService.copy(sourceAuth.getAppId(), "", "", null, targetApp);
log.info("延时客服复用结束");
} catch (Exception e) {
log.error("Delayed customer service reuse failure: {}", e.getMessage(), e);
}
......@@ -94,21 +103,12 @@ public class MyExecutorDistributeServiceImpl implements MyExecutorDistributeServ
case "4":
//菜单管理复用
try {
try {
List<String> appIds = targetAuthList.stream().map(AuthInfoVO::getAppId).collect(Collectors.toList());
List<MaterialMenuMain> materialMenuMainList = materialMenuMainService.getMaterialMenuMainVoInfo(appIds);
if (!materialMenuMainList.isEmpty()) {
for (MaterialMenuMain menuMain : materialMenuMainList) {
String appId = String.valueOf(menuMain.getAppId());
menuFeignClient.removeMenu(menuMain.getId(), appId);
}
}
} catch (Exception e) {
log.error("Failed to delete menu configuration: {}", e.getMessage(), e);
}
log.info("开始菜单管理复用");
removeBatch(distributeDTO.appIds(), type);
MenuMainCopyDTO menuMainCopyDTO = new MenuMainCopyDTO();
menuMainCopyDTO.addList(sourceAuth.getId(), idList);
menuFeignClient.copy(menuMainCopyDTO);
log.info("菜单管理复用结束");
} catch (Exception e) {
log.error("Menu management reuse failure: {}", e.getMessage(), e);
}
......@@ -129,4 +129,30 @@ public class MyExecutorDistributeServiceImpl implements MyExecutorDistributeServ
distributeService.saveBatch(distributeLogList);
}
private void removeBatch(List<String> appIds, String type) {
if ("3".equals(type)) {
try {
LambdaQueryWrapper<CustomerGraphicsDelay> wrapper = new LambdaQueryWrapper<CustomerGraphicsDelay>().in(CustomerGraphicsDelay::getAppId, appIds).eq(CustomerGraphicsDelay::getIsDeleted, 0);
List<Long> idsList = customerGraphicsDelayService.list(wrapper).stream().map(CustomerGraphicsDelay::getId).collect(Collectors.toList());
if (!idsList.isEmpty()) {
customerGraphicsDelayService.removeBatch(idsList);
}
} catch (Exception e) {
log.error("Failed to delete the delayed customer service overcommitment configuration: {}", e.getMessage(), e);
}
} else if ("4".equals(type)) {
try {
List<MaterialMenuMain> materialMenuMainList = materialMenuMainService.getMaterialMenuMainVoInfo(appIds);
if (!materialMenuMainList.isEmpty()) {
for (MaterialMenuMain menuMain : materialMenuMainList) {
String appId = String.valueOf(menuMain.getAppId());
menuFeignClient.removeMenu(menuMain.getId(), appId);
}
}
} catch (Exception e) {
log.error("Failed to delete menu reuse configuration: {}", e.getMessage(), e);
}
}
}
}
......@@ -13,6 +13,6 @@ import lombok.Data;
public class AccountSetupVO {
private Long id;
private String appId;
private Long channelId;
private String channelId;
private String nickName;
}
......@@ -61,9 +61,9 @@
<select id="getRole" resultType="com.yaoyaozw.customer.vo.kanban.AccountSetupVO">
SELECT
ae.id,
ae.app_id,
ae.nick_name,
ae.channel_id
ae.app_id AS appId,
ae.nick_name AS nickName,
ae.channel_id AS channelId
FROM
account_entity ae
LEFT JOIN account_cost_setup acs on acs.account_id=ae.id
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论