|
@@ -8,6 +8,7 @@ import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.ZipUtil;
|
|
import cn.hutool.core.util.ZipUtil;
|
|
import cn.hutool.extra.qrcode.QrCodeUtil;
|
|
import cn.hutool.extra.qrcode.QrCodeUtil;
|
|
import cn.hutool.extra.qrcode.QrConfig;
|
|
import cn.hutool.extra.qrcode.QrConfig;
|
|
|
|
+import cn.hutool.http.HttpUtil;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
@@ -468,29 +469,32 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
}
|
|
}
|
|
|
|
|
|
private void createQrCode(String num, ScenePlusExt scenePlusExt, String qrLogo) {
|
|
private void createQrCode(String num, ScenePlusExt scenePlusExt, String qrLogo) {
|
|
|
|
+ String localLogoPath = null;
|
|
if (!ObjectUtils.isEmpty(qrLogo)) {
|
|
if (!ObjectUtils.isEmpty(qrLogo)) {
|
|
- if (!new File(ConstantFilePath.AGENT_PATH + qrLogo).exists()) {
|
|
|
|
- try {
|
|
|
|
- fYunFileService.downloadFile(qrLogo, ConstantFilePath.AGENT_PATH + qrLogo);
|
|
|
|
- qrLogo = ConstantFilePath.AGENT_PATH + qrLogo;
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- log.error("公司logo下载失败:{}", qrLogo);
|
|
|
|
- qrLogo = null;
|
|
|
|
- }
|
|
|
|
|
|
+ try {
|
|
|
|
+ localLogoPath = ConstantFilePath.AGENT_PATH + qrLogo.substring(qrLogo.lastIndexOf("//") + 1);
|
|
|
|
+ HttpUtil.downloadFile(qrLogo, localLogoPath);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ log.error("公司logo下载失败:{}", qrLogo);
|
|
|
|
+ localLogoPath = null;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//生成二维码
|
|
//生成二维码
|
|
String outPathZh = ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+ num +".png";
|
|
String outPathZh = ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+ num +".png";
|
|
String outPathEn = ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+ num +"_en.png";
|
|
String outPathEn = ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+ num +"_en.png";
|
|
QrConfig qrConfig = QrConfig.create();
|
|
QrConfig qrConfig = QrConfig.create();
|
|
- if(!ObjectUtils.isEmpty(qrLogo)){
|
|
|
|
- qrConfig.setImg(qrLogo);
|
|
|
|
|
|
+ if(!ObjectUtils.isEmpty(localLogoPath)){
|
|
|
|
+ qrConfig.setImg(localLogoPath);
|
|
}
|
|
}
|
|
QrCodeUtil.generate(scenePlusExt.getWebSite(), qrConfig, FileUtil.file(outPathZh));
|
|
QrCodeUtil.generate(scenePlusExt.getWebSite(), qrConfig, FileUtil.file(outPathZh));
|
|
QrCodeUtil.generate(scenePlusExt.getWebSite() + "&lang=en", qrConfig, FileUtil.file(outPathEn));
|
|
QrCodeUtil.generate(scenePlusExt.getWebSite() + "&lang=en", qrConfig, FileUtil.file(outPathEn));
|
|
//上传二维码
|
|
//上传二维码
|
|
fYunFileService.uploadFile(outPathZh, String.format(UploadFilePath.DOWNLOADS_QRCODE, num) + num + ".png");
|
|
fYunFileService.uploadFile(outPathZh, String.format(UploadFilePath.DOWNLOADS_QRCODE, num) + num + ".png");
|
|
fYunFileService.uploadFile(outPathEn, String.format(UploadFilePath.DOWNLOADS_QRCODE, num) + num + "_en.png");
|
|
fYunFileService.uploadFile(outPathEn, String.format(UploadFilePath.DOWNLOADS_QRCODE, num) + num + "_en.png");
|
|
|
|
+
|
|
|
|
+ if(!ObjectUtils.isEmpty(localLogoPath)){
|
|
|
|
+ FileUtils.deleteFile(localLogoPath);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
private void pushMsgToApp(Integer pushChannel, String pushToken, int cameraType, String sceneName, String webSite){
|
|
private void pushMsgToApp(Integer pushChannel, String pushToken, int cameraType, String sceneName, String webSite){
|