11/24
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.yxt.yyth.api.lpkgiftcard;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.yxt.common.base.utils.StringUtils;
|
||||
import com.yxt.yyth.api.lpkstore.StoreSelect;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -36,12 +37,13 @@ public class AppletVo {
|
||||
public String getStart() {
|
||||
SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd");
|
||||
start=sdf.format(DateUtil.offsetDay(new Date(),+2));
|
||||
|
||||
int i=DateUtil.parse(sdf.format(DateUtil.parse(start))).compareTo(DateUtil.parse(sdf.format(DateUtil.parse(dateEnd))));
|
||||
if(String.valueOf(i).equals("-1")){
|
||||
end=sdf.format(DateUtil.parse(dateEnd));
|
||||
}else{
|
||||
end=sdf.format(DateUtil.offsetDay(DateUtil.parse(dateEnd),2));
|
||||
if(StringUtils.isNotBlank(dateEnd)){
|
||||
int i=DateUtil.parse(sdf.format(DateUtil.parse(start))).compareTo(DateUtil.parse(sdf.format(DateUtil.parse(dateEnd))));
|
||||
if(String.valueOf(i).equals("-1")){
|
||||
end=sdf.format(DateUtil.parse(dateEnd));
|
||||
}else{
|
||||
end=sdf.format(DateUtil.offsetDay(DateUtil.parse(dateEnd),2));
|
||||
}
|
||||
}
|
||||
return start;
|
||||
}
|
||||
@@ -55,7 +57,12 @@ public class AppletVo {
|
||||
|
||||
public String getTime() {
|
||||
SimpleDateFormat sdf =new SimpleDateFormat("yyyy.MM.dd");
|
||||
time=sdf.format(DateUtil.parse(dateStart))+"~"+sdf.format(DateUtil.parse(dateEnd));
|
||||
if(StringUtils.isNotBlank(dateStart)){
|
||||
if(StringUtils.isNotBlank(dateEnd)){
|
||||
time=sdf.format(DateUtil.parse(dateStart))+"~"+sdf.format(DateUtil.parse(dateEnd));
|
||||
}
|
||||
}
|
||||
|
||||
return time;
|
||||
}
|
||||
|
||||
@@ -69,11 +76,19 @@ public class AppletVo {
|
||||
|
||||
public String getState() {
|
||||
SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd");
|
||||
int i=DateUtil.parse(sdf.format(DateUtil.parse(dateEnd))).compareTo(DateUtil.parse(sdf.format(DateUtil.date())));
|
||||
if( String.valueOf(i).equals("-1")){
|
||||
state="失效";
|
||||
showBtn=false;
|
||||
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="失效";
|
||||
showBtn=false;
|
||||
// appletVo.setShowBtn(true);
|
||||
}else{
|
||||
state="正常";
|
||||
if(states.equals("5")){
|
||||
this.state="失效";
|
||||
showBtn=false;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
state="正常";
|
||||
if(states.equals("5")){
|
||||
@@ -81,6 +96,7 @@ public class AppletVo {
|
||||
showBtn=false;
|
||||
}
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,8 +85,7 @@ public class LpkGiftCardService extends MybatisBaseService<LpkGiftCardMapper, Lp
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
return rb.success().setData(p);
|
||||
}
|
||||
|
||||
public ResultBean getGifCardBySid(String sid) {
|
||||
public ResultBean<AppletVo> getGifCardBySid(String sid) {
|
||||
ResultBean rb = new ResultBean().fail();
|
||||
AppletVo vo = baseMapper.getGifCardBySid(sid);
|
||||
List<LpkGiftBagGoodsVo> list = LpkGiftBagGoodsService.getGoodsByBagSid(vo.getGiftbagSid());
|
||||
@@ -114,14 +113,6 @@ public class LpkGiftCardService extends MybatisBaseService<LpkGiftCardMapper, Lp
|
||||
goodsVo.setLNum(s.getGoodsNumber());
|
||||
goodsVos.add(goodsVo);
|
||||
}
|
||||
// if(!vo.isShowBtn()){
|
||||
// GoodsVo goodsVo=new GoodsVo();
|
||||
// goodsVo.setGoods(s.getGoodsName());
|
||||
// goodsVo.setNum(s.getGoodsNumber());
|
||||
// goodsVo.setPic(s.getPicUrl());
|
||||
// goodsVo.setLNum(0);
|
||||
// goodsVos.add(goodsVo);
|
||||
// }
|
||||
});
|
||||
vo.setGoodsVos(goodsVos);
|
||||
return rb.success().setData(vo);
|
||||
@@ -142,12 +133,14 @@ public class LpkGiftCardService extends MybatisBaseService<LpkGiftCardMapper, Lp
|
||||
goodsVo.setGoodsSid(s.getGoodsSid());
|
||||
goodsVo.setPic(urlPrefix + s.getPicUrl());
|
||||
if (null != goods) {
|
||||
if (goods.getGoodsNumber() != s.getGoodsNumber()) {
|
||||
goodsVo.setLNum(s.getGoodsNumber() - goods.getGoodsNumber());
|
||||
if(goods.getGoodsNumber()!=s.getGoodsNumber()){
|
||||
goodsVo.setLNum(s.getGoodsNumber()-goods.getGoodsNumber());
|
||||
goodsVo.setSelect(s.getGoodsNumber()-goods.getGoodsNumber());
|
||||
goodsVos.add(goodsVo);
|
||||
}
|
||||
} else {
|
||||
goodsVo.setLNum(s.getGoodsNumber());
|
||||
goodsVo.setSelect(s.getGoodsNumber());
|
||||
goodsVos.add(goodsVo);
|
||||
}
|
||||
});
|
||||
@@ -280,4 +273,11 @@ public class LpkGiftCardService extends MybatisBaseService<LpkGiftCardMapper, Lp
|
||||
PagerVo<LpkGiftCardListVo> p = PagerUtil.pageToVo(pagging, null);
|
||||
return rb.success().setData(p);
|
||||
}
|
||||
public ResultBean changState(String cardSid,String state) {
|
||||
ResultBean rb=new ResultBean().fail();
|
||||
LpkGiftCard card=baseMapper.selectOne(new QueryWrapper<LpkGiftCard>().eq("sid",cardSid));
|
||||
card.setState(state);
|
||||
baseMapper.updateById(card);
|
||||
return rb.success().setData("成功");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,4 +14,5 @@ import org.apache.ibatis.annotations.Select;
|
||||
public interface LpkReserveOrderGoodsMapper extends BaseMapper<LpkReserveOrderGoods> {
|
||||
@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);
|
||||
|
||||
}
|
||||
|
||||
@@ -4,12 +4,15 @@ import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.yxt.common.base.service.MybatisBaseService;
|
||||
import com.yxt.common.core.result.ResultBean;
|
||||
import com.yxt.yyth.api.lpkgiftcard.AppletVo;
|
||||
import com.yxt.yyth.api.lpkgiftcard.GoodsVo;
|
||||
import com.yxt.yyth.api.lpkreserveorder.Goods;
|
||||
import com.yxt.yyth.api.lpkreserveorder.LpkReserveOrder;
|
||||
import com.yxt.yyth.api.lpkreserveorder.LpkReserveOrderDto;
|
||||
import com.yxt.yyth.api.lpkreserveordergoods.LpkReserveOrderGoods;
|
||||
import com.yxt.yyth.api.lpkreserveordergoods.LpkReserveOrderGoodsDto;
|
||||
import com.yxt.yyth.biz.lpkgiftcard.LpkGiftCardService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
@@ -20,6 +23,8 @@ import java.util.List;
|
||||
*/
|
||||
@Service
|
||||
public class LpkReserveOrderGoodsService extends MybatisBaseService<LpkReserveOrderGoodsMapper, LpkReserveOrderGoods> {
|
||||
@Autowired
|
||||
LpkGiftCardService lpkGiftCardService;
|
||||
public ResultBean<LpkReserveOrderGoods> getReserveByCardSid(String carSid,String goodsSid){
|
||||
ResultBean rb=new ResultBean();
|
||||
LpkReserveOrderGoods goods= baseMapper.getReserveByCardSid(carSid,goodsSid);
|
||||
@@ -38,7 +43,21 @@ public class LpkReserveOrderGoodsService extends MybatisBaseService<LpkReserveOr
|
||||
baseMapper.insert(goods);
|
||||
}
|
||||
}
|
||||
|
||||
AppletVo vo=lpkGiftCardService.getGifCardBySid(dto.getCardSid()).getData();
|
||||
int i=0;
|
||||
for (GoodsVo vo1:vo.getGoodsVos()){
|
||||
LpkReserveOrderGoods goods1=baseMapper.getReserveByCardSid(dto.getCardSid(), vo1.getGoodsSid());
|
||||
if(null!=goods1){
|
||||
if(vo1.getNum()==goods1.getGoodsNumber()){
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if(vo.getGoodsVos().size()==i){
|
||||
lpkGiftCardService.changState(dto.getCardSid(),"5");
|
||||
}else{
|
||||
lpkGiftCardService.changState(dto.getCardSid(),"4");
|
||||
}
|
||||
}
|
||||
return rb.success().setData("预约成功");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user