|
@ -14,6 +14,7 @@ import com.yxt.common.core.result.ResultBean; |
|
|
import com.yxt.common.core.vo.PagerVo; |
|
|
import com.yxt.common.core.vo.PagerVo; |
|
|
import com.yxt.yyth.api.empcard.EmpAppletVo; |
|
|
import com.yxt.yyth.api.empcard.EmpAppletVo; |
|
|
import com.yxt.yyth.api.empcard.EmpCard; |
|
|
import com.yxt.yyth.api.empcard.EmpCard; |
|
|
|
|
|
import com.yxt.yyth.api.empcard.EmpCardVo; |
|
|
import com.yxt.yyth.api.empcardgift.*; |
|
|
import com.yxt.yyth.api.empcardgift.*; |
|
|
import com.yxt.yyth.api.empcardgiftgoods.EmpCardGiftGoodsDto; |
|
|
import com.yxt.yyth.api.empcardgiftgoods.EmpCardGiftGoodsDto; |
|
|
import com.yxt.yyth.api.empcardgiftgoods.EmpCardGiftGoodsVo; |
|
|
import com.yxt.yyth.api.empcardgiftgoods.EmpCardGiftGoodsVo; |
|
@ -326,6 +327,13 @@ public class EmpCardGiftService extends MybatisBaseService<EmpCardGiftMapper, Em |
|
|
if(null==empCard){ |
|
|
if(null==empCard){ |
|
|
return rb.setMsg("请选择正确的企业卡"); |
|
|
return rb.setMsg("请选择正确的企业卡"); |
|
|
} |
|
|
} |
|
|
|
|
|
for(GoodsVo goodsVo:dto.getGoodsVoList()){ |
|
|
|
|
|
EmpCardVo vo= empCardService.getBagGoods(dto.getEmpCardSid(),goodsVo.getGoodsSid()).getData(); |
|
|
|
|
|
if(goodsVo.getSelect()*Integer.valueOf(dto.getCount())>vo.getGoodsNumber()){ |
|
|
|
|
|
return rb.setMsg("商品数量不足,请重新选择"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
for (int k = 0; k < Integer.valueOf(dto.getCount()); k++) { |
|
|
EmpCardGrantLog record = new EmpCardGrantLog(); |
|
|
EmpCardGrantLog record = new EmpCardGrantLog(); |
|
|
record.setCreateTime(new DateTime()); |
|
|
record.setCreateTime(new DateTime()); |
|
|
record.setEmpCardSid(dto.getEmpCardSid()); |
|
|
record.setEmpCardSid(dto.getEmpCardSid()); |
|
@ -342,10 +350,13 @@ public class EmpCardGiftService extends MybatisBaseService<EmpCardGiftMapper, Em |
|
|
card.setState("1"); |
|
|
card.setState("1"); |
|
|
card.setCreateTime(new DateTime()); |
|
|
card.setCreateTime(new DateTime()); |
|
|
card.setGrantDate(new Date()); |
|
|
card.setGrantDate(new Date()); |
|
|
card.setCodeKey(dto.getCodeKey()); |
|
|
|
|
|
card.setCode(dto.getCode()); |
|
|
|
|
|
String cardArea="9"; |
|
|
String cardArea="9"; |
|
|
String maxSerNum = baseMapper.selctMaxSerNum(cardArea); |
|
|
String maxSerNum = baseMapper.selctMaxSerNum(cardArea); |
|
|
|
|
|
String uuid = UniqueIdGenerator.generateUniqueID(); |
|
|
|
|
|
int randomNumber = new Random().nextInt(900000) + 100000; |
|
|
|
|
|
card.setCodeKey(String.valueOf(randomNumber)); |
|
|
|
|
|
card.setCode("99"+uuid.substring(2)); |
|
|
if (StringUtils.isBlank(maxSerNum)) { |
|
|
if (StringUtils.isBlank(maxSerNum)) { |
|
|
card.setSerialNumber(cardArea + "0000001"); |
|
|
card.setSerialNumber(cardArea + "0000001"); |
|
|
} else { |
|
|
} else { |
|
@ -387,6 +398,7 @@ public class EmpCardGiftService extends MybatisBaseService<EmpCardGiftMapper, Em |
|
|
empCardService.changState(dto.getEmpCardSid(), "3"); |
|
|
empCardService.changState(dto.getEmpCardSid(), "3"); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
return rb.success(); |
|
|
return rb.success(); |
|
|
} |
|
|
} |
|
|
public ResultBean<EmpCardGiftVo> getEmpCardGoods(String empCardSid, String goodsSid) { |
|
|
public ResultBean<EmpCardGiftVo> getEmpCardGoods(String empCardSid, String goodsSid) { |
|
|