refactor: 重构服务依赖注入和上下文管理
移除硬编码的服务注入,改为使用缓存机制动态获取Bean 优化上下文类结构,统一服务获取方式 添加PageContent类支持分页数据封装 实现异步数据加载功能
This commit is contained in:
@@ -137,7 +137,7 @@ public class ContractService implements IEntityService<Contract>, QueryService<C
|
||||
}
|
||||
|
||||
// field
|
||||
spec = SpecificationUtils.andFieldEqualParam(spec, paramsNode, "parentCode");
|
||||
spec = SpecificationUtils.andFieldEqualParam(spec, paramsNode, "payWay", "parentCode");
|
||||
|
||||
// relation
|
||||
spec = SpecificationUtils.andParam(spec, paramsNode, "group", "kind", "type", "group", "company", "project");
|
||||
|
||||
@@ -77,10 +77,6 @@ public abstract class AbstContractRepairTasker extends Tasker<Object> {
|
||||
return purchaseBillVoucherCtx;
|
||||
}
|
||||
|
||||
public void setContractService(ContractService contractService) {
|
||||
contractCtx.setContractService(contractService);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object execute(MessageHolder holder) throws Exception {
|
||||
try {
|
||||
|
||||
@@ -31,7 +31,6 @@ public class ContractFilesRebuildAllTasker extends Tasker<Object> {
|
||||
ContractCtx getContractCtx() {
|
||||
if (contractCtx == null) {
|
||||
contractCtx = new ContractCtx();
|
||||
contractCtx.setContractService(getContractService());
|
||||
}
|
||||
return contractCtx;
|
||||
}
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
package com.ecep.contract.ds.project;
|
||||
|
||||
import static com.ecep.contract.SpringApp.getBean;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import org.hibernate.Hibernate;
|
||||
|
||||
import com.ecep.contract.MessageHolder;
|
||||
import com.ecep.contract.cloud.AbstractCtx;
|
||||
import com.ecep.contract.ds.company.service.CompanyService;
|
||||
import com.ecep.contract.ds.project.service.ProjectService;
|
||||
import com.ecep.contract.model.Company;
|
||||
import com.ecep.contract.model.Project;
|
||||
@@ -18,8 +15,7 @@ import lombok.Setter;
|
||||
public class ProjectCtx extends AbstractCtx {
|
||||
@Setter
|
||||
private ProjectService projectService;
|
||||
@Setter
|
||||
CompanyService companyService;
|
||||
|
||||
|
||||
ProjectService getProjectService() {
|
||||
if (projectService == null) {
|
||||
@@ -28,13 +24,6 @@ public class ProjectCtx extends AbstractCtx {
|
||||
return projectService;
|
||||
}
|
||||
|
||||
CompanyService getCompanyService() {
|
||||
if (companyService == null) {
|
||||
companyService = getBean(CompanyService.class);
|
||||
}
|
||||
return companyService;
|
||||
}
|
||||
|
||||
public boolean updateCustomer(Project project, Company customer, MessageHolder holder) {
|
||||
boolean modified = false;
|
||||
if (!Objects.equals(project.getCustomer(), customer)) {
|
||||
|
||||
Reference in New Issue
Block a user