|
@@ -6,6 +6,8 @@ import cn.hutool.core.io.FileUtil;
|
|
|
import cn.hutool.core.io.file.FileNameUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.core.util.ZipUtil;
|
|
|
+import cn.hutool.extra.qrcode.QrCodeUtil;
|
|
|
+import cn.hutool.extra.qrcode.QrConfig;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
@@ -108,6 +110,9 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
|
@Autowired
|
|
|
private IIncrementTypeService incrementTypeService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ICompanyService companyService;
|
|
|
+
|
|
|
@Override
|
|
|
public void buildScenePre(BuildSceneCallMessage message) {
|
|
|
boolean success = false;
|
|
@@ -222,16 +227,6 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
|
SceneEditInfoExt sceneEditInfoExt = (SceneEditInfoExt)editInfoArr[1];
|
|
|
SceneEditControls sceneEditControls = (SceneEditControls)editInfoArr[2];
|
|
|
|
|
|
- String outPathZh = ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+sceneCode+".png";
|
|
|
- String outPathEn = ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+sceneCode+"_en.png";
|
|
|
- //生成新的分享的二维码-中文版本
|
|
|
- MatrixToImageWriterUtil.createQRCode(scenePlusExt.getWebSite(), outPathZh, false,null);
|
|
|
- //生成新的分享的二维码-英文版本
|
|
|
- MatrixToImageWriterUtil.createQRCode(scenePlusExt.getWebSite() + "&lang=en", outPathEn, false, null);
|
|
|
- //上传二维码
|
|
|
- fYunFileService.uploadFile(outPathZh, String.format(UploadFilePath.DOWNLOADS_QRCODE, sceneCode) + sceneCode + ".png");
|
|
|
- fYunFileService.uploadFile(outPathEn, String.format(UploadFilePath.DOWNLOADS_QRCODE, sceneCode) + sceneCode + "_en.png");
|
|
|
-
|
|
|
//上传全景图俯视图
|
|
|
this.uploadFloorCad(path, sceneCode, uploadFiles);
|
|
|
|
|
@@ -441,6 +436,8 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
|
String sceneJsonKey = dataViewPath + "scene.json";
|
|
|
boolean exist = fYunFileService.fileExist(sceneJsonKey);
|
|
|
//如果云端没有scene.json文件,生成一份
|
|
|
+ String qrLogo = null;
|
|
|
+
|
|
|
if(!exist){
|
|
|
SceneJsonBean sceneJson = new SceneJsonBean();
|
|
|
BeanUtil.copyProperties(sceneEditInfoExt, sceneJson);
|
|
@@ -455,12 +452,35 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
|
if(arrearCap) {
|
|
|
sceneJson.setPayStatus(PayStatus.NO_CAPACITY.code());
|
|
|
}
|
|
|
+ // 获取企业logo
|
|
|
+ CameraDetail cameraDetail = cameraDetailService.getByCameraId(scenePlus.getCameraId());
|
|
|
+ if(!ObjectUtils.isEmpty(cameraDetail.getCompanyId())){
|
|
|
+ String userViewPath = String.format(UploadFilePath.USER_VIEW_PATH, num);
|
|
|
+ Company company = companyService.getById(cameraDetail.getCompanyId());
|
|
|
+ if (StrUtil.isNotEmpty(company.getTopLogo())) {
|
|
|
+ fYunFileService.copyFileInBucket(company.getTopLogo(),userViewPath + "loadingLogo-user.png");
|
|
|
+ sceneJson.setFloorLogo("user");
|
|
|
+ sceneJson.setFloorLogoFile("loadingLogo-user.png");
|
|
|
+ }
|
|
|
+ if (StrUtil.isNotEmpty(company.getFloorLogo())) {
|
|
|
+ fYunFileService.copyFileInBucket(company.getFloorLogo(),userViewPath + "floorLogo-user.png");
|
|
|
+ sceneJson.setFloorLogo("user");
|
|
|
+ sceneJson.setFloorLogoFile("floorLogo-user.png");
|
|
|
+ }
|
|
|
+ if (!ObjectUtils.isEmpty(company.getQrLogo())) {
|
|
|
+ if (!new File(ConstantFilePath.AGENT_PATH + company.getQrLogo()).exists()) {
|
|
|
+ fYunFileService.downloadFile(company.getQrLogo(), ConstantFilePath.AGENT_PATH + company.getQrLogo());
|
|
|
+ }
|
|
|
+ qrLogo = ConstantFilePath.AGENT_PATH + company.getQrLogo();
|
|
|
+ }
|
|
|
|
|
|
+ }
|
|
|
String sceneJsonStr = JSON.toJSONString(sceneJson);
|
|
|
//上传sceneJson文件
|
|
|
fYunFileService.uploadFile(sceneJsonStr.getBytes(), sceneJsonKey);
|
|
|
//scenejson写入缓存
|
|
|
redisUtil.set(String.format(RedisKey.SCENE_JSON, num), sceneJsonStr);
|
|
|
+
|
|
|
}
|
|
|
// 上传status JSON.
|
|
|
|
|
@@ -476,6 +496,19 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
|
|
|
|
fYunFileService.uploadFile(ConstantFilePath.SCENE_PATH + "data/data" + num + File.separator + "status.json",
|
|
|
dataViewPath + "status.json");
|
|
|
+
|
|
|
+ //生成二维码
|
|
|
+ String outPathZh = ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+num+".png";
|
|
|
+ String outPathEn = ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+num+"_en.png";
|
|
|
+ QrConfig qrConfig = QrConfig.create();
|
|
|
+ if(!ObjectUtils.isEmpty(qrLogo)){
|
|
|
+ qrConfig.setImg(qrLogo);
|
|
|
+ }
|
|
|
+ QrCodeUtil.generate(scenePlusExt.getWebSite(), qrConfig, FileUtil.file(outPathZh));
|
|
|
+ QrCodeUtil.generate(scenePlusExt.getWebSite() + "&lang=en", qrConfig, FileUtil.file(outPathEn));
|
|
|
+ //上传二维码
|
|
|
+ fYunFileService.uploadFile(outPathZh, String.format(UploadFilePath.DOWNLOADS_QRCODE, num) + num + ".png");
|
|
|
+ fYunFileService.uploadFile(outPathEn, String.format(UploadFilePath.DOWNLOADS_QRCODE, num) + num + "_en.png");
|
|
|
}
|
|
|
|
|
|
private void pushMsgToApp(Integer pushChannel, String pushToken, int cameraType, String sceneName, String webSite){
|