Selaa lähdekoodia

#MOD 今日销售统计

谭斌 2 vuotta sitten
vanhempi
commit
c4d05bdbda

+ 10 - 0
device-api-cloud/src/main/java/com/xy/feign/DeviceDataFeign.java

@@ -0,0 +1,10 @@
+package com.xy.feign;
+
+import com.xy.FeignInterceptor;
+import com.xy.consts.ServiceConsts;
+import com.xy.service.DeviceDataService;
+import org.springframework.cloud.openfeign.FeignClient;
+
+@FeignClient(value = ServiceConsts.SERVICE_NAME, configuration = FeignInterceptor.class)
+public interface DeviceDataFeign extends DeviceDataService {
+}

+ 1 - 0
device-api-service-merc-mini/src/main/java/com/xy/controller/MercMiniDeviceController.java

@@ -72,6 +72,7 @@ public class MercMiniDeviceController {
         return deviceInfoService.mercHomeStatistical(dto);
     }
 
+
     @PostMapping("searchPage")
     @ApiOperation("小程序商户设备搜索")
     public R<PageBean<DeviceInfoDto.MerHomeSearchVO>> mercDeviceSearchPage(@RequestBody DeviceInfoDto.Page page) {

+ 4 - 0
device-api-service-merc-mini/src/main/java/com/xy/controller/MercMiniDeviceHomePageController.java

@@ -10,6 +10,7 @@ import com.xy.dto.MercMiniDeviceDto;
 import com.xy.dto.OrderRefundDto;
 import com.xy.service.DeviceDataServiceImpl;
 import com.xy.service.OrderRefundService;
+import com.xy.service.OrdersService;
 import com.xy.utils.MercAuthUtils;
 import com.xy.utils.R;
 import io.swagger.annotations.Api;
@@ -35,6 +36,7 @@ public class MercMiniDeviceHomePageController {
 
     private DeviceDataServiceImpl deviceDataService;
     private OrderRefundService refundService;
+    private OrdersService ordersService;
 
     @PostMapping("count")
     @ApiOperation("首页统计")
@@ -73,4 +75,6 @@ public class MercMiniDeviceHomePageController {
         vo.setMonth(month);
         return R.ok(vo);
     }
+
+
 }

+ 5 - 0
device-api-service/src/main/java/com/xy/service/DeviceDataServiceImpl.java

@@ -285,6 +285,11 @@ public class DeviceDataServiceImpl extends ServiceImpl<DeviceDataMapper, DeviceD
         return copy(DeviceDataDto.Vo.class, list);
     }
 
