...
|
...
|
@@ -4,12 +4,12 @@ import com.github.pagehelper.PageInfo; |
|
|
import com.sunyo.wlpt.message.bus.service.domain.*;
|
|
|
import com.sunyo.wlpt.message.bus.service.response.ResultJson;
|
|
|
import com.sunyo.wlpt.message.bus.service.service.*;
|
|
|
import com.sunyo.wlpt.message.bus.service.utils.IdUtils;
|
|
|
import org.springframework.format.annotation.DateTimeFormat;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.validation.constraints.NotNull;
|
|
|
import java.util.Date;
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -71,7 +71,8 @@ public class MessageNoteController { |
|
|
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
|
|
@RequestParam(value = "receiveTime", required = false) Date receiveTime,
|
|
|
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
|
|
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
|
|
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize)
|
|
|
{
|
|
|
// 获取查询参数
|
|
|
MessageNote messageNote = MessageNote.builder()
|
|
|
.username(username)
|
...
|
...
|
@@ -97,8 +98,8 @@ public class MessageNoteController { |
|
|
* @return {@link ResultJson}
|
|
|
*/
|
|
|
@DeleteMapping("/delete")
|
|
|
public ResultJson deleteMessageNote(@RequestBody MessageNote messageNote) {
|
|
|
|
|
|
public ResultJson deleteMessageNote(@RequestBody MessageNote messageNote)
|
|
|
{
|
|
|
return messageNoteService.deleteByPrimaryKey(messageNote.getId()) > 0
|
|
|
? new ResultJson<>("200", "删除-消息收发记录,成功")
|
|
|
: new ResultJson<>("500", "删除-消息收发记录,失败");
|
...
|
...
|
@@ -111,8 +112,8 @@ public class MessageNoteController { |
|
|
* @return {@link ResultJson}
|
|
|
*/
|
|
|
@GetMapping("/batchRemove")
|
|
|
public ResultJson batchRemoveMessageNote(String ids) {
|
|
|
|
|
|
public ResultJson batchRemoveMessageNote(String ids)
|
|
|
{
|
|
|
return messageNoteService.deleteByPrimaryKey(ids) > 0
|
|
|
? new ResultJson<>("200", "删除-消息收发记录,成功")
|
|
|
: new ResultJson<>("500", "删除-消息收发记录,失败");
|
...
|
...
|
@@ -125,8 +126,8 @@ public class MessageNoteController { |
|
|
* @return {@link ResultJson}
|
|
|
*/
|
|
|
@PutMapping("/update")
|
|
|
public ResultJson updateMessageNote(@RequestBody MessageNote messageNote) {
|
|
|
|
|
|
public ResultJson updateMessageNote(@RequestBody MessageNote messageNote)
|
|
|
{
|
|
|
return messageNoteService.updateByPrimaryKeySelective(note_fillName(messageNote)) > 0
|
|
|
? new ResultJson<>("200", "编辑-消息收发记录,成功")
|
|
|
: new ResultJson<>("500", "编辑-消息收发记录,失败");
|
...
|
...
|
@@ -139,10 +140,9 @@ public class MessageNoteController { |
|
|
* @return {@link ResultJson}
|
|
|
*/
|
|
|
@PostMapping("/insert")
|
|
|
public ResultJson insertMessageNote(@RequestBody MessageNote messageNote) {
|
|
|
// 设置id
|
|
|
messageNote.setId(IdUtils.generateId());
|
|
|
return messageNoteService.insertSelective(note_fillName(messageNote)) > 0
|
|
|
public ResultJson insertMessageNote(@RequestBody @NotNull MessageNote messageNote)
|
|
|
{
|
|
|
return messageNoteService.insertSelective(messageNote) > 0
|
|
|
? new ResultJson<>("200", "编辑-消息收发记录,成功")
|
|
|
: new ResultJson<>("500", "编辑-消息收发记录,失败");
|
|
|
}
|
...
|
...
|
@@ -153,10 +153,11 @@ public class MessageNoteController { |
|
|
*/
|
|
|
@Scheduled(cron = "0 0 4 * * ? ")
|
|
|
@GetMapping("/autoDelete")
|
|
|
public void autoDeleteMessageNote() {
|
|
|
public void autoDeleteMessageNote()
|
|
|
{
|
|
|
// 类型
|
|
|
String deleteType = "message_note";
|
|
|
// 首先获取可自主设置的默认时间
|
|
|
// 获取时间
|
|
|
SchedulingDelete schedulingDelete = schedulingDeleteService.selectByType(deleteType);
|
|
|
Integer deleteTime = schedulingDelete.getDeleteTime();
|
|
|
// 定时自动删除
|
...
|
...
|
@@ -169,7 +170,9 @@ public class MessageNoteController { |
|
|
* @param messageNote {@link MessageNote}
|
|
|
* @return {@link MessageNote}
|
|
|
*/
|
|
|
public MessageNote note_fillName(MessageNote messageNote) {
|
|
|
public MessageNote note_fillName(MessageNote messageNote)
|
|
|
{
|
|
|
|
|
|
// 填充,发送内容(编辑 or 新增)
|
|
|
messageNote.setSendContent(messageNote.getAlias_sendContent().getBytes());
|
|
|
|
...
|
...
|
@@ -186,8 +189,8 @@ public class MessageNoteController { |
|
|
messageNote.setExchangeName(busExchange.getExchangeName());
|
|
|
|
|
|
// 填充,队列名称
|
|
|
BusQueue busQueue = busQueueService.selectByPrimaryKey(messageNote.getQueueId());
|
|
|
messageNote.setQueueName(busQueue.getQueueName());
|
|
|
// BusQueue busQueue = busQueueService.selectByPrimaryKey(messageNote.getQueueId());
|
|
|
// messageNote.setQueueName(busQueue.getQueueName());
|
|
|
|
|
|
// 填充,路由键名称
|
|
|
RoutingKey routingKey = routingKeyService.selectByPrimaryKey(messageNote.getRoutingKeyId());
|
...
|
...
|
|