Commit 25eeef38 authored by 李秀明's avatar 李秀明

feat: 增加/idx/table/getPage前置权限控制接口

parent 3349e2e3
package com.yeejoin.amos.boot.module.jxiop.biz.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jxiop.biz.service.IIdxBizTableService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.Map;
@RestController
@Api(tags = "idx业务前置接口")
@RequestMapping(value = "/idx")
public class IdxBizTableController {
@Autowired
IIdxBizTableService idxBizTableService;
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "分页查询业务事实表的数据", notes = "分页查询业务事实表的数据-IDX前置接口")
@GetMapping(value = "/table/getPage")
public ResponseModel<Page<Map<String, Object>>> getTablePage(@RequestParam Map<String, Object> map) {
return ResponseHelper.buildResponse(idxBizTableService.getPage(map));
}
}
package com.yeejoin.amos.boot.module.jxiop.biz.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.Map;
public interface IIdxBizTableService {
/**
* 分页查询业务事实表的数据-IDX(/idx/table/getPage)前置接口, 增加权限控制
*
* @param map 查询参数
*/
Page<Map<String, Object>> getPage(Map<String, Object> map);
}
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jxiop.api.feign.IdxFeign;
import com.yeejoin.amos.boot.module.jxiop.biz.service.IIdxBizTableService;
import com.yeejoin.amos.boot.module.jxiop.biz.service.IPermissionService;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@Service
@Slf4j
public class IdxBizTableServiceImpl implements IIdxBizTableService {
@Autowired
private IPermissionService permissionService;
@Autowired
private IdxFeign idxFeign;
/**
* 分页查询业务事实表的数据-IDX(/idx/table/getPage)前置接口, 增加权限控制
*
* @param map 查询参数
*/
public Page<Map<String, Object>> getPage(Map<String, Object> map) {
List<String> currentUserPermissions = permissionService.getCurrentUserPermissions();
if (Objects.isNull(currentUserPermissions)) {
currentUserPermissions = new ArrayList<>();
}
String gatewayIds = String.join(",", currentUserPermissions);
if (!gatewayIds.isEmpty()) {
map.put("GATEWAY_ID", String.format("[%s]", gatewayIds));
}
FeignClientResult<Page<Map<String, Object>>> page = idxFeign.getPage(map);
return page.getResult();
}
}
package com.yeejoin.amos.boot.module.jxiop.api.feign; package com.yeejoin.amos.boot.module.jxiop.api.feign;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
...@@ -17,4 +18,10 @@ public interface IdxFeign { ...@@ -17,4 +18,10 @@ public interface IdxFeign {
FeignClientResult<Map<String, Object>> healthIndexData(@RequestParam(required = false, value = "parentCode") String parentCode, FeignClientResult<Map<String, Object>> healthIndexData(@RequestParam(required = false, value = "parentCode") String parentCode,
@RequestParam(required = false, value = "stationType") String stationType); @RequestParam(required = false, value = "stationType") String stationType);
/**
* 分页查询业务事实表的数据
*/
@GetMapping("/table/getPage")
FeignClientResult<Page<Map<String, Object>>> getPage(@RequestParam Map<String, Object> map);
} }
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