From b9b4add3fb94bab754d32f2c7fd0b43653f8c7f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=98=89=E4=BC=9F?= <1724121454@qq.com> Date: Mon, 2 Aug 2021 10:02:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=82=E5=B8=B8=E6=B6=88=E6=81=AF=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/AbnormalMessageController.java | 130 ----------------- .../anomaly/mapper/AbnormalMessageMapper.java | 18 --- .../service/AbnormalMessageService.java | 28 ---- .../service/impl/AbnormalBillServiceImpl.java | 52 +++---- .../impl/AbnormalMessageServiceImpl.java | 46 ------ .../service/impl/AnomalyJobServiceImpl.java | 28 ++-- .../common/controller/MessageController.java | 132 ++++++++++++++++++ .../mesnac/common/mapper/MessageMapper.java | 18 +++ .../mesnac/common/model/Message.java | 50 +++---- .../mesnac/common/service/MessageService.java | 28 ++++ .../service/impl/MessageServiceImpl.java | 46 ++++++ .../main/resources/mapper/MessageMapper.xml | 112 +++++++-------- 12 files changed, 346 insertions(+), 342 deletions(-) delete mode 100644 anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/AbnormalMessageController.java delete mode 100644 anomaly/src/main/java/com/foreverwin/mesnac/anomaly/mapper/AbnormalMessageMapper.java delete mode 100644 anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/AbnormalMessageService.java delete mode 100644 anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/AbnormalMessageServiceImpl.java create mode 100644 common/src/main/java/com/foreverwin/mesnac/common/controller/MessageController.java create mode 100644 common/src/main/java/com/foreverwin/mesnac/common/mapper/MessageMapper.java rename anomaly/src/main/java/com/foreverwin/mesnac/anomaly/model/AbnormalMessage.java => common/src/main/java/com/foreverwin/mesnac/common/model/Message.java (87%) create mode 100644 common/src/main/java/com/foreverwin/mesnac/common/service/MessageService.java create mode 100644 common/src/main/java/com/foreverwin/mesnac/common/service/impl/MessageServiceImpl.java rename anomaly/src/main/resources/mapper/AbnormalMessageMapper.xml => common/src/main/resources/mapper/MessageMapper.xml (87%) diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/AbnormalMessageController.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/AbnormalMessageController.java deleted file mode 100644 index 43057883..00000000 --- a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/AbnormalMessageController.java +++ /dev/null @@ -1,130 +0,0 @@ -package com.foreverwin.mesnac.anomaly.controller; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.foreverwin.mesnac.anomaly.model.AbnormalMessage; -import com.foreverwin.mesnac.anomaly.service.AbnormalMessageService; -import com.foreverwin.modular.core.util.FrontPage; -import com.foreverwin.modular.core.util.R; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import java.util.List; - -/** - * - * @author 赵嘉伟 - * @since 2021-07-22 - */ -@RestController -@RequestMapping("/Z-ABNORMAL-MESSAGE") -public class AbnormalMessageController { - - @Autowired - public AbnormalMessageService abnormalMessageService; - - /** - * 根据id查询 - * - * @param id 主键 - * @return - */ - @ResponseBody - @GetMapping("/{id:.+}") - public R getAbnormalMessageById(@PathVariable String id) { - return R.ok( abnormalMessageService.getById(id)); - } - - /** - * 查询所有数据 - * - * @return - */ - @ResponseBody - @GetMapping("") - public R getAbnormalMessageList(AbnormalMessage abnormalMessage){ - List result; - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.setEntity(abnormalMessage); - result = abnormalMessageService.list(queryWrapper); - return R.ok(result); - } - - /** - * 分页查询数据 - * - * @param frontPage 分页信息 - * @return - */ - @ResponseBody - @GetMapping("/page") - public R page(FrontPage frontPage, AbnormalMessage abnormalMessage){ - IPage result; - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.setEntity(abnormalMessage); - if (frontPage.getGlobalQuery() != null && !"".equals(frontPage.getGlobalQuery().trim())) { - //TODO modify global query - queryWrapper.lambda().and(wrapper -> wrapper - .like(AbnormalMessage::getHandle, frontPage.getGlobalQuery()) - .or().like(AbnormalMessage::getSite, frontPage.getGlobalQuery()) - .or().like(AbnormalMessage::getAbnormalBillBo, frontPage.getGlobalQuery()) - .or().like(AbnormalMessage::getType, frontPage.getGlobalQuery()) - .or().like(AbnormalMessage::getMessageType, frontPage.getGlobalQuery()) - .or().like(AbnormalMessage::getSendUserGroup, frontPage.getGlobalQuery()) - .or().like(AbnormalMessage::getSendUser, frontPage.getGlobalQuery()) - .or().like(AbnormalMessage::getContent, frontPage.getGlobalQuery()) - .or().like(AbnormalMessage::getUpUserGroup, frontPage.getGlobalQuery()) - .or().like(AbnormalMessage::getUpUser, frontPage.getGlobalQuery()) - .or().like(AbnormalMessage::getUpMessageType, frontPage.getGlobalQuery()) - .or().like(AbnormalMessage::getAbnormalNode, frontPage.getGlobalQuery()) - .or().like(AbnormalMessage::getStatus, frontPage.getGlobalQuery()) - .or().like(AbnormalMessage::getCreatedUser, frontPage.getGlobalQuery()) - .or().like(AbnormalMessage::getModifiedUser, frontPage.getGlobalQuery()) - ); - } - result = abnormalMessageService.page(frontPage.getPagePlus(), queryWrapper); - return R.ok(result); - } - - /** - * 新增 - * @param abnormalMessage 传递的实体 - * @return null 失败 实体成功 - */ - @PostMapping - public R save(@RequestBody AbnormalMessage abnormalMessage) { - return R.ok(abnormalMessageService.save(abnormalMessage)); - } - - /** - * 修改 - * @param abnormalMessage 传递的实体 - * @return null 失败 实体成功 - */ - @PutMapping - public R updateById(@RequestBody AbnormalMessage abnormalMessage) { - return R.ok(abnormalMessageService.updateById(abnormalMessage)); - } - - /** - * 根据id删除对象 - * @param id 实体ID - * @return 0 失败 1 成功 - */ - @ResponseBody - @RequestMapping(method = RequestMethod.DELETE, value = "/{id:.+}") - public R removeById(@PathVariable("id") String id){ - return R.ok(abnormalMessageService.removeById(id)); - } - - /** - * 批量删除对象 - * @param ids 实体集合ID - * @return 0 失败 1 成功 - */ - @ResponseBody - @RequestMapping(method = RequestMethod.POST, value = "/delete-batch") - public R removeByIds(List ids){ - return R.ok(abnormalMessageService.removeByIds(ids)); - } -} \ No newline at end of file diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/mapper/AbnormalMessageMapper.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/mapper/AbnormalMessageMapper.java deleted file mode 100644 index 0d14bd7d..00000000 --- a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/mapper/AbnormalMessageMapper.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.foreverwin.mesnac.anomaly.mapper; - -import com.foreverwin.mesnac.anomaly.model.AbnormalMessage; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.springframework.stereotype.Repository; - -/** - *

- * Mapper 接口 - *

- * - * @author 赵嘉伟 - * @since 2021-07-22 - */ -@Repository -public interface AbnormalMessageMapper extends BaseMapper { - -} \ No newline at end of file diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/AbnormalMessageService.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/AbnormalMessageService.java deleted file mode 100644 index 275e7e28..00000000 --- a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/AbnormalMessageService.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.foreverwin.mesnac.anomaly.service; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.foreverwin.mesnac.anomaly.model.AbnormalMessage; -import com.baomidou.mybatisplus.extension.service.IService; -import com.foreverwin.modular.core.util.FrontPage; - -import java.util.List; - -/** - *

- * 服务类 - *

- * - * @author 赵嘉伟 - * @since 2021-07-22 - */ -public interface AbnormalMessageService extends IService { - - /** - * 分页查询 - * @param frontPage - * @return - */ - IPage selectPage(FrontPage frontPage, AbnormalMessage abnormalMessage); - - List selectList(AbnormalMessage abnormalMessage); -} \ No newline at end of file diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/AbnormalBillServiceImpl.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/AbnormalBillServiceImpl.java index 871daf86..c57f4187 100644 --- a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/AbnormalBillServiceImpl.java +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/AbnormalBillServiceImpl.java @@ -8,7 +8,6 @@ import com.foreverwin.mesnac.anomaly.dto.AbnormalBillDisposeDto; import com.foreverwin.mesnac.anomaly.dto.AbnormalBillDto; import com.foreverwin.mesnac.anomaly.mapper.AbnormalBillDisposeMapper; import com.foreverwin.mesnac.anomaly.mapper.AbnormalBillMapper; -import com.foreverwin.mesnac.anomaly.mapper.AbnormalMessageMapper; import com.foreverwin.mesnac.anomaly.model.*; import com.foreverwin.mesnac.anomaly.service.*; import com.foreverwin.mesnac.anomaly.util.ActiveMQUtil; @@ -16,7 +15,10 @@ import com.foreverwin.mesnac.common.constant.Constants; import com.foreverwin.mesnac.common.dto.ScrapDto; import com.foreverwin.mesnac.common.enums.HandleEnum; import com.foreverwin.mesnac.common.helper.NextNumberHelper; +import com.foreverwin.mesnac.common.mapper.MessageMapper; +import com.foreverwin.mesnac.common.model.Message; import com.foreverwin.mesnac.common.service.AnomalyService; +import com.foreverwin.mesnac.common.service.MessageService; import com.foreverwin.mesnac.common.util.StringUtil; import com.foreverwin.mesnac.meapi.dto.ShopOrderDto; import com.foreverwin.mesnac.meapi.mapper.*; @@ -129,10 +131,10 @@ public class AbnormalBillServiceImpl extends ServiceImpl wrapper = new QueryWrapper<>(); - AbnormalMessage abnormalMessage1 = new AbnormalMessage(); + QueryWrapper wrapper = new QueryWrapper<>(); + Message abnormalMessage1 = new Message(); abnormalMessage1.setSite(site); - abnormalMessage1.setAbnormalBillBo(abnormalBill.getHandle()); - abnormalMessage1.setAbnormalNode(Constants.ABNORMAL_MESSAGE_REPORT); + abnormalMessage1.setObjectBo(abnormalBill.getHandle()); + abnormalMessage1.setNode(Constants.ABNORMAL_MESSAGE_REPORT); wrapper.setEntity(abnormalMessage1); - AbnormalMessage _abnormalMessage = abnormalMessageMapper.selectOne(wrapper); + Message _abnormalMessage = messageMapper.selectOne(wrapper); abnormalMessage.setUpUserGroup(_abnormalMessage.getUpUserGroup()); abnormalMessage.setUpMessageType(_abnormalMessage.getUpMessageType()); abnormalMessage.setGrade(_abnormalMessage.getGrade()); abnormalMessage.setUpDateTime(_abnormalMessage.getUpDateTime()); - abnormalMessage.setAbnormalNode(Constants.ABNORMAL_MESSAGE_RESPONSE); + abnormalMessage.setNode(Constants.ABNORMAL_MESSAGE_RESPONSE); break; case Constants.CORRECTION_CONFIRM://纠纷确认 abnormalMessage.setSendUserGroup(abnormalBillDispose.getDutySendUserGroup()); - abnormalMessage.setAbnormalNode(Constants.ABNORMAL_MESSAGE_CORRECTION_CONFIRM); + abnormalMessage.setNode(Constants.ABNORMAL_MESSAGE_CORRECTION_CONFIRM); break; case Constants.PROGRAM_CONFIRM://方案确认 abnormalMessage.setSendUser(abnormalBillDispose.getResolveSendUser()); - abnormalMessage.setAbnormalNode(Constants.ABNORMAL_MESSAGE_PROGRAM_CONFIRM); + abnormalMessage.setNode(Constants.ABNORMAL_MESSAGE_PROGRAM_CONFIRM); break; case Constants.CANCEL://取消 abnormalMessage.setSendUserGroup(abnormalBill.getCancelSendUserGroup()); - abnormalMessage.setAbnormalNode(Constants.ABNORMAL_MESSAGE_CANCEL); + abnormalMessage.setNode(Constants.ABNORMAL_MESSAGE_CANCEL); //异常取消的时候要关闭当前异常单下所有的异常信息 - UpdateWrapper messageTypeUpdateWrapper = new UpdateWrapper<>(); + UpdateWrapper messageTypeUpdateWrapper = new UpdateWrapper<>(); // messageTypeUpdateWrapper.eq("SITE",site); // messageTypeUpdateWrapper.eq("ABNORMAL_BILL_BO",abnormalMessage.getAbnormalBillBo()); - AbnormalMessage abnormalMessage2 = new AbnormalMessage(); + Message abnormalMessage2 = new Message(); // abnormalMessage2.setAbnormalBillBo(abnormalMessage.getAbnormalBillBo()); abnormalMessage2.setStatus("Y"); messageTypeUpdateWrapper.eq("STATUS","N"); - messageTypeUpdateWrapper.eq("ABNORMAL_BILL_BO",abnormalMessage.getAbnormalBillBo()); - abnormalMessageService.update(abnormalMessage2,messageTypeUpdateWrapper); + messageTypeUpdateWrapper.eq("OBJECT_BO",abnormalMessage.getObjectBo()); + messageService.update(abnormalMessage2,messageTypeUpdateWrapper); break; case Constants.SHUT_DOWN: break; @@ -916,7 +918,7 @@ public class AbnormalBillServiceImpl extends ServiceImpl nwaUsers = nwaUserService.checkUserGroup(site,abnormalMessage.getSendUserGroup()); StringBuilder sendUsers = new StringBuilder(); for (int i = 0; i < nwaUsers.size(); i++) { @@ -960,7 +962,7 @@ public class AbnormalBillServiceImpl extends ServiceImpl - * 服务实现类 - *

- * - * @author 赵嘉伟 - * @since 2021-07-22 - */ -@Service -@Transactional(rollbackFor = Exception.class) -public class AbnormalMessageServiceImpl extends ServiceImpl implements AbnormalMessageService { - - - @Autowired - private AbnormalMessageMapper abnormalMessageMapper; - - @Override - public IPage selectPage(FrontPage frontPage, AbnormalMessage abnormalMessage) { - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.setEntity(abnormalMessage); - return super.page(frontPage.getPagePlus(), queryWrapper); - } - - @Override - public List selectList(AbnormalMessage abnormalMessage) { - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.setEntity(abnormalMessage); - return super.list(queryWrapper); - } - - -} \ No newline at end of file diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/AnomalyJobServiceImpl.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/AnomalyJobServiceImpl.java index aa2a1702..866ff383 100644 --- a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/AnomalyJobServiceImpl.java +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/AnomalyJobServiceImpl.java @@ -2,13 +2,13 @@ package com.foreverwin.mesnac.anomaly.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.foreverwin.mesnac.anomaly.mapper.AbnormalBillMapper; -import com.foreverwin.mesnac.anomaly.mapper.AbnormalMessageMapper; import com.foreverwin.mesnac.anomaly.model.AbnormalBill; -import com.foreverwin.mesnac.anomaly.model.AbnormalMessage; import com.foreverwin.mesnac.anomaly.service.AbnormalBillService; -import com.foreverwin.mesnac.anomaly.service.AbnormalMessageService; import com.foreverwin.mesnac.anomaly.service.AnomalyJobService; import com.foreverwin.mesnac.anomaly.util.ActiveMQUtil; +import com.foreverwin.mesnac.common.mapper.MessageMapper; +import com.foreverwin.mesnac.common.model.Message; +import com.foreverwin.mesnac.common.service.MessageService; import com.foreverwin.mesnac.common.util.StringUtil; import com.foreverwin.mesnac.meapi.mapper.UserGroupMapper; import com.foreverwin.mesnac.meapi.model.NwaUser; @@ -32,10 +32,10 @@ import java.util.UUID; public class AnomalyJobServiceImpl implements AnomalyJobService { @Autowired - private AbnormalMessageService abnormalMessageService; + private MessageService messageService; @Autowired - private AbnormalMessageMapper abnormalMessageMapper; + private MessageMapper messageMapper; @Autowired private AbnormalBillMapper abnormalBillMapper; @@ -58,19 +58,19 @@ public class AnomalyJobServiceImpl implements AnomalyJobService { LocalDateTime now = LocalDateTime.now(); String user = CommonMethods.getUser(); //找到状态为N,并且升级时间大于当前时间 - QueryWrapper abnormalMessageQueryWrapper = new QueryWrapper<>(); + QueryWrapper abnormalMessageQueryWrapper = new QueryWrapper<>(); abnormalMessageQueryWrapper.eq("STATUS","N"); abnormalMessageQueryWrapper.lt("UP_DATE_TIME",now); - List abnormalMessages = abnormalMessageMapper.selectList(abnormalMessageQueryWrapper); - for(AbnormalMessage _abnormalMessage : abnormalMessages){ + List abnormalMessages = messageMapper.selectList(abnormalMessageQueryWrapper); + for(Message _abnormalMessage : abnormalMessages){ String uuid = UUID.randomUUID().toString(); - AbnormalMessage abnormalMessage = new AbnormalMessage(); + Message abnormalMessage = new Message(); //设置abnormalMessage的handle abnormalMessage.setHandle(uuid); //设置abnormalMessage的site abnormalMessage.setSite(site); //设置abnormalMessage的异常单Bo - abnormalMessage.setAbnormalBillBo(_abnormalMessage.getAbnormalBillBo()); + abnormalMessage.setObjectBo(_abnormalMessage.getObjectBo()); //设置abnormalMessage的type abnormalMessage.setType(_abnormalMessage.getType()); //设置abnormalMessage的message_type @@ -89,7 +89,7 @@ public class AnomalyJobServiceImpl implements AnomalyJobService { abnormalMessage.setUpUser(null); } - AbnormalBill abnormalBill = abnormalBillMapper.selectById(abnormalMessage.getAbnormalBillBo()); + AbnormalBill abnormalBill = abnormalBillMapper.selectById(abnormalMessage.getObjectBo()); String message = abnormalBillService.formatMessage(abnormalBill,abnormalMessage.getMessageType(),site); @@ -101,7 +101,7 @@ public class AnomalyJobServiceImpl implements AnomalyJobService { abnormalMessage.setGrade(_abnormalMessage.getGrade() + 1); abnormalMessage.setResponseDateTime(now); - abnormalMessage.setAbnormalNode(_abnormalMessage.getAbnormalNode()); + abnormalMessage.setNode(_abnormalMessage.getNode()); abnormalMessage.setStatus("Y"); _abnormalMessage.setStatus("Y"); @@ -128,8 +128,8 @@ public class AnomalyJobServiceImpl implements AnomalyJobService { } activeMQUtil.wechatSendMessage(sendUsers.toString(),abnormalMessage.getContent()); // } - abnormalMessageService.saveOrUpdate(abnormalMessage); - abnormalMessageService.saveOrUpdate(_abnormalMessage); + messageService.saveOrUpdate(abnormalMessage); + messageService.saveOrUpdate(_abnormalMessage); } } } diff --git a/common/src/main/java/com/foreverwin/mesnac/common/controller/MessageController.java b/common/src/main/java/com/foreverwin/mesnac/common/controller/MessageController.java new file mode 100644 index 00000000..45371064 --- /dev/null +++ b/common/src/main/java/com/foreverwin/mesnac/common/controller/MessageController.java @@ -0,0 +1,132 @@ +package com.foreverwin.mesnac.common.controller; + +import com.foreverwin.modular.core.util.R; +import com.foreverwin.modular.core.util.FrontPage; +import com.foreverwin.modular.core.util.CommonMethods; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import com.foreverwin.mesnac.common.service.MessageService; +import com.foreverwin.mesnac.common.model.Message; +import java.util.List; + +/** + * + * @author zjw + * @since 2021-08-02 + */ +@RestController +@RequestMapping("/Z-MESSAGE") +public class MessageController { + + @Autowired + public MessageService messageService; + + /** + * 根据id查询 + * + * @param id 主键 + * @return + */ + @ResponseBody + @GetMapping("/{id:.+}") + public R getMessageById(@PathVariable String id) { + return R.ok( messageService.getById(id)); + } + + /** + * 查询所有数据 + * + * @return + */ + @ResponseBody + @GetMapping("") + public R getMessageList(Message message){ + List result; + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.setEntity(message); + result = messageService.list(queryWrapper); + return R.ok(result); + } + + /** + * 分页查询数据 + * + * @param frontPage 分页信息 + * @return + */ + @ResponseBody + @GetMapping("/page") + public R page(FrontPage frontPage, Message message){ + IPage result; + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.setEntity(message); + if (frontPage.getGlobalQuery() != null && !"".equals(frontPage.getGlobalQuery().trim())) { + //TODO modify global query + queryWrapper.lambda().and(wrapper -> wrapper + .like(Message::getHandle, frontPage.getGlobalQuery()) + .or().like(Message::getSite, frontPage.getGlobalQuery()) + .or().like(Message::getObjectBo, frontPage.getGlobalQuery()) + .or().like(Message::getType, frontPage.getGlobalQuery()) + .or().like(Message::getMessageType, frontPage.getGlobalQuery()) + .or().like(Message::getSendUserGroup, frontPage.getGlobalQuery()) + .or().like(Message::getSendUser, frontPage.getGlobalQuery()) + .or().like(Message::getContent, frontPage.getGlobalQuery()) + .or().like(Message::getUpUserGroup, frontPage.getGlobalQuery()) + .or().like(Message::getUpUser, frontPage.getGlobalQuery()) + .or().like(Message::getUpMessageType, frontPage.getGlobalQuery()) + .or().like(Message::getNode, frontPage.getGlobalQuery()) + .or().like(Message::getStatus, frontPage.getGlobalQuery()) + .or().like(Message::getCreatedUser, frontPage.getGlobalQuery()) + .or().like(Message::getModifiedUser, frontPage.getGlobalQuery()) + ); + } + result = messageService.page(frontPage.getPagePlus(), queryWrapper); + return R.ok(result); + } + + /** + * 新增 + * @param message 传递的实体 + * @return null 失败 实体成功 + */ + @PostMapping + public R save(@RequestBody Message message) { + return R.ok(messageService.save(message)); + } + + /** + * 修改 + * @param message 传递的实体 + * @return null 失败 实体成功 + */ + @PutMapping + public R updateById(@RequestBody Message message) { + return R.ok(messageService.updateById(message)); + } + + /** + * 根据id删除对象 + * @param id 实体ID + * @return 0 失败 1 成功 + */ + @ResponseBody + @RequestMapping(method = RequestMethod.DELETE, value = "/{id:.+}") + public R removeById(@PathVariable("id") String id){ + return R.ok(messageService.removeById(id)); + } + + /** + * 批量删除对象 + * @param ids 实体集合ID + * @return 0 失败 1 成功 + */ + @ResponseBody + @RequestMapping(method = RequestMethod.POST, value = "/delete-batch") + public R removeByIds(List ids){ + return R.ok(messageService.removeByIds(ids)); + } +} \ No newline at end of file diff --git a/common/src/main/java/com/foreverwin/mesnac/common/mapper/MessageMapper.java b/common/src/main/java/com/foreverwin/mesnac/common/mapper/MessageMapper.java new file mode 100644 index 00000000..e59ec6d2 --- /dev/null +++ b/common/src/main/java/com/foreverwin/mesnac/common/mapper/MessageMapper.java @@ -0,0 +1,18 @@ +package com.foreverwin.mesnac.common.mapper; + +import com.foreverwin.mesnac.common.model.Message; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zjw + * @since 2021-08-02 + */ +@Repository +public interface MessageMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/model/AbnormalMessage.java b/common/src/main/java/com/foreverwin/mesnac/common/model/Message.java similarity index 87% rename from anomaly/src/main/java/com/foreverwin/mesnac/anomaly/model/AbnormalMessage.java rename to common/src/main/java/com/foreverwin/mesnac/common/model/Message.java index b113c833..a40b12e2 100644 --- a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/model/AbnormalMessage.java +++ b/common/src/main/java/com/foreverwin/mesnac/common/model/Message.java @@ -1,4 +1,4 @@ -package com.foreverwin.mesnac.anomaly.model; +package com.foreverwin.mesnac.common.model; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; @@ -14,13 +14,13 @@ import java.time.LocalDateTime; * *

* - * @author 赵嘉伟 - * @since 2021-07-22 + * @author zjw + * @since 2021-08-02 */ -@TableName("Z_ABNORMAL_MESSAGE") +@TableName("Z_MESSAGE") -public class AbnormalMessage extends Model { +public class Message extends Model { private static final long serialVersionUID = 1L; @@ -37,8 +37,8 @@ public class AbnormalMessage extends Model { /** * 异常单 */ - @TableField("ABNORMAL_BILL_BO") - private String abnormalBillBo; + @TableField("OBJECT_BO") + private String objectBo; /** * 异常类型 */ @@ -88,7 +88,7 @@ public class AbnormalMessage extends Model { * 等级 */ @TableField("GRADE") - private Integer grade; + private Double grade; /** * 消息触发时间 */ @@ -97,8 +97,8 @@ public class AbnormalMessage extends Model { /** * 异常节点 */ - @TableField("ABNORMAL_NODE") - private String abnormalNode; + @TableField("NODE") + private String node; /** * 状态 */ @@ -142,12 +142,12 @@ public class AbnormalMessage extends Model { this.site = site; } - public String getAbnormalBillBo() { - return abnormalBillBo; + public String getObjectBo() { + return objectBo; } - public void setAbnormalBillBo(String abnormalBillBo) { - this.abnormalBillBo = abnormalBillBo; + public void setObjectBo(String objectBo) { + this.objectBo = objectBo; } public String getType() { @@ -222,11 +222,11 @@ public class AbnormalMessage extends Model { this.upDateTime = upDateTime; } - public Integer getGrade() { + public Double getGrade() { return grade; } - public void setGrade(Integer grade) { + public void setGrade(Double grade) { this.grade = grade; } @@ -238,12 +238,12 @@ public class AbnormalMessage extends Model { this.responseDateTime = responseDateTime; } - public String getAbnormalNode() { - return abnormalNode; + public String getNode() { + return node; } - public void setAbnormalNode(String abnormalNode) { - this.abnormalNode = abnormalNode; + public void setNode(String node) { + this.node = node; } public String getStatus() { @@ -290,7 +290,7 @@ public static final String HANDLE = "HANDLE"; public static final String SITE = "SITE"; -public static final String ABNORMAL_BILL_BO = "ABNORMAL_BILL_BO"; +public static final String OBJECT_BO = "OBJECT_BO"; public static final String TYPE = "TYPE"; @@ -314,7 +314,7 @@ public static final String GRADE = "GRADE"; public static final String RESPONSE_DATE_TIME = "RESPONSE_DATE_TIME"; -public static final String ABNORMAL_NODE = "ABNORMAL_NODE"; +public static final String NODE = "NODE"; public static final String STATUS = "STATUS"; @@ -334,10 +334,10 @@ public static final String MODIFIED_DATE_TIME = "MODIFIED_DATE_TIME"; @Override public String toString() { - return "AbnormalMessage{" + + return "Message{" + "handle = " + handle + ", site = " + site + - ", abnormalBillBo = " + abnormalBillBo + + ", objectBo = " + objectBo + ", type = " + type + ", messageType = " + messageType + ", sendUserGroup = " + sendUserGroup + @@ -349,7 +349,7 @@ public static final String MODIFIED_DATE_TIME = "MODIFIED_DATE_TIME"; ", upDateTime = " + upDateTime + ", grade = " + grade + ", responseDateTime = " + responseDateTime + - ", abnormalNode = " + abnormalNode + + ", node = " + node + ", status = " + status + ", createdUser = " + createdUser + ", createdDateTime = " + createdDateTime + diff --git a/common/src/main/java/com/foreverwin/mesnac/common/service/MessageService.java b/common/src/main/java/com/foreverwin/mesnac/common/service/MessageService.java new file mode 100644 index 00000000..ca38a076 --- /dev/null +++ b/common/src/main/java/com/foreverwin/mesnac/common/service/MessageService.java @@ -0,0 +1,28 @@ +package com.foreverwin.mesnac.common.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.foreverwin.mesnac.common.model.Message; +import com.baomidou.mybatisplus.extension.service.IService; +import com.foreverwin.modular.core.util.FrontPage; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author zjw + * @since 2021-08-02 + */ +public interface MessageService extends IService { + + /** + * 分页查询 + * @param frontPage + * @return + */ + IPage selectPage(FrontPage frontPage, Message message); + + List selectList(Message message); +} \ No newline at end of file diff --git a/common/src/main/java/com/foreverwin/mesnac/common/service/impl/MessageServiceImpl.java b/common/src/main/java/com/foreverwin/mesnac/common/service/impl/MessageServiceImpl.java new file mode 100644 index 00000000..07f75498 --- /dev/null +++ b/common/src/main/java/com/foreverwin/mesnac/common/service/impl/MessageServiceImpl.java @@ -0,0 +1,46 @@ +package com.foreverwin.mesnac.common.service.impl; + +import com.foreverwin.modular.core.util.FrontPage; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.foreverwin.mesnac.common.model.Message; +import com.foreverwin.mesnac.common.mapper.MessageMapper; +import com.foreverwin.mesnac.common.service.MessageService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +/** + *

+ * 服务实现类 + *

+ * + * @author zjw + * @since 2021-08-02 + */ +@Service +@Transactional(rollbackFor = Exception.class) +public class MessageServiceImpl extends ServiceImpl implements MessageService { + + + @Autowired + private MessageMapper messageMapper; + + @Override + public IPage selectPage(FrontPage frontPage, Message message) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.setEntity(message); + return super.page(frontPage.getPagePlus(), queryWrapper); + } + + @Override + public List selectList(Message message) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.setEntity(message); + return super.list(queryWrapper); + } + + +} \ No newline at end of file diff --git a/anomaly/src/main/resources/mapper/AbnormalMessageMapper.xml b/common/src/main/resources/mapper/MessageMapper.xml similarity index 87% rename from anomaly/src/main/resources/mapper/AbnormalMessageMapper.xml rename to common/src/main/resources/mapper/MessageMapper.xml index 345bbf1c..194046bb 100644 --- a/anomaly/src/main/resources/mapper/AbnormalMessageMapper.xml +++ b/common/src/main/resources/mapper/MessageMapper.xml @@ -1,12 +1,12 @@ - + - + - + @@ -18,7 +18,7 @@ - + @@ -28,17 +28,17 @@ - HANDLE, SITE, ABNORMAL_BILL_BO, TYPE, MESSAGE_TYPE, SEND_USER_GROUP, SEND_USER, CONTENT, UP_USER_GROUP, UP_USER, UP_MESSAGE_TYPE, UP_DATE_TIME, GRADE, RESPONSE_DATE_TIME, ABNORMAL_NODE, STATUS, CREATED_USER, CREATED_DATE_TIME, MODIFIED_USER, MODIFIED_DATE_TIME + HANDLE, SITE, OBJECT_BO, TYPE, MESSAGE_TYPE, SEND_USER_GROUP, SEND_USER, CONTENT, UP_USER_GROUP, UP_USER, UP_MESSAGE_TYPE, UP_DATE_TIME, GRADE, RESPONSE_DATE_TIME, NODE, STATUS, CREATED_USER, CREATED_DATE_TIME, MODIFIED_USER, MODIFIED_DATE_TIME SELECT - FROM Z_ABNORMAL_MESSAGE WHERE HANDLE IN ( + FROM Z_MESSAGE WHERE HANDLE IN ( #{item} ) - - INSERT INTO Z_ABNORMAL_MESSAGE + + INSERT INTO Z_MESSAGE HANDLE, SITE, - ABNORMAL_BILL_BO, + OBJECT_BO, TYPE, MESSAGE_TYPE, SEND_USER_GROUP, @@ -330,7 +330,7 @@ UP_DATE_TIME, GRADE, RESPONSE_DATE_TIME, - ABNORMAL_NODE, + NODE, STATUS, CREATED_USER, CREATED_DATE_TIME, @@ -340,7 +340,7 @@ #{handle}, #{site}, - #{abnormalBillBo}, + #{objectBo}, #{type}, #{messageType}, #{sendUserGroup}, @@ -352,7 +352,7 @@ #{upDateTime}, #{grade}, #{responseDateTime}, - #{abnormalNode}, + #{node}, #{status}, #{createdUser}, #{createdDateTime}, @@ -361,15 +361,15 @@ - - INSERT INTO Z_ABNORMAL_MESSAGE + + INSERT INTO Z_MESSAGE VALUES #{handle}, #{site}, - #{abnormalBillBo}, + #{objectBo}, #{type}, #{messageType}, #{sendUserGroup}, @@ -381,7 +381,7 @@ #{upDateTime}, #{grade}, #{responseDateTime}, - #{abnormalNode}, + #{node}, #{status}, #{createdUser}, #{createdDateTime}, @@ -392,9 +392,9 @@ - UPDATE Z_ABNORMAL_MESSAGE + UPDATE Z_MESSAGE SITE=#{et.site}, - ABNORMAL_BILL_BO=#{et.abnormalBillBo}, + OBJECT_BO=#{et.objectBo}, TYPE=#{et.type}, MESSAGE_TYPE=#{et.messageType}, SEND_USER_GROUP=#{et.sendUserGroup}, @@ -406,7 +406,7 @@ UP_DATE_TIME=#{et.upDateTime}, GRADE=#{et.grade}, RESPONSE_DATE_TIME=#{et.responseDateTime}, - ABNORMAL_NODE=#{et.abnormalNode}, + NODE=#{et.node}, STATUS=#{et.status}, CREATED_USER=#{et.createdUser}, CREATED_DATE_TIME=#{et.createdDateTime}, @@ -417,9 +417,9 @@ - UPDATE Z_ABNORMAL_MESSAGE + UPDATE Z_MESSAGE SITE=#{et.site}, - ABNORMAL_BILL_BO=#{et.abnormalBillBo}, + OBJECT_BO=#{et.objectBo}, TYPE=#{et.type}, MESSAGE_TYPE=#{et.messageType}, SEND_USER_GROUP=#{et.sendUserGroup}, @@ -431,7 +431,7 @@ UP_DATE_TIME=#{et.upDateTime}, GRADE=#{et.grade}, RESPONSE_DATE_TIME=#{et.responseDateTime}, - ABNORMAL_NODE=#{et.abnormalNode}, + NODE=#{et.node}, STATUS=#{et.status}, CREATED_USER=#{et.createdUser}, CREATED_DATE_TIME=#{et.createdDateTime}, @@ -442,9 +442,9 @@ - UPDATE Z_ABNORMAL_MESSAGE + UPDATE Z_MESSAGE SITE=#{et.site}, - ABNORMAL_BILL_BO=#{et.abnormalBillBo}, + OBJECT_BO=#{et.objectBo}, TYPE=#{et.type}, MESSAGE_TYPE=#{et.messageType}, SEND_USER_GROUP=#{et.sendUserGroup}, @@ -456,7 +456,7 @@ UP_DATE_TIME=#{et.upDateTime}, GRADE=#{et.grade}, RESPONSE_DATE_TIME=#{et.responseDateTime}, - ABNORMAL_NODE=#{et.abnormalNode}, + NODE=#{et.node}, STATUS=#{et.status}, CREATED_USER=#{et.createdUser}, CREATED_DATE_TIME=#{et.createdDateTime}, @@ -468,7 +468,7 @@ HANDLE=#{ew.entity.handle} AND SITE=#{ew.entity.site} - AND ABNORMAL_BILL_BO=#{ew.entity.abnormalBillBo} + AND OBJECT_BO=#{ew.entity.objectBo} AND TYPE=#{ew.entity.type} AND MESSAGE_TYPE=#{ew.entity.messageType} AND SEND_USER_GROUP=#{ew.entity.sendUserGroup} @@ -480,7 +480,7 @@ AND UP_DATE_TIME=#{ew.entity.upDateTime} AND GRADE=#{ew.entity.grade} AND RESPONSE_DATE_TIME=#{ew.entity.responseDateTime} - AND ABNORMAL_NODE=#{ew.entity.abnormalNode} + AND NODE=#{ew.entity.node} AND STATUS=#{ew.entity.status} AND CREATED_USER=#{ew.entity.createdUser} AND CREATED_DATE_TIME=#{ew.entity.createdDateTime} @@ -498,11 +498,11 @@ - DELETE FROM Z_ABNORMAL_MESSAGE WHERE HANDLE=#{handle} + DELETE FROM Z_MESSAGE WHERE HANDLE=#{handle} - DELETE FROM Z_ABNORMAL_MESSAGE + DELETE FROM Z_MESSAGE @@ -515,7 +515,7 @@ - DELETE FROM Z_ABNORMAL_MESSAGE + DELETE FROM Z_MESSAGE @@ -523,7 +523,7 @@ HANDLE=#{ew.entity.handle} AND SITE=#{ew.entity.site} - AND ABNORMAL_BILL_BO=#{ew.entity.abnormalBillBo} + AND OBJECT_BO=#{ew.entity.objectBo} AND TYPE=#{ew.entity.type} AND MESSAGE_TYPE=#{ew.entity.messageType} AND SEND_USER_GROUP=#{ew.entity.sendUserGroup} @@ -535,7 +535,7 @@ AND UP_DATE_TIME=#{ew.entity.upDateTime} AND GRADE=#{ew.entity.grade} AND RESPONSE_DATE_TIME=#{ew.entity.responseDateTime} - AND ABNORMAL_NODE=#{ew.entity.abnormalNode} + AND NODE=#{ew.entity.node} AND STATUS=#{ew.entity.status} AND CREATED_USER=#{ew.entity.createdUser} AND CREATED_DATE_TIME=#{ew.entity.createdDateTime} @@ -553,7 +553,7 @@ - DELETE FROM Z_ABNORMAL_MESSAGE WHERE HANDLE IN ( + DELETE FROM Z_MESSAGE WHERE HANDLE IN ( #{item} )