Browse Source

Merge remote-tracking branch 'origin/master'

平常心 5 months ago
parent
commit
84df70b8ec
16 changed files with 276 additions and 15 deletions
  1. 14 4
      yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/controller/admin/aidingstudentscollegemanage/AidingStudentsCollegeManageController.java
  2. 37 0
      yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/controller/admin/aidingstudentscollegemanage/vo/AidingStudentsCollegeManageStudentRespVO.java
  3. 11 1
      yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/controller/admin/aidingstudentsimportlist/AidingStudentsImportListController.java
  4. 8 0
      yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/controller/admin/aidingstudentsmanage/AidingStudentsManageController.java
  5. 6 0
      yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/controller/admin/aidingstudentsmanage/vo/AidingStudentsManagePageReqVO.java
  6. 8 0
      yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/controller/admin/aidingstudentsmanage/vo/AidingStudentsManageRespVO.java
  7. 6 0
      yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/controller/admin/aidingstudentsmanage/vo/AidingStudentsManageSaveReqVO.java
  8. 8 0
      yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/dal/dataobject/aidingstudentsmanage/AidingStudentsManageDO.java
  9. 1 1
      yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/dal/redis/RedisKeyConstants.java
  10. 17 6
      yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/dal/redis/aidingstudentsimportlist/AidingStudentsImportListRedisDAO.java
  11. 2 0
      yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/service/aidingstudentscollegemanage/AidingStudentsCollegeManageService.java
  12. 17 0
      yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/service/aidingstudentscollegemanage/AidingStudentsCollegeManageServiceImpl.java
  13. 62 1
      yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/service/aidingstudentsimportlist/AidingStudentsImportListServiceImpl.java
  14. 1 0
      yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/service/aidingstudentsmanage/AidingStudentsManageService.java
  15. 77 2
      yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/service/aidingstudentsmanage/AidingStudentsManageServiceImpl.java
  16. 1 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java

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

+ 11 - 1
yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/controller/admin/aidingstudentsimportlist/AidingStudentsImportListController.java

@@ -93,15 +93,25 @@ public class AidingStudentsImportListController {
     }
 
 
-    @PostMapping("/import-excel-to-redis")
+   /* @PostMapping("/import-excel-to-redis")
     @Operation(summary = "导入家庭情况困难认定学生 Excel到redis中")
     @PreAuthorize("@ss.hasPermission('as:aiding-students-import-list:importtoredis')")
     public CommonResult<String> importExcelToRedis(@RequestParam("file") MultipartFile file) throws Exception {
         List<AidingStudentsImportExcelVO> list = ExcelUtils.read(file, AidingStudentsImportExcelVO.class);
         String redisUUID = aidingStudentsImportListService.aidingStudentsImportExcelToRedis(list);
         return success(redisUUID);
+    }*/
+
+    @PostMapping("/import-excel-to-redis")
+    @Operation(summary = "导入家庭情况困难认定学生 Excel到redis中")
+    @PreAuthorize("@ss.hasPermission('as:aiding-students-import-list:importtoredis')")
+    public CommonResult<Boolean> importExcelToRedis(@RequestParam("file") MultipartFile file) throws Exception {
+        List<AidingStudentsImportExcelVO> list = ExcelUtils.read(file, AidingStudentsImportExcelVO.class);
+        aidingStudentsImportListService.aidingStudentsImportExcelToRedis(list);
+        return success(true);
     }
 
+
     @PostMapping("/reimport-excel")
     @Operation(summary = "重复导入家庭情况困难认定excel")
     @Parameters({

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

@@ -92,4 +92,12 @@ public class AidingStudentsManageController {
                         BeanUtils.toBean(list, AidingStudentsManageRespVO.class));
     }
 
+    @PutMapping("/publish")
+    @Operation(summary = "更新家庭困难认定项目管理状态")
+    @PreAuthorize("@ss.hasPermission('as:aiding-students-manage:update')")
+    public CommonResult<Boolean> updateAidingStudentsManageStatus(@RequestParam("id") Long id) {
+        aidingStudentsManageService.updateAidingStudentsManageStatus(id);
+        return success(true);
+    }
+
 }

