|
@ -24,8 +24,10 @@ import com.yxt.yyth.api.empreserveorder.EmpReserveOrderCardVo; |
|
|
import com.yxt.yyth.api.empreserveorder.EmpReserveOrderVo; |
|
|
import com.yxt.yyth.api.empreserveorder.EmpReserveOrderVo; |
|
|
import com.yxt.yyth.api.empreserveordergoods.EmpReserveOrderGoods; |
|
|
import com.yxt.yyth.api.empreserveordergoods.EmpReserveOrderGoods; |
|
|
import com.yxt.yyth.api.lpkcardbuildrecord.LpkCardBuildRecord; |
|
|
import com.yxt.yyth.api.lpkcardbuildrecord.LpkCardBuildRecord; |
|
|
|
|
|
import com.yxt.yyth.api.lpkgiftbag.LpkGiftBag; |
|
|
import com.yxt.yyth.api.lpkgiftcard.AppletVo; |
|
|
import com.yxt.yyth.api.lpkgiftcard.AppletVo; |
|
|
import com.yxt.yyth.api.lpkgiftcard.BindCardDto; |
|
|
import com.yxt.yyth.api.lpkgiftcard.BindCardDto; |
|
|
|
|
|
import com.yxt.yyth.api.lpkgiftcard.LpkGiftCard; |
|
|
import com.yxt.yyth.api.lpkgoods.LpkGoods; |
|
|
import com.yxt.yyth.api.lpkgoods.LpkGoods; |
|
|
import com.yxt.yyth.api.lpkreserveorder.LpkReserveOrderCardVo; |
|
|
import com.yxt.yyth.api.lpkreserveorder.LpkReserveOrderCardVo; |
|
|
import com.yxt.yyth.api.lpkreserveorder.LpkReserveOrderVo; |
|
|
import com.yxt.yyth.api.lpkreserveorder.LpkReserveOrderVo; |
|
@ -36,6 +38,9 @@ import com.yxt.yyth.biz.empcardgiftgoods.EmpCardGiftGoodsService; |
|
|
import com.yxt.yyth.biz.empcardgrantlog.EmpCardGrantLogService; |
|
|
import com.yxt.yyth.biz.empcardgrantlog.EmpCardGrantLogService; |
|
|
import com.yxt.yyth.biz.empreserveorder.EmpReserveOrderService; |
|
|
import com.yxt.yyth.biz.empreserveorder.EmpReserveOrderService; |
|
|
import com.yxt.yyth.biz.empreserveordergoods.EmpReserveOrderGoodsService; |
|
|
import com.yxt.yyth.biz.empreserveordergoods.EmpReserveOrderGoodsService; |
|
|
|
|
|
import com.yxt.yyth.biz.lpkgiftbag.LpkGiftBagService; |
|
|
|
|
|
import com.yxt.yyth.biz.lpkgiftcard.LpkGiftCardRest; |
|
|
|
|
|
import com.yxt.yyth.biz.lpkgiftcard.LpkGiftCardService; |
|
|
import com.yxt.yyth.biz.lpkgiftcard.generateRule.UniqueIdGenerator; |
|
|
import com.yxt.yyth.biz.lpkgiftcard.generateRule.UniqueIdGenerator; |
|
|
import com.yxt.yyth.biz.lpkgoods.LpkGoodsService; |
|
|
import com.yxt.yyth.biz.lpkgoods.LpkGoodsService; |
|
|
import com.yxt.yyth.biz.lpkreserveorder.LpkReserveOrderService; |
|
|
import com.yxt.yyth.biz.lpkreserveorder.LpkReserveOrderService; |
|
@ -87,6 +92,10 @@ public class EmpCardGiftService extends MybatisBaseService<EmpCardGiftMapper, Em |
|
|
@Autowired |
|
|
@Autowired |
|
|
LpkStoreService lpkStoreService; |
|
|
LpkStoreService lpkStoreService; |
|
|
@Autowired |
|
|
@Autowired |
|
|
|
|
|
LpkGiftCardService lpkGiftCardService; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
LpkGiftBagService lpkGiftBagService; |
|
|
|
|
|
@Autowired |
|
|
private FileUploadComponent fileUploadComponent; |
|
|
private FileUploadComponent fileUploadComponent; |
|
|
|
|
|
|
|
|
@Autowired |
|
|
@Autowired |
|
@ -241,6 +250,8 @@ public class EmpCardGiftService extends MybatisBaseService<EmpCardGiftMapper, Em |
|
|
vo.setValue(vo2.getSid()); |
|
|
vo.setValue(vo2.getSid()); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
EmpCardGift empCardGift=baseMapper.selectOne(new QueryWrapper<EmpCardGift>().eq("empCardSid",vo.getSid()).eq("cardType","2")); |
|
|
|
|
|
vo.setEmpCardGift(empCardGift); |
|
|
vo.setOrderCardVoList(empReserveOrderCardVos); |
|
|
vo.setOrderCardVoList(empReserveOrderCardVos); |
|
|
vo.setGoodsVos(goodsVos); |
|
|
vo.setGoodsVos(goodsVos); |
|
|
return rb.success().setData(vo); |
|
|
return rb.success().setData(vo); |
|
@ -333,6 +344,7 @@ public class EmpCardGiftService extends MybatisBaseService<EmpCardGiftMapper, Em |
|
|
return rb.setMsg("商品数量不足,请重新选择"); |
|
|
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 < Integer.valueOf(dto.getCount()); k++) { |
|
|
EmpCardGrantLog record = new EmpCardGrantLog(); |
|
|
EmpCardGrantLog record = new EmpCardGrantLog(); |
|
|
record.setCreateTime(new DateTime()); |
|
|
record.setCreateTime(new DateTime()); |
|
@ -350,6 +362,8 @@ 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.setEndDate(bag.getDateEnd()); |
|
|
|
|
|
card.setStartDate(bag.getDateStart()); |
|
|
|
|
|
|
|
|
String cardArea="9"; |
|
|
String cardArea="9"; |
|
|
String maxSerNum = baseMapper.selctMaxSerNum(cardArea); |
|
|
String maxSerNum = baseMapper.selctMaxSerNum(cardArea); |
|
@ -373,12 +387,13 @@ public class EmpCardGiftService extends MybatisBaseService<EmpCardGiftMapper, Em |
|
|
} |
|
|
} |
|
|
baseMapper.insert(card); |
|
|
baseMapper.insert(card); |
|
|
for(GoodsVo vo:dto.getGoodsVoList()){ |
|
|
for(GoodsVo vo:dto.getGoodsVoList()){ |
|
|
|
|
|
if(vo.getSelect()!=0){ |
|
|
EmpCardGiftGoodsDto dto1=new EmpCardGiftGoodsDto(); |
|
|
EmpCardGiftGoodsDto dto1=new EmpCardGiftGoodsDto(); |
|
|
dto1.setEmpCardGiftSid(card.getSid()); |
|
|
dto1.setEmpCardGiftSid(card.getSid()); |
|
|
dto1.setGoodsSid(vo.getGoodsSid()); |
|
|
dto1.setGoodsSid(vo.getGoodsSid()); |
|
|
dto1.setGoodsNumber(vo.getSelect()); |
|
|
dto1.setGoodsNumber(vo.getSelect()); |
|
|
empCardGiftGoodsService.save(dto1); |
|
|
empCardGiftGoodsService.save(dto1); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
record.setSerialNumber(card.getSerialNumber()); |
|
|
record.setSerialNumber(card.getSerialNumber()); |
|
|
record.setEmpCardSid(dto.getEmpCardSid()); |
|
|
record.setEmpCardSid(dto.getEmpCardSid()); |
|
@ -401,6 +416,132 @@ public class EmpCardGiftService extends MybatisBaseService<EmpCardGiftMapper, Em |
|
|
} |
|
|
} |
|
|
return rb.success(); |
|
|
return rb.success(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
|
public ResultBean generateEmpCard(EmpCardGiftDto dto) { |
|
|
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
|
|
if (StringUtils.isBlank(dto.getEmpCardSid())) { |
|
|
|
|
|
return rb.setMsg("请选择提货卡"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
LpkGiftCard empCard = lpkGiftCardService.fetchBySid(dto.getEmpCardSid()); |
|
|
|
|
|
if (null == empCard) { |
|
|
|
|
|
return rb.setMsg("请选择正确的提货卡"); |
|
|
|
|
|
} |
|
|
|
|
|
LpkGiftBag bag=lpkGiftBagService.getOne(new QueryWrapper<LpkGiftBag>().eq("sid",empCard.getGiftbagSid())); |
|
|
|
|
|
EmpCardGift card = new EmpCardGift(); |
|
|
|
|
|
card.setCardType("3"); |
|
|
|
|
|
card.setRemarks(dto.getRemarks()); |
|
|
|
|
|
card.setEmpCardSid(dto.getEmpCardSid()); |
|
|
|
|
|
card.setEmpCardSerialNumber(empCard.getSerialNumber()); |
|
|
|
|
|
card.setEmpCardCode(empCard.getCode()); |
|
|
|
|
|
card.setEmpCardCustomerSid(empCard.getCustomerSid()); |
|
|
|
|
|
card.setState("1"); |
|
|
|
|
|
card.setCreateTime(new DateTime()); |
|
|
|
|
|
card.setGrantDate(new Date()); |
|
|
|
|
|
card.setEndDate(bag.getDateEnd()); |
|
|
|
|
|
card.setStartDate(bag.getDateStart()); |
|
|
|
|
|
String cardArea = "9"; |
|
|
|
|
|
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)) { |
|
|
|
|
|
card.setSerialNumber(cardArea + "0000001"); |
|
|
|
|
|
} else { |
|
|
|
|
|
String substringSer = maxSerNum.substring(cardArea.length()); |
|
|
|
|
|
int i1 = Integer.parseInt(substringSer); |
|
|
|
|
|
int finNum = i1 + 1; |
|
|
|
|
|
int length = String.valueOf(finNum).length(); |
|
|
|
|
|
int len = 7 - length; |
|
|
|
|
|
String num = String.valueOf(finNum); |
|
|
|
|
|
for (int a = 0; a < len; a++) { |
|
|
|
|
|
num = "0" + num; |
|
|
|
|
|
} |
|
|
|
|
|
card.setSerialNumber(cardArea + num); |
|
|
|
|
|
} |
|
|
|
|
|
baseMapper.insert(card); |
|
|
|
|
|
for (GoodsVo vo : dto.getGoodsVoList()) { |
|
|
|
|
|
if(vo.getLNum()!=0){ |
|
|
|
|
|
EmpCardGiftGoodsDto dto1 = new EmpCardGiftGoodsDto(); |
|
|
|
|
|
dto1.setEmpCardGiftSid(card.getSid()); |
|
|
|
|
|
dto1.setGoodsSid(vo.getGoodsSid()); |
|
|
|
|
|
dto1.setGoodsNumber(vo.getLNum()); |
|
|
|
|
|
empCardGiftGoodsService.save(dto1); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
lpkGiftCardService.cardTransfer(dto.getEmpCardSid()); |
|
|
|
|
|
return rb.success(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
|
public ResultBean generateEmpCardGift(EmpCardGiftDto dto) { |
|
|
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
|
|
if (StringUtils.isBlank(dto.getEmpCardSid())) { |
|
|
|
|
|
return rb.setMsg("请选择福礼卡"); |
|
|
|
|
|
} |
|
|
|
|
|
EmpCardGift empCard=baseMapper.selectOne(new QueryWrapper<EmpCardGift>().eq("sid",dto.getEmpCardSid())); |
|
|
|
|
|
if (null == empCard) { |
|
|
|
|
|
return rb.setMsg("请选择正确的福礼卡"); |
|
|
|
|
|
} |
|
|
|
|
|
EmpCardGift card = new EmpCardGift(); |
|
|
|
|
|
card.setCardType("2"); |
|
|
|
|
|
card.setRemarks(dto.getRemarks()); |
|
|
|
|
|
card.setEmpCardSid(dto.getEmpCardSid()); |
|
|
|
|
|
card.setEmpCardSerialNumber(empCard.getSerialNumber()); |
|
|
|
|
|
card.setEmpCardCode(empCard.getCode()); |
|
|
|
|
|
card.setEmpCardCustomerSid(empCard.getCustomerSid()); |
|
|
|
|
|
card.setState("1"); |
|
|
|
|
|
card.setCreateTime(new DateTime()); |
|
|
|
|
|
card.setGrantDate(new Date()); |
|
|
|
|
|
card.setEndDate(empCard.getEndDate()); |
|
|
|
|
|
card.setStartDate(empCard.getStartDate()); |
|
|
|
|
|
String cardArea = "9"; |
|
|
|
|
|
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)) { |
|
|
|
|
|
card.setSerialNumber(cardArea + "0000001"); |
|
|
|
|
|
} else { |
|
|
|
|
|
String substringSer = maxSerNum.substring(cardArea.length()); |
|
|
|
|
|
int i1 = Integer.parseInt(substringSer); |
|
|
|
|
|
int finNum = i1 + 1; |
|
|
|
|
|
int length = String.valueOf(finNum).length(); |
|
|
|
|
|
int len = 7 - length; |
|
|
|
|
|
String num = String.valueOf(finNum); |
|
|
|
|
|
for (int a = 0; a < len; a++) { |
|
|
|
|
|
num = "0" + num; |
|
|
|
|
|
} |
|
|
|
|
|
card.setSerialNumber(cardArea + num); |
|
|
|
|
|
} |
|
|
|
|
|
baseMapper.insert(card); |
|
|
|
|
|
for (GoodsVo vo : dto.getGoodsVoList()) { |
|
|
|
|
|
if(vo.getLNum()!=0){ |
|
|
|
|
|
EmpCardGiftGoodsDto dto1 = new EmpCardGiftGoodsDto(); |
|
|
|
|
|
dto1.setEmpCardGiftSid(card.getSid()); |
|
|
|
|
|
dto1.setGoodsSid(vo.getGoodsSid()); |
|
|
|
|
|
dto1.setGoodsNumber(vo.getLNum()); |
|
|
|
|
|
empCardGiftGoodsService.save(dto1); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
cardTransfer(dto.getEmpCardSid()); |
|
|
|
|
|
return rb.success(); |
|
|
|
|
|
} |
|
|
|
|
|
/** |
|
|
|
|
|
*是否转赠 |
|
|
|
|
|
* @param sid |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
|
|
|
public ResultBean cardTransfer(String sid ) { |
|
|
|
|
|
ResultBean rb=new ResultBean(); |
|
|
|
|
|
EmpCardGift card=baseMapper.selectOne(new QueryWrapper<EmpCardGift>().eq("sid",sid)); |
|
|
|
|
|
card.setIsTransfer("1"); |
|
|
|
|
|
baseMapper.updateById(card); |
|
|
|
|
|
return rb.success().setData("成功"); |
|
|
|
|
|
} |
|
|
public ResultBean<EmpCardGiftVo> getEmpCardGoods(String empCardSid, String goodsSid) { |
|
|
public ResultBean<EmpCardGiftVo> getEmpCardGoods(String empCardSid, String goodsSid) { |
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
return rb.success().setData(baseMapper.getEmpCardGoods(empCardSid,goodsSid)); |
|
|
return rb.success().setData(baseMapper.getEmpCardGoods(empCardSid,goodsSid)); |
|
@ -630,9 +771,9 @@ public class EmpCardGiftService extends MybatisBaseService<EmpCardGiftMapper, Em |
|
|
//
|
|
|
//
|
|
|
public ResultBean<Object> isSaturAndSun(String cardSid) { |
|
|
public ResultBean<Object> isSaturAndSun(String cardSid) { |
|
|
ResultBean rb = new ResultBean().fail(); |
|
|
ResultBean rb = new ResultBean().fail(); |
|
|
EmpGiftAppletVo vo = getGifCardBySid(cardSid).getData(); |
|
|
EmpCardGift empCardGift=baseMapper.selectOne(new QueryWrapper<EmpCardGift>().eq("sid",cardSid)); |
|
|
LocalDate now = DateUtil.parse(vo.getStart()).toSqlDate().toLocalDate(); |
|
|
LocalDate now = DateUtil.parse(empCardGift.getStartDate().toString()).toSqlDate().toLocalDate(); |
|
|
LocalDate endD = DateUtil.parse(vo.getEnd()).toSqlDate().toLocalDate(); |
|
|
LocalDate endD = DateUtil.parse(empCardGift.getEndDate().toString()).toSqlDate().toLocalDate(); |
|
|
List<String> weekMap = new ArrayList<>(); |
|
|
List<String> weekMap = new ArrayList<>(); |
|
|
// 第一个星期六
|
|
|
// 第一个星期六
|
|
|
// LocalDate saturday = now.with(firstInMonth(DayOfWeek.SATURDAY));
|
|
|
// LocalDate saturday = now.with(firstInMonth(DayOfWeek.SATURDAY));
|
|
|