刘俊驰 1 年之前
父節點
當前提交
0025d1f8f0

+ 4 - 9
cooleshow-app/src/main/java/com/yonge/cooleshow/admin/controller/MusicSheetApplicationExtendController.java

@@ -11,7 +11,6 @@ import com.dayaedu.cbs.openfeign.wrapper.music.CbsMusicSheetWrapper;
 import com.microsvc.toolkit.common.response.paging.PageInfo;
 import com.microsvc.toolkit.common.response.template.R;
 import com.microsvc.toolkit.common.webportal.exception.BizException;
-import com.microsvc.toolkit.config.jwt.utils.JwtUserInfo;
 import com.yonge.cooleshow.biz.dal.dto.PageUtil;
 import com.yonge.cooleshow.biz.dal.entity.MusicSheet;
 import com.yonge.cooleshow.biz.dal.service.MusicSheetService;
@@ -20,14 +19,12 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections.CollectionUtils;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
-import springfox.documentation.annotations.ApiIgnore;
 
 import javax.annotation.Resource;
 import java.util.ArrayList;
@@ -91,13 +88,11 @@ public class MusicSheetApplicationExtendController {
 
     @PreAuthorize("@pcs.hasPermissions('musicSheetApplicationExtend/page')")
     @PostMapping({"/page"})
-    public R<PageInfo<CbsMusicSheetWrapper.MusicSheet>> musicSheetPage(@RequestBody CbsMusicSheetWrapper.MusicSheetQuery var1) {
+    public R<PageInfo> musicSheetPage(@RequestBody CbsMusicSheetWrapper.MusicSheetQuery var1) {
         var1.setAddAppId(Long.parseLong(openFeignClientConfigProperties.getAppId()));
         try {
             PageInfo<CbsMusicSheetWrapper.MusicSheet> info = this.musicFeignClientService.musicSheetPage(var1).feignData();
-            if (CollectionUtils.isEmpty(info.getRows())) {
-                return R.from(info);
-            }else {
+            if (CollectionUtils.isNotEmpty(info.getRows())) {
                 List<MusicSheetWrapper.CbsMusicSheet> result = new ArrayList<>();
                 for (CbsMusicSheetWrapper.MusicSheet row : info.getRows()) {
                     MusicSheetWrapper.CbsMusicSheet cbsMusicSheet = JSONObject.parseObject(JSONObject.toJSONString(row), MusicSheetWrapper.CbsMusicSheet.class);
@@ -110,9 +105,9 @@ public class MusicSheetApplicationExtendController {
                     }
                     result.add(cbsMusicSheet);
                 }
-                PageUtil.pageInfo(info, result);
-                return R.from(info);
+                return R.from(PageUtil.transPageInfo(info, result));
             }
+            return R.from(info);
         } catch (Exception e) {
             log.error("查询曲目应用拓展表异常", e);
             if (e instanceof BizException) {

+ 1 - 1
cooleshow-app/src/main/java/com/yonge/cooleshow/admin/controller/MusicalInstrumentController.java

@@ -21,7 +21,7 @@ import java.util.List;
 @Slf4j
 @Validated
 @RestController
-@RequestMapping("/musicalInstrument")
+@RequestMapping("${app-config.url.admin:}/musicalInstrument")
 @Api(tags = "曲目乐器")
 public class MusicalInstrumentController {
 

+ 14 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/PageUtil.java

@@ -39,4 +39,18 @@ public class PageUtil {
         resultPage.setTotal(total);
         return resultPage;
     }
+
+    public static <T,E> com.microsvc.toolkit.common.response.paging.PageInfo<T> transPageInfo(com.microsvc.toolkit.common.response.paging.PageInfo<E> source, List<T> rows) {
+        if (Objects.isNull(source)) {
+            return new com.microsvc.toolkit.common.response.paging.PageInfo<>();
+        }
+        int total = Integer.parseInt(String.valueOf(source.getTotal()));
+        int limit = Integer.parseInt(String.valueOf(source.getLimit()));
+        com.microsvc.toolkit.common.response.paging.PageInfo<T> resultPage = new com.microsvc.toolkit.common.response.paging.PageInfo<>();
+        resultPage.setRows(rows);
+        resultPage.setCurrent(Long.valueOf(source.getCurrent()).intValue());
+        resultPage.setLimit(limit);
+        resultPage.setTotal(total);
+        return resultPage;
+    }
 }

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

@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.beust.jcommander.internal.Lists;
 import com.dayaedu.cbs.common.enums.EClientType;
 import com.dayaedu.cbs.common.enums.music.*;
+import com.dayaedu.cbs.common.enums.music.EMusicAvailableType;
 import com.dayaedu.cbs.common.enums.school.EMusicSheetType;
 import com.dayaedu.cbs.openfeign.client.MusicFeignClientService;
 import com.dayaedu.cbs.openfeign.properties.OpenFeignClientConfigProperties;

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

@@ -265,6 +265,7 @@ public class SubjectServiceImpl extends BaseServiceImpl<Long, Subject> implement
                 Subject subject = new Subject();
                 subject.setCbsSubjectId(addSubject.getCbsSubjectId());
                 subject.setEnableFlag(false);
+                subject.setParentSubjectId(addSubject.getParentSubjectId());
                 this.insert(subject);
                 subjectId= subject.getId();
             } else {
@@ -317,7 +318,7 @@ public class SubjectServiceImpl extends BaseServiceImpl<Long, Subject> implement
             pageInfo.setTotal(count);
             params.put("offset", pageInfo.getOffset());
             dataList = subjectDao.findPage(params);
-            if(query.getParentSubjectId() == null){
+            if(query.getParentSubjectId() == null || query.getParentSubjectId() > 0){
                 // 转map
                 Map<Long, SubjectWrapper.Subject> subjectMap = dataList.stream().collect(Collectors.toMap(SubjectWrapper.Subject::getCbsSubjectId, Function.identity(),(o1, o2)->o1));
                 // cbs声部ID集合
@@ -326,7 +327,7 @@ public class SubjectServiceImpl extends BaseServiceImpl<Long, Subject> implement
                 CbsSubjectWrapper.SubjectQuery subjectQuery = new CbsSubjectWrapper.SubjectQuery();
                 subjectQuery.setIds(cbsSubjectIds);
                 subjectQuery.setName(query.getKeyword());
-                subjectQuery.setPage(query.getPage());
+                subjectQuery.setPage(1);
                 subjectQuery.setRows(query.getRows());
                 try {
                     com.microsvc.toolkit.common.response.paging.PageInfo<CbsSubjectWrapper.Subject> subjectPageInfo = musicFeignClientService.subjectPage(subjectQuery).feignData();

+ 4 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/wrapper/SubjectWrapper.java

@@ -214,6 +214,10 @@ public class SubjectWrapper {
         @NotNull(message = "内容平台声部ID不能为空")
         private Long cbsSubjectId;
 
+        @ApiModelProperty("分类编号")
+        @NotNull(message = "分类编号不能为空")
+        private Long parentSubjectId;
+
         @ApiModelProperty("乐器ID")
         private List<Long> instrumentIds;
     }

+ 8 - 4
cooleshow-user/user-biz/src/main/resources/config/mybatis/SubjectMapper.xml

@@ -241,12 +241,14 @@
         FROM subject t
         LEFT JOIN instrument i on t.id_ = i.subject_id_
         <where>
-            AND t.cbs_subject_id_ is not null
             <if test="parentSubjectId != null">
                 AND t.parent_subject_id_ = #{parentSubjectId}
             </if>
             <if test="parentSubjectId == null">
-                AND t.parent_subject_id_ != 0
+                AND t.parent_subject_id_ != 0 AND t.cbs_subject_id_ is not null
+            </if>
+            <if test="keyword != null and keyword != ''">
+                AND t.name_ LIKE CONCAT('%',#{keyword},'%')
             </if>
             <if test="delFlag != null">
                 AND t.del_flag_ = #{delFlag}
@@ -296,12 +298,14 @@
         FROM subject t
         LEFT JOIN instrument i on t.id_ = i.subject_id_
         <where>
-            AND t.cbs_subject_id_ is not null
             <if test="parentSubjectId != null">
                 AND t.parent_subject_id_ = #{parentSubjectId}
             </if>
             <if test="parentSubjectId == null">
-                AND t.parent_subject_id_ != 0
+                AND t.parent_subject_id_ != 0 AND t.cbs_subject_id_ is not null
+            </if>
+            <if test="keyword != null and keyword != ''">
+                AND t.name_ LIKE CONCAT('%',#{keyword},'%')
             </if>
             <if test="delFlag != null">
                 AND t.del_flag_ = #{delFlag}