ManifestMasterServiceImp.java
3.5 KB
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
package com.tianbo.analysis.service.imp;
import com.tianbo.analysis.dao.ORIGINMANIFESTMASTERMapper;
import com.tianbo.analysis.model.FFMInfo;
import com.tianbo.analysis.model.ORIGINMANIFESTMASTER;
import com.tianbo.analysis.service.FFMInfoService;
import com.tianbo.analysis.service.ManifestMasterService;
import com.tianbo.analysis.service.ManifestSecondService;
import com.tianbo.util.Date.DateUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
@Slf4j
@Service
public class ManifestMasterServiceImp implements ManifestMasterService{
@Autowired
ORIGINMANIFESTMASTERMapper originmanifestmasterMapper;
@Autowired
FFMInfoService ffmInfoService;
@Override
public int insertManifestWithMaster(FFMInfo item){
ORIGINMANIFESTMASTER master = new ORIGINMANIFESTMASTER();
String flightDate = DateUtil.dateToString(item.getFlightdate());
String flightNo = item.getFlightno();
String weibillMaster = item.getWaybillnomaster();
String weight = item.getManifesttotalweight();
String piece = item.getManifesttotalpiece();
String destnation = item.getDestinationstation();
master.setWaybillnomaster(item.getWaybillnomaster());
master.setFlightDate(item.getFlightdate());
master.setFlightno(item.getFlightno());
List<ORIGINMANIFESTMASTER> _masterinfo = originmanifestmasterMapper.queryMasterInfo(master);
//业务库没此运单的数据,则写入业务库数据,否则更新临时表此运单处理状态
if (_masterinfo!=null && _masterinfo.size()==0){
master.setAutoid(item.getAutoid());
master.setOriginatingstation(item.getOriginatingstation());
master.setDestinationstation(item.getDestinationstation());
master.setSegment(item.getOriginatingstation() + "-" + item.getDestinationstation());
//填写分批标识
master.setIsbatch(item.getIsbatch());
//运单起始地
master.setOriginatingstationBill(item.getOriginatingstationBill());
//运单目的地
master.setDestinationstationBill(item.getDestinationstationBill());
//舱单件数
master.setManifesttotalpiece(item.getManifesttotalpiece());
//舱单重量
master.setManifesttotalweight(item.getManifesttotalweight());
master.setStatus("01");
master.setCustomscode(item.getCustomscode());
master.setReportorder("");
master.setIslast("");
master.setCreatedate(new Date());
log.warn(new StringBuilder("开始插入舱单数据到业务库:\n")
.append("航班号:").append(flightNo).append("/").append(flightDate)
.append("\n运单号:").append(weibillMaster)
.append("\n件/重:").append(piece).append("/").append(weight)
.append("\n目的地:").append(destnation)
.toString());
return originmanifestmasterMapper.insertSelective(master);
//写入完毕
}else {
//重复数据不操作,直接更新掉临时表数据状态
ffmInfoService.setDealstatusSuccess(item);
log.info("运单号:"+item.getWaybillnomaster()+"业务库数据已存在与业务库不更新,更新此运单舱单临时表业务数据为已处理");
}
return 0;
}
}