Browse Source

活动排课

zouxuan 4 years ago
parent
commit
c9e635d59e

+ 2 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/PracticeGroupService.java

@@ -397,4 +397,6 @@ public interface PracticeGroupService extends BaseService<Long, PracticeGroup> {
 	* @date 2021/10/15 14:43
 	*/
 	Integer countTeacherPracticeGroups(Integer teacherId);
+
+	Object getPracticeGroupPayInfo(Long practiceGroupId, Integer userId);
 }

+ 18 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/PracticeGroupServiceImpl.java

@@ -5309,4 +5309,22 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
     public Integer countTeacherPracticeGroups(Integer teacherId) {
         return practiceGroupDao.countTeacherPracticeGroups(teacherId);
     }
+
+    @Override
+    public Object getPracticeGroupPayInfo(Long practiceGroupId, Integer userId) {
+        PracticeGroup practiceGroup = practiceGroupDao.get(practiceGroupId);
+        if(Objects.isNull(practiceGroup)){
+            throw new BizException("未找到此课程");
+        }
+        VipGroupPayInfoDto vipGroupPayInfo = new VipGroupPayInfoDto();
+        vipGroupPayInfo.setVipGroupId(practiceGroupId.intValue());
+        vipGroupPayInfo.setViipGroupName(practiceGroup.getName());
+        vipGroupPayInfo.setPrice(practiceGroup.getTotalPrice());
+        SysUserCashAccount sysUserCashAccount = sysUserCashAccountService.get(userId);
+        if(Objects.isNull(sysUserCashAccount)){
+            throw new BizException("当前用户没有现金账户");
+        }
+        vipGroupPayInfo.setBalance(sysUserCashAccount.getBalance());
+        return vipGroupPayInfo;
+    }
 }

+ 10 - 0
mec-student/src/main/java/com/ym/mec/student/controller/PracticeGroupController.java

@@ -268,6 +268,16 @@ public class PracticeGroupController extends BaseController {
         }
     }
 
+    @ApiOperation(value = "获取网管课购买信息")
+    @PostMapping("/getPracticeGroupPayInfo")
+    public Object getPracticeGroupPayInfo(Long vipGroupId){
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (null == sysUser) {
+            return failed(HttpStatus.FORBIDDEN, "请登录");
+        }
+        return succeed(practiceGroupService.getPracticeGroupPayInfo(vipGroupId,sysUser.getId()));
+    }
+
     @ApiOperation("营销活动购买")
     @PostMapping(value = "/buyActivity")
     @AuditLogAnnotation(operateName = "营销活动购买")