REQ-3581: 印章授权人问题

This commit is contained in:
yanglin 2025-03-03 16:26:32 +08:00
parent a2c83d1edf
commit 6511a7524e
5 changed files with 16 additions and 11 deletions

View File

@ -24,4 +24,9 @@ public interface OrgPerson {
static boolean equals(OrgPerson a, OrgPerson b) { static boolean equals(OrgPerson a, OrgPerson b) {
return Objects.equals(a.getOuId(), b.getOuId()) && Objects.equals(a.getPersonId(), b.getPersonId()); return Objects.equals(a.getOuId(), b.getOuId()) && Objects.equals(a.getPersonId(), b.getPersonId());
} }
static String toString(OrgPerson person) {
return String.format("%d_%d", person.getOuId(), person.getPersonId());
}
} }

View File

@ -53,10 +53,10 @@ public class EssOrgDao extends ServiceImpl<EssOrgMapper, EssOrg> {
.update(); .update();
} }
public void changeSuperAdmin(Long ouId, Long personId) { public void changeSuperAdmin(OrgPerson admin) {
lambdaUpdate() // lambdaUpdate() //
.eq(EssOrg::getOuId, ouId) // .eq(EssOrg::getOuId, admin.getOuId()) //
.set(EssOrg::getSuperAdminPersonId, personId) // .set(EssOrg::getSuperAdminPersonId, admin.getPersonId()) //
.update(); .update();
} }

View File

@ -57,10 +57,10 @@ public class EssSealPersonDao extends ServiceImpl<EssSealPersonMapper, EssSealPe
.oneOpt(); .oneOpt();
} }
public List<EssSealPerson> getByPersonId(Long ouId, Long personId) { public List<EssSealPerson> getByPerson(OrgPerson person) {
return lambdaQuery() // return lambdaQuery() //
.eq(EssSealPerson::getOuId, ouId) // .eq(EssSealPerson::getOuId, person.getOuId()) //
.eq(EssSealPerson::getPersonId, personId) // .eq(EssSealPerson::getPersonId, person.getPersonId()) //
.list(); .list();
} }

View File

@ -93,9 +93,9 @@ public class OrgManager {
} }
@BizTransactional @BizTransactional
public void changeSuperAdmin(Long ouId, Long superAdmin) { public void changeSuperAdmin(OrgPerson admin) {
essOrgDao.changeSuperAdmin(ouId, superAdmin); essOrgDao.changeSuperAdmin(admin);
log.info("change super admin: ouId={}, superAdmin={}", ouId, superAdmin); log.info("change super admin: {}", OrgPerson.toString(admin));
} }
public EssPerson getSuperAdminOrThrow(Long ouId) { public EssPerson getSuperAdminOrThrow(Long ouId) {

View File

@ -91,7 +91,7 @@ class CallbackController implements EssCallbackApi, InitializingBean {
PersonOpenId person = PersonOpenId.parse(request.readMsgData(OrgPersonJoin.class).getProxyOperatorOpenId()); PersonOpenId person = PersonOpenId.parse(request.readMsgData(OrgPersonJoin.class).getProxyOperatorOpenId());
orgManager.addAuthorizedOrgPerson(person); orgManager.addAuthorizedOrgPerson(person);
// 自动授权 // 自动授权
for (EssSealPerson sealPerson : essSealPersonDao.getByPersonId(person.getOuId(), person.getPersonId())) { for (EssSealPerson sealPerson : essSealPersonDao.getByPerson(person)) {
AddSealAuthorizationRequest addSealAuthorizationRequest = new AddSealAuthorizationRequest(); AddSealAuthorizationRequest addSealAuthorizationRequest = new AddSealAuthorizationRequest();
addSealAuthorizationRequest.setEssSealId(sealPerson.getEssSealId()); addSealAuthorizationRequest.setEssSealId(sealPerson.getEssSealId());
addSealAuthorizationRequest.setPersonId(person.getPersonId()); addSealAuthorizationRequest.setPersonId(person.getPersonId());
@ -201,7 +201,7 @@ class CallbackController implements EssCallbackApi, InitializingBean {
registerHandler(CallbackType.SUPER_ADMIN_CHANGED, request -> { registerHandler(CallbackType.SUPER_ADMIN_CHANGED, request -> {
SuperAdminChanged changes = request.readMsgData(SuperAdminChanged.class); SuperAdminChanged changes = request.readMsgData(SuperAdminChanged.class);
PersonOpenId admin = PersonOpenId.parse(changes.getChangeToUserOpenId()); PersonOpenId admin = PersonOpenId.parse(changes.getChangeToUserOpenId());
orgManager.changeSuperAdmin(admin.getOuId(), admin.getPersonId()); orgManager.changeSuperAdmin(admin);
return admin.getOuId(); return admin.getOuId();
}); });
} }