@RequestMapping("doc-info-save")
public String save(@ModelAttribute DocInfo docInfo,
@RequestParam("attachment") MultipartFile attachment,
@RequestParam Map<String, Object> parameterMap,
RedirectAttributes redirectAttributes) throws Exception {
DocInfo dest = null;
Long id = docInfo.getId();
if (id != null) {
dest = docInfoManager.get(id);
beanMapper.copy(docInfo, dest);
} else {
dest = docInfo;
dest.setCreateTime(new Date());
String userId = SpringSecurityUtils.getCurrentUserId();
dest.setUserId(Long.parseLong(userId));
}
StoreDTO storeDto = storeConnector.save("docinfo",
new MultipartFileResource(attachment),
attachment.getOriginalFilename());
dest.setName(attachment.getOriginalFilename());
dest.setPath(storeDto.getKey());
docInfoManager.save(dest);
messageHelper.addFlashMessage(redirectAttributes, "core.success.save",
"保存成功");