Commit bab8467c by levphon

修复设备状态查询bug

1 parent 17c4fc7e
......@@ -12,6 +12,7 @@ import cn.com.glsx.admin.modules.service.ElectricFenceService;
import cn.com.glsx.admin.modules.service.VehicleService;
import com.alibaba.excel.EasyExcel;
import com.github.pagehelper.PageInfo;
import com.glsx.plat.common.annotation.NoResubmit;
import com.glsx.plat.common.annotation.SysLog;
import com.glsx.plat.common.enums.OperateType;
import com.glsx.plat.common.utils.DateUtils;
......@@ -66,6 +67,7 @@ public class ElectricFenceController extends AbstractController {
* @param fenceBO
* @return
*/
@NoResubmit
@SysLog(module = MODULE, value = "新增围栏", action = OperateType.ADD)
@PostMapping(value = "/add")
@ApiOperation(value = "新增围栏")
......@@ -80,6 +82,7 @@ public class ElectricFenceController extends AbstractController {
* @param fenceBO
* @return
*/
@NoResubmit
@SysLog(module = MODULE, value = "编辑围栏", action = OperateType.EDIT)
@PostMapping(value = "/edit")
@ApiOperation(value = "编辑围栏")
......
......@@ -494,7 +494,7 @@
tv.vehicle_usages vehicleUsages,
tvd.created_date activateTime,
ddf.`status` AS freqStatus,
tu.username creator,
concat(tdept.department_name,'/',tu.username) creator,
tv.created_by createdBy
from t_vehicle tv
left join t_vehicle_device tvd on tvd.vehicle_id = tv.id
......@@ -502,6 +502,7 @@
left join t_device td on td.sn = tvd.sn
left join t_device_location tdl on tdl.sn = tvd.sn
left join t_user tu on tu.id = tv.created_by
left join t_department tdept on tdept.id = tu.department_id
left join (select vehicle_id, sn, status from (SELECT * FROM t_device_freq order by created_date desc) temp GROUP BY temp.sn) ddf on ddf.vehicle_id = tv.id and ddf.sn =
td.sn
where tv.del_flag = 0
......@@ -537,12 +538,12 @@
<if test="deviceState != null">
<choose>
<when test="deviceState == 0"> <!-- 行驶中-->
and (td.source=1) and speed>0 and ((timestampdiff(SECOND,tdl.last_gps_time,now())) <![CDATA[<]]> 360 or (timestampdiff(SECOND,tdl.last_bs_time,now()))
<![CDATA[<]]> 360)
and (td.source=1) and ((timestampdiff(SECOND,tdl.last_gps_time,now())) <![CDATA[<]]> 360 or (timestampdiff(SECOND,tdl.last_bs_time,now())) <![CDATA[<]]> 360)
and tdl.stay_status = 2
</when>
<when test="deviceState == 1"> <!-- 静止-->
and (td.source=1) and (speed=0 or speed is null) and ((timestampdiff(SECOND,tdl.last_gps_time,now())) <![CDATA[<]]> 360 or
(timestampdiff(SECOND,tdl.last_bs_time,now())) <![CDATA[<]]> 360)
and (td.source=1) and ((timestampdiff(SECOND,tdl.last_gps_time,now())) <![CDATA[<]]> 360 or (timestampdiff(SECOND,tdl.last_bs_time,now())) <![CDATA[<]]> 360)
and (tdl.stay_status is null or tdl.stay_status = 1)
</when>
<when test="deviceState == 2"> <!-- 离线-->
and ((timestampdiff(SECOND, tdl.last_gps_time, now()) &gt; #{offlineTime} and timestampdiff(SECOND, tdl.last_bs_time, now()) &gt; #{offlineTime})
......@@ -585,7 +586,7 @@
ddf.timer AS timer,
ddf.`week` AS `week`,
ddf.week_timer AS weekTimer,
tu.username creator,
concat(tdept.department_name,'/',tu2.username) creator,
tu.username,
tu.account operation
from t_vehicle tv
......@@ -595,6 +596,8 @@
left join t_device_location tdl on tdl.sn = tvd.sn
left join (select * from (SELECT * FROM t_device_freq order by created_date desc) temp GROUP BY temp.sn) ddf on ddf.vehicle_id = tv.id and ddf.sn = td.sn
left join t_user tu on tu.id = ddf.created_by
left join t_user tu2 on tu2.id = tv.created_by
left join t_department tdept on tdept.id = tu2.department_id
where tv.del_flag = 0
and tvd.bind_status = 1
and tvd.del_flag = 0
......@@ -628,12 +631,12 @@
<if test="deviceState != null">
<choose>
<when test="deviceState == 0"> <!-- 行驶中-->
and (td.source=1) and speed>0 and ((timestampdiff(SECOND,tdl.last_gps_time,now())) <![CDATA[<]]> 360 or (timestampdiff(SECOND,tdl.last_bs_time,now()))
<![CDATA[<]]> 360)
and (td.source=1) and ((timestampdiff(SECOND,tdl.last_gps_time,now())) <![CDATA[<]]> 360 or (timestampdiff(SECOND,tdl.last_bs_time,now())) <![CDATA[<]]> 360)
and tdl.stay_status = 2
</when>
<when test="deviceState == 1"> <!-- 静止-->
and (td.source=1) and (speed=0 or speed is null) and ((timestampdiff(SECOND,tdl.last_gps_time,now())) <![CDATA[<]]> 360 or
(timestampdiff(SECOND,tdl.last_bs_time,now())) <![CDATA[<]]> 360)
and (td.source=1) and ((timestampdiff(SECOND,tdl.last_gps_time,now())) <![CDATA[<]]> 360 or (timestampdiff(SECOND,tdl.last_bs_time,now())) <![CDATA[<]]> 360)
and (tdl.stay_status is null or tdl.stay_status = 1)
</when>
<when test="deviceState == 2"> <!-- 离线-->
and ((timestampdiff(SECOND, tdl.last_gps_time, now()) &gt; #{offlineTime} and timestampdiff(SECOND, tdl.last_bs_time, now()) &gt; #{offlineTime})
......
......@@ -77,7 +77,7 @@ public class ElectricFenceServiceTest {
for (int i = 1; i <= 1000; i++) {
ElectricFenceBO fenceBO = new ElectricFenceBO();
fenceBO.setFenceName(i + "警情围栏" + batchNumber);
fenceBO.setBizFenceType(1);
fenceBO.setBizFenceType(14);
fenceBO.setTriggerType(i % 2 == 0 ? 1 : 2);
fenceBO.setTimeType(1);
fenceBO.setStartTime(new Date());
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!