Procházet zdrojové kódy

Merge branch 'dev_1_2_20220802'

liujunchi před 3 roky
rodič
revize
845b9a217d
21 změnil soubory, kde provedl 251 přidání a 60 odebrání
  1. 29 3
      cooleshow-user/user-admin/src/main/java/com/yonge/cooleshow/admin/controller/ActivityEvaluationController.java
  2. 0 2
      cooleshow-user/user-admin/src/main/java/com/yonge/cooleshow/admin/controller/CourseGroupController.java
  3. 4 3
      cooleshow-user/user-admin/src/main/java/com/yonge/cooleshow/admin/controller/MusicSheetController.java
  4. 7 1
      cooleshow-user/user-admin/src/main/java/com/yonge/cooleshow/admin/controller/VideoLessonController.java
  5. 10 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/ActivityEvaluationDao.java
  6. 25 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/ReasonDto.java
  7. 15 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/search/ActivityEvaluationSearch.java
  8. 11 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/search/CourseGroupSearch.java
  9. 11 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/search/MusicSheetSearch.java
  10. 1 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/enums/AccountBizTypeEnum.java
  11. 1 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/enums/MessageTypeEnum.java
  12. 10 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/ActivityEvaluationService.java
  13. 15 11
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/ActivityEvaluationServiceImpl.java
  14. 58 24
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/ActivityPlanServiceImpl.java
  15. 13 8
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/MusicSheetServiceImpl.java
  16. 5 2
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/UserOrderServiceImpl.java
  17. 1 2
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/VideoLessonShelvesVo.java
  18. 29 1
      cooleshow-user/user-biz/src/main/resources/config/mybatis/ActivityEvaluationMapper.xml
  19. 3 0
      cooleshow-user/user-biz/src/main/resources/config/mybatis/CourseGroupMapper.xml
  20. 1 1
      cooleshow-user/user-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml
  21. 2 2
      cooleshow-user/user-biz/src/main/resources/config/mybatis/UserOrderMapper.xml

+ 29 - 3
cooleshow-user/user-admin/src/main/java/com/yonge/cooleshow/admin/controller/ActivityEvaluationController.java

@@ -1,22 +1,26 @@
 package com.yonge.cooleshow.admin.controller;
 
 import com.yonge.cooleshow.biz.dal.dto.ActivityEvaluationDto;
+import com.yonge.cooleshow.biz.dal.dto.search.MusicSheetSearch;
+import com.yonge.cooleshow.biz.dal.enums.AuthStatusEnum;
+import com.yonge.cooleshow.biz.dal.vo.MusicSheetVo;
 import com.yonge.cooleshow.common.controller.BaseController;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.yonge.cooleshow.common.enums.YesOrNoEnum;
 import com.yonge.toolset.base.page.PageInfo;
 import com.yonge.toolset.mybatis.support.PageUtil;
 
 import com.yonge.toolset.base.util.StringUtil;
 import io.swagger.annotations.*;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
 import javax.validation.Valid;
 
 import com.yonge.cooleshow.biz.dal.vo.ActivityEvaluationVo;
 import com.yonge.cooleshow.biz.dal.dto.search.ActivityEvaluationSearch;
-import com.yonge.cooleshow.biz.dal.entity.ActivityEvaluation;
 import com.yonge.cooleshow.biz.dal.service.ActivityEvaluationService;
 
 @RestController
