浏览代码

Merge branch 'feature/0721-tenant' of http://git.dayaedu.com/yonge/cooleshow into feature/0721-tenant

liujc 1 年之前
父节点
当前提交
e11c8b9d4e

+ 3 - 2
cooleshow-user/user-admin/src/main/java/com/yonge/cooleshow/admin/controller/TenantAlbumController.java

@@ -18,6 +18,7 @@ import com.yonge.toolset.base.page.PageInfo;
 import com.yonge.toolset.mybatis.support.PageUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -142,7 +143,7 @@ public class TenantAlbumController {
             tenantAlbumSheets.stream().forEach(t->{
                 String musicSubject = t.getMusicSubject();
 
-                if (!musicSubject.isEmpty()){
+                if (StringUtils.isNotBlank(musicSubject)){
                     //设置对应声部名称
                     List<Subject> subject = subjectService.findBySubjectByIdList(musicSubject);
                     t.setMusicSubjectName(subject.get(0).getName());
@@ -151,7 +152,7 @@ public class TenantAlbumController {
 
                 //设置对应标签名称
                 String musicTag = t.getMusicTag();
-                if (!musicTag.isEmpty()){
+                if (StringUtils.isNotBlank(musicTag)){
                     String[] split = musicTag.split(",");
                     for (String s : split) {
                         List<Long> list = new ArrayList<>();

+ 5 - 24
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/StudentTrainOverviewDto.java

@@ -1,11 +1,13 @@
 package com.yonge.cooleshow.biz.dal.dto;
 
 import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
 
 /**
  * @Author Joburgess
  * @Date 2021/8/11 0011
  */
+@Data
 public class StudentTrainOverviewDto {
 
     @ApiModelProperty("训练天数")
@@ -14,30 +16,9 @@ public class StudentTrainOverviewDto {
     @ApiModelProperty("训练时长")
     private int trainTime = 0;
 
+    @ApiModelProperty("平均训练时长")
+    private int avgTrainTime = 0;
+
     @ApiModelProperty("训练次数")
     private int trainNum = 0;
-
-    public int getTrainDays() {
-        return trainDays;
-    }
-
-    public void setTrainDays(int trainDays) {
-        this.trainDays = trainDays;
-    }
-
-    public int getTrainTime() {
-        return trainTime;
-    }
-
-    public void setTrainTime(int trainTime) {
-        this.trainTime = trainTime;
-    }
-
-    public int getTrainNum() {
-        return trainNum;
-    }
-
-    public void setTrainNum(int trainNum) {
-        this.trainNum = trainNum;
-    }
 }

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

@@ -310,7 +310,7 @@ public class SysMusicCompareRecordServiceImpl extends BaseServiceImpl<Long, SysM
 																				queryInfo.getEndTime(),queryInfo.getClientId());
 		}
 
-		if(CollectionUtils.isEmpty(userTrainChartData)||userTrainChartData.size()!=7){
+		if(CollectionUtils.isEmpty(userTrainChartData) || userTrainChartData.size() < 7){
 			Set<LocalDate> trainDates = userTrainChartData.stream().map(StudentTrainChartDto::getTrainDate).collect(Collectors.toSet());
 			LocalDate startLocalDate = LocalDate.parse(queryInfo.getStartTime(), DateUtil.dateFormatter);
 			for (int i = 1; i <= 7; i++) {
@@ -340,6 +340,7 @@ public class SysMusicCompareRecordServiceImpl extends BaseServiceImpl<Long, SysM
 		pageInfo.setRows(dataList);
 		Map<String, Object> result = new HashMap<>();
 		userTrainOverView.setTrainTime(userTrainOverView.getTrainTime()/60);
+		userTrainOverView.setAvgTrainTime(userTrainOverView.getTrainTime() / userTrainOverView.getTrainDays());
 		result.put("userTrainOverView",userTrainOverView);
 
 		List<IndexBaseDto> userTrainChartResult = new ArrayList<>();

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

@@ -173,6 +173,9 @@ public class TenantAlbumMusicWrapper {
         @AllArgsConstructor
         @ApiModel(" TenantAlbumMusic-学生端专辑曲目返回")
         public static class StudentTenantAlbumMusic implements QueryInfo {
+            @ApiModelProperty(value = "曲目表id")
+            private Long id;
+
             @ApiModelProperty(value = "精品标志")
             private String exquisiteFlag;
 

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

@@ -19,6 +19,7 @@
     
     <select id="selectPage" resultType="com.yonge.cooleshow.biz.dal.wrapper.TenantAlbumMusicWrapper$StudentTenantAlbumMusic">
 		SELECT
+        m.id_ as id,
         m.music_sheet_name_ as musicSheetName,
         m.composer_ as composer,
         m.user_id_ as userId,

+ 9 - 9
cooleshow-user/user-tenant/src/main/java/com/yonge/cooleshow/tenant/controller/open/OpenTenantController.java

@@ -110,15 +110,15 @@ public class OpenTenantController {
             }
         }
 
-//        Long tenantId = tenantStaff.getTenantId();
-//        TenantInfo tenantInfo = tenantInfoService.getById(tenantId);
-//        if(tenantInfo == null){
-//            throw new BizException("机构不存在");
-//        }
-//        if (Boolean.FALSE.equals(tenantInfo.getEnableFlag())) {
-//            String configValue = sysConfigService.findConfigValue("customer_service_phone");
-//            throw new BizException(5004, "机构已停用,请联系客服/n" + (StringUtils.isEmpty(configValue) ? "" : configValue));
-//        }
+        Long tenantId = tenantStaff.getTenantId();
+        TenantInfo tenantInfo = tenantInfoService.getById(tenantId);
+        if(tenantInfo == null){
+            throw new BizException("机构不存在");
+        }
+        if (Boolean.FALSE.equals(tenantInfo.getEnableFlag())) {
+            // 机构冻结
+            throw new BizException(5004, openId);
+        }
         tenantStaff.setWxOpenid(openId);
         tenantStaffService.updateById(tenantStaff);
         return HttpResponseResult.succeed();