Commit 47c21f43 authored by 赵啸非's avatar 赵啸非

修改区域列表查询

parent 2491521d
package com.mortals.xhx.base.framework.interceptor;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.service.IAuthTokenService;
import com.mortals.framework.service.IUser;
import com.mortals.framework.util.AESUtil;
import com.mortals.framework.utils.ServletUtils;
import com.mortals.framework.web.interceptor.BaseInterceptor;
import com.mortals.xhx.base.framework.config.InterceptorConfig;
import com.mortals.xhx.common.code.ApiRespCodeEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import org.springframework.web.method.HandlerMethod;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.Method;
/**
* 用户权限验证,基于token
......@@ -36,6 +40,13 @@ public class AuthUserInterceptor extends BaseInterceptor {
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
throws Exception {
JSONObject ret = new JSONObject();
HandlerMethod handlerMethod = (HandlerMethod) handler;
Method method = handlerMethod.getMethod();
UnAuth annotation = method.getAnnotation(UnAuth.class);
if (annotation != null) {
//取消校验
return true;
}
try {
String uri = request.getServletPath();
//校验配置的请求路径是否需要检查权限
......
......@@ -4,8 +4,7 @@ POST {{baseUrl}}/window/business/list
Content-Type: application/json
{
"windowId":6529 ,
"siteBusinessId":4300 ,
"siteBusinessId":3,
"page":1,
"size":10
}
......
......@@ -28,8 +28,7 @@ public interface IApiAreaFeign extends IFeign {
* @return
*/
@PostMapping(value = "/area/list")
String list(@RequestBody AreaEntity query,
@RequestHeader(name = "Authorization", required = true) String token);
String list(@RequestBody AreaEntity query);
/**
......@@ -39,8 +38,7 @@ public interface IApiAreaFeign extends IFeign {
* @return
*/
@GetMapping(value = "/area/info")
String viewAreaInfo(@RequestParam(value = "id") Long id,
@RequestHeader(name = "Authorization", required = true) String token);
String viewAreaInfo(@RequestParam(value = "id") Long id);
/**
......@@ -50,8 +48,7 @@ public interface IApiAreaFeign extends IFeign {
* @return
*/
@GetMapping(value = "/area/getListByParentId")
String getListByParentId(@RequestParam(value = "parentId") String parentId,
@RequestHeader(name = "Authorization", required = true) String token);
String getListByParentId(@RequestParam(value = "parentId") String parentId);
}
......@@ -63,8 +60,8 @@ class AreaFeignFallbackFactory implements FallbackFactory<IApiAreaFeign> {
public IApiAreaFeign create(Throwable t) {
return new IApiAreaFeign() {
@Override
public String list(AreaEntity query, String token) {
log.error("暂时无法获取区域列表信息,请稍后再试!query:{},token:{}", JSON.toJSONString(query), token);
public String list(AreaEntity query) {
log.error("暂时无法获取区域列表信息,请稍后再试!query:{}", JSON.toJSONString(query));
log.error(t.getMessage());
ApiResp<String> failResp = new ApiResp<>();
failResp.setCode(ApiRespCodeEnum.FAILED.getValue());
......@@ -73,8 +70,8 @@ class AreaFeignFallbackFactory implements FallbackFactory<IApiAreaFeign> {
}
@Override
public String viewAreaInfo(Long id, String token) {
log.error("暂时无法获取区域信息,请稍后再试!parentId:{},token:{}", id, token);
public String viewAreaInfo(Long id) {
log.error("暂时无法获取区域信息,请稍后再试!parentId:{}", id);
log.error(t.getMessage());
ApiResp<String> failResp = new ApiResp<>();
failResp.setCode(ApiRespCodeEnum.FAILED.getValue());
......@@ -83,8 +80,8 @@ class AreaFeignFallbackFactory implements FallbackFactory<IApiAreaFeign> {
}
@Override
public String getListByParentId(String parentId, String token) {
log.error("暂时无法获取区域信息,请稍后再试!parentId:{},token:{}", parentId, token);
public String getListByParentId(String parentId) {
log.error("暂时无法获取区域信息,请稍后再试!parentId:{}", parentId);
log.error(t.getMessage());
ApiResp<String> failResp = new ApiResp<>();
failResp.setCode(ApiRespCodeEnum.FAILED.getValue());
......
......@@ -51,7 +51,7 @@ public interface AreaService extends ICRUDService<AreaEntity, Long> {
* @param context
* @return
*/
String getListByParentId(String parentId,String token, Context context);
String getListByParentId(String parentId, Context context);
/**
......@@ -61,15 +61,14 @@ public interface AreaService extends ICRUDService<AreaEntity, Long> {
* @param context
* @return
*/
String viewArea(Long id,String token, Context context);
String viewArea(Long id, Context context);
/**
* 查询区域列表信息
* @param query
* @param token
* @param context
* @return
*/
String list(AreaEntity query, String token, Context context);
String list(AreaEntity query, Context context);
}
\ No newline at end of file
......@@ -37,11 +37,11 @@ public class AreaServiceImpl extends AbstractCRUDServiceImpl<AreaDao, AreaEntity
@Override
public String getListByParentId(String parentId, String token, Context context) {
public String getListByParentId(String parentId, Context context) {
if (ObjectUtils.isEmpty(parentId)) {
parentId = "0";
}
String resp = apiAreaFeign.getListByParentId(parentId, token);
String resp = apiAreaFeign.getListByParentId(parentId);
ApiResp apiResp = JSON.parseObject(resp, ApiResp.class);
if (apiResp.getCode() != YesNoEnum.YES.getValue()) {
......@@ -53,8 +53,8 @@ public class AreaServiceImpl extends AbstractCRUDServiceImpl<AreaDao, AreaEntity
}
@Override
public String viewArea(Long id, String token, Context context) {
String resp = apiAreaFeign.viewAreaInfo(id, token);
public String viewArea(Long id, Context context) {
String resp = apiAreaFeign.viewAreaInfo(id);
ApiResp apiResp = JSON.parseObject(resp, ApiResp.class);
if (apiResp.getCode() != YesNoEnum.YES.getValue()) {
throw new AppException("获取区域数据失败:" + apiResp.getMsg());
......@@ -64,9 +64,9 @@ public class AreaServiceImpl extends AbstractCRUDServiceImpl<AreaDao, AreaEntity
}
@Override
public String list(AreaEntity query, String token, Context context) {
public String list(AreaEntity query, Context context) {
log.info("areaListReq==》{}", JSON.toJSONString(query));
String resp = apiAreaFeign.list(query, token);
String resp = apiAreaFeign.list(query);
ApiResp apiResp = JSON.parseObject(resp, ApiResp.class);
if (apiResp.getCode() != YesNoEnum.YES.getValue()) {
throw new AppException("获取区域列表数据失败:" + apiResp.getMsg());
......
......@@ -56,7 +56,7 @@ public class AreaController extends BaseCRUDJsonBodyMappingController<AreaServic
Context context = this.getContext();
try {
String token = authTokenService.getToken(request);
String resp = this.service.viewArea(id, token, context);
String resp = this.service.viewArea(id, context);
this.recordSysLog(this.request, busiDesc + " 【成功】");
return resp;
} catch (Exception e) {
......@@ -74,7 +74,7 @@ public class AreaController extends BaseCRUDJsonBodyMappingController<AreaServic
String busiDesc = "查询" + this.getModuleDesc();
try {
String token = authTokenService.getToken(request);
String resp = this.service.list(query, token, context);
String resp = this.service.list(query, context);
recordSysLog(request, busiDesc + " 【成功】");
return resp;
} catch (Exception e) {
......@@ -117,7 +117,7 @@ public class AreaController extends BaseCRUDJsonBodyMappingController<AreaServic
String busiDesc = "查询" + this.getModuleDesc() + "子节点";
try {
String token = authTokenService.getToken(request);
String retStr = this.service.getListByParentId(parentId, token, getContext());
String retStr = this.service.getListByParentId(parentId, getContext());
recordSysLog(request, busiDesc + "【成功】");
return retStr;
} catch (Exception e) {
......
###区域列表
GET {{baseUrl}}/area/getListByParentId?parentId=0
Authorization: {{authToken}}
Accept: application/json
###区域列表
POST {{baseUrl}}/area/list
Content-Type: application/json
{
"areaCode":"510000000000",
"page":1,
"size":5
}
###区域查看
GET {{baseUrl}}/area/info?id=5
Authorization: {{authToken}}
Accept: application/json
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