190 lines
6.9 KiB
Java
190 lines
6.9 KiB
Java
package com.hzs.third.job;
|
|
|
|
import com.hzs.activity.pick.IAcRetailPickLogServiceApi;
|
|
import com.hzs.bonus.detail.ICuRegionAssessApi;
|
|
import com.hzs.common.core.domain.R;
|
|
import com.hzs.common.core.utils.DateUtils;
|
|
import com.hzs.member.base.ICuMemberRetailRegionServiceApi;
|
|
import com.hzs.member.base.IMemberServiceApi;
|
|
import com.hzs.member.statis.ICuBonusStatisServiceApi;
|
|
import com.hzs.member.statis.ICuBonusVertexStatisServiceApi;
|
|
import com.hzs.report.stat.IMemberReportServiceApi;
|
|
import com.hzs.retail.member.IMemberRetailApi;
|
|
import com.xxl.job.core.handler.annotation.XxlJob;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
import java.time.temporal.ChronoUnit;
|
|
import java.util.Date;
|
|
|
|
@ConditionalOnProperty(name = "xxl-job.start", havingValue = "true")
|
|
@Component
|
|
@Slf4j
|
|
public class MemberJob {
|
|
|
|
@DubboReference
|
|
IMemberServiceApi iMemberServiceApi;
|
|
@DubboReference
|
|
IMemberRetailApi iMemberRetailApi;
|
|
@DubboReference
|
|
ICuBonusStatisServiceApi iCuBonusStatisServiceApi;
|
|
@DubboReference
|
|
ICuBonusVertexStatisServiceApi iCuBonusVertexStatisServiceApi;
|
|
@DubboReference
|
|
ICuMemberRetailRegionServiceApi iCuMemberRetailRegionServiceApi;
|
|
@DubboReference
|
|
IAcRetailPickLogServiceApi iAcRetailPickLogServiceApi;
|
|
@DubboReference
|
|
IMemberReportServiceApi iMemberReportServiceApi;
|
|
@DubboReference
|
|
ICuRegionAssessApi iCuRegionAssessApi;
|
|
|
|
/**
|
|
* 定时统计奖金拨比
|
|
*/
|
|
@XxlJob("bonus-statis")
|
|
public void cuBonusStatis() {
|
|
//查询前一天的订单和奖金
|
|
Date date = DateUtils.currentDate();
|
|
date = DateUtils.beforeDate(1, ChronoUnit.DAYS, date);
|
|
String payTimeStr = (DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, date));
|
|
R<Boolean> statis = iCuBonusStatisServiceApi.statisHistoryBonus(payTimeStr, payTimeStr);
|
|
if (!statis.getData()) {
|
|
log.info("{}-定时统计奖金拨统计失败", DateUtils.currentDate());
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 定时统计顶点奖金拨比
|
|
*/
|
|
@XxlJob("bonus-vertex-statis")
|
|
public void cuBonusVertexStatis() {
|
|
//查询前一天的订单和奖金
|
|
Date date = DateUtils.currentDate();
|
|
date = DateUtils.beforeDate(1, ChronoUnit.DAYS, date);
|
|
String payTimeStr = (DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, date));
|
|
R<Boolean> statis = iCuBonusVertexStatisServiceApi.anewStatisHistoryBonus(payTimeStr, payTimeStr);
|
|
if (!statis.getData()) {
|
|
log.info("{}-定时统计奖金拨统计失败", DateUtils.currentDate());
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 重算7天内奖金拨比
|
|
**/
|
|
@XxlJob("rerun-bonus-statis")
|
|
public void rerunCuBonusStatis() {
|
|
//查询前一天的订单和奖金
|
|
Date date = DateUtils.currentDate();
|
|
date = DateUtils.beforeDate(2, ChronoUnit.DAYS, date);
|
|
Date endDate = DateUtils.beforeDate(5, ChronoUnit.DAYS, date);
|
|
String endDateStr = (DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, date));
|
|
String startDateStr = (DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, endDate));
|
|
//删除前6天的数据
|
|
R<Boolean> delstatis = iCuBonusStatisServiceApi.delStatis(startDateStr, endDateStr);
|
|
if (delstatis.getData()) {
|
|
//重算前6天的数据
|
|
R<Boolean> statis = iCuBonusStatisServiceApi.statisHistoryBonus(startDateStr, endDateStr);
|
|
if (!statis.getData()) {
|
|
log.info("{}-重算7天定时统计奖金拨统计失败", DateUtils.currentDate());
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 7天重算顶点奖金拨比统计
|
|
**/
|
|
@XxlJob("rerun-bonus-vertex-statis")
|
|
public void rerunCuBonusVertexStatis() {
|
|
//查询前一天的订单和奖金
|
|
Date date = DateUtils.currentDate();
|
|
date = DateUtils.beforeDate(2, ChronoUnit.DAYS, date);
|
|
Date endDate = DateUtils.beforeDate(5, ChronoUnit.DAYS, date);
|
|
String endDateStr = (DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, date));
|
|
String startDateStr = (DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, endDate));
|
|
//删除前6天的数据
|
|
R<Boolean> delstatis = iCuBonusVertexStatisServiceApi.delStatis(startDateStr, endDateStr);
|
|
if (delstatis.getData()) {
|
|
//重算前6天的数据
|
|
R<Boolean> statis = iCuBonusVertexStatisServiceApi.anewStatisHistoryBonus(startDateStr, endDateStr);
|
|
if (!statis.getData()) {
|
|
log.info("{}-重算7天定时统计顶点奖金拨统计失败", DateUtils.currentDate());
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 定时清除未使用的会员编号
|
|
*/
|
|
@XxlJob("clear-member-empty-code")
|
|
public void clearMemberEmptyCode() {
|
|
log.info("clear-member-empty-code 开始执行!");
|
|
Integer dataCount = iMemberServiceApi.clearMemberEmptyCode().getData();
|
|
log.info("clear-member-empty-code 开始结束! 共处理:{}", dataCount);
|
|
}
|
|
|
|
/**
|
|
* 定时修改到期的零售区域
|
|
**/
|
|
@XxlJob("retail-region")
|
|
public void retailRegion() {
|
|
Date date = new Date();
|
|
Date startDate = DateUtils.beforeDate(2, ChronoUnit.DAYS, date);
|
|
Date endDate = DateUtils.afterDate(1, ChronoUnit.DAYS, date);
|
|
//批量修改已到期的会员收益区域
|
|
iCuRegionAssessApi.validateHandAreaAssess(startDate, endDate);
|
|
}
|
|
|
|
/**
|
|
* 定时校验会员收益区域
|
|
*/
|
|
@XxlJob("checkRegion")
|
|
public void checkRegion() {
|
|
// 定时校验会员收益区域
|
|
iMemberRetailApi.checkRegion();
|
|
}
|
|
|
|
/**
|
|
* 定时任务重复收益区域数据
|
|
*/
|
|
@XxlJob("handleRepeatRegion")
|
|
public void handleRepeatRegion() {
|
|
iCuMemberRetailRegionServiceApi.handleRepeatRegion();
|
|
}
|
|
|
|
/**
|
|
* 每月10号处理上个月提货赠送活动满足活动规则的数据
|
|
**/
|
|
@XxlJob("deliveryLog")
|
|
public void deliveryLog() {
|
|
iAcRetailPickLogServiceApi.deliveryLog();
|
|
}
|
|
|
|
/**
|
|
* 统计直推会员金额业绩盒数
|
|
**/
|
|
@XxlJob("sta-smount-box")
|
|
public void pushAmountBoxmethod() {
|
|
iMemberReportServiceApi.pushAmountBoxmethod();
|
|
}
|
|
|
|
/**
|
|
* 重算7天统计直推会员金额业绩盒数
|
|
**/
|
|
@XxlJob("repeat-sta-smount-box")
|
|
public void repeatPushAmountBoxmethod() {
|
|
//查询前一天的订单和奖金
|
|
Date date = DateUtils.currentDate();
|
|
date = DateUtils.beforeDate(2, ChronoUnit.DAYS, date);
|
|
Date endDate = DateUtils.beforeDate(5, ChronoUnit.DAYS, date);
|
|
String endDateStr = (DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, date));
|
|
String startDateStr = (DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, endDate));
|
|
//重算前6天的数据
|
|
iMemberReportServiceApi.repeatPushAmountBoxmethod(startDateStr, endDateStr);
|
|
}
|
|
|
|
|
|
}
|