feat:增加统计测试接口
This commit is contained in:
@@ -0,0 +1,49 @@
|
|||||||
|
package com.gxwebsoft.shop.controller;
|
||||||
|
|
||||||
|
import com.alipay.api.domain.DashboardParam;
|
||||||
|
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||||
|
import com.gxwebsoft.common.core.web.ApiResult;
|
||||||
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
|
import com.gxwebsoft.shop.entity.Coupon;
|
||||||
|
import com.gxwebsoft.shop.entity.Dashboard;
|
||||||
|
import com.gxwebsoft.shop.param.CouponParam;
|
||||||
|
import com.gxwebsoft.shop.service.CouponService;
|
||||||
|
import com.gxwebsoft.shop.service.OrderService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.gxwebsoft.common.core.web.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仪表盘,数据统计
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2022-11-28 18:26:05
|
||||||
|
*/
|
||||||
|
@Api(tags = "数据统计")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/shop/dashboard")
|
||||||
|
public class DashboardController extends BaseController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private OrderService orderService;
|
||||||
|
|
||||||
|
//@PreAuthorize("hasAuthority('shop:dashboard')")
|
||||||
|
@OperationLog
|
||||||
|
@ApiOperation("可查看一天日新增的订单量、一天日销售额以及总订单量、总销售额等数据\n")
|
||||||
|
@GetMapping("/day")
|
||||||
|
public ApiResult<Dashboard> day(DashboardParam param) {
|
||||||
|
Dashboard dashboard = new Dashboard();
|
||||||
|
dashboard.setDayTotalSale(BigDecimal.valueOf(30));
|
||||||
|
dashboard.setDayNewOrderNum(20);
|
||||||
|
dashboard.setTotalSale(BigDecimal.valueOf(5000));
|
||||||
|
dashboard.setTotalOrderNum(2000);;
|
||||||
|
return success(dashboard);
|
||||||
|
}
|
||||||
|
}
|
||||||
26
src/main/java/com/gxwebsoft/shop/entity/Dashboard.java
Normal file
26
src/main/java/com/gxwebsoft/shop/entity/Dashboard.java
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
package com.gxwebsoft.shop.entity;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@ApiModel(value = "Dashboard对象", description = "仪表盘数据统计字段")
|
||||||
|
public class Dashboard {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "新增的订单量")
|
||||||
|
private int dayNewOrderNum;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "当日销售额")
|
||||||
|
private BigDecimal dayTotalSale;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "总订单量")
|
||||||
|
private int totalOrderNum;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "总销售额")
|
||||||
|
private BigDecimal totalSale;
|
||||||
|
}
|
||||||
16
src/main/java/com/gxwebsoft/shop/param/DashBoardParam.java
Normal file
16
src/main/java/com/gxwebsoft/shop/param/DashBoardParam.java
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
package com.gxwebsoft.shop.param;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import com.gxwebsoft.common.core.web.BaseParam;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
@ApiModel(value = "DashBoardParam", description = "银表盘数据统计面板参数")
|
||||||
|
public class DashBoardParam extends BaseParam {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user