✨ 进行中配载可编辑、汇票可选放开限制,并补充业务部门与待确认回单

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-22 15:40:59 +08:00
parent 73c8f6665e
commit dea72691de
23 changed files with 572 additions and 145 deletions
@@ -260,6 +260,17 @@ public class DeptController extends BladeController {
return R.data(deptService.listPlatformCompany());
}
/**
* 业务部门下拉(是否业务部门=是)
*/
@PreAuth(AuthConstant.PERMIT_ALL)
@GetMapping("/business-dept-select")
@ApiOperationSupport(order = 12)
@Operation(summary = "业务部门下拉", description = "返回是否业务部门=是的部门列表")
public R<List<Dept>> businessDeptSelect() {
return R.data(deptService.listBusinessDept());
}
/**
* 获取部门的主管信息
*/
@@ -20,6 +20,7 @@
<result column="mnemonic_code" property="mnemonicCode"/>
<result column="carrier_customer_id" property="carrierCustomerId"/>
<result column="is_platform_company" property="isPlatformCompany"/>
<result column="is_business_dept" property="isBusinessDept"/>
<result column="sort" property="sort"/>
<result column="remark" property="remark"/>
<result column="status" property="status"/>
@@ -43,6 +44,7 @@
<result column="mnemonic_code" property="mnemonicCode"/>
<result column="carrier_customer_id" property="carrierCustomerId"/>
<result column="is_platform_company" property="isPlatformCompany"/>
<result column="is_business_dept" property="isBusinessDept"/>
<result column="sort" property="sort"/>
<result column="remark" property="remark"/>
<result column="status" property="status"/>
@@ -106,6 +106,13 @@ public interface IDeptService extends IService<Dept> {
*/
List<Dept> listPlatformCompany();
/**
* 业务部门下拉(是否业务部门=是)
*
* @return 业务部门列表
*/
List<Dept> listBusinessDept();
/**
* 根据部门名称精确匹配获取部门ID集合
*
@@ -337,6 +337,18 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
return list(queryWrapper);
}
@Override
public List<Dept> listBusinessDept() {
LambdaQueryWrapper<Dept> queryWrapper = Wrappers.<Dept>lambdaQuery()
.eq(Dept::getIsBusinessDept, 1)
.orderByAsc(Dept::getSort)
.orderByAsc(Dept::getId);
if (!AuthUtil.isAdministrator()) {
queryWrapper.eq(Dept::getTenantId, AuthUtil.getTenantId());
}
return list(queryWrapper);
}
@Override
public String getDeptIds(String tenantId, String deptNames) {
List<Dept> deptList = baseMapper.selectList(Wrappers.<Dept>query().lambda().eq(Dept::getTenantId, tenantId).in(Dept::getDeptName, Func.toStrList(deptNames)));
@@ -443,6 +455,7 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
rootDept.setIsDeleted(BladeConstant.DB_NOT_DELETED);
rootDept.setIsOa(0);
rootDept.setIsPlatformCompany(0);
rootDept.setIsBusinessDept(0);
rootDept.setSyncTime(new Date());
this.save(rootDept);
log.info("已创建 OA 同步集团顶级 id={} name={} code={}",
@@ -536,6 +549,7 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
newRoot.setIsDeleted(BladeConstant.DB_NOT_DELETED);
newRoot.setIsOa(0);
newRoot.setIsPlatformCompany(0);
newRoot.setIsBusinessDept(0);
newRoot.setSyncTime(new Date());
this.save(newRoot);
log.info("迁移创建新集团顶级 id={}(来自历史 id={})", newRootId, legacyRootId);
@@ -598,6 +612,7 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
externalDept.setIsDeleted(BladeConstant.DB_NOT_DELETED);
externalDept.setIsOa(0);
externalDept.setIsPlatformCompany(0);
externalDept.setIsBusinessDept(0);
externalDept.setSyncTime(new Date());
this.save(externalDept);
log.info("已创建外部组织顶级 id={}", externalDept.getId());
@@ -678,6 +693,9 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
if (dept.getIsPlatformCompany() == null) {
dept.setIsPlatformCompany(0);
}
if (dept.getIsBusinessDept() == null) {
dept.setIsBusinessDept(0);
}
// 排序未填时默认 1
if (dept.getSort() == null) {
dept.setSort(1);
@@ -804,6 +822,7 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
dept.setIsDeleted(BladeConstant.DB_NOT_DELETED);
dept.setIsOa(1);
dept.setIsPlatformCompany(0);
dept.setIsBusinessDept(0);
dept.setSyncTime(new Date());
boolean saved = save(dept);
if (saved) {
@@ -924,7 +924,8 @@ public class OASyncServiceImpl implements IOASyncService {
.select(Dept::getId, Dept::getDeptCode, Dept::getDeptName, Dept::getFullName,
Dept::getOaModified, Dept::getParentId, Dept::getOaId, Dept::getBelongCompanyCode,
Dept::getParentCode, Dept::getOaSupSubComId,
Dept::getContractCodePrefix, Dept::getContractInitialSerial));
Dept::getContractCodePrefix, Dept::getContractInitialSerial,
Dept::getIsPlatformCompany, Dept::getIsBusinessDept));
Map<String, Dept> byOaId = new HashMap<>();
for (Dept dept : deptList) {
if (StringUtils.isNotBlank(dept.getOaId())) {
@@ -989,6 +990,8 @@ public class OASyncServiceImpl implements IOASyncService {
}
// OA 不同步合同本地配置:保留已有值,并把 -1 空占位规范为 null,避免 ALWAYS 策略写回 -1/清空
preserveLocalContractFields(dept, existing);
// OA 不同步「是否平台公司 / 是否业务部门」:更新时强制保留本地已配置值,新增默认否
preserveLocalBizFlags(dept, existing);
normalizeContractInitialSerial(dept);
if (StringUtils.isNotBlank(dept.getDeptCode())) {
deptIdByCode.put(dept.getDeptCode(), dept.getId());
@@ -1066,6 +1069,26 @@ public class OASyncServiceImpl implements IOASyncService {
}
}
/**
* OA 同步不携带本地业务标志:更新时保留已配置的「是否平台公司 / 是否业务部门」,新增默认否。
*/
private void preserveLocalBizFlags(Dept incoming, Dept existing) {
if (incoming == null) {
return;
}
if (existing != null) {
incoming.setIsPlatformCompany(existing.getIsPlatformCompany() != null ? existing.getIsPlatformCompany() : 0);
incoming.setIsBusinessDept(existing.getIsBusinessDept() != null ? existing.getIsBusinessDept() : 0);
return;
}
if (incoming.getIsPlatformCompany() == null) {
incoming.setIsPlatformCompany(0);
}
if (incoming.getIsBusinessDept() == null) {
incoming.setIsBusinessDept(0);
}
}
/**
* 合同初始流水号 -1 为空占位,同步落库前规范为 null。
*/