修改ecuId取值错误问题
This commit is contained in:
parent
312e7e178d
commit
1861389672
@ -768,6 +768,33 @@ public class EbikeBikeInfoController {
|
|||||||
return JsonResult.success("", resDispatchVehicleDto);
|
return JsonResult.success("", resDispatchVehicleDto);
|
||||||
}
|
}
|
||||||
return JsonResult.failed("获取调度车辆数据失败!");
|
return JsonResult.failed("获取调度车辆数据失败!");
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 有工单-根据工单ID 车辆编号 新增调度车车辆
|
||||||
|
* @param ebikeDispatchRecordDto
|
||||||
|
*/
|
||||||
|
|
||||||
|
@PostMapping("createDispatchRecord")
|
||||||
|
public JsonResult<?> createDispatchRecord(@RequestBody ReqEbikeDispatchRecordDto ebikeDispatchRecordDto) {
|
||||||
|
EbikeDispatchRecords dispatchRecord = ebikeBikeInfoService.createDispatchRecord(ebikeDispatchRecordDto);
|
||||||
|
if (!StringUtils.isEmpty(dispatchRecord)) {
|
||||||
|
return JsonResult.success("", dispatchRecord);
|
||||||
|
}else{
|
||||||
|
return JsonResult.failed("车辆已经在调度列表中!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除调度记录接口
|
||||||
|
* @param recordId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("deleteDispatchRecord")
|
||||||
|
public JsonResult<?> deleteDispatchRecord(@RequestParam(name = "recordId") String recordId) {
|
||||||
|
Boolean aBoolean = ebikeBikeInfoService.deleteDispatchRecord(recordId);
|
||||||
|
if (aBoolean) {
|
||||||
|
return JsonResult.success("删除成功", aBoolean);
|
||||||
|
}
|
||||||
|
return JsonResult.failed("删除失败!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -59,4 +59,8 @@ public class ResInventoryBikeListDto {
|
|||||||
* IMEI
|
* IMEI
|
||||||
*/
|
*/
|
||||||
private String imei;
|
private String imei;
|
||||||
|
/**
|
||||||
|
* ecuId
|
||||||
|
*/
|
||||||
|
private String ecuId;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,7 +35,7 @@ public class EbikeDispatchRecords implements Serializable {
|
|||||||
* 自增主键,唯一标识一条记录
|
* 自增主键,唯一标识一条记录
|
||||||
*/
|
*/
|
||||||
@Id
|
@Id
|
||||||
private Long id;
|
private String id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 工单ID,表示对应的工单
|
* 工单ID,表示对应的工单
|
||||||
|
|||||||
@ -249,4 +249,16 @@ public interface EbikeBikeInfoService extends IService<EbikeBikeInfo> {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ResDispatchVehicleDto getDispatchVehicleByOrderId(String orderId);
|
ResDispatchVehicleDto getDispatchVehicleByOrderId(String orderId);
|
||||||
|
/**
|
||||||
|
* 有工单-根据工单ID 车辆编号 新增调度车车辆
|
||||||
|
* @param ebikeDispatchRecordDto
|
||||||
|
*/
|
||||||
|
EbikeDispatchRecords createDispatchRecord(ReqEbikeDispatchRecordDto ebikeDispatchRecordDto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除调度记录接口
|
||||||
|
* @param recordId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Boolean deleteDispatchRecord(String recordId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,6 +32,7 @@ import com.mybatisflex.core.query.QueryWrapper;
|
|||||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.kafka.common.errors.ResourceNotFoundException;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -234,7 +235,7 @@ public class EbikeBikeInfoServiceImpl extends ServiceImpl<EbikeBikeInfoMapper, E
|
|||||||
ResInventoryBikeListDto resInventoryBikeListDto = ebikeBikeInfoMapper
|
ResInventoryBikeListDto resInventoryBikeListDto = ebikeBikeInfoMapper
|
||||||
.selectOneByQueryAs(queryWrapper, ResInventoryBikeListDto.class);
|
.selectOneByQueryAs(queryWrapper, ResInventoryBikeListDto.class);
|
||||||
queryWrapper.clear();
|
queryWrapper.clear();
|
||||||
queryWrapper.eq("ecu_id", resEbikeBikeAndEcuCodeDto.getEcuId());
|
queryWrapper.eq("ecu_id", resInventoryBikeListDto.getEcuId());
|
||||||
EbikeEcuInfo ebikeEcuInfo = ebikeEcuInfoMapper.selectOneByQuery(queryWrapper);
|
EbikeEcuInfo ebikeEcuInfo = ebikeEcuInfoMapper.selectOneByQuery(queryWrapper);
|
||||||
BeanUtils.copyProperties(resInventoryBikeListDto, resEbikeBikeAndEcuCodeDto);
|
BeanUtils.copyProperties(resInventoryBikeListDto, resEbikeBikeAndEcuCodeDto);
|
||||||
BeanUtils.copyProperties(ebikeEcuInfo, resEbikeBikeAndEcuCodeDto);
|
BeanUtils.copyProperties(ebikeEcuInfo, resEbikeBikeAndEcuCodeDto);
|
||||||
@ -1215,4 +1216,39 @@ public class EbikeBikeInfoServiceImpl extends ServiceImpl<EbikeBikeInfoMapper, E
|
|||||||
|
|
||||||
return resDispatchVehicleDto;
|
return resDispatchVehicleDto;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 有工单-根据工单ID 车辆编号 新增调度车车辆
|
||||||
|
* @param ebikeDispatchRecordDto
|
||||||
|
*/
|
||||||
|
public EbikeDispatchRecords createDispatchRecord(ReqEbikeDispatchRecordDto ebikeDispatchRecordDto){
|
||||||
|
// 检查是否已存在相同的 OrderId 和 BikeCode
|
||||||
|
|
||||||
|
QueryWrapper query = QueryWrapper.create();
|
||||||
|
query.eq("dispatch_state", 0);
|
||||||
|
query.eq("bike_code", ebikeDispatchRecordDto.getBikeCode());
|
||||||
|
// 执行查询操作
|
||||||
|
EbikeDispatchRecords existingRecord = ebikeDispatchRecordsMapper.selectOneByQuery(query);
|
||||||
|
|
||||||
|
if (existingRecord != null) {
|
||||||
|
// 如果存在,直接返回现有记录
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
EbikeDispatchRecords ebikeDispatchRecords = new EbikeDispatchRecords();
|
||||||
|
ebikeDispatchRecords.setOrderId(ebikeDispatchRecordDto.getOrderId());
|
||||||
|
ebikeDispatchRecords.setBikeCode(ebikeDispatchRecordDto.getBikeCode());
|
||||||
|
ebikeDispatchRecords.setDispatchState(ebikeDispatchRecordDto.getDispatchState());
|
||||||
|
ebikeDispatchRecordsMapper.insert(ebikeDispatchRecords);
|
||||||
|
return ebikeDispatchRecords;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 删除调度记录接口
|
||||||
|
* @param recordId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Boolean deleteDispatchRecord(String recordId) {
|
||||||
|
if (ebikeDispatchRecordsMapper.selectOneById(recordId) == null) {
|
||||||
|
throw new ResourceNotFoundException("调度记录不存在");
|
||||||
|
}
|
||||||
|
return ebikeDispatchRecordsMapper.deleteById(recordId) > 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user