| | |
| | | |
| | | import com.yeshi.makemoney.app.entity.SystemEnum; |
| | | import com.yeshi.makemoney.app.service.inter.user.QQUserInfoService; |
| | | import com.yeshi.makemoney.app.service.inter.user.UserExtraInfoService; |
| | | import com.yeshi.makemoney.app.service.inter.user.WXUserInfoService; |
| | | import com.yeshi.makemoney.app.utils.user.InviteCodeUtil; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.*; |
| | | |
| | | import org.yeshi.utils.bean.BeanUtil; |
| | | |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import com.yeshi.makemoney.app.dao.user.UserInfoDao; |
| | | import com.yeshi.makemoney.app.entity.user.UserInfo; |
| | |
| | | @Service |
| | | public class UserInfoServiceImpl implements UserInfoService { |
| | | |
| | | Logger logger = LoggerFactory.getLogger(UserInfoService.class); |
| | | |
| | | @Resource |
| | | private UserInfoDao userInfoMapper; |
| | | @Resource |
| | |
| | | @Resource |
| | | private QQUserInfoService qqUserInfoService; |
| | | |
| | | @Resource |
| | | private UserExtraInfoService userExtraInfoService; |
| | | |
| | | @Override |
| | | public List<UserInfo> list(UserInfoQuery userInfoQuery, int page, int pageSize) { |
| | | DaoQuery daoQuery = new DaoQuery(); |
| | | try { |
| | | BeanUtil.copyProperties(userInfoQuery, daoQuery); |
| | | } catch (IllegalAccessException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | daoQuery.uid=userInfoQuery.getUid(); |
| | | |
| | | daoQuery.sortList = Arrays.asList(new String[]{"create_time desc"}); |
| | | |
| | | daoQuery.start = (page - 1) * pageSize; |
| | | daoQuery.count = pageSize; |
| | | return userInfoMapper.list(daoQuery); |
| | | } |
| | | |
| | | @Override |
| | | public List<UserInfo> list(List<Long> uidList) { |
| | | if(uidList==null||uidList.size()==0) { |
| | | public List<UserInfo> list(Collection<Long> uidList) { |
| | | if (uidList == null || uidList.size() == 0) { |
| | | return new ArrayList<>(); |
| | | } |
| | | return userInfoMapper.listByUids(uidList); |
| | | List<Long> list = new ArrayList<>(); |
| | | list.addAll(uidList); |
| | | return userInfoMapper.listByUids(list); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | //保存 |
| | | userInfoMapper.insertSelective(userInfo); |
| | | |
| | | //添加邀请码 |
| | | userExtraInfoService.setInviteCode(userInfo.getId(), InviteCodeUtil.createInviteCode(userInfo.getId())); |
| | | } |
| | | |
| | | @Override |
| | |
| | | return userInfos != null && userInfos.size() > 0 ? userInfos.get(0) : null; |
| | | } |
| | | |
| | | @Override |
| | | public void forbiddenUser(List<Long> uidList, String adminId) { |
| | | if (uidList == null || uidList.size() == 0) { |
| | | return; |
| | | } |
| | | |
| | | for (Long uid : uidList) { |
| | | UserInfo user = new UserInfo(); |
| | | user.setId(uid); |
| | | user.setStatus(UserInfo.STATUS_FORBIDDEN); |
| | | update(user); |
| | | logger.warn("封禁用户: uid-{} adminId-{}", uid, adminId); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | } |