Compare commits

..

2 Commits

Author SHA1 Message Date
71d3ecab52 CompanyVendor 改为 Vendor 2025-09-23 22:50:30 +08:00
5919636c04 feat(供应商管理): 新增供应商实体类及VO转换方法
添加CompanyVendor实体类,包含供应商基本信息、关联关系和VO转换功能
2025-09-23 22:50:16 +08:00
37 changed files with 166 additions and 186 deletions

View File

@@ -3,9 +3,7 @@ package com.ecep.contract.controller.vendor;
import java.io.File; import java.io.File;
import com.ecep.contract.VendorType; import com.ecep.contract.VendorType;
import com.ecep.contract.model.VendorCatalog;
import com.ecep.contract.vo.VendorCatalogVo; import com.ecep.contract.vo.VendorCatalogVo;
import com.ecep.contract.vo.VendorTypeLocalVo;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
@@ -15,12 +13,9 @@ import org.springframework.util.StringUtils;
import com.ecep.contract.DesktopUtils; import com.ecep.contract.DesktopUtils;
import com.ecep.contract.controller.AbstEntityController; import com.ecep.contract.controller.AbstEntityController;
import com.ecep.contract.model.CompanyVendor;
import com.ecep.contract.model.VendorTypeLocal;
import com.ecep.contract.service.CompanyService; import com.ecep.contract.service.CompanyService;
import com.ecep.contract.service.CompanyVendorService; import com.ecep.contract.service.CompanyVendorService;
import com.ecep.contract.util.FxmlPath; import com.ecep.contract.util.FxmlPath;
import com.ecep.contract.util.ProxyUtils;
import com.ecep.contract.vm.CompanyVendorViewModel; import com.ecep.contract.vm.CompanyVendorViewModel;
import javafx.event.ActionEvent; import javafx.event.ActionEvent;

View File

@@ -2,12 +2,10 @@ package com.ecep.contract.controller.vendor;
import java.io.File; import java.io.File;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import com.ecep.contract.service.VendorFileTypeService; import com.ecep.contract.service.VendorFileTypeService;
import com.ecep.contract.util.ProxyUtils;
import com.ecep.contract.vo.CompanyVendorFileVo; import com.ecep.contract.vo.CompanyVendorFileVo;
import com.ecep.contract.vo.CompanyVendorVo; import com.ecep.contract.vo.CompanyVendorVo;
import com.ecep.contract.vo.CompanyVo; import com.ecep.contract.vo.CompanyVo;
@@ -21,10 +19,6 @@ import com.ecep.contract.SpringApp;
import com.ecep.contract.constant.CompanyVendorConstant; import com.ecep.contract.constant.CompanyVendorConstant;
import com.ecep.contract.controller.tab.TabSkin; import com.ecep.contract.controller.tab.TabSkin;
import com.ecep.contract.model.BaseEnumEntity; import com.ecep.contract.model.BaseEnumEntity;
import com.ecep.contract.model.Company;
import com.ecep.contract.model.CompanyVendor;
import com.ecep.contract.model.CompanyVendorFile;
import com.ecep.contract.model.VendorFileTypeLocal;
import com.ecep.contract.service.CompanyVendorFileService; import com.ecep.contract.service.CompanyVendorFileService;
import com.ecep.contract.task.CompanyVendorEvaluationFormUpdateTask; import com.ecep.contract.task.CompanyVendorEvaluationFormUpdateTask;
import com.ecep.contract.util.FxmlPath; import com.ecep.contract.util.FxmlPath;

View File

@@ -8,26 +8,21 @@ import com.ecep.contract.controller.ComboBoxUtils;
import com.ecep.contract.controller.table.cell.VendorTypeTableCell; import com.ecep.contract.controller.table.cell.VendorTypeTableCell;
import com.ecep.contract.service.*; import com.ecep.contract.service.*;
import com.ecep.contract.vo.*; import com.ecep.contract.vo.*;
import org.springframework.util.StringUtils;
import com.ecep.contract.controller.tab.TabSkin; import com.ecep.contract.controller.tab.TabSkin;
import com.ecep.contract.controller.table.AbstEntityTableTabSkin; import com.ecep.contract.controller.table.AbstEntityTableTabSkin;
import com.ecep.contract.controller.table.cell.CompanyVendorTableCell; import com.ecep.contract.controller.table.cell.CompanyVendorTableCell;
import com.ecep.contract.controller.vendor.CompanyVendorWindowController; import com.ecep.contract.controller.vendor.CompanyVendorWindowController;
import com.ecep.contract.model.CompanyVendor;
import com.ecep.contract.model.VendorTypeLocal;
import com.ecep.contract.util.BooleanConfigProperty; import com.ecep.contract.util.BooleanConfigProperty;
import com.ecep.contract.util.FxmlPath; import com.ecep.contract.util.FxmlPath;
import com.ecep.contract.util.IntegerConfigProperty; import com.ecep.contract.util.IntegerConfigProperty;
import com.ecep.contract.util.ParamUtils; import com.ecep.contract.util.ParamUtils;
import com.ecep.contract.util.ParamUtils.Builder; import com.ecep.contract.util.ParamUtils.Builder;
import com.ecep.contract.util.ProxyUtils;
import com.ecep.contract.util.UITools; import com.ecep.contract.util.UITools;
import com.ecep.contract.vm.CompanyVendorApprovedItemViewModel; import com.ecep.contract.vm.CompanyVendorApprovedItemViewModel;
import com.ecep.contract.vm.CompanyVendorApprovedListViewModel; import com.ecep.contract.vm.CompanyVendorApprovedListViewModel;
import javafx.beans.property.SimpleBooleanProperty; import javafx.beans.property.SimpleBooleanProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
import javafx.event.ActionEvent; import javafx.event.ActionEvent;
import javafx.scene.control.CheckMenuItem; import javafx.scene.control.CheckMenuItem;
@@ -38,7 +33,6 @@ import javafx.scene.control.SelectionMode;
import javafx.scene.control.Spinner; import javafx.scene.control.Spinner;
import javafx.scene.control.Tab; import javafx.scene.control.Tab;
import javafx.scene.control.TableColumn; import javafx.scene.control.TableColumn;
import javafx.util.StringConverter;
import lombok.Setter; import lombok.Setter;
@FxmlPath("/ui/company/vendor/vendor_approved_list-tab-vendor.fxml") @FxmlPath("/ui/company/vendor/vendor_approved_list-tab-vendor.fxml")

View File

@@ -41,11 +41,6 @@ import org.springframework.util.StringUtils;
import com.ecep.contract.MessageHolder; import com.ecep.contract.MessageHolder;
import com.ecep.contract.MyDateTimeUtils; import com.ecep.contract.MyDateTimeUtils;
import com.ecep.contract.VendorType; import com.ecep.contract.VendorType;
import com.ecep.contract.model.Company;
import com.ecep.contract.model.CompanyContact;
import com.ecep.contract.model.CompanyVendor;
import com.ecep.contract.model.CompanyVendorApprovedItem;
import com.ecep.contract.model.Contract;
import com.ecep.contract.service.CompanyContactService; import com.ecep.contract.service.CompanyContactService;
import com.ecep.contract.service.CompanyVendorApprovedFileService; import com.ecep.contract.service.CompanyVendorApprovedFileService;
import com.ecep.contract.service.CompanyVendorApprovedItemService; import com.ecep.contract.service.CompanyVendorApprovedItemService;

View File

@@ -19,9 +19,7 @@ import org.springframework.util.StringUtils;
import com.ecep.contract.MessageHolder; import com.ecep.contract.MessageHolder;
import com.ecep.contract.VendorFileType; import com.ecep.contract.VendorFileType;
import com.ecep.contract.VendorType; import com.ecep.contract.VendorType;
import com.ecep.contract.model.CompanyVendor; import com.ecep.contract.model.Vendor;
import com.ecep.contract.model.CompanyVendorApprovedItem;
import com.ecep.contract.model.Contract;
import com.ecep.contract.service.CompanyOldNameService; import com.ecep.contract.service.CompanyOldNameService;
import com.ecep.contract.service.CompanyVendorApprovedItemService; import com.ecep.contract.service.CompanyVendorApprovedItemService;
import com.ecep.contract.service.CompanyVendorApprovedListService; import com.ecep.contract.service.CompanyVendorApprovedListService;
@@ -414,7 +412,7 @@ public class CompanyVendorApprovedListVendorImportTask extends Tasker<Object> {
* @param item 供方名录中供应商的条目 * @param item 供方名录中供应商的条目
* @param holder 消息输出器 * @param holder 消息输出器
* @return true if qualified * @return true if qualified
* @see #findAllEvaluationFormFiles(CompanyVendor, LocalDate) * @see #findAllEvaluationFormFiles(Vendor, LocalDate)
*/ */
private boolean checkAsQualifiedVendorByEvaluationFormFiles( private boolean checkAsQualifiedVendorByEvaluationFormFiles(
CompanyVendorVo vendor, CompanyVendorApprovedItemVo item, MessageHolder holder) { CompanyVendorVo vendor, CompanyVendorApprovedItemVo item, MessageHolder holder) {

View File

@@ -13,8 +13,7 @@ import org.springframework.stereotype.Service;
import com.ecep.contract.MessageHolder; import com.ecep.contract.MessageHolder;
import com.ecep.contract.MyDateTimeUtils; import com.ecep.contract.MyDateTimeUtils;
import com.ecep.contract.VendorFileType; import com.ecep.contract.VendorFileType;
import com.ecep.contract.model.CompanyVendor; import com.ecep.contract.model.Vendor;
import com.ecep.contract.model.CompanyVendorFile;
import com.ecep.contract.model.VendorFileTypeLocal; import com.ecep.contract.model.VendorFileTypeLocal;
import com.ecep.contract.util.ParamUtils; import com.ecep.contract.util.ParamUtils;
import com.ecep.contract.vm.CompanyVendorFileViewModel; import com.ecep.contract.vm.CompanyVendorFileViewModel;
@@ -28,7 +27,7 @@ public class CompanyVendorFileService extends QueryService<CompanyVendorFileVo,
// TODO Auto-generated method stub // TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getNextSignDate'"); throw new UnsupportedOperationException("Unimplemented method 'getNextSignDate'");
} }
public LocalDate getNextSignDate(CompanyVendor companyVendor, Consumer<String> state) { public LocalDate getNextSignDate(Vendor vendor, Consumer<String> state) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getNextSignDate'"); throw new UnsupportedOperationException("Unimplemented method 'getNextSignDate'");
} }

