|
@@ -11,6 +11,7 @@ import com.huimv.common.utils.StringUtilsWork;
|
|
|
import com.huimv.video.dhicc.icc.CommonConstant;
|
|
|
import com.huimv.video.dhicc.result.R;
|
|
|
import com.huimv.video.dhicc.service.IClientAllEventService;
|
|
|
+import com.huimv.video.dhicc.util.GetResponse;
|
|
|
import net.sf.json.JSONObject;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
@@ -75,15 +76,15 @@ public class ClientAllEventServiceImpl implements IClientAllEventService {
|
|
|
return getSellPigsChannel(paramsMap);
|
|
|
case 6:
|
|
|
//人员门禁事件
|
|
|
- paramsMap.put("startSwingTime",startDateText);
|
|
|
- paramsMap.put("endSwingTime",endDateText);
|
|
|
+ paramsMap.put("alarmStartDateString",startDateText);
|
|
|
+ paramsMap.put("alarmEndDateString",endDateText);
|
|
|
paramsMap.put("openType",61);
|
|
|
System.out.println("人员门禁事件输入参数>>"+paramsMap.toString());
|
|
|
return getEntranceGuard(paramsMap);
|
|
|
default:
|
|
|
//车辆闸机事件
|
|
|
System.out.println("车辆闸机事件输入参数>>"+paramsMap.toString());
|
|
|
- return getCarGateMachine(request,paramsMap);
|
|
|
+ return getCarAutoGate(request,paramsMap);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -123,8 +124,18 @@ public class ClientAllEventServiceImpl implements IClientAllEventService {
|
|
|
|
|
|
//人员门禁事件
|
|
|
private R getEntranceGuard(Map<String, Object> paramsMap) throws ClientException {
|
|
|
+ String total = SendMassageGetPagePersonAlarm(paramsMap.get("alarmStartDateString").toString(),paramsMap.get("alarmEndDateString").toString());
|
|
|
+ if(total == null){
|
|
|
+ total = "0";
|
|
|
+ }
|
|
|
+ System.out.println("################### total>>"+total);
|
|
|
+// GeneralResponse gr = getAccidentRecord1(paramsMap);
|
|
|
+// com.alibaba.fastjson.JSONObject.toJSONString(gr);
|
|
|
+// com.alibaba.fastjson.JSONObject grJo = JSON.parseObject(JSON.toJSONString(getAccidentRecord1(paramsMap)));
|
|
|
+// com.alibaba.fastjson.JSONObject resultJo = grJo.getJSONObject("result");
|
|
|
+// System.out.println("resultJo>>"+resultJo);
|
|
|
//
|
|
|
- return R.ok("请求成功").put("data", getAccidentRecord1(paramsMap)).put("total", parseTotal(get_person_record_totalpage(paramsMap).toString())).put("isVideo",false);
|
|
|
+ return R.ok("请求成功").put("data", getAccidentRecord1(paramsMap)).put("total", Integer.parseInt(total)).put("isVideo",false);
|
|
|
}
|
|
|
|
|
|
//解析总页码
|
|
@@ -135,10 +146,29 @@ public class ClientAllEventServiceImpl implements IClientAllEventService {
|
|
|
}
|
|
|
|
|
|
//车辆闸机事件
|
|
|
- private R getCarGateMachine(HttpServletRequest request, Map<String, Object> paramsMap) throws ClientException {
|
|
|
+ private R getCarAutoGate(HttpServletRequest request, Map<String, Object> paramsMap) throws ClientException {
|
|
|
+ Integer farmId= (int) paramsMap.get("farmId");
|
|
|
+// JSONObject carJo = JSONObject.fromObject(getCarRecord(request,farmId));
|
|
|
+// String resultText = carJo.getString("result");
|
|
|
+// String dataText = JSON.parseObject(resultText).getString("data");
|
|
|
+// String totalRowsText = JSON.parseObject(dataText).getString("totalRows");
|
|
|
+ GeneralResponse grObj = getCarRecord(request,farmId);
|
|
|
+ com.alibaba.fastjson.JSONObject grJo = JSON.parseObject(com.alibaba.fastjson.JSONObject.toJSONString(grObj));
|
|
|
+ com.alibaba.fastjson.JSONObject resultJo = grJo.getJSONObject("result");
|
|
|
+ com.alibaba.fastjson.JSONObject dataJo = resultJo.getJSONObject("data");
|
|
|
+ String totalRowsText = dataJo.getString("totalRows");
|
|
|
+ resultJo.put("total",Integer.parseInt(totalRowsText));
|
|
|
+ return R.ok("请求成功").put("data", grObj).put("total",Integer.parseInt(totalRowsText)).put("isVideo",false);
|
|
|
+ }
|
|
|
+
|
|
|
+ private R getCarAutoGate_old1(HttpServletRequest request, Map<String, Object> paramsMap) throws ClientException {
|
|
|
Integer farmId= (int) paramsMap.get("farmId");
|
|
|
+ JSONObject carJo = JSONObject.fromObject(getCarRecord(request,farmId));
|
|
|
+ String resultText = carJo.getString("result");
|
|
|
+ String dataText = JSON.parseObject(resultText).getString("data");
|
|
|
+ String totalRowsText = JSON.parseObject(dataText).getString("totalRows");
|
|
|
//
|
|
|
- return R.ok("请求成功").put("data", getCarRecord(request,farmId)).put("isVideo",false);
|
|
|
+ return R.ok("请求成功").put("data", resultText).put("total",Integer.parseInt(totalRowsText)).put("isVideo",false);
|
|
|
}
|
|
|
|
|
|
//查询车辆通行记录 by Yangdi
|
|
@@ -272,14 +302,20 @@ public class ClientAllEventServiceImpl implements IClientAllEventService {
|
|
|
return generalResponse;
|
|
|
}
|
|
|
|
|
|
- //人员通道查询总页数 by Yangdi
|
|
|
- @RequestMapping("/get_person_record_totalpage")
|
|
|
- public GeneralResponse get_person_record_totalpage( @RequestBody Map<String, Object> params ) throws ClientException {
|
|
|
- Integer farmId= (int) params.get("farmId");
|
|
|
- if(farmId!=1){
|
|
|
- //返回为空数据
|
|
|
- return new GeneralResponse() ;
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * //查人员通过过去几个小时的接口---异常通过次数接口
|
|
|
+ * @param begin 开始时间
|
|
|
+ * @param end 结束时间
|
|
|
+ * @return
|
|
|
+ * @throws ClientException
|
|
|
+ */
|
|
|
+ public String SendMassageGetPagePersonAlarm(String begin, String end ) throws ClientException {
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
+ params.put("startSwingTime",begin);
|
|
|
+ params.put("endSwingTime",end);
|
|
|
+ params.put("containDomain","1");
|
|
|
+ params.put("openResult",0);
|
|
|
+ System.out.println("内部参数>>"+params);
|
|
|
String URL = "/evo-apigw/evo-accesscontrol/1.0.0/card/accessControl/swingCardRecord/bycondition/combinedCount?systime="; //获取事件URL post请求
|
|
|
IClient iClient = new DefaultClient();
|
|
|
String timestamp = String.valueOf((new Date()).getTime());
|
|
@@ -296,6 +332,82 @@ public class ClientAllEventServiceImpl implements IClientAllEventService {
|
|
|
//发起请求处理应答
|
|
|
GeneralResponse generalResponse = iClient.doAction(generalRequest, generalRequest.getResponseClass());
|
|
|
System.out.println("执行结束");
|
|
|
- return generalResponse;
|
|
|
+ JSONObject jsonObject = JSONObject.fromObject(generalResponse.getResult());
|
|
|
+ Object data = jsonObject.get("data");
|
|
|
+ System.out.println("## 内部打印结果>>"+data);
|
|
|
+ return data.toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ //人员通道查询总页数 by Yangdi
|
|
|
+// @RequestMapping("/get_person_record_totalpage")
|
|
|
+// public GeneralResponse get_person_record_totalpage( @RequestBody Map<String, Object> params ) throws ClientException {
|
|
|
+// Integer farmId= (int) params.get("farmId");
|
|
|
+// if(farmId!=1){
|
|
|
+// //返回为空数据
|
|
|
+// return new GeneralResponse() ;
|
|
|
+// }
|
|
|
+// String URL = "/evo-apigw/evo-accesscontrol/1.0.0/card/accessControl/swingCardRecord/bycondition/combinedCount?systime="; //获取事件URL post请求
|
|
|
+// IClient iClient = new DefaultClient();
|
|
|
+// String timestamp = String.valueOf((new Date()).getTime());
|
|
|
+// Long aLong = Long.valueOf(timestamp);
|
|
|
+// String NewUrl = URL + aLong;
|
|
|
+// System.out.println("开始执行");
|
|
|
+// //这种已经在配置文件里面安排了账号ip以及密码
|
|
|
+// GeneralRequest generalRequest = new GeneralRequest(NewUrl, Method.POST);
|
|
|
+// System.out.println(NewUrl);
|
|
|
+// generalRequest.header("Content-Type", " application/json");
|
|
|
+// System.out.println(JSON.toJSONString(params));
|
|
|
+// //里面是
|
|
|
+// generalRequest.body(JSON.toJSONString(params));
|
|
|
+// //发起请求处理应答
|
|
|
+// GeneralResponse generalResponse = iClient.doAction(generalRequest, generalRequest.getResponseClass());
|
|
|
+// System.out.println("执行结束");
|
|
|
+// return generalResponse;
|
|
|
+// }
|
|
|
+
|
|
|
+ public static void main(String[] args) throws ClientException {
|
|
|
+
|
|
|
+ Map<String, Object> params1 =new HashMap<>();
|
|
|
+
|
|
|
+ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ Calendar c = Calendar.getInstance();
|
|
|
+ Date date = new Date();
|
|
|
+ c.setTime(date);
|
|
|
+ c.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
+ c.set(Calendar.MINUTE, 0);
|
|
|
+ c.set(Calendar.SECOND, 0);
|
|
|
+ //调整天数
|
|
|
+ c.add(Calendar.DATE,0);
|
|
|
+ Date A = c.getTime();
|
|
|
+ String formatA = format.format(A);
|
|
|
+ c.set(Calendar.HOUR, +24);
|
|
|
+ Date d = c.getTime();
|
|
|
+ String formatD = format.format(d);
|
|
|
+ System.out.println(formatA+formatD);
|
|
|
+
|
|
|
+ System.out.println("formatA>>"+formatA);
|
|
|
+ System.out.println("formatD>>"+formatD);
|
|
|
+
|
|
|
+ params1.put("pageNum",1);
|
|
|
+ params1.put("pageSize",20);
|
|
|
+ params1.put("startSwingTime",formatA);
|
|
|
+ params1.put("endSwingTime",formatD);
|
|
|
+// params1.put("startSwingTime","2021-12-24 00:00:00");
|
|
|
+// params1.put("endSwingTime","2021-12-24 23:59:59");
|
|
|
+
|
|
|
+ params1.put("containDomain","1");
|
|
|
+ params1.put("openResult",0); //刷脸失败
|
|
|
+ String URL = "/evo-apigw/evo-accesscontrol/1.0.0/card/accessControl/swingCardRecord/bycondition/combined?systime=";
|
|
|
+ IClient iClient = new DefaultClient();
|
|
|
+ GeneralRequest generalRequest = new GeneralRequest(URL + Long.valueOf(String.valueOf((new Date()).getTime())), Method.POST);
|
|
|
+ generalRequest.header("Content-Type", " application/json");
|
|
|
+ generalRequest.body(JSON.toJSONString(params1));
|
|
|
+ GeneralResponse generalResponse = iClient.doAction(generalRequest, generalRequest.getResponseClass());
|
|
|
+ JSONObject jsonObject = JSONObject.fromObject(generalResponse.getResult());
|
|
|
+ GetResponse getResponse = new GetResponse();
|
|
|
+
|
|
|
+ System.out.println("total>>"+getResponse.SendMassageGetPagePersonAlarm((String) params1.get("startSwingTime"),(String) params1.get("endSwingTime")));
|
|
|
+ System.out.println(jsonObject.toString());
|
|
|
+
|
|
|
}
|
|
|
}
|