mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 02:55:04 +08:00
Merge branch 'dev' of http://192.168.2.2:8099/jsowell/jsowell-charger-web into dev
This commit is contained in:
@@ -1,7 +1,12 @@
|
||||
package com.jsowell.thirdparty.nanrui.domain;
|
||||
package com.jsowell.pile.domain.nanrui;
|
||||
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 订单信息
|
||||
@@ -10,6 +15,9 @@ import lombok.Data;
|
||||
* @Date 2023/9/25 14:33
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class NROrderInfo {
|
||||
/**
|
||||
* 运营商 ID
|
||||
@@ -37,7 +45,7 @@ public class NROrderInfo {
|
||||
* 3:其他
|
||||
*/
|
||||
@JSONField(name = "UserChargeType")
|
||||
private String userChargeType;
|
||||
private Integer userChargeType;
|
||||
|
||||
/**
|
||||
* 本次充电电量
|
||||
@@ -45,35 +53,35 @@ public class NROrderInfo {
|
||||
* 如果不设置峰谷电价,平电量等于本次充电电量,其他分电量为零
|
||||
*/
|
||||
@JSONField(name = "Elect")
|
||||
private String elect;
|
||||
private BigDecimal elect;
|
||||
|
||||
/**
|
||||
* 尖阶段电量
|
||||
* 单位 kWh,精度 0.001
|
||||
*/
|
||||
@JSONField(name = "CuspElect")
|
||||
private String cuspElect;
|
||||
private BigDecimal cuspElect;
|
||||
|
||||
/**
|
||||
* 峰阶段电量
|
||||
* 单位 kWh,精度 0.001
|
||||
*/
|
||||
@JSONField(name = "PeakElect")
|
||||
private String peakElect;
|
||||
private BigDecimal peakElect;
|
||||
|
||||
/**
|
||||
* 平阶段电量
|
||||
* 单位 kWh,精度 0.001
|
||||
*/
|
||||
@JSONField(name = "FlatElect")
|
||||
private String flatElect;
|
||||
private BigDecimal flatElect;
|
||||
|
||||
/**
|
||||
* 谷阶段电量
|
||||
* 单位 kWh,精度 0.001
|
||||
*/
|
||||
@JSONField(name = "ValleyElect")
|
||||
private String valleyElect;
|
||||
private BigDecimal valleyElect;
|
||||
|
||||
/**
|
||||
* 本次充电开始时间
|
||||
@@ -95,12 +103,12 @@ public class NROrderInfo {
|
||||
* 单位 kWh,精度 0.001
|
||||
*/
|
||||
@JSONField(name = "MeterValueStart")
|
||||
private String meterValueStart;
|
||||
private BigDecimal meterValueStart;
|
||||
|
||||
/**
|
||||
* 电表总止值
|
||||
* 单位 kWh,精度 0.001
|
||||
*/
|
||||
@JSONField(name = "MeterValueEnd")
|
||||
private String meterValueEnd;
|
||||
private BigDecimal meterValueEnd;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.jsowell.pile.dto.nanrui;
|
||||
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 南瑞平台查询订单信息DTO
|
||||
*
|
||||
* @author Lemon
|
||||
* @Date 2023/10/10 14:59
|
||||
*/
|
||||
@Data
|
||||
public class NRQueryOrderDTO {
|
||||
|
||||
private String orderCode;
|
||||
|
||||
/**
|
||||
* yyyy-MM-dd HH:mm:ss 格式,必填,以充电结束时间为准
|
||||
*/
|
||||
@JSONField(name = "QueryStartTime")
|
||||
private String queryStartTime;
|
||||
|
||||
/**
|
||||
* yyyy-MM-dd HH:mm:ss 格式,必填,以充电结束时间为准
|
||||
*/
|
||||
@JSONField(name = "QueryEndTime")
|
||||
private String queryEndTime;
|
||||
}
|
||||
@@ -2,7 +2,9 @@ package com.jsowell.pile.mapper;
|
||||
|
||||
import com.jsowell.pile.domain.OrderBasicInfo;
|
||||
import com.jsowell.pile.domain.OrderDetail;
|
||||
import com.jsowell.pile.domain.nanrui.NROrderInfo;
|
||||
import com.jsowell.pile.dto.*;
|
||||
import com.jsowell.pile.dto.nanrui.NRQueryOrderDTO;
|
||||
import com.jsowell.pile.vo.base.MerchantOrderInfoVO;
|
||||
import com.jsowell.pile.vo.lianlian.AccumulativeInfoVO;
|
||||
import com.jsowell.pile.vo.uniapp.OrderVO;
|
||||
@@ -246,4 +248,11 @@ public interface OrderBasicInfoMapper {
|
||||
* @return
|
||||
*/
|
||||
int updateMerchantByStationId(@Param("stationId")Long stationId, @Param("newMerchantId")String newMerchantId);
|
||||
|
||||
/**
|
||||
* 通过订单编号获取南瑞平台所需要的订单数据信息
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
List<NROrderInfo> getNROrderInfoByOrderCode(@Param("dto") NRQueryOrderDTO dto);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,9 @@ import com.jsowell.adapay.vo.OrderSettleResult;
|
||||
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
|
||||
import com.jsowell.common.core.domain.ykc.TransactionRecordsData;
|
||||
import com.jsowell.pile.domain.*;
|
||||
import com.jsowell.pile.domain.nanrui.NROrderInfo;
|
||||
import com.jsowell.pile.dto.*;
|
||||
import com.jsowell.pile.dto.nanrui.NRQueryOrderDTO;
|
||||
import com.jsowell.pile.service.orderlogic.AbstractOrderLogic;
|
||||
import com.jsowell.pile.vo.base.MerchantOrderInfoVO;
|
||||
import com.jsowell.pile.vo.base.OrderAmountDetailVO;
|
||||
@@ -353,4 +355,18 @@ public interface IOrderBasicInfoService {
|
||||
* @return
|
||||
*/
|
||||
int updateMerchantByStationId(Long stationId, String newMerchantId);
|
||||
|
||||
/**
|
||||
* 通过订单编号获取南瑞平台所需要的订单数据信息
|
||||
* @param orderCode
|
||||
* @return
|
||||
*/
|
||||
NROrderInfo getNROrderInfoByOrderCode(String orderCode);
|
||||
|
||||
/**
|
||||
* 通过充电结束时间批量查询
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
List<NROrderInfo> getNROrderInfos(NRQueryOrderDTO dto);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,9 @@ import com.jsowell.common.util.bean.BeanUtils;
|
||||
import com.jsowell.common.util.id.IdUtils;
|
||||
import com.jsowell.common.util.id.SnowflakeIdWorker;
|
||||
import com.jsowell.pile.domain.*;
|
||||
import com.jsowell.pile.domain.nanrui.NROrderInfo;
|
||||
import com.jsowell.pile.dto.*;
|
||||
import com.jsowell.pile.dto.nanrui.NRQueryOrderDTO;
|
||||
import com.jsowell.pile.mapper.OrderBasicInfoMapper;
|
||||
import com.jsowell.pile.service.*;
|
||||
import com.jsowell.pile.service.orderlogic.AbstractOrderLogic;
|
||||
@@ -165,6 +167,9 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
@Autowired
|
||||
private ClearingBillInfoService clearingBillInfoService;
|
||||
|
||||
@Autowired
|
||||
private IPileMsgRecordService pileMsgRecordService;
|
||||
|
||||
/**
|
||||
* 条件查询订单基本信息
|
||||
*
|
||||
@@ -989,6 +994,39 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
return orderBasicInfoMapper.updateMerchantByStationId(stationId, newMerchantId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过订单编号获取南瑞平台所需要的订单数据信息
|
||||
* @param orderCode
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public NROrderInfo getNROrderInfoByOrderCode(String orderCode) {
|
||||
NRQueryOrderDTO dto = new NRQueryOrderDTO();
|
||||
dto.setOrderCode(orderCode);
|
||||
List<NROrderInfo> nrOrderInfos = orderBasicInfoMapper.getNROrderInfoByOrderCode(dto);
|
||||
if (CollectionUtils.isEmpty(nrOrderInfos)) {
|
||||
return null;
|
||||
}
|
||||
// 此方法仅通过订单编号查,因此只有一条数据
|
||||
NROrderInfo nrOrderInfo = nrOrderInfos.get(0);
|
||||
// 将组织机构代码截取后九位
|
||||
String organizationCode = nrOrderInfo.getOperatorId();
|
||||
String operatorId = StringUtils.substring(organizationCode, organizationCode.length() - 9);
|
||||
nrOrderInfo.setOperatorId(operatorId);
|
||||
nrOrderInfo.setUserChargeType(1);
|
||||
// TODO 获取电表总起、止值
|
||||
// pileMsgRecordService.getPileFeedList()
|
||||
|
||||
nrOrderInfo.setMeterValueStart(BigDecimal.ZERO);
|
||||
nrOrderInfo.setMeterValueEnd(BigDecimal.ZERO);
|
||||
return nrOrderInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NROrderInfo> getNROrderInfos(NRQueryOrderDTO dto) {
|
||||
return orderBasicInfoMapper.getNROrderInfoByOrderCode(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 卡状态解锁
|
||||
*/
|
||||
|
||||
@@ -1165,4 +1165,33 @@
|
||||
where
|
||||
station_id = #{stationId,jdbcType=BIGINT}
|
||||
</update>
|
||||
|
||||
<select id="getNROrderInfoByOrderCode" resultType="com.jsowell.pile.domain.nanrui.NROrderInfo">
|
||||
SELECT
|
||||
t1.merchant_id,
|
||||
t3.organization_code AS operatorId,
|
||||
t1.pile_connector_code AS connectorId,
|
||||
t1.order_code AS startChargeSeq,
|
||||
t2.total_used_electricity AS elect,
|
||||
t2.sharp_used_electricity AS cuspElect,
|
||||
t2.peak_used_electricity AS peakElect,
|
||||
t2.flat_used_electricity AS flatElect,
|
||||
t2.valley_used_electricity AS valleyElect,
|
||||
t1.charge_start_time AS startTime,
|
||||
t1.charge_end_time AS endTime
|
||||
FROM
|
||||
order_basic_info t1
|
||||
JOIN order_detail t2 ON t1.order_code = t2.order_code
|
||||
AND t1.del_flag = '0'
|
||||
JOIN pile_merchant_info t3 ON t1.merchant_id = t3.id
|
||||
AND t3.del_flag = '0'
|
||||
<where>
|
||||
<if test="dto.orderCode != null and dto.orderCode != ''">
|
||||
and t1.order_code = #{dto.orderCode,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="dto.queryStartTime != null and dto.queryStartTime != '' and dto.queryEndTime != null and dto.queryEndTime != ''">
|
||||
and t1.charge_end_time between #{dto.queryStartTime,jdbcType=VARCHAR} and #{dto.queryEndTime,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -1,7 +1,10 @@
|
||||
package com.jsowell.thirdparty.nanrui.service;
|
||||
|
||||
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
|
||||
import com.jsowell.pile.domain.nanrui.NROrderInfo;
|
||||
import com.jsowell.pile.dto.QueryOrderDTO;
|
||||
import com.jsowell.pile.dto.QueryStationInfoDTO;
|
||||
import com.jsowell.pile.dto.nanrui.NRQueryOrderDTO;
|
||||
import com.jsowell.thirdparty.nanrui.domain.NRStationStatusInfo;
|
||||
|
||||
import java.text.ParseException;
|
||||
@@ -52,8 +55,26 @@ public interface NRService {
|
||||
|
||||
/**
|
||||
* 查询设备接口状态
|
||||
* 此接口用于批量查询设备实时状态
|
||||
* 由充电运营商方实现此接口,省、市两级监管平台调用。
|
||||
* @param stationIds
|
||||
* @return
|
||||
*/
|
||||
String query_station_status(List<String> stationIds);
|
||||
Map<String, Object> query_station_status(List<String> stationIds);
|
||||
|
||||
|
||||
/**
|
||||
* 充电电量信息推送
|
||||
* 当运营商平台完成一次充电时,将充电电量信息推送至省、市两级监管平台
|
||||
* @param orderCode
|
||||
* @return
|
||||
*/
|
||||
String notification_orderInfo(String orderCode);
|
||||
|
||||
/**
|
||||
* 此接口用于批量查询时间区段内交易记录
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
List<NROrderInfo> query_order_info(NRQueryOrderDTO dto);
|
||||
}
|
||||
@@ -11,16 +11,15 @@ import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.common.util.PageUtils;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.pile.domain.*;
|
||||
import com.jsowell.pile.domain.nanrui.NROrderInfo;
|
||||
import com.jsowell.pile.dto.QueryConnectorListDTO;
|
||||
import com.jsowell.pile.dto.QueryStationInfoDTO;
|
||||
import com.jsowell.pile.dto.nanrui.NRQueryOrderDTO;
|
||||
import com.jsowell.pile.service.*;
|
||||
import com.jsowell.pile.vo.base.ConnectorInfoVO;
|
||||
import com.jsowell.pile.vo.uniapp.CurrentTimePriceDetails;
|
||||
import com.jsowell.pile.vo.web.PileConnectorInfoVO;
|
||||
import com.jsowell.pile.vo.web.PileModelInfoVO;
|
||||
import com.jsowell.pile.vo.web.PileStationVO;
|
||||
import com.jsowell.thirdparty.lianlian.domain.ConnectorInfo;
|
||||
import com.jsowell.thirdparty.lianlian.domain.StationInfo;
|
||||
import com.jsowell.thirdparty.nanrui.domain.*;
|
||||
import com.jsowell.thirdparty.nanrui.service.NRService;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
@@ -266,7 +265,7 @@ public class NRServiceImpl implements NRService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String query_station_status(List<String> stationIds) {
|
||||
public Map<String, Object> query_station_status(List<String> stationIds) {
|
||||
List<NRStationStatusInfo> resultList = new ArrayList<>();
|
||||
|
||||
// 将 stationIdList 转换成 List<Long>
|
||||
@@ -279,7 +278,7 @@ public class NRServiceImpl implements NRService {
|
||||
.build();
|
||||
List<PileConnectorInfoVO> connectorInfoVOS = pileConnectorInfoService.getConnectorInfoListByParams(dto);
|
||||
if (CollectionUtils.isEmpty(connectorInfoVOS)) {
|
||||
return null;
|
||||
return new LinkedHashMap<>();
|
||||
}
|
||||
// 根据stationId分组
|
||||
Map<String, List<PileConnectorInfoVO>> collect = connectorInfoVOS.stream()
|
||||
@@ -327,11 +326,29 @@ public class NRServiceImpl implements NRService {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("StationStatusInfos", resultList);
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String notification_orderInfo(String orderCode) {
|
||||
// 根据订单号查询订单信息
|
||||
NROrderInfo nrOrderInfo = orderBasicInfoService.getNROrderInfoByOrderCode(orderCode);
|
||||
// TODO 发送请求
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("OrderInfo", nrOrderInfo);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NROrderInfo> query_order_info(NRQueryOrderDTO dto) {
|
||||
List<NROrderInfo> nrOrderInfos = orderBasicInfoService.getNROrderInfos(dto);
|
||||
if (CollectionUtils.isEmpty(nrOrderInfos)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return nrOrderInfos;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String chargingTime = "30";
|
||||
Date beginTime = DateUtils.addMinute(new Date(), -Integer.parseInt(chargingTime));
|
||||
|
||||
Reference in New Issue
Block a user