zouxuan преди 3 години
родител
ревизия
68b0bd7523
променени са 19 файла, в които са добавени 290 реда и са изтрити 299 реда
  1. 0 2
      cms/src/main/java/com/ym/mec/cms/service/SysConfigService.java
  2. 11 4
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/TeacherAttendanceDto.java
  3. 37 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/UnitEnum.java
  4. 3 3
      mec-biz/src/main/java/com/ym/mec/biz/service/CourseScheduleTeacherSalaryService.java
  5. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/service/IndexBaseMonthDataService.java
  6. 14 7
      mec-biz/src/main/java/com/ym/mec/biz/service/SysConfigService.java
  7. 2 2
      mec-biz/src/main/java/com/ym/mec/biz/service/SysTenantConfigService.java
  8. 21 8
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java
  9. 6 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java
  10. 87 160
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleTeacherSalaryServiceImpl.java
  11. 17 11
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/IndexBaseMonthDataServiceImpl.java
  12. 13 18
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupSubjectPlanServiceImpl.java
  13. 3 3
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentAttendanceServiceImpl.java
  14. 15 28
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java
  15. 12 2
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysTenantConfigServiceImpl.java
  16. 3 1
      mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml
  17. 3 3
      mec-biz/src/main/resources/config/mybatis/CourseScheduleTeacherSalaryMapper.xml
  18. 14 11
      mec-web/src/main/java/com/ym/mec/web/controller/IndexController.java
  19. 28 34
      mec-web/src/main/java/com/ym/mec/web/controller/TaskController.java

+ 0 - 2
cms/src/main/java/com/ym/mec/cms/service/SysConfigService.java

