This commit is contained in:
admin-lmm
2023-06-27 09:24:18 +08:00
8 changed files with 52 additions and 16 deletions

View File

@@ -4,6 +4,7 @@ import com.google.common.collect.Lists;
import com.jsowell.common.util.StringUtils;
import com.jsowell.pile.domain.ykcCommond.*;
import com.jsowell.pile.dto.RemoteAccountBalanceUpdateDTO;
import com.jsowell.pile.dto.UpdateFirmwareDTO;
import com.jsowell.pile.service.YKCPushCommandService;
import com.jsowell.pile.domain.PileBillingRelation;
import com.jsowell.pile.domain.PileBillingTemplate;
@@ -185,12 +186,13 @@ public class PileRemoteService {
/**
* 远程更新
*
* @param pileSns 前台传的桩号集合
*/
public void updateFirmware(List<String> pileSns) {
public void updateFirmware(UpdateFirmwareDTO dto) {
//
UpdateFirmwareCommand command = UpdateFirmwareCommand.builder().pileSnList(pileSns).build();
UpdateFirmwareCommand command = UpdateFirmwareCommand.builder()
.pileSnList(dto.getPileSns())
.filePath(dto.getFilePath())
.build();
ykcPushCommandService.pushUpdateFileCommand(command);
}

View File

@@ -5,6 +5,7 @@ import com.jsowell.common.constant.Constants;
import com.jsowell.common.core.domain.AjaxResult;
import com.jsowell.pile.dto.GenerateOrderDTO;
import com.jsowell.pile.dto.QueryPileDTO;
import com.jsowell.pile.dto.UpdateFirmwareDTO;
import com.jsowell.service.OrderService;
import com.jsowell.service.PileRemoteService;
import org.apache.commons.collections4.CollectionUtils;
@@ -105,11 +106,11 @@ public class PileRemoteController {
* @return
*/
@PostMapping("/updateFirmware")
public AjaxResult updateFirmware(@RequestBody QueryPileDTO queryPileDTO) {
if (CollectionUtils.isEmpty(queryPileDTO.getPileSns())) {
public AjaxResult updateFirmware(@RequestBody UpdateFirmwareDTO dto) {
if (CollectionUtils.isEmpty(dto.getPileSns())) {
return AjaxResult.error("参数不能为空");
}
pileRemoteService.updateFirmware(queryPileDTO.getPileSns());
pileRemoteService.updateFirmware(dto);
return AjaxResult.success();
}

View File

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

View File

@@ -12,5 +12,9 @@ import java.util.List;
@AllArgsConstructor
@Builder
public class UpdateFirmwareCommand {
List<String> pileSnList;
private List<String> pileSnList;
// /update.bin
private String filePath;
}

View File

@@ -0,0 +1,24 @@
package com.jsowell.pile.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class UpdateFirmwareDTO {
/**
* 桩编码List
*/
private List<String> pileSns;
/**
* 固件路径
*/
private String filePath;
}

View File

@@ -340,7 +340,7 @@ public class YKCPushCommandServiceImpl implements YKCPushCommandService {
byte[] passwordByteArr = BytesUtil.checkLengthAndBehindAppendZero(BytesUtil.str2Asc(Constants.updateServerPassword), 32);
// 文件路径
byte[] filePathByteArr = BytesUtil.checkLengthAndBehindAppendZero(BytesUtil.str2Asc(Constants.filePath), 64);
byte[] filePathByteArr = BytesUtil.checkLengthAndBehindAppendZero(BytesUtil.str2Asc(command.getFilePath()), 64);
// 执行控制 01立即执行 02空闲执行
byte[] performTypeByteArr = Constants.oneByteArray;

View File

@@ -478,8 +478,8 @@ public class AMapServiceImpl implements AMapService {
Map<String, List<PileInfoVO>> pileMap = pileInfoList.stream().collect(Collectors.groupingBy(PileInfoVO::getPileSn));
info = new AMapEquipmentInfo();
for (Map.Entry<String, List<PileInfoVO>> pile : pileMap.entrySet()) {
info = new AMapEquipmentInfo();
String pileSn = pile.getKey();
List<PileInfoVO> value = pile.getValue();
PileInfoVO pileInfoVO = value.get(0);

View File

@@ -213,10 +213,14 @@
</el-row>
</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-tab-pane label="配置管理" name="second">
<el-button type="primary" icon="el-icon-s-tools" round @click="updateFirmware('/update.bin')">远程升级</el-button>
</el-tab-pane>
<el-tab-pane label="配置管理" name="second">
<el-button type="primary" icon="el-icon-s-tools" round @click="updateFirmware('/update2.bin')">远程升级2</el-button>
</el-tab-pane>
</el-tabs>
</div>
</template>
@@ -290,9 +294,10 @@ export default {
},
methods: {
// 远程升级固件
updateFirmware() {
updateFirmware(filePath) {
const data = {
pileSns: [this.pileSn],
filePath: filePath
};
console.log("远程升级固件:", data);
updateFirmware(data).then((response) => {