zouxuan 5 years ago
parent
commit
cf8142334d

+ 7 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/PracticeLessonApplyService.java

@@ -19,4 +19,11 @@ public interface PracticeLessonApplyService extends BaseService<Integer, Practic
      * @return
      */
     Map<String, Object> practiceSum();
+
+    /**
+     * 新增记录
+     * @param memo
+     * @return
+     */
+    void add(String memo);
 }

+ 25 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/PracticeLessonApplyServiceImpl.java

@@ -1,7 +1,10 @@
 package com.ym.mec.biz.service.impl;
 
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.CourseScheduleStudentPaymentDao;
 import com.ym.mec.biz.dal.dto.PracticeSumDto;
+import com.ym.mec.common.exception.BizException;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -10,11 +13,9 @@ import com.ym.mec.biz.dal.entity.PracticeLessonApply;
 import com.ym.mec.biz.service.PracticeLessonApplyService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
+import org.springframework.transaction.annotation.Transactional;
 
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
 
 @Service
 public class PracticeLessonApplyServiceImpl extends BaseServiceImpl<Integer, PracticeLessonApply>  implements PracticeLessonApplyService {
@@ -23,6 +24,8 @@ public class PracticeLessonApplyServiceImpl extends BaseServiceImpl<Integer, Pra
 	private PracticeLessonApplyDao practiceLessonApplyDao;
 	@Autowired
 	private CourseScheduleStudentPaymentDao scheduleStudentPaymentDao;
+	@Autowired
+	private SysUserFeignService sysUserFeignService;
 
 	@Override
 	public BaseDAO<Integer, PracticeLessonApply> getDAO() {
@@ -50,4 +53,22 @@ public class PracticeLessonApplyServiceImpl extends BaseServiceImpl<Integer, Pra
 		map.put("practiceSumDtos",practiceSumDtos);
 		return map;
 	}
+
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public synchronized void add(String memo) {
+		SysUser sysUser = sysUserFeignService.queryUserInfo();
+		if (sysUser == null) {
+			throw new BizException("获取用户信息失败");
+		}
+		PracticeLessonApply practiceLessonApply = new PracticeLessonApply();
+		practiceLessonApply.setCreateTime(new Date());
+		practiceLessonApply.setMemo(memo);
+		practiceLessonApply.setUserId(sysUser.getId());
+		PracticeLessonApply lessonApply = practiceLessonApplyDao.findByUserId(sysUser.getId());
+		if(lessonApply != null){
+			throw new BizException("您已申请过陪练课!");
+		}
+		practiceLessonApplyDao.insert(practiceLessonApply);
+	}
 }

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

@@ -358,6 +358,11 @@ public class StudentManageServiceImpl implements StudentManageService {
 
     @Override
     public List<StudentHasCourseDto> queryHasCourseStudent(String organId) {
+//        Set<Integer> musicUserIds = scheduleStudentPaymentDao.queryMusicStudentPer();
+//        Set<Integer> vipUserIds = scheduleStudentPaymentDao.queryVipStudentPer();
+//        musicUserIds.addAll(vipUserIds);
+        //学员编号", "姓名", "分部", "所在乐团", "乐团所属声部", "所在vip课","是否激活","是否预约
+        //获取编号,姓名,分部,"是否激活","是否预约
         return studentManageDao.queryHasCourseStudent(organId);
     }
 

+ 2 - 13
mec-student/src/main/java/com/ym/mec/student/controller/PracticeLessonApplyController.java

@@ -32,19 +32,8 @@ public class PracticeLessonApplyController extends BaseController {
 	@ApiOperation("新增陪练课申请")
 	@PostMapping(value = "add")
 	public Object add(String memo) {
-		SysUser sysUser = sysUserFeignService.queryUserInfo();
-		if (sysUser == null) {
-			return failed("获取用户信息失败");
-		}
-		PracticeLessonApply lessonApply = practiceLessonApplyService.findByUserId(sysUser.getId());
-		if(lessonApply != null){
-			throw new BizException("您已申请过陪练课!");
-		}
-		PracticeLessonApply practiceLessonApply = new PracticeLessonApply();
-		practiceLessonApply.setCreateTime(new Date());
-		practiceLessonApply.setMemo(memo);
-		practiceLessonApply.setUserId(sysUser.getId());
-		return succeed(practiceLessonApplyService.insert(practiceLessonApply));
+		practiceLessonApplyService.add(memo);
+		return succeed();
 	}
 
 	@ApiOperation("根据用户编号查询是否申请过")