Browse Source

导入退役名单

houlai 6 months ago
parent
commit
f291707a0f
14 changed files with 761 additions and 2 deletions
  1. 3 0
      yudao-module-as/yudao-module-as-api/src/main/java/cn/iocoder/yudao/module/as/enums/ErrorCodeConstants.java
  2. 1 1
      yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/controller/admin/financialaidmanage/vo/FinancialAidManageSaveReqVO.java
  3. 26 0
      yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/controller/admin/financialaidmanage/vo/FinancialAidQuota.java
  4. 115 0
      yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/controller/admin/financialaidretirementlist/FinancialAidRetirementListController.java
  5. 22 0
      yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/controller/admin/financialaidretirementlist/vo/FinancialAidRetirementListExcelRespVO.java
  6. 80 0
      yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/controller/admin/financialaidretirementlist/vo/FinancialAidRetirementListExcelVO.java
  7. 62 0
      yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/controller/admin/financialaidretirementlist/vo/FinancialAidRetirementListPageReqVO.java
  8. 76 0
      yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/controller/admin/financialaidretirementlist/vo/FinancialAidRetirementListRespVO.java
  9. 55 0
      yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/controller/admin/financialaidretirementlist/vo/FinancialAidRetirementListSaveReqVO.java
  10. 4 1
      yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/dal/dataobject/financialaidmanage/FinancialAidManageDO.java
  11. 83 0
      yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/dal/dataobject/financialaidretirementlist/FinancialAidRetirementListDO.java
  12. 39 0
      yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/dal/mysql/financialaidretirementlist/FinancialAidRetirementListMapper.java
  13. 56 0
      yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/service/financialaidretirementlist/FinancialAidRetirementListService.java
  14. 139 0
      yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/service/financialaidretirementlist/FinancialAidRetirementListServiceImpl.java

+ 3 - 0
yudao-module-as/yudao-module-as-api/src/main/java/cn/iocoder/yudao/module/as/enums/ErrorCodeConstants.java

@@ -16,6 +16,9 @@ public interface ErrorCodeConstants {
     ErrorCode AIDING_STUDENTS_IMPORT_LIST_STUDENT_CODE_NOT_EXISTS = new ErrorCode(2_009_000_008,  "系统中不存在该学生学号");
     ErrorCode AIDING_STUDENTS_IMPORT_LIST_FILE_IMPORT_ERROR = new ErrorCode(2_009_000_009,  "excel解析失败");
     ErrorCode AIDING_STUDENTS_IMPORT_LIST_FAILURE = new ErrorCode(2_009_000_010,  "自治区名单导入失败");
+    ErrorCode FINANCIAL_AID_RETIREMENT_LIST_NOT_EXISTS = new ErrorCode(2_009_000_011, "家庭经济困难退役复学学生汇总不存在");
+    ErrorCode FINANCIAL_AID_RETIREMENT_LIST_EXCEL_ISNULL = new ErrorCode(2_009_000_011, "家庭经济困难退役复学学生汇总excel解析为空");
+
 
 
 }

+ 1 - 1
yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/controller/admin/financialaidmanage/vo/FinancialAidManageSaveReqVO.java

@@ -33,7 +33,7 @@ public class FinancialAidManageSaveReqVO {
     private String faNoticeFileName;
 
     @Schema(description = "助学金各学院名额分配")
-    private String financialAidQuota;
+    private FinancialAidQuota financialAidQuota;
 
     @Schema(description = "绑定家庭经济困难认定管理")
     private Integer studentManageId;

+ 26 - 0
yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/controller/admin/financialaidmanage/vo/FinancialAidQuota.java

@@ -0,0 +1,26 @@
+package cn.iocoder.yudao.module.as.controller.admin.financialaidmanage.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+@Schema(description = "管理后台 - 助学金项目管理各学院名额分配")
+@Data
+public class FinancialAidQuota {
+    @Schema(description = "计算机学院一等名额")
+    private Integer computerCollegeFirstQuota;
+
+    @Schema(description = "计算机学院二等名额")
+    private Integer computerCollegeSecondQuota;
+
+    @Schema(description = "计算机学院三等名额")
+    private Integer computerCollegeThirdQuota;
+
+    @Schema(description = "测绘学院一等名额")
+    private Integer geomaticsCollegeFirstQuota;
+
+    @Schema(description = "测绘学院二等名额")
+    private Integer geomaticsCollegeSecondQuota;
+
+    @Schema(description = "测绘学院三等名额")
+    private Integer geomaticsCollegeThirdQuota;
+
+}

+ 115 - 0
yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/controller/admin/financialaidretirementlist/FinancialAidRetirementListController.java

@@ -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));
+    }
+
+}

+ 22 - 0
yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/controller/admin/financialaidretirementlist/vo/FinancialAidRetirementListExcelRespVO.java

@@ -0,0 +1,22 @@
+package cn.iocoder.yudao.module.as.controller.admin.financialaidretirementlist.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Builder;
+import lombok.Data;
+
+import java.util.List;
+import java.util.Map;
+
+@Schema(description = "管理后台 - 家庭经济困难退役复学学生汇总导入excel  Response VO")
+@Data
+@Builder
+public class FinancialAidRetirementListExcelRespVO {
+    @Schema(description = "导入成功的学生名数组", requiredMode = Schema.RequiredMode.REQUIRED)
+    private List<String> createStudentNames;
+
+/*    @Schema(description = "更新成功的学生名数组", requiredMode = Schema.RequiredMode.REQUIRED)
+    private List<String> updateStudentNames;*/
+
+    @Schema(description = "导入失败的学生集合,key 为用户名,value 为失败原因", requiredMode = Schema.RequiredMode.REQUIRED)
+    private Map<String, String> failureStudentNames;
+}

+ 80 - 0
yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/controller/admin/financialaidretirementlist/vo/FinancialAidRetirementListExcelVO.java

@@ -0,0 +1,80 @@
+package cn.iocoder.yudao.module.as.controller.admin.financialaidretirementlist.vo;
+
+import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
+import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
+import cn.iocoder.yudao.module.system.enums.DictTypeConstants;
+import com.alibaba.excel.annotation.ExcelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+import javax.validation.constraints.NotNull;
+import java.time.LocalDateTime;
+
+@Schema(description = "管理后台 - 家庭经济困难退役复学学生汇总导入excel VO")
+@Data
+@Builder
+@AllArgsConstructor
+@NoArgsConstructor
+@Accessors(chain = false) // 设置 chain = false,避免导入有问题
+public class FinancialAidRetirementListExcelVO {
+
+/*    @Schema(description = "序号", example = "1")
+    @ExcelProperty("序号")
+    private Long id;*/
+
+    @Schema(description = "学院名字", example = "赵六")
+    @ExcelProperty(value = "学院")
+    private String collegeName;
+
+
+    @Schema(description = "姓名", example = "芋艿")
+    @ExcelProperty("姓名")
+    private String studentName;
+
+    @Schema(description = "学生性别(男生为1,女生为2,未知为3)")
+    @ExcelProperty(value = "性别", converter = DictConvert.class)
+    @DictFormat(DictTypeConstants.USER_SEX)
+    private Integer studentSex;
+
+    @Schema(description = "民族")
+    @ExcelProperty("民族")
+    private String studentNation;
+
+    @Schema(description = "年级")
+    @ExcelProperty("年级")
+    private String studentGrade;
+
+    @Schema(description = "专业")
+    @ExcelProperty("专业")
+    private String studentMajor;
+
+    @Schema(description = "班级")
+    @ExcelProperty("班级")
+    private String studentClass;
+
+    @Schema(description = "学号")
+    @ExcelProperty("学号")
+    private String studentCode;
+
+    @Schema(description = "入学年月")
+    @ExcelProperty("入学年月")
+    private String studentEnrollmentDate;
+
+    @Schema(description = "困难认定等级,如1,2,3")
+    @ExcelProperty("困难认定等级")
+    private Integer studentDifficultyLevel;
+
+    @Schema(description = "户籍地")
+    @ExcelProperty("户籍地")
+    private String studentHometown;
+
+    @Schema(description = "退役复学学生核对情况,如退役复学学生")
+    @ExcelProperty("退役复学学生核对情况")
+    private String studentCheck;
+
+
+}

+ 62 - 0
yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/controller/admin/financialaidretirementlist/vo/FinancialAidRetirementListPageReqVO.java

@@ -0,0 +1,62 @@
+package cn.iocoder.yudao.module.as.controller.admin.financialaidretirementlist.vo;
+
+import lombok.*;
+import java.util.*;
+import io.swagger.v3.oas.annotations.media.Schema;
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import org.springframework.format.annotation.DateTimeFormat;
+import java.time.LocalDateTime;
+
+import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
+
+@Schema(description = "管理后台 - 家庭经济困难退役复学学生汇总分页 Request VO")
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+public class FinancialAidRetirementListPageReqVO extends PageParam {
+
+    @Schema(description = "学院名字", example = "赵六")
+    private String collegeName;
+
+    @Schema(description = "外键:助学金项目管理id", example = "27297")
+    private Long asFinancialAidManageId;
+
+    @Schema(description = "姓名", example = "芋艿")
+    private String studentName;
+
+    @Schema(description = "学生性别(男生为1,女生为2,未知为3)")
+    private Integer studentSex;
+
+    @Schema(description = "民族")
+    private String studentNation;
+
+    @Schema(description = "年级")
+    private String studentGrade;
+
+    @Schema(description = "专业")
+    private String studentMajor;
+
+    @Schema(description = "班级")
+    private String studentClass;
+
+    @Schema(description = "学号")
+    private String studentCode;
+
+    @Schema(description = "入学年月")
+    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+    private String[] studentEnrollmentDate;
+
+    @Schema(description = "困难认定等级,如1,2,3")
+    private Integer studentDifficultyLevel;
+
+    @Schema(description = "户籍地")
+    private String studentHometown;
+
+    @Schema(description = "退役复学学生核对情况,如退役复学学生")
+    private String studentCheck;
+
+    @Schema(description = "导入/创建时间")
+    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+    private LocalDateTime[] createTime;
+
+}

+ 76 - 0
yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/controller/admin/financialaidretirementlist/vo/FinancialAidRetirementListRespVO.java

@@ -0,0 +1,76 @@
+package cn.iocoder.yudao.module.as.controller.admin.financialaidretirementlist.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.*;
+import java.util.*;
+import java.util.*;
+import org.springframework.format.annotation.DateTimeFormat;
+import java.time.LocalDateTime;
+import com.alibaba.excel.annotation.*;
+
+@Schema(description = "管理后台 - 家庭经济困难退役复学学生汇总 Response VO")
+@Data
+@ExcelIgnoreUnannotated
+public class FinancialAidRetirementListRespVO {
+
+    @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "27814")
+    @ExcelProperty("id")
+    private Long id;
+
+    @Schema(description = "学院名字", example = "赵六")
+    @ExcelProperty("学院名字")
+    private String collegeName;
+
+    @Schema(description = "外键:助学金项目管理id", requiredMode = Schema.RequiredMode.REQUIRED, example = "27297")
+    @ExcelProperty("外键:助学金项目管理id")
+    private Long asFinancialAidManageId;
+
+    @Schema(description = "姓名", example = "芋艿")
+    @ExcelProperty("姓名")
+    private String studentName;
+
+    @Schema(description = "学生性别(男生为1,女生为2,未知为3)")
+    @ExcelProperty("学生性别(男生为1,女生为2,未知为3)")
+    private Integer studentSex;
+
+    @Schema(description = "民族")
+    @ExcelProperty("民族")
+    private String studentNation;
+
+    @Schema(description = "年级")
+    @ExcelProperty("年级")
+    private String studentGrade;
+
+    @Schema(description = "专业")
+    @ExcelProperty("专业")
+    private String studentMajor;
+
+    @Schema(description = "班级")
+    @ExcelProperty("班级")
+    private String studentClass;
+
+    @Schema(description = "学号")
+    @ExcelProperty("学号")
+    private String studentCode;
+
+    @Schema(description = "入学年月")
+    @ExcelProperty("入学年月")
+    private String studentEnrollmentDate;
+
+    @Schema(description = "困难认定等级,如1,2,3")
+    @ExcelProperty("困难认定等级,如1,2,3")
+    private Integer studentDifficultyLevel;
+
+    @Schema(description = "户籍地")
+    @ExcelProperty("户籍地")
+    private String studentHometown;
+
+    @Schema(description = "退役复学学生核对情况,如退役复学学生")
+    @ExcelProperty("退役复学学生核对情况,如退役复学学生")
+    private String studentCheck;
+
+    @Schema(description = "导入/创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("导入/创建时间")
+    private LocalDateTime createTime;
+
+}

