Jelajahi Sumber

Merge remote-tracking branch 'origin/master'

Joburgess 5 tahun lalu
induk
melakukan
d7e4c30997

+ 12 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentPaymentOrder.java

@@ -108,6 +108,9 @@ public class StudentPaymentOrder {
 	
 	private SysUser user = new SysUser();
 
+	//优惠金额
+	private BigDecimal remitFee;
+
 	public void setId(Long id){
 		this.id = id;
 	}
@@ -315,9 +318,17 @@ public class StudentPaymentOrder {
 		this.organId = organId;
 	}
 
+
+	public BigDecimal getRemitFee() {
+		return remitFee;
+	}
+
+	public void setRemitFee(BigDecimal remitFee) {
+		this.remitFee = remitFee;
+	}
+
 	@Override
 	public String toString() {
 		return ToStringBuilder.reflectionToString(this);
 	}
-
 }

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

@@ -707,11 +707,15 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
                 .distinct()
                 .collect(Collectors.toList());
         //班级与学生的关联记录
+        List<CourseScheduleStudentPayment> exitStudentPaymentList = courseScheduleStudentPaymentDao.findByCourseScheduleIds(existCourseScheduleIds);
+
         List<ClassGroupStudentMapper> classGroupStudentMappers = classGroupStudentMapperDao.findByClassGroups(classGroupIds);
         Map<Integer, List<ClassGroupStudentMapper>> classGroupStudentsMap = classGroupStudentMappers
                 .stream()
                 .collect(Collectors.groupingBy(ClassGroupStudentMapper::getClassGroupId));
 
