Преглед на файлове

Merge branch 'children_day'

周箭河 преди 4 години
родител
ревизия
979efd5c6d

+ 5 - 8
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ChildrenDayReserveServiceImpl.java

@@ -187,11 +187,15 @@ public class ChildrenDayReserveServiceImpl extends BaseServiceImpl<Integer, Chil
             }
         }
 
+        //获取课程的价格
+        OrganizationDegreeCourseFee courseFee = organizationDegreeCourseFeeDao.getByOrganId(degreePayDto.getOrganId());
+
         //检查已经购买的课程(不能重复)
         details = childrenDayDegreeDetailService.getByUserIdAndStatus(degreePayDto.getUserId(), 2);
         Set<Integer> detailTypes = details.stream().map(ChildrenDayDegreeDetail::getType).collect(Collectors.toSet());
 
-        if (degreePayDto.getTheoryLevel() != null && degreePayDto.getTheoryLevel() > 0 && !degreePayDto.getTheoryCourse() && !detailTypes.contains(5)) {
+        if (degreePayDto.getTheoryLevel() != null && degreePayDto.getTheoryLevel() > 0 &&
+                courseFee != null && !degreePayDto.getTheoryCourse() && !detailTypes.contains(5)) {
             throw new BizException("参加乐理考试,请选乐理考级专项训练课");
         }
 
@@ -238,13 +242,6 @@ public class ChildrenDayReserveServiceImpl extends BaseServiceImpl<Integer, Chil
         }
         degreePayDto.setReserveId(userReserve.getId());
 
-        //获取课程的价格
-        OrganizationDegreeCourseFee courseFee = organizationDegreeCourseFeeDao.getByOrganId(degreePayDto.getOrganId());
-
-        if (courseFee == null) {
-            throw new BizException("当前分部不参与,谢谢关注");
-        }
-
         List<DegreeLevelFee> degreeLevelFees = degreeLevelFeeDao.getAll();
 
         //订单总金额

+ 5 - 2
mec-student/src/main/java/com/ym/mec/student/controller/ChildrenDayDegreeDetailController.java

@@ -11,12 +11,14 @@ import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.Arrays;
 import java.util.List;
 import java.util.Objects;
 
@@ -43,8 +45,9 @@ public class ChildrenDayDegreeDetailController extends BaseController {
         childrenDayDetailDto.setUser(user);
         childrenDayDetailDto.setChildrenDayDegreeDetails(userDegreeInfo);
         Student student = studentDao.get(user.getId());
-        if (student != null) {
-            childrenDayDetailDto.setSubjectId(Integer.parseInt(student.getSubjectIdList()));
+        if (student != null && StringUtils.isNotBlank(student.getSubjectIdList())) {
+            List<String> subjectIds = Arrays.asList(student.getSubjectIdList().split(","));
+            childrenDayDetailDto.setSubjectId(Integer.parseInt(subjectIds.get(0)));
         }
         return succeed(childrenDayDetailDto);
     }