提交 4465d3eb 作者: 沈振路

复用替换公众号名称

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