refactor project

This commit is contained in:
Cauchy
2023-10-19 15:04:31 +08:00
parent 19a2ef58a9
commit 1994ba60ae
35 changed files with 274 additions and 226 deletions

View File

@@ -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";
}

View File

@@ -93,7 +93,7 @@ public class BookController {
wrapper.eq(ShopProductToLabelEntity::getDelFlag,0);
List<Integer> pIds = shopProductToLabelService.getBaseMapper().selectList(wrapper).stream().map(ShopProductToLabelEntity::getProductId).collect(Collectors.toList());
List<ShopProductEntity> shopProductEntities = shopProductService.getBaseMapper().selectList(new LambdaQueryWrapper<ShopProductEntity>().in(ShopProductEntity::getProductId, pIds));
List<ShopProduct> shopProductEntities = shopProductService.getBaseMapper().selectList(new LambdaQueryWrapper<ShopProduct>().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<String> publisherList = Arrays.asList(publisherIds);
List<PublisherEntity> publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper<PublisherEntity>().in("id", publisherList));
List<Publisher> publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper<Publisher>().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<String> publisherList = Arrays.asList(publisherIds);
List<PublisherEntity> publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper<PublisherEntity>().in("id", publisherList));
List<Publisher> publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper<Publisher>().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<String> publisherList = Arrays.asList(publisherIds);
List<PublisherEntity> publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper<PublisherEntity>().in("id", publisherList));
List<Publisher> publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper<Publisher>().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<String> publisherList = Arrays.asList(publisherIds);
List<PublisherEntity> publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper<PublisherEntity>().in("id", publisherList));
List<Publisher> publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper<Publisher>().in("id", publisherList));
for (PublisherEntity publisherEntity : publisherEntities) {
publisherName += "," + publisherEntity.getPublisherName();
for (Publisher publisher : publisherEntities) {
publisherName += "," + publisher.getPublisherName();
}
publisherName = publisherName.startsWith(",") ? publisherName.substring(1) : publisherName;

View File

@@ -377,10 +377,10 @@ public class BookForumArticlesServiceController {
String publisherId = bookentity.getPublisherId();
String[] publisherIds = publisherId.split(",");
List<String> publisherList = Arrays.asList(publisherIds);
List<PublisherEntity> publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper<PublisherEntity>().in("id", publisherList));
List<Publisher> publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper<Publisher>().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));

View File

