Browse Source

Merge remote-tracking branch 'origin/master'

周箭河 4 năm trước cách đây
mục cha
commit
2461ac8202

+ 4 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherDefaultMusicGroupSalaryServiceImpl.java

@@ -140,6 +140,9 @@ public class TeacherDefaultMusicGroupSalaryServiceImpl extends BaseServiceImpl<L
 										if(studentNum == null || studentNum == 0){
 											studentNum = 1;
 										}
+										if(studentNum>5){
+											studentNum = 5;
+										}
 										ts.setExpectSalary(new BigDecimal(obj.getDouble(studentNum + "")));
 										list.add(ts);
 									}
@@ -193,4 +196,4 @@ public class TeacherDefaultMusicGroupSalaryServiceImpl extends BaseServiceImpl<L
 			}
 		}
 	}
-}
+}

+ 22 - 18
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherDefaultVipGroupSalaryServiceImpl.java

@@ -10,6 +10,8 @@ import java.util.Objects;
 import java.util.Set;
 import java.util.stream.Collectors;
 
+import com.ym.mec.biz.dal.dao.*;
+import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.service.VipGroupService;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -17,18 +19,8 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import com.alibaba.fastjson.JSON;
-import com.ym.mec.biz.dal.dao.CourseScheduleTeacherSalaryDao;
-import com.ym.mec.biz.dal.dao.TeacherDao;
-import com.ym.mec.biz.dal.dao.TeacherDefaultVipGroupSalaryDao;
-import com.ym.mec.biz.dal.dao.VipGroupActivityDao;
-import com.ym.mec.biz.dal.dao.VipGroupDao;
 import com.ym.mec.biz.dal.dto.VipGroupSalarySettlementDto;
 import com.ym.mec.biz.dal.entity.CourseSchedule.CourseScheduleType;
-import com.ym.mec.biz.dal.entity.CourseScheduleTeacherSalary;
-import com.ym.mec.biz.dal.entity.Teacher;
-import com.ym.mec.biz.dal.entity.TeacherDefaultVipGroupSalary;
-import com.ym.mec.biz.dal.entity.VipGroup;
-import com.ym.mec.biz.dal.entity.VipGroupActivity;
 import com.ym.mec.biz.dal.enums.JobNatureEnum;
 import com.ym.mec.biz.dal.enums.SalarySettlementTypeEnum;
 import com.ym.mec.biz.dal.enums.TeachModeEnum;
@@ -58,6 +50,9 @@ public class TeacherDefaultVipGroupSalaryServiceImpl extends BaseServiceImpl<Lon
 	@Autowired
 	private VipGroupService vipGroupService;
 
