| | |
| | | package com.yeshi.fanli.controller.client;
|
| | |
|
| | | import java.io.IOException;
|
| | | import java.io.PrintWriter;
|
| | | import java.io.UnsupportedEncodingException;
|
| | | import java.lang.reflect.InvocationTargetException;
|
| | | import java.lang.reflect.Type;
|
| | | import java.math.BigDecimal;
|
| | | import java.net.URLEncoder;
|
| | | import java.text.SimpleDateFormat;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Arrays;
|
| | | import java.util.Date;
|
| | | import java.util.Iterator;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | | import java.util.UUID;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RequestMethod;
|
| | | import org.springframework.web.multipart.MultipartFile;
|
| | | import org.yeshi.utils.HttpUtil;
|
| | | import org.yeshi.utils.IPUtil;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | | import org.yeshi.utils.NumberUtil;
|
| | | import org.yeshi.utils.taobao.TbImgUtil;
|
| | | import org.yeshi.utils.tencentcloud.COSManager;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | |
| | | import com.google.gson.JsonPrimitive;
|
| | | import com.google.gson.JsonSerializationContext;
|
| | | import com.google.gson.JsonSerializer;
|
| | | import com.yeshi.fanli.dto.HongBao;
|
| | | import com.yeshi.fanli.dto.HongBaoDTO;
|
| | | import com.yeshi.fanli.dto.money.AccountDetails;
|
| | | import com.yeshi.fanli.dto.order.OrderItem;
|
| | | 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.entity.bus.user.BindingAccount;
|
| | | import com.yeshi.fanli.entity.bus.user.Extract;
|
| | | import com.yeshi.fanli.entity.bus.user.ExtractRecord;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBao;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoExtra;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoMessage;
|
| | | import com.yeshi.fanli.entity.bus.user.LostOrder;
|
| | | import com.yeshi.fanli.entity.bus.user.MoneyRecord;
|
| | | import com.yeshi.fanli.entity.bus.user.OrderItem;
|
| | | import com.yeshi.fanli.entity.bus.user.PassWordErrorRecord;
|
| | | import com.yeshi.fanli.entity.bus.user.SMSHistory;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSaleExtraInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserActiveLog;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
|
| | | import com.yeshi.fanli.entity.bus.user.WeiXinUser;
|
| | | import com.yeshi.fanli.entity.system.System;
|
| | | import com.yeshi.fanli.entity.common.AdminUser;
|
| | | import com.yeshi.fanli.entity.common.Config;
|
| | | import com.yeshi.fanli.entity.goods.CollectionGoodsV2;
|
| | | import com.yeshi.fanli.entity.goods.CommonGoods;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail;
|
| | | import com.yeshi.fanli.entity.order.HongBaoOrder;
|
| | | import com.yeshi.fanli.entity.system.BusinessSystem;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBriefExtra;
|
| | | import com.yeshi.fanli.exception.BindingAccountException;
|
| | | import com.yeshi.fanli.exception.ObjectStateException;
|
| | | import com.yeshi.fanli.exception.goods.CollectionGoodsException;
|
| | | import com.yeshi.fanli.exception.taobao.TaoKeApiException;
|
| | | import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
|
| | | import com.yeshi.fanli.goods.CollectionGoodsV2;
|
| | | import com.yeshi.fanli.exception.user.UserCustomSettingsException;
|
| | | import com.yeshi.fanli.exception.user.UserInfoException;
|
| | | 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.BusinessSystemService;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.config.SystemService;
|
| | | import com.yeshi.fanli.service.inter.count.HongBaoV2CountService;
|
| | | import com.yeshi.fanli.service.inter.goods.CollectionGoodsV2Service;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoMessageService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoV2Service;
|
| | | import com.yeshi.fanli.service.inter.hongbao.ThreeSaleExtraInfoSerivce;
|
| | | import com.yeshi.fanli.service.inter.hongbao.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.order.HongBaoOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.LostOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderItemServcie;
|
| | | import com.yeshi.fanli.service.inter.order.OrderService;
|
| | | import com.yeshi.fanli.service.inter.user.AccountDetailsService;
|
| | | import com.yeshi.fanli.service.inter.user.AccountMessageService;
|
| | | import com.yeshi.fanli.service.inter.user.BindingAccountService;
|
| | | import com.yeshi.fanli.service.inter.user.ExtractRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.ExtractService;
|
| | | import com.yeshi.fanli.service.inter.user.MoneyRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.PassWordErrorRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.MaskKeyService;
|
| | | import com.yeshi.fanli.service.inter.user.ShamUserService;
|
| | | import com.yeshi.fanli.service.inter.user.SpreadUserImgService;
|
| | | import com.yeshi.fanli.service.inter.user.UserAccountService;
|
| | | import com.yeshi.fanli.service.inter.user.UserActiveLogService;
|
| | | import com.yeshi.fanli.service.inter.user.UserCustomSettingsService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.WxDownService;
|
| | | import com.yeshi.fanli.service.inter.user.UserMoneyDetailService;
|
| | | import com.yeshi.fanli.service.inter.user.UserShareGoodsRecordService;
|
| | | import com.yeshi.fanli.util.AESUtil;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.GsonUtil;
|
| | | import com.yeshi.fanli.util.HongBaoUtil;
|
| | |
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.Utils;
|
| | | import com.yeshi.fanli.util.account.UserUtil;
|
| | | import com.yeshi.fanli.util.email.MailSenderUtil;
|
| | | import com.yeshi.fanli.util.factory.AccountDetailsFactory;
|
| | | import com.yeshi.fanli.util.factory.HongBaoFactory;
|
| | | import com.yeshi.fanli.util.factory.OrderItemFactory;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | | import com.yeshi.fanli.util.wx.WXLoginUtil;
|
| | | import com.yeshi.fanli.vo.user.UserInfoExtraVO;
|
| | | import com.yeshi.fanli.vo.user.UserSettingsVO;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
| | | private OrderService orderService;
|
| | |
|
| | | @Resource
|
| | | private HongBaoService hongBaoService;
|
| | |
|
| | | @Resource
|
| | | private MoneyRecordService moneyRecordService;
|
| | |
|
| | | @Resource
|
| | | private BindingAccountService bindingAccountService;
|
| | |
|
| | | @Resource
|
| | | private ExtractService extractService;
|
| | |
|
| | | @Resource
|
| | | private PassWordErrorRecordService passWordErrorRecordService;
|
| | |
|
| | | @Resource
|
| | | private ConfigService configService;
|
| | |
|
| | | @Resource
|
| | | private SystemService systemService;
|
| | |
|
| | | @Resource
|
| | | private HongBaoMessageService hongBaoMessageService;
|
| | | private BusinessSystemService businessSystemService;
|
| | |
|
| | | @Resource
|
| | | private ShamUserService shamUserService;
|
| | |
| | | private LostOrderService lostOrderService;
|
| | |
|
| | | @Resource
|
| | | private OrderItemServcie orderItemServcie;
|
| | |
|
| | | @Resource
|
| | | private AccountDetailsService accountDetailsService;
|
| | |
|
| | | @Resource
|
| | | private AccountMessageService accountMessageService;
|
| | |
|
| | | @Resource
|
| | | private HongBaoManageService hongBaoManageService;
|
| | |
|
| | | @Resource
|
| | | private WxDownService wxDownService;
|
| | |
|
| | | @Resource
|
| | | private UserAccountService loginService;
|
| | |
| | |
|
| | | @Resource
|
| | | private CollectionGoodsV2Service collectionGoodsV2Service;
|
| | |
|
| | | @Resource
|
| | | private AdminUserService adminUserService;
|
| | |
|
| | | @Resource
|
| | | private UserMoneyDetailService userMoneyDetailService;
|
| | |
|
| | | @Resource
|
| | | private HongBaoOrderService hongBaoOrderService;
|
| | |
|
| | | @Resource
|
| | | private HongBaoV2Service hongBaoV2Service;
|
| | |
|
| | | @Resource
|
| | | private SpreadUserImgService spreadUserImgService;
|
| | |
|
| | | @Resource
|
| | | private UserShareGoodsRecordService userShareGoodsRecordService;
|
| | |
|
| | | @Resource
|
| | | private UserCustomSettingsService userCustomSettingsService;
|
| | |
|
| | | @Resource
|
| | | private UserInfoExtraService userInfoExtraService;
|
| | |
|
| | | @Resource
|
| | | private AppVersionService appVersionService;
|
| | |
|
| | | @Resource
|
| | | private HongBaoV2CountService hongBaoV2CountService;
|
| | |
|
| | | @Resource
|
| | | private AccountMessageService accountMessageService;
|
| | | |
| | | @Resource
|
| | | private MaskKeyService maskKeyService;
|
| | | |
| | |
|
| | | private static final String PASSWORD_MAX_ERROR = "password_max_error";
|
| | | private static final String EXTRACT_MIN_MONEY = "extract_min_money";
|
| | |
| | | // }
|
| | | // });
|
| | | if (find != null) {
|
| | | if (find.getState() != UserInfo.STATE_NORMAL) {
|
| | | out.print(JsonUtil.loadFalseResult(Constant.CODE_FORBIDDEN_USER,
|
| | | Constant.FORBIDDEN_USER_REASON_DESC));
|
| | | return;
|
| | | }
|
| | |
|
| | | // 邀请关系生效
|
| | | threeSaleSerivce.effective(find);
|
| | | // 重新计算用户等级
|
| | | threeSaleSerivce.reComputeUserRank(id);
|
| | |
|
| | | // 添加用户活跃记录
|
| | | UserActiveLog userActiveLog = new UserActiveLog();
|
| | |
| | | }
|
| | | }
|
| | | // 不是用ID的登陆的事就多了
|
| | | System system = systemService.getSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
|
| | | acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult("系统不存在"));
|
| | | return;
|
| | |
| | | }
|
| | | }
|
| | | // 不是用ID的登陆的事就多了
|
| | | System system = systemService.getSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
|
| | | acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult("系统不存在"));
|
| | | return;
|
| | |
| | | }
|
| | |
|
| | | private void outUserInfo(AcceptData acceptData, PrintWriter out, String remotIP, UserInfo user, String device) {
|
| | | BigDecimal MyTotalMoney = hongBaoService.getMyTotalHongBaoByUid(user.getId());
|
| | | user.setTotalHongBao(MyTotalMoney);
|
| | | BigDecimal unOpenmoney = hongBaoService.getUnOpenHongBaoByUid(user.getId());
|
| | | BigDecimal canOpenMoney = hongBaoService.getCanOpenHongBaoByUid(user.getId());
|
| | | user.setTotalHongBao(new BigDecimal(0));
|
| | | BigDecimal unOpenmoney = new BigDecimal(0);
|
| | | BigDecimal canOpenMoney = new BigDecimal(0);
|
| | | user.setNoOpenHongBao(unOpenmoney);
|
| | | user.setCanOpenHongBao(canOpenMoney);
|
| | |
|
| | |
| | | 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())))
|
| | | data.put("showTiCheng", false);
|
| | | else {
|
| | | data.put("showTiCheng", spreadImgCount + shareCount > 0);
|
| | | if (spreadImgCount + shareCount > 0) {
|
| | | showTiCheng = 0;
|
| | | }
|
| | | }
|
| | |
|
| | | if ("ios".equalsIgnoreCase(acceptData.getPlatform())
|
| | | && configService.iosOnLining(Integer.parseInt(acceptData.getVersion())))
|
| | | data.put("inviteList", String.format("http://%s/%s/client/share/friends_new_online.html",
|
| | | Constant.systemCommonConfig.getProjectHost(), Constant.systemCommonConfig.getProjectName()));
|
| | | else
|
| | | data.put("inviteList", configService.get("team_list"));
|
| | |
|
| | | // 界面状态
|
| | | 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.getNoBonusCount() == null) {
|
| | | mySettings.setNoBonusCount(showTiCheng); // 根据showTiCheng来判断
|
| | | }
|
| | | if (mySettings.getNoNewsRedDot() == null) {
|
| | | mySettings.setNoNewsRedDot(0);
|
| | | }
|
| | | if (mySettings.getNoShareRecordAndStorage() == null) {
|
| | | mySettings.setNoShareRecordAndStorage(showTiCheng); // 根据showTiCheng来判断
|
| | | }
|
| | | if (mySettings.getNoInvitationBonus() == null) {
|
| | | mySettings.setNoInvitationBonus(0);
|
| | | }
|
| | |
|
| | | data.put("moduleState", mySettings);
|
| | |
|
| | | int welfareCenterNews = 0;
|
| | | String invitCode = null;
|
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(user.getId());
|
| | | if (userInfoExtra != null) {
|
| | | if (userInfoExtra.getCouponNews() != null) {
|
| | | welfareCenterNews = userInfoExtra.getCouponNews();
|
| | | }
|
| | |
|
| | | if (userInfoExtra.getInviteCode() != null && userInfoExtra.getInviteCode().trim().length() > 0) {
|
| | | invitCode = userInfoExtra.getInviteCode();
|
| | | }
|
| | | }
|
| | | // 邀请码
|
| | | data.put("invitCode", invitCode);
|
| | | // 福利中心消息
|
| | | data.put("welfareCenterNews", welfareCenterNews);
|
| | |
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | |
|
| | | final UserInfo uuser = user;
|
| | | ThreadUtil.run(new Runnable() {
|
| | | public void run() {
|
| | |
|
| | | try {
|
| | | // 获取邀请码:若无邀请码且存在有效的队员关系 则自动生成邀请码
|
| | | userInfoExtraService.getUserInviteCode(uuser.getId());
|
| | | } catch (UserInfoExtraException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | LogHelper.userInfo(GsonUtil.toJsonExpose(uuser));
|
| | | uuser.setLastLoginIp(remotIP);
|
| | | uuser.setLastLoginTime(java.lang.System.currentTimeMillis());
|
| | | userInfoService.updateLoginInfo(uuser);
|
| | | wxDownService.save(device);
|
| | | // 更新用户附加信息,老用户不存在的需要添加
|
| | | try {
|
| | | userInfoExtraService.updateUserRankByUid(uuser.getId());
|
| | | } catch (UserInfoExtraException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | | });
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | /**
|
| | | * 获取提现记录
|
| | | * |
| | | * @param acceptData
|
| | | * @param uid
|
| | | * 用户id
|
| | | * @param page
|
| | | * 页数(从0开始)
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getmoneyrecord", method = RequestMethod.POST)
|
| | | public void getMoneyRecord(AcceptData acceptData, long uid, int page, PrintWriter out) {
|
| | | UserInfo user = userInfoService.getUserById(uid);
|
| | | if (user == null) {
|
| | | out.print(JsonUtil.loadFalseResult("用户不存在"));
|
| | | return;
|
| | | }
|
| | | if (page < 0) {
|
| | | page = 0;
|
| | | }
|
| | |
|
| | | List<MoneyRecord> moneyRecordList = moneyRecordService.getMoneyRecord(uid, page);
|
| | | int count = moneyRecordService.getCount(uid);
|
| | | JSONObject data = new JSONObject();
|
| | | if (moneyRecordList == null || moneyRecordList.size() == 0) {
|
| | | data.put("count", 0);
|
| | | data.put("moneyRecordList", new ArrayList());
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | return;
|
| | | }
|
| | | data.put("count", count);
|
| | | Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
|
| | | data.put("moneyRecordList", gson.toJson(moneyRecordList));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取当前用户红包
|
| | | * |
| | | * @param acceptData
|
| | | * @param uid
|
| | | * 用户id
|
| | | * @param out
|
| | | * @throws ObjectStateException
|
| | | */
|
| | | @RequestMapping(value = "gethongbao", method = RequestMethod.POST)
|
| | | public void getHongBao(AcceptData acceptData, long uid, PrintWriter out) {
|
| | | UserInfo user = userInfoService.getUserById(uid);
|
| | | JSONObject data = new JSONObject();
|
| | | if (user == null) {
|
| | | data.put("count", 0);
|
| | | data.put("hongBaoList", new ArrayList());
|
| | | data.put("error", "用户不存在");
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | return;
|
| | | }
|
| | | List<HongBaoExtra> hongBaoList = hongBaoService.getHongBao(uid);
|
| | |
|
| | | if (hongBaoList.size() == 0) {
|
| | | data.put("count", 0);
|
| | | data.put("hongBaoList", hongBaoList);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | return;
|
| | | }
|
| | | data.put("count", hongBaoList.size());
|
| | | data.put("hongBaoList", GsonUtil.toJsonExpose(hongBaoList));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | return;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 设置提现密码
|
| | | * |
| | | * @param acceptData
|
| | | * @param payPassword
|
| | | * 提现密码(要经过md5加密)
|
| | | * @param uid
|
| | | * 用户id
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "setpaypassword", method = RequestMethod.POST)
|
| | | public void setPayPassword(AcceptData acceptData, String payPassword, long uid, PrintWriter out) {
|
| | | UserInfo user = userInfoService.getUserById(uid);
|
| | | if (user == null) {
|
| | | out.print(JsonUtil.loadFalseResult("用户不存在"));
|
| | | return;
|
| | | }
|
| | | user.setPayPassword(payPassword);
|
| | | userInfoService.update(user);
|
| | | out.print(JsonUtil.loadTrueResult("设置成功"));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取用户提现账号
|
| | | *
|
| | | * @param acceptData
|
| | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("user", user);
|
| | | Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
|
| | | String maxError = "5";
|
| | | maxError = configService.get(PASSWORD_MAX_ERROR); // 当日输错密码最多次数
|
| | | PassWordErrorRecord record = passWordErrorRecordService.getRecord(uid);
|
| | | int max = Integer.parseInt(maxError);
|
| | | if (record.getCount() >= max) {
|
| | | data.put("error", "1"); // 达到最多限制
|
| | | } else {
|
| | | data.put("error", "0");
|
| | | }
|
| | | data.put("maxError", maxError);
|
| | |
|
| | | data.put("error", "0");
|
| | | data.put("maxError", 1);
|
| | | String minMoney = configService.get(EXTRACT_MIN_MONEY); // 单笔提现的最小金额
|
| | | String maxMoney = configService.get(EXTRACT_MAX_MONEY); // 单笔提现的最大金额
|
| | | int maxDayCount = Integer.parseInt(configService.get("extract_count_day"));
|
| | |
| | | }
|
| | |
|
| | | String minMoney = configService.get(EXTRACT_MIN_MONEY); // 单笔提现的最小金额
|
| | | String maxMoney = configService.get(EXTRACT_MAX_MONEY); // 单笔提现的最大金额
|
| | | String maxDayMoney = configService.get("extract_money_day"); // 每日最大提现金额
|
| | | int maxDayCount = Integer.parseInt(configService.get("extract_count_day"));
|
| | | ExtractRecord extractRecord = extractRecordService.getExtractRecordByUid(uid);
|
| | | boolean canExtract = true;
|
| | | String errorMsg = "";
|
| | | if (extractRecord != null && extractRecord.getCount() + 1 >= maxDayCount) {
|
| | | if (extractRecord != null && extractRecord.getCount() + 1 > maxDayCount) {
|
| | | canExtract = false;
|
| | | errorMsg = String.format("每日最多提现%s次", maxDayCount + "");
|
| | | } else if (extractRecord != null
|
| | | && extractRecord.getMoney().add(money).compareTo(new BigDecimal(maxMoney)) > 0) {
|
| | | && extractRecord.getMoney().add(money).compareTo(new BigDecimal(maxDayMoney)) > 0) {
|
| | | canExtract = false;
|
| | | errorMsg = String.format("每日最多提现%s元", maxMoney);
|
| | | errorMsg = String.format("每日最多提现%s元", maxDayMoney);
|
| | | } else if (new BigDecimal(minMoney).compareTo(money) > 0) {
|
| | | canExtract = false;
|
| | | errorMsg = String.format("每次最低提现%s元", minMoney);
|
| | |
| | | }
|
| | |
|
| | | /**
|
| | | * 客户端提现密码输入错误时调用
|
| | | * |
| | | * @param acceptData
|
| | | * @param uid
|
| | | * 用户id
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "errormax", method = RequestMethod.POST)
|
| | | public void errorMax(AcceptData acceptData, long uid, PrintWriter out) {
|
| | | UserInfo user = userInfoService.getUserById(uid);
|
| | | if (user == null) {
|
| | | out.print(JsonUtil.loadFalseResult("用户不存在"));
|
| | | return;
|
| | | }
|
| | | PassWordErrorRecord record = passWordErrorRecordService.getRecord(user.getId());
|
| | | record.setUserInfo(user);
|
| | | String maxErrorStr = "5";
|
| | | maxErrorStr = configService.get(PASSWORD_MAX_ERROR); // 当日输错密码最多次数
|
| | | int maxError = Integer.parseInt(maxErrorStr);
|
| | | int count = passWordErrorRecordService.setRecord(record);
|
| | | JSONObject data = new JSONObject();
|
| | | int c = maxError - count;
|
| | | if (c <= 0) { // 当错误次数还未超过当日输错最多次数时,state为1,代表还能继续输入,little为剩余次数。state为2则不能继续输入,提现客户端退出输入密码界面
|
| | | data.put("state", "2");
|
| | | data.put("little", 0);
|
| | | } else {
|
| | | data.put("state", "1");
|
| | | data.put("little", c);
|
| | | }
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 添加用户提现账号
|
| | | *
|
| | | * @param acceptData
|
| | |
| | | }
|
| | |
|
| | | /**
|
| | | * 提现
|
| | | * |
| | | * @param acceptData
|
| | | * @param uid
|
| | | * 用户id
|
| | | * @param money
|
| | | * 提现金额
|
| | | * @param pwd
|
| | | * 密码
|
| | | * @param request
|
| | | * @param type
|
| | | * 提现账户类型
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "extractmoney", method = RequestMethod.POST)
|
| | | public void extractMoney(AcceptData acceptData, long uid, double money, String pwd, HttpServletRequest request,
|
| | | int type, PrintWriter out) {
|
| | | UserInfo user = userInfoService.getUserById(uid);
|
| | | LogHelper.userInfo("[ip:" + IPUtil.getRemotIP(request) + "]");
|
| | | if (user == null) {
|
| | | LogHelper.userInfo("不存在该用户:uid=" + uid);
|
| | | out.print(JsonUtil.loadFalseResult("用户不存在"));
|
| | | return;
|
| | | }
|
| | | System system = systemService.getSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | if (system == null) {
|
| | | LogHelper.userInfo("提现时,不存在该系统");
|
| | | out.print(JsonUtil.loadFalseResult("系统不存在"));
|
| | | return;
|
| | | }
|
| | | PassWordErrorRecord record = passWordErrorRecordService.getRecord(user.getId());
|
| | | int errorcount = record.getCount();
|
| | | String maxStr = "5";
|
| | | maxStr = configService.get(PASSWORD_MAX_ERROR);
|
| | | int max = Integer.parseInt(maxStr);
|
| | | if (max <= errorcount) {
|
| | | LogHelper.userInfo("[ip:" + IPUtil.getRemotIP(request) + "]用户[" + GsonUtil.toJson(user) + "]:提现密码错误已达上限!");
|
| | | out.print(JsonUtil.loadFalseResult("提现密码已达到每日错误次数上限,请明日再试!"));
|
| | | return;
|
| | | }
|
| | |
|
| | | if (pwd == null || !pwd.equals(user.getPayPassword())) {
|
| | | passWordErrorRecordService.setRecord(record);
|
| | | out.print(JsonUtil.loadFalseResult("支付密码错误"));
|
| | | return;
|
| | | }
|
| | |
|
| | | passWordErrorRecordService.deleteRecord(uid);// 当提现密码输入正确时,清除当前用户的密码错误输入记录
|
| | |
|
| | | String minMoney = configService.get(EXTRACT_MIN_MONEY); // 单笔提现最小金额
|
| | |
|
| | | if (money < 0.1) { // 转帐到支付宝的最小金额
|
| | | out.print(JsonUtil.loadFalseResult("单笔提现金额需要大于:" + 0.1 + "元"));
|
| | | return;
|
| | | }
|
| | |
|
| | | double dminMoney = Double.parseDouble(minMoney);
|
| | | if (money < dminMoney) { // 后台设置的单笔转账的最小金额
|
| | | out.print(JsonUtil.loadFalseResult("单笔提现金额需要大于:" + dminMoney + "元"));
|
| | | return;
|
| | | }
|
| | | String maxMoney = configService.get(EXTRACT_MAX_MONEY); // 单笔提现最大金额
|
| | | double dmaxMoney = Double.parseDouble(maxMoney);
|
| | | if (dmaxMoney < money) { // 后台设置的单笔转账的最大金额
|
| | | out.print(JsonUtil.loadFalseResult("单笔提现金额多为:" + dmaxMoney + "元"));
|
| | | return;
|
| | | }
|
| | |
|
| | | if (type != Constant.ZHIFUBAO && type != Constant.WEIXIN) { // 提现类型必须是支付宝类型或者微信类型,目前(20170506)仅支持支付宝
|
| | | out.print(JsonUtil.loadFalseResult(Constant.NOTYPE));
|
| | | return;
|
| | | }
|
| | |
|
| | | BindingAccount bindingAccount = bindingAccountService.getBindingAccountByUidAndType(uid, type);
|
| | | if (bindingAccount == null) {
|
| | | out.print(JsonUtil.loadFalseResult(Constant.NOACCOUNT));
|
| | | return;
|
| | | }
|
| | |
|
| | | Extract extract = new Extract();
|
| | | extract.setIp(IPUtil.getRemotIP(request));
|
| | | extract.setAccount(bindingAccount.getAccount());
|
| | | extract.setName(bindingAccount.getName());
|
| | | extract.setMoney(new BigDecimal(String.valueOf(money)));
|
| | | extract.setUserInfo(user);
|
| | | extract.setExtractTime(java.lang.System.currentTimeMillis());
|
| | | extract.setType(type);
|
| | | extract.setState(0);
|
| | | extract.setSystem(system);
|
| | | Integer etype = extractService.addExtract(extract);
|
| | | if (etype == null) {
|
| | | out.print(JsonUtil.loadTrueResult("操作成功"));
|
| | | return;
|
| | | } else if (etype == 1 || etype == 2) {
|
| | | out.print(JsonUtil.loadFalseResult("已超过当日提现次数或提现金额"));
|
| | | } else if (etype == 3) {
|
| | | out.print(JsonUtil.loadFalseResult("提现金额大于我的红包"));
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | /**
|
| | | * 新版提现
|
| | | *
|
| | | * @param acceptData
|
| | |
| | | HttpServletRequest request, int type, PrintWriter out) {
|
| | | UserInfo user = userInfoService.getUserById(uid);
|
| | | if (user == null) {
|
| | | user = userInfoService.getUserByIdWithMybatis(uid);
|
| | | if (user != null && user.getState() != UserInfo.STATE_NORMAL) {
|
| | | out.print(JsonUtil.loadFalseResult(Constant.CODE_FORBIDDEN_USER, Constant.FORBIDDEN_USER_REASON_DESC));
|
| | | return;
|
| | | }
|
| | |
|
| | | out.print(JsonUtil.loadFalseResult("用户不存在"));
|
| | | return;
|
| | | }
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | System system = systemService.getSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
|
| | | acceptData.getPackages());
|
| | | if (system == null) {
|
| | | LogHelper.userInfo("提现时,不存在该系统");
|
| | | out.print(JsonUtil.loadFalseResult("系统不存在"));
|
| | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("id", extract.getId());
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | ThreadUtil.run(new Runnable() {
|
| | |
|
| | | @Override
|
| | | public void run() {
|
| | | JSONObject json = new JSONObject();
|
| | | json.put("timeStamp", java.lang.System.currentTimeMillis());
|
| | | json.put("adminId", 4L);
|
| | | String sign = AESUtil.encrypt(json.toString(), Constant.ADMINH5_AESKEY);
|
| | | String url = "";
|
| | | try {
|
| | | url = String.format("%s?from=emailh5&sign=%s",
|
| | | Constant.systemCommonConfig.getExtractNotifyUrl(), URLEncoder.encode(sign, "UTF-8"));
|
| | | } catch (UnsupportedEncodingException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | long[] targetUids = new long[] { 3L, 4L };
|
| | | Config config = configService.getConfig("extract_code_email_from");
|
| | | String[] sts = config.getValue().split(",");
|
| | | String account = sts[0];
|
| | | String pwd = sts[1];
|
| | | for (long adminId : targetUids) {
|
| | | AdminUser adminUser = adminUserService.selectByPrimaryKey(adminId);
|
| | | String msg = "提现审核链接:" + url;
|
| | | boolean isS = MailSenderUtil.sendEmail(adminUser.getEmail(), account, pwd, "有新的提现审核", msg);
|
| | | }
|
| | | }
|
| | | });
|
| | | return;
|
| | | } else if (etype == 1) {
|
| | | out.print(JsonUtil.loadFalseResult("已超过当日提现次数"));
|
| | |
| | | out.print(JsonUtil.loadFalseResult("已超过当日提现金额"));
|
| | | } else if (etype == 3) {
|
| | | out.print(JsonUtil.loadFalseResult("提现金额大于我的红包"));
|
| | | } else if (etype == 111) {
|
| | | out.print(JsonUtil.loadFalseResult("更换了手机号后7天内不允许提现"));
|
| | | } else if (etype == 110) {
|
| | | out.print(JsonUtil.loadFalseResult(Constant.znxConfig.getExtractWrongMsg()));
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "openhongbao")
|
| | | public void openHongBao(AcceptData acceptData, long hid, HttpServletRequest request, PrintWriter out) {
|
| | | String ip = IPUtil.getRemotIP(request);
|
| | | HongBaoExtra hbx = hongBaoService.open(hid, ip);
|
| | | if (hbx == null) {
|
| | | out.print(JsonUtil.loadFalseResult("红包异常"));
|
| | | LogHelper.userInfo("[ip:" + IPUtil.getRemotIP(request) + "] 打开红包[id=" + hid + "]失败!");
|
| | | return;
|
| | | }
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("hongBao", GsonUtil.toJsonExpose(hbx));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | LogHelper.userInfo("[ip:" + IPUtil.getRemotIP(request) + "] 打开红包[id=" + hid + "]成功!");
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "getHongBaoMessages", method = RequestMethod.POST)
|
| | | public void getHongBaoMessages(AcceptData acceptData, PrintWriter out) {
|
| | | List<HongBaoMessage> list = shamUserService.getManyData();
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("list", list);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | @RequestMapping("findLostOrder")
|
| | | public void findLostOrder(AcceptData acceptData, LostOrder lostOrder, PrintWriter out) {
|
| | | boolean orderNum = true;
|
| | |
| | |
|
| | | @RequestMapping("findOrderItemList")
|
| | | public void findOrderItemList(AcceptData acceptData, long uid, int page, PrintWriter out) {
|
| | | List<OrderItem> list = orderItemServcie.findOrderItemList(uid, page);
|
| | | list.parallelStream().forEach(oi -> {
|
| | | oi.setDesc();
|
| | | });
|
| | | int count = orderItemServcie.getCount(uid);
|
| | | List<HongBaoOrder> list = hongBaoOrderService.listFanLiOrder(uid, page, Constant.PAGE_SIZE);
|
| | |
|
| | | List<OrderItem> orderList = new ArrayList<>();
|
| | | for (HongBaoOrder oi : list) {
|
| | | OrderItem orderItem = OrderItemFactory.create(oi);
|
| | | orderItem.setDesc();
|
| | | orderItem.setPicture(TbImgUtil.getTBSize220Img(orderItem.getPicture()));
|
| | | orderList.add(orderItem);
|
| | | }
|
| | | long count = hongBaoOrderService.countFanLiOrder(uid);
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | | .excludeFieldsWithoutExposeAnnotation().create();
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("list", gson.toJson(list));
|
| | | data.put("list", gson.toJson(orderList));
|
| | | data.put("count", count);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
| | | */
|
| | | @RequestMapping("getTiChengOrderList")
|
| | | public void getTiChengOrderList(AcceptData acceptData, long uid, int page, PrintWriter out) {
|
| | | List<HongBao> list = hongBaoService.getTiChengHongBaoList(uid, page);
|
| | | long count = hongBaoService.getTiChengHongBaoListCount(uid);
|
| | | List<HongBaoDTO> hongBaoDTOList = hongBaoV2Service.listJiangJinByUid(uid, page, Constant.PAGE_SIZE);
|
| | | List<HongBao> list = new ArrayList<>();
|
| | | if (hongBaoDTOList != null)
|
| | | for (HongBaoDTO dto : hongBaoDTOList) {
|
| | | list.add(HongBaoFactory.createHongBao(dto));
|
| | | }
|
| | | long count = hongBaoV2Service.countJiangJinByUid(uid);
|
| | | List<OrderItem> orderItemList = HongBaoUtil.convertToTiChengOrder(list);
|
| | | Gson gson = JsonUtil.getApiCommonGson();
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("list", gson.toJson(orderItemList));
|
| | | data.put("count", count);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | @RequestMapping("getOrderItem")
|
| | | public void getOrderItem(AcceptData acceptData, long id, PrintWriter out) {
|
| | | OrderItem orderItem = orderItemServcie.getOne(id);
|
| | | if (orderItem == null) {
|
| | | out.print(JsonUtil.loadFalseResult("不存在该订单"));
|
| | | return;
|
| | | }
|
| | | orderItem.setDesc();
|
| | | JSONObject data = new JSONObject();
|
| | | GsonBuilder gsonBuilder = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder());
|
| | | Gson gson = gsonBuilder.excludeFieldsWithoutExposeAnnotation().create();
|
| | | data.put("orderItem", gson.toJson(orderItem));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | |
| | | List<CollectionGoodsV2> collectionGoodsList = collectionGoodsV2Service.getCollectionGoodsList(uid, page + 1,
|
| | | Constant.PAGE_SIZE);
|
| | |
|
| | | // List<CollectionGoods> coList =
|
| | | // collectionGoodsService.findCollectionGoods(uid, page + 1);
|
| | | List<TaoBaoGoodsBriefExtra> list = new ArrayList<TaoBaoGoodsBriefExtra>();
|
| | |
|
| | | long count = collectionGoodsV2Service.getCollectionGoodsCount(uid);
|
| | | JSONObject data = new JSONObject();
|
| | | Map<String, String> map = hongBaoManageService.convertMap();
|
| | | String proportion = map.get("hongbao_goods_proportion");
|
| | | String fcRate = map.get("hongbao_fc_ratio");
|
| | | List<TaoBaoGoodsBriefExtra> list = new ArrayList<TaoBaoGoodsBriefExtra>();
|
| | | collectionGoodsList.parallelStream().forEachOrdered(cg -> {
|
| | | TaoBaoGoodsBrief goodsBrief = TaoBaoUtil.convert(cg.getCommonGoods());
|
| | | goodsBrief.setSalesCount(TaoBaoUtil.getSaleCount(goodsBrief.getBiz30day()));
|
| | | TaoBaoGoodsBriefExtra taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(goodsBrief, proportion,
|
| | | fcRate, "");
|
| | | taoBaoGoodsBriefExtra.setCreatetime(cg.getCreateTime());
|
| | | list.add(taoBaoGoodsBriefExtra);
|
| | | });
|
| | |
|
| | | List<TaoBaoGoodsBrief> listTaoKeGoods = new ArrayList<TaoBaoGoodsBrief>();
|
| | | if (collectionGoodsList != null && collectionGoodsList.size() > 0) {
|
| | |
|
| | | BigDecimal proportion = hongBaoManageService.getFanLiRate();
|
| | |
|
| | | List<Long> listGid = new ArrayList<Long>();
|
| | | for (CollectionGoodsV2 collectionGoodsV2 : collectionGoodsList) {
|
| | | CommonGoods commonGoods = collectionGoodsV2.getCommonGoods();
|
| | | if (commonGoods == null) {
|
| | | continue;
|
| | | }
|
| | | listGid.add(commonGoods.getGoodsId());
|
| | | }
|
| | |
|
| | | try {
|
| | | // API网络接口验证是否在售
|
| | | listTaoKeGoods = TaoKeApiUtil.getBatchGoodsInfo(listGid);
|
| | | } catch (TaoKeApiException e) {
|
| | | e.printStackTrace();
|
| | | } catch (TaobaoGoodsDownException e) {
|
| | | e.printStackTrace();
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | for (CollectionGoodsV2 collectionGoodsV2 : collectionGoodsList) {
|
| | | CommonGoods commonGoods = collectionGoodsV2.getCommonGoods();
|
| | | if (commonGoods == null) {
|
| | | continue;
|
| | | }
|
| | |
|
| | | if (listTaoKeGoods != null && listTaoKeGoods.size() > 0) {
|
| | | int state = 1; // 默认停售
|
| | | Long goodsId = commonGoods.getGoodsId();
|
| | | for (TaoBaoGoodsBrief taoKeGoods : listTaoKeGoods) {
|
| | | Long auctionId = taoKeGoods.getAuctionId();
|
| | | if (goodsId == auctionId || goodsId.equals(auctionId)) {
|
| | | state = 0; // 在售
|
| | | break;
|
| | | }
|
| | | }
|
| | | commonGoods.setState(state);
|
| | | }
|
| | |
|
| | | TaoBaoGoodsBrief goodsBrief = TaoBaoUtil.convert(commonGoods);
|
| | | goodsBrief.setSalesCount(TaoBaoUtil.getSaleCount(goodsBrief.getBiz30day()));
|
| | | TaoBaoGoodsBriefExtra taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(goodsBrief,
|
| | | proportion.toString(), "");
|
| | | taoBaoGoodsBriefExtra.setCreatetime(collectionGoodsV2.getCreateTime());
|
| | |
|
| | | list.add(taoBaoGoodsBriefExtra);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | GsonBuilder builder = new GsonBuilder().registerTypeAdapter(Date.class, new JsonSerializer<Date>() {
|
| | | @Override
|
| | | public JsonElement serialize(Date value, Type theType, JsonSerializationContext context) {
|
| | |
| | |
|
| | | @RequestMapping("findAccountDetailsList")
|
| | | public void findAccountDetailsList(AcceptData acceptData, long uid, int page, PrintWriter out) {
|
| | | List<AccountDetails> list = accountDetailsService.findAccountDetailsList(uid, page);
|
| | | int count = accountDetailsService.getCount(uid);
|
| | | List<UserMoneyDetail> detailList = userMoneyDetailService.listByUidWithState(uid, page, Constant.PAGE_SIZE);
|
| | | List<AccountDetails> list = new ArrayList<>();
|
| | | for (UserMoneyDetail detail : detailList)
|
| | | list.add(AccountDetailsFactory.create(detail));
|
| | | long count = userMoneyDetailService.countByUidWithState(uid);
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("list", GsonUtil.toJsonExpose(list));
|
| | | data.put("count", count);
|
| | |
| | | }
|
| | |
|
| | | @RequestMapping("findAccountDetailsListV2")
|
| | | public void findAccountDetailsListNew(AcceptData acceptData, long uid, int page, PrintWriter out) {
|
| | | List<AccountDetails> list = accountDetailsService.findAccountDetailsListWithState(uid, page);
|
| | | long count = accountDetailsService.getCountWithState(uid);
|
| | | public void findAccountDetailsListNew(AcceptData acceptData, Long uid, int page, PrintWriter out) {
|
| | |
|
| | | if (uid == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "UID为空"));
|
| | | return;
|
| | | }
|
| | |
|
| | | List<UserMoneyDetail> detailList = userMoneyDetailService.listByUidWithState(uid, page, Constant.PAGE_SIZE);
|
| | |
|
| | | List<AccountDetails> list = new ArrayList<>();
|
| | | for (UserMoneyDetail detail : detailList)
|
| | | list.add(AccountDetailsFactory.create(detail));
|
| | |
|
| | | long count = userMoneyDetailService.countByUidWithState(uid);
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | JSONArray array = new JSONArray();
|
| | | for (AccountDetails ad : list) {
|
| | |
| | | }
|
| | | data.put("list", array);
|
| | | data.put("count", count);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "isWxDown")
|
| | |
|
| | | public void isWxDown(AcceptData acceptData, PrintWriter out) {
|
| | | boolean b = wxDownService.isWxDownFirstLogin(acceptData.getDevice());
|
| | | // IOS上线测试
|
| | | if (Integer.parseInt(acceptData.getVersion()) >= 22
|
| | | && acceptData.getPackages().equalsIgnoreCase(Constant.systemCommonConfig.getIosBundleId()))
|
| | | b = false;
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("isFirst", b);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | |
| | | @RequestMapping(value = "getMyTeam", method = RequestMethod.POST)
|
| | | public void getMyTeam(AcceptData acceptData, long page, long uid, long type, PrintWriter out) {
|
| | |
|
| | | int pageSize = Constant.PAGE_SIZE;
|
| | | try {
|
| | | int pageSize = Constant.PAGE_SIZE;
|
| | |
|
| | | JSONObject resultData = new JSONObject();
|
| | | if (type == 1) {
|
| | | resultData = threeSaleSerivce.getMyFirstTeam((page - 1) * pageSize, pageSize, uid);
|
| | | } else if (type == 2) {
|
| | | resultData = threeSaleSerivce.getMySecondTeam((page - 1) * pageSize, pageSize, uid);
|
| | | JSONObject resultData = new JSONObject();
|
| | | if (type == 1) {
|
| | | resultData = threeSaleSerivce.getMyFirstTeam((page - 1) * pageSize, pageSize, uid, null);
|
| | | } else if (type == 2) {
|
| | | resultData = threeSaleSerivce.getMySecondTeam((page - 1) * pageSize, pageSize, uid, null);
|
| | | }
|
| | |
|
| | | // 安卓系统返回所有数据
|
| | | String platform = acceptData.getPlatform();
|
| | | if ("android".equalsIgnoreCase(platform)) {
|
| | | 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 = null;
|
| | | ThreeSale threeSale = threeSaleSerivce.getMyBoss(uid);
|
| | | if (threeSale != null) {
|
| | | bossData = new JSONObject();
|
| | | 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));
|
| | | }
|
| | |
|
| | | String helpLink = configService.get("team_help_url");
|
| | | if (helpLink == null) {
|
| | | helpLink = "";
|
| | | }
|
| | |
|
| | | 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);
|
| | |
|
| | | 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));
|
| | | } catch (UserInfoExtraException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getMsg()));
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadFalseResult("统计失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | // 安卓系统返回所有数据
|
| | | String platform = acceptData.getPlatform();
|
| | | if ("android".equalsIgnoreCase(platform)) {
|
| | | }
|
| | |
|
| | | /**
|
| | | * 用户队员列表查询 1.5.3查询有效队员
|
| | | * |
| | | * @param acceptData
|
| | | * @param id
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getMyTeamNew", method = RequestMethod.POST)
|
| | | public void getMyTeamNew(AcceptData acceptData, long page, long uid, long type, PrintWriter out) {
|
| | |
|
| | | try {
|
| | | int pageSize = Constant.PAGE_SIZE;
|
| | |
|
| | | JSONObject resultData = new JSONObject();
|
| | | if (type == 1) {
|
| | | resultData = threeSaleSerivce.getMyFirstTeam((page - 1) * pageSize, pageSize, uid, 1);
|
| | | } else if (type == 2) {
|
| | | resultData = threeSaleSerivce.getMySecondTeam((page - 1) * pageSize, pageSize, uid, 1);
|
| | | }
|
| | |
|
| | | // 安卓系统返回所有数据
|
| | | String platform = acceptData.getPlatform();
|
| | | if ("android".equalsIgnoreCase(platform)) {
|
| | | long firstTeam = threeSaleSerivce.countFirstTeam(uid, 1);
|
| | |
|
| | | long secondTeam = threeSaleSerivce.countSecondTeam(uid, 1);
|
| | |
|
| | | JSONObject bossData = null;
|
| | | ThreeSale threeSale = threeSaleSerivce.getMyBoss(uid);
|
| | | if (threeSale != null) {
|
| | | bossData = new JSONObject();
|
| | | 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));
|
| | | }
|
| | |
|
| | | String helpLink = configService.get("team_help_url");
|
| | | if (helpLink == null) {
|
| | | helpLink = "";
|
| | | }
|
| | |
|
| | | 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);
|
| | |
|
| | | resultData.put("helpLink", helpLink);
|
| | | resultData.put("firstTeam", firstTeam);
|
| | | resultData.put("secondTeam", secondTeam);
|
| | | resultData.put("boss", bossData);
|
| | | }
|
| | | out.print(JsonUtil.loadTrueResult(resultData));
|
| | | } catch (UserInfoExtraException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getMsg()));
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadFalseResult("统计失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 用户队员统计 1.4.1
|
| | | * |
| | | * @param acceptData
|
| | | * @param id
|
| | | * @param out
|
| | | */
|
| | | @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 secondTeam = threeSaleSerivce.countSecondTeam(uid, 1);
|
| | | long secondTeamTotal = threeSaleSerivce.countSecondTeam(uid, null);
|
| | |
|
| | | JSONObject bossData = null;
|
| | | JSONObject bossData = new JSONObject();
|
| | | ThreeSale threeSale = threeSaleSerivce.getMyBoss(uid);
|
| | | if (threeSale != null) {
|
| | | bossData = new JSONObject();
|
| | | UserInfo boss = threeSale.getBoss();
|
| | | if (boss != null) {
|
| | | bossData.put("nickName", boss.getNickName());
|
| | |
| | | bossData.put("inviteTime", "邀请时间: " + sdf.format(inviteTime));
|
| | | }
|
| | |
|
| | | JSONObject resultData = new JSONObject();
|
| | |
|
| | | String helpLink = configService.get("team_help_url");
|
| | | if (helpLink == null) {
|
| | | helpLink = "";
|
| | |
| | | resultData.put("secondTeam", secondTeam);
|
| | | resultData.put("secondTeamTotal", secondTeamTotal);
|
| | | resultData.put("boss", bossData);
|
| | | }
|
| | | out.print(JsonUtil.loadTrueResult(resultData));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 用户队员统计 1.4.1
|
| | | * |
| | | * @param acceptData
|
| | | * @param id
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "countMyTeam", method = RequestMethod.POST)
|
| | | public void countMyTeam(AcceptData acceptData, long uid, PrintWriter out) {
|
| | |
|
| | | 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());
|
| | | 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);
|
| | |
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
|
| | | Long createTime = threeSale.getCreateTime();
|
| | | Date inviteTime = new Date(createTime);
|
| | | bossData.put("inviteTime", "邀请时间: " + sdf.format(inviteTime));
|
| | | 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));
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | out.print(JsonUtil.loadFalseResult("删除失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | /**
|
| | | * 设置界面开关状态
|
| | | * |
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param params
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "setModuleState", method = RequestMethod.POST)
|
| | | public void setModuleState(AcceptData acceptData, Long uid, String params, PrintWriter out) {
|
| | |
|
| | | if (uid == null) {
|
| | | 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);
|
| | | }
|
| | | out.print(JsonUtil.loadTrueResult("设置成功"));
|
| | |
|
| | | } catch (UserCustomSettingsException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getMsg()));
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadFalseResult("设置失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取等级信息
|
| | | * |
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getRankInfo", method = RequestMethod.POST)
|
| | | public void getRankInfo(AcceptData acceptData, Long uid, PrintWriter out) {
|
| | |
|
| | | if (uid == null) {
|
| | | 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) {
|
| | | out.print(JsonUtil.loadFalseResult("获取失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取等级信息
|
| | | * |
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getUserConfig", method = RequestMethod.POST)
|
| | | public void getUserConfig(AcceptData acceptData, Long uid, PrintWriter out) {
|
| | |
|
| | | if (uid == null) {
|
| | | 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_url"));
|
| | | } else {
|
| | | // 已有邀请码
|
| | | 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) {
|
| | | out.print(JsonUtil.loadFalseResult("获取失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取用户信息
|
| | | * |
| | | * @param acceptData
|
| | | * @param form
|
| | | * @param requst
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getuserinfoNew", method = RequestMethod.POST)
|
| | | public void getuserinfoNew(AcceptData acceptData, Long uid, HttpServletRequest requst, PrintWriter out) {
|
| | | try {
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
|
| | | acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult("系统不存在"));
|
| | | return;
|
| | | }
|
| | |
|
| | | if (uid == null) {
|
| | | out.print(JsonUtil.loadFalseResult("请求参数为空"));
|
| | | return;
|
| | | }
|
| | |
|
| | | UserInfo userInfo = userInfoService.getUserInfo(uid);
|
| | |
|
| | | // 添加用户活跃记录
|
| | | UserActiveLog userActiveLog = new UserActiveLog();
|
| | | userActiveLog.setChannel(acceptData.getChannel());
|
| | | userActiveLog.setIp(requst.getRemoteHost());
|
| | | userActiveLog.setUid(userInfo.getId());
|
| | | userActiveLog.setVersionCode(acceptData.getVersion());
|
| | | userActiveLog.setOsVersion(acceptData.getOsVersion());
|
| | | userActiveLog.setDeviceType(acceptData.getDeviceType());
|
| | | userActiveLogService.addUserActiveLog(userActiveLog);
|
| | |
|
| | | // 处理用户信息
|
| | | outUserInfoHandle(userInfo);
|
| | |
|
| | | GsonBuilder gsonBuilder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation();
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("user", JsonUtil.getConvertBigDecimalToStringBuilder(gsonBuilder).create().toJson(userInfo));
|
| | |
|
| | | // 界面状态
|
| | | UserSettingsVO mySettings = null;
|
| | | try {
|
| | | mySettings = userCustomSettingsService.getMySettings(uid);
|
| | | } catch (UserCustomSettingsException e) {
|
| | | mySettings = new UserSettingsVO();
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | if (mySettings.getCancelNotice() == null) {
|
| | | mySettings.setCancelNotice(0);
|
| | | }
|
| | | if (mySettings.getNoBonusCount() == null) {
|
| | | mySettings.setNoBonusCount(0);
|
| | | }
|
| | | if (mySettings.getNoNewsRedDot() == null) {
|
| | | mySettings.setNoNewsRedDot(0);
|
| | | }
|
| | | if (mySettings.getNoShareRecordAndStorage() == null) {
|
| | | mySettings.setNoShareRecordAndStorage(0);
|
| | | }
|
| | | if (mySettings.getNoInvitationBonus() == null) {
|
| | | mySettings.setNoInvitationBonus(0);
|
| | | }
|
| | | data.put("moduleState", mySettings);
|
| | |
|
| | | int welfareCenterNews = 0;
|
| | | String invitCode = null;
|
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | if (userInfoExtra != null) {
|
| | | if (userInfoExtra.getCouponNews() != null) {
|
| | | welfareCenterNews = userInfoExtra.getCouponNews();
|
| | | }
|
| | |
|
| | | if (userInfoExtra.getInviteCode() != null && userInfoExtra.getInviteCode().trim().length() > 0) {
|
| | | invitCode = userInfoExtra.getInviteCode();
|
| | | }
|
| | |
|
| | | if (userInfoExtra.getUserRank() != null) {
|
| | | String picture = userInfoExtra.getUserRank().getPicture();
|
| | | String icon = userInfoExtra.getUserRank().getIcon();
|
| | | userInfo.setRankNamePicture(picture);
|
| | | userInfo.setRankIcon(icon);
|
| | | } else {
|
| | | userInfo.setRankNamePicture(null);
|
| | | userInfo.setRankIcon(null);
|
| | | }
|
| | | }
|
| | |
|
| | | data.put("invitCode", invitCode); // 邀请码
|
| | | data.put("welfareCenterNews", welfareCenterNews);// 福利中心消息
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | |
|
| | | final UserInfo uuser = userInfo;
|
| | | ThreadUtil.run(new Runnable() {
|
| | | public void run() {
|
| | | try {
|
| | | // 获取邀请码:若无邀请码且存在有效的队员关系 则自动生成邀请码
|
| | | userInfoExtraService.getUserInviteCode(uuser.getId());
|
| | | } catch (UserInfoExtraException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | // 更新用户附加信息,老用户不存在的需要添加
|
| | | try {
|
| | | userInfoExtraService.updateUserRankByUid(uuser.getId());
|
| | | } catch (UserInfoExtraException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | });
|
| | |
|
| | | } catch (UserInfoException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadFalseResult("获取失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | private void outUserInfoHandle(UserInfo user) {
|
| | |
|
| | | // 红包处理
|
| | | user.setTotalHongBao(new BigDecimal(0));
|
| | | user.setNoOpenHongBao(new BigDecimal(0));
|
| | | user.setCanOpenHongBao(new BigDecimal(0));
|
| | |
|
| | | // 电话号码处理
|
| | | if (!StringUtil.isNullOrEmpty(user.getPhone())) {
|
| | | if (user.getPhone().length() > 5) {
|
| | | String phone = user.getPhone().substring(0, 3);
|
| | | phone += "******";
|
| | | phone += user.getPhone().substring(user.getPhone().length() - 2, user.getPhone().length());
|
| | | user.setPhone(phone);
|
| | | }
|
| | | }
|
| | |
|
| | | UserInfoExtraVO userInfoExtra = userInfoExtraService.getInfoExtraVOByUid(user.getId());
|
| | | if (userInfoExtra != null && userInfoExtra.getUserRank() != null) {
|
| | | String picture = userInfoExtra.getUserRank().getPicture();
|
| | | String icon = userInfoExtra.getUserRank().getIcon();
|
| | | user.setRankNamePicture(picture);
|
| | | user.setRankIcon(icon);
|
| | | }
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 用户更换头像
|
| | | * @param acceptData
|
| | | * @param fileList
|
| | | * @param uid
|
| | | * @param request
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "uploadPortrait")
|
| | | public void uploadPortrait(AcceptData acceptData, MultipartFile file, Long uid, HttpServletRequest request, PrintWriter out) {
|
| | | try {
|
| | | if (uid == null) {
|
| | | out.print(JsonUtil.loadFalseResult("用户未登录"));
|
| | | return;
|
| | | }
|
| | | if (file == null) {
|
| | | out.print(JsonUtil.loadFalseResult("上传文件不能为空"));
|
| | | return;
|
| | | }
|
| | | |
| | | long fileSize = file.getSize() / 1024 + 1;
|
| | | if (fileSize > 200) {
|
| | | out.print(JsonUtil.loadFalseResult("上传文件不能大于200kb"));
|
| | | return;
|
| | | }
|
| | | userInfoService.uploadPortrait(file, uid);
|
| | | out.print(JsonUtil.loadTrueResult("保存成功"));
|
| | | } catch (UserInfoException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getMsg()));
|
| | | e.printStackTrace();
|
| | | } catch (IOException e) {
|
| | | out.print(JsonUtil.loadFalseResult("图片上传失败失败"));
|
| | | e.printStackTrace();
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadFalseResult("保存失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | /**
|
| | | * 更换昵称
|
| | | * @param acceptData
|
| | | * @param nickName
|
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "saveInfo")
|
| | | public void saveInfo(AcceptData acceptData, String nickName, Long uid, PrintWriter out) {
|
| | | try {
|
| | | if (uid == null) {
|
| | | out.print(JsonUtil.loadFalseResult("用户未登录"));
|
| | | return;
|
| | | }
|
| | | if (StringUtil.isNullOrEmpty(nickName)) {
|
| | | out.print(JsonUtil.loadFalseResult("昵称不能为空"));
|
| | | return;
|
| | | }
|
| | | if (nickName.length() > 200) {
|
| | | out.print(JsonUtil.loadFalseResult("昵称过长"));
|
| | | return;
|
| | | }
|
| | | |
| | | if(maskKeyService.examineContent(nickName)) {
|
| | | out.print(JsonUtil.loadFalseResult("不能包含敏感词汇"));
|
| | | return;
|
| | | }
|
| | | |
| | | userInfoService.saveUserInfo(nickName, uid);
|
| | | |
| | | out.print(JsonUtil.loadTrueResult("保存成功"));
|
| | | } catch (UserInfoException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getMsg()));
|
| | | e.printStackTrace();
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadFalseResult("保存失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|