卡券数量不能为负数
This commit is contained in:
@@ -330,6 +330,15 @@ public class EmpCardGiftService extends MybatisBaseService<EmpCardGiftMapper, Em
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ResultBean generateCard(EmpCardGiftDto dto) {
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
if(dto.getCount().contains("-")){
|
||||
return rb.setMsg("卡券数量不能为负数,请重新填写");
|
||||
}
|
||||
int count=0;
|
||||
try{
|
||||
count=Integer.parseInt(dto.getCount());
|
||||
}catch (Exception e){
|
||||
return rb.setMsg("卡券数量不是数字,请重新填写");
|
||||
}
|
||||
if (StringUtils.isBlank(dto.getEmpCardSid())) {
|
||||
return rb.setMsg("请选择企业卡");
|
||||
}
|
||||
@@ -340,12 +349,13 @@ public class EmpCardGiftService extends MybatisBaseService<EmpCardGiftMapper, Em
|
||||
}
|
||||
for(GoodsVo goodsVo:dto.getGoodsVoList()){
|
||||
EmpCardVo vo= empCardService.getBagGoods(dto.getEmpCardSid(),goodsVo.getGoodsSid()).getData();
|
||||
if(goodsVo.getSelect()*Integer.valueOf(dto.getCount())>vo.getGoodsNumber()){
|
||||
if(goodsVo.getSelect()*count>vo.getGoodsNumber()){
|
||||
return rb.setMsg("商品数量不足,请重新选择");
|
||||
}
|
||||
}
|
||||
|
||||
LpkGiftBag bag=lpkGiftBagService.getOne(new QueryWrapper<LpkGiftBag>().eq("sid",empCard.getGiftbagSid()));
|
||||
for (int k = 0; k < Integer.valueOf(dto.getCount()); k++) {
|
||||
for (int k = 0; k < count; k++) {
|
||||
EmpCardGrantLog record = new EmpCardGrantLog();
|
||||
record.setCreateTime(new DateTime());
|
||||
record.setEmpCardSid(dto.getEmpCardSid());
|
||||
|
||||
Reference in New Issue
Block a user