Compare commits
57 Commits
Author | SHA1 | Date |
---|---|---|
|
9e7acd05eb | |
|
944f0e54d6 | |
|
4985133ea4 | |
|
47216f68fa | |
|
addbef8cb2 | |
|
be2ae25b5c | |
|
98340d6742 | |
|
a70d511a06 | |
|
52d214770b | |
|
2d11a335d7 | |
|
c25fa2a9f0 | |
|
fa9d4b2562 | |
|
bd8de06651 | |
|
a5f4b5965f | |
|
f23a1dd5dd | |
|
d5c7172fed | |
|
736a7bf3bd | |
|
f0e59c3ee5 | |
|
422def8d91 | |
|
2376619f63 | |
|
4266d351c4 | |
|
7b28a0d3f4 | |
|
9b90ffe59d | |
|
5c17141343 | |
|
ac0523706f | |
|
a954982686 | |
|
5c19ee200d | |
|
2ad30ffc4d | |
|
97e16394c5 | |
|
5b4f68a44b | |
|
2cdc51d420 | |
|
978661eee2 | |
|
17f9faa9f8 | |
|
ba1c0d0b6c | |
|
d13486422c | |
|
0ef7780459 | |
|
97e8f30549 | |
|
519a3dc0f8 | |
|
a329b820e4 | |
|
cfa58a6363 | |
|
0ac14a9518 | |
|
b0a8de4b3b | |
|
afa290ba7c | |
|
faa6144677 | |
|
161257c78b | |
|
d09c8e13d8 | |
|
73b1c89ecd | |
|
b1992d60e1 | |
|
2a68bc53ee | |
|
14ad6463ff | |
|
43b8e942ad | |
|
42c5fe68be | |
|
9b86eec766 | |
|
7fc7e8a602 | |
|
2bec05f542 | |
|
a6aba82501 | |
|
489efb0ae4 |
|
@ -75,6 +75,30 @@ public class JeecgController<T, S extends IService<T>> {
|
|||
mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
|
||||
return mv;
|
||||
}
|
||||
/**
|
||||
* 根据传入数据列表导出 Excel
|
||||
*
|
||||
* @param dataList 导出的数据列表
|
||||
* @param clazz 导出类的 Class
|
||||
* @param title 导出标题
|
||||
*/
|
||||
protected ModelAndView exportXlsByList(List<T> dataList, Class<T> clazz, String title) {
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
|
||||
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
||||
|
||||
mv.addObject(NormalExcelConstants.FILE_NAME, title);
|
||||
mv.addObject(NormalExcelConstants.CLASS, clazz);
|
||||
|
||||
ExportParams exportParams = new ExportParams(title + "报表", "导出人:" + sysUser.getRealname(), title);
|
||||
exportParams.setImageBasePath(jeecgBaseConfig.getPath().getUpload());
|
||||
|
||||
mv.addObject(NormalExcelConstants.PARAMS, exportParams);
|
||||
mv.addObject(NormalExcelConstants.DATA_LIST, dataList);
|
||||
|
||||
return mv;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据每页sheet数量导出多sheet
|
||||
*
|
||||
|
|
|
@ -77,6 +77,8 @@ public class ShiroConfig {
|
|||
}
|
||||
// 2024.3.26 黄晖添加
|
||||
|
||||
// 2024.10.23 林利弘添加
|
||||
// filterChainDefinitionMap.put("/cetDataImport/cas/client/validateLogin", "anon"); //cas验证登录
|
||||
|
||||
|
||||
// 配置不会被拦截的链接 顺序判断
|
||||
|
|
|
@ -250,7 +250,7 @@ public class SysPermissionController {
|
|||
//添加首页路由
|
||||
//update-begin-author:taoyan date:20200211 for: TASK #3368 【路由缓存】首页的缓存设置有问题,需要根据后台的路由配置来实现是否缓存
|
||||
if(!PermissionDataUtil.hasIndexPage(metaList)){
|
||||
SysPermission indexMenu = sysPermissionService.list(new LambdaQueryWrapper<SysPermission>().eq(SysPermission::getName,"首页")).get(0);
|
||||
SysPermission indexMenu = sysPermissionService.list(new LambdaQueryWrapper<SysPermission>().like(SysPermission::getName,"首页")).get(0);
|
||||
metaList.add(0,indexMenu);
|
||||
}
|
||||
//update-end-author:taoyan date:20200211 for: TASK #3368 【路由缓存】首页的缓存设置有问题,需要根据后台的路由配置来实现是否缓存
|
||||
|
@ -263,7 +263,7 @@ public class SysPermissionController {
|
|||
//update-end--Author:zyf Date:20220425 for:自定义首页地址 LOWCOD-1578
|
||||
|
||||
if(roleIndex!=null){
|
||||
List<SysPermission> menus = metaList.stream().filter(sysPermission -> "首页".equals(sysPermission.getName())).collect(Collectors.toList());
|
||||
List<SysPermission> menus = metaList.stream().filter(sysPermission -> sysPermission.getName().contains("首页")).collect(Collectors.toList());
|
||||
//update-begin---author:liusq ---date:2022-06-29 for:设置自定义首页地址和组件----------
|
||||
String component = roleIndex.getComponent();
|
||||
String routeUrl = roleIndex.getUrl();
|
||||
|
|
|
@ -32,6 +32,11 @@
|
|||
<scope>runtime</scope>
|
||||
</dependency>-->
|
||||
<!--达梦数据库 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>easyexcel</artifactId>
|
||||
<version>3.1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.dameng</groupId>
|
||||
<artifactId>Dm8JdbcDriver18</artifactId>
|
||||
|
|
|
@ -3,6 +3,11 @@ package org.jeecg.modules.anno;
|
|||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
/**
|
||||
* @Description DBF行标识
|
||||
* @Author Cool
|
||||
* @Date 13:03 2024/10/11
|
||||
**/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface AttributeName {
|
||||
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
package org.jeecg.modules.config;
|
||||
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
*
|
||||
* @Author: Cool
|
||||
* @Date: 2024/10/24/13:54
|
||||
* @Description: 线程池管理
|
||||
*/
|
||||
public class ThreadPoolManager {
|
||||
// 单例实例,使用 volatile 关键字
|
||||
private static volatile ThreadPoolExecutor executor;
|
||||
|
||||
private ThreadPoolManager() {}
|
||||
|
||||
public static ThreadPoolExecutor getExecutor() {
|
||||
if (executor == null) {
|
||||
synchronized (ThreadPoolManager.class) {
|
||||
if (executor == null) {
|
||||
executor = new ThreadPoolExecutor(
|
||||
4,
|
||||
6,
|
||||
60L,
|
||||
TimeUnit.SECONDS,
|
||||
new LinkedBlockingQueue<>(50),
|
||||
Executors.defaultThreadFactory(),
|
||||
new ThreadPoolExecutor.AbortPolicy()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
return executor;
|
||||
}
|
||||
}
|
|
@ -1,8 +1,11 @@
|
|||
package org.jeecg.modules.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.dto.getRateByEntryDateDto;
|
||||
import org.jeecg.modules.dto.getRateByMajorAndLastestBatchDto;
|
||||
import org.jeecg.modules.entity.Cet_6;
|
||||
import org.jeecg.modules.service.CenterService;
|
||||
import org.jeecg.modules.service.ICet_4Service;
|
||||
|
@ -12,6 +15,7 @@ import org.springframework.cache.annotation.Cacheable;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/cet")
|
||||
|
@ -26,6 +30,8 @@ public class CenterController {
|
|||
|
||||
/**
|
||||
* 统计四级表和六级表中存在的年级
|
||||
*
|
||||
* @return {@link Result }<{@link JSONObject }>
|
||||
*/
|
||||
@GetMapping(value = "/getEntrydate")
|
||||
public Result<JSONObject> getEntrydate() {
|
||||
|
@ -58,6 +64,11 @@ public class CenterController {
|
|||
|
||||
/**
|
||||
* 依据学院和年级获取四级和六级通过数据
|
||||
*
|
||||
* @param college
|
||||
* @param major
|
||||
* @param entrydate
|
||||
* @return {@link Result }<{@link JSONObject }>
|
||||
*/
|
||||
@GetMapping(value = "/getData")
|
||||
// @Cacheable(cacheNames = "getData", key = "#college+#major+#entrydate")
|
||||
|
@ -68,7 +79,7 @@ public class CenterController {
|
|||
@PostMapping("/getAllRate")
|
||||
@Cacheable(value = "getAllRate", key = "'getAllRate' + #webData")
|
||||
public Result<JSONObject> getAllRate(@RequestBody JSONObject webData) {
|
||||
String level= webData.getString("level");
|
||||
String level = webData.getString("level");
|
||||
//四六级分开查询
|
||||
if (level.equals("cet4")) {
|
||||
|
||||
|
@ -81,18 +92,19 @@ public class CenterController {
|
|||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/getRateByCollege")
|
||||
public Result<JSONObject> getRateByCollege(@RequestBody JSONObject webData){
|
||||
public Result<JSONObject> getRateByCollege(@RequestBody JSONObject webData) {
|
||||
return cet4Service.getRateByCollege(webData);
|
||||
}
|
||||
|
||||
@GetMapping("/getRateByAllBatch")
|
||||
// @Cacheable(value = "getRateByAllBatch", key = "'getRateByAllBatch' + #college+#major+#level")
|
||||
public Result<JSONObject> getRateByAllBatch(@RequestParam("college") String college,@RequestParam("major") String major, @RequestParam("level") String level) {
|
||||
public Result<JSONObject> getRateByAllBatch(@RequestParam("college") String college, @RequestParam("major") String major, @RequestParam("level") String level) {
|
||||
// System.out.println(college + " " + level);
|
||||
if (level.equals("cet4")) {
|
||||
|
||||
return cet4Service.getRateByAllBatch(college,major);
|
||||
return cet4Service.getRateByAllBatch(college, major);
|
||||
} else if (level.equals("cet6")) {
|
||||
Cet_6 cet = new Cet_6();
|
||||
cet.setCollege(college);
|
||||
|
@ -101,15 +113,42 @@ public class CenterController {
|
|||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/getRateByBatch")
|
||||
public Result<JSONObject> getRateByBatch(@RequestParam("batch")String batch, @RequestParam("college") String college, @RequestParam("level")String level){
|
||||
if (level.equals("cet4")){
|
||||
return cet4Service.getRateByBatch(college,batch);
|
||||
}else return null;
|
||||
public Result<JSONObject> getRateByBatch(@RequestParam("batch") String batch, @RequestParam("college") String college, @RequestParam("level") String level) {
|
||||
if (level.equals("cet4")) {
|
||||
return cet4Service.getRateByBatch(college, batch);
|
||||
} else return null;
|
||||
}
|
||||
|
||||
@PostMapping("/getRateByMajor")
|
||||
public Result<JSONObject> getRateByMajor(@RequestBody JSONObject webData){
|
||||
return cet4Service.getRateByMajor(webData);
|
||||
public Result<JSONObject> getRateByMajor(@RequestBody JSONObject webData) {
|
||||
return cet4Service.getRateByMajor(webData);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param getRateByMajorAndLastestBatchParam
|
||||
* @return {@link Result }<{@link JSONObject }>
|
||||
*/
|
||||
@PostMapping("/getRateByMajorAndLastestBatch")
|
||||
@ApiOperation(value = "根据专业获取每个年级最新批次的通过率")
|
||||
public Result<JSONObject> getRateByMajorAndLastestBatch(@Valid @RequestBody getRateByMajorAndLastestBatchDto getRateByMajorAndLastestBatchParam) {
|
||||
log.info("根据专业获取最新批次的通过率入参:{}", JSONObject.toJSONString(getRateByMajorAndLastestBatchParam));
|
||||
return cet4Service.getRateByMajorAndLastestBatch(getRateByMajorAndLastestBatchParam);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param getRateByEntryDateDtoParams
|
||||
* @return {@link Result }<{@link JSONObject }>
|
||||
*/
|
||||
@PostMapping( "/getRateByEntryDate")
|
||||
@ApiOperation(value = "根据学院/专业的每个年级的通过率")
|
||||
public Result<JSONObject> getRateByEntryDate(@RequestBody getRateByEntryDateDto getRateByEntryDateDtoParams) {
|
||||
log.info("根据学院/专业的每个年级的通过率: {}", JSONObject.toJSONString(getRateByEntryDateDtoParams));
|
||||
return cet4Service.getRateByEntryDate(getRateByEntryDateDtoParams);
|
||||
}
|
||||
@GetMapping("/getTest")
|
||||
public Result<JSONObject> getTest() {
|
||||
|
|
|
@ -0,0 +1,182 @@
|
|||
package org.jeecg.modules.controller;
|
||||
|
||||
|
||||
import java.util.Arrays;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.jeecg.modules.entity.Cet4_major;
|
||||
import org.jeecg.modules.service.ICet4MajorService;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
|
||||
/**
|
||||
* @Description: cet4_major
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-10-23
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags = "cet4_major")
|
||||
@RestController
|
||||
@RequestMapping("/com/cet4Major")
|
||||
@Slf4j
|
||||
public class Cet4MajorController extends JeecgController<Cet4_major, ICet4MajorService> {
|
||||
@Autowired
|
||||
private ICet4MajorService cet4MajorService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param cet4Major
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "cet4_major-分页列表查询")
|
||||
@ApiOperation(value = "cet4_major-分页列表查询", notes = "cet4_major-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<Cet4_major>> queryPageList(Cet4_major cet4Major,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<Cet4_major> queryWrapper = QueryGenerator.initQueryWrapper(cet4Major, req.getParameterMap());
|
||||
Page<Cet4_major> page = new Page<Cet4_major>(pageNo, pageSize);
|
||||
IPage<Cet4_major> pageList = cet4MajorService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param cet4Major
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "cet4_major-添加")
|
||||
@ApiOperation(value = "cet4_major-添加", notes = "cet4_major-添加")
|
||||
@RequiresPermissions("com:cet4_major:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody Cet4_major cet4Major) {
|
||||
cet4MajorService.save(cet4Major);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param cet4Major
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "cet4_major-编辑")
|
||||
@ApiOperation(value = "cet4_major-编辑", notes = "cet4_major-编辑")
|
||||
@RequiresPermissions("com:cet4_major:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody Cet4_major cet4Major) {
|
||||
cet4MajorService.updateById(cet4Major);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "cet4_major-通过id删除")
|
||||
@ApiOperation(value = "cet4_major-通过id删除", notes = "cet4_major-通过id删除")
|
||||
@RequiresPermissions("com:cet4_major:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
cet4MajorService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "cet4_major-批量删除")
|
||||
@ApiOperation(value = "cet4_major-批量删除", notes = "cet4_major-批量删除")
|
||||
@RequiresPermissions("com:cet4_major:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
this.cet4MajorService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "cet4_major-通过id查询")
|
||||
@ApiOperation(value = "cet4_major-通过id查询", notes = "cet4_major-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<Cet4_major> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
Cet4_major cet4Major = cet4MajorService.getById(id);
|
||||
if (cet4Major == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(cet4Major);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param cet4Major
|
||||
*/
|
||||
// @RequiresPermissions("com:cet4_major:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, Cet4_major cet4Major) {
|
||||
return super.exportXls(request, cet4Major, Cet4_major.class, "cet4_major");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
// @RequiresPermissions("com:cet4_major:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return cet4MajorService.importStudentData(request);
|
||||
}
|
||||
|
||||
@RequestMapping("downloadTemplate")
|
||||
@ApiOperation("四六级导入数据文件模版")
|
||||
public Result<?> downloadTemplate(HttpServletResponse response) {
|
||||
return cet4MajorService.downloadTemplate(response);
|
||||
}
|
||||
|
||||
@RequestMapping("loadTable")
|
||||
@ApiOperation("加载表格")
|
||||
public Result<?> loadTable() {
|
||||
return cet4MajorService.loadTable();
|
||||
}
|
||||
|
||||
@RequestMapping("asyncData")
|
||||
@ApiOperation("同步数据")
|
||||
public Result<?> asyncData() {
|
||||
return cet4MajorService.asyncData();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
package org.jeecg.modules.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.service.CetDataImport;
|
||||
import org.jeecg.modules.utils.Base64DecodedMultipartFile;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Base64;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
*
|
||||
* @Author: Cool
|
||||
* @Date: 2024/10/10/22:06
|
||||
* @Description:
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("cetDataImport")
|
||||
@Api(value = "四六级数据导入接口")
|
||||
@Slf4j
|
||||
public class CetDataImportController {
|
||||
|
||||
@Autowired
|
||||
private CetDataImport cetDataImport;
|
||||
|
||||
|
||||
/**
|
||||
* @param fileContent dbf文件
|
||||
* @param batch 考试批次
|
||||
* @param level cet等级(cet4/cet6)
|
||||
* @Author Cool
|
||||
* @Date 22:08 2024/10/10
|
||||
* DBF数据导入
|
||||
**/
|
||||
@RequestMapping("dbfImport")
|
||||
@ApiOperation("DBF数据导入")
|
||||
public Result<?> DBFImport(@RequestBody JSONObject jsonObject) {
|
||||
byte[] fileBytes;
|
||||
String batch = jsonObject.getString("batch");
|
||||
String fileName = (String) jsonObject.get("fileName");
|
||||
String level = jsonObject.getString("level");
|
||||
String fileContent = jsonObject.getString("fileContent");
|
||||
try {
|
||||
// 移除 data URL 前缀
|
||||
String base64Data = fileContent.split(",")[1];
|
||||
fileBytes = Base64.getDecoder().decode(base64Data);
|
||||
} catch (Exception e) {
|
||||
return Result.error("文件解码失败");
|
||||
}
|
||||
MultipartFile file = new Base64DecodedMultipartFile(fileBytes, fileName);
|
||||
|
||||
return cetDataImport.readDBF(file, batch, level);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping("downloadTemplate")
|
||||
@ApiOperation("四六级导入数据文件模版")
|
||||
public Result<?> downloadTemplate(HttpServletResponse response) {
|
||||
return cetDataImport.downloadTemplate(response);
|
||||
}
|
||||
|
||||
// @RequestMapping("test")
|
||||
// @ApiOperation("DBF数据导入")
|
||||
// public Result<?> test() throws FileNotFoundException {
|
||||
// return cetDataImport.readDBF1();
|
||||
// }
|
||||
|
||||
}
|
|
@ -0,0 +1,201 @@
|
|||
package org.jeecg.modules.controller;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.modules.entity.CetGraduates;
|
||||
import org.jeecg.modules.service.ICetGraduatesService;
|
||||
import org.jeecg.modules.service.ICetInvigilateDataService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 研究生数据表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-06-11
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="研究生数据表")
|
||||
@RestController
|
||||
@RequestMapping("/cet/cetGraduates")
|
||||
@Slf4j
|
||||
public class CetGraduatesController extends JeecgController<CetGraduates, ICetGraduatesService> {
|
||||
@Autowired
|
||||
private ICetGraduatesService cetGraduatesService;
|
||||
@Autowired
|
||||
private ICetInvigilateDataService cetInvigilateDataService;
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param cetGraduates
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "研究生数据表-分页列表查询")
|
||||
@ApiOperation(value="研究生数据表-分页列表查询", notes="研究生数据表-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<CetGraduates>> queryPageList(CetGraduates cetGraduates,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<CetGraduates> queryWrapper = QueryGenerator.initQueryWrapper(cetGraduates, req.getParameterMap());
|
||||
Page<CetGraduates> page = new Page<CetGraduates>(pageNo, pageSize);
|
||||
IPage<CetGraduates> pageList = cetGraduatesService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param cetGraduates
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "研究生数据表-添加")
|
||||
@ApiOperation(value="研究生数据表-添加", notes="研究生数据表-添加")
|
||||
// @RequiresPermissions("cet:cet_graduates:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody CetGraduates cetGraduates) {
|
||||
return cetGraduatesService.add(cetGraduates);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param cetGraduates
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "研究生数据表-编辑")
|
||||
@ApiOperation(value="研究生数据表-编辑", notes="研究生数据表-编辑")
|
||||
@RequiresPermissions("cet:cet_graduates:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody CetGraduates cetGraduates) {
|
||||
cetGraduatesService.updateById(cetGraduates);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "研究生数据表-通过id删除")
|
||||
@ApiOperation(value="研究生数据表-通过id删除", notes="研究生数据表-通过id删除")
|
||||
@RequiresPermissions("cet:cet_graduates:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||
// 1. 查询研究生分表
|
||||
CetGraduates graduate = cetGraduatesService.lambdaQuery()
|
||||
.eq(CetGraduates::getId, id)
|
||||
.one();
|
||||
|
||||
if (graduate == null) {
|
||||
return Result.error("研究生数据不存在,无法删除!");
|
||||
}
|
||||
|
||||
try {
|
||||
// 2. 删除研究生分表记录
|
||||
cetGraduatesService.lambdaUpdate()
|
||||
.eq(CetGraduates::getId, id)
|
||||
.remove();
|
||||
|
||||
// 3. 删除总表记录
|
||||
cetInvigilateDataService.removeById(id);
|
||||
|
||||
return Result.OK("删除成功!");
|
||||
} catch (Exception e) {
|
||||
log.error("删除研究生及其总表数据异常,ID[{}]: {}", id, e.getMessage(), e);
|
||||
return Result.error("删除失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "研究生数据表-批量删除")
|
||||
@ApiOperation(value="研究生数据表-批量删除", notes="研究生数据表-批量删除")
|
||||
@RequiresPermissions("cet:cet_graduates:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
String[] idArray = ids.split(",");
|
||||
List<String> idList = Arrays.asList(idArray);
|
||||
|
||||
try {
|
||||
// 1. 删除研究生分表记录(graduate_id in ...)
|
||||
cetGraduatesService.lambdaUpdate()
|
||||
.in(CetGraduates::getId, idList)
|
||||
.remove();
|
||||
|
||||
// 2. 删除总表记录(主键id in ...)
|
||||
cetInvigilateDataService.removeByIds(idList);
|
||||
|
||||
return Result.OK("批量删除成功!");
|
||||
} catch (Exception e) {
|
||||
log.error("批量删除研究生及总表记录失败: {}", e.getMessage(), e);
|
||||
return Result.error("批量删除失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "研究生数据表-通过id查询")
|
||||
@ApiOperation(value="研究生数据表-通过id查询", notes="研究生数据表-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<CetGraduates> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
CetGraduates cetGraduates = cetGraduatesService.getById(id);
|
||||
if(cetGraduates==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(cetGraduates);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param cetGraduates
|
||||
*/
|
||||
@RequiresPermissions("cet:cet_graduates:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, CetGraduates cetGraduates) {
|
||||
return super.exportXls(request, cetGraduates, CetGraduates.class, "研究生数据表");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("cet:cet_graduates:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, CetGraduates.class);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,257 @@
|
|||
package org.jeecg.modules.controller;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.modules.entity.CetGroup;
|
||||
import org.jeecg.modules.entity.CetInvigilateData;
|
||||
import org.jeecg.modules.entity.ClassRoom;
|
||||
import org.jeecg.modules.service.ICetGroupService;
|
||||
import org.jeecg.modules.service.ICetInvigilateDataService;
|
||||
import org.jeecg.modules.service.IClassRoomService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
|
||||
/**
|
||||
* @Description: 分组数据表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-06-12
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="分组数据表")
|
||||
@RestController
|
||||
@RequestMapping("/cet/cetGroup")
|
||||
@Slf4j
|
||||
public class CetGroupController extends JeecgController<CetGroup, ICetGroupService> {
|
||||
@Autowired
|
||||
private ICetGroupService cetGroupService;
|
||||
@Autowired
|
||||
private ICetInvigilateDataService cetInvigilateDataService;
|
||||
@Autowired
|
||||
private IClassRoomService classRoomService;
|
||||
|
||||
/**
|
||||
* @param webData
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value="分配教室", notes="分配教室")
|
||||
@PostMapping(value = "/batchHandleClassRoom")
|
||||
public Result<?> batchHandleClassRooms(@RequestBody Map<String, Object> webData) {
|
||||
return cetGroupService.batchHandleClassRooms(webData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param cetGroup
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "分组数据表-分页列表查询")
|
||||
@ApiOperation(value="分组数据表-分页列表查询", notes="分组数据表-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<CetGroup>> queryPageList(CetGroup cetGroup,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<CetGroup> queryWrapper = QueryGenerator.initQueryWrapper(cetGroup, req.getParameterMap());
|
||||
Page<CetGroup> page = new Page<>(pageNo, pageSize);
|
||||
IPage<CetGroup> pageList = cetGroupService.page(page, queryWrapper);
|
||||
|
||||
// 获取当前页中所有 groupId 和 roomId
|
||||
Set<String> groupIds = new HashSet<>();
|
||||
Set<String> roomIds = new HashSet<>();
|
||||
|
||||
for (CetGroup group : pageList.getRecords()) {
|
||||
if (group.getId() != null) {
|
||||
groupIds.add(group.getId());
|
||||
}
|
||||
if (group.getRoomId() != null) {
|
||||
roomIds.add(group.getRoomId());
|
||||
}
|
||||
}
|
||||
|
||||
// 查询 invigilator 用户信息
|
||||
if (!groupIds.isEmpty()) {
|
||||
List<CetInvigilateData> userList = cetInvigilateDataService.list(
|
||||
new QueryWrapper<CetInvigilateData>().in("group_id", groupIds)
|
||||
);
|
||||
Map<String, List<String>> groupIdToUserNames = userList.stream()
|
||||
.collect(Collectors.groupingBy(CetInvigilateData::getGroupId,
|
||||
Collectors.mapping(CetInvigilateData::getName, Collectors.toList())));
|
||||
|
||||
// 查询 roomId -> roomName 映射
|
||||
Map<String, String> roomIdToName = new HashMap<>();
|
||||
if (!roomIds.isEmpty()) {
|
||||
List<ClassRoom> rooms = classRoomService.list(
|
||||
new QueryWrapper<ClassRoom>().in("id", roomIds)
|
||||
);
|
||||
roomIdToName = rooms.stream()
|
||||
.collect(Collectors.toMap(
|
||||
room -> String.valueOf(room.getId()),
|
||||
ClassRoom::getFullName // 或 .getName()
|
||||
));
|
||||
}
|
||||
|
||||
// 设置每条记录的 userNames 和 roomName
|
||||
for (CetGroup group : pageList.getRecords()) {
|
||||
String groupIdStr = String.valueOf(group.getId());
|
||||
List<String> names = groupIdToUserNames.get(groupIdStr);
|
||||
group.setRowUser((names != null && !names.isEmpty()) ? String.join(", ", names) : "");
|
||||
|
||||
String roomName = roomIdToName.get(String.valueOf(group.getRoomId()));
|
||||
group.setRoomName(roomName != null ? roomName : "");
|
||||
}
|
||||
}
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param cetGroup
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "分组数据表-添加")
|
||||
@ApiOperation(value="分组数据表-添加", notes="分组数据表-添加")
|
||||
@RequiresPermissions("cet:cet_group:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody CetGroup cetGroup) {
|
||||
cetGroupService.save(cetGroup);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param cetGroup
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "分组数据表-编辑")
|
||||
@ApiOperation(value="分组数据表-编辑", notes="分组数据表-编辑")
|
||||
@RequiresPermissions("cet:cet_group:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody CetGroup cetGroup) {
|
||||
cetGroupService.updateById(cetGroup);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "分组数据表-通过id删除")
|
||||
@ApiOperation(value="分组数据表-通过id删除", notes="分组数据表-通过id删除")
|
||||
@RequiresPermissions("cet:cet_group:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name="id", required=true) String id) {
|
||||
// 删除分组表中的分组
|
||||
cetGroupService.removeById(id);
|
||||
// 将数据总表对应groupId置空
|
||||
UpdateWrapper<CetInvigilateData> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.eq("group_id", id).set("group_id", null);
|
||||
cetInvigilateDataService.update(updateWrapper);
|
||||
// 清空 ClassRoom 中的 group_id,并将状态设为 0(空闲)
|
||||
UpdateWrapper<ClassRoom> roomUpdateWrapper = new UpdateWrapper<>();
|
||||
roomUpdateWrapper.eq("group_id", id)
|
||||
.set("group_id", null)
|
||||
.set("status", 0);
|
||||
classRoomService.update(roomUpdateWrapper);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "分组数据表-批量删除")
|
||||
@ApiOperation(value="分组数据表-批量删除", notes="分组数据表-批量删除")
|
||||
@RequiresPermissions("cet:cet_group:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids", required=true) String ids) {
|
||||
List<String> idList = Arrays.asList(ids.split(","));
|
||||
// 删除分组表中的分组
|
||||
cetGroupService.removeByIds(idList);
|
||||
|
||||
// 将数据总表对应groupId置空
|
||||
UpdateWrapper<CetInvigilateData> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.in("group_id", idList).set("group_id", null);
|
||||
cetInvigilateDataService.update(updateWrapper);
|
||||
// 清空 ClassRoom 中的 group_id,并将状态设为 0(空闲)
|
||||
UpdateWrapper<ClassRoom> roomUpdateWrapper = new UpdateWrapper<>();
|
||||
roomUpdateWrapper.in("group_id", idList)
|
||||
.set("group_id", null)
|
||||
.set("status", 0);
|
||||
classRoomService.update(roomUpdateWrapper);
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value="分组数据表-通过id查询", notes="分组数据表-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<CetGroup> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
CetGroup cetGroup = cetGroupService.getById(id);
|
||||
if(cetGroup==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(cetGroup);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param cetGroup
|
||||
*/
|
||||
@RequiresPermissions("cet:cet_group:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, CetGroup cetGroup) {
|
||||
return super.exportXls(request, cetGroup, CetGroup.class, "分组数据表");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("cet:cet_group:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, CetGroup.class);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,340 @@
|
|||
package org.jeecg.modules.controller;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.modules.entity.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.modules.service.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
|
||||
/**
|
||||
* @Description: 数据总表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-06-11
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="数据总表")
|
||||
@RestController
|
||||
@RequestMapping("/cet/cetInvigilateData")
|
||||
@Slf4j
|
||||
public class CetInvigilateDataController extends JeecgController<CetInvigilateData, ICetInvigilateDataService> {
|
||||
@Autowired
|
||||
private ICetInvigilateDataService cetInvigilateDataService;
|
||||
@Autowired
|
||||
private ICetTeachersService cetTeachersService;
|
||||
@Autowired
|
||||
private ICetGraduatesService cetGraduatesService;
|
||||
@Autowired
|
||||
private ICetNoTeachersService cetNoTeachersService;
|
||||
@Autowired
|
||||
private ICetGroupService cetGroupService;
|
||||
@Autowired
|
||||
private IClassRoomService classRoomService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 批量分组
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "分组")
|
||||
@ApiOperation(value="分组", notes="分组")
|
||||
@PostMapping(value = "/batchHandleGroup")
|
||||
public Result<String> batchHandleGroup(@RequestBody Map<String, Object> webData) {
|
||||
|
||||
return cetInvigilateDataService.batchHandleGroup(webData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param cetInvigilateData
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "数据总表-分页列表查询")
|
||||
@ApiOperation(value="数据总表-分页列表查询", notes="数据总表-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<CetInvigilateData>> queryPageList(CetInvigilateData cetInvigilateData,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<CetInvigilateData> queryWrapper = QueryGenerator.initQueryWrapper(cetInvigilateData, req.getParameterMap());
|
||||
Page<CetInvigilateData> page = new Page<CetInvigilateData>(pageNo, pageSize);
|
||||
IPage<CetInvigilateData> pageList = cetInvigilateDataService.page(page, queryWrapper);
|
||||
// 取所有分组ID(假设 groupId 是 String 类型,如果是 Long 请对应修改)
|
||||
Set<String> groupIds = pageList.getRecords().stream()
|
||||
.map(CetInvigilateData::getGroupId)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
if (!groupIds.isEmpty()) {
|
||||
// 批量查询分组信息
|
||||
List<CetGroup> groupList = cetGroupService.list(
|
||||
new QueryWrapper<CetGroup>().in("id", groupIds)
|
||||
);
|
||||
|
||||
// 转成 Map<groupId, groupName>
|
||||
Map<String, String> groupIdToName = groupList.stream()
|
||||
.collect(Collectors.toMap(CetGroup::getId, CetGroup::getGroupName));
|
||||
|
||||
// 给每条数据设置 groupName 字段(需保证 CetInvigilateData 有对应字段及setter)
|
||||
pageList.getRecords().forEach(item -> {
|
||||
String name = groupIdToName.get(item.getGroupId());
|
||||
item.setGroupName(name != null ? name : "");
|
||||
});
|
||||
}
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param cetInvigilateData
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "数据总表-添加")
|
||||
@ApiOperation(value="数据总表-添加", notes="数据总表-添加")
|
||||
@RequiresPermissions("cet:cet_invigilate_data:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody CetInvigilateData cetInvigilateData) {
|
||||
|
||||
return cetInvigilateDataService.add(cetInvigilateData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param cetInvigilateData
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "数据总表-编辑")
|
||||
@ApiOperation(value="数据总表-编辑", notes="数据总表-编辑")
|
||||
@RequiresPermissions("cet:cet_invigilate_data:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody CetInvigilateData cetInvigilateData) {
|
||||
cetInvigilateDataService.updateById(cetInvigilateData);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "数据总表-通过id删除")
|
||||
@ApiOperation(value="数据总表-通过id删除", notes="数据总表-通过id删除")
|
||||
@RequiresPermissions("cet:cet_invigilate_data:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
// 1. 查询总表记录,获取类型
|
||||
CetInvigilateData data = cetInvigilateDataService.getById(id);
|
||||
if (data == null) {
|
||||
return Result.error("数据不存在,无法删除!");
|
||||
}
|
||||
|
||||
String type = data.getType();
|
||||
try {
|
||||
// 2. 根据类型删除对应的分表记录
|
||||
switch (type) {
|
||||
case "教师":
|
||||
cetTeachersService.lambdaUpdate()
|
||||
.eq(CetTeachers::getId, id)
|
||||
.remove();
|
||||
break;
|
||||
case "研究生":
|
||||
cetGraduatesService.lambdaUpdate()
|
||||
.eq(CetGraduates::getId, id)
|
||||
.remove();
|
||||
break;
|
||||
case "非教师":
|
||||
cetNoTeachersService.lambdaUpdate()
|
||||
.eq(CetNoTeachers::getId, id)
|
||||
.remove();
|
||||
break;
|
||||
default:
|
||||
return Result.error("未知类型,无法删除关联数据!");
|
||||
}
|
||||
|
||||
// 3. 删除总表记录
|
||||
cetInvigilateDataService.removeById(id);
|
||||
|
||||
return Result.OK("删除成功!");
|
||||
} catch (Exception e) {
|
||||
log.error("删除人员数据异常 ID[{}] 类型[{}]: {}", id, type, e.getMessage(), e);
|
||||
return Result.error("删除失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "数据总表-批量删除")
|
||||
@ApiOperation(value="数据总表-批量删除", notes="数据总表-批量删除")
|
||||
@RequiresPermissions("cet:cet_invigilate_data:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
String[] idArray = ids.split(",");
|
||||
List<String> successIds = new ArrayList<>();
|
||||
List<String> failedIds = new ArrayList<>();
|
||||
|
||||
for (String id : idArray) {
|
||||
// 1. 查询总表记录
|
||||
CetInvigilateData data = cetInvigilateDataService.getById(id);
|
||||
if (data == null) {
|
||||
failedIds.add(id + "(数据不存在)");
|
||||
continue;
|
||||
}
|
||||
|
||||
String type = data.getType();
|
||||
try {
|
||||
// 2. 删除对应分表记录
|
||||
switch (type) {
|
||||
case "教师":
|
||||
cetTeachersService.lambdaUpdate()
|
||||
.eq(CetTeachers::getId, id)
|
||||
.remove();
|
||||
break;
|
||||
case "研究生":
|
||||
cetGraduatesService.lambdaUpdate()
|
||||
.eq(CetGraduates::getId, id)
|
||||
.remove();
|
||||
break;
|
||||
case "非教师":
|
||||
cetNoTeachersService.lambdaUpdate()
|
||||
.eq(CetNoTeachers::getId, id)
|
||||
.remove();
|
||||
break;
|
||||
default:
|
||||
failedIds.add(id + "(未知类型:" + type + ")");
|
||||
continue;
|
||||
}
|
||||
|
||||
// 3. 删除总表记录
|
||||
cetInvigilateDataService.removeById(id);
|
||||
successIds.add(id);
|
||||
} catch (Exception e) {
|
||||
log.error("删除异常,ID[{}] 类型[{}]: {}", id, type, e.getMessage(), e);
|
||||
failedIds.add(id + "(异常: " + e.getMessage() + ")");
|
||||
}
|
||||
}
|
||||
|
||||
if (failedIds.isEmpty()) {
|
||||
return Result.OK("批量删除成功,共删除 " + successIds.size() + " 条数据!");
|
||||
} else {
|
||||
return Result.error("部分删除失败!成功 " + successIds.size() + " 条,失败 " + failedIds.size()
|
||||
+ " 条:\n" + String.join(", ", failedIds));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "数据总表-通过id查询")
|
||||
@ApiOperation(value="数据总表-通过id查询", notes="数据总表-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<CetInvigilateData> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
CetInvigilateData cetInvigilateData = cetInvigilateDataService.getById(id);
|
||||
if(cetInvigilateData==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(cetInvigilateData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param cetInvigilateData
|
||||
*/
|
||||
@RequiresPermissions("cet:cet_invigilate_data:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, CetInvigilateData cetInvigilateData) {
|
||||
// 1. 获取查询参数后的数据列表
|
||||
List<CetInvigilateData> dataList = cetInvigilateDataService.list(
|
||||
QueryGenerator.initQueryWrapper(cetInvigilateData, request.getParameterMap())
|
||||
);
|
||||
|
||||
// 2. 获取所有涉及的 groupId
|
||||
Set<String> groupIds = dataList.stream()
|
||||
.map(CetInvigilateData::getGroupId)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
// 3. 查询所有 groupId -> roomId 的映射
|
||||
Map<String, String> groupIdToRoomId = new HashMap<>();
|
||||
if (!groupIds.isEmpty()) {
|
||||
List<CetGroup> groups = cetGroupService.list(
|
||||
new QueryWrapper<CetGroup>().in("id", groupIds)
|
||||
);
|
||||
groupIdToRoomId = groups.stream()
|
||||
.filter(g -> g.getRoomId() != null)
|
||||
.collect(Collectors.toMap(CetGroup::getId, CetGroup::getRoomId));
|
||||
}
|
||||
|
||||
// 4. 查询所有 roomId -> roomName 的映射
|
||||
Set<String> roomIds = new HashSet<>(groupIdToRoomId.values());
|
||||
Map<String, String> roomIdToName = new HashMap<>();
|
||||
if (!roomIds.isEmpty()) {
|
||||
List<ClassRoom> rooms = classRoomService.list(
|
||||
new QueryWrapper<ClassRoom>().in("id", roomIds)
|
||||
);
|
||||
roomIdToName = rooms.stream()
|
||||
.collect(Collectors.toMap(ClassRoom::getId, ClassRoom::getFullName));
|
||||
}
|
||||
|
||||
// 5. 给每条数据填充 roomName 字段
|
||||
for (CetInvigilateData item : dataList) {
|
||||
String groupId = item.getGroupId();
|
||||
String roomId = groupIdToRoomId.get(groupId);
|
||||
String roomName = roomIdToName.get(roomId);
|
||||
item.setRoomName(roomName != null ? roomName : "");
|
||||
}
|
||||
|
||||
// 6. 执行导出(手动指定导出数据)
|
||||
return super.exportXlsByList(dataList, CetInvigilateData.class, "数据总表");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("cet:cet_invigilate_data:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, CetInvigilateData.class);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,203 @@
|
|||
package org.jeecg.modules.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.modules.entity.CetGraduates;
|
||||
import org.jeecg.modules.entity.CetNoTeachers;
|
||||
import org.jeecg.modules.service.ICetInvigilateDataService;
|
||||
import org.jeecg.modules.service.ICetNoTeachersService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
|
||||
/**
|
||||
* @Description: 非教师数据表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-06-11
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="非教师数据表")
|
||||
@RestController
|
||||
@RequestMapping("/cet/cetNoTeachers")
|
||||
@Slf4j
|
||||
public class CetNoTeachersController extends JeecgController<CetNoTeachers, ICetNoTeachersService> {
|
||||
@Autowired
|
||||
private ICetNoTeachersService cetNoTeachersService;
|
||||
@Autowired
|
||||
private ICetInvigilateDataService cetInvigilateDataService;
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param cetNoTeachers
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "非教师数据表-分页列表查询")
|
||||
@ApiOperation(value="非教师数据表-分页列表查询", notes="非教师数据表-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<CetNoTeachers>> queryPageList(CetNoTeachers cetNoTeachers,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<CetNoTeachers> queryWrapper = QueryGenerator.initQueryWrapper(cetNoTeachers, req.getParameterMap());
|
||||
Page<CetNoTeachers> page = new Page<CetNoTeachers>(pageNo, pageSize);
|
||||
IPage<CetNoTeachers> pageList = cetNoTeachersService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param cetNoTeachers
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "非教师数据表-添加")
|
||||
@ApiOperation(value="非教师数据表-添加", notes="非教师数据表-添加")
|
||||
// @RequiresPermissions("cet:cet_no_teachers:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody CetNoTeachers cetNoTeachers) {
|
||||
|
||||
return cetNoTeachersService.add(cetNoTeachers);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param cetNoTeachers
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "非教师数据表-编辑")
|
||||
@ApiOperation(value="非教师数据表-编辑", notes="非教师数据表-编辑")
|
||||
@RequiresPermissions("cet:cet_no_teachers:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody CetNoTeachers cetNoTeachers) {
|
||||
cetNoTeachersService.updateById(cetNoTeachers);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "非教师数据表-通过id删除")
|
||||
@ApiOperation(value="非教师数据表-通过id删除", notes="非教师数据表-通过id删除")
|
||||
@RequiresPermissions("cet:cet_no_teachers:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||
// 1. 查询研究生分表
|
||||
CetNoTeachers nonTeachers = cetNoTeachersService.lambdaQuery()
|
||||
.eq(CetNoTeachers::getId, id)
|
||||
.one();
|
||||
|
||||
if (nonTeachers == null) {
|
||||
return Result.error("研究生数据不存在,无法删除!");
|
||||
}
|
||||
|
||||
try {
|
||||
// 2. 删除研究生分表记录
|
||||
cetNoTeachersService.lambdaUpdate()
|
||||
.eq(CetNoTeachers::getId, id)
|
||||
.remove();
|
||||
|
||||
// 3. 删除总表记录
|
||||
cetInvigilateDataService.removeById(id);
|
||||
|
||||
return Result.OK("删除成功!");
|
||||
} catch (Exception e) {
|
||||
log.error("删除研究生及其总表数据异常,ID[{}]: {}", id, e.getMessage(), e);
|
||||
return Result.error("删除失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "非教师数据表-批量删除")
|
||||
@ApiOperation(value="非教师数据表-批量删除", notes="非教师数据表-批量删除")
|
||||
@RequiresPermissions("cet:cet_no_teachers:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
String[] idArray = ids.split(",");
|
||||
List<String> idList = Arrays.asList(idArray);
|
||||
|
||||
try {
|
||||
// 1. 删除研究生分表记录(graduate_id in ...)
|
||||
cetNoTeachersService.lambdaUpdate()
|
||||
.in(CetNoTeachers::getId, idList)
|
||||
.remove();
|
||||
|
||||
// 2. 删除总表记录(主键id in ...)
|
||||
cetInvigilateDataService.removeByIds(idList);
|
||||
|
||||
return Result.OK("批量删除成功!");
|
||||
} catch (Exception e) {
|
||||
log.error("批量删除研究生及总表记录失败: {}", e.getMessage(), e);
|
||||
return Result.error("批量删除失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "非教师数据表-通过id查询")
|
||||
@ApiOperation(value="非教师数据表-通过id查询", notes="非教师数据表-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<CetNoTeachers> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
CetNoTeachers cetNoTeachers = cetNoTeachersService.getById(id);
|
||||
if(cetNoTeachers==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(cetNoTeachers);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param cetNoTeachers
|
||||
*/
|
||||
@RequiresPermissions("cet:cet_no_teachers:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, CetNoTeachers cetNoTeachers) {
|
||||
return super.exportXls(request, cetNoTeachers, CetNoTeachers.class, "非教师数据表");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("cet:cet_no_teachers:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, CetNoTeachers.class);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,206 @@
|
|||
package org.jeecg.modules.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.modules.entity.CetGraduates;
|
||||
import org.jeecg.modules.entity.CetTeachers;
|
||||
import org.jeecg.modules.service.ICetInvigilateDataService;
|
||||
import org.jeecg.modules.service.ICetTeachersService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
|
||||
/**
|
||||
* @Description: 教师数据表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-06-11
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="教师数据表")
|
||||
@RestController
|
||||
@RequestMapping("/cet/cetTeachers")
|
||||
@Slf4j
|
||||
public class CetTeachersController extends JeecgController<CetTeachers, ICetTeachersService> {
|
||||
@Autowired
|
||||
private ICetTeachersService cetTeachersService;
|
||||
@Autowired
|
||||
private ICetInvigilateDataService cetInvigilateDataService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param cetTeachers
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "教师数据表-分页列表查询")
|
||||
@ApiOperation(value="教师数据表-分页列表查询", notes="教师数据表-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<CetTeachers>> queryPageList(CetTeachers cetTeachers,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<CetTeachers> queryWrapper = QueryGenerator.initQueryWrapper(cetTeachers, req.getParameterMap());
|
||||
Page<CetTeachers> page = new Page<CetTeachers>(pageNo, pageSize);
|
||||
IPage<CetTeachers> pageList = cetTeachersService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param cetTeachers
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "教师数据表-添加")
|
||||
@ApiOperation(value="教师数据表-添加", notes="教师数据表-添加")
|
||||
@RequiresPermissions("data:cet_teachers:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody CetTeachers cetTeachers) {
|
||||
|
||||
return cetTeachersService.add(cetTeachers);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param cetTeachers
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "教师数据表-编辑")
|
||||
@ApiOperation(value="教师数据表-编辑", notes="教师数据表-编辑")
|
||||
@RequiresPermissions("data:cet_teachers:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody CetTeachers cetTeachers) {
|
||||
cetTeachersService.updateById(cetTeachers);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "教师数据表-通过id删除")
|
||||
@ApiOperation(value="教师数据表-通过id删除", notes="教师数据表-通过id删除")
|
||||
@RequiresPermissions("data:cet_teachers:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||
|
||||
// 1. 查询研究生分表
|
||||
CetTeachers teachers = cetTeachersService.lambdaQuery()
|
||||
.eq(CetTeachers::getId, id)
|
||||
.one();
|
||||
|
||||
if (teachers == null) {
|
||||
return Result.error("研究生数据不存在,无法删除!");
|
||||
}
|
||||
|
||||
try {
|
||||
// 2. 删除研究生分表记录
|
||||
cetTeachersService.lambdaUpdate()
|
||||
.eq(CetTeachers::getId, id)
|
||||
.remove();
|
||||
|
||||
// 3. 删除总表记录
|
||||
cetInvigilateDataService.removeById(id);
|
||||
|
||||
return Result.OK("删除成功!");
|
||||
} catch (Exception e) {
|
||||
log.error("删除研究生及其总表数据异常,ID[{}]: {}", id, e.getMessage(), e);
|
||||
return Result.error("删除失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "教师数据表-批量删除")
|
||||
@ApiOperation(value="教师数据表-批量删除", notes="教师数据表-批量删除")
|
||||
@RequiresPermissions("data:cet_teachers:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
String[] idArray = ids.split(",");
|
||||
List<String> idList = Arrays.asList(idArray);
|
||||
|
||||
try {
|
||||
// 1. 删除研究生分表记录(graduate_id in ...)
|
||||
cetTeachersService.lambdaUpdate()
|
||||
.in(CetTeachers::getId, idList)
|
||||
.remove();
|
||||
|
||||
// 2. 删除总表记录(主键id in ...)
|
||||
cetInvigilateDataService.removeByIds(idList);
|
||||
|
||||
return Result.OK("批量删除成功!");
|
||||
} catch (Exception e) {
|
||||
log.error("批量删除研究生及总表记录失败: {}", e.getMessage(), e);
|
||||
return Result.error("批量删除失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "教师数据表-通过id查询")
|
||||
@ApiOperation(value="教师数据表-通过id查询", notes="教师数据表-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<CetTeachers> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
CetTeachers cetTeachers = cetTeachersService.getById(id);
|
||||
if(cetTeachers==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(cetTeachers);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param cetTeachers
|
||||
*/
|
||||
@RequiresPermissions("data:cet_teachers:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, CetTeachers cetTeachers) {
|
||||
return super.exportXls(request, cetTeachers, CetTeachers.class, "教师数据表");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("data:cet_teachers:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, CetTeachers.class);
|
||||
}
|
||||
|
||||
}
|
|
@ -25,128 +25,126 @@ import io.swagger.annotations.ApiOperation;
|
|||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
|
||||
/**
|
||||
/**
|
||||
* @Description: cet_4
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-03-26
|
||||
* @Date: 2024-03-26
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="cet_4")
|
||||
@Api(tags = "cet_4")
|
||||
@RestController
|
||||
@RequestMapping("/cet_4")
|
||||
@Slf4j
|
||||
public class Cet_4Controller extends JeecgController<Cet_4, ICet_4Service> {
|
||||
@Autowired
|
||||
private ICet_4Service cet_4Service;
|
||||
@Autowired
|
||||
private ICet_4Service cet_4Service;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param cet_4
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "cet_4-分页列表查询")
|
||||
@ApiOperation(value="cet_4-分页列表查询", notes="cet_4-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<Cet_4>> queryPageList(Cet_4 cet_4,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<Cet_4> queryWrapper = QueryGenerator.initQueryWrapper(cet_4, req.getParameterMap());
|
||||
Page<Cet_4> page = new Page<Cet_4>(pageNo, pageSize);
|
||||
IPage<Cet_4> pageList = cet_4Service.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param cet_4
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "cet_4-添加")
|
||||
@ApiOperation(value="cet_4-添加", notes="cet_4-添加")
|
||||
@RequiresPermissions("cet:cet_4:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody Cet_4 cet_4) {
|
||||
cet_4Service.save(cet_4);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param cet_4
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "cet_4-编辑")
|
||||
@ApiOperation(value="cet_4-编辑", notes="cet_4-编辑")
|
||||
@RequiresPermissions("cet:cet_4:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody Cet_4 cet_4) {
|
||||
cet_4Service.updateById(cet_4);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "cet_4-通过id删除")
|
||||
@ApiOperation(value="cet_4-通过id删除", notes="cet_4-通过id删除")
|
||||
@RequiresPermissions("cet:cet_4:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||
cet_4Service.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "cet_4-批量删除")
|
||||
@ApiOperation(value="cet_4-批量删除", notes="cet_4-批量删除")
|
||||
@RequiresPermissions("cet:cet_4:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.cet_4Service.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "cet_4-通过id查询")
|
||||
@ApiOperation(value="cet_4-通过id查询", notes="cet_4-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<Cet_4> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
Cet_4 cet_4 = cet_4Service.getById(id);
|
||||
if(cet_4==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(cet_4);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param cet_4
|
||||
*/
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param cet_4
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "cet_4-分页列表查询")
|
||||
@ApiOperation(value = "cet_4-分页列表查询", notes = "cet_4-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<Cet_4>> queryPageList(Cet_4 cet_4,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<Cet_4> queryWrapper = QueryGenerator.initQueryWrapper(cet_4, req.getParameterMap());
|
||||
Page<Cet_4> page = new Page<Cet_4>(pageNo, pageSize);
|
||||
IPage<Cet_4> pageList = cet_4Service.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param cet_4
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "cet_4-添加")
|
||||
@ApiOperation(value = "cet_4-添加", notes = "cet_4-添加")
|
||||
@RequiresPermissions("cet:cet_4:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody Cet_4 cet_4) {
|
||||
cet_4Service.save(cet_4);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param cet_4
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "cet_4-编辑")
|
||||
@ApiOperation(value = "cet_4-编辑", notes = "cet_4-编辑")
|
||||
@RequiresPermissions("cet:cet_4:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody Cet_4 cet_4) {
|
||||
cet_4Service.updateById(cet_4);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "cet_4-通过id删除")
|
||||
@ApiOperation(value = "cet_4-通过id删除", notes = "cet_4-通过id删除")
|
||||
@RequiresPermissions("cet:cet_4:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
cet_4Service.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "cet_4-批量删除")
|
||||
@ApiOperation(value = "cet_4-批量删除", notes = "cet_4-批量删除")
|
||||
@RequiresPermissions("cet:cet_4:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
this.cet_4Service.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "cet_4-通过id查询")
|
||||
@ApiOperation(value = "cet_4-通过id查询", notes = "cet_4-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<Cet_4> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
Cet_4 cet_4 = cet_4Service.getById(id);
|
||||
if (cet_4 == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(cet_4);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param cet_4
|
||||
*/
|
||||
@RequiresPermissions("cet:cet_4:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, Cet_4 cet_4) {
|
||||
|
@ -154,24 +152,34 @@ public class Cet_4Controller extends JeecgController<Cet_4, ICet_4Service> {
|
|||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("cet:cet_4:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, Cet_4.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 依据学生id和姓名获取四级成绩
|
||||
*/
|
||||
@RequestMapping("/getDataByStudent")
|
||||
public Result<JSONObject> getDataByStudent(@RequestBody JSONObject jsonObject){
|
||||
return cet_4Service.getDataByStudent(jsonObject);
|
||||
}
|
||||
/**
|
||||
* 依据学生id和姓名获取四级成绩
|
||||
*/
|
||||
@RequestMapping("/getDataByStudent")
|
||||
public Result<JSONObject> getDataByStudent(@RequestBody JSONObject jsonObject) {
|
||||
return cet_4Service.getDataByStudent(jsonObject);
|
||||
}
|
||||
|
||||
@RequestMapping("loadImportDataList")
|
||||
public Result<JSONObject> loadImportDataList() {
|
||||
return cet_4Service.loadImportDataList();
|
||||
}
|
||||
@RequestMapping("analyze")
|
||||
public Result<JSONObject> analyze(@RequestBody JSONObject webData) {
|
||||
return cet_4Service.getAnalyze(webData);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@ package org.jeecg.modules.controller;
|
|||
import java.util.Arrays;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.modules.entity.Cet_6;
|
||||
|
@ -22,125 +24,125 @@ import io.swagger.annotations.ApiOperation;
|
|||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
|
||||
/**
|
||||
/**
|
||||
* @Description: cet_6
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-03-26
|
||||
* @Date: 2024-03-26
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="cet_6")
|
||||
@Api(tags = "cet_6")
|
||||
@RestController
|
||||
@RequestMapping("/cet_6")
|
||||
@Slf4j
|
||||
public class Cet_6Controller extends JeecgController<Cet_6, ICet_6Service> {
|
||||
@Autowired
|
||||
private ICet_6Service cet_6Service;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param cet_6
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "cet_6-分页列表查询")
|
||||
@ApiOperation(value="cet_6-分页列表查询", notes="cet_6-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<Cet_6>> queryPageList(Cet_6 cet_6,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<Cet_6> queryWrapper = QueryGenerator.initQueryWrapper(cet_6, req.getParameterMap());
|
||||
Page<Cet_6> page = new Page<Cet_6>(pageNo, pageSize);
|
||||
IPage<Cet_6> pageList = cet_6Service.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param cet_6
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "cet_6-添加")
|
||||
@ApiOperation(value="cet_6-添加", notes="cet_6-添加")
|
||||
@RequiresPermissions("cet:cet_6:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody Cet_6 cet_6) {
|
||||
cet_6Service.save(cet_6);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param cet_6
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "cet_6-编辑")
|
||||
@ApiOperation(value="cet_6-编辑", notes="cet_6-编辑")
|
||||
@RequiresPermissions("cet:cet_6:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody Cet_6 cet_6) {
|
||||
cet_6Service.updateById(cet_6);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "cet_6-通过id删除")
|
||||
@ApiOperation(value="cet_6-通过id删除", notes="cet_6-通过id删除")
|
||||
@RequiresPermissions("cet:cet_6:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||
cet_6Service.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "cet_6-批量删除")
|
||||
@ApiOperation(value="cet_6-批量删除", notes="cet_6-批量删除")
|
||||
@RequiresPermissions("cet:cet_6:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.cet_6Service.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "cet_6-通过id查询")
|
||||
@ApiOperation(value="cet_6-通过id查询", notes="cet_6-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<Cet_6> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
Cet_6 cet_6 = cet_6Service.getById(id);
|
||||
if(cet_6==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(cet_6);
|
||||
}
|
||||
@Autowired
|
||||
private ICet_6Service cet_6Service;
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param cet_6
|
||||
*/
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param cet_6
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "cet_6-分页列表查询")
|
||||
@ApiOperation(value = "cet_6-分页列表查询", notes = "cet_6-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<Cet_6>> queryPageList(Cet_6 cet_6,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<Cet_6> queryWrapper = QueryGenerator.initQueryWrapper(cet_6, req.getParameterMap());
|
||||
Page<Cet_6> page = new Page<Cet_6>(pageNo, pageSize);
|
||||
IPage<Cet_6> pageList = cet_6Service.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param cet_6
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "cet_6-添加")
|
||||
@ApiOperation(value = "cet_6-添加", notes = "cet_6-添加")
|
||||
@RequiresPermissions("cet:cet_6:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody Cet_6 cet_6) {
|
||||
cet_6Service.save(cet_6);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param cet_6
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "cet_6-编辑")
|
||||
@ApiOperation(value = "cet_6-编辑", notes = "cet_6-编辑")
|
||||
@RequiresPermissions("cet:cet_6:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody Cet_6 cet_6) {
|
||||
cet_6Service.updateById(cet_6);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "cet_6-通过id删除")
|
||||
@ApiOperation(value = "cet_6-通过id删除", notes = "cet_6-通过id删除")
|
||||
@RequiresPermissions("cet:cet_6:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
cet_6Service.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "cet_6-批量删除")
|
||||
@ApiOperation(value = "cet_6-批量删除", notes = "cet_6-批量删除")
|
||||
@RequiresPermissions("cet:cet_6:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
this.cet_6Service.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "cet_6-通过id查询")
|
||||
@ApiOperation(value = "cet_6-通过id查询", notes = "cet_6-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<Cet_6> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
Cet_6 cet_6 = cet_6Service.getById(id);
|
||||
if (cet_6 == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(cet_6);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param cet_6
|
||||
*/
|
||||
@RequiresPermissions("cet:cet_6:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, Cet_6 cet_6) {
|
||||
|
@ -148,16 +150,27 @@ public class Cet_6Controller extends JeecgController<Cet_6, ICet_6Service> {
|
|||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("cet:cet_6:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, Cet_6.class);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping("getRate")
|
||||
public Result<?> getRate() {
|
||||
return cet_6Service.getGrateRate();
|
||||
}
|
||||
|
||||
@RequestMapping("loadImportDataList")
|
||||
public Result<JSONObject> loadImportDataList() {
|
||||
return cet_6Service.loadImportDataList();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,167 @@
|
|||
package org.jeecg.modules.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.modules.entity.ClassRoom;
|
||||
import org.jeecg.modules.service.IClassRoomService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
|
||||
/**
|
||||
* @Description: 教室表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-06-11
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="教室表")
|
||||
@RestController
|
||||
@RequestMapping("/cet/classRoom")
|
||||
@Slf4j
|
||||
public class ClassRoomController extends JeecgController<ClassRoom, IClassRoomService> {
|
||||
@Autowired
|
||||
private IClassRoomService classRoomService;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param classRoom
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "教室表-分页列表查询")
|
||||
@ApiOperation(value="教室表-分页列表查询", notes="教室表-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<ClassRoom>> queryPageList(ClassRoom classRoom,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<ClassRoom> queryWrapper = QueryGenerator.initQueryWrapper(classRoom, req.getParameterMap());
|
||||
Page<ClassRoom> page = new Page<ClassRoom>(pageNo, pageSize);
|
||||
IPage<ClassRoom> pageList = classRoomService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param classRoom
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "教室表-添加")
|
||||
@ApiOperation(value="教室表-添加", notes="教室表-添加")
|
||||
@RequiresPermissions("cet:class_room:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody ClassRoom classRoom) {
|
||||
return classRoomService.add(classRoom);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param classRoom
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "教室表-编辑")
|
||||
@ApiOperation(value="教室表-编辑", notes="教室表-编辑")
|
||||
@RequiresPermissions("cet:class_room:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody ClassRoom classRoom) {
|
||||
classRoomService.updateById(classRoom);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "教室表-通过id删除")
|
||||
@ApiOperation(value="教室表-通过id删除", notes="教室表-通过id删除")
|
||||
@RequiresPermissions("cet:class_room:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||
classRoomService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "教室表-批量删除")
|
||||
@ApiOperation(value="教室表-批量删除", notes="教室表-批量删除")
|
||||
@RequiresPermissions("cet:class_room:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.classRoomService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "教室表-通过id查询")
|
||||
@ApiOperation(value="教室表-通过id查询", notes="教室表-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<ClassRoom> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
ClassRoom classRoom = classRoomService.getById(id);
|
||||
if(classRoom==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(classRoom);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param classRoom
|
||||
*/
|
||||
@RequiresPermissions("cet:class_room:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, ClassRoom classRoom) {
|
||||
return super.exportXls(request, classRoom, ClassRoom.class, "教室表");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("cet:class_room:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, ClassRoom.class);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package org.jeecg.modules.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@ApiModel(value = "根据专业获取每个年级最新批次的通过率")
|
||||
@Data
|
||||
public class getRateByEntryDateDto {
|
||||
// @ApiModelProperty(value = "年级")
|
||||
// @NotBlank
|
||||
// String entrydate;
|
||||
|
||||
@ApiModelProperty(value = "学院")
|
||||
@NotBlank
|
||||
private String college;
|
||||
|
||||
@ApiModelProperty(value = "专业")
|
||||
private String major;
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package org.jeecg.modules.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author NanYu
|
||||
* @date 2024/10/13
|
||||
*/
|
||||
@ApiModel(value = "根据专业获取每个年级最新批次的通过率")
|
||||
@Data
|
||||
public class getRateByMajorAndLastestBatchDto implements Serializable {
|
||||
@ApiModelProperty(value = "学院")
|
||||
@NotBlank
|
||||
private String college;
|
||||
|
||||
@ApiModelProperty(value = "专业")
|
||||
private String major;
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
package org.jeecg.modules.entity;
|
||||
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecg.modules.anno.AttributeName;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "cet_english对象", description = "四六级英语")
|
||||
public class CET implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@AttributeName(4)
|
||||
@ApiModelProperty(value = "学生姓名")
|
||||
private String name;
|
||||
@AttributeName(11)
|
||||
@ApiModelProperty(value = "学生所在学院")
|
||||
private String college;
|
||||
@AttributeName(15)
|
||||
@ApiModelProperty(value = "学生成绩")
|
||||
private Integer result;
|
||||
@AttributeName(19)
|
||||
@ApiModelProperty(value = "学生学号")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "考试批次")
|
||||
private Date batch;
|
||||
@ApiModelProperty(value = "学生入学时间")
|
||||
private String entrydate;
|
||||
@AttributeName(12)
|
||||
@ApiModelProperty(value = "学生听力成绩")
|
||||
private Integer listen;
|
||||
@AttributeName(13)
|
||||
@ApiModelProperty(value = "阅读成绩")
|
||||
private Integer reading;
|
||||
@AttributeName(14)
|
||||
@ApiModelProperty(value = "写作成绩")
|
||||
private Integer writing;
|
||||
|
||||
}
|
|
@ -1,22 +1,78 @@
|
|||
package org.jeecg.modules.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Description: cet4_major
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-10-23
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("cet4_major")
|
||||
public class Cet4_major {
|
||||
private String id;
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="cet4_major对象", description="cet4_major")
|
||||
public class Cet4_major implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**id*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Excel(name = "学号", width = 15)
|
||||
@ApiModelProperty(value = "id")
|
||||
private String code;
|
||||
/**name*/
|
||||
@Excel(name = "姓名", width = 15)
|
||||
@ApiModelProperty(value = "name")
|
||||
private String name;
|
||||
/**college*/
|
||||
@Excel(name = "上课院系", width = 15)
|
||||
@ApiModelProperty(value = "college")
|
||||
private String college;
|
||||
private String major_id;
|
||||
/**majorId*/
|
||||
@Excel(name = "专业号", width = 15)
|
||||
@ApiModelProperty(value = "majorId")
|
||||
private String majorId;
|
||||
/**majorname*/
|
||||
@Excel(name = "专业名称", width = 15)
|
||||
@ApiModelProperty(value = "majorname")
|
||||
private String majorname;
|
||||
private String class_name;
|
||||
/**className*/
|
||||
@Excel(name = "班级", width = 15)
|
||||
@ApiModelProperty(value = "className")
|
||||
private String className;
|
||||
/**educate*/
|
||||
@Excel(name = "学制", width = 15)
|
||||
@ApiModelProperty(value = "educate")
|
||||
private String educate;
|
||||
/**entrydate*/
|
||||
@Excel(name = "当前所在级", width = 15)
|
||||
@ApiModelProperty(value = "entrydate")
|
||||
private String entrydate;
|
||||
/**campus*/
|
||||
@Excel(name = "校区", width = 15)
|
||||
@ApiModelProperty(value = "campus")
|
||||
private String campus;
|
||||
/**state*/
|
||||
@Excel(name = "在校状态", width = 15)
|
||||
@ApiModelProperty(value = "state")
|
||||
private String state;
|
||||
/**level*/
|
||||
@Excel(name = "培养层次", width = 15)
|
||||
@ApiModelProperty(value = "level")
|
||||
private String level;
|
||||
/**category*/
|
||||
@Excel(name = "学生类别", width = 15)
|
||||
@ApiModelProperty(value = "category")
|
||||
private String category;
|
||||
}
|
||||
|
|
|
@ -13,11 +13,11 @@ import lombok.experimental.Accessors;
|
|||
* @Date: 2024/09/09/20:45
|
||||
* @Description:
|
||||
*/
|
||||
@TableName("cet_4_20240907")
|
||||
@TableName("cet_6_copy1")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="cet_4数据清洗实体类", description="仅用作cet_4数据清洗")
|
||||
@ApiModel(value="cet数据清洗实体类", description="仅用作cet数据清洗")
|
||||
public class CetClean extends Cet_4 {
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,91 @@
|
|||
package org.jeecg.modules.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Description: 研究生数据表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-06-11
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("cet_graduates")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="cet_graduates对象", description="研究生数据表")
|
||||
public class CetGraduates implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String Id ;
|
||||
/**学号*/
|
||||
@Excel(name = "学号", width = 15)
|
||||
@ApiModelProperty(value = "学号")
|
||||
private String studentNumber;
|
||||
/**教师姓名*/
|
||||
@Excel(name = "教师姓名", width = 15)
|
||||
@ApiModelProperty(value = "教师姓名")
|
||||
private String graduatesName;
|
||||
/**年龄*/
|
||||
@Excel(name = "年龄", width = 15)
|
||||
@ApiModelProperty(value = "年龄")
|
||||
private String age;
|
||||
/**性别*/
|
||||
@Excel(name = "性别", width = 15)
|
||||
@ApiModelProperty(value = "性别")
|
||||
private String sex;
|
||||
/**校区*/
|
||||
@Excel(name = "校区", width = 15)
|
||||
@ApiModelProperty(value = "校区")
|
||||
private String campus;
|
||||
/**校区*/
|
||||
@Excel(name = "学院", width = 15)
|
||||
@ApiModelProperty(value = "学院")
|
||||
private String college;
|
||||
/**照片地址*/
|
||||
@Excel(name = "照片地址", width = 15)
|
||||
@ApiModelProperty(value = "照片地址")
|
||||
private String photoAddress;
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private Date createTime;
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String updateBy;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private Date updateTime;
|
||||
/**所属部门*/
|
||||
@ApiModelProperty(value = "所属部门")
|
||||
private String sysOrgCode;
|
||||
/**类型*/
|
||||
@TableField(exist = false)
|
||||
private String type;
|
||||
/**类型*/
|
||||
@Excel(name = "分组", width = 15)
|
||||
@ApiModelProperty(value = "分组")
|
||||
private String groupId;
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
package org.jeecg.modules.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Description: 分组数据表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-06-12
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("cet_group")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="cet_group对象", description="分组数据表")
|
||||
public class CetGroup implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String id;
|
||||
@Excel(name = "分组名称", width = 15)
|
||||
@ApiModelProperty(value = "分组名称")
|
||||
private String groupName;
|
||||
/**分组名称*/
|
||||
@Excel(name = "分组名称", width = 15)
|
||||
@ApiModelProperty(value = "分组名称")
|
||||
@TableField(exist = false)
|
||||
private String rowUser;
|
||||
/**分组名称*/
|
||||
@Excel(name = "教室名称", width = 15)
|
||||
@ApiModelProperty(value = "教室名称")
|
||||
@TableField(exist = false)
|
||||
private String roomName;
|
||||
/**教室ID*/
|
||||
@Excel(name = "教室ID", width = 15)
|
||||
@ApiModelProperty(value = "教室ID")
|
||||
private String roomId;
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String updateBy;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
/**所属部门*/
|
||||
@ApiModelProperty(value = "所属部门")
|
||||
private String sysOrgCode;
|
||||
}
|
|
@ -0,0 +1,102 @@
|
|||
package org.jeecg.modules.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Description: 数据总表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-06-11
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("cet_invigilate_data")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="cet_invigilate_data对象", description="数据总表")
|
||||
public class CetInvigilateData implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String Id;
|
||||
/**学号/工号*/
|
||||
@Excel(name = "学号/工号", width = 15)
|
||||
@ApiModelProperty(value = "学号/工号")
|
||||
private String code;
|
||||
/**教师姓名*/
|
||||
@Excel(name = "教师姓名", width = 15)
|
||||
@ApiModelProperty(value = "教师姓名")
|
||||
private String name;
|
||||
/**年龄*/
|
||||
@Excel(name = "年龄", width = 15)
|
||||
@ApiModelProperty(value = "年龄")
|
||||
private String age;
|
||||
/**性别*/
|
||||
@Excel(name = "性别", width = 15)
|
||||
@ApiModelProperty(value = "性别")
|
||||
private String sex;
|
||||
/**校区*/
|
||||
@Excel(name = "校区", width = 15)
|
||||
@ApiModelProperty(value = "校区")
|
||||
private String campus;
|
||||
/**学院*/
|
||||
@Excel(name = "学院", width = 15)
|
||||
@ApiModelProperty(value = "学院")
|
||||
private String college;
|
||||
/**照片地址*/
|
||||
// @Excel(name = "照片地址", width = 15)
|
||||
@ApiModelProperty(value = "照片地址")
|
||||
private String photoAddress;
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private Date createTime;
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String updateBy;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private Date updateTime;
|
||||
/**所属部门*/
|
||||
@ApiModelProperty(value = "所属部门")
|
||||
private String sysOrgCode;
|
||||
/**类型*/
|
||||
@Excel(name = "类型", width = 15)
|
||||
@ApiModelProperty(value = "类型")
|
||||
private String type;
|
||||
/**类型*/
|
||||
// @Excel(name = "分组", width = 15)
|
||||
@ApiModelProperty(value = "分组")
|
||||
private String groupId;
|
||||
/**分组*/
|
||||
// @Excel(name = "分组", width = 15)
|
||||
@ApiModelProperty(value = "分组")
|
||||
@TableField(exist = false)
|
||||
private String groupName;
|
||||
/**教室*/
|
||||
@Excel(name = "教室", width = 15)
|
||||
@ApiModelProperty(value = "教室")
|
||||
@TableField(exist = false)
|
||||
private String roomName;
|
||||
}
|
|
@ -0,0 +1,83 @@
|
|||
package org.jeecg.modules.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Description: 非教师数据表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-06-11
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("cet_no_teachers")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="cet_no_teachers对象", description="非教师数据表")
|
||||
public class CetNoTeachers implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String Id ;
|
||||
/**教师姓名*/
|
||||
@Excel(name = "教师姓名", width = 15)
|
||||
@ApiModelProperty(value = "教师姓名")
|
||||
private String name;
|
||||
/**年龄*/
|
||||
@Excel(name = "年龄", width = 15)
|
||||
@ApiModelProperty(value = "年龄")
|
||||
private String age;
|
||||
/**性别*/
|
||||
@Excel(name = "性别", width = 15)
|
||||
@ApiModelProperty(value = "性别")
|
||||
private String sex;
|
||||
/**校区*/
|
||||
@Excel(name = "校区", width = 15)
|
||||
@ApiModelProperty(value = "校区")
|
||||
private String campus;
|
||||
/**照片地址*/
|
||||
@Excel(name = "照片地址", width = 15)
|
||||
@ApiModelProperty(value = "照片地址")
|
||||
private String photoAddress;
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private Date createTime;
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String updateBy;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private Date updateTime;
|
||||
/**所属部门*/
|
||||
@ApiModelProperty(value = "所属部门")
|
||||
private String sysOrgCode;
|
||||
/**类型*/
|
||||
@TableField(exist = false)
|
||||
private String type;
|
||||
/**类型*/
|
||||
@Excel(name = "分组", width = 15)
|
||||
@ApiModelProperty(value = "分组")
|
||||
private String groupId;
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
package org.jeecg.modules.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Description: 教师数据表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-06-11
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("cet_teachers")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="cet_teachers对象", description="教师数据表")
|
||||
public class CetTeachers implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String Id ;
|
||||
/**工号*/
|
||||
@Excel(name = "工号", width = 15)
|
||||
@ApiModelProperty(value = "工号")
|
||||
private String jobNumber;
|
||||
/**教师姓名*/
|
||||
@Excel(name = "教师姓名", width = 15)
|
||||
@ApiModelProperty(value = "教师姓名")
|
||||
private String teacherName;
|
||||
/**年龄*/
|
||||
@Excel(name = "年龄", width = 15)
|
||||
@ApiModelProperty(value = "年龄")
|
||||
private String age;
|
||||
/**性别*/
|
||||
@Excel(name = "性别", width = 15)
|
||||
@ApiModelProperty(value = "性别")
|
||||
private String sex;
|
||||
/**校区*/
|
||||
@Excel(name = "校区", width = 15)
|
||||
@ApiModelProperty(value = "校区")
|
||||
private String campus;
|
||||
/**学院*/
|
||||
@Excel(name = "学院", width = 15)
|
||||
@ApiModelProperty(value = "学院")
|
||||
private String college;
|
||||
/**照片地址*/
|
||||
@Excel(name = "照片地址", width = 15)
|
||||
@ApiModelProperty(value = "照片地址")
|
||||
private String photoAddress;
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private Date createTime;
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String updateBy;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private Date updateTime;
|
||||
/**所属部门*/
|
||||
@ApiModelProperty(value = "所属部门")
|
||||
private String sysOrgCode;
|
||||
/**类型*/
|
||||
@TableField(exist = false)
|
||||
private String type;
|
||||
/**类型*/
|
||||
@Excel(name = "分组", width = 15)
|
||||
@ApiModelProperty(value = "分组")
|
||||
private String groupId;
|
||||
|
||||
}
|
|
@ -4,11 +4,11 @@ import java.io.Serializable;
|
|||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.jeecg.modules.anno.AttributeName;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
|
@ -30,22 +30,29 @@ import lombok.experimental.Accessors;
|
|||
public class Cet_4 implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "主键id")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/**学生姓名*/
|
||||
@Excel(name = "学生姓名", width = 15)
|
||||
@AttributeName(4)
|
||||
@ApiModelProperty(value = "学生姓名")
|
||||
private String name;
|
||||
/**学生所在学院*/
|
||||
@Excel(name = "学生所在学院", width = 15)
|
||||
@AttributeName(11)
|
||||
@ApiModelProperty(value = "学生所在学院")
|
||||
private String college;
|
||||
/**学生成绩*/
|
||||
@Excel(name = "学生成绩", width = 15)
|
||||
@AttributeName(15)
|
||||
@ApiModelProperty(value = "学生成绩")
|
||||
private Integer result;
|
||||
/**学生学号*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@AttributeName(19)
|
||||
@ApiModelProperty(value = "学生学号")
|
||||
private String id;
|
||||
private String code;
|
||||
/**考试批次*/
|
||||
@Excel(name = "考试批次", width = 15, format = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
|
@ -58,14 +65,17 @@ public class Cet_4 implements Serializable {
|
|||
private String entrydate;
|
||||
/**听力成绩*/
|
||||
@Excel(name = "听力成绩", width = 15)
|
||||
@AttributeName(12)
|
||||
@ApiModelProperty(value = "听力成绩")
|
||||
private Integer listen;
|
||||
/**阅读成绩*/
|
||||
@Excel(name = "阅读成绩", width = 15)
|
||||
@AttributeName(13)
|
||||
@ApiModelProperty(value = "阅读成绩")
|
||||
private Integer reading;
|
||||
/**作文成绩*/
|
||||
@Excel(name = "作文成绩", width = 15)
|
||||
@AttributeName(14)
|
||||
@ApiModelProperty(value = "作文成绩")
|
||||
private Integer writing;
|
||||
/**专业名字*/
|
||||
|
|
|
@ -14,6 +14,12 @@ import java.util.Date;
|
|||
@Data
|
||||
@TableName("cet_4old")
|
||||
public class Cet_4old {
|
||||
|
||||
|
||||
@ApiModelProperty(value = "主键id")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 学生姓名
|
||||
*/
|
||||
|
@ -35,9 +41,8 @@ public class Cet_4old {
|
|||
/**
|
||||
* 学生学号
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "学生学号")
|
||||
private String id;
|
||||
private String code;
|
||||
/**
|
||||
* 考试批次
|
||||
*/
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
package org.jeecg.modules.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.jeecg.modules.anno.AttributeName;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
|
@ -17,53 +19,100 @@ import lombok.experimental.Accessors;
|
|||
/**
|
||||
* @Description: cet_6
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-03-26
|
||||
* @Date: 2024-03-26
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("cet_6")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="cet_6对象", description="cet_6")
|
||||
@ApiModel(value = "cet_6对象", description = "cet_6")
|
||||
public class Cet_6 implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**学生姓名*/
|
||||
@Excel(name = "学生姓名", width = 15)
|
||||
|
||||
@ApiModelProperty(value = "主键id")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 学生姓名
|
||||
*/
|
||||
@Excel(name = "学生姓名", width = 15)
|
||||
@AttributeName(4)
|
||||
@ApiModelProperty(value = "学生姓名")
|
||||
private java.lang.String name;
|
||||
/**学生所在学院*/
|
||||
@Excel(name = "学生所在学院", width = 15)
|
||||
private String name;
|
||||
/**
|
||||
* 学生所在学院
|
||||
*/
|
||||
@Excel(name = "学生所在学院", width = 15)
|
||||
@AttributeName(11)
|
||||
@ApiModelProperty(value = "学生所在学院")
|
||||
private java.lang.String college;
|
||||
/**学生成绩*/
|
||||
@Excel(name = "学生成绩", width = 15)
|
||||
private String college;
|
||||
/**
|
||||
* 学生成绩
|
||||
*/
|
||||
@Excel(name = "学生成绩", width = 15)
|
||||
@AttributeName(15)
|
||||
@ApiModelProperty(value = "学生成绩")
|
||||
private java.lang.Integer result;
|
||||
/**学生学号*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Integer result;
|
||||
/**
|
||||
* 学生学号
|
||||
*/
|
||||
@AttributeName(19)
|
||||
@ApiModelProperty(value = "学生学号")
|
||||
private java.lang.String id;
|
||||
/**考试批次*/
|
||||
@Excel(name = "考试批次", width = 15, format = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
private String code;
|
||||
/**
|
||||
* 考试批次
|
||||
*/
|
||||
@Excel(name = "考试批次", width = 15, format = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "考试批次")
|
||||
private java.util.Date batch;
|
||||
/**入学时间*/
|
||||
@Excel(name = "入学时间", width = 15)
|
||||
private Date batch;
|
||||
/**
|
||||
* 入学时间
|
||||
*/
|
||||
@Excel(name = "入学时间", width = 15)
|
||||
@ApiModelProperty(value = "入学时间")
|
||||
private java.lang.String entrydate;
|
||||
/**听力成绩*/
|
||||
@Excel(name = "听力成绩", width = 15)
|
||||
private String entrydate;
|
||||
/**
|
||||
* 听力成绩
|
||||
*/
|
||||
@Excel(name = "听力成绩", width = 15)
|
||||
@AttributeName(12)
|
||||
@ApiModelProperty(value = "听力成绩")
|
||||
private java.lang.Integer listen;
|
||||
/**阅读成绩*/
|
||||
@Excel(name = "阅读成绩", width = 15)
|
||||
private Integer listen;
|
||||
/**
|
||||
* 阅读成绩
|
||||
*/
|
||||
@Excel(name = "阅读成绩", width = 15)
|
||||
@AttributeName(13)
|
||||
@ApiModelProperty(value = "阅读成绩")
|
||||
private java.lang.Integer reading;
|
||||
/**作文成绩*/
|
||||
@Excel(name = "作文成绩", width = 15)
|
||||
private Integer reading;
|
||||
/**
|
||||
* 作文成绩
|
||||
*/
|
||||
@Excel(name = "作文成绩", width = 15)
|
||||
@AttributeName(14)
|
||||
@ApiModelProperty(value = "作文成绩")
|
||||
private java.lang.Integer writing;
|
||||
private Integer writing;
|
||||
/**
|
||||
* 专业名字
|
||||
*/
|
||||
@Excel(name = "专业名称", width = 15)
|
||||
@ApiModelProperty(value = "专业名称")
|
||||
private String majorname;
|
||||
/**
|
||||
* 培养层次
|
||||
*/
|
||||
@Excel(name = "培养层次", width = 15)
|
||||
@ApiModelProperty(value = "培养层次")
|
||||
private String level;
|
||||
/**
|
||||
* 在校状态
|
||||
*/
|
||||
@Excel(name = "在校状态", width = 15)
|
||||
@ApiModelProperty(value = "在校状态")
|
||||
private String state;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,88 @@
|
|||
package org.jeecg.modules.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Description: 教室表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-06-11
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("class_room")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="class_room对象", description="教室表")
|
||||
public class ClassRoom implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String id;
|
||||
// @Excel(name = "教学楼名", width = 15)
|
||||
@ApiModelProperty(value = "分组ID")
|
||||
private String groupId;
|
||||
/**教学楼名,如“理工一”、“崇师楼”*/
|
||||
@Excel(name = "教学楼名", width = 15)
|
||||
@ApiModelProperty(value = "教学楼名,如“理工一”、“崇师楼”")
|
||||
private String building;
|
||||
/**区域,如“A区”、“B区”,无则为空*/
|
||||
@Excel(name = "区域", width = 15)
|
||||
@ApiModelProperty(value = "区域,如“A区”、“B区”,无则为空")
|
||||
private String area;
|
||||
/**楼层号,如 5楼、2楼 等*/
|
||||
@Excel(name = "楼层号", width = 15)
|
||||
@ApiModelProperty(value = "楼层号,如 5楼、2楼 等")
|
||||
private String floor;
|
||||
/**房间编号,如“511教室”*/
|
||||
@Excel(name = "教室”", width = 15)
|
||||
@ApiModelProperty(value = "房间编号,如“511教室”")
|
||||
private String roomNumber;
|
||||
/**完整名称,如“崇师楼B区511教室”*/
|
||||
@Excel(name = "完整名称,如“崇师楼B区511教室”", width = 15)
|
||||
@ApiModelProperty(value = "完整名称,如“崇师楼B区511教室”")
|
||||
private String fullName;
|
||||
/**校区*/
|
||||
@Excel(name = "校区", width = 15)
|
||||
@ApiModelProperty(value = "校区")
|
||||
private String campus;
|
||||
/** 备注*/
|
||||
@Excel(name = " 备注", width = 15)
|
||||
@ApiModelProperty(value = " 备注")
|
||||
private String remarks;
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String updateBy;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
/**所属部门*/
|
||||
@ApiModelProperty(value = "所属部门")
|
||||
private String sysOrgCode;
|
||||
/**状态*/
|
||||
@ApiModelProperty(value = "状态")
|
||||
private String status;
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package org.jeecg.modules.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.entity.CetGraduates;
|
||||
|
||||
/**
|
||||
* @Description: 研究生数据表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-06-11
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface CetGraduatesMapper extends BaseMapper<CetGraduates> {
|
||||
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package org.jeecg.modules.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.entity.CetGroup;
|
||||
/**
|
||||
* @Description: 分组数据表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-06-12
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface CetGroupMapper extends BaseMapper<CetGroup> {
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package org.jeecg.modules.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.entity.CetInvigilateData;
|
||||
|
||||
/**
|
||||
* @Description: 数据总表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-06-11
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface CetInvigilateDataMapper extends BaseMapper<CetInvigilateData> {
|
||||
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
package org.jeecg.modules.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
import org.jeecg.modules.entity.CET;
|
||||
|
||||
public interface CetMapper extends BaseMapper<CET> {
|
||||
@Insert("insert into cet_4 (name, college, result, id, batch, entrydate, listen, reading, writing) values (#{name}, #{college}, #{result}, #{id},#{batch}, #{entrydate}, #{listen}, #{reading}, #{writing})")
|
||||
void insertCET_4(CET cet);
|
||||
@Insert("insert into cet_6 (name, college, result, id, batch, entrydate, listen, reading, writing)values (#{name}, #{college}, #{result}, #{id},#{batch}, #{entrydate}, #{listen}, #{reading}, #{writing})")
|
||||
void insertCET_6(CET cet);
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package org.jeecg.modules.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.entity.CetNoTeachers;
|
||||
|
||||
/**
|
||||
* @Description: 非教师数据表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-06-11
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface CetNoTeachersMapper extends BaseMapper<CetNoTeachers> {
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package org.jeecg.modules.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.entity.CetTeachers;
|
||||
|
||||
/**
|
||||
* @Description: 教师数据表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-06-11
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface CetTeachersMapper extends BaseMapper<CetTeachers> {
|
||||
|
||||
}
|
|
@ -4,6 +4,7 @@ import org.apache.ibatis.annotations.Param;
|
|||
import org.jeecg.modules.entity.Cet_4;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -13,5 +14,6 @@ import java.util.List;
|
|||
* @Version: V1.0
|
||||
*/
|
||||
public interface Cet_4Mapper extends BaseMapper<Cet_4> {
|
||||
Date lastestDate();
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
package org.jeecg.modules.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.entity.ClassRoom;
|
||||
|
||||
/**
|
||||
* @Description: 教室表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-06-11
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ClassRoomMapper extends BaseMapper<ClassRoom> {
|
||||
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.jeecg.modules.demo.cet.mapper.CetGraduatesMapper">
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.jeecg.modules.demo.cet.mapper.CetGroupMapper">
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.jeecg.modules.demo.cet.mapper.CetInvigilateDataMapper">
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.jeecg.modules.demo.cet.mapper.CetNoTeachersMapper">
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.jeecg.modules.demo.data.mapper.CetTeachersMapper">
|
||||
|
||||
</mapper>
|
|
@ -1,4 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.jeecg.modules.mapper.Cet_4Mapper">
|
||||
<select id="lastestDate" resultType="java.util.Date">
|
||||
SELECT MAX(batch) AS latest_batch FROM cet_4;
|
||||
</select>
|
||||
</mapper>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.jeecg.modules.demo.cet.mapper.ClassRoomMapper">
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,91 @@
|
|||
package org.jeecg.modules.pojo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
*
|
||||
* @Author: Cool
|
||||
* @Date: 2024/10/23/20:35
|
||||
* @Description:
|
||||
*/
|
||||
@Data
|
||||
public class CetStudent {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@ExcelProperty("学号")
|
||||
@ApiModelProperty(value = "id")
|
||||
private String code;
|
||||
/**
|
||||
* name
|
||||
*/
|
||||
@ExcelProperty("姓名")
|
||||
@ApiModelProperty(value = "name")
|
||||
private String name;
|
||||
/**
|
||||
* college
|
||||
*/
|
||||
@ExcelProperty("上课院系")
|
||||
@ApiModelProperty(value = "college")
|
||||
private String college;
|
||||
/**
|
||||
* majorId
|
||||
*/
|
||||
@ExcelProperty("专业号")
|
||||
@ApiModelProperty(value = "majorId")
|
||||
private String majorId;
|
||||
/**
|
||||
* majorname
|
||||
*/
|
||||
@ExcelProperty("专业名称")
|
||||
@ApiModelProperty(value = "majorname")
|
||||
private String majorname;
|
||||
/**
|
||||
* className
|
||||
*/
|
||||
@ExcelProperty("班级")
|
||||
@ApiModelProperty(value = "className")
|
||||
private String className;
|
||||
/**
|
||||
* educate
|
||||
*/
|
||||
@ExcelProperty("学制")
|
||||
@ApiModelProperty(value = "educate")
|
||||
private String educate;
|
||||
/**
|
||||
* entrydate
|
||||
*/
|
||||
@ExcelProperty("当前所在级")
|
||||
@ApiModelProperty(value = "entrydate")
|
||||
private String entrydate;
|
||||
/**
|
||||
* campus
|
||||
*/
|
||||
@ExcelProperty("校区")
|
||||
@ApiModelProperty(value = "campus")
|
||||
private String campus;
|
||||
/**
|
||||
* state
|
||||
*/
|
||||
@ExcelProperty("在校状态")
|
||||
@ApiModelProperty(value = "state")
|
||||
private String state;
|
||||
/**
|
||||
* level
|
||||
*/
|
||||
@ExcelProperty("培养层次")
|
||||
@ApiModelProperty(value = "level")
|
||||
private String level;
|
||||
/**
|
||||
* category
|
||||
*/
|
||||
@ExcelProperty("学生类别")
|
||||
@ApiModelProperty(value = "category")
|
||||
private String category;
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
package org.jeecg.modules.runnable;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.modules.entity.Cet4_major;
|
||||
import org.jeecg.modules.entity.Cet_4;
|
||||
import org.jeecg.modules.entity.Cet_6;
|
||||
import org.jeecg.modules.service.ICet4MajorService;
|
||||
import org.jeecg.modules.service.ICet_4Service;
|
||||
import org.jeecg.modules.service.ICet_6Service;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
*
|
||||
* @Author: Cool
|
||||
* @Date: 2024/10/24/14:38
|
||||
* @Description:
|
||||
*/
|
||||
@Slf4j
|
||||
public class CetDataAsync implements Runnable {
|
||||
|
||||
private final ICet_6Service cet6Service;
|
||||
private final ICet_4Service cet4Service;
|
||||
private final ICet4MajorService cet4MajorService;
|
||||
|
||||
// 构造函数注入
|
||||
public CetDataAsync(ICet_6Service cet6Service, ICet_4Service cet4Service, ICet4MajorService cet4MajorService) {
|
||||
this.cet6Service = cet6Service;
|
||||
this.cet4Service = cet4Service;
|
||||
this.cet4MajorService = cet4MajorService;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void run() {
|
||||
long start = System.currentTimeMillis();
|
||||
List<Cet4_major> majorList = cet4MajorService.list();
|
||||
List<Cet_4> allCet4 = cet4Service.list();
|
||||
List<Cet_6> allCet6 = cet6Service.list();
|
||||
List<Cet_4> cet4List = new ArrayList<>();
|
||||
List<Cet_6> cet6List = new ArrayList<>();
|
||||
Map<String, List<Cet_4>> cet4Map = allCet4.stream().collect(Collectors.groupingBy(Cet_4::getCode));
|
||||
Map<String, List<Cet_6>> cet6Map = allCet6.stream().collect(Collectors.groupingBy(Cet_6::getCode));
|
||||
majorList.forEach(e -> {
|
||||
List<Cet_4> cet4Collect = cet4Map.getOrDefault(e.getCode(), Collections.emptyList());
|
||||
List<Cet_6> cet6Collect = cet6Map.getOrDefault(e.getCode(), Collections.emptyList());
|
||||
cet4Collect.forEach(c -> {
|
||||
//填充数据
|
||||
c.setMajorname(e.getMajorname());
|
||||
c.setLevel(e.getLevel());
|
||||
c.setState(e.getState());
|
||||
});
|
||||
cet6Collect.forEach(c -> {
|
||||
//填充数据
|
||||
c.setMajorname(e.getMajorname());
|
||||
c.setLevel(e.getLevel());
|
||||
c.setState(e.getState());
|
||||
});
|
||||
cet4List.addAll(cet4Collect);
|
||||
cet6List.addAll(cet6Collect);
|
||||
if (cet4List.size() >= 500) {
|
||||
cet4Service.updateBatchById(cet4List);
|
||||
cet4List.clear();
|
||||
}
|
||||
if (cet6List.size() >= 500) {
|
||||
cet6Service.updateBatchById(cet6List);
|
||||
cet6List.clear();
|
||||
}
|
||||
});
|
||||
//将剩下的不足500的提交
|
||||
if (!cet4List.isEmpty()) {
|
||||
cet4Service.updateBatchById(cet4List);
|
||||
}
|
||||
if (!cet6List.isEmpty()) {
|
||||
cet6Service.updateBatchById(cet6List);
|
||||
}
|
||||
log.info("同步数据用时:{}",System.currentTimeMillis()-start);
|
||||
}
|
||||
}
|
|
@ -5,6 +5,11 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.entity.Cet_4;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* @Description: cet_6
|
||||
* @Author: jeecg-boot
|
||||
|
@ -21,5 +26,10 @@ public interface CenterService extends IService<Cet_4> {
|
|||
Result<JSONObject> getData(String college,String major, String entryDate);
|
||||
|
||||
Result<JSONObject> getTest();
|
||||
|
||||
Result<JSONObject> getCollegeMajor();
|
||||
|
||||
List<String> getEntryDateByBatch(Date batch);
|
||||
|
||||
<T,R> Map<Object, Long> dealList(List<T> list, Function<T,R> mapper);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,274 @@
|
|||
package org.jeecg.modules.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.linuxense.javadbf.DBFField;
|
||||
import com.linuxense.javadbf.DBFReader;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.util.DateUtils;
|
||||
import org.jeecg.modules.anno.AttributeName;
|
||||
import org.jeecg.modules.entity.Cet_4;
|
||||
import org.jeecg.modules.entity.Cet_6;
|
||||
import org.jeecg.modules.utils.DateUtil;
|
||||
import org.jeecg.modules.utils.ExportUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.lang.reflect.Field;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.*;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class CetDataImport {
|
||||
|
||||
private final String CET_DATA_IMPORT_TEMPLATE="template/cetDataImportTemplate.xlsx";
|
||||
private final String CET_DATE_FILE_TEMPLATE_NAME = "四六级数据导入模版.xlsx";
|
||||
|
||||
// @Autowired
|
||||
// CetMapper_6 cetMapper6;
|
||||
|
||||
@Autowired
|
||||
ICet_4Service cet4Service;
|
||||
|
||||
@Autowired
|
||||
ICet_6Service cet6Service;
|
||||
|
||||
/**
|
||||
* @Author Cool
|
||||
* @Date 12:58 2024/10/11
|
||||
**/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result<?> readDBF(MultipartFile file, String batchStr, String level) {
|
||||
if (!(level.equals("cet4") || level.equals("cet6"))) {
|
||||
return Result.error("请选择正确的考试水平");
|
||||
}
|
||||
Set<String> collegeSet = getColleges();
|
||||
Date batch = DateUtil.formatDateToDay(batchStr);
|
||||
boolean isCet4 = level.equals("cet4");
|
||||
try {
|
||||
List<Cet_6> cet6List = new ArrayList<>();
|
||||
List<Cet_4> cet4List = new ArrayList<>();
|
||||
DBFReader dbfReader = new DBFReader(file.getInputStream(), Charset.forName("GBK"));
|
||||
if (!checkFileFormat(dbfReader)) {
|
||||
return Result.error("上传文件格式错误");
|
||||
}
|
||||
Object[] rowValues;
|
||||
while ((rowValues = dbfReader.nextRecord()) != null) {
|
||||
Cet_6 cet6 = new Cet_6();
|
||||
Cet_4 cet4 = new Cet_4();
|
||||
Class<?> cetClass;
|
||||
if (isCet4) {
|
||||
cetClass = cet4.getClass();
|
||||
} else {
|
||||
cetClass = cet6.getClass();
|
||||
}
|
||||
Field[] fields = cetClass.getDeclaredFields();
|
||||
//对单个学生对象进行属性注入
|
||||
for (Field field : fields) {
|
||||
if (field.getDeclaredAnnotation(AttributeName.class) == null) continue;
|
||||
int fieldIndex = field.getDeclaredAnnotation(AttributeName.class).value();
|
||||
field.setAccessible(true);
|
||||
// 获取字段的类型
|
||||
Class<?> fieldType = field.getType();
|
||||
//进行类型区分
|
||||
if (fieldType == String.class) {
|
||||
Object value = rowValues[fieldIndex - 1];
|
||||
if (isCet4) {
|
||||
field.set(cet4, String.valueOf(value));
|
||||
} else {
|
||||
field.set(cet6, String.valueOf(value));
|
||||
}
|
||||
if (field.getName().equals("college")) {
|
||||
if (!collegeSet.contains(String.valueOf(value))) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (field.getName().equals("id")) {
|
||||
// System.out.println(field.getName());
|
||||
String entryDate = String.valueOf(value);
|
||||
//对学生信息进行检查
|
||||
entryDate = entryDate.substring(0, 4);
|
||||
int entry = Integer.parseInt(entryDate);
|
||||
int year = DateUtils.getYear();
|
||||
if (entry < 2010 || entry > year + 1 || Pattern.compile("[a-zA-Z]").matcher(entryDate).find())
|
||||
continue;
|
||||
if (isCet4) {
|
||||
cet4.setEntrydate(entryDate);
|
||||
} else {
|
||||
cet6.setEntrydate(entryDate);
|
||||
}
|
||||
}
|
||||
} else if (fieldType == int.class || fieldType == Integer.class) {
|
||||
Object value = rowValues[fieldIndex - 1];
|
||||
if (isCet4) {
|
||||
field.set(cet4, (int) Double.parseDouble(String.valueOf(value)));
|
||||
} else {
|
||||
field.set(cet6, (int) Double.parseDouble(String.valueOf(value)));
|
||||
}
|
||||
} else if (fieldType == Date.class) {
|
||||
Object value = rowValues[fieldIndex - 1];
|
||||
if (isCet4) {
|
||||
field.set(cet4, new Date(((Timestamp) value).getTime()));
|
||||
} else {
|
||||
field.set(cet6, new Date(((Timestamp) value).getTime()));
|
||||
}
|
||||
}
|
||||
}
|
||||
cet6.setBatch(batch);
|
||||
cet4.setBatch(batch);
|
||||
if (isCet4) {
|
||||
if (collegeSet.contains(cet4.getCollege())) {
|
||||
cet4List.add(cet4);
|
||||
}
|
||||
if (cet4List.size() >= 500) {
|
||||
cet4Service.saveBatch(cet4List);
|
||||
log.info("Cet学生{}", cet4);
|
||||
cet4List.clear();
|
||||
}
|
||||
} else {
|
||||
if (collegeSet.contains(cet6.getCollege())) {
|
||||
cet6List.add(cet6);
|
||||
}
|
||||
if (cet6List.size() >= 500) {
|
||||
cet6Service.saveBatch(cet6List);
|
||||
cet6List.clear();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (isCet4) {
|
||||
cet4Service.saveBatch(cet4List);
|
||||
} else {
|
||||
cet6Service.saveBatch(cet6List);
|
||||
}
|
||||
return Result.ok();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error("出现异常,请联系管理员");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public Set<String> getColleges() {
|
||||
LambdaQueryWrapper<Cet_4> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.groupBy(Cet_4::getCollege);
|
||||
List<Cet_4> list = cet4Service.list(wrapper);
|
||||
return list.stream().map(Cet_4::getCollege).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
private boolean checkFileFormat(DBFReader dbfReader) {
|
||||
if (!"ks_xm".equals(dbfReader.getField(3).getName())) {
|
||||
return false;
|
||||
}
|
||||
if (!"ks_xy_dm".equals(dbfReader.getField(10).getName())) {
|
||||
return false;
|
||||
}
|
||||
if (!"tl".equals(dbfReader.getField(11).getName())) {
|
||||
return false;
|
||||
}
|
||||
if (!"yd".equals(dbfReader.getField(12).getName())) {
|
||||
return false;
|
||||
}
|
||||
if (!"xz".equals(dbfReader.getField(13).getName())) {
|
||||
return false;
|
||||
}
|
||||
if (!"zf".equals(dbfReader.getField(14).getName())) {
|
||||
return false;
|
||||
}
|
||||
if (!"Ks_xh".equals(dbfReader.getField(18).getName())) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试用
|
||||
*
|
||||
* @Author Cool
|
||||
* @Date 19:03 2024/10/11
|
||||
**/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result<?> readDBF1() throws FileNotFoundException {
|
||||
|
||||
Set<String> collegeSet = getColleges();
|
||||
String batchStr = "2020-12-01";
|
||||
String level = "";
|
||||
File file = new File("C:\\Users\\86183\\Desktop\\202012-202406六级成绩\\2021下半年英语六级成绩.dbf");
|
||||
InputStream inputStream = new FileInputStream(file);
|
||||
Date batch = DateUtil.formatDateToDay(batchStr);
|
||||
try {
|
||||
List<Cet_6> cet6List = new ArrayList<>();
|
||||
DBFReader dbfReader = new DBFReader(inputStream, Charset.forName("GBK"));
|
||||
DBFField field1 = dbfReader.getField(0);
|
||||
Object[] rowValues = dbfReader.nextRecord();
|
||||
while ((rowValues = dbfReader.nextRecord()) != null) {
|
||||
Cet_6 cet6 = new Cet_6();
|
||||
Class<?> cetClass = cet6.getClass();
|
||||
Field[] fields = cetClass.getDeclaredFields();
|
||||
//对单个学生对象进行属性注入
|
||||
for (Field field : fields) {
|
||||
if (field.getDeclaredAnnotation(AttributeName.class) == null) continue;
|
||||
int fieldIndex = field.getDeclaredAnnotation(AttributeName.class).value();
|
||||
field.setAccessible(true);
|
||||
// 获取字段的类型
|
||||
Class<?> fieldType = field.getType();
|
||||
//进行类型区分
|
||||
if (fieldType == String.class) {
|
||||
Object value = rowValues[fieldIndex - 1];
|
||||
field.set(cet6, String.valueOf(value));
|
||||
if (field.getName().equals("college")) {
|
||||
if (!collegeSet.contains(String.valueOf(value))) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (field.getName().equals("id")) {
|
||||
// System.out.println(field.getName());
|
||||
String entryDate = String.valueOf(value);
|
||||
//对学生信息进行检查
|
||||
entryDate = entryDate.substring(0, 4);
|
||||
int entry = Integer.parseInt(entryDate);
|
||||
int year = DateUtils.getYear();
|
||||
if (entry < 2010 || entry > year + 1 || Pattern.compile("[a-zA-Z]").matcher(entryDate).find())
|
||||
continue;
|
||||
|
||||
cet6.setEntrydate(entryDate);
|
||||
}
|
||||
} else if (fieldType == int.class || fieldType == Integer.class) {
|
||||
Object value = rowValues[fieldIndex - 1];
|
||||
|
||||
field.set(cet6, (int) Double.parseDouble(String.valueOf(value)));
|
||||
} else if (fieldType == Date.class) {
|
||||
Object value = rowValues[fieldIndex - 1];
|
||||
field.set(cet6, new Date(((Timestamp) value).getTime()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Result.ok();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error("出现异常,请联系管理员");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Result<?> downloadTemplate(HttpServletResponse response) {
|
||||
try {
|
||||
ExportUtil.downloadExcelTemplate(response, CET_DATE_FILE_TEMPLATE_NAME, CET_DATA_IMPORT_TEMPLATE);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -1,115 +0,0 @@
|
|||
package org.jeecg.modules.service;
|
||||
|
||||
|
||||
import com.linuxense.javadbf.DBFReader;
|
||||
import org.jeecg.common.util.DateUtils;
|
||||
import org.jeecg.modules.anno.AttributeName;
|
||||
import org.jeecg.modules.entity.CET;
|
||||
import org.jeecg.modules.mapper.CetMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.Field;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@Service
|
||||
public class DBFImporter {
|
||||
@Resource
|
||||
CetMapper cetMapper;
|
||||
// @Autowired
|
||||
// CetMapper_6 cetMapper6;
|
||||
|
||||
public void readDBF(InputStream inputStream, Date batch, String level, String charsetName) {
|
||||
try {
|
||||
// List<CET> cetList = new ArrayList<>();
|
||||
DBFReader dbfReader = new DBFReader(inputStream, Charset.forName(charsetName));
|
||||
Object[] rowValues;
|
||||
|
||||
while ((rowValues = dbfReader.nextRecord()) != null) {
|
||||
CET cet = new CET();
|
||||
Class<?> cetClass = cet.getClass();
|
||||
Field[] fields = cetClass.getDeclaredFields();
|
||||
//对单个学生对象进行属性注入
|
||||
for (Field field : fields) {
|
||||
if (field.getDeclaredAnnotation(AttributeName.class) == null) continue;
|
||||
int fieldIndex = field.getDeclaredAnnotation(AttributeName.class).value();
|
||||
field.setAccessible(true);
|
||||
// 获取字段的类型
|
||||
Class<?> fieldType = field.getType();
|
||||
//进行类型区分
|
||||
if (fieldType == String.class) {
|
||||
Object value = rowValues[fieldIndex - 1];
|
||||
field.set(cet, String.valueOf(value));
|
||||
if (field.getName().equals("id")) {
|
||||
// System.out.println(field.getName());
|
||||
String entryDate = String.valueOf(value);
|
||||
//对学生信息进行检查
|
||||
int entry = Integer.parseInt(entryDate);
|
||||
int year = DateUtils.getYear();
|
||||
if (entry<2010||entry>year+1||Pattern.compile("[a-zA-Z]").matcher(entryDate).find()) continue;
|
||||
|
||||
cet.setEntrydate(entryDate.substring(0, 4));
|
||||
}
|
||||
} else if (fieldType == int.class || fieldType == Integer.class) {
|
||||
Object value = rowValues[fieldIndex - 1];
|
||||
|
||||
field.set(cet, (int) Double.parseDouble(String.valueOf(value)));
|
||||
} else if (fieldType == Date.class) {
|
||||
Object value = rowValues[fieldIndex - 1];
|
||||
field.set(cet, new Date(((Timestamp) value).getTime()));
|
||||
}
|
||||
}
|
||||
cet.setBatch(batch);
|
||||
// System.out.println(cet);
|
||||
// cetList.add(cet);
|
||||
System.out.println(cet);
|
||||
if (level.equals("英语四级")) {
|
||||
cetMapper.insertCET_4(cet);
|
||||
}
|
||||
if (level.equals("英语六级")) {
|
||||
cetMapper.insertCET_6(cet);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// System.out.println(cetList.size());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// private static Date extractDateFromPath(String filePath) {
|
||||
// // 在文件路径中找到日期部分的起始位置
|
||||
// String[] pathArray = filePath.split("\\\\");
|
||||
// String date = pathArray[pathArray.length - 2];
|
||||
//
|
||||
//
|
||||
// // 截取日期部分
|
||||
// String dateStr = date.substring(0, 7) + "-01";
|
||||
// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
// try {
|
||||
//
|
||||
// return simpleDateFormat.parse(dateStr);
|
||||
// } catch (ParseException e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// private String getLevel(String filePath) {
|
||||
// String[] pathArray = filePath.split("\\\\");
|
||||
// String level = pathArray[pathArray.length - 1];
|
||||
// return level.substring(0, 4);
|
||||
// }
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package org.jeecg.modules.service;
|
||||
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.entity.Cet4_major;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @Description: cet4_major
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-10-23
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ICet4MajorService extends IService<Cet4_major> {
|
||||
|
||||
Result<?> downloadTemplate(HttpServletResponse response);
|
||||
|
||||
Result<?> loadTable();
|
||||
|
||||
Result<?> importStudentData(HttpServletRequest request);
|
||||
|
||||
Result<?> asyncData();
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package org.jeecg.modules.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.entity.CetGraduates;
|
||||
|
||||
/**
|
||||
* @Description: 研究生数据表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-06-11
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ICetGraduatesService extends IService<CetGraduates> {
|
||||
|
||||
Result<String> add(CetGraduates cetGraduates);
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package org.jeecg.modules.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.entity.CetGroup;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 分组数据表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-06-12
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ICetGroupService extends IService<CetGroup> {
|
||||
|
||||
Result<?> batchHandleClassRooms(Map<String, Object> webData);
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package org.jeecg.modules.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.entity.CetInvigilateData;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 数据总表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-06-11
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ICetInvigilateDataService extends IService<CetInvigilateData> {
|
||||
|
||||
Result<String> add(CetInvigilateData cetInvigilateData);
|
||||
|
||||
Result<String> batchHandleGroup(Map<String, Object> webData);
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package org.jeecg.modules.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.entity.CetNoTeachers;
|
||||
|
||||
/**
|
||||
* @Description: 非教师数据表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-06-11
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ICetNoTeachersService extends IService<CetNoTeachers> {
|
||||
|
||||
Result<String> add(CetNoTeachers cetNoTeachers);
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package org.jeecg.modules.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.entity.CetTeachers;
|
||||
|
||||
/**
|
||||
* @Description: 教师数据表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-06-11
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ICetTeachersService extends IService<CetTeachers> {
|
||||
|
||||
Result<String> add(CetTeachers cetTeachers);
|
||||
|
||||
}
|
|
@ -2,14 +2,21 @@ package org.jeecg.modules.service;
|
|||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.dto.getRateByEntryDateDto;
|
||||
import org.jeecg.modules.dto.getRateByMajorAndLastestBatchDto;
|
||||
import org.jeecg.modules.entity.Cet_4;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: cet_4
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-03-26
|
||||
* @Date: 2024-03-26
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ICet_4Service extends IService<Cet_4> {
|
||||
|
@ -24,5 +31,19 @@ public interface ICet_4Service extends IService<Cet_4> {
|
|||
Result<JSONObject> getRateByMajor(JSONObject webData);
|
||||
|
||||
Result<JSONObject> getDataByStudent(JSONObject jsonObject);
|
||||
|
||||
JSONObject getGradeByBatch(Date batch, String college);
|
||||
|
||||
boolean cleanData();
|
||||
|
||||
Result<JSONObject> getRateByMajorAndLastestBatch(getRateByMajorAndLastestBatchDto getRateByMajorAndLastestBatchParam);
|
||||
|
||||
Result<JSONObject> getRateByEntryDate(getRateByEntryDateDto getRateByEntryDateDtoParams);
|
||||
|
||||
Result<JSONObject> loadImportDataList();
|
||||
|
||||
List<JSONObject> getJsonObjects(List<Map<String, Object>> list);
|
||||
|
||||
Result<JSONObject> getAnalyze(JSONObject webData);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,20 +1,22 @@
|
|||
package org.jeecg.modules.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.entity.Cet_6;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Description: cet_6
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-03-26
|
||||
* @Date: 2024-03-26
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ICet_6Service extends IService<Cet_6> {
|
||||
public Result<JSONObject> getRate(Cet_6 data);
|
||||
Result<JSONObject> getRate(Cet_6 data);
|
||||
|
||||
Result<?> getGrateRate();
|
||||
|
||||
Result<JSONObject> loadImportDataList();
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
package org.jeecg.modules.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.entity.ClassRoom;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 教室表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-06-11
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IClassRoomService extends IService<ClassRoom> {
|
||||
|
||||
Result<String> add(ClassRoom classRoom);
|
||||
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package org.jeecg.modules.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
|
@ -8,13 +9,11 @@ import org.jeecg.common.api.vo.Result;
|
|||
import org.jeecg.modules.entity.Cet4_major;
|
||||
import org.jeecg.modules.entity.Cet_4;
|
||||
import org.jeecg.modules.entity.Cet_4old;
|
||||
import org.jeecg.modules.entity.Cet_6;
|
||||
import org.jeecg.modules.mapper.Cet4_majorMapper;
|
||||
import org.jeecg.modules.mapper.Cet_4Mapper;
|
||||
import org.jeecg.modules.mapper.Cet_4oldMapper;
|
||||
import org.jeecg.modules.mapper.Cet_6Mapper;
|
||||
import org.jeecg.modules.service.CenterService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
@ -114,6 +113,29 @@ public class CenterServiceImpl extends ServiceImpl<Cet_4Mapper, Cet_4> implement
|
|||
return Result.ok(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getEntryDateByBatch(Date batch) {
|
||||
List<String> res=new ArrayList<>();
|
||||
String batchStr = DateUtil.format(batch, "yyyy-MM-dd");
|
||||
String[] dateArr = batchStr.split("-");
|
||||
//根据月份来判断是否是当年新生
|
||||
int month = Integer.parseInt(dateArr[1]);
|
||||
int year=Integer.parseInt(dateArr[0]);
|
||||
if (month < 10) {
|
||||
year--;
|
||||
}
|
||||
for(int i=0;i<4;i++){
|
||||
res.add(String.valueOf(year--));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T, R> Map<Object, Long> dealList(List<T> list, Function<T, R> mapper) {
|
||||
return list.stream().collect(Collectors.groupingBy(mapper,Collectors.counting()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 统计四级表和六级表中存在的批次
|
||||
*/
|
||||
|
@ -186,7 +208,7 @@ public class CenterServiceImpl extends ServiceImpl<Cet_4Mapper, Cet_4> implement
|
|||
@Override
|
||||
public Result<JSONObject> getData(String college, String major, String entryDate) {
|
||||
//判断是否存在缓存
|
||||
String key = "getData:"+college + major + entryDate;
|
||||
String key = "getData:" + college + major + entryDate;
|
||||
if (Boolean.TRUE.equals(redisTemplate.hasKey(key))) {
|
||||
System.out.println((JSONObject) redisTemplate.opsForValue().get(key));
|
||||
return Result.ok((JSONObject) redisTemplate.opsForValue().get(key));
|
||||
|
@ -238,35 +260,46 @@ public class CenterServiceImpl extends ServiceImpl<Cet_4Mapper, Cet_4> implement
|
|||
Cet_4QW.eq(Cet_4::getEntrydate, entryDate).eq(Cet_4::getBatch, batchList.get(i));
|
||||
//查询该年级的全校在籍学生
|
||||
Cet4_majorQW.clear();
|
||||
Cet4_majorQW.select(Cet4_major::getId).eq(Cet4_major::getEntrydate, entryDate).eq(Cet4_major::getState,"在校");
|
||||
Cet4_majorQW.select(Cet4_major::getCode).eq(Cet4_major::getEntrydate, entryDate).eq(Cet4_major::getState, "在校");
|
||||
allStudent = cet4_majorMapper.selectCount(Cet4_majorQW);
|
||||
} else if (college.equals("专升本")) {
|
||||
}else if(college.equals("全校(不含艺体美外语)")) {
|
||||
totalName = "全校";
|
||||
Cet_4QW.eq(Cet_4::getEntrydate, entryDate)
|
||||
.eq(Cet_4::getBatch, batchList.get(i))
|
||||
.eq(Cet_4::getState, "在校");
|
||||
Cet_4QW.notIn(Cet_4::getCollege, Arrays.asList("体育科学学院", "美术学院", "音乐学院", "国际美术学院"));
|
||||
Cet_4QW.notIn(Cet_4::getMajorname, Arrays.asList("英语","翻译", "商务英语", "表演","广播电视编导", "录音艺术", "播音与主持艺术","动画", "摄影", "数字媒体艺术","绘画","雕塑"));
|
||||
Cet4_majorQW.clear();
|
||||
Cet4_majorQW.select(Cet4_major::getCode).eq(Cet4_major::getEntrydate, entryDate).eq(Cet4_major::getState, "在校");
|
||||
allStudent = cet4_majorMapper.selectCount(Cet4_majorQW);
|
||||
|
||||
}else if (college.equals("专升本")) {
|
||||
totalName = "全校";
|
||||
Cet_4QW.eq(Cet_4::getLevel, college).eq(Cet_4::getEntrydate, entryDate).eq(Cet_4::getBatch, batchList.get(i));
|
||||
//查询该年级的专升本在籍学生
|
||||
Cet4_majorQW.clear();
|
||||
Cet4_majorQW.select(Cet4_major::getId).eq(Cet4_major::getLevel, college).eq(Cet4_major::getState,"在校").eq(Cet4_major::getEntrydate, entryDate);
|
||||
Cet4_majorQW.select(Cet4_major::getCode).eq(Cet4_major::getLevel, college).eq(Cet4_major::getState, "在校").eq(Cet4_major::getEntrydate, entryDate);
|
||||
allStudent = cet4_majorMapper.selectCount(Cet4_majorQW);
|
||||
} else if (major.equals("")) {
|
||||
totalName = "学院";
|
||||
Cet_4QW.eq(Cet_4::getCollege, college).eq(Cet_4::getEntrydate, entryDate).eq(Cet_4::getBatch, batchList.get(i));
|
||||
//查询该年级的学院在籍学生
|
||||
Cet4_majorQW.clear();
|
||||
Cet4_majorQW.select(Cet4_major::getId).eq(Cet4_major::getCollege, college).eq(Cet4_major::getState,"在校").eq(Cet4_major::getEntrydate, entryDate);
|
||||
Cet4_majorQW.select(Cet4_major::getCode).eq(Cet4_major::getCollege, college).eq(Cet4_major::getState, "在校").eq(Cet4_major::getEntrydate, entryDate);
|
||||
allStudent = cet4_majorMapper.selectCount(Cet4_majorQW);
|
||||
} else {
|
||||
totalName = "专业";
|
||||
//查询该年级的学院专业在籍学生
|
||||
Cet_4QW.eq(Cet_4::getCollege, college).eq(Cet_4::getMajorname, major).eq(Cet_4::getEntrydate, entryDate).eq(Cet_4::getBatch, batchList.get(i));
|
||||
Cet4_majorQW.clear();
|
||||
Cet4_majorQW.select(Cet4_major::getId).eq(Cet4_major::getCollege, college).eq(Cet4_major::getState,"在校").eq(Cet4_major::getMajorname, major).eq(Cet4_major::getEntrydate, entryDate);
|
||||
Cet4_majorQW.select(Cet4_major::getCode).eq(Cet4_major::getCollege, college).eq(Cet4_major::getState, "在校").eq(Cet4_major::getMajorname, major).eq(Cet4_major::getEntrydate, entryDate);
|
||||
allStudent = cet4_majorMapper.selectCount(Cet4_majorQW);
|
||||
}
|
||||
List<Map<String, Object>> Cet_4eEntrydate = cet4Mapper.selectMaps(Cet_4QW);
|
||||
|
||||
if (!Cet_4eEntrydate.isEmpty()) {
|
||||
for (Map<String, Object> map : Cet_4eEntrydate) {
|
||||
String str = (String) map.get("id");
|
||||
String str = (String) map.get("code");
|
||||
if ((int) map.get("result") >= 425) {
|
||||
attendMap4.put(str, 1);
|
||||
} else {
|
||||
|
@ -306,8 +339,8 @@ public class CenterServiceImpl extends ServiceImpl<Cet_4Mapper, Cet_4> implement
|
|||
json.put("batch", batchList.get(i));
|
||||
json.put("attendNumber", attendNumber4[i]);//每个年级的参加人数,
|
||||
json.put("passNumber", passNew4[i]);//每个年级的新通过人数
|
||||
json.put("batchpassrate", df.format((passNew4[i] / (double) attendNumber4[i])));//每个批次新通过人数/参加人数
|
||||
json.put("gradepassrate", df.format((passNumber[i] / (double) allStudent)));//累计通过 / 总人数
|
||||
json.put("batchpassrate", df.format(((attendNumber4[i] == 0) ? 0 : passNew4[i] / (double) attendNumber4[i])));//每个批次新通过人数/参加人数
|
||||
json.put("gradepassrate", df.format(((allStudent == 0) ? 0 : passNumber[i] / (double) allStudent)));//累计通过 / 总人数
|
||||
gradeArray.add(json);
|
||||
resultJson.put(grade[i / 2], gradeArray);
|
||||
} else {
|
||||
|
@ -317,8 +350,8 @@ public class CenterServiceImpl extends ServiceImpl<Cet_4Mapper, Cet_4> implement
|
|||
json.put("batch", batchList.get(j));
|
||||
json.put("attendNumber", attendNumber4[j]);//每个年级的参加人数,
|
||||
json.put("passNumber", passNew4[j]);//每个年级的新通过人数
|
||||
json.put("batchpassrate", df.format((passNew4[j] / (double) attendNumber4[i])));//每个批次新通过人数/参加人数
|
||||
json.put("gradepassrate", df.format((passNumber[i + 1] / (double) allStudent)));//累计通过 / 总人数
|
||||
json.put("batchpassrate", df.format(((attendNumber4[j] == 0) ? 0 : passNew4[j] / (double) attendNumber4[j])));//每个批次新通过人数/参加人数
|
||||
json.put("gradepassrate", df.format(((allStudent == 0) ? 0 : passNumber[i + 1] / (double) allStudent)));//累计通过 / 总人数
|
||||
gradeArray.add(json);
|
||||
}
|
||||
resultJson.put(grade[i / 2], gradeArray);
|
||||
|
@ -329,8 +362,9 @@ public class CenterServiceImpl extends ServiceImpl<Cet_4Mapper, Cet_4> implement
|
|||
result.put("cet4", resultJson);
|
||||
result.put("total", allStudent);//总人数
|
||||
result.put("totalName", totalName);//总人数
|
||||
result.put("passNumber",passNumber[n - 1]);//累计通过人数
|
||||
result.put("passRate", df.format((passNumber[n - 1] / (double) allStudent)));//累计通过率
|
||||
result.put("passNumber", passNumber[n - 1]);//累计通过人数
|
||||
result.put("passRate", df.format(((allStudent == 0) ? 0 : passNumber[n - 1] / (double) allStudent)));//累计通过率
|
||||
|
||||
// 将数据存入缓存
|
||||
redisTemplate.opsForValue().set(key, result, Duration.ofDays(7));
|
||||
return Result.ok(result);
|
||||
|
@ -344,25 +378,25 @@ public class CenterServiceImpl extends ServiceImpl<Cet_4Mapper, Cet_4> implement
|
|||
List<Cet_4old> list = cet4oldMapper.selectList(null);
|
||||
|
||||
// 准备id列表,用于批量查询
|
||||
List<String> idList = list.stream().map(Cet_4old::getId).collect(Collectors.toList());
|
||||
List<String> idList = list.stream().map(Cet_4old::getCode).collect(Collectors.toList());
|
||||
|
||||
// 批量查询专业信息
|
||||
cet4_majorQW.in(Cet4_major::getId, idList);
|
||||
cet4_majorQW.select(Cet4_major::getId, Cet4_major::getMajorname, Cet4_major::getLevel, Cet4_major::getState, Cet4_major::getEntrydate);
|
||||
cet4_majorQW.in(Cet4_major::getCode, idList);
|
||||
cet4_majorQW.select(Cet4_major::getCode, Cet4_major::getMajorname, Cet4_major::getLevel, Cet4_major::getState, Cet4_major::getEntrydate);
|
||||
List<Map<String, Object>> mapList = cet4_majorMapper.selectMaps(cet4_majorQW);
|
||||
|
||||
// 将专业信息写入学生对象
|
||||
Map<Object, Map<String, Object>> idToMap = mapList.stream().collect(Collectors.toMap(
|
||||
map -> map.get("id"),
|
||||
map -> map.get("code"),
|
||||
Function.identity()
|
||||
));
|
||||
int temp = 0;
|
||||
List<Cet_4> cet4List = new ArrayList<>();
|
||||
//以当前所在年级为入学年份
|
||||
for (Cet_4old cet4old : list) {
|
||||
Map<String, Object> map_major = idToMap.get(cet4old.getId());
|
||||
Map<String, Object> map_major = idToMap.get(cet4old.getCode());
|
||||
Cet_4 cet4 = new Cet_4();
|
||||
cet4.setId(cet4old.getId());
|
||||
cet4.setCode(cet4old.getCode());
|
||||
cet4.setName(cet4old.getName());
|
||||
cet4.setCollege(cet4old.getCollege());
|
||||
cet4.setResult(cet4old.getResult());
|
||||
|
@ -375,7 +409,7 @@ public class CenterServiceImpl extends ServiceImpl<Cet_4Mapper, Cet_4> implement
|
|||
cet4.setLevel((String) map_major.get("level"));
|
||||
cet4.setState((String) map_major.get("state"));
|
||||
cet4List.add(cet4);
|
||||
System.out.println(temp++ + ",id:" + cet4.getId() + " ,majorname:" + cet4.getMajorname() + " ,level:" + cet4.getLevel() + " ,state:" + cet4.getState());
|
||||
System.out.println(temp++ + ",id:" + cet4.getCode() + " ,majorname:" + cet4.getMajorname() + " ,level:" + cet4.getLevel() + " ,state:" + cet4.getState());
|
||||
}
|
||||
System.out.println(cet4List.size());
|
||||
// 批量更新
|
||||
|
@ -390,30 +424,4 @@ public class CenterServiceImpl extends ServiceImpl<Cet_4Mapper, Cet_4> implement
|
|||
}
|
||||
|
||||
|
||||
// @Override
|
||||
// public Result<JSONObject> getTest() {
|
||||
// //去除不在学籍表中的学生
|
||||
// LambdaQueryWrapper<Cet4_major> Cet4_majorQW = new LambdaQueryWrapper<>();
|
||||
// Cet4_majorQW.select(Cet4_major::getId);
|
||||
// List<Object> list = cet4_majorMapper.selectObjs(Cet4_majorQW);
|
||||
// System.out.println("所有符合的学号:"+list.size());//所有符合的学号
|
||||
// LambdaQueryWrapper<Cet_4> Cet_4QW = new LambdaQueryWrapper<>();
|
||||
// Cet_4QW.select(Cet_4::getId);
|
||||
// List<Object> list1 = cet4Mapper.selectObjs(Cet_4QW);
|
||||
// System.out.println("所有参加过四级考试的学生:"+list1.size());//所有参加过四级考试的学生
|
||||
// //删除所有参加过四级考试的学生中不符合的学号
|
||||
// List<Object> notin = new ArrayList<>();
|
||||
// for (Object obj : list1) {
|
||||
// if (!list.contains(obj)) {
|
||||
// notin.add(obj);
|
||||
// }
|
||||
// }
|
||||
// System.out.println("不符合的学号:"+notin.size());//不符合的学号
|
||||
// //批量删除list1中notin的学号
|
||||
// Cet_4QW.clear();
|
||||
// Cet_4QW.in(Cet_4::getId, notin);
|
||||
// cet4Mapper.delete(Cet_4QW);
|
||||
// System.out.println("删除完成");
|
||||
// return null;
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -0,0 +1,172 @@
|
|||
package org.jeecg.modules.service.impl;
|
||||
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.context.AnalysisContext;
|
||||
import com.alibaba.excel.event.AnalysisEventListener;
|
||||
import com.alibaba.excel.support.ExcelTypeEnum;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.config.ThreadPoolManager;
|
||||
import org.jeecg.modules.entity.Cet4_major;
|
||||
import org.jeecg.modules.mapper.Cet4_majorMapper;
|
||||
import org.jeecg.modules.pojo.CetStudent;
|
||||
import org.jeecg.modules.runnable.CetDataAsync;
|
||||
import org.jeecg.modules.service.ICet4MajorService;
|
||||
import org.jeecg.modules.service.ICet_4Service;
|
||||
import org.jeecg.modules.service.ICet_6Service;
|
||||
import org.jeecg.modules.utils.ExportUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Description: cet4_major
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-10-23
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class Cet4MajorServiceImpl extends ServiceImpl<Cet4_majorMapper, Cet4_major> implements ICet4MajorService {
|
||||
private final String CET_STUDENT_IMPORT_TEMPLATE = "template/cetStudentImportTemplate.xls";
|
||||
private final String CET_STUDENT_FILE_TEMPLATE_NAME = "四六级学生信息导入模版.xlsx";
|
||||
|
||||
@Autowired
|
||||
private ICet_6Service cet6Service;
|
||||
@Autowired
|
||||
ICet_4Service cet4Service;
|
||||
@Autowired
|
||||
@Lazy
|
||||
private ICet4MajorService cet4MajorService;
|
||||
|
||||
@Override
|
||||
public Result<?> downloadTemplate(HttpServletResponse response) {
|
||||
try {
|
||||
ExportUtil.downloadExcelTemplate(response, CET_STUDENT_FILE_TEMPLATE_NAME, CET_STUDENT_IMPORT_TEMPLATE);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<?> loadTable() {
|
||||
QueryWrapper<Cet4_major> wrapper = new QueryWrapper<>();
|
||||
wrapper.select("entrydate", "count(*) as studentNumber")
|
||||
.groupBy("entrydate");
|
||||
List<Map<String, Object>> list = this.listMaps(wrapper);
|
||||
// 倒序排序
|
||||
list = list.stream().filter(e -> e.get("entrydate") != null).collect(Collectors.toList());
|
||||
list.sort(Comparator.comparing((Map<String, Object> o) -> ((String) o.get("entrydate"))).reversed());
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("data", list);
|
||||
return Result.OK(jsonObject);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<?> importStudentData(HttpServletRequest request) {
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
|
||||
// 获取上传文件对象
|
||||
MultipartFile file = entity.getValue();
|
||||
if (file.isEmpty()) {
|
||||
// 文件为空,进行处理(例如,返回错误信息)
|
||||
return Result.error("上传的文件为空!");
|
||||
}
|
||||
try {
|
||||
/**'
|
||||
* 1. 读取表格
|
||||
*/
|
||||
ArrayList<CetStudent> furnitureArrayList = new ArrayList<>();
|
||||
//使用EasyExcel读取excel文件
|
||||
EasyExcel.read(file.getInputStream(), CetStudent.class, new AnalysisEventListener<CetStudent>() {
|
||||
@Override
|
||||
public void invoke(CetStudent furniture, AnalysisContext analysisContext) {
|
||||
System.out.println(furniture);
|
||||
// 将读取到的数据存储到 list 集合里
|
||||
furnitureArrayList.add(furniture);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doAfterAllAnalysed(AnalysisContext analysisContext) {
|
||||
// 读取完后的操作
|
||||
}
|
||||
}).excelType(ExcelTypeEnum.XLS).sheet().doRead();
|
||||
System.out.println(furnitureArrayList);
|
||||
/**
|
||||
* 将表格list用set为实体类
|
||||
*/
|
||||
ArrayList<Cet4_major> rmsFurnitureArrayList = new ArrayList<>();
|
||||
Timestamp timestamp = new Timestamp(System.currentTimeMillis());
|
||||
for (CetStudent cetStudent : furnitureArrayList) {
|
||||
Cet4_major cet4Major = new Cet4_major();
|
||||
cet4Major.setMajorId(cetStudent.getMajorId());
|
||||
cet4Major.setMajorname(cetStudent.getMajorname());
|
||||
cet4Major.setCode(cetStudent.getCode());
|
||||
cet4Major.setName(cetStudent.getName());
|
||||
cet4Major.setCollege(cetStudent.getCollege());
|
||||
cet4Major.setClassName(cetStudent.getClassName());
|
||||
cet4Major.setEducate(cetStudent.getEducate());
|
||||
cet4Major.setEntrydate(cetStudent.getEntrydate());
|
||||
cet4Major.setCampus(cetStudent.getCampus());
|
||||
cet4Major.setState(cetStudent.getState());
|
||||
cet4Major.setLevel(cetStudent.getLevel());
|
||||
cet4Major.setCategory(cetStudent.getCategory());
|
||||
|
||||
rmsFurnitureArrayList.add(cet4Major);
|
||||
}
|
||||
System.out.println(rmsFurnitureArrayList.size());
|
||||
/**
|
||||
* 遍历list save
|
||||
*/
|
||||
saveBatch(rmsFurnitureArrayList, 10000);
|
||||
System.out.println("插入成功");
|
||||
Timestamp timestamp2 = new Timestamp(System.currentTimeMillis());
|
||||
long millisecondsDiff = timestamp2.getTime() - timestamp.getTime();
|
||||
long secondsDiff = millisecondsDiff / 1000;
|
||||
System.out.println("时间差为:" + secondsDiff + " 秒");
|
||||
return Result.ok("文件导入成功!数据行数:" + rmsFurnitureArrayList.size());
|
||||
} catch (Exception e) {
|
||||
//update-begin-author:taoyan date:20211124 for: 导入数据重复增加提示
|
||||
String msg = e.getMessage();
|
||||
log.error(msg, e);
|
||||
if (msg != null && msg.indexOf("Duplicate entry") >= 0) {
|
||||
return Result.error("文件导入失败:有重复数据!");
|
||||
} else {
|
||||
return Result.error("文件导入失败:" + e.getMessage());
|
||||
}
|
||||
//update-end-author:taoyan date:20211124 for: 导入数据重复增加提示
|
||||
} finally {
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return Result.error("文件导入失败!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<?> asyncData() {
|
||||
//异步同步数据
|
||||
ThreadPoolExecutor executor = ThreadPoolManager.getExecutor();
|
||||
executor.execute(new CetDataAsync(cet6Service,cet4Service,cet4MajorService));
|
||||
return Result.ok();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
package org.jeecg.modules.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
|
||||
import org.jeecg.modules.entity.CetGraduates;
|
||||
import org.jeecg.modules.entity.CetInvigilateData;
|
||||
import org.jeecg.modules.mapper.CetGraduatesMapper;
|
||||
import org.jeecg.modules.mapper.CetInvigilateDataMapper;
|
||||
import org.jeecg.modules.service.ICetGraduatesService;
|
||||
import org.jeecg.modules.service.ICetInvigilateDataService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.DataIntegrityViolationException;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.yaml.snakeyaml.constructor.DuplicateKeyException;
|
||||
|
||||
/**
|
||||
* @Description: 研究生数据表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-06-11
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class CetGraduatesServiceImpl extends ServiceImpl<CetGraduatesMapper, CetGraduates> implements ICetGraduatesService {
|
||||
|
||||
private final ICetInvigilateDataService cetInvigilateDataService; // 只注入 Service,不注入 Mapper
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result<String> add(CetGraduates cetGraduates) {
|
||||
try {
|
||||
// 1. 参数校验(也可放到 @Validated + @Controller 处理)
|
||||
if (StringUtils.isBlank(cetGraduates.getGraduatesName())) {
|
||||
return Result.error("研究生姓名不能为空");
|
||||
}
|
||||
if (StringUtils.isBlank(cetGraduates.getStudentNumber())) {
|
||||
return Result.error("学号不能为空");
|
||||
}
|
||||
|
||||
// 2. 检查学号是否已存在(使用 lambdaQuery 是 MyBatis-Plus 的推荐做法)
|
||||
boolean exists = lambdaQuery()
|
||||
.eq(CetGraduates::getStudentNumber, cetGraduates.getStudentNumber())
|
||||
.exists();
|
||||
if (exists) {
|
||||
return Result.error("该学号已存在");
|
||||
}
|
||||
|
||||
// 3. 保存总表数据(调用 service 层,防止绕过事务控制)
|
||||
CetInvigilateData masterData = new CetInvigilateData();
|
||||
masterData.setName(cetGraduates.getGraduatesName());
|
||||
masterData.setType("研究生");
|
||||
|
||||
if (!cetInvigilateDataService.save(masterData)) {
|
||||
throw new RuntimeException("总表数据保存失败");
|
||||
}
|
||||
|
||||
// 4. 设置主表 ID 并保存研究生信息
|
||||
cetGraduates.setId(masterData.getId());
|
||||
|
||||
if (!this.save(cetGraduates)) {
|
||||
throw new RuntimeException("研究生数据保存失败");
|
||||
}
|
||||
|
||||
return Result.ok("添加成功");
|
||||
|
||||
} catch (DuplicateKeyException e) {
|
||||
return Result.error("数据已存在,请勿重复添加");
|
||||
} catch (DataIntegrityViolationException e) {
|
||||
return Result.error("数据不完整: " + e.getMostSpecificCause().getMessage());
|
||||
} catch (Exception e) {
|
||||
log.error("添加研究生 [{}] 异常:{}", cetGraduates.getGraduatesName(), e.getMessage(), e);
|
||||
return Result.error("系统异常,请联系管理员");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,113 @@
|
|||
package org.jeecg.modules.service.impl;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.entity.CetGroup;
|
||||
import org.jeecg.modules.entity.ClassRoom;
|
||||
import org.jeecg.modules.mapper.CetGroupMapper;
|
||||
import org.jeecg.modules.mapper.ClassRoomMapper;
|
||||
import org.jeecg.modules.service.ICetGroupService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Description: 分组数据表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-06-12
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class CetGroupServiceImpl extends ServiceImpl<CetGroupMapper, CetGroup> implements ICetGroupService {
|
||||
@Autowired
|
||||
private CetGroupMapper cetGroupMapper;
|
||||
@Autowired
|
||||
private ClassRoomMapper classRoomMapper;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Result<?> batchHandleClassRooms(Map<String, Object> webData) {
|
||||
Object idsObj = webData.get("ids");
|
||||
if (!(idsObj instanceof List)) {
|
||||
return Result.error("参数错误:未找到班级 ID 列表");
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
List<String> groupIds = (List<String>) idsObj;
|
||||
|
||||
if (CollectionUtils.isEmpty(groupIds)) {
|
||||
return Result.error("请选择需要分配教室的班级");
|
||||
}
|
||||
|
||||
// 查询空闲教室(status = 0)
|
||||
List<ClassRoom> freeRooms = classRoomMapper.selectList(
|
||||
new LambdaQueryWrapper<ClassRoom>().eq(ClassRoom::getStatus, 0)
|
||||
);
|
||||
|
||||
// 查询所有分组名称,构造 Map<groupId, groupName>
|
||||
List<CetGroup> groups = cetGroupMapper.selectBatchIds(groupIds);
|
||||
Map<String, String> groupIdNameMap = groups.stream()
|
||||
.collect(Collectors.toMap(CetGroup::getId, CetGroup::getGroupName));
|
||||
|
||||
List<String> failedGroupIds = new ArrayList<>();
|
||||
|
||||
int minSize = Math.min(groupIds.size(), freeRooms.size());
|
||||
|
||||
for (int i = 0; i < minSize; i++) {
|
||||
String groupId = groupIds.get(i);
|
||||
ClassRoom room = freeRooms.get(i);
|
||||
|
||||
boolean updated = classRoomMapper.update(
|
||||
null,
|
||||
new LambdaUpdateWrapper<ClassRoom>()
|
||||
.eq(ClassRoom::getId, room.getId())
|
||||
.eq(ClassRoom::getStatus, 0)
|
||||
.set(ClassRoom::getGroupId, groupId)
|
||||
.set(ClassRoom::getStatus, 1)
|
||||
) > 0;
|
||||
|
||||
if (!updated) {
|
||||
failedGroupIds.add(groupId);
|
||||
continue;
|
||||
}
|
||||
|
||||
cetGroupMapper.update(
|
||||
null,
|
||||
new LambdaUpdateWrapper<CetGroup>()
|
||||
.eq(CetGroup::getId, groupId)
|
||||
.set(CetGroup::getRoomId, room.getId())
|
||||
);
|
||||
}
|
||||
|
||||
// 如果教室不够,则剩下的也视为失败
|
||||
if (groupIds.size() > freeRooms.size()) {
|
||||
for (int i = freeRooms.size(); i < groupIds.size(); i++) {
|
||||
failedGroupIds.add(groupIds.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
// 构造返回消息
|
||||
String message = "成功为 " + (groupIds.size() - failedGroupIds.size()) + " 个分组分配教室。";
|
||||
if (!failedGroupIds.isEmpty()) {
|
||||
List<String> failedGroupNames = failedGroupIds.stream()
|
||||
.map(id -> groupIdNameMap.getOrDefault(id, "未知分组(ID=" + id + ")"))
|
||||
.collect(Collectors.toList());
|
||||
message += " 以下分组未分配到教室:" + String.join(", ", failedGroupNames);
|
||||
}
|
||||
|
||||
return Result.ok(message);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,213 @@
|
|||
package org.jeecg.modules.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.extension.toolkit.Db;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.entity.*;
|
||||
import org.jeecg.modules.mapper.CetGraduatesMapper;
|
||||
import org.jeecg.modules.mapper.CetInvigilateDataMapper;
|
||||
import org.jeecg.modules.mapper.CetNoTeachersMapper;
|
||||
import org.jeecg.modules.mapper.CetTeachersMapper;
|
||||
import org.jeecg.modules.service.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @Description: 数据总表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-06-11
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Transactional
|
||||
public class CetInvigilateDataServiceImpl extends ServiceImpl<CetInvigilateDataMapper, CetInvigilateData> implements ICetInvigilateDataService {
|
||||
|
||||
@Autowired
|
||||
private CetTeachersMapper cetTeachersMapper;
|
||||
@Autowired
|
||||
private CetGraduatesMapper cetGraduatesMapper;
|
||||
@Autowired
|
||||
private CetNoTeachersMapper cetNoTeachersMapper;
|
||||
@Autowired
|
||||
private CetInvigilateDataMapper cetInvigilateDataMapper;
|
||||
@Autowired
|
||||
private ICetGroupService cetGroupService;
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Result<String> add(CetInvigilateData cetInvigilateData) {
|
||||
try {
|
||||
|
||||
boolean masterSaved = this.save(cetInvigilateData); // MyBatis-Plus 的 save()
|
||||
if (!masterSaved) {
|
||||
throw new RuntimeException("总表数据保存失败");
|
||||
}
|
||||
|
||||
// 获取自动生成的 ID
|
||||
String masterId = cetInvigilateData.getId();
|
||||
|
||||
switch (cetInvigilateData.getType()) {
|
||||
case "教师":
|
||||
CetTeachers cetTeachers = BeanUtil.copyProperties(cetInvigilateData, CetTeachers.class);
|
||||
cetTeachers.setId(masterId);
|
||||
cetTeachers.setTeacherName(cetInvigilateData.getName());
|
||||
cetTeachers.setJobNumber(cetInvigilateData.getCode());
|
||||
if (cetTeachersMapper.insert(cetTeachers) <= 0) {
|
||||
throw new RuntimeException("教师信息保存失败");
|
||||
}
|
||||
break;
|
||||
|
||||
case "研究生":
|
||||
CetGraduates cetGraduates = BeanUtil.copyProperties(cetInvigilateData, CetGraduates.class);
|
||||
cetGraduates.setId(masterId);
|
||||
cetGraduates.setGraduatesName(cetInvigilateData.getName());
|
||||
cetGraduates.setStudentNumber(cetInvigilateData.getCode());
|
||||
if (cetGraduatesMapper.insert(cetGraduates) <= 0) {
|
||||
throw new RuntimeException("研究生信息保存失败");
|
||||
}
|
||||
break;
|
||||
|
||||
case "非教师":
|
||||
CetNoTeachers cetNoTeachers = BeanUtil.copyProperties(cetInvigilateData, CetNoTeachers.class);
|
||||
cetNoTeachers.setId(masterId);
|
||||
if (cetNoTeachersMapper.insert(cetNoTeachers) <= 0) {
|
||||
throw new RuntimeException("非教师信息保存失败");
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new RuntimeException("数据类型不存在!!");
|
||||
}
|
||||
|
||||
return Result.ok("添加成功!!");
|
||||
} catch (Exception e) {
|
||||
return Result.error("添加失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<String> batchHandleGroup(Map<String, Object> webData) {
|
||||
List<String> ids = (List<String>) webData.get("ids");
|
||||
if (ids == null || ids.isEmpty()) {
|
||||
return Result.error("ID列表为空");
|
||||
}
|
||||
|
||||
List<CetInvigilateData> users = cetInvigilateDataMapper.selectBatchIds(ids);
|
||||
|
||||
List<CetInvigilateData> maleTeachers = new ArrayList<>();
|
||||
List<CetInvigilateData> femaleTeachers = new ArrayList<>();
|
||||
List<CetInvigilateData> maleOthers = new ArrayList<>();
|
||||
List<CetInvigilateData> femaleOthers = new ArrayList<>();
|
||||
List<CetInvigilateData> maleGraduates = new ArrayList<>();
|
||||
List<CetInvigilateData> femaleGraduates = new ArrayList<>();
|
||||
|
||||
for (CetInvigilateData user : users) {
|
||||
String type = user.getType();
|
||||
String sex = user.getSex();
|
||||
boolean isMale = "男".equals(sex);
|
||||
|
||||
switch (type) {
|
||||
case "教师":
|
||||
if (isMale) maleTeachers.add(user);
|
||||
else femaleTeachers.add(user);
|
||||
break;
|
||||
case "研究生":
|
||||
if (isMale) maleGraduates.add(user);
|
||||
else femaleGraduates.add(user);
|
||||
break;
|
||||
default:
|
||||
if (isMale) maleOthers.add(user);
|
||||
else femaleOthers.add(user);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
List<List<CetInvigilateData>> groups = new ArrayList<>();
|
||||
|
||||
// 分组逻辑
|
||||
while (!maleTeachers.isEmpty() && !femaleOthers.isEmpty()) {
|
||||
groups.add(Arrays.asList(maleTeachers.remove(0), femaleOthers.remove(0)));
|
||||
}
|
||||
while (!femaleTeachers.isEmpty() && !maleOthers.isEmpty()) {
|
||||
groups.add(Arrays.asList(femaleTeachers.remove(0), maleOthers.remove(0)));
|
||||
}
|
||||
while (!maleTeachers.isEmpty() && !femaleTeachers.isEmpty()) {
|
||||
groups.add(Arrays.asList(maleTeachers.remove(0), femaleTeachers.remove(0)));
|
||||
}
|
||||
while (!maleTeachers.isEmpty() && !femaleGraduates.isEmpty()) {
|
||||
groups.add(Arrays.asList(maleTeachers.remove(0), femaleGraduates.remove(0)));
|
||||
}
|
||||
while (!femaleTeachers.isEmpty() && !maleGraduates.isEmpty()) {
|
||||
groups.add(Arrays.asList(femaleTeachers.remove(0), maleGraduates.remove(0)));
|
||||
}
|
||||
|
||||
int index = 1;
|
||||
for (List<CetInvigilateData> group : groups) {
|
||||
// 中文数字组名
|
||||
String groupName = "第" + toChineseNumber(index) + "组";
|
||||
|
||||
CetGroup cetGroup = new CetGroup()
|
||||
.setGroupName(groupName)
|
||||
.setRoomId("") // 可选
|
||||
.setCreateBy("system") // 建议替换为当前用户
|
||||
.setCreateTime(new Date())
|
||||
.setSysOrgCode("default");
|
||||
|
||||
cetGroupService.save(cetGroup); // 保存组,自动生成 ID
|
||||
String groupId = cetGroup.getId();
|
||||
|
||||
// 设置组ID并更新每位成员
|
||||
for (CetInvigilateData member : group) {
|
||||
member.setGroupId(groupId);
|
||||
cetInvigilateDataMapper.updateById(member);
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
int successCount = groups.size();
|
||||
int total = ids.size() / 2;
|
||||
return Result.ok("共成功组队:" + successCount + " 组,失败:" + (total - successCount) + " 组");
|
||||
}
|
||||
|
||||
private String toChineseNumber(int num) {
|
||||
String[] numChinese = {"零", "一", "二", "三", "四", "五", "六", "七", "八", "九"};
|
||||
String[] units = {"", "十", "百", "千"};
|
||||
if (num <= 0) return "";
|
||||
|
||||
StringBuilder result = new StringBuilder();
|
||||
String numStr = String.valueOf(num);
|
||||
int length = numStr.length();
|
||||
|
||||
for (int i = 0; i < length; i++) {
|
||||
int digit = numStr.charAt(i) - '0';
|
||||
int position = length - i - 1;
|
||||
|
||||
if (digit != 0) {
|
||||
if (!(digit == 1 && position == 1 && result.length() == 0)) {
|
||||
result.append(numChinese[digit]);
|
||||
}
|
||||
result.append(units[position]);
|
||||
} else {
|
||||
// Append "零" only if next digit is non-zero and not at the end
|
||||
if (i < length - 1 && numStr.charAt(i + 1) != '0') {
|
||||
result.append("零");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
package org.jeecg.modules.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.entity.CetInvigilateData;
|
||||
import org.jeecg.modules.entity.CetNoTeachers;
|
||||
import org.jeecg.modules.mapper.CetNoTeachersMapper;
|
||||
import org.jeecg.modules.service.ICetInvigilateDataService;
|
||||
import org.jeecg.modules.service.ICetNoTeachersService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.DataIntegrityViolationException;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.yaml.snakeyaml.constructor.DuplicateKeyException;
|
||||
|
||||
/**
|
||||
* @Description: 非教师数据表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-06-11
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class CetNoTeachersServiceImpl extends ServiceImpl<CetNoTeachersMapper, CetNoTeachers> implements ICetNoTeachersService {
|
||||
private final ICetInvigilateDataService cetInvigilateDataService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result<String> add(CetNoTeachers cetNoTeachers) {
|
||||
try {
|
||||
// 1. 构造总表对象
|
||||
CetInvigilateData masterData = new CetInvigilateData();
|
||||
BeanUtils.copyProperties(cetNoTeachers, masterData);
|
||||
masterData.setType("非教师"); // 设置类型标识
|
||||
masterData.setName(cetNoTeachers.getName());
|
||||
|
||||
// 2. 保存总表数据
|
||||
if (!cetInvigilateDataService.save(masterData)) {
|
||||
throw new RuntimeException("总表数据保存失败");
|
||||
}
|
||||
|
||||
// 3. 设置主表生成的 ID 到分表中
|
||||
cetNoTeachers.setId(masterData.getId());
|
||||
|
||||
// 4. 保存非教师分表数据
|
||||
if (!this.save(cetNoTeachers)) {
|
||||
throw new RuntimeException("非教师数据保存失败");
|
||||
}
|
||||
|
||||
return Result.ok("添加成功!");
|
||||
|
||||
} catch (DuplicateKeyException e) {
|
||||
return Result.error("该非教师信息已存在");
|
||||
} catch (DataIntegrityViolationException e) {
|
||||
return Result.error("数据完整性错误: " + e.getMostSpecificCause().getMessage());
|
||||
} catch (Exception e) {
|
||||
log.error("添加非教师数据异常: {}", e.getMessage(), e);
|
||||
return Result.error("系统错误: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
package org.jeecg.modules.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.beanutils.BeanUtils;
|
||||
import org.apache.ibatis.type.TypeAliasRegistry;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.entity.CetInvigilateData;
|
||||
import org.jeecg.modules.entity.CetTeachers;
|
||||
import org.jeecg.modules.mapper.CetTeachersMapper;
|
||||
import org.jeecg.modules.service.ICetInvigilateDataService;
|
||||
import org.jeecg.modules.service.ICetTeachersService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.DataIntegrityViolationException;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.yaml.snakeyaml.constructor.DuplicateKeyException;
|
||||
|
||||
/**
|
||||
* @Description: 教师数据表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-06-11
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class CetTeachersServiceImpl extends ServiceImpl<CetTeachersMapper, CetTeachers> implements ICetTeachersService {
|
||||
private final ICetInvigilateDataService cetInvigilateDataService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result<String> add(CetTeachers teacher) {
|
||||
try {
|
||||
// 1. 参数校验
|
||||
if (StringUtils.isBlank(teacher.getTeacherName())) {
|
||||
return Result.error("教师姓名不能为空");
|
||||
}
|
||||
|
||||
// 2. 检查教师工号是否已存在
|
||||
boolean exists = lambdaQuery()
|
||||
.eq(CetTeachers::getJobNumber, teacher.getJobNumber())
|
||||
.exists();
|
||||
if (exists) {
|
||||
return Result.error("该教师工号已存在");
|
||||
}
|
||||
|
||||
// 3. 保存总表数据
|
||||
CetInvigilateData master = new CetInvigilateData();
|
||||
master.setName(teacher.getTeacherName());
|
||||
master.setType("教师"); // 中文类型标识,用于区分不同身份
|
||||
|
||||
if (!cetInvigilateDataService.save(master)) {
|
||||
throw new RuntimeException("总表数据保存失败");
|
||||
}
|
||||
|
||||
// 4. 设置总表ID为教师ID,保存教师信息
|
||||
teacher.setId(master.getId());
|
||||
if (!this.save(teacher)) {
|
||||
throw new RuntimeException("教师数据保存失败");
|
||||
}
|
||||
|
||||
return Result.ok("添加成功");
|
||||
|
||||
} catch (DuplicateKeyException e) {
|
||||
return Result.error("数据已存在,请勿重复添加");
|
||||
} catch (DataIntegrityViolationException e) {
|
||||
return Result.error("数据不完整: " + e.getMostSpecificCause().getMessage());
|
||||
} catch (Exception e) {
|
||||
log.error("添加教师 [{}] 异常: {}", teacher.getTeacherName(), e.getMessage(), e);
|
||||
return Result.error("系统错误: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -3,10 +3,13 @@ package org.jeecg.modules.service.impl;
|
|||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.dto.getRateByEntryDateDto;
|
||||
import org.jeecg.modules.dto.getRateByMajorAndLastestBatchDto;
|
||||
import org.jeecg.modules.entity.Cet4_major;
|
||||
import org.jeecg.modules.entity.CetClean;
|
||||
import org.jeecg.modules.entity.Cet_4;
|
||||
|
@ -15,12 +18,11 @@ import org.jeecg.modules.mapper.Cet_4Mapper;
|
|||
import org.jeecg.modules.service.CenterService;
|
||||
import org.jeecg.modules.service.CetCleanService;
|
||||
import org.jeecg.modules.service.ICet_4Service;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.ParseException;
|
||||
|
@ -36,9 +38,9 @@ import java.util.stream.Collectors;
|
|||
*/
|
||||
@Service
|
||||
public class Cet_4ServiceImpl extends ServiceImpl<Cet_4Mapper, Cet_4> implements ICet_4Service {
|
||||
@Autowired
|
||||
@Resource
|
||||
Cet_4Mapper cet4Mapper;
|
||||
@Autowired
|
||||
@Resource
|
||||
Cet4_majorMapper cet4_MajorMapper;
|
||||
@Resource
|
||||
private CenterService centerService;
|
||||
|
@ -91,51 +93,63 @@ public class Cet_4ServiceImpl extends ServiceImpl<Cet_4Mapper, Cet_4> implements
|
|||
|
||||
@Override
|
||||
public Result<JSONObject> getRateByBatch(String college, String batchStr) {
|
||||
|
||||
// if (redisTemplate.opsForValue().get("getRateByBatch" + college + batchStr) != null) {
|
||||
// return Result.ok((JSONObject) redisTemplate.opsForValue().get("getRateByBatch" + college + batchStr));
|
||||
// }
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
DecimalFormat decimalFormat = new DecimalFormat("#.#");
|
||||
Date batch;
|
||||
try {
|
||||
batch = dateFormat.parse(batchStr);
|
||||
} catch (ParseException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
// 根据批次获得正确的年级
|
||||
List<String> trueEntryDate = centerService.getEntryDateByBatch(batch);
|
||||
|
||||
JSONObject jsonObject = new JSONObject(new LinkedHashMap<>());
|
||||
JSONObject resultData = new JSONObject();
|
||||
|
||||
LambdaQueryWrapper<Cet_4> queryWrapper = new LambdaQueryWrapper<>();
|
||||
//构造查询条件
|
||||
Map<String, List<Cet_4>> collect;
|
||||
|
||||
queryWrapper.eq(Cet_4::getBatch, batch).eq(!college.equals("全校"), Cet_4::getCollege, college);
|
||||
List<Cet_4> allStudentList = list(queryWrapper);
|
||||
//根据批次查人数
|
||||
|
||||
queryWrapper.ge(Cet_4::getResult, 425);
|
||||
List<Cet_4> passedList = cet4Mapper.selectList(queryWrapper);
|
||||
passedList = passedList.stream().filter(e -> trueEntryDate.contains(e.getEntrydate())).collect(Collectors.toList());
|
||||
if (college.equals("全校")) {
|
||||
queryWrapper.eq(Cet_4::getBatch, batch).ge(Cet_4::getResult, 425);
|
||||
List<Cet_4> result = cet4Mapper.selectList(queryWrapper);
|
||||
collect = result.stream().collect(Collectors.groupingBy(Cet_4::getCollege));
|
||||
//获取全校人数
|
||||
long allStudent = getNumAll(batch);
|
||||
//获取全校通过人数
|
||||
LambdaQueryWrapper<Cet_4> passQW = new LambdaQueryWrapper<>();
|
||||
passQW.eq(Cet_4::getBatch, batch).ge(Cet_4::getResult, 425);
|
||||
long passStudent = cet4Mapper.selectCount(queryWrapper);
|
||||
double passRateSum = passStudent / (double) allStudent * 100;
|
||||
DecimalFormat decimalFormat = new DecimalFormat("#.#");
|
||||
String rate = decimalFormat.format(passRateSum);
|
||||
double res = Double.parseDouble(rate);
|
||||
resultData.put("sumRate", res);
|
||||
collect = passedList.stream().collect(Collectors.groupingBy(Cet_4::getCollege));
|
||||
} else {
|
||||
queryWrapper.eq(Cet_4::getCollege, college).eq(Cet_4::getBatch, batch).ge(Cet_4::getResult, 425);
|
||||
List<Cet_4> result = cet4Mapper.selectList(queryWrapper);
|
||||
collect = result.stream().collect(Collectors.groupingBy(Cet_4::getMajorname));
|
||||
//获取学院人数
|
||||
long allStudent = getNumCollege(college, batch);
|
||||
//获取学院通过人数
|
||||
LambdaQueryWrapper<Cet_4> passQW = new LambdaQueryWrapper<>();
|
||||
passQW.eq(Cet_4::getCollege, college).eq(Cet_4::getBatch, batch).ge(Cet_4::getResult, 425);
|
||||
long passStudent = cet4Mapper.selectCount(queryWrapper);
|
||||
double passRateSum = passStudent / (double) allStudent * 100;
|
||||
DecimalFormat decimalFormat = new DecimalFormat("#.#");
|
||||
String rate = decimalFormat.format(passRateSum);
|
||||
double res = Double.parseDouble(rate);
|
||||
resultData.put("sumRate", res);
|
||||
collect = passedList.stream()
|
||||
.filter(cet4 -> cet4.getMajorname() != null)
|
||||
.collect(Collectors.groupingBy(Cet_4::getMajorname));
|
||||
}
|
||||
|
||||
// 过滤除去错误的数据
|
||||
allStudentList = allStudentList.stream().filter(e -> trueEntryDate.contains(e.getEntrydate())).collect(Collectors.toList());
|
||||
long allStudent = allStudentList.size();
|
||||
|
||||
long passStudent = passedList.size();
|
||||
double passRateSum = (passStudent / (double) allStudent) * 100;
|
||||
String rate = decimalFormat.format(passRateSum);
|
||||
double res;
|
||||
try {
|
||||
res = Double.parseDouble(rate);
|
||||
|
||||
} catch (NumberFormatException e) {
|
||||
e.printStackTrace();
|
||||
res = 0;
|
||||
|
||||
}
|
||||
// double res = Double.parseDouble(rate);
|
||||
resultData.put("sumRate", res);
|
||||
|
||||
|
||||
// System.out.println(collect);
|
||||
// List<Cet_4> result = cet4Mapper.selectList(queryWrapper);
|
||||
//通过批次
|
||||
|
@ -159,10 +173,9 @@ public class Cet_4ServiceImpl extends ServiceImpl<Cet_4Mapper, Cet_4> implements
|
|||
double size = entry.getValue().size();
|
||||
double passRate = size / sum * 100;
|
||||
// 定义格式化规则,保留四位小数
|
||||
DecimalFormat decimalFormat = new DecimalFormat("#.#");
|
||||
String rate = decimalFormat.format(passRate);
|
||||
double res = Double.parseDouble(rate);
|
||||
jsonObject.put(String.valueOf(entry.getKey()), res);
|
||||
String passRateStr = decimalFormat.format(passRate);
|
||||
double rateRes = Double.parseDouble(passRateStr);
|
||||
jsonObject.put(String.valueOf(entry.getKey()), rateRes);
|
||||
}
|
||||
//对jsonObject的值进行排序
|
||||
List<Map.Entry<String, Object>> list = new ArrayList<>(jsonObject.entrySet());
|
||||
|
@ -171,8 +184,11 @@ public class Cet_4ServiceImpl extends ServiceImpl<Cet_4Mapper, Cet_4> implements
|
|||
for (Map.Entry<String, Object> stringObjectEntry : list) {
|
||||
jsonObject.put(stringObjectEntry.getKey(), stringObjectEntry.getValue());
|
||||
}
|
||||
JSONObject gradeByBatch = getGradeByBatch(batch, college);
|
||||
resultData.put("data", jsonObject);
|
||||
resultData.put("gradeData", gradeByBatch);
|
||||
System.out.println(resultData);
|
||||
redisTemplate.opsForValue().set("getRateByBatch" + college + batchStr, resultData);
|
||||
return Result.OK(resultData);
|
||||
}
|
||||
|
||||
|
@ -233,13 +249,13 @@ public class Cet_4ServiceImpl extends ServiceImpl<Cet_4Mapper, Cet_4> implements
|
|||
|
||||
// 在循环开始之前,获取所有学院的在籍学生数量
|
||||
LambdaQueryWrapper<Cet4_major> allStudentQW = new LambdaQueryWrapper<>();
|
||||
allStudentQW.select(Cet4_major::getCollege, Cet4_major::getId).eq(Cet4_major::getState, "在校").eq(Cet4_major::getEntrydate, entryDate);
|
||||
allStudentQW.select(Cet4_major::getCollege, Cet4_major::getCode).eq(Cet4_major::getState, "在校").eq(Cet4_major::getEntrydate, entryDate);
|
||||
List<Map<String, Object>> allStudentList = cet4_majorMapper.selectMaps(allStudentQW);
|
||||
Map<String, Long> allStudentMap = allStudentList.stream().collect(Collectors.groupingBy(map -> (String) map.get("college"), Collectors.counting()));
|
||||
|
||||
// 在循环开始之前,获取所有批次的数据
|
||||
LambdaQueryWrapper<Cet_4> allBatchQW = new LambdaQueryWrapper<>();
|
||||
allBatchQW.select(Cet_4::getCollege, Cet_4::getId, Cet_4::getResult).eq(Cet_4::getEntrydate, entryDate).in(Cet_4::getBatch, batchList);
|
||||
allBatchQW.select(Cet_4::getCollege, Cet_4::getCode, Cet_4::getResult).eq(Cet_4::getEntrydate, entryDate).in(Cet_4::getBatch, batchList);
|
||||
List<Map<String, Object>> allBatchList = cet4Mapper.selectMaps(allBatchQW);
|
||||
Map<String, List<Map<String, Object>>> allBatchMap = allBatchList.stream().collect(Collectors.groupingBy(map -> (String) map.get("college")));
|
||||
|
||||
|
@ -254,7 +270,7 @@ public class Cet_4ServiceImpl extends ServiceImpl<Cet_4Mapper, Cet_4> implements
|
|||
//一次性获取所有批次的数据
|
||||
List<Map<String, Object>> Cet_4eEntrydate = allBatchMap.get(collegeName);
|
||||
for (Map<String, Object> map : Cet_4eEntrydate) {
|
||||
String str = (String) map.get("id");
|
||||
String str = (String) map.get("code");
|
||||
if ((int) map.get("result") >= 425) {
|
||||
attendMap4.put(str, 1);
|
||||
} else {
|
||||
|
@ -338,12 +354,12 @@ public class Cet_4ServiceImpl extends ServiceImpl<Cet_4Mapper, Cet_4> implements
|
|||
List<Object> collegeSet = cet4_MajorMapper.selectObjs(cet4MajorQW);
|
||||
// 在循环开始之前,获取该学院该年级的学生数量
|
||||
LambdaQueryWrapper<Cet4_major> allStudentQW = new LambdaQueryWrapper<>();
|
||||
allStudentQW.select(Cet4_major::getId).eq(Cet4_major::getState, "在校").eq(Cet4_major::getEntrydate, entryDate).eq(Cet4_major::getCollege, collegeName);
|
||||
allStudentQW.select(Cet4_major::getCode).eq(Cet4_major::getState, "在校").eq(Cet4_major::getEntrydate, entryDate).eq(Cet4_major::getCollege, collegeName);
|
||||
//获取该学院在籍学生数量
|
||||
long allStudent = cet4_majorMapper.selectCount(allStudentQW);
|
||||
// 在循环开始之前,获取该年级,学院所有批次的数据
|
||||
LambdaQueryWrapper<Cet_4> allBatchQW = new LambdaQueryWrapper<>();
|
||||
allBatchQW.select(Cet_4::getCollege, Cet_4::getId, Cet_4::getResult).eq(Cet_4::getEntrydate, entryDate).eq(Cet_4::getCollege, collegeName).in(Cet_4::getBatch, batchList);
|
||||
allBatchQW.select(Cet_4::getCollege, Cet_4::getCode, Cet_4::getResult).eq(Cet_4::getEntrydate, entryDate).eq(Cet_4::getCollege, collegeName).in(Cet_4::getBatch, batchList);
|
||||
//获取该学院该年级所有批次的数据
|
||||
List<Map<String, Object>> Cet_4eEntrydate = cet4Mapper.selectMaps(allBatchQW);
|
||||
if (collegeSet.contains(collegeName)) {
|
||||
|
@ -351,7 +367,7 @@ public class Cet_4ServiceImpl extends ServiceImpl<Cet_4Mapper, Cet_4> implements
|
|||
Map<String, Integer> attendMap4 = new HashMap<>();
|
||||
JSONObject json = new JSONObject();
|
||||
for (Map<String, Object> map : Cet_4eEntrydate) {
|
||||
String str = (String) map.get("id");
|
||||
String str = (String) map.get("code");
|
||||
if ((int) map.get("result") >= 425) {
|
||||
attendMap4.put(str, 1);
|
||||
} else {
|
||||
|
@ -385,6 +401,10 @@ public class Cet_4ServiceImpl extends ServiceImpl<Cet_4Mapper, Cet_4> implements
|
|||
//通过学院和专业获取数据
|
||||
JSONArray collegeMajors = webData.getJSONArray("college");
|
||||
JSONArray entryDateArray = webData.getJSONArray("entrydate");
|
||||
|
||||
if (redisTemplate.opsForValue().get("getRateByMajor" + webData) != null) {
|
||||
return Result.ok((JSONObject) redisTemplate.opsForValue().get("getRateByMajor" + webData));
|
||||
}
|
||||
//获取所有batch
|
||||
JSONObject batch = centerService.getBatch();
|
||||
JSONArray batchsArray = batch.getJSONArray("batches");
|
||||
|
@ -439,7 +459,7 @@ public class Cet_4ServiceImpl extends ServiceImpl<Cet_4Mapper, Cet_4> implements
|
|||
Cet_4QW.eq(Cet_4::getCollege, colleges.get(0)).eq(Cet_4::getMajorname, major).eq(Cet_4::getEntrydate, entryDate).in(Cet_4::getBatch, batchList);
|
||||
List<Map<String, Object>> Cet_4eEntrydate = cet4Mapper.selectMaps(Cet_4QW);
|
||||
for (Map<String, Object> map : Cet_4eEntrydate) {
|
||||
String str = (String) map.get("id");
|
||||
String str = (String) map.get("code");
|
||||
if ((int) map.get("result") >= 425) {
|
||||
attendMap4.put(str, 1);
|
||||
} else {
|
||||
|
@ -504,7 +524,7 @@ public class Cet_4ServiceImpl extends ServiceImpl<Cet_4Mapper, Cet_4> implements
|
|||
Cet_4QW.eq(Cet_4::getCollege, colleges.get(0)).eq(Cet_4::getMajorname, major).eq(Cet_4::getEntrydate, entryDate).in(Cet_4::getBatch, batchList);
|
||||
List<Map<String, Object>> Cet_4eEntrydate = cet4Mapper.selectMaps(Cet_4QW);
|
||||
for (Map<String, Object> map : Cet_4eEntrydate) {
|
||||
String str = (String) map.get("id");
|
||||
String str = (String) map.get("code");
|
||||
if ((int) map.get("result") >= 425) {
|
||||
attendMap4.put(str, 1);
|
||||
} else {
|
||||
|
@ -538,6 +558,7 @@ public class Cet_4ServiceImpl extends ServiceImpl<Cet_4Mapper, Cet_4> implements
|
|||
}
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("data", ans);
|
||||
redisTemplate.opsForValue().set("getRateByMajor" + webData, result);
|
||||
return Result.ok(result);
|
||||
}
|
||||
|
||||
|
@ -553,30 +574,264 @@ public class Cet_4ServiceImpl extends ServiceImpl<Cet_4Mapper, Cet_4> implements
|
|||
return remove(cet4Wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<JSONObject> getRateByMajorAndLastestBatch(getRateByMajorAndLastestBatchDto getRateByMajorAndLastestBatchParam) {
|
||||
Date batch = cet4Mapper.lastestDate();
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("data", getGradeByBatch(batch, getRateByMajorAndLastestBatchParam.getCollege(), getRateByMajorAndLastestBatchParam.getMajor()));
|
||||
return Result.ok(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<JSONObject> getRateByEntryDate(getRateByEntryDateDto getRateByEntryDateDtoParams) {
|
||||
LambdaQueryWrapper<Cet_4> cet4Wrapper = new LambdaQueryWrapper<>();
|
||||
cet4Wrapper.eq(Cet_4::getCollege, getRateByEntryDateDtoParams.getCollege());
|
||||
//根据前端数据是否传major 判断是否添加 sql 条件
|
||||
if (getRateByEntryDateDtoParams.getMajor() != null && !getRateByEntryDateDtoParams.getMajor().isEmpty()) {
|
||||
cet4Wrapper.eq(Cet_4::getMajorname, getRateByEntryDateDtoParams.getMajor());
|
||||
}
|
||||
//创建所有年级的list
|
||||
List<Map<String, Object>> maps = cet4Mapper.selectMaps(cet4Wrapper);
|
||||
cet4Wrapper.select(Cet_4::getEntrydate).groupBy(Cet_4::getEntrydate);
|
||||
List<Map<String, Object>> entryDateList = cet4Mapper.selectMaps(cet4Wrapper);
|
||||
|
||||
JSONArray ansArray = new JSONArray();
|
||||
for (Map<String, Object> Date : entryDateList) {
|
||||
//当前年纪的总人数
|
||||
LambdaQueryWrapper<Cet_4> cet4StudentCount = new LambdaQueryWrapper<>();
|
||||
cet4StudentCount.eq(Cet_4::getCollege, getRateByEntryDateDtoParams.getCollege())
|
||||
.eq(Cet_4::getEntrydate, Date.get("entrydate"));
|
||||
if (getRateByEntryDateDtoParams.getMajor() != null && !getRateByEntryDateDtoParams.getMajor().isEmpty()) {
|
||||
cet4StudentCount.eq(Cet_4::getMajorname, getRateByEntryDateDtoParams.getMajor());
|
||||
}
|
||||
cet4StudentCount.groupBy(Cet_4::getCode);
|
||||
List<Object> allStudentList = cet4Mapper.selectObjs(cet4StudentCount);
|
||||
long allStudentCount = allStudentList.size();
|
||||
// 统计当前 entryDate 下的通过人数
|
||||
//所有参加过四级考试的学生
|
||||
Map<String, Integer> attendMap4 = new HashMap<>();
|
||||
String currentEntryDate = (String) Date.get("entrydate");
|
||||
for (Map<String, Object> map : maps) {
|
||||
String studentEntryDate = (String) map.get("entrydate");
|
||||
String str = (String) map.get("code");
|
||||
// 仅处理当前 entryDate 下的学生数据
|
||||
if (currentEntryDate.equals(studentEntryDate)) {
|
||||
if ((int) map.get("result") >= 425) {
|
||||
attendMap4.put(str, 1);
|
||||
} else {
|
||||
if (!attendMap4.containsKey(str)) {//排除已经通过的人
|
||||
attendMap4.put(str, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//累计通过的人数
|
||||
int passNumber = (int) attendMap4.values().stream().filter(value -> value == 1).count();
|
||||
//每个年级的累计通过率保留三位小数
|
||||
double passRate = passNumber / (double) allStudentCount;
|
||||
//百分比
|
||||
passRate = passRate * 100;
|
||||
//保留两位小数
|
||||
DecimalFormat df = new DecimalFormat("#.##");
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("entryDate", currentEntryDate);
|
||||
json.put("passRate", df.format(passRate));
|
||||
ansArray.add(json);
|
||||
|
||||
}
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("data", ansArray);
|
||||
return Result.ok(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<JSONObject> loadImportDataList() {
|
||||
// 创建 QueryWrapper
|
||||
QueryWrapper<Cet_4> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.select("batch", "COUNT(*) AS count")
|
||||
.groupBy("batch");
|
||||
|
||||
// 执行查询,获取结果列表
|
||||
List<Map<String, Object>> list = this.listMaps(queryWrapper);
|
||||
List<JSONObject> res = getJsonObjects(list);
|
||||
return Result.ok(new JSONObject().fluentPut("data", res));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<JSONObject> getJsonObjects(List<Map<String, Object>> list) {
|
||||
List<JSONObject> res = new ArrayList<>();
|
||||
for (Map<String, Object> map : list) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("batch", map.get("batch"));
|
||||
jsonObject.put("attendNumber", map.get("count"));
|
||||
res.add(jsonObject);
|
||||
}
|
||||
res.sort((o1, o2) -> o2.getString("batch").compareTo(o1.getString("batch")));
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<JSONObject> getAnalyze(JSONObject webData) {
|
||||
String college = webData.getString("college");
|
||||
String major = webData.getString("major");
|
||||
// 检查是否有缓存
|
||||
if (redisTemplate.opsForValue().get("getAnalyze" + college + major) != null) {
|
||||
return Result.ok((JSONObject) redisTemplate.opsForValue().get("getAnalyze" + college + major));
|
||||
}
|
||||
|
||||
QueryWrapper<Cet_4> getMaxBatches = Wrappers.query();
|
||||
getMaxBatches.select("DISTINCT batch").orderByDesc("batch").last("LIMIT 3");
|
||||
List<Date> latestBatches = listObjs(getMaxBatches, obj -> (Date) obj);
|
||||
|
||||
JSONObject aggregatedResult = new JSONObject();
|
||||
JSONArray batchResults = new JSONArray();
|
||||
|
||||
for (Date batch : latestBatches) {
|
||||
LambdaQueryWrapper<Cet_4> queryWrapper = Wrappers.lambdaQuery(Cet_4.class)
|
||||
.eq(!Objects.equals(college, "全校"), Cet_4::getCollege, college)
|
||||
.eq(!major.isEmpty(), Cet_4::getMajorname, major)
|
||||
.eq(Cet_4::getBatch, batch);
|
||||
List<Cet_4> list = list(queryWrapper);
|
||||
|
||||
// Define ranges for analysis
|
||||
List<int[]> ranges = Arrays.asList(
|
||||
new int[]{0, 400},
|
||||
new int[]{400, 425},
|
||||
new int[]{425, 450},
|
||||
new int[]{450, 475},
|
||||
new int[]{475, 750}
|
||||
);
|
||||
|
||||
JSONObject rateByBatch = getRateByBatchRanges(list, ranges);
|
||||
JSONObject scoreRateByBatch = getScoreRateByLastBatch(list);
|
||||
|
||||
JSONObject batchResult = new JSONObject();
|
||||
batchResult.put("batch", batch);
|
||||
batchResult.put("rateByBatch", rateByBatch);
|
||||
batchResult.put("scoreByBatch", scoreRateByBatch);
|
||||
|
||||
batchResults.add(batchResult);
|
||||
}
|
||||
|
||||
aggregatedResult.put("data", batchResults);
|
||||
|
||||
// 缓存
|
||||
redisTemplate.opsForValue().set("getAnalyze" + college + major, aggregatedResult);
|
||||
|
||||
return Result.ok(aggregatedResult);
|
||||
}
|
||||
|
||||
|
||||
public JSONObject getRateByBatchRanges(List<Cet_4> list, List<int[]> ranges) {
|
||||
int total = list.size();
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
|
||||
// 遍历每个区间
|
||||
for (int[] range : ranges) {
|
||||
int min = range[0];
|
||||
int max = range[1];
|
||||
|
||||
// 计算符合条件的个数
|
||||
int count = (int) list.stream().filter(e -> e.getResult() >= min && e.getResult() < max).count();
|
||||
|
||||
// 计算比率
|
||||
double rate = count / (double) total;
|
||||
rate = rate * 100;
|
||||
|
||||
// 格式化结果并添加到结果中
|
||||
DecimalFormat df = new DecimalFormat("#.##");
|
||||
jsonObject.put(min + "-" + max, df.format(rate));
|
||||
}
|
||||
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
|
||||
//听力阅读等各个模块占比
|
||||
public JSONObject getScoreRateByLastBatch(List<Cet_4> list) {
|
||||
int total = list.size();
|
||||
int listen = 0;
|
||||
int read = 0;
|
||||
int write = 0;
|
||||
//求平均数
|
||||
for (Cet_4 cet_4 : list) {
|
||||
listen += cet_4.getListen();
|
||||
read += cet_4.getReading();
|
||||
write += cet_4.getWriting();
|
||||
}
|
||||
DecimalFormat df = new DecimalFormat("#.##");
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("listen", df.format(listen / (double) total));
|
||||
jsonObject.put("read", df.format(read / (double) total));
|
||||
jsonObject.put("write", df.format(write / (double) total));
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* 依据学生id和姓名获取四级数据
|
||||
*/
|
||||
@Override
|
||||
public Result<JSONObject> getDataByStudent(JSONObject jsonObject) {
|
||||
String name = jsonObject.getString("name");
|
||||
Integer id = jsonObject.getInteger("id");
|
||||
if (name == null || id == null) {
|
||||
Integer code = jsonObject.getInteger("code");
|
||||
if (name == null || code == null) {
|
||||
return Result.error("请填写完整的参数");
|
||||
}
|
||||
JSONObject result = new JSONObject();
|
||||
LambdaQueryWrapper<Cet_4> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(Cet_4::getName, name)
|
||||
.eq(Cet_4::getId, id);
|
||||
.eq(Cet_4::getCode, code);
|
||||
List<Cet_4> list = list(wrapper);
|
||||
result.put("results", list);
|
||||
return Result.ok(result);
|
||||
}
|
||||
|
||||
public JSONObject getGradeByBatch(Date batch, String college, String majorName) {
|
||||
//根据批次获取正确的年级
|
||||
List<String> trueEntryDate = centerService.getEntryDateByBatch(batch);
|
||||
LambdaQueryWrapper<Cet_4> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(!college.equals("全校"), Cet_4::getCollege, college)
|
||||
.eq(Cet_4::getBatch, batch)
|
||||
.eq(majorName != null, Cet_4::getMajorname, majorName);
|
||||
List<Cet_4> allStudent = list(wrapper);
|
||||
wrapper.ge(Cet_4::getResult, 425);
|
||||
List<Cet_4> allPassStudent = list(wrapper);
|
||||
|
||||
//所有参加该批次四级的学生,根据年级分组
|
||||
Map<String, Long> gradeStudentCount = allStudent.stream().filter(e -> trueEntryDate.contains(e.getEntrydate())).collect(Collectors.groupingBy(Cet_4::getEntrydate, Collectors.counting()));
|
||||
|
||||
//所有参加该批次四级且通过的学生,根据年级分组
|
||||
Map<String, Long> allPassStudentCount = allPassStudent.stream().filter(e -> trueEntryDate.contains(e.getEntrydate())).collect(Collectors.groupingBy(Cet_4::getEntrydate, Collectors.counting()));
|
||||
Set<String> entryDateKeySet = gradeStudentCount.keySet();
|
||||
JSONObject res = new JSONObject();
|
||||
for (String key : entryDateKeySet) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
double passRate;
|
||||
long passStudent = allPassStudentCount.getOrDefault(key, 0L);
|
||||
long allStudentNum = gradeStudentCount.getOrDefault(key, 0L);
|
||||
passRate = passStudent / (double) allStudentNum;
|
||||
passRate = passRate * 100;
|
||||
DecimalFormat df = new DecimalFormat("#.##");
|
||||
jsonObject.fluentPut("allStudent", allStudentNum)
|
||||
.fluentPut("passed", passStudent)
|
||||
.fluentPut("passRate", df.format(passRate));
|
||||
res.put(key, jsonObject);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public JSONObject getGradeByBatch(Date batch, String college) {
|
||||
return getGradeByBatch(batch, college, null);
|
||||
}
|
||||
|
||||
//获取全校人数
|
||||
private long getNumAll(Date batch) {
|
||||
private List<Cet_4> getNumAll(Date batch) {
|
||||
LambdaQueryWrapper<Cet_4> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(Cet_4::getBatch, batch);
|
||||
return cet4Mapper.selectCount(queryWrapper);
|
||||
return list(queryWrapper);
|
||||
}
|
||||
|
||||
//获取学院的人数
|
||||
|
|
|
@ -1,34 +1,47 @@
|
|||
package org.jeecg.modules.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.entity.Cet4_major;
|
||||
import org.jeecg.modules.entity.Cet_4;
|
||||
import org.jeecg.modules.entity.Cet_6;
|
||||
import org.jeecg.modules.mapper.Cet_6Mapper;
|
||||
import org.jeecg.modules.service.CenterService;
|
||||
import org.jeecg.modules.service.ICet4MajorService;
|
||||
import org.jeecg.modules.service.ICet_6Service;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Description: cet_6
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-03-26
|
||||
* @Date: 2024-03-26
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class Cet_6ServiceImpl extends ServiceImpl<Cet_6Mapper, Cet_6> implements ICet_6Service {
|
||||
@Resource
|
||||
Cet_6Mapper cet6Mapper;
|
||||
|
||||
//
|
||||
@Autowired
|
||||
@Lazy
|
||||
ICet4MajorService cet4MajorService;
|
||||
@Autowired
|
||||
Cet_4ServiceImpl cet4Service;
|
||||
@Autowired
|
||||
CenterService centerService;
|
||||
|
||||
@Override
|
||||
public Result<JSONObject> getRate(Cet_6 cet) {
|
||||
|
@ -45,8 +58,7 @@ public class Cet_6ServiceImpl extends ServiceImpl<Cet_6Mapper, Cet_6> implements
|
|||
double sum = (double) getNum(cet);
|
||||
double size = entry.getValue().size();
|
||||
double passRate = sum / size;
|
||||
jsonObject.put(String.valueOf(entry.getKey()),
|
||||
passRate);
|
||||
jsonObject.put(String.valueOf(entry.getKey()), passRate);
|
||||
}
|
||||
|
||||
return Result.OK(jsonObject);
|
||||
|
@ -60,15 +72,53 @@ public class Cet_6ServiceImpl extends ServiceImpl<Cet_6Mapper, Cet_6> implements
|
|||
double sum = (double) getNum(cet);
|
||||
double size = entry.getValue().size();
|
||||
double passRate = sum / size;
|
||||
jsonObject.put(String.valueOf(entry.getKey()),
|
||||
passRate);
|
||||
jsonObject.put(String.valueOf(entry.getKey()), passRate);
|
||||
}
|
||||
return Result.OK(jsonObject);
|
||||
}
|
||||
else return null;
|
||||
} else return null;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<?> getGrateRate() {
|
||||
LambdaQueryWrapper<Cet_6> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(Cet_6::getEntrydate, "2020");
|
||||
List<Cet_6> list1 = list(wrapper);
|
||||
Set<String> allStudent1 = list1.stream().map(Cet_6::getCode).collect(Collectors.toSet());
|
||||
log.info("六级总考试人数,{}", allStudent1.size());
|
||||
wrapper.ge(Cet_6::getResult, 425);
|
||||
List<Cet_6> list = list(wrapper);
|
||||
log.info("六级总通过人数,{}", list.size());
|
||||
|
||||
Set<String> passStudent = list.stream().map(Cet_6::getCode).collect(Collectors.toSet());
|
||||
log.info("六级通过人数,{}", passStudent.size());
|
||||
LambdaQueryWrapper<Cet4_major> majorWrapper = new LambdaQueryWrapper<>();
|
||||
majorWrapper.eq(Cet4_major::getEntrydate, "2020").eq(Cet4_major::getState, "在校");
|
||||
List<Cet4_major> majorList = cet4MajorService.list(majorWrapper);
|
||||
Set<String> allStudent = majorList.stream().map(Cet4_major::getCode).collect(Collectors.toSet());
|
||||
log.info("所有学生人数{}", allStudent.size());
|
||||
log.info("通过率,{}", (double) passStudent.size() / allStudent.size());
|
||||
LambdaQueryWrapper<Cet_4> cet4Wrapper = new LambdaQueryWrapper<>();
|
||||
cet4Wrapper.eq(Cet_4::getEntrydate, "2020");
|
||||
cet4Wrapper.ge(Cet_4::getResult, 425);
|
||||
List<Cet_4> cet4PassedStudent = cet4Service.list(cet4Wrapper);
|
||||
Set<String> cet4AllPassedStudent = cet4PassedStudent.stream().map(Cet_4::getCode).collect(Collectors.toSet());
|
||||
log.info("四级通过人数,{}", cet4AllPassedStudent.size());
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<JSONObject> loadImportDataList() {
|
||||
// 创建 QueryWrapper
|
||||
QueryWrapper<Cet_6> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.select("batch", "COUNT(*) AS count").groupBy("batch");
|
||||
|
||||
// 执行查询,获取结果列表
|
||||
List<Map<String, Object>> list = this.listMaps(queryWrapper);
|
||||
List<JSONObject> res = cet4Service.getJsonObjects(list);
|
||||
return Result.ok(new JSONObject().fluentPut("data", res));
|
||||
}
|
||||
|
||||
|
||||
private long getNum(Cet_6 cet) {
|
||||
LambdaQueryWrapper<Cet_6> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
package org.jeecg.modules.service.impl;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.checkerframework.checker.units.qual.A;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.jeecg.modules.entity.CetGroup;
|
||||
import org.jeecg.modules.entity.ClassRoom;
|
||||
import org.jeecg.modules.mapper.CetGroupMapper;
|
||||
import org.jeecg.modules.mapper.ClassRoomMapper;
|
||||
import org.jeecg.modules.service.IClassRoomService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @Description: 教室表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-06-11
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class ClassRoomServiceImpl extends ServiceImpl<ClassRoomMapper, ClassRoom> implements IClassRoomService {
|
||||
@Autowired
|
||||
private ClassRoomMapper classRoomMapper;
|
||||
@Autowired
|
||||
private CetGroupMapper cetGroupMapper;
|
||||
|
||||
@Override
|
||||
public Result<String> add(ClassRoom classRoom) {
|
||||
if (classRoom == null) {
|
||||
return Result.error("参数不能为空");
|
||||
}
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
String username = sysUser.getUsername();
|
||||
Date now = new Date();
|
||||
|
||||
classRoom.setCreateTime(now);
|
||||
classRoom.setUpdateTime(now);
|
||||
classRoom.setCreateBy(username);
|
||||
classRoom.setUpdateBy(username);
|
||||
classRoom.setStatus("0");
|
||||
String building = Optional.ofNullable(classRoom.getBuilding()).orElse("");
|
||||
String area = Optional.ofNullable(classRoom.getArea()).orElse("");
|
||||
String roomNumber = Optional.ofNullable(classRoom.getRoomNumber()).orElse("");
|
||||
// 拼接逻辑:有 area 的话加上 area.toUpperCase() + "区"
|
||||
String areaPart = area.isEmpty() ? "" : area.toUpperCase() + "区";
|
||||
// 最终 fullName
|
||||
String fullName = building + areaPart + roomNumber;
|
||||
classRoom.setArea(areaPart);
|
||||
classRoom.setFullName(fullName);
|
||||
|
||||
int rows = classRoomMapper.insert(classRoom);
|
||||
if (rows > 0) {
|
||||
return Result.ok("添加成功");
|
||||
} else {
|
||||
return Result.error("添加失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
package org.jeecg.modules.utils;
|
||||
import org.springframework.core.io.ByteArrayResource;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
*
|
||||
* @Author: Cool
|
||||
* @Date: 2024/10/23/17:16
|
||||
* @Description:
|
||||
*/
|
||||
public class Base64DecodedMultipartFile implements MultipartFile {
|
||||
|
||||
private final byte[] fileContent;
|
||||
private final String header;
|
||||
|
||||
public Base64DecodedMultipartFile(byte[] fileContent, String header) {
|
||||
this.fileContent = fileContent;
|
||||
this.header = header;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
// 返回文件名
|
||||
return header;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOriginalFilename() {
|
||||
// 返回文件名
|
||||
return header;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getContentType() {
|
||||
// 返回文件类型
|
||||
return "application/octet-stream";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return fileContent == null || fileContent.length == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSize() {
|
||||
return fileContent.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getBytes() throws IOException {
|
||||
return fileContent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream getInputStream() throws IOException {
|
||||
return new ByteArrayInputStream(fileContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transferTo(File dest) throws IOException, IllegalStateException {
|
||||
Files.write(dest.toPath(), fileContent);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package org.jeecg.modules.utils;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
*
|
||||
* @Author: Cool
|
||||
* @Date: 2024/10/11/18:33
|
||||
* @Description: 日期工具类
|
||||
*/
|
||||
@Slf4j
|
||||
public class DateUtil {
|
||||
|
||||
|
||||
public static Date formatDateToDay(String dateStr) {
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
||||
try {
|
||||
return format.parse(dateStr);
|
||||
} catch (ParseException e) {
|
||||
log.error("DateUtil格式化日期错误,{}", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
package org.jeecg.modules.utils;
|
||||
|
||||
import org.apache.poi.util.IOUtils;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
public class ExportUtil {
|
||||
|
||||
|
||||
/**
|
||||
* 下载
|
||||
* @param response
|
||||
* @param fileName
|
||||
* @param filePath
|
||||
* @throws IOException
|
||||
*/
|
||||
public static void download(HttpServletResponse response, String fileName, String filePath) throws IOException {
|
||||
|
||||
File file = new File(filePath);
|
||||
FileInputStream in = new FileInputStream(file);
|
||||
try (OutputStream os = response.getOutputStream()) {
|
||||
fileName = String.format("%s", fileName);
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + new String(fileName.getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1));
|
||||
response.addHeader("Cache-Control", "no-cache");
|
||||
byte[] bs = new byte[1024];
|
||||
int count = 0;
|
||||
|
||||
while ((count=in.read(bs, 0, bs.length))!=-1) {
|
||||
os.write(bs,0,count);
|
||||
}
|
||||
in.close();
|
||||
os.flush();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 下载Excel模板
|
||||
* @param response
|
||||
* @param resourceFileName
|
||||
* @param resourceFilePath
|
||||
* @throws IOException
|
||||
*/
|
||||
public static void downloadExcelTemplate(HttpServletResponse response, String resourceFileName, String resourceFilePath) throws IOException {
|
||||
ClassPathResource file = new ClassPathResource(resourceFilePath);
|
||||
InputStream inputStream = file.getInputStream();
|
||||
try (OutputStream os = response.getOutputStream()) {
|
||||
String fileName = String.format("%s", resourceFileName);
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + new String(fileName.getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1));
|
||||
response.addHeader("Cache-Control", "no-cache");
|
||||
IOUtils.copy(inputStream, os);
|
||||
inputStream.close();
|
||||
os.flush();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -45,8 +45,8 @@ spring:
|
|||
clean-disabled: true
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 10MB
|
||||
max-request-size: 10MB
|
||||
max-file-size: 50MB
|
||||
max-request-size: 50MB
|
||||
mail:
|
||||
host: smtp.163.com
|
||||
username: jeecgos@163.com
|
||||
|
@ -156,9 +156,12 @@ spring:
|
|||
slow-sql-millis: 5000
|
||||
datasource:
|
||||
master:
|
||||
url: jdbc:mysql://62.234.217.137:3306/jeecg-boot2?characterEncoding=UTF-8&rewriteBatchedStatements=true&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
|
||||
# url: jdbc:mysql://62.234.217.137:3306/jeecg-boot2?characterEncoding=UTF-8&rewriteBatchedStatements=true&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
|
||||
# username: root
|
||||
# password: nWZpHMb8mNxWE5Xk
|
||||
url: jdbc:mysql://43.138.83.20:3306/jeecg-boot2?characterEncoding=UTF-8&rewriteBatchedStatements=true&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
|
||||
username: root
|
||||
password: nWZpHMb8mNxWE5Xk
|
||||
password: dbb4acbf6b676522
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# 多数据源配置
|
||||
#multi-datasource1:
|
||||
|
@ -169,7 +172,7 @@ spring:
|
|||
#redis 配置
|
||||
redis:
|
||||
database: 2
|
||||
host: 62.234.217.137
|
||||
host: 43.138.83.20
|
||||
port: 6379
|
||||
password: LSHCwjr6ZN4hzCxS
|
||||
#mybatis plus 设置
|
||||
|
|
|
@ -45,8 +45,8 @@ spring:
|
|||
clean-disabled: true
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 10MB
|
||||
max-request-size: 10MB
|
||||
max-file-size: 50MB
|
||||
max-request-size: 50MB
|
||||
mail:
|
||||
host: smtp.163.com
|
||||
username: jeecgos@163.com
|
||||
|
@ -156,9 +156,9 @@ spring:
|
|||
slow-sql-millis: 5000
|
||||
datasource:
|
||||
master:
|
||||
url: jdbc:mysql://62.234.217.137:3306/jeecg-boot2?characterEncoding=UTF-8&rewriteBatchedStatements=true&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
|
||||
url: jdbc:mysql://43.138.83.20:3306/jeecg-boot2?characterEncoding=UTF-8&rewriteBatchedStatements=true&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
|
||||
username: root
|
||||
password: nWZpHMb8mNxWE5Xk
|
||||
password: dbb4acbf6b676522
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# 多数据源配置
|
||||
#multi-datasource1:
|
||||
|
@ -169,7 +169,7 @@ spring:
|
|||
#redis 配置
|
||||
redis:
|
||||
database: 2
|
||||
host: 62.234.217.137
|
||||
host: 43.138.83.20
|
||||
port: 6379
|
||||
password: LSHCwjr6ZN4hzCxS
|
||||
#mybatis plus 设置
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,43 @@
|
|||
package org.jeecg.modules.cet.clean;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import org.jeecg.JeecgSystemApplication;
|
||||
import org.jeecg.modules.entity.CetClean;
|
||||
import org.jeecg.modules.entity.Cet_4;
|
||||
import org.jeecg.modules.mapper.CetCleanMapper;
|
||||
import org.jeecg.modules.mapper.Cet_4Mapper;
|
||||
import org.jeecg.modules.service.CetCleanService;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = JeecgSystemApplication.class)
|
||||
public class CetCleanTest {
|
||||
@Autowired
|
||||
private CetCleanMapper cetCleanMapper;
|
||||
@Autowired
|
||||
private Cet_4Mapper cet4Mapper;
|
||||
|
||||
@Test
|
||||
public void cleanData() {
|
||||
LambdaQueryWrapper<Cet_4> actualQueryWrapper = Wrappers.lambdaQuery(Cet_4.class)
|
||||
.select(Cet_4::getCollege)
|
||||
.groupBy(Cet_4::getCollege);
|
||||
List<Cet_4> cet4s = cet4Mapper.selectList(actualQueryWrapper);
|
||||
List<String> collegeList = cet4s.stream()
|
||||
.map(Cet_4::getCollege)
|
||||
.collect(Collectors.toList());
|
||||
LambdaUpdateWrapper<CetClean> cleanUpdateWrapper = Wrappers.lambdaUpdate(CetClean.class)
|
||||
.notIn(CetClean::getCollege, collegeList);
|
||||
cetCleanMapper.delete(cleanUpdateWrapper);
|
||||
}
|
||||
}
|
|
@ -22,6 +22,5 @@ public class text {
|
|||
return;
|
||||
}
|
||||
// Result<JSONObject> result = cet_4Controller.getDataByStudent(2023011559, "余映婵");
|
||||
System.out.println(result);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue