|
@@ -2,6 +2,7 @@ package com.ym.mec.student.controller;
|
|
|
|
|
|
import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
|
|
+import com.ym.mec.auth.api.enums.SysUserType;
|
|
import com.ym.mec.biz.dal.dao.SysUserCashAccountDao;
|
|
import com.ym.mec.biz.dal.dao.SysUserCashAccountDao;
|
|
import com.ym.mec.biz.dal.dto.SporadicPayDto;
|
|
import com.ym.mec.biz.dal.dto.SporadicPayDto;
|
|
import com.ym.mec.biz.dal.entity.SporadicChargeInfo;
|
|
import com.ym.mec.biz.dal.entity.SporadicChargeInfo;
|
|
@@ -65,36 +66,36 @@ public class SporadicChargeInfoController extends BaseController {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- @ApiOperation(value = "零星支付")
|
|
|
|
- @PostMapping("/sporadicPay")
|
|
|
|
- public HttpResponseResult sporadicPay(@RequestBody SporadicPayDto sporadicPayDto) throws Exception {
|
|
|
|
- if(sporadicPayDto == null ||
|
|
|
|
- sporadicPayDto.getSporadicId() == null ||
|
|
|
|
- sporadicPayDto.getAmount() == null){
|
|
|
|
- throw new BizException("参数校验失败");
|
|
|
|
- }
|
|
|
|
- if(sporadicPayDto.getUserId() == null){
|
|
|
|
- SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
|
- if (sysUser == null || sysUser.getId() == null) {
|
|
|
|
- return failed("用户不存在");
|
|
|
|
- }
|
|
|
|
- if(!sysUser.getUserType().contains("STUDENT")){
|
|
|
|
- return failed("用户信息异常");
|
|
|
|
- }
|
|
|
|
- sporadicPayDto.setUserId(sysUser.getId());
|
|
|
|
- }
|
|
|
|
- if (sporadicPayDto.getIsRepeatPay() == false) {
|
|
|
|
|
|
+ @ApiOperation(value = "零星支付")
|
|
|
|
+ @PostMapping("/sporadicPay")
|
|
|
|
+ public HttpResponseResult sporadicPay(@RequestBody SporadicPayDto sporadicPayDto) throws Exception {
|
|
|
|
+ if (sporadicPayDto == null ||
|
|
|
|
+ sporadicPayDto.getSporadicId() == null ||
|
|
|
|
+ sporadicPayDto.getAmount() == null) {
|
|
|
|
+ throw new BizException("参数校验失败");
|
|
|
|
+ }
|
|
|
|
+ if (sporadicPayDto.getUserId() == null) {
|
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
|
+ if (sysUser == null || sysUser.getId() == null) {
|
|
|
|
+ return failed("用户不存在");
|
|
|
|
+ }
|
|
|
|
+ if (sysUser.getUserType() != SysUserType.STUDENT) {
|
|
|
|
+ return failed("用户信息异常");
|
|
|
|
+ }
|
|
|
|
+ sporadicPayDto.setUserId(sysUser.getId());
|
|
|
|
+ }
|
|
|
|
+ if (sporadicPayDto.getIsRepeatPay() == false) {
|
|
Integer ingOrder = studentPaymentOrderService.findOrderByGroupType(sporadicPayDto.getUserId(), sporadicPayDto.getSporadicId(), "SPORADIC", DealStatusEnum.ING);
|
|
Integer ingOrder = studentPaymentOrderService.findOrderByGroupType(sporadicPayDto.getUserId(), sporadicPayDto.getSporadicId(), "SPORADIC", DealStatusEnum.ING);
|
|
if (ingOrder != null && ingOrder > 0) {
|
|
if (ingOrder != null && ingOrder > 0) {
|
|
return failed(HttpStatus.CONTINUE, "您有待支付的订单");
|
|
return failed(HttpStatus.CONTINUE, "您有待支付的订单");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- Map payMap = musicGroupService.sporadicPay(sporadicPayDto);
|
|
|
|
- if(payMap.containsKey("tradeState")){
|
|
|
|
- return failed(HttpStatus.CREATED, "恭喜您,支付成功!");
|
|
|
|
- }
|
|
|
|
- return succeed(payMap);
|
|
|
|
- }
|
|
|
|
|
|
+ Map payMap = musicGroupService.sporadicPay(sporadicPayDto);
|
|
|
|
+ if (payMap.containsKey("tradeState")) {
|
|
|
|
+ return failed(HttpStatus.CREATED, "恭喜您,支付成功!");
|
|
|
|
+ }
|
|
|
|
+ return succeed(payMap);
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "福袋活动信息")
|
|
@ApiOperation(value = "福袋活动信息")
|
|
@@ -105,13 +106,18 @@ public class SporadicChargeInfoController extends BaseController {
|
|
if (sysUser == null || sysUser.getId() == null) {
|
|
if (sysUser == null || sysUser.getId() == null) {
|
|
return failed("请先登录");
|
|
return failed("请先登录");
|
|
}
|
|
}
|
|
- if (sysUser.getOrganId() == null) {
|
|
|
|
|
|
+ if (sysUser.getOrganId() == null || sysUser.getOrganId().isEmpty()) {
|
|
return failed("用户信息有误,没有分部信息");
|
|
return failed("用户信息有误,没有分部信息");
|
|
}
|
|
}
|
|
|
|
+ Integer organId = Integer.parseInt(sysUser.getOrganId());
|
|
|
|
+
|
|
if (type == null || type <= 0) {
|
|
if (type == null || type <= 0) {
|
|
return failed("参数不合法");
|
|
return failed("参数不合法");
|
|
}
|
|
}
|
|
- SporadicChargeInfo chargeInfo = sporadicChargeInfoService.findByOrganIdAndType(sysUser.getOrganId(), type);
|
|
|
|
|
|
+ SporadicChargeInfo chargeInfo = sporadicChargeInfoService.findByOrganIdAndType(organId, type);
|
|
|
|
+ if(chargeInfo == null){
|
|
|
|
+ return failed("分部活动不存在");
|
|
|
|
+ }
|
|
return succeed(chargeInfo);
|
|
return succeed(chargeInfo);
|
|
}
|
|
}
|
|
|
|
|