Browse Source

Merge branch 'master' of http://git.dayaedu.com/yonge/mec

zouxuan 5 years ago
parent
commit
559c085635

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/VipGroupCourseAdjustInfoDto.java

@@ -37,6 +37,17 @@ public class VipGroupCourseAdjustInfoDto {
     @ApiModelProperty(value = "是否跳过节假日 true-跳过 false-不跳过")
     private boolean isHoliday;
 
+    @ApiModelProperty(value = "教学点")
+    private Integer schoolId;
+
+    public Integer getSchoolId() {
+        return schoolId;
+    }
+
+    public void setSchoolId(Integer schoolId) {
+        this.schoolId = schoolId;
+    }
+
     public BigDecimal getSingleClassPrice() {
         return singleClassPrice;
     }

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

@@ -939,6 +939,11 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 			throw new BizException("排课起始时间不能小于当前时间");
 		}
 
+		boolean needSchoolId=Objects.nonNull(vipGroupCourseAdjustInfo.getTeachMode())&&vipGroupCourseAdjustInfo.getTeachMode().equals(TeachModeEnum.OFFLINE)&&Objects.isNull(vipGroupCourseAdjustInfo.getTeachMode());
+		if(needSchoolId){
+			throw new BizException("请设置教学点");
+		}
+
 		VipGroup vipGroup=vipGroupDao.get(vipGroupCourseAdjustInfo.getVipGroupId().longValue());
 		if(Objects.isNull(vipGroup)){
 			throw new BizException("指定课程不存在");
@@ -1029,6 +1034,14 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 					courseSchedules.get(courseStartDates.size()-1).setClassDate(courseStartTime);
 					courseSchedules.get(courseStartDates.size()-1).setStartClassTime(courseStartTime);
 					courseSchedules.get(courseStartDates.size()-1).setEndClassTime(courseEndTime);
+					if(Objects.nonNull(vipGroupCourseAdjustInfo.getTeachMode())){
+						courseSchedules.get(courseStartDates.size()-1).setTeachMode(vipGroupCourseAdjustInfo.getTeachMode());
+						if(vipGroupCourseAdjustInfo.getTeachMode().equals(TeachModeEnum.OFFLINE)){
+							courseSchedules.get(courseStartDates.size()-1).setSchoolId(vipGroupCourseAdjustInfo.getSchoolId());
+						}else{
+							courseSchedules.get(courseStartDates.size()-1).setSchoolId(null);
+						}
+					}
 				}
 				if(courseStartDates.size()==courseScheduleIds.size()){
 					break;
@@ -1307,6 +1320,12 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 				boolean teacherIsChange=oldTeacherIsNull||(!newTeacherIsNull&&!oldCourseSchedule.getActualTeacherId().equals(newCourseSchedule.getActualTeacherId()));
 				boolean schoolIsChange=oldSchoolIsNull||(newSchoolIsNull&&!oldCourseSchedule.getSchoolId().equals(newCourseSchedule.getSchoolId()));
 
+				boolean needSchoolId = Objects.nonNull(newCourseSchedule.getTeachMode())&&newCourseSchedule.getTeachMode().equals(TeachModeEnum.OFFLINE)&&Objects.isNull(newCourseSchedule.getSchoolId());
+
+				if(needSchoolId){
+					throw new BizException("请设置教学点");
+				}
+
 				if(schoolIsChange){
 					oldCourseSchedule.setSchoolId(newCourseSchedule.getSchoolId());
 				}
@@ -1383,6 +1402,14 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 			if(Objects.nonNull(newCourseSchedule.getSchoolId())){
 				oldCourseSchedule.setSchoolId(newCourseSchedule.getSchoolId());
 			}
+
+			if(Objects.nonNull(newCourseSchedule.getTeachMode())){
+				oldCourseSchedule.setTeachMode(newCourseSchedule.getTeachMode());
+				if(newCourseSchedule.getTeachMode().equals(TeachModeEnum.ONLINE)){
+					oldCourseSchedule.setSchoolId(null);
+				}
+			}
+
 			oldCourseSchedule.setActualTeacherId(newCourseSchedule.getActualTeacherId());
 			courseScheduleDao.update(oldCourseSchedule);
 			//删除被修改的教师课酬记录和考勤记录

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

@@ -87,7 +87,7 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA
 		SysConfig attendanceTimeRange = sysConfigService.findByParamName(SysConfigService.ENABLE_STUDENT_ATTENDANCE_TIME_RANGE);
 		int courseEndTime = DateUtil.minutesBetween(courseSchedule.getEndClassTime(), date);
 		if(date.after(courseSchedule.getEndClassTime())&&courseEndTime>attendanceTimeRange.getParanValue(Integer.class)){
-			throw new BizException("程结束一小时后禁止点名");
+			throw new BizException("程结束一小时后禁止点名");
 		}
 		studentAttendanceDao.deleteStudentAttendancesByCourse(courseScheduleId);
 		int classTimes=courseScheduleDao.countClassTimes(courseSchedule.getClassGroupId().longValue(),courseSchedule.getStartClassTime());

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

@@ -16,6 +16,8 @@ import java.util.stream.Collectors;
 import javax.annotation.Resource;
 
 import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -96,6 +98,8 @@ import com.ym.mec.util.http.HttpUtil;
 @Service
 public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, StudentRegistration> implements StudentRegistrationService {
 
+	private static final Logger LOGGER = LoggerFactory.getLogger(StudentRegistrationServiceImpl.class);
+	
     @Resource
     private StudentRegistrationDao studentRegistrationDao;
     @Autowired
@@ -792,6 +796,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 MusicGroupStudentFee musicGroupStudentFee = musicGroupStudentFeeDao.findByUser(studentRegistration.getUserId(), studentRegistration.getMusicGroupId());
                 musicGroupStudentFee.setLatestPaidTime(nowDate);
                 musicGroupStudentFee.setPaymentStatus(MusicGroupStudentFee.PaymentStatus.PAID_COMPLETED);
+                musicGroupStudentFee.setTemporaryCourseFee(BigDecimal.ZERO);
                 musicGroupStudentFee.setUpdateTime(nowDate);
                 musicGroupStudentFeeDao.update(musicGroupStudentFee);
                 //添加学生
@@ -850,14 +855,19 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                     studentRegistration.getParentsName(), studentPaymentOrder.getActualAmount());
 
 //            //生成课程协议
-            contractService.transferMusicGroupCoursesContract(studentRegistration.getUserId(),studentRegistration.getMusicGroupId());
-            //商品协议(租赁时候有)
-            if(musicOneSubjectClassPlan.getKitGroupPurchaseType().equals(KitGroupPurchaseTypeEnum.LEASE)){
-                StudentPaymentOrderDetail applyOrderMusical = studentPaymentOrderDetailService.findApplyOrderMusical(studentPaymentOrder.getId());
-                if(applyOrderMusical != null && applyOrderMusical.getGoodsIdList() != null && !applyOrderMusical.getGoodsIdList().equals("")){
-                    contractService.transferGoodsContract(studentPaymentOrder.getUserId(),studentPaymentOrder.getMusicGroupId(),applyOrderMusical.getGoodsIdList(),musicOneSubjectClassPlan.getKitGroupPurchaseType());
-                }
-            }
+			try {
+				contractService.transferMusicGroupCoursesContract(studentRegistration.getUserId(), studentRegistration.getMusicGroupId());
+				// 商品协议(租赁时候有)
+				if (musicOneSubjectClassPlan.getKitGroupPurchaseType().equals(KitGroupPurchaseTypeEnum.LEASE)) {
+					StudentPaymentOrderDetail applyOrderMusical = studentPaymentOrderDetailService.findApplyOrderMusical(studentPaymentOrder.getId());
+					if (applyOrderMusical != null && applyOrderMusical.getGoodsIdList() != null && !applyOrderMusical.getGoodsIdList().equals("")) {
+						contractService.transferGoodsContract(studentPaymentOrder.getUserId(), studentPaymentOrder.getMusicGroupId(),
+								applyOrderMusical.getGoodsIdList(), musicOneSubjectClassPlan.getKitGroupPurchaseType());
+					}
+				}
+			} catch (Exception e) {
+				LOGGER.error("协议生成失败",e);
+			}
         }
 
 

