From 8458e64aab474c0fc2f49ae4ff22fb11ce5cf6e2 Mon Sep 17 00:00:00 2001
From: “djh” <“3298565835@qq.com”>
Date: 星期一, 11 十一月 2024 16:55:28 +0800
Subject: [PATCH] 批次新增学员查询条件,新增题目导入接口

---
 exam-system/src/main/java/com/gkhy/exam/system/service/impl/ExCourseChapterPeriodServiceImpl.java |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/exam-system/src/main/java/com/gkhy/exam/system/service/impl/ExCourseChapterPeriodServiceImpl.java b/exam-system/src/main/java/com/gkhy/exam/system/service/impl/ExCourseChapterPeriodServiceImpl.java
index 080b18b..b70b3fe 100644
--- a/exam-system/src/main/java/com/gkhy/exam/system/service/impl/ExCourseChapterPeriodServiceImpl.java
+++ b/exam-system/src/main/java/com/gkhy/exam/system/service/impl/ExCourseChapterPeriodServiceImpl.java
@@ -39,6 +39,9 @@
         if(!checkNameUnique(period)){
             throw new ApiException("学时名称已存在");
         }
+        SysUser user= SecurityUtils.getLoginUser().getUser();
+        Long companyId=!user.getUserType().equals(UserTypeEnum.SYSTEM_USER)?user.getCompanyId():null;
+        period.setCompanyId(companyId);
         int row=baseMapper.insert(period);
         if(row<1){
             throw new ApiException("学时保存失败");
@@ -52,6 +55,7 @@
         if(!checkNameUnique(period)){
             throw new ApiException("学时名称已存在");
         }
+        period.setUpdateBy(SecurityUtils.getUsername());
         int row=baseMapper.updateById(period);
         if(row<1){
             throw new ApiException("更新学时失败");
@@ -97,12 +101,15 @@
         if(currentUser.getUserType().equals(UserTypeEnum.STUDENT.getCode())){
             throw new ApiException("没有权限操作");
         }
-        if(!currentUser.getCompanyId().equals(courseChapterPeriod.getCompanyId())){
+        if(courseChapterPeriod.getCompanyId()!=null&&!currentUser.getCompanyId().equals(courseChapterPeriod.getCompanyId())){
             throw new ApiException("没有权限操作其他企业课程");
         }
         int state=courseMapper.selectCourseState(courseChapterPeriod.getCourseId());
         if(state== ApproveStatusEnum.APPROVED.getCode()){
-            throw new ApiException("已审批的课程不能再修改");
+            throw new ApiException("已审批的课程不能再操作");
+        }
+        if(state== ApproveStatusEnum.APPROVING.getCode()){
+            throw new ApiException("待审批的课程不能再操作");
         }
     }
 

--
Gitblit v1.9.2