zouxuan 4 vuotta sitten
vanhempi
commit
79a47e51e8

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/PracticeGroupDao.java

@@ -404,4 +404,13 @@ public interface PracticeGroupDao extends com.ym.mec.common.dal.BaseDAO<Long, Pr
     int countUserRepeatPracticeGroupInCourseStartEndTime(@Param("userId") Integer userId,
                                                     @Param("courseStartDate") Date courseStartDate,
                                                     @Param("courseEndDate") Date courseEndDate);
+
+    /**
+    * @description: 获取学员可购买的网管课列表
+     * @param params
+    * @return java.util.List<com.ym.mec.biz.dal.dto.StudentVipGroupShowListDto>
+    * @author zx
+    * @date 2021/10/12 14:56
+    */
+    List<StudentVipGroupShowListDto> findPracticeGroups(Map<String, Object> params);
 }

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/ActivityWaitCourseStudentNumDto.java

@@ -18,8 +18,18 @@ public class ActivityWaitCourseStudentNumDto{
 
     private String avatar;
 
+    private String phone;
+
     private Integer userId;
 
+    public String getPhone() {
+        return phone;
+    }
+
+    public void setPhone(String phone) {
+        this.phone = phone;
+    }
+
     public Integer getUserId() {
         return userId;
     }

+ 0 - 34
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/PracticeGroupApplyBaseInfoDto.java

@@ -11,9 +11,6 @@ import java.util.List;
 
 public class PracticeGroupApplyBaseInfoDto extends PracticeGroup {
 
-    @ApiModelProperty(value = "课时总数")
-    private Integer allCourseNum;
-
     @ApiModelProperty(value = "课酬",required = false)
     private BigDecimal salary;
 
@@ -23,25 +20,10 @@ public class PracticeGroupApplyBaseInfoDto extends PracticeGroup {
     @ApiModelProperty(value = "活动课程类型")
     private ActivityCourseType activityCourseType;
 
-    /** 缴费截止时间 */
-    @ApiModelProperty(value = "缴费截止时间", required = false)
-    private java.util.Date paymentExpireDate;
-
     /** 课程结束日期 */
     @ApiModelProperty(value = "课程结束日期", required = false)
     private java.util.Date coursesExpireDate;
 
-    @ApiModelProperty(value = "报名开始时间", required = false)
-    private Date registrationStartTime;
-
-    public Date getPaymentExpireDate() {
-        return paymentExpireDate;
-    }
-
-    public void setPaymentExpireDate(Date paymentExpireDate) {
-        this.paymentExpireDate = paymentExpireDate;
-    }
-
     @Override
     public Date getCoursesExpireDate() {
         return coursesExpireDate;
@@ -52,14 +34,6 @@ public class PracticeGroupApplyBaseInfoDto extends PracticeGroup {
         this.coursesExpireDate = coursesExpireDate;
     }
 
-    public Date getRegistrationStartTime() {
-        return registrationStartTime;
-    }
-
-    public void setRegistrationStartTime(Date registrationStartTime) {
-        this.registrationStartTime = registrationStartTime;
-    }
-
     public ActivityCourseType getActivityCourseType() {
         return activityCourseType;
     }
@@ -76,14 +50,6 @@ public class PracticeGroupApplyBaseInfoDto extends PracticeGroup {
         this.onlineTeacherSalary = onlineTeacherSalary;
     }
 
-    public Integer getAllCourseNum() {
-        return allCourseNum;
-    }
-
-    public void setAllCourseNum(Integer allCourseNum) {
-        this.allCourseNum = allCourseNum;
-    }
-
     public BigDecimal getSalary() {
         return salary;
     }

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/StudentVipGroupShowListDto.java

@@ -61,6 +61,16 @@ public class StudentVipGroupShowListDto {
     @ApiModelProperty(value = "开课时间")
     private Date courseStartDate;
 
+    private Date createTime;
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
     public Date getCourseStartDate() {
         return courseStartDate;
     }

+ 45 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/PracticeGroup.java

@@ -6,6 +6,7 @@ import com.ym.mec.biz.dal.enums.PracticeGroupType;
 import io.swagger.annotations.ApiModelProperty;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 
+import java.math.BigDecimal;
 import java.util.Date;
 
 /**
@@ -77,6 +78,50 @@ public class PracticeGroup {
 	@ApiModelProperty(value = "课程规划",required = false)
 	private String courseScheduleJson;
 
+	@ApiModelProperty(value = "报名截止时间",required = false)
+	private Date paymentExpireDate;
+
+	@ApiModelProperty(value = "报名开始时间",required = false)
+	private Date registrationStartTime;
+
+	@ApiModelProperty(value = "课时总数")
+	private Integer allCourseNum;
+
+	@ApiModelProperty(value = "总金额",required = false)
+	private BigDecimal totalPrice = BigDecimal.ZERO;
+
+	public BigDecimal getTotalPrice() {
+		return totalPrice;
+	}
+
+	public void setTotalPrice(BigDecimal totalPrice) {
+		this.totalPrice = totalPrice;
+	}
+
+	public Integer getAllCourseNum() {
+		return allCourseNum;
+	}
+
+	public void setAllCourseNum(Integer allCourseNum) {
+		this.allCourseNum = allCourseNum;
+	}
+
+	public Date getPaymentExpireDate() {
+		return paymentExpireDate;
+	}
+
+	public void setPaymentExpireDate(Date paymentExpireDate) {
+		this.paymentExpireDate = paymentExpireDate;
+	}
+
+	public Date getRegistrationStartTime() {
+		return registrationStartTime;
+	}
+
+	public void setRegistrationStartTime(Date registrationStartTime) {
+		this.registrationStartTime = registrationStartTime;
+	}
+
 	public String getCourseScheduleJson() {
 		return courseScheduleJson;
 	}

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

@@ -459,4 +459,13 @@ public interface VipGroupService extends BaseService<Long, VipGroup> {
      * @return java.util.List<com.ym.mec.biz.dal.dto.TeacherBasicDto>
      */
     List<TeacherBasicDto> findTeacherWithVipGroupOrganAndSubject(Long vipGroupId);
+
+    /**
+    * @description: 获取学生可购买的vip、网管课
+     * @param queryInfo
+    * @return java.lang.Object
+    * @author zx
+    * @date 2021/10/12 14:51
+    */
+    Object queryVipPracticeGroups(StudentVipGroupQueryInfo queryInfo);
 }

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

@@ -4421,6 +4421,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
             applyBaseInfoDto.setAuditStatus(AuditStatusEnum.ING);
         }
 
+        applyBaseInfoDto.setTotalPrice(costInfo.get("totalPrice"));
         applyBaseInfoDto.setOnlineTeacherSalary(costInfo.get("onlineTeacherSalary"));
         applyBaseInfoDto.setGroupStatus(GroupStatusEnum.APPLYING);
 

+ 13 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

@@ -168,11 +168,9 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 	@Autowired
 	private SysCouponCodeService sysCouponCodeService;
 	@Autowired
-	private CloudTeacherOrderService cloudTeacherOrderService;
-	@Autowired
-	private StudentService studentService;
-	@Autowired
 	private ActivityUserMapperDao activityUserMapperDao;
+	@Autowired
+	private PracticeGroupDao practiceGroupDao;
 
 	private static final Logger LOGGER = LoggerFactory
 			.getLogger(VipGroup.class);
@@ -4493,4 +4491,15 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
         }
 		return teacherByOrganAndSubject;
 	}
+
+	@Override
+	public Object queryVipPracticeGroups(StudentVipGroupQueryInfo queryInfo) {
+		Map<String, Object> params = new HashMap<String, Object>();
+		MapUtil.populateMap(params, queryInfo);
+		List<StudentVipGroupShowListDto> vipGroups = vipGroupDao.findVipGroups(params);
+		vipGroups.addAll(practiceGroupDao.findPracticeGroups(params));
+		vipGroups.removeAll(Collections.singleton(null));
+		List<StudentVipGroupShowListDto> collect = vipGroups.stream().sorted(Comparator.comparing(StudentVipGroupShowListDto::getCreateTime).reversed()).collect(Collectors.toList());
+		return collect;
+	}
 }

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