+ 6 - 0
yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/controller/admin/aidingstudentsmanage/vo/AidingStudentsManagePageReqVO.java

@@ -38,4 +38,10 @@ public class AidingStudentsManagePageReqVO extends PageParam {
     @Schema(description = "家庭经济困难学生认定项目评审规则文件名称", example = "芋艿")
     private String diNoticeFileName;
 
+    @Schema(description = "自治区导入名单")
+    private String diImportListFile;
+
+    @Schema(description = "自治区导入名单名称")
+    private String diImportListFileName;
+
 }

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

@@ -45,4 +45,12 @@ public class AidingStudentsManageRespVO {
     @ExcelProperty("家庭经济困难学生认定项目评审规则文件名称")
     private String diNoticeFileName;
 
+    @Schema(description = "自治区导入名单文件")
+    @ExcelProperty("自治区导入名单文件")
+    private String diImportListFile;
+
+    @Schema(description = "自治区导入名单文件名称")
+    @ExcelProperty("自治区导入名单文件名称")
+    private String diImportListFileName;
+
 }

+ 6 - 0
yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/controller/admin/aidingstudentsmanage/vo/AidingStudentsManageSaveReqVO.java

@@ -32,4 +32,10 @@ public class AidingStudentsManageSaveReqVO {
     @Schema(description = "家庭经济困难学生认定项目评审规则文件名称", example = "芋艿")
     private String diNoticeFileName;
 
+    @Schema(description = "自治区导入名单")
+    private String diImportListFile;
+
+    @Schema(description = "自治区导入名单名称")
+    private String diImportListFileName;
+
 }

+ 8 - 0
yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/dal/dataobject/aidingstudentsmanage/AidingStudentsManageDO.java

@@ -52,5 +52,13 @@ public class AidingStudentsManageDO extends BaseDO {
      * 家庭经济困难学生认定项目评审规则文件名称
      */
     private String diNoticeFileName;
+    /**
+     * 自治区导入名单文件
+     */
+    private String diImportListFile;
+    /**
+     * 自治区导入名单文件名称
+     */
+    private String diImportListFileName;
 
 }

+ 1 - 1
yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/dal/redis/RedisKeyConstants.java

@@ -1,5 +1,5 @@
 package cn.iocoder.yudao.module.as.dal.redis;
 
 public interface RedisKeyConstants {
-    String AIDING_STUDENTS_IMPORT_LIST_KEY = "aiding_students_import_list:%s:%s";
+    String AIDING_STUDENTS_IMPORT_LIST_KEY = "aiding_students_import_list:%s";
 }

+ 17 - 6
yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/dal/redis/aidingstudentsimportlist/AidingStudentsImportListRedisDAO.java

