充电桩远程升级

This commit is contained in:
2023-04-06 16:32:41 +08:00
parent 263970c1e0
commit b3bbc21a82
8 changed files with 47 additions and 33 deletions

View File

@@ -9,7 +9,7 @@ import com.jsowell.netty.command.ykc.PublishPileBillingTemplateCommand;
import com.jsowell.netty.command.ykc.RebootCommand;
import com.jsowell.netty.command.ykc.StartChargingCommand;
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.pile.domain.PileBillingRelation;
import com.jsowell.pile.domain.PileBillingTemplate;
@@ -186,9 +186,9 @@ public class PileRemoteService {
*
* @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);
}
}

View File

@@ -7,19 +7,18 @@ import com.jsowell.pile.dto.GenerateOrderDTO;
import com.jsowell.pile.dto.QueryPileDTO;
import com.jsowell.service.OrderService;
import com.jsowell.service.PileRemoteService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.text.ParseException;
/**
* 远程控制controller
*/
@RestController
@RequestMapping("/remote")
@RequestMapping("/pile/remote")
public class PileRemoteController {
@Autowired
@@ -30,7 +29,7 @@ public class PileRemoteController {
/**
* 获取实时上传数据
* http://localhost:8080/remote/getRealTimeMonitorData
* http://localhost:8080/pile/remote/getRealTimeMonitorData
* @return
*/
@PostMapping("/getRealTimeMonitorData")
@@ -41,7 +40,7 @@ public class PileRemoteController {
/**
* 远程重启
* http://localhost:8080/remote/reboot
* http://localhost:8080/pile/remote/reboot
* @return
*/
@PostMapping("/reboot")
@@ -52,7 +51,7 @@ public class PileRemoteController {
/**
* 后管-远程启动充电
* http://localhost:8080/remote/remoteStartChargingForWeb
* http://localhost:8080/pile/remote/remoteStartChargingForWeb
*/
@PostMapping("/remoteStartChargingForWeb")
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
* @return
*/
@@ -82,7 +81,7 @@ public class PileRemoteController {
/**
* 远程下发二维码
* http://localhost:8080/remote/issueQRCode
* http://localhost:8080/pile/remote/issueQRCode
*/
@PostMapping("/issueQRCode")
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")
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
*/
@PostMapping("/updateFile")
public AjaxResult updateFile(@RequestBody QueryPileDTO queryPileDTO) {
pileRemoteService.updateFile(queryPileDTO.getPileSns());
@PostMapping("/updateFirmware")
public AjaxResult updateFirmware(@RequestBody QueryPileDTO queryPileDTO) {
if (CollectionUtils.isEmpty(queryPileDTO.getPileSns())) {
return AjaxResult.error("参数不能为空");
}
pileRemoteService.updateFirmware(queryPileDTO.getPileSns());
return AjaxResult.success();
}

View File

@@ -546,7 +546,7 @@ public class SpringBootTestController {
public void testRemoteUpdate() {
ArrayList<String> list = new ArrayList<>();
list.add("88000000000001");
pileRemoteService.updateFile(list);
pileRemoteService.updateFirmware(list);
}
@Test

View File

@@ -11,6 +11,6 @@ import java.util.List;
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class UpdateFileCommand {
public class UpdateFirmwareCommand {
List<String> pileSnList;
}

View File

@@ -53,7 +53,7 @@ public interface YKCPushCommandService {
* 发送远程更新命令
* @param command
*/
void pushUpdateFileCommand(UpdateFileCommand command);
void pushUpdateFileCommand(UpdateFirmwareCommand command);
/**
* 发送充电桩设置命令

View File

@@ -69,7 +69,7 @@ public class YKCPushCommandServiceImpl implements YKCPushCommandService {
// 通过桩编号获取channel
Channel channel = PileChannelEntity.getChannelByPileSn(pileSn);
if (Objects.isNull(channel)) {
log.error("push命令失败, 桩号:{}无法获取到长连接, 请检查充电桩连接状态!", pileSn);
log.error("push命令[{}]失败, 桩号:{}无法获取到长连接, 请检查充电桩连接状态!", ((YKCFrameTypeCode) frameTypeCode).getValue(), pileSn);
return false;
}
/**
@@ -284,7 +284,7 @@ public class YKCPushCommandServiceImpl implements YKCPushCommandService {
}
@Override
public void pushUpdateFileCommand(UpdateFileCommand command) {
public void pushUpdateFileCommand(UpdateFirmwareCommand command) {
List<String> pileSns = command.getPileSnList();
if (CollectionUtils.isEmpty(pileSns)) {
return;

View File

@@ -0,0 +1,10 @@
import request from '@/utils/request'
// 查询充电桩通讯日志
export function updateFirmware(data) {
return request({
url: '/pile/remote/updateFirmware',
method: 'post',
data: data
})
}

View File

@@ -5,7 +5,6 @@
value="first"
type="border-card"
@tab-click="handleClick"
v-loading="loading"
>
<el-tab-pane label="基本信息" name="first">
<el-row type="flex" justify="space-between">
@@ -23,7 +22,6 @@
<vue-qr
ref="Qrcode"
:text="pileDetail.qrCodeURL"
:callback="test + ''"
qid="testQrId"
:width="150"
style="margin-left: 25%"
@@ -127,19 +125,10 @@
align="center"
>
<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)">
<vue-qr
ref="Qrcode"
:text="scope.row.connectorQrCodeUrl"
:callback="test + ''"
qid="scope.row.connectorId"
:width="qrWidth"
/>
@@ -224,7 +213,9 @@
</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>
</div>
</template>
@@ -238,6 +229,7 @@ import {
import { queryConnectorListByParams } from "@/api/pile/connector";
// 二维码组件
import VueQr from "vue-qr";
import {updateFirmware} from "@/api/pile/pileRemote";
export default {
components: { VueQr },
@@ -296,6 +288,16 @@ export default {
setTimeout(() => {}, 300);
},
methods: {
// 远程升级固件
updateFirmware() {
const data = {
pileSns: [this.pileSn],
};
console.log("远程升级固件:", data);
updateFirmware(data).then((response) => {
console.log("updateFirmware结果", response);
});
},
//点击二维码事件
qrcodeClick(row) {
if (this.flag) {