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

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