13693261870
2025-07-02 6708810c4de34dfb9513061432d656f91d56ee3a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
package com.ruoyi.buss.controller;
 
 
import com.ruoyi.buss.common.DateUtils;
import com.ruoyi.buss.common.RfidUtil;
import com.ruoyi.buss.domain.*;
import com.ruoyi.buss.domain.dto.AllocBerthReqDTO;
import com.ruoyi.buss.domain.dto.AllocBerthTimeReqDTO;
import com.ruoyi.buss.domain.dto.DsTaskQueryParam;
import com.ruoyi.buss.domain.dto.TaskQueryParam;
import com.ruoyi.buss.domain.vo.RfIdVo;
import com.ruoyi.buss.service.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.StringUtils;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
 
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
 
@Tag(name = "支队任务接口")
@RestController
@RequestMapping("/buss/tasklist/ex")
public class DMTaskTimeController  extends BaseController {
 
    @Autowired
    private IDsTaskService iDsTaskService;
    @Autowired
    private IDsTaskList2Service iDsTaskListService;
    @Autowired
    private IDmBerth2Service dmBerthService;
    @Autowired
    private IDmHarbor2Service dmHarborService;
    @Autowired
    private IDmDdConfigService iDmDdConfigService;
    @Autowired
    private IDsTaskDetailService iDsTaskDetailService;
 
    @Value("${ruoyi.buss.rfid.url:http://192.168.0.2:10800/open/goods/task}")
    private String rfidUrl;
 
    private static String WATER_FLAG = "water";
    private static String MATER_FLAG = "mater";
    private static String OIL_FLAG = "oil";
    private static String AMMO_FLAG = "ammo";
    private static String AMMO_O_FLAG = "ammo_o";
 
 
    @Operation(summary = "获取本支队所有任务列表")
    @PostMapping("/histask/list")
    @ResponseBody
    public AjaxResult getTaskList(@RequestBody DsTaskQueryParam param) {
        if(null != param.getEtime()){
            param.setEtime(DateUtils.setToNextDayZero(param.getEtime()));
        }
        List<DsTask> dsTaskList = iDsTaskService.selectDsTaskListByParam(param);
        return success(dsTaskList);
    }
 
    @Operation(summary = "支队任务下发")
    @Log(title = "支队任务下发", businessType = BusinessType.UPDATE)
    @PostMapping("/apply/{taskid}/{deptid}")
    @ResponseBody
    public AjaxResult apply(@Parameter(name = "taskid", required = true, description = "任务编号") @PathVariable("taskid") Long taskid,
                            @Parameter(name = "deptid", required = true, description = "部门ID") @PathVariable("deptid") Long deptid,
                            @Parameter(name = "ids", required = false, description = "任务Ids") @RequestParam(value = "ids", required = false) String ids) {
        TaskQueryParam queryParam = new TaskQueryParam();
        if(null != taskid){
            queryParam.setTaskId(taskid);
        }
        queryParam.setDeptId(deptid);
        queryParam.setStatus("1");
 
        if(StringUtils.isNotBlank(ids)){
            List<Long> idList = Arrays.stream(ids.split(","))
                    .map(Long::valueOf)
                    .collect(Collectors.toList());
            if(null != idList && idList.size() > 0){
                queryParam.setIds(idList);
            }
        }
 
        List<DsTaskList2> dsTaskList = iDsTaskListService.selectDsTaskListByParam(queryParam);
        if(null == dsTaskList || dsTaskList.size() == 0){
            return error("未获取到对应的任务");
        }
 
 
        // 获取所有的泊位信息
        List<DmBerth2> berth2List = dmBerthService.selectDmBerthList(new DmBerth2());
 
        Map<Long, DmBerth2> berth2Map = berth2List.stream().collect(Collectors.toMap(DmBerth2::getPKID, berth -> berth));
 
 
        List<DsTaskList2> taskToUpdate = dsTaskList.stream().map(tmp -> {
            tmp.setStatus("2");
            DmBerth2 berth2 = berth2Map.get(tmp.getPKID());
            if(null != berth2){
                tmp.setPath(berth2.getPath());
            }
            return tmp;
        }).collect(Collectors.toList());
 
        if(!taskToUpdate.isEmpty()){
            iDsTaskListService.batchUpdateDsTaskList(taskToUpdate);
        }
 
        List<RfIdVo> rfIdVoList = new ArrayList<>();
        //rfIdVoList.add(new RfIdVo(Integer.valueOf(task.getShipNo()), task.getShipNo()+"舰艇补给任务", task.getPath()));
 
        // 推送数据到 RFID
//        try{
//            RfidUtil.asyncSendJsonPost(rfidUrl, rfIdVoList);
//        }catch (Exception e){e.printStackTrace();}
 
        // 更新Detail  路径规划
        this.updateDetailPath(taskid, deptid, berth2List);
 
        DsTaskList2 tmpTaskList = new DsTaskList2();
        tmpTaskList.setStatus("1");
        tmpTaskList.setTaskId(taskid);
        List<DsTaskList2> taskList2List = iDsTaskListService.selectDsTaskListList(tmpTaskList);
 
        if(null != taskList2List && taskList2List.size() > 0){
            DsTask dsTask = iDsTaskService.selectDsTaskByPKID(taskid);
            dsTask.setStatus("2");
            iDsTaskService.updateDsTask(dsTask);
            return success("下发成功");
        }
 
 
        return error("下发失败,请重试");
    }
 
 
    @Operation(summary = "支队任务下发")
    @Log(title = "支队任务下发", businessType = BusinessType.UPDATE)
    @PostMapping("/apply/{deptid}")
    @ResponseBody
    public AjaxResult applyV2(@Parameter(name = "taskid", required = true, description = "任务编号") @RequestParam("taskid") Long taskid,
                            @Parameter(name = "deptid", required = true, description = "部门ID") @PathVariable("deptid") Long deptid,
                            @Parameter(name = "ids", required = true, description = "任务Ids") @RequestParam("ids") String ids) {
        TaskQueryParam queryParam = new TaskQueryParam();
        if(null != taskid){
            queryParam.setTaskId(taskid);
        }
        queryParam.setDeptId(deptid);
        queryParam.setStatus("1");
 
        if(StringUtils.isNotBlank(ids)){
            List<Long> idList = Arrays.stream(ids.split(","))
                    .map(Long::valueOf)
                    .collect(Collectors.toList());
            if(null != idList && idList.size() > 0){
                queryParam.setIds(idList);
            }
        }
 
        List<DsTaskList2> dsTaskList = iDsTaskListService.selectDsTaskListByParam(queryParam);
 
        if(null == dsTaskList || dsTaskList.size() == 0){
            return error("未获取到对应的任务");
        }
 
        int flag = 1;
        for (DsTaskList2 task : dsTaskList) {
            task.setStatus("2");
            int updateResult = iDsTaskListService.updateDsTaskList(task);
            if (updateResult != 1) {
                flag = 0;
                break;
            }
        }
        DsTaskList2 tmpTaskList = new DsTaskList2();
        tmpTaskList.setStatus("1");
        tmpTaskList.setTaskId(taskid);
        List<DsTaskList2> taskList2List = iDsTaskListService.selectDsTaskListList(tmpTaskList);
        if(null != taskList2List && taskList2List.size() == 0){
            DsTask dsTask = iDsTaskService.selectDsTaskByPKID(taskid);
            dsTask.setStatus("2");
            iDsTaskService.updateDsTask(dsTask);
        }
 
        if(flag == 1){
            return success("下发成功");
        }
        return error("下发失败,请重试");
    }
 
 
    @Operation(summary = "获取最新下发的任务列表")
    @GetMapping("/task")
    @ResponseBody
    public AjaxResult getByTaskId(@Parameter(name = "deptId", description = "部门编码") Long deptId) {
        if(null == deptId)deptId = getDeptId();
        // 获取支队正在进行的任务
//        DsTask taskEntity = new DsTask();
//        taskEntity.setStatus("1");          // 1 状态为  支队   2 状态为 完成状态。
//        List<DsTask> tasks = iDsTaskService.selectDsTaskList(taskEntity);
//        if(null != tasks && tasks.size() > 0){
//            DsTask curTask = tasks.get(0);
            DsTaskList2 taskListEntity = new DsTaskList2();
//            taskListEntity.setTaskId(curTask.getPKID());
            taskListEntity.setDeptId(deptId);
            taskListEntity.setStatus("1");
            List<DsTaskList2> dsTaskList2s = iDsTaskListService.selectDsTaskListList(taskListEntity);
            return success(dsTaskList2s);
//        }
//        return success();
    }
 