+	@Autowired
+	private VipGroupCategoryDao vipGroupCategoryDao;
+
 	@Override
 	public BaseDAO<Long, TeacherDefaultVipGroupSalary> getDAO() {
 		return teacherDefaultVipGroupSalaryDao;
@@ -146,29 +141,38 @@ public class TeacherDefaultVipGroupSalaryServiceImpl extends BaseServiceImpl<Lon
 						// 课酬结算标准
 						if (vipGroup != null) {
 
+							VipGroupCategory vipGroupCategory = vipGroupCategoryDao.get(vipGroup.getVipGroupCategoryId());
+
 							VipGroupActivity vipGroupActivity = vipGroupActivityMap.get(vipGroup.getVipGroupActivityId());
-							if (vipGroupActivity == null) {
+							VipGroupSalarySettlementDto vipGroupSalarySettlementDto = null;
+							if (!vipGroupCategory.getMusicTheory()&&vipGroupActivity == null) {
 								continue;
+							}else if(!vipGroupCategory.getMusicTheory()){
+								vipGroupSalarySettlementDto= JSON.parseObject(vipGroupActivity.getSalarySettlementJson(),
+										VipGroupSalarySettlementDto.class);
 							}
 
-							VipGroupSalarySettlementDto vipGroupSalarySettlementDto = JSON.parseObject(vipGroupActivity.getSalarySettlementJson(),
-									VipGroupSalarySettlementDto.class);
-
-							if (vipGroupSalarySettlementDto == null) {
+							if (!vipGroupCategory.getMusicTheory()&&vipGroupSalarySettlementDto == null) {
 								continue;
 							}
 
 							TeacherDefaultVipGroupSalary tdms = salaryMap.get(vipGroup.getVipGroupCategoryId());
 							TeacherDefaultVipGroupSalary origTdms = map.get(vipGroup.getVipGroupCategoryId());
 							if (tdms != null && origTdms != null) {
-								Map<String, BigDecimal> teachModeSalaryMap = vipGroupService.countVipGroupCoursePredictFee(vipGroup, ts.getUserId(), ts.getCourseScheduleId());
+								Map<String, BigDecimal> teachModeSalaryMap = new HashMap<>();
+								if(vipGroupCategory.getMusicTheory()){
+									teachModeSalaryMap = vipGroupService.countVipGroupPredictFee(vipGroup, ts.getUserId());
+								}else{
+									teachModeSalaryMap = vipGroupService.countVipGroupCoursePredictFee(vipGroup, ts.getUserId(), ts.getCourseScheduleId());
+								}
 								if(TeachModeEnum.ONLINE.equals(ts.getCourseSchedule().getTeachMode())&&teachModeSalaryMap.containsKey("onlineTeacherSalary")){
 									ts.setExpectSalary(teachModeSalaryMap.get("onlineTeacherSalary"));
 								}else if(TeachModeEnum.OFFLINE.equals(ts.getCourseSchedule().getTeachMode())&&teachModeSalaryMap.containsKey("offlineTeacherSalary")){
 									ts.setExpectSalary(teachModeSalaryMap.get("offlineTeacherSalary"));
 								}
-
-								ts.setExpectSalary(tdms.getOfflineClassesSalary());
+								if(!vipGroupCategory.getMusicTheory()){
+									ts.setExpectSalary(tdms.getOfflineClassesSalary());
+								}
 								list.add(ts);
 							}
 						}

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

@@ -987,7 +987,11 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			normalStudentNum = classGroupStudentMapperDao.countGroupNormalStudentNum(GroupType.VIP, vipGroup.getId().toString());
 		}
 
-		if(Objects.nonNull(vipGroupActivity)){
+		if(!vipGroupCategory.getMusicTheory()&&Objects.isNull(vipGroupActivity)){
+			throw new BizException("活动设置错误");
+		}
+
+		if(!vipGroupCategory.getMusicTheory()){
 			VipGroupSalarySettlementDto vipGroupSalarySettlementDto = JSON.parseObject(vipGroupActivity.getSalarySettlementJson(), VipGroupSalarySettlementDto.class);
 
 			if(Objects.isNull(vipGroupSalarySettlementDto)){
@@ -1044,17 +1048,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			}
 
 			results.put("totalPrice",totalPrice.setScale(0,BigDecimal.ROUND_CEILING));
-
-			if(vipGroup instanceof VipGroupApplyBaseInfoDto && !CollectionUtils.isEmpty(((VipGroupApplyBaseInfoDto)vipGroup).getVipGroupStudentCoursePrices())){
-				for (VipGroupStudentCoursePrice vscp : ((VipGroupApplyBaseInfoDto)vipGroup).getVipGroupStudentCoursePrices()) {
-					if(Objects.isNull(vscp.getOnlineClassesUnitPrice())||Objects.isNull(vscp.getOfflineClassesUnitPrice())){
-						throw new BizException("请设置课程单价");
-					}
-					vscp.setPaymentPrice(vscp.getOfflineClassesUnitPrice().multiply(new BigDecimal(vipGroup.getOfflineClassesNum())).add(vscp.getOnlineClassesUnitPrice().multiply(new BigDecimal(vipGroup.getOnlineClassesNum()))));
-					vipGroup.setTotalPrice(vipGroup.getTotalPrice().add(vscp.getPaymentPrice()));
-					results.put(vscp.getStudentId().toString(), vscp.getPaymentPrice());
-				}
-			}
+			vipGroup.setTotalPrice(totalPrice.setScale(0,BigDecimal.ROUND_CEILING));
 
 			//教师课酬线上单课酬计算
 			if(Objects.nonNull(vipGroupSalarySettlementDto.getOnlineSalarySettlement())){
@@ -1124,11 +1118,9 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 
 			results.put("onlineTeacherSalary", ots);
 			results.put("offlineTeacherSalary", ofts);
-		}else{
-
 		}
 
-		if(Objects.isNull(vipGroupActivity)||vipGroupCategory.getMusicTheory()){
+		if(vipGroupCategory.getMusicTheory()){
 			BigDecimal ots = teacherDefaultVipGroupSalary.getOfflineClassesSalary();
 			BigDecimal ofts = teacherDefaultVipGroupSalary.getOfflineClassesSalary();
 			if(Objects.nonNull(vipGroup.getStatus())&&vipGroupCategory.getMusicTheory()){
@@ -1141,8 +1133,14 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		}
 
 		if(vipGroup instanceof VipGroupApplyBaseInfoDto&&!CollectionUtils.isEmpty(((VipGroupApplyBaseInfoDto)vipGroup).getVipGroupStudentCoursePrices())){
-			vipGroup.setTotalPrice(new BigDecimal(0));
+			if(vipGroupCategory.getMusicTheory()){
+				vipGroup.setTotalPrice(new BigDecimal(0));
+			}
 			for (VipGroupStudentCoursePrice vscp : ((VipGroupApplyBaseInfoDto)vipGroup).getVipGroupStudentCoursePrices()) {
+				if(!vipGroupCategory.getMusicTheory()){
+					results.put(vscp.getStudentId().toString(), vipGroup.getTotalPrice());
+					continue;
+				}
 				if(Objects.isNull(vscp.getOnlineClassesUnitPrice())||Objects.isNull(vscp.getOfflineClassesUnitPrice())){
 					throw new BizException("请设置课程单价");
 				}
@@ -1821,7 +1819,9 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			throw new BizException("不能对已停止的课程进行此操作");
 		}
 
-        List<StudentApplyRefunds> studentApplyRefunds = studentApplyRefundsDao.findByGroupAndUser(vipGroupId.toString(), GroupType.VIP.getCode(), studentId);
+		VipGroupCategory vipGroupCategory = vipGroupCategoryDao.get(vipGroup.getVipGroupCategoryId());
+
+		List<StudentApplyRefunds> studentApplyRefunds = studentApplyRefundsDao.findByGroupAndUser(vipGroupId.toString(), GroupType.VIP.getCode(), studentId);
 		if(!CollectionUtils.isEmpty(studentApplyRefunds)){
 		    throw new BizException("此学生存在退课申请,请到系统日志中查看");
         }
@@ -1879,7 +1879,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
             courseScheduleStudentPaymentDao.batchDeleteWithID(studentPaymentIds);
         }
 
-        if(!vipGroup.getStatus().equals(VipGroupStatusEnum.APPLYING)){
+        if(!vipGroup.getStatus().equals(VipGroupStatusEnum.APPLYING)||(Objects.nonNull(vipGroupCategory)&&vipGroupCategory.getMusicTheory())){
 			courseScheduleTeacherSalaryService.updateVipGroupCourseTeacherSalary(vipGroupId.intValue(), vipGroup.getUserId());
 		}
 

+ 13 - 2
mec-teacher/src/main/java/com/ym/mec/teacher/controller/VipGroupCategoryController.java

@@ -12,13 +12,16 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
+import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.Date;
+import java.util.List;
 import java.util.Objects;
+import java.util.stream.Collectors;
 
 @Api(tags = "vip课类别")
 @RequestMapping("vipGroupCategory")
@@ -48,13 +51,21 @@ public class VipGroupCategoryController extends BaseController {
 			return failed(HttpStatus.FORBIDDEN, "请登录");
 		}
 		if(Objects.nonNull(organId)){
-			return succeed(vipGroupCategoryService.findAllByOrgan(organId.toString()));
+			List<VipGroupCategory> result = vipGroupCategoryService.findAllByOrgan(organId.toString());
+			if(!CollectionUtils.isEmpty(result)){
+				result = result.stream().filter(c->!c.getMusicTheory()).collect(Collectors.toList());
+			}
+			return succeed(result);
 		}else{
 			Teacher teacher = teacherDao.get(user.getId());
 			if(Objects.isNull(teacher)){
 				return failed("教师信息不存在");
 			}
-			return succeed(vipGroupCategoryService.findAllByOrgan(teacher.getTeacherOrganId().toString()));
+			List<VipGroupCategory> result = vipGroupCategoryService.findAllByOrgan(teacher.getTeacherOrganId().toString());
+			if(!CollectionUtils.isEmpty(result)){
+				result = result.stream().filter(c->!c.getMusicTheory()).collect(Collectors.toList());
+			}
+			return succeed(result);
 		}
 	}