Commit c2c98b70 by lixinming

no message

parent f8d5386c
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -16,7 +16,6 @@
"lru-cache": "^4.1.5",
"md5": "^2.2.1",
"moment": "^2.24.0",
"mongoose": "^7.6.0",
"mysql": "^2.18.1",
"mysql2": "^3.6.0",
"node-xlsx": "^0.16.1",
......@@ -29,7 +28,6 @@
"ws": "^5.2.2",
"xml2js": "^0.4.23"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
......
......@@ -10,7 +10,7 @@
</mongodb>
<mysqldb>
<!-- 本地mysql配置 -->
<mysqlHost>192.168.0.105</mysqlHost>
<mysqlHost>127.0.0.1</mysqlHost>
<mysqlPort>3306</mysqlPort>
<mysqlUser>root</mysqlUser>
<mysqlPwd>123456</mysqlPwd>
......
......@@ -2,7 +2,7 @@ const Sequelize = require('sequelize');
export const TablesConfig = [
{
tableNameCn:'支部表',
tableNameCn:'支部表', // success
tableName:'branch',
schema:{
bId: {
......@@ -17,7 +17,7 @@ export const TablesConfig = [
association: []
},
{
tableNameCn:'后台用户表',
tableNameCn:'后台用户表', // success
tableName:'adminUser',
schema:{
uId:{
......@@ -34,7 +34,7 @@ export const TablesConfig = [
association: []
},
{
tableNameCn:'党员基础信息表',
tableNameCn:'党员基础信息表', // success
tableName:'partyMember',
schema:{
pmId: {
......@@ -55,11 +55,14 @@ export const TablesConfig = [
partyPositionsName: {type:Sequelize.STRING(100), allowNull:true, defaultValue:'[]'}, //党内职务id 枚举 --正式党员录入 [1,2] --多选
departmentName: {type:Sequelize.STRING(100), allowNull:true, defaultValue:'[]'}, //所属科室表id 枚举 [1,2] --多选
askForTime: {type:Sequelize.DATE, allowNull:true}, //申请入党时间 --入党积极分子录入、入党申请录入
yubeiTime: {type:Sequelize.DATE, allowNull:true}, //列为预备党员时间 --预备党员录入
fzdxTime:{type:Sequelize.DATE, allowNull:true}, //列为发展对象时间 --发展对象党员录入
listedAsActivistsTime: {type:Sequelize.DATE, allowNull:true}, //列为积极分子时间 --入党积极分子录入
liaison: {type:Sequelize.STRING(100), allowNull:true, defaultValue:'[]'}, //联系人 --入党积极分子录入 "" --多选
talkTime: {type:Sequelize.DATE, allowNull:true}, //谈话时间 --入党申请录入
partyState: {type:Sequelize.INTEGER, allowNull:true, defaultValue:1}, //党员状态 1:在党、2:退党
isAdmin: {type:Sequelize.BOOLEAN, allowNull:true, defaultValue:false}, //是否为管理员
desc:{type:Sequelize.STRING(255), allowNull:true},
/**小程序登录 */
loginId: {type:Sequelize.STRING(11),allowNull:false}, //登录账号 默认手机号
pwd:{type:Sequelize.STRING(100), allowNull:false}, //密码 默认手机号后6位
......@@ -75,7 +78,7 @@ export const TablesConfig = [
]
},
{
tableNameCn:'支部制度表',
tableNameCn:'支部制度表', // success
tableName:'branchSystem',
schema:{
bsId: { //自增的支部制度id
......@@ -92,11 +95,13 @@ export const TablesConfig = [
fileName: {type:Sequelize.STRING(500), allowNull:true, defaultValue:'[]'}, //文件名称 ["",""] --多选
fileType: {type:Sequelize.INTEGER, allowNull:true}, //文件类型
uploadTime: {type:Sequelize.DATE, allowNull:true, defaultValue:Sequelize.NOW}, //上传时间
content:{type:Sequelize.STRING(500), allowNull:true, defaultValue:''}, //内容
periodTime: {type:Sequelize.DATE, allowNull:false}, //有效期
},
association: []
},
{
tableNameCn:'组织生活表',
tableNameCn:'组织生活表', // success
tableName:'organizationalLife',
schema:{
oId: { //自增的组织生活id
......@@ -106,18 +111,22 @@ export const TablesConfig = [
autoIncrement:true, //允许自增
unique:true //表示该列的值必须唯一
},
theme: {type:Sequelize.STRING(500), allowNull:false},//主题
themeType: {type:Sequelize.INTEGER, allowNull:false}, //主题类型
dataMonth: {type:Sequelize.DATE, allowNull:false}, //数据月份
bId: {type:Sequelize.INTEGER, allowNull:false}, //支部表id 外键
fileName: {type:Sequelize.STRING(500), allowNull:true, defaultValue:'[]'}, //文件名称 ["",""] --多选
fileType: {type:Sequelize.INTEGER, allowNull:true}, //文件类型
uploadTime: {type:Sequelize.DATE, allowNull:true, defaultValue:Sequelize.NOW}, //上传时间
partyActivityType:{type:Sequelize.INTEGER, allowNull:false}, //党建活动类型
activityStartTime:{type:Sequelize.DATE, allowNull:false}, //活动开始时间
activityEndTime:{type:Sequelize.DATE, allowNull:false}, //活动结束时间
activityAdd:{type:Sequelize.STRING, allowNull:false}, //活动地点
activityHost:{type:Sequelize.STRING, allowNull:false}, //活动主持人
activityNoteTaker:{type:Sequelize.STRING, allowNull:false}, //活动记录人
participatingPartyMember:{type:Sequelize.STRING, allowNull:false, defaultValue:'[]'}, //参与党员
leavePartyMember:{type:Sequelize.STRING, allowNull:false, defaultValue:'[]'}, //请假党员
signedInMember:{type:Sequelize.STRING, allowNull:false, defaultValue:'[]'}, //签到人员
activityLog:{type:Sequelize.STRING, allowNull:false}, //日志
},
association: []
},
{
tableNameCn:'专题活动表', //党建资讯
tableNameCn:'专题活动表', //党建资讯 success
tableName:'thematicActivities',
schema:{
taId: { //自增的专题活动id
......@@ -127,17 +136,17 @@ export const TablesConfig = [
autoIncrement:true, //允许自增
unique:true //表示该列的值必须唯一
},
theme: {type:Sequelize.STRING(500), allowNull:false},//主题
dataMonth: {type:Sequelize.DATE, allowNull:false}, //数据月份
bId: {type:Sequelize.INTEGER, allowNull:false}, //支部表id 外键
fileName: {type:Sequelize.STRING(500), allowNull:true, defaultValue:'[]'}, //文件名称 ["",""] --多选
fileType: {type:Sequelize.INTEGER, allowNull:true}, //文件类型
uploadTime: {type:Sequelize.DATE, allowNull:true, defaultValue:Sequelize.NOW}, //上传时间
activitiesType: {type:Sequelize.STRING(500), defaultValue:'[]' }, //类型
theme: {type:Sequelize.STRING(500), allowNull:false},//主题 标题
content:{type:Sequelize.STRING(500), allowNull:false},//内容
activitesTime:{type:Sequelize.DATE, allowNull:false}, //活动时间
img:{type:Sequelize.STRING(500), allowNull:false},//图片
},
association: []
},
{
tableNameCn:'党建动态表',
tableNameCn:'党建动态表',//弃用
tableName:'partyBuildingDynamic',
schema:{
pbId: { //自增的党建动态id
......@@ -170,14 +179,15 @@ export const TablesConfig = [
pmId: {type:Sequelize.STRING(100), allowNull:false}, //党员信息表id 外键
bId: {type:Sequelize.INTEGER, allowNull:false}, //支部表id 外键
payType: {type:Sequelize.INTEGER, allowNull:false, defaultValue:2}, //缴纳状态 1:已缴纳、2:未缴纳
payableMonth: {type:Sequelize.DATE, allowNull:false}, //应交月份
payableMonth: {type:Sequelize.INTEGER, allowNull:false}, //应交月份
payableYear:{type:Sequelize.INTEGER, allowNull:false}, //应交年份
payTime: {type:Sequelize.DATE, allowNull:true}, //缴费时间
payAmount: {type:Sequelize.INTEGER, allowNull:true}, //缴费金额(元)
},
association: []
},
{
tableNameCn:'党建先锋表',
tableNameCn:'党建先锋表', // success
tableName:'partyVanguard',
schema:{
pvId: { //自增的党建先锋id
......@@ -193,7 +203,9 @@ export const TablesConfig = [
grantingUnit: {type:Sequelize.STRING(100), allowNull:false}, //授予单位/个人
grantTime: {type:Sequelize.DATE, allowNull:false},//授予时间
bId: {type:Sequelize.INTEGER, allowNull:false}, //支部表id
img:{type:Sequelize.STRING(255), allowNull:false}, //图片
isUse: {type:Sequelize.BOOLEAN, allowNull:false, defaultValue:true}, //是否使用
content:{type:Sequelize.STRING(500), allowNull:false}, //介绍
},
association: []
},
......@@ -220,6 +232,7 @@ export const TablesConfig = [
uploadTime: {type:Sequelize.DATE, allowNull:true, defaultValue:Sequelize.NOW}, //上传时间
updateTime: {type:Sequelize.DATE, allowNull:true, defaultValue:Sequelize.NOW}, //更新时间
isDelete: {type:Sequelize.BOOLEAN, allowNull:false, defaultValue:false}, //是否删除
desc:{type:Sequelize.STRING(500), defaultValue:''}, //简介
},
association: [
{type: "hasMany", check: "rateLearning",foreignKey:"mlId"},
......@@ -245,7 +258,7 @@ export const TablesConfig = [
association: []
},
{
tableNameCn:'学习强国',
tableNameCn:'学习强国',//弃用
tableName:'learningPower',
schema:{
lpId: { //自增的党员学习id
......@@ -267,7 +280,7 @@ export const TablesConfig = [
association: []
},
{
tableNameCn:'三级指标', //党建质量的三级指标得分
tableNameCn:'三级指标', //党建质量的三级指标得分 success
tableName:'thirdLevel',
schema:{
tlId: { //自增的党建质量id
......@@ -289,5 +302,24 @@ export const TablesConfig = [
lock:{type:Sequelize.BOOLEAN, allowNull:false, defaultValue:false},//锁,上了之后不可编辑内容
},
association: []
}
},
{
tableNameCn:'党建通知',
tableName:'partyNotice',
schema:{
pnId: { //自增的党员学习id
type:Sequelize.INTEGER(20), //表示属性的数据类型
allowNull:false, //表示当前列是否允许为空, false表示该列不能为空
primaryKey:true, //表示主键
autoIncrement:true, //允许自增
unique:true //表示该列的值必须唯一
},
bId: {type:Sequelize.INTEGER, allowNull:false}, //支部表id 外键
noticeType: {type:Sequelize.INTEGER, allowNull:false}, //通知类型
title: {type:Sequelize.STRING(500), allowNull:false}, //标题
content: {type:Sequelize.STRING(500), allowNull:false}, //内容
dataTime: {type:Sequelize.DATE, allowNull:false}, //数据时间
},
association: []
},
];
\ No newline at end of file
import mongoose = require('mongoose');
// import mongoose = require('mongoose');
let defaultOptions = {
useNewUrlParser:true,
auto_reconnect:true,
// reconnectTries:1000,
// reconnectInterval:3000,
keepAlive: 1,
connectTimeoutMS: 3000,
useCreateIndex: true,
useUnifiedTopology: true
};
// let defaultOptions = {
// useNewUrlParser:true,
// auto_reconnect:true,
// // reconnectTries:1000,
// // reconnectInterval:3000,
// keepAlive: 1,
// connectTimeoutMS: 3000,
// useCreateIndex: true,
// useUnifiedTopology: true
// };
export async function createDbConnect(connectUrl:string, options?:object) {
if (!options) options = defaultOptions;
return await mongoose.createConnection(connectUrl, options).catch(
(err)=>{
throw err
});
}
// export async function createDbConnect(connectUrl:string, options?:object) {
// if (!options) options = defaultOptions;
// return await mongoose.createConnection(connectUrl, options).catch(
// (err)=>{
// throw err
// });
// }
......@@ -4,23 +4,23 @@
import { systemConfig } from "../../config/serverConfig";
import { BizError } from "../../util/bizError";
import { createDbConnect } from "./dbConnect";
// import { createDbConnect } from "./dbConnect";
let baseDB;
export async function initDB() {
//如果配置了mongoServerConstVal 才会连接mongo
if (systemConfig.mongodbStr) {
baseDB = await createDbConnect(systemConfig.mongodbStr).catch(err => {
throw err
});
// export async function initDB() {
// //如果配置了mongoServerConstVal 才会连接mongo
// if (systemConfig.mongodbStr) {
// baseDB = await createDbConnect(systemConfig.mongodbStr).catch(err => {
// throw err
// });
console.log('mongodb init success');
} else {
throw new BizError("xml中未配置mongo连接字符串 无法连接到mongodb");
}
// console.log('mongodb init success');
// } else {
// throw new BizError("xml中未配置mongo连接字符串 无法连接到mongodb");
// }
}
// }
export { baseDB };
\ No newline at end of file
import { initConfig, systemConfig} from "./config/serverConfig";
import * as mongoDB from "./db/mongo/dbInit";
import * as mysqlDB from "./db/mysql/mysqlInit";
import { initModel } from "./model/modelBind";
import { initMysqlModel } from "./model/sqlModelBind";
import { httpServer } from "./net/http_server";
async function lanuch() {
/**初始化配置解析 */
await initConfig();
/**初始化数据库 */
// await mongoDB.initDB();
// await initModel();
/**初始化sql */
await mysqlDB.initMysqlDB();
await initMysqlModel();
......
......@@ -2,10 +2,8 @@
* 总路由入口
*/
import * as mongoRouter from './mongoRouter';
import * as mysqlRouter from './mysqlRouter';
export function setRouter(httpServer){
mongoRouter.setRouter(httpServer);
mysqlRouter.setRouter(httpServer);
}
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