    /**
     * 查询泊位信息列表
     */
    @Operation(summary = "查询泊位信息列表")
    @GetMapping("/berth/list")
    @ResponseBody
    public AjaxResult dmBerthList(@Parameter(name = "deptId", description = "部门编码") Long deptId) {
        if(null == deptId)deptId = getDeptId();
        if(null == deptId){
            return error("获取当前用户信息失败,请重新登录后尝试。");
        }
        DmHarbor2 harbor = new DmHarbor2();
        harbor.setDeptId(deptId);
        List<DmHarbor2> harborList = dmHarborService.selectDmHarborList(harbor);
        List<Long> tmpHarborIds = new ArrayList<>();
        harborList.stream().forEach(item -> {
            tmpHarborIds.add(item.getPKID());
        });
        List<DmBerth2> list = dmBerthService.selectDmBerthByHarborIdsAndStatus(tmpHarborIds);
 
        list = list.stream()
                .filter(task -> task.getDEPTH() != null)
                .sorted(Comparator.comparing(DmBerth2::getHarborId).thenComparing(DmBerth2::getOrderNum))
                .collect(Collectors.toList());
 
        return success(list);
    }
 
    @Operation(summary = "查询码头信息详情")
    @GetMapping("/harbor/id/{harborid}")
    @ResponseBody
    public AjaxResult dmBerthById(@Parameter(name = "harborid", description = "码头编码") @PathVariable("harborid") Long harborid) {
        return success(dmHarborService.selectDmHarborByPKID(harborid));
    }
 
    /**
     * 码头调度分配接口
     *
     */
    @Operation(summary = "码头调度分配")
    @PostMapping("/allocation")
    @ResponseBody
    public AjaxResult allocation(@RequestBody AllocBerthReqDTO reqDTO) {
        Long deptId = getDeptId();
        if(null != reqDTO.getDeptId()){
            deptId =reqDTO.getDeptId();
        }
 
        if(null == reqDTO.getTaskId()){
            return error("任务编码不能为空");
        }
 
        if(StringUtils.isBlank(reqDTO.getBerthids())){
            return error("泊位编号不能为空");
        }
        DsTaskList2 dsTaskList2Entity = new DsTaskList2();
        dsTaskList2Entity.setTaskId(reqDTO.getTaskId());
        dsTaskList2Entity.setDeptId(deptId);
        List<DsTaskList2> taskLists = iDsTaskListService.selectDsTaskListList(dsTaskList2Entity);
        if(taskLists.size() == 0){
            return error("所选舰艇为空,请重新检查参数");
        }
 
        return success(allocationBerth(taskLists, reqDTO.getRule(), reqDTO.getBerthids()));
    }
 
    /**
     * 新增保存任务列表信息
     */
    @Operation(summary = "泊位调配信息更新接口")
    @Log(title = "泊位调配信息更新接口", businessType = BusinessType.UPDATE)
    @PostMapping("/tasklist/update")
    @ResponseBody
    public AjaxResult addTaskListSave(@RequestBody List<DsTaskList2> taskList) {
        // 缺少数据非空以及合法性校验
 
        List<Long> pkidList = taskList.stream()
                                      .map(DsTaskList2::getPKID)
                                      .collect(Collectors.toList());
 
        List<DsTaskList2> existingTaskLists = iDsTaskListService.selectDsTaskListByPkids(pkidList);
 
        for (DsTaskList2 existingTask : existingTaskLists) {
            for (DsTaskList2 newTask : taskList) {
                if (existingTask.getPKID().equals(newTask.getPKID())) {
                    existingTask.setBerthId(newTask.getBerthId());
                    existingTask.setBerthName(newTask.getBerthName());
                    existingTask.setUpdateBy(getUsername());
                    iDsTaskListService.updateDsTaskList(existingTask);
                }
            }
        }
        return success("更新成功");
    }
 
