12/3
This commit is contained in:
@@ -36,6 +36,7 @@ public class AppletVo {
|
||||
private List<StoreSelect> select;
|
||||
private String storeSid;//上次提货地点
|
||||
private String addressName;
|
||||
private String isReservation;//是否超过预约时间 0 否 1是
|
||||
|
||||
|
||||
public String getStart() {
|
||||
@@ -52,8 +53,6 @@ public class AppletVo {
|
||||
return start;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getName() {
|
||||
name=name+code;
|
||||
return name;
|
||||
@@ -66,7 +65,6 @@ public class AppletVo {
|
||||
time=sdf.format(DateUtil.parse(dateStart))+"~"+sdf.format(DateUtil.parse(dateEnd));
|
||||
}
|
||||
}
|
||||
|
||||
return time;
|
||||
}
|
||||
|
||||
@@ -83,24 +81,45 @@ public class AppletVo {
|
||||
if(StringUtils.isNotBlank(dateEnd)){
|
||||
int i=DateUtil.parse(sdf.format(DateUtil.parse(dateEnd))).compareTo(DateUtil.parse(sdf.format(DateUtil.date())));
|
||||
if( String.valueOf(i).equals("-1")){
|
||||
state="失效";
|
||||
state="已过期";
|
||||
showBtn=false;
|
||||
// appletVo.setShowBtn(true);
|
||||
}else{
|
||||
state="正常";
|
||||
state="待提货";
|
||||
if(states.equals("5")){
|
||||
this.state="失效";
|
||||
if(isReservation.equals("0")){
|
||||
this.state="已预约";
|
||||
}else{
|
||||
this.state="已完成";
|
||||
showBtn=false;
|
||||
}
|
||||
}else if(states.equals("4")){
|
||||
if(isReservation.equals("0")){
|
||||
this.state="已预约";
|
||||
}else{
|
||||
this.state="待提货";
|
||||
}
|
||||
}
|
||||
// if(states.equals("5")){
|
||||
// this.state="失效";
|
||||
// showBtn=false;
|
||||
// }
|
||||
}
|
||||
}else{
|
||||
state="待提货";
|
||||
if(states.equals("5")){
|
||||
if(isReservation.equals("0")){
|
||||
this.state="已预约";
|
||||
}else{
|
||||
this.state="已完成";
|
||||
showBtn=false;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
state="正常";
|
||||
if(states.equals("5")){
|
||||
this.state="失效";
|
||||
showBtn=false;
|
||||
}
|
||||
// state="正常";
|
||||
// if(states.equals("5")){
|
||||
// this.state="失效";
|
||||
// showBtn=false;
|
||||
// }
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,4 +36,5 @@ public class LpkGiftCard {
|
||||
private String recordId;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date bindDate;
|
||||
private String isReservation ;//是否超过预约时间 0 否 1是
|
||||
}
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
package com.yxt.yyth.api.lpkreserveorder;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.yxt.common.core.vo.Vo;
|
||||
import lombok.Data;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Fan
|
||||
* @description
|
||||
@@ -11,10 +15,23 @@ import lombok.Data;
|
||||
@Data
|
||||
public class LpkReserveOrderCardVo implements Vo {
|
||||
private String code; //卡号
|
||||
private String reserveDate; //预约时间
|
||||
private Date reserveDate; //预约时间
|
||||
private String store; //提货门店
|
||||
private String bagName; //礼包
|
||||
private String cardSid; // 提货卡sid
|
||||
private String orderSid; //预约订单sid
|
||||
private String userName;
|
||||
private String userPhone;
|
||||
private String state;//提货状态
|
||||
|
||||
public String getState() {
|
||||
SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd");
|
||||
int c= DateUtil.parse(sdf.format(reserveDate)).compareTo(DateUtil.parse(sdf.format(new Date())));
|
||||
if(String.valueOf(c).equals("-1")){
|
||||
this.state="已提货";
|
||||
}else{
|
||||
this.state="未提货";
|
||||
}
|
||||
return state;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.yxt.yyth.api.lpkreserveorder;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.yxt.common.core.vo.Vo;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -18,7 +20,8 @@ public class LpkReserveOrderVo implements Vo {
|
||||
private String userPhone; //用户电话
|
||||
private String store; //门店
|
||||
private String storeSid; //门店
|
||||
private String reserveDate; //预约时间
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
|
||||
private Date reserveDate; //预约时间
|
||||
private String bagName; //礼包
|
||||
private String code; //卡号
|
||||
private List<OrderGoodsVo> goodsVo = new ArrayList<>();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.yxt.yyth.biz.lpkgiftcard;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.img.ImgUtil;
|
||||
import cn.hutool.extra.qrcode.QrCodeUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@@ -18,6 +19,7 @@ import com.yxt.yyth.api.lpkcardgrantrecord.LpkCardGrantRecordDto;
|
||||
import com.yxt.yyth.api.lpkgiftbag.LpkGiftBag;
|
||||
import com.yxt.yyth.api.lpkgiftbaggoods.LpkGiftBagGoodsVo;
|
||||
import com.yxt.yyth.api.lpkgiftcard.*;
|
||||
import com.yxt.yyth.api.lpkreserveorder.LpkReserveOrder;
|
||||
import com.yxt.yyth.api.lpkreserveorder.LpkReserveOrderVo;
|
||||
import com.yxt.yyth.api.lpkreserveordergoods.LpkReserveOrderGoods;
|
||||
import com.yxt.yyth.api.lpkstore.LpkStoreDetailsVo;
|
||||
@@ -73,11 +75,11 @@ public class LpkGiftCardService extends MybatisBaseService<LpkGiftCardMapper, Lp
|
||||
ResultBean rb = new ResultBean().fail();
|
||||
LpkGiftCard lpkGiftCard = baseMapper.selectOne(new QueryWrapper<LpkGiftCard>().eq("code", bindCardDto.getCode())
|
||||
.eq("codeKey", bindCardDto.getCodeKey()));
|
||||
AppletVo vo = baseMapper.getGifCardBySid(lpkGiftCard.getSid());
|
||||
if (null == lpkGiftCard) {
|
||||
return rb.setMsg("请核对卡号和密钥");
|
||||
}
|
||||
if (vo.getState().equals("失效")) {
|
||||
AppletVo vo = baseMapper.getGifCardBySid(lpkGiftCard.getSid());
|
||||
if (vo.getState().equals("已过期")) {
|
||||
return rb.setMsg("该卡已过期");
|
||||
}
|
||||
if (StringUtils.isNotBlank(lpkGiftCard.getCustomerSid())) {
|
||||
@@ -94,7 +96,7 @@ public class LpkGiftCardService extends MybatisBaseService<LpkGiftCardMapper, Lp
|
||||
ResultBean rb = new ResultBean().fail();
|
||||
LpkGiftCardQuery query = pq.getParams();
|
||||
QueryWrapper<LpkGiftCard> qw = new QueryWrapper<>();
|
||||
updateIsItInvalid();
|
||||
updateIsItInvalid(query.getCustomerSid());
|
||||
if (StringUtils.isNotBlank(query.getCustomerSid())) {
|
||||
qw.eq("customerSid", query.getCustomerSid());
|
||||
}
|
||||
@@ -104,17 +106,53 @@ public class LpkGiftCardService extends MybatisBaseService<LpkGiftCardMapper, Lp
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
return rb.success().setData(p);
|
||||
}
|
||||
|
||||
public ResultBean updateIsItInvalid() {
|
||||
// public ResultBean updateIsItInvalid() {
|
||||
// ResultBean rb = new ResultBean();
|
||||
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
// List<LpkGiftBag> lpkGiftBags = lpkGiftBagService.list(new QueryWrapper<LpkGiftBag>().lt("dateEnd", sdf.format(new Date())));
|
||||
// for (LpkGiftBag lpkGiftBag : lpkGiftBags) {
|
||||
// Integer i = baseMapper.selectCount(new QueryWrapper<LpkGiftCard>().eq("giftbagSid", lpkGiftBag.getSid()).ne("state", "5"));
|
||||
// if (i != 0) {
|
||||
// baseMapper.updateIsItInvalid(lpkGiftBag.getSid(), "5");
|
||||
// }
|
||||
// }
|
||||
// return rb.success();
|
||||
// }
|
||||
public ResultBean updateIsItInvalid(String customerSid) {
|
||||
ResultBean rb = new ResultBean();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
List<LpkGiftBag> lpkGiftBags = lpkGiftBagService.list(new QueryWrapper<LpkGiftBag>().lt("dateEnd", sdf.format(new Date())));
|
||||
for (LpkGiftBag lpkGiftBag : lpkGiftBags) {
|
||||
Integer i = baseMapper.selectCount(new QueryWrapper<LpkGiftCard>().eq("giftbagSid", lpkGiftBag.getSid()).ne("state", "5"));
|
||||
if (i != 0) {
|
||||
baseMapper.updateIsItInvalid(lpkGiftBag.getSid(), "5");
|
||||
List<LpkGiftBag> lpkGiftBags = lpkGiftBagService.list(new QueryWrapper<LpkGiftBag>());
|
||||
SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd");
|
||||
for(LpkGiftBag lpkGiftBag : lpkGiftBags){
|
||||
int in= DateUtil.parse(sdf.format(lpkGiftBag.getDateEnd())).compareTo(DateUtil.parse(sdf.format(new Date())));
|
||||
if(String.valueOf(in).equals("-1")){
|
||||
Integer i = baseMapper.selectCount(new QueryWrapper<LpkGiftCard>().eq("giftbagSid", lpkGiftBag.getSid()).ne("state", "5"));
|
||||
if (i != 0) {
|
||||
baseMapper.updateIsItInvalid(lpkGiftBag.getSid(), "5");
|
||||
}
|
||||
}else{
|
||||
List<LpkGiftCard>list= baseMapper.selectList(new QueryWrapper<LpkGiftCard>().eq("customerSid",customerSid).eq("giftbagSid",lpkGiftBag.getSid()));
|
||||
for (LpkGiftCard card:list){
|
||||
LpkReserveOrderVo LpkReserveOrderVo=lpkReserveOrderService.selByCardSid(card.getSid()).getData();
|
||||
if(null!=LpkReserveOrderVo){
|
||||
int c= DateUtil.parse(sdf.format(LpkReserveOrderVo.getReserveDate())).compareTo(DateUtil.parse(sdf.format(new Date())));
|
||||
LpkGiftCard card1= baseMapper.selectOne(new QueryWrapper<LpkGiftCard>().eq("sid",card.getSid()));
|
||||
if(String.valueOf(c).equals("-1")){
|
||||
card1.setIsReservation("1");
|
||||
baseMapper.updateById(card1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
// List<LpkGiftBag> lpkGiftBags = lpkGiftBagService.list(new QueryWrapper<LpkGiftBag>().lt("dateEnd", sdf.format(new Date())));
|
||||
// for (LpkGiftBag lpkGiftBag : lpkGiftBags) {
|
||||
// Integer i = baseMapper.selectCount(new QueryWrapper<LpkGiftCard>().eq("giftbagSid", lpkGiftBag.getSid()).ne("state", "5"));
|
||||
// if (i != 0) {
|
||||
// baseMapper.updateIsItInvalid(lpkGiftBag.getSid(), "5");
|
||||
// }
|
||||
// }
|
||||
return rb.success();
|
||||
}
|
||||
|
||||
@@ -125,7 +163,7 @@ public class LpkGiftCardService extends MybatisBaseService<LpkGiftCardMapper, Lp
|
||||
List<GoodsVo> goodsVos = new ArrayList<>();
|
||||
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.setGoods(s.getGoodsName());
|
||||
goodsVo.setNum(s.getGoodsNumber());
|
||||
|
||||
@@ -26,4 +26,6 @@ public interface LpkReserveOrderMapper extends BaseMapper<LpkReserveOrder> {
|
||||
List<ReserveOrderExport> exportExcel(@Param(Constants.WRAPPER) QueryWrapper<LpkReserveOrderQuery> qw);
|
||||
@Select("select * from lpk_reserve_order where customerSid =#{sid} order by createTime desc limit 1")
|
||||
LpkReserveOrderVo getStoreByCustomerSid(@Param("sid") String sid);
|
||||
@Select("select * from lpk_reserve_order where cardSid =#{sid} order by reserveDate desc limit 1")
|
||||
LpkReserveOrderVo selByCardSid(@Param("sid") String sid);
|
||||
}
|
||||
|
||||
@@ -53,7 +53,8 @@
|
||||
s.`name` as store,
|
||||
b.`name` as bagName,
|
||||
o.cardSid as cardSid,
|
||||
o.sid as orderSid
|
||||
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
|
||||
|
||||
@@ -266,4 +266,8 @@ public class LpkReserveOrderService extends MybatisBaseService<LpkReserveOrderMa
|
||||
public ResultBean<LpkReserveOrderVo> getStoreByCustomerSid(String sid) {
|
||||
return new ResultBean().success().setData(baseMapper.getStoreByCustomerSid(sid));
|
||||
}
|
||||
public ResultBean<LpkReserveOrderVo> selByCardSid(String sid) {
|
||||
return new ResultBean().success().setData(baseMapper.selByCardSid(sid));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public class LpkReserveOrderGoodsService extends MybatisBaseService<LpkReserveOr
|
||||
for (GoodsVo vo1 : vo.getGoodsVos()) {
|
||||
LpkReserveOrderGoods goods1 = baseMapper.getReserveByCardSid(dto.getSid(), vo1.getGoodsSid());
|
||||
if (null != goods1) {
|
||||
if (vo1.getNum() == goods1.getGoodsNumber()) {
|
||||
if (vo1.getNum() <= goods1.getGoodsNumber()) {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user