From e91b530517c049686ca01daf1e78b1aea26fccfb Mon Sep 17 00:00:00 2001 From: Lemon Date: Tue, 11 Aug 2026 16:01:02 +0800 Subject: [PATCH] =?UTF-8?q?bugfix=20=E8=BF=90=E8=90=A5=E7=AB=AF=E5=B0=8F?= =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E6=8E=A5=E5=8F=A3=E6=9D=83=E9=99=90=E6=8E=A7?= =?UTF-8?q?=E5=88=B6=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessConnectorInfoController.java | 46 ++++++++-- .../business/BusinessFinancialController.java | 64 ++++++++++++++ .../BusinessStationInfoController.java | 65 ++++++++++---- .../core/controller/BaseController.java | 4 + .../impl/BusinessFinancialServiceImpl.java | 88 +++++++++---------- .../impl/PileConnectorInfoServiceImpl.java | 3 +- 6 files changed, 201 insertions(+), 69 deletions(-) diff --git a/jsowell-admin/src/main/java/com/jsowell/api/uniapp/business/BusinessConnectorInfoController.java b/jsowell-admin/src/main/java/com/jsowell/api/uniapp/business/BusinessConnectorInfoController.java index 14f46dea5..a97604911 100644 --- a/jsowell-admin/src/main/java/com/jsowell/api/uniapp/business/BusinessConnectorInfoController.java +++ b/jsowell-admin/src/main/java/com/jsowell/api/uniapp/business/BusinessConnectorInfoController.java @@ -2,12 +2,18 @@ package com.jsowell.api.uniapp.business; import com.alibaba.fastjson2.JSONObject; import com.google.common.collect.ImmutableMap; +import com.google.common.collect.Lists; import com.jsowell.common.core.controller.BaseController; +import com.jsowell.common.core.domain.AjaxResult; +import com.jsowell.common.core.domain.vo.AuthorizedDeptVO; import com.jsowell.common.core.page.PageResponse; import com.jsowell.common.response.RestApiResponse; +import com.jsowell.common.util.SecurityUtils; +import com.jsowell.pile.domain.PileMerchantInfo; import com.jsowell.pile.dto.business.QueryConnectorInfoDTO; import com.jsowell.pile.service.OrderBasicInfoService; import com.jsowell.pile.service.PileConnectorInfoService; +import com.jsowell.pile.service.PileMerchantInfoService; import com.jsowell.pile.service.PileStationInfoService; import com.jsowell.pile.util.UserUtils; import com.jsowell.pile.vo.base.ConnectorInfoVO; @@ -19,8 +25,10 @@ import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; /** * 运营端小程序枪口信息相关controller @@ -38,6 +46,36 @@ public class BusinessConnectorInfoController extends BaseController { @Autowired private PileStationInfoService pileStationInfoService; + @Autowired + private PileMerchantInfoService pileMerchantInfoService; + + + /** + * 鉴权返回stationIdList + */ + public List getStationIdListByAuthorization() { + // 权限过滤 + AuthorizedDeptVO authorizedMap = UserUtils.getAuthorizedMap(); + if (authorizedMap == null) { + // 为空表示没有权限,返回空数组 + return new ArrayList<>(); + } + String deptId = authorizedMap.getDeptId(); + if (CollectionUtils.isNotEmpty(authorizedMap.getStationDeptIds())) { + // 为站点管理员 + return pileStationInfoService.getIdsByDeptId(deptId); + }else { + // 平台管理员或运营商管理员 + // 根据部门id查询merchantId + PileMerchantInfo pileMerchantInfo = pileMerchantInfoService.queryInfoByDeptId(deptId); + if (pileMerchantInfo != null) { + // 根据merchantId查询stationIdList + return pileStationInfoService.getStationIdsByMerchantIds(Lists.newArrayList(String.valueOf(pileMerchantInfo.getId()))); + } + } + return new ArrayList<>(); + } + /** * 获取枪口信息列表 * @param dto @@ -47,11 +85,9 @@ public class BusinessConnectorInfoController extends BaseController { public RestApiResponse getBusinessConnectorInfoList(@RequestBody QueryConnectorInfoDTO dto) { RestApiResponse response = null; try { - // 获取登录账号信息 - LoginUserDetailVO loginUserDetail = UserUtils.getLoginUserDetail(); - List merchantIdList = loginUserDetail.getFirstMerchantIdList(); - if (CollectionUtils.isEmpty(dto.getStationIds())) { - dto.setStationIds(pileStationInfoService.getStationIdsByMerchantIds(merchantIdList)); + List stationIdList = getStationIdListByAuthorization(); + if (CollectionUtils.isNotEmpty(stationIdList)) { + dto.setStationIds(stationIdList); } PageResponse pageResponse = pileConnectorInfoService.getConnectorListByStationAndStatus(dto); response = new RestApiResponse<>(ImmutableMap.of("pageResponse", pageResponse)); diff --git a/jsowell-admin/src/main/java/com/jsowell/api/uniapp/business/BusinessFinancialController.java b/jsowell-admin/src/main/java/com/jsowell/api/uniapp/business/BusinessFinancialController.java index bd85052d5..01b472b0c 100644 --- a/jsowell-admin/src/main/java/com/jsowell/api/uniapp/business/BusinessFinancialController.java +++ b/jsowell-admin/src/main/java/com/jsowell/api/uniapp/business/BusinessFinancialController.java @@ -2,12 +2,15 @@ package com.jsowell.api.uniapp.business; import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONObject; +import com.google.common.collect.Lists; import com.jsowell.common.core.controller.BaseController; +import com.jsowell.common.core.domain.vo.AuthorizedDeptVO; import com.jsowell.common.core.page.PageResponse; import com.jsowell.common.enums.ykc.ReturnCodeEnum; import com.jsowell.common.exception.BusinessException; import com.jsowell.common.response.RestApiResponse; import com.google.common.collect.ImmutableMap; +import com.jsowell.pile.domain.PileMerchantInfo; import com.jsowell.pile.dto.IndexQueryDTO; import com.jsowell.pile.dto.MerchantOrderReportDTO; import com.jsowell.pile.dto.ParkingCouponRecordQueryDTO; @@ -16,6 +19,9 @@ import com.jsowell.pile.dto.business.BusinessEfficiencyQueryDTO; import com.jsowell.pile.dto.business.BusinessOperationAnalysisQueryDTO; import com.jsowell.pile.dto.business.BusinessScaleQueryDTO; import com.jsowell.pile.dto.business.BusinessWorkbenchSummaryQueryDTO; +import com.jsowell.pile.service.PileMerchantInfoService; +import com.jsowell.pile.service.PileStationInfoService; +import com.jsowell.pile.util.UserUtils; import com.jsowell.pile.vo.uniapp.business.BusinessDailySettlementDetailVO; import com.jsowell.pile.service.BusinessFinancialService; import com.jsowell.pile.service.OrderBasicInfoService; @@ -27,6 +33,7 @@ import com.jsowell.pile.vo.uniapp.business.BusinessScaleVO; import com.jsowell.pile.vo.uniapp.business.BusinessWorkbenchSummaryVO; import com.jsowell.pile.vo.web.MerchantOrderReportVO; import com.jsowell.pile.vo.web.TimeDistributionVO; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -34,6 +41,7 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.ArrayList; import java.util.List; /** @@ -51,6 +59,38 @@ public class BusinessFinancialController extends BaseController { @Autowired private OrderBasicInfoService orderBasicInfoService; + @Autowired + private PileStationInfoService pileStationInfoService; + + @Autowired + private PileMerchantInfoService pileMerchantInfoService; + + /** + * 鉴权返回stationIdList + */ + public List getStationIdListByAuthorization() { + // 权限过滤 + AuthorizedDeptVO authorizedMap = UserUtils.getAuthorizedMap(); + if (authorizedMap == null) { + // 为空表示没有权限,返回空数组 + return new ArrayList<>(); + } + String deptId = authorizedMap.getDeptId(); + if (CollectionUtils.isNotEmpty(authorizedMap.getStationDeptIds())) { + // 为站点管理员 + return pileStationInfoService.getIdsByDeptId(deptId); + }else { + // 平台管理员或运营商管理员 + // 根据部门id查询merchantId + PileMerchantInfo pileMerchantInfo = pileMerchantInfoService.queryInfoByDeptId(deptId); + if (pileMerchantInfo != null) { + // 根据merchantId查询stationIdList + return pileStationInfoService.getStationIdsByMerchantIds(Lists.newArrayList(String.valueOf(pileMerchantInfo.getId()))); + } + } + return new ArrayList<>(); + } + /** * 查询工作台首页汇总 * @@ -62,6 +102,10 @@ public class BusinessFinancialController extends BaseController { logger.info("查询工作台首页汇总 params:{}", JSONObject.toJSONString(dto)); RestApiResponse response; try { + List stationIdList = getStationIdListByAuthorization(); + if (CollectionUtils.isNotEmpty(stationIdList)) { + dto.setStationIdList(stationIdList); + } BusinessWorkbenchSummaryVO result = businessFinancialService.getWorkbenchSummary(dto); response = new RestApiResponse<>(result); logger.info("查询工作台首页汇总成功 today:{}, stationCount:{}", @@ -90,6 +134,10 @@ public class BusinessFinancialController extends BaseController { if (dto == null) { throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR); } + List stationIdList = getStationIdListByAuthorization(); + if (CollectionUtils.isNotEmpty(stationIdList)) { + dto.setStationIdList(stationIdList); + } BusinessDailySettlementDetailVO result = businessFinancialService.getDailySettlementDetail(dto); response = new RestApiResponse<>(result); logger.info("查询结算日报详情成功 startTime:{}, endTime:{}", @@ -177,6 +225,10 @@ public class BusinessFinancialController extends BaseController { if (dto == null) { throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR); } + List stationIdList = getStationIdListByAuthorization(); + if (CollectionUtils.isNotEmpty(stationIdList)) { + dto.setStationIdList(stationIdList); + } BusinessOperationAnalysisVO result = businessFinancialService.getBusinessOperationAnalysis(dto); response = new RestApiResponse<>(result); logger.info("查询经营分析成功 startTime:{}, endTime:{}, selectedMetricCode:{}", @@ -205,6 +257,10 @@ public class BusinessFinancialController extends BaseController { if (dto == null) { throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR); } + List stationIdList = getStationIdListByAuthorization(); + if (CollectionUtils.isNotEmpty(stationIdList)) { + dto.setStationIdList(stationIdList); + } BusinessScaleVO result = businessFinancialService.getBusinessScale(dto); response = new RestApiResponse<>(result); logger.info("查询经营规模成功 startTime:{}, endTime:{}, selectedMetricCode:{}", @@ -261,6 +317,10 @@ public class BusinessFinancialController extends BaseController { if (dto == null) { throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR); } + List stationIdList = getStationIdListByAuthorization(); + if (CollectionUtils.isNotEmpty(stationIdList)) { + dto.setStationIdList(stationIdList); + } BusinessEfficiencyAnalysisVO result = businessFinancialService.getEfficiencyAnalysis(dto); response = new RestApiResponse<>(result); logger.info("查询效率分析成功 startTime:{}, endTime:{}", @@ -289,6 +349,10 @@ public class BusinessFinancialController extends BaseController { if (dto == null) { throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR); } + List stationIdList = getStationIdListByAuthorization(); + if (CollectionUtils.isNotEmpty(stationIdList)) { + dto.setStationIdList(stationIdList); + } PageResponse pageResponse = businessFinancialService.getStationOrderRank(dto); response = new RestApiResponse<>(ImmutableMap.of("pageResponse", pageResponse)); logger.info("查询场站订单排行成功 startTime:{}, endTime:{}, total:{}", diff --git a/jsowell-admin/src/main/java/com/jsowell/api/uniapp/business/BusinessStationInfoController.java b/jsowell-admin/src/main/java/com/jsowell/api/uniapp/business/BusinessStationInfoController.java index 69d15afc6..662cd3d26 100644 --- a/jsowell-admin/src/main/java/com/jsowell/api/uniapp/business/BusinessStationInfoController.java +++ b/jsowell-admin/src/main/java/com/jsowell/api/uniapp/business/BusinessStationInfoController.java @@ -2,15 +2,19 @@ package com.jsowell.api.uniapp.business; import com.alibaba.fastjson2.JSONObject; import com.google.common.collect.ImmutableMap; +import com.google.common.collect.Lists; import com.jsowell.common.core.controller.BaseController; +import com.jsowell.common.core.domain.vo.AuthorizedDeptVO; import com.jsowell.common.core.page.TableDataInfo; import com.jsowell.common.exception.BusinessException; import com.jsowell.common.response.RestApiResponse; import com.jsowell.common.util.StringUtils; +import com.jsowell.pile.domain.PileMerchantInfo; import com.jsowell.pile.dto.QueryStationDTO; import com.jsowell.pile.dto.business.StationBusinessAnalyzeInfoDTO; import com.jsowell.pile.dto.business.StationStatisticsInfoDTO; import com.jsowell.pile.service.OrderBasicInfoService; +import com.jsowell.pile.service.PileMerchantInfoService; import com.jsowell.pile.service.PileStationInfoService; import com.jsowell.pile.util.UserUtils; import com.jsowell.pile.vo.base.LoginUserDetailVO; @@ -22,6 +26,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; +import java.util.ArrayList; import java.util.List; /** @@ -40,6 +45,36 @@ public class BusinessStationInfoController extends BaseController { @Autowired private OrderBasicInfoService orderBasicInfoService; + @Autowired + private PileMerchantInfoService pileMerchantInfoService; + + /** + * 鉴权返回stationIdList + */ + public List getStationIdListByAuthorization() { + // 权限过滤 + AuthorizedDeptVO authorizedMap = UserUtils.getAuthorizedMap(); + if (authorizedMap == null) { + // 为空表示没有权限,返回空数组 + return new ArrayList<>(); + } + String deptId = authorizedMap.getDeptId(); + if (CollectionUtils.isNotEmpty(authorizedMap.getStationDeptIds())) { + // 为站点管理员 + return pileStationInfoService.getIdsByDeptId(deptId); + }else { + // 平台管理员或运营商管理员 + // 根据部门id查询merchantId + PileMerchantInfo pileMerchantInfo = pileMerchantInfoService.queryInfoByDeptId(deptId); + if (pileMerchantInfo != null) { + // 根据merchantId查询stationIdList + return pileStationInfoService.getStationIdsByMerchantIds(Lists.newArrayList(String.valueOf(pileMerchantInfo.getId()))); + } + } + return new ArrayList<>(); + } + + /** @@ -68,10 +103,9 @@ public class BusinessStationInfoController extends BaseController { try { // List stationStatisticsInfos = pileStationInfoService.getStationStatisticsInfos(dto); // 获取登录账号信息 - LoginUserDetailVO loginUserDetail = UserUtils.getLoginUserDetail(); - List merchantIdList = loginUserDetail.getFirstMerchantIdList(); - if (CollectionUtils.isEmpty(dto.getStationIds())) { - dto.setStationIds(pileStationInfoService.getStationIdsByMerchantIds(merchantIdList)); + List stationIdList = getStationIdListByAuthorization(); + if (CollectionUtils.isNotEmpty(stationIdList)) { + dto.setStationIds(stationIdList); } StationStatisticsInfosVO info = pileStationInfoService.getStationStatisticsInfosV2(dto); response = new RestApiResponse<>(ImmutableMap.of("stationStatisticsInfo", info)); @@ -94,10 +128,9 @@ public class BusinessStationInfoController extends BaseController { RestApiResponse response = null; try { // 获取登录账号信息 - LoginUserDetailVO loginUserDetail = UserUtils.getLoginUserDetail(); - List merchantIdList = loginUserDetail.getFirstMerchantIdList(); - if (CollectionUtils.isEmpty(dto.getStationIds())) { - dto.setStationIds(pileStationInfoService.getStationIdsByMerchantIds(merchantIdList)); + List stationIdList = getStationIdListByAuthorization(); + if (CollectionUtils.isNotEmpty(stationIdList)) { + dto.setStationIds(stationIdList); } StationBusinessAnalyzeInfoVO vo = pileStationInfoService.getStationBusinessAnalyzeInfo(dto); response = new RestApiResponse<>(ImmutableMap.of("stationBusinessAnalyzeInfoVO", vo)); @@ -161,11 +194,9 @@ public class BusinessStationInfoController extends BaseController { public RestApiResponse getStationOrderQuantityInfo(@RequestBody StationBusinessAnalyzeInfoDTO dto) { RestApiResponse response = null; try { - // 获取登录账号信息 - LoginUserDetailVO loginUserDetail = UserUtils.getLoginUserDetail(); - List merchantIdList = loginUserDetail.getFirstMerchantIdList(); - if (CollectionUtils.isEmpty(dto.getStationIds())) { - dto.setStationIds(pileStationInfoService.getStationIdsByMerchantIds(merchantIdList)); + List stationIdList = getStationIdListByAuthorization(); + if (CollectionUtils.isNotEmpty(stationIdList)) { + dto.setStationIds(stationIdList); } StationBusinessAnalyzeInfoVO vo = pileStationInfoService.getStationOrderQuantityInfo(dto); response = new RestApiResponse<>(ImmutableMap.of("stationBusinessAnalyzeInfoVO", vo)); @@ -185,11 +216,9 @@ public class BusinessStationInfoController extends BaseController { public RestApiResponse getStationConnectorUsedInfo(@RequestBody StationBusinessAnalyzeInfoDTO dto) { RestApiResponse response = null; try { - // 获取登录账号信息 - LoginUserDetailVO loginUserDetail = UserUtils.getLoginUserDetail(); - List merchantIdList = loginUserDetail.getFirstMerchantIdList(); - if (CollectionUtils.isEmpty(dto.getStationIds())) { - dto.setStationIds(pileStationInfoService.getStationIdsByMerchantIds(merchantIdList)); + List stationIdList = getStationIdListByAuthorization(); + if (CollectionUtils.isNotEmpty(stationIdList)) { + dto.setStationIds(stationIdList); } StationBusinessAnalyzeInfoVO vo = pileStationInfoService.getStationConnectorUsedInfo(dto); response = new RestApiResponse<>(ImmutableMap.of("stationBusinessAnalyzeInfoVO", vo)); diff --git a/jsowell-common/src/main/java/com/jsowell/common/core/controller/BaseController.java b/jsowell-common/src/main/java/com/jsowell/common/core/controller/BaseController.java index c1b804902..20caac742 100644 --- a/jsowell-common/src/main/java/com/jsowell/common/core/controller/BaseController.java +++ b/jsowell-common/src/main/java/com/jsowell/common/core/controller/BaseController.java @@ -2,9 +2,11 @@ package com.jsowell.common.core.controller; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +import com.google.common.collect.ImmutableMap; import com.jsowell.common.constant.HttpStatus; import com.jsowell.common.core.domain.AjaxResult; import com.jsowell.common.core.domain.model.LoginUser; +import com.jsowell.common.core.domain.vo.AuthorizedDeptVO; import com.jsowell.common.core.page.PageDomain; import com.jsowell.common.core.page.PageResponse; import com.jsowell.common.core.page.TableDataInfo; @@ -13,6 +15,7 @@ import com.jsowell.common.enums.ykc.ReturnCodeEnum; import com.jsowell.common.exception.BusinessException; import com.jsowell.common.util.*; import com.jsowell.common.util.sql.SqlUtil; +import org.apache.commons.collections4.CollectionUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.bind.WebDataBinder; @@ -22,6 +25,7 @@ import javax.servlet.http.HttpServletRequest; import java.beans.PropertyEditorSupport; import java.util.Date; import java.util.List; +import java.util.Objects; /** * web层通用数据处理 diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/BusinessFinancialServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/BusinessFinancialServiceImpl.java index 05f32d311..7328f6ce3 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/BusinessFinancialServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/BusinessFinancialServiceImpl.java @@ -153,19 +153,18 @@ public class BusinessFinancialServiceImpl implements BusinessFinancialService { String todayDate = today.toString(); String recentStartTime = today.minusDays(6).toString(); String recentEndTime = todayDate; - - FinancialScope scope = resolveFinancialScope(dto.getStationIdList()); + List stationIdList = dto.getStationIdList(); CompletableFuture todayOrderCountFuture = CompletableFuture.supplyAsync( - () -> countTodayOrderCount(scope.getStationIdList(), todayDate), FINANCIAL_THREAD_POOL); + () -> countTodayOrderCount(stationIdList, todayDate), FINANCIAL_THREAD_POOL); CompletableFuture> recentReportsFuture = CompletableFuture.supplyAsync( - () -> queryRawReports(scope.getStationIdList(), recentStartTime, recentEndTime), FINANCIAL_THREAD_POOL); + () -> queryRawReports(stationIdList, recentStartTime, recentEndTime), FINANCIAL_THREAD_POOL); List recentReports = recentReportsFuture.join(); ReportSummary recentSummary = buildReportSummary(recentReports); ReportSummary todaySummary = buildReportSummary(recentReports, todayDate); Long todayOrderCount = todayOrderCountFuture.join(); - Integer pendingParkingAppealCount = countPendingParkingAppeal(scope.getStationIdList()); + Integer pendingParkingAppealCount = countPendingParkingAppeal(stationIdList); List cardList = new ArrayList<>(); cardList.add(buildWorkbenchCard(WORKBENCH_CARD_ORDER_MANAGEMENT, "订单管理", "今日订单量", @@ -183,9 +182,9 @@ public class BusinessFinancialServiceImpl implements BusinessFinancialService { .today(todayDate) .recentStartTime(recentStartTime) .recentEndTime(recentEndTime) - .merchantIdList(scope.getMerchantIdList()) - .stationIdList(scope.getStationIdList()) - .stationCount(scope.getStationIdList() != null ? scope.getStationIdList().size() : null) + // .merchantIdList(scope.getMerchantIdList()) + .stationIdList(stationIdList) + .stationCount(stationIdList.size()) .todayOrderCount(todayOrderCount) .recentNetCashFlow(formatMoney(recentSummary.getOrderTotalAmount())) .todayArrivalAmount(formatMoney(todaySummary.getArrivalAmount())) @@ -205,8 +204,7 @@ public class BusinessFinancialServiceImpl implements BusinessFinancialService { public BusinessDailySettlementDetailVO getDailySettlementDetail(BusinessDailySettlementQueryDTO dto) { validateDailySettlementQuery(dto); - FinancialScope scope = resolveFinancialScope(dto.getStationIdList()); - List reportList = queryRawReports(scope.getStationIdList(), dto.getStartTime(), dto.getEndTime()); + List reportList = queryRawReports(dto.getStationIdList(), dto.getStartTime(), dto.getEndTime()); ReportSummary summary = buildReportSummary(reportList); List incomeItems = new ArrayList<>(); @@ -219,8 +217,8 @@ public class BusinessFinancialServiceImpl implements BusinessFinancialService { return BusinessDailySettlementDetailVO.builder() .startTime(dto.getStartTime()) .endTime(dto.getEndTime()) - .merchantIdList(scope.getMerchantIdList()) - .stationCount(scope.getStationIdList() != null ? scope.getStationIdList().size() : null) + // .merchantIdList(scope.getMerchantIdList()) + .stationCount(dto.getStationIdList().size()) .settlementAmount(formatMoney(summary.getSettlementAmount())) .totalOrderCount(BigDecimalUtils.normalize(summary.getTotalOrderCount())) .orderTotalAmount(formatMoney(summary.getOrderTotalAmount())) @@ -368,7 +366,7 @@ public class BusinessFinancialServiceImpl implements BusinessFinancialService { } BusinessOperationDateRangeDTO range = buildDateRange(dto); - List stationIdList = resolveStationIds(dto.getStationIdList()); + List stationIdList = dto.getStationIdList(); // 并行查询当前周期和上周期原始数据 CompletableFuture> currentReportFuture = CompletableFuture.supplyAsync( @@ -421,7 +419,7 @@ public class BusinessFinancialServiceImpl implements BusinessFinancialService { } BusinessOperationDateRangeDTO range = buildDateRange(dto); - List stationIdList = resolveStationIds(dto.getStationIdList()); + List stationIdList = dto.getStationIdList(); // 并行查询订单汇总和枪口数量 CompletableFuture summaryFuture = CompletableFuture.supplyAsync( @@ -573,19 +571,19 @@ public class BusinessFinancialServiceImpl implements BusinessFinancialService { * @param stationIdList 前端传入站点ID列表 * @return 实际查询站点ID列表 */ - private List resolveStationIds(List stationIdList) { - List authorizedStationIds = getAuthorizedStationIds(); - if (authorizedStationIds == null) { - return CollectionUtils.isEmpty(stationIdList) ? null : stationIdList; - } - if (!CollectionUtils.isEmpty(stationIdList)) { - return stationIdList.stream() - .filter(authorizedStationIds::contains) - .distinct() - .collect(Collectors.toList()); - } - return authorizedStationIds; - } + // private List resolveStationIds(List stationIdList) { + // List authorizedStationIds = getAuthorizedStationIds(); + // if (authorizedStationIds == null) { + // return CollectionUtils.isEmpty(stationIdList) ? null : stationIdList; + // } + // if (!CollectionUtils.isEmpty(stationIdList)) { + // return stationIdList.stream() + // .filter(authorizedStationIds::contains) + // .distinct() + // .collect(Collectors.toList()); + // } + // return authorizedStationIds; + // } /** * 校验结算日报详情查询条件 @@ -614,20 +612,20 @@ public class BusinessFinancialServiceImpl implements BusinessFinancialService { /** * 解析财务接口通用账号和站点范围 */ - private FinancialScope resolveFinancialScope(List stationIdList) { - List merchantIdList = UserUtils.getFirstMerchantIdList(); - List queryStationIds = stationIdList; - if (CollectionUtils.isEmpty(queryStationIds)) { - if (CollectionUtils.isEmpty(merchantIdList)) { - return new FinancialScope(merchantIdList, Collections.emptyList()); - } - queryStationIds = pileStationInfoService.getStationIdsByMerchantIds(merchantIdList); - if (queryStationIds == null) { - queryStationIds = Collections.emptyList(); - } - } - return new FinancialScope(merchantIdList, resolveStationIds(queryStationIds)); - } + // private FinancialScope resolveFinancialScope(List stationIdList) { + // List merchantIdList = UserUtils.getFirstMerchantIdList(); + // List queryStationIds = stationIdList; + // if (CollectionUtils.isEmpty(queryStationIds)) { + // if (CollectionUtils.isEmpty(merchantIdList)) { + // return new FinancialScope(merchantIdList, Collections.emptyList()); + // } + // queryStationIds = pileStationInfoService.getStationIdsByMerchantIds(merchantIdList); + // if (queryStationIds == null) { + // queryStationIds = Collections.emptyList(); + // } + // } + // return new FinancialScope(merchantIdList, resolveStationIds(queryStationIds)); + // } /** * 统计今日订单量 @@ -920,7 +918,7 @@ public class BusinessFinancialServiceImpl implements BusinessFinancialService { } BusinessOperationDateRangeDTO range = buildDateRangeFromScale(dto); - List stationIdList = resolveStationIds(dto.getStationIdList()); + List stationIdList = dto.getStationIdList(); // 并行查询当前周期和上周期的原始报表数据,各只查一次 CompletableFuture> currentReportFuture = CompletableFuture.supplyAsync( @@ -1184,7 +1182,7 @@ public class BusinessFinancialServiceImpl implements BusinessFinancialService { dto.setEndTime(endDate.toString()); } - List stationIdList = resolveStationIds(dto.getStationIdList()); + List stationIdList = dto.getStationIdList(); // 并行查询订单汇总和枪口数量 CompletableFuture summaryFuture = CompletableFuture.supplyAsync( @@ -1287,7 +1285,7 @@ public class BusinessFinancialServiceImpl implements BusinessFinancialService { int pageNum = dto.getPageNum() != null && dto.getPageNum() > 0 ? dto.getPageNum() : 1; int pageSize = dto.getPageSize() != null && dto.getPageSize() > 0 ? dto.getPageSize() : 10; - List stationIdList = resolveStationIds(dto.getStationIdList()); + List stationIdList = dto.getStationIdList(); // 查询结算报表原始数据 List reportList = queryRawReports( @@ -1370,7 +1368,7 @@ public class BusinessFinancialServiceImpl implements BusinessFinancialService { } BusinessOperationDateRangeDTO range = buildDateRangeFromEfficiency(dto); - List stationIdList = resolveStationIds(dto.getStationIdList()); + List stationIdList = dto.getStationIdList(); // 并行查询当前周期和上周期原始报表数据 CompletableFuture> currentReportFuture = CompletableFuture.supplyAsync( diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileConnectorInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileConnectorInfoServiceImpl.java index 743e9cb61..733daec1f 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileConnectorInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileConnectorInfoServiceImpl.java @@ -1122,6 +1122,7 @@ public class PileConnectorInfoServiceImpl implements PileConnectorInfoService { * @param connectorStatus * @return */ + @Override public Map getConnectorStatusNum(List stationIds, String connectorStatus) { Map map = new LinkedHashMap<>(); List connectorInfoVOS = pileConnectorInfoMapper.batchSelectConnectorListByStatus(stationIds, connectorStatus); @@ -1162,7 +1163,7 @@ public class PileConnectorInfoServiceImpl implements PileConnectorInfoService { } } // 全部数量 - int totalNum = offlineNum + freeNum + occupiedNum + chargingNum + faultNum + hangingNum; + int totalNum = connectorInfoVOS.size(); map.put("totalNum", totalNum); map.put("offlineNum", offlineNum);