Browse Source

审核查询

刘俊驰 3 months ago
parent
commit
e6d15fc5fa

+ 89 - 4
cooleshow-app/src/main/java/com/yonge/cooleshow/admin/controller/MusicSheetCbsController.java

@@ -7,14 +7,13 @@ import com.dayaedu.cbs.openfeign.wrapper.music.CbsMusicSheetWrapper;
 import com.microsvc.toolkit.common.response.template.R;
 import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
 import com.yonge.cooleshow.auth.api.entity.SysUser;
+import com.yonge.cooleshow.biz.dal.dao.MusicSheetDao;
 import com.yonge.cooleshow.biz.dal.entity.MusicSheet;
+import com.yonge.cooleshow.biz.dal.entity.MusicSheetAuthRecord;
 import com.yonge.cooleshow.biz.dal.entity.Student;
 import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
 import com.yonge.cooleshow.biz.dal.enums.SourceTypeEnum;
-import com.yonge.cooleshow.biz.dal.service.AppVersionInfoService;
-import com.yonge.cooleshow.biz.dal.service.InstrumentService;
-import com.yonge.cooleshow.biz.dal.service.MusicSheetService;
-import com.yonge.cooleshow.biz.dal.service.StudentService;
+import com.yonge.cooleshow.biz.dal.service.*;
 import com.yonge.cooleshow.biz.dal.vo.MusicSheetDetailVo;
 import com.yonge.cooleshow.biz.dal.vo.MusicSheetVo;
 import com.yonge.cooleshow.biz.dal.wrapper.InstrumentWrapper;
@@ -66,6 +65,11 @@ public class MusicSheetCbsController extends BaseController {
     @Autowired
     private InstrumentService instrumentService;
 
+    @Autowired
+    private MusicSheetDao musicSheetDao;
+
+    @Resource
+    private MusicSheetAuthRecordService musicSheetAuthRecordService;
 
     /**
      * 查询单条
@@ -75,6 +79,87 @@ public class MusicSheetCbsController extends BaseController {
      */
     @ApiOperation(value = "查询内容平台数据")
     @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "id", dataType = "long")
+    })
+    @GetMapping("/cbsDetailAuth/{id}")
+    public R<MusicSheetVo.MusicSheetDetail> cbsDetailAuth(@PathVariable("id") String id) {
+
+        MusicSheetVo.MusicSheetDetail musicSheetDetail = null;
+        MusicSheetDetailVo detail = musicSheetDao.detail(Long.parseLong(id));
+        if (detail == null) {
+            MusicSheetDetailVo result = musicSheetAuthRecordService.auditDetail(id);
+            if (result != null) {
+                detail = result;
+                if(StringUtils.isNotEmpty(result.getMusicSheetJson())){
+                    // 审核中数据
+                    musicSheetDetail = JSON.parseObject(result.getMusicSheetJson(), MusicSheetVo.MusicSheetDetail.class);
+                }else {
+                    MusicSheetAuthRecord authRecord = musicSheetAuthRecordService.getById(id);
+                    detail = musicSheetDao.detail(authRecord.getMusicSheetId());
+                    if(detail == null){
+                        throw new BizException("未找到曲目信息");
+                    }
+                    id = authRecord.getMusicSheetId().toString();
+                }
+            }
+            if(result == null){
+                throw new BizException("未找到曲目信息");
+            }
+
+        }
+
+        if (musicSheetDetail == null) {
+
+            CbsMusicSheetWrapper.MusicSheet cbsMusicSheet = musicSheetService.cbsDetail(detail.getCbsMusicSheetId());
+            cbsMusicSheet.setBizId(Long.parseLong(id));
+            musicSheetDetail = JSON.parseObject(JSON.toJSONString(cbsMusicSheet), MusicSheetVo.MusicSheetDetail.class);
+        }
+
+        // 设置曲目付费类型
+        musicSheetDetail.setPaymentType(detail.getPaymentType());
+        // 设置业务端曲目分类
+        musicSheetDetail.setScoreType(detail.getScoreType());
+        musicSheetDetail.setIsConvertibleScore(detail.getNotation() ==YesOrNoEnum.YES);
+        musicSheetDetail.setPlay(detail.getPlay());
+        musicSheetDetail.setBuyed(detail.getBuyed());
+        musicSheetDetail.setMusicPrice(detail.getMusicPrice());
+
+
+    // 如果是合奏 并且乐器ID = 2268
+        musicSheetDetail.setSpecialPercussionFlag(false);
+        if ("2268".equals(musicSheetDetail.getMusicalInstrumentIds()) && musicSheetDetail.getMusicSheetType() == EMusicSheetType.CONCERT) {
+            musicSheetDetail.setSpecialPercussionFlag(true);
+        }
+
+        // 设置乐器信息
+        if (StringUtils.isNotBlank(musicSheetDetail.getMusicalInstrumentIds())) {
+            List<Long> instrumentIds = Arrays.stream(musicSheetDetail.getMusicalInstrumentIds().split(","))
+                    .map(Long::parseLong).collect(Collectors.toList());
+
+            if (CollectionUtils.isNotEmpty(instrumentIds) && CollectionUtils.isNotEmpty(musicSheetDetail.getMusicalInstruments())) {
+                Map<Long, InstrumentWrapper.Instrument> instrumentMap = instrumentService.getMapByIds(instrumentIds);
+                for (CbsMusicSheetWrapper.MusicalInstrument musicalInstrument : musicSheetDetail.getMusicalInstruments()) {
+                    InstrumentWrapper.Instrument instrument = instrumentMap.get(musicalInstrument.getId().longValue());
+                    if (instrument != null) {
+                        musicalInstrument.setOrientation(instrument.getOrientation());
+                    }
+
+                }
+            }
+        }
+        return R.from(musicSheetDetail);
+
+    }
+
+
+        /**
+         * 查询单条
+         *
+         * @param id 详情ID
+         * @return R<MusicSheetVo.MusicSheet>
+         */
+    @ApiOperation(value = "查询内容平台数据")
+    @ApiImplicitParams({
         @ApiImplicitParam(name = "id", value = "id", dataType = "long")
     })
     @GetMapping("/cbsDetail/{id}")

+ 2 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/MusicSheetService.java

@@ -77,6 +77,8 @@ public interface MusicSheetService extends IService<MusicSheet> {
      */
     MusicSheetShareVo shareMusicSheet(SysUser sysUser);
 
+    MusicSheetDetailVo getCbsDetail(Long id, SourceTypeEnum sourceTypeEnum);
+
     MusicSheetDetailVo getAuditDetail(Long id);
 
     /**

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

@@ -394,7 +394,8 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
         return musicSheetShareVo;
     }
 
-    public MusicSheetDetailVo getCbsDetail(Long id,SourceTypeEnum sourceTypeEnum) {
+    @Override
+    public MusicSheetDetailVo getCbsDetail(Long id, SourceTypeEnum sourceTypeEnum) {
         MusicSheet musicSheet = this.baseMapper.get(id);
         if (musicSheet == null) {
             throw new BizException("未找到曲目信息");