|
@@ -77,6 +77,16 @@ public class CdKeyGroupServiceImpl extends ServiceImpl<CdKeyGroupMapper, CdKeyGr
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public String createCdKeyGroup(CdKeyCreateParam param) {
|
|
|
+
|
|
|
+ Integer totalQuantity = param.getQuantity();
|
|
|
+ Integer goodsQuantity = 0;
|
|
|
+ for (CdKeyGroupGoods cdKeyGroupGoods : param.getGoodsList()) {
|
|
|
+ goodsQuantity += cdKeyGroupGoods.getQuantity();
|
|
|
+ }
|
|
|
+ if (!totalQuantity.equals(goodsQuantity)) {
|
|
|
+ throw new ServiceException("兑换码数量不一致");
|
|
|
+ }
|
|
|
+
|
|
|
Channel channel = channelService.getById(param.getChannelId());
|
|
|
if (channel == null) {
|
|
|
LogUtil.error(logger,"门店不存在,channelId:{0}", param.getChannelId());
|
|
@@ -85,6 +95,7 @@ public class CdKeyGroupServiceImpl extends ServiceImpl<CdKeyGroupMapper, CdKeyGr
|
|
|
// 生成兑换码组
|
|
|
CdKeyGroup cdKeyGroup = mapperFacade.map(param, CdKeyGroup.class);
|
|
|
cdKeyGroup.setGroupId(bizIdGenerator.newId());
|
|
|
+ cdKeyGroup.setTitle(param.getTitle());
|
|
|
cdKeyGroup.setStatus(CdKeyGroupStatusEnum.WAITING);
|
|
|
cdKeyGroup.setSiteName(channel.getName());
|
|
|
cdKeyGroup.setCreatedTime(new Date());
|