Explorar o código

对外接口修改

gao.qiang %!s(int64=2) %!d(string=hai) anos
pai
achega
02f4df1ce3

+ 9 - 13
hazard-sdk/src/main/java/com/ozs/controller/upload/GeoHazardMonitorTokenController.java

@@ -62,30 +62,26 @@ public class GeoHazardMonitorTokenController {
     /**
      * 获取web访问令牌
      *
-     * @param grantType    授权类型,客户端模式(client_credentials)
-     * @param clientId     客户端编号
-     * @param clientSecret 客户端密钥
      * @return
      */
     @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();
+        SvcAddress svcAddress = JSON.parseObject(parameter, SvcAddress.class);
         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);
         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) {
                 RespGeoHazardMonitorVo respGeoHazardMonitorVo = new RespGeoHazardMonitorVo();
                 respGeoHazardMonitorVo.setAccessToken(objects.get(1));