退款回滚库存
This commit is contained in:
parent
d46d4ca6df
commit
a6adc81366
|
|
@ -0,0 +1 @@
|
|||
/target/
|
||||
|
|
@ -21,6 +21,7 @@ import com.github.pagehelper.PageHelper;
|
|||
import com.github.pagehelper.PageInfo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -84,6 +85,13 @@ public class PayService {
|
|||
TbShopInfoMapper tbShopInfoMapper;
|
||||
@Autowired
|
||||
TbQuickPayMapper tbQuickPayMapper;
|
||||
|
||||
@Autowired
|
||||
private TbProductSkuMapper productSkuMapper;
|
||||
|
||||
@Autowired
|
||||
private RedisUtils redisUtil;
|
||||
|
||||
@Value("${gateway.url}")
|
||||
private String gateWayUrl;
|
||||
@Value("${client.backUrl}")
|
||||
|
|
@ -905,9 +913,19 @@ public class PayService {
|
|||
// jsonObject.put("data",new ReturnWTZInfo(orderId+"",newOrderInfo.getPayAmount(),details));
|
||||
producer.putOrderCollect(jsonObject.toJSONString());
|
||||
|
||||
|
||||
producer.printMechine(String.valueOf(newOrderInfo.getId()));
|
||||
|
||||
// 更新商品库存
|
||||
for (TbOrderDetail detail : returnDetail) {
|
||||
detail = tbOrderDetailMapper.selectByPrimaryKey(detail.getId());
|
||||
|
||||
TbProductSku productSku = productSkuMapper.selectByPrimaryKey(detail.getProductSkuId());
|
||||
if (ObjectUtil.isNotEmpty(productSku)) {
|
||||
redisUtil.seckill(RedisCst.PRODUCT + shopId.toString() + ":" + productSku.getId().toString(), String.valueOf(detail.getReturnNum() + productSku.getStockNumber().intValue()));
|
||||
productSkuMapper.updateByskuIdSub(productSku.getId(), detail.getReturnNum() * -1);
|
||||
}
|
||||
}
|
||||
|
||||
return Result.success(CodeEnum.SUCCESS);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue