Commit 9569744a by 吕明尚

修改定时任务

parent f5228c68
...@@ -90,7 +90,7 @@ spring: ...@@ -90,7 +90,7 @@ spring:
master: master:
url: jdbc:mysql://129.211.46.84:3306/sharedb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8 url: jdbc:mysql://129.211.46.84:3306/sharedb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8
username: root username: root
password: whxz2019 password: Whxz@2019
# 从库数据源 # 从库数据源
slave: slave:
# 从数据源开关/默认关闭 # 从数据源开关/默认关闭
...@@ -152,7 +152,7 @@ spring: ...@@ -152,7 +152,7 @@ spring:
# 密码 # 密码
# password: whxz2019 # password: whxz2019
# password: 123456 # password: 123456
password: ZmWISp5@ password: ErRQcVj1hSwl
# 连接超时时间 # 连接超时时间
timeout: 10s timeout: 10s
lettuce: lettuce:
......
...@@ -90,7 +90,7 @@ spring: ...@@ -90,7 +90,7 @@ spring:
master: master:
url: jdbc:mysql://129.211.46.84:3306/sharedb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8 url: jdbc:mysql://129.211.46.84:3306/sharedb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8
username: root username: root
password: whxz2019 password: Whxz@2019
# 从库数据源 # 从库数据源
slave: slave:
# 从数据源开关/默认关闭 # 从数据源开关/默认关闭
...@@ -152,7 +152,7 @@ spring: ...@@ -152,7 +152,7 @@ spring:
# 密码 # 密码
# password: whxz2019 # password: whxz2019
# password: 123456 # password: 123456
password: ZmWISp5@ password: ErRQcVj1hSwl
# 连接超时时间 # 连接超时时间
timeout: 10s timeout: 10s
lettuce: lettuce:
......
...@@ -42,6 +42,7 @@ public class CouponRetryTask { ...@@ -42,6 +42,7 @@ public class CouponRetryTask {
@XxlJob("AuToRetryCoupon") @XxlJob("AuToRetryCoupon")
public void AuToRetryCoupon() { public void AuToRetryCoupon() {
logger.debug("AuToRetryCoupon:自动重新验卷开始");
LambdaQueryWrapper<SConsumerCoupon> consumerCouponWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SConsumerCoupon> consumerCouponWrapper = new LambdaQueryWrapper<>();
consumerCouponWrapper.eq(SConsumerCoupon::getUseStatus, UserStatusEnum.UNUSED.getCode()); consumerCouponWrapper.eq(SConsumerCoupon::getUseStatus, UserStatusEnum.UNUSED.getCode());
consumerCouponWrapper.eq(SConsumerCoupon::getIsDelete, YesNoEnum.no.getIndex()); consumerCouponWrapper.eq(SConsumerCoupon::getIsDelete, YesNoEnum.no.getIndex());
...@@ -56,11 +57,13 @@ public class CouponRetryTask { ...@@ -56,11 +57,13 @@ public class CouponRetryTask {
if (!CollectionUtils.isEmpty(expiredSConsumerCounpons)) { if (!CollectionUtils.isEmpty(expiredSConsumerCounpons)) {
sConsumerCouponService.updateBatchById(expiredSConsumerCounpons); sConsumerCouponService.updateBatchById(expiredSConsumerCounpons);
} }
logger.debug("AuToRetryCoupon:自动重新验卷结束");
} }
// 自动生成优惠卷购买金额 // 自动生成优惠卷购买金额
@XxlJob("AutoGenerateCoupon") @XxlJob("AutoGenerateCoupon")
public void AutoGenerateCoupon() { public void AutoGenerateCoupon() {
logger.debug("AutoGenerateCoupon:自动生成优惠卷购买金额开始");
LambdaQueryWrapper<SConsumerCoupon> consumerCouponWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SConsumerCoupon> consumerCouponWrapper = new LambdaQueryWrapper<>();
List<SStore> list = storeService.list(); List<SStore> list = storeService.list();
list = list.stream().filter(item -> item.getOpenShopUuid() != null).collect(Collectors.toList()); list = list.stream().filter(item -> item.getOpenShopUuid() != null).collect(Collectors.toList());
...@@ -112,6 +115,7 @@ public class CouponRetryTask { ...@@ -112,6 +115,7 @@ public class CouponRetryTask {
sConsumerCouponService.updateBatchById(updatedCoupons); sConsumerCouponService.updateBatchById(updatedCoupons);
} }
} }
logger.debug("AutoGenerateCoupon:自动生成优惠卷购买金额结束");
} }
private void processCoupons(List<SConsumerCoupon> coupons, List<SStore> stores) { private void processCoupons(List<SConsumerCoupon> coupons, List<SStore> stores) {
...@@ -153,6 +157,7 @@ public class CouponRetryTask { ...@@ -153,6 +157,7 @@ public class CouponRetryTask {
@XxlJob("AutoUpdateCouponPromotionPrice") @XxlJob("AutoUpdateCouponPromotionPrice")
public void AutoUpdateCouponPromotionPrice() { public void AutoUpdateCouponPromotionPrice() {
logger.debug("AutoUpdateCouponPromotionPrice:自动更新优惠券促销金额开始");
try { try {
LambdaQueryWrapper<SCoupon> sCouponLambdaQueryWrapper = Wrappers.lambdaQuery(SCoupon.class); LambdaQueryWrapper<SCoupon> sCouponLambdaQueryWrapper = Wrappers.lambdaQuery(SCoupon.class);
sCouponLambdaQueryWrapper.isNotNull(SCoupon::getSalePrice); sCouponLambdaQueryWrapper.isNotNull(SCoupon::getSalePrice);
...@@ -208,12 +213,14 @@ public class CouponRetryTask { ...@@ -208,12 +213,14 @@ public class CouponRetryTask {
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
logger.debug("AutoUpdateCouponPromotionPrice:自动更新优惠券促销金额结束");
} }
//补齐美团团购id //补齐美团团购id
@XxlJob("AutoGenerateTuangouId") @XxlJob("AutoGenerateTuangouId")
public void AutoGenerateTuangouId() { public void AutoGenerateTuangouId() {
logger.debug("AutoGenerateTuangouId:补齐美团团购id开始");
LambdaQueryWrapper<SConsumerCoupon> consumerCouponWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SConsumerCoupon> consumerCouponWrapper = new LambdaQueryWrapper<>();
consumerCouponWrapper.eq(SConsumerCoupon::getIsDelete, YesNoEnum.no.getIndex()); consumerCouponWrapper.eq(SConsumerCoupon::getIsDelete, YesNoEnum.no.getIndex());
consumerCouponWrapper.isNull(SConsumerCoupon::getDealgroupId); consumerCouponWrapper.isNull(SConsumerCoupon::getDealgroupId);
...@@ -240,5 +247,6 @@ public class CouponRetryTask { ...@@ -240,5 +247,6 @@ public class CouponRetryTask {
} }
if (!CollectionUtils.isEmpty(sConsumerCouponList)) if (!CollectionUtils.isEmpty(sConsumerCouponList))
sConsumerCouponService.updateBatchById(sConsumerCouponList); sConsumerCouponService.updateBatchById(sConsumerCouponList);
logger.debug("AutoGenerateTuangouId:补齐美团团购id结束");
} }
} }
...@@ -43,6 +43,7 @@ public class DeviceTask { ...@@ -43,6 +43,7 @@ public class DeviceTask {
*/ */
@XxlJob("deviceGatewayStatusMonitor") @XxlJob("deviceGatewayStatusMonitor")
public void deviceGatewayStatusMonitor() { public void deviceGatewayStatusMonitor() {
log.debug("deviceGatewayStatusMonitor:设备网关状态监控开始");
// 更新网关状态 // 更新网关状态
List<DeviceGateway> list = deviceGatewayService.deviceGatewayStatusMonitor(); List<DeviceGateway> list = deviceGatewayService.deviceGatewayStatusMonitor();
if (list.size() > 0) { if (list.size() > 0) {
...@@ -51,10 +52,12 @@ public class DeviceTask { ...@@ -51,10 +52,12 @@ public class DeviceTask {
deviceGatewayService.sendSmsByStatusOff(deviceGateway); deviceGatewayService.sendSmsByStatusOff(deviceGateway);
}); });
} }
log.debug("deviceGatewayStatusMonitor:设备网关状态监控结束");
} }
@XxlJob("updateDeviceDoorLockPassword") @XxlJob("updateDeviceDoorLockPassword")
public void updateDeviceDoorLockPassword() { public void updateDeviceDoorLockPassword() {
log.debug("updateDeviceDoorLockPassword:每周一修改房间门锁密码开始");
String jobParam = XxlJobHelper.getJobParam(); String jobParam = XxlJobHelper.getJobParam();
Integer validTime = Integer.getInteger(jobParam); Integer validTime = Integer.getInteger(jobParam);
log.debug("jobParam:" + jobParam); log.debug("jobParam:" + jobParam);
...@@ -63,6 +66,7 @@ public class DeviceTask { ...@@ -63,6 +66,7 @@ public class DeviceTask {
} }
// 更新所有门锁设备开锁密码 // 更新所有门锁设备开锁密码
deviceService.updateDeviceDoorLockPassword(validTime); deviceService.updateDeviceDoorLockPassword(validTime);
log.debug("updateDeviceDoorLockPassword:每周一修改房间门锁密码结束");
} }
} }
...@@ -161,6 +161,7 @@ public class OrderTask { ...@@ -161,6 +161,7 @@ public class OrderTask {
*/ */
@XxlJob("refundApply") @XxlJob("refundApply")
public void refundApply() { public void refundApply() {
logger.debug("refundApply:执行 用户退款申请开始");
String redisKey = Constants.ORDER_TASK_REDIS_KEY_AFTER_REFUND_BY_USER; String redisKey = Constants.ORDER_TASK_REDIS_KEY_AFTER_REFUND_BY_USER;
Long size = redisUtil.getListSize(redisKey); Long size = redisUtil.getListSize(redisKey);
logger.debug("OrderTask.refundApply | size:" + size); logger.debug("OrderTask.refundApply | size:" + size);
...@@ -188,6 +189,7 @@ public class OrderTask { ...@@ -188,6 +189,7 @@ public class OrderTask {
redisUtil.lPush(redisKey, orderId); redisUtil.lPush(redisKey, orderId);
} }
} }
logger.debug("refundApply:执行 用户退款申请结束");
} }
/** /**
...@@ -234,6 +236,7 @@ public class OrderTask { ...@@ -234,6 +236,7 @@ public class OrderTask {
//预约订单到期自动更新订单状态,更新房间状态 //预约订单到期自动更新订单状态,更新房间状态
@XxlJob("autoToStore") @XxlJob("autoToStore")
public void autoToStore() { public void autoToStore() {
logger.debug("autoToStore:预约订单到期自动更新订单状态,更新房间状态开始");
//查询所有已支付的订单 //查询所有已支付的订单
Set<String> keys = redisTemplate.keys(ReceiptRdeisEnum.ORDER_NO.getValue() + "*"); Set<String> keys = redisTemplate.keys(ReceiptRdeisEnum.ORDER_NO.getValue() + "*");
if (keys.size() == 0) { if (keys.size() == 0) {
...@@ -319,6 +322,7 @@ public class OrderTask { ...@@ -319,6 +322,7 @@ public class OrderTask {
logger.error("预约订单到期自动更新订单状态失败!"); logger.error("预约订单到期自动更新订单状态失败!");
throw new BaseException("预约订单到期自动更新订单状态失败!"); throw new BaseException("预约订单到期自动更新订单状态失败!");
} }
logger.debug("autoToStore:预约订单到期自动更新订单状态,更新房间状态结束");
} }
/** /**
...@@ -327,6 +331,7 @@ public class OrderTask { ...@@ -327,6 +331,7 @@ public class OrderTask {
*/ */
@XxlJob("orderCompensate") @XxlJob("orderCompensate")
public void orderCompensate() { public void orderCompensate() {
logger.debug("orderCompensate:房间、订单状态监控开始");
// 订单状态处理 // 订单状态处理
LambdaQueryWrapper<SOrder> queryWrapper = new LambdaQueryWrapper(); LambdaQueryWrapper<SOrder> queryWrapper = new LambdaQueryWrapper();
queryWrapper.le(SOrder::getEndDate, DateUtil.offset(DateUtil.date(), DateField.MINUTE, -2)); queryWrapper.le(SOrder::getEndDate, DateUtil.offset(DateUtil.date(), DateField.MINUTE, -2));
...@@ -390,6 +395,7 @@ public class OrderTask { ...@@ -390,6 +395,7 @@ public class OrderTask {
roomService.updateBatchById(roomList, roomList.size()); roomService.updateBatchById(roomList, roomList.size());
} }
} }
logger.debug("orderCompensate:房间、订单状态监控结束");
} }
} }
...@@ -127,6 +127,7 @@ public class RedisTask { ...@@ -127,6 +127,7 @@ public class RedisTask {
*/ */
@XxlJob("AutoDelRefundedCoupon") @XxlJob("AutoDelRefundedCoupon")
public void AutoDelRefundedCoupon() { public void AutoDelRefundedCoupon() {
logger.debug("AutoDelRefundedCoupon:定时自动删除异常优惠券开始");
//获取所有待使用的优惠卷 //获取所有待使用的优惠卷
LambdaQueryWrapper<SConsumerCoupon> wrapper = Wrappers.lambdaQuery(); LambdaQueryWrapper<SConsumerCoupon> wrapper = Wrappers.lambdaQuery();
wrapper.eq(SConsumerCoupon::getUseStatus, CouponStatusEnum.NORMAL.getValue()); wrapper.eq(SConsumerCoupon::getUseStatus, CouponStatusEnum.NORMAL.getValue());
...@@ -171,6 +172,7 @@ public class RedisTask { ...@@ -171,6 +172,7 @@ public class RedisTask {
} }
if (!CollectionUtils.isEmpty(expiredCoupons)) isConsumerCouponService.removeByIdList(expiredCoupons); if (!CollectionUtils.isEmpty(expiredCoupons)) isConsumerCouponService.removeByIdList(expiredCoupons);
} }
logger.debug("AutoDelRefundedCoupon:定时自动删除异常优惠券结束");
} }
public void processAutoReceiptCode() { public void processAutoReceiptCode() {
...@@ -221,6 +223,7 @@ public class RedisTask { ...@@ -221,6 +223,7 @@ public class RedisTask {
@XxlJob("AutomaticMtSessionKey") @XxlJob("AutomaticMtSessionKey")
public void AutomaticMtSessionKey() { public void AutomaticMtSessionKey() {
logger.debug("AutomaticMtSessionKey:自动续期session开始");
Boolean b = redisTemplate.hasKey(ReceiptRdeisEnum.MT_SESSION_KEY.getValue()); Boolean b = redisTemplate.hasKey(ReceiptRdeisEnum.MT_SESSION_KEY.getValue());
if (!b) { if (!b) {
JSONObject o = new JSONObject(redisTemplate.opsForValue().get(ReceiptRdeisEnum.MT_SESSION_OBJECT_KEY.getValue())); JSONObject o = new JSONObject(redisTemplate.opsForValue().get(ReceiptRdeisEnum.MT_SESSION_OBJECT_KEY.getValue()));
...@@ -236,12 +239,13 @@ public class RedisTask { ...@@ -236,12 +239,13 @@ public class RedisTask {
tiktokService.clientToken(); tiktokService.clientToken();
} }
wechatNewService.getPublicAccessToken(); wechatNewService.getPublicAccessToken();
logger.debug("AutomaticMtSessionKey:自动续期session结束");
} }
//自动添加保洁记录 //自动添加保洁记录
@XxlJob("AutoAddSCleanRecords") @XxlJob("AutoAddSCleanRecords")
public void AutoAddSCleanRecords() { public void AutoAddSCleanRecords() {
logger.debug("AutoAddSCleanRecords:自动添加保洁记录开始");
Set<String> keys = redisTemplate.keys(ReceiptRdeisEnum.ORDER_NO_KEY.getValue() + "*"); Set<String> keys = redisTemplate.keys(ReceiptRdeisEnum.ORDER_NO_KEY.getValue() + "*");
if (keys.size() == 0) { if (keys.size() == 0) {
return; return;
...@@ -351,11 +355,12 @@ public class RedisTask { ...@@ -351,11 +355,12 @@ public class RedisTask {
logger.debug("订单号为:" + sOrder.getOrderNo() + "的订单已结束,更改订单状态为已使用"); logger.debug("订单号为:" + sOrder.getOrderNo() + "的订单已结束,更改订单状态为已使用");
} }
}); });
logger.debug("AutoAddSCleanRecords:自动添加保洁记录结束");
} }
@XxlJob("autoRoomExpireTime") @XxlJob("autoRoomExpireTime")
public void autoRoomExpireTime() { public void autoRoomExpireTime() {
logger.debug("autoRoomExpireTime:房间15分钟续单开始");
Set<String> keys = redisTemplate.keys(ReceiptRdeisEnum.ROOM_EXPIRE_TIME.getValue() + "*"); Set<String> keys = redisTemplate.keys(ReceiptRdeisEnum.ROOM_EXPIRE_TIME.getValue() + "*");
if (keys.size() == 0) { if (keys.size() == 0) {
return; return;
...@@ -379,6 +384,7 @@ public class RedisTask { ...@@ -379,6 +384,7 @@ public class RedisTask {
redisUtil.delete(key); redisUtil.delete(key);
} }
}); });
logger.debug("autoRoomExpireTime:房间15分钟续单结束");
} }
private boolean extracted(String o, List<SOrder> sOrders, SOrder sOrder) { private boolean extracted(String o, List<SOrder> sOrders, SOrder sOrder) {
List<SOrder> sOrders1 = sOrders.stream().filter(item -> List<SOrder> sOrders1 = sOrders.stream().filter(item ->
...@@ -414,6 +420,7 @@ public class RedisTask { ...@@ -414,6 +420,7 @@ public class RedisTask {
*/ */
@XxlJob("monitorDeviceQueue") @XxlJob("monitorDeviceQueue")
public void monitorDeviceQueue() { public void monitorDeviceQueue() {
logger.debug("monitorDeviceQueue:设备消息队列监控开始");
Set<String> keys = redisTemplate.keys(MqttConstants.MQTT_STORE_LAST_TIME_KEY + "*"); Set<String> keys = redisTemplate.keys(MqttConstants.MQTT_STORE_LAST_TIME_KEY + "*");
if (keys.size() == 0) { if (keys.size() == 0) {
return; return;
...@@ -454,10 +461,12 @@ public class RedisTask { ...@@ -454,10 +461,12 @@ public class RedisTask {
} }
} }
}); });
logger.debug("monitorDeviceQueue:设备消息队列监控结束");
} }
@XxlJob("AutoOrderCancelPay") @XxlJob("AutoOrderCancelPay")
public void AutoOrderCancelPay() { public void AutoOrderCancelPay() {
logger.debug("AutoOrderCancelPay:延时订单取消支付开始");
Set<String> keys = redisTemplate.keys(ReceiptRdeisEnum.ORDER_CANCEL_PAY + "*"); Set<String> keys = redisTemplate.keys(ReceiptRdeisEnum.ORDER_CANCEL_PAY + "*");
if (keys.size() == 0) { if (keys.size() == 0) {
return; return;
...@@ -480,6 +489,7 @@ public class RedisTask { ...@@ -480,6 +489,7 @@ public class RedisTask {
} }
} }
}); });
logger.debug("AutoOrderCancelPay:延时订单取消支付结束");
} }
/** /**
...@@ -487,6 +497,7 @@ public class RedisTask { ...@@ -487,6 +497,7 @@ public class RedisTask {
*/ */
@XxlJob("AutoEquityMembersSms") @XxlJob("AutoEquityMembersSms")
public void AutoEquityMembersSms() { public void AutoEquityMembersSms() {
logger.debug("AutoEquityMembersSms:自动发送权益会员过期短信开始");
Set<String> keys = redisTemplate.keys(ReceiptRdeisEnum.EQUITY_MEMBERS_TIME + "*"); Set<String> keys = redisTemplate.keys(ReceiptRdeisEnum.EQUITY_MEMBERS_TIME + "*");
if (keys.size() == 0) { if (keys.size() == 0) {
return; return;
...@@ -503,14 +514,16 @@ public class RedisTask { ...@@ -503,14 +514,16 @@ public class RedisTask {
SConsumer sConsumer = sConsumerService.getById(consumerId); SConsumer sConsumer = sConsumerService.getById(consumerId);
logger.debug("手机号为:{}的用户年度权益会员将在3天后失效", sConsumer.getPhone()); logger.debug("手机号为:{}的用户年度权益会员将在3天后失效", sConsumer.getPhone());
smsService.sendOneSms(sConsumer.getPhone(), "年度权益会员将在3天后失效,请及时续约保障权益会员的权益"); smsService.sendOneSms(sConsumer.getPhone(), "年度权益会员将在3天后失效,请及时续约保障权益会员的权益");
redisUtil.delete(key); // redisUtil.delete(key);
} }
}); });
logger.debug("AutoEquityMembersSms:自动发送权益会员过期短信结束");
} }
//权益会员降级 //权益会员降级
@XxlJob("AutoUpdateEquityMembers") @XxlJob("AutoUpdateEquityMembers")
public void AutoUpdateEquityMembers() { public void AutoUpdateEquityMembers() {
logger.debug("AutoUpdateEquityMembers:权益会员降级开始");
Set<String> keys = redisTemplate.keys(ReceiptRdeisEnum.EQUITY_MEMBERS_TIME + "*"); Set<String> keys = redisTemplate.keys(ReceiptRdeisEnum.EQUITY_MEMBERS_TIME + "*");
if (keys.size() == 0) { if (keys.size() == 0) {
return; return;
...@@ -540,6 +553,7 @@ public class RedisTask { ...@@ -540,6 +553,7 @@ public class RedisTask {
redisUtil.delete(key); redisUtil.delete(key);
} }
}); });
logger.debug("AutoUpdateEquityMembers:权益会员降级结束");
} }
/** /**
...@@ -547,6 +561,7 @@ public class RedisTask { ...@@ -547,6 +561,7 @@ public class RedisTask {
*/ */
@XxlJob("AutoProgressLog") @XxlJob("AutoProgressLog")
public void AutoProgressLog() { public void AutoProgressLog() {
logger.debug("AutoProgressLog:会员等级滚动降级开始");
//查询1年之前的数据 //查询1年之前的数据
List<MemberProgressLog> list = memberProgressLogService.list(new LambdaQueryWrapper<MemberProgressLog>() List<MemberProgressLog> list = memberProgressLogService.list(new LambdaQueryWrapper<MemberProgressLog>()
.lt(MemberProgressLog::getExpirationTime, new Date()) .lt(MemberProgressLog::getExpirationTime, new Date())
...@@ -564,6 +579,10 @@ public class RedisTask { ...@@ -564,6 +579,10 @@ public class RedisTask {
if (memberProgressLogs.size() > 0) { if (memberProgressLogs.size() > 0) {
//查询会员 //查询会员
ConsumerMember consumerMember = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::getConsumerId, item)); ConsumerMember consumerMember = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::getConsumerId, item));
if (consumerMember.getMembershipProgress().equals(BigDecimal.ZERO)) {
//结束此次循环
return;
}
//查询会员配置 //查询会员配置
MemberConfig memberConfig = memberConfigService.getById(consumerMember.getMemberConfigId()); MemberConfig memberConfig = memberConfigService.getById(consumerMember.getMemberConfigId());
final BigDecimal[] sum = {BigDecimal.ZERO}; final BigDecimal[] sum = {BigDecimal.ZERO};
...@@ -575,7 +594,9 @@ public class RedisTask { ...@@ -575,7 +594,9 @@ public class RedisTask {
sum[0] = sum[0].subtract(log.getVariableProgress()); sum[0] = sum[0].subtract(log.getVariableProgress());
} }
}); });
if (consumerMember.getMembershipProgress().compareTo(sum[0]) < 0) { //判断会员进度是否小于扣除进度的绝对值
if (consumerMember.getMembershipProgress().compareTo(sum[0].abs()) < 0) {
//设置为0
consumerMember.setMembershipProgress(BigDecimal.ZERO); consumerMember.setMembershipProgress(BigDecimal.ZERO);
consumerMember.setMembershipLevel(0L); consumerMember.setMembershipLevel(0L);
MemberConfig memberConfigServiceOne = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>() MemberConfig memberConfigServiceOne = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>()
...@@ -583,13 +604,17 @@ public class RedisTask { ...@@ -583,13 +604,17 @@ public class RedisTask {
.eq(MemberConfig::getMembershipLevel, consumerMember.getMembershipLevel()) .eq(MemberConfig::getMembershipLevel, consumerMember.getMembershipLevel())
); );
consumerMember.setMemberConfigId(memberConfigServiceOne.getId()); consumerMember.setMemberConfigId(memberConfigServiceOne.getId());
} else //判断会员进度是否大于扣除进度
//判断会员进度是否大于扣除进度 } else if (consumerMember.getMembershipProgress().compareTo(sum[0].abs()) >= 0) {
if (consumerMember.getMembershipProgress().compareTo(sum[0]) >= 0) {
//会员进度减去扣除进度 //会员进度减去扣除进度
BigDecimal subtract = consumerMember.getMembershipProgress().subtract(sum[0]); BigDecimal subtract = BigDecimal.ZERO;
if (sum[0].compareTo(BigDecimal.ZERO) < 0) {
subtract = consumerMember.getMembershipProgress().add(sum[0]);
} else if (sum[0].compareTo(BigDecimal.ZERO) > 0) {
subtract = consumerMember.getMembershipProgress().subtract(sum[0]);
}
consumerMember.setMembershipProgress(subtract); consumerMember.setMembershipProgress(subtract);
if (subtract.compareTo(BigDecimal.valueOf(memberConfig.getLimitRequirements())) < 0) { if (consumerMember.getMembershipProgress().compareTo(BigDecimal.valueOf(memberConfig.getLimitRequirements())) < 0) {
//等级降一级 //等级降一级
if (consumerMember.getMembershipLevel() > 0L) { if (consumerMember.getMembershipLevel() > 0L) {
consumerMember.setMembershipLevel(consumerMember.getMembershipLevel() - 1); consumerMember.setMembershipLevel(consumerMember.getMembershipLevel() - 1);
...@@ -604,6 +629,7 @@ public class RedisTask { ...@@ -604,6 +629,7 @@ public class RedisTask {
consumerMemberService.updateConsumerMember(consumerMember); consumerMemberService.updateConsumerMember(consumerMember);
} }
}); });
logger.debug("AutoProgressLog:会员等级滚动降级结束");
} }
...@@ -656,6 +682,7 @@ public class RedisTask { ...@@ -656,6 +682,7 @@ public class RedisTask {
//自动更新用户unionid //自动更新用户unionid
@XxlJob("AutoUpdateOpenid") @XxlJob("AutoUpdateOpenid")
public void AutoUpdateOpenid() { public void AutoUpdateOpenid() {
logger.debug("AutoUpdateOpenid:自动更新用户unionid开始");
List<SConsumerToken> sConsumerTokenList = sConsumerTokenService.list(new LambdaQueryWrapper<SConsumerToken>().isNotNull(SConsumerToken::getUnionId).isNull(SConsumerToken::getOpenId)); List<SConsumerToken> sConsumerTokenList = sConsumerTokenService.list(new LambdaQueryWrapper<SConsumerToken>().isNotNull(SConsumerToken::getUnionId).isNull(SConsumerToken::getOpenId));
if (CollectionUtils.isEmpty(sConsumerTokenList)) { if (CollectionUtils.isEmpty(sConsumerTokenList)) {
return; return;
...@@ -689,5 +716,6 @@ public class RedisTask { ...@@ -689,5 +716,6 @@ public class RedisTask {
} }
} }
}); });
logger.debug("AutoUpdateOpenid:自动更新用户unionid结束");
} }
} }
...@@ -51,7 +51,7 @@ saobei: ...@@ -51,7 +51,7 @@ saobei:
# 开发环境配置 # 开发环境配置
server: server:
# 服务器的HTTP端口,默认为8080 # 服务器的HTTP端口,默认为8080
port: 8882 port: 8884
servlet: servlet:
# 应用的访问路径 # 应用的访问路径
context-path: / context-path: /
...@@ -151,7 +151,7 @@ spring: ...@@ -151,7 +151,7 @@ spring:
database: 0 database: 0
# 密码 # 密码
# password: whxz2019 # password: whxz2019
password: 123456 password: ErRQcVj1hSwl
# 连接超时时间 # 连接超时时间
timeout: 10s timeout: 10s
lettuce: lettuce:
...@@ -246,8 +246,8 @@ xxl: ...@@ -246,8 +246,8 @@ xxl:
executor: executor:
address: '' address: ''
#执行器名字,需要和网页中新建的执行器名字一致 #执行器名字,需要和网页中新建的执行器名字一致
appname: share-quartz-test appname: share-quartz-dev
ip: '' ip: ''
logpath: /var/gxpt/logs/xxl-job/jobhandler logpath: /var/gxpt/logs/xxl-job/jobhandler
logRetentionDays: 30 logRetentionDays: 30
port: 9998 port: 8885
\ No newline at end of file \ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment