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