From d64edd51ef74aed04d9d5be2ec035398f2f271d4 Mon Sep 17 00:00:00 2001 From: yangjun <1173114630@qq.com> Date: Mon, 7 Apr 2025 11:05:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=B0=8F=E7=BB=84=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=E6=8A=A5=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ZyInfoStudentController.java | 146 ++++++++++++++++-- .../src/main/resources/application-linux.yml | 4 +- 2 files changed, 136 insertions(+), 14 deletions(-) diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/controller/ZyInfoStudentController.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/controller/ZyInfoStudentController.java index e92f5fd1..308ad674 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/controller/ZyInfoStudentController.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/controller/ZyInfoStudentController.java @@ -337,18 +337,22 @@ public class ZyInfoStudentController extends JeecgController zyInfoStudentQueryWrappertt = new QueryWrapper<>(); @@ -840,6 +844,124 @@ public class ZyInfoStudentController extends JeecgController zyscStuBatch(@RequestBody ZyInfoStudent zyInfoStudent, HttpServletResponse response) { + + //20241107新增判断,看原来是否有数据,防止重复添加 + QueryWrapper zyInfoStudentQueryWrapper = new QueryWrapper<>(); + zyInfoStudentQueryWrapper.eq("a.create_by",zyInfoStudent.getStuId()); + zyInfoStudentQueryWrapper.eq("a.main_id",zyInfoStudent.getMainId()); + zyInfoStudentQueryWrapper.last("limit 1"); + ZyInfoStudent stuPar = zyInfoStudentService.getOne(zyInfoStudentQueryWrapper); + ZyInfo zyInfo = zyInfoService.getById(zyInfoStudent.getMainId()); + SysUser user = sysUserService.getUserByName(zyInfoStudent.getStuId()); + if(stuPar==null) { + + ZyInfoStudent zyInfoStudent1 = new ZyInfoStudent(); + zyInfoStudent1.setMainId(zyInfo.getId()); + zyInfoStudent1.setCreateBy(user.getUsername()); + zyInfoStudent1.setCreateTime(new Date()); + zyInfoStudent1.setFilePath(zyInfoStudent.getFilePath()); + zyInfoStudent1.setStudentName(user.getRealname()); + zyInfoStudentService.save(zyInfoStudent1); + stuPar =zyInfoStudent1; + zyInfoStudent =zyInfoStudent1; + + }else{ +// if(StringUtils.isNotEmpty(stuPar.getFilePath())){ +// return Result.error("您已上传了作业,请刷新后尝试"); +// } + stuPar.setFilePath(zyInfoStudent.getFilePath()); + + zyInfoStudent =stuPar; + } + + //判断是否可以取消代办xshpkg + if(StringUtils.equals("0",zyInfo.getXshpkg())){ + UpdateWrapper zyDbtx = new UpdateWrapper<>(); + zyDbtx.set("flag","1"); + zyDbtx.eq("main_id",zyInfo.getId()); + zyDbtx.eq("create_by",stuPar.getCreateBy()); + zyDbtx.eq("type","0"); + zyDbtxService.update(zyDbtx); + } + + + QueryWrapper zyInfoStudentHpQueryWrapper3 = new QueryWrapper<>(); + zyInfoStudentHpQueryWrapper3.eq("main_id",stuPar.getMainId()); + zyInfoStudentHpQueryWrapper3.eq("stu_id",stuPar.getCreateBy()); + List list3 = zyInfoStudentHpService.list(zyInfoStudentHpQueryWrapper3); + if(list3.size()>4){ + UpdateWrapper zyDbtx = new UpdateWrapper<>(); + zyDbtx.set("flag","1"); + zyDbtx.eq("main_id",stuPar.getMainId()); + zyDbtx.eq("create_by",stuPar.getCreateBy()); + zyDbtx.eq("type","0"); + zyDbtxService.update(zyDbtx); + } + + String nameLast = zyInfoStudent.getFilePath().substring(zyInfoStudent.getFilePath().lastIndexOf(".")+1); + if(StringUtils.equals("pdf",nameLast)){ + zyInfoStudent.setPdfPath(zyInfoStudent.getFilePath()); + }else if(StringUtils.equals("doc",nameLast) || StringUtils.equals("docx",nameLast)){ + if(StringUtils.equals("local",uploadType)){ + Global global = SpringContextHolder.getBean(Global.class); + FileUtil.mkdir(global.getContractDickPath()); + String dd = DateUtils.formatDate(new Date(),"yyyyMMddHHmmss"); + String docPath = upLoadPath+ File.separator+ zyInfoStudent.getFilePath(); + String namePath = dd + ".pdf"; + String pdfPath = global.getContractDickPath() + namePath; + System.out.println("filPath:"+zyInfoStudent.getFilePath()); + System.out.println("docPath:"+docPath); + System.out.println("pdfPath:"+pdfPath); + PDFUtil.office2PDF(docPath,pdfPath); + zyInfoStudent.setPdfPath("contract/"+namePath); + }else{ + ZykInfo zykInfo = new ZykInfo(); + zykInfo.setBizId(zyInfoStudent.getId()); + zykInfo.setBizTable("zy_jxdg"); + zykInfo.setWjlx(WjlxEnum.JXDG.getType()); + zykInfo.setRwbh(zyInfo.getRwbh()); + zykInfo.setFileName(zyInfoStudent.getFilePath()); + Map map = zykService.saveToZykJxdg(zykInfo); + String fileName = map.get("data"); + String pdfName = map.get("pdfData"); + zyInfoStudent.setFilePath(fileName); + zyInfoStudent.setPdfPath(pdfName); + } + } + zyInfoStudent.setPublishTime(new Date()); + boolean bol = zyInfoStudentService.updateById(zyInfoStudent, response); + if(bol == false){ + return Result.error("文件存储失败,请重新上传作业!"); + } + QueryWrapper kcKechengbiaoQueryWrapper = new QueryWrapper<>(); + kcKechengbiaoQueryWrapper.eq("rwbh",zyInfo.getRwbh()); + kcKechengbiaoQueryWrapper.eq("jgh",zyInfo.getCreateBy()); + kcKechengbiaoQueryWrapper.eq("xqxn",zyInfo.getXnxq()); + kcKechengbiaoQueryWrapper.last("limit 1"); + KcKechengbiao kcKechengbiao = kcKechengbiaoService.getOne(kcKechengbiaoQueryWrapper); + try { + //作业代办提醒 + ZyDbtx zyDbtx = new ZyDbtx(); + zyDbtx.setCreateBy(zyInfo.getCreateBy()); + zyDbtx.setType("5");//0发布作业 1评分 2测验 3问卷 4讨论 5学生提交作业 6学生提交测验 7学生提交问卷 + zyDbtx.setMainId(zyInfo.getId()); + zyDbtx.setRwbh(zyInfo.getRwbh()); + zyDbtx.setContent(user.getRealname()+"学生提交了["+kcKechengbiao.getKcmc()+"]课程“"+zyInfo.getTitle()+"”作业,该作业完成时间为:"+DateUtils.formatDate(zyInfo.getEndTime(),"yyyy-MM-dd HH:mm")+",请及时查看。学生提交时间:"+DateUtils.formatDate(new Date(),"yyyy-MM-dd HH:mm:ss")); + zyDbtx.setFlag("0"); + zyDbtx.setFbr(zyInfo.getCreateBy()); + zyDbtxService.save(zyDbtx); + } catch (Exception e) { + e.printStackTrace(); + } + + return Result.OK(zyInfoStudent); + } + + @AutoLog(value = "学生作业开始检测") @ApiOperation(value="学生作业开始检测", notes="学生作业开始检测") @RequestMapping(value = "/stuWpKsjc", method = {RequestMethod.PUT,RequestMethod.POST}) diff --git a/jeecg-module-system/jeecg-system-start/src/main/resources/application-linux.yml b/jeecg-module-system/jeecg-system-start/src/main/resources/application-linux.yml index d1b2288e..026d2d93 100644 --- a/jeecg-module-system/jeecg-system-start/src/main/resources/application-linux.yml +++ b/jeecg-module-system/jeecg-system-start/src/main/resources/application-linux.yml @@ -189,9 +189,9 @@ jeecg: app: http://localhost:8051 path: #文件上传根目录 设置 - upload: /data/jeecg-boot/upload + upload: /data/opt/jeecg-boot/upload #webapp文件路径 - webapp: /data/jeecg-boot/webapp + webapp: /data/opt/jeecg-boot/webapp shiro: excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/**,/api/getUserInfo #阿里云oss存储和大鱼短信秘钥配置