增加了评分接口(测试版)
This commit is contained in:
parent
15cfd2a5c5
commit
a5d69bdf75
|
@ -262,3 +262,33 @@ CREATE TABLE IF NOT EXISTS order_claim
|
|||
INDEX idx_orderId (orderId),
|
||||
INDEX idx_manicuristId (manicuristId)
|
||||
) COMMENT '抢单记录表' COLLATE = utf8mb4_unicode_ci;
|
||||
|
||||
-- 收藏表
|
||||
create table collect
|
||||
(
|
||||
id bigint auto_increment comment 'id' primary key ,
|
||||
userId bigint not null comment '用户id',
|
||||
businessId bigint not null comment '商家id'
|
||||
) comment '收藏';
|
||||
|
||||
-- 用户评分表
|
||||
create table user_rating
|
||||
(
|
||||
id bigint auto_increment primary key comment 'id',
|
||||
businessId bigint not null comment '商家id',
|
||||
userId bigint not null comment '用户id',
|
||||
orderId bigint not null comment '订单id',
|
||||
rating tinyint not null comment '评分',
|
||||
createTime datetime default CURRENT_TIMESTAMP not null comment '创建时间'
|
||||
) comment '用户评分' collate = utf8mb4_unicode_ci;
|
||||
|
||||
-- 商家等级表
|
||||
create table business_level
|
||||
(
|
||||
id bigint auto_increment primary key comment 'id',
|
||||
businessId bigint not null comment '商家id',
|
||||
averageScore DECIMAL(3, 2) not null default 0 comment '综合评分',
|
||||
level tinyint not null comment '等级',
|
||||
createTime DATETIME default CURRENT_TIMESTAMP comment '创建时间',
|
||||
updateTime DATETIME default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP comment '更新时间'
|
||||
)
|
|
@ -2,13 +2,12 @@ package com.cj.jiaqingjiayi.controller;
|
|||
|
||||
|
||||
import com.alipay.api.*;
|
||||
import com.alipay.api.domain.AlipayTradeCloseModel;
|
||||
import com.alipay.api.domain.AlipayTradeCreateModel;
|
||||
import com.alipay.api.request.AlipaySystemOauthTokenRequest;
|
||||
import com.alipay.api.request.AlipayTradeCreateRequest;
|
||||
import com.alipay.api.request.AlipayUserInfoShareRequest;
|
||||
import com.alipay.api.response.AlipaySystemOauthTokenResponse;
|
||||
import com.alipay.api.response.AlipayTradeCreateResponse;
|
||||
import com.alipay.api.response.AlipayUserInfoShareResponse;
|
||||
import com.alipay.api.domain.AlipayTradeQueryModel;
|
||||
import com.alipay.api.domain.AlipayTradeRefundModel;
|
||||
import com.alipay.api.request.*;
|
||||
import com.alipay.api.response.*;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.cj.jiaqingjiayi.common.BaseResponse;
|
||||
|
@ -86,7 +85,7 @@ public class AlipayController {
|
|||
String alipayPublicKey = PublicKey;
|
||||
AlipayConfig alipayConfig = new AlipayConfig();
|
||||
//沙箱网关
|
||||
alipayConfig.setServerUrl("https://openapi-sandbox.dl.alipaydev.com/gateway.do");
|
||||
// alipayConfig.setServerUrl("https://openapi-sandbox.dl.alipaydev.com/gateway.do");
|
||||
//支付宝网关
|
||||
alipayConfig.setServerUrl("https://openapi.alipay.com/gateway.do");
|
||||
alipayConfig.setAppId(appId);
|
||||
|
@ -127,6 +126,13 @@ public class AlipayController {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 创建支付
|
||||
* @param createAlipayRequest
|
||||
* @param request
|
||||
* @return
|
||||
* @throws AlipayApiException
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@GetMapping("/create/alipay")
|
||||
public BaseResponse<String> AlipayTradeCreate(@RequestBody CreateAlipayRequest createAlipayRequest, HttpServletRequest request) throws AlipayApiException {
|
||||
|
@ -183,6 +189,73 @@ public class AlipayController {
|
|||
return ResultUtils.success(tradeNo);
|
||||
}
|
||||
|
||||
@GetMapping("/test/close")
|
||||
public String closeOrder(String orderNo) throws AlipayApiException {
|
||||
|
||||
AlipayClient alipayClient = new DefaultAlipayClient(getAlipayConfig());
|
||||
AlipayTradeCloseRequest request = new AlipayTradeCloseRequest();
|
||||
AlipayTradeCloseModel model = new AlipayTradeCloseModel();
|
||||
|
||||
//model.setTradeNo(); 这是订单项
|
||||
//订单项可能会有多个支付单
|
||||
model.setTradeNo(orderNo);
|
||||
|
||||
request.setBizModel(model);
|
||||
//request.setNotifyUrl(NOURL);
|
||||
AlipayTradeCloseResponse response = alipayClient.execute(request);
|
||||
|
||||
//这里应该写进日志
|
||||
|
||||
|
||||
return response.getBody();
|
||||
}
|
||||
|
||||
@GetMapping("/test/refund")
|
||||
public String test_refund(String orderNo) throws AlipayApiException {
|
||||
AlipayClient alipayClient = new DefaultAlipayClient(getAlipayConfig());
|
||||
AlipayTradeRefundRequest request = new AlipayTradeRefundRequest();
|
||||
AlipayTradeRefundModel model = new AlipayTradeRefundModel();
|
||||
|
||||
|
||||
QueryWrapper<Orders> ordersQueryWrapper = new QueryWrapper<>();
|
||||
ordersQueryWrapper.eq("pickupCode", orderNo);
|
||||
Orders orders = ordersService.getOne(ordersQueryWrapper);
|
||||
model.setOutTradeNo(orderNo);
|
||||
model.setRefundAmount(String.valueOf(orders.getTotalPrice()));
|
||||
//退款请求单号 要求唯一 需改
|
||||
//model.setOutRequestNo("123");
|
||||
|
||||
request.setBizModel(model);
|
||||
//request.setNotifyUrl(NOURL);
|
||||
AlipayTradeRefundResponse response = alipayClient.execute(request);
|
||||
|
||||
String body = response.getBody();
|
||||
orders.setPaymentStatus(2);
|
||||
Date date = new Date();
|
||||
orders.setUpdateTime(date);
|
||||
boolean update = ordersService.updateById(orders);
|
||||
ThrowUtils.throwIf(!update, ErrorCode.OPERATION_ERROR, "修改订单状态失败");
|
||||
return body;
|
||||
}
|
||||
|
||||
@GetMapping("/test/query")
|
||||
public String test_query (String orderNo) throws AlipayApiException {
|
||||
AlipayClient alipayClient = new DefaultAlipayClient(getAlipayConfig());
|
||||
AlipayTradeQueryRequest request = new AlipayTradeQueryRequest();
|
||||
AlipayTradeQueryModel model = new AlipayTradeQueryModel();
|
||||
|
||||
model.setOutTradeNo(orderNo);
|
||||
|
||||
request.setBizModel(model);
|
||||
//request.setNotifyUrl(NOURL);
|
||||
|
||||
AlipayTradeQueryResponse response = alipayClient.execute(request);
|
||||
String body = response.getBody();
|
||||
return body;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static AlipayConfig getAlipayConfig() {
|
||||
String privateKey = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCrh54evp6VX68kLvmWybc945JbHaJDRJf6bDSKNwQfCkvEZxfOwYTGXu7XfZq2G/qmFJ6Xp9KxV0yYrxPwjXwPMU4E78/ZaMZ44iSTSq+qvMJMBR7PJOX1MkW7EFfhUPmb+5S0KQurjMQadY4b2VxeHwVxTRPKAdsm0tnfgN8/pO7TfpyGOWX5dRSIruQ3c+MFmJOy0cSZZ4tGlidqZDS9v4YJpmw3u5dX4BvGKtNMPaAnxSpLCDp1fd/vh6ROl71QkLFR+3mNQcwvDOGNJ2Rq78bgfkIVp0BBMySk5Mfv6kunh0QMaxK8wi+Y9swv7Iiyy7U2/zrBvA+1i3e5ctH9AgMBAAECggEBAJSiNrTjbp13RVewUNyFvIAnc4n62sE5bgw0uS5PUAXpsQ/mWW3yqLAQURxvnaFSC1bgpTA630qGoDvp8fhPUYIEslt6xnvY26qiIxly7Vegqyiegzzx90YKIvxexBfdR/4O+aNHsfIcT02yMcsWBYEVlmzAYnZ4N0OkD+EpVcpaIBv2HwGsJnczz41GQVl9GX2DOL8j8+eSWhZM0Jq3d1ksgcfUHH1TT12XCbEE3fKJEMKKlrjVPrtTb+v9m6t0okOgjW+z+IR0zY1HBR92yC+0/CP4FfkbGBhKNxsmbyU4ilTmKINHMy40bqGqrEYo+LBzhEKBT82eMbg9cJbL68ECgYEA37dP5hWEfuTWAoAwduI6OW8kTwxNddIigzTV3qlqEeo21K6RQOOTeYKXrpMmYG65MU5J3xF7AYyhb3rMpega++22Qybxlrme88hqe0s/DeSToG2mw1zYLkkHb5+oT05fCOlLmFGPeLRBfJTxjM6wPNX/1NvGOEVC9DekXuauWZECgYEAxEhmSne07LD6J2sYqsbmOb0zdOpCNT0a+7SomZwiMpVFcsxFvZhYJlcLwyR2m3deLphxwQBPbyxe8TtOZST7P7APpoeI4c0t6PL44vG3eUh+GHFVyf1dbLwMGa9gQ0JFRwBH5iDD2hfnTNfmcNUYzBRHZQK60FFlPCd566hOG60CgYBNVNJbmEiKjJOlnaYjEiRKQi7s3DXSambfr93V7/3oX2vArO8s3P3XXNsNz3POlbeSYZuLbkF00aXkITCokMjzGMKOB+Iu1c8qObcFE4eiR8b4B69DjM51gWz+mtPVRiP3sp0c8+SCNt0EMYAlyjSFcvvSGn40aUyxmqJI47iU4QKBgFYStaCkO9eriBcvFKMXE7BwMpdrftsfz6xfPawW1rw9zzWXNGH+43D0rPjHDagBQXDHcuLCwxKqb3vzmN4ryG3WRBavyqvSMPa9Tb0faGisDHelg4xPKd/b2qaMzHbSIdUP33egGKKT5t9AshH6sKQVpHU8LDXb67vkR8e6h34FAoGAf21Aea9/+3FavddWC/5j0fvESN2U58X0xf4R/FZLa5QsT/iCAo4QqaeYZvF6csWR6lu0zJB88gA+4s6G6xP1JERL3LbE2pHjDe0eNOIsWSzsINICQQ2s3Gm5mh75+/8dfAsRiAPi9nS7FJ74Tcryb4+txeZKiBZgLnEFeRLOB3U=";
|
||||
String alipayPublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsP/3AQ6DbZbQhFafYUdRS8F6jSXJzYfF3N14L48Jo+xlGp1FW8uq2bu8izP9qcuFxui2CzuQflo0BM+XmSmRt6KkmyGSvGmCdf4gC/doTT7xtMaQu72Mvezr69VC0Lp5iJeLVHzV5/BMFdgfGee5HnAUU5bn4Ytlqw14kCxgeLitZltvHtirq7vVCXlWyikbdtmV0HgmzaWbrC+jVyb/nk9oH8PpV5juJmhwEuiReEdKPKMdPoeJK3sZ9dHsOx+Bm3LkEY075fPvpHDtJFaLi/k7fFY+0oQxsX92qRL9kViOAhMonvFFKZFK06vxuPUtuZelGrzGttiOjVJRRGIiaQIDAQAB";
|
||||
|
|
|
@ -208,7 +208,7 @@ public class CommoditiesController {
|
|||
/**
|
||||
*根据id获取商品
|
||||
*/
|
||||
@ApiOperation(value = "根据id获取商品信息")
|
||||
@ApiOperation(value = "根据商品id获取商品信息")
|
||||
@GetMapping("/getById/commodities")
|
||||
public BaseResponse<CommoditiesVO> getCommoditiesById(@RequestParam Long id) {
|
||||
ThrowUtils.throwIf(id < 0, ErrorCode.NULL_ERROR);
|
||||
|
|
|
@ -12,10 +12,7 @@ import com.cj.jiaqingjiayi.exception.BusinessException;
|
|||
import com.cj.jiaqingjiayi.exception.ThrowUtils;
|
||||
import com.cj.jiaqingjiayi.model.CommonRequest;
|
||||
import com.cj.jiaqingjiayi.model.domain.*;
|
||||
import com.cj.jiaqingjiayi.model.request.order.MyOrderQueryRequest;
|
||||
import com.cj.jiaqingjiayi.model.request.order.OrderAddRequest;
|
||||
import com.cj.jiaqingjiayi.model.request.order.OrderItemsAddRequest;
|
||||
import com.cj.jiaqingjiayi.model.request.order.OrderQueryRequest;
|
||||
import com.cj.jiaqingjiayi.model.request.order.*;
|
||||
import com.cj.jiaqingjiayi.model.vo.OrdersVO;
|
||||
import com.cj.jiaqingjiayi.service.*;
|
||||
import io.swagger.annotations.Api;
|
||||
|
@ -138,6 +135,20 @@ public class OrdersController {
|
|||
return ResultUtils.success(ordersService.getOrdersVO(orders));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页获取订单列表(管理员)
|
||||
*/
|
||||
@PostMapping("/list/page")
|
||||
@ApiOperation(value = "分页获取订单列表(管理员)")
|
||||
public BaseResponse<Page<Orders>> listOrdersByPage(@RequestBody OrderQueryRequest orderQueryRequest, HttpServletRequest request) {
|
||||
userService.isAdmin(request);
|
||||
long current = orderQueryRequest.getCurrent();
|
||||
long size = orderQueryRequest.getPageSize();
|
||||
Page<Orders> ordersPage = ordersService.page(new Page<>(current, size),
|
||||
ordersService.getQueryWrapper(orderQueryRequest));
|
||||
return ResultUtils.success(ordersPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取我的订单
|
||||
*/
|
||||
|
@ -169,7 +180,155 @@ public class OrdersController {
|
|||
return ResultUtils.success(ordersVOPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单统计
|
||||
*/
|
||||
@ApiOperation(value = "订单统计")
|
||||
@PostMapping("/count")
|
||||
public BaseResponse<String> ordersCount(@RequestBody OrderCountRequest orderCountRequest) {
|
||||
String type = orderCountRequest.getType();
|
||||
Integer state = orderCountRequest.getPaymentStatus();
|
||||
Long businessId = orderCountRequest.getBusinessId();
|
||||
String startTime = orderCountRequest.getStartTime();
|
||||
String endTime = orderCountRequest.getEndTime();
|
||||
|
||||
// 参数校验
|
||||
ThrowUtils.throwIf(StringUtils.isBlank(type), ErrorCode.PARAMS_ERROR, "Type不能为空");
|
||||
ThrowUtils.throwIf(businessId == null, ErrorCode.PARAMS_ERROR, "BusinessId不能为空");
|
||||
|
||||
// 构建查询条件
|
||||
QueryWrapper<Orders> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq(state != null, "paymentStatus", state);
|
||||
queryWrapper.eq("businessId", businessId);
|
||||
return getStringBaseResponse(type, startTime, endTime, queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单金额统计(商家)
|
||||
*/
|
||||
@ApiOperation(value = "订单金额统计")
|
||||
@PostMapping("/count/money")
|
||||
//@AuthCheck(mustRole = UserConstant.BUSINESS_ROLE)
|
||||
public BaseResponse<List<BigDecimal>> ordersCountMoney(@RequestBody OrderCountRequest orderCountRequest) {
|
||||
// 获取查询类型
|
||||
String type = orderCountRequest.getType();
|
||||
ThrowUtils.throwIf(StringUtils.isBlank(type), ErrorCode.PARAMS_ERROR);
|
||||
OrderQueryRequest orderQueryRequest = new OrderQueryRequest();
|
||||
BeanUtils.copyProperties(orderCountRequest, orderQueryRequest);
|
||||
List<BigDecimal> moneyCountList = new ArrayList<>();
|
||||
if (type.equals("week")) {
|
||||
LocalDate today = LocalDate.now();
|
||||
DateTimeFormatter startFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd 00:00:00");
|
||||
DateTimeFormatter endFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd 23:59:59");
|
||||
// 遍历查询7天数据,放入数组
|
||||
for (int i = 0; i <= 6; i++) {
|
||||
LocalDate date = today.minusDays(i);
|
||||
orderQueryRequest.setStartTime(date.format(startFormatter));
|
||||
orderQueryRequest.setEndTime(date.format(endFormatter));
|
||||
QueryWrapper<Orders> queryWrapper = ordersService.getQueryWrapper(orderQueryRequest);
|
||||
List<Orders> ordertList = ordersService.list(queryWrapper);
|
||||
BigDecimal money = new BigDecimal("0");
|
||||
for (Orders order : ordertList) {
|
||||
money = money.add(order.getTotalPrice());
|
||||
}
|
||||
moneyCountList.add(money);
|
||||
}
|
||||
} else {
|
||||
QueryWrapper<Orders> queryWrapper = ordersService.getQueryWrapper(orderQueryRequest);
|
||||
List<Orders> ordertList = ordersService.list(queryWrapper);
|
||||
BigDecimal money = new BigDecimal("0");
|
||||
for (Orders order : ordertList) {
|
||||
money = money.add(order.getTotalPrice());
|
||||
}
|
||||
moneyCountList.add(money);
|
||||
}
|
||||
return ResultUtils.success(moneyCountList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单数量统计(商家)
|
||||
*/
|
||||
@ApiOperation(value = "订单数量统计")
|
||||
@PostMapping("/count/number")
|
||||
//@AuthCheck(mustRole = UserConstant.BUSINESS_ROLE)
|
||||
public BaseResponse<List<Long>> ordersCountNumber(@RequestBody OrderCountRequest orderCountRequest) {
|
||||
// 获取查询类型
|
||||
String type = orderCountRequest.getType();
|
||||
ThrowUtils.throwIf(StringUtils.isBlank(type), ErrorCode.PARAMS_ERROR);
|
||||
OrderQueryRequest orderQueryRequest = new OrderQueryRequest();
|
||||
BeanUtils.copyProperties(orderCountRequest, orderQueryRequest);
|
||||
List<Long> numberCountList = new ArrayList<>();
|
||||
if (type.equals("week")) {
|
||||
LocalDate today = LocalDate.now();
|
||||
DateTimeFormatter startFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd 00:00:00");
|
||||
DateTimeFormatter endFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd 23:59:59");
|
||||
// 遍历查询7天数据,放入数组
|
||||
for (int i = 0; i <= 6; i++) {
|
||||
LocalDate date = today.minusDays(i);
|
||||
orderQueryRequest.setStartTime(date.format(startFormatter));
|
||||
orderQueryRequest.setEndTime(date.format(endFormatter));
|
||||
QueryWrapper<Orders> queryWrapper = ordersService.getQueryWrapper(orderQueryRequest);
|
||||
long count = ordersService.count(queryWrapper );
|
||||
numberCountList.add(count);
|
||||
}
|
||||
} else {
|
||||
QueryWrapper<Orders> queryWrapper = ordersService.getQueryWrapper(orderQueryRequest);
|
||||
long count = ordersService.count(queryWrapper);
|
||||
numberCountList.add(count);
|
||||
}
|
||||
return ResultUtils.success(numberCountList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单统计(web端)
|
||||
*/
|
||||
@ApiOperation(value = "订单统计(web端)")
|
||||
@PostMapping("/count/web")
|
||||
//@AuthCheck(mustRole = UserConstant.BUSINESS_ROLE)
|
||||
public BaseResponse<String> ordersCountByWeb(@RequestBody OrderCountRequest orderCountRequest) {
|
||||
String type = orderCountRequest.getType();
|
||||
Integer state = orderCountRequest.getPaymentStatus();
|
||||
String businessName = orderCountRequest.getBusinessName();
|
||||
Long businessState = orderCountRequest.getBusinessState();
|
||||
String startTime = orderCountRequest.getStartTime();
|
||||
String endTime = orderCountRequest.getEndTime();
|
||||
List<Long> businessIdList = new ArrayList<>();
|
||||
ThrowUtils.throwIf(StringUtils.isBlank(type), ErrorCode.PARAMS_ERROR);
|
||||
if (businessName != null || businessState != null) {
|
||||
QueryWrapper<Business> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq(StringUtils.isNotBlank(businessName), "businessName", businessName);
|
||||
wrapper.eq(businessState != null, "state", businessState);
|
||||
List<Business> businessList = businessService.list(wrapper);
|
||||
if (CollectionUtils.isEmpty(businessList)) {
|
||||
return ResultUtils.success("0");
|
||||
}
|
||||
businessIdList = businessList.stream().map(Business::getId).collect(Collectors.toList());
|
||||
}
|
||||
QueryWrapper<Orders> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq(state != null, "paymentStatus", state);
|
||||
queryWrapper.in(!CollectionUtils.isEmpty(businessIdList), "businessId", businessIdList);
|
||||
return getStringBaseResponse(type, startTime, endTime, queryWrapper);
|
||||
}
|
||||
|
||||
private BaseResponse<String> getStringBaseResponse(String type, String startTime, String endTime, QueryWrapper<Orders> queryWrapper) {
|
||||
queryWrapper.ge(StringUtils.isNotBlank(startTime), "createTime", startTime);
|
||||
queryWrapper.le(StringUtils.isNotBlank(endTime), "createTime", endTime);
|
||||
if (type.equals("money")) {
|
||||
List<Orders> ordertList = ordersService.list(queryWrapper);
|
||||
BigDecimal money = new BigDecimal("0");
|
||||
for (Orders order : ordertList) {
|
||||
money = money.add(order.getTotalPrice());
|
||||
}
|
||||
String strMoney = String.valueOf(money);
|
||||
return ResultUtils.success(strMoney);
|
||||
} else if (type.equals("number")) {
|
||||
long count = ordersService.count(queryWrapper);
|
||||
String strNumber = String.valueOf(count);
|
||||
return ResultUtils.success(strNumber);
|
||||
} else {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "type不正确");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -16,18 +16,22 @@ import com.cj.jiaqingjiayi.service.CartService;
|
|||
import com.cj.jiaqingjiayi.mapper.CartMapper;
|
||||
import com.cj.jiaqingjiayi.service.CommoditiesService;
|
||||
import com.cj.jiaqingjiayi.service.UserService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import static com.cj.jiaqingjiayi.contant.UserConstant.USER_LOGIN_STATE;
|
||||
|
||||
/**
|
||||
* @author 高木
|
||||
* @description 针对表【cart(购物车表)】的数据库操作Service实现
|
||||
* @createDate 2024-09-05 15:15:56
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class CartServiceImpl extends ServiceImpl<CartMapper, Cart>
|
||||
implements CartService{
|
||||
|
||||
|
@ -68,7 +72,9 @@ public class CartServiceImpl extends ServiceImpl<CartMapper, Cart>
|
|||
|
||||
@Override
|
||||
public Long addCart(CartAddRequest cartAddRequest, HttpServletRequest request) {
|
||||
// System.out.println("request11111111111111111111111111111:" + request.getSession().getAttribute(USER_LOGIN_STATE));
|
||||
User loginUser = userService.getLoginUser(request);
|
||||
// System.out.println("request22222222222222222222222:" + request.getSession().getAttribute(USER_LOGIN_STATE));
|
||||
Long userId = loginUser.getId();
|
||||
Long businessId = cartAddRequest.getBusinessId();
|
||||
Long commoditiesId = cartAddRequest.getCommoditiesId();
|
||||
|
|
|
@ -181,6 +181,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User>
|
|||
@Override
|
||||
public User getLoginUser(HttpServletRequest request) {
|
||||
Object userObj = request.getSession().getAttribute(USER_LOGIN_STATE);
|
||||
System.out.println("request11111111111111111111111111111:" + request.getSession().getAttribute(USER_LOGIN_STATE));
|
||||
User currentUser = (User) userObj;
|
||||
|
||||
if(currentUser == null){
|
||||
|
|
Loading…
Reference in New Issue
Block a user