    /**
     * 码头调度分配接口
     *
     */
    @Operation(summary = "泊位补给计划分配")
    @PostMapping("/berth/alloc")
    @ResponseBody
    public AjaxResult berthAllocation(@RequestBody AllocBerthTimeReqDTO reqDTO) {
        //获取当前用户部门编号
        Long deptId = getDeptId();
        if(null != reqDTO.getDeptId()){
            deptId = reqDTO.getDeptId();
        }
        if(null == reqDTO.getTaskId()){
            return error("任务编号不能为空");
        }
 
        DsTaskList2 dsTaskList2Entity = new DsTaskList2();
        dsTaskList2Entity.setTaskId(reqDTO.getTaskId());
        dsTaskList2Entity.setDeptId(deptId);
        List<DsTaskList2> taskLists = iDsTaskListService.selectDsTaskListList(dsTaskList2Entity);
        if(taskLists.size() == 0){
            return error("当前无任务,请重新检查参数");
        }
        // 重新组织数据结构,然后发送
        return success(allocationBerthTime(taskLists, reqDTO.getRule()));
    }
 
 
    /**
     * 舰艇分组
     * @param list
     * @param rule
     * @param berthids
     * @return
     */
    private List<DsTaskList2> allocationBerth(List<DsTaskList2> list, String rule, String berthids){
        List<DsTaskList2> resultTask =  new ArrayList<>();
        String[] berthArr = berthids.split(",");
 
        if(null != list && list.size() > 0){
            switch (rule){
                case "JTXH":        //按舰艇型号
                case "DYYX":        //按弹药优先
                case "YXSX":        //按优先顺序
                case "RGFZ":        //按人工分组
                default:
                    if(null != berthArr && berthArr.length > 0){
 
                        Map<Long, List<DmBerth2>> harborBerthMap = new HashMap<>();
 
                        List<Long> berthIdList = Arrays.stream(berthArr)
                                                    .map(Long::valueOf)
                                                    .collect(Collectors.toList());
                        List<DmBerth2> berthList = dmBerthService.selectDmBerthByHarborIds(berthIdList);
 
                        for (DmBerth2 dmBerth2 : berthList) {
                            if (dmBerth2 != null) {
                                harborBerthMap.computeIfAbsent(dmBerth2.getHarborId(), k -> new ArrayList<>()).add(dmBerth2);
                            }
                        }
 
                        for (DsTaskList2 task : list) {
                            Long harborId = task.getHarborId();
                            List<DmBerth2> availableBerths = harborBerthMap.get(harborId);
                            if (availableBerths != null && !availableBerths.isEmpty()) {
                                DmBerth2 assignedBerth = availableBerths.remove(0);
                                task.setBerthId(assignedBerth.getPKID());
                                task.setBerthName(assignedBerth.getNAME());
                                resultTask.add(task);
                            } else {
                                // 如果没有可用的泊位则继续按照原来的逻辑重复分配
                                for (Map.Entry<Long, List<DmBerth2>> entry : harborBerthMap.entrySet()) {
                                    if (!entry.getValue().isEmpty()) {
                                        DmBerth2 assignedBerth = entry.getValue().remove(0);
                                        task.setBerthId(assignedBerth.getPKID());
                                        task.setBerthName(assignedBerth.getNAME());
                                        resultTask.add(task);
                                        break;
                                    }
                                }
                            }
                        }
                    }
            }
        }
        return resultTask;
    }
 
