From b3fce41f7960a21c707788aa87448c3e4de82da9 Mon Sep 17 00:00:00 2001 From: yujian <yujian> Date: 星期三, 27 二月 2019 11:47:51 +0800 Subject: [PATCH] 福利券 邀请队员成功之后激活 --- fanli/src/main/java/com/yeshi/fanli/service/impl/msg/UserSystemMsgServiceImpl.java | 34 ++++++++++++++++++++++++++++++++++ 1 files changed, 34 insertions(+), 0 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/msg/UserSystemMsgServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/msg/UserSystemMsgServiceImpl.java index 98e6df7..0745cb3 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/msg/UserSystemMsgServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/msg/UserSystemMsgServiceImpl.java @@ -7,12 +7,15 @@ import org.springframework.stereotype.Service; +import com.yeshi.fanli.dao.config.SystemZnxDao; +import com.yeshi.fanli.dao.mybatis.UserInfoMapper; import com.yeshi.fanli.dao.mybatis.msg.UserSystemMsgMapper; import com.yeshi.fanli.entity.bus.msg.UserSystemMsg; import com.yeshi.fanli.entity.bus.msg.UserSystemMsgTypeEnum; import com.yeshi.fanli.entity.bus.user.UserInfo; import com.yeshi.fanli.entity.system.SystemZnx; import com.yeshi.fanli.exception.msg.UserSystemMsgException; +import com.yeshi.fanli.service.inter.msg.UserMsgReadStateService; import com.yeshi.fanli.service.inter.msg.UserSystemMsgService; import com.yeshi.fanli.util.StringUtil; @@ -21,6 +24,15 @@ @Resource private UserSystemMsgMapper userSystemMsgMapper; + + @Resource + private UserMsgReadStateService userMsgReadStateService; + + @Resource + private UserInfoMapper userInfoMapper; + + @Resource + private SystemZnxDao systemZnxDao; @Override public void addUserSystemMsg(Long uid, UserSystemMsgTypeEnum type, String title, String content, int timeTag, @@ -50,6 +62,7 @@ msg.setTimeTag(timeTag); } userSystemMsgMapper.insertSelective(msg); + userMsgReadStateService.addSystemMsgUnReadCount(uid, 1); } @Override @@ -99,4 +112,25 @@ userSystemMsgMapper.setMsgReadByUid(uid); } + @Override + public void syncSystemZNX(Long uid) { + UserInfo user = userInfoMapper.selectByPrimaryKey(uid); + if (user == null) + return; + long createtTime = user.getCreatetime(); + List<SystemZnx> list = systemZnxDao.list("from SystemZnx s where s.createTime>=" + createtTime); + if (list != null && list.size() > 0) { + for (SystemZnx znx : list) { + UserSystemMsg msg = userSystemMsgMapper.selectBySystemZNXId(znx.getId()); + if (msg == null) + try { + addUserSystemMsg(uid, UserSystemMsgTypeEnum.common, null, null, UserSystemMsg.TIME_TAG_COMMON, znx); + } catch (UserSystemMsgException e) { + e.printStackTrace(); + } + } + + } + } + } -- Gitblit v1.8.0