sgj
2026-03-27 1eddf64a7104dcd06065e8ac309eebc42c24fb05
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
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
package com.fzzy.igds.service;
 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.fzzy.igds.constant.Constant;
import com.fzzy.igds.constant.InoutConstant;
import com.fzzy.igds.data.*;
import com.fzzy.igds.domain.*;
import com.fzzy.igds.mapper.InoutNoticeInMapper;
import com.fzzy.igds.mapper.InoutNoticeOutMapper;
import com.fzzy.igds.utils.ContextUtil;
import com.fzzy.work.data.WorkBizType;
import com.fzzy.work.data.WorkStatus;
import com.fzzy.work.domain.WorkOrderConf;
import com.fzzy.work.service.BizWorkService;
import com.ruoyi.common.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.transaction.annotation.Transactional;
 
import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
/**
 * @Description 出入库通知单service层,包含入库通知单和出库通知单
 * @Author CZT
 * @Date 2025/11/29 16:33
 */
@Slf4j
@Service
public class InoutNoticeService {
 
    @Resource
    private InoutNoticeInMapper noticeInMapper;
    @Resource
    private InoutNoticeOutMapper noticeOutMapper;
    @Resource
    private DepotService depotService;
    @Resource
    private CoreDeptService coreDeptService;
    @Resource
    private PledgeContractService pledgeContractService;
 
    @Resource
    private BizWorkService workService;
 
    /*----------------------入库通知单信息-------------------------*/
 
    /**
     * 分页查询数据
     * @param page
     * @param param
     */
    public void pageQueryIn(Page<InoutNoticeIn> page, NoticeParam param) {
        QueryWrapper<InoutNoticeIn> queryWrapper = new QueryWrapper<>();
 
        if (null == param) {
            param = new NoticeParam();
        }
        param.setCompanyId(ContextUtil.getCompanyId());
 
        queryWrapper.eq("company_id", param.getCompanyId());
        if (StringUtils.isNotBlank(param.getDeptId())) {
            queryWrapper.eq("dept_id", param.getDeptId());
        }else {
            queryWrapper.likeRight("dept_id", ContextUtil.subDeptId(null));
        }
        if (StringUtils.isNotBlank(param.getCustomerName())) {
            queryWrapper.like("customer_name", param.getCustomerName());
        }
        if (StringUtils.isNotBlank(param.getFoodVariety())) {
            queryWrapper.like("food_variety", param.getFoodVariety());
        }
        if (StringUtils.isNotBlank(param.getCompleteStatus())) {
            queryWrapper.like("complete_status", param.getCompleteStatus());
        }
 
        queryWrapper.orderByDesc("id");
        noticeInMapper.selectPage(page, queryWrapper);
    }
 
    /**
     * 根据条件查询
     * @return
     */
    public List<InoutNoticeIn> getNoticeIn(NoticeParam param) {
 
        QueryWrapper<InoutNoticeIn> queryWrapper = new QueryWrapper<>();
        if (StringUtils.isNotBlank(param.getCompanyId())) {
            queryWrapper.eq("company_id", param.getCompanyId());
        }
        if (StringUtils.isNotBlank(param.getDeptId())) {
            queryWrapper.eq("dept_id", param.getDeptId());
        }
        if (StringUtils.isNotBlank(param.getAuditStatus())) {
            queryWrapper.eq("audit_status", param.getAuditStatus());
        }
        if (StringUtils.isNotBlank(param.getCompleteStatus())) {
            queryWrapper.eq("complete_status", param.getCompleteStatus());
        }
        if (StringUtils.isNotBlank(param.getKey())) {
            queryWrapper.like("name", param.getKey());
        }
        queryWrapper.orderByDesc("create_time");
 
        return noticeInMapper.selectList(queryWrapper);
    }
 
    /**
     * 根据条件查询
     * @param id
     * @return
     */
    public InoutNoticeIn getNoticeInOne(String id) {
 
        QueryWrapper<InoutNoticeIn> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("id", id);
        return noticeInMapper.selectOne(queryWrapper);
    }
 
    /**
     *  查询数据
     * @param companyId
     * @return
     */
    public List<InoutNoticeIn> getUnComNoticeIn(String companyId) {
        if (StringUtils.isEmpty(companyId)) {
            companyId = ContextUtil.getCompanyId();
        }
        NoticeParam param = new NoticeParam();
        param.setCompanyId(companyId);
        param.setCompleteStatus(Constant.COMPLETE_STATUS_NONE);
        return this.getNoticeIn(param);
    }
 
    /**
     *  - 保存更新数据
     *
     * @param data
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    public BaseResp saveOrUpdateIn(InoutNoticeIn data) {
 
        //如果是库区自建通知单
        if (InoutConstant.NOTICE_IN_TYPE_10.equals(data.getType())) {
            //获取质押合同数据
            PledgeContract pledge = this.getPledgeByDepotId(data);
            if (null != pledge && pledge.getStatus().equals(Constant.YN_N)) {
                return BaseResp.error("当前仓库有未解押的质押合同,质押合同=" + pledge.getName());
            }
        }
 
        //如果质押通知单
        if (InoutConstant.NOTICE_IN_TYPE_20.equals(data.getType())) {
            //1.验证银行是否填写,未填写,则不允许保存
            if (StringUtils.isEmpty(data.getBankId())) {
                return BaseResp.error("质押银行不能为空!");
            }
            //2.验证银行和仓库的对应关系是否正确,不正确则不允许保存
            PledgeContract pledge = this.getPledgeByDepotIdAndBankId(data);
            if (null == pledge) {
                return BaseResp.error("未获取到当前库区、仓库和银行之间的质押信息!");
            }
        }
 
        //修改和提交是两个逻辑判断
        if (null == data.getUpdateBy()) {
            return this.saveInAddStartWork(data);
        } else {
            data.setUpdateBy(ContextUtil.getLoginUserName());
            data.setUpdateTime(new Date());
            noticeInMapper.updateById(data);
            return BaseResp.success();
        }
    }
 
    private BaseResp saveInAddStartWork(InoutNoticeIn data) {
        //数据保存
        data.setUpdateBy(ContextUtil.getLoginUserName());
        data.setUpdateTime(new Date());
        data.setCreateBy(ContextUtil.getLoginUserName());
        data.setCreateTime(new Date());
        data.setAuditStatus(WorkStatus.STATUS_10.getCode());
        data.setCompleteStatus(Constant.COMPLETE_STATUS_NONE);
 
        //执行流程
        WorkOrderConf conf = workService.getConfByDeptId(data.getDeptId(), WorkBizType.TYPE_10);
        //流程不启用
        if (null == conf || Constant.YN_N.equals(conf.getValTag())) {
            data.setAuditStatus(WorkStatus.STATUS_50.getCode());
        } else {
            BaseResp resp = workService.startByNoticeIn(data, conf);
            log.info("---------启动工单流程------{}", resp);
        }
 
        noticeInMapper.insert(data);
 
        return BaseResp.success();
    }
 
 
    /**
     * 判断当前仓库是否在质押合同中未解押
     * @param data 当前数据
     * @return true-在质押合同中未解押,false-在质押合同中已解押
     */
    private PledgeContract getPledgeByDepotId(InoutNoticeIn data) {
        IgdsBaseParam param = new IgdsBaseParam();
        param.setCompanyId(data.getCompanyId());
        param.setDeptId(data.getDeptId());
        param.setDepotId(data.getDepotId());
        return pledgeContractService.getByDepotId(param);
    }
 
    private PledgeContract getPledgeByDepotIdAndBankId(InoutNoticeIn data) {
        IgdsBaseParam param = new IgdsBaseParam();
        param.setCompanyId(data.getCompanyId());
        param.setDeptId(data.getDeptId());
        param.setDepotId(data.getDepotId());
        param.setBankId(data.getBankId());
        return pledgeContractService.getByDepotId(param);
    }
 
    /**
     * 更新审核状态
     * @param id
     * @param status
     */
    public void updateNoticeInStatus(String id, String status) {
        UpdateWrapper<InoutNoticeIn> updateWrapper = new UpdateWrapper<>();
        updateWrapper.eq("id", id).set("audit_status", status);
 
        noticeInMapper.update(null, updateWrapper);
    }
 
    /**
     *  - 删除数据
     *
     * @param data
     * @return
     */
    public String delDataIn(InoutNoticeIn data) {
        noticeInMapper.deleteById(data);
        return null;
    }
 
    /*----------------------出库通知单信息-------------------------*/
 
    /**
     * 分页查询数据
     * @param page
     * @param param
     */
    public void pageQueryOut(Page<InoutNoticeOut> page, NoticeParam param) {
        QueryWrapper<InoutNoticeOut> queryWrapper = new QueryWrapper<>();
 
        if (null == param) {
            param = new NoticeParam();
        }
        param.setCompanyId(ContextUtil.getCompanyId());
 
        queryWrapper.eq("company_id", param.getCompanyId());
        if (StringUtils.isNotBlank(param.getDeptId())) {
            queryWrapper.eq("dept_id", param.getDeptId());
        }else {
            queryWrapper.likeRight("dept_id", ContextUtil.subDeptId(null));
        }
        if (StringUtils.isNotBlank(param.getCustomerName())) {
            queryWrapper.like("customer_name", param.getCustomerName());
        }
        if (StringUtils.isNotBlank(param.getFoodVariety())) {
            queryWrapper.like("food_variety", param.getFoodVariety());
        }
        if (StringUtils.isNotBlank(param.getCompleteStatus())) {
            queryWrapper.like("complete_status", param.getCompleteStatus());
        }
        queryWrapper.orderByDesc("id");
        noticeOutMapper.selectPage(page, queryWrapper);
    }
 
