|
@@ -16,6 +16,7 @@ import com.dragoninfo.dcuc.authweb.restcontroller.api.authservice.v4.vo.ResultRe
|
|
|
import com.dragoninfo.dcuc.authweb.util.VersionUtils;
|
|
|
import com.dragoninfo.dcuc.common.utils.ResponseUtil;
|
|
|
import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
|
|
|
+import com.dragonsoft.duceap.commons.util.string.StringUtils;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
@@ -46,9 +47,6 @@ public class DataAuthApiV2Controller {
|
|
|
@Autowired
|
|
|
private IApiDataAuthFacade apiDataAuthFacade;
|
|
|
|
|
|
- @Autowired
|
|
|
- private IAuthUserInfoFacade userFacade;
|
|
|
-
|
|
|
@ApiOperation(value = "数据鉴权")
|
|
|
@ApiImplicitParams({@ApiImplicitParam(name = "dataAuthV2ReqVO", value = "数据资源对象")})
|
|
|
@PostMapping(value = "data-auth/data-items/check")
|
|
@@ -66,25 +64,24 @@ public class DataAuthApiV2Controller {
|
|
|
|
|
|
DecodedJWT decode = JWT.decode(appTokenId);
|
|
|
String idcard = decode.getClaim("idCard").asString();
|
|
|
-
|
|
|
- AuthUserDTO userInfo = userFacade.findByIdcard(idcard);
|
|
|
- if (userInfo == null) {
|
|
|
- return ResultRespVO.respRequestErrorMessage("用户不存在");
|
|
|
+ if (StringUtils.isBlank(idcard)) {
|
|
|
+ return ResultRespVO.resultEnumMessage(BusinessRespEnum.TOKEN_FAIL);
|
|
|
}
|
|
|
|
|
|
- DataAuthV2ReqDTO reqDTO = new DataAuthV2ReqDTO();
|
|
|
- reqDTO.setResourceId(resourceId);
|
|
|
- reqDTO.setIdcard(userInfo.getIdcard());
|
|
|
- ResponseDTO<DataAuthV2RespDTO> dto = apiDataAuthFacade.dataItemsCheckV2(reqDTO);
|
|
|
+ DataAuthV2ReqDTO v2ReqDTO = new DataAuthV2ReqDTO();
|
|
|
+ v2ReqDTO.setIdcard(idcard);
|
|
|
+ v2ReqDTO.setResourceId(resourceId);
|
|
|
+
|
|
|
+ ResponseDTO<DataAuthV2RespDTO> dto = apiDataAuthFacade.dataItemsCheckV2(v2ReqDTO);
|
|
|
if (!ResponseUtil.isSuccess(dto)) {
|
|
|
- return ResultRespVO.resultEnumMessage(BusinessRespEnum.AUTH_FAIL);
|
|
|
+ ResultRespVO<DataAuthV2RespVO> respVO = ResultRespVO.resultEnumMessage(BusinessRespEnum.AUTH_FAIL);
|
|
|
+ respVO.setMessage(dto.getMessage());
|
|
|
+ return respVO;
|
|
|
} else {
|
|
|
DataAuthV2RespDTO respDTO = (DataAuthV2RespDTO) dto.getResult();
|
|
|
Set<String> set = respDTO.getItemIdentifier();
|
|
|
- String join = Optional.ofNullable(set)
|
|
|
- .orElse(Collections.emptySet())
|
|
|
- .stream()
|
|
|
- .collect(Collectors.joining(StrUtil.COMMA));
|
|
|
+ String join = String.join(StrUtil.COMMA, Optional.ofNullable(set)
|
|
|
+ .orElse(Collections.emptySet()));
|
|
|
DataAuthV2RespVO respVO = new DataAuthV2RespVO();
|
|
|
respVO.setResourceId(resourceId);
|
|
|
respVO.setItemIdentifier(join);
|