Commit a5543e29205911fc16ef924f798a02f8f69de78b
0 parents
初始化项目
Showing
100 changed files
with
3846 additions
and
0 deletions
Too many changes to show.
To preserve performance only 100 of 158 files are displayed.
.gitignore
0 → 100644
pom.xml
0 → 100644
| 1 | +++ a/pom.xml | ||
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
| 3 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| 4 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| 5 | + <modelVersion>4.0.0</modelVersion> | ||
| 6 | + | ||
| 7 | + <parent> | ||
| 8 | + <groupId>org.springframework.boot</groupId> | ||
| 9 | + <artifactId>spring-boot-starter-parent</artifactId> | ||
| 10 | + <version>3.2.0</version> | ||
| 11 | + <relativePath/> | ||
| 12 | + </parent> | ||
| 13 | + | ||
| 14 | + <groupId>com.diligrp.tms</groupId> | ||
| 15 | + <artifactId>rider-service</artifactId> | ||
| 16 | + <version>1.0.0</version> | ||
| 17 | + <name>rider-service</name> | ||
| 18 | + <description>地利外卖骑手配送系统</description> | ||
| 19 | + | ||
| 20 | + <properties> | ||
| 21 | + <java.version>17</java.version> | ||
| 22 | + <mybatis-plus.version>3.5.7</mybatis-plus.version> | ||
| 23 | + </properties> | ||
| 24 | + | ||
| 25 | + <dependencies> | ||
| 26 | + <!-- Spring Boot Web --> | ||
| 27 | + <dependency> | ||
| 28 | + <groupId>org.springframework.boot</groupId> | ||
| 29 | + <artifactId>spring-boot-starter-web</artifactId> | ||
| 30 | + </dependency> | ||
| 31 | + | ||
| 32 | + <!-- MyBatis-Plus (Spring Boot 3 专用 starter) --> | ||
| 33 | + <dependency> | ||
| 34 | + <groupId>com.baomidou</groupId> | ||
| 35 | + <artifactId>mybatis-plus-spring-boot3-starter</artifactId> | ||
| 36 | + <version>${mybatis-plus.version}</version> | ||
| 37 | + </dependency> | ||
| 38 | + | ||
| 39 | + <!-- MySQL --> | ||
| 40 | + <dependency> | ||
| 41 | + <groupId>com.mysql</groupId> | ||
| 42 | + <artifactId>mysql-connector-j</artifactId> | ||
| 43 | + <scope>runtime</scope> | ||
| 44 | + </dependency> | ||
| 45 | + | ||
| 46 | + <!-- Redis --> | ||
| 47 | + <dependency> | ||
| 48 | + <groupId>org.springframework.boot</groupId> | ||
| 49 | + <artifactId>spring-boot-starter-data-redis</artifactId> | ||
| 50 | + </dependency> | ||
| 51 | + | ||
| 52 | + <!-- Validation --> | ||
| 53 | + <dependency> | ||
| 54 | + <groupId>org.springframework.boot</groupId> | ||
| 55 | + <artifactId>spring-boot-starter-validation</artifactId> | ||
| 56 | + </dependency> | ||
| 57 | + | ||
| 58 | + <!-- Lombok --> | ||
| 59 | + <dependency> | ||
| 60 | + <groupId>org.projectlombok</groupId> | ||
| 61 | + <artifactId>lombok</artifactId> | ||
| 62 | + <optional>true</optional> | ||
| 63 | + </dependency> | ||
| 64 | + | ||
| 65 | + <!-- JWT --> | ||
| 66 | + <dependency> | ||
| 67 | + <groupId>io.jsonwebtoken</groupId> | ||
| 68 | + <artifactId>jjwt-api</artifactId> | ||
| 69 | + <version>0.11.5</version> | ||
| 70 | + </dependency> | ||
| 71 | + <dependency> | ||
| 72 | + <groupId>io.jsonwebtoken</groupId> | ||
| 73 | + <artifactId>jjwt-impl</artifactId> | ||
| 74 | + <version>0.11.5</version> | ||
| 75 | + <scope>runtime</scope> | ||
| 76 | + </dependency> | ||
| 77 | + <dependency> | ||
| 78 | + <groupId>io.jsonwebtoken</groupId> | ||
| 79 | + <artifactId>jjwt-jackson</artifactId> | ||
| 80 | + <version>0.11.5</version> | ||
| 81 | + <scope>runtime</scope> | ||
| 82 | + </dependency> | ||
| 83 | + | ||
| 84 | + <!-- Test --> | ||
| 85 | + <dependency> | ||
| 86 | + <groupId>org.springframework.boot</groupId> | ||
| 87 | + <artifactId>spring-boot-starter-test</artifactId> | ||
| 88 | + <scope>test</scope> | ||
| 89 | + </dependency> | ||
| 90 | + </dependencies> | ||
| 91 | + | ||
| 92 | + <build> | ||
| 93 | + <plugins> | ||
| 94 | + <plugin> | ||
| 95 | + <groupId>org.springframework.boot</groupId> | ||
| 96 | + <artifactId>spring-boot-maven-plugin</artifactId> | ||
| 97 | + <configuration> | ||
| 98 | + <excludes> | ||
| 99 | + <exclude> | ||
| 100 | + <groupId>org.projectlombok</groupId> | ||
| 101 | + <artifactId>lombok</artifactId> | ||
| 102 | + </exclude> | ||
| 103 | + </excludes> | ||
| 104 | + </configuration> | ||
| 105 | + </plugin> | ||
| 106 | + </plugins> | ||
| 107 | + </build> | ||
| 108 | +</project> |
src/main/java/com/diligrp/rider/RiderServiceApplication.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/RiderServiceApplication.java | ||
| 1 | +package com.diligrp.rider; | ||
| 2 | + | ||
| 3 | +import org.mybatis.spring.annotation.MapperScan; | ||
| 4 | +import org.springframework.boot.SpringApplication; | ||
| 5 | +import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
| 6 | +import org.springframework.scheduling.annotation.EnableAsync; | ||
| 7 | + | ||
| 8 | +@SpringBootApplication | ||
| 9 | +@MapperScan("com.diligrp.rider.mapper") | ||
| 10 | +@EnableAsync | ||
| 11 | +public class RiderServiceApplication { | ||
| 12 | + public static void main(String[] args) { | ||
| 13 | + SpringApplication.run(RiderServiceApplication.class, args); | ||
| 14 | + } | ||
| 15 | +} |
src/main/java/com/diligrp/rider/common/enums/IncomeStatusEnum.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/common/enums/IncomeStatusEnum.java | ||
| 1 | +package com.diligrp.rider.common.enums; | ||
| 2 | + | ||
| 3 | +import lombok.Getter; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * 结算状态枚举 | ||
| 7 | + * 0=未结算 1=待结算 2=已结算 | ||
| 8 | + */ | ||
| 9 | +@Getter | ||
| 10 | +public enum IncomeStatusEnum { | ||
| 11 | + NOT_SETTLED(0, "未结算"), | ||
| 12 | + PENDING(1, "待结算"), | ||
| 13 | + SETTLED(2, "已结算"); | ||
| 14 | + | ||
| 15 | + private final int code; | ||
| 16 | + private final String desc; | ||
| 17 | + | ||
| 18 | + IncomeStatusEnum(int code, String desc) { | ||
| 19 | + this.code = code; | ||
| 20 | + this.desc = desc; | ||
| 21 | + } | ||
| 22 | +} |
src/main/java/com/diligrp/rider/common/enums/OrderStatusEnum.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/common/enums/OrderStatusEnum.java | ||
| 1 | +package com.diligrp.rider.common.enums; | ||
| 2 | + | ||
| 3 | +import lombok.Getter; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * 订单状态枚举 | ||
| 7 | + * 1=待支付 2=已支付 3=已接单 4=服务中 6=已完成 | ||
| 8 | + * 7=退款申请 8=退款成功 9=退款拒绝 10=已取消 | ||
| 9 | + */ | ||
| 10 | +@Getter | ||
| 11 | +public enum OrderStatusEnum { | ||
| 12 | + WAIT_PAY(1, "待支付"), | ||
| 13 | + PAID(2, "已支付"), | ||
| 14 | + ACCEPTED(3, "已接单"), | ||
| 15 | + IN_SERVICE(4, "服务中"), | ||
| 16 | + COMPLETED(6, "已完成"), | ||
| 17 | + REFUND_APPLY(7, "退款申请"), | ||
| 18 | + REFUND_SUCCESS(8, "退款成功"), | ||
| 19 | + REFUND_REJECT(9, "退款拒绝"), | ||
| 20 | + CANCELLED(10, "已取消"); | ||
| 21 | + | ||
| 22 | + private final int code; | ||
| 23 | + private final String desc; | ||
| 24 | + | ||
| 25 | + OrderStatusEnum(int code, String desc) { | ||
| 26 | + this.code = code; | ||
| 27 | + this.desc = desc; | ||
| 28 | + } | ||
| 29 | +} |
src/main/java/com/diligrp/rider/common/enums/RiderStatusEnum.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/common/enums/RiderStatusEnum.java | ||
| 1 | +package com.diligrp.rider.common.enums; | ||
| 2 | + | ||
| 3 | +import lombok.Getter; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * 骑手状态枚举 | ||
| 7 | + * 0=拒绝 1=通过 2=待审核 | ||
| 8 | + */ | ||
| 9 | +@Getter | ||
| 10 | +public enum RiderStatusEnum { | ||
| 11 | + REJECTED(0, "拒绝"), | ||
| 12 | + APPROVED(1, "通过"), | ||
| 13 | + PENDING(2, "待审核"); | ||
| 14 | + | ||
| 15 | + private final int code; | ||
| 16 | + private final String desc; | ||
| 17 | + | ||
| 18 | + RiderStatusEnum(int code, String desc) { | ||
| 19 | + this.code = code; | ||
| 20 | + this.desc = desc; | ||
| 21 | + } | ||
| 22 | +} |
src/main/java/com/diligrp/rider/common/enums/TransStatusEnum.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/common/enums/TransStatusEnum.java | ||
| 1 | +package com.diligrp.rider.common.enums; | ||
| 2 | + | ||
| 3 | +import lombok.Getter; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * 转单状态枚举 | ||
| 7 | + * 0=未转单 1=转单申请通过 2=转单申请中 3=转单申请拒绝 | ||
| 8 | + */ | ||
| 9 | +@Getter | ||
| 10 | +public enum TransStatusEnum { | ||
| 11 | + NONE(0, "未转单"), | ||
| 12 | + APPROVED(1, "转单申请通过"), | ||
| 13 | + PENDING(2, "转单申请中"), | ||
| 14 | + REJECTED(3, "转单申请拒绝"); | ||
| 15 | + | ||
| 16 | + private final int code; | ||
| 17 | + private final String desc; | ||
| 18 | + | ||
| 19 | + TransStatusEnum(int code, String desc) { | ||
| 20 | + this.code = code; | ||
| 21 | + this.desc = desc; | ||
| 22 | + } | ||
| 23 | +} |
src/main/java/com/diligrp/rider/common/exception/BizException.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/common/exception/BizException.java | ||
| 1 | +package com.diligrp.rider.common.exception; | ||
| 2 | + | ||
| 3 | +import lombok.Getter; | ||
| 4 | + | ||
| 5 | +@Getter | ||
| 6 | +public class BizException extends RuntimeException { | ||
| 7 | + private final int code; | ||
| 8 | + | ||
| 9 | + public BizException(String message) { | ||
| 10 | + super(message); | ||
| 11 | + this.code = 1; | ||
| 12 | + } | ||
| 13 | + | ||
| 14 | + public BizException(int code, String message) { | ||
| 15 | + super(message); | ||
| 16 | + this.code = code; | ||
| 17 | + } | ||
| 18 | +} |
src/main/java/com/diligrp/rider/common/exception/GlobalExceptionHandler.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/common/exception/GlobalExceptionHandler.java | ||
| 1 | +package com.diligrp.rider.common.exception; | ||
| 2 | + | ||
| 3 | +import com.diligrp.rider.common.result.Result; | ||
| 4 | +import lombok.extern.slf4j.Slf4j; | ||
| 5 | +import org.springframework.validation.BindException; | ||
| 6 | +import org.springframework.web.bind.MethodArgumentNotValidException; | ||
| 7 | +import org.springframework.web.bind.annotation.ExceptionHandler; | ||
| 8 | +import org.springframework.web.bind.annotation.RestControllerAdvice; | ||
| 9 | + | ||
| 10 | +@Slf4j | ||
| 11 | +@RestControllerAdvice | ||
| 12 | +public class GlobalExceptionHandler { | ||
| 13 | + | ||
| 14 | + @ExceptionHandler(BizException.class) | ||
| 15 | + public Result<Void> handleBizException(BizException e) { | ||
| 16 | + return Result.error(e.getCode(), e.getMessage()); | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + @ExceptionHandler(MethodArgumentNotValidException.class) | ||
| 20 | + public Result<Void> handleValidException(MethodArgumentNotValidException e) { | ||
| 21 | + String msg = e.getBindingResult().getFieldErrors().stream() | ||
| 22 | + .map(f -> f.getField() + ": " + f.getDefaultMessage()) | ||
| 23 | + .findFirst().orElse("参数错误"); | ||
| 24 | + return Result.error(400, msg); | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + @ExceptionHandler(BindException.class) | ||
| 28 | + public Result<Void> handleBindException(BindException e) { | ||
| 29 | + String msg = e.getFieldErrors().stream() | ||
| 30 | + .map(f -> f.getField() + ": " + f.getDefaultMessage()) | ||
| 31 | + .findFirst().orElse("参数错误"); | ||
| 32 | + return Result.error(400, msg); | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + @ExceptionHandler(Exception.class) | ||
| 36 | + public Result<Void> handleException(Exception e) { | ||
| 37 | + log.error("系统异常", e); | ||
| 38 | + return Result.error(500, "系统内部错误"); | ||
| 39 | + } | ||
| 40 | +} |
src/main/java/com/diligrp/rider/common/result/Result.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/common/result/Result.java | ||
| 1 | +package com.diligrp.rider.common.result; | ||
| 2 | + | ||
| 3 | +import lombok.Data; | ||
| 4 | + | ||
| 5 | +@Data | ||
| 6 | +public class Result<T> { | ||
| 7 | + private int code; | ||
| 8 | + private String msg; | ||
| 9 | + private T data; | ||
| 10 | + | ||
| 11 | + private Result(int code, String msg, T data) { | ||
| 12 | + this.code = code; | ||
| 13 | + this.msg = msg; | ||
| 14 | + this.data = data; | ||
| 15 | + } | ||
| 16 | + | ||
| 17 | + public static <T> Result<T> success(T data) { | ||
| 18 | + return new Result<>(0, "success", data); | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + public static <T> Result<T> success() { | ||
| 22 | + return new Result<>(0, "success", null); | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + public static <T> Result<T> error(int code, String msg) { | ||
| 26 | + return new Result<>(code, msg, null); | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + public static <T> Result<T> error(String msg) { | ||
| 30 | + return new Result<>(1, msg, null); | ||
| 31 | + } | ||
| 32 | +} |
src/main/java/com/diligrp/rider/config/AuthInterceptor.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/config/AuthInterceptor.java | ||
| 1 | +package com.diligrp.rider.config; | ||
| 2 | + | ||
| 3 | +import com.fasterxml.jackson.databind.ObjectMapper; | ||
| 4 | +import com.diligrp.rider.common.exception.BizException; | ||
| 5 | +import com.diligrp.rider.common.result.Result; | ||
| 6 | +import com.diligrp.rider.entity.Substation; | ||
| 7 | +import com.diligrp.rider.mapper.SubstationMapper; | ||
| 8 | +import jakarta.servlet.http.HttpServletRequest; | ||
| 9 | +import jakarta.servlet.http.HttpServletResponse; | ||
| 10 | +import lombok.RequiredArgsConstructor; | ||
| 11 | +import org.springframework.stereotype.Component; | ||
| 12 | +import org.springframework.util.StringUtils; | ||
| 13 | +import org.springframework.web.servlet.HandlerInterceptor; | ||
| 14 | + | ||
| 15 | +@Component | ||
| 16 | +@RequiredArgsConstructor | ||
| 17 | +public class AuthInterceptor implements HandlerInterceptor { | ||
| 18 | + | ||
| 19 | + private final JwtUtil jwtUtil; | ||
| 20 | + private final ObjectMapper objectMapper; | ||
| 21 | + private final SubstationMapper substationMapper; | ||
| 22 | + | ||
| 23 | + @Override | ||
| 24 | + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { | ||
| 25 | + String token = request.getHeader("Authorization"); | ||
| 26 | + if (!StringUtils.hasText(token)) { | ||
| 27 | + token = request.getParameter("token"); | ||
| 28 | + } | ||
| 29 | + if (!StringUtils.hasText(token)) { | ||
| 30 | + writeError(response, 700, "请先登录"); | ||
| 31 | + return false; | ||
| 32 | + } | ||
| 33 | + if (token.startsWith("Bearer ")) { | ||
| 34 | + token = token.substring(7); | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + String path = request.getRequestURI(); | ||
| 38 | + | ||
| 39 | + try { | ||
| 40 | + io.jsonwebtoken.Claims claims = jwtUtil.getAdminClaims(token); | ||
| 41 | + | ||
| 42 | + if (claims.get("adminId") != null) { | ||
| 43 | + // 管理员 token | ||
| 44 | + Long adminId = ((Number) claims.get("adminId")).longValue(); | ||
| 45 | + String role = (String) claims.get("role"); | ||
| 46 | + | ||
| 47 | + // /api/platform/** 仅超级管理员可访问 | ||
| 48 | + if (path.startsWith("/api/platform/") && !"admin".equals(role)) { | ||
| 49 | + writeError(response, 403, "权限不足,需要超级管理员权限"); | ||
| 50 | + return false; | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + request.setAttribute("adminId", adminId); | ||
| 54 | + request.setAttribute("role", role); | ||
| 55 | + | ||
| 56 | + // 分站管理员:注入 cityId 供 Service 层做城市隔离 | ||
| 57 | + if ("substation".equals(role)) { | ||
| 58 | + Substation sub = substationMapper.selectById(adminId); | ||
| 59 | + if (sub != null) { | ||
| 60 | + request.setAttribute("cityId", sub.getCityId()); | ||
| 61 | + } | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + } else if (claims.get("riderId") != null) { | ||
| 65 | + // 骑手 token | ||
| 66 | + request.setAttribute("riderId", ((Number) claims.get("riderId")).longValue()); | ||
| 67 | + if (claims.get("cityId") != null) { | ||
| 68 | + request.setAttribute("cityId", ((Number) claims.get("cityId")).longValue()); | ||
| 69 | + } | ||
| 70 | + } else { | ||
| 71 | + writeError(response, 700, "登录状态失效,请重新登录"); | ||
| 72 | + return false; | ||
| 73 | + } | ||
| 74 | + } catch (BizException e) { | ||
| 75 | + writeError(response, e.getCode(), e.getMessage()); | ||
| 76 | + return false; | ||
| 77 | + } | ||
| 78 | + return true; | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + private void writeError(HttpServletResponse response, int code, String msg) throws Exception { | ||
| 82 | + response.setContentType("application/json;charset=UTF-8"); | ||
| 83 | + response.getWriter().write(objectMapper.writeValueAsString(Result.error(code, msg))); | ||
| 84 | + } | ||
| 85 | +} |
src/main/java/com/diligrp/rider/config/CorsConfig.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/config/CorsConfig.java | ||
| 1 | +package com.diligrp.rider.config; | ||
| 2 | + | ||
| 3 | +import org.springframework.context.annotation.Bean; | ||
| 4 | +import org.springframework.context.annotation.Configuration; | ||
| 5 | +import org.springframework.web.cors.CorsConfiguration; | ||
| 6 | +import org.springframework.web.cors.UrlBasedCorsConfigurationSource; | ||
| 7 | +import org.springframework.web.filter.CorsFilter; | ||
| 8 | + | ||
| 9 | +@Configuration | ||
| 10 | +public class CorsConfig { | ||
| 11 | + | ||
| 12 | + @Bean | ||
| 13 | + public CorsFilter corsFilter() { | ||
| 14 | + CorsConfiguration config = new CorsConfiguration(); | ||
| 15 | + // 允许的来源(开发环境放开,生产环境改为具体域名) | ||
| 16 | + config.addAllowedOriginPattern("*"); | ||
| 17 | + config.addAllowedHeader("*"); | ||
| 18 | + config.addAllowedMethod("*"); | ||
| 19 | + config.setAllowCredentials(true); | ||
| 20 | + config.setMaxAge(3600L); | ||
| 21 | + | ||
| 22 | + UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); | ||
| 23 | + source.registerCorsConfiguration("/**", config); | ||
| 24 | + return new CorsFilter(source); | ||
| 25 | + } | ||
| 26 | +} |
src/main/java/com/diligrp/rider/config/JwtUtil.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/config/JwtUtil.java | ||
| 1 | +package com.diligrp.rider.config; | ||
| 2 | + | ||
| 3 | +import com.diligrp.rider.common.exception.BizException; | ||
| 4 | +import io.jsonwebtoken.*; | ||
| 5 | +import io.jsonwebtoken.security.Keys; | ||
| 6 | +import org.springframework.beans.factory.annotation.Value; | ||
| 7 | +import org.springframework.stereotype.Component; | ||
| 8 | + | ||
| 9 | +import java.nio.charset.StandardCharsets; | ||
| 10 | +import java.security.Key; | ||
| 11 | +import java.util.Date; | ||
| 12 | +import java.util.HashMap; | ||
| 13 | +import java.util.Map; | ||
| 14 | + | ||
| 15 | +@Component | ||
| 16 | +public class JwtUtil { | ||
| 17 | + | ||
| 18 | + @Value("${jwt.secret}") | ||
| 19 | + private String secret; | ||
| 20 | + | ||
| 21 | + @Value("${jwt.expire}") | ||
| 22 | + private long expire; | ||
| 23 | + | ||
| 24 | + private Key getKey() { | ||
| 25 | + return Keys.hmacShaKeyFor(secret.getBytes(StandardCharsets.UTF_8)); | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + public String generateToken(Long riderId) { | ||
| 29 | + Map<String, Object> claims = new HashMap<>(); | ||
| 30 | + claims.put("riderId", riderId); | ||
| 31 | + return buildToken(claims); | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + /** 生成骑手 token,携带 riderId + cityId */ | ||
| 35 | + public String generateRiderToken(Long riderId, Long cityId) { | ||
| 36 | + Map<String, Object> claims = new HashMap<>(); | ||
| 37 | + claims.put("riderId", riderId); | ||
| 38 | + claims.put("cityId", cityId); | ||
| 39 | + return buildToken(claims); | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + /** 生成管理员 token,携带 role 和 id */ | ||
| 43 | + public String generateAdminToken(Long adminId, String role) { | ||
| 44 | + Map<String, Object> claims = new HashMap<>(); | ||
| 45 | + claims.put("adminId", adminId); | ||
| 46 | + claims.put("role", role); | ||
| 47 | + return buildToken(claims); | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + private String buildToken(Map<String, Object> claims) { | ||
| 51 | + return Jwts.builder() | ||
| 52 | + .setClaims(claims) | ||
| 53 | + .setIssuedAt(new Date()) | ||
| 54 | + .setExpiration(new Date(System.currentTimeMillis() + expire * 1000)) | ||
| 55 | + .signWith(getKey(), SignatureAlgorithm.HS256) | ||
| 56 | + .compact(); | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + public Long getRiderIdFromToken(String token) { | ||
| 60 | + try { | ||
| 61 | + Claims claims = parseClaims(token); | ||
| 62 | + return ((Number) claims.get("riderId")).longValue(); | ||
| 63 | + } catch (ExpiredJwtException e) { | ||
| 64 | + throw new BizException(700, "登录状态已过期,请重新登录"); | ||
| 65 | + } catch (Exception e) { | ||
| 66 | + throw new BizException(700, "登录状态失效,请重新登录"); | ||
| 67 | + } | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + public Claims getAdminClaims(String token) { | ||
| 71 | + try { | ||
| 72 | + return parseClaims(token); | ||
| 73 | + } catch (ExpiredJwtException e) { | ||
| 74 | + throw new BizException(700, "登录状态已过期,请重新登录"); | ||
| 75 | + } catch (Exception e) { | ||
| 76 | + throw new BizException(700, "登录状态失效,请重新登录"); | ||
| 77 | + } | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + private Claims parseClaims(String token) { | ||
| 81 | + return Jwts.parserBuilder() | ||
| 82 | + .setSigningKey(getKey()) | ||
| 83 | + .build() | ||
| 84 | + .parseClaimsJws(token) | ||
| 85 | + .getBody(); | ||
| 86 | + } | ||
| 87 | +} |
src/main/java/com/diligrp/rider/config/OpenApiInterceptor.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/config/OpenApiInterceptor.java | ||
| 1 | +package com.diligrp.rider.config; | ||
| 2 | + | ||
| 3 | +import com.fasterxml.jackson.databind.ObjectMapper; | ||
| 4 | +import com.diligrp.rider.common.result.Result; | ||
| 5 | +import com.diligrp.rider.service.OpenAppService; | ||
| 6 | +import jakarta.servlet.http.HttpServletRequest; | ||
| 7 | +import jakarta.servlet.http.HttpServletResponse; | ||
| 8 | +import lombok.RequiredArgsConstructor; | ||
| 9 | +import org.springframework.stereotype.Component; | ||
| 10 | +import org.springframework.util.StringUtils; | ||
| 11 | +import org.springframework.web.servlet.HandlerInterceptor; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * 开放平台签名拦截器 | ||
| 15 | + * 验证请求头:X-App-Key, X-Timestamp, X-Nonce, X-Sign | ||
| 16 | + */ | ||
| 17 | +@Component | ||
| 18 | +@RequiredArgsConstructor | ||
| 19 | +public class OpenApiInterceptor implements HandlerInterceptor { | ||
| 20 | + | ||
| 21 | + private final OpenAppService openAppService; | ||
| 22 | + private final ObjectMapper objectMapper; | ||
| 23 | + | ||
| 24 | + @Override | ||
| 25 | + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { | ||
| 26 | + String appKey = request.getHeader("X-App-Key"); | ||
| 27 | + String timestamp = request.getHeader("X-Timestamp"); | ||
| 28 | + String nonce = request.getHeader("X-Nonce"); | ||
| 29 | + String sign = request.getHeader("X-Sign"); | ||
| 30 | + | ||
| 31 | + if (!StringUtils.hasText(appKey) || !StringUtils.hasText(timestamp) | ||
| 32 | + || !StringUtils.hasText(nonce) || !StringUtils.hasText(sign)) { | ||
| 33 | + writeError(response, 401, "缺少认证头信息(X-App-Key/X-Timestamp/X-Nonce/X-Sign)"); | ||
| 34 | + return false; | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + boolean valid = openAppService.verifySign(appKey, timestamp, nonce, sign); | ||
| 38 | + if (!valid) { | ||
| 39 | + writeError(response, 401, "签名验证失败或已过期"); | ||
| 40 | + return false; | ||
| 41 | + } | ||
| 42 | + return true; | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + private void writeError(HttpServletResponse response, int code, String msg) throws Exception { | ||
| 46 | + response.setContentType("application/json;charset=UTF-8"); | ||
| 47 | + response.setStatus(200); | ||
| 48 | + response.getWriter().write(objectMapper.writeValueAsString(Result.error(code, msg))); | ||
| 49 | + } | ||
| 50 | +} |
src/main/java/com/diligrp/rider/config/WebMvcConfig.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/config/WebMvcConfig.java | ||
| 1 | +package com.diligrp.rider.config; | ||
| 2 | + | ||
| 3 | +import lombok.RequiredArgsConstructor; | ||
| 4 | +import org.springframework.context.annotation.Configuration; | ||
| 5 | +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; | ||
| 6 | +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | ||
| 7 | + | ||
| 8 | +@Configuration | ||
| 9 | +@RequiredArgsConstructor | ||
| 10 | +public class WebMvcConfig implements WebMvcConfigurer { | ||
| 11 | + | ||
| 12 | + private final AuthInterceptor authInterceptor; | ||
| 13 | + private final OpenApiInterceptor openApiInterceptor; | ||
| 14 | + | ||
| 15 | + @Override | ||
| 16 | + public void addInterceptors(InterceptorRegistry registry) { | ||
| 17 | + // JWT 鉴权:骑手端、管理端、平台端 | ||
| 18 | + registry.addInterceptor(authInterceptor) | ||
| 19 | + .addPathPatterns("/api/rider/**", "/api/admin/**", "/api/platform/**") | ||
| 20 | + .excludePathPatterns( | ||
| 21 | + "/api/rider/login/**", | ||
| 22 | + "/api/rider/apply", | ||
| 23 | + "/api/merchant/enter", | ||
| 24 | + "/api/admin/auth/login" // 管理员登录无需鉴权 | ||
| 25 | + ); | ||
| 26 | + | ||
| 27 | + // 开放平台签名鉴权:/api/open/** 需要 AppKey+签名 | ||
| 28 | + registry.addInterceptor(openApiInterceptor) | ||
| 29 | + .addPathPatterns("/api/open/**"); | ||
| 30 | + | ||
| 31 | + // /api/delivery/fee/** 对内中台接口,内网调用,不做鉴权 | ||
| 32 | + } | ||
| 33 | +} |
src/main/java/com/diligrp/rider/controller/AdminAuthController.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/controller/AdminAuthController.java | ||
| 1 | +package com.diligrp.rider.controller; | ||
| 2 | + | ||
| 3 | +import com.diligrp.rider.common.result.Result; | ||
| 4 | +import com.diligrp.rider.dto.AdminLoginDTO; | ||
| 5 | +import com.diligrp.rider.service.impl.AdminAuthServiceImpl; | ||
| 6 | +import com.diligrp.rider.vo.AdminLoginVO; | ||
| 7 | +import jakarta.validation.Valid; | ||
| 8 | +import lombok.RequiredArgsConstructor; | ||
| 9 | +import org.springframework.web.bind.annotation.*; | ||
| 10 | + | ||
| 11 | +@RestController | ||
| 12 | +@RequestMapping("/api/admin/auth") | ||
| 13 | +@RequiredArgsConstructor | ||
| 14 | +public class AdminAuthController { | ||
| 15 | + | ||
| 16 | + private final AdminAuthServiceImpl adminAuthService; | ||
| 17 | + | ||
| 18 | + /** | ||
| 19 | + * 管理员登录(超级管理员 + 分站管理员统一入口) | ||
| 20 | + * 请求体:{ "account": "gz_admin", "pass": "admin123", "role": "substation" } | ||
| 21 | + * role 可选值:admin(超级管理员)| substation(分站管理员,默认) | ||
| 22 | + */ | ||
| 23 | + @PostMapping("/login") | ||
| 24 | + public Result<AdminLoginVO> login(@Valid @RequestBody AdminLoginDTO dto) { | ||
| 25 | + return Result.success(adminAuthService.login(dto)); | ||
| 26 | + } | ||
| 27 | +} |
src/main/java/com/diligrp/rider/controller/AdminRefundController.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/controller/AdminRefundController.java | ||
| 1 | +package com.diligrp.rider.controller; | ||
| 2 | + | ||
| 3 | +import com.diligrp.rider.common.result.Result; | ||
| 4 | +import com.diligrp.rider.entity.OrderRefundReason; | ||
| 5 | +import com.diligrp.rider.entity.OrderRefundRecord; | ||
| 6 | +import com.diligrp.rider.service.RefundService; | ||
| 7 | +import com.diligrp.rider.service.RiderEvaluateService; | ||
| 8 | +import lombok.RequiredArgsConstructor; | ||
| 9 | +import org.springframework.web.bind.annotation.*; | ||
| 10 | + | ||
| 11 | +import java.util.List; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * 平台/分站管理:退款审核 + 评价管理 | ||
| 15 | + */ | ||
| 16 | +@RestController | ||
| 17 | +@RequestMapping("/api/admin") | ||
| 18 | +@RequiredArgsConstructor | ||
| 19 | +public class AdminRefundController { | ||
| 20 | + | ||
| 21 | + private final RefundService refundService; | ||
| 22 | + private final RiderEvaluateService evaluateService; | ||
| 23 | + | ||
| 24 | + /** 退款原因列表管理(全部角色) */ | ||
| 25 | + @GetMapping("/refund/reasons") | ||
| 26 | + public Result<List<OrderRefundReason>> reasons(@RequestParam(defaultValue = "0") int role) { | ||
| 27 | + return Result.success(refundService.getReasons(role)); | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + /** 查看订单退款记录 */ | ||
| 31 | + @GetMapping("/refund/record") | ||
| 32 | + public Result<OrderRefundRecord> record(@RequestParam Long orderId) { | ||
| 33 | + return Result.success(refundService.getByOrderId(orderId)); | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + /** | ||
| 37 | + * 审核退款申请 | ||
| 38 | + * status=1 通过(退款成功) | ||
| 39 | + * status=2 拒绝 | ||
| 40 | + */ | ||
| 41 | + @PostMapping("/refund/handle") | ||
| 42 | + public Result<Void> handle( | ||
| 43 | + @RequestParam Long recordId, | ||
| 44 | + @RequestParam int status, | ||
| 45 | + @RequestParam(required = false, defaultValue = "") String remark) { | ||
| 46 | + refundService.handleRefund(recordId, status, remark); | ||
| 47 | + return Result.success(); | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + /** 骑手评价列表(运营查看) */ | ||
| 51 | + @GetMapping("/evaluate/list") | ||
| 52 | + public Result<List<?>> evaluateList( | ||
| 53 | + @RequestParam Long riderId, | ||
| 54 | + @RequestParam(defaultValue = "0") int type, | ||
| 55 | + @RequestParam(defaultValue = "1") int page) { | ||
| 56 | + return Result.success(evaluateService.getRiderEvaluates(riderId, type, page)); | ||
| 57 | + } | ||
| 58 | +} |
src/main/java/com/diligrp/rider/controller/AdminRiderController.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/controller/AdminRiderController.java | ||
| 1 | +package com.diligrp.rider.controller; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||
| 4 | +import com.diligrp.rider.common.result.Result; | ||
| 5 | +import com.diligrp.rider.dto.AdminRiderAddDTO; | ||
| 6 | +import com.diligrp.rider.entity.Orders; | ||
| 7 | +import com.diligrp.rider.entity.Rider; | ||
| 8 | +import com.diligrp.rider.mapper.OrdersMapper; | ||
| 9 | +import com.diligrp.rider.service.AdminRiderService; | ||
| 10 | +import jakarta.servlet.http.HttpServletRequest; | ||
| 11 | +import jakarta.validation.Valid; | ||
| 12 | +import lombok.RequiredArgsConstructor; | ||
| 13 | +import org.springframework.web.bind.annotation.*; | ||
| 14 | + | ||
| 15 | +import java.util.List; | ||
| 16 | + | ||
| 17 | +@RestController | ||
| 18 | +@RequestMapping("/api/admin/rider") | ||
| 19 | +@RequiredArgsConstructor | ||
| 20 | +public class AdminRiderController { | ||
| 21 | + | ||
| 22 | + private final AdminRiderService adminRiderService; | ||
| 23 | + private final OrdersMapper ordersMapper; | ||
| 24 | + | ||
| 25 | + /** 手动新增骑手(分站管理员自动绑定本城市) */ | ||
| 26 | + @PostMapping("/add") | ||
| 27 | + public Result<Void> add(@Valid @RequestBody AdminRiderAddDTO dto, HttpServletRequest request) { | ||
| 28 | + Long cityId = "substation".equals(request.getAttribute("role")) | ||
| 29 | + ? (Long) request.getAttribute("cityId") | ||
| 30 | + : dto.getCityId(); | ||
| 31 | + adminRiderService.add(dto, cityId); | ||
| 32 | + return Result.success(); | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + /** 骑手列表(分站管理员仅看本城市,超管看全部) */ | ||
| 36 | + @GetMapping("/list") | ||
| 37 | + public Result<List<Rider>> list( | ||
| 38 | + @RequestParam(required = false) String keyword, | ||
| 39 | + @RequestParam(required = false) Integer userStatus, | ||
| 40 | + HttpServletRequest request) { | ||
| 41 | + Long cityId = "substation".equals(request.getAttribute("role")) | ||
| 42 | + ? (Long) request.getAttribute("cityId") | ||
| 43 | + : null; | ||
| 44 | + return Result.success(adminRiderService.list(keyword, userStatus, cityId)); | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + /** 指派骑手候选列表 */ | ||
| 48 | + @GetMapping("/order/candidates") | ||
| 49 | + public Result<List<Rider>> designateCandidates(@RequestParam Long orderId, HttpServletRequest request) { | ||
| 50 | + Long cityId = "substation".equals(request.getAttribute("role")) | ||
| 51 | + ? (Long) request.getAttribute("cityId") | ||
| 52 | + : null; | ||
| 53 | + return Result.success(adminRiderService.designateCandidates(orderId, cityId)); | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + /** 审核骑手:status=0拒绝 1通过 */ | ||
| 57 | + @PostMapping("/setStatus") | ||
| 58 | + public Result<Void> setStatus(@RequestParam Long riderId, @RequestParam int status) { | ||
| 59 | + adminRiderService.setStatus(riderId, status); | ||
| 60 | + return Result.success(); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + /** 设置骑手等级,levelId 为空时使用默认等级 */ | ||
| 64 | + @PostMapping("/setLevel") | ||
| 65 | + public Result<Void> setLevel(@RequestParam Long riderId, | ||
| 66 | + @RequestParam(required = false) Long levelId, | ||
| 67 | + HttpServletRequest request) { | ||
| 68 | + Long cityId = "substation".equals(request.getAttribute("role")) | ||
| 69 | + ? (Long) request.getAttribute("cityId") | ||
| 70 | + : null; | ||
| 71 | + adminRiderService.setLevel(riderId, levelId, cityId); | ||
| 72 | + return Result.success(); | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + /** 启用/禁用骑手账号:status=0禁用 1启用 */ | ||
| 76 | + @PostMapping("/setEnableStatus") | ||
| 77 | + public Result<Void> setEnableStatus(@RequestParam Long riderId, @RequestParam int status) { | ||
| 78 | + adminRiderService.setEnableStatus(riderId, status); | ||
| 79 | + return Result.success(); | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + /** 切换骑手类型:type=1兼职 2全职 */ | ||
| 83 | + @PostMapping("/setType") | ||
| 84 | + public Result<Void> setType(@RequestParam Long riderId, @RequestParam int type) { | ||
| 85 | + adminRiderService.setType(riderId, type); | ||
| 86 | + return Result.success(); | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + /** 指派骑手接单 */ | ||
| 90 | + @PostMapping("/order/designate") | ||
| 91 | + public Result<Void> designate(@RequestParam Long orderId, @RequestParam Long riderId) { | ||
| 92 | + adminRiderService.designate(orderId, riderId); | ||
| 93 | + return Result.success(); | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | + /** 处理转单申请:trans=1通过 3拒绝 */ | ||
| 97 | + @PostMapping("/order/setTrans") | ||
| 98 | + public Result<Void> setTrans(@RequestParam Long orderId, @RequestParam int trans) { | ||
| 99 | + adminRiderService.setTrans(orderId, trans); | ||
| 100 | + return Result.success(); | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | + /** | ||
| 104 | + * 订单列表(分站管理员查看本城市订单 / 超管查看所有) | ||
| 105 | + * 分站管理员:cityId 从 token 自动注入,无需传参 | ||
| 106 | + * 超管:可传 cityId 筛选某城市 | ||
| 107 | + */ | ||
| 108 | + @GetMapping("/order/list") | ||
| 109 | + public Result<List<Orders>> orderList( | ||
| 110 | + @RequestParam(required = false) Integer status, | ||
| 111 | + @RequestParam(required = false) Integer isTrans, | ||
| 112 | + @RequestParam(required = false) String keyword, | ||
| 113 | + @RequestParam(defaultValue = "1") int page, | ||
| 114 | + HttpServletRequest request) { | ||
| 115 | + Long cityId = (Long) request.getAttribute("cityId"); | ||
| 116 | + String role = (String) request.getAttribute("role"); | ||
| 117 | + | ||
| 118 | + LambdaQueryWrapper<Orders> wrapper = new LambdaQueryWrapper<Orders>() | ||
| 119 | + .eq(Orders::getIsDel, 0) | ||
| 120 | + .orderByDesc(Orders::getId); | ||
| 121 | + | ||
| 122 | + if ("substation".equals(role) && cityId != null) { | ||
| 123 | + wrapper.eq(Orders::getCityId, cityId); | ||
| 124 | + } | ||
| 125 | + if (status != null) wrapper.eq(Orders::getStatus, status); | ||
| 126 | + if (isTrans != null) wrapper.eq(Orders::getIsTrans, isTrans); | ||
| 127 | + if (keyword != null && !keyword.isBlank()) { | ||
| 128 | + wrapper.and(w -> w.like(Orders::getOrderNo, keyword) | ||
| 129 | + .or().like(Orders::getOutOrderNo, keyword) | ||
| 130 | + .or().like(Orders::getRecipName, keyword) | ||
| 131 | + .or().like(Orders::getRecipPhone, keyword)); | ||
| 132 | + } | ||
| 133 | + int offset = (page - 1) * 20; | ||
| 134 | + wrapper.last("LIMIT " + offset + ",20"); | ||
| 135 | + | ||
| 136 | + return Result.success(ordersMapper.selectList(wrapper)); | ||
| 137 | + } | ||
| 138 | + | ||
| 139 | + /** | ||
| 140 | + * 配送订单列表(平台管理员查看外部系统推入的订单) | ||
| 141 | + * 按 appKey / outOrderNo 查询 | ||
| 142 | + */ | ||
| 143 | + @GetMapping("/order/delivery/list") | ||
| 144 | + public Result<List<Orders>> deliveryOrderList( | ||
| 145 | + @RequestParam(required = false) String appKey, | ||
| 146 | + @RequestParam(required = false) String outOrderNo, | ||
| 147 | + @RequestParam(required = false) Integer status, | ||
| 148 | + @RequestParam(defaultValue = "1") int page) { | ||
| 149 | + LambdaQueryWrapper<Orders> wrapper = new LambdaQueryWrapper<Orders>() | ||
| 150 | + .eq(Orders::getIsDel, 0) | ||
| 151 | + .orderByDesc(Orders::getId); | ||
| 152 | + if (appKey != null && !appKey.isBlank()) wrapper.eq(Orders::getAppKey, appKey); | ||
| 153 | + if (outOrderNo != null && !outOrderNo.isBlank()) wrapper.like(Orders::getOutOrderNo, outOrderNo); | ||
| 154 | + if (status != null) wrapper.eq(Orders::getStatus, status); | ||
| 155 | + int offset = (page - 1) * 20; | ||
| 156 | + wrapper.last("LIMIT " + offset + ",20"); | ||
| 157 | + return Result.success(ordersMapper.selectList(wrapper)); | ||
| 158 | + } | ||
| 159 | +} |
src/main/java/com/diligrp/rider/controller/AdminRiderLevelController.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/controller/AdminRiderLevelController.java | ||
| 1 | +package com.diligrp.rider.controller; | ||
| 2 | + | ||
| 3 | +import com.diligrp.rider.common.exception.BizException; | ||
| 4 | +import com.diligrp.rider.common.result.Result; | ||
| 5 | +import com.diligrp.rider.dto.AdminRiderLevelSaveDTO; | ||
| 6 | +import com.diligrp.rider.entity.RiderLevel; | ||
| 7 | +import com.diligrp.rider.service.AdminRiderLevelService; | ||
| 8 | +import jakarta.servlet.http.HttpServletRequest; | ||
| 9 | +import jakarta.validation.Valid; | ||
| 10 | +import lombok.RequiredArgsConstructor; | ||
| 11 | +import org.springframework.web.bind.annotation.*; | ||
| 12 | + | ||
| 13 | +import java.util.List; | ||
| 14 | + | ||
| 15 | +@RestController | ||
| 16 | +@RequestMapping("/api/admin/rider/level") | ||
| 17 | +@RequiredArgsConstructor | ||
| 18 | +public class AdminRiderLevelController { | ||
| 19 | + | ||
| 20 | + private final AdminRiderLevelService adminRiderLevelService; | ||
| 21 | + | ||
| 22 | + @GetMapping("/list") | ||
| 23 | + public Result<List<RiderLevel>> list(@RequestParam(required = false) Long cityId, HttpServletRequest request) { | ||
| 24 | + return Result.success(adminRiderLevelService.list(resolveCityId(cityId, request))); | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + @PostMapping("/add") | ||
| 28 | + public Result<Void> add(@Valid @RequestBody AdminRiderLevelSaveDTO dto, HttpServletRequest request) { | ||
| 29 | + adminRiderLevelService.add(dto, resolveCityId(dto.getCityId(), request)); | ||
| 30 | + return Result.success(); | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + @PutMapping("/edit") | ||
| 34 | + public Result<Void> edit(@Valid @RequestBody AdminRiderLevelSaveDTO dto, HttpServletRequest request) { | ||
| 35 | + adminRiderLevelService.edit(dto, resolveCityId(dto.getCityId(), request)); | ||
| 36 | + return Result.success(); | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + @PostMapping("/setDefault") | ||
| 40 | + public Result<Void> setDefault(@RequestParam Long id, | ||
| 41 | + @RequestParam(required = false) Long cityId, | ||
| 42 | + HttpServletRequest request) { | ||
| 43 | + adminRiderLevelService.setDefault(id, resolveCityId(cityId, request)); | ||
| 44 | + return Result.success(); | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + @DeleteMapping("/del") | ||
| 48 | + public Result<Void> delete(@RequestParam Long id, | ||
| 49 | + @RequestParam(required = false) Long cityId, | ||
| 50 | + HttpServletRequest request) { | ||
| 51 | + adminRiderLevelService.delete(id, resolveCityId(cityId, request)); | ||
| 52 | + return Result.success(); | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + private Long resolveCityId(Long cityId, HttpServletRequest request) { | ||
| 56 | + if ("substation".equals(request.getAttribute("role"))) { | ||
| 57 | + Long requestCityId = (Long) request.getAttribute("cityId"); | ||
| 58 | + if (requestCityId == null || requestCityId < 1) { | ||
| 59 | + throw new BizException("当前账号未绑定城市"); | ||
| 60 | + } | ||
| 61 | + return requestCityId; | ||
| 62 | + } | ||
| 63 | + if (cityId == null || cityId < 1) { | ||
| 64 | + throw new BizException("城市不能为空"); | ||
| 65 | + } | ||
| 66 | + return cityId; | ||
| 67 | + } | ||
| 68 | +} |
src/main/java/com/diligrp/rider/controller/DeliveryFeeController.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/controller/DeliveryFeeController.java | ||
| 1 | +package com.diligrp.rider.controller; | ||
| 2 | + | ||
| 3 | +import com.diligrp.rider.common.result.Result; | ||
| 4 | +import com.diligrp.rider.dto.DeliveryFeeCalcDTO; | ||
| 5 | +import com.diligrp.rider.service.DeliveryFeeService; | ||
| 6 | +import com.diligrp.rider.vo.DeliveryFeeResultVO; | ||
| 7 | +import jakarta.validation.Valid; | ||
| 8 | +import lombok.RequiredArgsConstructor; | ||
| 9 | +import org.springframework.web.bind.annotation.*; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * 配送费计算接口(对内中台核心接口) | ||
| 13 | + * 电商系统下单前调用此接口获取配送费 | ||
| 14 | + */ | ||
| 15 | +@RestController | ||
| 16 | +@RequestMapping("/api/delivery/fee") | ||
| 17 | +@RequiredArgsConstructor | ||
| 18 | +public class DeliveryFeeController { | ||
| 19 | + | ||
| 20 | + private final DeliveryFeeService deliveryFeeService; | ||
| 21 | + | ||
| 22 | + /** | ||
| 23 | + * 计算配送费 | ||
| 24 | + * 入参:cityId, orderType, startLng, startLat, endLng, endLat, weight, serviceTime | ||
| 25 | + * 出参:各项费用明细 + 总费用 + 预计送达时间 | ||
| 26 | + */ | ||
| 27 | + @PostMapping("/calc") | ||
| 28 | + public Result<DeliveryFeeResultVO> calc(@Valid @RequestBody DeliveryFeeCalcDTO dto) { | ||
| 29 | + return Result.success(deliveryFeeService.calcFee(dto)); | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + /** | ||
| 33 | + * 检查城市是否开通某服务 | ||
| 34 | + * orderType: 1=帮我送 2=帮我取 6=外卖配送 | ||
| 35 | + */ | ||
| 36 | + @GetMapping("/check") | ||
| 37 | + public Result<Boolean> check(@RequestParam Long cityId, @RequestParam int orderType) { | ||
| 38 | + return Result.success(deliveryFeeService.isServiceEnabled(cityId, orderType)); | ||
| 39 | + } | ||
| 40 | +} |
src/main/java/com/diligrp/rider/controller/OpenApiController.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/controller/OpenApiController.java | ||
| 1 | +package com.diligrp.rider.controller; | ||
| 2 | + | ||
| 3 | +import com.diligrp.rider.common.exception.BizException; | ||
| 4 | +import com.diligrp.rider.common.result.Result; | ||
| 5 | +import com.diligrp.rider.dto.DeliveryFeeCalcDTO; | ||
| 6 | +import com.diligrp.rider.dto.OpenDeliveryFeeCalcDTO; | ||
| 7 | +import com.diligrp.rider.entity.OpenApp; | ||
| 8 | +import com.diligrp.rider.service.DeliveryFeeService; | ||
| 9 | +import com.diligrp.rider.service.OpenAppService; | ||
| 10 | +import com.diligrp.rider.vo.DeliveryFeeResultVO; | ||
| 11 | +import jakarta.servlet.http.HttpServletRequest; | ||
| 12 | +import jakarta.validation.Valid; | ||
| 13 | +import lombok.RequiredArgsConstructor; | ||
| 14 | +import org.springframework.web.bind.annotation.*; | ||
| 15 | + | ||
| 16 | +/** | ||
| 17 | + * 开放平台对外接口 | ||
| 18 | + * 路径前缀 /api/open/** 受 OpenApiInterceptor 签名鉴权保护 | ||
| 19 | + * 第三方系统需携带 X-App-Key / X-Timestamp / X-Nonce / X-Sign 请求头 | ||
| 20 | + */ | ||
| 21 | +@RestController | ||
| 22 | +@RequestMapping("/api/open") | ||
| 23 | +@RequiredArgsConstructor | ||
| 24 | +public class OpenApiController { | ||
| 25 | + | ||
| 26 | + private final DeliveryFeeService deliveryFeeService; | ||
| 27 | + private final OpenAppService openAppService; | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * 计算配送费(对外开放版) | ||
| 31 | + * cityId 由 AppKey 绑定的租户自动确定,不信任外部传参 | ||
| 32 | + */ | ||
| 33 | + @PostMapping("/delivery/fee/calc") | ||
| 34 | + public Result<DeliveryFeeResultVO> calcFee(@Valid @RequestBody OpenDeliveryFeeCalcDTO dto, | ||
| 35 | + HttpServletRequest request) { | ||
| 36 | + DeliveryFeeCalcDTO calcDTO = new DeliveryFeeCalcDTO(); | ||
| 37 | + calcDTO.setCityId(resolveCityId(request)); | ||
| 38 | + calcDTO.setOrderType(dto.getOrderType()); | ||
| 39 | + calcDTO.setStartLng(dto.getStartLng()); | ||
| 40 | + calcDTO.setStartLat(dto.getStartLat()); | ||
| 41 | + calcDTO.setEndLng(dto.getEndLng()); | ||
| 42 | + calcDTO.setEndLat(dto.getEndLat()); | ||
| 43 | + calcDTO.setWeight(dto.getWeight()); | ||
| 44 | + calcDTO.setPieces(dto.getPieces()); | ||
| 45 | + calcDTO.setServiceTime(dto.getServiceTime()); | ||
| 46 | + return Result.success(deliveryFeeService.calcFee(calcDTO)); | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + /** | ||
| 50 | + * 检查城市服务是否开通 | ||
| 51 | + * cityId 由 AppKey 绑定的租户自动确定 | ||
| 52 | + */ | ||
| 53 | + @GetMapping("/delivery/check") | ||
| 54 | + public Result<Boolean> check(@RequestParam int orderType, HttpServletRequest request) { | ||
| 55 | + return Result.success(deliveryFeeService.isServiceEnabled(resolveCityId(request), orderType)); | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + private Long resolveCityId(HttpServletRequest request) { | ||
| 59 | + String appKey = request.getHeader("X-App-Key"); | ||
| 60 | + OpenApp app = openAppService.getByAppKey(appKey); | ||
| 61 | + if (app == null || app.getStatus() != 1) { | ||
| 62 | + throw new BizException("应用不存在或已禁用"); | ||
| 63 | + } | ||
| 64 | + if (app.getCityId() == null || app.getCityId() < 1) { | ||
| 65 | + throw new BizException("该应用未绑定租户,请联系平台管理员"); | ||
| 66 | + } | ||
| 67 | + return app.getCityId(); | ||
| 68 | + } | ||
| 69 | +} |
src/main/java/com/diligrp/rider/controller/OpenDeliveryOrderController.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/controller/OpenDeliveryOrderController.java | ||
| 1 | +package com.diligrp.rider.controller; | ||
| 2 | + | ||
| 3 | +import com.diligrp.rider.common.result.Result; | ||
| 4 | +import com.diligrp.rider.dto.DeliveryOrderCreateDTO; | ||
| 5 | +import com.diligrp.rider.service.DeliveryOrderService; | ||
| 6 | +import com.diligrp.rider.vo.DeliveryOrderCreateVO; | ||
| 7 | +import jakarta.servlet.http.HttpServletRequest; | ||
| 8 | +import jakarta.validation.Valid; | ||
| 9 | +import lombok.RequiredArgsConstructor; | ||
| 10 | +import org.springframework.web.bind.annotation.*; | ||
| 11 | + | ||
| 12 | +/** | ||
| 13 | + * 开放平台:配送订单接口 | ||
| 14 | + * 路径 /api/open/** 由 OpenApiInterceptor 做签名鉴权 | ||
| 15 | + * X-App-Key 会由拦截器写入 request attribute | ||
| 16 | + */ | ||
| 17 | +@RestController | ||
| 18 | +@RequestMapping("/api/open/delivery/order") | ||
| 19 | +@RequiredArgsConstructor | ||
| 20 | +public class OpenDeliveryOrderController { | ||
| 21 | + | ||
| 22 | + private final DeliveryOrderService deliveryOrderService; | ||
| 23 | + | ||
| 24 | + /** | ||
| 25 | + * 创建配送订单(推单) | ||
| 26 | + * 外部系统在自己完成支付后调用此接口,中台接管配送 | ||
| 27 | + */ | ||
| 28 | + @PostMapping("/create") | ||
| 29 | + public Result<DeliveryOrderCreateVO> create( | ||
| 30 | + @Valid @RequestBody DeliveryOrderCreateDTO dto, | ||
| 31 | + HttpServletRequest request) { | ||
| 32 | + String appKey = request.getHeader("X-App-Key"); | ||
| 33 | + return Result.success(deliveryOrderService.create(appKey, dto)); | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + /** | ||
| 37 | + * 查询配送订单状态 | ||
| 38 | + * 接入方可轮询此接口跟踪配送进度 | ||
| 39 | + */ | ||
| 40 | + @GetMapping("/query") | ||
| 41 | + public Result<DeliveryOrderCreateVO> query( | ||
| 42 | + @RequestParam String outOrderNo, | ||
| 43 | + HttpServletRequest request) { | ||
| 44 | + String appKey = request.getHeader("X-App-Key"); | ||
| 45 | + return Result.success(deliveryOrderService.queryByOutOrderNo(appKey, outOrderNo)); | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + /** | ||
| 49 | + * 取消配送订单 | ||
| 50 | + * 仅 status=2(待接单)可取消 | ||
| 51 | + */ | ||
| 52 | + @PostMapping("/cancel") | ||
| 53 | + public Result<Void> cancel( | ||
| 54 | + @RequestParam String outOrderNo, | ||
| 55 | + HttpServletRequest request) { | ||
| 56 | + String appKey = request.getHeader("X-App-Key"); | ||
| 57 | + deliveryOrderService.cancel(appKey, outOrderNo); | ||
| 58 | + return Result.success(); | ||
| 59 | + } | ||
| 60 | +} |
src/main/java/com/diligrp/rider/controller/OpenStoreController.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/controller/OpenStoreController.java | ||
| 1 | +package com.diligrp.rider.controller; | ||
| 2 | + | ||
| 3 | +import com.diligrp.rider.common.result.Result; | ||
| 4 | +import com.diligrp.rider.dto.MerchantStoreDTO; | ||
| 5 | +import com.diligrp.rider.entity.MerchantStore; | ||
| 6 | +import com.diligrp.rider.service.MerchantService; | ||
| 7 | +import jakarta.servlet.http.HttpServletRequest; | ||
| 8 | +import lombok.RequiredArgsConstructor; | ||
| 9 | +import org.springframework.web.bind.annotation.*; | ||
| 10 | + | ||
| 11 | +import java.util.List; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * 开放平台:门店同步接口 | ||
| 15 | + * 接入方用 AppKey 签名后调用,同步自己系统的门店数据到配送中台 | ||
| 16 | + */ | ||
| 17 | +@RestController | ||
| 18 | +@RequestMapping("/api/open/store") | ||
| 19 | +@RequiredArgsConstructor | ||
| 20 | +public class OpenStoreController { | ||
| 21 | + | ||
| 22 | + private final MerchantService merchantService; | ||
| 23 | + | ||
| 24 | + /** | ||
| 25 | + * 同步门店(新增或更新) | ||
| 26 | + * 以 appKey + outStoreId 为唯一键,存在则更新,不存在则新增 | ||
| 27 | + * dto.outStoreId 必填 | ||
| 28 | + */ | ||
| 29 | + @PostMapping("/sync") | ||
| 30 | + public Result<MerchantStore> sync( | ||
| 31 | + @RequestBody MerchantStoreDTO dto, | ||
| 32 | + HttpServletRequest request) { | ||
| 33 | + String appKey = request.getHeader("X-App-Key"); | ||
| 34 | + return Result.success(merchantService.syncStore(appKey, dto)); | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * 查询本应用下的门店列表 | ||
| 39 | + */ | ||
| 40 | + @GetMapping("/list") | ||
| 41 | + public Result<List<MerchantStore>> list( | ||
| 42 | + HttpServletRequest request, | ||
| 43 | + @RequestParam(required = false) Long cityId, | ||
| 44 | + @RequestParam(defaultValue = "1") int page) { | ||
| 45 | + String appKey = request.getHeader("X-App-Key"); | ||
| 46 | + return Result.success(merchantService.storeList(cityId, null, page)); | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + /** | ||
| 50 | + * 根据外部门店编号查询 | ||
| 51 | + */ | ||
| 52 | + @GetMapping("/getByOutStoreId") | ||
| 53 | + public Result<MerchantStore> getByOutStoreId( | ||
| 54 | + @RequestParam String outStoreId, | ||
| 55 | + HttpServletRequest request) { | ||
| 56 | + String appKey = request.getHeader("X-App-Key"); | ||
| 57 | + return Result.success(merchantService.getByOutStoreId(appKey, outStoreId)); | ||
| 58 | + } | ||
| 59 | +} |
src/main/java/com/diligrp/rider/controller/PlatformCityController.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/controller/PlatformCityController.java | ||
| 1 | +package com.diligrp.rider.controller; | ||
| 2 | + | ||
| 3 | +import com.diligrp.rider.common.result.Result; | ||
| 4 | +import com.diligrp.rider.entity.City; | ||
| 5 | +import com.diligrp.rider.service.CityService; | ||
| 6 | +import com.diligrp.rider.vo.CityVO; | ||
| 7 | +import lombok.RequiredArgsConstructor; | ||
| 8 | +import org.springframework.web.bind.annotation.*; | ||
| 9 | + | ||
| 10 | +import java.util.List; | ||
| 11 | + | ||
| 12 | +@RestController | ||
| 13 | +@RequestMapping("/api/platform/city") | ||
| 14 | +@RequiredArgsConstructor | ||
| 15 | +public class PlatformCityController { | ||
| 16 | + | ||
| 17 | + private final CityService cityService; | ||
| 18 | + | ||
| 19 | + /** 获取两级城市树(省→市) */ | ||
| 20 | + @GetMapping("/tree") | ||
| 21 | + public Result<List<CityVO>> tree() { | ||
| 22 | + return Result.success(cityService.getTree()); | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + /** 已开通城市列表 */ | ||
| 26 | + @GetMapping("/open") | ||
| 27 | + public Result<List<CityVO>> openList() { | ||
| 28 | + return Result.success(cityService.getOpenList()); | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + /** 新增城市 */ | ||
| 32 | + @PostMapping("/add") | ||
| 33 | + public Result<Void> add(@RequestBody City city) { | ||
| 34 | + cityService.add(city); | ||
| 35 | + return Result.success(); | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + /** 编辑城市基础信息 */ | ||
| 39 | + @PutMapping("/edit") | ||
| 40 | + public Result<Void> edit(@RequestBody City city) { | ||
| 41 | + cityService.edit(city); | ||
| 42 | + return Result.success(); | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + /** 开通/关闭城市:status=0关闭 1开通 */ | ||
| 46 | + @PostMapping("/setStatus") | ||
| 47 | + public Result<Void> setStatus(@RequestParam Long cityId, @RequestParam int status) { | ||
| 48 | + cityService.setStatus(cityId, status); | ||
| 49 | + return Result.success(); | ||
| 50 | + } | ||
| 51 | +} |
src/main/java/com/diligrp/rider/controller/PlatformCityFeePlanController.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/controller/PlatformCityFeePlanController.java | ||
| 1 | +package com.diligrp.rider.controller; | ||
| 2 | + | ||
| 3 | +import com.diligrp.rider.common.result.Result; | ||
| 4 | +import com.diligrp.rider.dto.DeliveryFeePlanPreviewDTO; | ||
| 5 | +import com.diligrp.rider.dto.DeliveryFeePlanSaveDTO; | ||
| 6 | +import com.diligrp.rider.service.DeliveryFeePlanService; | ||
| 7 | +import com.diligrp.rider.vo.DeliveryFeePlanDetailVO; | ||
| 8 | +import com.diligrp.rider.vo.DeliveryFeePlanVO; | ||
| 9 | +import com.diligrp.rider.vo.DeliveryFeeResultVO; | ||
| 10 | +import lombok.RequiredArgsConstructor; | ||
| 11 | +import org.springframework.web.bind.annotation.*; | ||
| 12 | + | ||
| 13 | +import java.util.List; | ||
| 14 | + | ||
| 15 | +@RestController | ||
| 16 | +@RequestMapping("/api/platform/city") | ||
| 17 | +@RequiredArgsConstructor | ||
| 18 | +public class PlatformCityFeePlanController { | ||
| 19 | + | ||
| 20 | + private final DeliveryFeePlanService deliveryFeePlanService; | ||
| 21 | + | ||
| 22 | + @GetMapping("/{cityId}/fee-plans") | ||
| 23 | + public Result<List<DeliveryFeePlanVO>> listPlans(@PathVariable Long cityId) { | ||
| 24 | + return Result.success(deliveryFeePlanService.listPlans(cityId)); | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + @GetMapping("/{cityId}/fee-plans/{planId}") | ||
| 28 | + public Result<DeliveryFeePlanDetailVO> getPlanDetail(@PathVariable Long cityId, @PathVariable Long planId) { | ||
| 29 | + return Result.success(deliveryFeePlanService.getPlanDetail(cityId, planId)); | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + @PostMapping("/{cityId}/fee-plans") | ||
| 33 | + public Result<Long> createPlan(@PathVariable Long cityId, @RequestBody DeliveryFeePlanSaveDTO dto) { | ||
| 34 | + return Result.success(deliveryFeePlanService.createPlan(cityId, dto)); | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + @PostMapping("/{cityId}/fee-plans/init-default") | ||
| 38 | + public Result<Long> initializeDefaultPlan(@PathVariable Long cityId) { | ||
| 39 | + return Result.success(deliveryFeePlanService.initializeDefaultPlan(cityId)); | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + @PutMapping("/{cityId}/fee-plans/{planId}") | ||
| 43 | + public Result<Void> updatePlan(@PathVariable Long cityId, | ||
| 44 | + @PathVariable Long planId, | ||
| 45 | + @RequestBody DeliveryFeePlanSaveDTO dto) { | ||
| 46 | + deliveryFeePlanService.updatePlan(cityId, planId, dto); | ||
| 47 | + return Result.success(); | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + @PostMapping("/{cityId}/fee-plans/{planId}/copy") | ||
| 51 | + public Result<Long> copyPlan(@PathVariable Long cityId, @PathVariable Long planId) { | ||
| 52 | + return Result.success(deliveryFeePlanService.copyPlan(cityId, planId)); | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + @PostMapping("/{cityId}/fee-plans/{planId}/default") | ||
| 56 | + public Result<Void> setDefaultPlan(@PathVariable Long cityId, @PathVariable Long planId) { | ||
| 57 | + deliveryFeePlanService.setDefaultPlan(cityId, planId); | ||
| 58 | + return Result.success(); | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + @DeleteMapping("/{cityId}/fee-plans/{planId}") | ||
| 62 | + public Result<Void> deletePlan(@PathVariable Long cityId, @PathVariable Long planId) { | ||
| 63 | + deliveryFeePlanService.deletePlan(cityId, planId); | ||
| 64 | + return Result.success(); | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + @PostMapping("/{cityId}/fee-plans/preview") | ||
| 68 | + public Result<DeliveryFeeResultVO> preview(@PathVariable Long cityId, | ||
| 69 | + @RequestBody DeliveryFeePlanPreviewDTO dto) { | ||
| 70 | + return Result.success(deliveryFeePlanService.preview(cityId, dto)); | ||
| 71 | + } | ||
| 72 | +} |
src/main/java/com/diligrp/rider/controller/PlatformMerchantController.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/controller/PlatformMerchantController.java | ||
| 1 | +package com.diligrp.rider.controller; | ||
| 2 | + | ||
| 3 | +import com.diligrp.rider.common.result.Result; | ||
| 4 | +import com.diligrp.rider.dto.MerchantStoreDTO; | ||
| 5 | +import com.diligrp.rider.entity.MerchantStore; | ||
| 6 | +import com.diligrp.rider.service.MerchantService; | ||
| 7 | +import jakarta.validation.Valid; | ||
| 8 | +import lombok.RequiredArgsConstructor; | ||
| 9 | +import org.springframework.web.bind.annotation.*; | ||
| 10 | + | ||
| 11 | +import java.math.BigDecimal; | ||
| 12 | +import java.util.List; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * 平台后台:门店管理 | ||
| 16 | + * - 外部门店通过开放平台 /api/open/store/sync 同步,统一存入 merchant_store 表 | ||
| 17 | + * - 平台管理员也可直接新建门店,选填 outStoreId 与外部系统对账 | ||
| 18 | + */ | ||
| 19 | +@RestController | ||
| 20 | +@RequestMapping("/api/platform/merchant") | ||
| 21 | +@RequiredArgsConstructor | ||
| 22 | +public class PlatformMerchantController { | ||
| 23 | + | ||
| 24 | + private final MerchantService merchantService; | ||
| 25 | + | ||
| 26 | + /** 门店列表(含外部同步的和平台自建的) */ | ||
| 27 | + @GetMapping("/store/list") | ||
| 28 | + public Result<List<MerchantStore>> storeList( | ||
| 29 | + @RequestParam(required = false) Long cityId, | ||
| 30 | + @RequestParam(required = false) String keyword, | ||
| 31 | + @RequestParam(defaultValue = "1") int page) { | ||
| 32 | + return Result.success(merchantService.storeList(cityId, keyword, page)); | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + /** 新增门店(平台直接建,无需审核) */ | ||
| 36 | + @PostMapping("/store/add") | ||
| 37 | + public Result<Long> addStore(@Valid @RequestBody MerchantStoreDTO dto) { | ||
| 38 | + return Result.success(merchantService.addStore(dto)); | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + /** 编辑门店 */ | ||
| 42 | + @PutMapping("/store/edit") | ||
| 43 | + public Result<Void> editStore(@Valid @RequestBody MerchantStoreDTO dto) { | ||
| 44 | + merchantService.editStore(dto); | ||
| 45 | + return Result.success(); | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + /** 门店详情 */ | ||
| 49 | + @GetMapping("/store/detail") | ||
| 50 | + public Result<MerchantStore> storeDetail(@RequestParam Long storeId) { | ||
| 51 | + return Result.success(merchantService.getStore(storeId)); | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + /** 设置营业/打烊 */ | ||
| 55 | + @PostMapping("/store/setOperatingState") | ||
| 56 | + public Result<Void> setOperatingState(@RequestParam Long storeId, @RequestParam int state) { | ||
| 57 | + merchantService.setOperatingState(storeId, state); | ||
| 58 | + return Result.success(); | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + /** 更新免运费和起送金额 */ | ||
| 62 | + @PostMapping("/store/updateFeeConfig") | ||
| 63 | + public Result<Void> updateFeeConfig( | ||
| 64 | + @RequestParam Long storeId, | ||
| 65 | + @RequestParam(defaultValue = "0") BigDecimal freeShipping, | ||
| 66 | + @RequestParam(defaultValue = "0") BigDecimal upToSend) { | ||
| 67 | + merchantService.updateFeeConfig(storeId, freeShipping, upToSend); | ||
| 68 | + return Result.success(); | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + /** 删除门店 */ | ||
| 72 | + @DeleteMapping("/store/del") | ||
| 73 | + public Result<Void> delStore(@RequestParam Long storeId) { | ||
| 74 | + merchantService.delStore(storeId); | ||
| 75 | + return Result.success(); | ||
| 76 | + } | ||
| 77 | +} |
src/main/java/com/diligrp/rider/controller/PlatformOpenAppController.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/controller/PlatformOpenAppController.java | ||
| 1 | +package com.diligrp.rider.controller; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||
| 4 | +import com.diligrp.rider.common.result.Result; | ||
| 5 | +import com.diligrp.rider.dto.PlatformMockDeliveryCreateDTO; | ||
| 6 | +import com.diligrp.rider.entity.OpenApp; | ||
| 7 | +import com.diligrp.rider.entity.WebhookLog; | ||
| 8 | +import com.diligrp.rider.mapper.OpenAppMapper; | ||
| 9 | +import com.diligrp.rider.mapper.WebhookLogMapper; | ||
| 10 | +import com.diligrp.rider.service.DeliveryOrderService; | ||
| 11 | +import com.diligrp.rider.service.OpenAppService; | ||
| 12 | +import com.diligrp.rider.service.WebhookService; | ||
| 13 | +import com.diligrp.rider.vo.DeliveryOrderCreateVO; | ||
| 14 | +import jakarta.validation.Valid; | ||
| 15 | +import lombok.RequiredArgsConstructor; | ||
| 16 | +import org.springframework.web.bind.annotation.*; | ||
| 17 | + | ||
| 18 | +import java.util.List; | ||
| 19 | + | ||
| 20 | +/** | ||
| 21 | + * 平台后台:开放平台应用管理 | ||
| 22 | + */ | ||
| 23 | +@RestController | ||
| 24 | +@RequestMapping("/api/platform/open") | ||
| 25 | +@RequiredArgsConstructor | ||
| 26 | +public class PlatformOpenAppController { | ||
| 27 | + | ||
| 28 | + private final OpenAppService openAppService; | ||
| 29 | + private final WebhookService webhookService; | ||
| 30 | + private final WebhookLogMapper webhookLogMapper; | ||
| 31 | + private final OpenAppMapper openAppMapper; | ||
| 32 | + private final DeliveryOrderService deliveryOrderService; | ||
| 33 | + | ||
| 34 | + /** 应用列表 */ | ||
| 35 | + @GetMapping("/list") | ||
| 36 | + public Result<List<OpenApp>> list(@RequestParam(defaultValue = "1") int page) { | ||
| 37 | + return Result.success(openAppService.list(page)); | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + /** 创建应用 */ | ||
| 41 | + @PostMapping("/create") | ||
| 42 | + public Result<OpenApp> create(@RequestParam String appName, | ||
| 43 | + @RequestParam Long cityId, | ||
| 44 | + @RequestParam(required = false) Long storeId, | ||
| 45 | + @RequestParam(required = false) String webhookUrl, | ||
| 46 | + @RequestParam(required = false) String webhookEvents, | ||
| 47 | + @RequestParam(required = false) String remark) { | ||
| 48 | + return Result.success(openAppService.create(appName, cityId, storeId, webhookUrl, webhookEvents, remark)); | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + /** 平台后台模拟推送配送单 */ | ||
| 52 | + @PostMapping("/mockDelivery/create") | ||
| 53 | + public Result<DeliveryOrderCreateVO> mockDeliveryCreate(@Valid @RequestBody PlatformMockDeliveryCreateDTO dto) { | ||
| 54 | + OpenApp app = openAppMapper.selectById(dto.getAppId()); | ||
| 55 | + if (app == null) { | ||
| 56 | + return Result.error("应用不存在"); | ||
| 57 | + } | ||
| 58 | + return Result.success(deliveryOrderService.create(app.getAppKey(), dto)); | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + /** 重置 AppSecret */ | ||
| 62 | + @PostMapping("/resetSecret") | ||
| 63 | + public Result<String> resetSecret(@RequestParam Long appId) { | ||
| 64 | + return Result.success(openAppService.resetSecret(appId)); | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + /** 启用/禁用应用:status=0禁用 1启用 */ | ||
| 68 | + @PostMapping("/setStatus") | ||
| 69 | + public Result<Void> setStatus(@RequestParam Long appId, @RequestParam int status) { | ||
| 70 | + openAppService.setStatus(appId, status); | ||
| 71 | + return Result.success(); | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + /** 更新 Webhook 配置 */ | ||
| 75 | + @PostMapping("/updateWebhook") | ||
| 76 | + public Result<Void> updateWebhook(@RequestParam Long appId, | ||
| 77 | + @RequestParam String webhookUrl, | ||
| 78 | + @RequestParam String webhookEvents) { | ||
| 79 | + openAppService.updateWebhook(appId, webhookUrl, webhookEvents); | ||
| 80 | + return Result.success(); | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + /** Webhook 推送日志 */ | ||
| 84 | + @GetMapping("/webhook/logs") | ||
| 85 | + public Result<List<WebhookLog>> webhookLogs(@RequestParam Long appId, | ||
| 86 | + @RequestParam(defaultValue = "1") int page) { | ||
| 87 | + int offset = (page - 1) * 20; | ||
| 88 | + List<WebhookLog> logs = webhookLogMapper.selectList( | ||
| 89 | + new LambdaQueryWrapper<WebhookLog>() | ||
| 90 | + .eq(WebhookLog::getAppId, appId) | ||
| 91 | + .orderByDesc(WebhookLog::getId) | ||
| 92 | + .last("LIMIT " + offset + ",20")); | ||
| 93 | + return Result.success(logs); | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | + /** 重试失败的 Webhook */ | ||
| 97 | + @PostMapping("/webhook/retry") | ||
| 98 | + public Result<Void> retryWebhook(@RequestParam Long logId) { | ||
| 99 | + webhookService.retry(logId); | ||
| 100 | + return Result.success(); | ||
| 101 | + } | ||
| 102 | +} |
src/main/java/com/diligrp/rider/controller/PlatformSubstationController.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/controller/PlatformSubstationController.java | ||
| 1 | +package com.diligrp.rider.controller; | ||
| 2 | + | ||
| 3 | +import com.diligrp.rider.common.result.Result; | ||
| 4 | +import com.diligrp.rider.dto.ChangePasswordDTO; | ||
| 5 | +import com.diligrp.rider.entity.Substation; | ||
| 6 | +import com.diligrp.rider.service.SubstationService; | ||
| 7 | +import jakarta.validation.Valid; | ||
| 8 | +import lombok.RequiredArgsConstructor; | ||
| 9 | +import org.springframework.web.bind.annotation.*; | ||
| 10 | + | ||
| 11 | +import java.util.List; | ||
| 12 | + | ||
| 13 | +@RestController | ||
| 14 | +@RequestMapping("/api/platform/substation") | ||
| 15 | +@RequiredArgsConstructor | ||
| 16 | +public class PlatformSubstationController { | ||
| 17 | + | ||
| 18 | + private final SubstationService substationService; | ||
| 19 | + | ||
| 20 | + /** 分站管理员列表 */ | ||
| 21 | + @GetMapping("/list") | ||
| 22 | + public Result<List<Substation>> list(@RequestParam(required = false) String keyword) { | ||
| 23 | + return Result.success(substationService.list(keyword)); | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + /** 新增分站管理员 */ | ||
| 27 | + @PostMapping("/add") | ||
| 28 | + public Result<Void> add(@RequestBody Substation substation) { | ||
| 29 | + substationService.add(substation); | ||
| 30 | + return Result.success(); | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + /** 编辑分站管理员 */ | ||
| 34 | + @PutMapping("/edit") | ||
| 35 | + public Result<Void> edit(@RequestBody Substation substation) { | ||
| 36 | + substationService.edit(substation); | ||
| 37 | + return Result.success(); | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + /** 禁用 */ | ||
| 41 | + @PostMapping("/ban") | ||
| 42 | + public Result<Void> ban(@RequestParam Long id) { | ||
| 43 | + substationService.ban(id); | ||
| 44 | + return Result.success(); | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + /** 启用 */ | ||
| 48 | + @PostMapping("/cancelBan") | ||
| 49 | + public Result<Void> cancelBan(@RequestParam Long id) { | ||
| 50 | + substationService.cancelBan(id); | ||
| 51 | + return Result.success(); | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + /** 删除 */ | ||
| 55 | + @DeleteMapping("/del") | ||
| 56 | + public Result<Void> del(@RequestParam Long id) { | ||
| 57 | + substationService.del(id); | ||
| 58 | + return Result.success(); | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + /** 根据城市ID查分站管理员 */ | ||
| 62 | + @GetMapping("/getByCity") | ||
| 63 | + public Result<Substation> getByCity(@RequestParam Long cityId) { | ||
| 64 | + return Result.success(substationService.getByCityId(cityId)); | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + /** | ||
| 68 | + * 分站管理员修改自己的密码 | ||
| 69 | + * 需要携带分站管理员 token(role=substation) | ||
| 70 | + */ | ||
| 71 | + @PostMapping("/changePassword") | ||
| 72 | + public Result<Void> changePassword( | ||
| 73 | + @Valid @RequestBody ChangePasswordDTO dto, | ||
| 74 | + jakarta.servlet.http.HttpServletRequest request) { | ||
| 75 | + Long adminId = (Long) request.getAttribute("adminId"); | ||
| 76 | + substationService.changePassword(adminId, dto.getOldPassword(), dto.getNewPassword()); | ||
| 77 | + return Result.success(); | ||
| 78 | + } | ||
| 79 | +} |
src/main/java/com/diligrp/rider/controller/RiderAuthController.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/controller/RiderAuthController.java | ||
| 1 | +package com.diligrp.rider.controller; | ||
| 2 | + | ||
| 3 | +import com.diligrp.rider.common.result.Result; | ||
| 4 | +import com.diligrp.rider.dto.ApplyDTO; | ||
| 5 | +import com.diligrp.rider.dto.LoginDTO; | ||
| 6 | +import com.diligrp.rider.service.RiderAuthService; | ||
| 7 | +import com.diligrp.rider.vo.RiderVO; | ||
| 8 | +import jakarta.validation.Valid; | ||
| 9 | +import lombok.RequiredArgsConstructor; | ||
| 10 | +import org.springframework.web.bind.annotation.*; | ||
| 11 | + | ||
| 12 | +@RestController | ||
| 13 | +@RequestMapping("/api/rider") | ||
| 14 | +@RequiredArgsConstructor | ||
| 15 | +public class RiderAuthController { | ||
| 16 | + | ||
| 17 | + private final RiderAuthService authService; | ||
| 18 | + | ||
| 19 | + /** 骑手申请注册 */ | ||
| 20 | + @PostMapping("/apply") | ||
| 21 | + public Result<Void> apply(@Valid @RequestBody ApplyDTO dto) { | ||
| 22 | + authService.apply(dto); | ||
| 23 | + return Result.success(); | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + /** 密码登录 */ | ||
| 27 | + @PostMapping("/login/pass") | ||
| 28 | + public Result<RiderVO> loginByPass(@Valid @RequestBody LoginDTO dto) { | ||
| 29 | + return Result.success(authService.loginByPass(dto)); | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + /** 获取个人信息 */ | ||
| 33 | + @GetMapping("/user/info") | ||
| 34 | + public Result<RiderVO> getInfo(jakarta.servlet.http.HttpServletRequest request) { | ||
| 35 | + Long riderId = (Long) request.getAttribute("riderId"); | ||
| 36 | + return Result.success(authService.getInfo(riderId)); | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + /** 切换休息/接单状态 */ | ||
| 40 | + @PostMapping("/user/toggleRest") | ||
| 41 | + public Result<Void> toggleRest(jakarta.servlet.http.HttpServletRequest request) { | ||
| 42 | + Long riderId = (Long) request.getAttribute("riderId"); | ||
| 43 | + authService.toggleRest(riderId); | ||
| 44 | + return Result.success(); | ||
| 45 | + } | ||
| 46 | +} |
src/main/java/com/diligrp/rider/controller/RiderBalanceController.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/controller/RiderBalanceController.java | ||
| 1 | +package com.diligrp.rider.controller; | ||
| 2 | + | ||
| 3 | +import com.diligrp.rider.common.result.Result; | ||
| 4 | +import com.diligrp.rider.service.RiderBalanceService; | ||
| 5 | +import com.diligrp.rider.vo.BalanceVO; | ||
| 6 | +import jakarta.servlet.http.HttpServletRequest; | ||
| 7 | +import lombok.RequiredArgsConstructor; | ||
| 8 | +import org.springframework.web.bind.annotation.*; | ||
| 9 | + | ||
| 10 | +import java.math.BigDecimal; | ||
| 11 | + | ||
| 12 | +@RestController | ||
| 13 | +@RequestMapping("/api/rider/balance") | ||
| 14 | +@RequiredArgsConstructor | ||
| 15 | +public class RiderBalanceController { | ||
| 16 | + | ||
| 17 | + private final RiderBalanceService balanceService; | ||
| 18 | + | ||
| 19 | + /** 查询余额及流水 */ | ||
| 20 | + @GetMapping | ||
| 21 | + public Result<BalanceVO> getBalance(@RequestParam(defaultValue = "1") int page, | ||
| 22 | + HttpServletRequest request) { | ||
| 23 | + Long riderId = (Long) request.getAttribute("riderId"); | ||
| 24 | + return Result.success(balanceService.getBalance(riderId, page)); | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + /** 今日收入统计 */ | ||
| 28 | + @GetMapping("/today") | ||
| 29 | + public Result<BigDecimal> todayIncome(HttpServletRequest request) { | ||
| 30 | + Long riderId = (Long) request.getAttribute("riderId"); | ||
| 31 | + return Result.success(balanceService.getTodayIncome(riderId)); | ||
| 32 | + } | ||
| 33 | +} |
src/main/java/com/diligrp/rider/controller/RiderExtController.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/controller/RiderExtController.java | ||
| 1 | +package com.diligrp.rider.controller; | ||
| 2 | + | ||
| 3 | +import com.diligrp.rider.common.result.Result; | ||
| 4 | +import com.diligrp.rider.service.RiderEvaluateService; | ||
| 5 | +import com.diligrp.rider.service.RiderOrderService; | ||
| 6 | +import com.diligrp.rider.service.RefundService; | ||
| 7 | +import com.diligrp.rider.entity.OrderRefundReason; | ||
| 8 | +import com.diligrp.rider.vo.RiderMonthCountVO; | ||
| 9 | +import com.diligrp.rider.vo.RiderTodayCountVO; | ||
| 10 | +import com.diligrp.rider.vo.OrderVO; | ||
| 11 | +import jakarta.servlet.http.HttpServletRequest; | ||
| 12 | +import lombok.Data; | ||
| 13 | +import lombok.RequiredArgsConstructor; | ||
| 14 | +import org.springframework.web.bind.annotation.*; | ||
| 15 | + | ||
| 16 | +import java.util.List; | ||
| 17 | + | ||
| 18 | +/** | ||
| 19 | + * 骑手端扩展接口:转单/退款/评价/统计 | ||
| 20 | + */ | ||
| 21 | +@RestController | ||
| 22 | +@RequestMapping("/api/rider") | ||
| 23 | +@RequiredArgsConstructor | ||
| 24 | +public class RiderExtController { | ||
| 25 | + | ||
| 26 | + private final RiderOrderService orderService; | ||
| 27 | + private final RiderEvaluateService evaluateService; | ||
| 28 | + private final RefundService refundService; | ||
| 29 | + | ||
| 30 | + @Data | ||
| 31 | + static class OrderIdReq { private Long orderId; } | ||
| 32 | + @Data | ||
| 33 | + static class RefundReq { | ||
| 34 | + private Long orderId; | ||
| 35 | + private Long reasonId = 0L; | ||
| 36 | + private String reason = ""; | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + // ---- 转单 ---- | ||
| 40 | + | ||
| 41 | + /** 骑手申请转单(仅 status=3 可申请) */ | ||
| 42 | + @PostMapping("/order/applyTrans") | ||
| 43 | + public Result<Void> applyTrans(@RequestBody OrderIdReq req, HttpServletRequest request) { | ||
| 44 | + Long riderId = (Long) request.getAttribute("riderId"); | ||
| 45 | + orderService.applyTrans(riderId, req.getOrderId()); | ||
| 46 | + return Result.success(); | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + // ---- 统计 ---- | ||
| 50 | + | ||
| 51 | + /** 今日统计 */ | ||
| 52 | + @GetMapping("/order/count/today") | ||
| 53 | + public Result<RiderTodayCountVO> todayCount(HttpServletRequest request) { | ||
| 54 | + Long riderId = (Long) request.getAttribute("riderId"); | ||
| 55 | + return Result.success(orderService.getTodayCount(riderId)); | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + /** 月度统计(year=0表示本年) */ | ||
| 59 | + @GetMapping("/order/count/month") | ||
| 60 | + public Result<List<RiderMonthCountVO>> monthCount( | ||
| 61 | + @RequestParam(defaultValue = "0") int year, | ||
| 62 | + HttpServletRequest request) { | ||
| 63 | + Long riderId = (Long) request.getAttribute("riderId"); | ||
| 64 | + return Result.success(orderService.getMonthCount(riderId, year)); | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + /** | ||
| 68 | + * 骑手历史订单明细列表 | ||
| 69 | + * type=0全部 1已完成 2已转单 | ||
| 70 | + */ | ||
| 71 | + @GetMapping("/order/count/list") | ||
| 72 | + public Result<List<OrderVO>> countList( | ||
| 73 | + @RequestParam(defaultValue = "0") int type, | ||
| 74 | + @RequestParam(defaultValue = "1") int page, | ||
| 75 | + HttpServletRequest request) { | ||
| 76 | + Long riderId = (Long) request.getAttribute("riderId"); | ||
| 77 | + return Result.success(orderService.getCountList(riderId, type, page)); | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + // ---- 退款 ---- | ||
| 81 | + | ||
| 82 | + /** 退款原因列表(role=2骑手) */ | ||
| 83 | + @GetMapping("/order/refund/reasons") | ||
| 84 | + public Result<List<OrderRefundReason>> refundReasons() { | ||
| 85 | + return Result.success(refundService.getReasons(2)); | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + /** 骑手申请退款 */ | ||
| 89 | + @PostMapping("/order/refund/apply") | ||
| 90 | + public Result<Void> applyRefund(@RequestBody RefundReq req, HttpServletRequest request) { | ||
| 91 | + Long riderId = (Long) request.getAttribute("riderId"); | ||
| 92 | + Long reasonId = req.getReasonId() != null ? req.getReasonId() : 0L; | ||
| 93 | + String reason = req.getReason() != null ? req.getReason() : ""; | ||
| 94 | + refundService.applyRefund(req.getOrderId(), riderId, 2, reasonId, reason); | ||
| 95 | + return Result.success(); | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + // ---- 评价 ---- | ||
| 99 | + | ||
| 100 | + /** 骑手查看自己的评价列表(type=1好评 2中评 3差评 0全部) */ | ||
| 101 | + @GetMapping("/evaluate/list") | ||
| 102 | + public Result<List<?>> evaluateList( | ||
| 103 | + @RequestParam(defaultValue = "0") int type, | ||
| 104 | + @RequestParam(defaultValue = "1") int page, | ||
| 105 | + HttpServletRequest request) { | ||
| 106 | + Long riderId = (Long) request.getAttribute("riderId"); | ||
| 107 | + return Result.success(evaluateService.getRiderEvaluates(riderId, type, page)); | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + /** 本月好评数 */ | ||
| 111 | + @GetMapping("/evaluate/month/good") | ||
| 112 | + public Result<Integer> monthGoodCount(HttpServletRequest request) { | ||
| 113 | + Long riderId = (Long) request.getAttribute("riderId"); | ||
| 114 | + return Result.success(evaluateService.getMonthGoodCount(riderId)); | ||
| 115 | + } | ||
| 116 | +} |
src/main/java/com/diligrp/rider/controller/RiderLocationController.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/controller/RiderLocationController.java | ||
| 1 | +package com.diligrp.rider.controller; | ||
| 2 | + | ||
| 3 | +import com.diligrp.rider.common.result.Result; | ||
| 4 | +import com.diligrp.rider.dto.LocationDTO; | ||
| 5 | +import com.diligrp.rider.service.RiderLocationService; | ||
| 6 | +import com.diligrp.rider.vo.NearbyRiderVO; | ||
| 7 | +import jakarta.servlet.http.HttpServletRequest; | ||
| 8 | +import jakarta.validation.Valid; | ||
| 9 | +import lombok.RequiredArgsConstructor; | ||
| 10 | +import org.springframework.web.bind.annotation.*; | ||
| 11 | + | ||
| 12 | +import java.util.List; | ||
| 13 | + | ||
| 14 | +@RestController | ||
| 15 | +@RequestMapping("/api/rider/location") | ||
| 16 | +@RequiredArgsConstructor | ||
| 17 | +public class RiderLocationController { | ||
| 18 | + | ||
| 19 | + private final RiderLocationService locationService; | ||
| 20 | + | ||
| 21 | + /** 上报位置 */ | ||
| 22 | + @PostMapping("/update") | ||
| 23 | + public Result<Void> update(@Valid @RequestBody LocationDTO dto, HttpServletRequest request) { | ||
| 24 | + Long riderId = (Long) request.getAttribute("riderId"); | ||
| 25 | + locationService.updateLocation(riderId, dto); | ||
| 26 | + return Result.success(); | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + /** 查看自己位置 */ | ||
| 30 | + @GetMapping | ||
| 31 | + public Result<LocationDTO> get(HttpServletRequest request) { | ||
| 32 | + Long riderId = (Long) request.getAttribute("riderId"); | ||
| 33 | + return Result.success(locationService.getLocation(riderId)); | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + /** | ||
| 37 | + * 附近在线骑手列表(分站地图查看用) | ||
| 38 | + * Location.getNearby() | ||
| 39 | + */ | ||
| 40 | + @GetMapping("/nearby") | ||
| 41 | + public Result<List<NearbyRiderVO>> nearby( | ||
| 42 | + @RequestParam Long cityId, | ||
| 43 | + @RequestParam String lng, | ||
| 44 | + @RequestParam String lat, | ||
| 45 | + HttpServletRequest request) { | ||
| 46 | + return Result.success(locationService.getNearby(cityId, lng, lat)); | ||
| 47 | + } | ||
| 48 | +} |
src/main/java/com/diligrp/rider/controller/RiderOrderController.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/controller/RiderOrderController.java | ||
| 1 | +package com.diligrp.rider.controller; | ||
| 2 | + | ||
| 3 | +import com.diligrp.rider.common.result.Result; | ||
| 4 | +import com.diligrp.rider.service.RiderOrderService; | ||
| 5 | +import com.diligrp.rider.vo.OrderVO; | ||
| 6 | +import jakarta.servlet.http.HttpServletRequest; | ||
| 7 | +import lombok.Data; | ||
| 8 | +import lombok.RequiredArgsConstructor; | ||
| 9 | +import org.springframework.web.bind.annotation.*; | ||
| 10 | + | ||
| 11 | +import java.util.List; | ||
| 12 | + | ||
| 13 | +@RestController | ||
| 14 | +@RequestMapping("/api/rider/order") | ||
| 15 | +@RequiredArgsConstructor | ||
| 16 | +public class RiderOrderController { | ||
| 17 | + | ||
| 18 | + private final RiderOrderService orderService; | ||
| 19 | + | ||
| 20 | + @Data | ||
| 21 | + static class OrderIdCityReq { private Long orderId; private Long cityId; } | ||
| 22 | + @Data | ||
| 23 | + static class OrderCompleteReq { private Long orderId; private String thumbs; } | ||
| 24 | + @Data | ||
| 25 | + static class OrderStartReq { private Long orderId; private String code; } | ||
| 26 | + | ||
| 27 | + /** | ||
| 28 | + * 订单列表 | ||
| 29 | + * @param type 1=待接单 2=待取货 3=待完成 | ||
| 30 | + * @param cityId 城市ID | ||
| 31 | + * @param page 页码 | ||
| 32 | + */ | ||
| 33 | + @GetMapping("/list") | ||
| 34 | + public Result<List<OrderVO>> list(@RequestParam Integer type, | ||
| 35 | + @RequestParam Long cityId, | ||
| 36 | + @RequestParam(defaultValue = "1") int page, | ||
| 37 | + HttpServletRequest request) { | ||
| 38 | + Long riderId = (Long) request.getAttribute("riderId"); | ||
| 39 | + return Result.success(orderService.getList(riderId, cityId, type, page)); | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + /** 订单详情 */ | ||
| 43 | + @GetMapping("/detail") | ||
| 44 | + public Result<OrderVO> detail(@RequestParam Long orderId, HttpServletRequest request) { | ||
| 45 | + Long riderId = (Long) request.getAttribute("riderId"); | ||
| 46 | + return Result.success(orderService.getDetail(riderId, orderId)); | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + /** 拒单 */ | ||
| 50 | + @PostMapping("/refuse") | ||
| 51 | + public Result<Void> refuse(@RequestBody OrderIdCityReq req, HttpServletRequest request) { | ||
| 52 | + Long riderId = (Long) request.getAttribute("riderId"); | ||
| 53 | + orderService.refuse(riderId, req.getCityId(), req.getOrderId()); | ||
| 54 | + return Result.success(); | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + /** 抢单 */ | ||
| 58 | + @PostMapping("/grap") | ||
| 59 | + public Result<Void> grap(@RequestBody OrderIdCityReq req, HttpServletRequest request) { | ||
| 60 | + Long riderId = (Long) request.getAttribute("riderId"); | ||
| 61 | + orderService.grap(riderId, req.getCityId(), req.getOrderId()); | ||
| 62 | + return Result.success(); | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + /** 开始服务(取件),输入完成码 */ | ||
| 66 | + @PostMapping("/start") | ||
| 67 | + public Result<Void> start(@RequestBody OrderStartReq req, HttpServletRequest request) { | ||
| 68 | + Long riderId = (Long) request.getAttribute("riderId"); | ||
| 69 | + orderService.start(riderId, req.getOrderId(), req.getCode()); | ||
| 70 | + return Result.success(); | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + /** 完成订单,上传照片 */ | ||
| 74 | + @PostMapping("/complete") | ||
| 75 | + public Result<Void> complete(@RequestBody OrderCompleteReq req, HttpServletRequest request) { | ||
| 76 | + Long riderId = (Long) request.getAttribute("riderId"); | ||
| 77 | + orderService.complete(riderId, req.getOrderId(), req.getThumbs()); | ||
| 78 | + return Result.success(); | ||
| 79 | + } | ||
| 80 | +} |
src/main/java/com/diligrp/rider/controller/RiderUploadController.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/controller/RiderUploadController.java | ||
| 1 | +package com.diligrp.rider.controller; | ||
| 2 | + | ||
| 3 | +import com.diligrp.rider.common.result.Result; | ||
| 4 | +import lombok.RequiredArgsConstructor; | ||
| 5 | +import org.springframework.web.bind.annotation.*; | ||
| 6 | +import org.springframework.web.multipart.MultipartFile; | ||
| 7 | + | ||
| 8 | +import java.util.Map; | ||
| 9 | +import java.util.UUID; | ||
| 10 | + | ||
| 11 | +@RestController | ||
| 12 | +@RequestMapping("/api/rider/upload") | ||
| 13 | +@RequiredArgsConstructor | ||
| 14 | +public class RiderUploadController { | ||
| 15 | + | ||
| 16 | + /** 文件上传(mock:返回占位图URL)TODO: 接入实际存储服务 */ | ||
| 17 | + @PostMapping("") | ||
| 18 | + public Result<Map<String, Object>> upload(@RequestParam("file") MultipartFile file) { | ||
| 19 | + String filename = UUID.randomUUID().toString().replace("-", "") + ".jpg"; | ||
| 20 | + String url = "https://diligrp.com/static/upload/" + filename; | ||
| 21 | + return Result.success(Map.of("url", url)); | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + @GetMapping("/config") | ||
| 25 | + public Result<Map<String, Object>> getUploadConfig() { | ||
| 26 | + return Result.success(Map.of( | ||
| 27 | + "url", 0, | ||
| 28 | + "domain", "", | ||
| 29 | + "qiniu", Map.of(), | ||
| 30 | + "ali", Map.of(), | ||
| 31 | + "txcos", Map.of() | ||
| 32 | + )); | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + @GetMapping("/qiniu/token") | ||
| 36 | + public Result<Map<String, Object>> getQiniuToken() { | ||
| 37 | + return Result.success(Map.of("token", "")); | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + @GetMapping("/ali/sts") | ||
| 41 | + public Result<Map<String, Object>> getAliSts() { | ||
| 42 | + return Result.success(Map.of( | ||
| 43 | + "accessKeyId", "", | ||
| 44 | + "accessKeySecret", "", | ||
| 45 | + "securityToken", "", | ||
| 46 | + "endpoint", "", | ||
| 47 | + "bucket", "" | ||
| 48 | + )); | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + @GetMapping("/txcos/sts") | ||
| 52 | + public Result<Map<String, Object>> getTxSts() { | ||
| 53 | + return Result.success(Map.of( | ||
| 54 | + "tmpSecretId", "", | ||
| 55 | + "tmpSecretKey", "", | ||
| 56 | + "sessionToken", "", | ||
| 57 | + "region", "", | ||
| 58 | + "bucket", "", | ||
| 59 | + "appid", "" | ||
| 60 | + )); | ||
| 61 | + } | ||
| 62 | +} |
src/main/java/com/diligrp/rider/dto/AdminLoginDTO.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/dto/AdminLoginDTO.java | ||
| 1 | +package com.diligrp.rider.dto; | ||
| 2 | + | ||
| 3 | +import jakarta.validation.constraints.NotBlank; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +@Data | ||
| 7 | +public class AdminLoginDTO { | ||
| 8 | + @NotBlank(message = "账号不能为空") | ||
| 9 | + private String account; | ||
| 10 | + @NotBlank(message = "密码不能为空") | ||
| 11 | + private String pass; | ||
| 12 | + /** 登录角色:admin=超级管理员 substation=分站管理员 */ | ||
| 13 | + private String role = "substation"; | ||
| 14 | +} |
src/main/java/com/diligrp/rider/dto/AdminRiderAddDTO.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/dto/AdminRiderAddDTO.java | ||
| 1 | +package com.diligrp.rider.dto; | ||
| 2 | + | ||
| 3 | +import jakarta.validation.constraints.NotBlank; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +@Data | ||
| 7 | +public class AdminRiderAddDTO { | ||
| 8 | + @NotBlank(message = "昵称不能为空") | ||
| 9 | + private String userNickname; | ||
| 10 | + | ||
| 11 | + @NotBlank(message = "手机号不能为空") | ||
| 12 | + private String mobile; | ||
| 13 | + | ||
| 14 | + @NotBlank(message = "密码不能为空") | ||
| 15 | + private String password; | ||
| 16 | + | ||
| 17 | + private Long cityId; | ||
| 18 | +} |
src/main/java/com/diligrp/rider/dto/AdminRiderLevelSaveDTO.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/dto/AdminRiderLevelSaveDTO.java | ||
| 1 | +package com.diligrp.rider.dto; | ||
| 2 | + | ||
| 3 | +import jakarta.validation.constraints.NotBlank; | ||
| 4 | +import jakarta.validation.constraints.NotNull; | ||
| 5 | +import lombok.Data; | ||
| 6 | + | ||
| 7 | +import java.math.BigDecimal; | ||
| 8 | + | ||
| 9 | +@Data | ||
| 10 | +public class AdminRiderLevelSaveDTO { | ||
| 11 | + private Long id; | ||
| 12 | + | ||
| 13 | + @NotNull(message = "城市不能为空") | ||
| 14 | + private Long cityId; | ||
| 15 | + | ||
| 16 | + @NotNull(message = "等级编号不能为空") | ||
| 17 | + private Integer levelId; | ||
| 18 | + | ||
| 19 | + @NotBlank(message = "等级名称不能为空") | ||
| 20 | + private String name; | ||
| 21 | + | ||
| 22 | + @NotNull(message = "转单次数上限不能为空") | ||
| 23 | + private Integer transNums; | ||
| 24 | + | ||
| 25 | + @NotNull(message = "收入模式不能为空") | ||
| 26 | + private Integer runFeeMode; | ||
| 27 | + | ||
| 28 | + private BigDecimal runFixMoney; | ||
| 29 | + private BigDecimal runRate; | ||
| 30 | + private Integer distanceBasic; | ||
| 31 | + private BigDecimal distanceBasicMoney; | ||
| 32 | + private BigDecimal distanceMoreMoney; | ||
| 33 | + private BigDecimal distanceMaxMoney; | ||
| 34 | +} |
src/main/java/com/diligrp/rider/dto/ApplyDTO.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/dto/ApplyDTO.java | ||
| 1 | +package com.diligrp.rider.dto; | ||
| 2 | + | ||
| 3 | +import jakarta.validation.constraints.NotBlank; | ||
| 4 | +import jakarta.validation.constraints.NotNull; | ||
| 5 | +import lombok.Data; | ||
| 6 | + | ||
| 7 | +@Data | ||
| 8 | +public class ApplyDTO { | ||
| 9 | + @NotBlank(message = "姓名不能为空") | ||
| 10 | + private String name; | ||
| 11 | + @NotBlank(message = "手机号不能为空") | ||
| 12 | + private String mobile; | ||
| 13 | + @NotBlank(message = "密码不能为空") | ||
| 14 | + private String pass; | ||
| 15 | + @NotBlank(message = "验证码不能为空") | ||
| 16 | + private String code; | ||
| 17 | + private String idNo; | ||
| 18 | + private String thumb; | ||
| 19 | + @NotNull(message = "城市不能为空") | ||
| 20 | + private Long cityId; | ||
| 21 | +} |
src/main/java/com/diligrp/rider/dto/ChangePasswordDTO.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/dto/ChangePasswordDTO.java | ||
| 1 | +package com.diligrp.rider.dto; | ||
| 2 | + | ||
| 3 | +import jakarta.validation.constraints.NotBlank; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +@Data | ||
| 7 | +public class ChangePasswordDTO { | ||
| 8 | + @NotBlank(message = "原密码不能为空") | ||
| 9 | + private String oldPassword; | ||
| 10 | + @NotBlank(message = "新密码不能为空") | ||
| 11 | + private String newPassword; | ||
| 12 | +} |
src/main/java/com/diligrp/rider/dto/DeliveryFeeCalcDTO.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/dto/DeliveryFeeCalcDTO.java | ||
| 1 | +package com.diligrp.rider.dto; | ||
| 2 | + | ||
| 3 | +import jakarta.validation.constraints.NotNull; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +import java.math.BigDecimal; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 配送费计算请求 DTO | ||
| 10 | + */ | ||
| 11 | +@Data | ||
| 12 | +public class DeliveryFeeCalcDTO { | ||
| 13 | + | ||
| 14 | + @NotNull(message = "城市ID不能为空") | ||
| 15 | + private Long cityId; | ||
| 16 | + | ||
| 17 | + /** 订单类型:1=帮我送 2=帮我取 6=外卖配送 */ | ||
| 18 | + @NotNull(message = "订单类型不能为空") | ||
| 19 | + private Integer orderType; | ||
| 20 | + | ||
| 21 | + /** 起点经度 */ | ||
| 22 | + @NotNull(message = "起点经度不能为空") | ||
| 23 | + private String startLng; | ||
| 24 | + | ||
| 25 | + /** 起点纬度 */ | ||
| 26 | + @NotNull(message = "起点纬度不能为空") | ||
| 27 | + private String startLat; | ||
| 28 | + | ||
| 29 | + /** 终点经度 */ | ||
| 30 | + @NotNull(message = "终点经度不能为空") | ||
| 31 | + private String endLng; | ||
| 32 | + | ||
| 33 | + /** 终点纬度 */ | ||
| 34 | + @NotNull(message = "终点纬度不能为空") | ||
| 35 | + private String endLat; | ||
| 36 | + | ||
| 37 | + /** 重量(kg),不传默认0 */ | ||
| 38 | + private BigDecimal weight = BigDecimal.ZERO; | ||
| 39 | + | ||
| 40 | + /** 件数,不传默认0 */ | ||
| 41 | + private Integer pieces = 0; | ||
| 42 | + | ||
| 43 | + /** 服务时间戳(秒),用于时段附加费匹配,0=当前时间 */ | ||
| 44 | + private Long serviceTime = 0L; | ||
| 45 | +} |
src/main/java/com/diligrp/rider/dto/DeliveryFeePlanPreviewDTO.java
0 → 100644
src/main/java/com/diligrp/rider/dto/DeliveryFeePlanSaveDTO.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/dto/DeliveryFeePlanSaveDTO.java | ||
| 1 | +package com.diligrp.rider.dto; | ||
| 2 | + | ||
| 3 | +import lombok.Data; | ||
| 4 | + | ||
| 5 | +@Data | ||
| 6 | +public class DeliveryFeePlanSaveDTO { | ||
| 7 | + | ||
| 8 | + private String name; | ||
| 9 | + | ||
| 10 | + private Integer status; | ||
| 11 | + | ||
| 12 | + private Integer listOrder; | ||
| 13 | + | ||
| 14 | + private String remark; | ||
| 15 | + | ||
| 16 | + private DeliveryPricingConfigDTO config; | ||
| 17 | +} |
src/main/java/com/diligrp/rider/dto/DeliveryOrderCreateDTO.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/dto/DeliveryOrderCreateDTO.java | ||
| 1 | +package com.diligrp.rider.dto; | ||
| 2 | + | ||
| 3 | +import jakarta.validation.constraints.NotBlank; | ||
| 4 | +import jakarta.validation.constraints.NotNull; | ||
| 5 | +import lombok.Data; | ||
| 6 | + | ||
| 7 | +import java.math.BigDecimal; | ||
| 8 | +import java.util.List; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * 外部系统推单请求 DTO | ||
| 12 | + * 对应 POST /api/open/delivery/order/create | ||
| 13 | + */ | ||
| 14 | +@Data | ||
| 15 | +public class DeliveryOrderCreateDTO { | ||
| 16 | + | ||
| 17 | + /** 城市ID */ | ||
| 18 | + private Long cityId; | ||
| 19 | + | ||
| 20 | + /** | ||
| 21 | + * 接入方门店编号(对应 merchant_store.out_store_id) | ||
| 22 | + * 传入后中台自动查找门店,填充名称/地址/经纬度,无需重复传 storeName/storeLng/storeLat | ||
| 23 | + */ | ||
| 24 | + private String outStoreId; | ||
| 25 | + | ||
| 26 | + /** 发货门店名称(outStoreId 为空时必填) */ | ||
| 27 | + private String storeName; | ||
| 28 | + | ||
| 29 | + /** 发货门店地址 */ | ||
| 30 | + private String storeAddr; | ||
| 31 | + | ||
| 32 | + /** 发货门店经度(extStoreId 为空时必填) */ | ||
| 33 | + private String storeLng; | ||
| 34 | + | ||
| 35 | + /** 发货门店纬度(extStoreId 为空时必填) */ | ||
| 36 | + private String storeLat; | ||
| 37 | + | ||
| 38 | + /** 收件人姓名 */ | ||
| 39 | + @NotBlank(message = "收件人姓名不能为空") | ||
| 40 | + private String recipName; | ||
| 41 | + | ||
| 42 | + /** 收件人电话 */ | ||
| 43 | + @NotBlank(message = "收件人电话不能为空") | ||
| 44 | + private String recipPhone; | ||
| 45 | + | ||
| 46 | + /** 收件人地址 */ | ||
| 47 | + @NotBlank(message = "收件人地址不能为空") | ||
| 48 | + private String recipAddr; | ||
| 49 | + | ||
| 50 | + /** 收件人经度 */ | ||
| 51 | + @NotBlank(message = "收件人经度不能为空") | ||
| 52 | + private String recipLng; | ||
| 53 | + | ||
| 54 | + /** 收件人纬度 */ | ||
| 55 | + @NotBlank(message = "收件人纬度不能为空") | ||
| 56 | + private String recipLat; | ||
| 57 | + | ||
| 58 | + /** 外部系统订单号(用于回调对账,需唯一) */ | ||
| 59 | + @NotBlank(message = "外部订单号不能为空") | ||
| 60 | + private String outOrderNo; | ||
| 61 | + | ||
| 62 | + /** 货物重量(kg),用于重量计费,0=不计重 */ | ||
| 63 | + private BigDecimal weight = BigDecimal.ZERO; | ||
| 64 | + | ||
| 65 | + /** 期望配送时间戳(秒),0=立即配送 */ | ||
| 66 | + private Long serviceTime = 0L; | ||
| 67 | + | ||
| 68 | + /** 状态变更回调地址(可覆盖应用级配置) */ | ||
| 69 | + private String callbackUrl; | ||
| 70 | + | ||
| 71 | + /** 整单备注 */ | ||
| 72 | + private String remark; | ||
| 73 | + | ||
| 74 | + /** | ||
| 75 | + * 货物清单(骑手端可见) | ||
| 76 | + * 配送中台不解析具体业务含义,只做透传快照 | ||
| 77 | + */ | ||
| 78 | + private List<DeliveryItemDTO> items; | ||
| 79 | + | ||
| 80 | + /** 整单货物备注(如:放门口、不要辣等) */ | ||
| 81 | + private String itemRemark; | ||
| 82 | + | ||
| 83 | + @Data | ||
| 84 | + public static class DeliveryItemDTO { | ||
| 85 | + /** 货物名称 */ | ||
| 86 | + private String name; | ||
| 87 | + /** 数量 */ | ||
| 88 | + private Integer quantity = 1; | ||
| 89 | + /** 规格/型号(如大份、500ml等) */ | ||
| 90 | + private String spec; | ||
| 91 | + /** 单项备注 */ | ||
| 92 | + private String remark; | ||
| 93 | + } | ||
| 94 | +} |
src/main/java/com/diligrp/rider/dto/DeliveryPricingConfigDTO.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/dto/DeliveryPricingConfigDTO.java | ||
| 1 | +package com.diligrp.rider.dto; | ||
| 2 | + | ||
| 3 | +import lombok.Data; | ||
| 4 | + | ||
| 5 | +import java.math.BigDecimal; | ||
| 6 | +import java.util.List; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 外卖配送计价方案 DTO | ||
| 10 | + */ | ||
| 11 | +@Data | ||
| 12 | +public class DeliveryPricingConfigDTO { | ||
| 13 | + | ||
| 14 | + private List<Integer> type; | ||
| 15 | + private DeliveryPricingRuleDTO type6; | ||
| 16 | + private DeliveryPricingRuleDTO type1; | ||
| 17 | + private DeliveryPricingRuleDTO type2; | ||
| 18 | + private BigDecimal distanceBasic; | ||
| 19 | + private Integer distanceBasicTime; | ||
| 20 | + private Integer distanceMoreTime; | ||
| 21 | + private BigDecimal riderDistance; | ||
| 22 | + private Integer riderTime; | ||
| 23 | +} |
src/main/java/com/diligrp/rider/dto/DeliveryPricingRuleDTO.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/dto/DeliveryPricingRuleDTO.java | ||
| 1 | +package com.diligrp.rider.dto; | ||
| 2 | + | ||
| 3 | +import lombok.Data; | ||
| 4 | + | ||
| 5 | +import java.math.BigDecimal; | ||
| 6 | +import java.util.List; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 外卖配送计价维度 DTO | ||
| 10 | + */ | ||
| 11 | +@Data | ||
| 12 | +public class DeliveryPricingRuleDTO { | ||
| 13 | + | ||
| 14 | + private BigDecimal minFee = BigDecimal.ZERO; | ||
| 15 | + private Integer baseSwitch = 0; | ||
| 16 | + private BigDecimal baseFee = BigDecimal.ZERO; | ||
| 17 | + private Integer feeMode = 1; | ||
| 18 | + private BigDecimal fixMoney = BigDecimal.ZERO; | ||
| 19 | + private Integer distanceSwitch = 0; | ||
| 20 | + private BigDecimal distanceBasic = BigDecimal.ZERO; | ||
| 21 | + private BigDecimal distanceBasicMoney = BigDecimal.ZERO; | ||
| 22 | + private BigDecimal distanceMoreMoney = BigDecimal.ZERO; | ||
| 23 | + private Integer distanceMode = 1; | ||
| 24 | + private Integer distanceType = 1; | ||
| 25 | + private List<DistanceStepDTO> distanceSteps; | ||
| 26 | + private Integer weightSwitch = 0; | ||
| 27 | + private BigDecimal weightFirst = BigDecimal.ZERO; | ||
| 28 | + private BigDecimal weightFirstFee = BigDecimal.ZERO; | ||
| 29 | + private BigDecimal weightUnitFee = BigDecimal.ZERO; | ||
| 30 | + private BigDecimal weightCapFee = BigDecimal.ZERO; | ||
| 31 | + private BigDecimal weightBasic = BigDecimal.ZERO; | ||
| 32 | + private BigDecimal weightBasicMoney = BigDecimal.ZERO; | ||
| 33 | + private BigDecimal weightMoreMoney = BigDecimal.ZERO; | ||
| 34 | + private Integer weightType = 1; | ||
| 35 | + private Integer pieceSwitch = 0; | ||
| 36 | + private List<PieceRuleDTO> pieceRules; | ||
| 37 | + private List<TimePeriodDTO> times; | ||
| 38 | + | ||
| 39 | + @Data | ||
| 40 | + public static class DistanceStepDTO { | ||
| 41 | + private BigDecimal endDistance; | ||
| 42 | + private BigDecimal unitDistance; | ||
| 43 | + private BigDecimal unitFee; | ||
| 44 | + private Integer listOrder; | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + @Data | ||
| 48 | + public static class PieceRuleDTO { | ||
| 49 | + private Integer startPiece; | ||
| 50 | + private Integer endPiece; | ||
| 51 | + private BigDecimal fee; | ||
| 52 | + private Integer listOrder; | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + @Data | ||
| 56 | + public static class TimePeriodDTO { | ||
| 57 | + private Integer start; | ||
| 58 | + private Integer end; | ||
| 59 | + private Integer isOpen; | ||
| 60 | + private BigDecimal money; | ||
| 61 | + } | ||
| 62 | +} |
src/main/java/com/diligrp/rider/dto/LocationDTO.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/dto/LocationDTO.java | ||
| 1 | +package com.diligrp.rider.dto; | ||
| 2 | + | ||
| 3 | +import jakarta.validation.constraints.NotNull; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +@Data | ||
| 7 | +public class LocationDTO { | ||
| 8 | + @NotNull(message = "经度不能为空") | ||
| 9 | + private String lng; | ||
| 10 | + @NotNull(message = "纬度不能为空") | ||
| 11 | + private String lat; | ||
| 12 | +} |
src/main/java/com/diligrp/rider/dto/LoginDTO.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/dto/LoginDTO.java | ||
| 1 | +package com.diligrp.rider.dto; | ||
| 2 | + | ||
| 3 | +import jakarta.validation.constraints.NotBlank; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +@Data | ||
| 7 | +public class LoginDTO { | ||
| 8 | + @NotBlank(message = "手机号不能为空") | ||
| 9 | + private String username; | ||
| 10 | + @NotBlank(message = "密码不能为空") | ||
| 11 | + private String pass; | ||
| 12 | +} |
src/main/java/com/diligrp/rider/dto/MerchantEnterDTO.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/dto/MerchantEnterDTO.java | ||
| 1 | +package com.diligrp.rider.dto; | ||
| 2 | + | ||
| 3 | +import jakarta.validation.constraints.NotBlank; | ||
| 4 | +import jakarta.validation.constraints.NotNull; | ||
| 5 | +import lombok.Data; | ||
| 6 | + | ||
| 7 | +@Data | ||
| 8 | +public class MerchantEnterDTO { | ||
| 9 | + @NotBlank(message = "联系人姓名不能为空") | ||
| 10 | + private String name; | ||
| 11 | + @NotBlank(message = "手机号不能为空") | ||
| 12 | + private String mobile; | ||
| 13 | + @NotBlank(message = "店铺名称不能为空") | ||
| 14 | + private String storeName; | ||
| 15 | + @NotNull(message = "城市不能为空") | ||
| 16 | + private Long cityId; | ||
| 17 | + private String remark; | ||
| 18 | + /** 类型:1=商家入驻 2=骑手入驻 3=商务合作 */ | ||
| 19 | + private Integer type = 1; | ||
| 20 | +} |
src/main/java/com/diligrp/rider/dto/MerchantStoreDTO.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/dto/MerchantStoreDTO.java | ||
| 1 | +package com.diligrp.rider.dto; | ||
| 2 | + | ||
| 3 | +import jakarta.validation.constraints.NotBlank; | ||
| 4 | +import jakarta.validation.constraints.NotNull; | ||
| 5 | +import lombok.Data; | ||
| 6 | + | ||
| 7 | +import java.math.BigDecimal; | ||
| 8 | + | ||
| 9 | +@Data | ||
| 10 | +public class MerchantStoreDTO { | ||
| 11 | + private Long id; | ||
| 12 | + @NotBlank(message = "店铺名称不能为空") | ||
| 13 | + private String name; | ||
| 14 | + @NotNull(message = "城市不能为空") | ||
| 15 | + private Long cityId; | ||
| 16 | + private String thumb; | ||
| 17 | + private String address; | ||
| 18 | + private String lng; | ||
| 19 | + private String lat; | ||
| 20 | + /** 营业状态:0=打烊 1=营业 */ | ||
| 21 | + private Integer operatingState = 1; | ||
| 22 | + /** 是否自动接单 */ | ||
| 23 | + private Integer automaticOrder = 0; | ||
| 24 | + /** 配送类型:1=外卖配送 2=到店自提 */ | ||
| 25 | + private Integer shippingType = 1; | ||
| 26 | + /** 免运费门槛 */ | ||
| 27 | + private BigDecimal freeShipping = BigDecimal.ZERO; | ||
| 28 | + /** 起送金额 */ | ||
| 29 | + private BigDecimal upToSend = BigDecimal.ZERO; | ||
| 30 | + /** 营业日期JSON */ | ||
| 31 | + private String openDate; | ||
| 32 | + /** 营业时间JSON */ | ||
| 33 | + private String openTime; | ||
| 34 | + private String about; | ||
| 35 | + /** 商家账号手机号(用于创建登录账号) */ | ||
| 36 | + private String accountMobile; | ||
| 37 | + /** | ||
| 38 | + * 接入方自己系统的门店编号(外部门店ID) | ||
| 39 | + * 外部系统同步门店时必填;平台自建时选填,便于与外部系统对账 | ||
| 40 | + */ | ||
| 41 | + private String outStoreId; | ||
| 42 | +} |
src/main/java/com/diligrp/rider/dto/OpenDeliveryFeeCalcDTO.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/dto/OpenDeliveryFeeCalcDTO.java | ||
| 1 | +package com.diligrp.rider.dto; | ||
| 2 | + | ||
| 3 | +import jakarta.validation.constraints.NotNull; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +import java.math.BigDecimal; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 开放平台配送费计算请求 DTO | ||
| 10 | + * cityId 由 X-App-Key 绑定的租户自动带出,不允许外部传入。 | ||
| 11 | + */ | ||
| 12 | +@Data | ||
| 13 | +public class OpenDeliveryFeeCalcDTO { | ||
| 14 | + | ||
| 15 | + /** 订单类型:1=帮我送 2=帮我取 6=外卖配送 */ | ||
| 16 | + @NotNull(message = "订单类型不能为空") | ||
| 17 | + private Integer orderType; | ||
| 18 | + | ||
| 19 | + /** 起点经度 */ | ||
| 20 | + @NotNull(message = "起点经度不能为空") | ||
| 21 | + private String startLng; | ||
| 22 | + | ||
| 23 | + /** 起点纬度 */ | ||
| 24 | + @NotNull(message = "起点纬度不能为空") | ||
| 25 | + private String startLat; | ||
| 26 | + | ||
| 27 | + /** 终点经度 */ | ||
| 28 | + @NotNull(message = "终点经度不能为空") | ||
| 29 | + private String endLng; | ||
| 30 | + | ||
| 31 | + /** 终点纬度 */ | ||
| 32 | + @NotNull(message = "终点纬度不能为空") | ||
| 33 | + private String endLat; | ||
| 34 | + | ||
| 35 | + /** 重量(kg),不传默认0 */ | ||
| 36 | + private BigDecimal weight = BigDecimal.ZERO; | ||
| 37 | + | ||
| 38 | + /** 件数,不传默认0 */ | ||
| 39 | + private Integer pieces = 0; | ||
| 40 | + | ||
| 41 | + /** 服务时间戳(秒),用于时段附加费匹配,0=当前时间 */ | ||
| 42 | + private Long serviceTime = 0L; | ||
| 43 | +} |
src/main/java/com/diligrp/rider/dto/PlatformMockDeliveryCreateDTO.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/dto/PlatformMockDeliveryCreateDTO.java | ||
| 1 | +package com.diligrp.rider.dto; | ||
| 2 | + | ||
| 3 | +import jakarta.validation.constraints.NotNull; | ||
| 4 | +import lombok.Data; | ||
| 5 | +import lombok.EqualsAndHashCode; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * 平台后台模拟推单 DTO | ||
| 9 | + */ | ||
| 10 | +@Data | ||
| 11 | +@EqualsAndHashCode(callSuper = true) | ||
| 12 | +public class PlatformMockDeliveryCreateDTO extends DeliveryOrderCreateDTO { | ||
| 13 | + | ||
| 14 | + /** 开放平台应用ID */ | ||
| 15 | + @NotNull(message = "应用ID不能为空") | ||
| 16 | + private Long appId; | ||
| 17 | +} |
src/main/java/com/diligrp/rider/entity/AdminUser.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/entity/AdminUser.java | ||
| 1 | +package com.diligrp.rider.entity; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.annotation.*; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * 超级管理员表 | ||
| 8 | + */ | ||
| 9 | +@Data | ||
| 10 | +@TableName("admin_user") | ||
| 11 | +public class AdminUser { | ||
| 12 | + | ||
| 13 | + @TableId(type = IdType.AUTO) | ||
| 14 | + private Long id; | ||
| 15 | + | ||
| 16 | + /** 登录账号 */ | ||
| 17 | + private String userLogin; | ||
| 18 | + | ||
| 19 | + /** 密码(MD5) */ | ||
| 20 | + private String userPass; | ||
| 21 | + | ||
| 22 | + /** 昵称 */ | ||
| 23 | + private String userNickname; | ||
| 24 | + | ||
| 25 | + /** 状态:0=禁用 1=正常 */ | ||
| 26 | + private Integer userStatus; | ||
| 27 | + | ||
| 28 | + private Long createTime; | ||
| 29 | +} |
src/main/java/com/diligrp/rider/entity/City.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/entity/City.java | ||
| 1 | +package com.diligrp.rider.entity; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.annotation.*; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +import java.math.BigDecimal; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 城市表 | ||
| 10 | + * city表,是配送中台的核心配置单元 | ||
| 11 | + */ | ||
| 12 | +@Data | ||
| 13 | +@TableName("city") | ||
| 14 | +public class City { | ||
| 15 | + | ||
| 16 | + @TableId(type = IdType.AUTO) | ||
| 17 | + private Long id; | ||
| 18 | + | ||
| 19 | + /** 父级ID,0=省级 */ | ||
| 20 | + private Long pid; | ||
| 21 | + | ||
| 22 | + /** 城市名称 */ | ||
| 23 | + private String name; | ||
| 24 | + | ||
| 25 | + /** 行政区划码 */ | ||
| 26 | + private String areaCode; | ||
| 27 | + | ||
| 28 | + /** 状态:0=未开通 1=已开通 */ | ||
| 29 | + private Integer status; | ||
| 30 | + | ||
| 31 | + /** 平台抽成比例(%) */ | ||
| 32 | + private BigDecimal rate; | ||
| 33 | + | ||
| 34 | + /** 排序 */ | ||
| 35 | + private Integer listOrder; | ||
| 36 | +} |
src/main/java/com/diligrp/rider/entity/DeliveryFeePlan.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/entity/DeliveryFeePlan.java | ||
| 1 | +package com.diligrp.rider.entity; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.annotation.IdType; | ||
| 4 | +import com.baomidou.mybatisplus.annotation.TableId; | ||
| 5 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
| 6 | +import lombok.Data; | ||
| 7 | + | ||
| 8 | +import java.math.BigDecimal; | ||
| 9 | + | ||
| 10 | +@Data | ||
| 11 | +@TableName("delivery_fee_plan") | ||
| 12 | +public class DeliveryFeePlan { | ||
| 13 | + | ||
| 14 | + @TableId(type = IdType.AUTO) | ||
| 15 | + private Long id; | ||
| 16 | + | ||
| 17 | + private Long cityId; | ||
| 18 | + | ||
| 19 | + private String name; | ||
| 20 | + | ||
| 21 | + private Integer isDefault; | ||
| 22 | + | ||
| 23 | + private BigDecimal minFee; | ||
| 24 | + | ||
| 25 | + private BigDecimal distanceBasic; | ||
| 26 | + | ||
| 27 | + private Integer distanceBasicTime; | ||
| 28 | + | ||
| 29 | + private Integer distanceMoreTime; | ||
| 30 | + | ||
| 31 | + private BigDecimal riderDistance; | ||
| 32 | + | ||
| 33 | + private Integer riderTime; | ||
| 34 | + | ||
| 35 | + private Integer status; | ||
| 36 | + | ||
| 37 | + private Integer listOrder; | ||
| 38 | + | ||
| 39 | + private String remark; | ||
| 40 | + | ||
| 41 | + private Long createTime; | ||
| 42 | + | ||
| 43 | + private Long updateTime; | ||
| 44 | +} |
src/main/java/com/diligrp/rider/entity/DeliveryFeePlanDimension.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/entity/DeliveryFeePlanDimension.java | ||
| 1 | +package com.diligrp.rider.entity; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.annotation.IdType; | ||
| 4 | +import com.baomidou.mybatisplus.annotation.TableId; | ||
| 5 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
| 6 | +import lombok.Data; | ||
| 7 | + | ||
| 8 | +import java.math.BigDecimal; | ||
| 9 | + | ||
| 10 | +@Data | ||
| 11 | +@TableName("delivery_fee_plan_dimension") | ||
| 12 | +public class DeliveryFeePlanDimension { | ||
| 13 | + | ||
| 14 | + @TableId(type = IdType.AUTO) | ||
| 15 | + private Long id; | ||
| 16 | + | ||
| 17 | + private Long planId; | ||
| 18 | + | ||
| 19 | + private String dimensionType; | ||
| 20 | + | ||
| 21 | + private Integer enabled; | ||
| 22 | + | ||
| 23 | + private BigDecimal baseFee; | ||
| 24 | + | ||
| 25 | + private BigDecimal startDistance; | ||
| 26 | + | ||
| 27 | + private BigDecimal startFee; | ||
| 28 | + | ||
| 29 | + private BigDecimal firstWeight; | ||
| 30 | + | ||
| 31 | + private BigDecimal firstFee; | ||
| 32 | + | ||
| 33 | + private BigDecimal unitWeightFee; | ||
| 34 | + | ||
| 35 | + private BigDecimal capFee; | ||
| 36 | + | ||
| 37 | + private String extraJson; | ||
| 38 | + | ||
| 39 | + private Long createTime; | ||
| 40 | + | ||
| 41 | + private Long updateTime; | ||
| 42 | +} |
src/main/java/com/diligrp/rider/entity/DeliveryFeePlanDistanceStep.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/entity/DeliveryFeePlanDistanceStep.java | ||
| 1 | +package com.diligrp.rider.entity; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.annotation.IdType; | ||
| 4 | +import com.baomidou.mybatisplus.annotation.TableId; | ||
| 5 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
| 6 | +import lombok.Data; | ||
| 7 | + | ||
| 8 | +import java.math.BigDecimal; | ||
| 9 | + | ||
| 10 | +@Data | ||
| 11 | +@TableName("delivery_fee_plan_distance_step") | ||
| 12 | +public class DeliveryFeePlanDistanceStep { | ||
| 13 | + | ||
| 14 | + @TableId(type = IdType.AUTO) | ||
| 15 | + private Long id; | ||
| 16 | + | ||
| 17 | + private Long planId; | ||
| 18 | + | ||
| 19 | + private BigDecimal endDistance; | ||
| 20 | + | ||
| 21 | + private BigDecimal unitDistance; | ||
| 22 | + | ||
| 23 | + private BigDecimal unitFee; | ||
| 24 | + | ||
| 25 | + private Integer listOrder; | ||
| 26 | + | ||
| 27 | + private Long createTime; | ||
| 28 | + | ||
| 29 | + private Long updateTime; | ||
| 30 | +} |
src/main/java/com/diligrp/rider/entity/DeliveryFeePlanPieceRule.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/entity/DeliveryFeePlanPieceRule.java | ||
| 1 | +package com.diligrp.rider.entity; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.annotation.IdType; | ||
| 4 | +import com.baomidou.mybatisplus.annotation.TableId; | ||
| 5 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
| 6 | +import lombok.Data; | ||
| 7 | + | ||
| 8 | +import java.math.BigDecimal; | ||
| 9 | + | ||
| 10 | +@Data | ||
| 11 | +@TableName("delivery_fee_plan_piece_rule") | ||
| 12 | +public class DeliveryFeePlanPieceRule { | ||
| 13 | + | ||
| 14 | + @TableId(type = IdType.AUTO) | ||
| 15 | + private Long id; | ||
| 16 | + | ||
| 17 | + private Long planId; | ||
| 18 | + | ||
| 19 | + private Integer startPiece; | ||
| 20 | + | ||
| 21 | + private Integer endPiece; | ||
| 22 | + | ||
| 23 | + private BigDecimal fee; | ||
| 24 | + | ||
| 25 | + private Integer listOrder; | ||
| 26 | + | ||
| 27 | + private Long createTime; | ||
| 28 | + | ||
| 29 | + private Long updateTime; | ||
| 30 | +} |
src/main/java/com/diligrp/rider/entity/DeliveryFeePlanTimeRule.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/entity/DeliveryFeePlanTimeRule.java | ||
| 1 | +package com.diligrp.rider.entity; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.annotation.IdType; | ||
| 4 | +import com.baomidou.mybatisplus.annotation.TableId; | ||
| 5 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
| 6 | +import lombok.Data; | ||
| 7 | + | ||
| 8 | +import java.math.BigDecimal; | ||
| 9 | + | ||
| 10 | +@Data | ||
| 11 | +@TableName("delivery_fee_plan_time_rule") | ||
| 12 | +public class DeliveryFeePlanTimeRule { | ||
| 13 | + | ||
| 14 | + @TableId(type = IdType.AUTO) | ||
| 15 | + private Long id; | ||
| 16 | + | ||
| 17 | + private Long planId; | ||
| 18 | + | ||
| 19 | + private Integer startMinute; | ||
| 20 | + | ||
| 21 | + private Integer endMinute; | ||
| 22 | + | ||
| 23 | + private BigDecimal fee; | ||
| 24 | + | ||
| 25 | + private Integer enabled; | ||
| 26 | + | ||
| 27 | + private Integer listOrder; | ||
| 28 | + | ||
| 29 | + private Long createTime; | ||
| 30 | + | ||
| 31 | + private Long updateTime; | ||
| 32 | +} |
src/main/java/com/diligrp/rider/entity/ExtStore.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/entity/ExtStore.java | ||
| 1 | +package com.diligrp.rider.entity; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.annotation.*; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * 外部门店表 | ||
| 8 | + * 接入方通过 API 注册/同步自己系统的门店到配送中台 | ||
| 9 | + * 与 AppKey 绑定,一个应用可有多个门店 | ||
| 10 | + */ | ||
| 11 | +@Data | ||
| 12 | +@TableName("ext_store") | ||
| 13 | +public class ExtStore { | ||
| 14 | + | ||
| 15 | + @TableId(type = IdType.AUTO) | ||
| 16 | + private Long id; | ||
| 17 | + | ||
| 18 | + /** 所属应用 AppKey */ | ||
| 19 | + private String appKey; | ||
| 20 | + | ||
| 21 | + /** 接入方自己系统的门店ID(外部系统的原始ID,用于对账) */ | ||
| 22 | + private String outStoreId; | ||
| 23 | + | ||
| 24 | + /** 门店名称 */ | ||
| 25 | + private String name; | ||
| 26 | + | ||
| 27 | + /** 门店地址 */ | ||
| 28 | + private String address; | ||
| 29 | + | ||
| 30 | + /** 经度 */ | ||
| 31 | + private String lng; | ||
| 32 | + | ||
| 33 | + /** 纬度 */ | ||
| 34 | + private String lat; | ||
| 35 | + | ||
| 36 | + /** 所属城市ID */ | ||
| 37 | + private Long cityId; | ||
| 38 | + | ||
| 39 | + /** 门店联系电话 */ | ||
| 40 | + private String phone; | ||
| 41 | + | ||
| 42 | + /** 营业状态:0=关闭 1=营业 */ | ||
| 43 | + private Integer status; | ||
| 44 | + | ||
| 45 | + /** 备注 */ | ||
| 46 | + private String remark; | ||
| 47 | + | ||
| 48 | + private Long createTime; | ||
| 49 | + | ||
| 50 | + private Long updateTime; | ||
| 51 | +} |
src/main/java/com/diligrp/rider/entity/MerchantEnter.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/entity/MerchantEnter.java | ||
| 1 | +package com.diligrp.rider.entity; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.annotation.*; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +import java.math.BigDecimal; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 商家入驻申请表 | ||
| 10 | + * merchant_enter表 | ||
| 11 | + */ | ||
| 12 | +@Data | ||
| 13 | +@TableName("merchant_enter") | ||
| 14 | +public class MerchantEnter { | ||
| 15 | + | ||
| 16 | + @TableId(type = IdType.AUTO) | ||
| 17 | + private Long id; | ||
| 18 | + | ||
| 19 | + /** 联系人姓名 */ | ||
| 20 | + private String name; | ||
| 21 | + | ||
| 22 | + /** 手机号 */ | ||
| 23 | + private String mobile; | ||
| 24 | + | ||
| 25 | + /** 店铺名称 */ | ||
| 26 | + private String storeName; | ||
| 27 | + | ||
| 28 | + /** 申请类型:1=商家入驻 2=骑手入驻 3=商务合作 */ | ||
| 29 | + private Integer type; | ||
| 30 | + | ||
| 31 | + /** 所在城市ID */ | ||
| 32 | + private Long cityId; | ||
| 33 | + | ||
| 34 | + /** 备注 */ | ||
| 35 | + private String remark; | ||
| 36 | + | ||
| 37 | + /** 状态:0=未处理 1=已通过 -1=已拒绝 */ | ||
| 38 | + private Integer status; | ||
| 39 | + | ||
| 40 | + private Long addTime; | ||
| 41 | +} |
src/main/java/com/diligrp/rider/entity/MerchantStore.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/entity/MerchantStore.java | ||
| 1 | +package com.diligrp.rider.entity; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.annotation.*; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +import java.math.BigDecimal; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 商家店铺表 | ||
| 10 | + * merchant_store表 | ||
| 11 | + */ | ||
| 12 | +@Data | ||
| 13 | +@TableName("merchant_store") | ||
| 14 | +public class MerchantStore { | ||
| 15 | + | ||
| 16 | + @TableId(type = IdType.AUTO) | ||
| 17 | + private Long id; | ||
| 18 | + | ||
| 19 | + /** 店铺名称 */ | ||
| 20 | + private String name; | ||
| 21 | + | ||
| 22 | + /** 店铺封面图 */ | ||
| 23 | + private String thumb; | ||
| 24 | + | ||
| 25 | + /** 所属城市ID */ | ||
| 26 | + private Long cityId; | ||
| 27 | + | ||
| 28 | + /** 店铺地址 */ | ||
| 29 | + private String address; | ||
| 30 | + | ||
| 31 | + /** 经度 */ | ||
| 32 | + private String lng; | ||
| 33 | + | ||
| 34 | + /** 纬度 */ | ||
| 35 | + private String lat; | ||
| 36 | + | ||
| 37 | + /** 营业状态:0=打烊 1=营业 */ | ||
| 38 | + private Integer operatingState; | ||
| 39 | + | ||
| 40 | + /** 是否自动接单:0=否 1=是 */ | ||
| 41 | + private Integer automaticOrder; | ||
| 42 | + | ||
| 43 | + /** 配送类型:1=外卖配送 2=到店自提 */ | ||
| 44 | + private Integer shippingType; | ||
| 45 | + | ||
| 46 | + /** 免运费门槛(订单金额满X元免运费,0=不免) */ | ||
| 47 | + private BigDecimal freeShipping; | ||
| 48 | + | ||
| 49 | + /** 起送金额(订单金额低于此值不接单,0=不限) */ | ||
| 50 | + private BigDecimal upToSend; | ||
| 51 | + | ||
| 52 | + /** 营业日期JSON,如[1,2,3,4,5]表示周一到周五 */ | ||
| 53 | + private String openDate; | ||
| 54 | + | ||
| 55 | + /** 营业时间JSON,如["09:00","22:00"] */ | ||
| 56 | + private String openTime; | ||
| 57 | + | ||
| 58 | + /** 店铺简介 */ | ||
| 59 | + private String about; | ||
| 60 | + | ||
| 61 | + /** 关联账号ID(merchant_users表) */ | ||
| 62 | + private Long accountId; | ||
| 63 | + | ||
| 64 | + /** | ||
| 65 | + * 关联接入方 AppKey(为空=平台自建门店) | ||
| 66 | + * 外部系统同步门店时写入,用于标识门店归属哪个接入方 | ||
| 67 | + */ | ||
| 68 | + private String appKey; | ||
| 69 | + | ||
| 70 | + /** | ||
| 71 | + * 接入方自己系统的门店ID(外部门店编号) | ||
| 72 | + * 推单时传此字段,中台自动匹配门店经纬度 | ||
| 73 | + * 平台自建门店也可手动填入,便于与外部系统对账 | ||
| 74 | + */ | ||
| 75 | + private String outStoreId; | ||
| 76 | + | ||
| 77 | + /** 排序 */ | ||
| 78 | + private Integer listOrder; | ||
| 79 | + | ||
| 80 | + /** 是否删除 */ | ||
| 81 | + @TableLogic | ||
| 82 | + private Integer isDel; | ||
| 83 | + | ||
| 84 | + private Long addTime; | ||
| 85 | +} |
src/main/java/com/diligrp/rider/entity/MerchantUsers.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/entity/MerchantUsers.java | ||
| 1 | +package com.diligrp.rider.entity; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.annotation.*; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +import java.math.BigDecimal; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 商家账号表 | ||
| 10 | + * merchant_users(商家登录账号,与店铺1:1) | ||
| 11 | + */ | ||
| 12 | +@Data | ||
| 13 | +@TableName("merchant_users") | ||
| 14 | +public class MerchantUsers { | ||
| 15 | + | ||
| 16 | + @TableId(type = IdType.AUTO) | ||
| 17 | + private Long id; | ||
| 18 | + | ||
| 19 | + /** 关联店铺ID */ | ||
| 20 | + private Long storeId; | ||
| 21 | + | ||
| 22 | + /** 手机号(即登录账号) */ | ||
| 23 | + private String mobile; | ||
| 24 | + | ||
| 25 | + /** 昵称 */ | ||
| 26 | + private String userNickname; | ||
| 27 | + | ||
| 28 | + /** 账号状态:0=禁用 1=正常 */ | ||
| 29 | + private Integer userStatus; | ||
| 30 | + | ||
| 31 | + /** 账号类型:1=商家 */ | ||
| 32 | + private Integer type; | ||
| 33 | + | ||
| 34 | + private Long createTime; | ||
| 35 | +} |
src/main/java/com/diligrp/rider/entity/OpenApp.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/entity/OpenApp.java | ||
| 1 | +package com.diligrp.rider.entity; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.annotation.*; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * 开放平台应用表 | ||
| 8 | + * 第三方系统接入时申请 AppKey/AppSecret | ||
| 9 | + */ | ||
| 10 | +@Data | ||
| 11 | +@TableName("open_app") | ||
| 12 | +public class OpenApp { | ||
| 13 | + | ||
| 14 | + @TableId(type = IdType.AUTO) | ||
| 15 | + private Long id; | ||
| 16 | + | ||
| 17 | + /** 应用名称 */ | ||
| 18 | + private String appName; | ||
| 19 | + | ||
| 20 | + /** AppKey(唯一标识) */ | ||
| 21 | + private String appKey; | ||
| 22 | + | ||
| 23 | + /** AppSecret(签名密钥,不对外展示) */ | ||
| 24 | + private String appSecret; | ||
| 25 | + | ||
| 26 | + /** 关联商家店铺ID,0=平台级接入 */ | ||
| 27 | + private Long storeId; | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * 关联租户/城市ID(必填) | ||
| 31 | + * 该 AppKey 只能在此城市下推单、查询、调度骑手 | ||
| 32 | + */ | ||
| 33 | + private Long cityId; | ||
| 34 | + | ||
| 35 | + /** 状态:0=禁用 1=正常 */ | ||
| 36 | + private Integer status; | ||
| 37 | + | ||
| 38 | + /** Webhook 回调地址 */ | ||
| 39 | + private String webhookUrl; | ||
| 40 | + | ||
| 41 | + /** 回调事件订阅(JSON数组),如["order.paid","order.completed"] */ | ||
| 42 | + private String webhookEvents; | ||
| 43 | + | ||
| 44 | + /** 备注 */ | ||
| 45 | + private String remark; | ||
| 46 | + | ||
| 47 | + private Long createTime; | ||
| 48 | +} |
src/main/java/com/diligrp/rider/entity/OrderRefundReason.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/entity/OrderRefundReason.java | ||
| 1 | +package com.diligrp.rider.entity; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.annotation.*; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * 退款原因配置表 | ||
| 8 | + */ | ||
| 9 | +@Data | ||
| 10 | +@TableName("orders_refund_reason") | ||
| 11 | +public class OrderRefundReason { | ||
| 12 | + | ||
| 13 | + @TableId(type = IdType.AUTO) | ||
| 14 | + private Long id; | ||
| 15 | + | ||
| 16 | + /** 原因描述 */ | ||
| 17 | + private String name; | ||
| 18 | + | ||
| 19 | + /** 适用角色:1=用户申请 2=骑手申请 */ | ||
| 20 | + private Integer role; | ||
| 21 | + | ||
| 22 | + private Integer listOrder; | ||
| 23 | +} |
src/main/java/com/diligrp/rider/entity/OrderRefundRecord.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/entity/OrderRefundRecord.java | ||
| 1 | +package com.diligrp.rider.entity; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.annotation.*; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +import java.math.BigDecimal; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 退款申请记录表 | ||
| 10 | + */ | ||
| 11 | +@Data | ||
| 12 | +@TableName("orders_refund_record") | ||
| 13 | +public class OrderRefundRecord { | ||
| 14 | + | ||
| 15 | + @TableId(type = IdType.AUTO) | ||
| 16 | + private Long id; | ||
| 17 | + | ||
| 18 | + /** 订单ID */ | ||
| 19 | + private Long oid; | ||
| 20 | + | ||
| 21 | + /** 订单号 */ | ||
| 22 | + private String orderNo; | ||
| 23 | + | ||
| 24 | + /** 申请人ID */ | ||
| 25 | + private Long uid; | ||
| 26 | + | ||
| 27 | + /** 申请角色:1=用户 2=骑手 */ | ||
| 28 | + private Integer role; | ||
| 29 | + | ||
| 30 | + /** 退款原因ID */ | ||
| 31 | + private Long reasonId; | ||
| 32 | + | ||
| 33 | + /** 退款原因描述 */ | ||
| 34 | + private String reason; | ||
| 35 | + | ||
| 36 | + /** 退款金额 */ | ||
| 37 | + private BigDecimal money; | ||
| 38 | + | ||
| 39 | + /** 处理状态:0=待处理 1=通过 2=拒绝 */ | ||
| 40 | + private Integer status; | ||
| 41 | + | ||
| 42 | + /** 处理备注 */ | ||
| 43 | + private String remark; | ||
| 44 | + | ||
| 45 | + private Long addTime; | ||
| 46 | + private Long handleTime; | ||
| 47 | +} |
src/main/java/com/diligrp/rider/entity/Orders.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/entity/Orders.java | ||
| 1 | +package com.diligrp.rider.entity; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.annotation.*; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +import java.math.BigDecimal; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 订单主表 | ||
| 10 | + */ | ||
| 11 | +@Data | ||
| 12 | +@TableName("orders") | ||
| 13 | +public class Orders { | ||
| 14 | + | ||
| 15 | + @TableId(type = IdType.AUTO) | ||
| 16 | + private Long id; | ||
| 17 | + | ||
| 18 | + /** 订单号 */ | ||
| 19 | + private String orderNo; | ||
| 20 | + | ||
| 21 | + /** 用户ID */ | ||
| 22 | + private Long uid; | ||
| 23 | + | ||
| 24 | + /** 骑手ID */ | ||
| 25 | + private Long riderId; | ||
| 26 | + | ||
| 27 | + /** 原始骑手ID(转单前) */ | ||
| 28 | + private Long oldRiderId; | ||
| 29 | + | ||
| 30 | + /** 城市ID */ | ||
| 31 | + private Long cityId; | ||
| 32 | + | ||
| 33 | + /** 订单类型:6=外卖配送 */ | ||
| 34 | + private Integer type; | ||
| 35 | + | ||
| 36 | + /** | ||
| 37 | + * 状态:1=待支付 2=已支付 3=已接单 4=服务中 | ||
| 38 | + * 6=已完成 7=退款申请 8=退款成功 9=退款拒绝 10=已取消 | ||
| 39 | + */ | ||
| 40 | + private Integer status; | ||
| 41 | + | ||
| 42 | + /** 支付类型:1=支付宝 2=微信 */ | ||
| 43 | + private Integer payType; | ||
| 44 | + | ||
| 45 | + /** 订单金额 */ | ||
| 46 | + private BigDecimal money; | ||
| 47 | + | ||
| 48 | + /** 配送费 */ | ||
| 49 | + private BigDecimal moneyDelivery; | ||
| 50 | + | ||
| 51 | + /** 总金额 */ | ||
| 52 | + private BigDecimal moneyTotal; | ||
| 53 | + | ||
| 54 | + /** 骑手收入 */ | ||
| 55 | + private BigDecimal riderIncome; | ||
| 56 | + | ||
| 57 | + /** 站点收入 */ | ||
| 58 | + private BigDecimal substationIncome; | ||
| 59 | + | ||
| 60 | + /** 结算状态:0=未结算 1=待结算 2=已结算 */ | ||
| 61 | + private Integer isIncome; | ||
| 62 | + | ||
| 63 | + /** 转单状态:0=未转单 1=通过 2=申请中 3=拒绝 */ | ||
| 64 | + private Integer isTrans; | ||
| 65 | + | ||
| 66 | + /** 完成码(用户给骑手输入确认完成) */ | ||
| 67 | + private String code; | ||
| 68 | + | ||
| 69 | + /** 起点名称 */ | ||
| 70 | + private String fName; | ||
| 71 | + | ||
| 72 | + /** 起点地址 */ | ||
| 73 | + private String fAddr; | ||
| 74 | + | ||
| 75 | + /** 起点经度 */ | ||
| 76 | + private String fLng; | ||
| 77 | + | ||
| 78 | + /** 起点纬度 */ | ||
| 79 | + private String fLat; | ||
| 80 | + | ||
| 81 | + /** 终点名称 */ | ||
| 82 | + private String tName; | ||
| 83 | + | ||
| 84 | + /** 终点地址 */ | ||
| 85 | + private String tAddr; | ||
| 86 | + | ||
| 87 | + /** 终点经度 */ | ||
| 88 | + private String tLng; | ||
| 89 | + | ||
| 90 | + /** 终点纬度 */ | ||
| 91 | + private String tLat; | ||
| 92 | + | ||
| 93 | + /** 收件人姓名 */ | ||
| 94 | + private String recipName; | ||
| 95 | + | ||
| 96 | + /** 收件人电话 */ | ||
| 97 | + private String recipPhone; | ||
| 98 | + | ||
| 99 | + /** 附加信息JSON */ | ||
| 100 | + private String extra; | ||
| 101 | + | ||
| 102 | + /** 取件照片JSON数组 */ | ||
| 103 | + private String thumbs; | ||
| 104 | + | ||
| 105 | + /** 关联店铺订单ID */ | ||
| 106 | + private Long storeOid; | ||
| 107 | + | ||
| 108 | + /** 外部业务系统订单号(接入方传入,用于回调对账) */ | ||
| 109 | + private String outOrderNo; | ||
| 110 | + | ||
| 111 | + /** 接入方 AppKey */ | ||
| 112 | + private String appKey; | ||
| 113 | + | ||
| 114 | + /** 状态变更回调地址(接入方提供,覆盖应用级 webhookUrl) */ | ||
| 115 | + private String callbackUrl; | ||
| 116 | + | ||
| 117 | + /** | ||
| 118 | + * 货物清单快照(JSON数组,接入方推单时传入,不耦合业务商品表) | ||
| 119 | + * 格式:[{"name":"宫保鸡丁","quantity":2,"spec":"大份","remark":""}] | ||
| 120 | + */ | ||
| 121 | + private String itemsJson; | ||
| 122 | + | ||
| 123 | + /** 货物整单备注(如:放门口、不要辣) */ | ||
| 124 | + private String itemRemark; | ||
| 125 | + | ||
| 126 | + /** 关联外部门店ID(接入方在平台注册的门店) */ | ||
| 127 | + private Long extStoreId; | ||
| 128 | + | ||
| 129 | + /** 是否删除 */ | ||
| 130 | + @TableLogic | ||
| 131 | + private Integer isDel; | ||
| 132 | + | ||
| 133 | + /** 下单时间 */ | ||
| 134 | + private Long addTime; | ||
| 135 | + | ||
| 136 | + /** 支付时间 */ | ||
| 137 | + private Long payTime; | ||
| 138 | + | ||
| 139 | + /** 接单时间 */ | ||
| 140 | + private Long grapTime; | ||
| 141 | + | ||
| 142 | + /** 取件时间 */ | ||
| 143 | + private Long pickTime; | ||
| 144 | + | ||
| 145 | + /** 完成时间 */ | ||
| 146 | + private Long completeTime; | ||
| 147 | + | ||
| 148 | + /** 转单时间 */ | ||
| 149 | + private Long transTime; | ||
| 150 | +} |
src/main/java/com/diligrp/rider/entity/Rider.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/entity/Rider.java | ||
| 1 | +package com.diligrp.rider.entity; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.annotation.*; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +import java.math.BigDecimal; | ||
| 7 | +import java.time.LocalDateTime; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * 骑手信息表 | ||
| 11 | + */ | ||
| 12 | +@Data | ||
| 13 | +@TableName("rider") | ||
| 14 | +public class Rider { | ||
| 15 | + | ||
| 16 | + @TableId(type = IdType.AUTO) | ||
| 17 | + private Long id; | ||
| 18 | + | ||
| 19 | + /** 手机号 */ | ||
| 20 | + private String mobile; | ||
| 21 | + | ||
| 22 | + /** 登录名 */ | ||
| 23 | + private String userLogin; | ||
| 24 | + | ||
| 25 | + /** 昵称 */ | ||
| 26 | + private String userNickname; | ||
| 27 | + | ||
| 28 | + /** 密码(加密) */ | ||
| 29 | + private String userPass; | ||
| 30 | + | ||
| 31 | + /** 头像 */ | ||
| 32 | + private String avatar; | ||
| 33 | + | ||
| 34 | + /** 头像缩略图 */ | ||
| 35 | + private String avatarThumb; | ||
| 36 | + | ||
| 37 | + /** 城市ID */ | ||
| 38 | + private Long cityId; | ||
| 39 | + | ||
| 40 | + /** 等级ID */ | ||
| 41 | + private Long levelId; | ||
| 42 | + | ||
| 43 | + /** 等级名称(非表字段) */ | ||
| 44 | + @TableField(exist = false) | ||
| 45 | + private String levelName; | ||
| 46 | + | ||
| 47 | + /** 类型:1=兼职 2=全职 */ | ||
| 48 | + private Integer type; | ||
| 49 | + | ||
| 50 | + /** 审核状态:0=拒绝 1=通过 2=待审核 */ | ||
| 51 | + private Integer userStatus; | ||
| 52 | + | ||
| 53 | + /** 账号状态:0=禁用 1=正常 */ | ||
| 54 | + private Integer status; | ||
| 55 | + | ||
| 56 | + /** 余额(兼职骑手用) */ | ||
| 57 | + private BigDecimal balance; | ||
| 58 | + | ||
| 59 | + /** 是否休息:0=否 1=是 */ | ||
| 60 | + private Integer isRest; | ||
| 61 | + | ||
| 62 | + /** 身份证号 */ | ||
| 63 | + private String idNo; | ||
| 64 | + | ||
| 65 | + /** 手持身份证照片 */ | ||
| 66 | + private String thumb; | ||
| 67 | + | ||
| 68 | + @TableField(fill = FieldFill.INSERT) | ||
| 69 | + private Long createTime; | ||
| 70 | +} |
src/main/java/com/diligrp/rider/entity/RiderBalance.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/entity/RiderBalance.java | ||
| 1 | +package com.diligrp.rider.entity; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.annotation.*; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +import java.math.BigDecimal; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 骑手余额流水表 | ||
| 10 | + */ | ||
| 11 | +@Data | ||
| 12 | +@TableName("rider_balance") | ||
| 13 | +public class RiderBalance { | ||
| 14 | + | ||
| 15 | + @TableId(type = IdType.AUTO) | ||
| 16 | + private Long id; | ||
| 17 | + | ||
| 18 | + /** 骑手ID */ | ||
| 19 | + private Long uid; | ||
| 20 | + | ||
| 21 | + /** 变动类型:1=收入 2=提现 */ | ||
| 22 | + private Integer type; | ||
| 23 | + | ||
| 24 | + /** 关联动作(如:order_complete) */ | ||
| 25 | + private String action; | ||
| 26 | + | ||
| 27 | + /** 关联ID(如订单ID) */ | ||
| 28 | + private Long actionId; | ||
| 29 | + | ||
| 30 | + /** 订单号 */ | ||
| 31 | + private String orderNo; | ||
| 32 | + | ||
| 33 | + /** 变动金额 */ | ||
| 34 | + private BigDecimal nums; | ||
| 35 | + | ||
| 36 | + /** 变动后余额 */ | ||
| 37 | + private BigDecimal total; | ||
| 38 | + | ||
| 39 | + private Long addTime; | ||
| 40 | +} |
src/main/java/com/diligrp/rider/entity/RiderEvaluate.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/entity/RiderEvaluate.java | ||
| 1 | +package com.diligrp.rider.entity; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.annotation.*; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * 骑手评价表(用户对骑手的配送评价) | ||
| 8 | + */ | ||
| 9 | +@Data | ||
| 10 | +@TableName("rider_evaluate") | ||
| 11 | +public class RiderEvaluate { | ||
| 12 | + | ||
| 13 | + @TableId(type = IdType.AUTO) | ||
| 14 | + private Long id; | ||
| 15 | + | ||
| 16 | + /** 用户ID(评价人) */ | ||
| 17 | + private Long uid; | ||
| 18 | + | ||
| 19 | + /** 订单ID */ | ||
| 20 | + private Long oid; | ||
| 21 | + | ||
| 22 | + /** 骑手ID */ | ||
| 23 | + private Long rid; | ||
| 24 | + | ||
| 25 | + /** 评价内容 */ | ||
| 26 | + private String content; | ||
| 27 | + | ||
| 28 | + /** 星级:1-5 */ | ||
| 29 | + private Integer star; | ||
| 30 | + | ||
| 31 | + /** 城市ID */ | ||
| 32 | + private Long cityId; | ||
| 33 | + | ||
| 34 | + private Long addTime; | ||
| 35 | +} |
src/main/java/com/diligrp/rider/entity/RiderLevel.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/entity/RiderLevel.java | ||
| 1 | +package com.diligrp.rider.entity; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.annotation.*; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +import java.math.BigDecimal; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 骑手等级配置表 | ||
| 10 | + */ | ||
| 11 | +@Data | ||
| 12 | +@TableName("rider_level") | ||
| 13 | +public class RiderLevel { | ||
| 14 | + | ||
| 15 | + @TableId(type = IdType.AUTO) | ||
| 16 | + private Long id; | ||
| 17 | + | ||
| 18 | + /** 城市ID */ | ||
| 19 | + private Long cityId; | ||
| 20 | + | ||
| 21 | + /** 等级编号 */ | ||
| 22 | + private Integer levelId; | ||
| 23 | + | ||
| 24 | + /** 等级名称 */ | ||
| 25 | + private String name; | ||
| 26 | + | ||
| 27 | + /** 是否默认等级 */ | ||
| 28 | + private Integer isDefault; | ||
| 29 | + | ||
| 30 | + /** 转单次数上限 */ | ||
| 31 | + private Integer transNums; | ||
| 32 | + | ||
| 33 | + /** | ||
| 34 | + * 跑腿类收入模式:1=固定金额 2=按比例 3=按距离 | ||
| 35 | + */ | ||
| 36 | + private Integer runFeeMode; | ||
| 37 | + | ||
| 38 | + /** 跑腿固定金额(mode=1) */ | ||
| 39 | + private BigDecimal runFixMoney; | ||
| 40 | + | ||
| 41 | + /** 跑腿比例(mode=2,百分比) */ | ||
| 42 | + private BigDecimal runRate; | ||
| 43 | + | ||
| 44 | + /** 起始距离(mode=3,米) */ | ||
| 45 | + private Integer distanceBasic; | ||
| 46 | + | ||
| 47 | + /** 基础配送费(mode=3) */ | ||
| 48 | + private BigDecimal distanceBasicMoney; | ||
| 49 | + | ||
| 50 | + /** 超出每公里费用(mode=3) */ | ||
| 51 | + private BigDecimal distanceMoreMoney; | ||
| 52 | + | ||
| 53 | + /** 最高配送费上限(mode=3) */ | ||
| 54 | + private BigDecimal distanceMaxMoney; | ||
| 55 | + | ||
| 56 | + /** | ||
| 57 | + * 办事类收入模式:1=固定金额 2=按比例 | ||
| 58 | + */ | ||
| 59 | + private Integer workFeeMode; | ||
| 60 | + | ||
| 61 | + /** 办事固定金额(mode=1) */ | ||
| 62 | + private BigDecimal workFixMoney; | ||
| 63 | + | ||
| 64 | + /** 办事比例(mode=2,百分比) */ | ||
| 65 | + private BigDecimal workRate; | ||
| 66 | +} |
src/main/java/com/diligrp/rider/entity/RiderLocation.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/entity/RiderLocation.java | ||
| 1 | +package com.diligrp.rider.entity; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.annotation.*; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * 骑手位置表 | ||
| 8 | + */ | ||
| 9 | +@Data | ||
| 10 | +@TableName("rider_location") | ||
| 11 | +public class RiderLocation { | ||
| 12 | + | ||
| 13 | + @TableId(type = IdType.AUTO) | ||
| 14 | + private Long id; | ||
| 15 | + | ||
| 16 | + /** 骑手ID */ | ||
| 17 | + private Long uid; | ||
| 18 | + | ||
| 19 | + /** 经度 */ | ||
| 20 | + private String lng; | ||
| 21 | + | ||
| 22 | + /** 纬度 */ | ||
| 23 | + private String lat; | ||
| 24 | + | ||
| 25 | + /** 更新时间 */ | ||
| 26 | + private Long updateTime; | ||
| 27 | +} |
src/main/java/com/diligrp/rider/entity/RiderOrderCount.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/entity/RiderOrderCount.java | ||
| 1 | +package com.diligrp.rider.entity; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.annotation.*; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +import java.math.BigDecimal; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 骑手订单统计表 | ||
| 10 | + */ | ||
| 11 | +@Data | ||
| 12 | +@TableName("rider_order_count") | ||
| 13 | +public class RiderOrderCount { | ||
| 14 | + | ||
| 15 | + @TableId(type = IdType.AUTO) | ||
| 16 | + private Long id; | ||
| 17 | + | ||
| 18 | + /** 骑手ID */ | ||
| 19 | + private Long uid; | ||
| 20 | + | ||
| 21 | + /** 统计日期(yyyyMMdd) */ | ||
| 22 | + private Integer countDate; | ||
| 23 | + | ||
| 24 | + /** 完成订单数 */ | ||
| 25 | + private Integer orders; | ||
| 26 | + | ||
| 27 | + /** 转单数 */ | ||
| 28 | + private Integer transfers; | ||
| 29 | + | ||
| 30 | + /** 配送距离(米) */ | ||
| 31 | + private Long distance; | ||
| 32 | +} |
src/main/java/com/diligrp/rider/entity/RiderOrderRefuse.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/entity/RiderOrderRefuse.java | ||
| 1 | +package com.diligrp.rider.entity; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.annotation.*; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * 骑手拒单记录表 | ||
| 8 | + */ | ||
| 9 | +@Data | ||
| 10 | +@TableName("rider_orders_refuse") | ||
| 11 | +public class RiderOrderRefuse { | ||
| 12 | + | ||
| 13 | + @TableId(type = IdType.AUTO) | ||
| 14 | + private Long id; | ||
| 15 | + | ||
| 16 | + /** 骑手ID */ | ||
| 17 | + private Long riderId; | ||
| 18 | + | ||
| 19 | + /** 订单ID */ | ||
| 20 | + private Long oid; | ||
| 21 | + | ||
| 22 | + /** 拒单时间 */ | ||
| 23 | + private Long addTime; | ||
| 24 | +} |
src/main/java/com/diligrp/rider/entity/Substation.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/entity/Substation.java | ||
| 1 | +package com.diligrp.rider.entity; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.annotation.*; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * 分站管理员表 | ||
| 8 | + * 每个城市对应一个分站管理员,负责该城市骑手/订单日常运营 | ||
| 9 | + */ | ||
| 10 | +@Data | ||
| 11 | +@TableName("substation") | ||
| 12 | +public class Substation { | ||
| 13 | + | ||
| 14 | + @TableId(type = IdType.AUTO) | ||
| 15 | + private Long id; | ||
| 16 | + | ||
| 17 | + /** 管理的城市ID */ | ||
| 18 | + private Long cityId; | ||
| 19 | + | ||
| 20 | + /** 登录账号 */ | ||
| 21 | + private String userLogin; | ||
| 22 | + | ||
| 23 | + /** 昵称 */ | ||
| 24 | + private String userNickname; | ||
| 25 | + | ||
| 26 | + /** 密码(MD5) */ | ||
| 27 | + private String userPass; | ||
| 28 | + | ||
| 29 | + /** 手机号 */ | ||
| 30 | + private String mobile; | ||
| 31 | + | ||
| 32 | + /** 头像 */ | ||
| 33 | + private String avatar; | ||
| 34 | + | ||
| 35 | + /** 状态:0=禁用 1=正常 */ | ||
| 36 | + private Integer userStatus; | ||
| 37 | + | ||
| 38 | + private Long createTime; | ||
| 39 | +} |
src/main/java/com/diligrp/rider/entity/WebhookLog.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/entity/WebhookLog.java | ||
| 1 | +package com.diligrp.rider.entity; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.annotation.*; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * Webhook 推送日志表 | ||
| 8 | + * 记录每次回调的发送结果,便于排查问题和重试 | ||
| 9 | + */ | ||
| 10 | +@Data | ||
| 11 | +@TableName("webhook_log") | ||
| 12 | +public class WebhookLog { | ||
| 13 | + | ||
| 14 | + @TableId(type = IdType.AUTO) | ||
| 15 | + private Long id; | ||
| 16 | + | ||
| 17 | + /** 应用ID */ | ||
| 18 | + private Long appId; | ||
| 19 | + | ||
| 20 | + /** 事件类型,如 order.completed */ | ||
| 21 | + private String event; | ||
| 22 | + | ||
| 23 | + /** 推送的业务ID(如订单ID) */ | ||
| 24 | + private Long bizId; | ||
| 25 | + | ||
| 26 | + /** 推送URL */ | ||
| 27 | + private String url; | ||
| 28 | + | ||
| 29 | + /** 推送内容(JSON) */ | ||
| 30 | + private String payload; | ||
| 31 | + | ||
| 32 | + /** HTTP响应码 */ | ||
| 33 | + private Integer responseCode; | ||
| 34 | + | ||
| 35 | + /** 响应内容(截取前500字) */ | ||
| 36 | + private String responseBody; | ||
| 37 | + | ||
| 38 | + /** 状态:0=失败 1=成功 */ | ||
| 39 | + private Integer status; | ||
| 40 | + | ||
| 41 | + /** 重试次数 */ | ||
| 42 | + private Integer retryCount; | ||
| 43 | + | ||
| 44 | + private Long createTime; | ||
| 45 | +} |
src/main/java/com/diligrp/rider/mapper/AdminUserMapper.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/mapper/AdminUserMapper.java | ||
| 1 | +package com.diligrp.rider.mapper; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
| 4 | +import com.diligrp.rider.entity.AdminUser; | ||
| 5 | +import org.apache.ibatis.annotations.Mapper; | ||
| 6 | + | ||
| 7 | +@Mapper | ||
| 8 | +public interface AdminUserMapper extends BaseMapper<AdminUser> { | ||
| 9 | +} |
src/main/java/com/diligrp/rider/mapper/CityMapper.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/mapper/CityMapper.java | ||
| 1 | +package com.diligrp.rider.mapper; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
| 4 | +import com.diligrp.rider.entity.City; | ||
| 5 | +import org.apache.ibatis.annotations.Mapper; | ||
| 6 | + | ||
| 7 | +@Mapper | ||
| 8 | +public interface CityMapper extends BaseMapper<City> { | ||
| 9 | +} |
src/main/java/com/diligrp/rider/mapper/DeliveryFeePlanDimensionMapper.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/mapper/DeliveryFeePlanDimensionMapper.java | ||
| 1 | +package com.diligrp.rider.mapper; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
| 4 | +import com.diligrp.rider.entity.DeliveryFeePlanDimension; | ||
| 5 | +import org.apache.ibatis.annotations.Mapper; | ||
| 6 | + | ||
| 7 | +@Mapper | ||
| 8 | +public interface DeliveryFeePlanDimensionMapper extends BaseMapper<DeliveryFeePlanDimension> { | ||
| 9 | +} |
src/main/java/com/diligrp/rider/mapper/DeliveryFeePlanDistanceStepMapper.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/mapper/DeliveryFeePlanDistanceStepMapper.java | ||
| 1 | +package com.diligrp.rider.mapper; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
| 4 | +import com.diligrp.rider.entity.DeliveryFeePlanDistanceStep; | ||
| 5 | +import org.apache.ibatis.annotations.Mapper; | ||
| 6 | + | ||
| 7 | +@Mapper | ||
| 8 | +public interface DeliveryFeePlanDistanceStepMapper extends BaseMapper<DeliveryFeePlanDistanceStep> { | ||
| 9 | +} |
src/main/java/com/diligrp/rider/mapper/DeliveryFeePlanMapper.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/mapper/DeliveryFeePlanMapper.java | ||
| 1 | +package com.diligrp.rider.mapper; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
| 4 | +import com.diligrp.rider.entity.DeliveryFeePlan; | ||
| 5 | +import org.apache.ibatis.annotations.Mapper; | ||
| 6 | + | ||
| 7 | +@Mapper | ||
| 8 | +public interface DeliveryFeePlanMapper extends BaseMapper<DeliveryFeePlan> { | ||
| 9 | +} |
src/main/java/com/diligrp/rider/mapper/DeliveryFeePlanPieceRuleMapper.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/mapper/DeliveryFeePlanPieceRuleMapper.java | ||
| 1 | +package com.diligrp.rider.mapper; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
| 4 | +import com.diligrp.rider.entity.DeliveryFeePlanPieceRule; | ||
| 5 | +import org.apache.ibatis.annotations.Mapper; | ||
| 6 | + | ||
| 7 | +@Mapper | ||
| 8 | +public interface DeliveryFeePlanPieceRuleMapper extends BaseMapper<DeliveryFeePlanPieceRule> { | ||
| 9 | +} |
src/main/java/com/diligrp/rider/mapper/DeliveryFeePlanTimeRuleMapper.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/mapper/DeliveryFeePlanTimeRuleMapper.java | ||
| 1 | +package com.diligrp.rider.mapper; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
| 4 | +import com.diligrp.rider.entity.DeliveryFeePlanTimeRule; | ||
| 5 | +import org.apache.ibatis.annotations.Mapper; | ||
| 6 | + | ||
| 7 | +@Mapper | ||
| 8 | +public interface DeliveryFeePlanTimeRuleMapper extends BaseMapper<DeliveryFeePlanTimeRule> { | ||
| 9 | +} |
src/main/java/com/diligrp/rider/mapper/ExtStoreMapper.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/mapper/ExtStoreMapper.java | ||
| 1 | +package com.diligrp.rider.mapper; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
| 4 | +import com.diligrp.rider.entity.ExtStore; | ||
| 5 | +import org.apache.ibatis.annotations.Mapper; | ||
| 6 | + | ||
| 7 | +@Mapper | ||
| 8 | +public interface ExtStoreMapper extends BaseMapper<ExtStore> { | ||
| 9 | +} |
src/main/java/com/diligrp/rider/mapper/MerchantEnterMapper.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/mapper/MerchantEnterMapper.java | ||
| 1 | +package com.diligrp.rider.mapper; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
| 4 | +import com.diligrp.rider.entity.MerchantEnter; | ||
| 5 | +import org.apache.ibatis.annotations.Mapper; | ||
| 6 | + | ||
| 7 | +@Mapper | ||
| 8 | +public interface MerchantEnterMapper extends BaseMapper<MerchantEnter> { | ||
| 9 | +} |
src/main/java/com/diligrp/rider/mapper/MerchantStoreMapper.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/mapper/MerchantStoreMapper.java | ||
| 1 | +package com.diligrp.rider.mapper; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
| 4 | +import com.diligrp.rider.entity.MerchantStore; | ||
| 5 | +import org.apache.ibatis.annotations.Mapper; | ||
| 6 | + | ||
| 7 | +@Mapper | ||
| 8 | +public interface MerchantStoreMapper extends BaseMapper<MerchantStore> { | ||
| 9 | +} |
src/main/java/com/diligrp/rider/mapper/MerchantUsersMapper.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/mapper/MerchantUsersMapper.java | ||
| 1 | +package com.diligrp.rider.mapper; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
| 4 | +import com.diligrp.rider.entity.MerchantUsers; | ||
| 5 | +import org.apache.ibatis.annotations.Mapper; | ||
| 6 | + | ||
| 7 | +@Mapper | ||
| 8 | +public interface MerchantUsersMapper extends BaseMapper<MerchantUsers> { | ||
| 9 | +} |
src/main/java/com/diligrp/rider/mapper/OpenAppMapper.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/mapper/OpenAppMapper.java | ||
| 1 | +package com.diligrp.rider.mapper; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
| 4 | +import com.diligrp.rider.entity.OpenApp; | ||
| 5 | +import org.apache.ibatis.annotations.Mapper; | ||
| 6 | + | ||
| 7 | +@Mapper | ||
| 8 | +public interface OpenAppMapper extends BaseMapper<OpenApp> { | ||
| 9 | +} |
src/main/java/com/diligrp/rider/mapper/OrderRefundReasonMapper.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/mapper/OrderRefundReasonMapper.java | ||
| 1 | +package com.diligrp.rider.mapper; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
| 4 | +import com.diligrp.rider.entity.OrderRefundReason; | ||
| 5 | +import org.apache.ibatis.annotations.Mapper; | ||
| 6 | + | ||
| 7 | +@Mapper | ||
| 8 | +public interface OrderRefundReasonMapper extends BaseMapper<OrderRefundReason> { | ||
| 9 | +} |
src/main/java/com/diligrp/rider/mapper/OrderRefundRecordMapper.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/mapper/OrderRefundRecordMapper.java | ||
| 1 | +package com.diligrp.rider.mapper; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
| 4 | +import com.diligrp.rider.entity.OrderRefundRecord; | ||
| 5 | +import org.apache.ibatis.annotations.Mapper; | ||
| 6 | + | ||
| 7 | +@Mapper | ||
| 8 | +public interface OrderRefundRecordMapper extends BaseMapper<OrderRefundRecord> { | ||
| 9 | +} |
src/main/java/com/diligrp/rider/mapper/OrdersMapper.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/mapper/OrdersMapper.java | ||
| 1 | +package com.diligrp.rider.mapper; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
| 4 | +import com.diligrp.rider.entity.Orders; | ||
| 5 | +import org.apache.ibatis.annotations.Mapper; | ||
| 6 | +import org.apache.ibatis.annotations.Param; | ||
| 7 | + | ||
| 8 | +@Mapper | ||
| 9 | +public interface OrdersMapper extends BaseMapper<Orders> { | ||
| 10 | + | ||
| 11 | + /** 查询骑手今日转单次数 */ | ||
| 12 | + int countTodayTrans(@Param("riderId") Long riderId, @Param("todayStart") long todayStart); | ||
| 13 | +} |
src/main/java/com/diligrp/rider/mapper/RiderBalanceMapper.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/mapper/RiderBalanceMapper.java | ||
| 1 | +package com.diligrp.rider.mapper; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
| 4 | +import com.diligrp.rider.entity.RiderBalance; | ||
| 5 | +import org.apache.ibatis.annotations.Mapper; | ||
| 6 | + | ||
| 7 | +@Mapper | ||
| 8 | +public interface RiderBalanceMapper extends BaseMapper<RiderBalance> { | ||
| 9 | +} |
src/main/java/com/diligrp/rider/mapper/RiderEvaluateMapper.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/mapper/RiderEvaluateMapper.java | ||
| 1 | +package com.diligrp.rider.mapper; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
| 4 | +import com.diligrp.rider.entity.RiderEvaluate; | ||
| 5 | +import org.apache.ibatis.annotations.Mapper; | ||
| 6 | + | ||
| 7 | +@Mapper | ||
| 8 | +public interface RiderEvaluateMapper extends BaseMapper<RiderEvaluate> { | ||
| 9 | +} |
src/main/java/com/diligrp/rider/mapper/RiderLevelMapper.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/mapper/RiderLevelMapper.java | ||
| 1 | +package com.diligrp.rider.mapper; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
| 4 | +import com.diligrp.rider.entity.RiderLevel; | ||
| 5 | +import org.apache.ibatis.annotations.Mapper; | ||
| 6 | + | ||
| 7 | +@Mapper | ||
| 8 | +public interface RiderLevelMapper extends BaseMapper<RiderLevel> { | ||
| 9 | +} |
src/main/java/com/diligrp/rider/mapper/RiderLocationMapper.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/mapper/RiderLocationMapper.java | ||
| 1 | +package com.diligrp.rider.mapper; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
| 4 | +import com.diligrp.rider.entity.RiderLocation; | ||
| 5 | +import org.apache.ibatis.annotations.Mapper; | ||
| 6 | + | ||
| 7 | +@Mapper | ||
| 8 | +public interface RiderLocationMapper extends BaseMapper<RiderLocation> { | ||
| 9 | +} |
src/main/java/com/diligrp/rider/mapper/RiderMapper.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/mapper/RiderMapper.java | ||
| 1 | +package com.diligrp.rider.mapper; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
| 4 | +import com.diligrp.rider.entity.Rider; | ||
| 5 | +import org.apache.ibatis.annotations.Mapper; | ||
| 6 | + | ||
| 7 | +@Mapper | ||
| 8 | +public interface RiderMapper extends BaseMapper<Rider> { | ||
| 9 | +} |
src/main/java/com/diligrp/rider/mapper/RiderOrderCountMapper.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/mapper/RiderOrderCountMapper.java | ||
| 1 | +package com.diligrp.rider.mapper; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
| 4 | +import com.diligrp.rider.entity.RiderOrderCount; | ||
| 5 | +import org.apache.ibatis.annotations.Mapper; | ||
| 6 | +import org.apache.ibatis.annotations.Param; | ||
| 7 | + | ||
| 8 | +@Mapper | ||
| 9 | +public interface RiderOrderCountMapper extends BaseMapper<RiderOrderCount> { | ||
| 10 | + | ||
| 11 | + /** 累加骑手订单统计 */ | ||
| 12 | + void upsertCount(@Param("uid") Long uid, @Param("countDate") int countDate, | ||
| 13 | + @Param("orders") int orders, @Param("distance") long distance, | ||
| 14 | + @Param("transfers") int transfers); | ||
| 15 | +} |
src/main/java/com/diligrp/rider/mapper/RiderOrderRefuseMapper.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/mapper/RiderOrderRefuseMapper.java | ||
| 1 | +package com.diligrp.rider.mapper; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
| 4 | +import com.diligrp.rider.entity.RiderOrderRefuse; | ||
| 5 | +import org.apache.ibatis.annotations.Mapper; | ||
| 6 | +import org.apache.ibatis.annotations.Param; | ||
| 7 | + | ||
| 8 | +import java.util.List; | ||
| 9 | + | ||
| 10 | +@Mapper | ||
| 11 | +public interface RiderOrderRefuseMapper extends BaseMapper<RiderOrderRefuse> { | ||
| 12 | + | ||
| 13 | + /** 查询骑手已拒绝的订单ID列表 */ | ||
| 14 | + List<Long> selectRefuseOrderIds(@Param("riderId") Long riderId); | ||
| 15 | +} |
src/main/java/com/diligrp/rider/mapper/SubstationMapper.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/mapper/SubstationMapper.java | ||
| 1 | +package com.diligrp.rider.mapper; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
| 4 | +import com.diligrp.rider.entity.Substation; | ||
| 5 | +import org.apache.ibatis.annotations.Mapper; | ||
| 6 | + | ||
| 7 | +@Mapper | ||
| 8 | +public interface SubstationMapper extends BaseMapper<Substation> { | ||
| 9 | +} |
src/main/java/com/diligrp/rider/mapper/WebhookLogMapper.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/mapper/WebhookLogMapper.java | ||
| 1 | +package com.diligrp.rider.mapper; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
| 4 | +import com.diligrp.rider.entity.WebhookLog; | ||
| 5 | +import org.apache.ibatis.annotations.Mapper; | ||
| 6 | + | ||
| 7 | +@Mapper | ||
| 8 | +public interface WebhookLogMapper extends BaseMapper<WebhookLog> { | ||
| 9 | +} |
src/main/java/com/diligrp/rider/service/AdminRiderLevelService.java
0 → 100644
| 1 | +++ a/src/main/java/com/diligrp/rider/service/AdminRiderLevelService.java | ||
| 1 | +package com.diligrp.rider.service; | ||
| 2 | + | ||
| 3 | +import com.diligrp.rider.dto.AdminRiderLevelSaveDTO; | ||
| 4 | +import com.diligrp.rider.entity.RiderLevel; | ||
| 5 | + | ||
| 6 | +import java.util.List; | ||
| 7 | + | ||
| 8 | +public interface AdminRiderLevelService { | ||
| 9 | + List<RiderLevel> list(Long cityId); | ||
| 10 | + | ||
| 11 | + void add(AdminRiderLevelSaveDTO dto, Long cityId); | ||
| 12 | + | ||
| 13 | + void edit(AdminRiderLevelSaveDTO dto, Long cityId); | ||
| 14 | + | ||
| 15 | + void setDefault(Long id, Long cityId); | ||
| 16 | + | ||
| 17 | + void delete(Long id, Long cityId); | ||
| 18 | +} |