Browse Source

完成助学金获得学院以及项目接口

houlai 6 months ago
parent
commit
e0a89698fb

+ 8 - 0
yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/controller/admin/aidingstudentsmanage/AidingStudentsManageController.java

@@ -79,6 +79,14 @@ public class AidingStudentsManageController {
         return success(BeanUtils.toBean(pageResult, AidingStudentsManageRespVO.class));
     }
 
+    @GetMapping("/list")
+    @Operation(summary = "获得家庭困难认定项目管理列表")
+    @PreAuthorize("@ss.hasPermission('as:aiding-students-manage:query')")
+    public CommonResult<List<AidingStudentsManageRespVO>> getAidingStudentsManageList() {
+        List<AidingStudentsManageDO> list = aidingStudentsManageService.getAllManagetList();
+        return success(BeanUtils.toBean(list, AidingStudentsManageRespVO.class));
+    }
+
     @GetMapping("/export-excel")
     @Operation(summary = "导出家庭困难认定项目管理 Excel")
     @PreAuthorize("@ss.hasPermission('as:aiding-students-manage:export')")

+ 15 - 0
yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/controller/admin/financialaidmanage/FinancialAidManageController.java

@@ -1,5 +1,8 @@
 package cn.iocoder.yudao.module.as.controller.admin.financialaidmanage;
 
+import cn.iocoder.yudao.module.as.controller.admin.aidingstudentsmanage.vo.AidingStudentsManageRespVO;
+import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
+import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
 import org.springframework.web.bind.annotation.*;
 import javax.annotation.Resource;
 import org.springframework.validation.annotation.Validated;
@@ -92,5 +95,17 @@ public class FinancialAidManageController {
         ExcelUtils.write(response, "助学金项目管理.xls", "数据", FinancialAidManageRespVO.class,
                         BeanUtils.toBean(list, FinancialAidManageRespVO.class));
     }
+    @GetMapping("/get-all-college")
+    @Operation(summary = "获得所有学院信息")
+    @PreAuthorize("@ss.hasPermission('as:financial-aid-manage:query')")
+    public CommonResult<List<DeptRespDTO>> getAllCollege() {
+        return success(financialAidManageService.getAllCollege());
+    }
+    @GetMapping("/get-all-aidingstudentsmanage")
+    @Operation(summary = "获得所有家庭贫困认定项目管理")
+    @PreAuthorize("@ss.hasPermission('as:financial-aid-manage:query')")
+    public CommonResult<List<AidingStudentsManageRespVO>> getAllAidingStudentsManage() {
+        return success(financialAidManageService.getAllAidingStudentsManage());
+    }
 
 }

+ 2 - 0
yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/service/aidingstudentsmanage/AidingStudentsManageService.java

@@ -76,4 +76,6 @@ public interface AidingStudentsManageService {
     }
 
     List<AidingStudentsManageDO> getManagetList(Collection<Long> ids);
+
+    List<AidingStudentsManageDO> getAllManagetList();
 }

+ 10 - 73
yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/service/aidingstudentsmanage/AidingStudentsManageServiceImpl.java

@@ -4,10 +4,13 @@ import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
 import cn.iocoder.yudao.framework.common.util.io.FileUtils;
 import cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission;
 import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
+import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
 import cn.iocoder.yudao.module.as.controller.admin.aidingstudentsimportlist.vo.AidingStudentsImportExcelRespVO;
 import cn.iocoder.yudao.module.as.controller.admin.aidingstudentsimportlist.vo.AidingStudentsImportExcelVO;
+import cn.iocoder.yudao.module.as.dal.dataobject.financialaidretirementlist.FinancialAidRetirementListDO;
 import cn.iocoder.yudao.module.as.service.aidingstudentsimportlist.AidingStudentsImportListService;
 import cn.iocoder.yudao.module.as.service.aidingstudentsimportlist.AidingStudentsImportListServiceImpl;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import org.apache.tomcat.util.http.fileupload.FileItem;
 import org.apache.tomcat.util.http.fileupload.IOUtils;
 import org.apache.tomcat.util.http.fileupload.disk.DiskFileItemFactory;
@@ -57,79 +60,6 @@ public class AidingStudentsManageServiceImpl implements AidingStudentsManageServ
         aidingStudentsManageMapper.insert(aidingStudentsManage);
         //改变状态
         aidingStudentsManage.setDiStatus(0);