+ 55 - 0
yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/controller/admin/financialaidretirementlist/vo/FinancialAidRetirementListSaveReqVO.java

@@ -0,0 +1,55 @@
+package cn.iocoder.yudao.module.as.controller.admin.financialaidretirementlist.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.*;
+import java.util.*;
+import javax.validation.constraints.*;
+
+@Schema(description = "管理后台 - 家庭经济困难退役复学学生汇总新增/修改 Request VO")
+@Data
+public class FinancialAidRetirementListSaveReqVO {
+
+    @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "27814")
+    private Long id;
+
+    @Schema(description = "学院名字", example = "赵六")
+    private String collegeName;
+
+    @Schema(description = "外键:助学金项目管理id", requiredMode = Schema.RequiredMode.REQUIRED, example = "27297")
+    @NotNull(message = "外键:助学金项目管理id不能为空")
+    private Long asFinancialAidManageId;
+
+    @Schema(description = "姓名", example = "芋艿")
+    private String studentName;
+
+    @Schema(description = "学生性别(男生为1,女生为2,未知为3)")
+    private Integer studentSex;
+
+    @Schema(description = "民族")
+    private String studentNation;
+
+    @Schema(description = "年级")
+    private String studentGrade;
+
+    @Schema(description = "专业")
+    private String studentMajor;
+
+    @Schema(description = "班级")
+    private String studentClass;
+
+    @Schema(description = "学号")
+    private String studentCode;
+
+    @Schema(description = "入学年月")
+    private String studentEnrollmentDate;
+
+    @Schema(description = "困难认定等级,如1,2,3")
+    private Integer studentDifficultyLevel;
+
+    @Schema(description = "户籍地")
+    private String studentHometown;
+
+    @Schema(description = "退役复学学生核对情况,如退役复学学生")
+    private String studentCheck;
+
+}

+ 4 - 1
yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/dal/dataobject/financialaidmanage/FinancialAidManageDO.java

@@ -1,5 +1,7 @@
 package cn.iocoder.yudao.module.as.dal.dataobject.financialaidmanage;
 
+import cn.iocoder.yudao.module.as.controller.admin.financialaidmanage.vo.FinancialAidQuota;
+import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
 import lombok.*;
 import java.util.*;
 import java.time.LocalDateTime;
@@ -55,6 +57,7 @@ public class FinancialAidManageDO extends BaseDO {
     /**
      * 助学金各学院名额分配
      */
-    private String financialAidQuota;
+    @TableField(typeHandler = JacksonTypeHandler.class)
+    private FinancialAidQuota financialAidQuota;
 
 }

+ 83 - 0
yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/dal/dataobject/financialaidretirementlist/FinancialAidRetirementListDO.java

