@RequestMapping(value = "/take", method = RequestMethod.POST) @ResponseBody public String take(HttpServletRequest request, String pwd3, int take) { Object obj = request.getSession().getAttribute("loginedUser"); Member_user member_user = null; try { if (obj != null) { member_user = (Member_user) obj; if (!member_user.getPwd3().equals(EncryptUtil.encode(pwd3))) { return "2"; } member_user = member_userService.getById(member_user.getId()); if (Float.valueOf(member_user.getCapital()) >= take && take % 100 == 0) { Withdraw_log withdraw_log = new Withdraw_log(); withdraw_log.setCapital(take); withdraw_log.setNumber(member_user.getId()); withdraw_log.setMember(member_user.getAccount_name()); withdraw_log.setMember_id(member_user.getUserid()); withdraw_log.setApply_time(new Date()); withdraw_log.setOperation(1); withdraw_log.setDetail("奖金提现" + take); withdraw_log.setTax(0); withdraw_log.setCapital(take); withdraw_log.setTake(take); withdraw_log.setState(0); withdraw_log.setAccount(member_user.getAccount()); withdraw_log.setAccount_node(member_user.getAccount_node()); withdraw_logService.save(withdraw_log); logService.saveLog( member_user.getUserid(), member_user.getAccount_name(), LogService.TYPE_CREATE, gson.toJson(withdraw_log), utils.getIpAddrByRequest(request), "withdraw_log", member_user.getUserid() + "奖金提现" + take); String capital = (member_user.getCapital() != null && !"".equals(member_user.getCapital())) ? member_user.getCapital() : "0"; capital = String.valueOf(Float.valueOf(capital) - take); member_user.setCapital(capital); String withdraw = (member_user.getWithdraw() != null && !"".equals(member_user.getWithdraw())) ? member_user.getWithdraw() : "0"; withdraw = String.valueOf(Float.valueOf(withdraw) + take); member_user.setWithdraw(withdraw); member_userService.update(member_user); logService.saveLog( member_user.getUserid(), member_user.getAccount_name(), LogService.TYPE_UPDATE, gson.toJson(member_user), utils.getIpAddrByRequest(request), "member_user", member_user.getUserid() + member_user.getAccount_name() + "余额更新为" + member_user.getCapital()); Capital_log capital_log = new Capital_log(); capital_log.setMember_id(member_user.getUserid()); capital_log.setMember(member_user.getAccount_name()); capital_log.setNumber(member_user.getId()); capital_log.setOperation(4); capital_log.setPayout("" + take); capital_log.setDetail("奖金提现" + take); capital_log.setState(2); capital_log.setRemain(capital); capital_log.setTime(new Date()); capital_log.setIncome("" + 0); capital_logService.save(capital_log); logService.saveLog( member_user.getUserid(), member_user.getAccount_name(), LogService.TYPE_CREATE, gson.toJson(capital_log), utils.getIpAddrByRequest(request), "capital_log", member_user.getUserid() + "奖金支出记录-" + take); } } } catch (NumberFormatException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return "1"; }
@RequestMapping(value = "/cancel", method = RequestMethod.POST) @ResponseBody public String cancel(HttpServletRequest request, int id, int state) { Object obj = request.getSession().getAttribute("loginedUser"); if (obj != null) { Member_user loginedUser = (Member_user) obj; loginedUser = member_userService.getById(loginedUser.getId()); Withdraw_log withdraw_log = withdraw_logService.getById(id); withdraw_log.setState(state); withdraw_log.setApprove(loginedUser.getAccount_name()); withdraw_log.setApprove_id(loginedUser.getUserid()); withdraw_log.setApprove_time(new Date()); withdraw_logService.update(withdraw_log); logService.saveLog( loginedUser.getUserid(), loginedUser.getAccount_name(), LogService.TYPE_UPDATE, gson.toJson(withdraw_log), utils.getIpAddrByRequest(request), "withdraw_log", loginedUser.getUserid() + "提现取消"); String capital = (loginedUser.getCapital() != null || !"".equals(loginedUser.getCapital())) ? loginedUser.getCapital() : "0"; capital = String.valueOf(Float.valueOf(capital) + withdraw_log.getCapital()); String withdraw = (loginedUser.getWithdraw() != null || !"".equals(loginedUser.getWithdraw())) ? loginedUser.getWithdraw() : "0"; withdraw = String.valueOf(Float.valueOf(withdraw) - withdraw_log.getCapital()); loginedUser.setCapital(capital); loginedUser.setWithdraw(withdraw); member_userService.update(loginedUser); logService.saveLog( loginedUser.getUserid(), loginedUser.getAccount_name(), LogService.TYPE_UPDATE, gson.toJson(loginedUser), utils.getIpAddrByRequest(request), "member_user", loginedUser.getUserid() + "更新" + loginedUser.getUserid() + "余额为" + loginedUser.getCapital()); Capital_log capital_log = new Capital_log(); capital_log.setMember_id(loginedUser.getUserid()); capital_log.setMember(loginedUser.getAccount_name()); capital_log.setNumber(loginedUser.getId()); capital_log.setOperation(0); capital_log.setIncome("" + withdraw_log.getCapital()); capital_log.setDetail("奖金提现" + withdraw_log.getCapital() + "--取消"); capital_log.setState(1); capital_log.setRemain(capital); capital_log.setTime(new Date()); capital_logService.save(capital_log); logService.saveLog( loginedUser.getUserid(), loginedUser.getAccount_name(), LogService.TYPE_CREATE, gson.toJson(capital_log), utils.getIpAddrByRequest(request), "capital_log", loginedUser.getUserid() + "提现取消,奖金收入记录+" + withdraw_log.getCapital()); } return "1"; }