+    @Override
+    public R<List<DeviceDataDto.Vo>> getMercDataOneDay(DeviceDataDto.CountByDay dto) {
+        return R.ok(this.getMercDataOneDay(dto.getMercId(), dto.getDateValue()));
+    }
+
     public static class SaveOrAccum {
 
         public R saveOrAccum(DeviceDataDto.SaveOrAccum saveOrAccum, DeviceDataServiceImpl deviceDataService) {

+ 29 - 10
device-api/src/main/java/com/xy/dto/DeviceDataDto.java

@@ -25,7 +25,7 @@ public class DeviceDataDto {
 
     @Data
     @Accessors(chain = true)
-    public static class SumCountVo{
+    public static class SumCountVo {
         @ApiModelProperty(value = "营业额;单位分")
         private Integer salesMoney;
 
@@ -47,22 +47,23 @@ public class DeviceDataDto {
         @ApiModelProperty(value = "0元订单笔数")
         private Integer zeroCount;
     }
+
     @Data
     @Accessors(chain = true)
-    public static class SumCountDto{
-        @ApiModelProperty(value = "商户ID",required = true)
+    public static class SumCountDto {
+        @ApiModelProperty(value = "商户ID", required = true)
         private Long mercId;
 
         @NotNull(message = "统计类型不能为空")
-        @ApiModelProperty(value = "统计类型",required = true)
+        @ApiModelProperty(value = "统计类型", required = true)
         private String type;
 
         @NotNull(message = "排序字段不能为空")
-        @ApiModelProperty(value = "排序字段",required = true)
+        @ApiModelProperty(value = "排序字段", required = true)
         private String orderByKey;
 
         @NotNull(message = "排序方式不能为空")
-        @ApiModelProperty(value = "排序方式",required = true)
+        @ApiModelProperty(value = "排序方式", required = true)
         private String orderBy;
 
         @ApiModelProperty("开始时间")
@@ -72,18 +73,19 @@ public class DeviceDataDto {
         private String endDate;
 
         public String getBeginDate() {
-            return StrUtil.replace(beginDate,"-","");
+            return StrUtil.replace(beginDate, "-", "");
         }
+
         public String getEndDate() {
-            return StrUtil.replace(endDate,"-","");
+            return StrUtil.replace(endDate, "-", "");
         }
     }
 
     @Data
     @Accessors(chain = true)
-    public static class SumPageDto extends SumCountDto{
+    public static class SumPageDto extends SumCountDto {
         @NotNull(message = "分页信息不能为空")
-        @ApiModelProperty(value = "分页信息",required = true)
+        @ApiModelProperty(value = "分页信息", required = true)
         private PageBean page;
     }
 
@@ -117,6 +119,7 @@ public class DeviceDataDto {
         @ApiModelProperty(value = "0元订单笔数")
         private Integer zeroCount;
     }
+
     @Data
     @Accessors(chain = true)
     public static class Page extends Vo {
@@ -274,5 +277,21 @@ public class DeviceDataDto {
 
     }
 
+    @Data
+    @Accessors(chain = true)
+    public static class CountByDay {
+
+        @ApiModelProperty(value = "设备ID")
+        private Long deviceId;
+
+        @ApiModelProperty(value = "商户ID")
+        private Long mercId;
+
+        @ApiModelProperty(value = "日期")
+        private String dateValue;
+
+
+    }
+
 
 }

+ 50 - 0
device-api/src/main/java/com/xy/dto/MercMiniDeviceDto.java

@@ -1,5 +1,7 @@
 package com.xy.dto;
 
+import cn.hutool.core.date.DateTime;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.experimental.Accessors;
@@ -71,6 +73,54 @@ public class MercMiniDeviceDto {
 
     }
 
+    @Data
+    @Accessors(chain = true)
+    public static class HomePageDayDTO {
+        @JsonFormat(pattern = "yyyy-MM-dd")
+        private DateTime date;
+    }
+
+    @Data
+    @Accessors(chain = true)
+    public static class HomePageDayVO {
+        @ApiModelProperty(value = "今日收款")
+        private Integer todayReceivedMoney;
+        @ApiModelProperty(value = "今日补收-金额")
+        private Integer todayFillMoney;
+        @ApiModelProperty(value = "今日补收-数量")
+        private Integer todayFillOrderNum;
+
+        @ApiModelProperty(value = "今日补退-金额")
+        private Integer todayHisRefundMoney;
+
+        @ApiModelProperty(value = "今日补退-数量")
+        private Integer todayHisOrderRefundNum;
+
+        @ApiModelProperty(value = "今日退款-金额")
+        private Integer todayOrderRefundMoney;
+
+        @ApiModelProperty(value = "今日退款-数量")
+        private Integer todayOrderRefundNum;
+
+        @ApiModelProperty(value = "今日销售-订单金额")
+        private Integer todayOrderTotalMoney;
+
+        @ApiModelProperty(value = "今日销售-到账金额")
+        private Integer todayOrderRealMoney;
+        @ApiModelProperty(value = "今日销售-数量")
+        private Integer todayOrderNum;
+
+        @ApiModelProperty(value = "风险单-待处理数量")
+        private Integer toDoRiskOrderCount;
+
+        @ApiModelProperty(value = "风险单-今日处理数量")
+        private Integer toDayHandleRiskOrderCount;
+        @ApiModelProperty(value = "风险单-今日新增数量")
+        private Integer toDayNewRiskOrderCount;
+
+
+    }
+
     @Data
     @Accessors(chain = true)
     public static class DayCountVO {

+ 15 - 1
device-api/src/main/java/com/xy/service/DeviceDataService.java

@@ -1,6 +1,13 @@
 package com.xy.service;
 
 import com.xy.annotate.RestMappingController;
+import com.xy.dto.DeviceDataDto;
+import com.xy.utils.R;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+
+import java.util.List;
 
 /**
  * <p>
@@ -12,6 +19,13 @@ import com.xy.annotate.RestMappingController;
  */
 @RestMappingController("/device-data")
 public interface DeviceDataService {
-
+    /**
+     * 指定查询商户所有设备某天数据
+     *
+     * @param dto
+     * @return
+     */
+    @PostMapping("getByDay")
+    R<List<DeviceDataDto.Vo>> getMercDataOneDay(@RequestBody @Validated DeviceDataDto.CountByDay dto);
 
 }