增加PC端停止充电

This commit is contained in:
yuyang 2021-11-25 16:08:23 +08:00
parent 9a509f4f03
commit ef7e7b111e
6 changed files with 52 additions and 10 deletions

View File

@ -400,6 +400,7 @@
<select id="selectXhpcTerminalList" resultType="java.util.Map">
select
te.terminal_id as terminalId,
te.charging_pile_id as chargingPileId,
te.charging_station_id as chargingStationId,
te.name as terminalName,
ct.name as chargingStationName,

View File

@ -77,6 +77,7 @@
<select id="getXhpcTerminalList" resultType="map">
select
te.terminal_id as terminalId,
te.charging_pile_id as chargingPileId,
te.charging_station_id as chargingStationId,
te.name as terminalName,
ct.name as chargingStationName,

View File

@ -115,7 +115,7 @@ public class XhpcHistoryOrderController extends BaseController {
* 终端统计
*/
@GetMapping("/test3")
@Scheduled(cron = "0 0/8 * * * ?")
@Scheduled(cron = "0 0/2 * * * ?")
public void test3(){
logger.info(">>>>>>>>>>>>>>>>>>>>>>>终端统计定时任务>>>>>>>>>>>>>>>>>>>>>");
logger.info(">>>>>>>>>>>>>>>>>>>>>>>终端统计定时任务>>>>>>>>>>>>>>>>>>>>>");
@ -126,7 +126,7 @@ public class XhpcHistoryOrderController extends BaseController {
* 场站统计
*/
@GetMapping("/test2")
@Scheduled(cron = "0 0/7 * * * ?")
@Scheduled(cron = "0 0/2 * * * ?")
public void test2(){
logger.info(">>>>>>>>>>>>>>>>>>>>>>>场站统计定时任务>>>>>>>>>>>>>>>>>>>>>");
logger.info(">>>>>>>>>>>>>>>>>>>>>>>场站统计定时任务>>>>>>>>>>>>>>>>>>>>>");
@ -138,7 +138,7 @@ public class XhpcHistoryOrderController extends BaseController {
* 日期统计
*/
@GetMapping("/test1")
@Scheduled(cron = "0 0/6 * * * ?")
@Scheduled(cron = "0 0/2 * * * ?")
public void test1(){
add(1000,1);
}
@ -434,7 +434,7 @@ public class XhpcHistoryOrderController extends BaseController {
* 小时统计
*/
@GetMapping("/test")
@Scheduled(cron = "0 0/5 * * * ?")
@Scheduled(cron = "0 0/2 * * * ?")
public void test(){
logger.info(">>>>>>>>>>>>>>>>>>>>>>>小时统计定时任务>>>>>>>>>>>>>>>>>>>>>");
logger.info(">>>>>>>>>>>>>>>>>>>>>>>小时统计定时任务>>>>>>>>>>>>>>>>>>>>>");

View File

@ -1,9 +1,13 @@
package com.xhpc.order.controller;
import com.xhpc.common.api.PowerPileService;
import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.page.TableDataInfo;
import com.xhpc.common.redis.service.RedisService;
import com.xhpc.order.api.XhpcChargeOrderController;
import com.xhpc.order.service.IXhpcChargeOrderService;
import com.xhpc.order.service.IXhpcStopChargingOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
@ -12,6 +16,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
/**
* program: ruoyi
@ -26,7 +32,13 @@ public class XhpcStopChargingOrderController extends BaseController {
private IXhpcStopChargingOrderService iXhpcStopChargingOrderService;
@Autowired
private XhpcChargeOrderController xhpcChargeOrderController;
private RedisService redisService;
@Autowired
private PowerPileService powerPileService;
@Autowired
private IXhpcChargeOrderService xhpcChargeOrderService;
@GetMapping("/list")
public TableDataInfo list(Long userId, Long chargingStationId, Long terminalId){
@ -36,14 +48,32 @@ public class XhpcStopChargingOrderController extends BaseController {
/**
* 停止充电
* @param userId
* @param terminalSerialNumber 终端编码
* @param chargingOrderId 充电id
* @param serialNumber 终端编号
* @return
*/
@GetMapping("/stopUp")
public AjaxResult stopUp(@RequestParam Long userId, @RequestParam String terminalSerialNumber, @RequestParam Long chargingOrderId){
public AjaxResult stopUp(@RequestParam String serialNumber,@RequestParam Long chargingPileId){
//查询缓存是否该终端在充电
Map<String, Object> cacheMap = redisService.getCacheMap("gun:" + serialNumber);
return xhpcChargeOrderController.stopUp(userId, terminalSerialNumber, chargingOrderId);
if(cacheMap!=null){
if(cacheMap.get("orderkey") !=null){
String orderkey = cacheMap.get("orderkey").toString().substring(6);
Map<String, Object> xhpcChargingPileById = xhpcChargeOrderService.getXhpcChargingPileById(chargingPileId);
String version ="0A";
if(xhpcChargingPileById.get("communicationProtocolVersion")!=null && !"".equals(xhpcChargingPileById.get("communicationProtocolVersion").toString())){
version=xhpcChargingPileById.get("communicationProtocolVersion").toString();
}
R r = powerPileService.stopCharging(orderkey, orderkey.substring(0,14), orderkey.substring(0,16), version);
if(r.getCode()==200){
return AjaxResult.success("停止充电命令已下发");
}else{
return AjaxResult.success(r.getMsg());
}
}
}
return AjaxResult.success("无车辆充电");
}
}

View File

@ -5,6 +5,7 @@ import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.domain.XhpcRate;
import com.xhpc.order.domain.XhpcChargeOrder;
import com.xhpc.order.domain.XhpcOrderRedisRecord;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.Date;
@ -153,10 +154,14 @@ public interface IXhpcChargeOrderService {
*/
List<XhpcChargeOrder> getXhpcChargeOrderStatus(Integer status,Integer source);
R startUpBy3rd(String internetSerialNumber, String driverId, Integer chargingAmt, String plateNum, Integer status, String connectorId);
/**
* 标记异常大于创建4小时标记为异常
*/
void updateStatus();
//获取桩信息
Map<String,Object> getXhpcChargingPileById(Long chargingPileId);
}

View File

@ -512,6 +512,11 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
xhpcChargeOrderMapper.updateStatus();
}
@Override
public Map<String, Object> getXhpcChargingPileById(Long chargingPileId) {
return xhpcChargeOrderMapper.getXhpcChargingPileById(chargingPileId);
}
public static boolean isValidDate(String str) {
try {
if (0 != str.length()) {