✨ 组织与人员支持OA增量同步,并完善用户启停与性别空值

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-10 13:56:29 +08:00
parent e20afc0d55
commit 4e7193893f
22 changed files with 423 additions and 100 deletions
@@ -38,6 +38,7 @@ import org.springblade.core.tenant.annotation.TenantIgnore;
import org.springblade.core.tool.jackson.JsonUtil;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.cache.SysCache;
import org.springblade.system.cache.UserCache;
import org.springblade.transport.excel.CustomerArchiveExcel;
import org.springblade.transport.mapper.CreditRatingStandardMapper;
@@ -118,6 +119,8 @@ public class CustomerArchiveServiceImpl extends BaseServiceImpl<CustomerArchiveM
private static final String APPROVAL_REVIEWING = "reviewing";
private static final String APPROVAL_APPROVED = "approved";
private static final String APPROVAL_REJECTED = "rejected";
/** 客商所属组织固定为顶层组织 */
private static final String FIXED_OWNER_DEPT_NAME = "桂物物流集团";
private static final String CUSTOMER_CODE_PREFIX = "KS";
/**
* 变更快照忽略字段:明细每次保存会重建主键/审计字段,不能作为“是否有修改”的依据
@@ -479,15 +482,7 @@ public class CustomerArchiveServiceImpl extends BaseServiceImpl<CustomerArchiveM
customer.setRegisteredAddress(buildRegisteredAddress(customer));
customer.setLegalPerson(trimToEmpty(customer.getLegalPerson()));
customer.setContactPhone(trimToEmpty(customer.getContactPhone()));
customer.setDeptIds(trimToNull(customer.getDeptIds()));
if (Func.isNotEmpty(customer.getDeptIds())) {
List<Long> deptIdList = Func.toLongList(customer.getDeptIds());
if (Func.isEmpty(deptIdList)) {
throw new ServiceException("所属组织不正确");
}
customer.setDeptId(deptIdList.get(0));
}
customer.setDeptName(trimToEmpty(customer.getDeptName()));
applyFixedOwnerDept(customer);
customer.setAccessType(Func.isEmpty(customer.getAccessType()) ? ACCESS_TEMPORARY : customer.getAccessType());
customer.setApprovalStatus(Func.isEmpty(customer.getApprovalStatus()) ? APPROVAL_DRAFT : customer.getApprovalStatus());
if (Func.isEmpty(customer.getStatus())) {
@@ -1628,6 +1623,25 @@ public class CustomerArchiveServiceImpl extends BaseServiceImpl<CustomerArchiveM
return trimToNull(fallbackAddress);
}
/**
* 客商所属组织固定为顶层「桂物物流集团」,忽略前端传入的其他组织。
*/
private void applyFixedOwnerDept(CustomerArchiveVO customer) {
customer.setDeptName(FIXED_OWNER_DEPT_NAME);
String tenantId = AuthUtil.getTenantId();
String deptIds = SysCache.getDeptIds(tenantId, FIXED_OWNER_DEPT_NAME);
if (Func.isEmpty(deptIds)) {
throw new ServiceException("未找到所属组织「" + FIXED_OWNER_DEPT_NAME + "」,请先维护组织数据");
}
List<Long> deptIdList = Func.toLongList(deptIds);
if (Func.isEmpty(deptIdList) || deptIdList.get(0) == null) {
throw new ServiceException("所属组织「" + FIXED_OWNER_DEPT_NAME + "」不正确");
}
Long deptId = deptIdList.get(0);
customer.setDeptId(deptId);
customer.setDeptIds(String.valueOf(deptId));
}
private String trimToEmpty(String value) {
return value == null ? "" : value.trim();
}
@@ -739,9 +739,6 @@ public class ProjectApplyServiceImpl extends BaseServiceImpl<ProjectApplyMapper,
TransportBusinessSupport.validateRequired(projectApply.getCarrierNames(), "请选择下游承运商");
validateAmount(projectApply.getFundLimit(), "项目资金使用额度", false);
validateAmount(projectApply.getReceivableLimit(), "项目应收账款额度", false);
if (projectApply.getReceivableLimit() != null && projectApply.getFundLimit() != null && projectApply.getReceivableLimit().compareTo(projectApply.getFundLimit()) > 0) {
throw new ServiceException("项目应收账款额度不能超过项目资金使用额度");
}
validateDays(projectApply.getReceivableDays(), "应收账款回款期限");
validateDays(projectApply.getPaymentDays(), "回款账期");
validateAmount(projectApply.getProjectScale(), "项目规模", true);
@@ -1926,7 +1926,7 @@ public class WaybillServiceImpl extends BaseServiceImpl<WaybillMapper, Waybill>
if (isRoadTransport(waybill.getTransportType())) {
if ("承运商".equals(waybill.getCarrierType())) {
TransportBusinessSupport.validateRequired(waybill.getCarrierName(), "承运商不能为空");
} else {
} else if (!isBatchImport(waybill)) {
TransportBusinessSupport.validateRequired(waybill.getDriverName(), "司机不能为空");
}
}
@@ -2079,6 +2079,10 @@ public class WaybillServiceImpl extends BaseServiceImpl<WaybillMapper, Waybill>
return value.contains("公路") || value.contains("道路") || value.contains("road") || "gl".equals(value);
}
private boolean isBatchImport(Waybill waybill) {
return waybill != null && TransportBusinessSupport.DATA_SOURCE_BATCH_IMPORT.equals(waybill.getDataSource());
}
private void fillJsonFromFlatFields(Waybill waybill) {
if (Func.isEmpty(waybill.getTaskEntryMode())) {
waybill.setTaskEntryMode("simple");