@ -22,6 +22,7 @@ import org.springframework.web.bind.annotation.*;
@@ -22,6 +22,7 @@ import org.springframework.web.bind.annotation.*;
import java.util.Arrays ;
import java.util.List ;
import java.util.Optional ;
/ * *
* < p >
@ -60,29 +61,25 @@ public class MapLogisticController {
@@ -60,29 +61,25 @@ public class MapLogisticController {
@GetMapping ( "getMapDataByCourierUserId/{courierUserId:\\w+}" )
@ApiOperation ( value = "根据收样员id获取地图数据" )
public R getById ( @PathVariable String courierUserId ) {
MapLogistic mapLogistic = iMapLogisticService . getOne ( Wrappers . < MapLogistic > lambdaQuery ( ) . eq ( MapLogistic : : getCourierUserId , courierUserId ) ) ;
if ( ObjectUtil . isNotEmpty ( mapLogistic ) ) {
List < MapTask > mapTaskList = iMapTaskService
. list ( Wrappers . < MapTask > lambdaQuery ( ) . eq ( MapTask : : getMapLogisticId , mapLogistic . getId ( ) ) . orderByAsc ( MapTask : : getSort ) ) ;
mapTaskList . forEach ( item - > {
// 需要带上key,前端地图设计器表格是通过唯一key定位行数据,以及保存时通过key绑定地图标记点数据
item . setKey ( item . getId ( ) ) ;
List < MapTaskPreset > mapTaskPresetList = iMapTaskPresetService
. list ( Wrappers . < MapTaskPreset > lambdaQuery ( ) . eq ( MapTaskPreset : : getMapTaskId , item . getId ( ) ) . orderByAsc ( MapTaskPreset : : getSort ) ) ;
mapTaskPresetList . forEach ( childItem - > childItem . setKey ( childItem . getId ( ) ) ) ;
item . setMapTaskPreset ( mapTaskPresetList ) ;
} ) ;
List < MapLogisticPoint > mapLogisticPointList = iMapLogisticPointService
. list ( Wrappers . < MapLogisticPoint > lambdaQuery ( ) . eq ( MapLogisticPoint : : getMapLogisticId , mapLogistic . getId ( ) ) . orderByAsc ( MapLogisticPoint : : getSort ) ) ;
mapLogisticPointList . forEach ( item - > item . setKey ( item . getId ( ) ) ) ;
mapLogistic . setMapTask ( mapTaskList ) ;
mapLogistic . setMapLogisticPoint ( mapLogisticPointList ) ;
// 针对与没有地图数据的收样员,检查是否有其他收样员设置的交接转办任务
} else {
}
MapLogistic mapLogistic = Optional . ofNullable ( iMapLogisticService
. getOne ( Wrappers . < MapLogistic > lambdaQuery ( ) . eq ( MapLogistic : : getCourierUserId , courierUserId ) ) ) . orElse ( new MapLogistic ( ) ) ;
List < MapTask > mapTaskList = iMapTaskService
. list ( Wrappers . < MapTask > lambdaQuery ( ) . eq ( MapTask : : getMapLogisticId , mapLogistic . getId ( ) ) . orderByAsc ( MapTask : : getSort ) ) ;
mapTaskList . forEach ( item - > {
// 需要绑上key,前端地图设计器表格是通过唯一key定位行数据,以及保存时通过key绑定地图标记点数据
item . setKey ( item . getId ( ) ) ;
List < MapTaskPreset > mapTaskPresetList = iMapTaskPresetService
. list ( Wrappers . < MapTaskPreset > lambdaQuery ( ) . eq ( MapTaskPreset : : getMapTaskId , item . getId ( ) ) . orderByAsc ( MapTaskPreset : : getSort ) ) ;
mapTaskPresetList . forEach ( childItem - > childItem . setKey ( childItem . getId ( ) ) ) ;
item . setMapTaskPreset ( mapTaskPresetList ) ;
} ) ;
List < MapLogisticPoint > mapLogisticPointList = iMapLogisticPointService . getTaskPointByCourierUserId ( mapLogistic . getCourierUserId ( ) ) ;
List < MapLogisticPoint > mapTaskPresetLogisticPointList = iMapLogisticPointService . getTaskPresetPointByCourierUserId ( mapLogistic . getCourierUserId ( ) ) ;
mapLogisticPointList . forEach ( item - > item . setKey ( item . getId ( ) ) ) ;
mapTaskPresetLogisticPointList . forEach ( item - > item . setKey ( item . getId ( ) ) ) ;
mapLogistic . setMapTask ( mapTaskList ) ;
mapLogistic . setMapLogisticPoint ( mapLogisticPointList ) ;
mapLogistic . setMapTaskPresetLogisticPoint ( mapTaskPresetLogisticPointList ) ;
return R . ok ( mapLogistic ) ;
}