REQ-3581: 印章授权人问题
This commit is contained in:
parent
a2c83d1edf
commit
6511a7524e
@ -24,4 +24,9 @@ public interface OrgPerson {
|
||||
static boolean equals(OrgPerson a, OrgPerson b) {
|
||||
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());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -53,10 +53,10 @@ public class EssOrgDao extends ServiceImpl<EssOrgMapper, EssOrg> {
|
||||
.update();
|
||||
}
|
||||
|
||||
public void changeSuperAdmin(Long ouId, Long personId) {
|
||||
public void changeSuperAdmin(OrgPerson admin) {
|
||||
lambdaUpdate() //
|
||||
.eq(EssOrg::getOuId, ouId) //
|
||||
.set(EssOrg::getSuperAdminPersonId, personId) //
|
||||
.eq(EssOrg::getOuId, admin.getOuId()) //
|
||||
.set(EssOrg::getSuperAdminPersonId, admin.getPersonId()) //
|
||||
.update();
|
||||
}
|
||||
|
||||
|
||||
@ -57,10 +57,10 @@ public class EssSealPersonDao extends ServiceImpl<EssSealPersonMapper, EssSealPe
|
||||
.oneOpt();
|
||||
}
|
||||
|
||||
public List<EssSealPerson> getByPersonId(Long ouId, Long personId) {
|
||||
public List<EssSealPerson> getByPerson(OrgPerson person) {
|
||||
return lambdaQuery() //
|
||||
.eq(EssSealPerson::getOuId, ouId) //
|
||||
.eq(EssSealPerson::getPersonId, personId) //
|
||||
.eq(EssSealPerson::getOuId, person.getOuId()) //
|
||||
.eq(EssSealPerson::getPersonId, person.getPersonId()) //
|
||||
.list();
|
||||
}
|
||||
|
||||
|
||||
@ -93,9 +93,9 @@ public class OrgManager {
|
||||
}
|
||||
|
||||
@BizTransactional
|
||||
public void changeSuperAdmin(Long ouId, Long superAdmin) {
|
||||
essOrgDao.changeSuperAdmin(ouId, superAdmin);
|
||||
log.info("change super admin: ouId={}, superAdmin={}", ouId, superAdmin);
|
||||
public void changeSuperAdmin(OrgPerson admin) {
|
||||
essOrgDao.changeSuperAdmin(admin);
|
||||
log.info("change super admin: {}", OrgPerson.toString(admin));
|
||||
}
|
||||
|
||||
public EssPerson getSuperAdminOrThrow(Long ouId) {
|
||||
|
||||
@ -91,7 +91,7 @@ class CallbackController implements EssCallbackApi, InitializingBean {
|
||||
PersonOpenId person = PersonOpenId.parse(request.readMsgData(OrgPersonJoin.class).getProxyOperatorOpenId());
|
||||
orgManager.addAuthorizedOrgPerson(person);
|
||||
// 自动授权
|
||||
for (EssSealPerson sealPerson : essSealPersonDao.getByPersonId(person.getOuId(), person.getPersonId())) {
|
||||
for (EssSealPerson sealPerson : essSealPersonDao.getByPerson(person)) {
|
||||
AddSealAuthorizationRequest addSealAuthorizationRequest = new AddSealAuthorizationRequest();
|
||||
addSealAuthorizationRequest.setEssSealId(sealPerson.getEssSealId());
|
||||
addSealAuthorizationRequest.setPersonId(person.getPersonId());
|
||||
@ -201,7 +201,7 @@ class CallbackController implements EssCallbackApi, InitializingBean {
|
||||
registerHandler(CallbackType.SUPER_ADMIN_CHANGED, request -> {
|
||||
SuperAdminChanged changes = request.readMsgData(SuperAdminChanged.class);
|
||||
PersonOpenId admin = PersonOpenId.parse(changes.getChangeToUserOpenId());
|
||||
orgManager.changeSuperAdmin(admin.getOuId(), admin.getPersonId());
|
||||
orgManager.changeSuperAdmin(admin);
|
||||
return admin.getOuId();
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user