This commit is contained in:
2025-09-30 16:28:41 +08:00
parent cb03127593
commit 78be6bad44
2 changed files with 34 additions and 36 deletions

View File

@ -75,12 +75,12 @@ public class SendDataController {
return sendDataService.sendStoreInfoToBattery(Long.parseLong(id));
}
@ApiOperation(value = "接收充电同步数据接口")
@GetMapping("/subOrder/{id}")
public Map<String,String> sendSubOrderToBattery(@PathVariable String id){
log.info("/subOrder 接收充电数据:{}",id);
return sendDataService.sendSubOrderToBattery(Long.parseLong(id));
}
// @ApiOperation(value = "接收充电同步数据接口")
// @GetMapping("/subOrder/{id}")
// public Map<String,String> sendSubOrderToBattery(@PathVariable String id){
// log.info("/subOrder 接收充电数据:{}",id);
// return sendDataService.sendSubOrderToBattery(Long.parseLong(id));
// }
@ApiOperation(value = "接收充电同步数据接口")
@GetMapping("/OrderMeal/{id}")
@ -90,34 +90,34 @@ public class SendDataController {
}
// @ApiOperation(value = "异步接收充电同步数据接口")
// @GetMapping("/subOrder/{id}")
// public CompletableFuture<ResponseEntity<Map<String, String>>> sendSubOrderToBattery(@PathVariable String id){
// log.info("/subOrder 接收充电数据:{}",id);
// return CompletableFuture
// .supplyAsync(() -> {
// try {
// return sendDataService.sendSubOrderToBattery(Long.parseLong(id));
// } catch (Exception e) {
// log.error("处理用户数据时发生异常", e);
// Map<String, String> errorResponse = new HashMap<>();
// errorResponse.put("code", "9999");
// errorResponse.put("msg", "处理失败: " + e.getMessage());
// return errorResponse;
// }
// }, taskExecutor)
// .thenApply(result -> {
// log.info("用户数据处理完成,返回结果: {}", result);
// return ResponseEntity.ok(result);
// })
// .exceptionally(throwable -> {
// log.error("异步处理用户数据时发生异常", throwable);
// Map<String, String> errorResponse = new HashMap<>();
// errorResponse.put("code", "9999");
// errorResponse.put("msg", "系统异常");
// return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(errorResponse);
// });
// }
@ApiOperation(value = "异步接收充电同步数据接口")
@GetMapping("/subOrder/{id}")
public CompletableFuture<ResponseEntity<Map<String, String>>> sendSubOrderToBattery(@PathVariable String id){
log.info("/subOrder 接收充电数据:{}",id);
return CompletableFuture
.supplyAsync(() -> {
try {sleep(5000);
return sendDataService.sendSubOrderToBattery(Long.parseLong(id));
} catch (Exception e) {
log.error("处理用户数据时发生异常", e);
Map<String, String> errorResponse = new HashMap<>();
errorResponse.put("code", "9999");
errorResponse.put("msg", "处理失败: " + e.getMessage());
return errorResponse;
}
}, taskExecutor)
.thenApply(result -> {
log.info("用户数据处理完成,返回结果: {}", result);
return ResponseEntity.ok(result);
})
.exceptionally(throwable -> {
log.error("异步处理用户数据时发生异常", throwable);
Map<String, String> errorResponse = new HashMap<>();
errorResponse.put("code", "9999");
errorResponse.put("msg", "系统异常");
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(errorResponse);
});
}

View File

@ -356,8 +356,6 @@ public class SendDataServiceImpl implements SendDataService {
map.put("msg",jsonObject.get("msg").toString());
return map;
}else if (status.equals("200")){
String bOrdNo = jsonObject.get("order_no").toString();
companyStoreMapper.updateOdId(bOrdNo,id);
map.put("code",status);
map.put("msg","发送成功");
return map;