|
@@ -1,41 +1,19 @@
|
|
package com.yonge.cooleshow.admin.controller;
|
|
package com.yonge.cooleshow.admin.controller;
|
|
|
|
|
|
-import io.swagger.annotations.Api;
|
|
|
|
-import io.swagger.annotations.ApiImplicitParam;
|
|
|
|
-import io.swagger.annotations.ApiImplicitParams;
|
|
|
|
-import io.swagger.annotations.ApiOperation;
|
|
|
|
-
|
|
|
|
-import java.io.IOException;
|
|
|
|
-import java.io.OutputStream;
|
|
|
|
-import java.util.Date;
|
|
|
|
-import java.util.List;
|
|
|
|
-
|
|
|
|
-import javax.servlet.http.HttpServletResponse;
|
|
|
|
-import javax.validation.Valid;
|
|
|
|
-
|
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
|
-import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
-import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
-import org.springframework.web.bind.annotation.PathVariable;
|
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
|
-
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
|
|
import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
|
|
import com.yonge.cooleshow.auth.api.entity.SysUser;
|
|
import com.yonge.cooleshow.auth.api.entity.SysUser;
|
|
import com.yonge.cooleshow.biz.dal.dto.VipSubmitReq;
|
|
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.StudentSearch;
|
|
import com.yonge.cooleshow.biz.dal.dto.search.VipRecordSearch;
|
|
import com.yonge.cooleshow.biz.dal.dto.search.VipRecordSearch;
|
|
|
|
+import com.yonge.cooleshow.biz.dal.entity.Student;
|
|
import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
|
|
import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
|
|
import com.yonge.cooleshow.biz.dal.service.MemberPriceSettingsService;
|
|
import com.yonge.cooleshow.biz.dal.service.MemberPriceSettingsService;
|
|
import com.yonge.cooleshow.biz.dal.service.StudentService;
|
|
import com.yonge.cooleshow.biz.dal.service.StudentService;
|
|
import com.yonge.cooleshow.biz.dal.service.VipCardRecordService;
|
|
import com.yonge.cooleshow.biz.dal.service.VipCardRecordService;
|
|
import com.yonge.cooleshow.biz.dal.vo.StudentVo;
|
|
import com.yonge.cooleshow.biz.dal.vo.StudentVo;
|
|
import com.yonge.cooleshow.biz.dal.vo.VipRecordVo;
|
|
import com.yonge.cooleshow.biz.dal.vo.VipRecordVo;
|
|
|
|
+import com.yonge.cooleshow.biz.dal.wrapper.StudentWrapper;
|
|
import com.yonge.cooleshow.common.controller.BaseController;
|
|
import com.yonge.cooleshow.common.controller.BaseController;
|
|
import com.yonge.cooleshow.common.entity.HttpResponseResult;
|
|
import com.yonge.cooleshow.common.entity.HttpResponseResult;
|
|
import com.yonge.cooleshow.common.enums.UserLockFlag;
|
|
import com.yonge.cooleshow.common.enums.UserLockFlag;
|
|
@@ -46,6 +24,29 @@ import com.yonge.toolset.base.page.PageInfo;
|
|
import com.yonge.toolset.mybatis.support.PageUtil;
|
|
import com.yonge.toolset.mybatis.support.PageUtil;
|
|
import com.yonge.toolset.utils.date.DateUtil;
|
|
import com.yonge.toolset.utils.date.DateUtil;
|
|
import com.yonge.toolset.utils.excel.POIUtil;
|
|
import com.yonge.toolset.utils.excel.POIUtil;
|
|
|
|
+import io.swagger.annotations.Api;
|
|
|
|
+import io.swagger.annotations.ApiImplicitParam;
|
|
|
|
+import io.swagger.annotations.ApiImplicitParams;
|
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
|
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.http.HttpStatus;
|
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.PathVariable;
|
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
+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.List;
|
|
|
|
|
|
@RestController
|
|
@RestController
|
|
@RequestMapping("/student")
|
|
@RequestMapping("/student")
|
|
@@ -54,8 +55,7 @@ public class StudentController extends BaseController {
|
|
@Autowired
|
|
@Autowired
|
|
private StudentService studentService;
|
|
private StudentService studentService;
|
|
|
|
|
|
-
|
|
|
|
- @Autowired
|
|
|
|
|
|
+ @Resource
|
|
private SysUserFeignService sysUserFeignService;
|
|
private SysUserFeignService sysUserFeignService;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
@@ -64,56 +64,55 @@ public class StudentController extends BaseController {
|
|
@Autowired
|
|
@Autowired
|
|
private VipCardRecordService vipCardRecordService;
|
|
private VipCardRecordService vipCardRecordService;
|
|
|
|
|
|
-
|
|
|
|
@GetMapping("/detail/{id}")
|
|
@GetMapping("/detail/{id}")
|
|
@ApiOperation(value = "详情", notes = "传入id")
|
|
@ApiOperation(value = "详情", notes = "传入id")
|
|
@ApiImplicitParams({
|
|
@ApiImplicitParams({
|
|
@ApiImplicitParam(name = "id", value = "id", paramType = "path", dataType = "long", required = true),
|
|
@ApiImplicitParam(name = "id", value = "id", paramType = "path", dataType = "long", required = true),
|
|
})
|
|
})
|
|
@PreAuthorize("@pcs.hasPermissions('student/detail')")
|
|
@PreAuthorize("@pcs.hasPermissions('student/detail')")
|
|
- public HttpResponseResult<StudentVo> detail(@PathVariable("id") Long id){
|
|
|
|
- StudentVo detail = studentService.detail(id);
|
|
|
|
- return succeed(detail);
|
|
|
|
- }
|
|
|
|
|
|
+ public HttpResponseResult<StudentVo> detail(@PathVariable("id") Long id) {
|
|
|
|
+ StudentVo detail = studentService.detail(id);
|
|
|
|
+ return succeed(detail);
|
|
|
|
+ }
|
|
|
|
|
|
@PostMapping("/page")
|
|
@PostMapping("/page")
|
|
@ApiOperation(value = "查询分页", notes = "传入StudentSearch")
|
|
@ApiOperation(value = "查询分页", notes = "传入StudentSearch")
|
|
@PreAuthorize("@pcs.hasPermissions('student/page')")
|
|
@PreAuthorize("@pcs.hasPermissions('student/page')")
|
|
public HttpResponseResult<PageInfo<StudentVo>> page(@RequestBody StudentSearch query) {
|
|
public HttpResponseResult<PageInfo<StudentVo>> page(@RequestBody StudentSearch query) {
|
|
-
|
|
|
|
- if(StringUtils.isNotBlank(query.getUserStatus())){
|
|
|
|
- switch (query.getUserStatus()) {
|
|
|
|
- case "LOCKED":
|
|
|
|
- query.setDelFlag(YesOrNoEnum.NO);
|
|
|
|
- query.setLockFlag(UserLockFlag.LOCKED);
|
|
|
|
- break;
|
|
|
|
- case "CLOSED":
|
|
|
|
- query.setDelFlag(YesOrNoEnum.YES);
|
|
|
|
- break;
|
|
|
|
-
|
|
|
|
- default:
|
|
|
|
- query.setDelFlag(YesOrNoEnum.NO);
|
|
|
|
- query.setLockFlag(UserLockFlag.NORMAL);
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- IPage<StudentVo> pages = studentService.selectPage(PageUtil.getPage(query), query);
|
|
|
|
- List<StudentVo> rows = pages.getRecords();
|
|
|
|
-
|
|
|
|
- for(StudentVo vo : rows){
|
|
|
|
- if(vo.getDelFlag() == YesOrNoEnum.YES){
|
|
|
|
- vo.setUserStatus(UserStatusEnum.CLOSED);
|
|
|
|
- }else{
|
|
|
|
- if(vo.getLockFlag() == UserLockFlag.LOCKED){
|
|
|
|
- vo.setUserStatus(UserStatusEnum.LOCKED);
|
|
|
|
- }else{
|
|
|
|
- vo.setUserStatus(UserStatusEnum.NORMAL);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
+ if (StringUtils.isNotBlank(query.getUserStatus())) {
|
|
|
|
+ switch (query.getUserStatus()) {
|
|
|
|
+ case "LOCKED":
|
|
|
|
+ query.setDelFlag(YesOrNoEnum.NO);
|
|
|
|
+ query.setLockFlag(UserLockFlag.LOCKED);
|
|
|
|
+ break;
|
|
|
|
+ case "CLOSED":
|
|
|
|
+ query.setDelFlag(YesOrNoEnum.YES);
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
+ default:
|
|
|
|
+ query.setDelFlag(YesOrNoEnum.NO);
|
|
|
|
+ query.setLockFlag(UserLockFlag.NORMAL);
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ IPage<StudentVo> pages = studentService.selectPage(PageUtil.getPage(query), query);
|
|
|
|
+ List<StudentVo> rows = pages.getRecords();
|
|
|
|
+
|
|
|
|
+ for (StudentVo vo : rows) {
|
|
|
|
+ if (vo.getDelFlag() == YesOrNoEnum.YES) {
|
|
|
|
+ vo.setUserStatus(UserStatusEnum.CLOSED);
|
|
|
|
+ } else {
|
|
|
|
+ if (vo.getLockFlag() == UserLockFlag.LOCKED) {
|
|
|
|
+ vo.setUserStatus(UserStatusEnum.LOCKED);
|
|
|
|
+ } else {
|
|
|
|
+ vo.setUserStatus(UserStatusEnum.NORMAL);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
return succeed(PageUtil.pageInfo(pages));
|
|
return succeed(PageUtil.pageInfo(pages));
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
|
|
@ApiOperation(value = "学生列表导出")
|
|
@ApiOperation(value = "学生列表导出")
|
|
@PostMapping("export")
|
|
@PostMapping("export")
|
|
@@ -121,45 +120,45 @@ public class StudentController extends BaseController {
|
|
public void export(HttpServletResponse response, @RequestBody StudentSearch queryInfo) throws IOException {
|
|
public void export(HttpServletResponse response, @RequestBody StudentSearch queryInfo) throws IOException {
|
|
queryInfo.setPage(1);
|
|
queryInfo.setPage(1);
|
|
queryInfo.setRows(49999);
|
|
queryInfo.setRows(49999);
|
|
-
|
|
|
|
- if(StringUtils.isNotBlank(queryInfo.getUserStatus())){
|
|
|
|
- switch (queryInfo.getUserStatus()) {
|
|
|
|
- case "LOCKED":
|
|
|
|
- queryInfo.setDelFlag(YesOrNoEnum.NO);
|
|
|
|
- queryInfo.setLockFlag(UserLockFlag.LOCKED);
|
|
|
|
- break;
|
|
|
|
- case "CLOSED":
|
|
|
|
- queryInfo.setDelFlag(YesOrNoEnum.YES);
|
|
|
|
- break;
|
|
|
|
-
|
|
|
|
- default:
|
|
|
|
- queryInfo.setDelFlag(YesOrNoEnum.NO);
|
|
|
|
- queryInfo.setLockFlag(UserLockFlag.NORMAL);
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
+ if (StringUtils.isNotBlank(queryInfo.getUserStatus())) {
|
|
|
|
+ switch (queryInfo.getUserStatus()) {
|
|
|
|
+ case "LOCKED":
|
|
|
|
+ queryInfo.setDelFlag(YesOrNoEnum.NO);
|
|
|
|
+ queryInfo.setLockFlag(UserLockFlag.LOCKED);
|
|
|
|
+ break;
|
|
|
|
+ case "CLOSED":
|
|
|
|
+ queryInfo.setDelFlag(YesOrNoEnum.YES);
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
+ default:
|
|
|
|
+ queryInfo.setDelFlag(YesOrNoEnum.NO);
|
|
|
|
+ queryInfo.setLockFlag(UserLockFlag.NORMAL);
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
List<StudentVo> rows = studentService.selectPage(PageUtil.getPage(queryInfo), queryInfo).getRecords();
|
|
List<StudentVo> rows = studentService.selectPage(PageUtil.getPage(queryInfo), queryInfo).getRecords();
|
|
if (rows.size() < 1) {
|
|
if (rows.size() < 1) {
|
|
throw new BizException("没有可导出数据");
|
|
throw new BizException("没有可导出数据");
|
|
}
|
|
}
|
|
-
|
|
|
|
- for(StudentVo vo : rows){
|
|
|
|
- if(vo.getDelFlag() == YesOrNoEnum.YES){
|
|
|
|
- vo.setUserStatus(UserStatusEnum.CLOSED);
|
|
|
|
- }else{
|
|
|
|
- if(vo.getLockFlag() == UserLockFlag.LOCKED){
|
|
|
|
- vo.setUserStatus(UserStatusEnum.LOCKED);
|
|
|
|
- }else{
|
|
|
|
- vo.setUserStatus(UserStatusEnum.NORMAL);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
+ for (StudentVo vo : rows) {
|
|
|
|
+ if (vo.getDelFlag() == YesOrNoEnum.YES) {
|
|
|
|
+ vo.setUserStatus(UserStatusEnum.CLOSED);
|
|
|
|
+ } else {
|
|
|
|
+ if (vo.getLockFlag() == UserLockFlag.LOCKED) {
|
|
|
|
+ vo.setUserStatus(UserStatusEnum.LOCKED);
|
|
|
|
+ } else {
|
|
|
|
+ vo.setUserStatus(UserStatusEnum.NORMAL);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
OutputStream outputStream = response.getOutputStream();
|
|
OutputStream outputStream = response.getOutputStream();
|
|
try {
|
|
try {
|
|
HSSFWorkbook workbook = POIUtil.exportExcel(new String[]{"学生编号", "学生姓名", "真实姓名", "性别", "出生日期",
|
|
HSSFWorkbook workbook = POIUtil.exportExcel(new String[]{"学生编号", "学生姓名", "真实姓名", "性别", "出生日期",
|
|
- "年龄", "专业", "手机号码", "是否是会员", "注册时间","用户状态"}, new String[]{
|
|
|
|
- "userId","username" , "realName", "gender.msg", "birthdate", "age", "subjectName", "phone",
|
|
|
|
- "isVip.msg", "createTime", "userStatus.msg"}, rows);
|
|
|
|
|
|
+ "年龄", "专业", "手机号码", "是否是会员", "注册时间", "用户状态", "学生来源"}, new String[]{
|
|
|
|
+ "userId", "username", "realName", "gender.msg", "birthdate", "age", "subjectName", "phone",
|
|
|
|
+ "isVip.msg", "createTime", "userStatus.msg", "tenantName"}, rows);
|
|
response.setContentType("application/octet-stream");
|
|
response.setContentType("application/octet-stream");
|
|
response.setHeader("Content-Disposition", "attac:wq" +
|
|
response.setHeader("Content-Disposition", "attac:wq" +
|
|
"hment;filename=学生列表-" + DateUtil.getDate(new Date()) + ".xls");
|
|
"hment;filename=学生列表-" + DateUtil.getDate(new Date()) + ".xls");
|
|
@@ -185,7 +184,7 @@ public class StudentController extends BaseController {
|
|
@PreAuthorize("@pcs.hasPermissions('student/addVip')")
|
|
@PreAuthorize("@pcs.hasPermissions('student/addVip')")
|
|
public HttpResponseResult<Boolean> addVip(@Valid @RequestBody VipSubmitReq vipSubmitReq) {
|
|
public HttpResponseResult<Boolean> addVip(@Valid @RequestBody VipSubmitReq vipSubmitReq) {
|
|
SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
- if (sysUser == null || sysUser.getId() == null) {
|
|
|
|
|
|
+ if (sysUser == null || sysUser.getId() == null) {
|
|
return failed("用户信息获取失败");
|
|
return failed("用户信息获取失败");
|
|
}
|
|
}
|
|
return succeed(memberPriceSettingsService.addVip(vipSubmitReq, ClientEnum.STUDENT, sysUser));
|
|
return succeed(memberPriceSettingsService.addVip(vipSubmitReq, ClientEnum.STUDENT, sysUser));
|
|
@@ -200,4 +199,24 @@ public class StudentController extends BaseController {
|
|
recordSearch.setClient(ClientEnum.STUDENT);
|
|
recordSearch.setClient(ClientEnum.STUDENT);
|
|
return succeed(vipCardRecordService.vipRecord(recordSearch));
|
|
return succeed(vipCardRecordService.vipRecord(recordSearch));
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @PostMapping("/updateTenant")
|
|
|
|
+ @ApiOperation(value = "修改机构")
|
|
|
|
+ public HttpResponseResult<Boolean> updateTenant(@RequestBody StudentWrapper.StudentUpdateTenant updateTenant) {
|
|
|
|
+ SysUser user = sysUserFeignService.queryUserInfo();
|
|
|
|
+ if (user == null || null == user.getId()) {
|
|
|
|
+ return failed(HttpStatus.FORBIDDEN, "请登录");
|
|
|
|
+ }
|
|
|
|
+ if (user.getTenantId() == null || user.getTenantId() == -1L) {
|
|
|
|
+ return failed("非机构用户不允许更换机构");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Student student = studentService.getById(user.getId());
|
|
|
|
+ if (student == null) {
|
|
|
|
+ return failed("未查询到学生的信息");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ studentService.updateTenant(student, updateTenant.getTenantId());
|
|
|
|
+ return succeed();
|
|
|
|
+ }
|
|
}
|
|
}
|