商品库存累加减公共方法修正

This commit is contained in:
Jack 2025-06-14 16:41:48 +08:00
parent 669bd33b5f
commit 13b5acfea9
12 changed files with 661 additions and 67 deletions

View File

@ -19,7 +19,9 @@ import com.suisung.mall.common.pojo.req.WxUserInfoReq;
import com.suisung.mall.common.utils.I18nUtil; import com.suisung.mall.common.utils.I18nUtil;
import com.suisung.mall.common.utils.phone.PhoneNumberUtils; import com.suisung.mall.common.utils.phone.PhoneNumberUtils;
import com.suisung.mall.core.web.service.impl.BaseServiceImpl; import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -37,6 +39,7 @@ import java.util.UUID;
* @author Xinze * @author Xinze
* @since 2021-04-28 * @since 2021-04-28
*/ */
@Slf4j
@Service @Service
public class AccountUserBindConnectServiceImpl extends BaseServiceImpl<AccountUserBindConnectMapper, AccountUserBindConnect> implements AccountUserBindConnectService { public class AccountUserBindConnectServiceImpl extends BaseServiceImpl<AccountUserBindConnectMapper, AccountUserBindConnect> implements AccountUserBindConnectService {
@ -397,12 +400,26 @@ public class AccountUserBindConnectServiceImpl extends BaseServiceImpl<AccountUs
return null; return null;
} }
/**
* 初始化账户用户绑定信息
*
* @param bindId 绑定ID
* @param bindType 绑定类型
* @param userId 用户ID
* @param userType 用户类型
* @return 账户用户绑定连接对象如果初始化失败则返回null
*/
public AccountUserBindConnect initAccountUserBindConnect(String bindId, Integer bindType, Integer userId, Integer userType) { public AccountUserBindConnect initAccountUserBindConnect(String bindId, Integer bindType, Integer userId, Integer userType) {
if (StrUtil.isBlank(bindId) || bindType == null || userId == null || userType == null) { // 1. 校验入参任何一个为空直接返回null
if (StrUtil.isBlank(bindId)
|| ObjectUtil.isNull(bindType)
|| ObjectUtil.isNull(bindType)
|| ObjectUtil.isNull(bindType)) {
log.warn("初始化账户用户绑定信息失败参数存在空值bindId={}, bindType={}, userId={}, userType={}", bindId, bindType, userId, userType);
return null; return null;
} }
// 2. 查询是否已存在绑定关系
QueryWrapper<AccountUserBindConnect> queryWrapper = new QueryWrapper<>(); QueryWrapper<AccountUserBindConnect> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("bind_id", bindId) queryWrapper.eq("bind_id", bindId)
.eq("bind_type", bindType) .eq("bind_type", bindType)
@ -410,29 +427,44 @@ public class AccountUserBindConnectServiceImpl extends BaseServiceImpl<AccountUs
.eq("user_id", userId) .eq("user_id", userId)
.eq("bind_active", CommonConstant.Enable); .eq("bind_active", CommonConstant.Enable);
AccountUserBindConnect accountUserBindConnect = findOne(queryWrapper); AccountUserBindConnect existingBindConnect = findOne(queryWrapper);
if (accountUserBindConnect != null) { if (existingBindConnect != null) {
return accountUserBindConnect; log.info("账户用户绑定信息已存在bindId={}, bindType={}, userId={}, userType={}", bindId, bindType, userId, userType);
return existingBindConnect;
} }
// 新增一条绑定数据 // 3. 创建新的绑定关系
AccountUserBindConnect record = new AccountUserBindConnect(); AccountUserBindConnect newBindConnect = new AccountUserBindConnect();
record.setBind_id(bindId); newBindConnect.setBind_id(bindId);
record.setBind_type(bindType); newBindConnect.setBind_type(bindType);
record.setUser_id(userId); newBindConnect.setUser_id(userId);
record.setUser_type(userType); newBindConnect.setUser_type(userType);
record.setBind_active(CommonConstant.Enable); newBindConnect.setBind_active(CommonConstant.Enable);
record.setBind_time(new Date()); newBindConnect.setBind_time(new Date());
record.setBind_expires_in(0); newBindConnect.setBind_expires_in(0);
record.setBind_token_ttl(0); newBindConnect.setBind_token_ttl(0);
record.setBind_level(0); newBindConnect.setBind_level(0);
record.setBind_vip(0); newBindConnect.setBind_vip(0);
// 一定是 insert 新增不能 saveOrUpdate // log.debug("准备创建新的账户用户绑定信息: {}", JSONUtil.toJsonStr(newBindConnect));
if (add(record)) {
return record; // 4. 插入新的绑定关系处理唯一索引冲突异常
try {
if (add(newBindConnect)) {
log.info("成功创建账户用户绑定信息: bindId={}, bindType={}, userId={}, userType={}", bindId, bindType, userId, userType);
return newBindConnect;
} else {
log.error("创建账户用户绑定信息失败数据库操作返回false");
return null;
}
} catch (DuplicateKeyException e) {
// 5. 捕获唯一索引冲突异常
log.error("创建账户用户绑定信息失败违反唯一约束bindId={}, bindType={}, userId={}, userType={}", bindId, bindType, userId, userType, e);
return null;
} catch (Exception e) {
// 6. 捕获其他异常
log.error("创建账户用户绑定信息时发生未知异常bindId={}, bindType={}, userId={}, userType={}", bindId, bindType, userId, userType, e);
return null;
} }
return null;
} }
} }