@@ -35,8 +35,6 @@ public interface SysConfigService extends BaseService<Long, SysConfig> {
      */
     public static final String ATTENDANCE_RANGE = "attendance_range";
 
-    String ATTENDANCE_RANGE_VIP = "attendance_range_vip";
-
     /**
      * 学生允许请假的时间,为开课前{}小时
      */

+ 11 - 4
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/TeacherAttendanceDto.java

@@ -2,10 +2,7 @@ package com.ym.mec.biz.dal.dto;
 
 import com.ym.mec.biz.dal.entity.ClassGroup;
 import com.ym.mec.biz.dal.entity.CourseSchedule;
-import com.ym.mec.biz.dal.enums.ClassGroupTypeEnum;
-import com.ym.mec.biz.dal.enums.CourseStatusEnum;
-import com.ym.mec.biz.dal.enums.CourseViewTypeEnum;
-import com.ym.mec.biz.dal.enums.YesOrNoEnum;
+import com.ym.mec.biz.dal.enums.*;
 import io.swagger.annotations.ApiModelProperty;
 
 import java.util.Date;
@@ -42,6 +39,8 @@ public class TeacherAttendanceDto {
 
     private CourseSchedule.CourseScheduleType courseType;
 
+    private TeachModeEnum teachMode;
+
     @ApiModelProperty(value = "乐团ID",required = false)
     private String musicGroupId;
 
@@ -112,6 +111,14 @@ public class TeacherAttendanceDto {
     @ApiModelProperty(value = "课程规划")
     private String coursePlan;
 
+    public TeachModeEnum getTeachMode() {
+        return teachMode;
+    }
+
+    public void setTeachMode(TeachModeEnum teachMode) {
+        this.teachMode = teachMode;
+    }
+
     public String getCoursePlan() {
         return coursePlan;
     }

+ 37 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/UnitEnum.java

@@ -0,0 +1,37 @@
+package com.ym.mec.biz.dal.enums;
+
+import com.ym.mec.common.enums.BaseEnum;
+
+/**
+ * 审核状态枚举(元、%)
+ */
+public enum UnitEnum implements BaseEnum<String, UnitEnum> {
+	PERCENTAGE("PERCENTAGE", "审核中"),
+	YUAN("YUAN", "元");
+
+	private String code;
+
+	private String msg;
+
+	UnitEnum(String code, String msg) {
+		this.code = code;
+		this.msg = msg;
+	}
+
+	public void setCode(String code) {
+		this.code = code;
+	}
+
+	public String getMsg() {
+		return msg;
+	}
+
+	public void setMsg(String msg) {
+		this.msg = msg;
+	}
+
+	@Override
+	public String getCode() {
+		return this.code;
+	}
+}

+ 3 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/CourseScheduleTeacherSalaryService.java

@@ -52,7 +52,7 @@ public interface CourseScheduleTeacherSalaryService extends BaseService<Long, Co
      * @return void
      * @describe 教师vip课课酬结算
      */
-    void teacherSalarySettlement();
+    void teacherSalarySettlement(Integer tenantId);
 
     /**
      * @Author: Joburgess
@@ -61,7 +61,7 @@ public interface CourseScheduleTeacherSalaryService extends BaseService<Long, Co
      * @return void
      * @describe 教师陪练课课酬结算
      */
-    void practiceTeacherSalarySettlement();
+    void practiceTeacherSalarySettlement(Integer tenantId);
 
     /**
      * @describe 教师乐团课课酬结算
@@ -69,7 +69,7 @@ public interface CourseScheduleTeacherSalaryService extends BaseService<Long, Co
      * @date 2019/11/3
      * @return void
      */
-    void musicGroupTeacherSalarySettlement();
+    void musicGroupTeacherSalarySettlement(Integer tenantId);
 
     /**
      * 获取教师薪酬列表

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/IndexBaseMonthDataService.java

@@ -32,7 +32,7 @@ public interface IndexBaseMonthDataService extends BaseService<Long, IndexBaseMo
      * @param organIds
      * @return
      */
-    List<IndexErrInfoDto> getRemindMatterData(String organIds);
+    List<IndexErrInfoDto> getRemindMatterData(String organIds,Integer tenantId);
 
     /**
      * 是否有提醒事项

+ 14 - 7
mec-biz/src/main/java/com/ym/mec/biz/service/SysConfigService.java

@@ -18,6 +18,20 @@ public interface SysConfigService extends BaseService<Long, SysConfig> {
     String MUSIC_GROUP_TOPIC_ID = "music_group_topic_id";
     //自动确认收货时间
     String AUTO_AFFIRM_RECEIVE_TIME = "music_group_topic_id";
+    //各声部不购买会员入团资格限制学员数
+    String MEMBER_GROUP_FEE_STUDENT_NUM = "member_group_fee_student_num";
+    //会员团每学期赠送课程分钟数
+    String MEMBER_GROUP_TERM_GIVE_COURSE_TIME = "member_group_term_give_course_time";
+    //提醒老师创建新的缴费项目,距离缴费项有效期前{}天
+    String PUSH_CREATE_PAYMENT_CALENDER = "push_create_payment_calender";
+    //线下课老师可以打卡范围,GPS定位距离教学点距离
+    String ATTENDANCE_RANGE = "attendance_range";
+    //线下课定位异常扣除金额
+    String OFFLINE_GPS_ERROR_CUT_SALARY = "offline_gps_error_cut_salary";
+    //线下课定位异常扣除金额
+    String OFFLINE_GPS_ERROR_CUT_SALARY_UNIT = "offline_gps_error_cut_salary_unit";
+    //试用期老师课酬发放百分比
+    String PROBATION_TEACHER_SALARY = "probation_teacher_salary";
 
     public static final String BASE_API_URL = "base_api_url";
 
@@ -44,13 +58,6 @@ public interface SysConfigService extends BaseService<Long, SysConfig> {
     String ADVANCE_SIGN_OUT_MINUTES = "advance_sign_out_minutes";
 
     /**
-     * 老师可以打卡范围,为教学定位方圆{}米
-     */
-    public static final String ATTENDANCE_RANGE = "attendance_range";
-
-    String ATTENDANCE_RANGE_VIP = "attendance_range_vip";
-
-    /**
      * 学生允许请假的时间,为开课前{}小时
      */
     public static final String ADVANCE_LEAVE_HOURS = "advance_leave_hours";

+ 2 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/SysTenantConfigService.java

@@ -3,8 +3,6 @@ package com.ym.mec.biz.service;
 import com.ym.mec.biz.dal.entity.SysConfig;
 import com.ym.mec.biz.dal.entity.SysTenantConfig;
 import com.ym.mec.common.service.BaseService;
-import org.apache.ibatis.annotations.Param;
-
 import java.util.List;
 import java.util.Map;
 
@@ -14,4 +12,6 @@ public interface SysTenantConfigService extends BaseService<Integer, SysTenantCo
 
     void batchUpSet(List<SysConfig> sysConfigs, Integer tenantId);
 
+    String getConfigValue(String paramName, Integer tenantId);
+
 }

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

@@ -128,6 +128,8 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
     @Autowired
     private SysConfigDao sysConfigDao;
     @Autowired
+    private SysTenantConfigDao sysTenantConfigDao;
+    @Autowired
     private SubjectDao subjectDao;
     @Autowired
     private GroupDao groupDao;
@@ -2790,6 +2792,17 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             throw new BizException("当前班级已冻结无法操作预排课");
         }
         MusicGroup musicGroup = musicGroupDao.get(classGroup.getMusicGroupId());
+        if(musicGroup == null){
+            throw new BizException("乐团信息查询失败");
+        }
+        if(musicGroup.getTenantId() == null){
+            throw new BizException("乐团机构信息异常,请联系管理员");
+        }
+        String configValue = sysTenantConfigDao.getConfigValue(SysConfigService.MEMBER_GROUP_TERM_GIVE_COURSE_TIME, musicGroup.getTenantId());
+        if(StringUtils.isEmpty(configValue)){
+            throw new BizException("请配置会员团每学期赠送课程分钟数");
+        }
+        Integer giveCourseTime = Integer.parseInt(configValue);
 
         Boolean confirmGenerate = false;
         if (Objects.nonNull(classGroup4MixDtos.get(0).getConfirmGenerate())) {
@@ -2834,25 +2847,25 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                     classGroup4MixDto.getCourseType() == TRAINING_SINGLE || classGroup4MixDto.getCourseType() == TRAINING_MIX){
                 //单技课和合奏课最大的排课时长不能超过44 * 45 分钟
                 if(classGroup4MixDto.getCourseType() == SINGLE || classGroup4MixDto.getCourseType() == TRAINING_SINGLE){
-                    if(totalCourseMinutes > 44 * 45){
-                        throw new BizException("声部类型总时长不能超过最大限制(1980分钟)");
+                    if(totalCourseMinutes > giveCourseTime){
+                        throw new BizException("声部类型总时长不能超过最大限制({}分钟)",giveCourseTime);
                     }
                     singleCourseMinutes = totalCourseMinutes;
                     //获取所选学员最大的已消耗的单技课时长
                     int maxSingleCourseMinutes = musicGroupSchoolTermStudentCourseDetailDao.getMaxSingleCourseMinutes(musicGroupSchoolTermCourseDetailId,studentIds);
-                    if(44 * 45 - maxSingleCourseMinutes < totalCourseMinutes){
+                    if(giveCourseTime - maxSingleCourseMinutes < totalCourseMinutes){
 //                        throw new BizException("操作失败:所选学员可排单技课时长已不足{}分钟",totalCourseMinutes);
-                        throw new BizException("声部类型总时长不能超过最大限制(1980分钟)");
+                        throw new BizException("声部类型总时长不能超过最大限制({}分钟)",giveCourseTime);
                     }
                 } else {
-                    if(totalCourseMinutes > 44 * 45){
-                        throw new BizException("合奏类型总时长不能超过最大限制(1980分钟)");
+                    if(totalCourseMinutes > giveCourseTime){
+                        throw new BizException("合奏类型总时长不能超过最大限制({}分钟)",giveCourseTime);
                     }
                     totalMixCourseMinutes = totalCourseMinutes;
                     int maxMixCourseMinutes = musicGroupSchoolTermStudentCourseDetailDao.getMaxMixCourseMinutes(musicGroupSchoolTermCourseDetailId,studentIds);
-                    if(44 * 45 - maxMixCourseMinutes < totalCourseMinutes){
+                    if(giveCourseTime - maxMixCourseMinutes < totalCourseMinutes){
 //                        throw new BizException("操作失败:所选学员可排合奏课时长已不足{}分钟",totalCourseMinutes);
-                        throw new BizException("合奏类型总时长不能超过最大限制(1980分钟)");
+                        throw new BizException("合奏类型总时长不能超过最大限制({}分钟)",giveCourseTime);
                     }
                 }
             }

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

@@ -81,6 +81,8 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
     @Autowired
     private SysConfigDao sysConfigDao;
     @Autowired
+    private SysTenantConfigService sysTenantConfigService;
+    @Autowired
     private StudentAttendanceDao studentAttendanceDao;
     @Autowired
     private ClassGroupStudentMapperDao classGroupStudentMapperDao;
@@ -189,6 +191,9 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
         if (null == user) {
             throw new BizException("获取用户信息失败");
         }
+        if (null == user.getTenantId()) {
+            throw new BizException("用户机构信息异常,请联系管理员");
+        }
         if (Objects.isNull(courseID)) {
             throw new BizException("参数错误!");
         }
@@ -226,7 +231,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
         currentCourseDetail.setNormalRemind(normalRemindNum<=0?0:1);
 		currentCourseDetail.setCurrentTime(new Date());
         currentCourseDetail.setAdvanceSignInMinutes(Integer.parseInt(sysConfigDao.findConfigValue(SysConfigService.ADVANCE_SIGN_IN_MINUTES)));
-		currentCourseDetail.setAttendanceRange(CourseScheduleType.VIP.equals(currentCourseDetail.getCourseType())?Integer.parseInt(sysConfigDao.findConfigValue(SysConfigService.ATTENDANCE_RANGE_VIP)):Integer.parseInt(sysConfigDao.findConfigValue(SysConfigService.ATTENDANCE_RANGE)));
+		currentCourseDetail.setAttendanceRange(sysTenantConfigService.getAttendanceRange(user.getTenantId(),currentCourseDetail.getTeachMode()));
         currentCourseDetail.setAdvanceSignOutMinutes(Integer.parseInt(sysConfigDao.findConfigValue(SysConfigService.ADVANCE_SIGN_OUT_MINUTES)));
 		CourseSchedule courseSchedule = courseScheduleDao.get(courseID);
 		//获取课程规划

+ 87 - 160
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleTeacherSalaryServiceImpl.java

@@ -64,6 +64,8 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
     @Autowired
     private SysConfigService sysConfigDao;
     @Autowired
+    private SysTenantConfigService sysTenantConfigService;
+    @Autowired
     private TeacherAttendanceDao teacherAttendanceDao;
     @Autowired
     private ClassGroupDao classGroupDao;
@@ -72,16 +74,10 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
     @Autowired
     private ClassGroupStudentMapperDao classGroupStudentMapperDao;
     @Autowired
-    private TeacherDefaultVipGroupSalaryDao teacherDefaultVipGroupSalaryDao;
-    @Autowired
     private CourseScheduleRewardsRulesService courseScheduleRewardsRulesService;
     @Autowired
-    private StudentAttendanceDao studentAttendanceDao;
-    @Autowired
     private TeacherSalaryComplaintsDao teacherSalaryComplaintsDao;
     @Autowired
-    private TeacherCourseRewardService teacherCourseRewardService;
-    @Autowired
     private SysMessageService sysMessageService;
     @Autowired
     private TeacherCourseRewardDao teacherCourseRewardDao;
@@ -216,7 +212,7 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public void practiceTeacherSalarySettlement() {
+    public void practiceTeacherSalarySettlement(Integer tenantId) {
         //获取教师未结算课程记录
         Date now = new Date();
         Date date = DateUtil.addMonths(now, -1);
@@ -242,28 +238,21 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
             return;
         }
 
-        BigDecimal zero = new BigDecimal("0");
+        //试用期课酬规则
+        String configValue2 = sysTenantConfigService.getConfigValue(SysConfigService.PROBATION_TEACHER_SALARY,tenantId);
+        Integer probationTeacherSalary = 100;
+        if(StringUtils.isNotEmpty(configValue2)){
+            probationTeacherSalary = Integer.parseInt(configValue2);
+        }
 
-        //获取课程对应教学点补贴
-//        List<Map<Long, BigDecimal>> courseSubsidyByCourses = courseScheduleTeacherSalaryDao.findCourseSubsidyByCourses(new ArrayList<>(courseScheduleIds));
-//        Map<Integer, BigDecimal> courseSubsidyMap = MapUtil.convertIntegerMap(courseSubsidyByCourses);
+        BigDecimal zero = new BigDecimal("0");
 
-        someDayAgoTeacherCourseSalaryNoSettlement.forEach(courseScheduleTeacherSalary -> {
+        for (int i = 0; i < someDayAgoTeacherCourseSalaryNoSettlement.size(); i++) {
+            CourseScheduleTeacherSalary courseScheduleTeacherSalary = someDayAgoTeacherCourseSalaryNoSettlement.get(i);
             List<String> deductReasons = new ArrayList<>();
 
             BigDecimal expectSalary = courseScheduleTeacherSalary.getExpectSalary();
 
-//            BigDecimal subsidy = courseSubsidyMap.get(courseScheduleTeacherSalary.getCourseScheduleId());
-//            if (Objects.isNull(subsidy)) {
-//                subsidy = new BigDecimal(0);
-//            }
-//            courseScheduleTeacherSalary.setSubsidy(subsidy);
-//            expectSalary = expectSalary.add(subsidy);
-//
-//            if(BigDecimal.ZERO.compareTo(subsidy)!=0){
-//                deductReasons.add("教学点补贴:" + subsidy);
-//            }
-
             if(Objects.isNull(courseScheduleTeacherSalary.getSubsidy())){
                 courseScheduleTeacherSalary.setSubsidy(zero);
             }
@@ -286,22 +275,9 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
                 return;
             }
 
-//            boolean notPositive = Objects.nonNull(teacher)&&Objects.nonNull(teacher.getFormalStaffDate())&&courseScheduleTeacherSalary.getCourseSchedule().getClassDate().compareTo(teacher.getFormalStaffDate())<0;
-//            boolean isProbationPeriod = Objects.nonNull(teacher)&&Objects.nonNull(teacher.getIsProbationPeriod())&&ProbationPeriodEnum.TRY.equals(teacher.getIsProbationPeriod());
-
             //判断课程是否在试用期内
-            boolean trail = false;
-
-            if(Objects.nonNull(teacher)&&Objects.nonNull(teacher.getEntryDate())&&courseScheduleTeacherSalary.getCourseSchedule().getClassDate().compareTo(teacher.getEntryDate())>=0){
-                trail = true;
-            }
-            if(Objects.nonNull(teacher)&&Objects.nonNull(teacher.getFormalStaffDate())&&courseScheduleTeacherSalary.getCourseSchedule().getClassDate().compareTo(teacher.getFormalStaffDate())>=0){
-                trail = false;
-            }
-
-            //如果上课日期在试用期内按80%结算
-            if(trail){
-                expectSalary = expectSalary.multiply(new BigDecimal("0.8"));
+            if(isTrail(teacher,courseScheduleTeacherSalary.getCourseSchedule().getClassDate())){
+                expectSalary = expectSalary.multiply(new BigDecimal(probationTeacherSalary/100));
                 deductReasons.add("未转正");
             }
 
@@ -364,12 +340,12 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
             courseScheduleTeacherSalary.setSettlementTime(now);
             courseScheduleTeacherSalary.setBelongToDaya(false);
             courseScheduleTeacherSalaryDao.update(courseScheduleTeacherSalary);
-        });
+        }
     }
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public void teacherSalarySettlement() {
+    public void teacherSalarySettlement(Integer tenantId) {
         Date now = new Date();
         Date date = DateUtil.addMonths(now, -1);
         String startDate = DateUtil.format(DateUtil.getFirstDayOfMonth(date),DateUtil.DEFAULT_PATTERN);
@@ -388,6 +364,13 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
             LOGGER.info("未获取到未结算课酬记录!");
             return;
         }
+
+        //试用期课酬规则
+        String configValue2 = sysTenantConfigService.getConfigValue(SysConfigService.PROBATION_TEACHER_SALARY,tenantId);
+        Integer probationTeacherSalary = 100;
+        if(StringUtils.isNotEmpty(configValue2)){
+            probationTeacherSalary = Integer.parseInt(configValue2);
+        }
         //获取未结算课程编号列表
         List<Long> courseScheduleIds = someDayAgoTeacherCourseSalaryNoSettlement.stream().map(CourseScheduleTeacherSalary::getCourseScheduleId).collect(Collectors.toList());
 
@@ -395,30 +378,15 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
         List<TeacherAttendance> allTeacherAttendances = teacherAttendanceDao.findByCourseSchedules(courseScheduleIds);
         Map<String, List<TeacherAttendance>> teacherCourseAttendanceMap = allTeacherAttendances.stream().collect(Collectors.groupingBy(ta -> org.apache.commons.lang3.StringUtils.joinWith(":", ta.getCourseScheduleId(), ta.getTeacherId())));
 
-        BigDecimal zero = new BigDecimal(0);
-
-        //获取课程对应教学点补贴
-//        List<Map<Long, BigDecimal>> courseSubsidyByCourses = courseScheduleTeacherSalaryDao.findCourseSubsidyByCourses(courseScheduleIds);
-//        Map<Integer, BigDecimal> courseSubsidyMap = MapUtil.convertIntegerMap(courseSubsidyByCourses);
-
         //处理课酬信息
-        someDayAgoTeacherCourseSalaryNoSettlement.forEach(courseScheduleTeacherSalary -> {
+        for (int i = 0; i < someDayAgoTeacherCourseSalaryNoSettlement.size(); i++) {
+            CourseScheduleTeacherSalary courseScheduleTeacherSalary = someDayAgoTeacherCourseSalaryNoSettlement.get(i);
             List<String> deductReasons = new ArrayList<>();
 
             BigDecimal expectSalary = courseScheduleTeacherSalary.getExpectSalary();
 
-//            BigDecimal subsidy = courseSubsidyMap.get(courseScheduleTeacherSalary.getCourseScheduleId());
-//            if (Objects.isNull(subsidy)) {
-//                subsidy = new BigDecimal(0);
-//            }
-//            courseScheduleTeacherSalary.setSubsidy(subsidy);
-//            expectSalary = expectSalary.add(subsidy);
-//            if(BigDecimal.ZERO.compareTo(subsidy)!=0){
-//                deductReasons.add("教学点补贴:" + subsidy);
-//            }
-
             if(Objects.isNull(courseScheduleTeacherSalary.getSubsidy())){
-                courseScheduleTeacherSalary.setSubsidy(zero);
+                courseScheduleTeacherSalary.setSubsidy(BigDecimal.ZERO);
             }
 
             if(BigDecimal.ZERO.compareTo(courseScheduleTeacherSalary.getSubsidy())!=0){
@@ -439,22 +407,10 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
                 return;
             }
 
-//            boolean notPositive = Objects.nonNull(teacher)&&Objects.nonNull(teacher.getFormalStaffDate())&&courseScheduleTeacherSalary.getCourseSchedule().getClassDate().compareTo(teacher.getFormalStaffDate())<0;
-//            boolean isProbationPeriod = Objects.nonNull(teacher)&&Objects.nonNull(teacher.getIsProbationPeriod())&&ProbationPeriodEnum.TRY.equals(teacher.getIsProbationPeriod());
-
             //判断课程是否在试用期内
-            boolean trail = false;
-
-            if(Objects.nonNull(teacher)&&Objects.nonNull(teacher.getEntryDate())&&courseScheduleTeacherSalary.getCourseSchedule().getClassDate().compareTo(teacher.getEntryDate())>=0){
-                trail = true;
-            }
-            if(Objects.nonNull(teacher)&&Objects.nonNull(teacher.getFormalStaffDate())&&courseScheduleTeacherSalary.getCourseSchedule().getClassDate().compareTo(teacher.getFormalStaffDate())>=0){
-                trail = false;
-            }
-
             //如果上课日期在试用期内按80%结算
-            if(trail){
-                expectSalary = expectSalary.multiply(new BigDecimal("0.8"));
+            if(isTrail(teacher,courseScheduleTeacherSalary.getCourseSchedule().getClassDate())){
+                expectSalary = expectSalary.multiply(new BigDecimal(probationTeacherSalary/100));
                 deductReasons.add("未转正");
             }
 
@@ -462,7 +418,6 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
             BigDecimal deductCost = new BigDecimal(0);
             List<TeacherAttendance> courseTeacherAttendances = teacherCourseAttendanceMap.get(org.apache.commons.lang3.StringUtils.joinWith(":", courseScheduleTeacherSalary.getCourseScheduleId(), courseScheduleTeacherSalary.getUserId()));
 
-//            TeacherAttendance teacherAttendance = courseTeacherAttendances.get(0);
             if(CollectionUtils.isEmpty(courseTeacherAttendances)||Objects.isNull(courseTeacherAttendances.get(0).getSignInStatus())){
                 //未签到扣除全部课酬
                 deductCost = deductCost.add(expectSalary.abs());
@@ -520,12 +475,24 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
             courseScheduleTeacherSalary.setSettlementTime(now);
             courseScheduleTeacherSalary.setBelongToDaya(false);
             courseScheduleTeacherSalaryDao.update(courseScheduleTeacherSalary);
-        });
+        }
+    }
+
+    Boolean isTrail(Teacher teacher,Date classDate){
+        //判断课程是否在试用期内
+        boolean trail = false;
+        if(Objects.nonNull(teacher)&&Objects.nonNull(teacher.getEntryDate())&&classDate.compareTo(teacher.getEntryDate())>=0){
+            trail = true;
+        }
+        if(Objects.nonNull(teacher)&&Objects.nonNull(teacher.getFormalStaffDate())&&classDate.compareTo(teacher.getFormalStaffDate())>=0){
+            trail = false;
+        }
+        return trail;
     }
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public void musicGroupTeacherSalarySettlement() {
+    public void musicGroupTeacherSalarySettlement(Integer tenantId) {
         Date now = new Date();
         Date date = DateUtil.addMonths(now, -1);
         String startDate = DateUtil.format(DateUtil.getFirstDayOfMonth(date),DateUtil.DEFAULT_PATTERN);
@@ -541,10 +508,6 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
 
         BigDecimal zero = new BigDecimal(0);
 
-        //获取课程对应教学点补贴
-//        List<Map<Long, BigDecimal>> courseSubsidyByCourses = courseScheduleTeacherSalaryDao.findCourseSubsidyByCourses(courseScheduleIds);
-//        Map<Integer, BigDecimal> courseSubsidyMap = MapUtil.convertIntegerMap(courseSubsidyByCourses);
-
         Set<Integer> schoolIds = yesterdayCourseSchedules.stream().map(CourseSchedule::getSchoolId).collect(Collectors.toSet());
         List<School> schools = schoolDao.getSchools(new ArrayList<>(schoolIds));
         Map<Integer, School> idSchoolMap = new HashMap<>();
@@ -563,20 +526,35 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
             return;
         }
 
-        SysConfig sysConfig = sysConfigService.findByParamName(SysConfigService.ATTENDANCE_RANGE);
+        //定位范围
+        String gpsRange = sysTenantConfigService.getConfigValue(SysConfigService.ATTENDANCE_RANGE,tenantId);
         double attendanceRange = 0;
-        if(Objects.nonNull(sysConfig)){
-            attendanceRange = Double.valueOf(sysConfig.getParanValue());
+        if(StringUtils.isNotEmpty(gpsRange)){
+            attendanceRange = Double.valueOf(gpsRange);
+        }
+        //签到签退定位异常扣除金额
+//        String configValue = sysTenantConfigService.getConfigValue(SysConfigService.OFFLINE_GPS_ERROR_CUT_SALARY,tenantId);
+//        Integer gpsCutSalary = null;
+//        if(StringUtils.isNotEmpty(configValue)){
+//            gpsCutSalary = Integer.parseInt(configValue);
+//        }
+//        //签到签退定位异常扣除单位
+//        String configValue1 = sysTenantConfigService.getConfigValue(SysConfigService.OFFLINE_GPS_ERROR_CUT_SALARY_UNIT,tenantId);
+//        UnitEnum unitEnum = null;
+//        if(StringUtils.isNotEmpty(configValue1)){
+//            unitEnum = UnitEnum.valueOf(configValue1);
+//        }
+          //试用期课酬规则
+        String configValue2 = sysTenantConfigService.getConfigValue(SysConfigService.PROBATION_TEACHER_SALARY,tenantId);
+        Integer probationTeacherSalary = 100;
+        if(StringUtils.isNotEmpty(configValue2)){
+            probationTeacherSalary = Integer.parseInt(configValue2);
         }
 
         //教师签到记录
         List<TeacherAttendance> allTeacherAttendances = teacherAttendanceDao.findByCourseSchedules(courseScheduleIds);
         Map<String, List<TeacherAttendance>> teacherCourseAttendanceMap = allTeacherAttendances.stream().collect(Collectors.groupingBy(ta -> org.apache.commons.lang3.StringUtils.joinWith(":", ta.getCourseScheduleId(), ta.getTeacherId())));
 
-        //学员点名记录
-        List<StudentAttendance> allStudentAttendances = studentAttendanceDao.findByCourseIds(courseScheduleIds);
-        Map<Long, List<StudentAttendance>> courseStudentAttendanceMap = allStudentAttendances.stream().collect(Collectors.groupingBy(StudentAttendance::getCourseScheduleId));
-
         //需要根据实际上课学员结算课酬的课程编号
         List<Long> needStudentAttendanceCourseScheduleIds = yesterdayCourseSchedules.stream()
                 .filter(c -> CourseSchedule.CourseScheduleType.HIGH_ONLINE.equals(c.getType())
@@ -591,23 +569,9 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
         Map<Long, Long> courseNormalStudentsMap = new HashMap<>();
         if(!CollectionUtils.isEmpty(studentAttendances)){
             courseNormalStudentsMap =studentAttendances.stream()
-//                    .filter(studentAttendance -> StudentAttendanceStatusEnum.NORMAL.equals(studentAttendance.getStatus()))
                     .collect(Collectors.groupingBy(CourseScheduleStudentPayment::getCourseScheduleId, Collectors.counting()));
         }
 
-        //课程对应乐团结算方式集合
-        List<Map<String, String>> musicGroupSettlementTypeByCourse = courseScheduleTeacherSalaryDao.findMusicGroupSettlementTypeByCourse(courseScheduleIds);
-        Map<String, String> musicGroupSettlementsMap = MapUtil.convertMybatisMap(musicGroupSettlementTypeByCourse);
-
-        //所有老师编号
-        List<Integer> allTeacherIds = courseScheduleTeacherSalaries.stream()
-                .map(CourseScheduleTeacherSalary::getUserId)
-                .collect(Collectors.toList());
-
-        //所有老师默认乐团课酬
-        List<TeacherDefaultMusicGroupSalary> teacherDefaultMusicGroupSalaries = teacherDefaultMusicGroupSalaryDao.findByTeacher(allTeacherIds);
-        Map<CourseSchedule.CourseScheduleType, List<TeacherDefaultMusicGroupSalary>> teacherDefaultMusicGroupSalariesGroupByCourseType = teacherDefaultMusicGroupSalaries.stream().collect(Collectors.groupingBy(TeacherDefaultMusicGroupSalary::getCourseScheduleType));
-
         Set<Integer> teacherIds = courseScheduleTeacherSalaries.stream().map(CourseScheduleTeacherSalary::getUserId).collect(Collectors.toSet());
         List<Teacher> teachers = teacherDao.findByTeacherIds(new ArrayList<>(teacherIds));
         Map<Integer, Teacher> idTeacherMap = teachers.stream().collect(Collectors.toMap(Teacher::getId, t -> t, (t1, t2) -> t1));
@@ -644,15 +608,6 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
 
                 List<String> deductReasons = new ArrayList<>();
 
-//                BigDecimal subsidy = courseSubsidyMap.get(courseSchedule.getId());
-//                if (Objects.isNull(subsidy)) {
-//                    subsidy = new BigDecimal(0);
-//                }
-//                teacherSalary = teacherSalary.add(subsidy);
-//                if(BigDecimal.ZERO.compareTo(subsidy)!=0){
-//                    deductReasons.add("教学点补贴:" + subsidy);
-//                }
-
                 if(Objects.isNull(courseScheduleTeacherSalary.getSubsidy())){
                     courseScheduleTeacherSalary.setSubsidy(zero);
                 }
@@ -662,24 +617,9 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
                     deductReasons.add("课程补贴:" + courseScheduleTeacherSalary.getSubsidy());
                 }
 
-                //未转正
-//                boolean notPositive = Objects.nonNull(teacher)&&Objects.nonNull(teacher.getFormalStaffDate())&&courseSchedule.getClassDate().compareTo(teacher.getFormalStaffDate())<0;
-                //试用期
-//                boolean isProbationPeriod = Objects.nonNull(teacher)&&Objects.nonNull(teacher.getIsProbationPeriod())&&ProbationPeriodEnum.TRY.equals(teacher.getIsProbationPeriod());
-
-                //判断课程是否在试用期内
-                boolean trail = false;
-
-                if(Objects.nonNull(teacher)&&Objects.nonNull(teacher.getEntryDate())&&courseSchedule.getClassDate().compareTo(teacher.getEntryDate())>=0){
-                    trail = true;
-                }
-                if(Objects.nonNull(teacher)&&Objects.nonNull(teacher.getFormalStaffDate())&&courseSchedule.getClassDate().compareTo(teacher.getFormalStaffDate())>=0){
-                    trail = false;
-                }
-
                 //如果上课日期在试用期内按80%结算
-                if(trail){
-                    teacherSalary = teacherSalary.multiply(new BigDecimal("0.8"));
+                if(isTrail(teacher,courseSchedule.getClassDate())){
+                    teacherSalary = teacherSalary.multiply(new BigDecimal(probationTeacherSalary/100));
                     deductReasons.add("未转正");
                 }
 
@@ -749,15 +689,6 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
 
             List<String> deductReasons = new ArrayList<>();
 
-//            BigDecimal subsidy = courseSubsidyMap.get(courseSchedule.getId());
-//            if (Objects.isNull(subsidy)) {
-//                subsidy = new BigDecimal(0);
-//            }
-//            teacherSalary = teacherSalary.add(subsidy);
-//            if(BigDecimal.ZERO.compareTo(subsidy)!=0){
-//                deductReasons.add("教学点补贴:" + subsidy);
-//            }
-
             if(Objects.isNull(courseScheduleTeacherSalary.getSubsidy())){
                 courseScheduleTeacherSalary.setSubsidy(zero);
             }
@@ -767,9 +698,6 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
                 deductReasons.add("课程补贴:" + courseScheduleTeacherSalary.getSubsidy());
             }
 
-//            boolean notPositive = Objects.nonNull(teacher)&&Objects.nonNull(teacher.getFormalStaffDate())&&courseSchedule.getClassDate().compareTo(teacher.getFormalStaffDate())<0;
-//            boolean isProbationPeriod = Objects.nonNull(teacher)&&Objects.nonNull(teacher.getIsProbationPeriod())&&ProbationPeriodEnum.TRY.equals(teacher.getIsProbationPeriod());
-
             //判断课程是否在试用期内
             boolean trail = false;
 
@@ -790,15 +718,6 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
             BigDecimal deductCost = BigDecimal.ZERO;
             List<TeacherAttendance> courseTeacherAttendances = teacherCourseAttendanceMap.get(org.apache.commons.lang3.StringUtils.joinWith(":", courseScheduleTeacherSalary.getCourseScheduleId(), courseScheduleTeacherSalary.getUserId()));
 
-            boolean isCallName = false;
-            List<StudentAttendance> courseStudentAttendance = courseStudentAttendanceMap.get(courseScheduleTeacherSalary.getCourseScheduleId());
-            if(!CollectionUtils.isEmpty(courseStudentAttendance)){
-                long csaNum = courseStudentAttendance.stream().filter(csa -> DateUtil.hoursBetween(csa.getCreateTime(), courseSchedule.getStartClassTime()) < 4).count();
-                if(csaNum>0){
-                    isCallName = true;
-                }
-            }
-
             TeacherAttendance teacherAttendance = null;
             if(!CollectionUtils.isEmpty(courseTeacherAttendances)){
                 teacherAttendance = courseTeacherAttendances.get(0);
@@ -822,6 +741,13 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
                     signOutInRange = true;
                 }
             }
+            //签到状态
+            if(Objects.isNull(teacherAttendance) || Objects.isNull(teacherAttendance.getSignInStatus())){
+                //无签到记录扣除全部课酬
+                deductCost = deductCost.add(teacherSalary.abs());
+                deductReasons.add("未签到扣除全部课酬");
+            }
+
 
             if(Objects.isNull(teacherAttendance)||Objects.isNull(teacherAttendance.getSignInStatus())){
                 //无签到记录扣除全部课酬
@@ -2160,11 +2086,11 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
         }
 
         //签到GPS范围VIP
-        SysConfig vipSysConfig = sysConfigService.findByParamName(SysConfigService.ATTENDANCE_RANGE_VIP);
-        double vipAttendanceRange = 0;
-        if(Objects.nonNull(vipSysConfig)){
-            vipAttendanceRange = Double.valueOf(vipSysConfig.getParanValue());
-        }
+//        SysConfig vipSysConfig = sysConfigService.findByParamName(SysConfigService.ATTENDANCE_RANGE);
+//        double vipAttendanceRange = 0;
+//        if(Objects.nonNull(vipSysConfig)){
+//            vipAttendanceRange = Double.valueOf(vipSysConfig.getParanValue());
+//        }
 
         //教师签到记录
         List<TeacherAttendance> allTeacherAttendances = teacherAttendanceDao.findByCourseSchedules(courseIds);
@@ -2203,7 +2129,7 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
                     calMusicCourseTeacherActualSalary(courseSchedule, teacherSalary, teacherAttendances, school, teacher, attendanceRange, false);
                     break;
                 case VIP:
-                    calVipCourseTeacherActualSalary(courseSchedule, teacherSalary, teacherAttendances, school, teacher, vipAttendanceRange, false);
+                    calVipCourseTeacherActualSalary(courseSchedule, teacherSalary, teacherAttendances, school, teacher, attendanceRange, false);
                     break;
                 case PRACTICE:
                     calPracticeTeacherActualSalary(courseSchedule, teacherSalary, teacherAttendances, school, teacher, false);
@@ -2228,7 +2154,7 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
         }
 
         teacherSalaryOverview.setAttendanceRange(attendanceRange);
-        teacherSalaryOverview.setVipAttendanceRange(vipAttendanceRange);
+        teacherSalaryOverview.setVipAttendanceRange(attendanceRange);
 
         return teacherSalaryOverview;
     }
@@ -2277,11 +2203,11 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
             }
 
             //签到GPS范围VIP
-            SysConfig vipSysConfig = sysConfigService.findByParamName(SysConfigService.ATTENDANCE_RANGE_VIP);
-            double vipAttendanceRange = 0;
-            if(Objects.nonNull(vipSysConfig)){
-                vipAttendanceRange = Double.valueOf(vipSysConfig.getParanValue());
-            }
+//            SysConfig vipSysConfig = sysConfigService.findByParamName(SysConfigService.ATTENDANCE_RANGE_VIP);
+//            double vipAttendanceRange = 0;
+//            if(Objects.nonNull(vipSysConfig)){
+//                vipAttendanceRange = Double.valueOf(vipSysConfig.getParanValue());
+//            }
 
             //教师签到记录
             List<TeacherAttendance> allTeacherAttendances = teacherAttendanceDao.findByCourseSchedules(courseIds);
@@ -2323,7 +2249,7 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
                         calMusicCourseTeacherActualSalary(courseSchedule, teacherSalary, teacherAttendances, school, teacher, attendanceRange, queryInfo.getUpdated());
                         break;
                     case VIP:
-                        calVipCourseTeacherActualSalary(courseSchedule, teacherSalary, teacherAttendances, school, teacher, vipAttendanceRange, queryInfo.getUpdated());
+                        calVipCourseTeacherActualSalary(courseSchedule, teacherSalary, teacherAttendances, school, teacher, attendanceRange, queryInfo.getUpdated());
                         break;
                     case PRACTICE:
                         calPracticeTeacherActualSalary(courseSchedule, teacherSalary, teacherAttendances, school, teacher, queryInfo.getUpdated());
@@ -2567,4 +2493,5 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
         sysMessageService.batchPushMessage(MessageTypeEnum.TEACHER_PUSH_INCOME_REMIND,
                 userMap, null, 0, "12", "TEACHER","income_remind.mp3","income_remind_channel");
     }
+
 }

+ 17 - 11
mec-biz/src/main/java/com/ym/mec/biz/service/impl/IndexBaseMonthDataServiceImpl.java

@@ -51,6 +51,8 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 	@Autowired
 	private SysConfigDao sysConfigDao;
 	@Autowired
+	private SysTenantConfigDao sysTenantConfigDao;
+	@Autowired
 	private MusicGroupPaymentCalenderDao musicGroupPaymentCalenderDao;
 	@Autowired
 	private SysUserFeignService sysUserFeignService;
@@ -1015,7 +1017,7 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 	}
 
 	@Override
-	public List<IndexErrInfoDto> getRemindMatterData(String organIds) {
+	public List<IndexErrInfoDto> getRemindMatterData(String organIds,Integer tenantId) {
 		SysUser sysUser = sysUserFeignService.queryUserInfo();
 		if (sysUser == null) {
 			throw new BizException("用户信息获取失败");
@@ -1033,21 +1035,25 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 			//获取教务老师关联的班级列表
 			educationUserId = sysUser.getId();
 		}
-		//获取关联的乐团列表
-		List<String> musicGroupIds = musicGroupDao.queryIdsByEduIdAndOrganIds(educationUserId,organIds);
-		String configValue1 = sysConfigDao.findConfigValue("push_create_payment_calender");
 		Date date = new Date();
-		String format = DateUtil.format(date, DateUtil.DEFAULT_PATTERN);
+
 		List<IndexErrInfoDto> result = new ArrayList<>();
+
 		IndexErrInfoDto indexErrInfoDto = new IndexErrInfoDto();
 		indexErrInfoDto.setErrorType(WAIT_CREATE_PAYMENT_CALENDER);
 		indexErrInfoDto.setDesc(WAIT_CREATE_PAYMENT_CALENDER.getMsg());
-		if(musicGroupIds.size() > 0){
-			List<Long> calenderIds = musicGroupPaymentCalenderDao.queryEndIds(configValue1, format,musicGroupIds);
-			if(calenderIds.size() > 0){
-				List<String> musicGroupIdList = musicGroupPaymentCalenderDao.queryMusicGroupIds(calenderIds);
-				indexErrInfoDto.setResult(musicGroupIdList);
-				indexErrInfoDto.setNum(musicGroupIdList.size());
+		String configValue1 = sysTenantConfigDao.getConfigValue(SysConfigService.PUSH_CREATE_PAYMENT_CALENDER, tenantId);
+		if(StringUtils.isNotEmpty(configValue1)){
+			//获取关联的乐团列表
+			List<String> musicGroupIds = musicGroupDao.queryIdsByEduIdAndOrganIds(educationUserId,organIds);
+			String format = DateUtil.format(date, DateUtil.DEFAULT_PATTERN);
+			if(musicGroupIds.size() > 0){
+				List<Long> calenderIds = musicGroupPaymentCalenderDao.queryEndIds(configValue1, format,musicGroupIds);
+				if(calenderIds.size() > 0){
+					List<String> musicGroupIdList = musicGroupPaymentCalenderDao.queryMusicGroupIds(calenderIds);
+					indexErrInfoDto.setResult(musicGroupIdList);
+					indexErrInfoDto.setNum(musicGroupIdList.size());
+				}
 			}
 		}
 		result.add(indexErrInfoDto);

+ 13 - 18
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupSubjectPlanServiceImpl.java

@@ -8,6 +8,8 @@ import java.util.Map;
 
 import javax.annotation.Resource;
 
+import com.ym.mec.biz.dal.dao.*;
+import com.ym.mec.biz.service.*;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -15,13 +17,6 @@ import org.springframework.stereotype.Service;
 import com.alibaba.fastjson.JSON;
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
-import com.ym.mec.biz.dal.dao.ChargeTypeSubjectMapperDao;
-import com.ym.mec.biz.dal.dao.GoodsDao;
-import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderCourseSettingsDao;
-import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDao;
-import com.ym.mec.biz.dal.dao.MusicGroupSubjectPlanDao;
-import com.ym.mec.biz.dal.dao.OrganizationCloudTeacherFeeDao;
-import com.ym.mec.biz.dal.dao.StudentPaymentOrderDetailDao;
 import com.ym.mec.biz.dal.dto.MusicGroupGoodsAndDiscountDto;
 import com.ym.mec.biz.dal.dto.MusicGroupRegRespDto;
 import com.ym.mec.biz.dal.dto.MusicGroupSubjectGoodsAndInfoDto;
@@ -39,14 +34,6 @@ import com.ym.mec.biz.dal.entity.Subject;
 import com.ym.mec.biz.dal.enums.CourseViewTypeEnum;
 import com.ym.mec.biz.dal.enums.DealStatusEnum;
 import com.ym.mec.biz.dal.enums.GoodsType;
-import com.ym.mec.biz.service.GoodsService;
-import com.ym.mec.biz.service.MemberRankPrivilegesService;
-import com.ym.mec.biz.service.MusicGroupService;
-import com.ym.mec.biz.service.MusicGroupSubjectGoodsGroupService;
-import com.ym.mec.biz.service.MusicGroupSubjectPlanService;
-import com.ym.mec.biz.service.OrganizationCourseUnitPriceSettingsService;
-import com.ym.mec.biz.service.StudentRegistrationService;
-import com.ym.mec.biz.service.SubjectService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
@@ -62,6 +49,8 @@ public class MusicGroupSubjectPlanServiceImpl extends BaseServiceImpl<Integer, M
 
     @Autowired
     private GoodsService goodsService;
+    @Autowired
+    private SysTenantConfigDao sysTenantConfigDao;
 
     @Autowired
     private MusicGroupSubjectGoodsGroupService musicGroupSubjectGoodsGroupService;
@@ -123,10 +112,16 @@ public class MusicGroupSubjectPlanServiceImpl extends BaseServiceImpl<Integer, M
     @Override
     public MusicGroupSubjectGoodsAndInfoDto getSubjectGoodsAndInfo(String musicGroupId, Integer subjectId) {
         MusicGroup musicGroup = musicGroupService.get(musicGroupId);
-        
         if(musicGroup == null){
         	throw new BizException("乐团信息查询失败");
         }
+        if(musicGroup.getTenantId() == null){
+        	throw new BizException("乐团机构信息异常,请联系管理员");
+        }
+        String configValue = sysTenantConfigDao.getConfigValue(SysConfigService.MEMBER_GROUP_TERM_GIVE_COURSE_TIME, musicGroup.getTenantId());
+        if(StringUtils.isEmpty(configValue)){
+            throw new BizException("请配置会员团每学期赠送课程分钟数");
+        }
 
         //课程形态
         Map<String, Object> courseForm = JSON.parseObject(musicGroup.getCourseForm(), Map.class);
@@ -189,12 +184,12 @@ public class MusicGroupSubjectPlanServiceImpl extends BaseServiceImpl<Integer, M
 			OrganizationCourseUnitPriceSettings singleUnitPriceSettings = organizationCourseUnitPriceSettingsService.queryByOrganIdAndCourseTypeAndChargeType(musicGroup.getOrganId(), CourseScheduleType.SINGLE, musicGroup.getChargeTypeId());
 			if (singleUnitPriceSettings != null) {
 				memberCoursePrice.put(CourseScheduleType.SINGLE.name(),
-						singleUnitPriceSettings.getUnitPrice().multiply(new BigDecimal(1980)).setScale(0, BigDecimal.ROUND_HALF_UP));
+						singleUnitPriceSettings.getUnitPrice().multiply(new BigDecimal(configValue)).setScale(0, BigDecimal.ROUND_HALF_UP));
 			}
 			OrganizationCourseUnitPriceSettings mixUnitPriceSettings = organizationCourseUnitPriceSettingsService.queryByOrganIdAndCourseTypeAndChargeType(musicGroup.getOrganId(), CourseScheduleType.MIX, musicGroup.getChargeTypeId());
 			if (mixUnitPriceSettings != null) {
 				memberCoursePrice.put(CourseScheduleType.MIX.name(),
-						mixUnitPriceSettings.getUnitPrice().multiply(new BigDecimal(1980)).setScale(0, BigDecimal.ROUND_HALF_UP));
+						mixUnitPriceSettings.getUnitPrice().multiply(new BigDecimal(configValue)).setScale(0, BigDecimal.ROUND_HALF_UP));
 			}
 			
 			musicGroupSubjectGoodsAndInfo.setMemberCoursePrice(memberCoursePrice);

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

@@ -236,7 +236,7 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA
 
         //是否在范围内
         boolean isInScore = true;
-        String teacherAttendanceMemo = null;
+//        String teacherAttendanceMemo = null;
         if (Objects.nonNull(school)) {
             if (StringUtils.isBlank(school.getLongitudeLatitude())) {
                 if (studentAttendanceInfos.getUpdate().equals(YesOrNoEnum.YES.getCode())) {
@@ -244,13 +244,13 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA
                     schoolDao.update(school);
                 }
             } else {
-                SysConfig sysConfig = sysConfigService.findByParamName(SysConfigService.ATTENDANCE_RANGE_VIP);
+                SysConfig sysConfig = sysConfigService.findByParamName(SysConfigService.ATTENDANCE_RANGE);
                 double attendanceRange = Double.valueOf(sysConfig.getParanValue());
                 double distance = MapUtil.distance(studentAttendanceInfos.getSignInLongitudeLatitude(),
                         school.getLongitudeLatitude());
                 if (distance > attendanceRange) {
                     isInScore = false;
-                    teacherAttendanceMemo = "打卡地点距离教学点" + distance + "米";
+//                    teacherAttendanceMemo = "打卡地点距离教学点" + distance + "米";
                 }
             }
         }

+ 15 - 28
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -20,6 +20,7 @@ import java.util.stream.Collectors;
 
 import javax.annotation.Resource;
 
+import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.page.*;
 import com.ym.mec.biz.service.*;
@@ -40,29 +41,6 @@ import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.auth.api.entity.SysUserRole;
 import com.ym.mec.auth.api.enums.CertificateTypeEnum;
-import com.ym.mec.biz.dal.dao.CourseScheduleDao;
-import com.ym.mec.biz.dal.dao.EmployeeDao;
-import com.ym.mec.biz.dal.dao.GoodsDao;
-import com.ym.mec.biz.dal.dao.ImGroupDao;
-import com.ym.mec.biz.dal.dao.MusicGroupDao;
-import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderCourseSettingsDao;
-import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDao;
-import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDetailDao;
-import com.ym.mec.biz.dal.dao.MusicGroupPaymentStudentCourseDetailDao;
-import com.ym.mec.biz.dal.dao.MusicGroupStudentFeeDao;
-import com.ym.mec.biz.dal.dao.MusicGroupSubjectPlanDao;
-import com.ym.mec.biz.dal.dao.OrganizationCloudTeacherFeeDao;
-import com.ym.mec.biz.dal.dao.OrganizationDao;
-import com.ym.mec.biz.dal.dao.StudentCourseFeeDetailDao;
-import com.ym.mec.biz.dal.dao.StudentDao;
-import com.ym.mec.biz.dal.dao.StudentInstrumentDao;
-import com.ym.mec.biz.dal.dao.StudentPaymentOrderDetailDao;
-import com.ym.mec.biz.dal.dao.StudentRegistrationDao;
-import com.ym.mec.biz.dal.dao.SubjectChangeDao;
-import com.ym.mec.biz.dal.dao.SubjectDao;
-import com.ym.mec.biz.dal.dao.SysConfigDao;
-import com.ym.mec.biz.dal.dao.SysUserCashAccountDao;
-import com.ym.mec.biz.dal.dao.TeacherDao;
 import com.ym.mec.biz.dal.entity.ClassGroup;
 import com.ym.mec.biz.dal.entity.ClassGroupStudentMapper;
 import com.ym.mec.biz.dal.entity.CloudTeacherOrder;
@@ -167,6 +145,8 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     @Autowired
     private SysConfigDao sysConfigDao;
     @Autowired
+    private SysTenantConfigDao sysTenantConfigDao;
+    @Autowired
     private MusicGroupDao musicGroupDao;
     @Autowired
     private SysUserCashAccountDetailService sysUserCashAccountDetailService;
@@ -1984,16 +1964,23 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         if (studentRegistration.getNoneNeedCloudTeacher().equals(1)) {
             throw new BizException("该学生已设置");
         }
+        MusicGroup musicGroup = musicGroupDao.get(studentRegistration.getMusicGroupId());
+        if(musicGroup == null){
+            throw new BizException("乐团信息不存在");
+        }
+        if(musicGroup.getTenantId() == null){
+            throw new BizException("乐团机构信息异常,请联系管理员");
+        }
 
         MusicGroupSubjectPlan musicOneSubjectClassPlan = musicGroupSubjectPlanService.getMusicOneSubjectClassPlan(studentRegistration.getMusicGroupId(), studentRegistration.getActualSubjectId());
-        
         int paidNum = musicOneSubjectClassPlan.getPaidStudentNum() == null ? 0 : musicOneSubjectClassPlan.getPaidStudentNum();
         int paidZeroNum = musicOneSubjectClassPlan.getPaidZeroNum() == null ? 0 : musicOneSubjectClassPlan.getPaidZeroNum();
-        
-        if(paidZeroNum > 0){
-        	throw new BizException("每个声部只能有一个免费入团名额");
+        String configValue = sysTenantConfigDao.getConfigValue(SysConfigService.MEMBER_GROUP_FEE_STUDENT_NUM,musicGroup.getTenantId());
+        if(StringUtils.isNotEmpty(configValue)){
+            if(paidZeroNum >= Integer.parseInt(configValue)){
+                throw new BizException("每个声部只能有{}个免费入团名额",configValue);
+            }
         }
-        
         if(!isContinue){
         	if (musicOneSubjectClassPlan.getPaidStudentNum() >= musicOneSubjectClassPlan.getExpectedStudentNum()) {
                 return new HttpResponseResult<Boolean>(true, HttpStatus.CONTINUE, null, "乐团该声部招生人数已满,是否继续操作?");

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

@@ -3,15 +3,20 @@ package com.ym.mec.biz.service.impl;
 import com.ym.mec.biz.dal.dao.SysTenantConfigDao;
 import com.ym.mec.biz.dal.entity.SysConfig;
 import com.ym.mec.biz.dal.entity.SysTenantConfig;
+import com.ym.mec.biz.dal.entity.Teacher;
+import com.ym.mec.biz.dal.enums.TeachModeEnum;
+import com.ym.mec.biz.service.SysConfigService;
 import com.ym.mec.biz.service.SysTenantConfigService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.ss.formula.functions.T;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.util.List;
-import java.util.Map;
+import java.math.BigDecimal;
+import java.util.*;
 import java.util.stream.Collectors;
 
 @Service
@@ -40,4 +45,9 @@ public class SysTenantConfigServiceImpl extends BaseServiceImpl<Integer, SysTena
 		sysTenantConfigDao.delByConfigId(configIdList,tenantId);
 		sysTenantConfigDao.batchInsert(sysConfigs,tenantId);
 	}
+
+	@Override
+	public String getConfigValue(String paramName, Integer tenantId) {
+		return sysTenantConfigDao.getConfigValue(paramName, tenantId);
+	}
 }

+ 3 - 1
mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -409,6 +409,7 @@
         <result property="className" column="class_name"/>
         <result property="classType" column="class_type" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <result property="courseType" column="course_type" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
+        <result property="teachMode" column="teach_mode_" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <result property="musicGroupId" column="music_group_id"/>
         <result property="musicGroupName" column="music_group_name"/>
         <result property="schoolId" column="school_id_"/>
@@ -442,7 +443,8 @@
                s.address_,
                s.longitude_latitude_,
                su.real_name_                                     teacher_name_,
-               ta.sign_in_time_
+               ta.sign_in_time_,
+               cs.teach_mode_
         FROM course_schedule cs
                  LEFT JOIN class_group cg ON cs.class_group_id_ = cg.id_
                  LEFT JOIN music_group mg ON cg.music_group_id_ = mg.id_

+ 3 - 3
mec-biz/src/main/resources/config/mybatis/CourseScheduleTeacherSalaryMapper.xml

@@ -441,12 +441,12 @@
 		SELECT * FROM  course_schedule_teacher_salary WHERE course_schedule_id_=#{courseScheduleId}
 	</select>
 	<select id="findByCourseSchedulesWithNoSettlement" resultMap="CourseScheduleTeacherSalary">
-		SELECT csts.*,CASE WHEN cs.teach_mode_ = 'ONLINE' THEN csts.expect_salary_ * (CASE WHEN (ta.sign_in_status_ IS NULL OR ta.sign_in_status_ = 0) AND (ta.sign_out_status_ IS NULL OR ta.sign_out_status_ = 0) THEN 0
+		SELECT csts.*,cs.teach_mode_,CASE WHEN cs.teach_mode_ = 'ONLINE' THEN csts.expect_salary_ * (CASE WHEN (ta.sign_in_status_ IS NULL OR ta.sign_in_status_ = 0) AND (ta.sign_out_status_ IS NULL OR ta.sign_out_status_ = 0) THEN 0
 		WHEN ta.sign_in_status_ IS NULL OR ta.sign_in_status_ = 0 THEN 0.5
 		WHEN ta.sign_out_status_ IS NULL OR ta.sign_out_status_ = 0 THEN 0.5 ELSE 1 END) ELSE csts.expect_salary_ END teacher_actual_salary_
 		FROM course_schedule_teacher_salary csts
-			LEFT JOIN teacher_attendance ta ON ta.course_schedule_id_ = csts.course_schedule_id_
-			LEFT JOIN course_schedule cs ON cs.id_ = csts.course_schedule_id_
+		LEFT JOIN teacher_attendance ta ON ta.course_schedule_id_ = csts.course_schedule_id_
+		LEFT JOIN course_schedule cs ON cs.id_ = csts.course_schedule_id_
 		WHERE csts.course_schedule_id_ IN
 		<foreach collection="courseScheduleIds" item="courseScheduleId" open="(" close=")" separator=",">
 			#{courseScheduleId}

+ 14 - 11
mec-web/src/main/java/com/ym/mec/web/controller/IndexController.java

@@ -204,18 +204,21 @@ public class IndexController extends BaseController {
 		if (sysUser == null) {
 			return failed("用户信息获取失败");
 		}
-			Employee employee = employeeService.get(sysUser.getId());
-			if (StringUtils.isBlank(organId)) {
-				organId = employee.getOrganIdList();
-			}else if(StringUtils.isEmpty(employee.getOrganIdList())){
-				return failed("用户所在分部异常");
-			}else {
-				List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
-				if(!list.containsAll(Arrays.asList(organId.split(",")))){
-					return failed("非法请求");
-				}
+		if (sysUser.getTenantId() == null) {
+			return failed("用户机构信息异常,请联系管理员");
+		}
+		Employee employee = employeeService.get(sysUser.getId());
+		if (StringUtils.isBlank(organId)) {
+			organId = employee.getOrganIdList();
+		}else if(StringUtils.isEmpty(employee.getOrganIdList())){
+			return failed("用户所在分部异常");
+		}else {
+			List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
+			if(!list.containsAll(Arrays.asList(organId.split(",")))){
+				return failed("非法请求");
 			}
-		return succeed(indexService.getRemindMatterData(organId));
+		}
+		return succeed(indexService.getRemindMatterData(organId,sysUser.getTenantId()));
 	}
 
 	@ApiOperation("查询分部云教练学员汇总数据")

+ 28 - 34
mec-web/src/main/java/com/ym/mec/web/controller/TaskController.java

@@ -2,7 +2,9 @@ package com.ym.mec.web.controller;
 
 import com.alibaba.fastjson.JSONObject;
 import com.ym.mec.biz.dal.dao.MusicGroupSchoolTermCourseDetailDao;
+import com.ym.mec.biz.dal.dao.TenantInfoDao;
 import com.ym.mec.biz.dal.entity.MusicGroupSchoolTermCourseDetail;
+import com.ym.mec.biz.dal.entity.TenantInfo;
 import com.ym.mec.biz.dal.enums.IndexDataType;
 import com.ym.mec.biz.event.source.CourseEventSource;
 import com.ym.mec.biz.service.*;
@@ -32,107 +34,78 @@ public class TaskController extends BaseController {
 
 	@Autowired
 	private MusicGroupStudentFeeService musicGroupStudentFeeService;
-
 	@Autowired
 	private VipGroupService vipGroupService;
-
 	@Autowired
 	private CourseScheduleService courseScheduleService;
-
 	@Autowired
 	private TeacherAttendanceService teacherAttendanceService;
-
 	@Autowired
 	private CourseScheduleTeacherSalaryService courseScheduleTeacherSalaryService;
-
 	@Autowired
 	private StudentCourseHomeworkService studentCourseHomeworkService;
-
 	@Autowired
 	private CourseHomeworkService courseHomeworkService;
-
 	@Autowired
 	private StudentPaymentOrderService studentPaymentOrderService;
-
 	@Autowired
 	private TenantPaymentOrderService tenantPaymentOrderService;
-
 	@Autowired
 	private TeacherCourseStatisticsService teacherCourseStatisticsService;
-
 	@Autowired
 	private PracticeGroupService practiceGroupService;
-
 	@Autowired
 	private CourseScheduleEvaluateService courseScheduleEvaluateService;
-
 	@Autowired
 	private CourseReviewService courseReviewService;
-
 	@Autowired
 	private CoursesGroupService coursesGroupService;
-
 	@Autowired
 	private ExtracurricularExercisesService extracurricularExercisesService;
-	
 	@Autowired
 	private StudentService studentService;
-	
 	@Autowired
 	private MusicGroupPaymentCalenderService musicGroupPaymentCalenderService;
-
 	@Autowired
 	private MusicGroupPaymentCalenderDetailService musicGroupPaymentCalenderDetailService;
-
 	@Autowired
 	private StudentServeService studentServeService;
-
 	@Autowired
 	private OperatingReportService operatingReportService;
-
 	@Autowired
 	private GoodsService goodsService;
 	@Autowired
 	private StudentGoodsSellService studentGoodsSellService;
 	@Autowired
 	private SysMessageService sysMessageService;
-
 	@Autowired
 	private CourseEventSource courseEventSource;
 	@Autowired
 	private RedisCache<String, Object> redisCache;
 	@Autowired
 	private IndexBaseMonthDataService indexBaseMonthDataService;
-
 	@Autowired
 	private InspectionItemPlanService inspectionItemPlanService;
-
 	@Autowired
 	private StudentInstrumentService studentInstrumentService;
-
 	@Autowired
 	private CloudTeacherOrderService cloudTeacherOrderService;
 	@Autowired
 	private HistoryMessageService historyMessageService;
 	@Autowired
-	private UploadFileService uploadFileService;
-	@Autowired
 	private ImFeignService imFeignService;
-
 	@Autowired
 	private IndexErrDataRecordService indexErrDataRecordService;
-
 	@Autowired
 	private ClassGroupService classGroupService;
-
 	@Autowired
 	private MusicGroupSchoolTermCourseDetailDao musicGroupSchoolTermCourseDetailDao;
-
 	@Autowired
 	private MusicGroupSchoolTermCourseDetailService musicGroupSchoolTermCourseDetailService;
-
 	@Autowired
 	private SysMusicCompareRecordService sysMusicCompareRecordService;
+	@Autowired
+	private TenantInfoDao tenantInfoDao;
 
 	@GetMapping(value = "/syncImHistoryMessageTask")
 	// 同步即时通讯聊天记录
@@ -203,7 +176,14 @@ public class TaskController extends BaseController {
 	@GetMapping("/vipGroupTeacherSalarySettlement")
 	// vip课课酬结算
 	public void vipGroupTeacherSalarySettlement() {
-		courseScheduleTeacherSalaryService.teacherSalarySettlement();
+		Map<String,Object> paramMap = new HashMap<>(1);
+		paramMap.put("state",1);
+		List<TenantInfo> tenantInfos = tenantInfoDao.queryList(paramMap);
+		if(tenantInfos != null && tenantInfos.size() > 0){
+			for (TenantInfo tenantInfo : tenantInfos) {
+				courseScheduleTeacherSalaryService.teacherSalarySettlement(tenantInfo.getId());
+			}
+		}
 		redisCache.getRedisTemplate().opsForSet().add(CourseScheduleTeacherSalaryService.TASK_KEY, "VIP");
 //		courseScheduleTeacherSalaryService.salaryMark();
 	}
@@ -211,7 +191,14 @@ public class TaskController extends BaseController {
 	@GetMapping("/practiceTeacherSalarySettlement")
 	// 陪练课课酬结算
 	public void practiceTeacherSalarySettlement() {
-		courseScheduleTeacherSalaryService.practiceTeacherSalarySettlement();
+		Map<String,Object> paramMap = new HashMap<>(1);
+		paramMap.put("state",1);
+		List<TenantInfo> tenantInfos = tenantInfoDao.queryList(paramMap);
+		if(tenantInfos != null && tenantInfos.size() > 0){
+			for (TenantInfo tenantInfo : tenantInfos) {
+				courseScheduleTeacherSalaryService.practiceTeacherSalarySettlement(tenantInfo.getId());
+			}
+		}
 		redisCache.getRedisTemplate().opsForSet().add(CourseScheduleTeacherSalaryService.TASK_KEY, "PRACTICE");
 //		courseScheduleTeacherSalaryService.salaryMark();
 	}
@@ -219,7 +206,14 @@ public class TaskController extends BaseController {
 	// 乐团课课酬结算
 	@GetMapping("/musicGroupTeacherSalarySettlement")
 	public void musicGroupTeacherSalarySettlement() {
-		courseScheduleTeacherSalaryService.musicGroupTeacherSalarySettlement();
+		Map<String,Object> paramMap = new HashMap<>(1);
+		paramMap.put("state",1);
+		List<TenantInfo> tenantInfos = tenantInfoDao.queryList(paramMap);
+		if(tenantInfos != null && tenantInfos.size() > 0){
+			for (TenantInfo tenantInfo : tenantInfos) {
+				courseScheduleTeacherSalaryService.musicGroupTeacherSalarySettlement(tenantInfo.getId());
+			}
+		}
 		redisCache.getRedisTemplate().opsForSet().add(CourseScheduleTeacherSalaryService.TASK_KEY, "MUSIC");
 //		courseScheduleTeacherSalaryService.salaryMark();
 	}