消息中心
This commit is contained in:
@@ -5,8 +5,10 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.czg.account.dto.shopuser.ShopUserMoneyEditDTO;
|
||||
import com.czg.account.entity.AcUserMsg;
|
||||
import com.czg.account.entity.ShopInfo;
|
||||
import com.czg.account.entity.ShopUser;
|
||||
import com.czg.account.service.AcUserMsgService;
|
||||
import com.czg.account.service.ShopConfigService;
|
||||
import com.czg.account.service.ShopInfoService;
|
||||
import com.czg.account.service.ShopUserService;
|
||||
@@ -63,6 +65,9 @@ public class MkConsumeCashbackServiceImpl extends ServiceImpl<MkConsumeCashbackM
|
||||
@Resource
|
||||
private MkConsumeCashbackRecordService consumeCashbackRecordService;
|
||||
|
||||
@DubboReference
|
||||
private AcUserMsgService acUserMsgService;
|
||||
|
||||
@Override
|
||||
@Cacheable(key = "#shopId")
|
||||
public MkConsumeCashbackVO detail(Long shopId) {
|
||||
@@ -156,6 +161,10 @@ public class MkConsumeCashbackServiceImpl extends ServiceImpl<MkConsumeCashbackM
|
||||
.setRelationId(mkConsumeCashbackRecord.getId()).setMoney(cashbackAmount).setBizEnum(ShopUserFlowBizEnum.CASHBACK)
|
||||
.setRemark(StrUtil.format("订单消费: {}, 返现: {}", amount, cashbackAmount)));
|
||||
log.info("订单返现 订单ID:{}, 店铺用户id: {}, 订单消费: {}, 返现: {}",orderId, shopUser.getId(), amount, cashbackAmount);
|
||||
|
||||
AcUserMsg msg = new AcUserMsg().setUserId(userId).setShopId(shopId).setSourceId(orderId).setSourceType("order")
|
||||
.setType("cash").setTitle("返现通知").setContent(StrUtil.format("订单: {}, 返现: {}", orderNo, cashbackAmount));
|
||||
acUserMsgService.addUserMsg(msg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,6 +50,6 @@ public class MkPointsConfigServiceImpl extends ServiceImpl<MkPointsConfigMapper,
|
||||
}
|
||||
BigDecimal awardPoints = NumberUtil.roundDown(NumberUtil.div(payAmount, consumeAmount), 0);
|
||||
mkPointsUserService.alterPoints(null, shopUserId, orderInfo.getShopId(), PointsConstant.ADD,
|
||||
awardPoints.intValue(), orderInfo.getId().toString(), StrUtil.format("消费¥{}送{}积分", payAmount, awardPoints.intValue()));
|
||||
awardPoints.intValue(), orderInfo.getId(), StrUtil.format("消费¥{}送{}积分", payAmount, awardPoints.intValue()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.czg.service.market.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.czg.account.entity.AcUserMsg;
|
||||
import com.czg.account.entity.ShopInfo;
|
||||
import com.czg.account.entity.ShopUser;
|
||||
import com.czg.account.service.AcUserMsgService;
|
||||
import com.czg.account.service.ShopInfoService;
|
||||
import com.czg.account.service.ShopUserService;
|
||||
import com.czg.account.vo.PointsShopListVO;
|
||||
@@ -40,6 +42,9 @@ public class MkPointsUserServiceImpl extends ServiceImpl<MkPointsUserMapper, MkP
|
||||
@Resource
|
||||
private MkPointsUserRecordService pointsUserRecordService;
|
||||
|
||||
@DubboReference
|
||||
private AcUserMsgService acUserMsgService;
|
||||
|
||||
@Override
|
||||
public Page<MkPointsUserDTO> getPointsUserPage(String phone, Integer page, Integer size) {
|
||||
Long shopUserId = null;
|
||||
@@ -110,7 +115,7 @@ public class MkPointsUserServiceImpl extends ServiceImpl<MkPointsUserMapper, MkP
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long alterPoints(Long userId, Long shopUserId, Long shopId, PointsConstant floatType, Integer points, String sourceId, String reason) {
|
||||
public Long alterPoints(Long userId, Long shopUserId, Long shopId, PointsConstant floatType, Integer points, Long sourceId, String reason) {
|
||||
MkPointsUser pointsUser = getPointsUser(shopId, shopUserId, userId);
|
||||
if (floatType == null) {
|
||||
throw new CzgException("积分变动类型不能为空");
|
||||
@@ -134,13 +139,25 @@ public class MkPointsUserServiceImpl extends ServiceImpl<MkPointsUserMapper, MkP
|
||||
.mkPointsUserId(pointsUser.getId())
|
||||
.floatType(floatType.getValue())
|
||||
.floatPoints(points)
|
||||
.sourceId(sourceId)
|
||||
.sourceId(sourceId.toString())
|
||||
.content(reason)
|
||||
.build();
|
||||
boolean save = pointsUserRecordService.save(record);
|
||||
if (!save) {
|
||||
throw new CzgException("积分操作失败,积分记录保存失败");
|
||||
}
|
||||
|
||||
AcUserMsg msg = new AcUserMsg()
|
||||
.setUserId(userId)
|
||||
.setShopId(shopId)
|
||||
.setSourceId(sourceId)
|
||||
.setSourceType("order")
|
||||
.setType("points")
|
||||
.setReadStatus(0)
|
||||
.setTitle("积分变动")
|
||||
.setContent(StrUtil.format("支付订单,{} 积分已入账", points));
|
||||
acUserMsgService.addUserMsg(msg);
|
||||
|
||||
return record.getId();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,7 +185,7 @@ public class MkShopRechargeServiceImpl extends ServiceImpl<MkShopRechargeMapper,
|
||||
|
||||
// 发放积分
|
||||
if (rechargeDetail.getRewardPoints() != null) {
|
||||
pointsUserService.alterPoints(null, shopUserId, shopUser.getMainShopId(), PointsConstant.ADD, rechargeDetail.getRewardPoints(), editId.toString(), "会员充值送积分");
|
||||
pointsUserService.alterPoints(null, shopUserId, shopUser.getMainShopId(), PointsConstant.ADD, rechargeDetail.getRewardPoints(), editId, "会员充值送积分");
|
||||
}
|
||||
|
||||
// 发放优惠券
|
||||
|
||||
@@ -318,7 +318,7 @@ public class TbMemberConfigServiceImpl extends ServiceImpl<TbMemberConfigMapper,
|
||||
int points = (int) (money.floatValue() / levelVO.getCostRewardPoints());
|
||||
log.info("消费送积分: {}", points);
|
||||
if (points > 0) {
|
||||
pointsUserService.alterPoints(null, shopUser.getId(), shopUser.getMainShopId(), PointsConstant.ADD, points, sourceId.toString(), "会员消费送积分");
|
||||
pointsUserService.alterPoints(null, shopUser.getId(), shopUser.getMainShopId(), PointsConstant.ADD, points, sourceId, "会员消费送积分");
|
||||
|
||||
}
|
||||
}
|
||||
@@ -333,7 +333,7 @@ public class TbMemberConfigServiceImpl extends ServiceImpl<TbMemberConfigMapper,
|
||||
if (levelVO.getIsCycleReward() == 1) {
|
||||
if (levelVO.getCycleRewardPoints() != null) {
|
||||
int points = levelVO.getCycleRewardPoints();
|
||||
pointsUserService.alterPoints(null, shopUser.getId(), shopUser.getMainShopId(), PointsConstant.ADD, points, sourceId.toString(), "会员周奖励");
|
||||
pointsUserService.alterPoints(null, shopUser.getId(), shopUser.getMainShopId(), PointsConstant.ADD, points, sourceId, "会员周奖励");
|
||||
}
|
||||
|
||||
if (levelVO.getCycleRewardCouponList() != null && !levelVO.getCycleRewardCouponList().isEmpty()) {
|
||||
|
||||
Reference in New Issue
Block a user