Commit afdfa2c5 by chenjinjing

二期内容提交测试准备

parent 061280c5
......@@ -8,12 +8,14 @@
"@types/node": "^10.12.18",
"archiver": "^7.0.1",
"compression": "^1.7.4",
"docx": "^9.5.1",
"exceljs": "^4.4.0",
"express": "^4.17.1",
"express-async-handler": "^1.1.4",
"express-history-api-fallback": "^2.2.1",
"formidable": "^1.2.1",
"fs-extra": "^11.3.2",
"jsdom": "^26.1.0",
"log4js": "^6.6.1",
"lru-cache": "^4.1.5",
"md5": "^2.2.1",
......@@ -21,9 +23,12 @@
"mongoose": "^5.4.0",
"mysql": "^2.18.1",
"node-fetch": "^2.7.0",
"node-schedule": "^2.1.1",
"node-xlsx": "^0.16.1",
"nodemailer": "^6.1.1",
"officegen": "^0.6.5",
"pdf-parse": "^2.2.2",
"pdf2docx": "^0.0.0",
"pinyin": "^4.0.0-alpha.2",
"qs": "^6.11.0",
"request": "^2.88.0",
......
<config>
<port>9098</port>
<sign>xxx90909082fsdahfjosadjfpoiwausjorip2hjklrhn1ioud0u124rx0qwejfokasjfolksaujfoas</sign>
<dbServer>http://192.168.0.71:40012</dbServer>
<dbServer>http://192.168.0.105:40012</dbServer>
<imgUrl>http://192.168.0.71:9098</imgUrl>
<imgFileUrl>http://192.168.0.71:9097</imgFileUrl>
<fileUrl>/yuyi/files/1/</fileUrl>
......
......@@ -52,8 +52,8 @@ const typeNameMap = {
export async function downloadConsolidatedDataSimple(
eIds: string | string[],
options: {
// 需要导出的数据类型(仍然保留但会合并显示)
exportDataTypes?: string[];
// // 需要导出的数据类型(仍然保留但会合并显示)
// exportDataTypes?: string[];
// 需要下载的文件类型,使用你已有的DOWNLOADTYPE枚举
exportFileTypes?: DOWNLOADTYPE[];
// 自定义列配置
......@@ -65,11 +65,20 @@ export async function downloadConsolidatedDataSimple(
try {
const enterpriseIds = Array.isArray(eIds) ? eIds : [eIds];
const {
exportDataTypes = ['基础信息', '经营数据', '融资情况', '荣誉奖项'],
// exportDataTypes = ['基础信息', '经营数据', '融资情况', '荣誉奖项'],
exportFileTypes = [DOWNLOADTYPE.租赁信息],
customColumns = {}
} = options;
let exportDataTypes = [];
if (Object.keys(customColumns).length > 0) {
for (let key in customColumns) {
exportDataTypes.push(key);
}
} else {
exportDataTypes = ['基础信息', '经营数据', '融资情况', '荣誉奖项'];
}
// 参数验证
if (!enterpriseIds || enterpriseIds.length === 0) {
throw new BizError(ERRORENUM.参数错误, '企业ID不能为空');
......
......@@ -11,6 +11,7 @@ import { ERRORENUM } from "../config/enum/errorEnum";
import { MSGTYPE } from "../config/enum/enum";
import { eccFormParam } from "../util/verificationParam";
import { EnterpriseNotificationAddConfig } from "../config/eccParam/enterprise";
import { changeEnumValue } from "../util/verificationEnum";
/**
......@@ -134,6 +135,7 @@ export async function getNotificationList(msgTitle:string, msgType:number, eId:s
return {
...item,
msgType:changeEnumValue(MSGTYPE, item.msgType),
eId: targetEnterpriseInfo
};
});
......@@ -143,6 +145,112 @@ export async function getNotificationList(msgTitle:string, msgType:number, eId:s
/**
* 消息通知 - 回显
* @param msgId 消息ID
* @returns 消息详情信息
*/
export async function notificationInfo(msgId: string) {
const FuncName = "企业消息通知-回显";
// 分页查询数据
const filesList = ["msgId", "msgTitle", "msgContent", "msgType", "isPop", "effectiveTime", "createTime", "eId"];
// 验证消息是否存在
const messageDetail = await selectData(
OPERATIONALDATATYPE.查询单个,
TABLENAME.企业消息通知表,
{ msgId },
filesList
);
if (!messageDetail) {
throw new BizError(ERRORENUM.数据不存在, "消息不存在");
}
// 处理企业ID信息
let eIdArray: string[] = [];
let targetEnterpriseInfo: string | string[] = [];
try {
if (messageDetail.eId) {
const parsedEid = JSON.parse(messageDetail.eId);
if (Array.isArray(parsedEid)) {
eIdArray = parsedEid;
if (eIdArray.length === 0) {
// 空数组表示全部企业
targetEnterpriseInfo = "全部企业";
} else {
// 如果有企业ID,查询企业名称
const enterpriseMap = new Map<string, string>();
if (eIdArray.length > 0) {
const enterpriseFields = ["eId", "eName"];
const enterpriseParam = {
eId: { "%in%": eIdArray }
};
const enterpriseList = await selectData(
OPERATIONALDATATYPE.查询多个,
TABLENAME.企业基础信息表, // 需要确认企业表的名称
enterpriseParam,
enterpriseFields
);
// 构建企业ID到企业名称的映射
enterpriseList.forEach(enterprise => {
enterpriseMap.set(enterprise.eId, enterprise.eName || enterprise.eId);
});
// 将企业ID转换为企业名称
targetEnterpriseInfo = eIdArray.map(eId => {
return enterpriseMap.get(eId) || eId;
});
}
}
} else {
// 如果不是数组,保持原值
targetEnterpriseInfo = messageDetail.eId;
eIdArray = [messageDetail.eId];
}
} else {
// 如果eId为空,表示全部企业
targetEnterpriseInfo = "全部企业";
}
} catch (error) {
// 如果解析失败,保持原值
console.error(`解析企业ID失败: ${messageDetail.eId}`, error);
targetEnterpriseInfo = messageDetail.eId || "";
eIdArray = messageDetail.eId ? [messageDetail.eId] : [];
}
// 处理有效时间,转换为时间戳
let effectiveTimeStamp = "-";
if (messageDetail.effectiveTime) {
effectiveTimeStamp = moment(messageDetail.effectiveTime).format("YYYY-MM-DD");
}
// 处理创建时间,转换为时间戳
let createTimeStamp = "-";
if (messageDetail.createTime) {
createTimeStamp = moment(messageDetail.createTime).format("YYYY-MM-DD");
}
// 返回处理后的消息详情
return {
msgId: messageDetail.msgId,
msgTitle: messageDetail.msgTitle,
msgContent: messageDetail.msgContent,
msgType: messageDetail.msgType,
isPop: messageDetail.isPop,
effectiveTime: effectiveTimeStamp,
createTime: createTimeStamp,
eId: eIdArray, // 返回企业ID数组,方便前端编辑
eIdDisplay: targetEnterpriseInfo // 显示用的企业信息(名称或ID)
};
}
/**
* 创建通知
* @param param
* @param eId 企业ID数组,如 ["e_72b85665bb98d1fbc195d587a36cb223"],空数组表示发给所有企业
......@@ -175,6 +283,8 @@ export async function createNotification(param: {
eccFormParam(FuncName, EnterpriseNotificationAddConfig, validationParam);
// 处理企业ID,直接使用传入的数组格式
let eIdArray: string[] = [];
if (param.eId) {
......@@ -325,8 +435,8 @@ export async function editNotification(msgId: string, updates: {
await operationalData(
OPERATIONALDATATYPE.修改,
TABLENAME.企业消息通知表,
{ msgId },
updateData
updateData,
{ msgId }
);
}
......@@ -404,20 +514,20 @@ export async function deleteNotificationById(msgId: string) {
throw new BizError(ERRORENUM.数据不存在, "消息不存在");
}
// 删除消息主记录
// 同时删除已读状态记录
await operationalData(
OPERATIONALDATATYPE.删除,
TABLENAME.企业消息通知表,
TABLENAME.企业消息已读状态表,
{},
{ msgId },
{}
);
// 同时删除已读状态记录
// 删除消息主记录
await operationalData(
OPERATIONALDATATYPE.删除,
TABLENAME.企业消息已读状态表,
TABLENAME.企业消息通知表,
{},
{ msgId },
{}
);
return { isSuccess: true, message: "删除成功" };
......
......@@ -533,8 +533,19 @@ export enum MSGTYPE {
// 园区通知
园区公告 = 9,
活动通知 = 10
活动通知 = 10,
其他通知 = 100
};
export enum MSGTYPECLIENT {
// 季度填报相关
季度填报提醒 = 1,
填报截止提醒 = 2,
其他通知 = 100
};
......@@ -72,17 +72,17 @@ export enum ENTERPRISEBASEMOVEOUT {
export enum DOWNLOADCOLS {
企业名称 ="enterpriseName",
统一信用代码 = "uscc",
注册号 = "zhuCeHao",
组织机构代码 = "zuZhiJiGouDaiMa",
更多电话 = "gengDuoDianHua",
主营业务 = "mainBusiness",
// 注册号 = "zhuCeHao",
// 组织机构代码 = "zuZhiJiGouDaiMa",
// 更多电话 = "gengDuoDianHua",
// 主营业务 = "mainBusiness",
注册日期 = "logonTime",
邮箱 = "mail",
是否自然人控股企业 = "isNaturalPersonHolding",
// 邮箱 = "mail",
// 是否自然人控股企业 = "isNaturalPersonHolding",
行业领域 = "industry",
更多邮箱 = "moreMail",
// 更多邮箱 = "moreMail",
注册地址 = "logonAddress",
通信地址 = "tongXinDiZhi",
// 通信地址 = "tongXinDiZhi",
联系人 = "liaison",
联系电话 = "liaisonPhone",
登记机关 = "dengJiJiGuan",
......
......@@ -7,6 +7,7 @@ import { initConfig, systemConfig } from "./config/serverConfig";
import { initApiDataStorage } from "./data/dataInterfaceWithCache";
import { httpServer } from "./net/http_server";
async function lanuch() {
await initConfig();
httpServer.createServer(systemConfig.port);
......@@ -23,6 +24,8 @@ async function lanuch() {
}
lanuch();
......@@ -9,7 +9,9 @@ import { checkUser } from '../middleware/user';
export function setRouter(httpServer) {
httpServer.post('/admin/enterprise/massagnotice/list', checkUser, asyncHandler(getNotificationList));
httpServer.post('/admin/enterprise/massagnotice/info', checkUser, asyncHandler(notificationInfo));
httpServer.post('/admin/enterprise/massagnotice/add', checkUser, asyncHandler(addNotification));
httpServer.post('/admin/enterprise/massagnotice/update', checkUser, asyncHandler(updateNotification));
httpServer.post('/admin/enterprise/massagnotice/updatepopup', checkUser, asyncHandler(updateNotificationPopupStatus));
httpServer.post('/admin/enterprise/massagnotice/delete', checkUser, asyncHandler(deleteNotificationById));
......@@ -22,7 +24,7 @@ export function setRouter(httpServer) {
* @param res
*/
async function getNotificationList(req, res) {
let { msgTitle, msgType, eId, page } = req.query;
let { msgTitle, msgType, eId, page } = req.body;
let result = await massageNoticeBiz.getNotificationList(msgTitle, msgType, eId, page);
res.success(result);
......@@ -30,6 +32,19 @@ async function getNotificationList(req, res) {
/**
* 企业消息通知-回显
* @param req
* @param res
*/
async function notificationInfo(req, res) {
let {msgId} = req.body;
let result = await massageNoticeBiz.notificationInfo(msgId);
res.success(result);
}
/**
* 添加企业消息通知
* @param req
* @param res
......@@ -43,6 +58,19 @@ async function addNotification(req, res) {
/**
* 编辑企业消息通知
* @param req
* @param res
*/
async function updateNotification(req, res) {
let {msgId, param} = req.body;
let result = await massageNoticeBiz.editNotification(msgId, param);
res.success(result);
}
/**
* 修改消息是否弹窗状态
* @param req
* @param res
......@@ -55,15 +83,13 @@ async function updateNotificationPopupStatus(req, res) {
}
/**
* 删除企业消息通知
* @param req
* @param res
*/
async function deleteNotificationById(req, res) {
let { msgId } = req.query;
let { msgId } = req.body;
let result = await massageNoticeBiz.deleteNotificationById(msgId);
res.success(result);
......
......@@ -37,6 +37,7 @@ const config = {
"/public/operationcols":outputEnumConfig.OPERATIONCOLS, //经营数据下载列
"/public/financingcols":outputEnumConfig.FINANCINGCOLS, //融资数据下载列
"/public/honorcols":outputEnumConfig.HONORCOLS, //荣誉数据下载列
"/public/msgtypeclient":enumConfig.MSGTYPECLIENT, //季度消息通知类型-前端用
// "/public/output/basedata":outputEnumConfig.BASEDATA,
// "/public/output/opreatdata":outputEnumConfig.OPERATIONDATA,
......
......@@ -67,9 +67,9 @@ async function downloadConsolidated(req, res) {
return res.status(400).json({ error: "缺少必要参数options" });
}
if (!options.exportDataTypes) {
return res.status(400).json({ error: "缺少必要参数options.exportDataTypes" });
}
// if (!options.exportDataTypes) {
// return res.status(400).json({ error: "缺少必要参数options.exportDataTypes" });
// }
if (!options.exportFileTypes) {
return res.status(400).json({ error: "缺少必要参数options.exportFileTypes" });
......
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