积分模块相关代码
This commit is contained in:
@@ -20,4 +20,6 @@ public interface TbPointsGoodsSettingService extends IService<TbPointsGoodsSetti
|
||||
|
||||
boolean update(TbPointsGoodsSetting dto);
|
||||
|
||||
void delete(Long id);
|
||||
|
||||
}
|
||||
@@ -126,6 +126,9 @@ public class TbPointsExchangeRecordServiceImpl extends ServiceImpl<TbPointsExcha
|
||||
if (goods == null) {
|
||||
throw new MsgException("兑换的商品信息不存在");
|
||||
}
|
||||
if (goods.getDelFlag() == 1) {
|
||||
throw new MsgException("兑换的商品信息不存在");
|
||||
}
|
||||
record.setPointsGoodsName(goods.getGoodsName());
|
||||
record.setGoodsImageUrl(goods.getGoodsImageUrl());
|
||||
|
||||
@@ -178,6 +181,10 @@ public class TbPointsExchangeRecordServiceImpl extends ServiceImpl<TbPointsExcha
|
||||
log.setFloatPoints(-requiredPoints);
|
||||
log.setCreateTime(new Date());
|
||||
tbMemberPointsLogMapper.insert(log);
|
||||
// 更新累计兑换数量
|
||||
goods.setTotalExchangeCount(goods.getTotalExchangeCount() + 1);
|
||||
goods.setUpdateTime(new Date());
|
||||
tbPointsGoodsSettingMapper.updateById(goods);
|
||||
return record;
|
||||
}
|
||||
|
||||
|
||||
@@ -92,4 +92,9 @@ public class TbPointsGoodsSettingServiceImpl extends ServiceImpl<TbPointsGoodsSe
|
||||
entity.setUpdateTime(new Date());
|
||||
return super.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(Long id) {
|
||||
super.update(Wrappers.<TbPointsGoodsSetting>lambdaUpdate().set(TbPointsGoodsSetting::getDelFlag, 1).eq(TbPointsGoodsSetting::getId, id));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user