| | |
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail.UserMoneyDetailTypeEnum;
|
| | | import com.yeshi.fanli.exception.user.UserInfoExtraException;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoV2Service;
|
| | | import com.yeshi.fanli.service.inter.user.ExtractService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | |
| | |
|
| | | @Resource
|
| | | private UserInfoExtraService userInfoExtraService;
|
| | |
|
| | | @Resource
|
| | | private ConfigService configService;
|
| | |
|
| | | /**
|
| | | * 新版资金详情(1.4.9)
|
| | |
| | | });
|
| | |
|
| | | // 获取提现中的信息
|
| | |
|
| | | BigDecimal extractingMoney = extractService.sumVerifyingMoney(uid);
|
| | | if (extractingMoney.compareTo(new BigDecimal(0)) > 0)
|
| | | vo.setExtractingMoneyInfo("提现中:¥" + extractingMoney.setScale(2));
|
| | |
| | | else
|
| | | vo.setAutoExtract(false);
|
| | |
|
| | | vo.setAutoExtractHelpUrl(configService.get("auto_extract_help_url"));
|
| | | out.print(JsonUtil.loadTrueResult(builder.create().toJson(vo)));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 自动提现
|
| | | * |
| | | * @param acceptData
|
| | | * @param type
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping("autoExtract")
|
| | | public void autoExtract(AcceptData acceptData, Long uid, Integer type, PrintWriter out) {
|
| | | if (type == null) {
|
| | | out.print(JsonUtil.loadFalseResult("请上传type"));
|
| | | return;
|
| | | }
|
| | | if (uid == null) {
|
| | | out.print(JsonUtil.loadFalseResult("用戶未登录"));
|
| | | return;
|
| | | }
|
| | |
|
| | | UserInfoExtra userExtra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | UserInfo user = userInfoService.selectByPKey(uid);
|
| | | if (user == null) {
|
| | | out.print(JsonUtil.loadFalseResult("用戶不存在"));
|
| | | return;
|
| | | }
|
| | | if (type == 1)// 开启
|
| | | {
|
| | | if (userExtra.getAutoExtract() == null || userExtra.getAutoExtract() == false) {
|
| | | if (StringUtil.isNullOrEmpty(user.getWxUnionId()))// 尚未綁定微信
|
| | | {
|
| | | out.print(JsonUtil.loadFalseResult("未綁定微信"));
|
| | | return;
|
| | | }
|
| | | // 设置自动提现
|
| | | UserInfoExtra update = new UserInfoExtra();
|
| | | update.setId(userExtra.getId());
|
| | | update.setAutoExtract(true);
|
| | | try {
|
| | | userInfoExtraService.saveUserInfoExtra(update);
|
| | | } catch (UserInfoExtraException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | out.print(JsonUtil.loadTrueResult(""));
|
| | | return;
|
| | | } else {
|
| | | out.print(JsonUtil.loadTrueResult(""));
|
| | | return;
|
| | | }
|
| | | } else {// 关闭
|
| | | UserInfoExtra update = new UserInfoExtra();
|
| | | update.setId(userExtra.getId());
|
| | | update.setAutoExtract(false);
|
| | | try {
|
| | | userInfoExtraService.saveUserInfoExtra(update);
|
| | | } catch (UserInfoExtraException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | out.print(JsonUtil.loadTrueResult(""));
|
| | | return;
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | }
|