Browse Source

Merge branch 'dev_1_3_2_20220815' of http://git.dayaedu.com/yonge/cooleshow into dev_1_3_2_20220815

liujunchi 3 years ago
parent
commit
e351945909

+ 6 - 3
cooleshow-auth/auth-server/src/main/java/com/yonge/cooleshow/auth/web/controller/UserController.java

@@ -192,6 +192,9 @@ public class UserController extends BaseController {
                 sysUser.setRealName(username);
                 sysUser.setRealName(username);
             }
             }
             sysUser.setUsername(username);
             sysUser.setUsername(username);
+            if(SysUserType.TEACHER.getCode().equals(authUser.getClientId().toUpperCase())){
+                sysUser.setLastUsernameTime(new Date());
+            }
         }
         }
 		/*if(StringUtils.isEmpty(sysUser.getImToken())){
 		/*if(StringUtils.isEmpty(sysUser.getImToken())){
 			ImResult register = imFeignService.register(new ImUserModel(sysUser.getId().toString(), username, sysUser.getAvatar()));
 			ImResult register = imFeignService.register(new ImUserModel(sysUser.getId().toString(), username, sysUser.getAvatar()));
@@ -570,14 +573,14 @@ public class UserController extends BaseController {
         if (authUser == null) {
         if (authUser == null) {
             return failed(HttpStatus.FORBIDDEN, "请登录");
             return failed(HttpStatus.FORBIDDEN, "请登录");
         }
         }
-        setReq.setClientId(authUser.getClientId());
+        setReq.setClientId(authUser.getClientId().toUpperCase());
 
 
         SysUser user = sysUserService.get(authUser.getUserId());
         SysUser user = sysUserService.get(authUser.getUserId());
         if (user == null || null == user.getId()) {
         if (user == null || null == user.getId()) {
             return failed("用户不存在");
             return failed("用户不存在");
         }
         }
 
 
-        if (SysUserType.TEACHER.getCode().equals(authUser.getClientId())) {
+        if (SysUserType.TEACHER.getCode().equals(authUser.getClientId().toUpperCase())) {
             //判断用户昵称修改时间
             //判断用户昵称修改时间
             if (StringUtils.isNotEmpty(setReq.getUsername())) {
             if (StringUtils.isNotEmpty(setReq.getUsername())) {
                 checkLastUsernameTime(user, setReq.getUsername());
                 checkLastUsernameTime(user, setReq.getUsername());
@@ -596,7 +599,7 @@ public class UserController extends BaseController {
             if (null != user.getLastUsernameTime()
             if (null != user.getLastUsernameTime()
                     && StringUtils.isNotEmpty(configValue)) {
                     && StringUtils.isNotEmpty(configValue)) {
                 Long lastUsernameMonth = Long.parseLong(configValue);
                 Long lastUsernameMonth = Long.parseLong(configValue);
-                Long monthDiff = DateUtil.getMonthDiff(new Date(), user.getLastUsernameTime());
+                Long monthDiff = DateUtil.getMonthDiff(user.getLastUsernameTime(),new Date());
 
 
                 if (monthDiff < lastUsernameMonth && lastUsernameMonth > 0) {
                 if (monthDiff < lastUsernameMonth && lastUsernameMonth > 0) {
                     throw new BizException("每隔" + lastUsernameMonth + "个月可修改一次");
                     throw new BizException("每隔" + lastUsernameMonth + "个月可修改一次");

+ 1 - 1
cooleshow-user/user-admin/src/main/java/com/yonge/cooleshow/admin/controller/ActivityRewardController.java

@@ -117,7 +117,7 @@ public class ActivityRewardController extends BaseController {
     /**
     /**
      * 调整库存
      * 调整库存
      */
      */
