Selaa lähdekoodia

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

liujc 1 vuosi sitten
vanhempi
commit
e4c043265d

+ 9 - 8
cooleshow-app/src/main/java/com/yonge/cooleshow/tenant/controller/StudentController.java

@@ -47,6 +47,7 @@ import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.multipart.MultipartFile;
 
+import javax.annotation.Resource;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -60,13 +61,12 @@ import java.util.stream.Collectors;
 @RequestMapping("${app-config.url.tenant:}/student")
 @Api(value = "学生表", tags = "学生表")
 public class StudentController extends BaseController {
+
     @Autowired
     private StudentService studentService;
-
     @Autowired
     private TeacherService teacherService;
-
-    @Autowired
+    @Resource
     private SysUserFeignService sysUserFeignService;
     @Autowired
     private ImUserFriendService imUserFriendService;
@@ -104,17 +104,18 @@ public class StudentController extends BaseController {
         });
 
 
-        Map<Long, List<TenantActivationCode>> groupByUserId = new HashMap<>();
+        Map<String, List<TenantActivationCode>> groupByPhone = new HashMap<>();
         if (!rows.isEmpty() && query.getTenantAlbumPurchaseId() != null) {
-            List<String> studentPhones = rows.stream().map(StudentVo::getPhone).collect(Collectors.toList());
-            groupByUserId = tenantActivationCodeService.lambdaQuery()
+            List<String> studentPhones =
+                    rows.stream().map(StudentVo::getPhone).filter(StringUtils::isNotEmpty).collect(Collectors.toList());
+            groupByPhone = tenantActivationCodeService.lambdaQuery()
                     .eq(TenantActivationCode::getId, query.getTenantAlbumPurchaseId())
                     .in(TenantActivationCode::getActivationPhone, studentPhones)
-                    .list().stream().collect(Collectors.groupingBy(TenantActivationCode::getActivationUserId));
+                    .list().stream().collect(Collectors.groupingBy(TenantActivationCode::getActivationPhone));
         }
 
         for (StudentVo vo : rows) {
-            vo.setSendActiveCodeNum(groupByUserId.getOrDefault(vo.getUserId(), new ArrayList<>()).size());
+            vo.setSendActiveCodeNum(groupByPhone.getOrDefault(vo.getPhone(), new ArrayList<>()).size());
             if (StringUtils.isNotEmpty(vo.getPhone())) {
                 vo.setPhone(vo.getPhone().replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2"));
             }

+ 6 - 5
cooleshow-user/user-tenant/src/main/java/com/yonge/cooleshow/tenant/controller/StudentController.java

@@ -103,17 +103,18 @@ public class StudentController extends BaseController {
         });
 
 
-        Map<Long, List<TenantActivationCode>> groupByUserId = new HashMap<>();
+        Map<String, List<TenantActivationCode>> groupByPhone = new HashMap<>();
         if (!rows.isEmpty() && query.getTenantAlbumPurchaseId() != null) {
-            List<String> studentPhones = rows.stream().map(StudentVo::getPhone).collect(Collectors.toList());
-             groupByUserId = tenantActivationCodeService.lambdaQuery()
+            List<String> studentPhones =
+                    rows.stream().map(StudentVo::getPhone).filter(StringUtils::isNotEmpty).collect(Collectors.toList());
+             groupByPhone = tenantActivationCodeService.lambdaQuery()
                     .eq(TenantActivationCode::getId, query.getTenantAlbumPurchaseId())
                     .in(TenantActivationCode::getActivationPhone, studentPhones)
-                    .list().stream().collect(Collectors.groupingBy(TenantActivationCode::getActivationUserId));
+                    .list().stream().collect(Collectors.groupingBy(TenantActivationCode::getActivationPhone));
         }
 
         for (StudentVo vo : rows) {
-            vo.setSendActiveCodeNum(groupByUserId.getOrDefault(vo.getUserId(), new ArrayList<>()).size());
+            vo.setSendActiveCodeNum(groupByPhone.getOrDefault(vo.getPhone(), new ArrayList<>()).size());
             if (StringUtils.isNotEmpty(vo.getPhone())) {
                 vo.setPhone(vo.getPhone().replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2"));
             }