Forráskód Böngészése

Merge remote-tracking branch 'origin/master'

周箭河 5 éve
szülő
commit
69d1e77dfd

+ 0 - 5
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentWithdrawServiceImpl.java

@@ -59,13 +59,10 @@ public class StudentWithdrawServiceImpl extends BaseServiceImpl<String, StudentW
 	@Autowired
 	private SysUserCashAccountDetailService accountDetailService;
 
-	private Lock lock = new ReentrantLock();
-
 	@Override
 	@Transactional(rollbackFor = Exception.class)
 	public boolean confirmWithdraw(WithdrawDto withdrawDto) {
 		try {
-			lock.lock();
 			SysUserCashAccount sysUserCashAccount = cashAccountService.get(withdrawDto.getUserId().intValue());
 			if (Objects.isNull(sysUserCashAccount)){
 				throw new BizException("账户不存在!");
@@ -86,8 +83,6 @@ public class StudentWithdrawServiceImpl extends BaseServiceImpl<String, StudentW
 		} catch (Exception e) {
 			log.error("用户提现出现异常 {}", e.getMessage(), e);
 			throw new BizException(e.getMessage());
-		} finally {
-			lock.unlock();
 		}
 		return true;
 	}

+ 34 - 21
mec-student/src/main/java/com/ym/mec/student/controller/WithdrawController.java

@@ -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();
+	}
 }

+ 10 - 13
mec-web/src/main/java/com/ym/mec/web/controller/StudentWithdrawController.java

@@ -1,14 +1,19 @@
 package com.ym.mec.web.controller;
 
-import com.ym.mec.biz.dal.dto.CashAccountDetail;
-import com.ym.mec.biz.dal.dto.WithdrawDto;
-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 org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.ym.mec.biz.dal.dto.WithdrawDto;
+import com.ym.mec.biz.service.StudentWithdrawService;
+import com.ym.mec.common.controller.BaseController;
 
 @RequestMapping("studentWithdraw")
 @Api(tags = "提现服务")
@@ -27,14 +32,6 @@ public class StudentWithdrawController extends BaseController {
         return succeed();
     }
 
-    @PostMapping("page")
-    @ApiOperation(value = "学员提现详情")
-    @PreAuthorize("@pcs.hasPermissions('studentWithdraw/page')")
-    public Object getInfo(@RequestBody CashAccountDetail cashAccountDetail) {
-        return succeed(studentWithdrawService.queryWithdrawPage(cashAccountDetail));
-    }
-
-
     @ApiOperation(value = "分页查询")
     @GetMapping("/queryPage")
     @PreAuthorize("@pcs.hasPermissions('studentWithdraw/queryPage')")