Commit ff053674 by chenjinjing

no message

parent 41a1ecc4
...@@ -15,7 +15,7 @@ import { eccFormParam } from "../util/verificationParam"; ...@@ -15,7 +15,7 @@ import { eccFormParam } from "../util/verificationParam";
export async function gardenNoticeList(keywords:string, page:number) { export async function gardenNoticeList(keywords:string, page:number) {
let selectParam:any = {}; let selectParam:any = {};
if (keywords) selectParam.content = {"%like%":keywords}; if (keywords) selectParam.content = {"%like%":keywords};
let filesList = ["gnId", "title", "isPublished", "publishTime", "content"]; let filesList = ["gnId", "title", "isPublished", "publishStartTime", "publishEndTime", "content"];
// let resList = await selectData(OPERATIONALDATATYPE.分页查询, TABLENAME.园区通知表, {}, filesList, page); // let resList = await selectData(OPERATIONALDATATYPE.分页查询, TABLENAME.园区通知表, {}, filesList, page);
let resList = await selectData(OPERATIONALDATATYPE.分页查询, TABLENAME.园区通知表, selectParam, filesList, page); let resList = await selectData(OPERATIONALDATATYPE.分页查询, TABLENAME.园区通知表, selectParam, filesList, page);
...@@ -27,7 +27,7 @@ export async function gardenNoticeList(keywords:string, page:number) { ...@@ -27,7 +27,7 @@ export async function gardenNoticeList(keywords:string, page:number) {
title:info.title, title:info.title,
content:info.content, content:info.content,
isPublished:info.isPublished, isPublished:info.isPublished,
publishTime:moment(info.publishTime).format("YYYY-MM-DD") publishTime:`${moment(info.publishStartTime).format("YYYY-MM-DD")}-${moment(info.publishEndTime).format("YYYY-MM-DD")}`
}); });
}); });
...@@ -36,7 +36,7 @@ export async function gardenNoticeList(keywords:string, page:number) { ...@@ -36,7 +36,7 @@ export async function gardenNoticeList(keywords:string, page:number) {
export async function gardenNoticeInfo(gnId:string) { export async function gardenNoticeInfo(gnId:string) {
let filesList = ["gnId", "title", "isPublished", "content", "publishTime", "relatedEnterprise"]; let filesList = ["gnId", "title", "isPublished", "content", "publishStartTime", "publishEndTime", "relatedEnterprise"];
let resInfo = await selectData(OPERATIONALDATATYPE.查询单个, TABLENAME.园区通知表, {gnId}, filesList); let resInfo = await selectData(OPERATIONALDATATYPE.查询单个, TABLENAME.园区通知表, {gnId}, filesList);
let dataInfo = { let dataInfo = {
...@@ -44,7 +44,8 @@ export async function gardenNoticeInfo(gnId:string) { ...@@ -44,7 +44,8 @@ export async function gardenNoticeInfo(gnId:string) {
title:resInfo.title,//标题 title:resInfo.title,//标题
content:resInfo.content,//内容 content:resInfo.content,//内容
isPublished:resInfo.isPublished,//是否发布(1:是,0:否) isPublished:resInfo.isPublished,//是否发布(1:是,0:否)
publishTime:resInfo.publishTime,//发布时间 publishStartTime:resInfo.publishStartTime,//发布时间
publishEndTime:resInfo.publishEndTime,//发布时间
relatedEnterprise:JSON.parse(resInfo.relatedEnterprise || '[]'),//关联企业 relatedEnterprise:JSON.parse(resInfo.relatedEnterprise || '[]'),//关联企业
}; };
return {dataInfo} return {dataInfo}
...@@ -54,12 +55,13 @@ export async function gardenNoticeInfo(gnId:string) { ...@@ -54,12 +55,13 @@ export async function gardenNoticeInfo(gnId:string) {
export async function gardenNoticeUpdate(gnId:string, param) { export async function gardenNoticeUpdate(gnId:string, param) {
const FuncName = "修改园区通知" const FuncName = "修改园区通知"
eccFormParam(FuncName, GardenNoticeUpdateConfig, param ); eccFormParam(FuncName, GardenNoticeUpdateConfig, param );
let filesList = ["gnId", "title", "isPublished", "content", "publishTime", "relatedEnterprise"]; let filesList = ["gnId", "title", "isPublished", "content", "publishStartTime", "publishEndTime", "relatedEnterprise"];
let resInfo = await selectData(OPERATIONALDATATYPE.查询单个, TABLENAME.园区通知表, {gnId}, filesList); let resInfo = await selectData(OPERATIONALDATATYPE.查询单个, TABLENAME.园区通知表, {gnId}, filesList);
if (!resInfo.gnId) throw new BizError(ERRORENUM.数据不存在); if (!resInfo.gnId) throw new BizError(ERRORENUM.数据不存在);
param.publishTime = getMySqlMs(param.publishTime); param.publishStartTime = getMySqlMs(param.publishStartTime);
param.publishEndTime = getMySqlMs(param.publishEndTime);
param.relatedEnterprise = JSON.stringify(param.relatedEnterprise); param.relatedEnterprise = JSON.stringify(param.relatedEnterprise);
await operationalData(OPERATIONALDATATYPE.修改, TABLENAME.园区通知表, param, {gnId}); await operationalData(OPERATIONALDATATYPE.修改, TABLENAME.园区通知表, param, {gnId});
...@@ -71,7 +73,8 @@ export async function gardenNoticeAdd(param) { ...@@ -71,7 +73,8 @@ export async function gardenNoticeAdd(param) {
eccFormParam(FuncName, GardenNoticeUpdateConfig, param ); eccFormParam(FuncName, GardenNoticeUpdateConfig, param );
param.gnId = randomId(TABLEID.园区通知表); param.gnId = randomId(TABLEID.园区通知表);
param.publishTime = getMySqlMs(param.publishTime); param.publishStartTime = getMySqlMs(param.publishStartTime);
param.publishEndTime = getMySqlMs(param.publishEndTime);
param.relatedEnterprise = JSON.stringify(param.relatedEnterprise); param.relatedEnterprise = JSON.stringify(param.relatedEnterprise);
await operationalData(OPERATIONALDATATYPE.增加, TABLENAME.园区通知表, param, {}); await operationalData(OPERATIONALDATATYPE.增加, TABLENAME.园区通知表, param, {});
......
...@@ -10,7 +10,9 @@ export const GardenNoticeUpdateConfig = { ...@@ -10,7 +10,9 @@ export const GardenNoticeUpdateConfig = {
title:{type:"String"},// 标题 title:{type:"String"},// 标题
content:{type:"String"},// 内容 content:{type:"String"},// 内容
isPublished:{type:"Number"},// 是否发布(1:是,0:否) isPublished:{type:"Number"},// 是否发布(1:是,0:否)
publishTime:{type:"Number"},// 发布时间 // publishTime:{type:"Number"},// 发布时间
publishStartTime:{type:"Number"}, //发布开始时间
publishEndTime:{type:"Number"}, //发布结束时间
relatedEnterprise:{type:"[String]"},// 关联企业 relatedEnterprise:{type:"[String]"},// 关联企业
} }
......
...@@ -130,8 +130,8 @@ export enum FOLLOWUPSTATUS { ...@@ -130,8 +130,8 @@ export enum FOLLOWUPSTATUS {
*/ */
export enum NEEDCATEGORY { export enum NEEDCATEGORY {
// 物业服务 = 1, // 物业服务 = 1,
工商税务 = 2, // 工商税务 = 2,
代理记账, 代理记账 = 3,
贷款服务, 贷款服务,
法律服务, 法律服务,
知识产权, 知识产权,
......
import { awaitData } from "../biz/dataInit";
import { OPERATIONALDATATYPE, TABLENAME } from "../config/enum/dbEnum";
import { selectData } from "./operationalData";
// 初始化数据文件结构
async function initDataFile() {
let enterpriseList = await selectData(OPERATIONALDATATYPE.查询多个, TABLENAME.企业基础信息表, {}, ["eId", "uscc", "enterpriseName"]);
let currentData = {};
let usccData = await awaitData("91310115MADM8EA654");
currentData["91310115MADM8EA654"] = usccData;
for (let i = 0; i < enterpriseList.length; i++) {
let info = enterpriseList[i];
console.log("开始同步企查查数据");
let usccData = await awaitData(info.uscc);
currentData[info.uscc] = usccData;
console.log(`${info.enterpriseName} 同步成功, eId:${info.eId},下标 ${i}`);
}
console.log("刷新缓存数据结束")
}
/**
* 接口更新
* 设置定时器,每天刷新一次数据
*/
export async function initApiDataStorage() {
await initDataFile();
setInterval(async function () {
await initDataFile();
}, 3600 * 1000 * 24);
}
import { awaitData } from "./biz/dataInit";
import { initConfig, systemConfig } from "./config/serverConfig"; import { initConfig, systemConfig } from "./config/serverConfig";
import { initApiDataStorage } from "./data/dataInterfaceWithCache";
import { httpServer } from "./net/http_server"; import { httpServer } from "./net/http_server";
async function lanuch() { async function lanuch() {
await initConfig(); await initConfig();
httpServer.createServer(systemConfig.port); httpServer.createServer(systemConfig.port);
console.log('This indicates that the server is started successfully.'); console.log('This indicates that the server is started successfully.');
// await initApiDataStorage();
} }
......
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