1
0

15 Revīzijas 119663d46b ... cce891bbde

Autors SHA1 Ziņojums Datums
  liujc cce891bbde 默认值 2 mēneši atpakaļ
  liujc c4e5317042 fix 2 mēneši atpakaļ
  liujc 831576426e fix 2 mēneši atpakaļ
  liujc 0475431388 fix 2 mēneši atpakaļ
  liujc a756282540 fix 2 mēneši atpakaļ
  liujc ba9f986e5c merge 2 mēneši atpakaļ
  Eric 722639876d fix 课件课时数字段 2 mēneši atpakaļ
  Eric b5e644a47b fix 课件课时数字段 2 mēneši atpakaļ
  Eric e4effb3eee fix 酷乐秀扫码登录 2 mēneši atpakaļ
  Eric 66fd790f08 fix 酷乐秀扫码登录 2 mēneši atpakaļ
  Eric e6ffe23400 fix 酷乐秀扫码登录 2 mēneši atpakaļ
  Eric 8ff49c8fff fix 酷乐秀扫码登录 2 mēneši atpakaļ
  Eric c2a49c64c4 fix 酷乐秀扫码登录 2 mēneši atpakaļ
  Eric 87d917a7ea fix 酷乐秀扫码登录 2 mēneši atpakaļ
  Eric 74e4b3e771 fix 酷乐秀扫码登录 2 mēneši atpakaļ
20 mainītis faili ar 285 papildinājumiem un 17 dzēšanām
  1. 1 0
      cooleshow-app/src/main/java/com/yonge/cooleshow/config/ResourceServerConfig.java
  2. 0 1
      cooleshow-app/src/main/java/com/yonge/cooleshow/teacher/controller/TenantAlbumSheetController.java
  3. 19 4
      cooleshow-app/src/main/java/com/yonge/cooleshow/teacher/controller/TenantGroupAlbumController.java
  4. 15 0
      cooleshow-auth/auth-api/src/main/java/com/yonge/cooleshow/auth/api/client/SysUserFeignService.java
  5. 32 0
      cooleshow-auth/auth-api/src/main/java/com/yonge/cooleshow/auth/api/client/fallback/SysUserFeignServiceFallback.java
  6. 7 0
      cooleshow-auth/auth-server/src/main/java/com/yonge/cooleshow/auth/core/provider/PhoneAuthenticationProvider.java
  7. 1 1
      cooleshow-auth/auth-server/src/main/java/com/yonge/cooleshow/auth/core/provider/service/DefaultUserDetailsService.java
  8. 8 1
      cooleshow-auth/auth-server/src/main/java/com/yonge/cooleshow/auth/core/service/CustomAuthenticationKeyGenerator.java
  9. 88 0
      cooleshow-auth/auth-server/src/main/java/com/yonge/cooleshow/auth/service/impl/CbsQrCodeScanServiceImpl.java
  10. 33 0
      cooleshow-auth/auth-server/src/main/java/com/yonge/cooleshow/auth/web/controller/OpenQrLoginController.java
  11. 0 2
      cooleshow-auth/auth-server/src/main/java/com/yonge/cooleshow/auth/web/controller/TokenController.java
  12. 8 0
      cooleshow-auth/pom.xml
  13. 7 1
      cooleshow-common/src/main/java/com/yonge/cooleshow/common/service/IdGeneratorService.java
  14. 13 0
      cooleshow-common/src/main/java/com/yonge/cooleshow/common/service/impl/RedisIdGeneratorService.java
  15. 1 1
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/enums/SubjectTypeEnum.java
  16. 25 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/cbs/impl/CbsQrCodeScanServiceImpl.java
  17. 7 4
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/MusicSheetServiceImpl.java
  18. 2 2
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/TenantAlbumMusicServiceImpl.java
  19. 17 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/wrapper/TenantAlbumMusicWrapper.java
  20. 1 0
      cooleshow-user/user-biz/src/main/resources/config/mybatis/TenantGroupAlbumMapper.xml

+ 1 - 0
cooleshow-app/src/main/java/com/yonge/cooleshow/config/ResourceServerConfig.java

@@ -38,6 +38,7 @@ public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
 						"/*/appVersionInfo/queryByPlatform",
 						"/*/uploadFile",
 						"/*/open/**",