@@ -32,7 +36,8 @@ public class ActivityEvaluationController extends BaseController {
      */
     @PostMapping("/page")
     @ApiOperation(value = "查询分页", notes = "传入activityEvaluationSearch")
-    public HttpResponseResult<PageInfo<ActivityEvaluationVo>> page(@RequestBody ActivityEvaluationSearch query) {
+	@PreAuthorize("@pcs.hasPermissions('activityEvaluation/page')")
+	public HttpResponseResult<PageInfo<ActivityEvaluationVo>> page(@RequestBody ActivityEvaluationSearch query) {
 		IPage<ActivityEvaluationVo> pages = activityEvaluationService.selectPage(PageUtil.getPage(query), query);
         return succeed(PageUtil.pageInfo(pages));
 	}
@@ -42,6 +47,7 @@ public class ActivityEvaluationController extends BaseController {
 	 */
 	@PostMapping("/addBatch")
 	@ApiOperation(value = "批量增加曲目")
+	@PreAuthorize("@pcs.hasPermissions('activityEvaluation/addBatch')")
 	public HttpResponseResult addBatch(@Valid @RequestBody ActivityEvaluationDto param) {
     	return status(activityEvaluationService.addBatch(param));
 	}
@@ -51,10 +57,30 @@ public class ActivityEvaluationController extends BaseController {
 	 */
 	@PostMapping("/remove")
 	@ApiOperation(value = "删除", notes = "传入ids")
-	public HttpResponseResult remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+	@PreAuthorize("@pcs.hasPermissions('activityEvaluation/remove')")
+	public HttpResponseResult remove(
+			@ApiParam(value = "主键集合", required = true)
+			@RequestParam(value = "ids") String ids) {
         if (StringUtil.isEmpty(ids)) {
 			return failed("参数不能为空");
 		}
 		return status(activityEvaluationService.removeByIds(StringUtil.toLongList(ids)));
 	}
+
+
+	@ApiOperation(value = "分页查询曲目", httpMethod="POST", consumes="application/json", produces="application/json")
+	@PostMapping(value="/musicPage", consumes="application/json", produces="application/json")
+	@PreAuthorize("@pcs.hasPermissions('activityEvaluation/musicPage')")
+	public HttpResponseResult<PageInfo<MusicSheetVo>> musicPage(@RequestBody MusicSheetSearch query) {
+		if(null == query.getActivityId()){
+			return failed("活动id不能为空");
+		}
+		query.setAuditStatus(AuthStatusEnum.PASS);
+		query.setState(YesOrNoEnum.YES);
+
+		IPage<MusicSheetVo> musicSheetVoIPage = activityEvaluationService.musicPage(PageUtil.getPage(query), query);
+		return succeed(PageUtil.pageInfo(musicSheetVoIPage));
+	}
+
+
 }

+ 0 - 2
cooleshow-user/user-admin/src/main/java/com/yonge/cooleshow/admin/controller/CourseGroupController.java

@@ -32,8 +32,6 @@ public class CourseGroupController extends BaseController {
     @Autowired
     private CourseGroupService courseGroupService;
     @Autowired
-    private SysUserFeignService sysUserFeignService;
-    @Autowired
     private CourseScheduleService courseScheduleService;
 
     @ApiOperation(value = "课程组管理-陪练课", notes = "{\n" +

+ 4 - 3
cooleshow-user/user-admin/src/main/java/com/yonge/cooleshow/admin/controller/MusicSheetController.java

@@ -5,6 +5,7 @@ import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
 import com.yonge.cooleshow.auth.api.entity.SysUser;
 import com.yonge.cooleshow.biz.dal.dto.MusicSheetDto;
 import com.yonge.cooleshow.biz.dal.dto.MusicSheetExport;
+import com.yonge.cooleshow.biz.dal.dto.ReasonDto;
 import com.yonge.cooleshow.biz.dal.dto.req.TeacherMusicSheetAuditReq;
 import com.yonge.cooleshow.biz.dal.dto.search.MusicSheetSearch;
 import com.yonge.cooleshow.biz.dal.dto.search.StudentMusicSheetOrderSearch;
@@ -180,7 +181,7 @@ 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, String reason) {
+    public HttpResponseResult<Boolean> state(@ApiParam(value = "曲目编号", required = true)  @PathVariable Long id, @RequestBody ReasonDto reasonDto) {
         if (StringUtil.isEmpty(id)) {
             return failed("参数不能为空");
         }
@@ -189,10 +190,10 @@ public class MusicSheetController extends BaseController {
             return failed("未找到曲目");
         }
         if (YesOrNoEnum.YES.equals(musicSheet.getState()) &&
-                musicSheet.getSourceType().equals(SourceTypeEnum.TEACHER) && StringUtil.isEmpty(reason)) {
+                musicSheet.getSourceType().equals(SourceTypeEnum.TEACHER) && StringUtil.isEmpty(reasonDto.getReason())) {
             return failed("请填写下架原因");
         }
-        return status(musicSheetService.state(id,reason));
+        return status(musicSheetService.state(id,reasonDto.getReason()));
     }
 
     /**

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

@@ -9,6 +9,7 @@ import com.yonge.cooleshow.biz.dal.entity.VideoLessonGroup;
 import com.yonge.cooleshow.biz.dal.entity.VideoLessonGroupDetail;
 import com.yonge.cooleshow.biz.dal.service.VideoLessonGroupDetailService;
 import com.yonge.cooleshow.biz.dal.service.VideoLessonGroupService;
+import com.yonge.toolset.base.util.StringUtil;
 import com.yonge.toolset.mybatis.support.PageUtil;
 import com.yonge.cooleshow.biz.dal.valid.AddGroup;
 import com.yonge.cooleshow.biz.dal.valid.SelectGroup;
@@ -23,6 +24,7 @@ import org.springframework.http.HttpStatus;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
+import javax.annotation.Resource;
 import javax.validation.constraints.NotNull;
 import java.util.Date;
 import java.util.List;
@@ -36,7 +38,7 @@ import java.util.List;
 @Api(tags = "视频课")
 @Validated
 public class VideoLessonController extends BaseController {
-    @Autowired
+    @Resource
     private SysUserFeignService sysUserFeignService;
     @Autowired
     private VideoLessonGroupService lessonGroupService;
@@ -147,6 +149,10 @@ public class VideoLessonController extends BaseController {
         if (user == null || null == user.getId()) {
             return failed(HttpStatus.FORBIDDEN, "请登录");
         }
+        if (shelvesVo.getShelvesFlag() == 0 && StringUtil.isEmpty(shelvesVo.getShelvesReason())) {
+            return failed( "下架必须要有下架原因");
+        }
+
         shelvesVo.setShelvesId(user.getId());
         shelvesVo.setShelvesTime(new Date());
         lessonGroupService.updateShelves(shelvesVo);

+ 10 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/ActivityEvaluationDao.java

@@ -4,7 +4,9 @@ import java.util.List;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.yonge.cooleshow.biz.dal.dto.search.MusicSheetSearch;
 import com.yonge.cooleshow.biz.dal.vo.ActivityMusicVo;
+import com.yonge.cooleshow.biz.dal.vo.MusicSheetVo;
 import org.apache.ibatis.annotations.Param;
 import com.yonge.cooleshow.biz.dal.entity.ActivityEvaluation;
 import com.yonge.cooleshow.biz.dal.vo.ActivityEvaluationVo;
@@ -56,4 +58,12 @@ public interface ActivityEvaluationDao extends BaseMapper<ActivityEvaluation> {
 	 * @return
 	 */
 	List<ActivityMusicVo> selectActivityUser(@Param("activityPlanId") Long activityPlanId);
+
+	/**
+	 * 查询曲子
+	 * @param page
+	 * @param query
+	 * @return
+	 */
+	List<MusicSheetVo> musicPage(@Param("page") IPage<MusicSheetVo> page, @Param("param") MusicSheetSearch query);
 }

+ 25 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/ReasonDto.java

@@ -0,0 +1,25 @@
+package com.yonge.cooleshow.biz.dal.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * Description
+ *
+ * @author liujunchi
+ * @date 2022-08-08
+ */
+@ApiModel("曲目下架原因")
+public class ReasonDto {
+
+    @ApiModelProperty("曲目下架原因")
+    private String  reason;
+
+    public String getReason() {
+        return reason;
+    }
+
+    public void setReason(String reason) {
+        this.reason = reason;
+    }
+}

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

@@ -2,6 +2,10 @@ package com.yonge.cooleshow.biz.dal.dto.search;
 
 import com.yonge.toolset.base.page.QueryInfo;
 import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
 
 /**
  * @Author: liweifan
@@ -11,4 +15,15 @@ import io.swagger.annotations.ApiModel;
 public class ActivityEvaluationSearch extends QueryInfo{
 	private static final long serialVersionUID = 1L;
 
+	@ApiModelProperty(value = "活动id",required = true)
+	@NotNull(message = "活动id不能为空")
+	private Long activityId;
+
+	public Long getActivityId() {
+		return activityId;
+	}
+
+	public void setActivityId(Long activityId) {
+		this.activityId = activityId;
+	}
 }

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

@@ -51,6 +51,9 @@ public class CourseGroupSearch extends QueryInfo {
     @ApiModelProperty(value = "老师id")
     private Long teacherId;
 
+    @ApiModelProperty(value = "是否上架 (0:否  1:是)")
+    private Integer shelvesFlag;
+
     public Long getStudentId() {
         return studentId;
     }
@@ -140,4 +143,12 @@ public class CourseGroupSearch extends QueryInfo {
     public void setStatus(String status) {
         this.status = status;
     }
+
+    public Integer getShelvesFlag() {
+        return shelvesFlag;
+    }
+
+    public void setShelvesFlag(Integer shelvesFlag) {
+        this.shelvesFlag = shelvesFlag;
+    }
 }

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

@@ -48,6 +48,9 @@ public class MusicSheetSearch  extends QueryInfo{
     @ApiModelProperty(value = "创建人id (老师id)")
     private Long createBy;
 
+    @ApiModelProperty("活动id(活动添加曲目列表必传)")
+    private Long activityId;
+
     @ApiModelProperty(value = "假删除 false : 未删除 true:已删除",hidden = true)
     private Boolean delFlag = false;
 
@@ -158,4 +161,12 @@ public class MusicSheetSearch  extends QueryInfo{
     public void setSourceType(SourceTypeEnum sourceType) {
         this.sourceType = sourceType;
     }
+
+    public Long getActivityId() {
+        return activityId;
+    }
+
+    public void setActivityId(Long activityId) {
+        this.activityId = activityId;
+    }
 }

+ 1 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/enums/AccountBizTypeEnum.java

@@ -45,4 +45,5 @@ public enum AccountBizTypeEnum implements BaseEnum<String, AccountBizTypeEnum> {
     public String getMsg() {
         return this.msg;
     }
+
 }

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

@@ -95,6 +95,7 @@ public enum MessageTypeEnum implements BaseEnum<String, MessageTypeEnum> {
     MUSIC_SHEET_OUT_SALE_REASON("老师曲目下架通知"),
     LIVE_COURSE_OUT_SALE_REASON("老师直播课下架通知"),
     VIDEO_COURSE_OUT_SALE_REASON("老师视频课下架通知"),
+    ACTIVITY_JOIN_MESSAGE("活动参与通知"),
 
     ;
 

+ 10 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/ActivityEvaluationService.java

@@ -3,10 +3,12 @@ package com.yonge.cooleshow.biz.dal.service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.yonge.cooleshow.biz.dal.dto.ActivityEvaluationDto;
+import com.yonge.cooleshow.biz.dal.dto.search.MusicSheetSearch;
 import com.yonge.cooleshow.biz.dal.vo.ActivityEvaluationVo;
 import com.yonge.cooleshow.biz.dal.dto.search.ActivityEvaluationSearch;
 import com.yonge.cooleshow.biz.dal.entity.ActivityEvaluation;
 import com.yonge.cooleshow.biz.dal.vo.ActivityMusicVo;
+import com.yonge.cooleshow.biz.dal.vo.MusicSheetVo;
 
 import java.util.List;
 
@@ -46,4 +48,12 @@ public interface ActivityEvaluationService extends IService<ActivityEvaluation>
 	 * @return
 	 */
     List<ActivityMusicVo> getActivityMusic(Long activityPlanId, Long userId);
+
+	/**
+	 * 查询曲目分页
+	 * @param page
+	 * @param query
+	 * @return
+	 */
+	IPage<MusicSheetVo> musicPage(IPage<MusicSheetVo> page, MusicSheetSearch query);
 }

+ 15 - 11
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/ActivityEvaluationServiceImpl.java

@@ -3,8 +3,10 @@ package com.yonge.cooleshow.biz.dal.service.impl;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.yonge.cooleshow.biz.dal.dto.ActivityEvaluationDto;
+import com.yonge.cooleshow.biz.dal.dto.search.MusicSheetSearch;
 import com.yonge.cooleshow.biz.dal.support.WrapperUtil;
 import com.yonge.cooleshow.biz.dal.vo.ActivityMusicVo;
+import com.yonge.cooleshow.biz.dal.vo.MusicSheetVo;
 import org.apache.commons.collections.CollectionUtils;
 import org.springframework.stereotype.Service;
 import org.slf4j.Logger;
@@ -17,7 +19,6 @@ import com.yonge.cooleshow.biz.dal.service.ActivityEvaluationService;
 
 import java.util.List;
 
-import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
 
@@ -26,13 +27,13 @@ import java.util.stream.Collectors;
 public class ActivityEvaluationServiceImpl extends ServiceImpl<ActivityEvaluationDao, ActivityEvaluation> implements ActivityEvaluationService {
     private final static Logger log = LoggerFactory.getLogger(ActivityEvaluationServiceImpl.class);
 
-	@Override
+    @Override
     public ActivityEvaluationVo detail(Long id) {
         return baseMapper.detail(id);
     }
-    
+
     @Override
-    public IPage<ActivityEvaluationVo> selectPage(IPage<ActivityEvaluationVo> page, ActivityEvaluationSearch query){
+    public IPage<ActivityEvaluationVo> selectPage(IPage<ActivityEvaluationVo> page, ActivityEvaluationSearch query) {
         return page.setRecords(baseMapper.selectPage(page, query));
     }
 
@@ -40,20 +41,18 @@ public class ActivityEvaluationServiceImpl extends ServiceImpl<ActivityEvaluatio
     public Boolean addBatch(ActivityEvaluationDto param) {
         List<Long> musicSheetIds = WrapperUtil.toLongList(param.getMusicSheetIds());
         //过滤出未添加的曲子
-        musicSheetIds = baseMapper.selectUnjoinMusicIds(param.getActivityId(),musicSheetIds);
-
-        Integer num = baseMapper.addBatch(param.getActivityId(),musicSheetIds);
-        return null;
+        musicSheetIds = baseMapper.selectUnjoinMusicIds(param.getActivityId(), musicSheetIds);
+        return baseMapper.addBatch(param.getActivityId(), musicSheetIds) > 0;
     }
 
 
     @Override
     public List<ActivityMusicVo> getActivityMusic(Long activityPlanId, Long userId) {
-        List<ActivityMusicVo> result = baseMapper.selectActivityMusic(activityPlanId,userId);
+        List<ActivityMusicVo> result = baseMapper.selectActivityMusic(activityPlanId, userId);
         List<ActivityMusicVo> activityMusicVoList = baseMapper.selectActivityUser(activityPlanId);
         Map<Long, List<ActivityMusicVo>> collect = activityMusicVoList.stream()
-                                                                      .collect(Collectors.groupingBy(
-                                                                              ActivityMusicVo::getEvaluationId));
+                .collect(Collectors.groupingBy(
+                        ActivityMusicVo::getEvaluationId));
         for (ActivityMusicVo activityMusicVo : result) {
             List<ActivityMusicVo> activityUserList = collect.get(activityMusicVo.getEvaluationId());
             if (!CollectionUtils.isEmpty(activityUserList)) {
@@ -66,4 +65,9 @@ public class ActivityEvaluationServiceImpl extends ServiceImpl<ActivityEvaluatio
         return result;
     }
 
+    @Override
+    public IPage<MusicSheetVo> musicPage(IPage<MusicSheetVo> page, MusicSheetSearch query) {
+        return page.setRecords(baseMapper.musicPage(page, query));
+    }
+
 }

+ 58 - 24
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/ActivityPlanServiceImpl.java

@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.yonge.cooleshow.auth.api.entity.SysUser;
 import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
-import com.yonge.cooleshow.auth.api.entity.SysUser;
 import com.yonge.cooleshow.biz.dal.dao.ActivityPlanDao;
 import com.yonge.cooleshow.biz.dal.dao.ActivityPlanEvaluationDao;
 import com.yonge.cooleshow.biz.dal.dto.ActivityPlanDto;
@@ -14,6 +13,9 @@ import com.yonge.cooleshow.biz.dal.dto.ActivityPlanPayDto;
 import com.yonge.cooleshow.biz.dal.dto.req.OrderReq;
 import com.yonge.cooleshow.biz.dal.dto.search.ActivityPlanSearch;
 import com.yonge.cooleshow.biz.dal.entity.*;
+import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
+import com.yonge.cooleshow.biz.dal.enums.MessageTypeEnum;
+import com.yonge.cooleshow.biz.dal.enums.SourceTypeEnum;
 import com.yonge.cooleshow.biz.dal.service.*;
 import com.yonge.cooleshow.biz.dal.vo.ActivityMusicVo;
 import com.yonge.cooleshow.biz.dal.vo.ActivityPlanVo;
@@ -24,24 +26,23 @@ import com.yonge.cooleshow.common.entity.HttpResponseResult;
 import com.yonge.cooleshow.common.enums.ActivityTypeEnum;
 import com.yonge.cooleshow.common.enums.RegistrationMethodEnum;
 import com.yonge.toolset.base.exception.BizException;
+import com.yonge.toolset.base.util.StringUtil;
+import com.yonge.toolset.thirdparty.message.MessageSenderPluginContext;
 import org.springframework.stereotype.Service;
 import org.apache.commons.collections.CollectionUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import com.yonge.cooleshow.biz.dal.entity.ActivityPlan;
-import com.yonge.cooleshow.biz.dal.vo.ActivityPlanVo;
-import com.yonge.cooleshow.biz.dal.dto.search.ActivityPlanSearch;
-import com.yonge.cooleshow.biz.dal.dao.ActivityPlanDao;
 import com.yonge.cooleshow.biz.dal.service.ActivityPlanService;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.math.BigDecimal;
+import java.util.*;
 import java.util.Date;
-import java.util.Date;
+
 import java.util.List;
 import java.util.Optional;
 
@@ -67,6 +68,9 @@ public class ActivityPlanServiceImpl extends ServiceImpl<ActivityPlanDao, Activi
     @Autowired
     private ActivityEvaluationRecordService activityEvaluationRecordService;
 
+    @Autowired
+    private SysMessageService sysMessageService;
+
 	@Override
     public ActivityPlanVo detail(Long id) {
         ActivityPlanVo detail = baseMapper.detail(id);
@@ -114,7 +118,7 @@ public class ActivityPlanServiceImpl extends ServiceImpl<ActivityPlanDao, Activi
                     return true;
                 }
                 return false;
-            }else{
+            } else {
                 activityPlan.setUpdateBy(user.getId());
                 updateById(activityPlan);
 
@@ -128,11 +132,25 @@ public class ActivityPlanServiceImpl extends ServiceImpl<ActivityPlanDao, Activi
 
     @Override
     public Boolean updateActivityState(Long activityId, Integer activityState, Long id) {
+        ActivityPlanVo detail = detail(activityId);
+
         ActivityPlan activityPlan = new ActivityPlan();
+
+        if (activityState == 1) {
+            Date now = new Date();
+            if (detail.getActivityEnd().before(now)) {
+                return false;
+            }
+            if(detail.getActivityStart().after(now)){
+                activityPlan.setActivityStart(now);
+            }
+        }
+
         activityPlan.setId(activityId);
         activityPlan.setActivityState(activityState);
         activityPlan.setUpdateBy(id);
         activityPlan.setUpdateTime(new Date());
+
         baseMapper.updateById(activityPlan);
         return true;
     }
@@ -152,21 +170,19 @@ public class ActivityPlanServiceImpl extends ServiceImpl<ActivityPlanDao, Activi
     }
 
 
-
-
     @Override
     public MusicActivityVo getActivityInfo(Long activityPlanId, SysUser user) {
         ActivityPlan activityPlan = this.getById(activityPlanId);
 
         MusicActivityVo activityVo = new MusicActivityVo();
-        BeanUtils.copyProperties(activityPlan,activityVo);
+        BeanUtils.copyProperties(activityPlan, activityVo);
 
         // 活动曲目
-        List<ActivityMusicVo> activityMusicVoList = activityEvaluationService.getActivityMusic(activityPlanId,user.getId());
+        List<ActivityMusicVo> activityMusicVoList = activityEvaluationService.getActivityMusic(activityPlanId, user.getId());
         activityVo.setActivityMusicVoList(activityMusicVoList);
 
         // 报名状态
-        activityVo.setJoin(activityRegistrationService.getRegistration(user.getId(),activityPlanId));
+        activityVo.setJoin(activityRegistrationService.getRegistration(user.getId(), activityPlanId));
 
         // 活动奖品
         List<ActivityReward> activityRewardList = activityRewardService.getActivityReward(activityPlanId);
@@ -182,12 +198,14 @@ public class ActivityPlanServiceImpl extends ServiceImpl<ActivityPlanDao, Activi
     @Override
     public HttpResponseResult<OrderCreateRes> orderCreate(OrderReq.OrderReqInfo orderReqInfo) {
 
+        log.info("活动购买 参数 --> {}",orderReqInfo);
+
+        // 检查用户
         getSysUser(orderReqInfo.getUserId());
         ActivityPlanPayDto activityPlanPayDto = JSON.parseObject(
                 JSON.toJSONString(orderReqInfo.getBizContent()), ActivityPlanPayDto.class);
 
-        // 检查活动购买
-
+        // 检查活动购买是否已购买
         checkActivityPay(activityPlanPayDto.getActivityId());
 
 
@@ -200,7 +218,7 @@ public class ActivityPlanServiceImpl extends ServiceImpl<ActivityPlanDao, Activi
         if (activityPlanPayDto.getActivityId() == null) {
             throw new BizException("活动id不能为空");
         }
-        ActivityPlan activityPlan = getById(activityPlanPayDto.getActivityId() );
+        ActivityPlan activityPlan = getById(activityPlanPayDto.getActivityId());
 
         orderCreateRes.setRes(true);
         orderCreateRes.setGoodType(orderCreateRes.getGoodType());
@@ -213,9 +231,9 @@ public class ActivityPlanServiceImpl extends ServiceImpl<ActivityPlanDao, Activi
 
     private boolean checkoutJoinActivity(Long activityId, Long userId) {
         return activityRegistrationService.lambdaQuery()
-                                                   .eq(ActivityRegistration::getActivityId, activityId)
-                                                   .eq(ActivityRegistration::getUserId, userId)
-                                                   .count() >0;
+                .eq(ActivityRegistration::getActivityId, activityId)
+                .eq(ActivityRegistration::getUserId, userId)
+                .count() > 0;
     }
 
     @Override
@@ -286,9 +304,25 @@ public class ActivityPlanServiceImpl extends ServiceImpl<ActivityPlanDao, Activi
         return true;
     }
 
+
+    /**
+     * 参与活动消息
+     */
     private void sendMessage(String activityName, Long userId) {
+        try {
+            //  发送消息
+            SysUser user = sysUserFeignService.queryUserById(userId);
+
+            Map<Long, String> receivers = new HashMap<>();
+            receivers.put(userId, user.getPhone());
+
+            sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.ACTIVITY_JOIN_MESSAGE, receivers, null,
+                                               0, null, ClientEnum.STUDENT.getCode(), user.getUsername(), activityName);
+
+        } catch (Exception e) {
+            log.error("活动参与发送消息失败--> {}",e.fillInStackTrace());
+        }
 
-        // TODO  发送消息
 
     }
 
@@ -301,17 +335,17 @@ public class ActivityPlanServiceImpl extends ServiceImpl<ActivityPlanDao, Activi
         if (activityPlan.getActivityState() == 0) {
             throw new BizException("活动已停止");
         }
-        if (new Date().compareTo(activityPlan.getActivityStart()) <0) {
-            throw  new BizException("活动未开始");
+        if (new Date().compareTo(activityPlan.getActivityStart()) < 0) {
+            throw new BizException("活动未开始");
         }
-        if (new Date().compareTo(activityPlan.getActivityEnd()) >0) {
+        if (new Date().compareTo(activityPlan.getActivityEnd()) > 0) {
             throw new BizException("活动已结束");
         }
     }
 
     private SysUser getSysUser(Long userId) {
         return Optional.ofNullable(userId)
-                       .map(sysUserFeignService::queryUserById)
-                       .orElseThrow(() -> new BizException("用户不存在"));
+                .map(sysUserFeignService::queryUserById)
+                .orElseThrow(() -> new BizException("用户不存在"));
     }
 }

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

@@ -161,15 +161,20 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
     }
 
     private void sendOutSaleMessage(String reason, MusicSheet musicSheet) {
-        if(musicSheet.getSourceType().equals(SourceTypeEnum.TEACHER)) {
-            SysUser sysUser = getSysUser(musicSheet.getUserId());
-            // 推送老师
-            Map<Long, String> teacherReceivers = new HashMap<>();
-            teacherReceivers.put(sysUser.getId(), sysUser.getPhone());
-
-            sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.MUSIC_SHEET_OUT_SALE_REASON, teacherReceivers, null,
-                               0, null, ClientEnum.TEACHER.getCode(), musicSheet.getMusicSheetName(),reason);
+        try {
+            if(musicSheet.getSourceType().equals(SourceTypeEnum.TEACHER)) {
+                SysUser sysUser = getSysUser(musicSheet.getUserId());
+                // 推送老师
+                Map<Long, String> teacherReceivers = new HashMap<>();
+                teacherReceivers.put(sysUser.getId(), sysUser.getPhone());
+
+                sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.MUSIC_SHEET_OUT_SALE_REASON, teacherReceivers, null,
+                                                   0, null, ClientEnum.TEACHER.getCode(), musicSheet.getMusicSheetName(),reason);
+            }
+        } catch (Exception e) {
+            log.error("曲目下架失败 -->{}",e.fillInStackTrace());
         }
+
     }
 
     @Override

+ 5 - 2
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/UserOrderServiceImpl.java

@@ -812,8 +812,11 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i
 
         if (platformFee.compareTo(BigDecimal.ZERO) > 0) {
             PlatformCashAccountRecord platformCashAccountRecord;
-            if (GoodTypeEnum.PINAO_ROOM.equals(orderDetailVo.getGoodType())
-                    || GoodTypeEnum.ACTI_REGIST.equals(orderDetailVo.getGoodType())) {
+            if (GoodTypeEnum.PINAO_ROOM.equals(orderDetailVo.getGoodType())) {
+                platformCashAccountRecord = new PlatformCashAccountRecord(orderDetailVo.getUserId(), platformFee,
+                        InOrOutEnum.IN, PostStatusEnum.RECORDED, AccountBizTypeEnum.PIAON_ROOM, orderDetailVo.getBizId(),
+                        orderDetailVo.getOrderNo(), accountPeriodTime);
+            }else if (GoodTypeEnum.ACTI_REGIST.equals(orderDetailVo.getGoodType())) {
                 AccountBizTypeEnum bizTypeEnum = AccountBizTypeEnum.valueOf(orderDetailVo.getGoodType().getCode());
                 platformCashAccountRecord = new PlatformCashAccountRecord(orderDetailVo.getUserId(), platformFee,
                         InOrOutEnum.IN, PostStatusEnum.RECORDED, bizTypeEnum, orderDetailVo.getBizId(),

+ 1 - 2
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/VideoLessonShelvesVo.java

@@ -24,8 +24,7 @@ public class VideoLessonShelvesVo extends BaseEntity {
     @ListValue(vals = {0, 1}, message = "是否上架必须提交指定值")
     private Integer shelvesFlag;
 
-    @ApiModelProperty(value = "原因", required = true)
-    @NotBlank(message = "原因不能为空")
+    @ApiModelProperty(value = "原因")
     private String shelvesReason;
 
     @ApiModelProperty(value = "上下架时间", hidden = true)

+ 29 - 1
cooleshow-user/user-biz/src/main/resources/config/mybatis/ActivityEvaluationMapper.xml

@@ -32,7 +32,14 @@
     </select>
 
     <select id="selectUnjoinMusicIds" resultType="java.lang.Long">
-        select * from activity_evaluation
+        select t.id_ from music_sheet t
+        where t.id_ IN
+        <foreach collection="musicSheetIds" item="item" open="(" separator="," close=")">
+            #{item}
+        </foreach>
+        and not exists (
+            select 1 from activity_evaluation e where e.activity_id_ = #{activityId} and t.id_ = e.music_sheet_id_
+        )
     </select>
 
     <insert id="addBatch">
@@ -90,4 +97,25 @@
         left join subject s on s.id_ = stu.subject_id_
 
     </select>
+
+    <select id="musicPage" resultType="com.yonge.cooleshow.biz.dal.vo.MusicSheetVo">
+        select
+            <include refid="com.yonge.cooleshow.biz.dal.dao.MusicSheetDao.Base_Column_List"/>,
+            su.username_ as addName,
+            su.avatar_ as addUserAvatar,
+            (select group_concat(mt.name_) from music_tag mt
+                where find_in_set(mt.id_,t.music_tag_) and mt.del_flag_ = 0  and mt.state_ = 1) as musicTagNames,
+            (select group_concat(s.name_) from subject s
+                where find_in_set(s.id_,t.music_subject_) and s.del_flag_ = 0 ) as subjectNames
+        from music_sheet t
+        left join sys_user su on t.create_by_ = su.id_
+        <where>
+            su.del_flag_ = 0
+            and not exists(
+                select 1 from activity_evaluation ae where ae.activity_id_ = ${param.activityId} and ae.music_sheet_id_ = t.id_
+            )
+            <include refid="com.yonge.cooleshow.biz.dal.dao.MusicSheetDao.QueryInfo"/>
+        </where>
+        order by t.id_ desc
+    </select>
 </mapper>

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

@@ -605,6 +605,9 @@
             <if test="param.status != null and param.status != ''">
                 AND g.audit_status_ = #{param.status}
             </if>
+            <if test="param.shelvesFlag != null">
+                AND g.shelves_flag_ = #{param.shelvesFlag}
+            </if>
         </where>
     </select>
     <select id="selectVideoGroupStudent" resultType="com.yonge.cooleshow.biz.dal.vo.CourseGroupStudentVo">

+ 1 - 1
cooleshow-user/user-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -509,7 +509,7 @@
         LEFT JOIN (SELECT course_id_,COUNT(1) AS payCount FROM course_schedule_student_payment GROUP BY course_id_) a ON s.id_=a.course_id_
         WHERE s.lock_=0
         AND s.status_ IN ('ING','NOT_START','COMPLETE')
-        AND g.status_ IN ('ING', 'COMPLETE','APPLY')
+        AND g.status_ IN ('ING', 'COMPLETE','APPLY','OUT_SALE')
         AND s.id_ IN
         (SELECT course_id_ FROM course_schedule_student_payment WHERE user_id_ = #{param.studentId} AND course_type_ IN ('LIVE','PIANO_ROOM_CLASS'))
         AND s.class_date_ = #{param.classDate}

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

@@ -134,10 +134,10 @@
                 )
             </if>
             <if test="null != param.orderType and '' != param.orderType">
-                AND INTE_ARRAY(#{param.orderType},t.order_type_)
+                AND FIND_IN_SET(t.order_type_,#{param.orderType})
             </if>
             <if test="null != param.status and '' != param.status">
-                AND INTE_ARRAY(#{param.status},t.status_)
+                AND FIND_IN_SET(t.status_,#{param.status})
             </if>
             <if test="param.startTime !=null">
                 <![CDATA[AND t.create_time_ >= #{param.startTime} ]]>