添加注解
This commit is contained in:
parent
c5f84d2f05
commit
e9f6a219c6
|
@ -35,6 +35,7 @@ public class AIConfig {
|
|||
return builder.defaultSystem(
|
||||
"""
|
||||
你是食刻必达校快送小程序的助手,情谊轻松切愉快的语气与用户交流。
|
||||
你可以给用户推荐一些商家和菜品
|
||||
今天的日期是{current_date}。
|
||||
请讲中文。
|
||||
"""
|
||||
|
@ -59,7 +60,7 @@ public class AIConfig {
|
|||
|
||||
// @Bean
|
||||
// @Description("推荐菜品")
|
||||
// public Function<Void, List<Dishes>> getDishesByOrders() {
|
||||
// List<Orders> ordersList = ordersService.list();
|
||||
// public Function<Void, List<Dishes>> getDishesByAI() {
|
||||
// new LocalTime
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.bsz.school_send_back_end.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.ai.chat.client.ChatClient;
|
||||
import org.springframework.ai.chat.client.advisor.AbstractChatMemoryAdvisor;
|
||||
|
@ -12,6 +13,7 @@ import reactor.core.publisher.Flux;
|
|||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Tag(name = "ai接口")
|
||||
@RestController
|
||||
@RequestMapping("/ai")
|
||||
public class AIController {
|
||||
|
|
|
@ -12,6 +12,7 @@ import com.bsz.school_send_back_end.model.domain.Orders;
|
|||
import com.bsz.school_send_back_end.service.ErrandBillService;
|
||||
import com.bsz.school_send_back_end.service.ErrandService;
|
||||
import com.bsz.school_send_back_end.service.OrdersService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
@ -19,11 +20,11 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Tag(name = "跑腿流水接口")
|
||||
@RestController
|
||||
@RequestMapping("/bill")
|
||||
@Slf4j
|
||||
|
@ -50,6 +51,11 @@ public class BillController {
|
|||
LambdaQueryWrapper<Orders> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(Orders::getErrandId, loginErrand.getId());
|
||||
List<Orders> ordersList = ordersService.list(wrapper);
|
||||
|
||||
// 如果订单列表为空,直接返回空结果
|
||||
if (ordersList.isEmpty()) {
|
||||
return ResultUtils.success(Collections.emptyList());
|
||||
}
|
||||
List<Long> orderIds = ordersList.stream()
|
||||
.map(Orders::getId)
|
||||
.collect(Collectors.toList());
|
||||
|
|
|
@ -26,6 +26,8 @@ import com.bsz.school_send_back_end.service.BusinessAuthService;
|
|||
import com.bsz.school_send_back_end.service.BusinessService;
|
||||
import com.bsz.school_send_back_end.service.CollectService;
|
||||
import com.bsz.school_send_back_end.service.UserService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jdk.jfr.Timestamp;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
@ -43,6 +45,7 @@ import static com.bsz.school_send_back_end.contant.UserConstant.USER_SALT;
|
|||
/**
|
||||
* 商家接口
|
||||
*/
|
||||
@Tag(name = "商家接口")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/business")
|
||||
|
|
|
@ -19,6 +19,7 @@ import com.bsz.school_send_back_end.model.dto.businessinfo.InfoQueryRequest;
|
|||
import com.bsz.school_send_back_end.service.BusinessService;
|
||||
import com.bsz.school_send_back_end.service.BusinessinfoService;
|
||||
import com.github.houbb.sensitive.word.core.SensitiveWordHelper;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
@ -30,6 +31,7 @@ import jakarta.annotation.Resource;
|
|||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
@Tag(name = "商家公告接口")
|
||||
@RestController
|
||||
@Slf4j
|
||||
@RequestMapping("/businessInfo")
|
||||
|
|
|
@ -15,6 +15,7 @@ import com.bsz.school_send_back_end.model.dto.cart.CartUpdateRequest;
|
|||
import com.bsz.school_send_back_end.model.vo.CartVO;
|
||||
import com.bsz.school_send_back_end.service.CartService;
|
||||
import com.bsz.school_send_back_end.service.UserService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
@ -27,6 +28,7 @@ import jakarta.annotation.Resource;
|
|||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
@Tag(name = "购物车接口")
|
||||
@RestController
|
||||
@Slf4j
|
||||
@RequestMapping("/cart")
|
||||
|
|
|
@ -15,6 +15,7 @@ import com.bsz.school_send_back_end.model.dto.category.CategoryDeleteRequest;
|
|||
import com.bsz.school_send_back_end.model.dto.category.CategoryUpdateRequest;
|
||||
import com.bsz.school_send_back_end.service.BusinessService;
|
||||
import com.bsz.school_send_back_end.service.CategoryService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
@ -22,6 +23,7 @@ import org.springframework.web.bind.annotation.*;
|
|||
import jakarta.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Tag(name = "餐厅接口")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/category")
|
||||
|
|
|
@ -13,6 +13,7 @@ import com.bsz.school_send_back_end.model.dto.collect.CollectAddRequest;
|
|||
import com.bsz.school_send_back_end.model.vo.CollectVO;
|
||||
import com.bsz.school_send_back_end.service.CollectService;
|
||||
import com.bsz.school_send_back_end.service.UserService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
@ -25,6 +26,7 @@ import jakarta.servlet.http.HttpServletRequest;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Tag(name = "收藏接口")
|
||||
@RestController
|
||||
@Slf4j
|
||||
@RequestMapping("/collect")
|
||||
|
|
|
@ -23,6 +23,7 @@ import com.bsz.school_send_back_end.model.vo.DishesVO;
|
|||
import com.bsz.school_send_back_end.service.BusinessService;
|
||||
import com.bsz.school_send_back_end.service.DishesService;
|
||||
import com.bsz.school_send_back_end.service.SpecificationsDishesService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
@ -33,6 +34,7 @@ import jakarta.annotation.Resource;
|
|||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
@Tag(name = "菜品接口")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/dishes")
|
||||
|
|
|
@ -21,6 +21,7 @@ import com.bsz.school_send_back_end.model.dto.DishesGroup.DishesGroupUpdateReque
|
|||
import com.bsz.school_send_back_end.service.BusinessService;
|
||||
import com.bsz.school_send_back_end.service.DishesGroupService;
|
||||
import com.bsz.school_send_back_end.service.DishesService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
@ -33,6 +34,7 @@ import jakarta.annotation.Resource;
|
|||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
@Tag(name = "菜品分组接口")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/dishesGroup")
|
||||
|
|
|
@ -17,6 +17,7 @@ import com.bsz.school_send_back_end.model.dto.errandAtuh.ErrandAuthAddRequest;
|
|||
import com.bsz.school_send_back_end.model.dto.errandAtuh.ErrandAuthQueryRequest;
|
||||
import com.bsz.school_send_back_end.service.ErrandAuthService;
|
||||
import com.bsz.school_send_back_end.service.ErrandService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
@ -24,6 +25,7 @@ import org.springframework.web.bind.annotation.*;
|
|||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
|
||||
@Tag(name = "快送员认证接口")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/errandAuth")
|
||||
|
|
|
@ -21,6 +21,7 @@ import com.bsz.school_send_back_end.model.dto.errand.ErrandUpdateRequest;
|
|||
import com.bsz.school_send_back_end.model.vo.ErrandVO;
|
||||
import com.bsz.school_send_back_end.model.vo.OrdersVO;
|
||||
import com.bsz.school_send_back_end.service.*;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
@ -40,6 +41,7 @@ import java.util.stream.Collectors;
|
|||
|
||||
import static com.bsz.school_send_back_end.contant.UserConstant.*;
|
||||
|
||||
@Tag(name = "快送员接口")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/errand")
|
||||
|
|
|
@ -18,6 +18,7 @@ import com.bsz.school_send_back_end.model.dto.erradnIncome.ErrandIncomeQueryRequ
|
|||
import com.bsz.school_send_back_end.service.ErrandIncomeService;
|
||||
import com.bsz.school_send_back_end.service.ErrandService;
|
||||
import com.bsz.school_send_back_end.service.UserService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
@ -27,6 +28,7 @@ import java.math.BigDecimal;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Tag(name = "快送员收入接口")
|
||||
@RestController
|
||||
@Slf4j
|
||||
@RequestMapping("/errandIncome")
|
||||
|
|
|
@ -10,6 +10,7 @@ import com.bsz.school_send_back_end.model.domain.User;
|
|||
import com.bsz.school_send_back_end.model.dto.file.UploadFileRequest;
|
||||
import com.bsz.school_send_back_end.model.enums.FileUploadBizEnum;
|
||||
import com.bsz.school_send_back_end.service.UserService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.RandomStringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
@ -24,6 +25,7 @@ import java.util.Arrays;
|
|||
/**
|
||||
* 文件上传
|
||||
*/
|
||||
@Tag(name = "文件上传接口")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/file")
|
||||
|
|
|
@ -46,6 +46,7 @@ import java.util.stream.Collectors;
|
|||
/**
|
||||
* 订单相关接口
|
||||
**/
|
||||
@Tag(name = "订单相关接口")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Tag(name = "订单接口")
|
||||
|
|
|
@ -7,12 +7,13 @@ import com.bsz.school_send_back_end.service.OssService;
|
|||
import com.bsz.school_send_back_end.common.ResultUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
|
||||
@Api(tags = "阿里云文件管理")
|
||||
@Tag(name = "阿里云文件上传接口")
|
||||
@RestController
|
||||
@RequestMapping("/fileOss")
|
||||
public class OssController {
|
||||
|
|
|
@ -2,11 +2,13 @@ package com.bsz.school_send_back_end.controller;
|
|||
|
||||
import com.bsz.school_send_back_end.model.domain.PrivateMessage;
|
||||
import com.bsz.school_send_back_end.service.WebsocketService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.messaging.handler.annotation.MessageMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
|
||||
@Tag(name = "聊天接口")
|
||||
@RestController
|
||||
public class PrivateChatController {
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ import com.bsz.school_send_back_end.model.domain.PrivateMessage;
|
|||
import com.bsz.school_send_back_end.model.domain.User;
|
||||
import com.bsz.school_send_back_end.service.PrivateMessageService;
|
||||
import com.bsz.school_send_back_end.service.UserService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.messaging.simp.SimpMessagingTemplate;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
@ -18,6 +19,7 @@ import jakarta.annotation.Resource;
|
|||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Tag(name = "私聊")
|
||||
@RestController
|
||||
@RequestMapping("/PrivateMessage")
|
||||
public class PrivateMessageController {
|
||||
|
|
|
@ -19,6 +19,7 @@ import com.bsz.school_send_back_end.service.BusinessService;
|
|||
import com.bsz.school_send_back_end.service.OrderRefundsService;
|
||||
import com.bsz.school_send_back_end.service.OrdersService;
|
||||
import com.bsz.school_send_back_end.service.UserService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
@ -32,6 +33,7 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Tag(name = "退款接口")
|
||||
@RestController
|
||||
@RequestMapping("/refund")
|
||||
public class RefundController {
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.bsz.school_send_back_end.common.BaseResponse;
|
|||
import com.bsz.school_send_back_end.common.ResultUtils;
|
||||
import com.bsz.school_send_back_end.utils.AliyunSmsUtils;
|
||||
import com.bsz.school_send_back_end.utils.RandomNumberGenerator;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
@ -15,6 +16,7 @@ import jakarta.annotation.Resource;
|
|||
import java.util.HashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Tag(name = "阿里云短信接口")
|
||||
@RestController
|
||||
@Slf4j
|
||||
@RequestMapping("/sms")
|
||||
|
|
|
@ -11,6 +11,7 @@ import com.bsz.school_send_back_end.model.dto.CommonRequest;
|
|||
import com.bsz.school_send_back_end.model.dto.system.SystemAddRequest;
|
||||
import com.bsz.school_send_back_end.model.dto.system.SystemQueryRequest;
|
||||
import com.bsz.school_send_back_end.service.SysteminfoService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
@ -21,6 +22,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
import jakarta.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Tag(name = "公告与轮播图接口")
|
||||
@RestController
|
||||
@Slf4j
|
||||
@RequestMapping("/system")
|
||||
|
|
|
@ -15,6 +15,7 @@ import com.bsz.school_send_back_end.model.dto.log.LogQueryRequest;
|
|||
import com.bsz.school_send_back_end.model.vo.BusinessLogVO;
|
||||
import com.bsz.school_send_back_end.service.BusinessService;
|
||||
import com.bsz.school_send_back_end.service.SystemlogService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
@ -27,6 +28,7 @@ import jakarta.annotation.Resource;
|
|||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Tag(name = "系统日志接口")
|
||||
@RestController
|
||||
@RequestMapping("/log")
|
||||
@Slf4j
|
||||
|
|
|
@ -27,6 +27,7 @@ import com.bsz.school_send_back_end.model.vo.UserVO;
|
|||
import com.bsz.school_send_back_end.service.*;
|
||||
import com.bsz.school_send_back_end.utils.RandomNumberGenerator;
|
||||
import com.bsz.school_send_back_end.utils.UniqueNumberGenerator;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
@ -40,6 +41,7 @@ import jakarta.servlet.http.HttpServletResponse;
|
|||
import java.io.PrintWriter;
|
||||
import java.util.*;
|
||||
|
||||
@Tag(name = "支付宝支付相关接口")
|
||||
@RestController
|
||||
@Slf4j
|
||||
@RequestMapping("/Alipay")
|
||||
|
|
|
@ -16,6 +16,7 @@ import com.bsz.school_send_back_end.mapper.UserMapper;
|
|||
import com.bsz.school_send_back_end.model.domain.User;
|
||||
import com.bsz.school_send_back_end.service.UserService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.util.DigestUtils;
|
||||
|
@ -32,6 +33,7 @@ import static com.bsz.school_send_back_end.contant.UserConstant.*;
|
|||
/**
|
||||
* 用户接口
|
||||
*/
|
||||
@Tag(name = "用户接口")
|
||||
@RestController
|
||||
@RequestMapping("/user")
|
||||
public class UserController {
|
||||
|
|
|
@ -17,6 +17,7 @@ import com.bsz.school_send_back_end.model.dto.userRating.UserRatingAddRequest;
|
|||
import com.bsz.school_send_back_end.model.dto.userRating.UserRatingReviewRequest;
|
||||
import com.bsz.school_send_back_end.service.UserRatingService;
|
||||
import com.bsz.school_send_back_end.service.UserService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
@ -28,6 +29,7 @@ import jakarta.annotation.Resource;
|
|||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
@Tag(name = "用户评分接口")
|
||||
@RestController
|
||||
@Slf4j
|
||||
@RequestMapping("/level")
|
||||
|
|
|
@ -72,12 +72,17 @@ public class RabbitMQSender {
|
|||
// 延迟检查订单状态信息
|
||||
MultiDelayMessage<Long> msg = new MultiDelayMessage<>(orderId, newDelayMillis);
|
||||
int delayValue = msg.removeNextDelay().intValue();
|
||||
rabbitTemplate.convertAndSend(RabbitMQConstant.CANCEL_ORDER_EXCHANGE,
|
||||
RabbitMQConstant.CANCEL_ORDER_ROUTING_KEY, msg, message -> {
|
||||
// 添加延迟消息属性
|
||||
message.getMessageProperties().setDelay(delayValue);
|
||||
rabbitTemplate.convertAndSend(
|
||||
RabbitMQConstant.CANCEL_ORDER_EXCHANGE,
|
||||
RabbitMQConstant.CANCEL_ORDER_ROUTING_KEY,
|
||||
msg,
|
||||
message -> {
|
||||
// 新版本设置延迟时间的方式
|
||||
message.getMessageProperties()
|
||||
.setHeader("x-delay", delayValue); // 单位:毫秒
|
||||
return message;
|
||||
});
|
||||
}
|
||||
);
|
||||
log.info("发送成功,orderID:{}", orderId);
|
||||
}
|
||||
//自动退款30分钟未接单的
|
||||
|
@ -86,11 +91,18 @@ public class RabbitMQSender {
|
|||
MultiDelayMessage msg = new MultiDelayMessage<>(orderId, newDelayMillis);
|
||||
int delayValue = msg.removeNextDelay().intValue();
|
||||
|
||||
rabbitTemplate.convertAndSend(RabbitMQConstant.DELIVERY_DELAY_EXCHANGE,
|
||||
RabbitMQConstant.DELIVERY_ORDER_ROUTING_KEY, msg, message -> {
|
||||
message.getMessageProperties().setDelay(delayValue);
|
||||
rabbitTemplate.convertAndSend(
|
||||
RabbitMQConstant.DELIVERY_DELAY_EXCHANGE,
|
||||
RabbitMQConstant.DELIVERY_ORDER_ROUTING_KEY,
|
||||
msg,
|
||||
message -> {
|
||||
// 新版使用x-delay头设置延迟
|
||||
message.getMessageProperties()
|
||||
.setHeader("x-delay", delayValue); // 单位毫秒
|
||||
return message;
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
log.info("外卖单延迟消息发送成功,订单ID:{}", orderId);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,8 +9,8 @@ import org.apache.ibatis.annotations.Select;
|
|||
* @author xy
|
||||
*/
|
||||
public interface UserRatingMapper extends BaseMapper<UserRating> {
|
||||
// @Select("select avg(rating) from school_send.user_rating where businessId = #{businessId}")
|
||||
@Select("select avg(rating) from xiaokuaisong.user_rating where ratedEntityId = #{ratedEntityId}")
|
||||
@Select("select avg(rating) from school_send.user_rating where ratedEntityId = #{ratedEntityId}")
|
||||
// @Select("select avg(rating) from xiaokuaisong.user_rating where ratedEntityId = #{ratedEntityId}")
|
||||
Double findAvgByRatedEntityId(@Param("ratedEntityId") Long ratedEntityId);
|
||||
|
||||
}
|
||||
|
|
|
@ -79,7 +79,8 @@ public class Orders implements Serializable {
|
|||
/**
|
||||
* 取餐时间
|
||||
*/
|
||||
private Date pickupTime;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private LocalDateTime pickupTime;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
|
|
|
@ -12,11 +12,6 @@ public class UserVO implements Serializable {
|
|||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 支付宝开放平台id
|
||||
*/
|
||||
private String unionId;
|
||||
|
||||
/**
|
||||
* openId
|
||||
*/
|
||||
|
@ -51,11 +46,6 @@ public class UserVO implements Serializable {
|
|||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 邮箱
|
||||
*/
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 状态 0 -正常
|
||||
*/
|
||||
|
|
|
@ -33,6 +33,8 @@ import java.time.LocalDateTime;
|
|||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.bsz.school_send_back_end.contant.UserConstant.DELIVERY_FEE_MAP;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
|
@ -232,19 +234,41 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, Orders>
|
|||
String notes = orderUpdateRequest.getNotes();
|
||||
BigDecimal totalPrice = orders.getTotalPrice();
|
||||
Integer currentPickupMethod = orders.getPickupMethod();
|
||||
if (pickupMethod == 0) {
|
||||
|
||||
if (pickupMethod == 0) {
|
||||
// 转为自取,需要减去相应的费用
|
||||
if (currentPickupMethod == 1 || currentPickupMethod == 2) {
|
||||
BigDecimal newTotalPrice = calculateTotalPrice(orders.getId(), totalPrice, false); // 减去打包费
|
||||
orders.setTotalPrice(newTotalPrice);
|
||||
if (currentPickupMethod == 2) {
|
||||
BigDecimal total = calculateTotal(orders.getId(), newTotalPrice, location, false); //减去配送费
|
||||
orders.setTotalPrice(total);
|
||||
}
|
||||
} else if (pickupMethod == 1 || pickupMethod == 2) {
|
||||
// 当 pickupMethod 从 0 修改为 1 或 2,更新价格并设置相关信息
|
||||
}
|
||||
} else if (pickupMethod == 1) {
|
||||
// 转为外带
|
||||
if (currentPickupMethod == 0) {
|
||||
BigDecimal newTotalPrice = calculateTotalPrice(orders.getId(), totalPrice, true); // 添加打包费
|
||||
// 从自取转为外带,添加打包费
|
||||
BigDecimal newTotalPrice = calculateTotalPrice(orders.getId(), totalPrice, true);
|
||||
orders.setTotalPrice(newTotalPrice);
|
||||
} else if (currentPickupMethod == 2) {
|
||||
// 从配送转为外带,减去配送费,保留打包费
|
||||
BigDecimal newTotalPrice = calculateTotal(orders.getId(), totalPrice, location, false);
|
||||
orders.setTotalPrice(newTotalPrice);
|
||||
}
|
||||
if (pickupMethod == 2) {
|
||||
} else if (pickupMethod == 2) {
|
||||
// 转为配送
|
||||
if (currentPickupMethod == 0) {
|
||||
// 从自取转为配送,添加打包费和配送费
|
||||
BigDecimal newTotalPrice = calculateTotalPrice(orders.getId(), totalPrice, true); // 添加打包费
|
||||
BigDecimal total = calculateTotal(orders.getId(), newTotalPrice, location, true); // 添加配送费
|
||||
orders.setTotalPrice(total);
|
||||
} else if (currentPickupMethod == 1) {
|
||||
// 从外带转为配送,添加配送费,保留打包费
|
||||
BigDecimal total = calculateTotal(orders.getId(), totalPrice, location, true);
|
||||
orders.setTotalPrice(total);
|
||||
}
|
||||
|
||||
// 验证取餐时间和地址
|
||||
this.validateDelivery(location, pickupStartTime);
|
||||
|
||||
|
@ -266,9 +290,8 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, Orders>
|
|||
boolean save = errandOrderService.saveOrUpdate(errandOrder1);
|
||||
ThrowUtils.throwIf(!save, ErrorCode.OPERATION_ERROR, "创建跑腿订单关联失败");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
orders.setPickupMethod(pickupMethod);
|
||||
if (pickupMethod == 0 || pickupMethod == 1) {
|
||||
orders.setLocation(null);
|
||||
|
@ -290,6 +313,7 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, Orders>
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<Orders> findExpiredOrders(LocalDateTime deadline) {
|
||||
return this.lambdaQuery()
|
||||
|
@ -466,4 +490,18 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, Orders>
|
|||
return resultMap;
|
||||
}
|
||||
|
||||
private BigDecimal calculateTotal(Long orderId, BigDecimal totalPrice, String location, boolean add) {
|
||||
Orders orders = this.getById(orderId);
|
||||
log.info("location:{}" , location);
|
||||
BigDecimal pack = DELIVERY_FEE_MAP.get(location);
|
||||
log.info("pack:{}" , pack);
|
||||
if (add) {
|
||||
totalPrice = totalPrice.add(pack);// 确保将结果赋回 totalPrice
|
||||
} else {
|
||||
totalPrice = totalPrice.subtract(pack); // 减去打包费
|
||||
}
|
||||
|
||||
return totalPrice;
|
||||
}
|
||||
|
||||
}
|
|
@ -9,12 +9,12 @@ spring:
|
|||
# url: jdbc:mysql://localhost:3306/school_send
|
||||
# username: root
|
||||
# password: 123456
|
||||
# url: jdbc:mysql://39.101.78.35/school_send
|
||||
# username: school_send
|
||||
# password: 12345678
|
||||
url: jdbc:mysql://154.8.193.216/xiaokuaisong
|
||||
username: xiaokuaisong
|
||||
url: jdbc:mysql://39.101.78.35/school_send
|
||||
username: school_send
|
||||
password: 12345678
|
||||
# url: jdbc:mysql://154.8.193.216/xiaokuaisong
|
||||
# username: xiaokuaisong
|
||||
# password: 12345678
|
||||
# mvc:
|
||||
# pathmatch:
|
||||
# matching-strategy: ant_path_matcher
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
package com.bsz.school_send_back_end;
|
||||
|
||||
import com.bsz.school_send_back_end.contant.UserConstant;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.util.DigestUtils;
|
||||
|
||||
|
||||
|
||||
@SpringBootTest
|
||||
public class Test {
|
||||
|
||||
@org.junit.Test
|
||||
public void password() {
|
||||
String pas1 = "Hzn040128@";
|
||||
String pas2 = "Ryx040813@";
|
||||
String pas3 = "Zxr040805@";
|
||||
System.out.println(DigestUtils.md5DigestAsHex((UserConstant.USER_SALT + pas1).getBytes()));
|
||||
System.out.println(DigestUtils.md5DigestAsHex((UserConstant.USER_SALT + pas2).getBytes()));
|
||||
System.out.println(DigestUtils.md5DigestAsHex((UserConstant.USER_SALT + pas3).getBytes()));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user