+						"/open/**",
 						"/*/room/statusSync",
 						"/*/room/tencentRtcCallback",
 						"/*/wechat/*",

+ 0 - 1
cooleshow-app/src/main/java/com/yonge/cooleshow/teacher/controller/TenantAlbumSheetController.java

@@ -3,7 +3,6 @@ package com.yonge.cooleshow.teacher.controller;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.dayaedu.cbs.openfeign.client.CoursewareFeignService;
-import com.dayaedu.cbs.openfeign.wrapper.courseware.CbsLessonCoursewareDetailWrapper;
 import com.dayaedu.cbs.openfeign.wrapper.courseware.CbsLessonCoursewareWrapper;
 import com.microsvc.toolkit.common.response.paging.QueryInfo;
 import com.yonge.cooleshow.auth.api.client.SysUserFeignService;

+ 19 - 4
cooleshow-app/src/main/java/com/yonge/cooleshow/teacher/controller/TenantGroupAlbumController.java

@@ -3,7 +3,9 @@ package com.yonge.cooleshow.teacher.controller;
 import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
 import com.yonge.cooleshow.auth.api.entity.SysUser;
 import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
+import com.yonge.cooleshow.biz.dal.service.TenantAlbumMusicService;
 import com.yonge.cooleshow.biz.dal.service.TenantGroupAlbumService;
+import com.yonge.cooleshow.biz.dal.wrapper.TenantAlbumMusicWrapper;
 import com.yonge.cooleshow.biz.dal.wrapper.TenantGroupAlbumWrapper;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
 import io.swagger.annotations.Api;
@@ -12,13 +14,12 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
 
+import static com.yonge.cooleshow.common.controller.BaseController.failed;
+
 @Slf4j
 @Validated
 @RestController
