|
@@ -62,30 +62,26 @@ public class GeoHazardMonitorTokenController {
|
|
/**
|
|
/**
|
|
* 获取web访问令牌
|
|
* 获取web访问令牌
|
|
*
|
|
*
|
|
- * @param grantType 授权类型,客户端模式(client_credentials)
|
|
|
|
- * @param clientId 客户端编号
|
|
|
|
- * @param clientSecret 客户端密钥
|
|
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@PostMapping("/IPAddress/token")
|
|
@PostMapping("/IPAddress/token")
|
|
- public String getWebToken(@RequestParam(value = "grantType", required = false) String grantType,
|
|
|
|
- @RequestParam(value = "clientId", required = false) String clientId,
|
|
|
|
- @RequestParam(value = "clientSecret", required = false) String clientSecret) {
|
|
|
|
|
|
+ public String getWebToken(@RequestParam("parameter") String parameter) {
|
|
// 生成令牌
|
|
// 生成令牌
|
|
JSONObject jsonObject=new JSONObject();
|
|
JSONObject jsonObject=new JSONObject();
|
|
|
|
+ SvcAddress svcAddress = JSON.parseObject(parameter, SvcAddress.class);
|
|
LambdaQueryWrapper<SvcAddress> lw = new LambdaQueryWrapper<SvcAddress>();
|
|
LambdaQueryWrapper<SvcAddress> lw = new LambdaQueryWrapper<SvcAddress>();
|
|
- if (!ObjectUtils.isEmpty(grantType)) {
|
|
|
|
- lw.eq(SvcAddress::getGrantType, grantType);
|
|
|
|
|
|
+ if (!ObjectUtils.isEmpty(svcAddress.getGrantType())) {
|
|
|
|
+ lw.eq(SvcAddress::getGrantType, svcAddress.getGrantType());
|
|
}
|
|
}
|
|
- if (!ObjectUtils.isEmpty(clientId)) {
|
|
|
|
- lw.eq(SvcAddress::getClientId, clientId);
|
|
|
|
|
|
+ if (!ObjectUtils.isEmpty(svcAddress.getClientId())) {
|
|
|
|
+ lw.eq(SvcAddress::getClientId, svcAddress.getClientId());
|
|
}
|
|
}
|
|
- if (!ObjectUtils.isEmpty(clientSecret)) {
|
|
|
|
- lw.eq(SvcAddress::getClientSecret, clientSecret);
|
|
|
|
|
|
+ if (!ObjectUtils.isEmpty(svcAddress.getClientSecret())) {
|
|
|
|
+ lw.eq(SvcAddress::getClientSecret, svcAddress.getClientSecret());
|
|
}
|
|
}
|
|
List<SvcAddress> list = svcAddressService.list(lw);
|
|
List<SvcAddress> list = svcAddressService.list(lw);
|
|
if (list.size() > 0) {
|
|
if (list.size() > 0) {
|
|
- ArrayList<String> objects = apiTokenUtils.createGeoHazardMonitorToken(grantType, clientId, clientSecret);
|
|
|
|
|
|
+ ArrayList<String> objects = apiTokenUtils.createGeoHazardMonitorToken(svcAddress.getGrantType(), svcAddress.getClientId(), svcAddress.getClientSecret());
|
|
if (objects.size() > 0) {
|
|
if (objects.size() > 0) {
|
|
RespGeoHazardMonitorVo respGeoHazardMonitorVo = new RespGeoHazardMonitorVo();
|
|
RespGeoHazardMonitorVo respGeoHazardMonitorVo = new RespGeoHazardMonitorVo();
|
|
respGeoHazardMonitorVo.setAccessToken(objects.get(1));
|
|
respGeoHazardMonitorVo.setAccessToken(objects.get(1));
|