Merge branch 'dev' into feature-integrated_with_JCPP

This commit is contained in:
Guoqs
2026-01-08 09:38:32 +08:00
20 changed files with 573 additions and 156 deletions

View File

@@ -459,4 +459,11 @@ public interface OrderBasicInfoMapper {
* @return
*/
List<IndexPlatformProfitVO> getInsuranceAmount(@Param("dto") IndexQueryDTO dto);
/**
* 批量查询充电枪信息
* @param chargingConnectorCodeList
* @return
*/
List<PileConnectorInfoVO> batchQueryChargingConnectorInfo(@Param("pileConnectorCodes") List<String> chargingConnectorCodeList);
}

View File

@@ -136,6 +136,14 @@ public interface PileConnectorInfoMapper {
*/
List<ConnectorInfoVO> batchSelectConnectorList(@Param("stationIds") List<String> stationIds);
/**
* 此方法与上面方法一样只是多加了status字段
* @param stationIds
* @param status
* @return
*/
List<ConnectorInfoVO> batchSelectConnectorListByStatus(@Param("stationIds") List<String> stationIds, @Param("status") String status);
/**
* 查询异常设备数量
* @param stationId

View File

@@ -133,4 +133,11 @@ public interface PileStationInfoMapper {
* @return
*/
List<UserFrequentedStationInfo> queryUserFrequentedStation(@Param("memberId") String memberId ,@Param("startTime") String startTime ,@Param("endTime") String endTime);
/**
* 通过运营商ids查询站点ids
* @param merchantIdList
* @return
*/
List<String> getStationIdsByMerchantIds(@Param("merchantIds") List<String> merchantIdList);
}

View File

@@ -661,4 +661,18 @@ public interface OrderBasicInfoService{
* @return
*/
List<IndexPlatformProfitVO> getInsuranceAmount(IndexQueryDTO dto);
/**
* 批量查询充电枪信息
* @param chargingConnectorCodeList
* @return
*/
List<PileConnectorInfoVO> batchQueryChargingConnectorInfo(List<String> chargingConnectorCodeList);
/**
* 批量查询充电枪实时数据
* @param transactionCodeList
* @return
*/
List<RealTimeMonitorData> getRealTimeMonitorDataList(List<String> transactionCodeList);
}

View File

@@ -153,7 +153,7 @@ public interface PileConnectorInfoService {
/**
* 通过站点id和枪口状态查询枪口列表
*/
BusinessConnectorInfoVO getConnectorListByStationAndStatus(QueryConnectorInfoDTO dto);
PageResponse getConnectorListByStationAndStatus(QueryConnectorInfoDTO dto);
/**
* 通过查询参数查询枪口信息
@@ -183,4 +183,12 @@ public interface PileConnectorInfoService {
* @return
*/
int queryAbnormalDeviceCount(String id);
/**
* 查询充电桩枪口状态数量
* @param stationIds
* @param connectorStatus
* @return
*/
public Map<String, Object> getConnectorStatusNum(List<String> stationIds, String connectorStatus);
}

View File

@@ -216,5 +216,10 @@ public interface PileStationInfoService {
*/
PageResponse queryUserFrequentedStation(QueryStationDTO dto);
/**
* 通过运营商ids查询站点ids
* @param merchantIdList
* @return
*/
List<String> getStationIdsByMerchantIds(List<String> merchantIdList);
}

View File

