付款时优惠卷列表
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
package com.peanut.modules.book.controller;
|
||||
|
||||
import cn.com.marsoft.tool.ToolObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.peanut.common.utils.PageUtils;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.common.utils.ShiroUtils;
|
||||
import com.peanut.modules.book.service.*;
|
||||
import com.peanut.modules.common.entity.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -60,7 +62,7 @@ public class UserRecordController {
|
||||
|
||||
List list = new ArrayList<>();
|
||||
//此处bookid实际传的是商品id
|
||||
List<UserRecord> bookid = userRecordService.getBaseMapper().selectList(new QueryWrapper<UserRecord>().eq("bookid", userRecordEntity.getBookid()).orderByDesc("create_date"));
|
||||
List<UserRecord> bookid = userRecordService.getBaseMapper().selectList(new QueryWrapper<UserRecord>().eq("product_id", userRecordEntity.getProductId()).orderByDesc("create_date"));
|
||||
|
||||
|
||||
if (bookid != null) {
|
||||
@@ -232,44 +234,4 @@ public class UserRecordController {
|
||||
return R.ok("成功").put("userRecordEntity", recordEntity);
|
||||
}
|
||||
|
||||
/*
|
||||
TODO 老版本接口,新版本上线后要删除
|
||||
*/
|
||||
@RequestMapping("/UserRecordcomment")
|
||||
public R commodity(@RequestBody UserRecord recordEntity) {
|
||||
//todo 已收货限制字段,只可评价一次
|
||||
BuyOrder buyOrder = buyOrderService.getBaseMapper().selectOne(new QueryWrapper<BuyOrder>()
|
||||
.eq("order_sn", recordEntity.getOrderSn())
|
||||
);
|
||||
|
||||
Integer orderId = buyOrder.getOrderId();
|
||||
BuyOrderDetail detailEntity = buyOrderDetailService.getBaseMapper().selectOne(new QueryWrapper<BuyOrderDetail>().eq("Order_id", orderId).eq("product_id", recordEntity.getBookid()));
|
||||
Integer orderId1 = detailEntity.getOrderId();
|
||||
UserRecord userRecordEntity = userRecordService.getBaseMapper().selectOne(new QueryWrapper<UserRecord>().eq("orderSn", recordEntity.getOrderSn()).eq("userid", recordEntity.getUserid()).eq("orderdid", orderId1).last("LIMIT 1"));
|
||||
|
||||
if (userRecordEntity != null) {
|
||||
return R.error("您已评价过");
|
||||
}
|
||||
if (recordEntity.getImages() != null) {
|
||||
List<Map<String, String>> imageList = (ArrayList<Map<String, String>>) recordEntity.getImages();
|
||||
String imageStr = "";
|
||||
for (Map m : imageList) {
|
||||
imageStr += m.get("url") + ",";
|
||||
|
||||
}
|
||||
|
||||
|
||||
recordEntity.setImages(imageStr);
|
||||
}
|
||||
recordEntity.setDelflag(0);
|
||||
recordEntity.setOrderdId(orderId1);
|
||||
userRecordService.saveOrUpdate(recordEntity);
|
||||
|
||||
|
||||
detailEntity.setRecordId(1);
|
||||
buyOrderDetailService.saveOrUpdate(detailEntity);
|
||||
|
||||
|
||||
return R.ok("成功").put("userRecordEntity", recordEntity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,10 +9,7 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.peanut.common.utils.ExcludeEmptyQueryWrapper;
|
||||
import com.peanut.common.utils.PageUtils;
|
||||
import com.peanut.common.utils.Query;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.common.utils.*;
|
||||
import com.peanut.config.Constants;
|
||||
import com.peanut.modules.common.dao.*;
|
||||
import com.peanut.modules.book.service.*;
|
||||
@@ -62,7 +59,7 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
|
||||
ShopProductService shopProductService;
|
||||
|
||||
@Autowired
|
||||
private BookService bookService;
|
||||
private UserRecordDao userRecordDao;
|
||||
|
||||
@Autowired
|
||||
private BuyOrderDao buyOrderDao;
|
||||
@@ -489,6 +486,13 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
|
||||
.eq(BuyOrderProduct::getOrderId, b.getOrderId()));
|
||||
for (BuyOrderProduct bb : buyOrderProducts){
|
||||
bb.setProduct(shopProductService.getById(bb.getProductId()));
|
||||
UserRecord userRecord = userRecordDao.selectOne(new QueryWrapper<UserRecord>()
|
||||
.eq("userid", ShiroUtils.getUId())
|
||||
.eq("orderdid", b.getOrderId())
|
||||
.eq("product_id", bb.getProductId()));
|
||||
if (userRecord!=null){
|
||||
bb.setRecordId(userRecord.getId());
|
||||
}
|
||||
}
|
||||
b.setProductList(buyOrderProducts);
|
||||
b.setTimestamp(b.getCreateTime().getTime()/1000);
|
||||
|
||||
Reference in New Issue
Block a user