“djh”
4 days ago 9abc6588d464269024d3e680b98cfd71e2acc84e
新增修改部分限制
8 files modified
101 ■■■■■ changed files
multi-framework/src/main/java/com/gkhy/exam/framework/aspectj/LogAspect.java 15 ●●●● patch | view | raw | blame | history
multi-system/src/main/java/com/gkhy/exam/system/domain/ExCourse.java 8 ●●●●● patch | view | raw | blame | history
multi-system/src/main/java/com/gkhy/exam/system/service/impl/ExCourseChapterPeriodServiceImpl.java 14 ●●●● patch | view | raw | blame | history
multi-system/src/main/java/com/gkhy/exam/system/service/impl/ExCourseChapterServiceImpl.java 14 ●●●● patch | view | raw | blame | history
multi-system/src/main/java/com/gkhy/exam/system/service/impl/ExCoursePhaseServiceImpl.java 16 ●●●●● patch | view | raw | blame | history
multi-system/src/main/java/com/gkhy/exam/system/service/impl/ExCourseServiceImpl.java 29 ●●●● patch | view | raw | blame | history
multi-system/src/main/resources/mapper/system/ExCourseMapper.xml 3 ●●●● patch | view | raw | blame | history
multi-system/src/main/resources/mapper/system/ExPhaseStudentMapper.xml 2 ●●● patch | view | raw | blame | history
multi-framework/src/main/java/com/gkhy/exam/framework/aspectj/LogAspect.java
@@ -6,6 +6,7 @@
import cn.hutool.extra.servlet.ServletUtil;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.alibaba.fastjson2.JSONWriter;
import com.alibaba.fastjson2.filter.SimplePropertyPreFilter;
import com.gkhy.exam.common.annotation.Log;
import com.gkhy.exam.common.domain.entity.SysUser;
@@ -268,13 +269,21 @@
        webLog.put("method",request.getMethod());
        Object params=getParameter(method, joinPoint.getArgs());
        webLog.put("parameter",params);
        if (params != null) {
            if (params instanceof MultipartFile || params.toString().contains("MultipartFile")) {
                webLog.put("parameter", "文件上传接口,参数不打印");
            } else {
                webLog.put("parameter", params);
            }
        } else {
            webLog.put("parameter", params);
        }
        webLog.put("uri",request.getRequestURI());
        webLog.put("url",requestURL.toString());
        if(user!=null) {
            webLog.put("userName", user.getName());
        }
        log.info(webLog.toString());
        log.info(JSON.toJSONString(webLog, JSONWriter.Feature.IgnoreErrorGetter));
        Object result = joinPoint.proceed();
        if (result == null) {
            //如果切到了 没有返回类型的void方法,这里直接返回
@@ -283,7 +292,7 @@
        long endTime = System.currentTimeMillis();
        webLog.put("result",StringUtils.sub(JSON.toJSONString(result),0,2000));
        webLog.put("spendTime",endTime - startTime);
        log.info(webLog.toString());
        log.info(JSON.toJSONString(webLog, JSONWriter.Feature.IgnoreErrorGetter));
        return result;
    }
multi-system/src/main/java/com/gkhy/exam/system/domain/ExCourse.java
@@ -4,6 +4,7 @@
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.gkhy.exam.common.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
@@ -15,6 +16,8 @@
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL;
@@ -107,5 +110,10 @@
    @TableField(exist = false)
    private Long period;
    @ApiModelProperty(value = "截止时间")
    @TableField("stop_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime stopTime;
}
multi-system/src/main/java/com/gkhy/exam/system/service/impl/ExCourseChapterPeriodServiceImpl.java
@@ -104,13 +104,13 @@
        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("已审批的课程不能再操作");
        }
        if(state== ApproveStatusEnum.APPROVING.getCode()){
            throw new ApiException("待审批的课程不能再操作");
        }
//        int state=courseMapper.selectCourseState(courseChapterPeriod.getCourseId());
//        if(state== ApproveStatusEnum.APPROVED.getCode()){
//            throw new ApiException("已审批的课程不能再操作");
//        }
//        if(state== ApproveStatusEnum.APPROVING.getCode()){
//            throw new ApiException("待审批的课程不能再操作");
//        }
    }
}
multi-system/src/main/java/com/gkhy/exam/system/service/impl/ExCourseChapterServiceImpl.java
@@ -149,13 +149,13 @@
        if(courseChapter.getCompanyId()!=null&&!currentUser.getCompanyId().equals(courseChapter.getCompanyId())){
            throw new ApiException("没有权限操作其他企业课程");
        }
        int state=courseMapper.selectCourseState(courseChapter.getCourseId());
        if(state==ApproveStatusEnum.APPROVED.getCode()){
            throw new ApiException("已审批的课程不能再操作");
        }
        if(state==ApproveStatusEnum.APPROVING.getCode()){
            throw new ApiException("待审批的课程不能再操作");
        }
