Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5595a8009b | |||
| 233c226dca | |||
| 76c6e12c72 | |||
| 5b030ea361 | |||
| 266e782fc0 | |||
| aa7483b1b1 | |||
| 7eeeb8a30f | |||
| 70307e3833 | |||
| 8bde6b15f6 |
@@ -1,39 +0,0 @@
|
||||
package com.czg.controller;
|
||||
|
||||
import com.czg.account.entity.ShopUser;
|
||||
import com.czg.account.service.ShopInfoService;
|
||||
import com.czg.account.service.ShopUserFlowService;
|
||||
import com.czg.account.service.ShopUserService;
|
||||
import com.czg.account.service.TestService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @author GYJoker
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/notify/test")
|
||||
public class TestController {
|
||||
@Resource
|
||||
private ShopUserFlowService shopUserFlowService;
|
||||
@Resource
|
||||
private ShopInfoService shopInfoService;
|
||||
@Resource
|
||||
private ShopUserService shopUserService;
|
||||
@Resource
|
||||
private TestService testService;
|
||||
|
||||
@RequestMapping("/hello")
|
||||
public String hello() {
|
||||
shopUserFlowService.list().forEach(item -> {
|
||||
ShopUser shopUserInfo = shopUserService.getShopUserInfo(item.getShopId(), item.getUserId());
|
||||
if (shopUserInfo != null) {
|
||||
item.setShopUserId(shopUserInfo.getId());
|
||||
shopUserFlowService.updateById(item);
|
||||
}
|
||||
});
|
||||
// return testService.insertData();
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ import com.czg.market.vo.InviteUserVO;
|
||||
import com.czg.market.vo.MkDistributionConfigVO;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.czg.task.DistributionTask;
|
||||
import com.czg.utils.AssertUtil;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import jakarta.annotation.Resource;
|
||||
@@ -37,6 +38,22 @@ public class UDistributionController {
|
||||
private MkDistributionWithdrawFlowService withdrawFlowService;
|
||||
@Resource
|
||||
private MkDistributionFlowService distributionFlowService;
|
||||
@Resource
|
||||
private DistributionTask distributionTask;
|
||||
|
||||
/**
|
||||
* 分销员中心-获取配置
|
||||
*/
|
||||
@GetMapping("/task")
|
||||
public CzgResult<String> task(@RequestParam Long shopId) {
|
||||
try {
|
||||
distributionTask.deliver(shopId);
|
||||
} catch (Exception e) {
|
||||
return CzgResult.failure(e.getMessage());
|
||||
}
|
||||
return CzgResult.success("任务执行成功");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 分销员中心-获取配置
|
||||
|
||||
@@ -6,6 +6,7 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* market服务 任务总调度
|
||||
*
|
||||
* @author ww
|
||||
*/
|
||||
@Component
|
||||
@@ -18,9 +19,9 @@ public class AAMarketTasks {
|
||||
|
||||
|
||||
// 分销延时发放
|
||||
@Scheduled(fixedRate = 30000)
|
||||
@Scheduled(cron = "0 0 0/2 * * ? ")
|
||||
public void distributionTask() {
|
||||
distributionTask.deliver();
|
||||
distributionTask.deliver(null);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +30,7 @@ public class AAMarketTasks {
|
||||
public void birthdayGiftTask() {
|
||||
birthdayGiftTask.deliver();
|
||||
}
|
||||
|
||||
//会员生日弹窗提醒重置 每年1月1日
|
||||
@Scheduled(cron = "0 0 0 1 1 ?")
|
||||
public void birthdayGiftRemindTask() {
|
||||
@@ -39,6 +41,7 @@ public class AAMarketTasks {
|
||||
//优惠券 过期
|
||||
@Resource
|
||||
private CouponTask couponTask;
|
||||
|
||||
//每天每小时的30分 0秒 执行
|
||||
@Scheduled(cron = "0 30 * * * ? ")
|
||||
public void couponTask() {
|
||||
@@ -48,6 +51,7 @@ public class AAMarketTasks {
|
||||
//会员奖励发放
|
||||
@Resource
|
||||
private MemberTask memberTask;
|
||||
|
||||
//每天1点 0分 0秒 执行
|
||||
@Scheduled(cron = "0 0 1 * * ? ")
|
||||
public void memberTask() {
|
||||
@@ -57,6 +61,7 @@ public class AAMarketTasks {
|
||||
//满减活动/限时折扣 处理任务状态 定时任务
|
||||
@Resource
|
||||
private ActivityStatusTask activityStatusTask;
|
||||
|
||||
//每天0点 0分 1秒 执行
|
||||
@Scheduled(cron = "1 0 0 * * ? ")
|
||||
public void activityStatusTask() {
|
||||
@@ -67,6 +72,7 @@ public class AAMarketTasks {
|
||||
//月累计 发送条数 累计金额
|
||||
@Resource
|
||||
private SmsShopMoneyTask smsShopMoneyTask;
|
||||
|
||||
//每月1号 0点 0分 1秒 执行
|
||||
@Scheduled(cron = "1 0 0 1 * ?")
|
||||
public void smsShopMoneyTask() {
|
||||
|
||||
@@ -2,10 +2,13 @@ package com.czg.task;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.czg.account.entity.ShopInfo;
|
||||
import com.czg.account.entity.ShopUser;
|
||||
import com.czg.account.service.ShopInfoService;
|
||||
import com.czg.account.service.ShopUserService;
|
||||
import com.czg.constant.TableValueConstant;
|
||||
import com.czg.constants.SystemConstants;
|
||||
import com.czg.exception.CzgException;
|
||||
import com.czg.market.entity.MkDistributionFlow;
|
||||
import com.czg.market.service.MkDistributionFlowService;
|
||||
import com.czg.market.service.MkDistributionUserService;
|
||||
@@ -18,6 +21,7 @@ import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
@@ -40,8 +44,6 @@ public class DistributionTask {
|
||||
private OrderInfoService orderInfoService;
|
||||
@DubboReference
|
||||
private ShopInfoService shopInfoService;
|
||||
@DubboReference
|
||||
private ShopUserService shopUserService;
|
||||
|
||||
List<String> list = List.of(OrderStatusEnums.REFUND.getCode(), OrderStatusEnums.PART_REFUND.getCode());
|
||||
|
||||
@@ -51,44 +53,55 @@ public class DistributionTask {
|
||||
*/
|
||||
// @Scheduled(cron = "0 0 0 * * ?")
|
||||
// @Scheduled(fixedRate = 30000)
|
||||
public void deliver() {
|
||||
// 1. 订单完成支付时(判断是否分销)产生流水记录。
|
||||
// 2. 判断入账时间。
|
||||
// 3. 如果是 0 天,再去判断商户余额是否足够。够则入账,不足则不管。
|
||||
// 4. 流水增加应该入账的时间(订单产生时带入)
|
||||
// 5. 定时任务 应该是一天执行一次。查询待入账状态和应入账时间小于当前时间的记录,循环处理:并且判断商户余额是否足够,余额不足忽略处理;余额足够变为已入账并扣除商户余额。
|
||||
// 6. 订单产生退款时,去流水表查询该订单的流水记录,如果未入账改为已入账,并插入一条退款扣钱的流水。
|
||||
|
||||
// shopInfo 查余额>0
|
||||
// 循环 shopId 查询 如果金额不足 终止
|
||||
//
|
||||
LocalDateTime localDateTime = DateUtil.date().toLocalDateTime();
|
||||
distributionFlowService.list(new QueryWrapper()
|
||||
.eq(MkDistributionFlow::getStatus, TableValueConstant.DistributionFlow.Status.PENDING.getCode()).le(MkDistributionFlow::getDeliverTime, localDateTime)).forEach(item -> {
|
||||
FunUtils.safeRunVoid(() -> {
|
||||
log.info("开始处理延时分账, id: {}, orderNo: {}, 类型: {}", item.getId(), item.getOrderNo(), item.getType());
|
||||
|
||||
OrderInfo orderInfo = orderInfoService.getOne(new QueryWrapper().eq(OrderInfo::getOrderNo, item.getOrderNo()));
|
||||
if (orderInfo == null) {
|
||||
item.setStatus(TableValueConstant.DistributionFlow.Status.FAIL.getCode());
|
||||
distributionFlowService.updateById(item);
|
||||
log.warn("订单不存在, 订单号: {}", item.getOrderNo());
|
||||
return;
|
||||
public void deliver(Long shopId) {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
List<ShopInfo> shopInfos = shopInfoService.list(QueryWrapper.create()
|
||||
.eq(ShopInfo::getIsDeleted, SystemConstants.OneZero.ZERO)
|
||||
.isNotNull(ShopInfo::getExpireTime)
|
||||
.lt(ShopInfo::getExpireTime, now)
|
||||
.gt(ShopInfo::getAmount, BigDecimal.ZERO)
|
||||
.eq(ShopInfo::getId, shopId)
|
||||
);
|
||||
if (CollUtil.isEmpty(shopInfos)) {
|
||||
log.info("分销延时分账 无符合条件的店铺,无需处理分账");
|
||||
return;
|
||||
}
|
||||
for (ShopInfo shopInfo : shopInfos) {
|
||||
boolean breakCurrentShopFlow = false;
|
||||
List<MkDistributionFlow> flowList = distributionFlowService.list(new QueryWrapper()
|
||||
.eq(MkDistributionFlow::getShopId, shopInfo.getId())
|
||||
.eq(MkDistributionFlow::getStatus, TableValueConstant.DistributionFlow.Status.PENDING.getCode())
|
||||
.le(MkDistributionFlow::getDeliverTime, now)
|
||||
.orderBy(MkDistributionFlow::getId, true)
|
||||
);
|
||||
for (MkDistributionFlow item : flowList) {
|
||||
if (breakCurrentShopFlow) {
|
||||
break;
|
||||
}
|
||||
if (list.contains(orderInfo.getStatus())) {
|
||||
log.warn("订单已退款, 订单号: {}", item.getOrderNo());
|
||||
distributionUserService.refund(orderInfo.getId(), orderInfo.getOrderNo());
|
||||
} else {
|
||||
item.setStatus(TableValueConstant.DistributionFlow.Status.SUCCESS.getCode());
|
||||
ShopUser shopUser = shopUserService.getById(item.getDistributionUserId());
|
||||
distributionUserService.updateShopInfoAmount(orderInfo.getShopId(), item.getRewardAmount().negate(), orderInfo.getId(), TableValueConstant.DistributionAmountFlow.Type.SUB, "分销扣减");
|
||||
distributionUserService.updateIncome(item.getRewardAmount().negate(), item.getRewardAmount(), BigDecimal.ZERO,
|
||||
item.getDistributionUserId(), shopUser.getUserId(), item.getShopUserId(), item.getShopId(), item.getLevel());
|
||||
distributionFlowService.updateById(item);
|
||||
try {
|
||||
log.info("分销延时分账, id: {}, orderNo: {}, 类型: {}", item.getId(), item.getOrderNo(), item.getType());
|
||||
OrderInfo orderInfo = orderInfoService.getOne(new QueryWrapper().eq(OrderInfo::getOrderNo, item.getOrderNo()));
|
||||
if (orderInfo == null) {
|
||||
item.setStatus(TableValueConstant.DistributionFlow.Status.FAIL.getCode());
|
||||
distributionFlowService.updateById(item);
|
||||
log.warn("分销延时分账。订单不存在, 订单号: {}", item.getOrderNo());
|
||||
continue;
|
||||
}
|
||||
if (list.contains(orderInfo.getStatus())) {
|
||||
log.warn("分销延时分账。订单已退款, 订单号: {}", item.getOrderNo());
|
||||
distributionUserService.refund(orderInfo.getId(), orderInfo.getOrderNo());
|
||||
} else {
|
||||
item.setStatus(TableValueConstant.DistributionFlow.Status.SUCCESS.getCode());
|
||||
distributionUserService.distributionUserAmount(item, orderInfo);
|
||||
}
|
||||
} catch (CzgException e) {
|
||||
log.error("店铺{}:{}分销延时分账异常:{}", shopInfo.getId(), shopInfo.getShopName(), e.getMessage());
|
||||
breakCurrentShopFlow = true;
|
||||
} catch (Exception e) {
|
||||
log.error("店铺{}:{}分销延时分账异常", shopInfo.getId(), shopInfo.getShopName(), e);
|
||||
breakCurrentShopFlow = true;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -50,6 +50,8 @@ public class NotifyController {
|
||||
@Resource
|
||||
private MkShopConsumeDiscountRecordService consumeDiscountRecordService;
|
||||
|
||||
|
||||
//新客立减清除数据 测试用
|
||||
@RequestMapping("clear")
|
||||
public String clear(@RequestParam Integer shopId) {
|
||||
consumeDiscountRecordService.remove(new QueryWrapper().eq(MkShopConsumeDiscountRecord::getShopId, shopId));
|
||||
|
||||
@@ -21,7 +21,7 @@ public class StatisticTaskController {
|
||||
private StatisticTask statisticTask;
|
||||
|
||||
/**
|
||||
* 基础统计
|
||||
* 基础统计 预留重置统计
|
||||
*
|
||||
* @param date 日期yyyy-MM-dd
|
||||
*/
|
||||
|
||||
@@ -39,7 +39,7 @@ public class OTimeTask {
|
||||
@Resource
|
||||
private CashierCartService cartService;
|
||||
@Resource
|
||||
private OrderPaymentService orderPaymentService;
|
||||
private OrderPaymentService paymentService;
|
||||
@Resource
|
||||
private GbOrderService gbOrderService;
|
||||
@Resource
|
||||
@@ -117,7 +117,7 @@ public class OTimeTask {
|
||||
|
||||
LocalDateTime tenMinutesAgo = LocalDateTime.now().minusMinutes(10);
|
||||
LocalDateTime thirdDayAgo = LocalDateTime.now().minusDays(3);
|
||||
List<OrderPayment> list = orderPaymentService.list(QueryWrapper.create()
|
||||
List<OrderPayment> list = paymentService.list(QueryWrapper.create()
|
||||
.gt(OrderPayment::getUpdateTime, thirdDayAgo)
|
||||
.lt(OrderPayment::getUpdateTime, tenMinutesAgo)
|
||||
.in(OrderPayment::getSourceType, ware)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.czg.config;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.mybatisflex.core.audit.AuditManager;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -17,8 +18,24 @@ public class MybatisFlexConfig {
|
||||
//设置 SQL 审计收集器
|
||||
AuditManager.setMessageCollector(auditMessage ->
|
||||
log.info("[sql] time: {}, size: {}, sql:\n{}",
|
||||
auditMessage.getElapsedTime(), auditMessage.getQueryCount(), auditMessage.getFullSql())
|
||||
);
|
||||
auditMessage.getElapsedTime(), auditMessage.getQueryCount(), compressSql(auditMessage.getFullSql())));
|
||||
}
|
||||
|
||||
/**
|
||||
* 精简SQL:去除多余换行、制表符、连续空格,保留语法必需空格
|
||||
*
|
||||
* @param originalSql 原始带换行/空格的SQL
|
||||
* @return 精简后的SQL
|
||||
*/
|
||||
public static String compressSql(String originalSql) {
|
||||
if (StrUtil.isBlank(originalSql)) {
|
||||
return "";
|
||||
}
|
||||
// 1. 替换所有换行、制表符为单个空格
|
||||
String tempSql = originalSql.replaceAll("\\r\\n|\\r|\\n|\\t", " ");
|
||||
// 2. 替换多个连续空格为单个空格
|
||||
tempSql = tempSql.replaceAll("\\s+", " ");
|
||||
// 3. 去除首尾空格
|
||||
return tempSql.trim();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,10 +7,12 @@ import com.czg.exception.CzgException;
|
||||
import com.czg.market.dto.MkDistributionUserDTO;
|
||||
import com.czg.market.dto.MkDistributionWithdrawFlowDTO;
|
||||
import com.czg.market.entity.MkDistributionConfig;
|
||||
import com.czg.market.entity.MkDistributionFlow;
|
||||
import com.czg.market.entity.MkDistributionUser;
|
||||
import com.czg.market.vo.DistributionCenterShopVO;
|
||||
import com.czg.market.vo.InviteUserVO;
|
||||
import com.czg.order.dto.MkDistributionPayDTO;
|
||||
import com.czg.order.entity.OrderInfo;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
|
||||
@@ -123,6 +125,8 @@ public interface MkDistributionUserService extends IService<MkDistributionUser>
|
||||
|
||||
void refund(Long orderId, String orderNo);
|
||||
|
||||
void distributionUserAmount(MkDistributionFlow item, OrderInfo orderInfo);
|
||||
|
||||
/**
|
||||
* 发放分销奖励
|
||||
*
|
||||
|
||||
@@ -41,6 +41,7 @@ public class OrderDetailSmallVO implements Serializable {
|
||||
private LocalDateTime startOrderTime;
|
||||
private LocalDateTime dishOutTime;
|
||||
private LocalDateTime foodServeTime;
|
||||
private Integer isTemporary;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
|
||||
if (shopInfo == null) {
|
||||
throw new CzgException("店铺不存在");
|
||||
}
|
||||
if (shopInfo.getExpireTime() != null && (DateUtil.date().toLocalDateTime().isAfter(shopInfo.getExpireTime()))) {
|
||||
if (shopInfo.getExpireTime() != null && (LocalDateTime.now().isAfter(shopInfo.getExpireTime()))) {
|
||||
throw new CzgException("店铺已过期,请联系商家");
|
||||
}
|
||||
if (SystemConstants.OneZero.ZERO == shopInfo.getOnSale() || shopInfo.getStatus() != SystemConstants.OneZero.ONE) {
|
||||
|
||||
@@ -22,6 +22,8 @@ import com.czg.market.vo.InviteUserVO;
|
||||
import com.czg.market.vo.MemberConfigVO;
|
||||
import com.czg.order.entity.OrderInfo;
|
||||
import com.czg.service.account.mapper.ShopUserMapper;
|
||||
import com.czg.service.account.util.FunUtil;
|
||||
import com.czg.utils.FunUtils;
|
||||
import com.czg.utils.PageUtil;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
@@ -61,6 +63,7 @@ public class ShopUserServiceImpl extends ServiceImpl<ShopUserMapper, ShopUser> i
|
||||
private MemberLevelConfigService memberLevelConfigService;
|
||||
@DubboReference
|
||||
private TbMemberConfigService memberConfigService;
|
||||
|
||||
private ShopUser getUserInfo(Long shopUserId) {
|
||||
ShopUser shopUser = queryChain().eq(ShopUser::getId, shopUserId).one();
|
||||
if (shopUser == null) {
|
||||
@@ -240,9 +243,13 @@ public class ShopUserServiceImpl extends ServiceImpl<ShopUserMapper, ShopUser> i
|
||||
shopUser.setBirthDay(null);
|
||||
}
|
||||
shopUser.setNickName(userInfo.getNickName());
|
||||
if (shopUser.getJoinTime() == null) {
|
||||
shopUser.setJoinTime(LocalDateTime.now());
|
||||
// if (shopUser.getJoinTime() == null) {
|
||||
// shopUser.setJoinTime(LocalDateTime.now());
|
||||
// }
|
||||
boolean b = saveOrUpdate(shopUser);
|
||||
if (b) {
|
||||
FunUtils.transactionSafeRun(() -> memberConfigService.joinMemberByCondition(shopId, userId, shopUser));
|
||||
}
|
||||
return saveOrUpdate(shopUser);
|
||||
return b;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.czg.market.entity.MkPointsUser;
|
||||
import com.czg.market.entity.MkShopCouponRecord;
|
||||
import com.czg.market.service.MkPointsUserService;
|
||||
import com.czg.market.service.MkShopCouponRecordService;
|
||||
import com.czg.market.service.TbMemberConfigService;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.service.RedisService;
|
||||
import com.czg.service.account.mapper.ShopConfigMapper;
|
||||
|
||||
@@ -85,8 +85,6 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
|
||||
private ShopUserService shopUserService;
|
||||
@DubboReference
|
||||
private UserInfoService userInfoService;
|
||||
@DubboReference
|
||||
private OrderPaymentService orderPaymentService;
|
||||
@Resource
|
||||
private OrderInfoService orderInfoService;
|
||||
@DubboReference
|
||||
@@ -706,6 +704,16 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
|
||||
});
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void distributionUserAmount(MkDistributionFlow item, OrderInfo orderInfo) {
|
||||
ShopUser shopUser = shopUserService.getById(item.getDistributionUserId());
|
||||
updateShopInfoAmount(orderInfo.getShopId(), item.getRewardAmount().negate(), orderInfo.getId(), TableValueConstant.DistributionAmountFlow.Type.SUB, "分销扣减");
|
||||
updateIncome(item.getRewardAmount().negate(), item.getRewardAmount(), BigDecimal.ZERO,
|
||||
item.getDistributionUserId(), shopUser.getUserId(), item.getShopUserId(), item.getShopId(), item.getLevel());
|
||||
distributionFlowService.updateById(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void distribute(Long sourceId, String orderNo, BigDecimal amount, Long sourceUserId, Long shopId, String type) {
|
||||
MkDistributionDeliver deliver = new MkDistributionDeliver().setSourceId(sourceId).setOrderNo(orderNo).setShopId(shopId).setType(type).setStatus("success");
|
||||
|
||||
@@ -192,7 +192,7 @@ public class MkPointsUserServiceImpl extends ServiceImpl<MkPointsUserMapper, MkP
|
||||
.shopId(pointsUser.getShopId())
|
||||
.shopUserId(pointsUser.getShopUserId())
|
||||
.floatType(PointsConstant.SUB.getValue())
|
||||
.floatPoints(floatPoints)
|
||||
.floatPoints(-floatPoints)
|
||||
.balancePoints(pointsUser.getPointBalance())
|
||||
.sourceId(orderId.toString())
|
||||
.content(reason)
|
||||
|
||||
@@ -175,9 +175,9 @@ public class MkShopRechargeServiceImpl extends ServiceImpl<MkShopRechargeMapper,
|
||||
|
||||
// 标准充值
|
||||
if (rechargeDetailId != null) {
|
||||
MkShopRechargeDetail rechargeDetail = shopRechargeDetailService.getById(rechargeDetailId);
|
||||
shopUserMoneyEditDTO.setMoney(rechargeDetail.getAmount());
|
||||
FunUtils.asyncSafeRunVoid(() -> {
|
||||
MkShopRechargeDetail rechargeDetail = shopRechargeDetailService.getById(rechargeDetailId);
|
||||
shopUserMoneyEditDTO.setMoney(rechargeDetail.getAmount());
|
||||
// 赠送金额
|
||||
ShopUserMoneyEditDTO shopUserMoneyEditRewardDTO = new ShopUserMoneyEditDTO()
|
||||
.setId(shopUserId)
|
||||
|
||||
@@ -361,6 +361,7 @@ public class TbMemberConfigServiceImpl extends ServiceImpl<TbMemberConfigMapper,
|
||||
memberExpFlowService.save(expFlow);
|
||||
|
||||
upShopUser.setExperience(shopUser.getExperience() + exp);
|
||||
shopUser.setExperience(upShopUser.getExperience());
|
||||
// 修改会员等级
|
||||
MemberLevelConfig nextConfig = levelConfigService.getOne(new QueryWrapper().eq(MemberLevelConfig::getShopId, shopUser.getMainShopId())
|
||||
.gt(MemberLevelConfig::getExperienceValue, levelVO.getExperienceValue()).orderBy(MemberLevelConfig::getExperienceValue, true).limit(1));
|
||||
|
||||
@@ -36,7 +36,7 @@ public class DistributionPayServiceImpl implements DistributionPayService {
|
||||
private final BigDecimal MONEY_RATE = new BigDecimal("100");
|
||||
|
||||
@Resource
|
||||
private OrderPaymentService orderPaymentService;
|
||||
private OrderPaymentService paymentService;
|
||||
@Resource
|
||||
private MkDistributionConfigService configService;
|
||||
@Resource
|
||||
@@ -74,7 +74,7 @@ public class DistributionPayServiceImpl implements DistributionPayService {
|
||||
.setPayType(PayTypeConstants.PayType.PAY)
|
||||
.setOrderNo(payParam.getPlatformType() + IdUtil.getSnowflakeNextId())
|
||||
.setAmount(isRecharge ? payParam.getAmount() : detail.getPayAmount());
|
||||
orderPaymentService.save(orderPayment);
|
||||
paymentService.save(orderPayment);
|
||||
|
||||
InitInfo initInfo = new InitInfo().setConfig(detail);
|
||||
if (isRecharge) {
|
||||
|
||||
@@ -1060,7 +1060,8 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
||||
distributionUserService.costUpgradeLevelBefore(orderInfo.getUserId(), orderInfo.getShopId());
|
||||
// 分销奖励
|
||||
distributionUserService.distribute(orderInfo.getId(), orderInfo.getOrderNo(), payment.getAmount(), orderInfo.getUserId(), orderInfo.getShopId(), "order");
|
||||
} else if (PayTypeConstants.SourceType.MEMBER_IN.equals(payment.getSourceType()) || PayTypeConstants.SourceType.FREE.equals(payment.getSourceType())) {
|
||||
}
|
||||
else if (PayTypeConstants.SourceType.MEMBER_IN.equals(payment.getSourceType()) || PayTypeConstants.SourceType.FREE.equals(payment.getSourceType())) {
|
||||
boolean isFree = PayTypeConstants.SourceType.FREE.equals(payment.getSourceType());
|
||||
ShopUser shopUser = shopUserService.getById(payment.getSourceId());
|
||||
OrderInfo orderInfo = null;
|
||||
@@ -1112,17 +1113,22 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
||||
payment.getId(), payment.getSourceType(), bizEnum, orderInfo == null);
|
||||
}
|
||||
}
|
||||
} else if (PayTypeConstants.SourceType.MEMBER_PAY.equals(payment.getSourceType())) {
|
||||
}
|
||||
else if (PayTypeConstants.SourceType.MEMBER_PAY.equals(payment.getSourceType())) {
|
||||
//购买会员
|
||||
ShopUser shopUser = shopUserService.getById(payment.getSourceId());
|
||||
memberConfigService.joinMember(payment.getShopId(), shopUser.getUserId(), payment.getRelatedId());
|
||||
} else if (PayTypeConstants.SourceType.DISTRIBUTION.equals(payment.getSourceType())) {
|
||||
}
|
||||
else if (PayTypeConstants.SourceType.DISTRIBUTION.equals(payment.getSourceType())) {
|
||||
distributionUserService.open(payment.getSourceId(), payment.getAmount(), payment.getShopId(), payment.getId());
|
||||
} else if (PayTypeConstants.SourceType.POINT.equals(payment.getSourceType())) {
|
||||
}
|
||||
else if (PayTypeConstants.SourceType.POINT.equals(payment.getSourceType())) {
|
||||
goodPayService.payCallBack(payment.getSourceId(), payment.getId());
|
||||
} else if (PayTypeConstants.SourceType.WARE.equals(payment.getSourceType())) {
|
||||
}
|
||||
else if (PayTypeConstants.SourceType.WARE.equals(payment.getSourceType())) {
|
||||
gbOrderService.payCallBack(payment.getSourceId(), payment.getId());
|
||||
} else if (PayTypeConstants.SourceType.PP.equals(payment.getSourceType())) {
|
||||
}
|
||||
else if (PayTypeConstants.SourceType.PP.equals(payment.getSourceType())) {
|
||||
ppPackageOrderService.paySuccess(payment.getSourceId(), payment.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,10 +22,10 @@ public class OrderPaymentServiceImpl extends ServiceImpl<OrderPaymentMapper, Ord
|
||||
@Override
|
||||
public BigDecimal countMemberInAmount(Long shopId, Long shopUserId) {
|
||||
return getOneAs(QueryWrapper.create().select("IFNULL(sum(amount), 0) as total_amount")
|
||||
.eq(OrderPayment::getShopId, 143)
|
||||
.eq(OrderPayment::getShopId, shopId)
|
||||
.eq(OrderPayment::getSourceType, PayTypeConstants.SourceType.MEMBER_IN)
|
||||
.eq(OrderPayment::getPayType, PayTypeConstants.PayType.PAY)
|
||||
.eq(OrderPayment::getSourceId, 127452)
|
||||
.eq(OrderPayment::getSourceId, shopUserId)
|
||||
.eq(OrderPayment::getPayStatus, PayTypeConstants.PayStatus.SUCCESS), BigDecimal.class);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user