mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-08-14 02:03:54 +08:00
bugfix 运营端小程序接口权限控制优化
This commit is contained in:
@@ -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(
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user