| | |
| | | import java.text.ParseException;
|
| | | import java.text.SimpleDateFormat;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Calendar;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | |
| | | import com.google.gson.JsonSerializer;
|
| | | import com.yeshi.fanli.dto.user.UserInviteLevelEnum;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.user.ForbiddenUserIdentifyCode;
|
| | | import com.yeshi.fanli.entity.bus.user.SMSHistory;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | | 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.ForbiddenUserIdentifyCode.ForbiddenUserIdentifyCodeTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.TearcherInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserVIPInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserVIPPreInfo;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail.UserMoneyDetailTypeEnum;
|
| | | import com.yeshi.fanli.entity.order.OrderMoneyDailyCount;
|
| | | import com.yeshi.fanli.entity.push.DeviceActive;
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopOrder;
|
| | | import com.yeshi.fanli.entity.system.BusinessSystem;
|
| | |
| | | import com.yeshi.fanli.service.inter.money.UserMoneyDetailService;
|
| | | import com.yeshi.fanli.service.inter.money.UserMoneyService;
|
| | | import com.yeshi.fanli.service.inter.order.CommonOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.HongBaoV2Service;
|
| | | import com.yeshi.fanli.service.inter.order.LostOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderMoneyDailyCountService;
|
| | | import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.push.DeviceActiveService;
|
| | | import com.yeshi.fanli.service.inter.push.DeviceTokenHWService;
|
| | |
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.ThreadUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.VersionUtil;
|
| | | import com.yeshi.fanli.util.account.UserUtil;
|
| | | import com.yeshi.fanli.util.annotation.RequestSerializableByKey;
|
| | | import com.yeshi.fanli.util.user.UserLevelUtil;
|
| | | import com.yeshi.fanli.vo.user.UserVipRateVO;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | | import org.yeshi.utils.entity.ProxyIP;
|
| | |
|
| | | /**
|
| | | * 账户系统
|
| | |
| | | @Resource
|
| | | private UserVIPPreInfoService userVIPPreInfoService;
|
| | |
|
| | | |
| | | @Resource
|
| | | private HongBaoV2Service hongBaoV2Service;
|
| | | |
| | | @Resource
|
| | | private OrderMoneyDailyCountService orderMoneyDailyCountService;
|
| | |
|
| | | |
| | | /**
|
| | | * 新版登录 V1.5.3
|
| | | *
|
| | |
| | | UserInfo userInfo = null;
|
| | | // 手机登录
|
| | | if (loginType == 1) {
|
| | | userInfo = userAccountService.loginPhone(request, loginType, vcode, phone, system.getAppid());
|
| | | userInfo = userAccountService.loginPhone(new ProxyIP(request.getRemoteHost(),request.getRemotePort()),acceptData, loginType, vcode, phone, system.getAppid());
|
| | | }
|
| | |
|
| | | // 微信登录
|
| | | if (loginType == 2) {
|
| | | userInfo = userAccountService.loginWeiXinNew(request, acceptData, loginType, code, system.getAppid());
|
| | | userInfo = userAccountService.loginWeiXinNew(new ProxyIP(request.getRemoteHost(),request.getRemotePort()), acceptData, loginType, code, system.getAppid());
|
| | | }
|
| | |
|
| | | if (userInfo == null) {
|
| | |
| | | }
|
| | |
|
| | | try {
|
| | | UserInfo userInfo = userAccountService.bindPhoneToLogin(phone, key, system.getAppid(), request);
|
| | | UserInfo userInfo = userAccountService.bindPhoneToLogin(new ProxyIP(request.getRemoteHost(),request.getRemotePort()),acceptData, phone, key);
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("userInfo", UserUtil.filterForClientUser(userInfo));
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | |
|
| | | /**
|
| | | * 绑定微信V2.1.3 电话号码 登录
|
| | | * |
| | | * @param acceptData
|
| | | * @param vcode
|
| | | * @param phone
|
| | | * @param uid
|
| | | * @param code
|
| | | * @param key
|
| | | * @param request
|
| | | * @param out
|
| | | */
|
| | | @RequestSerializableByKey(key = "'bindWXLogin-'+#code")
|
| | |
| | | }
|
| | |
|
| | | try {
|
| | | UserInfo userInfo = userAccountService.bindWXToLogin(request, acceptData, code, system.getAppid(), key);
|
| | | UserInfo userInfo = userAccountService.bindWXToLogin(new ProxyIP(request.getRemoteHost(),request.getRemotePort()), acceptData, code, system.getAppid(), key);
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("userInfo", UserUtil.filterForClientUser(userInfo));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | |
| | |
|
| | | }
|
| | |
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 绑定电话号码 V2.0.1 微信登录
|
| | | * |
| | | * @param acceptData
|
| | | * @param vcode
|
| | | * @param phone
|
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "recordBind")
|
| | |
| | | out.print(JsonUtil.loadFalseResult("用户id为空"));
|
| | | return;
|
| | | }
|
| | |
|
| | | bindRemindService.addBindPhone(uid);
|
| | | out.print(JsonUtil.loadTrueResult("记录成功"));
|
| | | }
|
| | |
| | | vo.setNickName(userInfo.getNickName());
|
| | | vo.setPortrait(userInfo.getPortrait());
|
| | | vo.setHelpLink(userVipConfigService.getValueByKey("help_link_vip_h5"));
|
| | | vo.setCsdLink(configService.get(ConfigKeyEnum.customerServiceLink.getKey()));
|
| | | vo.setCsdLink(configService.getValue(ConfigKeyEnum.customerServiceLink.getKey(),acceptData.getSystem()));
|
| | |
|
| | | Date now = new Date();
|
| | | Date start = new Date(0);
|
| | |
| | | }
|
| | | json.put("tearcherWX", tearcherWX);
|
| | | json.put("tearcherTip", "我是你的导师,为你在省赚过程中解难答疑,对你一对一辅导,倾听你的需求总结并反馈给板栗快省官方运营团队,快来添加我吧。");
|
| | | json.put("newerGongLue", configService.get(ConfigKeyEnum.newerGonglue.getKey()));
|
| | | json.put("newerGongLue", configService.getValue(ConfigKeyEnum.newerGonglue.getKey(),acceptData.getSystem()));
|
| | |
|
| | | // 已完成
|
| | | json.put("doneOrder", doneOrder);
|
| | |
| | | json.put("superVIP", jsonrRed3);
|
| | |
|
| | | // 人工客服链接
|
| | | json.put("csdLink", configService.get(ConfigKeyEnum.customerServiceLink.getKey()));
|
| | | json.put("csdLink", configService.getValue(ConfigKeyEnum.customerServiceLink.getKey(),acceptData.getSystem()));
|
| | |
|
| | | UserVIPInfo userVIPInfo = userVIPInfoService.selectByUid(uid);
|
| | | String leftTime = "";
|
| | |
| | | redisManager.clearSMSVCode(phone, SMSHistory.TYPE_REMVOE);
|
| | | }
|
| | |
|
| | | UserInfo user = new UserInfo(uid);
|
| | | user.setState(UserInfo.STATE_DELETE);
|
| | | user.setStateDesc("用户主动注销账户");
|
| | | userInfoService.updateByPrimaryKeySelective(user);
|
| | | userAccountService.forbiddenUserAll(uid, "用户主动注销账户");
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("注销成功"));
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 注销账户数据
|
| | | * @param acceptData
|
| | | * @param callback
|
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping("getAccountData")
|
| | | public void getAccountData(AcceptData acceptData, String callback, Long uid, PrintWriter out) {
|
| | | if (uid == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("用户未登录"));
|
| | | return;
|
| | | }
|
| | | |
| | | UserInfo user = userInfoService.getUserById(uid);
|
| | | if (user == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("用户不存在"));
|
| | | return;
|
| | | }
|
| | | |
| | | Date minDate = null;
|
| | | Date maxDate = null;
|
| | | long timeStamp = System.currentTimeMillis();
|
| | | Calendar calendar = Calendar.getInstance();
|
| | | calendar.setTimeInMillis(timeStamp);
|
| | | |
| | | // 全部未到账
|
| | | minDate = new Date(0);
|
| | | maxDate = new Date(timeStamp);
|
| | | BigDecimal totalMoney = hongBaoV2Service.getUnRecievedMoneyWithCreateTime(uid, minDate, maxDate);
|
| | | if (totalMoney == null) |
| | | totalMoney = BigDecimal.ZERO;
|
| | | totalMoney = totalMoney.add(user.getMyHongBao());
|
| | | |
| | | // 本月预估
|
| | | maxDate = new Date(timeStamp);
|
| | | calendar = Calendar.getInstance();
|
| | | minDate = new Date(TimeUtil.convertToTimeTemp(calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) + 1), "yyyy-M"));
|
| | | calendar.add(Calendar.MONTH, -1);
|
| | | BigDecimal monthMoney = getMoney(orderMoneyDailyCountService.query(uid, minDate, maxDate));
|
| | | |
| | | // 上月预估
|
| | | maxDate = new Date(TimeUtil
|
| | | .convertToTimeTemp(calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) + 1), "yyyy-M"));
|
| | | calendar.add(Calendar.MONTH, -1);
|
| | | minDate = new Date(TimeUtil
|
| | | .convertToTimeTemp(calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) + 1), "yyyy-M"));
|
| | | BigDecimal lastMoney = getMoney(orderMoneyDailyCountService.query(uid, minDate, maxDate));
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("totalMoney", totalMoney.setScale(2, BigDecimal.ROUND_DOWN));
|
| | | data.put("monthMoney", monthMoney.setScale(2, BigDecimal.ROUND_DOWN));
|
| | | data.put("lastMoney", lastMoney.setScale(2, BigDecimal.ROUND_DOWN));
|
| | | data.put("link", configService.getValue(ConfigKeyEnum.accountLogoutProtocolLink.getKey(),acceptData.getSystem()));
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | }
|
| | | |
| | | private BigDecimal getMoney(List<OrderMoneyDailyCount> list) {
|
| | | BigDecimal money = BigDecimal.ZERO;
|
| | | BigDecimal hundred = BigDecimal.valueOf(100);
|
| | | if (list != null && list.size() > 0) {
|
| | | for (OrderMoneyDailyCount dailyCount : list) {
|
| | | if (dailyCount.getIncome() != null)
|
| | | money = money.add(MoneyBigDecimalUtil.div(BigDecimal.valueOf(dailyCount.getIncome()), hundred));
|
| | | if (dailyCount.getIncomeTeam() != null)
|
| | | money = money.add(MoneyBigDecimalUtil.div(BigDecimal.valueOf(dailyCount.getIncomeTeam()), hundred));
|
| | | }
|
| | | }
|
| | | return money;
|
| | | }
|
| | | }
|