|
|
@@ -3,6 +3,7 @@ package com.kxs.stat.biz.service.impl;
|
|
|
import cn.hutool.core.date.DatePattern;
|
|
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
|
|
import cn.hutool.core.util.NumberUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.kxs.common.core.constant.SecurityConstants;
|
|
|
import com.kxs.stat.api.model.KxsLkbTrade;
|
|
|
@@ -50,9 +51,16 @@ public class KxsUserTradeServiceImpl extends ServiceImpl<KxsUserTradeMapper, Kxs
|
|
|
|
|
|
@Override
|
|
|
@Async
|
|
|
- public void getUserTradeList() {
|
|
|
+ public void getUserTradeList(String para) {
|
|
|
//拼接表名
|
|
|
- String thisMoth = LocalDateTimeUtil.format(LocalDate.now(), DatePattern.SIMPLE_MONTH_PATTERN);
|
|
|
+ String thisMoth;
|
|
|
+ //如果定时任务传了参数就使用定时任务的参数
|
|
|
+ if(StrUtil.isNotBlank(para)){
|
|
|
+ thisMoth = para;
|
|
|
+ }else{
|
|
|
+ thisMoth = LocalDateTimeUtil.format(LocalDate.now(), DatePattern.SIMPLE_MONTH_PATTERN);
|
|
|
+ }
|
|
|
+
|
|
|
String tableName = PREFIX_TABLE_NAME + thisMoth;
|
|
|
|
|
|
int batchSize = 100;
|
|
|
@@ -120,13 +128,13 @@ public class KxsUserTradeServiceImpl extends ServiceImpl<KxsUserTradeMapper, Kxs
|
|
|
for (ShdTradeAmtVO kxsUserTrade : shdTradeAmtVOList) {
|
|
|
batch.add(kxsUserTrade);
|
|
|
if (batch.size() >= batchSize) {
|
|
|
- remoteUserShdStat(batch);
|
|
|
+ remoteUserShdStat(batch, thisMoth);
|
|
|
batch.clear();
|
|
|
}
|
|
|
}
|
|
|
// 处理最后一批数据
|
|
|
if (!batch.isEmpty()) {
|
|
|
- remoteUserShdStat(batch);
|
|
|
+ remoteUserShdStat(batch, thisMoth);
|
|
|
}
|
|
|
return null;
|
|
|
});
|
|
|
@@ -140,7 +148,7 @@ public class KxsUserTradeServiceImpl extends ServiceImpl<KxsUserTradeMapper, Kxs
|
|
|
}
|
|
|
|
|
|
|
|
|
- public void remoteUserShdStat(List<ShdTradeAmtVO> userTradeList) {
|
|
|
+ public void remoteUserShdStat(List<ShdTradeAmtVO> userTradeList, String month) {
|
|
|
List<IntegralStatDTO> params = new ArrayList<>();
|
|
|
for (ShdTradeAmtVO datum : userTradeList) {
|
|
|
|
|
|
@@ -162,7 +170,7 @@ public class KxsUserTradeServiceImpl extends ServiceImpl<KxsUserTradeMapper, Kxs
|
|
|
totalAmount = totalAmount.add(datum.getLkbActAmt());
|
|
|
}
|
|
|
if(totalAmount.compareTo(BigDecimal.valueOf(3000000)) >= 0){
|
|
|
- params.add(IntegralStatDTO.builder().userId(Long.valueOf(userId)).totalAmount(totalAmount).build());
|
|
|
+ params.add(IntegralStatDTO.builder().userId(Long.valueOf(userId)).tradeMonth(Integer.valueOf(month)).totalAmount(totalAmount).build());
|
|
|
log.info("用户{}交易额达标:{}", userId, totalAmount);
|
|
|
}
|
|
|
}
|