|
|
|
|
@@ -12,11 +12,13 @@ import com.yxt.common.base.utils.StringUtils;
|
|
|
|
|
import com.yxt.common.core.query.PagerQuery;
|
|
|
|
|
import com.yxt.common.core.result.ResultBean;
|
|
|
|
|
import com.yxt.common.core.vo.PagerVo;
|
|
|
|
|
import com.yxt.yythmall.api.cannotreservedictionary.CannotReserveDictionary;
|
|
|
|
|
import com.yxt.yythmall.api.lpkgoods.LpkGoods;
|
|
|
|
|
import com.yxt.yythmall.api.lpkreserveorder.LpkReserveOrderQuery;
|
|
|
|
|
import com.yxt.yythmall.api.lpkstore.LpkStore;
|
|
|
|
|
import com.yxt.yythmall.api.vegecallerreservedetails.VegeCellarReserveDetails;
|
|
|
|
|
import com.yxt.yythmall.api.vegecallerreserveorder.*;
|
|
|
|
|
import com.yxt.yythmall.biz.cannotreservedictionary.CannotReserveDictionaryService;
|
|
|
|
|
import com.yxt.yythmall.biz.lpkgiftcard.generateRule.UniqueIdGenerator;
|
|
|
|
|
import com.yxt.yythmall.biz.lpkgoods.LpkGoodsService;
|
|
|
|
|
import com.yxt.yythmall.biz.lpkstore.LpkStoreService;
|
|
|
|
|
@@ -43,6 +45,8 @@ public class VegeCellarReserveOrderService extends MybatisBaseService<VegeCellar
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private LpkGoodsService lpkGoodsService;
|
|
|
|
|
@Autowired
|
|
|
|
|
CannotReserveDictionaryService cannotReserveDictionaryService;
|
|
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public ResultBean submission(VegeCellarReserveOrderDto dto) {
|
|
|
|
|
@@ -69,48 +73,6 @@ public class VegeCellarReserveOrderService extends MybatisBaseService<VegeCellar
|
|
|
|
|
return rb;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ResultBean addGoodsOrder(VegeCellarReserveOrderDto dto) {
|
|
|
|
|
ResultBean rb = new ResultBean().fail();
|
|
|
|
|
boolean b = isSatAndSun(dto.getReserveDate());
|
|
|
|
|
if (!b) {
|
|
|
|
|
return rb.setMsg("周六、周日不能预约提货");
|
|
|
|
|
}
|
|
|
|
|
VegeCellarReserveOrder order = new VegeCellarReserveOrder();
|
|
|
|
|
order = baseMapper.selectList(new QueryWrapper<VegeCellarReserveOrder>().eq("customerSid", dto.getCustomerSid())
|
|
|
|
|
.eq("affiliation", dto.getAffiliation()).eq("state", "0")).get(0);
|
|
|
|
|
if (order == null) {
|
|
|
|
|
BeanUtil.copyProperties(dto, order, "id", "sid");
|
|
|
|
|
order.setStoreSid(dto.getStoreSid());
|
|
|
|
|
// order.setCardSid(dto.getSid());
|
|
|
|
|
order.setCreateTime(new DateTime());
|
|
|
|
|
baseMapper.insert(order);
|
|
|
|
|
}
|
|
|
|
|
dto.setOrderSid(order.getSid());
|
|
|
|
|
vegeCellarReserveDetailsService.addDetail(dto);
|
|
|
|
|
return rb.success().setData("预约成功");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ResultBean minusGoodsOrder(VegeCellarReserveOrderDto dto) {
|
|
|
|
|
ResultBean rb = new ResultBean().fail();
|
|
|
|
|
boolean b = isSatAndSun(dto.getReserveDate());
|
|
|
|
|
if (!b) {
|
|
|
|
|
return rb.setMsg("周六、周日不能预约提货");
|
|
|
|
|
}
|
|
|
|
|
VegeCellarReserveOrder order = new VegeCellarReserveOrder();
|
|
|
|
|
order = baseMapper.selectList(new QueryWrapper<VegeCellarReserveOrder>().eq("customerSid", dto.getCustomerSid())
|
|
|
|
|
.eq("affiliation", dto.getAffiliation()).eq("state", "0")).get(0);
|
|
|
|
|
if (order == null) {
|
|
|
|
|
BeanUtil.copyProperties(dto, order, "id", "sid");
|
|
|
|
|
order.setStoreSid(dto.getStoreSid());
|
|
|
|
|
// order.setCardSid(dto.getSid());
|
|
|
|
|
order.setCreateTime(new DateTime());
|
|
|
|
|
baseMapper.insert(order);
|
|
|
|
|
}
|
|
|
|
|
dto.setOrderSid(order.getSid());
|
|
|
|
|
vegeCellarReserveDetailsService.addDetail(dto);
|
|
|
|
|
return rb.success().setData("预约成功");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean isSatAndSun(String date) {
|
|
|
|
|
DateTime dateTime = DateUtil.parse(date);
|
|
|
|
|
@@ -123,7 +85,13 @@ public class VegeCellarReserveOrderService extends MybatisBaseService<VegeCellar
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean isSatAndSun1(String date) {
|
|
|
|
|
List<CannotReserveDictionary>l =cannotReserveDictionaryService.list(new QueryWrapper<CannotReserveDictionary>().eq("unavailableTime",date));
|
|
|
|
|
if (l.size()>0){
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
// @Test
|
|
|
|
|
// public void isSatAndSun(){
|
|
|
|
|
// String date="2023-12-11";
|
|
|
|
|
|