View File

@@ -2,8 +2,6 @@ package com.ecep.contract.service;
import java.io.File; import java.io.File;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.List;
import java.util.Locale;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
@@ -15,9 +13,8 @@ import com.ecep.contract.MessageHolder;
import com.ecep.contract.SpringApp; import com.ecep.contract.SpringApp;
import com.ecep.contract.VendorType; import com.ecep.contract.VendorType;
import com.ecep.contract.constant.CompanyVendorConstant; import com.ecep.contract.constant.CompanyVendorConstant;
import com.ecep.contract.model.CompanyVendor; import com.ecep.contract.model.Vendor;
import com.ecep.contract.model.VendorCatalog; import com.ecep.contract.model.VendorCatalog;
import com.ecep.contract.model.VendorTypeLocal;
import com.ecep.contract.util.CompanyUtils; import com.ecep.contract.util.CompanyUtils;
import com.ecep.contract.util.FileUtils; import com.ecep.contract.util.FileUtils;
import com.ecep.contract.util.MyStringUtils; import com.ecep.contract.util.MyStringUtils;
@@ -68,7 +65,7 @@ public class CompanyVendorService extends QueryService<CompanyVendorVo, CompanyV
throw new UnsupportedOperationException("Unimplemented method 'reBuildingFiles'"); throw new UnsupportedOperationException("Unimplemented method 'reBuildingFiles'");
} }
public boolean reBuildingFiles(CompanyVendor companyVendor, MessageHolder messageHolder) { public boolean reBuildingFiles(Vendor vendor, MessageHolder messageHolder) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'reBuildingFiles'"); throw new UnsupportedOperationException("Unimplemented method 'reBuildingFiles'");
} }

View File

@@ -3,9 +3,7 @@ package com.ecep.contract.vm;
import java.util.Objects; import java.util.Objects;
import com.ecep.contract.VendorType; import com.ecep.contract.VendorType;
import com.ecep.contract.model.CompanyVendor;
import com.ecep.contract.vo.CompanyVendorApprovedItemVo; import com.ecep.contract.vo.CompanyVendorApprovedItemVo;
import com.ecep.contract.vo.CompanyVendorApprovedListVo;
import javafx.beans.property.SimpleObjectProperty; import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.SimpleStringProperty;

View File

@@ -3,7 +3,7 @@ package com.ecep.contract.vm;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.Objects; import java.util.Objects;
import com.ecep.contract.model.CompanyVendor; import com.ecep.contract.model.Vendor;
import com.ecep.contract.model.CompanyVendorEntity; import com.ecep.contract.model.CompanyVendorEntity;
import com.ecep.contract.model.Employee; import com.ecep.contract.model.Employee;
import com.ecep.contract.model.VendorCatalog; import com.ecep.contract.model.VendorCatalog;
@@ -26,7 +26,7 @@ public class VendorEntityViewModel extends IdentityViewModel<CompanyVendorEntity
/** /**
* 关联的企业 * 关联的企业
*/ */
private SimpleObjectProperty<CompanyVendor> vendor = new SimpleObjectProperty<>(); private SimpleObjectProperty<Vendor> vendor = new SimpleObjectProperty<>();
/** /**
* 发展日期 * 发展日期
*/ */

View File

