商品模块代码提交
This commit is contained in:
@@ -3,6 +3,7 @@ package com.czg.service.order.service.impl;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.czg.account.vo.HandoverCategoryListVo;
|
||||
import com.czg.account.vo.HandoverProductListVo;
|
||||
import com.czg.config.RabbitPublisher;
|
||||
@@ -23,10 +24,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 订单Rpc ServiceImpl
|
||||
@@ -182,6 +180,28 @@ public class OrderInfoRpcServiceImpl implements OrderInfoRpcService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void orderRefundCallback(JSONObject data) {
|
||||
Set<String> keys = data.keySet();
|
||||
// 封装扣减库存数据
|
||||
List<Map<String, Object>> dataList = new ArrayList<>();
|
||||
for (String key : keys) {
|
||||
Long productId = Convert.toLong(key);
|
||||
BigDecimal num = data.getBigDecimal(key);
|
||||
Map<String, Object> row = new HashMap<>(2);
|
||||
data.put("productId", productId);
|
||||
data.put("num", num);
|
||||
dataList.add(row);
|
||||
}
|
||||
try {
|
||||
// 调用商品服务回退库存
|
||||
productRpcService.orderRefundReturnStock(dataList);
|
||||
} catch (Exception e) {
|
||||
log.error("调用商品服务回退库存", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendHandoverReceiptPrintMsgToMq(Long handoverRecordId) {
|
||||
rabbitPublisher.sendHandoverPrintMsg(Convert.toStr(handoverRecordId));
|
||||
|
||||
Reference in New Issue
Block a user