This commit is contained in:
齐天大圣 2024-06-03 08:40:17 +08:00
parent e2f89bd897
commit ccde099d3d
3 changed files with 16 additions and 3 deletions

View File

@ -227,14 +227,16 @@ public class IntegralGiftServiceImpl implements IntegralGiftService {
String lockKey = "integralGift-"+id; String lockKey = "integralGift-"+id;
Boolean isLock = redisLock.tryLock(lockKey,500,5000, TimeUnit.MILLISECONDS); Boolean isLock = redisLock.tryLock(lockKey,500,5000, TimeUnit.MILLISECONDS);
if (isLock) { if (isLock) {
redisLock.unlock(lockKey); try {
IntegralGift integralGift = integralGiftDao.queryById(id); IntegralGift integralGift = integralGiftDao.queryById(id);
if (editInventory.compareTo(integralGift.getRemainingInventory())>0) { if (editInventory.compareTo(integralGift.getRemainingInventory())>0) {
throw new RuntimeException("该积分商品库存不足!"); throw new RuntimeException("该积分商品库存不足!");
}else { }else {
integralGiftDao.updateInventoryByLock(id, editInventory); integralGiftDao.updateInventoryByLock(id, editInventory);
} }
}finally {
redisLock.unlock(lockKey);
}
} }
return true; return true;
} }

View File

@ -113,5 +113,12 @@ public class CardValueOrdersController extends BaseController {
String status = map.get("status"); String status = map.get("status");
cardValueOrdersService.updateOrderStatus(orderNo,status); cardValueOrdersService.updateOrderStatus(orderNo,status);
} }
@PostMapping("getOneByOrderNo")
public void getOneByOrderNo(@RequestBody Map<String,String> map){
String orderNo = map.get("orderNo");
cardValueOrdersService.getOneByOrderNo(orderNo);
}
} }

View File

@ -68,7 +68,11 @@ public class OilTagController extends BaseController {
} }
// queryWrapper.eq(OilTag::getDeptId,nowAccountInfo.getDeptId()); // queryWrapper.eq(OilTag::getDeptId,nowAccountInfo.getDeptId());
// FIND_IN_SET // FIND_IN_SET
queryWrapper.apply("FIND_IN_SET('" + nowAccountInfo.getDeptId() + "', dept_ids)"); if (100!=nowAccountInfo.getDeptId()){
queryWrapper.apply("FIND_IN_SET('" + nowAccountInfo.getDeptId() + "', dept_ids)");
//queryWrapper.eq(OilTag::getDeptId,nowAccountInfo.getDeptId());
}
//queryWrapper.apply("FIND_IN_SET('" + nowAccountInfo.getDeptId() + "', dept_ids)");
if (ObjectUtils.isNotEmpty(oilTag.getSnCode())){ if (ObjectUtils.isNotEmpty(oilTag.getSnCode())){
queryWrapper.eq(OilTag::getSnCode,oilTag.getSnCode()); queryWrapper.eq(OilTag::getSnCode,oilTag.getSnCode());