From fbdbb67c9de7a99398b5776435abb69352a11845 Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期一, 26 一月 2026 14:04:01 +0800
Subject: [PATCH] 经销商管理
---
server/dmmall_service/src/main/java/com/doumee/dao/system/vo/CountDataVO.java | 2
admin/src/views/index.vue | 27 ++++----
server/dmmall_service/src/main/java/com/doumee/dao/business/model/GoodsorderDetail.java | 3 +
server/dmmall_admin/src/main/java/com/doumee/api/business/WorkbenchController.java | 1
server/dmmall_service/src/main/java/com/doumee/service/business/impl/WorkbenchServiceImpl.java | 134 +++++++++++++++++++++++++++++++++++++++++---
admin/src/api/business/workbench.js | 7 ++
server/dmmall_service/src/main/java/com/doumee/dao/system/vo/BusinessDataCountVO.java | 6 +
7 files changed, 155 insertions(+), 25 deletions(-)
diff --git a/admin/src/api/business/workbench.js b/admin/src/api/business/workbench.js
new file mode 100644
index 0000000..c3890ff
--- /dev/null
+++ b/admin/src/api/business/workbench.js
@@ -0,0 +1,7 @@
+import request from '../../utils/request'
+
+export function allList (data) {
+ return request.post('/business/workbench/businessData', data, {
+ trim: true
+ })
+}
diff --git a/admin/src/views/index.vue b/admin/src/views/index.vue
index 4c935ce..44acdb1 100644
--- a/admin/src/views/index.vue
+++ b/admin/src/views/index.vue
@@ -145,9 +145,9 @@
},
data () {
return {
- tabs2: [{ index: 0, name: '鎸夐攢閲�' }, { index: 1, name: '鎸夐攢鍞' } ],
+ 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: '杩�1骞�' }],
+ tabs: [{ index: 0, name: '浠婃棩' }, { index: 1, name: '杩�7鏃�' }, { index: 2, name: '杩�30鏃�' }, { index: 3, name: '杩�12鏈�' }],
tabName: '浠婃棩',
tabIndex: 0,
tabIndex1: 0,
@@ -156,6 +156,9 @@
topYear:null,
topMonth:null,
topYear2:null,
+ },
+ topData:{
+
},
countData: {
totalPrice: 1000,
@@ -170,6 +173,14 @@
myChart0: null,
myChart1: null
}
+ },
+ created () {
+ this.config({
+ module: '宸ヤ綔鍙版暟鎹粺璁�',
+ api: '/business/workbench',
+ 'field.id': 'id',
+ 'field.main': 'id'
+ })
},
mounted () {
this.initCountData()
@@ -228,18 +239,6 @@
data: this.orderCorderCount
}]
})
- },
- changeCount (page) {
- if (page == 7) {
- this.orderCorderCount = [10, 10, 20, 10, 40, 10, 30]
- this.opinionData = ['3.20', '3.21', '3.22', '3.23', '3.24', '3.25', '3.26']
- } else {
- this.orderCorderCount = [11, 10, 20, 10, 40, 10, 30, 20, 10, 20, 10, 40, 10, 30, 10, 10, 20, 10, 40, 10, 30, 10, 10, 20, 10, 40, 10, 30, 20, 40]
- this.opinionData = ['3.01', '3.02', '3.03', '3.04', '3.05', '3.06', '3.07', '3.08', '3.09', '3.10', '3.11', '3.12', '3.13', '3.14', '3.15', '3.16', '3.17', '3.18', '3.19', '3.20', '3.21', '3.22', '3.23', '3.24', '3.25', '3.26', '3.27', '3.28', '3.28', '3.30']
- }
- // this.orderCorderCount.push(1)
- // this.opinionData.push(1)
- this.renderOrderChange()
}
}
}
diff --git a/server/dmmall_admin/src/main/java/com/doumee/api/business/WorkbenchController.java b/server/dmmall_admin/src/main/java/com/doumee/api/business/WorkbenchController.java
index 716c84b..9c8b21f 100644
--- a/server/dmmall_admin/src/main/java/com/doumee/api/business/WorkbenchController.java
+++ b/server/dmmall_admin/src/main/java/com/doumee/api/business/WorkbenchController.java
@@ -30,7 +30,6 @@
@PreventRepeat
@ApiOperation("鏂板缓")
@PostMapping("/businessData")
- @RequiresPermissions("business:fund:create")
public ApiResponse<BusinessDataCountVO> create(@RequestBody CountDataDTO param) {
return ApiResponse.success(workbenchService.businessData(param));
}
diff --git a/server/dmmall_service/src/main/java/com/doumee/dao/business/model/GoodsorderDetail.java b/server/dmmall_service/src/main/java/com/doumee/dao/business/model/GoodsorderDetail.java
index cc066a4..4284eac 100644
--- a/server/dmmall_service/src/main/java/com/doumee/dao/business/model/GoodsorderDetail.java
+++ b/server/dmmall_service/src/main/java/com/doumee/dao/business/model/GoodsorderDetail.java
@@ -55,6 +55,9 @@
@ApiModelProperty(value = "璁㈠崟缂栫爜锛堝叧鑱攇oodsorder琛級", example = "1")
@ExcelColumn(name="璁㈠崟缂栫爜锛堝叧鑱攇oodsorder琛級")
private Integer orderId;
+ @ApiModelProperty(value = "鍟嗗搧缂栫爜锛坓ooods琛級", example = "1")
+ @ExcelColumn(name="鍟嗗搧缂栫爜锛坓ooods琛級")
+ private Integer goodsId;
@ApiModelProperty(value = "SKU鍒楄〃鍥�")
@ExcelColumn(name="SKU鍒楄〃鍥�")
diff --git a/server/dmmall_service/src/main/java/com/doumee/dao/system/vo/BusinessDataCountVO.java b/server/dmmall_service/src/main/java/com/doumee/dao/system/vo/BusinessDataCountVO.java
index af8fa59..1b29b5a 100644
--- a/server/dmmall_service/src/main/java/com/doumee/dao/system/vo/BusinessDataCountVO.java
+++ b/server/dmmall_service/src/main/java/com/doumee/dao/system/vo/BusinessDataCountVO.java
@@ -14,7 +14,7 @@
@ApiModelProperty(value = "缁熻鏁伴噺(璁㈠崟鏁般�侀攢閲忋�佹秷鑰楃Н鍒嗛噺)")
private Long num;
@ApiModelProperty(value = "缁熻鏁伴噺2 (浼氬憳鏁帮級")
- private Long num2;
+ private Long num1;
@ApiModelProperty(value = "閿�鍞锛屼紭鎯犻噾棰�")
private BigDecimal price;
@ApiModelProperty(value = "閿�鍞锛屼績鎴愪氦鏄撻噾棰濋噾棰�")
@@ -25,4 +25,8 @@
private List<CountDataVO> dataList;
@ApiModelProperty(value = "缁熻鍒楄〃鏁版嵁2")
private List<CountDataVO> dataList2;
+ @ApiModelProperty(value = "缁熻鍒楄〃鏁版嵁鍒嗙被2")
+ private List<String> cateList;
+ @ApiModelProperty(value = "缁熻鍒楄〃鏁版嵁3")
+ private List<BigDecimal[]> numList;
}
diff --git a/server/dmmall_service/src/main/java/com/doumee/dao/system/vo/CountDataVO.java b/server/dmmall_service/src/main/java/com/doumee/dao/system/vo/CountDataVO.java
index be3d75e..ca7ef89 100644
--- a/server/dmmall_service/src/main/java/com/doumee/dao/system/vo/CountDataVO.java
+++ b/server/dmmall_service/src/main/java/com/doumee/dao/system/vo/CountDataVO.java
@@ -24,4 +24,6 @@
private BigDecimal price1;
@ApiModelProperty(value = "缁熻缁村害鍚嶇О")
private String name;
+ @ApiModelProperty(value = "缁熻缁村害鏃堕棿鍚嶇О")
+ private String dateStr;
}
diff --git a/server/dmmall_service/src/main/java/com/doumee/service/business/impl/WorkbenchServiceImpl.java b/server/dmmall_service/src/main/java/com/doumee/service/business/impl/WorkbenchServiceImpl.java
index 1b84f94..b619893 100644
--- a/server/dmmall_service/src/main/java/com/doumee/service/business/impl/WorkbenchServiceImpl.java
+++ b/server/dmmall_service/src/main/java/com/doumee/service/business/impl/WorkbenchServiceImpl.java
@@ -35,6 +35,7 @@
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
+import org.checkerframework.checker.units.qual.C;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
@@ -57,33 +58,148 @@
public class WorkbenchServiceImpl implements WorkbenchService {
@Autowired
private GoodsorderMapper goodsorderMapper;
+ @Autowired
+ private GoodsorderDetailMapper goodsorderDetailMapper;
@Override
public BusinessDataCountVO businessData(CountDataDTO param) {
BusinessDataCountVO data = new BusinessDataCountVO();
int dataType = param.getDateType();//0浠婃棩 1杩戜竷鏃� 2杩�30鏃� 3杩�1骞�
- int days = 1;
+ String name = "HOUR(CREATE_DATE)";
+ List<String> dateList = new ArrayList<>();
+ Date date = Utils.Date.getEnd(new Date());//浠婃棩 23:59:59
+ Date startDate = DateUtil.addDaysToDate(date,-1);
switch (dataType) {
case 1: {
- days = 7;
+ 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)));
+ }
+ startDate = DateUtil.addDaysToDate(date,7);
break;
} case 2: {
- days =30;
+ name = "DATE_FORMAT(GoodsCREATE_DATE, '%Y-%m-%d')";
+ for(int i=1;i<=30;i++){
+ dateList.add(DateUtil.getPlusTime2(DateUtil.addDaysToDate(date,30-i)));
+ }
+ startDate = DateUtil.addDaysToDate(date,30);
break;
} case 3: {
- days = 365;
+ startDate = DateUtil.increaseMonth(date,-12);
+ name = "DATE_FORMAT(GoodsCREATE_DATE, '%Y-%m')";
+ for(int i=1;i<=12;i++){
+ dateList.add(DateUtil.getPlusTime2(DateUtil.increaseMonth(date,12-i)));
+ }
break;
} default:{
-
+ for(int i=0;i<=23;i++){
+ dateList.add(i+"");
+ }
+ break;
}
}
- Date startDate = DateUtil.addDaysToDate(Utils.Date.getStart(new Date()),-days);
- CountDataVO r= goodsorderMapper.selectJoinOne(CountDataVO.class,new MPJLambdaWrapper<Goodsorder>()
+ //璁㈠崟閿�閲�
+ CountDataVO r = goodsorderMapper.selectJoinOne(CountDataVO.class,new MPJLambdaWrapper<Goodsorder>()
+ .select("(select count(t.id) )",CountDataVO::getNum)
+ .select("(select sum(t.totalPrice) )",CountDataVO::getPrice)
.ge(Goodsorder::getCreateDate,startDate)
- .in(Goodsorder::getStatus,Constants.OrderStatus.DONE.getKey(),Constants.OrderStatus.DONE.getKey())
- );
+ .eq(Goodsorder::getIsdeleted,Constants.ZERO)
+ .in(Goodsorder::getStatus,Constants.OrderStatus.DONE.getKey(),Constants.OrderStatus.REFUND.getKey()) );
+ if (r != null) {
+ data.setNum(Constants.formatLongNum(r.getNum()));//璁㈠崟閲�
+ data.setPrice(Constants.formatBigdecimal(r.getPrice()));//璁㈠崟閲戦
+ }
+ //閫�娆剧粺璁�
+ CountDataVO r1 = goodsorderMapper.selectJoinOne(CountDataVO.class,new MPJLambdaWrapper<Goodsorder>()
+ .select("(select count(t.id) )",CountDataVO::getNum)
+ .select("(select sum(t.reundMoney) )",CountDataVO::getPrice)
+ .ge(Goodsorder::getRefundTime,startDate)
+ .eq(Goodsorder::getIsdeleted,Constants.ZERO)
+ .in(Goodsorder::getStatus,Constants.OrderStatus.REFUND.getKey()) );
+
+ if (r1 != null) {
+ data.setNum1(Constants.formatLongNum(r1.getNum()));//閫�娆惧崟閲�
+ data.setPrice1(Constants.formatBigdecimal(r1.getPrice()));//閫�娆鹃噾棰�
+ }
+
+ //缁熻璁㈠崟閿�閲忓拰閿�鍞闆嗗悎
+ 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)
+ .eq(Goodsorder::getIsdeleted,Constants.ZERO)
+ .in(Goodsorder::getStatus,Constants.OrderStatus.DONE.getKey(),Constants.OrderStatus.REFUND.getKey())
+ .groupBy(name) );
+
+ List<CountDataVO> datalist1 = new ArrayList<>();
+ for(String str : dateList){
+ CountDataVO tmp = new CountDataVO();
+ tmp.setDateStr(str);
+ tmp.setNum(0l);
+ tmp.setPrice(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()));
+ }
+ }
+ }
+ datalist1.add(tmp);
+ }
+ data.setDataList(datalist1 );
+
+ //缁熻鍚勭被鍟嗗搧鏁版嵁闆嗗悎
+ List<CountDataVO> list2 = goodsorderDetailMapper.selectJoinList(CountDataVO.class,new MPJLambdaWrapper<GoodsorderDetail>()
+ .select("(select "+name+")",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)
+ .eq(Goodsorder::getIsdeleted,Constants.ZERO)
+ .in(Goodsorder::getStatus,Constants.OrderStatus.DONE.getKey(),Constants.OrderStatus.REFUND.getKey())
+ .groupBy(name +",t2.category_id"));
+
+ List<BigDecimal[]> datalist2 = new ArrayList<>();
+ List<String> 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(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()));
+ }
+ }
+ }
+ datalist2.add(temp);
+ }
+ }
+ data.setCateList(cateList);
+ data.setNumList(datalist2 );
return data;
}
+ private List<String> getCateListFromDataList(List<CountDataVO> list2) {
+ List<String> list = new ArrayList<>();
+ for(CountDataVO model :list2){
+ boolean isnew = true;
+ for(String str :list){
+ if(StringUtils.equals(str,model.getName())){
+ isnew = false;
+ }
+
+ }
+ if(isnew ){
+ list.add(model.getName());
+ }
+ }
+ return list;
+ }
+
}
--
Gitblit v1.9.3