|
@@ -7,9 +7,11 @@ 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.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.TenantGroupService;
|
|
|
import com.yonge.cooleshow.biz.dal.service.VipCardRecordService;
|
|
|
import com.yonge.cooleshow.biz.dal.vo.StudentVo;
|
|
|
import com.yonge.cooleshow.biz.dal.vo.VipRecordVo;
|
|
@@ -41,12 +43,16 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import javax.validation.Valid;
|
|
|
import java.io.IOException;
|
|
|
import java.io.OutputStream;
|
|
|
import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@RestController
|
|
|
@RequestMapping("${app-config.url.admin:}/student")
|
|
@@ -55,7 +61,7 @@ public class StudentController extends BaseController {
|
|
|
@Autowired
|
|
|
private StudentService studentService;
|
|
|
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private SysUserFeignService sysUserFeignService;
|
|
|
|
|
|
@Autowired
|
|
@@ -64,6 +70,9 @@ public class StudentController extends BaseController {
|
|
|
@Autowired
|
|
|
private VipCardRecordService vipCardRecordService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private TenantGroupService tenantGroupService;
|
|
|
+
|
|
|
@GetMapping("/detail/{id}")
|
|
|
@ApiOperation(value = "详情", notes = "传入id")
|
|
|
@ApiImplicitParams({
|
|
@@ -100,6 +109,17 @@ public class StudentController extends BaseController {
|
|
|
IPage<StudentVo> pages = studentService.selectPage(PageUtil.getPage(query), query);
|
|
|
List<StudentVo> rows = pages.getRecords();
|
|
|
|
|
|
+ List<Long> tenantGroupIds = rows.stream().map(Student::getTenantGroupId)
|
|
|
+ .filter(next -> next != null && next != -1L).distinct().collect(Collectors.toList());
|
|
|
+ Map<Long, String> tenantGroupIdNameMap = new HashMap<>();
|
|
|
+ if (!tenantGroupIds.isEmpty()) {
|
|
|
+ Map<Long, String> tenantGroupMap = tenantGroupService.lambdaQuery()
|
|
|
+ .in(TenantGroup::getId, tenantGroupIds)
|
|
|
+ .list().stream().collect(Collectors.toMap(TenantGroup::getId, TenantGroup::getName));
|
|
|
+ tenantGroupIdNameMap.putAll(tenantGroupMap);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
for (StudentVo vo : rows) {
|
|
|
if (vo.getDelFlag() == YesOrNoEnum.YES) {
|
|
|
vo.setUserStatus(UserStatusEnum.CLOSED);
|
|
@@ -110,6 +130,7 @@ public class StudentController extends BaseController {
|
|
|
vo.setUserStatus(UserStatusEnum.NORMAL);
|
|
|
}
|
|
|
}
|
|
|
+ vo.setTenantGroupName(tenantGroupIdNameMap.getOrDefault(vo.getTenantGroupId(), ""));
|
|
|
}
|
|
|
return succeed(PageUtil.pageInfo(pages));
|
|
|
}
|
|
@@ -142,6 +163,16 @@ public class StudentController extends BaseController {
|
|
|
throw new BizException("没有可导出数据");
|
|
|
}
|
|
|
|
|
|
+ List<Long> tenantGroupIds = rows.stream().map(Student::getTenantGroupId)
|
|
|
+ .filter(next -> next != null && next != -1L).distinct().collect(Collectors.toList());
|
|
|
+ Map<Long, String> tenantGroupIdNameMap = new HashMap<>();
|
|
|
+ if (!tenantGroupIds.isEmpty()) {
|
|
|
+ Map<Long, String> tenantGroupMap = tenantGroupService.lambdaQuery()
|
|
|
+ .in(TenantGroup::getId, tenantGroupIds)
|
|
|
+ .list().stream().collect(Collectors.toMap(TenantGroup::getId, TenantGroup::getName));
|
|
|
+ tenantGroupIdNameMap.putAll(tenantGroupMap);
|
|
|
+ }
|
|
|
+
|
|
|
for (StudentVo vo : rows) {
|
|
|
if (vo.getDelFlag() == YesOrNoEnum.YES) {
|
|
|
vo.setUserStatus(UserStatusEnum.CLOSED);
|
|
@@ -152,13 +183,14 @@ public class StudentController extends BaseController {
|
|
|
vo.setUserStatus(UserStatusEnum.NORMAL);
|
|
|
}
|
|
|
}
|
|
|
+ vo.setTenantGroupName(tenantGroupIdNameMap.getOrDefault(vo.getTenantGroupId(), ""));
|
|
|
}
|
|
|
OutputStream outputStream = response.getOutputStream();
|
|
|
try {
|
|
|
HSSFWorkbook workbook = POIUtil.exportExcel(new String[]{"学生编号", "学生姓名", "真实姓名", "性别", "出生日期",
|
|
|
- "年龄", "专业", "手机号码", "是否是会员", "注册时间", "用户状态", "学生来源"}, new String[]{
|
|
|
+ "年龄", "专业", "手机号码", "是否是会员", "注册时间", "用户状态", "学生来源","小组"}, new String[]{
|
|
|
"userId", "username", "realName", "gender.msg", "birthdate", "age", "subjectName", "phone",
|
|
|
- "isVip.msg", "createTime", "userStatus.msg", "tenantName"}, rows);
|
|
|
+ "isVip.msg", "createTime", "userStatus.msg", "tenantName", "tenantGroupName"}, rows);
|
|
|
response.setContentType("application/octet-stream");
|
|
|
response.setHeader("Content-Disposition", "attac:wq" +
|
|
|
"hment;filename=学生列表-" + DateUtil.getDate(new Date()) + ".xls");
|