|
@@ -52,19 +52,21 @@ public class PolicyInfoServiceImpl extends BaseServiceImpl<PolicyInfoMapper, Pol
|
|
|
PolicyInfo policyInfo = new PolicyInfo();
|
|
|
BeanUtils.copyProperties(dto,policyInfo);
|
|
|
Boolean isExist = true;
|
|
|
+ List<AttachmentInfo> list = dto.getList();
|
|
|
+ if (list == null || list.size() == 0){
|
|
|
+ throw new ServiceException("请上传附件");
|
|
|
+ }
|
|
|
if (policyInfo.getId() == null){
|
|
|
isExist = false;
|
|
|
policyInfo.setId(SnowFlakeUtil.getId());
|
|
|
policyInfo.setUploadDate(LocalDate.now());
|
|
|
//删除之前的附件
|
|
|
- attachmentInfoService.deleteByMasterId(-1L);
|
|
|
+ attachmentInfoService.deleteByMasterId(-1L,dto.getProjectId());
|
|
|
}else {
|
|
|
//删除之前的附件
|
|
|
- attachmentInfoService.deleteByMasterId(policyInfo.getId());
|
|
|
- }
|
|
|
- List<AttachmentInfo> list = dto.getList();
|
|
|
- if (list == null || list.size() == 0){
|
|
|
- throw new ServiceException("请上传附件");
|
|
|
+ attachmentInfoService.deleteByMasterId(policyInfo.getId(),dto.getProjectId());
|
|
|
+ //再删除本次上传的附件
|
|
|
+ attachmentInfoService.deleteBatch(list.stream().map(l->l.getId()).collect(Collectors.toList()));
|
|
|
}
|
|
|
List<String> data = new ArrayList<>();
|
|
|
for (AttachmentInfo info : list) {
|