|
@@ -6,18 +6,23 @@ import com.google.common.collect.ImmutableList;
|
|
|
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.dto.search.TeacherSearch;
|
|
|
import com.yonge.cooleshow.biz.dal.entity.Student;
|
|
|
import com.yonge.cooleshow.biz.dal.entity.Teacher;
|
|
|
import com.yonge.cooleshow.biz.dal.entity.TenantActivationCode;
|
|
|
import com.yonge.cooleshow.biz.dal.entity.TenantInfo;
|
|
|
import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
|
|
|
import com.yonge.cooleshow.biz.dal.service.ImUserFriendService;
|
|
|
+import com.yonge.cooleshow.biz.dal.service.OssFileService;
|
|
|
import com.yonge.cooleshow.biz.dal.service.StudentService;
|
|
|
import com.yonge.cooleshow.biz.dal.service.TeacherService;
|
|
|
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.vo.TeacherVo;
|
|
|
+import com.yonge.cooleshow.biz.dal.wrapper.OssFileWrapper;
|
|
|
import com.yonge.cooleshow.biz.dal.wrapper.StudentWrapper;
|
|
|
+import com.yonge.cooleshow.biz.dal.wrapper.teacher.TeacherWrapper;
|
|
|
import com.yonge.cooleshow.common.controller.BaseController;
|
|
|
import com.yonge.cooleshow.common.entity.HttpResponseResult;
|
|
|
import com.yonge.cooleshow.common.enums.BizHttpStatus;
|
|
@@ -48,7 +53,9 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.HashSet;
|
|
|
import java.util.List;
|
|
@@ -63,18 +70,17 @@ public class StudentController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
|
private StudentService studentService;
|
|
|
- @Autowired
|
|
|
- private TeacherService teacherService;
|
|
|
@Resource
|
|
|
private SysUserFeignService sysUserFeignService;
|
|
|
@Autowired
|
|
|
- private ImUserFriendService imUserFriendService;
|
|
|
- @Autowired
|
|
|
private TenantInfoService tenantInfoService;
|
|
|
|
|
|
@Autowired
|
|
|
private TenantActivationCodeService tenantActivationCodeService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private OssFileService ossFileService;
|
|
|
+
|
|
|
@GetMapping("/detail/{id}")
|
|
|
@ApiOperation(value = "详情", notes = "传入id")
|
|
|
public HttpResponseResult<StudentVo> detail(@PathVariable("id") Long id) {
|
|
@@ -131,6 +137,39 @@ public class StudentController extends BaseController {
|
|
|
return succeed(PageUtil.pageInfo(pages));
|
|
|
}
|
|
|
|
|
|
+ @GetMapping("/exportStudent")
|
|
|
+ @ApiOperation(value = "导出学生", notes = "传入TeacherSearch")
|
|
|
+ public HttpResponseResult<OssFileWrapper.ExportFile> exportTeacher(@RequestBody StudentSearch query) {
|
|
|
+ TenantInfo tenantInfo = getTenantInfo();
|
|
|
+ query.setTenantId(tenantInfo.getId());
|
|
|
+ query.setDelFlag(YesOrNoEnum.NO);
|
|
|
+ query.setLockFlag(UserLockFlag.NORMAL);
|
|
|
+ query.setOrderBy("u.username_ asc");
|
|
|
+ query.setPage(1);
|
|
|
+ query.setRows(9999);
|
|
|
+
|
|
|
+ IPage<StudentVo> pages = studentService.selectPage(PageUtil.getPage(query), query);
|
|
|
+ List<StudentVo> rows = pages.getRecords();
|
|
|
+
|
|
|
+ if (rows.isEmpty()) {
|
|
|
+ throw new BizException("没有可导出数据");
|
|
|
+ }
|
|
|
+
|
|
|
+ List<StudentWrapper.ExportStudentTemplate> templateList = rows.stream().map(next -> {
|
|
|
+ StudentWrapper.ExportStudentTemplate template = new StudentWrapper.ExportStudentTemplate();
|
|
|
+ template.setUserName(next.getUsername());
|
|
|
+ template.setPhone(next.getPhone());
|
|
|
+ template.setSubjectName(next.getSubjectName());
|
|
|
+ template.setTenantGroupName(next.getTenantGroupName());
|
|
|
+ return template;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+
|
|
|
+ String format = new SimpleDateFormat("yyyyMMddHHmm").format(new Date());
|
|
|
+ OssFileWrapper.ExportFile exportFile = ossFileService.uploadFile(templateList,
|
|
|
+ StudentWrapper.ExportStudentTemplate.class, format, "学生");
|
|
|
+ return succeed(exportFile);
|
|
|
+ }
|
|
|
+
|
|
|
@PostMapping("/save")
|
|
|
@ApiOperation(value = "新增/修改", notes = "传入Student")
|
|
|
public HttpResponseResult<Boolean> save(
|