终端接口

This commit is contained in:
yuyang 2021-07-29 13:47:03 +08:00
parent 2aee9fa71a
commit 0f8a2fa234
5 changed files with 64 additions and 4 deletions

View File

@ -5,10 +5,7 @@ import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.page.TableDataInfo;
import com.xhpc.charging.station.service.IXhpcTerminalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@ -82,4 +79,15 @@ public class XhpcTerminalController extends BaseController {
return AjaxResult.success(xhpcTerminalService.selectXhpcTerminalPileMessage(terminalId));
}
/**
* 通过终端编号进入小程序开始充电页面
*/
@GetMapping(value = "/getWXpNumMessage")
public AjaxResult getWXpNumMessage(@RequestParam(value = "pNum") String pNum)
{
return AjaxResult.success(xhpcTerminalService.getWXpNumMessage(pNum));
}
}

View File

@ -1,5 +1,6 @@
package com.xhpc.charging.station.mapper;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.domain.XhpcChargingStation;
import com.xhpc.common.domain.XhpcTerminal;
import org.apache.ibatis.annotations.Param;
@ -73,4 +74,11 @@ public interface XhpcTerminalMapper {
* 今日充电量今日充电用户今日充电次数
*/
Map<String,Object> getXhpcRateTimeOrderStatistics(@Param("chargingStationId")Long chargingStationId,@Param("gunNumber")String gunNumber);
/**
* 通过终端编号进入小程序开始充电页面
* @param pNum 终端编号
* @return
*/
Map<String,Object> getWXpNumMessage(@Param("pNum")String pNum);
}

View File

@ -47,4 +47,12 @@ public interface IXhpcTerminalService {
* 终端详情
*/
AjaxResult selectXhpcTerminalPileMessage(Long terminalId);
/**
* 通过终端编号进入小程序开始充电页面
* @param pNum 终端编号
* @return
*/
AjaxResult getWXpNumMessage(String pNum);
}

View File

@ -1,11 +1,13 @@
package com.xhpc.charging.station.service;
import cn.hutool.core.date.DateUtil;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.domain.XhpcTerminal;
import com.xhpc.charging.station.mapper.XhpcTerminalMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -20,6 +22,8 @@ public class XhpcTerminalServiceImpl implements IXhpcTerminalService{
@Autowired
private XhpcTerminalMapper xhpcTerminalMapper;
@Autowired
private IXhpcRateTimeService xhpcRateTimeService;
/**
* PC端页面统计
@ -76,4 +80,21 @@ public class XhpcTerminalServiceImpl implements IXhpcTerminalService{
return AjaxResult.success(map);
}
@Override
public AjaxResult getWXpNumMessage(String pNum) {
//获取枪的状态
Map<String, Object> map = xhpcTerminalMapper.getWXpNumMessage(pNum);
Long chargingStationId = Long.parseLong(map.get("chargingStationId").toString());
//HH:mm:ss
String tiem = DateUtil.formatTime(new Date());
Map<String, Object> xhpcRateTime = xhpcRateTimeService.getXhpcRateTime(tiem, chargingStationId);
if(xhpcRateTime!=null){
map.putAll(xhpcRateTime);
}
return AjaxResult.success(map);
}
}

View File

@ -249,4 +249,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where real_time_order_id in (
select max(real_time_order_id) from xhpc_real_time_order WHERE to_days(create_time) = to_days(now()) and charging_station_id=#{chargingStationId} and gun_number =#{gunNumber} group by charging_order_id )
</select>
<select id="getWXpNumMessage" resultType="map">
select
ter.name as terminalName,
ter.serial_number as serialNumber,
cp.power as power,
cp.max_voltage as maxVoltage,
cp.auxiliary_power_supply as auxiliaryPowerSupply,
ct.parking_instructions as parkingInstructions,
ter.charging_station_id as chargingStationId
from xhpc_terminal as ter
left join xhpc_charging_pile as cp on cp.charging_pile_id=ter.charging_pile_id
left join xhpc_charging_station as ct on ct.charging_station_id =ter.charging_station_id
where ter.serial_number=#{pNum} and ter.del_flag = 0
</select>
</mapper>