Sfoglia il codice sorgente

Merge remote-tracking branch 'origin/master'

周箭河 5 anni fa
parent
commit
75b4e402ac

+ 8 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleDao.java

@@ -703,4 +703,12 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
      */
     Integer countCurrentTimes(@Param("classGroupId") Integer classGroupId,
                               @Param("currentCourseDate") Date currentCourseDate);
+
+    /**
+     * 修改未上课程教学点
+     * @param groupType
+     * @param musicGroupId
+     * @param schoolId
+     */
+    void updateCourseScheduleSchool(@Param("groupType") String groupType,@Param("musicGroupId") String musicGroupId,@Param("schoolId") Integer schoolId);
 }

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleTeacherSalaryDao.java

@@ -213,5 +213,5 @@ public interface CourseScheduleTeacherSalaryDao extends BaseDAO<Long, CourseSche
 	 * @param courseScheduleIds: 课程编号列表
 	 * @return java.util.List<java.util.Map<java.lang.Integer,java.lang.Integer>>
 	 */
-	List<Map<Long,Integer>> checkCoursesIsSettlement(@Param("courseScheduleIds") List<Integer> courseScheduleIds);
+	List<Map<Long,Integer>> checkCoursesIsSettlement(@Param("courseScheduleIds") List<Long> courseScheduleIds);
 }

+ 8 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupStudentFeeDao.java

@@ -4,6 +4,7 @@ import com.ym.mec.biz.dal.entity.MusicGroupStudentFee;
 import com.ym.mec.common.dal.BaseDAO;
 import org.apache.ibatis.annotations.Param;
 
+import java.math.BigDecimal;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
@@ -91,4 +92,11 @@ public interface MusicGroupStudentFeeDao extends BaseDAO<Long, MusicGroupStudent
 	 * @return
 	 */
 	Integer countStudentNoPayNum(String musicGroupId);
+
+	/**
+	 * 根据乐团声部修改学员课程费用
+	 * @param musicGroupId
+	 * @param subjectId
+	 */
+    void updateCourseFee(@Param("musicGroupId") String musicGroupId, @Param("subjectId") Integer subjectId,@Param("courseFee") BigDecimal courseFee);
 }

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

