浏览代码

fix 导入

he2802 3 年之前
父节点
当前提交
25e5f86b72

+ 22 - 0
zhongzheng-admin/src/main/java/com/zhongzheng/controller/course/CourseSectionController.java

@@ -139,6 +139,28 @@ public class CourseSectionController extends BaseController {
         return AjaxResult.success(message);
     }
 
+    @ApiOperation("导入节模板带业务层次")
+    @Log(title = "导入节模板", businessType = BusinessType.IMPORT)
+    @PreAuthorize("@ss.hasPermi('system:section:import')")
+    @PostMapping("/importDataBusiness")
+    public AjaxResult<Map<String,Object>> importDataBusiness(MultipartFile file, Long educationTypeId,Long projectId,Long businessId,Long subjectId) throws Exception
+    {
+        ExcelUtil<CourseSectionImport> util = new ExcelUtil<CourseSectionImport>(CourseSectionImport.class);
+        List<CourseSectionImport> sectionList = util.importExcel(file.getInputStream());
+        Collections.reverse(sectionList);
+        for(CourseSectionImport sectionImport : sectionList){
+            sectionImport.setEducationTypeId(educationTypeId);
+            sectionImport.setProjectId(projectId);
+            sectionImport.setBusinessId(businessId);
+            sectionImport.setSubjectId(subjectId);
+        }
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        String operName = loginUser.getUsername();
+        Map<String,Object> message = iCourseSectionService.importSection(sectionList, false, operName);
+
+        return AjaxResult.success(message);
+    }
+
     /**
      * 删除课程小节
      */

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionServiceImpl.java

@@ -186,11 +186,14 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
                 for(Long id : bo.getQuestionIds()){
                     Question update = new Question();
                     update.setQuestionId(id);
+                    update.setUpdateTime(DateUtils.getNowTime());
                     update.setStatus(-1);
+                    this.updateById(update);
                 }
             }
             if(Validator.isNotEmpty(bo.getQuestionId())){
                 Question update = new Question();
+                update.setUpdateTime(DateUtils.getNowTime());
                 update.setQuestionId(bo.getQuestionId());
                 update.setStatus(-1);
                 return this.updateById(update);

+ 18 - 3
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseSectionServiceImpl.java

@@ -227,17 +227,32 @@ public class CourseSectionServiceImpl extends ServiceImpl<CourseSectionMapper, C
             //业务层次,导入每条只有一条业务层次
             List<CourseSectionBusinessAddBo> businessList = new ArrayList<>();
             CourseSectionBusinessAddBo addBo = new CourseSectionBusinessAddBo();
-            Long eduId = findEduId(sectionImport.getEducationType());
+            Long eduId = null;
+            if(Validator.isNotEmpty(sectionImport.getEducationTypeId())){
+                eduId = sectionImport.getEducationTypeId();
+            }else{
+                eduId = findEduId(sectionImport.getEducationType());
+            }
             if(!Validator.isNotEmpty(eduId)){
                 errorLog+="第"+(size - Index)+"条:"+sectionImport.getEducationType()+"-该教育类型不存在。\r\n";
                 continue;
             }
-            Long projectId = findProjectId(sectionImport.getProject(),eduId);
+            Long projectId = null;
+            if(Validator.isNotEmpty(sectionImport.getProjectId())){
+                projectId = sectionImport.getProjectId();
+            }else{
+                projectId = findProjectId(sectionImport.getProject(),eduId);
+            }
             if(!Validator.isNotEmpty(projectId)){
                 errorLog+="第"+(size - Index)+"条:"+sectionImport.getProject()+"-该项目类型不存在或者和教育类型不匹配。\r\n";
                 continue;
             }
-            Long businessId = findBusinessId(sectionImport.getBusiness(),projectId);
+            Long businessId = null;
+            if(Validator.isNotEmpty(sectionImport.getBusinessId())){
+                businessId = sectionImport.getBusinessId();
+            }else{
+                businessId = findBusinessId(sectionImport.getBusiness(),projectId);
+            }
             if(!Validator.isNotEmpty(businessId)){
                 errorLog+="第"+(size - Index)+"条:"+sectionImport.getBusiness()+"-该业务层次不存在或者和项目类型不匹配。\r\n";
                 continue;

+ 7 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/vo/CourseSectionImport.java

@@ -76,4 +76,11 @@ public class CourseSectionImport {
     private Long durationTime;
 
 
+    private Long educationTypeId;
+
+    private Long businessId;
+
+    private Long subjectId;
+
+    private Long projectId;
 }