feat: 新增多个服务类及工具类,重构部分代码结构

重构服务类结构,将分散的服务统一整合到service包下
新增ProjectConstant常量类及多个实体服务类
添加SecurityUtils安全工具类和BeanCacher工具类
优化部分UI控件和转换器的实现
This commit is contained in:
2025-09-06 13:43:52 +08:00
parent 0e444508ff
commit effd7b103c
253 changed files with 2920 additions and 1646 deletions

View File

@@ -14,7 +14,7 @@ import org.springframework.util.StringUtils;
import com.ecep.contract.MessageHolder;
import com.ecep.contract.SpringApp;
import com.ecep.contract.cloud.u8.ctx.ContractCtx;
import com.ecep.contract.constant.CloudYuConstant;
import com.ecep.contract.ds.contract.tasker.AbstContractRepairTasker;
/**
@@ -37,7 +37,7 @@ public class ContractSyncTask extends AbstContractRepairTasker {
holder.error("无法获取 YongYouU8Repository " + e.getMessage());
return;
}
if (getConfService().getBoolean(ContractCtx.KEY_SYNC_USE_LATEST_ID)) {
if (getConfService().getBoolean(CloudYuConstant.KEY_SYNC_USE_LATEST_ID)) {
syncByLatestId(holder);
} else {
syncByLatestDate(holder);
@@ -45,7 +45,7 @@ public class ContractSyncTask extends AbstContractRepairTasker {
}
private void syncByLatestId(MessageHolder holder) {
int latestId = getConfService().getInt(ContractCtx.KEY_SYNC_BY_LATEST_ID);
int latestId = getConfService().getInt(CloudYuConstant.KEY_SYNC_BY_LATEST_ID);
updateTitle("用友U8系统-同步合同,从 " + latestId + " 开始");
Long total = repository.countAllContracts(latestId);
@@ -81,11 +81,11 @@ public class ContractSyncTask extends AbstContractRepairTasker {
updateProgress(counter.incrementAndGet(), total);
});
}
getConfService().set(ContractCtx.KEY_SYNC_BY_LATEST_ID, String.valueOf(reference.get()));
getConfService().set(CloudYuConstant.KEY_SYNC_BY_LATEST_ID, String.valueOf(reference.get()));
}
private void syncByLatestDate(MessageHolder holder) {
String strDateTime = getConfService().getString(ContractCtx.KEY_SYNC_BY_LATEST_DATE);
String strDateTime = getConfService().getString(CloudYuConstant.KEY_SYNC_BY_LATEST_DATE);
LocalDateTime latestDateTime = null;
if (StringUtils.hasText(strDateTime)) {
try {
@@ -135,7 +135,7 @@ public class ContractSyncTask extends AbstContractRepairTasker {
updateProgress(counter.incrementAndGet(), total);
});
}
getConfService().set(ContractCtx.KEY_SYNC_BY_LATEST_DATE, String.valueOf(reference.get()));
getConfService().set(CloudYuConstant.KEY_SYNC_BY_LATEST_DATE, String.valueOf(reference.get()));
}
}

View File

@@ -10,6 +10,7 @@ import org.springframework.util.StringUtils;
import com.ecep.contract.MessageHolder;
import com.ecep.contract.constant.CloudServiceConstant;
import com.ecep.contract.constant.CloudYuConstant;
import com.ecep.contract.ds.company.service.CompanyOldNameService;
import com.ecep.contract.ds.company.service.CompanyService;
import com.ecep.contract.model.Company;
@@ -18,11 +19,6 @@ import com.ecep.contract.model.CompanyOldName;
import lombok.Setter;
public class CompanyCtx extends AbstractYongYouU8Ctx {
/**
* 自动创建公司的时间
*/
public static final String AUTO_CREATE_COMPANY_AFTER = "cloud.u8.auto-create-company-after";
@Setter
private CompanyOldNameService companyOldNameService;
@@ -114,7 +110,7 @@ public class CompanyCtx extends AbstractYongYouU8Ctx {
return null;
}
CompanyService companyService = getCompanyService();
String autoCreateAfter = getConfService().getString(AUTO_CREATE_COMPANY_AFTER);
String autoCreateAfter = getConfService().getString(CloudYuConstant.KEY_AUTO_CREATE_COMPANY_AFTER);
// 当配置存在,且开发时间小于指定时间,不创建
if (StringUtils.hasText(autoCreateAfter)) {
LocalDate miniDate = LocalDate.parse(autoCreateAfter);

View File

@@ -66,24 +66,6 @@ import lombok.Setter;
* 合同上下文
*/
public class ContractCtx extends AbstractYongYouU8Ctx {
public static final String KEY_PREFIX = "cloud.u8.contract.";
/**
* 合同同步后的最后一个日期
*/
public static final String KEY_SYNC_BY_LATEST_DATE = KEY_PREFIX + "latestDate";
/**
* 合同同步后的最后一个合同ID
*/
public static final String KEY_SYNC_BY_LATEST_ID = KEY_PREFIX + "latestId";
/**
* 合同同步时是否使用最后更新的Id来判断更新范围否则使用最后更新的合同日期来判断更新范围
*/
public static final String KEY_SYNC_USE_LATEST_ID = KEY_PREFIX + "sync.use-latest-id";
/**
* 合同同步时的时间间隔,单位:秒
*/
public static final String KEY_SYNC_ELAPSE = KEY_PREFIX + "sync.elapse";
@Setter
private ContractService contractService;
@Setter