| | |
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Propagation;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | | import org.yeshi.utils.HttpUtil;
|
| | | import org.yeshi.utils.NumberUtil;
|
| | | import org.yeshi.utils.tencentcloud.COSManager;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dao.mybatis.BindingAccountMapper;
|
| | |
| | | import com.yeshi.fanli.entity.admin.UserInfoAdmin;
|
| | | import com.yeshi.fanli.entity.bus.user.BindingAccount;
|
| | | import com.yeshi.fanli.entity.bus.user.InviteUser;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.WeiXinUser;
|
| | | import com.yeshi.fanli.entity.system.System;
|
| | | import com.yeshi.fanli.exception.ThreeSaleException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoService;
|
| | |
| | | import com.yeshi.fanli.util.Utils;
|
| | | import com.yeshi.fanli.util.account.UserUtil;
|
| | | import com.yeshi.fanli.util.wx.WXLoginUtil;
|
| | | import org.yeshi.utils.HttpUtil;
|
| | | import org.yeshi.utils.NumberUtil;
|
| | | import org.yeshi.utils.tencentcloud.COSManager;
|
| | |
|
| | | @Service
|
| | | public class UserInfoServiceImpl implements UserInfoService {
|
| | |
| | |
|
| | | @Resource
|
| | | private ShareMapper shareMapper;
|
| | | |
| | | |
| | |
|
| | | public UserInfo getUserByLoginTypeAndOpenId(int loginType, String openid, String appid) {
|
| | | List<UserInfo> list = null;
|
| | |
| | | }
|
| | | String wxUnionId = weiXinUser.getUnionid();
|
| | | UserInfo find = getUserByLoginTypeAndOpenId(Constant.WEIXIN, wxUnionId, Constant.APPID);
|
| | |
|
| | | if (find == null) {
|
| | | find = new UserInfo();
|
| | | find.setAppId(Constant.APPID);
|
| | | find.setWxUnionId(weiXinUser.getUnionid());
|
| | | String wxHeadImg = COSManager.getInstance().uploadFile(
|
| | | HttpUtil.getAsInputStream(weiXinUser.getHeadimgurl()),
|
| | | Constant.WXHEADURL + UUID.randomUUID().toString()).getUrl();
|
| | | String wxHeadImg = COSManager.getInstance()
|
| | | .uploadFile(HttpUtil.getAsInputStream(weiXinUser.getHeadimgurl()),
|
| | | Constant.WXHEADURL + UUID.randomUUID().toString())
|
| | | .getUrl();
|
| | | find.setPortrait(wxHeadImg);
|
| | | find.setWxPic(wxHeadImg);
|
| | | find.setNickName(weiXinUser.getNickname());
|
| | |
| | | System system = new System(Constant.FANLI);
|
| | | system.setPlatform(1);
|
| | | find.setSystem(system);
|
| | | UserInfo addUser = null;
|
| | | synchronized (UserInfo.class) {
|
| | | addUser = addUser(find, Constant.APPID);
|
| | | if (addUser != null && addUser.getId() > 1) {
|
| | | threeSaleSerivce.bind(find, inviter);
|
| | | return true;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | try {
|
| | | threeSaleSerivce.bind(find, inviter);
|
| | | return true;
|
| | | } catch (ThreeSaleException e) {
|
| | | e.printStackTrace();
|
| | | return false;
|
| | | }
|
| | | }
|
| | |
|
| | | @Transactional
|
| | |
| | | @Override
|
| | | public long getFriendsListCount(long id, int type) {
|
| | | if (type == 1)
|
| | | return userInfoDao
|
| | | .getCountSQL("SELECT COUNT(t.`id`) FROM `yeshi_ec_threesale` t WHERE t.`boss_id`= " + id +" AND (t.expire = 0 OR t.expire IS NULL)");
|
| | | return userInfoDao.getCountSQL("SELECT COUNT(t.`id`) FROM `yeshi_ec_threesale` t WHERE t.`boss_id`= " + id
|
| | | + " AND (t.expire = 0 OR t.expire IS NULL)");
|
| | | else
|
| | | return userInfoDao.getCountSQL(
|
| | | "SELECT COUNT(tt.id) FROM `yeshi_ec_threesale` t LEFT JOIN yeshi_ec_threesale tt ON tt.`boss_id`=t.`worker_id` WHERE t.`boss_id`="
|
| | |
| | | return UserUtil.filterForClientUser(user);
|
| | | }
|
| | |
|
| | |
|
| | | @Override
|
| | | public List<UserInfoAdmin> query(long start, int count, String key, Integer userType, |
| | | Integer days, String startTime, String endTime, Integer orderField,Integer orderMode) {
|
| | | public List<UserInfoAdmin> query(long start, int count, String key, Integer userType, Integer days,
|
| | | String startTime, String endTime, Integer orderField, Integer orderMode) {
|
| | |
|
| | | List<UserInfoAdmin> adminList = new ArrayList<UserInfoAdmin>();
|
| | |
|
| | | List<UserInfo> userList = userInfoMapper.query(start, count, key, userType, days,
|
| | | startTime, endTime, orderField,orderMode);
|
| | | List<UserInfo> userList = userInfoMapper.query(start, count, key, userType, days, startTime, endTime,
|
| | | orderField, orderMode);
|
| | | if (userList == null || userList.size() == 0) {
|
| | | return null;
|
| | | }
|
| | |
| | | if (lastLoginTime == null) {
|
| | | userInfo.setLastLoginTime(0L);
|
| | | }
|
| | | |
| | |
|
| | | userInfoAdmin.setUserInfo(userInfo);
|
| | |
|
| | |
| | | userInfoAdmin.setTbNameState(2);
|
| | | }
|
| | |
|
| | | |
| | |
|
| | | Long uid = userInfo.getId();
|
| | |
|
| | | /* 绑定账号信息 */
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | // 最后一次下单时间
|
| | | Long lastOrderTime = hongBaoService.getLastOrderTime(uid);
|
| | | if (lastOrderTime == null) {
|
| | |
| | | } else {
|
| | | userInfoAdmin.setLastOrderTime(lastOrderTime);
|
| | | }
|
| | | |
| | |
|
| | | // 历史总订单
|
| | | long totalOrder = hongBaoService.countByUidSelf(uid, null, null);
|
| | |
| | | // 历史总收益
|
| | | double totalMoneyHistory = hongBaoService.countReceiveMoneysByUid(uid);
|
| | | userInfoAdmin.setTotalMoneyHistory(totalMoneyHistory);
|
| | | |
| | |
|
| | | // 统计分享个数
|
| | | long countUserShares = userShareGoodsHistoryMapper.countUserShares(uid);
|
| | |
| | |
|
| | | userInfoMapper.updateByPrimaryKeySelective(user);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public List<Long> longTimeNoLogin(int daysNum, List<Long> list ) {
|