+ 12 - 0
mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -195,6 +195,12 @@
             <if test="schoolId != null">
                 schoole_id_ = #{schoolId},
             </if>
+            <if test="schoolId == null">
+                schoole_id_ = null,
+            </if>
+            <if test="teachMode != null">
+                teach_mode_ = #{teachMode,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
+            </if>
             update_time_ = NOW()
         </set>
         WHERE id_ = #{id}
@@ -1023,6 +1029,12 @@
                 <if test="item.schoolId != null">
                     schoole_id_ = #{item.schoolId},
                 </if>
+                <if test="item.schoolId == null">
+                    schoole_id_ = null,
+                </if>
+                <if test="item.teachMode != null">
+                    teach_mode_ = #{item.teachMode,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
+                </if>
                 update_time_ = NOW()
             </set>
             WHERE id_ = #{item.id}

+ 22 - 18
mec-web/src/main/java/com/ym/mec/web/controller/ExportController.java

@@ -193,9 +193,9 @@ public class ExportController extends BaseController {
                 for (StudentPaymentOrderDetail orderDetail : row.getOrderDetailList()) {
                     if (orderDetail.getType().equals(OrderDetailTypeEnum.MUSICAL)) {
                         musicalFee = musicalFee.add(orderDetail.getPrice());
-                    }else if(orderDetail.getType().equals(OrderDetailTypeEnum.COURSE)){
+                    } else if (orderDetail.getType().equals(OrderDetailTypeEnum.COURSE)) {
                         courseFee = courseFee.add(orderDetail.getPrice());
-                    }else if (orderDetail.getType().equals(OrderDetailTypeEnum.ACCESSORIES) || orderDetail.getType().equals(OrderDetailTypeEnum.TEACHING) || orderDetail.getType().equals(OrderDetailTypeEnum.OTHER)) {
+                    } else if (orderDetail.getType().equals(OrderDetailTypeEnum.ACCESSORIES) || orderDetail.getType().equals(OrderDetailTypeEnum.TEACHING) || orderDetail.getType().equals(OrderDetailTypeEnum.OTHER)) {
                         teachingFee = teachingFee.add(orderDetail.getPrice());
                     }
                 }
@@ -254,9 +254,9 @@ public class ExportController extends BaseController {
 
         try {
             String[] header = {"序号", "学生姓名", "交易流水号", "订单编号", "收款渠道", "收款账户", "支付金额", "到账时间",
-                    "关联乐团ID/VIP课ID", "课程形态","课程费用", "押金", "乐器", "教辅费用", "零星收款费用", "零星收款类别", "手续费", "专业", "分部", "单位/学校", "备注"};
+                    "关联乐团ID/VIP课ID", "课程形态", "课程费用", "押金", "乐器", "教辅费用", "零星收款费用", "零星收款类别", "手续费", "专业", "分部", "单位/学校", "备注"};
             String[] body = {"id", "user.username", "transNo", "orderNo", "paymentChannel", "merNos", "actualAmount", "payTime", "musicGroupId",
-                    "groupType.desc", "courseFee","leaseFee", "musicalFee", "teachingFee", "sporadicAmount", "sporadicType", "transferFee", "subjectName", "organName", "schoolName", "memo"};
+                    "groupType.desc", "courseFee", "leaseFee", "musicalFee", "teachingFee", "sporadicAmount", "sporadicType", "transferFee", "subjectName", "organName", "schoolName", "memo"};
             HSSFWorkbook workbook = POIUtil.exportExcel(header, body, studentPaymentOrderExportDtos);
             response.setContentType("application/octet-stream");
             response.setHeader("Content-Disposition", "attachment;filename=lender-" + DateUtil.getDate(new Date()) + ".xls");
@@ -282,16 +282,18 @@ public class ExportController extends BaseController {
                 } else {
                     row.setGender("女");
                 }
-                if (row.getPaymentStatus().equals("PAID_COMPLETED")) {
-                    row.setPaymentStatus("完成缴费");
-                } else if (row.getPaymentStatus().equals("NON_PAYMENT")) {
-                    row.setPaymentStatus("未缴费");
-                } else if (row.getPaymentStatus().equals("PROCESSING")) {
-                    row.setPaymentStatus("缴费中");
+                if (row.getPaymentStatus() != null) {
+                    if (row.getPaymentStatus().equals("PAID_COMPLETED")) {
+                        row.setPaymentStatus("完成缴费");
+                    } else if (row.getPaymentStatus().equals("NON_PAYMENT")) {
+                        row.setPaymentStatus("未缴费");
+                    } else if (row.getPaymentStatus().equals("PROCESSING")) {
+                        row.setPaymentStatus("缴费中");
+                    }
                 }
-                if(row.getStudentStatus().equals("NORMAL")){
+                if (row.getStudentStatus().equals("NORMAL")) {
                     row.setStudentStatus("在读");
-                }else {
+                } else {
                     row.setStudentStatus("退团");
                 }
                 if (row.getIsActive()) {
@@ -299,18 +301,20 @@ public class ExportController extends BaseController {
                 } else {
                     row.setActiveName("否");
                 }
-                if(row.getIsNewStudent().equals(1)){
+                if (row.getIsNewStudent().equals(1)) {
                     row.setIsNewStudentStr("是");
-                }else {
+                } else {
                     row.setIsNewStudentStr("否");
                 }
-                row.setNextPaymentDateStr(DateUtil.format(row.getNextPaymentDate(), DateUtil.DEFAULT_PATTERN));
+                if (row.getNextPaymentDate() != null) {
+                    row.setNextPaymentDateStr(DateUtil.format(row.getNextPaymentDate(), DateUtil.DEFAULT_PATTERN));
+                }
                 row.setCurrentGrade(row.getCurrentGrade() + row.getCurrentClass());
             }
-            String[] header = {"学员编号","学员姓名", "性别", "联系电话", "年级班级", "专业", "学员状态", "新增学员", "缴费金额",
+            String[] header = {"学员编号", "学员姓名", "性别", "联系电话", "年级班级", "专业", "学员状态", "新增学员", "缴费金额",
                     "下次缴费日期", "报名缴费", "是否激活"};
-            String[] body = {"userId","realName", "gender", "phone", "currentGrade", "subjectName", "studentStatus", "isNewStudentStr",
-                    "courseFee", "nextPaymentDateStr","paymentStatus", "activeName"};
+            String[] body = {"userId", "realName", "gender", "phone", "currentGrade", "subjectName", "studentStatus", "isNewStudentStr",
+                    "courseFee", "nextPaymentDateStr", "paymentStatus", "activeName"};
             HSSFWorkbook workbook = POIUtil.exportExcel(header, body, musicGroupStudentsDtoPageInfo.getRows());
             response.setContentType("application/octet-stream");
             response.setHeader("Content-Disposition", "attachment;filename=lender-" + DateUtil.getDate(new Date()) + ".xls");