package fcb.project.manager.base.service.custom; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import fcb.project.manager.base.entity.CommonRspBean; import fcb.project.manager.base.entity.SevenTwoZeroSceneRspBean; import fcb.project.manager.core.feignInterfaces.PanoFeign; import lombok.extern.log4j.Log4j2; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import java.util.*; /** * 2 * @Author: Abner * 3 * @Date: 2021/1/26 19:09 * 4 */ @Service @Log4j2 public class PanoService { @Autowired PanoFeign panoFeign; public boolean noticeVrAuditStatus(String houseId, String token , int status){ if(StringUtils.isBlank(houseId)){ return false; } CommonRspBean rspBean = panoFeign.auditedVrNotice(houseId, status , token ); log.info("通知720VR项目审核通过,720返回结果:{}" , JSON.toJSONString(rspBean)); if(null == rspBean || null == rspBean.getCode() || rspBean.getCode().compareTo(0) != 0){ return false; } log.info("成功通知720VR项目已经审核通过"); return true; } public boolean noticeDeleteVr(String houseId, String token){ if(StringUtils.isBlank(houseId)){ return false; } CommonRspBean rspBean = panoFeign.deleteVrNotice(houseId , token); log.info("通知720删除V项目,720返回结果:{}" , JSON.toJSONString(rspBean)); if(null == rspBean || null == rspBean.getCode() || rspBean.getCode().compareTo(0) != 0){ return false; } log.info("成功通知720VR项目已经删除"); return true; } public List getKanKanSceneNums(String houseId, String token) { if (StringUtils.isBlank(houseId)) { return null; } SevenTwoZeroSceneRspBean sevenTwoZeroSceneRspBean = null; try { sevenTwoZeroSceneRspBean = panoFeign.getFdkanaknSceneNum(token , houseId , "3" , "house"); }catch (Exception e){ log.info("调用720出现异常:{}" , e); return null; } log.info("720返回结果:{}", JSON.toJSONString(sevenTwoZeroSceneRspBean)); if (null == sevenTwoZeroSceneRspBean || null == sevenTwoZeroSceneRspBean.getCode()) { log.info("720返回结果解析失败"); return null; } if (sevenTwoZeroSceneRspBean.getCode().compareTo(0) != 0) { log.info("720返回非成功:code={},msg={}", sevenTwoZeroSceneRspBean.getCode(), sevenTwoZeroSceneRspBean.getMsg()); return null; } if (CollectionUtils.isEmpty(sevenTwoZeroSceneRspBean.getData())) { log.info("720返回的list为空,无需操作"); return null; } return sevenTwoZeroSceneRspBean.getData(); } public TreeMap getHouseVrlinks(List houseIds , String token){ if(CollectionUtils.isEmpty(houseIds)){ return new TreeMap<>(); } Map body = new HashMap<>(); body.put("houseIds" , houseIds); body.put("pageNum" , 1); body.put("pageSize" , houseIds.size()); CommonRspBean rspBean = panoFeign.getVrLinks(body , token); log.info("从720获取最新vrlink的预览路径的返回值为:{}" , JSON.toJSONString(rspBean)); if(null == rspBean || null == rspBean.getCode() || rspBean.getCode() != 0){ log.info("调用720获取最新的预览路径失败"); return new TreeMap<>(); } Map jsonObject = null; try { jsonObject = (Map) rspBean.getData(); }catch (Exception e){ log.info("解析data数据失败"); return new TreeMap<>(); } if(null == jsonObject){ log.info("解析720返回的data失败"); return new TreeMap<>(); } if(!jsonObject.containsKey("list")){ log.info("解析720返回的data缺失list"); return new TreeMap<>(); } List> list = null; try { list = (List>) jsonObject.get("list"); }catch (Exception e){ log.info("720返回的data的list转换失败"); return new TreeMap<>(); } if(null == list || list.isEmpty()){ log.info("720返回的data的list为空"); return new TreeMap<>(); } TreeMap resultTree = new TreeMap<>(); for (int i = 0; i < list.size(); i++) { resultTree.putAll(list.get(i)); } return resultTree; } }