@@ -121,9 +121,12 @@ public class MusicGroup {
 	@ApiModelProperty(value = "乐团图片",required = false)
 	private String img;
 	
-	@ApiModelProperty(value = "教学主任",required = false)
+	@ApiModelProperty(value = "乐队指导",required = false)
 	private Integer directorUserId;
 
+	@ApiModelProperty(value = "乐队指导",required = false)
+	private String directorUserName;
+
 	@ApiModelProperty(value = "乐团创建人",required = false)
 	private Integer operatorUserId;
 
@@ -144,6 +147,14 @@ public class MusicGroup {
 	
 	private OwnershipType ownershipType;
 
+	public String getDirectorUserName() {
+		return directorUserName;
+	}
+
+	public void setDirectorUserName(String directorUserName) {
+		this.directorUserName = directorUserName;
+	}
+
 	public Date getExpectStartGroupDate() {
 		return expectStartGroupDate;
 	}

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/queryMusicGroupStudentQueryInfo.java

@@ -10,6 +10,16 @@ public class queryMusicGroupStudentQueryInfo extends QueryInfo {
 
     private Integer subjectId;
 
+    private String paymentStatus;
+
+    public String getPaymentStatus() {
+        return paymentStatus;
+    }
+
+    public void setPaymentStatus(String paymentStatus) {
+        this.paymentStatus = paymentStatus;
+    }
+
     public String getMusicGroupId() {
         return musicGroupId;
     }

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

@@ -338,4 +338,5 @@ public interface VipGroupService extends BaseService<Long, VipGroup> {
      * @return
      */
     VipBuyResultDto findVipBuyResultInfo(Integer vipGroupId);
+
 }

+ 8 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java

@@ -666,7 +666,13 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 		List<CourseSchedule> oldCourseScheduleIds = courseScheduleDao.findByCourseScheduleIds(courseScheduleIds);
 		Map<Long, List<CourseSchedule>> oldCourseScheduleMap = oldCourseScheduleIds.stream()
 				.collect(Collectors.groupingBy(CourseSchedule::getId));
+		List<Map<Long, Integer>> courseSettlementMaps = courseScheduleTeacherSalaryDao.checkCoursesIsSettlement(courseScheduleIds);
+		Map<Long, Long> courseSettlementMap = MapUtil.convertIntegerMap(courseSettlementMaps);
 		newCourseSchedules.forEach(newCourseSchedule->{
+			Long isSettlement = courseSettlementMap.get(newCourseSchedule.getId().longValue());
+			if(Objects.nonNull(isSettlement)&&isSettlement>0){
+				throw new BizException("调整的课程中存在已结算的课程");
+			}
 			CourseSchedule oldCourseSchedule=null;
 			if(Objects.isNull(newCourseSchedule.getActualTeacherId())){
 				List<CourseSchedule> oldCourseSchedules = oldCourseScheduleMap.get(newCourseSchedule.getId());
@@ -1378,8 +1384,8 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
                     courseSchedule.setIsSettlement(0);
                 });
             }else{
-                List<Integer> courseScheduleIds = dataList.stream()
-                        .map(courseSchedule -> courseSchedule.getId().intValue())
+                List<Long> courseScheduleIds = dataList.stream()
+                        .map(courseSchedule -> courseSchedule.getId())
                         .distinct().collect(Collectors.toList());
                 List<Map<Long, Integer>> courseSettlementMaps = courseScheduleTeacherSalaryDao.checkCoursesIsSettlement(courseScheduleIds);
                 Map<Long, Long> courseSettlementMap = MapUtil.convertIntegerMap(courseSettlementMaps);

+ 23 - 9
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java

@@ -299,17 +299,22 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
                     musicGroupSubjectPlan.setApplyStudentNum(e.getRegisterIdList().size());
                 }
             });
-			if (studentRegistrationList.size() > 0) {
-				studentRegistrationDao.batchInsert(studentRegistrationList);
-			}
             musicGroup.setStatus(MusicGroupStatusEnum.PAY);
 			//是否是免费团
             if (musicGroupSubjectPlans != null && musicGroupSubjectPlans.size() > 0) {
                 int size = musicGroupSubjectPlans.stream().filter(e -> e.getFee().compareTo(BigDecimal.ZERO) == 1).collect(Collectors.toList()).size();
                 if(size < 1){
                     musicGroup.setStatus(MusicGroupStatusEnum.PREPARE);
+                    if (studentRegistrationList.size() > 0) {
+                        //修改为已缴费
+                        studentRegistrationList.forEach(e->e.setPaymentStatus(PaymentStatusEnum.YES));
+                        studentRegistrationDao.batchInsert(studentRegistrationList);
+                    }
                 }
             }
+            if (studentRegistrationList.size() > 0) {
+                studentRegistrationDao.batchInsert(studentRegistrationList);
+            }
             musicGroupDao.update(musicGroup);
             musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "跨团调整", sysUser.getId(),""));
         }
@@ -642,9 +647,13 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             musicGroupSubjectPlanDao.delByMusicGroupId(musicGroupId);
             //删除原有的声部商品组合
             musicGroupSubjectGoodsGroupDao.delByMusicGroupId(subFeeSettingDto.getMusicGroupId());
-
-			if (subFeeSettingDto.getMusicGroupSubjectPlans() != null && subFeeSettingDto.getMusicGroupSubjectPlans().size() > 0) {
-				musicGroupSubjectPlanDao.batchAdd(subFeeSettingDto.getMusicGroupSubjectPlans(), musicGroupId);
+            List<MusicGroupSubjectPlan> musicGroupSubjectPlans = subFeeSettingDto.getMusicGroupSubjectPlans();
+            if (musicGroupSubjectPlans != null && musicGroupSubjectPlans.size() > 0) {
+                musicGroupSubjectPlans.forEach(e->{
+                    //修改课程费用
+                    musicGroupStudentFeeDao.updateCourseFee(musicGroupId,e.getSubjectId(),e.getFee());
+                });
+				musicGroupSubjectPlanDao.batchAdd(musicGroupSubjectPlans, musicGroupId);
 			}
 			if (subFeeSettingDto.getMusicGroupSubjectGoodsGroups() != null && subFeeSettingDto.getMusicGroupSubjectGoodsGroups().size() > 0) {
 				musicGroupSubjectGoodsGroupDao.batchInsert(subFeeSettingDto.getMusicGroupSubjectGoodsGroups(), musicGroupId);
@@ -1039,7 +1048,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 				//更新班级人数
 				classGroupDao.batchUpdateStudentNumMinusOne(classGroupIdList);
 
-                List<ImGroupModel> imGroupModels = new ArrayList<ImGroupModel>();
+                List<ImGroupModel> imGroupModels = new ArrayList<>();
                 ImGroupMember[] imGroupMember = {new ImGroupMember(userId.toString())};
                 for (Integer classGroupId : classGroupIdList) {
                     imGroupModels.add(new ImGroupModel(classGroupId + "",imGroupMember,""));
@@ -1518,10 +1527,14 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             throw new Exception("用户信息获取失败");
         }
         String musicGroupId = subFeeSettingDto.getMusicGroup().getId();
-        if(musicGroupDao.get(musicGroupId) == null){
+        MusicGroup group = musicGroupDao.get(musicGroupId);
+        MusicGroup musicGroup = subFeeSettingDto.getMusicGroup();
+        if(group == null){
             throw new Exception("乐团信息不存在");
+        }else if(group.getSchoolId() != musicGroup.getSchoolId()){
+            //如果已生成课表,那么修改未上课时教学点
+            courseScheduleDao.updateCourseScheduleSchool("MUSIC",musicGroupId,musicGroup.getSchoolId());
         }
-        MusicGroup musicGroup = subFeeSettingDto.getMusicGroup();
 
         Date date = new Date();
         List<Integer> months = subFeeSettingDto.getMonths();
@@ -1644,6 +1657,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
         musicGroup.setEducationalTeacherName(teacherDao.queryNameById(musicGroup.getEducationalTeacherId()));
         musicGroup.setTeamTeacherName(teacherDao.queryNameById(musicGroup.getTeamTeacherId()));
+        musicGroup.setDirectorUserName(teacherDao.queryNameById(musicGroup.getDirectorUserId()));
         Organization organization = organizationDao.get(musicGroup.getOrganId());
         if(organization != null){
             musicGroup.setOrganName(organization.getName());

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

@@ -612,12 +612,6 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                     studentRegistration.setPaymentStatus(PaymentStatusEnum.YES);
                     studentPaymentOrder.setActualAmount(reduce);
                     studentPaymentOrder.setPayTime(date);
-                }else {
-                    Map<Integer, String> receivers = new HashMap<>(1);
-                    receivers.put(studentRegistration.getUserId(), studentRegistration.getParentsPhone());
-                    String studentApplyUrl = sysConfigDao.findConfigValue(SysConfigService.STUDENT_APPLY_URL) + musicGroupId;
-                    sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.YIMEI, MessageTypeEnum.SMS_MUSIC_GROUP_ADD_STUDENT,
-                            receivers, null, 0, null, studentRegistration.getParentsName(), studentRegistration.getName(), musicGroup.getName(),HttpUtil.getSortUrl(studentApplyUrl));
                 }
                 studentPaymentOrder.setExpectAmount(reduce);
                 //当前学员是否以前存在过当前乐团

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

@@ -25,6 +25,8 @@ import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
 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.Propagation;
@@ -109,6 +111,9 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 	@Autowired
     private TeacherService teacherService;
 
+	private static final Logger LOGGER = LoggerFactory
+			.getLogger(VipGroup.class);
+
 	@Override
 	public BaseDAO<Long, VipGroup> getDAO() {
 		return vipGroupDao;
@@ -860,8 +865,8 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			classGroup.setStudentNum(studentPaymentNum);
 			classGroup.setDelFlag(0);
 			vipGroup.setStatus(VipGroupStatusEnum.APPLYING_END);
-			vipGroupDao.update(vipGroup);
 			createVipGroupCourseScheInfo(vipGroupId,classGroup);
+			vipGroupDao.update(vipGroup);
 		}
 		if(num!=0||updateVipStatus){
 			classGroupDao.update(classGroup);
@@ -1060,7 +1065,12 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			return;
 		}
 
-		updateVipGroupStudentNumAndStatus(vipGroupId, classGroup,0,true);
+		try {
+			updateVipGroupStudentNumAndStatus(vipGroupId, classGroup,0,true);
+		} catch (Exception e) {
+			LOGGER.error("小课[{}]开课失败",vipGroupId);
+		}
+
 		SysUserCashAccount sysUserCashAccount = sysUserCashAccountService.get(userId);
 
 		VipGroup vipGroup = vipGroupDao.get(vipGroupId);

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

@@ -957,6 +957,10 @@
         UPDATE course_schedule SET status_ = #{status}
         WHERE id_=#{courseScheduleId}
     </update>
+    <update id="updateCourseScheduleSchool">
+        UPDATE course_schedule cs SET cs.schoole_id_ = #{schoolId} WHERE cs.music_group_id_ = #{musicGroupId}
+        AND cs.group_type_ = 'MUSIC' AND NOW() &lt; CONCAT(cs.class_date_," ",cs.start_class_time_);
+    </update>
 
     <select id="queryNoSignInListByBeforeMinutes" resultMap="CourseSchedule">
         SELECT cs.* FROM course_schedule cs left join teacher_attendance ta on ta.course_schedule_id_ = cs.id_ WHERE ta.sign_in_time_ is null and SUBTIME(start_class_time_, CONCAT(#{minutes},'00')) &lt; CURRENT_TIME()

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

@@ -193,4 +193,7 @@
         WHERE id_ = #{item.id}
         </foreach>
     </update>
+    <update id="updateCourseFee">
+        UPDATE music_group_student_fee_ SET course_fee_ = #{courseFee} WHERE music_group_id_ = #{musicGroupId} AND subject_id_ = #{subjectId}
+    </update>
 </mapper>

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

@@ -428,11 +428,17 @@
 
     <insert id="batchInsert">
         INSERT INTO student_registration
-        (parents_phone_,id_,user_id_,name_,music_group_id_,current_grade_,current_class_,subject_id_,is_allow_adjust_,kit_purchase_method_,remark_,create_time_,update_time_,parents_name_,parents_company_,payment_status_,actual_subject_id_,music_group_status_)
+        (parents_phone_,id_,user_id_,name_,music_group_id_,current_grade_,current_class_,subject_id_,
+        is_allow_adjust_,kit_purchase_method_,remark_,create_time_,update_time_,
+        parents_name_,parents_company_,payment_status_,actual_subject_id_,music_group_status_)
         VALUES
         <foreach collection="studentRegistrationList" item="item" index="index" separator=",">
-            (#{item.parentsPhone},#{item.id},#{item.userId},#{item.name},#{item.musicGroupId},#{item.currentGrade},#{item.currentClass},#{item.subjectId},#{item.isAllowAdjust,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{item.kitPurchaseMethod,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
-            #{item.remark},now(),now(),#{item.parentsName},#{item.parentsCompany},#{item.paymentStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{item.subjectId},#{item.musicGroupStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler})
+            (#{item.parentsPhone},#{item.id},#{item.userId},#{item.name},#{item.musicGroupId},#{item.currentGrade},
+            #{item.currentClass},#{item.subjectId},#{item.isAllowAdjust,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
+            #{item.kitPurchaseMethod,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
+            #{item.remark},now(),now(),#{item.parentsName},#{item.parentsCompany},
+            #{item.paymentStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{item.subjectId},
+            #{item.musicGroupStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler})
         </foreach>
     </insert>
 

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

@@ -430,7 +430,7 @@
         <include refid="queryTeacherAttendanceSql"/>
     </select>
     <select id="queryNameById" resultType="java.lang.String">
-        select real_name_ FROM sys_user s WHERE id_ = #{userId}
+        select real_name_ FROM sys_user s WHERE id_ = #{userId} LIMIT 1
     </select>
     <resultMap id="musicGroupStudentApplyDto" type="com.ym.mec.biz.dal.dto.musicGroupStudentApplyDto">
         <result property="userId" column="user_id_"/>
@@ -460,6 +460,9 @@
             <if test="subjectId != null">
                 AND sr.actual_subject_id_ = #{subjectId}
             </if>
+            <if test="paymentStatus != null">
+                AND sr.payment_status_ = #{paymentStatus}
+            </if>
         </where>
     </sql>
     <select id="countMusicGroupStudentApply" resultType="java.lang.Integer">