Pārlūkot izejas kodu

任务板:50、48、44、4138

zouxuan 5 gadi atpakaļ
vecāks
revīzija
c3d8c52c0e

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

@@ -10,6 +10,7 @@ import com.ym.mec.biz.dal.enums.CourseStatusEnum;
 import com.ym.mec.biz.dal.enums.GroupType;
 import com.ym.mec.common.dal.BaseDAO;
 
+import com.ym.mec.common.page.PageInfo;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 
@@ -730,4 +731,11 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
     void updateCourseScheduleSchool(@Param("groupType") String groupType,@Param("musicGroupId") String musicGroupId,@Param("schoolId") Integer schoolId);
 
     int countCourseScheduleByMusicGroupId(@Param("musicGroupId") String musicGroupId);
+
+    /**
+     * 获取学员的课程列表
+     * @param params
+     * @return
+     */
+    PageInfo<CourseListDto> queryStudentCourse(Map<String, Object> params);
 }

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

@@ -8,6 +8,7 @@ import java.math.BigDecimal;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 public interface MusicGroupStudentFeeDao extends BaseDAO<Long, MusicGroupStudentFee> {
 
@@ -120,4 +121,11 @@ public interface MusicGroupStudentFeeDao extends BaseDAO<Long, MusicGroupStudent
 	 */
 	void batchInsert(@Param("musicGroupStudentFees") List<MusicGroupStudentFee> musicGroupStudentFees
 			, @Param("nextPaymentDate") Date nextPaymentDate, @Param("paymentStatus") String paymentStatus);
+
+	/**
+	 * 获取当前乐团下所有学员缴费状态
+	 * @param musicGroupId
+	 * @return
+	 */
+	List<Map<Integer, String>> findPaymentStatusMap(String musicGroupId);
 }

+ 25 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/MusicGroupStudentsDto.java

@@ -2,6 +2,9 @@ package com.ym.mec.biz.dal.dto;
 
 import io.swagger.annotations.ApiModelProperty;
 