    /**
     * 根据条件查询
     * @return
     */
    public List<InoutNoticeOut> getNoticeOut(NoticeParam param) {
        QueryWrapper<InoutNoticeOut> queryWrapper = new QueryWrapper<>();
        if (StringUtils.isNotBlank(param.getCompanyId())) {
            queryWrapper.eq("company_id", param.getCompanyId());
        }
        if (StringUtils.isNotBlank(param.getDeptId())) {
            queryWrapper.eq("dept_id", param.getDeptId());
        }
        if (StringUtils.isNotBlank(param.getAuditStatus())) {
            queryWrapper.eq("audit_status", param.getAuditStatus());
        }
        if (StringUtils.isNotBlank(param.getCompleteStatus())) {
            queryWrapper.eq("complete_status", param.getCompleteStatus());
        }
        if (StringUtils.isNotBlank(param.getKey())) {
            queryWrapper.like("name", param.getKey());
        }
        queryWrapper.orderByDesc("create_time");
 
        return noticeOutMapper.selectList(queryWrapper);
    }
 
    /**
     * 根据条件查询
     * @param id
     * @return
     */
    public InoutNoticeOut getNoticeOutOne(String id) {
        QueryWrapper<InoutNoticeOut> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("id", id);
        return noticeOutMapper.selectOne(queryWrapper);
    }
 
    /**
     * Mybatis-plus 获取信息
     * @param companyId
     * @return
     */
    public List<InoutNoticeOut> getUnComNoticeOut(String companyId) {
        if (StringUtils.isEmpty(companyId)) {
            companyId = ContextUtil.getCompanyId();
        }
        NoticeParam param = new NoticeParam();
        param.setCompanyId(companyId);
        param.setCompleteStatus(Constant.COMPLETE_STATUS_NONE);
        return this.getNoticeOut(param);
    }
 
    /**
     *  - 保存更新数据
     *
     * @param data
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    public BaseResp saveOrUpdateOut(InoutNoticeOut data) {
        //如果出库通知单类型为库区通知单,验证仓库是否是未解押得仓库,是则不允许保存
        if (InoutConstant.NOTICE_IN_TYPE_10.equals(data.getType())) {
            //在质押合同找到未解押,且质押仓库包含当前仓库的数据
            //获取质押合同数据
            PledgeContract pledge = this.getPledgeByDepotIdOut(data);
            if (null != pledge && pledge.getStatus().equals(Constant.YN_N)) {
                return BaseResp.error("当前仓库有未解押的质押合同,质押合同=" + pledge.getName());
            }
        }
        //如果出库通知单类型为监管通知单
        //如果质押通知单
        if (InoutConstant.NOTICE_IN_TYPE_20.equals(data.getType())) {
            //1.验证银行是否填写,未填写,则不允许保存
            if (StringUtils.isEmpty(data.getBankId())) {
                return BaseResp.error("质押银行不能为空!");
            }
            //2.验证银行和仓库的对应关系是否正确,不正确则不允许保存
            PledgeContract pledge = this.getPledgeByDepotIdAndBankIdOut(data);
            if (null == pledge) {
                return BaseResp.error("未获取到当前库区、仓库和银行之间的质押信息!");
            }
        }
 
        if (null == data.getUpdateBy()) {
            return this.saveOutAddStartWork(data);
        } else {
            data.setUpdateBy(ContextUtil.getLoginUserName());
            data.setUpdateTime(new Date());
            noticeOutMapper.updateById(data);
            return BaseResp.success();
        }
    }
 
    /**
     * 更新审核状态
     * @param id
     * @param status
     */
    public void updateNoticeOutStatus(String id, String status) {
        UpdateWrapper<InoutNoticeOut> updateWrapper = new UpdateWrapper<>();
        updateWrapper.eq("id", id).set("audit_status", status);
 
        noticeOutMapper.update(null, updateWrapper);
    }
 
    /**
     * 删除数据
     *
     * @param data
     * @return
     */
    public String delDataOut(InoutNoticeOut data) {
        noticeOutMapper.deleteById(data);
        return null;
    }
 
