Browse Source

Merge branch 'Joburgess'

# Conflicts:
#	mec-common/audit-log/src/main/java/com/yonge/log/interceptor/AuditLogInterceptor.java
Joburgess 4 years ago
parent
commit
05af26628e

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

@@ -4960,14 +4960,14 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 		if(Objects.nonNull(maxCourseTime)&&coursesExpireDate.compareTo(maxCourseTime)<0){
 			throw new BizException("课程组有效结结束时间不得早于最后一节课结束时间");
 		}
-		if(Objects.nonNull(practiceGroup.getBuyMonths())){
-			LocalDate courseStartDay = LocalDateTime.ofInstant(practiceGroup.getCoursesStartDate().toInstant(), DateUtil.zoneId).toLocalDate();
-			LocalDate currentExpiredDay = courseStartDay.plusMonths(practiceGroup.getBuyMonths()).plusDays(-1);
-			Date courseExpiredDateTemp=Date.from(currentExpiredDay.atStartOfDay(DateUtil.zoneId).toInstant());
-			if(coursesExpireDate.before(courseExpiredDateTemp)){
-				throw new BizException("课程结束时间不得早于,{}", DateUtil.dateToString(courseExpiredDateTemp, "yyyy年MM月dd日"));
-			}
-		}
+//		if(Objects.nonNull(practiceGroup.getBuyMonths())){
+//			LocalDate courseStartDay = LocalDateTime.ofInstant(practiceGroup.getCoursesStartDate().toInstant(), DateUtil.zoneId).toLocalDate();
+//			LocalDate currentExpiredDay = courseStartDay.plusMonths(practiceGroup.getBuyMonths()).plusDays(-1);
+//			Date courseExpiredDateTemp=Date.from(currentExpiredDay.atStartOfDay(DateUtil.zoneId).toInstant());
+//			if(coursesExpireDate.before(courseExpiredDateTemp)){
+//				throw new BizException("课程结束时间不得早于,{}", DateUtil.dateToString(courseExpiredDateTemp, "yyyy年MM月dd日"));
+//			}
+//		}
 		CoursesGroupModifyLog coursesGroupModifyLog = new CoursesGroupModifyLog();
 		coursesGroupModifyLog.setGroupId(practiceGroupId);
 		coursesGroupModifyLog.setGroupType(PRACTICE.getCode());

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

@@ -105,9 +105,11 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 					studentIds.add(e.getUserId());
 				}
 			}else {
+				calender.setActualNum((calender.getActualNum()==null?0:calender.getActualNum()) + 1);
 				e.setPaymentStatus(PAID_COMPLETED);
 			}
 		});
+		musicGroupPaymentCalenderDao.update(calender);
 		musicGroupPaymentCalenderDetailDao.batchUpdate(calenderDetails);
 		//推送消息
 		if (calender.getPayUserType() == STUDENT && studentIds.size() > 0) {

+ 12 - 15
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java

@@ -432,9 +432,6 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 					Set<Integer> list2 = Arrays.stream(ints).boxed().collect(Collectors.toSet());
 					musicGroupPaymentCalenderDetailService.batchAdd(musicGroupPaymentCalender.getId(),list2);
 				}
-			}
-
-			if(musicGroupPaymentCalender.getStatus() == OPEN){
 				//将0元未缴费学员缴费状态更新为已缴费
 				int j = musicGroupPaymentCalenderDetailDao.updateNoPaymentAndZeroPaymentStatus(musicGroupPaymentCalender.getId());
 				musicGroupPaymentCalender.setActualNum((musicGroupPaymentCalender.getActualNum()==null?0:musicGroupPaymentCalender.getActualNum()) + j);
@@ -750,6 +747,10 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 					//如果是跨团班级合并,添加学员
 					musicGroupPaymentCalenderDetailService.batchAdd(musicGroupPaymentCalender,musicGroupPaymentCalenderDto.getMusicGroupPaymentCalenderStudentDetails());
 				}
+				//将0元未缴费学员缴费状态更新为已缴费
+				int j = musicGroupPaymentCalenderDetailDao.updateNoPaymentAndZeroPaymentStatus(musicGroupPaymentCalender.getId());
+				musicGroupPaymentCalender.setActualNum((musicGroupPaymentCalender.getActualNum()==null?0:musicGroupPaymentCalender.getActualNum()) + j);
+				musicGroupPaymentCalenderDao.update(musicGroupPaymentCalender);
 			}
 
 			if (currentMusicGroupPaymentCalenderCourseSettings.size() > 0) {
@@ -763,13 +764,6 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 				}
 				musicGroupPaymentCalenderCourseSettingsDao.batchInsert(currentMusicGroupPaymentCalenderCourseSettings);
 			}
-
-			if(musicGroupPaymentCalender.getStatus() == OPEN){
-				//将0元未缴费学员缴费状态更新为已缴费
-				int j = musicGroupPaymentCalenderDetailDao.updateNoPaymentAndZeroPaymentStatus(musicGroupPaymentCalender.getId());
-				musicGroupPaymentCalender.setActualNum((musicGroupPaymentCalender.getActualNum()==null?0:musicGroupPaymentCalender.getActualNum()) + j);
-				musicGroupPaymentCalenderDao.update(musicGroupPaymentCalender);
-			}
 		}
 
 		// 如果是报名,需要修改乐团状态
