82 lines
2.5 KiB
Java
82 lines
2.5 KiB
Java
package com.hzs.third.job;
|
||
|
||
import cn.hutool.core.collection.CollectionUtil;
|
||
import com.hzs.common.core.domain.R;
|
||
import com.hzs.common.domain.member.ext.CuMemberExt;
|
||
import com.hzs.member.account.IMemberJobServiceApi;
|
||
import com.hzs.member.base.IMemberServiceApi;
|
||
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.util.List;
|
||
|
||
/**
|
||
* 会员模块定时任务
|
||
*/
|
||
@ConditionalOnProperty(name = "xxl-job.start", havingValue = "true")
|
||
@Component
|
||
@Slf4j
|
||
public class CuMemberJob {
|
||
|
||
@DubboReference
|
||
IMemberJobServiceApi iMemberJobServiceApi;
|
||
@DubboReference
|
||
IMemberServiceApi iMemberServiceApi;
|
||
|
||
/**
|
||
* 定时插入账户详情数据
|
||
*/
|
||
@XxlJob("insertAccountDetail")
|
||
public void insertAccountDetail() {
|
||
iMemberJobServiceApi.insertAccountDetail();
|
||
}
|
||
|
||
/**
|
||
* 每月月初定时删除上上个月的数据
|
||
*/
|
||
@XxlJob("deleteAccountDetailByMonth")
|
||
public void deleteAccountDetailByMonth() {
|
||
iMemberJobServiceApi.deleteAccountDetailByMonth();
|
||
}
|
||
|
||
@XxlJob("sendPlaceErrorMsg")
|
||
public void sendPlaceErrorMsg() {
|
||
List<CuMemberExt> cuMemberList = iMemberServiceApi.queryPlaceErrorCode().getData();
|
||
if (CollectionUtil.isNotEmpty(cuMemberList)) {
|
||
StringBuilder sb = new StringBuilder();
|
||
for (CuMemberExt cuMemberExt : cuMemberList) {
|
||
Long pkPlaceParent = cuMemberExt.getPkPlaceParent();
|
||
Integer placeDept = cuMemberExt.getPlaceDept();
|
||
sb.append("会员ID: ").append(pkPlaceParent).append(" ,部门: ").append(placeDept).append(" ,");
|
||
}
|
||
sb.append("结算错误,安置有问题");
|
||
}
|
||
}
|
||
|
||
/**
|
||
* 提前四个月自动服务协议有效期续期一年
|
||
*/
|
||
@XxlJob("updateMemberWhiteExpireDate")
|
||
public void updateMemberExpireDate() {
|
||
R<?> result = iMemberServiceApi.updateMemberExpireDate();
|
||
if (!result.isSuccess()) {
|
||
log.error("提前四个月自动服务协议有效期续期一年,{}", result.getMsg());
|
||
}
|
||
}
|
||
|
||
/**
|
||
* 清除7天前0元会员
|
||
*/
|
||
@XxlJob("clearZeroMember")
|
||
public void clearZeroMember() {
|
||
R<?> result = iMemberJobServiceApi.clearZeroMember();
|
||
if (!result.isSuccess()) {
|
||
log.error("清除7天前0元会员失败,{}", result.getMsg());
|
||
}
|
||
}
|
||
|
||
}
|