22 changed files with 478 additions and 11 deletions
@ -0,0 +1,22 @@ |
|||
package cn.nla.common.enums; |
|||
|
|||
/** |
|||
* 客户端枚举类 |
|||
*/ |
|||
public enum ClientType { |
|||
|
|||
/** |
|||
* 原生应用 |
|||
*/ |
|||
APP, |
|||
|
|||
/** |
|||
* 电脑端 |
|||
*/ |
|||
PC, |
|||
|
|||
/** |
|||
* 网页 |
|||
*/ |
|||
H5 |
|||
} |
@ -0,0 +1,20 @@ |
|||
package cn.nla.common.enums; |
|||
|
|||
public enum ProductOrderPayTypeEnum { |
|||
|
|||
/** |
|||
* 微信支付 |
|||
*/ |
|||
WECHAT, |
|||
|
|||
/** |
|||
* 支付支付 |
|||
*/ |
|||
ALIPAY, |
|||
|
|||
/** |
|||
* 银行卡支付 |
|||
*/ |
|||
BANK; |
|||
|
|||
} |
@ -0,0 +1,22 @@ |
|||
package cn.nla.common.enums; |
|||
|
|||
public enum ProductOrderStateEnum { |
|||
|
|||
/** |
|||
* 未支付订单 |
|||
*/ |
|||
NEW, |
|||
|
|||
|
|||
/** |
|||
* 已经支付订单 |
|||
*/ |
|||
PAY, |
|||
|
|||
/** |
|||
* 超时取消订单 |
|||
*/ |
|||
CANCEL; |
|||
|
|||
} |
|||
|
@ -0,0 +1,17 @@ |
|||
package cn.nla.common.enums; |
|||
|
|||
|
|||
public enum ProductOrderTypeEnum { |
|||
|
|||
/** |
|||
* 普通订单 |
|||
*/ |
|||
DAILY, |
|||
|
|||
|
|||
/** |
|||
* 促销订单 |
|||
*/ |
|||
PROMOTION; |
|||
|
|||
} |
@ -0,0 +1,29 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" |
|||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|||
<parent> |
|||
<artifactId>nla-shop</artifactId> |
|||
<groupId>cn.nla</groupId> |
|||
<version>1.0-SNAPSHOT</version> |
|||
</parent> |
|||
<modelVersion>4.0.0</modelVersion> |
|||
<artifactId>nla-order-service</artifactId> |
|||
<description>订单服务模块</description> |
|||
|
|||
<properties> |
|||
<maven.compiler.source>11</maven.compiler.source> |
|||
<maven.compiler.target>11</maven.compiler.target> |
|||
</properties> |
|||
<dependencies> |
|||
<dependency> |
|||
<groupId>cn.nla</groupId> |
|||
<artifactId>nla-common</artifactId> |
|||
<version>1.0-SNAPSHOT</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.projectlombok</groupId> |
|||
<artifactId>lombok</artifactId> |
|||
</dependency> |
|||
</dependencies> |
|||
</project> |
@ -0,0 +1,15 @@ |
|||
package cn.nla.order; |
|||
|
|||
import org.mybatis.spring.annotation.MapperScan; |
|||
import org.springframework.boot.SpringApplication; |
|||
import org.springframework.boot.autoconfigure.SpringBootApplication; |
|||
import org.springframework.context.annotation.ComponentScan; |
|||
|
|||
@SpringBootApplication |
|||
@MapperScan("cn.nla.*.mapper") |
|||
@ComponentScan(basePackages = {"cn.nla.*"}) |
|||
public class OrderApplication { |
|||
public static void main(String[] args) { |
|||
SpringApplication.run(OrderApplication.class, args); |
|||
} |
|||
} |
@ -0,0 +1,57 @@ |
|||
package cn.nla.order.model.request; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.math.BigDecimal; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 订单请求参数 |
|||
*/ |
|||
@ApiModel(value = "添加订单对象", description = "添加订单请求对象") |
|||
@Data |
|||
public class ConfirmOrderRequest { |
|||
@ApiModelProperty(value = "购物车使用的优惠券,集满减劵(如果传空或者小于0,则不用优惠券)", example = "1") |
|||
@JsonProperty("coupon_record_id") |
|||
private Long couponRecordId; |
|||
@ApiModelProperty(value = "最终购买的商品列表:传递id,购买数量从购物车中读取") |
|||
@JsonProperty("product_ids") |
|||
private List<Long> productIdList; |
|||
@ApiModelProperty(value = "支付方式", example = "WECHAT") |
|||
@JsonProperty("pay_type") |
|||
private String payType; |
|||
/** |
|||
* 端类型 |
|||
*/ |
|||
@ApiModelProperty(value = "端类型", example = "APP") |
|||
@JsonProperty("client_type") |
|||
private String clientType; |
|||
/** |
|||
* 收货地址id |
|||
*/ |
|||
@ApiModelProperty(value = "收货地址id", example = "中国") |
|||
@JsonProperty("address_id") |
|||
private long addressId; |
|||
/** |
|||
* 总价格,前端传递,后端需要验价 |
|||
*/ |
|||
@ApiModelProperty(value = "总价格", example = "40.00") |
|||
@JsonProperty("total_amount") |
|||
private BigDecimal totalAmount; |
|||
/** |
|||
* 实际支付的价格, |
|||
* 如果用了优惠劵,则是减去优惠券后端价格,如果没的话,则是totalAmount一样 |
|||
*/ |
|||
@ApiModelProperty(value = "实际支付的价格", example = "20.00") |
|||
@JsonProperty("real_pay_amount") |
|||
private BigDecimal realPayAmount; |
|||
/** |
|||
* 防重令牌 |
|||
*/ |
|||
@ApiModelProperty(value = "防重令牌", example = "sdvdgwerqwerwrwerqweq") |
|||
@JsonProperty("token") |
|||
private String token; |
|||
} |
@ -0,0 +1,26 @@ |
|||
server: |
|||
port: 9004 |
|||
spring: |
|||
application: |
|||
name: nla-order-service |
|||
redis: |
|||
host: 127.0.0.1 |
|||
port: 6379 |
|||
database: 0 |
|||
password: yuan123456 |
|||
#数据库配置 |
|||
datasource: |
|||
driver-class-name: com.mysql.cj.jdbc.Driver |
|||
url: jdbc:mysql://117.72.43.105:3306/p_nla_order?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai |
|||
username: root |
|||
password: Yuan625621105. |
|||
#配置plus打印sql⽇志 |
|||
mybatis-plus: |
|||
configuration: |
|||
log-impl: |
|||
org.apache.ibatis.logging.stdout.StdOutImpl |
|||
#设置⽇志级别,ERROR/WARN/INFO/DEBUG,默认是INFO以上才显示 |
|||
#logging: |
|||
# level: |
|||
# root: INFO |
|||
|
@ -0,0 +1,71 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<configuration scan="true" scanPeriod="60 seconds" debug="false"> |
|||
<!-- 自定义配置: 日志存放路径 --> |
|||
<property name="log.path" value="./logs/nla-order-service"/> |
|||
<!-- 日志输出格式 --> |
|||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/> |
|||
<!-- 控制台输出 --> |
|||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender"> |
|||
<encoder> |
|||
<pattern>${log.pattern}</pattern> |
|||
</encoder> |
|||
</appender> |
|||
<!-- 系统日志输出 --> |
|||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
|||
<file>${log.path}/info.log</file> |
|||
<!-- 循环政策:基于时间创建日志文件 --> |
|||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
|||
<!-- 日志文件名格式 --> |
|||
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern> |
|||
<!-- 日志最大的历史 60天 --> |
|||
<maxHistory>60</maxHistory> |
|||
</rollingPolicy> |
|||
<encoder> |
|||
<pattern>${log.pattern}</pattern> |
|||
</encoder> |
|||
<filter class="ch.qos.logback.classic.filter.LevelFilter"> |
|||
<!-- 过滤的级别 --> |
|||
<level>INFO</level> |
|||
<!-- 匹配时的操作:接收(记录) --> |
|||
<onMatch>ACCEPT</onMatch> |
|||
<!-- 不匹配时的操作:拒绝(不记录) --> |
|||
<onMismatch>DENY</onMismatch> |
|||
</filter> |
|||
</appender> |
|||
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
|||
<file>${log.path}/error.log</file> |
|||
<!-- 循环政策:基于时间创建日志文件 --> |
|||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
|||
<!-- 日志文件名格式 --> |
|||
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern> |
|||
<!-- 日志最大的历史 60天 --> |
|||
<maxHistory>60</maxHistory> |
|||
</rollingPolicy> |
|||
<encoder> |
|||
<pattern>${log.pattern}</pattern> |
|||
</encoder> |
|||
<filter class="ch.qos.logback.classic.filter.LevelFilter"> |
|||
<!-- 过滤的级别 --> |
|||
<level>ERROR</level> |
|||
<!-- 匹配时的操作:接收(记录) --> |
|||
<onMatch>ACCEPT</onMatch> |
|||
<!-- 不匹配时的操作:拒绝(不记录) --> |
|||
<onMismatch>DENY</onMismatch> |
|||
</filter> |
|||
</appender> |
|||
<!-- 自定义配置: 系统模块日志级别控制 --> |
|||
<logger name="cn.nla" level="info"/> |
|||
<!-- Spring日志级别控制 --> |
|||
<logger name="org.springframework" level="warn"/> |
|||
<logger name="io.lettuce.core.protocol" level="ERROR"/> |
|||
<!--自定义配置: mapper打印--> |
|||
<logger name="cn.nla.order.mapper" level="DEBUG"/> |
|||
<root level="info"> |
|||
<appender-ref ref="console"/> |
|||
</root> |
|||
<!--系统操作日志--> |
|||
<root level="info"> |
|||
<appender-ref ref="file_info"/> |
|||
<appender-ref ref="file_error"/> |
|||
</root> |
|||
</configuration> |
@ -0,0 +1,23 @@ |
|||
package cn.nla.user.feign; |
|||
|
|||
import cn.nla.common.util.JsonData; |
|||
import cn.nla.user.model.request.NewUserCouponRequest; |
|||
import org.springframework.cloud.openfeign.FeignClient; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* Feign调用优惠券服务接口 |
|||
*/ |
|||
@FeignClient(name = "nla-coupon-service") |
|||
public interface CouponFeignService { |
|||
/** |
|||
* 分页查询优惠券 |
|||
*/ |
|||
@GetMapping("/cop/coupon/v1/page_coupon") |
|||
JsonData pageCouponList(@RequestHeader Map<String, String> header, @RequestParam("page") int page, @RequestParam("size") int size); |
|||
|
|||
@PostMapping("/cop/coupon/v1/new_user_coupon") |
|||
JsonData addNewUserCoupon(@RequestBody NewUserCouponRequest newUserCouponRequest); |
|||
} |
@ -0,0 +1,20 @@ |
|||
package cn.nla.user.model.request; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* 新用户注册发放优惠卷 |
|||
*/ |
|||
@ApiModel(value = "新用户注册发放优惠卷对象", description = "新用户注册发放优惠卷请求对象") |
|||
@Data |
|||
public class NewUserCouponRequest { |
|||
@ApiModelProperty(value = "用户Id", example = "19") |
|||
@JsonProperty("user_id") |
|||
private long userId; |
|||
@ApiModelProperty(value = "名称", example = "二当家") |
|||
@JsonProperty("name") |
|||
private String name; |
|||
} |
Loading…
Reference in new issue