提交 2c7e25f2 作者: 沈振路

Merge remote-tracking branch 'origin/master'

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