Commit 558ce6db by 吕明尚

房间套餐增加时长和使用时长匹配

parent 14d74ae5
...@@ -77,6 +77,11 @@ public class PackServiceImpl extends ServiceImpl<PackMapper, SPack> implements I ...@@ -77,6 +77,11 @@ public class PackServiceImpl extends ServiceImpl<PackMapper, SPack> implements I
@Override @Override
public int insertPack(SPack sPack) { public int insertPack(SPack sPack) {
sPack.setCreateTime(DateUtils.getNowDate()); sPack.setCreateTime(DateUtils.getNowDate());
if (sPack.getType().equals(YesNoEnum.yes.getIndex())) {
if ((Integer.parseInt(sPack.getPackaEndPeriod()) - Integer.parseInt(sPack.getPackaStartPeriod())) != Integer.parseInt(sPack.getDuration())) {
throw new BaseException("套餐时长和使用时长不匹配!");
}
}
return baseMapper.insertPack(sPack); return baseMapper.insertPack(sPack);
} }
...@@ -89,6 +94,11 @@ public class PackServiceImpl extends ServiceImpl<PackMapper, SPack> implements I ...@@ -89,6 +94,11 @@ public class PackServiceImpl extends ServiceImpl<PackMapper, SPack> implements I
@Override @Override
public int updatePack(SPack SPack) { public int updatePack(SPack SPack) {
SPack.setUpdateTime(DateUtils.getNowDate()); SPack.setUpdateTime(DateUtils.getNowDate());
if (SPack.getType().equals(YesNoEnum.yes.getIndex())) {
if ((Integer.parseInt(SPack.getPackaEndPeriod()) - Integer.parseInt(SPack.getPackaStartPeriod())) != Integer.parseInt(SPack.getDuration())) {
throw new BaseException("套餐时长和使用时长不匹配!");
}
}
return baseMapper.updatePack(SPack); return baseMapper.updatePack(SPack);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment