|
@@ -27,7 +27,9 @@ import org.springblade.core.log.exception.ServiceException;
|
|
|
import org.springblade.core.mp.support.Query;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.utils.BeanUtil;
|
|
|
+import org.springblade.core.tool.utils.Func;
|
|
|
import org.springblade.core.tool.utils.ObjectUtil;
|
|
|
+import org.springblade.meter.dto.MaterialMeterBatchImportDTO;
|
|
|
import org.springblade.meter.dto.MaterialMeterFormDTO;
|
|
|
import org.springblade.meter.entity.*;
|
|
|
import org.springblade.meter.excel.MaterialMeterFormExcel;
|
|
@@ -42,6 +44,8 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
+import java.time.LocalDateTime;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -256,4 +260,28 @@ public class MaterialMeterFormServiceImpl extends BaseServiceImpl<MaterialMeterF
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void batchImportFile(MaterialMeterBatchImportDTO dto) {
|
|
|
+ String materialMeterFormIds = dto.getMaterialMeterFormIds();
|
|
|
+ List<Long> ids = Func.toLongList(materialMeterFormIds);
|
|
|
+ List<MaterialMeterBatchImportDTO.NewBladeFile> files = dto.getFiles();
|
|
|
+ List<AttachmentForm> fileList = new ArrayList<>();
|
|
|
+ for (MaterialMeterBatchImportDTO.NewBladeFile file : files) {
|
|
|
+ for (Long id : ids) {
|
|
|
+ AttachmentForm form = new AttachmentForm();
|
|
|
+ form.setProjectId(dto.getProjectId());
|
|
|
+ form.setContractId(dto.getContractId());
|
|
|
+ form.setMasterId(id);
|
|
|
+ form.setFileName(file.getOriginalName());
|
|
|
+ form.setFileUrl(file.getLink());
|
|
|
+ form.setFilePdfUrl(file.getPdfUrl());
|
|
|
+ form.setFileSuffix(file.getFileSuffix());
|
|
|
+ form.setFileSizeName(file.getFileSizeName());
|
|
|
+ form.setFileUpTime(LocalDateTime.now());
|
|
|
+ fileList.add(form);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ attachmentFormService.saveBatch(fileList);
|
|
|
+ }
|
|
|
}
|