|
@@ -1,8 +1,10 @@
|
|
|
package com.fdkankan.manage_jp.task;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fdkankan.manage_jp.entity.Project;
|
|
|
import com.fdkankan.manage_jp.entity.ProjectSceneGps;
|
|
|
import com.fdkankan.manage_jp.entity.ScenePlus;
|
|
|
+import com.fdkankan.manage_jp.httpClient.service.LaserService;
|
|
|
import com.fdkankan.manage_jp.service.IProjectSceneGpsService;
|
|
|
import com.fdkankan.manage_jp.vo.response.SceneGpsDb;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -12,7 +14,9 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
|
@Slf4j
|
|
@@ -20,6 +24,8 @@ public class TaskService {
|
|
|
|
|
|
@Autowired
|
|
|
IProjectSceneGpsService projectSceneGpsService;
|
|
|
+ @Autowired
|
|
|
+ LaserService laserService;
|
|
|
|
|
|
|
|
|
@Scheduled(initialDelay = 2000, fixedDelay = 1000 * 60 )
|
|
@@ -29,15 +35,33 @@ public class TaskService {
|
|
|
log.info("没有需要更新GPS数据的场景");
|
|
|
}
|
|
|
|
|
|
- List<ProjectSceneGps> list = new ArrayList<>();
|
|
|
+ List<ProjectSceneGps> pluslist = new ArrayList<>();
|
|
|
+ List<ProjectSceneGps> laserList = new ArrayList<>();
|
|
|
for (SceneGpsDb sceneGpsDb : numList) {
|
|
|
ProjectSceneGps sceneGps = projectSceneGpsService.addGps(sceneGpsDb);
|
|
|
if(sceneGps != null){
|
|
|
log.info("num:{}gps:{}",sceneGpsDb.getNum(),sceneGps);
|
|
|
- list.add(sceneGps);
|
|
|
+ if(sceneGps.getSceneSource() == 4 || sceneGps.getSceneSource() == 5){
|
|
|
+ laserList.add(sceneGps);
|
|
|
+ }else {
|
|
|
+ pluslist.add(sceneGps);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(!pluslist.isEmpty()){
|
|
|
+ projectSceneGpsService.saveBatch(pluslist);
|
|
|
+ }
|
|
|
+ if(!laserList.isEmpty()){
|
|
|
+ List<String> numList1 = laserList.stream().map(ProjectSceneGps::getNum).collect(Collectors.toList());
|
|
|
+ HashMap<String, JSONObject> ssSceneMap = laserService.list(numList1, null);
|
|
|
+ for (ProjectSceneGps sceneGps : laserList) {
|
|
|
+ JSONObject ssObj = ssSceneMap.get(sceneGps.getNum());
|
|
|
+ if(ssObj!=null){
|
|
|
+ sceneGps.setWebSite(ssObj.getString("webSite"));
|
|
|
+ }
|
|
|
}
|
|
|
+ projectSceneGpsService.saveBatch(laserList);
|
|
|
}
|
|
|
- projectSceneGpsService.saveBatch(list);
|
|
|
|
|
|
}
|
|
|
}
|