feat: 提交cola client层
parent
64b705dfea
commit
a2c2f8d92e
|
@ -77,6 +77,7 @@
|
|||
<mqtt.version>1.2.5</mqtt.version>
|
||||
<pf4j-spring.version>0.9.0</pf4j-spring.version>
|
||||
<vertx.version>4.5.13</vertx.version>
|
||||
<swagger-annotations.version>2.2.25</swagger-annotations.version>
|
||||
<!-- 三方云服务相关 -->
|
||||
<commons-io.version>2.17.0</commons-io.version>
|
||||
<commons-compress.version>1.27.1</commons-compress.version>
|
||||
|
@ -92,6 +93,11 @@
|
|||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.swagger.core.v3</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>${swagger-annotations.version}</version>
|
||||
</dependency>
|
||||
<!-- 统一依赖管理 -->
|
||||
<dependency>
|
||||
<groupId>io.netty</groupId>
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
<modules>
|
||||
<module>yudao-module-trade-cola-domain</module>
|
||||
<module>yudao-module-trade-cola-infrastructure</module>
|
||||
<module>yudao-module-trade-cola-client</module>
|
||||
</modules>
|
||||
|
||||
</project>
|
||||
</project>
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
<?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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-module-trade-cola</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>yudao-module-trade-cola-client</artifactId>
|
||||
|
||||
<name>${project.artifactId}</name>
|
||||
<description>
|
||||
trade 模块 客户端层
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-common</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.swagger.core.v3</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
</dependency>
|
||||
<!-- 参数校验 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<!-- RPC 远程调用相关 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>14</source>
|
||||
<target>14</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,46 @@
|
|||
package cn.iocoder.yudao.module.trade.api.order.api;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.RpcConstants;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.trade.api.order.dto.clientobject.TradeOrderRespCO;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.module.trade.api.order.api.TradeOrderServiceI.NAME;
|
||||
|
||||
@FeignClient(name = NAME) // TODO 芋艿:fallbackFactory =
|
||||
@Tag(name = "RPC 服务 - 订单")
|
||||
public interface TradeOrderServiceI {
|
||||
|
||||
String NAME = "trade-server";
|
||||
String PREFIX = RpcConstants.RPC_API_PREFIX + "/trade" + "/order";
|
||||
|
||||
@GetMapping(PREFIX + "/list")
|
||||
@Operation(summary = "获得订单列表")
|
||||
@Parameter(name = "ids", description = "订单编号数组", required = true)
|
||||
CommonResult<List<TradeOrderRespCO>> getOrderList(@RequestParam("ids") Collection<Long> ids);
|
||||
|
||||
@GetMapping(PREFIX + "/get")
|
||||
@Operation(summary = "获得订单")
|
||||
@Parameter(name = "id", description = "订单编号", required = true)
|
||||
CommonResult<TradeOrderRespCO> getOrder(@RequestParam("id") Long id);
|
||||
|
||||
@PutMapping(PREFIX + "/cancel-paid")
|
||||
@Parameters({
|
||||
@Parameter(name = "userId", description = "用户编号", required = true, example = "1024"),
|
||||
@Parameter(name = "orderId", description = "订单编号", required = true, example = "2048"),
|
||||
})
|
||||
CommonResult<Boolean> cancelPaidOrder(@RequestParam("userId") Long userId,
|
||||
@RequestParam("orderId") Long orderId,
|
||||
@RequestParam("cancelType") Integer cancelType);
|
||||
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package cn.iocoder.yudao.module.trade.api.order.dto.clientobject;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* This is the object communicate with Client. The clients could be view layer or other
|
||||
* HSF Consumers.
|
||||
*
|
||||
* @author fulan.zjf 2017-10-27 PM 12:19:15
|
||||
*/
|
||||
@Setter
|
||||
@Getter
|
||||
public abstract class ClientObject implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* This is for extended values。
|
||||
*/
|
||||
protected Map<String, Object> extValues = new HashMap<>();
|
||||
|
||||
public Object getExtField(String key) {
|
||||
if (extValues != null) {
|
||||
return extValues.get(key);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void putExtField(String fieldName, Object value) {
|
||||
this.extValues.put(fieldName, value);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package cn.iocoder.yudao.module.trade.api.order.dto.clientobject;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Data Transfer object, including Command, Query and Response, Command and Query is CQRS
|
||||
* concept.
|
||||
*
|
||||
* @author Frank Zhang 2020.11.13
|
||||
*
|
||||
*/
|
||||
public abstract class DTO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
package cn.iocoder.yudao.module.trade.api.order.dto.clientobject;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 订单信息 Response DTO
|
||||
*
|
||||
* @author HUIHUI
|
||||
* @author laokou
|
||||
*/
|
||||
@Schema(description = "RPC 服务 - 订单信息 Response CO")
|
||||
@Data
|
||||
public class TradeOrderRespCO extends ClientObject {
|
||||
|
||||
// ========== 订单基本信息 ==========
|
||||
|
||||
@Schema(description = "订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "订单流水号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1146347329394184195")
|
||||
private String no;
|
||||
|
||||
@Schema(description = "订单类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Integer type; // 参见 TradeOrderTypeEnum 枚举
|
||||
|
||||
@Schema(description = "订单来源", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Integer terminal; // 参见 TerminalEnum 枚举
|
||||
|
||||
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "用户 IP", requiredMode = Schema.RequiredMode.REQUIRED, example = "127.0.0.1")
|
||||
private String userIp;
|
||||
|
||||
@Schema(description = "用户备注", example = "这个商品不错哦")
|
||||
private String userRemark;
|
||||
|
||||
@Schema(description = "订单状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "0")
|
||||
private Integer status; // 参见 TradeOrderStatusEnum 枚举
|
||||
|
||||
@Schema(description = "购买的商品数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
|
||||
private Integer productCount;
|
||||
|
||||
@Schema(description = "订单完成时间")
|
||||
private LocalDateTime finishTime;
|
||||
|
||||
@Schema(description = "订单取消时间")
|
||||
private LocalDateTime cancelTime;
|
||||
|
||||
@Schema(description = "取消类型", example = "1")
|
||||
private Integer cancelType; // 参见 TradeOrderCancelTypeEnum 枚举
|
||||
|
||||
@Schema(description = "商家备注", example = "这个用户很喜欢退货")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "是否评价", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
|
||||
private Boolean commentStatus;
|
||||
|
||||
// ========== 价格 + 支付基本信息 ==========
|
||||
|
||||
@Schema(description = "支付订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
private Long payOrderId;
|
||||
|
||||
@Schema(description = "是否已支付", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
|
||||
private Boolean payStatus;
|
||||
|
||||
}
|
Loading…
Reference in New Issue