|
@@ -345,37 +345,46 @@ public class ScenePlusServiceImpl extends ServiceImpl<IScenePlusMapper, ScenePlu
|
|
|
return scenePlus.getId();
|
|
|
}
|
|
|
|
|
|
+ public static void main(String[] args) {
|
|
|
+ String ext = FileUtil.extName("downloads/scene/KK-gz55kk3T/QRcode/shareLogo.png");
|
|
|
+ System.out.println(ext);
|
|
|
+ }
|
|
|
+
|
|
|
public void createQrCode(String num, Long cameraId, String website, String shareLogoImg, String sceneVersion) {
|
|
|
|
|
|
String localLogoPath = null;
|
|
|
- String qrLogo = StrUtil.isEmpty(shareLogoImg) ? null : shareLogoImg;
|
|
|
- if(sceneVersion.equals(SceneVersionType.V3.code()) && StrUtil.isNotEmpty(qrLogo) && FileUtil.exist(ConstantFilePath.SCENE_PATH + qrLogo)){
|
|
|
- localLogoPath = ConstantFilePath.SCENE_PATH + qrLogo;
|
|
|
- }else{
|
|
|
- if(StrUtil.isEmpty(qrLogo)){
|
|
|
- CameraDetail cameraDetail = null;
|
|
|
- Company company = null;
|
|
|
- if(Objects.nonNull(cameraId)){
|
|
|
- cameraDetail = cameraDetailService.getByCameraId(cameraId);
|
|
|
- if(Objects.nonNull(cameraDetail)){
|
|
|
- company = !ObjectUtils.isEmpty(cameraDetail.getCompanyId()) ? companyService.getById(cameraDetail.getCompanyId()) : null;
|
|
|
- }
|
|
|
+ if(StrUtil.isNotEmpty(shareLogoImg)){
|
|
|
+ if(sceneVersion.equals(SceneVersionType.V3.code())){
|
|
|
+ localLogoPath = ConstantFilePath.SCENE_PATH + shareLogoImg;
|
|
|
+ }else{
|
|
|
+ localLogoPath = ConstantFilePath.SCENE_PATH + "qrLogo/" + UUID.randomUUID().toString() + "." + FileUtil.extName(shareLogoImg);
|
|
|
+ fYunFileServiceInterface.downloadFile(shareLogoImg, localLogoPath);
|
|
|
+ }
|
|
|
+ if(!FileUtil.exist(localLogoPath)){
|
|
|
+ localLogoPath = null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(StrUtil.isEmpty(localLogoPath)){
|
|
|
+ CameraDetail cameraDetail = null;
|
|
|
+ Company company = null;
|
|
|
+ if(Objects.nonNull(cameraId)){
|
|
|
+ cameraDetail = cameraDetailService.getByCameraId(cameraId);
|
|
|
+ if(Objects.nonNull(cameraDetail)){
|
|
|
+ company = !ObjectUtils.isEmpty(cameraDetail.getCompanyId()) ? companyService.getById(cameraDetail.getCompanyId()) : null;
|
|
|
}
|
|
|
- qrLogo = !ObjectUtils.isEmpty(company) && !ObjectUtils.isEmpty(company.getQrLogo()) ? company.getQrLogo() : null;
|
|
|
}
|
|
|
-
|
|
|
- if (!ObjectUtils.isEmpty(qrLogo)) {
|
|
|
+ shareLogoImg = !ObjectUtils.isEmpty(company) && !ObjectUtils.isEmpty(company.getQrLogo()) ? company.getQrLogo() : null;
|
|
|
+ if (StrUtil.isNotEmpty(shareLogoImg)) {
|
|
|
try {
|
|
|
- localLogoPath = ConstantFilePath.SCENE_PATH + "qrLogo/" + qrLogo.substring(qrLogo.lastIndexOf("//") + 1);
|
|
|
- HttpUtil.downloadFile(qrLogo, localLogoPath);
|
|
|
+ localLogoPath = ConstantFilePath.SCENE_PATH + "qrLogo/" + shareLogoImg.substring(shareLogoImg.lastIndexOf("//") + 1);
|
|
|
+ HttpUtil.downloadFile(shareLogoImg, localLogoPath);
|
|
|
} catch (Exception e) {
|
|
|
- log.error("logo下载失败:{}", qrLogo);
|
|
|
+ log.error("logo下载失败:{}", shareLogoImg);
|
|
|
localLogoPath = null;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
//生成二维码
|
|
|
String outPathZh = com.fdkankan.model.constants.ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+ num +".png";
|
|
|
String outPathEn = com.fdkankan.model.constants.ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+ num +"_en.png";
|