Browse Source

奖助学金调整

dzx 7 months ago
parent
commit
0cbabf574c

+ 100 - 15
src/main/java/com/xjrsoft/module/student/controller/BaseStudentScholarshipReleaseController.java

@@ -2,19 +2,33 @@ package com.xjrsoft.module.student.controller;
 
 import cn.dev33.satoken.annotation.SaCheckPermission;
 import cn.hutool.core.bean.BeanUtil;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+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.github.yulichang.wrapper.MPJLambdaWrapper;
 import com.xjrsoft.common.model.result.RT;
 import com.xjrsoft.common.page.ConventPage;
 import com.xjrsoft.common.page.PageOutput;
+import com.xjrsoft.common.utils.VoToColumnUtil;
+import com.xjrsoft.module.base.entity.BaseClass;
+import com.xjrsoft.module.base.entity.BaseGrade;
+import com.xjrsoft.module.base.entity.BaseMajorSet;
+import com.xjrsoft.module.organization.entity.User;
+import com.xjrsoft.module.organization.service.IUserService;
 import com.xjrsoft.module.student.dto.AddBaseStudentScholarshipReleaseDto;
+import com.xjrsoft.module.student.dto.AddStudentScholarshipDto;
 import com.xjrsoft.module.student.dto.BaseStudentScholarshipReleasePageDto;
 import com.xjrsoft.module.student.dto.UpdateBaseStudentScholarshipReleaseDto;
+import com.xjrsoft.module.student.entity.BaseStudentScholarshipApplicant;
 import com.xjrsoft.module.student.entity.BaseStudentScholarshipRelease;
+import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
+import com.xjrsoft.module.student.service.IBaseStudentScholarshipApplicantService;
 import com.xjrsoft.module.student.service.IBaseStudentScholarshipReleaseService;
+import com.xjrsoft.module.student.vo.BaseStudentScholarshipApplicantVo;
 import com.xjrsoft.module.student.vo.BaseStudentScholarshipReleasePageVo;
+import com.xjrsoft.module.student.vo.BaseStudentScholarshipReleaseRecordVo;
 import com.xjrsoft.module.student.vo.BaseStudentScholarshipReleaseVo;
