|
@@ -70,6 +70,14 @@ public class PaperStructService {
|
|
|
* @return
|
|
|
*/
|
|
|
public PaperStruct save(PaperStruct paperStruct, AccessUser user) {
|
|
|
+ PaperStruct oldPaperStruct = paperStructRepo.findOne(paperStruct.getId());
|
|
|
+ PaperStruct rps = null;
|
|
|
+ if (oldPaperStruct != null && !paperStruct.getName().equals(oldPaperStruct.getName())) {// 那么就是更新操作
|
|
|
+ rps = this.checkNameUnique(paperStruct.getName(), user.getOrgId().toString());
|
|
|
+ }
|
|
|
+ if (rps != null) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
List<PaperDetailStruct> paperDetailStructs = paperStruct.getPaperDetailStructs();
|
|
|
int number = 0;
|
|
|
for (PaperDetailStruct paperDetailStruct : paperDetailStructs) {
|
|
@@ -94,7 +102,7 @@ public class PaperStructService {
|
|
|
}
|
|
|
paperStruct.setDetailCount(paperDetailStructs.size());
|
|
|
paperStruct.setOrgId(user.getOrgId().toString());
|
|
|
- paperStruct.setCreator(user.getLoginName());
|
|
|
+ paperStruct.setCreator(user.getName());
|
|
|
paperStruct.setCreateTime(CommonUtils.getCurDateTime());
|
|
|
return paperStructRepo.save(paperStruct);
|
|
|
}
|