|
@@ -6,7 +6,9 @@ import com.ydtech.core.page.PageRequest;
|
|
|
import com.ydtech.core.page.PageResult;
|
|
import com.ydtech.core.page.PageResult;
|
|
|
import com.ydtech.modules.admin.model.SysDept;
|
|
import com.ydtech.modules.admin.model.SysDept;
|
|
|
import com.ydtech.modules.admin.model.SysUser;
|
|
import com.ydtech.modules.admin.model.SysUser;
|
|
|
|
|
+import com.ydtech.modules.admin.model.SysUserInfo;
|
|
|
import com.ydtech.modules.admin.service.SysDeptService;
|
|
import com.ydtech.modules.admin.service.SysDeptService;
|
|
|
|
|
+import com.ydtech.modules.admin.service.SysUserInfoService;
|
|
|
import com.ydtech.modules.admin.service.SysUserService;
|
|
import com.ydtech.modules.admin.service.SysUserService;
|
|
|
import com.ydtech.modules.base.controller.BaseController;
|
|
import com.ydtech.modules.base.controller.BaseController;
|
|
|
import com.ydtech.modules.esm.model.vo.ExtensionVO;
|
|
import com.ydtech.modules.esm.model.vo.ExtensionVO;
|
|
@@ -48,6 +50,8 @@ public class InsPayApplyController extends BaseController {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
SysUserService sysUserService;
|
|
SysUserService sysUserService;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
|
|
+ SysUserInfoService sysUserInfoService;
|
|
|
|
|
+ @Autowired
|
|
|
SysDeptService sysDeptService;
|
|
SysDeptService sysDeptService;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
InsCommissionService insCommissionService;
|
|
InsCommissionService insCommissionService;
|
|
@@ -117,6 +121,39 @@ public class InsPayApplyController extends BaseController {
|
|
|
return HttpResult.ok(pageResult);
|
|
return HttpResult.ok(pageResult);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 人员账户分页查询
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param pageRequest
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @PostMapping(value = "/findPageAccount")
|
|
|
|
|
+ public HttpResult findPageAccount(@RequestBody PageRequest pageRequest) {
|
|
|
|
|
+
|
|
|
|
|
+ int pageNum = pageRequest.getPageNum();
|
|
|
|
|
+ int pageSize = pageRequest.getPageSize();
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ String userid = pageRequest.getColumnFilterValue(pageRequest, "userid"); // 出单员
|
|
|
|
|
+ String deptid = pageRequest.getColumnFilterValue(pageRequest, "deptid"); // 所属机构
|
|
|
|
|
+
|
|
|
|
|
+ StringBuffer whereStr = new StringBuffer(" where 1=1");
|
|
|
|
|
+ ArrayList array = new ArrayList();
|
|
|
|
|
+
|
|
|
|
|
+ if (!StringUtils.isEmpty(userid)) {
|
|
|
|
|
+ whereStr.append(" and userid=?");
|
|
|
|
|
+ array.add(userid);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!StringUtils.isEmpty(deptid)) {
|
|
|
|
|
+ whereStr.append(" and deptid like ?");
|
|
|
|
|
+ array.add(deptid + "%");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ PageResult pageResult = insPayApplyService.selectAccountPaging(pageNum, pageSize, whereStr.toString(), array.toArray());
|
|
|
|
|
+
|
|
|
|
|
+ return HttpResult.ok(pageResult);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 查询提现详情
|
|
* 查询提现详情
|
|
|
*
|
|
*
|
|
@@ -270,7 +307,7 @@ public class InsPayApplyController extends BaseController {
|
|
|
|
|
|
|
|
AccountVo account = new AccountVo();
|
|
AccountVo account = new AccountVo();
|
|
|
//账户总金额
|
|
//账户总金额
|
|
|
- double sumAmount = insCommissionService.sumAmount(" where t.refereescode=? and t.auditstatus=?", new Object[]{userid, "1"});
|
|
|
|
|
|
|
+ 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 totalAmount = insPayApplyService.sumAmount(" where t.userid=? and t.applytype=?", new Object[]{userid, "B"});
|
|
|
//可提现余额
|
|
//可提现余额
|
|
@@ -293,58 +330,60 @@ public class InsPayApplyController extends BaseController {
|
|
|
return httpResult;
|
|
return httpResult;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// /**
|
|
|
|
|
-// * 推广费提现申请
|
|
|
|
|
-// *
|
|
|
|
|
-// * @param userid
|
|
|
|
|
-// * @param amount
|
|
|
|
|
-// * @return
|
|
|
|
|
-// */
|
|
|
|
|
-// @PostMapping(value = "/extendApply")
|
|
|
|
|
-// public HttpResult extendApply(@RequestParam String userid, @RequestParam double amount) {
|
|
|
|
|
-// HttpResult httpResult = new HttpResult();
|
|
|
|
|
-// //推广账户总金额
|
|
|
|
|
-// double sumAmount = insCommissionService.sumAmount(" where t.refereescode=? and t.auditstatus=?", new Object[]{userid, "1"});
|
|
|
|
|
-// //已提现金额
|
|
|
|
|
-// double totalAmount = insPayApplyService.sumAmount(" where t.userid=? and t.applytype=?", new Object[]{userid, "B"});
|
|
|
|
|
-// double accountBalance = sumAmount - totalAmount;
|
|
|
|
|
-//
|
|
|
|
|
-// if (amount > accountBalance) {
|
|
|
|
|
-// return HttpResult.error("可提现余额不足");
|
|
|
|
|
-// }
|
|
|
|
|
-// InsPayApply apply = new InsPayApply();
|
|
|
|
|
-// String applyno = IdGenerate.nextId();
|
|
|
|
|
-// SysUser user = sysUserService.getById(userid);
|
|
|
|
|
-// if (user == null) {
|
|
|
|
|
-// httpResult.setMsg("userId不存在");
|
|
|
|
|
-// return httpResult;
|
|
|
|
|
-// }
|
|
|
|
|
-// apply.setApplyno(applyno);
|
|
|
|
|
-// apply.setUserid(userid);
|
|
|
|
|
-// apply.setUsername(user.getName());
|
|
|
|
|
-// apply.setDeptid(user.getDeptId());
|
|
|
|
|
-// SysDept dept = sysDeptService.getById(user.getDeptId());
|
|
|
|
|
-// apply.setDeptname(dept == null ? "" : dept.getName());
|
|
|
|
|
-// BigDecimal decimal = new BigDecimal(accountBalance);
|
|
|
|
|
-// decimal = decimal.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
-// apply.setAccountbalance(decimal.doubleValue());
|
|
|
|
|
-// apply.setApplyamount(amount);
|
|
|
|
|
-// decimal = new BigDecimal(accountBalance - amount);
|
|
|
|
|
-// decimal = decimal.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
-// apply.setBalance(decimal.doubleValue());
|
|
|
|
|
-// apply.setDisrate("");
|
|
|
|
|
-// EsmUserInternal userInternal = esmUserInternalService.getById(userid);
|
|
|
|
|
-// apply.setBankname(userInternal.getBankname());
|
|
|
|
|
-// apply.setAccountno(userInternal.getAccountno());
|
|
|
|
|
-// apply.setApplystatus("0"); //0申请中 1支付中 2已支付
|
|
|
|
|
-// apply.setApplytype("B"); //A跟单绩效 B推广佣金
|
|
|
|
|
-// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
-// apply.setCreatetime(sdf.format(new Date()));
|
|
|
|
|
-//
|
|
|
|
|
-// insPayApplyService.insert(apply);
|
|
|
|
|
-//
|
|
|
|
|
-// return HttpResult.ok("保存成功");
|
|
|
|
|
-// }
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 推广费提现申请
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param userid
|
|
|
|
|
+ * @param amount
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @PostMapping(value = "/extendApply")
|
|
|
|
|
+ public HttpResult extendApply(@RequestParam String userid, @RequestParam double amount) {
|
|
|
|
|
+ HttpResult httpResult = new HttpResult();
|
|
|
|
|
+ //推广账户总金额
|
|
|
|
|
+ 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;
|
|
|
|
|
+
|
|
|
|
|
+ if (amount > accountBalance) {
|
|
|
|
|
+ return HttpResult.error("可提现余额不足");
|
|
|
|
|
+ }
|
|
|
|
|
+ InsPayApply apply = new InsPayApply();
|
|
|
|
|
+ String applyno = IdGenerate.nextId();
|
|
|
|
|
+ SysUser user = sysUserService.getById(userid);
|
|
|
|
|
+ if (user == null) {
|
|
|
|
|
+ httpResult.setMsg("userId不存在");
|
|
|
|
|
+ return httpResult;
|
|
|
|
|
+ }
|
|
|
|
|
+ apply.setApplyno(applyno);
|
|
|
|
|
+ apply.setUserid(userid);
|
|
|
|
|
+ apply.setUsername(user.getName());
|
|
|
|
|
+ apply.setDeptid(user.getDeptId());
|
|
|
|
|
+ SysDept dept = sysDeptService.getById(user.getDeptId());
|
|
|
|
|
+ apply.setDeptname(dept == null ? "" : dept.getName());
|
|
|
|
|
+ BigDecimal decimal = new BigDecimal(accountBalance);
|
|
|
|
|
+ decimal = decimal.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
+ apply.setAccountbalance(decimal.doubleValue());
|
|
|
|
|
+ apply.setApplyamount(amount);
|
|
|
|
|
+ decimal = new BigDecimal(accountBalance - amount);
|
|
|
|
|
+ decimal = decimal.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
+ apply.setBalance(decimal.doubleValue());
|
|
|
|
|
+ apply.setDisrate("");
|
|
|
|
|
+
|
|
|
|
|
+ //查询详情信息
|
|
|
|
|
+ SysUserInfo userInfo = sysUserInfoService.getById(userid);
|
|
|
|
|
+ apply.setBankname(userInfo.getBankName());
|
|
|
|
|
+ apply.setAccountno(userInfo.getAccountno());
|
|
|
|
|
+ apply.setApplystatus("0"); //0申请中 1支付中 2已支付
|
|
|
|
|
+ apply.setApplytype("B"); //A跟单绩效 B推广佣金
|
|
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
+ apply.setCreatetime(sdf.format(new Date()));
|
|
|
|
|
+
|
|
|
|
|
+ insPayApplyService.insert(apply);
|
|
|
|
|
+
|
|
|
|
|
+ return HttpResult.ok("保存成功");
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 提现账户
|
|
* 提现账户
|
|
@@ -358,7 +397,7 @@ public class InsPayApplyController extends BaseController {
|
|
|
AccountVo account = new AccountVo();
|
|
AccountVo account = new AccountVo();
|
|
|
|
|
|
|
|
//账户总金额
|
|
//账户总金额
|
|
|
- double sumAmount = insCompanyFeeService.sumAmount(" where t.userid=? and t.settlestatus=?", new Object[]{userid, "1"});
|
|
|
|
|
|
|
+ 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 totalAmount = insPayApplyService.sumAmount(" where t.userid=? and t.applytype=?", new Object[]{userid, "A"});
|
|
|
//可提现余额
|
|
//可提现余额
|
|
@@ -378,57 +417,58 @@ public class InsPayApplyController extends BaseController {
|
|
|
return httpResult;
|
|
return httpResult;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// /**
|
|
|
|
|
-// * 提现申请
|
|
|
|
|
-// *
|
|
|
|
|
-// * @param userid
|
|
|
|
|
-// * @param amount
|
|
|
|
|
-// * @return
|
|
|
|
|
-// */
|
|
|
|
|
-// @PostMapping(value = "/applyPay")
|
|
|
|
|
-// public HttpResult applyPay(@RequestParam String userid, @RequestParam double amount) {
|
|
|
|
|
-// HttpResult httpResult = new HttpResult();
|
|
|
|
|
-// //账户总金额
|
|
|
|
|
-// double sumAmount = insCompanyFeeService.sumAmount(" where t.userid=? and t.settlestatus=?", new Object[]{userid, "1"});
|
|
|
|
|
-// //已提现金额
|
|
|
|
|
-// double applyAmount = insPayApplyService.sumAmount(" where t.userid=? and t.applytype=?", new Object[]{userid, "A"});
|
|
|
|
|
-// double accountBalance = sumAmount - applyAmount;
|
|
|
|
|
-// if (amount > accountBalance) {
|
|
|
|
|
-// return HttpResult.error("可提现余额不足");
|
|
|
|
|
-// }
|
|
|
|
|
-// InsPayApply apply = new InsPayApply();
|
|
|
|
|
-// String applyno = IdGenerate.nextId();
|
|
|
|
|
-// SysUser user = sysUserService.getById(userid);
|
|
|
|
|
-// if (user == null) {
|
|
|
|
|
-// httpResult.setMsg("userId不存在");
|
|
|
|
|
-// return httpResult;
|
|
|
|
|
-// }
|
|
|
|
|
-// apply.setApplyno(applyno);
|
|
|
|
|
-// apply.setUserid(userid);
|
|
|
|
|
-// apply.setUsername(user.getName());
|
|
|
|
|
-// apply.setDeptid(user.getDeptId());
|
|
|
|
|
-// SysDept dept = sysDeptService.getById(user.getDeptId());
|
|
|
|
|
-// apply.setDeptname(dept == null ? "" : dept.getName());
|
|
|
|
|
-// BigDecimal decimal = new BigDecimal(accountBalance);
|
|
|
|
|
-// decimal = decimal.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
-// apply.setAccountbalance(decimal.doubleValue());
|
|
|
|
|
-// apply.setApplyamount(amount);
|
|
|
|
|
-// decimal = new BigDecimal(accountBalance - amount);
|
|
|
|
|
-// decimal = decimal.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
-// apply.setBalance(decimal.doubleValue());
|
|
|
|
|
-// apply.setDisrate("");
|
|
|
|
|
-// EsmUserInternal userInternal = esmUserInternalService.getById(userid);
|
|
|
|
|
-// apply.setBankname(userInternal.getBankname());
|
|
|
|
|
-// apply.setAccountno(userInternal.getAccountno());
|
|
|
|
|
-// apply.setApplystatus("0"); //0申请中 1支付中 2已支付
|
|
|
|
|
-// apply.setApplytype("A"); //A跟单绩效 B推广佣金
|
|
|
|
|
-// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
-// apply.setCreatetime(sdf.format(new Date()));
|
|
|
|
|
-//
|
|
|
|
|
-// insPayApplyService.insert(apply);
|
|
|
|
|
-//
|
|
|
|
|
-// return HttpResult.ok("保存成功");
|
|
|
|
|
-// }
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 提现申请
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param userid
|
|
|
|
|
+ * @param amount
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @PostMapping(value = "/applyPay")
|
|
|
|
|
+ public HttpResult applyPay(@RequestParam String userid, @RequestParam double amount) {
|
|
|
|
|
+ HttpResult httpResult = new HttpResult();
|
|
|
|
|
+ //账户总金额
|
|
|
|
|
+ double sumAmount = insCompanyFeeService.sumAmount(" where t.userid=? ", new Object[]{userid});
|
|
|
|
|
+ //已提现金额
|
|
|
|
|
+ double applyAmount = insPayApplyService.sumAmount(" where t.userid=? and t.applytype=?", new Object[]{userid, "A"});
|
|
|
|
|
+ double accountBalance = sumAmount - applyAmount;
|
|
|
|
|
+ if (amount > accountBalance) {
|
|
|
|
|
+ return HttpResult.error("可提现余额不足");
|
|
|
|
|
+ }
|
|
|
|
|
+ InsPayApply apply = new InsPayApply();
|
|
|
|
|
+ String applyno = IdGenerate.nextId();
|
|
|
|
|
+ SysUser user = sysUserService.getById(userid);
|
|
|
|
|
+ if (user == null) {
|
|
|
|
|
+ httpResult.setMsg("userId不存在");
|
|
|
|
|
+ return httpResult;
|
|
|
|
|
+ }
|
|
|
|
|
+ apply.setApplyno(applyno);
|
|
|
|
|
+ apply.setUserid(userid);
|
|
|
|
|
+ apply.setUsername(user.getName());
|
|
|
|
|
+ apply.setDeptid(user.getDeptId());
|
|
|
|
|
+ SysDept dept = sysDeptService.getById(user.getDeptId());
|
|
|
|
|
+ apply.setDeptname(dept == null ? "" : dept.getName());
|
|
|
|
|
+ BigDecimal decimal = new BigDecimal(accountBalance);
|
|
|
|
|
+ decimal = decimal.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
+ apply.setAccountbalance(decimal.doubleValue());
|
|
|
|
|
+ apply.setApplyamount(amount);
|
|
|
|
|
+ decimal = new BigDecimal(accountBalance - amount);
|
|
|
|
|
+ decimal = decimal.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
+ apply.setBalance(decimal.doubleValue());
|
|
|
|
|
+ apply.setDisrate("");
|
|
|
|
|
+ //查询详情信息
|
|
|
|
|
+ SysUserInfo userInfo = sysUserInfoService.getById(userid);
|
|
|
|
|
+ apply.setBankname(userInfo.getBankName());
|
|
|
|
|
+ apply.setAccountno(userInfo.getAccountno());
|
|
|
|
|
+ apply.setApplystatus("0"); //0申请中 1支付中 2已支付
|
|
|
|
|
+ apply.setApplytype("A"); //A跟单绩效 B推广佣金
|
|
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
+ apply.setCreatetime(sdf.format(new Date()));
|
|
|
|
|
+
|
|
|
|
|
+ insPayApplyService.insert(apply);
|
|
|
|
|
+
|
|
|
|
|
+ return HttpResult.ok("保存成功");
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 提现审核
|
|
* 提现审核
|