mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-11-27 10:00:57 +00:00
Add Korea business area code checker example
Refactored korea_business_areacode.json to include metadata and expanded area code data. Added korea_biz_area_checker.js example script to read Excel files and match business numbers to area names using the updated area code data.
This commit is contained in:
parent
f86ea078c6
commit
d156e40e6b
|
|
@ -1,173 +1,231 @@
|
|||
{
|
||||
"seoul": [
|
||||
100,
|
||||
101,
|
||||
104,
|
||||
105,
|
||||
106,
|
||||
107,
|
||||
108,
|
||||
109,
|
||||
110,
|
||||
113,
|
||||
114,
|
||||
117,
|
||||
119,
|
||||
120,
|
||||
145,
|
||||
146,
|
||||
147,
|
||||
201,
|
||||
204,
|
||||
206,
|
||||
209,
|
||||
210,
|
||||
211,
|
||||
212,
|
||||
214,
|
||||
215,
|
||||
217,
|
||||
220,
|
||||
230
|
||||
],
|
||||
"incheon": [
|
||||
121,
|
||||
122,
|
||||
131,
|
||||
137,
|
||||
150,
|
||||
234,
|
||||
800
|
||||
],
|
||||
"busan": [
|
||||
600,
|
||||
602,
|
||||
603,
|
||||
605,
|
||||
606,
|
||||
607,
|
||||
617,
|
||||
621,
|
||||
623
|
||||
],
|
||||
"daegu": [
|
||||
500,
|
||||
502,
|
||||
503,
|
||||
504,
|
||||
514,
|
||||
516
|
||||
],
|
||||
"gwangju": [
|
||||
400,
|
||||
408,
|
||||
409,
|
||||
410,
|
||||
419
|
||||
],
|
||||
"daejeon": [
|
||||
300,
|
||||
305,
|
||||
314,
|
||||
318
|
||||
],
|
||||
"ulsan": [
|
||||
610,
|
||||
620
|
||||
],
|
||||
"sejong": [
|
||||
320
|
||||
],
|
||||
"gyeonggi": [
|
||||
123,
|
||||
124,
|
||||
125,
|
||||
126,
|
||||
127,
|
||||
128,
|
||||
129,
|
||||
130,
|
||||
132,
|
||||
134,
|
||||
135,
|
||||
138,
|
||||
140,
|
||||
141,
|
||||
142,
|
||||
143,
|
||||
144,
|
||||
149,
|
||||
151,
|
||||
152,
|
||||
200,
|
||||
231,
|
||||
232,
|
||||
233,
|
||||
235,
|
||||
236
|
||||
],
|
||||
"gangwon": [
|
||||
221,
|
||||
222,
|
||||
223,
|
||||
224,
|
||||
225,
|
||||
226,
|
||||
227
|
||||
],
|
||||
"chungbuk": [
|
||||
301,
|
||||
302,
|
||||
303,
|
||||
304,
|
||||
317
|
||||
],
|
||||
"chungnam": [
|
||||
307,
|
||||
308,
|
||||
310,
|
||||
311,
|
||||
312,
|
||||
313,
|
||||
316,
|
||||
319
|
||||
],
|
||||
"jeonbuk": [
|
||||
401,
|
||||
402,
|
||||
403,
|
||||
404,
|
||||
407,
|
||||
418
|
||||
],
|
||||
"jeonnam": [
|
||||
411,
|
||||
412,
|
||||
415,
|
||||
416,
|
||||
417
|
||||
],
|
||||
"gyeongbuk": [
|
||||
505,
|
||||
506,
|
||||
507,
|
||||
508,
|
||||
510,
|
||||
511,
|
||||
512,
|
||||
513,
|
||||
515
|
||||
],
|
||||
"gyeongnam": [
|
||||
608,
|
||||
609,
|
||||
611,
|
||||
612,
|
||||
613,
|
||||
615,
|
||||
624
|
||||
],
|
||||
"jeju": [
|
||||
616
|
||||
]
|
||||
"title": "Korea Business Number Area Code",
|
||||
"author": "Namhyeon Go <gnh1201@catswords.re.kr>, WelsonJS OSS team",
|
||||
"website": "https://github.com/gnh1201/welsonjs",
|
||||
"created_on": "2025-11-19",
|
||||
"data": {
|
||||
"seoul": [
|
||||
100,
|
||||
101,
|
||||
104,
|
||||
105,
|
||||
106,
|
||||
107,
|
||||
108,
|
||||
109,
|
||||
110,
|
||||
113,
|
||||
114,
|
||||
117,
|
||||
119,
|
||||
120,
|
||||
145,
|
||||
146,
|
||||
147,
|
||||
201,
|
||||
204,
|
||||
206,
|
||||
209,
|
||||
210,
|
||||
211,
|
||||
212,
|
||||
214,
|
||||
215,
|
||||
217,
|
||||
220,
|
||||
230
|
||||
],
|
||||
"incheon": [
|
||||
121,
|
||||
122,
|
||||
131,
|
||||
137,
|
||||
150,
|
||||
234,
|
||||
800
|
||||
],
|
||||
"busan": [
|
||||
600,
|
||||
602,
|
||||
603,
|
||||
605,
|
||||
606,
|
||||
607,
|
||||
617,
|
||||
621,
|
||||
623
|
||||
],
|
||||
"daegu": [
|
||||
500,
|
||||
502,
|
||||
503,
|
||||
504,
|
||||
514,
|
||||
516
|
||||
],
|
||||
"gwangju": [
|
||||
400,
|
||||
408,
|
||||
409,
|
||||
410,
|
||||
419
|
||||
],
|
||||
"daejeon": [
|
||||
300,
|
||||
305,
|
||||
314,
|
||||
318
|
||||
],
|
||||
"ulsan": [
|
||||
610,
|
||||
620
|
||||
],
|
||||
"sejong": [
|
||||
320
|
||||
],
|
||||
"gyeonggi": [
|
||||
123,
|
||||
124,
|
||||
125,
|
||||
126,
|
||||
127,
|
||||
128,
|
||||
129,
|
||||
130,
|
||||
132,
|
||||
134,
|
||||
135,
|
||||
138,
|
||||
140,
|
||||
141,
|
||||
142,
|
||||
143,
|
||||
144,
|
||||
149,
|
||||
151,
|
||||
152,
|
||||
200,
|
||||
231,
|
||||
232,
|
||||
233,
|
||||
235,
|
||||
236
|
||||
],
|
||||
"gangwon": [
|
||||
221,
|
||||
222,
|
||||
223,
|
||||
224,
|
||||
225,
|
||||
226,
|
||||
227
|
||||
],
|
||||
"chungbuk": [
|
||||
301,
|
||||
302,
|
||||
303,
|
||||
304,
|
||||
317
|
||||
],
|
||||
"chungnam": [
|
||||
307,
|
||||
308,
|
||||
310,
|
||||
311,
|
||||
312,
|
||||
313,
|
||||
316,
|
||||
319
|
||||
],
|
||||
"jeonbuk": [
|
||||
401,
|
||||
402,
|
||||
403,
|
||||
404,
|
||||
407,
|
||||
418
|
||||
],
|
||||
"jeonnam": [
|
||||
411,
|
||||
412,
|
||||
415,
|
||||
416,
|
||||
417
|
||||
],
|
||||
"gyeongbuk": [
|
||||
505,
|
||||
506,
|
||||
507,
|
||||
508,
|
||||
510,
|
||||
511,
|
||||
512,
|
||||
513,
|
||||
515
|
||||
],
|
||||
"gyeongnam": [
|
||||
608,
|
||||
609,
|
||||
611,
|
||||
612,
|
||||
613,
|
||||
615,
|
||||
624
|
||||
],
|
||||
"jeju": [
|
||||
616
|
||||
],
|
||||
"p_seoul": [
|
||||
116,
|
||||
775
|
||||
],
|
||||
"p_incheon": [
|
||||
172,
|
||||
139
|
||||
],
|
||||
"p_gyeonggi": [
|
||||
696,
|
||||
276,
|
||||
585,
|
||||
133,
|
||||
687,
|
||||
509,
|
||||
581,
|
||||
557,
|
||||
405,
|
||||
727,
|
||||
514,
|
||||
371
|
||||
],
|
||||
"p_busan": [
|
||||
825,
|
||||
644,
|
||||
449
|
||||
],
|
||||
"p_daejeon": [
|
||||
306
|
||||
],
|
||||
"p_sejong": [
|
||||
330,
|
||||
698
|
||||
],
|
||||
"p_gwangju": [
|
||||
256
|
||||
],
|
||||
"p_gyeongbuk": [
|
||||
568
|
||||
],
|
||||
"p_chungnam": [
|
||||
709,
|
||||
294
|
||||
],
|
||||
"p_chungbuk": [
|
||||
203,
|
||||
136
|
||||
],
|
||||
"p_jeonbuk": [
|
||||
586,
|
||||
704
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
57
examples/korea_biz_area_checker.js
Normal file
57
examples/korea_biz_area_checker.js
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
// korea_biz_area_checker.js
|
||||
// Namhyeon Go <gnh1201@catswords.re.kr>, WelsonJS OSS team
|
||||
// https://github.com/gnh1201/welsonjs
|
||||
//
|
||||
var FILE = require("lib/file");
|
||||
var Office = require("lib/msoffice");
|
||||
|
||||
function main(args) {
|
||||
// Business Area Code in Korea
|
||||
console.log("> Business Area Code in Korea");
|
||||
var data_biz_areacode = JSON.parse(FILE.readFile("data/korea_business_areacode.json")).data;
|
||||
console.log(JSON.stringify(data_biz_areacode));
|
||||
|
||||
// Open the Microsoft Excel file
|
||||
console.log("> Open the Microsoft Excel file");
|
||||
var excel = new Office.Excel();
|
||||
excel.open("data\\example.xlsx");
|
||||
|
||||
// Retrieve the business area code
|
||||
for (var i = 3; i < 1233; i++) {
|
||||
try {
|
||||
// check the biz area name
|
||||
console.log(">> check the biz area name");
|
||||
var areaname = excel.getCellByPosition(i, 16).getValue();
|
||||
if (!!areaname)
|
||||
continue;
|
||||
|
||||
// check the biz number
|
||||
console.log(">> check the biz number");
|
||||
var biznumber = excel.getCellByPosition(i, 8).getValue();
|
||||
if (!biznumber)
|
||||
continue;
|
||||
|
||||
// match the biznumber to biz area code data
|
||||
console.log(">> match the biznumber to biz area code data: " + biznumber);
|
||||
var matched_areaname = "unknown";
|
||||
for (var k in data_biz_areacode) {
|
||||
var areacode = parseInt(biznumber.substring(0, 3));
|
||||
if (data_biz_areacode[k].indexOf(areacode) > -1) {
|
||||
matched_areaname = k;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
console.log(">> write the matched area name: " + matched_areaname);
|
||||
excel.getCellByPosition(i, 16).setValue(matched_areaname);
|
||||
} catch (e) {
|
||||
excel.getCellByPosition(i, 16).setValue("unknown");
|
||||
}
|
||||
}
|
||||
|
||||
excel.saveAs("example_edited.xlsx");
|
||||
|
||||
excel.close();
|
||||
}
|
||||
|
||||
exports.main = main;
|
||||
Loading…
Reference in New Issue
Block a user