| | |
| | | package com.ks.daylucky.service.impl.remote; |
| | | |
| | | import com.ks.daylucky.exception.UserInfoExtraException; |
| | | import com.ks.daylucky.mapper.UserInfoExtraMapper; |
| | | import com.ks.daylucky.pojo.DO.UserInfoExtra; |
| | | import com.ks.daylucky.pojo.DTO.UserMsgSettings; |
| | |
| | | import org.apache.dubbo.config.annotation.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | |
| | | @Service(version = "1.0.0") |
| | | public class UserInfoExtraServiceImpl implements UserInfoExtraService { |
| | |
| | | |
| | | |
| | | @Override |
| | | public void init(Long uid) { |
| | | UserInfoExtra extra = new UserInfoExtra(); |
| | | extra.setCreateTime(new Date()); |
| | | extra.setMsgSetting(new UserMsgSettings().toString()); |
| | | extra.setMsgUnreadCount(0); |
| | | userInfoExtraMapper.insertSelective(extra); |
| | | } |
| | | |
| | | @Override |
| | | public UserInfoExtra getUserInfoExtra(Long uid) { |
| | | return null; |
| | | return userInfoExtraMapper.selectByPrimaryKey(uid); |
| | | } |
| | | |
| | | @Override |
| | | public void setMsgRead(Long uid) { |
| | | |
| | | public void setMsgRead(Long uid) throws UserInfoExtraException { |
| | | UserInfoExtra extra = new UserInfoExtra(); |
| | | extra.setUid(uid); |
| | | extra.setMsgUnreadCount(0); |
| | | extra.setUpdateTime(new Date()); |
| | | userInfoExtraMapper.updateByPrimaryKeySelective(extra); |
| | | } |
| | | |
| | | @Override |
| | | public void setUserMsgSetting(UserMsgSettings setting) { |
| | | |
| | | public void setUserMsgSetting(Long uid, UserMsgSettings setting) { |
| | | UserInfoExtra extra = new UserInfoExtra(); |
| | | extra.setUid(uid); |
| | | extra.setMsgSetting(setting.toString()); |
| | | extra.setUpdateTime(new Date()); |
| | | userInfoExtraMapper.updateByPrimaryKeySelective(extra); |
| | | } |
| | | |
| | | @Override |
| | | public UserMsgSettings getUserMsgSettings(Long uid) { |
| | | return null; |
| | | UserInfoExtra userInfoExtra = userInfoExtraMapper.selectByPrimaryKeyForUpdate(uid); |
| | | String msg = userInfoExtra.getMsgSetting(); |
| | | return UserMsgSettings.parse(msg); |
| | | } |
| | | } |