From c007868c62c7da5c9ce1bf0e77d9e5f8619826e4 Mon Sep 17 00:00:00 2001
From: yujian <yujian@123.com>
Date: 星期三, 12 六月 2019 12:24:09 +0800
Subject: [PATCH] 查询默认有效调整

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgOtherDetailServiceImpl.java |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 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..a81c05d 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
@@ -20,6 +21,9 @@
 
 	@Resource
 	private MsgOtherDetailMapper msgOtherDetailMapper;
+
+	@Resource
+	private UserMsgReadStateService userMsgReadStateService;
 
 	@Override
 	public void addMsgOtherDetail(MsgOtherDetail detail) throws MsgOtherDetailException {
@@ -30,8 +34,10 @@
 			if (detail.getCoupnContent() == null)
 				throw new MsgOtherDetailException(1, "鍐呭涓虹┖");
 			detail.setContent(new Gson().toJson(detail.getCoupnContent()));
-			detail.setCreateTime(new Date());
+			if (detail.getCreateTime() == null)
+				detail.setCreateTime(new Date());
 			msgOtherDetailMapper.insertSelective(detail);
+			userMsgReadStateService.addOtherMsgUnReadCount(detail.getUser().getId(), 1);
 		}
 	}
 
@@ -45,6 +51,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