@@ -32,6 +33,8 @@ public class TenantGroupAlbumController {
     @Autowired
     private SysUserFeignService sysUserFeignService;
 
+    @Autowired
+    private TenantAlbumMusicService tenantAlbumMusicService;
 	@ApiOperation(value = "学生可购买机构专辑信息")
 	@GetMapping("/buyAlbumInfo")
 	public HttpResponseResult<List<TenantGroupAlbumWrapper.BuyTenantAlbum>> buyAlbumInfo(@RequestParam(required = false) Long tenantGroupAlbumId) {
@@ -47,4 +50,16 @@ public class TenantGroupAlbumController {
         query.setClientType(ClientEnum.TEACHER);
 		return HttpResponseResult.succeed(tenantGroupAlbumService.buyAlbumInfo(query));
 	}
+
+    @ApiOperation(value = "查询条件")
+    @PostMapping("/selectCondition")
+    public HttpResponseResult<TenantAlbumMusicWrapper.TenantAlbumMusicSelectData> selectCondition(@RequestBody @Validated TenantAlbumMusicWrapper.TenantAlbumMusicSelect query) {
+        SysUser user = sysUserFeignService.queryUserInfo();
+        if (user == null || null == user.getId()) {
+            return failed(HttpStatus.FORBIDDEN, "请登录");
+        }
+        query.setUserId(user.getId());
+        return HttpResponseResult.succeed(tenantAlbumMusicService.getTenantAlbumMusicQuery(query));
+    }
+
 }

+ 15 - 0
cooleshow-auth/auth-api/src/main/java/com/yonge/cooleshow/auth/api/client/SysUserFeignService.java

@@ -1,5 +1,6 @@
 package com.yonge.cooleshow.auth.api.client;
 
+import com.dayaedu.cbs.openfeign.wrapper.qrcode.CbsQrCodeScanWrapper;
 import com.yonge.cooleshow.auth.api.client.fallback.SysUserFeignServiceFallback;
 import com.yonge.cooleshow.auth.api.dto.RealnameAuthReq;
 import com.yonge.cooleshow.auth.api.dto.SysUserQueryInfo;
@@ -17,6 +18,7 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestParam;
 
 import java.util.List;
+import java.util.Map;
 
 @FeignClient(contextId = "sysUserFeignService", name = "${app-config.open-feign.auth-server.name:auth-server}", url = "${app-config.open-feign.auth-server.url:}",
 		configuration = { FeignConfiguration.class }, fallback = SysUserFeignServiceFallback.class)
@@ -83,4 +85,17 @@ public interface SysUserFeignService {
 	@ApiOperation(value = "获取登录用户client")
 	HttpResponseResult<String> client();
 
+	@PostMapping(value = "open/qrcode/userInfo")
+	CbsQrCodeScanWrapper.UserInfo userInfo(@RequestBody CbsQrCodeScanWrapper.QrCodeScanUserInfoReq req);
+
+	@PostMapping(value = "open/qrcode/login")
+	CbsQrCodeScanWrapper.QrCodeScanToken login(@RequestBody CbsQrCodeScanWrapper.QrCodeScanReq req);
+
+	@PostMapping(value = "smsLogin")
+	HttpResponseResult<Map<String,Object>> smsLogin(@RequestParam("phone")String phone,
+													@RequestParam("smsCode")String smsCode,
+													@RequestParam("loginType")String loginType,
+													@RequestParam("clientId")String clientId,
+													@RequestParam("clientSecret")String clientSecret);
+
 }

+ 32 - 0
cooleshow-auth/auth-api/src/main/java/com/yonge/cooleshow/auth/api/client/fallback/SysUserFeignServiceFallback.java

@@ -1,7 +1,9 @@
 package com.yonge.cooleshow.auth.api.client.fallback;
 
 import java.util.List;
+import java.util.Map;
 
+import com.dayaedu.cbs.openfeign.wrapper.qrcode.CbsQrCodeScanWrapper;
 import com.yonge.cooleshow.auth.api.dto.RealnameAuthReq;
 import com.yonge.cooleshow.auth.api.dto.SysUserQueryInfo;
 import com.yonge.toolset.utils.idcard.IdcardInfoExtractor;
@@ -97,4 +99,34 @@ public class SysUserFeignServiceFallback implements SysUserFeignService {
 		return null;
 	}
 
+	/**
+	 * @param req
+	 * @return
+	 */
+	@Override
+	public CbsQrCodeScanWrapper.UserInfo userInfo(CbsQrCodeScanWrapper.QrCodeScanUserInfoReq req) {
+		return null;
+	}
+
+	/**
+	 * @param req
+	 * @return
+	 */
+	@Override
+	public CbsQrCodeScanWrapper.QrCodeScanToken login(CbsQrCodeScanWrapper.QrCodeScanReq req) {
+		return null;
+	}
+
+	/**
+	 * @param phone
+	 * @param smsCode
+	 * @param clientId
+	 * @param loginType
+	 * @param clientSecret
+	 * @return
+	 */
+	@Override
+	public HttpResponseResult<Map<String, Object>> smsLogin(String phone, String smsCode, String loginType, String clientId, String clientSecret) {
+		return null;
+	}
 }

+ 7 - 0
cooleshow-auth/auth-server/src/main/java/com/yonge/cooleshow/auth/core/provider/PhoneAuthenticationProvider.java

@@ -28,6 +28,7 @@ import org.springframework.security.core.userdetails.UsernameNotFoundException;
 import org.springframework.security.jwt.Jwt;
 import org.springframework.security.jwt.JwtHelper;
 import org.springframework.security.jwt.crypto.sign.RsaVerifier;
+import org.springframework.security.oauth2.provider.OAuth2Authentication;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.security.interfaces.RSAPublicKey;
@@ -147,6 +148,12 @@ public class PhoneAuthenticationProvider extends AbstractAuthenticationProvider
                 if (!b) {
                     throw new BadCredentialsException("验证码校验失败");
                 }
+
+                // 老师扫码登陆
+                if (loginEntity.getClientId().toLowerCase().startsWith("qr_")) {
+                    // 重置登录账号信息
+                    loginEntity.setClientId(loginEntity.getClientId().toLowerCase().replace("qr_", "").toUpperCase());
+                }
             }
 
             String clientId = loginEntity.getClientId();

+ 1 - 1
cooleshow-auth/auth-server/src/main/java/com/yonge/cooleshow/auth/core/provider/service/DefaultUserDetailsService.java

