Browse Source

Merge branch 'feature/0124' of http://git.dayaedu.com/yonge/cooleshow into feature/0124

刘俊驰 1 năm trước cách đây
mục cha
commit
1014b23957
15 tập tin đã thay đổi với 187 bổ sung55 xóa
  1. 5 0
      cooleshow-app/src/main/java/com/yonge/cooleshow/admin/controller/StudentController.java
  2. 1 4
      cooleshow-app/src/main/java/com/yonge/cooleshow/admin/controller/TenantAlbumController.java
  3. 3 7
      cooleshow-app/src/main/java/com/yonge/cooleshow/admin/controller/TenantGroupAlbumController.java
  4. 5 0
      cooleshow-app/src/main/java/com/yonge/cooleshow/tenant/controller/StudentController.java
  5. 36 0
      cooleshow-auth/auth-server/src/main/resources/logback-test.xml
  6. 10 11
      cooleshow-common/src/main/java/com/yonge/cooleshow/common/service/impl/RedisIdGeneratorService.java
  7. 3 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/mapper/TenantGroupAlbumMapper.java
  8. 2 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/TenantAlbumService.java
  9. 2 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/TenantGroupAlbumService.java
  10. 18 12
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/TenantActivationCodeServiceImpl.java
  11. 38 5
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/TenantAlbumServiceImpl.java
  12. 41 5
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/TenantGroupAlbumServiceImpl.java
  13. 5 11
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/TenantGroupServiceImpl.java
  14. 9 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/wrapper/TenantGroupAlbumWrapper.java
  15. 9 0
      cooleshow-user/user-biz/src/main/resources/config/mybatis/TenantGroupAlbumMapper.xml

+ 5 - 0
cooleshow-app/src/main/java/com/yonge/cooleshow/admin/controller/StudentController.java

@@ -36,6 +36,7 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
+import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -134,6 +135,10 @@ public class StudentController extends BaseController {
                     .eq(TenantGroupAlbum::getDelFlag, false)
                     .eq(TenantGroupAlbum::getStatus, true)
                     .list().stream().map(TenantGroupAlbum::getTenantGroupId).map(String::valueOf).distinct().collect(Collectors.toList());
+            if (CollectionUtils.isEmpty(tenantGroupIds)) {
+                // 没有小组
+                return succeed(PageUtil.getPageInfo(PageUtil.getPage(query), new ArrayList<>()));
+            }
             query.setTenantGroupId(String.join(",", tenantGroupIds));
         }
 

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

