doum
8 小时以前 c11bce150d6e702f41ce247a0c62ea03401318f1
经销商管理
已修改8个文件
475 ■■■■ 文件已修改
admin/src/api/business/workbench.js 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin/src/views/index.vue 219 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmmall_admin/src/main/java/com/doumee/api/business/WorkbenchController.java 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmmall_service/src/main/java/com/doumee/core/utils/DateUtil.java 67 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmmall_service/src/main/java/com/doumee/dao/system/vo/BusinessDataCountVO.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmmall_service/src/main/java/com/doumee/dao/system/vo/CountDataVO.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmmall_service/src/main/java/com/doumee/service/business/WorkbenchService.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmmall_service/src/main/java/com/doumee/service/business/impl/WorkbenchServiceImpl.java 144 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin/src/api/business/workbench.js
@@ -1,7 +1,17 @@
import request from '../../utils/request'
export function allList (data) {
export function businessData (data) {
  return request.post('/business/workbench/businessData', data, {
    trim: true
  })
}
export function shopRankList10 (data) {
  return request.post('/business/workbench/shopRankList10', data, {
    trim: true
  })
}
export function goodsRankList10 (data) {
  return request.post('/business/workbench/goodsRankList10', data, {
    trim: true
  })
}
admin/src/views/index.vue
@@ -11,22 +11,22 @@
        <div class="data-summary">
          <div class="data-item blue">
            <div>{{tabName}}销售额</div>
            <div class="data-num">¥{{ (countData.totalPrice ||0).toFixed(2) }}</div>
            <div class="data-num">¥{{ (topData.price ||0).toFixed(2) }}</div>
          </div>
          <div class="parting"></div>
          <div class="data-item yellow">
            <div>{{tabName}}成交订单量</div>
            <div class="data-num">{{ countData.totalNum ||0}}</div>
            <div class="data-num">{{ topData.num||0}}</div>
          </div>
          <div class="parting"></div>
          <div class="data-item green">
            <div>{{tabName}}退款金额</div>
            <div class="data-num">¥{{( countData.totalRefundPrice ||0).toFixed(2) }}</div>
            <div class="data-num">¥{{( topData.price1 ||0).toFixed(2) }}</div>
          </div>
          <div class="parting"></div>
          <div class="data-item orange">
            <div>{{tabName}}退款订单量</div>
            <div class="data-num">{{ countData.totalRefundNum ||0 }}</div>
            <div class="data-num">{{ topData.num1 ||0 }}</div>
          </div>
          <div class="parting"></div>
        </div>
@@ -35,7 +35,7 @@
      <div class="change-style">
        <div class="count-left">
          <div class="item-title">订单量与销售额趋势</div>
          <div ref="orderCount" class="bottom"></div>
          <div ref="orderCount" class="bottom"  ></div>
        </div>
        <div class="count-right">
          <div class="item-title">各品类销售额占比</div>
@@ -46,9 +46,9 @@
          <div class="tab-title" style="display: flex;align-items: center; ">
            <span style="">排名分析</span>
            <div class="tab-item" style="margin-left: 20px;" >
              <el-date-picker  style="width: 110px;height: 22px;margin-right: 10px;"   v-model="searchForm.topYear"  type="year"
              <el-date-picker  style="width: 110px;height: 22px;margin-right: 10px;"   v-model="searchForm.topYear"  type="year" @change="changeYearMonth"
                  clearable  value-format="yyyy"     format="yyyy'年'"   placeholder="年份" ></el-date-picker>
              <el-date-picker  style="width: 100px;height: 22px;"   v-model="searchForm.topMonth"  type="month"
              <el-date-picker  style="width: 100px;height: 22px;"   v-model="searchForm.topMonth"  type="month"  @change="changeYearMonth"
                               clearable  value-format="MM"     format="MM'月'"   placeholder="月份" ></el-date-picker>
            </div>
          </div>
@@ -69,7 +69,7 @@
              <el-table-column prop="name" label="经销商名称"   align="center" >  </el-table-column>
              <el-table-column prop="num" label="订单量"   align="center" >  </el-table-column>
              <el-table-column prop="price" label="销售额(元)" align="center" ></el-table-column>
              <el-table-column prop="num2" label="会员数" align="center"  ></el-table-column>
              <el-table-column prop="num1" label="会员数" align="center"  ></el-table-column>
            </el-table>
          </div>
        </div>
@@ -138,27 +138,40 @@
<script>
import TableLayout from '@/layouts/TableLayout'
import BaseTable from '@/components/base/BaseTable'
import * as echarts from 'echarts'
export default {
  extends: BaseTable,
  components: {
    TableLayout
  },
  data () {
    return {
      tabs2: [{ index: 0, name: '按销量' }, { index: 1, name: '按销售额'}],
      loading1: false,
      loading2: false,
      loading3: false,
      tabs2: [{ index: 0, name: '按销量' }, { index: 1, name: '按销售额' }],
      tabs1: [{ index: 0, name: '按订单量' }, { index: 1, name: '按销售额' }, { index: 2, name: '按会员数' }],
      tabs: [{ index: 0, name: '今日' }, { index: 1, name: '近7日' }, { index: 2, name: '近30日' }, { index: 3, name: '近12月' }],
      tabName: '今日',
      tabIndex: 0,
      tabIndex1: 0,
      tabIndex2: 0,
      searchForm:{
        topYear:null,
        topMonth:null,
        topYear2:null,
      searchForm: {
        topYear: null,
        topMonth: null,
        topYear2: null
      },
      topData:{
      topData: {
        num: 0,
        num1: 0,
        price: 0,
        price1: 0,
        dateStrList: [],
        dataList: [],
        dataList2: [],
        cateList: [],
        numList: []
      },
      countData: {
        totalPrice: 1000,
@@ -166,10 +179,8 @@
        totalRefundPrice: 10000,
        totalRefundNum: 100
      },
      dataList1:[],
      dataList2:[],
      orderCorderCount: [10, 10, 20, 10, 40, 10, 30],
      opinionData: ['3.20', '3.21', '3.22', '3.23', '3.24', '3.25', '3.26'],
      dataList1: [],
      dataList2: [],
      myChart0: null,
      myChart1: null
    }
@@ -183,10 +194,54 @@
    })
  },
  mounted () {
    this.initCountData()
    this.initTopData()
    this.initShopRankData()
    this.initGoodsRankData()
  },
  methods: {
    initCountData () {
    changeYearMonth(){
      this.initGoodsRankData()
      this.initShopRankData()
    },
    initShopRankData () {
      this.loading2 = true
      this.api.shopRankList10({ year: this.searchForm.topYear, month: this.searchForm.topMonth ,type:this.tabIndex1}).then(res => {
        res = res || []
        this.dataList1 = res
      }).finally(() => {
        this.loading2 = false
      })
    },
    initGoodsRankData () {
      this.loading3 = true
      this.api.goodsRankList10({ year: this.searchForm.topYear, month: this.searchForm.topMonth ,type:this.tabIndex2}).then(res => {
        res = res || []
        this.dataList2 = res
      }).finally(() => {
        this.loading3 = false
      })
    },
    initTopData () {
      this.loading1 = true
      this.initTopEcharts()
      this.api.businessData({ dateType: this.tabIndex }).then(res => {
        res = res || {}
        res.num = res.num || 0
        res.num1 = res.num1 || 0
        res.price = res.price || 0
        res.price1 = res.price1 || 0
        res.dateStrList = res.dateStrList || []
        res.datalist2 = res.datalist2 || []
        res.dataList = res.dataList || []
        res.cateList = res.cateList || []
        this.topData = res
        this.renderEchartOption0()
        this.renderEchartOption2()
      }).finally(() => {
        this.loading1 = false
      })
    },
    initTopEcharts () {
      this.myChart0 = echarts.init(this.$refs.orderCount)
      window.addEventListener('resize', () => {
        this.myChart0.resize()
@@ -195,23 +250,46 @@
      window.addEventListener('resize', () => {
        this.myChart1.resize()
      })
      this.renderOrderChange(this.myChart0)
      this.renderOrderChange(this.myChart1)
      this.renderEchartOption0()
      this.renderEchartOption2()
    },
    changeTab (item) {
      this.tabName = item.name
      this.tabIndex = item.index
      if (this.loading1) {
        return
      }
      if (item.index !== this.tabIndex) {
        this.tabName = item.name
        this.tabIndex = item.index
        this.initTopData()
      }
    },
    changeTab1 (item) {
      this.tabIndex1 = item.index
      if (this.loading2) {
        return
      }
      if (item.index !== this.tabIndex1) {
        this.tabName = item.name
        this.tabIndex1 = item.index
        this.initShopRankData()
      }
    },
    changeTab2 (item) {
      this.tabIndex2 = item.index
      if (this.loading3) {
        return
      }
      if (item.index !== this.tabIndex2) {
        this.tabName = item.name
        this.tabIndex2 = item.index
        this.initGoodsRankData()
      }
    },
    renderOrderChange (chart) {
      chart.setOption({
    renderEchartOption0 () {
      this.myChart0.setOption({
        tooltip: {
          trigger: 'axis'
          trigger: 'axis',
          axisPointer: {
            type: 'cross'
          }
        },
        grid: {
          left: '3%',
@@ -221,23 +299,84 @@
        },
        toolbox: {
          feature: {
          }
        },
        legend: {
          data: ['订单量', '销售额(元)']
        },
        xAxis: {
          type: 'category',
          boundaryGap: false,
          data: this.opinionData
          data: this.topData.dateStrList || []
        },
        yAxis: {
          type: 'value'
        yAxis: [
          {
            type: 'value',
            name: '订单量',
            min: 0
          },
          {
            type: 'value',
            name: '销售额(元)',
            min: 0
          }
        ],
        series: [
          {
            name: '订单量',
            data: this.topData.dataList || [],
            type: 'bar'
          },
          {
            name: '销售额(元)',
            yAxisIndex: 1,
            data: this.topData.dataList2 || [],
            type: 'line'
          }
        ]
      })
    },
    renderEchartOption2 () {
      const series = []
      this.topData.cateList.forEach((item, index) => {
        series.push( {
          name: item.name,
          type: 'bar',
          stack: 'total',
          barWidth: '60%',
          label: {
            // show: true
          },
          data: item.data||[]
        })
      })
      this.myChart1.setOption({
        tooltip: {
          trigger: 'axis',
          axisPointer: {
            type: 'cross'
          }
        },
        series: [{
          name: '订单',
          type: 'line',
          stack: '总量',
          data: this.orderCorderCount
        }]
        grid: {
          left: '3%',
          right: '4%',
          bottom: '3%',
          containLabel: true
        },
        toolbox: {
          feature: {
          }
        },
        legend: {
          data: this.topData.cateList || []
        },
        xAxis: {
          type: 'category',
          boundaryGap: false,
          data: this.topData.dateStrList || []
        },
        yAxis: { type: 'value' } ,
        series
      })
    }
  }
server/dmmall_admin/src/main/java/com/doumee/api/business/WorkbenchController.java
@@ -15,6 +15,8 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
 * @author 江蹄蹄
 * @date 2023/03/21 15:48
@@ -27,11 +29,20 @@
    @Autowired
    private WorkbenchService workbenchService;
    @PreventRepeat
    @ApiOperation("新建")
    @ApiOperation("经营数据分析")
    @PostMapping("/businessData")
    public ApiResponse<BusinessDataCountVO> create(@RequestBody CountDataDTO param) {
    public ApiResponse<BusinessDataCountVO> businessData(@RequestBody CountDataDTO param) {
        return ApiResponse.success(workbenchService.businessData(param));
    }
    @ApiOperation("经销商TOP10")
    @PostMapping("/shopRankList10")
    public ApiResponse<List<BusinessDataCountVO>> shopRankList10(@RequestBody CountDataDTO param) {
        return ApiResponse.success(workbenchService.shopRankList10(param));
    }
    @ApiOperation("单一商品TOP10")
    @PostMapping("/goodsRankList10")
    public ApiResponse<List<BusinessDataCountVO>> goodsRankList10(@RequestBody CountDataDTO param) {
        return ApiResponse.success(workbenchService.goodsRankList10(param));
    }
}
server/dmmall_service/src/main/java/com/doumee/core/utils/DateUtil.java
@@ -7,13 +7,11 @@
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.*;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters;
import java.util.Calendar;
import java.util.*;
import java.util.Date;
import java.util.Enumeration;
import java.util.GregorianCalendar;
import java.util.Hashtable;
import java.util.Locale;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
@@ -1240,7 +1238,12 @@
        }
        return length;
    }
    public static String minusMonthToDate(LocalDate date, int num) {
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM");
        String month = date.minusMonths(num).format(formatter);
        return month;
}
    /**
     * 得到两个日期之间相差的天数
     *
@@ -1712,7 +1715,56 @@
        calo.add(Calendar.DATE, intBetween);
        return calo.getTime();
    }
    public static List<Date> getDatePeriodByYearAndMonth(int year  , int month) {
        List<Date> list = new ArrayList<>();
        list.add(null);
        list.add(null);
        try {
            Calendar calendar = Calendar.getInstance();
            calendar.set(Calendar.YEAR, year);
            calendar.set(Calendar.MONTH, month);
            calendar.set(Calendar.DAY_OF_MONTH, 1);
            calendar.set(Calendar.HOUR_OF_DAY, 0);
            calendar.set(Calendar.MINUTE, 0);
            calendar.set(Calendar.SECOND, 0);
            list.set(0,calendar.getTime());
            calendar.add(Calendar.MONTH, 1); // 加一个月
            calendar.add(Calendar.DAY_OF_MONTH, -1); // 然后减一天得到这个月最后一天
            calendar.set(Calendar.HOUR_OF_DAY, 23);
            calendar.set(Calendar.MINUTE, 59);
            calendar.set(Calendar.SECOND, 59);
            list.set(1,calendar.getTime());
        }catch (Exception e){
        }
        return list;
    }
    public static List<Date> getDatePeriodByYear(int year) {
        List<Date> list = new ArrayList<>();
        list.add(null);
        list.add(null);
        try {
            Calendar calendar = Calendar.getInstance();
            calendar.set(Calendar.YEAR, year);
            calendar.set(Calendar.MONTH,0);
            calendar.set(Calendar.DAY_OF_MONTH, 1);
            calendar.set(Calendar.HOUR_OF_DAY, 0);
            calendar.set(Calendar.MINUTE, 0);
            calendar.set(Calendar.SECOND, 0);
            list.set(0,calendar.getTime());
            calendar.add(Calendar.YEAR, 1); // 加一个月
            calendar.add(Calendar.DAY_OF_MONTH, -1); // 然后减一天得到这个月最后一天
            calendar.set(Calendar.HOUR_OF_DAY, 23);
            calendar.set(Calendar.MINUTE, 59);
            calendar.set(Calendar.SECOND, 59);
            list.set(1,calendar.getTime());
        }catch (Exception e){
        }
        return list;
    }
    /**
     * 得到将date增加指定年数后的date
     *
@@ -2753,7 +2805,10 @@
    public static void main(String[] args) {
        try {
            System.out.println(RandomStringUtils.randomNumeric(3));
            System.out.println(getPlusTime2(getDatePeriodByYearAndMonth(2026,11).get(0)));
            System.out.println(getPlusTime2(getDatePeriodByYearAndMonth(2026,11).get(1)));
            System.out.println(getPlusTime2(getDatePeriodByYear(2026).get(0)));
            System.out.println(getPlusTime2(getDatePeriodByYear(2026).get(1)));
        } catch (Exception ex) {
            ex.printStackTrace();
        }
server/dmmall_service/src/main/java/com/doumee/dao/system/vo/BusinessDataCountVO.java
@@ -22,11 +22,11 @@
    @ApiModelProperty(value = "统计维度名称")
    private String name;
    @ApiModelProperty(value = "统计列表数据")
    private List<CountDataVO> dataList;
    private List<Long> dataList;
    @ApiModelProperty(value = "横轴")
    private List<String> dateStrList;
    @ApiModelProperty(value = "统计列表数据2")
    private List<CountDataVO> dataList2;
    private List<BigDecimal> dataList2;
    @ApiModelProperty(value = "统计列表数据分类2")
    private List<String>  cateList;
    @ApiModelProperty(value = "统计列表数据3")
    private List<BigDecimal[]> numList;
    private List<CountDataVO>  cateList;
}
server/dmmall_service/src/main/java/com/doumee/dao/system/vo/CountDataVO.java
@@ -6,6 +6,7 @@
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
@Data
@ApiModel("经销商账户明细对象")
@@ -26,4 +27,6 @@
    private String name;
    @ApiModelProperty(value = "统计维度时间名称")
    private String dateStr;
    @ApiModelProperty(value = "销售额集合")
    private BigDecimal[] data;
}
server/dmmall_service/src/main/java/com/doumee/service/business/WorkbenchService.java
@@ -17,4 +17,7 @@
public interface WorkbenchService {
    BusinessDataCountVO businessData(CountDataDTO param);
    List<BusinessDataCountVO> shopRankList10(CountDataDTO param);
    List<BusinessDataCountVO> goodsRankList10(CountDataDTO param);
}
server/dmmall_service/src/main/java/com/doumee/service/business/impl/WorkbenchServiceImpl.java
@@ -45,6 +45,7 @@
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.*;
import java.util.stream.Collectors;
@@ -60,12 +61,71 @@
    private GoodsorderMapper goodsorderMapper;
    @Autowired
    private GoodsorderDetailMapper goodsorderDetailMapper;
    @Override
    public List<BusinessDataCountVO> shopRankList10(CountDataDTO param) {
        Date startDate = null,endDate = null;
        if(param.getYear()!=null && param.getMonth()!=null){
            List<Date> dList = DateUtil.getDatePeriodByYearAndMonth(param.getYear(),param.getMonth()-1);
            startDate = dList.get(0);
            endDate = dList.get(1);
        }else if(param.getYear()!=null && param.getMonth()==null){
            List<Date> dList = DateUtil.getDatePeriodByYear(param.getYear());
            startDate = dList.get(0);
            endDate = dList.get(1);
        }
        //统计订单销量和销售额集合
        List<BusinessDataCountVO> list1 =  goodsorderMapper.selectJoinList(BusinessDataCountVO.class,new MPJLambdaWrapper<Goodsorder>()
                .selectAs(Shop::getName,BusinessDataCountVO::getName)
                .select("(select count(distinct(t.member_id)) )",BusinessDataCountVO::getNum1)
                .select("(select count(t.id) )",BusinessDataCountVO::getNum)
                .select("(select sum(t.total_price) )",BusinessDataCountVO::getPrice)
                .leftJoin(Shop.class,Shop::getId,Goodsorder::getDistributionShopId)
                .ge(startDate!=null,Goodsorder::getCreateDate,startDate)
                .ne(endDate!=null,Goodsorder::getCreateDate,endDate)
                .eq(Goodsorder::getIsdeleted,Constants.ZERO)
                .in(Goodsorder::getStatus,Constants.OrderStatus.DONE.getKey(),Constants.OrderStatus.REFUND.getKey())
                .groupBy(Goodsorder::getDistributionShopId)
                .orderByDesc(Constants.equalsInteger(param.getType() ,0),"sum(t.total_price) ")
                .orderByDesc(Constants.equalsInteger(param.getType() ,1),"count(t.id) ")
                .orderByDesc(Constants.equalsInteger(param.getType() ,2),"count(distinct(t.member_id))")
                .last("limit 10")) ;
        return list1;
    }
    @Override
    public List<BusinessDataCountVO> goodsRankList10(CountDataDTO param) {
        Date startDate = null,endDate = null;
        if(param.getYear()!=null && param.getMonth()!=null){
            List<Date> dList = DateUtil.getDatePeriodByYearAndMonth(param.getYear(),param.getMonth()-1);
            startDate = dList.get(0);
            endDate = dList.get(1);
        }else if(param.getYear()!=null && param.getMonth()==null){
            List<Date> dList = DateUtil.getDatePeriodByYear(param.getYear());
            startDate = dList.get(0);
            endDate = dList.get(1);
        }
        //统计订单销量和销售额集合
        List<BusinessDataCountVO> list1 =  goodsorderDetailMapper.selectJoinList(BusinessDataCountVO.class,new MPJLambdaWrapper<GoodsorderDetail>()
                .selectAs(Goods::getName,BusinessDataCountVO::getName)
                .select("(select sum(t.goods_num) )",BusinessDataCountVO::getNum)
                .select("(select  sum(ifnull(t.price,0) * ifnull(t.goods_num,0)))",BusinessDataCountVO::getPrice)
                .leftJoin(Goodsorder.class,Goodsorder::getId,GoodsorderDetail::getOrderId)
                .leftJoin(Goods.class,Goods::getId,GoodsorderDetail::getGoodsId)
                .ge(startDate!=null,Goodsorder::getCreateDate,startDate)
                .ne(endDate!=null,Goodsorder::getCreateDate,endDate)
                .eq(Goodsorder::getIsdeleted,Constants.ZERO)
                .in(Goodsorder::getStatus,Constants.OrderStatus.DONE.getKey(),Constants.OrderStatus.REFUND.getKey())
                .groupBy(GoodsorderDetail::getGoodsId)
                .orderByDesc(Constants.equalsInteger(param.getType() ,1),"sum(ifnull(t.price,0) * ifnull(t.goods_num,0)) ")
                .orderByDesc(Constants.equalsInteger(param.getType() ,0),"sum(t.goods_num) ")
                .last("limit 10")) ;
        return list1;
    }
    @Override
    public BusinessDataCountVO businessData(CountDataDTO param) {
        BusinessDataCountVO data = new BusinessDataCountVO();
        int dataType = param.getDateType();//0今日 1近七日 2近30日 3近1年
        String name = "HOUR(CREATE_DATE)";
        String name = "HOUR(t.CREATE_DATE)";
        List<String> dateList = new ArrayList<>();
        Date date = Utils.Date.getEnd(new Date());//今日 23:59:59
        Date startDate = DateUtil.addDaysToDate(date,-1);
@@ -73,22 +133,23 @@
            case 1: {
                name = "DATE_FORMAT(t.CREATE_DATE, '%Y-%m-%d')";
                for(int i=1;i<=7;i++){
                    dateList.add(DateUtil.getPlusTime2(DateUtil.addDaysToDate(date,7-i)));
                    dateList.add(DateUtil.getShortTime(DateUtil.addDaysToDate(date,i-7)));
                }
                startDate = DateUtil.addDaysToDate(date,7);
                startDate = DateUtil.addDaysToDate(date,-7);
                break;
            } case 2: {
                name = "DATE_FORMAT(GoodsCREATE_DATE, '%Y-%m-%d')";
                name = "DATE_FORMAT(t.CREATE_DATE, '%Y-%m-%d')";
                for(int i=1;i<=30;i++){
                    dateList.add(DateUtil.getPlusTime2(DateUtil.addDaysToDate(date,30-i)));
                    dateList.add(DateUtil.getShortTime(DateUtil.addDaysToDate(date,i-30)));
                }
                startDate = DateUtil.addDaysToDate(date,30);
                startDate = DateUtil.addDaysToDate(date,-30);
                break;
            } case 3: {
                startDate = DateUtil.increaseMonth(date,-12);
                name = "DATE_FORMAT(GoodsCREATE_DATE, '%Y-%m')";
                LocalDate now = LocalDate.now();
                startDate = DateUtil.increaseYear(date,-1);
                name = "DATE_FORMAT(t.CREATE_DATE, '%Y-%m')";
                for(int i=1;i<=12;i++){
                    dateList.add(DateUtil.getPlusTime2(DateUtil.increaseMonth(date,12-i)));
                    dateList.add(DateUtil.minusMonthToDate(now,12-i));
                }
                break;
            } default:{
@@ -98,10 +159,12 @@
                break;
            }
        }
        data.setDateStrList(dateList);
        //订单销量
        CountDataVO r =  goodsorderMapper.selectJoinOne(CountDataVO.class,new MPJLambdaWrapper<Goodsorder>()
                        .select("(select count(t.id) )",CountDataVO::getNum)
                        .select("(select sum(t.totalPrice) )",CountDataVO::getPrice)
                        .select("(select sum(t.total_Price) )",CountDataVO::getPrice)
                .ge(Goodsorder::getCreateDate,startDate)
                .eq(Goodsorder::getIsdeleted,Constants.ZERO)
                .in(Goodsorder::getStatus,Constants.OrderStatus.DONE.getKey(),Constants.OrderStatus.REFUND.getKey()) );
@@ -112,7 +175,7 @@
        //退款统计
        CountDataVO r1 =  goodsorderMapper.selectJoinOne(CountDataVO.class,new MPJLambdaWrapper<Goodsorder>()
                        .select("(select count(t.id) )",CountDataVO::getNum)
                        .select("(select sum(t.reundMoney) )",CountDataVO::getPrice)
                        .select("(select sum(t.refund_money) )",CountDataVO::getPrice)
                .ge(Goodsorder::getRefundTime,startDate)
                .eq(Goodsorder::getIsdeleted,Constants.ZERO)
                .in(Goodsorder::getStatus,Constants.OrderStatus.REFUND.getKey())  );
@@ -127,76 +190,77 @@
        List<CountDataVO> list1 =  goodsorderMapper.selectJoinList(CountDataVO.class,new MPJLambdaWrapper<Goodsorder>()
                .select("(select "+name+")",CountDataVO::getDateStr)
                .select("(select count(t.id) )",CountDataVO::getNum)
                .select("(select sum(t.totalPrice) )",CountDataVO::getPrice)
                .ge(Goodsorder::getRefundTime,startDate)
                .select("(select sum(t.total_price) )",CountDataVO::getPrice)
                .ge(Goodsorder::getCreateDate,startDate)
                .eq(Goodsorder::getIsdeleted,Constants.ZERO)
                .in(Goodsorder::getStatus,Constants.OrderStatus.DONE.getKey(),Constants.OrderStatus.REFUND.getKey())
                .groupBy(name) );
        List<CountDataVO> datalist1 = new ArrayList<>();
        List<Long> datalist1 = new ArrayList<>();
        List<BigDecimal> datalistPrice = new ArrayList<>();
        for(String str : dateList){
            CountDataVO tmp = new CountDataVO();
            tmp.setDateStr(str);
            tmp.setNum(0l);
            tmp.setPrice(new BigDecimal(0));
            long tnum =0;
            BigDecimal tprice = new BigDecimal(0);
            if(list1!=null){
                for(CountDataVO p : list1){
                    if(StringUtils.equals(p.getDateStr(),str)){
                        tmp.setNum(Constants.formatLongNum(p.getNum()));
                        tmp.setPrice(Constants.formatBigdecimal(p.getPrice()));
                        tnum =(Constants.formatLongNum(p.getNum()));
                        tprice = (Constants.formatBigdecimal(p.getPrice()));
                        break;
                    }
                }
            }
            datalist1.add(tmp);
            datalist1.add( tnum );
            datalistPrice.add(tprice);
        }
        data.setDataList(datalist1 );
        data.setDataList2(datalistPrice );
        String name1 =name.replace("t.","t3.");
        //统计各类商品数据集合
        List<CountDataVO> list2 =  goodsorderDetailMapper.selectJoinList(CountDataVO.class,new MPJLambdaWrapper<GoodsorderDetail>()
                .select("(select "+name+")",CountDataVO::getDateStr)
                .select("(select "+name1+")",CountDataVO::getDateStr)
                .selectAs(Labels::getName,CountDataVO::getName)
                .select("(select sum(t.totalPrice) )",CountDataVO::getPrice)
                 .leftJoin(Goods.class,Goods::getId,GoodsorderDetail::getGoodsId)
                 .leftJoin(Labels.class,Labels::getId,Goods::getCategoryId)
                 .leftJoin(Goodsorder.class,Goodsorder::getId,GoodsorderDetail::getOrderId)
                .ge(Goodsorder::getRefundTime,startDate)
                .select("(select sum(ifnull(t.price,0) * ifnull(t.goods_num,0)) )",CountDataVO::getPrice)
                .leftJoin(Goods.class,Goods::getId,GoodsorderDetail::getGoodsId)
                .leftJoin(Labels.class,Labels::getId,Goods::getCategoryId)
                .leftJoin(Goodsorder.class,Goodsorder::getId,GoodsorderDetail::getOrderId)
                .ge(Goodsorder::getCreateDate,startDate)
                .eq(Goodsorder::getIsdeleted,Constants.ZERO)
                .in(Goodsorder::getStatus,Constants.OrderStatus.DONE.getKey(),Constants.OrderStatus.REFUND.getKey())
                .groupBy(name +",t2.category_id"));
                .groupBy(name1+",t1.category_id"));
        List<BigDecimal[]> datalist2 = new ArrayList<>();
        List<String> cateList = getCateListFromDataList(list2);
        List<CountDataVO> cateList = getCateListFromDataList(list2);
        if(list2!=null &&list2.size()>0 && cateList!=null && cateList.size()>0){
            BigDecimal[] temp = new BigDecimal[dateList.size()];
            for(String cate : cateList){
            for(CountDataVO cate : cateList){
                for(int i=0;i<dateList.size();i++){
                    temp[i] = new BigDecimal(0);
                    for(CountDataVO model : list2){
                        if(StringUtils.equals(model.getDateStr(),dateList.get(i)) && StringUtils.equals(model.getName(),cate)){
                            temp[i] = temp[i].add(Constants.formatBigdecimal(model.getPrice()));
                        if(StringUtils.equals(model.getDateStr(),dateList.get(i)) && StringUtils.equals(model.getName(),cate.getName())){
                            temp[i] = Constants.formatBigdecimal(model.getPrice());
                        }
                    }
                }
                datalist2.add(temp);
                cate.setData(temp);
            }
        }
        data.setCateList(cateList);
        data.setNumList(datalist2 );
        return data;
    }
    private List<String> getCateListFromDataList(List<CountDataVO> list2) {
        List<String> list = new ArrayList<>();
    private List<CountDataVO> getCateListFromDataList(List<CountDataVO> list2) {
        List<CountDataVO> list = new ArrayList<>();
        for(CountDataVO model :list2){
            boolean isnew = true;
            for(String str :list){
                if(StringUtils.equals(str,model.getName())){
            for(CountDataVO str :list){
                if(StringUtils.equals(str.getName(),model.getName())){
                    isnew = false;
                }
            }
            if(isnew ){
                list.add(model.getName());
                list.add(model);
            }
        }
        return list;