Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
6effcfbba7
@ -412,14 +412,7 @@ public class EbikeBikeInfoServiceImpl extends ServiceImpl<EbikeBikeInfoMapper, E
|
||||
if (!ebikeBikeFaultReportFiles.isEmpty()) {
|
||||
ebikeBikeFaultReportFileMapper.insertBatch(ebikeBikeFaultReportFiles);
|
||||
}
|
||||
//上报故障成功后 更新车辆信息表状态
|
||||
//根据车辆编号查出车辆信息
|
||||
String currentStatus = EbikeStatus.WAITING_FOR_REPAIR; // 获取当前状态为“待维修”
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
queryWrapper.eq("bike_code", ebikeBikeFaultReport.getBikeCode());
|
||||
EbikeBikeInfo ebikeBikeInfo = ebikeBikeInfoMapper.selectOneByQuery(queryWrapper);
|
||||
ebikeBikeInfo.setState(currentStatus);
|
||||
ebikeBikeInfoMapper.update(ebikeBikeInfo);
|
||||
modifyMaintenanceStatus(ebikeBikeFaultReport.getBikeCode());
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
log.error("faultReporting===>{}", e.getMessage() + Arrays.toString(e.getStackTrace()));
|
||||
@ -657,6 +650,7 @@ public class EbikeBikeInfoServiceImpl extends ServiceImpl<EbikeBikeInfoMapper, E
|
||||
if (!ebikeBikeFaultRepairRecords.isEmpty()) {
|
||||
ebikeBikeFaultRepairRecordMapper.insertBatch(ebikeBikeFaultRepairRecords);
|
||||
}
|
||||
modifyMaintenanceStatus(ebikeBikeInfo.getBikeCode());
|
||||
return ebikeBikeOrder.getOrderId();
|
||||
} catch (Exception e) {
|
||||
log.error("createWorkOrder===>" + e.getMessage() + Arrays.toString(e.getStackTrace()));
|
||||
@ -870,6 +864,8 @@ public class EbikeBikeInfoServiceImpl extends ServiceImpl<EbikeBikeInfoMapper, E
|
||||
QueryWrapper query = QueryWrapper.create();
|
||||
switch (orderType){
|
||||
case "1":
|
||||
EbikeBikeInfo ebikeBikeInfo = ebikeBikeInfoMapper.selectOneById(ebikeBikeOrder.getOrderId());
|
||||
modifyMaintenanceStatus(ebikeBikeInfo.getBikeCode());
|
||||
break;
|
||||
case "2":
|
||||
query.eq(EBIKE_BIKE_FAULT_REPAIR_RECORD.ORDER_ID.getName(), orderId);
|
||||
@ -1473,5 +1469,25 @@ public class EbikeBikeInfoServiceImpl extends ServiceImpl<EbikeBikeInfoMapper, E
|
||||
|
||||
return JsonResult.success(resEbikeInfoReginIdDtos);
|
||||
}
|
||||
private void modifyMaintenanceStatus(String bikeCode){
|
||||
//是否存在维修中的订单数据
|
||||
int i = ebikeBikeInfoMapper.selectOrderCount(bikeCode);
|
||||
//查询车辆是否存在故障
|
||||
int i1 = ebikeBikeInfoMapper.selectReportCount(bikeCode);
|
||||
String currentStatus = EbikeStatus.WAITING_FOR_REPAIR;
|
||||
if(i >0){ //维修中
|
||||
currentStatus=EbikeStatus.REPAIRING;
|
||||
} else if(i==0 && i1>0){ //待维修
|
||||
currentStatus=EbikeStatus.WAITING_FOR_SHIPMENT;
|
||||
}else if(i==0 && i1==0){ //待出库
|
||||
currentStatus=EbikeStatus.WAITING_FOR_SHIPMENT;
|
||||
}
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
queryWrapper.eq("bike_code", bikeCode);
|
||||
EbikeBikeInfo ebikeBikeInfo = ebikeBikeInfoMapper.selectOneByQuery(queryWrapper);
|
||||
ebikeBikeInfo.setState(currentStatus);
|
||||
ebikeBikeInfoMapper.update(ebikeBikeInfo);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user