@@ -50,7 +50,7 @@ public class CompanyVendorApprovedItem implements IdentityEntity, Serializable,
@ManyToOne(fetch = FetchType.LAZY) @ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "VENDOR_ID", nullable = false) @JoinColumn(name = "VENDOR_ID", nullable = false)
@ToString.Exclude @ToString.Exclude
private CompanyVendor vendor; private Vendor vendor;
/** /**
* 类型,历史的,可能会变更的,所以这样也要存 * 类型,历史的,可能会变更的,所以这样也要存

View File

@@ -41,7 +41,7 @@ public class CompanyVendorEntity implements IdentityEntity, Serializable, Voable
@ManyToOne(fetch = FetchType.LAZY) @ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "COMPANY_VENDOR_ID") @JoinColumn(name = "COMPANY_VENDOR_ID")
@ToString.Exclude @ToString.Exclude
private CompanyVendor vendor; private Vendor vendor;
@Column(name = "NAME") @Column(name = "NAME")
private String name; private String name;

View File

@@ -41,7 +41,7 @@ public class CompanyVendorFile implements CompanyBasicFile<VendorFileType>, Seri
@ManyToOne(fetch = FetchType.LAZY) @ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "VENDOR_ID") @JoinColumn(name = "VENDOR_ID")
@ToString.Exclude @ToString.Exclude
private CompanyVendor vendor; private Vendor vendor;
@Column(name = "TYPE") @Column(name = "TYPE")
@Enumerated(EnumType.STRING) @Enumerated(EnumType.STRING)

View File

@@ -34,7 +34,7 @@ import lombok.ToString;
@Entity @Entity
@Table(name = "COMPANY_VENDOR", schema = "supplier_ms") @Table(name = "COMPANY_VENDOR", schema = "supplier_ms")
@ToString @ToString
public class CompanyVendor implements IdentityEntity, CompanyBasedEntity, Serializable, Voable<CompanyVendorVo> { public class Vendor implements IdentityEntity, CompanyBasedEntity, Serializable, Voable<CompanyVendorVo> {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
@Column(name = "ID", nullable = false) @Column(name = "ID", nullable = false)
@@ -114,7 +114,7 @@ public class CompanyVendor implements IdentityEntity, CompanyBasedEntity, Serial
if (HibernateProxyUtils.isNotEffectiveClassEquals(object, this)) { if (HibernateProxyUtils.isNotEffectiveClassEquals(object, this)) {
return false; return false;
} }
CompanyVendor that = (CompanyVendor) object; Vendor that = (Vendor) object;
return getId() != null && Objects.equals(getId(), that.getId()); return getId() != null && Objects.equals(getId(), that.getId());
} }

View File

@@ -3,8 +3,10 @@ package com.ecep.contract.vo;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
@Data @Data
@EqualsAndHashCode(callSuper = true)
public class CloudRkVo extends CloudBasedVo implements CompanyBasedVo { public class CloudRkVo extends CloudBasedVo implements CompanyBasedVo {
private String cloudId; private String cloudId;
private Integer companyId; private Integer companyId;

View File

@@ -3,8 +3,10 @@ package com.ecep.contract.vo;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
@Data @Data
@EqualsAndHashCode(callSuper = true)
public class CloudTycVo extends CloudBasedVo implements CompanyBasedVo { public class CloudTycVo extends CloudBasedVo implements CompanyBasedVo {
private Integer score; private Integer score;
private LocalDateTime cloudLatest; private LocalDateTime cloudLatest;

View File

@@ -4,8 +4,10 @@ import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
@Data @Data
@EqualsAndHashCode(callSuper = true)
public class CloudYuVo extends CloudBasedVo implements CompanyBasedVo { public class CloudYuVo extends CloudBasedVo implements CompanyBasedVo {
private Integer companyId; private Integer companyId;

View File

@@ -5,8 +5,10 @@ import com.ecep.contract.model.BaseEnumEntity;
import com.ecep.contract.model.IdentityEntity; import com.ecep.contract.model.IdentityEntity;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
@Data @Data
@EqualsAndHashCode(callSuper = true)
public class CompanyCustomerFileTypeLocalVo extends BaseEnumEntity<CustomerFileType> implements IdentityEntity { public class CompanyCustomerFileTypeLocalVo extends BaseEnumEntity<CustomerFileType> implements IdentityEntity {
} }

View File

@@ -5,8 +5,10 @@ import com.ecep.contract.model.BaseEnumEntity;
import com.ecep.contract.model.IdentityEntity; import com.ecep.contract.model.IdentityEntity;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
@Data @Data
@EqualsAndHashCode(callSuper = true)
public class CompanyFileTypeLocalVo extends BaseEnumEntity<CompanyFileType> implements IdentityEntity { public class CompanyFileTypeLocalVo extends BaseEnumEntity<CompanyFileType> implements IdentityEntity {
private boolean active = false; private boolean active = false;
} }

View File

@@ -4,8 +4,10 @@ import com.ecep.contract.model.BaseEnumEntity;
import com.ecep.contract.model.IdentityEntity; import com.ecep.contract.model.IdentityEntity;
import com.ecep.contract.ContractFileType; import com.ecep.contract.ContractFileType;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
@Data @Data
@EqualsAndHashCode(callSuper = true)
public class ContractFileTypeLocalVo extends BaseEnumEntity<ContractFileType> implements IdentityEntity { public class ContractFileTypeLocalVo extends BaseEnumEntity<ContractFileType> implements IdentityEntity {
private String description; private String description;
private String suggestFileName; private String suggestFileName;

View File

@@ -5,8 +5,10 @@ import com.ecep.contract.model.BaseEnumEntity;
import com.ecep.contract.model.IdentityEntity; import com.ecep.contract.model.IdentityEntity;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
@Data @Data
@EqualsAndHashCode(callSuper = true)
public class ProjectFileTypeLocalVo extends BaseEnumEntity<ProjectFileType> implements IdentityEntity { public class ProjectFileTypeLocalVo extends BaseEnumEntity<ProjectFileType> implements IdentityEntity {
private boolean active = false; private boolean active = false;
} }

View File

@@ -2,7 +2,6 @@ package com.ecep.contract.cloud.old;
import java.beans.PropertyDescriptor; import java.beans.PropertyDescriptor;
import java.io.File; import java.io.File;
import java.time.Instant;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
@@ -51,7 +50,7 @@ import com.ecep.contract.model.CompanyCustomer;
import com.ecep.contract.model.CompanyCustomerFile; import com.ecep.contract.model.CompanyCustomerFile;
import com.ecep.contract.model.CompanyFile; import com.ecep.contract.model.CompanyFile;
import com.ecep.contract.model.CompanyOldName; import com.ecep.contract.model.CompanyOldName;
import com.ecep.contract.model.CompanyVendor; import com.ecep.contract.model.Vendor;
import com.ecep.contract.model.CompanyVendorFile; import com.ecep.contract.model.CompanyVendorFile;
import com.ecep.contract.model.Contract; import com.ecep.contract.model.Contract;
import com.ecep.contract.model.ContractFile; import com.ecep.contract.model.ContractFile;
@@ -511,40 +510,41 @@ public class OldVersionService {
if (type == Types.VENDOR) { if (type == Types.VENDOR) {
String vendorType = (String) map.get("TYPE"); String vendorType = (String) map.get("TYPE");
boolean changed = false; boolean changed = false;
CompanyVendor companyVendor = companyVendorRepository.findByCompany(updater).orElseGet(() -> { Vendor vendor = companyVendorRepository.findByCompany(updater).orElse(null);
CompanyVendor vendor = new CompanyVendor(); if (vendor == null) {
vendor = new Vendor();
vendor.setId(id); vendor.setId(id);
vendor.setCompany(updater); vendor.setCompany(updater);
vendor.setCreated(LocalDateTime.now()); vendor.setCreated(LocalDateTime.now());
return vendor; changed = true;
}); }
if (StringUtils.hasText(vendorType)) { if (StringUtils.hasText(vendorType)) {
VendorType t = VendorType.valueOf(vendorType); VendorType t = VendorType.valueOf(vendorType);
if (!Objects.equals(t, companyVendor.getType())) { if (!Objects.equals(t, vendor.getType())) {
companyVendor.setType(t); vendor.setType(t);
changed = true; changed = true;
} }
} }
if (companyVendor.getCompany() == null) { if (vendor.getCompany() == null) {
companyVendor.setCompany(updater); vendor.setCompany(updater);
changed = true; changed = true;
} }
if (!Objects.equals(absolutePath, companyVendor.getPath())) { if (!Objects.equals(absolutePath, vendor.getPath())) {
companyVendor.setPath(absolutePath); vendor.setPath(absolutePath);
changed = true; changed = true;
} }
if (changed) { if (changed) {
companyVendorRepository.save(companyVendor); companyVendorRepository.save(vendor);
} }
CompanyVendorFileService fileService = SpringApp.getBean(CompanyVendorFileService.class); CompanyVendorFileService fileService = SpringApp.getBean(CompanyVendorFileService.class);
// 1. 先做数据库排重 // 1. 先做数据库排重
List<CompanyVendorFile> files = fileService.findAllByVendor(companyVendor); List<CompanyVendorFile> files = fileService.findAllByVendor(vendor);
HashMap<String, CompanyVendorFile> fileMap = new HashMap<>(); HashMap<String, CompanyVendorFile> fileMap = new HashMap<>();
for (CompanyVendorFile vendorFile : files) { for (CompanyVendorFile vendorFile : files) {
String key = vendorFile.getFilePath(); String key = vendorFile.getFilePath();
@@ -587,7 +587,7 @@ public class OldVersionService {
try { try {
CompanyVendorFile vendorFile = new CompanyVendorFile(); CompanyVendorFile vendorFile = new CompanyVendorFile();
CompanyVendorFileUtils.applyVendorFileByMap(vendorFile, m); CompanyVendorFileUtils.applyVendorFileByMap(vendorFile, m);
vendorFile.setVendor(companyVendor); vendorFile.setVendor(vendor);
fileService.save(vendorFile); fileService.save(vendorFile);
if (logger.isInfoEnabled()) { if (logger.isInfoEnabled()) {
logger.info("Create New CompanyVendorFile {}", vendorFile); logger.info("Create New CompanyVendorFile {}", vendorFile);

View File

@@ -1,6 +1,5 @@
package com.ecep.contract.cloud.u8; package com.ecep.contract.cloud.u8;
import java.time.Instant;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Map; import java.util.Map;
@@ -23,7 +22,7 @@ import com.ecep.contract.ds.vendor.service.CompanyVendorEntityService;
import com.ecep.contract.ds.vendor.service.CompanyVendorService; import com.ecep.contract.ds.vendor.service.CompanyVendorService;
import com.ecep.contract.model.CloudYu; import com.ecep.contract.model.CloudYu;
import com.ecep.contract.model.Company; import com.ecep.contract.model.Company;
import com.ecep.contract.model.CompanyVendor; import com.ecep.contract.model.Vendor;
import com.ecep.contract.model.CompanyVendorEntity; import com.ecep.contract.model.CompanyVendorEntity;
import lombok.Setter; import lombok.Setter;
@@ -109,7 +108,7 @@ public class VendorSyncTask extends AbstContractRepairTasker {
} }
private void updateCloudYu(CompanyVendorEntity entity) { private void updateCloudYu(CompanyVendorEntity entity) {
CompanyVendor vendor = entity.getVendor(); Vendor vendor = entity.getVendor();
if (vendor == null) { if (vendor == null) {
return; return;
} }
@@ -132,7 +131,7 @@ public class VendorSyncTask extends AbstContractRepairTasker {
private void updateCompanyNameAndAbbName(CompanyVendorEntity entity, MessageHolder holder) { private void updateCompanyNameAndAbbName(CompanyVendorEntity entity, MessageHolder holder) {
CompanyService companyService = vendorCtx.getCompanyService(); CompanyService companyService = vendorCtx.getCompanyService();
CompanyVendor vendor = entity.getVendor(); Vendor vendor = entity.getVendor();
if (vendor == null) { if (vendor == null) {
return; return;
} }

View File

@@ -20,7 +20,7 @@ import com.ecep.contract.ds.vendor.service.CompanyVendorService;
import com.ecep.contract.model.Company; import com.ecep.contract.model.Company;
import com.ecep.contract.model.CompanyCustomer; import com.ecep.contract.model.CompanyCustomer;
import com.ecep.contract.model.CompanyCustomerEntity; import com.ecep.contract.model.CompanyCustomerEntity;
import com.ecep.contract.model.CompanyVendor; import com.ecep.contract.model.Vendor;
import com.ecep.contract.model.CompanyVendorEntity; import com.ecep.contract.model.CompanyVendorEntity;
import com.ecep.contract.model.Employee; import com.ecep.contract.model.Employee;
@@ -145,7 +145,7 @@ public class AbstractYongYouU8Ctx extends AbstractCtx {
if (entity == null) { if (entity == null) {
holder.warn("无效" + topic + "" + vendorCode); holder.warn("无效" + topic + "" + vendorCode);
} else { } else {
CompanyVendor customer = entity.getVendor(); Vendor customer = entity.getVendor();
if (customer == null) { if (customer == null) {
holder.warn("无效" + topic + "" + vendorCode); holder.warn("无效" + topic + "" + vendorCode);
} else { } else {

View File

@@ -37,7 +37,7 @@ import com.ecep.contract.ds.vendor.service.CompanyVendorService;
import com.ecep.contract.model.Company; import com.ecep.contract.model.Company;
import com.ecep.contract.model.CompanyCustomer; import com.ecep.contract.model.CompanyCustomer;
import com.ecep.contract.model.CompanyCustomerEntity; import com.ecep.contract.model.CompanyCustomerEntity;
import com.ecep.contract.model.CompanyVendor; import com.ecep.contract.model.Vendor;
import com.ecep.contract.model.CompanyVendorEntity; import com.ecep.contract.model.CompanyVendorEntity;
import com.ecep.contract.model.Contract; import com.ecep.contract.model.Contract;
import com.ecep.contract.model.ContractCatalog; import com.ecep.contract.model.ContractCatalog;
@@ -343,7 +343,7 @@ public class ContractCtx extends AbstractYongYouU8Ctx {
} }
entity = updateVendorEntityDetailByCode(entity, unit, holder); entity = updateVendorEntityDetailByCode(entity, unit, holder);
CompanyVendor vendor = entity.getVendor(); Vendor vendor = entity.getVendor();
if (vendor == null) { if (vendor == null) {
if (company != null) { if (company != null) {
vendor = vendorService.findByCompany(company); vendor = vendorService.findByCompany(company);
@@ -365,7 +365,7 @@ public class ContractCtx extends AbstractYongYouU8Ctx {
} }
} }
if (vendor == null) { if (vendor == null) {
vendor = new CompanyVendor(); vendor = new Vendor();
vendor.setCompany(company); vendor.setCompany(company);
vendorModified = true; vendorModified = true;
} }
@@ -574,7 +574,7 @@ public class ContractCtx extends AbstractYongYouU8Ctx {
return getContractService().findByCode(contractCode); return getContractService().findByCode(contractCode);
} }
public boolean syncByVendorEntity(CompanyVendor companyVendor, CompanyVendorEntity entity, MessageHolder holder) { public boolean syncByVendorEntity(Vendor vendor, CompanyVendorEntity entity, MessageHolder holder) {
String code = entity.getCode(); String code = entity.getCode();
holder.debug("同步供应商相关项 " + code + "," + entity.getName() + " 的合同"); holder.debug("同步供应商相关项 " + code + "," + entity.getName() + " 的合同");
if (!StringUtils.hasText(code)) { if (!StringUtils.hasText(code)) {

View File

@@ -21,7 +21,7 @@ import com.ecep.contract.ds.contract.service.PurchaseBillVoucherService;
import com.ecep.contract.ds.contract.service.PurchaseOrderItemService; import com.ecep.contract.ds.contract.service.PurchaseOrderItemService;
import com.ecep.contract.ds.contract.service.PurchaseOrdersService; import com.ecep.contract.ds.contract.service.PurchaseOrdersService;
import com.ecep.contract.model.Company; import com.ecep.contract.model.Company;
import com.ecep.contract.model.CompanyVendor; import com.ecep.contract.model.Vendor;
import com.ecep.contract.model.CompanyVendorEntity; import com.ecep.contract.model.CompanyVendorEntity;
import com.ecep.contract.model.Contract; import com.ecep.contract.model.Contract;
import com.ecep.contract.model.Inventory; import com.ecep.contract.model.Inventory;
@@ -109,7 +109,7 @@ public class PurchaseBillVoucherCtx extends AbstractYongYouU8Ctx {
Map<Integer, PurchaseBillVoucher> voucherMap = vouchers.stream() Map<Integer, PurchaseBillVoucher> voucherMap = vouchers.stream()
.collect(Collectors.toMap(PurchaseBillVoucher::getRefId, item -> item)); .collect(Collectors.toMap(PurchaseBillVoucher::getRefId, item -> item));
CompanyVendor vendor = getCompanyVendorService().findByCompany(company); Vendor vendor = getCompanyVendorService().findByCompany(company);
if (vendor != null) { if (vendor != null) {
List<CompanyVendorEntity> entities = getCompanyVendorEntityService().findAllByVendor(vendor); List<CompanyVendorEntity> entities = getCompanyVendorEntityService().findAllByVendor(vendor);
holder.debug(company.getName() + "" holder.debug(company.getName() + ""

View File

@@ -1,6 +1,5 @@
package com.ecep.contract.cloud.u8.ctx; package com.ecep.contract.cloud.u8.ctx;
import java.time.Instant;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List; import java.util.List;
@@ -19,7 +18,7 @@ import com.ecep.contract.ds.company.service.CompanyService;
import com.ecep.contract.ds.vendor.service.CompanyVendorEntityService; import com.ecep.contract.ds.vendor.service.CompanyVendorEntityService;
import com.ecep.contract.ds.vendor.service.CompanyVendorService; import com.ecep.contract.ds.vendor.service.CompanyVendorService;
import com.ecep.contract.model.Company; import com.ecep.contract.model.Company;
import com.ecep.contract.model.CompanyVendor; import com.ecep.contract.model.Vendor;
import com.ecep.contract.model.CompanyVendorEntity; import com.ecep.contract.model.CompanyVendorEntity;
import com.ecep.contract.model.VendorCatalog; import com.ecep.contract.model.VendorCatalog;
@@ -132,7 +131,7 @@ public class VendorCtx extends AbstractYongYouU8Ctx {
} }
CompanyVendor vendor = item.getVendor(); Vendor vendor = item.getVendor();
if (vendor == null) { if (vendor == null) {
// 如果没有关联供应商,则根据供应商名称或别名查找公司 // 如果没有关联供应商,则根据供应商名称或别名查找公司
Company company = findOrCreateCompanyByVendorEntity(item, holder); Company company = findOrCreateCompanyByVendorEntity(item, holder);
@@ -193,14 +192,14 @@ public class VendorCtx extends AbstractYongYouU8Ctx {
* @return 是否更新了供应商信息 * @return 是否更新了供应商信息
*/ */
public boolean syncVendor(Company company, MessageHolder holder) { public boolean syncVendor(Company company, MessageHolder holder) {
CompanyVendor companyVendor = getCompanyVendorService().findByCompany(company); Vendor vendor = getCompanyVendorService().findByCompany(company);
if (companyVendor == null) { if (vendor == null) {
holder.warn("供应商未创建, 如需要请手动创建."); holder.warn("供应商未创建, 如需要请手动创建.");
return false; return false;
} }
// 检索相关项 // 检索相关项
List<CompanyVendorEntity> entities = getCompanyVendorEntityService().findAllByVendor(companyVendor); List<CompanyVendorEntity> entities = getCompanyVendorEntityService().findAllByVendor(vendor);
if (entities.isEmpty()) { if (entities.isEmpty()) {
holder.error("供应商关联任何相关项"); holder.error("供应商关联任何相关项");
return false; return false;
@@ -229,14 +228,14 @@ public class VendorCtx extends AbstractYongYouU8Ctx {
} }
// 更新供应商的开发日期 // 更新供应商的开发日期
if (updateVendorDevelopDate(companyVendor, entities, holder)) { if (updateVendorDevelopDate(vendor, entities, holder)) {
companyVendor = getCompanyVendorService().save(companyVendor); vendor = getCompanyVendorService().save(vendor);
updated = true; updated = true;
} }
// 同步供应商关联的合同 // 同步供应商关联的合同
for (CompanyVendorEntity entity : entities) { for (CompanyVendorEntity entity : entities) {
if (getContractCtx().syncByVendorEntity(companyVendor, entity, holder)) { if (getContractCtx().syncByVendorEntity(vendor, entity, holder)) {
updated = true; updated = true;
} }
} }
@@ -262,7 +261,7 @@ public class VendorCtx extends AbstractYongYouU8Ctx {
return modified; return modified;
} }
private boolean updateVendorDevelopDate(CompanyVendor companyVendor, List<CompanyVendorEntity> entities, MessageHolder holder) { private boolean updateVendorDevelopDate(Vendor vendor, List<CompanyVendorEntity> entities, MessageHolder holder) {
LocalDate developDate = null; LocalDate developDate = null;
for (CompanyVendorEntity entity : entities) { for (CompanyVendorEntity entity : entities) {
// 取最早的开发日期 // 取最早的开发日期
@@ -270,7 +269,7 @@ public class VendorCtx extends AbstractYongYouU8Ctx {
developDate = entity.getDevelopDate(); developDate = entity.getDevelopDate();
} }
} }
return updateLocalDate(companyVendor::getDevelopDate, companyVendor::setDevelopDate, developDate, holder, "开发日期"); return updateLocalDate(vendor::getDevelopDate, vendor::setDevelopDate, developDate, holder, "开发日期");
} }
public CompanyVendorEntity findOrCreateByCode(String venCode, MessageHolder subHolder) { public CompanyVendorEntity findOrCreateByCode(String venCode, MessageHolder subHolder) {
@@ -285,7 +284,7 @@ public class VendorCtx extends AbstractYongYouU8Ctx {
return entity; return entity;
} }
private CompanyVendor createVendorByVendorEntity(CompanyVendorEntity entity, MessageHolder holder) { private Vendor createVendorByVendorEntity(CompanyVendorEntity entity, MessageHolder holder) {
LocalDate developDate = entity.getDevelopDate(); LocalDate developDate = entity.getDevelopDate();
if (developDate == null) { if (developDate == null) {
holder.warn(entity.getName() + " 没有设置开发日期,跳过"); holder.warn(entity.getName() + " 没有设置开发日期,跳过");
@@ -303,14 +302,14 @@ public class VendorCtx extends AbstractYongYouU8Ctx {
return null; return null;
} }
CompanyVendor companyVendor = new CompanyVendor(); Vendor vendor = new Vendor();
int nextId = SpringApp.getBean(OldVersionService.class).newCompanyVendor(entity.getName()); int nextId = SpringApp.getBean(OldVersionService.class).newCompanyVendor(entity.getName());
companyVendor.setId(nextId); vendor.setId(nextId);
companyVendor.setCatalog(entity.getCatalog()); vendor.setCatalog(entity.getCatalog());
companyVendor.setDevelopDate(developDate); vendor.setDevelopDate(developDate);
holder.info("新供应商:" + entity.getName() + "分配编号:" + nextId); holder.info("新供应商:" + entity.getName() + "分配编号:" + nextId);
companyVendor.setCreated(LocalDateTime.now()); vendor.setCreated(LocalDateTime.now());
return companyVendor; return vendor;
} }

View File

@@ -16,7 +16,7 @@ import com.ecep.contract.ds.vendor.service.CompanyVendorService;
import com.ecep.contract.model.Company; import com.ecep.contract.model.Company;
import com.ecep.contract.model.CompanyCustomer; import com.ecep.contract.model.CompanyCustomer;
import com.ecep.contract.model.CompanyOldName; import com.ecep.contract.model.CompanyOldName;
import com.ecep.contract.model.CompanyVendor; import com.ecep.contract.model.Vendor;
import com.ecep.contract.util.FileUtils; import com.ecep.contract.util.FileUtils;
import com.ecep.contract.util.MyStringUtils; import com.ecep.contract.util.MyStringUtils;
import com.ecep.contract.util.SpecificationUtils; import com.ecep.contract.util.SpecificationUtils;
@@ -465,11 +465,11 @@ public class CompanyService extends EntityService<Company, Integer> implements I
}); });
} }
List<CompanyVendor> searchedVendors = companyVendorService.search(searchText); List<Vendor> searchedVendors = companyVendorService.search(searchText);
if (!searchedVendors.isEmpty()) { if (!searchedVendors.isEmpty()) {
spec = SpecificationUtils.or(spec, (root, query, builder) -> { spec = SpecificationUtils.or(spec, (root, query, builder) -> {
return builder.in(root.get("id")).value(searchedVendors.stream() return builder.in(root.get("id")).value(searchedVendors.stream()
.map(CompanyVendor::getCompany) .map(Vendor::getCompany)
.filter(Objects::nonNull) .filter(Objects::nonNull)
.map(Company::getId) .map(Company::getId)
.collect(Collectors.toSet())); .collect(Collectors.toSet()));

View File

@@ -18,8 +18,6 @@ import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable; import org.springframework.cache.annotation.Cacheable;
import org.springframework.cache.annotation.Caching; import org.springframework.cache.annotation.Caching;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort; import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification; import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -33,12 +31,9 @@ import com.ecep.contract.ds.contract.repository.ContractRepository;
import com.ecep.contract.ds.other.service.SysConfService; import com.ecep.contract.ds.other.service.SysConfService;
import com.ecep.contract.model.Company; import com.ecep.contract.model.Company;
import com.ecep.contract.model.CompanyCustomer; import com.ecep.contract.model.CompanyCustomer;
import com.ecep.contract.model.CompanyVendor; import com.ecep.contract.model.Vendor;
import com.ecep.contract.model.Contract; import com.ecep.contract.model.Contract;
import com.ecep.contract.model.ContractCatalog; import com.ecep.contract.model.ContractCatalog;
import com.ecep.contract.model.ContractGroup;
import com.ecep.contract.model.ContractKind;
import com.ecep.contract.model.ContractType;
import com.ecep.contract.model.Project; import com.ecep.contract.model.Project;
import com.ecep.contract.util.MyStringUtils; import com.ecep.contract.util.MyStringUtils;
import com.ecep.contract.util.SpecificationUtils; import com.ecep.contract.util.SpecificationUtils;
@@ -238,7 +233,7 @@ public class ContractService extends EntityService<Contract, Integer> implements
}; };
} }
public List<Contract> findAllByCompanyVendor(CompanyVendor vendor, LocalDate beginDate, LocalDate endDate) { public List<Contract> findAllByCompanyVendor(Vendor vendor, LocalDate beginDate, LocalDate endDate) {
Company company = vendor.getCompany(); Company company = vendor.getCompany();
return contractRepository.findAll((root, query, cb) -> { return contractRepository.findAll((root, query, cb) -> {
Predicate p = cb.and( Predicate p = cb.and(

View File

@@ -6,7 +6,7 @@ import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import com.ecep.contract.model.CompanyVendor; import com.ecep.contract.model.Vendor;
import com.ecep.contract.model.CompanyVendorApprovedItem; import com.ecep.contract.model.CompanyVendorApprovedItem;
import com.ecep.contract.model.CompanyVendorApprovedList; import com.ecep.contract.model.CompanyVendorApprovedList;
@@ -19,7 +19,7 @@ public interface CompanyVendorApprovedItemRepository extends
List<CompanyVendorApprovedItem> findAllByList(CompanyVendorApprovedList list); List<CompanyVendorApprovedItem> findAllByList(CompanyVendorApprovedList list);
List<CompanyVendorApprovedItem> findAllByListAndVendor(CompanyVendorApprovedList list, CompanyVendor vendor); List<CompanyVendorApprovedItem> findAllByListAndVendor(CompanyVendorApprovedList list, Vendor vendor);
CompanyVendorApprovedItem findByListAndVendor(CompanyVendorApprovedList list, CompanyVendor vendor); CompanyVendorApprovedItem findByListAndVendor(CompanyVendorApprovedList list, Vendor vendor);
} }

View File

@@ -6,13 +6,13 @@ import java.util.Optional;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import com.ecep.contract.ds.MyRepository; import com.ecep.contract.ds.MyRepository;
import com.ecep.contract.model.CompanyVendor; import com.ecep.contract.model.Vendor;
import com.ecep.contract.model.CompanyVendorEntity; import com.ecep.contract.model.CompanyVendorEntity;
@Repository @Repository
public interface CompanyVendorEntityRepository extends MyRepository<CompanyVendorEntity, Integer> { public interface CompanyVendorEntityRepository extends MyRepository<CompanyVendorEntity, Integer> {
Optional<CompanyVendorEntity> findByCode(String code); Optional<CompanyVendorEntity> findByCode(String code);
List<CompanyVendorEntity> findByVendor(CompanyVendor vendor); List<CompanyVendorEntity> findByVendor(Vendor vendor);
} }

View File

@@ -7,7 +7,7 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import com.ecep.contract.VendorFileType; import com.ecep.contract.VendorFileType;
import com.ecep.contract.model.CompanyVendor; import com.ecep.contract.model.Vendor;
import com.ecep.contract.model.CompanyVendorFile; import com.ecep.contract.model.CompanyVendorFile;
@Repository @Repository
@@ -16,7 +16,7 @@ public interface CompanyVendorFileRepository
List<CompanyVendorFile> findAllByVendorId(int vendorId); List<CompanyVendorFile> findAllByVendorId(int vendorId);
List<CompanyVendorFile> findAllByVendorAndType(CompanyVendor vendor, VendorFileType type); List<CompanyVendorFile> findAllByVendorAndType(Vendor vendor, VendorFileType type);
List<CompanyVendorFile> findByVendorId(int vendorId); List<CompanyVendorFile> findByVendorId(int vendorId);
} }

View File

@@ -9,20 +9,20 @@ import org.springframework.transaction.annotation.Transactional;
import com.ecep.contract.ds.MyRepository; import com.ecep.contract.ds.MyRepository;
import com.ecep.contract.model.Company; import com.ecep.contract.model.Company;
import com.ecep.contract.model.CompanyVendor; import com.ecep.contract.model.Vendor;
import com.ecep.contract.model.VendorCatalog; import com.ecep.contract.model.VendorCatalog;
/** /**
* 供应商 Repository * 供应商 Repository
*/ */
@Repository @Repository
public interface CompanyVendorRepository extends MyRepository<CompanyVendor, Integer> { public interface CompanyVendorRepository extends MyRepository<Vendor, Integer> {
List<CompanyVendor> findAllByCatalog(VendorCatalog catalog); List<Vendor> findAllByCatalog(VendorCatalog catalog);
List<CompanyVendor> findAllByCatalogId(Integer catalogId); List<Vendor> findAllByCatalogId(Integer catalogId);
Optional<CompanyVendor> findByCompany(Company company); Optional<Vendor> findByCompany(Company company);
@Modifying @Modifying
@Transactional @Transactional

View File

@@ -19,7 +19,7 @@ import com.ecep.contract.ds.company.service.CompanyOldNameService;
import com.ecep.contract.ds.vendor.repository.CompanyVendorApprovedItemRepository; import com.ecep.contract.ds.vendor.repository.CompanyVendorApprovedItemRepository;
import com.ecep.contract.model.Company; import com.ecep.contract.model.Company;
import com.ecep.contract.model.CompanyOldName; import com.ecep.contract.model.CompanyOldName;
import com.ecep.contract.model.CompanyVendor; import com.ecep.contract.model.Vendor;
import com.ecep.contract.model.CompanyVendorApprovedItem; import com.ecep.contract.model.CompanyVendorApprovedItem;
import com.ecep.contract.model.CompanyVendorApprovedList; import com.ecep.contract.model.CompanyVendorApprovedList;
@@ -44,7 +44,7 @@ public class CompanyVendorApprovedItemService implements IEntityService<CompanyV
@Override @Override
public Specification<CompanyVendorApprovedItem> getSpecification(String searchText) { public Specification<CompanyVendorApprovedItem> getSpecification(String searchText) {
return (root, query, builder) -> { return (root, query, builder) -> {
Path<CompanyVendor> vendor = root.get("vendor"); Path<Vendor> vendor = root.get("vendor");
Path<Company> company = vendor.get("company"); Path<Company> company = vendor.get("company");
List<CompanyOldName> oldNames = companyOldNameService.search(searchText); List<CompanyOldName> oldNames = companyOldNameService.search(searchText);
@@ -95,7 +95,7 @@ public class CompanyVendorApprovedItemService implements IEntityService<CompanyV
return findAll(spec, pageable); return findAll(spec, pageable);
} }
public List<CompanyVendorApprovedItem> findAllByListAndVendor(CompanyVendorApprovedList approvedList, CompanyVendor vendor) { public List<CompanyVendorApprovedItem> findAllByListAndVendor(CompanyVendorApprovedList approvedList, Vendor vendor) {
return repository.findAllByListAndVendor(approvedList, vendor); return repository.findAllByListAndVendor(approvedList, vendor);
} }
} }

View File

@@ -17,7 +17,7 @@ import org.springframework.util.StringUtils;
import com.ecep.contract.IEntityService; import com.ecep.contract.IEntityService;
import com.ecep.contract.ds.vendor.repository.CompanyVendorEntityRepository; import com.ecep.contract.ds.vendor.repository.CompanyVendorEntityRepository;
import com.ecep.contract.model.CompanyVendor; import com.ecep.contract.model.Vendor;
import com.ecep.contract.model.CompanyVendorEntity; import com.ecep.contract.model.CompanyVendorEntity;
import com.ecep.contract.util.SpecificationUtils; import com.ecep.contract.util.SpecificationUtils;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
@@ -109,7 +109,7 @@ public class CompanyVendorEntityService implements IEntityService<CompanyVendorE
return repository.save(entity); return repository.save(entity);
} }
public List<CompanyVendorEntity> findAllByVendor(CompanyVendor vendor) { public List<CompanyVendorEntity> findAllByVendor(Vendor vendor) {
return repository.findByVendor(vendor); return repository.findByVendor(vendor);
} }
} }

View File

@@ -23,7 +23,7 @@ import com.ecep.contract.ds.company.service.CompanyBasicService;
import com.ecep.contract.ds.contract.service.ContractFileService; import com.ecep.contract.ds.contract.service.ContractFileService;
import com.ecep.contract.ds.contract.service.ContractService; import com.ecep.contract.ds.contract.service.ContractService;
import com.ecep.contract.ds.vendor.repository.CompanyVendorFileRepository; import com.ecep.contract.ds.vendor.repository.CompanyVendorFileRepository;
import com.ecep.contract.model.CompanyVendor; import com.ecep.contract.model.Vendor;
import com.ecep.contract.model.CompanyVendorFile; import com.ecep.contract.model.CompanyVendorFile;
import com.ecep.contract.model.Contract; import com.ecep.contract.model.Contract;
@@ -72,8 +72,8 @@ public class CompanyVendorFileService implements IEntityService<CompanyVendorFil
return findAll(spec, pageable); return findAll(spec, pageable);
} }
public List<CompanyVendorFile> findAllByVendor(CompanyVendor companyVendor) { public List<CompanyVendorFile> findAllByVendor(Vendor vendor) {
return repository.findAllByVendorId(companyVendor.getId()); return repository.findAllByVendorId(vendor.getId());
} }
public void delete(CompanyVendorFile file) { public void delete(CompanyVendorFile file) {
@@ -96,18 +96,18 @@ public class CompanyVendorFileService implements IEntityService<CompanyVendorFil
return repository.findAll(spec, sort); return repository.findAll(spec, sort);
} }
public List<CompanyVendorFile> findAllByVendorAndType(CompanyVendor vendor, VendorFileType type) { public List<CompanyVendorFile> findAllByVendorAndType(Vendor vendor, VendorFileType type) {
return repository.findAllByVendorAndType(vendor, type); return repository.findAllByVendorAndType(vendor, type);
} }
/** /**
* 验证供应商文件 * 验证供应商文件
* *
* @param companyVendor 供应商 * @param vendor 供应商
* @param verifyDate 验证日期 * @param verifyDate 验证日期
* @param holder 状态输出 * @param holder 状态输出
*/ */
public void verify(CompanyVendor companyVendor, LocalDate verifyDate, MessageHolder holder) { public void verify(Vendor vendor, LocalDate verifyDate, MessageHolder holder) {
// 验证最早日期,之前属于历史问题,不做处理 // 验证最早日期,之前属于历史问题,不做处理
LocalDate minDate = LocalDate.of(2022, 1, 1); LocalDate minDate = LocalDate.of(2022, 1, 1);
if (verifyDate.isBefore(minDate)) { if (verifyDate.isBefore(minDate)) {
@@ -115,7 +115,7 @@ public class CompanyVendorFileService implements IEntityService<CompanyVendorFil
} }
// 查询所有评价表 // 查询所有评价表
List<CompanyVendorFile> files = findAllByVendorAndType(companyVendor, VendorFileType.EvaluationForm); List<CompanyVendorFile> files = findAllByVendorAndType(vendor, VendorFileType.EvaluationForm);
if (files == null || files.isEmpty()) { if (files == null || files.isEmpty()) {
holder.error("未见供应商评价"); holder.error("未见供应商评价");
return; return;
@@ -146,21 +146,21 @@ public class CompanyVendorFileService implements IEntityService<CompanyVendorFil
/** /**
* 根据合同 和 评价表情况计算下一个评价日期 * 根据合同 和 评价表情况计算下一个评价日期
* *
* @param companyVendor 供应商 * @param vendor 供应商
* @return 下一个评价日期 * @return 下一个评价日期
*/ */
public LocalDate getNextSignDate(CompanyVendor companyVendor, Consumer<String> state) { public LocalDate getNextSignDate(Vendor vendor, Consumer<String> state) {
LocalDate miniContractDate = LocalDate.of(2022, 1, 1); LocalDate miniContractDate = LocalDate.of(2022, 1, 1);
// 检索全部合同 // 检索全部合同
ContractService contractService = SpringApp.getBean(ContractService.class); ContractService contractService = SpringApp.getBean(ContractService.class);
List<Contract> contractList = contractService.findAllByCompanyVendor(companyVendor, null, null); List<Contract> contractList = contractService.findAllByCompanyVendor(vendor, null, null);
if (contractList.isEmpty()) { if (contractList.isEmpty()) {
state.accept("未发现已登记的合同"); state.accept("未发现已登记的合同");
return null; return null;
} }
// 检索评价表 // 检索评价表
List<CompanyVendorFile> files = findAllByVendorAndType(companyVendor, VendorFileType.EvaluationForm); List<CompanyVendorFile> files = findAllByVendorAndType(vendor, VendorFileType.EvaluationForm);
CompanyVendorFile latestFile = files.stream() CompanyVendorFile latestFile = files.stream()
.filter(v -> v.getSignDate() != null && v.isValid()) .filter(v -> v.getSignDate() != null && v.isValid())
.max(Comparator.comparing(CompanyVendorFile::getSignDate)) .max(Comparator.comparing(CompanyVendorFile::getSignDate))

View File

@@ -40,7 +40,7 @@ import java.util.stream.Collectors;
@Service @Service
@CacheConfig(cacheNames = CompanyVendorConstant.CACHE_NAME) @CacheConfig(cacheNames = CompanyVendorConstant.CACHE_NAME)
public class CompanyVendorService extends CompanyBasicService public class CompanyVendorService extends CompanyBasicService
implements IEntityService<CompanyVendor>, QueryService<CompanyVendor> { implements IEntityService<Vendor>, QueryService<Vendor> {
private static final Logger logger = LoggerFactory.getLogger(CompanyVendorService.class); private static final Logger logger = LoggerFactory.getLogger(CompanyVendorService.class);
@@ -63,17 +63,17 @@ public class CompanyVendorService extends CompanyBasicService
private VendorClassRepository vendorClassRepository; private VendorClassRepository vendorClassRepository;
@Cacheable(key = "#p0") @Cacheable(key = "#p0")
public CompanyVendor findById(Integer id) { public Vendor findById(Integer id) {
return companyVendorRepository.findById(id).orElse(null); return companyVendorRepository.findById(id).orElse(null);
} }
public Page<CompanyVendor> findAll(Specification<CompanyVendor> spec, Pageable pageable) { public Page<Vendor> findAll(Specification<Vendor> spec, Pageable pageable) {
return companyVendorRepository.findAll(spec, pageable); return companyVendorRepository.findAll(spec, pageable);
} }
@Override @Override
public Page<CompanyVendor> findAll(JsonNode paramsNode, Pageable pageable) { public Page<Vendor> findAll(JsonNode paramsNode, Pageable pageable) {
Specification<CompanyVendor> spec = null; Specification<Vendor> spec = null;
if (paramsNode.has(ServiceConstant.KEY_SEARCH_TEXT)) { if (paramsNode.has(ServiceConstant.KEY_SEARCH_TEXT)) {
spec = getSpecification(paramsNode.get(ServiceConstant.KEY_SEARCH_TEXT).asText()); spec = getSpecification(paramsNode.get(ServiceConstant.KEY_SEARCH_TEXT).asText());
} }
@@ -86,31 +86,31 @@ public class CompanyVendorService extends CompanyBasicService
return findAll(spec, pageable); return findAll(spec, pageable);
} }
public CompanyVendor findByCompany(Company company) { public Vendor findByCompany(Company company) {
return companyVendorRepository.findByCompany(company).orElse(null); return companyVendorRepository.findByCompany(company).orElse(null);
} }
@Caching(evict = { @Caching(evict = {
@CacheEvict(key = "#p0.id") @CacheEvict(key = "#p0.id")
}) })
public CompanyVendor save(CompanyVendor companyVendor) { public Vendor save(Vendor vendor) {
return companyVendorRepository.save(companyVendor); return companyVendorRepository.save(vendor);
} }
@Caching(evict = { @Caching(evict = {
@CacheEvict(key = "#p0.id") @CacheEvict(key = "#p0.id")
}) })
@Override @Override
public void delete(CompanyVendor entity) { public void delete(Vendor entity) {
companyVendorRepository.delete(entity); companyVendorRepository.delete(entity);
} }
@Override @Override
public Specification<CompanyVendor> getSpecification(String searchText) { public Specification<Vendor> getSpecification(String searchText) {
if (!StringUtils.hasText(searchText)) { if (!StringUtils.hasText(searchText)) {
return null; return null;
} }
Specification<CompanyVendor> nameSpec = (root, query, builder) -> { Specification<Vendor> nameSpec = (root, query, builder) -> {
Path<Company> company = root.get("company"); Path<Company> company = root.get("company");
return companyService.buildSearchPredicate(searchText, company, query, builder); return companyService.buildSearchPredicate(searchText, company, query, builder);
}; };
@@ -131,7 +131,7 @@ public class CompanyVendorService extends CompanyBasicService
return builder.in(root.get("id")).value(searched.stream() return builder.in(root.get("id")).value(searched.stream()
.map(CompanyVendorEntity::getVendor) .map(CompanyVendorEntity::getVendor)
.filter(Objects::nonNull) .filter(Objects::nonNull)
.map(CompanyVendor::getId) .map(Vendor::getId)
.collect(Collectors.toSet())); .collect(Collectors.toSet()));
}); });
} }
@@ -139,8 +139,8 @@ public class CompanyVendorService extends CompanyBasicService
} }
@Override @Override
public List<CompanyVendor> search(String searchText) { public List<Vendor> search(String searchText) {
Specification<CompanyVendor> spec = getSpecification(searchText); Specification<Vendor> spec = getSpecification(searchText);
return companyVendorRepository.findAll(spec, Pageable.ofSize(10)).getContent(); return companyVendorRepository.findAll(spec, Pageable.ofSize(10)).getContent();
} }
@@ -156,11 +156,11 @@ public class CompanyVendorService extends CompanyBasicService
/** /**
* 重置 供应商文件 * 重置 供应商文件
* *
* @param companyVendor 供应商对象 * @param vendor 供应商对象
* @param status 输出 * @param status 输出
*/ */
public boolean reBuildingFiles(CompanyVendor companyVendor, Consumer<String> status) { public boolean reBuildingFiles(Vendor vendor, Consumer<String> status) {
List<CompanyVendorFile> dbFiles = companyVendorFileService.findAllByVendor(companyVendor); List<CompanyVendorFile> dbFiles = companyVendorFileService.findAllByVendor(vendor);
Map<String, CompanyVendorFile> map = new HashMap<>(); Map<String, CompanyVendorFile> map = new HashMap<>();
boolean modified = fetchDbFiles(dbFiles, map, status); boolean modified = fetchDbFiles(dbFiles, map, status);
@@ -171,15 +171,15 @@ public class CompanyVendorService extends CompanyBasicService
List<CompanyVendorFile> retrieveFiles = new ArrayList<>(); List<CompanyVendorFile> retrieveFiles = new ArrayList<>();
// TODO 供应商有曾用名,可能存在多个目录 // TODO 供应商有曾用名,可能存在多个目录
fetchFiles(companyVendor.getPath(), needMoveToCompanyPath, retrieveFiles, map, status); fetchFiles(vendor.getPath(), needMoveToCompanyPath, retrieveFiles, map, status);
// 移动文件到公司目录下 to company path // 移动文件到公司目录下 to company path
moveFileToCompany(companyVendor.getCompany(), needMoveToCompanyPath); moveFileToCompany(vendor.getCompany(), needMoveToCompanyPath);
status.accept("导入 " + retrieveFiles.size() + " 个文件"); status.accept("导入 " + retrieveFiles.size() + " 个文件");
if (!retrieveFiles.isEmpty()) { if (!retrieveFiles.isEmpty()) {
// update db // update db
retrieveFiles.forEach(v -> v.setVendor(companyVendor)); retrieveFiles.forEach(v -> v.setVendor(vendor));
companyVendorFileService.saveAll(retrieveFiles); companyVendorFileService.saveAll(retrieveFiles);
modified = true; modified = true;
} }
@@ -187,6 +187,7 @@ public class CompanyVendorService extends CompanyBasicService
return modified; return modified;
} }
@SuppressWarnings("unchecked")
@Override @Override
protected <T, F extends CompanyBasicFile<T>> boolean fillFileAsDefaultType(F dbFile, File file, protected <T, F extends CompanyBasicFile<T>> boolean fillFileAsDefaultType(F dbFile, File file,
Consumer<String> status) { Consumer<String> status) {
@@ -196,6 +197,7 @@ public class CompanyVendorService extends CompanyBasicService
return true; return true;
} }
@SuppressWarnings("unchecked")
@Override @Override
protected <T, F extends CompanyBasicFile<T>> F fillFileType(File file, List<File> fileList, protected <T, F extends CompanyBasicFile<T>> F fillFileType(File file, List<File> fileList,
Consumer<String> status) { Consumer<String> status) {
@@ -206,6 +208,7 @@ public class CompanyVendorService extends CompanyBasicService
return (F) vendorFile; return (F) vendorFile;
} }
@SuppressWarnings("unchecked")
@Override @Override
protected <T, F extends CompanyBasicFile<T>> boolean setFileTypeAsEvaluationForm(F file) { protected <T, F extends CompanyBasicFile<T>> boolean setFileTypeAsEvaluationForm(F file) {
T type = file.getType(); T type = file.getType();
@@ -235,22 +238,22 @@ public class CompanyVendorService extends CompanyBasicService
|| fileName.contains(CompanyVendorConstant.EVALUATION_FORM_NAME3); || fileName.contains(CompanyVendorConstant.EVALUATION_FORM_NAME3);
} }
public void verify(CompanyVendor companyVendor, MessageHolder holder) { public void verify(Vendor vendor, MessageHolder holder) {
if (companyVendor.getType() == null) { if (vendor.getType() == null) {
holder.warn("数据异常,未设置供应商类型"); holder.warn("数据异常,未设置供应商类型");
return; return;
} }
verify(companyVendor, LocalDate.now(), holder); verify(vendor, LocalDate.now(), holder);
} }
private boolean verifyAsTypicallyVendor(CompanyVendor companyVendor, LocalDate verifyDate, MessageHolder holder) { private boolean verifyAsTypicallyVendor(Vendor vendor, LocalDate verifyDate, MessageHolder holder) {
VendorType vendorType = companyVendor.getType(); VendorType vendorType = vendor.getType();
if (vendorType != VendorType.TYPICALLY) { if (vendorType != VendorType.TYPICALLY) {
return false; return false;
} }
boolean modified = false; boolean modified = false;
Company company = companyVendor.getCompany(); Company company = vendor.getCompany();
if (!Hibernate.isInitialized(company)) { if (!Hibernate.isInitialized(company)) {
company = companyService.findById(company.getId()); company = companyService.findById(company.getId());
} }
@@ -259,8 +262,8 @@ public class CompanyVendorService extends CompanyBasicService
if (StringUtils.hasText(entStatus)) { if (StringUtils.hasText(entStatus)) {
if (entStatus.contains("注销")) { if (entStatus.contains("注销")) {
holder.error("营业状态异常:" + entStatus + ", 自动设置为不合格"); holder.error("营业状态异常:" + entStatus + ", 自动设置为不合格");
companyVendor.setType(VendorType.UNQUALIFIED); vendor.setType(VendorType.UNQUALIFIED);
companyVendor.setDescription(MyStringUtils.appendIfAbsent(companyVendor.getDescription(), vendor.setDescription(MyStringUtils.appendIfAbsent(vendor.getDescription(),
"自动检测到营业状态为" + entStatus + ",设置为不合格供应商.")); "自动检测到营业状态为" + entStatus + ",设置为不合格供应商."));
modified = true; modified = true;
} }
@@ -271,8 +274,8 @@ public class CompanyVendorService extends CompanyBasicService
return modified; return modified;
} }
private boolean verifyAsQualifiedVendor(CompanyVendor companyVendor, LocalDate verifyDate, MessageHolder status) { private boolean verifyAsQualifiedVendor(Vendor vendor, LocalDate verifyDate, MessageHolder status) {
VendorType vendorType = companyVendor.getType(); VendorType vendorType = vendor.getType();
if (vendorType != VendorType.QUALIFIED) { if (vendorType != VendorType.QUALIFIED) {
return false; return false;
} }
@@ -292,51 +295,51 @@ public class CompanyVendorService extends CompanyBasicService
holder.error("合同未关联公司"); holder.error("合同未关联公司");
return; return;
} }
CompanyVendor companyVendor = findByCompany(company); Vendor vendor = findByCompany(company);
if (companyVendor == null) { if (vendor == null) {
holder.error("合同未关联供应商"); holder.error("合同未关联供应商");
return; return;
} }
if (companyVendor.getType() == null) { if (vendor.getType() == null) {
holder.error("供应商未设置类型"); holder.error("供应商未设置类型");
return; return;
} }
if (companyVendor.getType() == VendorType.UNQUALIFIED) { if (vendor.getType() == VendorType.UNQUALIFIED) {
holder.error("不合格供应商"); holder.error("不合格供应商");
return; return;
} }
verify(companyVendor, contract.getSetupDate(), holder); verify(vendor, contract.getSetupDate(), holder);
} }
/** /**
* 供应商合规检测 * 供应商合规检测
* *
* @param companyVendor 供应商对象 * @param vendor 供应商对象
* @param verifyDate 检测日期 * @param verifyDate 检测日期
* @param holder 状态输出对象 * @param holder 状态输出对象
*/ */
public boolean verify(CompanyVendor companyVendor, LocalDate verifyDate, MessageHolder holder) { public boolean verify(Vendor vendor, LocalDate verifyDate, MessageHolder holder) {
boolean modified = false; boolean modified = false;
if (verifyAsQualifiedVendor(companyVendor, verifyDate, holder)) { if (verifyAsQualifiedVendor(vendor, verifyDate, holder)) {
modified = true; modified = true;
} }
if (verifyAsTypicallyVendor(companyVendor, verifyDate, holder)) { if (verifyAsTypicallyVendor(vendor, verifyDate, holder)) {
modified = true; modified = true;
} }
if (!StringUtils.hasText(companyVendor.getPurchase())) { if (!StringUtils.hasText(vendor.getPurchase())) {
holder.error("未设置采购的产品"); holder.error("未设置采购的产品");
} }
if (!StringUtils.hasText(companyVendor.getPath())) { if (!StringUtils.hasText(vendor.getPath())) {
holder.error("未设置文件夹"); holder.error("未设置文件夹");
} }
companyVendorFileService.verify(companyVendor, verifyDate, holder); companyVendorFileService.verify(vendor, verifyDate, holder);
if (modified) { if (modified) {
companyVendorRepository.save(companyVendor); companyVendorRepository.save(vendor);
} }
return modified; return modified;
} }
@@ -357,8 +360,8 @@ public class CompanyVendorService extends CompanyBasicService
return new File(path); return new File(path);
} }
public boolean makePathAbsent(CompanyVendor companyVendor) { public boolean makePathAbsent(Vendor vendor) {
String path = companyVendor.getPath(); String path = vendor.getPath();
if (StringUtils.hasText(path)) { if (StringUtils.hasText(path)) {
File file = new File(path); File file = new File(path);
if (file.exists()) { if (file.exists()) {
@@ -366,26 +369,26 @@ public class CompanyVendorService extends CompanyBasicService
} }
} }
File dir = makePath(companyVendor); File dir = makePath(vendor);
if (dir == null) { if (dir == null) {
return false; return false;
} }
if (!dir.exists()) { if (!dir.exists()) {
return false; return false;
} }
companyVendor.setPath(dir.getAbsolutePath()); vendor.setPath(dir.getAbsolutePath());
return true; return true;
} }
public File makePath(CompanyVendor companyVendor) { public File makePath(Vendor vendor) {
File basePath = getBasePath(); File basePath = getBasePath();
Company company = companyVendor.getCompany(); Company company = vendor.getCompany();
if (!Hibernate.isInitialized(company)) { if (!Hibernate.isInitialized(company)) {
company = companyService.findById(company.getId()); company = companyService.findById(company.getId());
} }
String companyName = company.getName(); String companyName = company.getName();
String fileName = CompanyUtils.formatCompanyVendorId(companyVendor.getId()) + "-" String fileName = CompanyUtils.formatCompanyVendorId(vendor.getId()) + "-"
+ FileUtils.escapeFileName(companyName); + FileUtils.escapeFileName(companyName);
File dir = new File(basePath, fileName); File dir = new File(basePath, fileName);
@@ -398,7 +401,7 @@ public class CompanyVendorService extends CompanyBasicService
} }
public void resetTo(Company from, Company to) { public void resetTo(Company from, Company to) {
Optional<CompanyVendor> optional = companyVendorRepository.findByCompany(from); Optional<Vendor> optional = companyVendorRepository.findByCompany(from);
optional.ifPresent(companyVendor -> { optional.ifPresent(companyVendor -> {
companyVendor companyVendor
.setDescription(MyStringUtils.appendIfAbsent(companyVendor.getDescription(), "转自 " + from.getId())); .setDescription(MyStringUtils.appendIfAbsent(companyVendor.getDescription(), "转自 " + from.getId()));
@@ -445,7 +448,7 @@ public class CompanyVendorService extends CompanyBasicService
return vendorTypeLocalRepository.save(type); return vendorTypeLocalRepository.save(type);
} }
public long count(Specification<CompanyVendor> spec) { public long count(Specification<Vendor> spec) {
return companyVendorRepository.count(spec); return companyVendorRepository.count(spec);
} }

View File

@@ -16,7 +16,7 @@ import org.springframework.util.StringUtils;
import com.ecep.contract.MessageHolder; import com.ecep.contract.MessageHolder;
import com.ecep.contract.ds.contract.tasker.ContractRepairComm; import com.ecep.contract.ds.contract.tasker.ContractRepairComm;
import com.ecep.contract.ds.vendor.service.CompanyVendorService; import com.ecep.contract.ds.vendor.service.CompanyVendorService;
import com.ecep.contract.model.CompanyVendor; import com.ecep.contract.model.Vendor;
import com.ecep.contract.ui.Tasker; import com.ecep.contract.ui.Tasker;
/** /**
@@ -31,7 +31,7 @@ public class VendorVerifyAllTasker extends Tasker<Object> {
updateTitle("遍历核验所有供应商"); updateTitle("遍历核验所有供应商");
Pageable pageRequest = PageRequest.ofSize(200); Pageable pageRequest = PageRequest.ofSize(200);
AtomicInteger counter = new AtomicInteger(0); AtomicInteger counter = new AtomicInteger(0);
Specification<CompanyVendor> spec = null; Specification<Vendor> spec = null;
CompanyVendorService vendorService = getBean(CompanyVendorService.class); CompanyVendorService vendorService = getBean(CompanyVendorService.class);
long total = vendorService.count(spec); long total = vendorService.count(spec);
@@ -40,12 +40,12 @@ public class VendorVerifyAllTasker extends Tasker<Object> {
break; break;
} }
Page<CompanyVendor> page = vendorService.findAll(spec, pageRequest); Page<Vendor> page = vendorService.findAll(spec, pageRequest);
if (page.isEmpty()) { if (page.isEmpty()) {
break; break;
} }
for (CompanyVendor vendor : page) { for (Vendor vendor : page) {
if (isCancelled()) { if (isCancelled()) {
break; break;
} }