|
|
@@ -1,7 +1,6 @@
|
|
|
package com.ydtech.modules.ins.controller;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.ydtech.core.page.HttpResult;
|
|
|
import com.ydtech.core.page.PageRequest;
|
|
|
import com.ydtech.core.page.PageResult;
|
|
|
@@ -225,7 +224,7 @@ public class InsPayApplyController extends BaseController {
|
|
|
decimal = decimal.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
account.setAccountBalance(decimal.doubleValue());
|
|
|
account.setTotalAmount(totalAmount);
|
|
|
- account.setPayamount(payamount);
|
|
|
+ account.setPayAmount(payamount);
|
|
|
decimal = new BigDecimal(totalAmount - payamount);
|
|
|
decimal = decimal.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
account.setApplyAmount(decimal.doubleValue());
|
|
|
@@ -308,31 +307,41 @@ public class InsPayApplyController extends BaseController {
|
|
|
/**
|
|
|
* 推广账户
|
|
|
*
|
|
|
- * @param userid
|
|
|
* @return
|
|
|
*/
|
|
|
- @GetMapping(value = "/extendAccount")
|
|
|
- public HttpResult extendAccount(@RequestParam String userid) {
|
|
|
+ @PostMapping(value = "/extendAccount")
|
|
|
+ public HttpResult extendAccount(@RequestBody PageRequest pageRequest){
|
|
|
HttpResult httpResult = new HttpResult();
|
|
|
-
|
|
|
+ String userid=getUserId();
|
|
|
AccountVo account = new AccountVo();
|
|
|
+ String startdate = pageRequest.getColumnFilterValue(pageRequest, "startdate"); // 开始时间
|
|
|
+ String enddate = pageRequest.getColumnFilterValue(pageRequest, "enddate"); // 截止时间
|
|
|
+ StringBuffer whereStr = new StringBuffer(" where refereescode=? ");
|
|
|
+ ArrayList array = new ArrayList();
|
|
|
+ array.add(userid);
|
|
|
+ if (!org.springframework.util.StringUtils.isEmpty(startdate) && !org.springframework.util.StringUtils.isEmpty(enddate)) {
|
|
|
+ whereStr.append(" and DATE_FORMAT(signdate, '%Y-%m-%d') between DATE_FORMAT(?, '%Y-%m-%d') and DATE_FORMAT(?, '%Y-%m-%d') ");
|
|
|
+ array.add(startdate);
|
|
|
+ array.add(enddate);
|
|
|
+ }
|
|
|
//账户总金额
|
|
|
- double sumAmount = insCommissionService.sumAmount(" where t.refereescode=?", new Object[]{userid});
|
|
|
- //已提现金额
|
|
|
- double totalAmount = insPayApplyService.sumAmount(" where t.userid=? and t.applytype=?", new Object[]{userid, "B"});
|
|
|
- //可提现余额
|
|
|
- double accountBalance = sumAmount - totalAmount;
|
|
|
+ double totalAmount = insCommissionService.sumAmount( whereStr.toString(), array.toArray());
|
|
|
+ //提现中金额
|
|
|
+ StringBuffer whereStr_apy=whereStr.append(" and exists (select 1 from ins_pay_apply b on t.applyno =b.applyno) ");
|
|
|
+ double applyAmount = insCommissionService.sumAmount( whereStr_apy.toString(), array.toArray());
|
|
|
+ //可用余额(可提现金额)
|
|
|
+ double accountBalance = totalAmount - applyAmount;
|
|
|
//已到账
|
|
|
- double payamount = insPayApplyService.sumAmount(" where t.userid=? and applystatus=? and t.applytype=?", new Object[]{userid, "2", "B"});
|
|
|
-
|
|
|
+ StringBuffer whereStr_pay=whereStr.append(" and exists (select 1 from ins_pay_apply b on t.applyno =b.applyno and b.applystatus='2') ");
|
|
|
+ double payamount = insCommissionService.sumAmount( whereStr_pay.toString(), array.toArray());
|
|
|
BigDecimal decimal = new BigDecimal(accountBalance);
|
|
|
decimal = decimal.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
- account.setAccountBalance(decimal.doubleValue());
|
|
|
- account.setTotalAmount(totalAmount);
|
|
|
- account.setPayamount(payamount);
|
|
|
- decimal = new BigDecimal(totalAmount - payamount);
|
|
|
- decimal = decimal.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
- account.setApplyAmount(decimal.doubleValue());
|
|
|
+ account.setTotalAmount(totalAmount);//账户总金额
|
|
|
+ account.setApplyAmount(applyAmount);//提现中金额
|
|
|
+ account.setPayAmount(payamount);//已到账金额
|
|
|
+ BigDecimal payingAmount = new BigDecimal(applyAmount - payamount).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ account.setPayingAmount(payingAmount.doubleValue());//支付中
|
|
|
+ account.setAccountBalance(decimal.doubleValue());//可用余额(可提现金额)
|
|
|
|
|
|
|
|
|
httpResult.setData(account);
|
|
|
@@ -405,31 +414,42 @@ public class InsPayApplyController extends BaseController {
|
|
|
|
|
|
/**
|
|
|
* 提现账户
|
|
|
- *
|
|
|
- * @param userid
|
|
|
* @return
|
|
|
*/
|
|
|
- @GetMapping(value = "/payAccount")
|
|
|
- public HttpResult payAccount(@RequestParam String userid) {
|
|
|
+ @PostMapping(value = "/payAccount")
|
|
|
+ public HttpResult payAccount(@RequestBody PageRequest pageRequest) {
|
|
|
HttpResult httpResult = new HttpResult();
|
|
|
AccountVo account = new AccountVo();
|
|
|
-
|
|
|
+ String userid=getUserId();
|
|
|
+ String startdate = pageRequest.getColumnFilterValue(pageRequest, "startdate"); // 开始时间
|
|
|
+ String enddate = pageRequest.getColumnFilterValue(pageRequest, "enddate"); // 截止时间
|
|
|
+ StringBuffer whereStr = new StringBuffer(" where t.userid=? ");
|
|
|
+ ArrayList array = new ArrayList();
|
|
|
+ array.add(userid);
|
|
|
+ if (!org.springframework.util.StringUtils.isEmpty(startdate) && !org.springframework.util.StringUtils.isEmpty(enddate)) {
|
|
|
+ whereStr.append(" and DATE_FORMAT(signdate, '%Y-%m-%d') between DATE_FORMAT(?, '%Y-%m-%d') and DATE_FORMAT(?, '%Y-%m-%d') ");
|
|
|
+ array.add(startdate);
|
|
|
+ array.add(enddate);
|
|
|
+ }
|
|
|
//账户总金额
|
|
|
- double sumAmount = insCompanyFeeService.sumAmount(" where t.userid=?", new Object[]{userid});
|
|
|
- //已提现金额
|
|
|
- double totalAmount = insPayApplyService.sumAmount(" where t.userid=? and t.applytype=?", new Object[]{userid, "A"});
|
|
|
- //可提现余额
|
|
|
- double accountBalance = sumAmount - totalAmount;
|
|
|
+ double totalAmount = insCompanyFeeService.sumAmount( whereStr.toString(), array.toArray());
|
|
|
+ //提现中金额
|
|
|
+ StringBuffer whereStr_apy=whereStr.append(" and exists (select 1 from ins_pay_apply b on t.applyno =b.applyno) ");
|
|
|
+ double applyAmount = insCompanyFeeService.sumAmount( whereStr_apy.toString(), array.toArray());
|
|
|
+ //可用余额(可提现金额)
|
|
|
+ double accountBalance = totalAmount - applyAmount;
|
|
|
//已到账
|
|
|
- double payamount = insPayApplyService.sumAmount(" where t.userid=? and applystatus=? and t.applytype=?", new Object[]{userid, "2", "A"});
|
|
|
+ StringBuffer whereStr_pay=whereStr.append(" and exists (select 1 from ins_pay_apply b on t.applyno =b.applyno and b.applystatus='2') ");
|
|
|
+ double payamount = insCompanyFeeService.sumAmount( whereStr_pay.toString(), array.toArray());
|
|
|
BigDecimal decimal = new BigDecimal(accountBalance);
|
|
|
decimal = decimal.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
- account.setAccountBalance(decimal.doubleValue());
|
|
|
- account.setTotalAmount(totalAmount);
|
|
|
- account.setPayamount(payamount);
|
|
|
- decimal = new BigDecimal(totalAmount - payamount);
|
|
|
- decimal = decimal.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
- account.setApplyAmount(Math.abs(decimal.doubleValue()));
|
|
|
+ account.setTotalAmount(totalAmount);//账户总金额
|
|
|
+ account.setApplyAmount(applyAmount);//提现中金额
|
|
|
+ account.setPayAmount(payamount);//已到账金额
|
|
|
+ BigDecimal payingAmount = new BigDecimal(applyAmount - payamount).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ account.setPayingAmount(payingAmount.doubleValue());//支付中
|
|
|
+ account.setAccountBalance(decimal.doubleValue());//可用余额(可提现金额)
|
|
|
+
|
|
|
httpResult.setData(account);
|
|
|
|
|
|
return httpResult;
|