|
|
@ -22,12 +22,14 @@ import com.yxt.ordermall.api.vegecallerreserveorder.*; |
|
|
|
import com.yxt.ordermall.api.vegetablecellar.VegetableCellarDto; |
|
|
|
import com.yxt.ordermall.api.vegetablecellar.vegeVo; |
|
|
|
import com.yxt.ordermall.biz.cannotreservedictionary.CannotReserveDictionaryService; |
|
|
|
import com.yxt.ordermall.biz.func.basebrandinfo.BaseBrandInfoVo; |
|
|
|
import com.yxt.ordermall.biz.func.basegoodssku.GoodsSkuDetailVo; |
|
|
|
import com.yxt.ordermall.biz.lpkgiftcard.generateRule.UniqueIdGenerator; |
|
|
|
import com.yxt.ordermall.biz.lpkgoods.LpkGoodsService; |
|
|
|
import com.yxt.ordermall.biz.lpkstore.LpkStoreService; |
|
|
|
import com.yxt.ordermall.biz.vegecallerreservedetail.VegeCellarReserveDetailsService; |
|
|
|
import com.yxt.ordermall.biz.vegetablecellar.VegetableCellarService; |
|
|
|
import com.yxt.ordermall.feign.base.basebrandinfo.BaseBrandInfoFeign; |
|
|
|
import com.yxt.ordermall.feign.base.basegoodssku.BaseGoodsSkuFeign; |
|
|
|
import com.yxt.ordermall.feign.warehouse.warehouseinfo.WarehouseInfoFeign; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
@ -41,6 +43,7 @@ import java.time.LocalTime; |
|
|
|
import java.time.ZoneId; |
|
|
|
import java.util.*; |
|
|
|
import java.util.regex.Pattern; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
|
* @author wangpengfei |
|
|
@ -63,6 +66,8 @@ public class VegeCellarReserveOrderService extends MybatisBaseService<VegeCellar |
|
|
|
BaseGoodsSkuFeign baseGoodsSkuFeign; |
|
|
|
@Autowired |
|
|
|
WarehouseInfoFeign warehouseInfoFeign; |
|
|
|
@Autowired |
|
|
|
BaseBrandInfoFeign baseBrandInfoFeign; |
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public ResultBean submission(VegeCellarReserveOrderDto dto) { |
|
|
@ -126,7 +131,38 @@ public class VegeCellarReserveOrderService extends MybatisBaseService<VegeCellar |
|
|
|
rb=vegetableCellarService.save1Goods(dto); |
|
|
|
return rb; |
|
|
|
} |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public ResultBean cancelReservation(String [] sids) { |
|
|
|
ResultBean rb = new ResultBean().fail(); |
|
|
|
List<String> collect = Arrays.stream(sids).distinct().collect(Collectors.toList()); |
|
|
|
for (String sid : collect) { |
|
|
|
List<String> state=new ArrayList<>(); |
|
|
|
state.add("0"); |
|
|
|
state.add("1"); |
|
|
|
VegeCellarReserveOrder vegeCellarReserveOrder = baseMapper.selectOne(new QueryWrapper<VegeCellarReserveOrder>().eq("sid", sid).in("state",state)); |
|
|
|
if(vegeCellarReserveOrder==null){ |
|
|
|
return rb.setMsg("预约单不符合取消条件"); |
|
|
|
} |
|
|
|
vegeCellarReserveOrder.setState("2"); |
|
|
|
baseMapper.updateById(vegeCellarReserveOrder); |
|
|
|
List<VegeCellarReserveDetails> list=vegeCellarReserveDetailsService.selByOrderSids(vegeCellarReserveOrder.getSid()); |
|
|
|
VegetableCellarDto dto=new VegetableCellarDto(); |
|
|
|
List<vegeVo> vos=new ArrayList<>(); |
|
|
|
for (VegeCellarReserveDetails details:list){ |
|
|
|
String brandId=lpkGoodsService.getOne(new QueryWrapper<LpkGoods>().eq("skuSid",details.getGoodsSid())).getBrandId().toString(); |
|
|
|
vegeVo vo=new vegeVo(); |
|
|
|
vo.setBrandId(brandId); |
|
|
|
vo.setGoodsSid(details.getGoodsSid()); |
|
|
|
vo.setGoodsNumber(String.valueOf(details.getGoodsNumber())); |
|
|
|
vos.add(vo); |
|
|
|
} |
|
|
|
dto.setVos(vos); |
|
|
|
dto.setCustomerSid(vegeCellarReserveOrder.getCustomerSid()); |
|
|
|
rb=vegetableCellarService.save1Goods(dto); |
|
|
|
} |
|
|
|
|
|
|
|
return rb; |
|
|
|
} |
|
|
|
|
|
|
|
// public boolean isSatAndSun(String date) {
|
|
|
|
// DateTime dateTime = DateUtil.parse(date);
|
|
|
@ -267,33 +303,65 @@ public class VegeCellarReserveOrderService extends MybatisBaseService<VegeCellar |
|
|
|
if (StrUtil.isNotBlank(query.getEndDate())) { |
|
|
|
qw.le("date_format(vo.reserveDate,'%Y-%m-%d')", query.getEndDate()); |
|
|
|
} |
|
|
|
if (StrUtil.isNotBlank(query.getBankSid())) { |
|
|
|
qw.eq("lb.sid", query.getBankSid()); |
|
|
|
if (StrUtil.isNotBlank(query.getAddress())) { |
|
|
|
qw.eq("vo.storeSid", query.getAddress()); |
|
|
|
} |
|
|
|
if (StrUtil.isNotBlank(query.getStore())) { |
|
|
|
qw.eq("vo.storeSid", query.getStore()); |
|
|
|
if (StrUtil.isNotBlank(query.getBrand())) { |
|
|
|
qw.eq("vo.affiliation", query.getBrand()); |
|
|
|
} |
|
|
|
if (StrUtil.isNotBlank(query.getCardType())) { |
|
|
|
qw.eq("vo.affiliation", query.getCardType()); |
|
|
|
if (StrUtil.isNotBlank(query.getUserName())) { |
|
|
|
qw.like("vo.userName", query.getUserName()); |
|
|
|
} |
|
|
|
if (StrUtil.isNotBlank(query.getUserPhone())) { |
|
|
|
qw.like("vo.userPhone", query.getUserPhone()); |
|
|
|
} |
|
|
|
if (StrUtil.isNotBlank(query.getGoodsName())) { |
|
|
|
qw.like("vd.goodsName", query.getGoodsName()); |
|
|
|
} |
|
|
|
if (StrUtil.isNotBlank(query.getStateValue())) { |
|
|
|
qw.eq("vo.state", query.getStateValue()); |
|
|
|
} |
|
|
|
|
|
|
|
// qw.orderByAsc("vo.reserveDate");
|
|
|
|
return qw; |
|
|
|
} |
|
|
|
|
|
|
|
// public ResultBean<IPage<ReserveOrderVo>> pageOfCustomer(PagerQuery<LpkReserveOrderQuery> pq) {
|
|
|
|
// ResultBean rb = ResultBean.fireFail();
|
|
|
|
// LpkReserveOrderQuery query = pq.getParams();
|
|
|
|
// QueryWrapper<VegeCellarReserveOrder> qw = buildQuery(query);
|
|
|
|
//// qw.orderByDesc("vo.reserveDate");
|
|
|
|
// qw.ne("vo.state","2");
|
|
|
|
// IPage<VegeCellarReserveOrder> page = PagerUtil.queryToPage(pq);
|
|
|
|
// IPage<ReserveOrderVo> pagerVo = baseMapper.pageOfCustomer(page, qw);
|
|
|
|
// return rb.success().setData(pagerVo);
|
|
|
|
// }
|
|
|
|
public ResultBean<IPage<ReserveOrderVo>> pageOfCustomer(PagerQuery<LpkReserveOrderQuery> pq) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
LpkReserveOrderQuery query = pq.getParams(); |
|
|
|
QueryWrapper<VegeCellarReserveOrder> qw = buildQuery(query); |
|
|
|
qw.ne("vo.state","2"); |
|
|
|
// qw.orderByDesc("vo.reserveDate");
|
|
|
|
// qw.ne("vo.state","2");
|
|
|
|
IPage<VegeCellarReserveOrder> page = PagerUtil.queryToPage(pq); |
|
|
|
IPage<ReserveOrderVo> pagerVo = baseMapper.pageOfCustomer(page, qw); |
|
|
|
for (ReserveOrderVo record : pagerVo.getRecords()) { |
|
|
|
ResultBean<GoodsSkuDetailVo> goodsBySkuSid = baseGoodsSkuFeign.getGoodsBySkuSid(record.getGoodsSid()); |
|
|
|
if(goodsBySkuSid.getData()!=null){ |
|
|
|
record.setGoodsName(goodsBySkuSid.getData().getGoodsName()); |
|
|
|
} |
|
|
|
|
|
|
|
ResultBean<BaseBrandInfoVo> initialization = baseBrandInfoFeign.initialization(record.getAffiliation()); |
|
|
|
if(initialization.getData()!=null){ |
|
|
|
record.setBrandName(initialization.getData().getBrandName()); |
|
|
|
} |
|
|
|
ResultBean<WarehouseInfoVo> initialization1 = warehouseInfoFeign.initialization(record.getStoreSid()); |
|
|
|
if(initialization1.getData()!=null){ |
|
|
|
record.setStoreName(initialization1.getData().getWarehouseName()); |
|
|
|
} |
|
|
|
} |
|
|
|
return rb.success().setData(pagerVo); |
|
|
|
} |
|
|
|
|
|
|
|
public Map<String, List<ReserveCustomerExcel>> mapForExcelCustomer(LpkReserveOrderQuery query) { |
|
|
|
QueryWrapper<VegeCellarReserveOrder> qw = buildQuery(query); |
|
|
|
qw.ne("vo.state","2"); |
|
|
|
// qw.ne("vo.state","2");
|
|
|
|
List<ReserveOrderVo> list = baseMapper.pageOfCustomer(qw); |
|
|
|
Map<String, List<ReserveCustomerExcel>> map = new HashMap<>(); |
|
|
|
list.forEach(vo -> { |
|
|
@ -311,8 +379,23 @@ public class VegeCellarReserveOrderService extends MybatisBaseService<VegeCellar |
|
|
|
|
|
|
|
public List<ReserveCustomerExcel> listForExcelCustomer(LpkReserveOrderQuery query) { |
|
|
|
QueryWrapper<VegeCellarReserveOrder> qw = buildQuery(query); |
|
|
|
qw.ne("vo.state","2"); |
|
|
|
// qw.ne("vo.state","2");
|
|
|
|
List<ReserveOrderVo> list = baseMapper.pageOfCustomer(qw); |
|
|
|
for (ReserveOrderVo record :list) { |
|
|
|
ResultBean<GoodsSkuDetailVo> goodsBySkuSid = baseGoodsSkuFeign.getGoodsBySkuSid(record.getGoodsSid()); |
|
|
|
if(goodsBySkuSid.getData()!=null){ |
|
|
|
record.setGoodsName(goodsBySkuSid.getData().getGoodsName()); |
|
|
|
} |
|
|
|
|
|
|
|
ResultBean<BaseBrandInfoVo> initialization = baseBrandInfoFeign.initialization(record.getAffiliation()); |
|
|
|
if(initialization.getData()!=null){ |
|
|
|
record.setBrandName(initialization.getData().getBrandName()); |
|
|
|
} |
|
|
|
ResultBean<WarehouseInfoVo> initialization1 = warehouseInfoFeign.initialization(record.getStoreSid()); |
|
|
|
if(initialization1.getData()!=null){ |
|
|
|
record.setStoreName(initialization1.getData().getWarehouseName()); |
|
|
|
} |
|
|
|
} |
|
|
|
List<ReserveCustomerExcel> volist = new ArrayList<>(); |
|
|
|
list.forEach(vo -> { |
|
|
|
ReserveCustomerExcel ex = new ReserveCustomerExcel(); |
|
|
|