本文提供:
1.企業分類數據
2.此類用于吧文本 數據變成 sql 并插入數據庫
import
?java.io.BufferedReader;
import
?java.io.FileInputStream;
import
?java.io.IOException;
import
?java.io.InputStreamReader;
import
?java.util.regex.Matcher;
import
?java.util.regex.Pattern;
//
insert?into?industry?(id,name,fid,language)?values(1,'--工?業?品--',null,0);
public
?
class
?FileMain?{
????
public
?
static
?
void
?main(String[]?args)?
throws
?IOException?{
????????
????????String?filePath?
=
?
"
t.txt
"
;
????????Pattern?pattern?
=
?Pattern.compile(
"
^[0-9]+\\.(.+)
"
);
????????
????????InputStreamReader?read?
=
?
new
?InputStreamReader(
????????????????
new
?FileInputStream(
????????????????????????FileMain.
class
.getClassLoader().getResource(filePath).getPath()
????????????????????????),
"
UTF-8
"
????????);
????????
????????StringBuffer?buffer?
=
?
new
?StringBuffer();
????????
????????
????????BufferedReader?reader?
=
?
new
?BufferedReader(read);
????????String?stmp?
=
?
null
;
????????
int
?titleii?
=
?
0
?;
????????
while
(??(stmp?
=
?reader.readLine())
!=
null
?
&&
?
!
stmp.trim().equals(
""
)??){
????????????Matcher?matcher?
=
?pattern.matcher(stmp)?;
????????????
if
(?matcher.find()){
????????????????titleii
++
?;
????????????????buffer.append(
"
\n\n
"
);
????????????????buffer.append(getIndustryInsertSql(titleii
+
""
,matcher.group(
1
),
"
null
"
,
"
0
"
));
?????????????????????
while
(???(stmp?
=
?reader.readLine())
!=
null
?
&&
?
!
stmp.trim().equals(
""
)??
&&
?????????????????????????????????????
!
pattern.matcher(stmp).find()?){
?????????????????????????
int
?cii?
=
?
0
?;
?????????????????????????
for
(String?csql?:?stmp.split(
"
\\|
"
)){
?????????????????????????????
if
(csql
!=
null
?
&&
?
!
csql.trim().equals(
""
))
?????????????????????????????????buffer.append(getIndustryInsertSql(?(titleii
+
10000
)
+
""
+
(
++
cii)?,csql.trim(),titleii
+
""
,
"
0
"
));
?????????????????????????}
?????????????????????}
????????????}
????????}
????????
????????System.out.println(?buffer?);
????}
????
????
????
public
?
static
?String?getIndustryInsertSql(String?id,String?name,String?fid,String?language){
????????String?sqlt?
=
?
"
insert?into?industry?(id,name,fid,language)?values(:id,':name',:fid,:language);\n
"
;
????????sqlt?
=
?sqlt.replaceAll(
"
:id
"
,?id);
????????sqlt?
=
?sqlt.replaceAll(
"
:name
"
,?name);
????????sqlt?
=
?sqlt.replaceAll(
"
:fid
"
,?fid);
????????sqlt?
=
?sqlt.replaceAll(
"
:language
"
,language);
????????
????????
return
?sqlt?;
????}
????
????
}
1
.旅游?餐飲?娛樂?休閑?購物
浴場?
|
?休閑娛樂?
|
?旅游、賓館?
|
?餐飲?
|
?體育、休閑運動?
|
?寵物、花鳥?
|
?文化藝術?
|
?購物?
|
?體育、文娛用品?
|
?酒店、廚房設備用品
2
.機械設備、通用零部件
鍋爐?
|
?機床?
|
?機械機器設備?
|
?通用機械設備?
|
?專用機械設備?
|
?泵業?
|
?動力、節能設備?
|
?熱力工程設備?
|
?機電設備?
|
?通用零部件業?
|
?非標設備及零部件
3
.日常服務
監督、投訴及熱線電話?
|
?水、電、煤?
|
?日常服務?
|
?美發美容、浴室?
|
?商務、清洗服務?
|
?家政家教、老年服務?
|
?閑置物品調劑回收
4
.紡織?皮革?服裝?鞋帽?
紡織印染?
|
?皮革、毛皮、羽絨制品?
|
?服裝?
|
?鞋帽
5
.家具?生活用品?食品
照相、攝像器材?
|
?凈水及設備?
|
?家具?木制品?居家飾品?
|
?日用品、日用雜品?
|
?日用化工?
|
?日用電器?
|
?自行車、縫紉機?
|
?食品、煙、酒?
|
?副食品、糧油
6
.通信?郵政?計算機?網絡?
通信?
|
?郵政?
|
?通訊設備?
|
?電子計算機?
|
?互聯網信息及技術服務
7
.醫療保健?社會福利
福利?
|
?殯葬業?
|
?醫療衛生事業?
|
?醫藥?
|
?保健品?
|
?衛生、醫療及康復器材
8
.電子電器?儀器儀表?
電池、充電器?
|
?廣播、影視、音響設備及器材?
|
?防靜電、防雷、防爆及弱電工程及設備?
|
?衡量器?
|
?電器設備?
|
?電子設備、材料及器件?
|
?電工器材?
|
?照明器具?
|
?自動化設備?
|
?儀器儀表
9
.金融?保險?證券?投資
保險?
|
?證券期貨?
|
?開發區?
|
?金融?
|
?金融投資?
|
?外事服務、國際勞務?
|
?商(企)業駐在機構
10
.交通物流?運輸設備?
城市公共交通?
|
?交通運輸?
|
?物流業?
|
?交通運輸設備?
|
?航天航空
11
.城建?房產?建材?裝潢?
城市建設?
|
?環境保護?
|
?房地產業?
|
?建筑、安裝、裝潢業?
|
?建筑材料業?
|
?木材
12
.石油化工?橡膠塑料?
石油、石油化工?
|
?能源?
|
?化肥農藥?
|
?火工產品?
|
?橡膠、橡塑制品?
|
?塑料(塑膠)及其制品?
|
?化工原料及產品?
|
?涂料、油墨、顏料、染料?
|
?林產化工
13
.鐘表眼鏡?工藝品?禮品?
古董、收藏品?
|
?金銀珠寶、飾品?
|
?氣球、賀卡、日歷?
|
?鐘表、眼鏡?
|
?工藝品?
|
?禮品?
|
?旗篷、鏡框
14
.造紙?紙品?印刷?包裝?
造紙、紙張?
|
?紙品?
|
?印刷、制版、裝訂?
|
?印刷用品及器材?
|
?包裝
?
15
.新聞?出版?科研?教育?
新聞出版?
|
?廣播影視?
|
?音像制品、圖書銷售?
|
?科研設計?氣象地質?技術監測?
|
?高新技術?
|
?教育事業
--
---------------------------------------------------------------------
變成sql?
insert
?
into
?industry?(id,name,fid,language)?
values
(
1
,
'
旅游?餐飲?娛樂?休閑?購物
'
,
null
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100011
,
'
浴場
'
,
1
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100012
,
'
休閑娛樂
'
,
1
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100013
,
'
旅游、賓館
'
,
1
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100014
,
'
餐飲
'
,
1
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100015
,
'
體育、休閑運動
'
,
1
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100016
,
'
寵物、花鳥
'
,
1
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100017
,
'
文化藝術
'
,
1
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100018
,
'
購物
'
,
1
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100019
,
'
體育、文娛用品
'
,
1
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
1000110
,
'
酒店、廚房設備用品
'
,
1
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
2
,
'
機械設備、通用零部件
'
,
null
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100021
,
'
鍋爐
'
,
2
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100022
,
'
機床
'
,
2
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100023
,
'
機械機器設備
'
,
2
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100024
,
'
通用機械設備
'
,
2
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100025
,
'
專用機械設備
'
,
2
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100026
,
'
泵業
'
,
2
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100027
,
'
動力、節能設備
'
,
2
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100028
,
'
熱力工程設備
'
,
2
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100029
,
'
機電設備
'
,
2
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
1000210
,
'
通用零部件業
'
,
2
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
1000211
,
'
非標設備及零部件
'
,
2
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
3
,
'
日常服務
'
,
null
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100031
,
'
監督、投訴及熱線電話
'
,
3
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100032
,
'
水、電、煤
'
,
3
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100033
,
'
日常服務
'
,
3
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100034
,
'
美發美容、浴室
'
,
3
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100035
,
'
商務、清洗服務
'
,
3
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100036
,
'
家政家教、老年服務
'
,
3
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100037
,
'
閑置物品調劑回收
'
,
3
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
4
,
'
紡織?皮革?服裝?鞋帽?
'
,
null
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100041
,
'
紡織印染
'
,
4
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100042
,
'
皮革、毛皮、羽絨制品
'
,
4
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100043
,
'
服裝
'
,
4
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100044
,
'
鞋帽
'
,
4
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
5
,
'
家具?生活用品?食品
'
,
null
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100051
,
'
照相、攝像器材
'
,
5
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100052
,
'
凈水及設備
'
,
5
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100053
,
'
家具?木制品?居家飾品
'
,
5
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100054
,
'
日用品、日用雜品
'
,
5
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100055
,
'
日用化工
'
,
5
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100056
,
'
日用電器
'
,
5
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100057
,
'
自行車、縫紉機
'
,
5
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100058
,
'
食品、煙、酒
'
,
5
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100059
,
'
副食品、糧油
'
,
5
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
6
,
'
通信?郵政?計算機?網絡?
'
,
null
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100061
,
'
通信
'
,
6
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100062
,
'
郵政
'
,
6
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100063
,
'
通訊設備
'
,
6
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100064
,
'
電子計算機
'
,
6
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100065
,
'
互聯網信息及技術服務
'
,
6
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
7
,
'
醫療保健?社會福利
'
,
null
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100071
,
'
福利
'
,
7
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100072
,
'
殯葬業
'
,
7
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100073
,
'
醫療衛生事業
'
,
7
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100074
,
'
醫藥
'
,
7
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100075
,
'
保健品
'
,
7
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100076
,
'
衛生、醫療及康復器材
'
,
7
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
8
,
'
電子電器?儀器儀表?
'
,
null
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100081
,
'
電池、充電器
'
,
8
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100082
,
'
廣播、影視、音響設備及器材
'
,
8
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100083
,
'
防靜電、防雷、防爆及弱電工程及設備
'
,
8
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100084
,
'
衡量器
'
,
8
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100085
,
'
電器設備
'
,
8
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100086
,
'
電子設備、材料及器件
'
,
8
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100087
,
'
電工器材
'
,
8
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100088
,
'
照明器具
'
,
8
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100089
,
'
自動化設備
'
,
8
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
1000810
,
'
儀器儀表
'
,
8
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
9
,
'
金融?保險?證券?投資
'
,
null
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100091
,
'
保險
'
,
9
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100092
,
'
證券期貨
'
,
9
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100093
,
'
開發區
'
,
9
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100094
,
'
金融
'
,
9
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100095
,
'
金融投資
'
,
9
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100096
,
'
外事服務、國際勞務
'
,
9
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100097
,
'
商(企)業駐在機構
'
,
9
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
10
,
'
交通物流?運輸設備?
'
,
null
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100101
,
'
城市公共交通
'
,
10
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100102
,
'
交通運輸
'
,
10
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100103
,
'
物流業
'
,
10
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100104
,
'
交通運輸設備
'
,
10
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100105
,
'
航天航空
'
,
10
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
11
,
'
城建?房產?建材?裝潢?
'
,
null
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100111
,
'
城市建設
'
,
11
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100112
,
'
環境保護
'
,
11
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100113
,
'
房地產業
'
,
11
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100114
,
'
建筑、安裝、裝潢業
'
,
11
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100115
,
'
建筑材料業
'
,
11
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100116
,
'
木材
'
,
11
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
12
,
'
石油化工?橡膠塑料?
'
,
null
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100121
,
'
石油、石油化工
'
,
12
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100122
,
'
能源
'
,
12
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100123
,
'
化肥農藥
'
,
12
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100124
,
'
火工產品
'
,
12
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100125
,
'
橡膠、橡塑制品
'
,
12
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100126
,
'
塑料(塑膠)及其制品
'
,
12
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100127
,
'
化工原料及產品
'
,
12
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100128
,
'
涂料、油墨、顏料、染料
'
,
12
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100129
,
'
林產化工
'
,
12
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
13
,
'
鐘表眼鏡?工藝品?禮品?
'
,
null
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100131
,
'
古董、收藏品
'
,
13
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100132
,
'
金銀珠寶、飾品
'
,
13
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100133
,
'
氣球、賀卡、日歷
'
,
13
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100134
,
'
鐘表、眼鏡
'
,
13
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100135
,
'
工藝品
'
,
13
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100136
,
'
禮品
'
,
13
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100137
,
'
旗篷、鏡框
'
,
13
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
14
,
'
造紙?紙品?印刷?包裝?
'
,
null
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100141
,
'
造紙、紙張
'
,
14
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100142
,
'
紙品
'
,
14
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100143
,
'
印刷、制版、裝訂
'
,
14
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100144
,
'
印刷用品及器材
'
,
14
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100145
,
'
包裝
'
,
14
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
15
,
'
新聞?出版?科研?教育?
'
,
null
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100151
,
'
新聞出版
'
,
15
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100152
,
'
廣播影視
'
,
15
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100153
,
'
音像制品、圖書銷售
'
,
15
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100154
,
'
科研設計?氣象地質?技術監測
'
,
15
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100155
,
'
高新技術
'
,
15
,
0
);
insert
?
into
?industry?(id,name,fid,language)?
values
(
100156
,
'
教育事業
'
,
15
,
0
);
?
?