refactor(client): 重构银行和公司相关代码
- 更新了多个类中的导入语句,替换了模型类为对应的VO类 - 优化了部分方法的参数和返回类型,使用VO类替代模型类 - 重构了自动补全功能,使用统一的泛型方法 - 添加了缓存注解,提高了数据访问性能 - 优化了部分代码结构,提高了可维护性
This commit is contained in:
@@ -3,16 +3,16 @@ package com.ecep.contract.controller.bank;
|
|||||||
import com.ecep.contract.controller.AbstEntityManagerSkin;
|
import com.ecep.contract.controller.AbstEntityManagerSkin;
|
||||||
import com.ecep.contract.controller.ManagerSkin;
|
import com.ecep.contract.controller.ManagerSkin;
|
||||||
import com.ecep.contract.controller.table.EditableEntityTableTabSkin;
|
import com.ecep.contract.controller.table.EditableEntityTableTabSkin;
|
||||||
import com.ecep.contract.model.Bank;
|
|
||||||
import com.ecep.contract.vm.BankViewModel;
|
import com.ecep.contract.vm.BankViewModel;
|
||||||
|
import com.ecep.contract.vo.BankVo;
|
||||||
|
|
||||||
import javafx.scene.control.TableColumn;
|
import javafx.scene.control.TableColumn;
|
||||||
import javafx.scene.control.cell.TextFieldTableCell;
|
import javafx.scene.control.cell.TextFieldTableCell;
|
||||||
|
|
||||||
|
|
||||||
public class BankManagerSkin
|
public class BankManagerSkin
|
||||||
extends AbstEntityManagerSkin<Bank, BankViewModel, BankManagerSkin, BankManagerWindowController>
|
extends AbstEntityManagerSkin<BankVo, BankViewModel, BankManagerSkin, BankManagerWindowController>
|
||||||
implements ManagerSkin, EditableEntityTableTabSkin<Bank, BankViewModel> {
|
implements ManagerSkin, EditableEntityTableTabSkin<BankVo, BankViewModel> {
|
||||||
|
|
||||||
public BankManagerSkin(BankManagerWindowController controller) {
|
public BankManagerSkin(BankManagerWindowController controller) {
|
||||||
super(controller);
|
super(controller);
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ import org.springframework.context.annotation.Scope;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import com.ecep.contract.controller.AbstManagerWindowController;
|
import com.ecep.contract.controller.AbstManagerWindowController;
|
||||||
import com.ecep.contract.model.Bank;
|
|
||||||
import com.ecep.contract.service.BankService;
|
import com.ecep.contract.service.BankService;
|
||||||
import com.ecep.contract.util.FxmlPath;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
import com.ecep.contract.vm.BankViewModel;
|
import com.ecep.contract.vm.BankViewModel;
|
||||||
|
import com.ecep.contract.vo.BankVo;
|
||||||
|
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.scene.control.TableColumn;
|
import javafx.scene.control.TableColumn;
|
||||||
@@ -19,7 +19,7 @@ import javafx.scene.control.TableColumn;
|
|||||||
@Component
|
@Component
|
||||||
@FxmlPath("/ui/bank-manager.fxml")
|
@FxmlPath("/ui/bank-manager.fxml")
|
||||||
public class BankManagerWindowController
|
public class BankManagerWindowController
|
||||||
extends AbstManagerWindowController<Bank, BankViewModel, BankManagerSkin> {
|
extends AbstManagerWindowController<BankVo, BankViewModel, BankManagerSkin> {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private BankService bankService;
|
private BankService bankService;
|
||||||
|
|||||||
@@ -1,29 +1,20 @@
|
|||||||
package com.ecep.contract.controller.bank.account;
|
package com.ecep.contract.controller.bank.account;
|
||||||
|
|
||||||
import com.ecep.contract.SpringApp;
|
|
||||||
import com.ecep.contract.controller.company.CompanyWindowController;
|
import com.ecep.contract.controller.company.CompanyWindowController;
|
||||||
import com.ecep.contract.controller.tab.AbstEntityBasedTabSkin;
|
import com.ecep.contract.controller.tab.AbstEntityBasedTabSkin;
|
||||||
import com.ecep.contract.controller.tab.TabSkin;
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
import com.ecep.contract.converter.BankStringConverter;
|
|
||||||
import com.ecep.contract.converter.CompanyStringConverter;
|
|
||||||
import com.ecep.contract.model.Company;
|
|
||||||
import com.ecep.contract.model.CompanyBankAccount;
|
|
||||||
import com.ecep.contract.service.BankService;
|
import com.ecep.contract.service.BankService;
|
||||||
import com.ecep.contract.service.CompanyService;
|
import com.ecep.contract.service.CompanyService;
|
||||||
import com.ecep.contract.util.UITools;
|
import com.ecep.contract.util.UITools;
|
||||||
import com.ecep.contract.vm.CompanyBankAccountViewModel;
|
import com.ecep.contract.vm.CompanyBankAccountViewModel;
|
||||||
|
import com.ecep.contract.vo.CompanyBankAccountVo;
|
||||||
|
import com.ecep.contract.vo.CompanyVo;
|
||||||
|
|
||||||
import javafx.scene.control.Tab;
|
import javafx.scene.control.Tab;
|
||||||
import javafx.scene.control.TextField;
|
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
public class BankAccountBaseTabSkin
|
public class BankAccountBaseTabSkin
|
||||||
extends AbstEntityBasedTabSkin<BankAccountWindowController, CompanyBankAccount, CompanyBankAccountViewModel>
|
extends AbstEntityBasedTabSkin<BankAccountWindowController, CompanyBankAccountVo, CompanyBankAccountViewModel>
|
||||||
implements TabSkin {
|
implements TabSkin {
|
||||||
@Setter
|
|
||||||
private CompanyService companyService;
|
|
||||||
@Setter
|
|
||||||
private BankService bankService;
|
|
||||||
|
|
||||||
public BankAccountBaseTabSkin(BankAccountWindowController controller) {
|
public BankAccountBaseTabSkin(BankAccountWindowController controller) {
|
||||||
super(controller);
|
super(controller);
|
||||||
@@ -37,8 +28,9 @@ public class BankAccountBaseTabSkin
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initializeTab() {
|
public void initializeTab() {
|
||||||
initializeBaseTabCompanyFieldAutoCompletion(controller.companyField);
|
UITools.autoCompletion(controller.companyField, viewModel.getCompanyId(), getCompanyService());
|
||||||
initializeBaseTabBankFieldAutoCompletion(controller.bankField);
|
|
||||||
|
UITools.autoCompletion(controller.bankField, viewModel.getBankId(), getBankService());
|
||||||
|
|
||||||
controller.openingBankField.textProperty().bindBidirectional(viewModel.getOpeningBank());
|
controller.openingBankField.textProperty().bindBidirectional(viewModel.getOpeningBank());
|
||||||
controller.bankAccountField.textProperty().bindBidirectional(viewModel.getAccount());
|
controller.bankAccountField.textProperty().bindBidirectional(viewModel.getAccount());
|
||||||
@@ -47,36 +39,21 @@ public class BankAccountBaseTabSkin
|
|||||||
controller.createdField.textProperty().bind(viewModel.getCreated().asString());
|
controller.createdField.textProperty().bind(viewModel.getCreated().asString());
|
||||||
controller.versionLabel.textProperty().bind(viewModel.getVersion().asString());
|
controller.versionLabel.textProperty().bind(viewModel.getVersion().asString());
|
||||||
|
|
||||||
controller.relativeCompanyBtn.disableProperty().bind(viewModel.getCompany().isNull());
|
controller.relativeCompanyBtn.disableProperty().bind(viewModel.getCompanyId().isNull());
|
||||||
controller.relativeCompanyBtn.setOnAction(event -> {
|
controller.relativeCompanyBtn.setOnAction(event -> {
|
||||||
Company company = viewModel.getCompany().get();
|
Integer companyId = viewModel.getCompanyId().get();
|
||||||
if (company != null) {
|
if (companyId != null) {
|
||||||
|
CompanyVo company = getCompanyService().findById(companyId);
|
||||||
CompanyWindowController.show(company, controller.root.getScene().getWindow());
|
CompanyWindowController.show(company, controller.root.getScene().getWindow());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeBaseTabCompanyFieldAutoCompletion(TextField textField) {
|
|
||||||
CompanyStringConverter converter = SpringApp.getBean(CompanyStringConverter.class);
|
|
||||||
UITools.autoCompletion(textField, viewModel.getCompany(), converter::suggest, converter);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initializeBaseTabBankFieldAutoCompletion(TextField textField) {
|
|
||||||
BankStringConverter converter = SpringApp.getBean(BankStringConverter.class);
|
|
||||||
UITools.autoCompletion(textField, viewModel.getBank(), converter::suggest, converter);
|
|
||||||
}
|
|
||||||
|
|
||||||
public BankService getBankService() {
|
public BankService getBankService() {
|
||||||
if (bankService == null) {
|
return getCachedBean(BankService.class);
|
||||||
bankService = getBean(BankService.class);
|
|
||||||
}
|
|
||||||
return bankService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public CompanyService getCompanyService() {
|
public CompanyService getCompanyService() {
|
||||||
if (companyService == null) {
|
return getCachedBean(CompanyService.class);
|
||||||
companyService = getBean(CompanyService.class);
|
|
||||||
}
|
|
||||||
return companyService;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.ecep.contract.model.CompanyBankAccount;
|
|||||||
import com.ecep.contract.service.CompanyBankAccountService;
|
import com.ecep.contract.service.CompanyBankAccountService;
|
||||||
import com.ecep.contract.util.FxmlPath;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
import com.ecep.contract.vm.CompanyBankAccountViewModel;
|
import com.ecep.contract.vm.CompanyBankAccountViewModel;
|
||||||
|
import com.ecep.contract.vo.CompanyBankAccountVo;
|
||||||
|
|
||||||
import javafx.scene.control.Button;
|
import javafx.scene.control.Button;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
@@ -25,7 +26,7 @@ import javafx.stage.WindowEvent;
|
|||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
@Component
|
@Component
|
||||||
@FxmlPath("/ui/company/bank-account.fxml")
|
@FxmlPath("/ui/company/bank-account.fxml")
|
||||||
public class BankAccountWindowController extends AbstEntityController<CompanyBankAccount, CompanyBankAccountViewModel> {
|
public class BankAccountWindowController extends AbstEntityController<CompanyBankAccountVo, CompanyBankAccountViewModel> {
|
||||||
public BorderPane root;
|
public BorderPane root;
|
||||||
public TabPane tabPane;
|
public TabPane tabPane;
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +1,21 @@
|
|||||||
package com.ecep.contract.controller.company;
|
package com.ecep.contract.controller.company;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.ecep.contract.controller.tab.TabSkin;
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
import com.ecep.contract.controller.table.AbstEntityTableTabSkin;
|
import com.ecep.contract.controller.table.AbstEntityTableTabSkin;
|
||||||
import com.ecep.contract.controller.table.TableOfTabSkin;
|
import com.ecep.contract.controller.table.TableOfTabSkin;
|
||||||
import com.ecep.contract.model.Company;
|
|
||||||
import com.ecep.contract.model.IdentityEntity;
|
import com.ecep.contract.model.IdentityEntity;
|
||||||
import com.ecep.contract.service.CompanyService;
|
import com.ecep.contract.service.CompanyService;
|
||||||
|
import com.ecep.contract.util.ParamUtils;
|
||||||
import com.ecep.contract.vm.CompanyBasedViewModel;
|
import com.ecep.contract.vm.CompanyBasedViewModel;
|
||||||
import com.ecep.contract.vm.CompanyViewModel;
|
import com.ecep.contract.vm.CompanyViewModel;
|
||||||
import com.ecep.contract.vm.IdentityViewModel;
|
import com.ecep.contract.vm.IdentityViewModel;
|
||||||
|
import com.ecep.contract.vo.CompanyVo;
|
||||||
|
|
||||||
public abstract class AbstCompanyTableTabSkin<T extends IdentityEntity, TV extends IdentityViewModel<T>>
|
public abstract class AbstCompanyTableTabSkin<T extends IdentityEntity, TV extends IdentityViewModel<T>>
|
||||||
extends AbstEntityTableTabSkin<CompanyWindowController, Company, CompanyViewModel, T, TV>
|
extends AbstEntityTableTabSkin<CompanyWindowController, CompanyVo, CompanyViewModel, T, TV>
|
||||||
implements TabSkin, TableOfTabSkin<Company, T, TV> {
|
implements TabSkin, TableOfTabSkin<CompanyVo, T, TV> {
|
||||||
|
|
||||||
public AbstCompanyTableTabSkin(CompanyWindowController controller) {
|
public AbstCompanyTableTabSkin(CompanyWindowController controller) {
|
||||||
super(controller);
|
super(controller);
|
||||||
@@ -26,7 +26,7 @@ public abstract class AbstCompanyTableTabSkin<T extends IdentityEntity, TV exten
|
|||||||
protected TV createNewViewModel() {
|
protected TV createNewViewModel() {
|
||||||
TV model = super.createNewViewModel();
|
TV model = super.createNewViewModel();
|
||||||
if (model instanceof CompanyBasedViewModel m) {
|
if (model instanceof CompanyBasedViewModel m) {
|
||||||
m.getCompany().set(getEntity());
|
m.getCompanyId().set(getEntity().getId());
|
||||||
}
|
}
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
@@ -40,13 +40,8 @@ public abstract class AbstCompanyTableTabSkin<T extends IdentityEntity, TV exten
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> getSpecification(Company parent) {
|
public Map<String, Object> getSpecification(CompanyVo parent) {
|
||||||
Map<String, Object> params = getSpecification();
|
return ParamUtils.equal("company", parent.getId());
|
||||||
if (params == null) {
|
|
||||||
params = new HashMap<>();
|
|
||||||
}
|
|
||||||
params.put("company", parent.getId());
|
|
||||||
return params;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ import com.ecep.contract.util.FxmlPath;
|
|||||||
import com.ecep.contract.util.ProxyUtils;
|
import com.ecep.contract.util.ProxyUtils;
|
||||||
import com.ecep.contract.util.UITools;
|
import com.ecep.contract.util.UITools;
|
||||||
import com.ecep.contract.vm.CompanyViewModel;
|
import com.ecep.contract.vm.CompanyViewModel;
|
||||||
|
import com.ecep.contract.vo.CompanyVo;
|
||||||
|
|
||||||
import javafx.beans.property.SimpleObjectProperty;
|
import javafx.beans.property.SimpleObjectProperty;
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
@@ -61,16 +62,11 @@ import javafx.stage.Window;
|
|||||||
@Component
|
@Component
|
||||||
@FxmlPath("/ui/company/company.fxml")
|
@FxmlPath("/ui/company/company.fxml")
|
||||||
public class CompanyWindowController
|
public class CompanyWindowController
|
||||||
extends AbstEntityController<Company, CompanyViewModel> {
|
extends AbstEntityController<CompanyVo, CompanyViewModel> {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(CompanyWindowController.class);
|
private static final Logger logger = LoggerFactory.getLogger(CompanyWindowController.class);
|
||||||
|
|
||||||
public static void show(Company company, Window window) {
|
public static void show(CompanyVo company, Window window) {
|
||||||
CompanyViewModel viewModel = new CompanyViewModel();
|
show(CompanyViewModel.from(company), window);
|
||||||
if (!ProxyUtils.isInitialized(company)) {
|
|
||||||
company = SpringApp.getBean(CompanyService.class).findById(company.getId());
|
|
||||||
}
|
|
||||||
viewModel.update(company);
|
|
||||||
show(viewModel, window);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -269,7 +265,7 @@ public class CompanyWindowController
|
|||||||
* 企业合规检查
|
* 企业合规检查
|
||||||
*/
|
*/
|
||||||
public void onCompanyVerifyAction(ActionEvent event) {
|
public void onCompanyVerifyAction(ActionEvent event) {
|
||||||
Company company = getEntity();
|
CompanyVo company = getEntity();
|
||||||
CompanyVerifyTasker task = new CompanyVerifyTasker();
|
CompanyVerifyTasker task = new CompanyVerifyTasker();
|
||||||
task.setCompanyService(companyService);
|
task.setCompanyService(companyService);
|
||||||
task.setCompany(company);
|
task.setCompany(company);
|
||||||
@@ -277,7 +273,7 @@ public class CompanyWindowController
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onCompanyOpenInExplorerAction(ActionEvent event) {
|
public void onCompanyOpenInExplorerAction(ActionEvent event) {
|
||||||
Company company = getEntity();
|
CompanyVo company = getEntity();
|
||||||
String path = company.getPath();
|
String path = company.getPath();
|
||||||
|
|
||||||
CompletableFuture.runAsync(() -> {
|
CompletableFuture.runAsync(() -> {
|
||||||
|
|||||||
@@ -3,9 +3,7 @@ package com.ecep.contract.controller.project;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.BiFunction;
|
import java.util.function.BiFunction;
|
||||||
|
|
||||||
import com.ecep.contract.service.*;
|
|
||||||
import org.controlsfx.control.textfield.AutoCompletionBinding;
|
import org.controlsfx.control.textfield.AutoCompletionBinding;
|
||||||
import com.ecep.contract.util.ProxyUtils;
|
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import com.ecep.contract.SpringApp;
|
import com.ecep.contract.SpringApp;
|
||||||
@@ -13,13 +11,20 @@ import com.ecep.contract.controller.company.CompanyWindowController;
|
|||||||
import com.ecep.contract.controller.tab.TabSkin;
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
import com.ecep.contract.converter.CompanyStringConverter;
|
import com.ecep.contract.converter.CompanyStringConverter;
|
||||||
import com.ecep.contract.converter.EntityStringConverter;
|
import com.ecep.contract.converter.EntityStringConverter;
|
||||||
import com.ecep.contract.model.Bank;
|
|
||||||
import com.ecep.contract.model.Company;
|
import com.ecep.contract.model.Company;
|
||||||
import com.ecep.contract.model.CompanyBankAccount;
|
import com.ecep.contract.model.CompanyBankAccount;
|
||||||
import com.ecep.contract.model.CompanyContact;
|
import com.ecep.contract.model.CompanyContact;
|
||||||
import com.ecep.contract.model.CompanyInvoiceInfo;
|
import com.ecep.contract.model.CompanyInvoiceInfo;
|
||||||
|
import com.ecep.contract.service.BankService;
|
||||||
|
import com.ecep.contract.service.CompanyBankAccountService;
|
||||||
|
import com.ecep.contract.service.CompanyContactService;
|
||||||
|
import com.ecep.contract.service.CompanyInvoiceInfoService;
|
||||||
|
import com.ecep.contract.service.CompanyService;
|
||||||
import com.ecep.contract.util.FxmlPath;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
|
import com.ecep.contract.util.ProxyUtils;
|
||||||
import com.ecep.contract.util.UITools;
|
import com.ecep.contract.util.UITools;
|
||||||
|
import com.ecep.contract.vo.BankVo;
|
||||||
|
import com.ecep.contract.vo.CompanyVo;
|
||||||
|
|
||||||
import javafx.beans.property.SimpleObjectProperty;
|
import javafx.beans.property.SimpleObjectProperty;
|
||||||
import javafx.beans.property.StringProperty;
|
import javafx.beans.property.StringProperty;
|
||||||
@@ -103,7 +108,7 @@ public class ProjectTabSkinCustomerInfo
|
|||||||
});
|
});
|
||||||
|
|
||||||
companyDetailBtn.setOnAction(event -> {
|
companyDetailBtn.setOnAction(event -> {
|
||||||
Company company = viewModel.getCustomer().get();
|
CompanyVo company = viewModel.getCustomer().get();
|
||||||
if (company == null) {
|
if (company == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -204,7 +209,7 @@ public class ProjectTabSkinCustomerInfo
|
|||||||
}
|
}
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("开户行:");
|
sb.append("开户行:");
|
||||||
Bank bank = account.getBank();
|
BankVo bank = account.getBank();
|
||||||
if (bank != null) {
|
if (bank != null) {
|
||||||
if (!ProxyUtils.isInitialized(bank)) {
|
if (!ProxyUtils.isInitialized(bank)) {
|
||||||
bank = getBankService().findById(bank.getId());
|
bank = getBankService().findById(bank.getId());
|
||||||
|
|||||||
@@ -4,18 +4,20 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import com.ecep.contract.model.Bank;
|
|
||||||
import com.ecep.contract.service.BankService;
|
import com.ecep.contract.service.BankService;
|
||||||
|
import com.ecep.contract.vo.BankVo;
|
||||||
|
|
||||||
import jakarta.annotation.PostConstruct;
|
import jakarta.annotation.PostConstruct;
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@Component
|
@Component
|
||||||
public class BankStringConverter extends EntityStringConverter<Bank> {
|
@Deprecated
|
||||||
|
public class BankStringConverter extends EntityStringConverter<BankVo> {
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@Autowired
|
@Autowired
|
||||||
BankService service;
|
BankService service;
|
||||||
|
|
||||||
public BankStringConverter() {
|
public BankStringConverter() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,63 @@
|
|||||||
package com.ecep.contract.service;
|
package com.ecep.contract.service;
|
||||||
|
|
||||||
import java.util.List;
|
import org.springframework.cache.annotation.CacheConfig;
|
||||||
|
import org.springframework.cache.annotation.CacheEvict;
|
||||||
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
|
import org.springframework.cache.annotation.Caching;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.ecep.contract.model.Bank;
|
import com.ecep.contract.util.ParamUtils;
|
||||||
import com.ecep.contract.vm.BankViewModel;
|
import com.ecep.contract.vm.BankViewModel;
|
||||||
|
import com.ecep.contract.vo.BankVo;
|
||||||
|
|
||||||
|
import javafx.util.StringConverter;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class BankService extends QueryService<Bank, BankViewModel> {
|
@CacheConfig(cacheNames = "bank")
|
||||||
public Bank findByName(String name) {
|
public class BankService extends QueryService<BankVo, BankViewModel> {
|
||||||
return null;
|
@Cacheable(key = "#p0")
|
||||||
|
@Override
|
||||||
|
public BankVo findById(Integer id) {
|
||||||
|
return super.findById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BankVo findByName(String name) {
|
||||||
|
Page<BankVo> page = findAll(ParamUtils.equal(name, name), Pageable.ofSize(1));
|
||||||
|
if (page.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return page.getContent().getFirst();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Caching(evict = { @CacheEvict(key = "#p0.id") })
|
||||||
|
@Override
|
||||||
|
public BankVo save(BankVo entity) {
|
||||||
|
return super.save(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Caching(evict = { @CacheEvict(key = "#p0.id") })
|
||||||
|
@Override
|
||||||
|
public void delete(BankVo entity) {
|
||||||
|
super.delete(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
private StringConverter<BankVo> stringConverter = new StringConverter<BankVo>() {
|
||||||
|
@Override
|
||||||
|
public String toString(BankVo object) {
|
||||||
|
return object == null ? "" : object.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BankVo fromString(String string) {
|
||||||
|
return findByName(string);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public StringConverter<BankVo> getStringConverter() {
|
||||||
|
return stringConverter;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,13 +5,13 @@ import java.util.List;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.ecep.contract.model.Company;
|
import com.ecep.contract.model.Company;
|
||||||
import com.ecep.contract.model.CompanyBankAccount;
|
|
||||||
import com.ecep.contract.vm.CompanyBankAccountViewModel;
|
import com.ecep.contract.vm.CompanyBankAccountViewModel;
|
||||||
|
import com.ecep.contract.vo.CompanyBankAccountVo;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class CompanyBankAccountService extends QueryService<CompanyBankAccount, CompanyBankAccountViewModel> {
|
public class CompanyBankAccountService extends QueryService<CompanyBankAccountVo, CompanyBankAccountViewModel> {
|
||||||
|
|
||||||
public List<CompanyBankAccount> searchByCompany(Company company, String searchText) {
|
public List<CompanyBankAccountVo> searchByCompany(Company company, String searchText) {
|
||||||
throw new UnsupportedOperationException("未实现");
|
throw new UnsupportedOperationException("未实现");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,24 +1,22 @@
|
|||||||
package com.ecep.contract.service;
|
package com.ecep.contract.service;
|
||||||
|
|
||||||
import com.ecep.contract.MessageHolder;
|
import java.io.File;
|
||||||
import com.ecep.contract.model.Company;
|
|
||||||
import com.ecep.contract.model.CompanyCustomer;
|
|
||||||
import com.ecep.contract.vm.CompanyCustomerViewModel;
|
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.io.File;
|
import com.ecep.contract.MessageHolder;
|
||||||
import java.util.HashMap;
|
import com.ecep.contract.model.CompanyCustomer;
|
||||||
import java.util.Map;
|
import com.ecep.contract.util.ParamUtils;
|
||||||
|
import com.ecep.contract.vm.CompanyCustomerViewModel;
|
||||||
|
import com.ecep.contract.vo.CompanyVo;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class CompanyCustomerService extends QueryService<CompanyCustomer, CompanyCustomerViewModel> {
|
public class CompanyCustomerService extends QueryService<CompanyCustomer, CompanyCustomerViewModel> {
|
||||||
|
|
||||||
public CompanyCustomer findByCompany(Company company) {
|
public CompanyCustomer findByCompany(CompanyVo company) {
|
||||||
Map<String, Object> params = new HashMap<>();
|
Page<CompanyCustomer> page = findAll(ParamUtils.equal("company", company.getId()), Pageable.ofSize(1));
|
||||||
params.put("company", company.getId());
|
|
||||||
Page<CompanyCustomer> page = findAll(params, Pageable.ofSize(1));
|
|
||||||
if (page.isEmpty()) {
|
if (page.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,22 @@
|
|||||||
package com.ecep.contract.service;
|
package com.ecep.contract.service;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import com.ecep.contract.vo.CompanyOldNameVo;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import com.ecep.contract.CompanyFileType;
|
import com.ecep.contract.CompanyFileType;
|
||||||
import com.ecep.contract.MessageHolder;
|
import com.ecep.contract.MessageHolder;
|
||||||
import com.ecep.contract.MyDateTimeUtils;
|
import com.ecep.contract.MyDateTimeUtils;
|
||||||
@@ -12,17 +29,10 @@ import com.ecep.contract.model.CompanyOldName;
|
|||||||
import com.ecep.contract.util.FileUtils;
|
import com.ecep.contract.util.FileUtils;
|
||||||
import com.ecep.contract.util.ParamUtils;
|
import com.ecep.contract.util.ParamUtils;
|
||||||
import com.ecep.contract.vm.CompanyFileViewModel;
|
import com.ecep.contract.vm.CompanyFileViewModel;
|
||||||
import javafx.collections.ObservableList;
|
import com.ecep.contract.vo.CompanyFileVo;
|
||||||
import org.springframework.data.domain.Pageable;
|
import com.ecep.contract.vo.CompanyVo;
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
|
|
||||||
import java.io.File;
|
import javafx.collections.ObservableList;
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.function.Consumer;
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class CompanyFileService extends QueryService<CompanyFile, CompanyFileViewModel> {
|
public class CompanyFileService extends QueryService<CompanyFile, CompanyFileViewModel> {
|
||||||
@@ -295,16 +305,16 @@ public class CompanyFileService extends QueryService<CompanyFile, CompanyFileVie
|
|||||||
* @param files 要被移动的文件集合,需要从中选择需要的
|
* @param files 要被移动的文件集合,需要从中选择需要的
|
||||||
* @param holder 状态输出
|
* @param holder 状态输出
|
||||||
*/
|
*/
|
||||||
public boolean retrieveFromDownloadFiles(Company company, File[] files, MessageHolder holder) {
|
public boolean retrieveFromDownloadFiles(CompanyVo company, File[] files, MessageHolder holder) {
|
||||||
Map<String, File> map = new HashMap<>();
|
Map<String, File> map = new HashMap<>();
|
||||||
File home = new File(company.getPath());
|
File home = new File(company.getPath());
|
||||||
map.put(company.getName(), home);
|
map.put(company.getName(), home);
|
||||||
List<CompanyFile> retrieveFiles = new ArrayList<>();
|
List<CompanyFileVo> retrieveFiles = new ArrayList<>();
|
||||||
|
|
||||||
List<CompanyOldName> oldNames = SpringApp.getBean(CompanyOldNameService.class).findAllByCompany(company);
|
List<CompanyOldNameVo> oldNames = SpringApp.getBean(CompanyOldNameService.class).findAllByCompany(company);
|
||||||
|
|
||||||
// 获取所有曾用名
|
// 获取所有曾用名
|
||||||
for (CompanyOldName companyOldName : oldNames) {
|
for (CompanyOldNameVo companyOldName : oldNames) {
|
||||||
String name = companyOldName.getName();
|
String name = companyOldName.getName();
|
||||||
if (!StringUtils.hasText(name)) {
|
if (!StringUtils.hasText(name)) {
|
||||||
continue;
|
continue;
|
||||||
@@ -375,13 +385,13 @@ public class CompanyFileService extends QueryService<CompanyFile, CompanyFileVie
|
|||||||
* @param holder 状态输出
|
* @param holder 状态输出
|
||||||
* @return 生成的公司文件对象,如果无法转换则返回null
|
* @return 生成的公司文件对象,如果无法转换则返回null
|
||||||
*/
|
*/
|
||||||
private CompanyFile fillDownloadFileType(Company company, File file, String companyName, File destDir,
|
private CompanyFileVo fillDownloadFileType(CompanyVo company, File file, String companyName, File destDir,
|
||||||
MessageHolder holder) {
|
MessageHolder holder) {
|
||||||
String fileName = file.getName();
|
String fileName = file.getName();
|
||||||
// 天眼查的报告
|
// 天眼查的报告
|
||||||
// 目前只有 基础版企业信用报告, 企业信用信息公示报告下载保存时的文件名中没有天眼查
|
// 目前只有 基础版企业信用报告, 企业信用信息公示报告下载保存时的文件名中没有天眼查
|
||||||
if (CloudTycService.isTycReport(fileName)) {
|
if (CloudTycService.isTycReport(fileName)) {
|
||||||
CompanyFile companyFile = new CompanyFile();
|
CompanyFileVo companyFile = new CompanyFileVo();
|
||||||
companyFile.setType(CompanyFileType.CreditReport);
|
companyFile.setType(CompanyFileType.CreditReport);
|
||||||
fillApplyDateAbsent(file, companyFile);
|
fillApplyDateAbsent(file, companyFile);
|
||||||
|
|
||||||
@@ -471,7 +481,7 @@ public class CompanyFileService extends QueryService<CompanyFile, CompanyFileVie
|
|||||||
/**
|
/**
|
||||||
* 当 ApplyDate 未设置时,尝试使用文件名中包含的日期
|
* 当 ApplyDate 未设置时,尝试使用文件名中包含的日期
|
||||||
*/
|
*/
|
||||||
private static void fillApplyDateAbsent(File file, CompanyFile companyFile) {
|
private static void fillApplyDateAbsent(File file, CompanyFileVo companyFile) {
|
||||||
LocalDate applyDate = companyFile.getApplyDate();
|
LocalDate applyDate = companyFile.getApplyDate();
|
||||||
if (applyDate != null) {
|
if (applyDate != null) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1,36 +1,39 @@
|
|||||||
package com.ecep.contract.service;
|
package com.ecep.contract.service;
|
||||||
|
|
||||||
import com.ecep.contract.model.Company;
|
|
||||||
import com.ecep.contract.model.CompanyOldName;
|
|
||||||
import com.ecep.contract.vm.CompanyOldNameViewModel;
|
|
||||||
import org.springframework.data.domain.Pageable;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Service
|
import com.ecep.contract.model.IdentityEntity;
|
||||||
public class CompanyOldNameService extends QueryService<CompanyOldName, CompanyOldNameViewModel> {
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
public boolean makePathAbsent(CompanyOldName companyOldName) {
|
import com.ecep.contract.model.Company;
|
||||||
|
import com.ecep.contract.model.CompanyOldName;
|
||||||
|
import com.ecep.contract.util.ParamUtils;
|
||||||
|
import com.ecep.contract.vm.CompanyOldNameViewModel;
|
||||||
|
import com.ecep.contract.vo.CompanyOldNameVo;
|
||||||
|
import com.ecep.contract.vo.CompanyVo;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class CompanyOldNameService extends QueryService<CompanyOldNameVo, CompanyOldNameViewModel> {
|
||||||
|
|
||||||
|
public boolean makePathAbsent(CompanyOldNameVo companyOldName) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
throw new UnsupportedOperationException("Unimplemented method 'makePathAbsent'");
|
throw new UnsupportedOperationException("Unimplemented method 'makePathAbsent'");
|
||||||
}
|
}
|
||||||
|
|
||||||
public CompanyOldName findMatchByDate(Company company, LocalDate localDate) {
|
public CompanyOldName findMatchByDate(CompanyVo company, LocalDate localDate) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
throw new UnsupportedOperationException("Unimplemented method 'findMatchByDate'");
|
throw new UnsupportedOperationException("Unimplemented method 'findMatchByDate'");
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<CompanyOldName> findAllByCompanyAndName(Company company, String oldName) {
|
public List<CompanyOldNameVo> findAllByCompanyAndName(CompanyVo company, String oldName) {
|
||||||
// TODO Auto-generated method stub
|
return findAll(ParamUtils.builder().equals("company", company.getId()).equals("oldName", oldName).build(),
|
||||||
throw new UnsupportedOperationException("Unimplemented method 'findAllByCompanyAndName'");
|
Pageable.unpaged()).getContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<CompanyOldName> findAllByCompany(Company company) {
|
public List<CompanyOldNameVo> findAllByCompany(IdentityEntity company) {
|
||||||
HashMap<String, Object> params = new HashMap<>();
|
return findAll(ParamUtils.equal("company", company.getId()), Pageable.unpaged()).getContent();
|
||||||
params.put("company", company.getId());
|
|
||||||
return findAll(params, Pageable.unpaged()).getContent();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,18 @@
|
|||||||
package com.ecep.contract.service;
|
package com.ecep.contract.service;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.cache.annotation.CacheConfig;
|
||||||
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
|
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.MessageHolder;
|
||||||
import com.ecep.contract.MyDateTimeUtils;
|
import com.ecep.contract.MyDateTimeUtils;
|
||||||
import com.ecep.contract.SpringApp;
|
import com.ecep.contract.SpringApp;
|
||||||
@@ -7,22 +20,11 @@ import com.ecep.contract.constant.CompanyConstant;
|
|||||||
import com.ecep.contract.model.Company;
|
import com.ecep.contract.model.Company;
|
||||||
import com.ecep.contract.util.FileUtils;
|
import com.ecep.contract.util.FileUtils;
|
||||||
import com.ecep.contract.vm.CompanyViewModel;
|
import com.ecep.contract.vm.CompanyViewModel;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import com.ecep.contract.vo.CompanyVo;
|
||||||
import org.springframework.cache.annotation.CacheConfig;
|
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
|
||||||
import org.springframework.data.domain.Pageable;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@CacheConfig(cacheNames = "company")
|
@CacheConfig(cacheNames = "company")
|
||||||
public class CompanyService extends QueryService<Company, CompanyViewModel> {
|
public class CompanyService extends QueryService<CompanyVo, CompanyViewModel> {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysConfService confService;
|
private SysConfService confService;
|
||||||
@@ -42,37 +44,37 @@ public class CompanyService extends QueryService<Company, CompanyViewModel> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Cacheable(key = "#p0")
|
@Cacheable(key = "#p0")
|
||||||
public Company findById(Integer id) {
|
public CompanyVo findById(Integer id) {
|
||||||
return super.findById(id);
|
return super.findById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Company findByName(String name) {
|
public CompanyVo findByName(String name) {
|
||||||
List<Company> list = findAllByName(name);
|
List<CompanyVo> list = findAllByName(name);
|
||||||
if (list.isEmpty()) {
|
if (list.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return list.getFirst();
|
return list.getFirst();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Company> findAllByName(String name) {
|
public List<CompanyVo> findAllByName(String name) {
|
||||||
Map<String, Object> params = new HashMap<>();
|
Map<String, Object> params = new HashMap<>();
|
||||||
params.put("name", name);
|
params.put("name", name);
|
||||||
return findAll(params, Pageable.unpaged()).getContent();
|
return findAll(params, Pageable.unpaged()).getContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void merge(Company company, Company updater) {
|
public void merge(CompanyVo company, CompanyVo updater) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
throw new UnsupportedOperationException("Unimplemented method 'merge'");
|
throw new UnsupportedOperationException("Unimplemented method 'merge'");
|
||||||
}
|
}
|
||||||
|
|
||||||
public Company createNewCompany(String newCompanyName) {
|
public CompanyVo createNewCompany(String newCompanyName) {
|
||||||
Company company = new Company();
|
CompanyVo company = new CompanyVo();
|
||||||
company.setName(newCompanyName);
|
company.setName(newCompanyName);
|
||||||
company.setCreated(LocalDate.now());
|
company.setCreated(LocalDate.now());
|
||||||
return company;
|
return company;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean existsCompanyPath(Company company) {
|
public boolean existsCompanyPath(CompanyVo company) {
|
||||||
if (!StringUtils.hasText(company.getPath())) {
|
if (!StringUtils.hasText(company.getPath())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -81,7 +83,7 @@ public class CompanyService extends QueryService<Company, CompanyViewModel> {
|
|||||||
return path.exists();
|
return path.exists();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean checkCompanyPathInBasePath(Company company) {
|
public boolean checkCompanyPathInBasePath(CompanyVo company) {
|
||||||
if (!existsCompanyPath(company)) {
|
if (!existsCompanyPath(company)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -93,7 +95,7 @@ public class CompanyService extends QueryService<Company, CompanyViewModel> {
|
|||||||
return path.getAbsolutePath().startsWith(basePath.getAbsolutePath());
|
return path.getAbsolutePath().startsWith(basePath.getAbsolutePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void verifyEnterpriseStatus(Company company, LocalDate verifyDate, MessageHolder holder) {
|
public void verifyEnterpriseStatus(CompanyVo company, LocalDate verifyDate, MessageHolder holder) {
|
||||||
// 检查营业状态
|
// 检查营业状态
|
||||||
String entStatus = company.getEntStatus();
|
String entStatus = company.getEntStatus();
|
||||||
if (StringUtils.hasText(entStatus)) {
|
if (StringUtils.hasText(entStatus)) {
|
||||||
@@ -114,7 +116,7 @@ public class CompanyService extends QueryService<Company, CompanyViewModel> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean makePathAbsent(Company company) {
|
public boolean makePathAbsent(CompanyVo company) {
|
||||||
String path = company.getPath();
|
String path = company.getPath();
|
||||||
if (StringUtils.hasText(path)) {
|
if (StringUtils.hasText(path)) {
|
||||||
File file = new File(path);
|
File file = new File(path);
|
||||||
@@ -141,7 +143,7 @@ public class CompanyService extends QueryService<Company, CompanyViewModel> {
|
|||||||
* @param company 要创建的企业对象
|
* @param company 要创建的企业对象
|
||||||
* @return 目录
|
* @return 目录
|
||||||
*/
|
*/
|
||||||
public File makePath(Company company) {
|
public File makePath(CompanyVo company) {
|
||||||
File basePath = getBasePath();
|
File basePath = getBasePath();
|
||||||
if (!basePath.exists()) {
|
if (!basePath.exists()) {
|
||||||
return null;
|
return null;
|
||||||
@@ -178,7 +180,7 @@ public class CompanyService extends QueryService<Company, CompanyViewModel> {
|
|||||||
* @param files 要被移动的文件集合,需要从中选择需要的
|
* @param files 要被移动的文件集合,需要从中选择需要的
|
||||||
* @param holder 状态输出
|
* @param holder 状态输出
|
||||||
*/
|
*/
|
||||||
public boolean retrieveFromDownloadFiles(Company company, File[] files, MessageHolder holder) {
|
public boolean retrieveFromDownloadFiles(CompanyVo company, File[] files, MessageHolder holder) {
|
||||||
//
|
//
|
||||||
boolean companyChanged = makePathAbsent(company);
|
boolean companyChanged = makePathAbsent(company);
|
||||||
|
|
||||||
|
|||||||
@@ -2,20 +2,30 @@ package com.ecep.contract.service;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.*;
|
import java.util.Collection;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import com.ecep.contract.VendorType;
|
|
||||||
import com.ecep.contract.model.*;
|
|
||||||
import com.ecep.contract.util.MyStringUtils;
|
|
||||||
import com.ecep.contract.util.ProxyUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import com.ecep.contract.MessageHolder;
|
import com.ecep.contract.MessageHolder;
|
||||||
|
import com.ecep.contract.VendorType;
|
||||||
|
import com.ecep.contract.model.Company;
|
||||||
|
import com.ecep.contract.model.CompanyVendor;
|
||||||
|
import com.ecep.contract.model.Contract;
|
||||||
|
import com.ecep.contract.model.VendorCatalog;
|
||||||
|
import com.ecep.contract.model.VendorTypeLocal;
|
||||||
|
import com.ecep.contract.util.MyStringUtils;
|
||||||
|
import com.ecep.contract.util.ParamUtils;
|
||||||
|
import com.ecep.contract.util.ProxyUtils;
|
||||||
import com.ecep.contract.vm.CompanyVendorViewModel;
|
import com.ecep.contract.vm.CompanyVendorViewModel;
|
||||||
import org.springframework.util.StringUtils;
|
import com.ecep.contract.vo.CompanyVo;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class CompanyVendorService extends QueryService<CompanyVendor, CompanyVendorViewModel> {
|
public class CompanyVendorService extends QueryService<CompanyVendor, CompanyVendorViewModel> {
|
||||||
@@ -27,14 +37,11 @@ public class CompanyVendorService extends QueryService<CompanyVendor, CompanyVen
|
|||||||
private CompanyVendorFileService companyVendorFileService;
|
private CompanyVendorFileService companyVendorFileService;
|
||||||
|
|
||||||
public VendorCatalog findCatalogById(Integer id) {
|
public VendorCatalog findCatalogById(Integer id) {
|
||||||
// TODO Auto-generated method stub
|
|
||||||
throw new UnsupportedOperationException("Unimplemented method 'findCatalogById'");
|
throw new UnsupportedOperationException("Unimplemented method 'findCatalogById'");
|
||||||
}
|
}
|
||||||
|
|
||||||
public CompanyVendor findByCompany(Company company) {
|
public CompanyVendor findByCompany(CompanyVo company) {
|
||||||
Map<String, Object> params = new HashMap<>();
|
Page<CompanyVendor> page = findAll(ParamUtils.equal("company", company.getId()), Pageable.ofSize(1));
|
||||||
params.put("company", company.getId());
|
|
||||||
Page<CompanyVendor> page = findAll(params, Pageable.ofSize(1));
|
|
||||||
if (page.isEmpty()) {
|
if (page.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -93,7 +100,8 @@ public class CompanyVendorService extends QueryService<CompanyVendor, CompanyVen
|
|||||||
if (entStatus.contains("注销")) {
|
if (entStatus.contains("注销")) {
|
||||||
holder.error("营业状态异常:" + entStatus + ", 自动设置为不合格");
|
holder.error("营业状态异常:" + entStatus + ", 自动设置为不合格");
|
||||||
companyVendor.setType(VendorType.UNQUALIFIED);
|
companyVendor.setType(VendorType.UNQUALIFIED);
|
||||||
companyVendor.setDescription(MyStringUtils.appendIfAbsent(companyVendor.getDescription(), "自动检测到营业状态为" + entStatus + ",设置为不合格供应商."));
|
companyVendor.setDescription(MyStringUtils.appendIfAbsent(companyVendor.getDescription(),
|
||||||
|
"自动检测到营业状态为" + entStatus + ",设置为不合格供应商."));
|
||||||
valid = true;
|
valid = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ import com.ecep.contract.vm.InventoryViewModel;
|
|||||||
public class InventoryService extends QueryService<Inventory, InventoryViewModel> {
|
public class InventoryService extends QueryService<Inventory, InventoryViewModel> {
|
||||||
|
|
||||||
public Inventory createNewInstance() {
|
public Inventory createNewInstance() {
|
||||||
// TODO Auto-generated method stub
|
Inventory inventory = new Inventory();
|
||||||
throw new UnsupportedOperationException("Unimplemented method 'createNewInstance'");
|
return inventory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void syncInventory(Inventory inventory, MessageHolder holder) {
|
public void syncInventory(Inventory inventory, MessageHolder holder) {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
|||||||
import com.fasterxml.jackson.databind.JsonMappingException;
|
import com.fasterxml.jackson.databind.JsonMappingException;
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import javafx.util.StringConverter;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -253,4 +254,7 @@ public class QueryService<T extends IdentityEntity, TV extends IdentityViewModel
|
|||||||
return pageContent;
|
return pageContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public StringConverter<T> getStringConverter() {
|
||||||
|
throw new UnsupportedOperationException("Not implemented");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -5,7 +5,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
|
|
||||||
import com.ecep.contract.MessageHolder;
|
import com.ecep.contract.MessageHolder;
|
||||||
import com.ecep.contract.constant.CloudServiceConstant;
|
import com.ecep.contract.constant.CloudServiceConstant;
|
||||||
import com.ecep.contract.model.Company;
|
import com.ecep.contract.vo.CompanyVo;
|
||||||
|
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@ import lombok.Setter;
|
|||||||
public class CompanyCompositeUpdateTasker extends Tasker<Object> {
|
public class CompanyCompositeUpdateTasker extends Tasker<Object> {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(CompanyCompositeUpdateTasker.class);
|
private static final Logger logger = LoggerFactory.getLogger(CompanyCompositeUpdateTasker.class);
|
||||||
@Setter
|
@Setter
|
||||||
private Company company;
|
private CompanyVo company;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Object execute(MessageHolder holder) throws Exception {
|
protected Object execute(MessageHolder holder) throws Exception {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.ecep.contract.task;
|
package com.ecep.contract.task;
|
||||||
|
|
||||||
import com.ecep.contract.MessageHolder;
|
import com.ecep.contract.MessageHolder;
|
||||||
import com.ecep.contract.model.Company;
|
import com.ecep.contract.vo.CompanyVo;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
@@ -9,7 +9,7 @@ import lombok.Setter;
|
|||||||
public class CompanyVerifyTasker extends Tasker<Object> {
|
public class CompanyVerifyTasker extends Tasker<Object> {
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
private Company company;
|
private CompanyVo company;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Object execute(MessageHolder holder) throws Exception {
|
protected Object execute(MessageHolder holder) throws Exception {
|
||||||
|
|||||||
@@ -7,6 +7,10 @@ import java.util.concurrent.CompletableFuture;
|
|||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
import com.ecep.contract.model.IdentityEntity;
|
||||||
|
import com.ecep.contract.service.QueryService;
|
||||||
|
import com.ecep.contract.vm.IdentityViewModel;
|
||||||
|
import javafx.beans.property.ObjectProperty;
|
||||||
import org.controlsfx.control.textfield.AutoCompletionBinding;
|
import org.controlsfx.control.textfield.AutoCompletionBinding;
|
||||||
import org.controlsfx.control.textfield.TextFields;
|
import org.controlsfx.control.textfield.TextFields;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@@ -72,7 +76,7 @@ public class UITools {
|
|||||||
* @param content 扩张节点
|
* @param content 扩张节点
|
||||||
*/
|
*/
|
||||||
public static CompletableFuture<ButtonType> showAndWait(Alert.AlertType alertType, String title, String header,
|
public static CompletableFuture<ButtonType> showAndWait(Alert.AlertType alertType, String title, String header,
|
||||||
String message, Node content) {
|
String message, Node content) {
|
||||||
CompletableFuture<ButtonType> future = new CompletableFuture<>();
|
CompletableFuture<ButtonType> future = new CompletableFuture<>();
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
Alert alert = new Alert(alertType);
|
Alert alert = new Alert(alertType);
|
||||||
@@ -165,7 +169,7 @@ public class UITools {
|
|||||||
* @param init 初始化
|
* @param init 初始化
|
||||||
*/
|
*/
|
||||||
public static void showTaskDialogAndWait(String title, javafx.concurrent.Task<?> task,
|
public static void showTaskDialogAndWait(String title, javafx.concurrent.Task<?> task,
|
||||||
Consumer<Consumer<Message>> init) {
|
Consumer<Consumer<Message>> init) {
|
||||||
Dialog<Message> dialog = createDialog();
|
Dialog<Message> dialog = createDialog();
|
||||||
dialog.getDialogPane().getScene().getStylesheets().add("/ui/dialog.css");
|
dialog.getDialogPane().getScene().getStylesheets().add("/ui/dialog.css");
|
||||||
dialog.setTitle(title);
|
dialog.setTitle(title);
|
||||||
@@ -244,6 +248,52 @@ public class UITools {
|
|||||||
return autoCompletion(textField, property, converter::suggest, converter);
|
return autoCompletion(textField, property, converter::suggest, converter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static <T extends IdentityEntity, TV extends IdentityViewModel<T>> AutoCompletionBinding<T> autoCompletion(
|
||||||
|
TextField textField, ObjectProperty<Integer> idProperty, QueryService<T, TV> queryService) {
|
||||||
|
Integer id = idProperty.get();
|
||||||
|
T entity = queryService.findById(id);
|
||||||
|
|
||||||
|
StringConverter<T> converter = queryService.getStringConverter();
|
||||||
|
|
||||||
|
// 先赋值
|
||||||
|
textField.textProperty().set(converter.toString(entity));
|
||||||
|
// 监听 property 变化
|
||||||
|
idProperty.addListener((observable, oldValue, newValue) -> {
|
||||||
|
T newEntity = queryService.findById(newValue);
|
||||||
|
textField.textProperty().set(converter.toString(newEntity));
|
||||||
|
});
|
||||||
|
|
||||||
|
// 关联一个 自动完成
|
||||||
|
AutoCompletionBinding<T> completionBinding = TextFields.bindAutoCompletion(textField, p -> {
|
||||||
|
if (p.isCancelled()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return queryService.search(p.getUserText());
|
||||||
|
} catch (Exception e) {
|
||||||
|
textField.setText(e.getMessage());
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}, converter);
|
||||||
|
|
||||||
|
// 设置自动补全选中值到 property
|
||||||
|
completionBinding.setOnAutoCompleted(event -> {
|
||||||
|
T completion = event.getCompletion();
|
||||||
|
idProperty.set(completion.getId());
|
||||||
|
});
|
||||||
|
|
||||||
|
// fixed 当输入框丢失焦点时,输入框内容为空时,设置property 为null
|
||||||
|
textField.focusedProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
|
if (!newValue) {
|
||||||
|
if (!StringUtils.hasText(textField.getText())) {
|
||||||
|
idProperty.set(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return completionBinding;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 给 TextField 增加一个 自动补全功能
|
* 给 TextField 增加一个 自动补全功能
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.ecep.contract.vm;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import com.ecep.contract.model.Bank;
|
import com.ecep.contract.model.Bank;
|
||||||
|
import com.ecep.contract.vo.BankVo;
|
||||||
|
|
||||||
import javafx.beans.property.SimpleStringProperty;
|
import javafx.beans.property.SimpleStringProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -10,12 +11,12 @@ import lombok.EqualsAndHashCode;
|
|||||||
|
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public class BankViewModel extends IdentityViewModel<Bank> {
|
public class BankViewModel extends IdentityViewModel<BankVo> {
|
||||||
private SimpleStringProperty code = new SimpleStringProperty();
|
private SimpleStringProperty code = new SimpleStringProperty();
|
||||||
private SimpleStringProperty name = new SimpleStringProperty();
|
private SimpleStringProperty name = new SimpleStringProperty();
|
||||||
|
|
||||||
|
|
||||||
public static BankViewModel from(Bank v) {
|
public static BankViewModel from(BankVo v) {
|
||||||
BankViewModel vm = new BankViewModel();
|
BankViewModel vm = new BankViewModel();
|
||||||
vm.update(v);
|
vm.update(v);
|
||||||
return vm;
|
return vm;
|
||||||
@@ -23,14 +24,14 @@ public class BankViewModel extends IdentityViewModel<Bank> {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void updateFrom(Bank v) {
|
protected void updateFrom(BankVo v) {
|
||||||
super.updateFrom(v);
|
super.updateFrom(v);
|
||||||
getCode().set(v.getCode());
|
getCode().set(v.getCode());
|
||||||
getName().set(v.getName());
|
getName().set(v.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean copyTo(Bank v) {
|
public boolean copyTo(BankVo v) {
|
||||||
boolean modified = super.copyTo(v);
|
boolean modified = super.copyTo(v);
|
||||||
if (!Objects.equals(getCode().get(), v.getCode())) {
|
if (!Objects.equals(getCode().get(), v.getCode())) {
|
||||||
v.setCode(getCode().get());
|
v.setCode(getCode().get());
|
||||||
|
|||||||
@@ -3,9 +3,7 @@ package com.ecep.contract.vm;
|
|||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import com.ecep.contract.model.Bank;
|
import com.ecep.contract.vo.CompanyBankAccountVo;
|
||||||
import com.ecep.contract.model.Company;
|
|
||||||
import com.ecep.contract.model.CompanyBankAccount;
|
|
||||||
|
|
||||||
import javafx.beans.property.SimpleIntegerProperty;
|
import javafx.beans.property.SimpleIntegerProperty;
|
||||||
import javafx.beans.property.SimpleObjectProperty;
|
import javafx.beans.property.SimpleObjectProperty;
|
||||||
@@ -15,11 +13,12 @@ import lombok.EqualsAndHashCode;
|
|||||||
|
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public class CompanyBankAccountViewModel extends IdentityViewModel<CompanyBankAccount> implements CompanyBasedViewModel {
|
public class CompanyBankAccountViewModel extends IdentityViewModel<CompanyBankAccountVo>
|
||||||
|
implements CompanyBasedViewModel {
|
||||||
private SimpleIntegerProperty id = new SimpleIntegerProperty();
|
private SimpleIntegerProperty id = new SimpleIntegerProperty();
|
||||||
|
|
||||||
private SimpleObjectProperty<Company> company = new SimpleObjectProperty<>();
|
private SimpleObjectProperty<Integer> companyId = new SimpleObjectProperty<>();
|
||||||
private SimpleObjectProperty<Bank> bank = new SimpleObjectProperty<>();
|
private SimpleObjectProperty<Integer> bankId = new SimpleObjectProperty<>();
|
||||||
|
|
||||||
private SimpleStringProperty openingBank = new SimpleStringProperty();
|
private SimpleStringProperty openingBank = new SimpleStringProperty();
|
||||||
private SimpleStringProperty account = new SimpleStringProperty();
|
private SimpleStringProperty account = new SimpleStringProperty();
|
||||||
@@ -29,27 +28,27 @@ public class CompanyBankAccountViewModel extends IdentityViewModel<CompanyBankAc
|
|||||||
private SimpleIntegerProperty version = new SimpleIntegerProperty();
|
private SimpleIntegerProperty version = new SimpleIntegerProperty();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void updateFrom(CompanyBankAccount v) {
|
protected void updateFrom(CompanyBankAccountVo v) {
|
||||||
getId().set(v.getId());
|
getId().set(v.getId());
|
||||||
getCompany().set(v.getCompany());
|
companyId.set(v.getCompanyId());
|
||||||
getBank().set(v.getBank());
|
bankId.set(v.getBankId());
|
||||||
getOpeningBank().set(v.getOpeningBank());
|
getOpeningBank().set(v.getOpeningBank());
|
||||||
getAccount().set(v.getAccount());
|
getAccount().set(v.getAccount());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean copyTo(CompanyBankAccount v) {
|
public boolean copyTo(CompanyBankAccountVo v) {
|
||||||
boolean modified = super.copyTo(v);
|
boolean modified = super.copyTo(v);
|
||||||
if (!Objects.equals(id.get(), v.getId())) {
|
if (!Objects.equals(id.get(), v.getId())) {
|
||||||
v.setId(id.get());
|
v.setId(id.get());
|
||||||
modified = true;
|
modified = true;
|
||||||
}
|
}
|
||||||
if (!Objects.equals(company.get(), v.getCompany())) {
|
if (!Objects.equals(companyId.get(), v.getCompanyId())) {
|
||||||
v.setCompany(company.get());
|
v.setCompanyId(companyId.get());
|
||||||
modified = true;
|
modified = true;
|
||||||
}
|
}
|
||||||
if (!Objects.equals(bank.get(), v.getBank())) {
|
if (!Objects.equals(bankId.get(), v.getBankId())) {
|
||||||
v.setBank(bank.get());
|
v.setBankId(bankId.get());
|
||||||
modified = true;
|
modified = true;
|
||||||
}
|
}
|
||||||
if (!Objects.equals(openingBank.get(), v.getOpeningBank())) {
|
if (!Objects.equals(openingBank.get(), v.getOpeningBank())) {
|
||||||
@@ -63,7 +62,7 @@ public class CompanyBankAccountViewModel extends IdentityViewModel<CompanyBankAc
|
|||||||
return modified;
|
return modified;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CompanyBankAccountViewModel from(CompanyBankAccount v) {
|
public static CompanyBankAccountViewModel from(CompanyBankAccountVo v) {
|
||||||
CompanyBankAccountViewModel vm = new CompanyBankAccountViewModel();
|
CompanyBankAccountViewModel vm = new CompanyBankAccountViewModel();
|
||||||
vm.updateFrom(v);
|
vm.updateFrom(v);
|
||||||
return vm;
|
return vm;
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
package com.ecep.contract.vm;
|
package com.ecep.contract.vm;
|
||||||
|
|
||||||
import com.ecep.contract.model.Company;
|
import javafx.beans.property.ObjectProperty;
|
||||||
|
|
||||||
import javafx.beans.property.SimpleObjectProperty;
|
|
||||||
|
|
||||||
public interface CompanyBasedViewModel {
|
public interface CompanyBasedViewModel {
|
||||||
SimpleObjectProperty<Company> getCompany();
|
ObjectProperty<Integer> getCompanyId();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package com.ecep.contract.vm;
|
|||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import com.ecep.contract.model.CompanyOldName;
|
import com.ecep.contract.vo.CompanyOldNameVo;
|
||||||
|
|
||||||
import javafx.beans.property.SimpleBooleanProperty;
|
import javafx.beans.property.SimpleBooleanProperty;
|
||||||
import javafx.beans.property.SimpleIntegerProperty;
|
import javafx.beans.property.SimpleIntegerProperty;
|
||||||
@@ -14,40 +14,39 @@ import lombok.EqualsAndHashCode;
|
|||||||
|
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public class CompanyOldNameViewModel extends IdentityViewModel<CompanyOldName> {
|
public class CompanyOldNameViewModel extends IdentityViewModel<CompanyOldNameVo> {
|
||||||
private SimpleIntegerProperty id = new SimpleIntegerProperty();
|
private SimpleIntegerProperty id = new SimpleIntegerProperty();
|
||||||
private SimpleStringProperty name = new SimpleStringProperty();
|
private SimpleStringProperty name = new SimpleStringProperty();
|
||||||
private SimpleStringProperty path = new SimpleStringProperty();
|
private SimpleStringProperty path = new SimpleStringProperty();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private SimpleObjectProperty<LocalDate> beginDate = new SimpleObjectProperty<>();
|
private SimpleObjectProperty<LocalDate> beginDate = new SimpleObjectProperty<>();
|
||||||
private SimpleObjectProperty<LocalDate> endDate = new SimpleObjectProperty<>();
|
private SimpleObjectProperty<LocalDate> endDate = new SimpleObjectProperty<>();
|
||||||
|
|
||||||
private SimpleBooleanProperty ambiguity = new SimpleBooleanProperty();
|
private SimpleBooleanProperty ambiguity = new SimpleBooleanProperty();
|
||||||
private SimpleIntegerProperty version = new SimpleIntegerProperty();
|
private SimpleBooleanProperty active = new SimpleBooleanProperty();
|
||||||
private SimpleStringProperty memo = new SimpleStringProperty();
|
private SimpleStringProperty memo = new SimpleStringProperty();
|
||||||
|
private SimpleIntegerProperty version = new SimpleIntegerProperty();
|
||||||
|
|
||||||
|
public static CompanyOldNameViewModel from(CompanyOldNameVo name) {
|
||||||
public static CompanyOldNameViewModel from(CompanyOldName name) {
|
|
||||||
CompanyOldNameViewModel model = new CompanyOldNameViewModel();
|
CompanyOldNameViewModel model = new CompanyOldNameViewModel();
|
||||||
model.update(name);
|
model.update(name);
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateFrom(CompanyOldName oldName) {
|
public void updateFrom(CompanyOldNameVo oldName) {
|
||||||
id.set(oldName.getId());
|
id.set(oldName.getId());
|
||||||
name.set(oldName.getName());
|
name.set(oldName.getName());
|
||||||
path.set(oldName.getPath());
|
path.set(oldName.getPath());
|
||||||
memo.set(oldName.getMemo());
|
memo.set(oldName.getMemo());
|
||||||
beginDate.set(oldName.getBeginDate());
|
beginDate.set(oldName.getBeginDate());
|
||||||
endDate.set(oldName.getEndDate());
|
endDate.set(oldName.getEndDate());
|
||||||
ambiguity.set(oldName.getAmbiguity());
|
ambiguity.set(oldName.isAmbiguity());
|
||||||
|
active.set(oldName.isActive());
|
||||||
version.set(oldName.getVersion());
|
version.set(oldName.getVersion());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean copyTo(CompanyOldName c) {
|
public boolean copyTo(CompanyOldNameVo c) {
|
||||||
boolean modified = super.copyTo(c);
|
boolean modified = super.copyTo(c);
|
||||||
if (!Objects.equals(id.get(), c.getId())) {
|
if (!Objects.equals(id.get(), c.getId())) {
|
||||||
c.setId(id.get());
|
c.setId(id.get());
|
||||||
@@ -73,10 +72,14 @@ public class CompanyOldNameViewModel extends IdentityViewModel<CompanyOldName> {
|
|||||||
c.setEndDate(endDate.get());
|
c.setEndDate(endDate.get());
|
||||||
modified = true;
|
modified = true;
|
||||||
}
|
}
|
||||||
if (!Objects.equals(ambiguity.get(), c.getAmbiguity())) {
|
if (!Objects.equals(ambiguity.get(), c.isAmbiguity())) {
|
||||||
c.setAmbiguity(ambiguity.get());
|
c.setAmbiguity(ambiguity.get());
|
||||||
modified = true;
|
modified = true;
|
||||||
}
|
}
|
||||||
|
if (!Objects.equals(active.get(), c.isActive())) {
|
||||||
|
c.setActive(active.get());
|
||||||
|
modified = true;
|
||||||
|
}
|
||||||
return modified;
|
return modified;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package com.ecep.contract.vm;
|
|||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import com.ecep.contract.model.Company;
|
import com.ecep.contract.vo.CompanyVo;
|
||||||
|
|
||||||
import javafx.beans.property.SimpleBooleanProperty;
|
import javafx.beans.property.SimpleBooleanProperty;
|
||||||
import javafx.beans.property.SimpleIntegerProperty;
|
import javafx.beans.property.SimpleIntegerProperty;
|
||||||
@@ -12,10 +12,9 @@ import javafx.beans.property.SimpleStringProperty;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public class CompanyViewModel extends IdentityViewModel<Company> {
|
public class CompanyViewModel extends IdentityViewModel<CompanyVo> {
|
||||||
private SimpleStringProperty name = new SimpleStringProperty();
|
private SimpleStringProperty name = new SimpleStringProperty();
|
||||||
private SimpleStringProperty shortName = new SimpleStringProperty();
|
private SimpleStringProperty shortName = new SimpleStringProperty();
|
||||||
private SimpleStringProperty uid = new SimpleStringProperty();
|
private SimpleStringProperty uid = new SimpleStringProperty();
|
||||||
@@ -42,14 +41,14 @@ public class CompanyViewModel extends IdentityViewModel<Company> {
|
|||||||
|
|
||||||
private SimpleIntegerProperty version = new SimpleIntegerProperty();
|
private SimpleIntegerProperty version = new SimpleIntegerProperty();
|
||||||
|
|
||||||
public static CompanyViewModel from(Company company) {
|
public static CompanyViewModel from(CompanyVo company) {
|
||||||
CompanyViewModel model = new CompanyViewModel();
|
CompanyViewModel model = new CompanyViewModel();
|
||||||
model.update(company);
|
model.update(company);
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void updateFrom(Company company) {
|
protected void updateFrom(CompanyVo company) {
|
||||||
super.updateFrom(company);
|
super.updateFrom(company);
|
||||||
name.set(company.getName());
|
name.set(company.getName());
|
||||||
shortName.set(company.getShortName());
|
shortName.set(company.getShortName());
|
||||||
@@ -79,7 +78,7 @@ public class CompanyViewModel extends IdentityViewModel<Company> {
|
|||||||
version.set(company.getVersion());
|
version.set(company.getVersion());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean copyTo(Company v) {
|
public boolean copyTo(CompanyVo v) {
|
||||||
boolean modified = super.copyTo(v);
|
boolean modified = super.copyTo(v);
|
||||||
if (!Objects.equals(name.get(), v.getName())) {
|
if (!Objects.equals(name.get(), v.getName())) {
|
||||||
v.setName(name.get());
|
v.setName(name.get());
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import com.ecep.contract.model.Project;
|
|||||||
import com.ecep.contract.model.ProjectIndustry;
|
import com.ecep.contract.model.ProjectIndustry;
|
||||||
import com.ecep.contract.model.ProjectSaleType;
|
import com.ecep.contract.model.ProjectSaleType;
|
||||||
import com.ecep.contract.model.ProjectType;
|
import com.ecep.contract.model.ProjectType;
|
||||||
|
import com.ecep.contract.vo.ProjectVo;
|
||||||
|
|
||||||
import javafx.beans.property.SimpleBooleanProperty;
|
import javafx.beans.property.SimpleBooleanProperty;
|
||||||
import javafx.beans.property.SimpleIntegerProperty;
|
import javafx.beans.property.SimpleIntegerProperty;
|
||||||
@@ -25,8 +26,8 @@ import lombok.EqualsAndHashCode;
|
|||||||
|
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public class ProjectViewModel extends IdentityViewModel<Project> {
|
public class ProjectViewModel extends IdentityViewModel<ProjectVo> {
|
||||||
private SimpleObjectProperty<Company> customer = new SimpleObjectProperty<>();
|
private SimpleObjectProperty<Integer> customer = new SimpleObjectProperty<>();
|
||||||
/**
|
/**
|
||||||
* 银行账户(公司可能有多个账户,此项目关联其中一个账户)
|
* 银行账户(公司可能有多个账户,此项目关联其中一个账户)
|
||||||
*/
|
*/
|
||||||
@@ -78,14 +79,14 @@ public class ProjectViewModel extends IdentityViewModel<Project> {
|
|||||||
|
|
||||||
private SimpleIntegerProperty version = new SimpleIntegerProperty();
|
private SimpleIntegerProperty version = new SimpleIntegerProperty();
|
||||||
|
|
||||||
public static ProjectViewModel from(Project project) {
|
public static ProjectViewModel from(ProjectVo project) {
|
||||||
ProjectViewModel model = new ProjectViewModel();
|
ProjectViewModel model = new ProjectViewModel();
|
||||||
model.update(project);
|
model.update(project);
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void updateFrom(Project v) {
|
protected void updateFrom(ProjectVo v) {
|
||||||
super.updateFrom(v);
|
super.updateFrom(v);
|
||||||
customer.set(v.getCustomer());
|
customer.set(v.getCustomer());
|
||||||
bankAccount.set(v.getBankAccount());
|
bankAccount.set(v.getBankAccount());
|
||||||
@@ -118,7 +119,7 @@ public class ProjectViewModel extends IdentityViewModel<Project> {
|
|||||||
getVersion().set(v.getVersion());
|
getVersion().set(v.getVersion());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean copyTo(Project v) {
|
public boolean copyTo(ProjectVo v) {
|
||||||
boolean modified = super.copyTo(v);
|
boolean modified = super.copyTo(v);
|
||||||
if (!Objects.equals(customer.get(), v.getCustomer())) {
|
if (!Objects.equals(customer.get(), v.getCustomer())) {
|
||||||
v.setCustomer(customer.get());
|
v.setCustomer(customer.get());
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import com.ecep.contract.model.IdentityEntity;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class CompanyBankAccountVo implements IdentityEntity {
|
public class CompanyBankAccountVo implements IdentityEntity, CompanyBasedVo {
|
||||||
private Integer id;
|
private Integer id;
|
||||||
/**
|
/**
|
||||||
* 公司id
|
* 公司id
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.ecep.contract.vo;
|
||||||
|
|
||||||
|
public interface CompanyBasedVo {
|
||||||
|
Integer getCompanyId();
|
||||||
|
|
||||||
|
void setCompanyId(Integer companyId);
|
||||||
|
}
|
||||||
@@ -6,10 +6,9 @@ import java.time.LocalDate;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class CompanyBlackReasonVo implements IdentityEntity {
|
public class CompanyBlackReasonVo implements IdentityEntity ,CompanyBasedVo{
|
||||||
private Integer id;
|
private Integer id;
|
||||||
private Integer companyId;
|
private Integer companyId;
|
||||||
private String companyName;
|
|
||||||
private BlackReasonType type;
|
private BlackReasonType type;
|
||||||
private String applyName;
|
private String applyName;
|
||||||
private LocalDate applyDate;
|
private LocalDate applyDate;
|
||||||
|
|||||||
@@ -6,10 +6,9 @@ import java.time.LocalDate;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class CompanyContactVo implements IdentityEntity, NamedEntity {
|
public class CompanyContactVo implements IdentityEntity, NamedEntity ,CompanyBasedVo{
|
||||||
private Integer id;
|
private Integer id;
|
||||||
private Integer companyId;
|
private Integer companyId;
|
||||||
private String companyName;
|
|
||||||
private String name;
|
private String name;
|
||||||
private String position;
|
private String position;
|
||||||
private String phone;
|
private String phone;
|
||||||
|
|||||||
@@ -4,10 +4,9 @@ import com.ecep.contract.model.IdentityEntity;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class CompanyContractVo implements IdentityEntity {
|
public class CompanyContractVo implements IdentityEntity ,CompanyBasedVo{
|
||||||
private Integer id;
|
private Integer id;
|
||||||
private Integer companyId;
|
private Integer companyId;
|
||||||
private String companyName;
|
|
||||||
private Integer contractId;
|
private Integer contractId;
|
||||||
private String contractCode;
|
private String contractCode;
|
||||||
private String contractName;
|
private String contractName;
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import lombok.Data;
|
|||||||
public class CompanyCustomerFileVo implements IdentityEntity {
|
public class CompanyCustomerFileVo implements IdentityEntity {
|
||||||
private Integer id;
|
private Integer id;
|
||||||
private Integer customerId;
|
private Integer customerId;
|
||||||
private String customerName;
|
|
||||||
private CompanyCustomerFileType type;
|
private CompanyCustomerFileType type;
|
||||||
private String filePath;
|
private String filePath;
|
||||||
private String editFilePath;
|
private String editFilePath;
|
||||||
|
|||||||
@@ -6,10 +6,9 @@ import java.time.LocalDate;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class CompanyCustomerVo implements IdentityEntity {
|
public class CompanyCustomerVo implements IdentityEntity,CompanyBasedVo {
|
||||||
private Integer id;
|
private Integer id;
|
||||||
private Integer companyId;
|
private Integer companyId;
|
||||||
private String companyName;
|
|
||||||
private LocalDate developDate;
|
private LocalDate developDate;
|
||||||
private String path;
|
private String path;
|
||||||
private Integer companyContactId;
|
private Integer companyContactId;
|
||||||
|
|||||||
@@ -4,10 +4,9 @@ import com.ecep.contract.model.IdentityEntity;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class CompanyExtendInfoVo implements IdentityEntity {
|
public class CompanyExtendInfoVo implements IdentityEntity, CompanyBasedVo {
|
||||||
private Integer id;
|
private Integer id;
|
||||||
private Integer companyId;
|
private Integer companyId;
|
||||||
private String companyName;
|
|
||||||
private boolean disableVerify = false;
|
private boolean disableVerify = false;
|
||||||
private int version = 0;
|
private int version = 0;
|
||||||
}
|
}
|
||||||
@@ -8,11 +8,10 @@ import com.ecep.contract.model.IdentityEntity;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class CompanyFileVo implements IdentityEntity {
|
public class CompanyFileVo implements IdentityEntity, CompanyBasedVo {
|
||||||
|
|
||||||
private Integer id;
|
private Integer id;
|
||||||
private Integer companyId;
|
private Integer companyId;
|
||||||
private String companyName;
|
|
||||||
private CompanyFileType type;
|
private CompanyFileType type;
|
||||||
private LocalDate applyDate;
|
private LocalDate applyDate;
|
||||||
private LocalDate expiringDate;
|
private LocalDate expiringDate;
|
||||||
|
|||||||
@@ -5,11 +5,10 @@ import com.ecep.contract.model.NamedEntity;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class CompanyInvoiceInfoVo implements IdentityEntity, NamedEntity {
|
public class CompanyInvoiceInfoVo implements IdentityEntity, NamedEntity, CompanyBasedVo {
|
||||||
private Integer id;
|
private Integer id;
|
||||||
private String name;
|
private String name;
|
||||||
private Integer companyId;
|
private Integer companyId;
|
||||||
private String companyName;
|
|
||||||
private String taxId;
|
private String taxId;
|
||||||
private String address;
|
private String address;
|
||||||
private String phone;
|
private String phone;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import com.ecep.contract.model.NamedEntity;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class CompanyOldNameVo implements IdentityEntity, NamedEntity {
|
public class CompanyOldNameVo implements IdentityEntity, NamedEntity, CompanyBasedVo {
|
||||||
private Integer id;
|
private Integer id;
|
||||||
private Integer companyId;
|
private Integer companyId;
|
||||||
private String name;
|
private String name;
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ public class InventoryVo implements IdentityEntity {
|
|||||||
private Integer catalogId;
|
private Integer catalogId;
|
||||||
private String catalogName;
|
private String catalogName;
|
||||||
private String specification;
|
private String specification;
|
||||||
private boolean specificationLock;
|
private boolean specificationLock = false;
|
||||||
private boolean nameLock;
|
private boolean nameLock = false;
|
||||||
private Double purchaseTax;
|
private Double purchaseTax;
|
||||||
private Double purchasePrice;
|
private Double purchasePrice;
|
||||||
private Double purchaseTaxPrice;
|
private Double purchaseTaxPrice;
|
||||||
|
|||||||
@@ -18,5 +18,5 @@ public class InvoiceVo implements IdentityEntity {
|
|||||||
private Double totalAmount;
|
private Double totalAmount;
|
||||||
private Integer invoiceStatusId;
|
private Integer invoiceStatusId;
|
||||||
private String remark;
|
private String remark;
|
||||||
private Boolean active;
|
private Boolean active = false;
|
||||||
}
|
}
|
||||||
@@ -17,5 +17,5 @@ public class PurchaseOrderVo implements IdentityEntity {
|
|||||||
private Double taxRate;
|
private Double taxRate;
|
||||||
private Integer statusId;
|
private Integer statusId;
|
||||||
private String remark;
|
private String remark;
|
||||||
private Boolean active;
|
private Boolean active = false;
|
||||||
}
|
}
|
||||||
@@ -1,16 +1,16 @@
|
|||||||
package com.ecep.contract.vo;
|
package com.ecep.contract.vo;
|
||||||
|
|
||||||
import com.ecep.contract.model.IdentityEntity;
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
import com.ecep.contract.model.IdentityEntity;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class PurchaseReceiptVo implements IdentityEntity {
|
public class PurchaseReceiptVo implements IdentityEntity {
|
||||||
private Integer id;
|
private Integer id;
|
||||||
private Integer purchaseOrderId;
|
|
||||||
private String code;
|
private String code;
|
||||||
private LocalDate receiptDate;
|
private Integer orderId;
|
||||||
private Integer receivedByEmployeeId;
|
private LocalDate verifierDate;
|
||||||
private String remark;
|
private LocalDate arriveDate;
|
||||||
private Boolean active;
|
private String description;
|
||||||
|
private boolean active = false;
|
||||||
}
|
}
|
||||||
@@ -17,5 +17,5 @@ public class SalesOrderVo implements IdentityEntity {
|
|||||||
private Double taxRate;
|
private Double taxRate;
|
||||||
private Integer statusId;
|
private Integer statusId;
|
||||||
private String remark;
|
private String remark;
|
||||||
private Boolean active;
|
private Boolean active = false;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user