Преглед на файлове

学生界面查询学院项目

houlai преди 6 месеца
родител
ревизия
5efed98286

+ 14 - 4
yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/controller/admin/aidingstudentscollegemanage/AidingStudentsCollegeManageController.java

@@ -2,7 +2,9 @@ package cn.iocoder.yudao.module.as.controller.admin.aidingstudentscollegemanage;
 
 import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
 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;
@@ -18,11 +20,13 @@ 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.aidingstudentscollegemanage.vo.*;
@@ -100,6 +104,7 @@ public class AidingStudentsCollegeManageController {
         PageResult<AidingStudentsCollegeManageDO> pageResult = aidingStudentsCollegeManageService.getAidingStudentsCollegeManagePage(pageReqVO);
         return success(BeanUtils.toBean(pageResult, AidingStudentsCollegeManageRespVO.class));
     }
+
     @GetMapping("/projectInfo")
     @Operation(summary = "获得家庭困难认定项目学院管理项目详细信息分页")
     @PreAuthorize("@ss.hasPermission('as:aiding-students-college-manage:query')")
@@ -110,19 +115,24 @@ public class AidingStudentsCollegeManageController {
     }
 
 
-
-
     @GetMapping("/export-excel")
     @Operation(summary = "导出家庭困难认定项目学院管理 Excel")
     @PreAuthorize("@ss.hasPermission('as:aiding-students-college-manage:export')")
     @ApiAccessLog(operateType = EXPORT)
     public void exportAidingStudentsCollegeManageExcel(@Valid AidingStudentsCollegeManagePageReqVO pageReqVO,
-              HttpServletResponse response) throws IOException {
+                                                       HttpServletResponse response) throws IOException {
         pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
         List<AidingStudentsCollegeManageDO> list = aidingStudentsCollegeManageService.getAidingStudentsCollegeManagePage(pageReqVO).getList();
         // 导出 Excel
         ExcelUtils.write(response, "家庭困难认定项目学院管理.xls", "数据", AidingStudentsCollegeManageRespVO.class,
-                        BeanUtils.toBean(list, AidingStudentsCollegeManageRespVO.class));
+                BeanUtils.toBean(list, AidingStudentsCollegeManageRespVO.class));
     }
 
+    @GetMapping("/getStudentCollegeManageInfo")
+    @Operation(summary = "获得学生家庭困难认定项目学院管理信息")
+    @PreAuthorize("@ss.hasPermission('as:aiding-students-college-manage:student-query')")
+    public CommonResult<List<AidingStudentsCollegeManageStudentRespVO>> getStudentCollegeManageInfo() {
+        List<AidingStudentsCollegeManageStudentRespVO> aidingStudentsCollegeManageStudentRespVOS = aidingStudentsCollegeManageService.getStudentCollegeManageInfo();
+        return success(aidingStudentsCollegeManageStudentRespVOS);
+    }
 }

+ 37 - 0
yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/controller/admin/aidingstudentscollegemanage/vo/AidingStudentsCollegeManageStudentRespVO.java

@@ -0,0 +1,37 @@
+package cn.iocoder.yudao.module.as.controller.admin.aidingstudentscollegemanage.vo;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+@Schema(description = "管理后台 - 学生显示 家庭困难认定项目学院管理 Response VO")
+@Data
+public class AidingStudentsCollegeManageStudentRespVO {
+    @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "2482")
+    @ExcelProperty("id")
+    private Long id;
+
+    @Schema(description = "学生提交时间段时间")
+    @ExcelProperty("学生提交时间段时间")
+    private String submitTime;
+    @Schema(description = "学院通知文件")
+
+    @ExcelProperty("学院通知文件")
+    private String[] collegeNoticeFile;
+
+    @Schema(description = "学院通知文件名称", example = "芋艿")
+    @ExcelProperty("学院通知文件名称")
+    private String[] collegeNoticeFileName;
+
+    @Schema(description = "学校项目id")
+    @ExcelProperty("学校项目id")
+    private Long manageId;
+
+    @Schema(description ="项目名称")
+    @ExcelProperty("项目名称")
+    private String diName;
+
+    @Schema(description = "是否在自治区名单")
+    @ExcelProperty("是否在自治区名单")
+    private Boolean inImportList;
+}

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

