文档库--比较发布日期和标准实施日期

This commit is contained in:
zhn
2022-03-09 17:30:34 +08:00
parent 2eb742b9c3
commit 41dc50d7fd
2 changed files with 26 additions and 5 deletions
@@ -260,8 +260,7 @@ public class BussDocumentLibraryEOController extends JeroController<BussDocument
try {
bussDocumentLibraryEOService.addInfo(map);
} catch (Exception e) {
return Result.error("新增失败");
return Result.error(e.getMessage());
}
return Result.OK("新增成功");
}
@@ -278,7 +277,7 @@ public class BussDocumentLibraryEOController extends JeroController<BussDocument
try {
bussDocumentLibraryEOService.updateInfo(map);
} catch (Exception e) {
return Result.error("编辑失败");
return Result.error(e.getMessage());
}
return Result.OK("编辑成功");
}
@@ -630,6 +630,18 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
* @param map
*/
public void addInfo(Map<String, Object> map) {
try {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
String implementTime = (String)map.get("implement_time");
String issueTime = (String)map.get("issue_time");
Date implementTimeDate=df.parse(implementTime);
Date issueTimeDate=df.parse(issueTime);
if(issueTimeDate.after(implementTimeDate)){
throw new JeroBootException("发布日期不能大于标准实施日期");
}
} catch (ParseException e) {
throw new JeroBootException("新增失败");
}
if (ObjectUtils.isNotEmpty(map.get("replace_standard_id"))) {
map.put("replace_standard", map.get("replace_standard_id"));
}
@@ -718,6 +730,18 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
* @param map
*/
public void updateInfo(Map<String, Object> map) {
try {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
String implementTime = (String)map.get("implement_time");
String issueTime = (String)map.get("issue_time");
Date implementTimeDate=df.parse(implementTime);
Date issueTimeDate=df.parse(issueTime);
if(issueTimeDate.after(implementTimeDate)){
throw new JeroBootException("发布日期不能大于标准实施日期") ;
}
} catch (ParseException e) {
throw new JeroBootException("编辑失败") ;
}
String cut = (String) map.get("cut");
if (ObjectUtils.isNotEmpty(map.get("replace_standard_id"))) {
map.put("replace_standard", map.get("replace_standard_id"));
@@ -842,8 +866,6 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
//删除文档库数据
bussDocumentLibraryEOMapper.deleteById((String) map.get("id"));
bussDocumentLibraryEOMapper.insertInfo(insertField, insertValue);
}
/**