no message
This commit is contained in:
@ -75,44 +75,44 @@ public class SendDataController {
|
|||||||
return sendDataService.sendStoreInfoToBattery(Long.parseLong(id));
|
return sendDataService.sendStoreInfoToBattery(Long.parseLong(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
// @ApiOperation(value = "接收充电同步数据接口")
|
@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}")
|
@GetMapping("/subOrder/{id}")
|
||||||
public CompletableFuture<ResponseEntity<Map<String, String>>> sendSubOrderToBattery(@PathVariable String id){
|
public Map<String,String> sendSubOrderToBattery(@PathVariable String id){
|
||||||
log.info("/subOrder 接收充电数据:{}",id);
|
log.info("/subOrder 接收充电数据:{}",id);
|
||||||
return CompletableFuture
|
return sendDataService.sendSubOrderToBattery(Long.parseLong(id));
|
||||||
.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 {
|
||||||
|
// 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 = "接收需同步数据接口")
|
// @ApiOperation(value = "接收需同步数据接口")
|
||||||
|
|||||||
@ -268,62 +268,76 @@ public class SendDataServiceImpl implements SendDataService {
|
|||||||
OrderBatteryInfo orderBatteryInfo = orderBatteryInfoMapper.selectOrderBatteryInfoById(id);
|
OrderBatteryInfo orderBatteryInfo = orderBatteryInfoMapper.selectOrderBatteryInfoById(id);
|
||||||
|
|
||||||
Map<String, String> map = new HashMap<>();
|
Map<String, String> map = new HashMap<>();
|
||||||
if(orderBatteryInfo == null){
|
// if(orderBatteryInfo == null){
|
||||||
map.put("msg","未找到此租电订单信息");
|
// map.put("msg","未找到此租电订单信息");
|
||||||
map.put("code","500");
|
// map.put("code","500");
|
||||||
return map;
|
// return map;
|
||||||
}
|
// }
|
||||||
if (orderBatteryInfo.getPhone() == null || orderBatteryInfo.getPhone().isEmpty()){
|
// if (orderBatteryInfo.getPhone() == null || orderBatteryInfo.getPhone().isEmpty()){
|
||||||
map.put("msg","租电订单手机号不能为空");
|
// map.put("msg","租电订单手机号不能为空");
|
||||||
map.put("code","500");
|
// map.put("code","500");
|
||||||
return map;
|
// return map;
|
||||||
}
|
// }
|
||||||
if (orderBatteryInfo.getStart_date() == null || orderBatteryInfo.getStart_date().isEmpty()){
|
// if (orderBatteryInfo.getStart_date() == null || orderBatteryInfo.getStart_date().isEmpty()){
|
||||||
map.put("msg","租电订单开始时间不能为空");
|
// map.put("msg","租电订单开始时间不能为空");
|
||||||
map.put("code","500");
|
// map.put("code","500");
|
||||||
return map;
|
// return map;
|
||||||
}
|
// }
|
||||||
if(orderBatteryInfo.getEnd_date() == null || orderBatteryInfo.getEnd_date().isEmpty()){
|
// if(orderBatteryInfo.getEnd_date() == null || orderBatteryInfo.getEnd_date().isEmpty()){
|
||||||
map.put("msg","租电订单结束时间不能为空");
|
// map.put("msg","租电订单结束时间不能为空");
|
||||||
map.put("code","500");
|
// map.put("code","500");
|
||||||
return map;
|
// return map;
|
||||||
}
|
// }
|
||||||
if (orderBatteryInfo.getCity() == null ) {
|
// if (orderBatteryInfo.getCity() == null ) {
|
||||||
map.put("msg","租电订单城市不能为空");
|
// map.put("msg","租电订单城市不能为空");
|
||||||
map.put("code","500");
|
// map.put("code","500");
|
||||||
return map;
|
// return map;
|
||||||
}
|
// }
|
||||||
if (orderBatteryInfo.getStore() == null){
|
// if (orderBatteryInfo.getStore() == null){
|
||||||
map.put("msg","租电订单门店不能为空");
|
// map.put("msg","租电订单门店不能为空");
|
||||||
map.put("code","500");
|
// map.put("code","500");
|
||||||
return map;
|
// return map;
|
||||||
}
|
// }
|
||||||
if (orderBatteryInfo.getCategory() == null){
|
// if (orderBatteryInfo.getCategory() == null){
|
||||||
map.put("msg","电池类别不能为空");
|
// map.put("msg","电池类别不能为空");
|
||||||
map.put("code","500");
|
// map.put("code","500");
|
||||||
return map;
|
// return map;
|
||||||
}
|
// }
|
||||||
if (orderBatteryInfo.getOperator_id() == null){
|
// if (orderBatteryInfo.getOperator_id() == null){
|
||||||
map.put("msg","运营商ID不能为空");
|
// map.put("msg","运营商ID不能为空");
|
||||||
map.put("code","500");
|
// map.put("code","500");
|
||||||
return map;
|
// return map;
|
||||||
}
|
// }
|
||||||
if (orderBatteryInfo.getOrder_no() == null){
|
// if (orderBatteryInfo.getOrder_no() == null){
|
||||||
map.put("msg","租电订单编号不能为空");
|
// map.put("msg","租电订单编号不能为空");
|
||||||
map.put("code","500");
|
// map.put("code","500");
|
||||||
return map;
|
// return map;
|
||||||
}
|
// }
|
||||||
|
|
||||||
SyncRequest syncRequest = new SyncRequest();
|
SyncRequest syncRequest = new SyncRequest();
|
||||||
syncRequest.setData(orderBatteryInfo);
|
syncRequest.setData(orderBatteryInfo);
|
||||||
if (saveRecord(syncRequest,URL+"/batteryorder",id,"batteryorder")){
|
|
||||||
|
String response = thirdPartyForwardService.forwardData(URL+"/batteryorder",JSON.toJSONString(syncRequest));
|
||||||
|
JSONObject jsonObject = JSON.parseObject(response);
|
||||||
|
String status = jsonObject.get("status").toString();
|
||||||
|
|
||||||
|
if (status.equals("40001") || status.equals("40002") || status.equals("40003") || status.equals("40005") || status.equals("40006")){
|
||||||
|
map.put("code",status);
|
||||||
|
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","发送成功");
|
map.put("msg","发送成功");
|
||||||
map.put("code","200");
|
return map;
|
||||||
}
|
}else if (status.equals("401")){
|
||||||
else {
|
map.put("code",status);
|
||||||
map.put("msg","发送失败");
|
map.put("msg","鉴权失败");
|
||||||
map.put("code","500");
|
return map;
|
||||||
}
|
}
|
||||||
|
map.put("code","500");
|
||||||
|
map.put("msg","系统异常");
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user