提交 8ca04e2d 作者: 沈振路

人群包问题修复

上级 3593ae6a
......@@ -68,8 +68,11 @@ public class CustomerDelayGraphicsController {
@ApiOperation("复用")
@PostMapping("/copy")
public BaseResult copy(@RequestParam String appId, @RequestBody List<String> targetAppList) {
return customerGraphicsDelayService.copy(appId, targetAppList);
public BaseResult copy(@RequestParam String appId,
@RequestParam(required = false) String bookId,
@RequestParam(required = false) String bookName,
@RequestBody List<String> targetAppList) {
return customerGraphicsDelayService.copy(appId, bookId, bookName, targetAppList);
}
@ApiOperation("所有公众号")
......
......@@ -89,10 +89,12 @@ public class CrowdPackage implements Serializable {
this.id = id;
this.packageName = packageName;
if (ObjectUtil.isNotNull(activeTimeMin)) {
this.activeTimeMin = activeTimeMin.longValue() * CrowdPackageCommonConstant.HOUR_TO_MILLION_RATE;
Double v = activeTimeMin * CrowdPackageCommonConstant.HOUR_TO_MILLION_RATE;
this.activeTimeMin = v.longValue();
}
if (ObjectUtil.isNotNull(activeTimeMax)) {
this.activeTimeMax = activeTimeMax.longValue() * CrowdPackageCommonConstant.HOUR_TO_MILLION_RATE;
Double v = (activeTimeMax * CrowdPackageCommonConstant.HOUR_TO_MILLION_RATE);
this.activeTimeMax = v.longValue();
}
}
......
......@@ -88,10 +88,12 @@ public interface CustomerGraphicsDelayService extends IService<CustomerGraphicsD
* 复制
*
* @param appId 应用程序id
* @param bookId 选择目标书
* @param bookName 书名
* @param targetAppList 目标应用程序列表
* @return {@link BaseResult}
*/
BaseResult copy(String appId, List<String> targetAppList);
BaseResult copy(String appId, String bookId, String bookName, List<String> targetAppList);
/**
* 获得认证列表
......
......@@ -53,6 +53,9 @@ public class CrowdPackageConditionMatchServiceImpl extends ServiceImpl<MaterialC
List<Long> setupIdList = commonService.getSetupIdListFromStaticCondition(staticConditionList);
long getSetupIdTime = System.currentTimeMillis();
LOCAL_LOG.info("获取SetupId列表耗时 {}ms, setupId列表长度: {}", getSetupIdTime - getConditionTime, setupIdList.size());
if (CollectionUtil.isEmpty(setupIdList)) {
return new ArrayList<>();
}
// 根据动态条件获取用户列表
List<CrowdPackageUserVO> userList = userEntityService.getUserMatchDynamicExpress(nonStaticConditionList, openId);
......@@ -60,9 +63,8 @@ public class CrowdPackageConditionMatchServiceImpl extends ServiceImpl<MaterialC
LOCAL_LOG.info("获取SetupId列表符合动态条件的用户耗时 {}ms, 符合动态条件的用户: {}个", dynamicUserTime - getSetupIdTime, userList.size());
// 筛选所属setupId在列表中的用户
if (CollectionUtil.isNotEmpty(setupIdList)) {
userList = userList.stream().filter(item -> setupIdList.contains(item.getSetupId())).collect(Collectors.toList());
}
long allUserTime = System.currentTimeMillis();
LOCAL_LOG.info("获取符合全部条件的用户耗时: {}ms, 符合全部条件的用户: {}个", allUserTime - dynamicUserTime, userList.size());
......
......@@ -31,6 +31,7 @@ import com.yaoyaozw.customer.vo.kanban.CommonOptionResponseVO;
import com.yaoyaozw.customer.vo.customer.CustomerDelayGraphicsDetailVO;
import com.yaoyaozw.customer.vo.customer.CustomerDelayItemVO;
import com.yaoyaozw.customer.vo.customer.CustomerDelayListVO;
import jodd.util.StringUtil;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -43,6 +44,7 @@ import java.text.SimpleDateFormat;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* @author darker
......@@ -236,7 +238,7 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi
}
@Override
public BaseResult copy(String appId, List<String> targetAppList) {
public BaseResult copy(String appId, String bookId, String bookName, List<String> targetAppList) {
List<AuthorizerInfo> authorizerInfoList = authorizerInfoService.list();
Map<String, AuthorizerInfo> authMap = authorizerInfoList.stream().collect(Collectors.toMap(AuthorizerInfo::getAppid, Function.identity()));
......@@ -252,7 +254,17 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi
List<Long> sourceMainIdList = sourceCustomerList.stream().map(CustomerGraphicsDelay::getId).collect(Collectors.toList());
// 获取原始链接素材 图文只有一条、文本有多条
List<ReferralEntity> referralEntityList = referralEntityService.list(new QueryWrapper<ReferralEntity>().in("material_graphics_id", sourceMainIdList).orderByAsc("gmt_create").orderByAsc("sort"));
Map<Long, List<ReferralEntity>> referralGroupMap = referralEntityList.stream().collect(Collectors.groupingBy(ReferralEntity::getMaterialGraphicsId));
// 分组链接,如果复用时选择了书,则需要为原本的所有书进行重新赋值
Stream<ReferralEntity> stream = referralEntityList.stream();
if (StringUtil.isNotBlank(bookId)) {
stream = stream.peek(item -> {
if (StringUtil.isNotBlank(item.getBookId())) {
item.setBookId(bookId);
item.setBookName(bookName);
}
});
}
Map<Long, List<ReferralEntity>> referralGroupMap = stream.collect(Collectors.groupingBy(ReferralEntity::getMaterialGraphicsId));
// 遍历处理
HashSet<String> storeTypeKeySet = CollectionUtil.newHashSet(sourceAuthInfo.getStoreType());
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论