+        Map<Long, List<CourseScheduleStudentPayment>> exitStudentPaymentMap = exitStudentPaymentList.stream().collect(Collectors.groupingBy(CourseScheduleStudentPayment::getId));
+
         //根据课程获取教师id关联集合
         List<IntegerAndIntegerListDto> courseScheduleTeachingTeacherIdList = new ArrayList<>();
         if (!CollectionUtils.isEmpty(existCourseScheduleIds)) {
@@ -730,13 +734,12 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 
         newNode:
         for (CourseSchedule newCourseSchedule : courseSchedules) {
-            exitNode:
             for (CourseSchedule existCourseSchedule : existCourseSchedules) {
-                if(newCourseSchedule.getEndClassTime().compareTo(existCourseSchedule.getStartClassTime()) <= 0){
+                if (newCourseSchedule.getEndClassTime().compareTo(existCourseSchedule.getStartClassTime()) <= 0) {
                     continue newNode;
                 }
-                if(existCourseSchedule.getEndClassTime().compareTo(newCourseSchedule.getStartClassTime()) <= 0){
-                    continue exitNode;
+                if (existCourseSchedule.getEndClassTime().compareTo(newCourseSchedule.getStartClassTime()) <= 0) {
+                    continue;
                 }
 
                 boolean isTeacherRepeat = false;
@@ -761,22 +764,23 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 
                 //学生冲突检测
                 if (newCourseSchedule.getClassGroupId().equals(existCourseSchedule.getClassGroupId())) {
-                    //如果班级相同,则学生肯定存在冲突
+                    //如果班级相同,则学生肯定全部存在冲突,当做老师冲突处理
                     isTeacherRepeat = true;
                 }
-                //如果班级不同,则需要检测两个班级是否存在重复的学生
-                List<ClassGroupStudentMapper> preClassGroupStudents = classGroupStudentsMap.get(newCourseSchedule.getClassGroupId());
-                List<ClassGroupStudentMapper> backClassGroupStudents = classGroupStudentsMap.get(existCourseSchedule.getClassGroupId());
 
                 List<Integer> repeatStudentIds = new ArrayList<>();
-                if (classGroupStudentsMap.containsKey(newCourseSchedule.getClassGroupId()) && classGroupStudentsMap.containsKey(existCourseSchedule.getClassGroupId())) {
+                if (!isTeacherRepeat && classGroupStudentsMap.containsKey(newCourseSchedule.getClassGroupId()) && exitStudentPaymentMap.containsKey(existCourseSchedule.getId())) {
+                    //如果班级不同,则需要检测两个班级是否存在重复的学生
+                    List<ClassGroupStudentMapper> preClassGroupStudents = classGroupStudentsMap.get(newCourseSchedule.getClassGroupId());
+                    List<CourseScheduleStudentPayment> backClassGroupStudents = exitStudentPaymentMap.get(existCourseSchedule.getId());
+
                     //当前课程所在班级的学生编号列表
                     List<Integer> preClassGroupStudentIds = preClassGroupStudents.stream()
                             .map(ClassGroupStudentMapper::getUserId)
                             .collect(Collectors.toList());
                     //后面一节课程所在班级的学生编号列表
                     List<Integer> backClassGroupStudentIds = backClassGroupStudents.stream()
-                            .map(ClassGroupStudentMapper::getUserId)
+                            .map(CourseScheduleStudentPayment::getUserId)
                             .collect(Collectors.toList());
                     repeatStudentIds = preClassGroupStudentIds.stream()
                             .filter(backClassGroupStudentIds::contains)
@@ -784,7 +788,13 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
                     if (!CollectionUtils.isEmpty(repeatStudentIds)) {
                         isStudentRepeat = true;
                     }
+
+                    if(isStudentRepeat && (backClassGroupStudentIds.size() == repeatStudentIds.size())){
+                        isStudentRepeat = false;
+                        isTeacherRepeat = true;
+                    }
                 }
+
                 if (!isTeacherRepeat && !isStudentRepeat) {
                     continue;
                 }

+ 13 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java

@@ -311,6 +311,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             }
         }
 
+        studentPaymentOrder.setPaymentChannel("BALANCE");
         studentPaymentOrder.setOrganId(chargeInfo.getOrganId());
         studentPaymentOrder.setUpdateTime(date);
         studentPaymentOrderService.update(studentPaymentOrder);
@@ -499,6 +500,10 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         if (amount.compareTo(orderAmount) != 0) {
             throw new BizException("商品价格不符");
         }
+
+        if (amount.compareTo(BigDecimal.ZERO) < 0) {
+            throw new BizException("价格异常");
+        }
         String orderNo = idGeneratorService.generatorId("payment") + "";
 
         String channelType = "";
@@ -522,6 +527,8 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
                 sysUserCashAccountService.updateBalance(userId, balance.negate(), PlatformCashAccountDetailTypeEnum.PAY_FEE, "乐团报名");
             }
         }
+        studentPaymentOrder.setPaymentChannel("BALANCE");
+        studentPaymentOrder.setRemitFee(remitFee);
         studentPaymentOrder.setOrganId(musicGroup.getOrganId());
         studentPaymentOrder.setUpdateTime(date);
         studentPaymentOrderService.update(studentPaymentOrder);
@@ -731,6 +738,10 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             throw new BizException("商品价格不符");
         }
 
+        if (amount.compareTo(BigDecimal.ZERO) < 0) {
+            throw new BizException("价格异常");
+        }
+
         String orderNo = idGeneratorService.generatorId("payment") + "";
 
         String channelType = "";
@@ -754,6 +765,8 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
                 sysUserCashAccountService.updateBalance(userId, balance.negate(), PlatformCashAccountDetailTypeEnum.PAY_FEE, "乐团报名");
             }
         }
+        studentPaymentOrder.setPaymentChannel("BALANCE");
+        studentPaymentOrder.setRemitFee(remitFee);
         studentPaymentOrder.setOrganId(musicGroup.getOrganId());
         studentPaymentOrder.setUpdateTime(date);
         studentPaymentOrderService.update(studentPaymentOrder);

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