@@ -6255,6 +6255,7 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
}
/**
<<<<<<< HEAD
* 运营端小程序查询订单
* @param dto 查询条件
* @return 订单查询结果
@@ -6302,10 +6303,32 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
long orderCount = pageInfo.getTotal();
// 3. 统计总金额(使用聚合 SQL避免查询所有数据到内存
OrderStatisticsVO statistics = orderBasicInfoMapper.countBusinessOrderStatistics(queryOrderDTO);
BigDecimal totalOrderAmount = statistics != null && statistics.getOrderAmount() != null
? statistics.getOrderAmount() : BigDecimal.ZERO;
// 3. 统计总金额 (分批处理)
BigDecimal totalOrderAmount = BigDecimal.ZERO;
int batchSize = 500; // 每批最多 500 个站点ID
if (stationIdList.size() > batchSize) {
// 分批查询统计
List<List<String>> batches = Lists.partition(stationIdList, batchSize);
for (List<String> batch : batches) {
QueryOrderDTO batchDTO = QueryOrderDTO.builder()
.stationIdList(batch)
.startTime(dto.getCreateTime())
.endTime(dto.getEndTime())
.orderStatus(dto.getOrderStatus())
.startMode(dto.getStartMode())
.stationName(dto.getStationName())
.build();
OrderStatisticsVO batchStatistics = orderBasicInfoMapper.countBusinessOrderStatistics(batchDTO);
if (batchStatistics != null && batchStatistics.getOrderAmount() != null) {
totalOrderAmount = totalOrderAmount.add(batchStatistics.getOrderAmount());
}
}
} else {
// 直接查询
OrderStatisticsVO statistics = orderBasicInfoMapper.countBusinessOrderStatistics(queryOrderDTO);
totalOrderAmount = statistics != null && statistics.getOrderAmount() != null
? statistics.getOrderAmount() : BigDecimal.ZERO;
}
//4. 转换为 BusinessOrderListVO
List<BusinessOrderListVO> businessOrderList = orderListVOS.stream()
@@ -6338,6 +6361,77 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
.build();
}
/*
* 批量查询充电枪口信息
* @param chargingConnectorCodeList
* @return
*/
@Override
public List<PileConnectorInfoVO> batchQueryChargingConnectorInfo(List<String> chargingConnectorCodeList) {
// 这个infoVOs只有简单数据没有充电中数据
List<PileConnectorInfoVO> infoVOS = orderBasicInfoMapper.batchQueryChargingConnectorInfo(chargingConnectorCodeList);
List<String> transactionCodes = infoVOS.stream()
.map(PileConnectorInfoVO::getTransactionCode)
.collect(Collectors.toList());
List<RealTimeMonitorData> list = getRealTimeMonitorDataList(transactionCodes);
Map<String, RealTimeMonitorData> bMap = list.stream()
.collect(Collectors.toMap(
RealTimeMonitorData::getPileConnectorCode,
x -> x,
(existing, replacement) -> existing // 如果有重复key保留第一个
));
for (PileConnectorInfoVO infoVO : infoVOS) {
String pileConnectorCode = infoVO.getPileConnectorCode();
if (pileConnectorCode != null && bMap.containsKey(pileConnectorCode)) {
RealTimeMonitorData realTimeMonitorData = bMap.get(pileConnectorCode);
infoVO.setChargingDegree(new BigDecimal(realTimeMonitorData.getChargingDegree()));
infoVO.setChargingTime(realTimeMonitorData.getSumChargingTime());
infoVO.setSOC(realTimeMonitorData.getSOC());
infoVO.setTimeRemaining(realTimeMonitorData.getTimeRemaining());
}
}
return infoVOS;
}
/**
* 批量查询实时监控数据
* @param transactionCodeList
* @return
*/
@Override
public List<RealTimeMonitorData> getRealTimeMonitorDataList(List<String> transactionCodeList) {
List<RealTimeMonitorData> resultList = new ArrayList<>();
List<String> redisKeys = new ArrayList<>();
for (String transactionCode : transactionCodeList) {
// 截取枪口编号
String pileConnectorCode = transactionCode.substring(0, 16);
redisKeys.add(CacheConstants.PILE_REAL_TIME_MONITOR_DATA + pileConnectorCode + "_" + transactionCode);
}
// 批量查询多个key值的数据 key: redisKey, value: 最后一条实时数据
// 注意数据在Redis中以Hash类型存储field为时间字符串需要获取所有field后取最新的一条
for (String redisKey : redisKeys) {
try {
Map<String, String> hashData = redisCache.getCacheMap(redisKey);
if (hashData != null && !hashData.isEmpty()) {
// 按时间排序,获取最新的一条数据
String latestJson = hashData.entrySet().stream()
.max(Map.Entry.comparingByKey())
.map(Map.Entry::getValue)
.orElse(null);
if (latestJson != null) {
RealTimeMonitorData data = JSON.parseObject(latestJson, RealTimeMonitorData.class);
resultList.add(data);
}
}
} catch (Exception e) {
logger.error("获取实时监控数据失败redisKey={}", redisKey, e);
}
}
return resultList;
}
}

