| | |
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.lang.reflect.Type;
|
| | | import java.math.BigDecimal;
|
| | | import java.text.SimpleDateFormat;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Calendar;
|
| | |
| | | import com.yeshi.fanli.entity.bus.user.ForbiddenUserIdentifyCode;
|
| | | import com.yeshi.fanli.entity.bus.user.ForbiddenUserIdentifyCode.ForbiddenUserIdentifyCodeTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | | import com.yeshi.fanli.entity.bus.user.UserActiveLog;
|
| | | import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInviteValidNum;
|
| | | import com.yeshi.fanli.entity.bus.user.UserRank;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.TearcherInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserVIPInfo;
|
| | | import com.yeshi.fanli.entity.common.AdminUser;
|
| | | import com.yeshi.fanli.entity.integral.IntegralDetail;
|
| | |
| | | import com.yeshi.fanli.exception.user.ForbiddenUserIdentifyCodeException;
|
| | | import com.yeshi.fanli.exception.user.vip.UserVIPInfoException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.count.HongBaoV2CountService;
|
| | | import com.yeshi.fanli.service.inter.count.UserInfoCountService;
|
| | | import com.yeshi.fanli.service.inter.money.UserMoneyDetailService;
|
| | | import com.yeshi.fanli.service.inter.money.extract.BindingAccountService;
|
| | | import com.yeshi.fanli.service.inter.money.extract.ExtractService;
|
| | | import com.yeshi.fanli.service.inter.order.HongBaoV2Service;
|
| | | import com.yeshi.fanli.service.inter.user.ForbiddenUserIdentifyCodeService;
|
| | | import com.yeshi.fanli.service.inter.user.UserAccountService;
|
| | | import com.yeshi.fanli.service.inter.user.UserActiveLogService;
|
| | |
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.UserRankService;
|
| | | import com.yeshi.fanli.service.inter.user.integral.IntegralDetailService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleDetailService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.user.invite.UserInviteValidNumService;
|
| | | import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.TearcherService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
| | | @Resource
|
| | | private IntegralDetailService integralDetailService;
|
| | |
|
| | |
|
| | | @Resource
|
| | | private UserInviteValidNumService userInviteValidNumService;
|
| | | |
| | | @Resource
|
| | | private ThreeSaleSerivce threeSaleSerivce;
|
| | | |
| | | @Resource
|
| | | private ExtractService extractService;
|
| | | |
| | | @Resource
|
| | | private HongBaoV2Service hongBaoV2Service;
|
| | | |
| | | @Resource
|
| | | private TearcherService tearcherService;
|
| | | |
| | | @Resource
|
| | | private ThreeSaleDetailService threeSaleDetailService;
|
| | | |
| | | @Resource
|
| | | private HongBaoV2CountService hongBaoV2CountService;
|
| | | |
| | |
|
| | | /**
|
| | | * 查询用户信息列表 正常用户/异常用户
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 用户基础信息查询
|
| | | * @param callback
|
| | | * @param pageIndex
|
| | | * @param pageSize
|
| | | * @param key
|
| | | * @param keyType
|
| | | * @param rank
|
| | | * @param userType
|
| | | * @param days
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @param type
|
| | | * @param level
|
| | | * @param activeCode
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "queryInfo")
|
| | | public void queryInfo(String callback, Integer pageIndex, Integer pageSize, String key, Integer keyType, Integer rank,Integer userType,
|
| | | Integer days, String startTime, String endTime, Integer state,String level,
|
| | | Integer activeCode, PrintWriter out) {
|
| | | try {
|
| | | if (pageIndex == null)
|
| | | pageIndex = 1;
|
| | |
|
| | | if (pageSize == null)
|
| | | pageSize = Constant.PAGE_SIZE;
|
| | |
|
| | | String userRank = null;
|
| | | if (rank != null) {
|
| | | switch (rank) {
|
| | | case 1:
|
| | | userRank = "青铜";
|
| | | break;
|
| | | case 2:
|
| | | userRank = "白银";
|
| | | break;
|
| | | case 3:
|
| | | userRank = "黄金";
|
| | | break;
|
| | | case 4:
|
| | | userRank = "铂金";
|
| | | break;
|
| | | default:
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | List<UserInfoVO> userList = userInfoService.queryInfo((pageIndex - 1) * pageSize, pageSize, state, key, keyType,
|
| | | userRank, days, startTime, endTime, userType, level, activeCode);
|
| | |
|
| | | if (userList == null || userList.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无相关数据"));
|
| | | return;
|
| | | }
|
| | |
|
| | | long count = userInfoService.countInfo(state, key, keyType, userRank, days, startTime, endTime,userType, level, activeCode);
|
| | |
|
| | | int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
|
| | | PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
|
| | |
|
| | | GsonBuilder gsonBuilder = new GsonBuilder();
|
| | | gsonBuilder.serializeNulls();
|
| | | Gson gson = gsonBuilder.create();
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("pe", pe);
|
| | | data.put("resultList", gson.toJson(userList));
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 资金统计
|
| | | * @param callback
|
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "statisticsMoney")
|
| | | public void statisticsMoney(String callback, Long uid, PrintWriter out) {
|
| | | try {
|
| | | UserInfo user = userInfoService.getUserByIdWithMybatis(uid);
|
| | | if (user == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("该用户ID不存在"));
|
| | | return;
|
| | | }
|
| | | |
| | | Date minDate = null;
|
| | | Date maxDate = null;
|
| | | long timeStamp = System.currentTimeMillis();
|
| | | Calendar calendar = Calendar.getInstance();
|
| | | calendar.setTimeInMillis(timeStamp);
|
| | | List<UserMoneyDetailTypeEnum> typeList = new ArrayList<>();
|
| | | typeList.add(UserMoneyDetailTypeEnum.extract);
|
| | | typeList.add(UserMoneyDetailTypeEnum.extractNew);
|
| | | typeList.add(UserMoneyDetailTypeEnum.extractVerify);
|
| | | typeList.add(UserMoneyDetailTypeEnum.extractVerifyNew);
|
| | | typeList.add(UserMoneyDetailTypeEnum.extractReject);
|
| | | typeList.add(UserMoneyDetailTypeEnum.extractAutoWX);
|
| | | minDate = new Date(0L);
|
| | | maxDate = new Date(timeStamp);
|
| | | // 累计成功提现
|
| | | BigDecimal totalExtractMoney = userMoneyDetailService.statisticUserTypeMoneyWithDate(uid, typeList, minDate,
|
| | | maxDate, 1).abs();
|
| | | // 提现中金额
|
| | | BigDecimal extractingMoney = extractService.sumVerifyingMoney(uid);
|
| | | |
| | | // 全部未到账
|
| | | minDate = new Date(0);
|
| | | maxDate = new Date(timeStamp);
|
| | | BigDecimal unRecievedMoney = hongBaoV2Service.getUnRecievedMoneyWithCreateTime(uid, minDate, maxDate);
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("totalExtractMoney", totalExtractMoney);
|
| | | data.put("extractingMoney", extractingMoney);
|
| | | data.put("balanceMoney", user.getMyHongBao());
|
| | | data.put("unRecievedMoney", unRecievedMoney);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 权益统计
|
| | | * @param callback
|
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "statisticsGoldCoin")
|
| | | public void statisticsEquity(String callback, Long uid, PrintWriter out) {
|
| | | try {
|
| | | int goldCoin = 0;
|
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | if (userInfoExtra != null) {
|
| | | goldCoin = userInfoExtra.getGoldCoin();
|
| | | }
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("goldCoin", goldCoin);
|
| | | data.put("exchangeGoldCoin",new BigDecimal(integralDetailService.sumUseGoldCoin(uid)).abs());
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 用户粉丝统计
|
| | | * |
| | | * @param callback
|
| | | * @param pageIndex
|
| | | * @param pageSize
|
| | | * @param id
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "countTeamFans")
|
| | | public void countTeamFans(String callback, Long uid, PrintWriter out) {
|
| | | JSONObject data = new JSONObject();
|
| | | |
| | | // 导师
|
| | | String tearcherName = "";
|
| | | TearcherInfo tearcherInfo = tearcherService.selectByUid(uid);
|
| | | if (tearcherInfo != null) {
|
| | | tearcherName = tearcherInfo.getNickName();
|
| | | }
|
| | | data.put("tearcherName", tearcherName); |
| | | |
| | | // 邀请人
|
| | | String bossName = "";
|
| | | UserInfo boss = threeSaleSerivce.getBoss(uid);
|
| | | if (boss != null) {
|
| | | bossName = boss.getNickName();
|
| | | }
|
| | | data.put("bossName", bossName); |
| | | |
| | | // 邀请粉丝
|
| | | int doneFirst = 0;
|
| | | int doneSecond = 0;
|
| | | UserInviteValidNum userInviteValidNum = userInviteValidNumService.selectByPrimaryKey(uid);
|
| | | if (userInviteValidNum != null) {
|
| | | doneFirst = userInviteValidNum.getNumFirst() == null ? 0 : userInviteValidNum.getNumFirst();
|
| | | doneSecond = userInviteValidNum.getNumSecond() == null ? 0 : userInviteValidNum.getNumSecond();
|
| | | }
|
| | | data.put("doneFirst", doneFirst); |
| | | data.put("doneSecond", doneSecond); |
| | | |
| | | // 九代粉丝数量
|
| | | data.put("nineFans", threeSaleDetailService.countByBossUidAndMaxLevel(uid, 9)); |
| | | |
| | | // 有效粉丝
|
| | | data.put("first", threeSaleSerivce.countFirstTeam(uid)); |
| | | data.put("second", threeSaleSerivce.countSecondTeam(uid)); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | }
|
| | | |
| | | |
| | | |
| | | /**
|
| | | * 用户详细信息
|
| | | * @param callback
|
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getInfoDetail")
|
| | | public void getInfoDetail(String callback, Long uid, PrintWriter out) {
|
| | | JSONObject data = new JSONObject();
|
| | | UserInfo user = userInfoService.getUserByIdWithMybatis(uid);
|
| | | data.put("phone", user.getPhone()); |
| | | data.put("state", user.getState()); |
| | | data.put("createtime", user.getCreatetime()); |
| | | |
| | | |
| | | String mark = "";
|
| | | String activation = "未激活";
|
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | if (userInfoExtra != null) {
|
| | | if (!StringUtil.isNullOrEmpty(userInfoExtra.getMark())) {
|
| | | mark = userInfoExtra.getMark();
|
| | | }
|
| | | |
| | | String inviteCode = userInfoExtra.getInviteCode();
|
| | | if (!StringUtil.isNullOrEmpty(inviteCode)) {
|
| | | activation = "已激活";
|
| | | } else {
|
| | | activation = "未激活";
|
| | | }
|
| | | }
|
| | | data.put("mark", mark); |
| | | data.put("activation", activation); |
| | | |
| | | // 最近一次下单时间
|
| | | String orderTime = "";
|
| | | Date lastOrderTime = hongBaoV2CountService.getLastHongBaoTime(uid);
|
| | | if (lastOrderTime != null) {
|
| | | orderTime = TimeUtil.formatDate(lastOrderTime);
|
| | | }
|
| | | data.put("orderTime", orderTime); |
| | | |
| | | |
| | | // 最近登录时间
|
| | | String activeTime = "";
|
| | | UserActiveLog userActiveLog = userActiveLogService.getUserLatestActiveInfo(uid);
|
| | | if (userActiveLog != null) {
|
| | | activeTime = TimeUtil.formatDate(userActiveLog.getCreateTime());
|
| | | }
|
| | | data.put("activeTime", activeTime); |
| | | // |
| | | // // 显示用户微信 淘宝 老版本存在
|
| | | // String wxUnionId = userInfoVO.getWxUnionId();
|
| | | // if (wxUnionId == null || wxUnionId.trim().length() == 0) {
|
| | | // userInfoVO.setWxName(null);
|
| | | // }
|
| | | //
|
| | | // // 是否绑定支付宝(购买 + 分享权限)
|
| | | // String taoBaoUid = userInfoVO.getTaoBaoUid();
|
| | | // String tbSpecialId = userInfoVO.getTbSpecialId();
|
| | | // String tbRelationId = userInfoVO.getTbRelationId();
|
| | | // if (StringUtil.isNullOrEmpty(taoBaoUid) || StringUtil.isNullOrEmpty(tbSpecialId)
|
| | | // || StringUtil.isNullOrEmpty(tbRelationId)) {
|
| | | // userInfoVO.setTbName(null);
|
| | | // userInfoVO.setTaoBaoUid(null);
|
| | | // }
|
| | | //
|
| | | // Long uid = userInfoVO.getId();
|
| | | // /* 绑定收款账号信息 */
|
| | | // List<BindingAccount> account = bindingAccountMapper.selectByUid(uid);
|
| | | // if (account != null && account.size() > 0) {
|
| | | // BindingAccount bindingAccount = account.get(0);
|
| | | // Integer type = bindingAccount.getType();
|
| | | // if (type != null && type == 1) {
|
| | | // // 支付宝
|
| | | // userInfoVO.setAccountAlipay(bindingAccount.getAccount());
|
| | | // userInfoVO.setAccountName(bindingAccount.getName());
|
| | | // userInfoVO.setAccountBindId(bindingAccount.getId());
|
| | | //
|
| | | // } else if (type != null && type == 2) {
|
| | | // // 微信
|
| | | // userInfoVO.setAccountWX(bindingAccount.getAccount());
|
| | | // userInfoVO.setAccountNameWX(bindingAccount.getName());
|
| | | // userInfoVO.setAccountBindIdWX(bindingAccount.getId());
|
| | | // }
|
| | | // }
|
| | | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 统计今日用户总情况
|
| | | *
|
| | |
| | | continue;
|
| | | }
|
| | |
|
| | | |
| | | UserInfo user = userInfoService.selectByPKey(userInfo.getId());
|
| | | if (user != null) {
|
| | | detail.setUserInfo(user);
|
| | |
| | | }
|
| | |
|
| | | long count = userMoneyDetailService.countQuery(key, keyType);
|
| | |
|
| | | int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
|
| | | PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
|
| | |
|
| | |
|
| | | GsonBuilder gsonBuilder = new GsonBuilder().setDateFormat("yyyy-MM-dd HH:mm:ss");
|
| | | gsonBuilder.registerTypeAdapter(UserMoneyDetailTypeEnum.class, new JsonSerializer<UserMoneyDetailTypeEnum>() {
|
| | |
| | | }
|
| | | });
|
| | | Gson gson = gsonBuilder.create();
|
| | | |
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("pe", pe);
|
| | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("查询失败"));
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | |
| | | |
| | |
|
| | | |
| | | }
|