提交 0e6ca380 作者: gh

月平均付费修正

上级 7e4cf8cc
......@@ -46,7 +46,7 @@ public class SchedulingTask {
/**
* 拉取付费订单(每15min一次)
*/
@Scheduled(cron = "0 5/15 * * * *")
//@Scheduled(cron = "0 5/15 * * * *")
public void retrieveOrderData(){
Calendar calendar = Calendar.getInstance();
......@@ -59,13 +59,13 @@ public class SchedulingTask {
integrationRequestDTO.setRequestDate(calendar.getTime());
accountOrderService.activeUserByOrder(integrationRequestDTO);
//accountOrderService.activeUserByOrder(integrationRequestDTO);
}
/**
* 更新付费用户近一月平均充值(每天一次:4点10分)
*/
@Scheduled(cron = "0 10 4 * * *")
//@Scheduled(cron = "0 10 4 * * *")
public void retrieveMonthOrder(){
Calendar calendar = Calendar.getInstance();
......@@ -78,7 +78,7 @@ public class SchedulingTask {
integrationRequestDTO.setRequestDate(calendar.getTime());
accountOrderService.calculateAvgMonth(integrationRequestDTO);
//accountOrderService.calculateAvgMonth(integrationRequestDTO);
}
......
......@@ -222,6 +222,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()){
LOCAL_LOG.info("start sendCustomerMessage");
for (CustomerGraphics customerGraphics : customerGraphicsList) {
//人群包id
Long packId = customerGraphics.getPackId();
......@@ -255,6 +256,7 @@ public class CustomerGraphicsServiceImpl extends ServiceImpl<CustomerGraphicsMap
}
}
updateBatchById(customerGraphicsList);
LOCAL_LOG.info("end sendCustomerMessage");
}
}
......
......@@ -35,13 +35,13 @@ public class WeChatServiceImpl implements WeChatService{
private static final String CUSTOMER_NEWS="news";
private static final int THREAD_NUM=1000;
private static final int THREAD_SIZE=1000;
private static final Integer SUCCESS_CODE=0;
private static final Integer EXPIRED_CODE=40001;
private static final Integer FORBID_Time=6;
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());
......@@ -63,7 +63,7 @@ public class WeChatServiceImpl implements WeChatService{
Calendar instance = Calendar.getInstance();
int i = instance.get(Calendar.HOUR_OF_DAY);
//早上0-6点不发
if (i<FORBID_Time){
if (i<FORBID_TIME){
//token
UriComponentsBuilder uriComponentsBuilder = UriComponentsBuilder.fromHttpUrl(customerPath).queryParam("access_token",authorizerToken.getAuthorizerAccessToken());
//找到延时序列
......@@ -135,9 +135,9 @@ public class WeChatServiceImpl implements WeChatService{
//计数器
CountDownLatch latch = new CountDownLatch(openidList.size());
for (int i = 0; i < openidList.size(); i+=THREAD_NUM) {
for (int i = 0; i < openidList.size(); i+=THREAD_SIZE) {
List<CrowdPackageUserVO> subOpenidList = openidList.subList(i, Math.min(i + THREAD_NUM, openidList.size()));
List<CrowdPackageUserVO> subOpenidList = openidList.subList(i, Math.min(i + THREAD_SIZE, openidList.size()));
//TODO:配置多线程+测试+记录发送量
EXECUTOR.execute(()->{
......@@ -146,7 +146,6 @@ public class WeChatServiceImpl implements WeChatService{
customerRequest.setTouser(crowdPackageUserVO.getOpenId());
try {
System.err.println(customerRequest.getTouser());
WeChatResponseEntity response=(WeChatResponseEntity)weChatRestService.httpPostRequest(uriComponentsBuilder, customerRequest,WeChatResponseEntity.class);
......@@ -156,7 +155,6 @@ public class WeChatServiceImpl implements WeChatService{
//发送成功计数
customerGraphics.updateCount();
}
System.err.println(response);
}else if(EXPIRED_CODE.equals(response.getErrcode()) ){
Thread.sleep(500);
//token过期重新取一下
......
......@@ -37,7 +37,7 @@
<select id="findMonthDailyAccountOrder" resultType="com.yaoyaozw.customer.vo.kanban.UserAvgAmountVO">
SELECT
open_id,convert(SUM(profit)/(if(datediff(CURDATE(),user_subscribe_time)&lt;30,datediff(CURDATE(),user_subscribe_time),30)),decimal(8,2))
open_id,convert(SUM(profit)/(if(datediff(CURDATE(),user_subscribe_time)&lt;30,datediff(CURDATE(),user_subscribe_time),30)),decimal(8,2)) as avgAmount
FROM
account_order
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论