@ -1,22 +1,21 @@
@@ -1,22 +1,21 @@
package com.cloud.kicc.commonbiz.service.impl ;
import cn.hutool.core.collection.ListUtil ;
import cn.hutool.core.util.ArrayUtil ;
import cn.hutool.core.util.NumberUtil ;
import cn.hutool.core.util.ObjectUtil ;
import cn.hutool.core.util.StrUtil ;
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.MapLogisticPoint ;
import com.cloud.kicc.commonbiz.api.entity.MapTask ;
import com.cloud.kicc.commonbiz.api.entity.MapTaskPreset ;
import com.cloud.kicc.commonbiz.api.entity.* ;
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.IMapTaskPresetService ;
import com.cloud.kicc.commonbiz.service.IMapTaskService ;
import com.cloud.kicc.commonbiz.service.* ;
import lombok.RequiredArgsConstructor ;
import org.springframework.stereotype.Service ;
import org.springframework.transaction.annotation.Transactional ;
import java.util.List ;
/ * *
* < p >
* 地图核心主任务表 服务实现类
@ -34,9 +33,15 @@ public class MapLogisticServiceImpl extends ServiceImpl<MapLogisticMapper, MapLo
@@ -34,9 +33,15 @@ public class MapLogisticServiceImpl extends ServiceImpl<MapLogisticMapper, MapLo
private final IMapTaskPresetService iMapTaskPresetService ;
private final IMapLogisticPointService iMapLogisticPointService ;
private final HospitalService hospitalService ;
private final OrgService orgService ;
@Override
public void mapSaveOrUpdate ( MapLogistic mapLogistic ) {
// 保存不做过多的处理,直接先删后加,由于前端未做操作记录池功能,不能实现表格数据的增删改
List < Org > orgList = orgService . list ( ) ;
List < Hospital > hospitalList = hospitalService . list ( Wrappers . < Hospital > lambdaQuery ( ) . eq ( Hospital : : getMapNotify , "1" ) ) ;
super . removeById ( mapLogistic ) ;
iMapTaskService . remove ( Wrappers . < MapTask > lambdaUpdate ( ) . eq ( MapTask : : getMapLogisticId , mapLogistic . getId ( ) ) ) ;
iMapTaskPresetService . remove ( Wrappers . < MapTaskPreset > lambdaUpdate ( ) . eq ( MapTaskPreset : : getMapLogisticId , mapLogistic . getId ( ) ) ) ;
@ -52,8 +57,37 @@ public class MapLogisticServiceImpl extends ServiceImpl<MapLogisticMapper, MapLo
@@ -52,8 +57,37 @@ public class MapLogisticServiceImpl extends ServiceImpl<MapLogisticMapper, MapLo
mapTask . getMapTaskPreset ( ) . forEach ( mapTaskPreset - > {
mapTaskPreset . setMapLogisticId ( mapLogistic . getId ( ) ) ;
mapTaskPreset . setMapTaskId ( mapTask . getId ( ) ) ;
iMapTaskPresetService . save ( mapTaskPreset ) ;
/*orgList.stream().filter(ietm -> StrUtil.equals(ietm.getId(), ) )*/
/ * const hospital = mapState . hospitalList . find ( e = > e . value = = item . hospitalId ) ,
org = item . orgId ? mapState . orgList . find ( e = > e . value = = item . orgId ) : { } as MapPointType ; * /
// 追加交接转办任务标记点,首次新增没有任何数据,后面会有收样员设置的位置数据覆盖
mapLogistic . getMapLogisticPoint ( ) . addAll ( ListUtil . of (
new MapLogisticPoint ( )
. setLng ( mapTaskPreset . getOrginPresetLng ( ) )
. setLat ( mapTaskPreset . getOrginPresetLat ( ) )
. setSort ( Integer . sum ( mapLogistic . getMapLogisticPoint ( ) . size ( ) , 1 ) )
. setType ( "0" )
. setTaskType ( "1" )
. setMapTaskId ( mapTaskPreset . getId ( ) )
. setHospitalId ( mapTaskPreset . getOrginPresetId ( ) )
. setHospitalName ( mapTaskPreset . getOrginPresetName ( ) )
. setCourierUserId ( mapTaskPreset . getCourierUserId ( ) ) ,
new MapLogisticPoint ( )
. setLng ( mapTaskPreset . getDestinationPresetLng ( ) )
. setLat ( mapTaskPreset . getDestinationPresetLat ( ) )
. setSort ( Integer . sum ( mapLogistic . getMapLogisticPoint ( ) . size ( ) , 2 ) )
. setType ( "0" )
. setTaskType ( "1" )
. setMapTaskId ( mapTaskPreset . getId ( ) )
. setHospitalId ( mapTaskPreset . getDestinationPresetId ( ) )
. setHospitalName ( mapTaskPreset . getDestinationPresetName ( ) )
. setCourierUserId ( mapTaskPreset . getCourierUserId ( ) )
) ) ;
} ) ;
iMapTaskPresetService . saveBatch ( mapTask . getMapTaskPreset ( ) ) ;
}
} ) ;
mapLogistic . getMapLogisticPoint ( ) . forEach ( item - > item . setMapLogisticId ( mapLogistic . getId ( ) ) ) ;