提交 4e5006e1 作者: 沈振路

客服-活动

上级 bd36ced5
...@@ -3,6 +3,8 @@ package com.yaoyaozw.customer.components; ...@@ -3,6 +3,8 @@ package com.yaoyaozw.customer.components;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference; import com.alibaba.fastjson.TypeReference;
...@@ -14,13 +16,16 @@ import com.yaoyaozw.customer.dto.customer.CustomerMessageSaveDTO; ...@@ -14,13 +16,16 @@ import com.yaoyaozw.customer.dto.customer.CustomerMessageSaveDTO;
import com.yaoyaozw.customer.entity.CustomerGraphics; import com.yaoyaozw.customer.entity.CustomerGraphics;
import com.yaoyaozw.customer.entity.ReferralEntity; import com.yaoyaozw.customer.entity.ReferralEntity;
import com.yaoyaozw.customer.entity.RegisterUserEntity; import com.yaoyaozw.customer.entity.RegisterUserEntity;
import com.yaoyaozw.customer.enums.CustomerStoreTemplateEnum;
import com.yaoyaozw.customer.feigns.ReferralFeignClient; import com.yaoyaozw.customer.feigns.ReferralFeignClient;
import com.yaoyaozw.customer.mapper.CustomerGraphicsMapper;
import com.yaoyaozw.customer.mapper.KanbanCommonMapper; import com.yaoyaozw.customer.mapper.KanbanCommonMapper;
import com.yaoyaozw.customer.mapper.MaterialCommonMapper; import com.yaoyaozw.customer.mapper.MaterialCommonMapper;
import com.yaoyaozw.customer.service.CrowdPackageConditionMatchService; import com.yaoyaozw.customer.service.CrowdPackageConditionMatchService;
import com.yaoyaozw.customer.service.ReferralEntityService; import com.yaoyaozw.customer.service.ReferralEntityService;
import com.yaoyaozw.customer.service.RegisterUserEntityService; import com.yaoyaozw.customer.service.RegisterUserEntityService;
import com.yaoyaozw.customer.vo.AuthInfoVO; import com.yaoyaozw.customer.vo.AuthInfoVO;
import com.yaoyaozw.customer.vo.CommonOptionResponseVO;
import com.yaoyaozw.customer.vo.customer.CrowdPackageUserVO; import com.yaoyaozw.customer.vo.customer.CrowdPackageUserVO;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -30,6 +35,7 @@ import org.springframework.data.redis.core.RedisTemplate; ...@@ -30,6 +35,7 @@ import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.math.RoundingMode;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -60,6 +66,8 @@ public class CustomerServiceCommonAsyncComponent { ...@@ -60,6 +66,8 @@ public class CustomerServiceCommonAsyncComponent {
@Autowired @Autowired
private MaterialCommonMapper materialCommonMapper; private MaterialCommonMapper materialCommonMapper;
@Autowired @Autowired
private CustomerGraphicsMapper customerGraphicsMapper;
@Autowired
private KanbanCommonMapper kanbanCommonMapper; private KanbanCommonMapper kanbanCommonMapper;
...@@ -150,6 +158,9 @@ public class CustomerServiceCommonAsyncComponent { ...@@ -150,6 +158,9 @@ public class CustomerServiceCommonAsyncComponent {
generateUsualLink(storeGroupMap, customerReferral); generateUsualLink(storeGroupMap, customerReferral);
} }
// 处理完之后将状态改为待发送
customerMain.setSendStatus(2);
customerGraphicsMapper.updateById(customerMain);
} }
...@@ -168,6 +179,7 @@ public class CustomerServiceCommonAsyncComponent { ...@@ -168,6 +179,7 @@ public class CustomerServiceCommonAsyncComponent {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd"); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
String dateStr = dateFormat.format(new Date()); String dateStr = dateFormat.format(new Date());
Map<String, String> storeEntityMap = getStoreEntityMap(storeGroupMap.keySet());
storeGroupMap.forEach((storeType, userVoList) -> { storeGroupMap.forEach((storeType, userVoList) -> {
LOCAL_LOG.info("当前处理书城: {}", storeType); LOCAL_LOG.info("当前处理书城: {}", storeType);
...@@ -183,6 +195,7 @@ public class CustomerServiceCommonAsyncComponent { ...@@ -183,6 +195,7 @@ public class CustomerServiceCommonAsyncComponent {
// 重新生成链接主键id // 重新生成链接主键id
referralEntity.setId(snowflakeComponent.snowflakeId()); referralEntity.setId(snowflakeComponent.snowflakeId());
referralEntity.setAccountId(authInfoVo.getAccountId()); referralEntity.setAccountId(authInfoVo.getAccountId());
referralEntity.setStoreTypeName(storeEntityMap.get(storeType));
try { try {
getCopyReferral(dateStr, authInfoVo, referralEntity); getCopyReferral(dateStr, authInfoVo, referralEntity);
} catch (Exception e) { } catch (Exception e) {
...@@ -201,33 +214,71 @@ public class CustomerServiceCommonAsyncComponent { ...@@ -201,33 +214,71 @@ public class CustomerServiceCommonAsyncComponent {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd"); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
String dateStr = dateFormat.format(new Date()); String dateStr = dateFormat.format(new Date());
String activityContent = customerReferral.getRechargeAmount().stripTrailingZeros().toPlainString() + "送" + customerReferral.getGiftAmount();
LOCAL_LOG.info("活动内容: {}", activityContent);
Map<String, String> storeEntityMap = getStoreEntityMap(storeGroupMap.keySet());
storeGroupMap.forEach((storeType, userVoList) -> { storeGroupMap.forEach((storeType, userVoList) -> {
LOCAL_LOG.info("当前处理书城: {}", storeType); LOCAL_LOG.info("当前处理书城: {}", storeType);
// 去重提取公众号 boolean isLegal = true;
Set<String> accountSet = userVoList.stream().map(CrowdPackageUserVO::getAccountId).collect(Collectors.toSet()); // 阳光、掌中云 需要获取configId
List<AuthInfoVO> authInfoList = materialCommonMapper.getAuthInfoList(accountSet); if (storeType.equals(CustomerCommonConstant.STORE_NAME_YANG_GUANG) || storeType.equals(CustomerCommonConstant.STORE_NAME_ZHANG_ZHONG_YUN)) {
R activityConfig = referralFeignClient.getActivityConfig(customerReferral.getRechargeAmount().stripTrailingZeros().toPlainString(), storeType, null);
// 定义 // 获取资源配置列表
List<ReferralEntity> referralEntityList = new ArrayList<>(accountSet.size()); Map<String, Object> data = activityConfig.getData();
for (AuthInfoVO authInfoVo : authInfoList) {
ReferralEntity referralEntity = new ReferralEntity(); JSONArray configList = JSONUtil.parseArray(data.get("configList"));
List<CommonOptionResponseVO> activityConfigList = JSONUtil.toList(configList, CommonOptionResponseVO.class);
if (!CollectionUtil.isEmpty(activityConfigList)) {
// 转换config
Map<String, String> configMap = activityConfigList.stream().collect(Collectors.toMap(key -> key.getLabel().replaceAll("[^(0-9.送)]", ""), CommonOptionResponseVO::getValue, (o1, o2) -> o2));
String configId = configMap.get(activityContent);
LOCAL_LOG.info("活动内容: {} 获取到configId: {}", activityContent, configId);
customerReferral.setConfigId(configId);
if (ObjectUtil.isNull(configId)) {
isLegal = false;
}
} else {
isLegal = false;
LOCAL_LOG.info("无法获取资源配置, 中断当前循环");
}
}
String tempId = CustomerStoreTemplateEnum.getTempId(storeType);
customerReferral.setTemplateId(tempId);
if (isLegal) {
// 去重提取公众号
Set<String> accountSet = userVoList.stream().map(CrowdPackageUserVO::getAccountId).collect(Collectors.toSet());
List<AuthInfoVO> authInfoList = materialCommonMapper.getAuthInfoList(accountSet);
// 定义
List<ReferralEntity> referralEntityList = new ArrayList<>(accountSet.size());
for (AuthInfoVO authInfoVo : authInfoList) {
ReferralEntity referralEntity = new ReferralEntity();
BeanUtil.copyProperties(customerReferral, referralEntity);
// 重新生成链接主键id
referralEntity.setId(snowflakeComponent.snowflakeId());
referralEntity.setAccountId(authInfoVo.getAccountId());
referralEntity.setStoreTypeName(storeEntityMap.get(storeType));
try {
getCopyReferral(dateStr, authInfoVo, referralEntity);
} catch (Exception e) {
LOCAL_LOG.warn("公众号: {} 获取链接异常: {}", authInfoVo.getAccountName(), e.getMessage());
}
BeanUtil.copyProperties(customerReferral, referralEntity); referralEntityList.add(referralEntity);
// 重新生成链接主键id }
referralEntity.setId(snowflakeComponent.snowflakeId());
referralEntity.setAccountId(authInfoVo.getAccountId());
getCopyReferral(dateStr, authInfoVo, referralEntity);
referralEntityList.add(referralEntity); // 批量新增
referralEntityService.saveBatch(referralEntityList);
} }
// 批量新增
referralEntityService.saveBatch(referralEntityList);
}); });
} }
private void generateUsualLink(Map<String, List<CrowdPackageUserVO>> storeGroupMap, ReferralEntity customerReferral) { private void generateUsualLink(Map<String, List<CrowdPackageUserVO>> storeGroupMap, ReferralEntity customerReferral) {
Map<String, String> storeEntityMap = getStoreEntityMap(storeGroupMap.keySet());
storeGroupMap.forEach((storeType, userVoList) -> { storeGroupMap.forEach((storeType, userVoList) -> {
LOCAL_LOG.info("当前处理书城: {}", storeType); LOCAL_LOG.info("当前处理书城: {}", storeType);
...@@ -244,6 +295,8 @@ public class CustomerServiceCommonAsyncComponent { ...@@ -244,6 +295,8 @@ public class CustomerServiceCommonAsyncComponent {
// 重新生成链接主键id // 重新生成链接主键id
referralEntity.setId(snowflakeComponent.snowflakeId()); referralEntity.setId(snowflakeComponent.snowflakeId());
referralEntity.setAccountId(authInfoVo.getAccountId()); referralEntity.setAccountId(authInfoVo.getAccountId());
referralEntity.setStoreTypeName(storeEntityMap.get(storeType));
getCopyReferral(null, authInfoVo, referralEntity); getCopyReferral(null, authInfoVo, referralEntity);
referralEntityList.add(referralEntity); referralEntityList.add(referralEntity);
...@@ -254,8 +307,6 @@ public class CustomerServiceCommonAsyncComponent { ...@@ -254,8 +307,6 @@ public class CustomerServiceCommonAsyncComponent {
}); });
} }
private void getCopyReferral(String dateStr, AuthInfoVO authInfoVo, ReferralEntity referralEntity) { private void getCopyReferral(String dateStr, AuthInfoVO authInfoVo, ReferralEntity referralEntity) {
referralEntity.setStoreType(authInfoVo.getStoreType()); referralEntity.setStoreType(authInfoVo.getStoreType());
// 非常用链接类型的name需要处理 // 非常用链接类型的name需要处理
...@@ -268,13 +319,13 @@ public class CustomerServiceCommonAsyncComponent { ...@@ -268,13 +319,13 @@ public class CustomerServiceCommonAsyncComponent {
} }
// 替换共用字段 // 替换共用字段
name = name.replace("{newsType}", newsTypeName).replace("{accountNickName}", authInfoVo.getAccountName()) name = name.replace("{newsType}", newsTypeName).replace("{accountNickName}", authInfoVo.getAccountName())
.replace("{storeType}", referralEntity.getStoreType()).replace("{currentDate}", dateStr); .replace("{storeType}", referralEntity.getStoreTypeName()).replace("{currentDate}", dateStr);
if (newsType.equals(CustomerCommonConstant.BOOK_NEWS_TYPE)) { if (newsType.equals(CustomerCommonConstant.BOOK_NEWS_TYPE)) {
// 系统-客服-{newsType}-{accountNickName}-{storeType}-{currentDate}-{bookName} // 系统-客服-{newsType}-{accountNickName}-{storeType}-{currentDate}-{bookName}
name = name.replace("{bookName}", referralEntity.getBookName()); name = name.replace("{bookName}", referralEntity.getBookName());
} else if (newsType.equals(CustomerCommonConstant.ACTIVITY_NEWS_TYPE)) { } else if (newsType.equals(CustomerCommonConstant.ACTIVITY_NEWS_TYPE)) {
// 系统-客服-{newsType}-{accountNickName}-{storeType}-{currentDate}-充{recharge}送{gift} // 系统-客服-{newsType}-{accountNickName}-{storeType}-{currentDate}-充{recharge}送{gift}
name = name.replace("{recharge}", referralEntity.getRechargeAmount().toPlainString()).replace("{gift}", referralEntity.getGiftAmount().toString()); name = name.replace("{recharge}", referralEntity.getRechargeAmount().stripTrailingZeros().toPlainString()).replace("{gift}", referralEntity.getGiftAmount().toString());
} }
referralEntity.setName(name); referralEntity.setName(name);
} }
...@@ -282,6 +333,8 @@ public class CustomerServiceCommonAsyncComponent { ...@@ -282,6 +333,8 @@ public class CustomerServiceCommonAsyncComponent {
R r = referralFeignClient.productReferral(referralEntity); R r = referralFeignClient.productReferral(referralEntity);
if (!r.getCode().equals(ApiResultConstant.SUCCESS_CODE)) { if (!r.getCode().equals(ApiResultConstant.SUCCESS_CODE)) {
throw new RuntimeException(r.getMessage()); throw new RuntimeException(r.getMessage());
} else {
LOCAL_LOG.info("公众号: {} 获取链接成功", authInfoVo.getAccountName());
} }
String res = r.getData("storeReferral", new TypeReference<String>() {}); String res = r.getData("storeReferral", new TypeReference<String>() {});
JSONObject jsonObject1 = JSON.parseObject(res); JSONObject jsonObject1 = JSON.parseObject(res);
...@@ -290,10 +343,13 @@ public class CustomerServiceCommonAsyncComponent { ...@@ -290,10 +343,13 @@ public class CustomerServiceCommonAsyncComponent {
referralEntity.setReferral(referral); referralEntity.setReferral(referral);
} }
private String getConfigIdFromInterface(String storeType) { private Map<String, String> getStoreEntityMap(Set<String> storeKeySet) {
if (CollectionUtil.isEmpty(storeKeySet)) {
return new HashMap<>(4);
}
List<CommonOptionResponseVO> storeTypeEntity = kanbanCommonMapper.getStoreTypeEntity(storeKeySet);
return storeTypeEntity.stream().collect(Collectors.toMap(CommonOptionResponseVO::getKey, CommonOptionResponseVO::getName));
return null;
} }
} }
...@@ -10,6 +10,10 @@ public class CustomerCommonConstant { ...@@ -10,6 +10,10 @@ public class CustomerCommonConstant {
public final static String CROWD_HUMAN_NUN_REDIS_KEY = "crowdHumanNum"; public final static String CROWD_HUMAN_NUN_REDIS_KEY = "crowdHumanNum";
public final static String STORE_NAME_YANG_GUANG = "YANG_GUANG";
public final static String STORE_NAME_ZHANG_ZHONG_YUN = "ZHANG_ZHONG_YUN";
public final static String STORE_NAME_YUE_WEN = "YUE_WEN";
public final static Integer BOOK_NEWS_TYPE = 1; public final static Integer BOOK_NEWS_TYPE = 1;
public final static String BOOK_NEWS_TYPE_NAME = "推广"; public final static String BOOK_NEWS_TYPE_NAME = "推广";
......
...@@ -82,7 +82,7 @@ public class CustomerReferralDTO implements Serializable { ...@@ -82,7 +82,7 @@ public class CustomerReferralDTO implements Serializable {
public Date getEndTime() { public Date getEndTime() {
if (ObjectUtil.isNull(this.endTime) && CollectionUtil.isNotEmpty(this.dateList)) { if (ObjectUtil.isNull(this.endTime) && CollectionUtil.isNotEmpty(this.dateList)) {
return dateList.get(0); return dateList.get(1);
} }
return endTime; return endTime;
} }
......
package com.yaoyaozw.customer.enums;
import org.apache.commons.lang3.StringUtils;
/**
* @author darker
* @date 2022/10/11 20:23
*/
public enum CustomerStoreTemplateEnum {
/**
* 客服消息书城活动模板
*/
YANG_GUANG("YANG_GUANG", "5"),
YUE_WEN("YUE_WEN", "1"),
ZHANG_ZHONG_YUN("ZHANG_ZHONG_YUN", "1"),
ZHANG_DU("ZHANG_DU", "1")
;
private final String storeType;
private final String templateId;
CustomerStoreTemplateEnum(String storeType, String templateId) {
this.storeType = storeType;
this.templateId = templateId;
}
public String getStoreType() {
return storeType;
}
public String getTemplateId() {
return templateId;
}
public static String getTempId(String storeType) {
if (StringUtils.isBlank(storeType)) {
return null;
}
for (CustomerStoreTemplateEnum value : CustomerStoreTemplateEnum.values()) {
if (storeType.contains(value.getStoreType())) {
return value.getTemplateId();
}
}
return null;
}
}
...@@ -3,8 +3,10 @@ package com.yaoyaozw.customer.feigns; ...@@ -3,8 +3,10 @@ package com.yaoyaozw.customer.feigns;
import com.yaoyaozw.customer.common.R; import com.yaoyaozw.customer.common.R;
import com.yaoyaozw.customer.entity.ReferralEntity; import com.yaoyaozw.customer.entity.ReferralEntity;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
/** /**
...@@ -25,4 +27,16 @@ public interface ReferralFeignClient { ...@@ -25,4 +27,16 @@ public interface ReferralFeignClient {
@PostMapping("/getReferral") @PostMapping("/getReferral")
R productReferral(@RequestBody ReferralEntity referralEntity); R productReferral(@RequestBody ReferralEntity referralEntity);
/**
* 获取活动config
*
* @param Key 关键
* @param storeType 存储类型
* @param infoId 信息标识
* @return {@link R}
*/
@GetMapping("/getActivityConfig")
R getActivityConfig(@RequestParam String Key, @RequestParam String storeType, @RequestParam(required = false) Long infoId);
} }
...@@ -7,6 +7,7 @@ import org.apache.ibatis.annotations.Param; ...@@ -7,6 +7,7 @@ import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List; import java.util.List;
import java.util.Set;
/** /**
* @author darker * @author darker
...@@ -41,5 +42,13 @@ public interface KanbanCommonMapper { ...@@ -41,5 +42,13 @@ public interface KanbanCommonMapper {
*/ */
String getStoreTypeByExpression(@Param("expression") String expression); String getStoreTypeByExpression(@Param("expression") String expression);
/**
* 获取书城
*
* @param storeKeySet 存储键设置
* @return {@link List}<{@link CommonOptionResponseVO}>
*/
List<CommonOptionResponseVO> getStoreTypeEntity(@Param("storeKeySet") Set<String> storeKeySet);
} }
package com.yaoyaozw.customer.scheduling; package com.yaoyaozw.customer.scheduling;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yaoyaozw.customer.constants.CustomerCommonConstant;
import com.yaoyaozw.customer.dto.integration.IntegrationRequestDTO; import com.yaoyaozw.customer.dto.integration.IntegrationRequestDTO;
import com.yaoyaozw.customer.entity.CrowdPackage;
import com.yaoyaozw.customer.service.AccountOrderService; import com.yaoyaozw.customer.service.AccountOrderService;
import com.yaoyaozw.customer.service.RegisterUserEntityService; import com.yaoyaozw.customer.service.RegisterUserEntityService;
import com.yaoyaozw.customer.service.impl.CrowdPackageServiceImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;
@Component @Component
public class SchedulingTask { public class SchedulingTask {
private final static Logger localLog = LoggerFactory.getLogger(SchedulingTask.class);
@Autowired @Autowired
private AccountOrderService accountOrderService; private AccountOrderService accountOrderService;
@Autowired @Autowired
private RegisterUserEntityService registerUserEntityService; private RegisterUserEntityService registerUserEntityService;
@Autowired
private RedisTemplate redisTemplate;
@Autowired
private CrowdPackageServiceImpl crowdPackageService;
/** /**
...@@ -69,4 +87,34 @@ public class SchedulingTask { ...@@ -69,4 +87,34 @@ public class SchedulingTask {
} }
/**
* 从redis中更新人群包人数
*/
@Scheduled(cron = "0 0/15 * * * ?")
public void updateCrowdPackageNumFromRedis() {
localLog.info("开始同步redis中人群包人数至数据库");
HashMap<String, Integer> entries = (HashMap<String, Integer>) redisTemplate.boundHashOps(CustomerCommonConstant.CROWD_HUMAN_NUN_REDIS_KEY).entries();
if (CollectionUtil.isEmpty(entries)) {
return;
}
localLog.info("redis中获取到人群包人数数据: {}对", entries.size());
Date now = new Date();
List<CrowdPackage> list = crowdPackageService.list();
localLog.info("数据库中获取人群包: {}条", list.size());
List<CrowdPackage> resultList = list.stream().filter(item -> entries.containsKey(item.getId().toString()))
.peek(item -> {
item.setLastCountTime(now);
Integer num = entries.get(item.getId().toString());
item.setCrowdNum(num);
}).collect(Collectors.toList());
localLog.info("要更新人群包: {} 条", resultList.size());
if (CollectionUtil.isNotEmpty(resultList)) {
crowdPackageService.updateBatchById(resultList);
}
localLog.info("删除创建时的临时数据");
crowdPackageService.remove(new QueryWrapper<CrowdPackage>().isNull("package_name"));
}
} }
...@@ -147,10 +147,6 @@ public class CrowdPackageServiceImpl extends ServiceImpl<MaterialCrowdPackageMap ...@@ -147,10 +147,6 @@ public class CrowdPackageServiceImpl extends ServiceImpl<MaterialCrowdPackageMap
if (CollectionUtil.isEmpty(pageList)) { if (CollectionUtil.isEmpty(pageList)) {
return new GenericsResult<>(false, "暂无数据"); return new GenericsResult<>(false, "暂无数据");
} }
HashMap<String, Integer> entries = (HashMap<String, Integer>) redisTemplate.boundHashOps(CustomerCommonConstant.CROWD_HUMAN_NUN_REDIS_KEY).entries();
if (CollectionUtil.isNotEmpty(entries)) {
pageList.forEach(item -> item.setNumOfCrowdInPackage(entries.get(item.getId().toString())));
}
return new GenericsResult<>(pageList); return new GenericsResult<>(pageList);
} }
......
...@@ -25,6 +25,7 @@ import com.yaoyaozw.customer.service.CrowdPackageConditionService; ...@@ -25,6 +25,7 @@ import com.yaoyaozw.customer.service.CrowdPackageConditionService;
import com.yaoyaozw.customer.service.ReferralEntityService; import com.yaoyaozw.customer.service.ReferralEntityService;
import com.yaoyaozw.customer.vo.customer.CustomerMessageDetailVO; import com.yaoyaozw.customer.vo.customer.CustomerMessageDetailVO;
import com.yaoyaozw.customer.vo.customer.CustomerMessageListVO; import com.yaoyaozw.customer.vo.customer.CustomerMessageListVO;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -86,7 +87,9 @@ public class CustomerGraphicsServiceImpl extends ServiceImpl<CustomerGraphicsMap ...@@ -86,7 +87,9 @@ public class CustomerGraphicsServiceImpl extends ServiceImpl<CustomerGraphicsMap
// 获取name模板 // 获取name模板
String nameModel = CustomerCommonConstant.getLinkNameModel(referralEntity.getNewsType()); String nameModel = CustomerCommonConstant.getLinkNameModel(referralEntity.getNewsType());
LOCAL_LOG.info("获取name模板: {}", nameModel); LOCAL_LOG.info("获取name模板: {}", nameModel);
referralEntity.setName(nameModel); if (StringUtils.isNotBlank(nameModel)) {
referralEntity.setName(nameModel);
}
// 保存链接数据 // 保存链接数据
referralEntityService.saveOrUpdate(referralEntity); referralEntityService.saveOrUpdate(referralEntity);
...@@ -168,6 +171,8 @@ public class CustomerGraphicsServiceImpl extends ServiceImpl<CustomerGraphicsMap ...@@ -168,6 +171,8 @@ public class CustomerGraphicsServiceImpl extends ServiceImpl<CustomerGraphicsMap
} }
byId.setPackId(packId); byId.setPackId(packId);
// 设置状态为链接生成中
byId.setSendStatus(1);
boolean result = super.updateById(byId); boolean result = super.updateById(byId);
if (result) { if (result) {
// 删除之前设置人群包的时候获取链接生成的数据 // 删除之前设置人群包的时候获取链接生成的数据
......
...@@ -20,4 +20,10 @@ public class CommonOptionResponseVO implements Serializable { ...@@ -20,4 +20,10 @@ public class CommonOptionResponseVO implements Serializable {
@ApiModelProperty("选项名称") @ApiModelProperty("选项名称")
private String name; private String name;
@ApiModelProperty("key值")
private String value;
@ApiModelProperty("选项名称")
private String label;
} }
...@@ -31,7 +31,7 @@ public class CrowdPackageListVO implements Serializable { ...@@ -31,7 +31,7 @@ public class CrowdPackageListVO implements Serializable {
private Integer numOfCrowdInPackage; private Integer numOfCrowdInPackage;
@ApiModelProperty("最后一次统计时间") @ApiModelProperty("最后一次统计时间")
private Integer lastCountTime; private String lastCountTime;
@ApiModelProperty("创建时间") @ApiModelProperty("创建时间")
private String createTime; private String createTime;
......
...@@ -33,4 +33,15 @@ ...@@ -33,4 +33,15 @@
limit 1 limit 1
</select> </select>
<select id="getStoreTypeEntity" resultType="com.yaoyaozw.customer.vo.CommonOptionResponseVO">
select
store_type as `key`,
store_name as `name`
from store_entity
where store_type in
<foreach collection="storeKeySet" item="storeKey" open="(" close=")" separator=",">
#{storeKey}
</foreach>
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -18,7 +18,8 @@ ...@@ -18,7 +18,8 @@
<select id="getPageList" resultType="com.yaoyaozw.customer.vo.crowd.CrowdPackageListVO"> <select id="getPageList" resultType="com.yaoyaozw.customer.vo.crowd.CrowdPackageListVO">
select select
cpm.id, cpm.package_name as packageName, cpm.id, cpm.package_name as packageName,
cpm.crowd_num as numOfCrowdInPackage, cpm.last_count_time as lastCountTime, ifnull(cpm.crowd_num, 0) as numOfCrowdInPackage,
cpm.last_count_time as lastCountTime,
cpm.create_time as createTime, cpm.modified_time as modifiedTime, cpm.create_time as createTime, cpm.modified_time as modifiedTime,
cau.nick_name as createUser, mau.nick_name as modifiedUser, cau.nick_name as createUser, mau.nick_name as modifiedUser,
group_concat(concat('【', mat.operator_description, '】')) as packageLabel group_concat(concat('【', mat.operator_description, '】')) as packageLabel
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论