Procházet zdrojové kódy

Merge branch 'zx_online_0422' of http://git.dayaedu.com/yonge/cooleshow into develop-new

zouxuan před 1 rokem
rodič
revize
c7c0b1704d

+ 14 - 3
cooleshow-app/src/main/java/com/yonge/cooleshow/admin/controller/AppVersionInfoController.java

@@ -9,6 +9,8 @@ import com.yonge.toolset.base.page.PageInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiOperation;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.MediaType;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -37,10 +39,19 @@ public class AppVersionInfoController extends BaseController {
 	@ApiOperation("根据app客户端查询对象")
 	@ApiImplicitParam(name = "platform", value = "平台名称", required = true, dataType = "String", paramType = "path")
 	@GetMapping(value = "/queryByPlatform")
-	public HttpResponseResult<AppVersionInfo> queryByPlatform(String platform) {
+	public HttpResponseResult<AppVersionInfo> queryByPlatform(String platform,String localVersion) {
 		List<AppVersionInfo> list = appVersionInfoService.queryNewestByPlatform(platform);
-		if (list.size() > 0) {
-			return succeed(list.get(0));
+		if (CollectionUtils.isNotEmpty(list)) {
+			AppVersionInfo appVersionInfo = list.get(0);
+			//如果应用版本跨多个版本时若其中任何一个版本有强制更新,返回字段标记为强制更新
+			if(!appVersionInfo.getIsForceUpdate() && StringUtils.isNotEmpty(localVersion)){
+				//是否需要强制更新
+				AppVersionInfo forceUpdate = appVersionInfoService.checkForceUpdate(platform,localVersion);
+				if(forceUpdate != null){
+					appVersionInfo.setIsForceUpdate(true);
+				}
+			}
+			return succeed(appVersionInfo);
 		}
 		return failed();
 	}

+ 14 - 3
cooleshow-user/user-admin/src/main/java/com/yonge/cooleshow/admin/controller/AppVersionInfoController.java

@@ -6,6 +6,8 @@ import io.swagger.annotations.ApiOperation;
 
 import java.util.List;
 
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.MediaType;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -39,10 +41,19 @@ public class AppVersionInfoController extends BaseController {
 	@ApiOperation("根据app客户端查询对象")
 	@ApiImplicitParam(name = "platform", value = "平台名称", required = true, dataType = "String", paramType = "path")
 	@GetMapping(value = "/queryByPlatform")
-	public HttpResponseResult<AppVersionInfo> queryByPlatform(String platform) {
+	public HttpResponseResult<AppVersionInfo> queryByPlatform(String platform,String localVersion) {
 		List<AppVersionInfo> list = appVersionInfoService.queryNewestByPlatform(platform);
-		if (list.size() > 0) {
-			return succeed(list.get(0));
+		if (CollectionUtils.isNotEmpty(list)) {
+			AppVersionInfo appVersionInfo = list.get(0);
+			//如果应用版本跨多个版本时若其中任何一个版本有强制更新,返回字段标记为强制更新
+			if(!appVersionInfo.getIsForceUpdate() && StringUtils.isNotEmpty(localVersion)){
+				//是否需要强制更新
+				AppVersionInfo forceUpdate = appVersionInfoService.checkForceUpdate(platform,localVersion);
+				if(forceUpdate != null){
+					appVersionInfo.setIsForceUpdate(true);
+				}
+			}
+			return succeed(appVersionInfo);
 		}
 		return failed();
 	}

+ 26 - 0
cooleshow-user/user-admin/src/main/java/com/yonge/cooleshow/admin/controller/ExceptionLogController.java

@@ -0,0 +1,26 @@
+package com.yonge.cooleshow.admin.controller;
+
+import com.dayaedu.cbs.openfeign.client.SysExceptionLogFeignClientService;
+import com.dayaedu.cbs.openfeign.wrapper.courseware.SysExceptionLogVo;
+import com.yonge.cooleshow.common.controller.BaseController;
+import com.yonge.cooleshow.common.entity.HttpResponseResult;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+@RestController
+public class ExceptionLogController extends BaseController {
+
+	@Resource
+	private SysExceptionLogFeignClientService sysExceptionLogFeignClientService;
+
+	@PostMapping("sysExceptionLog/save")
+	public HttpResponseResult save(@RequestBody List<SysExceptionLogVo.SysExceptionLog> sysExceptionLogVos) {
+		sysExceptionLogFeignClientService.add(sysExceptionLogVos).feignData();
+		return succeed();
+	}
+
+}

+ 1 - 2
cooleshow-user/user-biz/pom.xml

@@ -136,7 +136,6 @@
         <dependency>
             <groupId>com.microsvc.toolkit.middleware</groupId>
             <artifactId>microsvc-middleware-rtc</artifactId>
-            <version>1.0.0</version>
         </dependency>
 
 
@@ -148,7 +147,7 @@
         <dependency>
             <groupId>com.dayaedu.cbs.openfeign</groupId>
             <artifactId>dayaedu-openfeign-client</artifactId>
-            <version>1.0.1</version>
+            <version>1.0.2</version>
             <exclusions>
                 <exclusion>
                     <groupId>com.alibaba.cloud</groupId>

+ 2 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/AppVersionInfoDao.java

@@ -26,4 +26,6 @@ public interface AppVersionInfoDao extends BaseDAO<Long, AppVersionInfo> {
 	AppVersionInfo selectAppVersionInfo(@Param("platform") String platform, @Param("version") String version);
 
 	List<AppVersionInfo> queryLatestByPlatform(@Param("platform") String platform, @Param("status") String status);
+
+    AppVersionInfo checkForceUpdate(@Param("platform") String platform, @Param("localVersion") String localVersion);
 }

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

@@ -33,4 +33,6 @@ public interface AppVersionInfoService extends BaseService<Long, AppVersionInfo>
 	YesOrNoEnum getAppAuditVersion(String platform, String version);
 
     List<AppVersionInfo> queryLatestByPlatform(String platform, String appStatus);
+
+    AppVersionInfo checkForceUpdate(String platform, String localVersion);
 }

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

@@ -78,4 +78,9 @@ public class AppVersionInfoServiceImpl extends BaseServiceImpl<Long, AppVersionI
     public List<AppVersionInfo> queryLatestByPlatform(String platform, String appStatus) {
 		return appVersionInfoDao.queryLatestByPlatform(platform, appStatus);
 	}
+
+    @Override
+    public AppVersionInfo checkForceUpdate(String platform, String localVersion) {
+        return appVersionInfoDao.checkForceUpdate(platform, localVersion);
+    }
 }

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

@@ -62,6 +62,8 @@ public class PaymentMerchantConfigServiceImpl extends ServiceImpl<PaymentMerchan
                 adapayPayConfig.setKeyPrivate(config.getRsaPrivateKey());
                 adapayPayConfig.setWxAppId(config.getWxAppId());
                 adapayPayConfig.setWxAppSecret(config.getWxAppSecret());
+                adapayPayConfig.setMiniAppId(config.getMiniAppId());
+                adapayPayConfig.setMiniAppSecret(config.getMiniAppSerret());
                 adapayPayConfig.setSupportCreditCards(properties.getSupportCreditCards());
                 try {
                     AdapayPaymentServicePlugin plugin = new AdapayPaymentServicePlugin(config.getPaymentVendor(), adapayPayConfig, false);

+ 12 - 10
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/TenantGroupAlbumServiceImpl.java

@@ -153,16 +153,18 @@ public class TenantGroupAlbumServiceImpl extends ServiceImpl<TenantGroupAlbumMap
         // 过滤出课件
         List<Long> coursewareIds = list.stream().filter(x -> x.getSubjectType() == SubjectTypeEnum.COURSEWARE).map(TenantAlbumMusic::getMusicSheetId).collect(Collectors.toList());
 
-        CbsLessonCoursewareWrapper.LambdaQuery lambdaQuery = CbsLessonCoursewareWrapper.LambdaQuery.builder().ids(coursewareIds)
-            .delFlag(false).enableFlag(true).build();
-        List<CbsLessonCoursewareWrapper.Entity> entities = coursewareFeignService.lessonCoursewareLambdaQuery(lambdaQuery).feignData();
-        if (CollectionUtils.isNotEmpty(entities)) {
-            // id 集合
-            List<Long> courseIds = entities.stream().map(CbsLessonCoursewareWrapper.Entity::getId).collect(Collectors.toList());
-            // list 去除类型为COURSEWARE,id 不在courseIds
-            list = list.stream().filter(x -> x.getSubjectType() != SubjectTypeEnum.COURSEWARE || courseIds.contains(x.getMusicSheetId())).collect(Collectors.toList());
-        } else {
-            list = list.stream().filter(x -> x.getSubjectType() != SubjectTypeEnum.COURSEWARE ).collect(Collectors.toList());
+        if (CollectionUtils.isNotEmpty(coursewareIds)) {
+            CbsLessonCoursewareWrapper.LambdaQuery lambdaQuery = CbsLessonCoursewareWrapper.LambdaQuery.builder().ids(coursewareIds)
+                .delFlag(false).enableFlag(true).build();
+            List<CbsLessonCoursewareWrapper.Entity> entities = coursewareFeignService.lessonCoursewareLambdaQuery(lambdaQuery).feignData();
+            if (CollectionUtils.isNotEmpty(entities)) {
+                // id 集合
+                List<Long> courseIds = entities.stream().map(CbsLessonCoursewareWrapper.Entity::getId).collect(Collectors.toList());
+                // list 去除类型为COURSEWARE,id 不在courseIds
+                list = list.stream().filter(x -> x.getSubjectType() != SubjectTypeEnum.COURSEWARE || courseIds.contains(x.getMusicSheetId())).collect(Collectors.toList());
+            } else {
+                list = list.stream().filter(x -> x.getSubjectType() != SubjectTypeEnum.COURSEWARE).collect(Collectors.toList());
+            }
         }
 
 

+ 32 - 45
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/UserTenantAlbumRecordServiceImpl.java

@@ -500,56 +500,43 @@ public class UserTenantAlbumRecordServiceImpl extends ServiceImpl<UserTenantAlbu
         String name = tenantAlbum.getName();
         //机构专辑封面
         String coverImg = tenantAlbum.getCoverImg();
-        //机构专辑曲目数
-        List<TenantAlbumMusic> tenantAlbumMusiclist = tenantAlbumMusicMapper.getByAlbumAndEnable(Lists.newArrayList(tenantAlbumId));
-        // 过滤出曲目
-        List<SubjectTypeEnum> enumList = com.beust.jcommander.internal.Lists.newArrayList(SubjectTypeEnum.MUSIC, SubjectTypeEnum.SUBJECT, SubjectTypeEnum.ENSEMBLE);
-        List<Long> MusicSheetIds = tenantAlbumMusiclist.stream().filter(o->enumList.contains(o.getSubjectType()))
-            .map(TenantAlbumMusic::getMusicSheetId).distinct().collect(Collectors.toList());
-
-        List<Long> coursewareIds = tenantAlbumMusiclist.stream().filter(o->o.getSubjectType() == SubjectTypeEnum.COURSEWARE)
-            .map(TenantAlbumMusic::getMusicSheetId).distinct().collect(Collectors.toList());
-        CbsLessonCoursewareWrapper.LambdaQuery lambdaQuery = CbsLessonCoursewareWrapper.LambdaQuery.builder().ids(coursewareIds)
-            .delFlag(false).enableFlag(true).build();
-        List<CbsLessonCoursewareWrapper.Entity> entities = coursewareFeignService.lessonCoursewareLambdaQuery(lambdaQuery).feignData();
-        if (CollectionUtils.isNotEmpty(entities)) {
-            // id 集合
-            List<Long> courseIds = entities.stream().map(CbsLessonCoursewareWrapper.Entity::getId).collect(Collectors.toList());
-            // list 去除类型为COURSEWARE,id 不在courseIds
-            album.setCoursewareCounts(courseIds.size());
-        } else {
-            album.setCoursewareCounts(0);
-        }
 
-        //计算符合条件的个数
-        if (CollectionUtils.isNotEmpty(MusicSheetIds)) {
-            size = musicSheetService.lambdaQuery().in(MusicSheet::getId, MusicSheetIds).eq(MusicSheet::getState, true)
-                .eq(MusicSheet::getDelFlag, false).count();
+        List<TenantAlbumMusic> albumMusicList = tenantAlbumMusicMapper.getByAlbumAndEnable(tenantAlbumIds);
+        // 过滤出课件
+        List<Long> coursewareIds = albumMusicList.stream().filter(x -> x.getSubjectType() == SubjectTypeEnum.COURSEWARE).map(TenantAlbumMusic::getMusicSheetId).collect(Collectors.toList());
+
+        if (CollectionUtils.isNotEmpty(coursewareIds)) {
+            CbsLessonCoursewareWrapper.LambdaQuery lambdaQuery = CbsLessonCoursewareWrapper.LambdaQuery.builder().ids(coursewareIds)
+                .delFlag(false).enableFlag(true).build();
+            List<CbsLessonCoursewareWrapper.Entity> entities = coursewareFeignService.lessonCoursewareLambdaQuery(lambdaQuery).feignData();
+            if (CollectionUtils.isNotEmpty(entities)) {
+                // id 集合
+                List<Long> courseIds = entities.stream().map(CbsLessonCoursewareWrapper.Entity::getId).collect(Collectors.toList());
+                // list 去除类型为COURSEWARE,id 不在courseIds
+                albumMusicList = albumMusicList.stream().filter(x -> x.getSubjectType() != SubjectTypeEnum.COURSEWARE || courseIds.contains(x.getMusicSheetId())).collect(Collectors.toList());
+            } else {
+                albumMusicList = albumMusicList.stream().filter(x -> x.getSubjectType() != SubjectTypeEnum.COURSEWARE).collect(Collectors.toList());
+            }
         }
 
-        //获取合奏曲目数量
-        List<TenantAlbumMusic> ensembleLits = tenantAlbumMusicService.lambdaQuery().eq(TenantAlbumMusic::getSubjectType, "ENSEMBLE")
-            .eq(TenantAlbumMusic::getTenantAlbumId, tenantAlbumId)
-            .eq(TenantAlbumMusic::getDelFlag, false).list();
-        List<Long> ensembleMusicSheetIds = ensembleLits.stream().map(TenantAlbumMusic::getMusicSheetId).distinct().collect(Collectors.toList());
-
-        album.setEnsembleCounts(ensembleMusicSheetIds.size());
 
-        //获取小曲目的曲目数量
-        List<TenantAlbumMusic> musicLists = tenantAlbumMusicService.lambdaQuery().eq(TenantAlbumMusic::getSubjectType, "MUSIC")
-            .eq(TenantAlbumMusic::getTenantAlbumId, tenantAlbumId)
-            .eq(TenantAlbumMusic::getDelFlag, false).list();
-        List<Long> musicSheetIds = musicLists.stream().map(TenantAlbumMusic::getMusicSheetId).distinct().collect(Collectors.toList());
-
-        album.setMusicCounts(musicSheetIds.size());
-
-        //获取声部的曲目数量
-        List<TenantAlbumMusic> subjectLists = tenantAlbumMusicService.lambdaQuery().eq(TenantAlbumMusic::getSubjectType, "SUBJECT")
-            .eq(TenantAlbumMusic::getTenantAlbumId, tenantAlbumId)
-            .eq(TenantAlbumMusic::getDelFlag, false).list();
-        List<Long> subjectSheetIds = subjectLists.stream().map(TenantAlbumMusic::getMusicSheetId).distinct().collect(Collectors.toList());
+        // 根据专辑ID分组 在根据声部分类 分组
+        Map<Long, Map<SubjectTypeEnum, Long>> map = albumMusicList.stream()
+            .collect(Collectors.groupingBy(TenantAlbumMusic::getTenantAlbumId, Collectors.groupingBy(TenantAlbumMusic::getSubjectType,Collectors.counting())));
 
-        album.setSubjectCounts(subjectSheetIds.size());
+        Map<SubjectTypeEnum, Long> subjectTypeEnumLongMap = map.get(tenantAlbum.getId());
+        if (subjectTypeEnumLongMap != null) {
+            album.setMusicCounts(subjectTypeEnumLongMap.getOrDefault(SubjectTypeEnum.MUSIC,0L).intValue());
+            album.setEnsembleCounts(subjectTypeEnumLongMap.getOrDefault(SubjectTypeEnum.ENSEMBLE,0L).intValue());
+            album.setSubjectCounts(subjectTypeEnumLongMap.getOrDefault(SubjectTypeEnum.SUBJECT,0L).intValue());
+            album.setCoursewareCounts(subjectTypeEnumLongMap.getOrDefault(SubjectTypeEnum.COURSEWARE,0L).intValue());
+        } else {
+            album.setMusicCounts(0);
+            album.setEnsembleCounts(0);
+            album.setSubjectCounts(0);
+            album.setCoursewareCounts(0);
+        }
+        album.setMusicNum(album.getMusicCounts() + album.getEnsembleCounts()+album.getSubjectCounts());
 
 
         //机构专辑简介

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

@@ -141,4 +141,7 @@
 		order by version_ desc, status_='newest' desc, id_ desc
 		limit 1
 	</select>
+    <select id="checkForceUpdate" resultMap="AppVersionInfo">
+		select * from app_version_info where version_ > #{localVersion} and platform_ = #{platform} AND is_force_update_ = 1 limit 1
+	</select>
 </mapper>