//        int state=courseMapper.selectCourseState(courseChapter.getCourseId());
//        if(state==ApproveStatusEnum.APPROVED.getCode()){
//            throw new ApiException("已审批的课程不能再操作");
//        }
//        if(state==ApproveStatusEnum.APPROVING.getCode()){
//            throw new ApiException("待审批的课程不能再操作");
//        }
    }
}
multi-system/src/main/java/com/gkhy/exam/system/service/impl/ExCoursePhaseServiceImpl.java
@@ -108,13 +108,15 @@
        if(coursePhase.getCompanyId()!=null&&!currentUser.getCompanyId().equals(coursePhase.getCompanyId())){
            throw new ApiException("没有权限操作其他企业批次");
        }
        int level=coursePhase.getLevel();
        if((level==1 ||level==4) && currentUser.getUserType()>UserTypeEnum.COMPANY_USER.getCode()){
            throw new ApiException("当前账户无权限新增公司级批次");
        }
        if(level==2 && currentUser.getUserType()>UserTypeEnum.DEPART_USER.getCode()){
            throw new ApiException("当前账户无权限新增事业部级级批次");
        }
//        int level=coursePhase.getLevel();
//        if((level==1 ||level==4) && (currentUser.getUserType().equals(UserTypeEnum.COMPANY_USER.getCode())
//                || currentUser.getUserType().equals(UserTypeEnum.COMPANY_ADMIN.getCode())
//                || currentUser.getUserType().equals(UserTypeEnum.SYSTEM_USER.getCode()) ) ){
//            throw new ApiException("当前账户无权限新增公司级批次");
//        }
//        if(level==2 && currentUser.getUserType()>UserTypeEnum.DEPART_USER.getCode()){
//            throw new ApiException("当前账户无权限新增事业部级级批次");
//        }
    }
multi-system/src/main/java/com/gkhy/exam/system/service/impl/ExCourseServiceImpl.java
@@ -76,11 +76,12 @@
        }
        checkUserAllowed(course);
        if(SecurityUtils.getLoginUser().getUser().getUserType().equals(UserTypeEnum.SYSTEM_USER.getCode())){
            course.setState(ApproveStatusEnum.APPROVED.getCode());
            course.setPrivatize(PrivatizeEnum.PUBLIC.getCode());
        }else{
            course.setState(ApproveStatusEnum.TEMPORARY.getCode());
        }
//        else{
//            course.setState(ApproveStatusEnum.TEMPORARY.getCode());
//        }
        course.setState(ApproveStatusEnum.APPROVED.getCode());
        int row =baseMapper.insert(course);
        if(row<1){
            throw new ApiException("新增课程失败");
@@ -112,14 +113,14 @@
        if(!currentUser.getCompanyId().equals(course.getCompanyId())){
            throw new ApiException("没有权限操作其他企业课程");
        }
        if(course.getId()!=null){
            if(course.getState().equals(ApproveStatusEnum.APPROVING.getCode())){
                throw new ApiException("课程待审批状态不能再操作");
            }
            if(course.getState().equals(ApproveStatusEnum.APPROVED.getCode())){
                throw new ApiException("已审批的课程不能再操作");
            }
        }
//        if(course.getId()!=null){
//            if(course.getState().equals(ApproveStatusEnum.APPROVING.getCode())){
//                throw new ApiException("课程待审批状态不能再操作");
//            }
//            if(course.getState().equals(ApproveStatusEnum.APPROVED.getCode())){
//                throw new ApiException("已审批的课程不能再操作");
//            }
//        }
    }
    @Override
@@ -163,9 +164,9 @@
            if(!currentUser.getCompanyId().equals(dbCourse.getCompanyId())){
                throw new ApiException("没有权限操作其他企业课程");
            }
            if(dbCourse.getState().equals(ApproveStatusEnum.APPROVED.getCode())){
                throw new ApiException("已审批的课程不能再操作");
            }
//            if(dbCourse.getState().equals(ApproveStatusEnum.APPROVED.getCode())){
//                throw new ApiException("已审批的课程不能再操作");
//            }
        }
        if(StringUtils.isBlank(course.getMessage())){
            course.setMessage("");
multi-system/src/main/resources/mapper/system/ExCourseMapper.xml
@@ -13,6 +13,7 @@
        <result property="delFlag"         column="del_flag"          />
        <result property="companyId"         column="company_id"          />
        <result property="privatize"         column="privatize"          />
        <result property="stopTime"         column="stop_time"          />
        <result property="message"         column="message"          />
        <result property="version"         column="version"          />
        <result property="createBy"       column="create_by"       />
@@ -27,7 +28,7 @@
    <sql id="selectCourseVo">
        select a.id, a.name, a.category_id, a.status, a.logo,a.sort,a.introduce,a.state,a.company_id,a.message,
               a.privatize,a.version, a.create_by, a.create_time, a.update_by, a.update_time, a.remark,b.name as company_name,c.name as category_name
               a.privatize,a.stop_time,a.version, a.create_by, a.create_time, a.update_by, a.update_time, a.remark,b.name as company_name,c.name as category_name
        from ex_course a
        left join sys_company b on b.id=a.company_id
        left join sys_category c on c.id=a.category_id
multi-system/src/main/resources/mapper/system/ExPhaseStudentMapper.xml
@@ -66,7 +66,7 @@
                and b.phone like concat('%',#{studentPhone},'%')
            </if>
            <if test="studentId!=null">
                and a.student_id=#{studentId}
                and a.student_id=#{studentId} and (d.stop_time is null or d.stop_time > now())
            </if>
        </where>
        order by a.id desc