@@ -79,7 +79,7 @@ public class DefaultUserDetailsService implements UserDetailsService {
             if (UserLockFlag.LOCKED.equals(data.getLockFlag())) {
                 throw new LockedException("账户被锁定");
             }
-        }else if(SysUserType.TEACHER.getCode().equals(clientId)) {
+        }else if(SysUserType.TEACHER.getCode().equals(clientId) || "qr_teacher".equalsIgnoreCase(clientId)) {
             TeacherApi data = adminFeignService.getTeacher(sysUser.getId()).getData();
             if (data == null) {
                 throw new UsernameNotFoundException("账户不存在");

+ 8 - 1
cooleshow-auth/auth-server/src/main/java/com/yonge/cooleshow/auth/core/service/CustomAuthenticationKeyGenerator.java

@@ -4,6 +4,7 @@ import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.TreeSet;
 
+import cn.hutool.core.util.RandomUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.security.oauth2.common.util.OAuth2Utils;
 import org.springframework.security.oauth2.provider.OAuth2Authentication;
@@ -25,7 +26,13 @@ public class CustomAuthenticationKeyGenerator extends DefaultAuthenticationKeyGe
 		if (!authentication.isClientOnly()) {
 			values.put(USERNAME, StringUtils.substringAfter(authentication.getName(), ":"));
 		}
-		values.put(CLIENT_ID, authorizationRequest.getClientId());
+
+		String clientId = authorizationRequest.getClientId();
+		if (StringUtils.isNotEmpty(clientId) && "qr_teacher".equalsIgnoreCase(clientId)) {
+			// 酷乐秀老师端扫码登录,允许多端登录,同时生成多个token
+			clientId += ":" + RandomUtil.randomNumbers(6);
+		}
+		values.put(CLIENT_ID, clientId);
 		if (authorizationRequest.getScope() != null) {
 			values.put(SCOPE, OAuth2Utils.formatParameterList(new TreeSet<String>(authorizationRequest.getScope())));
 		}

+ 88 - 0
cooleshow-auth/auth-server/src/main/java/com/yonge/cooleshow/auth/service/impl/CbsQrCodeScanServiceImpl.java

@@ -0,0 +1,88 @@
+package com.yonge.cooleshow.auth.service.impl;
+
+import cn.hutool.core.util.RandomUtil;
+import com.alibaba.fastjson.JSONObject;
+import com.dayaedu.cbs.openfeign.wrapper.qrcode.CbsQrCodeScanWrapper;
+import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
+import com.yonge.cooleshow.auth.api.entity.SysUser;
+import com.yonge.cooleshow.auth.core.service.CustomTokenServices;
+import com.yonge.cooleshow.auth.dal.dao.SysConfigDao;
+import com.yonge.cooleshow.auth.service.SysUserService;
+import com.yonge.cooleshow.common.entity.HttpResponseResult;
+import com.yonge.cooleshow.common.service.IdGeneratorService;
+import com.yonge.toolset.base.exception.BizException;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.security.oauth2.provider.OAuth2Authentication;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.Map;
+import java.util.Objects;
+
+@Service
+public class CbsQrCodeScanServiceImpl {
+
+    @Resource
+    private CustomTokenServices customTokenServices;
+    @Resource
+    private SysUserService sysUserService;
+    @Resource
+    private SysUserFeignService sysUserFeignService;
+    @Resource
+    private SysConfigDao sysConfigDao;
+
+    @Autowired
+    private IdGeneratorService smsCodeService;
+
+    public CbsQrCodeScanWrapper.UserInfo userInfo(CbsQrCodeScanWrapper.QrCodeScanUserInfoReq req) {
+        CbsQrCodeScanWrapper.UserInfo userInfo = new CbsQrCodeScanWrapper.UserInfo();
+        userInfo.setUsername(customTokenServices.loadAuthentication(req.getToken()).getName().split(":")[1]);
+        userInfo.setClientTypes("TEACHER");
+
+        SysUser sysUser = sysUserService.queryByPhone(userInfo.getUsername());
+        if (sysUser == null) {
+            throw new BizException(HttpStatus.UNAUTHORIZED.value(), "用户不存在");
+        }
+        // 查询老师机构ID
+        Long tenantId = sysUserService.getTenantByClient(sysUser.getId(), "TEACHER");
+        if (Objects.nonNull(tenantId) && tenantId == -1L) {
+            // 平台老师不允许扫码登录乐教通,返回机构ID
+            userInfo.setClientTypes("-1");
+        }
+        return userInfo;
+    }
+
+    public CbsQrCodeScanWrapper.QrCodeScanToken login(CbsQrCodeScanWrapper.QrCodeScanReq req) {
+        //校验是否过期
+        OAuth2Authentication auth2Authentication = customTokenServices.loadAuthentication(req.getPassword());
+        String phone = auth2Authentication.getName().split(":")[1];
+        SysUser sysUser = sysUserService.queryByPhone(phone);
+        if (sysUser == null) {
+            throw new BizException(HttpStatus.UNAUTHORIZED.value(), "用户不存在");
+        }
+        //获取需要排除的用户编号
+        String excludeUserIds = sysConfigDao.findConfigValue("exclude_user_ids");
+        if(StringUtils.isNotEmpty(excludeUserIds) && excludeUserIds.contains(sysUser.getId().toString())){
+            throw new BizException("扫码登陆失败: 用户已锁定");
+        }
+
+        // 生成6位随机数验证码
+        String code = RandomUtil.randomNumbers(6);
+        // 保存验证码
+        smsCodeService.saveVerifyValidCode(phone, code, "SMS_VERIFY_CODE_LOGIN");
+        //调用登陆接口
+        HttpResponseResult<Map<String,Object>> result = sysUserFeignService.smsLogin(phone, code,"SMS", req.getClientId(), req.getClientSecret());
+        if (result != null){
+            if(result.getCode() != 200){
+                throw new BizException("扫码登陆失败", result.getMsg());
+            }
+            CbsQrCodeScanWrapper.QrCodeScanToken qrCodeScanToken = new CbsQrCodeScanWrapper.QrCodeScanToken();
+            JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(result.getData().get("authentication")));
+            qrCodeScanToken.setTokenData(jsonObject.getString("access_token"));
+            return qrCodeScanToken;
+        }
+        throw new BizException("扫码登陆失败", "调用登陆接口失败");
+    }
+}

+ 33 - 0
cooleshow-auth/auth-server/src/main/java/com/yonge/cooleshow/auth/web/controller/OpenQrLoginController.java

@@ -0,0 +1,33 @@
+package com.yonge.cooleshow.auth.web.controller;
+
+import com.dayaedu.cbs.openfeign.wrapper.qrcode.CbsQrCodeScanWrapper;
+import com.yonge.cooleshow.auth.service.impl.CbsQrCodeScanServiceImpl;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+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 javax.annotation.Resource;
+
+@RestController
+@Api(tags = "扫码登陆")
+@RequestMapping(value = "/open")
+public class OpenQrLoginController {
+
+	@Resource
+	private CbsQrCodeScanServiceImpl cbsQrCodeScanService;
+
+	@ApiOperation(value = "获取用户信息")
+	@PostMapping(value = "/qrcode/userInfo")
+	public CbsQrCodeScanWrapper.UserInfo userInfo(@RequestBody CbsQrCodeScanWrapper.QrCodeScanUserInfoReq req) {
+		return cbsQrCodeScanService.userInfo(req);
+	}
+
+	@ApiOperation(value = "生成token")
+	@PostMapping(value = "/qrcode/login")
+	public CbsQrCodeScanWrapper.QrCodeScanToken login(@RequestBody CbsQrCodeScanWrapper.QrCodeScanReq req) {
+		return cbsQrCodeScanService.login(req);
+	}
+}

+ 0 - 2
cooleshow-auth/auth-server/src/main/java/com/yonge/cooleshow/auth/web/controller/TokenController.java

@@ -1,6 +1,5 @@
 package com.yonge.cooleshow.auth.web.controller;
 
-import cn.hutool.core.net.URLEncodeUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -46,7 +45,6 @@ import org.springframework.web.client.RestTemplate;
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import java.io.IOException;
-import java.text.MessageFormat;
 import java.util.Base64;
 import java.util.Calendar;
 import java.util.Locale;

+ 8 - 0
cooleshow-auth/pom.xml

@@ -25,4 +25,12 @@
         <module>auth-api</module>
         <module>auth-server</module>
     </modules>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.dayaedu.cbs.openfeign</groupId>
+            <artifactId>dayaedu-openfeign-api</artifactId>
+            <version>${cbs.version}</version>
+        </dependency>
+    </dependencies>
 </project>

+ 7 - 1
cooleshow-common/src/main/java/com/yonge/cooleshow/common/service/IdGeneratorService.java

@@ -23,5 +23,11 @@ public interface IdGeneratorService {
 	 */
 	boolean verifyValidCode(String mobile, String authCode,String keyEnum);
 
-
+	/**
+	 * 保存验证码
+	 * @param mobile 手机号
+	 * @param authCode 验证码
+	 * @param keyEnum 验证码类型
+	 */
+	void saveVerifyValidCode(String mobile, String authCode,String keyEnum);
 }

+ 13 - 0
cooleshow-common/src/main/java/com/yonge/cooleshow/common/service/impl/RedisIdGeneratorService.java

@@ -113,6 +113,19 @@ public class RedisIdGeneratorService implements IdGeneratorService {
 		}
     }
 
