|
@@ -87,44 +87,24 @@ public class GeoHazardMonitorTokenController {
|
|
|
respGeoHazardMonitorVo.setAccessToken(objects.get(1));
|
|
|
respGeoHazardMonitorVo.setExpiresIn(Long.valueOf(objects.get(0)));
|
|
|
respGeoHazardMonitorVo.setTokenType("令牌类型");
|
|
|
- jsonObject.put("resultCode",1);
|
|
|
- jsonObject.put("message","成功");
|
|
|
- jsonObject.put("data",respGeoHazardMonitorVo);
|
|
|
+ jsonObject.put("resultCode", 1);
|
|
|
+ jsonObject.put("message", "成功");
|
|
|
+ jsonObject.put("data", respGeoHazardMonitorVo);
|
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
} else {
|
|
|
- jsonObject.put("resultCode",2);
|
|
|
- jsonObject.put("message","失败");
|
|
|
- jsonObject.put("data","生成token失败");
|
|
|
+ jsonObject.put("resultCode", 2);
|
|
|
+ jsonObject.put("message", "失败");
|
|
|
+ jsonObject.put("data", "生成token失败");
|
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
}
|
|
|
} else {
|
|
|
- jsonObject.put("resultCode",2);
|
|
|
- jsonObject.put("message","失败");
|
|
|
- jsonObject.put("data","参数验证失败");
|
|
|
+ jsonObject.put("resultCode", 2);
|
|
|
+ jsonObject.put("message", "失败");
|
|
|
+ jsonObject.put("data", "参数验证失败");
|
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 获取app访问令牌
|
|
|
- *
|
|
|
- * @return
|
|
|
- */
|
|
|
- @PostMapping("/App/token")
|
|
|
- public Result getAppToken(@RequestParam("parameter") String parameter) {
|
|
|
- // 生成令牌
|
|
|
- ArrayList<String> objects = appTokenUtils.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失败!!");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 报警信息数据传输
|
|
|
*
|
|
@@ -162,14 +142,14 @@ public class GeoHazardMonitorTokenController {
|
|
|
respMsgAlarmVo.setIsCancel(alarm.getIsLock());
|
|
|
respMsgAlarmVo.setCancelTime(alarm.getReleasedTime());
|
|
|
}
|
|
|
- jsonObject.put("resultCode",1);
|
|
|
- jsonObject.put("message","成功");
|
|
|
- jsonObject.put("data",respMsgAlarmVo);
|
|
|
+ jsonObject.put("resultCode", 1);
|
|
|
+ jsonObject.put("message", "成功");
|
|
|
+ jsonObject.put("data", respMsgAlarmVo);
|
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
} else {
|
|
|
- jsonObject.put("resultCode",2);
|
|
|
- jsonObject.put("message","失败");
|
|
|
- jsonObject.put("data","token验证失败");
|
|
|
+ jsonObject.put("resultCode", 2);
|
|
|
+ jsonObject.put("message", "失败");
|
|
|
+ jsonObject.put("data", "token验证失败");
|
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
}
|
|
|
}
|
|
@@ -181,7 +161,8 @@ public class GeoHazardMonitorTokenController {
|
|
|
* @return
|
|
|
*/
|
|
|
@PostMapping("/IPAddress/device/state")
|
|
|
- public String deviceState(@RequestParam("parameter") String parameter, HttpServletRequest request) throws ParseException {
|
|
|
+ public String deviceState(@RequestParam("parameter") String parameter, HttpServletRequest request) throws
|
|
|
+ ParseException {
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
String token = apiTokenUtils.getGeoHazardMonitorToken(request);
|
|
|
if (StringUtils.isNotEmpty(token)) {
|
|
@@ -194,16 +175,16 @@ public class GeoHazardMonitorTokenController {
|
|
|
baseDynamicManagement.setElectricity(reqDeviceVo.getElectricity());
|
|
|
baseDynamicManagement.setUpdateTime(new Date(reqDeviceVo.getTime()));
|
|
|
if (baseDeviceDynamicManagementService.updateById(baseDynamicManagement)) {
|
|
|
- jsonObject.put("resultCode",1);
|
|
|
- jsonObject.put("message","成功");
|
|
|
+ jsonObject.put("resultCode", 1);
|
|
|
+ jsonObject.put("message", "成功");
|
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
}
|
|
|
- jsonObject.put("resultCode",2);
|
|
|
- jsonObject.put("message","设备状态数据传输失败");
|
|
|
- return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
+ jsonObject.put("resultCode", 2);
|
|
|
+ jsonObject.put("message", "设备状态数据传输失败");
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
} else {
|
|
|
- jsonObject.put("resultCode",2);
|
|
|
- jsonObject.put("message","token验证失败");
|
|
|
+ jsonObject.put("resultCode", 2);
|
|
|
+ jsonObject.put("message", "token验证失败");
|
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
}
|
|
|
}
|