permission
This commit is contained in:
parent
ebe85d7c26
commit
9a0d0d2980
@ -78,14 +78,16 @@ public class AcPermissionDistributeController {
|
||||
public String generateQrCode(@PathVariable("pdId") Long pdId, @RequestAttribute(value = AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO loginInfo) {
|
||||
return this.permissionDistributeService.generateQrCode(pdId, loginInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信扫码获取权限分发相关信息
|
||||
*
|
||||
* @param code 用户编码
|
||||
* @param id 权限分发id
|
||||
*/
|
||||
@GetMapping
|
||||
public void findPermissionDistributeInfo(String code, Long id){
|
||||
|
||||
@GetMapping("/scan")
|
||||
public ScanPermissionDistributeInfoRspVo scanPermissionDistributeInfo(String code, Long id) {
|
||||
return this.permissionDistributeService.scanPermissionDistributeInfo(code, id);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -225,11 +225,24 @@ public class PermissionDistributeService {
|
||||
* @param code 用户编码
|
||||
* @param id 权限分发id
|
||||
*/
|
||||
public void scanPermissionDistributeInfo(String code, Long id) {
|
||||
@Transactional(readOnly = true)
|
||||
public ScanPermissionDistributeInfoRspVo scanPermissionDistributeInfo(String code, Long id) {
|
||||
AccountVO accountVO = this.authenticateService.getOrCreateUserByWmcode(WxApiService.MiniApp.JoyLink, code);
|
||||
PermissionDistribute permissionDistribute = this.permissionDistributeDAO.selectByPrimaryKey(id);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(null != permissionDistribute, String.format("权限分发[id=%s]不存在", id));
|
||||
Permission permission = this.permissionDAO.selectByPrimaryKey(permissionDistribute.getPermissionId());
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(null != permission, String.format("权限分发[id=%s]的权限[id=%s]不存在", id, permissionDistribute.getPermissionId()));
|
||||
//
|
||||
SysAccount creator = this.sysAccountDAO.selectByPrimaryKey(permissionDistribute.getCreatorId());
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(null != creator);
|
||||
SysAccount scanner = this.sysAccountDAO.selectByPrimaryKey(accountVO.getId());
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(null != scanner);
|
||||
//
|
||||
ScanPermissionDistributeInfoRspVo rsp = new ScanPermissionDistributeInfoRspVo();
|
||||
rsp.fill(permissionDistribute);
|
||||
rsp.fillPermission(permission);
|
||||
rsp.fillCreator(creator);
|
||||
rsp.fillScanner(scanner);
|
||||
return rsp;
|
||||
}
|
||||
}
|
||||
|
@ -1,27 +1,29 @@
|
||||
package club.joylink.rtss.vo.permission;
|
||||
|
||||
import club.joylink.rtss.entity.SysAccount;
|
||||
import club.joylink.rtss.entity.permission.Permission;
|
||||
import club.joylink.rtss.entity.permission.PermissionDistribute;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 扫码获取权限分发的响应
|
||||
* 扫码获取权限分发的相关信息
|
||||
*/
|
||||
@Data
|
||||
public class ScanPermissionDistributeInfoRspVo {
|
||||
/**
|
||||
* 扫码用户的账号id
|
||||
* 进行扫码操作的用户
|
||||
*/
|
||||
private Long accountId;
|
||||
private AccountVo scanner;
|
||||
/**
|
||||
* 权限分发id
|
||||
*/
|
||||
private Long pdId;
|
||||
|
||||
/**
|
||||
* 关联权限id
|
||||
* 关联权限
|
||||
*/
|
||||
private Long permissionId;
|
||||
private PermissionVo permissionInfo;
|
||||
|
||||
/**
|
||||
* 分发来自subject id(rts_permission_subject)
|
||||
@ -44,7 +46,7 @@ public class ScanPermissionDistributeInfoRspVo {
|
||||
private Boolean forever;
|
||||
|
||||
/**
|
||||
* 权限分发状态
|
||||
* 权限分发状态,1-有效,2-无效
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
@ -52,12 +54,6 @@ public class ScanPermissionDistributeInfoRspVo {
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
@ -69,12 +65,94 @@ public class ScanPermissionDistributeInfoRspVo {
|
||||
private LocalDateTime endTime;
|
||||
|
||||
/**
|
||||
* 创建者id
|
||||
* 创建者
|
||||
*/
|
||||
private Long creatorId;
|
||||
private AccountVo creator;
|
||||
|
||||
/**
|
||||
* 备注描述
|
||||
*/
|
||||
private String dsc;
|
||||
|
||||
public void fillCreator(SysAccount account){
|
||||
this.setCreator(this.convertFrom(account));
|
||||
}
|
||||
public void fillScanner(SysAccount account){
|
||||
this.setScanner(this.convertFrom(account));
|
||||
}
|
||||
public void fillPermission(Permission p){
|
||||
PermissionVo to = new PermissionVo();
|
||||
this.setPermissionInfo(to);
|
||||
//
|
||||
to.setId(p.getId());
|
||||
to.setName(p.getName());
|
||||
to.setDes(p.getDes());
|
||||
}
|
||||
public void fill(PermissionDistribute p){
|
||||
this.pdId=p.getId();
|
||||
this.sourceSubjectId=p.getSourceSubjectId();
|
||||
this.amount=p.getAmount();
|
||||
this.remains=p.getRemains();
|
||||
this.forever=p.getForever();
|
||||
this.status=p.getStatus();
|
||||
this.createTime=p.getCreateTime();
|
||||
this.startTime=p.getStartTime();
|
||||
this.endTime=p.getEndTime();
|
||||
this.dsc=p.getDsc();
|
||||
}
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
private AccountVo convertFrom(SysAccount from){
|
||||
AccountVo to = new AccountVo();
|
||||
to.setId(from.getId());
|
||||
to.setName(from.getName());
|
||||
to.setAccount(from.getAccount());
|
||||
to.setNickName(from.getNickname());
|
||||
to.setMobile(from.getMobile());
|
||||
to.setEmail(from.getEmail());
|
||||
return to;
|
||||
}
|
||||
@Data
|
||||
public static class AccountVo{
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 账号
|
||||
*/
|
||||
private String account;
|
||||
/**
|
||||
* 真实姓名
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 昵称
|
||||
*/
|
||||
private String nickName;
|
||||
/**
|
||||
* 电话
|
||||
*/
|
||||
private String mobile;
|
||||
/**
|
||||
* 邮件地址
|
||||
*/
|
||||
private String email;
|
||||
|
||||
}
|
||||
@Data
|
||||
public static class PermissionVo{
|
||||
/**
|
||||
* 权限id
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 权限名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 权限描述
|
||||
*/
|
||||
private String des;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user