فهرست منبع

add 未缴费学员【学员回访】必填

周箭河 4 سال پیش
والد
کامیت
1b5902e7d8

+ 11 - 2
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentRegistrationDao.java

@@ -363,16 +363,25 @@ public interface StudentRegistrationDao extends BaseDAO<Long, StudentRegistratio
 
     /**
      * 获取分部乐团在读学生数
+     *
      * @return
      */
     List<OrderStatisDto> getOrganNormalStudent();
 
     /**
+     * @param userIds:
+     * @return java.util.List<com.ym.mec.biz.dal.dto.UserGroupDto>
      * @describe 获取学员关联乐团记录
      * @author qnc99
      * @date 2020/11/24 0024
-     * @param userIds:
-     * @return java.util.List<com.ym.mec.biz.dal.dto.UserGroupDto>
      */
     List<UserGroupDto> getUserGroups(@Param("userIds") List<Integer> userIds);
+
+
+    /**
+     * 获取乐团未交费的学生
+     * @param musicGroupId
+     * @return
+     */
+    List<StudentRegistration> getNoPaymentStudent(@Param("musicGroupId") String musicGroupId);
 }

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentVisitDao.java

@@ -4,6 +4,7 @@ import com.ym.mec.biz.dal.dto.BasicUserDto;
 import com.ym.mec.biz.dal.dto.StudentVisitDto;
 import com.ym.mec.biz.dal.entity.StudentVisit;
 import com.ym.mec.common.dal.BaseDAO;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 import java.util.Map;
@@ -37,8 +38,18 @@ public interface StudentVisitDao extends BaseDAO<Integer, StudentVisit> {
 
     /**
      * 获取学生总数
+     *
      * @param params
      * @return
      */
     Integer getStudentsCount(Map<String, Object> params);
+
+    /**
+     * 获取乐团回访的学生
+     *
+     * @param musicGroupId
+     * @param studentIds
+     * @return
+     */
+    List<Integer> getMusicGroupVisitStudent(@Param("musicGroupId") String musicGroupId, @Param("studentIds") List<Integer> studentIds);
 }

+ 70 - 79
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java

@@ -9,6 +9,7 @@ import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.stream.Collectors;
 
+import com.ym.mec.biz.dal.dao.*;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -21,37 +22,6 @@ import com.alibaba.fastjson.TypeReference;
 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.biz.dal.dao.ChargeTypeDao;
-import com.ym.mec.biz.dal.dao.ClassGroupDao;
-import com.ym.mec.biz.dal.dao.ClassGroupStudentMapperDao;
-import com.ym.mec.biz.dal.dao.CooperationOrganDao;
-import com.ym.mec.biz.dal.dao.CourseScheduleDao;
-import com.ym.mec.biz.dal.dao.CourseScheduleStudentPaymentDao;
-import com.ym.mec.biz.dal.dao.CourseScheduleTeacherSalaryDao;
-import com.ym.mec.biz.dal.dao.EmployeeDao;
-import com.ym.mec.biz.dal.dao.MusicGroupBuildLogDao;
-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.MusicGroupPaymentEntitiesDao;
-import com.ym.mec.biz.dal.dao.MusicGroupPaymentStudentCourseDetailDao;
-import com.ym.mec.biz.dal.dao.MusicGroupPurchaseListDao;
-import com.ym.mec.biz.dal.dao.MusicGroupQuitDao;
-import com.ym.mec.biz.dal.dao.MusicGroupStudentFeeDao;
-import com.ym.mec.biz.dal.dao.MusicGroupSubjectGoodsGroupDao;
-import com.ym.mec.biz.dal.dao.MusicGroupSubjectPlanDao;
-import com.ym.mec.biz.dal.dao.OrganizationDao;
-import com.ym.mec.biz.dal.dao.SchoolDao;
-import com.ym.mec.biz.dal.dao.SporadicChargeInfoDao;
-import com.ym.mec.biz.dal.dao.StudentDao;
-import com.ym.mec.biz.dal.dao.StudentPaymentOrderDao;
-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.SysConfigDao;
-import com.ym.mec.biz.dal.dao.TeacherAttendanceDao;
-import com.ym.mec.biz.dal.dao.TeacherDao;
 import com.ym.mec.biz.dal.dto.BasicUserDto;
 import com.ym.mec.biz.dal.dto.CourseFormDto;
 import com.ym.mec.biz.dal.dto.CourseScheduleTeachersDto;
