feat:机器人消息模板接口
This commit is contained in:
parent
58519e3218
commit
e7f246acd3
@ -13,6 +13,11 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class RobotInfoResp {
|
public class RobotInfoResp {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键ID
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
/**
|
/**
|
||||||
* 机器人ID
|
* 机器人ID
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -31,6 +31,11 @@
|
|||||||
<artifactId>msg-center-api</artifactId>
|
<artifactId>msg-center-api</artifactId>
|
||||||
<version>1.0.0-SNAPSHOT</version>
|
<version>1.0.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.xuxueli</groupId>
|
||||||
|
<artifactId>xxl-job-core</artifactId>
|
||||||
|
<version>2.2.0</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.axzo.framework</groupId>
|
<groupId>cn.axzo.framework</groupId>
|
||||||
<artifactId>axzo-web-spring-boot-starter</artifactId>
|
<artifactId>axzo-web-spring-boot-starter</artifactId>
|
||||||
|
|||||||
@ -0,0 +1,44 @@
|
|||||||
|
//package cn.axzo.im.job;
|
||||||
|
//
|
||||||
|
//import cn.axzo.outman.client.task.BaseJobHandler;
|
||||||
|
//import cn.axzo.outman.common.constants.CommonConstants;
|
||||||
|
//import cn.axzo.outman.service.api.TaskService;
|
||||||
|
//import cn.azxo.framework.common.utils.LogUtil;
|
||||||
|
//import com.xxl.job.core.biz.model.ReturnT;
|
||||||
|
//import com.xxl.job.core.handler.annotation.XxlJob;
|
||||||
|
//import lombok.extern.slf4j.Slf4j;
|
||||||
|
//import org.springframework.stereotype.Component;
|
||||||
|
//
|
||||||
|
//import javax.annotation.Resource;
|
||||||
|
//
|
||||||
|
///**
|
||||||
|
// * 百度访问令牌刷新定时任务
|
||||||
|
// *
|
||||||
|
// * @author zhaoyong
|
||||||
|
// * @see BaiduAccessTokenRefreshJobHandler
|
||||||
|
// * @since 2021-06-28 21:58
|
||||||
|
// */
|
||||||
|
//@Slf4j
|
||||||
|
//@Component
|
||||||
|
//public class BaiduAccessTokenRefreshJobHandler extends BaseJobHandler {
|
||||||
|
//
|
||||||
|
// @Resource(name = "taskService")
|
||||||
|
// private TaskService taskService;
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// @XxlJob("baiduAccessTokenRefreshJobHandler")
|
||||||
|
// public ReturnT<String> execute(String param) throws Exception {
|
||||||
|
// return jobLoggerTemplate.execute(CommonConstants.CTX_LOG_ID_MDC, () -> {
|
||||||
|
// log.info("BaiduAccessTokenRefreshJobHandler.execute task Start ......");
|
||||||
|
// try {
|
||||||
|
// taskService.refreshBaiduAccessToken();
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// LogUtil.error("BaiduAccessTokenRefreshJobHandler.execute is error", e);
|
||||||
|
// return ReturnT.FAIL;
|
||||||
|
// }
|
||||||
|
// log.info("BaiduAccessTokenRefreshJobHandler.execute task End ......");
|
||||||
|
// return ReturnT.SUCCESS;
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//}
|
||||||
@ -0,0 +1,33 @@
|
|||||||
|
//package cn.axzo.im.job;
|
||||||
|
//
|
||||||
|
//import cn.azxo.framework.common.logger.JobLoggerTemplate;
|
||||||
|
//import cn.azxo.framework.common.service.JobParamResolver;
|
||||||
|
//import com.xxl.job.core.biz.model.ReturnT;
|
||||||
|
//
|
||||||
|
//import javax.annotation.Resource;
|
||||||
|
//
|
||||||
|
///**
|
||||||
|
// * 基础定时任务
|
||||||
|
// *
|
||||||
|
// * @author zhaoyong
|
||||||
|
// * @see BaseJobHandler
|
||||||
|
// * @since 2021-06-23 18:32
|
||||||
|
// */
|
||||||
|
//public abstract class BaseJobHandler {
|
||||||
|
//
|
||||||
|
// @Resource(name = "jobLoggerTemplate")
|
||||||
|
// protected JobLoggerTemplate jobLoggerTemplate;
|
||||||
|
//
|
||||||
|
// @Resource(name = "jobParamResolver")
|
||||||
|
// protected JobParamResolver jobParamResolver;
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 定时任务执行逻辑
|
||||||
|
// *
|
||||||
|
// * @param param
|
||||||
|
// * @return
|
||||||
|
// * @throws Exception
|
||||||
|
// */
|
||||||
|
// public abstract ReturnT<String> execute(String param) throws Exception;
|
||||||
|
//
|
||||||
|
//}
|
||||||
@ -0,0 +1,70 @@
|
|||||||
|
//package cn.axzo.im.job;
|
||||||
|
//
|
||||||
|
//import cn.azxo.framework.common.logger.JobLoggerTemplate;
|
||||||
|
//import cn.azxo.framework.common.service.JobParamResolver;
|
||||||
|
//import cn.azxo.framework.common.spring.condition.NonLocalEnvironment;
|
||||||
|
//import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
|
||||||
|
//import lombok.extern.slf4j.Slf4j;
|
||||||
|
//import org.springframework.beans.factory.annotation.Value;
|
||||||
|
//import org.springframework.context.annotation.Bean;
|
||||||
|
//import org.springframework.context.annotation.Configuration;
|
||||||
|
//
|
||||||
|
///**
|
||||||
|
// * Xxl Job Config
|
||||||
|
// *
|
||||||
|
// * @author zhaoyong
|
||||||
|
// * @see XxlJobConfig
|
||||||
|
// * @since 2021-06-23 18:28
|
||||||
|
// */
|
||||||
|
//@Slf4j
|
||||||
|
//@Configuration
|
||||||
|
//public class XxlJobConfig {
|
||||||
|
//
|
||||||
|
// @Value("${xxl.job.admin.addresses}")
|
||||||
|
// private String adminAddresses;
|
||||||
|
//
|
||||||
|
// @Value("${xxl.job.executor.appName}")
|
||||||
|
// private String appName;
|
||||||
|
//
|
||||||
|
// @Value("${xxl.job.executor.ip:}")
|
||||||
|
// private String ip;
|
||||||
|
//
|
||||||
|
// @Value("${xxl.job.executor.port}")
|
||||||
|
// private int port;
|
||||||
|
//
|
||||||
|
// @Value("${xxl.job.accessToken:}")
|
||||||
|
// private String accessToken;
|
||||||
|
//
|
||||||
|
// @Value("${xxl.job.executor.logPath:}")
|
||||||
|
// private String logPath;
|
||||||
|
//
|
||||||
|
// @Value("${xxl.job.executor.logRetentionDays}")
|
||||||
|
// private int logRetentionDays;
|
||||||
|
//
|
||||||
|
// @Bean
|
||||||
|
// @NonLocalEnvironment
|
||||||
|
// public XxlJobSpringExecutor xxlJobExecutor() {
|
||||||
|
// log.info(">>>>>>>>>>> axzo outman service xxl-job config init.");
|
||||||
|
// XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
|
||||||
|
// xxlJobSpringExecutor.setAdminAddresses(adminAddresses);
|
||||||
|
// xxlJobSpringExecutor.setAppname(appName);
|
||||||
|
// xxlJobSpringExecutor.setIp(ip);
|
||||||
|
// xxlJobSpringExecutor.setPort(port);
|
||||||
|
// xxlJobSpringExecutor.setAccessToken(accessToken);
|
||||||
|
// xxlJobSpringExecutor.setLogPath(logPath);
|
||||||
|
// xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays);
|
||||||
|
// return xxlJobSpringExecutor;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// @Bean("jobParamResolver")
|
||||||
|
// public JobParamResolver jobParamResolver() {
|
||||||
|
// return new JobParamResolver();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Bean("jobLoggerTemplate")
|
||||||
|
// public JobLoggerTemplate jobLoggerTemplate() {
|
||||||
|
// return new JobLoggerTemplate();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//}
|
||||||
@ -29,6 +29,7 @@ import javax.validation.Valid;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.function.Consumer;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -157,6 +158,21 @@ public class RobotInfoService {
|
|||||||
List<RobotInfoResp> list = BeanMapper.copyList(robotInfoIPage.getRecords(), RobotInfoResp.class);
|
List<RobotInfoResp> list = BeanMapper.copyList(robotInfoIPage.getRecords(), RobotInfoResp.class);
|
||||||
PageResp<RobotInfoResp> pageOfRobotInfoResp = PageResp.list(robotInfoIPage.getCurrent(), robotInfoIPage.getSize(),
|
PageResp<RobotInfoResp> pageOfRobotInfoResp = PageResp.list(robotInfoIPage.getCurrent(), robotInfoIPage.getSize(),
|
||||||
robotInfoIPage.getTotal(), list);
|
robotInfoIPage.getTotal(), list);
|
||||||
|
list.forEach(robotInfoResp -> {
|
||||||
|
RobotInfo robotInfo = robotInfoDao.lambdaQuery().eq(RobotInfo::getIsDelete, 0)
|
||||||
|
.eq(RobotInfo::getId, robotInfoResp.getId()).one();
|
||||||
|
if (robotInfo == null) {
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
List<Long> tagIdList = robotInfo.getTagNameList();
|
||||||
|
List<RobotTag> robotTags = robotTagDao.queryRobotTagValidList(tagIdList);
|
||||||
|
List<RobotTagResp> robotTagsResp = BeanMapper.copyList(robotTags, RobotTagResp.class);
|
||||||
|
robotInfoResp.setRobotTagList(robotTagsResp);
|
||||||
|
robotTagsResp.forEach(robotTag -> {
|
||||||
|
int useCount = robotTagService.findTagUseCount(Integer.parseInt(String.valueOf(robotTag.getId())));
|
||||||
|
robotTag.setUseCount(useCount);
|
||||||
|
});
|
||||||
|
});
|
||||||
list.forEach(this::fillRobotRespOfMsgTemplate);
|
list.forEach(this::fillRobotRespOfMsgTemplate);
|
||||||
return pageOfRobotInfoResp;
|
return pageOfRobotInfoResp;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user