提交 4465d3eb 作者: 沈振路

复用替换公众号名称

上级 7a3a4184
...@@ -86,18 +86,23 @@ public class FollowReplyComponent { ...@@ -86,18 +86,23 @@ public class FollowReplyComponent {
/** /**
* 获取复用时的链接数据 * 获取复用时的链接数据
* *
* @param sourceAccountName 源公众号名称
* @param dateStr 日期 * @param dateStr 日期
* @param authInfoVo 目标公众号 * @param authInfoVo 目标公众号
* @param sourceReferral 链接参数 * @param sourceReferral 链接参数
* @return {@link ReferralEntity} * @return {@link ReferralEntity}
*/ */
public ReferralEntity getCopyReferralEntity(String dateStr, AuthInfoVO authInfoVo, ReferralEntity sourceReferral) { public ReferralEntity getCopyReferralEntity(String sourceAccountName, String dateStr, AuthInfoVO authInfoVo, ReferralEntity sourceReferral) {
ReferralEntity targetReferral = new ReferralEntity(); ReferralEntity targetReferral = new ReferralEntity();
BeanUtil.copyProperties(sourceReferral, targetReferral, BeanUtil.copyProperties(sourceReferral, targetReferral,
"id", "accountId", "name", "referral", "materialGraphicsId", "infoId"); "id", "accountId", "name", "referral", "materialGraphicsId", "infoId");
// 为参数设置公众号相关参数 // 为参数设置公众号相关参数
targetReferral.setAccountId(authInfoVo.getAccountId()); targetReferral.setAccountId(authInfoVo.getAccountId());
targetReferral.setInfoId(authInfoVo.getId()); targetReferral.setInfoId(authInfoVo.getId());
String textContent = targetReferral.getTextContent();
if (StringUtils.isNotEmpty(textContent)) {
targetReferral.setTextContent(textContent.replace(sourceAccountName, authInfoVo.getAccountName()));
}
Integer newsType = targetReferral.getNewsType(); Integer newsType = targetReferral.getNewsType();
if (CustomerCommonConstant.REMOTE_LINK_NEWS_TYPE_LIST.contains(newsType)) { if (CustomerCommonConstant.REMOTE_LINK_NEWS_TYPE_LIST.contains(newsType)) {
...@@ -125,7 +130,7 @@ public class FollowReplyComponent { ...@@ -125,7 +130,7 @@ public class FollowReplyComponent {
* @param sourceMaterialList 源素材列表 * @param sourceMaterialList 源素材列表
* @return 执行结果 * @return 执行结果
*/ */
public FollowReplyCopyResultVO copyMaterialToTarget(AuthInfoVO targetAuth, List<CustomerFollowReply> sourceMaterialList) { public FollowReplyCopyResultVO copyMaterialToTarget(String sourceAccountName, AuthInfoVO targetAuth, List<CustomerFollowReply> sourceMaterialList) {
FollowReplyCopyResultVO result = new FollowReplyCopyResultVO(); FollowReplyCopyResultVO result = new FollowReplyCopyResultVO();
result.setHasError(false); result.setHasError(false);
...@@ -172,7 +177,7 @@ public class FollowReplyComponent { ...@@ -172,7 +177,7 @@ public class FollowReplyComponent {
List<ReferralEntity> singleMaterialReferralList = new ArrayList<>(referralEntityList.size()); List<ReferralEntity> singleMaterialReferralList = new ArrayList<>(referralEntityList.size());
for (ReferralEntity sourceReferral : referralEntityList) { for (ReferralEntity sourceReferral : referralEntityList) {
try { try {
ReferralEntity finalReferral = getCopyReferralEntity(dateStr, targetAuth, sourceReferral); ReferralEntity finalReferral = getCopyReferralEntity(sourceAccountName, dateStr, targetAuth, sourceReferral);
finalReferral.setMaterialGraphicsId(entity.getId()); finalReferral.setMaterialGraphicsId(entity.getId());
singleMaterialReferralList.add(finalReferral); singleMaterialReferralList.add(finalReferral);
finalReferralList.add(finalReferral); finalReferralList.add(finalReferral);
......
...@@ -235,7 +235,7 @@ public class CustomerFollowReplyServiceImpl extends ServiceImpl<CustomerFollowRe ...@@ -235,7 +235,7 @@ public class CustomerFollowReplyServiceImpl extends ServiceImpl<CustomerFollowRe
for (AuthInfoVO targetAuth : targetAuthList) { for (AuthInfoVO targetAuth : targetAuthList) {
localLog.info("批次号: {}, 公众号处理进度: {}/{}", copyFlag, idx++, targetAuthList.size()); localLog.info("批次号: {}, 公众号处理进度: {}/{}", copyFlag, idx++, targetAuthList.size());
// 调用复用 // 调用复用
FollowReplyCopyResultVO result = followReplyComponent.copyMaterialToTarget(targetAuth, sourceMaterialList); FollowReplyCopyResultVO result = followReplyComponent.copyMaterialToTarget(sourceAuth.getAccountName(), targetAuth, sourceMaterialList);
if (result.getHasError()) { if (result.getHasError()) {
if (errorAuthList == null) { if (errorAuthList == null) {
errorAuthList = new ArrayList<>(); errorAuthList = new ArrayList<>();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论