Commit c8523cc3 authored by hanfeng's avatar hanfeng

Merge branch 'master-order-statistics' into dev

parents 4fd1b0f4 4b650145
......@@ -7,9 +7,9 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.xxfc.platform.order.contant.enumerate.AccountTypeEnum;
import com.xxfc.platform.order.contant.enumerate.DeductionTypeEnum;
import com.xxfc.platform.order.contant.enumerate.OrderTypeEnum;
import com.xxfc.platform.order.contant.enumerate.RefundTypeEnum;
import com.xxfc.platform.order.entity.DailyTravelOrderStatistics;
import com.xxfc.platform.order.entity.OrderAccount;
import com.xxfc.platform.order.entity.OrderStatistics;
......@@ -197,7 +197,7 @@ public class DailyTravelOrderStatisticsBiz extends BaseBiz<DailyTravelOrderStati
private void refundAndDeductions(Map<Integer, List<OrderAccountDTO>> map, DailyTravelOrderStatistics orderStatistics) {
ArrayList<OrderAccountDTO> arrayList = Lists.newArrayList();
for (Integer key : map.keySet()) {
if (!key.equals(RefundTypeEnum.ORDER_FUND.getCode())) {
if (!key.equals(AccountTypeEnum.IN_ORDER_PAY.getCode())) {
arrayList.addAll(map.get(key));
}
}
......@@ -222,7 +222,7 @@ public class DailyTravelOrderStatisticsBiz extends BaseBiz<DailyTravelOrderStati
private DailyTravelOrderStatistics getGmvAndSecurityDeposit(Map<Integer, List<OrderAccountDTO>> map) {
DailyTravelOrderStatistics orderStatistics = new DailyTravelOrderStatistics();
List<OrderAccountDTO> orderAccountDTOS = map.get(RefundTypeEnum.ORDER_FUND.getCode());
List<OrderAccountDTO> orderAccountDTOS = map.get(AccountTypeEnum.IN_ORDER_PAY.getCode());
if (CollectionUtils.isNotEmpty(orderAccountDTOS)) {
ArrayList<OrderAccountDetail> orderAccountDetails = getOrderAccountDetail(orderAccountDTOS);
......@@ -276,9 +276,7 @@ public class DailyTravelOrderStatisticsBiz extends BaseBiz<DailyTravelOrderStati
*/
private List<OrderAccountDeduction> gettDeductions(ArrayList<OrderAccountDetail> orderAccountDetails) {
ArrayList<OrderAccountDeduction> arrayList = Lists.newArrayList();
for (OrderAccountDetail orderAccountDetail : orderAccountDetails) {
arrayList.addAll(orderAccountDetail.getDeductions());
}
orderAccountDetails.parallelStream().map(OrderAccountDetail::getDeductions).forEach(e->arrayList.addAll(e));
return arrayList;
}
......@@ -286,14 +284,14 @@ public class DailyTravelOrderStatisticsBiz extends BaseBiz<DailyTravelOrderStati
/**
* 根据type获取对应的金额总和
*
* @param OrderAccountDeduction
* @param list
* @param type 金额类型
* @return
*/
private BigDecimal get(List<OrderAccountDeduction> OrderAccountDeduction, List<Integer> type) {
return OrderAccountDeduction.parallelStream()
.filter(el -> el.getType().equals(type))
.map(com.xxfc.platform.order.pojo.account.OrderAccountDeduction::getAmount)
private BigDecimal get(List<OrderAccountDeduction> list, List<Integer> type) {
return list.parallelStream()
.filter(el ->type.contains(el.getType()))
.map(OrderAccountDeduction::getAmount)
.reduce(BigDecimal.ZERO,BigDecimal::add);
}
......
......@@ -4,9 +4,9 @@ import cn.hutool.json.JSONUtil;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.xxfc.platform.order.contant.enumerate.AccountTypeEnum;
import com.xxfc.platform.order.contant.enumerate.DeductionTypeEnum;
import com.xxfc.platform.order.contant.enumerate.OrderTypeEnum;
import com.xxfc.platform.order.contant.enumerate.RefundTypeEnum;
import com.xxfc.platform.order.entity.DailyVehicleOrderStatistics;
import com.xxfc.platform.order.entity.OrderAccount;
import com.xxfc.platform.order.entity.OrderStatistics;
......@@ -208,14 +208,14 @@ public class DailyVehicleOrderStatisticsBiz extends BaseBiz<DailyVehicleOrderSta
/**
* 根据type获取对应的金额总和
*
* @param OrderAccountDeduction
* @param list
* @param types 金额类型
* @return
*/
private BigDecimal get(List<OrderAccountDeduction> OrderAccountDeduction, List<Integer> types) {
return OrderAccountDeduction.parallelStream()
.filter(el -> types.contains(el))
.map(com.xxfc.platform.order.pojo.account.OrderAccountDeduction::getAmount)
private BigDecimal get(List<OrderAccountDeduction> list, List<Integer> types) {
return list.parallelStream()
.filter(el -> types.contains(el.getType()))
.map(OrderAccountDeduction::getAmount)
.reduce(BigDecimal.ZERO,BigDecimal::add);
}
......@@ -342,7 +342,7 @@ public class DailyVehicleOrderStatisticsBiz extends BaseBiz<DailyVehicleOrderSta
private void refundAndDeductions(Map<Integer, List<OrderAccountDTO>> map, DailyVehicleOrderStatistics orderStatistics) {
ArrayList<OrderAccountDTO> arrayList = Lists.newArrayList();
for (Integer key : map.keySet()) {
if (!key.equals(RefundTypeEnum.ORDER_FUND.getCode())) {
if (!key.equals(AccountTypeEnum.IN_ORDER_PAY.getCode())) {
arrayList.addAll(map.get(key));
}
}
......@@ -387,7 +387,7 @@ public class DailyVehicleOrderStatisticsBiz extends BaseBiz<DailyVehicleOrderSta
*/
private DailyVehicleOrderStatistics getGmvAndSecurityDeposit(Map<Integer, List<OrderAccountDTO>> map) {
DailyVehicleOrderStatistics orderStatistics = new DailyVehicleOrderStatistics();
List<OrderAccountDTO> orderAccountDTOS = map.get(RefundTypeEnum.ORDER_FUND.getCode());
List<OrderAccountDTO> orderAccountDTOS = map.get(AccountTypeEnum.IN_ORDER_PAY.getCode());
if (CollectionUtils.isNotEmpty(orderAccountDTOS)) {
ArrayList<OrderAccountDetail> orderAccountDetails = getOrderAccountDetail(orderAccountDTOS);
......@@ -437,9 +437,7 @@ public class DailyVehicleOrderStatisticsBiz extends BaseBiz<DailyVehicleOrderSta
*/
private List<OrderAccountDeduction> gettDeductions(ArrayList<OrderAccountDetail> orderAccountDetails) {
ArrayList<OrderAccountDeduction> arrayList = Lists.newArrayList();
for (OrderAccountDetail orderAccountDetail : orderAccountDetails) {
arrayList.addAll(orderAccountDetail.getDeductions());
}
orderAccountDetails.parallelStream().map(OrderAccountDetail::getDeductions).forEach(e->arrayList.addAll(e));
return arrayList;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment