|
@@ -1,15 +1,15 @@
|
|
|
package com.ozs.controller.upload;
|
|
|
|
|
|
-import com.ozs.common.core.domain.AjaxResult;
|
|
|
import com.ozs.common.core.domain.Result;
|
|
|
+import com.ozs.common.utils.ApiTokenUtils;
|
|
|
import com.ozs.common.utils.StringUtils;
|
|
|
-import com.ozs.framework.web.service.TokenService;
|
|
|
-import com.ozs.system.domain.vo.ReqMsgAlarmVo;
|
|
|
-import com.ozs.system.domain.vo.RespGeoHazardMonitorVo;
|
|
|
-import com.ozs.system.domain.vo.RespMsgAlarmVo;
|
|
|
+import com.ozs.vo.ReqMsgAlarmVo;
|
|
|
+import com.ozs.vo.RespGeoHazardMonitorVo;
|
|
|
+import com.ozs.vo.RespMsgAlarmVo;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
+import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
@@ -25,7 +25,7 @@ import java.util.ArrayList;
|
|
|
public class GeoHazardMonitorTokenController {
|
|
|
|
|
|
@Resource
|
|
|
- private TokenService tokenService;
|
|
|
+ private ApiTokenUtils apiTokenUtils;
|
|
|
|
|
|
/**
|
|
|
* 获取访问令牌
|
|
@@ -36,18 +36,23 @@ public class GeoHazardMonitorTokenController {
|
|
|
* @return
|
|
|
*/
|
|
|
@PostMapping("/IPAddress/token")
|
|
|
- public Result login(@RequestParam("grantType") String grantType, @RequestParam("clientId") String clientId, @RequestParam("clientSecret") String clientSecret) {
|
|
|
+ @ResponseBody
|
|
|
+ public Result login(@RequestParam("grantType") String grantType,
|
|
|
+ @RequestParam("clientId") String clientId,
|
|
|
+ @RequestParam("clientSecret") String clientSecret) {
|
|
|
// 生成令牌
|
|
|
- ArrayList<String> objects = tokenService.createGeoHazardMonitorToken();
|
|
|
- if (objects.size() > 0) {
|
|
|
- RespGeoHazardMonitorVo respGeoHazardMonitorVo = new RespGeoHazardMonitorVo();
|
|
|
- respGeoHazardMonitorVo.setAccessToken(objects.get(1));
|
|
|
- respGeoHazardMonitorVo.setExpiresIn(Long.valueOf(objects.get(0)));
|
|
|
- respGeoHazardMonitorVo.setTokenType("令牌类型");
|
|
|
- return new Result(1, "成功", respGeoHazardMonitorVo);
|
|
|
- } else {
|
|
|
- return new Result(2, "失败", "生成token失败!!");
|
|
|
- }
|
|
|
+// ArrayList<String> objects = apiTokenUtils.createGeoHazardMonitorToken();
|
|
|
+// if (objects.size() > 0) {
|
|
|
+// RespGeoHazardMonitorVo respGeoHazardMonitorVo = new RespGeoHazardMonitorVo();
|
|
|
+// respGeoHazardMonitorVo.setAccessToken(objects.get(1));
|
|
|
+// respGeoHazardMonitorVo.setExpiresIn(Long.valueOf(objects.get(0)));
|
|
|
+// respGeoHazardMonitorVo.setTokenType("令牌类型");
|
|
|
+// return new Result(1, "成功", respGeoHazardMonitorVo);
|
|
|
+// } else {
|
|
|
+// return new Result(2, "失败", "生成token失败!!");
|
|
|
+// }
|
|
|
+ int i=1;
|
|
|
+ return Result.success();
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -59,7 +64,7 @@ public class GeoHazardMonitorTokenController {
|
|
|
@PostMapping("/IPAddress/alarm")
|
|
|
public Result login(@RequestBody ReqMsgAlarmVo reqMsgAlarmVo, HttpServletRequest request) {
|
|
|
// 生成令牌
|
|
|
- String token = tokenService.getGeoHazardMonitorToken(request);
|
|
|
+ String token = apiTokenUtils.getGeoHazardMonitorToken(request);
|
|
|
if (StringUtils.isNotEmpty(token)) {
|
|
|
RespMsgAlarmVo respMsgAlarmVo = new RespMsgAlarmVo();
|
|
|
respMsgAlarmVo.setAlarmId(reqMsgAlarmVo.getAlarmId());
|