|
@@ -1,5 +1,6 @@
|
|
|
package org.dromara.util;
|
|
package org.dromara.util;
|
|
|
|
|
|
|
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.util.CharsetUtil;
|
|
import cn.hutool.core.util.CharsetUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.json.JSON;
|
|
import cn.hutool.json.JSON;
|
|
@@ -145,7 +146,27 @@ public class CamelDataUtil {
|
|
|
//靠近站点 还得计算当前是否跨站点
|
|
//靠近站点 还得计算当前是否跨站点
|
|
|
String stationName = RedisUtils.getCacheObject(StringUtils.format("car_{}_{}_tip",carInfoVo1.getCarNum(),DateFormatUtils.format( scheduleVo.getScheduleDate(),DateUtils.YYYYMMDDHHMMSS) ));
|
|
String stationName = RedisUtils.getCacheObject(StringUtils.format("car_{}_{}_tip",carInfoVo1.getCarNum(),DateFormatUtils.format( scheduleVo.getScheduleDate(),DateUtils.YYYYMMDDHHMMSS) ));
|
|
|
if(stationName!=null && stationName.contains(jsonObject.getStr("stationName"))){
|
|
if(stationName!=null && stationName.contains(jsonObject.getStr("stationName"))){
|
|
|
- //提报过的不再提报
|
|
|
|
|
|
|
+ //提报过的不再提报 //离开站记录时间
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ if (scheduleVo.getExt1() != null) {
|
|
|
|
|
+ //进站点 记录时间
|
|
|
|
|
+ JSONObject datainout = new JSONObject();
|
|
|
|
|
+ datainout = JSONUtil.parseObj(scheduleVo.getExt1());
|
|
|
|
|
+ if (datainout.get(jsonObject.getStr("stationName")) != null) {
|
|
|
|
|
+ JSONObject inout = datainout.getJSONObject(jsonObject.getStr("stationName"));
|
|
|
|
|
+ if (inout.getStr("outtime") == null) {
|
|
|
|
|
+ inout.set("outtime", DateUtil.now());
|
|
|
|
|
+ }
|
|
|
|
|
+ datainout.set(jsonObject.getStr("stationName"), inout);
|
|
|
|
|
+ scheduleVo.setExt1(JSONUtil.toJsonStr(datainout));
|
|
|
|
|
+ TblCarScheduleBo scheduleVo1 = new TblCarScheduleBo();
|
|
|
|
|
+ scheduleVo1.setId(scheduleVo.getId());
|
|
|
|
|
+ scheduleVo1.setExt1(scheduleVo.getExt1());
|
|
|
|
|
+ tblCarScheduleService.updateByBo(scheduleVo1);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }catch (Exception e){}
|
|
|
}else{
|
|
}else{
|
|
|
lines1.add(jsonObject);
|
|
lines1.add(jsonObject);
|
|
|
}
|
|
}
|
|
@@ -171,6 +192,23 @@ public class CamelDataUtil {
|
|
|
sysDictData.setDictType("tbl_sites");
|
|
sysDictData.setDictType("tbl_sites");
|
|
|
List<SysDictDataVo> stations = sysDictDataService.selectDictDataList(sysDictData);
|
|
List<SysDictDataVo> stations = sysDictDataService.selectDictDataList(sysDictData);
|
|
|
if(stations.size()>0){
|
|
if(stations.size()>0){
|
|
|
|
|
+ try{
|
|
|
|
|
+ //进站点 记录时间
|
|
|
|
|
+ JSONObject datainout = new JSONObject();
|
|
|
|
|
+ if(scheduleVo.getExt1()!=null){
|
|
|
|
|
+ datainout = JSONUtil.parseObj(scheduleVo.getExt1());
|
|
|
|
|
+ }
|
|
|
|
|
+ JSONObject inout = new JSONObject();
|
|
|
|
|
+ inout.set("intime", DateUtil.now());
|
|
|
|
|
+ datainout.set(stations.get(0).getDictLabel(),inout);
|
|
|
|
|
+ scheduleVo.setExt1(JSONUtil.toJsonStr(datainout));
|
|
|
|
|
+ TblCarScheduleBo scheduleVo1 = new TblCarScheduleBo();
|
|
|
|
|
+ scheduleVo1.setId(scheduleVo.getId());
|
|
|
|
|
+ scheduleVo1.setExt1(scheduleVo.getExt1());
|
|
|
|
|
+ tblCarScheduleService.updateByBo(scheduleVo1);
|
|
|
|
|
+ }catch (Exception e){}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
//满足条件播报(led or 广播)
|
|
//满足条件播报(led or 广播)
|
|
|
String message = StringUtils.format("{}即将到达{},即将到达,请准备接货。", carInfoVo1.getCarNum(),stations.get(0).getDictLabel());
|
|
String message = StringUtils.format("{}即将到达{},即将到达,请准备接货。", carInfoVo1.getCarNum(),stations.get(0).getDictLabel());
|
|
|
if(StringUtils.isNotEmpty(stations.get(0).getRemark())){
|
|
if(StringUtils.isNotEmpty(stations.get(0).getRemark())){
|
|
@@ -255,14 +293,20 @@ public class CamelDataUtil {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
iCreatedTime = ((JSONObject)(countdata.getJSONArray("data").get(0))).getLong("iCreatedTime");
|
|
iCreatedTime = ((JSONObject)(countdata.getJSONArray("data").get(0))).getLong("iCreatedTime");
|
|
|
|
|
+ if(iCreatedTime*1000>DateUtil.current()-24*3600*1000 && iCreatedTime*1000<DateUtil.current()+24*3600*1000){
|
|
|
|
|
+ //正确的时间
|
|
|
|
|
+ CountData countData = new CountData();
|
|
|
|
|
+ countData.setIncount(in);
|
|
|
|
|
+ countData.setOutcount(out);
|
|
|
|
|
+ countData.setDevicecode(sn);
|
|
|
|
|
+ countData.setTslong(iCreatedTime*1000);
|
|
|
|
|
+ countDataService.insertData(countData);
|
|
|
|
|
+ }else{
|
|
|
|
|
+ log.error("{}:时间错误",iCreatedTime);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
//存储数据
|
|
//存储数据
|
|
|
- log.info("{},{},{},{},{}",sn,type,in,out,iCreatedTime);
|
|
|
|
|
- CountData countData = new CountData();
|
|
|
|
|
- countData.setIncount(in);
|
|
|
|
|
- countData.setOutcount(out);
|
|
|
|
|
- countData.setDevicecode(sn);
|
|
|
|
|
- countData.setTslong(iCreatedTime*1000);
|
|
|
|
|
- countDataService.insertData(countData);
|
|
|
|
|
|
|
+// log.info("{},{},{},{},{}",sn,type,in,out,iCreatedTime);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|