浏览代码

fix机构激活码

Eric 1 年之前
父节点
当前提交
558cbebd24

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

@@ -2,6 +2,7 @@ package com.yonge.cooleshow.tenant.controller;
 
 import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.google.common.collect.Lists;
 import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
 import com.yonge.cooleshow.auth.api.entity.SysUser;
 import com.yonge.cooleshow.biz.dal.dto.search.StudentSearch;
@@ -45,6 +46,7 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Optional;
 import java.util.stream.Collectors;
 
 @RestController
@@ -81,17 +83,17 @@ public class StudentController extends BaseController {
         IPage<StudentVo> pages = studentService.selectPage(PageUtil.getPage(query), query);
         List<StudentVo> rows = pages.getRecords();
 
-        Map<Long, List<TenantActivationCode>> groupByUserId = new HashMap<>();
+        Map<String, List<TenantActivationCode>> groupByUserId = new HashMap<>();
         if (!rows.isEmpty() && query.getTenantAlbumPurchaseId() != null) {
-            List<Long> studentIdList = rows.stream().map(Student::getUserId).collect(Collectors.toList());
+            List<String> studentIdList = rows.stream().map(StudentVo::getPhone).collect(Collectors.toList());
              groupByUserId = tenantActivationCodeService.lambdaQuery()
                     .eq(TenantActivationCode::getTenantAlbumPurchaseId, query.getTenantAlbumPurchaseId())
-                    .in(TenantActivationCode::getActivationUserId, studentIdList)
-                    .list().stream().collect(Collectors.groupingBy(TenantActivationCode::getActivationUserId));
+                    .in(TenantActivationCode::getActivationPhone, studentIdList)
+                    .list().stream().collect(Collectors.groupingBy(TenantActivationCode::getActivationPhone));
         }
 
         for (StudentVo vo : rows) {
-            vo.setSendActiveCodeNum(groupByUserId.getOrDefault(vo.getUserId(), new ArrayList<>()).size());
+            vo.setSendActiveCodeNum(groupByUserId.getOrDefault(Optional.ofNullable(vo.getPhone()).orElse(""), Lists.newArrayList()).size());
             if (StringUtils.isNotEmpty(vo.getPhone())) {
                 vo.setPhone(vo.getPhone().replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2"));
             }

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

@@ -23,7 +23,7 @@
         <include refid="baseColumns"/>, ta.purchase_cycle_ as purchaseCycle, su.username_ as activationUserName
         FROM tenant_activation_code t
         LEFT JOIN tenant_album_purchase ta on t.tenant_album_purchase_id_ = ta.id_
-        LEFT JOIN sys_user su on t.activation_user_id_ = su.id_
+        LEFT JOIN sys_user su on t.activation_phone_ = su.phone_
         <if test="param.orderNo != null and param.orderNo != ''">
             left join tenant_album_purchase t4 on t4.id_ = t.tenant_album_purchase_id_
         </if>