-
-        //解析excel
-
-        //创建temp.xlsx
-        /*String path = this.getClass().getResource("").getPath();//注意getResource("")里面是空字符串
-        String path1=path+"importexcel";
-        try {
-            File dir = new File(path1);
-            if(!dir.exists()){
-                dir.mkdirs();//创建目录
-            }
-            File f = new File(path1,"temp.xlsx");
-            f.deleteOnExit();
-            if(!f.exists()){
-                f.createNewFile();
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        }*/
-
-
-
-        //从url读取出文件到已创建的文件中
-        /*URL website = null;
-        ReadableByteChannel rbc = null;
-        FileOutputStream fos = null;
-        try {
-            website = new URL(aidingStudentsManage.getDiImportListFile());
-            rbc = Channels.newChannel(website.openStream());
-            fos = new FileOutputStream(path1+"/temp.xlsx");//本地要存储的文件地址 例如:test.txt
-            fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
-        } catch (Exception e) {
-            e.printStackTrace();
-        }finally{
-            if(fos!=null){
-                try {
-                    fos.close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-            if(rbc!=null){
-                try {
-                    rbc.close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-
-            }
-        }*/
-
-
-
-
-        //导入名单
-        /*File file = new File(path1+"/temp.xlsx");
-        AidingStudentsImportExcelRespVO aidingStudentsImportExcelRespVO=null;
-        try {
-            MultipartFile cMultiFile = new MockMultipartFile("file", file.getName(), null, new FileInputStream(file));
-            List<AidingStudentsImportExcelVO> list = ExcelUtils.read(cMultiFile, AidingStudentsImportExcelVO.class);
-             aidingStudentsImportExcelRespVO = aidingStudentsImportListService.aidingStudentsImportExcelListFromCloud(aidingStudentsManage.getId(), list);
-
-        } catch (IOException e) {
-            throw exception(AIDING_STUDENTS_IMPORT_LIST_FILE_IMPORT_ERROR);
-        }*/
-
-
-
-
-        // 删除excel文件
-        //file.deleteOnExit();
-
-
         // 返回
         return excelResolver(aidingStudentsManage.getDiImportListFile(), aidingStudentsManage.getId());
     }
@@ -262,4 +192,11 @@ public class AidingStudentsManageServiceImpl implements AidingStudentsManageServ
         }
         return aidingStudentsManageMapper.selectBatchIds(ids);
     }
+
+    @Override
+    public List<AidingStudentsManageDO> getAllManagetList() {
+        return aidingStudentsManageMapper.selectList(
+                new LambdaQueryWrapperX<AidingStudentsManageDO>().orderByDesc(AidingStudentsManageDO::getCreateTime)
+        ) ;
+    }
 }

+ 7 - 0
yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/service/financialaidmanage/FinancialAidManageService.java

@@ -2,10 +2,14 @@ package cn.iocoder.yudao.module.as.service.financialaidmanage;
 
 import java.util.*;
 import javax.validation.*;
+
+import cn.iocoder.yudao.module.as.controller.admin.aidingstudentsmanage.vo.AidingStudentsManageRespVO;
 import cn.iocoder.yudao.module.as.controller.admin.financialaidmanage.vo.*;
 import cn.iocoder.yudao.module.as.dal.dataobject.financialaidmanage.FinancialAidManageDO;
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
 import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
+import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
 
 /**
  * 助学金项目管理 Service 接口
@@ -52,4 +56,7 @@ public interface FinancialAidManageService {
      */
     PageResult<FinancialAidManageDO> getFinancialAidManagePage(FinancialAidManagePageReqVO pageReqVO);
 
+    List<DeptRespDTO> getAllCollege();
+
+    List<AidingStudentsManageRespVO> getAllAidingStudentsManage();
 }

+ 28 - 0
yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/service/financialaidmanage/FinancialAidManageServiceImpl.java

@@ -1,5 +1,15 @@
 package cn.iocoder.yudao.module.as.service.financialaidmanage;
 
+import cn.iocoder.yudao.module.as.controller.admin.aidingstudentsmanage.vo.AidingStudentsManageRespVO;
+import cn.iocoder.yudao.module.as.dal.dataobject.aidingstudentsmanage.AidingStudentsManageDO;
+import cn.iocoder.yudao.module.as.service.aidingstudentsimportlist.AidingStudentsImportListServiceImpl;
+import cn.iocoder.yudao.module.as.service.aidingstudentsmanage.AidingStudentsManageService;
+import cn.iocoder.yudao.module.system.api.dept.DeptApi;
+import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
+import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
+import cn.iocoder.yudao.module.system.dal.mysql.dept.DeptMapper;
+import cn.iocoder.yudao.module.system.service.dept.DeptService;
+import cn.iocoder.yudao.module.system.service.dept.DeptServiceImpl;
 import org.springframework.stereotype.Service;
 import javax.annotation.Resource;
 import org.springframework.validation.annotation.Validated;
@@ -28,6 +38,12 @@ public class FinancialAidManageServiceImpl implements FinancialAidManageService
 
     @Resource
     private FinancialAidManageMapper financialAidManageMapper;
+    @Resource
+    private DeptApi deptApi;
+    @Resource
+    private DeptMapper deptMapper;
+    @Resource
+    private AidingStudentsManageService aidingStudentsManageService;
 
     @Override
     public Long createFinancialAidManage(FinancialAidManageSaveReqVO createReqVO) {
@@ -71,4 +87,16 @@ public class FinancialAidManageServiceImpl implements FinancialAidManageService
         return financialAidManageMapper.selectPage(pageReqVO);
     }
 
+    @Override
+    public List<DeptRespDTO> getAllCollege() {
+        List<DeptDO> deptDOS = deptMapper.selectListByParentId(0L);
+        return BeanUtils.toBean(deptDOS, DeptRespDTO.class);
+    }
+
+    @Override
+    public List<AidingStudentsManageRespVO> getAllAidingStudentsManage() {
+        List<AidingStudentsManageDO> allManagetList = aidingStudentsManageService.getAllManagetList();
+        return BeanUtils.toBean(allManagetList, AidingStudentsManageRespVO.class);
+    }
+
 }