From c93dfa3912f0fed74faa2f5f3ef42c318a04a7a2 Mon Sep 17 00:00:00 2001 From: yujian <yujian@163.com> Date: 星期一, 13 四月 2020 11:04:14 +0800 Subject: [PATCH] 消息 --- fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgOtherDetailServiceImpl.java | 17 +++++++---------- 1 files changed, 7 insertions(+), 10 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgOtherDetailServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgOtherDetailServiceImpl.java index 284ea93..d6e35b1 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgOtherDetailServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgOtherDetailServiceImpl.java @@ -13,6 +13,7 @@ import com.yeshi.fanli.entity.bus.msg.MsgOtherDetail.MsgTypeOtherTypeEnum; import com.yeshi.fanli.exception.msg.MsgOtherDetailException; import com.yeshi.fanli.service.inter.msg.MsgOtherDetailService; +import com.yeshi.fanli.service.inter.msg.UserMsgReadStateService; import com.yeshi.fanli.util.Constant; @Service @@ -21,18 +22,13 @@ @Resource private MsgOtherDetailMapper msgOtherDetailMapper; + @Resource + private UserMsgReadStateService userMsgReadStateService; + @Override public void addMsgOtherDetail(MsgOtherDetail detail) throws MsgOtherDetailException { - - if (detail.getType() == MsgTypeOtherTypeEnum.couponMianDan - || detail.getType() == MsgTypeOtherTypeEnum.couponReward - || detail.getType() == MsgTypeOtherTypeEnum.couponWelfareMianDan) { - if (detail.getCoupnContent() == null) - throw new MsgOtherDetailException(1, "鍐呭涓虹┖"); - detail.setContent(new Gson().toJson(detail.getCoupnContent())); - detail.setCreateTime(new Date()); - msgOtherDetailMapper.insertSelective(detail); - } + msgOtherDetailMapper.insertSelective(detail); + userMsgReadStateService.addOtherMsgUnReadCount(detail.getUser().getId(), 1); } @Override @@ -45,6 +41,7 @@ if (detail.getCoupnContent() == null) throw new MsgOtherDetailException(1, "鍐呭涓虹┖"); detail.setContent(new Gson().toJson(detail.getCoupnContent())); + if(detail.getUpdateTime()==null) detail.setUpdateTime(new Date()); msgOtherDetailMapper.updateByPrimaryKeySelective(detail); } -- Gitblit v1.8.0