@@ -272,10 +272,7 @@ public class TenantAlbumController {
     @ApiOperation(value = "启用/冻结", notes = "启用/冻结")
     @PreAuthorize("@pcs.hasPermissions('tenantAlbum/updateStatus')")
     public HttpResponseResult<Boolean> updateStatus(@Validated @RequestBody TenantAlbumVo.UpdateStatus status) {
-        tenantAlbumService.lambdaUpdate()
-                .set(TenantAlbum::getStatus, status.getStatus())
-                .eq(TenantAlbum::getId, status.getId())
-                .update();
+        tenantAlbumService.updateStatus(status.getId(), status.getStatus());
         return HttpResponseResult.succeed();
     }
 

+ 3 - 7
cooleshow-app/src/main/java/com/yonge/cooleshow/admin/controller/TenantGroupAlbumController.java

@@ -101,14 +101,10 @@ public class TenantGroupAlbumController {
     }
 
     @ApiOperation(value = "删除", notes = "机构小组专辑配置表- 传入id")
-    @PreAuthorize("@pcs.hasPermissions('tenantGroupAlbum/remove', {'BACKEND'})")
+    @PreAuthorize("@pcs.hasPermissions('tenantGroupAlbum/updateStatus', {'BACKEND'})")
     @PostMapping("/updateStatus")
-    public R<Boolean> remove(@RequestBody TenantGroupAlbumWrapper.UpdateStatus updateStatus) {
-        List<Long> ids = Arrays.stream(updateStatus.getIds().split(",")).map(Long::valueOf).collect(Collectors.toList());
-        tenantGroupAlbumService.lambdaUpdate()
-                .set(TenantGroupAlbum::getStatus, updateStatus.getStatus())
-                .in(TenantGroupAlbum::getId, ids)
-                .update();
+    public R<Boolean> updateStatus(@RequestBody TenantGroupAlbumWrapper.UpdateStatus updateStatus) {
+        tenantGroupAlbumService.updateStatus(updateStatus);
         return R.from(true);
     }
 }

+ 5 - 0
cooleshow-app/src/main/java/com/yonge/cooleshow/tenant/controller/StudentController.java

@@ -40,6 +40,7 @@ import com.yonge.toolset.utils.easyexcel.ExcelUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
@@ -119,6 +120,10 @@ public class StudentController extends BaseController {
                     .eq(TenantGroupAlbum::getDelFlag, false)
                     .eq(TenantGroupAlbum::getStatus, true)
                     .list().stream().map(TenantGroupAlbum::getTenantGroupId).map(String::valueOf).distinct().collect(Collectors.toList());
+            if (CollectionUtils.isEmpty(tenantGroupIds)) {
+                // 没有小组
+                return succeed(PageUtil.getPageInfo(PageUtil.getPage(query), new ArrayList<>()));
+            }
             query.setTenantGroupId(String.join(",", tenantGroupIds));
         }
 

+ 36 - 0
cooleshow-auth/auth-server/src/main/resources/logback-test.xml

@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration scan="true" scanPeriod="10 seconds">
+
+	<property name="LOG_HOME" value="/mdata/cooleshow-test/jenkins/logs/auth-%d{yyyy-MM-dd_HH}-%i.log" />
+	<property name="CONSOLE_LOG_PATTERN"
+		value="[%X{username} %X{ip} %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36}] : %msg%n" />
+
+	<appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
+		<encoder charset="UTF-8">
+			<pattern>${CONSOLE_LOG_PATTERN}</pattern>
+		</encoder>
+	</appender>
+
+	<appender name="file"
+		class="ch.qos.logback.core.rolling.RollingFileAppender">
+		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+			<FileNamePattern>${LOG_HOME}</FileNamePattern>
+			<MaxHistory>90</MaxHistory>
+			<TimeBasedFileNamingAndTriggeringPolicy
+				class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+				<MaxFileSize>20MB</MaxFileSize>
+			</TimeBasedFileNamingAndTriggeringPolicy>
+		</rollingPolicy>
+
+		<encoder>
+			<pattern>${CONSOLE_LOG_PATTERN}</pattern>
+		</encoder>
+	</appender>
+
+	<logger name="com.yonge" level="INFO" />
+	<root level="INFO">
+		<appender-ref ref="stdout" />
+		<appender-ref ref="file" />
+	</root>
+
+</configuration>

+ 10 - 11
cooleshow-common/src/main/java/com/yonge/cooleshow/common/service/impl/RedisIdGeneratorService.java

@@ -98,21 +98,20 @@ public class RedisIdGeneratorService implements IdGeneratorService {
 
 	@Override
 	public boolean verifyValidCode(String mobile, String authCode,String keyEnum) {
+
+		// 验证码验证
+		String key = "verificationCode" + keyEnum + mobile;
+		Object object = redisCache.get(key);
+		String verifyCode = object == null ? null : object.toString();
 		if (debugMode || this.authCode) {
-			if (defaultPwd.equals(authCode)) {
-				return true;
-			}
+            return defaultPwd.equals(authCode)
+                || (StringUtils.isNoneEmpty(verifyCode) && StringUtils.equalsIgnoreCase(verifyCode, authCode));
 		} else {
-			String key = "verificationCode" + keyEnum + mobile;
-			Object object = redisCache.get(key);
+
 			log.info("*********************mobile:{} smsCode:{} inutCode:{}******************", key, object, authCode);
-			String verifyCode = object == null ? null : object.toString();
-			if (StringUtils.isNoneEmpty(verifyCode) && StringUtils.equalsIgnoreCase(verifyCode, authCode)) {
-				return true;
-			}
+            return StringUtils.isNoneEmpty(verifyCode) && StringUtils.equalsIgnoreCase(verifyCode, authCode);
 		}
-		return false;
-	}
+    }
 
 
 

+ 3 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/mapper/TenantGroupAlbumMapper.java

@@ -1,6 +1,7 @@
 package com.yonge.cooleshow.biz.dal.mapper;
 
 import java.util.List;
+import java.util.Map;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -26,4 +27,6 @@ public interface TenantGroupAlbumMapper extends BaseMapper<TenantGroupAlbum> {
 
 
     List<TenantGroupAlbumWrapper.BuyTenantAlbum> getBuyAlbumInfo(@Param("param") TenantGroupAlbumWrapper.BuyTenantAlbumQuery query);
+
+	List<TenantGroupAlbumWrapper.TenantGroupAlbumCount> countGroupAlbumByGroupId(@Param("ids") String ids);
 }

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

@@ -79,6 +79,8 @@ public interface TenantAlbumService extends IService<TenantAlbum>  {
      */
     List<TenantAlbum> getByTenantId(Long tenantId,Boolean status);
 
+    void updateStatus(Long id, Boolean status);
+
 
     /**
      * 添加机构专辑数据

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

@@ -51,4 +51,6 @@ public interface TenantGroupAlbumService extends IService<TenantGroupAlbum>  {
      * @param clientType         客户端类型
      */
     List<TenantGroupAlbumWrapper.BuyTenantAlbum> buyAlbumInfo(Long tenantGroupAlbumId, Long userId, ClientEnum clientType);
+
+    void updateStatus(TenantGroupAlbumWrapper.UpdateStatus updateStatus);
 }

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

@@ -215,22 +215,28 @@ public class TenantActivationCodeServiceImpl extends ServiceImpl<TenantActivatio
         if (code == null) {
             throw new BizException("激活码不存在");
         }
+
+        // 线下发放,有账号,则校验机构
+        if (EActivationCode.WAIT.equals(code.getSendStatus())) {
+            // 校验该激活码的来源小组专辑是否和该学生的小组是一致
+            Long tenantAlbumId = code.getTenantAlbumId();
+            List<Long> tenantGroupIds = tenantGroupAlbumService.lambdaQuery()
+                    .eq(TenantGroupAlbum::getTenantAlbumId, tenantAlbumId)
+                    .eq(TenantGroupAlbum::getStatus, true)
+                    .eq(TenantGroupAlbum::getDelFlag, false)
+                    .list().stream().map(TenantGroupAlbum::getTenantGroupId).distinct().collect(Collectors.toList());
+            if (!tenantGroupIds.contains(student.getTenantGroupId())) {
+                throw new BizException("激活码不可用");
+            }
+        }
+
         SysUser sysUser = sysUserService.getDao().selectById(studentId);
+        // 如果码已经激活或者发放给别人
         if (Boolean.TRUE.equals(code.getActivationStatus()) || (EActivationCode.SEND.equals(code.getSendStatus()) &&
                 !sysUser.getPhone().equals(code.getActivationPhone()))) {
             throw new BizException("激活码已经被使用");
         }
 
-        // 校验该激活码的来源小组专辑是否和该学生改的小组是一致
-        Long tenantAlbumId = code.getTenantAlbumId();
-        List<Long> tenantGroupIds = tenantGroupAlbumService.lambdaQuery()
-                .eq(TenantGroupAlbum::getTenantAlbumId, tenantAlbumId)
-                .eq(TenantGroupAlbum::getStatus, true)
-                .eq(TenantGroupAlbum::getDelFlag, false)
-                .list().stream().map(TenantGroupAlbum::getTenantGroupId).distinct().collect(Collectors.toList());
-        if (!tenantGroupIds.contains(student.getTenantGroupId())) {
-            throw new BizException("激活码不可用");
-        }
 
         // 通过状态和ID同时判断更新是否存在竞争
         boolean update = this.lambdaUpdate()
@@ -547,8 +553,8 @@ public class TenantActivationCodeServiceImpl extends ServiceImpl<TenantActivatio
             String phone = template.getPhone();
             if (StringUtils.isNotEmpty(phone)) {
                 if (!Pattern.matches(PHONE_REG, phone.trim()) ||
-                        (mapStudentByPhone.containsKey(phone) && (!mapStudentByPhone.get(phone).getTenantId().equals(tenantId)) ||
-                                tenantGroupIds.contains(mapStudentByPhone.get(phone).getTenantGroupId()))) {
+                        (mapStudentByPhone.containsKey(phone) && ((!mapStudentByPhone.get(phone).getTenantId().equals(tenantId)) ||
+                                !tenantGroupIds.contains(mapStudentByPhone.get(phone).getTenantGroupId())))) {
                     phone_err_lines.add(msgRowNo);
                 }
             }

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

@@ -1,17 +1,22 @@
 package com.yonge.cooleshow.biz.dal.service.impl;
 
 import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.core.toolkit.IdWorker;
-import com.baomidou.mybatisplus.extension.service.additional.query.impl.LambdaQueryChainWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.beust.jcommander.internal.Lists;
 import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
 import com.yonge.cooleshow.auth.api.entity.SysUser;
 import com.yonge.cooleshow.biz.dal.dao.UserOrderDao;
 import com.yonge.cooleshow.biz.dal.entity.*;
-import com.yonge.cooleshow.biz.dal.enums.*;
+import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
+import com.yonge.cooleshow.biz.dal.enums.InOrOutEnum;
+import com.yonge.cooleshow.biz.dal.enums.MessageTypeEnum;
+import com.yonge.cooleshow.biz.dal.enums.OrderStatusEnum;
+import com.yonge.cooleshow.biz.dal.enums.OrderTypeEnum;
+import com.yonge.cooleshow.biz.dal.enums.SourceTypeEnum;
 import com.yonge.cooleshow.biz.dal.mapper.TenantAlbumMapper;
+import com.yonge.cooleshow.biz.dal.mapper.TenantGroupAlbumMapper;
 import com.yonge.cooleshow.biz.dal.service.*;
 import com.yonge.cooleshow.biz.dal.vo.UserOrderDetailVo;
 import com.yonge.cooleshow.biz.dal.wrapper.TenantAlbumWrapper;
@@ -30,8 +35,15 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
-import java.util.*;
-import java.util.concurrent.CompletableFuture;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.stream.Collectors;
 
@@ -97,6 +109,9 @@ public class TenantAlbumServiceImpl extends ServiceImpl<TenantAlbumMapper, Tenan
     @Autowired
     private UserOrderDao userOrderDao;
 
+    @Autowired
+    private TenantGroupAlbumMapper tenantGroupAlbumMapper;
+
     /**
      * 查询详情
      *
@@ -620,6 +635,24 @@ public class TenantAlbumServiceImpl extends ServiceImpl<TenantAlbumMapper, Tenan
 
     }
 
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public void updateStatus(Long id, Boolean status) {
+        tenantAlbumService.lambdaUpdate()
+                .set(TenantAlbum::getStatus, status)
+                .eq(TenantAlbum::getId, id)
+                .update();
+
+        if (Boolean.FALSE.equals(status)) {
+            UpdateWrapper<TenantGroupAlbum> queryWrapper = new UpdateWrapper<>();
+            queryWrapper.lambda()
+                    .set(TenantGroupAlbum::getStatus, false)
+                    .eq(TenantGroupAlbum::getTenantAlbumId, id)
+                    .eq(TenantGroupAlbum::getDelFlag, false);
+            tenantGroupAlbumMapper.update(null, queryWrapper);
+        }
+    }
+
     private void insertAlbumMusic(Long tenantId, TenantAlbum tenantAlbum,
                                   List<TenantAlbumWrapper.MusicSheetData> musicSheetDataList) {
         //曲目表赋值

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

@@ -4,19 +4,30 @@ import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.yonge.cooleshow.biz.dal.dao.UserOrderDao;
-import com.yonge.cooleshow.biz.dal.entity.*;
+import com.yonge.cooleshow.biz.dal.entity.Student;
+import com.yonge.cooleshow.biz.dal.entity.Teacher;
+import com.yonge.cooleshow.biz.dal.entity.TenantAlbum;
+import com.yonge.cooleshow.biz.dal.entity.TenantAlbumMusic;
+import com.yonge.cooleshow.biz.dal.entity.TenantGroupAlbum;
+import com.yonge.cooleshow.biz.dal.entity.TenantStaff;
 import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
 import com.yonge.cooleshow.biz.dal.enums.SubjectTypeEnum;
 import com.yonge.cooleshow.biz.dal.mapper.TenantAlbumMusicMapper;
-import com.yonge.cooleshow.biz.dal.service.*;
+import com.yonge.cooleshow.biz.dal.mapper.TenantGroupAlbumMapper;
+import com.yonge.cooleshow.biz.dal.service.StudentService;
+import com.yonge.cooleshow.biz.dal.service.TeacherService;
+import com.yonge.cooleshow.biz.dal.service.TenantAlbumService;
+import com.yonge.cooleshow.biz.dal.service.TenantGroupAlbumService;
+import com.yonge.cooleshow.biz.dal.service.TenantStaffService;
+import com.yonge.cooleshow.biz.dal.wrapper.TenantGroupAlbumWrapper;
 import com.yonge.toolset.base.exception.BizException;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import lombok.extern.slf4j.Slf4j;
-import com.yonge.cooleshow.biz.dal.wrapper.TenantGroupAlbumWrapper;
-import com.yonge.cooleshow.biz.dal.mapper.TenantGroupAlbumMapper;
+import org.springframework.transaction.annotation.Transactional;
 
+import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
@@ -44,6 +55,9 @@ public class TenantGroupAlbumServiceImpl extends ServiceImpl<TenantGroupAlbumMap
     @Autowired
     private TeacherService teacherService;
 
+    @Autowired
+    private TenantAlbumService tenantAlbumService;
+
 	/**
      * 查询详情
      * @param id 详情ID
@@ -160,4 +174,26 @@ public class TenantGroupAlbumServiceImpl extends ServiceImpl<TenantGroupAlbumMap
 
         return buyAlbumInfo;
     }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public void updateStatus(TenantGroupAlbumWrapper.UpdateStatus updateStatus) {
+        List<Long> ids = Arrays.stream(updateStatus.getIds().split(",")).map(Long::valueOf).collect(Collectors.toList());
+        List<TenantGroupAlbum> tenantGroupAlbumList = this.lambdaQuery().in(TenantGroupAlbum::getId, ids).list();
+        if (CollectionUtils.isEmpty(tenantGroupAlbumList)) {
+            return;
+        }
+        List<Long> tenantAlbumIds = tenantGroupAlbumList.stream().map(TenantGroupAlbum::getTenantAlbumId).distinct().collect(Collectors.toList());
+        List<TenantAlbum> list = tenantAlbumService.lambdaQuery()
+                .in(TenantAlbum::getId, tenantAlbumIds)
+                .eq(TenantAlbum::getDelFlag, false)
+                .list();
+        if (list.stream().anyMatch(next -> Boolean.FALSE.equals(next.getStatus()))) {
+            throw new BizException("专辑已经停用");
+        }
+        this.lambdaUpdate()
+                .set(TenantGroupAlbum::getStatus, updateStatus.getStatus())
+                .in(TenantGroupAlbum::getId, ids)
+                .update();
+    }
 }

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

@@ -33,6 +33,7 @@ import com.yonge.cooleshow.biz.dal.service.TenantGroupService;
 import com.yonge.cooleshow.biz.dal.service.im.ImGroupCoreService;
 import com.yonge.cooleshow.biz.dal.vo.StudentVo;
 import com.yonge.cooleshow.biz.dal.wrapper.StudentWrapper;
+import com.yonge.cooleshow.biz.dal.wrapper.TenantGroupAlbumWrapper;
 import com.yonge.cooleshow.biz.dal.wrapper.TenantGroupWrapper;
 import com.yonge.cooleshow.biz.dal.wrapper.im.ImGroupWrapper;
 import com.yonge.toolset.base.exception.BizException;
@@ -118,17 +119,10 @@ public class TenantGroupServiceImpl extends ServiceImpl<TenantGroupMapper, Tenan
             List<Long> adminIdList = records.stream().map(TenantGroupWrapper.TenantGroup::getAdminId).distinct().collect(Collectors.toList());
             Map<Long, com.yonge.cooleshow.biz.dal.entity.SysUser> mapByIds = sysUserService.getMapByIds(adminIdList);
 
-            List<Long> ids = records.stream().map(TenantGroupWrapper.TenantGroup::getId).collect(Collectors.toList());
-            QueryWrapper<TenantGroupAlbum> queryWrapper = new QueryWrapper<>();
-            queryWrapper.select("count(*) as count,tenant_group_id_ as tenantGroupId");
-            queryWrapper.lambda().in(TenantGroupAlbum::getTenantGroupId, ids);
-            queryWrapper.groupBy("tenant_group_id_");
-            List<Map<String, Object>> maps = tenantGroupAlbumMapper.selectMaps(queryWrapper);
-            Map<Long, Integer> countByGroupId = new HashMap<>();
-            maps.forEach(next -> {
-                JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(next));
-                countByGroupId.put(jsonObject.getLong("tenantGroupId"), jsonObject.getInteger("count"));
-            });
+            String ids = records.stream().map(TenantGroupWrapper.TenantGroup::getId).map(String::valueOf).collect(Collectors.joining(","));
+            Map<Long, Integer> countByGroupId = tenantGroupAlbumMapper.countGroupAlbumByGroupId(ids).stream().collect(Collectors.toMap(TenantGroupAlbumWrapper.TenantGroupAlbumCount::getTenantGroupId
+                    , TenantGroupAlbumWrapper.TenantGroupAlbumCount::getCount));
+
             for (TenantGroupWrapper.TenantGroup record : records) {
                 record.setGroupUserCount(groupBy.getOrDefault(record.getId(), 0));
                 record.setImGroupExist(existImgGroupIds.contains(record.getImGroupId()));

+ 9 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/wrapper/TenantGroupAlbumWrapper.java

@@ -278,4 +278,13 @@ public class TenantGroupAlbumWrapper {
         }
     }
 
+
+    @Data
+    public static class TenantGroupAlbumCount {
+
+        private Long tenantGroupId;
+
+        private Integer count;
+    }
+
 }

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

@@ -98,4 +98,13 @@
             </if>
         </where>
     </select>
+
+    <select id="countGroupAlbumByGroupId" resultType="com.yonge.cooleshow.biz.dal.wrapper.TenantGroupAlbumWrapper$TenantGroupAlbumCount">
+        select t.tenant_group_id_ as tenantGroupId, count(1) as count
+        from tenant_group_album t
+        where find_in_set(t.tenant_group_id_, #{ids})
+          and t.del_flag_ = 0
+          and t.status_ = 1
+        group by t.tenant_group_id_
+    </select>
 </mapper>