|
@@ -5,8 +5,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
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;
|
|
|
+import com.yonge.cooleshow.biz.dal.entity.Student;
|
|
|
+import com.yonge.cooleshow.biz.dal.entity.TenantActivationCode;
|
|
|
import com.yonge.cooleshow.biz.dal.entity.TenantInfo;
|
|
|
import com.yonge.cooleshow.biz.dal.service.StudentService;
|
|
|
+import com.yonge.cooleshow.biz.dal.service.TenantActivationCodeService;
|
|
|
import com.yonge.cooleshow.biz.dal.service.TenantInfoService;
|
|
|
import com.yonge.cooleshow.biz.dal.vo.StudentVo;
|
|
|
import com.yonge.cooleshow.biz.dal.wrapper.StudentWrapper;
|
|
@@ -39,7 +42,11 @@ 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.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@RestController
|
|
|
@RequestMapping("/student")
|
|
@@ -54,6 +61,9 @@ public class StudentController extends BaseController {
|
|
|
@Autowired
|
|
|
private TenantInfoService tenantInfoService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private TenantActivationCodeService tenantActivationCodeService;
|
|
|
+
|
|
|
@GetMapping("/detail/{id}")
|
|
|
@ApiOperation(value = "详情", notes = "传入id")
|
|
|
public HttpResponseResult<StudentVo> detail(@PathVariable("id") Long id) {
|
|
@@ -72,7 +82,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<>();
|
|
|
+ if (!rows.isEmpty() && query.getTenantAlbumPurchaseId() != null) {
|
|
|
+ List<Long> studentIdList = rows.stream().map(Student::getUserId).collect(Collectors.toList());
|
|
|
+ groupByUserId = tenantActivationCodeService.lambdaQuery()
|
|
|
+ .eq(TenantActivationCode::getId, query.getTenantAlbumPurchaseId())
|
|
|
+ .in(TenantActivationCode::getActivationUserId, studentIdList)
|
|
|
+ .list().stream().collect(Collectors.groupingBy(TenantActivationCode::getActivationUserId));
|
|
|
+ }
|
|
|
+
|
|
|
for (StudentVo vo : rows) {
|
|
|
+ vo.setSendActiveCodeNum(groupByUserId.getOrDefault(vo.getUserId(), new ArrayList<>()).size());
|
|
|
if (StringUtils.isNotEmpty(vo.getPhone())) {
|
|
|
vo.setPhone(vo.getPhone().replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2"));
|
|
|
}
|
|
@@ -111,8 +131,8 @@ public class StudentController extends BaseController {
|
|
|
return failed(HttpStatus.FORBIDDEN, "请登录");
|
|
|
}
|
|
|
try {
|
|
|
- ExcelDataReader<StudentWrapper.StudentExport> reader =
|
|
|
- ExcelUtils.getReader(StudentWrapper.StudentExport.class, file);
|
|
|
+ ExcelDataReader<StudentWrapper.StudentImport> reader =
|
|
|
+ ExcelUtils.getReader(StudentWrapper.StudentImport.class, file);
|
|
|
studentService.importStudentExcel(reader.getDataList(), user.getTenantId(), user.getId());
|
|
|
return HttpResponseResult.succeed();
|
|
|
} catch (ExcelException e) {
|