测试问题代码修改

This commit is contained in:
纪寒 2023-11-09 16:26:41 +08:00
parent 5171209fb4
commit d99f503b63

View File

@ -302,29 +302,29 @@ public class PatientCenterServiceImpl implements PatientCenterService {
GoodsAttributeDetails goodsAttributeDetails = nursingStationGoodsMapper.selectGoodsAttributeDetailsGoodsStockById(goodsOrder.getGoodsAttributeDetailsId());
//判断当前商品是否可兑换商品
if (Objects.nonNull(goodsAttributeDetails) && CouponAndIntegralFlagEnum.NOT_CONVERTIBLE.getInfo().equals(goodsAttributeDetails.getIntegralExchangeFlag())) {
return AjaxResult.error("当前商品非积分兑换商品,无法兑换!");
return AjaxResult.error("当前商品非健康豆兑换商品,无法兑换!");
}
//判断积分兑换数值是否正确
boolean integralExchangeSill = Objects.nonNull(goodsAttributeDetails) && Objects.isNull(goodsAttributeDetails.getIntegralExchangeSill());
boolean equalIntegralExchangeSill = Objects.nonNull(goodsAttributeDetails) && !goodsOrder.getIntegralExchangeSill().equals(goodsAttributeDetails.getIntegralExchangeSill());
if (BooleanUtils.isTrue(integralExchangeSill) || BooleanUtils.isTrue(equalIntegralExchangeSill)) {
return AjaxResult.error("当前商品兑换需要使用的积分数值不正确,无法兑换!");
return AjaxResult.error("当前商品兑换需要使用的健康豆数量不正确,无法兑换!");
}
//判断积分兑换商品数目是否正确
boolean integralExchangeCount = Objects.nonNull(goodsAttributeDetails) && Objects.isNull(goodsAttributeDetails.getIntegralExchangeCount());
boolean equalIntegralExchangeCount = Objects.nonNull(goodsAttributeDetails) && !goodsOrder.getIntegralExchangeCount().equals(goodsAttributeDetails.getIntegralExchangeCount());
if (BooleanUtils.isTrue(integralExchangeCount) || BooleanUtils.isTrue(equalIntegralExchangeCount)) {
return AjaxResult.error("当前积分兑换商品的数量不正确,无法兑换!");
return AjaxResult.error("当前健康豆兑换商品的数量不正确,无法兑换!");
}
//判断库存是否充足
if (Objects.isNull(goodsAttributeDetails.getGoodsStock()) || goodsAttributeDetails.getGoodsStock() == 0) {
return AjaxResult.error("当前商品库存不足,无法购买");
return AjaxResult.error("当前商品库存不足,无法兑换");
}
//判读用户账户积分是否充足
AtomicInteger patientIntegral = new AtomicInteger(Objects.isNull(patientInfo.getIntegral()) ? 0 : patientInfo.getIntegral());
AtomicInteger exchangeIntegralSkill = new AtomicInteger(Objects.isNull(goodsOrder.getIntegralExchangeSill()) ? 0 : goodsOrder.getIntegralExchangeSill());
if (patientIntegral.get() < exchangeIntegralSkill.get()) {
return AjaxResult.error("当前用户的账户积分数值不足,无法兑换!");
return AjaxResult.error("当前用户的健康豆数目值不足,无法兑换!");
}
//判断商品库存数量是否满足兑换数量
AtomicInteger goodsStock = new AtomicInteger(goodsAttributeDetails.getGoodsStock());