|
@@ -1,7 +1,9 @@
|
|
|
package com.fjhx.service.supplier.impl;
|
|
|
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
@@ -11,6 +13,7 @@ import com.fjhx.entity.supplier.SupplierBank;
|
|
|
import com.fjhx.entity.supplier.SupplierContacts;
|
|
|
import com.fjhx.entity.supplier.SupplierKeep;
|
|
|
import com.fjhx.mapper.supplier.SupplierMapper;
|
|
|
+import com.fjhx.params.supplier.SupplierKeepVo;
|
|
|
import com.fjhx.params.supplier.SupplierVo;
|
|
|
import com.fjhx.service.common.CommonFileService;
|
|
|
import com.fjhx.service.supplier.SupplierBankService;
|
|
@@ -24,6 +27,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -78,8 +82,19 @@ public class SupplierServiceImpl extends ServiceImpl<SupplierMapper, Supplier> i
|
|
|
supplierContactsService.save(supplierContacts);
|
|
|
|
|
|
// 供应商维护记录
|
|
|
- List<SupplierKeep> supplierKeepList = supplierVo.getSupplierKeepList();
|
|
|
- supplierKeepList.forEach(supplierKeep -> supplierKeep.setSupplierId(id));
|
|
|
+ List<SupplierKeepVo> supplierKeepVoList = supplierVo.getSupplierKeepList();
|
|
|
+
|
|
|
+ List<SupplierKeep> supplierKeepList = supplierKeepVoList.stream().map(item -> {
|
|
|
+ // 赋值供应商id
|
|
|
+ item.setSupplierId(id);
|
|
|
+
|
|
|
+ // 绑定维护记录图片
|
|
|
+ long fileLinkedId = IdWorker.getId();
|
|
|
+ item.setFileLinkedId(fileLinkedId);
|
|
|
+ commonFileService.add(fileLinkedId, item.getFileList());
|
|
|
+
|
|
|
+ return BeanUtil.toBean(item, SupplierKeep.class);
|
|
|
+ }).collect(Collectors.toList());
|
|
|
supplierKeepService.saveBatch(supplierKeepList);
|
|
|
|
|
|
// 其他资质
|
|
@@ -107,9 +122,27 @@ public class SupplierServiceImpl extends ServiceImpl<SupplierMapper, Supplier> i
|
|
|
}
|
|
|
|
|
|
// 供应商维护记录
|
|
|
- List<SupplierKeep> supplierKeepList = supplierVo.getSupplierKeepList();
|
|
|
- if (ObjectUtil.isNotEmpty(supplierKeepList)) {
|
|
|
- supplierKeepService.updateBatchById(supplierKeepList);
|
|
|
+ List<SupplierKeepVo> supplierKeepVoList = supplierVo.getSupplierKeepList();
|
|
|
+ if (ObjectUtil.isNotEmpty(supplierKeepVoList)) {
|
|
|
+
|
|
|
+ List<SupplierKeep> supplierKeepList = supplierKeepVoList.stream().map(item -> {
|
|
|
+ // 赋值供应商id
|
|
|
+ item.setSupplierId(id);
|
|
|
+
|
|
|
+ Long fileLinkedId = item.getFileLinkedId();
|
|
|
+ List<CommonFile> fileList = item.getFileList();
|
|
|
+ if (ObjectUtil.isNotEmpty(fileLinkedId)) {
|
|
|
+ commonFileService.edit(fileLinkedId, fileList);
|
|
|
+ } else {
|
|
|
+ fileLinkedId = IdWorker.getId();
|
|
|
+ item.setFileLinkedId(fileLinkedId);
|
|
|
+ commonFileService.add(fileLinkedId, item.getFileList());
|
|
|
+ }
|
|
|
+
|
|
|
+ return BeanUtil.toBean(item, SupplierKeep.class);
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ supplierKeepService.saveOrUpdateBatch(supplierKeepList);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
// 其他资质
|