|
|
@ -1,10 +1,23 @@ |
|
|
|
package com.cloud.kicc.commonbiz.service.impl; |
|
|
|
package com.cloud.kicc.commonbiz.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
import com.cloud.kicc.commonbiz.api.entity.MapLogistic; |
|
|
|
import com.cloud.kicc.commonbiz.api.entity.MapLogistic; |
|
|
|
|
|
|
|
import com.cloud.kicc.commonbiz.api.entity.MapLogisticPoint; |
|
|
|
|
|
|
|
import com.cloud.kicc.commonbiz.api.entity.MapTask; |
|
|
|
|
|
|
|
import com.cloud.kicc.commonbiz.api.entity.MapTaskPreset; |
|
|
|
import com.cloud.kicc.commonbiz.mapper.MapLogisticMapper; |
|
|
|
import com.cloud.kicc.commonbiz.mapper.MapLogisticMapper; |
|
|
|
|
|
|
|
import com.cloud.kicc.commonbiz.service.IMapLogisticPointService; |
|
|
|
import com.cloud.kicc.commonbiz.service.IMapLogisticService; |
|
|
|
import com.cloud.kicc.commonbiz.service.IMapLogisticService; |
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
import com.cloud.kicc.commonbiz.service.IMapTaskPresetService; |
|
|
|
|
|
|
|
import com.cloud.kicc.commonbiz.service.IMapTaskService; |
|
|
|
|
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
|
|
|
|
import org.apache.poi.ss.formula.functions.T; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.Optional; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* <p> |
|
|
|
* <p> |
|
|
@ -15,6 +28,42 @@ import org.springframework.stereotype.Service; |
|
|
|
* @since 2022-07-22 |
|
|
|
* @since 2022-07-22 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Service |
|
|
|
@Service |
|
|
|
|
|
|
|
@RequiredArgsConstructor |
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public class MapLogisticServiceImpl extends ServiceImpl<MapLogisticMapper, MapLogistic> implements IMapLogisticService { |
|
|
|
public class MapLogisticServiceImpl extends ServiceImpl<MapLogisticMapper, MapLogistic> implements IMapLogisticService { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final IMapTaskService iMapTaskService; |
|
|
|
|
|
|
|
private final IMapTaskPresetService iMapTaskPresetService; |
|
|
|
|
|
|
|
private final IMapLogisticPointService iMapLogisticPointService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public boolean mapSaveOrUpdate(MapLogistic mapLogistic) { |
|
|
|
|
|
|
|
// 保存不做过多的处理,直接先删后加,由于前端未做操作记录池功能,不能实现表格数据的增删改
|
|
|
|
|
|
|
|
super.removeById(mapLogistic); |
|
|
|
|
|
|
|
iMapTaskService.remove(Wrappers.<MapTask>lambdaUpdate().eq(MapTask::getMapLogisticId, mapLogistic.getId())); |
|
|
|
|
|
|
|
iMapTaskPresetService.remove(Wrappers.<MapTaskPreset>lambdaUpdate().eq(MapTaskPreset::getMapLogisticId, mapLogistic.getId())); |
|
|
|
|
|
|
|
iMapLogisticPointService.remove(Wrappers.<MapLogisticPoint>lambdaUpdate().eq(MapLogisticPoint::getMapLogisticId, mapLogistic.getId())); |
|
|
|
|
|
|
|
super.save(mapLogistic); |
|
|
|
|
|
|
|
mapLogistic.getMapTask().forEach(mapTask -> { |
|
|
|
|
|
|
|
mapTask.setMapLogisticId(mapLogistic.getId()); |
|
|
|
|
|
|
|
iMapTaskService.save(mapTask); |
|
|
|
|
|
|
|
// 匹配查找跟地图任务关联的地图标记点数据
|
|
|
|
|
|
|
|
MapLogisticPoint mapLogisticPoint = mapLogistic.getMapLogisticPoint().stream() |
|
|
|
|
|
|
|
.filter(item -> item.getKey().equals("1")).findFirst().get(); |
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(mapLogisticPoint)){ |
|
|
|
|
|
|
|
mapLogisticPoint.setMapLogisticId(mapLogistic.getId()); |
|
|
|
|
|
|
|
mapLogisticPoint.setMapTaskId(mapTask.getId()); |
|
|
|
|
|
|
|
iMapLogisticPointService.save(mapLogisticPoint); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(mapTask.getMapTaskPreset())) { |
|
|
|
|
|
|
|
mapTask.getMapTaskPreset().forEach(mapTaskPreset -> { |
|
|
|
|
|
|
|
mapTaskPreset.setMapLogisticId(mapLogistic.getId()); |
|
|
|
|
|
|
|
mapTaskPreset.setMapTaskId(mapTask.getId()); |
|
|
|
|
|
|
|
iMapTaskPresetService.save(mapTaskPreset); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|