crud注入当前操作用户信息
parent
2766c34889
commit
3c87bf32f1
|
|
@ -11,6 +11,7 @@ import org.qinan.safetyeval.domain.entity.OrgDepartmentEntity;
|
|||
import org.qinan.safetyeval.domain.query.OrgDepartmentQuery;
|
||||
import org.qinan.safetyeval.domain.query.PageResult;
|
||||
import org.qinan.safetyeval.domain.service.OrgDepartmentDomainService;
|
||||
import org.qinan.safetyeval.infrastructure.adapter.auth.AuthUserContextAdapter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -73,7 +74,8 @@ public class OrgDepartmentExecutor implements OrgDepartmentApi {
|
|||
OrgDepartmentQuery domainQuery = new OrgDepartmentQuery();
|
||||
domainQuery.setPageNum(query.getCurrent());
|
||||
domainQuery.setPageSize(query.getSize());
|
||||
domainQuery.setOrgId(query.getOrgId());
|
||||
domainQuery.setTenantId(AuthUserContextAdapter.getCurrentTenantId());
|
||||
domainQuery.setOrgId(AuthUserContextAdapter.getCurrentOrgId());
|
||||
domainQuery.setParentId(query.getParentId());
|
||||
domainQuery.setDeptName(query.getDeptName());
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import org.qinan.safetyeval.domain.entity.OrgEquipmentEntity;
|
|||
import org.qinan.safetyeval.domain.query.OrgEquipmentQuery;
|
||||
import org.qinan.safetyeval.domain.query.PageResult;
|
||||
import org.qinan.safetyeval.domain.service.OrgEquipmentDomainService;
|
||||
import org.qinan.safetyeval.infrastructure.adapter.auth.AuthUserContextAdapter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -93,7 +94,8 @@ public class OrgEquipmentExecutor implements OrgEquipmentApi {
|
|||
OrgEquipmentQuery domainQuery = new OrgEquipmentQuery();
|
||||
domainQuery.setPageNum(query.getCurrent());
|
||||
domainQuery.setPageSize(query.getSize());
|
||||
domainQuery.setOrgId(query.getOrgId());
|
||||
domainQuery.setTenantId(AuthUserContextAdapter.getCurrentTenantId());
|
||||
domainQuery.setOrgId(AuthUserContextAdapter.getCurrentOrgId());
|
||||
domainQuery.setDeviceName(query.getDeviceName());
|
||||
domainQuery.setInstrumentType(query.getInstrumentType());
|
||||
domainQuery.setDeviceType(query.getDeviceType());
|
||||
|
|
|
|||
|
|
@ -130,6 +130,7 @@ public class OrgInfoExecutor implements OrgInfoApi {
|
|||
domainQuery.setUnitName(query.getUnitName());
|
||||
domainQuery.setCreditCode(query.getCreditCode());
|
||||
domainQuery.setAuthStatusCode(query.getAuthStatusCode());
|
||||
// 管理员可跨租户查询机构信息,此处保留前端传入的tenantId
|
||||
domainQuery.setTenantId(query.getTenantId());
|
||||
|
||||
PageResult<OrgInfoEntity> pageResult = orgInfoDomainService.page(domainQuery);
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import org.qinan.safetyeval.domain.entity.OrgPersonnelCertEntity;
|
|||
import org.qinan.safetyeval.domain.query.OrgPersonnelCertQuery;
|
||||
import org.qinan.safetyeval.domain.query.PageResult;
|
||||
import org.qinan.safetyeval.domain.service.OrgPersonnelCertDomainService;
|
||||
import org.qinan.safetyeval.infrastructure.adapter.auth.AuthUserContextAdapter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -89,7 +90,8 @@ public class OrgPersonnelCertExecutor implements OrgPersonnelCertApi {
|
|||
OrgPersonnelCertQuery domainQuery = new OrgPersonnelCertQuery();
|
||||
domainQuery.setPageNum(query.getCurrent());
|
||||
domainQuery.setPageSize(query.getSize());
|
||||
domainQuery.setOrgId(query.getOrgId());
|
||||
domainQuery.setTenantId(AuthUserContextAdapter.getCurrentTenantId());
|
||||
domainQuery.setOrgId(AuthUserContextAdapter.getCurrentOrgId());
|
||||
domainQuery.setPersonnelId(query.getPersonnelId());
|
||||
domainQuery.setCertName(query.getCertName());
|
||||
domainQuery.setCertTypeCode(query.getCertTypeCode());
|
||||
|
|
|
|||
|
|
@ -11,9 +11,11 @@ import org.qinan.safetyeval.domain.entity.OrgPersonnelChangeEntity;
|
|||
import org.qinan.safetyeval.domain.query.OrgPersonnelChangeQuery;
|
||||
import org.qinan.safetyeval.domain.query.PageResult;
|
||||
import org.qinan.safetyeval.domain.service.OrgPersonnelChangeDomainService;
|
||||
import org.qinan.safetyeval.infrastructure.adapter.auth.AuthUserContextAdapter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* 人员变更记录执行器(App层)
|
||||
|
|
@ -32,7 +34,9 @@ public class OrgPersonnelChangeExecutor implements OrgPersonnelChangeApi {
|
|||
OrgPersonnelChangeEntity entity = new OrgPersonnelChangeEntity();
|
||||
entity.setChangeItem(cmd.getChangeItem());
|
||||
entity.setChangeTime(cmd.getChangeTime());
|
||||
entity.setOperatorName(cmd.getOperatorName());
|
||||
// 操作人从AuthUserContextAdapter获取,不从前端Cmd传入
|
||||
String operator = AuthUserContextAdapter.getCurrentUserName();
|
||||
entity.setOperatorName(StringUtils.hasText(operator) ? operator : "系统");
|
||||
|
||||
OrgPersonnelChangeEntity result = orgPersonnelChangeDomainService.add(entity);
|
||||
return SingleResponse.success(toCO(result));
|
||||
|
|
@ -50,7 +54,9 @@ public class OrgPersonnelChangeExecutor implements OrgPersonnelChangeApi {
|
|||
entity.setId(cmd.getId());
|
||||
entity.setChangeItem(cmd.getChangeItem());
|
||||
entity.setChangeTime(cmd.getChangeTime());
|
||||
entity.setOperatorName(cmd.getOperatorName());
|
||||
// 操作人从AuthUserContextAdapter获取,不从前端Cmd传入
|
||||
String operator = AuthUserContextAdapter.getCurrentUserName();
|
||||
entity.setOperatorName(StringUtils.hasText(operator) ? operator : "系统");
|
||||
|
||||
OrgPersonnelChangeEntity result = orgPersonnelChangeDomainService.modify(entity);
|
||||
return SingleResponse.success(toCO(result));
|
||||
|
|
@ -67,7 +73,8 @@ public class OrgPersonnelChangeExecutor implements OrgPersonnelChangeApi {
|
|||
OrgPersonnelChangeQuery domainQuery = new OrgPersonnelChangeQuery();
|
||||
domainQuery.setPageNum(query.getCurrent());
|
||||
domainQuery.setPageSize(query.getSize());
|
||||
domainQuery.setOrgId(query.getOrgId());
|
||||
domainQuery.setTenantId(AuthUserContextAdapter.getCurrentTenantId());
|
||||
domainQuery.setOrgId(AuthUserContextAdapter.getCurrentOrgId());
|
||||
domainQuery.setPersonnelId(query.getPersonnelId());
|
||||
domainQuery.setChangeItem(query.getChangeItem());
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import org.qinan.safetyeval.domain.gateway.OrgResignApplyGateway;
|
|||
import org.qinan.safetyeval.domain.query.OrgPersonnelQuery;
|
||||
import org.qinan.safetyeval.domain.query.PageResult;
|
||||
import org.qinan.safetyeval.domain.service.OrgPersonnelDomainService;
|
||||
import org.qinan.safetyeval.infrastructure.adapter.auth.AuthUserContextAdapter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -93,7 +94,8 @@ public class OrgPersonnelExecutor implements OrgPersonnelApi {
|
|||
OrgPersonnelQuery domainQuery = new OrgPersonnelQuery();
|
||||
domainQuery.setPageNum(query.getCurrent());
|
||||
domainQuery.setPageSize(query.getSize());
|
||||
domainQuery.setOrgId(query.getOrgId());
|
||||
domainQuery.setTenantId(AuthUserContextAdapter.getCurrentTenantId());
|
||||
domainQuery.setOrgId(AuthUserContextAdapter.getCurrentOrgId());
|
||||
domainQuery.setDeptId(query.getDeptId());
|
||||
domainQuery.setPostId(query.getPostId());
|
||||
domainQuery.setUserName(query.getUserName());
|
||||
|
|
@ -101,7 +103,7 @@ public class OrgPersonnelExecutor implements OrgPersonnelApi {
|
|||
domainQuery.setEmploymentStatusCode(query.getEmploymentStatusCode());
|
||||
if (query.getResignAuditStatus() != null && orgResignApplyGateway != null) {
|
||||
domainQuery.setPersonnelIds(orgResignApplyGateway.listPersonnelIdsByAuditStatus(
|
||||
query.getResignAuditStatus(), query.getOrgId()));
|
||||
query.getResignAuditStatus(), AuthUserContextAdapter.getCurrentOrgId()));
|
||||
}
|
||||
|
||||
PageResult<OrgPersonnelEntity> pageResult = orgPersonnelDomainService.page(domainQuery);
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import org.qinan.safetyeval.domain.entity.OrgPositionEntity;
|
|||
import org.qinan.safetyeval.domain.query.OrgPositionQuery;
|
||||
import org.qinan.safetyeval.domain.query.PageResult;
|
||||
import org.qinan.safetyeval.domain.service.OrgPositionDomainService;
|
||||
import org.qinan.safetyeval.infrastructure.adapter.auth.AuthUserContextAdapter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -69,7 +70,8 @@ public class OrgPositionExecutor implements OrgPositionApi {
|
|||
OrgPositionQuery domainQuery = new OrgPositionQuery();
|
||||
domainQuery.setPageNum(query.getCurrent());
|
||||
domainQuery.setPageSize(query.getSize());
|
||||
domainQuery.setOrgId(query.getOrgId());
|
||||
domainQuery.setTenantId(AuthUserContextAdapter.getCurrentTenantId());
|
||||
domainQuery.setOrgId(AuthUserContextAdapter.getCurrentOrgId());
|
||||
domainQuery.setDeptId(query.getDeptId());
|
||||
domainQuery.setPositionName(query.getPositionName());
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import org.qinan.safetyeval.domain.entity.OrgQualificationEntity;
|
|||
import org.qinan.safetyeval.domain.query.OrgQualificationQuery;
|
||||
import org.qinan.safetyeval.domain.query.PageResult;
|
||||
import org.qinan.safetyeval.domain.service.OrgQualificationDomainService;
|
||||
import org.qinan.safetyeval.infrastructure.adapter.auth.AuthUserContextAdapter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -83,7 +84,8 @@ public class OrgQualificationExecutor implements OrgQualificationApi {
|
|||
OrgQualificationQuery domainQuery = new OrgQualificationQuery();
|
||||
domainQuery.setPageNum(query.getCurrent());
|
||||
domainQuery.setPageSize(query.getSize());
|
||||
domainQuery.setOrgId(query.getOrgId());
|
||||
domainQuery.setTenantId(AuthUserContextAdapter.getCurrentTenantId());
|
||||
domainQuery.setOrgId(AuthUserContextAdapter.getCurrentOrgId());
|
||||
domainQuery.setCertName(query.getCertName());
|
||||
domainQuery.setCertNo(query.getCertNo());
|
||||
domainQuery.setEnableFlag(query.getEnableFlag());
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import org.qinan.safetyeval.domain.query.OrgResignApplyQuery;
|
|||
import org.qinan.safetyeval.domain.query.PageResult;
|
||||
import org.qinan.safetyeval.domain.service.OrgResignApplyDomainService;
|
||||
import org.qinan.safetyeval.app.support.OrgPersonnelViewEnricher;
|
||||
import org.qinan.safetyeval.infrastructure.adapter.auth.AuthUserContextAdapter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -40,7 +41,9 @@ public class OrgResignApplyExecutor implements OrgResignApplyApi {
|
|||
@Override
|
||||
public SingleResponse<OrgResignApplyCO> add(OrgResignApplyAddCmd cmd) {
|
||||
OrgResignApplyEntity entity = new OrgResignApplyEntity();
|
||||
entity.setApplicantName(cmd.getApplicantName());
|
||||
// 申请人从当前登录用户自动获取,不从前端参数传入
|
||||
String currentUserName = AuthUserContextAdapter.getCurrentUserName();
|
||||
entity.setApplicantName(StringUtils.hasText(currentUserName) ? currentUserName : cmd.getApplicantName());
|
||||
entity.setApplyTime(cmd.getApplyTime());
|
||||
entity.setResignReason(cmd.getResignReason());
|
||||
entity.setExpectedResignDate(cmd.getExpectedResignDate());
|
||||
|
|
@ -102,7 +105,8 @@ public class OrgResignApplyExecutor implements OrgResignApplyApi {
|
|||
OrgResignApplyQuery domainQuery = new OrgResignApplyQuery();
|
||||
domainQuery.setPageNum(query.getCurrent());
|
||||
domainQuery.setPageSize(query.getSize());
|
||||
domainQuery.setOrgId(query.getOrgId());
|
||||
domainQuery.setTenantId(AuthUserContextAdapter.getCurrentTenantId());
|
||||
domainQuery.setOrgId(AuthUserContextAdapter.getCurrentOrgId());
|
||||
domainQuery.setPersonnelId(query.getPersonnelId());
|
||||
domainQuery.setAuditStatusCode(query.getAuditStatusCode());
|
||||
domainQuery.setApplicantName(query.getApplicantName());
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import org.qinan.safetyeval.domain.entity.QualFilingChangeDetailEntity;
|
|||
import org.qinan.safetyeval.domain.query.QualFilingChangeDetailQuery;
|
||||
import org.qinan.safetyeval.domain.query.PageResult;
|
||||
import org.qinan.safetyeval.domain.service.QualFilingChangeDetailDomainService;
|
||||
import org.qinan.safetyeval.infrastructure.adapter.auth.AuthUserContextAdapter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -65,6 +66,7 @@ public class QualFilingChangeDetailExecutor implements QualFilingChangeDetailApi
|
|||
QualFilingChangeDetailQuery domainQuery = new QualFilingChangeDetailQuery();
|
||||
domainQuery.setPageNum(query.getCurrent());
|
||||
domainQuery.setPageSize(query.getSize());
|
||||
domainQuery.setTenantId(AuthUserContextAdapter.getCurrentTenantId());
|
||||
domainQuery.setChangeId(query.getChangeId());
|
||||
domainQuery.setChangeField(query.getChangeField());
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import org.qinan.safetyeval.domain.entity.QualFilingChangeEntity;
|
|||
import org.qinan.safetyeval.domain.query.QualFilingChangeQuery;
|
||||
import org.qinan.safetyeval.domain.query.PageResult;
|
||||
import org.qinan.safetyeval.domain.service.QualFilingChangeDomainService;
|
||||
import org.qinan.safetyeval.infrastructure.adapter.auth.AuthUserContextAdapter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -109,7 +110,8 @@ public class QualFilingChangeExecutor implements QualFilingChangeApi {
|
|||
QualFilingChangeQuery domainQuery = new QualFilingChangeQuery();
|
||||
domainQuery.setPageNum(query.getCurrent());
|
||||
domainQuery.setPageSize(query.getSize());
|
||||
domainQuery.setOrgId(query.getOrgId());
|
||||
domainQuery.setTenantId(AuthUserContextAdapter.getCurrentTenantId());
|
||||
domainQuery.setOrgId(AuthUserContextAdapter.getCurrentOrgId());
|
||||
domainQuery.setOriginFilingId(query.getOriginFilingId());
|
||||
domainQuery.setFilingNo(query.getFilingNo());
|
||||
domainQuery.setFilingStatusCode(query.getFilingStatusCode());
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import org.qinan.safetyeval.domain.entity.QualFilingCommitmentEntity;
|
|||
import org.qinan.safetyeval.domain.query.QualFilingCommitmentQuery;
|
||||
import org.qinan.safetyeval.domain.query.PageResult;
|
||||
import org.qinan.safetyeval.domain.service.QualFilingCommitmentDomainService;
|
||||
import org.qinan.safetyeval.infrastructure.adapter.auth.AuthUserContextAdapter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -67,6 +68,7 @@ public class QualFilingCommitmentExecutor implements QualFilingCommitmentApi {
|
|||
QualFilingCommitmentQuery domainQuery = new QualFilingCommitmentQuery();
|
||||
domainQuery.setPageNum(query.getCurrent());
|
||||
domainQuery.setPageSize(query.getSize());
|
||||
domainQuery.setTenantId(AuthUserContextAdapter.getCurrentTenantId());
|
||||
domainQuery.setFilingId(query.getFilingId());
|
||||
|
||||
PageResult<QualFilingCommitmentEntity> pageResult = qualFilingCommitmentDomainService.page(domainQuery);
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import org.qinan.safetyeval.domain.entity.QualFilingEquipmentEntity;
|
|||
import org.qinan.safetyeval.domain.query.QualFilingEquipmentQuery;
|
||||
import org.qinan.safetyeval.domain.query.PageResult;
|
||||
import org.qinan.safetyeval.domain.service.QualFilingEquipmentDomainService;
|
||||
import org.qinan.safetyeval.infrastructure.adapter.auth.AuthUserContextAdapter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -91,6 +92,7 @@ public class QualFilingEquipmentExecutor implements QualFilingEquipmentApi {
|
|||
QualFilingEquipmentQuery domainQuery = new QualFilingEquipmentQuery();
|
||||
domainQuery.setPageNum(query.getCurrent());
|
||||
domainQuery.setPageSize(query.getSize());
|
||||
domainQuery.setTenantId(AuthUserContextAdapter.getCurrentTenantId());
|
||||
domainQuery.setFilingId(query.getFilingId());
|
||||
domainQuery.setDeviceName(query.getDeviceName());
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import org.qinan.safetyeval.domain.entity.QualFilingEntity;
|
|||
import org.qinan.safetyeval.domain.query.QualFilingQuery;
|
||||
import org.qinan.safetyeval.domain.query.PageResult;
|
||||
import org.qinan.safetyeval.domain.service.QualFilingDomainService;
|
||||
import org.qinan.safetyeval.infrastructure.adapter.auth.AuthUserContextAdapter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -111,7 +112,8 @@ public class QualFilingExecutor implements QualFilingApi {
|
|||
QualFilingQuery domainQuery = new QualFilingQuery();
|
||||
domainQuery.setPageNum(query.getCurrent());
|
||||
domainQuery.setPageSize(query.getSize());
|
||||
domainQuery.setOrgId(query.getOrgId());
|
||||
domainQuery.setTenantId(AuthUserContextAdapter.getCurrentTenantId());
|
||||
domainQuery.setOrgId(AuthUserContextAdapter.getCurrentOrgId());
|
||||
domainQuery.setFilingNo(query.getFilingNo());
|
||||
domainQuery.setFilingUnitName(query.getFilingUnitName());
|
||||
domainQuery.setFilingStatusCode(query.getFilingStatusCode());
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import org.qinan.safetyeval.domain.entity.QualFilingMaterialEntity;
|
|||
import org.qinan.safetyeval.domain.query.QualFilingMaterialQuery;
|
||||
import org.qinan.safetyeval.domain.query.PageResult;
|
||||
import org.qinan.safetyeval.domain.service.QualFilingMaterialDomainService;
|
||||
import org.qinan.safetyeval.infrastructure.adapter.auth.AuthUserContextAdapter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -69,6 +70,7 @@ public class QualFilingMaterialExecutor implements QualFilingMaterialApi {
|
|||
QualFilingMaterialQuery domainQuery = new QualFilingMaterialQuery();
|
||||
domainQuery.setPageNum(query.getCurrent());
|
||||
domainQuery.setPageSize(query.getSize());
|
||||
domainQuery.setTenantId(AuthUserContextAdapter.getCurrentTenantId());
|
||||
domainQuery.setFilingId(query.getFilingId());
|
||||
domainQuery.setMaterialContent(query.getMaterialContent());
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import org.qinan.safetyeval.domain.entity.QualFilingPersonnelCertEntity;
|
|||
import org.qinan.safetyeval.domain.query.QualFilingPersonnelCertQuery;
|
||||
import org.qinan.safetyeval.domain.query.PageResult;
|
||||
import org.qinan.safetyeval.domain.service.QualFilingPersonnelCertDomainService;
|
||||
import org.qinan.safetyeval.infrastructure.adapter.auth.AuthUserContextAdapter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -87,6 +88,7 @@ public class QualFilingPersonnelCertExecutor implements QualFilingPersonnelCertA
|
|||
QualFilingPersonnelCertQuery domainQuery = new QualFilingPersonnelCertQuery();
|
||||
domainQuery.setPageNum(query.getCurrent());
|
||||
domainQuery.setPageSize(query.getSize());
|
||||
domainQuery.setTenantId(AuthUserContextAdapter.getCurrentTenantId());
|
||||
domainQuery.setFilingId(query.getFilingId());
|
||||
domainQuery.setFilingPersonnelId(query.getFilingPersonnelId());
|
||||
domainQuery.setCertName(query.getCertName());
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import org.qinan.safetyeval.domain.entity.QualFilingPersonnelEntity;
|
|||
import org.qinan.safetyeval.domain.query.QualFilingPersonnelQuery;
|
||||
import org.qinan.safetyeval.domain.query.PageResult;
|
||||
import org.qinan.safetyeval.domain.service.QualFilingPersonnelDomainService;
|
||||
import org.qinan.safetyeval.infrastructure.adapter.auth.AuthUserContextAdapter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -105,6 +106,7 @@ public class QualFilingPersonnelExecutor implements QualFilingPersonnelApi {
|
|||
QualFilingPersonnelQuery domainQuery = new QualFilingPersonnelQuery();
|
||||
domainQuery.setPageNum(query.getCurrent());
|
||||
domainQuery.setPageSize(query.getSize());
|
||||
domainQuery.setTenantId(AuthUserContextAdapter.getCurrentTenantId());
|
||||
domainQuery.setFilingId(query.getFilingId());
|
||||
domainQuery.setPersonName(query.getPersonName());
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,9 @@ public class OrgDepartmentQuery {
|
|||
/** 每页条数 */
|
||||
private Long pageSize;
|
||||
|
||||
/** 租户ID */
|
||||
private Long tenantId;
|
||||
|
||||
/** 机构ID */
|
||||
private Long orgId;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,9 @@ public class OrgEquipmentQuery {
|
|||
/** 每页条数 */
|
||||
private Long pageSize;
|
||||
|
||||
/** 租户ID */
|
||||
private Long tenantId;
|
||||
|
||||
/** 机构ID */
|
||||
private Long orgId;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,9 @@ public class OrgPersonnelCertQuery {
|
|||
/** 每页条数 */
|
||||
private Long pageSize;
|
||||
|
||||
/** 租户ID */
|
||||
private Long tenantId;
|
||||
|
||||
/** 机构ID */
|
||||
private Long orgId;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,9 @@ public class OrgPersonnelChangeQuery {
|
|||
/** 每页条数 */
|
||||
private Long pageSize;
|
||||
|
||||
/** 租户ID */
|
||||
private Long tenantId;
|
||||
|
||||
/** 机构ID */
|
||||
private Long orgId;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,9 @@ public class OrgPersonnelQuery {
|
|||
/** 每页条数 */
|
||||
private Long pageSize;
|
||||
|
||||
/** 租户ID */
|
||||
private Long tenantId;
|
||||
|
||||
/** 机构ID */
|
||||
private Long orgId;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,9 @@ public class OrgPositionQuery {
|
|||
/** 每页条数 */
|
||||
private Long pageSize;
|
||||
|
||||
/** 租户ID */
|
||||
private Long tenantId;
|
||||
|
||||
/** 机构ID */
|
||||
private Long orgId;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,9 @@ public class OrgQualificationQuery {
|
|||
/** 每页条数 */
|
||||
private Long pageSize;
|
||||
|
||||
/** 租户ID */
|
||||
private Long tenantId;
|
||||
|
||||
/** 机构ID */
|
||||
private Long orgId;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,9 @@ public class OrgResignApplyQuery {
|
|||
/** 每页条数 */
|
||||
private Long pageSize;
|
||||
|
||||
/** 租户ID */
|
||||
private Long tenantId;
|
||||
|
||||
/** 机构ID */
|
||||
private Long orgId;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,9 @@ public class QualFilingChangeDetailQuery {
|
|||
/** 每页条数 */
|
||||
private Long pageSize;
|
||||
|
||||
/** 租户ID */
|
||||
private Long tenantId;
|
||||
|
||||
/** 变更ID */
|
||||
private Long changeId;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,9 @@ public class QualFilingChangeQuery {
|
|||
/** 每页条数 */
|
||||
private Long pageSize;
|
||||
|
||||
/** 租户ID */
|
||||
private Long tenantId;
|
||||
|
||||
/** 机构ID */
|
||||
private Long orgId;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,9 @@ public class QualFilingCommitmentQuery {
|
|||
/** 每页条数 */
|
||||
private Long pageSize;
|
||||
|
||||
/** 租户ID */
|
||||
private Long tenantId;
|
||||
|
||||
/** 备案ID */
|
||||
private Long filingId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,9 @@ public class QualFilingEquipmentQuery {
|
|||
/** 每页条数 */
|
||||
private Long pageSize;
|
||||
|
||||
/** 租户ID */
|
||||
private Long tenantId;
|
||||
|
||||
/** 备案ID */
|
||||
private Long filingId;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,9 @@ public class QualFilingMaterialQuery {
|
|||
/** 每页条数 */
|
||||
private Long pageSize;
|
||||
|
||||
/** 租户ID */
|
||||
private Long tenantId;
|
||||
|
||||
/** 备案ID */
|
||||
private Long filingId;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,9 @@ public class QualFilingPersonnelCertQuery {
|
|||
/** 每页条数 */
|
||||
private Long pageSize;
|
||||
|
||||
/** 租户ID */
|
||||
private Long tenantId;
|
||||
|
||||
/** 备案ID */
|
||||
private Long filingId;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,9 @@ public class QualFilingPersonnelQuery {
|
|||
/** 每页条数 */
|
||||
private Long pageSize;
|
||||
|
||||
/** 租户ID */
|
||||
private Long tenantId;
|
||||
|
||||
/** 备案ID */
|
||||
private Long filingId;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,9 @@ public class QualFilingQuery {
|
|||
/** 每页条数 */
|
||||
private Long pageSize;
|
||||
|
||||
/** 租户ID */
|
||||
private Long tenantId;
|
||||
|
||||
/** 机构ID */
|
||||
private Long orgId;
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,14 @@ public final class AuthUserContextAdapter {
|
|||
return AuthUserInfo.from(AuthContext.getCurrentUser());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取原始用户信息
|
||||
* @return
|
||||
*/
|
||||
public static SSOUser getCurrentUserOri(){
|
||||
return AuthContext.getCurrentUser();
|
||||
}
|
||||
|
||||
public static Long getCurrentUserId() {
|
||||
AuthUserInfo user = getCurrentUser();
|
||||
return user == null ? null : user.getUserId();
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ public class OrgDepartmentGatewayImpl implements OrgDepartmentGateway {
|
|||
public OrgDepartmentEntity modify(OrgDepartmentEntity entity) {
|
||||
OrgDepartmentDO dataObject = toDO(entity);
|
||||
dataObject.setId(entity.getId());
|
||||
InsertFieldDefaults.applyForUpdate(dataObject);
|
||||
orgDepartmentMapper.updateById(dataObject);
|
||||
return get(entity.getId());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ public class OrgEquipmentGatewayImpl implements OrgEquipmentGateway {
|
|||
public OrgEquipmentEntity modify(OrgEquipmentEntity entity) {
|
||||
OrgEquipmentDO dataObject = toDO(entity);
|
||||
dataObject.setId(entity.getId());
|
||||
InsertFieldDefaults.applyForUpdate(dataObject);
|
||||
orgEquipmentMapper.updateById(dataObject);
|
||||
return get(entity.getId());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ public class OrgInfoGatewayImpl implements OrgInfoGateway {
|
|||
public OrgInfoEntity modify(OrgInfoEntity entity) {
|
||||
OrgInfoDO dataObject = toDO(entity);
|
||||
dataObject.setId(entity.getId());
|
||||
InsertFieldDefaults.applyForUpdate(dataObject);
|
||||
orgInfoMapper.updateById(dataObject);
|
||||
return get(entity.getId());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ public class OrgPersonnelCertGatewayImpl implements OrgPersonnelCertGateway {
|
|||
public OrgPersonnelCertEntity modify(OrgPersonnelCertEntity entity) {
|
||||
OrgPersonnelCertDO dataObject = toDO(entity);
|
||||
dataObject.setId(entity.getId());
|
||||
InsertFieldDefaults.applyForUpdate(dataObject);
|
||||
orgPersonnelCertMapper.updateById(dataObject);
|
||||
return get(entity.getId());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ public class OrgPersonnelChangeGatewayImpl implements OrgPersonnelChangeGateway
|
|||
public OrgPersonnelChangeEntity modify(OrgPersonnelChangeEntity entity) {
|
||||
OrgPersonnelChangeDO dataObject = toDO(entity);
|
||||
dataObject.setId(entity.getId());
|
||||
InsertFieldDefaults.applyForUpdate(dataObject);
|
||||
orgPersonnelChangeMapper.updateById(dataObject);
|
||||
return get(entity.getId());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ public class OrgPersonnelGatewayImpl implements OrgPersonnelGateway {
|
|||
public OrgPersonnelEntity modify(OrgPersonnelEntity entity) {
|
||||
OrgPersonnelDO dataObject = toDO(entity);
|
||||
dataObject.setId(entity.getId());
|
||||
InsertFieldDefaults.applyForUpdate(dataObject);
|
||||
orgPersonnelMapper.updateById(dataObject);
|
||||
return get(entity.getId());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ public class OrgPositionGatewayImpl implements OrgPositionGateway {
|
|||
public OrgPositionEntity modify(OrgPositionEntity entity) {
|
||||
OrgPositionDO dataObject = toDO(entity);
|
||||
dataObject.setId(entity.getId());
|
||||
InsertFieldDefaults.applyForUpdate(dataObject);
|
||||
orgPositionMapper.updateById(dataObject);
|
||||
return get(entity.getId());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ public class OrgQualificationGatewayImpl implements OrgQualificationGateway {
|
|||
public OrgQualificationEntity modify(OrgQualificationEntity entity) {
|
||||
OrgQualificationDO dataObject = toDO(entity);
|
||||
dataObject.setId(entity.getId());
|
||||
InsertFieldDefaults.applyForUpdate(dataObject);
|
||||
orgQualificationMapper.updateById(dataObject);
|
||||
return get(entity.getId());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ public class OrgResignApplyGatewayImpl implements OrgResignApplyGateway {
|
|||
public OrgResignApplyEntity modify(OrgResignApplyEntity entity) {
|
||||
OrgResignApplyDO dataObject = toDO(entity);
|
||||
dataObject.setId(entity.getId());
|
||||
InsertFieldDefaults.applyForUpdate(dataObject);
|
||||
orgResignApplyMapper.updateById(dataObject);
|
||||
return get(entity.getId());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import org.qinan.safetyeval.domain.query.QualFilingChangeDetailQuery;
|
|||
import org.qinan.safetyeval.domain.query.PageResult;
|
||||
import org.qinan.safetyeval.infrastructure.dataobject.QualFilingChangeDetailDO;
|
||||
import org.qinan.safetyeval.infrastructure.mapper.QualFilingChangeDetailMapper;
|
||||
import org.qinan.safetyeval.infrastructure.support.InsertFieldDefaults;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
|
|
@ -30,6 +31,7 @@ public class QualFilingChangeDetailGatewayImpl implements QualFilingChangeDetail
|
|||
@Override
|
||||
public QualFilingChangeDetailEntity save(QualFilingChangeDetailEntity entity) {
|
||||
QualFilingChangeDetailDO dataObject = toDO(entity);
|
||||
InsertFieldDefaults.apply(dataObject);
|
||||
qualFilingChangeDetailMapper.insert(dataObject);
|
||||
entity.setId(dataObject.getId());
|
||||
return entity;
|
||||
|
|
@ -53,6 +55,7 @@ public class QualFilingChangeDetailGatewayImpl implements QualFilingChangeDetail
|
|||
public QualFilingChangeDetailEntity modify(QualFilingChangeDetailEntity entity) {
|
||||
QualFilingChangeDetailDO dataObject = toDO(entity);
|
||||
dataObject.setId(entity.getId());
|
||||
InsertFieldDefaults.applyForUpdate(dataObject);
|
||||
qualFilingChangeDetailMapper.updateById(dataObject);
|
||||
return get(entity.getId());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import org.qinan.safetyeval.domain.query.QualFilingChangeQuery;
|
|||
import org.qinan.safetyeval.domain.query.PageResult;
|
||||
import org.qinan.safetyeval.infrastructure.dataobject.QualFilingChangeDO;
|
||||
import org.qinan.safetyeval.infrastructure.mapper.QualFilingChangeMapper;
|
||||
import org.qinan.safetyeval.infrastructure.support.InsertFieldDefaults;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
|
|
@ -30,6 +31,7 @@ public class QualFilingChangeGatewayImpl implements QualFilingChangeGateway {
|
|||
@Override
|
||||
public QualFilingChangeEntity save(QualFilingChangeEntity entity) {
|
||||
QualFilingChangeDO dataObject = toDO(entity);
|
||||
InsertFieldDefaults.apply(dataObject);
|
||||
qualFilingChangeMapper.insert(dataObject);
|
||||
entity.setId(dataObject.getId());
|
||||
return entity;
|
||||
|
|
@ -53,6 +55,7 @@ public class QualFilingChangeGatewayImpl implements QualFilingChangeGateway {
|
|||
public QualFilingChangeEntity modify(QualFilingChangeEntity entity) {
|
||||
QualFilingChangeDO dataObject = toDO(entity);
|
||||
dataObject.setId(entity.getId());
|
||||
InsertFieldDefaults.applyForUpdate(dataObject);
|
||||
qualFilingChangeMapper.updateById(dataObject);
|
||||
return get(entity.getId());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import org.qinan.safetyeval.domain.query.QualFilingCommitmentQuery;
|
|||
import org.qinan.safetyeval.domain.query.PageResult;
|
||||
import org.qinan.safetyeval.infrastructure.dataobject.QualFilingCommitmentDO;
|
||||
import org.qinan.safetyeval.infrastructure.mapper.QualFilingCommitmentMapper;
|
||||
import org.qinan.safetyeval.infrastructure.support.InsertFieldDefaults;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
|
|
@ -30,6 +31,7 @@ public class QualFilingCommitmentGatewayImpl implements QualFilingCommitmentGate
|
|||
@Override
|
||||
public QualFilingCommitmentEntity save(QualFilingCommitmentEntity entity) {
|
||||
QualFilingCommitmentDO dataObject = toDO(entity);
|
||||
InsertFieldDefaults.apply(dataObject);
|
||||
qualFilingCommitmentMapper.insert(dataObject);
|
||||
entity.setId(dataObject.getId());
|
||||
return entity;
|
||||
|
|
@ -53,6 +55,7 @@ public class QualFilingCommitmentGatewayImpl implements QualFilingCommitmentGate
|
|||
public QualFilingCommitmentEntity modify(QualFilingCommitmentEntity entity) {
|
||||
QualFilingCommitmentDO dataObject = toDO(entity);
|
||||
dataObject.setId(entity.getId());
|
||||
InsertFieldDefaults.applyForUpdate(dataObject);
|
||||
qualFilingCommitmentMapper.updateById(dataObject);
|
||||
return get(entity.getId());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import org.qinan.safetyeval.domain.query.QualFilingEquipmentQuery;
|
|||
import org.qinan.safetyeval.domain.query.PageResult;
|
||||
import org.qinan.safetyeval.infrastructure.dataobject.QualFilingEquipmentDO;
|
||||
import org.qinan.safetyeval.infrastructure.mapper.QualFilingEquipmentMapper;
|
||||
import org.qinan.safetyeval.infrastructure.support.InsertFieldDefaults;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
|
|
@ -30,6 +31,7 @@ public class QualFilingEquipmentGatewayImpl implements QualFilingEquipmentGatewa
|
|||
@Override
|
||||
public QualFilingEquipmentEntity save(QualFilingEquipmentEntity entity) {
|
||||
QualFilingEquipmentDO dataObject = toDO(entity);
|
||||
InsertFieldDefaults.apply(dataObject);
|
||||
qualFilingEquipmentMapper.insert(dataObject);
|
||||
entity.setId(dataObject.getId());
|
||||
return entity;
|
||||
|
|
@ -53,6 +55,7 @@ public class QualFilingEquipmentGatewayImpl implements QualFilingEquipmentGatewa
|
|||
public QualFilingEquipmentEntity modify(QualFilingEquipmentEntity entity) {
|
||||
QualFilingEquipmentDO dataObject = toDO(entity);
|
||||
dataObject.setId(entity.getId());
|
||||
InsertFieldDefaults.applyForUpdate(dataObject);
|
||||
qualFilingEquipmentMapper.updateById(dataObject);
|
||||
return get(entity.getId());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import org.qinan.safetyeval.domain.query.QualFilingQuery;
|
|||
import org.qinan.safetyeval.domain.query.PageResult;
|
||||
import org.qinan.safetyeval.infrastructure.dataobject.QualFilingDO;
|
||||
import org.qinan.safetyeval.infrastructure.mapper.QualFilingMapper;
|
||||
import org.qinan.safetyeval.infrastructure.support.InsertFieldDefaults;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
|
|
@ -30,6 +31,7 @@ public class QualFilingGatewayImpl implements QualFilingGateway {
|
|||
@Override
|
||||
public QualFilingEntity save(QualFilingEntity entity) {
|
||||
QualFilingDO dataObject = toDO(entity);
|
||||
InsertFieldDefaults.apply(dataObject);
|
||||
qualFilingMapper.insert(dataObject);
|
||||
entity.setId(dataObject.getId());
|
||||
return entity;
|
||||
|
|
@ -53,6 +55,7 @@ public class QualFilingGatewayImpl implements QualFilingGateway {
|
|||
public QualFilingEntity modify(QualFilingEntity entity) {
|
||||
QualFilingDO dataObject = toDO(entity);
|
||||
dataObject.setId(entity.getId());
|
||||
InsertFieldDefaults.applyForUpdate(dataObject);
|
||||
qualFilingMapper.updateById(dataObject);
|
||||
return get(entity.getId());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import org.qinan.safetyeval.domain.query.QualFilingMaterialQuery;
|
|||
import org.qinan.safetyeval.domain.query.PageResult;
|
||||
import org.qinan.safetyeval.infrastructure.dataobject.QualFilingMaterialDO;
|
||||
import org.qinan.safetyeval.infrastructure.mapper.QualFilingMaterialMapper;
|
||||
import org.qinan.safetyeval.infrastructure.support.InsertFieldDefaults;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
|
|
@ -30,6 +31,7 @@ public class QualFilingMaterialGatewayImpl implements QualFilingMaterialGateway
|
|||
@Override
|
||||
public QualFilingMaterialEntity save(QualFilingMaterialEntity entity) {
|
||||
QualFilingMaterialDO dataObject = toDO(entity);
|
||||
InsertFieldDefaults.apply(dataObject);
|
||||
qualFilingMaterialMapper.insert(dataObject);
|
||||
entity.setId(dataObject.getId());
|
||||
return entity;
|
||||
|
|
@ -53,6 +55,7 @@ public class QualFilingMaterialGatewayImpl implements QualFilingMaterialGateway
|
|||
public QualFilingMaterialEntity modify(QualFilingMaterialEntity entity) {
|
||||
QualFilingMaterialDO dataObject = toDO(entity);
|
||||
dataObject.setId(entity.getId());
|
||||
InsertFieldDefaults.applyForUpdate(dataObject);
|
||||
qualFilingMaterialMapper.updateById(dataObject);
|
||||
return get(entity.getId());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import org.qinan.safetyeval.domain.query.QualFilingPersonnelCertQuery;
|
|||
import org.qinan.safetyeval.domain.query.PageResult;
|
||||
import org.qinan.safetyeval.infrastructure.dataobject.QualFilingPersonnelCertDO;
|
||||
import org.qinan.safetyeval.infrastructure.mapper.QualFilingPersonnelCertMapper;
|
||||
import org.qinan.safetyeval.infrastructure.support.InsertFieldDefaults;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
|
|
@ -30,6 +31,7 @@ public class QualFilingPersonnelCertGatewayImpl implements QualFilingPersonnelCe
|
|||
@Override
|
||||
public QualFilingPersonnelCertEntity save(QualFilingPersonnelCertEntity entity) {
|
||||
QualFilingPersonnelCertDO dataObject = toDO(entity);
|
||||
InsertFieldDefaults.apply(dataObject);
|
||||
qualFilingPersonnelCertMapper.insert(dataObject);
|
||||
entity.setId(dataObject.getId());
|
||||
return entity;
|
||||
|
|
@ -62,6 +64,7 @@ public class QualFilingPersonnelCertGatewayImpl implements QualFilingPersonnelCe
|
|||
public QualFilingPersonnelCertEntity modify(QualFilingPersonnelCertEntity entity) {
|
||||
QualFilingPersonnelCertDO dataObject = toDO(entity);
|
||||
dataObject.setId(entity.getId());
|
||||
InsertFieldDefaults.applyForUpdate(dataObject);
|
||||
qualFilingPersonnelCertMapper.updateById(dataObject);
|
||||
return get(entity.getId());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import org.qinan.safetyeval.domain.query.QualFilingPersonnelQuery;
|
|||
import org.qinan.safetyeval.domain.query.PageResult;
|
||||
import org.qinan.safetyeval.infrastructure.dataobject.QualFilingPersonnelDO;
|
||||
import org.qinan.safetyeval.infrastructure.mapper.QualFilingPersonnelMapper;
|
||||
import org.qinan.safetyeval.infrastructure.support.InsertFieldDefaults;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
|
|
@ -30,6 +31,7 @@ public class QualFilingPersonnelGatewayImpl implements QualFilingPersonnelGatewa
|
|||
@Override
|
||||
public QualFilingPersonnelEntity save(QualFilingPersonnelEntity entity) {
|
||||
QualFilingPersonnelDO dataObject = toDO(entity);
|
||||
InsertFieldDefaults.apply(dataObject);
|
||||
qualFilingPersonnelMapper.insert(dataObject);
|
||||
entity.setId(dataObject.getId());
|
||||
return entity;
|
||||
|
|
@ -53,6 +55,7 @@ public class QualFilingPersonnelGatewayImpl implements QualFilingPersonnelGatewa
|
|||
public QualFilingPersonnelEntity modify(QualFilingPersonnelEntity entity) {
|
||||
QualFilingPersonnelDO dataObject = toDO(entity);
|
||||
dataObject.setId(entity.getId());
|
||||
InsertFieldDefaults.applyForUpdate(dataObject);
|
||||
qualFilingPersonnelMapper.updateById(dataObject);
|
||||
return get(entity.getId());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package org.qinan.safetyeval.infrastructure.handler;
|
|||
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
||||
import org.apache.ibatis.reflection.MetaObject;
|
||||
import org.qinan.safetyeval.domain.adapter.UserInfoAdapter;
|
||||
import org.qinan.safetyeval.infrastructure.adapter.auth.AuthUserContextAdapter;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
|
@ -13,7 +14,8 @@ import java.time.LocalDateTime;
|
|||
* MyBatis Plus 自动填充处理器
|
||||
* <p>
|
||||
* 在 insert 和 update 操作时自动填充 GBS 标准字段,
|
||||
* 通过 UserInfoAdapter 获取当前用户上下文信息。
|
||||
* 优先通过 AuthUserContextAdapter 获取 SSO 真实登录用户信息,
|
||||
* 其次通过 UserInfoAdapter(ThreadLocal 方式)获取,最后回退到配置默认值。
|
||||
* 使用 strictFill 策略:仅当字段值为 null 时才填充。
|
||||
* </p>
|
||||
*
|
||||
|
|
@ -41,26 +43,73 @@ public class MyMetaObjectHandler implements MetaObjectHandler {
|
|||
@Value("${safety-eval.public-api.system-user-name:system}")
|
||||
private String fallbackUserName;
|
||||
|
||||
@Override
|
||||
public void insertFill(MetaObject metaObject) {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
Long userId = userInfoAdapter.getCurrentUserId();
|
||||
String userName = userInfoAdapter.getCurrentUserName();
|
||||
Long tenantId = userInfoAdapter.getCurrentTenantId();
|
||||
Long orgId = userInfoAdapter.getCurrentOrgId();
|
||||
|
||||
/**
|
||||
* 解析用户ID:优先 AuthUserContextAdapter(SSO) → UserInfoAdapter(ThreadLocal) → 配置回退
|
||||
*/
|
||||
private Long resolveUserId() {
|
||||
Long userId = AuthUserContextAdapter.getCurrentUserId();
|
||||
if (userId != null) {
|
||||
return userId;
|
||||
}
|
||||
userId = userInfoAdapter.getCurrentUserId();
|
||||
if (userId == null && fallbackUserId != null && fallbackUserId > 0) {
|
||||
userId = fallbackUserId;
|
||||
}
|
||||
return userId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析用户名:优先 AuthUserContextAdapter(SSO) → UserInfoAdapter(ThreadLocal) → 配置回退
|
||||
*/
|
||||
private String resolveUserName() {
|
||||
String userName = AuthUserContextAdapter.getCurrentUserName();
|
||||
if (userName != null) {
|
||||
return userName;
|
||||
}
|
||||
userName = userInfoAdapter.getCurrentUserName();
|
||||
if (userName == null && fallbackUserName != null) {
|
||||
userName = fallbackUserName;
|
||||
}
|
||||
return userName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析租户ID:优先 AuthUserContextAdapter(SSO) → UserInfoAdapter(ThreadLocal) → 配置回退
|
||||
*/
|
||||
private Long resolveTenantId() {
|
||||
Long tenantId = AuthUserContextAdapter.getCurrentTenantId();
|
||||
if (tenantId != null) {
|
||||
return tenantId;
|
||||
}
|
||||
tenantId = userInfoAdapter.getCurrentTenantId();
|
||||
if (tenantId == null && fallbackTenantId != null && fallbackTenantId > 0) {
|
||||
tenantId = fallbackTenantId;
|
||||
}
|
||||
return tenantId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析机构ID:优先 AuthUserContextAdapter(SSO) → UserInfoAdapter(ThreadLocal) → 配置回退
|
||||
*/
|
||||
private Long resolveOrgId() {
|
||||
Long orgId = AuthUserContextAdapter.getCurrentOrgId();
|
||||
if (orgId != null) {
|
||||
return orgId;
|
||||
}
|
||||
orgId = userInfoAdapter.getCurrentOrgId();
|
||||
if (orgId == null && fallbackOrgId != null && fallbackOrgId > 0) {
|
||||
orgId = fallbackOrgId;
|
||||
}
|
||||
return orgId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertFill(MetaObject metaObject) {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
Long userId = resolveUserId();
|
||||
String userName = resolveUserName();
|
||||
Long tenantId = resolveTenantId();
|
||||
Long orgId = resolveOrgId();
|
||||
|
||||
// 严格填充:仅当字段值为 null 时填充,优先级最低
|
||||
this.strictInsertFill(metaObject, "createTime", LocalDateTime.class, now);
|
||||
|
|
@ -69,7 +118,7 @@ public class MyMetaObjectHandler implements MetaObjectHandler {
|
|||
this.strictInsertFill(metaObject, "env", String.class, DEFAULT_ENV);
|
||||
this.strictInsertFill(metaObject, "version", Integer.class, 0);
|
||||
|
||||
// 用户相关字段:仅当 adapter 返回值不为 null 时才填充
|
||||
// 用户相关字段:仅当解析值不为 null 时才填充
|
||||
if (userId != null) {
|
||||
this.strictInsertFill(metaObject, "createId", Long.class, userId);
|
||||
this.strictInsertFill(metaObject, "updateId", Long.class, userId);
|
||||
|
|
@ -89,14 +138,8 @@ public class MyMetaObjectHandler implements MetaObjectHandler {
|
|||
@Override
|
||||
public void updateFill(MetaObject metaObject) {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
Long userId = userInfoAdapter.getCurrentUserId();
|
||||
String userName = userInfoAdapter.getCurrentUserName();
|
||||
if (userId == null && fallbackUserId != null && fallbackUserId > 0) {
|
||||
userId = fallbackUserId;
|
||||
}
|
||||
if (userName == null && fallbackUserName != null) {
|
||||
userName = fallbackUserName;
|
||||
}
|
||||
Long userId = resolveUserId();
|
||||
String userName = resolveUserName();
|
||||
|
||||
this.strictUpdateFill(metaObject, "updateTime", LocalDateTime.class, now);
|
||||
if (userId != null) {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,17 @@
|
|||
package org.qinan.safetyeval.infrastructure.support;
|
||||
|
||||
import org.qinan.safetyeval.infrastructure.adapter.auth.AuthUserContextAdapter;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* insert 前补齐 GBS 默认字段,避免逻辑删除字段为 null 导致 selectById 查不到。
|
||||
* insert 前补齐 GBS 默认字段。
|
||||
* <p>
|
||||
* 作为 MyMetaObjectHandler 的防御性补充:当 MyBatis-Plus MetaObjectHandler 因框架冲突等原因
|
||||
* 未生效时,此工具类确保 GBS 标准字段在 insert 前显式填充。
|
||||
* 用户信息优先从 AuthUserContextAdapter(SSO)获取。
|
||||
* </p>
|
||||
*/
|
||||
public final class InsertFieldDefaults {
|
||||
|
||||
|
|
@ -17,9 +25,69 @@ public final class InsertFieldDefaults {
|
|||
if (dataObject == null) {
|
||||
return;
|
||||
}
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
|
||||
// 常量默认值
|
||||
setIfNull(dataObject, "deleteEnum", DELETE_NOT_DELETED);
|
||||
setIfNull(dataObject, "env", DEFAULT_ENV);
|
||||
setIfNull(dataObject, "version", 0);
|
||||
|
||||
// 时间字段
|
||||
setIfNull(dataObject, "createTime", now);
|
||||
setIfNull(dataObject, "updateTime", now);
|
||||
|
||||
// 用户上下文字段:从 AuthUserContextAdapter 获取
|
||||
Long userId = AuthUserContextAdapter.getCurrentUserId();
|
||||
String userName = AuthUserContextAdapter.getCurrentUserName();
|
||||
Long tenantId = AuthUserContextAdapter.getCurrentTenantId();
|
||||
Long orgId = AuthUserContextAdapter.getCurrentOrgId();
|
||||
|
||||
if (userId != null) {
|
||||
setIfNull(dataObject, "createId", userId);
|
||||
setIfNull(dataObject, "updateId", userId);
|
||||
}
|
||||
if (userName != null) {
|
||||
setIfNull(dataObject, "createName", userName);
|
||||
setIfNull(dataObject, "updateName", userName);
|
||||
}
|
||||
if (tenantId != null) {
|
||||
setIfNull(dataObject, "tenantId", tenantId);
|
||||
}
|
||||
if (orgId != null) {
|
||||
setIfNull(dataObject, "orgId", orgId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* insert 前补齐 GBS 默认字段,并允许指定额外的用户名(用于特定业务场景的 entity.operatorName 等)。
|
||||
*/
|
||||
public static void applyWithUserName(Object dataObject, String overrideUserName) {
|
||||
apply(dataObject);
|
||||
if (overrideUserName != null) {
|
||||
setIfNull(dataObject, "createName", overrideUserName);
|
||||
setIfNull(dataObject, "updateName", overrideUserName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* update 前补齐 GBS 更新字段(updateTime、updateId、updateName)。
|
||||
* 防御性补充 MyMetaObjectHandler 未生效的场景。
|
||||
*/
|
||||
public static void applyForUpdate(Object dataObject) {
|
||||
if (dataObject == null) {
|
||||
return;
|
||||
}
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
Long userId = AuthUserContextAdapter.getCurrentUserId();
|
||||
String userName = AuthUserContextAdapter.getCurrentUserName();
|
||||
|
||||
setIfNull(dataObject, "updateTime", now);
|
||||
if (userId != null) {
|
||||
setIfNull(dataObject, "updateId", userId);
|
||||
}
|
||||
if (userName != null) {
|
||||
setIfNull(dataObject, "updateName", userName);
|
||||
}
|
||||
}
|
||||
|
||||
private static void setIfNull(Object target, String property, Object value) {
|
||||
|
|
|
|||
|
|
@ -1,13 +1,14 @@
|
|||
package org.qinan.safetyeval.infrastructure.support;
|
||||
|
||||
import org.qinan.safetyeval.domain.adapter.UserInfoAdapter;
|
||||
import org.qinan.safetyeval.infrastructure.adapter.auth.AuthUserContextAdapter;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 解析写入时的 orgId:优先实体值 → 登录上下文 → 配置回退(local 联调 org-id=1)。
|
||||
* 解析写入时的 orgId:优先实体值 → SSO 登录上下文(AuthUserContextAdapter) → ThreadLocal(UserInfoAdapter) → 配置回退(local 联调 org-id=1)。
|
||||
*/
|
||||
@Component
|
||||
public class OrgContextResolver {
|
||||
|
|
@ -22,10 +23,17 @@ public class OrgContextResolver {
|
|||
if (entityOrgId != null) {
|
||||
return entityOrgId;
|
||||
}
|
||||
Long orgId = userInfoAdapter.getCurrentOrgId();
|
||||
// 优先 SSO 真实登录用户的 orgId
|
||||
Long orgId = AuthUserContextAdapter.getCurrentOrgId();
|
||||
if (orgId != null) {
|
||||
return orgId;
|
||||
}
|
||||
// 其次 ThreadLocal 方式
|
||||
orgId = userInfoAdapter.getCurrentOrgId();
|
||||
if (orgId != null) {
|
||||
return orgId;
|
||||
}
|
||||
// 最后配置回退
|
||||
if (fallbackOrgId != null && fallbackOrgId > 0) {
|
||||
return fallbackOrgId;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue