|
@@ -9,7 +9,6 @@ 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;
|
|
@@ -36,23 +35,20 @@ public class GeoHazardMonitorTokenController {
|
|
|
* @return
|
|
|
*/
|
|
|
@PostMapping("/IPAddress/token")
|
|
|
- @ResponseBody
|
|
|
- public Result login(@RequestParam("grantType") String grantType,
|
|
|
+ public Result getToken(@RequestParam("grantType") String grantType,
|
|
|
@RequestParam("clientId") String clientId,
|
|
|
@RequestParam("clientSecret") String clientSecret) {
|
|
|
// 生成令牌
|
|
|
-// 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();
|
|
|
+ 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失败!!");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -62,7 +58,8 @@ public class GeoHazardMonitorTokenController {
|
|
|
* @return
|
|
|
*/
|
|
|
@PostMapping("/IPAddress/alarm")
|
|
|
- public Result login(@RequestBody ReqMsgAlarmVo reqMsgAlarmVo, HttpServletRequest request) {
|
|
|
+ public Result alarm(@RequestBody ReqMsgAlarmVo reqMsgAlarmVo,
|
|
|
+ HttpServletRequest request) {
|
|
|
// 生成令牌
|
|
|
String token = apiTokenUtils.getGeoHazardMonitorToken(request);
|
|
|
if (StringUtils.isNotEmpty(token)) {
|