Commit 5890a82a by 孙香冬

no message

parent 76690a88
File added
~'pv`wIlvq'?^~'ijblkLa'?'dahlk')'ura'?'dahlk')'qjn`k'?'<5=`dd<32==2<c13465422g1g=57=g33'x)~'ijblkLa'?'p4')'ura'?'476')'qjn`k'?'=1<`a652=3647f`70737a77gf2`c`03d'xXx
\ No newline at end of file
~'pv`wIlvq'?^~'ijblkLa'?'dahlk')'ura'?'dahlk')'qjn`k'?'a00d527445f=1=g=3d75gfg5gd0=c0f5'x)~'ijblkLa'?'p4')'ura'?'476')'qjn`k'?'=1<`a652=3647f`70737a77gf2`c`03d'xXx
\ No newline at end of file
No preview for this file type
<config>
<port>9098</port>
<zcwjPath>http://192.168.0.53:9098/pdf/</zcwjPath>
</config>
\ No newline at end of file
......@@ -157,6 +157,6 @@ export function getData(req, res) {
ret['xxsj'] = {title: '表格详细数据', valueList: cjwxxTableData};
console.log("村居委");
console.log(name + "村居委");
res.send(ret);
}
\ No newline at end of file
......@@ -17,6 +17,29 @@ export async function ztsjExcelUp(req, res) {
res.send({success: true});
}
//查询机上传
export async function cxjExcelUp(req, res) {
upExcel(req, '查询机.xlsx');
res.send({success: true});
}
//创业能力上传
export async function cynlExcelUp(req, res) {
upExcel(req, '创业能力.xlsx');
res.send({success: true});
}
//DISC上传
export async function DISCExcelUp(req, res) {
upExcel(req, 'DISC.xlsx');
res.send({success: true});
}
//霍德华上传
export async function hdhExcelUp(req, res) {
upExcel(req, '职业倾向.xlsx');
res.send({success: true});
}
function upExcel(req, name) {
// let data = req.body;
......
import { gaoQiaoTableData } from "../data/table/jcsjData";
import { keyValuePackage, tablePackage } from "../dataPackage/inFrontOut";
import { getKeyValueOut, getTableOut } from "../dataPackage/out";
// 高桥
export function getData(req, res) {
let excelData = gaoQiaoTableData();
let ret:any = {};
let gqsjData = tablePackage(excelData['高桥数据'].headerList[0], excelData['高桥数据'].bodyList);
let gqsjDataList = [];
gqsjData.dataList.forEach( info => {
let {A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q} = info;
let dataList = {
UnitName: A, //公司名称
PostName: B, //岗位名称
View_Education: C,//学历要求
View_AgeRange: D,//年龄范围
View_WorkArea: E,//工作区域
Status: F,//招聘进度
RecruitmentPersonCount: G, //招聘人数
View_WorkNature: H, //工作性质
View_Salary: I, //提供月薪
View_PostDescriptionA: J, //工作内容
View_PostDescriptionB: K, //任职要求
View_PostDescriptionC: L, //工作地点
View_PostDescriptionE: M, //其他补充
WorkClass: N, //工作班时
PostCode: O, //岗位编码
Male: P == "不限" ? null : P, //男
Female: Q == "不限" ? null : Q //女
}
gqsjDataList.push(dataList);
})
ret['gqsj'] = {title: '高桥数据', titleList: gqsjData.titleList, dataList: gqsjDataList};
res.send(ret);
}
\ No newline at end of file
import { zcwjTableData } from "../data/table/jcsjData";
import { keyValuePackage } from "../dataPackage/inFrontOut";
import { getKeyValueOut } from "../dataPackage/out";
import { systemConfig } from "../config/serverConfig";
// 政策文件
\ No newline at end of file
// 政策文件
export function getData(req, res) {
let excelData = zcwjTableData();
let ret:any = {};
let zcwjData = keyValuePackage(excelData['政策文件'].dataList);
let zcwjPackageData = [];
zcwjData.forEach( info => {
let {key, value, unit} = info;
let zcwjPath = systemConfig.zcwjPath + value + "#toolbar=0";
zcwjPackageData.push({key, value: zcwjPath, unit});
})
ret['zcwj'] = getKeyValueOut('政策文件', zcwjPackageData);
res.send(ret);
}
\ No newline at end of file
import { get } from "../util/request";
export async function getData(req, res) {
let ret:any = {};
let qwData:any = await get("https://ls.sunyah.com/API/SanLin/SanLin_QueryPost.ashx", {"appid":"98092D9C-0161-4181-9522-8548A9B14BC8"});
let qwBody = qwData.body;
ret["qw"] = qwBody;
res.send(ret);
}
\ No newline at end of file
......@@ -36,10 +36,10 @@ export function getData(req, res) {
let titleList = [];
zpxxDataList.forEach( info => {
let {A, B, C, D, E} = info;
if (name == A) {
titleList = ['招聘职位', '办公地点', '工作经验', '学历要求']
zpxxPackageData.push({job: B, site: C, experience: D, education: E});
}
titleList = ['招聘职位', '办公地点', '工作经验', '学历要求']
zpxxPackageData.push({job: B, site: C, experience: D, education: E});
// if (name == A) {
// }
})
ret['zpxx'] = getTableOut('招聘信息', {titleList, dataList: zpxxPackageData});
......
......@@ -3,7 +3,10 @@ import * as fs from "fs";
import { BizError } from "../util/bizError";
import { analysisXml } from "../util/myXML";
export let port = Number(process.env.PORT) || Number(process.argv[3]) || 7576; //如果xml里面没有配置 就会使用到这里的端口
export let systemConfig = {
port:9999,
zcwjPath:''
};
const ConfigName = "serverConfig.xml";
export async function initConfig() {
......@@ -13,8 +16,9 @@ export async function initConfig() {
let configInfo:any = await analysisXml(configStr);
if (!configInfo || !configInfo.config) console.log("xml中无配置加载");
else {
let config = configInfo.config;
port = config.port[0] || port;
let {port, zcwjPath} = configInfo.config;
systemConfig.port = port[0];
systemConfig.zcwjPath = zcwjPath[0];
}
} catch(err) {
......
......@@ -35,7 +35,7 @@ function changeDataProcess(interfaceName, interfaceData, config) {
function jcsjInterfaceData() {
let jcsjinterfaceName = "基础数据";
let jcsjinterfaceName = "区网数据";
let jcsjData:any = getInterfaceByInterfaceName(jcsjinterfaceName);
/*
......
......@@ -113,3 +113,29 @@ export function zdhzqyPopTableData() {
let result = packageDataProcess(blockDataList, titltListConfig, keyValueOrTitleList, barChartList, stringList, decollatePlanarList);
return result;
}
export function zcwjTableData() {
let blockDataList = onceSheetBecomeOfblockData('查询机.xlsx', '政策文件');
let keyValueOrTitleList = ["政策文件"];//适配 饼图 键值以及需要多个key的
let barChartList = []; //适配 柱状图 折线图
let stringList = [];
let decollatePlanarList =[];//适配 表格
let titltListConfig = {};
let result = packageDataProcess(blockDataList, titltListConfig, keyValueOrTitleList, barChartList, stringList, decollatePlanarList);
return result;
}
export function gaoQiaoTableData() {
let blockDataList = onceSheetBecomeOfblockData('查询机.xlsx', '高桥');
let keyValueOrTitleList = [];//适配 饼图 键值以及需要多个key的
let barChartList = []; //适配 柱状图 折线图
let stringList = [];
let decollatePlanarList =["高桥数据"];//适配 表格
let titltListConfig = {};
let result = packageDataProcess(blockDataList, titltListConfig, keyValueOrTitleList, barChartList, stringList, decollatePlanarList);
return result;
}
\ No newline at end of file
import { initInterfaceData } from "./data/interface/cronJob";
import { httpServer } from "./net/http_server";
import { initConfig, port } from "./config/serverConfig";
import { initConfig, systemConfig } from "./config/serverConfig";
import { initUserConfig } from "./config/users";
import { cjwPopTableData, cjwTableData, gqTableData, jcsjTableData, mapTableData, zdhzqyPopTableData, zdhzqyTableData } from "./data/table/jcsjData";
// export let zdqyPopExcelData = zdhzqyPopTableData();
// export let zdqyExcelData = zdhzqyTableData();
// export let mapExcelData = mapTableData();
// export let cjwPopExcelData = cjwPopTableData();
// export let jcsjExcelData = jcsjTableData();
// export let excelData = gqTableData();
// export let popExcelData = cjwPopTableData();
// export let cjwExcelData = cjwTableData();
async function lanuch() {
initUserConfig();
await initConfig();
httpServer.createServer( port );
httpServer.createServer( systemConfig.port );
console.log('This indicates that the server is started successfully.');
}
lanuch();
......@@ -6,6 +6,9 @@ import * as cjwBiz from '../biz/cjw';
import * as zdqyBiz from '../biz/zdqy';
import * as excelBiz from '../biz/excel';
import * as loginBiz from '../biz/admin';
import * as zcwjBiz from '../biz/policy';
import * as gqBiz from '../biz/gq';
import * as qwBiz from '../biz/qw';
export function setRouter(httpServer){
httpServer.post('/jcsj', asyncHandler(jcsjBiz.getData));
......@@ -19,12 +22,24 @@ export function setRouter(httpServer){
httpServer.post('/zdqy', asyncHandler(zdqyBiz.getData));
httpServer.get('/zdqy', asyncHandler(zdqyBiz.getData));
httpServer.post('/zcwj', asyncHandler(zcwjBiz.getData));
httpServer.get('/zcwj', asyncHandler(zcwjBiz.getData));
httpServer.post('/gq', asyncHandler(gqBiz.getData));
httpServer.get('/gq', asyncHandler(gqBiz.getData));
httpServer.post('/api/login', asyncHandler(loginBiz.login));
httpServer.post('/api/jcsjup', asyncHandler(excelBiz.jcsjExcelUp));
httpServer.post('/api/ztsjup', asyncHandler(excelBiz.ztsjExcelUp));
httpServer.post('/api/cxjup', asyncHandler(excelBiz.cxjExcelUp));
httpServer.post('/api/discup', asyncHandler(excelBiz.DISCExcelUp));
httpServer.post('/api/hdhup', asyncHandler(excelBiz.hdhExcelUp));
httpServer.post('/api/download', asyncHandler(excelBiz.downloadFile));
httpServer.get('/api/download', asyncHandler(excelBiz.downloadFile));
httpServer.get('/qw', asyncHandler(qwBiz.getData));
}
\ No newline at end of file
......@@ -9,7 +9,8 @@ const XLSX = require('xlsx');
* @returns [ {blockData:数据块(二维数组), blockTitle:"数据标题"}]
*/
export function onceSheetBecomeOfblockData(fileName, sheetName) {
let {sheetMap} = getExcel( path.join(__dirname.substring(0,__dirname.indexOf("out")), "res", fileName ));
// let {sheetMap} = getExcel( path.join(__dirname.substring(0,__dirname.indexOf("out")), "res", fileName ));
let {sheetMap} = getExcelData( path.join(__dirname.substring(0,__dirname.indexOf("out")), "res", fileName ));
let thisBlockData = getBlockData(sheetMap[sheetName]);
return thisBlockData;
}
......@@ -20,7 +21,8 @@ export function onceSheetBecomeOfblockData(fileName, sheetName) {
* @returns {"sheetName1":[ {blockData:数据块(二维数组), blockTitle:"数据标题"}], ...}
*/
export function excelBecomeOfBlockData(fileName) {
let {sheetMap} = getExcel( path.join(__dirname.substring(0,__dirname.indexOf("out")), "res", fileName ));
// let {sheetMap} = getExcel( path.join(__dirname.substring(0,__dirname.indexOf("out")), "res", fileName ));
let {sheetMap} = getExcelData( path.join(__dirname.substring(0,__dirname.indexOf("out")), "res", fileName ));
let result = {};
for (let sheetName in sheetMap) {
result[sheetName] = getBlockData(sheetMap[sheetName]);
......@@ -190,21 +192,25 @@ function checkBlock(dataList) {
return {blockData, blockTitle, delDataList:dataList,notItem};
}
//获取单个excel文件的数据
function getExcel(filePath) {
console.log();
const workSheetsFromFile = xlsx.parse(filePath);
let sheetMap = {};
let sheetList = [];
for (let i = 0; i < workSheetsFromFile.length; i++) {
let sheetInfo = workSheetsFromFile[i];
sheetMap[sheetInfo.name] = sheetInfo.data;
sheetList.push(sheetInfo);
}
return {sheetMap, sheetList}
}
//数据较多时获取单个excel文件的数据
function getExcelData(filePath) {
var tableData = XLSX.readFile(filePath);
// let ms = new Date().valueOf();
// for (let key in workSheetsFromFile.Sheets["村居委表格数据"]) {
// if (key == "!merges") console.log(key);
// }
// console.log(new Date().valueOf() - ms);
// const workSheetsFromFile2 = xlsx.parse(filePath);
let workSheetsFromFile = [];
for (let sheetName in tableData.Sheets) {
workSheetsFromFile.push({name:sheetName, data:sheetToArray(tableData.Sheets[sheetName])});
......@@ -229,19 +235,19 @@ function sheetToArray(sheetInfo) {
for (let key in sheetInfo) {
let {v} = sheetInfo[key];
//key = A10
let 数字 = parseInt(key.replace(/[a-zA-Z]+/,""));
if (!数字) continue;
let 字母 = key.replace(/[0-9]+/,"");
let 字母长度 = 字母.length;
let = -1;
for(let i = 0; i < 字母.length; i++) {
let 位数 = 字母长度-i;
let = 字母[i].charCodeAt(0) - 64;
+= Math.pow(26, 位数-1) * ;
let num = parseInt(key.replace(/[a-zA-Z]+/,""));
if (!num) continue;
let letter = key.replace(/[0-9]+/,"");
let letterLen = letter.length;
let value = -1;
for(let i = 0; i < letter.length; i++) {
let digit = letterLen-i;
let charNum = letter[i].charCodeAt(0) - 64;
value += Math.pow(26, digit-1) * charNum;
}
let 下标 = 数字 -1;
if (!data[下标]) data[下标] = [];
data[下标][] = v || "";
let index = num -1;
if (!data[index]) data[index] = [];
data[index][value] = v || "";
}
return data;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment