|
@@ -129,6 +129,57 @@ public class BuildSceneProgressServiceImpl implements IBuildSceneProgressService
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void onDelete(WatchEvent<?> event, Path currentPath) {
|
|
public void onDelete(WatchEvent<?> event, Path currentPath) {
|
|
|
|
+ watchMonitor.interrupt();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void onOverflow(WatchEvent<?> event, Path currentPath) {
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ watchMonitor.start();
|
|
|
|
+
|
|
|
|
+ System.out.println();
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public static void main(String[] args) {
|
|
|
|
+ File file = new File("D:\\test\\111.txt");
|
|
|
|
+ WatchMonitor watchMonitor = WatchMonitor.create(file);
|
|
|
|
+ watchMonitor.setWatcher(new Watcher(){
|
|
|
|
+
|
|
|
|
+ boolean complete = false;
|
|
|
|
+ int mainProgress = 0;
|
|
|
|
+ Long totalTime = null;//buildProgressTime
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void onCreate(WatchEvent<?> event, Path currentPath) {
|
|
|
|
+// log.info("project.json文件创建完毕");
|
|
|
|
+// String projectJsonStr = FileUtil.readUtf8String(file);
|
|
|
|
+// JSONObject projectJson = JSON.parseObject(projectJsonStr);
|
|
|
|
+// JSONObject state = projectJson.getJSONObject("state");
|
|
|
|
+// Long expectTime = state.getLong("expect_time");
|
|
|
|
+// totalTime += expectTime;
|
|
|
|
+// redisUtil.set(String.format(RedisKey.SCENE_BUILD_EXPECT_TOTAL_TIME_NUM, num), String.valueOf(totalTime), RedisKey.CAMERA_EXPIRE_7_TIME);
|
|
|
|
+// Map<String, Object> params = new HashMap<>();
|
|
|
|
+// params.put("website", website);
|
|
|
|
+// params.put("title", title);
|
|
|
|
+// params.put("customUserId",customUserId);
|
|
|
|
+// params.put("gps", gps);
|
|
|
|
+// params.put("totalTime", totalTime);
|
|
|
|
+// params.put("progress", mainProgress);
|
|
|
|
+// HttpUtil.post(buildProgressUrl, JSON.toJSONString(params), 2000);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void onModify(WatchEvent<?> event, Path currentPath) {
|
|
|
|
+ System.out.println("文件修改了");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void onDelete(WatchEvent<?> event, Path currentPath) {
|
|
|
|
+ System.out.println("文件删除了");
|
|
|
|
+ watchMonitor.interrupt();
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|