+	/**
+	 * 保存验证码
+	 *
+	 * @param mobile   手机号
+	 * @param authCode 验证码
+	 * @param keyEnum  验证码类型
+	 */
+	@Override
+	public void saveVerifyValidCode(String mobile, String authCode, String keyEnum) {
+		String key = "verificationCode" + keyEnum + mobile;
+		// 验证码有效性:10分钟
+		redisCache.put(key, authCode, 600);
+	}
 
 
 }

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

@@ -11,7 +11,7 @@ import com.yonge.toolset.base.enums.BaseEnum;
  */
 public enum SubjectTypeEnum implements BaseEnum<String, SubjectTypeEnum> {
 
-
+    // 专辑类型 ENSEMBLE:合奏 MUSIC:小曲目 SUBJECT:声部 COURSEWARE:课件
     ENSEMBLE("合奏"),
     MUSIC("小曲目"),
     SUBJECT("声部"),

+ 25 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/cbs/impl/CbsQrCodeScanServiceImpl.java

@@ -0,0 +1,25 @@
+package com.yonge.cooleshow.biz.dal.service.cbs.impl;
+
+import com.dayaedu.cbs.openfeign.service.CbsQrCodeScanService;
+import com.dayaedu.cbs.openfeign.wrapper.qrcode.CbsQrCodeScanWrapper;
+import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+
+@Service
+public class CbsQrCodeScanServiceImpl implements CbsQrCodeScanService {
+
+    @Resource
+    private SysUserFeignService sysUserFeignService;
+
+    @Override
+    public CbsQrCodeScanWrapper.UserInfo userInfo(CbsQrCodeScanWrapper.QrCodeScanUserInfoReq req) {
+        return sysUserFeignService.userInfo(req);
+    }
+
+    @Override
+    public CbsQrCodeScanWrapper.QrCodeScanToken login(CbsQrCodeScanWrapper.QrCodeScanReq req) {
+        return sysUserFeignService.login(req);
+    }
+}

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

@@ -926,11 +926,14 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
         record.setTitleImg(musicSheetApplication.getMusicCover());
     }
 
