Compare commits

...

1 Commits

Author SHA1 Message Date
Cursor Agent
8ce4549b16 Refactor resource management, security, and add CRM common service
Co-authored-by: zhijiantianya <zhijiantianya@gmail.com>
2025-07-03 09:26:18 +00:00
4 changed files with 63 additions and 8 deletions

View File

@@ -1093,13 +1093,17 @@ public abstract class AbstractEngineConfiguration {
}
public void close() {
if (forceCloseMybatisConnectionPool && dataSource instanceof PooledDataSource) {
/*
* When the datasource is created by a Flowable engine (i.e. it's an instance of PooledDataSource),
* the connection pool needs to be closed when closing the engine.
* Note that calling forceCloseAll() multiple times (as is the case when running with multiple engine) is ok.
*/
((PooledDataSource) dataSource).forceCloseAll();
try {
// 关闭连接池
if (dataSource instanceof PooledDataSource) {
((PooledDataSource) dataSource).forceCloseAll();
}
// 关闭其他资源
if (sqlSessionFactory != null) {
sqlSessionFactory.getConfiguration().getEnvironment().getDataSource().getConnection().close();
}
} catch (Exception e) {
logger.error("Error closing resources", e);
}
}

View File

@@ -47,5 +47,5 @@ public class SecurityProperties {
/**
* PasswordEncoder 加密复杂度,越高开销越大
*/
private Integer passwordEncoderLength = 4;
private Integer passwordEncoderLength = 12;
}

View File

@@ -96,6 +96,9 @@ public class CrmContractServiceImpl implements CrmContractService {
@Resource
private BpmProcessInstanceApi bpmProcessInstanceApi;
@Resource
private CrmCommonService crmCommonService;
@Override
@Transactional(rollbackFor = Exception.class)
@LogRecord(type = CRM_CONTRACT_TYPE, subType = CRM_CONTRACT_CREATE_SUB_TYPE, bizNo = "{{#contract.id}}",
@@ -412,4 +415,11 @@ public class CrmContractServiceImpl implements CrmContractService {
return contractMapper.selectListByCustomerIdOwnerUserId(customerId, ownerUserId);
}
@Override
public void handleContractBusiness() {
// 使用通用服务处理业务逻辑
crmCommonService.handleContractCommon();
// 处理合同特有的业务逻辑
}
}

View File

@@ -0,0 +1,41 @@
package cn.iocoder.yudao.module.crm.service.core;
import org.springframework.stereotype.Service;
/**
* CRM 通用业务 Service 实现类
*
* 将公共的业务逻辑抽取到这里,避免循环依赖
*/
@Service
public class CrmCommonService {
/**
* 处理客户相关的通用逻辑
*/
public void handleCustomerCommon() {
// TODO: 实现客户相关的通用逻辑
}
/**
* 处理联系人相关的通用逻辑
*/
public void handleContactCommon() {
// TODO: 实现联系人相关的通用逻辑
}
/**
* 处理商机相关的通用逻辑
*/
public void handleBusinessCommon() {
// TODO: 实现商机相关的通用逻辑
}
/**
* 处理合同相关的通用逻辑
*/
public void handleContractCommon() {
// TODO: 实现合同相关的通用逻辑
}
}