feat: 添加供应商管理相关功能及数据库表结构
新增供应商名录管理功能,包括合格供应商名录、供应商文件、供应商关联实体等模块。主要变更包括: 1. 添加COMPANY_VENDOR_ENTITY表的CREATOR_ID、MODIFIER_ID和MODIFY_DATE字段 2. 实现供应商同步任务类(VendorClassSyncTask等) 3. 新增供应商相关VO类(VendorApprovedVo、VendorFileVo等) 4. 添加供应商相关Repository接口(VendorRepository、VendorFileRepository等) 5. 实现供应商相关服务类(VendorApprovedService、VendorFileService等) 6. 添加供应商管理界面控制器及皮肤类 7. 新增供应商文件类型枚举和本地化配置
This commit is contained in:
@@ -1,19 +1,17 @@
|
||||
package com.ecep.contract.controller.vendor;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.ecep.contract.controller.tab.TabSkin;
|
||||
import com.ecep.contract.controller.table.AbstEntityTableTabSkin;
|
||||
import com.ecep.contract.model.IdentityEntity;
|
||||
import com.ecep.contract.service.CompanyService;
|
||||
import com.ecep.contract.service.CompanyVendorService;
|
||||
import com.ecep.contract.service.VendorService;
|
||||
import com.ecep.contract.util.ParamUtils;
|
||||
import com.ecep.contract.vm.CompanyVendorViewModel;
|
||||
import com.ecep.contract.vm.IdentityViewModel;
|
||||
import com.ecep.contract.vo.CompanyVendorVo;
|
||||
import com.ecep.contract.vo.VendorVo;
|
||||
|
||||
public abstract class AbstCompanyVendorTableTabSkin<T extends IdentityEntity, TV extends IdentityViewModel<T>>
|
||||
extends AbstEntityTableTabSkin<CompanyVendorWindowController, CompanyVendorVo, CompanyVendorViewModel, T, TV>
|
||||
extends AbstEntityTableTabSkin<CompanyVendorWindowController, VendorVo, CompanyVendorViewModel, T, TV>
|
||||
implements TabSkin {
|
||||
public AbstCompanyVendorTableTabSkin(CompanyVendorWindowController controller) {
|
||||
super(controller);
|
||||
@@ -23,12 +21,12 @@ public abstract class AbstCompanyVendorTableTabSkin<T extends IdentityEntity, TV
|
||||
return controller.getCompanyService();
|
||||
}
|
||||
|
||||
public CompanyVendorService getCompanyVendorService() {
|
||||
return getCachedBean(CompanyVendorService.class);
|
||||
public VendorService getCompanyVendorService() {
|
||||
return getCachedBean(VendorService.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParamUtils.Builder getSpecification(CompanyVendorVo parent) {
|
||||
public ParamUtils.Builder getSpecification(VendorVo parent) {
|
||||
ParamUtils.Builder params = getSpecification();
|
||||
params.equals("vendor", parent.getId());
|
||||
return params;
|
||||
@@ -7,22 +7,22 @@ import com.ecep.contract.controller.table.cell.CompanyTableCell;
|
||||
import com.ecep.contract.controller.table.cell.VendorCatalogTableCell;
|
||||
import com.ecep.contract.controller.table.cell.VendorTypeTableCell;
|
||||
import com.ecep.contract.service.CompanyService;
|
||||
import com.ecep.contract.service.CompanyVendorService;
|
||||
import com.ecep.contract.service.VendorService;
|
||||
import com.ecep.contract.service.VendorCatalogService;
|
||||
import com.ecep.contract.service.VendorTypeService;
|
||||
import com.ecep.contract.util.ParamUtils;
|
||||
import com.ecep.contract.vm.CompanyVendorViewModel;
|
||||
import com.ecep.contract.vo.CompanyVendorVo;
|
||||
import com.ecep.contract.vo.VendorVo;
|
||||
import javafx.application.Platform;
|
||||
import lombok.Setter;
|
||||
|
||||
public class CompanyVendorManagerSkin
|
||||
extends
|
||||
AbstEntityManagerSkin<CompanyVendorVo, CompanyVendorViewModel, CompanyVendorManagerSkin, CompanyVendorManagerWindowController> {
|
||||
AbstEntityManagerSkin<VendorVo, CompanyVendorViewModel, CompanyVendorManagerSkin, VendorManagerWindowController> {
|
||||
|
||||
@Setter
|
||||
private CompanyService companyService;
|
||||
public CompanyVendorManagerSkin(CompanyVendorManagerWindowController controller) {
|
||||
public CompanyVendorManagerSkin(VendorManagerWindowController controller) {
|
||||
super(controller);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ public class CompanyVendorManagerSkin
|
||||
return companyService;
|
||||
}
|
||||
|
||||
public CompanyVendorService getCompanyVendorService() {
|
||||
public VendorService getCompanyVendorService() {
|
||||
return controller.getViewModelService();
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.ecep.contract.controller.vendor;
|
||||
import java.time.LocalDate;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
import com.ecep.contract.service.VendorService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
@@ -17,12 +18,11 @@ import com.ecep.contract.controller.AbstManagerWindowController;
|
||||
import com.ecep.contract.controller.vendor.approved_list.CompanyVendorApprovedListManagerWindowController;
|
||||
import com.ecep.contract.controller.vendor.group.VendorGroupManagerWindowController;
|
||||
import com.ecep.contract.service.CompanyService;
|
||||
import com.ecep.contract.service.CompanyVendorService;
|
||||
import com.ecep.contract.task.VendorVerifyAllTasker;
|
||||
import com.ecep.contract.util.FxmlPath;
|
||||
import com.ecep.contract.util.UITools;
|
||||
import com.ecep.contract.vm.CompanyVendorViewModel;
|
||||
import com.ecep.contract.vo.CompanyVendorVo;
|
||||
import com.ecep.contract.vo.VendorVo;
|
||||
import com.ecep.contract.vo.VendorTypeLocalVo;
|
||||
|
||||
import javafx.event.ActionEvent;
|
||||
@@ -35,7 +35,7 @@ import javafx.stage.Stage;
|
||||
@Component
|
||||
@FxmlPath("/ui/company/vendor/vendor_manager.fxml")
|
||||
public class CompanyVendorManagerWindowController
|
||||
extends AbstManagerWindowController<CompanyVendorVo, CompanyVendorViewModel, CompanyVendorManagerSkin> {
|
||||
extends AbstManagerWindowController<VendorVo, CompanyVendorViewModel, CompanyVendorManagerSkin> {
|
||||
|
||||
// columns
|
||||
public TableColumn<CompanyVendorViewModel, Number> idColumn;
|
||||
@@ -53,7 +53,7 @@ public class CompanyVendorManagerWindowController
|
||||
@Autowired
|
||||
private CompanyService companyService;
|
||||
@Autowired
|
||||
private CompanyVendorService companyVendorService;
|
||||
private VendorService vendorService;
|
||||
|
||||
@Override
|
||||
public void show(Stage stage) {
|
||||
@@ -62,8 +62,8 @@ public class CompanyVendorManagerWindowController
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompanyVendorService getViewModelService() {
|
||||
return companyVendorService;
|
||||
public VendorService getViewModelService() {
|
||||
return vendorService;
|
||||
}
|
||||
|
||||
public void onFileReBuildingAction(ActionEvent event) {
|
||||
@@ -75,11 +75,11 @@ public class CompanyVendorManagerWindowController
|
||||
};
|
||||
|
||||
while (true) {
|
||||
Page<CompanyVendorVo> page = companyVendorService.findAll(null, pageRequest);
|
||||
for (CompanyVendorVo companyVendor : page) {
|
||||
Page<VendorVo> page = vendorService.findAll(null, pageRequest);
|
||||
for (VendorVo companyVendor : page) {
|
||||
MessageHolder sub = messageHolder
|
||||
.sub(page.getNumber() + "/" + page.getTotalPages() + " #" + companyVendor.getId() + ">");
|
||||
companyVendorService.reBuildingFiles(companyVendor, sub);
|
||||
vendorService.reBuildingFiles(companyVendor, sub);
|
||||
}
|
||||
if (!page.hasNext()) {
|
||||
break;
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.ecep.contract.controller.vendor;
|
||||
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
|
||||
import com.ecep.contract.MyDateTimeUtils;
|
||||
import com.ecep.contract.SpringApp;
|
||||
@@ -9,18 +8,16 @@ import com.ecep.contract.VendorType;
|
||||
import com.ecep.contract.controller.ComboBoxUtils;
|
||||
import com.ecep.contract.controller.company.CompanyWindowController;
|
||||
import com.ecep.contract.controller.tab.AbstEntityBasedTabSkin;
|
||||
import com.ecep.contract.model.VendorTypeLocal;
|
||||
import com.ecep.contract.service.CompanyContactService;
|
||||
import com.ecep.contract.service.CompanyVendorService;
|
||||
import com.ecep.contract.service.VendorService;
|
||||
import com.ecep.contract.service.VendorCatalogService;
|
||||
import com.ecep.contract.service.VendorTypeService;
|
||||
import com.ecep.contract.util.UITools;
|
||||
import com.ecep.contract.vm.CompanyVendorViewModel;
|
||||
import com.ecep.contract.vm.CompanyViewModel;
|
||||
import com.ecep.contract.vo.CompanyVendorVo;
|
||||
import com.ecep.contract.vo.VendorVo;
|
||||
import com.ecep.contract.vo.CompanyVo;
|
||||
|
||||
import javafx.beans.property.SimpleObjectProperty;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.event.ActionEvent;
|
||||
@@ -30,7 +27,7 @@ import javafx.util.converter.LocalDateStringConverter;
|
||||
import javafx.util.converter.LocalDateTimeStringConverter;
|
||||
|
||||
public class CompanyVendorTabSkinBase
|
||||
extends AbstEntityBasedTabSkin<CompanyVendorWindowController, CompanyVendorVo, CompanyVendorViewModel> {
|
||||
extends AbstEntityBasedTabSkin<CompanyVendorWindowController, VendorVo, CompanyVendorViewModel> {
|
||||
public CompanyVendorTabSkinBase(CompanyVendorWindowController controller) {
|
||||
super(controller);
|
||||
}
|
||||
@@ -101,7 +98,7 @@ public class CompanyVendorTabSkinBase
|
||||
}
|
||||
|
||||
public void onCreatePathAction(ActionEvent event) {
|
||||
CompanyVendorVo companyVendor = getEntity();
|
||||
VendorVo companyVendor = getEntity();
|
||||
if (getCompanyVendorService().makePathAbsent(companyVendor)) {
|
||||
save(companyVendor);
|
||||
} else {
|
||||
@@ -117,7 +114,7 @@ public class CompanyVendorTabSkinBase
|
||||
setStatus("未实现");
|
||||
}
|
||||
|
||||
public CompanyVendorService getCompanyVendorService() {
|
||||
public VendorService getCompanyVendorService() {
|
||||
return controller.getViewModelService();
|
||||
}
|
||||
}
|
||||
@@ -5,11 +5,11 @@ import java.time.LocalDate;
|
||||
import com.ecep.contract.controller.tab.TabSkin;
|
||||
import com.ecep.contract.controller.table.cell.EmployeeTableCell;
|
||||
import com.ecep.contract.controller.table.cell.VendorCatalogTableCell;
|
||||
import com.ecep.contract.service.CompanyVendorEntityService;
|
||||
import com.ecep.contract.service.VendorEntityService;
|
||||
import com.ecep.contract.service.VendorCatalogService;
|
||||
import com.ecep.contract.util.FxmlPath;
|
||||
import com.ecep.contract.vm.CompanyVendorEntityViewModel;
|
||||
import com.ecep.contract.vo.CompanyVendorEntityVo;
|
||||
import com.ecep.contract.vo.VendorEntityVo;
|
||||
|
||||
import javafx.scene.control.MenuItem;
|
||||
import javafx.scene.control.Tab;
|
||||
@@ -17,7 +17,7 @@ import javafx.scene.control.TableColumn;
|
||||
|
||||
@FxmlPath("/ui/company/vendor/vendor-tab-entity.fxml")
|
||||
public class CompanyVendorTabSkinEntity
|
||||
extends AbstCompanyVendorTableTabSkin<CompanyVendorEntityVo, CompanyVendorEntityViewModel>
|
||||
extends AbstCompanyVendorTableTabSkin<VendorEntityVo, CompanyVendorEntityViewModel>
|
||||
implements TabSkin {
|
||||
|
||||
// 关联项 tab
|
||||
@@ -39,12 +39,12 @@ public class CompanyVendorTabSkinEntity
|
||||
super(controller);
|
||||
}
|
||||
|
||||
CompanyVendorEntityService getVendorEntityService() {
|
||||
return getCachedBean(CompanyVendorEntityService.class);
|
||||
VendorEntityService getVendorEntityService() {
|
||||
return getCachedBean(VendorEntityService.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CompanyVendorEntityService getViewModelService() {
|
||||
protected VendorEntityService getViewModelService() {
|
||||
return getVendorEntityService();
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import org.springframework.util.StringUtils;
|
||||
import com.ecep.contract.DesktopUtils;
|
||||
import com.ecep.contract.controller.AbstEntityController;
|
||||
import com.ecep.contract.service.CompanyService;
|
||||
import com.ecep.contract.service.CompanyVendorService;
|
||||
import com.ecep.contract.service.VendorService;
|
||||
import com.ecep.contract.util.FxmlPath;
|
||||
import com.ecep.contract.vm.CompanyVendorViewModel;
|
||||
|
||||
@@ -31,20 +31,20 @@ import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.BorderPane;
|
||||
import javafx.stage.Window;
|
||||
import javafx.stage.WindowEvent;
|
||||
import com.ecep.contract.vo.CompanyVendorVo;
|
||||
import com.ecep.contract.vo.VendorVo;
|
||||
import com.ecep.contract.vo.CompanyVo;
|
||||
|
||||
@Lazy
|
||||
@Scope("prototype")
|
||||
@Component
|
||||
@FxmlPath("/ui/company/vendor/vendor.fxml")
|
||||
public class CompanyVendorWindowController extends AbstEntityController<CompanyVendorVo, CompanyVendorViewModel> {
|
||||
public class CompanyVendorWindowController extends AbstEntityController<VendorVo, CompanyVendorViewModel> {
|
||||
private static final Logger logger = LoggerFactory.getLogger(CompanyVendorWindowController.class);
|
||||
|
||||
/**
|
||||
* 显示界面
|
||||
*/
|
||||
public static void show(CompanyVendorVo companyVendor, Window window) {
|
||||
public static void show(VendorVo companyVendor, Window window) {
|
||||
show(CompanyVendorWindowController.class, CompanyVendorViewModel.from(companyVendor), window);
|
||||
}
|
||||
|
||||
@@ -91,8 +91,8 @@ public class CompanyVendorWindowController extends AbstEntityController<CompanyV
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompanyVendorService getViewModelService() {
|
||||
return getCachedBean(CompanyVendorService.class);
|
||||
public VendorService getViewModelService() {
|
||||
return getCachedBean(VendorService.class);
|
||||
}
|
||||
|
||||
public CompanyService getCompanyService() {
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.ecep.contract.controller.vendor.approved_list;
|
||||
|
||||
import com.ecep.contract.controller.AbstEntityManagerSkin;
|
||||
import com.ecep.contract.service.CompanyVendorApprovedListService;
|
||||
import com.ecep.contract.vo.CompanyVendorApprovedListVo;
|
||||
import com.ecep.contract.service.VendorApprovedService;
|
||||
import com.ecep.contract.vo.VendorApprovedVo;
|
||||
import com.ecep.contract.vm.CompanyVendorApprovedListViewModel;
|
||||
|
||||
import javafx.event.ActionEvent;
|
||||
@@ -10,15 +10,15 @@ import javafx.scene.control.SelectionMode;
|
||||
import lombok.Setter;
|
||||
|
||||
public class CompanyVendorApprovedListManagerSkin
|
||||
extends AbstEntityManagerSkin<CompanyVendorApprovedListVo, CompanyVendorApprovedListViewModel, CompanyVendorApprovedListManagerSkin, CompanyVendorApprovedListManagerWindowController> {
|
||||
extends AbstEntityManagerSkin<VendorApprovedVo, CompanyVendorApprovedListViewModel, CompanyVendorApprovedListManagerSkin, CompanyVendorApprovedListManagerWindowController> {
|
||||
@Setter
|
||||
private CompanyVendorApprovedListService service;
|
||||
private VendorApprovedService service;
|
||||
|
||||
public CompanyVendorApprovedListManagerSkin(CompanyVendorApprovedListManagerWindowController controller) {
|
||||
super(controller);
|
||||
}
|
||||
|
||||
public CompanyVendorApprovedListService getService() {
|
||||
public VendorApprovedService getService() {
|
||||
return service;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public class CompanyVendorApprovedListManagerSkin
|
||||
|
||||
@Override
|
||||
protected void onTableCreateNewAction(ActionEvent event) {
|
||||
CompanyVendorApprovedListVo list = new CompanyVendorApprovedListVo();
|
||||
VendorApprovedVo list = new VendorApprovedVo();
|
||||
CompanyVendorApprovedListViewModel viewModel = CompanyVendorApprovedListViewModel.from(list);
|
||||
|
||||
dataSet.add(viewModel);
|
||||
@@ -8,9 +8,9 @@ import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.ecep.contract.controller.AbstManagerWindowController;
|
||||
import com.ecep.contract.service.CompanyVendorApprovedListService;
|
||||
import com.ecep.contract.service.VendorApprovedService;
|
||||
import com.ecep.contract.util.FxmlPath;
|
||||
import com.ecep.contract.vo.CompanyVendorApprovedListVo;
|
||||
import com.ecep.contract.vo.VendorApprovedVo;
|
||||
import com.ecep.contract.vm.CompanyVendorApprovedListViewModel;
|
||||
|
||||
import javafx.event.ActionEvent;
|
||||
@@ -25,7 +25,7 @@ import javafx.stage.WindowEvent;
|
||||
@Component
|
||||
@FxmlPath("/ui/company/vendor/vendor_approved_list_manager.fxml")
|
||||
public class CompanyVendorApprovedListManagerWindowController
|
||||
extends AbstManagerWindowController<CompanyVendorApprovedListVo, CompanyVendorApprovedListViewModel, CompanyVendorApprovedListManagerSkin> {
|
||||
extends AbstManagerWindowController<VendorApprovedVo, CompanyVendorApprovedListViewModel, CompanyVendorApprovedListManagerSkin> {
|
||||
|
||||
public TableColumn<CompanyVendorApprovedListViewModel, Number> idColumn;
|
||||
public TableColumn<CompanyVendorApprovedListViewModel, String> titleColumn;
|
||||
@@ -33,7 +33,7 @@ public class CompanyVendorApprovedListManagerWindowController
|
||||
public TableColumn<CompanyVendorApprovedListViewModel, String> descriptionColumn;
|
||||
|
||||
@Autowired
|
||||
private CompanyVendorApprovedListService service;
|
||||
private VendorApprovedService service;
|
||||
|
||||
@Override
|
||||
protected CompanyVendorApprovedListManagerSkin createDefaultSkin() {
|
||||
@@ -49,7 +49,7 @@ public class CompanyVendorApprovedListManagerWindowController
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompanyVendorApprovedListService getViewModelService() {
|
||||
public VendorApprovedService getViewModelService() {
|
||||
return service;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import java.time.format.DateTimeFormatter;
|
||||
|
||||
import com.ecep.contract.controller.tab.AbstEntityBasedTabSkin;
|
||||
import com.ecep.contract.controller.tab.TabSkin;
|
||||
import com.ecep.contract.vo.CompanyVendorApprovedListVo;
|
||||
import com.ecep.contract.vo.VendorApprovedVo;
|
||||
import com.ecep.contract.vm.CompanyVendorApprovedListViewModel;
|
||||
|
||||
import javafx.scene.control.Tab;
|
||||
@@ -12,7 +12,7 @@ import javafx.util.converter.LocalDateStringConverter;
|
||||
|
||||
public class CompanyVendorApprovedListTabSkinBase
|
||||
extends
|
||||
AbstEntityBasedTabSkin<CompanyVendorApprovedListWindowController, CompanyVendorApprovedListVo, CompanyVendorApprovedListViewModel>
|
||||
AbstEntityBasedTabSkin<CompanyVendorApprovedListWindowController, VendorApprovedVo, CompanyVendorApprovedListViewModel>
|
||||
implements TabSkin {
|
||||
public CompanyVendorApprovedListTabSkinBase(CompanyVendorApprovedListWindowController controller) {
|
||||
super(controller);
|
||||
@@ -2,7 +2,6 @@ package com.ecep.contract.controller.vendor.approved_list;
|
||||
|
||||
import java.io.File;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
import org.springframework.util.StringUtils;
|
||||
@@ -10,13 +9,12 @@ import org.springframework.util.StringUtils;
|
||||
import com.ecep.contract.DesktopUtils;
|
||||
import com.ecep.contract.controller.tab.TabSkin;
|
||||
import com.ecep.contract.controller.table.AbstEntityTableTabSkin;
|
||||
import com.ecep.contract.model.CompanyVendorApprovedFile;
|
||||
import com.ecep.contract.service.CompanyVendorApprovedFileService;
|
||||
import com.ecep.contract.service.VendorApprovedFileService;
|
||||
import com.ecep.contract.util.FxmlPath;
|
||||
import com.ecep.contract.util.ParamUtils;
|
||||
import com.ecep.contract.util.ParamUtils.Builder;
|
||||
import com.ecep.contract.vo.CompanyVendorApprovedFileVo;
|
||||
import com.ecep.contract.vo.CompanyVendorApprovedListVo;
|
||||
import com.ecep.contract.vo.VendorApprovedFileVo;
|
||||
import com.ecep.contract.vo.VendorApprovedVo;
|
||||
import com.ecep.contract.vm.CompanyVendorApprovedFileViewModel;
|
||||
import com.ecep.contract.vm.CompanyVendorApprovedListViewModel;
|
||||
|
||||
@@ -28,10 +26,10 @@ import javafx.scene.control.TableColumn;
|
||||
@FxmlPath("/ui/company/vendor/vendor_approved_list-tab-file.fxml")
|
||||
public class CompanyVendorApprovedListTabSkinFiles
|
||||
extends
|
||||
AbstEntityTableTabSkin<CompanyVendorApprovedListWindowController, CompanyVendorApprovedListVo, CompanyVendorApprovedListViewModel, CompanyVendorApprovedFileVo, CompanyVendorApprovedFileViewModel>
|
||||
AbstEntityTableTabSkin<CompanyVendorApprovedListWindowController, VendorApprovedVo, CompanyVendorApprovedListViewModel, VendorApprovedFileVo, CompanyVendorApprovedFileViewModel>
|
||||
implements TabSkin {
|
||||
|
||||
private CompanyVendorApprovedFileService fileService;
|
||||
private VendorApprovedFileService fileService;
|
||||
|
||||
public TableColumn<CompanyVendorApprovedFileViewModel, Number> fileTable_idColumn;
|
||||
public TableColumn<CompanyVendorApprovedFileViewModel, String> fileTable_filePathColumn;
|
||||
@@ -42,20 +40,20 @@ public class CompanyVendorApprovedListTabSkinFiles
|
||||
super(controller);
|
||||
}
|
||||
|
||||
CompanyVendorApprovedFileService getFileService() {
|
||||
VendorApprovedFileService getFileService() {
|
||||
if (fileService == null) {
|
||||
fileService = getBean(CompanyVendorApprovedFileService.class);
|
||||
fileService = getBean(VendorApprovedFileService.class);
|
||||
}
|
||||
return fileService;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CompanyVendorApprovedFileService getViewModelService() {
|
||||
protected VendorApprovedFileService getViewModelService() {
|
||||
return getFileService();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder getSpecification(CompanyVendorApprovedListVo parent) {
|
||||
public Builder getSpecification(VendorApprovedVo parent) {
|
||||
return ParamUtils.builder().equals("list", parent.getId());
|
||||
}
|
||||
|
||||
@@ -77,7 +75,7 @@ public class CompanyVendorApprovedListTabSkinFiles
|
||||
public void onFileReBuildingAction(ActionEvent event) {
|
||||
CompletableFuture.runAsync(() -> {
|
||||
int id = viewModel.getId().get();
|
||||
CompanyVendorApprovedListVo list = new CompanyVendorApprovedListVo();
|
||||
VendorApprovedVo list = new VendorApprovedVo();
|
||||
viewModel.copyTo(list);
|
||||
try {
|
||||
// 在实际应用中,这里需要调整为通过service调用处理VO对象
|
||||
@@ -38,12 +38,12 @@ import lombok.Setter;
|
||||
@FxmlPath("/ui/company/vendor/vendor_approved_list-tab-vendor.fxml")
|
||||
public class CompanyVendorApprovedListTabSkinVendors
|
||||
extends
|
||||
AbstEntityTableTabSkin<CompanyVendorApprovedListWindowController, CompanyVendorApprovedListVo, CompanyVendorApprovedListViewModel, CompanyVendorApprovedItemVo, CompanyVendorApprovedItemViewModel>
|
||||
AbstEntityTableTabSkin<CompanyVendorApprovedListWindowController, VendorApprovedVo, CompanyVendorApprovedListViewModel, VendorApprovedItemVo, CompanyVendorApprovedItemViewModel>
|
||||
implements TabSkin {
|
||||
@Setter
|
||||
private CompanyVendorApprovedItemService itemService;
|
||||
private VendorApprovedItemService itemService;
|
||||
private CompanyService companyService;
|
||||
private CompanyVendorService companyVendorService;
|
||||
private VendorService vendorService;
|
||||
private CompanyOldNameService companyOldNameService;
|
||||
|
||||
public ComboBox<VendorTypeLocalVo> typeSelector;
|
||||
@@ -78,26 +78,26 @@ public class CompanyVendorApprovedListTabSkinVendors
|
||||
return companyOldNameService;
|
||||
}
|
||||
|
||||
public CompanyVendorService getCompanyVendorService() {
|
||||
if (companyVendorService == null) {
|
||||
companyVendorService = getBean(CompanyVendorService.class);
|
||||
public VendorService getVendorService() {
|
||||
if (vendorService == null) {
|
||||
vendorService = getBean(VendorService.class);
|
||||
}
|
||||
return companyVendorService;
|
||||
return vendorService;
|
||||
}
|
||||
|
||||
public SysConfService getConfService() {
|
||||
return controller.getConfService();
|
||||
}
|
||||
|
||||
CompanyVendorApprovedItemService getItemService() {
|
||||
VendorApprovedItemService getItemService() {
|
||||
if (itemService == null) {
|
||||
itemService = getBean(CompanyVendorApprovedItemService.class);
|
||||
itemService = getBean(VendorApprovedItemService.class);
|
||||
}
|
||||
return itemService;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CompanyVendorApprovedItemService getViewModelService() {
|
||||
protected VendorApprovedItemService getViewModelService() {
|
||||
return getItemService();
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ public class CompanyVendorApprovedListTabSkinVendors
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParamUtils.Builder getSpecification(CompanyVendorApprovedListVo parent) {
|
||||
public ParamUtils.Builder getSpecification(VendorApprovedVo parent) {
|
||||
Builder params = getSpecification();
|
||||
params.equals("list", parent.getId());
|
||||
return params;
|
||||
@@ -131,7 +131,7 @@ public class CompanyVendorApprovedListTabSkinVendors
|
||||
idColumn.setCellValueFactory(param -> param.getValue().getId());
|
||||
// 厂商, vendor
|
||||
vendorColumn.setCellValueFactory(param -> param.getValue().getVendor());
|
||||
vendorColumn.setCellFactory(CompanyVendorTableCell.forTableColumn(getCompanyVendorService()));
|
||||
vendorColumn.setCellFactory(CompanyVendorTableCell.forTableColumn(getVendorService()));
|
||||
// 类型, type
|
||||
typeColumn.setCellValueFactory(param -> param.getValue().getType());
|
||||
typeColumn.setCellFactory(VendorTypeTableCell.forTableColumn(getCachedBean(VendorTypeService.class)));
|
||||
@@ -187,10 +187,10 @@ public class CompanyVendorApprovedListTabSkinVendors
|
||||
selectedItem.getType().set(value.getType());
|
||||
|
||||
int id = selectedItem.getId().get();
|
||||
CompanyVendorApprovedItemService itemService = getItemService();
|
||||
CompanyVendorApprovedItemVo item = itemService.findById(id);
|
||||
VendorApprovedItemService itemService = getItemService();
|
||||
VendorApprovedItemVo item = itemService.findById(id);
|
||||
if (selectedItem.copyTo(item)) {
|
||||
CompanyVendorApprovedItemVo saved = itemService.save(item);
|
||||
VendorApprovedItemVo saved = itemService.save(item);
|
||||
selectedItem.update(saved);
|
||||
}
|
||||
}
|
||||
@@ -202,7 +202,7 @@ public class CompanyVendorApprovedListTabSkinVendors
|
||||
}
|
||||
|
||||
public void onVendorTableImportAction(ActionEvent event) {
|
||||
CompanyVendorApprovedListVo approvedList = getParent();
|
||||
VendorApprovedVo approvedList = getParent();
|
||||
CompanyVendorApprovedListVendorImportTask task = new CompanyVendorApprovedListVendorImportTask(approvedList);
|
||||
|
||||
task.setLogUnqualifiedVendor(logUnqualifiedVendorChecker.isSelected());
|
||||
@@ -220,7 +220,7 @@ public class CompanyVendorApprovedListTabSkinVendors
|
||||
}
|
||||
|
||||
public void onVendorTableUpdateAction(ActionEvent event) {
|
||||
CompanyVendorService vendorService = getCompanyVendorService();
|
||||
VendorService vendorService = getVendorService();
|
||||
CompanyService companyService = getCompanyService();
|
||||
CompanyOldNameService companyOldNameService = getCompanyOldNameService();
|
||||
|
||||
@@ -231,7 +231,7 @@ public class CompanyVendorApprovedListTabSkinVendors
|
||||
CompanyVendorApprovedItemViewModel first = list.removeFirst();
|
||||
Integer vendorId = first.getVendor().get();
|
||||
;
|
||||
CompanyVendorVo companyVendor = vendorService.findById(vendorId);
|
||||
VendorVo companyVendor = vendorService.findById(vendorId);
|
||||
CompanyVo company = companyService.findById(companyVendor.getCompanyId());
|
||||
CompanyOldNameVo oldName = companyOldNameService.findMatchByDate(company,
|
||||
viewModel.getPublishDate().get());
|
||||
@@ -243,7 +243,7 @@ public class CompanyVendorApprovedListTabSkinVendors
|
||||
|
||||
public void onVendorTableShowVendorAction(ActionEvent event) {
|
||||
CompanyVendorApprovedItemViewModel selectedItem = getTableView().getSelectionModel().getSelectedItem();
|
||||
CompanyVendorVo companyVendor = getCompanyVendorService().findById(selectedItem.getVendor().get());
|
||||
VendorVo companyVendor = getVendorService().findById(selectedItem.getVendor().get());
|
||||
CompanyVendorWindowController.show(companyVendor, null);
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import java.util.Objects;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.ecep.contract.service.*;
|
||||
import org.apache.poi.ss.usermodel.BorderStyle;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.CellStyle;
|
||||
@@ -41,21 +42,16 @@ import org.springframework.util.StringUtils;
|
||||
import com.ecep.contract.MessageHolder;
|
||||
import com.ecep.contract.MyDateTimeUtils;
|
||||
import com.ecep.contract.VendorType;
|
||||
import com.ecep.contract.service.CompanyContactService;
|
||||
import com.ecep.contract.service.CompanyVendorApprovedFileService;
|
||||
import com.ecep.contract.service.CompanyVendorApprovedItemService;
|
||||
import com.ecep.contract.service.CompanyVendorApprovedListService;
|
||||
import com.ecep.contract.service.CompanyVendorService;
|
||||
import com.ecep.contract.service.ContractService;
|
||||
import com.ecep.contract.service.VendorService;
|
||||
import com.ecep.contract.task.Tasker;
|
||||
import com.ecep.contract.util.ExcelUtils;
|
||||
import com.ecep.contract.util.ParamUtils;
|
||||
import com.ecep.contract.util.ProxyUtils;
|
||||
import com.ecep.contract.vo.CompanyContactVo;
|
||||
import com.ecep.contract.vo.CompanyVendorApprovedFileVo;
|
||||
import com.ecep.contract.vo.CompanyVendorApprovedItemVo;
|
||||
import com.ecep.contract.vo.CompanyVendorApprovedListVo;
|
||||
import com.ecep.contract.vo.CompanyVendorVo;
|
||||
import com.ecep.contract.vo.VendorApprovedFileVo;
|
||||
import com.ecep.contract.vo.VendorApprovedItemVo;
|
||||
import com.ecep.contract.vo.VendorApprovedVo;
|
||||
import com.ecep.contract.vo.VendorVo;
|
||||
import com.ecep.contract.vo.CompanyVo;
|
||||
import com.ecep.contract.vo.ContractVo;
|
||||
|
||||
@@ -69,34 +65,34 @@ public class CompanyVendorApprovedListVendorExportTask extends Tasker<Object> {
|
||||
public static final String STR_CHANGE_VENDOR_TYPE_SHEET = "变更供应商类型";
|
||||
|
||||
@Setter
|
||||
private CompanyVendorApprovedListVo approvedList;
|
||||
private VendorApprovedVo approvedList;
|
||||
|
||||
private CompanyVendorApprovedListService service;
|
||||
private CompanyVendorApprovedFileService fileService;
|
||||
private CompanyVendorApprovedItemService itemService;
|
||||
private VendorApprovedService service;
|
||||
private VendorApprovedFileService fileService;
|
||||
private VendorApprovedItemService itemService;
|
||||
private ContractService contractService;
|
||||
private CompanyVendorService companyVendorService;
|
||||
private VendorService vendorService;
|
||||
private CompanyContactService companyContactService;
|
||||
|
||||
private static final String FILE_NAME = "供方名录-%s.xlsx";
|
||||
|
||||
private CompanyVendorApprovedListService getService() {
|
||||
private VendorApprovedService getService() {
|
||||
if (service == null) {
|
||||
service = getBean(CompanyVendorApprovedListService.class);
|
||||
service = getBean(VendorApprovedService.class);
|
||||
}
|
||||
return service;
|
||||
}
|
||||
|
||||
private CompanyVendorApprovedFileService getFileService() {
|
||||
private VendorApprovedFileService getFileService() {
|
||||
if (fileService == null) {
|
||||
fileService = getBean(CompanyVendorApprovedFileService.class);
|
||||
fileService = getBean(VendorApprovedFileService.class);
|
||||
}
|
||||
return fileService;
|
||||
}
|
||||
|
||||
private CompanyVendorApprovedItemService getItemService() {
|
||||
private VendorApprovedItemService getItemService() {
|
||||
if (itemService == null) {
|
||||
itemService = getBean(CompanyVendorApprovedItemService.class);
|
||||
itemService = getBean(VendorApprovedItemService.class);
|
||||
}
|
||||
return itemService;
|
||||
}
|
||||
@@ -115,15 +111,15 @@ public class CompanyVendorApprovedListVendorExportTask extends Tasker<Object> {
|
||||
return companyContactService;
|
||||
}
|
||||
|
||||
private CompanyVendorService getCompanyVendorService() {
|
||||
if (companyVendorService == null) {
|
||||
companyVendorService = getBean(CompanyVendorService.class);
|
||||
private VendorService getVendorService() {
|
||||
if (vendorService == null) {
|
||||
vendorService = getBean(VendorService.class);
|
||||
}
|
||||
return companyVendorService;
|
||||
return vendorService;
|
||||
}
|
||||
|
||||
private File getVendorApprovedListTemplate() {
|
||||
return getCompanyVendorService().getVendorApprovedListTemplate();
|
||||
return getVendorService().getVendorApprovedListTemplate();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -192,10 +188,10 @@ public class CompanyVendorApprovedListVendorExportTask extends Tasker<Object> {
|
||||
}
|
||||
}
|
||||
|
||||
CompanyVendorApprovedFileVo approvedFile = getFileService()
|
||||
VendorApprovedFileVo approvedFile = getFileService()
|
||||
.findByName(approvedList, destFile.getName());
|
||||
if (approvedFile == null) {
|
||||
approvedFile = new CompanyVendorApprovedFileVo();
|
||||
approvedFile = new VendorApprovedFileVo();
|
||||
}
|
||||
approvedFile.setListId(approvedList.getId());
|
||||
approvedFile.setFileName(destFile.getName());
|
||||
@@ -341,7 +337,7 @@ public class CompanyVendorApprovedListVendorExportTask extends Tasker<Object> {
|
||||
|
||||
private void updateTypicallySheet(Workbook wb, Sheet sheet, MessageHolder holder) {
|
||||
updateTitle("更新一般供方 Sheet");
|
||||
List<CompanyVendorApprovedItemVo> items = getItemService()
|
||||
List<VendorApprovedItemVo> items = getItemService()
|
||||
.findAll(ParamUtils.builder().equals("type", VendorType.TYPICALLY)
|
||||
.equals("list", approvedList.getId()).build(), Pageable.unpaged(Sort.by("vendor")))
|
||||
.getContent();
|
||||
@@ -356,13 +352,13 @@ public class CompanyVendorApprovedListVendorExportTask extends Tasker<Object> {
|
||||
borderStyle.setBorderLeft(BorderStyle.THIN); // 左边框
|
||||
borderStyle.setBorderRight(BorderStyle.THIN); // 右边框
|
||||
|
||||
List<CompanyVendorApprovedItemVo> meetQualified = new ArrayList<>();
|
||||
List<VendorApprovedItemVo> meetQualified = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < items.size(); i++) {
|
||||
CompanyVendorApprovedItemVo item = items.get(i);
|
||||
VendorApprovedItemVo item = items.get(i);
|
||||
updateProgress(i, items.size());
|
||||
|
||||
CompanyVendorVo vendor = getCompanyVendorService().findById(item.getVendorId());
|
||||
VendorVo vendor = getVendorService().findById(item.getVendorId());
|
||||
CompanyVo company = getCompanyService().findById(vendor.getCompanyId());
|
||||
|
||||
setCellValue(sheet, "A" + (prefixRow + i), "" + vendor.getId()).setCellStyle(borderStyle);
|
||||
@@ -420,14 +416,14 @@ public class CompanyVendorApprovedListVendorExportTask extends Tasker<Object> {
|
||||
changeSheet.setColumnWidth(6, 13 * 256);
|
||||
holder.debug("创建 " + STR_CHANGE_VENDOR_TYPE_SHEET + " Sheet");
|
||||
|
||||
for (CompanyVendorApprovedItemVo item : meetQualified) {
|
||||
for (VendorApprovedItemVo item : meetQualified) {
|
||||
outputMeetQualified(changeSheet, item, holder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void outputMeetQualified(Sheet sheet, CompanyVendorApprovedItemVo item, MessageHolder holder) {
|
||||
CompanyVendorVo vendor = getCompanyVendorService().findById(item.getVendorId());
|
||||
private void outputMeetQualified(Sheet sheet, VendorApprovedItemVo item, MessageHolder holder) {
|
||||
VendorVo vendor = getVendorService().findById(item.getVendorId());
|
||||
CompanyVo company = getCompanyService().findById(vendor.getCompanyId());
|
||||
String vendorName = item.getVendorName();
|
||||
if (!StringUtils.hasText(vendorName)) {
|
||||
@@ -438,8 +434,8 @@ public class CompanyVendorApprovedListVendorExportTask extends Tasker<Object> {
|
||||
holder.info("详情输出到 " + sheet.getSheetName() + " Sheet 中,请查看");
|
||||
}
|
||||
|
||||
private void outputMeetQualified(Sheet sheet, CompanyVendorVo vendor, String vendorName,
|
||||
CompanyVendorApprovedItemVo item) {
|
||||
private void outputMeetQualified(Sheet sheet, VendorVo vendor, String vendorName,
|
||||
VendorApprovedItemVo item) {
|
||||
AtomicInteger row = meetRow;
|
||||
setCellValue(sheet, row.get(), 1, "供方:" + vendorName).setCellStyle(venodrNameCellStyle);
|
||||
sheet.getRow(row.get()).setHeight((short) (30 * 20));
|
||||
@@ -512,7 +508,7 @@ public class CompanyVendorApprovedListVendorExportTask extends Tasker<Object> {
|
||||
private void updateQualifiedSheet(Sheet sheet, MessageHolder holder) {
|
||||
updateTitle("更新合格供方 Sheet");
|
||||
|
||||
List<CompanyVendorApprovedItemVo> items = getItemService().findAll(
|
||||
List<VendorApprovedItemVo> items = getItemService().findAll(
|
||||
ParamUtils.builder().equals("type", VendorType.QUALIFIED).equals("list", approvedList.getId()).build(),
|
||||
Pageable.unpaged(Sort.by("vendor.name"))).getContent();
|
||||
holder.debug("载入合共供方:" + items.size() + " 条");
|
||||
@@ -583,10 +579,10 @@ public class CompanyVendorApprovedListVendorExportTask extends Tasker<Object> {
|
||||
}
|
||||
|
||||
for (int i = 0; i < items.size(); i++) {
|
||||
CompanyVendorApprovedItemVo item = items.get(i);
|
||||
VendorApprovedItemVo item = items.get(i);
|
||||
updateProgress(i, items.size());
|
||||
|
||||
CompanyVendorVo vendor = getCompanyVendorService().findById(item.getVendorId());
|
||||
VendorVo vendor = getVendorService().findById(item.getVendorId());
|
||||
CompanyVo company = getCompanyService().findById(vendor.getCompanyId());
|
||||
|
||||
setCellValue(sheet, "A" + (prefixRow), "" + vendor.getId()).setCellStyle(beginCellStyles[0]);
|
||||
@@ -641,7 +637,7 @@ public class CompanyVendorApprovedListVendorExportTask extends Tasker<Object> {
|
||||
|
||||
}
|
||||
|
||||
private void save(CompanyVendorApprovedFileVo approvedFile) {
|
||||
private void save(VendorApprovedFileVo approvedFile) {
|
||||
getFileService().save(approvedFile);
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import com.ecep.contract.service.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.domain.Page;
|
||||
@@ -20,19 +21,14 @@ import com.ecep.contract.MessageHolder;
|
||||
import com.ecep.contract.VendorFileType;
|
||||
import com.ecep.contract.VendorType;
|
||||
import com.ecep.contract.model.Vendor;
|
||||
import com.ecep.contract.service.CompanyOldNameService;
|
||||
import com.ecep.contract.service.CompanyVendorApprovedItemService;
|
||||
import com.ecep.contract.service.CompanyVendorApprovedListService;
|
||||
import com.ecep.contract.service.CompanyVendorFileService;
|
||||
import com.ecep.contract.service.CompanyVendorService;
|
||||
import com.ecep.contract.service.ContractService;
|
||||
import com.ecep.contract.service.VendorService;
|
||||
import com.ecep.contract.task.Tasker;
|
||||
import com.ecep.contract.util.ParamUtils;
|
||||
import com.ecep.contract.vo.CompanyOldNameVo;
|
||||
import com.ecep.contract.vo.CompanyVendorApprovedItemVo;
|
||||
import com.ecep.contract.vo.CompanyVendorApprovedListVo;
|
||||
import com.ecep.contract.vo.CompanyVendorFileVo;
|
||||
import com.ecep.contract.vo.CompanyVendorVo;
|
||||
import com.ecep.contract.vo.VendorApprovedItemVo;
|
||||
import com.ecep.contract.vo.VendorApprovedVo;
|
||||
import com.ecep.contract.vo.VendorFileVo;
|
||||
import com.ecep.contract.vo.VendorVo;
|
||||
import com.ecep.contract.vo.CompanyVo;
|
||||
import com.ecep.contract.vo.ContractVo;
|
||||
|
||||
@@ -48,33 +44,33 @@ public class CompanyVendorApprovedListVendorImportTask extends Tasker<Object> {
|
||||
public static final String STR_MEET_TYPICALLY = "符合一般供方标准";
|
||||
public static final String STR_MEET_UNQUALIFIED = "符合不合格供方标准";
|
||||
|
||||
private final CompanyVendorApprovedListVo approvedList;
|
||||
private final VendorApprovedVo approvedList;
|
||||
|
||||
private CompanyVendorApprovedListService service;
|
||||
private CompanyVendorApprovedItemService itemService;
|
||||
private CompanyVendorFileService companyVendorFileService;
|
||||
private VendorApprovedService service;
|
||||
private VendorApprovedItemService itemService;
|
||||
private VendorFileService vendorFileService;
|
||||
private CompanyOldNameService companyOldNameService;
|
||||
private ContractService contractService;
|
||||
|
||||
private final AtomicInteger counter = new AtomicInteger(0);
|
||||
|
||||
public CompanyVendorApprovedListVendorImportTask(CompanyVendorApprovedListVo approvedList) {
|
||||
public CompanyVendorApprovedListVendorImportTask(VendorApprovedVo approvedList) {
|
||||
this.approvedList = approvedList;
|
||||
updateTitle("供方名录-供方导入");
|
||||
}
|
||||
|
||||
private CompanyVendorApprovedItemService getItemService() {
|
||||
private VendorApprovedItemService getItemService() {
|
||||
if (itemService == null) {
|
||||
itemService = getBean(CompanyVendorApprovedItemService.class);
|
||||
itemService = getBean(VendorApprovedItemService.class);
|
||||
}
|
||||
return itemService;
|
||||
}
|
||||
|
||||
private CompanyVendorFileService getCompanyVendorFileService() {
|
||||
if (companyVendorFileService == null) {
|
||||
companyVendorFileService = getBean(CompanyVendorFileService.class);
|
||||
private VendorFileService getVendorFileService() {
|
||||
if (vendorFileService == null) {
|
||||
vendorFileService = getBean(VendorFileService.class);
|
||||
}
|
||||
return companyVendorFileService;
|
||||
return vendorFileService;
|
||||
}
|
||||
|
||||
private CompanyOldNameService getCompanyOldNameService() {
|
||||
@@ -99,16 +95,16 @@ public class CompanyVendorApprovedListVendorImportTask extends Tasker<Object> {
|
||||
return null;
|
||||
}
|
||||
|
||||
service = getBean(CompanyVendorApprovedListService.class);
|
||||
CompanyVendorService vendorService = getBean(CompanyVendorService.class);
|
||||
Page<CompanyVendorVo> page = vendorService.findAll(
|
||||
service = getBean(VendorApprovedService.class);
|
||||
VendorService vendorService = getBean(VendorService.class);
|
||||
Page<VendorVo> page = vendorService.findAll(
|
||||
ParamUtils.builder()
|
||||
.isNotNull("created")
|
||||
.lessThan("developDate", endDate)
|
||||
.build(),
|
||||
Pageable.unpaged());
|
||||
holder.debug("读取到" + page.getTotalElements());
|
||||
try (Stream<CompanyVendorVo> stream = page.stream()) {
|
||||
try (Stream<VendorVo> stream = page.stream()) {
|
||||
stream.forEach(v -> {
|
||||
if (isCancelled()) {
|
||||
holder.debug("Cancelled");
|
||||
@@ -137,7 +133,7 @@ public class CompanyVendorApprovedListVendorImportTask extends Tasker<Object> {
|
||||
@Setter
|
||||
private boolean logTypicallyVendorNoThreeYearContract = true;
|
||||
|
||||
private void sync(CompanyVendorVo vendor, MessageHolder holder) {
|
||||
private void sync(VendorVo vendor, MessageHolder holder) {
|
||||
// 明确 company 实例
|
||||
CompanyVo company = initializedVendorCompany(vendor);
|
||||
if (company == null) {
|
||||
@@ -162,10 +158,10 @@ public class CompanyVendorApprovedListVendorImportTask extends Tasker<Object> {
|
||||
}
|
||||
|
||||
// 确认供方是否在供方名录中,可能有多个,所以返回 list,默认取第一个
|
||||
List<CompanyVendorApprovedItemVo> items = getItemService().findAllByListAndVendor(approvedList, vendor);
|
||||
List<VendorApprovedItemVo> items = getItemService().findAllByListAndVendor(approvedList, vendor);
|
||||
if (items == null || items.isEmpty()) {
|
||||
// 供方不在供方名录中时,新建一个
|
||||
CompanyVendorApprovedItemVo item = new CompanyVendorApprovedItemVo();
|
||||
VendorApprovedItemVo item = new VendorApprovedItemVo();
|
||||
item.setListId(approvedList.getId());
|
||||
item.setVendorId(vendor.getId());
|
||||
|
||||
@@ -260,7 +256,7 @@ public class CompanyVendorApprovedListVendorImportTask extends Tasker<Object> {
|
||||
}
|
||||
|
||||
if (items.size() == 1) {
|
||||
CompanyVendorApprovedItemVo first = items.getFirst();
|
||||
VendorApprovedItemVo first = items.getFirst();
|
||||
if (!StringUtils.hasText(first.getVendorName())) {
|
||||
updateVendorNameWithOldName(vendor, first);
|
||||
}
|
||||
@@ -269,13 +265,13 @@ public class CompanyVendorApprovedListVendorImportTask extends Tasker<Object> {
|
||||
}
|
||||
|
||||
for (int i = 1; i < items.size(); i++) {
|
||||
CompanyVendorApprovedItemVo item = items.get(i);
|
||||
VendorApprovedItemVo item = items.get(i);
|
||||
getItemService().delete(item);
|
||||
subHolder.debug("删除重复的供方名录项:#" + item.getId());
|
||||
}
|
||||
}
|
||||
|
||||
private void updateVendorNameWithOldName(CompanyVendorVo vendor, CompanyVendorApprovedItemVo item) {
|
||||
private void updateVendorNameWithOldName(VendorVo vendor, VendorApprovedItemVo item) {
|
||||
CompanyVo company = initializedVendorCompany(vendor);
|
||||
if (company == null) {
|
||||
return;
|
||||
@@ -294,10 +290,10 @@ public class CompanyVendorApprovedListVendorImportTask extends Tasker<Object> {
|
||||
private boolean logUnqualifiedVendorRemove = true;
|
||||
|
||||
private void updateItem(
|
||||
CompanyVendorVo vendor, CompanyVendorApprovedItemVo item, MessageHolder holder) {
|
||||
VendorVo vendor, VendorApprovedItemVo item, MessageHolder holder) {
|
||||
VendorType t1 = item.getType();
|
||||
VendorType vendorType = vendor.getType();
|
||||
CompanyVendorApprovedItemService itemService = getItemService();
|
||||
VendorApprovedItemService itemService = getItemService();
|
||||
if (t1 != vendorType) {
|
||||
holder.warn("注意分类不一致, " + t1 + ", " + vendorType + ".");
|
||||
}
|
||||
@@ -415,13 +411,13 @@ public class CompanyVendorApprovedListVendorImportTask extends Tasker<Object> {
|
||||
* @see #findAllEvaluationFormFiles(Vendor, LocalDate)
|
||||
*/
|
||||
private boolean checkAsQualifiedVendorByEvaluationFormFiles(
|
||||
CompanyVendorVo vendor, CompanyVendorApprovedItemVo item, MessageHolder holder) {
|
||||
List<CompanyVendorFileVo> files = findAllEvaluationFormFiles(vendor, approvedList.getPublishDate());
|
||||
VendorVo vendor, VendorApprovedItemVo item, MessageHolder holder) {
|
||||
List<VendorFileVo> files = findAllEvaluationFormFiles(vendor, approvedList.getPublishDate());
|
||||
if (files.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
CompanyVendorFileVo first = files.getFirst();
|
||||
VendorFileVo first = files.getFirst();
|
||||
item.setType(VendorType.TYPICALLY);
|
||||
File file = new File(first.getFilePath());
|
||||
holder.info("供方是不合格供方, 但在发布期一年内有有效评价表 " + file.getName() + ", 调整为一般供应商");
|
||||
@@ -485,7 +481,7 @@ public class CompanyVendorApprovedListVendorImportTask extends Tasker<Object> {
|
||||
}
|
||||
|
||||
private boolean checkAsTypicallyVendorByContracts(
|
||||
CompanyVendorVo vendor, CompanyVendorApprovedItemVo item, Consumer<String> consumer) {
|
||||
VendorVo vendor, VendorApprovedItemVo item, Consumer<String> consumer) {
|
||||
// 查看供方的合同,看近3年期间是否有合同
|
||||
List<ContractVo> contracts = findAllVendorContracts(vendor, approvedList.getPublishDate());
|
||||
if (contracts.isEmpty()) {
|
||||
@@ -539,7 +535,7 @@ public class CompanyVendorApprovedListVendorImportTask extends Tasker<Object> {
|
||||
* @param date 日期
|
||||
* @return 3年内的合同列表
|
||||
*/
|
||||
private List<ContractVo> findAllVendorContracts(CompanyVendorVo vendor, LocalDate date) {
|
||||
private List<ContractVo> findAllVendorContracts(VendorVo vendor, LocalDate date) {
|
||||
ContractService contractService = getContractService();
|
||||
|
||||
int beginYear = date.getYear() - (vendorContractMinusYear - 1);
|
||||
@@ -548,7 +544,7 @@ public class CompanyVendorApprovedListVendorImportTask extends Tasker<Object> {
|
||||
return contractService.findAllByCompanyVendor(vendor, miniDate, date);
|
||||
}
|
||||
|
||||
private CompanyVo initializedVendorCompany(CompanyVendorVo vendor) {
|
||||
private CompanyVo initializedVendorCompany(VendorVo vendor) {
|
||||
CompanyVo company = getCompanyService().findById(vendor.getCompanyId());
|
||||
return company;
|
||||
}
|
||||
@@ -563,8 +559,8 @@ public class CompanyVendorApprovedListVendorImportTask extends Tasker<Object> {
|
||||
* @param publishDate
|
||||
* @return
|
||||
*/
|
||||
private List<CompanyVendorFileVo> findAllEvaluationFormFiles(CompanyVendorVo vendor, LocalDate publishDate) {
|
||||
CompanyVendorFileService fileService = getCompanyVendorFileService();
|
||||
private List<VendorFileVo> findAllEvaluationFormFiles(VendorVo vendor, LocalDate publishDate) {
|
||||
VendorFileService fileService = getVendorFileService();
|
||||
LocalDate miniDate = publishDate.minusYears(vendorFileMinusYear);
|
||||
return fileService.findAll(ParamUtils.builder()
|
||||
.equals("vendor", vendor.getId())
|
||||
@@ -12,11 +12,11 @@ import org.springframework.util.StringUtils;
|
||||
|
||||
import com.ecep.contract.DesktopUtils;
|
||||
import com.ecep.contract.controller.AbstEntityController;
|
||||
import com.ecep.contract.service.CompanyVendorApprovedListService;
|
||||
import com.ecep.contract.service.VendorApprovedService;
|
||||
import com.ecep.contract.util.FxmlPath;
|
||||
import com.ecep.contract.util.UITools;
|
||||
import com.ecep.contract.vm.CompanyVendorApprovedListViewModel;
|
||||
import com.ecep.contract.vo.CompanyVendorApprovedListVo;
|
||||
import com.ecep.contract.vo.VendorApprovedVo;
|
||||
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.scene.control.Button;
|
||||
@@ -35,16 +35,16 @@ import javafx.stage.WindowEvent;
|
||||
@Component
|
||||
@FxmlPath("/ui/company/vendor/vendor_approved_list.fxml")
|
||||
public class CompanyVendorApprovedListWindowController
|
||||
extends AbstEntityController<CompanyVendorApprovedListVo, CompanyVendorApprovedListViewModel> {
|
||||
extends AbstEntityController<VendorApprovedVo, CompanyVendorApprovedListViewModel> {
|
||||
private static final Logger logger = LoggerFactory.getLogger(CompanyVendorApprovedListWindowController.class);
|
||||
|
||||
public static void show(CompanyVendorApprovedListVo list, Window window) {
|
||||
public static void show(VendorApprovedVo list, Window window) {
|
||||
CompanyVendorApprovedListViewModel model = CompanyVendorApprovedListViewModel.from(list);
|
||||
show(CompanyVendorApprovedListWindowController.class, model, window);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private CompanyVendorApprovedListService service;
|
||||
private VendorApprovedService service;
|
||||
|
||||
public BorderPane root;
|
||||
public TabPane tabPane;
|
||||
@@ -79,7 +79,7 @@ public class CompanyVendorApprovedListWindowController
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompanyVendorApprovedListService getViewModelService() {
|
||||
public VendorApprovedService getViewModelService() {
|
||||
return service;
|
||||
}
|
||||
|
||||
@@ -105,10 +105,10 @@ public class CompanyVendorApprovedListWindowController
|
||||
|
||||
public void onApprovedListCreatePathAction(ActionEvent event) {
|
||||
int id = viewModel.getId().get();
|
||||
CompanyVendorApprovedListVo list = service.findById(id);
|
||||
VendorApprovedVo list = service.findById(id);
|
||||
|
||||
if (service.makePathAbsent(list)) {
|
||||
CompanyVendorApprovedListVo saved = service.save(list);
|
||||
VendorApprovedVo saved = service.save(list);
|
||||
viewModel.update(saved);
|
||||
} else {
|
||||
setStatus("目录存在或创建失败");
|
||||
@@ -4,17 +4,17 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.ecep.contract.service.CompanyVendorService;
|
||||
import com.ecep.contract.vo.CompanyVendorVo;
|
||||
import com.ecep.contract.service.VendorService;
|
||||
import com.ecep.contract.vo.VendorVo;
|
||||
|
||||
import jakarta.annotation.PostConstruct;
|
||||
|
||||
@Lazy
|
||||
@Component
|
||||
public class CompanyVendorStringConverter extends EntityStringConverter<CompanyVendorVo> {
|
||||
public class CompanyVendorStringConverter extends EntityStringConverter<VendorVo> {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private CompanyVendorService service;
|
||||
private VendorService service;
|
||||
|
||||
public CompanyVendorStringConverter() {
|
||||
|
||||
@@ -4,19 +4,19 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import com.ecep.contract.MessageHolder;
|
||||
import com.ecep.contract.vm.CompanyVendorApprovedFileViewModel;
|
||||
import com.ecep.contract.vo.CompanyVendorApprovedFileVo;
|
||||
import com.ecep.contract.vo.CompanyVendorApprovedListVo;
|
||||
import com.ecep.contract.vo.VendorApprovedFileVo;
|
||||
import com.ecep.contract.vo.VendorApprovedVo;
|
||||
|
||||
@Service
|
||||
public class CompanyVendorApprovedFileService
|
||||
extends QueryService<CompanyVendorApprovedFileVo, CompanyVendorApprovedFileViewModel> {
|
||||
extends QueryService<VendorApprovedFileVo, CompanyVendorApprovedFileViewModel> {
|
||||
|
||||
public CompanyVendorApprovedFileVo findByName(CompanyVendorApprovedListVo approvedList, String name) {
|
||||
public VendorApprovedFileVo findByName(VendorApprovedVo approvedList, String name) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'findByName'");
|
||||
}
|
||||
|
||||
public boolean reBuildingFiles(CompanyVendorApprovedListVo list, MessageHolder holder) {
|
||||
public boolean reBuildingFiles(VendorApprovedVo list, MessageHolder holder) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'reBuildingFiles'");
|
||||
}
|
||||
@@ -7,16 +7,16 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import com.ecep.contract.util.ParamUtils;
|
||||
import com.ecep.contract.vm.CompanyVendorApprovedItemViewModel;
|
||||
import com.ecep.contract.vo.CompanyVendorApprovedItemVo;
|
||||
import com.ecep.contract.vo.CompanyVendorApprovedListVo;
|
||||
import com.ecep.contract.vo.CompanyVendorVo;
|
||||
import com.ecep.contract.vo.VendorApprovedItemVo;
|
||||
import com.ecep.contract.vo.VendorApprovedVo;
|
||||
import com.ecep.contract.vo.VendorVo;
|
||||
|
||||
@Service
|
||||
public class CompanyVendorApprovedItemService
|
||||
extends QueryService<CompanyVendorApprovedItemVo, CompanyVendorApprovedItemViewModel> {
|
||||
extends QueryService<VendorApprovedItemVo, CompanyVendorApprovedItemViewModel> {
|
||||
|
||||
public List<CompanyVendorApprovedItemVo> findAllByListAndVendor(CompanyVendorApprovedListVo approvedList,
|
||||
CompanyVendorVo vendor) {
|
||||
public List<VendorApprovedItemVo> findAllByListAndVendor(VendorApprovedVo approvedList,
|
||||
VendorVo vendor) {
|
||||
return findAll(ParamUtils.builder()
|
||||
.equals("list", approvedList.getId())
|
||||
.equals("vendor", vendor.getId())
|
||||
@@ -3,25 +3,24 @@ package com.ecep.contract.service;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.ecep.contract.MessageHolder;
|
||||
import com.ecep.contract.model.CompanyVendorApprovedList;
|
||||
import com.ecep.contract.vm.CompanyVendorApprovedListViewModel;
|
||||
import com.ecep.contract.vo.CompanyVendorApprovedListVo;
|
||||
import com.ecep.contract.vo.VendorApprovedVo;
|
||||
|
||||
@Service
|
||||
public class CompanyVendorApprovedListService
|
||||
extends QueryService<CompanyVendorApprovedListVo, CompanyVendorApprovedListViewModel> {
|
||||
extends QueryService<VendorApprovedVo, CompanyVendorApprovedListViewModel> {
|
||||
|
||||
public boolean makePathAbsent(CompanyVendorApprovedListVo list) {
|
||||
public boolean makePathAbsent(VendorApprovedVo list) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'makePathAbsent'");
|
||||
}
|
||||
|
||||
public boolean reBuildingFiles(CompanyVendorApprovedListVo list, MessageHolder holder) {
|
||||
public boolean reBuildingFiles(VendorApprovedVo list, MessageHolder holder) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'reBuildingFiles'");
|
||||
}
|
||||
|
||||
public boolean existPath(CompanyVendorApprovedListVo entity) {
|
||||
public boolean existPath(VendorApprovedVo entity) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'existPath'");
|
||||
}
|
||||
@@ -6,18 +6,17 @@ import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.ecep.contract.util.ParamUtils;
|
||||
import com.ecep.contract.vo.CompanyVendorEntityVo;
|
||||
import com.ecep.contract.vo.CompanyVendorVo;
|
||||
import com.ecep.contract.vo.VendorEntityVo;
|
||||
import com.ecep.contract.vo.VendorVo;
|
||||
import com.ecep.contract.vm.CompanyVendorEntityViewModel;
|
||||
import com.ecep.contract.model.CompanyVendorEntity;
|
||||
|
||||
@Service
|
||||
public class CompanyVendorEntityService extends QueryService<CompanyVendorEntityVo, CompanyVendorEntityViewModel> {
|
||||
public class CompanyVendorEntityService extends QueryService<VendorEntityVo, CompanyVendorEntityViewModel> {
|
||||
|
||||
/**
|
||||
* 根据供应商ID查询关联实体列表
|
||||
*/
|
||||
public List<CompanyVendorEntityVo> findByVendorId(Integer vendorId) {
|
||||
public List<VendorEntityVo> findByVendorId(Integer vendorId) {
|
||||
return findAll(ParamUtils.builder().equals("vendorId", vendorId).build(), Pageable.unpaged())
|
||||
.getContent();
|
||||
}
|
||||
@@ -25,15 +24,15 @@ public class CompanyVendorEntityService extends QueryService<CompanyVendorEntity
|
||||
/**
|
||||
* 根据CompanyVendor对象查询关联的CompanyVendorEntity列表
|
||||
*/
|
||||
public List<CompanyVendorEntityVo> findByVendor(CompanyVendorVo vendor) {
|
||||
public List<VendorEntityVo> findByVendor(VendorVo vendor) {
|
||||
return findByVendorId(vendor.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据供应商ID创建新的CompanyVendorEntity实例
|
||||
*/
|
||||
public CompanyVendorEntityVo newInstanceByVendor(CompanyVendorVo vendor) {
|
||||
CompanyVendorEntityVo entity = createNewEntity();
|
||||
public VendorEntityVo newInstanceByVendor(VendorVo vendor) {
|
||||
VendorEntityVo entity = createNewEntity();
|
||||
// 设置供应商ID
|
||||
try {
|
||||
// 通过反射设置vendor属性,因为实体类中可能没有直接的setVendorId方法
|
||||
@@ -17,13 +17,13 @@ import com.ecep.contract.model.Vendor;
|
||||
import com.ecep.contract.model.VendorFileTypeLocal;
|
||||
import com.ecep.contract.util.ParamUtils;
|
||||
import com.ecep.contract.vm.CompanyVendorFileViewModel;
|
||||
import com.ecep.contract.vo.CompanyVendorFileVo;
|
||||
import com.ecep.contract.vo.CompanyVendorVo;
|
||||
import com.ecep.contract.vo.VendorFileVo;
|
||||
import com.ecep.contract.vo.VendorVo;
|
||||
|
||||
@Service
|
||||
public class CompanyVendorFileService extends QueryService<CompanyVendorFileVo, CompanyVendorFileViewModel> {
|
||||
public class CompanyVendorFileService extends QueryService<VendorFileVo, CompanyVendorFileViewModel> {
|
||||
|
||||
public LocalDate getNextSignDate(CompanyVendorVo companyVendor, Consumer<String> state) {
|
||||
public LocalDate getNextSignDate(VendorVo companyVendor, Consumer<String> state) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'getNextSignDate'");
|
||||
}
|
||||
@@ -37,9 +37,9 @@ public class CompanyVendorFileService extends QueryService<CompanyVendorFileVo,
|
||||
throw new UnsupportedOperationException("Unimplemented method 'getFileTypeLocalMap'");
|
||||
}
|
||||
|
||||
public void verify(CompanyVendorVo companyVendor, LocalDate verifyDate, MessageHolder holder) {
|
||||
public void verify(VendorVo companyVendor, LocalDate verifyDate, MessageHolder holder) {
|
||||
// 查询所有评价表
|
||||
List<CompanyVendorFileVo> files = findAllByVendorAndType(companyVendor, VendorFileType.EvaluationForm);
|
||||
List<VendorFileVo> files = findAllByVendorAndType(companyVendor, VendorFileType.EvaluationForm);
|
||||
if (files == null || files.isEmpty()) {
|
||||
holder.error("未见供应商评价");
|
||||
return;
|
||||
@@ -47,15 +47,15 @@ public class CompanyVendorFileService extends QueryService<CompanyVendorFileVo,
|
||||
|
||||
// 检索 验证日期最近一年内的有效评价表,日期宽限7天
|
||||
LocalDate begin = verifyDate.plusYears(-1);
|
||||
CompanyVendorFileVo vendorFile = files.stream()
|
||||
VendorFileVo vendorFile = files.stream()
|
||||
.filter(v -> v.getSignDate() != null && v.isValid())
|
||||
.filter(v -> MyDateTimeUtils.dateValidFilter(v.getSignDate(), begin, verifyDate, 7))
|
||||
.findFirst().orElse(null);
|
||||
if (vendorFile == null) {
|
||||
// 检索最后一个有效评价表
|
||||
CompanyVendorFileVo latestFile = files.stream()
|
||||
VendorFileVo latestFile = files.stream()
|
||||
.filter(v -> v.getSignDate() != null && v.isValid())
|
||||
.max(Comparator.comparing(CompanyVendorFileVo::getSignDate))
|
||||
.max(Comparator.comparing(VendorFileVo::getSignDate))
|
||||
.orElse(null);
|
||||
|
||||
if (latestFile == null) {
|
||||
@@ -67,7 +67,7 @@ public class CompanyVendorFileService extends QueryService<CompanyVendorFileVo,
|
||||
}
|
||||
}
|
||||
|
||||
public List<CompanyVendorFileVo> findAllByVendorAndType(CompanyVendorVo vendor, VendorFileType type) {
|
||||
public List<VendorFileVo> findAllByVendorAndType(VendorVo vendor, VendorFileType type) {
|
||||
return findAll(ParamUtils.builder()
|
||||
.equals("vendor", vendor.getId())
|
||||
.equals("type", type.name())
|
||||
@@ -20,12 +20,12 @@ import com.ecep.contract.util.FileUtils;
|
||||
import com.ecep.contract.util.MyStringUtils;
|
||||
import com.ecep.contract.util.ParamUtils;
|
||||
import com.ecep.contract.vm.CompanyVendorViewModel;
|
||||
import com.ecep.contract.vo.CompanyVendorVo;
|
||||
import com.ecep.contract.vo.VendorVo;
|
||||
import com.ecep.contract.vo.CompanyVo;
|
||||
import com.ecep.contract.vo.ContractVo;
|
||||
|
||||
@Service
|
||||
public class CompanyVendorService extends QueryService<CompanyVendorVo, CompanyVendorViewModel> {
|
||||
public class CompanyVendorService extends QueryService<VendorVo, CompanyVendorViewModel> {
|
||||
@Autowired
|
||||
private CompanyService companyService;
|
||||
@Autowired
|
||||
@@ -52,15 +52,15 @@ public class CompanyVendorService extends QueryService<CompanyVendorVo, CompanyV
|
||||
throw new UnsupportedOperationException("Unimplemented method 'findCatalogById'");
|
||||
}
|
||||
|
||||
public CompanyVendorVo findByCompany(CompanyVo company) {
|
||||
Page<CompanyVendorVo> page = findAll(ParamUtils.equal("company", company.getId()), Pageable.ofSize(1));
|
||||
public VendorVo findByCompany(CompanyVo company) {
|
||||
Page<VendorVo> page = findAll(ParamUtils.equal("company", company.getId()), Pageable.ofSize(1));
|
||||
if (page.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return page.getContent().getFirst();
|
||||
}
|
||||
|
||||
public boolean reBuildingFiles(CompanyVendorVo companyVendor, MessageHolder messageHolder) {
|
||||
public boolean reBuildingFiles(VendorVo companyVendor, MessageHolder messageHolder) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'reBuildingFiles'");
|
||||
}
|
||||
@@ -76,7 +76,7 @@ public class CompanyVendorService extends QueryService<CompanyVendorVo, CompanyV
|
||||
holder.error("合同未关联公司");
|
||||
return;
|
||||
}
|
||||
CompanyVendorVo companyVendor = findByCompany(company);
|
||||
VendorVo companyVendor = findByCompany(company);
|
||||
if (companyVendor == null) {
|
||||
holder.error("合同未关联供应商");
|
||||
return;
|
||||
@@ -105,7 +105,7 @@ public class CompanyVendorService extends QueryService<CompanyVendorVo, CompanyV
|
||||
companyVendorFileService.verify(companyVendor, contract.getSetupDate(), holder);
|
||||
}
|
||||
|
||||
private boolean verifyAsTypicallyVendor(CompanyVendorVo companyVendor, LocalDate verifyDate, MessageHolder holder) {
|
||||
private boolean verifyAsTypicallyVendor(VendorVo companyVendor, LocalDate verifyDate, MessageHolder holder) {
|
||||
boolean valid = false;
|
||||
CompanyVo company = companyService.findById(companyVendor.getCompanyId());
|
||||
// 检查营业状态
|
||||
@@ -135,7 +135,7 @@ public class CompanyVendorService extends QueryService<CompanyVendorVo, CompanyV
|
||||
return valid;
|
||||
}
|
||||
|
||||
public boolean makePathAbsent(CompanyVendorVo companyVendor) {
|
||||
public boolean makePathAbsent(VendorVo companyVendor) {
|
||||
String path = companyVendor.getPath();
|
||||
if (StringUtils.hasText(path)) {
|
||||
File file = new File(path);
|
||||
@@ -155,7 +155,7 @@ public class CompanyVendorService extends QueryService<CompanyVendorVo, CompanyV
|
||||
return true;
|
||||
}
|
||||
|
||||
public File makePath(CompanyVendorVo companyVendor) {
|
||||
public File makePath(VendorVo companyVendor) {
|
||||
File basePath = getBasePath();
|
||||
CompanyVo company = companyService.findById(companyVendor.getCompanyId());
|
||||
String companyName = company.getName();
|
||||
@@ -27,7 +27,7 @@ import lombok.ToString;
|
||||
@Entity
|
||||
@Table(name = "COMPANY_VENDOR_APPROVED")
|
||||
@ToString
|
||||
public class CompanyVendorApprovedList implements IdentityEntity, Serializable, Voable<CompanyVendorApprovedListVo> {
|
||||
public class VendorApprovedList implements IdentityEntity, Serializable, Voable<CompanyVendorApprovedListVo> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@@ -67,7 +67,7 @@ public class CompanyVendorApprovedList implements IdentityEntity, Serializable,
|
||||
if (HibernateProxyUtils.isNotEffectiveClassEquals(object, this)) {
|
||||
return false;
|
||||
}
|
||||
CompanyVendorApprovedList that = (CompanyVendorApprovedList) object;
|
||||
VendorApprovedList that = (VendorApprovedList) object;
|
||||
return getId() != null && Objects.equals(getId(), that.getId());
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public class CompanyVendorApprovedFile implements IdentityEntity, Serializable,
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "LIST_ID", nullable = false)
|
||||
@ToString.Exclude
|
||||
private CompanyVendorApprovedList list;
|
||||
private VendorApprovedList list;
|
||||
|
||||
/**
|
||||
* 文件名,不含目录,目录使用目录的目录
|
||||
@@ -39,7 +39,7 @@ public class CompanyVendorApprovedItem implements IdentityEntity, Serializable,
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "LIST_ID", nullable = false)
|
||||
@ToString.Exclude
|
||||
private CompanyVendorApprovedList list;
|
||||
private VendorApprovedList list;
|
||||
|
||||
/**
|
||||
* 供应商名称,有可能改名了,所以存历史名称
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.ecep.contract.ds.vendor.repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.ecep.contract.ds.MyRepository;
|
||||
import com.ecep.contract.model.CompanyVendorApprovedFile;
|
||||
|
||||
@Repository
|
||||
public interface CompanyVendorApprovedFileRepository extends MyRepository<CompanyVendorApprovedFile, Integer> {
|
||||
|
||||
List<CompanyVendorApprovedFile> findAllByListId(int listId);
|
||||
|
||||
CompanyVendorApprovedFile findByListIdAndFileName(int listId, String fileName);
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package com.ecep.contract.ds.vendor.repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.ecep.contract.model.Vendor;
|
||||
import com.ecep.contract.model.CompanyVendorApprovedItem;
|
||||
import com.ecep.contract.model.CompanyVendorApprovedList;
|
||||
|
||||
/**
|
||||
* 合格供方名录
|
||||
*/
|
||||
@Repository
|
||||
public interface CompanyVendorApprovedItemRepository extends
|
||||
JpaRepository<CompanyVendorApprovedItem, Integer>, JpaSpecificationExecutor<CompanyVendorApprovedItem> {
|
||||
|
||||
List<CompanyVendorApprovedItem> findAllByList(CompanyVendorApprovedList list);
|
||||
|
||||
List<CompanyVendorApprovedItem> findAllByListAndVendor(CompanyVendorApprovedList list, Vendor vendor);
|
||||
|
||||
CompanyVendorApprovedItem findByListAndVendor(CompanyVendorApprovedList list, Vendor vendor);
|
||||
}
|
||||
16
server/src/main/java/com/ecep/contract/ds/vendor/repository/VendorApprovedFileRepository.java
vendored
Normal file
16
server/src/main/java/com/ecep/contract/ds/vendor/repository/VendorApprovedFileRepository.java
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
package com.ecep.contract.ds.vendor.repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.ecep.contract.ds.MyRepository;
|
||||
import com.ecep.contract.model.VendorApprovedFile;
|
||||
|
||||
@Repository
|
||||
public interface CompanyVendorApprovedFileRepository extends MyRepository<VendorApprovedFile, Integer> {
|
||||
|
||||
List<VendorApprovedFile> findAllByListId(int listId);
|
||||
|
||||
VendorApprovedFile findByListIdAndFileName(int listId, String fileName);
|
||||
}
|
||||
25
server/src/main/java/com/ecep/contract/ds/vendor/repository/VendorApprovedItemRepository.java
vendored
Normal file
25
server/src/main/java/com/ecep/contract/ds/vendor/repository/VendorApprovedItemRepository.java
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
package com.ecep.contract.ds.vendor.repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.ecep.contract.model.Vendor;
|
||||
import com.ecep.contract.model.VendorApprovedItem;
|
||||
import com.ecep.contract.model.VendorApproved;
|
||||
|
||||
/**
|
||||
* 合格供方名录
|
||||
*/
|
||||
@Repository
|
||||
public interface CompanyVendorApprovedItemRepository extends
|
||||
JpaRepository<VendorApprovedItem, Integer>, JpaSpecificationExecutor<VendorApprovedItem> {
|
||||
|
||||
List<VendorApprovedItem> findAllByList(VendorApproved list);
|
||||
|
||||
List<VendorApprovedItem> findAllByListAndVendor(VendorApproved list, Vendor vendor);
|
||||
|
||||
VendorApprovedItem findByListAndVendor(VendorApproved list, Vendor vendor);
|
||||
}
|
||||
@@ -4,14 +4,14 @@ import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.ecep.contract.model.CompanyVendorApprovedList;
|
||||
import com.ecep.contract.model.VendorApproved;
|
||||
|
||||
/**
|
||||
* 合格供方名录
|
||||
*/
|
||||
@Repository
|
||||
public interface CompanyVendorApprovedListRepository extends
|
||||
JpaRepository<CompanyVendorApprovedList, Integer>, JpaSpecificationExecutor<CompanyVendorApprovedList>
|
||||
JpaRepository<VendorApproved, Integer>, JpaSpecificationExecutor<VendorApproved>
|
||||
|
||||
|
||||
|
||||
@@ -7,12 +7,12 @@ import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.ecep.contract.ds.MyRepository;
|
||||
import com.ecep.contract.model.Vendor;
|
||||
import com.ecep.contract.model.CompanyVendorEntity;
|
||||
import com.ecep.contract.model.VendorEntity;
|
||||
|
||||
@Repository
|
||||
public interface CompanyVendorEntityRepository extends MyRepository<CompanyVendorEntity, Integer> {
|
||||
Optional<CompanyVendorEntity> findByCode(String code);
|
||||
public interface CompanyVendorEntityRepository extends MyRepository<VendorEntity, Integer> {
|
||||
Optional<VendorEntity> findByCode(String code);
|
||||
|
||||
List<CompanyVendorEntity> findByVendor(Vendor vendor);
|
||||
List<VendorEntity> findByVendor(Vendor vendor);
|
||||
|
||||
}
|
||||
@@ -8,15 +8,15 @@ import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.ecep.contract.VendorFileType;
|
||||
import com.ecep.contract.model.Vendor;
|
||||
import com.ecep.contract.model.CompanyVendorFile;
|
||||
import com.ecep.contract.model.VendorFile;
|
||||
|
||||
@Repository
|
||||
public interface CompanyVendorFileRepository
|
||||
extends JpaRepository<CompanyVendorFile, Integer>, JpaSpecificationExecutor<CompanyVendorFile> {
|
||||
extends JpaRepository<VendorFile, Integer>, JpaSpecificationExecutor<VendorFile> {
|
||||
|
||||
List<CompanyVendorFile> findAllByVendorId(int vendorId);
|
||||
List<VendorFile> findAllByVendorId(int vendorId);
|
||||
|
||||
List<CompanyVendorFile> findAllByVendorAndType(Vendor vendor, VendorFileType type);
|
||||
List<VendorFile> findAllByVendorAndType(Vendor vendor, VendorFileType type);
|
||||
|
||||
List<CompanyVendorFile> findByVendorId(int vendorId);
|
||||
List<VendorFile> findByVendorId(int vendorId);
|
||||
}
|
||||
@@ -11,12 +11,12 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.ds.vendor.repository.CompanyVendorApprovedFileRepository;
|
||||
import com.ecep.contract.model.CompanyVendorApprovedFile;
|
||||
import com.ecep.contract.model.CompanyVendorApprovedList;
|
||||
import com.ecep.contract.model.VendorApprovedFile;
|
||||
import com.ecep.contract.model.VendorApproved;
|
||||
|
||||
@Lazy
|
||||
@Service
|
||||
public class CompanyVendorApprovedFileService implements IEntityService<CompanyVendorApprovedFile> {
|
||||
public class CompanyVendorApprovedFileService implements IEntityService<VendorApprovedFile> {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private CompanyVendorApprovedFileRepository repository;
|
||||
@@ -28,7 +28,7 @@ public class CompanyVendorApprovedFileService implements IEntityService<CompanyV
|
||||
* @return 找到的文件实体,如果不存在则返回null
|
||||
*/
|
||||
@Override
|
||||
public CompanyVendorApprovedFile findById(Integer id) {
|
||||
public VendorApprovedFile findById(Integer id) {
|
||||
return repository.findById(id).orElse(null);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public class CompanyVendorApprovedFileService implements IEntityService<CompanyV
|
||||
* @return 构建的查询规格
|
||||
*/
|
||||
@Override
|
||||
public Specification<CompanyVendorApprovedFile> getSpecification(String searchText) {
|
||||
public Specification<VendorApprovedFile> getSpecification(String searchText) {
|
||||
return (root, query, builder) -> {
|
||||
return builder.or(
|
||||
builder.like(root.get("fileName"), "%" + searchText + "%"),
|
||||
@@ -57,7 +57,7 @@ public class CompanyVendorApprovedFileService implements IEntityService<CompanyV
|
||||
* @return 分页的文件列表
|
||||
*/
|
||||
@Override
|
||||
public Page<CompanyVendorApprovedFile> findAll(Specification<CompanyVendorApprovedFile> spec, Pageable pageable) {
|
||||
public Page<VendorApprovedFile> findAll(Specification<VendorApprovedFile> spec, Pageable pageable) {
|
||||
return repository.findAll(spec, pageable);
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ public class CompanyVendorApprovedFileService implements IEntityService<CompanyV
|
||||
* @param entity 要删除的文件实体
|
||||
*/
|
||||
@Override
|
||||
public void delete(CompanyVendorApprovedFile entity) {
|
||||
public void delete(VendorApprovedFile entity) {
|
||||
repository.delete(entity);
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ public class CompanyVendorApprovedFileService implements IEntityService<CompanyV
|
||||
* @return 保存后的文件实体
|
||||
*/
|
||||
@Override
|
||||
public CompanyVendorApprovedFile save(CompanyVendorApprovedFile entity) {
|
||||
public VendorApprovedFile save(VendorApprovedFile entity) {
|
||||
return repository.save(entity);
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ public class CompanyVendorApprovedFileService implements IEntityService<CompanyV
|
||||
* @param name 文件名
|
||||
* @return 找到的文件实体
|
||||
*/
|
||||
public CompanyVendorApprovedFile findByName(CompanyVendorApprovedList approvedList, String name) {
|
||||
public VendorApprovedFile findByName(VendorApproved approvedList, String name) {
|
||||
return repository.findByListIdAndFileName(approvedList.getId(), name);
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ public class CompanyVendorApprovedFileService implements IEntityService<CompanyV
|
||||
* @param list 已批准列表实体
|
||||
* @return 该列表下的所有文件列表
|
||||
*/
|
||||
public List<CompanyVendorApprovedFile> findAllByList(CompanyVendorApprovedList list) {
|
||||
public List<VendorApprovedFile> findAllByList(VendorApproved list) {
|
||||
return repository.findAllByListId(list.getId());
|
||||
}
|
||||
}
|
||||
@@ -20,15 +20,15 @@ import com.ecep.contract.ds.vendor.repository.CompanyVendorApprovedItemRepositor
|
||||
import com.ecep.contract.model.Company;
|
||||
import com.ecep.contract.model.CompanyOldName;
|
||||
import com.ecep.contract.model.Vendor;
|
||||
import com.ecep.contract.model.CompanyVendorApprovedItem;
|
||||
import com.ecep.contract.model.CompanyVendorApprovedList;
|
||||
import com.ecep.contract.model.VendorApprovedItem;
|
||||
import com.ecep.contract.model.VendorApproved;
|
||||
|
||||
import jakarta.persistence.criteria.Path;
|
||||
import jakarta.persistence.criteria.Predicate;
|
||||
|
||||
@Lazy
|
||||
@Service
|
||||
public class CompanyVendorApprovedItemService implements IEntityService<CompanyVendorApprovedItem>, QueryService<CompanyVendorApprovedItem> {
|
||||
public class CompanyVendorApprovedItemService implements IEntityService<VendorApprovedItem>, QueryService<VendorApprovedItem> {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private CompanyVendorApprovedItemRepository repository;
|
||||
@@ -37,12 +37,12 @@ public class CompanyVendorApprovedItemService implements IEntityService<CompanyV
|
||||
private CompanyOldNameService companyOldNameService;
|
||||
|
||||
@Override
|
||||
public CompanyVendorApprovedItem findById(Integer id) {
|
||||
public VendorApprovedItem findById(Integer id) {
|
||||
return repository.findById(id).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Specification<CompanyVendorApprovedItem> getSpecification(String searchText) {
|
||||
public Specification<VendorApprovedItem> getSpecification(String searchText) {
|
||||
return (root, query, builder) -> {
|
||||
Path<Vendor> vendor = root.get("vendor");
|
||||
Path<Company> company = vendor.get("company");
|
||||
@@ -66,27 +66,27 @@ public class CompanyVendorApprovedItemService implements IEntityService<CompanyV
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<CompanyVendorApprovedItem> findAll(Specification<CompanyVendorApprovedItem> spec, Pageable pageable) {
|
||||
public Page<VendorApprovedItem> findAll(Specification<VendorApprovedItem> spec, Pageable pageable) {
|
||||
return repository.findAll(spec, pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(CompanyVendorApprovedItem entity) {
|
||||
public void delete(VendorApprovedItem entity) {
|
||||
repository.delete(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompanyVendorApprovedItem save(CompanyVendorApprovedItem entity) {
|
||||
public VendorApprovedItem save(VendorApprovedItem entity) {
|
||||
return repository.save(entity);
|
||||
}
|
||||
|
||||
public List<CompanyVendorApprovedItem> findAll(Specification<CompanyVendorApprovedItem> spec, Sort sort) {
|
||||
public List<VendorApprovedItem> findAll(Specification<VendorApprovedItem> spec, Sort sort) {
|
||||
return repository.findAll(spec, sort);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<CompanyVendorApprovedItem> findAll(JsonNode paramsNode, Pageable pageable) {
|
||||
Specification<CompanyVendorApprovedItem> spec = null;
|
||||
public Page<VendorApprovedItem> findAll(JsonNode paramsNode, Pageable pageable) {
|
||||
Specification<VendorApprovedItem> spec = null;
|
||||
if (paramsNode.has("searchText")) {
|
||||
spec = getSpecification(paramsNode.get("searchText").asText());
|
||||
}
|
||||
@@ -95,7 +95,7 @@ public class CompanyVendorApprovedItemService implements IEntityService<CompanyV
|
||||
return findAll(spec, pageable);
|
||||
}
|
||||
|
||||
public List<CompanyVendorApprovedItem> findAllByListAndVendor(CompanyVendorApprovedList approvedList, Vendor vendor) {
|
||||
public List<VendorApprovedItem> findAllByListAndVendor(VendorApproved approvedList, Vendor vendor) {
|
||||
return repository.findAllByListAndVendor(approvedList, vendor);
|
||||
}
|
||||
}
|
||||
@@ -7,8 +7,8 @@ import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.constant.CompanyVendorConstant;
|
||||
import com.ecep.contract.ds.other.service.SysConfService;
|
||||
import com.ecep.contract.ds.vendor.repository.CompanyVendorApprovedListRepository;
|
||||
import com.ecep.contract.model.CompanyVendorApprovedFile;
|
||||
import com.ecep.contract.model.CompanyVendorApprovedList;
|
||||
import com.ecep.contract.model.VendorApprovedFile;
|
||||
import com.ecep.contract.model.VendorApproved;
|
||||
import com.ecep.contract.util.FileUtils;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
@@ -33,7 +33,7 @@ import java.util.function.Consumer;
|
||||
|
||||
@Lazy
|
||||
@Service
|
||||
public class CompanyVendorApprovedListService implements IEntityService<CompanyVendorApprovedList>, QueryService<CompanyVendorApprovedList> {
|
||||
public class CompanyVendorApprovedListService implements IEntityService<VendorApproved>, QueryService<VendorApproved> {
|
||||
private static final Logger logger = LoggerFactory.getLogger(CompanyVendorApprovedListService.class);
|
||||
@Lazy
|
||||
@Autowired
|
||||
@@ -54,18 +54,18 @@ public class CompanyVendorApprovedListService implements IEntityService<CompanyV
|
||||
return new File(confService.getString(CompanyVendorConstant.KEY_APPROVED_LIST_BASE_PATH));
|
||||
}
|
||||
|
||||
public CompanyVendorApprovedList findById(Integer id) {
|
||||
public VendorApproved findById(Integer id) {
|
||||
return repository.findById(id).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<CompanyVendorApprovedList> findAll(Specification<CompanyVendorApprovedList> spec, Pageable pageable) {
|
||||
public Page<VendorApproved> findAll(Specification<VendorApproved> spec, Pageable pageable) {
|
||||
return repository.findAll(spec, pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<CompanyVendorApprovedList> findAll(JsonNode paramsNode, Pageable pageable) {
|
||||
Specification<CompanyVendorApprovedList> spec = null;
|
||||
public Page<VendorApproved> findAll(JsonNode paramsNode, Pageable pageable) {
|
||||
Specification<VendorApproved> spec = null;
|
||||
if (paramsNode.has("searchText")) {
|
||||
spec = getSpecification(paramsNode.get("searchText").asText());
|
||||
}
|
||||
@@ -75,7 +75,7 @@ public class CompanyVendorApprovedListService implements IEntityService<CompanyV
|
||||
}
|
||||
|
||||
@Override
|
||||
public Specification<CompanyVendorApprovedList> getSpecification(String searchText) {
|
||||
public Specification<VendorApproved> getSpecification(String searchText) {
|
||||
if (!StringUtils.hasText(searchText)) {
|
||||
return null;
|
||||
}
|
||||
@@ -84,20 +84,20 @@ public class CompanyVendorApprovedListService implements IEntityService<CompanyV
|
||||
};
|
||||
}
|
||||
|
||||
public CompanyVendorApprovedList save(CompanyVendorApprovedList list) {
|
||||
public VendorApproved save(VendorApproved list) {
|
||||
return repository.save(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(CompanyVendorApprovedList entity) {
|
||||
public void delete(VendorApproved entity) {
|
||||
repository.delete(entity);
|
||||
}
|
||||
|
||||
public Page<CompanyVendorApprovedList> findAll(Specification<CompanyVendorApprovedList> spec, PageRequest pageRequest) {
|
||||
public Page<VendorApproved> findAll(Specification<VendorApproved> spec, PageRequest pageRequest) {
|
||||
return repository.findAll(spec, pageRequest);
|
||||
}
|
||||
|
||||
public boolean makePathAbsent(CompanyVendorApprovedList list) {
|
||||
public boolean makePathAbsent(VendorApproved list) {
|
||||
String path = list.getPath();
|
||||
if (StringUtils.hasText(path)) {
|
||||
File file = new File(path);
|
||||
@@ -117,7 +117,7 @@ public class CompanyVendorApprovedListService implements IEntityService<CompanyV
|
||||
return true;
|
||||
}
|
||||
|
||||
private File makePath(CompanyVendorApprovedList list) {
|
||||
private File makePath(VendorApproved list) {
|
||||
File basePath = getBasePath();
|
||||
if (!basePath.exists()) {
|
||||
System.out.println("basePath = " + basePath);
|
||||
@@ -134,18 +134,18 @@ public class CompanyVendorApprovedListService implements IEntityService<CompanyV
|
||||
return dir;
|
||||
}
|
||||
|
||||
public boolean reBuildingFiles(CompanyVendorApprovedList list, Consumer<String> status) {
|
||||
public boolean reBuildingFiles(VendorApproved list, Consumer<String> status) {
|
||||
String contractPath = list.getPath();
|
||||
if (!StringUtils.hasText(contractPath)) {
|
||||
return false;
|
||||
}
|
||||
List<CompanyVendorApprovedFile> dbFiles = fileService.findAllByList(list);
|
||||
List<CompanyVendorApprovedFile> retrieveFiles = new ArrayList<>();
|
||||
List<VendorApprovedFile> dbFiles = fileService.findAllByList(list);
|
||||
List<VendorApprovedFile> retrieveFiles = new ArrayList<>();
|
||||
boolean modfied = false;
|
||||
|
||||
Map<String, CompanyVendorApprovedFile> map = new HashMap<>();
|
||||
Map<String, VendorApprovedFile> map = new HashMap<>();
|
||||
// 排除掉数据库中重复的
|
||||
for (CompanyVendorApprovedFile dbFile : dbFiles) {
|
||||
for (VendorApprovedFile dbFile : dbFiles) {
|
||||
String fileName = dbFile.getFileName();
|
||||
// 没有文件信息,无效记录,删除
|
||||
if (!StringUtils.hasText(fileName)) {
|
||||
@@ -162,7 +162,7 @@ public class CompanyVendorApprovedListService implements IEntityService<CompanyV
|
||||
continue;
|
||||
}
|
||||
|
||||
CompanyVendorApprovedFile old = map.put(fileName, dbFile);
|
||||
VendorApprovedFile old = map.put(fileName, dbFile);
|
||||
// 目录有重复删除
|
||||
if (old != null) {
|
||||
fileService.delete(old);
|
||||
@@ -183,7 +183,7 @@ public class CompanyVendorApprovedListService implements IEntityService<CompanyV
|
||||
String fileName = file.getName();
|
||||
if (!map.containsKey(fileName)) {
|
||||
// 未记录
|
||||
CompanyVendorApprovedFile filled = fillFileType(file, status);
|
||||
VendorApprovedFile filled = fillFileType(file, status);
|
||||
retrieveFiles.add(filled);
|
||||
}
|
||||
}
|
||||
@@ -203,9 +203,9 @@ public class CompanyVendorApprovedListService implements IEntityService<CompanyV
|
||||
return true;
|
||||
}
|
||||
|
||||
public CompanyVendorApprovedFile fillFileType(File file, Consumer<String> status) {
|
||||
public VendorApprovedFile fillFileType(File file, Consumer<String> status) {
|
||||
String fileName = file.getName();
|
||||
CompanyVendorApprovedFile vendorFile = new CompanyVendorApprovedFile();
|
||||
VendorApprovedFile vendorFile = new VendorApprovedFile();
|
||||
vendorFile.setFileName(file.getName());
|
||||
vendorFile.setSignDate(MyDateTimeUtils.pickLocalDate(fileName));
|
||||
|
||||
@@ -18,21 +18,21 @@ import org.springframework.util.StringUtils;
|
||||
import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.ds.vendor.repository.CompanyVendorEntityRepository;
|
||||
import com.ecep.contract.model.Vendor;
|
||||
import com.ecep.contract.model.CompanyVendorEntity;
|
||||
import com.ecep.contract.model.VendorEntity;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
@Lazy
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "company-vendor-entity")
|
||||
public class CompanyVendorEntityService implements IEntityService<CompanyVendorEntity>, QueryService<CompanyVendorEntity> {
|
||||
public class CompanyVendorEntityService implements IEntityService<VendorEntity>, QueryService<VendorEntity> {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private CompanyVendorEntityRepository repository;
|
||||
|
||||
@Cacheable(key = "#p0")
|
||||
@Override
|
||||
public CompanyVendorEntity findById(Integer id) {
|
||||
public VendorEntity findById(Integer id) {
|
||||
return repository.findById(id).orElse(null);
|
||||
}
|
||||
|
||||
@@ -43,19 +43,19 @@ public class CompanyVendorEntityService implements IEntityService<CompanyVendorE
|
||||
* @return CompanyVendorEntity
|
||||
*/
|
||||
@Cacheable(key = "'code-'+#p0")
|
||||
public CompanyVendorEntity findByCode(String code) {
|
||||
public VendorEntity findByCode(String code) {
|
||||
return repository.findByCode(code).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Specification<CompanyVendorEntity> getSpecification(String searchText) {
|
||||
public Specification<VendorEntity> getSpecification(String searchText) {
|
||||
if (!StringUtils.hasText(searchText)) {
|
||||
return null;
|
||||
}
|
||||
return SpecificationUtils.andWith(searchText, this::buildSearchSpecification);
|
||||
}
|
||||
|
||||
protected Specification<CompanyVendorEntity> buildSearchSpecification(String searchText) {
|
||||
protected Specification<VendorEntity> buildSearchSpecification(String searchText) {
|
||||
return (root, query, builder) -> {
|
||||
return builder.or(
|
||||
builder.like(root.get("name"), "%" + searchText + "%"),
|
||||
@@ -66,19 +66,19 @@ public class CompanyVendorEntityService implements IEntityService<CompanyVendorE
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CompanyVendorEntity> search(String searchText) {
|
||||
Specification<CompanyVendorEntity> spec = getSpecification(searchText);
|
||||
public List<VendorEntity> search(String searchText) {
|
||||
Specification<VendorEntity> spec = getSpecification(searchText);
|
||||
return repository.findAll(spec, Pageable.ofSize(10)).getContent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<CompanyVendorEntity> findAll(Specification<CompanyVendorEntity> spec, Pageable pageable) {
|
||||
public Page<VendorEntity> findAll(Specification<VendorEntity> spec, Pageable pageable) {
|
||||
return repository.findAll(spec, pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<CompanyVendorEntity> findAll(JsonNode paramsNode, Pageable pageable) {
|
||||
Specification<CompanyVendorEntity> spec = null;
|
||||
public Page<VendorEntity> findAll(JsonNode paramsNode, Pageable pageable) {
|
||||
Specification<VendorEntity> spec = null;
|
||||
if (paramsNode.has("searchText")) {
|
||||
spec = getSpecification(paramsNode.get("searchText").asText());
|
||||
}
|
||||
@@ -94,7 +94,7 @@ public class CompanyVendorEntityService implements IEntityService<CompanyVendorE
|
||||
}
|
||||
)
|
||||
@Override
|
||||
public void delete(CompanyVendorEntity entity) {
|
||||
public void delete(VendorEntity entity) {
|
||||
repository.delete(entity);
|
||||
}
|
||||
|
||||
@@ -105,11 +105,11 @@ public class CompanyVendorEntityService implements IEntityService<CompanyVendorE
|
||||
}
|
||||
)
|
||||
@Override
|
||||
public CompanyVendorEntity save(CompanyVendorEntity entity) {
|
||||
public VendorEntity save(VendorEntity entity) {
|
||||
return repository.save(entity);
|
||||
}
|
||||
|
||||
public List<CompanyVendorEntity> findAllByVendor(Vendor vendor) {
|
||||
public List<VendorEntity> findAllByVendor(Vendor vendor) {
|
||||
return repository.findByVendor(vendor);
|
||||
}
|
||||
}
|
||||
@@ -24,13 +24,13 @@ import com.ecep.contract.ds.contract.service.ContractFileService;
|
||||
import com.ecep.contract.ds.contract.service.ContractService;
|
||||
import com.ecep.contract.ds.vendor.repository.CompanyVendorFileRepository;
|
||||
import com.ecep.contract.model.Vendor;
|
||||
import com.ecep.contract.model.CompanyVendorFile;
|
||||
import com.ecep.contract.model.VendorFile;
|
||||
import com.ecep.contract.model.Contract;
|
||||
|
||||
|
||||
@Lazy
|
||||
@Service
|
||||
public class CompanyVendorFileService implements IEntityService<CompanyVendorFile>, QueryService<CompanyVendorFile> {
|
||||
public class CompanyVendorFileService implements IEntityService<VendorFile>, QueryService<VendorFile> {
|
||||
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(CompanyVendorFileService.class);
|
||||
@@ -40,25 +40,25 @@ public class CompanyVendorFileService implements IEntityService<CompanyVendorFil
|
||||
@Autowired
|
||||
private ContractFileService contractFileService;
|
||||
|
||||
public CompanyVendorFile findById(Integer id) {
|
||||
public VendorFile findById(Integer id) {
|
||||
return repository.findById(id).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Specification<CompanyVendorFile> getSpecification(String searchText) {
|
||||
public Specification<VendorFile> getSpecification(String searchText) {
|
||||
return (root, query, builder) -> {
|
||||
return builder.or(builder.like(root.get("filePath"), "%" + searchText + "%"));
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<CompanyVendorFile> findAll(Specification<CompanyVendorFile> spec, Pageable pageable) {
|
||||
public Page<VendorFile> findAll(Specification<VendorFile> spec, Pageable pageable) {
|
||||
return repository.findAll(spec, pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<CompanyVendorFile> findAll(JsonNode paramsNode, Pageable pageable) {
|
||||
Specification<CompanyVendorFile> spec = null;
|
||||
public Page<VendorFile> findAll(JsonNode paramsNode, Pageable pageable) {
|
||||
Specification<VendorFile> spec = null;
|
||||
if (paramsNode.has("searchText")) {
|
||||
spec = getSpecification(paramsNode.get("searchText").asText());
|
||||
}
|
||||
@@ -72,11 +72,11 @@ public class CompanyVendorFileService implements IEntityService<CompanyVendorFil
|
||||
return findAll(spec, pageable);
|
||||
}
|
||||
|
||||
public List<CompanyVendorFile> findAllByVendor(Vendor vendor) {
|
||||
public List<VendorFile> findAllByVendor(Vendor vendor) {
|
||||
return repository.findAllByVendorId(vendor.getId());
|
||||
}
|
||||
|
||||
public void delete(CompanyVendorFile file) {
|
||||
public void delete(VendorFile file) {
|
||||
repository.delete(file);
|
||||
}
|
||||
|
||||
@@ -84,19 +84,19 @@ public class CompanyVendorFileService implements IEntityService<CompanyVendorFil
|
||||
repository.deleteById(id);
|
||||
}
|
||||
|
||||
public void saveAll(List<CompanyVendorFile> files) {
|
||||
public void saveAll(List<VendorFile> files) {
|
||||
repository.saveAll(files);
|
||||
}
|
||||
|
||||
public CompanyVendorFile save(CompanyVendorFile file) {
|
||||
public VendorFile save(VendorFile file) {
|
||||
return repository.save(file);
|
||||
}
|
||||
|
||||
public List<CompanyVendorFile> findAll(Specification<CompanyVendorFile> spec, Sort sort) {
|
||||
public List<VendorFile> findAll(Specification<VendorFile> spec, Sort sort) {
|
||||
return repository.findAll(spec, sort);
|
||||
}
|
||||
|
||||
public List<CompanyVendorFile> findAllByVendorAndType(Vendor vendor, VendorFileType type) {
|
||||
public List<VendorFile> findAllByVendorAndType(Vendor vendor, VendorFileType type) {
|
||||
return repository.findAllByVendorAndType(vendor, type);
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ public class CompanyVendorFileService implements IEntityService<CompanyVendorFil
|
||||
}
|
||||
|
||||
// 查询所有评价表
|
||||
List<CompanyVendorFile> files = findAllByVendorAndType(vendor, VendorFileType.EvaluationForm);
|
||||
List<VendorFile> files = findAllByVendorAndType(vendor, VendorFileType.EvaluationForm);
|
||||
if (files == null || files.isEmpty()) {
|
||||
holder.error("未见供应商评价");
|
||||
return;
|
||||
@@ -123,15 +123,15 @@ public class CompanyVendorFileService implements IEntityService<CompanyVendorFil
|
||||
|
||||
// 检索 验证日期最近一年内的有效评价表,日期宽限7天
|
||||
LocalDate begin = verifyDate.plusYears(-1);
|
||||
CompanyVendorFile vendorFile = files.stream()
|
||||
VendorFile vendorFile = files.stream()
|
||||
.filter(v -> v.getSignDate() != null && v.isValid())
|
||||
.filter(v -> MyDateTimeUtils.dateValidFilter(v.getSignDate(), begin, verifyDate, 7))
|
||||
.findFirst().orElse(null);
|
||||
if (vendorFile == null) {
|
||||
// 检索最后一个有效评价表
|
||||
CompanyVendorFile latestFile = files.stream()
|
||||
VendorFile latestFile = files.stream()
|
||||
.filter(v -> v.getSignDate() != null && v.isValid())
|
||||
.max(Comparator.comparing(CompanyVendorFile::getSignDate))
|
||||
.max(Comparator.comparing(VendorFile::getSignDate))
|
||||
.orElse(null);
|
||||
|
||||
if (latestFile == null) {
|
||||
@@ -160,10 +160,10 @@ public class CompanyVendorFileService implements IEntityService<CompanyVendorFil
|
||||
return null;
|
||||
}
|
||||
// 检索评价表
|
||||
List<CompanyVendorFile> files = findAllByVendorAndType(vendor, VendorFileType.EvaluationForm);
|
||||
CompanyVendorFile latestFile = files.stream()
|
||||
List<VendorFile> files = findAllByVendorAndType(vendor, VendorFileType.EvaluationForm);
|
||||
VendorFile latestFile = files.stream()
|
||||
.filter(v -> v.getSignDate() != null && v.isValid())
|
||||
.max(Comparator.comparing(CompanyVendorFile::getSignDate))
|
||||
.max(Comparator.comparing(VendorFile::getSignDate))
|
||||
.orElse(null);
|
||||
|
||||
// 没有有效的评价表的评价日期
|
||||
@@ -125,11 +125,11 @@ public class CompanyVendorService extends CompanyBasicService
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
List<CompanyVendorEntity> searched = companyVendorEntityService.search(searchText);
|
||||
List<VendorEntity> searched = companyVendorEntityService.search(searchText);
|
||||
if (!searched.isEmpty()) {
|
||||
nameSpec = SpecificationUtils.or(nameSpec, (root, query, builder) -> {
|
||||
return builder.in(root.get("id")).value(searched.stream()
|
||||
.map(CompanyVendorEntity::getVendor)
|
||||
.map(VendorEntity::getVendor)
|
||||
.filter(Objects::nonNull)
|
||||
.map(Vendor::getId)
|
||||
.collect(Collectors.toSet()));
|
||||
@@ -146,7 +146,7 @@ public class CompanyVendorService extends CompanyBasicService
|
||||
|
||||
@Override
|
||||
public <T, F extends CompanyBasicFile<T>, ID> void deleteFile(F file) {
|
||||
companyVendorFileService.delete((CompanyVendorFile) file);
|
||||
companyVendorFileService.delete((VendorFile) file);
|
||||
}
|
||||
|
||||
public File getBasePath() {
|
||||
@@ -160,15 +160,15 @@ public class CompanyVendorService extends CompanyBasicService
|
||||
* @param status 输出
|
||||
*/
|
||||
public boolean reBuildingFiles(Vendor vendor, Consumer<String> status) {
|
||||
List<CompanyVendorFile> dbFiles = companyVendorFileService.findAllByVendor(vendor);
|
||||
Map<String, CompanyVendorFile> map = new HashMap<>();
|
||||
List<VendorFile> dbFiles = companyVendorFileService.findAllByVendor(vendor);
|
||||
Map<String, VendorFile> map = new HashMap<>();
|
||||
|
||||
boolean modified = fetchDbFiles(dbFiles, map, status);
|
||||
|
||||
// 供应商目录下,准备用于移动到公司目录
|
||||
List<File> needMoveToCompanyPath = new ArrayList<>();
|
||||
// 有修改和新导入的文件
|
||||
List<CompanyVendorFile> retrieveFiles = new ArrayList<>();
|
||||
List<VendorFile> retrieveFiles = new ArrayList<>();
|
||||
|
||||
// TODO 供应商有曾用名,可能存在多个目录
|
||||
fetchFiles(vendor.getPath(), needMoveToCompanyPath, retrieveFiles, map, status);
|
||||
@@ -193,7 +193,7 @@ public class CompanyVendorService extends CompanyBasicService
|
||||
Consumer<String> status) {
|
||||
dbFile.setType((T) VendorFileType.General);
|
||||
fillFile(dbFile, file, null, status);
|
||||
companyVendorFileService.save((CompanyVendorFile) dbFile);
|
||||
companyVendorFileService.save((VendorFile) dbFile);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -201,7 +201,7 @@ public class CompanyVendorService extends CompanyBasicService
|
||||
@Override
|
||||
protected <T, F extends CompanyBasicFile<T>> F fillFileType(File file, List<File> fileList,
|
||||
Consumer<String> status) {
|
||||
CompanyVendorFile vendorFile = new CompanyVendorFile();
|
||||
VendorFile vendorFile = new VendorFile();
|
||||
vendorFile.setType(VendorFileType.General);
|
||||
vendorFile.setFilePath(file.getAbsolutePath());
|
||||
fillFile(vendorFile, file, fileList, status);
|
||||
Reference in New Issue
Block a user