提交 2c7e25f2 作者: 沈振路

Merge remote-tracking branch 'origin/master'

......@@ -63,8 +63,9 @@ public class SchedulingTask {
}
/**
* 更新付费用户近一月平均充值(每天一次)
* 更新付费用户近一月平均充值(每天一次:4点10分
*/
@Scheduled(cron = "0 10 4 * * *")
public void retrieveMonthOrder(){
Calendar calendar = Calendar.getInstance();
......@@ -85,6 +86,7 @@ public class SchedulingTask {
/**
* 每10min扫描一次正常客服
*/
@Scheduled(cron = "0 0/10 * * * *")
public void publishCustomerMessage(){
Calendar calendar = Calendar.getInstance();
......
package com.yaoyaozw.customer.service.impl;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yaoyaozw.customer.dto.integration.IntegrationRequestDTO;
import com.yaoyaozw.customer.entity.RegisterUserEntity;
......@@ -43,6 +44,7 @@ public class AccountOrderServiceImpl extends ServiceImpl<AccountOrderMapper, Acc
Map<String, List<AccountOrder>> userOrderMap = runtimeOrders.stream().collect(Collectors.groupingBy(AccountOrder::getOpenId));
Calendar instance = Calendar.getInstance();
if (!openIdSet.isEmpty()){
//获取注册用户信息
List<RegisterUserEntity> userList = registerUserEntityService.list(new QueryWrapper<RegisterUserEntity>().in(RegisterUserEntity.COL_OPEN_ID, openIdSet));
......@@ -63,8 +65,11 @@ public class AccountOrderServiceImpl extends ServiceImpl<AccountOrderMapper, Acc
Double sum=registerUser.getPayAmount()!=null?registerUser.getPayAmount():0;
for (AccountOrder accountOrder : accountOrders) {
//下单时间推5min
instance.setTime(accountOrder.getFinishTime());
instance.add(Calendar.MINUTE,5);
//最近活跃时间
lastFinishTime = (lastFinishTime != null && lastFinishTime.compareTo(accountOrder.getFinishTime()) > 0) ? lastFinishTime : accountOrder.getFinishTime();
lastFinishTime = (lastFinishTime != null && lastFinishTime.compareTo(accountOrder.getFinishTime()) > 0) ? lastFinishTime : instance.getTime();
//最大类型
type = Math.max(accountOrder.getType() + 1, type);
sum += accountOrder.getProfit();
......@@ -96,6 +101,7 @@ public class AccountOrderServiceImpl extends ServiceImpl<AccountOrderMapper, Acc
public void calculateAvgMonth(IntegrationRequestDTO integrationRequestDTO) {
//获取近一月每个用户的平均充值
List<UserAvgAmountVO> userAvgAmountVos= baseMapper.findMonthDailyAccountOrder();
if(!userAvgAmountVos.isEmpty()){
Map<String, Double> userAvgAmountMap = userAvgAmountVos.stream().collect(Collectors.toMap(UserAvgAmountVO::getOpenId, UserAvgAmountVO::getAvgAmount, (v1, v2) -> v1));
//获取付费用户信息
List<RegisterUserEntity> userList = registerUserEntityService.list(new QueryWrapper<RegisterUserEntity>().gt(RegisterUserEntity.COL_PAY_TYPE, 0));
......@@ -110,6 +116,8 @@ public class AccountOrderServiceImpl extends ServiceImpl<AccountOrderMapper, Acc
registerUserEntityService.updateBatchById(userList);
}
}
/**
......
......@@ -6,6 +6,7 @@ import com.yaoyaozw.customer.entity.AuthorizerToken;
import com.yaoyaozw.customer.service.AuthorizerTokenService;
import com.yaoyaozw.customer.service.CustomerGraphicsDelayService;
import com.yaoyaozw.customer.service.wechat.service.WeChatService;
import com.yaoyaozw.customer.utils.YYZWDateUtil;
import com.yaoyaozw.customer.vo.customer.CustomerDelayItemVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......
......@@ -221,6 +221,7 @@ public class CustomerGraphicsServiceImpl extends ServiceImpl<CustomerGraphicsMap
List<CustomerGraphics> customerGraphicsList = list(new QueryWrapper<CustomerGraphics>().eq(CustomerGraphics.COL_POST_TIME, requestDate).eq(CustomerGraphics.COL_SEND_STATUS,9));
if(!customerGraphicsList.isEmpty()){
for (CustomerGraphics customerGraphics : customerGraphicsList) {
//人群包id
Long packId = customerGraphics.getPackId();
......@@ -255,6 +256,7 @@ public class CustomerGraphicsServiceImpl extends ServiceImpl<CustomerGraphicsMap
}
updateBatchById(customerGraphicsList);
}
}
private BaseResult checkExtendBook(String storeType, CrowdPackageConditionMatch storeConditionMatch) {
// 判断有没有选书城条件
......
......@@ -41,6 +41,8 @@ public class WeChatServiceImpl implements WeChatService{
private static final Integer EXPIRED_CODE=40001;
private static final Integer FORBID_Time=6;
private static final ThreadPoolExecutor EXECUTOR = new ThreadPoolExecutor(20, 100, 60L, TimeUnit.SECONDS, new LinkedBlockingQueue<>(2),new ThreadPoolExecutor.CallerRunsPolicy());
private final static Object CUSTOMER_LOCK=new Object();
......@@ -57,6 +59,11 @@ public class WeChatServiceImpl implements WeChatService{
public Future<CustomerDelayPublish> sendCustomerDelayMessage( AuthorizerToken authorizerToken, CustomerDelayPublish user,
Map<Integer,List<CustomerDelayItemVO>> delaySortMap,
Set<CustomerDelayItemVO> needUpdateVoList) {
//获取当前小时数
Calendar instance = Calendar.getInstance();
int i = instance.get(Calendar.HOUR_OF_DAY);
//早上0-6点不发
if (i<FORBID_Time){
//token
UriComponentsBuilder uriComponentsBuilder = UriComponentsBuilder.fromHttpUrl(customerPath).queryParam("access_token",authorizerToken.getAuthorizerAccessToken());
//找到延时序列
......@@ -97,6 +104,7 @@ public class WeChatServiceImpl implements WeChatService{
}
}
}
}
//用户首次活跃时间
Long subscribeTimestamp = user.getFirstActive()!=null?user.getFirstActive().getTime():user.getGmtCreate().getTime();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论