Commit bb7a4f1d authored by zhangc's avatar zhangc

修改dmp组织信息

parent fdc87eca
...@@ -26,9 +26,13 @@ public class AuthDmpUserApiReq implements Serializable { ...@@ -26,9 +26,13 @@ public class AuthDmpUserApiReq implements Serializable {
@NotNull(message = "apiKey唯一标识不能为空") @NotNull(message = "apiKey唯一标识不能为空")
private String apiKey; private String apiKey;
@ApiModelProperty(value = "组织id",required = true) @ApiModelProperty(value = "组织编码",required = true)
@NotNull(message = "组织id不能为空") @NotNull(message = "组织编码不能为空")
private Long orgId; private String orgCode;
@ApiModelProperty(value = "组织类型: INT 内部, OUT 外部",required = true)
@NotNull(message = "组织类型不能为空")
private String orgType;
@ApiModelProperty(value = "授权类型:DATA_BANK_AUTH 数据银行 , DMP_AUTH dmp授权",required = true) @ApiModelProperty(value = "授权类型:DATA_BANK_AUTH 数据银行 , DMP_AUTH dmp授权",required = true)
@NotNull(message = "授权类型不能为空") @NotNull(message = "授权类型不能为空")
......
...@@ -33,9 +33,9 @@ public class AuthMallUserApiReq implements Serializable { ...@@ -33,9 +33,9 @@ public class AuthMallUserApiReq implements Serializable {
@ApiModelProperty(value = "用户id",required = false) @ApiModelProperty(value = "用户id",required = false)
private String userId; private String userId;
@ApiModelProperty(value = "组织id",required = true) @ApiModelProperty(value = "组织编码",required = true)
@NotNull(message = "组织id不能为空") @NotNull(message = "组织编码不能为空")
private Long orgId; private String orgCode;
@ApiModelProperty(value = "授权类型:DATA_BANK_AUTH 数据银行 , DMP_AUTHdmp 授权",required = true) @ApiModelProperty(value = "授权类型:DATA_BANK_AUTH 数据银行 , DMP_AUTHdmp 授权",required = true)
@NotNull(message = "授权类型不能为空") @NotNull(message = "授权类型不能为空")
......
...@@ -87,7 +87,7 @@ public class AuthServiceImpl implements AuthService { ...@@ -87,7 +87,7 @@ public class AuthServiceImpl implements AuthService {
if (null == apiInterface) { if (null == apiInterface) {
return Result.of_error("api授权信息不存在!"); return Result.of_error("api授权信息不存在!");
} }
ApiOrg apiOrg = apiOrgMapper.selectById(req.getOrgId()); ApiOrg apiOrg = apiOrgMapper.selectOne(new QueryWrapper<ApiOrg>().eq("org_code",req.getOrgCode()));
if (null == apiOrg) { if (null == apiOrg) {
return Result.of_error("组织信息不存在!"); return Result.of_error("组织信息不存在!");
} }
...@@ -106,11 +106,21 @@ public class AuthServiceImpl implements AuthService { ...@@ -106,11 +106,21 @@ public class AuthServiceImpl implements AuthService {
AuthModeEnum.POWER_CALL_MODE.name().equals(req.getAuthMode())) { AuthModeEnum.POWER_CALL_MODE.name().equals(req.getAuthMode())) {
return Result.of_error("授权类型错误!"); return Result.of_error("授权类型错误!");
} }
String authCode = "";
ApiAuth apiAuth = new ApiAuth(); ApiAuth apiAuth = new ApiAuth();
BeanUtils.copyProperties(req, apiAuth); BeanUtils.copyProperties(req, apiAuth);
apiAuth.setApiInterfaceId(apiInterface.getId()); apiAuth.setApiInterfaceId(apiInterface.getId());
apiAuth.setAuthCode("");//授权码 if (StringUtils.isNotBlank(req.getOrgType()) //内部组织
apiAuth.setSalt("");//盐值 && Constants.AUTH_INT.equalsIgnoreCase(req.getOrgType())) {
authCode = getAuthCode(apiOrg.getOrgCode(),"",Constants.AUTH_INT);
}
/*else if (StringUtils.isNotBlank(req.getOrgType()) //外部组织
&& Constants.AUTH_OUT.equalsIgnoreCase(req.getOrgType())) {
authCode = getAuthCode("", req.getUserId(),Constants.AUTH_OUT);
}*/
apiAuth.setAuthCode(authCode);//授权码
String salt = RandomUtil.getStringRandom(8);
apiAuth.setSalt(salt);//盐值
apiAuth.setStatus("1");//授权状态 apiAuth.setStatus("1");//授权状态
if (apiAuthMapper.insert(apiAuth) > 0) { if (apiAuthMapper.insert(apiAuth) > 0) {
return Result.of_success(ResultMsg.SUCCESS); return Result.of_success(ResultMsg.SUCCESS);
...@@ -131,7 +141,7 @@ public class AuthServiceImpl implements AuthService { ...@@ -131,7 +141,7 @@ public class AuthServiceImpl implements AuthService {
if (null == apiInterface) { if (null == apiInterface) {
return Result.of_error("api授权信息不存在!"); return Result.of_error("api授权信息不存在!");
} }
ApiOrg apiOrg = apiOrgMapper.selectById(req.getOrgId()); ApiOrg apiOrg = apiOrgMapper.selectOne(new QueryWrapper<ApiOrg>().eq("org_code",req.getOrgCode()));
if (null == apiOrg) { if (null == apiOrg) {
return Result.of_error("组织信息不存在!"); return Result.of_error("组织信息不存在!");
} }
...@@ -168,9 +178,9 @@ public class AuthServiceImpl implements AuthService { ...@@ -168,9 +178,9 @@ public class AuthServiceImpl implements AuthService {
response.setAuthCode(authCode); response.setAuthCode(authCode);
response.setSalt(salt); response.setSalt(salt);
if (apiAuthMapper.insert(apiAuth) > 0) { if (apiAuthMapper.insert(apiAuth) > 0) {
return Result.of_success(response); return Result.of_success(ResultMsg.SUCCESS,response);
} }
return Result.of_success(ResultMsg.FAILURE); return Result.of_success(ResultMsg.FAILURE,response);
} }
/** /**
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
</properties> </properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment