退款回滚库存
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 com.github.pagehelper.PageInfo;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
@ -84,6 +85,13 @@ public class PayService {
|
||||||
TbShopInfoMapper tbShopInfoMapper;
|
TbShopInfoMapper tbShopInfoMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
TbQuickPayMapper tbQuickPayMapper;
|
TbQuickPayMapper tbQuickPayMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TbProductSkuMapper productSkuMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RedisUtils redisUtil;
|
||||||
|
|
||||||
@Value("${gateway.url}")
|
@Value("${gateway.url}")
|
||||||
private String gateWayUrl;
|
private String gateWayUrl;
|
||||||
@Value("${client.backUrl}")
|
@Value("${client.backUrl}")
|
||||||
|
|
@ -905,9 +913,19 @@ public class PayService {
|
||||||
// jsonObject.put("data",new ReturnWTZInfo(orderId+"",newOrderInfo.getPayAmount(),details));
|
// jsonObject.put("data",new ReturnWTZInfo(orderId+"",newOrderInfo.getPayAmount(),details));
|
||||||
producer.putOrderCollect(jsonObject.toJSONString());
|
producer.putOrderCollect(jsonObject.toJSONString());
|
||||||
|
|
||||||
|
|
||||||
producer.printMechine(String.valueOf(newOrderInfo.getId()));
|
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);
|
return Result.success(CodeEnum.SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue