Commit 5e699372 by chenjinjing

no message

parent afdfa2c5
......@@ -5,5 +5,6 @@
/public
/logs
/video
/files
*.logs
*.zip
<config>
<port>9098</port>
<sign>xxx90909082fsdahfjosadjfpoiwausjorip2hjklrhn1ioud0u124rx0qwejfokasjfolksaujfoas</sign>
<dbServer>http://192.168.0.105:40012</dbServer>
<SECRET_TOKEN>Ngz86cuAKxblwXR9OiKSWbfkj7oZ8R0lMU8pTfpVYBDCkvtUb0ZwbaBvwWyfv2O9</SECRET_TOKEN>
<dbServer>http://192.168.0.71:40012</dbServer>
<imgUrl>http://192.168.0.71:9098</imgUrl>
<imgFileUrl>http://192.168.0.71:9097</imgFileUrl>
<unZipFileUrl>http://127.0.0.1:9097</unZipFileUrl>
<fileUrl>/yuyi/files/1/</fileUrl>
<qcc>
<key>2b14555ce89346e8b96684e2e2a1c7c2</key>
......
......@@ -1178,7 +1178,8 @@ export async function qiyeRenZheng(enterpriseName, page) {
if (item[imgKey]) {
let imgArr = parseAndAddUrlPrefix(item[imgKey]); //JSON.parse(item[imgKey]);
for (let k = 0; k < imgArr.length; k++) {
addItem[imgKey].push(`${systemConfig.imgFileUrl}${imgArr[k]}`);
// addItem[imgKey].push(`${systemConfig.imgFileUrl}${imgArr[k]}`);
addItem[imgKey].push(`${imgArr[k]}`);
}
}
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -78,8 +78,7 @@ export async function getNotificationList(msgTitle:string, msgType:number, eId:s
if (allEnterpriseIds.size > 0) {
const enterpriseIdsArray = Array.from(allEnterpriseIds);
// 假设企业表中有 eId 和 eName 字段
const enterpriseFields = ["eId", "eName"];
const enterpriseFields = ["eId", "enterpriseName"];
const enterpriseParam = {
eId: { "%in%": enterpriseIdsArray }
};
......@@ -93,7 +92,7 @@ export async function getNotificationList(msgTitle:string, msgType:number, eId:s
// 构建企业ID到企业名称的映射
enterpriseList.forEach(enterprise => {
enterpriseMap.set(enterprise.eId, enterprise.eName || enterprise.eId);
enterpriseMap.set(enterprise.eId, enterprise.enterpriseName || enterprise.eId);
});
}
......@@ -122,7 +121,7 @@ export async function getNotificationList(msgTitle:string, msgType:number, eId:s
}
} else {
// 如果不是数组,保持原值
targetEnterpriseInfo = item.eId;
targetEnterpriseInfo = item.enterpriseName;
}
} else {
// 如果eId为空,表示全部企业
......@@ -136,6 +135,7 @@ export async function getNotificationList(msgTitle:string, msgType:number, eId:s
return {
...item,
msgType:changeEnumValue(MSGTYPE, item.msgType),
effectiveTime:moment(item.effectiveTime).format("YYYY-MM-DD"),
eId: targetEnterpriseInfo
};
});
......
......@@ -387,12 +387,14 @@ export async function settleInEnterpriseOut(eId:string, descType, desc:string) {
*/
export async function getNewApplicationCount() {
let selectParam = {
register: enumConfig.CHANGESTATE.未审核,
register:enumConfig.CHANGESTATE.已通过,
"%or%":[{state:enumConfig.CHANGESTATE.未审核}, {state:enumConfig.CHANGESTATE.已驳回}],
// register: enumConfig.CHANGESTATE.未审核,
isNewApplication: enumConfig.STATE., // 只统计未查看的新申请
"%or%": [
{ register: enumConfig.CHANGESTATE.未审核 },
{ register: enumConfig.CHANGESTATE.已驳回 }
]
// "%or%": [
// { register: enumConfig.CHANGESTATE.未审核 },
// { register: enumConfig.CHANGESTATE.已驳回 }
// ]
};
let count = await selectData(
......
......@@ -10,7 +10,7 @@ import { OPERATIONALDATATYPE, TABLEID, TABLENAME } from "../config/enum/dbEnum";
import { operationalData, selectData, selectManyTableData } from "../data/operationalData";
import { BizError } from "../util/bizError";
import { ERRORENUM } from "../config/enum/errorEnum";
import { getMySqlMs, getPinyinInitials, getToken, randomId } from "../tools/system";
import { getMySqlMs, getPinyinInitials, getPwdMd5, getToken, randomId } from "../tools/system";
import { changeAdd, extractData } from "../util/piecemeal";
import { EnterpriseApplyForConfig } from "../config/splitResult/enterprise";
import { CHANGESTATE, CHANGETYPE, FUHUASTATE, RUFUSTATE, STATE } from "../config/enum/enum";
......@@ -31,11 +31,14 @@ import { createMessageReminder } from "./message";
let userInfo = await selectData(OPERATIONALDATATYPE.查询单个, TABLENAME.企业用户表, {phone}, ["uId"]);
if (userInfo && userInfo.uId) throw new BizError(ERRORENUM.手机号码重复);
let uId = randomId(TABLEID.企业用户表);
const encryptedPwd = getPwdMd5(uId, pwd);
let addUInfo = {
uId:randomId(TABLEID.企业用户表),
uId,
userName,
phone,
pwd
pwd:encryptedPwd
};
await operationalData(OPERATIONALDATATYPE.增加, TABLENAME.企业用户表, addUInfo, {});
......@@ -53,7 +56,9 @@ export async function enterpriseLogin(phone:string, pwd:string) {
let enterpriseUserInfo = await selectData(OPERATIONALDATATYPE.查询单个, TABLENAME.企业用户表, {phone}, ["uId", "phone", "pwd", "eId"]);
if (!enterpriseUserInfo || !enterpriseUserInfo.uId) throw new BizError(ERRORENUM.账号不存在);
if (enterpriseUserInfo.pwd != pwd) throw new BizError(ERRORENUM.账号或密码错误);
const encryptedPwd = getPwdMd5(enterpriseUserInfo.uId, pwd);
console.log(enterpriseUserInfo.pwd + "===>" + encryptedPwd)
if (enterpriseUserInfo.pwd != encryptedPwd) throw new BizError(ERRORENUM.账号或密码错误);
let updateUserInfo = {
token : getToken(enterpriseUserInfo.uId),
......@@ -429,7 +434,12 @@ export async function updateRuFu(eId:string, param) {
}
await operationalData(OPERATIONALDATATYPE.修改, TABLENAME.企业基础信息表, {state:CHANGESTATE.未审核, isNewApplication: STATE.}, {eId});
await operationalData(OPERATIONALDATATYPE.修改, TABLENAME.租赁信息, param, {eId});
let updataParam = {};
for (let key in param) {
updataParam[key] = JSON.stringify(param[key]);
}
await operationalData(OPERATIONALDATATYPE.修改, TABLENAME.租赁信息, updataParam, {eId});
// 检查是否是重新提交(之前被驳回过)
const wasRejected = resInfo.state === CHANGESTATE.已驳回;
......
......@@ -513,6 +513,19 @@ export enum DOWNLOADTYPE {
}
// 下载类型枚举
export enum DOWNLOADCLIENTTYPE {
// 全部数据 = 'all',
资质证书 = 'qualification',
知识产权 = 'intellectualProperty',
租赁信息 = 'lease',
// 商标 = 'trademark',
// 作品著作权 = 'copyright',
// 软件著作权 = 'softwareCopyright',
// 专利 = 'patent'
}
// 企业消息状态枚举
export enum MSGTYPE {
// 季度填报相关
......
......@@ -85,22 +85,27 @@ export enum DOWNLOADCOLS {
// 通信地址 = "tongXinDiZhi",
联系人 = "liaison",
联系电话 = "liaisonPhone",
登记机关 = "dengJiJiGuan",
// 登记机关 = "dengJiJiGuan",
企业规模 = "qiYeGuiMo",
登记状态 = "RAS",
官网地址 = "guanWang",
营业期限 = "yingYeQiXian",
注销时间 = "logOffMS",
// 登记状态 = "RAS",
// 官网地址 = "guanWang",
// 营业期限 = "yingYeQiXian",
// 注销时间 = "logOffMS",
实缴资本 = "shijiaoziben",
企业机构类型 = "enterpriseType",
// 企业机构类型 = "enterpriseType",
简介 = "jianJie",
注册资本 = "zhuceziben",
纳税人资质 = "naShuiRenZiZhi",
// 纳税人资质 = "naShuiRenZiZhi",
经营地址 = "operatingAddress",
迁入前注册地址 = "oldLogonAddress",
税号 = "shuiHao",
税务局 = "shuiWuJu",
// 迁入前注册地址 = "oldLogonAddress",
// 税号 = "shuiHao",
// 税务局 = "shuiWuJu",
经营范围 = "jingYingFanWei",
/**其他表 */
孵化时间 = "fuhuaTime",
租赁面积 = "area",
楼号 = "building",
室号 = "roomNumber",
}
......@@ -129,10 +134,11 @@ export enum FINANCINGCOLS {
/**荣誉奖项下载列 */
export enum HONORCOLS {
奖项名称 = "awardName",
颁奖单位 = "awardingUnit",
获奖日期 = "awardTime",
奖项等级 = "awardLevel",
荣誉奖项数量 = "awardCount"
// 奖项名称 = "awardName",
// 颁奖单位 = "awardingUnit",
// 获奖日期 = "awardTime",
// 奖项等级 = "awardLevel",
}
......
......@@ -16,9 +16,11 @@ export async function initConfig() {
if (!configInfo || !configInfo.config) throw new BizError('xml中无配置');
else {
let {port, sign, dbServer, imgUrl, imgFileUrl, qcc } = configInfo.config;
let {port, sign, SECRET_TOKEN, dbServer, imgUrl, imgFileUrl, qcc, unZipFileUrl } = configInfo.config;
systemConfig.port = parseInt(port[0]);
systemConfig.secretToken = SECRET_TOKEN[0];
systemConfig.dbSign = sign[0];
systemConfig.dbPath = dbServer[0];
......@@ -28,6 +30,7 @@ export async function initConfig() {
systemConfig.qccKey = qcc[0].key[0];
systemConfig.qccSecretKey = qcc[0].SecretKey[0];
systemConfig.unZipFileUrl = unZipFileUrl[0];
}
......
......@@ -6,12 +6,14 @@
export class ServerConfig {
/**系统配置 */
port:number;
dbSign:String;
dbPath:String;
secretToken:string;
dbSign:string;
dbPath:string;
imgPath:string;
imgUrl:String;
imgFileUrl:String;
imgUrl:string;
imgFileUrl:string;
/**企查查 */
qccKey:string;
qccSecretKey:string;
unZipFileUrl:string;
}
\ No newline at end of file
import { newDow } from "./biz/createZip";
import { integration } from "./biz/dataAsync";
import { migrateAdminPasswords, migrateEnterpriseUserPasswords } from "./biz/dataInit";
import { migrateSingleFileToArray } from "./biz/migrateSingleFileToArray";
......@@ -15,12 +16,22 @@ async function lanuch() {
// await initApiDataStorage();
console.log("更新加密后密码格式...");
// console.log("更新加密后密码格式...");
// await migrateEnterpriseUserPasswords();
// await migrateAdminPasswords();
console.log("更新业务函数以兼容新的文件存储格式...");
// console.log("更新业务函数以兼容新的文件存储格式...");
// migrateSingleFileToArray();
// await integration();
// let eIds = ["e_ea892413d62a108e7a9517443668ddcf","e_08ae2d8974e752b3e251de1764274baa", "e_8f554f5254d9775484802ad0b2e96731"];
// let options = {exportFileTypes: ["all"], customColumns:{
// "经营数据":[
// { key: '营收(万元)', value: 'BI' },
// { key: '纳税(万元)', value: 'TXP' },
// { key: '季度', value: 'quarter' }
// ]
// }};
// await newDow(eIds, options);
}
......
......@@ -30,6 +30,7 @@ export class httpServer {
// httpServer.use(bodyParser.json({limit:'5mb'}));
// httpServer.use(bodyParser.urlencoded({limit:'5mb', extends:true}));
// httpServer.use(express.static("./temp"));
httpServer.use(express.static("./static") );
httpServer.use(express.static("./files") );
httpServer.use(express.static("./img") );
......@@ -38,7 +39,7 @@ export class httpServer {
httpServer.use(fallback('index.html', { root }));
httpServer.use(compression());
httpServer.use(watch);
httpServer.use(bodyParser.json({limit:"5000kb"}));
httpServer.use(bodyParser.json({limit:"50000kb"}));
routers.setRouter(httpServer);
httpServer.use(httpErrorHandler);
......
......@@ -32,7 +32,7 @@ const config = {
"/public/desctypeclient":enumConfig.DESCTYPECLIENT, //入孵申请审批驳回
"/public/filedesctypeclient":enumConfig.FILEDESCTYPECLIENT, //入孵材料审批驳回
/**二期 */
"/public/downloadtype":enumConfig.DOWNLOADTYPE, //下载类型
"/public/downloadtype":enumConfig.DOWNLOADCLIENTTYPE, //下载类型
"/public/downloadcols":outputEnumConfig.DOWNLOADCOLS, //基础数据下载列
"/public/operationcols":outputEnumConfig.OPERATIONCOLS, //经营数据下载列
"/public/financingcols":outputEnumConfig.FINANCINGCOLS, //融资数据下载列
......
......@@ -5,11 +5,15 @@
import asyncHandler = require("express-async-handler");
import { checkUser } from "../middleware/user";
import * as fs from "fs-extra";
import { downloadConsolidatedDataSimple, downloadEnterpriseData } from "../biz/createZip";
import { downloadConsolidatedDataSimple, downloadEnterpriseData, newDow } from "../biz/createZip";
import { DOWNLOADTYPE } from "../config/enum/enum";
import { systemConfig } from "../config/serverConfig";
export function setRouter(httpServer) {
// 按配置下载压缩包数据
httpServer.post("/admin/enterprise/zipdownload/newdow", checkUser, asyncHandler(newDowZipDownload));
// 下载全部数据
httpServer.post("/admin/enterprise/zipdownload/consolidated", checkUser, asyncHandler(downloadConsolidated));
......@@ -27,6 +31,44 @@ export function setRouter(httpServer) {
}
async function newDowZipDownload(req, res) {
try {
console.log("收到下载全部数据请求,参数:", req.body);
const { eIds, options } = req.body;
if (!eIds) {
return res.status(400).json({ error: "缺少必要参数eIds" });
}
if (!options) {
return res.status(400).json({ error: "缺少必要参数options" });
}
if (!options.exportFileTypes) {
return res.status(400).json({ error: "缺少必要参数options.exportFileTypes" });
}
console.log(`开始下载全部数据,企业ID: ${JSON.stringify(eIds)}, 数据类型: ${JSON.stringify(options.exportDataTypes)}, 文件类型: ${JSON.stringify(options.exportFileTypes)}`);
let result = await newDow(eIds, options);
res.success(result);
} catch (error) {
console.error("下载全部数据失败:", error);
if (!res.headersSent) {
res.status(500).json({
error: "下载全部数据失败",
message: error.message,
stack: process.env.NODE_ENV === "development" ? error.stack : undefined
});
}
}
}
/**
* 下载
......@@ -55,6 +97,19 @@ export function setRouter(httpServer) {
}
*/
async function downloadConsolidated(req, res) {
/**
* 现有逻辑:
* 1.去filesServer 获取文件 鉴权
* 2.拿到文件的二进制文件写入到 temp
* 3.压缩
* 4.返回压缩包的文件目录
*
* 1.通知filesserver 有人下载,xuya
* 2.filesServer 去处理压缩包
* 3.filseServer返回目录名称和目录地址
* 4.本接口返回
*
*/
try {
console.log("收到下载全部数据请求,参数:", req.body);
const { eIds, options } = req.body;
......@@ -80,12 +135,7 @@ async function downloadConsolidated(req, res) {
let result = await downloadConsolidatedDataSimple(eIds, options);
console.log("全部数据ZIP文件创建成功: ", result.fileName);
console.log("处理统计:", result.statistics);
// 设置响应头
res.setHeader("Content-Type", "application/zip");
res.setHeader("Content-Disposition", `attachment; filename=${encodeURIComponent(result.fileName)}`);
res.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
// 检查文件是否存在
if (!await fs.pathExists(result.filePath)) {
throw new Error("ZIP文件未找到: " + result.filePath);
......@@ -96,21 +146,24 @@ async function downloadConsolidated(req, res) {
res.setHeader("Content-Length", stats.size);
console.log(`准备发送文件: ${result.fileName}, 大小: ${stats.size} bytes`);
res.success({fileDir:result.fileDir, filename:result.fileName});
// 发送文件
res.sendFile(result.filePath, async (err) => {
if (err) {
console.error("发送文件失败:", err);
if (!res.headersSent) {
res.status(500).json({ error: "文件发送失败", message: err.message });
}
} else {
console.log("全部数据文件发送成功");
}
// // 发送文件
// res.sendFile(result.filePath, async (err) => {
// if (err) {
// console.error("发送文件失败:", err);
// if (!res.headersSent) {
// res.status(500).json({ error: "文件发送失败", message: err.message });
// }
// } else {
// console.log("全部数据文件发送成功");
// }
// 清理临时文件
await cleanupTempFile(result.filePath);
});
// // 清理临时文件
// // await cleanupTempFile(result.filePath);
// });
} catch (error) {
console.error("下载全部数据失败:", error);
if (!res.headersSent) {
......@@ -176,7 +229,7 @@ async function handleDownload(req, res, downloadType: DOWNLOADTYPE, typeName: st
}
// 清理临时文件
await cleanupTempFile(result.filePath);
// await cleanupTempFile(result.filePath);
});
} catch (error) {
......
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