UP
This commit is contained in:
@@ -9,6 +9,7 @@ import java.util.Locale;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import com.ecep.contract.util.ContextUtils;
|
||||
import com.ecep.contract.util.FxmlPath;
|
||||
import com.ecep.contract.util.FxmlUtils;
|
||||
import com.ecep.contract.vo.EmployeeVo;
|
||||
@@ -41,7 +42,7 @@ import javafx.stage.Window;
|
||||
import javafx.stage.WindowEvent;
|
||||
import lombok.Getter;
|
||||
|
||||
public class BaseController {
|
||||
public class BaseController implements ContextUtils {
|
||||
private static final Logger logger = LoggerFactory.getLogger(BaseController.class);
|
||||
public static HashMap<String, Stage> stages = new HashMap<>();
|
||||
|
||||
@@ -50,7 +51,7 @@ public class BaseController {
|
||||
}
|
||||
|
||||
public static <T extends BaseController> CompletableFuture<Void> show(Class<T> clz, Window owner,
|
||||
Consumer<T> consumer) {
|
||||
Consumer<T> consumer) {
|
||||
String key = clz.getName();
|
||||
if (toFront(key)) {
|
||||
return null;
|
||||
|
||||
@@ -26,7 +26,7 @@ import com.ecep.contract.controller.tab.CompanyTabSkinOldName;
|
||||
import com.ecep.contract.controller.tab.CompanyTabSkinOther;
|
||||
import com.ecep.contract.controller.tab.CompanyTabSkinPurchaseBillVoucher;
|
||||
import com.ecep.contract.controller.vendor.VendorWindowController;
|
||||
import com.ecep.contract.service.CompanyCustomerService;
|
||||
import com.ecep.contract.service.CustomerService;
|
||||
import com.ecep.contract.service.CompanyService;
|
||||
import com.ecep.contract.service.VendorService;
|
||||
import com.ecep.contract.task.CompanyCompositeUpdateTasker;
|
||||
@@ -34,7 +34,7 @@ import com.ecep.contract.task.CompanyVerifyTasker;
|
||||
import com.ecep.contract.util.FxmlPath;
|
||||
import com.ecep.contract.util.UITools;
|
||||
import com.ecep.contract.vm.CompanyViewModel;
|
||||
import com.ecep.contract.vo.CompanyCustomerVo;
|
||||
import com.ecep.contract.vo.CustomerVo;
|
||||
import com.ecep.contract.vo.VendorVo;
|
||||
import com.ecep.contract.vo.CompanyVo;
|
||||
|
||||
@@ -124,7 +124,7 @@ public class CompanyWindowController
|
||||
// private final CompanyVendorViewModel companyVendorViewModel = new
|
||||
// CompanyVendorViewModel();
|
||||
|
||||
private final SimpleObjectProperty<CompanyCustomerVo> companyCustomerProperty = new SimpleObjectProperty<>();
|
||||
private final SimpleObjectProperty<CustomerVo> companyCustomerProperty = new SimpleObjectProperty<>();
|
||||
private final SimpleObjectProperty<VendorVo> companyVendorProperty = new SimpleObjectProperty<>();
|
||||
|
||||
public Pane customerTab_pane1;
|
||||
@@ -202,7 +202,7 @@ public class CompanyWindowController
|
||||
logger.debug("onCustomerTabShown");
|
||||
}
|
||||
getLoadedFuture().thenAcceptAsync(company -> {
|
||||
CompanyCustomerVo customerVo = getCachedBean(CompanyCustomerService.class).findByCompany(company);
|
||||
CustomerVo customerVo = getCachedBean(CustomerService.class).findByCompany(company);
|
||||
companyCustomerProperty.set(customerVo);
|
||||
}).exceptionally(ex -> {
|
||||
UITools.showExceptionAndWait(ex.getMessage(), ex);
|
||||
|
||||
@@ -158,16 +158,10 @@ public class ContractVerifyWindowController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
ContractVerifyComm comm = new ContractVerifyComm();
|
||||
ContractVerifyComm comm = new ContractVerifyComm(this);
|
||||
|
||||
@Autowired
|
||||
private ProjectSaleTypeService saleTypeService;
|
||||
@Autowired
|
||||
private VendorGroupService vendorGroupService;
|
||||
@Autowired
|
||||
private ContractService contractService;
|
||||
@Autowired
|
||||
private EmployeeService employeeService;
|
||||
|
||||
@FXML
|
||||
public DatePicker setupDateBeginSelector;
|
||||
@@ -218,7 +212,6 @@ public class ContractVerifyWindowController extends BaseController {
|
||||
|
||||
public void onShown(WindowEvent windowEvent) {
|
||||
super.onShown(windowEvent);
|
||||
comm.setContractService(contractService);
|
||||
viewTable.getScene().getStylesheets().add("/ui/contract/contract-verify.css");
|
||||
|
||||
LocalDate now = LocalDate.now();
|
||||
@@ -230,11 +223,7 @@ public class ContractVerifyWindowController extends BaseController {
|
||||
viewTable_employeeColumn.setCellValueFactory(param -> param.getValue().getEmployee());
|
||||
viewTable_employeeColumn.setCellFactory(param -> new EmployeeTableCell<>(getEmployeeService()));
|
||||
viewTable_setupDateColumn.setCellValueFactory(param -> param.getValue().getSetupDate());
|
||||
// viewTable_stateColumn.setCellValueFactory(param ->
|
||||
// param.getValue().getMessages().map(messages -> {
|
||||
// return
|
||||
// messages.stream().map(Message::getMessage).collect(Collectors.joining(", "));
|
||||
// }));
|
||||
|
||||
viewTable_stateColumn.setCellValueFactory(param -> param.getValue().getMessages());
|
||||
viewTable_stateColumn.setCellFactory(param -> new StateTableCell());
|
||||
|
||||
|
||||
@@ -3,15 +3,15 @@ package com.ecep.contract.controller.customer;
|
||||
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.CompanyCustomerService;
|
||||
import com.ecep.contract.service.CustomerService;
|
||||
import com.ecep.contract.service.CompanyService;
|
||||
import com.ecep.contract.vm.CompanyCustomerViewModel;
|
||||
import com.ecep.contract.vm.IdentityViewModel;
|
||||
import com.ecep.contract.vo.CompanyCustomerVo;
|
||||
import com.ecep.contract.vo.CustomerVo;
|
||||
|
||||
public abstract class AbstCompanyCustomerTableTabSkin<T extends IdentityEntity, TV extends IdentityViewModel<T>>
|
||||
extends
|
||||
AbstEntityTableTabSkin<CompanyCustomerWindowController, CompanyCustomerVo, CompanyCustomerViewModel, T, TV>
|
||||
AbstEntityTableTabSkin<CompanyCustomerWindowController, CustomerVo, CompanyCustomerViewModel, T, TV>
|
||||
implements TabSkin {
|
||||
|
||||
public AbstCompanyCustomerTableTabSkin(CompanyCustomerWindowController controller) {
|
||||
@@ -22,8 +22,8 @@ public abstract class AbstCompanyCustomerTableTabSkin<T extends IdentityEntity,
|
||||
return controller.getCompanyService();
|
||||
}
|
||||
|
||||
protected CompanyCustomerService getCompanyCustomerService() {
|
||||
return getCachedBean(CompanyCustomerService.class);
|
||||
protected CustomerService getCompanyCustomerService() {
|
||||
return getCachedBean(CustomerService.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,13 +19,13 @@ import org.springframework.util.StringUtils;
|
||||
|
||||
import com.ecep.contract.controller.BaseController;
|
||||
import com.ecep.contract.vo.CompanyCustomerEvaluationFormFileVo;
|
||||
import com.ecep.contract.vo.CompanyCustomerFileVo;
|
||||
import com.ecep.contract.vo.CustomerFileVo;
|
||||
import com.ecep.contract.service.CompanyCustomerFileService;
|
||||
import com.ecep.contract.service.CompanyCustomerEvaluationFormFileService;
|
||||
import com.ecep.contract.util.FileUtils;
|
||||
import com.ecep.contract.util.FxmlUtils;
|
||||
import com.ecep.contract.vm.CompanyCustomerEvaluationFormFileViewModel;
|
||||
import com.ecep.contract.vm.CompanyCustomerFileViewModel;
|
||||
import com.ecep.contract.vm.CustomerFileViewModel;
|
||||
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.binding.Bindings;
|
||||
@@ -142,7 +142,7 @@ public class CompanyCustomerEvaluationFormFileWindowController extends BaseContr
|
||||
|
||||
loadedFuture = CompletableFuture.supplyAsync(() -> {
|
||||
int id = viewModel.getId().get();
|
||||
CompanyCustomerFileVo customerFile = companyCustomerFileService.findById(id);
|
||||
CustomerFileVo customerFile = companyCustomerFileService.findById(id);
|
||||
CompanyCustomerEvaluationFormFileVo formFile = evaluationFormFileService.findByCustomerFile(customerFile);
|
||||
Platform.runLater(() -> update(formFile));
|
||||
return formFile;
|
||||
|
||||
@@ -34,14 +34,14 @@ import com.ecep.contract.MyDateTimeUtils;
|
||||
import com.ecep.contract.service.CompanyCustomerEntityService;
|
||||
import com.ecep.contract.service.CompanyCustomerEvaluationFormFileService;
|
||||
import com.ecep.contract.service.CompanyCustomerFileService;
|
||||
import com.ecep.contract.service.CompanyCustomerService;
|
||||
import com.ecep.contract.service.CustomerService;
|
||||
import com.ecep.contract.task.Tasker;
|
||||
import com.ecep.contract.util.ExcelUtils;
|
||||
import com.ecep.contract.util.UITools;
|
||||
import com.ecep.contract.vo.CompanyCustomerEntityVo;
|
||||
import com.ecep.contract.vo.CompanyCustomerEvaluationFormFileVo;
|
||||
import com.ecep.contract.vo.CompanyCustomerFileVo;
|
||||
import com.ecep.contract.vo.CompanyCustomerVo;
|
||||
import com.ecep.contract.vo.CustomerFileVo;
|
||||
import com.ecep.contract.vo.CustomerVo;
|
||||
import com.ecep.contract.vo.CompanyVo;
|
||||
|
||||
import lombok.Setter;
|
||||
@@ -52,14 +52,14 @@ public class CompanyCustomerExportExcelTasker extends Tasker<Object> {
|
||||
@Setter
|
||||
File destFile;
|
||||
|
||||
CompanyCustomerService customerService;
|
||||
CustomerService customerService;
|
||||
CompanyCustomerEntityService customerEntityService;
|
||||
CompanyCustomerFileService customerFileService;
|
||||
CompanyCustomerEvaluationFormFileService customerEvaluationFormFileService;
|
||||
|
||||
CompanyCustomerService getCustomerService() {
|
||||
CustomerService getCustomerService() {
|
||||
if (customerService == null)
|
||||
customerService = getBean(CompanyCustomerService.class);
|
||||
customerService = getBean(CustomerService.class);
|
||||
return customerService;
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ public class CompanyCustomerExportExcelTasker extends Tasker<Object> {
|
||||
setCellValue(sheet, "A19", "Build by CMS @ " + MyDateTimeUtils.format(LocalDateTime.now()));
|
||||
|
||||
int rowIndex = 0;
|
||||
for (CompanyCustomerVo customer : getCustomerService().findAll(null, Pageable.unpaged())) {
|
||||
for (CustomerVo customer : getCustomerService().findAll(null, Pageable.unpaged())) {
|
||||
Integer companyId = customer.getCompanyId();
|
||||
;
|
||||
CompanyVo company = getCompanyService().findById(companyId);
|
||||
@@ -136,7 +136,7 @@ public class CompanyCustomerExportExcelTasker extends Tasker<Object> {
|
||||
}
|
||||
}
|
||||
|
||||
CompanyCustomerFileVo customerFile = getCustomerFileService()
|
||||
CustomerFileVo customerFile = getCustomerFileService()
|
||||
.findAllByCustomer(customer).stream().filter(v -> v.isValid())
|
||||
.max(Comparator.comparing(v -> v.getSignDate())).orElse(null);
|
||||
|
||||
|
||||
@@ -4,18 +4,18 @@ import com.ecep.contract.MyDateTimeUtils;
|
||||
import com.ecep.contract.controller.AbstEntityManagerSkin;
|
||||
import com.ecep.contract.controller.table.cell.CompanyTableCell;
|
||||
import com.ecep.contract.controller.table.cell.CustomerCatalogTableCell;
|
||||
import com.ecep.contract.service.CompanyCustomerService;
|
||||
import com.ecep.contract.service.CustomerService;
|
||||
import com.ecep.contract.service.CompanyService;
|
||||
import com.ecep.contract.service.CustomerCatalogService;
|
||||
import com.ecep.contract.vm.CompanyCustomerViewModel;
|
||||
import com.ecep.contract.vo.CompanyCustomerVo;
|
||||
import com.ecep.contract.vo.CustomerVo;
|
||||
import com.ecep.contract.vo.CompanyVo;
|
||||
|
||||
import javafx.application.Platform;
|
||||
|
||||
public class CompanyCustomerManagerSkin
|
||||
extends
|
||||
AbstEntityManagerSkin<CompanyCustomerVo, CompanyCustomerViewModel, CompanyCustomerManagerSkin, CompanyCustomerManagerWindowController> {
|
||||
AbstEntityManagerSkin<CustomerVo, CompanyCustomerViewModel, CompanyCustomerManagerSkin, CompanyCustomerManagerWindowController> {
|
||||
|
||||
public CompanyCustomerManagerSkin(CompanyCustomerManagerWindowController controller) {
|
||||
super(controller);
|
||||
@@ -25,7 +25,7 @@ public class CompanyCustomerManagerSkin
|
||||
return getBean(CompanyService.class);
|
||||
}
|
||||
|
||||
public CompanyCustomerService getCompanyCustomerService() {
|
||||
public CustomerService getCompanyCustomerService() {
|
||||
return controller.getViewModelService();
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import java.time.LocalDate;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import com.ecep.contract.vo.CompanyCustomerVo;
|
||||
import com.ecep.contract.vo.CustomerVo;
|
||||
import com.ecep.contract.vo.CompanyVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
@@ -17,7 +17,7 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import com.ecep.contract.MyDateTimeUtils;
|
||||
import com.ecep.contract.controller.AbstManagerWindowController;
|
||||
import com.ecep.contract.service.CompanyCustomerService;
|
||||
import com.ecep.contract.service.CustomerService;
|
||||
import com.ecep.contract.service.CompanyService;
|
||||
import com.ecep.contract.util.FxmlPath;
|
||||
import com.ecep.contract.util.UITools;
|
||||
@@ -44,7 +44,7 @@ import javafx.stage.Stage;
|
||||
@Component
|
||||
@FxmlPath("/ui/company/customer/customer_manager.fxml")
|
||||
public class CompanyCustomerManagerWindowController
|
||||
extends AbstManagerWindowController<CompanyCustomerVo, CompanyCustomerViewModel, CompanyCustomerManagerSkin> {
|
||||
extends AbstManagerWindowController<CustomerVo, CompanyCustomerViewModel, CompanyCustomerManagerSkin> {
|
||||
|
||||
// columns
|
||||
public TableColumn<CompanyCustomerViewModel, Number> idColumn;
|
||||
@@ -59,8 +59,8 @@ public class CompanyCustomerManagerWindowController
|
||||
|
||||
|
||||
@Override
|
||||
public CompanyCustomerService getViewModelService() {
|
||||
return getCachedBean(CompanyCustomerService.class);
|
||||
public CustomerService getViewModelService() {
|
||||
return getCachedBean(CustomerService.class);
|
||||
}
|
||||
|
||||
private CompanyService getCompanyService() {
|
||||
@@ -117,11 +117,11 @@ public class CompanyCustomerManagerWindowController
|
||||
CompletableFuture.runAsync(() -> {
|
||||
Pageable pageRequest = PageRequest.ofSize(50);
|
||||
while (!canceled.get()) {
|
||||
Page<CompanyCustomerVo> page = getViewModelService().findAll(null, pageRequest);
|
||||
Page<CustomerVo> page = getViewModelService().findAll(null, pageRequest);
|
||||
int index = page.getNumber() * page.getSize();
|
||||
|
||||
int i = 1;
|
||||
for (CompanyCustomerVo companyCustomer : page) {
|
||||
for (CustomerVo companyCustomer : page) {
|
||||
if (canceled.get()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -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.CompanyContactService;
|
||||
import com.ecep.contract.service.CompanyCustomerService;
|
||||
import com.ecep.contract.service.CustomerService;
|
||||
import com.ecep.contract.service.CompanyService;
|
||||
import com.ecep.contract.util.FxmlPath;
|
||||
import com.ecep.contract.vm.CompanyCustomerViewModel;
|
||||
import com.ecep.contract.vo.CompanyCustomerVo;
|
||||
import com.ecep.contract.vo.CustomerVo;
|
||||
import com.ecep.contract.vo.CompanyVo;
|
||||
|
||||
import javafx.event.ActionEvent;
|
||||
@@ -36,13 +36,13 @@ import javafx.stage.WindowEvent;
|
||||
@Scope("prototype")
|
||||
@Component
|
||||
@FxmlPath("/ui/company/customer/customer.fxml")
|
||||
public class CompanyCustomerWindowController extends AbstEntityController<CompanyCustomerVo, CompanyCustomerViewModel> {
|
||||
public class CompanyCustomerWindowController extends AbstEntityController<CustomerVo, CompanyCustomerViewModel> {
|
||||
private static final Logger logger = LoggerFactory.getLogger(CompanyCustomerWindowController.class);
|
||||
|
||||
/**
|
||||
* 显示界面
|
||||
*/
|
||||
public static void show(CompanyCustomerVo customer, Window window) {
|
||||
public static void show(CustomerVo customer, Window window) {
|
||||
show(CompanyCustomerWindowController.class, CompanyCustomerViewModel.from(customer), window);
|
||||
}
|
||||
|
||||
@@ -80,15 +80,15 @@ public class CompanyCustomerWindowController extends AbstEntityController<Compan
|
||||
|
||||
@Override
|
||||
protected void registerTabSkins() {
|
||||
registerTabSkin(baseInfoTab, tab -> new CompanyCustomerTabSkinBase(this));
|
||||
registerTabSkin(baseInfoTab, tab -> new CustomerTabSkinBase(this));
|
||||
registerTabSkin(fileTab, tab -> new CustomerTabSkinFile(this));
|
||||
registerTabSkin(entityTab, tab -> new CustomerTabSkinEntity(this));
|
||||
registerTabSkin(satisfactionTab, tab -> new CustomerTabSkinSatisfactionSurvey(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompanyCustomerService getViewModelService() {
|
||||
return getCachedBean(CompanyCustomerService.class);
|
||||
public CustomerService getViewModelService() {
|
||||
return getCachedBean(CustomerService.class);
|
||||
}
|
||||
|
||||
public CompanyService getCompanyService() {
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.ecep.contract.controller.customer;
|
||||
import java.io.File;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@@ -11,12 +12,16 @@ import com.ecep.contract.controller.company.CompanyWindowController;
|
||||
import com.ecep.contract.controller.tab.AbstEntityBasedTabSkin;
|
||||
import com.ecep.contract.controller.tab.TabSkin;
|
||||
import com.ecep.contract.service.CompanyContactService;
|
||||
import com.ecep.contract.service.CompanyCustomerService;
|
||||
import com.ecep.contract.service.CustomerService;
|
||||
import com.ecep.contract.service.CompanyService;
|
||||
import com.ecep.contract.service.QueryService;
|
||||
import com.ecep.contract.util.UITools;
|
||||
import com.ecep.contract.vm.CompanyContactViewModel;
|
||||
import com.ecep.contract.vm.CompanyCustomerViewModel;
|
||||
import com.ecep.contract.vo.CompanyCustomerVo;
|
||||
import com.ecep.contract.vo.CompanyContactVo;
|
||||
import com.ecep.contract.vo.CustomerVo;
|
||||
import com.ecep.contract.vo.CompanyVo;
|
||||
import com.ecep.contract.vo.VendorVo;
|
||||
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.beans.property.SimpleObjectProperty;
|
||||
@@ -24,13 +29,14 @@ import javafx.event.ActionEvent;
|
||||
import javafx.scene.control.Tab;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.stage.DirectoryChooser;
|
||||
import javafx.util.StringConverter;
|
||||
import javafx.util.converter.LocalDateStringConverter;
|
||||
|
||||
public class CompanyCustomerTabSkinBase
|
||||
extends AbstEntityBasedTabSkin<CompanyCustomerWindowController, CompanyCustomerVo, CompanyCustomerViewModel>
|
||||
public class CustomerTabSkinBase
|
||||
extends AbstEntityBasedTabSkin<CompanyCustomerWindowController, CustomerVo, CompanyCustomerViewModel>
|
||||
implements TabSkin {
|
||||
|
||||
public CompanyCustomerTabSkinBase(CompanyCustomerWindowController controller) {
|
||||
public CustomerTabSkinBase(CompanyCustomerWindowController controller) {
|
||||
super(controller);
|
||||
}
|
||||
|
||||
@@ -44,7 +50,25 @@ public class CompanyCustomerTabSkinBase
|
||||
initializeCompanyFieldAutoCompletion(controller.companyField);
|
||||
initializeContactFieldAutoCompletion(controller.contactField);
|
||||
|
||||
UITools.autoCompletion(controller.contactField, viewModel.getContact(), getCompanyContactService());
|
||||
UITools.autoCompletion(controller.contactField, viewModel.getContact(),
|
||||
new QueryService<CompanyContactVo, CompanyContactViewModel>() {
|
||||
@Override
|
||||
public CompanyContactVo findById(Integer id) {
|
||||
return getCompanyContactService().findById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CompanyContactVo> search(String searchText) {
|
||||
CustomerVo vendor = getEntity();
|
||||
CompanyVo company = controller.getCompanyService().findById(vendor.getCompanyId());
|
||||
return getCompanyContactService().searchByCompany(company, searchText);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StringConverter<CompanyContactVo> getStringConverter() {
|
||||
return getCompanyContactService().getStringConverter();
|
||||
}
|
||||
});
|
||||
|
||||
LocalDateStringConverter converter = new LocalDateStringConverter(DateTimeFormatter.ISO_LOCAL_DATE, null);
|
||||
|
||||
@@ -92,7 +116,7 @@ public class CompanyCustomerTabSkinBase
|
||||
}
|
||||
|
||||
public void onCompanyCustomerCreatePathAction(ActionEvent event) {
|
||||
CompanyCustomerVo companyCustomer = getCompanyCustomerService().findById(viewModel.getId().get());
|
||||
CustomerVo companyCustomer = getCompanyCustomerService().findById(viewModel.getId().get());
|
||||
if (getCompanyCustomerService().makePathAbsent(companyCustomer)) {
|
||||
companyCustomer = getCompanyCustomerService().save(companyCustomer);
|
||||
viewModel.update(companyCustomer);
|
||||
@@ -103,10 +127,10 @@ public class CompanyCustomerTabSkinBase
|
||||
|
||||
public void onCompanyCustomerChangePathAction(ActionEvent event) {
|
||||
DirectoryChooser chooser = new DirectoryChooser();
|
||||
CompanyCustomerVo entity = getEntity();
|
||||
CustomerVo entity = getEntity();
|
||||
String path = entity.getPath();
|
||||
File initialDirectory = null;
|
||||
|
||||
|
||||
// 如果当前已经设置了目录并且路径有效,则设置初始目录为该目录
|
||||
if (StringUtils.hasText(path)) {
|
||||
File dir = new File(path);
|
||||
@@ -114,16 +138,16 @@ public class CompanyCustomerTabSkinBase
|
||||
initialDirectory = dir;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 如果没有有效的初始目录,则使用基础路径
|
||||
if (initialDirectory == null) {
|
||||
initialDirectory = getCompanyCustomerService().getBasePath();
|
||||
}
|
||||
|
||||
|
||||
if (initialDirectory != null) {
|
||||
chooser.setInitialDirectory(initialDirectory);
|
||||
}
|
||||
|
||||
|
||||
File newDirectory = chooser.showDialog(getTab().getContent().getScene().getWindow());
|
||||
if (newDirectory != null) {
|
||||
entity.setPath(newDirectory.getAbsolutePath());
|
||||
@@ -135,8 +159,8 @@ public class CompanyCustomerTabSkinBase
|
||||
setStatus("未实现");
|
||||
}
|
||||
|
||||
public CompanyCustomerService getCompanyCustomerService() {
|
||||
return controller.getCachedBean(CompanyCustomerService.class);
|
||||
public CustomerService getCompanyCustomerService() {
|
||||
return controller.getCachedBean(CustomerService.class);
|
||||
}
|
||||
|
||||
public CompanyContactService getCompanyContactService() {
|
||||
@@ -12,7 +12,7 @@ import com.ecep.contract.util.FxmlPath;
|
||||
import com.ecep.contract.util.ParamUtils;
|
||||
import com.ecep.contract.vm.CustomerEntityViewModel;
|
||||
import com.ecep.contract.vo.CompanyCustomerEntityVo;
|
||||
import com.ecep.contract.vo.CompanyCustomerVo;
|
||||
import com.ecep.contract.vo.CustomerVo;
|
||||
|
||||
import javafx.scene.control.MenuItem;
|
||||
import javafx.scene.control.Tab;
|
||||
@@ -89,7 +89,7 @@ public class CustomerTabSkinEntity
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParamUtils.Builder getSpecification(CompanyCustomerVo parent) {
|
||||
public ParamUtils.Builder getSpecification(CustomerVo parent) {
|
||||
ParamUtils.Builder params = getSpecification();
|
||||
params.equals("customer", parent.getId());
|
||||
return params;
|
||||
|
||||
@@ -4,49 +4,40 @@ import java.io.File;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import com.ecep.contract.controller.table.cell.CompanyCustomerFileTableTypeTableCell;
|
||||
import com.ecep.contract.controller.table.cell.FilePathTableCell;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.ecep.contract.CustomerFileType;
|
||||
import com.ecep.contract.DesktopUtils;
|
||||
import com.ecep.contract.Message;
|
||||
import com.ecep.contract.MyDateTimeUtils;
|
||||
import com.ecep.contract.SpringApp;
|
||||
import com.ecep.contract.constant.CompanyCustomerConstant;
|
||||
import com.ecep.contract.controller.customer.tasker.CustomerEvaluationFormUpdateTask;
|
||||
import com.ecep.contract.controller.customer.tasker.CustomerNextSignDateTask;
|
||||
import com.ecep.contract.controller.table.EditableEntityTableTabSkin;
|
||||
import com.ecep.contract.model.BaseEnumEntity;
|
||||
import com.ecep.contract.controller.table.cell.CompanyCustomerFileTableTypeTableCell;
|
||||
import com.ecep.contract.controller.table.cell.FilePathTableCell;
|
||||
import com.ecep.contract.service.CompanyCustomerEvaluationFormFileService;
|
||||
import com.ecep.contract.service.CompanyCustomerFileService;
|
||||
import com.ecep.contract.service.CompanyCustomerFileTypeService;
|
||||
import com.ecep.contract.service.CompanyCustomerService;
|
||||
import com.ecep.contract.service.CompanyService;
|
||||
import com.ecep.contract.service.CustomerService;
|
||||
import com.ecep.contract.task.CustomerFileMoveTasker;
|
||||
import com.ecep.contract.util.FileUtils;
|
||||
import com.ecep.contract.util.FxmlPath;
|
||||
import com.ecep.contract.util.ParamUtils;
|
||||
import com.ecep.contract.util.UITools;
|
||||
import com.ecep.contract.vm.CompanyCustomerFileViewModel;
|
||||
import com.ecep.contract.vm.CustomerFileViewModel;
|
||||
import com.ecep.contract.vo.CompanyCustomerEvaluationFormFileVo;
|
||||
import com.ecep.contract.vo.CompanyCustomerFileVo;
|
||||
import com.ecep.contract.vo.CompanyCustomerVo;
|
||||
import com.ecep.contract.vo.CustomerFileVo;
|
||||
import com.ecep.contract.vo.CompanyVo;
|
||||
import com.ecep.contract.vo.CustomerFileTypeLocalVo;
|
||||
import com.ecep.contract.vo.CustomerVo;
|
||||
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableMap;
|
||||
import javafx.concurrent.Task;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.ButtonType;
|
||||
import javafx.scene.control.MenuItem;
|
||||
import javafx.scene.control.Tab;
|
||||
import javafx.scene.control.TableCell;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.cell.CheckBoxTableCell;
|
||||
@@ -56,19 +47,19 @@ import lombok.Setter;
|
||||
|
||||
@FxmlPath("/ui/company/customer/customer-tab-file.fxml")
|
||||
public class CustomerTabSkinFile
|
||||
extends AbstCompanyCustomerTableTabSkin<CompanyCustomerFileVo, CompanyCustomerFileViewModel>
|
||||
implements EditableEntityTableTabSkin<CompanyCustomerFileVo, CompanyCustomerFileViewModel> {
|
||||
extends AbstCompanyCustomerTableTabSkin<CustomerFileVo, CustomerFileViewModel>
|
||||
implements EditableEntityTableTabSkin<CustomerFileVo, CustomerFileViewModel> {
|
||||
|
||||
@Setter
|
||||
private CompanyCustomerFileService companyCustomerFileService;
|
||||
|
||||
public TableColumn<CompanyCustomerFileViewModel, Number> fileTable_idColumn;
|
||||
public TableColumn<CompanyCustomerFileViewModel, CustomerFileType> fileTable_typeColumn;
|
||||
public TableColumn<CompanyCustomerFileViewModel, String> fileTable_filePathColumn;
|
||||
public TableColumn<CompanyCustomerFileViewModel, String> fileTable_editFilePathColumn;
|
||||
public TableColumn<CompanyCustomerFileViewModel, LocalDate> fileTable_signDateColumn;
|
||||
public TableColumn<CompanyCustomerFileViewModel, Boolean> fileTable_validColumn;
|
||||
public TableColumn<CompanyCustomerFileViewModel, String> fileTable_descriptionColumn;
|
||||
public TableColumn<CustomerFileViewModel, Number> fileTable_idColumn;
|
||||
public TableColumn<CustomerFileViewModel, CustomerFileType> fileTable_typeColumn;
|
||||
public TableColumn<CustomerFileViewModel, String> fileTable_filePathColumn;
|
||||
public TableColumn<CustomerFileViewModel, String> fileTable_editFilePathColumn;
|
||||
public TableColumn<CustomerFileViewModel, LocalDate> fileTable_signDateColumn;
|
||||
public TableColumn<CustomerFileViewModel, Boolean> fileTable_validColumn;
|
||||
public TableColumn<CustomerFileViewModel, String> fileTable_descriptionColumn;
|
||||
|
||||
public Button fileTable_reBuildBtn;
|
||||
public Button fileTable_updateEvaluationFormBuildBtn;
|
||||
@@ -99,7 +90,7 @@ public class CustomerTabSkinFile
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParamUtils.Builder getSpecification(CompanyCustomerVo parent) {
|
||||
public ParamUtils.Builder getSpecification(CustomerVo parent) {
|
||||
ParamUtils.Builder params = getSpecification();
|
||||
params.equals("customer", parent.getId());
|
||||
return params;
|
||||
@@ -109,7 +100,7 @@ public class CustomerTabSkinFile
|
||||
public void initializeTable() {
|
||||
super.initializeTable();
|
||||
|
||||
TableView<CompanyCustomerFileViewModel> table = getTableView();
|
||||
TableView<CustomerFileViewModel> table = getTableView();
|
||||
|
||||
table.disableProperty().bind(viewModel.getPath().isEmpty());
|
||||
fileTable_idColumn.setCellValueFactory(param -> param.getValue().getId());
|
||||
@@ -163,7 +154,7 @@ public class CustomerTabSkinFile
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onTableRowDoubleClickedAction(CompanyCustomerFileViewModel item) {
|
||||
protected void onTableRowDoubleClickedAction(CustomerFileViewModel item) {
|
||||
CustomerFileType fileType = item.getType().get();
|
||||
if (fileType == CustomerFileType.EvaluationForm) {
|
||||
|
||||
@@ -196,7 +187,7 @@ public class CustomerTabSkinFile
|
||||
setStatus("目录错误,不存在");
|
||||
return;
|
||||
}
|
||||
CompanyCustomerVo companyCustomer = getParent();
|
||||
CustomerVo companyCustomer = getParent();
|
||||
LocalDate nextSignDate = getCompanyCustomerFileService().getNextSignDate(companyCustomer,
|
||||
((level, message) -> setStatus(message)));
|
||||
if (nextSignDate != null && files.size() == 1) {
|
||||
@@ -208,15 +199,15 @@ public class CustomerTabSkinFile
|
||||
+ "." + StringUtils.getFilenameExtension(fileName);
|
||||
File dest = new File(dir, destFileName);
|
||||
if (file.renameTo(dest)) {
|
||||
CompanyCustomerFileVo ccf = new CompanyCustomerFileVo();
|
||||
CustomerFileVo ccf = new CustomerFileVo();
|
||||
ccf.setCustomer(companyCustomer.getId());
|
||||
ccf.setType(CustomerFileType.EvaluationForm);
|
||||
ccf.setFilePath(dest.getAbsolutePath());
|
||||
ccf.setSignDate(nextSignDate);
|
||||
ccf.setValid(false);
|
||||
CompanyCustomerFileVo saved = getCompanyCustomerFileService().save(ccf);
|
||||
CustomerFileVo saved = getCompanyCustomerFileService().save(ccf);
|
||||
Platform.runLater(() -> {
|
||||
CompanyCustomerFileViewModel model = new CompanyCustomerFileViewModel();
|
||||
CustomerFileViewModel model = new CustomerFileViewModel();
|
||||
model.update(saved);
|
||||
dataSet.add(model);
|
||||
|
||||
@@ -235,7 +226,7 @@ public class CustomerTabSkinFile
|
||||
for (File file : files) {
|
||||
File dest = new File(dir, file.getName());
|
||||
if (file.renameTo(dest)) {
|
||||
CompanyCustomerFileVo ccf = new CompanyCustomerFileVo();
|
||||
CustomerFileVo ccf = new CustomerFileVo();
|
||||
ccf.setCustomer(companyCustomer.getId());
|
||||
ccf.setType(CustomerFileType.General);
|
||||
ccf.setFilePath(dest.getAbsolutePath());
|
||||
@@ -248,9 +239,9 @@ public class CustomerTabSkinFile
|
||||
|
||||
public void onFileReBuildingAction(ActionEvent event) {
|
||||
|
||||
CompanyCustomerService customerService = getCompanyCustomerService();
|
||||
CustomerService customerService = getCompanyCustomerService();
|
||||
try {
|
||||
CompanyCustomerVo companyCustomer = customerService.findById(viewModel.getId().get());
|
||||
CustomerVo companyCustomer = customerService.findById(viewModel.getId().get());
|
||||
if (customerService.reBuildingFiles(companyCustomer, (level, message) -> setStatus(message))) {
|
||||
loadTableDataSet();
|
||||
}
|
||||
@@ -260,7 +251,7 @@ public class CustomerTabSkinFile
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean deleteRow(CompanyCustomerFileViewModel row) {
|
||||
protected boolean deleteRow(CustomerFileViewModel row) {
|
||||
String path = row.getFilePath().get();
|
||||
if (super.deleteRow(row)) {
|
||||
File file = new File(path);
|
||||
@@ -280,7 +271,7 @@ public class CustomerTabSkinFile
|
||||
}
|
||||
|
||||
public void onFileTableMoveToCompanyPathAction(ActionEvent event) {
|
||||
CompanyCustomerFileViewModel selectedItem = getSelectedItem();
|
||||
CustomerFileViewModel selectedItem = getSelectedItem();
|
||||
if (selectedItem == null) {
|
||||
return;
|
||||
}
|
||||
@@ -309,46 +300,17 @@ public class CustomerTabSkinFile
|
||||
loadTableDataSet();
|
||||
}
|
||||
|
||||
private void initializeTask(Task<Object> task, String prefix, Consumer<String> consumer) {
|
||||
task.setOnScheduled(e -> {
|
||||
consumer.accept("正在" + prefix + ",请稍后...");
|
||||
});
|
||||
task.setOnRunning(e -> {
|
||||
consumer.accept("开始" + prefix + "...");
|
||||
});
|
||||
task.setOnSucceeded(e -> {
|
||||
consumer.accept(prefix + "同步完成...");
|
||||
});
|
||||
task.exceptionProperty().addListener((observable, oldValue, newValue) -> {
|
||||
consumer.accept(newValue.getMessage());
|
||||
});
|
||||
SpringApp.getBean(ScheduledExecutorService.class).submit(task);
|
||||
consumer.accept("任务已创建...");
|
||||
}
|
||||
|
||||
public void onUpdateEvaluationFormAction(ActionEvent event) {
|
||||
CompanyCustomerEvaluationFormUpdateTask task = new CompanyCustomerEvaluationFormUpdateTask();
|
||||
CustomerEvaluationFormUpdateTask task = new CustomerEvaluationFormUpdateTask();
|
||||
task.setCustomer(getCompanyCustomerService().findById(viewModel.getId().get()));
|
||||
UITools.showTaskDialogAndWait("更新评价表", task, consumer -> {
|
||||
initializeTask(task, "更新评价表", msg -> consumer.accept(Message.info(msg)));
|
||||
});
|
||||
UITools.showTaskDialogAndWait("更新评价表", task, null);
|
||||
loadTableDataSet();
|
||||
}
|
||||
|
||||
public void onCalcNextSignDateAction(ActionEvent event) {
|
||||
UITools.showDialogAndWait("计算客户下一个评价日期", "依据已有的客户评估表和登记采购的合同计算下一个评估日期", ds -> {
|
||||
CompanyCustomerVo companyCustomer = getCompanyCustomerService().findById(viewModel.getId().get());
|
||||
LocalDate nextSignDate = getCompanyCustomerFileService().getNextSignDate(companyCustomer, (level, msg) -> {
|
||||
Platform.runLater(() -> {
|
||||
ds.add(msg);
|
||||
});
|
||||
});
|
||||
if (nextSignDate != null) {
|
||||
Platform.runLater(() -> {
|
||||
ds.add("下一个评价日期:" + nextSignDate);
|
||||
});
|
||||
}
|
||||
});
|
||||
CustomerNextSignDateTask task = new CustomerNextSignDateTask();
|
||||
task.setCustomer(getEntity());
|
||||
UITools.showTaskDialogAndWait("计算客户的下一个评价日期", task, null);
|
||||
}
|
||||
|
||||
private CompanyCustomerFileService getCompanyCustomerFileService() {
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.ecep.contract.controller.project.satisfaction_survey.CustomerSatisfac
|
||||
import com.ecep.contract.controller.table.cell.EmployeeTableCell;
|
||||
import com.ecep.contract.controller.table.cell.ProjectTableCell;
|
||||
import com.ecep.contract.converter.EntityStringConverter;
|
||||
import com.ecep.contract.vo.CompanyCustomerVo;
|
||||
import com.ecep.contract.vo.CustomerVo;
|
||||
import com.ecep.contract.vo.CustomerCatalogVo;
|
||||
import com.ecep.contract.vo.CustomerSatisfactionSurveyVo;
|
||||
import com.ecep.contract.vo.EmployeeVo;
|
||||
@@ -96,7 +96,7 @@ public class CustomerTabSkinSatisfactionSurvey
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParamUtils.Builder getSpecification(CompanyCustomerVo parent) {
|
||||
public ParamUtils.Builder getSpecification(CustomerVo parent) {
|
||||
ParamUtils.Builder params = getSpecification();
|
||||
params.equals("project.customer", parent.getId());
|
||||
return params;
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
package com.ecep.contract.controller.customer;
|
||||
package com.ecep.contract.controller.customer.tasker;
|
||||
|
||||
import com.ecep.contract.MessageHolder;
|
||||
import com.ecep.contract.WebSocketClientTasker;
|
||||
import com.ecep.contract.task.Tasker;
|
||||
import com.ecep.contract.vo.CompanyCustomerVo;
|
||||
import com.ecep.contract.vo.CustomerVo;
|
||||
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* 客户评估表更新任务
|
||||
*/
|
||||
public class CompanyCustomerEvaluationFormUpdateTask extends Tasker<Object> implements WebSocketClientTasker {
|
||||
public class CustomerEvaluationFormUpdateTask extends Tasker<Object> implements WebSocketClientTasker {
|
||||
@Setter
|
||||
private CompanyCustomerVo customer;
|
||||
private CustomerVo customer;
|
||||
|
||||
@Override
|
||||
public String getTaskName() {
|
||||
return getClass().getSimpleName();
|
||||
return "CustomerEvaluationFormUpdateTask";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.ecep.contract.controller.customer;
|
||||
package com.ecep.contract.controller.customer.tasker;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -6,19 +6,19 @@ import org.slf4j.LoggerFactory;
|
||||
import com.ecep.contract.MessageHolder;
|
||||
import com.ecep.contract.WebSocketClientTasker;
|
||||
import com.ecep.contract.task.Tasker;
|
||||
import com.ecep.contract.vo.CompanyCustomerVo;
|
||||
import com.ecep.contract.vo.CustomerVo;
|
||||
|
||||
import lombok.Setter;
|
||||
|
||||
public class CompanyCustomerNextSignDateTask extends Tasker<Object> implements WebSocketClientTasker {
|
||||
private static final Logger logger = LoggerFactory.getLogger(CompanyCustomerNextSignDateTask.class);
|
||||
public class CustomerNextSignDateTask extends Tasker<Object> implements WebSocketClientTasker {
|
||||
private static final Logger logger = LoggerFactory.getLogger(CustomerNextSignDateTask.class);
|
||||
|
||||
@Setter
|
||||
private CompanyCustomerVo customer;
|
||||
private CustomerVo customer;
|
||||
|
||||
@Override
|
||||
public String getTaskName() {
|
||||
return getClass().getSimpleName();
|
||||
return "CustomerNextSignDateTask";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1,8 +1,9 @@
|
||||
package com.ecep.contract.task;
|
||||
package com.ecep.contract.controller.customer.tasker;
|
||||
|
||||
import com.ecep.contract.MessageHolder;
|
||||
import com.ecep.contract.WebSocketClientTasker;
|
||||
import com.ecep.contract.vo.CompanyCustomerVo;
|
||||
import com.ecep.contract.task.Tasker;
|
||||
import com.ecep.contract.vo.CustomerVo;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -11,10 +12,10 @@ import lombok.Setter;
|
||||
* 客户文件重建任务类
|
||||
* 用于通过WebSocket与服务器通信,重建客户相关文件
|
||||
*/
|
||||
public class CompanyCustomerRebuildFilesTasker extends Tasker<Object> implements WebSocketClientTasker {
|
||||
public class CustomerRebuildFilesTasker extends Tasker<Object> implements WebSocketClientTasker {
|
||||
@Getter
|
||||
@Setter
|
||||
private CompanyCustomerVo companyCustomer;
|
||||
private CustomerVo companyCustomer;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@@ -22,7 +23,7 @@ public class CompanyCustomerRebuildFilesTasker extends Tasker<Object> implements
|
||||
|
||||
@Override
|
||||
public String getTaskName() {
|
||||
return "CompanyCustomerRebuildFilesTasker";
|
||||
return "CustomerRebuildFilesTasker";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -13,7 +13,7 @@ import com.ecep.contract.controller.table.cell.EmployeeTableCell;
|
||||
import com.ecep.contract.converter.CompanyStringConverter;
|
||||
import com.ecep.contract.converter.EmployeeStringConverter;
|
||||
import com.ecep.contract.service.CompanyCustomerFileService;
|
||||
import com.ecep.contract.service.CompanyCustomerService;
|
||||
import com.ecep.contract.service.CustomerService;
|
||||
import com.ecep.contract.service.CompanyService;
|
||||
import com.ecep.contract.service.ProjectBidService;
|
||||
import com.ecep.contract.util.FxmlPath;
|
||||
@@ -56,7 +56,7 @@ public class ProjectTabSkinBid
|
||||
@Setter
|
||||
private CompanyService companyService;
|
||||
@Setter
|
||||
private CompanyCustomerService customerService;
|
||||
private CustomerService customerService;
|
||||
@Setter
|
||||
private CompanyCustomerFileService customerFileService;
|
||||
|
||||
@@ -163,9 +163,9 @@ public class ProjectTabSkinBid
|
||||
return companyStringConverter;
|
||||
}
|
||||
|
||||
private CompanyCustomerService getCompanyCustomerService() {
|
||||
private CustomerService getCompanyCustomerService() {
|
||||
if (customerService == null) {
|
||||
customerService = getBean(CompanyCustomerService.class);
|
||||
customerService = getBean(CustomerService.class);
|
||||
}
|
||||
return customerService;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import com.ecep.contract.controller.table.cell.EmployeeTableCell;
|
||||
import com.ecep.contract.converter.CompanyStringConverter;
|
||||
import com.ecep.contract.converter.EmployeeStringConverter;
|
||||
import com.ecep.contract.service.CompanyCustomerFileService;
|
||||
import com.ecep.contract.service.CompanyCustomerService;
|
||||
import com.ecep.contract.service.CustomerService;
|
||||
import com.ecep.contract.service.CompanyService;
|
||||
import com.ecep.contract.service.CustomerSatisfactionSurveyService;
|
||||
import com.ecep.contract.util.FxmlPath;
|
||||
@@ -52,7 +52,7 @@ public class ProjectTabSkinCustomerSatisfactionSurvey
|
||||
@Setter
|
||||
private CompanyService companyService;
|
||||
@Setter
|
||||
private CompanyCustomerService customerService;
|
||||
private CustomerService customerService;
|
||||
@Setter
|
||||
private CompanyCustomerFileService customerFileService;
|
||||
|
||||
@@ -141,9 +141,9 @@ public class ProjectTabSkinCustomerSatisfactionSurvey
|
||||
return companyStringConverter;
|
||||
}
|
||||
|
||||
private CompanyCustomerService getCompanyCustomerService() {
|
||||
private CustomerService getCompanyCustomerService() {
|
||||
if (customerService == null) {
|
||||
customerService = getBean(CompanyCustomerService.class);
|
||||
customerService = getBean(CustomerService.class);
|
||||
}
|
||||
return customerService;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import com.ecep.contract.controller.table.cell.LocalDateTimeTableCell;
|
||||
import com.ecep.contract.converter.CompanyStringConverter;
|
||||
import com.ecep.contract.converter.EmployeeStringConverter;
|
||||
import com.ecep.contract.service.CompanyCustomerFileService;
|
||||
import com.ecep.contract.service.CompanyCustomerService;
|
||||
import com.ecep.contract.service.CustomerService;
|
||||
import com.ecep.contract.service.CompanyService;
|
||||
import com.ecep.contract.service.ProjectQuotationService;
|
||||
import com.ecep.contract.util.FxmlPath;
|
||||
@@ -69,7 +69,7 @@ public class ProjectTabSkinQuotation
|
||||
@Setter
|
||||
private CompanyService companyService;
|
||||
@Setter
|
||||
private CompanyCustomerService customerService;
|
||||
private CustomerService customerService;
|
||||
@Setter
|
||||
private CompanyCustomerFileService customerFileService;
|
||||
|
||||
@@ -174,9 +174,9 @@ public class ProjectTabSkinQuotation
|
||||
return companyStringConverter;
|
||||
}
|
||||
|
||||
private CompanyCustomerService getCompanyCustomerService() {
|
||||
private CustomerService getCompanyCustomerService() {
|
||||
if (customerService == null) {
|
||||
customerService = getBean(CompanyCustomerService.class);
|
||||
customerService = getBean(CustomerService.class);
|
||||
}
|
||||
return customerService;
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ public class ProjectBidTabSkinBase
|
||||
@Setter
|
||||
private CompanyService companyService;
|
||||
@Setter
|
||||
private CompanyCustomerService customerService;
|
||||
private CustomerService customerService;
|
||||
@Setter
|
||||
private CompanyCustomerFileService customerFileService;
|
||||
@Setter
|
||||
@@ -266,7 +266,7 @@ public class ProjectBidTabSkinBase
|
||||
}
|
||||
Integer companyId = project.getCustomerId();
|
||||
CompanyVo company = getCompanyService().findById(companyId);
|
||||
CompanyCustomerVo customer = getCompanyCustomerService().findByCompany(company);
|
||||
CustomerVo customer = getCompanyCustomerService().findByCompany(company);
|
||||
if (customer == null) {
|
||||
// 没有对应的客户
|
||||
return;
|
||||
@@ -275,7 +275,7 @@ public class ProjectBidTabSkinBase
|
||||
CompanyCustomerFileService fileService = getBean(CompanyCustomerFileService.class);
|
||||
|
||||
// 获取客户资信评估表
|
||||
List<CompanyCustomerFileVo> list = fileService.findAllByCustomerAndType(customer,
|
||||
List<CustomerFileVo> list = fileService.findAllByCustomerAndType(customer,
|
||||
CustomerFileType.EvaluationForm);
|
||||
if (list.isEmpty()) {
|
||||
// 没有评估表
|
||||
@@ -285,7 +285,7 @@ public class ProjectBidTabSkinBase
|
||||
// 在时间范围内是否有评估表
|
||||
LocalDateTime applyTime = getViewModel().getApplyTime().get();
|
||||
LocalDate verifyDate = applyTime.toLocalDate();
|
||||
CompanyCustomerFileVo file = list.stream()
|
||||
CustomerFileVo file = list.stream()
|
||||
.filter(v -> v.getSignDate() != null && v.isValid())
|
||||
.filter(v -> v.getType() == CustomerFileType.EvaluationForm)
|
||||
.filter(v -> MyDateTimeUtils.dateValidFilter(verifyDate, v.getSignDate(), v.getSignDate().plusYears(1),
|
||||
@@ -423,9 +423,9 @@ public class ProjectBidTabSkinBase
|
||||
return companyStringConverter;
|
||||
}
|
||||
|
||||
private CompanyCustomerService getCompanyCustomerService() {
|
||||
private CustomerService getCompanyCustomerService() {
|
||||
if (customerService == null) {
|
||||
customerService = getBean(CompanyCustomerService.class);
|
||||
customerService = getBean(CustomerService.class);
|
||||
}
|
||||
return customerService;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import com.ecep.contract.converter.EmployeeStringConverter;
|
||||
import com.ecep.contract.model.Employee;
|
||||
import com.ecep.contract.service.CompanyCustomerEvaluationFormFileService;
|
||||
import com.ecep.contract.service.CompanyCustomerFileService;
|
||||
import com.ecep.contract.service.CompanyCustomerService;
|
||||
import com.ecep.contract.service.CustomerService;
|
||||
import com.ecep.contract.service.CompanyService;
|
||||
import com.ecep.contract.service.ProjectQuotationService;
|
||||
import com.ecep.contract.service.ProjectService;
|
||||
@@ -54,7 +54,7 @@ public class ProjectQuotationTabSkinBase
|
||||
@Setter
|
||||
private CompanyService companyService;
|
||||
@Setter
|
||||
private CompanyCustomerService customerService;
|
||||
private CustomerService customerService;
|
||||
@Setter
|
||||
private CompanyCustomerFileService customerFileService;
|
||||
@Setter
|
||||
@@ -244,8 +244,8 @@ public class ProjectQuotationTabSkinBase
|
||||
return getBean(CompanyStringConverter.class);
|
||||
}
|
||||
|
||||
private CompanyCustomerService getCompanyCustomerService() {
|
||||
return getBean(CompanyCustomerService.class);
|
||||
private CustomerService getCompanyCustomerService() {
|
||||
return getBean(CustomerService.class);
|
||||
}
|
||||
|
||||
private CompanyCustomerFileService getCompanyCustomerFileService() {
|
||||
|
||||
@@ -18,7 +18,7 @@ import com.ecep.contract.converter.CompanyStringConverter;
|
||||
import com.ecep.contract.converter.EmployeeStringConverter;
|
||||
import com.ecep.contract.service.CompanyCustomerEvaluationFormFileService;
|
||||
import com.ecep.contract.service.CompanyCustomerFileService;
|
||||
import com.ecep.contract.service.CompanyCustomerService;
|
||||
import com.ecep.contract.service.CustomerService;
|
||||
import com.ecep.contract.service.CompanyService;
|
||||
import com.ecep.contract.service.ProjectCostService;
|
||||
import com.ecep.contract.service.ProjectQuotationService;
|
||||
@@ -27,8 +27,8 @@ import com.ecep.contract.util.ProxyUtils;
|
||||
import com.ecep.contract.util.UITools;
|
||||
import com.ecep.contract.vm.CustomerSatisfactionSurveyViewModel;
|
||||
import com.ecep.contract.vo.CompanyCustomerEvaluationFormFileVo;
|
||||
import com.ecep.contract.vo.CompanyCustomerFileVo;
|
||||
import com.ecep.contract.vo.CompanyCustomerVo;
|
||||
import com.ecep.contract.vo.CustomerFileVo;
|
||||
import com.ecep.contract.vo.CustomerVo;
|
||||
import com.ecep.contract.vo.CompanyVo;
|
||||
import com.ecep.contract.vo.CustomerSatisfactionSurveyVo;
|
||||
import com.ecep.contract.vo.ProjectVo;
|
||||
@@ -64,7 +64,7 @@ public class CustomerSatisfactionSurveyTabSkinBase
|
||||
@Setter
|
||||
private CompanyService companyService;
|
||||
@Setter
|
||||
private CompanyCustomerService customerService;
|
||||
private CustomerService customerService;
|
||||
@Setter
|
||||
private CompanyCustomerFileService customerFileService;
|
||||
@Setter
|
||||
@@ -228,13 +228,13 @@ public class CustomerSatisfactionSurveyTabSkinBase
|
||||
}
|
||||
Integer companyId = project.getCustomerId();
|
||||
CompanyVo company = getCompanyService().findById(companyId);
|
||||
CompanyCustomerVo customer = getCompanyCustomerService().findByCompany(company);
|
||||
CustomerVo customer = getCompanyCustomerService().findByCompany(company);
|
||||
if (customer == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
CompanyCustomerFileService companyCustomerFileService = getBean(CompanyCustomerFileService.class);
|
||||
List<CompanyCustomerFileVo> list = companyCustomerFileService.findAllByCustomerAndType(customer,
|
||||
List<CustomerFileVo> list = companyCustomerFileService.findAllByCustomerAndType(customer,
|
||||
CustomerFileType.EvaluationForm);
|
||||
if (list.isEmpty()) {
|
||||
return;
|
||||
@@ -242,7 +242,7 @@ public class CustomerSatisfactionSurveyTabSkinBase
|
||||
|
||||
LocalDateTime applyTime = getViewModel().getApplyTime().get();
|
||||
LocalDate verifyDate = applyTime.toLocalDate();
|
||||
CompanyCustomerFileVo file = list.stream()
|
||||
CustomerFileVo file = list.stream()
|
||||
.filter(v -> v.getSignDate() != null && v.isValid())
|
||||
.filter(v -> v.getType() == CustomerFileType.EvaluationForm)
|
||||
.filter(v -> MyDateTimeUtils.dateValidFilter(verifyDate, v.getSignDate(), v.getSignDate().plusYears(1),
|
||||
@@ -314,9 +314,9 @@ public class CustomerSatisfactionSurveyTabSkinBase
|
||||
return companyStringConverter;
|
||||
}
|
||||
|
||||
private CompanyCustomerService getCompanyCustomerService() {
|
||||
private CustomerService getCompanyCustomerService() {
|
||||
if (customerService == null) {
|
||||
customerService = getBean(CompanyCustomerService.class);
|
||||
customerService = getBean(CustomerService.class);
|
||||
}
|
||||
return customerService;
|
||||
}
|
||||
|
||||
@@ -16,8 +16,8 @@ import com.ecep.contract.constant.CloudServiceConstant;
|
||||
import com.ecep.contract.controller.company.AbstCompanyTableTabSkin;
|
||||
import com.ecep.contract.controller.company.CompanyWindowController;
|
||||
import com.ecep.contract.controller.table.EditableEntityTableTabSkin;
|
||||
import com.ecep.contract.controller.table.cell.CompanyFilePathTableCell;
|
||||
import com.ecep.contract.controller.table.cell.CompanyFileTypeTableCell;
|
||||
import com.ecep.contract.controller.table.cell.FilePathTableCell;
|
||||
import com.ecep.contract.service.CloudTycService;
|
||||
import com.ecep.contract.service.CompanyFileService;
|
||||
import com.ecep.contract.service.CompanyFileTypeService;
|
||||
@@ -92,7 +92,7 @@ public class CompanyTabSkinFile
|
||||
typeColumn.setCellFactory(CompanyFileTypeTableCell.forTableColumn(getCachedBean(CompanyFileTypeService.class)));
|
||||
|
||||
filePathColumn.setCellValueFactory(param -> param.getValue().getFilePath());
|
||||
filePathColumn.setCellFactory(param -> new CompanyFilePathTableCell<>(viewModel.getPath()));
|
||||
filePathColumn.setCellFactory(FilePathTableCell.forTableColumn(viewModel.getPath()));
|
||||
|
||||
applyDateColumn.setCellValueFactory(param -> param.getValue().getApplyDate());
|
||||
expiringDateColumn.setCellValueFactory(param -> param.getValue().getExpiringDate());
|
||||
|
||||
@@ -23,7 +23,7 @@ import com.ecep.contract.controller.vendor.VendorWindowController;
|
||||
import com.ecep.contract.converter.ContractStringConverter;
|
||||
import com.ecep.contract.service.VendorService;
|
||||
import com.ecep.contract.util.UITools;
|
||||
import com.ecep.contract.vo.CompanyCustomerVo;
|
||||
import com.ecep.contract.vo.CustomerVo;
|
||||
import com.ecep.contract.vo.VendorVo;
|
||||
import com.ecep.contract.vo.CompanyVo;
|
||||
import com.ecep.contract.vo.ContractTypeVo;
|
||||
@@ -445,7 +445,7 @@ public class ContractTabSkinBase extends AbstContractBasedTabSkin {
|
||||
public void onContractOpenRelativeCompanyCustomerAction(ActionEvent event) {
|
||||
ContractVo contract = getEntity();
|
||||
CompanyVo company = controller.getCompanyService().findById(contract.getCompanyId());
|
||||
CompanyCustomerVo companyCustomer = getCompanyCustomerService().findByCompany(company);
|
||||
CustomerVo companyCustomer = getCompanyCustomerService().findByCompany(company);
|
||||
CompanyCustomerWindowController.show(companyCustomer, null);
|
||||
}
|
||||
|
||||
@@ -465,8 +465,8 @@ public class ContractTabSkinBase extends AbstContractBasedTabSkin {
|
||||
UITools.autoCompletion(textField, viewModel.getProject(), getProjectService());
|
||||
}
|
||||
|
||||
public CompanyCustomerService getCompanyCustomerService() {
|
||||
return getCachedBean(CompanyCustomerService.class);
|
||||
public CustomerService getCompanyCustomerService() {
|
||||
return getCachedBean(CustomerService.class);
|
||||
}
|
||||
|
||||
public ProjectService getProjectService() {
|
||||
|
||||
@@ -150,8 +150,8 @@ public class ContractUpdater implements MessageHolder {
|
||||
return getBean(VendorService.class);
|
||||
}
|
||||
|
||||
private CompanyCustomerService getCustomerService() {
|
||||
return getBean(CompanyCustomerService.class);
|
||||
private CustomerService getCustomerService() {
|
||||
return getBean(CustomerService.class);
|
||||
}
|
||||
|
||||
private CompanyService getCompanyService() {
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
package com.ecep.contract.controller.table.cell;
|
||||
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import javafx.scene.control.TableCell;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class CompanyFilePathTableCell<T> extends TableCell<T, String> {
|
||||
private SimpleStringProperty companyPathProperty;
|
||||
|
||||
public void setCompanyPathProperty(SimpleStringProperty property) {
|
||||
this.companyPathProperty = property;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateItem(String item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
if (empty || item == null) {
|
||||
setText("");
|
||||
return;
|
||||
}
|
||||
if (companyPathProperty != null) {
|
||||
String path = companyPathProperty.get();
|
||||
if (StringUtils.hasText(path)) {
|
||||
if (item.startsWith(path)) {
|
||||
item = "~" + item.substring(path.length());
|
||||
}
|
||||
}
|
||||
}
|
||||
setText(item);
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ import com.ecep.contract.SpringApp;
|
||||
import com.ecep.contract.service.CompanyCustomerEvaluationFormFileService;
|
||||
import com.ecep.contract.service.CompanyCustomerFileService;
|
||||
import com.ecep.contract.vo.CompanyCustomerEvaluationFormFileVo;
|
||||
import com.ecep.contract.vo.CompanyCustomerFileVo;
|
||||
import com.ecep.contract.vo.CustomerFileVo;
|
||||
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@@ -49,7 +49,7 @@ public class EvaluationFileTableCell<V> extends AsyncUpdateTableCell<V, Integer,
|
||||
if (vo == null || vo.getCustomerFile() == null) {
|
||||
return super.format(vo);
|
||||
}
|
||||
CompanyCustomerFileVo customerFile = getFileService().findById(vo.getCustomerFile());
|
||||
CustomerFileVo customerFile = getFileService().findById(vo.getCustomerFile());
|
||||
String path = customerFile.getFilePath();
|
||||
if (StringUtils.hasText(path)) {
|
||||
File file = new File(path);
|
||||
|
||||
@@ -6,20 +6,26 @@ import javafx.scene.control.TableColumn;
|
||||
import javafx.util.Callback;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* 文件路径单元格
|
||||
* 用于显示文件路径,根据根路径截取相对路径
|
||||
* 若文件路径以根路径开头,则截取相对路径,否则显示完整路径
|
||||
* 若根路径为空,则显示完整路径
|
||||
*/
|
||||
public class FilePathTableCell<V> extends TableCell<V, String> {
|
||||
|
||||
private StringProperty path;
|
||||
private StringProperty rootPathProperty;
|
||||
|
||||
/**
|
||||
* 创建一个用于表格列的单元格工厂
|
||||
*/
|
||||
public static <T> Callback<TableColumn<T, String>, TableCell<T, String>> forTableColumn(
|
||||
StringProperty parentPath) {
|
||||
return param -> new FilePathTableCell<>(parentPath);
|
||||
StringProperty rootPath) {
|
||||
return param -> new FilePathTableCell<>(rootPath);
|
||||
}
|
||||
|
||||
public FilePathTableCell(StringProperty parentPath) {
|
||||
this.path = parentPath;
|
||||
this.rootPathProperty = parentPath;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -30,7 +36,7 @@ public class FilePathTableCell<V> extends TableCell<V, String> {
|
||||
return;
|
||||
}
|
||||
|
||||
String path = this.path.get();
|
||||
String path = this.rootPathProperty.get();
|
||||
if (StringUtils.hasText(path)) {
|
||||
if (item.startsWith(path)) {
|
||||
item = "~" + item.substring(path.length());
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.time.LocalDate;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
import com.ecep.contract.service.VendorService;
|
||||
import com.ecep.contract.task.VendorReBuildFilesTasker;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
@@ -73,13 +74,14 @@ public class VendorManagerWindowController
|
||||
MessageHolder messageHolder = (level, msg) -> {
|
||||
System.out.println(level + ">" + msg);
|
||||
};
|
||||
|
||||
VendorReBuildFilesTasker tasker = new VendorReBuildFilesTasker();
|
||||
while (true) {
|
||||
Page<VendorVo> page = vendorService.findAll(null, pageRequest);
|
||||
for (VendorVo companyVendor : page) {
|
||||
MessageHolder sub = messageHolder
|
||||
.sub(page.getNumber() + "/" + page.getTotalPages() + " #" + companyVendor.getId() + ">");
|
||||
vendorService.reBuildingFiles(companyVendor, sub);
|
||||
tasker.setVendor(companyVendor);
|
||||
tasker.callRemoteTask(sub, getLocale(), companyVendor.getId());
|
||||
}
|
||||
if (!page.hasNext()) {
|
||||
break;
|
||||
|
||||
34
client/src/main/java/com/ecep/contract/controller/vendor/VendorNextSignDateTask.java
vendored
Normal file
34
client/src/main/java/com/ecep/contract/controller/vendor/VendorNextSignDateTask.java
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
package com.ecep.contract.controller.vendor;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.ecep.contract.MessageHolder;
|
||||
import com.ecep.contract.WebSocketClientTasker;
|
||||
import com.ecep.contract.task.Tasker;
|
||||
import com.ecep.contract.vo.VendorVo;
|
||||
|
||||
import lombok.Setter;
|
||||
|
||||
public class VendorNextSignDateTask extends Tasker<Object> implements WebSocketClientTasker {
|
||||
private static final Logger logger = LoggerFactory.getLogger(VendorNextSignDateTask.class);
|
||||
|
||||
@Setter
|
||||
private VendorVo vendor;
|
||||
|
||||
@Override
|
||||
public String getTaskName() {
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProgress(long current, long total) {
|
||||
super.updateProgress(current, total);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object execute(MessageHolder holder) throws Exception {
|
||||
updateTitle("计算供应商下一个评价日期");
|
||||
return callRemoteTask(holder, getLocale(), vendor.getId());
|
||||
}
|
||||
}
|
||||
@@ -2,24 +2,28 @@ package com.ecep.contract.controller.vendor;
|
||||
|
||||
import java.io.File;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.ecep.contract.MyDateTimeUtils;
|
||||
import com.ecep.contract.SpringApp;
|
||||
import com.ecep.contract.VendorType;
|
||||
import com.ecep.contract.util.ComboBoxUtils;
|
||||
import com.ecep.contract.controller.company.CompanyWindowController;
|
||||
import com.ecep.contract.controller.tab.AbstEntityBasedTabSkin;
|
||||
import com.ecep.contract.service.CompanyContactService;
|
||||
import com.ecep.contract.service.VendorService;
|
||||
import com.ecep.contract.service.QueryService;
|
||||
import com.ecep.contract.service.VendorCatalogService;
|
||||
import com.ecep.contract.service.VendorService;
|
||||
import com.ecep.contract.service.VendorTypeService;
|
||||
import com.ecep.contract.util.ComboBoxUtils;
|
||||
import com.ecep.contract.util.UITools;
|
||||
import com.ecep.contract.vm.CompanyContactViewModel;
|
||||
import com.ecep.contract.vm.CompanyVendorViewModel;
|
||||
import com.ecep.contract.vm.CompanyViewModel;
|
||||
import com.ecep.contract.vo.VendorVo;
|
||||
import com.ecep.contract.vo.CompanyContactVo;
|
||||
import com.ecep.contract.vo.CompanyVo;
|
||||
import com.ecep.contract.vo.VendorVo;
|
||||
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
@@ -27,6 +31,7 @@ import javafx.event.ActionEvent;
|
||||
import javafx.scene.control.ComboBox;
|
||||
import javafx.scene.control.Tab;
|
||||
import javafx.stage.DirectoryChooser;
|
||||
import javafx.util.StringConverter;
|
||||
import javafx.util.converter.LocalDateStringConverter;
|
||||
import javafx.util.converter.LocalDateTimeStringConverter;
|
||||
|
||||
@@ -59,12 +64,31 @@ public class VendorTabSkinBase
|
||||
controller.developDateField.setConverter(converter);
|
||||
controller.developDateField.valueProperty().bindBidirectional(viewModel.getDevelopDate());
|
||||
|
||||
ComboBoxUtils.initialComboBox(controller.catalogField, viewModel.getCatalog(), getCachedBean(VendorCatalogService.class), true);
|
||||
ComboBoxUtils.initialComboBox(controller.catalogField, viewModel.getCatalog(),
|
||||
getCachedBean(VendorCatalogService.class), true);
|
||||
|
||||
initialTypeComboBox();
|
||||
|
||||
controller.protocolProviderField.selectedProperty().bindBidirectional(viewModel.getProtocolProvider());
|
||||
UITools.autoCompletion(controller.contactField, viewModel.getContact(), getCompanyContactService());
|
||||
UITools.autoCompletion(controller.contactField, viewModel.getContact(),
|
||||
new QueryService<CompanyContactVo, CompanyContactViewModel>() {
|
||||
@Override
|
||||
public CompanyContactVo findById(Integer id) {
|
||||
return getCompanyContactService().findById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CompanyContactVo> search(String searchText) {
|
||||
VendorVo vendor = getEntity();
|
||||
CompanyVo company = controller.getCompanyService().findById(vendor.getCompanyId());
|
||||
return getCompanyContactService().searchByCompany(company, searchText);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StringConverter<CompanyContactVo> getStringConverter() {
|
||||
return getCompanyContactService().getStringConverter();
|
||||
}
|
||||
});
|
||||
controller.purchaseField.textProperty().bindBidirectional(viewModel.getPurchase());
|
||||
|
||||
controller.pathField.textProperty().bind(viewModel.getPath());
|
||||
@@ -115,7 +139,7 @@ public class VendorTabSkinBase
|
||||
VendorVo entity = getEntity();
|
||||
String path = entity.getPath();
|
||||
File initialDirectory = null;
|
||||
|
||||
|
||||
// 如果当前已经设置了目录并且路径有效,则设置初始目录为该目录
|
||||
if (StringUtils.hasText(path)) {
|
||||
File dir = new File(path);
|
||||
@@ -123,16 +147,16 @@ public class VendorTabSkinBase
|
||||
initialDirectory = dir;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 如果没有有效的初始目录,则使用基础路径
|
||||
if (initialDirectory == null) {
|
||||
initialDirectory = getCompanyVendorService().getBasePath();
|
||||
}
|
||||
|
||||
|
||||
if (initialDirectory != null) {
|
||||
chooser.setInitialDirectory(initialDirectory);
|
||||
}
|
||||
|
||||
|
||||
File newDirectory = chooser.showDialog(getTab().getContent().getScene().getWindow());
|
||||
if (newDirectory != null) {
|
||||
entity.setPath(newDirectory.getAbsolutePath());
|
||||
|
||||
@@ -3,40 +3,34 @@ package com.ecep.contract.controller.vendor;
|
||||
import java.io.File;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
import com.ecep.contract.service.VendorFileTypeService;
|
||||
import com.ecep.contract.vo.VendorFileVo;
|
||||
import com.ecep.contract.vo.VendorVo;
|
||||
import com.ecep.contract.vo.CompanyVo;
|
||||
import com.ecep.contract.vo.VendorFileTypeLocalVo;
|
||||
import javafx.scene.control.*;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.ecep.contract.VendorFileType;
|
||||
import com.ecep.contract.DesktopUtils;
|
||||
import com.ecep.contract.MyDateTimeUtils;
|
||||
import com.ecep.contract.SpringApp;
|
||||
import com.ecep.contract.VendorFileType;
|
||||
import com.ecep.contract.constant.CompanyVendorConstant;
|
||||
import com.ecep.contract.controller.tab.TabSkin;
|
||||
import com.ecep.contract.model.BaseEnumEntity;
|
||||
import com.ecep.contract.controller.table.cell.FilePathTableCell;
|
||||
import com.ecep.contract.service.VendorFileService;
|
||||
import com.ecep.contract.service.VendorFileTypeService;
|
||||
import com.ecep.contract.task.CompanyVendorEvaluationFormUpdateTask;
|
||||
import com.ecep.contract.task.VendorReBuildFilesTasker;
|
||||
import com.ecep.contract.util.FxmlPath;
|
||||
import com.ecep.contract.util.UITools;
|
||||
import com.ecep.contract.vm.CompanyVendorFileViewModel;
|
||||
import com.ecep.contract.vo.CompanyVo;
|
||||
import com.ecep.contract.vo.VendorFileTypeLocalVo;
|
||||
import com.ecep.contract.vo.VendorFileVo;
|
||||
import com.ecep.contract.vo.VendorVo;
|
||||
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableMap;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.ButtonType;
|
||||
import javafx.scene.control.MenuItem;
|
||||
import javafx.scene.control.Tab;
|
||||
import javafx.scene.control.TableCell;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.cell.CheckBoxTableCell;
|
||||
import lombok.Setter;
|
||||
|
||||
@@ -59,6 +53,9 @@ public class VendorTabSkinFile
|
||||
public MenuItem fileTable_menu_refresh;
|
||||
public MenuItem fileTable_menu_del;
|
||||
public MenuItem fileTable_menu_move_to_company_path;
|
||||
public Menu fileTable_menu_set_valid;
|
||||
public MenuItem fileTable_menu_set_valid_true;
|
||||
public MenuItem fileTable_menu_set_valid_false;
|
||||
|
||||
public Button fileTable_reBuildBtn;
|
||||
public Button fileTable_updateEvaluationFormBuildBtn;
|
||||
@@ -97,10 +94,13 @@ public class VendorTabSkinFile
|
||||
param.getValue().getType()).map(VendorFileTypeLocalVo::getValue));
|
||||
|
||||
fileTable_filePathColumn.setCellValueFactory(param -> param.getValue().getFilePath());
|
||||
fileTable_filePathColumn.setCellFactory(param -> new FileTableFilePathTableCell());
|
||||
fileTable_filePathColumn.setCellFactory(FilePathTableCell.forTableColumn(viewModel.getPath()));
|
||||
|
||||
fileTable_editFilePathColumn.setCellValueFactory(param -> param.getValue().getEditFilePath());
|
||||
fileTable_editFilePathColumn.setCellFactory(param -> new FileTableFilePathTableCell());
|
||||
fileTable_editFilePathColumn.setCellFactory(FilePathTableCell.forTableColumn(viewModel.getPath()));
|
||||
|
||||
fileTable_signDateColumn.setCellValueFactory(param -> param.getValue().getSignDate());
|
||||
|
||||
fileTable_validColumn.setEditable(true);
|
||||
fileTable_validColumn.setCellValueFactory(param -> param.getValue().getValid());
|
||||
fileTable_validColumn.setCellFactory(param -> new CheckBoxTableCell<>());
|
||||
@@ -113,6 +113,14 @@ public class VendorTabSkinFile
|
||||
fileTable_menu_del.setOnAction(this::onTableDeleteAction);
|
||||
fileTable_menu_move_to_company_path.setOnAction(this::onFileTableMoveToCompanyPathAction);
|
||||
|
||||
// 设置有效性菜单项事件处理
|
||||
fileTable_menu_set_valid_true.setOnAction(e -> setValidValue(true));
|
||||
fileTable_menu_set_valid_false.setOnAction(e -> setValidValue(false));
|
||||
|
||||
// 当表格中没有选中项时,菜单项不显示
|
||||
fileTable_menu_set_valid.visibleProperty()
|
||||
.bind(Bindings.isNotEmpty(table.getSelectionModel().getSelectedItems()));
|
||||
|
||||
super.initializeTab();
|
||||
}
|
||||
|
||||
@@ -174,23 +182,19 @@ public class VendorTabSkinFile
|
||||
ccf.setType(VendorFileType.General);
|
||||
ccf.setFilePath(dest.getAbsolutePath());
|
||||
ccf.setValid(false);
|
||||
VendorFileVo saved = getVendorFileService().save(ccf);
|
||||
getVendorFileService().save(ccf);
|
||||
}
|
||||
}
|
||||
loadTableDataSet();
|
||||
}
|
||||
|
||||
public void onFileReBuildingAction(ActionEvent event) {
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
VendorVo companyVendor = getParent();
|
||||
if (getCompanyVendorService().reBuildingFiles(companyVendor, (level, msg) -> setStatus(msg))) {
|
||||
loadTableDataSet();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
VendorReBuildFilesTasker tasker = new VendorReBuildFilesTasker();
|
||||
tasker.setVendor(getEntity());
|
||||
UITools.showTaskDialogAndWait("重建文件", tasker, null);
|
||||
if (tasker.isModified()) {
|
||||
loadTableDataSet();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -278,43 +282,15 @@ public class VendorTabSkinFile
|
||||
|
||||
public void onUpdateEvaluationFormAction(ActionEvent event) {
|
||||
CompanyVendorEvaluationFormUpdateTask task = new CompanyVendorEvaluationFormUpdateTask();
|
||||
task.setVendor(getEntity());
|
||||
UITools.showTaskDialogAndWait("更新评价表", task, null);
|
||||
loadTableDataSet();
|
||||
}
|
||||
|
||||
public void onCalcNextSignDateAction(ActionEvent event) {
|
||||
UITools.showDialogAndWait("计算供应商下一个评价日期", "依据已有的供应商评价表和登记采购的合同计算下一个评价日期", ds -> {
|
||||
VendorVo companyVendor = getCompanyVendorService().findById(viewModel.getId().get());
|
||||
LocalDate nextSignDate = getVendorFileService().getNextSignDate(companyVendor, msg -> {
|
||||
Platform.runLater(() -> {
|
||||
ds.add(msg);
|
||||
});
|
||||
});
|
||||
if (nextSignDate != null) {
|
||||
Platform.runLater(() -> {
|
||||
ds.add("下一个评价日期:" + nextSignDate);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
class FileTableFilePathTableCell extends TableCell<CompanyVendorFileViewModel, String> {
|
||||
@Override
|
||||
protected void updateItem(String item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
if (empty || !StringUtils.hasText(item)) {
|
||||
setText("");
|
||||
return;
|
||||
}
|
||||
|
||||
String path = viewModel.getPath().get();
|
||||
if (StringUtils.hasText(path)) {
|
||||
if (item.startsWith(path)) {
|
||||
item = "~" + item.substring(path.length());
|
||||
}
|
||||
}
|
||||
setText(item);
|
||||
}
|
||||
VendorNextSignDateTask task = new VendorNextSignDateTask();
|
||||
task.setVendor(getEntity());
|
||||
UITools.showTaskDialogAndWait("计算供应商的下一个评价日期", task, null);
|
||||
}
|
||||
|
||||
public VendorFileService getVendorFileService() {
|
||||
@@ -324,4 +300,28 @@ public class VendorTabSkinFile
|
||||
return vendorFileService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置选中行的valid值
|
||||
*
|
||||
* @param valid 有效性值
|
||||
*/
|
||||
private void setValidValue(boolean valid) {
|
||||
List<CompanyVendorFileViewModel> selectedItems = getTableView().getSelectionModel().getSelectedItems();
|
||||
if (selectedItems.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (CompanyVendorFileViewModel item : selectedItems) {
|
||||
// 更新视图模型的值
|
||||
item.getValid().set(valid);
|
||||
|
||||
// 保存到后端
|
||||
VendorFileVo entity = loadRowData(item);
|
||||
entity.setValid(valid);
|
||||
saveRowData(entity);
|
||||
}
|
||||
|
||||
setStatus("已更新" + selectedItems.size() + "条记录的有效性状态");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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.CompanyCustomerService;
|
||||
import com.ecep.contract.vo.CompanyCustomerVo;
|
||||
import com.ecep.contract.service.CustomerService;
|
||||
import com.ecep.contract.vo.CustomerVo;
|
||||
|
||||
import jakarta.annotation.PostConstruct;
|
||||
|
||||
@Lazy
|
||||
@Component
|
||||
public class CompanyCustomerStringConverter extends EntityStringConverter<CompanyCustomerVo> {
|
||||
public class CompanyCustomerStringConverter extends EntityStringConverter<CustomerVo> {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private CompanyCustomerService service;
|
||||
private CustomerService service;
|
||||
|
||||
public CompanyCustomerStringConverter() {
|
||||
|
||||
|
||||
@@ -63,6 +63,8 @@ public class CloudTycService extends QueryService<CloudTycVo, CloudTycInfoViewMo
|
||||
if (cloudTyc == null) {
|
||||
cloudTyc = new CloudTycVo();
|
||||
cloudTyc.setCompanyId(company.getId());
|
||||
cloudTyc.setCloudId("");
|
||||
cloudTyc.setScore(0);
|
||||
cloudTyc.setActive(false);
|
||||
cloudTyc.setVersion(1);
|
||||
cloudTyc = save(cloudTyc);
|
||||
|
||||
@@ -8,11 +8,11 @@ import org.springframework.stereotype.Service;
|
||||
import com.ecep.contract.util.ParamUtils;
|
||||
import com.ecep.contract.vm.CustomerEntityViewModel;
|
||||
import com.ecep.contract.vo.CompanyCustomerEntityVo;
|
||||
import com.ecep.contract.vo.CompanyCustomerVo;
|
||||
import com.ecep.contract.vo.CustomerVo;
|
||||
|
||||
@Service
|
||||
public class CompanyCustomerEntityService extends QueryService<CompanyCustomerEntityVo, CustomerEntityViewModel> {
|
||||
public List<CompanyCustomerEntityVo> findAllByCustomer(CompanyCustomerVo customer) {
|
||||
public List<CompanyCustomerEntityVo> findAllByCustomer(CustomerVo customer) {
|
||||
return findAll(ParamUtils.builder()
|
||||
.equals("customer", customer.getId()).build(), Pageable.unpaged())
|
||||
.getContent();
|
||||
|
||||
@@ -6,7 +6,7 @@ import org.springframework.stereotype.Service;
|
||||
import com.ecep.contract.util.ParamUtils;
|
||||
import com.ecep.contract.vm.CompanyCustomerEvaluationFormFileViewModel;
|
||||
import com.ecep.contract.vo.CompanyCustomerEvaluationFormFileVo;
|
||||
import com.ecep.contract.vo.CompanyCustomerFileVo;
|
||||
import com.ecep.contract.vo.CustomerFileVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -24,7 +24,7 @@ public class CompanyCustomerEvaluationFormFileService
|
||||
/**
|
||||
* 根据客户文件查找评估表文件
|
||||
*/
|
||||
public CompanyCustomerEvaluationFormFileVo findByCustomerFile(CompanyCustomerFileVo customerFile) {
|
||||
public CompanyCustomerEvaluationFormFileVo findByCustomerFile(CustomerFileVo customerFile) {
|
||||
return findByCustomerFile(customerFile.getId());
|
||||
}
|
||||
|
||||
|
||||
@@ -17,15 +17,15 @@ import com.ecep.contract.MessageHolder;
|
||||
import com.ecep.contract.SpringApp;
|
||||
import com.ecep.contract.constant.CompanyCustomerConstant;
|
||||
import com.ecep.contract.util.ParamUtils;
|
||||
import com.ecep.contract.vm.CompanyCustomerFileViewModel;
|
||||
import com.ecep.contract.vo.CompanyCustomerFileVo;
|
||||
import com.ecep.contract.vo.CompanyCustomerVo;
|
||||
import com.ecep.contract.vm.CustomerFileViewModel;
|
||||
import com.ecep.contract.vo.CustomerFileVo;
|
||||
import com.ecep.contract.vo.CustomerVo;
|
||||
import com.ecep.contract.vo.CompanyVo;
|
||||
import com.ecep.contract.vo.ContractVo;
|
||||
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "customer-file")
|
||||
public class CompanyCustomerFileService extends QueryService<CompanyCustomerFileVo, CompanyCustomerFileViewModel> {
|
||||
public class CompanyCustomerFileService extends QueryService<CustomerFileVo, CustomerFileViewModel> {
|
||||
|
||||
public File getEvaluationFormTemplate() {
|
||||
SysConfService confService = SpringApp.getBean(SysConfService.class);
|
||||
@@ -38,11 +38,11 @@ public class CompanyCustomerFileService extends QueryService<CompanyCustomerFile
|
||||
|
||||
@Cacheable
|
||||
@Override
|
||||
public CompanyCustomerFileVo findById(Integer id) {
|
||||
public CustomerFileVo findById(Integer id) {
|
||||
return super.findById(id);
|
||||
}
|
||||
|
||||
public LocalDate getNextSignDate(CompanyCustomerVo companyCustomer, MessageHolder holder) {
|
||||
public LocalDate getNextSignDate(CustomerVo companyCustomer, MessageHolder holder) {
|
||||
LocalDate miniContractDate = LocalDate.of(2022, 1, 1);
|
||||
Integer companyId = companyCustomer.getCompanyId();
|
||||
|
||||
@@ -57,11 +57,11 @@ public class CompanyCustomerFileService extends QueryService<CompanyCustomerFile
|
||||
}
|
||||
|
||||
// 检索评估表
|
||||
List<CompanyCustomerFileVo> files = findAllByCustomerAndType(companyCustomer,
|
||||
List<CustomerFileVo> files = findAllByCustomerAndType(companyCustomer,
|
||||
CustomerFileType.EvaluationForm);
|
||||
CompanyCustomerFileVo latestFile = files.stream()
|
||||
CustomerFileVo latestFile = files.stream()
|
||||
.filter(v -> v.getSignDate() != null && v.isValid())
|
||||
.max(Comparator.comparing(CompanyCustomerFileVo::getSignDate))
|
||||
.max(Comparator.comparing(CustomerFileVo::getSignDate))
|
||||
.orElse(null);
|
||||
if (latestFile == null) {
|
||||
// 没有有效的评估表的评价日期
|
||||
@@ -104,12 +104,12 @@ public class CompanyCustomerFileService extends QueryService<CompanyCustomerFile
|
||||
return SpringApp.getBean(HolidayService.class).adjustToWorkDay(setupDate.plusDays(-7));
|
||||
}
|
||||
|
||||
public List<CompanyCustomerFileVo> findAllByCustomer(CompanyCustomerVo companyCustomer) {
|
||||
public List<CustomerFileVo> findAllByCustomer(CustomerVo companyCustomer) {
|
||||
return findAll(ParamUtils.builder().equals("customer", companyCustomer).build(), Pageable.unpaged())
|
||||
.getContent();
|
||||
}
|
||||
|
||||
public List<CompanyCustomerFileVo> findAllByCustomerAndType(CompanyCustomerVo customer, CustomerFileType type) {
|
||||
public List<CustomerFileVo> findAllByCustomerAndType(CustomerVo customer, CustomerFileType type) {
|
||||
return findAll(ParamUtils.builder()
|
||||
.equals("customer", customer.getId())
|
||||
.equals("type", type.name())
|
||||
@@ -118,7 +118,7 @@ public class CompanyCustomerFileService extends QueryService<CompanyCustomerFile
|
||||
|
||||
@CacheEvict(allEntries = true)
|
||||
@Override
|
||||
public CompanyCustomerFileVo save(CompanyCustomerFileVo entity) {
|
||||
public CustomerFileVo save(CustomerFileVo entity) {
|
||||
return super.save(entity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,24 +2,23 @@ package com.ecep.contract.service;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import javafx.application.Platform;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.ecep.contract.MessageHolder;
|
||||
import com.ecep.contract.SpringApp;
|
||||
import com.ecep.contract.constant.CompanyCustomerConstant;
|
||||
import com.ecep.contract.task.CompanyCustomerRebuildFilesTasker;
|
||||
import com.ecep.contract.controller.customer.tasker.CustomerRebuildFilesTasker;
|
||||
import com.ecep.contract.util.ParamUtils;
|
||||
import com.ecep.contract.util.UITools;
|
||||
import com.ecep.contract.vm.CompanyCustomerViewModel;
|
||||
import com.ecep.contract.vo.CompanyCustomerVo;
|
||||
import com.ecep.contract.vo.CompanyVo;
|
||||
import org.springframework.util.StringUtils;
|
||||
import com.ecep.contract.vo.CustomerVo;
|
||||
|
||||
@Service
|
||||
public class CompanyCustomerService extends QueryService<CompanyCustomerVo, CompanyCustomerViewModel> {
|
||||
public class CustomerService extends QueryService<CustomerVo, CompanyCustomerViewModel> {
|
||||
private File basePath;
|
||||
|
||||
public File getBasePath() {
|
||||
@@ -30,8 +29,8 @@ public class CompanyCustomerService extends QueryService<CompanyCustomerVo, Comp
|
||||
return basePath;
|
||||
}
|
||||
|
||||
public CompanyCustomerVo findByCompany(CompanyVo company) {
|
||||
Page<CompanyCustomerVo> page = findAll(ParamUtils.equal("company", company.getId()), Pageable.ofSize(1));
|
||||
public CustomerVo findByCompany(CompanyVo company) {
|
||||
Page<CustomerVo> page = findAll(ParamUtils.equal("company", company.getId()), Pageable.ofSize(1));
|
||||
if (page.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
@@ -45,14 +44,14 @@ public class CompanyCustomerService extends QueryService<CompanyCustomerVo, Comp
|
||||
* @param holder 消息持有者,用于显示任务执行过程中的消息
|
||||
* @return 如果文件重建成功则返回true,否则返回false
|
||||
*/
|
||||
public boolean reBuildingFiles(CompanyCustomerVo companyCustomer, MessageHolder holder) {
|
||||
public boolean reBuildingFiles(CustomerVo companyCustomer, MessageHolder holder) {
|
||||
// 首先确保客户有有效的路径
|
||||
if (!makePathAbsent(companyCustomer)) {
|
||||
holder.warn("无法创建或确认客户路径,文件重建可能失败");
|
||||
}
|
||||
|
||||
// 创建并配置文件重建任务
|
||||
CompanyCustomerRebuildFilesTasker tasker = new CompanyCustomerRebuildFilesTasker();
|
||||
CustomerRebuildFilesTasker tasker = new CustomerRebuildFilesTasker();
|
||||
tasker.setCompanyCustomer(companyCustomer);
|
||||
|
||||
// 显示任务对话框并等待任务完成
|
||||
@@ -68,7 +67,7 @@ public class CompanyCustomerService extends QueryService<CompanyCustomerVo, Comp
|
||||
* @param companyCustomer 客户对象
|
||||
* @return 如果成功创建路径并设置则返回true,否则返回false
|
||||
*/
|
||||
public boolean makePathAbsent(CompanyCustomerVo companyCustomer) {
|
||||
public boolean makePathAbsent(CustomerVo companyCustomer) {
|
||||
String path = companyCustomer.getPath();
|
||||
if (StringUtils.hasText(path)) {
|
||||
File file = new File(path);
|
||||
@@ -94,7 +93,7 @@ public class CompanyCustomerService extends QueryService<CompanyCustomerVo, Comp
|
||||
* @param companyCustomer 客户对象
|
||||
* @return 创建的目录对象,如果创建失败则返回null
|
||||
*/
|
||||
private File makePath(CompanyCustomerVo companyCustomer) {
|
||||
private File makePath(CustomerVo companyCustomer) {
|
||||
File basePath = getBasePath();
|
||||
Integer companyId = companyCustomer.getCompanyId();
|
||||
CompanyVo company = SpringApp.getBean(CompanyService.class).findById(companyId);
|
||||
@@ -1,36 +1,49 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
import com.ecep.contract.MessageHolder;
|
||||
import com.ecep.contract.MyDateTimeUtils;
|
||||
import com.ecep.contract.SpringApp;
|
||||
import com.ecep.contract.VendorFileType;
|
||||
import com.ecep.contract.constant.CompanyCustomerConstant;
|
||||
import com.ecep.contract.constant.CompanyVendorConstant;
|
||||
import com.ecep.contract.util.ParamUtils;
|
||||
import com.ecep.contract.vm.CompanyVendorFileViewModel;
|
||||
import com.ecep.contract.vo.ContractVo;
|
||||
import com.ecep.contract.vo.VendorFileVo;
|
||||
import com.ecep.contract.vo.VendorVo;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.File;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import com.ecep.contract.SpringApp;
|
||||
import com.ecep.contract.vo.ContractVo;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.ecep.contract.MessageHolder;
|
||||
import com.ecep.contract.MyDateTimeUtils;
|
||||
import com.ecep.contract.VendorFileType;
|
||||
import com.ecep.contract.model.VendorFileTypeLocal;
|
||||
import com.ecep.contract.util.ParamUtils;
|
||||
import com.ecep.contract.vm.CompanyVendorFileViewModel;
|
||||
import com.ecep.contract.vo.VendorFileVo;
|
||||
import com.ecep.contract.vo.VendorVo;
|
||||
|
||||
@Service
|
||||
public class VendorFileService extends QueryService<VendorFileVo, CompanyVendorFileViewModel> {
|
||||
public File getEvaluationFormTemplate() {
|
||||
SysConfService confService = SpringApp.getBean(SysConfService.class);
|
||||
String path = confService.getString(CompanyVendorConstant.KEY_EVALUATION_FORM_TEMPLATE);
|
||||
if (path == null) {
|
||||
return null;
|
||||
}
|
||||
return new File(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取供应商下一个评价表的日期
|
||||
*
|
||||
* @param vendor 供应商
|
||||
* @param state 状态消费者
|
||||
* @return 下一个评价表的日期
|
||||
*/
|
||||
public LocalDate getNextSignDate(VendorVo vendor, Consumer<String> state) {
|
||||
LocalDate miniContractDate = LocalDate.of(2022, 1, 1);
|
||||
|
||||
// 检索全部合同
|
||||
ContractService contractService = SpringApp.getBean(ContractService.class);
|
||||
List<ContractVo> contractList = contractService.findAllByCompanyVendor(vendor, null, null);
|
||||
List<ContractVo> contractList = contractService.findAllByCompanyVendor(vendor, miniContractDate, LocalDate.now());
|
||||
if (contractList.isEmpty()) {
|
||||
state.accept("未发现已登记的合同");
|
||||
return null;
|
||||
|
||||
@@ -65,11 +65,6 @@ public class VendorService extends QueryService<VendorVo, CompanyVendorViewModel
|
||||
return page.getContent().getFirst();
|
||||
}
|
||||
|
||||
public boolean reBuildingFiles(VendorVo companyVendor, MessageHolder messageHolder) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'reBuildingFiles'");
|
||||
}
|
||||
|
||||
public void verify(ContractVo contract, MessageHolder holder) {
|
||||
CompanyVo company = companyService.findById(contract.getCompanyId());
|
||||
if (company == null) {
|
||||
|
||||
@@ -19,13 +19,11 @@ import lombok.Setter;
|
||||
public class CloudRkSyncTask extends Tasker<Object> implements WebSocketClientTasker {
|
||||
private static final Logger logger = LoggerFactory.getLogger(CloudRkSyncTask.class);
|
||||
|
||||
@Setter
|
||||
private CompanyVo company;
|
||||
|
||||
@Override
|
||||
protected Object execute(MessageHolder holder) throws Exception {
|
||||
updateTitle(String.format("集团相关方平台同步任务[%s]", company.getName()));
|
||||
return callRemoteTask(holder, getLocale(), company.getId());
|
||||
updateTitle("集团相关方平台同步任务");
|
||||
return callRemoteTask(holder, getLocale());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.ecep.contract.task;
|
||||
|
||||
import com.ecep.contract.MessageHolder;
|
||||
import com.ecep.contract.WebSocketClientTasker;
|
||||
import com.ecep.contract.service.CloudRkService;
|
||||
import com.ecep.contract.vo.CompanyVo;
|
||||
|
||||
import lombok.Setter;
|
||||
@@ -23,7 +24,7 @@ public class CompanyRkUpdateTasker extends Tasker<Object> implements WebSocketCl
|
||||
|
||||
@Override
|
||||
protected Object execute(MessageHolder holder) throws Exception {
|
||||
updateTitle("合并更新 " + company.getName());
|
||||
updateTitle("从 集团相关方平台 拉取数据更新 " + company.getName() + " 企业信息");
|
||||
return callRemoteTask(holder, getLocale(), company.getId());
|
||||
}
|
||||
|
||||
|
||||
@@ -4,16 +4,32 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.ecep.contract.MessageHolder;
|
||||
import com.ecep.contract.WebSocketClientTasker;
|
||||
import com.ecep.contract.vo.VendorVo;
|
||||
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* 更新供应商评价表
|
||||
*/
|
||||
public class CompanyVendorEvaluationFormUpdateTask extends Tasker<Object> {
|
||||
public class CompanyVendorEvaluationFormUpdateTask extends Tasker<Object> implements WebSocketClientTasker {
|
||||
private static final Logger logger = LoggerFactory.getLogger(CompanyVendorEvaluationFormUpdateTask.class);
|
||||
@Setter
|
||||
private VendorVo vendor;
|
||||
|
||||
@Override
|
||||
public void updateProgress(long current, long total) {
|
||||
super.updateProgress(current, total);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTaskName() {
|
||||
return "CompanyVendorEvaluationFormUpdateTask";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object execute(MessageHolder holder) throws Exception {
|
||||
updateTitle("更新供应商评价表");
|
||||
return null;
|
||||
return callRemoteTask(holder, getLocale(), vendor.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,11 +4,13 @@ import com.ecep.contract.*;
|
||||
import com.ecep.contract.controller.project.cost.ProjectCostImportItemsFromContractsTasker;
|
||||
import com.ecep.contract.model.ContractFileTypeLocal;
|
||||
import com.ecep.contract.service.*;
|
||||
import com.ecep.contract.util.ContextUtils;
|
||||
import com.ecep.contract.vo.*;
|
||||
import javafx.beans.property.SimpleBooleanProperty;
|
||||
import javafx.collections.ObservableMap;
|
||||
import javafx.util.converter.NumberStringConverter;
|
||||
import lombok.Data;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.io.File;
|
||||
@@ -20,173 +22,101 @@ import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Data
|
||||
public class ContractVerifyComm {
|
||||
// Project
|
||||
private ProjectService projectService;
|
||||
private ProjectSaleTypeRequireFileTypeService saleTypeRequireFileTypeService;
|
||||
private ProjectSaleTypeService saleTypeService;
|
||||
private ProjectCostService projectCostService;
|
||||
private ProjectQuotationService projectQuotationService;
|
||||
private ProjectBidService projectBidService;
|
||||
// Contract
|
||||
private ContractService contractService;
|
||||
private ContractFileService contractFileService;
|
||||
private ContractFileTypeService contractFileTypeService;
|
||||
private ContractBidVendorService contractBidVendorService;
|
||||
public class ContractVerifyComm implements ContextUtils {
|
||||
ContextUtils parent;
|
||||
|
||||
// Company
|
||||
private CompanyService companyService;
|
||||
private CompanyFileService companyFileService;
|
||||
// Vendor
|
||||
private VendorService vendorService;
|
||||
private VendorGroupService vendorGroupService;
|
||||
private VendorGroupRequireFileTypeService vendorGroupRequireFileTypeService;
|
||||
private ExtendVendorInfoService extendVendorInfoService;
|
||||
// Customer
|
||||
private CompanyCustomerService companyCustomerService;
|
||||
private CompanyCustomerFileService companyCustomerFileService;
|
||||
private CompanyExtendInfoService companyExtendInfoService;
|
||||
// Employee
|
||||
private EmployeeService employeeService;
|
||||
public ContractVerifyComm(ContextUtils parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getBean(Class<T> requiredType) throws BeansException {
|
||||
return parent.getBean(requiredType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getCachedBean(Class<T> requiredType) throws BeansException {
|
||||
return parent.getCachedBean(requiredType);
|
||||
}
|
||||
|
||||
private ProjectService getProjectService() {
|
||||
if (projectService == null) {
|
||||
projectService = SpringApp.getBean(ProjectService.class);
|
||||
}
|
||||
return projectService;
|
||||
return getCachedBean(ProjectService.class);
|
||||
}
|
||||
|
||||
private ProjectSaleTypeService getSaleTypeService() {
|
||||
if (saleTypeService == null) {
|
||||
saleTypeService = SpringApp.getBean(ProjectSaleTypeService.class);
|
||||
}
|
||||
return saleTypeService;
|
||||
return getCachedBean(ProjectSaleTypeService.class);
|
||||
}
|
||||
|
||||
ProjectCostService getProjectCostService() {
|
||||
if (projectCostService == null) {
|
||||
projectCostService = SpringApp.getBean(ProjectCostService.class);
|
||||
}
|
||||
return projectCostService;
|
||||
private ProjectCostService getProjectCostService() {
|
||||
return getCachedBean(ProjectCostService.class);
|
||||
}
|
||||
|
||||
ProjectQuotationService getProjectQuotationService() {
|
||||
if (projectQuotationService == null) {
|
||||
projectQuotationService = SpringApp.getBean(ProjectQuotationService.class);
|
||||
}
|
||||
return projectQuotationService;
|
||||
private ProjectQuotationService getProjectQuotationService() {
|
||||
return getCachedBean(ProjectQuotationService.class);
|
||||
}
|
||||
|
||||
ProjectBidService getProjectBidService() {
|
||||
if (projectBidService == null) {
|
||||
projectBidService = SpringApp.getBean(ProjectBidService.class);
|
||||
}
|
||||
return projectBidService;
|
||||
private ProjectBidService getProjectBidService() {
|
||||
return getCachedBean(ProjectBidService.class);
|
||||
}
|
||||
|
||||
private ProjectSaleTypeRequireFileTypeService getSaleTypeRequireFileTypeService() {
|
||||
if (saleTypeRequireFileTypeService == null) {
|
||||
saleTypeRequireFileTypeService = SpringApp.getBean(ProjectSaleTypeRequireFileTypeService.class);
|
||||
}
|
||||
return saleTypeRequireFileTypeService;
|
||||
return getCachedBean(ProjectSaleTypeRequireFileTypeService.class);
|
||||
}
|
||||
|
||||
public ContractService getContractService() {
|
||||
if (contractService == null) {
|
||||
contractService = SpringApp.getBean(ContractService.class);
|
||||
}
|
||||
return contractService;
|
||||
return getCachedBean(ContractService.class);
|
||||
}
|
||||
|
||||
private ContractFileService getContractFileService() {
|
||||
if (contractFileService == null) {
|
||||
contractFileService = SpringApp.getBean(ContractFileService.class);
|
||||
}
|
||||
return contractFileService;
|
||||
return getCachedBean(ContractFileService.class);
|
||||
}
|
||||
|
||||
private ContractFileTypeService getContractFileTypeService() {
|
||||
if (contractFileTypeService == null) {
|
||||
contractFileTypeService = SpringApp.getBean(ContractFileTypeService.class);
|
||||
}
|
||||
return contractFileTypeService;
|
||||
return getCachedBean(ContractFileTypeService.class);
|
||||
}
|
||||
|
||||
private ContractBidVendorService getContractBidVendorService() {
|
||||
if (contractBidVendorService == null) {
|
||||
contractBidVendorService = SpringApp.getBean(ContractBidVendorService.class);
|
||||
}
|
||||
return contractBidVendorService;
|
||||
return getCachedBean(ContractBidVendorService.class);
|
||||
}
|
||||
|
||||
private CompanyService getCompanyService() {
|
||||
if (companyService == null) {
|
||||
companyService = SpringApp.getBean(CompanyService.class);
|
||||
}
|
||||
return companyService;
|
||||
return getBean(CompanyService.class);
|
||||
}
|
||||
|
||||
private CompanyFileService getCompanyFileService() {
|
||||
if (companyFileService == null) {
|
||||
companyFileService = SpringApp.getBean(CompanyFileService.class);
|
||||
}
|
||||
return companyFileService;
|
||||
return getCachedBean(CompanyFileService.class);
|
||||
}
|
||||
|
||||
private VendorGroupService getVendorGroupService() {
|
||||
if (vendorGroupService == null) {
|
||||
vendorGroupService = SpringApp.getBean(VendorGroupService.class);
|
||||
}
|
||||
return vendorGroupService;
|
||||
return getCachedBean(VendorGroupService.class);
|
||||
}
|
||||
|
||||
private VendorGroupRequireFileTypeService getVendorGroupRequireFileTypeService() {
|
||||
if (vendorGroupRequireFileTypeService == null) {
|
||||
vendorGroupRequireFileTypeService = SpringApp.getBean(VendorGroupRequireFileTypeService.class);
|
||||
}
|
||||
return vendorGroupRequireFileTypeService;
|
||||
return getCachedBean(VendorGroupRequireFileTypeService.class);
|
||||
}
|
||||
|
||||
private ExtendVendorInfoService getExtendVendorInfoService() {
|
||||
if (extendVendorInfoService == null) {
|
||||
extendVendorInfoService = SpringApp.getBean(ExtendVendorInfoService.class);
|
||||
}
|
||||
return extendVendorInfoService;
|
||||
return getCachedBean(ExtendVendorInfoService.class);
|
||||
}
|
||||
|
||||
private VendorService getVendorService() {
|
||||
if (vendorService == null) {
|
||||
vendorService = SpringApp.getBean(VendorService.class);
|
||||
}
|
||||
return vendorService;
|
||||
return getCachedBean(VendorService.class);
|
||||
}
|
||||
|
||||
private CompanyCustomerService getCompanyCustomerService() {
|
||||
if (companyCustomerService == null) {
|
||||
companyCustomerService = SpringApp.getBean(CompanyCustomerService.class);
|
||||
}
|
||||
return companyCustomerService;
|
||||
private CustomerService getCompanyCustomerService() {
|
||||
return getCachedBean(CustomerService.class);
|
||||
}
|
||||
|
||||
private CompanyCustomerFileService getCompanyCustomerFileService() {
|
||||
if (companyCustomerFileService == null) {
|
||||
companyCustomerFileService = SpringApp.getBean(CompanyCustomerFileService.class);
|
||||
}
|
||||
return companyCustomerFileService;
|
||||
return getCachedBean(CompanyCustomerFileService.class);
|
||||
}
|
||||
|
||||
private CompanyExtendInfoService getCompanyExtendInfoService() {
|
||||
if (companyExtendInfoService == null) {
|
||||
companyExtendInfoService = SpringApp.getBean(CompanyExtendInfoService.class);
|
||||
}
|
||||
return companyExtendInfoService;
|
||||
return getCachedBean(CompanyExtendInfoService.class);
|
||||
}
|
||||
|
||||
private EmployeeService getEmployeeService() {
|
||||
if (employeeService == null) {
|
||||
employeeService = SpringApp.getBean(EmployeeService.class);
|
||||
}
|
||||
return employeeService;
|
||||
return getCachedBean(EmployeeService.class);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -389,6 +319,7 @@ public class ContractVerifyComm {
|
||||
}
|
||||
}
|
||||
if (verifyVendor.get()) {
|
||||
|
||||
getVendorService().verify(contract, holder);
|
||||
}
|
||||
|
||||
@@ -581,7 +512,7 @@ public class ContractVerifyComm {
|
||||
valid = false;
|
||||
}
|
||||
|
||||
CompanyCustomerVo companyCustomer = getCompanyCustomerService().findByCompany(company);
|
||||
CustomerVo companyCustomer = getCompanyCustomerService().findByCompany(company);
|
||||
if (companyCustomer == null) {
|
||||
holder.warn("合同未关联客户");
|
||||
valid = false;
|
||||
@@ -602,7 +533,7 @@ public class ContractVerifyComm {
|
||||
return valid;
|
||||
}
|
||||
|
||||
private boolean verifyCustomerFileByContract(CompanyCustomerVo companyCustomer, ContractVo contract,
|
||||
private boolean verifyCustomerFileByContract(CustomerVo companyCustomer, ContractVo contract,
|
||||
MessageHolder holder) {
|
||||
List<LocalDate> verifyDates = new ArrayList<>();
|
||||
LocalDate minDate = LocalDate.of(2022, 1, 1);
|
||||
@@ -655,14 +586,14 @@ public class ContractVerifyComm {
|
||||
}
|
||||
|
||||
// 客户
|
||||
List<CompanyCustomerFileVo> files = getCompanyCustomerFileService().findAllByCustomer(companyCustomer);
|
||||
List<CustomerFileVo> files = getCompanyCustomerFileService().findAllByCustomer(companyCustomer);
|
||||
if (files == null || files.isEmpty()) {
|
||||
holder.warn("未见客户评估表");
|
||||
return false;
|
||||
}
|
||||
|
||||
for (LocalDate verifyDate : verifyDates) {
|
||||
CompanyCustomerFileVo customerFile = files.stream()
|
||||
CustomerFileVo customerFile = files.stream()
|
||||
.filter(v -> v.getSignDate() != null && v.isValid())
|
||||
.filter(v -> v.getType() == CustomerFileType.EvaluationForm)
|
||||
.filter(v -> MyDateTimeUtils.dateValidFilter(verifyDate, v.getSignDate(),
|
||||
@@ -673,10 +604,10 @@ public class ContractVerifyComm {
|
||||
}
|
||||
}
|
||||
|
||||
CompanyCustomerFileVo latestFile = files.stream()
|
||||
CustomerFileVo latestFile = files.stream()
|
||||
.filter(v -> v.getSignDate() != null && v.isValid())
|
||||
.filter(v -> v.getType() == CustomerFileType.EvaluationForm)
|
||||
.max(Comparator.comparing(CompanyCustomerFileVo::getSignDate))
|
||||
.max(Comparator.comparing(CustomerFileVo::getSignDate))
|
||||
.orElse(null);
|
||||
|
||||
if (latestFile == null) {
|
||||
|
||||
@@ -1,4 +1,55 @@
|
||||
package com.ecep.contract.task;
|
||||
|
||||
public class VendorReBuildFilesTasker {
|
||||
import com.ecep.contract.MessageHolder;
|
||||
import com.ecep.contract.WebSocketClientTasker;
|
||||
import com.ecep.contract.vo.VendorVo;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* 供应商文件重建任务器客户端实现
|
||||
* 用于通过WebSocket与服务器通信,重建供应商相关文件
|
||||
*/
|
||||
public class VendorReBuildFilesTasker extends Tasker<Object> implements WebSocketClientTasker {
|
||||
private static final Logger logger = LoggerFactory.getLogger(VendorReBuildFilesTasker.class);
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private VendorVo vendor;
|
||||
|
||||
@Getter
|
||||
protected boolean modified = false;
|
||||
|
||||
@Override
|
||||
public String getTaskName() {
|
||||
return "VendorReBuildFilesTasker";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProgress(long current, long total) {
|
||||
super.updateProgress(current, total);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object execute(MessageHolder holder) throws Exception {
|
||||
updateTitle("重建供应商文件");
|
||||
if (vendor == null) {
|
||||
holder.addMessage(java.util.logging.Level.SEVERE, "供应商信息不能为空");
|
||||
return null;
|
||||
}
|
||||
return callRemoteTask(holder, getLocale(), vendor.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理从服务器返回的修改状态
|
||||
* 当服务器端更新此属性时,客户端会接收到更新
|
||||
*
|
||||
* @param modified 文件是否被修改
|
||||
*/
|
||||
public void setModified(boolean modified) {
|
||||
this.modified = modified;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import com.ecep.contract.constant.ServiceConstant;
|
||||
public class ParamUtils {
|
||||
/**
|
||||
* 创建日期范围查询参数
|
||||
*
|
||||
*
|
||||
* @param key 查询字段名
|
||||
* @param begin 开始日期
|
||||
* @param end 结束日期
|
||||
@@ -28,7 +28,7 @@ public class ParamUtils {
|
||||
|
||||
/**
|
||||
* 创建等于条件查询参数
|
||||
*
|
||||
*
|
||||
* @param key 查询字段名
|
||||
* @param value 查询值
|
||||
* @return 包含等于条件的查询参数Map
|
||||
@@ -39,7 +39,7 @@ public class ParamUtils {
|
||||
|
||||
/**
|
||||
* 创建字符串模糊查询参数
|
||||
*
|
||||
*
|
||||
* @param key 查询字段名
|
||||
* @param value 模糊查询的字符串值
|
||||
* @return 包含模糊查询条件的查询参数Map
|
||||
@@ -52,7 +52,7 @@ public class ParamUtils {
|
||||
|
||||
/**
|
||||
* 创建日期模糊查询参数
|
||||
*
|
||||
*
|
||||
* @param key 查询字段名
|
||||
* @param value 模糊查询的日期值
|
||||
* @return 包含日期模糊查询条件的查询参数Map
|
||||
@@ -65,7 +65,7 @@ public class ParamUtils {
|
||||
|
||||
/**
|
||||
* 创建非空条件查询参数
|
||||
*
|
||||
*
|
||||
* @param key 查询字段名
|
||||
* @return 包含非空条件的查询参数Map
|
||||
*/
|
||||
@@ -77,7 +77,7 @@ public class ParamUtils {
|
||||
|
||||
/**
|
||||
* 创建小于条件的日期查询参数
|
||||
*
|
||||
*
|
||||
* @param key 查询字段名
|
||||
* @param value 比较的日期值
|
||||
* @return 包含小于条件的查询参数Map
|
||||
@@ -90,7 +90,7 @@ public class ParamUtils {
|
||||
|
||||
/**
|
||||
* 创建参数构建器实例
|
||||
*
|
||||
*
|
||||
* @return Builder实例,用于链式构建复杂查询条件
|
||||
*/
|
||||
public static Builder builder() {
|
||||
@@ -114,7 +114,7 @@ public class ParamUtils {
|
||||
|
||||
/**
|
||||
* 添加非空条件到构建器
|
||||
*
|
||||
*
|
||||
* @param key 查询字段名
|
||||
* @return 当前Builder实例,支持链式调用
|
||||
*/
|
||||
@@ -125,7 +125,7 @@ public class ParamUtils {
|
||||
|
||||
/**
|
||||
* 添加小于条件到构建器(针对日期类型)
|
||||
*
|
||||
*
|
||||
* @param key 查询字段名
|
||||
* @param value 比较的日期值
|
||||
* @return 当前Builder实例,支持链式调用
|
||||
@@ -137,7 +137,7 @@ public class ParamUtils {
|
||||
|
||||
/**
|
||||
* 添加大于条件到构建器(针对日期类型)
|
||||
*
|
||||
*
|
||||
* @param key 查询字段名
|
||||
* @param value 比较的日期值
|
||||
* @return 当前Builder实例,支持链式调用
|
||||
@@ -149,7 +149,7 @@ public class ParamUtils {
|
||||
|
||||
/**
|
||||
* 添加等于条件到构建器
|
||||
*
|
||||
*
|
||||
* @param key 查询字段名
|
||||
* @param value 查询值
|
||||
* @return 当前Builder实例,支持链式调用
|
||||
@@ -161,20 +161,24 @@ public class ParamUtils {
|
||||
|
||||
/**
|
||||
* 添加日期范围条件到构建器
|
||||
*
|
||||
*
|
||||
* @param key 查询字段名
|
||||
* @param begin 开始日期
|
||||
* @param end 结束日期
|
||||
* @return 当前Builder实例,支持链式调用
|
||||
*/
|
||||
public Builder between(String key, LocalDate begin, LocalDate end) {
|
||||
params.put(key, Map.of("begin", begin, "end", end));
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("begin", begin);
|
||||
params.put("end", end);
|
||||
this.params.put(key, params);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加全文搜索条件到构建器
|
||||
*
|
||||
*
|
||||
* @param searchText 搜索文本
|
||||
* @return 当前Builder实例,支持链式调用
|
||||
*/
|
||||
@@ -185,7 +189,7 @@ public class ParamUtils {
|
||||
|
||||
/**
|
||||
* 构建并返回查询参数Map
|
||||
*
|
||||
*
|
||||
* @return 包含所有添加条件的查询参数Map
|
||||
*/
|
||||
public Map<String, Object> build() {
|
||||
@@ -194,7 +198,7 @@ public class ParamUtils {
|
||||
|
||||
/**
|
||||
* 添加AND逻辑条件组到构建器
|
||||
*
|
||||
*
|
||||
* @param consumer Builder消费者,用于构建子条件
|
||||
* @return 当前Builder实例,支持链式调用
|
||||
*/
|
||||
@@ -207,7 +211,7 @@ public class ParamUtils {
|
||||
|
||||
/**
|
||||
* 添加OR逻辑条件组到构建器
|
||||
*
|
||||
*
|
||||
* @param consumer Builder消费者,用于构建子条件
|
||||
* @return 当前Builder实例,支持链式调用
|
||||
*/
|
||||
|
||||
@@ -4,7 +4,7 @@ import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.ecep.contract.vo.CompanyCustomerVo;
|
||||
import com.ecep.contract.vo.CustomerVo;
|
||||
|
||||
import javafx.beans.property.SimpleIntegerProperty;
|
||||
import javafx.beans.property.SimpleObjectProperty;
|
||||
@@ -14,7 +14,7 @@ import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class CompanyCustomerViewModel extends IdentityViewModel<CompanyCustomerVo> {
|
||||
public class CompanyCustomerViewModel extends IdentityViewModel<CustomerVo> {
|
||||
private SimpleStringProperty state = new SimpleStringProperty();
|
||||
/**
|
||||
* 关联的企业,Company
|
||||
@@ -39,13 +39,13 @@ public class CompanyCustomerViewModel extends IdentityViewModel<CompanyCustomerV
|
||||
private SimpleObjectProperty<LocalDateTime> created = new SimpleObjectProperty<>();
|
||||
private SimpleIntegerProperty version = new SimpleIntegerProperty();
|
||||
|
||||
public static CompanyCustomerViewModel from(CompanyCustomerVo cc) {
|
||||
public static CompanyCustomerViewModel from(CustomerVo cc) {
|
||||
CompanyCustomerViewModel model = new CompanyCustomerViewModel();
|
||||
model.update(cc);
|
||||
return model;
|
||||
}
|
||||
|
||||
public void updateFrom(CompanyCustomerVo c) {
|
||||
public void updateFrom(CustomerVo c) {
|
||||
super.updateFrom(c);
|
||||
getCompany().set(c.getCompanyId());
|
||||
getCatalog().set(c.getCatalogId());
|
||||
@@ -57,7 +57,7 @@ public class CompanyCustomerViewModel extends IdentityViewModel<CompanyCustomerV
|
||||
version.set(c.getVersion());
|
||||
}
|
||||
|
||||
public boolean copyTo(CompanyCustomerVo v) {
|
||||
public boolean copyTo(CustomerVo v) {
|
||||
boolean modified = super.copyTo(v);
|
||||
if (!Objects.equals(company.get(), v.getCompanyId())) {
|
||||
v.setCompanyId(company.get());
|
||||
|
||||
@@ -4,7 +4,7 @@ import java.time.LocalDate;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.ecep.contract.CustomerFileType;
|
||||
import com.ecep.contract.vo.CompanyCustomerFileVo;
|
||||
import com.ecep.contract.vo.CustomerFileVo;
|
||||
|
||||
import javafx.beans.property.SimpleBooleanProperty;
|
||||
import javafx.beans.property.SimpleObjectProperty;
|
||||
@@ -16,10 +16,10 @@ import lombok.ToString;
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ToString
|
||||
public class CompanyCustomerFileViewModel extends IdentityViewModel<CompanyCustomerFileVo> {
|
||||
public class CustomerFileViewModel extends IdentityViewModel<CustomerFileVo> {
|
||||
|
||||
public static CompanyCustomerFileViewModel from(CompanyCustomerFileVo companyCustomerFile) {
|
||||
CompanyCustomerFileViewModel model = new CompanyCustomerFileViewModel();
|
||||
public static CustomerFileViewModel from(CustomerFileVo companyCustomerFile) {
|
||||
CustomerFileViewModel model = new CustomerFileViewModel();
|
||||
model.update(companyCustomerFile);
|
||||
return model;
|
||||
}
|
||||
@@ -44,7 +44,7 @@ public class CompanyCustomerFileViewModel extends IdentityViewModel<CompanyCusto
|
||||
private SimpleBooleanProperty valid = new SimpleBooleanProperty(this, "valid", false);
|
||||
|
||||
@Override
|
||||
protected void updateFrom(CompanyCustomerFileVo v) {
|
||||
protected void updateFrom(CustomerFileVo v) {
|
||||
super.updateFrom(v);
|
||||
getCustomer().set(v.getCustomer());
|
||||
getType().set(v.getType());
|
||||
@@ -56,7 +56,7 @@ public class CompanyCustomerFileViewModel extends IdentityViewModel<CompanyCusto
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean copyTo(CompanyCustomerFileVo v) {
|
||||
public boolean copyTo(CustomerFileVo v) {
|
||||
boolean modified = super.copyTo(v);
|
||||
if (!Objects.equals(customer.get(), v.getCustomer())) {
|
||||
v.setCustomer(customer.get());
|
||||
Reference in New Issue
Block a user