|
@@ -0,0 +1,115 @@
|
|
|
+package cn.iocoder.yudao.module.as.controller.admin.financialaidretirementlist;
|
|
|
+
|
|
|
+import cn.iocoder.yudao.module.as.controller.admin.aidingstudentsimportlist.vo.AidingStudentsImportExcelVO;
|
|
|
+import com.alibaba.excel.EasyExcel;
|
|
|
+import com.alibaba.excel.ExcelReader;
|
|
|
+import com.alibaba.excel.read.metadata.ReadSheet;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
+import io.swagger.v3.oas.annotations.Parameter;
|
|
|
+import io.swagger.v3.oas.annotations.Operation;
|
|
|
+
|
|
|
+import javax.validation.constraints.*;
|
|
|
+import javax.validation.*;
|
|
|
+import javax.servlet.http.*;
|
|
|
+import java.util.*;
|
|
|
+import java.io.IOException;
|
|
|
+
|
|
|
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
|
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
|
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
+
|
|
|
+import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
|
+
|
|
|
+import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
|
|
+
|
|
|
+import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
|
|
+
|
|
|
+import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
|
|
+
|
|
|
+import cn.iocoder.yudao.module.as.controller.admin.financialaidretirementlist.vo.*;
|
|
|
+import cn.iocoder.yudao.module.as.dal.dataobject.financialaidretirementlist.FinancialAidRetirementListDO;
|
|
|
+import cn.iocoder.yudao.module.as.service.financialaidretirementlist.FinancialAidRetirementListService;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
+
|
|
|
+@Tag(name = "管理后台 - 家庭经济困难退役复学学生汇总")
|
|
|
+@RestController
|
|
|
+@RequestMapping("/as/financial-aid-retirement-list")
|
|
|
+@Validated
|
|
|
+public class FinancialAidRetirementListController {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private FinancialAidRetirementListService financialAidRetirementListService;
|
|
|
+
|
|
|
+ @PostMapping("/create")
|
|
|
+ @Operation(summary = "创建家庭经济困难退役复学学生汇总")
|
|
|
+ @PreAuthorize("@ss.hasPermission('as:financial-aid-retirement-list:create')")
|
|
|
+ public CommonResult<Long> createFinancialAidRetirementList(@Valid @RequestBody FinancialAidRetirementListSaveReqVO createReqVO) {
|
|
|
+ return success(financialAidRetirementListService.createFinancialAidRetirementList(createReqVO));
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/import-excel")
|
|
|
+ @Operation(summary = "导入家庭经济困难退役复学学生汇总excel")
|
|
|
+ @PreAuthorize("@ss.hasPermission('as:financial-aid-retirement-list:import-excel')")
|
|
|
+ public CommonResult<FinancialAidRetirementListExcelRespVO> importFinancialAidRetirementListExcel(@RequestParam("file") MultipartFile file,@RequestParam("asFinancialAidManageId") Long asFinancialAidManageId) throws IOException {
|
|
|
+
|
|
|
+ List<FinancialAidRetirementListExcelVO> list = EasyExcel.read(file.getInputStream(), FinancialAidRetirementListExcelVO.class, null).sheet("2023-2024学年家庭经济困难学生汇总表").headRowNumber(2).doReadSync();
|
|
|
+
|
|
|
+ return success(financialAidRetirementListService.importFinancialAidRetirementListExcel(list, asFinancialAidManageId));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @PutMapping("/update")
|
|
|
+ @Operation(summary = "更新家庭经济困难退役复学学生汇总")
|
|
|
+ @PreAuthorize("@ss.hasPermission('as:financial-aid-retirement-list:update')")
|
|
|
+ public CommonResult<Boolean> updateFinancialAidRetirementList(@Valid @RequestBody FinancialAidRetirementListSaveReqVO updateReqVO) {
|
|
|
+ financialAidRetirementListService.updateFinancialAidRetirementList(updateReqVO);
|
|
|
+ return success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @DeleteMapping("/delete")
|
|
|
+ @Operation(summary = "删除家庭经济困难退役复学学生汇总")
|
|
|
+ @Parameter(name = "id", description = "编号", required = true)
|
|
|
+ @PreAuthorize("@ss.hasPermission('as:financial-aid-retirement-list:delete')")
|
|
|
+ public CommonResult<Boolean> deleteFinancialAidRetirementList(@RequestParam("id") Long id) {
|
|
|
+ financialAidRetirementListService.deleteFinancialAidRetirementList(id);
|
|
|
+ return success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/get")
|
|
|
+ @Operation(summary = "获得家庭经济困难退役复学学生汇总")
|
|
|
+ @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
+ @PreAuthorize("@ss.hasPermission('as:financial-aid-retirement-list:query')")
|
|
|
+ public CommonResult<FinancialAidRetirementListRespVO> getFinancialAidRetirementList(@RequestParam("id") Long id) {
|
|
|
+ FinancialAidRetirementListDO financialAidRetirementList = financialAidRetirementListService.getFinancialAidRetirementList(id);
|
|
|
+ return success(BeanUtils.toBean(financialAidRetirementList, FinancialAidRetirementListRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/page")
|
|
|
+ @Operation(summary = "获得家庭经济困难退役复学学生汇总分页")
|
|
|
+ @PreAuthorize("@ss.hasPermission('as:financial-aid-retirement-list:query')")
|
|
|
+ public CommonResult<PageResult<FinancialAidRetirementListRespVO>> getFinancialAidRetirementListPage(@Valid FinancialAidRetirementListPageReqVO pageReqVO) {
|
|
|
+ PageResult<FinancialAidRetirementListDO> pageResult = financialAidRetirementListService.getFinancialAidRetirementListPage(pageReqVO);
|
|
|
+ return success(BeanUtils.toBean(pageResult, FinancialAidRetirementListRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/export-excel")
|
|
|
+ @Operation(summary = "导出家庭经济困难退役复学学生汇总 Excel")
|
|
|
+ @PreAuthorize("@ss.hasPermission('as:financial-aid-retirement-list:export')")
|
|
|
+ @ApiAccessLog(operateType = EXPORT)
|
|
|
+ public void exportFinancialAidRetirementListExcel(@Valid FinancialAidRetirementListPageReqVO pageReqVO,
|
|
|
+ HttpServletResponse response) throws IOException {
|
|
|
+ pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
+ List<FinancialAidRetirementListDO> list = financialAidRetirementListService.getFinancialAidRetirementListPage(pageReqVO).getList();
|
|
|
+ // 导出 Excel
|
|
|
+ ExcelUtils.write(response, "家庭经济困难退役复学学生汇总.xls", "数据", FinancialAidRetirementListRespVO.class,
|
|
|
+ BeanUtils.toBean(list, FinancialAidRetirementListRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+}
|