# Conflicts:
#	jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfo/controller/ZyInfoController.java
#	jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/CommonController.java
This commit is contained in:
yangjun 2025-01-06 09:09:16 +08:00
commit fe19f4ede9
15 changed files with 878 additions and 283 deletions

View File

@ -1,6 +1,7 @@
package org.jeecg.common.exception;
import cn.hutool.core.util.ObjectUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.AuthorizationException;
import org.apache.shiro.authz.UnauthorizedException;
import org.jeecg.common.api.vo.Result;
@ -15,19 +16,18 @@ import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.multipart.MaxUploadSizeExceededException;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.NoHandlerFoundException;
import lombok.extern.slf4j.Slf4j;
import javax.servlet.http.HttpServletRequest;
import java.sql.SQLException;
import java.sql.SQLNonTransientException;
import java.sql.SQLSyntaxErrorException;
import java.util.Iterator;
/**
* 异常处理器
*
* @Author scott
* @Date 2019
*/
@RestControllerAdvice
@Slf4j
@ -37,8 +37,9 @@ public class JeecgBootExceptionHandler {
* 处理自定义异常
*/
@ExceptionHandler(JeecgBootException.class)
public Result<?> handleJeecgBootException(JeecgBootException e){
log.error(e.getMessage(), e);
public Result<?> handleJeecgBootException(JeecgBootException e, HttpServletRequest request) {
log.error("Intercepted exception for request: URL={}, Method={}, Parameters={}",
request.getRequestURI(), request.getMethod(), request.getParameterMap(), e);
return Result.error(e.getMessage());
}
@ -46,65 +47,52 @@ public class JeecgBootExceptionHandler {
* 处理自定义微服务异常
*/
@ExceptionHandler(JeecgCloudException.class)
public Result<?> handleJeecgCloudException(JeecgCloudException e){
log.error(e.getMessage(), e);
public Result<?> handleJeecgCloudException(JeecgCloudException e, HttpServletRequest request) {
log.error("Intercepted exception for request: URL={}, Method={}, Parameters={}",
request.getRequestURI(), request.getMethod(), request.getParameterMap(), e);
return Result.error(e.getMessage());
}
/**
* 处理自定义异常
* 处理自定义401异常
*/
@ExceptionHandler(JeecgBoot401Exception.class)
@ResponseStatus(HttpStatus.UNAUTHORIZED)
public Result<?> handleJeecgBoot401Exception(JeecgBoot401Exception e){
log.error(e.getMessage(), e);
return new Result(401,e.getMessage());
public Result<?> handleJeecgBoot401Exception(JeecgBoot401Exception e, HttpServletRequest request) {
log.error("Intercepted exception for request: URL={}, Method={}, Parameters={}",
request.getRequestURI(), request.getMethod(), request.getParameterMap(), e);
return new Result<>(401, e.getMessage());
}
@ExceptionHandler(NoHandlerFoundException.class)
public Result<?> handlerNoFoundException(Exception e) {
log.error(e.getMessage(), e);
public Result<?> handlerNoFoundException(Exception e, HttpServletRequest request) {
log.error("Intercepted exception for request: URL={}, Method={}, Parameters={}",
request.getRequestURI(), request.getMethod(), request.getParameterMap(), e);
return Result.error(404, "路径不存在,请检查路径是否正确");
}
@ExceptionHandler(DuplicateKeyException.class)
public Result<?> handleDuplicateKeyException(DuplicateKeyException e){
log.error(e.getMessage(), e);
public Result<?> handleDuplicateKeyException(DuplicateKeyException e, HttpServletRequest request) {
log.error("Intercepted exception for request: URL={}, Method={}, Parameters={}",
request.getRequestURI(), request.getMethod(), request.getParameterMap(), e);
return Result.error("数据库中已存在该记录");
}
@ExceptionHandler({UnauthorizedException.class, AuthorizationException.class})
public Result<?> handleAuthorizationException(AuthorizationException e){
log.error(e.getMessage(), e);
public Result<?> handleAuthorizationException(AuthorizationException e, HttpServletRequest request) {
log.error("Intercepted exception for request: URL={}, Method={}, Parameters={}",
request.getRequestURI(), request.getMethod(), request.getParameterMap(), e);
return Result.noauth("没有权限,请联系管理员授权");
}
@ExceptionHandler(Exception.class)
public Result<?> handleException(Exception e){
log.error(e.getMessage(), e);
//update-begin---author:zyf ---date:20220411 for处理Sentinel限流自定义异常
Throwable throwable = e.getCause();
SentinelErrorInfoEnum errorInfoEnum = SentinelErrorInfoEnum.getErrorByException(throwable);
if (ObjectUtil.isNotEmpty(errorInfoEnum)) {
return Result.error(errorInfoEnum.getError());
}
//update-end---author:zyf ---date:20220411 for处理Sentinel限流自定义异常
// return Result.error("操作失败"+e.getMessage());
return Result.error("操作失败");
}
/**
* @Author 政辉
* @param e
* @return
*/
@ExceptionHandler(HttpRequestMethodNotSupportedException.class)
public Result<?> httpRequestMethodNotSupportedException(HttpRequestMethodNotSupportedException e){
public Result<?> httpRequestMethodNotSupportedException(HttpRequestMethodNotSupportedException e, HttpServletRequest request) {
StringBuffer sb = new StringBuffer();
sb.append("不支持");
sb.append(e.getMethod());
sb.append("请求方法,");
sb.append("支持以下");
String[] methods = e.getSupportedMethods();
if (methods != null) {
for (String str : methods) {
@ -112,44 +100,73 @@ public class JeecgBootExceptionHandler {
sb.append("");
}
}
log.error("Intercepted unsupported HTTP method request: URL={}, Method={}, Parameters={}",
request.getRequestURI(), e.getMethod(), request.getParameterMap());
log.error(sb.toString(), e);
//return Result.error("没有权限,请联系管理员授权");
return Result.error(405, sb.toString());
}
/**
* spring默认上传大小100MB 超出大小捕获异常MaxUploadSizeExceededException
*/
@ExceptionHandler(MaxUploadSizeExceededException.class)
public Result<?> handleMaxUploadSizeExceededException(MaxUploadSizeExceededException e) {
log.error(e.getMessage(), e);
public Result<?> handleMaxUploadSizeExceededException(MaxUploadSizeExceededException e, HttpServletRequest request) {
if (request instanceof MultipartHttpServletRequest) {
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
Iterator<String> fileNames = multipartRequest.getFileNames();
while (fileNames.hasNext()) {
String fileName = fileNames.next();
MultipartFile file = multipartRequest.getFile(fileName);
log.error("File upload exceeded max size: File name={}, Size={} bytes, Content type={}",
file.getOriginalFilename(), file.getSize(), file.getContentType());
}
}
return Result.error("文件大小超出10MB限制, 请压缩或降低文件质量!");
}
@ExceptionHandler(DataIntegrityViolationException.class)
public Result<?> handleDataIntegrityViolationException(DataIntegrityViolationException e) {
log.error(e.getMessage(), e);
public Result<?> handleDataIntegrityViolationException(DataIntegrityViolationException e, HttpServletRequest request) {
log.error("Intercepted exception for request: URL={}, Method={}, Parameters={}",
request.getRequestURI(), request.getMethod(), request.getParameterMap(), e);
//issues/3624数据库执行异常handleDataIntegrityViolationException提示有误 #3624
return Result.error("执行数据库异常,违反了完整性例如:违反惟一约束、违反非空限制、字段内容超出长度等");
}
@ExceptionHandler(PoolException.class)
public Result<?> handlePoolException(PoolException e) {
log.error(e.getMessage(), e);
public Result<?> handlePoolException(PoolException e, HttpServletRequest request) {
log.error("Intercepted exception for request: URL={}, Method={}, Parameters={}",
request.getRequestURI(), request.getMethod(), request.getParameterMap(), e);
return Result.error("Redis 连接异常!");
}
@ExceptionHandler({SQLSyntaxErrorException.class, SQLNonTransientException.class, SQLException.class})
public Result<?> handleSQLSyntaxErrorException(SQLException e) {
log.error(e.getMessage(), e);
public Result<?> handleSQLSyntaxErrorException(SQLException e, HttpServletRequest request) {
log.error("Intercepted exception for request: URL={}, Method={}, Parameters={}",
request.getRequestURI(), request.getMethod(), request.getParameterMap(), e);
return Result.error("SQL语法错误");
}
@ExceptionHandler({BadSqlGrammarException.class, InvalidDataAccessResourceUsageException.class, NonTransientDataAccessException.class, DataAccessException.class})
public Result<?> handleBadSqlGrammarException(DataAccessException e) {
log.error(e.getMessage(), e);
public Result<?> handleBadSqlGrammarException(DataAccessException e, HttpServletRequest request) {
log.error("Intercepted exception for request: URL={}, Method={}, Parameters={}",
request.getRequestURI(), request.getMethod(), request.getParameterMap(), e);
return Result.error("SQL语法错误");
}
@ExceptionHandler(Exception.class)
public Result<?> handleException(Exception e, HttpServletRequest request) {
log.error("Intercepted an exception for request: URL={}, Method={}, Parameters={}",
request.getRequestURI(), request.getMethod(), request.getParameterMap(), e);
// 处理Sentinel限流自定义异常
Throwable throwable = e.getCause();
SentinelErrorInfoEnum errorInfoEnum = SentinelErrorInfoEnum.getErrorByException(throwable);
if (ObjectUtil.isNotEmpty(errorInfoEnum)) {
return Result.error(errorInfoEnum.getError());
}
return Result.error("操作失败");
}
}

View File

@ -0,0 +1,153 @@
package org.jeecg.common.exception;
import cn.hutool.core.util.ObjectUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.AuthorizationException;
import org.apache.shiro.authz.UnauthorizedException;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.enums.SentinelErrorInfoEnum;
import org.springframework.dao.*;
import org.springframework.data.redis.connection.PoolException;
import org.springframework.http.HttpStatus;
import org.springframework.jdbc.BadSqlGrammarException;
import org.springframework.web.HttpRequestMethodNotSupportedException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.multipart.MaxUploadSizeExceededException;
import org.springframework.web.servlet.NoHandlerFoundException;
import java.sql.SQLException;
import java.sql.SQLNonTransientException;
import java.sql.SQLSyntaxErrorException;
/**
* 异常处理器
*
* @Author scott
* @Date 2019
*/
@RestControllerAdvice
@Slf4j
public class JeecgBootExceptionHandlerbk {
/**
* 处理自定义异常
*/
@ExceptionHandler(JeecgBootException.class)
public Result<?> handleJeecgBootException(JeecgBootException e){
log.error(e.getMessage(), e);
return Result.error(e.getMessage());
}
/**
* 处理自定义微服务异常
*/
@ExceptionHandler(JeecgCloudException.class)
public Result<?> handleJeecgCloudException(JeecgCloudException e){
log.error(e.getMessage(), e);
return Result.error(e.getMessage());
}
/**
* 处理自定义异常
*/
@ExceptionHandler(JeecgBoot401Exception.class)
@ResponseStatus(HttpStatus.UNAUTHORIZED)
public Result<?> handleJeecgBoot401Exception(JeecgBoot401Exception e){
log.error(e.getMessage(), e);
return new Result(401,e.getMessage());
}
@ExceptionHandler(NoHandlerFoundException.class)
public Result<?> handlerNoFoundException(Exception e) {
log.error(e.getMessage(), e);
return Result.error(404, "路径不存在,请检查路径是否正确");
}
@ExceptionHandler(DuplicateKeyException.class)
public Result<?> handleDuplicateKeyException(DuplicateKeyException e){
log.error(e.getMessage(), e);
return Result.error("数据库中已存在该记录");
}
@ExceptionHandler({UnauthorizedException.class, AuthorizationException.class})
public Result<?> handleAuthorizationException(AuthorizationException e){
log.error(e.getMessage(), e);
return Result.noauth("没有权限,请联系管理员授权");
}
@ExceptionHandler(Exception.class)
public Result<?> handleException(Exception e){
log.error(e.getMessage(), e);
//update-begin---author:zyf ---date:20220411 for处理Sentinel限流自定义异常
Throwable throwable = e.getCause();
SentinelErrorInfoEnum errorInfoEnum = SentinelErrorInfoEnum.getErrorByException(throwable);
if (ObjectUtil.isNotEmpty(errorInfoEnum)) {
return Result.error(errorInfoEnum.getError());
}
//update-end---author:zyf ---date:20220411 for处理Sentinel限流自定义异常
// return Result.error("操作失败"+e.getMessage());
return Result.error("操作失败");
}
/**
* @Author 政辉
* @param e
* @return
*/
@ExceptionHandler(HttpRequestMethodNotSupportedException.class)
public Result<?> httpRequestMethodNotSupportedException(HttpRequestMethodNotSupportedException e){
StringBuffer sb = new StringBuffer();
sb.append("不支持");
sb.append(e.getMethod());
sb.append("请求方法,");
sb.append("支持以下");
String [] methods = e.getSupportedMethods();
if(methods!=null){
for(String str:methods){
sb.append(str);
sb.append("");
}
}
log.error(sb.toString(), e);
//return Result.error("没有权限,请联系管理员授权");
return Result.error(405,sb.toString());
}
/**
* spring默认上传大小100MB 超出大小捕获异常MaxUploadSizeExceededException
*/
@ExceptionHandler(MaxUploadSizeExceededException.class)
public Result<?> handleMaxUploadSizeExceededException(MaxUploadSizeExceededException e) {
log.error(e.getMessage(), e);
return Result.error("文件大小超出10MB限制, 请压缩或降低文件质量! ");
}
@ExceptionHandler(DataIntegrityViolationException.class)
public Result<?> handleDataIntegrityViolationException(DataIntegrityViolationException e) {
log.error(e.getMessage(), e);
//issues/3624数据库执行异常handleDataIntegrityViolationException提示有误 #3624
return Result.error("执行数据库异常,违反了完整性例如:违反惟一约束、违反非空限制、字段内容超出长度等");
}
@ExceptionHandler(PoolException.class)
public Result<?> handlePoolException(PoolException e) {
log.error(e.getMessage(), e);
return Result.error("Redis 连接异常!");
}
@ExceptionHandler({ SQLSyntaxErrorException.class, SQLNonTransientException.class, SQLException.class })
public Result<?> handleSQLSyntaxErrorException(SQLException e) {
log.error(e.getMessage(), e);
return Result.error("SQL语法错误");
}
@ExceptionHandler({ BadSqlGrammarException.class, InvalidDataAccessResourceUsageException.class, NonTransientDataAccessException.class, DataAccessException.class })
public Result<?> handleBadSqlGrammarException(DataAccessException e) {
log.error(e.getMessage(), e);
return Result.error("SQL语法错误");
}
}

View File

@ -0,0 +1,50 @@
package org.jeecg.common.exception;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Iterator;
@Component
@Slf4j
public class LoggingInterceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
// 记录普通请求信息
log.info("Request intercepted: URL={}, Method={}, Parameters={}",
request.getRequestURI(), request.getMethod(), request.getParameterMap());
// 如果是多部分请求文件上传记录文件元数据
if (request instanceof MultipartHttpServletRequest) {
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
Iterator<String> fileNames = multipartRequest.getFileNames();
while (fileNames.hasNext()) {
String fileName = fileNames.next();
MultipartFile file = multipartRequest.getFile(fileName);
log.info("Intercepted file upload: URL={}, File name={}, Size={} bytes, Content type={}",
request.getRequestURI(), file.getOriginalFilename(), file.getSize(), file.getContentType());
}
}
return true; // 继续处理链
}
// 可选实现postHandle和afterCompletion方法...
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
// 可以在这里添加处理后的行为
}
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
// 可以在这里添加请求完成后的行为
}
}

View File

@ -0,0 +1,19 @@
package org.jeecg.common.exception;
import org.jeecg.common.exception.LoggingInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class WebConfig implements WebMvcConfigurer {
@Autowired
private LoggingInterceptor loggingInterceptor;
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(loggingInterceptor).addPathPatterns("/**");
}
}

View File

@ -331,6 +331,7 @@ public class KcKechengbiaoController extends JeecgController<KcKechengbiao, IKcK
QueryWrapper<KcKechengbiao> kcKechengbiaoQueryWrapper = new QueryWrapper<>();
kcKechengbiaoQueryWrapper.eq("rwbh",rwbh);
kcKechengbiaoQueryWrapper.eq("xqxn",xqxn);
kcKechengbiaoQueryWrapper.eq("flag","0");
kcKechengbiaoQueryWrapper.last("limit 1");
KcKechengbiao kcKechengbiao = kcKechengbiaoService.getOne(kcKechengbiaoQueryWrapper);
return Result.OK(kcKechengbiao);

View File

@ -758,7 +758,7 @@ public class ZyInfoController extends JeecgController<ZyInfo, IZyInfoService> {
//删除老师留过的作业重新生成新的
QueryWrapper<ZyInfo> query = new QueryWrapper<>();
query.eq("rwbh", zyInfo.getRwbh());
// query.eq("create_by",zyInfo.getCreateBy());
query.eq("create_by",zyInfo.getCreateBy());
query.eq("zy_leixing","0");
List<ZyInfo> oldList = zyInfoService.list(query);
zyInfoService.remove(query);

View File

@ -26,6 +26,7 @@ public class ZyInfoSys implements Serializable {
private String xqxn;
@Excel(name = "学院", width = 15)
private String kkdw;
private String dwh;//学院号
@Excel(name = "课程名称", width = 15)
private String kcmc;
@Excel(name = "课程性质", width = 15)

View File

@ -36,10 +36,26 @@ public interface ZyInfoMapper extends BaseMapper<ZyInfo> {
List<ZyInfoSys> getZyStaticNo(@Param("zyInfoSys") ZyInfoSys zyInfoSys);
List<ZyInfoSys> getXyZyList(@Param("zyInfoSys") ZyInfoSys zyInfoSys);
List<ZyInfoSys> getZyTopList(@Param("zyInfoSys") ZyInfoSys zyInfoSys);
List<ZyInfoSys> getZyList(@Param("zyInfoSys") ZyInfoSys zyInfoSys);
List<ZyInfoSys> getCyTopList(@Param("zyInfoSys") ZyInfoSys zyInfoSys);
List<ZyInfoSys> getCyList(@Param("zyInfoSys") ZyInfoSys zyInfoSys);
List<ZyInfoSys> getXYCyList(@Param("zyInfoSys") ZyInfoSys zyInfoSys);
List<ZyInfoSys> getKcTopList(@Param("zyInfoSys") ZyInfoSys zyInfoSys);
List<ZyInfoSys> getXnKcList(@Param("zyInfoSys") ZyInfoSys zyInfoSys);
List<ZyInfoSys> getJsTopList(@Param("zyInfoSys") ZyInfoSys zyInfoSys);
List<ZyInfoSys> getXnJsList(@Param("zyInfoSys") ZyInfoSys zyInfoSys);
IPage<ZyInfoSys> sysStaticZyList(Page<ZyInfoSys> page,@Param("zyInfoSys") ZyInfoSys zyInfoSys);
IPage<CyInfoSys> sysStaticCyList(Page<CyInfoSys> page, @Param("zyInfoSys") CyInfoSys cyInfoSys);

View File

@ -244,6 +244,26 @@
select count(distinct ww.id) as count,'10' as type from wjx_wjxx ww join kc_kechengbiao kk on kk.jgh = ww.create_by AND kk.rwbh = ww.rwbh AND kk.xqxn = ww.xqxn where (ww.update_time = DATE_FORMAT(NOW(),'%Y-%m-%d') or ww.create_time = DATE_FORMAT(NOW(),'%Y-%m-%d') ) and ww.qpublish in (2)
union all
select count(distinct zi.id) as count,'11' as type from zy_info zi join kc_kechengbiao kk on kk.jgh = zi.create_by AND kk.rwbh = zi.rwbh AND kk.xqxn = zi.xnxq where zi.zy_status in ('1','2') and zi.xnxq = #{zyInfoSys.xqxn} and zi.sfcc in ('1','2') and kk.flag = 0
union all
select count(*) as count,'12' as type from zy_info where file_path is not null and xnxq = #{zyInfoSys.xqxn}
union all
select count(*) as count,'13' as type from zy_info where file_path is not null and xnxq = #{zyInfoSys.xqxn} and xshpkg = '1'
union all
select count(*) as count,'14' as type from zy_info where file_path is not null and xnxq = #{zyInfoSys.xqxn} and sfcc = '1'
union all
SELECT COUNT(*) as count,'16' as type FROM wjx_djxx WHERE create_time BETWEEN (SELECT bxqkssj FROM kc_sys_config WHERE flag1=#{zyInfoSys.xqxn} LIMIT 1) AND (SELECT bxqjssj FROM kc_sys_config WHERE flag1=#{zyInfoSys.xqxn} LIMIT 1);
</select>
<select id="getXyZyList" resultType="org.jeecg.modules.kc.zyInfo.entity.ZyInfoSys">
select (@rownum:=@rownum + 1) AS rownum,t.* from (
select count(*) as count,b.dwmc as kkdw from zy_info a,xxhbuser b where a.create_by = b.gh and xnxq = #{zyInfoSys.xqxn} and zy_status in (1,2) GROUP BY b.dwmc
) t , (SELECT @rownum:=0) AS r ORDER BY count-0 desc
</select>
<select id="getZyList" resultType="org.jeecg.modules.kc.zyInfo.entity.ZyInfoSys">
select (@rownum:=@rownum + 1) AS rownum,t.* from (
select a.create_by,count(*) as count,b.xm as skjs,b.dwmc as kkdw from zy_info a,xxhbuser b where a.create_by = b.gh and xnxq = #{zyInfoSys.xqxn} and zy_status in (1,2) GROUP BY a.create_by ,b.xm,b.dwmc
) t , (SELECT @rownum:=0) AS r ORDER BY count-0 desc
</select>
<select id="getZyTopList" resultType="org.jeecg.modules.kc.zyInfo.entity.ZyInfoSys">
@ -252,13 +272,169 @@
) t , (SELECT @rownum:=0) AS r ORDER BY count-0 desc limit 10
</select>
<select id="getCyList" resultType="org.jeecg.modules.kc.zyInfo.entity.ZyInfoSys">
select (@rownum:=@rownum + 1) AS rownum,t.* from (
select a.create_by,count(*) as count,b.xm as skjs,b.dwmc as kkdw from wjx_wjxx a,xxhbuser b where a.create_by = b.gh and xqxn = #{zyInfoSys.xqxn} and qpublish in (1,2) GROUP BY a.create_by ,b.xm,b.dwmc
) t , (SELECT @rownum:=0) AS r ORDER BY count-0 desc
</select>
<select id="getCyTopList" resultType="org.jeecg.modules.kc.zyInfo.entity.ZyInfoSys">
select (@rownum:=@rownum + 1) AS rownum,t.* from (
select a.create_by,count(*) as count,b.xm as skjs,b.dwmc as kkdw from wjx_wjxx a,xxhbuser b where a.create_by = b.gh and xqxn = #{zyInfoSys.xqxn} and qpublish in (1,2) GROUP BY a.create_by ,b.xm,b.dwmc
) t , (SELECT @rownum:=0) AS r ORDER BY count-0 desc limit 10
</select>
<select id="getXYCyList" resultType="org.jeecg.modules.kc.zyInfo.entity.ZyInfoSys">
select (@rownum:=@rownum + 1) AS rownum,t.* from (
select count(*) as count,b.dwmc as kkdw from wjx_wjxx a,xxhbuser b where a.create_by = b.gh and xqxn = #{zyInfoSys.xqxn} and qpublish in (1,2) GROUP BY b.dwmc
) t , (SELECT @rownum:=0) AS r ORDER BY count-0 desc
</select>
<select id="getKcTopList" resultType="org.jeecg.modules.kc.zyInfo.entity.ZyInfoSys">
SELECT
( @rownum := @rownum + 1 ) AS rownum,
t.*
FROM
(
SELECT
b.kcmc,
count(*) AS count,
b.kkdw
FROM
zy_info a,
kc_kechengbiao b
WHERE
a.rwbh = b.rwbh
AND a.xnxq = #{zyInfoSys.xqxn} GROUP BY b.kcmc,b.kkdw
union all
SELECT
b.kcmc,
count(*) AS count,
b.kkdw
FROM
wjx_wjxx a,
kc_kechengbiao b
WHERE
a.rwbh = b.rwbh
AND a.xqxn = #{zyInfoSys.xqxn} GROUP BY b.kcmc,b.kkdw
) t,
( SELECT @rownum := 0 ) AS r
ORDER BY
count - 0 DESC
LIMIT 10
</select>
<select id="getXnKcList" resultType="org.jeecg.modules.kc.zyInfo.entity.ZyInfoSys">
SELECT
( @rownum := @rownum + 1 ) AS rownum,
t.*
FROM
(
SELECT
b.kcmc,
count(*) AS count,
b.kkdw
FROM
zy_info a,
kc_kechengbiao b
WHERE
a.rwbh = b.rwbh
AND a.xnxq = #{zyInfoSys.xqxn} GROUP BY b.kcmc,b.kkdw
union all
SELECT
b.kcmc,
count(*) AS count,
b.kkdw
FROM
wjx_wjxx a,
kc_kechengbiao b
WHERE
a.rwbh = b.rwbh
AND a.xqxn = #{zyInfoSys.xqxn} GROUP BY b.kcmc,b.kkdw
) t,
( SELECT @rownum := 0 ) AS r
ORDER BY
count - 0 DESC
</select>
<select id="getJsTopList" resultType="org.jeecg.modules.kc.zyInfo.entity.ZyInfoSys">
SELECT
( @rownum := @rownum + 1 ) AS rownum,
t.*
FROM
(
SELECT
a.create_by,
count(*) AS count,
b.xm AS skjs,
b.dwmc AS kkdw
FROM
zy_info a,
xxhbuser b
WHERE
a.create_by = b.gh
AND xnxq = #{zyInfoSys.xqxn} and zy_status in (1,2) GROUP BY a.create_by ,b.xm,b.dwmc
union all
SELECT
a.create_by,
count(*) AS count,
b.xm AS skjs,
b.dwmc AS kkdw
FROM
wjx_wjxx a,
xxhbuser b
WHERE
a.create_by = b.gh
AND xqxn = #{zyInfoSys.xqxn} and qpublish in (1,2) GROUP BY a.create_by ,b.xm,b.dwmc
) t,
( SELECT @rownum := 0 ) AS r
ORDER BY
count - 0 DESC
LIMIT 10
</select>
<select id="getXnJsList" resultType="org.jeecg.modules.kc.zyInfo.entity.ZyInfoSys">
SELECT
( @rownum := @rownum + 1 ) AS rownum,
t.*
FROM
(
SELECT
a.create_by,
count(*) AS count,
b.xm AS skjs,
b.dwmc AS kkdw
FROM
zy_info a,
xxhbuser b
WHERE
a.create_by = b.gh
AND xnxq = #{zyInfoSys.xqxn} and zy_status in (1,2) GROUP BY a.create_by ,b.xm,b.dwmc
union all
SELECT
a.create_by,
count(*) AS count,
b.xm AS skjs,
b.dwmc AS kkdw
FROM
wjx_wjxx a,
xxhbuser b
WHERE
a.create_by = b.gh
AND xqxn = #{zyInfoSys.xqxn} and qpublish in (1,2) GROUP BY a.create_by ,b.xm,b.dwmc
) t,
( SELECT @rownum := 0 ) AS r
ORDER BY
count - 0 DESC
</select>
<select id="sysStaticZyList" resultType="org.jeecg.modules.kc.zyInfo.entity.ZyInfoSys">
select a.*,b.skjs,b.jgh,b.kcmc,b.kcbh,b.xkrs,b.kkdw,b.kcxz,b.zc,a.xnxq as xqxn,

View File

@ -0,0 +1,28 @@
package org.jeecg.modules.kc.zyInfo.pojo;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel;
import java.io.Serializable;
/**
* @Description: 导出用
* @Author: zmy
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
public class ExportEntity1 implements Serializable {
private static final long serialVersionUID = 1L;
@Excel(name = "序号", width = 10)
private String rownum;
@Excel(name = "姓名", width = 15)
private String skjs;
@Excel(name = "次数", width = 15)
private String count;
@Excel(name = "学院", width = 40)
private String kkdw;
}

View File

@ -0,0 +1,28 @@
package org.jeecg.modules.kc.zyInfo.pojo;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel;
import java.io.Serializable;
/**
* @Description: 导出用
* @Author: zmy
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
public class ExportEntity2 implements Serializable {
private static final long serialVersionUID = 1L;
@Excel(name = "序号", width = 10)
private String rownum;
@Excel(name = "课程", width = 40)
private String kcmc;
@Excel(name = "次数", width = 15)
private String count;
@Excel(name = "学院", width = 40)
private String kkdw;
}

View File

@ -37,6 +37,8 @@ public interface IZyInfoService extends IService<ZyInfo> {
Map<String,Object> sysStaticNo(ZyInfoSys zyInfoSys);
List<ZyInfoSys> getPHData(ZyInfoSys zyInfoSys,String tag);
IPage<ZyInfoSys> sysStaticZyList(Page<ZyInfoSys> page, ZyInfoSys zyInfoSys);
IPage<CyInfoSys> sysStaticCyList(Page<CyInfoSys> page, CyInfoSys cyInfoSys);

View File

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.xkcoding.http.HttpUtil;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.SecurityUtils;
@ -180,6 +181,12 @@ public class ZyInfoServiceImpl extends ServiceImpl<ZyInfoMapper, ZyInfo> impleme
String jr_cy_syzcs = "0";
String jr_cy_ywczcs = "0";
String xn_zy_cccs = "0"; //查重次数
String xn_kc_zyzxsrc = "0";//使用课程作业总学生人次
String xn_kc_zyhp = "0";//使用课程作业互评总学生人次
String xn_kc_zycc = "0";//使用课程作业查重总学生人次
String xn_kc_zywczxsrc = "0";//完成课程作业总学生人次
String xn_kc_ktcy = "0";//使用课堂测验总学生人次
String xn_kc_wccy = "0";//完成课堂测验总学生人次
List<ZyInfoSys> list = baseMapper.getZyStaticNo(zyInfoSys);
for (ZyInfoSys par : list) {
@ -205,13 +212,36 @@ public class ZyInfoServiceImpl extends ServiceImpl<ZyInfoMapper, ZyInfo> impleme
jr_cy_ywczcs = par.getCount();
} else if (StringUtils.equals("11", par.getType())) {
xn_zy_cccs = par.getCount();
} else if (StringUtils.equals("12", par.getType())) {
xn_kc_zyzxsrc = par.getCount();
} else if (StringUtils.equals("13", par.getType())) {
xn_kc_zyhp = par.getCount();
} else if (StringUtils.equals("14", par.getType())) {
xn_kc_zycc = par.getCount();
} else if (StringUtils.equals("15", par.getType())) {
xn_kc_zywczxsrc = par.getCount();
} else if (StringUtils.equals("16", par.getType())) {
xn_kc_ktcy = par.getCount();
} else if (StringUtils.equals("17", par.getType())) {
xn_kc_wccy = par.getCount();
}
}
//本学年作业使用排行TOP10
List<ZyInfoSys> list1 = baseMapper.getZyTopList(zyInfoSys);
//本学年测验使用排行TOP10
List<ZyInfoSys> list2 = baseMapper.getCyTopList(zyInfoSys);
//本学年课程使用排行TOP10
List<ZyInfoSys> list3 = baseMapper.getKcTopList(zyInfoSys);
//本学年教师使用排行TOP10
List<ZyInfoSys> list4 = baseMapper.getJsTopList(zyInfoSys);
list.add(zyInfoSys);
//本学年各个学院作业数
List<ZyInfoSys> list5 = baseMapper.getXyZyList(zyInfoSys);
//本学年各个学院测验数
List<ZyInfoSys> list6 = baseMapper.getXYCyList(zyInfoSys);
map.put("xn_zy_syzcs", xn_zy_syzcs);//本学年作业使用总次数
map.put("xn_zy_hpzcs", xn_zy_hpzcs);//本学年作业互评总次数
map.put("xn_zy_ywczcs", xn_zy_ywczcs);//本学年作业已完成总次数
@ -223,12 +253,39 @@ public class ZyInfoServiceImpl extends ServiceImpl<ZyInfoMapper, ZyInfo> impleme
map.put("jr_zy_ywczcs", jr_zy_ywczcs);//今日作业已完成总次数
map.put("jr_cy_syzcs", jr_cy_syzcs);//今日测验使用总次数
map.put("jr_cy_ywczcs", jr_cy_ywczcs);//今日测验已完成总次数
map.put("xn_kc_zyzxsrc",xn_kc_zyzxsrc );//使用课程作业总学生人次
map.put("xn_kc_zyhp",xn_kc_zyhp );//使用课程作业互评总学生人次
map.put("xn_kc_zycc",xn_kc_zycc );//使用课程作业查重总学生人次
map.put("xn_kc_zywczxsrc",xn_kc_zywczxsrc );//完成课程作业总学生人次
map.put("xn_kc_ktcy",xn_kc_ktcy );//使用课堂测验总学生人次
map.put("xn_kc_wccy",xn_kc_wccy );//完成课堂测验总学生人次
map.put("xntop10", list1);//本学年作业使用排行TOP10
map.put("jrtop10", list2);//本学年测验使用排行TOP10
map.put("kctop10", list3);//本学年课程使用排行TOP10
map.put("jstop10", list4);//本学年教师使用排行TOP10
map.put("xnxyzycs", list5);//本学年各个学院作业数
map.put("xnxycycs", list6);//本学年各个学院测验数
return map;
}
@Override
public List<ZyInfoSys> getPHData(ZyInfoSys zyInfoSys,String tag) {
List<ZyInfoSys> list = Lists.newArrayList();
if("xntop10".equals(tag)){
list = baseMapper.getZyList(zyInfoSys);
}
if("jrtop10".equals(tag)){
list = baseMapper.getCyList(zyInfoSys);
}
if("kctop10".equals(tag)){
list = baseMapper.getXnKcList(zyInfoSys);
}
if("jstop10".equals(tag)){
list = baseMapper.getXnJsList(zyInfoSys);
}
return list;
}
@Override
public IPage<ZyInfoSys> sysStaticZyList(Page<ZyInfoSys> page, ZyInfoSys zyInfoSys) {
return baseMapper.sysStaticZyList(page, zyInfoSys);

View File

@ -18,16 +18,26 @@ import org.jeecg.modules.kc.kcCasusers.service.IKcCasusersService;
import org.jeecg.modules.kc.zyInfoStudent.entity.ZyInfoStudent;
import org.jeecg.modules.kc.zyInfoStudent.service.IZyInfoStudentService;
import org.jeecg.modules.kc.zyZyxx.entity.ZyZyxx;
import org.jeecg.modules.system.controller.CommonController;
import org.jeecg.modules.system.entity.SysUser;
import org.jeecg.modules.system.service.ISysUserService;
import org.jeecg.modules.wps.entity.WpsEnti;
import org.jeecg.modules.wps.entity.WpsUploadEnti;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.util.*;
/**
@ -46,8 +56,12 @@ public class WpsController extends JeecgController<KcCasusers, IKcCasusersServic
@Autowired
private ISysUserService sysUserService;
@Autowired
private CommonController commonController;
/**
* 文档预览
*
* @param fileId
* @return
*/
@ -75,16 +89,20 @@ public class WpsController extends JeecgController<KcCasusers, IKcCasusersServic
/**
* 文件下载地址
*
* @param fileId
* @return
*/
@RequestMapping(value = "/files/{fileId}/download", method = {RequestMethod.GET})
public Map<String, Object> download(@PathVariable("fileId") String fileId) {
log.info("~~~~~~~~~~~~>>>>>>>>>>>");
log.info("download--fileId=" + fileId);
log.info("~~~~~~~~~~~~<<<<<<<<<<<");
ZyInfoStudent zyInfoStudent = zyInfoStudentService.getById(fileId);
Map<String, Object> mapRet = new HashMap<>();
Map<String, Object> mapRet2 = new HashMap<>();
// https://kczxcs.nenu.edu.cn/jeecg-boot/sys/common/static/temp/QA%E4%BD%9C%E4%B8%9A%E7%B3%BB%E7%BB%9F%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98_1733101749150.docx
mapRet2.put("url", "https://kczxcs.nenu.edu.cn/jeecg-boot/sys/common/static/" + zyInfoStudent.getFilePath());
Map<String, String> headers = new HashMap<>();
mapRet.put("code", 0);
mapRet.put("data", mapRet2);
return mapRet;
@ -93,11 +111,13 @@ public class WpsController extends JeecgController<KcCasusers, IKcCasusersServic
/**
* 获取文档用户权限
*
* @param fileId
* @return
*/
@RequestMapping(value = "/files/{fileId}/permission", method = {RequestMethod.GET})
public Map<String,Object> permission(@PathVariable("fileId") String fileId) {
public Map<String, Object> permission(@PathVariable("fileId") String fileId,
@RequestHeader(value = "X-WebOffice-Token", required = false) String webOfficeToken) {
ZyInfoStudent zyInfoStudent = zyInfoStudentService.getById(fileId);
Map<String, Object> mapRet = new HashMap<>();
Map<String, Object> mapRet2 = new HashMap<>();
@ -110,9 +130,9 @@ public class WpsController extends JeecgController<KcCasusers, IKcCasusersServic
mapRet2.put("read", 1);
// mapRet2.put("rename",1);
// mapRet2.put("saveas",1);
mapRet2.put("update",1);
mapRet2.put("user_id",zyInfoStudent.getCreateBy());
mapRet2.put("update", webOfficeToken.equals(zyInfoStudent.getCreateBy()) ? 0 : 1);
// mapRet2.put("user_id",zyInfoStudent.getCreateBy());
mapRet2.put("user_id", webOfficeToken);
mapRet.put("data", mapRet2);
return mapRet;
}
@ -120,6 +140,7 @@ public class WpsController extends JeecgController<KcCasusers, IKcCasusersServic
/**
* 文档预览
*
* @param fileId
* @return
*/
@ -169,6 +190,7 @@ public class WpsController extends JeecgController<KcCasusers, IKcCasusersServic
/**
* 准备上传阶段
*
* @param fileId
* @return
*/
@ -191,7 +213,7 @@ public class WpsController extends JeecgController<KcCasusers, IKcCasusersServic
Map<String, Object> mapRet = new HashMap<>();
mapRet.put("code", 0);
Map<String, Object> mapRet2 = new HashMap<>();
mapRet2.put("url","https://kczxcs.nenu.edu.cn/jeecg-boot/sys/common/static/"+zyInfoStudent.getFilePath());
mapRet2.put("url", "https://kczxcs.nenu.edu.cn/jeecg-boot/v3/3rd/static/" + zyInfoStudent.getFilePath());
mapRet2.put("method", "POST");
mapRet.put("data", mapRet2);
mapRet.put("message", "");
@ -220,5 +242,18 @@ public class WpsController extends JeecgController<KcCasusers, IKcCasusersServic
return mapRet;
}
@PostMapping("/static/temp/{fileName}")
public ResponseEntity<String> downloadFile(@PathVariable String fileName
, @RequestParam(value = "file", required = false) MultipartFile file) {
log.info(">>>>>>>>>");
log.info("fileName=" + fileName);
String newFileName = fileName.substring(0, fileName.indexOf("_")) + "_" + System.currentTimeMillis() + fileName.substring(fileName.indexOf("."));
log.info("fileName222处理后=", newFileName);
String savePath = commonController.uploadLocal(file, newFileName, "temp");
log.info("savePath=" + savePath);
log.info("<<<<<<<<<");
//TODO 存数据库 不能旧的不删除然后每次都新存 前端关闭弹窗时调用保存方法来触发这个接口
return null;
}
}

View File

@ -21,6 +21,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.util.AntPathMatcher;
import org.springframework.util.FileCopyUtils;
import org.springframework.web.bind.annotation.*;
@ -34,6 +35,11 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
@ -68,8 +74,8 @@ public class CommonController {
SftpConfig sftpConfig;
/**
* @Author 政辉
* @return
* @Author 政辉
*/
@GetMapping("/403")
public Result<?> noauth() {
@ -78,6 +84,7 @@ public class CommonController {
/**
* 文件上传统一方法
*
* @param request
* @param response
* @return
@ -116,8 +123,10 @@ public class CommonController {
}
return result;
}
/**
* 文件上传统一方法
*
* @param bizPath
* @param file
* @return
@ -135,9 +144,6 @@ public class CommonController {
bizPath = "";
}
}
if (CommonConstant.UPLOAD_TYPE_LOCAL.equals(uploadType)) {
//update-begin-author:liusq date:20221102 for: 过滤上传文件类型
FileTypeFilter.fileTypeFilter(file);
@ -169,6 +175,7 @@ public class CommonController {
/**
* 本地文件上传
*
* @param mf 文件
* @param bizPath 自定义路径
* @return
@ -179,11 +186,12 @@ public class CommonController {
/**
* 本地文件上传
*
* @param mf 文件
* @param bizPath 自定义路径
* @return
*/
private String uploadLocal(MultipartFile mf,String _fileName,String bizPath){
public String uploadLocal(MultipartFile mf, String _fileName, String bizPath) {
try {
String ctxPath = uploadpath;
String fileName = _fileName;
@ -345,6 +353,7 @@ public class CommonController {
return Result.OK("upload ok");
}
@PostMapping(value = "/sectionUpload/end")
public Result<?> sectionUploadEnd(@RequestBody SectionUploadData sectionUploadData) {
log.info("合并文件!");
@ -442,6 +451,7 @@ public class CommonController {
/**
* file转MultipartFile
*
* @param file File对象
* @return MultipartFile 对象
*/
@ -624,9 +634,9 @@ public class CommonController {
// }
/**
* @功能pdf预览Iframe
* @param modelAndView
* @return
* @功能pdf预览Iframe
*/
@RequestMapping("/pdf/pdfPreviewIframe")
public ModelAndView pdfPreviewIframe(ModelAndView modelAndView) {
@ -637,6 +647,7 @@ public class CommonController {
/**
* 把指定URL后的字符串全部截断当成参数
* 这么做是为了防止URL中包含中文或者特殊字符/匹配不了的问题
*
* @param request
* @return
*/
@ -648,6 +659,7 @@ public class CommonController {
/**
* 获取文件真实路径
*
* @param path
* @return
*/