提交 4e5006e1 作者: 沈振路

客服-活动

上级 bd36ced5
...@@ -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);
if (StringUtils.isNotBlank(nameModel)) {
referralEntity.setName(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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论