|
@@ -1,18 +1,24 @@
|
|
|
package com.ym.mec.student.controller;
|
|
|
|
|
|
-import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
|
-import com.ym.mec.auth.api.entity.SysUser;
|
|
|
-import com.ym.mec.biz.dal.entity.StudentWithdraw;
|
|
|
-import com.ym.mec.biz.service.StudentWithdrawService;
|
|
|
-import com.ym.mec.common.controller.BaseController;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
+
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.util.Date;
|
|
|
+
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
|
+import com.ym.mec.auth.api.entity.SysUser;
|
|
|
+import com.ym.mec.biz.dal.entity.StudentWithdraw;
|
|
|
+import com.ym.mec.biz.dal.enums.DealStatusEnum;
|
|
|
+import com.ym.mec.biz.service.StudentWithdrawService;
|
|
|
+import com.ym.mec.common.controller.BaseController;
|
|
|
+
|
|
|
/**
|
|
|
* @program: mec
|
|
|
* @description: 提现
|
|
@@ -24,21 +30,28 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
@Api(tags = "提现服务")
|
|
|
public class WithdrawController extends BaseController {
|
|
|
|
|
|
- @Autowired
|
|
|
- private StudentWithdrawService studentWithdrawService;
|
|
|
- @Autowired
|
|
|
- private SysUserFeignService sysUserFeignService;
|
|
|
+ @Autowired
|
|
|
+ private StudentWithdrawService studentWithdrawService;
|
|
|
+ @Autowired
|
|
|
+ private SysUserFeignService sysUserFeignService;
|
|
|
|
|
|
- @ApiOperation(value = "新增提现申请")
|
|
|
- @PostMapping("/add")
|
|
|
- @PreAuthorize("@pcs.hasPermissions('studentWithdraw/add')")
|
|
|
- public Object add(StudentWithdraw studentWithdraw) throws Exception {
|
|
|
- SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
- if(sysUser == null && sysUser.getId() == null){
|
|
|
- return failed("获取用户信息失败");
|
|
|
- }
|
|
|
- studentWithdraw.setUserId(sysUser.getId());
|
|
|
- studentWithdrawService.add(studentWithdraw);
|
|
|
- return succeed();
|
|
|
- }
|
|
|
+ @ApiOperation(value = "新增提现申请")
|
|
|
+ @PostMapping("/add")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('studentWithdraw/add')")
|
|
|
+ public Object add(String bankCardNo, BigDecimal amount) throws Exception {
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
+ if (sysUser == null || sysUser.getId() == null) {
|
|
|
+ return failed("获取用户信息失败");
|
|
|
+ }
|
|
|
+ Date date = new Date();
|
|
|
+ StudentWithdraw studentWithdraw = new StudentWithdraw();
|
|
|
+ studentWithdraw.setUserId(sysUser.getId());
|
|
|
+ studentWithdraw.setAmount(amount);
|
|
|
+ studentWithdraw.setBankCardNo(bankCardNo);
|
|
|
+ studentWithdraw.setModifyTime(date);
|
|
|
+ studentWithdraw.setCreateTime(date);
|
|
|
+ studentWithdraw.setStatus(DealStatusEnum.ING);
|
|
|
+ studentWithdrawService.add(studentWithdraw);
|
|
|
+ return succeed();
|
|
|
+ }
|
|
|
}
|