作者 朱兆平

IMF开发包和springboot 报 还是有冲突,注意这里的坑,找时间弄下这些包

开始做切换到IMF的新仓单数据订阅的报文解析
正在显示 24 个修改的文件 包含 1039 行增加57 行删除
... ... @@ -93,6 +93,12 @@
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
... ...
package com.example.demo.controller;
import com.example.demo.service.NMS_FSU_FOH_Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping(value = "/arrivalMaster")
public class FSUFohController {
@Autowired
private NMS_FSU_FOH_Service fohService;
@GetMapping("list")
public Object list(@RequestParam(name = "pageNum",required = false,defaultValue = "1")
int pageNum,
@RequestParam(name = "pageSize",required = false,defaultValue = "10")
int pageSize){
return fohService.selectAll(pageNum,pageSize);
}
@GetMapping("getByAutoid")
public Object getByAutoid(@RequestParam(name = "autoid",required = true) String autoid){
return fohService.selectByPrimaryKey(autoid);
}
}
... ...
package com.example.demo.handle;
import com.example.demo.model.IMF_META;
import com.example.demo.util.IO.FileTool;
import com.example.demo.util.XML.XML2ENTITY;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import java.util.Map;
@Component
public class IMF_Message_MainHandle {
protected static final Logger logger = LoggerFactory.getLogger(IMF_Message_MainHandle.class);
public IMF_META messageHandle(String xmlString) throws Exception{
String TYPE_Path = "All";
IMF_META imf_meta = new IMF_META();
try{
Document doc = DocumentHelper.parseText(xmlString);
XML2ENTITY xml2ENTITY = new XML2ENTITY();
Map<String, Object> map = xml2ENTITY.Dom2Map(doc);
Map metaMap = (Map) getMap(map,"META");
imf_meta.setSNDR((String) getMap(metaMap,"SNDR"));
imf_meta.setDDTM((String) getMap(metaMap,"DDTM"));
imf_meta.setRCVR((String) getMap(metaMap,"RCVR"));
imf_meta.setSEQN((String) getMap(metaMap,"SEQN"));
imf_meta.setTYPE((String) getMap(metaMap,"TYPE"));
TYPE_Path = (String) getMap(metaMap,"STYP");
imf_meta.setSTYP(TYPE_Path);
//解析分配
switch (TYPE_Path){
case "PFFM":
break;
case "UFOH":
break;
case "EFOH":
break;
case "UDEP":
break;
case "EDEP":
break;
case "URCF":
break;
case "ERCF":
break;
case "FFM":
break;
case "IFWB":
break;
case "IFHL":
break;
}
}catch (Exception e){
FileTool.writeFile(TYPE_Path,e.toString()+"\n"+xmlString,false);
}
return imf_meta;
}
public static Boolean CheckMap(Map map,String key){
if(map.containsKey(key)){
return Boolean.TRUE;
}else {
return Boolean.FALSE;
}
}
public static Object getMap(Map map,String key){
if(map!=null && CheckMap(map,key)){
return map.get(key);
}else {
return null;
}
}
}
... ...
package com.example.demo.handle;
import com.example.demo.model.T_TXD_FWB;
import com.example.demo.model.T_TXD_FWBSTATUS;
import com.example.demo.service.T_TXD_FWB_Service;
import com.example.demo.util.Helper;
import com.example.demo.util.XML.XML2ENTITY;
... ... @@ -37,7 +36,8 @@ public class T_ETL_FWB_Handle {
public Boolean insertHandle (String xmlStr,BigDecimal messageBak_fid){
try{
Document doc = DocumentHelper.parseText(xmlStr);
Map<String, Object> map = XML2ENTITY.Dom2Map(doc);
XML2ENTITY xml2ENTITY = new XML2ENTITY();
Map<String, Object> map = xml2ENTITY.Dom2Map(doc);
T_TXD_FWB fwb= new T_TXD_FWB();
fwb.setMessageBakId(messageBak_fid);
... ... @@ -73,7 +73,7 @@ public class T_ETL_FWB_Handle {
String flightDevTime = ((Map)flight.get("DepartureEvent")).get("ScheduledOccurrenceDateTime").toString();
ZonedDateTime depZoneTime = ZonedDateTime.parse(flightDevTime);
Date flightDate = Date.from(depZoneTime.toInstant()); //这个是入库航班日期格式
fwb.setDeDatetime(flightDate);
//货物节点
//插入主数据表
... ...
package com.example.demo.handle.nms;
public class FSU_FOH_Handle {
public void fsu_foh_handle(){
}
}
... ...
package com.example.demo.handle.IMF;
package com.example.demo.imf;
import com.caac.imf.api.IMFClient;
import com.example.demo.scheduled.IMF_KAKO_Task;
import com.example.demo.handle.IMF_Message_MainHandle;
import com.example.demo.model.IMF_META;
import com.example.demo.scheduled.IMF_Task;
import com.example.demo.util.IO.FileTool;
import org.apache.log4j.Logger;
public class KAKO_Reader extends Thread{
protected static final Logger logger = Logger.getLogger(KAKO_Reader.class);
public class IMF_Reader extends Thread{
protected static final Logger logger = Logger.getLogger(IMF_Reader.class);
private IMFClient client;
public static boolean isrunning;
public KAKO_Reader(IMFClient client) {
public IMF_Reader(IMFClient client) {
this.client = client;
}
... ... @@ -18,19 +21,20 @@ public class KAKO_Reader extends Thread{
try{
isrunning =true;
while(true) {
if (IMF_KAKO_Task.LOGIN_OK) {
synchronized(this) {
if (IMF_Task.LOGIN_OK) {
String message = this.client.getMSG();
if (message != null) {
logger.info(message);
FileTool.writeFile("all",message,true);
IMF_Message_MainHandle mainHandle = new IMF_Message_MainHandle();
IMF_META meta = mainHandle.messageHandle(message);
}
}
logger.info("当前线程:"+Thread.currentThread().getName());
} else {
//logger.info("***");
}
try {
Thread.sleep(100L);
Thread.sleep(500L);
} catch (InterruptedException var3) {
var3.printStackTrace();
... ...
package com.example.demo.handle.IMF;
package com.example.demo.imf;
import com.caac.imf.api.IMFClient;
import com.example.demo.scheduled.IMF_KAKO_Task;
import com.example.demo.scheduled.IMF_Task;
import org.apache.log4j.Logger;
import org.slf4j.LoggerFactory;
public class KAKO_Sender extends Thread{
public class IMF_Sender extends Thread{
protected static final Logger logger = Logger.getLogger(KAKO_Sender.class);
protected static final Logger logger = Logger.getLogger(IMF_Sender.class);
public static boolean isrunning;
private IMFClient client;
public KAKO_Sender(IMFClient client) {
private String content;
public IMF_Sender(IMFClient client,String content) {
this.client = client;
this.content = content;
}
private String SendMsg = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
"<Msg>\n" +
"\t<META>\n" +
"\t\t<SNDR>ZWY</SNDR>\n" +
"\t\t<SNDR>NMS</SNDR>\n" +
"\t\t<RCVR/>\n" +
"\t\t<SEQN>16078357182</SEQN>\n" +
"\t\t<DDTM>20181116175107671</DDTM>\n" +
"\t\t<TYPE>HYXX</TYPE>\n" +
"\t\t<STYP>NDLR</STYP>\n" +
"\t\t<STYP>GAT</STYP>\n" +
"\t</META>\n" +
"\t<DECLAREPREPAREMASTERXMLBODY>\n" +
"\t\t<Head>\n" +
... ... @@ -123,9 +124,9 @@ public class KAKO_Sender extends Thread{
return;
}
isrunning=true;
if(IMF_KAKO_Task.isSuc){
if(IMF_Task.isSuc){
// logger.info("<<<<<<<<<<<主线程初始化成功>>>>>>>>>>>>");
if(IMF_KAKO_Task.LOGIN_OK){
if(IMF_Task.LOGIN_OK){
String returnMsg = this.client.sendMSG(SendMsg);
logger.info("《--------发送信息成功开始轮询500mm一次--------"+returnMsg);
... ... @@ -143,6 +144,6 @@ public class KAKO_Sender extends Thread{
isrunning=false;
logger.info("<<<<<<<<<<<发送线程不在了>>>>>>>>>>>>");
logger.info("<<<<<<<<<<<发送线程结束>>>>>>>>>>>>");
}
}
... ...
package com.example.demo.mapper;
import com.example.demo.model.NMS_FSU_FOH;
import java.util.List;
public interface NMS_FSU_FOHMapper {
int deleteByPrimaryKey(String autoid);
int insert(NMS_FSU_FOH record);
int insertSelective(NMS_FSU_FOH record);
NMS_FSU_FOH selectByPrimaryKey(String autoid);
int updateByPrimaryKeySelective(NMS_FSU_FOH record);
int updateByPrimaryKey(NMS_FSU_FOH record);
List<NMS_FSU_FOH> selectAll();
}
\ No newline at end of file
... ...
package com.example.demo.model;
public class IMF_META {
private String SNDR;//报文发送者账号
private String RCVR;//指定消息接受者
private String DDTM;//发送时间yyyyMMddhhmmss
private String TYPE;//消息主类型
private String STYP;//消息子类型
private String SEQN;//消息序号
public String getBODY() {
return BODY;
}
public void setBODY(String BODY) {
this.BODY = BODY;
}
private String BODY;//消息体
public String getSNDR() {
return SNDR;
}
public void setSNDR(String SNDR) {
this.SNDR = SNDR;
}
public String getRCVR() {
return RCVR;
}
public void setRCVR(String RCVR) {
this.RCVR = RCVR;
}
public String getDDTM() {
return DDTM;
}
public void setDDTM(String DDTM) {
this.DDTM = DDTM;
}
public String getTYPE() {
return TYPE;
}
public void setTYPE(String TYPE) {
this.TYPE = TYPE;
}
public String getSTYP() {
return STYP;
}
public void setSTYP(String STYP) {
this.STYP = STYP;
}
public String getSEQN() {
return SEQN;
}
public void setSEQN(String SEQN) {
this.SEQN = SEQN;
}
}
... ...
package com.example.demo.model;
import java.util.Date;
public class NMS_FSU_FOH {
private String autoid;
private String waybillnomaster;
private String tcdName;
private String tcdTypecode;
private String flightno;
private Date flightdate;
private String carrier;
private String originatingstation;
private String oName;
private String destinationstation;
private String fdName;
private String arrivedtotalpiece;
private String totalpiecequantity;
private String arrivedtotalweight;
private String grossweightmeasureuc;
private String totalgrossweightmeasure;
private String totalgrossweightmeasureuc;
private String chargeableweightmeasure;
private String chargeableweightmeasureuc;
private Date arriveddate;
private String transportsplitdescription;
private String customscode;
private String productname;
private String status;
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
... ...
... ... @@ -2,53 +2,54 @@ package com.example.demo.scheduled;
import com.caac.imf.api.IMFClient;
import com.caac.imf.api.IMFClientFactory;
import com.example.demo.handle.IMF.KAKO_Reader;
import com.example.demo.handle.IMF.KAKO_Sender;
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import com.example.demo.imf.IMF_Reader;
import com.example.demo.imf.IMF_Sender;
@Component
public class IMF_KAKO_Task {
protected static final Logger logger = Logger.getLogger(IMF_KAKO_Task.class);
public class IMF_Task {
protected static final Logger logger = Logger.getLogger(IMF_Task.class);
public static boolean LOGIN_OK = false;
public static boolean isSuc = true;
public static IMFClient client = null;
@Scheduled(fixedRate = 5000)
// @Scheduled(fixedRate = 5000)
private static void start() throws Exception {
PropertyConfigurator.configure("config/log4j.properties");
client = IMFClientFactory.createInstance();
if (client != null) {
if (!KAKO_Reader.isrunning) {
KAKO_Reader kako_reader = new KAKO_Reader(client);
IMF_Reader kako_reader = new IMF_Reader(client);
if (!kako_reader.isrunning) {
kako_reader.start();
logger.info("*********KAKO读取线程已开启***********");
} else {
logger.info("*********KAKO读取线程已开启-不再启动线程*********");
}
if(!KAKO_Sender.isrunning){
KAKO_Sender kako_sender = new KAKO_Sender(client);
kako_sender.start();
logger.info("<<<<<<<<<KAKO发送线程已开启>>>>>>>>>>>>");
}else {
logger.info("<<<<<<<<<KAKO发送线程已开启-不再启动线程>>>>>>>>>>>>");
}
}
if (!LOGIN_OK){
loginIMF(client, "KAKO", "KAKO", "config/imf_config.properties");
loginIMF(client, "NMS", "NMS_P", "config/imf_config.properties");
}
}
public void sendMsg(String msg){
if (!msg.equals(null) && !msg.isEmpty()){
IMF_Sender kako_sender = new IMF_Sender(client,msg);
if(!kako_sender.isrunning) {
kako_sender.start();
}
}
}
private static void loginIMF(IMFClient client, String userName, String password, String confFileName) {
if (client.initial(confFileName)) {
String message = client.login(userName, password);
... ...
package com.example.demo.service;
import com.example.demo.model.NMS_FSU_FOH;
import com.github.pagehelper.PageInfo;
public interface NMS_FSU_FOH_Service {
int insert(NMS_FSU_FOH record);
int insertSelective(NMS_FSU_FOH record);
int updateByPrimaryKeySelective(NMS_FSU_FOH record);
int updateByPrimaryKey(NMS_FSU_FOH record);
NMS_FSU_FOH selectByPrimaryKey(String autoid);
PageInfo<NMS_FSU_FOH> selectAll(int pageNum, int pageSize);
}
... ...
package com.example.demo.service.imp;
import com.example.demo.mapper.NMS_FSU_FOHMapper;
import com.example.demo.model.NMS_FSU_FOH;
import com.example.demo.service.NMS_FSU_FOH_Service;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service("fsu_foh_service")
public class NMS_FSU_FOH_ServiceImp implements NMS_FSU_FOH_Service{
@Autowired
private NMS_FSU_FOHMapper fsu_fohMapper;
public int insert(NMS_FSU_FOH record){
return fsu_fohMapper.insert(record);
}
public int insertSelective(NMS_FSU_FOH record){
return fsu_fohMapper.insertSelective(record);
}
public int updateByPrimaryKeySelective(NMS_FSU_FOH record){
return fsu_fohMapper.updateByPrimaryKeySelective(record);
}
public int updateByPrimaryKey(NMS_FSU_FOH record){
return fsu_fohMapper.updateByPrimaryKey(record);
}
public NMS_FSU_FOH selectByPrimaryKey(String autoid){
return fsu_fohMapper.selectByPrimaryKey(autoid);
}
public PageInfo<NMS_FSU_FOH> selectAll(int pageNum,int pageSize){
PageHelper.startPage(pageNum,pageSize);
Page<NMS_FSU_FOH> page = PageHelper.startPage(pageNum,pageSize);
List<NMS_FSU_FOH> fsuFohList = fsu_fohMapper.selectAll();
PageInfo<NMS_FSU_FOH> result = new PageInfo<NMS_FSU_FOH>(fsuFohList);
return result;
}
}
... ...
package com.example.demo.util.Date;
import java.text.SimpleDateFormat;
import java.util.Date;
public final class DateUtil {
private static Date currentDate = new Date();
private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
public static String getToday(){
return sdf.format(currentDate);
}
}
... ...
... ... @@ -5,6 +5,7 @@ import org.springframework.lang.Nullable;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Map;
import java.util.UUID;
public class Helper {
... ... @@ -46,4 +47,8 @@ public class Helper {
return null;
}
}
public static String getUUID(){
return UUID.randomUUID().toString().replace("-", "");
}
}
... ...
package com.example.demo.util.IO;
import com.example.demo.util.Date.DateUtil;
import com.example.demo.util.Helper;
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.io.IOException;
public final class FileTool {
private final static String errorRootDirectory = "errorLogs";//错误的根目录名
private final static String xmlRootDirectory = "xmlLog"; //记录已收到的报文目录
private final static String Cherector = "UTF-8";
/**
* 写入文件
* @param path 二级目录
* @param content 写入内容
* @param rightOrwrong 是写入错误记录目录还是记录目录
*/
public static void writeFile(String path,String content,boolean rightOrwrong){
StringBuffer stringBuffer = new StringBuffer();
if (rightOrwrong){
stringBuffer.append(xmlRootDirectory).append(path).append("/").append(DateUtil.getToday()).append("/").append(Helper.getUUID()).append(".log");
}else {
stringBuffer.append(errorRootDirectory).append(path).append("/").append(DateUtil.getToday()).append("/").append(Helper.getUUID()).append(".log");
}
File file = new File(stringBuffer.toString());
try{
FileUtils.writeStringToFile(file,content,Cherector);
}catch (IOException e){
e.printStackTrace();
}
}
}
... ...
... ... @@ -10,7 +10,7 @@ import org.dom4j.Element;
public class XML2ENTITY {
@SuppressWarnings("unchecked")
public static Map<String, Object> Dom2Map(Document doc){
public Map<String, Object> Dom2Map(Document doc){
Map<String, Object> map = new HashMap<String, Object>();
if(doc == null)
return map;
... ... @@ -26,7 +26,7 @@ public class XML2ENTITY {
return map;
}
@SuppressWarnings("unchecked")
public static Map Dom2Map(Element e){
public Map Dom2Map(Element e){
Map map = new HashMap();
List list = e.elements();
if(list.size() > 0){
... ...
... ... @@ -6,15 +6,15 @@ eureka.instance.hostname=localhost
#eureka服务器页面中status的请求路径
eureka.instance.status-page-url=http://localhost:7002/index
#eureka注册中心服务器地址
eureka.client.service-url.defaultZone=http://localhost:7001/eureka/
eureka.client.service-url.defaultZone=http://10.50.3.82:19527/eureka/
#服务名
spring.application.name=wareHouseAnalysis
#spring.datasource.name=CGOETL
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
spring.datasource.driver-class-name=oracle.jdbc.OracleDriver
spring.datasource.url=jdbc:oracle:thin:@10.50.3.68:1521:CGODW
spring.datasource.username=cgoetl
spring.datasource.url=jdbc:oracle:thin:@10.50.3.70:1521:CGODB
spring.datasource.username=CGONMS
spring.datasource.password=1q2w3e4r
#配置初始化大小/最小/最大
spring.datasource.druid.initial-size=1
... ... @@ -36,7 +36,9 @@ mybatis.mapper-locations=classpath:mapping/*.xml
mybatis.type-aliases-package=com.example.demo.model
logging.level.com.example.demo.mapper=DEBUG
pagehelper.helper-dialect=mysql
pagehelper.helper-dialect=oracle
#pagehelper.auto-dialect=true
#pagehelper.auto-runtime-dialect=true
pagehelper.reasonable=true
pagehelper.support-methods-arguments=true
pagehelper.params=count=countSql
... ...
... ... @@ -16,8 +16,8 @@
<!--<jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://127.0.0.1:3307/statistics" userId="root" password="">-->
<!--</jdbcConnection>-->
<jdbcConnection driverClass="oracle.jdbc.driver.OracleDriver"
connectionURL="jdbc:oracle:thin:@10.50.3.68:1521:CGODW"
userId="cgoetl"
connectionURL="jdbc:oracle:thin:@10.50.3.70:1521:CGODB"
userId="CGONMS"
password="1q2w3e4r">
</jdbcConnection>
<!-- 默认false,把JDBC DECIMAL 和 NUMERIC 类型解析为 Integer,为 true时把JDBC DECIMAL 和
... ... @@ -42,6 +42,6 @@
<property name="enableSubPackages" value="true"/>
</javaClientGenerator>
<!-- 要生成的表 tableName是数据库中的表名或视图名 domainObjectName是实体类名-->
<table tableName="T_ETL_MESSAGE" domainObjectName="T_ETL_MESSAGE" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
<table tableName="ARRIVEDMASTER" domainObjectName="NMS_FSU_FOH" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
</context>
</generatorConfiguration>
\ No newline at end of file
... ...
... ... @@ -10,7 +10,7 @@ Configuration:
- name: log.level.xjj
value: trace
- name: log.path
value: /opt/logs
value: logs
- name: project.name
value: my-spring-boot
... ...
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.example.demo.mapper.NMS_FSU_FOHMapper" >
<resultMap id="BaseResultMap" type="com.example.demo.model.NMS_FSU_FOH" >
<id column="AUTOID" property="autoid" jdbcType="VARCHAR" />
<result column="WAYBILLNOMASTER" property="waybillnomaster" jdbcType="VARCHAR" />
<result column="TCD_NAME" property="tcdName" jdbcType="VARCHAR" />
<result column="TCD_TYPECODE" property="tcdTypecode" jdbcType="VARCHAR" />
<result column="FLIGHTNO" property="flightno" jdbcType="VARCHAR" />
<result column="FLIGHTDATE" property="flightdate" jdbcType="TIMESTAMP" />
<result column="CARRIER" property="carrier" jdbcType="VARCHAR" />
<result column="ORIGINATINGSTATION" property="originatingstation" jdbcType="VARCHAR" />
<result column="O_NAME" property="oName" jdbcType="VARCHAR" />
<result column="DESTINATIONSTATION" property="destinationstation" jdbcType="VARCHAR" />
<result column="FD_NAME" property="fdName" jdbcType="VARCHAR" />
<result column="ARRIVEDTOTALPIECE" property="arrivedtotalpiece" jdbcType="VARCHAR" />
<result column="TOTALPIECEQUANTITY" property="totalpiecequantity" jdbcType="VARCHAR" />
<result column="ARRIVEDTOTALWEIGHT" property="arrivedtotalweight" jdbcType="VARCHAR" />
<result column="GROSSWEIGHTMEASUREUC" property="grossweightmeasureuc" jdbcType="VARCHAR" />
<result column="TOTALGROSSWEIGHTMEASURE" property="totalgrossweightmeasure" jdbcType="VARCHAR" />
<result column="TOTALGROSSWEIGHTMEASUREUC" property="totalgrossweightmeasureuc" jdbcType="VARCHAR" />
<result column="CHARGEABLEWEIGHTMEASURE" property="chargeableweightmeasure" jdbcType="VARCHAR" />
<result column="CHARGEABLEWEIGHTMEASUREUC" property="chargeableweightmeasureuc" jdbcType="VARCHAR" />
<result column="ARRIVEDDATE" property="arriveddate" jdbcType="TIMESTAMP" />
<result column="TRANSPORTSPLITDESCRIPTION" property="transportsplitdescription" jdbcType="VARCHAR" />
<result column="CUSTOMSCODE" property="customscode" jdbcType="VARCHAR" />
<result column="PRODUCTNAME" property="productname" jdbcType="VARCHAR" />
<result column="STATUS" property="status" jdbcType="VARCHAR" />
<result column="RECEIPTINFORMATION" property="receiptinformation" jdbcType="VARCHAR" />
<result column="CREATEDATE" property="createdate" jdbcType="TIMESTAMP" />
</resultMap>
<sql id="Base_Table">
ARRIVEDMASTER
</sql>
<sql id="Base_Column_List" >
AUTOID, WAYBILLNOMASTER, TCD_NAME, TCD_TYPECODE, FLIGHTNO, FLIGHTDATE, CARRIER, ORIGINATINGSTATION,
O_NAME, DESTINATIONSTATION, FD_NAME, ARRIVEDTOTALPIECE, TOTALPIECEQUANTITY, ARRIVEDTOTALWEIGHT,
GROSSWEIGHTMEASUREUC, TOTALGROSSWEIGHTMEASURE, TOTALGROSSWEIGHTMEASUREUC, CHARGEABLEWEIGHTMEASURE,
CHARGEABLEWEIGHTMEASUREUC, ARRIVEDDATE, TRANSPORTSPLITDESCRIPTION, CUSTOMSCODE, PRODUCTNAME,
STATUS, RECEIPTINFORMATION, CREATEDATE
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from ARRIVEDMASTER
where AUTOID = #{autoid,jdbcType=VARCHAR}
</select>
<select id="selectAll" resultMap="BaseResultMap">-- resultType="com.example.demo.model.NMS_FSU_FOH"
SELECT
<include refid="Base_Column_List"/>
FROM
<include refid="Base_Table"/>
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
delete from ARRIVEDMASTER
where AUTOID = #{autoid,jdbcType=VARCHAR}
</delete>
<insert id="insert" parameterType="com.example.demo.model.NMS_FSU_FOH" >
insert into ARRIVEDMASTER (AUTOID, WAYBILLNOMASTER, TCD_NAME,
TCD_TYPECODE, FLIGHTNO, FLIGHTDATE,
CARRIER, ORIGINATINGSTATION, O_NAME,
DESTINATIONSTATION, FD_NAME, ARRIVEDTOTALPIECE,
TOTALPIECEQUANTITY, ARRIVEDTOTALWEIGHT,
GROSSWEIGHTMEASUREUC, TOTALGROSSWEIGHTMEASURE,
TOTALGROSSWEIGHTMEASUREUC, CHARGEABLEWEIGHTMEASURE,
CHARGEABLEWEIGHTMEASUREUC, ARRIVEDDATE,
TRANSPORTSPLITDESCRIPTION, CUSTOMSCODE,
PRODUCTNAME, STATUS, RECEIPTINFORMATION,
CREATEDATE)
values (#{autoid,jdbcType=VARCHAR}, #{waybillnomaster,jdbcType=VARCHAR}, #{tcdName,jdbcType=VARCHAR},
#{tcdTypecode,jdbcType=VARCHAR}, #{flightno,jdbcType=VARCHAR}, #{flightdate,jdbcType=TIMESTAMP},
#{carrier,jdbcType=VARCHAR}, #{originatingstation,jdbcType=VARCHAR}, #{oName,jdbcType=VARCHAR},
#{destinationstation,jdbcType=VARCHAR}, #{fdName,jdbcType=VARCHAR}, #{arrivedtotalpiece,jdbcType=VARCHAR},
#{totalpiecequantity,jdbcType=VARCHAR}, #{arrivedtotalweight,jdbcType=VARCHAR},
#{grossweightmeasureuc,jdbcType=VARCHAR}, #{totalgrossweightmeasure,jdbcType=VARCHAR},
#{totalgrossweightmeasureuc,jdbcType=VARCHAR}, #{chargeableweightmeasure,jdbcType=VARCHAR},
#{chargeableweightmeasureuc,jdbcType=VARCHAR}, #{arriveddate,jdbcType=TIMESTAMP},
#{transportsplitdescription,jdbcType=VARCHAR}, #{customscode,jdbcType=VARCHAR},
#{productname,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{receiptinformation,jdbcType=VARCHAR},
#{createdate,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.example.demo.model.NMS_FSU_FOH" >
insert into ARRIVEDMASTER
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="autoid != null" >
AUTOID,
</if>
<if test="waybillnomaster != null" >
WAYBILLNOMASTER,
</if>
<if test="tcdName != null" >
TCD_NAME,
</if>
<if test="tcdTypecode != null" >
TCD_TYPECODE,
</if>
<if test="flightno != null" >
FLIGHTNO,
</if>
<if test="flightdate != null" >
FLIGHTDATE,
</if>
<if test="carrier != null" >
CARRIER,
</if>
<if test="originatingstation != null" >
ORIGINATINGSTATION,
</if>
<if test="oName != null" >
O_NAME,
</if>
<if test="destinationstation != null" >
DESTINATIONSTATION,
</if>
<if test="fdName != null" >
FD_NAME,
</if>
<if test="arrivedtotalpiece != null" >
ARRIVEDTOTALPIECE,
</if>
<if test="totalpiecequantity != null" >
TOTALPIECEQUANTITY,
</if>
<if test="arrivedtotalweight != null" >
ARRIVEDTOTALWEIGHT,
</if>
<if test="grossweightmeasureuc != null" >
GROSSWEIGHTMEASUREUC,
</if>
<if test="totalgrossweightmeasure != null" >
TOTALGROSSWEIGHTMEASURE,
</if>
<if test="totalgrossweightmeasureuc != null" >
TOTALGROSSWEIGHTMEASUREUC,
</if>
<if test="chargeableweightmeasure != null" >
CHARGEABLEWEIGHTMEASURE,
</if>
<if test="chargeableweightmeasureuc != null" >
CHARGEABLEWEIGHTMEASUREUC,
</if>
<if test="arriveddate != null" >
ARRIVEDDATE,
</if>
<if test="transportsplitdescription != null" >
TRANSPORTSPLITDESCRIPTION,
</if>
<if test="customscode != null" >
CUSTOMSCODE,
</if>
<if test="productname != null" >
PRODUCTNAME,
</if>
<if test="status != null" >
STATUS,
</if>
<if test="receiptinformation != null" >
RECEIPTINFORMATION,
</if>
<if test="createdate != null" >
CREATEDATE,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="autoid != null" >
#{autoid,jdbcType=VARCHAR},
</if>
<if test="waybillnomaster != null" >
#{waybillnomaster,jdbcType=VARCHAR},
</if>
<if test="tcdName != null" >
#{tcdName,jdbcType=VARCHAR},
</if>
<if test="tcdTypecode != null" >
#{tcdTypecode,jdbcType=VARCHAR},
</if>
<if test="flightno != null" >
#{flightno,jdbcType=VARCHAR},
</if>
<if test="flightdate != null" >
#{flightdate,jdbcType=TIMESTAMP},
</if>
<if test="carrier != null" >
#{carrier,jdbcType=VARCHAR},
</if>
<if test="originatingstation != null" >
#{originatingstation,jdbcType=VARCHAR},
</if>
<if test="oName != null" >
#{oName,jdbcType=VARCHAR},
</if>
<if test="destinationstation != null" >
#{destinationstation,jdbcType=VARCHAR},
</if>
<if test="fdName != null" >
#{fdName,jdbcType=VARCHAR},
</if>
<if test="arrivedtotalpiece != null" >
#{arrivedtotalpiece,jdbcType=VARCHAR},
</if>
<if test="totalpiecequantity != null" >
#{totalpiecequantity,jdbcType=VARCHAR},
</if>
<if test="arrivedtotalweight != null" >
#{arrivedtotalweight,jdbcType=VARCHAR},
</if>
<if test="grossweightmeasureuc != null" >
#{grossweightmeasureuc,jdbcType=VARCHAR},
</if>
<if test="totalgrossweightmeasure != null" >
#{totalgrossweightmeasure,jdbcType=VARCHAR},
</if>
<if test="totalgrossweightmeasureuc != null" >
#{totalgrossweightmeasureuc,jdbcType=VARCHAR},
</if>
<if test="chargeableweightmeasure != null" >
#{chargeableweightmeasure,jdbcType=VARCHAR},
</if>
<if test="chargeableweightmeasureuc != null" >
#{chargeableweightmeasureuc,jdbcType=VARCHAR},
</if>
<if test="arriveddate != null" >
#{arriveddate,jdbcType=TIMESTAMP},
</if>
<if test="transportsplitdescription != null" >
#{transportsplitdescription,jdbcType=VARCHAR},
</if>
<if test="customscode != null" >
#{customscode,jdbcType=VARCHAR},
</if>
<if test="productname != null" >
#{productname,jdbcType=VARCHAR},
</if>
<if test="status != null" >
#{status,jdbcType=VARCHAR},
</if>
<if test="receiptinformation != null" >
#{receiptinformation,jdbcType=VARCHAR},
</if>
<if test="createdate != null" >
#{createdate,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.example.demo.model.NMS_FSU_FOH" >
update ARRIVEDMASTER
<set >
<if test="waybillnomaster != null" >
WAYBILLNOMASTER = #{waybillnomaster,jdbcType=VARCHAR},
</if>
<if test="tcdName != null" >
TCD_NAME = #{tcdName,jdbcType=VARCHAR},
</if>
<if test="tcdTypecode != null" >
TCD_TYPECODE = #{tcdTypecode,jdbcType=VARCHAR},
</if>
<if test="flightno != null" >
FLIGHTNO = #{flightno,jdbcType=VARCHAR},
</if>
<if test="flightdate != null" >
FLIGHTDATE = #{flightdate,jdbcType=TIMESTAMP},
</if>
<if test="carrier != null" >
CARRIER = #{carrier,jdbcType=VARCHAR},
</if>
<if test="originatingstation != null" >
ORIGINATINGSTATION = #{originatingstation,jdbcType=VARCHAR},
</if>
<if test="oName != null" >
O_NAME = #{oName,jdbcType=VARCHAR},
</if>
<if test="destinationstation != null" >
DESTINATIONSTATION = #{destinationstation,jdbcType=VARCHAR},
</if>
<if test="fdName != null" >
FD_NAME = #{fdName,jdbcType=VARCHAR},
</if>
<if test="arrivedtotalpiece != null" >
ARRIVEDTOTALPIECE = #{arrivedtotalpiece,jdbcType=VARCHAR},
</if>
<if test="totalpiecequantity != null" >
TOTALPIECEQUANTITY = #{totalpiecequantity,jdbcType=VARCHAR},
</if>
<if test="arrivedtotalweight != null" >
ARRIVEDTOTALWEIGHT = #{arrivedtotalweight,jdbcType=VARCHAR},
</if>
<if test="grossweightmeasureuc != null" >
GROSSWEIGHTMEASUREUC = #{grossweightmeasureuc,jdbcType=VARCHAR},
</if>
<if test="totalgrossweightmeasure != null" >
TOTALGROSSWEIGHTMEASURE = #{totalgrossweightmeasure,jdbcType=VARCHAR},
</if>
<if test="totalgrossweightmeasureuc != null" >
TOTALGROSSWEIGHTMEASUREUC = #{totalgrossweightmeasureuc,jdbcType=VARCHAR},
</if>
<if test="chargeableweightmeasure != null" >
CHARGEABLEWEIGHTMEASURE = #{chargeableweightmeasure,jdbcType=VARCHAR},
</if>
<if test="chargeableweightmeasureuc != null" >
CHARGEABLEWEIGHTMEASUREUC = #{chargeableweightmeasureuc,jdbcType=VARCHAR},
</if>
<if test="arriveddate != null" >
ARRIVEDDATE = #{arriveddate,jdbcType=TIMESTAMP},
</if>
<if test="transportsplitdescription != null" >
TRANSPORTSPLITDESCRIPTION = #{transportsplitdescription,jdbcType=VARCHAR},
</if>
<if test="customscode != null" >
CUSTOMSCODE = #{customscode,jdbcType=VARCHAR},
</if>
<if test="productname != null" >
PRODUCTNAME = #{productname,jdbcType=VARCHAR},
</if>
<if test="status != null" >
STATUS = #{status,jdbcType=VARCHAR},
</if>
<if test="receiptinformation != null" >
RECEIPTINFORMATION = #{receiptinformation,jdbcType=VARCHAR},
</if>
<if test="createdate != null" >
CREATEDATE = #{createdate,jdbcType=TIMESTAMP},
</if>
</set>
where AUTOID = #{autoid,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.example.demo.model.NMS_FSU_FOH" >
update ARRIVEDMASTER
set WAYBILLNOMASTER = #{waybillnomaster,jdbcType=VARCHAR},
TCD_NAME = #{tcdName,jdbcType=VARCHAR},
TCD_TYPECODE = #{tcdTypecode,jdbcType=VARCHAR},
FLIGHTNO = #{flightno,jdbcType=VARCHAR},
FLIGHTDATE = #{flightdate,jdbcType=TIMESTAMP},
CARRIER = #{carrier,jdbcType=VARCHAR},
ORIGINATINGSTATION = #{originatingstation,jdbcType=VARCHAR},
O_NAME = #{oName,jdbcType=VARCHAR},
DESTINATIONSTATION = #{destinationstation,jdbcType=VARCHAR},
FD_NAME = #{fdName,jdbcType=VARCHAR},
ARRIVEDTOTALPIECE = #{arrivedtotalpiece,jdbcType=VARCHAR},
TOTALPIECEQUANTITY = #{totalpiecequantity,jdbcType=VARCHAR},
ARRIVEDTOTALWEIGHT = #{arrivedtotalweight,jdbcType=VARCHAR},
GROSSWEIGHTMEASUREUC = #{grossweightmeasureuc,jdbcType=VARCHAR},
TOTALGROSSWEIGHTMEASURE = #{totalgrossweightmeasure,jdbcType=VARCHAR},
TOTALGROSSWEIGHTMEASUREUC = #{totalgrossweightmeasureuc,jdbcType=VARCHAR},
CHARGEABLEWEIGHTMEASURE = #{chargeableweightmeasure,jdbcType=VARCHAR},
CHARGEABLEWEIGHTMEASUREUC = #{chargeableweightmeasureuc,jdbcType=VARCHAR},
ARRIVEDDATE = #{arriveddate,jdbcType=TIMESTAMP},
TRANSPORTSPLITDESCRIPTION = #{transportsplitdescription,jdbcType=VARCHAR},
CUSTOMSCODE = #{customscode,jdbcType=VARCHAR},
PRODUCTNAME = #{productname,jdbcType=VARCHAR},
STATUS = #{status,jdbcType=VARCHAR},
RECEIPTINFORMATION = #{receiptinformation,jdbcType=VARCHAR},
CREATEDATE = #{createdate,jdbcType=TIMESTAMP}
where AUTOID = #{autoid,jdbcType=VARCHAR}
</update>
</mapper>
\ No newline at end of file
... ...
... ... @@ -237,7 +237,8 @@ public class FWBDemo {
long beginTime = System.currentTimeMillis();
try{
Map<String, Object> map = XML2ENTITY.Dom2Map(doc);
XML2ENTITY xml2ENTITY = new XML2ENTITY();
Map<String, Object> map = xml2ENTITY.Dom2Map(doc);
T_TXD_FWB fwb= new T_TXD_FWB();
//fwb.setFid(getBigDecimal(1));
fwb.setMessageBakId(getBigDecimal(1));
... ...
package com.example.demo;
import com.example.demo.util.Date.DateUtil;
import com.example.demo.util.Helper;
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.io.IOException;
public class FileTest {
private static String rootDirectory = "errorLogs";
private static String Cherector = "UTF-8";
public static void main(String[] args) throws IOException {
writeFile("/PFFM/","test我是谁");
}
public static void writeFile(String path,String content){
String filename=rootDirectory + path + DateUtil.getToday()+"/"+ Helper.getUUID()+".log";
File file = new File(filename);
try{
FileUtils.writeStringToFile(file,content,Cherector);
}catch (IOException e){
e.printStackTrace();
}
}
}
... ...
... ... @@ -1176,12 +1176,10 @@ public class XmlToMapDemo {
long beginTime = System.currentTimeMillis();
Map<String, Object> map = XML2ENTITY.Dom2Map(doc);
// 头部解析
Map metamap = (Map) map.get("META");
String SEDR = (String) metamap.get("SNDR");
logger.info(SEDR);
XML2ENTITY xml2ENTITY = new XML2ENTITY();
Map<String, Object> map = xml2ENTITY.Dom2Map(doc); map.get("META");
//报体解析入口
Map LogisticsTransportManifest = (Map) map.get("LogisticsTransportManifest");
... ...