From c2b44a985d16842ba73c1b6e213a653013a7157a Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期一, 09 十月 2023 17:03:39 +0800
Subject: [PATCH] 修復bug
---
/dev/null | 33 -----------
server/services/src/main/java/com/doumee/service/business/impl/PricingRuleServiceImpl.java | 3 -
server/services/src/main/java/com/doumee/core/constants/Constants.java | 1
server/services/src/main/java/com/doumee/dao/business/model/Goodsorder.java | 14 ++++
server/platform/src/main/java/com/doumee/api/business/GoodsorderController.java | 7 ++
server/services/src/main/java/com/doumee/dao/business/model/Refund.java | 10 ++-
server/services/src/main/java/com/doumee/dao/business/vo/GoodsorderTotalDataVO.java | 39 +++++++++++++
server/services/src/main/java/com/doumee/service/business/GoodsorderService.java | 3 +
server/services/src/main/java/com/doumee/service/business/impl/GoodsorderServiceImpl.java | 53 +++++++++++++++++
9 files changed, 123 insertions(+), 40 deletions(-)
diff --git a/server/platform/src/main/java/com/doumee/api/business/GoodsorderController.java b/server/platform/src/main/java/com/doumee/api/business/GoodsorderController.java
index 1fa11a5..46e2aa6 100644
--- a/server/platform/src/main/java/com/doumee/api/business/GoodsorderController.java
+++ b/server/platform/src/main/java/com/doumee/api/business/GoodsorderController.java
@@ -7,6 +7,7 @@
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
import com.doumee.dao.business.model.Goodsorder;
+import com.doumee.dao.business.vo.GoodsorderTotalDataVO;
import com.doumee.service.business.GoodsorderService;
import com.doumee.service.business.GoodsorderService;
import io.swagger.annotations.Api;
@@ -76,6 +77,12 @@
public ApiResponse<PageData<Goodsorder>> findPage (@RequestBody PageWrap<Goodsorder> pageWrap) {
return ApiResponse.success(goodsorderService.findPage(pageWrap));
}
+ @ApiOperation("绾夸笂浜ゆ槗姹囨�绘暟鎹帴鍙�")
+ @PostMapping("/getTotalData")
+ @RequiresPermissions("business:goodsorder:query")
+ public ApiResponse<GoodsorderTotalDataVO> getTotalData (@RequestBody Goodsorder pageWrap) {
+ return ApiResponse.success(goodsorderService.getTotalData(pageWrap));
+ }
@ApiOperation("瀵煎嚭Excel")
@PostMapping("/exportExcel")
diff --git a/server/services/src/main/java/com/doumee/core/constants/Constants.java b/server/services/src/main/java/com/doumee/core/constants/Constants.java
index 7549ff2..f2ecde0 100644
--- a/server/services/src/main/java/com/doumee/core/constants/Constants.java
+++ b/server/services/src/main/java/com/doumee/core/constants/Constants.java
@@ -58,6 +58,7 @@
public interface transactionsType{
int deposit =0;
int consumption =1;
+
int refund =2;
int platformRefund = 3;
}
diff --git a/server/services/src/main/java/com/doumee/dao/business/model/Goodsorder.java b/server/services/src/main/java/com/doumee/dao/business/model/Goodsorder.java
index 64dd2eb..4d2c14c 100644
--- a/server/services/src/main/java/com/doumee/dao/business/model/Goodsorder.java
+++ b/server/services/src/main/java/com/doumee/dao/business/model/Goodsorder.java
@@ -122,4 +122,18 @@
@ApiModelProperty(value = "缁撶畻绫诲瀷 0鑷姩缁撶畻 1骞冲彴浜哄伐缁撶畻 2绯荤粺鑷姩缁撶畻")
@ExcelColumn(name="缁撶畻绫诲瀷 0鑷姩缁撶畻 1骞冲彴浜哄伐缁撶畻 2绯荤粺鑷姩缁撶畻")
private Integer closeType;
+
+
+
+ @ApiModelProperty(value = "鏌ヨ寮�濮嬫棩鏈燂紙鍖呭惈锛�", example = "2023-10-01 15:12:01")
+ @TableField(exist = false)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private Date startDate;
+ @ApiModelProperty(value = "鏌ヨ鎴鏃ユ湡锛堝寘鍚級", example = "2023-10-09 15:12:05")
+ @TableField(exist = false)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private Date endDate;
+ @ApiModelProperty(value = "浜ゆ槗绗旀暟", example = "0")
+ @TableField(exist = false)
+ private int countNum;
}
diff --git a/server/services/src/main/java/com/doumee/dao/business/model/Refund.java b/server/services/src/main/java/com/doumee/dao/business/model/Refund.java
index c328599..d7e8d5f 100644
--- a/server/services/src/main/java/com/doumee/dao/business/model/Refund.java
+++ b/server/services/src/main/java/com/doumee/dao/business/model/Refund.java
@@ -1,12 +1,9 @@
package com.doumee.dao.business.model;
-import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.*;
import com.doumee.core.annotation.excel.ExcelColumn;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
@@ -98,4 +95,9 @@
@ExcelColumn(name="閫�娆惧師鍥�")
private String reason;
+
+ @ApiModelProperty(value = "浜ゆ槗绗旀暟", example = "0")
+ @TableField(exist = false)
+ private int countNum;
+
}
diff --git a/server/services/src/main/java/com/doumee/dao/business/vo/GoodsorderTotalDataVO.java b/server/services/src/main/java/com/doumee/dao/business/vo/GoodsorderTotalDataVO.java
new file mode 100644
index 0000000..e432c59
--- /dev/null
+++ b/server/services/src/main/java/com/doumee/dao/business/vo/GoodsorderTotalDataVO.java
@@ -0,0 +1,39 @@
+package com.doumee.dao.business.vo;
+
+import com.doumee.dao.system.model.SystemDepartment;
+import com.doumee.dao.system.model.SystemUser;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * @author Eva.Caesar Liu
+ * @date 2022/03/15 09:54
+ */
+@Data
+@ApiModel("绾夸笂浜ゆ槗姹囨�荤粺璁″璞¤繑鍥�")
+public class GoodsorderTotalDataVO {
+
+ @ApiModelProperty(value = "鏀粯鎶奸噾",example = "0")
+ private BigDecimal payMoney;
+ @ApiModelProperty(value = "鏀粯浜ゆ槗绗旀暟",example = "0")
+ private int payNum;
+
+ @ApiModelProperty(value = "閫�娆�",example = "0")
+ private BigDecimal refundMoney;
+ @ApiModelProperty(value = "閫�娆剧瑪鏁�",example = "0")
+ private int refundNum;
+
+ @ApiModelProperty(value = "鏈粨绠�",example = "0")
+ private BigDecimal unClosedMoney;
+ @ApiModelProperty(value = "鏈粨绠楃瑪鏁�",example = "0")
+ private int unClosedNum;
+
+ @ApiModelProperty(value = "缁撶畻鏀跺叆",example = "0")
+ private BigDecimal closedMoney;
+ @ApiModelProperty(value = "缁撶畻鏀跺叆绗旀暟",example = "0")
+ private int closedNum;
+}
diff --git a/server/services/src/main/java/com/doumee/dao/business/vo/WxBillDetailTotalVO.java b/server/services/src/main/java/com/doumee/dao/business/vo/WxBillDetailTotalVO.java
deleted file mode 100644
index 245d376..0000000
--- a/server/services/src/main/java/com/doumee/dao/business/vo/WxBillDetailTotalVO.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.doumee.dao.business.vo;
-
-import com.doumee.dao.system.model.SystemDepartment;
-import com.doumee.dao.system.model.SystemUser;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import java.util.List;
-
-/**
- * @author Eva.Caesar Liu
- * @date 2022/03/15 09:54
- */
-@Data
-@ApiModel("寰俊瀵硅处鏄庣粏缁熻瀵硅薄杩斿洖")
-public class WxBillDetailTotalVO extends SystemDepartment {
-
- @ApiModelProperty(value = "閮ㄩ棬浜烘暟")
- private long userCount;
-
- @ApiModelProperty(value = "瀛愰儴闂ㄥ垪琛�")
- private List<WxBillDetailTotalVO> children;
-
- @ApiModelProperty(value = "鏄惁鍖呭惈瀛愰儴闂�")
- private Boolean hasChildren;
-
- @ApiModelProperty(value = "鍒涘缓浜轰俊鎭�")
- private SystemUser createUserInfo;
-
- @ApiModelProperty(value = "鏇存柊浜轰俊鎭�")
- private SystemUser updateUserInfo;
-}
diff --git a/server/services/src/main/java/com/doumee/service/business/GoodsorderService.java b/server/services/src/main/java/com/doumee/service/business/GoodsorderService.java
index 6941ae7..b33930c 100644
--- a/server/services/src/main/java/com/doumee/service/business/GoodsorderService.java
+++ b/server/services/src/main/java/com/doumee/service/business/GoodsorderService.java
@@ -5,6 +5,7 @@
import com.doumee.core.model.PageWrap;
import com.doumee.dao.business.model.Bikes;
import com.doumee.dao.business.model.Goodsorder;
+import com.doumee.dao.business.vo.GoodsorderTotalDataVO;
import com.doumee.dao.business.web.response.HomeResponse;
import com.doumee.dao.business.web.response.GoodsorderDetailDTO;
import com.doumee.dao.business.web.response.RidesDetailResponse;
@@ -143,4 +144,6 @@
RidesDetailResponse getRidesDetailResponse(String id);
+
+ GoodsorderTotalDataVO getTotalData(Goodsorder pageWrap);
}
diff --git a/server/services/src/main/java/com/doumee/service/business/impl/GoodsorderServiceImpl.java b/server/services/src/main/java/com/doumee/service/business/impl/GoodsorderServiceImpl.java
index ca87427..2245919 100644
--- a/server/services/src/main/java/com/doumee/service/business/impl/GoodsorderServiceImpl.java
+++ b/server/services/src/main/java/com/doumee/service/business/impl/GoodsorderServiceImpl.java
@@ -23,6 +23,7 @@
import com.doumee.dao.business.model.Goodsorder;
import com.doumee.dao.business.model.Member;
import com.doumee.dao.business.model.MemberRides;
+import com.doumee.dao.business.vo.GoodsorderTotalDataVO;
import com.doumee.dao.business.web.response.*;
import com.doumee.dao.business.join.MemberRidesJoinMapper;
import com.doumee.dao.business.model.*;
@@ -341,7 +342,59 @@
}
}
+ @Override
+ public GoodsorderTotalDataVO getTotalData(Goodsorder param){
+ GoodsorderTotalDataVO model = new GoodsorderTotalDataVO();
+ model.setPayMoney(new BigDecimal(0.00));
+ model.setRefundMoney(new BigDecimal(0.00));
+ model.setClosedMoney(new BigDecimal(0.00));
+ model.setUnClosedMoney(new BigDecimal(0.00));
+ model.setClosedNum(0);
+ model.setUnClosedNum(0);
+ model.setPayNum(0);
+ model.setRefundNum(0);
+ QueryWrapper<Goodsorder> queryWrapper = new QueryWrapper<>();
+ queryWrapper.lambda().ge(param.getStartDate() !=null,Goodsorder::getPayDate,DateUtil.getShortDateStr(param.getStartDate()));
+ queryWrapper.lambda().le(param.getEndDate() !=null,Goodsorder::getPayDate,DateUtil.getShortDateStr(param.getEndDate()));
+ queryWrapper.lambda().eq(Goodsorder::getPayStatus, Constants.ONE);//宸叉敮浠�
+ queryWrapper.lambda().eq(Goodsorder::getIsdeleted, Constants.ZERO);
+ queryWrapper.lambda().groupBy(Goodsorder::getStatus);
+ queryWrapper.select( "count(id) as count_num"
+ ,"sum(money) as money" );
+ //鎸夎鍗曠姸鎬佸垎缁勭粺璁�
+ List<Goodsorder> detailList = goodsorderMapper.selectList(queryWrapper);
+ for(Goodsorder goodsorder : detailList){
+ if(Constants.formatIntegerNum(goodsorder.getStatus()) == Constants.GOODSORDER_STATUS.CLOSE.getKey()){
+ //宸茬粨绠�
+ model.setClosedNum(model.getClosedNum()+goodsorder.getCountNum());
+ model.setClosedMoney(model.getClosedMoney().add(Constants.formatDecimalNum(goodsorder.getCloseMoney())));
+
+ model.setPayNum(model.getPayNum()+goodsorder.getCountNum());
+ model.setPayMoney(model.getPayMoney().add(Constants.formatDecimalNum(goodsorder.getMoney())));
+ }else if(Constants.formatIntegerNum(goodsorder.getStatus()) == Constants.GOODSORDER_STATUS.HAVING_PAY.getKey()){
+ //宸叉敮浠樻湭缁撶畻
+ model.setUnClosedNum(model.getUnClosedNum()+goodsorder.getCountNum());
+ model.setUnClosedMoney(model.getUnClosedMoney().add(Constants.formatDecimalNum(goodsorder.getMoney())));
+
+ model.setPayNum(model.getPayNum()+goodsorder.getCountNum());
+ model.setPayMoney(model.getPayMoney().add(Constants.formatDecimalNum(goodsorder.getMoney())));
+ }
+ }
+ QueryWrapper<Refund> queryWrapper2 = new QueryWrapper<>();
+ queryWrapper2.lambda().ge(param.getStartDate() !=null,Refund::getDoneDate,DateUtil.getShortDateStr(param.getStartDate()));
+ queryWrapper2.lambda().le(param.getEndDate() !=null,Refund::getDoneDate,DateUtil.getShortDateStr(param.getEndDate()));
+ queryWrapper2.lambda().eq(Refund::getIsdeleted, Constants.ZERO);
+ queryWrapper2.select( "count(id) as count_num"
+ ,"sum(money) as money" );
+ //缁熻閫�娆炬暟鎹�
+ Refund refund = refundMapper.selectOne(queryWrapper2.last("limit 1"));
+ if(refund !=null){
+ model.setRefundNum(Constants.formatIntegerNum(refund.getCountNum()));
+ model.setRefundMoney( Constants.formatDecimalNum(refund.getMoney()));
+ }
+ return model;
+ }
@Override
public RidesDetailResponse getRidesDetailResponse(String id) {
diff --git a/server/services/src/main/java/com/doumee/service/business/impl/PricingRuleServiceImpl.java b/server/services/src/main/java/com/doumee/service/business/impl/PricingRuleServiceImpl.java
index 91a34ba..1b294d1 100644
--- a/server/services/src/main/java/com/doumee/service/business/impl/PricingRuleServiceImpl.java
+++ b/server/services/src/main/java/com/doumee/service/business/impl/PricingRuleServiceImpl.java
@@ -34,9 +34,6 @@
@Autowired
PricingParamMapper pricingParamMapper;
- @Autowired
- PricingDetailMapper pricingParamMapper;
-
@Autowired
MemberRidesMapper memberRidesMapper;
--
Gitblit v1.9.3