Explorar o código

收费管理,调整导出和树

dzx hai 1 ano
pai
achega
10076fbb4d

+ 23 - 20
src/main/java/com/xjrsoft/module/student/controller/ConsumptionController.java

@@ -4,12 +4,15 @@ 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.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.*;
@@ -30,7 +33,9 @@ import org.springframework.web.bind.annotation.RestController;
 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: 学生职务设置
@@ -52,45 +57,43 @@ public class ConsumptionController {
     @GetMapping(value = "/tree")
     @ApiOperation(value = "学生在读毕业年级班级树")
     @SaCheckPermission("studentmanager:detail")
-    public RT<List<BaseStudentTreeVo>> tree() {
-        List<BaseStudentTreeVo> voList = new ArrayList<>();
+    public RT<List<BaseClassTreeVo>> tree() {
+        List<BaseClassTreeVo> voList = new ArrayList<>();
 
-        voList.add(new BaseStudentTreeVo(){{
-            setId(6L);
-            setName("在读年级");
-        }});
+        List<BaseClassQfCountVo> qfCount = pbVXsxxsfytbService.getClassQfCount();
+        Map<Long, Integer> qfCountMap = new HashMap<>();
+        for (BaseClassQfCountVo qfCountVo : qfCount) {
+            qfCountMap.put(qfCountVo.getId(), qfCountVo.getCount());
+        }
 
-        voList.add(new BaseStudentTreeVo(){{
-            setId(8L);
-            setName("毕业年级");
+        voList.add(new BaseClassTreeVo(){{
+            setId(6L);
+            setName("年级");
         }});
 
         baseGradeService.list().forEach((node) -> {
             if(node.getStatus() == 1){
-                voList.add(new BaseStudentTreeVo(){{
+                voList.add(new BaseClassTreeVo(){{
                     setId(node.getId());
                     setName(node.getName());
                     setParentId(6L);
                 }});
             }
-            if(node.getStatus() == 0){
-                voList.add(new BaseStudentTreeVo(){{
-                    setId(node.getId());
-                    setName(node.getName());
-                    setParentId(8L);
-                }});
-            }
         });
 
-        baseClassService.list().forEach((node)->{
-            voList.add(new BaseStudentTreeVo(){{
+        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<BaseStudentTreeVo> treeVoList = TreeUtil.build(voList);
+        List<BaseClassTreeVo> treeVoList = TreeUtil.build(voList);
 
         return RT.ok(treeVoList);
     }

+ 4 - 1
src/main/java/com/xjrsoft/module/student/mapper/PbVXsxxsfytbMapper.java

@@ -2,8 +2,11 @@ package com.xjrsoft.module.student.mapper;
 
 import com.github.yulichang.base.MPJBaseMapper;
 import com.xjrsoft.module.student.entity.PbVXsxxsfytb;
+import com.xjrsoft.module.student.vo.BaseClassQfCountVo;
 import org.apache.ibatis.annotations.Mapper;
 
+import java.util.List;
+
 /**
 * @title: 
 * @Author dzx
@@ -12,5 +15,5 @@ import org.apache.ibatis.annotations.Mapper;
 */
 @Mapper
 public interface PbVXsxxsfytbMapper extends MPJBaseMapper<PbVXsxxsfytb> {
-
+    List<BaseClassQfCountVo> getClassQfCount();
 }

+ 2 - 0
src/main/java/com/xjrsoft/module/student/service/IPbVXsxxsfytbService.java

@@ -22,4 +22,6 @@ public interface IPbVXsxxsfytbService extends MPJBaseService<PbVXsxxsfytb> {
     IPage<PbVXsxxsfytbPageVo> getPage(PbVXsxxsfytbPageDto dto);
 
     List<PbVXsxxsfytbExcelVo> getList(PbVXsxxsfytbExcelDto dto);
+
+    List<BaseClassQfCountVo> getClassQfCount();
 }

+ 8 - 0
src/main/java/com/xjrsoft/module/student/service/impl/PbVXsxxsfytbServiceImpl.java

@@ -16,6 +16,7 @@ import com.xjrsoft.module.student.entity.PbSemesterConfig;
 import com.xjrsoft.module.student.entity.PbVXsxxsfytb;
 import com.xjrsoft.module.student.mapper.PbVXsxxsfytbMapper;
 import com.xjrsoft.module.student.service.IPbVXsxxsfytbService;
+import com.xjrsoft.module.student.vo.BaseClassQfCountVo;
 import com.xjrsoft.module.student.vo.PbVXsxxsfytbExcelVo;
 import com.xjrsoft.module.student.vo.PbVXsxxsfytbPageVo;
 import com.xjrsoft.module.student.vo.PbVXsxxsfytbPersonal;
@@ -42,6 +43,8 @@ import java.util.stream.Collectors;
 @AllArgsConstructor
 public class PbVXsxxsfytbServiceImpl extends MPJBaseServiceImpl<PbVXsxxsfytbMapper, PbVXsxxsfytb> implements IPbVXsxxsfytbService {
 
+    private final PbVXsxxsfytbMapper pbVXsxxsfytbMapper;
+
     @Override
     public PersonalPortraitFeeInformationVo listCostInformation(PersonalPortraitFeeInformationDto dto) {
 
@@ -165,4 +168,9 @@ public class PbVXsxxsfytbServiceImpl extends MPJBaseServiceImpl<PbVXsxxsfytbMapp
         }
         return list;
     }
+
+    @Override
+    public List<BaseClassQfCountVo> getClassQfCount() {
+        return pbVXsxxsfytbMapper.getClassQfCount();
+    }
 }

+ 26 - 0
src/main/java/com/xjrsoft/module/student/vo/BaseClassQfCountVo.java

@@ -0,0 +1,26 @@
+package com.xjrsoft.module.student.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+* @title: 班级欠费人数
+* @Author dzx
+* @Date: 2024年3月21日
+* @Version 1.0
+*/
+@Data
+public class BaseClassQfCountVo {
+
+    /**
+    * 主键
+    */
+    @ApiModelProperty("主键")
+    private Long id;
+    /**
+    * 人数
+    */
+    @ApiModelProperty("人数")
+    private Integer count;
+
+}

+ 34 - 0
src/main/java/com/xjrsoft/module/student/vo/BaseClassTreeVo.java

@@ -0,0 +1,34 @@
+package com.xjrsoft.module.student.vo;
+
+import com.xjrsoft.common.model.tree.ITreeNode;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @author dzx
+ * @date 2024/3/21
+ */
+@Data
+public class BaseClassTreeVo implements ITreeNode<BaseClassTreeVo, Long>, Serializable {
+    @ApiModelProperty("id")
+    private Long id;
+
+
+    @ApiModelProperty("name")
+    private String name;
+
+
+    @ApiModelProperty("disabled")
+    private Long parentId;
+
+
+    @ApiModelProperty("children")
+    private List<BaseClassTreeVo> children;
+
+    @ApiModelProperty("状态(0:不欠费 1:欠费)")
+    private Integer status;
+
+}

+ 15 - 0
src/main/resources/mapper/student/PbVXsxxsfytbMapper.xml

@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.xjrsoft.module.student.mapper.PbVXsxxsfytbMapper">
+    <select id="getClassQfCount" resultType="com.xjrsoft.module.student.vo.BaseClassQfCountVo">
+        select id, (
+            select count(*) from xjr_user t1
+                                     inner join base_student_school_roll t2 on t1.id = t2.user_id
+                                     inner join pb_v_xsxxsfytb t3 on t1.credential_number = t3.Studentcode
+            where t3.qfje > 0 and t2.class_id = base_class.id
+        ) as count
+        from base_class where delete_mark = 0
+    </select>
+</mapper>

+ 6 - 0
src/main/resources/sqlScript/20240311_sql.sql

@@ -54,3 +54,9 @@ CREATE TABLE `pb_semester_config` (
   PRIMARY KEY (`id`) USING BTREE
 ) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='攀宝学期对应';
 
+
+ALTER TABLE `tl`.`pb_v_xsxxsfytb`   
+  ADD INDEX (`Studentcode`),
+  ADD INDEX (`qfje`);
+
+