+import java.math.BigDecimal;
+import java.util.Date;
+
 public class MusicGroupStudentsDto{
 
     @ApiModelProperty(value = "学生编号",required = false)
@@ -25,6 +28,12 @@ public class MusicGroupStudentsDto{
     @ApiModelProperty(value = "专业",required = false)
     private String subjectName;
 
+    @ApiModelProperty(value = "下次缴费日期",required = false)
+    private Date nextPaymentDate;
+
+    @ApiModelProperty(value = "课程费用",required = false)
+    private BigDecimal courseFee;
+
     @ApiModelProperty(value = "乐团编号",required = false)
     private String musicGroupId;
 
@@ -37,6 +46,22 @@ public class MusicGroupStudentsDto{
     @ApiModelProperty(value = "是否新增学员(1是0否)",required = false)
     private Integer isNewStudent;
 
+    public Date getNextPaymentDate() {
+        return nextPaymentDate;
+    }
+
+    public void setNextPaymentDate(Date nextPaymentDate) {
+        this.nextPaymentDate = nextPaymentDate;
+    }
+
+    public BigDecimal getCourseFee() {
+        return courseFee;
+    }
+
+    public void setCourseFee(BigDecimal courseFee) {
+        this.courseFee = courseFee;
+    }
+
     public Integer getUserId() {
         return userId;
     }

+ 2 - 2
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupStudentFee.java

@@ -74,7 +74,7 @@ public class MusicGroupStudentFee {
 	private java.util.Date updateTime;
 
 	public MusicGroupStudentFee(String musicGroupId, Integer userId, Integer subjectId,
-								BigDecimal courseFee, Date nextPaymentDate, BigDecimal temporaryCourseFee) {
+								BigDecimal courseFee, Date nextPaymentDate, BigDecimal temporaryCourseFee,PaymentStatus paymentStatus) {
 		this.musicGroupId = musicGroupId;
 		this.userId = userId;
 		this.subjectId = subjectId;
@@ -82,7 +82,7 @@ public class MusicGroupStudentFee {
 		this.nextPaymentDate = nextPaymentDate;
 		this.continuousAbsenteeismTimes = 0;
 		this.temporaryCourseFee = temporaryCourseFee;
-		this.paymentStatus = PaymentStatus.PAID_COMPLETED;
+		this.paymentStatus = paymentStatus;
 	}
 
 	public MusicGroupStudentFee() {

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/MusicGroupStudentQueryInfo.java

@@ -8,6 +8,9 @@ public class MusicGroupStudentQueryInfo extends QueryInfo {
   @ApiModelProperty(value = "科目编号")
   private Integer subjectId;
 
+  @ApiModelProperty(value = "学员姓名")
+  private String studentName;
+
   @ApiModelProperty(value = "乐团编号")
   private String musicGroupId;
 
@@ -17,6 +20,14 @@ public class MusicGroupStudentQueryInfo extends QueryInfo {
   @ApiModelProperty(value = "缴费状态  PAID_COMPLETED(完成缴费), NON_PAYMENT(未缴费), PROCESSING(缴费中)",required = false)
   private String paymentStatus;
 
+  public String getStudentName() {
+    return studentName;
+  }
+
+  public void setStudentName(String studentName) {
+    this.studentName = studentName;
+  }
+
   public String getMusicGroupId() {
     return musicGroupId;
   }

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

@@ -16,6 +16,16 @@ public class VipGroupQueryInfo extends QueryInfo {
 
     private Integer activityId;
 
+    private String status;
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
     public Integer getTeacherId() {
         return teacherId;
     }

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

@@ -556,11 +556,12 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         List<CourseListDto> courseListDtos = null;
         //获取分页前的所有的乐团编号和vip编号
         params.put("offset", pageInfo.getOffset());
-        List<String> musicGroupIds = courseScheduleDao.queryMusicGroupIds(params);
+        List<String> musicGroupIds = null;
         if (queryInfo.isHideOverGroup()) {
             musicGroupIds = courseScheduleDao.queryMusicGroupIdsWithoutOverGroup(params);
             pageInfo.setTotal(courseScheduleDao.countMusicGroupIdsWithoutOverGroup(params));
         }else {
+            musicGroupIds = courseScheduleDao.queryMusicGroupIds(params);
             pageInfo.setTotal(courseScheduleDao.countMusicGroupIds(params));
         }
         courseListDtos = new ArrayList<>();

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

@@ -1013,6 +1013,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         }
 
         musicGroup.setPaymentExpireDate(expireDate);
+        musicGroup.setApplyExpireDate(expireDate);
         musicGroup.setUpdateTime(date);
         musicGroupDao.update(musicGroup);
         musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId,"延长缴费",sysUser.getId(),""));

+ 7 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentManageServiceImpl.java

@@ -13,6 +13,7 @@ import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.page.QueryInfo;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.http.HttpUtil;
+import org.apache.commons.collections.MapUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -31,6 +32,8 @@ public class StudentManageServiceImpl implements StudentManageService {
     @Autowired
     private StudentManageDao studentManageDao;
     @Autowired
+    private MusicGroupStudentFeeDao musicGroupStudentFeeDao;
+    @Autowired
     private TeacherDao teacherDao;
     @Autowired
     private StudentRegistrationDao studentRegistrationDao;
@@ -187,6 +190,10 @@ public class StudentManageServiceImpl implements StudentManageService {
             pageInfo.setTotal(count);
             params.put("offset", pageInfo.getOffset());
             dataList = studentManageDao.queryMusicGroupStudent(params);
+            Map<Integer,String> maps = MapUtil.convertIntegerMap(musicGroupStudentFeeDao.findPaymentStatusMap(queryInfo.getMusicGroupId()));
+            dataList.forEach(e->{
+                e.setPaymentStatus(maps.get(e.getUserId()));
+            });
         }
         if (count == 0) {
             dataList = new ArrayList<>();

+ 19 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -507,6 +507,12 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 sysUser.setImToken(register.getToken());
                 teacherDao.updateUser(sysUser);
             } else {
+                sysUser.setPhone(studentRegistration.getParentsPhone());
+                sysUser.setRealName(studentRegistration.getParentsName());
+                sysUser.setUsername(studentRegistration.getName());
+                sysUser.setGender(studentRegistration.getGender());
+                sysUser.setOrganId(studentRegistration.getOrganId());
+                teacherDao.updateUser(sysUser);
                 userId = sysUser.getId();
             }
             studentRegistration.setActualSubjectId(studentRegistration.getSubjectId());
@@ -532,9 +538,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 studentAddDto.setCourseFee(musicOneSubjectClassPlan.getFee());
             }
             Date nextPaymentDate = musicGroupPaymentCalenderService.getNextPaymentDate(musicGroupId);
-            musicGroupStudentFeeDao.insert(new MusicGroupStudentFee(musicGroupId,
-                    userId, studentRegistration.getSubjectId(), studentAddDto.getCourseFee(),
-                    nextPaymentDate, studentAddDto.getTemporaryCourseFee()));
+
             //生成订单
             StudentPaymentOrder studentPaymentOrder = new StudentPaymentOrder();
             studentPaymentOrder.setUserId(userId);
@@ -548,22 +552,33 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             List<StudentPaymentOrderDetail> studentPaymentOrderDetails = studentAddDto.getStudentPaymentOrderDetails();
             if (studentPaymentOrderDetails == null) {
                 studentPaymentOrderDetails = new ArrayList<>();
+            }else {
+                studentPaymentOrderDetails.forEach(e->{
+                    if(e.getPrice() == null){
+                        throw new BizException("请补全订单信息");
+                    }
+                });
             }
             StudentPaymentOrderDetail studentPaymentOrderDetail = new StudentPaymentOrderDetail();
             studentPaymentOrderDetail.setPrice(studentAddDto.getTemporaryCourseFee());
             studentPaymentOrderDetail.setType(OrderDetailTypeEnum.COURSE);
             studentPaymentOrderDetails.add(studentPaymentOrderDetail);
             //汇总金额
+
             BigDecimal reduce = studentPaymentOrderDetails.stream().map(e -> e.getPrice()).reduce(BigDecimal.ZERO, BigDecimal::add);
+            MusicGroupStudentFee.PaymentStatus paymentStatus = MusicGroupStudentFee.PaymentStatus.NON_PAYMENT;
             if (reduce == BigDecimal.ZERO) {
+                paymentStatus = MusicGroupStudentFee.PaymentStatus.PAID_COMPLETED;
                 studentPaymentOrder.setStatus(DealStatusEnum.SUCCESS);
                 studentRegistration.setPaymentStatus(PaymentStatusEnum.YES);
                 studentPaymentOrder.setActualAmount(reduce);
                 studentPaymentOrder.setPayTime(date);
             }
+            musicGroupStudentFeeDao.insert(new MusicGroupStudentFee(musicGroupId,
+                    userId, studentRegistration.getSubjectId(), studentAddDto.getCourseFee(),
+                    nextPaymentDate, studentAddDto.getTemporaryCourseFee(),paymentStatus));
             studentPaymentOrder.setExpectAmount(reduce);
             //当前学员是否以前存在过当前乐团
-//                StudentRegistration registration = studentRegistrationDao.queryByUserIdAndMusicGroupId(userId, musicGroupId);
             if(phoneAndMusicGroupId != null){
                 studentRegistration.setId(phoneAndMusicGroupId.getId());
                 studentRegistrationDao.update(studentRegistration);

+ 5 - 9
mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -1166,20 +1166,16 @@
         WHERE cs.id_=#{courseScheduleId}
     </select>
     <select id="queryMusicGroupIds" resultType="java.lang.String">
-        SELECT DISTINCT spo.music_group_id_ FROM student_payment_order spo
-        LEFT JOIN class_group_student_mapper cgsm ON spo.music_group_id_ = cgsm.music_group_id_
+        SELECT DISTINCT cgsm.music_group_id_ FROM class_group_student_mapper cgsm
         LEFT JOIN class_group cg ON cgsm.class_group_id_ = cg.id_
-        WHERE spo.type_ != 'OTHER' AND spo.music_group_id_ IS NOT NULL
-        AND spo.user_id_ = #{userId} AND spo.status_='SUCCESS' AND cgsm.status_ != 'QUIT' AND cg.del_flag_ = 0
-        ORDER BY spo.music_group_id_
+        WHERE cgsm.user_id_ = #{userId} AND cgsm.status_ != 'QUIT' AND cg.del_flag_ = 0
+        ORDER BY cgsm.music_group_id_
         <include refid="global.limit"/>
     </select>
     <select id="countMusicGroupIds" resultType="int">
-        SELECT COUNT(DISTINCT spo.music_group_id_) FROM student_payment_order spo
-        LEFT JOIN class_group_student_mapper cgsm ON spo.music_group_id_ = cgsm.music_group_id_
+        SELECT COUNT(DISTINCT cgsm.music_group_id_) FROM class_group_student_mapper cgsm
         LEFT JOIN class_group cg ON cgsm.class_group_id_ = cg.id_
-        WHERE spo.type_ != 'OTHER' AND spo.music_group_id_ IS NOT NULL
-        AND spo.user_id_ = #{userId} AND spo.status_='SUCCESS' AND cgsm.status_ != 'QUIT' AND cg.del_flag_ = 0
+        WHERE cgsm.user_id_ = #{userId} AND cgsm.status_ != 'QUIT' AND cg.del_flag_ = 0
     </select>
     <select id="queryMusicGroupIdsWithoutOverGroup" resultType="java.lang.String">
         SELECT DISTINCT spo.music_group_id_ FROM student_payment_order spo

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

@@ -173,6 +173,9 @@
         LEFT JOIN music_group_subject_plan mgsp ON mgsp.music_group_id_ = sr.music_group_id_ AND mgsp.subject_id_ = sr.actual_subject_id_
         WHERE sr.music_group_status_ != 'QUIT' AND sr.payment_status_ = 2 AND mgsf.id_ IS NULL AND sr.music_group_id_ = #{musicGroupId}
     </select>
+    <select id="findPaymentStatusMap" resultType="java.util.Map">
+        SELECT user_id_ 'key',payment_status_ 'value' FROM music_group_student_fee_ WHERE music_group_id_ = #{musicGroupId}
+    </select>
 
     <update id="batchUpdate" parameterType="java.util.List">
     	<foreach collection="list" item="item" index="index" open="" close="" separator=";">

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

@@ -357,6 +357,9 @@
             <if test="search != null and search != ''">
                 AND (su.real_name_ like CONCAT("%",#{search},"%") OR sr.parents_phone_ like CONCAT("%",#{search},"%"))
             </if>
+            <if test="studentName != null">
+                AND su.username_ like CONCAT("%",#{studentName},"%")
+            </if>
             <if test="subjectId != null">
                 AND sr.actual_subject_id_ = #{subjectId}
             </if>
@@ -383,16 +386,19 @@
         <result property="paymentStatus" column="payment_status_"/>
         <result property="musicGroupId" column="music_group_id_"/>
         <result property="isNewStudent" column="is_new_student_"/>
+        <result property="courseFee" column="course_fee_"/>
+        <result property="nextPaymentDate" column="next_payment_date_"/>
     </resultMap>
     <select id="queryMusicGroupStudent" resultMap="MusicGroupStudentsDto">
         SELECT sr.user_id_,su.username_ real_name_,su.gender_,sr.parents_phone_,sr.current_grade_,
-        sr.current_class_,sr.music_group_status_,sr.payment_status_,
+        sr.current_class_,sr.music_group_status_,mgsf.next_payment_date_,mgsf.course_fee_,
         s.name_ subject_name_,sr.music_group_id_,
         IF(DATE_FORMAT(sr.create_time_,'%Y-%m-%d') > DATE_FORMAT(mg.payment_expire_date_,'%Y-%m-%d'),1,0) is_new_student_
         FROM student_registration sr
         LEFT JOIN sys_user su ON sr.user_id_ = su.id_
         LEFT JOIN `subject` s ON s.id_ = sr.actual_subject_id_
         LEFT JOIN music_group mg ON sr.music_group_id_ = mg.id_
+        LEFT JOIN music_group_student_fee_ mgsf ON mgsf.music_group_id_ = mg.id_ AND mgsf.user_id_ = su.id_
         <include refid="queryMusicGroupStudentSql"/>
         ORDER BY sr.create_time_ DESC
         <include refid="global.limit"/>

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

@@ -159,6 +159,9 @@
             <if test="teacherId!=null">
                 AND vg.user_id_=#{teacherId}
             </if>
+            <if test="status != null">
+                AND vg.status_ = #{status}
+            </if>
             <if test="activityId!=null">
                 AND vg.vip_group_activity_id_=#{activityId}
             </if>

+ 0 - 3
mec-teacher/src/main/java/com/ym/mec/teacher/controller/SmsCodeController.java

@@ -4,7 +4,6 @@ import com.google.code.kaptcha.Constants;
 import com.google.code.kaptcha.Producer;
 import com.google.code.kaptcha.servlet.KaptchaServlet;
 import com.ym.mec.biz.service.SmsCodeService;
-import com.ym.mec.biz.service.TeacherService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.security.SecurityConstants;
 import io.swagger.annotations.Api;
@@ -33,8 +32,6 @@ public class SmsCodeController extends BaseController {
     @Autowired
     private SmsCodeService smsCodeService;
     @Autowired
-    private TeacherService teacherService;
-    @Autowired
     private Producer captchaProducer;
     @Autowired
     private RedisTemplate<String,String> redisTemplate;