From b9b4d5c966a7b6c8c830af7f7d5c9f351d144af2 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期五, 18 十月 2024 11:08:28 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/UploadRealTimeMonitoringDataServiceImpl.java | 46 ++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 40 insertions(+), 6 deletions(-) diff --git a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/UploadRealTimeMonitoringDataServiceImpl.java b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/UploadRealTimeMonitoringDataServiceImpl.java index cbed3aa..3f4912d 100644 --- a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/UploadRealTimeMonitoringDataServiceImpl.java +++ b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/UploadRealTimeMonitoringDataServiceImpl.java @@ -1,10 +1,10 @@ package com.ruoyi.integration.mongodb.service.impl; -import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; import com.ruoyi.integration.iotda.constant.IotConstant; import com.ruoyi.integration.mongodb.service.UploadRealTimeMonitoringDataService; +import com.ruoyi.common.core.dto.MongoChargingOrderQuery; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; @@ -15,7 +15,6 @@ import org.springframework.stereotype.Service; import java.util.List; -import java.util.Set; @Service public class UploadRealTimeMonitoringDataServiceImpl implements UploadRealTimeMonitoringDataService { @@ -58,13 +57,48 @@ } @Override - public List<UploadRealTimeMonitoringData> getDataAll(Set<String> values, Integer page, Integer size) { + public List<UploadRealTimeMonitoringData> getDataAll(MongoChargingOrderQuery mongoChargingOrderQuery) { Query query = new Query(); - if (!values.isEmpty()){ - query.addCriteria(Criteria.where("transaction_serial_number").in(values)); +// if (!values.isEmpty()){ +// query.addCriteria(Criteria.where("transaction_serial_number").in(values)); +// } + if (mongoChargingOrderQuery.getCode() != null && !mongoChargingOrderQuery.getCode().isEmpty()) { + query.addCriteria(Criteria.where("transaction_serial_number").regex(mongoChargingOrderQuery.getCode(), "i")); // "i" 表示不区分大小写 } + if (mongoChargingOrderQuery.getOrderType() !=null){ + query.addCriteria(Criteria.where("order_type").is(mongoChargingOrderQuery.getOrderType())); + } + if (mongoChargingOrderQuery.getSiteId() != null){ + query.addCriteria(Criteria.where("site_id").is(mongoChargingOrderQuery.getSiteId())); + } + if (mongoChargingOrderQuery.getChargingPileCode() != null && !mongoChargingOrderQuery.getChargingPileCode().isEmpty()) { + query.addCriteria(Criteria.where("charging_pile_code").is(mongoChargingOrderQuery.getChargingPileCode())); + } + if (mongoChargingOrderQuery.getChargingGunCode() != null && !mongoChargingOrderQuery.getChargingGunCode().isEmpty()){ + query.addCriteria(Criteria.where("charging_gun_code").is(mongoChargingOrderQuery.getChargingGunCode())); + } + if (mongoChargingOrderQuery.getStatus() != null){ + query.addCriteria(Criteria.where("status").is(mongoChargingOrderQuery.getStatus())); + } + + if (mongoChargingOrderQuery.getStartTime() != null) { + String[] split = mongoChargingOrderQuery.getStartTime().split(" - "); + query.addCriteria(Criteria.where("startTime").gte(split[0]).lt(split[1])); + } + + if (mongoChargingOrderQuery.getEndTime() != null && mongoChargingOrderQuery.getEndTime() != null) { + String[] split = mongoChargingOrderQuery.getEndTime().split(" - "); + + query.addCriteria(Criteria.where("lastTime").gte(split[0]).lt(split[1])); + } + + + + + + // 设置分页 - Pageable pageable = PageRequest.of(page, size); + Pageable pageable = PageRequest.of(mongoChargingOrderQuery.getPageCurr(), mongoChargingOrderQuery.getPageSize()); query.with(pageable); List<UploadRealTimeMonitoringData> uploadRealTimeMonitoringData = mongoTemplate.find( -- Gitblit v1.7.1