| | |
| | | import com.yeshi.makemoney.app.service.inter.money.ExtractService; |
| | | import com.yeshi.makemoney.app.service.inter.money.UserExtractMoneyLimitService; |
| | | import com.yeshi.makemoney.app.service.inter.money.UserMoneyService; |
| | | import com.yeshi.makemoney.app.service.inter.user.UserInfoService; |
| | | import com.yeshi.makemoney.app.service.inter.user.WXUserInfoService; |
| | | import com.yeshi.makemoney.app.utils.ApiCodeConstant; |
| | | import com.yeshi.makemoney.app.utils.Constant; |
| | |
| | | private ExtractService extractService; |
| | | |
| | | @Resource |
| | | private UserInfoService userInfoService; |
| | | |
| | | @Resource |
| | | private UserExtractMoneyLimitService userExtractMoneyLimitService; |
| | | |
| | | private Gson gson = JsonUtil.getConvertBigDecimalToStringBuilder(new GsonBuilder()).create(); |
| | | private Gson gson = JsonUtil.getConvertBigDecimalToStringBuilder(new GsonBuilder()).create(); |
| | | |
| | | /** |
| | | * @return java.lang.String |
| | |
| | | @RequestMapping("getExtractInfo") |
| | | @ResponseBody |
| | | public String getExtractInfo(AcceptData acceptData, Long uid) { |
| | | UserInfo user = userInfoService.get(uid); |
| | | ExtractInfoVO vo = new ExtractInfoVO(); |
| | | vo.setBalance(userMoneyService.getBalance(uid).setScale(2)); |
| | | BigDecimal extracting = extractService.getExtractingMoney(uid); |
| | | if (extracting.compareTo(new BigDecimal(0)) > 0) { |
| | | vo.setExtracting(extracting.setScale(2).toString()); |
| | | } |
| | | vo.setNeedBindWX(wxUserInfoService.selectByUid(uid) == null); |
| | | vo.setNeedBindWX(user.getWxUser() == null); |
| | | return JsonUtil.loadTrueResult(gson.toJson(vo)); |
| | | } |
| | | |
| | |
| | | @RequestMapping("extract") |
| | | @ResponseBody |
| | | public String extract(AcceptData acceptData, Long uid, BigDecimal money, HttpServletRequest request) { |
| | | WXUserInfo wxUserInfo = wxUserInfoService.selectByUid(uid); |
| | | if (wxUserInfo == null) { |
| | | UserInfo user = userInfoService.get(uid); |
| | | |
| | | if (user.getWxUser() == null) { |
| | | return JsonUtil.loadFalseResult("尚未绑定微信"); |
| | | } |
| | | |
| | | WXUserInfo wxUserInfo = wxUserInfoService.get(user.getWxUser().getId()); |
| | | if (wxUserInfo == null) { |
| | | return JsonUtil.loadFalseResult("请重新绑定微信"); |
| | | } |
| | | |
| | | Extract extract = new Extract(); |
| | | extract.setUser(new UserInfo(uid)); |
| | | extract.setIp(IPUtil.getRemotIP(request) + ":" + request.getRemotePort()); |