bug fix
This commit is contained in:
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.peanut.common.utils.PageUtils;
|
||||
import com.peanut.common.utils.Query;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.config.Constants;
|
||||
import com.peanut.config.DelayQueueConfig;
|
||||
@@ -18,11 +19,13 @@ import com.peanut.modules.book.vo.response.BuyOrderResponseVo;
|
||||
import com.peanut.modules.book.vo.response.ExpressQueryResponseVo;
|
||||
import com.peanut.modules.book.vo.ShippingAddressRequestVo;
|
||||
import com.peanut.modules.book.vo.UserAddressVo;
|
||||
import com.peanut.modules.book.vo.response.OrderAddressResponseVo;
|
||||
import com.peanut.modules.pay.weChatPay.dto.WechatPaymentInfo;
|
||||
import com.peanut.modules.pay.weChatPay.service.WxpayService;
|
||||
import com.peanut.modules.sys.entity.SysConfigEntity;
|
||||
import com.peanut.modules.sys.service.SysConfigService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.formula.functions.Count;
|
||||
import org.springframework.amqp.core.MessagePostProcessor;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -82,6 +85,12 @@ public class BuyOrderController {
|
||||
private SysConfigService sysConfigService;
|
||||
@Autowired
|
||||
private BuyOrderProductService buyOrderProductService;
|
||||
@Autowired
|
||||
private ProvinceService provinceService;
|
||||
@Autowired
|
||||
private CityService cityService;
|
||||
@Autowired
|
||||
private CountyService countyService;
|
||||
|
||||
@RequestMapping(value = "/decomposeShipment", method = RequestMethod.GET)
|
||||
public R decomposeShipment(@RequestParam("userId") Integer userId) {
|
||||
@@ -361,6 +370,7 @@ public class BuyOrderController {
|
||||
|
||||
/**
|
||||
* app 端 取消订单
|
||||
* TODO 新版本上线后此方法删除
|
||||
*/
|
||||
@RequestMapping("/appDelete")
|
||||
@Transactional
|
||||
@@ -392,37 +402,37 @@ public class BuyOrderController {
|
||||
}
|
||||
|
||||
/**
|
||||
* app 端 取消订单
|
||||
* @param orderSn 订单号
|
||||
* @return R
|
||||
*/
|
||||
// @RequestMapping("/cancelOrder")
|
||||
// @Transactional
|
||||
// public R appDelete(@RequestParam("orderSn") String orderSn) {
|
||||
// QueryWrapper<BuyOrder> qu
|
||||
//
|
||||
// //1. 判断订单状态
|
||||
// BuyOrder byId = buyOrderService.getById(orderId);
|
||||
// if (byId != null) {
|
||||
// //2. 判断当前订单是否存在优惠券 进行 回显
|
||||
// Integer couponId = byId.getCouponId();
|
||||
// if (couponId != null) {
|
||||
//
|
||||
// CouponHistoryEntity byId1 = couponHistoryService.getById(couponId);
|
||||
// byId1.setUseStatus(0);
|
||||
// couponHistoryService.updateById(byId1);
|
||||
// }
|
||||
// // 库存回滚
|
||||
// List<BuyOrderDetail> buyOrderDetailEntities = buyOrderDetailService.getBaseMapper().selectList(new QueryWrapper<BuyOrderDetail>()
|
||||
// .eq("order_id", byId.getOrderId()));
|
||||
// for (BuyOrderDetail buyOrderDetailEntity : buyOrderDetailEntities) {
|
||||
// Integer productId = buyOrderDetailEntity.getProductId();
|
||||
// ShopProduct product = shopProductService.getById(productId);
|
||||
// product.setProductStock(product.getProductStock() + buyOrderDetailEntity.getQuantity());
|
||||
// shopProductService.updateById(product);
|
||||
// }
|
||||
// buyOrderService.removeById(orderId);
|
||||
// }
|
||||
// return R.ok();
|
||||
// }
|
||||
@RequestMapping("/cancelOrder")
|
||||
@Transactional
|
||||
public R appDelete(@RequestParam("orderSn") String orderSn) {
|
||||
QueryWrapper<BuyOrder> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("order_sn", orderSn);
|
||||
BuyOrder buyOrder = buyOrderService.getOne(queryWrapper);
|
||||
|
||||
if (buyOrder == null) {
|
||||
return R.error("订单不存在");
|
||||
}
|
||||
if (buyOrder.getCouponId() != null) {
|
||||
Integer couponId = buyOrder.getCouponId();
|
||||
CouponHistoryEntity couponHistory = couponHistoryService.getById(couponId);
|
||||
couponHistory.setUseStatus(0);
|
||||
couponHistoryService.updateById(couponHistory);
|
||||
}
|
||||
// 库存回滚
|
||||
List<BuyOrderProduct> buyOrderProductList = buyOrderProductService.getBaseMapper().selectList(new QueryWrapper<BuyOrderProduct>()
|
||||
.eq("order_id", buyOrder.getOrderId()));
|
||||
for (BuyOrderProduct buyOrderProduct : buyOrderProductList) {
|
||||
Integer productId = buyOrderProduct.getProductId();
|
||||
ShopProduct product = shopProductService.getById(productId);
|
||||
product.setProductStock(product.getProductStock() + buyOrderProduct.getQuantity());
|
||||
shopProductService.updateById(product);
|
||||
}
|
||||
buyOrderService.removeById(buyOrder.getOrderId());
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -475,6 +485,7 @@ public class BuyOrderController {
|
||||
*
|
||||
* @param orderId 订单 ID
|
||||
* @return R
|
||||
* TODO 新版本上线后 该方法删除
|
||||
*/
|
||||
@RequestMapping(value = "/getOrderInfo", method = RequestMethod.GET)
|
||||
public R appGetOrderInfo(@RequestParam("orderId") Integer orderId) {
|
||||
@@ -492,34 +503,98 @@ public class BuyOrderController {
|
||||
return R.ok().put("result", buyOrder);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改订单地址
|
||||
*
|
||||
* @param addressRequestVo 地址请求 value object
|
||||
* @return R
|
||||
*/
|
||||
@RequestMapping(value = "/modifyOrderAddress", method = RequestMethod.POST)
|
||||
public R modifyOrderAddress(@RequestBody ShippingAddressRequestVo addressRequestVo) {
|
||||
BuyOrder buyOrder = buyOrderService.getById(addressRequestVo.getOrderId());
|
||||
buyOrder.setProvince(addressRequestVo.getProvince());
|
||||
buyOrder.setCity(addressRequestVo.getCity());
|
||||
buyOrder.setDistrict(addressRequestVo.getCounty());
|
||||
|
||||
String provinceCode = addressRequestVo.getProvinceCode();
|
||||
QueryWrapper<Province> provinceQueryWrapper = new QueryWrapper<>();
|
||||
provinceQueryWrapper.eq("region_code", provinceCode);
|
||||
Province province = provinceService.getOne(provinceQueryWrapper);
|
||||
buyOrder.setProvince(province.getProvName());
|
||||
String cityCode = addressRequestVo.getCityCode();
|
||||
QueryWrapper<City> cityQueryWrapper = new QueryWrapper<>();
|
||||
cityQueryWrapper.eq("region_code", cityCode);
|
||||
City city = cityService.getOne(cityQueryWrapper);
|
||||
buyOrder.setCity(city.getCityName());
|
||||
String countyCode = addressRequestVo.getCountyCode();
|
||||
QueryWrapper<County> countyQueryWrapper = new QueryWrapper<>();
|
||||
countyQueryWrapper.eq("region_code", countyCode);
|
||||
County county = countyService.getOne(countyQueryWrapper);
|
||||
buyOrder.setDistrict(county.getCountyName());
|
||||
buyOrder.setShippingUser(addressRequestVo.getName());
|
||||
buyOrder.setUserPhone(addressRequestVo.getMobile());
|
||||
buyOrder.setAddress(addressRequestVo.getAddress());
|
||||
buyOrderService.updateById(buyOrder);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取订单地址
|
||||
*
|
||||
* @param orderSn 订单号
|
||||
* @return R
|
||||
*/
|
||||
@RequestMapping(value = "/getOrderAddress", method = RequestMethod.GET)
|
||||
public R getOrderAddress(@RequestParam("orderSn") String orderSn) {
|
||||
QueryWrapper<BuyOrder> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("order_sn", orderSn);
|
||||
BuyOrder buyOrder = buyOrderService.getOne(queryWrapper);
|
||||
OrderAddressResponseVo responseVo = new OrderAddressResponseVo();
|
||||
responseVo.setConsigneeMobile(buyOrder.getUserPhone());
|
||||
responseVo.setConsigneeName(buyOrder.getShippingUser());
|
||||
responseVo.setDetailAddress(buyOrder.getAddress());
|
||||
String provinceName = buyOrder.getProvince();
|
||||
String cityName = buyOrder.getCity();
|
||||
String countyName = buyOrder.getDistrict();
|
||||
|
||||
QueryWrapper<Province> provinceQueryWrapper = new QueryWrapper<>();
|
||||
provinceQueryWrapper.eq("prov_name", provinceName);
|
||||
Province province = provinceService.getOne(provinceQueryWrapper);
|
||||
responseVo.setProvinceCode(province.getRegionCode());
|
||||
|
||||
QueryWrapper<City> cityQueryWrapper = new QueryWrapper<>();
|
||||
cityQueryWrapper.eq("city_name", cityName);
|
||||
City city = cityService.getOne(cityQueryWrapper);
|
||||
responseVo.setCityCode(city.getRegionCode());
|
||||
|
||||
QueryWrapper<County> countyQueryWrapper = new QueryWrapper<>();
|
||||
countyQueryWrapper.eq("county_name", countyName);
|
||||
County county = countyService.getOne(countyQueryWrapper);
|
||||
responseVo.setCountyCode(county.getRegionCode());
|
||||
|
||||
return R.ok().put("result", responseVo);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询订单快递
|
||||
*
|
||||
* @param orderId 订单号
|
||||
* @param orderSn 订单号
|
||||
* @return R
|
||||
*/
|
||||
@RequestMapping(value = "/queryExpress", method = RequestMethod.GET)
|
||||
public R queryExpress(@RequestParam("orderId") Integer orderId) {
|
||||
QueryWrapper<BuyOrderDetail> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("order_id", orderId);
|
||||
List<BuyOrderDetail> buyOrderDetailList = buyOrderDetailService.list(queryWrapper);
|
||||
public R queryExpress(@RequestParam("orderSn") Integer orderSn) {
|
||||
QueryWrapper<BuyOrder> buyOrderQueryWrapper = new QueryWrapper<>();
|
||||
buyOrderQueryWrapper.eq("order_sn", orderSn);
|
||||
BuyOrder buyOrder = buyOrderService.getOne(buyOrderQueryWrapper);
|
||||
Integer orderId = buyOrder.getOrderId();
|
||||
|
||||
QueryWrapper<BuyOrderProduct> buyOrderProductQueryWrapper = new QueryWrapper<>();
|
||||
buyOrderProductQueryWrapper.eq("order_id", orderId);
|
||||
List<BuyOrderProduct> buyOrderProductList = buyOrderProductService.list(buyOrderProductQueryWrapper);
|
||||
List<ExpressQueryResponseVo> result = new ArrayList<>();
|
||||
for (BuyOrderDetail buyOrderDetail : buyOrderDetailList) {
|
||||
for (BuyOrderProduct buyOrderProduct : buyOrderProductList) {
|
||||
int expressOrderId = buyOrderProduct.getExpressOrderId();
|
||||
ExpressOrder expressOrder = expressOrderService.getById(expressOrderId);
|
||||
ExpressQueryResponseVo vo = new ExpressQueryResponseVo();
|
||||
vo.setOrderDetailId(buyOrderDetail.getId());
|
||||
ExpressQueryResponse expressQueryResponse = expressOrderService.queryExpressOrder(buyOrderDetail.getExpressCompanyCode(), buyOrderDetail.getExpressBillNo());
|
||||
ExpressQueryResponse expressQueryResponse = expressOrderService.queryExpressOrder(expressOrder.getExpressCompanyCode(), expressOrder.getExpressOrderSn());
|
||||
vo.setLogisticCode(expressQueryResponse.getLogisticCode());
|
||||
vo.setTraces(expressQueryResponse.getTraces());
|
||||
result.add(vo);
|
||||
|
||||
@@ -1,113 +1,113 @@
|
||||
package com.peanut.modules.book.controller;
|
||||
|
||||
import com.peanut.common.utils.PageUtils;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.book.entity.BuyOrderDetail;
|
||||
import com.peanut.modules.book.service.BuyOrderDetailService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 商品订单详情表
|
||||
*
|
||||
* @author yl
|
||||
* @email yl328572838@163.com
|
||||
* @date 2022-08-29 15:27:44
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("book/buyorderdetail")
|
||||
public class BuyOrderDetailController {
|
||||
@Autowired
|
||||
private BuyOrderDetailService buyOrderDetailService;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
public R list(@RequestParam Map<String, Object> params) {
|
||||
PageUtils page = buyOrderDetailService.queryPage(params);
|
||||
return R.ok().put("page", page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询已购买书籍
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/querybuy")
|
||||
public R querybuy(@RequestParam Map<String, Object> params) {
|
||||
PageUtils page = buyOrderDetailService.querybuy(params);
|
||||
return R.ok().put("page", page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 去重查询可打印面单
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/querySheetPage")
|
||||
public R querySheetPage(@RequestParam Map<String, Object> params) {
|
||||
PageUtils page = buyOrderDetailService.querySheet(params);
|
||||
return R.ok().put("page", page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*/
|
||||
@RequestMapping("/info/{allOrderId}")
|
||||
public R info(@PathVariable("allOrderId") Long allOrderId) {
|
||||
BuyOrderDetail buyOrderDetail = buyOrderDetailService.getById(allOrderId);
|
||||
return R.ok().put("buyOrderDetail", buyOrderDetail);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
@RequestMapping("/save")
|
||||
public R save(@RequestBody BuyOrderDetail buyOrderDetail) {
|
||||
buyOrderDetailService.save(buyOrderDetail);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@RequestMapping("/update")
|
||||
public R update(@RequestBody BuyOrderDetail buyOrderDetail) {
|
||||
buyOrderDetailService.updateById(buyOrderDetail);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@RequestMapping("/delete")
|
||||
public R delete(@RequestBody Long[] allOrderIds) {
|
||||
buyOrderDetailService.removeByIds(Arrays.asList(allOrderIds));
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@RequestMapping("/updateOrderStatus")
|
||||
public R updateOrderStatus(@RequestBody BuyOrderDetail buyOrderDetail) {
|
||||
buyOrderDetail.setOrderStatus("2");
|
||||
buyOrderDetailService.updateById(buyOrderDetail);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据运单号批量修改打印状态
|
||||
*
|
||||
* @param shippingSnList
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/batchUpdateByShippingSns")
|
||||
public R batchUpdateByShippingSns(@RequestBody String[] shippingSnList) {
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
//package com.peanut.modules.book.controller;
|
||||
//
|
||||
//import com.peanut.common.utils.PageUtils;
|
||||
//import com.peanut.common.utils.R;
|
||||
//import com.peanut.modules.book.entity.BuyOrderDetail;
|
||||
//import com.peanut.modules.book.service.BuyOrderDetailService;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.web.bind.annotation.*;
|
||||
//
|
||||
//import java.util.Arrays;
|
||||
//import java.util.Map;
|
||||
//
|
||||
///**
|
||||
// * 商品订单详情表
|
||||
// *
|
||||
// * @author yl
|
||||
// * @email yl328572838@163.com
|
||||
// * @date 2022-08-29 15:27:44
|
||||
// */
|
||||
//@RestController
|
||||
//@RequestMapping("book/buyorderdetail")
|
||||
//public class BuyOrderDetailController {
|
||||
// @Autowired
|
||||
// private BuyOrderDetailService buyOrderDetailService;
|
||||
//
|
||||
// /**
|
||||
// * 列表
|
||||
// */
|
||||
// @RequestMapping("/list")
|
||||
// public R list(@RequestParam Map<String, Object> params) {
|
||||
// PageUtils page = buyOrderDetailService.queryPage(params);
|
||||
// return R.ok().put("page", page);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 查询已购买书籍
|
||||
// *
|
||||
// * @param params
|
||||
// * @return
|
||||
// */
|
||||
// @RequestMapping("/querybuy")
|
||||
// public R querybuy(@RequestParam Map<String, Object> params) {
|
||||
// PageUtils page = buyOrderDetailService.querybuy(params);
|
||||
// return R.ok().put("page", page);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 去重查询可打印面单
|
||||
// *
|
||||
// * @param params
|
||||
// * @return
|
||||
// */
|
||||
// @RequestMapping("/querySheetPage")
|
||||
// public R querySheetPage(@RequestParam Map<String, Object> params) {
|
||||
// PageUtils page = buyOrderDetailService.querySheet(params);
|
||||
// return R.ok().put("page", page);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 信息
|
||||
// */
|
||||
// @RequestMapping("/info/{allOrderId}")
|
||||
// public R info(@PathVariable("allOrderId") Long allOrderId) {
|
||||
// BuyOrderDetail buyOrderDetail = buyOrderDetailService.getById(allOrderId);
|
||||
// return R.ok().put("buyOrderDetail", buyOrderDetail);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 保存
|
||||
// */
|
||||
// @RequestMapping("/save")
|
||||
// public R save(@RequestBody BuyOrderDetail buyOrderDetail) {
|
||||
// buyOrderDetailService.save(buyOrderDetail);
|
||||
// return R.ok();
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 修改
|
||||
// */
|
||||
// @RequestMapping("/update")
|
||||
// public R update(@RequestBody BuyOrderDetail buyOrderDetail) {
|
||||
// buyOrderDetailService.updateById(buyOrderDetail);
|
||||
// return R.ok();
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 删除
|
||||
// */
|
||||
// @RequestMapping("/delete")
|
||||
// public R delete(@RequestBody Long[] allOrderIds) {
|
||||
// buyOrderDetailService.removeByIds(Arrays.asList(allOrderIds));
|
||||
// return R.ok();
|
||||
// }
|
||||
//
|
||||
// @RequestMapping("/updateOrderStatus")
|
||||
// public R updateOrderStatus(@RequestBody BuyOrderDetail buyOrderDetail) {
|
||||
// buyOrderDetail.setOrderStatus("2");
|
||||
// buyOrderDetailService.updateById(buyOrderDetail);
|
||||
// return R.ok();
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 根据运单号批量修改打印状态
|
||||
// *
|
||||
// * @param shippingSnList
|
||||
// * @return
|
||||
// */
|
||||
// @RequestMapping("/batchUpdateByShippingSns")
|
||||
// public R batchUpdateByShippingSns(@RequestBody String[] shippingSnList) {
|
||||
// return R.ok();
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -4,11 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.book.entity.BuyOrder;
|
||||
import com.peanut.modules.book.entity.BuyOrderProduct;
|
||||
import com.peanut.modules.book.entity.ExpressOrder;
|
||||
import com.peanut.modules.book.service.BuyOrderProductService;
|
||||
import com.peanut.modules.book.service.BuyOrderService;
|
||||
import com.peanut.modules.book.service.ExpressCompanyService;
|
||||
import com.peanut.modules.book.service.ExpressOrderService;
|
||||
import com.peanut.modules.book.vo.ExpressCompanyVo;
|
||||
@@ -19,7 +15,10 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 快递 Controller
|
||||
@@ -33,10 +32,6 @@ public class ExpressController {
|
||||
@Autowired
|
||||
private ExpressCompanyService expressCompanyService;
|
||||
@Autowired
|
||||
private BuyOrderService buyOrderService;
|
||||
@Autowired
|
||||
private BuyOrderProductService buyOrderProductService;
|
||||
@Autowired
|
||||
private ExpressOrderService expressOrderService;
|
||||
|
||||
|
||||
@@ -54,7 +49,7 @@ public class ExpressController {
|
||||
/**
|
||||
* 获取快递面单列表
|
||||
*
|
||||
* @return
|
||||
* @return R
|
||||
*/
|
||||
@RequestMapping(path = "/getPrintTemplateList", method = RequestMethod.GET)
|
||||
public R getPrintTemplate(@RequestParam(value = "expressOrderSn", required = false) String expressOrderSn,
|
||||
|
||||
@@ -32,7 +32,7 @@ public class ShopProductController {
|
||||
@Autowired
|
||||
private ShopCategoryService shopCategoryService;
|
||||
@Autowired
|
||||
private BuyOrderDetailService buyOrderDetailService;
|
||||
private BuyOrderProductService buyOrderProductService;
|
||||
@Autowired
|
||||
private BookService bookService;
|
||||
@Autowired
|
||||
@@ -94,17 +94,17 @@ public class ShopProductController {
|
||||
* @param userId 用户id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/booklist")
|
||||
@RequestMapping("/bookList")
|
||||
public R bookList(@RequestParam("userId") Integer userId
|
||||
) {
|
||||
//查询已购买的书籍
|
||||
List<BuyOrderDetail> buyOrderDetailEntities = buyOrderDetailService.getBaseMapper().selectList(new QueryWrapper<BuyOrderDetail>()
|
||||
List<BuyOrderProduct> buyOrderProductList = buyOrderProductService.getBaseMapper().selectList(new QueryWrapper<BuyOrderProduct>()
|
||||
.eq("user_id", userId));
|
||||
//hashset不重复 且无序
|
||||
Set<String> purchasedProductIds = new HashSet<>();
|
||||
ArrayList<Object> list = new ArrayList<>();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
for (BuyOrderDetail buyOrderDetail : buyOrderDetailEntities) {
|
||||
for (BuyOrderProduct buyOrderDetail : buyOrderProductList) {
|
||||
map.put("ProductId", String.valueOf(buyOrderDetail.getProductId()));
|
||||
list.add(map);
|
||||
//去重取出以后买书籍的id
|
||||
|
||||
@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.book.entity.MyUserEntity;
|
||||
import com.peanut.modules.book.entity.UserFeedbackEntity;
|
||||
import com.peanut.modules.book.entity.UserRecordEntity;
|
||||
import com.peanut.modules.book.service.MyUserService;
|
||||
import com.peanut.modules.book.service.UserFeedbackSerivce;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@@ -3,15 +3,19 @@ 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.*;
|
||||
import com.peanut.modules.book.service.*;
|
||||
import com.peanut.modules.book.entity.BuyOrder;
|
||||
import com.peanut.modules.book.entity.MyUserEntity;
|
||||
import com.peanut.modules.book.entity.UserFollowUpEntity;
|
||||
import com.peanut.modules.book.entity.UserRecord;
|
||||
import com.peanut.modules.book.service.BuyOrderService;
|
||||
import com.peanut.modules.book.service.MyUserService;
|
||||
import com.peanut.modules.book.service.UserFollowUpService;
|
||||
import com.peanut.modules.book.service.UserRecordService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static com.peanut.common.utils.R.error;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/user/followUp")
|
||||
public class UserFollowUpController {
|
||||
@@ -25,41 +29,34 @@ public class UserFollowUpController {
|
||||
private MyUserService myUserService;
|
||||
@Autowired
|
||||
private BuyOrderService buyOrderService;
|
||||
@Autowired
|
||||
private BuyOrderDetailService buyOrderDetailService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
public R list(@RequestParam Map<String, Object> params ){
|
||||
public R list(@RequestParam Map<String, Object> params) {
|
||||
PageUtils page = userFollowUpService.queryPage(params);
|
||||
return R.ok().put("page", page);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 我的评价
|
||||
* 我的评价
|
||||
*/
|
||||
@RequestMapping("/Allevaluations")
|
||||
public R Allevaluations(@RequestBody UserFollowUpEntity userFollowUpEntity){
|
||||
public R Allevaluations(@RequestBody UserFollowUpEntity userFollowUpEntity) {
|
||||
List<UserFollowUpEntity> userid = userFollowUpService.getBaseMapper().selectList(new QueryWrapper<UserFollowUpEntity>().eq("userid", userFollowUpEntity.getUserId()));
|
||||
return R.ok().put("Allevaluations",userid);
|
||||
return R.ok().put("Allevaluations", userid);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 全部评价
|
||||
* 全部评价
|
||||
*/
|
||||
@RequestMapping("/Alllevas")
|
||||
public R Alllevas(@RequestBody UserFollowUpEntity users){
|
||||
public R Alllevas(@RequestBody UserFollowUpEntity users) {
|
||||
HashMap<Object, Object> maps = new HashMap<>();
|
||||
List list = new ArrayList<>();
|
||||
List<UserFollowUpEntity> bookid = userFollowUpService.getBaseMapper().selectList(new QueryWrapper<UserFollowUpEntity>().eq("bookid", users.getBookid()));
|
||||
@@ -68,67 +65,62 @@ public class UserFollowUpController {
|
||||
Integer bookid1 = userRecord.getBookid();
|
||||
Integer userid1 = userRecord.getUserId();
|
||||
List<MyUserEntity> id = myUserService.getBaseMapper().selectList(new QueryWrapper<MyUserEntity>().eq("id", userid1));
|
||||
String usser="";
|
||||
String usser = "";
|
||||
String name = "";
|
||||
for (MyUserEntity user : id) {
|
||||
usser = user.getAvatar();
|
||||
name =user.getNickname();
|
||||
usser = user.getAvatar();
|
||||
name = user.getNickname();
|
||||
|
||||
}
|
||||
map.put("Avatar",usser);
|
||||
map.put("name",name);
|
||||
map.put("Avatar", usser);
|
||||
map.put("name", name);
|
||||
map.put("userId", users.getUserId());
|
||||
map.put("bookid",bookid1);
|
||||
map.put("userid",userid1);
|
||||
map.put("content",users.getConTent());
|
||||
map.put("create_date",users.getCreateDate());
|
||||
map.put("oid",users.getOid());
|
||||
map.put("praIse",users.getPraIse());
|
||||
map.put("bookid", bookid1);
|
||||
map.put("userid", userid1);
|
||||
map.put("content", users.getConTent());
|
||||
map.put("create_date", users.getCreateDate());
|
||||
map.put("oid", users.getOid());
|
||||
map.put("praIse", users.getPraIse());
|
||||
|
||||
list.add(map);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
maps.put("list",list);
|
||||
maps.put("list", list);
|
||||
|
||||
return R.ok().put("list",list);
|
||||
return R.ok().put("list", list);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* 追加评论(用户只可评论一次)
|
||||
*
|
||||
* */
|
||||
@RequestMapping("/userFollowUp")
|
||||
public Object UserFollowUp(@RequestBody UserFollowUpEntity userFollowUpEntity ) {
|
||||
public Object UserFollowUp(@RequestBody UserFollowUpEntity userFollowUpEntity) {
|
||||
|
||||
|
||||
//根据传过来的userid和oid查询出来userRecordEntity中关联数据
|
||||
UserRecordEntity userRecord = userRecordService.getBaseMapper().selectOne(new QueryWrapper<UserRecordEntity>()
|
||||
UserRecord userRecord = userRecordService.getBaseMapper().selectOne(new QueryWrapper<UserRecord>()
|
||||
.eq("userid", userFollowUpEntity.getUserId()).last("LIMIT 1")
|
||||
.eq("bookid", userFollowUpEntity.getBookid())
|
||||
.eq("id",userFollowUpEntity.getOid())
|
||||
.eq("id", userFollowUpEntity.getOid())
|
||||
);
|
||||
if (userRecord==null){
|
||||
return R.error("请先评论再追评");
|
||||
}
|
||||
if (userRecord == null) {
|
||||
return R.error("请先评论再追评");
|
||||
}
|
||||
String orderSn = userRecord.getOrderSn();
|
||||
BuyOrder buyOrder =buyOrderService.getBaseMapper().selectOne(new QueryWrapper<BuyOrder>()
|
||||
.eq("order_sn",orderSn).last("LIMIT 1")
|
||||
BuyOrder buyOrder = buyOrderService.getBaseMapper().selectOne(new QueryWrapper<BuyOrder>()
|
||||
.eq("order_sn", orderSn).last("LIMIT 1")
|
||||
);
|
||||
|
||||
Integer orderId = buyOrder.getOrderId();
|
||||
Integer bookid = userRecord.getBookid();
|
||||
Integer userid = userRecord.getUserid();
|
||||
Integer id1 = userRecord.getId();
|
||||
BuyOrderDetail detailEntity = buyOrderDetailService.getBaseMapper().selectOne(new QueryWrapper<BuyOrderDetail>()
|
||||
.eq("Order_id", orderId).eq("product_id",bookid));
|
||||
|
||||
UserFollowUpEntity followUpEntity = userFollowUpService.getBaseMapper().selectOne(new QueryWrapper<UserFollowUpEntity>().eq("userid", userid).eq("oid",id1).last("LIMIT 1"));
|
||||
UserFollowUpEntity followUpEntity = userFollowUpService.getBaseMapper().selectOne(new QueryWrapper<UserFollowUpEntity>().eq("userid", userid).eq("oid", id1).last("LIMIT 1"));
|
||||
|
||||
// if (followUpEntity != null) {
|
||||
// return R.error("您已评价过");
|
||||
@@ -136,11 +128,11 @@ public class UserFollowUpController {
|
||||
|
||||
buyOrder.setRecordId(2);
|
||||
buyOrderService.saveOrUpdate(buyOrder);
|
||||
if (userFollowUpEntity.getImages()!=null) {
|
||||
if (userFollowUpEntity.getImages() != null) {
|
||||
|
||||
List<Map<String,String>> imageList = (ArrayList<Map<String,String>>)userFollowUpEntity.getImages();
|
||||
List<Map<String, String>> imageList = (ArrayList<Map<String, String>>) userFollowUpEntity.getImages();
|
||||
String imageStr = "";
|
||||
for(Map m : imageList){
|
||||
for (Map m : imageList) {
|
||||
imageStr += m.get("url") + ",";
|
||||
}
|
||||
|
||||
@@ -148,33 +140,30 @@ public class UserFollowUpController {
|
||||
|
||||
}
|
||||
|
||||
userFollowUpEntity.setOid(id1);
|
||||
userFollowUpEntity.setDelflag(0);
|
||||
userFollowUpEntity.setCreateDate(new Date());
|
||||
userFollowUpService.saveOrUpdate(userFollowUpEntity);
|
||||
return R.ok("成功").put("userFollowUpEntity",userFollowUpEntity);
|
||||
}
|
||||
|
||||
|
||||
userFollowUpEntity.setOid(id1);
|
||||
userFollowUpEntity.setDelflag(0);
|
||||
userFollowUpEntity.setCreateDate(new Date());
|
||||
userFollowUpService.saveOrUpdate(userFollowUpEntity);
|
||||
return R.ok("成功").put("userFollowUpEntity", userFollowUpEntity);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*/
|
||||
@RequestMapping("/info/{id}")
|
||||
public R info(@PathVariable("id") Integer id){
|
||||
public R info(@PathVariable("id") Integer id) {
|
||||
UserFollowUpEntity user = userFollowUpService.getById(id);
|
||||
|
||||
return R.ok().put("UserFollowUpEntity", user);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@RequestMapping("/update")
|
||||
public R update(@RequestBody UserRecordEntity user){
|
||||
public R update(@RequestBody UserRecord user) {
|
||||
userRecordService.updateById(user);
|
||||
|
||||
return R.ok();
|
||||
@@ -184,7 +173,7 @@ public class UserFollowUpController {
|
||||
* 删除
|
||||
*/
|
||||
@RequestMapping("/delete")
|
||||
public R delete(@RequestBody Integer[] ids){
|
||||
public R delete(@RequestBody Integer[] ids) {
|
||||
userRecordService.removeByIds(Arrays.asList(ids));
|
||||
|
||||
|
||||
@@ -192,4 +181,4 @@ public class UserFollowUpController {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public class UserRecordController {
|
||||
@Autowired
|
||||
private MyUserService myUserService;
|
||||
@Autowired
|
||||
private BuyOrderDetailService buyOrderDetailService;
|
||||
private BuyOrderProductService buyOrderProductService;
|
||||
@Autowired
|
||||
private UserFollowUpService userFollowUpService;
|
||||
|
||||
@@ -43,8 +43,8 @@ public class UserRecordController {
|
||||
* 查看我的评价
|
||||
*/
|
||||
@RequestMapping("/Allevaluations")
|
||||
public R Allevaluations(@RequestBody UserRecordEntity userRecordEntity) {
|
||||
List<UserRecordEntity> userid = userRecordService.getBaseMapper().selectList(new QueryWrapper<UserRecordEntity>().eq("userid", userRecordEntity.getUserid()).orderByDesc("create_date"));
|
||||
public R Allevaluations(@RequestBody UserRecord userRecord) {
|
||||
List<UserRecord> userid = userRecordService.getBaseMapper().selectList(new QueryWrapper<UserRecord>().eq("userid", userRecord.getUserid()).orderByDesc("create_date"));
|
||||
return R.ok().put("Allevaluations", userid);
|
||||
}
|
||||
|
||||
@@ -52,16 +52,16 @@ public class UserRecordController {
|
||||
* 查看全部评价
|
||||
*/
|
||||
@RequestMapping("/All")
|
||||
public R All(@RequestBody UserRecordEntity userRecordEntity) {
|
||||
public R All(@RequestBody UserRecord userRecordEntity) {
|
||||
|
||||
|
||||
List list = new ArrayList<>();
|
||||
//此处bookid实际传的是商品id
|
||||
List<UserRecordEntity> bookid = userRecordService.getBaseMapper().selectList(new QueryWrapper<UserRecordEntity>().eq("bookid", userRecordEntity.getBookid()).orderByDesc("create_date"));
|
||||
List<UserRecord> bookid = userRecordService.getBaseMapper().selectList(new QueryWrapper<UserRecord>().eq("bookid", userRecordEntity.getBookid()).orderByDesc("create_date"));
|
||||
|
||||
|
||||
if (bookid != null) {
|
||||
for (UserRecordEntity userRecord : bookid) {
|
||||
for (UserRecord userRecord : bookid) {
|
||||
|
||||
HashMap<Object, Object> map = new HashMap<>();
|
||||
Integer bookid1 = userRecord.getBookid();
|
||||
@@ -114,16 +114,16 @@ public class UserRecordController {
|
||||
*/
|
||||
@RequestMapping("/info/{id}")
|
||||
public R info(@PathVariable("id") Integer id) {
|
||||
UserRecordEntity userRecordEntity = userRecordService.getById(id);
|
||||
return R.ok().put("bookChapterContent", userRecordEntity);
|
||||
UserRecord userRecord = userRecordService.getById(id);
|
||||
return R.ok().put("bookChapterContent", userRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
@RequestMapping("/save")
|
||||
public R save(@RequestBody UserRecordEntity userRecordEntity) {
|
||||
userRecordService.save(userRecordEntity);
|
||||
public R save(@RequestBody UserRecord userRecord) {
|
||||
userRecordService.save(userRecord);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@@ -131,8 +131,8 @@ public class UserRecordController {
|
||||
* 修改
|
||||
*/
|
||||
@RequestMapping("/update")
|
||||
public R update(@RequestBody UserRecordEntity userRecordEntity) {
|
||||
userRecordService.updateById(userRecordEntity);
|
||||
public R update(@RequestBody UserRecord userRecord) {
|
||||
userRecordService.updateById(userRecord);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@@ -169,23 +169,23 @@ public class UserRecordController {
|
||||
//状态3为已收货
|
||||
// .eq("order_status","3")
|
||||
);
|
||||
UserRecordEntity userRecordEntity = new UserRecordEntity();
|
||||
UserRecord userRecord = new UserRecord();
|
||||
|
||||
|
||||
if (!ToolObject.isNullOrEmpty(buyOrder)) {
|
||||
return error("您已评价过了,请勿重复评论");
|
||||
//
|
||||
} else {
|
||||
userRecordEntity.setId(buyOrder.getOrderId());
|
||||
userRecordEntity.setContent(comment);
|
||||
userRecord.setId(buyOrder.getOrderId());
|
||||
userRecord.setContent(comment);
|
||||
//商品评价
|
||||
userRecordEntity.setBookid(bookid);
|
||||
userRecordEntity.setUserid(userid);
|
||||
userRecordEntity.setOrderSn(orderSn);
|
||||
userRecordEntity.setDelflag(0);
|
||||
userRecordEntity.setProductId(bookid);
|
||||
userRecordService.saveOrUpdate(userRecordEntity);
|
||||
return R.ok("成功").put("userRecordEntity", userRecordEntity);
|
||||
userRecord.setBookid(bookid);
|
||||
userRecord.setUserid(userid);
|
||||
userRecord.setOrderSn(orderSn);
|
||||
userRecord.setDelflag(0);
|
||||
userRecord.setProductId(bookid);
|
||||
userRecordService.saveOrUpdate(userRecord);
|
||||
return R.ok("成功").put("userRecordEntity", userRecord);
|
||||
}
|
||||
|
||||
|
||||
@@ -196,19 +196,20 @@ public class UserRecordController {
|
||||
* @param recordEntity
|
||||
* @return 生成评论(上传图片,星级评价
|
||||
*/
|
||||
@RequestMapping("/UserRecordcomment")
|
||||
public R commodity(@RequestBody UserRecordEntity recordEntity) {
|
||||
//todo 已收货限制字段,只可评价一次
|
||||
BuyOrder buyOrder = buyOrderService.getBaseMapper().selectOne(new QueryWrapper<BuyOrder>()
|
||||
.eq("order_sn", recordEntity.getOrderSn())
|
||||
);
|
||||
|
||||
@RequestMapping("/UserRecordComment")
|
||||
public R commodity(@RequestBody UserRecord recordEntity) {
|
||||
QueryWrapper<BuyOrder> buyOrderQueryWrapper = new QueryWrapper<>();
|
||||
buyOrderQueryWrapper.eq("order_sn", recordEntity.getOrderSn());
|
||||
BuyOrder buyOrder = buyOrderService.getOne(buyOrderQueryWrapper);
|
||||
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();
|
||||
UserRecordEntity userRecordEntity = userRecordService.getBaseMapper().selectOne(new QueryWrapper<UserRecordEntity>().eq("orderSn", recordEntity.getOrderSn()).eq("userid", recordEntity.getUserid()).eq("orderdid", orderId1).last("LIMIT 1"));
|
||||
QueryWrapper<BuyOrderProduct> buyOrderProductQueryWrapper = new QueryWrapper<>();
|
||||
buyOrderProductQueryWrapper.eq("order_id", orderId);
|
||||
buyOrderProductQueryWrapper.eq("product_id", recordEntity.getProductId());
|
||||
BuyOrderProduct buyOrderProduct = buyOrderProductService.getOne(buyOrderProductQueryWrapper);
|
||||
Integer orderId1 = buyOrderProduct.getOrderId();
|
||||
UserRecord userRecord = userRecordService.getBaseMapper().selectOne(new QueryWrapper<UserRecord>().eq("orderSn", recordEntity.getOrderSn()).eq("userid", recordEntity.getUserid()).eq("orderdid", orderId1).last("LIMIT 1"));
|
||||
|
||||
if (userRecordEntity != null) {
|
||||
if (userRecord != null) {
|
||||
return R.error("您已评价过");
|
||||
}
|
||||
if (recordEntity.getImages() != null) {
|
||||
@@ -218,19 +219,13 @@ public class UserRecordController {
|
||||
imageStr += m.get("url") + ",";
|
||||
|
||||
}
|
||||
|
||||
|
||||
recordEntity.setImages(imageStr);
|
||||
}
|
||||
recordEntity.setDelflag(0);
|
||||
recordEntity.setOrderdId(orderId1);
|
||||
userRecordService.saveOrUpdate(recordEntity);
|
||||
|
||||
|
||||
detailEntity.setRecordId(1);
|
||||
buyOrderDetailService.saveOrUpdate(detailEntity);
|
||||
|
||||
|
||||
buyOrderProduct.setRecordId(1);
|
||||
buyOrderProductService.saveOrUpdate(buyOrderProduct);
|
||||
return R.ok("成功").put("userRecordEntity", recordEntity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品订单详情表
|
||||
*
|
||||
*
|
||||
* @author yl
|
||||
* @email yl328572838@163.com
|
||||
* @date 2022-08-29 15:27:44
|
||||
@@ -17,5 +17,5 @@ import java.util.List;
|
||||
public interface BuyOrderDetailDao extends BaseMapper<BuyOrderDetail> {
|
||||
|
||||
public List<BuyOrderDetail> queryListByOrderIds(Integer[] ids);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.peanut.modules.book.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.peanut.modules.book.entity.UserFollowUpEntity;
|
||||
import com.peanut.modules.book.entity.UserRecordEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
package com.peanut.modules.book.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.peanut.modules.book.entity.UserEbookBuyEntity;
|
||||
import com.peanut.modules.book.entity.UserRecordEntity;
|
||||
import com.peanut.modules.book.entity.UserRecord;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
|
||||
//书籍评价表
|
||||
@Mapper
|
||||
public interface UserRecordDao extends BaseMapper<UserRecordEntity> {
|
||||
public interface UserRecordDao extends BaseMapper<UserRecord> {
|
||||
|
||||
}
|
||||
|
||||
@@ -37,6 +37,10 @@ public class BuyOrderProduct {
|
||||
* 快递订单 ID
|
||||
*/
|
||||
private int expressOrderId;
|
||||
/**
|
||||
* 评价 ID
|
||||
*/
|
||||
private int recordId;
|
||||
/**
|
||||
* 删除标识
|
||||
*/
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.util.Date;
|
||||
|
||||
@Data
|
||||
@TableName("user_record")
|
||||
public class UserRecordEntity {
|
||||
public class UserRecord {
|
||||
|
||||
|
||||
@TableId
|
||||
@@ -6,6 +6,7 @@ import com.peanut.modules.book.entity.BuyOrderDetail;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 商品订单详情表
|
||||
*
|
||||
|
||||
@@ -2,12 +2,12 @@ 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.UserRecordEntity;
|
||||
import com.peanut.modules.book.entity.UserRecord;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface UserRecordService extends IService<UserRecordEntity> {
|
||||
public interface UserRecordService extends IService<UserRecord> {
|
||||
|
||||
|
||||
//todo 传参参数 用户id 购买订单id 星级评价 内容
|
||||
|
||||
@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.common.utils.ExcludeEmptyQueryWrapper;
|
||||
@@ -58,6 +57,7 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
|
||||
|
||||
protected Logger logger = LoggerFactory.getLogger(BuyOrderServiceImpl.class);
|
||||
|
||||
// TODO 新版本上线后删除
|
||||
@Override
|
||||
public PageUtils list(Map<String, Object> params) throws Exception {
|
||||
|
||||
@@ -106,6 +106,7 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
|
||||
}
|
||||
|
||||
|
||||
// TODO 新版本上线后删除
|
||||
@Override
|
||||
public PageUtils getMyOrderList(Map<String, Object> params) {
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import com.peanut.common.utils.PageUtils;
|
||||
import com.peanut.common.utils.Query;
|
||||
import com.peanut.modules.book.dao.UserFollowUpDao;
|
||||
import com.peanut.modules.book.entity.UserFollowUpEntity;
|
||||
import com.peanut.modules.book.entity.UserRecordEntity;
|
||||
import com.peanut.modules.book.service.UserFollowUpService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.common.utils.*;
|
||||
import com.peanut.modules.book.dao.UserRecordDao;
|
||||
import com.peanut.modules.book.entity.MyUserEntity;
|
||||
import com.peanut.modules.book.entity.UserRecordEntity;
|
||||
import com.peanut.modules.book.entity.UserRecord;
|
||||
import com.peanut.modules.book.service.MyUserService;
|
||||
import com.peanut.modules.book.service.UserRecordService;
|
||||
import org.joda.time.DateTime;
|
||||
@@ -21,7 +21,7 @@ import java.util.*;
|
||||
|
||||
|
||||
@Service("UserRecordServiceImpl")
|
||||
public class UserRecordServiceImpl extends ServiceImpl<UserRecordDao, UserRecordEntity> implements UserRecordService {
|
||||
public class UserRecordServiceImpl extends ServiceImpl<UserRecordDao, UserRecord> implements UserRecordService {
|
||||
|
||||
@Autowired
|
||||
private MyUserService myUserService;
|
||||
@@ -37,9 +37,9 @@ public class UserRecordServiceImpl extends ServiceImpl<UserRecordDao, UserRecord
|
||||
@Override
|
||||
public PageUtils queryPage(Map<String, Object> params) {
|
||||
String productId = (String) params.get("proudictId");
|
||||
IPage<UserRecordEntity> page = page(
|
||||
new Query<UserRecordEntity>().getPage(params),
|
||||
new QueryWrapper<UserRecordEntity>()
|
||||
IPage<UserRecord> page = page(
|
||||
new Query<UserRecord>().getPage(params),
|
||||
new QueryWrapper<UserRecord>()
|
||||
//订单号,开始时间
|
||||
.eq("bookid", productId).orderByDesc("create_date")
|
||||
// .eq("")
|
||||
@@ -47,13 +47,13 @@ public class UserRecordServiceImpl extends ServiceImpl<UserRecordDao, UserRecord
|
||||
);
|
||||
|
||||
|
||||
for (UserRecordEntity userRecordEntity : page.getRecords()) {
|
||||
Integer userid = userRecordEntity.getUserid();
|
||||
for (UserRecord userRecord : page.getRecords()) {
|
||||
Integer userid = userRecord.getUserid();
|
||||
MyUserEntity byId = myUserService.getById(userid);
|
||||
String avatar = byId.getAvatar();
|
||||
String nickname = byId.getNickname();
|
||||
userRecordEntity.setAvatar(avatar);
|
||||
userRecordEntity.setNickname(nickname);
|
||||
userRecord.setAvatar(avatar);
|
||||
userRecord.setNickname(nickname);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -16,15 +16,15 @@ public class ShippingAddressRequestVo {
|
||||
/**
|
||||
* 省份
|
||||
*/
|
||||
private String province;
|
||||
private String provinceCode;
|
||||
/**
|
||||
* 城市
|
||||
*/
|
||||
private String city;
|
||||
private String cityCode;
|
||||
/**
|
||||
* 县
|
||||
*/
|
||||
private String county;
|
||||
private String countyCode;
|
||||
/**
|
||||
* 地址
|
||||
*/
|
||||
|
||||
@@ -15,7 +15,7 @@ public class ExpressQueryResponseVo {
|
||||
/**
|
||||
* 订单详情 ID
|
||||
*/
|
||||
private Long orderDetailId;
|
||||
private String expressCompanyCode;
|
||||
/**
|
||||
* 快递单号
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.peanut.modules.book.vo.response;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Description: 订单地址查询响应 Value Object
|
||||
* @Author: Cauchy
|
||||
* @CreateTime: 2023/10/24
|
||||
*/
|
||||
@Data
|
||||
public class OrderAddressResponseVo {
|
||||
/**
|
||||
* 省份
|
||||
*/
|
||||
private String provinceCode;
|
||||
/**
|
||||
* 市
|
||||
*/
|
||||
private String cityCode;
|
||||
/**
|
||||
* 区
|
||||
*/
|
||||
private String countyCode;
|
||||
/**
|
||||
* 收货人姓名
|
||||
*/
|
||||
private String consigneeName;
|
||||
/**
|
||||
* 收货人电话
|
||||
*/
|
||||
private String consigneeMobile;
|
||||
/**
|
||||
* 详细地址
|
||||
*/
|
||||
private String detailAddress;
|
||||
}
|
||||
Reference in New Issue
Block a user