@ -4,6 +4,7 @@ import cn.hutool.core.collection.ListUtil;
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.date.LocalDateTimeUtil ;
import cn.hutool.core.lang.UUID ;
import cn.hutool.core.thread.ThreadUtil ;
import cn.hutool.core.util.BooleanUtil ;
import cn.hutool.core.util.ObjectUtil ;
import cn.hutool.core.util.StrUtil ;
import com.alibaba.fastjson.JSONObject ;
@ -53,6 +54,8 @@ public class MapLogisticServiceImpl extends ServiceImpl<MapLogisticMapper, MapLo
@@ -53,6 +54,8 @@ public class MapLogisticServiceImpl extends ServiceImpl<MapLogisticMapper, MapLo
@Override
public void mapSaveOrUpdate ( MapLogistic mapLogistic ) {
// 生成每一批次操作的批次码
String batchCode = UUID . fromString ( UUID . randomUUID ( ) . toString ( ) ) . toString ( ) ;
// 保存不做过多的处理,直接先删后加,由于前端未做操作记录池功能,不能实现表格数据的增删改
super . removeById ( mapLogistic ) ;
iMapTaskService . remove ( Wrappers . < MapTask > lambdaUpdate ( ) . eq ( MapTask : : getMapLogisticId , mapLogistic . getId ( ) ) ) ;
@ -61,14 +64,22 @@ public class MapLogisticServiceImpl extends ServiceImpl<MapLogisticMapper, MapLo
@@ -61,14 +64,22 @@ public class MapLogisticServiceImpl extends ServiceImpl<MapLogisticMapper, MapLo
super . save ( mapLogistic ) ;
mapLogistic . getMapTask ( ) . forEach ( mapTask - > {
mapTask . setMapLogisticId ( mapLogistic . getId ( ) ) ;
if ( StrUtil . isNotBlank ( mapTask . getReceiptFileId ( ) ) & & StrUtil . isBlank ( mapTask . getBatchCode ( ) ) ) {
mapTask . setBatchCode ( batchCode ) ;
mapTask . setEnabledCreateReport ( true ) ;
}
iMapTaskService . save ( mapTask ) ;
// 匹配查找跟地图任务关联的地图标记点数据,不需要包含其他收养样员的交接任务标记点,他们已经与自己的任务进行了id绑定
// 匹配查找跟地图任务关联的地图标记点数据,不需要包含其他收样员的交接任务标记点,他们已经与自己的任务进行了id绑定
mapLogistic . getMapLogisticPoint ( ) . stream ( )
. filter ( item - > StrUtil . equals ( item . getKey ( ) , mapTask . getKey ( ) ) ) . forEach ( item - > item . setMapTaskId ( mapTask . getId ( ) ) ) ;
if ( ObjectUtil . isNotEmpty ( mapTask . getMapTaskPreset ( ) ) ) {
mapTask . getMapTaskPreset ( ) . forEach ( mapTaskPreset - > {
mapTaskPreset . setMapLogisticId ( mapLogistic . getId ( ) ) ;
mapTaskPreset . setMapTaskId ( mapTask . getId ( ) ) ;
if ( StrUtil . isNotBlank ( mapTaskPreset . getReceiptFileId ( ) ) & & StrUtil . isBlank ( mapTaskPreset . getBatchCode ( ) ) ) {
mapTaskPreset . setBatchCode ( batchCode ) ;
mapTaskPreset . setEnabledCreateReport ( true ) ;
}
iMapTaskPresetService . save ( mapTaskPreset ) ;
// 追加交接转办任务标记点,首次新增没有任何数据,后面会有收样员设置的位置数据覆盖
mapLogistic . getMapLogisticPoint ( ) . addAll ( ListUtil . of (
@ -97,43 +108,51 @@ public class MapLogisticServiceImpl extends ServiceImpl<MapLogisticMapper, MapLo
@@ -97,43 +108,51 @@ public class MapLogisticServiceImpl extends ServiceImpl<MapLogisticMapper, MapLo
}
} ) ;
mapLogistic . getMapLogisticPoint ( ) . forEach ( item - > item . setMapLogisticId ( mapLogistic . getId ( ) ) ) ;
createReportFormSetData ( mapLogistic ) ;
//ThreadUtil.execute(() -> createReportFormSetData(mapLogistic));
ThreadUtil . execute ( ( ) - > createReportFormSetData ( mapLogistic ) ) ;
iMapLogisticPointService . saveBatch ( mapLogistic . getMapLogisticPoint ( ) ) ;
}
private void createReportFormSetData ( MapLogistic mapLogistic ) {
String batchCode = UUID . fromString ( UUID . randomUUID ( ) . toString ( ) ) . toString ( ) ;
mapLogistic . getMapTask ( ) . forEach ( mapTask - > {
if ( StrUtil . isNotEmpty ( mapTask . getReceiptFileId ( ) ) ) {
if ( mapTask . getEnabledCreateReport ( ) ) {
JSONObject jsonObject = new JSONObject ( ) ;
R < User > user = remoteUserService . selectByUserId ( mapTask . getCourierUserId ( ) , SecurityConstants . FROM_IN ) ;
Org org = orgService . getById ( mapTask . getOrgId ( ) ) ;
Hospital hospital = hospitalService . getById ( mapTask . getHospitalId ( ) ) ;
JSONObject jsonObject = new JSONObject ( ) ;
jsonObject . put ( "hospitalId" , hospital . getKlabHospitalAccount ( ) ) ;
jsonObject . put ( "institutionId" , org . getKlabOrgAccount ( ) ) ;
if ( StrUtil . isNotBlank ( mapTask . getOrgId ( ) ) ) {
Org org = orgService . getById ( mapTask . getOrgId ( ) ) ;
jsonObject . put ( "institutionId" , org . getKlabOrgAccount ( ) ) ;
// todo:交接点位置由自己设置
} else jsonObject . put ( "institutionId" , 0 ) ;
// todo:任务科室医生还需讨论需求
jsonObject . put ( "officeId" , 0 ) ;
jsonObject . put ( "doctorId" , 0 ) ;
jsonObject . put ( "syUserId" , user . getData ( ) . getKlabUserAccount ( ) ) ;
jsonObject . put ( "batchCode" , batchCode ) ;
jsonObject . put ( "taskType" , 0 ) ;
jsonObject . put ( "batchCode" , mapTask . getBatchCode ( ) ) ;
jsonObject . put ( "taskType" , mapTask . getTaskType ( ) ) ;
jsonObject . put ( "originImages" , mapTask . getReceiptFileId ( ) ) ;
jsonObject . put ( "remark" , mapTask . getRemarks ( ) ) ;
internalSystemCreateReportForm ( jsonObject ) ;
}
mapTask . getMapTaskPreset ( ) . forEach ( mapTaskPreset - > {
if ( StrUtil . isNotEmpty ( mapTaskPreset . getReceiptFileId ( ) ) ) {
JSONObject jsonObject = new JSONObject ( ) ;
if ( mapTaskPreset . getEnabledCreateReport ( ) ) {
R < User > taskPresetUser = remoteUserService . selectByUserId ( mapTaskPreset . getCourierUserId ( ) , SecurityConstants . FROM_IN ) ;
JSONObject jsonObject = new JSONObject ( ) ;
if ( StrUtil . isNotBlank ( mapTaskPreset . getOrginPresetId ( ) ) ) {
Hospital hospital = hospitalService . getById ( mapTaskPreset . getOrginPresetId ( ) ) ;
jsonObject . put ( "hospitalId" , hospital . getKlabHospitalAccount ( ) ) ;
// todo:交接点位置由自己设置
jsonObject . put ( "hospitalId" , 0 ) ;
jsonObject . put ( "institutionId" , 0 ) ;
} else jsonObject . put ( "hospitalId" , 0 ) ;
if ( StrUtil . isNotBlank ( mapTaskPreset . getDestinationPresetId ( ) ) ) {
Org org = orgService . getById ( mapTaskPreset . getDestinationPresetId ( ) ) ;
jsonObject . put ( "institutionId" , org . getKlabOrgAccount ( ) ) ;
// todo:交接点位置由自己设置
} else jsonObject . put ( "institutionId" , 0 ) ;
// todo:任务科室医生还需讨论需求
jsonObject . put ( "officeId" , 0 ) ;
jsonObject . put ( "doctorId" , 0 ) ;
@ -142,7 +161,7 @@ public class MapLogisticServiceImpl extends ServiceImpl<MapLogisticMapper, MapLo
@@ -142,7 +161,7 @@ public class MapLogisticServiceImpl extends ServiceImpl<MapLogisticMapper, MapLo
jsonObject . put ( "taskType" , 1 ) ;
jsonObject . put ( "originImages" , mapTaskPreset . getReceiptFileId ( ) ) ;
jsonObject . put ( "remark" , mapTaskPreset . getRemarks ( ) ) ;
jsonObject . put ( "batchCode" , batchCode ) ;
jsonObject . put ( "batchCode" , mapTaskPreset . getBatchCode ( ) ) ;
internalSystemCreateReportForm ( jsonObject ) ;
}
} ) ;
@ -150,7 +169,7 @@ public class MapLogisticServiceImpl extends ServiceImpl<MapLogisticMapper, MapLo
@@ -150,7 +169,7 @@ public class MapLogisticServiceImpl extends ServiceImpl<MapLogisticMapper, MapLo
}
private void internalSystemCreateReportForm ( JSONObject jsonObject ) {
public void internalSystemCreateReportForm ( JSONObject jsonObject ) {
okhttp3 . Request request = new okhttp3 . Request
. Builder ( )
. url ( "https://cmsapi.kanglailab.com/reportTask/add" )