命令下发兼容处理

This commit is contained in:
attiya 2025-05-23 11:09:59 +08:00
parent 5c0dc11d5d
commit 89e38d7a38

View File

@ -62,7 +62,7 @@ public class EbikeCoreHandler {
ReqEbikeBikeComDto reqEbikeBikeComDto = new ReqEbikeBikeComDto(String.valueOf(bikeId), String.valueOf(staffId), cmdCode, "1", "1");
commandRecords.put(tid, reqEbikeBikeComDto);
}
String command = getCommand(cmdCode, tid);
String command = getCommand(cmdCode, tid,true);
cmdMsg.setCommand(command);
// 注册响应监听
pendingRequests.put(tid, future);
@ -109,7 +109,7 @@ public class EbikeCoreHandler {
String tid = UUID.randomUUID().toString().replace("-", "");
String command = getCommand(cmdCode, tid);
String command = getCommand(cmdCode, tid,false);
cmdMsg.setCommand(command);
// 注册响应监听
pendingRequests.put(tid, future);
@ -163,7 +163,7 @@ public class EbikeCoreHandler {
* @param tid 任务id
* @return 命令json字符串
*/
String getCommand(String cmdCode, String tid) {
String getCommand(String cmdCode, String tid,boolean record) {
EbikeCmdMapper cmdMapper = SpringContextHolder.getBean(EbikeCmdMapper.class);
EbikeParamMapper paramMapper = SpringContextHolder.getBean(EbikeParamMapper.class);
EbikeParamValueMapper paramValueMapper = SpringContextHolder.getBean(EbikeParamValueMapper.class);
@ -171,7 +171,9 @@ public class EbikeCoreHandler {
.where(EBIKE_CMD.CMD_CODE.eq(cmdCode));
EbikeCmd ebikeCmd = cmdMapper.selectOneByQuery(queryWrapper);
if (record){
commandRecords.get(tid).setCom(ebikeCmd.getCmdName());
}
queryWrapper.clear();
queryWrapper.where(EBIKE_PARAM.CMD_ID.eq(ebikeCmd.getCmdId()))