@@ -259,6 +229,8 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
     private MusicGroupPaymentStudentCourseDetailDao musicGroupPaymentStudentCourseDetailDao;
     @Autowired
     private SubjectChangeDao subjectChangeDao;
+    @Autowired
+    private StudentVisitDao studentVisitDao;
 
     private SimpleDateFormat sdf_ymd = new SimpleDateFormat("yyyy-MM-dd");
 
@@ -1602,19 +1574,19 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             studentRegistration.setUpdateTime(date);
 
             studentRegistrationDao.update(studentRegistration);
-            
+
             //更新服务指标、运营指标
             int remainCourseNum = courseScheduleStudentPaymentDao.countStudentNotStartCourseNumWithCourseType(userId, null);
-            if(remainCourseNum == 0){
-            	Student student = studentDao.get(userId);
-            	if(student == null){
-            		throw new BizException("学生信息查询失败");
-            	}
-            	student.setServiceTag(0);
-            	student.setOperatingTag(0);
-            	student.setOperatingTempTag(0);
-            	student.setUpdateTime(date);
-            	studentDao.update(student);
+            if (remainCourseNum == 0) {
+                Student student = studentDao.get(userId);
+                if (student == null) {
+                    throw new BizException("学生信息查询失败");
+                }
+                student.setServiceTag(0);
+                student.setOperatingTag(0);
+                student.setOperatingTempTag(0);
+                student.setUpdateTime(date);
+                studentDao.update(student);
             }
 
             //删除用户购买的课程记录
@@ -1625,11 +1597,11 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 
             BigDecimal price = courseScheduleStudentPaymentDao.countFinishCoursePriceWithMusicGroup(musicGroupId, GroupType.MUSIC, userId);
             BigDecimal subtractAmount = studentRegistration.getSurplusCourseFee();
-            if(Objects.isNull(price)){
+            if (Objects.isNull(price)) {
                 price = new BigDecimal(0);
             }
             subtractAmount = subtractAmount.subtract(price);
-            if(BigDecimal.ZERO.compareTo(subtractAmount)<0){
+            if (BigDecimal.ZERO.compareTo(subtractAmount) < 0) {
                 studentRegistrationService.updateUserSurplusCourseFee(userId, musicGroupId, subtractAmount.negate(), reason, operator.getId());
             }
 
@@ -1637,10 +1609,10 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 
             // 判断乐器是否是租赁
             MusicGroupSubjectPlan musicGroupSubjectPlan = musicGroupSubjectPlanDao.getMusicOneSubjectClassPlan(musicGroupId, studentRegistration.getActualSubjectId());
-            if(musicGroupSubjectPlan != null){
-            	musicGroupSubjectPlan.setPaidStudentNum(musicGroupSubjectPlan.getPaidStudentNum() - 1);
-            	musicGroupSubjectPlan.setUpdateTime(date);
-            	musicGroupSubjectPlanDao.update(musicGroupSubjectPlan);
+            if (musicGroupSubjectPlan != null) {
+                musicGroupSubjectPlan.setPaidStudentNum(musicGroupSubjectPlan.getPaidStudentNum() - 1);
+                musicGroupSubjectPlan.setUpdateTime(date);
+                musicGroupSubjectPlanDao.update(musicGroupSubjectPlan);
             }
 
             StudentPaymentOrder studentPaymentOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, musicGroupId, SUCCESS);
@@ -1752,21 +1724,21 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         studentRegistration.setUpdateTime(date);
 
         studentRegistrationDao.update(studentRegistration);
-        
+
         //更新服务指标、运营指标
         int remainCourseNum = courseScheduleStudentPaymentDao.countStudentNotStartCourseNumWithCourseType(userId, null);
-        if(remainCourseNum == 0){
-        	Student student = studentDao.get(userId);
-        	if(student == null){
-        		throw new BizException("学生信息查询失败");
-        	}
-        	student.setServiceTag(0);
-        	student.setOperatingTag(0);
-        	student.setOperatingTempTag(0);
-        	student.setUpdateTime(date);
-        	studentDao.update(student);
-        }
-        
+        if (remainCourseNum == 0) {
+            Student student = studentDao.get(userId);
+            if (student == null) {
+                throw new BizException("学生信息查询失败");
+            }
+            student.setServiceTag(0);
+            student.setOperatingTag(0);
+            student.setOperatingTempTag(0);
+            student.setUpdateTime(date);
+            studentDao.update(student);
+        }
+
 
         //删除用户购买的课程记录
         musicGroupPaymentStudentCourseDetailDao.deleteByUserIdAndMusicGroupId(userId, musicGroupId);
@@ -1776,11 +1748,11 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 
         BigDecimal price = courseScheduleStudentPaymentDao.countFinishCoursePriceWithMusicGroup(musicGroupId, GroupType.MUSIC, userId);
         BigDecimal subtractAmount = studentRegistration.getSurplusCourseFee();
-        if(Objects.isNull(price)){
+        if (Objects.isNull(price)) {
             price = new BigDecimal(0);
         }
         subtractAmount = subtractAmount.subtract(price);
-        if(BigDecimal.ZERO.compareTo(subtractAmount)<0){
+        if (BigDecimal.ZERO.compareTo(subtractAmount) < 0) {
             studentRegistrationService.updateUserSurplusCourseFee(userId, musicGroupId, subtractAmount.negate(), reason, operator.getId());
         }
 
@@ -1788,10 +1760,10 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 
         // 判断乐器是否是租赁
         MusicGroupSubjectPlan musicGroupSubjectPlan = musicGroupSubjectPlanDao.getMusicOneSubjectClassPlan(musicGroupId, studentRegistration.getActualSubjectId());
-        if(musicGroupSubjectPlan != null){
-        	musicGroupSubjectPlan.setPaidStudentNum(musicGroupSubjectPlan.getPaidStudentNum() - 1);
-        	musicGroupSubjectPlan.setUpdateTime(date);
-        	musicGroupSubjectPlanDao.update(musicGroupSubjectPlan);
+        if (musicGroupSubjectPlan != null) {
+            musicGroupSubjectPlan.setPaidStudentNum(musicGroupSubjectPlan.getPaidStudentNum() - 1);
+            musicGroupSubjectPlan.setUpdateTime(date);
+            musicGroupSubjectPlanDao.update(musicGroupSubjectPlan);
         }
 
         StudentPaymentOrder studentPaymentOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, musicGroupId, SUCCESS);
@@ -1853,12 +1825,12 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         }
 
         //缴费项目预计人数减一
-        musicGroupPaymentCalenderDao.cutCalenderExpectNum(userId,musicGroupId);
+        musicGroupPaymentCalenderDao.cutCalenderExpectNum(userId, musicGroupId);
         //删除缴费项目
-        List<Long> calenderIds = musicGroupPaymentCalenderDao.findStudentNoPaymentCalender(userId,musicGroupId);
+        List<Long> calenderIds = musicGroupPaymentCalenderDao.findStudentNoPaymentCalender(userId, musicGroupId);
         //删除缴费项目详情
         musicGroupPaymentCalenderDetailDao.deleteByUserIdAndMusicGroupId(userId, musicGroupId);
-        if(calenderIds != null && calenderIds.size() > 0){
+        if (calenderIds != null && calenderIds.size() > 0) {
             musicGroupPaymentCalenderDao.delByIds(calenderIds);
         }
         return true;
@@ -2073,7 +2045,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
                 sysMessageService.batchSendMessage(MessageSender.AWSMS, MessageTypeEnum.STUDENT_SMS_MUSIC_GROUP_RENEW_SUCCESS, yimei, null, 0, "1", "",
                         studentRegistration.getParentsName(), studentPaymentOrder.getActualAmount());
             }
-            studentRegistrationService.updateUserSurplusCourseFee(userId,musicGroupId,studentPaymentOrder.getExpectAmount(),"乐团续费",userId);
+            studentRegistrationService.updateUserSurplusCourseFee(userId, musicGroupId, studentPaymentOrder.getExpectAmount(), "乐团续费", userId);
             return true;
         } else {
             if (studentPaymentOrder.getBalancePaymentAmount() != null && studentPaymentOrder.getBalancePaymentAmount().doubleValue() > 0) {
@@ -2275,11 +2247,11 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         if (group == null) {
             throw new BizException("乐团信息不存在");
         }
-        
-		if (!(group.getStatus() == MusicGroupStatusEnum.DRAFT || group.getStatus() == MusicGroupStatusEnum.AUDIT_FAILED
-				|| group.getStatus() == MusicGroupStatusEnum.PROGRESS)) {
-			throw new BizException("当前乐团状态不能修改基本信息");
-		}
+
+        if (!(group.getStatus() == MusicGroupStatusEnum.DRAFT || group.getStatus() == MusicGroupStatusEnum.AUDIT_FAILED
+                || group.getStatus() == MusicGroupStatusEnum.PROGRESS)) {
+            throw new BizException("当前乐团状态不能修改基本信息");
+        }
 
         MusicGroup musicGroup = subFeeSettingDto.getMusicGroup();
         musicGroup.setStatus(group.getStatus());
@@ -2300,9 +2272,9 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             MusicGroupPaymentCalender regCalender = musicGroupPaymentCalenderDao.findByMusicGroupRegCalender(musicGroupId);
             if (regCalender != null) {
                 musicGroupPaymentCalenderDao.delByGroupId(musicGroupId);
-                
+
                 List<Long> calenderIds = new ArrayList<Long>();
-        		calenderIds.add(regCalender.getId());
+                calenderIds.add(regCalender.getId());
                 musicGroupPaymentCalenderCourseSettingsDao.deleteByMusicGroupPaymentCalenderId(calenderIds);
             }
         }
@@ -2401,7 +2373,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
     }
 
     @Override
-    public List<CourseScheduleTeachersDto> queryTeacherSalary(Long courseScheduleId,Integer teacherId) {
+    public List<CourseScheduleTeachersDto> queryTeacherSalary(Long courseScheduleId, Integer teacherId) {
         return courseScheduleTeacherSalaryDao.queryTeacherSalary(courseScheduleId, teacherId);
     }
 
@@ -2507,6 +2479,25 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         } else {
             throw new BizException("当前乐团状态不支持此操作");
         }
+        //报名未交费的学生,完成回访才能到下一步
+        boolean hasNoVisit = false;
+        StringBuilder tipsMsg = new StringBuilder();
+        List<StudentRegistration> noPaymentStudents = studentRegistrationDao.getNoPaymentStudent(musicGroupId);
+        if (noPaymentStudents.size() > 0) {
+            tipsMsg.append("以下学生未完成回访,");
+            List<Integer> studentIds = noPaymentStudents.stream().map(StudentRegistration::getUserId).collect(Collectors.toList());
+            List<Integer> musicGroupVisitStudent = studentVisitDao.getMusicGroupVisitStudent(musicGroupId, studentIds);
+            for (StudentRegistration noPaymentStudent : noPaymentStudents) {
+                if (!musicGroupVisitStudent.contains(noPaymentStudent.getUserId())) {
+                    hasNoVisit = true;
+                    tipsMsg.append(noPaymentStudent.getName()).append("(").append(noPaymentStudent.getUserId()).append(")、");
+                }
+            }
+        }
+        if (hasNoVisit) {
+            throw new BizException(tipsMsg.append("请完成回访").toString());
+        }
+
         musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, event, sysUser.getId(), ""));
         musicGroup.setStatus(MusicGroupStatusEnum.PREPARE);
         musicGroupDao.update(musicGroup);

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

@@ -690,4 +690,7 @@
             #{userId}
         </foreach>
     </select>
+    <select id="getNoPaymentStudent" resultMap="StudentRegistration">
+        SELECT * FROM student_registration WHERE music_group_id_ = #{musicGroupId} AND payment_status_ IN (0,1)
+    </select>
 </mapper>

+ 7 - 0
mec-biz/src/main/resources/config/mybatis/StudentVisitMapper.xml

@@ -172,4 +172,11 @@
         </if>
         AND s.del_flag_ = 0
     </select>
+    <select id="getMusicGroupVisitStudent" resultType="java.lang.Integer">
+        SELECT DISTINCT student_id_ FROM student_visit WHERE music_group_id_=#{musicGroupId}
+        AND student_id_ IN
+        <foreach collection="studentIds" item="studentId" open="(" close=")" separator=",">
+            #{studentId}
+        </foreach>
+    </select>
 </mapper>