@@ -79,15 +79,15 @@ public class BuyOrderController {
private SysConfigService sysConfigService;
/**
* 列表
* 订单列表
*
* @param params
* @return
* @throws Exception
*/
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> 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<ProductRequestVo> 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<String, Object> 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<BuyOrderDetail> 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,
@RequestMapping(value = "/delivery", method = RequestMethod.POST)
public R delivery(@RequestParam("expressCompanyCode") String expressCompanyCode,
@RequestBody List<Integer> buyOrderDetailId) throws Exception {
buyOrderService.createSplitPackageOrder(expressCompanyCode, buyOrderDetailId);
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;

View File

@@ -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<PublisherEntity> publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper<PublisherEntity>());
List<Publisher> publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper<Publisher>());
ArrayList<Object> list = new ArrayList<>();
for (PublisherEntity publisherEntitie : publisherEntities) {
for (Publisher publisherEntitie : publisherEntities) {
HashMap<Object, Object> 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<String, Object> 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();
}

View File

@@ -111,7 +111,7 @@ public class ShopProductController {
purchasedProductIds.add(String.valueOf(buyOrderDetail.getProductId()));
}
//查询商品表并过滤已购买商品id,根据时间倒叙展示
List<ShopProductEntity> allProductEntities = shopProductService.getBaseMapper().selectList(new QueryWrapper<ShopProductEntity>()
List<ShopProduct> allProductEntities = shopProductService.getBaseMapper().selectList(new QueryWrapper<ShopProduct>()
.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<String, Object> productMap = new HashMap<>();
productMap.put("product", product);
lists.add(productMap);
@@ -137,19 +137,19 @@ public class ShopProductController {
List<ShopProductBookEntity> bookEntityList = shopProductBookService.getBaseMapper().selectList(new QueryWrapper<ShopProductBookEntity>().eq("book_id", productId));
List<Object> list = new ArrayList<>();
ArrayList<String> booklist = new ArrayList<>();
ShopProductEntity shopProductEntity = null;
ShopProduct shopProduct = null;
for (ShopProductBookEntity shopProductBookEntity : bookEntityList) {
Integer proudictId = shopProductBookEntity.getProductId();
shopProductEntity = shopProductService.getBaseMapper().selectOne(new QueryWrapper<ShopProductEntity>().eq("product_id", proudictId));
shopProduct = shopProductService.getBaseMapper().selectOne(new QueryWrapper<ShopProduct>().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<ShopProductEntity>().eq("product_id", productId));
ShopProduct shopProduct = shopProductService.getBaseMapper().selectOne(new QueryWrapper<ShopProduct>().eq("product_id", productId));
ArrayList<Map<String, String>> imagesUrl = new ArrayList<Map<String, String>>();
//分类
Integer poid = shopProductEntity.getProductPid();
Integer poid = shopProduct.getProductPid();
//商品id
Integer productId1 = shopProductEntity.getProductId();
Integer productId1 = shopProduct.getProductId();
//分类信息
List<Integer> poids = shopCategoryService.findPoid(poid);
List<ShopProductBookEntity> product = shopProductBookService.getBaseMapper().selectList(new QueryWrapper<ShopProductBookEntity>()
.eq("product_id", productId1));
List<ShopProductEntity> result = new ArrayList<>();
List<ShopProduct> result = new ArrayList<>();
//获取商品id
Set<Integer> 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<ShopProductBookEntity> pbookEntitys = shopProductBookService.getBaseMapper().selectList(new QueryWrapper<ShopProductBookEntity>()
.eq("product_id", pId));
@@ -224,13 +224,13 @@ public class ShopProductController {
.having("count(product_id) >=" + ids.size())
);
List<ShopProductEntity> frag = new ArrayList<>();
List<ShopProduct> 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<ShopProductEntity>().eq("product_id", productId).eq("del_flag", 0));
if (shopProductEntity == null) {
ShopProduct shopProduct = shopProductService.getBaseMapper().selectOne(new QueryWrapper<ShopProduct>().eq("product_id", productId).eq("del_flag", 0));
if (shopProduct == null) {
return R.error("该商品已下架,看看其他商品吧");
}
ArrayList<Map<String, String>> imagesUrl = new ArrayList<Map<String, String>>();
Integer poid = shopProductEntity.getProductPid();
Integer productId1 = shopProductEntity.getProductId();
Integer poid = shopProduct.getProductPid();
Integer productId1 = shopProduct.getProductId();
List<Integer> poids = shopCategoryService.findPoid(poid);
shopProductEntity.setPoids(poids);
shopProduct.setPoids(poids);
List<Object> list = new ArrayList<>();
List<Object> bookIdlist = new ArrayList<>();
ArrayList<String> 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<ShopProductEntity> shopProductEntities = shopProductService.getBaseMapper().selectList(new QueryWrapper<ShopProductEntity>()
List<ShopProduct> shopProductEntities = shopProductService.getBaseMapper().selectList(new QueryWrapper<ShopProduct>()
.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<ShopProductEntity> list = shopProductService.appGetCategoryList(catId);
List<ShopProduct> list = shopProductService.appGetCategoryList(catId);
return R.ok().put("list", list);
}
@@ -467,7 +467,7 @@ public class ShopProductController {
*/
@RequestMapping("/prodSearch")
public R prodSearch() {
List<ShopProductEntity> list = shopProductService.list(new QueryWrapper<ShopProductEntity>().select("product_id,product_name"));
List<ShopProduct> list = shopProductService.list(new QueryWrapper<ShopProduct>().select("product_id,product_name"));
List<ShopProductVo> 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<String, Object> params) {
String productName = (String) params.get("productName");
List<ShopProductEntity> list = shopProductService.list(new QueryWrapper<ShopProductEntity>()
List<ShopProduct> list = shopProductService.list(new QueryWrapper<ShopProduct>()
.like("product_name", productName));
return R.ok().put("list", list);
}

View File

@@ -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<ShopProductToLabelEntity> shopProductEntityMPJLambdaWrapper = new MPJLambdaWrapper<ShopProductToLabelEntity>();
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<ShopProductEntity> shopProductEntityPage = shopProductToLabelDao.selectJoinPage(new Page<ShopProductEntity>(page, limit), ShopProductEntity.class, shopProductEntityMPJLambdaWrapper);
shopProductEntityMPJLambdaWrapper.eq(ShopProduct::getDelFlag,0);
Page<ShopProduct> shopProductEntityPage = shopProductToLabelDao.selectJoinPage(new Page<ShopProduct>(page, limit), ShopProduct.class, shopProductEntityMPJLambdaWrapper);
return R.ok().put("page",shopProductEntityPage);
}

View File

@@ -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<PublisherEntity> {
public interface PublisherDao extends BaseMapper<Publisher> {
}

View File

@@ -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<ShopProductEntity> {
public interface ShopProductDao extends BaseMapper<ShopProduct> {
List<ShopProductEntity> appGetCategoryList(Integer catId);
List<ShopProduct> appGetCategoryList(Integer catId);
int getTotalWeight(List<Integer> productIdList);

View File

@@ -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;

View File

@@ -24,7 +24,7 @@ public class BuyOrder implements Serializable {
@TableId
private Integer orderId;
/**
* 订单编号 yyyymmddnnnnnnnn
* 订单编号
*/
private String orderSn;
/**

View File

@@ -19,10 +19,6 @@ public class ExpressOrder {
* ID
*/
private int id;
/**
* 用户 ID
*/
private int userId;
/**
* 省份
*/

View File

@@ -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;
/**

View File

@@ -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;
/**

View File

@@ -28,7 +28,7 @@ public class ShopProductToLabelEntity {
* 不存入数据库,返回商品详情
*/
@TableField(exist = false)
private List<ShopProductEntity> shopProducts;
private List<ShopProduct> shopProducts;
@TableField(exist = false)
private List<Object> shopp;

View File

@@ -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<BuyOrder> {
PageUtils queryPage(Map<String, Object> params) throws Exception;
PageUtils list(Map<String, Object> params) throws Exception;
PageUtils queryPage1(Map<String, Object> params);
PageUtils getMyOrderList(Map<String, Object> params);
//更新订单状态
void updateOrderStatus(Integer userId, String orderSn, String type);
// 查询勾选的订单是否有可合并
List checkOrder(Integer[] orderIds);
List<UserOrderVo> checkOrder(Integer[] orderIds);
// 查询所有订单是否有可合并
Page checkOrder(Map<String, Object> params);
@@ -36,7 +37,7 @@ public interface BuyOrderService extends IService<BuyOrder> {
* @param expressCompanyCode 快递公司代码
* @param buyOrderDetailId 订单详情 ID 列表
*/
void createSplitPackageOrder(String expressCompanyCode, List<Integer> buyOrderDetailId);
void delivery(String expressCompanyCode, List<Integer> buyOrderDetailId);
}

View File

@@ -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<PublisherEntity> {
public interface PublisherService extends IService<Publisher> {
PageUtils queryPage(Map<String, Object> params);
}

View File

@@ -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<ShopProductEntity> {
public interface ShopProductService extends IService<ShopProduct> {
PageUtils queryPage(Map<String, Object> params);
PageUtils appQueryPage(Map<String, Object> params);
List<ShopProductEntity> appGetCategoryList(Integer catId);
List<ShopProduct> appGetCategoryList(Integer catId);
PageUtils getNewBook(Map<String, Object> params);

View File

@@ -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<BookDao, BookEntity> implements
String[] publisherIds = publisherId.split(",");
List<String> authorList = Arrays.asList(authorIds);
List<String> publisherList = Arrays.asList(publisherIds);
List<PublisherEntity> publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper<PublisherEntity>().in("id", publisherList));
List<Publisher> publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper<Publisher>().in("id", publisherList));
List<AuthorEntity> authorEntities = authorService.getBaseMapper().selectList(new QueryWrapper<AuthorEntity>().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<BookDao, BookEntity> implements
String publisherId = book.getPublisherId();
String[] publisherIds = publisherId.split(",");
List<String> publisherList = Arrays.asList(publisherIds);
List<PublisherEntity> publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper<PublisherEntity>().in("id", publisherList));
for (PublisherEntity publisherEntity : publisherEntities) {
publisherName += "," + publisherEntity.getPublisherName();
List<Publisher> publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper<Publisher>().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<BookDao, BookEntity> implements
String publisherId = book.getPublisherId();
String[] publisherIds = publisherId.split(",");
List<String> publisherList = Arrays.asList(publisherIds);
List<PublisherEntity> publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper<PublisherEntity>().in("id", publisherList));
for (PublisherEntity publisherEntity : publisherEntities) {
publisherName += "," + publisherEntity.getPublisherName();
List<Publisher> publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper<Publisher>().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<BookDao, BookEntity> implements
String publisherId = book.getPublisherId();
String[] publisherIds = publisherId.split(",");
List<String> publisherList = Arrays.asList(publisherIds);
List<PublisherEntity> publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper<PublisherEntity>().in("id", publisherList));
List<Publisher> publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper<Publisher>().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<BookDao, BookEntity> implements
List<String> authorList = Arrays.asList(authorIds);
List<String> publisherList = Arrays.asList(publisherIds);
List<PublisherEntity> publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper<PublisherEntity>().in("id", publisherList));
List<Publisher> publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper<Publisher>().in("id", publisherList));
List<AuthorEntity> authorEntities = authorService.getBaseMapper().selectList(new QueryWrapper<AuthorEntity>().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;

View File

@@ -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<BuyOrderDao, BuyOrder> impl
}
@Override
public PageUtils queryPage(Map<String, Object> params) throws Exception {
public PageUtils list(Map<String, Object> params) throws Exception {
IPage<BuyOrder> page;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
@@ -65,14 +66,15 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
endTime = sdf.format(Long.parseLong(params.get("endTime").toString()));
}
if (ObjectUtils.isEmpty(params.get("orderStatus"))) {
page = this.page(
new Query<BuyOrder>().getPage(params),
new ExcludeEmptyQueryWrapper<BuyOrder>().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<BuyOrder> queryWrapper = new ExcludeEmptyQueryWrapper<>();
Query<BuyOrder> 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<BuyOrder>().getPage(params),
@@ -84,6 +86,8 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
}
List<BuyOrder> records = page.getRecords();
for (BuyOrder record : records) {
Integer userId = record.getUserId();
@@ -96,50 +100,41 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
}
return new PageUtils(page);
}
public void list1(){
}
@Override
public PageUtils queryPage1(Map<String, Object> params) {
public PageUtils getMyOrderList(Map<String, Object> params) {
String orderStatus = (String) params.get("orderStatus");
if (orderStatus.equals("9")) {
orderStatus = null;
}
String userId = (String) params.get("userId");
IPage<BuyOrder> page = this.page(
new Query<BuyOrder>().getPage(params),
new QueryWrapper<BuyOrder>()
.eq("user_id", userId)
.eq(StringUtils.isNotBlank(orderStatus), "order_status", orderStatus)
.orderByDesc("create_time")
);
QueryWrapper<BuyOrder> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("user_id", userId);
queryWrapper.eq(orderStatus.equals(Constants.ORDER_STATUS_FAIL), "order_status", orderStatus);
queryWrapper.orderByDesc("create_time");
Query<BuyOrder> query = new Query<>();
IPage<BuyOrder> page = query.getPage(params);
page = this.page(page, queryWrapper);
List<BuyOrder> records = page.getRecords();
for (BuyOrder buyOrderEntity : records) {
Integer orderId = buyOrderEntity.getOrderId();
buyOrderEntity.setTimestamp(buyOrderEntity.getCreateTime().getTime() / 1000);
List<BuyOrderDetail> entities = buyOrderDetailService.getBaseMapper().selectList(new QueryWrapper<BuyOrderDetail>()
.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<BuyOrderDetail> buyOrderDetailQueryWrapper = new QueryWrapper<>();
buyOrderDetailQueryWrapper.eq("order_id", orderId);
List<BuyOrderDetail> 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<BuyOrderDao, BuyOrder> impl
*/
@Override
@Transactional
public List checkOrder(Integer[] orderIds) {
public List<UserOrderVo> checkOrder(Integer[] orderIds) {
// 查询出所有的订单信息(携带订单商品)
List<BuyOrder> orderList = new ArrayList<>();
@@ -292,7 +287,7 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
}
@Override
public void createSplitPackageOrder(String expressCompanyCode, List<Integer> buyOrderDetailId) {
public void delivery(String expressCompanyCode, List<Integer> buyOrderDetailId) {
QueryWrapper<BuyOrderDetail> queryWrapper = new QueryWrapper<>();
queryWrapper.in("id", buyOrderDetailId);
List<BuyOrderDetail> buyOrderDetailList = buyOrderDetailService.list(queryWrapper);
@@ -306,6 +301,7 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
totalWeight = totalWeight.add(
BigDecimal.valueOf(buyOrderDetail.getWeight().doubleValue()).multiply(new BigDecimal(buyOrderDetail.getQuantity()))
);
totalWeight = totalWeight.setScale(0, RoundingMode.UP);
commodityList.add(commodity);
}

View File

@@ -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<CouponHistoryDao, Coup
for (String s : split) {
// 多商品的 判断商品 是否为同一个分类 下
ShopProductEntity spe = shopProductService.getById(Integer.parseInt(s));
ShopProduct spe = shopProductService.getById(Integer.parseInt(s));
Integer productPid = spe.getProductPid();
Long productCategoryId = couponProductCategoryRelationEntity.getProductCategoryId();
if (productCategoryId.intValue() == productPid) {

View File

@@ -47,10 +47,13 @@ public class ExpressOrderServiceImpl extends ServiceImpl<ExpressOrderDao, Expres
orderRequestVo.setIsReturnPrintTemplate(1);
orderRequestVo.setShipperCode(expressOrder.getExpressCompanyCode());
orderRequestVo.setPayType(3);
if (expressOrder.getExpressCompanyCode().equals("SF")) {
if (expressOrder.getExpressCompanyCode().equals(Constants.EXPRESS_COMPANY_CODE_SF)) {
orderRequestVo.setMonthCode(Constants.EXPRESS_SF_MONTH_CODE);
}
if (expressOrder.getExpressCompanyCode().equals(Constants.EXPRESS_COMPANY_CODE_YD)) {
orderRequestVo.setCustomerName(Constants.EXPRESS_YD_CUSTOMER_NAME);
orderRequestVo.setCustomerPwd(Constants.EXPRESS_YD_CUSTOMER_PWD);
}
orderRequestVo.setExpType(1);
orderRequestVo.setCost(expressOrder.getExpressFee().doubleValue());
// 发货人
@@ -67,6 +70,7 @@ public class ExpressOrderServiceImpl extends ServiceImpl<ExpressOrderDao, Expres
receiver.setMobile(expressOrder.getMobile());
receiver.setProvinceName(expressOrder.getProvince());
receiver.setCityName(expressOrder.getCity());
receiver.setExpAreaName(expressOrder.getCounty());
receiver.setAddress(expressOrder.getAddress());
orderRequestVo.setSender(sender);
orderRequestVo.setReceiver(receiver);

View File

@@ -1,7 +1,6 @@
package com.peanut.modules.book.service.impl;
import com.peanut.common.utils.R;
import com.peanut.modules.book.entity.ShopProductEntity;
import com.peanut.modules.book.entity.ShopProduct;
import com.peanut.modules.book.service.ShopProductService;
import com.peanut.modules.book.vo.ShopCartVo;
import org.springframework.beans.BeanUtils;
@@ -51,7 +50,7 @@ public class OrderCartServiceImpl extends ServiceImpl<OrderCartDao, OrderCartEnt
Integer productId = orderCartEntity.getProductId();
ShopProductEntity productEntity = shopProductService.getById(productId);
ShopProduct productEntity = shopProductService.getById(productId);
System.out.println("productEntity=============================="+productEntity);
// if (productEntity == null) {
// return null;

View File

@@ -52,9 +52,9 @@ public class PayWechatOrderServiceImpl extends ServiceImpl<PayWechatOrderDao, Pa
@Override
public void addForPoint(String orderSn, String prepayId, Integer buyOrderId) {
QueryWrapper<BuyOrderEntity> wrapper = new QueryWrapper<>();
QueryWrapper<BuyOrder> 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());

View File

@@ -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<PublisherDao, PublisherEntity> implements PublisherService {
public class PublisherServiceImpl extends ServiceImpl<PublisherDao, Publisher> implements PublisherService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<PublisherEntity> page = this.page(
new Query<PublisherEntity>().getPage(params),
new QueryWrapper<PublisherEntity>().orderByDesc("create_time")
IPage<Publisher> page = this.page(
new Query<Publisher>().getPage(params),
new QueryWrapper<Publisher>().orderByDesc("create_time")
);
return new PageUtils(page);

View File

@@ -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<ShopProductBookDao,
public List<ProductBookQueryVO> getCartList(Integer productId) {
ShopProductEntity shopProductEntity = shopProductService.getBaseMapper().selectOne(new QueryWrapper<ShopProductEntity>().eq("product_id", productId));
ShopProduct shopProduct = shopProductService.getBaseMapper().selectOne(new QueryWrapper<ShopProduct>().eq("product_id", productId));
List<ShopProductBookEntity> proudictBooklist = this.list(new QueryWrapper<ShopProductBookEntity>().eq("product_id", productId));
List prList = new ArrayList<>();
List prLists = new ArrayList<>();
@@ -69,11 +69,11 @@ public class ShopProductBookServiceImpl extends ServiceImpl<ShopProductBookDao,
Integer bookId1 = shopProudictBook.getBookId();
BookEntity bookbyId = bookService.getById(bookId1);
prList.add(bookbyId);
ShopProductEntity shopProductbyId = shopProductService.getById(proudictId1);
ShopProduct shopProductbyId = shopProductService.getById(proudictId1);
shopProductbyId.setBookidsimages(prList);
}
}
shopProductEntity.setBookidsimages(prList);
shopProduct.setBookidsimages(prList);
return prLists;
}
@@ -102,14 +102,14 @@ public class ShopProductBookServiceImpl extends ServiceImpl<ShopProductBookDao,
return null;
}
LambdaQueryWrapper<ShopProductEntity> wrapper1 = new LambdaQueryWrapper<>();
wrapper1.eq(ShopProductEntity::getDelFlag, 0);
wrapper1.in(ShopProductEntity::getProductId, ids);
wrapper1.orderByAsc(ShopProductEntity::getPrice);
LambdaQueryWrapper<ShopProduct> wrapper1 = new LambdaQueryWrapper<>();
wrapper1.eq(ShopProduct::getDelFlag, 0);
wrapper1.in(ShopProduct::getProductId, ids);
wrapper1.orderByAsc(ShopProduct::getPrice);
wrapper1.last("limit 1");
List<ShopProductEntity> shopProductEntities = shopProductService.getBaseMapper().selectList(wrapper1);
ShopProductEntity shopProductEntity = shopProductEntities.get(0);
return shopProductEntity.getProductId();
List<ShopProduct> shopProductEntities = shopProductService.getBaseMapper().selectList(wrapper1);
ShopProduct shopProduct = shopProductEntities.get(0);
return shopProduct.getProductId();
}
@Override

View File

@@ -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<ShopProductDao, ShopProductEntity> implements ShopProductService {
public class ShopProductServiceImpl extends ServiceImpl<ShopProductDao, ShopProduct> implements ShopProductService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
String userid = (String) params.get("userid");
IPage<ShopProductEntity> page = this.page(
new Query<ShopProductEntity>().getPage(params),
new ExcludeEmptyQueryWrapper<ShopProductEntity>().like("product_name", params.get("key"))
IPage<ShopProduct> page = this.page(
new Query<ShopProduct>().getPage(params),
new ExcludeEmptyQueryWrapper<ShopProduct>().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<ShopProductDao, ShopProd
@Override
public PageUtils appQueryPage(Map<String, Object> params) {
IPage<ShopProductEntity> page = this.page(
new Query<ShopProductEntity>().getPage(params),
new QueryWrapper<ShopProductEntity>().orderByDesc("create_time")
IPage<ShopProduct> page = this.page(
new Query<ShopProduct>().getPage(params),
new QueryWrapper<ShopProduct>().orderByDesc("create_time")
.like("product_name", params.get("key"))
);
return new PageUtils(page);
}
@Override
public List<ShopProductEntity> appGetCategoryList(Integer catId) {
List<ShopProductEntity> list = this.getBaseMapper().appGetCategoryList(catId);
public List<ShopProduct> appGetCategoryList(Integer catId) {
List<ShopProduct> list = this.getBaseMapper().appGetCategoryList(catId);
return list;
}
@Override
public PageUtils getNewBook(Map<String, Object> params) {
IPage<ShopProductEntity> page = this.page(
new Query<ShopProductEntity>().getPage(params),
new QueryWrapper<ShopProductEntity>().eq("is_new",1).orderByDesc("create_time")
IPage<ShopProduct> page = this.page(
new Query<ShopProduct>().getPage(params),
new QueryWrapper<ShopProduct>().eq("is_new",1).orderByDesc("create_time")
);
return new PageUtils(page);
}
@@ -57,9 +57,9 @@ public class ShopProductServiceImpl extends ServiceImpl<ShopProductDao, ShopProd
@Override
public PageUtils selectListqueryPage(Map<String, Object> params) {
Object name = params.get("name");
IPage<ShopProductEntity> page = this.page(
new Query<ShopProductEntity>().getPage(params),
new ExcludeEmptyQueryWrapper<ShopProductEntity>().like("product_name", params.get("key"))
IPage<ShopProduct> page = this.page(
new Query<ShopProduct>().getPage(params),
new ExcludeEmptyQueryWrapper<ShopProduct>().like("product_name", params.get("key"))
);
return new PageUtils(page);
}
@@ -67,18 +67,18 @@ public class ShopProductServiceImpl extends ServiceImpl<ShopProductDao, ShopProd
@Override
public PageUtils queryPageproductSales(Map<String, Object> params) {
IPage<ShopProductEntity> page = this.page(
new Query<ShopProductEntity>().getPage(params),
new QueryWrapper<ShopProductEntity>().orderByDesc("sum_sales")
IPage<ShopProduct> page = this.page(
new Query<ShopProduct>().getPage(params),
new QueryWrapper<ShopProduct>().orderByDesc("sum_sales")
);
return new PageUtils(page);
}
@Override
public PageUtils queryPageactivityprice(Map<String, Object> params) {
IPage<ShopProductEntity> page = this.page(
new Query<ShopProductEntity>().getPage(params),
new QueryWrapper<ShopProductEntity>().ne("activity_price", "").ne("activity_price", 0)
IPage<ShopProduct> page = this.page(
new Query<ShopProduct>().getPage(params),
new QueryWrapper<ShopProduct>().ne("activity_price", "").ne("activity_price", 0)
);
return new PageUtils(page);
}

View File

@@ -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<ShopProductToLabe
Integer ptlId = shopProductToLabelEntity.getProductId();
//找到对应的商品信息放在Tolable空字段中进行返回
List<ShopProductEntity> ShopProduct = shopProductService.getBaseMapper().selectList(new QueryWrapper<ShopProductEntity>()
List<ShopProduct> ShopProduct = shopProductService.getBaseMapper().selectList(new QueryWrapper<com.peanut.modules.book.entity.ShopProduct>()
.eq("del_flag", 0)
.eq("product_id",ptlId)
);

View File

@@ -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<ShopSeckillDao, ShopSeck
if (!ops.hasKey(seckilProd.getPromotionSeckillId().toString() + "_" + seckilProd.getProdId().toString())) {
SeckillRedisTo seckillRedisTo = new SeckillRedisTo();
ShopProductEntity productEntity = shopProductService.getById(seckilProd.getProdId());
ShopProduct productEntity = shopProductService.getById(seckilProd.getProdId());
ProdInfoVo prodInfoVo = JSON.parseObject(JSON.toJSONString(productEntity), new TypeReference<ProdInfoVo>() {
});
seckillRedisTo.setProdInfo(prodInfoVo);

View File

@@ -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;
}

View File

@@ -74,5 +74,13 @@ public class ExpressOrderRequestVo {
* 是否返回电子面单模板
*/
private Integer IsReturnPrintTemplate;
/**
* 快递客户号
*/
private String CustomerName;
/**
* 快递客户密码
*/
private String CustomerPwd;
}

View File

@@ -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: 计算运费

View File

@@ -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:

View File

@@ -4,7 +4,7 @@
<mapper namespace="com.peanut.modules.book.dao.PublisherDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.peanut.modules.book.entity.PublisherEntity" id="publisherMap">
<resultMap type="com.peanut.modules.book.entity.Publisher" id="publisherMap">
<result property="id" column="id"/>
<result property="publisherName" column="publisher_name"/>
<result property="introduction" column="introduction"/>

View File

@@ -4,7 +4,7 @@
<mapper namespace="com.peanut.modules.book.dao.ShopProductDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.peanut.modules.book.entity.ShopProductEntity" id="shopProductMap">
<resultMap type="com.peanut.modules.book.entity.ShopProduct" id="shopProductMap">
<result property="productId" column="product_id"/>
<result property="productName" column="product_name"/>
<result property="price" column="price"/>
@@ -36,7 +36,7 @@
</resultMap>
<select id="appGetCategoryList" resultType="com.peanut.modules.book.entity.ShopProductEntity">
<select id="appGetCategoryList" resultType="com.peanut.modules.book.entity.ShopProduct">
SELECT
*
FROM