ソースを参照

设计购物车/订单商品数据库/员工统计图表

licailing 5 年 前
コミット
ec717ec190

+ 6 - 3
src/main/java/com/izouma/jiashanxia/domain/OrderInfo.java

@@ -56,8 +56,11 @@ public class OrderInfo extends BaseEntity {
     @ApiModelProperty(value = "充值套餐")
     private Long packageId;
 
-    @ApiModelProperty(value = "规格")
-    private String specification;
+//    @ApiModelProperty(value = "规格")
+//    private String specification;
+
+//    @ApiModelProperty(value = "使用日期")
+//    private LocalDate day;
 
     @ApiModelProperty(value = "价钱")
     private BigDecimal price;
@@ -77,7 +80,7 @@ public class OrderInfo extends BaseEntity {
     @ApiModelProperty(value = "多次使用")
     private boolean repeatedly;
 
-    @ApiModelProperty(value = "区分是种订单")
+    @ApiModelProperty(value = "区分是种订单")
     @Enumerated(EnumType.STRING)
     private GoodType goodType;
 

+ 31 - 0
src/main/java/com/izouma/jiashanxia/domain/OrderSnack.java

@@ -0,0 +1,31 @@
+package com.izouma.jiashanxia.domain;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.math.BigDecimal;
+import java.time.LocalDate;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Builder
+@ApiModel(value = "订单内商品")
+public class OrderSnack extends BaseEntity {
+    @ApiModelProperty(value = "购物车id")
+    private Long shoppingCardId;
+
+    private Long orderId;
+
+    private Long packageId;
+
+    private String specification;
+
+    private LocalDate day;
+
+    private BigDecimal price;
+}

+ 5 - 0
src/main/java/com/izouma/jiashanxia/domain/Package.java

@@ -1,6 +1,7 @@
 package com.izouma.jiashanxia.domain;
 
 import com.izouma.jiashanxia.converter.StringArrayConverter;
+import com.izouma.jiashanxia.enums.GoodType;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.AllArgsConstructor;
@@ -45,6 +46,10 @@ public class Package extends BaseEntity {
 //    @ApiModelProperty(value = "套餐类型")
 //    private PackageType type;
 
+    @ApiModelProperty(value = "区分是哪种类型")
+    @Enumerated(EnumType.STRING)
+    private GoodType goodType;
+
     @ApiModelProperty(value = "套餐分类")
     private Long categoryId;
 

+ 9 - 0
src/main/java/com/izouma/jiashanxia/domain/ShoppingCart.java

@@ -0,0 +1,9 @@
+package com.izouma.jiashanxia.domain;
+
+import java.math.BigDecimal;
+
+public class ShoppingCart extends BaseEntity {
+
+
+    private BigDecimal price;
+}

+ 23 - 6
src/main/java/com/izouma/jiashanxia/domain/Snack.java

@@ -1,6 +1,6 @@
 package com.izouma.jiashanxia.domain;
 
-import com.izouma.jiashanxia.converter.SpecificationListConverter;
+import com.izouma.jiashanxia.converter.StringArrayConverter;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.AllArgsConstructor;
@@ -21,17 +21,34 @@ import java.util.List;
 public class Snack extends BaseEntity {
     private String name;
 
-    private BigDecimal price;
+    private BigDecimal amount;
 
     @ApiModelProperty(value = "库存")
     private long inventory;
 
-    private String img;
+    @ApiModelProperty(value = "套餐标签")
+    @Convert(converter = StringArrayConverter.class)
+    private List<String> tag;
 
-    @ApiModelProperty(value = "规格")
+    @ApiModelProperty(value = "")
     @Column(columnDefinition = "TEXT")
-    @Convert(converter = SpecificationListConverter.class)
-    private List<Specification> specifications;
+    @Convert(converter = StringArrayConverter.class)
+    private List<String> img;
 
     private String content;
+
+    @ApiModelProperty(value = "是否单独分销")
+    private boolean separateDistribution;
+
+    @ApiModelProperty(value = "108将奖励比例")
+    private BigDecimal generalRatio;
+
+    @ApiModelProperty(value = "创客奖励比例")
+    private BigDecimal makerRatio;
+
+    @ApiModelProperty(value = "直推奖励比例")
+    private BigDecimal personalRatio0;
+
+    @ApiModelProperty(value = "间推奖励比例")
+    private BigDecimal personalRatio1;
 }

+ 2 - 1
src/main/java/com/izouma/jiashanxia/repo/CommissionRecordRepo.java

@@ -9,6 +9,7 @@ import org.springframework.data.jpa.repository.Query;
 
 import javax.transaction.Transactional;
 import java.math.BigDecimal;
+import java.time.LocalDateTime;
 import java.util.List;
 
 public interface CommissionRecordRepo extends JpaRepository<CommissionRecord, Long>, JpaSpecificationExecutor<CommissionRecord> {
@@ -17,7 +18,7 @@ public interface CommissionRecordRepo extends JpaRepository<CommissionRecord, Lo
     @Transactional
     void softDelete(Long id);
 
-    List<CommissionRecord> findAllByUserId(Long userId);
+    List<CommissionRecord> findAllByUserIdAndCreatedAtBetween(Long userId, LocalDateTime createdAt, LocalDateTime createdAt2);
 
     List<CommissionRecord> findAllByTransactionId(String transactionId);
 

+ 2 - 1
src/main/java/com/izouma/jiashanxia/repo/WithdrawRepo.java

@@ -8,6 +8,7 @@ import org.springframework.data.jpa.repository.Modifying;
 import org.springframework.data.jpa.repository.Query;
 
 import javax.transaction.Transactional;
+import java.time.LocalDateTime;
 import java.util.List;
 
 public interface WithdrawRepo extends JpaRepository<Withdraw, Long>, JpaSpecificationExecutor<Withdraw> {
@@ -20,5 +21,5 @@ public interface WithdrawRepo extends JpaRepository<Withdraw, Long>, JpaSpecific
 
     List<Withdraw> findAllByStatus(WithdrawStatus status);
 
-    List<Withdraw> findAllByStatusAndUserId(WithdrawStatus status, Long userId);
+    List<Withdraw> findAllByStatusAndUserIdAndAuditTimeBetween(WithdrawStatus status, Long userId, LocalDateTime auditTime, LocalDateTime auditTime2);
 }

+ 32 - 4
src/main/java/com/izouma/jiashanxia/service/OrderInfoService.java

@@ -86,6 +86,34 @@ public class OrderInfoService {
         return orderInfoRepo.save(order);
     }
 
+    /*
+   下订单
+    */
+    public OrderInfo createOrder1(OrderInfo orderInfo) {
+        Package aPackage = packageRepo.findById(orderInfo.getPackageId()).orElseThrow(new BusinessException("无套餐"));
+        DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
+        String localTime = df.format(LocalDateTime.now());
+        String num = String.format("%05d", orderInfoRepo.orderNum() + 1);
+
+//        if (ObjectUtil.isNotEmpty(orderInfo.getSpecification())) {
+//
+//
+//        }
+
+//        OrderInfo order = OrderInfo.builder()
+//                .packageId(packageId)
+//                .status(OrderInfoStatus.UNPAID)
+//                .userId(userId)
+//                .payMethod(payMethod)
+//                .orderNumber(localTime + num)
+//                .price(aPackage.getAmount())
+//                .name(aPackage.getName())
+//                .repeatedly(aPackage.isRepeatedly())
+//                .num(1)
+//                .build();
+        return orderInfoRepo.save(orderInfo);
+    }
+
     /*
     完成付款
      */
@@ -256,7 +284,7 @@ public class OrderInfoService {
         String transactionId = orderInfo.getId().toString();
 
         BigDecimal ratio = aPackage.getPersonalRatio0();
-        if (ObjectUtil.isNull(ratio)) {
+        if (ObjectUtil.isNull(ratio) || !aPackage.isSeparateDistribution()) {
             ratio = sysConfigService.getBigDecimal("PERSONAL_RATIO_0");
         }
 
@@ -299,7 +327,7 @@ public class OrderInfoService {
                 continue;
             }
             BigDecimal percentage = aPackage.getPersonalRatio1();
-            if (ObjectUtil.isNull(percentage)) {
+            if (ObjectUtil.isNull(percentage) || !aPackage.isSeparateDistribution()) {
                 String name = "PERSONAL_RATIO_" + i;
                 // 百分比
                 percentage = sysConfigService.getBigDecimal(name);
@@ -386,13 +414,13 @@ public class OrderInfoService {
     public void makerGeneralDistribution(User parent, BigDecimal amount, Long orderId, Long userId, Package aPackage) {
         // 创客比例
         BigDecimal makerRatio = aPackage.getMakerRatio();
-        if (ObjectUtil.isNull(makerRatio)) {
+        if (ObjectUtil.isNull(makerRatio) || !aPackage.isSeparateDistribution()) {
             makerRatio = sysConfigService.getBigDecimal("MAKER_RATIO");
         }
         BigDecimal maker = amount.multiply(makerRatio);
         // 108将比例
         BigDecimal generalRatio = aPackage.getMakerRatio();
-        if (ObjectUtil.isNull(generalRatio)) {
+        if (ObjectUtil.isNull(generalRatio) || !aPackage.isSeparateDistribution()) {
             generalRatio = sysConfigService.getBigDecimal("GENERAL_RATIO");
         }
         BigDecimal general = amount.multiply(generalRatio);

+ 5 - 3
src/main/java/com/izouma/jiashanxia/service/OrderRefundService.java

@@ -63,10 +63,12 @@ public class OrderRefundService {
                 throw new BusinessException("已退款");
             case REQUEST_REFUND:
                 throw new BusinessException("申请中");
+            case USED:
+                throw new BusinessException("已使用无法退款");
         }
-        if (orderInfo.isUse()) {
-            throw new BusinessException("已使用无法退款");
-        }
+//        if (orderInfo.isUse()) {
+//            throw new BusinessException("已使用无法退款");
+//        }
 
 
         // 可多次使用

+ 55 - 23
src/main/java/com/izouma/jiashanxia/service/StatisticService.java

@@ -1,6 +1,7 @@
 package com.izouma.jiashanxia.service;
 
 import cn.hutool.core.collection.CollUtil;
+import com.izouma.jiashanxia.domain.CommissionRecord;
 import com.izouma.jiashanxia.domain.OrderInfo;
 import com.izouma.jiashanxia.domain.Withdraw;
 import com.izouma.jiashanxia.domain.WxFee;
@@ -24,12 +25,13 @@ import java.util.stream.Collectors;
 @Service
 @AllArgsConstructor
 public class StatisticService {
-    private final UserRepo         userRepo;
-    private final CompanyRepo      companyRepo;
-    private final OrderInfoRepo    orderInfoRepo;
-    private final WxFeeRepo        wxFeeRepo;
-    private final WithdrawRepo     withdrawRepo;
-    private final UserService      userService;
+    private final UserRepo             userRepo;
+    private final CompanyRepo          companyRepo;
+    private final OrderInfoRepo        orderInfoRepo;
+    private final WxFeeRepo            wxFeeRepo;
+    private final WithdrawRepo         withdrawRepo;
+    private final UserService          userService;
+    private final CommissionRecordRepo commissionRecordRepo;
 
     /*
     数据总揽
@@ -106,7 +108,7 @@ public class StatisticService {
         return this.getDTOS(orderInfos, start, day);
     }
 
-    public List<StatisticDTO> employee(int year, int month, Long userId) {
+    public List<StatisticDTO> employeeOrder(int year, int month, Long userId) {
         LocalDateTime start = LocalDateTime.of(year, month, 1, 0, 0);
         LocalDateTime end = start.plusMonths(1);
         List<Long> childrenId = userService.childrenId(userId);
@@ -122,7 +124,7 @@ public class StatisticService {
         return this.getDTOS(orderInfos, start, (int) day);
     }
 
-    public List<StatisticDTO> employee2(int year, int month, Long userId) {
+    public List<StatisticDTO> employeeOrderFee(int year, int month, Long userId) {
         LocalDateTime start = LocalDateTime.of(year, month, 1, 0, 0);
         LocalDateTime end = start.plusMonths(1);
         long day = end.toLocalDate().toEpochDay() - start.toLocalDate().toEpochDay() - 1;
@@ -130,14 +132,12 @@ public class StatisticService {
         List<WxFee> wxFeeList = wxFeeRepo.findAll(((root, criteriaQuery, criteriaBuilder) -> {
             List<Predicate> and = new ArrayList<>();
             and.add(root.get("userId").in(childrenId));
-            and.add(criteriaBuilder.greaterThanOrEqualTo(root.get("paidAt"), start));
-            and.add(criteriaBuilder.lessThan(root.get("paidAt"), end));
+            and.add(criteriaBuilder.greaterThanOrEqualTo(root.get("createdAt"), start));
+            and.add(criteriaBuilder.lessThan(root.get("createdAt"), end));
             return criteriaBuilder.and(and.toArray(new Predicate[0]));
         }));
 
-        Map<Integer, List<WxFee>> collect = wxFeeRepo.findAllByCreatedAtBetweenAndUserId(start, end, userId)
-                .stream()
-                .collect(Collectors.groupingBy(WxFee::getAction));
+        Map<Integer, List<WxFee>> collect = wxFeeList.stream().collect(Collectors.groupingBy(WxFee::getAction));
         List<WxFee> wxFees = collect.get(0);
         List<WxFee> refunds = new ArrayList<>();
         List<WxFee> wxFees1 = collect.get(1);
@@ -173,20 +173,52 @@ public class StatisticService {
             LocalDateTime end = start.plusDays(1);
             LocalDateTime finalStart = start;
 
-//            BigDecimal fee = wxFees.stream()
-//                    .filter(wxFee -> !finalStart.isAfter(wxFee.getCreatedAt()) && end.isAfter(wxFee.getCreatedAt()))
-//                    .map(WxFee::getAmount)
-//                    .reduce(BigDecimal.ZERO, BigDecimal::add);
-//            BigDecimal refund = refunds.stream()
-//                    .filter(wxFee -> !finalStart.isAfter(wxFee.getCreatedAt()) && end.isAfter(wxFee.getCreatedAt()))
-//                    .map(WxFee::getAmount)
-//                    .reduce(BigDecimal.ZERO, BigDecimal::add);
+            BigDecimal fee = wxFees.stream()
+                    .filter(wxFee -> !finalStart.isAfter(wxFee.getCreatedAt()) && end.isAfter(wxFee.getCreatedAt()))
+                    .map(WxFee::getAmount)
+                    .reduce(BigDecimal.ZERO, BigDecimal::add);
+            BigDecimal refund = refunds.stream()
+                    .filter(wxFee -> !finalStart.isAfter(wxFee.getCreatedAt()) && end.isAfter(wxFee.getCreatedAt()))
+                    .map(WxFee::getAmount)
+                    .reduce(BigDecimal.ZERO, BigDecimal::add);
 
 
             dtos.add(StatisticDTO.builder()
                     .date(finalStart.toLocalDate())
-//                    .dayFee(fee)
-//                    .dayRefund(refund)
+                    .dayFee(fee)
+                    .dayRefund(refund)
+                    .build());
+            day--;
+            start = end;
+        }
+        return dtos;
+    }
+
+    public List<StatisticDTO> employeeCommission(int year, int month, Long userId) {
+        LocalDateTime start = LocalDateTime.of(year, month, 1, 0, 0);
+        LocalDateTime end = start.plusMonths(1);
+        long day = end.toLocalDate().toEpochDay() - start.toLocalDate().toEpochDay() - 1;
+        List<CommissionRecord> recordList = commissionRecordRepo.findAllByUserIdAndCreatedAtBetween(userId, start, end);
+        List<Withdraw> withdraws = withdrawRepo.findAllByStatusAndUserIdAndAuditTimeBetween(WithdrawStatus.SUCCESS, userId, start, end);
+
+        List<StatisticDTO> dtos = new ArrayList<>();
+        while (day > 0) {
+            LocalDateTime finalEnd = start.plusDays(1);
+            LocalDateTime finalStart = start;
+
+            BigDecimal fee = recordList.stream()
+                    .filter(commission -> !finalStart.isAfter(commission.getCreatedAt()) && finalEnd.isAfter(commission.getCreatedAt()))
+                    .map(CommissionRecord::getAmount)
+                    .reduce(BigDecimal.ZERO, BigDecimal::add);
+            BigDecimal withdraw = withdraws.stream()
+                    .filter(wxFee -> !finalStart.isAfter(wxFee.getAuditTime()) && end.isAfter(wxFee.getAuditTime()))
+                    .map(Withdraw::getAmount)
+                    .reduce(BigDecimal.ZERO, BigDecimal::add);
+
+            dtos.add(StatisticDTO.builder()
+                    .date(finalStart.toLocalDate())
+                    .dayFee(fee)
+                    .dayWithdraw(withdraw)
                     .build());
             day--;
             start = end;

+ 21 - 3
src/main/java/com/izouma/jiashanxia/web/StatisticController.java

@@ -15,7 +15,7 @@ import java.util.Map;
 @RestController
 @RequestMapping("/statistic")
 public class StatisticController {
-    private StatisticService statisticService;
+    private final StatisticService statisticService;
 
     @ApiOperation("数据总浏")
     @GetMapping("/data")
@@ -23,15 +23,33 @@ public class StatisticController {
         return statisticService.dataOverview();
     }
 
-    @ApiOperation("日销售额")
+    @ApiOperation("金额日销售额")
     @GetMapping("/dayAdd")
     public List<StatisticDTO> dayAdd(Integer day) {
         return statisticService.dayData(day);
     }
 
-    @ApiOperation("日销售额")
+    @ApiOperation("订单日销售额")
     @GetMapping("/dayAdd2")
     public List<StatisticDTO> dayAdd2(Integer day) {
         return statisticService.dayData2(day);
     }
+
+    @ApiOperation("员工订单日销售")
+    @GetMapping("/dayAddEmployee")
+    public List<StatisticDTO> dayAddEmployee(int year, int month, Long userId) {
+        return statisticService.employeeOrder(year, month, userId);
+    }
+
+    @ApiOperation("员工订单金额日销售")
+    @GetMapping("/dayAddEmployee1")
+    public List<StatisticDTO> dayAddEmployee1(int year, int month, Long userId) {
+        return statisticService.employeeOrderFee(year, month, userId);
+    }
+    @ApiOperation("员工收益金额日销售")
+    @GetMapping("/dayAddEmployee2")
+    public List<StatisticDTO> dayAddEmployee2(int year, int month, Long userId) {
+        return statisticService.employeeCommission(year, month, userId);
+    }
+
 }

+ 1 - 1
src/main/vue/src/components/PackageEdit.vue

@@ -92,7 +92,7 @@
                                 <el-date-picker
                                     type="date"
                                     value-format="yyyy-MM-dd"
-                                    placeholder="选择日期时间"
+                                    placeholder="选择日期"
                                     class="input"
                                     v-model="item.day"
                                 >

+ 8 - 0
src/main/vue/src/router.js

@@ -87,6 +87,14 @@ const router = new Router({
                         title: '员工列表'
                     }
                 },
+                {
+                    path: '/employeeDashboard',
+                    name: 'employeeDashboard',
+                    component: () => import(/* webpackChunkName: "404" */ '@/views/employee/EmployeeDashboard.vue'),
+                    meta: {
+                        title: '员工数据总览'
+                    }
+                },
                 {
                     path: '/childrenList',
                     name: 'childrenList',

+ 111 - 0
src/main/vue/src/views/employee/EmployeeDashboard.vue

@@ -0,0 +1,111 @@
+<template>
+    <div v-if="display">
+        <grid-layout
+            style="margin: 0 -10px;"
+            :layout="layout"
+            :col-num="12"
+            :row-height="30"
+            :is-draggable="editable"
+            :is-resizable="editable"
+            :is-mirrored="false"
+            :vertical-compact="true"
+            :margin="[10, 10]"
+            :use-css-transforms="true"
+        >
+            <grid-item
+                v-for="item in layout"
+                class="widget-wrapper"
+                :x="item.x"
+                :y="item.y"
+                :w="item.w"
+                :h="item.h"
+                :i="item.i"
+                :key="item.i"
+            >
+                <component :is="item.name" :value="$data[item.key]"></component>
+            </grid-item>
+        </grid-layout>
+        <!-- <el-button v-if="editable" @click="save">保存</el-button>
+        <el-button v-else @click="editable = true">编辑</el-button> -->
+    </div>
+</template>
+
+<script>
+import { GridLayout, GridItem } from 'vue-grid-layout';
+import UserWidget from '@/widgets/UserWidget';
+import OrderWidget from '@/widgets/OrderWidget';
+import CompanyWidget from '@/widgets/CompanyWidget';
+import FeeWidget from '@/widgets/FeeWidget';
+import RecentSales from '@/widgets/RecentSales';
+import RecentOrder from '@/widgets/RecentOrder';
+import { mapState } from 'vuex';
+
+export default {
+    created() {
+        this.$axios.get('/statistic/data').then(res => {
+            this.user = res.data['user'];
+            this.company = res.data['company'];
+            this.order = res.data['order'];
+            this.fee = res.data['fee'];
+        });
+        this.getAdmin();
+    },
+    data() {
+        return {
+            layout: [
+                // { x: 0, y: 0, w: 3, h: 3, i: '0', name: 'UserWidget', key: 'user' },
+                // { x: 3, y: 0, w: 3, h: 3, i: '1', name: 'CompanyWidget', key: 'company' },
+                // { x: 6, y: 0, w: 3, h: 3, i: '2', name: 'OrderWidget', key: 'order' },
+                // { x: 9, y: 0, w: 3, h: 3, i: '3', name: 'FeeWidget', key: 'fee' },
+                { x: 0, y: 4, w: 12, h: 12, i: '0', name: 'RecentOrder' },
+                { x: 0, y: 10, w: 12, h: 12, i: '1', name: 'RecentSales' }
+                /*{ x: 6, y: 4, w: 6, h: 12, i: '6', name: 'PieChartWidget' }*/
+            ],
+            editable: false,
+            user: 0,
+            company: 0,
+            order: 0,
+            fee: 0,
+            display: false
+        };
+    },
+    computed: {
+        ...mapState(['userInfo'])
+    },
+    methods: {
+        save() {
+            console.log(JSON.stringify(this.layout));
+            this.editable = false;
+        },
+        getAdmin() {
+            let data = this.userInfo.authorities;
+            for (let item in data) {
+                if (data[item].name === 'ROLE_ADMIN') {
+                    this.display = true;
+                    break;
+                }
+            }
+        }
+    },
+    components: {
+        GridLayout,
+        GridItem,
+        // UserWidget,
+        // OrderWidget,
+        // FeeWidget,
+        // CompanyWidget,
+        RecentSales,
+        RecentOrderEmployee
+    }
+};
+</script>
+
+<style lang="less">
+.widget-wrapper {
+    display: flex;
+    flex-direction: column;
+    .el-card {
+        flex-grow: 1;
+    }
+}
+</style>

+ 10 - 1
src/main/vue/src/views/employee/EmployeeList.vue

@@ -42,11 +42,12 @@
                     <i class="el-icon-user-solid" v-if="row.teamFounder"></i>
                 </template> -->
             </el-table-column>
-            <el-table-column label="操作" align="center" fixed="right">
+            <el-table-column label="操作" align="center" fixed="right" min-width="180">
                 <template slot-scope="{ row }">
                     <el-button size="mini" @click="handleCommand2(row.id)">收益</el-button>
                     <el-button size="mini" @click="handleCommand1(row.id)">下级</el-button>
                     <el-button size="mini" @click="handleCommand3(row.id)">销售</el-button>
+                    <el-button size="mini" @click="handleCommand4(row.id)">总览</el-button>
                     <!-- <el-button
                         @click="remove(row)"
                         type="warning"
@@ -215,6 +216,14 @@ export default {
                     id: id
                 }
             });
+        },
+        handleCommand4(id) {
+            this.$router.push({
+                path: '/employeeDashboard',
+                query: {
+                    id: id
+                }
+            });
         }
     }
 };

+ 69 - 0
src/main/vue/src/widgets/RecentOrderEmployee.vue

@@ -0,0 +1,69 @@
+<template>
+    <widget-card :bodyStyle="bodyStyle" ref="container">
+        <div style="width:100%;min-height:80px;" :loading="loading">
+            <div style="margin-bottom:5px">
+                <el-radio-group v-model="recentDays" size="mini" @change="getData">
+                    <el-radio-button label="7">近7天</el-radio-button>
+                    <el-radio-button label="30">近30天</el-radio-button>
+                </el-radio-group>
+            </div>
+            <bar-chart :chart-data="chartData" v-if="chartData"> </bar-chart>
+        </div>
+    </widget-card>
+</template>
+<script>
+import WidgetCard from './WidgetCard';
+import BarChart from '../components/BarChart';
+
+export default {
+    data() {
+        return {
+            bodyStyle: {
+                alignItems: 'center'
+            },
+            year: 2021,
+            month: 1,
+            chartData: null,
+            loading: false
+        };
+    },
+    created() {
+        this.getData();
+    },
+    methods: {
+        getData() {
+            this.loading = true;
+            this.$http
+                .get('/statistic/dayAddEmployee', {
+                    year: this.year,
+                    month: this.month,
+                    userId: this.$route.query.id
+                })
+                .then(res => {
+                    this.loading = false;
+                    this.chartData = {
+                        labels: res.map(i => i.date),
+                        datasets: [
+                            {
+                                label: '订单数',
+                                data: res.map(i => i.dayOrder),
+                                backgroundColor: 'rgba(54, 162, 235, 0.2)',
+                                borderColor: 'rgba(54, 162, 235, 1)',
+                                borderWidth: 1
+                            }
+                        ]
+                    };
+                })
+                .catch(e => {
+                    this.loading = false;
+                    this.$message.error(e.error);
+                });
+        }
+    },
+    components: {
+        WidgetCard,
+        BarChart
+    }
+};
+</script>
+<style lang="less" scoped></style>

+ 81 - 0
src/main/vue/src/widgets/RecentSalesEmployee.vue

@@ -0,0 +1,81 @@
+<template>
+    <widget-card :bodyStyle="bodyStyle" ref="container">
+        <div style="width:100%;min-height:80px;" :loading="loading">
+            <div style="margin-bottom:5px">
+                <el-radio-group v-model="recentDays" size="mini" @change="getData">
+                    <el-radio-button label="7">近7天</el-radio-button>
+                    <el-radio-button label="30">近30天</el-radio-button>
+                </el-radio-group>
+            </div>
+            <line-chart :chart-data="chartData" v-if="chartData"> </line-chart>
+        </div>
+    </widget-card>
+</template>
+<script>
+import WidgetCard from './WidgetCard';
+import LineChart from '../components/LineChart';
+
+export default {
+    data() {
+        return {
+            bodyStyle: {
+                display: 'flex',
+                alignItems: 'center'
+            },
+            recentDays: 7,
+            chartData: null,
+            loading: false
+        };
+    },
+    created() {
+        this.getData();
+    },
+    methods: {
+        getData() {
+            this.loading = true;
+            this.$http
+                .get('/statistic/dayAdd', {
+                    day: this.recentDays
+                })
+                .then(res => {
+                    this.loading = false;
+                    this.chartData = {
+                        labels: res.map(i => i.date),
+                        datasets: [
+                            {
+                                label: '销售额',
+                                data: res.map(i => i.dayFee),
+                                backgroundColor: ['rgba(54, 162, 235, 0.2)'],
+                                borderColor: ['rgba(54, 162, 235, 1)'],
+                                borderWidth: 1
+                            },
+                            {
+                                label: '提现金额',
+                                data: res.map(i => i.dayWithdraw),
+                                backgroundColor: ['rgba(230, 162, 60, 0.2)'],
+                                borderColor: ['rgba(230, 162, 60, 1)'],
+                                borderWidth: 1
+                            },
+                            {
+                                label: '退款额',
+                                data: res.map(i => i.dayRefund),
+                                backgroundColor: ['rgba(245, 108, 108, 0.2)'],
+                                borderColor: ['rgba(245, 108, 108, 1)'],
+                                borderWidth: 1
+                            }
+                        ]
+                    };
+                })
+                .catch(e => {
+                    this.loading = false;
+                    this.$message.error(e.error);
+                });
+        }
+    },
+    components: {
+        WidgetCard,
+        LineChart
+    }
+};
+</script>
+<style lang="less" scoped></style>

+ 8 - 2
src/test/java/com/izouma/jiashanxia/service/StatisticServiceTest.java

@@ -33,13 +33,19 @@ public class StatisticServiceTest {
 
     @Test
     public void test1() {
-        List<StatisticDTO> employee = statisticService.employee(2021, 1, 916L);
+        List<StatisticDTO> employee = statisticService.employeeOrder(2021, 1, 916L);
         employee.forEach(System.out::println);
     }
 
     @Test
     public void test2() {
-        List<StatisticDTO> employee = statisticService.employee2(2021, 1, 921L);
+        List<StatisticDTO> employee = statisticService.employeeOrderFee(2021, 1, 921L);
         employee.forEach(System.out::println);
     }
+
+    @Test
+    public void test3() {
+        List<StatisticDTO> statisticDTOS = statisticService.employeeCommission(2021, 1, 921L);
+        statisticDTOS.forEach(System.out::println);
+    }
 }