| | |
| | | package com.yeshi.fanli.service.impl.user.tb; |
| | | |
| | | import java.util.Collections; |
| | | import java.util.Comparator; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | //清除该用户的授权信息 |
| | | // userExtraTaoBaoInfoMapper.clearUid(uid); |
| | | SystemEnum system = userInfoService.getUserSystem(uid); |
| | | List<UserExtraTaoBaoInfo> list = userExtraTaoBaoInfoMapper.listByTaoBaoUid(taoBaoUid,system); |
| | | List<UserExtraTaoBaoInfo> list = userExtraTaoBaoInfoMapper.listByTaoBaoUid(taoBaoUid, system); |
| | | UserExtraTaoBaoInfo existInfo = null; |
| | | if (list != null) |
| | | for (UserExtraTaoBaoInfo tb : list) { |
| | |
| | | taoBaoInfo.setRelationUpdateTime(new Date()); |
| | | |
| | | |
| | | if (existInfo==null) { |
| | | if (existInfo == null) { |
| | | // 新增 |
| | | taoBaoInfo.setCreateTime(new Date()); |
| | | userExtraTaoBaoInfoMapper.insertSelective(taoBaoInfo); |
| | |
| | | |
| | | userExtraTaoBaoInfoMapper.clearUid(uid); |
| | | |
| | | List<UserExtraTaoBaoInfo> list = userExtraTaoBaoInfoMapper.listByTaoBaoUid(taoBaoUid,system); |
| | | List<UserExtraTaoBaoInfo> list = userExtraTaoBaoInfoMapper.listByTaoBaoUid(taoBaoUid, system); |
| | | if (list == null || list.size() == 0) { |
| | | // 新增 |
| | | taoBaoInfo.setCreateTime(new Date()); |
| | |
| | | throw new UserExtraTaoBaoInfoException(Constant.CODE_FORBIDDEN_USER, Constant.FORBIDDEN_USER_REASON_DESC); |
| | | } |
| | | |
| | | SystemEnum system=userInfoService.getUserSystem(uid); |
| | | SystemEnum system = userInfoService.getUserSystem(uid); |
| | | |
| | | UserExtraTaoBaoInfo taoBaoInfo = new UserExtraTaoBaoInfo(); |
| | | taoBaoInfo.setTaoBaoUid(taoBaoUid); |
| | |
| | | taoBaoInfo.setSpecialId(specialId); |
| | | taoBaoInfo.setSpecialUpdateTime(new Date()); |
| | | |
| | | List<UserExtraTaoBaoInfo> list = userExtraTaoBaoInfoMapper.listByTaoBaoUid(taoBaoUid,system); |
| | | List<UserExtraTaoBaoInfo> list = userExtraTaoBaoInfoMapper.listByTaoBaoUid(taoBaoUid, system); |
| | | |
| | | // 判断之前用户是否绑定过 |
| | | UserExtraTaoBaoInfo info = userExtraTaoBaoInfoMapper.selectByUid(uid); |
| | |
| | | public void bindTaoBaoOrderEnd6Num(String taoBaoUid, String orderId) { |
| | | if (taoBaoUid == null || StringUtil.isNullOrEmpty(orderId)) |
| | | return; |
| | | UserExtraTaoBaoInfo extraInfo = userExtraTaoBaoInfoMapper.selectByTaoBaoUid(taoBaoUid,null); |
| | | UserExtraTaoBaoInfo extraInfo = userExtraTaoBaoInfoMapper.selectByTaoBaoUid(taoBaoUid, null); |
| | | if (extraInfo != null) { |
| | | UserExtraTaoBaoInfo update = new UserExtraTaoBaoInfo(); |
| | | update.setId(extraInfo.getId()); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public UserExtraTaoBaoInfo getByRelationId(String relationId,SystemEnum system) { |
| | | public UserExtraTaoBaoInfo getByRelationId(String relationId, List<SystemEnum> systemList) { |
| | | if (StringUtil.isNullOrEmpty(relationId)) |
| | | return null; |
| | | return userExtraTaoBaoInfoMapper.selectByRelationIdWithUidNotNull(relationId,system); |
| | | return userExtraTaoBaoInfoMapper.selectByRelationIdWithUidNotNull(relationId, systemList); |
| | | } |
| | | |
| | | @Override |
| | | public UserExtraTaoBaoInfo getBySpecialId(String specialId,SystemEnum system) { |
| | | public UserExtraTaoBaoInfo getBySpecialId(String specialId, List<SystemEnum> systemList) { |
| | | if (StringUtil.isNullOrEmpty(specialId)) |
| | | return null; |
| | | return userExtraTaoBaoInfoMapper.selectBySpecialIdWithUidNotNull(specialId,system); |
| | | List<UserExtraTaoBaoInfo> list = userExtraTaoBaoInfoMapper.selectBySpecialIdWithUidNotNull(specialId, systemList); |
| | | if (list == null || list.size() == 0) { |
| | | return null; |
| | | } |
| | | if (list.size() == 1) { |
| | | return list.get(0); |
| | | } |
| | | //多个系统采用统一PID的情况 |
| | | //uid较小的在前 |
| | | Comparator<UserExtraTaoBaoInfo> comparator = new Comparator<UserExtraTaoBaoInfo>() { |
| | | @Override |
| | | public int compare(UserExtraTaoBaoInfo o1, UserExtraTaoBaoInfo o2) { |
| | | //uid从小到大排列 |
| | | return (int) (o1.getUser().getId().longValue() - o2.getUser().getId().longValue()); |
| | | } |
| | | }; |
| | | Collections.sort(list, comparator); |
| | | return list.get(0); |
| | | } |
| | | |
| | | @Override |