预约提货系统详情
This commit is contained in:
@@ -30,6 +30,8 @@ public class AppletVo {
|
|||||||
private String pName;
|
private String pName;
|
||||||
private String start;
|
private String start;
|
||||||
private String end;
|
private String end;
|
||||||
|
private String store; //门店
|
||||||
|
private String reserveDate; //预约时间
|
||||||
private List<GoodsVo> goodsVos;
|
private List<GoodsVo> goodsVos;
|
||||||
private List<StoreSelect> select;
|
private List<StoreSelect> select;
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ public class GoodsVo {
|
|||||||
private String pic;
|
private String pic;
|
||||||
private double num;
|
private double num;
|
||||||
private double lNum;
|
private double lNum;
|
||||||
private double select=0;
|
private double select = 0;
|
||||||
private String goodsSid;
|
private String goodsSid;
|
||||||
|
private double orderNum; //预约数量
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.yxt.yyth.api.lpkreserveorder;
|
|||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -14,7 +15,7 @@ public class LpkReserveOrder{
|
|||||||
private String id;
|
private String id;
|
||||||
private String sid= UUID.randomUUID().toString();
|
private String sid= UUID.randomUUID().toString();
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
|
||||||
private String createTime;
|
private Date createTime;
|
||||||
private String remarks;
|
private String remarks;
|
||||||
private String reserveType;
|
private String reserveType;
|
||||||
private String cardSid;
|
private String cardSid;
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.yxt.yyth.api.lpkreserveorder;
|
||||||
|
|
||||||
|
import com.yxt.common.core.vo.Vo;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Fan
|
||||||
|
* @description
|
||||||
|
* @date 2023/11/27 16:53
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class LpkReserveOrderCardVo implements Vo {
|
||||||
|
private String code; //卡号
|
||||||
|
private String reserveDate; //预约时间
|
||||||
|
private String store; //提货门店
|
||||||
|
private String bagName; //礼包
|
||||||
|
private String cardSid; // 提货卡sid
|
||||||
|
private String orderSid; //预约订单sid
|
||||||
|
}
|
||||||
@@ -18,5 +18,8 @@ public class LpkReserveOrderDto implements Dto {
|
|||||||
private String storeSid;//发放点
|
private String storeSid;//发放点
|
||||||
private String customerSid;//客户sid
|
private String customerSid;//客户sid
|
||||||
private String reserveDate;//发放时间
|
private String reserveDate;//发放时间
|
||||||
|
private String userName;//用户名
|
||||||
|
private String userPhone;//用户联系方式
|
||||||
private List<GoodsVo> goodsVos;
|
private List<GoodsVo> goodsVos;
|
||||||
|
private String orderSid;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,17 @@
|
|||||||
package com.yxt.yyth.api.lpkreserveorder;
|
package com.yxt.yyth.api.lpkreserveorder;
|
||||||
|
|
||||||
|
import com.yxt.common.core.query.Query;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author wangpengfei
|
* @author wangpengfei
|
||||||
* @date 2023/11/23 10:30
|
* @date 2023/11/23 10:30
|
||||||
*/
|
*/
|
||||||
public class LpkReserveOrderQuery {
|
@Data
|
||||||
|
public class LpkReserveOrderQuery implements Query {
|
||||||
|
private String userName;
|
||||||
|
private String store;
|
||||||
|
private String startDate;
|
||||||
|
private String endDate;
|
||||||
|
private String userSid;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.yxt.yyth.api.lpkreserveorder;
|
||||||
|
|
||||||
|
import com.yxt.common.core.vo.Vo;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Fan
|
||||||
|
* @description
|
||||||
|
* @date 2023/11/27 15:11
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class LpkReserveOrderVo implements Vo {
|
||||||
|
private String sid;
|
||||||
|
private String userName;
|
||||||
|
private String userPhone;
|
||||||
|
private String store;
|
||||||
|
private String reserveDate;
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ package com.yxt.yyth.api.lpkreserveordergoods;
|
|||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -14,10 +15,10 @@ public class LpkReserveOrderGoods {
|
|||||||
private String id;
|
private String id;
|
||||||
private String sid= UUID.randomUUID().toString();
|
private String sid= UUID.randomUUID().toString();
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
|
||||||
private String createTime;
|
private Date createTime;
|
||||||
private String remarks;
|
private String remarks;
|
||||||
private String cardSid;
|
private String cardSid;
|
||||||
private String goodsSid;
|
private String goodsSid;
|
||||||
private double goodsNumber;
|
private double goodsNumber;
|
||||||
|
private String orderSid;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,6 +98,7 @@ public class LpkGiftCardService extends MybatisBaseService<LpkGiftCardMapper, Lp
|
|||||||
List<LpkGiftBagGoodsVo> list = LpkGiftBagGoodsService.getGoodsByBagSid(vo.getGiftbagSid());
|
List<LpkGiftBagGoodsVo> list = LpkGiftBagGoodsService.getGoodsByBagSid(vo.getGiftbagSid());
|
||||||
List<GoodsVo> goodsVos = new ArrayList<>();
|
List<GoodsVo> goodsVos = new ArrayList<>();
|
||||||
list.forEach(s -> {
|
list.forEach(s -> {
|
||||||
|
LpkReserveOrderGoods goods = lpkReserveOrderGoodsService.getReserveByCardSid(vo.getSid(), s.getGoodsSid()).getData();
|
||||||
if (vo.getState().equals("失效")) {
|
if (vo.getState().equals("失效")) {
|
||||||
GoodsVo goodsVo = new GoodsVo();
|
GoodsVo goodsVo = new GoodsVo();
|
||||||
goodsVo.setGoods(s.getGoodsName());
|
goodsVo.setGoods(s.getGoodsName());
|
||||||
@@ -117,7 +118,15 @@ public class LpkGiftCardService extends MybatisBaseService<LpkGiftCardMapper, Lp
|
|||||||
goodsVo.setGoods(s.getGoodsName());
|
goodsVo.setGoods(s.getGoodsName());
|
||||||
goodsVo.setNum(s.getGoodsNumber());
|
goodsVo.setNum(s.getGoodsNumber());
|
||||||
goodsVo.setPic(urlPrefix + s.getPicUrl());
|
goodsVo.setPic(urlPrefix + s.getPicUrl());
|
||||||
goodsVo.setLNum(s.getGoodsNumber());
|
if (null != goods) {
|
||||||
|
if (goods.getGoodsNumber() != s.getGoodsNumber()) {
|
||||||
|
goodsVo.setLNum(s.getGoodsNumber() - goods.getGoodsNumber());
|
||||||
|
goodsVo.setSelect(s.getGoodsNumber() - goods.getGoodsNumber());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
goodsVo.setLNum(s.getGoodsNumber());
|
||||||
|
goodsVo.setSelect(s.getGoodsNumber());
|
||||||
|
}
|
||||||
goodsVos.add(goodsVo);
|
goodsVos.add(goodsVo);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,8 +1,16 @@
|
|||||||
package com.yxt.yyth.biz.lpkreserveorder;
|
package com.yxt.yyth.biz.lpkreserveorder;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||||
import com.yxt.yyth.api.lpkreserveorder.LpkReserveOrder;
|
import com.yxt.yyth.api.lpkreserveorder.LpkReserveOrder;
|
||||||
|
import com.yxt.yyth.api.lpkreserveorder.LpkReserveOrderCardVo;
|
||||||
|
import com.yxt.yyth.api.lpkreserveorder.LpkReserveOrderVo;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author wangpengfei
|
* @author wangpengfei
|
||||||
@@ -10,4 +18,9 @@ import org.apache.ibatis.annotations.Mapper;
|
|||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface LpkReserveOrderMapper extends BaseMapper<LpkReserveOrder> {
|
public interface LpkReserveOrderMapper extends BaseMapper<LpkReserveOrder> {
|
||||||
|
IPage<LpkReserveOrderVo> orderList(IPage<LpkReserveOrder> page, @Param(Constants.WRAPPER) QueryWrapper<LpkReserveOrder> qw);
|
||||||
|
|
||||||
|
List<LpkReserveOrderCardVo> orderByCardSid(String sid);
|
||||||
|
|
||||||
|
IPage<LpkReserveOrderCardVo> orderListByUserSid(IPage<LpkReserveOrder> page, @Param(Constants.WRAPPER) QueryWrapper<LpkReserveOrder> qw);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,4 +18,44 @@
|
|||||||
${ew.sqlSegment}
|
${ew.sqlSegment}
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
<select id="orderList" resultType="com.yxt.yyth.api.lpkreserveorder.LpkReserveOrderVo">
|
||||||
|
select
|
||||||
|
o.sid,
|
||||||
|
date_format(o.reserveDate, '%Y-%m-%d') as reserveDate,
|
||||||
|
o.userName,
|
||||||
|
o.userPhone,
|
||||||
|
s.name as store
|
||||||
|
from lpk_reserve_order as o
|
||||||
|
left join lpk_store as s on o.storeSid = s.sid
|
||||||
|
<where>
|
||||||
|
${ew.sqlSegment}
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
<select id="orderByCardSid" resultType="com.yxt.yyth.api.lpkreserveorder.LpkReserveOrderCardVo">
|
||||||
|
SELECT date_format(o.reserveDate, '%Y-%m-%d') as reserveDate,
|
||||||
|
c.`code`,
|
||||||
|
s.`name` as store,
|
||||||
|
b.`name` as bagName,
|
||||||
|
o.sid as orderSid
|
||||||
|
FROM lpk_reserve_order AS o
|
||||||
|
LEFT JOIN lpk_store AS s ON o.storeSid = s.sid
|
||||||
|
LEFT JOIN lpk_giftcard AS c ON o.cardSid = c.sid
|
||||||
|
LEFT JOIN lpk_giftbag AS b ON c.giftbagSid = b.sid
|
||||||
|
WHERE o.cardSid = #{sid}
|
||||||
|
</select>
|
||||||
|
<select id="orderListByUserSid" resultType="com.yxt.yyth.api.lpkreserveorder.LpkReserveOrderCardVo">
|
||||||
|
SELECT date_format(o.reserveDate, '%Y-%m-%d') as reserveDate,
|
||||||
|
c.`code`,
|
||||||
|
s.`name` as store,
|
||||||
|
b.`name` as bagName,
|
||||||
|
o.cardSid as cardSid,
|
||||||
|
o.sid as orderSid
|
||||||
|
FROM lpk_reserve_order AS o
|
||||||
|
LEFT JOIN lpk_store AS s ON o.storeSid = s.sid
|
||||||
|
LEFT JOIN lpk_giftcard AS c ON o.cardSid = c.sid
|
||||||
|
LEFT JOIN lpk_giftbag AS b ON c.giftbagSid = b.sid
|
||||||
|
<where>
|
||||||
|
${ew.sqlSegment}
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -1,15 +1,20 @@
|
|||||||
package com.yxt.yyth.biz.lpkreserveorder;
|
package com.yxt.yyth.biz.lpkreserveorder;
|
||||||
|
|
||||||
|
import com.yxt.common.core.query.PagerQuery;
|
||||||
import com.yxt.common.core.result.ResultBean;
|
import com.yxt.common.core.result.ResultBean;
|
||||||
|
import com.yxt.common.core.vo.PagerVo;
|
||||||
|
import com.yxt.yyth.api.lpkcustomer.LpkCustomerQuery;
|
||||||
|
import com.yxt.yyth.api.lpkcustomer.LpkCustomerVo;
|
||||||
|
import com.yxt.yyth.api.lpkreserveorder.LpkReserveOrderCardVo;
|
||||||
import com.yxt.yyth.api.lpkreserveorder.LpkReserveOrderDto;
|
import com.yxt.yyth.api.lpkreserveorder.LpkReserveOrderDto;
|
||||||
|
import com.yxt.yyth.api.lpkreserveorder.LpkReserveOrderQuery;
|
||||||
|
import com.yxt.yyth.api.lpkreserveorder.LpkReserveOrderVo;
|
||||||
|
import com.yxt.yyth.api.lpkstore.LpkStoreDetailsVo;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author wangpengfei
|
* @author wangpengfei
|
||||||
@@ -25,7 +30,31 @@ public class LpkReserveOrderRest {
|
|||||||
|
|
||||||
@ApiOperation("预约提交")
|
@ApiOperation("预约提交")
|
||||||
@PostMapping("/submission")
|
@PostMapping("/submission")
|
||||||
public ResultBean submission(@RequestBody LpkReserveOrderDto dto){
|
public ResultBean submission(@RequestBody LpkReserveOrderDto dto) {
|
||||||
return lpkReserveOrderService.submission(dto);
|
return lpkReserveOrderService.submission(dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("订单列表")
|
||||||
|
@PostMapping("/orderList")
|
||||||
|
public ResultBean<PagerVo<LpkReserveOrderVo>> orderList(@RequestBody PagerQuery<LpkReserveOrderQuery> pq) {
|
||||||
|
return lpkReserveOrderService.orderList(pq);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("根据提货卡查询预约记录")
|
||||||
|
@GetMapping("/orderByCardSid/{sid}")
|
||||||
|
public ResultBean orderByCardSid(@PathVariable("sid") String sid) {
|
||||||
|
return lpkReserveOrderService.orderByCardSid(sid);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("移动端预约订单列表")
|
||||||
|
@PostMapping("/orderListByUserSid")
|
||||||
|
public ResultBean<PagerVo<LpkReserveOrderCardVo>> orderListByUserSid(@RequestBody PagerQuery<LpkReserveOrderQuery> pq) {
|
||||||
|
return lpkReserveOrderService.orderListByUserSid(pq);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("预约记录详情")
|
||||||
|
@GetMapping("/orderDetails/{orderSid}")
|
||||||
|
public ResultBean orderDetails(@PathVariable("orderSid") String orderSid) {
|
||||||
|
return lpkReserveOrderService.orderDetails(orderSid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,44 @@
|
|||||||
package com.yxt.yyth.biz.lpkreserveorder;
|
package com.yxt.yyth.biz.lpkreserveorder;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.date.DateTime;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.yxt.common.base.service.MybatisBaseService;
|
import com.yxt.common.base.service.MybatisBaseService;
|
||||||
|
import com.yxt.common.base.utils.PagerUtil;
|
||||||
|
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.result.ResultBean;
|
||||||
import com.yxt.yyth.api.lpkreserveorder.Goods;
|
import com.yxt.common.core.vo.PagerVo;
|
||||||
import com.yxt.yyth.api.lpkreserveorder.LpkReserveOrder;
|
import com.yxt.yyth.api.lpkcustomer.LpkCustomer;
|
||||||
import com.yxt.yyth.api.lpkreserveorder.LpkReserveOrderDto;
|
import com.yxt.yyth.api.lpkcustomer.LpkCustomerQuery;
|
||||||
|
import com.yxt.yyth.api.lpkcustomer.LpkCustomerVo;
|
||||||
|
import com.yxt.yyth.api.lpkgiftbaggoods.LpkGiftBagGoodsVo;
|
||||||
|
import com.yxt.yyth.api.lpkgiftcard.AppletVo;
|
||||||
|
import com.yxt.yyth.api.lpkgiftcard.GoodsVo;
|
||||||
|
import com.yxt.yyth.api.lpkgiftcard.LpkGiftCard;
|
||||||
|
import com.yxt.yyth.api.lpkreserveorder.*;
|
||||||
|
import com.yxt.yyth.api.lpkreserveordergoods.LpkReserveOrderGoods;
|
||||||
import com.yxt.yyth.api.lpkreserveordergoods.LpkReserveOrderGoodsDto;
|
import com.yxt.yyth.api.lpkreserveordergoods.LpkReserveOrderGoodsDto;
|
||||||
|
import com.yxt.yyth.api.lpkstore.LpkStore;
|
||||||
|
import com.yxt.yyth.api.lpkstore.StoreSelect;
|
||||||
|
import com.yxt.yyth.biz.lpkgiftbaggoods.LpkGiftBagGoodsService;
|
||||||
|
import com.yxt.yyth.biz.lpkgiftcard.LpkGiftCardMapper;
|
||||||
|
import com.yxt.yyth.biz.lpkgiftcard.LpkGiftCardService;
|
||||||
import com.yxt.yyth.biz.lpkreserveordergoods.LpkReserveOrderGoodsService;
|
import com.yxt.yyth.biz.lpkreserveordergoods.LpkReserveOrderGoodsService;
|
||||||
|
import com.yxt.yyth.biz.lpkstore.LpkStoreService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author wangpengfei
|
* @author wangpengfei
|
||||||
* @date 2023/11/23 10:36
|
* @date 2023/11/23 10:36
|
||||||
@@ -20,14 +47,121 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|||||||
public class LpkReserveOrderService extends MybatisBaseService<LpkReserveOrderMapper, LpkReserveOrder> {
|
public class LpkReserveOrderService extends MybatisBaseService<LpkReserveOrderMapper, LpkReserveOrder> {
|
||||||
@Autowired
|
@Autowired
|
||||||
LpkReserveOrderGoodsService lpkReserveOrderGoodsService;
|
LpkReserveOrderGoodsService lpkReserveOrderGoodsService;
|
||||||
public ResultBean submission( LpkReserveOrderDto dto){
|
@Autowired
|
||||||
ResultBean rb=new ResultBean();
|
LpkGiftCardMapper lpkGiftCardMapper;
|
||||||
LpkReserveOrder order=new LpkReserveOrder();
|
@Autowired
|
||||||
|
LpkGiftBagGoodsService lpkGiftBagGoodsService;
|
||||||
|
@Autowired
|
||||||
|
LpkStoreService lpkStoreService;
|
||||||
|
@Value("${image.url.prefix:http://127.0.0.1:8080/upload/}")
|
||||||
|
private String urlPrefix;
|
||||||
|
|
||||||
|
public ResultBean submission(LpkReserveOrderDto dto) {
|
||||||
|
ResultBean rb = new ResultBean();
|
||||||
|
LpkReserveOrder order = new LpkReserveOrder();
|
||||||
BeanUtil.copyProperties(dto, order, "id", "sid");
|
BeanUtil.copyProperties(dto, order, "id", "sid");
|
||||||
order.setStoreSid(dto.getValue());
|
order.setStoreSid(dto.getValue());
|
||||||
|
order.setCardSid(dto.getSid());
|
||||||
|
order.setCreateTime(new DateTime());
|
||||||
baseMapper.insert(order);
|
baseMapper.insert(order);
|
||||||
|
dto.setOrderSid(order.getSid());
|
||||||
lpkReserveOrderGoodsService.submissionDetail(dto);
|
lpkReserveOrderGoodsService.submissionDetail(dto);
|
||||||
return rb.success().setData("预约成功");
|
return rb.success().setData("预约成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ResultBean<PagerVo<LpkReserveOrderVo>> orderList(PagerQuery<LpkReserveOrderQuery> pq) {
|
||||||
|
ResultBean rb = ResultBean.fireFail();
|
||||||
|
LpkReserveOrderQuery query = pq.getParams();
|
||||||
|
QueryWrapper<LpkReserveOrder> qw = new QueryWrapper<>();
|
||||||
|
qw.eq("1", "1");
|
||||||
|
if (StringUtils.isNotBlank(query.getStore())) {
|
||||||
|
qw.like("s.name", query.getStore());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(query.getUserName())) {
|
||||||
|
qw.like("o.userName", query.getUserName());
|
||||||
|
}
|
||||||
|
String startDate = query.getStartDate();
|
||||||
|
String endDate = query.getEndDate();
|
||||||
|
qw.apply(org.apache.commons.lang3.StringUtils.isNotEmpty(startDate), "date_format (o.reserveDate,'%Y-%m-%d') >= date_format('" + startDate + "','%Y-%m-%d')").
|
||||||
|
apply(org.apache.commons.lang3.StringUtils.isNotEmpty(endDate), "date_format (o.reserveDate,'%Y-%m-%d') <= date_format('" + endDate + "','%Y-%m-%d')"
|
||||||
|
);
|
||||||
|
qw.orderByDesc("o.createTime");
|
||||||
|
IPage<LpkReserveOrder> page = PagerUtil.queryToPage(pq);
|
||||||
|
IPage<LpkReserveOrderVo> pagging = baseMapper.orderList(page, qw);
|
||||||
|
PagerVo<LpkReserveOrderVo> p = PagerUtil.pageToVo(pagging, null);
|
||||||
|
return rb.success().setData(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResultBean orderByCardSid(String sid) {
|
||||||
|
ResultBean rb = ResultBean.fireFail();
|
||||||
|
List<LpkReserveOrderCardVo> list = baseMapper.orderByCardSid(sid);
|
||||||
|
return rb.success().setData(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResultBean<PagerVo<LpkReserveOrderCardVo>> orderListByUserSid(PagerQuery<LpkReserveOrderQuery> pq) {
|
||||||
|
ResultBean rb = ResultBean.fireFail();
|
||||||
|
LpkReserveOrderQuery query = pq.getParams();
|
||||||
|
QueryWrapper<LpkReserveOrder> qw = new QueryWrapper<>();
|
||||||
|
qw.eq("o.customerSid", query.getUserSid());
|
||||||
|
qw.orderByDesc("o.createTime");
|
||||||
|
IPage<LpkReserveOrder> page = PagerUtil.queryToPage(pq);
|
||||||
|
IPage<LpkReserveOrderCardVo> pagging = baseMapper.orderListByUserSid(page, qw);
|
||||||
|
PagerVo<LpkReserveOrderCardVo> p = PagerUtil.pageToVo(pagging, null);
|
||||||
|
return rb.success().setData(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResultBean orderDetails(String orderSid) {
|
||||||
|
ResultBean rb = new ResultBean().fail();
|
||||||
|
LpkReserveOrder lpkReserveOrder = fetchBySid(orderSid);
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
if (null != lpkReserveOrder) {
|
||||||
|
AppletVo vo = lpkGiftCardMapper.getGifCardBySid(lpkReserveOrder.getCardSid());
|
||||||
|
if (StringUtils.isNotBlank(lpkReserveOrder.getStoreSid())) {
|
||||||
|
LpkStore lpkStore = lpkStoreService.fetchBySid(lpkReserveOrder.getStoreSid());
|
||||||
|
if (null != lpkStore) {
|
||||||
|
if (StringUtils.isNotBlank(lpkStore.getName())) {
|
||||||
|
vo.setStore(lpkStore.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(lpkReserveOrder.getReserveDate())) {
|
||||||
|
try {
|
||||||
|
Date parse = sdf.parse(lpkReserveOrder.getReserveDate());
|
||||||
|
vo.setReserveDate(sdf.format(parse));
|
||||||
|
} catch (ParseException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<LpkGiftBagGoodsVo> list = lpkGiftBagGoodsService.getGoodsByBagSid(vo.getGiftbagSid());
|
||||||
|
List<StoreSelect> l = lpkStoreService.getAllStore().getData();
|
||||||
|
List<GoodsVo> goodsVos = new ArrayList<>();
|
||||||
|
list.forEach(s -> {
|
||||||
|
LpkReserveOrderGoods goods = lpkReserveOrderGoodsService.getReserveByCardSid(vo.getSid(), s.getGoodsSid()).getData();
|
||||||
|
LpkReserveOrderGoods orderGoods = lpkReserveOrderGoodsService.selByOrderSidAndGoodSid(orderSid, s.getGoodsSid());
|
||||||
|
GoodsVo goodsVo = new GoodsVo();
|
||||||
|
goodsVo.setGoods(s.getGoodsName());
|
||||||
|
goodsVo.setNum(s.getGoodsNumber());
|
||||||
|
goodsVo.setGoodsSid(s.getGoodsSid());
|
||||||
|
goodsVo.setPic(urlPrefix + s.getPicUrl());
|
||||||
|
if (null != goods) {
|
||||||
|
if (goods.getGoodsNumber() != s.getGoodsNumber()) {
|
||||||
|
goodsVo.setLNum(s.getGoodsNumber() - goods.getGoodsNumber());
|
||||||
|
goodsVo.setSelect(s.getGoodsNumber() - goods.getGoodsNumber());
|
||||||
|
if (null != orderGoods) {
|
||||||
|
goodsVo.setOrderNum(orderGoods.getGoodsNumber());
|
||||||
|
}
|
||||||
|
goodsVos.add(goodsVo);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
goodsVo.setLNum(s.getGoodsNumber());
|
||||||
|
goodsVo.setSelect(s.getGoodsNumber());
|
||||||
|
goodsVos.add(goodsVo);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
vo.setGoodsVos(goodsVos);
|
||||||
|
vo.setSelect(l);
|
||||||
|
return rb.success().setData(vo);
|
||||||
|
}
|
||||||
|
return rb.success();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,4 +15,5 @@ public interface LpkReserveOrderGoodsMapper extends BaseMapper<LpkReserveOrderGo
|
|||||||
@Select("select sum(goodsNumber) as goodsNumber , goodsSid as goodsSid from lpk_reserve_order_goods where cardSid=#{cardSid} and goodsSid=#{goodsSid}")
|
@Select("select sum(goodsNumber) as goodsNumber , goodsSid as goodsSid from lpk_reserve_order_goods where cardSid=#{cardSid} and goodsSid=#{goodsSid}")
|
||||||
LpkReserveOrderGoods getReserveByCardSid (@Param("cardSid")String cardSid,@Param("goodsSid") String goodsSid);
|
LpkReserveOrderGoods getReserveByCardSid (@Param("cardSid")String cardSid,@Param("goodsSid") String goodsSid);
|
||||||
|
|
||||||
|
LpkReserveOrderGoods selByOrderSidAndGoodSid(@Param("orderSid")String orderSid,@Param("goodsSid") String goodsSid);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,4 +18,11 @@
|
|||||||
${ew.sqlSegment}
|
${ew.sqlSegment}
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selByOrderSidAndGoodSid"
|
||||||
|
resultType="com.yxt.yyth.api.lpkreserveordergoods.LpkReserveOrderGoods">
|
||||||
|
select *
|
||||||
|
from lpk_reserve_order_goods
|
||||||
|
where orderSid = #{orderSid}
|
||||||
|
and goodsSid = #{goodsSid}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.yxt.yyth.biz.lpkreserveordergoods;
|
package com.yxt.yyth.biz.lpkreserveordergoods;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.date.DateTime;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.yxt.common.base.service.MybatisBaseService;
|
import com.yxt.common.base.service.MybatisBaseService;
|
||||||
import com.yxt.common.core.result.ResultBean;
|
import com.yxt.common.core.result.ResultBean;
|
||||||
@@ -25,39 +26,46 @@ import java.util.List;
|
|||||||
public class LpkReserveOrderGoodsService extends MybatisBaseService<LpkReserveOrderGoodsMapper, LpkReserveOrderGoods> {
|
public class LpkReserveOrderGoodsService extends MybatisBaseService<LpkReserveOrderGoodsMapper, LpkReserveOrderGoods> {
|
||||||
@Autowired
|
@Autowired
|
||||||
LpkGiftCardService lpkGiftCardService;
|
LpkGiftCardService lpkGiftCardService;
|
||||||
public ResultBean<LpkReserveOrderGoods> getReserveByCardSid(String carSid,String goodsSid){
|
|
||||||
ResultBean rb=new ResultBean();
|
public ResultBean<LpkReserveOrderGoods> getReserveByCardSid(String carSid, String goodsSid) {
|
||||||
LpkReserveOrderGoods goods= baseMapper.getReserveByCardSid(carSid,goodsSid);
|
ResultBean rb = new ResultBean();
|
||||||
|
LpkReserveOrderGoods goods = baseMapper.getReserveByCardSid(carSid, goodsSid);
|
||||||
return rb.success().setData(goods);
|
return rb.success().setData(goods);
|
||||||
}
|
}
|
||||||
public ResultBean submissionDetail(LpkReserveOrderDto dto){
|
|
||||||
ResultBean rb=new ResultBean();
|
public ResultBean submissionDetail(LpkReserveOrderDto dto) {
|
||||||
LpkReserveOrderGoods goods=new LpkReserveOrderGoods();
|
ResultBean rb = new ResultBean();
|
||||||
|
LpkReserveOrderGoods goods = new LpkReserveOrderGoods();
|
||||||
BeanUtil.copyProperties(dto, goods, "id", "sid");
|
BeanUtil.copyProperties(dto, goods, "id", "sid");
|
||||||
goods.setCardSid(dto.getSid());
|
goods.setCardSid(dto.getSid());
|
||||||
for (GoodsVo goods1:dto.getGoodsVos()){
|
for (GoodsVo goods1 : dto.getGoodsVos()) {
|
||||||
if(goods1.getSelect()!=0){
|
if (goods1.getSelect() != 0) {
|
||||||
goods.setCardSid(dto.getSid());
|
goods.setCardSid(dto.getSid());
|
||||||
goods.setGoodsSid(goods1.getGoodsSid());
|
goods.setGoodsSid(goods1.getGoodsSid());
|
||||||
goods.setGoodsNumber(goods1.getSelect());
|
goods.setGoodsNumber(goods1.getSelect());
|
||||||
|
goods.setCreateTime(new DateTime());
|
||||||
baseMapper.insert(goods);
|
baseMapper.insert(goods);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AppletVo vo=lpkGiftCardService.getGifCardBySid(dto.getSid()).getData();
|
AppletVo vo = lpkGiftCardService.getGifCardBySid(dto.getSid()).getData();
|
||||||
int i=0;
|
int i = 0;
|
||||||
for (GoodsVo vo1:vo.getGoodsVos()){
|
for (GoodsVo vo1 : vo.getGoodsVos()) {
|
||||||
LpkReserveOrderGoods goods1=baseMapper.getReserveByCardSid(dto.getCardSid(), vo1.getGoodsSid());
|
LpkReserveOrderGoods goods1 = baseMapper.getReserveByCardSid(dto.getCardSid(), vo1.getGoodsSid());
|
||||||
if(null!=goods1){
|
if (null != goods1) {
|
||||||
if(vo1.getNum()==goods1.getGoodsNumber()){
|
if (vo1.getNum() == goods1.getGoodsNumber()) {
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(vo.getGoodsVos().size()==i){
|
if (vo.getGoodsVos().size() == i) {
|
||||||
lpkGiftCardService.changState(dto.getSid(),"5");
|
lpkGiftCardService.changState(dto.getSid(), "5");
|
||||||
}else{
|
} else {
|
||||||
lpkGiftCardService.changState(dto.getSid(),"4");
|
lpkGiftCardService.changState(dto.getSid(), "4");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return rb.success().setData("预约成功");
|
return rb.success().setData("预约成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LpkReserveOrderGoods selByOrderSidAndGoodSid(String orderSid, String goodsSid) {
|
||||||
|
return baseMapper.selByOrderSidAndGoodSid(orderSid,goodsSid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user