    private BaseResp saveOutAddStartWork(InoutNoticeOut data) {
        //数据保存
        data.setUpdateBy(ContextUtil.getLoginUserName());
        data.setUpdateTime(new Date());
        data.setCreateBy(ContextUtil.getLoginUserName());
        data.setCreateTime(new Date());
        data.setAuditStatus(WorkStatus.STATUS_10.getCode());
        data.setCompleteStatus(Constant.COMPLETE_STATUS_NONE);
 
        //执行流程
        WorkOrderConf conf = workService.getConfByDeptId(data.getDeptId(), WorkBizType.TYPE_20);
        //流程不启用
        if (null == conf || Constant.YN_N.equals(conf.getValTag())) {
            data.setAuditStatus(WorkStatus.STATUS_50.getCode());
        } else {
            BaseResp resp = workService.startByNoticeOut(data, conf);
            log.info("---------启动工单流程------{}", resp);
        }
 
        noticeOutMapper.insert(data);
 
        return BaseResp.success();
    }
 
    /**
     * 判断当前仓库是否在质押合同中未解押
     * @param data 当前数据
     * @return true-在质押合同中未解押,false-在质押合同中已解押
     */
    private PledgeContract getPledgeByDepotIdOut(InoutNoticeOut data) {
        IgdsBaseParam param = new IgdsBaseParam();
        param.setCompanyId(data.getCompanyId());
        param.setDeptId(data.getDeptId());
        param.setDepotId(data.getDepotId());
        return pledgeContractService.getByDepotId(param);
    }
 
    private PledgeContract getPledgeByDepotIdAndBankIdOut(InoutNoticeOut data) {
        IgdsBaseParam param = new IgdsBaseParam();
        param.setCompanyId(data.getCompanyId());
        param.setDeptId(data.getDeptId());
        param.setDepotId(data.getDepotId());
        param.setBankId(data.getBankId());
        return pledgeContractService.getByDepotId(param);
    }
 
    /**
     * 根据ID获取通知单信息
     * @param id
     * @param type
     * @return
     */
    public NoticeDto queryNoticeById(String id, String type) {
        if (StringUtils.isEmpty(id) || StringUtils.isEmpty(type)) {
            return null;
        }
        NoticeDto noticeDto = new NoticeDto();
        if (Constant.TYPE_IN.equals(type)) {
            InoutNoticeIn noticeIn = this.getNoticeInOne(id);
            BeanUtils.copyProperties(noticeIn, noticeDto);
        } else {
            InoutNoticeOut noticeOut = this.getNoticeOutOne(id);
            BeanUtils.copyProperties(noticeOut, noticeDto);
        }
        return noticeDto;
    }
 
    /**
     * Mybatis-plus 更新信息
     * @param noticeInList
     * @return
     */
    public void updateSumNoticeIn(List<InoutNoticeIn> noticeInList) {
 
        if (null == noticeInList || noticeInList.isEmpty()) {
            return;
        }
 
        //遍历通知单
        NoticeParam param;
        for (InoutNoticeIn noticeIn : noticeInList) {
 
            param = new NoticeParam(noticeIn.getCompanyId(), noticeIn.getDeptId(),
                    noticeIn.getCustomerName(), noticeIn.getFoodVariety(), noticeIn.getId());
 
            log.info("开始更新出库通知单={}", param.toString());
 
            String msg = this.reSumNoticeInComplete(param);
            if (msg != null) {
                log.info("入库通知单完成量统计失败={},失败原因={}", param.toString(), msg);
            }
        }
    }
 
    /**
     * Mybatis-plus 获取信息
     * @param param
     * @return
     */
    public String reSumNoticeInComplete(NoticeParam param) {
        //TODO 待实现,后续根据需求进行实现
        if (StringUtils.isEmpty(param.getCustomerName())) {
            return "客户编码为空!";
        }
        if (StringUtils.isEmpty(param.getFoodVariety())) {
            return "粮食品种为空!";
        }
        if (StringUtils.isEmpty(param.getCompanyId())) {
            param.setCompanyId(ContextUtil.getCompanyId());
        }
        if (StringUtils.isEmpty(param.getDeptId())) {
            param.setDeptId(ContextUtil.subDeptId(null));
        }
        return null;
    }
 
