修改小组提交报错的问题

This commit is contained in:
yangjun 2025-04-07 11:05:40 +08:00
parent 251c5ff791
commit d64edd51ef
2 changed files with 136 additions and 14 deletions

View File

@ -337,6 +337,7 @@ public class ZyInfoStudentController extends JeecgController<ZyInfoStudent, IZyI
ZyInfoStudent zyInfoStudentPar = zyInfoStudentService.getById(zyInfoStudent.getId());
if(StringUtils.isNotEmpty(score)){
try {
ZyInfo zyInfo = zyInfoService.getKechengById(zyInfoStudentPar.getMainId());
//作业代办提醒
ZyDbtx zyDbtx = new ZyDbtx();
@ -349,6 +350,9 @@ public class ZyInfoStudentController extends JeecgController<ZyInfoStudent, IZyI
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
zyDbtx.setFbr(user.getUsername());
zyDbtxService.save(zyDbtx);
} catch (Exception e) {
e.printStackTrace();
}
}
QueryWrapper<ZyInfoStudent> zyInfoStudentQueryWrappertt = new QueryWrapper<>();
@ -840,6 +844,124 @@ public class ZyInfoStudentController extends JeecgController<ZyInfoStudent, IZyI
}
@AutoLog(value = "学生作业上传")
@ApiOperation(value="学生作业上传", notes="学生作业上传")
@RequestMapping(value = "/zyscStuBatch", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<Object> zyscStuBatch(@RequestBody ZyInfoStudent zyInfoStudent, HttpServletResponse response) {
//20241107新增判断看原来是否有数据防止重复添加
QueryWrapper<ZyInfoStudent> 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> 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<ZyInfoStudentHp> zyInfoStudentHpQueryWrapper3 = new QueryWrapper<>();
zyInfoStudentHpQueryWrapper3.eq("main_id",stuPar.getMainId());
zyInfoStudentHpQueryWrapper3.eq("stu_id",stuPar.getCreateBy());
List<ZyInfoStudentHp> list3 = zyInfoStudentHpService.list(zyInfoStudentHpQueryWrapper3);
if(list3.size()>4){
UpdateWrapper<ZyDbtx> 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<String,String> 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<KcKechengbiao> 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})

View File

@ -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存储和大鱼短信秘钥配置