Commit f7e65093 authored by litengwei's avatar litengwei

接口不需要token

parent aad60da0
...@@ -238,7 +238,7 @@ public class EquipmentDetailController extends AbstractBaseController { ...@@ -238,7 +238,7 @@ public class EquipmentDetailController extends AbstractBaseController {
} }
@RequestMapping(value = "/selectequipmentDateByCode", method = RequestMethod.GET) @RequestMapping(value = "/selectequipmentDateByCode", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "根据code查询", notes = "根据code查询") @ApiOperation(httpMethod = "GET", value = "根据code查询", notes = "根据code查询")
public EquipmentDate selectequipmentDateByCode(@RequestParam String code, public EquipmentDate selectequipmentDateByCode(@RequestParam String code,
@RequestParam(required = false) Long stockDetailId) { @RequestParam(required = false) Long stockDetailId) {
......
...@@ -6,6 +6,7 @@ import java.util.List; ...@@ -6,6 +6,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.component.robot.AmosRequestContext;
import com.yeejoin.equipmanage.common.entity.*; import com.yeejoin.equipmanage.common.entity.*;
import com.yeejoin.equipmanage.common.utils.SpringUtils; import com.yeejoin.equipmanage.common.utils.SpringUtils;
import com.yeejoin.equipmanage.fegin.JcsFeign; import com.yeejoin.equipmanage.fegin.JcsFeign;
...@@ -26,6 +27,7 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -26,6 +27,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.Bean; import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
...@@ -143,6 +145,8 @@ public class FireFightingSystemController extends AbstractBaseController { ...@@ -143,6 +145,8 @@ public class FireFightingSystemController extends AbstractBaseController {
IEquipmentService iEquipmentService; IEquipmentService iEquipmentService;
@Autowired @Autowired
FireFightingSystemMapper fireFightingSystemMapper; FireFightingSystemMapper fireFightingSystemMapper;
@Autowired
private AmosRequestContext amosAuth;
@Value("${equipment.hierarchy}") @Value("${equipment.hierarchy}")
private String hierarchy; private String hierarchy;
...@@ -909,27 +913,33 @@ public class FireFightingSystemController extends AbstractBaseController { ...@@ -909,27 +913,33 @@ public class FireFightingSystemController extends AbstractBaseController {
/** /**
* 获取点位图,区域树数据 * 获取点位图,区域树数据
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "获取点位图,区域树数据", notes = "消防系统点位图使用") @ApiOperation(value = "获取点位图,区域树数据", notes = "消防系统点位图使用")
@GetMapping(value = "/point/tree") @GetMapping(value = "/point/tree")
public List<PointTreeVo> getPointTree(@RequestParam(required = false) String systemId, public List<PointTreeVo> getPointTree(@RequestParam(required = false) String systemId,
@RequestParam(required = false) String bizOrgCode, @RequestParam(required = false) String bizOrgCode,
@RequestParam(required = false) String type) { @RequestParam(required = false) String type) {
RequestContext.setAppKey(amosAuth.getAppKey());
RequestContext.setProduct(amosAuth.getProduct());
RequestContext.setToken(amosAuth.getToken());
return fireFightingSystemService.getPointTree(systemId, bizOrgCode,type); return fireFightingSystemService.getPointTree(systemId, bizOrgCode,type);
} }
@RequestMapping(value = "/{systemCode}/system/detail", method = RequestMethod.GET) @RequestMapping(value = "/{systemCode}/system/detail", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation("通过系统code查询消防系统及部件信息") @ApiOperation("通过系统code查询消防系统及部件信息")
public Map<String, Object> getSystemDetailByCode(@PathVariable String systemCode) { public Map<String, Object> getSystemDetailByCode(@PathVariable String systemCode) {
return fireFightingSystemService.getSystemDetailByCode(systemCode); return fireFightingSystemService.getSystemDetailByCode(systemCode);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "获取系统分类树", notes = "获取系统分类树") @ApiOperation(httpMethod = "GET", value = "获取系统分类树", notes = "获取系统分类树")
@GetMapping(value = "/systemAndEquipmentTreeByBziOrgCode") @GetMapping(value = "/systemAndEquipmentTreeByBziOrgCode")
public List<OrgMenuDto> systemAndEquipmentTreeByBziOrgCode() { public List<OrgMenuDto> systemAndEquipmentTreeByBziOrgCode() {
RequestContext.setAppKey(amosAuth.getAppKey());
RequestContext.setProduct(amosAuth.getProduct());
RequestContext.setToken(amosAuth.getToken());
return fireFightingSystemService.systemAndEquipmentTreeByBziOrgCode(); return fireFightingSystemService.systemAndEquipmentTreeByBziOrgCode();
} }
......
...@@ -10,6 +10,7 @@ import org.springframework.web.context.request.ServletRequestAttributes; ...@@ -10,6 +10,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import feign.RequestInterceptor; import feign.RequestInterceptor;
import feign.RequestTemplate; import feign.RequestTemplate;
import org.typroject.tyboot.core.foundation.context.RequestContext;
public class FeignBasicAuthRequestInterceptor implements RequestInterceptor { public class FeignBasicAuthRequestInterceptor implements RequestInterceptor {
public public
...@@ -27,13 +28,28 @@ public class FeignBasicAuthRequestInterceptor implements RequestInterceptor { ...@@ -27,13 +28,28 @@ public class FeignBasicAuthRequestInterceptor implements RequestInterceptor {
String authToken = request.getHeader("token"); String authToken = request.getHeader("token");
/* If token not found get it from request parameter */ /* If token not found get it from request parameter */
if (StringUtils.isBlank(authToken)) { if (StringUtils.isBlank(authToken)) {
authToken = request.getHeader("X-Access-Token"); if (StringUtils.isBlank(RequestContext.getToken())) {
authToken = request.getHeader("X-Access-Token");
template.header("X-Access-Token", authToken);
template.header("token", authToken);
template.header("appKey", request.getHeader("appKey"));
template.header("product", request.getHeader("product"));
template.header("clientType", "feignClient");
} else {
template.header("X-Access-Token", RequestContext.getToken());
System.out.println(RequestContext.getToken());
template.header("token", RequestContext.getToken());
template.header("appKey", RequestContext.getAppKey());
template.header("product", RequestContext.getProduct());
template.header("clientType", "feignClient");
}
} else {
template.header("X-Access-Token", authToken);
template.header("token", authToken);
template.header("appKey", request.getHeader("appKey"));
template.header("product", request.getHeader("product"));
template.header("clientType", "feignClient");
} }
template.header("X-Access-Token", authToken);
template.header("token", authToken);
template.header("appKey", request.getHeader("appKey"));
template.header("product", request.getHeader("product"));
template.header("clientType", "feignClient");
} }
} }
} }
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