From ccea0d29e22ec8f62cdff129d3315ff44e173e69 Mon Sep 17 00:00:00 2001 From: wangpengfei <1928057482@qq.com> Date: Fri, 19 Jan 2024 10:52:38 +0800 Subject: [PATCH] 1/19 --- .../yythmall/api/lpkgoods/GoodsTypeVo.java | 14 ++++++++ .../VegeCellarReserveOrderDto.java | 1 + .../vegetablecellar/VegetableCellarDto.java | 26 +++++++-------- .../yythmall/api/vegetablecellar/vegeVo.java | 13 ++++++++ .../biz/lpkgiftcard/LpkGiftCardService.java | 2 +- .../yythmall/biz/lpkgoods/LpkGoodsMapper.java | 4 ++- .../yythmall/biz/lpkgoods/LpkGoodsMapper.xml | 6 ++++ .../yythmall/biz/lpkgoods/LpkGoodsRest.java | 10 ++++++ .../biz/lpkgoods/LpkGoodsService.java | 31 ++++++++++++++--- .../VegeCellarReserveDetailsService.java | 9 ++++- .../vegetablecellar/VegetableCellarRest.java | 5 +++ .../VegetableCellarService.java | 33 ++++++++++++++++--- .../yxt/yythmall/config/SaTokenConfigure.java | 2 ++ 13 files changed, 131 insertions(+), 25 deletions(-) create mode 100644 src/main/java/com/yxt/yythmall/api/lpkgoods/GoodsTypeVo.java create mode 100644 src/main/java/com/yxt/yythmall/api/vegetablecellar/vegeVo.java diff --git a/src/main/java/com/yxt/yythmall/api/lpkgoods/GoodsTypeVo.java b/src/main/java/com/yxt/yythmall/api/lpkgoods/GoodsTypeVo.java new file mode 100644 index 0000000..7c9ba0d --- /dev/null +++ b/src/main/java/com/yxt/yythmall/api/lpkgoods/GoodsTypeVo.java @@ -0,0 +1,14 @@ +package com.yxt.yythmall.api.lpkgoods; + +import lombok.Data; + +/** + * @author wangpengfei + * @date 2024/1/15 15:06 + */ +@Data +public class GoodsTypeVo { + private String name; + private String sid; + private String count; +} diff --git a/src/main/java/com/yxt/yythmall/api/vegecallerreserveorder/VegeCellarReserveOrderDto.java b/src/main/java/com/yxt/yythmall/api/vegecallerreserveorder/VegeCellarReserveOrderDto.java index 4fbd66b..e9a5f40 100644 --- a/src/main/java/com/yxt/yythmall/api/vegecallerreserveorder/VegeCellarReserveOrderDto.java +++ b/src/main/java/com/yxt/yythmall/api/vegecallerreserveorder/VegeCellarReserveOrderDto.java @@ -18,6 +18,7 @@ public class VegeCellarReserveOrderDto implements Dto { private String userName; private String userPhone; private String userAddress; + private String affiliation; private List goodsVos; private String orderSid; private String addressName; diff --git a/src/main/java/com/yxt/yythmall/api/vegetablecellar/VegetableCellarDto.java b/src/main/java/com/yxt/yythmall/api/vegetablecellar/VegetableCellarDto.java index 639fcf2..f685d17 100644 --- a/src/main/java/com/yxt/yythmall/api/vegetablecellar/VegetableCellarDto.java +++ b/src/main/java/com/yxt/yythmall/api/vegetablecellar/VegetableCellarDto.java @@ -1,8 +1,12 @@ package com.yxt.yythmall.api.vegetablecellar; +import com.fasterxml.jackson.annotation.JsonFormat; import com.yxt.common.core.dto.Dto; import lombok.Data; +import java.util.Date; +import java.util.List; + /** * @author wangpengfei * @date 2023/12/8 9:11 @@ -11,20 +15,14 @@ import lombok.Data; public class VegetableCellarDto implements Dto { private String id; private String sid; - private String createTime; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date createTime; private String remarks; - private String isEnable; - private String recordId; - private String recordSid; - private String giftbagSid; - private String serialNumber; - private String code; - private String codeKey; - private String state; - private String grantName; - private String grantDate; + // private String isEnable; + private String goodsSid; private String customerSid; - private String customerMobile; - private String Num; - private String cardArea; + private String affiliation; + private String goodsNumber; + private String totalNumber; + private List vos; } diff --git a/src/main/java/com/yxt/yythmall/api/vegetablecellar/vegeVo.java b/src/main/java/com/yxt/yythmall/api/vegetablecellar/vegeVo.java new file mode 100644 index 0000000..d381a9a --- /dev/null +++ b/src/main/java/com/yxt/yythmall/api/vegetablecellar/vegeVo.java @@ -0,0 +1,13 @@ +package com.yxt.yythmall.api.vegetablecellar; + +import lombok.Data; + +/** + * @author wangpengfei + * @date 2024/1/19 9:10 + */ +@Data +public class vegeVo { + private String goodsSid; + private String goodsNumber; +} diff --git a/src/main/java/com/yxt/yythmall/biz/lpkgiftcard/LpkGiftCardService.java b/src/main/java/com/yxt/yythmall/biz/lpkgiftcard/LpkGiftCardService.java index 5cb1748..bca1fee 100644 --- a/src/main/java/com/yxt/yythmall/biz/lpkgiftcard/LpkGiftCardService.java +++ b/src/main/java/com/yxt/yythmall/biz/lpkgiftcard/LpkGiftCardService.java @@ -1773,7 +1773,7 @@ public class LpkGiftCardService extends MybatisBaseService giftBagGoodss=lpkGoodsService.getAllGoodsApplets().getData(); + List giftBagGoodss=lpkGoodsService.getAllGoodsApplets(query).getData(); ShoppingCartQuery query1=new ShoppingCartQuery(); query1.setAffiliation(query.getAffiliation());query1.setCustomerSid(query.getCustomerSid()); List l=shoppingCartService.shoppingCartList(query1).getData(); diff --git a/src/main/java/com/yxt/yythmall/biz/lpkgoods/LpkGoodsMapper.java b/src/main/java/com/yxt/yythmall/biz/lpkgoods/LpkGoodsMapper.java index 58332ab..2f366e5 100644 --- a/src/main/java/com/yxt/yythmall/biz/lpkgoods/LpkGoodsMapper.java +++ b/src/main/java/com/yxt/yythmall/biz/lpkgoods/LpkGoodsMapper.java @@ -8,6 +8,7 @@ import com.yxt.yythmall.api.appletgiftbag.GiftBagGoods; import com.yxt.yythmall.api.appletgiftbag.GiftBagGoodss; import com.yxt.yythmall.api.appletgiftbag.MyGoodsVo; import com.yxt.yythmall.api.lpkgiftcard.LpkGiftCardQuery; +import com.yxt.yythmall.api.lpkgoods.GoodsTypeVo; import com.yxt.yythmall.api.lpkgoods.LpkGoods; import com.yxt.yythmall.api.lpkgoods.LpkGoodsQuery; import com.yxt.yythmall.api.lpkgoods.LpkGoodsVo; @@ -32,5 +33,6 @@ public interface LpkGoodsMapper extends BaseMapper { LpkGoods getGoodsByName(@Param("goodName") String goodName); List getAllGoodsApplet(); List getGoodsApplet( @Param("query") LpkGoodsQuery query); - List getAllGoodsApplets(); + List getAllGoodsApplets(@Param("query") LpkGiftCardQuery query); + List getType(); } diff --git a/src/main/java/com/yxt/yythmall/biz/lpkgoods/LpkGoodsMapper.xml b/src/main/java/com/yxt/yythmall/biz/lpkgoods/LpkGoodsMapper.xml index bfaa550..1ef2aa3 100644 --- a/src/main/java/com/yxt/yythmall/biz/lpkgoods/LpkGoodsMapper.xml +++ b/src/main/java/com/yxt/yythmall/biz/lpkgoods/LpkGoodsMapper.xml @@ -113,6 +113,12 @@ weight from lpk_goods where isAppletGrounding=1 and useTo=1 + + name like #{query.name} + order by createTime desc + \ No newline at end of file diff --git a/src/main/java/com/yxt/yythmall/biz/lpkgoods/LpkGoodsRest.java b/src/main/java/com/yxt/yythmall/biz/lpkgoods/LpkGoodsRest.java index 911410a..7ba3fed 100644 --- a/src/main/java/com/yxt/yythmall/biz/lpkgoods/LpkGoodsRest.java +++ b/src/main/java/com/yxt/yythmall/biz/lpkgoods/LpkGoodsRest.java @@ -86,4 +86,14 @@ public class LpkGoodsRest { public ResultBean vegeCellarTypeList(@RequestBody LpkGoodsQuery query) { return lpkGoodsService.vegeCellarTypeList(query); } + @ApiOperation("获取所有的商品类型") + @GetMapping("/getAllGoodsType") + public ResultBean getAllType() { + return lpkGoodsService.getAllType(); + } + @ApiOperation("根据类型查询商品") + @PostMapping("/getGoodsByType") + public ResultBean getGoodsByType(@RequestBody LpkGiftCardQuery query) { + return lpkGoodsService.getGoodsByTypeSid(query); + } } diff --git a/src/main/java/com/yxt/yythmall/biz/lpkgoods/LpkGoodsService.java b/src/main/java/com/yxt/yythmall/biz/lpkgoods/LpkGoodsService.java index 6ba0a95..50bb68d 100644 --- a/src/main/java/com/yxt/yythmall/biz/lpkgoods/LpkGoodsService.java +++ b/src/main/java/com/yxt/yythmall/biz/lpkgoods/LpkGoodsService.java @@ -12,9 +12,11 @@ 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.appletgiftbag.*; -import com.yxt.yythmall.api.lpkgiftcard.GoodsTypeVo; import com.yxt.yythmall.api.lpkgiftcard.LpkGiftCardQuery; import com.yxt.yythmall.api.lpkgoods.*; +import com.yxt.yythmall.api.shoppingcart.ShoppingCartQuery; +import com.yxt.yythmall.api.shoppingcart.ShoppingCartVo; +import com.yxt.yythmall.biz.shoppingcart.ShoppingCartService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -34,6 +36,8 @@ public class LpkGoodsService extends MybatisBaseService> goodsListPage(PagerQuery pq) { @@ -177,9 +181,9 @@ public class LpkGoodsService extends MybatisBaseService> getAllGoodsApplets() { + public ResultBean> getAllGoodsApplets(LpkGiftCardQuery query) { ResultBean rb = ResultBean.fireFail(); - List list=baseMapper.getAllGoodsApplets(); + List list=baseMapper.getAllGoodsApplets(query); list.forEach(s->{ double price=Double.valueOf(s.getPrice()); double jPrice =Double.valueOf(s.getJPrice()); @@ -233,5 +237,24 @@ public class LpkGoodsService extends MybatisBaseService> getAllType() { + ResultBean rb=new ResultBean().fail(); + List list=baseMapper.getType(); + return rb.success().setData(list); + } + public ResultBean getGoodsByTypeSid(LpkGiftCardQuery query) { + ResultBean rb=new ResultBean().fail(); + List giftBagGoodss=baseMapper.getAllGoodsApplets(query); + ShoppingCartQuery query1=new ShoppingCartQuery(); + query1.setAffiliation(query.getAffiliation());query1.setCustomerSid(query.getCustomerSid()); + List l=shoppingCartService.shoppingCartList(query1).getData(); + l.forEach(s->{ + giftBagGoodss.forEach(d->{ + if(s.getGoodsSid().equals(d.getGoodsSid())){ + d.setGoodsNumber(s.getGoodsNumber()); + } + }); + }); + return rb.success().setData(giftBagGoodss); + } } diff --git a/src/main/java/com/yxt/yythmall/biz/vegecallerreservedetail/VegeCellarReserveDetailsService.java b/src/main/java/com/yxt/yythmall/biz/vegecallerreservedetail/VegeCellarReserveDetailsService.java index b3f33c4..bba5efe 100644 --- a/src/main/java/com/yxt/yythmall/biz/vegecallerreservedetail/VegeCellarReserveDetailsService.java +++ b/src/main/java/com/yxt/yythmall/biz/vegecallerreservedetail/VegeCellarReserveDetailsService.java @@ -2,6 +2,7 @@ package com.yxt.yythmall.biz.vegecallerreservedetail; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.date.DateTime; +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.yythmall.api.empcardgiftgoods.EmpCardGiftGoodsVo; @@ -9,8 +10,10 @@ import com.yxt.yythmall.api.lpkgiftcard.AppletVo; import com.yxt.yythmall.api.lpkgiftcard.GoodsVo; import com.yxt.yythmall.api.vegecallerreservedetails.VegeCellarReserveDetails; import com.yxt.yythmall.api.vegecallerreserveorder.VegeCellarReserveOrderDto; +import com.yxt.yythmall.api.vegetablecellar.VegetableCellar; import com.yxt.yythmall.biz.empcardgiftgoods.EmpCardGiftGoodsService; import com.yxt.yythmall.biz.lpkgiftcard.LpkGiftCardService; +import com.yxt.yythmall.biz.vegetablecellar.VegetableCellarService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -25,7 +28,7 @@ public class VegeCellarReserveDetailsService extends MybatisBaseService getReserveByCardSid(String carSid, String goodsSid) { @@ -46,6 +49,10 @@ public class VegeCellarReserveDetailsService extends MybatisBaseService().eq("customerSid",dto.getCustomerSid()) + .eq("goodsSid",goods1.getGoodsSid()).eq("affiliation",dto.getAffiliation())).get(0); + vegetableCellar.setGoodsNumber(String.valueOf((int)(Double.valueOf(vegetableCellar.getGoodsNumber())-Double.valueOf(goods1.getSelect())))); + vegetableCellarService.updateById(vegetableCellar); } } diff --git a/src/main/java/com/yxt/yythmall/biz/vegetablecellar/VegetableCellarRest.java b/src/main/java/com/yxt/yythmall/biz/vegetablecellar/VegetableCellarRest.java index 31ac31b..17f3f97 100644 --- a/src/main/java/com/yxt/yythmall/biz/vegetablecellar/VegetableCellarRest.java +++ b/src/main/java/com/yxt/yythmall/biz/vegetablecellar/VegetableCellarRest.java @@ -26,4 +26,9 @@ public class VegetableCellarRest { public ResultBean addGoods(@RequestParam("mainSid") String mainSid) { return VegetableCellarService.addGoods(mainSid); } + @ApiOperation("创建记录列表") + @PostMapping("/saveGoods") + public ResultBean saveGoods(@RequestBody VegetableCellarDto dto) { + return VegetableCellarService.saveGoods(dto); + } } diff --git a/src/main/java/com/yxt/yythmall/biz/vegetablecellar/VegetableCellarService.java b/src/main/java/com/yxt/yythmall/biz/vegetablecellar/VegetableCellarService.java index 23f784c..5b1d83b 100644 --- a/src/main/java/com/yxt/yythmall/biz/vegetablecellar/VegetableCellarService.java +++ b/src/main/java/com/yxt/yythmall/biz/vegetablecellar/VegetableCellarService.java @@ -10,13 +10,12 @@ import com.yxt.common.core.result.ResultBean; import com.yxt.common.core.vo.PagerVo; import com.yxt.yythmall.api.ordorder.OrdOrder; import com.yxt.yythmall.api.ordorderdetails.OrdOrderDetail; -import com.yxt.yythmall.api.vegetablecellar.VegetableCellar; -import com.yxt.yythmall.api.vegetablecellar.VegetableCellarDto; -import com.yxt.yythmall.api.vegetablecellar.VegetableCellarQuery; -import com.yxt.yythmall.api.vegetablecellar.VegetableCellarVo; +import com.yxt.yythmall.api.shoppingcart.ShoppingCart; +import com.yxt.yythmall.api.vegetablecellar.*; import com.yxt.yythmall.biz.empcard.EmpCardService; import com.yxt.yythmall.biz.ordorder.OrdOrderService; import com.yxt.yythmall.biz.ordorderdetails.OrdOrderDetailService; +import com.yxt.yythmall.biz.shoppingcart.ShoppingCartService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -33,6 +32,8 @@ public class VegetableCellarService extends MybatisBaseService().eq("mainSid",mainSid)); @@ -54,4 +55,28 @@ public class VegetableCellarService extends MybatisBaseService().eq("customerSid",dto.getCustomerSid()) + .eq("goodsSid",detail.getGoodsSid()).eq("affiliation",dto.getAffiliation())); + if(vegetableCellar==null){ + VegetableCellar vegetable=new VegetableCellar(); + vegetable.setAffiliation(dto.getAffiliation()); + vegetable.setGoodsSid(detail.getGoodsSid()); + vegetable.setGoodsNumber(detail.getGoodsNumber()); + vegetable.setCustomerSid(dto.getCustomerSid()); + baseMapper.insert(vegetable); + }else{ + vegetableCellar.setGoodsNumber(String.valueOf(Double.valueOf(vegetableCellar.getGoodsNumber())+Double.valueOf(detail.getGoodsNumber()))); + baseMapper.updateById(vegetableCellar); + } + ShoppingCart shoppingCart=shoppingCartService.getOne((new QueryWrapper().eq("customerSid",dto.getCustomerSid()) + .eq("goodsSid",detail.getGoodsSid()).eq("affiliation",dto.getAffiliation()))); + shoppingCartService.delShoppingCart(shoppingCart.getSid()); + } + return rb.success().setMsg("成功"); + } } diff --git a/src/main/java/com/yxt/yythmall/config/SaTokenConfigure.java b/src/main/java/com/yxt/yythmall/config/SaTokenConfigure.java index 2649148..8c42ac2 100644 --- a/src/main/java/com/yxt/yythmall/config/SaTokenConfigure.java +++ b/src/main/java/com/yxt/yythmall/config/SaTokenConfigure.java @@ -61,6 +61,7 @@ public class SaTokenConfigure implements WebMvcConfigurer { .excludePathPatterns("/appletgiftbag/recommendRecord/**") //2024-01-17 .excludePathPatterns("/lpkgiftcard/getAllGoodsType/**") + .excludePathPatterns("/lpkgoods/getAllGoodsType/**") .excludePathPatterns("/lpkgiftcard/getGoodsByType/**") .excludePathPatterns("/shoppingcart/addShoppingCart") .excludePathPatterns("/shoppingcart/getGoodsWeight") @@ -72,6 +73,7 @@ public class SaTokenConfigure implements WebMvcConfigurer { .excludePathPatterns("/customerstore/getStoreBySid/**") .excludePathPatterns("/lpkgiftcard/bindAllCard") .excludePathPatterns("/lpkcustomer/customerInfo/**") + .excludePathPatterns("/vegetablecellar/saveGoods") //2024-01-18 .excludePathPatterns("/lpkcustomer/getCustomerInfo/**") .excludePathPatterns("/lpkcustomer/modifyUserNickName")