@@ -51,7 +51,7 @@
 		<where>
 			1=1
 			<if test="search != null and search != ''">
-				AND (name_ LIKE CONCAT('%',#{search},'%') OR id_ = #{search})
+				AND (name_ LIKE CONCAT('%',#{search},'%') OR id_ = #{search} OR FIND_IN_SET(#{search},activity_ids_))
 			</if>
 		</where>
 	</sql>

+ 45 - 7
mec-biz/src/main/resources/config/mybatis/PracticeGroupMapper.xml

@@ -29,6 +29,10 @@
         <result column="be_renew_group_id_" property="beRenewGroupId"/>
         <result column="educational_teacher_id_" property="educationalTeacherId"/>
         <result column="course_schedule_json_" property="courseScheduleJson"/>
+        <result column="payment_expire_date_" property="paymentExpireDate"/>
+        <result column="registration_start_time_" property="registrationStartTime"/>
+        <result column="course_num_" property="allCourseNum"/>
+        <result column="total_price_" property="totalPrice"/>
     </resultMap>
 
     <resultMap id="PracticeCourseDto" type="com.ym.mec.biz.dal.dto.PracticeCourseDto" extends="PracticeGroup">
@@ -67,6 +71,18 @@
     <update id="update" parameterType="com.ym.mec.biz.dal.entity.PracticeGroup">
         UPDATE practice_group
         <set>
+            <if test="totalPrice != null">
+                total_price_ = #{totalPrice},
+            </if>
+            <if test="paymentExpireDate != null">
+                payment_expire_date_ = #{paymentExpireDate},
+            </if>
+            <if test="registrationStartTime != null">
+                registration_start_time_ = #{registrationStartTime},
+            </if>
+            <if test="allCourseNum != null">
+                course_num_ = #{allCourseNum},
+            </if>
             <if test="courseScheduleJson != null">
                 course_schedule_json_ = #{courseScheduleJson},
             </if>
@@ -140,14 +156,16 @@
     <!-- 向数据库增加一条记录 -->
     <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.PracticeGroup" useGeneratedKeys="true" keyColumn="id"
             keyProperty="id">
-        <!--
-        <selectKey resultClass="int" keyProperty="id" >
-        SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL
-        </selectKey>
-        -->
         INSERT INTO practice_group
-        (id_,name_,type_,subject_id_,user_id_,student_id_,single_class_minutes_,organ_id_,courses_start_date_,courses_expire_date_,create_time_,update_time_,memo_,buy_months_,drill_times_on_week_,drill_times_json_,group_status_,be_renew_group_id_,educational_teacher_id_)
-        VALUES(#{id},#{name},#{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{subjectId},#{userId},#{studentId},#{singleClassMinutes},#{organId},#{coursesStartDate},#{coursesExpireDate},NOW(),NOW(),#{memo},#{buyMonths},#{drillTimesOnWeek},#{drillTimesJson},#{groupStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{beRenewGroupId},#{educationalTeacherId})
+        (id_,name_,type_,subject_id_,user_id_,student_id_,single_class_minutes_,
+         organ_id_,courses_start_date_,courses_expire_date_,create_time_,update_time_,
+         memo_,buy_months_,drill_times_on_week_,drill_times_json_,group_status_,
+         be_renew_group_id_,educational_teacher_id_,payment_expire_date_,registration_start_time_,course_num_,total_price_)
+        VALUES(#{id},#{name},#{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
+               #{subjectId},#{userId},#{studentId},#{singleClassMinutes},#{organId},#{coursesStartDate},
+               #{coursesExpireDate},NOW(),NOW(),#{memo},#{buyMonths},#{drillTimesOnWeek},#{drillTimesJson},
+               #{groupStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{beRenewGroupId},
+               #{educationalTeacherId},#{paymentExpireDate},#{registrationStartTime},#{allCourseNum},#{totalPrice})
     </insert>
 
     <select id="getUserFreePracticeGroup" resultMap="PracticeGroup">
@@ -775,4 +793,24 @@
         FROM practice_group
         WHERE student_id_ = #{userId} AND courses_start_date_ = #{courseStartDate} AND courses_expire_date_ = #{courseEndDate}
     </select>
+    <select id="findPracticeGroups" resultMap="com.ym.mec.biz.dal.dao.VipGroupDao.studentVipGroup">
+        SELECT pg.id_,pg.name_,pg.single_class_minutes_,pg.payment_expire_date_,pg.courses_expire_date_,
+        pg.courses_start_date_,pg.course_num_ online_classes_num_,pg.total_price_,cg.expect_student_num_,
+        cg.student_num_,su.real_name_ teacher_name_,su.avatar_,pg.create_time_
+        FROM practice_group pg
+        LEFT JOIN class_group cg ON pg.id_ = cg.music_group_id_ AND cg.group_type_ = 'PRACTICE'
+        LEFT JOIN teacher t ON pg.user_id_ = t.id_
+        LEFT JOIN sys_user su ON pg.user_id_ = su.id_
+        WHERE pg.audit_status_ = 'PASS' AND pg.group_status_ = 'APPLYING' AND pg.courses_expire_date_ >= DATE_FORMAT(NOW(),'%Y%m%d')
+        AND pg.registration_start_time_ &lt;= NOW()
+        AND pg.courses_start_date_ > NOW()
+        AND (select count(1) as num from student_payment_order where pg.id_ = music_group_id_ AND user_id_ = #{userId}
+        AND status_='SUCCESS') = 0 AND pg.student_id_ = #{userId}
+        <if test="subjectId != null">
+            AND pg.subject_id_ = #{subjectId}
+        </if>
+        <if test="search != null">
+            AND pg.name_ LIKE concat('%',#{search},'%')
+        </if>
+    </select>
 </mapper>

+ 17 - 12
mec-biz/src/main/resources/config/mybatis/VipGroupActivityMapper.xml

@@ -237,41 +237,44 @@
 		<where>
 			vga.del_flag_ = 0
 			<if test="courseType != null and courseType != ''">
-				AND course_type_ = #{courseType}
+				AND vga.course_type_ = #{courseType}
 			</if>
 			<if test="giveCourseType != null and giveCourseType != ''">
-				AND give_course_type_ = #{giveCourseType}
+				AND vga.give_course_type_ = #{giveCourseType}
 			</if>
 			<if test="organId != null">
-				AND INTE_ARRAY(organ_id_,#{organId})
+				AND INTE_ARRAY(vga.organ_id_,#{organId})
 			</if>
 			<if test="enable != null">
-				AND enable_ = #{enable}
+				AND vga.enable_ = #{enable}
 			</if>
 			<if test="giveFlag != null">
 				<if test="giveFlag == 'true'">
-					AND (give_course_num_ > 0 OR member_time_ > 0)
+					AND (vga.give_course_num_ > 0 OR vga.member_time_ > 0)
 				</if>
 				<if test="giveFlag == 'false'">
-					AND give_course_num_ = 0 AND member_time_ = 0
+					AND vga.give_course_num_ = 0 AND vga.member_time_ = 0
 				</if>
 			</if>
 			<if test="giveType != null">
 				<if test="giveType == 'VIP' or giveType == 'PRACTICE'">
-					AND give_course_type_ = #{giveType} AND give_course_num_ > 0
+					AND vga.give_course_type_ = #{giveType} AND vga.give_course_num_ > 0
 				</if>
 				<if test="giveType == 'MEMBER'">
-					AND give_course_type_ = #{status} AND give_member_time_ > 0
+					AND vga.give_course_type_ = #{status} AND vga.give_member_time_ > 0
 				</if>
 			</if>
 			<if test="status != null">
-				AND status_ = #{status}
+				AND vga.status_ = #{status}
+			</if>
+			<if test="allowOnlineToOffline != null">
+				AND vga.allow_online_to_offline_ = #{allowOnlineToOffline}
 			</if>
 			<if test="search != null and search != ''">
-				AND (vga.id_=#{search} OR vga.name_ LIKE CONCAT('%', #{search}, '%'))
+				AND (vga.id_ = #{search} OR vga.name_ LIKE CONCAT('%', #{search}, '%'))
 			</if>
 			<if test="applyToStudentType != null">
-				AND FIND_IN_SET(#{applyToStudentType},apply_to_student_type_)
+				AND FIND_IN_SET(#{applyToStudentType},vga.apply_to_student_type_)
 			</if>
 		</where>
 	</sql>
@@ -395,6 +398,7 @@
 		<result property="username" column="username_"/>
 		<result property="avatar" column="avatar_"/>
 		<result property="userId" column="user_id_"/>
+		<result property="phone" column="phone_"/>
 	</resultMap>
 	<select id="getActivityWaitCourseStudentNum" resultMap="ActivityWaitCourseStudentNumDto">
 		SELECT COUNT(CASE WHEN aum.vip_flag_ = 1 THEN 1 ELSE NULL END) vip_num_,
@@ -414,7 +418,8 @@
 		SELECT COUNT(CASE WHEN aum.vip_flag_ = 1 THEN 1 ELSE NULL END) vip_num_,
 			   COUNT(CASE WHEN aum.practice_flag_ = 1 THEN 1 ELSE NULL END) practice_num_,
 			   COUNT(CASE WHEN aum.give_vip_flag_ = 1 THEN 1 ELSE NULL END) give_vip_num_,
-			   COUNT(CASE WHEN aum.give_practice_flag_ = 1 THEN 1 ELSE NULL END) give_practice_num_,su.username_,su.avatar_,s.user_id_
+			   COUNT(CASE WHEN aum.give_practice_flag_ = 1 THEN 1 ELSE NULL END) give_practice_num_,
+				su.username_,su.avatar_,s.user_id_,su.phone_
 		FROM student s
 				 LEFT JOIN sys_user su ON su.id_ = s.user_id_
 				 LEFT JOIN activity_user_mapper aum ON s.user_id_ = aum.user_id_

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

@@ -122,6 +122,7 @@
         <result column="attribute1_" property="attribute1"/>
         <result column="category_name_" property="categoryName"/>
         <result property="courseStartDate" column="courses_start_date"/>
+        <result property="createTime" column="create_time_"/>
     </resultMap>
 
     <!-- 根据主键查询一条记录 -->
@@ -390,7 +391,7 @@
         t.introduction_,
         vga.type_,
         IF(vga.type_='GIVE_CLASS',vga.attribute2_,vga.attribute1_) attribute1_,
-        vgc.name_ category_name_
+        vgc.name_ category_name_,vg.create_time_
         FROM
         vip_group vg
         LEFT JOIN class_group cg ON vg.id_=cg.music_group_id_ AND cg.group_type_ = 'VIP'

+ 12 - 2
mec-student/src/main/java/com/ym/mec/student/controller/StudentVipGroupController.java

@@ -18,10 +18,8 @@ import com.ym.mec.biz.service.VipGroupService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.exception.BizException;
 import com.yonge.log.model.AuditLogAnnotation;
-
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.web.bind.annotation.*;
@@ -80,6 +78,18 @@ public class StudentVipGroupController extends BaseController {
         return succeed(result);
     }
 
+    @ApiOperation(value = "获取可购买vip、网管课列表")
+    @PostMapping(value = "/queryVipPracticeGroups")
+    public Object queryVipPracticeGroups(@RequestBody StudentVipGroupQueryInfo queryInfo){
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (null == sysUser) {
+            return failed(HttpStatus.FORBIDDEN, "请登录");
+        }
+        queryInfo.setOrganId(sysUser.getOrganId());
+        queryInfo.setUserId(sysUser.getId());
+        return succeed(vipGroupService.queryVipPracticeGroups(queryInfo));
+    }
+
     @ApiOperation(value = "获取学生端vip课显示详情")
     @GetMapping(value = "/getVipGroupShowDetail")
     public Object getVipGroupShowDetail(Long vipGroupId){

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

@@ -109,11 +109,15 @@ public class VipGroupActivityController extends BaseController {
     @ApiOperation(value = "删除活动方案")
     @PostMapping("/delete")
     @PreAuthorize("@pcs.hasPermissions('vipGroupActivity/delete')")
-    public Object delete(Long id){
+    public Object delete(Integer id){
         if(Objects.isNull(id)){
             throw new BizException("请指定活动编号!");
         }
-        vipGroupActivityService.delete(id.intValue());
+        VipGroupActivity activity = vipGroupActivityService.get(id);
+        if(activity.getEnable()){
+            throw new BizException("当前状态不允许删除!");
+        }
+        vipGroupActivityService.delete(id);
         return succeed();
     }