更新10.15
This commit is contained in:
parent
8433734694
commit
a63a74a8ec
@ -1873,8 +1873,14 @@ public class AllOrderInfoServiceImpl extends ServiceImpl<AllOrderInfoMapper, All
|
||||
List<OilNumber> oilNumbers = oilNumberMapper.selectAllOil(nowAccountInfo.getStoreId());
|
||||
List<String> oilNames = oilNumbers.stream().map(oil -> oil.getOilNames() + oil.getOilType()).collect(Collectors.toList());
|
||||
homeDataShowVo.setOilNames(oilNames);
|
||||
//根据开始时间与结束时间获取所有天数
|
||||
//判断开始时间减去结束时间是否大于等于一年
|
||||
List<String> days = getAllDatesBetween(startTime, endTime);
|
||||
Integer type = 0;
|
||||
if (DateUtil.between(DateUtil.parse(startTime), DateUtil.parse(endTime), DateUnit.DAY) >= 60) {
|
||||
days = getAllDatesBetweenYear(startTime, endTime);
|
||||
type = 1;
|
||||
}
|
||||
//根据开始时间与结束时间获取所有天数
|
||||
//查询所有订单
|
||||
DateTime dateTime2 = DateUtil.beginOfDay(DateUtil.parse(startTime));
|
||||
DateTime dateTime3 = DateUtil.endOfDay(DateUtil.parse(endTime));
|
||||
@ -1885,13 +1891,20 @@ public class AllOrderInfoServiceImpl extends ServiceImpl<AllOrderInfoMapper, All
|
||||
List<Map<String, Object>> oilData = new ArrayList<>();
|
||||
for (String day : days) {
|
||||
Map<String, Object> mapData = new HashMap<>();
|
||||
mapData.put("day", day);
|
||||
DateTime dateTime = new DateTime();
|
||||
DateTime dateTime1 = new DateTime();
|
||||
if (type == 1) {
|
||||
DateTime parse = DateUtil.parse(day);
|
||||
mapData.put("day", parse.toString("yyyy-MM"));
|
||||
dateTime = DateUtil.beginOfMonth(parse);
|
||||
dateTime1 = DateUtil.endOfMonth(parse);
|
||||
} else {
|
||||
mapData.put("day", day);
|
||||
dateTime = DateUtil.beginOfDay(DateUtil.parse(day));
|
||||
dateTime1 = DateUtil.endOfDay(dateTime);
|
||||
}
|
||||
List<Double> oilPrices = new ArrayList<>();
|
||||
DateTime dateTime = DateUtil.beginOfDay(DateUtil.parse(day));
|
||||
DateTime dateTime1 = DateUtil.endOfDay(dateTime);
|
||||
for (OilNumber oilNumber : oilNumbers) {
|
||||
//查询油品交易总金额
|
||||
// double price = oilOrderMapper.selectSumMoneyByDayAndOilNumber(oilNumber.getOilName(), day, nowAccountInfo.getStoreId());
|
||||
double price = calculateTotalPayAmount(oilOrders, dateTime, dateTime1, oilNumber.getOilName());
|
||||
oilPrices.add(price);
|
||||
}
|
||||
@ -1924,14 +1937,29 @@ public class AllOrderInfoServiceImpl extends ServiceImpl<AllOrderInfoMapper, All
|
||||
return dateList;
|
||||
}
|
||||
|
||||
public List<String> getAllDatesBetweenYear(String startTime, String endTime) {
|
||||
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
LocalDate startDate = LocalDate.parse(startTime, formatter);
|
||||
LocalDate endDate = LocalDate.parse(endTime, formatter);
|
||||
|
||||
List<String> dateList = new ArrayList<>();
|
||||
while (!startDate.isAfter(endDate)) {
|
||||
dateList.add(startDate.format(formatter));
|
||||
startDate = startDate.plusDays(30);
|
||||
}
|
||||
|
||||
return dateList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算指定支付时间范围和油品名称下的累计支付金额
|
||||
*
|
||||
* @param oilOrders OilOrder对象的集合
|
||||
* @param startTime 支付开始时间
|
||||
* @param endTime 支付结束时间
|
||||
* @param oilName 目标油品名称
|
||||
* @return 符合条件的累计支付金额
|
||||
* @param oilOrders OilOrder对象的集合
|
||||
* @param startTime 支付开始时间
|
||||
* @param endTime 支付结束时间
|
||||
* @param oilName 目标油品名称
|
||||
* @return 符合条件的累计支付金额
|
||||
*/
|
||||
public static double calculateTotalPayAmount(List<OilOrder> oilOrders, Date startTime, Date endTime, String oilName) {
|
||||
double totalPayAmount = 0.0;
|
||||
@ -2053,6 +2081,11 @@ public class AllOrderInfoServiceImpl extends ServiceImpl<AllOrderInfoMapper, All
|
||||
.between(AllOrderInfo::getPayTime, DateUtil.beginOfDay(DateUtil.parse(startTime)), DateUtil.endOfDay(DateUtil.parse(endTime))));
|
||||
|
||||
List<String> allDatesBetween = getAllDatesBetween(startTime, endTime);
|
||||
Integer type = 0;
|
||||
if (DateUtil.between(DateUtil.parse(startTime), DateUtil.parse(endTime), DateUnit.DAY) >= 60) {
|
||||
allDatesBetween = getAllDatesBetweenYear(startTime, endTime);
|
||||
type = 1;
|
||||
}
|
||||
|
||||
List<String> oilNames = new ArrayList<>();
|
||||
List<Map<String, Object>> oilData = new ArrayList<>();
|
||||
@ -2064,11 +2097,20 @@ public class AllOrderInfoServiceImpl extends ServiceImpl<AllOrderInfoMapper, All
|
||||
|
||||
//查询会员余额
|
||||
for (String time : allDatesBetween) {
|
||||
DateTime dateTime = DateUtil.beginOfDay(DateUtil.parse(time));
|
||||
DateTime dateTime1 = DateUtil.endOfDay(dateTime);
|
||||
Double memberBalance = allOrderInfoMapper.getCountMemberBalance(nowAccountInfo.getStoreId(), dateTime1.toString());
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("time", time);
|
||||
DateTime dateTime = new DateTime();
|
||||
DateTime dateTime1 = new DateTime();
|
||||
if (type == 1) {
|
||||
DateTime parse = DateUtil.parse(time);
|
||||
params.put("time", parse.toString("yyyy-MM"));
|
||||
dateTime = DateUtil.beginOfMonth(parse);
|
||||
dateTime1 = DateUtil.endOfMonth(parse);
|
||||
} else {
|
||||
params.put("time", time);
|
||||
dateTime = DateUtil.beginOfDay(DateUtil.parse(time));
|
||||
dateTime1 = DateUtil.endOfDay(dateTime);
|
||||
}
|
||||
Double memberBalance = allOrderInfoMapper.getCountMemberBalance(nowAccountInfo.getStoreId(), dateTime1.toString());
|
||||
List<Double> money = new ArrayList<>();
|
||||
//油品交易额
|
||||
List<AllOrderInfo> oilOrder = filterOrders(allOrderInfos, dateTime, dateTime1, "1", null, null);
|
||||
|
Loading…
Reference in New Issue
Block a user