写入数据仓库T_ELT_MESSAGE表原始报文,并本地存储接收报文,并记录入库异常的报文
正在显示
16 个修改的文件
包含
741 行增加
和
24 行删除
@@ -6,9 +6,12 @@ loginpass = KKW1 | @@ -6,9 +6,12 @@ loginpass = KKW1 | ||
6 | readDirectory = /Users/mrz/Downloads/3.CV972/1.CV报文 | 6 | readDirectory = /Users/mrz/Downloads/3.CV972/1.CV报文 |
7 | #接收存储报文目录 | 7 | #接收存储报文目录 |
8 | bakDirectory = xmlFromImf | 8 | bakDirectory = xmlFromImf |
9 | +#程序入库出错备份报文目录 | ||
10 | +errBakDirectory = xmlerr | ||
9 | 11 | ||
10 | #IMF MEAT报头配置 | 12 | #IMF MEAT报头配置 |
11 | 13 | ||
12 | RCVR= | 14 | RCVR= |
13 | TYPE=KAKO | 15 | TYPE=KAKO |
14 | -STYP=CARM | ||
16 | +STYP=CARM | ||
17 | +AppId=warehouse |
1 | +/** | ||
2 | + * @author mrz | ||
3 | + * @email 17966059@qq.com | ||
4 | + */ | ||
1 | package com.tianbo.warehouse; | 5 | package com.tianbo.warehouse; |
2 | 6 | ||
7 | +import org.mybatis.spring.annotation.MapperScan; | ||
3 | import org.springframework.boot.SpringApplication; | 8 | import org.springframework.boot.SpringApplication; |
4 | import org.springframework.boot.autoconfigure.SpringBootApplication; | 9 | import org.springframework.boot.autoconfigure.SpringBootApplication; |
5 | import org.springframework.cloud.netflix.eureka.EnableEurekaClient; | 10 | import org.springframework.cloud.netflix.eureka.EnableEurekaClient; |
6 | -import org.springframework.context.annotation.ComponentScan; | ||
7 | import org.springframework.scheduling.annotation.EnableScheduling; | 11 | import org.springframework.scheduling.annotation.EnableScheduling; |
8 | 12 | ||
9 | @SpringBootApplication | 13 | @SpringBootApplication |
10 | @EnableScheduling | 14 | @EnableScheduling |
11 | @EnableEurekaClient | 15 | @EnableEurekaClient |
16 | +@MapperScan("com.tianbo.warehouse.dao") | ||
12 | public class WarehouseApplication { | 17 | public class WarehouseApplication { |
13 | 18 | ||
14 | public static void main(String[] args) { | 19 | public static void main(String[] args) { |
1 | +package com.tianbo.warehouse.dao; | ||
2 | + | ||
3 | +import com.tianbo.warehouse.model.T_ETL_MESSAGE; | ||
4 | +import java.math.BigDecimal; | ||
5 | + | ||
6 | +public interface T_ETL_MESSAGEMapper { | ||
7 | + int deleteByPrimaryKey(BigDecimal fid); | ||
8 | + | ||
9 | + int insert(T_ETL_MESSAGE record); | ||
10 | + | ||
11 | + int insertSelective(T_ETL_MESSAGE record); | ||
12 | + | ||
13 | + T_ETL_MESSAGE selectByPrimaryKey(BigDecimal fid); | ||
14 | + | ||
15 | + int updateByPrimaryKeySelective(T_ETL_MESSAGE record); | ||
16 | + | ||
17 | + int updateByPrimaryKeyWithBLOBs(T_ETL_MESSAGE record); | ||
18 | + | ||
19 | + int updateByPrimaryKey(T_ETL_MESSAGE record); | ||
20 | +} |
1 | +package com.tianbo.warehouse.handle; | ||
2 | + | ||
3 | +import com.tianbo.warehouse.model.T_ETL_MESSAGE; | ||
4 | +import com.tianbo.warehouse.service.T_ETL_MESSAGEService; | ||
5 | + | ||
6 | +import com.tianbo.warehouse.util.Date.DateUtil; | ||
7 | +import com.tianbo.warehouse.util.IO.FileTool; | ||
8 | +import com.tianbo.warehouse.util.XML.XMLXPath; | ||
9 | +import org.apache.log4j.Logger; | ||
10 | +import org.dom4j.Document; | ||
11 | +import org.dom4j.DocumentHelper; | ||
12 | +import org.springframework.beans.factory.annotation.Autowired; | ||
13 | +import org.springframework.stereotype.Component; | ||
14 | + | ||
15 | +import javax.annotation.PostConstruct; | ||
16 | +import java.util.Date; | ||
17 | + | ||
18 | +/** | ||
19 | + * 存储IMF过来的原始报文到数据仓库T_ELT_MESSAGE原始报文表中 | ||
20 | + */ | ||
21 | +@Component | ||
22 | +public class IMFSaveHandle { | ||
23 | + | ||
24 | + @Autowired | ||
25 | + protected T_ETL_MESSAGEService messageService; | ||
26 | + | ||
27 | + private static IMFSaveHandle saveHandle; | ||
28 | + | ||
29 | + public final static String SNDR = "//MSG/META/SNDR"; | ||
30 | + | ||
31 | + public final static String RCVR = "//MSG/META/RCVR"; | ||
32 | + | ||
33 | + public final static String DDTM = "//MSG/META/DDTM"; | ||
34 | + | ||
35 | + public final static String TYPE = "//MSG/META/TYPE"; | ||
36 | + | ||
37 | + public final static String STYP = "//MSG/META/STYP"; | ||
38 | + | ||
39 | + public final static String SEQN = "//MSG/META/SEQN"; | ||
40 | + | ||
41 | + protected static final Logger logger = Logger.getLogger(IMFSaveHandle.class); | ||
42 | + | ||
43 | + @PostConstruct | ||
44 | + public void init(){ | ||
45 | + saveHandle = this; | ||
46 | + saveHandle.messageService = this.messageService; | ||
47 | + } | ||
48 | + | ||
49 | + public void handle(String xmlmessage){ | ||
50 | + try { | ||
51 | + Document document = DocumentHelper.parseText(xmlmessage); | ||
52 | + T_ETL_MESSAGE message = new T_ETL_MESSAGE(); | ||
53 | + String ddtm = XMLXPath.getSingleValueByPath(document,DDTM); | ||
54 | + Date ddtmDate = DateUtil.formatByyyyyMMddHHmmss(ddtm); | ||
55 | + message.setDdtm(ddtmDate); | ||
56 | + message.setSntm(ddtmDate); | ||
57 | + message.setOper("ALL"); | ||
58 | + message.setAppid("W"); | ||
59 | + message.setEtltim(new Date()); | ||
60 | + | ||
61 | + message.setSndr(XMLXPath.getSingleValueByPath(document,SNDR)); | ||
62 | + message.setRcvr(XMLXPath.getSingleValueByPath(document,RCVR)); | ||
63 | + message.setType(XMLXPath.getSingleValueByPath(document,TYPE)); | ||
64 | + message.setStyp(XMLXPath.getSingleValueByPath(document,STYP)); | ||
65 | + message.setSeqn(XMLXPath.getSingleValueByPath(document,SEQN)); | ||
66 | + | ||
67 | + message.setContent(xmlmessage); | ||
68 | + | ||
69 | + int i = saveHandle.messageService.insertSelective(message); | ||
70 | + }catch (Exception e){ | ||
71 | + FileTool.writeFile("err",xmlmessage,false); | ||
72 | + logger.warn("*报文入库失败已存储成备份文件*"); | ||
73 | + logger.error(e); | ||
74 | + logger.warn(e); | ||
75 | + } | ||
76 | + | ||
77 | + | ||
78 | + | ||
79 | + } | ||
80 | +} |
1 | package com.tianbo.warehouse.imf; | 1 | package com.tianbo.warehouse.imf; |
2 | 2 | ||
3 | import com.caac.imf.api.IMFClient; | 3 | import com.caac.imf.api.IMFClient; |
4 | +import com.tianbo.warehouse.handle.IMFSaveHandle; | ||
4 | import com.tianbo.warehouse.schedul.IMF_Task; | 5 | import com.tianbo.warehouse.schedul.IMF_Task; |
5 | import com.tianbo.warehouse.util.IO.FileTool; | 6 | import com.tianbo.warehouse.util.IO.FileTool; |
6 | import org.apache.log4j.Logger; | 7 | import org.apache.log4j.Logger; |
@@ -22,17 +23,18 @@ public class IMF_Reader extends Thread{ | @@ -22,17 +23,18 @@ public class IMF_Reader extends Thread{ | ||
22 | if (IMF_Task.LOGIN_OK) { | 23 | if (IMF_Task.LOGIN_OK) { |
23 | String message = this.client.getMSG(); | 24 | String message = this.client.getMSG(); |
24 | if (message != null) { | 25 | if (message != null) { |
26 | + //存储至备份目录 | ||
25 | FileTool.writeFileToBak(message); | 27 | FileTool.writeFileToBak(message); |
26 | -// IMF_Message_MainHandle mainHandle = new IMF_Message_MainHandle(); | ||
27 | -// IMF_META meta = mainHandle.messageHandle(message); | 28 | + IMFSaveHandle imfSaveHandle = new IMFSaveHandle(); |
29 | + imfSaveHandle.handle(message); | ||
28 | } | 30 | } |
29 | - logger.info("当前线程:"+Thread.currentThread().getName()); | 31 | + logger.info("当前读取线程:"+Thread.currentThread().getName()); |
30 | } else { | 32 | } else { |
31 | //logger.info("***"); | 33 | //logger.info("***"); |
32 | } | 34 | } |
33 | 35 | ||
34 | try { | 36 | try { |
35 | - Thread.sleep(500L); | 37 | + Thread.sleep(30000L); |
36 | } catch (InterruptedException var3) { | 38 | } catch (InterruptedException var3) { |
37 | var3.printStackTrace(); | 39 | var3.printStackTrace(); |
38 | 40 |
@@ -10,6 +10,8 @@ import org.apache.log4j.Logger; | @@ -10,6 +10,8 @@ import org.apache.log4j.Logger; | ||
10 | import org.xml.sax.SAXParseException; | 10 | import org.xml.sax.SAXParseException; |
11 | 11 | ||
12 | import java.io.File; | 12 | import java.io.File; |
13 | +import java.io.UnsupportedEncodingException; | ||
14 | +import java.util.Iterator; | ||
13 | import java.util.List; | 15 | import java.util.List; |
14 | 16 | ||
15 | public class IMF_Sender extends Thread{ | 17 | public class IMF_Sender extends Thread{ |
@@ -28,7 +30,7 @@ public class IMF_Sender extends Thread{ | @@ -28,7 +30,7 @@ public class IMF_Sender extends Thread{ | ||
28 | 30 | ||
29 | @Override | 31 | @Override |
30 | public void run(){ | 32 | public void run(){ |
31 | - try { | 33 | + |
32 | String sendDir = FileTool.readProperties("readDirectory"); | 34 | String sendDir = FileTool.readProperties("readDirectory"); |
33 | String SNDR = FileTool.readProperties("loginname"); | 35 | String SNDR = FileTool.readProperties("loginname"); |
34 | String TYPE = FileTool.readProperties("TYPE"); | 36 | String TYPE = FileTool.readProperties("TYPE"); |
@@ -47,16 +49,21 @@ public class IMF_Sender extends Thread{ | @@ -47,16 +49,21 @@ public class IMF_Sender extends Thread{ | ||
47 | while (true){ | 49 | while (true){ |
48 | //发送报文 | 50 | //发送报文 |
49 | List<File> files = FileTool.readDirectoryFiles(new File(sendDir)); | 51 | List<File> files = FileTool.readDirectoryFiles(new File(sendDir)); |
50 | - for (File file:files) { | ||
51 | - | ||
52 | - String sendMsg = MakeImfMeta.makeImfDocument(SNDR,RCVR,TYPE,STYP,DDTM,SEQN,file); | ||
53 | - String returnMsg = this.client.sendMSG(sendMsg); | ||
54 | - | ||
55 | - //发送成功处理,删除已发送成功的目录下的文件 | ||
56 | - if(returnMsg.indexOf("<CODE>9</CODE>")>=0){ | ||
57 | - FileUtils.forceDelete(file); | 52 | + String sendMsg = ""; |
53 | + Iterator<File> it = files.iterator(); | ||
54 | + while(it.hasNext()){ | ||
55 | + File file = it.next(); | ||
56 | + try { | ||
57 | + sendMsg = MakeImfMeta.makeImfDocument(SNDR,RCVR,TYPE,STYP,DDTM,SEQN,file); | ||
58 | + String returnMsg = this.client.sendMSG(sendMsg); | ||
59 | + if(returnMsg.indexOf("<CODE>9</CODE>")>=0){ | ||
60 | + FileUtils.forceDelete(file); | ||
61 | + } | ||
62 | + }catch (Exception e){ | ||
63 | + e.printStackTrace(); | ||
58 | } | 64 | } |
59 | } | 65 | } |
66 | + | ||
60 | try { | 67 | try { |
61 | Thread.sleep(500L); | 68 | Thread.sleep(500L); |
62 | } catch (InterruptedException var3) { | 69 | } catch (InterruptedException var3) { |
@@ -68,11 +75,8 @@ public class IMF_Sender extends Thread{ | @@ -68,11 +75,8 @@ public class IMF_Sender extends Thread{ | ||
68 | } | 75 | } |
69 | } | 76 | } |
70 | 77 | ||
71 | - }catch (Exception var14) { | ||
72 | - var14.printStackTrace(); | ||
73 | - logger.info(var14.getMessage()); | ||
74 | - } | ||
75 | - | 78 | + |
79 | + | ||
76 | isrunning=false; | 80 | isrunning=false; |
77 | logger.info("<<<<<<<<<<<发送线程结束>>>>>>>>>>>>"); | 81 | logger.info("<<<<<<<<<<<发送线程结束>>>>>>>>>>>>"); |
78 | } | 82 | } |
1 | +package com.tianbo.warehouse.model; | ||
2 | + | ||
3 | +import java.math.BigDecimal; | ||
4 | +import java.util.Date; | ||
5 | + | ||
6 | +public class T_ETL_MESSAGE { | ||
7 | + private BigDecimal fid; | ||
8 | + | ||
9 | + private String oper; | ||
10 | + | ||
11 | + private Date sntm; | ||
12 | + | ||
13 | + private String sndr; | ||
14 | + | ||
15 | + private String rcvr; | ||
16 | + | ||
17 | + private String seqn; | ||
18 | + | ||
19 | + private Date ddtm; | ||
20 | + | ||
21 | + private String type; | ||
22 | + | ||
23 | + private String styp; | ||
24 | + | ||
25 | + private String transid; | ||
26 | + | ||
27 | + private String remark; | ||
28 | + | ||
29 | + private Date outtm; | ||
30 | + | ||
31 | + private BigDecimal outflag; | ||
32 | + | ||
33 | + private Date etltim; | ||
34 | + | ||
35 | + private BigDecimal etlflag; | ||
36 | + | ||
37 | + private Date errtm; | ||
38 | + | ||
39 | + private BigDecimal errflag; | ||
40 | + | ||
41 | + private String errlog; | ||
42 | + | ||
43 | + private String appid; | ||
44 | + | ||
45 | + private String content; | ||
46 | + | ||
47 | + public BigDecimal getFid() { | ||
48 | + return fid; | ||
49 | + } | ||
50 | + | ||
51 | + public void setFid(BigDecimal fid) { | ||
52 | + this.fid = fid; | ||
53 | + } | ||
54 | + | ||
55 | + public String getOper() { | ||
56 | + return oper; | ||
57 | + } | ||
58 | + | ||
59 | + public void setOper(String oper) { | ||
60 | + this.oper = oper == null ? null : oper.trim(); | ||
61 | + } | ||
62 | + | ||
63 | + public Date getSntm() { | ||
64 | + return sntm; | ||
65 | + } | ||
66 | + | ||
67 | + public void setSntm(Date sntm) { | ||
68 | + this.sntm = sntm; | ||
69 | + } | ||
70 | + | ||
71 | + public String getSndr() { | ||
72 | + return sndr; | ||
73 | + } | ||
74 | + | ||
75 | + public void setSndr(String sndr) { | ||
76 | + this.sndr = sndr == null ? null : sndr.trim(); | ||
77 | + } | ||
78 | + | ||
79 | + public String getRcvr() { | ||
80 | + return rcvr; | ||
81 | + } | ||
82 | + | ||
83 | + public void setRcvr(String rcvr) { | ||
84 | + this.rcvr = rcvr == null ? null : rcvr.trim(); | ||
85 | + } | ||
86 | + | ||
87 | + public String getSeqn() { | ||
88 | + return seqn; | ||
89 | + } | ||
90 | + | ||
91 | + public void setSeqn(String seqn) { | ||
92 | + this.seqn = seqn == null ? null : seqn.trim(); | ||
93 | + } | ||
94 | + | ||
95 | + public Date getDdtm() { | ||
96 | + return ddtm; | ||
97 | + } | ||
98 | + | ||
99 | + public void setDdtm(Date ddtm) { | ||
100 | + this.ddtm = ddtm; | ||
101 | + } | ||
102 | + | ||
103 | + public String getType() { | ||
104 | + return type; | ||
105 | + } | ||
106 | + | ||
107 | + public void setType(String type) { | ||
108 | + this.type = type == null ? null : type.trim(); | ||
109 | + } | ||
110 | + | ||
111 | + public String getStyp() { | ||
112 | + return styp; | ||
113 | + } | ||
114 | + | ||
115 | + public void setStyp(String styp) { | ||
116 | + this.styp = styp == null ? null : styp.trim(); | ||
117 | + } | ||
118 | + | ||
119 | + public String getTransid() { | ||
120 | + return transid; | ||
121 | + } | ||
122 | + | ||
123 | + public void setTransid(String transid) { | ||
124 | + this.transid = transid == null ? null : transid.trim(); | ||
125 | + } | ||
126 | + | ||
127 | + public String getRemark() { | ||
128 | + return remark; | ||
129 | + } | ||
130 | + | ||
131 | + public void setRemark(String remark) { | ||
132 | + this.remark = remark; | ||
133 | + } | ||
134 | + | ||
135 | + public Date getOuttm() { | ||
136 | + return outtm; | ||
137 | + } | ||
138 | + | ||
139 | + public void setOuttm(Date outtm) { | ||
140 | + this.outtm = outtm; | ||
141 | + } | ||
142 | + | ||
143 | + public BigDecimal getOutflag() { | ||
144 | + return outflag; | ||
145 | + } | ||
146 | + | ||
147 | + public void setOutflag(BigDecimal outflag) { | ||
148 | + this.outflag = outflag; | ||
149 | + } | ||
150 | + | ||
151 | + public Date getEtltim() { | ||
152 | + return etltim; | ||
153 | + } | ||
154 | + | ||
155 | + public void setEtltim(Date etltim) { | ||
156 | + this.etltim = etltim; | ||
157 | + } | ||
158 | + | ||
159 | + public BigDecimal getEtlflag() { | ||
160 | + return etlflag; | ||
161 | + } | ||
162 | + | ||
163 | + public void setEtlflag(BigDecimal etlflag) { | ||
164 | + this.etlflag = etlflag; | ||
165 | + } | ||
166 | + | ||
167 | + public Date getErrtm() { | ||
168 | + return errtm; | ||
169 | + } | ||
170 | + | ||
171 | + public void setErrtm(Date errtm) { | ||
172 | + this.errtm = errtm; | ||
173 | + } | ||
174 | + | ||
175 | + public BigDecimal getErrflag() { | ||
176 | + return errflag; | ||
177 | + } | ||
178 | + | ||
179 | + public void setErrflag(BigDecimal errflag) { | ||
180 | + this.errflag = errflag; | ||
181 | + } | ||
182 | + | ||
183 | + public String getErrlog() { | ||
184 | + return errlog; | ||
185 | + } | ||
186 | + | ||
187 | + public void setErrlog(String errlog) { | ||
188 | + this.errlog = errlog; | ||
189 | + } | ||
190 | + | ||
191 | + public String getAppid() { | ||
192 | + return appid; | ||
193 | + } | ||
194 | + | ||
195 | + public void setAppid(String appid) { | ||
196 | + this.appid = appid == null ? null : appid.trim(); | ||
197 | + } | ||
198 | + | ||
199 | + public String getContent() { | ||
200 | + return content; | ||
201 | + } | ||
202 | + | ||
203 | + public void setContent(String content) { | ||
204 | + this.content = content == null ? null : content.trim(); | ||
205 | + } | ||
206 | +} |
@@ -39,7 +39,7 @@ public class IMF_Task { | @@ -39,7 +39,7 @@ public class IMF_Task { | ||
39 | 39 | ||
40 | IMF_Sender kako_sender = new IMF_Sender(client); | 40 | IMF_Sender kako_sender = new IMF_Sender(client); |
41 | if(!IMF_Sender.isrunning) { | 41 | if(!IMF_Sender.isrunning) { |
42 | - kako_sender.start(); | 42 | +// kako_sender.start(); |
43 | } | 43 | } |
44 | } | 44 | } |
45 | 45 |
1 | +package com.tianbo.warehouse.service.imp; | ||
2 | + | ||
3 | +import com.tianbo.warehouse.dao.T_ETL_MESSAGEMapper; | ||
4 | +import com.tianbo.warehouse.model.T_ETL_MESSAGE; | ||
5 | +import com.tianbo.warehouse.service.T_ETL_MESSAGEService; | ||
6 | +import org.springframework.beans.factory.annotation.Autowired; | ||
7 | +import org.springframework.stereotype.Service; | ||
8 | + | ||
9 | +@Service("messageService") | ||
10 | +public class T_ETL_MESSAGEServiceImp implements T_ETL_MESSAGEService{ | ||
11 | + | ||
12 | + @Autowired | ||
13 | + T_ETL_MESSAGEMapper messageMapper; | ||
14 | + | ||
15 | + @Override | ||
16 | + public int insert(T_ETL_MESSAGE record){ | ||
17 | + return messageMapper.insert(record); | ||
18 | + } | ||
19 | + | ||
20 | + @Override | ||
21 | + public int insertSelective(T_ETL_MESSAGE record){ | ||
22 | + return messageMapper.insertSelective(record); | ||
23 | + } | ||
24 | +} |
1 | package com.tianbo.warehouse.util.Date; | 1 | package com.tianbo.warehouse.util.Date; |
2 | 2 | ||
3 | import java.text.SimpleDateFormat; | 3 | import java.text.SimpleDateFormat; |
4 | +import java.time.LocalDateTime; | ||
5 | +import java.time.ZoneId; | ||
6 | +import java.time.format.DateTimeFormatter; | ||
7 | +import java.time.format.DateTimeParseException; | ||
4 | import java.util.Date; | 8 | import java.util.Date; |
5 | 9 | ||
6 | public final class DateUtil { | 10 | public final class DateUtil { |
@@ -14,4 +18,16 @@ public final class DateUtil { | @@ -14,4 +18,16 @@ public final class DateUtil { | ||
14 | public static String getDDTM(){ | 18 | public static String getDDTM(){ |
15 | return timesdf.format(currentDate); | 19 | return timesdf.format(currentDate); |
16 | } | 20 | } |
21 | + | ||
22 | + public static Date formatByyyyyMMddHHmmss(String dateStr) throws DateTimeParseException{ | ||
23 | + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmss"); | ||
24 | + LocalDateTime dateTime = LocalDateTime.parse(dateStr, formatter); | ||
25 | + return convertLDTToDate(dateTime); | ||
26 | + } | ||
27 | + | ||
28 | + //LocalDateTime转换为Date | ||
29 | + public static Date convertLDTToDate(LocalDateTime time) { | ||
30 | + return Date.from(time.atZone(ZoneId.systemDefault()).toInstant()); | ||
31 | + } | ||
32 | + | ||
17 | } | 33 | } |
@@ -39,7 +39,7 @@ public final class FileTool { | @@ -39,7 +39,7 @@ public final class FileTool { | ||
39 | 39 | ||
40 | } | 40 | } |
41 | public static String readfile(File file) throws IOException{ | 41 | public static String readfile(File file) throws IOException{ |
42 | - String fileToString = FileUtils.readFileToString(file, "GB2312"); | 42 | + String fileToString = FileUtils.readFileToString(file, "utf-8"); |
43 | return fileToString; | 43 | return fileToString; |
44 | } | 44 | } |
45 | 45 |
@@ -13,8 +13,8 @@ spring.application.name=imf-warehouse-reader | @@ -13,8 +13,8 @@ spring.application.name=imf-warehouse-reader | ||
13 | #spring.datasource.name=CGOETL | 13 | #spring.datasource.name=CGOETL |
14 | spring.datasource.type=com.alibaba.druid.pool.DruidDataSource | 14 | spring.datasource.type=com.alibaba.druid.pool.DruidDataSource |
15 | spring.datasource.driver-class-name=oracle.jdbc.OracleDriver | 15 | spring.datasource.driver-class-name=oracle.jdbc.OracleDriver |
16 | -spring.datasource.url=jdbc:oracle:thin:@10.50.3.70:1521:CGODB | ||
17 | -spring.datasource.username=CGONMS | 16 | +spring.datasource.url=jdbc:oracle:thin:@10.50.3.68:1521:CGODW |
17 | +spring.datasource.username=CGOETL | ||
18 | spring.datasource.password=1q2w3e4r | 18 | spring.datasource.password=1q2w3e4r |
19 | #配置初始化大小/最小/最大 | 19 | #配置初始化大小/最小/最大 |
20 | spring.datasource.druid.initial-size=1 | 20 | spring.datasource.druid.initial-size=1 |
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!DOCTYPE generatorConfiguration | ||
3 | + PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" | ||
4 | + "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd"> | ||
5 | +<generatorConfiguration> | ||
6 | + <!-- 数据库驱动:选择你的本地硬盘上面的数据库驱动包--> | ||
7 | + <!--<classPathEntry location="/Users/mrz/Downloads/mybatis-generator-core-1.3.2/lib/mysql-connector-java-5.1.25-bin.jar"/>--> | ||
8 | + <classPathEntry location="/Users/mrz/Documents/maven/ojdbc6.jar"/> | ||
9 | + <context id="DB2Tables" targetRuntime="MyBatis3"> | ||
10 | + <commentGenerator> | ||
11 | + <property name="suppressDate" value="true"/> | ||
12 | + <!-- 是否去除自动生成的注释 true:是 : false:否 --> | ||
13 | + <property name="suppressAllComments" value="true"/> | ||
14 | + </commentGenerator> | ||
15 | + <!--数据库链接URL,用户名、密码 --> | ||
16 | + <!--<jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://127.0.0.1:3307/statistics" userId="root" password="">--> | ||
17 | + <!--</jdbcConnection>--> | ||
18 | + <jdbcConnection driverClass="oracle.jdbc.driver.OracleDriver" | ||
19 | + connectionURL="jdbc:oracle:thin:@10.50.3.68:1521:CGODW" | ||
20 | + userId="CGOETL" | ||
21 | + password="1q2w3e4r"> | ||
22 | + </jdbcConnection> | ||
23 | + <!-- 默认false,把JDBC DECIMAL 和 NUMERIC 类型解析为 Integer,为 true时把JDBC DECIMAL 和 | ||
24 | + NUMERIC 类型解析为java.math.BigDecimal --> | ||
25 | + <!--<javaTypeResolver>--> | ||
26 | + <!--<property name="forceBigDecimals" value="true" />--> | ||
27 | + <!--</javaTypeResolver>--> | ||
28 | + <javaTypeResolver> | ||
29 | + <property name="forceBigDecimals" value="false"/> | ||
30 | + </javaTypeResolver> | ||
31 | + <!-- 生成模型的包名和位置--> | ||
32 | + <javaModelGenerator targetPackage="com.tianbo.warehouse.model" targetProject="src/main/java"> | ||
33 | + <property name="enableSubPackages" value="true"/> | ||
34 | + <property name="trimStrings" value="true"/> | ||
35 | + </javaModelGenerator> | ||
36 | + <!-- 生成映射文件的包名和位置--> | ||
37 | + <sqlMapGenerator targetPackage="mapping" targetProject="src/main/resources"> | ||
38 | + <property name="enableSubPackages" value="true"/> | ||
39 | + </sqlMapGenerator> | ||
40 | + <!-- 生成DAO的包名和位置--> | ||
41 | + <javaClientGenerator type="XMLMAPPER" targetPackage="com.tianbo.warehouse.dao" targetProject="src/main/java"> | ||
42 | + <property name="enableSubPackages" value="true"/> | ||
43 | + </javaClientGenerator> | ||
44 | + <!-- 要生成的表 tableName是数据库中的表名或视图名 domainObjectName是实体类名--> | ||
45 | + <table tableName="T_ETL_MESSAGE" domainObjectName="T_ETL_MESSAGE" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table> | ||
46 | + </context> | ||
47 | +</generatorConfiguration> |
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
3 | +<mapper namespace="com.tianbo.warehouse.dao.T_ETL_MESSAGEMapper"> | ||
4 | + <resultMap id="BaseResultMap" type="com.tianbo.warehouse.model.T_ETL_MESSAGE"> | ||
5 | + <id column="FID" jdbcType="DECIMAL" property="fid" /> | ||
6 | + <result column="OPER" jdbcType="VARCHAR" property="oper" /> | ||
7 | + <result column="SNTM" jdbcType="TIMESTAMP" property="sntm" /> | ||
8 | + <result column="SNDR" jdbcType="VARCHAR" property="sndr" /> | ||
9 | + <result column="RCVR" jdbcType="VARCHAR" property="rcvr" /> | ||
10 | + <result column="SEQN" jdbcType="VARCHAR" property="seqn" /> | ||
11 | + <result column="DDTM" jdbcType="TIMESTAMP" property="ddtm" /> | ||
12 | + <result column="TYPE" jdbcType="VARCHAR" property="type" /> | ||
13 | + <result column="STYP" jdbcType="VARCHAR" property="styp" /> | ||
14 | + <result column="TRANSID" jdbcType="VARCHAR" property="transid" /> | ||
15 | + <result column="REMARK" jdbcType="NVARCHAR" property="remark" /> | ||
16 | + <result column="OUTTM" jdbcType="TIMESTAMP" property="outtm" /> | ||
17 | + <result column="OUTFLAG" jdbcType="DECIMAL" property="outflag" /> | ||
18 | + <result column="ETLTIM" jdbcType="TIMESTAMP" property="etltim" /> | ||
19 | + <result column="ETLFLAG" jdbcType="DECIMAL" property="etlflag" /> | ||
20 | + <result column="ERRTM" jdbcType="TIMESTAMP" property="errtm" /> | ||
21 | + <result column="ERRFLAG" jdbcType="DECIMAL" property="errflag" /> | ||
22 | + <result column="ERRLOG" jdbcType="NVARCHAR" property="errlog" /> | ||
23 | + <result column="APPID" jdbcType="VARCHAR" property="appid" /> | ||
24 | + </resultMap> | ||
25 | + <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.tianbo.warehouse.model.T_ETL_MESSAGE"> | ||
26 | + <result column="CONTENT" jdbcType="CLOB" property="content" /> | ||
27 | + </resultMap> | ||
28 | + <sql id="Base_Column_List"> | ||
29 | + FID, OPER, SNTM, SNDR, RCVR, SEQN, DDTM, TYPE, STYP, TRANSID, REMARK, OUTTM, OUTFLAG, | ||
30 | + ETLTIM, ETLFLAG, ERRTM, ERRFLAG, ERRLOG, APPID | ||
31 | + </sql> | ||
32 | + <sql id="Blob_Column_List"> | ||
33 | + CONTENT | ||
34 | + </sql> | ||
35 | + <select id="selectByPrimaryKey" parameterType="java.math.BigDecimal" resultMap="ResultMapWithBLOBs"> | ||
36 | + select | ||
37 | + <include refid="Base_Column_List" /> | ||
38 | + , | ||
39 | + <include refid="Blob_Column_List" /> | ||
40 | + from T_ETL_MESSAGE | ||
41 | + where FID = #{fid,jdbcType=DECIMAL} | ||
42 | + </select> | ||
43 | + <delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal"> | ||
44 | + delete from T_ETL_MESSAGE | ||
45 | + where FID = #{fid,jdbcType=DECIMAL} | ||
46 | + </delete> | ||
47 | + <insert id="insert" parameterType="com.tianbo.warehouse.model.T_ETL_MESSAGE"> | ||
48 | + insert into T_ETL_MESSAGE (FID, OPER, SNTM, | ||
49 | + SNDR, RCVR, SEQN, DDTM, | ||
50 | + TYPE, STYP, TRANSID, | ||
51 | + REMARK, OUTTM, OUTFLAG, | ||
52 | + ETLTIM, ETLFLAG, ERRTM, | ||
53 | + ERRFLAG, ERRLOG, APPID, | ||
54 | + CONTENT) | ||
55 | + values (#{fid,jdbcType=DECIMAL}, #{oper,jdbcType=VARCHAR}, #{sntm,jdbcType=TIMESTAMP}, | ||
56 | + #{sndr,jdbcType=VARCHAR}, #{rcvr,jdbcType=VARCHAR}, #{seqn,jdbcType=VARCHAR}, #{ddtm,jdbcType=TIMESTAMP}, | ||
57 | + #{type,jdbcType=VARCHAR}, #{styp,jdbcType=VARCHAR}, #{transid,jdbcType=VARCHAR}, | ||
58 | + #{remark,jdbcType=NVARCHAR}, #{outtm,jdbcType=TIMESTAMP}, #{outflag,jdbcType=DECIMAL}, | ||
59 | + #{etltim,jdbcType=TIMESTAMP}, #{etlflag,jdbcType=DECIMAL}, #{errtm,jdbcType=TIMESTAMP}, | ||
60 | + #{errflag,jdbcType=DECIMAL}, #{errlog,jdbcType=NVARCHAR}, #{appid,jdbcType=VARCHAR}, | ||
61 | + #{content,jdbcType=CLOB}) | ||
62 | + </insert> | ||
63 | + <insert id="insertSelective" parameterType="com.tianbo.warehouse.model.T_ETL_MESSAGE"> | ||
64 | + insert into T_ETL_MESSAGE | ||
65 | + <trim prefix="(" suffix=")" suffixOverrides=","> | ||
66 | + <if test="fid != null"> | ||
67 | + FID, | ||
68 | + </if> | ||
69 | + <if test="oper != null"> | ||
70 | + OPER, | ||
71 | + </if> | ||
72 | + <if test="sntm != null"> | ||
73 | + SNTM, | ||
74 | + </if> | ||
75 | + <if test="sndr != null"> | ||
76 | + SNDR, | ||
77 | + </if> | ||
78 | + <if test="rcvr != null"> | ||
79 | + RCVR, | ||
80 | + </if> | ||
81 | + <if test="seqn != null"> | ||
82 | + SEQN, | ||
83 | + </if> | ||
84 | + <if test="ddtm != null"> | ||
85 | + DDTM, | ||
86 | + </if> | ||
87 | + <if test="type != null"> | ||
88 | + TYPE, | ||
89 | + </if> | ||
90 | + <if test="styp != null"> | ||
91 | + STYP, | ||
92 | + </if> | ||
93 | + <if test="transid != null"> | ||
94 | + TRANSID, | ||
95 | + </if> | ||
96 | + <if test="remark != null"> | ||
97 | + REMARK, | ||
98 | + </if> | ||
99 | + <if test="outtm != null"> | ||
100 | + OUTTM, | ||
101 | + </if> | ||
102 | + <if test="outflag != null"> | ||
103 | + OUTFLAG, | ||
104 | + </if> | ||
105 | + <if test="etltim != null"> | ||
106 | + ETLTIM, | ||
107 | + </if> | ||
108 | + <if test="etlflag != null"> | ||
109 | + ETLFLAG, | ||
110 | + </if> | ||
111 | + <if test="errtm != null"> | ||
112 | + ERRTM, | ||
113 | + </if> | ||
114 | + <if test="errflag != null"> | ||
115 | + ERRFLAG, | ||
116 | + </if> | ||
117 | + <if test="errlog != null"> | ||
118 | + ERRLOG, | ||
119 | + </if> | ||
120 | + <if test="appid != null"> | ||
121 | + APPID, | ||
122 | + </if> | ||
123 | + <if test="content != null"> | ||
124 | + CONTENT, | ||
125 | + </if> | ||
126 | + </trim> | ||
127 | + <trim prefix="values (" suffix=")" suffixOverrides=","> | ||
128 | + <if test="fid != null"> | ||
129 | + #{fid,jdbcType=DECIMAL}, | ||
130 | + </if> | ||
131 | + <if test="oper != null"> | ||
132 | + #{oper,jdbcType=VARCHAR}, | ||
133 | + </if> | ||
134 | + <if test="sntm != null"> | ||
135 | + #{sntm,jdbcType=TIMESTAMP}, | ||
136 | + </if> | ||
137 | + <if test="sndr != null"> | ||
138 | + #{sndr,jdbcType=VARCHAR}, | ||
139 | + </if> | ||
140 | + <if test="rcvr != null"> | ||
141 | + #{rcvr,jdbcType=VARCHAR}, | ||
142 | + </if> | ||
143 | + <if test="seqn != null"> | ||
144 | + #{seqn,jdbcType=VARCHAR}, | ||
145 | + </if> | ||
146 | + <if test="ddtm != null"> | ||
147 | + #{ddtm,jdbcType=TIMESTAMP}, | ||
148 | + </if> | ||
149 | + <if test="type != null"> | ||
150 | + #{type,jdbcType=VARCHAR}, | ||
151 | + </if> | ||
152 | + <if test="styp != null"> | ||
153 | + #{styp,jdbcType=VARCHAR}, | ||
154 | + </if> | ||
155 | + <if test="transid != null"> | ||
156 | + #{transid,jdbcType=VARCHAR}, | ||
157 | + </if> | ||
158 | + <if test="remark != null"> | ||
159 | + #{remark,jdbcType=OTHER}, | ||
160 | + </if> | ||
161 | + <if test="outtm != null"> | ||
162 | + #{outtm,jdbcType=TIMESTAMP}, | ||
163 | + </if> | ||
164 | + <if test="outflag != null"> | ||
165 | + #{outflag,jdbcType=DECIMAL}, | ||
166 | + </if> | ||
167 | + <if test="etltim != null"> | ||
168 | + #{etltim,jdbcType=TIMESTAMP}, | ||
169 | + </if> | ||
170 | + <if test="etlflag != null"> | ||
171 | + #{etlflag,jdbcType=DECIMAL}, | ||
172 | + </if> | ||
173 | + <if test="errtm != null"> | ||
174 | + #{errtm,jdbcType=TIMESTAMP}, | ||
175 | + </if> | ||
176 | + <if test="errflag != null"> | ||
177 | + #{errflag,jdbcType=DECIMAL}, | ||
178 | + </if> | ||
179 | + <if test="errlog != null"> | ||
180 | + #{errlog,jdbcType=OTHER}, | ||
181 | + </if> | ||
182 | + <if test="appid != null"> | ||
183 | + #{appid,jdbcType=VARCHAR}, | ||
184 | + </if> | ||
185 | + <if test="content != null"> | ||
186 | + #{content,jdbcType=CLOB}, | ||
187 | + </if> | ||
188 | + </trim> | ||
189 | + </insert> | ||
190 | + <update id="updateByPrimaryKeySelective" parameterType="com.tianbo.warehouse.model.T_ETL_MESSAGE"> | ||
191 | + update T_ETL_MESSAGE | ||
192 | + <set> | ||
193 | + <if test="oper != null"> | ||
194 | + OPER = #{oper,jdbcType=VARCHAR}, | ||
195 | + </if> | ||
196 | + <if test="sntm != null"> | ||
197 | + SNTM = #{sntm,jdbcType=TIMESTAMP}, | ||
198 | + </if> | ||
199 | + <if test="sndr != null"> | ||
200 | + SNDR = #{sndr,jdbcType=VARCHAR}, | ||
201 | + </if> | ||
202 | + <if test="rcvr != null"> | ||
203 | + RCVR = #{rcvr,jdbcType=VARCHAR}, | ||
204 | + </if> | ||
205 | + <if test="seqn != null"> | ||
206 | + SEQN = #{seqn,jdbcType=VARCHAR}, | ||
207 | + </if> | ||
208 | + <if test="ddtm != null"> | ||
209 | + DDTM = #{ddtm,jdbcType=TIMESTAMP}, | ||
210 | + </if> | ||
211 | + <if test="type != null"> | ||
212 | + TYPE = #{type,jdbcType=VARCHAR}, | ||
213 | + </if> | ||
214 | + <if test="styp != null"> | ||
215 | + STYP = #{styp,jdbcType=VARCHAR}, | ||
216 | + </if> | ||
217 | + <if test="transid != null"> | ||
218 | + TRANSID = #{transid,jdbcType=VARCHAR}, | ||
219 | + </if> | ||
220 | + <if test="remark != null"> | ||
221 | + REMARK = #{remark,jdbcType=OTHER}, | ||
222 | + </if> | ||
223 | + <if test="outtm != null"> | ||
224 | + OUTTM = #{outtm,jdbcType=TIMESTAMP}, | ||
225 | + </if> | ||
226 | + <if test="outflag != null"> | ||
227 | + OUTFLAG = #{outflag,jdbcType=DECIMAL}, | ||
228 | + </if> | ||
229 | + <if test="etltim != null"> | ||
230 | + ETLTIM = #{etltim,jdbcType=TIMESTAMP}, | ||
231 | + </if> | ||
232 | + <if test="etlflag != null"> | ||
233 | + ETLFLAG = #{etlflag,jdbcType=DECIMAL}, | ||
234 | + </if> | ||
235 | + <if test="errtm != null"> | ||
236 | + ERRTM = #{errtm,jdbcType=TIMESTAMP}, | ||
237 | + </if> | ||
238 | + <if test="errflag != null"> | ||
239 | + ERRFLAG = #{errflag,jdbcType=DECIMAL}, | ||
240 | + </if> | ||
241 | + <if test="errlog != null"> | ||
242 | + ERRLOG = #{errlog,jdbcType=OTHER}, | ||
243 | + </if> | ||
244 | + <if test="appid != null"> | ||
245 | + APPID = #{appid,jdbcType=VARCHAR}, | ||
246 | + </if> | ||
247 | + <if test="content != null"> | ||
248 | + CONTENT = #{content,jdbcType=CLOB}, | ||
249 | + </if> | ||
250 | + </set> | ||
251 | + where FID = #{fid,jdbcType=DECIMAL} | ||
252 | + </update> | ||
253 | + <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.tianbo.warehouse.model.T_ETL_MESSAGE"> | ||
254 | + update T_ETL_MESSAGE | ||
255 | + set OPER = #{oper,jdbcType=VARCHAR}, | ||
256 | + SNTM = #{sntm,jdbcType=TIMESTAMP}, | ||
257 | + SNDR = #{sndr,jdbcType=VARCHAR}, | ||
258 | + RCVR = #{rcvr,jdbcType=VARCHAR}, | ||
259 | + SEQN = #{seqn,jdbcType=VARCHAR}, | ||
260 | + DDTM = #{ddtm,jdbcType=TIMESTAMP}, | ||
261 | + TYPE = #{type,jdbcType=VARCHAR}, | ||
262 | + STYP = #{styp,jdbcType=VARCHAR}, | ||
263 | + TRANSID = #{transid,jdbcType=VARCHAR}, | ||
264 | + REMARK = #{remark,jdbcType=OTHER}, | ||
265 | + OUTTM = #{outtm,jdbcType=TIMESTAMP}, | ||
266 | + OUTFLAG = #{outflag,jdbcType=DECIMAL}, | ||
267 | + ETLTIM = #{etltim,jdbcType=TIMESTAMP}, | ||
268 | + ETLFLAG = #{etlflag,jdbcType=DECIMAL}, | ||
269 | + ERRTM = #{errtm,jdbcType=TIMESTAMP}, | ||
270 | + ERRFLAG = #{errflag,jdbcType=DECIMAL}, | ||
271 | + ERRLOG = #{errlog,jdbcType=OTHER}, | ||
272 | + APPID = #{appid,jdbcType=VARCHAR}, | ||
273 | + CONTENT = #{content,jdbcType=CLOB} | ||
274 | + where FID = #{fid,jdbcType=DECIMAL} | ||
275 | + </update> | ||
276 | + <update id="updateByPrimaryKey" parameterType="com.tianbo.warehouse.model.T_ETL_MESSAGE"> | ||
277 | + update T_ETL_MESSAGE | ||
278 | + set OPER = #{oper,jdbcType=VARCHAR}, | ||
279 | + SNTM = #{sntm,jdbcType=TIMESTAMP}, | ||
280 | + SNDR = #{sndr,jdbcType=VARCHAR}, | ||
281 | + RCVR = #{rcvr,jdbcType=VARCHAR}, | ||
282 | + SEQN = #{seqn,jdbcType=VARCHAR}, | ||
283 | + DDTM = #{ddtm,jdbcType=TIMESTAMP}, | ||
284 | + TYPE = #{type,jdbcType=VARCHAR}, | ||
285 | + STYP = #{styp,jdbcType=VARCHAR}, | ||
286 | + TRANSID = #{transid,jdbcType=VARCHAR}, | ||
287 | + REMARK = #{remark,jdbcType=OTHER}, | ||
288 | + OUTTM = #{outtm,jdbcType=TIMESTAMP}, | ||
289 | + OUTFLAG = #{outflag,jdbcType=DECIMAL}, | ||
290 | + ETLTIM = #{etltim,jdbcType=TIMESTAMP}, | ||
291 | + ETLFLAG = #{etlflag,jdbcType=DECIMAL}, | ||
292 | + ERRTM = #{errtm,jdbcType=TIMESTAMP}, | ||
293 | + ERRFLAG = #{errflag,jdbcType=DECIMAL}, | ||
294 | + ERRLOG = #{errlog,jdbcType=OTHER}, | ||
295 | + APPID = #{appid,jdbcType=VARCHAR} | ||
296 | + where FID = #{fid,jdbcType=DECIMAL} | ||
297 | + </update> | ||
298 | + | ||
299 | +</mapper> |
-
请 注册 或 登录 后发表评论