| | |
| | | import com.google.gson.JsonSerializationContext;
|
| | | import com.google.gson.JsonSerializer;
|
| | | import com.yeshi.fanli.dto.HongBaoDTO;
|
| | | import com.yeshi.fanli.entity.AppVersionInfo;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.user.AccountDetails;
|
| | | import com.yeshi.fanli.entity.bus.user.AccountMessage;
|
| | |
| | | import com.yeshi.fanli.exception.user.UserInfoExtraException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.AdminUserService;
|
| | | import com.yeshi.fanli.service.inter.config.AppVersionService;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.config.SystemService;
|
| | | import com.yeshi.fanli.service.inter.goods.CollectionGoodsV2Service;
|
| | |
| | |
|
| | | @Resource
|
| | | private UserShareGoodsRecordService userShareGoodsRecordService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private UserCustomSettingsService userCustomSettingsService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private UserInfoExtraService userInfoExtraService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private AppVersionService appVersionService;
|
| | |
|
| | | private static final String PASSWORD_MAX_ERROR = "password_max_error";
|
| | | private static final String EXTRACT_MIN_MONEY = "extract_min_money";
|
| | |
| | | BigDecimal fanliHB = user.getTotalHongBao();
|
| | | user.setTotalHongBao(fanliHB);
|
| | |
|
| | | UserInfo filterForClientUser = UserUtil.filterForClientUser(user);
|
| | |
|
| | | // 1.5.0 版本之后返回新的等级
|
| | | String version = acceptData.getVersion();
|
| | | if (version != null && version.trim().length() > 0) {
|
| | | int versionCode = Integer.parseInt(version);
|
| | | String platform = acceptData.getPlatform();
|
| | |
|
| | | AppVersionInfo versionInfo = appVersionService.getByPlatformAndVersion(platform, "1.5.0");
|
| | | if (versionInfo != null) {
|
| | | int versionCode150 = versionInfo.getVersionCode();
|
| | | if (versionCode >= versionCode150) {
|
| | | UserInfoExtraVO userInfoExtra = userInfoExtraService.getInfoExtraVOByUid(user.getId());
|
| | | if (userInfoExtra != null && userInfoExtra.getUserRank() != null) {
|
| | | String picture = userInfoExtra.getUserRank().getPicture();
|
| | | String icon = userInfoExtra.getUserRank().getIcon();
|
| | | filterForClientUser.setRankNamePicture(picture);
|
| | | filterForClientUser.setRankIcon(icon);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | GsonBuilder gsonBuilder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation();
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("user", JsonUtil.getConvertBigDecimalToStringBuilder(gsonBuilder).create()
|
| | | .toJson(UserUtil.filterForClientUser(user)));
|
| | | data.put("user",
|
| | | JsonUtil.getConvertBigDecimalToStringBuilder(gsonBuilder).create().toJson(filterForClientUser));
|
| | | data.put("first", 0);
|
| | | int spreadImgCount = spreadUserImgService.countUserSpreadImg(user.getId());
|
| | | long shareCount = userShareGoodsRecordService.countShareRecordByUid(user.getId());
|
| | | |
| | |
|
| | | int showTiCheng = 1; // 不显示
|
| | | if ("ios".equalsIgnoreCase(acceptData.getPlatform())
|
| | | && configService.iosOnLining(Integer.parseInt(acceptData.getVersion())))
|
| | |
| | | Constant.systemCommonConfig.getProjectHost(), Constant.systemCommonConfig.getProjectName()));
|
| | | else
|
| | | data.put("inviteList", configService.get("team_list"));
|
| | | |
| | |
|
| | | // 界面状态
|
| | | UserSettingsVO mySettings = null; |
| | | UserSettingsVO mySettings = null;
|
| | | try {
|
| | | mySettings = userCustomSettingsService.getMySettings(user.getId());
|
| | | } catch (UserCustomSettingsException e) {
|
| | | mySettings = new UserSettingsVO();
|
| | | e.printStackTrace();
|
| | | }
|
| | | |
| | |
|
| | | if (mySettings.getCancelNotice() == null) {
|
| | | mySettings.setCancelNotice(0);
|
| | | }
|
| | |
| | | if (mySettings.getNoInvitationBonus() == null) {
|
| | | mySettings.setNoInvitationBonus(0);
|
| | | }
|
| | | |
| | |
|
| | | data.put("moduleState", mySettings);
|
| | | |
| | |
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | final UserInfo uuser = user;
|
| | | ThreadUtil.run(new Runnable() {
|
| | |
| | | uuser.setLastLoginTime(java.lang.System.currentTimeMillis());
|
| | | userInfoService.updateLoginInfo(uuser);
|
| | | wxDownService.save(device);
|
| | | // 更新用户附加信息,老用户不存在的需要添加
|
| | | try {
|
| | | userInfoExtraService.updateUserRankByUid(uuser.getId());
|
| | | } catch (UserInfoExtraException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | | });
|
| | | }
|
| | |
| | | */
|
| | | @RequestMapping(value = "countMyTeam", method = RequestMethod.POST)
|
| | | public void countMyTeam(AcceptData acceptData, long uid, PrintWriter out) {
|
| | | try {
|
| | | long firstTeam = threeSaleSerivce.countFirstTeam(uid, 1);
|
| | | long firstTeamTotal = threeSaleSerivce.countFirstTeam(uid, null);
|
| | |
|
| | | long firstTeam = threeSaleSerivce.countFirstTeam(uid, 1);
|
| | | long firstTeamTotal = threeSaleSerivce.countFirstTeam(uid, null);
|
| | | long secondTeam = threeSaleSerivce.countSecondTeam(uid, 1);
|
| | | long secondTeamTotal = threeSaleSerivce.countSecondTeam(uid, null);
|
| | | JSONObject bossData = new JSONObject();
|
| | | ThreeSale threeSale = threeSaleSerivce.getMyBoss(uid);
|
| | | if (threeSale != null) {
|
| | | UserInfo boss = threeSale.getBoss();
|
| | | if (boss != null) {
|
| | | bossData.put("nickName", boss.getNickName());
|
| | | bossData.put("portrait", boss.getPortrait());
|
| | | }
|
| | |
|
| | | long secondTeam = threeSaleSerivce.countSecondTeam(uid, 1);
|
| | | long secondTeamTotal = threeSaleSerivce.countSecondTeam(uid, null);
|
| | | JSONObject bossData = new JSONObject();
|
| | | ThreeSale threeSale = threeSaleSerivce.getMyBoss(uid);
|
| | | if (threeSale != null) {
|
| | | UserInfo boss = threeSale.getBoss();
|
| | | if (boss != null) {
|
| | | bossData.put("nickName", boss.getNickName());
|
| | | bossData.put("portrait", boss.getPortrait());
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
|
| | | Long createTime = threeSale.getCreateTime();
|
| | | Date inviteTime = new Date(createTime);
|
| | | bossData.put("inviteTime", "邀请时间: " + sdf.format(inviteTime));
|
| | | }
|
| | |
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
|
| | | Long createTime = threeSale.getCreateTime();
|
| | | Date inviteTime = new Date(createTime);
|
| | | bossData.put("inviteTime", "邀请时间: " + sdf.format(inviteTime));
|
| | | JSONObject resultData = new JSONObject();
|
| | |
|
| | | String helpLink = configService.get("team_help_url");
|
| | | if (helpLink == null) {
|
| | | helpLink = "";
|
| | | }
|
| | | resultData.put("helpLink", helpLink);
|
| | | resultData.put("firstTeam", firstTeam);
|
| | | resultData.put("firstTeamTotal", firstTeamTotal);
|
| | | resultData.put("secondTeam", secondTeam);
|
| | | resultData.put("secondTeamTotal", secondTeamTotal);
|
| | | resultData.put("boss", bossData);
|
| | | |
| | | |
| | | boolean hasCode = false;
|
| | | String inviteCode = userInfoExtraService.getUserInviteCode(uid);
|
| | | if (inviteCode != null && inviteCode.trim().length() > 0) {
|
| | | hasCode = true; // 已有邀请码
|
| | | } else {
|
| | | // 邀请激活链接
|
| | | resultData.put("activationlink", configService.get("invite_activation_url"));
|
| | | }
|
| | | resultData.put("hasCode", hasCode);
|
| | |
|
| | | out.print(JsonUtil.loadTrueResult(resultData));
|
| | | |
| | | } catch (UserInfoExtraException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getMsg()));
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadFalseResult("统计失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | JSONObject resultData = new JSONObject();
|
| | |
|
| | | String helpLink = configService.get("team_help_url");
|
| | | if (helpLink == null) {
|
| | | helpLink = "";
|
| | | }
|
| | | resultData.put("helpLink", helpLink);
|
| | | resultData.put("firstTeam", firstTeam);
|
| | | resultData.put("firstTeamTotal", firstTeamTotal);
|
| | | resultData.put("secondTeam", secondTeam);
|
| | | resultData.put("secondTeamTotal", secondTeamTotal);
|
| | | resultData.put("boss", bossData);
|
| | |
|
| | | out.print(JsonUtil.loadTrueResult(resultData));
|
| | | |
| | | }
|
| | |
|
| | | /**
|
| | |
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 设置界面开关状态
|
| | | * 设置界面开关状态
|
| | | * |
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param params
|
| | |
| | | out.print(JsonUtil.loadFalseResult("用户未登录"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | try {
|
| | | if (params == null || params.trim().length() == 0) {
|
| | | out.print(JsonUtil.loadFalseResult("传递参数为空"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | JSONObject json = JSONObject.fromObject(params);
|
| | | Iterator<String> iterator = json.keys();
|
| | | while(iterator.hasNext()){
|
| | | String type = (String) iterator.next();
|
| | | int state = json.getInt(type);
|
| | | userCustomSettingsService.saveModuleState(uid, type, state);
|
| | | Iterator<String> iterator = json.keys();
|
| | | while (iterator.hasNext()) {
|
| | | String type = (String) iterator.next();
|
| | | int state = json.getInt(type);
|
| | | userCustomSettingsService.saveModuleState(uid, type, state);
|
| | | }
|
| | | out.print(JsonUtil.loadTrueResult("设置成功"));
|
| | | |
| | |
|
| | | } catch (UserCustomSettingsException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getMsg()));
|
| | | } catch (Exception e) {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 获取等级信息
|
| | | * 获取等级信息
|
| | | * |
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param out
|
| | |
| | | out.print(JsonUtil.loadFalseResult("用户未登录"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | try {
|
| | | |
| | | UserInfoExtraVO rankInfo = userInfoExtraService.getRankInfo(uid);
|
| | | |
| | | GsonBuilder gsonBuilder = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder());
|
| | | gsonBuilder.excludeFieldsWithoutExposeAnnotation();
|
| | | Gson gson = gsonBuilder.setDateFormat("yyyy.MM.dd").create();
|
| | | |
| | |
|
| | | JSONObject resultData = new JSONObject();
|
| | | resultData.put("rankInfo", gson.toJson(rankInfo));
|
| | | |
| | |
|
| | | out.print(JsonUtil.loadTrueResult(resultData));
|
| | | |
| | |
|
| | | } catch (UserInfoExtraException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getMsg()));
|
| | | } catch (Exception e) {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 获取等级信息
|
| | | * 获取等级信息
|
| | | * |
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param out
|
| | |
| | | out.print(JsonUtil.loadFalseResult("用户未登录"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | try {
|
| | | |
| | |
|
| | | String inviteCode = userInfoExtraService.getUserInviteCode(uid);
|
| | | |
| | |
|
| | | JSONObject inviteData = new JSONObject();
|
| | | if (inviteCode == null || inviteCode.trim().length() == 0) {
|
| | | // 无邀请码
|
| | |
| | | inviteData.put("content", "邀请码");
|
| | | inviteData.put("link", configService.get("invite_activation_success_url"));
|
| | | }
|
| | | |
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("invite", inviteData);
|
| | | |
| | |
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | |
| | |
|
| | | } catch (UserInfoExtraException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getMsg()));
|
| | | } catch (Exception e) {
|