提交 3e154429 编写于 作者: Z zengqiao

删除无效代码

上级 a12c3988
package com.xiaojukeji.kafka.manager.service.service.gateway.impl;
import com.alibaba.fastjson.JSONObject;
import com.xiaojukeji.kafka.manager.common.bizenum.ModuleEnum;
import com.xiaojukeji.kafka.manager.common.bizenum.OperateEnum;
import com.xiaojukeji.kafka.manager.common.bizenum.OperationStatusEnum;
......@@ -10,6 +9,7 @@ import com.xiaojukeji.kafka.manager.common.entity.ao.gateway.TopicQuota;
import com.xiaojukeji.kafka.manager.common.entity.pojo.OperateRecordDO;
import com.xiaojukeji.kafka.manager.common.entity.pojo.gateway.AuthorityDO;
import com.xiaojukeji.kafka.manager.common.entity.pojo.gateway.KafkaAclDO;
import com.xiaojukeji.kafka.manager.common.utils.JsonUtils;
import com.xiaojukeji.kafka.manager.common.utils.ValidateUtils;
import com.xiaojukeji.kafka.manager.dao.gateway.AuthorityDao;
import com.xiaojukeji.kafka.manager.dao.gateway.KafkaAclDao;
......@@ -119,7 +119,7 @@ public class AuthorityServiceImpl implements AuthorityService {
operateRecordDO.setModuleId(ModuleEnum.AUTHORITY.getCode());
operateRecordDO.setOperateId(OperateEnum.DELETE.getCode());
operateRecordDO.setResource(topicName);
operateRecordDO.setContent(JSONObject.toJSONString(content));
operateRecordDO.setContent(JsonUtils.toJSONString(content));
operateRecordDO.setOperator(operator);
operateRecordService.insert(operateRecordDO);
} catch (Exception e) {
......@@ -149,7 +149,7 @@ public class AuthorityServiceImpl implements AuthorityService {
} catch (Exception e) {
LOGGER.error("get authority failed, clusterId:{} topicName:{}.", clusterId, topicName, e);
}
return null;
return Collections.emptyList();
}
@Override
......@@ -162,14 +162,12 @@ public class AuthorityServiceImpl implements AuthorityService {
}
if (ValidateUtils.isEmptyList(doList)) {
return new ArrayList<>();
} else {
assert doList != null;
// 过滤权限列表中access=0的
List<AuthorityDO> newList = doList.stream()
.filter(authorityDO -> !TopicAuthorityEnum.DENY.getCode().equals(authorityDO.getAccess()))
.collect(Collectors.toList());
return newList;
}
// 去除掉权限列表中无权限的数据
return doList.stream()
.filter(authorityDO -> !TopicAuthorityEnum.DENY.getCode().equals(authorityDO.getAccess()))
.collect(Collectors.toList());
}
@Override
......
package com.xiaojukeji.kafka.manager.notify;
import com.xiaojukeji.kafka.manager.common.entity.ao.account.Account;
import com.xiaojukeji.kafka.manager.common.entity.pojo.OrderDO;
import com.xiaojukeji.kafka.manager.common.events.OrderApplyEvent;
import com.xiaojukeji.kafka.manager.notify.common.NotifyConstant;
import com.xiaojukeji.kafka.manager.notify.notifyer.AbstractNotifyService;
import com.xiaojukeji.kafka.manager.notify.common.OrderNotifyTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
......@@ -19,27 +12,10 @@ import org.springframework.stereotype.Service;
*/
@Service("orderApplyNotifyService")
public class OrderApplyNotifyService implements ApplicationListener<OrderApplyEvent> {
@Autowired
private AbstractNotifyService notifyService;
@Value("${notify.order.detail-url}")
private String orderDetailUrl;
@Async
@Override
public void onApplicationEvent(OrderApplyEvent orderApplyEvent) {
OrderDO orderDO = orderApplyEvent.getOrderDO();
String detailUrl = String.format(orderDetailUrl, orderDO.getId(), orderApplyEvent.getIdc());
for (Account account : NotifyConstant.accountList) {
notifyService.sendMsg(account.getUsername(),
OrderNotifyTemplate.getNotify2OrderHandlerMessage(
account.getChineseName(),
orderDO.getApplicant(),
orderDO.getTitle(),
detailUrl
)
);
}
// todo 工单通知
}
}
\ No newline at end of file
package com.xiaojukeji.kafka.manager.notify.common;
import com.xiaojukeji.kafka.manager.common.bizenum.AccountRoleEnum;
import com.xiaojukeji.kafka.manager.common.entity.ao.account.Account;
import java.util.Arrays;
import java.util.List;
/**
* @author zengqiao
* @date 20/8/27
*/
public class NotifyConstant {
public static final List<Account> accountList = Arrays.asList(
new Account("xuzhengxi", "徐正熙", "", AccountRoleEnum.OP)
);
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册