@@ -1094,11 +1088,9 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 				List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettings = musicGroupPaymentCalenderCourseSettingsDao.queryCalenderCourseSettings(musicGroupPaymentCalender.getId());
 				addStudent(musicGroupPaymentCalender,musicGroupPaymentCalenderCourseSettings);
 			}
-			if(musicGroupPaymentCalender.getStatus() == OPEN){
-				//将0元未缴费学员缴费状态更新为已缴费
-				int j = musicGroupPaymentCalenderDetailDao.updateNoPaymentAndZeroPaymentStatus(musicGroupPaymentCalender.getId());
-				musicGroupPaymentCalender.setActualNum((musicGroupPaymentCalender.getActualNum()==null?0:musicGroupPaymentCalender.getActualNum()) + j);
-			}
+			//将0元未缴费学员缴费状态更新为已缴费
+			int j = musicGroupPaymentCalenderDetailDao.updateNoPaymentAndZeroPaymentStatus(musicGroupPaymentCalender.getId());
+			musicGroupPaymentCalender.setActualNum((musicGroupPaymentCalender.getActualNum()==null?0:musicGroupPaymentCalender.getActualNum()) + j);
 		}
 		MusicGroupPaymentCalender calender = musicGroupPaymentCalenders.get(0);
 		//如果是报名,并且所有的报名都审核通过,需要修改乐团状态
@@ -1143,6 +1135,11 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 			classGroupService.spanGroupClassAdjustPass(adjust.getMasterClassGroupId()
 					,studentIds,courseIds,classGroupStudents,allLockCourseIds,batchNo,adjust.getMasterTotalPrice());
 		}
+		for (MusicGroupPaymentCalender musicGroupPaymentCalender : musicGroupPaymentCalenders) {
+			//将0元未缴费学员缴费状态更新为已缴费
+			int j = musicGroupPaymentCalenderDetailDao.updateNoPaymentAndZeroPaymentStatus(musicGroupPaymentCalender.getId());
+			musicGroupPaymentCalender.setActualNum((musicGroupPaymentCalender.getActualNum()==null?0:musicGroupPaymentCalender.getActualNum()) + j);
+		}
 		musicGroupPaymentCalenderDao.batchUpdate(musicGroupPaymentCalenders);
 	}
 

+ 38 - 30
mec-common/audit-log/src/main/java/com/yonge/log/interceptor/AuditLogInterceptor.java

@@ -41,7 +41,7 @@ public class AuditLogInterceptor extends HandlerInterceptorAdapter {
 
 	private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 
-	private static List<String> logUrl;
+	private static List<String> ignoreLogUrl;
 
 
 
@@ -52,37 +52,45 @@ public class AuditLogInterceptor extends HandlerInterceptorAdapter {
 	}
 
 	@Override
-	public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
-		String servletPath = request.getServletPath();
-		HandlerMethod handlerMethod = (HandlerMethod) handler;
-		AuditLogAnnotation anno = handlerMethod.getMethodAnnotation(AuditLogAnnotation.class);
-		ApiOperation apiOperation = handlerMethod.getMethodAnnotation(ApiOperation.class);
-		String operateName = null;
-		if(StringUtils.isEmpty(operateName) && apiOperation != null){
-			operateName = apiOperation.value();
-		}
-		if(StringUtils.isEmpty(operateName) && anno != null){
-			operateName = anno.operateName();
-		}
-		if(anno != null){
-			saveLog(operateName,servletPath,request);
-			return;
-		}
-		if(servletPath.contains("/task/")){
-			return;
-		}
- 		String substring = servletPath.substring(servletPath.lastIndexOf("/") + 1).toLowerCase();
-		if(logUrl == null){
-			logUrl = new ArrayList<>();
-			logUrl.add("update");
-			logUrl.add("modify");
-			logUrl.add("del");
-		}
-		for (String e : logUrl) {
-			if(substring.contains(e)){
+	public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
+		try {
+			String servletPath = request.getServletPath();
+			HandlerMethod handlerMethod = (HandlerMethod) handler;
+			AuditLogAnnotation anno = handlerMethod.getMethodAnnotation(AuditLogAnnotation.class);
+			ApiOperation apiOperation = handlerMethod.getMethodAnnotation(ApiOperation.class);
+			String operateName = null;
+			if(StringUtils.isEmpty(operateName) && apiOperation != null){
+				operateName = apiOperation.value();
+			}
+			if(StringUtils.isEmpty(operateName) && anno != null){
+				operateName = anno.operateName();
+			}
+			if(anno != null){
 				saveLog(operateName,servletPath,request);
-				break;
+				return;
+			}
+			if(servletPath.contains("/task/") || servletPath.contains("/import/") ){
+				return;
 			}
+			String substring = servletPath.substring(servletPath.lastIndexOf("/") + 1).toLowerCase();
+			if(ignoreLogUrl == null){
+				ignoreLogUrl = new ArrayList<>();
+				ignoreLogUrl.add("add");
+				ignoreLogUrl.add("insert");
+				ignoreLogUrl.add("query");
+				ignoreLogUrl.add("get");
+				ignoreLogUrl.add("find");
+				ignoreLogUrl.add("list");
+				ignoreLogUrl.add("detail");
+			}
+			for (String e : ignoreLogUrl) {
+				if(substring.contains(e)){
+					return;
+				}
+			}
+			saveLog(operateName,servletPath,request);
+		}catch (Exception e){
+			e.printStackTrace();
 		}
 	}