| | |
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.UserInfoMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.msg.UserSystemMsgMapper;
|
| | |
| | | @Resource
|
| | | private SystemZnxService systemZnxService;
|
| | |
|
| | | @Transactional(rollbackFor=Exception.class)
|
| | | @Override
|
| | | public void addUserSystemMsg(Long uid, UserSystemMsgTypeEnum type, String title, String content, int timeTag,
|
| | | SystemZnx sz) throws UserSystemMsgException {
|
| | |
| | | throw new UserSystemMsgException(1, "信息不完整");
|
| | | UserSystemMsg msg = new UserSystemMsg();
|
| | | if (sz != null) {
|
| | | if (userSystemMsgMapper.selectBySystemZNXId(sz.getId()) == null) {
|
| | | if (userSystemMsgMapper.selectBySystemZNXId(sz.getId(), uid) == null) {
|
| | | msg.setCreateTime(new Date(sz.getCreateTime()));
|
| | | msg.setRead(false);
|
| | | msg.setSolved(false);
|
| | |
| | | msg.setUser(new UserInfo(uid));
|
| | | msg.setType(type);
|
| | | msg.setTimeTag(timeTag);
|
| | | msg.setTitle(sz.getTitle());
|
| | | msg.setContent(sz.getContent());
|
| | | } else
|
| | | throw new UserSystemMsgException(1, "消息已存在");
|
| | | } else {
|
| | |
| | |
|
| | | @Override
|
| | | public void syncSystemZNX(Long uid) {
|
| | | UserInfo user = userInfoMapper.selectByPrimaryKey(uid);
|
| | | UserInfo user = userInfoMapper.selectAvailableByPrimaryKey(uid);
|
| | | if (user == null)
|
| | | return;
|
| | | long createTime = user.getCreatetime();
|
| | | List<SystemZnx> list = systemZnxService.listbyCreateTime(createTime);
|
| | | if (list != null && list.size() > 0) {
|
| | | for (SystemZnx znx : list) {
|
| | | UserSystemMsg msg = userSystemMsgMapper.selectBySystemZNXId(znx.getId());
|
| | | UserSystemMsg msg = userSystemMsgMapper.selectBySystemZNXId(znx.getId(), uid);
|
| | | if (msg == null)
|
| | | try {
|
| | | addUserSystemMsg(uid, UserSystemMsgTypeEnum.common, null, null, UserSystemMsg.TIME_TAG_COMMON, znx);
|
| | | addUserSystemMsg(uid, UserSystemMsgTypeEnum.common, null, null, UserSystemMsg.TIME_TAG_COMMON,
|
| | | znx);
|
| | | } catch (UserSystemMsgException e) {
|
| | | e.printStackTrace();
|
| | | }
|