    /**
     * Mybatis-plus 更新信息
     * @param noticeOutList
     * @return
     */
    public void updateSumNoticeOut(List<InoutNoticeOut> noticeOutList) {
 
        if (null == noticeOutList || noticeOutList.isEmpty()) {
            return;
        }
 
        //遍历通知单
        NoticeParam param;
        for (InoutNoticeOut noticeOut : noticeOutList) {
 
            param = new NoticeParam(noticeOut.getCompanyId(), noticeOut.getDeptId(), noticeOut.getDepotId(),
                    noticeOut.getCustomerName(), noticeOut.getFoodVariety(), noticeOut.getId());
 
            log.info("开始更新出库通知单={}", param.toString());
 
            String msg = this.reSumNoticeOutComplete(param);
            if (msg != null) {
                log.info("出库通知单完成量统计失败={},失败原因={}", param.toString(), msg);
            }
        }
    }
 
    /**
     * Mybatis-plus 更新信息
     * @param param
     * @return
     */
    public String reSumNoticeOutComplete(NoticeParam param) {
        //TODO 待实现,后续根据需求进行实现
        if (StringUtils.isEmpty(param.getCustomerName())) {
            return "客户编码为空!";
        }
        if (StringUtils.isEmpty(param.getFoodVariety())) {
            return "粮食品种为空!";
        }
        if (StringUtils.isEmpty(param.getDepotId())) {
            return "仓库编码为空!";
        }
        if (StringUtils.isEmpty(param.getCompanyId())) {
            param.setCompanyId(ContextUtil.getCompanyId());
        }
        if (StringUtils.isEmpty(param.getDeptId())) {
            param.setDeptId(ContextUtil.subDeptId(null));
        }
        return null;
    }
 
    /**
     *
     * @param param
     * @return
     */
    public ExportWordParam handleInData(ExportWordParam param) {
 
        InoutNoticeIn notice = this.getNoticeInOne(param.getBizId());
 
        //转换为模板需要的map数据源
        Map<String, Object> map = new HashMap();
 
        map.put("serId", notice.getId());
        map.put("name", notice.getName());
 
        String type = "";
        if ("10".equals(notice.getType())) {
            type = "库区通知单";
        }
        if ("20".equals(notice.getType())) {
            type = "监管通知单";
        }
        map.put("type", type);
 
        map.put("customerName", notice.getCustomerName());
 
        String unitName = "";
        Dept dept = coreDeptService.getDeptById(notice.getUnitName());
        if (dept != null) {
            unitName = dept.getKqmc();
        }
        map.put("unitName", unitName);
 
        Depot depot = depotService.getCacheDepot(notice.getCompanyId(), notice.getDepotId());
        String depotId = "";
        if (dept != null) {
            depotId = depot.getName();
        }
        map.put("depotId", depotId);
 
        map.put("year", notice.getYear());
        map.put("targetNumber", notice.getTargetNumber());
        map.put("completeNumber", notice.getCompleteNumber());
        map.put("completeStatus", notice.getCompleteStatus());
        map.put("contract", notice.getContract());
        map.put("remark", notice.getRemark());
        map.put("createUser", notice.getCreateBy());
        map.put("createTime", DateFormatUtils.format(notice.getCreateTime(), "yyyy-MM-dd HH:mm:ss"));
 
        param.setDataMap(map);
        return param;
    }
 
    /**
     *
     * @param param
     * @return
     */
    public ExportWordParam handleOutData(ExportWordParam param) {
 
        InoutNoticeOut notice = this.getNoticeOutOne(param.getBizId());
 
        //转换为模板需要的map数据源
        Map<String, Object> map = new HashMap();
 
        map.put("serId", notice.getId());
        map.put("name", notice.getName());
 
        String type = "";
        if ("10".equals(notice.getType())) {
            type = "库区通知单";
        }
        if ("20".equals(notice.getType())) {
            type = "监管通知单";
        }
        map.put("type", type);
 
        map.put("customerName", notice.getCustomerName());
 
        String unitName = "";
        Dept dept = coreDeptService.getDeptById(notice.getUnitName());
        if (dept != null) {
            unitName = dept.getKqmc();
        }
        map.put("unitName", unitName);
 
        Depot depot = depotService.getCacheDepot(notice.getCompanyId(), notice.getDepotId());
        String depotId = "";
        if (dept != null) {
            depotId = depot.getName();
        }
        map.put("depotId", depotId);
 
        map.put("year", notice.getYear());
        map.put("targetNumber", notice.getTargetNumber());
        map.put("completeNumber", notice.getCompleteNumber());
        map.put("completeStatus", notice.getCompleteStatus());
        map.put("contract", notice.getContract());
        map.put("remark", notice.getRemark());
        map.put("createUser", notice.getCreateBy());
        map.put("createTime", DateFormatUtils.format(notice.getCreateTime(), "yyyy-MM-dd HH:mm:ss"));
 
        param.setDataMap(map);
        return param;
    }
 
}