瀏覽代碼

曲目置顶

liujunchi 3 年之前
父節點
當前提交
4a04d3bfff

+ 8 - 3
cooleshow-mall/mall-portal/src/main/java/com/yonge/cooleshow/portal/controller/PaymentController.java

@@ -176,10 +176,15 @@ public class PaymentController extends BaseController {
                     }
                 }
             }
-            if (MethodNameEnum.refundPayment.equals(data.getMethodName())) {
-                //退款
-                portalOrderReturnApplyService.refundPaymentCallBack(data);
+            try {
+                if (MethodNameEnum.refundPayment.equals(data.getMethodName())) {
+                    //退款
+                    portalOrderReturnApplyService.refundPaymentCallBack(data);
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
             }
+
         }
         return res.getData().getResMsg();
     }

+ 24 - 2
cooleshow-user/user-admin/src/main/java/com/yonge/cooleshow/admin/controller/MusicSheetController.java

@@ -180,11 +180,18 @@ public class MusicSheetController extends BaseController {
     @PostMapping("/state/{id}")
     @ApiOperation(value = "启用/停用", notes = "传入id")
     @PreAuthorize("@pcs.hasPermissions('music/sheet/state')")
-    public HttpResponseResult<Boolean> state(@ApiParam(value = "曲目编号", required = true)  @PathVariable Long id) {
+    public HttpResponseResult<Boolean> state(@ApiParam(value = "曲目编号", required = true)  @PathVariable Long id,@RequestParam String reason) {
         if (StringUtil.isEmpty(id)) {
             return failed("参数不能为空");
         }
-        return status(musicSheetService.state(id));
+        MusicSheet musicSheet = musicSheetService.getById(id);
+        if (musicSheet == null) {
+            return failed("未找到曲目");
+        }
+        if (musicSheet.getSourceType().equals(SourceTypeEnum.TEACHER) && StringUtil.isEmpty(reason)) {
+            return failed("请填写下架原因");
+        }
+        return status(musicSheetService.state(id,reason));
     }
 
     /**
@@ -267,4 +274,19 @@ public class MusicSheetController extends BaseController {
         }
     }
 
+
+    /**
+     * 置顶
+     */
+    @PostMapping("/top/{id}")
+    @ApiOperation(value = "置顶曲目", notes = "传入id")
+    @PreAuthorize("@pcs.hasPermissions('music/sheet/top')")
+    public HttpResponseResult<Boolean> top(@ApiParam(value = "曲目编号", required = true)  @PathVariable Long id) {
+        if (StringUtil.isEmpty(id)) {
+            return failed("参数不能为空");
+        }
+        return status(musicSheetService.top(id));
+    }
+
+
 }

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

@@ -54,6 +54,16 @@ public class MusicSheetSearch  extends QueryInfo{
     @ApiModelProperty(value = "收费类型(FREE:免费;VIP:会员;CHARGE:单曲收费)")
     private ChargeTypeEnum chargeType;  //收费类型(0:免费;1:会员;2:单曲收费)
 
+    @ApiModelProperty(value = "查看我自己的曲目",required = true)
+    private Boolean myself;
+
+    public Boolean getMyself() {
+        return myself;
+    }
+
+    public void setMyself(Boolean myself) {
+        this.myself = myself;
+    }
 
     public ChargeTypeEnum getChargeType() {
         return chargeType;

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

@@ -36,8 +36,6 @@ public class StudentMusicSheetSearch  extends MusicSheetSearch{
     private String platform;
 
 
-    @ApiModelProperty(value = "查看我自己的曲目",required = true)
-    private Boolean myself = true;
 
     public ClientEnum getUserType() {
         return userType;
@@ -47,13 +45,7 @@ public class StudentMusicSheetSearch  extends MusicSheetSearch{
         this.userType = userType;
     }
 
-    public Boolean getMyself() {
-        return myself;
-    }
 
-    public void setMyself(Boolean myself) {
-        this.myself = myself;
-    }
 
     public YesOrNoEnum getAuditVersion() {
         return auditVersion;

+ 5 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/enums/MessageTypeEnum.java

@@ -90,7 +90,11 @@ public enum MessageTypeEnum implements BaseEnum<String, MessageTypeEnum> {
     SMS_BUY_LIVE("直播课购买成功"),
     SMS_LIVE_COMPLETION_SUCCESS("直播课成课"),
     SMS_LIVE_COMPLETION_FAIL("直播课成课失败"),
-    SMS_TOMORROW_COURSE_REMINDER("明日课程提醒(每晚9点)(短信)");
+    SMS_TOMORROW_COURSE_REMINDER("明日课程提醒(每晚9点)(短信)"),
+
+    MUSIC_SHEET_STOP_SHELVES_REASON("老师曲目下架通知"),
+
+    ;
 
     MessageTypeEnum(String msg) {
         this.code = this.name();

+ 10 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/MusicSheetService.java

@@ -39,9 +39,10 @@ public interface MusicSheetService extends IService<MusicSheet> {
      * 曲目状态修改 启用、停用
      *
      * @param id 曲目id
+     * @param reason
      * @return boolean
      */
-    boolean state(Long id);
+    boolean state(Long id, String reason);
 
     /**
      * 获取专辑详情曲目信息
@@ -274,4 +275,12 @@ public interface MusicSheetService extends IService<MusicSheet> {
      * @param musicSheetId 曲目id
      */
     ShareProfitVo shareMusicSheetProfit(SysUser sysUser, Long musicSheetId);
+
+    /**
+     * 置顶曲目
+     *
+     * @param musicSheetId 曲目id
+     * @return
+     */
+    Boolean top(Long musicSheetId);
 }

+ 27 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/MusicSheetServiceImpl.java

@@ -137,7 +137,7 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public boolean state(Long id) {
+    public boolean state(Long id, String reason) {
         MusicSheet musicSheet = this.getById(id);
         if (musicSheet == null) {
             throw new BizException("未找到曲目信息");
@@ -146,6 +146,13 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
             musicSheet.setState(YesOrNoEnum.YES);
         } else {
             musicSheet.setState(YesOrNoEnum.NO);
+            musicSheet.setTopFlag(YesOrNoEnum.NO);
+
+            // 下架发送推送
+            if(musicSheet.getSourceType().equals(SourceTypeEnum.TEACHER)) {
+
+            }
+
         }
         return this.updateById(musicSheet);
 
@@ -879,6 +886,25 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
         return result;
     }
 
+    @Override
+    public Boolean top(Long musicSheetId) {
+        MusicSheet musicSheet = getById(musicSheetId);
+
+        if (YesOrNoEnum.YES.equals(musicSheet.getTopFlag())) {
+            musicSheet.setTopFlag(YesOrNoEnum.NO);
+            return this.saveOrUpdate(musicSheet);
+        }
+        Integer count = this.lambdaQuery()
+                            .eq(MusicSheet::getDelFlag, YesOrNoEnum.NO)
+                            .eq(MusicSheet::getTopFlag, YesOrNoEnum.YES)
+                            .count();
+        if (count >=10) {
+            throw new BizException("首页推荐数量达到上限,请先取消其他曲谱推荐");
+        }
+        musicSheet.setTopFlag(YesOrNoEnum.YES);
+        return this.saveOrUpdate(musicSheet);
+    }
+
     private SysUser getSysUser(Long userId) {
         return Optional.ofNullable(userId)
                 .map(sysUserFeignService::queryUserById)

+ 6 - 2
cooleshow-user/user-biz/src/main/resources/config/mybatis/MusicSheetMapper.xml

@@ -79,7 +79,11 @@
             su.del_flag_ = 0
             <include refid="QueryInfo"/>
         </where>
-        order by  t.id_ desc
+        order by
+        <if test="param.myself == null or param.myself == false ">
+            t.top_flag_ desc,t.sort_number_ desc,
+        </if>
+         t.id_ desc
     </select>
 
     <sql id="QueryInfo">
@@ -155,7 +159,7 @@
             <if test="param.id != null">
                 <if test="param.type == 2">
                     and amr.album_id_ = #{param.id}
-                    order by amr.create_time_ desc
+                    order by amr.sort_number_ desc, t.id_ desc
                 </if>
                 <if test="param.type == 1">
                     and t.id_ not in(select amr2.music_sheet_id_  from album_music_relate amr2

+ 2 - 0
cooleshow-user/user-teacher/src/main/java/com/yonge/cooleshow/teacher/controller/MusicSheetController.java

@@ -131,6 +131,7 @@ public class MusicSheetController extends BaseController {
                 query.setState(YesOrNoEnum.YES);
             }
             query.setSourceType(SourceTypeEnum.TEACHER);
+            query.setMyself(true);
         } else {
             // 检查app版本
             query.setAuditVersion(appVersionInfoService.getAppAuditVersion(query.getPlatform(),query.getVersion()));
@@ -139,6 +140,7 @@ public class MusicSheetController extends BaseController {
             query.setState(YesOrNoEnum.YES);
             query.setAuditStatus(AuthStatusEnum.PASS);
             query.setStudentId(sysUser.getId());
+            query.setMyself(false);
         }
 
         IPage<MusicSheetVo> musicSheetVoIPage = musicSheetService.selectPage(PageUtil.getPage(query), query);