|
@@ -499,4 +499,40 @@ public class FsCompanyCustomerServiceImpl implements IFsCompanyCustomerService {
|
|
|
return R.error("微信接口调用失败: " + e.getMessage());
|
|
return R.error("微信接口调用失败: " + e.getMessage());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public R getShareMaterialWxCode(Long companyUserId, String appId, Long shareMaterialId) {
|
|
|
|
|
+ final WxMaService wxMaService = WxMaConfiguration.getMaService(appId);
|
|
|
|
|
+ String scene="cuId="+ companyUserId+ "&shareMaterialId=" + shareMaterialId;
|
|
|
|
|
+ byte[] file;
|
|
|
|
|
+ try {
|
|
|
|
|
+ file = wxMaService.getQrcodeService().createWxaCodeUnlimitBytes(
|
|
|
|
|
+ scene,
|
|
|
|
|
+ "/pages_course/customerStatistics",
|
|
|
|
|
+ true,
|
|
|
|
|
+ "release",
|
|
|
|
|
+ 430,
|
|
|
|
|
+ true,
|
|
|
|
|
+ null,
|
|
|
|
|
+ false);
|
|
|
|
|
+ // ======= 处理图片,替换中间的文字(/n:实现文字换行效果) =======
|
|
|
|
|
+ file = QRCodeImageCleaner.replaceCenterText(file, "益寿缘\n大药房");
|
|
|
|
|
+ // ==========================================
|
|
|
|
|
+ // 上传图片到存储桶
|
|
|
|
|
+ String suffix = ".png";
|
|
|
|
|
+ CloudStorageService storage = OSSFactory.build();
|
|
|
|
|
+ String url;
|
|
|
|
|
+ try {
|
|
|
|
|
+ url = storage.uploadSuffix(file, suffix);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("生成图片失败:{}",e.getMessage(),e);
|
|
|
|
|
+ return R.error("生成图片失败");
|
|
|
|
|
+ }
|
|
|
|
|
+ // 返回成功信息
|
|
|
|
|
+ return R.ok().put("url",url);
|
|
|
|
|
+ } catch (WxErrorException e) {
|
|
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
|
|
+ return R.error("微信接口调用失败: " + e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|