@@ -28,7 +28,7 @@ public class AidingStudentsImportListRedisDAO {
 
 
     public AidingStudentsImportExcelListDO get(String uniId,String studentCode) {
-        String redisKey = formatKey(uniId,studentCode);
+        String redisKey = formatKey(studentCode);
         return JsonUtils.parseObject(stringRedisTemplate.opsForValue().get(redisKey), AidingStudentsImportExcelListDO.class);
     }
 
@@ -75,22 +75,30 @@ public class AidingStudentsImportListRedisDAO {
         return result;
     }
 
-    public void setWithredisUUID(String redisUUID,AidingStudentsImportExcelListDO aidingStudentsImportExcelListDO) {
+/*    public void setWithredisUUID(String redisUUID,AidingStudentsImportExcelListDO aidingStudentsImportExcelListDO) {
         String redisKey = formatKey(redisUUID,aidingStudentsImportExcelListDO.getStudentCode());
         // 清理多余字段,避免缓存
         aidingStudentsImportExcelListDO.setUpdater(null).setUpdateTime(null).setCreateTime(null).setCreator(null).setDeleted(null);
 
         stringRedisTemplate.opsForValue().set(redisKey, JsonUtils.toJsonString(aidingStudentsImportExcelListDO), 60*60*24, TimeUnit.SECONDS);
 
-    }
+    }*/
+public void setWithredisUUID(AidingStudentsImportExcelListDO aidingStudentsImportExcelListDO) {
+    String redisKey = formatKey(aidingStudentsImportExcelListDO.getStudentCode());
+    // 清理多余字段,避免缓存
+    aidingStudentsImportExcelListDO.setUpdater(null).setUpdateTime(null).setCreateTime(null).setCreator(null).setDeleted(null);
+
+    stringRedisTemplate.opsForValue().set(redisKey, JsonUtils.toJsonString(aidingStudentsImportExcelListDO), 60*60*24, TimeUnit.SECONDS);
+
+}
 
 
 
 
 
 
-    public void delete(String uniId,String studentCode) {
-        String redisKey = formatKey(uniId,studentCode);
+    public void delete(String studentCode) {
+        String redisKey = formatKey(studentCode);
         stringRedisTemplate.delete(redisKey);
     }
 
@@ -105,7 +113,10 @@ public class AidingStudentsImportListRedisDAO {
 
 
 
-    private static String formatKey(String uniId,String studentCode) {
+    /*private static String formatKey(String uniId,String studentCode) {
         return String.format(AIDING_STUDENTS_IMPORT_LIST_KEY, uniId,studentCode);
+    }*/
+    private static String formatKey(String studentCode) {
+        return String.format(AIDING_STUDENTS_IMPORT_LIST_KEY, studentCode);
     }
 }

+ 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<>();

+ 62 - 1
yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/service/aidingstudentsimportlist/AidingStudentsImportListServiceImpl.java

@@ -189,8 +189,48 @@ public class AidingStudentsImportListServiceImpl implements AidingStudentsImport
     }
 
 
+
+    //根据项目id和list导入数据库
+    @Transactional(rollbackFor = Exception.class) // 添加事务,异常则回滚所有导入
+    public AidingStudentsImportExcelRespVO aidingStudentsImportExcelListFromCloud( Long asAidingStudentsManageId,List<AidingStudentsImportExcelListDO> list) {
+        // 校验是否为空
+        if (CollUtil.isEmpty(list)) {
+            throw exception(AIDING_STUDENTS_IMPORT_LIST_IS_NULL);
+        }
+        // 创建响应对象
+        AidingStudentsImportExcelRespVO respVO = AidingStudentsImportExcelRespVO.builder().createStudentNames(new ArrayList<>())
+                .failureStudentNames(new LinkedHashMap<>()).build();
+        // 转换对象
+        List<AidingStudentsImportExcelListDO> aidingStudentsImportEecleListDOS = BeanUtils.toBean(list, AidingStudentsImportExcelListDO.class);
+        aidingStudentsImportEecleListDOS.forEach(aidingStudentsImportEecleListDO -> {
+
+            // 校验,判断是否有不符合的原因
+
+            String result = validateImportListForCreateOrUpdate(aidingStudentsImportEecleListDO.getStudentName(), aidingStudentsImportEecleListDO.getStudentIdNumber(),
+                    aidingStudentsImportEecleListDO.getStudentCode(), aidingStudentsImportEecleListDO.getStudentAge(), aidingStudentsImportEecleListDO.getStudentSex());
+            if (result != null){
+                respVO.getFailureStudentNames().put(aidingStudentsImportEecleListDO.getStudentName(), result);
+                return;
+            }
+            //赋值给外键
+            aidingStudentsImportEecleListDO.setAsAidingStudentsManageId(asAidingStudentsManageId);
+            aidingStudentsImportEecleListDO.setCollegeId(getCollegeIdByStudentCode(aidingStudentsImportEecleListDO.getStudentCode()));
+
+            //判断此次项目数据库是否已经存在
+            if (checkStudentCodeExists(aidingStudentsImportEecleListDO.getStudentCode(),asAidingStudentsManageId)) {
+                respVO.getFailureStudentNames().put(aidingStudentsImportEecleListDO.getStudentName(), "该学生已导入过一次");
+                return;
+            }
+            //插入数据库
+            aidingStudentsImportListMapper.insert(aidingStudentsImportEecleListDO);
+            respVO.getCreateStudentNames().add(aidingStudentsImportEecleListDO.getStudentName());
+        });
+        return respVO;
+    }
+
+
     //导入到redis中
-    @Override
+/*    @Override
     public String aidingStudentsImportExcelToRedis(List<AidingStudentsImportExcelVO> list) {
         if (CollUtil.isEmpty(list)) {
             throw exception(AIDING_STUDENTS_IMPORT_LIST_IS_NULL);
@@ -205,6 +245,27 @@ public class AidingStudentsImportListServiceImpl implements AidingStudentsImport
             log.error("导入redis失败", e);
             throw new RuntimeException(e);
 
+        }
+        return redisUUID;
+    }*/
+
+
+
+    @Override
+    public String aidingStudentsImportExcelToRedis(List<AidingStudentsImportExcelVO> list) {
+        if (CollUtil.isEmpty(list)) {
+            throw exception(AIDING_STUDENTS_IMPORT_LIST_IS_NULL);
+        }
+        String redisUUID = String.valueOf(UUID.randomUUID());
+        try {
+            List<AidingStudentsImportExcelListDO> aidingStudentsImportEecleListDOS = BeanUtils.toBean(list, AidingStudentsImportExcelListDO.class);
+            aidingStudentsImportEecleListDOS.forEach(aidingStudentsImportEecleListDO -> {
+                aidingStudentsImportListRedisDAO.setWithredisUUID(aidingStudentsImportEecleListDO);
+            });
+        } catch (Exception e) {
+            log.error("导入redis失败", e);
+            throw new RuntimeException(e);
+
         }
         return redisUUID;
     }

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

@@ -52,4 +52,5 @@ public interface AidingStudentsManageService {
      */
     PageResult<AidingStudentsManageDO> getAidingStudentsManagePage(AidingStudentsManagePageReqVO pageReqVO);
 
+    void updateAidingStudentsManageStatus(Long id);
 }

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

@@ -1,10 +1,18 @@
 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;
 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;
@@ -28,6 +36,8 @@ public class AidingStudentsManageServiceImpl implements AidingStudentsManageServ
 
     @Resource
     private AidingStudentsManageMapper aidingStudentsManageMapper;
+    @Resource
+    private AidingStudentsImportListServiceImpl aidingStudentsImportListService;
 
     @Override
     public Long createAidingStudentsManage(AidingStudentsManageSaveReqVO createReqVO) {
@@ -35,7 +45,64 @@ public class AidingStudentsManageServiceImpl implements AidingStudentsManageServ
         AidingStudentsManageDO aidingStudentsManage = BeanUtils.toBean(createReqVO, AidingStudentsManageDO.class);
         aidingStudentsManageMapper.insert(aidingStudentsManage);
         //改变状态
-        aidingStudentsManage.setDiStatus(1);
+        aidingStudentsManage.setDiStatus(0);
+
+        //解析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(),)
+
+
         // 返回
         return aidingStudentsManage.getId();
     }
@@ -74,4 +141,12 @@ public class AidingStudentsManageServiceImpl implements AidingStudentsManageServ
         return aidingStudentsManageMapper.selectPage(pageReqVO);
     }
 
+    @Override
+    public void updateAidingStudentsManageStatus(Long id) {
+        AidingStudentsManageDO aidingStudentsManageDO = new AidingStudentsManageDO();
+        aidingStudentsManageDO.setDiStatus(1);
+        aidingStudentsManageDO.setId(id);
+        aidingStudentsManageMapper.updateById(aidingStudentsManageDO);
+    }
+
 }

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