-    @GetMapping("/updateStock")
+    @PostMapping("/updateStock")
     @ApiOperation(value = "调整库存")
     @ApiOperation(value = "调整库存")
     @PreAuthorize("@pcs.hasPermissions('activityPlan/updateStock')")
     @PreAuthorize("@pcs.hasPermissions('activityPlan/updateStock')")
     public HttpResponseResult updateStock(@RequestBody ActivityRewardChangeStock activityRewardChangeStock) {
     public HttpResponseResult updateStock(@RequestBody ActivityRewardChangeStock activityRewardChangeStock) {

+ 13 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/search/ActivityPlanSearch.java

@@ -1,12 +1,15 @@
 package com.yonge.cooleshow.biz.dal.dto.search;
 package com.yonge.cooleshow.biz.dal.dto.search;
 
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
 import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
+import com.yonge.cooleshow.common.enums.ActivityTypeEnum;
 import com.yonge.toolset.base.page.QueryInfo;
 import com.yonge.toolset.base.page.QueryInfo;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiModelProperty;
 import org.springframework.format.annotation.DateTimeFormat;
 import org.springframework.format.annotation.DateTimeFormat;
 
 
+import javax.validation.constraints.NotNull;
 import java.time.LocalDateTime;
 import java.time.LocalDateTime;
 import java.time.LocalTime;
 import java.time.LocalTime;
 import java.util.Date;
 import java.util.Date;
@@ -22,6 +25,8 @@ public class ActivityPlanSearch extends QueryInfo{
 	private String activityName;
 	private String activityName;
 	@ApiModelProperty("客户端:STUDENT 学生端 TEACHER 老师端 ")
 	@ApiModelProperty("客户端:STUDENT 学生端 TEACHER 老师端 ")
 	private ClientEnum activityClient;
 	private ClientEnum activityClient;
+	@ApiModelProperty(value = "活动类型 EVALUATION 评测活动 STANDARD_GIFT 达标赠送")
+	private ActivityTypeEnum activityType;
 	@ApiModelProperty("创建状态 0 正式 1 草稿 ")
 	@ApiModelProperty("创建状态 0 正式 1 草稿 ")
 	private Integer draftFlag;
 	private Integer draftFlag;
 	@ApiModelProperty("活动状态 0 停用 1 启用 ")
 	@ApiModelProperty("活动状态 0 停用 1 启用 ")
@@ -51,6 +56,14 @@ public class ActivityPlanSearch extends QueryInfo{
 		this.activityClient = activityClient;
 		this.activityClient = activityClient;
 	}
 	}
 
 
+	public ActivityTypeEnum getActivityType() {
+		return activityType;
+	}
+
+	public void setActivityType(ActivityTypeEnum activityType) {
+		this.activityType = activityType;
+	}
+
 	public Integer getDraftFlag() {
 	public Integer getDraftFlag() {
 		return draftFlag;
 		return draftFlag;
 	}
 	}

+ 3 - 0
cooleshow-user/user-biz/src/main/resources/config/mybatis/ActivityPlanMapper.xml

@@ -88,6 +88,9 @@
 		    <if test="param.activityClient != null">
 		    <if test="param.activityClient != null">
                 and t.activity_client_ = #{param.activityClient}
                 and t.activity_client_ = #{param.activityClient}
             </if>
             </if>
+            <if test="param.activityType != null">
+                and t.activity_type_ = #{param.activityType}
+            </if>
         </where>
         </where>
         order by t.id_ desc
         order by t.id_ desc
 	</select>
 	</select>

+ 59 - 57
cooleshow-user/user-biz/src/main/resources/config/mybatis/StudentMapper.xml

@@ -131,63 +131,65 @@
     <select id="querySubjectItem" resultType="com.yonge.cooleshow.biz.dal.entity.Subject">
     <select id="querySubjectItem" resultType="com.yonge.cooleshow.biz.dal.entity.Subject">
         select t.* from subject t
         select t.* from subject t
         join (
         join (
-        <trim prefixOverrides="union all">
-            <if test="type == null or type =='MUSIC'">
-                union all
-                (
-                    select
-                        a.music_subject_ as subject_id_
-                    from music_sheet a
-                    join music_sheet_purchase_record a1 on a.id_ = a1.music_sheet_id_
-                    where a1.student_id_ = #{userId} and a1.order_status_ = 'PAID'
-                    GROUP BY a.music_subject_
-                )
-            </if>
-            <if test="type == null or type =='VIDEO'">
-                union all
-                (
-                    select
-                        a.lesson_subject_ as subject_id_
-                    from video_lesson_group a
-                    join video_lesson_purchase_record a1 on a.id_ = a1.video_lesson_group_id_
-                    where a1.student_id_ = #{userId}
-                    GROUP BY a.lesson_subject_
-                )
-            </if>
-            <if test="type == null or type =='PINAO_ROOM'">
-                union all
-                (
-                    select
-                        a.subject_id_ as subject_id_
-                    from course_group a
-                    join course_schedule_student_payment a1 on a.id_ = a1.course_group_id_
-                    where a.type_ = 'PIANO_ROOM_CLASS' and a1.user_id_ = #{userId}
-                    GROUP BY a.subject_id_
-                )
-            </if>
-            <if test="type == null or type =='PRACTICE'">
-                union all
-                (
-                    select
-                        a.subject_id_ as subject_id_
-                    from course_group a
-                    join course_schedule_student_payment a1 on a.id_ = a1.course_group_id_
-                    where a.type_ = 'PRACTICE' and a1.user_id_ = #{userId}
-                    GROUP BY a.subject_id_
-                )
-            </if>
-            <if test="type == null or type =='LIVE'">
-                union all
-                (
-                    select
-                        a.subject_id_ as subject_id_
-                    from course_group a
-                    join course_schedule_student_payment a1 on a.id_ = a1.course_group_id_
-                    where a.type_ = 'LIVE' and a1.user_id_ = #{userId}
-                    GROUP BY a.subject_id_
-                )
-            </if>
-        </trim>
+            select a.subject_id_ from (
+                <trim prefixOverrides="union all">
+                    <if test="type == null or type =='MUSIC'">
+                        union all
+                        (
+                            select
+                                a.music_subject_ as subject_id_
+                            from music_sheet a
+                            join music_sheet_purchase_record a1 on a.id_ = a1.music_sheet_id_
+                            where a1.student_id_ = #{userId} and a1.order_status_ = 'PAID'
+                            GROUP BY a.music_subject_
+                        )
+                    </if>
+                    <if test="type == null or type =='VIDEO'">
+                        union all
+                        (
+                            select
+                                a.lesson_subject_ as subject_id_
+                            from video_lesson_group a
+                            join video_lesson_purchase_record a1 on a.id_ = a1.video_lesson_group_id_
+                            where a1.student_id_ = #{userId}
+                            GROUP BY a.lesson_subject_
+                        )
+                    </if>
+                    <if test="type == null or type =='PINAO_ROOM'">
+                        union all
+                        (
+                            select
+                                a.subject_id_ as subject_id_
+                            from course_group a
+                            join course_schedule_student_payment a1 on a.id_ = a1.course_group_id_
+                            where a.type_ = 'PIANO_ROOM_CLASS' and a1.user_id_ = #{userId}
+                            GROUP BY a.subject_id_
+                        )
+                    </if>
+                    <if test="type == null or type =='PRACTICE'">
+                        union all
+                        (
+                            select
+                                a.subject_id_ as subject_id_
+                            from course_group a
+                            join course_schedule_student_payment a1 on a.id_ = a1.course_group_id_
+                            where a.type_ = 'PRACTICE' and a1.user_id_ = #{userId}
+                            GROUP BY a.subject_id_
+                        )
+                    </if>
+                    <if test="type == null or type =='LIVE'">
+                        union all
+                        (
+                            select
+                                a.subject_id_ as subject_id_
+                            from course_group a
+                            join course_schedule_student_payment a1 on a.id_ = a1.course_group_id_
+                            where a.type_ = 'LIVE' and a1.user_id_ = #{userId}
+                            GROUP BY a.subject_id_
+                        )
+                    </if>
+                </trim>
+            ) a group by a.subject_id_
         ) a on t.id_ = a.subject_id_
         ) a on t.id_ = a.subject_id_
         where t.parent_subject_id_ != 0
         where t.parent_subject_id_ != 0
         and not exists(
         and not exists(

+ 25 - 23
cooleshow-user/user-biz/src/main/resources/config/mybatis/SubjectMapper.xml

@@ -31,38 +31,40 @@
     <select id="subjectSelect" resultType="com.yonge.cooleshow.biz.dal.entity.Subject">
     <select id="subjectSelect" resultType="com.yonge.cooleshow.biz.dal.entity.Subject">
         select t.* from subject t
         select t.* from subject t
         join (
         join (
-        <trim prefixOverrides="union all">
-            <if test="type == null or type =='MUSIC'">
-                union all
-                (select a.music_subject_ as subject_id_ from music_sheet a
+            select a.subject_id_ from (
+            <trim prefixOverrides="union all">
+                <if test="type == null or type =='MUSIC'">
+                    union all
+                    (select a.music_subject_ as subject_id_ from music_sheet a
                     where a.del_flag_ = 0 and a.state_ = 1
                     where a.del_flag_ = 0 and a.state_ = 1
                     GROUP BY a.music_subject_)
                     GROUP BY a.music_subject_)
-            </if>
-            <if test="type == null or type =='VIDEO'">
-                union all
-                (select a.lesson_subject_ as subject_id_ from video_lesson_group a
+                </if>
+                <if test="type == null or type =='VIDEO'">
+                    union all
+                    (select a.lesson_subject_ as subject_id_ from video_lesson_group a
                     where a.audit_status_ = 'PASS' and a.shelves_flag_ = 1
                     where a.audit_status_ = 'PASS' and a.shelves_flag_ = 1
                     GROUP BY a.lesson_subject_)
                     GROUP BY a.lesson_subject_)
-            </if>
-            <if test="type == null or type =='PINAO_ROOM'">
-                union all
-                (select a.subject_id_ as subject_id_ from course_group a
+                </if>
+                <if test="type == null or type =='PINAO_ROOM'">
+                    union all
+                    (select a.subject_id_ as subject_id_ from course_group a
                     where a.type_ = 'PIANO_ROOM_CLASS' and a.status_ in ('ING','COMPLETE','APPLY')
                     where a.type_ = 'PIANO_ROOM_CLASS' and a.status_ in ('ING','COMPLETE','APPLY')
                     GROUP BY a.subject_id_)
                     GROUP BY a.subject_id_)
-            </if>
-            <if test="type == null or type =='PRACTICE'">
-                union all
-                (select a.subject_id_ as subject_id_ from course_group a
+                </if>
+                <if test="type == null or type =='PRACTICE'">
+                    union all
+                    (select a.subject_id_ as subject_id_ from course_group a
                     where a.type_ = 'PRACTICE' and a.status_ in ('ING','COMPLETE','APPLY')
                     where a.type_ = 'PRACTICE' and a.status_ in ('ING','COMPLETE','APPLY')
                     GROUP BY a.subject_id_)
                     GROUP BY a.subject_id_)
-            </if>
-            <if test="type == null or type =='LIVE'">
-                union all
-                (select a.subject_id_ as subject_id_ from course_group a
-                    where a.type_ = 'LIVE' and a.status_ in ('ING','COMPLETE','APPLY')
+                </if>
+                <if test="type == null or type =='LIVE'">
+                    union all
+                    (select a.subject_id_ as subject_id_ from course_group a
+                    where a.type_ = 'LIVE' and a.status_ in ('APPLY')
                     GROUP BY a.subject_id_)
                     GROUP BY a.subject_id_)
-            </if>
-        </trim>
+                </if>
+            </trim>
+            ) a group by a.subject_id_
         ) a on t.id_ = a.subject_id_
         ) a on t.id_ = a.subject_id_
         where t.parent_subject_id_ != 0
         where t.parent_subject_id_ != 0
     </select>
     </select>

+ 24 - 22
cooleshow-user/user-biz/src/main/resources/config/mybatis/TeacherMapper.xml

@@ -178,28 +178,30 @@
     <select id="querySubjectItem" resultType="com.yonge.cooleshow.biz.dal.entity.Subject">
     <select id="querySubjectItem" resultType="com.yonge.cooleshow.biz.dal.entity.Subject">
         select t.* from subject t
         select t.* from subject t
         join (
         join (
-            <trim prefixOverrides="union all">
-                <if test="type == null or type =='MUSIC'">
-                    union all
-                    (select music_subject_ as subject_id_ from music_sheet where user_id_ = #{userId} GROUP BY music_subject_)
-                </if>
-                <if test="type == null or type =='VIDEO'">
-                    union all
-                    (select lesson_subject_ as subject_id_ from video_lesson_group where teacher_id_ = #{userId} GROUP BY lesson_subject_)
-                </if>
-                <if test="type == null or type =='PINAO_ROOM'">
-                    union all
-                    (select subject_id_ as subject_id_ from course_group where type_ = 'PIANO_ROOM_CLASS' and teacher_id_ = #{userId} GROUP BY subject_id_)
-                </if>
-                <if test="type == null or type =='PRACTICE'">
-                    union all
-                    (select subject_id_ as subject_id_ from course_group where type_ = 'PRACTICE' and teacher_id_ = #{userId} GROUP BY subject_id_)
-                </if>
-                <if test="type == null or type =='LIVE'">
-                    union all
-                    (select subject_id_ as subject_id_ from course_group where type_ = 'LIVE' and teacher_id_ = #{userId} GROUP BY subject_id_)
-                </if>
-            </trim>
+            select a.subject_id_ from (
+                <trim prefixOverrides="union all">
+                    <if test="type == null or type =='MUSIC'">union all
+                        (select music_subject_ as subject_id_ from music_sheet where user_id_ = #{userId} GROUP BY
+                        music_subject_)
+                    </if>
+                    <if test="type == null or type =='VIDEO'">
+                        union all
+                        (select lesson_subject_ as subject_id_ from video_lesson_group where teacher_id_ = #{userId} GROUP BY lesson_subject_)
+                    </if>
+                    <if test="type == null or type =='PINAO_ROOM'">
+                        union all
+                        (select subject_id_ as subject_id_ from course_group where type_ = 'PIANO_ROOM_CLASS' and teacher_id_ = #{userId} GROUP BY subject_id_)
+                    </if>
+                    <if test="type == null or type =='PRACTICE'">
+                        union all
+                        (select subject_id_ as subject_id_ from course_group where type_ = 'PRACTICE' and teacher_id_ = #{userId} GROUP BY subject_id_)
+                    </if>
+                    <if test="type == null or type =='LIVE'">
+                        union all
+                        (select subject_id_ as subject_id_ from course_group where type_ = 'LIVE' and teacher_id_ = #{userId} GROUP BY subject_id_)
+                    </if>
+                </trim>
+            ) a group by a.subject_id_
         ) a on t.id_ = a.subject_id_
         ) a on t.id_ = a.subject_id_
         where t.parent_subject_id_ != 0
         where t.parent_subject_id_ != 0
         and not exists(
         and not exists(