补提代码

This commit is contained in:
1378012178@qq.com 2025-01-06 09:24:57 +08:00
parent fe19f4ede9
commit 7deb4d868c
1 changed files with 99 additions and 0 deletions

View File

@ -32,6 +32,7 @@ import org.jeecg.modules.kc.zyDbtx.service.IZyDbtxService;
import org.jeecg.modules.kc.zyInfo.entity.CyInfoSys;
import org.jeecg.modules.kc.zyInfo.entity.ZyInfo;
import org.jeecg.modules.kc.zyInfo.entity.ZyInfoSys;
import org.jeecg.modules.kc.zyInfo.pojo.ExportEntity1;
import org.jeecg.modules.kc.zyInfo.service.IZyInfoService;
import org.jeecg.modules.kc.zyInfoStudent.entity.ZyInfoStudent;
import org.jeecg.modules.kc.zyInfoStudent.service.IZyInfoStudentService;
@ -39,6 +40,7 @@ import org.jeecg.modules.system.service.impl.SysBaseApiImpl;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
@ -987,7 +989,104 @@ public class ZyInfoController extends JeecgController<ZyInfo, IZyInfoService> {
}
@ApiOperation(value = "统计作业测试使用情况", notes = "刷新排行数据")
@GetMapping(value = "/getPHData")
public Result<List<ZyInfoSys>> getPHData(ZyInfoSys zyInfoSys,
@RequestParam(name = "tag", required = false) String tag,
HttpServletRequest req) {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//-------------获取当前登陆人是否是管理员角色如果不是都按照教务秘书处理---------------------------
List<String> roleList = sysBaseApi.getRolesByUsername(sysUser.getUsername());
String adminRole = "1";//0 admin 1教务秘书
for (String role : roleList) {
if (org.apache.commons.lang.StringUtils.equals("admin", role)) {
adminRole = "0";
break;
}
}
QueryWrapper<ZyInfoSys> queryWrapper = new QueryWrapper<ZyInfoSys>();
if (org.apache.commons.lang.StringUtils.equals("1", adminRole)) {
QueryWrapper<KcExportConfigTpkwcqkjzglx> queryWrapperCon = new QueryWrapper<KcExportConfigTpkwcqkjzglx>();
queryWrapperCon.eq("gh", sysUser.getUsername());
queryWrapperCon.orderByDesc("create_time");
queryWrapperCon.last("limit 1");
KcExportConfigTpkwcqkjzglx kcExportConfigTpkwcqkjzglx = kcExportConfigTpkwcqkjzglxService.getOne(queryWrapperCon);
zyInfoSys.setKkdw(kcExportConfigTpkwcqkjzglx.getDwmc());
}
if (com.baomidou.mybatisplus.core.toolkit.StringUtils.isEmpty(zyInfoSys.getXqxn())) {
KcSysConfig kcSysConfig = kcSysConfigService.getById("1");
zyInfoSys.setXqxn(kcSysConfig.getFlag1());
}
List<ZyInfoSys> list = zyInfoService.getPHData(zyInfoSys, tag);
return Result.OK(list);
}
@ApiOperation(value = "统计作业测试使用情况", notes = "导出排行数据")
@GetMapping(value = "/exportPHData")
public ModelAndView exportPHData(ZyInfoSys zyInfoSys, @RequestParam(name = "tag", required = false) String tag) {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//-------------获取当前登陆人是否是管理员角色如果不是都按照教务秘书处理---------------------------
List<String> roleList = sysBaseApi.getRolesByUsername(sysUser.getUsername());
String adminRole = "1";//0 admin 1教务秘书
for (String role : roleList) {
if (org.apache.commons.lang.StringUtils.equals("admin", role)) {
adminRole = "0";
break;
}
}
QueryWrapper<ZyInfoSys> queryWrapper = new QueryWrapper<ZyInfoSys>();
if (org.apache.commons.lang.StringUtils.equals("1", adminRole)) {
QueryWrapper<KcExportConfigTpkwcqkjzglx> queryWrapperCon = new QueryWrapper<KcExportConfigTpkwcqkjzglx>();
queryWrapperCon.eq("gh", sysUser.getUsername());
queryWrapperCon.orderByDesc("create_time");
queryWrapperCon.last("limit 1");
KcExportConfigTpkwcqkjzglx kcExportConfigTpkwcqkjzglx = kcExportConfigTpkwcqkjzglxService.getOne(queryWrapperCon);
zyInfoSys.setKkdw(kcExportConfigTpkwcqkjzglx.getDwmc());
}
if (com.baomidou.mybatisplus.core.toolkit.StringUtils.isEmpty(zyInfoSys.getXqxn())) {
KcSysConfig kcSysConfig = kcSysConfigService.getById("1");
zyInfoSys.setXqxn(kcSysConfig.getFlag1());
}
List<ZyInfoSys> list = zyInfoService.getPHData(zyInfoSys, tag);
List<ExportEntity1> exportList = list.stream()
.map(zyInfo -> {
ExportEntity1 entity = new ExportEntity1();
// 使用 Spring BeanUtils 复制属性
BeanUtils.copyProperties(zyInfo, entity);
String rn = entity.getRownum();
entity.setRownum(rn.substring(0,rn.indexOf(".")));
return entity;
})
.collect(Collectors.toList());
String title = "";
if ("xntop10".equals(tag)) {
title = "本学年作业使用排行";
}
if ("jrtop10".equals(tag)) {
title = "本学年测验使用排行";
}
if ("kctop10".equals(tag)) {
title = "本学年课程使用排行";
}
if ("jstop10".equals(tag)) {
title = "本学年教师使用排行";
}
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
//此处设置的filename无效 ,前端会重更新设置一下
mv.addObject(NormalExcelConstants.FILE_NAME, title);
mv.addObject(NormalExcelConstants.CLASS, ExportEntity1.class);
//update-begin--Author:liusq Date:20210126 for图片导出报错ImageBasePath未设置--------------------
ExportParams exportParams = new ExportParams(title + "报表", "导出人:" + sysUser.getRealname(), title);
exportParams.setImageBasePath(upLoadPath);
//update-end--Author:liusq Date:20210126 for图片导出报错ImageBasePath未设置----------------------
mv.addObject(NormalExcelConstants.PARAMS, exportParams);
mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
return mv;
}
@ApiOperation(value="统计作业使用情况", notes="统计作业使用情况")
@GetMapping(value = "/sysStaticZyList")