zouxuan 3 年之前
父節點
當前提交
b40afd9bd0

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

@@ -679,7 +679,8 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 			dayOfWeekMap.put(dto.getDayOfWeek(), list);
 		}
 
-		Calendar calendar = Calendar.getInstance();
+        Integer tenantId = TenantContextHolder.getTenantId();
+        Calendar calendar = Calendar.getInstance();
 		Date now = new Date();
 		List<CourseTimeDto> courseTimeDtoList = null;
 		List<CourseSchedule> courseScheduleList = new ArrayList<CourseSchedule>();
@@ -688,9 +689,9 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 		List<TeacherAttendance> teacherAttendances = new ArrayList<TeacherAttendance>();
 		Set<String> holidayDays = new HashSet<>();
 		if (isJumpHoliday) {
-			SysConfig holidaySetting = sysConfigService.findByParamName(SysConfigService.HOLIDAY_SETTING);
-			if(Objects.nonNull(holidaySetting)&&StringUtils.isNotBlank(holidaySetting.getParanValue())){
-				holidayDays = new HashSet<>(JSON.parseArray(holidaySetting.getParanValue(), String.class));
+			String holidaySetting = sysTenantConfigService.getTenantConfigValue(SysConfigService.HOLIDAY_SETTING,tenantId);
+			if(StringUtils.isNotBlank(holidaySetting)){
+				holidayDays = new HashSet<>(JSON.parseArray(holidaySetting, String.class));
 			}
 		}
 		calendar.setTime(startDate);
@@ -1761,12 +1762,12 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 		List<Date> courseStartDates = new ArrayList<>();
 
 		Set<String> holidayDays = new HashSet<>();
-
-		if (courseAdjustInfo.isHoliday()) {
-			SysConfig holidaySetting = sysConfigService.findByParamName(SysConfigService.HOLIDAY_SETTING);
-			if(StringUtils.isNotBlank(holidaySetting.getParanValue())){
-				holidayDays = new HashSet<>(JSON.parseArray(holidaySetting.getParanValue(), String.class));
-			}
+        Integer tenantId = TenantContextHolder.getTenantId();
+        if (courseAdjustInfo.isHoliday()) {
+            String holidaySetting = sysTenantConfigService.getTenantConfigValue(SysConfigService.HOLIDAY_SETTING,tenantId);
+            if(StringUtils.isNotBlank(holidaySetting)){
+                holidayDays = new HashSet<>(JSON.parseArray(holidaySetting, String.class));
+            }
 		}
 
 		Map<String, List<CourseSchedule>> result = new HashMap<String, List<CourseSchedule>>(){{
@@ -2543,11 +2544,12 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 
 		Set<String> holidayDays = new HashSet<>();
 
-		if (vipGroupCourseAdjustInfo.isHoliday()) {
-			SysConfig holidaySetting = sysConfigService.findByParamName(SysConfigService.HOLIDAY_SETTING);
-			if(StringUtils.isNotBlank(holidaySetting.getParanValue())){
-				holidayDays = new HashSet<>(JSON.parseArray(holidaySetting.getParanValue(), String.class));
-			}
+        Integer tenantId = TenantContextHolder.getTenantId();
+        if (vipGroupCourseAdjustInfo.isHoliday()) {
+            String holidaySetting = sysTenantConfigService.getTenantConfigValue(SysConfigService.HOLIDAY_SETTING,tenantId);
+            if(StringUtils.isNotBlank(holidaySetting)){
+                holidayDays = new HashSet<>(JSON.parseArray(holidaySetting, String.class));
+            }
 		}
 
         while (true) {
@@ -2781,12 +2783,13 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 		int betweenDays = 0;
 		//节假日
 		Set<String> holidayDays = new HashSet<>();
-		if(Objects.nonNull(courseAdjustInfo.getPauseDate())&&Objects.nonNull(courseAdjustInfo.getRecoveryDate())){
+        Integer tenantId = TenantContextHolder.getTenantId();
+        if(Objects.nonNull(courseAdjustInfo.getPauseDate())&&Objects.nonNull(courseAdjustInfo.getRecoveryDate())){
 			if (courseAdjustInfo.getHoliday()) {
-				SysConfig holidaySetting = sysConfigService.findByParamName(SysConfigService.HOLIDAY_SETTING);
-				if(Objects.nonNull(holidaySetting)&&StringUtils.isNotBlank(holidaySetting.getParanValue())){
-					holidayDays = new HashSet<>(JSON.parseArray(holidaySetting.getParanValue(), String.class));
-				}
+                String holidaySetting = sysTenantConfigService.getTenantConfigValue(SysConfigService.HOLIDAY_SETTING,tenantId);
+                if(StringUtils.isNotBlank(holidaySetting)){
+                    holidayDays = new HashSet<>(JSON.parseArray(holidaySetting, String.class));
+                }
 			}
 
 			LocalDate pauseDate = LocalDate.parse(courseAdjustInfo.getPauseDate(), DateUtil.dateFormatter);
@@ -3049,11 +3052,12 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 
 		Set<String> holidayDays = new HashSet<>();
 
-		if (coursePostPoneInfo.isSkipHoliday()) {
-			SysConfig holidaySetting = sysConfigService.findByParamName(SysConfigService.HOLIDAY_SETTING);
-			if(Objects.nonNull(holidaySetting)&&StringUtils.isNotBlank(holidaySetting.getParanValue())){
-				holidayDays = new HashSet<>(JSON.parseArray(holidaySetting.getParanValue(), String.class));
-			}
+        Integer tenantId = TenantContextHolder.getTenantId();
+        if (coursePostPoneInfo.isSkipHoliday()) {
+            String holidaySetting = sysTenantConfigService.getTenantConfigValue(SysConfigService.HOLIDAY_SETTING,tenantId);
+            if(StringUtils.isNotBlank(holidaySetting)){
+                holidayDays = new HashSet<>(JSON.parseArray(holidaySetting, String.class));
+            }
 		}
 
         classGroupCourseSchedulesWithDate.sort(Comparator.comparing(CourseSchedule::getStartClassTime));
@@ -3130,10 +3134,11 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 		Set<String> holidayDays = new HashSet<>();
 
 		if (vipGroupCourseAdjustInfo.isHoliday()) {
-			SysConfig holidaySetting = sysConfigService.findByParamName(SysConfigService.HOLIDAY_SETTING);
-			if(Objects.nonNull(holidaySetting)&&StringUtils.isNotBlank(holidaySetting.getParanValue())){
-				holidayDays = new HashSet<>(JSON.parseArray(holidaySetting.getParanValue(), String.class));
-			}
+            Integer tenantId = TenantContextHolder.getTenantId();
+            String holidaySetting = sysTenantConfigService.getTenantConfigValue(SysConfigService.HOLIDAY_SETTING,tenantId);
+            if(StringUtils.isNotBlank(holidaySetting)){
+                holidayDays = new HashSet<>(JSON.parseArray(holidaySetting, String.class));
+            }
 		}
 
         List<CourseSchedule> courseSchedules = new ArrayList<>();
@@ -4576,10 +4581,11 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
         Set<String> holidayDays = new HashSet<>();
 
 		if (courseGenerateInfo.isSkipHoliday()) {
-			SysConfig holidaySetting = sysConfigService.findByParamName(SysConfigService.HOLIDAY_SETTING);
-			if(Objects.nonNull(holidaySetting)&&StringUtils.isNotBlank(holidaySetting.getParanValue())){
-				holidayDays = new HashSet<>(JSON.parseArray(holidaySetting.getParanValue(), String.class));
-			}
+            Integer tenantId = TenantContextHolder.getTenantId();
+            String holidaySetting = sysTenantConfigService.getTenantConfigValue(SysConfigService.HOLIDAY_SETTING,tenantId);
+            if(StringUtils.isNotBlank(holidaySetting)){
+                holidayDays = new HashSet<>(JSON.parseArray(holidaySetting, String.class));
+            }
 		}
 
         List<CourseSchedule> courseSchedules = new ArrayList<>();

+ 7 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/OnlineMusicGroupServiceImpl.java

@@ -15,6 +15,7 @@ import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.ImGroupMember;
 import com.ym.mec.common.entity.ImGroupModel;
 import com.ym.mec.common.exception.BizException;
+import com.ym.mec.common.tenant.TenantContextHolder;
 import com.ym.mec.im.ImFeignService;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 import com.ym.mec.util.date.DateUtil;
@@ -82,6 +83,8 @@ public class OnlineMusicGroupServiceImpl implements OnlineMusicGroupService {
     private ImGroupMemberService imGroupMemberService;
     @Autowired
     private SysMessageService sysMessageService;
+    @Autowired
+    private SysTenantConfigService sysTenantConfigService;
 
     @Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
     @Override
@@ -419,9 +422,10 @@ public class OnlineMusicGroupServiceImpl implements OnlineMusicGroupService {
         Set<String> holidayDays = new HashSet<>();
 
         if (skipHoliday) {
-            SysConfig holidaySetting = sysConfigService.findByParamName(SysConfigService.HOLIDAY_SETTING);
-            if(Objects.nonNull(holidaySetting)&&StringUtils.isNotBlank(holidaySetting.getParanValue())){
-                holidayDays = new HashSet<>(JSON.parseArray(holidaySetting.getParanValue(), String.class));
+            Integer tenantId = TenantContextHolder.getTenantId();
+            String holidaySetting = sysTenantConfigService.getTenantConfigValue(SysConfigService.HOLIDAY_SETTING,tenantId);
+            if(StringUtils.isNotBlank(holidaySetting)){
+                holidayDays = new HashSet<>(JSON.parseArray(holidaySetting, String.class));
             }
         }
 

+ 4 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentServeServiceImpl.java

@@ -7,6 +7,7 @@ import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.enums.*;
 import com.ym.mec.biz.service.StudentServeService;
 import com.ym.mec.biz.service.SysConfigService;
+import com.ym.mec.biz.service.SysTenantConfigService;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.tenant.TenantContextHolder;
 import com.ym.mec.util.date.DateUtil;
@@ -47,7 +48,7 @@ public class StudentServeServiceImpl implements StudentServeService {
     @Autowired
     private StudentServeService studentServeService;
     @Autowired
-    private SysConfigDao sysConfigDao;
+    private SysTenantConfigService sysTenantConfigService;
     @Autowired
     private ClassGroupStudentMapperDao classGroupStudentMapperDao;
     @Autowired
@@ -316,8 +317,8 @@ public class StudentServeServiceImpl implements StudentServeService {
         Date nextMonday = Date.from(sunDayDate.plusDays(1).atStartOfDay(DateUtil.zoneId).toInstant());
 
         Set<String> holidayDays = new HashSet<>();
-        String holidaySetting = sysConfigDao.findConfigValue(SysConfigService.HOLIDAY_SETTING);
-        if(StringUtils.isNotEmpty(holidaySetting)){
+        String holidaySetting = sysTenantConfigService.getTenantConfigValue(SysConfigService.HOLIDAY_SETTING,tenantId);
+        if(StringUtils.isNotBlank(holidaySetting)){
             holidayDays = new HashSet<>(JSON.parseArray(holidaySetting, String.class));
         }
         LocalDate everyDay=monDayDate;

+ 12 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherCourseStatisticsServiceImpl.java

@@ -8,6 +8,7 @@ import com.ym.mec.biz.dal.entity.SysConfig;
 import com.ym.mec.biz.dal.entity.TeacherCourseStatistics;
 import com.ym.mec.biz.dal.page.TeacherCourseStatisticsQueryInfo;
 import com.ym.mec.biz.service.SysConfigService;
+import com.ym.mec.biz.service.SysTenantConfigService;
 import com.ym.mec.biz.service.TeacherCourseStatisticsService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.page.PageInfo;
@@ -16,6 +17,7 @@ import com.ym.mec.common.tenant.TenantContextHolder;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
 
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -30,6 +32,8 @@ public class TeacherCourseStatisticsServiceImpl extends BaseServiceImpl<Long, Te
     private TeacherCourseStatisticsDao teacherCourseStatisticsDao;
     @Autowired
     private SysConfigService sysConfigService;
+    @Autowired
+    private SysTenantConfigService sysTenantConfigService;
 
     @Override
     public BaseDAO<Long, TeacherCourseStatistics> getDAO() {
@@ -63,8 +67,14 @@ public class TeacherCourseStatisticsServiceImpl extends BaseServiceImpl<Long, Te
         if (teacherCourseStatisticsList.size() == 0) {
             return;
         }
-        SysConfig salaryConfig = sysConfigService.findByParamName(SysConfigService.WARNING_MIN_COURSE_SALARY);
-        JSONObject salaryConfigObject = JSON.parseObject(salaryConfig.getParanValue());
+        Integer tenantId = TenantContextHolder.getTenantId();
+        String configValue = sysTenantConfigService.getTenantConfigValue(SysConfigService.WARNING_MIN_COURSE_SALARY, tenantId);
+        JSONObject salaryConfigObject;
+        if(StringUtils.isNotEmpty(configValue)){
+            salaryConfigObject = JSON.parseObject(configValue);
+        }else {
+            salaryConfigObject = new JSONObject();
+        }
 
         List<Integer> userIds = teacherCourseStatisticsList.stream().map(TeacherCourseStatistics::getUserId).collect(Collectors.toList());
         List<TeacherCourseStatistics> teCourseSalaryStaticsAndTypes = teacherCourseStatisticsDao.findUserCourseSalaryByUserIds(userIds, startDate, endDate);

+ 6 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

@@ -158,6 +158,8 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
     @Autowired
     private SysConfigService sysConfigService;
     @Autowired
+    private SysTenantConfigService sysTenantConfigService;
+    @Autowired
     private SysCouponCodeService sysCouponCodeService;
     @Autowired
     private ActivityUserMapperService activityUserMapperService;
@@ -1591,9 +1593,10 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
             Set<String> holidayDays = new HashSet<>();
 
             if (skipHoliday) {
-                SysConfig holidaySetting = sysConfigService.findByParamName(SysConfigService.HOLIDAY_SETTING);
-                if (Objects.nonNull(holidaySetting) && StringUtils.isNotBlank(holidaySetting.getParanValue())) {
-                    holidayDays = new HashSet<>(JSON.parseArray(holidaySetting.getParanValue(), String.class));
+                Integer tenantId = TenantContextHolder.getTenantId();
+                String holidaySetting = sysTenantConfigService.getTenantConfigValue(SysConfigService.HOLIDAY_SETTING,tenantId);
+                if(StringUtils.isNotBlank(holidaySetting)){
+                    holidayDays = new HashSet<>(JSON.parseArray(holidaySetting, String.class));
                 }
             }
 

+ 8 - 1
mec-web/src/main/java/com/ym/mec/web/controller/TaskController.java

@@ -299,7 +299,14 @@ public class TaskController extends BaseController {
 	// 统计老师课酬
 	@GetMapping("/teacherCourseStatistic")
 	public void teacherCourseStatisticsService() throws Exception {
-		teacherCourseStatisticsService.teacherCourseStatistic();
+		List<TenantInfo> tenantInfos = tenantInfoService.list(new QueryWrapper<TenantInfo>().eq("state_",1));
+		if(tenantInfos != null && tenantInfos.size() > 0){
+			for (TenantInfo tenantInfo : tenantInfos) {
+				TenantContextHolder.setTenantId(tenantInfo.getId());
+				teacherCourseStatisticsService.teacherCourseStatistic();
+				TenantContextHolder.clearTenantId();
+			}
+		}
 	}
 
 	// 更新历史陪练课至已结束