View File

@ -12,6 +12,7 @@ import lombok.experimental.Accessors;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date;
/** /**
* <p> * <p>
@ -101,4 +102,9 @@ public class PayUserResource implements Serializable {
@ApiModelProperty(value = "乐观锁") @ApiModelProperty(value = "乐观锁")
private Integer version; private Integer version;
@ApiModelProperty(value = "新增时间,默认当前时间")
private Date created_at;
@ApiModelProperty(value = "最后更新时间,默认当前时间")
private Date updated_at;
} }

View File

@ -28,16 +28,6 @@ redis:
separator: ":" separator: ":"
expire: 3600 expire: 3600
redisson:
address: redis://@redis.host@:@redis.port@
database: @redis.database@ # Redis 库索引
password: @redis.password@ # Redis 密码
connectionPoolSize: 64 # 连接池大小
connectionMinimumIdleSize: 10 # 最小空闲连接数
idleConnectionTimeout: 10000 # 空闲连接超时时间(毫秒)
connectTimeout: 10000 # 连接超时时间(毫秒)
timeout: 3000 # 命令等待超时时间(毫秒)
baidu: baidu:
map: map:
app_id: 116444176 app_id: 116444176

View File

@ -333,6 +333,12 @@ public class PayController {
return flag; return flag;
} }
/**
* 订单退款远程调用
*
* @param shopOrderReturnList 退款列表
* @return 是否成功
*/
@RequestMapping(value = "/doRefund", method = RequestMethod.POST) @RequestMapping(value = "/doRefund", method = RequestMethod.POST)
public boolean doRefund(@RequestBody List<ShopOrderReturn> shopOrderReturnList) { public boolean doRefund(@RequestBody List<ShopOrderReturn> shopOrderReturnList) {
boolean flag = false; boolean flag = false;

File diff suppressed because one or more lines are too long

View File

@ -746,7 +746,7 @@ public class ShopActivityGroupbookingServiceImpl extends BaseServiceImpl<ShopAct
Integer return_next_state_id = StateCode.RETURN_PROCESS_FINISH; Integer return_next_state_id = StateCode.RETURN_PROCESS_FINISH;
//执行退货申请 //执行退货申请
flag = shopOrderReturnService.review(Collections.singletonList(return_id), Collections.singletonList(orderReturn), StateCode.RETURN_PROCESS_CHECK, return_next_state_id); flag = shopOrderReturnService.processReviewList(Collections.singletonList(return_id), Collections.singletonList(orderReturn), StateCode.RETURN_PROCESS_CHECK, return_next_state_id);
if (!flag) { if (!flag) {
throw new ApiException(ResultCode.FAILED); throw new ApiException(ResultCode.FAILED);

View File

@ -76,7 +76,7 @@ public class ShopOrderReturnController extends BaseControllerImpl {
return CommonResult.success(shopOrderReturnService.saveOrUpdate(shopOrderReturn)); return CommonResult.success(shopOrderReturnService.saveOrUpdate(shopOrderReturn));
} }
@ApiOperation(value = "退货单审核 - 同意退款退库", notes = "退货单审核 - 同意退款退库") @ApiOperation(value = "退货单审核 - 商家同意退款退库", notes = "退货单审核 - 同意退款退库")
@RequestMapping(value = "/review", method = RequestMethod.POST) @RequestMapping(value = "/review", method = RequestMethod.POST)
public CommonResult review(@RequestParam(name = "return_id") String return_id, public CommonResult review(@RequestParam(name = "return_id") String return_id,
@RequestParam(name = "return_flag", defaultValue = "0") Integer return_flag, @RequestParam(name = "return_flag", defaultValue = "0") Integer return_flag,
@ -86,10 +86,10 @@ public class ShopOrderReturnController extends BaseControllerImpl {
shopOrderReturn.setReturn_id(return_id); shopOrderReturn.setReturn_id(return_id);
shopOrderReturn.setReturn_flag(return_flag); shopOrderReturn.setReturn_flag(return_flag);
shopOrderReturn.setReturn_store_message(return_store_message); shopOrderReturn.setReturn_store_message(return_store_message);
return CommonResult.success(shopOrderReturnService.review(shopOrderReturn, receiving_address)); return CommonResult.success(shopOrderReturnService.processReviewList(shopOrderReturn, receiving_address));
} }
@ApiOperation(value = "退货单审核 - 家拒绝退款", notes = "退货单审核 - 卖家拒绝退款") @ApiOperation(value = "退货单审核 - 家拒绝退款", notes = "退货单审核 - 卖家拒绝退款")
@RequestMapping(value = "/refused", method = RequestMethod.POST) @RequestMapping(value = "/refused", method = RequestMethod.POST)
public CommonResult refused(ShopOrderReturn shopOrderReturn) { public CommonResult refused(ShopOrderReturn shopOrderReturn) {
String return_store_message = shopOrderReturn.getReturn_store_message(); String return_store_message = shopOrderReturn.getReturn_store_message();
@ -123,7 +123,7 @@ public class ShopOrderReturnController extends BaseControllerImpl {
ShopOrderReturn shopOrderReturn = shopOrderReturnService.get(return_id); ShopOrderReturn shopOrderReturn = shopOrderReturnService.get(return_id);
if (CheckUtil.checkDataRights(store_id, shopOrderReturn, ShopOrderReturn::getStore_id)) { if (CheckUtil.checkDataRights(store_id, shopOrderReturn, ShopOrderReturn::getStore_id)) {
shopOrderReturnService.review(Collections.singletonList(return_id), Collections.singletonList(shopOrderReturn), StateCode.RETURN_PROCESS_RECEIVED, null); shopOrderReturnService.processReviewList(Collections.singletonList(return_id), Collections.singletonList(shopOrderReturn), StateCode.RETURN_PROCESS_RECEIVED, null);
} else { } else {
throw new ApiException(ResultCode.FORBIDDEN); throw new ApiException(ResultCode.FORBIDDEN);
} }

View File

@ -58,7 +58,7 @@ public class UserReturnController extends BaseControllerImpl {
return shopOrderReturnService.returnItem(); return shopOrderReturnService.returnItem();
} }
@ApiOperation(value = "添加退款退货-发货退货,卖家也可以决定不退货退款,买家申请退款不支持。卖家可以主动退款。", notes = "添加退款退货-发货退货,卖家也可以决定不退货退款,买家申请退款不支持。卖家可以主动退款。") @ApiOperation(value = "添加退款退货-部分退货,卖家也可以决定不退货退款,买家申请退款不支持。卖家可以主动退款。", notes = "添加退款退货-发货退货,卖家也可以决定不退货退款,买家申请退款不支持。卖家可以主动退款。")
@RequestMapping(value = "/addItem", method = RequestMethod.GET) @RequestMapping(value = "/addItem", method = RequestMethod.GET)
public CommonResult addItem(OrderReturnVo orderReturnVo) { public CommonResult addItem(OrderReturnVo orderReturnVo) {
OrderReturnInputVo orderReturnInput = BeanUtil.copyProperties(orderReturnVo, OrderReturnInputVo.class); OrderReturnInputVo orderReturnInput = BeanUtil.copyProperties(orderReturnVo, OrderReturnInputVo.class);

View File

@ -43,7 +43,7 @@ public interface ShopOrderReturnService extends IBaseService<ShopOrderReturn> {
Map getReturnDetail(String return_id); Map getReturnDetail(String return_id);
boolean review(ShopOrderReturn shopOrderReturn, Integer receiving_address); boolean processReviewList(ShopOrderReturn shopOrderReturn, Integer receiving_address);
/** /**
* 退单审核 * 退单审核
@ -54,7 +54,7 @@ public interface ShopOrderReturnService extends IBaseService<ShopOrderReturn> {
* @param return_next_state_id * @param return_next_state_id
* @return * @return
*/ */
boolean review(List<String> return_ids, List<ShopOrderReturn> return_rows, Integer state_id, Integer return_next_state_id); boolean processReviewList(List<String> return_ids, List<ShopOrderReturn> return_rows, Integer state_id, Integer return_next_state_id);
/** /**
* 卖家拒绝退款 * 卖家拒绝退款

View File

@ -744,7 +744,7 @@ public class ShopOrderReturnServiceImpl extends BaseServiceImpl<ShopOrderReturnM
ShopOrderReturn orderReturn = get(return_id); ShopOrderReturn orderReturn = get(return_id);
if (CheckUtil.checkDataRights(store_id, orderReturn, ShopOrderReturn::getStore_id)) { if (CheckUtil.checkDataRights(store_id, orderReturn, ShopOrderReturn::getStore_id)) {
review(Collections.singletonList(return_id), Collections.singletonList(orderReturn), StateCode.RETURN_PROCESS_REFUND, null); processReviewList(Collections.singletonList(return_id), Collections.singletonList(orderReturn), StateCode.RETURN_PROCESS_REFUND, null);
} else { } else {
throw new ApiException(I18nUtil._("无操作权限!")); throw new ApiException(I18nUtil._("无操作权限!"));
} }
@ -875,7 +875,7 @@ public class ShopOrderReturnServiceImpl extends BaseServiceImpl<ShopOrderReturnM
} }
// 订单审核 // 订单审核
review(return_ids, Collections.singletonList(shopOrderReturn), StateCode.RETURN_PROCESS_CHECK, null); processReviewList(return_ids, Collections.singletonList(shopOrderReturn), StateCode.RETURN_PROCESS_CHECK, null);
} else { } else {
throw new ApiException(ResultCode.FORBIDDEN); throw new ApiException(ResultCode.FORBIDDEN);
} }
@ -1115,22 +1115,23 @@ public class ShopOrderReturnServiceImpl extends BaseServiceImpl<ShopOrderReturnM
} }
/** /**
* 退货单审核 - 同意退款退库 * 退货单审核 - 商家同意退款退库
* *
* @param shopOrderReturn * @param shopOrderReturn
* @return * @return
*/ */
@Override @Override
@GlobalTransactional @GlobalTransactional
public boolean review(ShopOrderReturn shopOrderReturn, Integer receiving_address) { public boolean processReviewList(ShopOrderReturn shopOrderReturn, Integer receiving_address) {
Integer store_id = null; Integer store_id;
if (shopOrderReturn.getStore_id() == null) { if (shopOrderReturn.getStore_id() == null) {
UserDto user = getCurrentUser(); UserDto user = getCurrentUser();
store_id = Convert.toInt(user.getStore_id()); store_id = Convert.toInt(user.getStore_id());
} else { } else {
store_id = shopOrderReturn.getStore_id(); store_id = shopOrderReturn.getStore_id();
} }
String str_return_id = shopOrderReturn.getReturn_id(); String str_return_id = shopOrderReturn.getReturn_id();
List<String> return_ids = Convert.toList(String.class, str_return_id); List<String> return_ids = Convert.toList(String.class, str_return_id);
@ -1140,17 +1141,19 @@ public class ShopOrderReturnServiceImpl extends BaseServiceImpl<ShopOrderReturnM
Integer return_flag = shopOrderReturn.getReturn_flag(); Integer return_flag = shopOrderReturn.getReturn_flag();
if (ObjectUtil.equal(return_flag, 0)) { if (ObjectUtil.equal(return_flag, 0)) {
//无需退货直接修改退货单状态为完成并调用 review 方法进行审核
if (!edit(shopOrderReturn)) { if (!edit(shopOrderReturn)) {
throw new ApiException(I18nUtil._("修改订单信息失败!")); throw new ApiException(I18nUtil._("修改订单信息失败!"));
} }
Integer return_next_state_id = StateCode.RETURN_PROCESS_FINISH; Integer return_next_state_id = StateCode.RETURN_PROCESS_FINISH;
// 订单审核 // 订单审核
if (!review(return_ids, orderReturns, StateCode.RETURN_PROCESS_CHECK, return_next_state_id)) { if (!processReviewList(return_ids, orderReturns, StateCode.RETURN_PROCESS_CHECK, return_next_state_id)) {
throw new ApiException(I18nUtil._("审核失败!")); throw new ApiException(I18nUtil._("审核失败!"));
} }
} else { } else {
//需要退货获取收货地址信息并更新退货单的相关字段如地址联系方式等随后调用 review 方法进行审核
ShopStoreShippingAddress address_row = shopStoreShippingAddressService.get(receiving_address); ShopStoreShippingAddress address_row = shopStoreShippingAddressService.get(receiving_address);
if (address_row != null) { if (address_row != null) {
String return_addr = address_row.getSs_province() + address_row.getSs_city() + address_row.getSs_county() + address_row.getSs_address(); String return_addr = address_row.getSs_province() + address_row.getSs_city() + address_row.getSs_county() + address_row.getSs_address();
@ -1167,7 +1170,7 @@ public class ShopOrderReturnServiceImpl extends BaseServiceImpl<ShopOrderReturnM
} }
// 订单审核 // 订单审核
if (!review(return_ids, orderReturns, StateCode.RETURN_PROCESS_CHECK, 0)) { if (!processReviewList(return_ids, orderReturns, StateCode.RETURN_PROCESS_CHECK, 0)) {
throw new ApiException(I18nUtil._("审核失败!")); throw new ApiException(I18nUtil._("审核失败!"));
} }
} else { } else {
@ -1175,8 +1178,10 @@ public class ShopOrderReturnServiceImpl extends BaseServiceImpl<ShopOrderReturnM
} }
} }
} else { } else {
// 没有权限
throw new ApiException(ResultCode.FORBIDDEN); throw new ApiException(ResultCode.FORBIDDEN);
} }
// 通知买家退货退款成功 // 通知买家退货退款成功
String message_id = "refunds-and-reminders"; String message_id = "refunds-and-reminders";
Map args = new HashMap(); Map args = new HashMap();
@ -1184,7 +1189,6 @@ public class ShopOrderReturnServiceImpl extends BaseServiceImpl<ShopOrderReturnM
args.put("return_refund_amount", shopOrderReturn.getReturn_refund_amount()); args.put("return_refund_amount", shopOrderReturn.getReturn_refund_amount());
messageService.sendNoticeMsg(shopOrderReturn.getBuyer_user_id(), 0, message_id, args); messageService.sendNoticeMsg(shopOrderReturn.getBuyer_user_id(), 0, message_id, args);
return true; return true;
} }
@ -1224,7 +1228,7 @@ public class ShopOrderReturnServiceImpl extends BaseServiceImpl<ShopOrderReturnM
} }
@Override @Override
public boolean review(List<String> return_ids, List<ShopOrderReturn> return_rows, Integer state_id, Integer return_next_state_id) { public boolean processReviewList(List<String> return_ids, List<ShopOrderReturn> return_rows, Integer state_id, Integer return_next_state_id) {
if (CollUtil.isEmpty(return_ids)) { if (CollUtil.isEmpty(return_ids)) {
throw new ApiException(I18nUtil._("请选择需要审核的退单!")); throw new ApiException(I18nUtil._("请选择需要审核的退单!"));
} }
@ -1278,9 +1282,17 @@ public class ShopOrderReturnServiceImpl extends BaseServiceImpl<ShopOrderReturnM
* *
* @param return_ids 退货订单id * @param return_ids 退货订单id
* @param store_id 所属店铺 * @param store_id 所属店铺
* @param return_state_id * @param return_state_id 当前退单状态
* @param return_rows * RETURN_PROCESS_SUBMIT = 3100; //客户提交退单1ReturnReturn
* @param return_next_state_id 当前订单状态 * RETURN_PROCESS_CHECK = 3105; //退单审核1ReturnReturn
* RETURN_PROCESS_RECEIVED = 3110; //收货确认0ReturnReturn
* RETURN_PROCESS_REFUND = 3115; //退款确认0ReturnReturn
* RETURN_PROCESS_RECEIPT_CONFIRMATION = 3120; //客户收款确认0ReturnReturn
* RETURN_PROCESS_FINISH = 3125; //完成1ReturnReturn3130-商家拒绝退货
* RETURN_PROCESS_REFUSED = 3130; //-商家拒绝退货
* RETURN_PROCESS_CANCEL = 3135; //-买家取消
* @param return_rows 退货订单列表
* @param return_next_state_id 下一个退单状态
* @return * @return
*/ */
@GlobalTransactional @GlobalTransactional
@ -1333,6 +1345,7 @@ public class ShopOrderReturnServiceImpl extends BaseServiceImpl<ShopOrderReturnM
} }
} }
// 判断是否需要退款
if (shopStoreConfigService.checkNeedRefund(return_state_id, return_next_state_id)) { if (shopStoreConfigService.checkNeedRefund(return_state_id, return_next_state_id)) {
// 执行真正退款逻辑 // 执行真正退款逻辑
// 卖家账户扣款买家账户增加 // 卖家账户扣款买家账户增加
@ -1346,6 +1359,7 @@ public class ShopOrderReturnServiceImpl extends BaseServiceImpl<ShopOrderReturnM
} }
} }
//修改退货订单及其相关商品为下一个待处理状态
editReturnNextState(return_ids, return_state_id, shopOrderReturn); editReturnNextState(return_ids, return_state_id, shopOrderReturn);
// 当前状态 - 旧状态 // 当前状态 - 旧状态
@ -1457,7 +1471,8 @@ public class ShopOrderReturnServiceImpl extends BaseServiceImpl<ShopOrderReturnM
} }
/** /**
* 修改订单为下一个待处理状态 * 修改退货订单及其相关商品为下一个待处理状态
* 这段代码实现了一个方法用于将退货订单及其相关商品的状态更新为下一个待处理状态
* *
* @param return_ids 退货订单id * @param return_ids 退货订单id
* @param return_state_id 前订单状态 * @param return_state_id 前订单状态

View File

@ -198,6 +198,20 @@ public class ShopStoreConfigServiceImpl extends BaseServiceImpl<ShopStoreConfigM
} }
} }
/**
* 检查是否需要退款
*
* @param return_state_id RETURN_PROCESS_SUBMIT = 3100; //客户提交退单1ReturnReturn
* RETURN_PROCESS_CHECK = 3105; //退单审核1ReturnReturn
* RETURN_PROCESS_RECEIVED = 3110; //收货确认0ReturnReturn
* RETURN_PROCESS_REFUND = 3115; //退款确认0ReturnReturn
* RETURN_PROCESS_RECEIPT_CONFIRMATION = 3120; //客户收款确认0ReturnReturn
* RETURN_PROCESS_FINISH = 3125; //完成1ReturnReturn3130-商家拒绝退货
* RETURN_PROCESS_REFUSED = 3130; //-商家拒绝退货
* RETURN_PROCESS_CANCEL = 3135; //-买家取消
* @param return_next_state_id
* @return
*/
@Override @Override
public boolean checkNeedRefund(Integer return_state_id, Integer return_next_state_id) { public boolean checkNeedRefund(Integer return_state_id, Integer return_next_state_id) {
Integer return_process_refund = StateCode.RETURN_PROCESS_MAP.get(StateCode.RETURN_PROCESS_REFUND); Integer return_process_refund = StateCode.RETURN_PROCESS_MAP.get(StateCode.RETURN_PROCESS_REFUND);

View File

@ -760,7 +760,7 @@ public class SyncThirdDataServiceImpl extends SyncBaseThirdSxAbstract implements
// 使用 Redis HINCRBY 保证原子性和高性能 // 使用 Redis HINCRBY 保证原子性和高性能
redisTemplate.opsForHash().increment(RedisKey.STOREDATARELEASE, productKey, delta); redisTemplate.opsForHash().increment(RedisKey.STOREDATARELEASE, productKey, delta);
} catch (Exception e) { } catch (Exception e) {
logger.error("库存累失败productKey={}, delta={}, error={}", productKey, delta, e.getMessage(), e); logger.error("库存累失败productKey={}, delta={}, error={}", productKey, delta, e.getMessage(), e);
} }
} }
} }