java-zk-app/bd-third/src/main/java/com/hzs/third/job/MemberJob.java

240 lines
8.1 KiB
Java
Raw Normal View History

2025-03-23 09:44:16 +08:00
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.hzs.system.config.IBdBarCodeServiceApi;
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;
/**
* @BelongsProject: hzs_cloud
* @BelongsPackage: com.hzs.third.job
* @Author: yh
* @CreateTime: 2023-04-27 09:31
* @Description:
* @Version: 1.0
*/
@ConditionalOnProperty(name = "xxl-job.start", havingValue = "true")
@Component
@Slf4j
public class MemberJob {
@DubboReference
IMemberServiceApi memberServiceApi;
@DubboReference
ICuBonusStatisServiceApi iCuBonusStatisServiceApi;
@DubboReference
ICuBonusVertexStatisServiceApi iCuBonusVertexStatisServiceApi;
@DubboReference
IBdBarCodeServiceApi iBdBarCodeServiceApi;
@DubboReference
ICuMemberRetailRegionServiceApi iCuMemberRetailRegionServiceApi;
@DubboReference
IMemberRetailApi iMemberRetailApi;
@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());
}
}
/**
* @description: 重算7天内奖金拨比
* @author: zhang jing
* @date: 2023/12/11 10:45
* @param: []
* @return: void
**/
@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());
}
}
}
/**
* @description: 7天重算顶点奖金拨比统计
* @author: zhang jing
* @date: 2024/8/15 10:29
* @param: []
* @return: void
**/
@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 = memberServiceApi.clearMemberEmptyCode().getData();
log.info("clear-member-empty-code 开始结束! 共处理:{}", dataCount);
}
/**
* 定时初始化条形码配置
*/
@XxlJob("updatWarehouseLogJob")
public void updatWarehouseLogJob() {
/**
* 查询初始化条形码配置,将当前尾号初始化为初始尾号
*/
iBdBarCodeServiceApi.updatWarehouseLog();
}
/**
* @description: 定时修改到期的零售区域
* @author: zhang jing
* @date: 2024/12/30 14:25
* @param: []
* @return: void
**/
@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();
}
/**
* @description: 每月10号处理上个月提货赠送活动满足活动规则的数据
* @author: zhang jing
* @date: 2025/2/6 10:59
* @param: []
* @return: void
**/
@XxlJob("deliveryLog")
public void deliveryLog() {
iAcRetailPickLogServiceApi.deliveryLog();
}
/**
* @description: 统计直推会员金额业绩盒数
* @author: zhang jing
* @date: 2025/2/12 16:09
* @param: []
* @return: void
**/
@XxlJob("sta-smount-box")
public void pushAmountBoxmethod() {
iMemberReportServiceApi.pushAmountBoxmethod();
}
/**
* @description: 重算7天统计直推会员金额业绩盒数
* @author: zhang jing
* @date: 2023/12/11 10:45
* @param: []
* @return: void
**/
@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);
}
}