Bläddra i källkod

1.接口同步

yuanliang 1 år sedan
förälder
incheckning
a2395dc5f0

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

@@ -7,10 +7,12 @@ import com.yonge.cooleshow.biz.dal.dto.VipSubmitReq;
 import com.yonge.cooleshow.biz.dal.dto.search.StudentSearch;
 import com.yonge.cooleshow.biz.dal.dto.search.VipRecordSearch;
 import com.yonge.cooleshow.biz.dal.entity.Student;
+import com.yonge.cooleshow.biz.dal.entity.TenantActivationCode;
 import com.yonge.cooleshow.biz.dal.entity.TenantGroup;
 import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
 import com.yonge.cooleshow.biz.dal.service.MemberPriceSettingsService;
 import com.yonge.cooleshow.biz.dal.service.StudentService;
+import com.yonge.cooleshow.biz.dal.service.TenantActivationCodeService;
 import com.yonge.cooleshow.biz.dal.service.TenantGroupService;
 import com.yonge.cooleshow.biz.dal.service.VipCardRecordService;
 import com.yonge.cooleshow.biz.dal.vo.StudentVo;
@@ -48,6 +50,7 @@ import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
@@ -73,6 +76,9 @@ public class StudentController extends BaseController {
     @Autowired
     private TenantGroupService tenantGroupService;
 
+    @Autowired
+    private TenantActivationCodeService tenantActivationCodeService;
+
     @GetMapping("/detail/{id}")
     @ApiOperation(value = "详情", notes = "传入id")
     @ApiImplicitParams({
@@ -113,6 +119,25 @@ public class StudentController extends BaseController {
         IPage<StudentVo> pages = studentService.selectPage(PageUtil.getPage(query), query);
         List<StudentVo> rows = pages.getRecords();
 
+        //如果真实姓名字段为空 把真实姓名赋值给昵称
+        rows.forEach(r -> {
+            if (StringUtils.isEmpty(r.getRealName())) {
+                if (StringUtils.isNotEmpty(r.getUsername())) {
+                    r.setRealName(r.getUsername());
+                }
+            }
+        });
+
+        Map<String, List<TenantActivationCode>> groupByPhone = new HashMap<>();
+        if (!rows.isEmpty() && query.getTenantAlbumPurchaseId() != null) {
+            List<String> studentPhones =
+                    rows.stream().map(StudentVo::getPhone).filter(StringUtils::isNotEmpty).collect(Collectors.toList());
+            groupByPhone = tenantActivationCodeService.lambdaQuery()
+                    .eq(TenantActivationCode::getTenantAlbumPurchaseId, query.getTenantAlbumPurchaseId())
+                    .in(TenantActivationCode::getActivationPhone, studentPhones)
+                    .list().stream().collect(Collectors.groupingBy(TenantActivationCode::getActivationPhone));
+        }
+
         List<Long> tenantGroupIds = rows.stream().map(Student::getTenantGroupId)
                 .filter(next -> next != null && next != -1L).distinct().collect(Collectors.toList());
         Map<Long, String> tenantGroupIdNameMap = new HashMap<>();
@@ -125,6 +150,7 @@ public class StudentController extends BaseController {
 
 
         for (StudentVo vo : rows) {
+            vo.setSendActiveCodeNum(groupByPhone.getOrDefault(vo.getPhone(), new ArrayList<>()).size());
             if (vo.getDelFlag() == YesOrNoEnum.YES) {
                 vo.setUserStatus(UserStatusEnum.CLOSED);
             } else {