作者 朱兆平

运抵解析OK

... ... @@ -49,7 +49,7 @@ spring:
type: com.alibaba.druid.pool.DruidDataSource
#oracle
driver-class-name: oracle.jdbc.OracleDriver
url: jdbc:oracle:thin:@218.28.199.134:8004banner.txt:CGODB
url: jdbc:oracle:thin:@218.28.199.134:8004:CGODB
username: CGONMS
password: 1q2w3e4r
#spring datasource mysql,注意编码配置,缺少数据库编码配置容易引起中文入库乱码
... ... @@ -132,7 +132,7 @@ jwt:
#自定义配置
custom:
#进港放行回执读取目录
receptDirectory: /Users/mrz/Downloads/rdp_temp
receptDirectory: /Users/mrz/Downloads/rdp_temp/logs/回执报文样例
#回执解析成功后的备份目录
receptBakDir: ./success
#解析错误报文的备份目录
... ...
... ... @@ -25,7 +25,7 @@
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息-->
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>info</level>
<level>DEBUG</level>
</filter>
<encoder>
<Pattern>${CONSOLE_LOG_PATTERN}</Pattern>
... ...
package com.tianbo.analysis.bean;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
/**
* @ProjectName:
* @Package: com.backstage.config
* @ClassName: ApplicationContextProvider
* @Description: 获取bean对象的工具类
* @Author: wangzhilong
* @CreateDate: 2018/8/31 13:26
* @Version: 1.0
*/
/**
* Author:ZhuShangJin
* Date:2018/7/3
*/
@Component
public class SpringBeanUtitl implements ApplicationContextAware{
private static ApplicationContext applicationContext = null;
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws
BeansException {
// TODO Auto-generated method stub
SpringBeanUtitl.applicationContext = applicationContext;
}
/**
* 从静态变量applicationContext中得到Bean, 自动转型为所赋值对象的类型.
*/
@SuppressWarnings("unchecked")
public static <T> T getBean(String name) {
if(name == null || applicationContext == null){
return null;
}
return (T) applicationContext.getBean(name);
}
/**
* 从静态变量applicationContext中得到Bean, 自动转型为所赋值对象的类型.
*/
public static <T> T getBean(Class<T> clazz) {
return applicationContext.getBean(clazz);
}
}
... ...
package com.tianbo.analysis.controller;
import com.tianbo.analysis.handle.CustomXmlHandle;
import com.tianbo.util.Date.DateUtil;
import com.tianbo.util.IO.FileTool;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.io.File;
import java.util.Iterator;
import java.util.List;
@RestController
... ...
package com.tianbo.analysis.handle;
import com.fasterxml.jackson.databind.annotation.JsonAppend;
import com.sun.xml.internal.ws.util.xml.XmlUtil;
import com.tianbo.analysis.model.CustomReception;
import com.tianbo.analysis.service.*;
import com.tianbo.util.Date.DateUtil;
import com.tianbo.util.XML.XMLXPath;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileExistsException;
import org.apache.commons.io.FileUtils;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.xml.sax.SAXParseException;
import javax.annotation.PostConstruct;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.UnsupportedEncodingException;
import java.util.List;
/**
* @author mrz
* @e
* 海关新舱单回执解析xml文件
*/
@Data
@Component
public class CustomXmlHandle{
@Slf4j
public class CustomXmlHandleThread implements Runnable{
private static CustomXmlHandle customXmlHandle;
//备份目录
@Value("${custom.receptBakDir}")
private String bakupDir;
//解析出错转移目录
@Value("${custom.errBakDir}")
private String errBakDir;
private File xmlfile;
private static CustomXmlHandleThread customXmlHandle;
//海关新舱单回执报头
public final static String MessageID = "//Manifest/Head/MessageID";
public final static String FunctionCode = "//Manifest/Head/FunctionCode";
... ... @@ -40,10 +53,10 @@ public class CustomXmlHandle{
//海关新舱单回执报体
public final static String JourneyID = "//Manifest/Response/BorderTransportMeans/JourneyID";
public final static String waybillMaster = "//Manifest/Response/Consignment/TransportContractDocument/ID";
public final static String waybillSecond = "//Manifest/Response/Consignment/AssociatedTransportDocument/ID";
public final static String responseCode = "//Manifest/Response/Consignment/ResponseType/Code";
public final static String responseText = "//Manifest/Response/Consignment/ResponseType/Text";
public final static String WaybillMaster = "//Manifest/Response/Consignment/TransportContractDocument/ID";
public final static String WaybillSecond = "//Manifest/Response/Consignment/AssociatedTransportDocument/ID";
public final static String ResponseCode = "//Manifest/Response/Consignment/ResponseType/Code";
public final static String ResponseText = "//Manifest/Response/Consignment/ResponseType/Text";
@Autowired
private CoustomAnalysisService coustomAnalysisService;
... ... @@ -66,6 +79,7 @@ public class CustomXmlHandle{
@Autowired
private INPORTALLOCATEService inportallocateService;
//通过@PostConstruct实现初始化bean之前进行的操作,解决service调用空指针问题
@PostConstruct
public void init() {
... ... @@ -83,28 +97,52 @@ public class CustomXmlHandle{
customXmlHandle.allocatearrivalService = this.allocatearrivalService;
customXmlHandle.inportallocateService = this.inportallocateService;
customXmlHandle.bakupDir = this.bakupDir;
customXmlHandle.errBakDir = this.errBakDir;
// 初使化时将已静态化的testService实例化
}
@Override
public void run() {
try{
int i =handelXmlDocument();
String today = DateUtil.getTodayBy_yyyyMMdd();
String backdireByDay = customXmlHandle.bakupDir + "/" + today;
//操作成功,则转移剪切解析文件到备份目录,否则转移到error目录备份
if(i>0){
File bakupDirectory = new File(backdireByDay);
FileUtils.moveFileToDirectory(xmlfile,bakupDirectory,true);
}else {
errBak(xmlfile);
}
}catch (FileExistsException e){
log.error("错误的解析文件剪切失败,目标目录已存在同名文件",e);
e.printStackTrace();
}catch (Exception e){
e.printStackTrace();
}
}
/**
*
* @param file 回执目录的文件
*
* @return
* @throws DocumentException
* @throws UnsupportedEncodingException
* @throws SAXParseException
* @throws FileNotFoundException
*/
public int handelXmlDocument(File file) throws DocumentException,UnsupportedEncodingException,SAXParseException {
public int handelXmlDocument() throws DocumentException,UnsupportedEncodingException,SAXParseException,FileNotFoundException {
int i = 0;
SAXReader saxReader = new SAXReader();
Document document = saxReader.read(file);
Document document = saxReader.read(xmlfile);
Element contentRoot = document.getRootElement();
//要解析的回执类型
String type= "MT9999";
String flightNo = "";
String flightDate = "";
... ... @@ -114,7 +152,7 @@ public class CustomXmlHandle{
String journeyid = XMLXPath.getSingleValueByPath(document,JourneyID);
// XMLXPath.getSingleValueByPath(document, )
if(journeyid != null){
if(journeyid != null&& !journeyid.isEmpty()){
String[] flightList = journeyid.split("/");
if(flightList.length > 0){
... ... @@ -125,13 +163,31 @@ public class CustomXmlHandle{
}
String awbA = XMLXPath.getSingleValueByPath(document,waybillMaster);
String awbA = XMLXPath.getSingleValueByPath(document,WaybillMaster);
//全格式的分单 如 17212345678_ADBD
String awbH = XMLXPath.getSingleValueByPath(document,waybillSecond);
String resCode = XMLXPath.getSingleValueByPath(document,responseCode);
String resText = XMLXPath.getSingleValueByPath(document,responseText);
String awbH = XMLXPath.getSingleValueByPath(document,WaybillSecond);
String resCode = XMLXPath.getSingleValueByPath(document,ResponseCode);
String resText = XMLXPath.getSingleValueByPath(document,ResponseText);
String messageId = XMLXPath.getSingleValueByPath(document, MessageID);
CustomReception customReception = new CustomReception(msgType,flightNo,flightDate,awbA,awbH,resText, messageId);
String sendTime = XMLXPath.getSingleValueByPath(document,SendTime);
String sendId = XMLXPath.getSingleValueByPath(document,SenderID);
String reciveId = XMLXPath.getSingleValueByPath(document,ReceiverID);
String version = XMLXPath.getSingleValueByPath(document,Version);
String functionCode = XMLXPath.getSingleValueByPath(document,FunctionCode);
CustomReception customReception = new CustomReception( msgType,
flightNo,
flightDate,
awbA,
awbH,
resCode,
resText,
messageId,
sendTime,
sendId,
reciveId,
version,
functionCode);
switch (msgType){
case "MT9999":
i = customXmlHandle.coustomAnalysisService.insertRecept(customReception);
... ... @@ -168,4 +224,19 @@ public class CustomXmlHandle{
return i;
}
public void errBak(File file){
try {
String today = DateUtil.getTodayBy_yyyyMMdd();
String errDirByDay = customXmlHandle.errBakDir + "/" + today;
File berrDirectory = new File(errDirByDay);
FileUtils.moveFileToDirectory(file,berrDirectory,true);
log.error("解析或其他错误备份文件:"+File.pathSeparator);
}catch (FileExistsException e){
log.error("错误的解析文件剪切失败,目标目录已存在同名文件",e);
e.printStackTrace();
}catch (Exception e){
e.printStackTrace();
}
}
}
... ...
package com.tianbo.analysis.model;
import lombok.Data;
import java.util.Date;
@Data
public class ARRIVEDMASTER {
private String autoid;
... ... @@ -13,7 +16,7 @@ public class ARRIVEDMASTER {
private String flightno;
private Date flightdate;
private Date flightDate;
private String carrier;
... ... @@ -54,212 +57,4 @@ public class ARRIVEDMASTER {
private String receiptinformation;
private Date createdate;
public String getAutoid() {
return autoid;
}
public void setAutoid(String autoid) {
this.autoid = autoid == null ? null : autoid.trim();
}
public String getWaybillnomaster() {
return waybillnomaster;
}
public void setWaybillnomaster(String waybillnomaster) {
this.waybillnomaster = waybillnomaster == null ? null : waybillnomaster.trim();
}
public String getTcdName() {
return tcdName;
}
public void setTcdName(String tcdName) {
this.tcdName = tcdName == null ? null : tcdName.trim();
}
public String getTcdTypecode() {
return tcdTypecode;
}
public void setTcdTypecode(String tcdTypecode) {
this.tcdTypecode = tcdTypecode == null ? null : tcdTypecode.trim();
}
public String getFlightno() {
return flightno;
}
public void setFlightno(String flightno) {
this.flightno = flightno == null ? null : flightno.trim();
}
public Date getFlightdate() {
return flightdate;
}
public void setFlightdate(Date flightdate) {
this.flightdate = flightdate;
}
public String getCarrier() {
return carrier;
}
public void setCarrier(String carrier) {
this.carrier = carrier == null ? null : carrier.trim();
}
public String getOriginatingstation() {
return originatingstation;
}
public void setOriginatingstation(String originatingstation) {
this.originatingstation = originatingstation == null ? null : originatingstation.trim();
}
public String getoName() {
return oName;
}
public void setoName(String oName) {
this.oName = oName == null ? null : oName.trim();
}
public String getDestinationstation() {
return destinationstation;
}
public void setDestinationstation(String destinationstation) {
this.destinationstation = destinationstation == null ? null : destinationstation.trim();
}
public String getFdName() {
return fdName;
}
public void setFdName(String fdName) {
this.fdName = fdName == null ? null : fdName.trim();
}
public String getArrivedtotalpiece() {
return arrivedtotalpiece;
}
public void setArrivedtotalpiece(String arrivedtotalpiece) {
this.arrivedtotalpiece = arrivedtotalpiece == null ? null : arrivedtotalpiece.trim();
}
public String getTotalpiecequantity() {
return totalpiecequantity;
}
public void setTotalpiecequantity(String totalpiecequantity) {
this.totalpiecequantity = totalpiecequantity == null ? null : totalpiecequantity.trim();
}
public String getArrivedtotalweight() {
return arrivedtotalweight;
}
public void setArrivedtotalweight(String arrivedtotalweight) {
this.arrivedtotalweight = arrivedtotalweight == null ? null : arrivedtotalweight.trim();
}
public String getGrossweightmeasureuc() {
return grossweightmeasureuc;
}
public void setGrossweightmeasureuc(String grossweightmeasureuc) {
this.grossweightmeasureuc = grossweightmeasureuc == null ? null : grossweightmeasureuc.trim();
}
public String getTotalgrossweightmeasure() {
return totalgrossweightmeasure;
}
public void setTotalgrossweightmeasure(String totalgrossweightmeasure) {
this.totalgrossweightmeasure = totalgrossweightmeasure == null ? null : totalgrossweightmeasure.trim();
}
public String getTotalgrossweightmeasureuc() {
return totalgrossweightmeasureuc;
}
public void setTotalgrossweightmeasureuc(String totalgrossweightmeasureuc) {
this.totalgrossweightmeasureuc = totalgrossweightmeasureuc == null ? null : totalgrossweightmeasureuc.trim();
}
public String getChargeableweightmeasure() {
return chargeableweightmeasure;
}
public void setChargeableweightmeasure(String chargeableweightmeasure) {
this.chargeableweightmeasure = chargeableweightmeasure == null ? null : chargeableweightmeasure.trim();
}
public String getChargeableweightmeasureuc() {
return chargeableweightmeasureuc;
}
public void setChargeableweightmeasureuc(String chargeableweightmeasureuc) {
this.chargeableweightmeasureuc = chargeableweightmeasureuc == null ? null : chargeableweightmeasureuc.trim();
}
public Date getArriveddate() {
return arriveddate;
}
public void setArriveddate(Date arriveddate) {
this.arriveddate = arriveddate;
}
public String getTransportsplitdescription() {
return transportsplitdescription;
}
public void setTransportsplitdescription(String transportsplitdescription) {
this.transportsplitdescription = transportsplitdescription == null ? null : transportsplitdescription.trim();
}
public String getCustomscode() {
return customscode;
}
public void setCustomscode(String customscode) {
this.customscode = customscode == null ? null : customscode.trim();
}
public String getProductname() {
return productname;
}
public void setProductname(String productname) {
this.productname = productname == null ? null : productname.trim();
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status == null ? null : status.trim();
}
public String getReceiptinformation() {
return receiptinformation;
}
public void setReceiptinformation(String receiptinformation) {
this.receiptinformation = receiptinformation == null ? null : receiptinformation.trim();
}
public Date getCreatedate() {
return createdate;
}
public void setCreatedate(Date createdate) {
this.createdate = createdate;
}
}
\ No newline at end of file
... ...
... ... @@ -23,14 +23,26 @@ public class CustomReception {
String flightDate,
String wayBillMaster,
String wayBillSecond,
String responseCode,
String responseText,
String messageID){
String messageID,
String sendTime,
String senderID,
String receiverID,
String version,
String functionCode){
this.messageType = messageType;
this.flightNo = flightNo;
this.flightDate = flightDate;
this.wayBillMaster = wayBillMaster;
this.wayBillSecond = wayBillSecond;
this.responseCode = responseCode;
this.responseText = responseText;
this.messageID = messageID;
this.sendTime = sendTime;
this.senderID =senderID;
this.receiverID = receiverID;
this.version = version;
this.functionCode = functionCode;
}
}
... ...
... ... @@ -6,6 +6,7 @@ import com.tianbo.analysis.model.ARRIVEDMASTER;
import com.tianbo.analysis.model.ARRIVEDSECONDARY;
import com.tianbo.analysis.model.CustomReception;
import com.tianbo.analysis.service.ARRIVEDMASTERService;
import com.tianbo.analysis.tools.AWBTools;
import com.tianbo.util.Date.DateUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
... ... @@ -57,23 +58,24 @@ public class ARRIVEDMASTERServiceImp implements ARRIVEDMASTERService {
//设置主单回执、航班号、航班日期
ARRIVEDMASTER arrivedmaster = new ARRIVEDMASTER();
arrivedmaster.setReceiptinformation(reception);
arrivedmaster.setFlightno(customReception.getFlightNo());
arrivedmaster.setFlightdate(flightDate);
//拆分航班号和承运人
String[] flightInfo = AWBTools.splitFlight(customReception.getFlightNo());
arrivedmaster.setFlightno(flightInfo[1]);
arrivedmaster.setCarrier(flightInfo[0]);
arrivedmaster.setFlightDate(flightDate);
// 判断航班号 航班日期 是否为空
if (flightDate != null && customReception.getFlightNo() != null){
if (awbA!=null && awbA.length()>0){
StringBuffer stringBuffer = new StringBuffer(awbA);
stringBuffer.insert(3,"-");
awbA = stringBuffer.toString();
//处理主单格式,将海关回执的主单号58019316861,变为580-19316861
awbA = AWBTools.awbFormat(awbA);
//设置主分单的 主单号
arrivedsecondary.setWaybillnomaster(awbA);
arrivedmaster.setWaybillnomaster(awbA);
}
//有分单号 更新分单
if(awbA!=null && awbA.length()>0 && awbH!=null && awbH.length()> 0){
//有分单号 更新分单回执
if(awbA!=null && !awbA.isEmpty() && awbH!=null && !awbH.isEmpty()){
//取分单号
String[] awbhArr = awbH.split("_");
String awbh = awbhArr[1];
... ... @@ -90,14 +92,17 @@ public class ARRIVEDMASTERServiceImp implements ARRIVEDMASTERService {
int ii = coustomAnalysisServiceImp.insertSendlog("MT3201",reception,autoId);
int iii = shareServiceImp.updateMessages(customReception);
if (i>0 && ii>0 && iii > 0){
if (i>0 && ii>0 ){
return 1;
}
if ( iii > 0){
return 1;
}
}
return 0;
}
//处理主单格式,将海关回执的主单号58019316861,变为580-19316861
if (awbA!=null && awbA.length()>0){
//更新主单回执
int i = arrivedmasterMapper.updateRECEIPTION(arrivedmaster);
... ... @@ -112,14 +117,19 @@ public class ARRIVEDMASTERServiceImp implements ARRIVEDMASTERService {
int ii =coustomAnalysisServiceImp.insertSendlog("MT3201",reception,autoId);
int iii = shareServiceImp.updateMessages(customReception);
if (i>0 && ii>0 && iii > 0){
if (i>0 && ii>0){
return 1;
}
if ( iii > 0){
return 1;
}
}
return 0;
}
}else {
//从发送日志表查找发送MESSAGEID进行二次入库
return shareServiceImp.share("MT3201", customReception);
}
}
... ... @@ -127,4 +137,6 @@ public class ARRIVEDMASTERServiceImp implements ARRIVEDMASTERService {
//未进入主分单解析 返回0 失败
return 0;
}
}
... ...
package com.tianbo.analysis.service.imp;
import com.tianbo.analysis.bean.SpringBeanUtitl;
import com.tianbo.analysis.dao.ORIGINMANIFESTMASTERMapper;
import com.tianbo.analysis.dao.OriginmanifestsecondaryMapper;
import com.tianbo.analysis.dao.SENDLOGMapper;
... ... @@ -30,6 +31,12 @@ public class CoustomAnalysisServiceImp implements CoustomAnalysisService {
@Autowired
OriginmanifestsecondaryMapper originmanifestsecondaryMapper;
CoustomAnalysisServiceImp(){
//处理多线程时 springboot 无法注入bean的问题
if (this.sendlogMapper==null){
this.sendlogMapper = SpringBeanUtitl.getBean(SENDLOGMapper.class);
}
}
@Override
public int insertRecept(CustomReception customReception){
... ... @@ -134,6 +141,8 @@ public class CoustomAnalysisServiceImp implements CoustomAnalysisService {
sendlog.setReceiption(reception);
sendlog.setSendpeice(new Long(0));
sendlog.setSendweight(new BigDecimal(0));
int i = sendlogMapper.insertSelective(sendlog);
if (i>0){
log.info("插入日志成功,插入数据量为:"+i);
... ...
package com.tianbo.analysis.service.imp;
import com.tianbo.analysis.bean.SpringBeanUtitl;
import com.tianbo.analysis.dao.*;
import com.tianbo.analysis.model.*;
import lombok.extern.slf4j.Slf4j;
... ... @@ -48,6 +49,10 @@ public class ShareServiceImp {
@Autowired
CUSTOMSMESSAGEMapper customsmessageMapper;
ShareServiceImp(){
customsmessageMapper = SpringBeanUtitl.getBean(CUSTOMSMESSAGEMapper.class);
}
public int share(String type, CustomReception customReception){
// 发送日志 插入
CoustomAnalysisServiceImp coustomAnalysisServiceImp = new CoustomAnalysisServiceImp();
... ... @@ -84,7 +89,7 @@ public class ShareServiceImp {
ARRIVEDMASTER arrivedmaster = new ARRIVEDMASTER();
arrivedmaster.setFlightno(cus.getFlightno());
arrivedmaster.setFlightdate(cus.getFlightdate());
arrivedmaster.setFlightDate(cus.getFlightdate());
arrivedmaster.setReceiptinformation(customReception.getResponseText());
arrivedmaster.setAutoid(cus.getMasterautoid());
arrivedmaster.setWaybillnomaster(waybill);
... ...
... ... @@ -2,9 +2,8 @@ package com.tianbo.analysis.task;
import com.tianbo.util.Date.DateUtil;
import com.tianbo.util.IO.FileTool;
import com.tianbo.analysis.handle.CustomXmlHandle;
import com.tianbo.analysis.handle.CustomXmlHandleThread;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
... ... @@ -24,24 +23,10 @@ public class TaskAnalysis {
@Value("${custom.receptDirectory}")
private String receptDir;
//备份目录
@Value("${custom.receptBakDir}")
private String bakupDir;
//解析出错转移目录
@Value("${custom.errBakDir}")
private String errBakDir;
@Scheduled(fixedDelay = 5000)
@Scheduled(fixedDelay = 500000)
public void startTask(){
String today = DateUtil.getTodayBy_yyyyMMdd();
String readDir = receptDir + "/" + today;
String backdireByDay = bakupDir + "/" + today;
//回执目录
String readDir = receptDir;
try{
File fileDirectory = new File(readDir);
List<File> files = FileTool.readDirectoryFiles(fileDirectory);
... ... @@ -49,19 +34,14 @@ public class TaskAnalysis {
while(it.hasNext()){
File file = it.next();
try {
//解析
int i = new CustomXmlHandle().handelXmlDocument(file);
//操作成功,则转移剪切解析文件到备份目录,否则转移到error目录备份
if(i>0){
File bakupDirectory = new File(backdireByDay);
FileUtils.moveFileToDirectory(file,bakupDirectory,true);
}else {
errBak(file);
}
CustomXmlHandleThread customXmlHandleThread = new CustomXmlHandleThread();
customXmlHandleThread.setXmlfile(file);
Thread thread = new Thread(customXmlHandleThread);
thread.start();
}catch (Exception e){
e.printStackTrace();
log.error("解析回执出错",e);
errBak(file);
}
}
}catch (Exception e){
... ... @@ -70,16 +50,4 @@ public class TaskAnalysis {
}
}
public void errBak(File file){
try {
String today = DateUtil.getTodayBy_yyyyMMdd();
String errDirByDay = errBakDir + "/" + today;
File berrDirectory = new File(errDirByDay);
FileUtils.moveFileToDirectory(file,berrDirectory,true);
log.error("解析或其他错误备份文件:"+File.pathSeparator);
}catch (Exception e){
e.printStackTrace();
}
}
}
... ...
package com.tianbo.analysis.tools;
public class AWBTools {
public static String awbFormat(String awbNo) {
if (awbNo != null && awbNo.length() > 0) {
StringBuffer stringBuffer = new StringBuffer(awbNo);
stringBuffer.insert(3, "-");
awbNo = stringBuffer.toString();
return awbNo;
}
return null;
}
public static String[] splitFlight(String flightNo){
String[] flight = {"1","2"};
flight[0] = flightNo.substring(0,2);
flight[1] = flightNo.substring(2);
return flight;
}
}
... ...
... ... @@ -346,9 +346,14 @@
<update id="updateRECEIPTION" parameterType="com.tianbo.analysis.model.ARRIVEDMASTER" >
UPDATE ARRIVEDMASTER
SET RECEIPTINFORMATION= #{receiptinformation,jdbcType=VARCHAR}
WHERE FLIGHTNO = #{flightno,jdbcType=VARCHAR}
UPDATE
ARRIVEDMASTER
SET
RECEIPTINFORMATION= #{receiptinformation,jdbcType=VARCHAR}
WHERE
FLIGHTNO = #{flightno,jdbcType=VARCHAR}
AND
CARRIER = #{carrier,jdbcType=VARCHAR}
AND
FLIGHTDATE= #{flightDate,jdbcType=TIMESTAMP}
AND
... ...