| | |
| | | package com.ks.daylucky.service.impl.remote; |
| | | |
| | | import com.beust.jcommander.ParameterException; |
| | | import com.ks.daylucky.exception.UserInfoException; |
| | | import com.ks.daylucky.mapper.UserInfoExtraMapper; |
| | | import com.ks.daylucky.mapper.UserInfoMapper; |
| | | import com.ks.daylucky.pojo.DO.UserInfo; |
| | | import com.ks.daylucky.pojo.DO.UserInfoExtra; |
| | | import com.ks.daylucky.pojo.VO.SimpleUser; |
| | | import com.ks.daylucky.query.UserInfoQuery; |
| | | import com.ks.daylucky.service.UserInfoExtraService; |
| | | import com.ks.daylucky.service.UserInfoService; |
| | | import com.ks.lib.common.exception.ParamsException; |
| | | import com.ks.lucky.pojo.DO.BaseUser; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.validation.annotation.Validated; |
| | |
| | | |
| | | @Validated |
| | | @Override |
| | | public Long addUserInfo(@Valid UserInfo userInfo) throws ParameterException, UserInfoException { |
| | | public Long addUserInfo(@Valid UserInfo userInfo) throws ParamsException, UserInfoException { |
| | | UserInfo old = getUserInfo(userInfo.getAppId(), userInfo.getIdentifyCode()); |
| | | if (old != null) { |
| | | throw new UserInfoException(UserInfoException.CODE_EXIST, "用户已存在"); |
| | |
| | | userInfoMapper.insertSelective(userInfo); |
| | | |
| | | //初始化附加信息 |
| | | userInfoExtraService.init(userInfo.getId()); |
| | | userInfoExtraService.init(userInfo.getId(), userInfo.getType() == UserInfo.TYPE_NORMAL ? true : false); |
| | | return userInfo.getId(); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<UserInfo> getUserList(UserInfoQuery query, int page, int pageSize) { |
| | | query.start = (page - 1) * pageSize; |
| | | query.count = pageSize; |
| | | public List<UserInfo> getUserList(UserInfoQuery query, Integer page, Integer pageSize) { |
| | | if (page != null && pageSize != null) { |
| | | query.start = (page - 1) * pageSize; |
| | | query.count = pageSize; |
| | | } |
| | | return userInfoMapper.list(query); |
| | | } |
| | | |
| | |
| | | userInfo.setUpdateTime(new Date()); |
| | | userInfoMapper.updateByPrimaryKeySelective(userInfo); |
| | | } |
| | | |
| | | @Override |
| | | public SimpleUser getSimpleUser(Long id) { |
| | | UserInfo user = userInfoMapper.selectByPrimaryKey(id); |
| | | if (user == null) { |
| | | return null; |
| | | } |
| | | return new SimpleUser(user.getId(), user.getNickName(), user.getPortrait()); |
| | | } |
| | | } |