修改桩详情接口

This commit is contained in:
yuyang 2021-08-11 16:25:10 +08:00
parent 34e5f7d88b
commit d1639320f6
16 changed files with 295 additions and 56 deletions

View File

@ -341,7 +341,7 @@
select te.name as name,
cp.power as power,
cp.auxiliary_power_supply as auxiliaryPowerSupply,
cp.serial_number as serialNumber,
te.serial_number as serialNumber,
cp.input_voltage as inputVoltage
from xhpc_terminal as te
left join xhpc_charging_pile as cp on cp.charging_pile_id = te.charging_pile_id

View File

@ -73,4 +73,5 @@ public class HxpcChargeOrderController extends BaseController {
return iHxpcChargeOrderService.stopUp(userId, serialNumber,chargingOrderId);
}
}

View File

@ -50,9 +50,45 @@ public class WebSocketController {
public void onOpen(@PathParam("userId") Long userId,Session session){
this.userId =userId;
this.session = session;
System.out.println("userId:"+userId);
System.out.println("session:"+session);
webSocketSet.add(this); //加入set中
addOnlineCount(); //在线数加1
System.out.println("有新连接加入!当前在线人数为" + getOnlineCount());
try {
this.session.getBasicRemote().sendText("推送消息");
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* 给指定的人发送消息
* @param message
*/
@OnMessage
public void sendToUser(String message) {
String sendUserno = message.split("[|]")[1];
String sendMessage = message.split("[|]")[0];
try {
if (webSocketSet.get(sendUserno) != null) {
webSocketSet.get(sendUserno).sendMessage("用户" + userno + "发来消息:" + " <br/> " + sendMessage);
} else {
System.out.println("当前用户不在线");
}
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* 获取当前时间
*
* @return
*/
private String getNowTime() {
Date date = new Date();
DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String time = format.format(date);
return time;
}
/**
@ -93,6 +129,7 @@ public class WebSocketController {
" \"remainingTime\": \"45\"\n" +
" }\n" +
"}";
//终端编号订单信息需要获取
ApplicationContext act = ApplicationContextRegister.getApplicationContext();
RedisService redisService = act.getBean(RedisService.class);
Object cacheObject = redisService.getCacheObject("gun:1472583698524602.seqdec");

View File

@ -43,12 +43,14 @@ public class XhpcHistoryOrderController extends BaseController {
* 用户订单详情接口
* @param userId 用户id
* @param historyOrderId 历史订单id
* @param type 1 历史订单id 2 充电订单id (暂时没用)
* @param chargingOrderId 充电订单id
* @return
*/
@GetMapping("/gethistotyOrderMessage")
public AjaxResult gethistotyOrderMessage(@RequestParam Long userId,@RequestParam Long historyOrderId)
public AjaxResult gethistotyOrderMessage(@RequestParam Long userId,@RequestParam Long historyOrderId,Integer type,Long chargingOrderId)
{
return xhpcHistoryOrderService.gethistotyOrderMessage(userId,historyOrderId);
return xhpcHistoryOrderService.gethistotyOrderMessage(userId,historyOrderId,type,chargingOrderId);
}

View File

@ -8,6 +8,7 @@ import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -48,10 +49,36 @@ public class XhpcRealTimeOrderController extends BaseController {
/**
* 实时订单详情
*/
@GetMapping("/message")
public AjaxResult message(@RequestParam Long realTimeOrderId)
@GetMapping("/getMessage")
public AjaxResult getMessage(@RequestParam Long realTimeOrderId)
{
return null;
return AjaxResult.success(xhpcRealTimeOrderService.getMessage(realTimeOrderId));
}
/**
* 实时订单详情数据列表PC
* @param chargingOrderId
* @return
*/
@GetMapping("/timeList")
public TableDataInfo timeList(@RequestParam Long chargingOrderId)
{
startPage();
List<Map<String,Object>> list = xhpcRealTimeOrderService.timeList(chargingOrderId);
return getDataTable(list);
}
/**
* 实时订单详情数据图表PC
* @param chargingOrderId
* @return
*/
@GetMapping("/timeChartList")
public AjaxResult timeChartList(@RequestParam Long chargingOrderId)
{
return xhpcRealTimeOrderService.timeChartList(chargingOrderId);
}
}

View File

@ -18,7 +18,7 @@ public interface HxpcChargeOrderMapper {
* @param userId
* @return
*/
Map<String,Object> getHistotyChargeOrderMessage(@Param("userId") Long userId);
int getHistotyChargeOrderMessage(@Param("userId") Long userId);
/**
* 异常订单

View File

@ -68,5 +68,5 @@ public interface XhpcHistoryOrderMapper {
* @param historyOrderId
* @return
*/
Map<String, Object> gethistotyOrderMessage(@Param("userId") Long userId, @Param("historyOrderId") Long historyOrderId);
Map<String, Object> gethistotyOrderMessage(@Param("userId") Long userId, @Param("historyOrderId") Long historyOrderId, @Param("type") Integer type, @Param("chargingOrderId") Long chargingOrderId);
}

View File

@ -4,6 +4,7 @@ import com.xhpc.order.domain.XhpcChargeOrderSoc;
import com.xhpc.order.domain.XhpcRealTimeOrder;
import org.apache.ibatis.annotations.Param;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -43,4 +44,40 @@ public interface XhpcRealTimeOrderMapper {
* @return
*/
List<Map<String,Object>> list(@Param("phone") String phone,@Param("transactionNumber") String transactionNumber,@Param("source") Integer source,@Param("chargingStationName") String chargingStationName,@Param("terminalName")String terminalName,@Param("operatorId") Long operatorId,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("type") Integer type);
/**
* 实时订单详情接口(PC端)
* @param realTimeOrderId
* @return
*/
Map<String,Object> getMessage(@Param("realTimeOrderId")Long realTimeOrderId);
/**
* 实时订单详情数据列表PC
* @param chargingOrderId
* @return
*/
List<Map<String,Object>> timeList(@Param("chargingOrderId")Long chargingOrderId);
/**
* 实时订单详情数据图表SOCPC
* @param chargingOrderId
* @return
*/
Map<String,Object> timeChartSOCList(Long chargingOrderId);
/**
* 实时订单详情数据图表电压PC
* @param chargingOrderId
* @return
*/
Map<String,Object> timeChartVoltageList(Long chargingOrderId);
/**
* 实时订单详情数据图表电流PC
* @param chargingOrderId
* @return
*/
Map<String,Object> timeChartCurrentList(Long chargingOrderId);
}

View File

@ -26,5 +26,5 @@ public interface IXhpcHistoryOrderService {
* @param historyOrderId
* @return
*/
AjaxResult gethistotyOrderMessage(Long userId,Long historyOrderId);
AjaxResult gethistotyOrderMessage(Long userId,Long historyOrderId,Integer type,Long chargingOrderId);
}

View File

@ -1,5 +1,8 @@
package com.xhpc.order.service;
import com.xhpc.common.core.web.domain.AjaxResult;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -18,7 +21,7 @@ public interface IXhpcRealTimeOrderService {
/**
* 实时订单接口
* 实时订单接口(PC端)
* @param phone 用户账号
* @param transactionNumber 订单编号
* @param source 用户类型 0C端用户 1流量用户
@ -31,5 +34,24 @@ public interface IXhpcRealTimeOrderService {
*/
List<Map<String,Object>> list(String phone,String transactionNumber,Integer source,String chargingStationName,String terminalName,Long operatorId,String startTime,String endTime);
/**
* 实时订单详情接口(PC端)
* @param realTimeOrderId
* @return
*/
Map<String,Object> getMessage(Long realTimeOrderId);
/**
* 实时订单详情数据列表PC
* @param chargingOrderId 充电订单id
* @return
*/
List<Map<String,Object>> timeList(Long chargingOrderId);
/**
* 实时订单详情数据图表PC
* @param chargingOrderId
* @return
*/
AjaxResult timeChartList(Long chargingOrderId);
}

View File

@ -45,8 +45,11 @@ public class HxpcChargeOrderServiceImpl implements IHxpcChargeOrderService {
@Override
public AjaxResult getHistotyChargeOrderMessage(Long userId) {
return AjaxResult.success(hxpcChargeOrderMapper.getHistotyChargeOrderMessage(userId));
int count = hxpcChargeOrderMapper.getHistotyChargeOrderMessage(userId);
if(count>0){
return AjaxResult.success();
}
return AjaxResult.error(1201,"无实时数据");
}
@Override

View File

@ -3,6 +3,7 @@ package com.xhpc.order.service.impl;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.order.mapper.XhpcHistoryOrderMapper;
import com.xhpc.order.service.IXhpcHistoryOrderService;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -24,8 +25,8 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService {
}
@Override
public AjaxResult gethistotyOrderMessage(Long userId, Long historyOrderId) {
return AjaxResult.success(xhpcHistoryOrderMapper.gethistotyOrderMessage(userId,historyOrderId));
public AjaxResult gethistotyOrderMessage(Long userId, Long historyOrderId,Integer type,Long chargingOrderId) {
return AjaxResult.success(xhpcHistoryOrderMapper.gethistotyOrderMessage(userId,historyOrderId,type,chargingOrderId));
}
}

View File

@ -1,11 +1,14 @@
package com.xhpc.order.service.impl;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.redis.service.RedisService;
import com.xhpc.order.mapper.XhpcRealTimeOrderMapper;
import com.xhpc.order.service.IXhpcRealTimeOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -59,5 +62,24 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService {
return xhpcRealTimeOrderMapper.list(phone,transactionNumber,source,chargingStationName,terminalName,operatorId,startTime,endTime,type);
}
@Override
public Map<String, Object> getMessage(Long realTimeOrderId) {
return xhpcRealTimeOrderMapper.getMessage(realTimeOrderId);
}
@Override
public List<Map<String, Object>> timeList(Long chargingOrderId) {
return xhpcRealTimeOrderMapper.timeList(chargingOrderId);
}
@Override
public AjaxResult timeChartList(Long chargingOrderId) {
Map<String,Object> map =new HashMap();
map.put("soc",xhpcRealTimeOrderMapper.timeChartSOCList(chargingOrderId));
map.put("voltage",xhpcRealTimeOrderMapper.timeChartVoltageList(chargingOrderId));
map.put("soc",xhpcRealTimeOrderMapper.timeChartCurrentList(chargingOrderId));
return AjaxResult.success(map);
}
}

View File

@ -49,27 +49,35 @@
<result property="rateModelId" column="rate_model_id"/>
</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 id="getHistotyChargeOrderMessage" resultType="int">
select
count(charge_order_id)
from xhpc_charge_order
where user_id = #{userId} and status=0 and del_flag =0
</select>
<!-- <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>-->
<select id="getUserMessage" resultType="map">
select
app_user_id as appUserId,

View File

@ -328,14 +328,21 @@
DATE_FORMAT(co.start_time,'%H:%m') as timeOne,
DATE_FORMAT(co.end_time,'%m月%d日') as daysTwo,
DATE_FORMAT(co.end_time,'%H:%m') as timeTwo,
co.status as status,
co.type as type
FROM xhpc_history_order as ho
LEFT JOIN xhpc_charging_station as cs on cs.charging_station_id = ho.charging_station_id
LEFT JOIN xhpc_terminal as te on te.terminal_id = ho.terminal_id
left join xhpc_charge_order as co on co.charge_order_id =ho.charge_order_id
where ho.status=0 and ho.del_flag=0 and ho.history_order_id =#{historyOrderId}
where ho.status=0 and ho.del_flag=0
<if test="userId !=null">
and ho.user_id =#{userId}
</if>
<if test="historyOrderId !=null">
and ho.history_order_id =#{historyOrderId}
</if>
<if test="chargingOrderId !=null">
and ho.charge_order_id =#{chargingOrderId}
</if>
</select>
</mapper>

View File

@ -202,23 +202,23 @@
<select id="list" resultType="map">
select
ro.real_time_order_id as realTimeOrderId,
co.serial_number as serialNumber,
ct.name as chargingStationName,
ter.pile_serial_number as pileSerialNumber,
ter.name as terminalName,
op.operator_id as operatorId,
op.name as operatorName,
cp.power as power,
cp.type as type,
ro.soc as soc,
co.status as status,
co.create_time as createTime,
ro.charging_degree as chargingDegree,
ro.charging_time as chargingTime,
co.source as source,
(SELECT phone FROM xhpc_app_user where app_user_id = co.user_id) as appUserPhone,
(SELECT phone from xhpc_internet_user where internet_user_id = co.user_id) as internetUserPhone
ro.real_time_order_id as realTimeOrderId,
co.serial_number as serialNumber,
ct.name as chargingStationName,
ter.pile_serial_number as pileSerialNumber,
ter.name as terminalName,
op.operator_id as operatorId,
op.name as operatorName,
cp.power as power,
cp.type as type,
ro.soc as soc,
co.status as status,
co.create_time as createTime,
ro.charging_degree as chargingDegree,
ro.charging_time as chargingTime,
co.source as source,
(SELECT phone FROM xhpc_app_user where app_user_id = co.user_id) as appUserPhone,
(SELECT phone from xhpc_internet_user where internet_user_id = co.user_id) as internetUserPhone
from xhpc_charge_order co
left join xhpc_real_time_order as ro on co.serial_number = ro.transaction_number
left join xhpc_charging_station as ct on ct.charging_station_id = ro.charging_station_id
@ -245,25 +245,97 @@
and op.operator_id =#{operatorId}
</if>
<if test="type==1">
and co.user_id in (SELECT app_user_id FROM xhpc_app_user where phone like concat('%', #{phone}, '%')) or
and co.user_id in (SELECT app_user_id FROM xhpc_app_user where phone like concat('%', #{phone}, '%')) or
co.user_id in (SELECT internet_user_id from xhpc_internet_user where phone like concat('%', #{phone}, '%'))
</if>
<if test="type==2">
<if test="source !=null and source ==0">
and co.user_id in (SELECT app_user_id FROM xhpc_app_user)
and co.user_id in (SELECT app_user_id FROM xhpc_app_user)
</if>
<if test="source !=null and source ==1">
and co.user_id in (SELECT internet_user_id from xhpc_internet_user)
and co.user_id in (SELECT internet_user_id from xhpc_internet_user)
</if>
</if>
<if test="type==3">
<if test="source !=null and source ==0">
and co.user_id in (SELECT app_user_id FROM xhpc_app_user where phone like concat('%', #{phone}, '%'))
and co.user_id in (SELECT app_user_id FROM xhpc_app_user where phone like concat('%', #{phone}, '%'))
</if>
<if test="source !=null and source ==1">
and co.user_id in (SELECT internet_user_id from xhpc_internet_user where phone like concat('%', #{phone}, '%'))
and co.user_id in (SELECT internet_user_id from xhpc_internet_user where phone like concat('%',
#{phone}, '%'))
</if>
</if>
group by charging_order_id
order by co.create_time desc
</select>
<select id="getMessage" resultType="map">
select
ro.real_time_order_id as realTimeOrderId,
co.serial_number as serialNumber,
ct.name as chargingStationName,
ter.pile_serial_number as pileSerialNumber,
ter.name as terminalName,
op.operator_id as operatorId,
op.name as operatorName,
cp.power as power,
cp.type as type,
ro.soc as soc,
co.status as status,
co.create_time as createTime,
ro.charging_degree as chargingDegree,
ro.charging_time as chargingTime,
co.source as source,
co.internet_serial_number as internetSerialNumber,
(SELECT phone FROM xhpc_app_user where app_user_id = co.user_id) as appUserPhone,
(SELECT phone from xhpc_internet_user where internet_user_id = co.user_id) as internetUserPhone
from xhpc_real_time_order ro
Left join xhpc_charge_order co on co.serial_number = ro.transaction_number
Left join xhpc_charging_station as ct on ct.charging_station_id = ro.charging_station_id
left join xhpc_operator as op on op.operator_id = ct.operator_id
left join xhpc_terminal as ter on ter.serial_number = ro.gun_number
left join xhpc_charging_pile as cp on cp.charging_pile_id = ter.charging_pile_id
where ro.real_time_order_id=#{realTimeOrderId}
</select>
<select id="timeList" resultType="map">
select
create_time as createTime,
voltage,
electric_current as electricCurrent,
soc,
charging_degree as chargingDegree,
loss_charging_degree as lossChargingDegree,
gun_line_temperature as gunLineTemperature,
charging_time as chargingTime,
remaining_time as remainingTime,
vehicle_gun_status as vehicleGunStatus
from xhpc_real_time_order
where charging_order_id=#{chargingOrderId}
order by create_time desc
</select>
<select id="timeChartSOCList" resultType="map">
select
group_concat(soc) as soc,
group_concat(DATE_FORMAT(create_time,'%H:%i:%s')) createTime
from xhpc_charge_order_soc
where charge_order_id=#{chargingOrderId}
</select>
<select id="timeChartVoltageList" resultType="map">
select
group_concat(voltage) as voltage,
group_concat(DATE_FORMAT(create_time,'%H:%i:%s')) createTime
from xhpc_charge_order_voltage
where charge_order_id=#{chargingOrderId}
</select>
<select id="timeChartCurrentList" resultType="map">
select
group_concat(current) as current,
group_concat(DATE_FORMAT(create_time,'%H:%i:%s')) createTime
from xhpc_charge_order_current
where charge_order_id=#{chargingOrderId}
</select>
</mapper>