@@ -140,6 +140,9 @@ public class SporadicChargeInfoImpl extends BaseServiceImpl<Integer, SporadicCha
         if (rows != null && rows.size() > 0) {
             Set<Integer> organIds = rows.stream().map(e -> e.getOrganId()).collect(Collectors.toSet());
             List<Integer> userIds = rows.stream().map(e -> e.getUserId()).collect(Collectors.toList());
+            if(userIds == null){
+                userIds = new ArrayList<>();
+            }
             Set<Integer> operatorIds = rows.stream().map(e -> e.getOperatorId()).collect(Collectors.toSet());
             Map<Integer, String> organNames = MapUtil.convertMybatisMap(organizationDao.findOrganNameMap(StringUtils.join(organIds, ",")));
             Map<Integer, String> operatorNames = MapUtil.convertMybatisMap(teacherDao.queryNameByIds(StringUtils.join(operatorIds, ",")));

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

@@ -609,6 +609,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             studentPaymentOrder.setStatus(DealStatusEnum.WAIT_PAY);
             studentPaymentOrder.setMusicGroupId(musicGroupId);
             studentPaymentOrder.setClassGroupId(studentAddDto.getSignClassId());
+            studentPaymentOrder.setOrganId(musicGroup.getOrganId());
 
             //生成订单明细
             List<StudentPaymentOrderDetail> studentPaymentOrderDetails = studentAddDto.getStudentPaymentOrderDetails();

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

@@ -79,7 +79,7 @@
 
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="SporadicChargeInfo" parameterType="map">
-		SELECT * FROM sporadic_charge_info sci
+		SELECT sci.* FROM sporadic_charge_info sci
 		LEFT JOIN sys_user su ON su.id_ = sci.user_id_
 		<include refid="queryPageSql"/>
 		ORDER BY sci.id_ DESC

+ 4 - 0
mec-biz/src/main/resources/config/mybatis/StudentPaymentOrderMapper.xml

@@ -17,6 +17,7 @@
         <result column="com_amount_" property="comAmount"/>
         <result column="per_amount_" property="perAmount"/>
         <result column="balance_payment_amount_" property="balancePaymentAmount"/>
+        <result column="remit_fee_" property="remitFee"/>
         <result column="trans_no_" property="transNo"/>
         <result column="status_" property="status" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <result column="memo_" property="memo"/>
@@ -149,6 +150,9 @@
             <if test="balancePaymentAmount != null">
                 balance_payment_amount_ = #{balancePaymentAmount},
             </if>
+            <if test="remitFee != null">
+                remit_fee_ = #{remitFee},
+            </if>
             <if test="type != null">
                 type_ = #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
             </if>

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

@@ -603,7 +603,7 @@
         </if>
     </select>
     <select id="queryUsernameByIds" resultType="java.util.Map" parameterType="list">
-        select id_ `key`,real_name_ `value` FROM sys_user s
+        select id_ `key`,username_ `value` FROM sys_user s
         WHERE s.id_ IN
         <foreach collection="userIds" item="item" open="(" close=")" separator=",">
             #{item}

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

@@ -280,9 +280,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","remitFee", "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");

+ 6 - 1
mec-web/src/main/java/com/ym/mec/web/controller/VipGroupManageController.java

@@ -70,7 +70,12 @@ public class VipGroupManageController extends BaseController {
         if(Objects.isNull(teacher)){
             return failed("请指定指导老师!");
         }
-        vipGroupApplyDto.getVipGroupApplyBaseInfo().setOrganId(teacher.getTeacherOrganId());
+        Employee employee = employeeDao.get(sysUser.getId());
+        if(StringUtils.isEmpty(employee.getOrganIdList()) || employee.getOrganIdList().contains(",")){
+            vipGroupApplyDto.getVipGroupApplyBaseInfo().setOrganId(teacher.getTeacherOrganId());
+        }else {
+            vipGroupApplyDto.getVipGroupApplyBaseInfo().setOrganId(Integer.parseInt(employee.getOrganIdList()));
+        }
         vipGroupService.createVipGroup(vipGroupApplyDto);
         return succeed();
     }