-
     public void initMusicSheetVos(List<MusicSheetVo> records) {
+        initMusicSheetVos(records,SourceTypeEnum.PLATFORM);
+    }
+
+    public void initMusicSheetVos(List<MusicSheetVo> records,SourceTypeEnum sourceTypeEnum) {
         if(CollectionUtils.isNotEmpty(records)){
             List<Long> cbsMusicSheetIds = records.stream().map(e -> e.getCbsMusicSheetId()).collect(Collectors.toList());
-            CbsMusicSheetWrapper.MusicSheetApplicationQuery query = this.getMusicSheetApplicationQuery();
+            CbsMusicSheetWrapper.MusicSheetApplicationQuery query = this.getMusicSheetApplicationQuery(sourceTypeEnum);
             query.setRows(cbsMusicSheetIds.size());
             query.setMusicSheetIds(cbsMusicSheetIds);
             List<CbsMusicSheetWrapper.MusicSheetApplication> rows = this.queryCbsMusicSheetApplication(query);
@@ -953,7 +956,7 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
     public IPage<MusicSheetVo> selectStudentPage(IPage<MusicSheetVo> page, StudentMusicSheetSearch query, ClientEnum clientType) {
         List<MusicSheetVo> records = baseMapper.selectStudentMusicPage(page, query, clientType);
         //设置内容平台曲目信息
-        this.initMusicSheetVos(records);
+        this.initMusicSheetVos(records,query.getProviderType());
         if (CollectionUtils.isNotEmpty(records)) {
 
             // 统计单曲归属专辑数
@@ -2469,7 +2472,7 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
         query.setDelFlag(true);
         query.setPage(1);
         query.setAudioPlayTypeFlag(false);
-        if (sourceType == SourceTypeEnum.PLATFORM) {
+        if (sourceType == null || sourceType == SourceTypeEnum.PLATFORM) {
             query.setApplicationId(applicationId);
         } else {
             query.setApplicationId(Long.parseLong(sysConfigService.findConfigValue(SysConfigConstant.CBS_TENANT_APP_ID)));

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

@@ -201,7 +201,7 @@ public class TenantAlbumMusicServiceImpl extends ServiceImpl<TenantAlbumMusicMap
                     studentTenantAlbumMusic.setTitleImg(row.getCoverImg());
                     studentTenantAlbumMusic.setMusicSubject(row.getCourseTypeCode());
                     studentTenantAlbumMusic.setMusicSubjectName(ECourseType.valueOf(row.getCourseTypeCode()).getName());
-                    musicSheets.add(studentTenantAlbumMusic);
+                    musicSheets.add(studentTenantAlbumMusic.courseNum(row.getCourseNum()).unitTestNum(row.getUnitTestNum()));
 
                 }
 
@@ -422,7 +422,7 @@ public class TenantAlbumMusicServiceImpl extends ServiceImpl<TenantAlbumMusicMap
             } else {
                 List<Long> useAlbumIdsByUserId = userTenantAlbumRecordService.getUseAlbumIdsByUserId(query.getUserId(), query.getClient());
                 if (CollectionUtils.isNotEmpty(useAlbumIdsByUserId)) {
-                    List<Long> list = tenantAlbumMusicService.getTenantAlbumMusicIdsByIds(useAlbumIdsByUserId, Arrays.asList(SubjectTypeEnum.COURSEWARE));
+                    List<Long> list = tenantAlbumMusicService.getTenantAlbumMusicIdsByIds(useAlbumIdsByUserId, Collections.singletonList(SubjectTypeEnum.COURSEWARE));
                     if (list.contains(query.getLessonCoursewareId())) {
                         lessonCoursewareDto.setPlay(true);
                     }

+ 17 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/wrapper/TenantAlbumMusicWrapper.java

@@ -81,9 +81,11 @@ public class TenantAlbumMusicWrapper {
     public static class TenantAlbumMusicSelect {
 
         @ApiModelProperty("专辑ID")
+        @NotNull(message = "专辑ID不能为空")
         private Long tenantAlbumId;
 
         @ApiModelProperty("声部分类(ENSEMBLE, MUSIC, SUBJECT)")
+        @NotNull(message = "分类不能为空")
         private SubjectTypeEnum subjectType;
 
         @ApiModelProperty(value = "用户ID", hidden = true)
@@ -253,6 +255,12 @@ public class TenantAlbumMusicWrapper {
         @ApiModelProperty("声谱类型,SINGLE:单曲,CONCERT:合奏")
         private String musicSheetType;
 
+        @ApiModelProperty("课时数")
+        private Integer courseNum;
+
+        @ApiModelProperty("单元测验数量")
+        private Integer unitTestNum;
+
         public String jsonString() {
             return JSON.toJSONString(this);
         }
@@ -261,6 +269,15 @@ public class TenantAlbumMusicWrapper {
             return JSON.parseObject(json, TenantAlbumMusic.class);
         }
 
+        public StudentTenantAlbumMusic unitTestNum(Integer unitTestNum) {
+            this.unitTestNum = unitTestNum;
+            return this;
+        }
+
+        public StudentTenantAlbumMusic courseNum(Integer courseNum) {
+            this.courseNum = courseNum;
+            return this;
+        }
     }
 
 }

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

@@ -97,6 +97,7 @@
                 </foreach>
             </if>
         </where>
+        order by t.id_ desc
     </select>
 
     <select id="countGroupAlbumByGroupId" resultType="com.yonge.cooleshow.biz.dal.wrapper.TenantGroupAlbumWrapper$TenantGroupAlbumCount">