实时订单
This commit is contained in:
parent
208e21020a
commit
af0b78f4a6
@ -0,0 +1,36 @@
|
||||
package com.xhpc.order.controller;
|
||||
|
||||
import com.xhpc.common.core.web.controller.BaseController;
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.order.service.IHxpcChargeOrderService;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2021/8/4 9:59
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/chargeOrder")
|
||||
@Api(value = "充电订单接口", tags = "充电订单接口")
|
||||
public class HxpcChargeOrderController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IHxpcChargeOrderService iHxpcChargeOrderService;
|
||||
|
||||
/**
|
||||
* 实时订单
|
||||
*/
|
||||
@GetMapping("/getHistotyChargeOrderMessage")
|
||||
public AjaxResult getHistotyChargeOrderMessage(@RequestParam Long userId)
|
||||
{
|
||||
return iHxpcChargeOrderService.getHistotyChargeOrderMessage(userId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,167 @@
|
||||
package com.xhpc.order.domain;
|
||||
|
||||
import com.xhpc.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 充电订单
|
||||
* @author yuyang
|
||||
* @date 2021/8/4 9:41
|
||||
*/
|
||||
public class HxpcChargeOrder extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 充电订单id
|
||||
*/
|
||||
private Long chargeOrderId;
|
||||
/**
|
||||
* 电站id
|
||||
*/
|
||||
private Long chargingStationId;
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 终端id
|
||||
*/
|
||||
private Long terminalId;
|
||||
/**
|
||||
* 互联网流水订单号
|
||||
*/
|
||||
private String internetSerialNumber;
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
private String serialNumber;
|
||||
/**
|
||||
* 充电启始soc
|
||||
*/
|
||||
private String startSoc;
|
||||
/**
|
||||
* 订单来源(0C端用户 1流量用户)
|
||||
*/
|
||||
private Integer source;
|
||||
/**
|
||||
* (状态(0开始充电 1自动结算,2异常,3平台结算)
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 删除标志(0代表存在 2代表删除)
|
||||
*/
|
||||
private Integer delFlag;
|
||||
/**
|
||||
* 费率模型id
|
||||
*/
|
||||
private Long rateModelId;
|
||||
|
||||
public Long getChargeOrderId() {
|
||||
|
||||
return chargeOrderId;
|
||||
}
|
||||
|
||||
public void setChargeOrderId(Long chargeOrderId) {
|
||||
|
||||
this.chargeOrderId = chargeOrderId;
|
||||
}
|
||||
|
||||
public Long getChargingStationId() {
|
||||
|
||||
return chargingStationId;
|
||||
}
|
||||
|
||||
public void setChargingStationId(Long chargingStationId) {
|
||||
|
||||
this.chargingStationId = chargingStationId;
|
||||
}
|
||||
|
||||
public Long getUserId() {
|
||||
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId) {
|
||||
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Long getTerminalId() {
|
||||
|
||||
return terminalId;
|
||||
}
|
||||
|
||||
public void setTerminalId(Long terminalId) {
|
||||
|
||||
this.terminalId = terminalId;
|
||||
}
|
||||
|
||||
public String getInternetSerialNumber() {
|
||||
|
||||
return internetSerialNumber;
|
||||
}
|
||||
|
||||
public void setInternetSerialNumber(String internetSerialNumber) {
|
||||
|
||||
this.internetSerialNumber = internetSerialNumber;
|
||||
}
|
||||
|
||||
public String getSerialNumber() {
|
||||
|
||||
return serialNumber;
|
||||
}
|
||||
|
||||
public void setSerialNumber(String serialNumber) {
|
||||
|
||||
this.serialNumber = serialNumber;
|
||||
}
|
||||
|
||||
public String getStartSoc() {
|
||||
|
||||
return startSoc;
|
||||
}
|
||||
|
||||
public void setStartSoc(String startSoc) {
|
||||
|
||||
this.startSoc = startSoc;
|
||||
}
|
||||
|
||||
public Integer getSource() {
|
||||
|
||||
return source;
|
||||
}
|
||||
|
||||
public void setSource(Integer source) {
|
||||
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Integer getDelFlag() {
|
||||
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public void setDelFlag(Integer delFlag) {
|
||||
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public Long getRateModelId() {
|
||||
|
||||
return rateModelId;
|
||||
}
|
||||
|
||||
public void setRateModelId(Long rateModelId) {
|
||||
|
||||
this.rateModelId = rateModelId;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package com.xhpc.order.mapper;
|
||||
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2021/8/4 9:55
|
||||
*/
|
||||
public interface HxpcChargeOrderMapper {
|
||||
|
||||
/**
|
||||
* 实时订单
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
Map<String,Object> getHistotyChargeOrderMessage(@Param("userId") Long userId);
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.xhpc.order.service;
|
||||
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2021/8/4 9:54
|
||||
*/
|
||||
public interface IHxpcChargeOrderService {
|
||||
|
||||
/**
|
||||
* 实时订单
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
AjaxResult getHistotyChargeOrderMessage(Long userId);
|
||||
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package com.xhpc.order.service.impl;
|
||||
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.order.mapper.HxpcChargeOrderMapper;
|
||||
import com.xhpc.order.service.IHxpcChargeOrderService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2021/8/4 9:54
|
||||
*/
|
||||
@Service
|
||||
public class HxpcChargeOrderServiceImpl implements IHxpcChargeOrderService {
|
||||
|
||||
@Autowired
|
||||
private HxpcChargeOrderMapper hxpcChargeOrderMapper;
|
||||
|
||||
@Override
|
||||
public AjaxResult getHistotyChargeOrderMessage(Long userId) {
|
||||
|
||||
return AjaxResult.success(hxpcChargeOrderMapper.getHistotyChargeOrderMessage(userId));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xhpc.order.mapper.HxpcChargeOrderMapper">
|
||||
|
||||
<resultMap type="com.xhpc.order.domain.HxpcChargeOrder" id="HxpcChargeOrderResult">
|
||||
<result column="charge_order_id" property="chargeOrderId"/>
|
||||
<result column="charging_station_id" property="chargingStationId"/>
|
||||
<result column="user_id" property="userId"/>
|
||||
<result column="terminal_id" property="terminalId"/>
|
||||
<result column="internet_serial_number" property="internetSerialNumber"/>
|
||||
<result column="serial_number" property="serialNumber"/>
|
||||
<result column="start_soc" property="startSoc"/>
|
||||
<result column="source" property="source"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="del_flag" property="delFlag"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="create_by" property="createBy"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="update_by" property="updateBy"/>
|
||||
<result column="remark" property="remark"/>
|
||||
<result column="rate_model_id" property="rateModelId"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="getHistotyChargeOrderMessage" resultType="map">
|
||||
select
|
||||
rto.real_time_order_id as realTimeOrderId,
|
||||
rto.charging_order_id as chargingOrderId,
|
||||
rto.voltage as voltage,
|
||||
rto.electric_current as electricCurrent,
|
||||
(select power from xhpc_charging_pile where charging_pile_id=
|
||||
(select charging_pile_id from xhpc_terminal where serial_number=rto.pile_number and del_flag=0 LIMIT 1))power,
|
||||
rto.soc as soc,
|
||||
rto.gun_number as gunNumber,
|
||||
rto.charging_degree as chargingDegree,
|
||||
rto.charging_time as chargingTime,
|
||||
rto.remaining_time as remainingTime,
|
||||
rto.amount_charged as amountCharged,
|
||||
au.balance as balance
|
||||
from xhpc_real_time_order as rto
|
||||
LEFT JOIN xhpc_app_user as au on au.app_user_id = rto.user_id
|
||||
where rto.charging_order_id =(select charge_order_id from xhpc_charge_order where status =0 and source = 0 ORDER BY create_time desc LIMIT 1)
|
||||
and rto.user_id=#{userId}
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
x
Reference in New Issue
Block a user