|
|
@ -10,8 +10,11 @@ import com.yxt.yyth.api.empreserveordergoods.EmpReserveOrderGoods; |
|
|
|
import com.yxt.yyth.api.lpkgiftcard.AppletVo; |
|
|
|
import com.yxt.yyth.api.empcardgift.GoodsVo; |
|
|
|
import com.yxt.yyth.api.lpkreserveorder.LpkReserveOrderDto; |
|
|
|
import com.yxt.yyth.api.lpkreserveordergoods.LpkReserveOrderGoods; |
|
|
|
import com.yxt.yyth.biz.empcardgift.EmpCardGiftService; |
|
|
|
import com.yxt.yyth.biz.lpkgiftcard.LpkGiftCardService; |
|
|
|
import com.yxt.yyth.biz.lpkreserveordergoods.LpkReserveOrderGoodsMapper; |
|
|
|
import com.yxt.yyth.biz.lpkreserveordergoods.LpkReserveOrderGoodsService; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
@ -25,30 +28,31 @@ import java.util.List; |
|
|
|
public class EmpReserveOrderGoodsService extends MybatisBaseService<EmpReserveOrderGoodsMapper, EmpReserveOrderGoods> { |
|
|
|
@Autowired |
|
|
|
EmpCardGiftService empCardGiftService; |
|
|
|
@Autowired |
|
|
|
LpkReserveOrderGoodsMapper lpkReserveOrderGoodsMapper; |
|
|
|
public ResultBean<EmpReserveOrderGoods> getReserveByCardSid(String carSid, String goodsSid) { |
|
|
|
ResultBean rb = new ResultBean(); |
|
|
|
EmpReserveOrderGoods goods = baseMapper.getReserveByCardSid(carSid, goodsSid); |
|
|
|
return rb.success().setData(goods); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean submissionDetail(EmpReserveOrderDto dto) { |
|
|
|
public ResultBean submissionDetail(LpkReserveOrderDto dto) { |
|
|
|
ResultBean rb = new ResultBean(); |
|
|
|
EmpReserveOrderGoods goods = new EmpReserveOrderGoods(); |
|
|
|
LpkReserveOrderGoods goods = new LpkReserveOrderGoods(); |
|
|
|
BeanUtil.copyProperties(dto, goods, "id", "sid"); |
|
|
|
goods.setCardSid(dto.getSid()); |
|
|
|
for (GoodsVo goods1 : dto.getGoodsVos()) { |
|
|
|
for (com.yxt.yyth.api.lpkgiftcard.GoodsVo goods1 : dto.getGoodsVos()) { |
|
|
|
if (goods1.getSelect() != 0) { |
|
|
|
goods.setCardSid(dto.getSid()); |
|
|
|
goods.setGoodsSid(goods1.getGoodsSid()); |
|
|
|
goods.setGoodsNumber(goods1.getSelect()); |
|
|
|
goods.setCreateTime(new DateTime()); |
|
|
|
baseMapper.insert(goods); |
|
|
|
lpkReserveOrderGoodsMapper.insert(goods); |
|
|
|
} |
|
|
|
} |
|
|
|
EmpGiftAppletVo vo = empCardGiftService.getGifCardBySid(dto.getSid()).getData(); |
|
|
|
int i = 0; |
|
|
|
for (GoodsVo vo1 : vo.getGoodsVos()) { |
|
|
|
EmpReserveOrderGoods goods1 = baseMapper.getReserveByCardSid(dto.getSid(), vo1.getGoodsSid()); |
|
|
|
LpkReserveOrderGoods goods1 = lpkReserveOrderGoodsMapper.getReserveByCardSid(dto.getSid(), vo1.getGoodsSid()); |
|
|
|
if (null != goods1) { |
|
|
|
if (vo1.getNum() <= goods1.getGoodsNumber()) { |
|
|
|
i++; |
|
|
@ -62,6 +66,38 @@ public class EmpReserveOrderGoodsService extends MybatisBaseService<EmpReserveOr |
|
|
|
} |
|
|
|
return rb.success().setData("预约成功"); |
|
|
|
} |
|
|
|
//
|
|
|
|
// public ResultBean submissionDetail(EmpReserveOrderDto dto) {
|
|
|
|
// ResultBean rb = new ResultBean();
|
|
|
|
// EmpReserveOrderGoods goods = new EmpReserveOrderGoods();
|
|
|
|
// BeanUtil.copyProperties(dto, goods, "id", "sid");
|
|
|
|
// goods.setCardSid(dto.getSid());
|
|
|
|
// for (GoodsVo goods1 : dto.getGoodsVos()) {
|
|
|
|
// if (goods1.getSelect() != 0) {
|
|
|
|
// goods.setCardSid(dto.getSid());
|
|
|
|
// goods.setGoodsSid(goods1.getGoodsSid());
|
|
|
|
// goods.setGoodsNumber(goods1.getSelect());
|
|
|
|
// goods.setCreateTime(new DateTime());
|
|
|
|
// baseMapper.insert(goods);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// EmpGiftAppletVo vo = empCardGiftService.getGifCardBySid(dto.getSid()).getData();
|
|
|
|
// int i = 0;
|
|
|
|
// for (GoodsVo vo1 : vo.getGoodsVos()) {
|
|
|
|
// EmpReserveOrderGoods goods1 = baseMapper.getReserveByCardSid(dto.getSid(), vo1.getGoodsSid());
|
|
|
|
// if (null != goods1) {
|
|
|
|
// if (vo1.getNum() <= goods1.getGoodsNumber()) {
|
|
|
|
// i++;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// if (vo.getGoodsVos().size() == i) {
|
|
|
|
// empCardGiftService.changState(dto.getSid(), "5");
|
|
|
|
// } else {
|
|
|
|
// empCardGiftService.changState(dto.getSid(), "4");
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// return rb.success().setData("预约成功");
|
|
|
|
// }
|
|
|
|
|
|
|
|
public EmpReserveOrderGoods selByOrderSidAndGoodSid(String orderSid, String goodsSid) { |
|
|
|
return baseMapper.selByOrderSidAndGoodSid(orderSid,goodsSid); |
|
|
|