SendLogServiceImp.java
2.3 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
package com.tianbo.analysis.service.imp;
import com.tianbo.analysis.dao.MANIFEST_AIR_CHANGEMapper;
import com.tianbo.analysis.dao.SENDLOGMapper;
import com.tianbo.analysis.model.CustomReception;
import com.tianbo.analysis.model.MANIFEST_AIR_CHANGE;
import com.tianbo.analysis.model.SENDLOG;
import com.tianbo.analysis.service.SendLogService;
import com.tianbo.analysis.tools.AWBTools;
import com.tianbo.util.Date.DateUtil;
import com.tianbo.util.Helper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@Service
@Slf4j
public class SendLogServiceImp implements SendLogService{
@Resource
private SENDLOGMapper sendlogMapper;
@Resource
MANIFEST_AIR_CHANGEMapper manifest_air_changeMapper;
@Override
public int insertSendlog(String type,String reception,String autoId){
SENDLOG sendlog = new SENDLOG();
sendlog.setOpauthor("System");
sendlog.setAutoid(Helper.getUUID());
sendlog.setCreatedate(new Date());
sendlog.setMessageautoid(autoId);
sendlog.setMessagetype(type);
sendlog.setReceiption(reception);
sendlog.setSendpeice(new Long(0));
sendlog.setSendweight(new BigDecimal(0));
int i = sendlogMapper.insertSelective(sendlog);
if (i>0){
log.info("插入回执日志成功,插入数据量为:"+i);
}
return i;
}
@Override
public int updateMT8204(CustomReception customReception) {
MANIFEST_AIR_CHANGE manifest_air_change = new MANIFEST_AIR_CHANGE();
manifest_air_change.setWaybillnomaster(AWBTools.awbFormat(customReception.getWayBillMaster()));
manifest_air_change.setFlightno(customReception.getFlightNo());
if (!StringUtils.isEmpty(customReception.getFlightDate())) {
manifest_air_change.setFlightDate(DateUtil.formatByyyyyMMdd(customReception.getFlightDate()));
}
List<MANIFEST_AIR_CHANGE> list = manifest_air_changeMapper.selectList(manifest_air_change);
if (!list.isEmpty()){
MANIFEST_AIR_CHANGE m = list.get(0);
return insertSendlog("MT8204",customReception.getResponseText(),m.getAutoid());
}
return 0;
}
}