|
@@ -89,6 +89,8 @@ public class CoursesGroupServiceImpl extends BaseServiceImpl<Long, CoursesGroup>
|
|
|
private SysMessageService sysMessageService;
|
|
|
@Autowired
|
|
|
private GroupDao groupDao;
|
|
|
+ @Autowired
|
|
|
+ private StudentPaymentRouteOrderService studentPaymentRouteOrderService;
|
|
|
|
|
|
private static final Logger LOGGER = LoggerFactory
|
|
|
.getLogger(PracticeGroupService.class);
|
|
@@ -103,32 +105,32 @@ public class CoursesGroupServiceImpl extends BaseServiceImpl<Long, CoursesGroup>
|
|
|
public HttpResponseResult createCourseGroup(CourseGroupCreateDto courseGroupCreateInfo) {
|
|
|
CoursesGroup courseGroup = courseGroupCreateInfo.getCoursesGroup();
|
|
|
CourseGenerateDto courseCycleInfo = courseGroupCreateInfo.getCourseCycleInfo();
|
|
|
- if(Objects.isNull(courseGroup.getName())|| StringUtils.isBlank(courseGroup.getName())){
|
|
|
+ if (Objects.isNull(courseGroup.getName()) || StringUtils.isBlank(courseGroup.getName())) {
|
|
|
throw new BizException("请填写课程名称");
|
|
|
}
|
|
|
- if(Objects.isNull(courseGroup.getSubjectId())){
|
|
|
+ if (Objects.isNull(courseGroup.getSubjectId())) {
|
|
|
throw new BizException("请选择科目");
|
|
|
}
|
|
|
- if(Objects.isNull(courseGroup.getMaxStudentNum())){
|
|
|
+ if (Objects.isNull(courseGroup.getMaxStudentNum())) {
|
|
|
throw new BizException("请填写班级人数");
|
|
|
}
|
|
|
- if(Objects.isNull(courseCycleInfo.getSingleClassMinutes())){
|
|
|
+ if (Objects.isNull(courseCycleInfo.getSingleClassMinutes())) {
|
|
|
throw new BizException("请填写课程时长");
|
|
|
}
|
|
|
- if(Objects.isNull(courseCycleInfo.getCourseCreateStartTime())){
|
|
|
+ if (Objects.isNull(courseCycleInfo.getCourseCreateStartTime())) {
|
|
|
throw new BizException("请填写课程开始时间");
|
|
|
}
|
|
|
- if(Objects.isNull(courseCycleInfo.getCourseCount())){
|
|
|
+ if (Objects.isNull(courseCycleInfo.getCourseCount())) {
|
|
|
throw new BizException("请填写课程数量");
|
|
|
}
|
|
|
|
|
|
studentDao.lockUser(courseGroup.getTeacherId());
|
|
|
|
|
|
//总课程时长
|
|
|
- Integer totalCourseTime=courseCycleInfo.getCourseCount()*courseCycleInfo.getSingleClassMinutes();
|
|
|
+ Integer totalCourseTime = courseCycleInfo.getCourseCount() * courseCycleInfo.getSingleClassMinutes();
|
|
|
|
|
|
try {
|
|
|
- sysTenantAccountService.update(courseGroup.getTeacherId(), -totalCourseTime, "", SysTenantAccountDetail.TransType.CONSUME, "",BigDecimal.ZERO,"课程组创建");
|
|
|
+ sysTenantAccountService.update(courseGroup.getTeacherId(), -totalCourseTime, "", SysTenantAccountDetail.TransType.CONSUME, "", BigDecimal.ZERO, "课程组创建");
|
|
|
} catch (Exception e) {
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
return BaseController.failed("余额不足,请充值。");
|
|
@@ -136,11 +138,11 @@ public class CoursesGroupServiceImpl extends BaseServiceImpl<Long, CoursesGroup>
|
|
|
|
|
|
Teacher teacher = teacherDao.get(courseGroup.getTeacherId());
|
|
|
|
|
|
- Date now=new Date();
|
|
|
+ Date now = new Date();
|
|
|
courseGroup.setSingleClassMinutes(courseCycleInfo.getSingleClassMinutes());
|
|
|
courseGroup.setStatus(GroupStatusEnum.NORMAL);
|
|
|
courseGroup.setOrganId(teacher.getTeacherOrganId());
|
|
|
- List<CourseSchedule> newCourses = courseScheduleService.createCourses(courseGroupCreateInfo.getCourseCycleInfo(),true);
|
|
|
+ List<CourseSchedule> newCourses = courseScheduleService.createCourses(courseGroupCreateInfo.getCourseCycleInfo(), true);
|
|
|
for (CourseSchedule newCourse : newCourses) {
|
|
|
newCourse.setTeachMode(TeachModeEnum.ONLINE);
|
|
|
newCourse.setGroupType(GroupType.COMM);
|
|
@@ -153,33 +155,33 @@ public class CoursesGroupServiceImpl extends BaseServiceImpl<Long, CoursesGroup>
|
|
|
newCourse.setOrganId(courseGroup.getOrganId());
|
|
|
}
|
|
|
try {
|
|
|
- courseScheduleService.checkNewCourseSchedules(newCourses,false);
|
|
|
+ courseScheduleService.checkNewCourseSchedules(newCourses, false);
|
|
|
} catch (Exception e) {
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
String errMessage;
|
|
|
- String courseName=e.getMessage().substring(e.getMessage().indexOf(")-")+2);
|
|
|
- courseName = courseName.substring(0,courseName.indexOf("("));
|
|
|
+ String courseName = e.getMessage().substring(e.getMessage().indexOf(")-") + 2);
|
|
|
+ courseName = courseName.substring(0, courseName.indexOf("("));
|
|
|
String courseTime = e.getMessage().substring(e.getMessage().indexOf("在") + 1);
|
|
|
courseTime = courseTime.substring(0, courseTime.indexOf("至"));
|
|
|
- errMessage="现在课程:";
|
|
|
- errMessage+=courseName;
|
|
|
- errMessage+="<br/>冲突时间:";
|
|
|
- errMessage+=courseTime;
|
|
|
+ errMessage = "现在课程:";
|
|
|
+ errMessage += courseName;
|
|
|
+ errMessage += "<br/>冲突时间:";
|
|
|
+ errMessage += courseTime;
|
|
|
return BaseController.failed(HttpStatus.FOUND, errMessage);
|
|
|
}
|
|
|
|
|
|
CourseSchedule firstCourseSchedule = newCourses.stream().min(Comparator.comparing(CourseSchedule::getStartClassTime)).get();
|
|
|
- if(firstCourseSchedule.getStartClassTime().before(now)){
|
|
|
+ if (firstCourseSchedule.getStartClassTime().before(now)) {
|
|
|
throw new BizException("开课时间不可小于当前时间");
|
|
|
}
|
|
|
CourseSchedule latestCourseSchedule = newCourses.stream().max(Comparator.comparing(CourseSchedule::getEndClassTime)).get();
|
|
|
courseGroup.setCoursesStartDate(firstCourseSchedule.getStartClassTime());
|
|
|
courseGroup.setCoursesEndDate(latestCourseSchedule.getEndClassTime());
|
|
|
|
|
|
- JSONArray courseTimesArray=new JSONArray();
|
|
|
+ JSONArray courseTimesArray = new JSONArray();
|
|
|
for (CourseTimeDto courseTime : courseCycleInfo.getCourseTimes()) {
|
|
|
- JSONObject courseTimeObject=new JSONObject();
|
|
|
- courseTimeObject.put(String.valueOf(courseTime.getDayOfWeek()),courseTime.getStartClassTime());
|
|
|
+ JSONObject courseTimeObject = new JSONObject();
|
|
|
+ courseTimeObject.put(String.valueOf(courseTime.getDayOfWeek()), courseTime.getStartClassTime());
|
|
|
courseTimesArray.add(courseTimeObject);
|
|
|
}
|
|
|
|
|
@@ -252,7 +254,7 @@ public class CoursesGroupServiceImpl extends BaseServiceImpl<Long, CoursesGroup>
|
|
|
|
|
|
@Override
|
|
|
public PageInfo findTeacherCourseGroups(Integer teacherId, GroupCourseScheduleQueryInfo queryInfo) {
|
|
|
- if(Objects.isNull(teacherId)){
|
|
|
+ if (Objects.isNull(teacherId)) {
|
|
|
throw new BizException("请指定老师");
|
|
|
}
|
|
|
|
|
@@ -261,7 +263,7 @@ public class CoursesGroupServiceImpl extends BaseServiceImpl<Long, CoursesGroup>
|
|
|
MapUtil.populateMap(params, queryInfo);
|
|
|
params.put("teacherId", teacherId);
|
|
|
|
|
|
- List<CourseGroupTeacherCardDto> groupCards=new ArrayList<>();
|
|
|
+ List<CourseGroupTeacherCardDto> groupCards = new ArrayList<>();
|
|
|
int count = coursesGroupDao.countTeacherGroups(params);
|
|
|
if (count > 0) {
|
|
|
pageInfo.setTotal(count);
|
|
@@ -283,9 +285,9 @@ public class CoursesGroupServiceImpl extends BaseServiceImpl<Long, CoursesGroup>
|
|
|
List<GroupValidDateDto> groupsValidate = courseScheduleDao.findGroupsValidate(groupIds, GroupType.COMM);
|
|
|
Map<String, GroupValidDateDto> groupValidateMap = groupsValidate.stream().collect(Collectors.toMap(GroupValidDateDto::getGroupId, e -> e));
|
|
|
|
|
|
- groupCards=new ArrayList<>();
|
|
|
+ groupCards = new ArrayList<>();
|
|
|
for (CoursesGroup teacherCourseGroup : teacherCourseGroups) {
|
|
|
- CourseGroupTeacherCardDto groupCard=new CourseGroupTeacherCardDto();
|
|
|
+ CourseGroupTeacherCardDto groupCard = new CourseGroupTeacherCardDto();
|
|
|
groupCard.setId(teacherCourseGroup.getId());
|
|
|
groupCard.setGroupType(GroupType.COMM);
|
|
|
groupCard.setName(teacherCourseGroup.getName());
|
|
@@ -295,20 +297,20 @@ public class CoursesGroupServiceImpl extends BaseServiceImpl<Long, CoursesGroup>
|
|
|
groupCard.setSubjectName(idSubjectMap.get(teacherCourseGroup.getSubjectId()).getName());
|
|
|
GroupCourseTimesDto groupCourseTimesInfo = groupCourseTimesInfoMap.get(String.valueOf(teacherCourseGroup.getId()));
|
|
|
GroupValidDateDto groupValidDate = groupValidateMap.get(String.valueOf(teacherCourseGroup.getId()));
|
|
|
- if(Objects.nonNull(groupValidDate)){
|
|
|
+ if (Objects.nonNull(groupValidDate)) {
|
|
|
groupCard.setCoursesStartDate(groupValidDate.getStartDate());
|
|
|
groupCard.setCoursesEndDate(groupValidDate.getEndDate());
|
|
|
}
|
|
|
groupCard.setClassGroupId(groupCourseTimesInfo.getClassGroupId());
|
|
|
groupCard.setTotalCourseTimes(groupCourseTimesInfo.getTotalCourseTimes());
|
|
|
groupCard.setSurplusClassTimes(groupCourseTimesInfo.getSurplusClassTimes());
|
|
|
- groupCard.setCurrentClassTimes(groupCard.getTotalCourseTimes()-groupCard.getSurplusClassTimes());
|
|
|
+ groupCard.setCurrentClassTimes(groupCard.getTotalCourseTimes() - groupCard.getSurplusClassTimes());
|
|
|
List<ClassGroupStudentMapper> groupStudents = groupStudentsMap.get(String.valueOf(teacherCourseGroup.getId()));
|
|
|
- if(!CollectionUtils.isEmpty(groupStudents)){
|
|
|
+ if (!CollectionUtils.isEmpty(groupStudents)) {
|
|
|
List<String> userNames = groupStudents.stream().map(ClassGroupStudentMapper::getUserName).collect(Collectors.toList());
|
|
|
- groupCard.setStudentNames(StringUtils.join(userNames,","));
|
|
|
- groupCard.setStudentIsFull(groupStudents.size()>=teacherCourseGroup.getMaxStudentNum()?1:0);
|
|
|
- }else{
|
|
|
+ groupCard.setStudentNames(StringUtils.join(userNames, ","));
|
|
|
+ groupCard.setStudentIsFull(groupStudents.size() >= teacherCourseGroup.getMaxStudentNum() ? 1 : 0);
|
|
|
+ } else {
|
|
|
groupCard.setStudentIsFull(3);
|
|
|
}
|
|
|
groupCards.add(groupCard);
|
|
@@ -324,7 +326,7 @@ public class CoursesGroupServiceImpl extends BaseServiceImpl<Long, CoursesGroup>
|
|
|
Map<String, Object> params = new HashMap<>();
|
|
|
MapUtil.populateMap(params, queryInfo);
|
|
|
|
|
|
- List<CourseGroupExtendDto> teacherCourseGroups=new ArrayList<>();
|
|
|
+ List<CourseGroupExtendDto> teacherCourseGroups = new ArrayList<>();
|
|
|
int count = coursesGroupDao.countTeacherGroupsWithWeb(params);
|
|
|
if (count > 0) {
|
|
|
pageInfo.setTotal(count);
|
|
@@ -335,29 +337,29 @@ public class CoursesGroupServiceImpl extends BaseServiceImpl<Long, CoursesGroup>
|
|
|
Map<String, Integer> groupStudentNumMap = groupStudentNums.stream().collect(Collectors.toMap(GroupBaseCourseInfoDto::getId, GroupBaseCourseInfoDto::getStudentNum));
|
|
|
|
|
|
List<GroupBaseCourseInfoDto> groupTotalClassesTimes = groupDao.countGroupTotalClassesTimes(groupIds, GroupType.COMM);
|
|
|
- Map<String, GroupBaseCourseInfoDto> groupBaseCourseInfoMap = groupTotalClassesTimes.stream().collect(Collectors.toMap(GroupBaseCourseInfoDto::getId, e->e));
|
|
|
+ Map<String, GroupBaseCourseInfoDto> groupBaseCourseInfoMap = groupTotalClassesTimes.stream().collect(Collectors.toMap(GroupBaseCourseInfoDto::getId, e -> e));
|
|
|
|
|
|
List<GroupBaseCourseInfoDto> groupFinishedClassesTimes = groupDao.countGroupFinishedClassesTimes(groupIds, GroupType.COMM);
|
|
|
- Map<String, Integer> groupFinishedClassesTimesMap = groupFinishedClassesTimes.stream().collect(Collectors.toMap(GroupBaseCourseInfoDto::getId, e->e.getCurrentClassTimes()));
|
|
|
+ Map<String, Integer> groupFinishedClassesTimesMap = groupFinishedClassesTimes.stream().collect(Collectors.toMap(GroupBaseCourseInfoDto::getId, e -> e.getCurrentClassTimes()));
|
|
|
|
|
|
for (CourseGroupExtendDto teacherCourseGroup : teacherCourseGroups) {
|
|
|
- if(Objects.nonNull(groupStudentNumMap.get(teacherCourseGroup.getId().toString()))) {
|
|
|
+ if (Objects.nonNull(groupStudentNumMap.get(teacherCourseGroup.getId().toString()))) {
|
|
|
teacherCourseGroup.setStudentNum(groupStudentNumMap.get(teacherCourseGroup.getId().toString()).intValue());
|
|
|
}
|
|
|
GroupBaseCourseInfoDto groupBaseCourseInfo = groupBaseCourseInfoMap.get(teacherCourseGroup.getId().toString());
|
|
|
- if(Objects.nonNull(groupBaseCourseInfo)){
|
|
|
+ if (Objects.nonNull(groupBaseCourseInfo)) {
|
|
|
teacherCourseGroup.setTotalClassTimes(groupBaseCourseInfo.getTotalClassTimes());
|
|
|
teacherCourseGroup.setFirstClassesStartTime(groupBaseCourseInfo.getFirstClassesStartTime());
|
|
|
teacherCourseGroup.setLastClassesEndTime(groupBaseCourseInfo.getLastClassesEndTime());
|
|
|
}
|
|
|
- if(Objects.nonNull(groupFinishedClassesTimesMap.get(teacherCourseGroup.getId().toString()))) {
|
|
|
+ if (Objects.nonNull(groupFinishedClassesTimesMap.get(teacherCourseGroup.getId().toString()))) {
|
|
|
teacherCourseGroup.setCurrentClassTimes(groupFinishedClassesTimesMap.get(teacherCourseGroup.getId().toString()).intValue());
|
|
|
}
|
|
|
- if(Objects.nonNull(teacherCourseGroup.getTotalClassTimes())){
|
|
|
- teacherCourseGroup.setGroupClassesTotalDuration(teacherCourseGroup.getSingleClassMinutes()*teacherCourseGroup.getTotalClassTimes());
|
|
|
+ if (Objects.nonNull(teacherCourseGroup.getTotalClassTimes())) {
|
|
|
+ teacherCourseGroup.setGroupClassesTotalDuration(teacherCourseGroup.getSingleClassMinutes() * teacherCourseGroup.getTotalClassTimes());
|
|
|
}
|
|
|
- if(Objects.nonNull(teacherCourseGroup.getCurrentClassTimes())){
|
|
|
- teacherCourseGroup.setGroupClassesConsumeDuration(teacherCourseGroup.getSingleClassMinutes()*teacherCourseGroup.getCurrentClassTimes());
|
|
|
+ if (Objects.nonNull(teacherCourseGroup.getCurrentClassTimes())) {
|
|
|
+ teacherCourseGroup.setGroupClassesConsumeDuration(teacherCourseGroup.getSingleClassMinutes() * teacherCourseGroup.getCurrentClassTimes());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -371,7 +373,7 @@ public class CoursesGroupServiceImpl extends BaseServiceImpl<Long, CoursesGroup>
|
|
|
Map<String, Object> params = new HashMap<>();
|
|
|
MapUtil.populateMap(params, queryInfo);
|
|
|
|
|
|
- List<CourseGroupExtendDto> teacherCourseGroups=new ArrayList<>();
|
|
|
+ List<CourseGroupExtendDto> teacherCourseGroups = new ArrayList<>();
|
|
|
int count = coursesGroupDao.countStudentGroupsWithWeb(params);
|
|
|
if (count > 0) {
|
|
|
pageInfo.setTotal(count);
|
|
@@ -383,32 +385,32 @@ public class CoursesGroupServiceImpl extends BaseServiceImpl<Long, CoursesGroup>
|
|
|
Map<String, Integer> groupStudentNumMap = groupStudentNums.stream().collect(Collectors.toMap(GroupBaseCourseInfoDto::getId, GroupBaseCourseInfoDto::getStudentNum));
|
|
|
|
|
|
List<GroupBaseCourseInfoDto> groupTotalClassesTimes = groupDao.countGroupTotalClassesTimes(groupIds, GroupType.COMM);
|
|
|
- Map<String, GroupBaseCourseInfoDto> groupBaseCourseInfoMap = groupTotalClassesTimes.stream().collect(Collectors.toMap(GroupBaseCourseInfoDto::getId, e->e));
|
|
|
+ Map<String, GroupBaseCourseInfoDto> groupBaseCourseInfoMap = groupTotalClassesTimes.stream().collect(Collectors.toMap(GroupBaseCourseInfoDto::getId, e -> e));
|
|
|
|
|
|
List<GroupBaseCourseInfoDto> groupFinishedClassesTimes = groupDao.countGroupFinishedClassesTimes(groupIds, GroupType.COMM);
|
|
|
- Map<String, Integer> groupFinishedClassesTimesMap = groupFinishedClassesTimes.stream().collect(Collectors.toMap(GroupBaseCourseInfoDto::getId, e->e.getCurrentClassTimes()));
|
|
|
+ Map<String, Integer> groupFinishedClassesTimesMap = groupFinishedClassesTimes.stream().collect(Collectors.toMap(GroupBaseCourseInfoDto::getId, e -> e.getCurrentClassTimes()));
|
|
|
|
|
|
List<SimpleUserDto> teachers = teacherDao.findSimpleTeachers(teacherIds);
|
|
|
Map<Integer, String> idNameMap = teachers.stream().collect(Collectors.toMap(SimpleUserDto::getUserId, SimpleUserDto::getUserName));
|
|
|
|
|
|
for (CourseGroupExtendDto teacherCourseGroup : teacherCourseGroups) {
|
|
|
- if(Objects.nonNull(groupStudentNumMap.get(teacherCourseGroup.getId().toString()))) {
|
|
|
+ if (Objects.nonNull(groupStudentNumMap.get(teacherCourseGroup.getId().toString()))) {
|
|
|
teacherCourseGroup.setStudentNum(groupStudentNumMap.get(teacherCourseGroup.getId().toString()).intValue());
|
|
|
}
|
|
|
GroupBaseCourseInfoDto groupBaseCourseInfo = groupBaseCourseInfoMap.get(teacherCourseGroup.getId().toString());
|
|
|
- if(Objects.nonNull(groupBaseCourseInfo)){
|
|
|
+ if (Objects.nonNull(groupBaseCourseInfo)) {
|
|
|
teacherCourseGroup.setTotalClassTimes(groupBaseCourseInfo.getTotalClassTimes());
|
|
|
teacherCourseGroup.setFirstClassesStartTime(groupBaseCourseInfo.getFirstClassesStartTime());
|
|
|
teacherCourseGroup.setLastClassesEndTime(groupBaseCourseInfo.getLastClassesEndTime());
|
|
|
}
|
|
|
- if(Objects.nonNull(groupFinishedClassesTimesMap.get(teacherCourseGroup.getId().toString()))) {
|
|
|
+ if (Objects.nonNull(groupFinishedClassesTimesMap.get(teacherCourseGroup.getId().toString()))) {
|
|
|
teacherCourseGroup.setCurrentClassTimes(groupFinishedClassesTimesMap.get(teacherCourseGroup.getId().toString()).intValue());
|
|
|
}
|
|
|
- if(Objects.nonNull(teacherCourseGroup.getTotalClassTimes())){
|
|
|
- teacherCourseGroup.setGroupClassesTotalDuration(teacherCourseGroup.getSingleClassMinutes()*teacherCourseGroup.getTotalClassTimes());
|
|
|
+ if (Objects.nonNull(teacherCourseGroup.getTotalClassTimes())) {
|
|
|
+ teacherCourseGroup.setGroupClassesTotalDuration(teacherCourseGroup.getSingleClassMinutes() * teacherCourseGroup.getTotalClassTimes());
|
|
|
}
|
|
|
- if(Objects.nonNull(teacherCourseGroup.getCurrentClassTimes())){
|
|
|
- teacherCourseGroup.setGroupClassesConsumeDuration(teacherCourseGroup.getSingleClassMinutes()*teacherCourseGroup.getCurrentClassTimes());
|
|
|
+ if (Objects.nonNull(teacherCourseGroup.getCurrentClassTimes())) {
|
|
|
+ teacherCourseGroup.setGroupClassesConsumeDuration(teacherCourseGroup.getSingleClassMinutes() * teacherCourseGroup.getCurrentClassTimes());
|
|
|
}
|
|
|
teacherCourseGroup.setTeacherName(idNameMap.get(teacherCourseGroup.getTeacherId()));
|
|
|
}
|
|
@@ -419,17 +421,17 @@ public class CoursesGroupServiceImpl extends BaseServiceImpl<Long, CoursesGroup>
|
|
|
|
|
|
@Override
|
|
|
public GroupHeadInfoDto getGroupHeadInfo(Long courseScheduleId) {
|
|
|
- if(Objects.isNull(courseScheduleId)){
|
|
|
+ if (Objects.isNull(courseScheduleId)) {
|
|
|
throw new BizException("请选择课程");
|
|
|
}
|
|
|
CourseSchedule courseSchedule = courseScheduleDao.get(courseScheduleId);
|
|
|
- if(Objects.isNull(courseSchedule)){
|
|
|
+ if (Objects.isNull(courseSchedule)) {
|
|
|
throw new BizException("课程不存在");
|
|
|
}
|
|
|
CoursesGroup coursesGroup = coursesGroupDao.get(Long.valueOf(courseSchedule.getMusicGroupId()));
|
|
|
Teacher teacher = teacherDao.get(courseSchedule.getActualTeacherId());
|
|
|
|
|
|
- GroupHeadInfoDto groupHeadInfo=new GroupHeadInfoDto();
|
|
|
+ GroupHeadInfoDto groupHeadInfo = new GroupHeadInfoDto();
|
|
|
groupHeadInfo.setGroupId(coursesGroup.getId().toString());
|
|
|
groupHeadInfo.setGroupName(coursesGroup.getName());
|
|
|
groupHeadInfo.setClassGroupId(courseSchedule.getClassGroupId());
|
|
@@ -445,66 +447,66 @@ public class CoursesGroupServiceImpl extends BaseServiceImpl<Long, CoursesGroup>
|
|
|
|
|
|
@Override
|
|
|
public Map<String, Object> getGroupDetail(Long groupId) {
|
|
|
- if(Objects.isNull(groupId)){
|
|
|
+ if (Objects.isNull(groupId)) {
|
|
|
throw new BizException("请指定课程组");
|
|
|
}
|
|
|
CoursesGroup coursesGroup = coursesGroupDao.get(groupId);
|
|
|
Teacher teacher = teacherDao.get(coursesGroup.getTeacherId());
|
|
|
List<String> subjectNames = subjectDao.findBySubIds(teacher.getSubjectId());
|
|
|
- Map<String, Object> result=new HashMap<>();
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
|
result.put("groupId", groupId);
|
|
|
result.put("groupName", coursesGroup.getName());
|
|
|
- result.put("courseStartDate",coursesGroup.getCoursesStartDate());
|
|
|
+ result.put("courseStartDate", coursesGroup.getCoursesStartDate());
|
|
|
result.put("courseEndDate", coursesGroup.getCoursesEndDate());
|
|
|
result.put("teacherName", teacher.getRealName());
|
|
|
- result.put("avatar",teacher.getAvatar());
|
|
|
+ result.put("avatar", teacher.getAvatar());
|
|
|
result.put("introduction", teacher.getIntroduction());
|
|
|
result.put("lectureNum", courseScheduleTeacherSalaryDao.countTeacherGiveLesson(coursesGroup.getTeacherId()));
|
|
|
- result.put("subjectNames", StringUtils.join(subjectNames,","));
|
|
|
+ result.put("subjectNames", StringUtils.join(subjectNames, ","));
|
|
|
List<CourseSchedule> groupNotStartCourses = courseScheduleDao.findGroupNotFinishCourses(groupId.toString(), GroupType.COMM);
|
|
|
- result.put("courseSchedules",groupNotStartCourses);
|
|
|
+ result.put("courseSchedules", groupNotStartCourses);
|
|
|
Map<TeachModeEnum, Long> collect = groupNotStartCourses.stream().collect(Collectors.groupingBy(CourseSchedule::getTeachMode, Collectors.counting()));
|
|
|
result.put("totalClassesTimes", groupNotStartCourses.size());
|
|
|
- result.put("onlineClassesTimes", Objects.isNull(collect.get(TeachModeEnum.ONLINE))?0:collect.get(TeachModeEnum.ONLINE));
|
|
|
- result.put("offlineClassesTimes", Objects.isNull(collect.get(TeachModeEnum.OFFLINE))?0:collect.get(TeachModeEnum.OFFLINE));
|
|
|
+ result.put("onlineClassesTimes", Objects.isNull(collect.get(TeachModeEnum.ONLINE)) ? 0 : collect.get(TeachModeEnum.ONLINE));
|
|
|
+ result.put("offlineClassesTimes", Objects.isNull(collect.get(TeachModeEnum.OFFLINE)) ? 0 : collect.get(TeachModeEnum.OFFLINE));
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
|
|
|
- public HttpResponseResult buyCourseGroup(Integer userId, Long courseGroupId, boolean isUseBalancePayment) {
|
|
|
- if(Objects.isNull(courseGroupId)){
|
|
|
+ public HttpResponseResult buyCourseGroup(Integer userId, Long courseGroupId, boolean isUseBalancePayment) throws Exception {
|
|
|
+ if (Objects.isNull(courseGroupId)) {
|
|
|
throw new BizException("请指定课程组");
|
|
|
}
|
|
|
|
|
|
CoursesGroup coursesGroup = coursesGroupDao.lockGroup(courseGroupId);
|
|
|
- if(Objects.isNull(coursesGroup)){
|
|
|
+ if (Objects.isNull(coursesGroup)) {
|
|
|
throw new BizException("此课程组不存在");
|
|
|
}
|
|
|
- if(coursesGroup.getStatus().equals(GroupStatusEnum.CANCEL)){
|
|
|
+ if (coursesGroup.getStatus().equals(GroupStatusEnum.CANCEL)) {
|
|
|
throw new BizException("课程已关闭,请联系老师了解详细情况。");
|
|
|
}
|
|
|
List<ClassGroupStudentMapper> groupStudents = classGroupStudentMapperDao.findGroupStudents(courseGroupId.toString(), GroupType.COMM, userId, null);
|
|
|
- if(!CollectionUtils.isEmpty(groupStudents)){
|
|
|
+ if (!CollectionUtils.isEmpty(groupStudents)) {
|
|
|
throw new BizException("您完成此课程组报名,无需重复报名。");
|
|
|
}
|
|
|
|
|
|
- Date now=new Date();
|
|
|
+ Date now = new Date();
|
|
|
|
|
|
ClassGroup classGroup = classGroupDao.findByMusicGroupAndType(courseGroupId.toString(), GroupType.COMM.getCode());
|
|
|
- if(classGroup.getStudentNum()>=classGroup.getExpectStudentNum()){
|
|
|
+ if (classGroup.getStudentNum() >= classGroup.getExpectStudentNum()) {
|
|
|
throw new BizException("课程人数已满");
|
|
|
}
|
|
|
|
|
|
BigDecimal amount = coursesGroup.getTotalCoursesPrice();
|
|
|
- if(Objects.isNull(amount)){
|
|
|
- amount=BigDecimal.ZERO;
|
|
|
+ if (Objects.isNull(amount)) {
|
|
|
+ amount = BigDecimal.ZERO;
|
|
|
}
|
|
|
|
|
|
- StudentPaymentOrder studentPaymentOrder=new StudentPaymentOrder();
|
|
|
+ StudentPaymentOrder studentPaymentOrder = new StudentPaymentOrder();
|
|
|
studentPaymentOrder.setUserId(userId);
|
|
|
studentPaymentOrder.setGroupType(GroupType.COMM);
|
|
|
- String orderNo=idGeneratorService.generatorId("payment") + "";
|
|
|
+ String orderNo = idGeneratorService.generatorId("payment") + "";
|
|
|
studentPaymentOrder.setOrderNo(orderNo);
|
|
|
studentPaymentOrder.setStatus(DealStatusEnum.ING);
|
|
|
studentPaymentOrder.setType(OrderTypeEnum.COURSE_GROUP_BUY);
|
|
@@ -514,18 +516,21 @@ public class CoursesGroupServiceImpl extends BaseServiceImpl<Long, CoursesGroup>
|
|
|
studentPaymentOrder.setClassGroupId(classGroup.getId());
|
|
|
studentPaymentOrder.setVersion(0);
|
|
|
|
|
|
- if(amount.compareTo(BigDecimal.ZERO)<=0){
|
|
|
+ BigDecimal balance = BigDecimal.ZERO;
|
|
|
+ if (amount.compareTo(BigDecimal.ZERO) <= 0) {
|
|
|
return this.orderCallback(studentPaymentOrder);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
studentPaymentOrderService.insert(studentPaymentOrder);
|
|
|
|
|
|
- if(isUseBalancePayment || studentPaymentOrder.getExpectAmount().doubleValue() == 0){
|
|
|
+ if (isUseBalancePayment || studentPaymentOrder.getExpectAmount().doubleValue() == 0) {
|
|
|
SysUserCashAccount userCashAccount = sysUserCashAccountService.getLocked(userId);
|
|
|
- if(userCashAccount == null){
|
|
|
+ if (userCashAccount == null) {
|
|
|
throw new BizException("用户账户找不到");
|
|
|
}
|
|
|
studentPaymentOrder.setPaymentChannel("BALANCE");
|
|
|
- if(userCashAccount.getBalance().subtract(studentPaymentOrder.getExpectAmount()).doubleValue() >= 0){
|
|
|
+ if (userCashAccount.getBalance().subtract(studentPaymentOrder.getExpectAmount()).doubleValue() >= 0) {
|
|
|
+ studentPaymentRouteOrderService.addRouteOrder(orderNo, coursesGroup.getOrganId(), studentPaymentOrder.getExpectAmount());
|
|
|
+
|
|
|
// 更新订单信息
|
|
|
studentPaymentOrder.setActualAmount(new BigDecimal(0));
|
|
|
studentPaymentOrder.setBalancePaymentAmount(studentPaymentOrder.getExpectAmount());
|
|
@@ -533,17 +538,18 @@ public class CoursesGroupServiceImpl extends BaseServiceImpl<Long, CoursesGroup>
|
|
|
studentPaymentOrder.setUpdateTime(now);
|
|
|
studentPaymentOrder.setRoutingOrganId(42);
|
|
|
|
|
|
- sysUserCashAccountService.updateBalance(userId, studentPaymentOrder.getExpectAmount().negate(),PlatformCashAccountDetailTypeEnum.PAY_FEE,"对外课程购买");
|
|
|
+ sysUserCashAccountService.updateBalance(userId, studentPaymentOrder.getExpectAmount().negate(), PlatformCashAccountDetailTypeEnum.PAY_FEE, "对外课程购买");
|
|
|
|
|
|
this.orderCallback(studentPaymentOrder);
|
|
|
|
|
|
- Map<String,Object> result=new HashMap<>();
|
|
|
- result.put("orderNo",studentPaymentOrder.getOrderNo());
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
|
+ result.put("orderNo", studentPaymentOrder.getOrderNo());
|
|
|
|
|
|
return BaseController.succeed(result);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
if (userCashAccount.getBalance().doubleValue() > 0) {
|
|
|
- sysUserCashAccountService.updateBalance(userId, userCashAccount.getBalance().negate(), PlatformCashAccountDetailTypeEnum.PAY_FEE, "对外课程购买");
|
|
|
+ balance = userCashAccount.getBalance();
|
|
|
+ sysUserCashAccountService.updateBalance(userId, balance.negate(), PlatformCashAccountDetailTypeEnum.PAY_FEE, "对外课程购买");
|
|
|
amount = studentPaymentOrder.getExpectAmount().subtract(userCashAccount.getBalance());
|
|
|
studentPaymentOrder.setActualAmount(amount);
|
|
|
studentPaymentOrder.setBalancePaymentAmount(userCashAccount.getBalance());
|
|
@@ -555,56 +561,52 @@ public class CoursesGroupServiceImpl extends BaseServiceImpl<Long, CoursesGroup>
|
|
|
|
|
|
String baseApiUrl = sysConfigDao.findConfigValue("base_api_url");
|
|
|
Map<String, BigDecimal> classFee = new HashMap<>();
|
|
|
- classFee.put("course",amount);
|
|
|
- classFee.put("instrument",BigDecimal.ZERO);
|
|
|
- classFee.put("accessories",BigDecimal.ZERO);
|
|
|
- classFee.put("other",BigDecimal.ZERO);
|
|
|
- try {
|
|
|
- Map<String,Object> payMap = payService.getPayMap(
|
|
|
- amount,
|
|
|
- orderNo,
|
|
|
- baseApiUrl+"/api-student/studentOrder/notify",
|
|
|
- baseApiUrl+"/api-student/studentOrder/paymentResult?orderNo=" + orderNo,
|
|
|
- "对外课程组购买",
|
|
|
- coursesGroup.getName(),
|
|
|
- userId,
|
|
|
- classFee,
|
|
|
- null
|
|
|
- );
|
|
|
-
|
|
|
- Map<String,BigDecimal> routingFee = (Map<String,BigDecimal>)payMap.get("routingFee");
|
|
|
- studentPaymentOrder.setRoutingOrganId((Integer) payMap.get("routingOrganId"));
|
|
|
- studentPaymentOrder.setComAmount(routingFee.get("COM"));
|
|
|
- studentPaymentOrder.setPerAmount(routingFee.get("PER"));
|
|
|
- studentPaymentOrder.setMerNos((String) payMap.get("routingMerNos"));
|
|
|
- studentPaymentOrder.setPaymentChannel((String) payMap.get("type"));
|
|
|
- studentPaymentOrder.setUpdateTime(now);
|
|
|
- studentPaymentOrderService.update(studentPaymentOrder);
|
|
|
-
|
|
|
- return BaseController.succeed(payMap);
|
|
|
- } catch (Exception e) {
|
|
|
- throw new BizException("订单提交超时,请尝试重新提交购买");
|
|
|
- }
|
|
|
+ classFee.put("course", amount);
|
|
|
+ classFee.put("instrument", BigDecimal.ZERO);
|
|
|
+ classFee.put("accessories", BigDecimal.ZERO);
|
|
|
+ classFee.put("other", BigDecimal.ZERO);
|
|
|
+ Map<String, Object> payMap = payService.getPayMap(
|
|
|
+ amount,
|
|
|
+ balance,
|
|
|
+ orderNo,
|
|
|
+ baseApiUrl + "/api-student/studentOrder/notify",
|
|
|
+ baseApiUrl + "/api-student/studentOrder/paymentResult?orderNo=" + orderNo,
|
|
|
+ "对外课程组购买",
|
|
|
+ coursesGroup.getName(),
|
|
|
+ coursesGroup.getOrganId(),
|
|
|
+ "outGroupBuy"
|
|
|
+ );
|
|
|
+
|
|
|
+ Map<String, BigDecimal> routingFee = (Map<String, BigDecimal>) payMap.get("routingFee");
|
|
|
+ studentPaymentOrder.setRoutingOrganId((Integer) payMap.get("routingOrganId"));
|
|
|
+ studentPaymentOrder.setComAmount(routingFee.get("COM"));
|
|
|
+ studentPaymentOrder.setPerAmount(routingFee.get("PER"));
|
|
|
+ studentPaymentOrder.setMerNos((String) payMap.get("routingMerNos"));
|
|
|
+ studentPaymentOrder.setPaymentChannel((String) payMap.get("type"));
|
|
|
+ studentPaymentOrder.setUpdateTime(now);
|
|
|
+ studentPaymentOrderService.update(studentPaymentOrder);
|
|
|
+
|
|
|
+ return BaseController.succeed(payMap);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- @Transactional(rollbackFor = Exception.class,isolation = Isolation.READ_COMMITTED)
|
|
|
+ @Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
|
|
|
public HttpResponseResult orderCallback(StudentPaymentOrder order) {
|
|
|
- if(order.getExpectAmount().compareTo(BigDecimal.ZERO)>0){
|
|
|
+ if (order.getExpectAmount().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
StudentPaymentOrder studentPaymentOrder = studentPaymentOrderDao.get(order.getId());
|
|
|
- if(!studentPaymentOrder.getStatus().equals(DealStatusEnum.ING)){
|
|
|
+ if (!studentPaymentOrder.getStatus().equals(DealStatusEnum.ING)) {
|
|
|
return BaseController.succeed();
|
|
|
}
|
|
|
SysUserCashAccount sysUserCashAccount = sysUserCashAccountService.get(order.getUserId());
|
|
|
- List<StudentPaymentOrder> userGroupOrders = studentPaymentOrderDao.findUserGroupOrders(order.getUserId(), order.getMusicGroupId(), order.getGroupType(),null);
|
|
|
+ List<StudentPaymentOrder> userGroupOrders = studentPaymentOrderDao.findUserGroupOrders(order.getUserId(), order.getMusicGroupId(), order.getGroupType(), null);
|
|
|
Map<DealStatusEnum, Long> statusOrderNumMap = userGroupOrders.stream().collect(Collectors.groupingBy(StudentPaymentOrder::getStatus, Collectors.counting()));
|
|
|
- Long successOrderNum=statusOrderNumMap.get(DealStatusEnum.SUCCESS);
|
|
|
- if(Objects.nonNull(successOrderNum)&&successOrderNum>0){
|
|
|
- if(order.getStatus().equals(DealStatusEnum.FAILED)&&Objects.nonNull(order.getBalancePaymentAmount())&&order.getBalancePaymentAmount().compareTo(BigDecimal.ZERO)>0){
|
|
|
+ Long successOrderNum = statusOrderNumMap.get(DealStatusEnum.SUCCESS);
|
|
|
+ if (Objects.nonNull(successOrderNum) && successOrderNum > 0) {
|
|
|
+ if (order.getStatus().equals(DealStatusEnum.FAILED) && Objects.nonNull(order.getBalancePaymentAmount()) && order.getBalancePaymentAmount().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
sysUserCashAccountService.updateBalance(order.getUserId(), order.getBalancePaymentAmount(), PlatformCashAccountDetailTypeEnum.REFUNDS, "网管课支付失败,退还余额");
|
|
|
}
|
|
|
- if(order.getStatus().equals(DealStatusEnum.SUCCESS)){
|
|
|
+ if (order.getStatus().equals(DealStatusEnum.SUCCESS)) {
|
|
|
sysUserCashAccountService.updateBalance(order.getUserId(), order.getExpectAmount(), PlatformCashAccountDetailTypeEnum.REFUNDS, "重复支付,退还余额");
|
|
|
order.setMemo("重复支付,进入余额");
|
|
|
}
|
|
@@ -612,26 +614,26 @@ public class CoursesGroupServiceImpl extends BaseServiceImpl<Long, CoursesGroup>
|
|
|
return BaseController.succeed();
|
|
|
}
|
|
|
|
|
|
- Long ingOrderNum=statusOrderNumMap.get(DealStatusEnum.ING);
|
|
|
- if(Objects.nonNull(ingOrderNum)&&ingOrderNum>1&&order.getStatus().equals(DealStatusEnum.FAILED)){
|
|
|
- if(Objects.nonNull(order.getBalancePaymentAmount())&&order.getBalancePaymentAmount().compareTo(BigDecimal.ZERO)>0){
|
|
|
+ Long ingOrderNum = statusOrderNumMap.get(DealStatusEnum.ING);
|
|
|
+ if (Objects.nonNull(ingOrderNum) && ingOrderNum > 1 && order.getStatus().equals(DealStatusEnum.FAILED)) {
|
|
|
+ if (Objects.nonNull(order.getBalancePaymentAmount()) && order.getBalancePaymentAmount().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
sysUserCashAccountService.updateBalance(order.getUserId(), order.getBalancePaymentAmount(), PlatformCashAccountDetailTypeEnum.REFUNDS, "网管课支付失败,退还余额");
|
|
|
}
|
|
|
studentPaymentOrderDao.update(order);
|
|
|
return BaseController.succeed();
|
|
|
}
|
|
|
|
|
|
- if(order.getStatus().equals(DealStatusEnum.SUCCESS)){
|
|
|
- courseScheduleDao.updateGroupCourseLock(order.getMusicGroupId(),GroupType.PRACTICE,0);
|
|
|
- }else{
|
|
|
- if(Objects.nonNull(order.getBalancePaymentAmount())&&order.getBalancePaymentAmount().compareTo(BigDecimal.ZERO)>0){
|
|
|
+ if (order.getStatus().equals(DealStatusEnum.SUCCESS)) {
|
|
|
+ courseScheduleDao.updateGroupCourseLock(order.getMusicGroupId(), GroupType.PRACTICE, 0);
|
|
|
+ } else {
|
|
|
+ if (Objects.nonNull(order.getBalancePaymentAmount()) && order.getBalancePaymentAmount().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
sysUserCashAccountService.updateBalance(order.getUserId(), order.getBalancePaymentAmount(), PlatformCashAccountDetailTypeEnum.REFUNDS, "网管课支付失败,退还余额");
|
|
|
}
|
|
|
studentPaymentOrderDao.update(order);
|
|
|
CoursesGroup coursesGroup = coursesGroupDao.get(Long.valueOf(order.getMusicGroupId()));
|
|
|
coursesGroup.setStatus(GroupStatusEnum.CANCEL);
|
|
|
coursesGroupDao.update(coursesGroup);
|
|
|
- groupService.deleteGroupOtherInfo(order.getMusicGroupId(),GroupType.PRACTICE);
|
|
|
+ groupService.deleteGroupOtherInfo(order.getMusicGroupId(), GroupType.PRACTICE);
|
|
|
return BaseController.succeed();
|
|
|
}
|
|
|
studentPaymentOrderDao.update(order);
|
|
@@ -659,10 +661,10 @@ public class CoursesGroupServiceImpl extends BaseServiceImpl<Long, CoursesGroup>
|
|
|
sysUserExpendCashAccountDetail.setAttribute(order.getTransNo());
|
|
|
sysUserExpendCashAccountDetail.setChannel(studentPaymentOrder.getPaymentChannel());
|
|
|
|
|
|
- if(studentPaymentOrder.getComAmount() != null){
|
|
|
+ if (studentPaymentOrder.getComAmount() != null) {
|
|
|
sysUserIncomeCashAccountDetail.setComAmount(studentPaymentOrder.getComAmount().negate());
|
|
|
}
|
|
|
- if(studentPaymentOrder.getPerAmount() != null){
|
|
|
+ if (studentPaymentOrder.getPerAmount() != null) {
|
|
|
sysUserExpendCashAccountDetail.setPerAmount(studentPaymentOrder.getPerAmount().negate());
|
|
|
}
|
|
|
|
|
@@ -670,8 +672,8 @@ public class CoursesGroupServiceImpl extends BaseServiceImpl<Long, CoursesGroup>
|
|
|
sysUserCashAccountDetailService.insert(sysUserExpendCashAccountDetail);
|
|
|
|
|
|
CoursesGroup coursesGroup = coursesGroupDao.get(Long.valueOf(order.getMusicGroupId()));
|
|
|
- if(!coursesGroup.getStatus().equals(GroupStatusEnum.NORMAL)){
|
|
|
- order.setVersion(order.getVersion()+1);
|
|
|
+ if (!coursesGroup.getStatus().equals(GroupStatusEnum.NORMAL)) {
|
|
|
+ order.setVersion(order.getVersion() + 1);
|
|
|
order.setMemo("支付成功,但课程组不处于正常状态");
|
|
|
studentPaymentOrderDao.update(order);
|
|
|
|
|
@@ -692,18 +694,18 @@ public class CoursesGroupServiceImpl extends BaseServiceImpl<Long, CoursesGroup>
|
|
|
classGroupStudentMapperDao.insert(classGroupStudentMapper);
|
|
|
|
|
|
List<ClassGroupStudentMapper> classGroupStudents = classGroupStudentMapperDao.findByClassGroup(classGroup.getId());
|
|
|
- if(!CollectionUtils.isEmpty(classGroupStudents)){
|
|
|
+ if (!CollectionUtils.isEmpty(classGroupStudents)) {
|
|
|
classGroup.setStudentNum(classGroupStudents.size());
|
|
|
classGroupDao.update(classGroup);
|
|
|
}
|
|
|
- if(!CollectionUtils.isEmpty(classGroupStudents)&&classGroupStudents.size()>=classGroup.getExpectStudentNum()){
|
|
|
+ if (!CollectionUtils.isEmpty(classGroupStudents) && classGroupStudents.size() >= classGroup.getExpectStudentNum()) {
|
|
|
coursesGroup.setStatus(GroupStatusEnum.NORMAL);
|
|
|
coursesGroupDao.update(coursesGroup);
|
|
|
}
|
|
|
|
|
|
List<CourseScheduleStudentPayment> courseScheduleStudentPayments = new ArrayList<>();
|
|
|
List<CourseSchedule> groupNotStartCourses = courseScheduleDao.findGroupNotFinishCourses(order.getMusicGroupId(), GroupType.COMM);
|
|
|
- if(CollectionUtils.isEmpty(groupNotStartCourses)){
|
|
|
+ if (CollectionUtils.isEmpty(groupNotStartCourses)) {
|
|
|
throw new BizException("课程已关闭,请联系老师了解详细情况。");
|
|
|
}
|
|
|
BigDecimal singleCoursePrice = order.getExpectAmount().divide(new BigDecimal(groupNotStartCourses.size()), CommonConstants.DECIMAL_PLACE, BigDecimal.ROUND_DOWN);
|
|
@@ -721,19 +723,19 @@ public class CoursesGroupServiceImpl extends BaseServiceImpl<Long, CoursesGroup>
|
|
|
courseScheduleStudentPaymentDao.batchInsert(courseScheduleStudentPayments);
|
|
|
|
|
|
try {
|
|
|
- courseScheduleService.checkNewCourseSchedules(groupNotStartCourses,false);
|
|
|
+ courseScheduleService.checkNewCourseSchedules(groupNotStartCourses, false);
|
|
|
} catch (Exception e) {
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
String errMessage;
|
|
|
|
|
|
- String courseName=e.getMessage().substring(e.getMessage().indexOf(")-")+2);
|
|
|
- courseName = courseName.substring(0,courseName.indexOf("("));
|
|
|
+ String courseName = e.getMessage().substring(e.getMessage().indexOf(")-") + 2);
|
|
|
+ courseName = courseName.substring(0, courseName.indexOf("("));
|
|
|
String courseTime = e.getMessage().substring(e.getMessage().indexOf("在") + 1);
|
|
|
courseTime = courseTime.substring(0, courseTime.indexOf("至"));
|
|
|
- errMessage="现在课程:";
|
|
|
- errMessage+=courseName;
|
|
|
- errMessage+="<br/>冲突时间:";
|
|
|
- errMessage+=courseTime;
|
|
|
+ errMessage = "现在课程:";
|
|
|
+ errMessage += courseName;
|
|
|
+ errMessage += "<br/>冲突时间:";
|
|
|
+ errMessage += courseTime;
|
|
|
|
|
|
return BaseController.failed(HttpStatus.FOUND, errMessage);
|
|
|
}
|
|
@@ -752,7 +754,7 @@ public class CoursesGroupServiceImpl extends BaseServiceImpl<Long, CoursesGroup>
|
|
|
public void noStudentsCourseGroupRemind() {
|
|
|
Date startDate = DateUtil.addDays(new Date(), 1);
|
|
|
List<CoursesGroup> noStudentsGroups = coursesGroupDao.findNoStudentsGroups(startDate);
|
|
|
- if(CollectionUtils.isEmpty(noStudentsGroups)){
|
|
|
+ if (CollectionUtils.isEmpty(noStudentsGroups)) {
|
|
|
return;
|
|
|
}
|
|
|
for (CoursesGroup noStudentsGroup : noStudentsGroups) {
|
|
@@ -766,7 +768,7 @@ public class CoursesGroupServiceImpl extends BaseServiceImpl<Long, CoursesGroup>
|
|
|
@Override
|
|
|
public void finishCourseGroup() {
|
|
|
List<CoursesGroup> noCoursesGroups = coursesGroupDao.findNoCoursesGroups();
|
|
|
- if(CollectionUtils.isEmpty(noCoursesGroups)){
|
|
|
+ if (CollectionUtils.isEmpty(noCoursesGroups)) {
|
|
|
return;
|
|
|
}
|
|
|
List<Long> groupIds = noCoursesGroups.stream().map(CoursesGroup::getId).collect(Collectors.toList());
|