+import com.xjrsoft.module.system.entity.DictionaryDetail;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
@@ -28,6 +42,7 @@ import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.validation.Valid;
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -42,44 +57,69 @@ import java.util.List;
 @AllArgsConstructor
 public class BaseStudentScholarshipReleaseController {
 
-
+    private final IBaseStudentScholarshipApplicantService applicantService;
     private final IBaseStudentScholarshipReleaseService releaseService;
+    private final IUserService userService;
 
     @GetMapping(value = "/page")
-    @ApiOperation(value="奖学金发放记录表列表(分页)")
+    @ApiOperation(value = "奖学金发放记录表列表(分页)")
     @SaCheckPermission("basestudentscholarshiprelease:detail")
-    public RT<PageOutput<BaseStudentScholarshipReleasePageVo>> page(@Valid BaseStudentScholarshipReleasePageDto dto){
+    public RT<PageOutput<BaseStudentScholarshipReleasePageVo>> page(@Valid BaseStudentScholarshipReleasePageDto dto) {
 
         Page<BaseStudentScholarshipReleasePageVo> page = releaseService.getPage(new Page<>(dto.getLimit(), dto.getSize()), dto);
         PageOutput<BaseStudentScholarshipReleasePageVo> pageOutput = ConventPage.getPageOutput(page, BaseStudentScholarshipReleasePageVo.class);
         return RT.ok(pageOutput);
     }
 
+    @GetMapping(value = "/record")
+    @ApiOperation(value = "奖学金发放记录表列表(分页)")
+    @SaCheckPermission("basestudentscholarshiprelease:detail")
+    public RT<PageOutput<BaseStudentScholarshipReleaseRecordVo>> record(@Valid BaseStudentScholarshipReleasePageDto dto) {
+
+        IPage<BaseStudentScholarshipReleaseRecordVo> page = releaseService.selectJoinListPage(ConventPage.getPage(dto), BaseStudentScholarshipReleaseRecordVo.class,
+                new MPJLambdaWrapper<BaseStudentScholarshipRelease>()
+                        .select(BaseStudentScholarshipRelease::getId)
+                        .select(BaseStudentScholarshipRelease.class,x -> VoToColumnUtil.fieldsToColumns(BaseStudentScholarshipRelease.class).contains(x.getProperty()))
+                        .eq(BaseStudentScholarshipRelease::getBaseStudentScholarshipApplicantId, dto.getApplicantId())
+        );
+        PageOutput<BaseStudentScholarshipReleaseRecordVo> pageOutput = ConventPage.getPageOutput(page, BaseStudentScholarshipReleaseRecordVo.class);
+        return RT.ok(pageOutput);
+    }
+
     @GetMapping(value = "/info")
-    @ApiOperation(value="根据id查询奖学金发放记录表信息")
+    @ApiOperation(value = "根据申请id查询奖学金发放记录表信息")
     @SaCheckPermission("basestudentscholarshiprelease:detail")
-    public RT<BaseStudentScholarshipReleaseVo> info(@RequestParam Long id){
-        BaseStudentScholarshipRelease baseStudentScholarshipRelease = releaseService.getById(id);
-        if (baseStudentScholarshipRelease == null) {
-           return RT.error("找不到此数据!");
+    public RT<BaseStudentScholarshipReleaseVo> info(@RequestParam Long id) {
+        BaseStudentScholarshipApplicant applicant = applicantService.getById(id);
+        if (applicant == null) {
+            return RT.error("找不到此数据!");
         }
-        return RT.ok(BeanUtil.toBean(baseStudentScholarshipRelease, BaseStudentScholarshipReleaseVo.class));
+        List<BaseStudentScholarshipRelease> list = releaseService.list(
+                new QueryWrapper<BaseStudentScholarshipRelease>().lambda()
+                        .eq(BaseStudentScholarshipRelease::getBaseStudentScholarshipApplicantId, id)
+        );
+        double sum = list.stream().filter(value -> value.getAmount() != null).mapToDouble(value -> value.getAmount()).sum();
+        BaseStudentScholarshipReleaseVo releaseVo = new BaseStudentScholarshipReleaseVo();
+        releaseVo.setScholarshipApplicantId(applicant.getBaseStudentScholarshipCategoryId());
+        releaseVo.setTotalAmount(applicant.getAmount());
+        releaseVo.setReleaseAmount(sum);
+        return RT.ok(releaseVo);
     }
 
 
     @PostMapping
     @ApiOperation(value = "新增奖学金发放记录表")
     @SaCheckPermission("basestudentscholarshiprelease:add")
-    public RT<Boolean> add(@Valid @RequestBody AddBaseStudentScholarshipReleaseDto dto){
+    public RT<Boolean> add(@Valid @RequestBody AddBaseStudentScholarshipReleaseDto dto) {
         BaseStudentScholarshipRelease baseStudentScholarshipRelease = BeanUtil.toBean(dto, BaseStudentScholarshipRelease.class);
         boolean isSuccess = releaseService.save(baseStudentScholarshipRelease);
-    return RT.ok(isSuccess);
+        return RT.ok(isSuccess);
     }
 
     @PutMapping
     @ApiOperation(value = "修改奖学金发放记录表")
     @SaCheckPermission("basestudentscholarshiprelease:edit")
-    public RT<Boolean> update(@Valid @RequestBody UpdateBaseStudentScholarshipReleaseDto dto){
+    public RT<Boolean> update(@Valid @RequestBody UpdateBaseStudentScholarshipReleaseDto dto) {
 
         BaseStudentScholarshipRelease baseStudentScholarshipRelease = BeanUtil.toBean(dto, BaseStudentScholarshipRelease.class);
         return RT.ok(releaseService.updateById(baseStudentScholarshipRelease));
@@ -89,9 +129,54 @@ public class BaseStudentScholarshipReleaseController {
     @DeleteMapping
     @ApiOperation(value = "删除奖学金发放记录表")
     @SaCheckPermission("basestudentscholarshiprelease:delete")
-    public RT<Boolean> delete(@Valid @RequestBody List<Long> ids){
+    public RT<Boolean> delete(@Valid @RequestBody List<Long> ids) {
         return RT.ok(releaseService.removeBatchByIds(ids));
-
     }
 
+    @PostMapping("add-student")
+    @ApiOperation(value = "添加学生")
+    @SaCheckPermission("basestudentscholarshiprelease:add")
+    public RT<Boolean> addStudent(@Valid @RequestBody AddStudentScholarshipDto dto) {
+        if(dto.getUserIds() != null && !dto.getUserIds().isEmpty()){
+
+            List<BaseStudentScholarshipApplicantVo> list = userService.selectJoinList(BaseStudentScholarshipApplicantVo.class,
+                    new MPJLambdaWrapper<User>()
+                            .selectAs(User::getId, BaseStudentScholarshipApplicantVo::getApplicantUserId)
+                            .selectAs(User::getName, BaseStudentScholarshipApplicantVo::getName)
+                            .selectAs(User::getCredentialNumber, BaseStudentScholarshipApplicantVo::getStudentId)
+                            .select("t5.name", BaseStudentScholarshipApplicantVo::getGenderName)
+                            .select("t4.name", BaseStudentScholarshipApplicantVo::getEnrollTypeCn)
+                            .selectAs(BaseMajorSet::getName, BaseStudentScholarshipApplicantVo::getMajorName)
+                            .selectAs(BaseClass::getName, BaseStudentScholarshipApplicantVo::getClassName)
+                            .selectAs(BaseGrade::getName, BaseStudentScholarshipApplicantVo::getGradeName)
+                            .innerJoin(BaseStudentSchoolRoll.class, BaseStudentSchoolRoll::getUserId, User::getId)
+                            .innerJoin(BaseClass.class, BaseClass::getId, BaseStudentSchoolRoll::getClassId)
+                            .innerJoin(BaseGrade.class, BaseGrade::getId, BaseClass::getGradeId)
+                            .leftJoin(DictionaryDetail.class, DictionaryDetail::getCode, BaseStudentSchoolRoll::getEnrollType)
+                            .leftJoin(DictionaryDetail.class, DictionaryDetail::getCode, User::getGender)
+                            .leftJoin(BaseMajorSet.class, BaseMajorSet::getId, BaseStudentSchoolRoll::getMajorSetId)
+            );
+            List<BaseStudentScholarshipApplicant> dataList = new ArrayList<>();
+            for (BaseStudentScholarshipApplicantVo applicantVo : list) {
+                dataList.add(
+                        new BaseStudentScholarshipApplicant(){{
+                            setStudentId(applicantVo.getStudentId());
+                            setName(applicantVo.getName());
+                            setClassName(applicantVo.getClassName());
+                            setApplicantUserId(applicantVo.getApplicantUserId());
+                            setGenderName(applicantVo.getGenderName());
+                            setEnrollTypeCn(applicantVo.getEnrollTypeCn());
+                            setMajorName(applicantVo.getMajorName());
+                            setGradeName(applicantVo.getGradeName());
+                            setStatus(1);
+                        }}
+                );
+            }
+            if(!dataList.isEmpty()){
+                applicantService.saveBatch(dataList);
+            }
+
+        }
+        return RT.ok(true);
+    }
 }

+ 42 - 0
src/main/java/com/xjrsoft/module/student/dto/AddStudentScholarshipDto.java

@@ -0,0 +1,42 @@
+package com.xjrsoft.module.student.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.List;
+
+
+/**
+* @title: 新生维护信息
+* @Author dzx
+* @Date: 2024-06-27
+* @Version 1.0
+*/
+@Data
+public class AddStudentScholarshipDto implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+    * 
+    */
+    @ApiModelProperty("学期id")
+    private Long semesterId;
+    /**
+    * 毕业学校
+    */
+    @ApiModelProperty("奖助学金id")
+    private Long baseStudentScholarshipCategoryId;
+    /**
+    * 学生姓名
+    */
+    @ApiModelProperty("学生id")
+    private List<Long> userIds;
+    /**
+    * 性别
+    */
+    @ApiModelProperty("等级")
+    private Integer scholarshipLevel;
+}

+ 3 - 0
src/main/java/com/xjrsoft/module/student/dto/BaseStudentScholarshipReleasePageDto.java

@@ -34,4 +34,7 @@ public class BaseStudentScholarshipReleasePageDto extends PageInput {
     @ApiModelProperty("申请奖助学金id")
     private Long scholarshipCategoryId;
 
+    @ApiModelProperty("申请id")
+    private Long applicantId;
+
 }

+ 4 - 0
src/main/java/com/xjrsoft/module/student/entity/BaseStudentScholarshipApplicant.java

@@ -159,4 +159,8 @@ public class BaseStudentScholarshipApplicant implements Serializable {
     private String bankUserName;
 
 
+    @ApiModelProperty("申请金额")
+    private Double amount;
+
+
 }

+ 4 - 0
src/main/java/com/xjrsoft/module/student/vo/BaseStudentScholarshipCategoryStatisticPageVo.java

@@ -43,4 +43,8 @@ public class BaseStudentScholarshipCategoryStatisticPageVo {
     @ApiModelProperty("发放金额")
     private Double releaseAmount;
 
+
+    @ApiModelProperty("申请人数")
+    private Integer applicantCount;
+
 }

+ 75 - 0
src/main/java/com/xjrsoft/module/student/vo/BaseStudentScholarshipReleaseRecordVo.java

@@ -0,0 +1,75 @@
+package com.xjrsoft.module.student.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+* @title: 奖学金发放记录表分页列表出参
+* @Author dzx
+* @Date: 2024-07-25
+* @Version 1.0
+*/
+@Data
+public class BaseStudentScholarshipReleaseRecordVo {
+
+    /**
+    * 
+    */
+    @ApiModelProperty("")
+    private String id;
+    /**
+    * 奖学金申请id
+    */
+    @ApiModelProperty("学期名称")
+    private String semesterName;
+    /**
+    * 发放金额
+    */
+    @ApiModelProperty("发放状态(2:全部发放 1:部分发放 0:未发放)")
+    private Integer releaseStatus;
+    /**
+    * 发放日期
+    */
+    @ApiModelProperty("姓名")
+    private String name;
+
+    @ApiModelProperty("性别")
+    private String genderCn;
+
+    @ApiModelProperty("身份证号")
+    private String credentialNumber;
+
+    @ApiModelProperty("班级名称")
+    private String className;
+
+    @ApiModelProperty("申请奖助学金名称")
+    private String scholarshipCategory;
+
+    @ApiModelProperty("奖助学金类型")
+    private String categoryCn;
+
+
+    @ApiModelProperty("等级")
+    private Integer scholarshipLevel;
+
+    @ApiModelProperty("金额")
+    private Double amount;
+
+    @ApiModelProperty("银行卡号")
+    private String bankNo;
+
+    @ApiModelProperty("收款银行名称")
+    private String bankType;
+
+    @ApiModelProperty("银行账户名称")
+    private String bankUserName;
+
+    @ApiModelProperty("发放金额")
+    private Double releaseAmount;
+
+    @ApiModelProperty("发放日期")
+    private Date releaseDate;
+
+}

+ 5 - 16
src/main/java/com/xjrsoft/module/student/vo/BaseStudentScholarshipReleaseVo.java

@@ -3,8 +3,6 @@ package com.xjrsoft.module.student.vo;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
-import java.util.Date;
-
 /**
 * @title: 奖学金发放记录表表单出参
 * @Author dzx
@@ -13,28 +11,19 @@ import java.util.Date;
 */
 @Data
 public class BaseStudentScholarshipReleaseVo {
-
-    /**
-    * 
-    */
-    @ApiModelProperty("")
-    private Long id;
     /**
     * 奖学金申请id
     */
     @ApiModelProperty("奖学金申请id")
-    private Long baseStudentScholarshipApplicantId;
+    private Long scholarshipApplicantId;
     /**
     * 发放金额
     */
-    @ApiModelProperty("发放金额")
-    private Double amount;
+    @ApiModelProperty("发放金额")
+    private Double releaseAmount;
     /**
     * 发放日期
     */
-    @ApiModelProperty("发放日期")
-    private Date releaseDate;
-
-
-
+    @ApiModelProperty("申请总金额")
+    private Double totalAmount;
 }

+ 5 - 3
src/main/resources/mapper/student/BaseStudentScholarshipCategoryMapper.xml

@@ -10,10 +10,12 @@
         SELECT SUM(a1.amount) FROM base_student_scholarship_release a1
         LEFT JOIN base_student_scholarship_applicant a2 ON a1.base_student_scholarship_applicant_id = a2.id
         WHERE a2.base_student_scholarship_category_id = t1.id AND a1.delete_mark = 0 AND a2.delete_mark = 0
-        ) AS release_amount FROM base_student_scholarship_category t1
+        ) AS release_amount,(
+        select count(*) from base_student_scholarship_applicant
+        where status = 1 and base_student_scholarship_category_id = t1.id
+        and delete_mark = 0
+        ) as applicant_count FROM base_student_scholarship_category t1
         LEFT JOIN xjr_dictionary_detail t2 ON t1.category = t2.code
         WHERE t1.delete_mark = 0;
     </select>
-
-
 </mapper>