diff --git a/src/main/java/com/peanut/config/Constants.java b/src/main/java/com/peanut/config/Constants.java index de6e4a8f..972a91cc 100644 --- a/src/main/java/com/peanut/config/Constants.java +++ b/src/main/java/com/peanut/config/Constants.java @@ -85,4 +85,20 @@ public class Constants { * 快递接口 - 查询 URL */ public static final String EXPRESS_QUERY_URL = "https://api.kdniao.com/Ebusiness/EbusinessOrderHandle.aspx"; + /** + * 韵达客户号 + */ + public static final String EXPRESS_YD_CUSTOMER_NAME = "263467666272"; + /** + * 韵达客户密码 + */ + public static final String EXPRESS_YD_CUSTOMER_PWD = "bWPRSpVu7x9wrDENd3TIaGnj8ZfekB"; + /** + * 顺丰 + */ + public static final String EXPRESS_COMPANY_CODE_SF = "SF"; + /** + * 韵达 + */ + public static final String EXPRESS_COMPANY_CODE_YD = "YD"; } \ No newline at end of file diff --git a/src/main/java/com/peanut/modules/book/controller/BookController.java b/src/main/java/com/peanut/modules/book/controller/BookController.java index ae58446e..c28eb05b 100644 --- a/src/main/java/com/peanut/modules/book/controller/BookController.java +++ b/src/main/java/com/peanut/modules/book/controller/BookController.java @@ -93,7 +93,7 @@ public class BookController { wrapper.eq(ShopProductToLabelEntity::getDelFlag,0); List pIds = shopProductToLabelService.getBaseMapper().selectList(wrapper).stream().map(ShopProductToLabelEntity::getProductId).collect(Collectors.toList()); - List shopProductEntities = shopProductService.getBaseMapper().selectList(new LambdaQueryWrapper().in(ShopProductEntity::getProductId, pIds)); + List shopProductEntities = shopProductService.getBaseMapper().selectList(new LambdaQueryWrapper().in(ShopProduct::getProductId, pIds)); return R.ok().put("Products",shopProductEntities); } @@ -177,10 +177,10 @@ public class BookController { String publisherId = book.getPublisherId(); String[] publisherIds = publisherId.split(","); List publisherList = Arrays.asList(publisherIds); - List publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper().in("id", publisherList)); + List publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper().in("id", publisherList)); - for (PublisherEntity publisherEntity : publisherEntities) { - publisherName += "," + publisherEntity.getPublisherName(); + for (Publisher publisher : publisherEntities) { + publisherName += "," + publisher.getPublisherName(); } publisherName = publisherName.startsWith(",") ? publisherName.substring(1) : publisherName; @@ -553,10 +553,10 @@ public class BookController { String publisherId = book.getPublisherId(); String[] publisherIds = publisherId.split(","); List publisherList = Arrays.asList(publisherIds); - List publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper().in("id", publisherList)); + List publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper().in("id", publisherList)); - for (PublisherEntity publisherEntity : publisherEntities) { - publisherName += "," + publisherEntity.getPublisherName(); + for (Publisher publisher : publisherEntities) { + publisherName += "," + publisher.getPublisherName(); } publisherName = publisherName.startsWith(",") ? publisherName.substring(1) : publisherName; @@ -594,10 +594,10 @@ public class BookController { String publisherId = book.getPublisherId(); String[] publisherIds = publisherId.split(","); List publisherList = Arrays.asList(publisherIds); - List publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper().in("id", publisherList)); + List publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper().in("id", publisherList)); - for (PublisherEntity publisherEntity : publisherEntities) { - publisherName += "," + publisherEntity.getPublisherName(); + for (Publisher publisher : publisherEntities) { + publisherName += "," + publisher.getPublisherName(); } publisherName = publisherName.startsWith(",") ? publisherName.substring(1) : publisherName; @@ -634,10 +634,10 @@ public class BookController { String publisherId = book.getPublisherId(); String[] publisherIds = publisherId.split(","); List publisherList = Arrays.asList(publisherIds); - List publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper().in("id", publisherList)); + List publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper().in("id", publisherList)); - for (PublisherEntity publisherEntity : publisherEntities) { - publisherName += "," + publisherEntity.getPublisherName(); + for (Publisher publisher : publisherEntities) { + publisherName += "," + publisher.getPublisherName(); } publisherName = publisherName.startsWith(",") ? publisherName.substring(1) : publisherName; diff --git a/src/main/java/com/peanut/modules/book/controller/BookForumArticlesServiceController.java b/src/main/java/com/peanut/modules/book/controller/BookForumArticlesServiceController.java index ef0c6b76..e093b9d2 100644 --- a/src/main/java/com/peanut/modules/book/controller/BookForumArticlesServiceController.java +++ b/src/main/java/com/peanut/modules/book/controller/BookForumArticlesServiceController.java @@ -377,10 +377,10 @@ public class BookForumArticlesServiceController { String publisherId = bookentity.getPublisherId(); String[] publisherIds = publisherId.split(","); List publisherList = Arrays.asList(publisherIds); - List publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper().in("id", publisherList)); + List publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper().in("id", publisherList)); - for (PublisherEntity publisherEntity : publisherEntities) { - publisherName += "," + publisherEntity.getPublisherName(); + for (Publisher publisher : publisherEntities) { + publisherName += "," + publisher.getPublisherName(); } publisherName = publisherName.startsWith(",") ? publisherName.substring(1) : publisherName; bookForumArticlesVO.setBookid(String.valueOf(bookid1)); diff --git a/src/main/java/com/peanut/modules/book/controller/BuyOrderController.java b/src/main/java/com/peanut/modules/book/controller/BuyOrderController.java index 6d99dc78..38c649d4 100644 --- a/src/main/java/com/peanut/modules/book/controller/BuyOrderController.java +++ b/src/main/java/com/peanut/modules/book/controller/BuyOrderController.java @@ -79,15 +79,15 @@ public class BuyOrderController { private SysConfigService sysConfigService; /** - * 列表 + * 订单列表 + * + * @param params + * @return + * @throws Exception */ @RequestMapping("/list") public R list(@RequestParam Map params) throws Exception { - - if ("all".equals(params.get("orderStatus"))) { - params.remove("orderStatus"); - } - PageUtils page = buyOrderService.queryPage(params); + PageUtils page = buyOrderService.list(params); return R.ok().put("page", page); } @@ -108,7 +108,7 @@ public class BuyOrderController { for (BuyOrderDetail buyOrderDetail : buyOrderDetails) { Integer productId = buyOrderDetail.getProductId(); int quantity = buyOrderDetail.getQuantity(); - ShopProductEntity product = shopProductService.getById(productId); + ShopProduct product = shopProductService.getById(productId); BigDecimal price = getRealPrice(product); if (!handleStock(buyOrderDetail, product)) { return R.error(500, "库存不足"); @@ -137,7 +137,8 @@ public class BuyOrderController { vo = userAddressService.getAddressName(vo, userAddress.getRegionCode()); buyOrder.setProvince(vo.getProvince()); buyOrder.setCity(vo.getCity()); - buyOrder.setDistrict(vo.getCity()); + buyOrder.setDistrict(vo.getCounty()); + buyOrder.setAddress(vo.getDetailAddress()); buyOrderService.save(buyOrder); for (BuyOrderDetail buyOrderDetail : buyOrderDetails) { @@ -187,7 +188,7 @@ public class BuyOrderController { List products = vo.getProducts(); BigDecimal totalWeight = new BigDecimal(0); for (ProductRequestVo product : products) { - ShopProductEntity shopProduct = shopProductService.getById(product.getProductId()); + ShopProduct shopProduct = shopProductService.getById(product.getProductId()); BigDecimal weight = BigDecimal.valueOf(Double.valueOf(shopProduct.getWeight()) / 1000.0); totalWeight = totalWeight.add(weight.multiply(new BigDecimal(product.getQuantity()))); } @@ -204,7 +205,7 @@ public class BuyOrderController { */ @RequestMapping("/getMyOrderList") public R getMyOrderList(@RequestParam Map params) { - PageUtils page = buyOrderService.queryPage1(params); + PageUtils page = buyOrderService.getMyOrderList(params); return R.ok().put("page", page); } @@ -251,7 +252,7 @@ public class BuyOrderController { .eq("order_id", byId.getOrderId())); for (BuyOrderDetail buyOrderDetailEntity : buyOrderDetailEntities) { Integer productId = buyOrderDetailEntity.getProductId(); - ShopProductEntity product = shopProductService.getById(productId); + ShopProduct product = shopProductService.getById(productId); product.setProductStock(product.getProductStock() + buyOrderDetailEntity.getQuantity()); shopProductService.updateById(product); } @@ -319,7 +320,7 @@ public class BuyOrderController { List buyOrderDetailList = buyOrderDetailService.list(queryWrapper); for (BuyOrderDetail buyOrderDetail : buyOrderDetailList) { - ShopProductEntity prod = shopProductService.getById(buyOrderDetail.getProductId()); + ShopProduct prod = shopProductService.getById(buyOrderDetail.getProductId()); if (prod != null) { buyOrderDetail.setImage(prod.getProductImages()); } @@ -392,10 +393,10 @@ public class BuyOrderController { * @param buyOrderDetailId 订单详情列表 * @return R */ - @RequestMapping(value = "/createSplitPackages", method = RequestMethod.POST) - public R createSplitPackageOrder(@RequestParam("expressCompanyCode") String expressCompanyCode, - @RequestBody List buyOrderDetailId) throws Exception { - buyOrderService.createSplitPackageOrder(expressCompanyCode, buyOrderDetailId); + @RequestMapping(value = "/delivery", method = RequestMethod.POST) + public R delivery(@RequestParam("expressCompanyCode") String expressCompanyCode, + @RequestBody List buyOrderDetailId) throws Exception { + buyOrderService.delivery(expressCompanyCode, buyOrderDetailId); return R.ok(); } @@ -406,7 +407,7 @@ public class BuyOrderController { * @param product 商品信息 * @return 商品实际价格 */ - private BigDecimal getRealPrice(ShopProductEntity product) { + private BigDecimal getRealPrice(ShopProduct product) { BigDecimal activityPrice = product.getActivityPrice(); return (activityPrice == null || activityPrice.equals(BigDecimal.ZERO)) ? product.getPrice() : activityPrice; } @@ -418,7 +419,7 @@ public class BuyOrderController { * @param product * @return */ - private boolean handleStock(BuyOrderDetail buyOrderDetail, ShopProductEntity product) { + private boolean handleStock(BuyOrderDetail buyOrderDetail, ShopProduct product) { int quantity = buyOrderDetail.getQuantity(); if (product.getProductStock() - quantity < 0) { return false; diff --git a/src/main/java/com/peanut/modules/book/controller/PublisherController.java b/src/main/java/com/peanut/modules/book/controller/PublisherController.java index aa031e42..9261a33f 100644 --- a/src/main/java/com/peanut/modules/book/controller/PublisherController.java +++ b/src/main/java/com/peanut/modules/book/controller/PublisherController.java @@ -3,7 +3,7 @@ package com.peanut.modules.book.controller; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.peanut.common.utils.PageUtils; import com.peanut.common.utils.R; -import com.peanut.modules.book.entity.PublisherEntity; +import com.peanut.modules.book.entity.Publisher; import com.peanut.modules.book.service.BookService; import com.peanut.modules.book.service.PublisherService; import org.springframework.beans.factory.annotation.Autowired; @@ -40,9 +40,9 @@ public class PublisherController { */ @RequestMapping("/publisherList") public R publisherList(){ - List publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper()); + List publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper()); ArrayList list = new ArrayList<>(); - for (PublisherEntity publisherEntitie : publisherEntities) { + for (Publisher publisherEntitie : publisherEntities) { HashMap map = new HashMap<>(); map.put("id",publisherEntitie.getId()); map.put("value",publisherEntitie.getPublisherName()); @@ -56,7 +56,7 @@ public class PublisherController { */ @RequestMapping("/info/{id}") public R info(@PathVariable("id") Integer id){ - PublisherEntity publisher = publisherService.getById(id); + Publisher publisher = publisherService.getById(id); return R.ok().put("publisher", publisher); } @@ -68,13 +68,13 @@ public class PublisherController { public R appGetInfo(@PathVariable("id") Integer id, @PathVariable("limit") String limit, @PathVariable("page") String page){ - PublisherEntity publisherEntity = publisherService.getById(id); + Publisher publisher = publisherService.getById(id); HashMap map = new HashMap<>(); - map.put("publisherName",publisherEntity.getPublisherName()); + map.put("publisherName", publisher.getPublisherName()); map.put("limit",limit); map.put("page",page); PageUtils pageUtils = bookService.queryPage(map); - return R.ok().put("publisherInfo", publisherEntity).put("publisherBooks",pageUtils); + return R.ok().put("publisherInfo", publisher).put("publisherBooks",pageUtils); } @@ -84,7 +84,7 @@ public class PublisherController { */ @RequestMapping("/save") // @RequiresPermissions("book:publisher:save") - public R save(@RequestBody PublisherEntity publisher){ + public R save(@RequestBody Publisher publisher){ publisher.setDelFlag(0); publisherService.save(publisher); return R.ok(); @@ -94,7 +94,7 @@ public class PublisherController { * 修改 */ @RequestMapping("/update") - public R update(@RequestBody PublisherEntity publisher){ + public R update(@RequestBody Publisher publisher){ publisherService.updateById(publisher); return R.ok(); } diff --git a/src/main/java/com/peanut/modules/book/controller/ShopProductController.java b/src/main/java/com/peanut/modules/book/controller/ShopProductController.java index 8db59414..d5a8f897 100644 --- a/src/main/java/com/peanut/modules/book/controller/ShopProductController.java +++ b/src/main/java/com/peanut/modules/book/controller/ShopProductController.java @@ -111,7 +111,7 @@ public class ShopProductController { purchasedProductIds.add(String.valueOf(buyOrderDetail.getProductId())); } //查询商品表并过滤已购买商品id,根据时间倒叙展示 - List allProductEntities = shopProductService.getBaseMapper().selectList(new QueryWrapper() + List allProductEntities = shopProductService.getBaseMapper().selectList(new QueryWrapper() .notIn("product_id", purchasedProductIds) .orderByDesc("create_time") // .notLike("book_ids",",") @@ -120,7 +120,7 @@ public class ShopProductController { ); List lists = new ArrayList<>(); - for (ShopProductEntity product : allProductEntities) { + for (ShopProduct product : allProductEntities) { Map productMap = new HashMap<>(); productMap.put("product", product); lists.add(productMap); @@ -137,19 +137,19 @@ public class ShopProductController { List bookEntityList = shopProductBookService.getBaseMapper().selectList(new QueryWrapper().eq("book_id", productId)); List list = new ArrayList<>(); ArrayList booklist = new ArrayList<>(); - ShopProductEntity shopProductEntity = null; + ShopProduct shopProduct = null; for (ShopProductBookEntity shopProductBookEntity : bookEntityList) { Integer proudictId = shopProductBookEntity.getProductId(); - shopProductEntity = shopProductService.getBaseMapper().selectOne(new QueryWrapper().eq("product_id", proudictId)); + shopProduct = shopProductService.getBaseMapper().selectOne(new QueryWrapper().eq("product_id", proudictId)); Integer bookId = shopProductBookEntity.getBookId(); BookEntity byId = bookService.getById(bookId); booklist.add(String.valueOf(bookId)); list.add(byId); - shopProductEntity.setBookidsimages(list); - shopProductEntity.setBookids(booklist); + shopProduct.setBookidsimages(list); + shopProduct.setBookids(booklist); } - return R.ok().put("shopProduct", shopProductEntity); + return R.ok().put("shopProduct", shopProduct); } @@ -157,17 +157,17 @@ public class ShopProductController { @RequestMapping("/bookinfolists/{productId}") public R bookinfolists(@PathVariable("productId") Integer productId) { //查询商品 - ShopProductEntity shopProductEntity = shopProductService.getBaseMapper().selectOne(new QueryWrapper().eq("product_id", productId)); + ShopProduct shopProduct = shopProductService.getBaseMapper().selectOne(new QueryWrapper().eq("product_id", productId)); ArrayList> imagesUrl = new ArrayList>(); //分类 - Integer poid = shopProductEntity.getProductPid(); + Integer poid = shopProduct.getProductPid(); //商品id - Integer productId1 = shopProductEntity.getProductId(); + Integer productId1 = shopProduct.getProductId(); //分类信息 List poids = shopCategoryService.findPoid(poid); List product = shopProductBookService.getBaseMapper().selectList(new QueryWrapper() .eq("product_id", productId1)); - List result = new ArrayList<>(); + List result = new ArrayList<>(); //获取商品id Set productIds = new HashSet<>(); productIds.add(productId); @@ -181,7 +181,7 @@ public class ShopProductController { } } for (Integer pId : productIds) { - ShopProductEntity proEntity = null; + ShopProduct proEntity = null; proEntity = shopProductService.getById(pId); List pbookEntitys = shopProductBookService.getBaseMapper().selectList(new QueryWrapper() .eq("product_id", pId)); @@ -224,13 +224,13 @@ public class ShopProductController { .having("count(product_id) >=" + ids.size()) ); - List frag = new ArrayList<>(); + List frag = new ArrayList<>(); //如果绑定的书为空,直接返回空值 if (ids.size() == 0) { return R.ok(); } for (ShopProductBookEntity spbe : ss) { - ShopProductEntity ca_sp = shopProductService.getById(spbe.getProductId()); + ShopProduct ca_sp = shopProductService.getById(spbe.getProductId()); frag.add(ca_sp); } @@ -246,16 +246,16 @@ public class ShopProductController { */ @RequestMapping("/info/{productId}") public R info(@PathVariable("productId") Integer productId) { - ShopProductEntity shopProductEntity = shopProductService.getBaseMapper().selectOne(new QueryWrapper().eq("product_id", productId).eq("del_flag", 0)); - if (shopProductEntity == null) { + ShopProduct shopProduct = shopProductService.getBaseMapper().selectOne(new QueryWrapper().eq("product_id", productId).eq("del_flag", 0)); + if (shopProduct == null) { return R.error("该商品已下架,看看其他商品吧"); } ArrayList> imagesUrl = new ArrayList>(); - Integer poid = shopProductEntity.getProductPid(); - Integer productId1 = shopProductEntity.getProductId(); + Integer poid = shopProduct.getProductPid(); + Integer productId1 = shopProduct.getProductId(); List poids = shopCategoryService.findPoid(poid); - shopProductEntity.setPoids(poids); + shopProduct.setPoids(poids); List list = new ArrayList<>(); List bookIdlist = new ArrayList<>(); ArrayList booklist = new ArrayList<>(); @@ -280,10 +280,10 @@ public class ShopProductController { } - shopProductEntity.setBookidsimages(list); - shopProductEntity.setBookids(booklist); - shopProductEntity.setShoproudIds(bookIdlist); - return R.ok().put("shopProduct", shopProductEntity).put("labels", labelList); + shopProduct.setBookidsimages(list); + shopProduct.setBookids(booklist); + shopProduct.setShoproudIds(bookIdlist); + return R.ok().put("shopProduct", shopProduct).put("labels", labelList); } @@ -306,7 +306,7 @@ public class ShopProductController { for (ShopProductBookEntity shopProduct : bookIds) { Integer shopProductId = shopProduct.getProductId(); - List shopProductEntities = shopProductService.getBaseMapper().selectList(new QueryWrapper() + List shopProductEntities = shopProductService.getBaseMapper().selectList(new QueryWrapper() .eq("product_id", shopProductId)); list.add(shopProductEntities); } @@ -319,7 +319,7 @@ public class ShopProductController { * 保存 */ @RequestMapping("/save") - public R save(@RequestBody ShopProductEntity shopProduct) { + public R save(@RequestBody ShopProduct shopProduct) { shopProduct.setCreateTime(new Date()); @@ -351,7 +351,7 @@ public class ShopProductController { * 修改 */ @RequestMapping("/update") - public R update(@RequestBody ShopProductEntity shopProduct) { + public R update(@RequestBody ShopProduct shopProduct) { //商品id Integer productId = shopProduct.getProductId(); @@ -458,7 +458,7 @@ public class ShopProductController { if (catId == 0) { catId = null; } - List list = shopProductService.appGetCategoryList(catId); + List list = shopProductService.appGetCategoryList(catId); return R.ok().put("list", list); } @@ -467,7 +467,7 @@ public class ShopProductController { */ @RequestMapping("/prodSearch") public R prodSearch() { - List list = shopProductService.list(new QueryWrapper().select("product_id,product_name")); + List list = shopProductService.list(new QueryWrapper().select("product_id,product_name")); List collect = list.stream().map(shopProductEntity -> { ShopProductVo shopProductVo = new ShopProductVo(); shopProductVo.setProductId(shopProductEntity.getProductId()); @@ -483,7 +483,7 @@ public class ShopProductController { @RequestMapping("/backProdSearch") public R backProdSearch(@RequestParam Map params) { String productName = (String) params.get("productName"); - List list = shopProductService.list(new QueryWrapper() + List list = shopProductService.list(new QueryWrapper() .like("product_name", productName)); return R.ok().put("list", list); } diff --git a/src/main/java/com/peanut/modules/book/controller/ShopProductLabelController.java b/src/main/java/com/peanut/modules/book/controller/ShopProductLabelController.java index 6fba88dc..444c0d40 100644 --- a/src/main/java/com/peanut/modules/book/controller/ShopProductLabelController.java +++ b/src/main/java/com/peanut/modules/book/controller/ShopProductLabelController.java @@ -1,14 +1,13 @@ package com.peanut.modules.book.controller; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.github.yulichang.wrapper.MPJLambdaWrapper; import com.peanut.common.utils.PageUtils; import com.peanut.common.utils.R; import com.peanut.modules.book.dao.ShopProductLabelDao; import com.peanut.modules.book.dao.ShopProductToLabelDao; -import com.peanut.modules.book.entity.ShopProductEntity; +import com.peanut.modules.book.entity.ShopProduct; import com.peanut.modules.book.entity.ShopProductLabelEntity; import com.peanut.modules.book.entity.ShopProductToLabelEntity; import com.peanut.modules.book.service.ShopProductLabelService; @@ -18,7 +17,6 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -106,12 +104,12 @@ public class ShopProductLabelController { @RequestMapping("/getProductsByLabel") public R getProductsByLabel(@RequestParam Integer splId,@RequestParam Integer limit,@RequestParam Integer page){ MPJLambdaWrapper shopProductEntityMPJLambdaWrapper = new MPJLambdaWrapper(); - shopProductEntityMPJLambdaWrapper.selectAll(ShopProductEntity.class); - shopProductEntityMPJLambdaWrapper.leftJoin(ShopProductEntity.class,ShopProductEntity::getProductId,ShopProductToLabelEntity::getProductId); + shopProductEntityMPJLambdaWrapper.selectAll(ShopProduct.class); + shopProductEntityMPJLambdaWrapper.leftJoin(ShopProduct.class, ShopProduct::getProductId,ShopProductToLabelEntity::getProductId); shopProductEntityMPJLambdaWrapper.eq(ShopProductToLabelEntity::getSplId,splId); shopProductEntityMPJLambdaWrapper.eq(ShopProductToLabelEntity::getDelFlag,0); - shopProductEntityMPJLambdaWrapper.eq(ShopProductEntity::getDelFlag,0); - Page shopProductEntityPage = shopProductToLabelDao.selectJoinPage(new Page(page, limit), ShopProductEntity.class, shopProductEntityMPJLambdaWrapper); + shopProductEntityMPJLambdaWrapper.eq(ShopProduct::getDelFlag,0); + Page shopProductEntityPage = shopProductToLabelDao.selectJoinPage(new Page(page, limit), ShopProduct.class, shopProductEntityMPJLambdaWrapper); return R.ok().put("page",shopProductEntityPage); } diff --git a/src/main/java/com/peanut/modules/book/dao/PublisherDao.java b/src/main/java/com/peanut/modules/book/dao/PublisherDao.java index 99e0a459..87390964 100644 --- a/src/main/java/com/peanut/modules/book/dao/PublisherDao.java +++ b/src/main/java/com/peanut/modules/book/dao/PublisherDao.java @@ -1,6 +1,6 @@ package com.peanut.modules.book.dao; -import com.peanut.modules.book.entity.PublisherEntity; +import com.peanut.modules.book.entity.Publisher; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Mapper; @@ -12,6 +12,6 @@ import org.apache.ibatis.annotations.Mapper; * @date 2022-08-04 15:36:59 */ @Mapper -public interface PublisherDao extends BaseMapper { +public interface PublisherDao extends BaseMapper { } diff --git a/src/main/java/com/peanut/modules/book/dao/ShopProductDao.java b/src/main/java/com/peanut/modules/book/dao/ShopProductDao.java index a6c85f0e..afd9d299 100644 --- a/src/main/java/com/peanut/modules/book/dao/ShopProductDao.java +++ b/src/main/java/com/peanut/modules/book/dao/ShopProductDao.java @@ -1,6 +1,6 @@ package com.peanut.modules.book.dao; -import com.peanut.modules.book.entity.ShopProductEntity; +import com.peanut.modules.book.entity.ShopProduct; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Mapper; @@ -14,9 +14,9 @@ import java.util.List; * @date 2022-10-28 09:43:14 */ @Mapper -public interface ShopProductDao extends BaseMapper { +public interface ShopProductDao extends BaseMapper { - List appGetCategoryList(Integer catId); + List appGetCategoryList(Integer catId); int getTotalWeight(List productIdList); diff --git a/src/main/java/com/peanut/modules/book/entity/BookEntity.java b/src/main/java/com/peanut/modules/book/entity/BookEntity.java index 0605df5a..4139d3d8 100644 --- a/src/main/java/com/peanut/modules/book/entity/BookEntity.java +++ b/src/main/java/com/peanut/modules/book/entity/BookEntity.java @@ -151,7 +151,7 @@ public class BookEntity implements Serializable { private AuthorEntity author; @TableField(exist = false) - private PublisherEntity publisher; + private Publisher publisher; @TableField(exist = false) private String authorName; diff --git a/src/main/java/com/peanut/modules/book/entity/BuyOrder.java b/src/main/java/com/peanut/modules/book/entity/BuyOrder.java index 70190195..092f90a8 100644 --- a/src/main/java/com/peanut/modules/book/entity/BuyOrder.java +++ b/src/main/java/com/peanut/modules/book/entity/BuyOrder.java @@ -24,7 +24,7 @@ public class BuyOrder implements Serializable { @TableId private Integer orderId; /** - * 订单编号 yyyymmddnnnnnnnn’ + * 订单编号 */ private String orderSn; /** diff --git a/src/main/java/com/peanut/modules/book/entity/ExpressOrder.java b/src/main/java/com/peanut/modules/book/entity/ExpressOrder.java index dfc5f16b..019202d7 100644 --- a/src/main/java/com/peanut/modules/book/entity/ExpressOrder.java +++ b/src/main/java/com/peanut/modules/book/entity/ExpressOrder.java @@ -19,10 +19,6 @@ public class ExpressOrder { * ID */ private int id; - /** - * 用户 ID - */ - private int userId; /** * 省份 */ diff --git a/src/main/java/com/peanut/modules/book/entity/PublisherEntity.java b/src/main/java/com/peanut/modules/book/entity/Publisher.java similarity index 93% rename from src/main/java/com/peanut/modules/book/entity/PublisherEntity.java rename to src/main/java/com/peanut/modules/book/entity/Publisher.java index fc0e7ab3..0bbb52b4 100644 --- a/src/main/java/com/peanut/modules/book/entity/PublisherEntity.java +++ b/src/main/java/com/peanut/modules/book/entity/Publisher.java @@ -15,7 +15,7 @@ import lombok.Data; */ @Data @TableName("publisher") -public class PublisherEntity implements Serializable { +public class Publisher implements Serializable { private static final long serialVersionUID = 1L; /** diff --git a/src/main/java/com/peanut/modules/book/entity/ShopProductEntity.java b/src/main/java/com/peanut/modules/book/entity/ShopProduct.java similarity index 98% rename from src/main/java/com/peanut/modules/book/entity/ShopProductEntity.java rename to src/main/java/com/peanut/modules/book/entity/ShopProduct.java index 80795766..f9633996 100644 --- a/src/main/java/com/peanut/modules/book/entity/ShopProductEntity.java +++ b/src/main/java/com/peanut/modules/book/entity/ShopProduct.java @@ -18,7 +18,7 @@ import java.util.List; */ @Data @TableName("shop_product") -public class ShopProductEntity implements Serializable { +public class ShopProduct implements Serializable { private static final long serialVersionUID = 1L; /** diff --git a/src/main/java/com/peanut/modules/book/entity/ShopProductToLabelEntity.java b/src/main/java/com/peanut/modules/book/entity/ShopProductToLabelEntity.java index 02b416e2..d6a3f8bc 100644 --- a/src/main/java/com/peanut/modules/book/entity/ShopProductToLabelEntity.java +++ b/src/main/java/com/peanut/modules/book/entity/ShopProductToLabelEntity.java @@ -28,7 +28,7 @@ public class ShopProductToLabelEntity { * 不存入数据库,返回商品详情 */ @TableField(exist = false) - private List shopProducts; + private List shopProducts; @TableField(exist = false) private List shopp; diff --git a/src/main/java/com/peanut/modules/book/service/BuyOrderService.java b/src/main/java/com/peanut/modules/book/service/BuyOrderService.java index 2d6e16b7..42031471 100644 --- a/src/main/java/com/peanut/modules/book/service/BuyOrderService.java +++ b/src/main/java/com/peanut/modules/book/service/BuyOrderService.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; import com.peanut.common.utils.PageUtils; import com.peanut.modules.book.entity.BuyOrder; +import com.peanut.modules.book.vo.UserOrderVo; import java.util.List; import java.util.Map; @@ -17,15 +18,15 @@ import java.util.Map; */ public interface BuyOrderService extends IService { - PageUtils queryPage(Map params) throws Exception; + PageUtils list(Map params) throws Exception; - PageUtils queryPage1(Map params); + PageUtils getMyOrderList(Map params); //更新订单状态 void updateOrderStatus(Integer userId, String orderSn, String type); // 查询勾选的订单是否有可合并 - List checkOrder(Integer[] orderIds); + List checkOrder(Integer[] orderIds); // 查询所有订单是否有可合并 Page checkOrder(Map params); @@ -36,7 +37,7 @@ public interface BuyOrderService extends IService { * @param expressCompanyCode 快递公司代码 * @param buyOrderDetailId 订单详情 ID 列表 */ - void createSplitPackageOrder(String expressCompanyCode, List buyOrderDetailId); + void delivery(String expressCompanyCode, List buyOrderDetailId); } \ No newline at end of file diff --git a/src/main/java/com/peanut/modules/book/service/PublisherService.java b/src/main/java/com/peanut/modules/book/service/PublisherService.java index d4c9f650..69f9c979 100644 --- a/src/main/java/com/peanut/modules/book/service/PublisherService.java +++ b/src/main/java/com/peanut/modules/book/service/PublisherService.java @@ -2,7 +2,7 @@ package com.peanut.modules.book.service; import com.baomidou.mybatisplus.extension.service.IService; import com.peanut.common.utils.PageUtils; -import com.peanut.modules.book.entity.PublisherEntity; +import com.peanut.modules.book.entity.Publisher; import java.util.Map; @@ -13,7 +13,7 @@ import java.util.Map; * @email yl328572838@163.com * @date 2022-08-04 15:36:59 */ -public interface PublisherService extends IService { +public interface PublisherService extends IService { PageUtils queryPage(Map params); } diff --git a/src/main/java/com/peanut/modules/book/service/ShopProductService.java b/src/main/java/com/peanut/modules/book/service/ShopProductService.java index b4f258ae..b5c0f82b 100644 --- a/src/main/java/com/peanut/modules/book/service/ShopProductService.java +++ b/src/main/java/com/peanut/modules/book/service/ShopProductService.java @@ -2,7 +2,7 @@ package com.peanut.modules.book.service; import com.baomidou.mybatisplus.extension.service.IService; import com.peanut.common.utils.PageUtils; -import com.peanut.modules.book.entity.ShopProductEntity; +import com.peanut.modules.book.entity.ShopProduct; import java.util.List; import java.util.Map; @@ -14,14 +14,14 @@ import java.util.Map; * @email yl328572838@163.com * @date 2022-10-28 09:43:14 */ -public interface ShopProductService extends IService { +public interface ShopProductService extends IService { PageUtils queryPage(Map params); PageUtils appQueryPage(Map params); - List appGetCategoryList(Integer catId); + List appGetCategoryList(Integer catId); PageUtils getNewBook(Map params); diff --git a/src/main/java/com/peanut/modules/book/service/impl/BookServiceImpl.java b/src/main/java/com/peanut/modules/book/service/impl/BookServiceImpl.java index dc4e0cfe..09b2914b 100644 --- a/src/main/java/com/peanut/modules/book/service/impl/BookServiceImpl.java +++ b/src/main/java/com/peanut/modules/book/service/impl/BookServiceImpl.java @@ -18,7 +18,6 @@ import com.peanut.modules.book.dao.BookDao; import com.peanut.modules.book.entity.*; import com.peanut.modules.book.entity.SysDictDataEntity; import com.peanut.modules.book.service.BookChapterService; -import com.peanut.modules.book.service.BookForumArticlesService; import com.peanut.modules.book.service.BookService; import com.peanut.modules.book.service.PublisherService; import com.peanut.modules.sys.service.SysDictDataService; @@ -110,13 +109,13 @@ public class BookServiceImpl extends ServiceImpl implements String[] publisherIds = publisherId.split(","); List authorList = Arrays.asList(authorIds); List publisherList = Arrays.asList(publisherIds); - List publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper().in("id", publisherList)); + List publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper().in("id", publisherList)); List authorEntities = authorService.getBaseMapper().selectList(new QueryWrapper().in("id", authorList)); for (AuthorEntity authorEntity : authorEntities) { authorName += "," + authorEntity.getAuthorName(); } - for (PublisherEntity publisherEntity : publisherEntities) { - publisherName += "," + publisherEntity.getPublisherName(); + for (Publisher publisher : publisherEntities) { + publisherName += "," + publisher.getPublisherName(); } authorName = authorName.startsWith(",") ? authorName.substring(1) : authorName; publisherName = publisherName.startsWith(",") ? publisherName.substring(1) : publisherName; @@ -263,9 +262,9 @@ public class BookServiceImpl extends ServiceImpl implements String publisherId = book.getPublisherId(); String[] publisherIds = publisherId.split(","); List publisherList = Arrays.asList(publisherIds); - List publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper().in("id", publisherList)); - for (PublisherEntity publisherEntity : publisherEntities) { - publisherName += "," + publisherEntity.getPublisherName(); + List publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper().in("id", publisherList)); + for (Publisher publisher : publisherEntities) { + publisherName += "," + publisher.getPublisherName(); } publisherName = publisherName.startsWith(",") ? publisherName.substring(1) : publisherName; book.setPublisherName(publisherName); @@ -309,9 +308,9 @@ public class BookServiceImpl extends ServiceImpl implements String publisherId = book.getPublisherId(); String[] publisherIds = publisherId.split(","); List publisherList = Arrays.asList(publisherIds); - List publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper().in("id", publisherList)); - for (PublisherEntity publisherEntity : publisherEntities) { - publisherName += "," + publisherEntity.getPublisherName(); + List publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper().in("id", publisherList)); + for (Publisher publisher : publisherEntities) { + publisherName += "," + publisher.getPublisherName(); } publisherName = publisherName.startsWith(",") ? publisherName.substring(1) : publisherName; book.setPublisherName(publisherName); @@ -348,10 +347,10 @@ public class BookServiceImpl extends ServiceImpl implements String publisherId = book.getPublisherId(); String[] publisherIds = publisherId.split(","); List publisherList = Arrays.asList(publisherIds); - List publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper().in("id", publisherList)); + List publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper().in("id", publisherList)); - for (PublisherEntity publisherEntity : publisherEntities) { - publisherName += "," + publisherEntity.getPublisherName(); + for (Publisher publisher : publisherEntities) { + publisherName += "," + publisher.getPublisherName(); } publisherName = publisherName.startsWith(",") ? publisherName.substring(1) : publisherName; book.setPublisherName(publisherName); @@ -561,13 +560,13 @@ public class BookServiceImpl extends ServiceImpl implements List authorList = Arrays.asList(authorIds); List publisherList = Arrays.asList(publisherIds); - List publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper().in("id", publisherList)); + List publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper().in("id", publisherList)); List authorEntities = authorService.getBaseMapper().selectList(new QueryWrapper().in("id", authorList)); for (AuthorEntity authorEntity : authorEntities) { authorName += "," + authorEntity.getAuthorName(); } - for (PublisherEntity publisherEntity : publisherEntities) { - publisherName += "," + publisherEntity.getPublisherName(); + for (Publisher publisher : publisherEntities) { + publisherName += "," + publisher.getPublisherName(); } authorName = authorName.startsWith(",") ? authorName.substring(1) : authorName; publisherName = publisherName.startsWith(",") ? publisherName.substring(1) : publisherName; diff --git a/src/main/java/com/peanut/modules/book/service/impl/BuyOrderServiceImpl.java b/src/main/java/com/peanut/modules/book/service/impl/BuyOrderServiceImpl.java index 9ada1dcd..35f3d166 100644 --- a/src/main/java/com/peanut/modules/book/service/impl/BuyOrderServiceImpl.java +++ b/src/main/java/com/peanut/modules/book/service/impl/BuyOrderServiceImpl.java @@ -8,13 +8,13 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.peanut.common.utils.ExcludeEmptyQueryWrapper; import com.peanut.common.utils.PageUtils; import com.peanut.common.utils.Query; +import com.peanut.config.Constants; import com.peanut.modules.book.dao.BuyOrderDao; import com.peanut.modules.book.entity.*; import com.peanut.modules.book.service.*; import com.peanut.modules.book.entity.ExpressCommodity; import com.peanut.modules.book.vo.ExpressOrderResponseVo; import com.peanut.modules.book.vo.UserOrderVo; -import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -22,6 +22,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.math.BigDecimal; +import java.math.RoundingMode; import java.text.SimpleDateFormat; import java.util.*; import java.util.stream.Collectors; @@ -54,7 +55,7 @@ public class BuyOrderServiceImpl extends ServiceImpl impl } @Override - public PageUtils queryPage(Map params) throws Exception { + public PageUtils list(Map params) throws Exception { IPage page; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); @@ -65,14 +66,15 @@ public class BuyOrderServiceImpl extends ServiceImpl impl endTime = sdf.format(Long.parseLong(params.get("endTime").toString())); } if (ObjectUtils.isEmpty(params.get("orderStatus"))) { - page = this.page( - new Query().getPage(params), - new ExcludeEmptyQueryWrapper().eq("user_phone", params.get("key")). - or().like("order_sn", params.get("key")).or().like("shipping_user", params.get("key")) - .apply(startTime != null, "date_format (create_time,'%Y-%m-%d') >= date_format ({0},'%Y-%m-%d')", startTime) - .apply(endTime != null, "date_format (create_time,'%Y-%m-%d') <= date_format ({0},'%Y-%m-%d')", endTime).orderByDesc("create_time") - - ); + ExcludeEmptyQueryWrapper queryWrapper = new ExcludeEmptyQueryWrapper<>(); + Query query = new Query<>(); + page = query.getPage(params); + queryWrapper.eq("user_phone", params.get("key")); + queryWrapper.or().like("order_sn", params.get("key")); + queryWrapper.or().like("shipping_user", params.get("key")); + queryWrapper.apply(startTime != null, "date_format (create_time,'%Y-%m-%d') >= date_format ({0},'%Y-%m-%d')", startTime); + queryWrapper.apply(endTime != null, "date_format (create_time,'%Y-%m-%d') <= date_format ({0},'%Y-%m-%d')", endTime).orderByDesc("create_time"); + page = this.page(page, queryWrapper); } else { page = this.page( new Query().getPage(params), @@ -84,6 +86,8 @@ public class BuyOrderServiceImpl extends ServiceImpl impl } + + List records = page.getRecords(); for (BuyOrder record : records) { Integer userId = record.getUserId(); @@ -96,50 +100,41 @@ public class BuyOrderServiceImpl extends ServiceImpl impl } - return new PageUtils(page); } + public void list1(){ + + } + @Override - public PageUtils queryPage1(Map params) { + public PageUtils getMyOrderList(Map params) { String orderStatus = (String) params.get("orderStatus"); - if (orderStatus.equals("9")) { - orderStatus = null; - } - String userId = (String) params.get("userId"); - - IPage page = this.page( - new Query().getPage(params), - new QueryWrapper() - .eq("user_id", userId) - .eq(StringUtils.isNotBlank(orderStatus), "order_status", orderStatus) - .orderByDesc("create_time") - ); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("user_id", userId); + queryWrapper.eq(orderStatus.equals(Constants.ORDER_STATUS_FAIL), "order_status", orderStatus); + queryWrapper.orderByDesc("create_time"); + Query query = new Query<>(); + IPage page = query.getPage(params); + page = this.page(page, queryWrapper); List records = page.getRecords(); - for (BuyOrder buyOrderEntity : records) { - Integer orderId = buyOrderEntity.getOrderId(); - buyOrderEntity.setTimestamp(buyOrderEntity.getCreateTime().getTime() / 1000); - List entities = buyOrderDetailService.getBaseMapper().selectList(new QueryWrapper() - .eq("order_id", orderId)); - if (entities != null) { - for (BuyOrderDetail entity : entities) { - Integer productId = entity.getProductId(); - ShopProductEntity shopPro = shopProductService.getById(productId); - if (shopPro != null) { - String productImages = shopPro.getProductImages(); - - entity.setImage(productImages); - } - - + for (BuyOrder buyOrder : records) { + Integer orderId = buyOrder.getOrderId(); + QueryWrapper buyOrderDetailQueryWrapper = new QueryWrapper<>(); + buyOrderDetailQueryWrapper.eq("order_id", orderId); + List buyOrderDetailList = buyOrderDetailService.list(buyOrderDetailQueryWrapper); + for (BuyOrderDetail buyOrderDetail : buyOrderDetailList) { + Integer productId = buyOrderDetail.getProductId(); + ShopProduct shopProduct = shopProductService.getById(productId); + if (shopProduct != null) { + String productImages = shopProduct.getProductImages(); + buyOrderDetail.setImage(productImages); } } - - buyOrderEntity.setProducts(entities); + buyOrder.setProducts(buyOrderDetailList); } - return new PageUtils(page); } @@ -175,7 +170,7 @@ public class BuyOrderServiceImpl extends ServiceImpl impl */ @Override @Transactional - public List checkOrder(Integer[] orderIds) { + public List checkOrder(Integer[] orderIds) { // 查询出所有的订单信息(携带订单商品) List orderList = new ArrayList<>(); @@ -292,7 +287,7 @@ public class BuyOrderServiceImpl extends ServiceImpl impl } @Override - public void createSplitPackageOrder(String expressCompanyCode, List buyOrderDetailId) { + public void delivery(String expressCompanyCode, List buyOrderDetailId) { QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.in("id", buyOrderDetailId); List buyOrderDetailList = buyOrderDetailService.list(queryWrapper); @@ -306,6 +301,7 @@ public class BuyOrderServiceImpl extends ServiceImpl impl totalWeight = totalWeight.add( BigDecimal.valueOf(buyOrderDetail.getWeight().doubleValue()).multiply(new BigDecimal(buyOrderDetail.getQuantity())) ); + totalWeight = totalWeight.setScale(0, RoundingMode.UP); commodityList.add(commodity); } diff --git a/src/main/java/com/peanut/modules/book/service/impl/CouponHistoryServiceImpl.java b/src/main/java/com/peanut/modules/book/service/impl/CouponHistoryServiceImpl.java index a6f3098c..5809d5a3 100644 --- a/src/main/java/com/peanut/modules/book/service/impl/CouponHistoryServiceImpl.java +++ b/src/main/java/com/peanut/modules/book/service/impl/CouponHistoryServiceImpl.java @@ -11,7 +11,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; -import java.math.BigDecimal; import java.util.*; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -21,7 +20,6 @@ import com.peanut.common.utils.PageUtils; import com.peanut.common.utils.Query; import com.peanut.modules.book.dao.CouponHistoryDao; -import org.springframework.util.ObjectUtils; @Slf4j @Service("couponHistoryService") @@ -192,7 +190,7 @@ public class CouponHistoryServiceImpl extends ServiceImpl wrapper = new QueryWrapper<>(); + QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq("order_sn", orderSn); - BuyOrderEntity buyOrder = buyOrderService.getOne(wrapper); + BuyOrder buyOrder = buyOrderService.getOne(wrapper); PayWechatOrderEntity entity = new PayWechatOrderEntity(); entity.setCustomerId(buyOrder.getUserId()); entity.setCreateTime(new Date()); diff --git a/src/main/java/com/peanut/modules/book/service/impl/PublisherServiceImpl.java b/src/main/java/com/peanut/modules/book/service/impl/PublisherServiceImpl.java index 3c2616c3..02241cb4 100644 --- a/src/main/java/com/peanut/modules/book/service/impl/PublisherServiceImpl.java +++ b/src/main/java/com/peanut/modules/book/service/impl/PublisherServiceImpl.java @@ -9,18 +9,18 @@ import com.peanut.common.utils.PageUtils; import com.peanut.common.utils.Query; import com.peanut.modules.book.dao.PublisherDao; -import com.peanut.modules.book.entity.PublisherEntity; +import com.peanut.modules.book.entity.Publisher; import com.peanut.modules.book.service.PublisherService; @Service("publisherService") -public class PublisherServiceImpl extends ServiceImpl implements PublisherService { +public class PublisherServiceImpl extends ServiceImpl implements PublisherService { @Override public PageUtils queryPage(Map params) { - IPage page = this.page( - new Query().getPage(params), - new QueryWrapper().orderByDesc("create_time") + IPage page = this.page( + new Query().getPage(params), + new QueryWrapper().orderByDesc("create_time") ); return new PageUtils(page); diff --git a/src/main/java/com/peanut/modules/book/service/impl/ShopProductBookServiceImpl.java b/src/main/java/com/peanut/modules/book/service/impl/ShopProductBookServiceImpl.java index 75e6acc9..05051706 100644 --- a/src/main/java/com/peanut/modules/book/service/impl/ShopProductBookServiceImpl.java +++ b/src/main/java/com/peanut/modules/book/service/impl/ShopProductBookServiceImpl.java @@ -8,7 +8,7 @@ import com.peanut.common.utils.PageUtils; import com.peanut.common.utils.Query; import com.peanut.modules.book.dao.ShopProductBookDao; import com.peanut.modules.book.entity.BookEntity; -import com.peanut.modules.book.entity.ShopProductEntity; +import com.peanut.modules.book.entity.ShopProduct; import com.peanut.modules.book.entity.ShopProductBookEntity; import com.peanut.modules.book.service.BookService; import com.peanut.modules.book.service.ShopProductService; @@ -56,7 +56,7 @@ public class ShopProductBookServiceImpl extends ServiceImpl getCartList(Integer productId) { - ShopProductEntity shopProductEntity = shopProductService.getBaseMapper().selectOne(new QueryWrapper().eq("product_id", productId)); + ShopProduct shopProduct = shopProductService.getBaseMapper().selectOne(new QueryWrapper().eq("product_id", productId)); List proudictBooklist = this.list(new QueryWrapper().eq("product_id", productId)); List prList = new ArrayList<>(); List prLists = new ArrayList<>(); @@ -69,11 +69,11 @@ public class ShopProductBookServiceImpl extends ServiceImpl wrapper1 = new LambdaQueryWrapper<>(); - wrapper1.eq(ShopProductEntity::getDelFlag, 0); - wrapper1.in(ShopProductEntity::getProductId, ids); - wrapper1.orderByAsc(ShopProductEntity::getPrice); + LambdaQueryWrapper wrapper1 = new LambdaQueryWrapper<>(); + wrapper1.eq(ShopProduct::getDelFlag, 0); + wrapper1.in(ShopProduct::getProductId, ids); + wrapper1.orderByAsc(ShopProduct::getPrice); wrapper1.last("limit 1"); - List shopProductEntities = shopProductService.getBaseMapper().selectList(wrapper1); - ShopProductEntity shopProductEntity = shopProductEntities.get(0); - return shopProductEntity.getProductId(); + List shopProductEntities = shopProductService.getBaseMapper().selectList(wrapper1); + ShopProduct shopProduct = shopProductEntities.get(0); + return shopProduct.getProductId(); } @Override diff --git a/src/main/java/com/peanut/modules/book/service/impl/ShopProductServiceImpl.java b/src/main/java/com/peanut/modules/book/service/impl/ShopProductServiceImpl.java index 76e2dd27..77c44940 100644 --- a/src/main/java/com/peanut/modules/book/service/impl/ShopProductServiceImpl.java +++ b/src/main/java/com/peanut/modules/book/service/impl/ShopProductServiceImpl.java @@ -10,20 +10,20 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.peanut.common.utils.PageUtils; import com.peanut.common.utils.Query; import com.peanut.modules.book.dao.ShopProductDao; -import com.peanut.modules.book.entity.ShopProductEntity; +import com.peanut.modules.book.entity.ShopProduct; import com.peanut.modules.book.service.ShopProductService; @Service("shopProductService") -public class ShopProductServiceImpl extends ServiceImpl implements ShopProductService { +public class ShopProductServiceImpl extends ServiceImpl implements ShopProductService { @Override public PageUtils queryPage(Map params) { String userid = (String) params.get("userid"); - IPage page = this.page( - new Query().getPage(params), - new ExcludeEmptyQueryWrapper().like("product_name", params.get("key")) + IPage page = this.page( + new Query().getPage(params), + new ExcludeEmptyQueryWrapper().like("product_name", params.get("key")) .notLike("book_ids",",").orderByDesc("sum_sales").eq("del_flag",0) ); return new PageUtils(page); @@ -31,25 +31,25 @@ public class ShopProductServiceImpl extends ServiceImpl params) { - IPage page = this.page( - new Query().getPage(params), - new QueryWrapper().orderByDesc("create_time") + IPage page = this.page( + new Query().getPage(params), + new QueryWrapper().orderByDesc("create_time") .like("product_name", params.get("key")) ); return new PageUtils(page); } @Override - public List appGetCategoryList(Integer catId) { - List list = this.getBaseMapper().appGetCategoryList(catId); + public List appGetCategoryList(Integer catId) { + List list = this.getBaseMapper().appGetCategoryList(catId); return list; } @Override public PageUtils getNewBook(Map params) { - IPage page = this.page( - new Query().getPage(params), - new QueryWrapper().eq("is_new",1).orderByDesc("create_time") + IPage page = this.page( + new Query().getPage(params), + new QueryWrapper().eq("is_new",1).orderByDesc("create_time") ); return new PageUtils(page); } @@ -57,9 +57,9 @@ public class ShopProductServiceImpl extends ServiceImpl params) { Object name = params.get("name"); - IPage page = this.page( - new Query().getPage(params), - new ExcludeEmptyQueryWrapper().like("product_name", params.get("key")) + IPage page = this.page( + new Query().getPage(params), + new ExcludeEmptyQueryWrapper().like("product_name", params.get("key")) ); return new PageUtils(page); } @@ -67,18 +67,18 @@ public class ShopProductServiceImpl extends ServiceImpl params) { - IPage page = this.page( - new Query().getPage(params), - new QueryWrapper().orderByDesc("sum_sales") + IPage page = this.page( + new Query().getPage(params), + new QueryWrapper().orderByDesc("sum_sales") ); return new PageUtils(page); } @Override public PageUtils queryPageactivityprice(Map params) { - IPage page = this.page( - new Query().getPage(params), - new QueryWrapper().ne("activity_price", "").ne("activity_price", 0) + IPage page = this.page( + new Query().getPage(params), + new QueryWrapper().ne("activity_price", "").ne("activity_price", 0) ); return new PageUtils(page); } diff --git a/src/main/java/com/peanut/modules/book/service/impl/ShopProductToLabelServiceImpl.java b/src/main/java/com/peanut/modules/book/service/impl/ShopProductToLabelServiceImpl.java index afd2941f..e22e0454 100644 --- a/src/main/java/com/peanut/modules/book/service/impl/ShopProductToLabelServiceImpl.java +++ b/src/main/java/com/peanut/modules/book/service/impl/ShopProductToLabelServiceImpl.java @@ -7,7 +7,7 @@ import com.peanut.common.utils.ExcludeEmptyQueryWrapper; import com.peanut.common.utils.PageUtils; import com.peanut.common.utils.Query; import com.peanut.modules.book.dao.ShopProductToLabelDao; -import com.peanut.modules.book.entity.ShopProductEntity; +import com.peanut.modules.book.entity.ShopProduct; import com.peanut.modules.book.entity.ShopProductToLabelEntity; import com.peanut.modules.book.service.ShopProductService; import com.peanut.modules.book.service.ShopProductToLabelService; @@ -45,7 +45,7 @@ public class ShopProductToLabelServiceImpl extends ServiceImpl ShopProduct = shopProductService.getBaseMapper().selectList(new QueryWrapper() + List ShopProduct = shopProductService.getBaseMapper().selectList(new QueryWrapper() .eq("del_flag", 0) .eq("product_id",ptlId) ); diff --git a/src/main/java/com/peanut/modules/book/service/impl/ShopSeckillServiceImpl.java b/src/main/java/com/peanut/modules/book/service/impl/ShopSeckillServiceImpl.java index 3547bae4..f084aab4 100644 --- a/src/main/java/com/peanut/modules/book/service/impl/ShopSeckillServiceImpl.java +++ b/src/main/java/com/peanut/modules/book/service/impl/ShopSeckillServiceImpl.java @@ -3,14 +3,12 @@ package com.peanut.modules.book.service.impl; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.TypeReference; import com.baomidou.mybatisplus.core.toolkit.IdWorker; -import com.peanut.common.utils.R; import com.peanut.modules.book.entity.SeckillProdRelationEntity; -import com.peanut.modules.book.entity.ShopProductEntity; +import com.peanut.modules.book.entity.ShopProduct; import com.peanut.modules.book.service.SeckillProdRelationService; import com.peanut.modules.book.service.ShopProductService; import com.peanut.modules.book.to.SeckillRedisTo; import com.peanut.modules.book.vo.ProdInfoVo; -import com.peanut.modules.book.vo.SeckillProdVo; import com.peanut.modules.book.vo.SeckillSessionWithProdVo; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang.StringUtils; @@ -20,10 +18,8 @@ import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.BoundHashOperations; import org.springframework.data.redis.core.StringRedisTemplate; -import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Service; -import java.text.SimpleDateFormat; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime; @@ -215,7 +211,7 @@ public class ShopSeckillServiceImpl extends ServiceImpl() { }); seckillRedisTo.setProdInfo(prodInfoVo); diff --git a/src/main/java/com/peanut/modules/book/vo/request/BuyOrderListRequestVo.java b/src/main/java/com/peanut/modules/book/vo/request/BuyOrderListRequestVo.java new file mode 100644 index 00000000..89346e84 --- /dev/null +++ b/src/main/java/com/peanut/modules/book/vo/request/BuyOrderListRequestVo.java @@ -0,0 +1,38 @@ +package com.peanut.modules.book.vo.request; + +import lombok.Data; + +import java.util.Date; + +/** + * @Description: 订单列表查询 Value Object + * @Author: Cauchy + * @CreateTime: 2023/10/19 + */ +@Data +public class BuyOrderListRequestVo { + /** + * 页号 + */ + private Integer pageIndex; + /** + * 页大小 + */ + private Integer pageSize; + /** + * 搜索关键词 + */ + private String searchKeyWord; + /** + * 开始时间 + */ + private Date startTime; + /** + * 结束时间 + */ + private Date endTime; + /** + * 订单状态 + */ + private Integer orderStatus; +} diff --git a/src/main/java/com/peanut/modules/book/vo/request/ExpressOrderRequestVo.java b/src/main/java/com/peanut/modules/book/vo/request/ExpressOrderRequestVo.java index f0289d91..1040432e 100644 --- a/src/main/java/com/peanut/modules/book/vo/request/ExpressOrderRequestVo.java +++ b/src/main/java/com/peanut/modules/book/vo/request/ExpressOrderRequestVo.java @@ -74,5 +74,13 @@ public class ExpressOrderRequestVo { * 是否返回电子面单模板 */ private Integer IsReturnPrintTemplate; + /** + * 快递客户号 + */ + private String CustomerName; + /** + * 快递客户密码 + */ + private String CustomerPwd; } diff --git a/src/main/java/com/peanut/modules/book/vo/request/ProductTransportVo.java b/src/main/java/com/peanut/modules/book/vo/request/ProductTransportVo.java index 51e4640e..f41290a6 100644 --- a/src/main/java/com/peanut/modules/book/vo/request/ProductTransportVo.java +++ b/src/main/java/com/peanut/modules/book/vo/request/ProductTransportVo.java @@ -1,10 +1,8 @@ package com.peanut.modules.book.vo.request; -import com.peanut.modules.book.entity.ShopProductEntity; import lombok.Data; import java.util.List; -import java.util.Map; /** * @Description: 计算运费 diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index b544078a..038b687d 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -3,9 +3,9 @@ spring: redis: open: false # 是否开启redis缓存 true开启 false关闭 database: 0 - host: 39.106.36.183 + host: 127.0.0.1 port: 6379 - password: Jgll2015 # 密码(默认为空) +# password: Jgll2015 # 密码(默认为空) timeout: 6000000ms # 连接超时时长(毫秒) jedis: pool: diff --git a/src/main/resources/mapper/book/PublisherDao.xml b/src/main/resources/mapper/book/PublisherDao.xml index 71fd4fb4..46a63444 100644 --- a/src/main/resources/mapper/book/PublisherDao.xml +++ b/src/main/resources/mapper/book/PublisherDao.xml @@ -4,7 +4,7 @@ - + diff --git a/src/main/resources/mapper/book/ShopProductDao.xml b/src/main/resources/mapper/book/ShopProductDao.xml index eefe232d..41e5d277 100644 --- a/src/main/resources/mapper/book/ShopProductDao.xml +++ b/src/main/resources/mapper/book/ShopProductDao.xml @@ -4,7 +4,7 @@ - + @@ -36,7 +36,7 @@ - SELECT * FROM