    /**
     * 舰艇时间分配
     * @param list
     * @param rule
     * @return
     */
    private List<DsTaskDetail> allocationBerthTime(List<DsTaskList2> list, String rule){
        List<DsTaskDetail> result = new ArrayList<>();
 
        // 获取时间计算配置信息
        List<DmDdConfig> configList = iDmDdConfigService.selectDmDdConfigList(new DmDdConfig());
 
        // 遍历所有需要计算的船信息
        for (DsTaskList2 task : list) {
            Long berthId = task.getBerthId();
            List<DsTaskDetail> taskDetails = new ArrayList<>();
 
            // 获取当前泊位的所有船只
            List<DsTaskList2> berthTasks = list.stream()
                    .filter(t -> t.getBerthId().equals(berthId))
                    .sorted(Comparator.comparing(DsTaskList2::getLEVEL))
                    .collect(Collectors.toList());
 
            // 遍历泊位的所有船只,计算每艘船的工作时间
            for (DsTaskList2 berthTask : berthTasks) {
                DsTaskDetail taskDetail = new DsTaskDetail();
                taskDetail.setTaskId(berthTask.getTaskId());
                taskDetail.setBerthId(berthTask.getBerthId());
                taskDetail.setShipNo(berthTask.getShipNo());
                taskDetail.setBerthName(berthTask.getBerthName());
                taskDetail.setHarborId(berthTask.getHarborId());
                taskDetail.setHarborName(berthTask.getHarborName());
                taskDetail.setParkingType(berthTask.getParkingType());
                taskDetail.setShipType(berthTask.getShipType());
 
                // 根据configList计算每一个类型物资工作需要的时间
                double totalOil = 0.0;
                double totalWater = 0.0;
                double totalMater = 0.0;
                double totalAmmo = 0.0;
 
                // 油
                if (berthTask.getOilA() != null && berthTask.getOilA() > 0) {
                    totalOil += berthTask.getOilA();
                }
                if (berthTask.getOilB() != null && berthTask.getOilB() > 0) {
                    totalOil += berthTask.getOilB();
                }
                if (berthTask.getOilG() != null && berthTask.getOilG() > 0) {
                    totalOil += berthTask.getOilG();
                }
                // 水
                if (berthTask.getWATER() != null && berthTask.getWATER() > 0) {
                    totalWater += berthTask.getWATER();
                }
                if (berthTask.getWaterP() != null && berthTask.getWaterP() > 0) {
                    totalWater += berthTask.getWaterP();
                }
                // 物资
                if (berthTask.getFOOD() != null && berthTask.getFOOD() > 0) {
                    totalMater += berthTask.getFOOD();
                }
                if (berthTask.getFoodO() != null && berthTask.getFoodO() > 0) {
                    totalMater += berthTask.getFoodO();
                }
                if (berthTask.getFoodW() != null && berthTask.getFoodW() > 0) {
                    totalMater += berthTask.getFoodW();
                }
 
                // 炮弹
                if (berthTask.getAmmoD() != null && berthTask.getAmmoD() > 0) {
                    totalAmmo += berthTask.getAmmoD();
                }
                if (berthTask.getAmmoP() != null && berthTask.getAmmoP() > 0) {
                    totalAmmo += berthTask.getAmmoP();
                }
                if (berthTask.getAmmoS() != null && berthTask.getAmmoS() > 0) {
                    totalAmmo += berthTask.getAmmoS();
                }
 
//                taskDetail.setWaterTime(getTimeByType(configList, totalWater, WATER_FLAG));
//                taskDetail.setOilTime(getTimeByType(configList, totalOil, OIL_FLAG));
//                taskDetail.setMatTime(getTimeByType(configList, totalMater, MATER_FLAG));
                // 弹药时间需要根据弹药种类进行分别计算
                Double totalAmmoTime = getTimeByType(configList, null == berthTask.getAmmoO() ? 0.0 : (double)(berthTask.getAmmoO()), AMMO_O_FLAG);
                totalAmmoTime += getTimeByType(configList, totalAmmo, AMMO_FLAG);
 
//                taskDetail.setAmmoTime(totalAmmoTime);
 
                double totalTime = 0.0;
                if ("TS".equals(rule)) {
                    totalTime = Math.max(taskDetail.getWaterTime(), Math.max(taskDetail.getOilTime(), Math.max(taskDetail.getMatTime(), taskDetail.getAmmoTime())));
                } else if ("XYHD".equals(rule)) {
                    totalTime = Math.max(taskDetail.getWaterTime(), Math.max(taskDetail.getMatTime(), taskDetail.getAmmoTime())) + taskDetail.getOilTime();
                }
//                taskDetail.setTotalTime(totalTime);
 
                // 将计算结果添加到结果列表中
                taskDetails.add(taskDetail);
            }
 
            // 将当前泊位的所有船只的计算结果添加到最终结果中
            result.addAll(taskDetails);
        }
        return result;
    }
 
    /**
     * 根据类型获取消耗时间
     * @param list
     * @param val
     * @param type
     * @return
     */
    private Double getTimeByType(List<DmDdConfig> list, Double val, String type){
        AtomicReference<Double> totalTime = new AtomicReference<>(0.0);
        // 参数为空 则返回0
        if(null != val && StringUtils.isNotBlank(type)){
            list.stream().forEach(item -> {
                if(item.getTYPE().equals(type) && null != item.getTIME()){
                    totalTime.set(item.getTIME() * val);
                }
            });
        }
        return totalTime.get();
    }
 
    // 根据ID获取泊位路径信息详情
    private String getBerthPathById(List<DmBerth2> list, Long id){
        for(DmBerth2 berth2 : list){
            if(berth2.getPKID() == id){
                return berth2.getPath();
            }
        }
        return "";
    }
 
    private void updateDetailPath(Long taskId, Long deptId, List<DmBerth2> berth2List){
        // 获取任务详情列表
        List<DsTaskDetail> taskDetails = iDsTaskDetailService.selectDsTaskDetailByTaskId(taskId, null);
        
        // 创建泊位ID到路径的映射
        Map<Long, DmBerth2> berth2Map = berth2List.stream().collect(Collectors.toMap(DmBerth2::getPKID, berth -> berth));
 
 
        // 批量更新任务详情
        List<DsTaskDetail> updatedDetails = taskDetails.stream()
            .filter(detail -> detail.getBerthId() != null)
            .peek(detail -> detail.setPath(berth2Map.get(detail.getBerthId()).getPath()))
            .collect(Collectors.toList());
            
        // 批量保存更新
        if (!updatedDetails.isEmpty()) {
            iDsTaskDetailService.batchUpdateDsTaskDetail(updatedDetails);
        }
    }
}