feat(closedArea): add currentUserCanAudit logic for car apply

koumen
dearLin 2026-03-20 11:00:08 +08:00
parent 211b07cdff
commit 6a4e893873
1 changed files with 17 additions and 0 deletions

View File

@ -1,5 +1,6 @@
package com.zcloud.primeport.command.query;
import com.jjb.saas.framework.auth.utils.AuthContext;
import com.zcloud.primeport.command.convertor.ClosedAreaCarApplyCoConvertor;
import com.zcloud.primeport.dto.ClosedAreaCarApplyPageQry;
import com.zcloud.primeport.dto.clientobject.ClosedAreaCarApplyCO;
@ -46,6 +47,22 @@ public class ClosedAreaCarApplyQueryExe {
Map<String, Object> params = PageQueryHelper.toHashMap(closedAreaCarApplyPageQry);
PageResponse<ClosedAreaCarApplyDO> pageResponse = closedAreaCarApplyRepository.listPage(params);
List<ClosedAreaCarApplyCO> examCenterCOS = closedAreaCarApplyCoConvertor.converDOsToCOs(pageResponse.getData());
// 获取当前登录用户ID
Long currentUserId = AuthContext.getUserId();
// 设置当前用户是否能审核
for (ClosedAreaCarApplyCO co : examCenterCOS) {
// 审核中(1)且当前用户是审批人 → 能审核(1),否则不能审核(2)
if (co.getAuditFlag() != null && co.getAuditFlag() == 1
&& co.getAuditPersonUserId() != null
&& co.getAuditPersonUserId().equals(currentUserId)) {
co.setCurrentUserCanAudit(1);
} else {
co.setCurrentUserCanAudit(2);
}
}
return PageResponse.of(examCenterCOS, pageResponse.getTotalCount(), pageResponse.getPageSize(), pageResponse.getPageIndex());
}
}