|
@@ -6,9 +6,14 @@ import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fdkankan.manage.common.PageInfo;
|
|
|
import com.fdkankan.manage.common.ResultData;
|
|
|
+import com.fdkankan.manage.entity.ScenePlus;
|
|
|
+import com.fdkankan.manage.entity.ScenePlusExt;
|
|
|
import com.fdkankan.manage.httpClient.client.OverallClient;
|
|
|
import com.fdkankan.manage.httpClient.vo.OverallParam;
|
|
|
import com.fdkankan.manage.httpClient.vo.OverallVo;
|
|
|
+import com.fdkankan.manage.service.ICommonService;
|
|
|
+import com.fdkankan.manage.service.IScenePlusExtService;
|
|
|
+import com.fdkankan.manage.service.IScenePlusService;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
@@ -18,7 +23,9 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 全景看看作品
|
|
@@ -31,12 +38,41 @@ public class OverallController {
|
|
|
private static String key ="appId";
|
|
|
|
|
|
@Autowired
|
|
|
- OverallClient overallClient;
|
|
|
+ OverallClient overallClient;
|
|
|
+ @Autowired
|
|
|
+ IScenePlusService scenePlusService;
|
|
|
+ @Autowired
|
|
|
+ IScenePlusExtService scenePlusExtService;
|
|
|
+ @Autowired
|
|
|
+ ICommonService commonService;
|
|
|
|
|
|
@PostMapping("/list")
|
|
|
public ResultData list(@RequestBody OverallParam param){
|
|
|
+ OverallVo vo = overallClient.list(param,appId,key);
|
|
|
+ if(vo.getCode() != 0 ){
|
|
|
+ return ResultData.error(vo.getCode(),vo.getMsg());
|
|
|
+ }
|
|
|
+ Object data = vo.getData();
|
|
|
+ JSONObject dataObj = JSONObject.parseObject(JSONObject.toJSONString(data));
|
|
|
+ JSONArray array = dataObj.getJSONArray("list");
|
|
|
+ for (Object o : array) {
|
|
|
+ JSONObject obj = (JSONObject) o;
|
|
|
+ obj.put("thumb",obj.getString("share"));
|
|
|
+ obj.put("sceneCodes",obj.getString("id"));
|
|
|
+ String name = obj.getString("name");
|
|
|
+ if(StringUtils.isBlank(name)){
|
|
|
+ name = "无标题";
|
|
|
+ }
|
|
|
+ obj.put("name",name);
|
|
|
+ }
|
|
|
+ List<Object> list = new ArrayList<>(array);
|
|
|
+ long total = dataObj.getLongValue("total");
|
|
|
+ return ResultData.ok(new PageInfo<>(param.getPageNum(), param.getPageSize(), total, list));
|
|
|
+ }
|
|
|
|
|
|
-
|
|
|
+ @PostMapping("/cameraSceneList")
|
|
|
+ public ResultData cameraSceneList(@RequestBody OverallParam param){
|
|
|
+ param.setType(2);
|
|
|
OverallVo vo = overallClient.list(param,appId,key);
|
|
|
if(vo.getCode() != 0 ){
|
|
|
return ResultData.error(vo.getCode(),vo.getMsg());
|
|
@@ -44,6 +80,15 @@ public class OverallController {
|
|
|
Object data = vo.getData();
|
|
|
JSONObject dataObj = JSONObject.parseObject(JSONObject.toJSONString(data));
|
|
|
JSONArray array = dataObj.getJSONArray("list");
|
|
|
+ List<JSONObject> collect = array.stream().map(e -> (JSONObject) e).collect(Collectors.toList());
|
|
|
+ List<String> numList = collect.stream().map(e -> e.getString("num")).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ScenePlus> scenePluses = scenePlusService.getByNumList(numList);
|
|
|
+ List<Long> plusIds = scenePluses.stream().map(ScenePlus::getId).collect(Collectors.toList());
|
|
|
+ HashMap<Long, ScenePlusExt> extMap = scenePlusExtService.getByPlusIds(plusIds);
|
|
|
+ HashMap<String, ScenePlus> plusMap = new HashMap<>();
|
|
|
+ scenePluses.forEach( e -> plusMap.put(e.getNum(),e));
|
|
|
+
|
|
|
for (Object o : array) {
|
|
|
JSONObject obj = (JSONObject) o;
|
|
|
obj.put("thumb",obj.getString("share"));
|
|
@@ -53,6 +98,18 @@ public class OverallController {
|
|
|
name = "无标题";
|
|
|
}
|
|
|
obj.put("name",name);
|
|
|
+
|
|
|
+ String num = obj.getString("num");
|
|
|
+ ScenePlus scenePlus = plusMap.get(num);
|
|
|
+ if(scenePlus != null){
|
|
|
+ ScenePlusExt ext = extMap.get(scenePlus.getId());
|
|
|
+ if(ext != null){
|
|
|
+ obj.put("algorithmTime",ext.getAlgorithm());
|
|
|
+ obj.put("gps",ext.getGps());
|
|
|
+ obj.put("addressComponent",commonService.getAddressComponent(ext.getGps()));
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
List<Object> list = new ArrayList<>(array);
|
|
|
long total = dataObj.getLongValue("total");
|