🐛 修复同名业务部门展示与合同编号前缀按旧平台公司ID匹配失败
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+10
-5
@@ -907,14 +907,19 @@ public class ContractManageServiceImpl extends BaseServiceImpl<ContractManageMap
|
||||
throw new ServiceException("合同负责部门不存在");
|
||||
}
|
||||
Dept platformCompany = SysCache.getDept(platformCompanyId);
|
||||
if (platformCompany == null) {
|
||||
throw new ServiceException("平台公司不存在");
|
||||
}
|
||||
// 合同编号前缀改由「平台公司 + 业务部门」业务部门配置维护,不再读取组织机构 Dept.contractCodePrefix
|
||||
// 合同编号前缀改由「平台公司 + 业务部门」业务部门配置维护;系统侧会按同名现行平台公司回退匹配
|
||||
BusinessDeptConfig config = SysCache.getBusinessDeptConfig(platformCompanyId, organizationId);
|
||||
String prefix = config == null ? null : TransportBusinessSupport.trimToNull(config.getContractCodePrefix());
|
||||
if (Func.isEmpty(prefix)) {
|
||||
throw new ServiceException("业务部门配置中未维护该平台公司与业务部门的合同编码前缀,无法自动生成,请先在业务部门配置中维护或手动输入合同编号");
|
||||
if (platformCompany == null) {
|
||||
throw new ServiceException("平台公司不存在或已删除,且未匹配到同名平台公司的合同编码前缀配置,请重新选择平台公司或手动输入合同编号");
|
||||
}
|
||||
String platformName = TransportBusinessSupport.trimToNull(platformCompany.getDeptName());
|
||||
String deptName = TransportBusinessSupport.trimToNull(dept.getDeptName());
|
||||
throw new ServiceException(String.format(
|
||||
"业务部门配置中未维护平台公司「%s」与业务部门「%s」的合同编码前缀,无法自动生成;请确认项目平台公司与配置中的平台公司为同一组织后维护,或手动输入合同编号",
|
||||
Func.toStr(platformName, String.valueOf(platformCompanyId)),
|
||||
Func.toStr(deptName, String.valueOf(organizationId))));
|
||||
}
|
||||
int year = LocalDate.now().getYear();
|
||||
String head = prefix + "(" + year + ")";
|
||||
|
||||
Reference in New Issue
Block a user