REQ-2497: backup
This commit is contained in:
parent
58998e16cb
commit
a610f7ab74
@ -21,6 +21,10 @@
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>cn.axzo.trade</groupId>
|
||||
<artifactId>trade-web-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mybatis</groupId>
|
||||
<artifactId>mybatis</artifactId>
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
package cn.axzo.msg.center.message.controller;
|
||||
|
||||
import cn.axzo.im.center.api.feign.MessageApi;
|
||||
import cn.axzo.im.center.api.feign.MessageController;
|
||||
import cn.axzo.im.center.api.vo.ApiChannel;
|
||||
import cn.axzo.im.center.api.vo.req.UpdateTemplateSendPriorityRequest;
|
||||
@ -23,7 +22,7 @@ import cn.axzo.msg.center.message.service.impl.oldmsg.OldMsgStatCache;
|
||||
import cn.axzo.msg.center.message.service.impl.person.PersonService;
|
||||
import cn.axzo.msg.center.message.service.todo.manage.TodoManager;
|
||||
import cn.axzo.msg.center.message.xxl.MigrateOldMsgHotDataJob;
|
||||
import cn.azxo.framework.common.model.CommonResponse;
|
||||
import cn.axzo.trade.web.annotation.EnableResponseAdvice;
|
||||
import com.alibaba.cloud.nacos.NacosConfigManager;
|
||||
import com.alibaba.cloud.nacos.parser.NacosDataParserHandler;
|
||||
import com.google.common.collect.Sets;
|
||||
@ -66,56 +65,64 @@ public class PrivateMessageController {
|
||||
private final ImMessageProps imProps;
|
||||
|
||||
@PostMapping("/sendPendingMessage")
|
||||
@EnableResponseAdvice(enable = false)
|
||||
public Object sendPendingMessage(@RequestBody @Valid PendingMessagePushParam request) {
|
||||
return todoManager.send(request);
|
||||
}
|
||||
|
||||
@PostMapping("/sendByEventMapping")
|
||||
@EnableResponseAdvice(enable = false)
|
||||
public Object sendByEventMapping(@RequestBody @Valid MessageSendReqV3 request) {
|
||||
return messageAPIV3.send(request);
|
||||
}
|
||||
|
||||
@PostMapping("/searchImRecord")
|
||||
@EnableResponseAdvice(enable = false)
|
||||
public Object searchImRecord(@RequestBody @Valid SearchMessageReqV3 req) {
|
||||
return messageRecordServiceV3.search(req);
|
||||
}
|
||||
|
||||
@PostMapping("/searchTodos")
|
||||
@EnableResponseAdvice(enable = false)
|
||||
public Object searchTodos(@RequestBody @Valid SearchPendingMessageReq req) {
|
||||
return todoSearchService.searchTodos(req);
|
||||
}
|
||||
|
||||
@PostMapping("/searchTodoLogs")
|
||||
@EnableResponseAdvice(enable = false)
|
||||
public Object searchTodoLogs(@RequestBody @Valid SearchTodoLogReq req) {
|
||||
return todoSearchService.searchTodoLogs(req);
|
||||
}
|
||||
|
||||
@PostMapping("/getGroupTemplates")
|
||||
@EnableResponseAdvice(enable = false)
|
||||
public Object getGroupTemplates(@RequestParam("groupNodeCode") String groupNodeCode) {
|
||||
return groupTemplateService.collectTemplateCodes(groupNodeCode);
|
||||
}
|
||||
|
||||
@PostMapping("/reloadOldMsgStat")
|
||||
@EnableResponseAdvice(enable = false)
|
||||
public Object reloadOldMsgStat(@RequestParam("personId") Long personId) throws Exception {
|
||||
return oldMsgStatCache.reloadBackground(Sets.newHashSet(personId));
|
||||
}
|
||||
|
||||
@PostMapping("/getPersonIdByPhone")
|
||||
@EnableResponseAdvice(enable = false)
|
||||
public Object getPersonIdByPhone(@RequestParam("phone") String phone) {
|
||||
Long personId = personService.getPersonIdByPhone(phone).orElse(null);
|
||||
return CommonResponse.success(personId);
|
||||
return personService.getPersonIdByPhone(phone).orElse(null);
|
||||
}
|
||||
|
||||
@PostMapping("/getPhoneByPersonId")
|
||||
@EnableResponseAdvice(enable = false)
|
||||
public Object getPhoneByPersonId(@RequestParam("personId") Long personId) {
|
||||
String phone = personService.getPhoneByPersonId(personId).orElse(null);
|
||||
return CommonResponse.success(phone);
|
||||
return personService.getPhoneByPersonId(personId).orElse(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 因为没有权限了, 用于查看nacos是否配置了正确的值
|
||||
*/
|
||||
@PostMapping("/readNacosConfig")
|
||||
@EnableResponseAdvice(enable = false)
|
||||
public Object readNacosConfig() throws Exception {
|
||||
String value = nacosConfigManager.getConfigService()
|
||||
.getConfig("msg-center.yaml", "DEFAULT_GROUP", 5000);
|
||||
@ -129,13 +136,15 @@ public class PrivateMessageController {
|
||||
}
|
||||
|
||||
@PostMapping("/migrateOldMsgHotData")
|
||||
@EnableResponseAdvice(enable = false)
|
||||
public Object migrateOldMsgHotData(
|
||||
@RequestBody(required = false) MigrateOldMsgHotDataJob.Param param) {
|
||||
migrateOldMsgHotDataJob.tryExecute(param, true);
|
||||
return CommonResponse.success("submitted");
|
||||
return "submitted";
|
||||
}
|
||||
|
||||
@PostMapping("/setImSendPriority")
|
||||
@EnableResponseAdvice(enable = false)
|
||||
public Object setImSendPriority(@RequestBody @Valid SetImSendPriorityRequest request) {
|
||||
BizAssertions.assertNotNull(request.getTemplateCode(), "templateCode can't be blank");
|
||||
BizAssertions.assertNotNull(request.getSendPriority(), "sendPriority can't be null");
|
||||
@ -167,7 +176,7 @@ public class PrivateMessageController {
|
||||
result.put("templatePriorityUpdated", templateUpdated);
|
||||
result.put("imMessagePriorityUpdated", imMessageUpdated);
|
||||
result.put("interceptedChannels", interceptedChannels);
|
||||
return CommonResponse.success(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@ -2,6 +2,7 @@ package cn.axzo.msg.center.message.service.todo.manage;
|
||||
|
||||
import cn.axzo.msg.center.common.utils.BizAssertions;
|
||||
import cn.axzo.msg.center.common.utils.PlaceholderResolver;
|
||||
import cn.axzo.msg.center.domain.entity.Todo;
|
||||
import cn.axzo.msg.center.message.domain.dto.MessageTemplateDTO;
|
||||
import cn.axzo.msg.center.message.domain.param.PendingMessagePushParam;
|
||||
import cn.axzo.msg.center.service.util.JSONUtils;
|
||||
@ -9,6 +10,8 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* @author yanglin
|
||||
*/
|
||||
@ -59,4 +62,21 @@ public class TodoExt {
|
||||
return content;
|
||||
}
|
||||
|
||||
public static JSONObject copyBizExtParam(Todo todo, boolean removeExt) {
|
||||
if (todo.getBizExtParam() == null)
|
||||
return null;
|
||||
JSONObject bizExtParam = new JSONObject(new HashMap<>(todo.getBizExtParam()));
|
||||
if (removeExt)
|
||||
bizExtParam.remove(TodoExt.CTX);
|
||||
return bizExtParam;
|
||||
}
|
||||
|
||||
public static JSONObject copyRouterExtParam(Todo todo, boolean removeExt) {
|
||||
if (todo.getRouterParams() == null)
|
||||
return null;
|
||||
JSONObject routerExtParam = new JSONObject(new HashMap<>(todo.getRouterParams()));
|
||||
if (removeExt)
|
||||
routerExtParam.remove(TodoExt.CTX);
|
||||
return routerExtParam;
|
||||
}
|
||||
}
|
||||
@ -38,7 +38,7 @@ public class TodoBroadcaster {
|
||||
.distinct()
|
||||
.collect(toList());
|
||||
List<Todo> upToDateTodos = todoDao.listByIds(todoIds);
|
||||
if (!upToDateTodos.isEmpty()) {
|
||||
if (upToDateTodos.isEmpty()) {
|
||||
log.warn("发送待办通知时, 查询不到最新的待办信息. todoIds={}", JSON.toJSONString(todoIds));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@ import cn.axzo.msg.center.dal.TodoBusinessDao;
|
||||
import cn.axzo.msg.center.dal.TodoBusinesses;
|
||||
import cn.axzo.msg.center.domain.entity.Todo;
|
||||
import cn.axzo.msg.center.domain.entity.TodoBusiness;
|
||||
import cn.axzo.msg.center.message.service.todo.manage.TodoExt;
|
||||
import cn.axzo.msg.center.mq.MqMessageRecord;
|
||||
import cn.axzo.msg.center.mq.MqMessageType;
|
||||
import cn.axzo.msg.center.mq.MqProducer;
|
||||
@ -45,6 +46,8 @@ public class TodoMqBroadcaster {
|
||||
|
||||
public TodoInfo createTodoInfo(TodoBusinesses businesses, Todo todo) {
|
||||
TodoInfo todoInfo = BeanMapper.copyBean(todo, TodoInfo.class);
|
||||
todoInfo.setBizExtParam(TodoExt.copyBizExtParam(todo, true));
|
||||
todoInfo.setRouterParams(TodoExt.copyRouterExtParam(todo, true));
|
||||
todoInfo.setTodoId(todo.getId());
|
||||
todoInfo.setTodoBusinessId(todo.getTodoBusinessId());
|
||||
todoInfo.setExecutorOuId(todo.getOuId());
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
package cn.axzo.msg.center.domain.entity;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@ -16,6 +16,7 @@ import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* @author yanglin
|
||||
|
||||
Loading…
Reference in New Issue
Block a user