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": [
|
"title": "Korea Business Number Area Code",
|
||||||
100,
|
"author": "Namhyeon Go <gnh1201@catswords.re.kr>, WelsonJS OSS team",
|
||||||
101,
|
"website": "https://github.com/gnh1201/welsonjs",
|
||||||
104,
|
"created_on": "2025-11-19",
|
||||||
105,
|
"data": {
|
||||||
106,
|
"seoul": [
|
||||||
107,
|
100,
|
||||||
108,
|
101,
|
||||||
109,
|
104,
|
||||||
110,
|
105,
|
||||||
113,
|
106,
|
||||||
114,
|
107,
|
||||||
117,
|
108,
|
||||||
119,
|
109,
|
||||||
120,
|
110,
|
||||||
145,
|
113,
|
||||||
146,
|
114,
|
||||||
147,
|
117,
|
||||||
201,
|
119,
|
||||||
204,
|
120,
|
||||||
206,
|
145,
|
||||||
209,
|
146,
|
||||||
210,
|
147,
|
||||||
211,
|
201,
|
||||||
212,
|
204,
|
||||||
214,
|
206,
|
||||||
215,
|
209,
|
||||||
217,
|
210,
|
||||||
220,
|
211,
|
||||||
230
|
212,
|
||||||
],
|
214,
|
||||||
"incheon": [
|
215,
|
||||||
121,
|
217,
|
||||||
122,
|
220,
|
||||||
131,
|
230
|
||||||
137,
|
],
|
||||||
150,
|
"incheon": [
|
||||||
234,
|
121,
|
||||||
800
|
122,
|
||||||
],
|
131,
|
||||||
"busan": [
|
137,
|
||||||
600,
|
150,
|
||||||
602,
|
234,
|
||||||
603,
|
800
|
||||||
605,
|
],
|
||||||
606,
|
"busan": [
|
||||||
607,
|
600,
|
||||||
617,
|
602,
|
||||||
621,
|
603,
|
||||||
623
|
605,
|
||||||
],
|
606,
|
||||||
"daegu": [
|
607,
|
||||||
500,
|
617,
|
||||||
502,
|
621,
|
||||||
503,
|
623
|
||||||
504,
|
],
|
||||||
514,
|
"daegu": [
|
||||||
516
|
500,
|
||||||
],
|
502,
|
||||||
"gwangju": [
|
503,
|
||||||
400,
|
504,
|
||||||
408,
|
514,
|
||||||
409,
|
516
|
||||||
410,
|
],
|
||||||
419
|
"gwangju": [
|
||||||
],
|
400,
|
||||||
"daejeon": [
|
408,
|
||||||
300,
|
409,
|
||||||
305,
|
410,
|
||||||
314,
|
419
|
||||||
318
|
],
|
||||||
],
|
"daejeon": [
|
||||||
"ulsan": [
|
300,
|
||||||
610,
|
305,
|
||||||
620
|
314,
|
||||||
],
|
318
|
||||||
"sejong": [
|
],
|
||||||
320
|
"ulsan": [
|
||||||
],
|
610,
|
||||||
"gyeonggi": [
|
620
|
||||||
123,
|
],
|
||||||
124,
|
"sejong": [
|
||||||
125,
|
320
|
||||||
126,
|
],
|
||||||
127,
|
"gyeonggi": [
|
||||||
128,
|
123,
|
||||||
129,
|
124,
|
||||||
130,
|
125,
|
||||||
132,
|
126,
|
||||||
134,
|
127,
|
||||||
135,
|
128,
|
||||||
138,
|
129,
|
||||||
140,
|
130,
|
||||||
141,
|
132,
|
||||||
142,
|
134,
|
||||||
143,
|
135,
|
||||||
144,
|
138,
|
||||||
149,
|
140,
|
||||||
151,
|
141,
|
||||||
152,
|
142,
|
||||||
200,
|
143,
|
||||||
231,
|
144,
|
||||||
232,
|
149,
|
||||||
233,
|
151,
|
||||||
235,
|
152,
|
||||||
236
|
200,
|
||||||
],
|
231,
|
||||||
"gangwon": [
|
232,
|
||||||
221,
|
233,
|
||||||
222,
|
235,
|
||||||
223,
|
236
|
||||||
224,
|
],
|
||||||
225,
|
"gangwon": [
|
||||||
226,
|
221,
|
||||||
227
|
222,
|
||||||
],
|
223,
|
||||||
"chungbuk": [
|
224,
|
||||||
301,
|
225,
|
||||||
302,
|
226,
|
||||||
303,
|
227
|
||||||
304,
|
],
|
||||||
317
|
"chungbuk": [
|
||||||
],
|
301,
|
||||||
"chungnam": [
|
302,
|
||||||
307,
|
303,
|
||||||
308,
|
304,
|
||||||
310,
|
317
|
||||||
311,
|
],
|
||||||
312,
|
"chungnam": [
|
||||||
313,
|
307,
|
||||||
316,
|
308,
|
||||||
319
|
310,
|
||||||
],
|
311,
|
||||||
"jeonbuk": [
|
312,
|
||||||
401,
|
313,
|
||||||
402,
|
316,
|
||||||
403,
|
319
|
||||||
404,
|
],
|
||||||
407,
|
"jeonbuk": [
|
||||||
418
|
401,
|
||||||
],
|
402,
|
||||||
"jeonnam": [
|
403,
|
||||||
411,
|
404,
|
||||||
412,
|
407,
|
||||||
415,
|
418
|
||||||
416,
|
],
|
||||||
417
|
"jeonnam": [
|
||||||
],
|
411,
|
||||||
"gyeongbuk": [
|
412,
|
||||||
505,
|
415,
|
||||||
506,
|
416,
|
||||||
507,
|
417
|
||||||
508,
|
],
|
||||||
510,
|
"gyeongbuk": [
|
||||||
511,
|
505,
|
||||||
512,
|
506,
|
||||||
513,
|
507,
|
||||||
515
|
508,
|
||||||
],
|
510,
|
||||||
"gyeongnam": [
|
511,
|
||||||
608,
|
512,
|
||||||
609,
|
513,
|
||||||
611,
|
515
|
||||||
612,
|
],
|
||||||
613,
|
"gyeongnam": [
|
||||||
615,
|
608,
|
||||||
624
|
609,
|
||||||
],
|
611,
|
||||||
"jeju": [
|
612,
|
||||||
616
|
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