| | |
| | | import com.yeshi.fanli.entity.bus.user.Extract;
|
| | | import com.yeshi.fanli.entity.bus.user.ExtractRecord;
|
| | | import com.yeshi.fanli.entity.bus.user.LostOrder;
|
| | | 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.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.PassWordErrorRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.ShamUserService;
|
| | | import com.yeshi.fanli.service.inter.user.SpreadUserImgService;
|
| | | import com.yeshi.fanli.service.inter.user.UserAccountService;
|
| | |
| | |
|
| | | @Resource
|
| | | private ExtractService extractService;
|
| | |
|
| | | @Resource
|
| | | private PassWordErrorRecordService passWordErrorRecordService;
|
| | |
|
| | | @Resource
|
| | | private ConfigService configService;
|
| | |
| | | }
|
| | |
|
| | | /**
|
| | | * 客户端提现密码输入错误时调用
|
| | | * |
| | | * @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
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 提现
|
| | | * |
| | | * @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;
|
| | | }
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(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("提现金额大于我的红包"));
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | /**
|
| | | * 新版提现
|