This commit is contained in:
2025-10-11 09:21:14 +08:00
parent bda92193d4
commit 553feac0a4
93 changed files with 1736 additions and 676 deletions

View File

@@ -2,7 +2,7 @@ package com.ecep.contract.cloud.old;
import com.ecep.contract.MessageHolder;
import com.ecep.contract.SpringApp;
import com.ecep.contract.ds.customer.service.CompanyCustomerService;
import com.ecep.contract.ds.customer.service.CustomerService;
import com.ecep.contract.ds.company.model.Company;
import com.ecep.contract.ds.contract.model.Contract;
import com.ecep.contract.ui.Tasker;
@@ -37,7 +37,7 @@ public class OldVersionSyncCustomerTask extends Tasker<Object> {
@Override
protected Object execute(MessageHolder holder) throws Exception {
updateTitle("老版本-同步客户数据");
basePath = getCachedBean(CompanyCustomerService.class).getBasePath();
basePath = getCachedBean(CustomerService.class).getBasePath();
List<Runnable> runnable = Arrays.asList(this::loadOldNames, this::loadContacts, this::syncCustomers,
this::syncContracts);

View File

@@ -1,6 +1,7 @@
package com.ecep.contract.cloud.rk;
import java.time.Instant;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;
@@ -38,13 +39,13 @@ public interface CloudRkRepository extends MyRepository<CloudRk, Integer> {
List<CloudRk> findAllByCompanyId(int companyId);
long countByLatestUpdateBefore(Instant instant);
long countByLatestUpdateBefore(LocalDateTime instant);
long countByAutoUpdateIsTrueAndLatestUpdateBefore(Instant instant);
long countByAutoUpdateIsTrueAndLatestUpdateBefore(LocalDateTime instant);
List<CloudRk> findTop100ByLatestUpdateBeforeOrderByLatestUpdateDesc(Instant instant);
List<CloudRk> findTop100ByLatestUpdateBeforeOrderByLatestUpdateDesc(LocalDateTime instant);
List<CloudRk> findTop100ByAutoUpdateIsTrueAndLatestUpdateBeforeOrderByLatestUpdateDesc(Instant instant);
List<CloudRk> findTop100ByAutoUpdateIsTrueAndLatestUpdateBeforeOrderByLatestUpdateDesc(LocalDateTime instant);
@Modifying
@Transactional

View File

@@ -354,9 +354,9 @@ public class CloudRkService implements IEntityService<CloudRk>, QueryService<Clo
* @return 记录条数
*/
public long countNeedUpdate() {
Instant now = Instant.now();
LocalDateTime now = LocalDateTime.now();
long elapse = getSyncElapse();
Instant instant = now.minusSeconds(elapse);
LocalDateTime instant = now.minusSeconds(elapse);
return cloudRKRepository.countByAutoUpdateIsTrueAndLatestUpdateBefore(instant);
}
@@ -365,9 +365,9 @@ public class CloudRkService implements IEntityService<CloudRk>, QueryService<Clo
*/
// @Transactional
public List<CloudRk> findNeedUpdate() {
Instant now = Instant.now();
LocalDateTime now = LocalDateTime.now();
long elapse = getSyncElapse();
Instant instant = now.minusSeconds(elapse);
LocalDateTime instant = now.minusSeconds(elapse);
return cloudRKRepository.findTop100ByAutoUpdateIsTrueAndLatestUpdateBeforeOrderByLatestUpdateDesc(instant);
}

View File

@@ -86,7 +86,7 @@ public class CloudRkCtx extends AbstractCtx implements CloudRkContext {
*/
public boolean syncCompany(Company company, CloudRk cloudRk, MessageHolder holder) {
if (!StringUtils.hasText(cloudRk.getCloudId())) {
holder.warn("未定义平台编号, 尝试从平台上自动获取");
holder.warn("未定义平台编号, 尝试获取平台编号");
// 当未定义平台编号时,尝试自动获取
if (!queryCloudIdAndSelectOne(company, cloudRk, holder)) {
// 自动获取到平台编号失败,立即返回
@@ -468,6 +468,7 @@ public class CloudRkCtx extends AbstractCtx implements CloudRkContext {
List<CloudRkService.EntInfo> results = new ArrayList<>();
ObjectMapper objectMapper = getObjectMapper();
try {
holder.debug("POST " + url);
HttpJsonUtils.post(url, data -> {
data.put("theKey", company.getName());
data.put("get", true);
@@ -819,13 +820,13 @@ public class CloudRkCtx extends AbstractCtx implements CloudRkContext {
private void saveJsonToFile(Company company, JsonNode json, String fileName, MessageHolder holder) {
String companyPath = company.getPath();
if (!StringUtils.hasText(companyPath)) {
holder.warn("公司路径为空");
holder.warn("公司路径为空, 无法保存 " + fileName);
return;
}
File dir = new File(companyPath);
if (!dir.exists()) {
holder.warn("公司路径不存在");
holder.warn("公司路径" + dir.getName() + "不存在, 无法保存 " + fileName);
return;
}

View File

@@ -12,7 +12,7 @@ import org.springframework.beans.BeansException;
import com.ecep.contract.MessageHolder;
import com.ecep.contract.SpringApp;
import com.ecep.contract.ds.customer.service.CompanyCustomerService;
import com.ecep.contract.ds.customer.service.CustomerService;
import com.ecep.contract.model.CustomerCatalog;
import com.ecep.contract.ui.Tasker;
import com.ecep.contract.vo.CustomerCatalogVo;
@@ -25,15 +25,15 @@ import lombok.Setter;
public class CustomerClassSyncTask extends Tasker<Object> {
private static final Logger logger = LoggerFactory.getLogger(CustomerClassSyncTask.class);
@Setter
private CompanyCustomerService companyCustomerService;
private CustomerService companyCustomerService;
public CustomerClassSyncTask() {
updateTitle("用友U8系统-同步客户分类信息");
}
CompanyCustomerService getCompanyCustomerService() {
CustomerService getCompanyCustomerService() {
if (companyCustomerService == null) {
companyCustomerService = SpringApp.getBean(CompanyCustomerService.class);
companyCustomerService = SpringApp.getBean(CustomerService.class);
}
return companyCustomerService;
}

View File

@@ -20,7 +20,7 @@ import com.ecep.contract.cloud.u8.ctx.CustomerCtx;
import com.ecep.contract.constant.CloudServiceConstant;
import com.ecep.contract.ds.company.service.CompanyService;
import com.ecep.contract.ds.contract.tasker.AbstContractRepairTasker;
import com.ecep.contract.ds.customer.service.CompanyCustomerService;
import com.ecep.contract.ds.customer.service.CustomerService;
import com.ecep.contract.ds.other.model.CloudYu;
import com.ecep.contract.ds.company.model.Company;
import com.ecep.contract.ds.customer.model.CompanyCustomer;
@@ -42,7 +42,7 @@ public class CustomerSyncTask extends AbstContractRepairTasker {
updateTitle("用友U8系统-同步客户");
}
private CompanyCustomerService getCompanyCustomerService() {
private CustomerService getCompanyCustomerService() {
return customerCtx.getCompanyCustomerService();
}

View File

@@ -14,7 +14,7 @@ import com.ecep.contract.cloud.AbstractCtx;
import com.ecep.contract.cloud.u8.YongYouU8Repository;
import com.ecep.contract.constant.CloudServiceConstant;
import com.ecep.contract.ds.customer.service.CompanyCustomerEntityService;
import com.ecep.contract.ds.customer.service.CompanyCustomerService;
import com.ecep.contract.ds.customer.service.CustomerService;
import com.ecep.contract.ds.vendor.service.VendorEntityService;
import com.ecep.contract.ds.vendor.service.VendorService;
import com.ecep.contract.ds.company.model.Company;
@@ -45,8 +45,8 @@ public class AbstractYongYouU8Ctx extends AbstractCtx {
}
}
public CompanyCustomerService getCompanyCustomerService() {
return getCachedBean(CompanyCustomerService.class);
public CustomerService getCompanyCustomerService() {
return getCachedBean(CustomerService.class);
}
public CompanyCustomerEntityService getCompanyCustomerEntityService() {
@@ -111,12 +111,12 @@ public class AbstractYongYouU8Ctx extends AbstractCtx {
Company company = null;
if (StringUtils.hasText(customerCode)) {
CompanyCustomerEntityService customerEntityService = getCompanyCustomerEntityService();
CompanyCustomerService customerService = getCompanyCustomerService();
CustomerService customerService = getCompanyCustomerService();
CompanyCustomerEntityVo entity = customerEntityService.findByCustomerCode(customerCode);
if (entity == null) {
holder.warn("无效" + topic + "" + customerCode);
} else {
CompanyCustomerVo customer = customerService.findById(entity.getCustomerId());
CustomerVo customer = customerService.findById(entity.getCustomerId());
if (customer == null) {
holder.warn("无效" + topic + "" + customerCode);
} else {

View File

@@ -37,7 +37,7 @@ import com.ecep.contract.ds.contract.service.ContractPayPlanService;
import com.ecep.contract.ds.contract.service.ContractService;
import com.ecep.contract.ds.contract.service.ContractTypeService;
import com.ecep.contract.ds.customer.service.CompanyCustomerEntityService;
import com.ecep.contract.ds.customer.service.CompanyCustomerService;
import com.ecep.contract.ds.customer.service.CustomerService;
import com.ecep.contract.ds.project.ProjectCtx;
import com.ecep.contract.ds.project.service.ProjectSaleTypeService;
import com.ecep.contract.ds.vendor.service.VendorEntityService;
@@ -463,7 +463,7 @@ public class ContractCtx extends AbstractYongYouU8Ctx {
boolean modified = false;
boolean customerModified = false;
CompanyCustomerEntityService customerEntityService = getCompanyCustomerEntityService();
CompanyCustomerService customerService = getCompanyCustomerService();
CustomerService customerService = getCompanyCustomerService();
CompanyCustomerEntityVo entity = customerEntityService.findByCustomerCode(unit);
if (entity == null) {
CompanyCustomerEntity v1 = new CompanyCustomerEntity();
@@ -472,7 +472,7 @@ public class ContractCtx extends AbstractYongYouU8Ctx {
}
entity = updateCustomerEntityDetailByCode(entity, unit, holder);
CompanyCustomerVo customer = customerService.findById(entity.getCustomerId());
CustomerVo customer = customerService.findById(entity.getCustomerId());
if (customer == null) {
if (company != null) {
customer = customerService.findByCompany(company).toVo();