拆分模块
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ecep.contract.model.Bank;
|
||||
import com.ecep.contract.vm.BankViewModel;
|
||||
|
||||
public class BankService implements ViewModelService<Bank, BankViewModel> {
|
||||
public Bank findByName(String name) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<Bank> search(String searchText) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.controlsfx.control.TaskProgressView;
|
||||
|
||||
import com.ecep.contract.Desktop;
|
||||
import com.ecep.contract.model.CloudRk;
|
||||
import com.ecep.contract.task.CloudRkSyncTask;
|
||||
import com.ecep.contract.vm.CloudRkViewModel;
|
||||
|
||||
import javafx.concurrent.Task;
|
||||
|
||||
public class CloudRkService implements ViewModelService<CloudRk, CloudRkViewModel> {
|
||||
|
||||
/**
|
||||
* 生成定时同步任务
|
||||
*
|
||||
* @param taskProgressView 任务视图
|
||||
*/
|
||||
public void scheduledTasks(TaskProgressView<Task<?>> taskProgressView) {
|
||||
ScheduledExecutorService executorService = Desktop.instance.getExecutorService();
|
||||
// 第一次延时1分钟启动
|
||||
executorService.schedule(() -> {
|
||||
// 定时 30分钟 运行一次
|
||||
executorService.scheduleAtFixedRate(() -> {
|
||||
Desktop.instance.getTaskMonitorCenter().registerAndStartTask(new CloudRkSyncTask());
|
||||
}, 0, 30, TimeUnit.MINUTES);
|
||||
}, 1, TimeUnit.MINUTES);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.ecep.contract.model.Company;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.ecep.contract.DesktopUtils;
|
||||
import com.ecep.contract.SpringApp;
|
||||
import com.ecep.contract.model.CloudTyc;
|
||||
import com.ecep.contract.util.UITools;
|
||||
import com.ecep.contract.vm.CloudTycInfoViewModel;
|
||||
|
||||
import javafx.application.Platform;
|
||||
|
||||
public class CloudTycService implements IEntityService<CloudTyc> {
|
||||
|
||||
public void save(CloudTycInfoViewModel viewModel) {
|
||||
int infoId = viewModel.getId().get();
|
||||
CloudTyc cloudTyc = findById(infoId);
|
||||
if (cloudTyc == null) {
|
||||
return;
|
||||
}
|
||||
if (viewModel.copyTo(cloudTyc)) {
|
||||
cloudTyc.setLatestUpdate(Instant.now());
|
||||
CloudTyc saved = save(cloudTyc);
|
||||
Platform.runLater(() -> viewModel.update(saved));
|
||||
}
|
||||
}
|
||||
|
||||
public void showInBrowse(String cloudId) {
|
||||
String baseUrl = SpringApp.getBean(SysConfService.class).getString("cloud.tyc.company");
|
||||
if (!StringUtils.hasText(baseUrl)) {
|
||||
UITools.showAlertAndWait("系统参数 cloud.tyc.company 未配置");
|
||||
return;
|
||||
}
|
||||
|
||||
String url = baseUrl + cloudId;
|
||||
|
||||
DesktopUtils.showInBrowse(url);
|
||||
|
||||
// UITools.showExceptionAndWait("使用浏览器打开网址出现异常", e);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public CloudTyc findById(Integer id) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'findById'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public CloudTyc save(CloudTyc entity) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'save'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(CloudTyc entity) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'delete'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CloudTyc> findAll() {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'findAll'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<CloudTyc> findAll(Map<String, Object> params, Pageable pageable) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'findAll'");
|
||||
}
|
||||
|
||||
public CloudTyc getOrCreateCloudTyc(Company company) {
|
||||
throw new UnsupportedOperationException("Unimplemented method 'getOrCreateCloudTyc'");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
import com.ecep.contract.model.CompanyContact;
|
||||
import com.ecep.contract.vm.CompanyContactViewModel;
|
||||
|
||||
public class CompanyContactService implements ViewModelService<CompanyContact, CompanyContactViewModel> {
|
||||
|
||||
}
|
||||
@@ -1,4 +1,23 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
public class CompanyCustomerEntityService {
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import com.ecep.contract.model.CompanyCustomer;
|
||||
import com.ecep.contract.model.CompanyCustomerEntity;
|
||||
import com.ecep.contract.vm.CompanyCustomerViewModel;
|
||||
|
||||
public class CompanyCustomerEntityService implements ViewModelService<CompanyCustomer, CompanyCustomerViewModel> {
|
||||
public List<CompanyCustomerEntity> findAllByCustomer(CompanyCustomer customer) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<CompanyCustomer> findAll(Map<String, Object> params, Pageable pageable) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'findAll'");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,30 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
public class CompanyCustomerFileService {
|
||||
import com.ecep.contract.MessageHolder;
|
||||
import com.ecep.contract.model.CompanyCustomer;
|
||||
import com.ecep.contract.model.CompanyCustomerEvaluationFormFile;
|
||||
import com.ecep.contract.model.CompanyCustomerFile;
|
||||
import com.ecep.contract.vm.CompanyCustomerFileViewModel;
|
||||
|
||||
import java.io.File;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public class CompanyCustomerFileService implements ViewModelService<CompanyCustomerFile, CompanyCustomerFileViewModel> {
|
||||
public List<CompanyCustomerEvaluationFormFile> findAllCustomerEvaluationFormFiles(CompanyCustomer customer) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public LocalDate getNextSignDate(CompanyCustomer companyCustomer, MessageHolder holder) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public File getEvaluationFormTemplate() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public void saveAll(List<CompanyCustomerFile> companyCustomerFiles) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
import com.ecep.contract.MessageHolder;
|
||||
import com.ecep.contract.model.Company;
|
||||
import com.ecep.contract.model.CompanyCustomer;
|
||||
import com.ecep.contract.model.CustomerCatalog;
|
||||
import com.ecep.contract.vm.CompanyCustomerViewModel;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class CompanyCustomerService implements ViewModelService<CompanyCustomer, CompanyCustomerViewModel> {
|
||||
|
||||
public CompanyCustomer findByCompany(Company company) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'findByCompany'");
|
||||
}
|
||||
|
||||
public CustomerCatalog findCatalogById(Integer id) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'findCatalogById'");
|
||||
}
|
||||
|
||||
public boolean reBuildingFiles(CompanyCustomer companyCustomer, MessageHolder holder) {
|
||||
throw new UnsupportedOperationException("Unimplemented method 'reBuildingFiles'");
|
||||
}
|
||||
|
||||
public File getBasePath() {
|
||||
throw new UnsupportedOperationException("Unimplemented method 'getBasePath'");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
import com.ecep.contract.model.Company;
|
||||
import com.ecep.contract.model.CompanyFile;
|
||||
import com.ecep.contract.vm.CompanyFileViewModel;
|
||||
|
||||
public class CompanyFileService implements ViewModelService<CompanyFile, CompanyFileViewModel> {
|
||||
|
||||
public void reBuildingFiles(Company company, Object object) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'reBuildingFiles'");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
import com.ecep.contract.model.CompanyOldName;
|
||||
import com.ecep.contract.vm.CompanyOldNameViewModel;
|
||||
|
||||
public class CompanyOldNameService implements ViewModelService<CompanyOldName, CompanyOldNameViewModel> {
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ecep.contract.model.Company;
|
||||
import com.ecep.contract.vm.CompanyViewModel;
|
||||
|
||||
public class CompanyService implements ViewModelService<Company, CompanyViewModel> {
|
||||
|
||||
public Company findByName(String name) {
|
||||
// return companyRepository.findByName(name);
|
||||
throw new UnsupportedOperationException("Unimplemented method 'findByName'");
|
||||
}
|
||||
|
||||
public List<Company> search(String name) {
|
||||
// return companyRepository.findByName(name);
|
||||
throw new UnsupportedOperationException("Unimplemented method 'search'");
|
||||
}
|
||||
|
||||
public List<Company> findAllByName(String name) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'findAllByName'");
|
||||
}
|
||||
|
||||
public void merge(Company company, Company updater) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'merge'");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.ecep.contract.converter.EntityStringConverter;
|
||||
import com.ecep.contract.model.Company;
|
||||
|
||||
import jakarta.annotation.PostConstruct;
|
||||
|
||||
@Lazy
|
||||
@Component
|
||||
public class CompanyStringConverter extends EntityStringConverter<Company> {
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
CompanyService service;
|
||||
public CompanyStringConverter() {
|
||||
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
private void init() {
|
||||
setInitialized(project -> service.findById(project.getId()));
|
||||
setSuggestion(service::search);
|
||||
setFromString(service::findByName);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
import com.ecep.contract.model.CompanyVendorEntity;
|
||||
import com.ecep.contract.vm.CompanyVendorEntityViewModel;
|
||||
|
||||
public class CompanyVendorEntityService implements ViewModelService<CompanyVendorEntity, CompanyVendorEntityViewModel> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import com.ecep.contract.model.CompanyVendor;
|
||||
import com.ecep.contract.model.CompanyVendorFile;
|
||||
import com.ecep.contract.vm.CompanyVendorFileViewModel;
|
||||
|
||||
public class CompanyVendorFileService implements ViewModelService<CompanyVendorFile, CompanyVendorFileViewModel> {
|
||||
|
||||
public LocalDate getNextSignDate(CompanyVendor companyVendor, Consumer<String> state) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'getNextSignDate'");
|
||||
}
|
||||
|
||||
public void saveAll(List<CompanyVendorFile> companyVendorFiles) {
|
||||
throw new UnsupportedOperationException("Unimplemented method 'saveAll'");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
import com.ecep.contract.MessageHolder;
|
||||
import com.ecep.contract.model.Company;
|
||||
import com.ecep.contract.model.CompanyVendor;
|
||||
import com.ecep.contract.model.VendorCatalog;
|
||||
import com.ecep.contract.vm.CompanyVendorViewModel;
|
||||
|
||||
public class CompanyVendorService implements ViewModelService<CompanyVendor, CompanyVendorViewModel> {
|
||||
|
||||
public VendorCatalog findCatalogById(Integer id) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'findCatalogById'");
|
||||
}
|
||||
|
||||
public CompanyVendor findByCompany(Company company) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'findByCompany'");
|
||||
}
|
||||
|
||||
public boolean reBuildingFiles(CompanyVendor companyVendor, MessageHolder messageHolder) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'reBuildingFiles'");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
import com.ecep.contract.model.ContractBidVendor;
|
||||
import com.ecep.contract.vm.ContractBidVendorViewModel;
|
||||
|
||||
public class ContractBidVendorService implements ViewModelService<ContractBidVendor, ContractBidVendorViewModel> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
import com.ecep.contract.model.ContractFile;
|
||||
import com.ecep.contract.vm.ContractFileViewModel;
|
||||
|
||||
public class ContractFileService implements ViewModelService<ContractFile, ContractFileViewModel> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
import com.ecep.contract.model.ContractGroup;
|
||||
import com.ecep.contract.vm.ContractGroupViewModel;
|
||||
|
||||
public class ContractGroupService implements ViewModelService<ContractGroup, ContractGroupViewModel> {
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
import com.ecep.contract.model.ContractKind;
|
||||
import com.ecep.contract.vm.ContractKindViewModel;
|
||||
|
||||
public class ContractKindService implements ViewModelService<ContractKind, ContractKindViewModel> {
|
||||
|
||||
public ContractKind findByName(String name) {
|
||||
throw new UnsupportedOperationException("Unimplemented method 'findByName'");
|
||||
|
||||
}
|
||||
|
||||
public ContractKind findByCode(String code) {
|
||||
throw new UnsupportedOperationException("Unimplemented method 'findByCode'");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ecep.contract.model.Contract;
|
||||
import com.ecep.contract.model.ContractGroup;
|
||||
import com.ecep.contract.vm.ContractViewModel;
|
||||
|
||||
public class ContractService implements ViewModelService<Contract, ContractViewModel> {
|
||||
|
||||
public boolean updateParentCode(Contract contract) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'updateParentCode'");
|
||||
}
|
||||
|
||||
public List<ContractGroup> findAllGroups() {
|
||||
throw new UnsupportedOperationException("Unimplemented method 'findAllGroups'");
|
||||
}
|
||||
|
||||
public Contract findByCode(String string) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'findByCode'");
|
||||
}
|
||||
|
||||
public List<Contract> search(String searchText) {
|
||||
throw new UnsupportedOperationException("Unimplemented method 'search'");
|
||||
}
|
||||
|
||||
public Contract findByName(String name) {
|
||||
throw new UnsupportedOperationException("Unimplemented method 'findByName'");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
import com.ecep.contract.model.ContractType;
|
||||
import com.ecep.contract.vm.ContractTypeViewModel;
|
||||
|
||||
public class ContractTypeService implements ViewModelService<ContractType, ContractTypeViewModel> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
import com.ecep.contract.model.CustomerSatisfactionSurvey;
|
||||
import com.ecep.contract.vm.CustomerSatisfactionSurveyViewModel;
|
||||
|
||||
public class CustomerSatisfactionSurveyService implements ViewModelService<CustomerSatisfactionSurvey, CustomerSatisfactionSurveyViewModel> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
import com.ecep.contract.model.EmployeeRole;
|
||||
import com.ecep.contract.vm.EmployeeRoleViewModel;
|
||||
|
||||
public class EmployeeRoleService implements ViewModelService<EmployeeRole, EmployeeRoleViewModel> {
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ecep.contract.model.Employee;
|
||||
import com.ecep.contract.model.EmployeeRole;
|
||||
import com.ecep.contract.vm.EmployeeViewModel;
|
||||
|
||||
public class EmployeeService implements ViewModelService<Employee, EmployeeViewModel> {
|
||||
|
||||
public Employee findByName(String name) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'findByName'");
|
||||
}
|
||||
|
||||
public List<EmployeeRole> getRolesByEmployeeId(Integer id) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'getRolesByEmployeeId'");
|
||||
}
|
||||
|
||||
public void updateActive(int sessionId) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'updateActive'");
|
||||
}
|
||||
|
||||
public List<Employee> search(String searchText) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'search'");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
import com.ecep.contract.model.ExtendVendorInfo;
|
||||
import com.ecep.contract.vm.ExtendVendorInfoViewModel;
|
||||
|
||||
public class ExtendVendorInfoService implements ViewModelService<ExtendVendorInfo, ExtendVendorInfoViewModel> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
public interface IEntityService<T> {
|
||||
T findById(Integer id);
|
||||
|
||||
T save(T entity);
|
||||
|
||||
void delete(T entity);
|
||||
|
||||
List<T> findAll();
|
||||
|
||||
Page<T> findAll(Map<String, Object> params, Pageable pageable);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
import com.ecep.contract.model.ProjectBid;
|
||||
import com.ecep.contract.vm.ProjectBidViewModel;
|
||||
|
||||
public class ProjectBidService implements ViewModelService<ProjectBid, ProjectBidViewModel> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
import com.ecep.contract.model.ProjectCost;
|
||||
import com.ecep.contract.vm.ProjectCostViewModel;
|
||||
|
||||
public class ProjectCostService implements ViewModelService<ProjectCost, ProjectCostViewModel> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
public class ProjectQuotationService implements ViewModelService<ProjectQuotation, ProjectQuotationViewModel>{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
public class ProjectSaleTypeRequireFileTypeService implements ViewModelService<ProjectSaleType, ProjectSaleTypeViewModel>{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
import com.ecep.contract.model.ProjectSaleType;
|
||||
import com.ecep.contract.vm.ProjectSaleTypeViewModel;
|
||||
|
||||
public class ProjectSaleTypeService implements ViewModelService<ProjectSaleType, ProjectSaleTypeViewModel> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
import com.ecep.contract.model.Project;
|
||||
import com.ecep.contract.vm.ProjectViewModel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ProjectService implements ViewModelService<Project, ProjectViewModel> {
|
||||
|
||||
|
||||
public List<Project> search(String searchText) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public Project findByName(String name) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public Project findByCode(String code) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public void applyCode(Project project, String code) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
import com.ecep.contract.model.SalesOrder;
|
||||
import com.ecep.contract.vm.SalesOrderViewModel;
|
||||
|
||||
public class SaleOrdersService implements ViewModelService<SalesOrder, SalesOrderViewModel> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import com.ecep.contract.model.SysConf;
|
||||
|
||||
public class SysConfService implements IEntityService<SysConf> {
|
||||
|
||||
@Override
|
||||
public SysConf findById(Integer id) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'findById'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysConf save(SysConf entity) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'save'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(SysConf entity) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'delete'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysConf> findAll() {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'findAll'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<SysConf> findAll(Map<String, Object> params, Pageable pageable) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'findAll'");
|
||||
}
|
||||
|
||||
public boolean getBoolean(String key) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'getBoolean'");
|
||||
}
|
||||
|
||||
public void set(String key, String string) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'set'");
|
||||
}
|
||||
|
||||
public String getString(String string) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'getString'");
|
||||
}
|
||||
|
||||
public int getInt(String key) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'getInt'");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
import com.ecep.contract.model.VendorGroupRequireFileType;
|
||||
import com.ecep.contract.vm.VendorGroupRequireFileTypeViewModel;
|
||||
|
||||
public class VendorGroupRequireFileTypeService
|
||||
implements ViewModelService<VendorGroupRequireFileType, VendorGroupRequireFileTypeViewModel> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
import com.ecep.contract.model.VendorGroup;
|
||||
import com.ecep.contract.vm.VendorGroupViewModel;
|
||||
|
||||
public class VendorGroupService implements ViewModelService<VendorGroup, VendorGroupViewModel> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import com.ecep.contract.constant.ServiceConstant;
|
||||
import com.ecep.contract.model.IdentityEntity;
|
||||
import com.ecep.contract.vm.IdentityViewModel;
|
||||
|
||||
/**
|
||||
* 视图模型服务接口
|
||||
*
|
||||
* @param <T> 实体类型
|
||||
* @param <TV> 视图模型类型
|
||||
* @author 2025-08-02
|
||||
*/
|
||||
public interface ViewModelService<T extends IdentityEntity, TV extends IdentityViewModel<T>>
|
||||
extends IEntityService<T> {
|
||||
|
||||
// <ID, R extends MyRepository<T, ID>> R getRepository();
|
||||
|
||||
default T findById(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
default TV from(T entity) {
|
||||
TV model = createNewViewModel();
|
||||
model.update(entity);
|
||||
return model;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
default TV createNewViewModel() {
|
||||
try {
|
||||
Type[] types = getClass().getGenericInterfaces();
|
||||
// System.out.println("types = " + Arrays.asList(types));
|
||||
if (types.length > 0) {
|
||||
String typeName = types[0].getTypeName();
|
||||
// System.out.println("typeName = " + typeName);
|
||||
String clz = typeName.split("<")[1].split(">")[0].split(",")[1].trim();
|
||||
// System.out.println("clz = " + clz);
|
||||
Class<?> clazz = Class.forName(clz);
|
||||
return (TV) clazz.getDeclaredConstructor().newInstance();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("无法创建ViewModel实例", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
default T createNewEntity() {
|
||||
try {
|
||||
Type[] types = getClass().getGenericInterfaces();
|
||||
// System.out.println("types = " + Arrays.asList(types));
|
||||
if (types.length > 0) {
|
||||
String typeName = types[0].getTypeName();
|
||||
// System.out.println("typeName = " + typeName);
|
||||
String clz = typeName.split("<")[1].split(">")[0].split(",")[0].trim();
|
||||
// System.out.println("clz = " + clz);
|
||||
Class<?> clazz = Class.forName(clz);
|
||||
return (T) clazz.getDeclaredConstructor().newInstance();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("无法创建Entity实例", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
default T save(T entity) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'save'");
|
||||
}
|
||||
|
||||
default void delete(T entity) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'delete'");
|
||||
}
|
||||
|
||||
@Override
|
||||
default List<T> findAll() {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'findAll'");
|
||||
}
|
||||
|
||||
default Page<T> findAll(Map<String, Object> params, Pageable pageable) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'findAll'");
|
||||
}
|
||||
|
||||
default long count(Map<String, Object> params) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'count'");
|
||||
}
|
||||
|
||||
default Map<String, Object> getSpecification(String searchText) {
|
||||
HashMap<String, Object> params = new HashMap<>();
|
||||
params.put(ServiceConstant.KEY_SEARCH_TEXT, searchText);
|
||||
return params;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.controlsfx.control.TaskProgressView;
|
||||
|
||||
import com.ecep.contract.Desktop;
|
||||
import com.ecep.contract.task.ContractSyncTask;
|
||||
import com.ecep.contract.task.CustomerSyncTask;
|
||||
import com.ecep.contract.task.MonitoredTask;
|
||||
import com.ecep.contract.task.VendorSyncTask;
|
||||
|
||||
import javafx.concurrent.Task;
|
||||
|
||||
public class YongYouU8Service {
|
||||
|
||||
/**
|
||||
* 生成定时同步任务
|
||||
*
|
||||
* @param taskProgressView 任务视图
|
||||
*/
|
||||
public void scheduledTasks(TaskProgressView<Task<?>> taskProgressView) {
|
||||
ScheduledExecutorService executorService = Desktop.instance.getExecutorService();
|
||||
executorService.scheduleAtFixedRate(() -> {
|
||||
ContractSyncTask task = new ContractSyncTask();
|
||||
MonitoredTask<Object> registerTask = Desktop.instance.getTaskMonitorCenter().registerTask(task);
|
||||
registerTask.schedule(5, TimeUnit.SECONDS);
|
||||
}, 3, TimeUnit.MINUTES.toSeconds(15), TimeUnit.SECONDS);
|
||||
|
||||
executorService.scheduleAtFixedRate(() -> {
|
||||
// 1小时运行一次同步供应商任务
|
||||
VendorSyncTask vendorTask = new VendorSyncTask();
|
||||
MonitoredTask<Object> registerVendorTask = Desktop.instance.getTaskMonitorCenter().registerTask(vendorTask);
|
||||
registerVendorTask.schedule(60, TimeUnit.SECONDS);
|
||||
|
||||
// 1小时运行一次同步客户任务
|
||||
CustomerSyncTask customerTask = new CustomerSyncTask();
|
||||
MonitoredTask<Object> registerCustomerTask = Desktop.instance.getTaskMonitorCenter()
|
||||
.registerTask(customerTask);
|
||||
registerCustomerTask.schedule(60, TimeUnit.SECONDS);
|
||||
|
||||
}, 3, TimeUnit.HOURS.toSeconds(1), TimeUnit.SECONDS);
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user