mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-07-02 13:07:57 +08:00
新增 广西平台Service相关方法
This commit is contained in:
@@ -28,6 +28,8 @@ public enum ThirdPlatformTypeEnum {
|
|||||||
GAN_SU_PLATFORM("17", "甘肃省平台", "MA01H3BQ9"),
|
GAN_SU_PLATFORM("17", "甘肃省平台", "MA01H3BQ9"),
|
||||||
GUI_ZHOU_PLATFORM("18", "贵州省平台", "009390404"),
|
GUI_ZHOU_PLATFORM("18", "贵州省平台", "009390404"),
|
||||||
NAN_RUI_PLATFORM("19", "南瑞平台", ""),
|
NAN_RUI_PLATFORM("19", "南瑞平台", ""),
|
||||||
|
|
||||||
|
GUANG_XI_PLATFORM("20", "广西平台", ""),
|
||||||
;
|
;
|
||||||
|
|
||||||
private String typeCode;
|
private String typeCode;
|
||||||
|
|||||||
@@ -75,4 +75,28 @@ public class QueryStartChargeDTO {
|
|||||||
* 支付方式(1-余额支付;3-白名单支付;4-微信支付;5-支付宝支付)
|
* 支付方式(1-余额支付;3-白名单支付;4-微信支付;5-支付宝支付)
|
||||||
*/
|
*/
|
||||||
private String payMode;
|
private String payMode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询页码
|
||||||
|
*/
|
||||||
|
@JsonProperty(value = "PageNo")
|
||||||
|
private Integer pageNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 每页数量
|
||||||
|
*/
|
||||||
|
@JsonProperty(value = "PageSize")
|
||||||
|
private Integer pageSize;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上次查询时间
|
||||||
|
*/
|
||||||
|
@JsonProperty(value = "LastQueryTime")
|
||||||
|
private String lastQueryTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上次查询结束时间
|
||||||
|
*/
|
||||||
|
@JsonProperty(value = "LastQueryEndTime")
|
||||||
|
private String lastQueryEndTime;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,6 +70,12 @@ public class QueryStationInfoDTO {
|
|||||||
@JsonProperty(value = "StationIDs")
|
@JsonProperty(value = "StationIDs")
|
||||||
private List<String> stationIds;
|
private List<String> stationIds;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更多标志
|
||||||
|
*/
|
||||||
|
@JsonProperty(value = "MoreFlag")
|
||||||
|
private Integer moreFlag;
|
||||||
|
|
||||||
|
|
||||||
private String address;
|
private String address;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.jsowell.pile.mapper;
|
package com.jsowell.pile.mapper;
|
||||||
|
|
||||||
|
import com.alipay.api.domain.ChargeOrderInfo;
|
||||||
import com.jsowell.pile.domain.OrderBasicInfo;
|
import com.jsowell.pile.domain.OrderBasicInfo;
|
||||||
import com.jsowell.pile.domain.OrderDetail;
|
import com.jsowell.pile.domain.OrderDetail;
|
||||||
import com.jsowell.pile.dto.*;
|
import com.jsowell.pile.dto.*;
|
||||||
@@ -394,4 +395,11 @@ public interface OrderBasicInfoMapper {
|
|||||||
|
|
||||||
|
|
||||||
List<String> tempGetOrderCodes(QueryOrderDTO dto);
|
List<String> tempGetOrderCodes(QueryOrderDTO dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询第三方平台订单列表
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<OrderVO> selectThirdPartyOrderList(@Param("dto") QueryStartChargeDTO dto);
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.jsowell.pile.service;
|
package com.jsowell.pile.service;
|
||||||
|
|
||||||
|
import com.alipay.api.domain.ChargeOrderInfo;
|
||||||
import com.huifu.adapay.core.exception.BaseAdaPayException;
|
import com.huifu.adapay.core.exception.BaseAdaPayException;
|
||||||
import com.jsowell.adapay.response.PaymentReverseResponse;
|
import com.jsowell.adapay.response.PaymentReverseResponse;
|
||||||
import com.jsowell.adapay.vo.OrderSplitResult;
|
import com.jsowell.adapay.vo.OrderSplitResult;
|
||||||
@@ -476,6 +477,12 @@ public interface OrderBasicInfoService{
|
|||||||
*/
|
*/
|
||||||
void createReservationOrder(ReservationChargingStartupResult chargingStartupResult);
|
void createReservationOrder(ReservationChargingStartupResult chargingStartupResult);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询第三方平台订单列表
|
||||||
|
* @param dto
|
||||||
|
*/
|
||||||
|
List<OrderVO> selectThirdPartyOrderList(QueryStartChargeDTO dto);
|
||||||
|
|
||||||
|
|
||||||
//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ 后管小程序 ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
|
//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ 后管小程序 ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.jsowell.pile.service.impl;
|
|||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.alipay.api.domain.ChargeOrderInfo;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
@@ -2592,7 +2593,18 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<AccumulativeInfoVO> getAccumulativeInfoForLianLian(QueryStationInfoDTO dto) {
|
public List<AccumulativeInfoVO> getAccumulativeInfoForLianLian(QueryStationInfoDTO dto) {
|
||||||
return orderBasicInfoMapper.getAccumulativeInfoForLianLian(dto);
|
List<AccumulativeInfoVO> accumulativeInfoList = orderBasicInfoMapper.getAccumulativeInfoForLianLian(dto);
|
||||||
|
for (AccumulativeInfoVO accumulativeInfoVO : accumulativeInfoList) {
|
||||||
|
String startTime = accumulativeInfoVO.getStartTime();
|
||||||
|
String endTime = accumulativeInfoVO.getEndTime();
|
||||||
|
if (startTime == null || endTime == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// 计算充电时长
|
||||||
|
int chargingTime = Integer.parseInt(String.valueOf(DateUtils.intervalTime(startTime, endTime))) * 60;
|
||||||
|
accumulativeInfoVO.setChargingTime(String.valueOf(chargingTime));
|
||||||
|
}
|
||||||
|
return accumulativeInfoList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -4096,6 +4108,15 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
|||||||
orderPayRecordService.batchInsert(Lists.newArrayList(principalPayRecord));
|
orderPayRecordService.batchInsert(Lists.newArrayList(principalPayRecord));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询第三方平订单列表
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<OrderVO> selectThirdPartyOrderList(QueryStartChargeDTO dto) {
|
||||||
|
return orderBasicInfoMapper.selectThirdPartyOrderList(dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1224,7 +1224,6 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService {
|
|||||||
public List<EquipmentInfo> getPileListForLianLian(String stationId) {
|
public List<EquipmentInfo> getPileListForLianLian(String stationId) {
|
||||||
List<EquipmentInfo> resultList = new ArrayList<>();
|
List<EquipmentInfo> resultList = new ArrayList<>();
|
||||||
// 通过站点id查询桩基本信息
|
// 通过站点id查询桩基本信息
|
||||||
// List<PileBasicInfo> list = this.getPileListByStationId(stationId);
|
|
||||||
List<PileDetailInfoVO> list = getPileDetailInfoList(stationId);
|
List<PileDetailInfoVO> list = getPileDetailInfoList(stationId);
|
||||||
// 封装成联联平台对象
|
// 封装成联联平台对象
|
||||||
for (PileDetailInfoVO pileDetailInfoVO : list) {
|
for (PileDetailInfoVO pileDetailInfoVO : list) {
|
||||||
@@ -1245,19 +1244,6 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService {
|
|||||||
equipmentInfo.setEquipmentType(Integer.valueOf(pileDetailInfoVO.getSpeedType()));
|
equipmentInfo.setEquipmentType(Integer.valueOf(pileDetailInfoVO.getSpeedType()));
|
||||||
equipmentInfo.setEquipmentModel(pileDetailInfoVO.getModelName());
|
equipmentInfo.setEquipmentModel(pileDetailInfoVO.getModelName());
|
||||||
|
|
||||||
// Map<String, String> pileStatus = pileConnectorInfoService.getPileStatus(Lists.newArrayList(pileBasicInfo.getSn()));
|
|
||||||
// Map<String, String> pileStatusMap = pileConnectorInfoService.getPileStatus(Lists.newArrayList(pileSn));
|
|
||||||
// String pileStatus = pileStatusMap.get(pileSn);
|
|
||||||
// if (StringUtils.equals(PileStatusEnum.ON_LINE.getValue(), pileStatus)) {
|
|
||||||
// // 1-在线
|
|
||||||
// pileStatus = LianLianPileStatusEnum.NORMAL.getCode();
|
|
||||||
// } else if (StringUtils.equals(PileStatusEnum.OFF_LINE.getValue(), pileStatus)) {
|
|
||||||
// // 2-离线
|
|
||||||
// pileStatus = LianLianPileStatusEnum.CLOSE_OFFLINE.getCode();
|
|
||||||
// } else if (StringUtils.equals(PileStatusEnum.FAULT.getValue(), pileStatus)) {
|
|
||||||
// // 3-故障
|
|
||||||
// pileStatus = LianLianPileStatusEnum.UNDER_MAINTENANCE.getCode();
|
|
||||||
// }
|
|
||||||
equipmentInfo.setEquipmentStatus(Integer.valueOf(pileDetailInfoVO.getPileStatus()));
|
equipmentInfo.setEquipmentStatus(Integer.valueOf(pileDetailInfoVO.getPileStatus()));
|
||||||
equipmentInfo.setEquipmentPower(new BigDecimal(pileDetailInfoVO.getRatedPower()).setScale(1, BigDecimal.ROUND_HALF_UP));
|
equipmentInfo.setEquipmentPower(new BigDecimal(pileDetailInfoVO.getRatedPower()).setScale(1, BigDecimal.ROUND_HALF_UP));
|
||||||
equipmentInfo.setNewNationalStandard(1);
|
equipmentInfo.setNewNationalStandard(1);
|
||||||
|
|||||||
@@ -41,6 +41,11 @@ public class AccumulativeInfoVO {
|
|||||||
*/
|
*/
|
||||||
private String endTime;
|
private String endTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充电时长
|
||||||
|
*/
|
||||||
|
private String chargingTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 枪口充电量
|
* 枪口充电量
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -4,48 +4,48 @@
|
|||||||
<resultMap id="BaseResultMap" type="com.jsowell.pile.domain.OrderBasicInfo">
|
<resultMap id="BaseResultMap" type="com.jsowell.pile.domain.OrderBasicInfo">
|
||||||
<!--@mbg.generated-->
|
<!--@mbg.generated-->
|
||||||
<!--@Table order_basic_info-->
|
<!--@Table order_basic_info-->
|
||||||
<id column="id" jdbcType="INTEGER" property="id" />
|
<id column="id" jdbcType="INTEGER" property="id"/>
|
||||||
<result column="order_code" jdbcType="VARCHAR" property="orderCode" />
|
<result column="order_code" jdbcType="VARCHAR" property="orderCode"/>
|
||||||
<result column="transaction_code" jdbcType="VARCHAR" property="transactionCode" />
|
<result column="transaction_code" jdbcType="VARCHAR" property="transactionCode"/>
|
||||||
<result column="order_status" jdbcType="VARCHAR" property="orderStatus" />
|
<result column="order_status" jdbcType="VARCHAR" property="orderStatus"/>
|
||||||
<result column="member_id" jdbcType="VARCHAR" property="memberId" />
|
<result column="member_id" jdbcType="VARCHAR" property="memberId"/>
|
||||||
<result column="station_id" jdbcType="VARCHAR" property="stationId" />
|
<result column="station_id" jdbcType="VARCHAR" property="stationId"/>
|
||||||
<result column="merchant_id" jdbcType="VARCHAR" property="merchantId" />
|
<result column="merchant_id" jdbcType="VARCHAR" property="merchantId"/>
|
||||||
<result column="pile_sn" jdbcType="VARCHAR" property="pileSn" />
|
<result column="pile_sn" jdbcType="VARCHAR" property="pileSn"/>
|
||||||
<result column="connector_code" jdbcType="VARCHAR" property="connectorCode" />
|
<result column="connector_code" jdbcType="VARCHAR" property="connectorCode"/>
|
||||||
<result column="pile_connector_code" jdbcType="VARCHAR" property="pileConnectorCode" />
|
<result column="pile_connector_code" jdbcType="VARCHAR" property="pileConnectorCode"/>
|
||||||
<result column="logic_card" jdbcType="VARCHAR" property="logicCard" />
|
<result column="logic_card" jdbcType="VARCHAR" property="logicCard"/>
|
||||||
<result column="vin_code" jdbcType="VARCHAR" property="vinCode" />
|
<result column="vin_code" jdbcType="VARCHAR" property="vinCode"/>
|
||||||
<result column="start_mode" jdbcType="VARCHAR" property="startMode" />
|
<result column="start_mode" jdbcType="VARCHAR" property="startMode"/>
|
||||||
<result column="third_party_type" jdbcType="VARCHAR" property="thirdPartyType" />
|
<result column="third_party_type" jdbcType="VARCHAR" property="thirdPartyType"/>
|
||||||
<result column="pay_mode" jdbcType="VARCHAR" property="payMode" />
|
<result column="pay_mode" jdbcType="VARCHAR" property="payMode"/>
|
||||||
<result column="pay_status" jdbcType="VARCHAR" property="payStatus" />
|
<result column="pay_status" jdbcType="VARCHAR" property="payStatus"/>
|
||||||
<result column="pay_amount" jdbcType="DECIMAL" property="payAmount" />
|
<result column="pay_amount" jdbcType="DECIMAL" property="payAmount"/>
|
||||||
<result column="pay_time" jdbcType="TIMESTAMP" property="payTime" />
|
<result column="pay_time" jdbcType="TIMESTAMP" property="payTime"/>
|
||||||
<result column="plate_number" jdbcType="VARCHAR" property="plateNumber" />
|
<result column="plate_number" jdbcType="VARCHAR" property="plateNumber"/>
|
||||||
<result column="order_amount" jdbcType="DECIMAL" property="orderAmount" />
|
<result column="order_amount" jdbcType="DECIMAL" property="orderAmount"/>
|
||||||
<result column="virtual_amount" jdbcType="DECIMAL" property="virtualAmount" />
|
<result column="virtual_amount" jdbcType="DECIMAL" property="virtualAmount"/>
|
||||||
<result column="group_code" jdbcType="VARCHAR" property="groupCode" />
|
<result column="group_code" jdbcType="VARCHAR" property="groupCode"/>
|
||||||
<result column="discount_amount" jdbcType="DECIMAL" property="discountAmount" />
|
<result column="discount_amount" jdbcType="DECIMAL" property="discountAmount"/>
|
||||||
<result column="settle_amount" jdbcType="DECIMAL" property="settleAmount" />
|
<result column="settle_amount" jdbcType="DECIMAL" property="settleAmount"/>
|
||||||
<result column="remedial_amount" jdbcType="DECIMAL" property="remedialAmount" />
|
<result column="remedial_amount" jdbcType="DECIMAL" property="remedialAmount"/>
|
||||||
<result column="charge_start_time" jdbcType="TIMESTAMP" property="chargeStartTime" />
|
<result column="charge_start_time" jdbcType="TIMESTAMP" property="chargeStartTime"/>
|
||||||
<result column="charge_end_time" jdbcType="TIMESTAMP" property="chargeEndTime" />
|
<result column="charge_end_time" jdbcType="TIMESTAMP" property="chargeEndTime"/>
|
||||||
<result column="start_type" jdbcType="VARCHAR" property="startType" />
|
<result column="start_type" jdbcType="VARCHAR" property="startType"/>
|
||||||
<result column="reserved_start_time" jdbcType="TIMESTAMP" property="reservedStartTime" />
|
<result column="reserved_start_time" jdbcType="TIMESTAMP" property="reservedStartTime"/>
|
||||||
<result column="reserved_end_time" jdbcType="TIMESTAMP" property="reservedEndTime" />
|
<result column="reserved_end_time" jdbcType="TIMESTAMP" property="reservedEndTime"/>
|
||||||
<result column="start_soc" jdbcType="VARCHAR" property="startSoc" />
|
<result column="start_soc" jdbcType="VARCHAR" property="startSoc"/>
|
||||||
<result column="end_soc" jdbcType="VARCHAR" property="endSoc" />
|
<result column="end_soc" jdbcType="VARCHAR" property="endSoc"/>
|
||||||
<result column="stop_reason_code" jdbcType="VARCHAR" property="stopReasonCode" />
|
<result column="stop_reason_code" jdbcType="VARCHAR" property="stopReasonCode"/>
|
||||||
<result column="reason" jdbcType="VARCHAR" property="reason" />
|
<result column="reason" jdbcType="VARCHAR" property="reason"/>
|
||||||
<result column="settlement_time" jdbcType="TIMESTAMP" property="settlementTime" />
|
<result column="settlement_time" jdbcType="TIMESTAMP" property="settlementTime"/>
|
||||||
<result column="refund_amount" jdbcType="DECIMAL" property="refundAmount" />
|
<result column="refund_amount" jdbcType="DECIMAL" property="refundAmount"/>
|
||||||
<result column="refund_status" jdbcType="VARCHAR" property="refundStatus" />
|
<result column="refund_status" jdbcType="VARCHAR" property="refundStatus"/>
|
||||||
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
|
<result column="create_by" jdbcType="VARCHAR" property="createBy"/>
|
||||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
|
||||||
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
|
<result column="update_by" jdbcType="VARCHAR" property="updateBy"/>
|
||||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
|
||||||
<result column="del_flag" jdbcType="CHAR" property="delFlag" />
|
<result column="del_flag" jdbcType="CHAR" property="delFlag"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
<!--@mbg.generated-->
|
<!--@mbg.generated-->
|
||||||
@@ -53,13 +53,14 @@
|
|||||||
pile_sn, connector_code, pile_connector_code, logic_card, vin_code, start_mode, third_party_type,
|
pile_sn, connector_code, pile_connector_code, logic_card, vin_code, start_mode, third_party_type,
|
||||||
pay_mode, pay_status, pay_amount, pay_time, plate_number, order_amount, virtual_amount,
|
pay_mode, pay_status, pay_amount, pay_time, plate_number, order_amount, virtual_amount,
|
||||||
group_code, discount_amount, settle_amount, remedial_amount, charge_start_time, charge_end_time,
|
group_code, discount_amount, settle_amount, remedial_amount, charge_start_time, charge_end_time,
|
||||||
start_type, reserved_start_time, reserved_end_time, start_soc, end_soc, stop_reason_code, reason, settlement_time, refund_amount,
|
start_type, reserved_start_time, reserved_end_time, start_soc, end_soc, stop_reason_code, reason,
|
||||||
|
settlement_time, refund_amount,
|
||||||
refund_status, create_by, create_time, update_by, update_time, del_flag
|
refund_status, create_by, create_time, update_by, update_time, del_flag
|
||||||
</sql>
|
</sql>
|
||||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||||
<!--@mbg.generated-->
|
<!--@mbg.generated-->
|
||||||
select
|
select
|
||||||
<include refid="Base_Column_List" />
|
<include refid="Base_Column_List"/>
|
||||||
from order_basic_info
|
from order_basic_info
|
||||||
where id = #{id,jdbcType=INTEGER}
|
where id = #{id,jdbcType=INTEGER}
|
||||||
</select>
|
</select>
|
||||||
@@ -68,7 +69,8 @@
|
|||||||
delete from order_basic_info
|
delete from order_basic_info
|
||||||
where id = #{id,jdbcType=INTEGER}
|
where id = #{id,jdbcType=INTEGER}
|
||||||
</delete>
|
</delete>
|
||||||
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.OrderBasicInfo" useGeneratedKeys="true">
|
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.OrderBasicInfo"
|
||||||
|
useGeneratedKeys="true">
|
||||||
<!--@mbg.generated-->
|
<!--@mbg.generated-->
|
||||||
insert into order_basic_info (order_code, transaction_code, order_status,
|
insert into order_basic_info (order_code, transaction_code, order_status,
|
||||||
member_id, station_id, merchant_id,
|
member_id, station_id, merchant_id,
|
||||||
@@ -101,7 +103,8 @@
|
|||||||
#{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{delFlag,jdbcType=CHAR}
|
#{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{delFlag,jdbcType=CHAR}
|
||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.OrderBasicInfo" useGeneratedKeys="true">
|
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.OrderBasicInfo"
|
||||||
|
useGeneratedKeys="true">
|
||||||
<!--@mbg.generated-->
|
<!--@mbg.generated-->
|
||||||
insert into order_basic_info
|
insert into order_basic_info
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
@@ -1050,30 +1053,40 @@
|
|||||||
pile_sn, connector_code, pile_connector_code, logic_card, vin_code, start_mode,
|
pile_sn, connector_code, pile_connector_code, logic_card, vin_code, start_mode,
|
||||||
third_party_type, pay_mode, pay_status, pay_amount, pay_time, plate_number, order_amount,
|
third_party_type, pay_mode, pay_status, pay_amount, pay_time, plate_number, order_amount,
|
||||||
virtual_amount, group_code, discount_amount, settle_amount, remedial_amount, charge_start_time,
|
virtual_amount, group_code, discount_amount, settle_amount, remedial_amount, charge_start_time,
|
||||||
charge_end_time, start_type, reserved_start_time, reserved_end_time, start_soc, end_soc, stop_reason_code, reason, settlement_time,
|
charge_end_time, start_type, reserved_start_time, reserved_end_time, start_soc, end_soc, stop_reason_code,
|
||||||
|
reason, settlement_time,
|
||||||
refund_amount, refund_status, create_by, create_time, update_by, update_time, del_flag
|
refund_amount, refund_status, create_by, create_time, update_by, update_time, del_flag
|
||||||
)
|
)
|
||||||
values
|
values
|
||||||
<foreach collection="list" item="item" separator=",">
|
<foreach collection="list" item="item" separator=",">
|
||||||
(#{item.orderCode,jdbcType=VARCHAR}, #{item.transactionCode,jdbcType=VARCHAR}, #{item.orderStatus,jdbcType=VARCHAR},
|
(#{item.orderCode,jdbcType=VARCHAR}, #{item.transactionCode,jdbcType=VARCHAR},
|
||||||
|
#{item.orderStatus,jdbcType=VARCHAR},
|
||||||
#{item.memberId,jdbcType=VARCHAR}, #{item.stationId,jdbcType=VARCHAR}, #{item.merchantId,jdbcType=VARCHAR},
|
#{item.memberId,jdbcType=VARCHAR}, #{item.stationId,jdbcType=VARCHAR}, #{item.merchantId,jdbcType=VARCHAR},
|
||||||
#{item.pileSn,jdbcType=VARCHAR}, #{item.connectorCode,jdbcType=VARCHAR}, #{item.pileConnectorCode,jdbcType=VARCHAR},
|
#{item.pileSn,jdbcType=VARCHAR}, #{item.connectorCode,jdbcType=VARCHAR},
|
||||||
|
#{item.pileConnectorCode,jdbcType=VARCHAR},
|
||||||
#{item.logicCard,jdbcType=VARCHAR}, #{item.vinCode,jdbcType=VARCHAR}, #{item.startMode,jdbcType=VARCHAR},
|
#{item.logicCard,jdbcType=VARCHAR}, #{item.vinCode,jdbcType=VARCHAR}, #{item.startMode,jdbcType=VARCHAR},
|
||||||
#{item.thirdPartyType,jdbcType=VARCHAR}, #{item.payMode,jdbcType=VARCHAR}, #{item.payStatus,jdbcType=VARCHAR},
|
#{item.thirdPartyType,jdbcType=VARCHAR}, #{item.payMode,jdbcType=VARCHAR},
|
||||||
#{item.payAmount,jdbcType=DECIMAL}, #{item.payTime,jdbcType=TIMESTAMP}, #{item.plateNumber,jdbcType=VARCHAR},
|
#{item.payStatus,jdbcType=VARCHAR},
|
||||||
#{item.orderAmount,jdbcType=DECIMAL}, #{item.virtualAmount,jdbcType=DECIMAL}, #{item.groupCode,jdbcType=VARCHAR},
|
#{item.payAmount,jdbcType=DECIMAL}, #{item.payTime,jdbcType=TIMESTAMP},
|
||||||
|
#{item.plateNumber,jdbcType=VARCHAR},
|
||||||
|
#{item.orderAmount,jdbcType=DECIMAL}, #{item.virtualAmount,jdbcType=DECIMAL},
|
||||||
|
#{item.groupCode,jdbcType=VARCHAR},
|
||||||
#{item.discountAmount,jdbcType=DECIMAL}, #{item.settleAmount,jdbcType=DECIMAL},
|
#{item.discountAmount,jdbcType=DECIMAL}, #{item.settleAmount,jdbcType=DECIMAL},
|
||||||
#{item.remedialAmount,jdbcType=DECIMAL}, #{item.chargeStartTime,jdbcType=TIMESTAMP},
|
#{item.remedialAmount,jdbcType=DECIMAL}, #{item.chargeStartTime,jdbcType=TIMESTAMP},
|
||||||
#{item.chargeEndTime,jdbcType=TIMESTAMP}, #{item.startType,jdbcType=VARCHAR}, #{item.reservedStartTime,jdbcType=TIMESTAMP},
|
#{item.chargeEndTime,jdbcType=TIMESTAMP}, #{item.startType,jdbcType=VARCHAR},
|
||||||
|
#{item.reservedStartTime,jdbcType=TIMESTAMP},
|
||||||
#{item.reservedEndTime,jdbcType=TIMESTAMP},
|
#{item.reservedEndTime,jdbcType=TIMESTAMP},
|
||||||
#{item.startSoc,jdbcType=VARCHAR}, #{item.endSoc,jdbcType=VARCHAR}, #{item.stopReasonCode,jdbcType=VARCHAR}, #{item.reason,jdbcType=VARCHAR},
|
#{item.startSoc,jdbcType=VARCHAR}, #{item.endSoc,jdbcType=VARCHAR}, #{item.stopReasonCode,jdbcType=VARCHAR},
|
||||||
|
#{item.reason,jdbcType=VARCHAR},
|
||||||
#{item.settlementTime,jdbcType=TIMESTAMP}, #{item.refundAmount,jdbcType=DECIMAL},
|
#{item.settlementTime,jdbcType=TIMESTAMP}, #{item.refundAmount,jdbcType=DECIMAL},
|
||||||
#{item.refundStatus,jdbcType=VARCHAR}, #{item.createBy,jdbcType=VARCHAR}, #{item.createTime,jdbcType=TIMESTAMP},
|
#{item.refundStatus,jdbcType=VARCHAR}, #{item.createBy,jdbcType=VARCHAR},
|
||||||
|
#{item.createTime,jdbcType=TIMESTAMP},
|
||||||
#{item.updateBy,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP}, #{item.delFlag,jdbcType=CHAR}
|
#{item.updateBy,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP}, #{item.delFlag,jdbcType=CHAR}
|
||||||
)
|
)
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insertOrUpdate" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.OrderBasicInfo" useGeneratedKeys="true">
|
<insert id="insertOrUpdate" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.OrderBasicInfo"
|
||||||
|
useGeneratedKeys="true">
|
||||||
<!--@mbg.generated-->
|
<!--@mbg.generated-->
|
||||||
insert into order_basic_info
|
insert into order_basic_info
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
@@ -1217,7 +1230,8 @@
|
|||||||
del_flag = #{delFlag,jdbcType=CHAR},
|
del_flag = #{delFlag,jdbcType=CHAR},
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insertOrUpdateSelective" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.OrderBasicInfo" useGeneratedKeys="true">
|
<insert id="insertOrUpdateSelective" keyColumn="id" keyProperty="id"
|
||||||
|
parameterType="com.jsowell.pile.domain.OrderBasicInfo" useGeneratedKeys="true">
|
||||||
<!--@mbg.generated-->
|
<!--@mbg.generated-->
|
||||||
insert into order_basic_info
|
insert into order_basic_info
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
@@ -1608,47 +1622,49 @@
|
|||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<resultMap extends="BaseResultMap" id="OrderBasicInfoOrderDetailResult" type="com.jsowell.pile.domain.OrderBasicInfo">
|
<resultMap extends="BaseResultMap" id="OrderBasicInfoOrderDetailResult"
|
||||||
<collection javaType="java.util.List" notNullColumn="sub_id" property="orderDetailList" resultMap="OrderDetailResult" />
|
type="com.jsowell.pile.domain.OrderBasicInfo">
|
||||||
|
<collection javaType="java.util.List" notNullColumn="sub_id" property="orderDetailList"
|
||||||
|
resultMap="OrderDetailResult"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<resultMap id="OrderDetailResult" type="com.jsowell.pile.domain.OrderDetail">
|
<resultMap id="OrderDetailResult" type="com.jsowell.pile.domain.OrderDetail">
|
||||||
<result column="id" property="id" />
|
<result column="id" property="id"/>
|
||||||
<result column="order_code" property="orderCode" />
|
<result column="order_code" property="orderCode"/>
|
||||||
<result column="total_used_electricity" property="totalUsedElectricity" />
|
<result column="total_used_electricity" property="totalUsedElectricity"/>
|
||||||
<result column="total_order_amount" property="totalOrderAmount" />
|
<result column="total_order_amount" property="totalOrderAmount"/>
|
||||||
<result column="total_electricity_amount" property="totalElectricityAmount" />
|
<result column="total_electricity_amount" property="totalElectricityAmount"/>
|
||||||
<result column="total_service_amount" property="totalServiceAmount" />
|
<result column="total_service_amount" property="totalServiceAmount"/>
|
||||||
<result column="sharp_price" property="sharpPrice" />
|
<result column="sharp_price" property="sharpPrice"/>
|
||||||
<result column="sharp_used_electricity" property="sharpUsedElectricity" />
|
<result column="sharp_used_electricity" property="sharpUsedElectricity"/>
|
||||||
<result column="sharp_electricity_price" property="sharpElectricityPrice" />
|
<result column="sharp_electricity_price" property="sharpElectricityPrice"/>
|
||||||
<result column="sharp_service_price" property="sharpServicePrice" />
|
<result column="sharp_service_price" property="sharpServicePrice"/>
|
||||||
<result column="sharp_amount" property="sharpAmount" />
|
<result column="sharp_amount" property="sharpAmount"/>
|
||||||
<result column="peak_price" property="peakPrice" />
|
<result column="peak_price" property="peakPrice"/>
|
||||||
<result column="peak_used_electricity" property="peakUsedElectricity" />
|
<result column="peak_used_electricity" property="peakUsedElectricity"/>
|
||||||
<result column="peak_electricity_price" property="peakElectricityPrice" />
|
<result column="peak_electricity_price" property="peakElectricityPrice"/>
|
||||||
<result column="peak_service_price" property="peakServicePrice" />
|
<result column="peak_service_price" property="peakServicePrice"/>
|
||||||
<result column="peak_amount" property="peakAmount" />
|
<result column="peak_amount" property="peakAmount"/>
|
||||||
<result column="flat_price" property="flatPrice" />
|
<result column="flat_price" property="flatPrice"/>
|
||||||
<result column="flat_used_electricity" property="flatUsedElectricity" />
|
<result column="flat_used_electricity" property="flatUsedElectricity"/>
|
||||||
<result column="flat_electricity_price" property="flatElectricityPrice" />
|
<result column="flat_electricity_price" property="flatElectricityPrice"/>
|
||||||
<result column="flat_service_price" property="flatServicePrice" />
|
<result column="flat_service_price" property="flatServicePrice"/>
|
||||||
<result column="flat_amount" property="flatAmount" />
|
<result column="flat_amount" property="flatAmount"/>
|
||||||
<result column="valley_price" property="valleyPrice" />
|
<result column="valley_price" property="valleyPrice"/>
|
||||||
<result column="valley_used_electricity" property="valleyUsedElectricity" />
|
<result column="valley_used_electricity" property="valleyUsedElectricity"/>
|
||||||
<result column="valley_electricity_price" property="valleyElectricityPrice" />
|
<result column="valley_electricity_price" property="valleyElectricityPrice"/>
|
||||||
<result column="valley_service_price" property="valleyServicePrice" />
|
<result column="valley_service_price" property="valleyServicePrice"/>
|
||||||
<result column="valley_amount" property="valleyAmount" />
|
<result column="valley_amount" property="valleyAmount"/>
|
||||||
<result column="create_by" property="createBy" />
|
<result column="create_by" property="createBy"/>
|
||||||
<result column="create_time" property="createTime" />
|
<result column="create_time" property="createTime"/>
|
||||||
<result column="update_by" property="updateBy" />
|
<result column="update_by" property="updateBy"/>
|
||||||
<result column="update_time" property="updateTime" />
|
<result column="update_time" property="updateTime"/>
|
||||||
<result column="del_flag" property="delFlag" />
|
<result column="del_flag" property="delFlag"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectOrderBasicInfoVo">
|
<sql id="selectOrderBasicInfoVo">
|
||||||
select
|
select
|
||||||
<include refid="Base_Column_List" />
|
<include refid="Base_Column_List"/>
|
||||||
from order_basic_info
|
from order_basic_info
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
@@ -1785,7 +1801,8 @@
|
|||||||
order by t1.create_time desc
|
order by t1.create_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getOrderTotalData" parameterType="com.jsowell.pile.dto.QueryOrderDTO" resultType="com.jsowell.pile.vo.web.OrderTotalDataVO">
|
<select id="getOrderTotalData" parameterType="com.jsowell.pile.dto.QueryOrderDTO"
|
||||||
|
resultType="com.jsowell.pile.vo.web.OrderTotalDataVO">
|
||||||
select
|
select
|
||||||
IFNULL(sum(t1.order_amount),0) as sumOrderAmount,
|
IFNULL(sum(t1.order_amount),0) as sumOrderAmount,
|
||||||
IFNULL(sum(t4.total_used_electricity),0) as sumUsedElectricity,
|
IFNULL(sum(t4.total_used_electricity),0) as sumUsedElectricity,
|
||||||
@@ -1897,7 +1914,8 @@
|
|||||||
where a.id = #{id}
|
where a.id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertOrderBasicInfo" keyProperty="id" parameterType="com.jsowell.pile.domain.OrderBasicInfo" useGeneratedKeys="true">
|
<insert id="insertOrderBasicInfo" keyProperty="id" parameterType="com.jsowell.pile.domain.OrderBasicInfo"
|
||||||
|
useGeneratedKeys="true">
|
||||||
insert into order_basic_info
|
insert into order_basic_info
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
<if test="orderCode != null">
|
<if test="orderCode != null">
|
||||||
@@ -2392,7 +2410,7 @@
|
|||||||
|
|
||||||
<select id="getOrderInfoByOrderCode" resultMap="BaseResultMap">
|
<select id="getOrderInfoByOrderCode" resultMap="BaseResultMap">
|
||||||
select
|
select
|
||||||
<include refid="Base_Column_List" />
|
<include refid="Base_Column_List"/>
|
||||||
from order_basic_info
|
from order_basic_info
|
||||||
<where>
|
<where>
|
||||||
order_code = #{orderCode,jdbcType=VARCHAR}
|
order_code = #{orderCode,jdbcType=VARCHAR}
|
||||||
@@ -2402,7 +2420,7 @@
|
|||||||
|
|
||||||
<select id="getOrderInfoByTransactionCode" resultMap="BaseResultMap">
|
<select id="getOrderInfoByTransactionCode" resultMap="BaseResultMap">
|
||||||
select
|
select
|
||||||
<include refid="Base_Column_List" />
|
<include refid="Base_Column_List"/>
|
||||||
from order_basic_info
|
from order_basic_info
|
||||||
where del_flag = '0'
|
where del_flag = '0'
|
||||||
and transaction_code = #{transactionCode,jdbcType=VARCHAR}
|
and transaction_code = #{transactionCode,jdbcType=VARCHAR}
|
||||||
@@ -2410,7 +2428,7 @@
|
|||||||
|
|
||||||
<select id="queryOrderBasicInfo" resultMap="BaseResultMap">
|
<select id="queryOrderBasicInfo" resultMap="BaseResultMap">
|
||||||
select
|
select
|
||||||
<include refid="Base_Column_List" />
|
<include refid="Base_Column_List"/>
|
||||||
from order_basic_info
|
from order_basic_info
|
||||||
where del_flag = '0'
|
where del_flag = '0'
|
||||||
and pile_sn = #{pileSn,jdbcType=VARCHAR}
|
and pile_sn = #{pileSn,jdbcType=VARCHAR}
|
||||||
@@ -2422,7 +2440,7 @@
|
|||||||
|
|
||||||
<select id="getOrderDetailByOrderCode" resultMap="OrderDetailResult">
|
<select id="getOrderDetailByOrderCode" resultMap="OrderDetailResult">
|
||||||
select
|
select
|
||||||
<include refid="Detail_Base_Column_List" />
|
<include refid="Detail_Base_Column_List"/>
|
||||||
from order_detail
|
from order_detail
|
||||||
where del_flag = '0'
|
where del_flag = '0'
|
||||||
and order_code = #{orderCode,jdbcType=VARCHAR}
|
and order_code = #{orderCode,jdbcType=VARCHAR}
|
||||||
@@ -2504,18 +2522,19 @@
|
|||||||
|
|
||||||
<select id="getUnpaidOrderListOver15Min" resultMap="BaseResultMap">
|
<select id="getUnpaidOrderListOver15Min" resultMap="BaseResultMap">
|
||||||
select
|
select
|
||||||
<include refid="Base_Column_List" />
|
<include refid="Base_Column_List"/>
|
||||||
from order_basic_info
|
from order_basic_info
|
||||||
where del_flag = '0'
|
where del_flag = '0'
|
||||||
and order_status = '0'
|
and order_status = '0'
|
||||||
and pay_status = '0'
|
and pay_status = '0'
|
||||||
<!--and create_time <![CDATA[ <= ]]> #{createTime,jdbcType=VARCHAR}-->
|
<!--and create_time <![CDATA[ <= ]]> #{createTime,jdbcType=VARCHAR}-->
|
||||||
and create_time between date_sub(#{createTime,jdbcType=VARCHAR}, interval 15 minute) and #{createTime,jdbcType=VARCHAR}
|
and create_time between date_sub(#{createTime,jdbcType=VARCHAR}, interval 15 minute) and
|
||||||
|
#{createTime,jdbcType=VARCHAR}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getUnpaidOrderList" resultMap="BaseResultMap">
|
<select id="getUnpaidOrderList" resultMap="BaseResultMap">
|
||||||
select
|
select
|
||||||
<include refid="Base_Column_List" />
|
<include refid="Base_Column_List"/>
|
||||||
from order_basic_info
|
from order_basic_info
|
||||||
where del_flag = '0'
|
where del_flag = '0'
|
||||||
and order_status = '0'
|
and order_status = '0'
|
||||||
@@ -2525,7 +2544,7 @@
|
|||||||
|
|
||||||
<select id="selectOrderListByTimeRangeAndStatus" resultMap="BaseResultMap">
|
<select id="selectOrderListByTimeRangeAndStatus" resultMap="BaseResultMap">
|
||||||
select
|
select
|
||||||
<include refid="Base_Column_List" />
|
<include refid="Base_Column_List"/>
|
||||||
from order_basic_info
|
from order_basic_info
|
||||||
where del_flag = '0'
|
where del_flag = '0'
|
||||||
and start_mode != '4'
|
and start_mode != '4'
|
||||||
@@ -2578,7 +2597,7 @@
|
|||||||
|
|
||||||
<select id="getOrderBasicInfo" resultMap="BaseResultMap">
|
<select id="getOrderBasicInfo" resultMap="BaseResultMap">
|
||||||
select
|
select
|
||||||
<include refid="Base_Column_List" />
|
<include refid="Base_Column_List"/>
|
||||||
from order_basic_info
|
from order_basic_info
|
||||||
where del_flag = '0'
|
where del_flag = '0'
|
||||||
<if test="memberId != null and memberId != ''">
|
<if test="memberId != null and memberId != ''">
|
||||||
@@ -2647,6 +2666,8 @@
|
|||||||
t1.pile_connector_code as pileConnectorCode,
|
t1.pile_connector_code as pileConnectorCode,
|
||||||
t1.pile_sn as pileSn,
|
t1.pile_sn as pileSn,
|
||||||
t1.station_id as stationId,
|
t1.station_id as stationId,
|
||||||
|
t1.charge_start_time as startTime,
|
||||||
|
t1.charge_end_time as endTime,
|
||||||
IFNULL(t2.total_used_electricity, 0.00) as connectorElectricity
|
IFNULL(t2.total_used_electricity, 0.00) as connectorElectricity
|
||||||
FROM order_basic_info t1
|
FROM order_basic_info t1
|
||||||
JOIN order_detail t2 ON t1.order_code = t2.order_code
|
JOIN order_detail t2 ON t1.order_code = t2.order_code
|
||||||
@@ -2658,7 +2679,7 @@
|
|||||||
|
|
||||||
<select id="queryElecAmountNullList" resultMap="OrderDetailResult">
|
<select id="queryElecAmountNullList" resultMap="OrderDetailResult">
|
||||||
select
|
select
|
||||||
<include refid="Detail_Base_Column_List" />
|
<include refid="Detail_Base_Column_List"/>
|
||||||
from order_detail
|
from order_detail
|
||||||
where del_flag = '0'
|
where del_flag = '0'
|
||||||
and total_order_amount is not null
|
and total_order_amount is not null
|
||||||
@@ -2692,7 +2713,7 @@
|
|||||||
|
|
||||||
<select id="getOrderDetailList" resultMap="OrderDetailResult">
|
<select id="getOrderDetailList" resultMap="OrderDetailResult">
|
||||||
select
|
select
|
||||||
<include refid="Detail_Base_Column_List" />
|
<include refid="Detail_Base_Column_List"/>
|
||||||
from order_detail
|
from order_detail
|
||||||
where del_flag = '0'
|
where del_flag = '0'
|
||||||
and order_code in
|
and order_code in
|
||||||
@@ -2702,7 +2723,7 @@
|
|||||||
</select>
|
</select>
|
||||||
<select id="tempQueryWeChatRefundOrders" resultMap="BaseResultMap">
|
<select id="tempQueryWeChatRefundOrders" resultMap="BaseResultMap">
|
||||||
select
|
select
|
||||||
<include refid="Base_Column_List" />
|
<include refid="Base_Column_List"/>
|
||||||
from order_basic_info
|
from order_basic_info
|
||||||
where del_flag = '0'
|
where del_flag = '0'
|
||||||
and pay_mode = '4'
|
and pay_mode = '4'
|
||||||
@@ -2750,7 +2771,7 @@
|
|||||||
|
|
||||||
<select id="queryOrderList" resultMap="BaseResultMap">
|
<select id="queryOrderList" resultMap="BaseResultMap">
|
||||||
select
|
select
|
||||||
<include refid="Base_Column_List" />
|
<include refid="Base_Column_List"/>
|
||||||
from order_basic_info
|
from order_basic_info
|
||||||
where del_flag = '0'
|
where del_flag = '0'
|
||||||
and order_code in
|
and order_code in
|
||||||
@@ -2796,10 +2817,8 @@
|
|||||||
<update id="updateMerchantByStationId">
|
<update id="updateMerchantByStationId">
|
||||||
update
|
update
|
||||||
order_basic_info
|
order_basic_info
|
||||||
set
|
set merchant_id = #{newMerchantId,jdbcType=VARCHAR}
|
||||||
merchant_id = #{newMerchantId,jdbcType=VARCHAR}
|
where station_id = #{stationId,jdbcType=BIGINT}
|
||||||
where
|
|
||||||
station_id = #{stationId,jdbcType=BIGINT}
|
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<select id="getNROrderInfoByOrderCode" resultType="com.jsowell.pile.vo.nanrui.JiangSuOrderInfoVO">
|
<select id="getNROrderInfoByOrderCode" resultType="com.jsowell.pile.vo.nanrui.JiangSuOrderInfoVO">
|
||||||
@@ -2828,14 +2847,14 @@
|
|||||||
and t1.order_code = #{dto.orderCode,jdbcType=VARCHAR}
|
and t1.order_code = #{dto.orderCode,jdbcType=VARCHAR}
|
||||||
</if>
|
</if>
|
||||||
<if test="dto.queryStartTime != null and dto.queryStartTime != '' and dto.queryEndTime != null and dto.queryEndTime != ''">
|
<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}
|
and t1.charge_end_time between #{dto.queryStartTime,jdbcType=VARCHAR} and
|
||||||
|
#{dto.queryEndTime,jdbcType=VARCHAR}
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="queryOrderPayDetail" resultType="com.jsowell.pile.vo.web.OrderPaymentDetailVO">
|
<select id="queryOrderPayDetail" resultType="com.jsowell.pile.vo.web.OrderPaymentDetailVO">
|
||||||
select
|
select t1.order_code as orderCode,
|
||||||
t1.order_code as orderCode,
|
|
||||||
t1.create_time as createTime,
|
t1.create_time as createTime,
|
||||||
t1.settlement_time as settlementTime,
|
t1.settlement_time as settlementTime,
|
||||||
t1.`pay_amount` as payAmount,
|
t1.`pay_amount` as payAmount,
|
||||||
@@ -2900,8 +2919,7 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getChargeOrderInfoByOrderCode" resultType="com.jsowell.pile.vo.uniapp.customer.OrderVO">
|
<select id="getChargeOrderInfoByOrderCode" resultType="com.jsowell.pile.vo.uniapp.customer.OrderVO">
|
||||||
SELECT
|
SELECT t1.merchant_id as mercahntId,
|
||||||
t1.merchant_id as mercahntId,
|
|
||||||
t3.organization_code as organizationCode,
|
t3.organization_code as organizationCode,
|
||||||
t1.order_code AS orderCode,
|
t1.order_code AS orderCode,
|
||||||
t1.transaction_code AS transactionCode,
|
t1.transaction_code AS transactionCode,
|
||||||
@@ -2928,21 +2946,18 @@
|
|||||||
t2.total_used_electricity AS totalPower,
|
t2.total_used_electricity AS totalPower,
|
||||||
t2.total_electricity_amount AS totalElectricityAmount,
|
t2.total_electricity_amount AS totalElectricityAmount,
|
||||||
t2.total_service_amount AS totalServiceAmount
|
t2.total_service_amount AS totalServiceAmount
|
||||||
FROM
|
FROM order_basic_info t1
|
||||||
order_basic_info t1
|
|
||||||
JOIN
|
JOIN
|
||||||
order_detail t2 ON t1.order_code = t2.order_code
|
order_detail t2 ON t1.order_code = t2.order_code
|
||||||
join
|
join
|
||||||
pile_merchant_info t3 on t1.merchant_id = t3.id
|
pile_merchant_info t3 on t1.merchant_id = t3.id
|
||||||
WHERE
|
WHERE t1.del_flag = '0'
|
||||||
t1.del_flag = '0'
|
AND t1.order_code = #{orderCode,jdbcType=VARCHAR}
|
||||||
AND
|
|
||||||
t1.order_code = #{orderCode,jdbcType=VARCHAR}
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getReservedOrder" resultMap="BaseResultMap">
|
<select id="getReservedOrder" resultMap="BaseResultMap">
|
||||||
select
|
select
|
||||||
<include refid="Base_Column_List" />
|
<include refid="Base_Column_List"/>
|
||||||
from order_basic_info
|
from order_basic_info
|
||||||
where del_flag = '0'
|
where del_flag = '0'
|
||||||
and pay_status = '1'
|
and pay_status = '1'
|
||||||
@@ -2952,8 +2967,7 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="queryOrderListByStationId" resultType="com.jsowell.pile.vo.SupStationStatsVO">
|
<select id="queryOrderListByStationId" resultType="com.jsowell.pile.vo.SupStationStatsVO">
|
||||||
SELECT
|
SELECT t1.order_code as orderCode,
|
||||||
t1.order_code as orderCode,
|
|
||||||
t3.organization_code as organizationCode,
|
t3.organization_code as organizationCode,
|
||||||
t1.station_id AS stationId,
|
t1.station_id AS stationId,
|
||||||
t1.pile_sn AS pileSn,
|
t1.pile_sn AS pileSn,
|
||||||
@@ -2961,14 +2975,12 @@
|
|||||||
t1.charge_start_time AS StartTime,
|
t1.charge_start_time AS StartTime,
|
||||||
t1.charge_end_time AS EndTime,
|
t1.charge_end_time AS EndTime,
|
||||||
t2.total_used_electricity AS totalPower
|
t2.total_used_electricity AS totalPower
|
||||||
FROM
|
FROM order_basic_info t1
|
||||||
order_basic_info t1
|
|
||||||
JOIN order_detail t2 ON t1.order_code = t2.order_code
|
JOIN order_detail t2 ON t1.order_code = t2.order_code
|
||||||
AND t1.del_flag = '0'
|
AND t1.del_flag = '0'
|
||||||
JOIN pile_merchant_info t3 on t1.merchant_id = t3.id
|
JOIN pile_merchant_info t3 on t1.merchant_id = t3.id
|
||||||
WHERE
|
WHERE t1.station_id = #{stationId,jdbcType=VARCHAR}
|
||||||
t1.station_id = #{stationId,jdbcType=VARCHAR}
|
AND t1.charge_start_time <![CDATA[ >= ]]> DATE_SUB(CURDATE(), INTERVAL 1 DAY)
|
||||||
AND t1.charge_start_time <![CDATA[ >= ]]> DATE_SUB( CURDATE(), INTERVAL 1 DAY )
|
|
||||||
AND t1.charge_start_time <![CDATA[ < ]]> CURDATE()
|
AND t1.charge_start_time <![CDATA[ < ]]> CURDATE()
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@@ -3024,8 +3036,8 @@
|
|||||||
<select id="getOrderDetailByStationIds" resultType="com.jsowell.pile.vo.uniapp.business.BusinessOrderDetailInfoVO">
|
<select id="getOrderDetailByStationIds" resultType="com.jsowell.pile.vo.uniapp.business.BusinessOrderDetailInfoVO">
|
||||||
SELECT
|
SELECT
|
||||||
DATE_FORMAT( t1.create_time, '%Y-%m-%d' ) AS tradeDate,
|
DATE_FORMAT( t1.create_time, '%Y-%m-%d' ) AS tradeDate,
|
||||||
<!-- t1.order_code AS orderCode,-->
|
<!-- t1.order_code AS orderCode,-->
|
||||||
<!-- t1.station_id AS stationId,-->
|
<!-- t1.station_id AS stationId,-->
|
||||||
t1.pile_connector_code as pileConnectorCode,
|
t1.pile_connector_code as pileConnectorCode,
|
||||||
t2.sharp_used_electricity AS sharpUsedElectricity,
|
t2.sharp_used_electricity AS sharpUsedElectricity,
|
||||||
t2.sharp_amount AS sharpAmount,
|
t2.sharp_amount AS sharpAmount,
|
||||||
@@ -3050,13 +3062,14 @@
|
|||||||
<foreach collection="stationIds" item="stationId" open="(" separator="," close=")">
|
<foreach collection="stationIds" item="stationId" open="(" separator="," close=")">
|
||||||
#{stationId,jdbcType=VARCHAR}
|
#{stationId,jdbcType=VARCHAR}
|
||||||
</foreach>
|
</foreach>
|
||||||
AND t1.create_time BETWEEN #{startTime,jdbcType=VARCHAR} AND DATE_ADD(#{endTime,jdbcType=VARCHAR}, INTERVAL 1 DAY)
|
AND t1.create_time BETWEEN #{startTime,jdbcType=VARCHAR} AND DATE_ADD(#{endTime,jdbcType=VARCHAR}, INTERVAL 1
|
||||||
|
DAY)
|
||||||
order by t1.create_time
|
order by t1.create_time
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="queryOrdersByPileConnectorCodeAndStatus" resultMap="BaseResultMap">
|
<select id="queryOrdersByPileConnectorCodeAndStatus" resultMap="BaseResultMap">
|
||||||
select
|
select
|
||||||
<include refid="Base_Column_List" />
|
<include refid="Base_Column_List"/>
|
||||||
from order_basic_info
|
from order_basic_info
|
||||||
where del_flag = '0'
|
where del_flag = '0'
|
||||||
and pile_connector_code = #{pileConnectorCode,jdbcType=VARCHAR}
|
and pile_connector_code = #{pileConnectorCode,jdbcType=VARCHAR}
|
||||||
@@ -3072,12 +3085,32 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="tempGetOrderCodes" resultType="java.lang.String">
|
<select id="tempGetOrderCodes" resultType="java.lang.String">
|
||||||
select
|
select order_code
|
||||||
order_code
|
from order_basic_info
|
||||||
from
|
where station_id = #{stationId,jdbcType=VARCHAR}
|
||||||
order_basic_info
|
|
||||||
where
|
|
||||||
station_id = #{stationId,jdbcType=VARCHAR}
|
|
||||||
and create_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
|
and create_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectThirdPartyOrderList" resultType="com.jsowell.pile.vo.uniapp.customer.OrderVO">
|
||||||
|
select t1.order_code as orderCode,
|
||||||
|
t1.start_mode as startMode,
|
||||||
|
t1.pile_connector_code as pileConnectorCode,
|
||||||
|
t1.charge_start_time as startTime,
|
||||||
|
t1.charge_end_time as endTime,
|
||||||
|
t2.total_used_electricity as totalPower,
|
||||||
|
t2.total_electricity_amount as totalElectricityAmount,
|
||||||
|
t2.total_service_amount as totalServiceAmount,
|
||||||
|
t1.order_amount as orderAmount
|
||||||
|
from order_basic_info t1
|
||||||
|
join order_detail t2 on t1.order_code = t2.order_code
|
||||||
|
and t1.del_flag = '0'
|
||||||
|
<where>
|
||||||
|
<if test="dto.lastQueryTime != null and dto.lastQueryTime != ''">
|
||||||
|
and t1.create_time <![CDATA[ >= ]]> #{dto.lastQueryTime,jdbcType=VARCHAR}
|
||||||
|
</if>
|
||||||
|
<if test="dto.lastQueryEndTime != null and dto.lastQueryEndTime != ''">
|
||||||
|
and t1.create_time <![CDATA[ <= ]]> #{dto.lastQueryEndTime,jdbcType=VARCHAR}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -29,4 +29,16 @@ public class ConnectorStatsInfo {
|
|||||||
*/
|
*/
|
||||||
@JSONField(name = "ConnectorElectricity")
|
@JSONField(name = "ConnectorElectricity")
|
||||||
private BigDecimal connectorElectricity;
|
private BigDecimal connectorElectricity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充电时长(单位:s)
|
||||||
|
*/
|
||||||
|
@JSONField(name = "ConnectorDuration")
|
||||||
|
private Integer connectorDuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充电次数
|
||||||
|
*/
|
||||||
|
@JSONField(name = "ConnectorNum")
|
||||||
|
private Integer connectorNum;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,18 @@ public class EquipmentStatsInfo {
|
|||||||
@JSONField(name = "EquipmentElectricity")
|
@JSONField(name = "EquipmentElectricity")
|
||||||
private BigDecimal equipmentElectricity;
|
private BigDecimal equipmentElectricity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充电时长(单位:s)
|
||||||
|
*/
|
||||||
|
@JSONField(name = "ConnectorDuration")
|
||||||
|
private Integer connectorDuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充电次数
|
||||||
|
*/
|
||||||
|
@JSONField(name = "ConnectorNum")
|
||||||
|
private Integer connectorNum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 充电设备接口统计信息列表 Y
|
* 充电设备接口统计信息列表 Y
|
||||||
* 充设备的所有充电设备接口统计对象集合
|
* 充设备的所有充电设备接口统计对象集合
|
||||||
|
|||||||
@@ -44,6 +44,18 @@ public class StationStatsInfo {
|
|||||||
@JSONField(name = "StationElectricity")
|
@JSONField(name = "StationElectricity")
|
||||||
private BigDecimal stationElectricity;
|
private BigDecimal stationElectricity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充电时长(单位:s)
|
||||||
|
*/
|
||||||
|
@JSONField(name = "ConnectorDuration")
|
||||||
|
private Integer connectorDuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充电次数
|
||||||
|
*/
|
||||||
|
@JSONField(name = "ConnectorNum")
|
||||||
|
private Integer connectorNum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 充电设备统计信息列表
|
* 充电设备统计信息列表
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -51,6 +51,12 @@ public class ChargeOrderInfo {
|
|||||||
@JSONField(name = "ConnectorID")
|
@JSONField(name = "ConnectorID")
|
||||||
private String connectorId;
|
private String connectorId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户发起充电类型
|
||||||
|
*/
|
||||||
|
@JSONField(name = "StartChargeType")
|
||||||
|
private Integer startChargeType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 充电订单号
|
* 充电订单号
|
||||||
*/
|
*/
|
||||||
@@ -110,6 +116,19 @@ public class ChargeOrderInfo {
|
|||||||
@JSONField(name = "TotalElecMoney")
|
@JSONField(name = "TotalElecMoney")
|
||||||
private BigDecimal totalElecMoney;
|
private BigDecimal totalElecMoney;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 累计电费
|
||||||
|
*/
|
||||||
|
@JSONField(name = "ElecMoney")
|
||||||
|
private BigDecimal elecMoney;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 累计服务费
|
||||||
|
*/
|
||||||
|
@JSONField(name = "SeviceMoney")
|
||||||
|
private BigDecimal seviceMoney;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 本次充电服务费金额
|
* 本次充电服务费金额
|
||||||
* 保留小数点后 2 位
|
* 保留小数点后 2 位
|
||||||
|
|||||||
@@ -68,6 +68,12 @@ public class StationInfo extends BaseStationInfo {
|
|||||||
@JSONField(name = "AreaCode")
|
@JSONField(name = "AreaCode")
|
||||||
private String areaCode;
|
private String areaCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 街道编码
|
||||||
|
*/
|
||||||
|
@JSONField(name = "StreetCode")
|
||||||
|
private String streetCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 详细地址 Y
|
* 详细地址 Y
|
||||||
* <=50字符
|
* <=50字符
|
||||||
@@ -254,6 +260,20 @@ public class StationInfo extends BaseStationInfo {
|
|||||||
@JSONField(name = "EquipmentInfos")
|
@JSONField(name = "EquipmentInfos")
|
||||||
private List<EquipmentInfo> equipmentInfos;
|
private List<EquipmentInfo> equipmentInfos;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 投建日期
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@JSONField(name = "RunDate")
|
||||||
|
private String runDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 投建日期
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@JSONField(name = "BuildDate")
|
||||||
|
private String buildDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否独立报桩 (0-否;1-是) Y
|
* 是否独立报桩 (0-否;1-是) Y
|
||||||
* 如果是独立报桩需要填写户号以及容量
|
* 如果是独立报桩需要填写户号以及容量
|
||||||
|
|||||||
@@ -205,6 +205,16 @@ public interface ThirdPartyPlatformService extends InitializingBean {
|
|||||||
throw new UnsupportedOperationException("This method is not yet implemented");
|
throw new UnsupportedOperationException("This method is not yet implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询已完成订单列表信息接口
|
||||||
|
* query_finish_orders
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
default Map<String, String> queryFinishOrders(QueryStartChargeDTO dto) {
|
||||||
|
throw new UnsupportedOperationException("This method is not yet implemented");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VIN码充电 insert_start_charge
|
* VIN码充电 insert_start_charge
|
||||||
* 华为平台
|
* 华为平台
|
||||||
|
|||||||
@@ -1,8 +1,63 @@
|
|||||||
package com.jsowell.thirdparty.platform.service.impl;
|
package com.jsowell.thirdparty.platform.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSON;
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.jsowell.common.constant.Constants;
|
||||||
|
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
|
||||||
|
import com.jsowell.common.core.redis.RedisCache;
|
||||||
|
import com.jsowell.common.enums.thirdparty.BusinessInformationExchangeEnum;
|
||||||
|
import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum;
|
||||||
|
import com.jsowell.common.enums.ykc.OrderStatusEnum;
|
||||||
|
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
||||||
|
import com.jsowell.common.enums.ykc.StartModeEnum;
|
||||||
|
import com.jsowell.common.exception.BusinessException;
|
||||||
|
import com.jsowell.common.util.DateUtils;
|
||||||
|
import com.jsowell.common.util.JWTUtils;
|
||||||
|
import com.jsowell.common.util.PageUtils;
|
||||||
|
import com.jsowell.common.util.StringUtils;
|
||||||
|
import com.jsowell.pile.domain.AreaCodeInfo;
|
||||||
|
import com.jsowell.pile.domain.OrderBasicInfo;
|
||||||
|
import com.jsowell.pile.domain.OrderDetail;
|
||||||
|
import com.jsowell.pile.dto.QueryStartChargeDTO;
|
||||||
|
import com.jsowell.pile.dto.QueryStationInfoDTO;
|
||||||
|
import com.jsowell.pile.service.*;
|
||||||
|
import com.jsowell.pile.thirdparty.CommonParamsDTO;
|
||||||
|
import com.jsowell.pile.thirdparty.EquipmentInfo;
|
||||||
|
import com.jsowell.pile.vo.ThirdPartySecretInfoVO;
|
||||||
|
import com.jsowell.pile.vo.base.ConnectorInfoVO;
|
||||||
|
import com.jsowell.pile.vo.base.MerchantInfoVO;
|
||||||
|
import com.jsowell.pile.vo.base.ThirdPartyStationInfoVO;
|
||||||
|
import com.jsowell.pile.vo.lianlian.AccumulativeInfoVO;
|
||||||
|
import com.jsowell.pile.vo.uniapp.customer.BillingPriceVO;
|
||||||
|
import com.jsowell.pile.vo.uniapp.customer.OrderVO;
|
||||||
|
import com.jsowell.pile.vo.web.PileConnectorInfoVO;
|
||||||
|
import com.jsowell.pile.vo.web.PileStationVO;
|
||||||
|
import com.jsowell.thirdparty.lianlian.domain.*;
|
||||||
|
import com.jsowell.thirdparty.lianlian.vo.AccessTokenVO;
|
||||||
|
import com.jsowell.thirdparty.platform.common.ChargeOrderInfo;
|
||||||
|
import com.jsowell.thirdparty.platform.domain.SupChargeDetails;
|
||||||
|
import com.jsowell.thirdparty.platform.domain.SupEquipChargeStatusInfo;
|
||||||
|
import com.jsowell.thirdparty.platform.domain.SupStationInfo;
|
||||||
|
import com.jsowell.thirdparty.platform.factory.ThirdPartyPlatformFactory;
|
||||||
import com.jsowell.thirdparty.platform.service.ThirdPartyPlatformService;
|
import com.jsowell.thirdparty.platform.service.ThirdPartyPlatformService;
|
||||||
|
import com.jsowell.thirdparty.platform.util.Cryptos;
|
||||||
|
import com.jsowell.thirdparty.platform.util.HttpRequestUtil;
|
||||||
|
import com.jsowell.thirdparty.platform.util.ThirdPartyPlatformUtils;
|
||||||
|
import com.jsowell.thirdparty.service.ThirdpartySecretInfoService;
|
||||||
|
import com.yi.business.geo.GeoCodeInfo;
|
||||||
|
import com.yi.business.geo.TermRelationTreeCoordinate;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 广西省平台Service
|
* 广西省平台Service
|
||||||
*
|
*
|
||||||
@@ -11,9 +66,609 @@ import org.springframework.stereotype.Service;
|
|||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class GuangXiPlatformServiceImpl implements ThirdPartyPlatformService {
|
public class GuangXiPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||||
|
// 平台类型
|
||||||
|
private final String thirdPlatformType = ThirdPlatformTypeEnum.GUANG_XI_PLATFORM.getTypeCode();
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RedisCache redisCache;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ThirdpartySecretInfoService thirdpartySecretInfoService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PileStationInfoService pileStationInfoService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PileBasicInfoService pileBasicInfoService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PileBillingTemplateService pileBillingTemplateService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PileConnectorInfoService pileConnectorInfoService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private OrderBasicInfoService orderBasicInfoService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IAreaCodeInfoService areaCodeInfoService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterPropertiesSet() throws Exception {
|
public void afterPropertiesSet() throws Exception {
|
||||||
|
ThirdPartyPlatformFactory.register(thirdPlatformType, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询令牌 query_token
|
||||||
|
*
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Map<String, String> queryToken(CommonParamsDTO dto) {
|
||||||
|
AccessTokenVO vo = new AccessTokenVO();
|
||||||
|
// 0:成功;1:失败
|
||||||
|
int succStat = 0;
|
||||||
|
// 0:无;1:无此对接平台;2:密钥错误; 3~99:自定义
|
||||||
|
int failReason = 0;
|
||||||
|
|
||||||
|
String operatorId = dto.getOperatorID();
|
||||||
|
// token缓存key值
|
||||||
|
String redisKey = operatorId + "_token:";
|
||||||
|
// 通过operatorId 查出 operatorSecret
|
||||||
|
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getGuangXiSecretInfo();
|
||||||
|
if (thirdPartySecretInfoVO == null) {
|
||||||
|
failReason = 1;
|
||||||
|
succStat = 1;
|
||||||
|
} else {
|
||||||
|
String ourOperatorSecret = thirdPartySecretInfoVO.getOurOperatorSecret();
|
||||||
|
String dataSecret = thirdPartySecretInfoVO.getOurDataSecret();
|
||||||
|
String dataSecretIv = thirdPartySecretInfoVO.getOurDataSecretIv();
|
||||||
|
// 解密data 获取参数中的OperatorSecret
|
||||||
|
String decrypt = Cryptos.decrypt(dto.getData(), dataSecret, dataSecretIv);
|
||||||
|
String inputOperatorSecret = null;
|
||||||
|
if (StringUtils.isNotBlank(decrypt)) {
|
||||||
|
inputOperatorSecret = JSON.parseObject(decrypt).getString("OperatorSecret");
|
||||||
|
}
|
||||||
|
// 对比密钥
|
||||||
|
if (!StringUtils.equals(ourOperatorSecret, inputOperatorSecret)) {
|
||||||
|
failReason = 1;
|
||||||
|
succStat = 1;
|
||||||
|
} else {
|
||||||
|
// 先查缓存中是否有已生成的token
|
||||||
|
String token = redisCache.getCacheObject(redisKey);
|
||||||
|
int expiredTime = (int) redisCache.getExpire(redisKey);
|
||||||
|
if (StringUtils.isBlank(token)) {
|
||||||
|
// 生成token
|
||||||
|
token = JWTUtils.createToken(operatorId, ourOperatorSecret, JWTUtils.ttlMillis);
|
||||||
|
expiredTime = (int) (JWTUtils.ttlMillis / 1000);
|
||||||
|
}
|
||||||
|
vo.setAccessToken(token);
|
||||||
|
vo.setTokenAvailableTime(expiredTime);
|
||||||
|
// 设置缓存
|
||||||
|
redisCache.setCacheObject(redisKey, token, expiredTime, TimeUnit.SECONDS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 组装返回参数
|
||||||
|
vo.setOperatorID(operatorId);
|
||||||
|
vo.setFailReason(failReason);
|
||||||
|
vo.setSuccStat(succStat);
|
||||||
|
|
||||||
|
Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMapV2(vo, thirdPartySecretInfoVO.getOurDataSecret()
|
||||||
|
, thirdPartySecretInfoVO.getOurDataSecretIv(), thirdPartySecretInfoVO.getOurSigSecret());
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询充电站信息 query_stations_info
|
||||||
|
*
|
||||||
|
* @param dto 查询站点信息dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Map<String, String> queryStationsInfo(QueryStationInfoDTO dto) {
|
||||||
|
int pageNo = dto.getPageNo() == null ? 1 : dto.getPageNo();
|
||||||
|
int pageSize = dto.getPageSize() == null ? 50 : dto.getPageSize();
|
||||||
|
dto.setThirdPlatformType(thirdPlatformType);
|
||||||
|
|
||||||
|
PageUtils.startPage(pageNo, pageSize);
|
||||||
|
List<ThirdPartyStationInfoVO> stationInfos = pileStationInfoService.selectStationInfosByThirdParty(dto);
|
||||||
|
if (CollectionUtils.isEmpty(stationInfos)) {
|
||||||
|
// 未查到数据
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getGuangXiSecretInfo();
|
||||||
|
|
||||||
|
PageInfo<ThirdPartyStationInfoVO> pageInfo = new PageInfo<>(stationInfos);
|
||||||
|
List<SupStationInfo> resultList = new ArrayList<>();
|
||||||
|
for (ThirdPartyStationInfoVO pileStationInfo : pageInfo.getList()) {
|
||||||
|
SupStationInfo info = SupStationInfo.builder()
|
||||||
|
.stationID(String.valueOf(pileStationInfo.getId()))
|
||||||
|
.operatorID(Constants.OPERATORID_JIANG_SU)
|
||||||
|
.equipmentOwnerID(ThirdPartyPlatformUtils.extractEquipmentOwnerID(pileStationInfo.getOrganizationCode()))
|
||||||
|
.stationName(pileStationInfo.getStationName())
|
||||||
|
.countryCode(pileStationInfo.getCountryCode())
|
||||||
|
// .areaCode()
|
||||||
|
// .streetCode()
|
||||||
|
.address(pileStationInfo.getAddress())
|
||||||
|
.serviceTel(pileStationInfo.getServiceTel())
|
||||||
|
.stationType(Integer.parseInt(pileStationInfo.getStationType()))
|
||||||
|
.stationStatus(Integer.parseInt(pileStationInfo.getStationStatus()))
|
||||||
|
.parkNums(Integer.parseInt(pileStationInfo.getParkNums()))
|
||||||
|
.stationLng(new BigDecimal(pileStationInfo.getStationLng()))
|
||||||
|
.stationLat(new BigDecimal(pileStationInfo.getStationLat()))
|
||||||
|
.construction(Integer.parseInt(pileStationInfo.getConstruction()))
|
||||||
|
// .electricityFee()
|
||||||
|
// .serviceFee()
|
||||||
|
// .equipmentInfos()
|
||||||
|
.runDate(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, pileStationInfo.getCreateTime()))
|
||||||
|
.buildDate(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, pileStationInfo.getCreateTime()))
|
||||||
|
|
||||||
|
.build();
|
||||||
|
|
||||||
|
JSONObject electricityFee = new JSONObject();
|
||||||
|
JSONObject serviceFee = new JSONObject();
|
||||||
|
// 查询计费模板
|
||||||
|
List<BillingPriceVO> priceList = pileBillingTemplateService.queryBillingPrice(String.valueOf(pileStationInfo.getId()));
|
||||||
|
for (BillingPriceVO billingPriceVO : priceList) {
|
||||||
|
electricityFee.put(billingPriceVO.getStartTime() + ":00-" + billingPriceVO.getEndTime() + ":00", billingPriceVO.getElectricityPrice());
|
||||||
|
serviceFee.put(billingPriceVO.getStartTime() + ":00-" + billingPriceVO.getEndTime() + ":00", billingPriceVO.getServicePrice());
|
||||||
|
}
|
||||||
|
info.setElectricityFee(electricityFee.toJSONString());
|
||||||
|
info.setServiceFee(serviceFee.toJSONString());
|
||||||
|
|
||||||
|
// AreaCode
|
||||||
|
String areaCode = pileStationInfo.getAreaCode(); // 330000,330200,330213
|
||||||
|
// 根据逗号分组
|
||||||
|
String[] split = StringUtils.split(areaCode, ",");
|
||||||
|
// 只取最后一部分 330213
|
||||||
|
String subAreaCode = split[split.length - 1];
|
||||||
|
info.setAreaCode(subAreaCode);
|
||||||
|
|
||||||
|
List<EquipmentInfo> pileList = pileBasicInfoService.getPileListForLianLian(String.valueOf(pileStationInfo.getId()));
|
||||||
|
if (CollectionUtils.isNotEmpty(pileList)) {
|
||||||
|
info.setEquipmentInfos(pileList); // 充电设备信息列表
|
||||||
|
}
|
||||||
|
|
||||||
|
// areaCodeCountryside
|
||||||
|
GeoCodeInfo geoCode = TermRelationTreeCoordinate.completeGeoCode(pileStationInfo.getAddress());
|
||||||
|
if (geoCode == null) {
|
||||||
|
// String areaCodeCountryside = geoCode.getCounty_code();
|
||||||
|
info.setStreetCode("123456789101");
|
||||||
|
} else {
|
||||||
|
AreaCodeInfo areaCodeInfo = new AreaCodeInfo();
|
||||||
|
if (StringUtils.isNotBlank(geoCode.getTownName())) {
|
||||||
|
String townName = geoCode.getTownName();
|
||||||
|
areaCodeInfo.setName(townName);
|
||||||
|
} else {
|
||||||
|
String countyName = geoCode.getCountyName();
|
||||||
|
areaCodeInfo.setName(countyName);
|
||||||
|
}
|
||||||
|
List<AreaCodeInfo> areaCodeInfoList = areaCodeInfoService.selectAreaCodeInfoList(areaCodeInfo);
|
||||||
|
info.setStreetCode(String.valueOf(areaCodeInfoList.get(0).getAreaCode()));
|
||||||
|
}
|
||||||
|
resultList.add(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
|
map.put("PageNo", pageInfo.getPageNum());
|
||||||
|
map.put("PageCount", pageInfo.getPages());
|
||||||
|
map.put("ItemSize", pageInfo.getTotal());
|
||||||
|
map.put("StationInfos", resultList);
|
||||||
|
Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMapV2(map, thirdPartySecretInfoVO.getOurDataSecret(),
|
||||||
|
thirdPartySecretInfoVO.getOurDataSecretIv(), thirdPartySecretInfoVO.getTheirSigSecret());
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备接口状态查询接口 query_station_status
|
||||||
|
* @param dto 查询站点信息dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Map<String, String> queryStationStatus(QueryStationInfoDTO dto) {
|
||||||
|
List<String> stationIds = dto.getStationIds();
|
||||||
|
List<StationStatusInfo> stationStatusInfos = new ArrayList<>();
|
||||||
|
List<Object> connectorStatusInfos = new ArrayList<>();
|
||||||
|
// 查询密钥信息
|
||||||
|
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getGuangXiSecretInfo();
|
||||||
|
|
||||||
|
// 根据站点idList查询枪口列表
|
||||||
|
List<ConnectorInfoVO> list = pileConnectorInfoService.batchSelectConnectorList(stationIds);
|
||||||
|
// 根据站点id分组
|
||||||
|
Map<String, List<ConnectorInfoVO>> collect = list.stream()
|
||||||
|
.collect(Collectors.groupingBy(ConnectorInfoVO::getStationId));
|
||||||
|
// 封装参数
|
||||||
|
for (Map.Entry<String, List<ConnectorInfoVO>> entry : collect.entrySet()) {
|
||||||
|
String stationId = entry.getKey();
|
||||||
|
List<ConnectorInfoVO> voList = entry.getValue();
|
||||||
|
StationStatusInfo stationStatusInfo = new StationStatusInfo();
|
||||||
|
|
||||||
|
stationStatusInfo.setStationId(stationId);
|
||||||
|
stationStatusInfo.setStationStatus(50); // 50-正常使用
|
||||||
|
ConnectorStatusInfo connectorStatusInfo;
|
||||||
|
for (ConnectorInfoVO connectorInfoVO : voList) {
|
||||||
|
connectorStatusInfo = ConnectorStatusInfo.builder()
|
||||||
|
.connectorID(connectorInfoVO.getPileConnectorCode())
|
||||||
|
.status(Integer.parseInt(connectorInfoVO.getConnectorStatus()))
|
||||||
|
|
||||||
|
.build();
|
||||||
|
connectorStatusInfos.add(connectorStatusInfo);
|
||||||
|
}
|
||||||
|
stationStatusInfo.setConnectorStatusInfos(connectorStatusInfos);
|
||||||
|
|
||||||
|
stationStatusInfos.add(stationStatusInfo);
|
||||||
|
}
|
||||||
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
|
map.put("StationStatusInfos", stationStatusInfos);
|
||||||
|
|
||||||
|
Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMapV2(map, thirdPartySecretInfoVO.getOurDataSecret(),
|
||||||
|
thirdPartySecretInfoVO.getOurDataSecretIv(), thirdPartySecretInfoVO.getTheirSigSecret());
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 推送设备状态变化接口 notification_stationStatus
|
||||||
|
* @param stationId 站点id
|
||||||
|
* @param pileConnectorCode 充电桩枪口编号
|
||||||
|
* @param status
|
||||||
|
* @param secretInfoVO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String notificationStationStatus(String stationId, String pileConnectorCode, String status, ThirdPartySecretInfoVO secretInfoVO) {
|
||||||
|
// 查询相关配置信息
|
||||||
|
ThirdPartySecretInfoVO ganSuSecretInfo = getGuangXiSecretInfo();
|
||||||
|
|
||||||
|
String operatorId = Constants.OPERATORID_JIANG_SU;
|
||||||
|
String operatorSecret = ganSuSecretInfo.getTheirOperatorSecret();
|
||||||
|
String signSecret = ganSuSecretInfo.getTheirSigSecret();
|
||||||
|
String dataSecret = ganSuSecretInfo.getTheirDataSecret();
|
||||||
|
String dataSecretIv = ganSuSecretInfo.getTheirDataSecretIv();
|
||||||
|
String urlAddress = ganSuSecretInfo.getTheirUrlPrefix();
|
||||||
|
|
||||||
|
String url = urlAddress + BusinessInformationExchangeEnum.NOTIFICATION_STATION_STATUS.getValue();
|
||||||
|
ConnectorStatusInfo info = ConnectorStatusInfo.builder()
|
||||||
|
.connectorID(pileConnectorCode)
|
||||||
|
.status(Integer.parseInt(status))
|
||||||
|
.build();
|
||||||
|
// 调用联联平台接口
|
||||||
|
JSONObject json = new JSONObject();
|
||||||
|
json.put("DataType", Constants.ZERO);
|
||||||
|
json.put("ConnectorStatusInfo", info);
|
||||||
|
String jsonString = JSON.toJSONString(json);
|
||||||
|
// 获取令牌
|
||||||
|
String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);
|
||||||
|
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询统计信息接口 query_station_stats
|
||||||
|
* @param dto 查询站点信息dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Map<String, String> queryStationStats(QueryStationInfoDTO dto) {
|
||||||
|
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getGuangXiSecretInfo();
|
||||||
|
// 根据站点id 查出这段时间的充电量
|
||||||
|
List<AccumulativeInfoVO> list = orderBasicInfoService.getAccumulativeInfoForLianLian(dto);
|
||||||
|
if (CollectionUtils.isEmpty(list)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据充电桩编号分组 key=充电桩编号
|
||||||
|
Map<String, List<AccumulativeInfoVO>> pileMap = list.stream()
|
||||||
|
.collect(Collectors.groupingBy(AccumulativeInfoVO::getPileSn));
|
||||||
|
|
||||||
|
// 存放所有充电桩设备
|
||||||
|
List<EquipmentStatsInfo> equipmentStatsInfoList = Lists.newArrayList();
|
||||||
|
// 站点用电量
|
||||||
|
BigDecimal stationElectricity = BigDecimal.ZERO;
|
||||||
|
int stationChargingTime = Constants.zero;
|
||||||
|
// 用于记录桩充电量 在循环每个枪口的时候初始化
|
||||||
|
BigDecimal pileElec;
|
||||||
|
// 桩充电次数
|
||||||
|
int pileChargingNum;
|
||||||
|
// 桩充电时长
|
||||||
|
int pileChargingTime;
|
||||||
|
for (String pileSn : pileMap.keySet()) {
|
||||||
|
// 该充电桩下 所有枪口的用电数据
|
||||||
|
List<AccumulativeInfoVO> accumulativeInfoVOS = pileMap.get(pileSn);
|
||||||
|
if (CollectionUtils.isEmpty(accumulativeInfoVOS)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// 存放充电桩用电量
|
||||||
|
pileElec = BigDecimal.ZERO;
|
||||||
|
// 充电桩充电次数
|
||||||
|
pileChargingNum = Constants.zero;
|
||||||
|
// 充电桩充电时长
|
||||||
|
pileChargingTime = Constants.zero;
|
||||||
|
|
||||||
|
// key=枪口编号 value 该枪口的用电数据
|
||||||
|
Map<String, List<AccumulativeInfoVO>> collect = accumulativeInfoVOS.stream()
|
||||||
|
.collect(Collectors.groupingBy(AccumulativeInfoVO::getPileConnectorCode));
|
||||||
|
|
||||||
|
List<ConnectorStatsInfo> connectorStatsInfos = Lists.newArrayList();
|
||||||
|
for (Map.Entry<String, List<AccumulativeInfoVO>> entry : collect.entrySet()) {
|
||||||
|
String pileConnectorCode = entry.getKey();
|
||||||
|
List<AccumulativeInfoVO> value = entry.getValue();
|
||||||
|
// 枪口用电量求和
|
||||||
|
BigDecimal connectorElec = value.stream()
|
||||||
|
.map(AccumulativeInfoVO::getConnectorElectricity)
|
||||||
|
.map(BigDecimal::new)
|
||||||
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
|
// 充电时长求和
|
||||||
|
BigDecimal chargingTime = value.stream()
|
||||||
|
.map(AccumulativeInfoVO::getChargingTime)
|
||||||
|
.map(BigDecimal::new)
|
||||||
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
|
|
||||||
|
// 充电次数
|
||||||
|
long chargingNumLong = accumulativeInfoVOS.stream()
|
||||||
|
.map(x -> x.getPileConnectorCode().equals(pileConnectorCode))
|
||||||
|
.count();
|
||||||
|
int chargingNum = Integer.parseInt(String.valueOf(chargingNumLong));
|
||||||
|
|
||||||
|
connectorStatsInfos.add(
|
||||||
|
ConnectorStatsInfo.builder()
|
||||||
|
.connectorID(pileConnectorCode)
|
||||||
|
.connectorElectricity(connectorElec)
|
||||||
|
.connectorDuration(chargingTime.intValue())
|
||||||
|
.connectorNum(chargingNum)
|
||||||
|
.build()
|
||||||
|
);
|
||||||
|
// 充电桩电量为枪口用电量累计
|
||||||
|
pileElec = pileElec.add(connectorElec);
|
||||||
|
// 充电桩充电次数为枪口充电次数累计
|
||||||
|
pileChargingNum += chargingNum;
|
||||||
|
// 充电时长
|
||||||
|
pileChargingTime += chargingTime.intValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
EquipmentStatsInfo build = EquipmentStatsInfo.builder()
|
||||||
|
.equipmentID(pileSn)
|
||||||
|
.equipmentElectricity(pileElec)
|
||||||
|
.connectorDuration(pileChargingTime)
|
||||||
|
.connectorNum(pileChargingNum)
|
||||||
|
.connectorStatsInfos(connectorStatsInfos)
|
||||||
|
.build();
|
||||||
|
equipmentStatsInfoList.add(build);
|
||||||
|
|
||||||
|
// 所有充电桩用电量之和
|
||||||
|
stationElectricity = stationElectricity.add(pileElec);
|
||||||
|
// 充电时长
|
||||||
|
stationChargingTime += pileChargingTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
StationStatsInfo stationStatsInfo = StationStatsInfo.builder()
|
||||||
|
.stationID(dto.getStationID())
|
||||||
|
.startTime(dto.getStartTime())
|
||||||
|
.endTime(dto.getEndTime())
|
||||||
|
.stationElectricity(stationElectricity)
|
||||||
|
.connectorDuration(stationChargingTime)
|
||||||
|
.connectorNum(list.size())
|
||||||
|
.equipmentStatsInfos(equipmentStatsInfoList) // 设备列表
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
|
map.put("StationStats", stationStatsInfo);
|
||||||
|
|
||||||
|
Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMapV2(map, thirdPartySecretInfoVO.getOurDataSecret(),
|
||||||
|
thirdPartySecretInfoVO.getOurDataSecretIv(), thirdPartySecretInfoVO.getTheirSigSecret());
|
||||||
|
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 推送已完成订单信息接口 notification_charge_order_info
|
||||||
|
* @param orderCode
|
||||||
|
* @param secretInfoVO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String notificationChargeOrderInfo(String orderCode, ThirdPartySecretInfoVO secretInfoVO) {
|
||||||
|
// 根据订单号查询出信息
|
||||||
|
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
|
||||||
|
if (orderBasicInfo == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
String operatorId = Constants.OPERATORID_JIANG_SU;
|
||||||
|
String operatorSecret = secretInfoVO.getTheirOperatorSecret();
|
||||||
|
String signSecret = secretInfoVO.getTheirSigSecret();
|
||||||
|
String dataSecret = secretInfoVO.getTheirDataSecret();
|
||||||
|
String dataSecretIv = secretInfoVO.getTheirDataSecretIv();
|
||||||
|
String urlAddress = secretInfoVO.getTheirUrlPrefix();
|
||||||
|
|
||||||
|
// 推送地址
|
||||||
|
String url = urlAddress + BusinessInformationExchangeEnum.NOTIFICATION_CHARGE_ORDER_INFO.getValue();
|
||||||
|
|
||||||
|
// 根据订单号查询订单详情
|
||||||
|
OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderCode);
|
||||||
|
if (orderDetail == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
ChargeOrderInfo chargeOrderInfo = ChargeOrderInfo.builder()
|
||||||
|
.startChargeSeq(orderCode)
|
||||||
|
// .startChargeType()
|
||||||
|
.connectorId(orderBasicInfo.getPileConnectorCode())
|
||||||
|
.startTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, orderBasicInfo.getChargeStartTime()))
|
||||||
|
.endTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, orderBasicInfo.getChargeEndTime()))
|
||||||
|
.totalPower(orderDetail.getTotalUsedElectricity())
|
||||||
|
// .totalElecMoney(orderDetail.getTotalElectricityAmount())
|
||||||
|
// .totalSeviceMoney(orderDetail.getTotalServiceAmount())
|
||||||
|
.elecMoney(orderDetail.getTotalElectricityAmount())
|
||||||
|
.seviceMoney(orderDetail.getTotalServiceAmount())
|
||||||
|
.totalMoney(orderDetail.getTotalOrderAmount())
|
||||||
|
|
||||||
|
.build();
|
||||||
|
// startChargeType
|
||||||
|
String startMode = orderBasicInfo.getStartMode();
|
||||||
|
if (StringUtils.equals(StartModeEnum.AUTH_CARD.getValue(), startMode)
|
||||||
|
|| StringUtils.equals(StartModeEnum.OFFLINE_CARD.getValue(), startMode)) {
|
||||||
|
chargeOrderInfo.setStartChargeType(3); // 3-卡启动
|
||||||
|
}else {
|
||||||
|
chargeOrderInfo.setStartChargeType(Constants.one);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取令牌
|
||||||
|
String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);
|
||||||
|
if (StringUtils.isBlank(token)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 调用平台接口
|
||||||
|
String jsonString = JSON.toJSONString(chargeOrderInfo);
|
||||||
|
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询已完成订单列表信息接口 query_finish_orders
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Map<String, String> queryFinishOrders(QueryStartChargeDTO dto) {
|
||||||
|
int pageNo = dto.getPageNo() == null ? 1 : dto.getPageNo();
|
||||||
|
int pageSize = dto.getPageSize() == null ? 10 : dto.getPageSize();
|
||||||
|
List<ChargeOrderInfo> orderInfos = new ArrayList<>();
|
||||||
|
|
||||||
|
PageUtils.startPage(pageNo, pageSize);
|
||||||
|
List<OrderVO> orderVOS = orderBasicInfoService.selectThirdPartyOrderList(dto);
|
||||||
|
|
||||||
|
PageInfo<OrderVO> pageInfo = new PageInfo<>(orderVOS);
|
||||||
|
|
||||||
|
for (OrderVO orderVO : pageInfo.getList()) {
|
||||||
|
ChargeOrderInfo chargeOrderInfo = ChargeOrderInfo.builder()
|
||||||
|
.startChargeSeq(orderVO.getOrderCode())
|
||||||
|
// .startChargeType()
|
||||||
|
.connectorId(orderVO.getPileConnectorCode())
|
||||||
|
.startTime(orderVO.getStartTime())
|
||||||
|
.endTime(orderVO.getStartTime())
|
||||||
|
.totalPower(new BigDecimal(orderVO.getTotalPower()))
|
||||||
|
.elecMoney(orderVO.getTotalElectricityAmount())
|
||||||
|
.seviceMoney(orderVO.getTotalServiceAmount())
|
||||||
|
.totalMoney(orderVO.getOrderAmount())
|
||||||
|
|
||||||
|
.build();
|
||||||
|
|
||||||
|
// startChargeType
|
||||||
|
String startMode = orderVO.getStartMode();
|
||||||
|
if (StringUtils.equals(StartModeEnum.AUTH_CARD.getValue(), startMode)
|
||||||
|
|| StringUtils.equals(StartModeEnum.OFFLINE_CARD.getValue(), startMode)) {
|
||||||
|
chargeOrderInfo.setStartChargeType(3); // 3-卡启动
|
||||||
|
}else {
|
||||||
|
chargeOrderInfo.setStartChargeType(Constants.one);
|
||||||
|
}
|
||||||
|
|
||||||
|
orderInfos.add(chargeOrderInfo);
|
||||||
|
}
|
||||||
|
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getGuangXiSecretInfo();
|
||||||
|
|
||||||
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
|
map.put("PageNo", pageInfo.getPageNum());
|
||||||
|
map.put("PageCount", pageInfo.getPages());
|
||||||
|
map.put("ItemSize", pageInfo.getTotal());
|
||||||
|
map.put("ChargeOrders", orderInfos);
|
||||||
|
map.put("LastQueryTime", dto.getLastQueryTime());
|
||||||
|
map.put("LastQueryEndTime", dto.getLastQueryEndTime());
|
||||||
|
|
||||||
|
Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMapV2(map, thirdPartySecretInfoVO.getOurDataSecret(),
|
||||||
|
thirdPartySecretInfoVO.getOurDataSecretIv(), thirdPartySecretInfoVO.getTheirSigSecret());
|
||||||
|
|
||||||
|
return resultMap;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 推送充电状态接口 notification_equip_charge_status
|
||||||
|
* @param orderCode 订单编号
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String notificationEquipChargeStatus(String orderCode) {
|
||||||
|
// 根据订单号查询订单信息
|
||||||
|
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
|
||||||
|
// 查询相关配置信息
|
||||||
|
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getGuangXiSecretInfo();
|
||||||
|
|
||||||
|
String operatorId = Constants.OPERATORID_JIANG_SU;
|
||||||
|
String operatorSecret = thirdPartySecretInfoVO.getTheirOperatorSecret();
|
||||||
|
String signSecret = thirdPartySecretInfoVO.getTheirSigSecret();
|
||||||
|
String dataSecret = thirdPartySecretInfoVO.getTheirDataSecret();
|
||||||
|
String dataSecretIv = thirdPartySecretInfoVO.getTheirDataSecretIv();
|
||||||
|
String urlAddress = thirdPartySecretInfoVO.getTheirUrlPrefix();
|
||||||
|
|
||||||
|
// 查询枪口实时状态
|
||||||
|
List<RealTimeMonitorData> chargingRealTimeData = orderBasicInfoService.getChargingRealTimeData(orderInfo.getTransactionCode());
|
||||||
|
RealTimeMonitorData realTimeMonitorData;
|
||||||
|
if (CollectionUtils.isEmpty(chargingRealTimeData)) {
|
||||||
|
realTimeMonitorData = RealTimeMonitorData.builder()
|
||||||
|
.chargingDegree(Constants.ZERO)
|
||||||
|
.connectorStatus("3")
|
||||||
|
.build();
|
||||||
|
chargingRealTimeData.add(realTimeMonitorData);
|
||||||
|
} else {
|
||||||
|
realTimeMonitorData = chargingRealTimeData.get(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询枪口状态
|
||||||
|
PileConnectorInfoVO info = pileConnectorInfoService.getPileConnectorInfoByConnectorCode(orderInfo.getPileConnectorCode());
|
||||||
|
if (Objects.isNull(info)) {
|
||||||
|
throw new BusinessException(ReturnCodeEnum.CODE_CONNECTOR_INFO_NULL_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
String orderStatus = orderInfo.getOrderStatus();
|
||||||
|
if (StringUtils.equals(OrderStatusEnum.IN_THE_CHARGING.getValue(), orderStatus)) {
|
||||||
|
// 充电中
|
||||||
|
orderStatus = "2";
|
||||||
|
} else if (StringUtils.equals(OrderStatusEnum.ORDER_COMPLETE.getValue(), orderStatus)) {
|
||||||
|
// 充电完成
|
||||||
|
orderStatus = "4";
|
||||||
|
}
|
||||||
|
BigDecimal current = realTimeMonitorData.getOutputCurrent() == null ? BigDecimal.ZERO : info.getCurrent();
|
||||||
|
BigDecimal voltage = realTimeMonitorData.getOutputVoltage() == null ? BigDecimal.ZERO : info.getVoltage();
|
||||||
|
String soc = realTimeMonitorData.getSOC() == null ? Constants.ZERO : info.getSOC();
|
||||||
|
|
||||||
|
String dateTime = DateUtils.getDateTime();
|
||||||
|
SupEquipChargeStatusInfo supEquipChargeStatusInfo = SupEquipChargeStatusInfo.builder()
|
||||||
|
.startChargeSeq(orderInfo.getOrderCode())
|
||||||
|
.startChargeSeqStat(Integer.parseInt(orderStatus))
|
||||||
|
.connectorID(orderInfo.getPileConnectorCode())
|
||||||
|
.connectorStatus(Integer.parseInt(realTimeMonitorData.getConnectorStatus())) // 3-充电中
|
||||||
|
.currentA(current.setScale(1, RoundingMode.HALF_UP))
|
||||||
|
.voltageA(voltage.setScale(1, RoundingMode.HALF_UP))
|
||||||
|
.soc(new BigDecimal(soc))
|
||||||
|
.startTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, orderInfo.getChargeStartTime()))
|
||||||
|
.endTime(dateTime)
|
||||||
|
.totalPower(new BigDecimal(realTimeMonitorData.getChargingDegree()))
|
||||||
|
|
||||||
|
.build();
|
||||||
|
|
||||||
|
String url = urlAddress + BusinessInformationExchangeEnum.NOTIFICATION_EQUIP_CHARGE_STATUS.getValue();
|
||||||
|
// 调用平台接口
|
||||||
|
String jsonString = JSON.toJSONString(supEquipChargeStatusInfo);
|
||||||
|
|
||||||
|
// 获取令牌
|
||||||
|
String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);
|
||||||
|
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取广西平台密钥信息
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private ThirdPartySecretInfoVO getGuangXiSecretInfo() {
|
||||||
|
ThirdPartySecretInfoVO thirdPartySecretInfoVO = thirdpartySecretInfoService.queryByThirdPlatformType(thirdPlatformType);
|
||||||
|
if (thirdPartySecretInfoVO == null) {
|
||||||
|
throw new BusinessException(ReturnCodeEnum.CODE_SELECT_INFO_IS_NULL);
|
||||||
|
}
|
||||||
|
thirdPartySecretInfoVO.setOurOperatorId(Constants.OPERATORID_JIANG_SU);
|
||||||
|
return thirdPartySecretInfoVO;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user