bugfix 运营端小程序接口权限控制优化

This commit is contained in:
Lemon
2026-08-11 16:01:02 +08:00
parent 33b48f2ad4
commit e91b530517
6 changed files with 201 additions and 69 deletions

View File

@@ -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<String> 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<String> merchantIdList = loginUserDetail.getFirstMerchantIdList();
if (CollectionUtils.isEmpty(dto.getStationIds())) {
dto.setStationIds(pileStationInfoService.getStationIdsByMerchantIds(merchantIdList));
List<String> stationIdList = getStationIdListByAuthorization();
if (CollectionUtils.isNotEmpty(stationIdList)) {
dto.setStationIds(stationIdList);
}
PageResponse pageResponse = pileConnectorInfoService.getConnectorListByStationAndStatus(dto);
response = new RestApiResponse<>(ImmutableMap.of("pageResponse", pageResponse));

View File

@@ -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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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:{}",

View File

@@ -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<String> 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<StationStatisticsInfosVO> stationStatisticsInfos = pileStationInfoService.getStationStatisticsInfos(dto);
// 获取登录账号信息
LoginUserDetailVO loginUserDetail = UserUtils.getLoginUserDetail();
List<String> merchantIdList = loginUserDetail.getFirstMerchantIdList();
if (CollectionUtils.isEmpty(dto.getStationIds())) {
dto.setStationIds(pileStationInfoService.getStationIdsByMerchantIds(merchantIdList));
List<String> 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<String> merchantIdList = loginUserDetail.getFirstMerchantIdList();
if (CollectionUtils.isEmpty(dto.getStationIds())) {
dto.setStationIds(pileStationInfoService.getStationIdsByMerchantIds(merchantIdList));
List<String> 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<String> merchantIdList = loginUserDetail.getFirstMerchantIdList();
if (CollectionUtils.isEmpty(dto.getStationIds())) {
dto.setStationIds(pileStationInfoService.getStationIdsByMerchantIds(merchantIdList));
List<String> 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<String> merchantIdList = loginUserDetail.getFirstMerchantIdList();
if (CollectionUtils.isEmpty(dto.getStationIds())) {
dto.setStationIds(pileStationInfoService.getStationIdsByMerchantIds(merchantIdList));
List<String> stationIdList = getStationIdListByAuthorization();
if (CollectionUtils.isNotEmpty(stationIdList)) {
dto.setStationIds(stationIdList);
}
StationBusinessAnalyzeInfoVO vo = pileStationInfoService.getStationConnectorUsedInfo(dto);
response = new RestApiResponse<>(ImmutableMap.of("stationBusinessAnalyzeInfoVO", vo));

View File

@@ -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层通用数据处理

View File

@@ -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<String> stationIdList = dto.getStationIdList();
CompletableFuture<Long> todayOrderCountFuture = CompletableFuture.supplyAsync(
() -> countTodayOrderCount(scope.getStationIdList(), todayDate), FINANCIAL_THREAD_POOL);
() -> countTodayOrderCount(stationIdList, todayDate), FINANCIAL_THREAD_POOL);
CompletableFuture<List<SettleOrderReport>> recentReportsFuture = CompletableFuture.supplyAsync(
() -> queryRawReports(scope.getStationIdList(), recentStartTime, recentEndTime), FINANCIAL_THREAD_POOL);
() -> queryRawReports(stationIdList, recentStartTime, recentEndTime), FINANCIAL_THREAD_POOL);
List<SettleOrderReport> 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<BusinessWorkbenchSummaryVO.WorkbenchCard> 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<SettleOrderReport> reportList = queryRawReports(scope.getStationIdList(), dto.getStartTime(), dto.getEndTime());
List<SettleOrderReport> reportList = queryRawReports(dto.getStationIdList(), dto.getStartTime(), dto.getEndTime());
ReportSummary summary = buildReportSummary(reportList);
List<BusinessDailySettlementDetailVO.SettlementItem> 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<String> stationIdList = resolveStationIds(dto.getStationIdList());
List<String> stationIdList = dto.getStationIdList();
// 并行查询当前周期和上周期原始数据
CompletableFuture<List<SettleOrderReport>> currentReportFuture = CompletableFuture.supplyAsync(
@@ -421,7 +419,7 @@ public class BusinessFinancialServiceImpl implements BusinessFinancialService {
}
BusinessOperationDateRangeDTO range = buildDateRange(dto);
List<String> stationIdList = resolveStationIds(dto.getStationIdList());
List<String> stationIdList = dto.getStationIdList();
// 并行查询订单汇总和枪口数量
CompletableFuture<BusinessOperationSummaryDTO> summaryFuture = CompletableFuture.supplyAsync(
@@ -573,19 +571,19 @@ public class BusinessFinancialServiceImpl implements BusinessFinancialService {
* @param stationIdList 前端传入站点ID列表
* @return 实际查询站点ID列表
*/
private List<String> resolveStationIds(List<String> stationIdList) {
List<String> 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<String> resolveStationIds(List<String> stationIdList) {
// List<String> 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<String> stationIdList) {
List<String> merchantIdList = UserUtils.getFirstMerchantIdList();
List<String> 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<String> stationIdList) {
// List<String> merchantIdList = UserUtils.getFirstMerchantIdList();
// List<String> 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<String> stationIdList = resolveStationIds(dto.getStationIdList());
List<String> stationIdList = dto.getStationIdList();
// 并行查询当前周期和上周期的原始报表数据,各只查一次
CompletableFuture<List<SettleOrderReport>> currentReportFuture = CompletableFuture.supplyAsync(
@@ -1184,7 +1182,7 @@ public class BusinessFinancialServiceImpl implements BusinessFinancialService {
dto.setEndTime(endDate.toString());
}
List<String> stationIdList = resolveStationIds(dto.getStationIdList());
List<String> stationIdList = dto.getStationIdList();
// 并行查询订单汇总和枪口数量
CompletableFuture<BusinessOperationSummaryDTO> 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<String> stationIdList = resolveStationIds(dto.getStationIdList());
List<String> stationIdList = dto.getStationIdList();
// 查询结算报表原始数据
List<SettleOrderReport> reportList = queryRawReports(
@@ -1370,7 +1368,7 @@ public class BusinessFinancialServiceImpl implements BusinessFinancialService {
}
BusinessOperationDateRangeDTO range = buildDateRangeFromEfficiency(dto);
List<String> stationIdList = resolveStationIds(dto.getStationIdList());
List<String> stationIdList = dto.getStationIdList();
// 并行查询当前周期和上周期原始报表数据
CompletableFuture<List<SettleOrderReport>> currentReportFuture = CompletableFuture.supplyAsync(

View File

@@ -1122,6 +1122,7 @@ public class PileConnectorInfoServiceImpl implements PileConnectorInfoService {
* @param connectorStatus
* @return
*/
@Override
public Map<String, Object> getConnectorStatusNum(List<String> stationIds, String connectorStatus) {
Map<String, Object> map = new LinkedHashMap<>();
List<ConnectorInfoVO> 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);