luohairen
2024-12-25 488ac4d44ee6a2dfb841cf047083cba80dfb5432
business/src/main/java/com/ycl/service/impl/ProjectInvestmentPolicyComplianceServiceImpl.java
@@ -23,6 +23,7 @@
import org.springframework.beans.BeanUtils;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import java.util.List;
import java.util.stream.Collectors;
@@ -54,6 +55,7 @@
        entity.setUpdateBy(userId);
        baseMapper.insert(entity);
        //添加文件
        if (!CollectionUtils.isEmpty(form.getFileList())) {
        List<File> fileList = form.getFileList();
        fileList.forEach(item->{
            item.setId(null);
@@ -61,6 +63,7 @@
            item.setType(FileTypeEnum.INVEST_POLICY);
        });
        fileService.saveBatch(fileList);
        }
        //避免新增一个后重复新增返回id给前端判断
        return Result.ok("添加成功").data(entity.getId());
    }
@@ -79,6 +82,7 @@
        Long userId = SecurityUtils.getUserId();
        entity.setUpdateBy(userId);
        baseMapper.updateById(entity);
        if (!CollectionUtils.isEmpty(form.getFileList())) {
        List<File> fileList = form.getFileList();
        fileList.forEach(item->{
            item.setId(null);
@@ -92,6 +96,7 @@
        fileMapper.delete(fileQueryWrapper);
        //替换成现有
        fileService.saveBatch(fileList);
        }
        return Result.ok("修改成功");
    }