mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-06-13 03:39:55 +08:00
充电桩远程升级
This commit is contained in:
@@ -9,7 +9,7 @@ import com.jsowell.netty.command.ykc.PublishPileBillingTemplateCommand;
|
|||||||
import com.jsowell.netty.command.ykc.RebootCommand;
|
import com.jsowell.netty.command.ykc.RebootCommand;
|
||||||
import com.jsowell.netty.command.ykc.StartChargingCommand;
|
import com.jsowell.netty.command.ykc.StartChargingCommand;
|
||||||
import com.jsowell.netty.command.ykc.StopChargingCommand;
|
import com.jsowell.netty.command.ykc.StopChargingCommand;
|
||||||
import com.jsowell.netty.command.ykc.UpdateFileCommand;
|
import com.jsowell.netty.command.ykc.UpdateFirmwareCommand;
|
||||||
import com.jsowell.netty.service.yunkuaichong.YKCPushCommandService;
|
import com.jsowell.netty.service.yunkuaichong.YKCPushCommandService;
|
||||||
import com.jsowell.pile.domain.PileBillingRelation;
|
import com.jsowell.pile.domain.PileBillingRelation;
|
||||||
import com.jsowell.pile.domain.PileBillingTemplate;
|
import com.jsowell.pile.domain.PileBillingTemplate;
|
||||||
@@ -186,9 +186,9 @@ public class PileRemoteService {
|
|||||||
*
|
*
|
||||||
* @param pileSns 前台传的桩号集合
|
* @param pileSns 前台传的桩号集合
|
||||||
*/
|
*/
|
||||||
public void updateFile(List<String> pileSns) {
|
public void updateFirmware(List<String> pileSns) {
|
||||||
//
|
//
|
||||||
UpdateFileCommand command = UpdateFileCommand.builder().pileSnList(pileSns).build();
|
UpdateFirmwareCommand command = UpdateFirmwareCommand.builder().pileSnList(pileSns).build();
|
||||||
ykcPushCommandService.pushUpdateFileCommand(command);
|
ykcPushCommandService.pushUpdateFileCommand(command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,19 +7,18 @@ import com.jsowell.pile.dto.GenerateOrderDTO;
|
|||||||
import com.jsowell.pile.dto.QueryPileDTO;
|
import com.jsowell.pile.dto.QueryPileDTO;
|
||||||
import com.jsowell.service.OrderService;
|
import com.jsowell.service.OrderService;
|
||||||
import com.jsowell.service.PileRemoteService;
|
import com.jsowell.service.PileRemoteService;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.text.ParseException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 远程控制controller
|
* 远程控制controller
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/remote")
|
@RequestMapping("/pile/remote")
|
||||||
public class PileRemoteController {
|
public class PileRemoteController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -30,7 +29,7 @@ public class PileRemoteController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取实时上传数据
|
* 获取实时上传数据
|
||||||
* http://localhost:8080/remote/getRealTimeMonitorData
|
* http://localhost:8080/pile/remote/getRealTimeMonitorData
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/getRealTimeMonitorData")
|
@PostMapping("/getRealTimeMonitorData")
|
||||||
@@ -41,7 +40,7 @@ public class PileRemoteController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 远程重启
|
* 远程重启
|
||||||
* http://localhost:8080/remote/reboot
|
* http://localhost:8080/pile/remote/reboot
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/reboot")
|
@PostMapping("/reboot")
|
||||||
@@ -52,7 +51,7 @@ public class PileRemoteController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 后管-远程启动充电
|
* 后管-远程启动充电
|
||||||
* http://localhost:8080/remote/remoteStartChargingForWeb
|
* http://localhost:8080/pile/remote/remoteStartChargingForWeb
|
||||||
*/
|
*/
|
||||||
@PostMapping("/remoteStartChargingForWeb")
|
@PostMapping("/remoteStartChargingForWeb")
|
||||||
public AjaxResult remoteStartCharging(@RequestBody GenerateOrderDTO dto) {
|
public AjaxResult remoteStartCharging(@RequestBody GenerateOrderDTO dto) {
|
||||||
@@ -70,7 +69,7 @@ public class PileRemoteController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 远程停止充电
|
* 远程停止充电
|
||||||
* http://localhost:8080/remote/remoteStopCharging
|
* http://localhost:8080/pile/remote/remoteStopCharging
|
||||||
* @param dto
|
* @param dto
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -82,7 +81,7 @@ public class PileRemoteController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 远程下发二维码
|
* 远程下发二维码
|
||||||
* http://localhost:8080/remote/issueQRCode
|
* http://localhost:8080/pile/remote/issueQRCode
|
||||||
*/
|
*/
|
||||||
@PostMapping("/issueQRCode")
|
@PostMapping("/issueQRCode")
|
||||||
public AjaxResult issueQRCode(@RequestBody QueryPileDTO queryPileDTO) {
|
public AjaxResult issueQRCode(@RequestBody QueryPileDTO queryPileDTO) {
|
||||||
@@ -92,7 +91,7 @@ public class PileRemoteController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 对时
|
* 对时
|
||||||
* http://localhost:8080/remote/proofreadTime
|
* http://localhost:8080/pile/remote/proofreadTime
|
||||||
*/
|
*/
|
||||||
@PostMapping("/proofreadTime")
|
@PostMapping("/proofreadTime")
|
||||||
public AjaxResult proofreadTime(@RequestBody QueryPileDTO queryPileDTO) {
|
public AjaxResult proofreadTime(@RequestBody QueryPileDTO queryPileDTO) {
|
||||||
@@ -102,12 +101,15 @@ public class PileRemoteController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 远程升级
|
* 远程升级
|
||||||
* http://localhost:8080/remote/updateFile
|
* http://localhost:8080/pile/remote/updateFirmware
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/updateFile")
|
@PostMapping("/updateFirmware")
|
||||||
public AjaxResult updateFile(@RequestBody QueryPileDTO queryPileDTO) {
|
public AjaxResult updateFirmware(@RequestBody QueryPileDTO queryPileDTO) {
|
||||||
pileRemoteService.updateFile(queryPileDTO.getPileSns());
|
if (CollectionUtils.isEmpty(queryPileDTO.getPileSns())) {
|
||||||
|
return AjaxResult.error("参数不能为空");
|
||||||
|
}
|
||||||
|
pileRemoteService.updateFirmware(queryPileDTO.getPileSns());
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -546,7 +546,7 @@ public class SpringBootTestController {
|
|||||||
public void testRemoteUpdate() {
|
public void testRemoteUpdate() {
|
||||||
ArrayList<String> list = new ArrayList<>();
|
ArrayList<String> list = new ArrayList<>();
|
||||||
list.add("88000000000001");
|
list.add("88000000000001");
|
||||||
pileRemoteService.updateFile(list);
|
pileRemoteService.updateFirmware(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -11,6 +11,6 @@ import java.util.List;
|
|||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Builder
|
@Builder
|
||||||
public class UpdateFileCommand {
|
public class UpdateFirmwareCommand {
|
||||||
List<String> pileSnList;
|
List<String> pileSnList;
|
||||||
}
|
}
|
||||||
@@ -53,7 +53,7 @@ public interface YKCPushCommandService {
|
|||||||
* 发送远程更新命令
|
* 发送远程更新命令
|
||||||
* @param command
|
* @param command
|
||||||
*/
|
*/
|
||||||
void pushUpdateFileCommand(UpdateFileCommand command);
|
void pushUpdateFileCommand(UpdateFirmwareCommand command);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送充电桩设置命令
|
* 发送充电桩设置命令
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ public class YKCPushCommandServiceImpl implements YKCPushCommandService {
|
|||||||
// 通过桩编号获取channel
|
// 通过桩编号获取channel
|
||||||
Channel channel = PileChannelEntity.getChannelByPileSn(pileSn);
|
Channel channel = PileChannelEntity.getChannelByPileSn(pileSn);
|
||||||
if (Objects.isNull(channel)) {
|
if (Objects.isNull(channel)) {
|
||||||
log.error("push命令失败, 桩号:{}无法获取到长连接, 请检查充电桩连接状态!", pileSn);
|
log.error("push命令[{}]失败, 桩号:{}无法获取到长连接, 请检查充电桩连接状态!", ((YKCFrameTypeCode) frameTypeCode).getValue(), pileSn);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -284,7 +284,7 @@ public class YKCPushCommandServiceImpl implements YKCPushCommandService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void pushUpdateFileCommand(UpdateFileCommand command) {
|
public void pushUpdateFileCommand(UpdateFirmwareCommand command) {
|
||||||
List<String> pileSns = command.getPileSnList();
|
List<String> pileSns = command.getPileSnList();
|
||||||
if (CollectionUtils.isEmpty(pileSns)) {
|
if (CollectionUtils.isEmpty(pileSns)) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
10
jsowell-ui/src/api/pile/pileRemote.js
Normal file
10
jsowell-ui/src/api/pile/pileRemote.js
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询充电桩通讯日志
|
||||||
|
export function updateFirmware(data) {
|
||||||
|
return request({
|
||||||
|
url: '/pile/remote/updateFirmware',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -5,7 +5,6 @@
|
|||||||
value="first"
|
value="first"
|
||||||
type="border-card"
|
type="border-card"
|
||||||
@tab-click="handleClick"
|
@tab-click="handleClick"
|
||||||
v-loading="loading"
|
|
||||||
>
|
>
|
||||||
<el-tab-pane label="基本信息" name="first">
|
<el-tab-pane label="基本信息" name="first">
|
||||||
<el-row type="flex" justify="space-between">
|
<el-row type="flex" justify="space-between">
|
||||||
@@ -23,7 +22,6 @@
|
|||||||
<vue-qr
|
<vue-qr
|
||||||
ref="Qrcode"
|
ref="Qrcode"
|
||||||
:text="pileDetail.qrCodeURL"
|
:text="pileDetail.qrCodeURL"
|
||||||
:callback="test + ''"
|
|
||||||
qid="testQrId"
|
qid="testQrId"
|
||||||
:width="150"
|
:width="150"
|
||||||
style="margin-left: 25%"
|
style="margin-left: 25%"
|
||||||
@@ -127,19 +125,10 @@
|
|||||||
align="center"
|
align="center"
|
||||||
>
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<!-- <el-link @click="qrcodeClick(scope.row)" v-if="scope.row.connectorQrCodeUrl == 0">-->
|
|
||||||
<!-- <vue-qr ref="Qrcode"-->
|
|
||||||
<!-- :text="scope.row.connectorQrCodeUrl"-->
|
|
||||||
<!-- :callback="test" qid="scope.row.connectorId"-->
|
|
||||||
<!-- :width="qrWidth"-->
|
|
||||||
|
|
||||||
<!-- />-->
|
|
||||||
<!-- </el-link>-->
|
|
||||||
<el-link @click="qrcodeClick(scope.row)">
|
<el-link @click="qrcodeClick(scope.row)">
|
||||||
<vue-qr
|
<vue-qr
|
||||||
ref="Qrcode"
|
ref="Qrcode"
|
||||||
:text="scope.row.connectorQrCodeUrl"
|
:text="scope.row.connectorQrCodeUrl"
|
||||||
:callback="test + ''"
|
|
||||||
qid="scope.row.connectorId"
|
qid="scope.row.connectorId"
|
||||||
:width="qrWidth"
|
:width="qrWidth"
|
||||||
/>
|
/>
|
||||||
@@ -224,7 +213,9 @@
|
|||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
|
|
||||||
<!-- 右侧配置管理页面目前不管 -->
|
<!-- 右侧配置管理页面目前不管 -->
|
||||||
<el-tab-pane label="配置管理" name="second">配置管理</el-tab-pane>
|
<el-tab-pane label="配置管理" name="second">
|
||||||
|
<el-button type="primary" icon="el-icon-s-tools" round @click="updateFirmware">远程升级</el-button>
|
||||||
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -238,6 +229,7 @@ import {
|
|||||||
import { queryConnectorListByParams } from "@/api/pile/connector";
|
import { queryConnectorListByParams } from "@/api/pile/connector";
|
||||||
// 二维码组件
|
// 二维码组件
|
||||||
import VueQr from "vue-qr";
|
import VueQr from "vue-qr";
|
||||||
|
import {updateFirmware} from "@/api/pile/pileRemote";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { VueQr },
|
components: { VueQr },
|
||||||
@@ -296,6 +288,16 @@ export default {
|
|||||||
setTimeout(() => {}, 300);
|
setTimeout(() => {}, 300);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 远程升级固件
|
||||||
|
updateFirmware() {
|
||||||
|
const data = {
|
||||||
|
pileSns: [this.pileSn],
|
||||||
|
};
|
||||||
|
console.log("远程升级固件:", data);
|
||||||
|
updateFirmware(data).then((response) => {
|
||||||
|
console.log("updateFirmware结果:", response);
|
||||||
|
});
|
||||||
|
},
|
||||||
//点击二维码事件
|
//点击二维码事件
|
||||||
qrcodeClick(row) {
|
qrcodeClick(row) {
|
||||||
if (this.flag) {
|
if (this.flag) {
|
||||||
|
|||||||
Reference in New Issue
Block a user