@@ -57,4 +57,6 @@ public interface AidingStudentsCollegeManageService {
     List<AdminUserRespDTO> getCollegeAllStudent();
 
     PageResult<AidingStudentsCollegeManageProjectInfoRespVO> getProjectInfoPage(AidingStudentsCollegeManageProjectInfoPageRespVO pageReqVO);
+
+    List<AidingStudentsCollegeManageStudentRespVO> getStudentCollegeManageInfo();
 }

+ 17 - 0
yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/service/aidingstudentscollegemanage/AidingStudentsCollegeManageServiceImpl.java

@@ -152,6 +152,23 @@ public class AidingStudentsCollegeManageServiceImpl implements AidingStudentsCol
 
     }
 
+    @Override
+    public List<AidingStudentsCollegeManageStudentRespVO> getStudentCollegeManageInfo() {
+        // 获得学院id
+        Long deptId = adminUserApi.getUser(getLoginUserId()).getDeptId();
+        Long collegeId =  deptApi.getCollegeId(deptId);
+        //获得学院的项目
+        List<AidingStudentsCollegeManageDO> aidingStudentsCollegeManageDOS = aidingStudentsCollegeManageMapper.selectList(Wrappers.lambdaQuery(AidingStudentsCollegeManageDO.class)
+                    .eq(AidingStudentsCollegeManageDO::getCollegeId, collegeId));
+        List<AidingStudentsCollegeManageStudentRespVO> aidingStudentsCollegeManageStudentRespVOS = BeanUtils.toBean(aidingStudentsCollegeManageDOS, AidingStudentsCollegeManageStudentRespVO.class);
+        //获得项目名字
+        aidingStudentsCollegeManageStudentRespVOS.forEach(aidingStudentsCollegeManageStudentRespVO -> {
+            aidingStudentsCollegeManageStudentRespVO.setDiName(aidingStudentsManageMapper.selectById(aidingStudentsCollegeManageStudentRespVO.getManageId()).getDiName());
+        });
+
+        return aidingStudentsCollegeManageStudentRespVOS;
+    }
+
     /*private List<AidingStudentsCollegeManageProjectInfoRespVO> merge2AidingStudentsCollegeManageProjectInfoRespVO
             (List<AidingStudentsManageDO> aidingStudentsManageDOS, List<AidingStudentsCollegeManageDO> aidingStudentsCollegeManageDOS) {
         List<AidingStudentsCollegeManageProjectInfoRespVO> aidingStudentsCollegeManageProjectInfoRespVOS = new ArrayList<>();

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

@@ -1,5 +1,5 @@
 package cn.iocoder.yudao.module.as.service.aidingstudentsmanage;
-
+import cn.iocoder.yudao.framework.common.util.io.FileUtils;
 import cn.iocoder.yudao.module.as.service.aidingstudentsimportlist.AidingStudentsImportListService;
 import cn.iocoder.yudao.module.as.service.aidingstudentsimportlist.AidingStudentsImportListServiceImpl;
 import org.springframework.stereotype.Service;
@@ -7,6 +7,12 @@ import javax.annotation.Resource;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.nio.channels.Channels;
+import java.nio.channels.ReadableByteChannel;
 import java.util.*;
 import cn.iocoder.yudao.module.as.controller.admin.aidingstudentsmanage.vo.*;
 import cn.iocoder.yudao.module.as.dal.dataobject.aidingstudentsmanage.AidingStudentsManageDO;
@@ -43,6 +49,56 @@ public class AidingStudentsManageServiceImpl implements AidingStudentsManageServ
 
         //解析excel
 
+        //创建temp.xlsx
+        try {
+            File dir = new File("src/main/resources/importexcel");
+            if(!dir.exists()){
+                dir.mkdirs();//创建目录
+            }
+            File f = new File("src/main/resources/importexcel","temp.xlsx");
+            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("..\\resources\\importexcel\\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();
+                }
+
+            }
+        }
+
+
+
+
         //导入名单
         //aidingStudentsImportListService.aidingStudentsImportExcelListFromCloud(aidingStudentsManage.getId(),)
 

+ 1 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java

@@ -253,6 +253,7 @@ public class AdminUserServiceImpl implements AdminUserService {
     }
 
     @Override
+    @DataPermission(enable = false)
     public AdminUserDO getUser(Long id) {
         return userMapper.selectById(id);
     }