View File

@@ -20,6 +20,7 @@ import com.jsowell.common.enums.ykc.PileStatusEnum;
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.util.DateUtils;
import com.jsowell.common.util.PageUtils;
import com.jsowell.common.util.SecurityUtils;
import com.jsowell.common.util.StringUtils;
import com.jsowell.common.util.spring.SpringUtils;
@@ -34,9 +35,13 @@ import com.jsowell.pile.dto.business.QueryConnectorInfoDTO;
import com.jsowell.pile.mapper.PileBasicInfoMapper;
import com.jsowell.pile.mapper.PileConnectorInfoMapper;
import com.jsowell.pile.service.*;
import com.jsowell.pile.util.UserUtils;
import com.jsowell.pile.vo.base.ConnectorInfoVO;
import com.jsowell.pile.vo.base.LoginUserDetailVO;
import com.jsowell.pile.vo.uniapp.business.BusinessConnectorDetailVO;
import com.jsowell.pile.vo.uniapp.business.BusinessConnectorInfoVO;
import com.jsowell.pile.vo.uniapp.business.BusinessOrderDetailInfoVO;
import com.jsowell.pile.vo.uniapp.customer.OrderVO;
import com.jsowell.pile.vo.web.PileConnectorInfoVO;
import com.jsowell.pile.vo.web.PileDetailVO;
import com.jsowell.pile.vo.web.PileModelInfoVO;
@@ -1053,58 +1058,114 @@ public class PileConnectorInfoServiceImpl implements PileConnectorInfoService {
/**
* 查询站点枪口列表
*
* @param dto
* @return
*/
@Override
public BusinessConnectorInfoVO getConnectorListByStationAndStatus(QueryConnectorInfoDTO dto) {
// 获取登录账号信息
Long deptId = SecurityUtils.getDeptId();
List<String> stationIds = pileMerchantInfoService.queryByMerchantDeptIds(Lists.newArrayList(String.valueOf(deptId)));
String connectorStatus = dto.getConnectorStatus();
int pageNum = dto.getPageNum();
int pageSize = dto.getPageSize();
BusinessConnectorInfoVO vo = new BusinessConnectorInfoVO();
// 根据站点ids查询枪口列表(有缓存)
List<ConnectorInfoVO> connectorInfoVOS = batchSelectConnectorList(stationIds);
// 筛选出枪口编号
List<String> pileConnectorCodeList = connectorInfoVOS.stream()
public PageResponse getConnectorListByStationAndStatus(QueryConnectorInfoDTO dto) {
List<PileConnectorInfoVO> list = new ArrayList<>();
List<String> stationIds = dto.getStationIds();
String status = dto.getConnectorStatus();
int pageNum = dto.getPageNum() == 0 ? 1 : dto.getPageNum();
int pageSize = dto.getPageSize() == 0 ? 10 : dto.getPageSize();
// 分页查询符合条件站点的枪口列表
PageUtils.startPage(pageNum, pageSize);
List<ConnectorInfoVO> connectorInfoVOS = pileConnectorInfoMapper.batchSelectConnectorListByStatus(stationIds, status);
PageInfo<ConnectorInfoVO> pageInfo = new PageInfo<>(connectorInfoVOS);
// 将分页列表中充电中的枪编码筛选出来
List<String> chargingPileConnectorCodeList = connectorInfoVOS.stream()
.filter(connectorInfoVO -> StringUtils.equals(connectorInfoVO.getConnectorStatus()
, PileConnectorDataBaseStatusEnum.OCCUPIED_CHARGING.getValue()))
.map(ConnectorInfoVO::getPileConnectorCode)
.collect(Collectors.toList());
// 批量获取某状态的枪口数量
Map<String, Integer> connectorStatusNumMap = getConnectorStatus(pileConnectorCodeList);
Integer offlineNum = connectorStatusNumMap.get("offlineNum");
Integer freeNum = connectorStatusNumMap.get("freeNum");
Integer occupiedNum = connectorStatusNumMap.get("occupiedNum");
Integer chargingNum = connectorStatusNumMap.get("chargingNum");
Integer faultNum = connectorStatusNumMap.get("faultNum");
vo.setConnectorNum(pileConnectorCodeList.size());
vo.setOfflineConnectorNum(offlineNum);
vo.setFreeConnectorNum(freeNum);
vo.setOccupiedConnectorNum(occupiedNum);
vo.setChargingConnectorNum(chargingNum);
vo.setFaultConnectorNum(faultNum);
List<Long> longStationIds = stationIds.stream()
.map(Long::parseLong) // 或 s -> Long.parseLong(s)
.collect(Collectors.toList());
// 根据站点id和枪口状态查询枪口列表
QueryConnectorListDTO queryConnectorListDTO = QueryConnectorListDTO.builder()
.pageNum(pageNum)
.pageSize(pageSize)
.stationIdList(longStationIds)
.build();
List<PileConnectorInfoVO> pileConnectorInfoVOList = getConnectorInfoListByParams(queryConnectorListDTO);
if (connectorStatus != null) {
// 筛选出符合状态的数据
pileConnectorInfoVOList = pileConnectorInfoVOList.stream()
.filter(x -> x.getStatus() == Integer.parseInt(connectorStatus))
.collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(chargingPileConnectorCodeList)) {
// 批量查询充电中的各项信息
List<PileConnectorInfoVO> pileConnectorInfoVOS = orderBasicInfoService.batchQueryChargingConnectorInfo(chargingPileConnectorCodeList);
// 将获取到的充电信息详情根据枪口编码将信息set进对应的pageInfo.list中对应的值
for (PileConnectorInfoVO pileConnectorInfoVO : pileConnectorInfoVOS) {
for (ConnectorInfoVO connectorInfoVO : connectorInfoVOS) {
if (StringUtils.equals(pileConnectorInfoVO.getPileConnectorCode(), connectorInfoVO.getPileConnectorCode())) {
connectorInfoVO.setOrderCode(pileConnectorInfoVO.getOrderCode());
connectorInfoVO.setChargeTime(pileConnectorInfoVO.getChargingTime());
connectorInfoVO.setChargeDegree(String.valueOf(pileConnectorInfoVO.getChargingDegree()));
connectorInfoVO.setTimeRemaining(pileConnectorInfoVO.getTimeRemaining());
connectorInfoVO.setSoc(String.valueOf(pileConnectorInfoVO.getSOC()));
}
}
}
}
vo.setPileConnectorInfoVOList(pileConnectorInfoVOList);
return vo;
return PageResponse.builder()
.pageNum(pageInfo.getPageNum())
.pageSize(pageInfo.getPageSize())
.total(pageInfo.getTotal())
.pages(pageInfo.getPages())
.list(connectorInfoVOS)
.build();
}
/**
* 获取站点各状态的枪口数量
* @param stationIds
* @param connectorStatus
* @return
*/
public Map<String, Object> getConnectorStatusNum(List<String> stationIds, String connectorStatus) {
Map<String, Object> map = new LinkedHashMap<>();
List<ConnectorInfoVO> connectorInfoVOS = pileConnectorInfoMapper.batchSelectConnectorListByStatus(stationIds, connectorStatus);
// 初始化对象
int offlineNum = 0;
int freeNum = 0;
int occupiedNum = 0;
int chargingNum = 0;
int hangingNum = 0;
int faultNum = 0;
for (ConnectorInfoVO connectorInfoVO : connectorInfoVOS) {
String status = connectorInfoVO.getConnectorStatus();
if (StringUtils.equals(status, PileConnectorDataBaseStatusEnum.OFF_NETWORK.getValue())) {
// 离网
offlineNum += 1;
}
if (StringUtils.equals(status, PileConnectorDataBaseStatusEnum.FREE.getValue())) {
// 空闲
freeNum += 1;
}
if (StringUtils.equals(status, PileConnectorDataBaseStatusEnum.OCCUPIED_RESERVED_LOCK.getValue())) {
// 预约锁定(挂起)
hangingNum += 1;
}
if (StringUtils.equals(status, PileConnectorDataBaseStatusEnum.OCCUPIED_NOT_CHARGED.getValue())) {
// 占用未充电
occupiedNum += 1;
}
if (StringUtils.equals(status, PileConnectorDataBaseStatusEnum.OCCUPIED_CHARGING.getValue())) {
// 充电中
chargingNum += 1;
}
if (StringUtils.equals(status, PileConnectorDataBaseStatusEnum.FAULT.getValue())) {
// 故障
faultNum += 1;
}
}
// 全部数量
int totalNum = offlineNum + freeNum + occupiedNum + chargingNum + faultNum + hangingNum;
map.put("totalNum", totalNum);
map.put("offlineNum", offlineNum);
map.put("freeNum", freeNum);
map.put("hangingNum", hangingNum);
map.put("occupiedNum", occupiedNum);
map.put("chargingNum", chargingNum);
map.put("faultNum", faultNum);
return map;
}
/**
@@ -1177,9 +1238,15 @@ public class PileConnectorInfoServiceImpl implements PileConnectorInfoService {
}
RealTimeMonitorData realTimeMonitorData = chargingRealTimeData.get(0);
String startSoc = orderBasicInfo.getStartSoc();
Date chargeStartTime = orderBasicInfo.getChargeStartTime();
String startTime = "-";
if (chargeStartTime != null) {
// 转换成 字符串
startTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, chargeStartTime);
}
String endSoc = realTimeMonitorData.getSOC();
detailVO.setChargeStartTime(startTime);
detailVO.setStartSOC(startSoc);
detailVO.setEndSOC(endSoc);
detailVO.setChargeDegree(realTimeMonitorData.getChargingDegree()); // 充电度数

View File

@@ -1623,4 +1623,14 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
return uniAppQueryStationInfoListV2(dto);
}
/**
* 根据商户ids查询站点ids
* @param merchantIdList
* @return
*/
@Override
public List<String> getStationIdsByMerchantIds(List<String> merchantIdList) {
return pileStationInfoMapper.getStationIdsByMerchantIds(merchantIdList);
}
}

View File

@@ -66,4 +66,13 @@ public class ConnectorInfoVO {
*/
private String ratedVoltage;
private String orderCode;
private String chargeDegree;
private String chargeTime;
private String timeRemaining;
private String soc;
}

View File

@@ -56,4 +56,9 @@ public class BusinessConnectorDetailVO {
* 故障原因
*/
private String faultReason;
/**
* 充电开始时间
*/
private String chargeStartTime;
}

View File

@@ -25,6 +25,11 @@ public class BusinessOrderDetailInfoVO {
private String pileConnectorCode;
/**
* 交易流水号
*/
private String transactionCode;
/**
* 充电次数
*/
@@ -185,4 +190,9 @@ public class BusinessOrderDetailInfoVO {
*/
private String memberId;
/**
* 剩余时间
*/
private String timeRemaining;
}

View File

@@ -1934,6 +1934,46 @@
join pile_station_info t3 on t1.station_id = t3.id and t3.del_flag = '0'
join order_detail t4 on t4.order_code = t1.order_code and t4.del_flag = '0'
where t1.del_flag = '0'
<!-- 优先使用最严格的过滤条件,减少扫描数据量 -->
<if test="stationIdList != null and stationIdList.size() != 0">
and t1.station_id in
<foreach collection="stationIdList" item="stationId" open="(" separator="," close=")">
#{stationId}
</foreach>
</if>
<if test="excludeStationIdList != null and excludeStationIdList.size() != 0">
and t1.station_id not in
<foreach close=")" collection="excludeStationIdList" item="excludeStationId" open="(" separator=",">
#{excludeStationId}
</foreach>
</if>
<if test="startTime != null and startTime != ''">
and t1.create_time <![CDATA[ >= ]]> #{startTime,jdbcType=VARCHAR}
</if>
<if test="endTime != null and endTime != ''">
and t1.create_time <![CDATA[ <= ]]> #{endTime,jdbcType=VARCHAR}
</if>
<if test="orderStatus != null and orderStatus != ''">
and t1.order_status = #{orderStatus,jdbcType=VARCHAR}
</if>
<if test="startMode != null and startMode != ''">
and t1.start_mode = #{startMode,jdbcType=VARCHAR}
</if>
<if test="stationName != null and stationName != ''">
and t3.station_name like concat('%', #{stationName,jdbcType=VARCHAR}, '%')
</if>
<if test="stationDeptIds != null and stationDeptIds.size() != 0">
and t3.dept_id in
<foreach close=")" collection="stationDeptIds" item="stationDeptId" open="(" separator=",">
#{stationDeptId}
</foreach>
</if>
<if test="orderCode != null and orderCode != ''">
and t1.order_code = #{orderCode,jdbcType=VARCHAR}
</if>
<if test="transactionCode != null and transactionCode != ''">
and t1.transaction_code = #{transactionCode,jdbcType=VARCHAR}
</if>
<if test="pileSn != null and pileSn != ''">
and t1.pile_sn = #{pileSn,jdbcType=VARCHAR}
</if>
@@ -1943,15 +1983,6 @@
<if test="memberId != null and memberId != ''">
and t1.member_id = #{memberId,jdbcType=VARCHAR}
</if>
<if test="orderStatus != null and orderStatus != ''">
and t1.order_status = #{orderStatus,jdbcType=VARCHAR}
</if>
<if test="orderCode != null and orderCode != ''">
and t1.order_code = #{orderCode,jdbcType=VARCHAR}
</if>
<if test="transactionCode != null and transactionCode != ''">
and t1.transaction_code = #{transactionCode,jdbcType=VARCHAR}
</if>
<if test="mobileNumber != null and mobileNumber != ''">
and t2.mobile_number = #{mobileNumber,jdbcType=VARCHAR}
</if>
@@ -1961,12 +1992,6 @@
<if test="stationId != null and stationId != ''">
and t1.station_id = #{stationId,jdbcType=VARCHAR}
</if>
<if test="startTime != null and startTime != ''">
and t1.create_time <![CDATA[ >= ]]> #{startTime,jdbcType=VARCHAR}
</if>
<if test="endTime != null and endTime != ''">
and t1.create_time <![CDATA[ <= ]]> #{endTime,jdbcType=VARCHAR}
</if>
<if test="startSettleTime != null and startSettleTime != ''">
and t1.settlement_time <![CDATA[ >= ]]> #{startSettleTime,jdbcType=VARCHAR}
</if>
@@ -1985,30 +2010,6 @@
<if test="payMode != null and payMode != ''">
and t1.pay_mode = #{payMode,jdbcType=VARCHAR}
</if>
<if test="stationDeptIds != null and stationDeptIds.size() != 0">
and t3.dept_id in
<foreach close=")" collection="stationDeptIds" item="stationDeptId" open="(" separator=",">
#{stationDeptId}
</foreach>
</if>
<if test="excludeStationIdList != null and excludeStationIdList.size() != 0">
and t1.station_id not in
<foreach close=")" collection="excludeStationIdList" item="excludeStationId" open="(" separator=",">
#{excludeStationId}
</foreach>
</if>
<if test="stationIdList != null and stationIdList.size() != 0">
and t1.station_id in
<foreach collection="stationIdList" item="stationId" open="(" separator="," close=")">
#{stationId}
</foreach>
</if>
<if test="startMode != null and startMode != ''">
and t1.start_mode = #{startMode,jdbcType=VARCHAR}
</if>
<if test="stationName != null and stationName != ''">
and t3.station_name like concat('%', #{stationName,jdbcType=VARCHAR}, '%')
</if>
order by t1.create_time desc
</select>
@@ -2087,62 +2088,53 @@
resultType="com.jsowell.pile.vo.web.OrderStatisticsVO">
SELECT
COUNT(*) AS orderCount,
IFNULL(SUM(order_amount), 0) AS orderAmount
FROM (
SELECT DISTINCT
t1.order_code,
t1.order_amount
FROM order_basic_info t1
LEFT JOIN member_basic_info t2
ON t1.member_id = t2.member_id
AND t2.del_flag = '0'
IFNULL(SUM(t1.order_amount), 0) AS orderAmount
FROM order_basic_info t1
<if test="(stationName != null and stationName != '') or (stationDeptIds != null and stationDeptIds.size() != 0)">
JOIN pile_station_info t3
ON t1.station_id = t3.id
AND t3.del_flag = '0'
JOIN order_detail t4
ON t4.order_code = t1.order_code
AND t4.del_flag = '0'
WHERE t1.del_flag = '0'
<if test="orderStatus != null and orderStatus != ''">
AND t1.order_status = #{orderStatus,jdbcType=VARCHAR}
</if>
<if test="merchantId != null and merchantId != ''">
AND t1.merchant_id = #{merchantId,jdbcType=VARCHAR}
</if>
<if test="stationId != null and stationId != ''">
AND t1.station_id = #{stationId,jdbcType=VARCHAR}
</if>
<if test="startTime != null and startTime != ''">
AND t1.create_time <![CDATA[ >= ]]> #{startTime,jdbcType=VARCHAR}
</if>
<if test="endTime != null and endTime != ''">
AND t1.create_time <![CDATA[ <= ]]> #{endTime,jdbcType=VARCHAR}
</if>
<if test="stationIdList != null and stationIdList.size() != 0">
AND t1.station_id IN
<foreach collection="stationIdList" item="stationId" open="(" separator="," close=")">
#{stationId}
</foreach>
</if>
<if test="startMode != null and startMode != ''">
AND t1.start_mode = #{startMode,jdbcType=VARCHAR}
</if>
<if test="stationName != null and stationName != ''">
AND t3.station_name LIKE CONCAT('%', #{stationName,jdbcType=VARCHAR}, '%')
</if>
<if test="stationDeptIds != null and stationDeptIds.size() != 0">
AND t3.dept_id IN
<foreach collection="stationDeptIds" item="stationDeptId" open="(" separator="," close=")">
#{stationDeptId}
</foreach>
</if>
<if test="excludeStationIdList != null and excludeStationIdList.size() != 0">
AND t1.station_id NOT IN
<foreach collection="excludeStationIdList" item="excludeStationId" open="(" separator="," close=")">
#{excludeStationId}
</foreach>
</if>
) AS temp
</if>
WHERE t1.del_flag = '0'
<if test="stationIdList != null and stationIdList.size() != 0">
AND t1.station_id IN
<foreach collection="stationIdList" item="stationId" open="(" separator="," close=")">
#{stationId}
</foreach>
</if>
<if test="excludeStationIdList != null and excludeStationIdList.size() != 0">
AND t1.station_id NOT IN
<foreach collection="excludeStationIdList" item="excludeStationId" open="(" separator="," close=")">
#{excludeStationId}
</foreach>
</if>
<if test="orderStatus != null and orderStatus != ''">
AND t1.order_status = #{orderStatus,jdbcType=VARCHAR}
</if>
<if test="startMode != null and startMode != ''">
AND t1.start_mode = #{startMode,jdbcType=VARCHAR}
</if>
<if test="startTime != null and startTime != ''">
AND t1.create_time <![CDATA[ >= ]]> #{startTime,jdbcType=VARCHAR}
</if>
<if test="endTime != null and endTime != ''">
AND t1.create_time <![CDATA[ <= ]]> #{endTime,jdbcType=VARCHAR}
</if>
<if test="merchantId != null and merchantId != ''">
AND t1.merchant_id = #{merchantId,jdbcType=VARCHAR}
</if>
<if test="stationId != null and stationId != ''">
AND t1.station_id = #{stationId,jdbcType=VARCHAR}
</if>
<if test="stationName != null and stationName != ''">
AND t3.station_name LIKE CONCAT('%', #{stationName,jdbcType=VARCHAR}, '%')
</if>
<if test="stationDeptIds != null and stationDeptIds.size() != 0">
AND t3.dept_id IN
<foreach collection="stationDeptIds" item="stationDeptId" open="(" separator="," close=")">
#{stationDeptId}
</foreach>
</if>
</select>
<select id="selectOrderBasicInfoById" parameterType="Long" resultMap="OrderBasicInfoOrderDetailResult">
@@ -3600,4 +3592,17 @@
and `settlement_time` BETWEEN #{dto.startTime,jdbcType=VARCHAR} and #{dto.endTime,jdbcType=VARCHAR}
group by DATE_FORMAT(settlement_time, '%Y-%m-%d');
</select>
<select id="batchQueryChargingConnectorInfo"
resultType="com.jsowell.pile.vo.web.PileConnectorInfoVO">
select
order_code as orderCode,
transaction_code as transactionCode,
pile_connector_code as pileConnectorCode
from order_basic_info where pile_connector_code in
<foreach item="pileConnectorCode" collection="pileConnectorCodes" separator="," open="(" close=")">
#{pileConnectorCode}
</foreach>
and order_status = '1'
</select>
</mapper>

View File

@@ -319,4 +319,27 @@
AND
t1.del_flag = '0'
</select>
<select id="batchSelectConnectorListByStatus" resultType="com.jsowell.pile.vo.base.ConnectorInfoVO">
SELECT
t1.pile_connector_code as pileConnectorCode,
t2.station_id as stationId,
t1.STATUS as connectorStatus,
t1.pile_sn as pileSn,
t2.model_id as modelId,
t3.speed_type as chargingType,
t3.rated_power as ratedPower
FROM
pile_connector_info t1
JOIN pile_basic_info t2 ON (t1.pile_sn = t2.sn AND t2.del_flag = '0')
JOIN pile_model_info t3 ON (t2.model_id = t3.id AND t3.del_flag = '0')
WHERE t1.del_flag = '0'
AND t2.station_id in
<foreach collection="stationIds" item="stationId" open="(" separator="," close=")">
#{stationId, jdbcType=VARCHAR}
</foreach>
<if test="status != null and status != ''">
AND t1.status = #{status,jdbcType=VARCHAR}
</if>
</select>
</mapper>

View File

@@ -743,4 +743,15 @@
ORDER BY
chargeNum DESC;
</select>
<select id="getStationIdsByMerchantIds" resultType="java.lang.String">
select
id
from
pile_station_info
where merchant_id in
<foreach collection="merchantIds" item="merchantId" open="(" separator="," close=")">
#{merchantId,jdbcType=VARCHAR}
</foreach>
</select>
</mapper>