李雨欣 9.8测试接口
parent
e576e9cc00
commit
fddc53db5b
|
@ -1,82 +0,0 @@
|
||||||
package com.muyu.market.admain;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import com.muyu.common.core.web.domain.BaseEntity;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import lombok.experimental.SuperBuilder;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@AllArgsConstructor
|
|
||||||
@SuperBuilder
|
|
||||||
@NoArgsConstructor
|
|
||||||
@TableName(value = "订单表",autoResultMap = true)
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
public class Orders extends BaseEntity {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 订单的唯一标识
|
|
||||||
*/
|
|
||||||
@TableId(value = "order_id",type = IdType.AUTO)
|
|
||||||
private Long orderId;
|
|
||||||
/**
|
|
||||||
* 用户名
|
|
||||||
*/
|
|
||||||
@Schema(description = "用户名",type = "Long")
|
|
||||||
private Long userId;
|
|
||||||
/**
|
|
||||||
* 商品Id
|
|
||||||
*/
|
|
||||||
@Schema(description = "商品Id",type = "Long")
|
|
||||||
private Long apiId;
|
|
||||||
/**
|
|
||||||
* 订单号
|
|
||||||
*/
|
|
||||||
@Schema(description = "订单号",type = "String")
|
|
||||||
private String orderNo;
|
|
||||||
/**
|
|
||||||
* 订单状态
|
|
||||||
*/
|
|
||||||
@Schema(description = "订单状态",type = "String")
|
|
||||||
private String orderStatus;
|
|
||||||
/**
|
|
||||||
* 订单总金额
|
|
||||||
*/
|
|
||||||
@Schema(description = "订单总金额",type = "BigDecimal")
|
|
||||||
private BigDecimal totalAmount;
|
|
||||||
/**
|
|
||||||
* 订单创建时间
|
|
||||||
*/
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
@Schema(description = "订单创建时间",type = "Date")
|
|
||||||
private Date createTime;
|
|
||||||
/**
|
|
||||||
* 订单更新时间
|
|
||||||
*/
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
@Schema(description = "订单更新时间",type = "Date")
|
|
||||||
private Date updateTime;
|
|
||||||
/**
|
|
||||||
* 订单备注
|
|
||||||
*/
|
|
||||||
@Schema(description = "订单备注",type = "String")
|
|
||||||
private String note;
|
|
||||||
|
|
||||||
|
|
||||||
private String createBy;
|
|
||||||
private String updateBy;
|
|
||||||
private String remark;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,79 +0,0 @@
|
||||||
package com.muyu.market.admain.request;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import lombok.experimental.SuperBuilder;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@AllArgsConstructor
|
|
||||||
@NoArgsConstructor
|
|
||||||
@SuperBuilder
|
|
||||||
@Tag(name = "订单展示", description = "订单展示")
|
|
||||||
public class OrdersListReq {
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 订单的唯一标识
|
|
||||||
*/
|
|
||||||
@TableId(value = "order_id",type = IdType.AUTO)
|
|
||||||
private Long orderId;
|
|
||||||
/**
|
|
||||||
* 用户名
|
|
||||||
*/
|
|
||||||
@Schema(description = "用户名",type ="Long")
|
|
||||||
private Long userId;
|
|
||||||
/**
|
|
||||||
* 商品Id
|
|
||||||
*/
|
|
||||||
@Schema(description = "商品Id",type ="Long")
|
|
||||||
private Long apiId;
|
|
||||||
/**
|
|
||||||
* 订单号
|
|
||||||
*/
|
|
||||||
@Schema(description = "订单号",type ="String")
|
|
||||||
private String orderNo;
|
|
||||||
/**
|
|
||||||
* 订单状态
|
|
||||||
*/
|
|
||||||
@Schema(description = "订单状态",type ="String")
|
|
||||||
private String orderStatus;
|
|
||||||
/**
|
|
||||||
* 订单总金额
|
|
||||||
*/
|
|
||||||
@Schema(description = "订单总金额",type ="BigDecimal")
|
|
||||||
private BigDecimal totalAmount;
|
|
||||||
/**
|
|
||||||
* 订单创建时间
|
|
||||||
*/
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
@Schema(description = "订单创建时间",type = "Date")
|
|
||||||
private Date createTime;
|
|
||||||
/**
|
|
||||||
* 订单更新时间
|
|
||||||
*/
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
@Schema(description = "订单创建时间",type = "Date")
|
|
||||||
private Date updateTime;
|
|
||||||
/**
|
|
||||||
* 订单备注
|
|
||||||
*/
|
|
||||||
@Schema(description = "订单备注",type ="String")
|
|
||||||
private String note;
|
|
||||||
|
|
||||||
|
|
||||||
private String createBy;
|
|
||||||
private String updateBy;
|
|
||||||
private String remark;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,101 +0,0 @@
|
||||||
package com.muyu.market.admain.response;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import com.muyu.market.admain.Myapi;
|
|
||||||
import com.muyu.market.admain.Orders;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import lombok.experimental.SuperBuilder;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@AllArgsConstructor
|
|
||||||
@NoArgsConstructor
|
|
||||||
@SuperBuilder
|
|
||||||
@Tag(name = "订单展示", description = "订单展示")
|
|
||||||
public class OrdersListResp {
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 订单的唯一标识
|
|
||||||
*/
|
|
||||||
@TableId(value = "order_id",type = IdType.AUTO)
|
|
||||||
private Long orderId;
|
|
||||||
/**
|
|
||||||
* 用户名
|
|
||||||
*/
|
|
||||||
@Schema(description = "用户名",type ="Long")
|
|
||||||
private Long userId;
|
|
||||||
/**
|
|
||||||
* 商品Id
|
|
||||||
*/
|
|
||||||
@Schema(description = "商品Id",type ="Long")
|
|
||||||
private Long apiId;
|
|
||||||
/**
|
|
||||||
* 订单号
|
|
||||||
*/
|
|
||||||
@Schema(description = "订单号",type ="String")
|
|
||||||
private String orderNo;
|
|
||||||
/**
|
|
||||||
* 订单状态
|
|
||||||
*/
|
|
||||||
@Schema(description = "订单状态",type ="String")
|
|
||||||
private String orderStatus;
|
|
||||||
/**
|
|
||||||
* 订单总金额
|
|
||||||
*/
|
|
||||||
@Schema(description = "订单总金额",type ="BigDecimal")
|
|
||||||
private BigDecimal totalAmount;
|
|
||||||
/**
|
|
||||||
* 订单创建时间
|
|
||||||
*/
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
@Schema(description = "订单创建时间",type = "Date")
|
|
||||||
private Date createTime;
|
|
||||||
/**
|
|
||||||
* 订单更新时间
|
|
||||||
*/
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
@Schema(description = "订单创建时间",type = "Date")
|
|
||||||
private Date updateTime;
|
|
||||||
/**
|
|
||||||
* 订单备注
|
|
||||||
*/
|
|
||||||
@Schema(description = "订单备注",type ="String")
|
|
||||||
private String note;
|
|
||||||
|
|
||||||
|
|
||||||
private String createBy;
|
|
||||||
private String updateBy;
|
|
||||||
private String remark;
|
|
||||||
|
|
||||||
|
|
||||||
public static OrdersListResp selOrdersList(Orders orders){
|
|
||||||
|
|
||||||
return OrdersListResp
|
|
||||||
.builder()
|
|
||||||
.orderId(orders.getOrderId())
|
|
||||||
.userId(orders.getUserId())
|
|
||||||
.apiId(orders.getApiId())
|
|
||||||
.orderNo(orders.getOrderNo())
|
|
||||||
.orderStatus(orders.getOrderStatus())
|
|
||||||
.totalAmount(orders.getTotalAmount())
|
|
||||||
.createTime(orders.getCreateTime())
|
|
||||||
.updateTime(orders.getUpdateTime())
|
|
||||||
.note(orders.getNote())
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -82,7 +82,7 @@ public class AliPayController {
|
||||||
params.put(name, request.getParameter(name));
|
params.put(name, request.getParameter(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
String tradeNo = params.get("out_trade_no");
|
String tradeNo0 = params.get("out_trade_no");
|
||||||
String gmtPayment = params.get("gmt_payment");
|
String gmtPayment = params.get("gmt_payment");
|
||||||
String alipayTradeNo = params.get("trade_no");
|
String alipayTradeNo = params.get("trade_no");
|
||||||
|
|
||||||
|
|
|
@ -1,62 +0,0 @@
|
||||||
package com.muyu.market.server.controller;
|
|
||||||
|
|
||||||
|
|
||||||
import com.muyu.common.core.domain.Result;
|
|
||||||
import com.muyu.market.admain.Myapi;
|
|
||||||
import com.muyu.market.admain.request.OrdersListReq;
|
|
||||||
import com.muyu.market.admain.response.OrdersListResp;
|
|
||||||
import com.muyu.market.server.service.OrdersService;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/orders")
|
|
||||||
@Tag(name = "订单控制层",description = "订单查询")
|
|
||||||
public class OrdersController {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private OrdersService ordersService;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 订单的添加
|
|
||||||
* @param myapi
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@PostMapping("/Saveorders")
|
|
||||||
@Operation(summary = "订单添加",description = "订单的添加")
|
|
||||||
public Result<String> createOrders(@RequestBody Myapi myapi){
|
|
||||||
|
|
||||||
ordersService.saveOrders(myapi);
|
|
||||||
return Result.success();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询订单信息
|
|
||||||
* @param ordersListReq
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@PostMapping("/ordersSelect")
|
|
||||||
@Operation(summary = "查询订单信息",description = "查询订单信息")
|
|
||||||
public Result<List<OrdersListResp>> ordersSelect(@RequestBody OrdersListReq ordersListReq){
|
|
||||||
List<OrdersListResp> selList = ordersService.ordersSelect(ordersListReq);
|
|
||||||
return Result.success(selList);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,17 +0,0 @@
|
||||||
package com.muyu.market.server.mapper;
|
|
||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.muyu.market.admain.Orders;
|
|
||||||
import com.muyu.market.admain.request.OrdersListReq;
|
|
||||||
import com.muyu.market.admain.response.OrdersListResp;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface OrdersMapper extends BaseMapper<Orders> {
|
|
||||||
|
|
||||||
|
|
||||||
List<OrdersListResp> ordersSelect(OrdersListReq ordersListReq);
|
|
||||||
}
|
|
|
@ -1,53 +0,0 @@
|
||||||
package com.muyu.market.server.service.Impl;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.muyu.common.security.utils.SecurityUtils;
|
|
||||||
import com.muyu.market.admain.Myapi;
|
|
||||||
import com.muyu.market.admain.Orders;
|
|
||||||
import com.muyu.market.admain.request.OrdersListReq;
|
|
||||||
import com.muyu.market.admain.response.OrdersListResp;
|
|
||||||
import com.muyu.market.server.mapper.OrdersMapper;
|
|
||||||
import com.muyu.market.server.service.OrdersService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, Orders> implements OrdersService {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private OrdersMapper ordersMapper;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void saveOrders(Myapi myapi) {
|
|
||||||
|
|
||||||
Orders orders = new Orders();
|
|
||||||
//获取用户ID
|
|
||||||
Long userId = SecurityUtils.getUserId();
|
|
||||||
orders.setUserId(userId);
|
|
||||||
//获取商品ID
|
|
||||||
orders.setApiId(myapi.getApiId());
|
|
||||||
//获取金额
|
|
||||||
orders.setTotalAmount(myapi.getPrice());
|
|
||||||
//创建时间为当前时间
|
|
||||||
orders.setCreateTime(new Date());
|
|
||||||
//修改时间为当前时间
|
|
||||||
orders.setUpdateTime(new Date());
|
|
||||||
|
|
||||||
try {
|
|
||||||
ordersMapper.insert(orders);
|
|
||||||
} catch (Exception e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<OrdersListResp> ordersSelect(OrdersListReq ordersListReq) {
|
|
||||||
return ordersMapper.ordersSelect(ordersListReq);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,15 +0,0 @@
|
||||||
package com.muyu.market.server.service;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
import com.muyu.market.admain.Myapi;
|
|
||||||
import com.muyu.market.admain.Orders;
|
|
||||||
import com.muyu.market.admain.request.OrdersListReq;
|
|
||||||
import com.muyu.market.admain.response.OrdersListResp;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface OrdersService extends IService<Orders> {
|
|
||||||
void saveOrders(Myapi myapi);
|
|
||||||
|
|
||||||
List<OrdersListResp> ordersSelect(OrdersListReq ordersListReq);
|
|
||||||
}
|
|
|
@ -1,35 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
|
||||||
<mapper namespace="com.muyu.market.server.mapper.OrdersMapper">
|
|
||||||
|
|
||||||
|
|
||||||
<resultMap id="OrderDetailDTOMap" type="com.muyu.market.admain.response.OrdersListResp">
|
|
||||||
<result property="orderId" column="order_id" />
|
|
||||||
<result property="userId" column="user_id" />
|
|
||||||
<result property="apiId" column="api_id" />
|
|
||||||
<result property="orderNo" column="order_no"/>
|
|
||||||
<result property="orderStatus" column="order_status"/>
|
|
||||||
<result property="totalAmount" column="total_amount"/>
|
|
||||||
<result property="createTime" column="create_time"/>
|
|
||||||
<result property="updateTime" column="update_time"/>
|
|
||||||
<result property="note" column="note"/>
|
|
||||||
</resultMap>
|
|
||||||
|
|
||||||
<select id="ordersSelect" resultType="com.muyu.market.admain.response.OrdersListResp">
|
|
||||||
|
|
||||||
SELECT
|
|
||||||
orders.*,
|
|
||||||
sys_user.user_name,
|
|
||||||
myapi.name,
|
|
||||||
myapi.price,
|
|
||||||
myapi.test,
|
|
||||||
FROM
|
|
||||||
orders
|
|
||||||
LEFT JOIN sys_user ON orders.order_id = sys_user.user_id
|
|
||||||
LEFT JOIN myapi ON orders.order_id = myapi.api_id
|
|
||||||
|
|
||||||
</select>
|
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
|
Loading…
Reference in New Issue