|
@@ -3,7 +3,11 @@ package com.fdkankan.contro.service.impl;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
+import cn.hutool.core.io.FileUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
+import cn.hutool.extra.qrcode.QrCodeUtil;
|
|
|
+import cn.hutool.extra.qrcode.QrConfig;
|
|
|
+import cn.hutool.http.HttpUtil;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
@@ -431,11 +435,7 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
|
}
|
|
|
|
|
|
if (StrUtil.isNotEmpty(company.getQrLogo())) {
|
|
|
- //生成新的分享的二维码
|
|
|
- MatrixToImageWriterUtil.createQRCode(scenePlusVO.getWebSite(), ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/" + sceneNum + ".png",
|
|
|
- false, ConstantFilePath.SCENE_PATH + imgViewPath + "QRShareLogo.png");
|
|
|
- MatrixToImageWriterUtil.createQRCode(scenePlusVO.getWebSite() + "&lang=en", ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/" + sceneNum + "_en.png",
|
|
|
- false, ConstantFilePath.SCENE_PATH + imgViewPath + "QRShareLogo.png");
|
|
|
+ createQrCode(sceneNum,scenePlusVO.getWebSite(),company.getQrLogo());
|
|
|
}
|
|
|
sceneProEditService.updateById(sceneEditInfo);
|
|
|
if (!ObjectUtils.isEmpty(company.getCalculateFlexibility()) && !company.getCalculateFlexibility()) {
|
|
@@ -448,6 +448,35 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
|
return scenePlusVO;
|
|
|
}
|
|
|
|
|
|
+ private void createQrCode(String num, String url, String qrLogo) {
|
|
|
+ String localLogoPath = null;
|
|
|
+ if (!org.apache.commons.lang3.ObjectUtils.isEmpty(qrLogo)) {
|
|
|
+ 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 outPathEn = ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+ num +"_en.png";
|
|
|
+ QrConfig qrConfig = QrConfig.create();
|
|
|
+ if(!org.apache.commons.lang3.ObjectUtils.isEmpty(localLogoPath)){
|
|
|
+ qrConfig.setImg(localLogoPath);
|
|
|
+ }
|
|
|
+ QrCodeUtil.generate(url, qrConfig, FileUtil.file(outPathZh));
|
|
|
+ QrCodeUtil.generate(url + "&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");
|
|
|
+
|
|
|
+ if(!org.apache.commons.lang3.ObjectUtils.isEmpty(localLogoPath)){
|
|
|
+ FileUtils.deleteFile(localLogoPath);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public ResultData uploadSuccessBuild(String params) throws Exception {
|
|
|
log.info("uploadSuccessBuild-params: " + params);
|