mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-04 18:10:10 +08:00
Merge branch 'master' into dev
# Conflicts: # jsowell-pile/src/main/java/com/jsowell/pile/service/impl/SettleOrderReportServiceImpl.java
This commit is contained in:
@@ -33,6 +33,7 @@ import com.jsowell.pile.service.OrderSplitRecordService;
|
||||
import com.jsowell.pile.service.PileMerchantInfoService;
|
||||
import com.jsowell.pile.vo.OrderInfoDetailVO;
|
||||
import com.jsowell.pile.vo.web.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -42,6 +43,7 @@ import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class OrderSplitRecordServiceImpl implements OrderSplitRecordService {
|
||||
|
||||
@@ -158,7 +160,19 @@ public class OrderSplitRecordServiceImpl implements OrderSplitRecordService {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
// 根据入参拉出时间段内所有订单的分账记录
|
||||
return orderSplitRecordMapper.queryOrderSplitDataList(merchantId, stationId, startTime, endTime);
|
||||
List<OrderSplitRecord> orderSplitRecords = orderSplitRecordMapper.queryOrderSplitDataList(merchantId, stationId, startTime, endTime);
|
||||
log.info("根据入参拉出时间段内所有订单的分账记录, merchantId:{}, stationId:{}, startTime:{}, endTime:{}",
|
||||
merchantId, stationId, startTime, endTime);
|
||||
// orderSplitRecords中电费分账金额与服务费分账金额为null, 设置0
|
||||
for (OrderSplitRecord orderSplitRecord : orderSplitRecords) {
|
||||
if (orderSplitRecord.getElectricitySplitAmount() == null) {
|
||||
orderSplitRecord.setElectricitySplitAmount(BigDecimal.ZERO);
|
||||
}
|
||||
if (orderSplitRecord.getServiceSplitAmount() == null) {
|
||||
orderSplitRecord.setServiceSplitAmount(BigDecimal.ZERO);
|
||||
}
|
||||
}
|
||||
return orderSplitRecords;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -680,7 +680,8 @@ public class SettleOrderReportServiceImpl implements SettleOrderReportService {
|
||||
log.info("站点:{}, 在{}-{}查询到订单数据{}条,订单编号:{}", stationInfo.getStationName(), startTime, endTime, orderListVOS.size(), collect);
|
||||
|
||||
// 根据入参拉出时间段内所有订单的分账记录
|
||||
List<OrderSplitRecord> orderSplitRecords = orderSplitRecordService.queryOrderSplitRecordList(stationInfo.getMerchantId(), stationId, startTime, endTime);
|
||||
List<OrderSplitRecord> orderSplitRecords = orderSplitRecordService.queryOrderSplitRecordList(stationInfo.getMerchantId(), stationId, tradeDate, tradeDate);
|
||||
log.info("查分账记录,站点:{}, 在{}-{}查询到分账数据{}条", stationInfo.getStationName(), startTime, endTime, orderSplitRecords.size());
|
||||
// orderSplitRecords转为map, key为订单编号, value为分账记录
|
||||
Map<String, OrderSplitRecord> splitRecordMap = orderSplitRecords.stream().collect(Collectors.toMap(OrderSplitRecord::getOrderCode, v -> v));
|
||||
|
||||
@@ -741,16 +742,21 @@ public class SettleOrderReportServiceImpl implements SettleOrderReportService {
|
||||
|
||||
// 电费金额, 如果splitRecordMap中存在,取Rrecord.getElectricitySplitAmount(), 如果不存在取vo.getTotalElectricityAmount()
|
||||
OrderSplitRecord record = splitRecordMap.get(vo.getOrderCode());
|
||||
BigDecimal electricityAmount = record != null
|
||||
? record.getElectricitySplitAmount()
|
||||
: vo.getTotalElectricityAmount() != null ? vo.getTotalElectricityAmount() : BigDecimal.ZERO;
|
||||
BigDecimal electricityAmount;
|
||||
BigDecimal serviceAmount;
|
||||
// BigDecimal e = vo.getTotalElectricityAmount() != null ? vo.getTotalElectricityAmount() : BigDecimal.ZERO;
|
||||
if (record != null) {
|
||||
electricityAmount = record.getElectricitySplitAmount() != null ? record.getElectricitySplitAmount() : BigDecimal.ZERO;
|
||||
serviceAmount = record.getServiceSplitAmount() != null ? record.getServiceSplitAmount() : BigDecimal.ZERO;
|
||||
log.info("record订单编号:{}, 订单金额:{}, 电费金额:{}, 服务费金额:{}", vo.getOrderCode(), orderAmount, electricityAmount, serviceAmount);
|
||||
} else {
|
||||
electricityAmount = vo.getTotalElectricityAmount() != null ? vo.getTotalElectricityAmount() : BigDecimal.ZERO;
|
||||
serviceAmount = vo.getTotalServiceAmount() != null ? vo.getTotalServiceAmount() : BigDecimal.ZERO;
|
||||
log.info("vo订单编号:{}, 订单金额:{}, 电费金额:{}, 服务费金额:{}", vo.getOrderCode(), orderAmount, electricityAmount, serviceAmount);
|
||||
}
|
||||
totalElectricityAmount = totalElectricityAmount.add(electricityAmount);
|
||||
|
||||
// 服务费金额,如果splitRecordMap中存在,取Rrecord.getElectricitySplitAmount(), 如果不存在取vo.getTotalElectricityAmount()
|
||||
BigDecimal serviceAmount = record != null
|
||||
? record.getServiceSplitAmount()
|
||||
: vo.getTotalServiceAmount() != null ? vo.getTotalServiceAmount() : BigDecimal.ZERO;
|
||||
// BigDecimal serviceAmount = vo.getTotalServiceAmount() != null ? vo.getTotalServiceAmount() : BigDecimal.ZERO;
|
||||
totalServiceAmount = totalServiceAmount.add(serviceAmount);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user