From 5c3391599e9becae40162fd8117b671f019343ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E5=85=81=E6=9E=9E?= <3422692813@qq.com> Date: Wed, 16 Oct 2024 12:38:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B010.16?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/FleetMemberServiceImpl.java | 7 ++-- .../service/impl/AllOrderInfoServiceImpl.java | 36 +++++++++++++++++-- 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/impl/FleetMemberServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/impl/FleetMemberServiceImpl.java index a19879f47..7f8b542a9 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/impl/FleetMemberServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/impl/FleetMemberServiceImpl.java @@ -128,18 +128,17 @@ public class FleetMemberServiceImpl extends ServiceImpl() .eq(FleetMember::getMobile, fleetMember.getMobile()) - .eq(FleetMember::getFleetId, fleetMember.getFleetId()) .last("limit 1")); if (ObjectUtil.isNotEmpty(fleetMember2)) { - throw new RuntimeException("该用户已加入该车队"); + throw new RuntimeException("该用户已绑定车队"); } // if (ObjectUtil.isNotEmpty(fleetMember1)) { // return 0; // } -// LJUserVo user = userService.selectUserByMobileAndChantStoreId(fleetMember.getMobile()); + //判断当前车队成员否存在账号 MtUser mtUser = mtUserMapper.selectOne(new LambdaQueryWrapper() .eq(MtUser::getMobile, fleetMember.getMobile()) diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/AllOrderInfoServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/AllOrderInfoServiceImpl.java index 0e48a7c43..d7aba0d1f 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/AllOrderInfoServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/AllOrderInfoServiceImpl.java @@ -1873,12 +1873,16 @@ public class AllOrderInfoServiceImpl extends ServiceImpl oilNumbers = oilNumberMapper.selectAllOil(nowAccountInfo.getStoreId()); List oilNames = oilNumbers.stream().map(oil -> oil.getOilNames() + oil.getOilType()).collect(Collectors.toList()); homeDataShowVo.setOilNames(oilNames); - //判断开始时间减去结束时间是否大于等于一年 + //判断开始时间减去结束时间是否大于等于60天 List 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; + //判断是否小于等于1天 + } else if (DateUtil.between(DateUtil.parse(startTime), DateUtil.parse(endTime), DateUnit.DAY) <= 1) { + days = getAllDatesBetweenDay(DateUtil.beginOfDay(DateUtil.parse(startTime)).toString(), DateUtil.endOfDay(DateUtil.parse(endTime)).toString()); + type = 2; } //根据开始时间与结束时间获取所有天数 //查询所有订单 @@ -1898,6 +1902,10 @@ public class AllOrderInfoServiceImpl extends ServiceImpl dateList = new ArrayList<>(); while (!startDate.isAfter(endDate)) { dateList.add(startDate.format(formatter)); - startDate = startDate.plusDays(30); + startDate = startDate.plusMonths(1); } return dateList; } + public List getAllDatesBetweenDay(String startTime, String endTime) { + + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + LocalDateTime startDate = LocalDateTime.parse(startTime, formatter); + LocalDateTime endDate = LocalDateTime.parse(endTime, formatter); + + List dateList = new ArrayList<>(); + while (!startDate.isAfter(endDate)) { + dateList.add(startDate.format(formatter)); + startDate = startDate.plusHours(1); + } + + + return dateList; + } + /** * 计算指定支付时间范围和油品名称下的累计支付金额 * @@ -2085,6 +2109,9 @@ public class AllOrderInfoServiceImpl extends ServiceImpl= 60) { allDatesBetween = getAllDatesBetweenYear(startTime, endTime); type = 1; + } else if (DateUtil.between(DateUtil.parse(startTime), DateUtil.parse(endTime), DateUnit.DAY) <= 1) { + allDatesBetween = getAllDatesBetweenDay(DateUtil.beginOfDay(DateUtil.parse(startTime)).toString(), DateUtil.endOfDay(DateUtil.parse(endTime)).toString()); + type = 2; } List oilNames = new ArrayList<>(); @@ -2105,6 +2132,11 @@ public class AllOrderInfoServiceImpl extends ServiceImpl