|
@@ -322,9 +322,16 @@ public class QuesServiceImpl implements QuesService{
|
|
|
}
|
|
|
}
|
|
|
byte [] pkgByte = DocxProcessUtil.getPkgByte(wordMLPackage);
|
|
|
- QuestionPkgPath quesPkgPath = quesPkgPathRepo.findFirstById(question.getQuesPkgPathId());
|
|
|
- quesPkgPath.setQuesPkg(pkgByte);
|
|
|
- quesPkgPathRepo.save(quesPkgPath);
|
|
|
+ if(question.getQuesPkgPathId() == null){
|
|
|
+ QuestionPkgPath quesPkgPath = new QuestionPkgPath(pkgByte);
|
|
|
+ QuestionPkgPath returnQuesPkgPath = quesPkgPathRepo.save(quesPkgPath);
|
|
|
+ question.setQuesPkgPathId(returnQuesPkgPath.getId());
|
|
|
+ quesRepo.save(question);
|
|
|
+ }else{
|
|
|
+ QuestionPkgPath quesPkgPath = quesPkgPathRepo.findFirstById(question.getQuesPkgPathId());
|
|
|
+ quesPkgPath.setQuesPkg(pkgByte);
|
|
|
+ quesPkgPathRepo.save(quesPkgPath);
|
|
|
+ }
|
|
|
pkgByte = null;
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|