1.点歌支付防抖

2.点歌记录倒序
3.下单同步保存库存记录
This commit is contained in:
2024-07-17 16:52:19 +08:00
parent d784ba8c27
commit 266bbd7381
10 changed files with 64 additions and 4 deletions

View File

@@ -147,6 +147,8 @@ public class PayService {
TbActivateMapper tbActivateMapper;
private final TbShopSongOrderService shopSongOrderService;
@Autowired
private MQUtils mQUtils;
public PayService(@Qualifier("tbShopSongOrderServiceImpl") TbShopSongOrderService shopSongOrderService) {
this.shopSongOrderService = shopSongOrderService;
@@ -268,7 +270,9 @@ public class PayService {
}
PublicResp<WxScanPayResp> publicResp = thirdPayService.scanpay(thirdUrl, thirdApply.getAppId(),
reqbody, reqbody, payment.getAmount().setScale(2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(100)).longValue(), "WECHAT", thirdApply.getSmallAppid(), openId, ip, DateUtils.getsdfTimesSS(), thirdApply.getStoreId(), callFSTBack, null, thirdApply.getAppToken());
reqbody, reqbody,
payment.getAmount().setScale(2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(100)).longValue(),
"WECHAT", thirdApply.getSmallAppid(), openId, ip, DateUtils.getsdfTimesSS(), thirdApply.getStoreId(), callFSTBack, null, thirdApply.getAppToken());
if (ObjectUtil.isNotNull(publicResp) && ObjectUtil.isNotEmpty(publicResp)) {
if ("000000".equals(publicResp.getCode())) {
WxScanPayResp wxScanPayResp = publicResp.getObjData();
@@ -878,6 +882,12 @@ public class PayService {
producer.printMechine(orderInfo.getId() + "");
sendOrderToClient(orderInfo);
redisUtil.deleteByKey(RedisCst.ORDER_EXPIRED.concat(orderInfo.getId().toString()));
// 发送mq消息并保存库存记录
JSONObject data = new JSONObject();
data.put("orderId", orderInfo.getId());
data.put("plat", "miniApp");
mQUtils.sendStockSaleMsg(data);
return "SUCCESS";
}
@@ -923,6 +933,12 @@ public class PayService {
producer.printCoupons(coupons.toJSONString());
sendOrderToClient(orderInfo);
redisUtil.deleteByKey(RedisCst.ORDER_EXPIRED.concat(orderInfo.getId().toString()));
// 发送mq消息并保存库存记录
JSONObject data = new JSONObject();
data.put("orderId", orderInfo.getId());
data.put("plat", "miniApp");
mQUtils.sendStockSaleMsg(data);
return "SUCCESS";
}

View File

@@ -138,7 +138,8 @@ public class ProductService {
if (ObjectUtil.isNotEmpty(in) && ObjectUtil.isNotNull(in)) {
List<TbProduct> products = tbProductMapper.selectByIdIn(in);
// List<TbProduct> products = tbProductMapper.selectByIdIn(in);
List<TbProduct> products = tbProductMapper.selectByIdInAndCheck(in);
if (ObjectUtil.isNotEmpty(products) && products.size() > 0) {
products.parallelStream().forEach(it -> {
Integer sum = tbProductMapper.selectByQcode(code, it.getId(), it.getShopId());

View File

@@ -9,6 +9,7 @@ import com.chaozhanggui.system.cashierservice.entity.TbShopSong;
import com.chaozhanggui.system.cashierservice.entity.TbShopSongOrder;
import com.chaozhanggui.system.cashierservice.entity.dto.SongOrderDTO;
import com.chaozhanggui.system.cashierservice.exception.MsgException;
import com.chaozhanggui.system.cashierservice.redis.RedisCst;
import com.chaozhanggui.system.cashierservice.service.PayService;
import com.chaozhanggui.system.cashierservice.service.TbShopSongOrderService;
import com.chaozhanggui.system.cashierservice.service.TbShopSongService;