| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208 |
- package com.xjrsoft.module.student.controller;
- import cn.dev33.satoken.annotation.SaCheckPermission;
- import cn.dev33.satoken.stp.StpUtil;
- import com.alibaba.excel.EasyExcel;
- import com.alibaba.excel.support.ExcelTypeEnum;
- import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
- import com.baomidou.mybatisplus.core.metadata.IPage;
- import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
- import com.xjrsoft.common.annotation.XjrLog;
- import com.xjrsoft.common.enums.DeleteMark;
- import com.xjrsoft.common.model.result.RT;
- import com.xjrsoft.common.page.ConventPage;
- import com.xjrsoft.common.page.PageOutput;
- import com.xjrsoft.common.utils.TreeUtil;
- import com.xjrsoft.module.base.entity.BaseClass;
- import com.xjrsoft.module.base.service.IBaseClassService;
- import com.xjrsoft.module.base.service.IBaseGradeService;
- import com.xjrsoft.module.student.dto.*;
- import com.xjrsoft.module.student.service.IPbVXssfdetailService;
- import com.xjrsoft.module.student.service.IPbVXsxxsfytbService;
- import com.xjrsoft.module.student.vo.*;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import lombok.AllArgsConstructor;
- import org.springframework.http.ResponseEntity;
- import org.springframework.web.bind.annotation.*;
- import javax.validation.Valid;
- import java.io.ByteArrayOutputStream;
- import java.util.ArrayList;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Map;
- /**
- * @title: 学生消费管理
- * @Author dzx
- * @Date: 2024年6月3日
- * @Version 1.0
- */
- @RestController
- @RequestMapping("/student" + "/consumption")
- @Api(value = "/student" + "/consumption", tags = "学生消费管理")
- @AllArgsConstructor
- public class ConsumptionController {
- private final IPbVXssfdetailService pbVXssfdetailService;
- private final IPbVXsxxsfytbService pbVXsxxsfytbService;
- private final IBaseGradeService baseGradeService;
- private final IBaseClassService baseClassService;
- @GetMapping(value = "/tree")
- @ApiOperation(value = "学生在读毕业年级班级树")
- @SaCheckPermission("studentmanager:detail")
- @XjrLog(value = "学生在读毕业年级班级树")
- public RT<List<BaseClassTreeVo>> tree() {
- List<BaseClassTreeVo> voList = new ArrayList<>();
- List<BaseClassQfCountVo> qfCount = pbVXsxxsfytbService.getClassQfCount();
- Map<Long, Integer> qfCountMap = new HashMap<>();
- for (BaseClassQfCountVo qfCountVo : qfCount) {
- qfCountMap.put(qfCountVo.getId(), qfCountVo.getCount());
- }
- voList.add(new BaseClassTreeVo() {{
- setId(6L);
- setName("年级");
- }});
- baseGradeService.list().forEach((node) -> {
- if (node.getStatus() == 1) {
- voList.add(new BaseClassTreeVo() {{
- setId(node.getId());
- setName(node.getName());
- setParentId(6L);
- }});
- }
- });
- baseClassService.list(new QueryWrapper<BaseClass>().lambda().eq(BaseClass::getDeleteMark, DeleteMark.NODELETE.getCode())).forEach((node) -> {
- voList.add(new BaseClassTreeVo() {{
- setId(node.getId());
- setName(node.getName());
- setParentId(node.getGradeId());
- setStatus(0);
- if (qfCountMap.get(node.getId()) != null && qfCountMap.get(node.getId()) > 0) {
- setStatus(1);
- }
- }});
- });
- List<BaseClassTreeVo> treeVoList = TreeUtil.build(voList);
- return RT.ok(treeVoList);
- }
- @GetMapping(value = "/personal-info")
- @ApiOperation(value = "学生个人信息")
- @SaCheckPermission("consumption:detail")
- @XjrLog(value = "学生个人信息", saveResponseData = true)
- public RT<PersonalPortraitPersonalInfoVo> personalInfo(@Valid PersonalInfoDto dto) {
- PersonalPortraitPersonalInfoVo info = pbVXssfdetailService.getPersonalInfo(dto);
- return RT.ok(info);
- }
- @GetMapping(value = "/detail-page")
- @ApiOperation(value = "学生收费明细分页查询")
- @SaCheckPermission("consumption:detail")
- @XjrLog(value = "学生收费明细分页查询")
- public RT<PageOutput<PbVXssfdetailPageVo>> detailPage(@Valid PbVXssfdetailPageDto dto) {
- Page<PbVXssfdetailPageVo> page = pbVXssfdetailService.getPage(new Page<>(dto.getLimit(), dto.getSize()), dto);
- PageOutput<PbVXssfdetailPageVo> pageOutput = ConventPage.getPageOutput(page, PbVXssfdetailPageVo.class);
- return RT.ok(pageOutput);
- }
- @GetMapping(value = "/pb_vx_sxxsfytbPage")
- @ApiOperation(value = "学生消费管理页分页查询")
- @SaCheckPermission("consumption:detail")
- @XjrLog(value = "学生消费管理页分页查询")
- public RT<PageOutput<PbVXsxxsfytbPageVo>> pbVXsxxsfytbPage(@Valid PbVXsxxsfytbPageDto dto) {
- List<String> roleList = StpUtil.getRoleList();
- if (roleList.size() == 2 && roleList.contains("TEACHER") && roleList.contains("CLASSTE")) {
- dto.setTeacherId(StpUtil.getLoginIdAsLong());
- }
- IPage<PbVXsxxsfytbPageVo> page = pbVXsxxsfytbService.getPage(dto);
- PageOutput<PbVXsxxsfytbPageVo> pageOutput = ConventPage.getPageOutput(page, PbVXsxxsfytbPageVo.class);
- return RT.ok(pageOutput);
- }
- @GetMapping(value = "/cost-information")
- @ApiOperation(value = "费用信息")
- @SaCheckPermission("consumption:detail")
- @XjrLog(value = "费用信息", saveResponseData = true)
- public RT<PersonalPortraitFeeInformationVo> costInformation(@Valid PersonalPortraitFeeInformationDto dto) {
- return RT.ok(pbVXsxxsfytbService.listCostInformation(dto));
- }
- @PostMapping("/export-query")
- @ApiOperation(value = "有参导出")
- @XjrLog(value = "有参导出")
- public ResponseEntity<byte[]> exportData(@RequestBody PbVXsxxsfytbExcelDto dto) {
- List<PbVXsxxsfytbExcelVo> dataList = pbVXsxxsfytbService.getList(dto);
- ByteArrayOutputStream bot = new ByteArrayOutputStream();
- EasyExcel.write(bot, PbVXsxxsfytbExcelVo.class).automaticMergeHead(false).excelType(ExcelTypeEnum.XLSX).sheet().doWrite(dataList);
- return RT.fileStream(bot.toByteArray(), "PbVXsxxsfytbExcel" + ExcelTypeEnum.XLSX.getValue());
- }
- @GetMapping(value = "/fee-detail")
- @ApiOperation(value = "学生缴费的详情")
- @SaCheckPermission("consumption:detail")
- @XjrLog(value = "学生缴费的详情")
- public RT<List<FeeDetailListVo>> feeDetail(@RequestParam String studentcode, String beltcode) {
- return RT.ok(pbVXsxxsfytbService.getFeeDetail(studentcode, beltcode));
- }
- @GetMapping(value = "/student-category-stat")
- @ApiOperation(value = "学生类别的人数统计")
- @SaCheckPermission("consumption:detail")
- @XjrLog(value = "学生类别的人数统计", saveResponseData = true)
- public RT<PbStudentCategoryVo> studentCategory(@Valid PbVXsxxsfytbStatDto dto) {
- return RT.ok(pbVXsxxsfytbService.studentCategoryStat(dto));
- }
- @GetMapping(value = "/stduy-status-stat")
- @ApiOperation(value = "就读方式的统计")
- @SaCheckPermission("consumption:detail")
- @XjrLog(value = "就读方式的统计", saveResponseData = true)
- public RT<PbStduyStatusVo> stduyStatus(@Valid PbVXsxxsfytbStatDto dto) {
- return RT.ok(pbVXsxxsfytbService.stduyStatusStat(dto));
- }
- @GetMapping(value = "/class-qf-page")
- @ApiOperation(value = "班级欠费排序")
- @SaCheckPermission("consumption:detail")
- @XjrLog(value = "班级欠费排序")
- public RT<PageOutput<ClassQfPageVo>> classQfPage(@Valid PbVXsxxsfytbStatDto dto) {
- Page<ClassQfPageVo> classQfPage = pbVXsxxsfytbService.getClassQfPage(new Page<>(dto.getLimit(), dto.getSize()), dto);
- PageOutput<ClassQfPageVo> pageOutput = ConventPage.getPageOutput(classQfPage, ClassQfPageVo.class);
- return RT.ok(pageOutput);
- }
- @GetMapping(value = "/feeitem-stat")
- @ApiOperation(value = "各年级的教材费、住宿费、军训费缴费统计")
- @SaCheckPermission("consumption:detail")
- @XjrLog(value = "各年级的教材费、住宿费、军训费缴费统计", saveResponseData = true)
- public RT<PbFeeitemStatVo> feeitemStat(@Valid PbVXsxxsfytbStatDto dto) {
- return RT.ok(pbVXsxxsfytbService.feeitemStat(dto));
- }
- @PostMapping(value = "/class-qf-export-query")
- @ApiOperation(value = "班级欠费排序-导出")
- @SaCheckPermission("consumption:detail")
- @XjrLog(value = "班级欠费排序-导出")
- public ResponseEntity<byte[]> classQfExpert(@Valid @RequestBody PbVXsxxsfytbStatDto dto) {
- long count = baseClassService.count();
- dto.setLimit(1);
- dto.setSize(Integer.parseInt(count + ""));
- List<ClassQfPageVo> records = pbVXsxxsfytbService.getClassQfPage(new Page<>(dto.getLimit(), dto.getSize()), dto).getRecords();
- ByteArrayOutputStream bot = new ByteArrayOutputStream();
- EasyExcel.write(bot, ClassQfPageVo.class).automaticMergeHead(false).excelType(ExcelTypeEnum.XLSX).sheet().doWrite(records);
- return RT.fileStream(bot.toByteArray(), "classQf" + ExcelTypeEnum.XLSX.getValue());
- }
- }
|