Commit 72300c71 by 刘宇峰

预留围栏同步口子

1 parent 7e3d9d5e
...@@ -119,10 +119,17 @@ public class ElectricFenceController { ...@@ -119,10 +119,17 @@ public class ElectricFenceController {
return R.ok(); return R.ok();
} }
@GetMapping(value = "/syncalldata")
@ApiOperation(value = "同步全部围栏到数据侧")
public R syncAllData() {
electricFenceService.syncAllFences();
return R.ok();
}
@GetMapping(value = "/syncdata") @GetMapping(value = "/syncdata")
@ApiOperation(value = "同步围栏到数据侧") @ApiOperation(value = "同步围栏到数据侧")
public R syncData() { public R syncData(@RequestParam("fenceId") Long fenceId) {
electricFenceService.syncFences(); electricFenceService.syncFence(fenceId);
return R.ok(); return R.ok();
} }
......
...@@ -567,7 +567,7 @@ public class ElectricFenceService { ...@@ -567,7 +567,7 @@ public class ElectricFenceService {
electricFenceSnsMapper.logicDeleteByFenceId(fenceId); electricFenceSnsMapper.logicDeleteByFenceId(fenceId);
} }
public void syncFences() { public void syncAllFences() {
List<ElectricFence> fenceList = electricFenceMapper.selectAllNotDel(); List<ElectricFence> fenceList = electricFenceMapper.selectAllNotDel();
fenceList.forEach(fence -> { fenceList.forEach(fence -> {
System.out.println(JSON.toJSONString(fence)); System.out.println(JSON.toJSONString(fence));
...@@ -575,4 +575,12 @@ public class ElectricFenceService { ...@@ -575,4 +575,12 @@ public class ElectricFenceService {
}); });
} }
public void syncFence(Long fenceId) {
ElectricFence fence = electricFenceMapper.selectById(fenceId);
if (fence != null) {
System.out.println(JSON.toJSONString(fence));
eFenceComponent.addElectricFence(fence);
}
}
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!