Commit bb7a4f1d authored by zhangc's avatar zhangc

修改dmp组织信息

parent fdc87eca
......@@ -26,9 +26,13 @@ public class AuthDmpUserApiReq implements Serializable {
@NotNull(message = "apiKey唯一标识不能为空")
private String apiKey;
@ApiModelProperty(value = "组织id",required = true)
@NotNull(message = "组织id不能为空")
private Long orgId;
@ApiModelProperty(value = "组织编码",required = true)
@NotNull(message = "组织编码不能为空")
private String orgCode;
@ApiModelProperty(value = "组织类型: INT 内部, OUT 外部",required = true)
@NotNull(message = "组织类型不能为空")
private String orgType;
@ApiModelProperty(value = "授权类型:DATA_BANK_AUTH 数据银行 , DMP_AUTH dmp授权",required = true)
@NotNull(message = "授权类型不能为空")
......
......@@ -33,9 +33,9 @@ public class AuthMallUserApiReq implements Serializable {
@ApiModelProperty(value = "用户id",required = false)
private String userId;
@ApiModelProperty(value = "组织id",required = true)
@NotNull(message = "组织id不能为空")
private Long orgId;
@ApiModelProperty(value = "组织编码",required = true)
@NotNull(message = "组织编码不能为空")
private String orgCode;
@ApiModelProperty(value = "授权类型:DATA_BANK_AUTH 数据银行 , DMP_AUTHdmp 授权",required = true)
@NotNull(message = "授权类型不能为空")
......
......@@ -87,7 +87,7 @@ public class AuthServiceImpl implements AuthService {
if (null == apiInterface) {
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) {
return Result.of_error("组织信息不存在!");
}
......@@ -106,11 +106,21 @@ public class AuthServiceImpl implements AuthService {
AuthModeEnum.POWER_CALL_MODE.name().equals(req.getAuthMode())) {
return Result.of_error("授权类型错误!");
}
String authCode = "";
ApiAuth apiAuth = new ApiAuth();
BeanUtils.copyProperties(req, apiAuth);
apiAuth.setApiInterfaceId(apiInterface.getId());
apiAuth.setAuthCode("");//授权码
apiAuth.setSalt("");//盐值
if (StringUtils.isNotBlank(req.getOrgType()) //内部组织
&& 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");//授权状态
if (apiAuthMapper.insert(apiAuth) > 0) {
return Result.of_success(ResultMsg.SUCCESS);
......@@ -131,7 +141,7 @@ public class AuthServiceImpl implements AuthService {
if (null == apiInterface) {
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) {
return Result.of_error("组织信息不存在!");
}
......@@ -168,9 +178,9 @@ public class AuthServiceImpl implements AuthService {
response.setAuthCode(authCode);
response.setSalt(salt);
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 @@
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<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