@@ -0,0 +1,83 @@
+package cn.iocoder.yudao.module.as.dal.dataobject.financialaidretirementlist;
+
+import lombok.*;
+import java.util.*;
+import java.time.LocalDateTime;
+import java.time.LocalDateTime;
+import com.baomidou.mybatisplus.annotation.*;
+import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
+
+/**
+ * 家庭经济困难退役复学学生汇总 DO
+ *
+ * @author ydm
+ */
+@TableName("as_financial_aid_retirement_list")
+@KeySequence("as_financial_aid_retirement_list_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class FinancialAidRetirementListDO extends BaseDO {
+
+    /**
+     * id
+     */
+    @TableId
+    private Long id;
+    /**
+     * 学院名字
+     */
+    private String collegeName;
+    /**
+     * 外键:助学金项目管理id
+     */
+    private Long asFinancialAidManageId;
+    /**
+     * 姓名
+     */
+    private String studentName;
+    /**
+     * 学生性别(男生为1,女生为2,未知为3)
+     */
+    private Integer studentSex;
+    /**
+     * 民族
+     */
+    private String studentNation;
+    /**
+     * 年级
+     */
+    private String studentGrade;
+    /**
+     * 专业
+     */
+    private String studentMajor;
+    /**
+     * 班级
+     */
+    private String studentClass;
+    /**
+     * 学号
+     */
+    private String studentCode;
+    /**
+     * 入学年月
+     */
+    private String studentEnrollmentDate;
+    /**
+     * 困难认定等级,如1,2,3
+     */
+    private Integer studentDifficultyLevel;
+    /**
+     * 户籍地
+     */
+    private String studentHometown;
+    /**
+     * 退役复学学生核对情况,如退役复学学生
+     */
+    private String studentCheck;
+
+}

+ 39 - 0
yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/dal/mysql/financialaidretirementlist/FinancialAidRetirementListMapper.java

@@ -0,0 +1,39 @@
+package cn.iocoder.yudao.module.as.dal.mysql.financialaidretirementlist;
+
+import java.util.*;
+
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
+import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
+import cn.iocoder.yudao.module.as.dal.dataobject.financialaidretirementlist.FinancialAidRetirementListDO;
+import org.apache.ibatis.annotations.Mapper;
+import cn.iocoder.yudao.module.as.controller.admin.financialaidretirementlist.vo.*;
+
+/**
+ * 家庭经济困难退役复学学生汇总 Mapper
+ *
+ * @author ydm
+ */
+@Mapper
+public interface FinancialAidRetirementListMapper extends BaseMapperX<FinancialAidRetirementListDO> {
+
+    default PageResult<FinancialAidRetirementListDO> selectPage(FinancialAidRetirementListPageReqVO reqVO) {
+        return selectPage(reqVO, new LambdaQueryWrapperX<FinancialAidRetirementListDO>()
+                .likeIfPresent(FinancialAidRetirementListDO::getCollegeName, reqVO.getCollegeName())
+                .eqIfPresent(FinancialAidRetirementListDO::getAsFinancialAidManageId, reqVO.getAsFinancialAidManageId())
+                .likeIfPresent(FinancialAidRetirementListDO::getStudentName, reqVO.getStudentName())
+                .eqIfPresent(FinancialAidRetirementListDO::getStudentSex, reqVO.getStudentSex())
+                .eqIfPresent(FinancialAidRetirementListDO::getStudentNation, reqVO.getStudentNation())
+                .eqIfPresent(FinancialAidRetirementListDO::getStudentGrade, reqVO.getStudentGrade())
+                .eqIfPresent(FinancialAidRetirementListDO::getStudentMajor, reqVO.getStudentMajor())
+                .eqIfPresent(FinancialAidRetirementListDO::getStudentClass, reqVO.getStudentClass())
+                .eqIfPresent(FinancialAidRetirementListDO::getStudentCode, reqVO.getStudentCode())
+                .betweenIfPresent(FinancialAidRetirementListDO::getStudentEnrollmentDate, reqVO.getStudentEnrollmentDate())
+                .eqIfPresent(FinancialAidRetirementListDO::getStudentDifficultyLevel, reqVO.getStudentDifficultyLevel())
+                .eqIfPresent(FinancialAidRetirementListDO::getStudentHometown, reqVO.getStudentHometown())
+                .eqIfPresent(FinancialAidRetirementListDO::getStudentCheck, reqVO.getStudentCheck())
+                .betweenIfPresent(FinancialAidRetirementListDO::getCreateTime, reqVO.getCreateTime())
+                .orderByDesc(FinancialAidRetirementListDO::getId));
+    }
+
+}

+ 56 - 0
yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/service/financialaidretirementlist/FinancialAidRetirementListService.java

@@ -0,0 +1,56 @@
+package cn.iocoder.yudao.module.as.service.financialaidretirementlist;
+
+import java.util.*;
+import javax.validation.*;
+import cn.iocoder.yudao.module.as.controller.admin.financialaidretirementlist.vo.*;
+import cn.iocoder.yudao.module.as.dal.dataobject.financialaidretirementlist.FinancialAidRetirementListDO;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+
+/**
+ * 家庭经济困难退役复学学生汇总 Service 接口
+ *
+ * @author ydm
+ */
+public interface FinancialAidRetirementListService {
+
+    /**
+     * 创建家庭经济困难退役复学学生汇总
+     *
+     * @param createReqVO 创建信息
+     * @return 编号
+     */
+    Long createFinancialAidRetirementList(@Valid FinancialAidRetirementListSaveReqVO createReqVO);
+
+    /**
+     * 更新家庭经济困难退役复学学生汇总
+     *
+     * @param updateReqVO 更新信息
+     */
+    void updateFinancialAidRetirementList(@Valid FinancialAidRetirementListSaveReqVO updateReqVO);
+
+    /**
+     * 删除家庭经济困难退役复学学生汇总
+     *
+     * @param id 编号
+     */
+    void deleteFinancialAidRetirementList(Long id);
+
+    /**
+     * 获得家庭经济困难退役复学学生汇总
+     *
+     * @param id 编号
+     * @return 家庭经济困难退役复学学生汇总
+     */
+    FinancialAidRetirementListDO getFinancialAidRetirementList(Long id);
+
+    /**
+     * 获得家庭经济困难退役复学学生汇总分页
+     *
+     * @param pageReqVO 分页查询
+     * @return 家庭经济困难退役复学学生汇总分页
+     */
+    PageResult<FinancialAidRetirementListDO> getFinancialAidRetirementListPage(FinancialAidRetirementListPageReqVO pageReqVO);
+
+    FinancialAidRetirementListExcelRespVO importFinancialAidRetirementListExcel(List<FinancialAidRetirementListExcelVO> list,Long asFinancialAidManageId);
+}

+ 139 - 0
yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/service/financialaidretirementlist/FinancialAidRetirementListServiceImpl.java

@@ -0,0 +1,139 @@
+package cn.iocoder.yudao.module.as.service.financialaidretirementlist;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.iocoder.yudao.module.as.controller.admin.aidingstudentsimportlist.vo.AidingStudentsImportExcelRespVO;
+import cn.iocoder.yudao.module.as.dal.dataobject.aidingstudentsimportlist.AidingStudentsImportExcelListDO;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.*;
+
+import cn.iocoder.yudao.module.as.controller.admin.financialaidretirementlist.vo.*;
+import cn.iocoder.yudao.module.as.dal.dataobject.financialaidretirementlist.FinancialAidRetirementListDO;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
+
+import cn.iocoder.yudao.module.as.dal.mysql.financialaidretirementlist.FinancialAidRetirementListMapper;
+
+import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
+import static cn.iocoder.yudao.module.as.enums.ErrorCodeConstants.*;
+
+/**
+ * 家庭经济困难退役复学学生汇总 Service 实现类
+ *
+ * @author ydm
+ */
+@Service
+@Validated
+public class FinancialAidRetirementListServiceImpl implements FinancialAidRetirementListService {
+
+    @Resource
+    private FinancialAidRetirementListMapper financialAidRetirementListMapper;
+
+    @Override
+    public Long createFinancialAidRetirementList(FinancialAidRetirementListSaveReqVO createReqVO) {
+        // 插入
+        FinancialAidRetirementListDO financialAidRetirementList = BeanUtils.toBean(createReqVO, FinancialAidRetirementListDO.class);
+        financialAidRetirementListMapper.insert(financialAidRetirementList);
+        // 返回
+        return financialAidRetirementList.getId();
+    }
+
+    @Override
+    public void updateFinancialAidRetirementList(FinancialAidRetirementListSaveReqVO updateReqVO) {
+        // 校验存在
+        validateFinancialAidRetirementListExists(updateReqVO.getId());
+        // 更新
+        FinancialAidRetirementListDO updateObj = BeanUtils.toBean(updateReqVO, FinancialAidRetirementListDO.class);
+        financialAidRetirementListMapper.updateById(updateObj);
+    }
+
+    @Override
+    public void deleteFinancialAidRetirementList(Long id) {
+        // 校验存在
+        validateFinancialAidRetirementListExists(id);
+        // 删除
+        financialAidRetirementListMapper.deleteById(id);
+    }
+
+    private void validateFinancialAidRetirementListExists(Long id) {
+        if (financialAidRetirementListMapper.selectById(id) == null) {
+            throw exception(FINANCIAL_AID_RETIREMENT_LIST_NOT_EXISTS);
+        }
+    }
+
+    @Override
+    public FinancialAidRetirementListDO getFinancialAidRetirementList(Long id) {
+        return financialAidRetirementListMapper.selectById(id);
+    }
+
+    @Override
+    public PageResult<FinancialAidRetirementListDO> getFinancialAidRetirementListPage(FinancialAidRetirementListPageReqVO pageReqVO) {
+        return financialAidRetirementListMapper.selectPage(pageReqVO);
+    }
+
+    @Override
+    //根据项目id和list导入数据库
+    @Transactional(rollbackFor = Exception.class) // 添加事务,异常则回滚所有导入
+    public FinancialAidRetirementListExcelRespVO importFinancialAidRetirementListExcel(List<FinancialAidRetirementListExcelVO> list, Long asFinancialAidManageId) {
+        // 校验是否为空
+        if (CollUtil.isEmpty(list)) {
+            throw exception(FINANCIAL_AID_RETIREMENT_LIST_EXCEL_ISNULL);
+        }
+        // 创建响应对象
+        FinancialAidRetirementListExcelRespVO respVO = FinancialAidRetirementListExcelRespVO.builder().createStudentNames(new ArrayList<>())
+                .failureStudentNames(new LinkedHashMap<>()).build();
+
+
+        // 转换对象
+        List<FinancialAidRetirementListDO> financialAidRetirementListDOS = BeanUtils.toBean(list, FinancialAidRetirementListDO.class);
+        financialAidRetirementListDOS.forEach(financialAidRetirementListDO -> {
+
+            //TODO 校验,判断是否有不符合的原因
+
+            /*String result = validateImportListForCreateOrUpdate(financialAidRetirementListDO.getStudentName(), financialAidRetirementListDO.getStudentIdNumber(),
+                    financialAidRetirementListDO.getStudentCode(), financialAidRetirementListDO.getStudentAge(), financialAidRetirementListDO.getStudentSex());
+            if (result != null) {
+                respVO.getFailureStudentNames().put(financialAidRetirementListDO.getStudentName(), result);
+                return;
+            }*/
+            //赋值给外键
+            financialAidRetirementListDO.setAsFinancialAidManageId(asFinancialAidManageId);
+
+
+            //判断此次项目数据库是否已经存在
+            if (checkStudentCodeExists(financialAidRetirementListDO.getStudentCode(), asFinancialAidManageId)) {
+                respVO.getFailureStudentNames().put(financialAidRetirementListDO.getStudentName(), "该学生已导入过一次");
+                return;
+            }
+            //插入数据库
+            financialAidRetirementListMapper.insert(financialAidRetirementListDO);
+            respVO.getCreateStudentNames().add(financialAidRetirementListDO.getStudentName());
+        });
+        if (CollUtil.isNotEmpty(respVO.getFailureStudentNames())) {
+            respVO.setCreateStudentNames(null);
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+        }
+        return respVO;
+    }
+
+    //根据学号校验这次项目该学生是否已经导入
+    private boolean checkStudentCodeExists(String studentCode, Long asFinancialAidManageId) {
+        //存在返回true,不存在返回false
+        return financialAidRetirementListMapper.selectCount(
+                Wrappers.lambdaQuery(FinancialAidRetirementListDO.class)
+                        .eq(FinancialAidRetirementListDO::getStudentCode, studentCode)
+                        .eq(FinancialAidRetirementListDO::getAsFinancialAidManageId, asFinancialAidManageId)
+        ) > 0;
+
+
+    }
+
+}