Ver Fonte

活动排课,资格管理

zouxuan há 3 anos atrás
pai
commit
3b78291a99

+ 38 - 71
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/ActivityStudentDto.java

@@ -1,5 +1,7 @@
 package com.ym.mec.biz.dal.dto;
 package com.ym.mec.biz.dal.dto;
 
 
+import io.swagger.annotations.ApiModelProperty;
+
 public class ActivityStudentDto{
 public class ActivityStudentDto{
 
 
     private String organName;
     private String organName;
@@ -10,21 +12,49 @@ public class ActivityStudentDto{
 
 
     private String phone;
     private String phone;
 
 
-    private Integer freeVipNum;
+    @ApiModelProperty(value = "总付费课时数")
+    private Integer totalCourseNum;
+
+    @ApiModelProperty(value = "剩余付费课时数")
+    private Integer subCourseNum;
+
+    @ApiModelProperty(value = "总赠送课时数")
+    private Integer totalGiveCourseNum;
 
 
-    private Integer useVipNum;
+    @ApiModelProperty(value = "剩余赠送课时数")
+    private Integer subGiveCourseNum;
 
 
-    private Integer freeGiveVipNum;
+    public Integer getTotalCourseNum() {
+        return totalCourseNum;
+    }
 
 
-    private Integer useGiveVipNum;
+    public void setTotalCourseNum(Integer totalCourseNum) {
+        this.totalCourseNum = totalCourseNum;
+    }
 
 
-    private Integer freePracticeNum;
+    public Integer getSubCourseNum() {
+        return subCourseNum;
+    }
 
 
-    private Integer usePracticeNum;
+    public void setSubCourseNum(Integer subCourseNum) {
+        this.subCourseNum = subCourseNum;
+    }
+
+    public Integer getTotalGiveCourseNum() {
+        return totalGiveCourseNum;
+    }
+
+    public void setTotalGiveCourseNum(Integer totalGiveCourseNum) {
+        this.totalGiveCourseNum = totalGiveCourseNum;
+    }
 
 
-    private Integer freeGivePracticeNum;
+    public Integer getSubGiveCourseNum() {
+        return subGiveCourseNum;
+    }
 
 
-    private Integer useGivePracticeNum;
+    public void setSubGiveCourseNum(Integer subGiveCourseNum) {
+        this.subGiveCourseNum = subGiveCourseNum;
+    }
 
 
     public String getOrganName() {
     public String getOrganName() {
         return organName;
         return organName;
@@ -58,67 +88,4 @@ public class ActivityStudentDto{
         this.phone = phone;
         this.phone = phone;
     }
     }
 
 
-    public Integer getFreeVipNum() {
-        return freeVipNum;
-    }
-
-    public void setFreeVipNum(Integer freeVipNum) {
-        this.freeVipNum = freeVipNum;
-    }
-
-    public Integer getUseVipNum() {
-        return useVipNum;
-    }
-
-    public void setUseVipNum(Integer useVipNum) {
-        this.useVipNum = useVipNum;
-    }
-
-    public Integer getFreeGiveVipNum() {
-        return freeGiveVipNum;
-    }
-
-    public void setFreeGiveVipNum(Integer freeGiveVipNum) {
-        this.freeGiveVipNum = freeGiveVipNum;
-    }
-
-    public Integer getUseGiveVipNum() {
-        return useGiveVipNum;
-    }
-
-    public void setUseGiveVipNum(Integer useGiveVipNum) {
-        this.useGiveVipNum = useGiveVipNum;
-    }
-
-    public Integer getFreePracticeNum() {
-        return freePracticeNum;
-    }
-
-    public void setFreePracticeNum(Integer freePracticeNum) {
-        this.freePracticeNum = freePracticeNum;
-    }
-
-    public Integer getUsePracticeNum() {
-        return usePracticeNum;
-    }
-
-    public void setUsePracticeNum(Integer usePracticeNum) {
-        this.usePracticeNum = usePracticeNum;
-    }
-
-    public Integer getFreeGivePracticeNum() {
-        return freeGivePracticeNum;
-    }
-
-    public void setFreeGivePracticeNum(Integer freeGivePracticeNum) {
-        this.freeGivePracticeNum = freeGivePracticeNum;
-    }
-
-    public Integer getUseGivePracticeNum() {
-        return useGivePracticeNum;
-    }
-
-    public void setUseGivePracticeNum(Integer useGivePracticeNum) {
-        this.useGivePracticeNum = useGivePracticeNum;
-    }
 }
 }

+ 3 - 3
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/ActivityUserDto.java

@@ -17,7 +17,7 @@ public class ActivityUserDto {
     private String subjectName;
     private String subjectName;
 
 
     @ApiModelProperty(value = "剩余可排课次数")
     @ApiModelProperty(value = "剩余可排课次数")
-    private String subCourseNum;
+    private Integer subCourseNum;
 
 
     public String getPhone() {
     public String getPhone() {
         return phone;
         return phone;
@@ -67,11 +67,11 @@ public class ActivityUserDto {
         this.subjectName = subjectName;
         this.subjectName = subjectName;
     }
     }
 
 
-    public String getSubCourseNum() {
+    public Integer getSubCourseNum() {
         return subCourseNum;
         return subCourseNum;
     }
     }
 
 
-    public void setSubCourseNum(String subCourseNum) {
+    public void setSubCourseNum(Integer subCourseNum) {
         this.subCourseNum = subCourseNum;
         this.subCourseNum = subCourseNum;
     }
     }
 }
 }

+ 3 - 3
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/VipGroupStudentDto.java

@@ -12,7 +12,7 @@ import java.util.Date;
 public class VipGroupStudentDto {
 public class VipGroupStudentDto {
 
 
     @ApiModelProperty(value = "用户编号")
     @ApiModelProperty(value = "用户编号")
-    private Long id;
+    private Integer id;
 
 
     @ApiModelProperty(value = "用户名称")
     @ApiModelProperty(value = "用户名称")
     private String userName;
     private String userName;
@@ -116,11 +116,11 @@ public class VipGroupStudentDto {
         this.phone = phone;
         this.phone = phone;
     }
     }
 
 
-    public Long getId() {
+    public Integer getId() {
         return id;
         return id;
     }
     }
 
 
-    public void setId(Long id) {
+    public void setId(Integer id) {
         this.id = id;
         this.id = id;
     }
     }
 
 

+ 13 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/ActivityUserQueryInfo.java

@@ -2,6 +2,8 @@ package com.ym.mec.biz.dal.page;
 
 
 import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiModelProperty;
 
 
+import java.util.List;
+
 /**
 /**
 * @author zx
 * @author zx
 * @date 2021/9/26 15:52
 * @date 2021/9/26 15:52
@@ -24,6 +26,17 @@ public class ActivityUserQueryInfo{
     @ApiModelProperty(value = "用于模糊查询")
     @ApiModelProperty(value = "用于模糊查询")
     private String search;
     private String search;
 
 
+    @ApiModelProperty(value = "学员列表")
+    private List<Integer> studentIds;
+
+    public List<Integer> getStudentIds() {
+        return studentIds;
+    }
+
+    public void setStudentIds(List<Integer> studentIds) {
+        this.studentIds = studentIds;
+    }
+
     public String getSearch() {
     public String getSearch() {
         return search;
         return search;
     }
     }

+ 14 - 5
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

@@ -1665,7 +1665,21 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
             if (!CollectionUtils.isEmpty(vipGroupStudentCoursePrices)) {
             if (!CollectionUtils.isEmpty(vipGroupStudentCoursePrices)) {
                 userPriceMap = vipGroupStudentCoursePrices.stream().collect(Collectors.toMap(VipGroupStudentCoursePrice::getStudentId, v -> v, (v1, v2) -> v1));
                 userPriceMap = vipGroupStudentCoursePrices.stream().collect(Collectors.toMap(VipGroupStudentCoursePrice::getStudentId, v -> v, (v1, v2) -> v1));
             }
             }
+            VipGroup vipGroup = vipGroupDao.get(queryInfo.getVipGroupId());
+            List<Integer> studentIds = dataList.stream().map(e -> e.getId()).collect(Collectors.toList());
+            ActivityUserQueryInfo activityUserQueryInfo = new ActivityUserQueryInfo();
+            activityUserQueryInfo.setCategoryId(vipGroup.getVipGroupCategoryId());
+            activityUserQueryInfo.setOrganIds(queryInfo.getOrganId());
+            activityUserQueryInfo.setSingleCourseTime(vipGroup.getSingleClassMinutes());
+            activityUserQueryInfo.setStudentIds(studentIds);
+            List<ActivityUserDto> activityUserDtos = activityUserMapperService.queryActivityStudentList(activityUserQueryInfo);
+            Map<Integer, Integer> collect = new HashMap<>();
+            if(!CollectionUtils.isEmpty(activityUserDtos)){
+                collect = activityUserDtos.stream().
+                        collect(Collectors.groupingBy(ActivityUserDto::getUserId, Collectors.collectingAndThen(Collectors.toList(), value -> value.get(0).getSubCourseNum())));
+            }
             for (VipGroupStudentDto vipGroupStudentDto : dataList) {
             for (VipGroupStudentDto vipGroupStudentDto : dataList) {
+                vipGroupStudentDto.setTotalClassTimes(collect.get(vipGroupStudentDto.getId()));
                 if (!userPriceMap.containsKey(Integer.valueOf(vipGroupStudentDto.getId().toString()))) {
                 if (!userPriceMap.containsKey(Integer.valueOf(vipGroupStudentDto.getId().toString()))) {
                     continue;
                     continue;
                 }
                 }
@@ -3775,11 +3789,6 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
             }
             }
         }
         }
 
 
-//		VipGroupDefaultClassesUnitPrice vipGroupDefaultClassesUnitPrice = vipGroupDefaultClassesUnitPriceDao.getByVipGroup(vipGroup.getId());
-//		if(Objects.isNull(vipGroupDefaultClassesUnitPrice)){
-//			throw new BizException("课程单价设置错误");
-//		}
-
         if (VipGroupStatusEnum.PAUSE.equals(vipGroup.getStatus())
         if (VipGroupStatusEnum.PAUSE.equals(vipGroup.getStatus())
                 || VipGroupStatusEnum.FINISHED.equals(vipGroup.getStatus())
                 || VipGroupStatusEnum.FINISHED.equals(vipGroup.getStatus())
                 || VipGroupStatusEnum.CANCEL.equals(vipGroup.getStatus())) {
                 || VipGroupStatusEnum.CANCEL.equals(vipGroup.getStatus())) {

+ 14 - 16
mec-biz/src/main/resources/config/mybatis/ActivityUserMapperMapper.xml

@@ -326,25 +326,17 @@
 		<result property="username" column="username_"/>
 		<result property="username" column="username_"/>
 		<result property="organName" column="name_"/>
 		<result property="organName" column="name_"/>
 		<result property="phone" column="phone_"/>
 		<result property="phone" column="phone_"/>
-		<result property="freeVipNum" column="free_vip_num_"/>
-		<result property="useVipNum" column="use_vip_num_"/>
-		<result property="freeGiveVipNum" column="free_give_vip_num_"/>
-		<result property="useGiveVipNum" column="use_give_vip_num_"/>
-		<result property="freePracticeNum" column="free_practice_num_"/>
-		<result property="usePracticeNum" column="use_practice_num_"/>
-		<result property="freeGivePracticeNum" column="free_give_practice_num_"/>
-		<result property="useGivePracticeNum" column="use_give_practice_num_"/>
+		<result property="totalCourseNum" column="total_course_num_"/>
+		<result property="subCourseNum" column="sub_course_num_"/>
+		<result property="totalGiveCourseNum" column="total_give_course_num_"/>
+		<result property="subGiveCourseNum" column="sub_give_course_num_"/>
 	</resultMap>
 	</resultMap>
 	<select id="queryActivityUserMapper" resultMap="ActivityStudentDto">
 	<select id="queryActivityUserMapper" resultMap="ActivityStudentDto">
 		SELECT o.name_,aum.user_id_,su.username_,su.phone_,
 		SELECT o.name_,aum.user_id_,su.username_,su.phone_,
-		COUNT(CASE WHEN aum.vip_flag_ = 1 THEN 1 ELSE NULL END) free_vip_num_,
-		COUNT(CASE WHEN aum.vip_flag_ = 2 THEN 1 ELSE NULL END) use_vip_num_,
-		COUNT(CASE WHEN aum.give_vip_flag_ = 1 THEN 1 ELSE NULL END) free_give_vip_num_,
-		COUNT(CASE WHEN aum.give_vip_flag_ = 2 THEN 1 ELSE NULL END) use_give_vip_num_,
-		COUNT(CASE WHEN aum.practice_flag_ = 1 THEN 1 ELSE NULL END) free_practice_num_,
-		COUNT(CASE WHEN aum.practice_flag_ = 2 THEN 1 ELSE NULL END) use_practice_num_,
-		COUNT(CASE WHEN aum.give_practice_flag_ = 1 THEN 1 ELSE NULL END) free_give_practice_num_,
-		COUNT(CASE WHEN aum.give_practice_flag_ = 2 THEN 1 ELSE NULL END) use_give_practice_num_
+		SUM(aum.total_course_num_) total_course_num_,
+		SUM(aum.sub_course_num_) sub_course_num_,
+		SUM(aum.total_give_course_num_) total_give_course_num_,
+		SUM(aum.sub_give_course_num_) sub_give_course_num_
 		FROM activity_user_mapper aum
 		FROM activity_user_mapper aum
 		LEFT JOIN sys_user su ON su.id_ = aum.user_id_
 		LEFT JOIN sys_user su ON su.id_ = aum.user_id_
 		LEFT JOIN organization o ON o.id_ = su.organ_id_
 		LEFT JOIN organization o ON o.id_ = su.organ_id_
@@ -465,6 +457,12 @@
 			<if test="queryInfo.teacherId != null">
 			<if test="queryInfo.teacherId != null">
 				AND aum.teacher_id_ = #{queryInfo.teacherId}
 				AND aum.teacher_id_ = #{queryInfo.teacherId}
 			</if>
 			</if>
+			<if test="queryInfo.studentIds != null and queryInfo.studentIds.size > 0">
+				AND aum.user_id_ IN
+				<foreach collection="queryInfo.studentIds" item="studentId" open="(" separator="," close=")">
+					#{studentId}
+				</foreach>
+			</if>
 		</where>
 		</where>
 		GROUP BY aum.user_id_
 		GROUP BY aum.user_id_
 		ORDER BY sj.id_ DESC,sub_course_num_ DESC
 		ORDER BY sj.id_ DESC,sub_course_num_ DESC