Commit 232e0f1d by 王祖波

区分群发和朋友圈

parent 0dcd72cb
...@@ -26,6 +26,11 @@ public class CombinedQDTO implements Serializable { ...@@ -26,6 +26,11 @@ public class CombinedQDTO implements Serializable {
*/ */
private String lineTwo; private String lineTwo;
/**
* 1群发 2朋友圈
*/
private Integer mediaType ;
public String getImageUrl() { public String getImageUrl() {
return imageUrl; return imageUrl;
} }
...@@ -66,8 +71,18 @@ public class CombinedQDTO implements Serializable { ...@@ -66,8 +71,18 @@ public class CombinedQDTO implements Serializable {
this.lineTwo = lineTwo; this.lineTwo = lineTwo;
} }
public Integer getMediaType() {
return mediaType;
}
public void setMediaType(Integer mediaType) {
this.mediaType = mediaType;
}
public String getUnionString() { public String getUnionString() {
return this.getImageUrl() + this.getQrCodeUrl() + this.getShowStyle() + this.getLineOne() + this.getLineTwo(); return this.getImageUrl() + this.getQrCodeUrl() + this.getShowStyle() + this.getLineOne() + this.getLineTwo() + this.getMediaType();
} }
} }
...@@ -52,11 +52,11 @@ public class ImageCombined { ...@@ -52,11 +52,11 @@ public class ImageCombined {
private static final int QR_WIDTH_REFERENCE = 136; private static final int QR_WIDTH_REFERENCE = 136;
private static final String LARGE_IMAGE_URL = "https://jhdmyx-1251519181.cos.ap-shanghai.myqcloud.com/image/material_content-191564494842458980f5c5ae685d3440.jpg?imageView2/2/w/1080/h/10800/format/jpg"; private static final String LARGE_IMAGE_URL = "https://revan-1251519181.cos.ap-shanghai.myqcloud.com/image/material_content-29dd73e4f9fb4a9eaf38ae1a3158bc91.jpg?imageView2/2/w/1080/h/10800/format/jpg";
private static final String QR_CODE_URL = "https://gicinner-1251519181.cos.ap-shanghai.myqcloud.com/image/material_content-4ffc77073ca1476fb264bf1be9f11383.png"; private static final String QR_CODE_URL = "https://gicinner-1251519181.cos.ap-shanghai.myqcloud.com/image/material_content-4ffc77073ca1476fb264bf1be9f11383.png";
private static final String STORE_NAME = "门店CCA门店CCA门店CCA门店CCA门店CCA门店CCA"; private static final String STORE_NAME = "杭州大厦";
private static final String GUIDE_NAME = "宇智222为您推荐门店CCA门店CCA门店CCA门店CCA门店CCA"; private static final String GUIDE_NAME = "翁坚鹏为您推荐";
private static final String OUTPUT_PATH = "/Users/wang/Downloads/output_image5.jpg"; private static final String OUTPUT_PATH = "/Users/wang/Downloads/output_image6.jpg";
static { static {
ImageIO.scanForPlugins(); // 初始化图像插件 ImageIO.scanForPlugins(); // 初始化图像插件
......
...@@ -367,7 +367,13 @@ public class MaterialServiceImpl implements MaterialService { ...@@ -367,7 +367,13 @@ public class MaterialServiceImpl implements MaterialService {
}else { }else {
arr = imageUrl.split("/"); arr = imageUrl.split("/");
} }
JSONResponse json = qywxSuiteApiService.uploadAttachment(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), combinedImageData, arr[arr.length - 1], QywxMediaTypeEnum.IMAGE.getCode(), qwDTO.isSelf(), qwDTO.getUrlHost()); JSONResponse json = null;
Integer mediaType = combinedQDTO.getMediaType();
if (Objects.equals(1,mediaType)) {
json = qywxSuiteApiService.uploadMedia(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), combinedImageData, arr[arr.length - 1], QywxMediaTypeEnum.IMAGE.getCode(), qwDTO.isSelf(), qwDTO.getUrlHost());
}else if (Objects.equals(2,mediaType)) {
json = qywxSuiteApiService.uploadAttachment(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), combinedImageData, arr[arr.length - 1], QywxMediaTypeEnum.IMAGE.getCode(), qwDTO.isSelf(), qwDTO.getUrlHost());
}
return json; return json;
} catch (Exception e) { } catch (Exception e) {
logger.info("合成图片获取媒体id异常",e); logger.info("合成图片获取媒体id异常",e);
......
...@@ -523,7 +523,7 @@ public class MaterialApiServiceImpl implements MaterialApiService { ...@@ -523,7 +523,7 @@ public class MaterialApiServiceImpl implements MaterialApiService {
if (StringUtils.isAnyBlank(combinedQDTO.getImageUrl(), combinedQDTO.getQrCodeUrl())) { if (StringUtils.isAnyBlank(combinedQDTO.getImageUrl(), combinedQDTO.getQrCodeUrl())) {
return com.gic.api.base.commons.ServiceResponse.failure("9999","参数异常") ; return com.gic.api.base.commons.ServiceResponse.failure("9999","参数异常") ;
} }
String unionString = combinedQDTO.getUnionString(); String unionString = combinedQDTO.getUnionString() + wxEnterpriseId;
String key = ImageCombined.IMAGE_REDIS_KEY + UUID.nameUUIDFromBytes(unionString.getBytes(StandardCharsets.UTF_8)); String key = ImageCombined.IMAGE_REDIS_KEY + UUID.nameUUIDFromBytes(unionString.getBytes(StandardCharsets.UTF_8));
String cache = (String)RedisUtil.getCache(key); String cache = (String)RedisUtil.getCache(key);
if (StringUtils.isNotBlank(cache)) { if (StringUtils.isNotBlank(cache)) {
......
...@@ -26,6 +26,10 @@ public class CombinedQO implements Serializable { ...@@ -26,6 +26,10 @@ public class CombinedQO implements Serializable {
* 第二行文字 * 第二行文字
*/ */
private String lineTwo; private String lineTwo;
/**
* 1群发 2朋友圈
*/
private Integer mediaType ;
public String getWxEnterpriseId() { public String getWxEnterpriseId() {
return wxEnterpriseId; return wxEnterpriseId;
...@@ -75,5 +79,12 @@ public class CombinedQO implements Serializable { ...@@ -75,5 +79,12 @@ public class CombinedQO implements Serializable {
this.lineTwo = lineTwo; this.lineTwo = lineTwo;
} }
public Integer getMediaType() {
return mediaType;
}
public void setMediaType(Integer mediaType) {
this.mediaType = mediaType;
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment