明树Git Lab

Commit 0c867a64 authored by zfp1's avatar zfp1

1

parent ccb3856e
/**
* 投后管理
*/
const errorMessage = require("../utils/errorMessage");
const _ = require("lodash");
const { Op } = require('sequelize');
const sequelize = require('sequelize');
const moment = require('moment');
const userModule = require('../module/userModule');
const projectModule = require('../module/projectModule');
async function createYyqtzhs(req, res, next) {
try {
if (!req.body.projectId) {
return res.sendError(errorMessage.paramsError);
}
//处理财务指标
let flattenArr = [];
let yyqtzhss = req.body.yyqtzhss || [[]]; //二维数组 多次上报
delete req.body.yyqtzhss;
for (let index = 0; index < yyqtzhss.length; index++) {
const element = yyqtzhss[index];
for (let i = 0; i < element.length; i++) {
let ei = element[i];
ei.groupBy = index;
ei.projectId = req.body.projectId;
flattenArr.push(ei);
}
}
delete req.body.yyqtzhss;
await DB.ThTzYyqtzhszb.bulkCreate(flattenArr);
let ret = await DB.ThTzYyqtzhs.create(req.body);
return res.sendData(ret);
} catch (error) {
next(error);
}
}
async function getYyqtzhsInfo(req, res, next) {
try {
let search = {};
if (req.body.id) {
search.id = req.body.id;
}
if (req.body.projectId) {
search.projectId = req.body.projectId;
}
if (_.isEmpty(search)) {
return res.sendError(errorMessage.paramsError);
}
let tzhs = await DB.ThTzYyqtzhs.findOne({ where: search, raw: true });
if (!(tzhs && tzhs.id && tzhs.projectId)) {
return res.sendError(errorMessage.resourceNotFound);
}
let yyqtzhss = await DB.ThTzYyqtzhszb.findAll({ where: { projectId: tzhs.projectId }, raw: true });
tzhs.yyqtzhss = _.values(_.groupBy(yyqtzhss, 'groupBy')) || [[]]
return res.sendData(tzhs);
} catch (error) {
next(error);
}
}
async function updateYyqtzhs(req, res, next) {
try {
if (!req.body.projectId) {
return res.sendError(errorMessage.paramsError);
}
let yyqtzhss = req.body.yyqtzhss || [[]]; //二维数组 多次上报
let ids3 = [], infos3 = [], newtyyqtzhss = [];
for (let index = 0; index < yyqtzhss.length; index++) {
const element = yyqtzhss[index];
for (let i = 0; i < element.length; i++) {
let ei = element[i];
ei.groupBy = index;
ei.projectId = req.body.projectId;
if (!ei.id) {
if (!_.isEmpty(ei)) {
newtyyqtzhss.push(ei);
}
} else {
ids3.push(ei.id); infos3.push(ei);
}
}
}
await DB.ThTzYyqtzhszb.destroy({ where: { projectId: req.body.projectId, id: { [Op.notIn]: ids3 } } }); // 删除id不在传入id数组里面的(用户在界面删除的)
await DB.ThTzYyqtzhszb.bulkCreate(newtyyqtzhss);//创建新的 没有id的
await Promise.all(infos3.map(item => { DB.ThTzYyqtzhszb.update(item, { where: { id: item.id } }) }));
delete req.body.yyqtzhss;
await DB.ThTzYyqtzhs.update(req.body, { where: { id: req.body.id } });
return res.sendData({});
} catch (error) {
next(error);
}
}
async function getYyqtzhsList(req, res, next) {
try {
let page = req.body.page || 1;
let limit = req.body.pagesize || req.body.pageSize || 10;
let offset = (page - 1) * limit;
let search = {};
search.order = [['createdAt', 'DESC']];
search.limit = limit;
search.offset = offset;
let where = { del: 0 };
if (req.body.projectName) {
where = {
[Op.or]: [
{ projectName: { [Op.like]: `%${req.body.projectName}%` } },
],
del: 0
}
}
search.where = where;
if (req.body.attributes && req.body.attributes.length) {
search.attributes = req.body.attributes;
}
let ret = await DB.ThTzYyqtzhs.findAndCountAll(search);
return res.sendData(ret);
} catch (error) {
next(error);
}
}
async function createYyqtzjc(req, res, next) {
try {
if (!req.body.projectId) {
return res.sendError(errorMessage.paramsError);
}
//日常自查 投资(成本)分析会
let yyqtzjcTzfxs = req.body.yyqtzjcTzfxs || [];
let newyyqtzjcTzfxs = [];
for (let index = 0; index < yyqtzjcTzfxs.length; index++) {
let element = yyqtzjcTzfxs[index];
element.projectId = req.body.projectId;
element.tzcbfxhzl = (element.tzcbfxhzl || []).map(o => { return o && o.id || o });
newyyqtzjcTzfxs.push(element);
}
delete req.body.yyqtzjcTzfxs;
//日常检查
let yyqtzjcrcjcs = req.body.yyqtzjcrcjcs || [];
let newyyqtzjcrcjcs = [];
for (let index = 0; index < yyqtzjcrcjcs.length; index++) {
let element = yyqtzjcrcjcs[index];
element.projectId = req.body.projectId;
element.fxcl = (element.fxcl || []).map(o => { return o && o.id || o });
newyyqtzjcrcjcs.push(element);
}
delete req.body.yyqtzjcrcjcs;
//专项检查
let yyqtzjcZxjcs = req.body.yyqtzjcZxjcs || [];
let newyyqtzjcZxjcs = [];
for (let index = 0; index < yyqtzjcZxjcs.length; index++) {
let element = yyqtzjcZxjcs[index];
element.projectId = req.body.projectId;
element.fjcl = (element.fjcl || []).map(o => { return o && o.id || o });
newyyqtzjcZxjcs.push(element);
}
delete req.body.yyqtzjcZxjcs;
//创建
await DB.ThTzYyqtzjcTzfx.bulkCreate(yyqtzjcTzfxs);
await DB.ThTzYyqtzjcrcjc.bulkCreate(yyqtzjcrcjcs);
await DB.ThTzYyqtzjcZxjc.bulkCreate(yyqtzjcZxjcs);
let ret = await DB.ThTzYyqtzjc.create(req.body);
return res.sendData(ret);
} catch (error) {
next(error);
}
}
async function getYyqtzjcInfo(req, res, next) {
try {
let search = {};
if (req.body.id) {
search.id = req.body.id;
}
if (req.body.projectId) {
search.projectId = req.body.projectId;
}
if (_.isEmpty(search)) {
return res.sendError(errorMessage.paramsError);
}
let jsqtzjc = await DB.ThTzYyqtzjc.findOne({ where: search, raw: true });
if (!(jsqtzjc && jsqtzjc.id && jsqtzjc.projectId)) {
return res.sendError(errorMessage.resourceNotFound);
}
let newyyqtzjcTzfxs = [], newyyqtzjcrcjcs = [], newyyqtzjcZxjcs = [];
let yyqtzjcTzfxs = await DB.ThTzYyqtzjcTzfx.findAll({ where: { projectId: jsqtzjc.projectId }, raw: true });
for (let index = 0; index < yyqtzjcTzfxs.length; index++) {
let element = yyqtzjcTzfxs[index];
// fileids.concat(element.tzcbfxhzl || []);
element.tzcbfxhzl = await DB.File.findAll({ where: { id: { [Op.in]: element.tzcbfxhzl } } });
newyyqtzjcTzfxs.push(element);
}
let yyqtzjcrcjcs = await DB.ThTzYyqtzjcrcjc.findAll({ where: { projectId: jsqtzjc.projectId }, raw: true });
for (let index = 0; index < yyqtzjcrcjcs.length; index++) {
const element = yyqtzjcrcjcs[index];
// fileids.concat(element.fxcl || []);
element.fxcl = await DB.File.findAll({ where: { id: { [Op.in]: element.fxcl } } });
newyyqtzjcrcjcs.push(element);
}
let yyqtzjcZxjcs = await DB.ThTzYyqtzjcZxjc.findAll({ where: { projectId: jsqtzjc.projectId }, raw: true });
for (let index = 0; index < yyqtzjcZxjcs.length; index++) {
const element = yyqtzjcZxjcs[index];
// fileids.concat(element.fjcl || []);
element.fjcl = await DB.File.findAll({ where: { id: { [Op.in]: element.fjcl } } });
newyyqtzjcZxjcs.push(element);
}
jsqtzjc.yyqtzjcTzfxs = newyyqtzjcTzfxs;
jsqtzjc.yyqtzjcrcjcs = newyyqtzjcrcjcs;
jsqtzjc.yyqtzjcZxjcs = newyyqtzjcZxjcs;
return res.sendData(jsqtzjc);
} catch (error) {
next(error);
}
}
async function updateYyqtzjc(req, res, next) {
try {
if (!req.body.projectId) {
return res.sendError(errorMessage.paramsError);
}
let yyqtzjcTzfxs = req.body.yyqtzjcTzfxs || [];
let ids = [], newArr = [], info = [];
for (let index = 0; index < yyqtzjcTzfxs.length; index++) {
let element = yyqtzjcTzfxs[index];
element.projectId = req.body.projectId;
element.tzcbfxhzl = (element.tzcbfxhzl || []).map(o => { return o && o.id || o });
if (element.id) {
ids.push(element.id);
info.push(element);
} else {
newArr.push(element);
}
}
await DB.ThTzYyqtzjcTzfx.destroy({ where: { projectId: req.body.projectId, id: { [Op.notIn]: ids } } }); // 删除id不在传入id数组里面的(用户在界面删除的)
await DB.ThTzYyqtzjcTzfx.bulkCreate(newArr);//创建新的 没有id的
await Promise.all(info.map(item => { DB.ThTzYyqtzjcTzfx.update(item, { where: { id: item.id } }) }));
delete req.body.yyqtzjcTzfxs;
let yyqtzjcrcjcs = req.body.yyqtzjcrcjcs || [];
let ids1 = [], newArr1 = [], info1 = [];
for (let index = 0; index < yyqtzjcrcjcs.length; index++) {
let element = yyqtzjcrcjcs[index];
element.projectId = req.body.projectId;
element.fxcl = (element.fxcl || []).map(o => { return o && o.id || o });
if (element.id) {
ids1.push(element.id);
info1.push(element);
} else {
newArr1.push(element);
}
}
await DB.ThTzYyqtzjcrcjc.destroy({ where: { projectId: req.body.projectId, id: { [Op.notIn]: ids1 } } }); // 删除id不在传入id数组里面的(用户在界面删除的)
await DB.ThTzYyqtzjcrcjc.bulkCreate(newArr1);//创建新的 没有id的
await Promise.all(info1.map(item => { DB.ThTzYyqtzjcrcjc.update(item, { where: { id: item.id } }) }));
delete req.body.yyqtzjcrcjcs;
let yyqtzjcZxjcs = req.body.yyqtzjcZxjcs || [];
let ids2 = [], newArr2 = [], info2 = [];
for (let index = 0; index < yyqtzjcZxjcs.length; index++) {
let element = yyqtzjcZxjcs[index];
element.projectId = req.body.projectId;
element.fjcl = (element.fjcl || []).map(o => { return o && o.id || o });
if (element.id) {
ids2.push(element.id);
info2.push(element);
} else {
newArr2.push(element);
}
}
await DB.ThTzYyqtzjcZxjc.destroy({ where: { projectId: req.body.projectId, id: { [Op.notIn]: ids2 } } }); // 删除id不在传入id数组里面的(用户在界面删除的)
await DB.ThTzYyqtzjcZxjc.bulkCreate(newArr2);//创建新的 没有id的
await Promise.all(info2.map(item => { DB.ThTzYyqtzjcZxjc.update(item, { where: { id: item.id } }) }));
delete req.body.yyqtzjcZxjcs;
await DB.ThTzYyqtzjc.update(req.body, { where: { id: req.body.id } });
return res.sendData({});
} catch (error) {
next(error);
}
}
async function getYyqtzjcList(req, res, next) {
try {
let page = req.body.page || 1;
let limit = req.body.pagesize || req.body.pageSize || 10;
let offset = (page - 1) * limit;
let search = {};
search.order = [['createdAt', 'DESC']];
search.limit = limit;
search.offset = offset;
let where = { del: 0 };
// if (req.body.projectName) {
// where = {
// [Op.or]: [
// { projectName: { [Op.like]: `%${req.body.projectName}%` } },
// ],
// del: 0
// }
// }
search.where = where;
if (req.body.attributes && req.body.attributes.length) {
search.attributes = req.body.attributes;
}
let ret = await DB.ThTzYyqtzjc.findAndCountAll(search);
return res.sendData(ret);
} catch (error) {
next(error);
}
}
async function createTzhpj(req, res, next) {
try {
if (!req.body.projectId) {
return res.sendError(errorMessage.paramsError);
}
req.body.xmgszcbg = (req.body.xmgszcbg || []).map(o => { return o && o.id || o });
req.body.hpjbg = (req.body.hpjbg || []).map(o => { return o && o.id || o });
req.body.qsmzqpj = (req.body.qsmzqpj || []).map(o => { return o && o.id || o });
let tzhpjwtzgs = (req.body.tzhpjwtzgs || []).map(o => {o.projectId = req.body.projectId; return o});
await DB.ThTzhpjwtzg.bulkCreate(tzhpjwtzgs);
delete req.body.tzhpjwtzgs;
let ret = await DB.ThTzhpj.create(req.body);
return res.sendData(ret);
} catch (error) {
next(error);
}
}
async function updateTzhpj(req, res, next) {
try {
req.body.xmgszcbg = (req.body.xmgszcbg || []).map(o => { return o && o.id || o });
req.body.hpjbg = (req.body.hpjbg || []).map(o => { return o && o.id || o });
req.body.qsmzqpj = (req.body.qsmzqpj || []).map(o => { return o && o.id || o });
let tzhpjwtzgs = req.body.tzhpjwtzgs || [];
let ids1 = [], newArr1 = [], info1 = [];
for (let index = 0; index < tzhpjwtzgs.length; index++) {
let element = tzhpjwtzgs[index];
element.projectId = req.body.projectId;
if (element.id) {
ids1.push(element.id);
info1.push(element);
} else {
newArr1.push(element);
}
}
await DB.ThTzhpjwtzg.destroy({ where: { projectId: req.body.projectId, id: { [Op.notIn]: ids1 } } }); // 删除id不在传入id数组里面的(用户在界面删除的)
await DB.ThTzhpjwtzg.bulkCreate(newArr1);//创建新的 没有id的
await Promise.all(info1.map(item => { DB.ThTzhpjwtzg.update(item, { where: { id: item.id } }) }));
delete req.body.tzhpjwtzgs;
await DB.ThTzhpj.update(req.body, { where: { id: req.body.id } });
return res.sendData();
} catch (error) {
next(error);
}
}
async function getTzhpjList(req, res, next) {
try {
let page = req.body.page || 1;
let limit = req.body.pagesize || req.body.pageSize || 10;
let offset = (page - 1) * limit;
let search = {};
search.order = [['createdAt', 'DESC']];
search.limit = limit;
search.offset = offset;
let where = { del: 0 };
// if (req.body.projectName) {
// where = {
// [Op.or]: [
// { projectName: { [Op.like]: `%${req.body.projectName}%` } },
// ],
// del: 0
// }
// }
search.where = where;
if (req.body.attributes && req.body.attributes.length) {
search.attributes = req.body.attributes;
}
let ret = await DB.ThTzhpj.findAndCountAll(search);
return res.sendData(ret);
} catch (error) {
next(error);
}
}
async function getTzhpjInfo(req, res, next) {
try {
let search = {};
if (req.body.id) {
search.id = req.body.id;
}
if (req.body.projectId) {
search.projectId = req.body.projectId;
}
if (_.isEmpty(search)) {
return res.sendError(errorMessage.paramsError);
}
let tzhpj = await DB.ThTzhpj.findOne({ where: search, raw: true });
if (!(tzhpj && tzhpj.id)) {
return res.sendError(errorMessage.resourceNotFound);
}
let fileIds = [].concat(tzhpj.xmgszcbg).concat(tzhpj.hpjbg).concat(tzhpj.qsmzqpj);
let files = await DB.File.findAll({ where: { id: { [Op.in]: fileIds } }, raw: true });
let fileMap = [];
for (let index = 0; index < files.length; index++) {
const element = files[index];
fileMap[element.id] = element;
}
tzhpj.xmgszcbg = (tzhpj.xmgszcbg || []).map(o => { return fileMap[o] });
tzhpj.hpjbg = tzhpj.hpjbg.map(o => { return fileMap[o] });
tzhpj.qsmzqpj = tzhpj.qsmzqpj.map(o => { return fileMap[o] });
tzhpj.tzhpjwtzgs = await DB.ThTzhpjwtzg.findAll({where: {projectId: tzhpj.projectId}, raw: true});
return res.sendData(tzhpj);
} catch (error) {
next(error);
}
}
async function createYjgl(req, res, next) {
try {
//
req.body.zbyzyj = (req.body.zbyzyj || []).map(o => {return o && o.id || o});
req.body.qzlyzzyj = (req.body.qzlyzzyj || []).map(o => {return o && o.id || o});
req.body.qmyj = (req.body.qmyj || []).map(o => {return o && o.id || o});
let ret = await DB.ThYjgl.create(req.body);
return res.sendData(ret);
} catch (error) {
next(error);
}
}
async function updateYjgl(req, res, next) {
try {
req.body.zbyzyj = (req.body.zbyzyj || []).map(o => {return o && o.id || o});
req.body.qzlyzzyj = (req.body.qzlyzzyj || []).map(o => {return o && o.id || o});
req.body.qmyj = (req.body.qmyj || []).map(o => {return o && o.id || o});
await DB.ThYjgl.update(req.body, {where: {id: req.body.id}});
return res.sendData();
} catch (error) {
next(error);
}
}
async function getYjglList(req, res, next) {
try {
let page = req.body.page || 1;
let limit = req.body.pagesize || req.body.pageSize || 10;
let offset = (page - 1) * limit;
let search = {};
search.order = [['createdAt', 'DESC']];
search.limit = limit;
search.offset = offset;
let where = { del: 0 };
// if (req.body.projectName) {
// where = {
// [Op.or]: [
// { projectName: { [Op.like]: `%${req.body.projectName}%` } },
// ],
// del: 0
// }
// }
search.where = where;
if (req.body.attributes && req.body.attributes.length) {
search.attributes = req.body.attributes;
}
let ret = await DB.ThYjgl.findAndCountAll(search);
return res.sendData(ret);
} catch (error) {
next(error);
}
}
async function getYjglInfo(req, res, next) {
try {
let search = {};
if (req.body.id) {
search.id = req.body.id;
}
if (req.body.projectId) {
search.projectId = req.body.projectId;
}
if (_.isEmpty(search)) {
return res.sendError(errorMessage.paramsError);
}
let yjgl = await DB.ThYjgl.findOne({ where: search, raw: true });
if (!(yjgl && yjgl.id)) {
return res.sendError(errorMessage.resourceNotFound);
}
let fileIds = [].concat(yjgl.zbyzyj).concat(yjgl.qzlyzzyj).concat(yjgl.qmyj);
let files = await DB.File.findAll({ where: { id: { [Op.in]: fileIds } }, raw: true });
let fileMap = [];
for (let index = 0; index < files.length; index++) {
const element = files[index];
fileMap[element.id] = element;
}
yjgl.zbyzyj = (yjgl.zbyzyj || []).map(o => { return fileMap[o] });
yjgl.qzlyzzyj = yjgl.qzlyzzyj.map(o => { return fileMap[o] });
yjgl.qmyj = yjgl.qmyj.map(o => { return fileMap[o] });
return res.sendData(yjgl);
} catch (error) {
next(error);
}
}
module.exports = {
createYyqtzhs,
updateYyqtzhs,
getYyqtzhsList,
getYyqtzhsInfo,
createYyqtzjc,
updateYyqtzjc,
getYyqtzjcList,
getYyqtzjcInfo,
createTzhpj,
updateTzhpj,
getTzhpjList,
getTzhpjInfo,
createYjgl,
updateYjgl,
getYjglList,
getYjglInfo,
}
\ No newline at end of file
......@@ -64,6 +64,15 @@ const TzZdsxspfl = require("./model/jt/tzZdsxspfl");
const TzXmtc = require("./model/jt/tzXmtc");
const TzXmtcCwzb = require("./model/jt/tzXmtcCwzb");
const ThTzhpj = require('./model/jt/thTzhpj');
const ThTzhpjwtzg = require('./model/jt/thTzhpjwtzg');
const ThYyqtzhs = require('./model/jt/thYyqtzhs');
const ThYyqtzhszb = require('./model/jt/thYyqtzhszb');
const ThYyqtzjc = require('./model/jt/thYyqtzjc');
const ThYyqtzjcTzfx = require('./model/jt/thYyqtzjcTzfx');
const ThYyqtzjcZxjc = require('./model/jt/thYyqtzjcZxjc');
const ThYyqtzjcrcjc = require('./model/jt/thYyqtzjcrcjc');
/**
* 业务表
*/
......@@ -124,6 +133,15 @@ global.DB = {
TzZdsxspfl,
TzXmtc,
TzXmtcCwzb,
ThTzhpj,
ThTzhpjwtzg,
ThYyqtzhs,
ThYyqtzhszb,
ThYyqtzjc,
ThYyqtzjcTzfx,
ThYyqtzjcZxjc,
ThYyqtzjcrcjc,
}
......
const { DataTypes } = require('sequelize');
const sequelize = require('../index');
const moment = require('moment');
//投中管理- 建设期投资检查
const ThTzhpj = sequelize.define('ThTzhpj', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
projectName: {
type: DataTypes.STRING,
comment: "项目名称",
},
xmgszcbg: {
type: DataTypes.JSON,
comment: "项目公司自查报告",
},
hpjbg: {
type: DataTypes.JSON,
comment: "后评价报告",
},
qsmzqpj: {
type: DataTypes.JSON,
comment: "全生命周期评价",
},
projectId: {
type: DataTypes.INTEGER,
comment: "所属项目ID",
},
del: {
type: DataTypes.INTEGER,
defaultValue: 0,
comment: "0 正常 1 删除"
},
createdAt: {
type: DataTypes.DATE,
defaultValue: new Date(),
get() {
const rawValue = this.getDataValue('createdAt');
return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
}
},
updatedAt: { // 同样处理 updatedAt
type: DataTypes.DATE,
defaultValue: new Date(),
get() {
const rawValue = this.getDataValue('updatedAt');
return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
}
}
}, {
tableName: 'jt_th_tzhpj', // 指定表名(如果与模型名不同)
timestamps: true, // 是否自动添加 createdAt 和 updatedAt 字段(覆盖全局设置)
});
// 同步模型到数据库(创建表)
ThTzhpj.sync({
force: false,
// force: true ,//会删除已存在表并重新创建
// alter: true
})
.then(() => {
console.log('ThTzhpj 表同步成功');
});
module.exports = ThTzhpj;
\ No newline at end of file
const { DataTypes } = require('sequelize');
const sequelize = require('../index');
const moment = require('moment');
//投中管理- 建设期投资检查
const ThTzhpjwtzg = sequelize.define('ThTzhpjwtzg', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
ccwt: {
type: DataTypes.TEXT,
comment: "存在的问题",
},
wtxs: {
type: DataTypes.TEXT,
comment: "问题详述",
},
zgcs: {
type: DataTypes.TEXT,
comment: "整改措施",
},
lsqk: {
type: DataTypes.TEXT,
comment: "落实情况",
},
zrbm: {
type: DataTypes.STRING,
comment: "责任部门",
},
zrr: {
type: DataTypes.STRING,
comment: "责任人",
},
zgqx: {
type: DataTypes.DATE,
comment: "整改期限",
},
sfgb: {
type: DataTypes.INTEGER,
comment: "是否关闭",
},
projectId: {
type: DataTypes.INTEGER,
comment: "所属项目ID",
},
del: {
type: DataTypes.INTEGER,
defaultValue: 0,
comment: "0 正常 1 删除"
},
createdAt: {
type: DataTypes.DATE,
defaultValue: new Date(),
get() {
const rawValue = this.getDataValue('createdAt');
return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
}
},
updatedAt: { // 同样处理 updatedAt
type: DataTypes.DATE,
defaultValue: new Date(),
get() {
const rawValue = this.getDataValue('updatedAt');
return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
}
}
}, {
tableName: 'jt_th_tzhpjwtzg', // 指定表名(如果与模型名不同)
timestamps: true, // 是否自动添加 createdAt 和 updatedAt 字段(覆盖全局设置)
});
// 同步模型到数据库(创建表)
ThTzhpjwtzg.sync({
force: false,
// force: true ,//会删除已存在表并重新创建
// alter: true
})
.then(() => {
console.log('ThTzhpjwtzg 表同步成功');
});
module.exports = ThTzhpjwtzg;
\ No newline at end of file
const { DataTypes } = require('sequelize');
const sequelize = require('../index');
const moment = require('moment');
//投中管理- 建设期投资检查
const ThYjgl = sequelize.define('ThYjgl', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
projectName: {
type: DataTypes.STRING,
comment: "项目名称",
},
zbyzyj: {
type: DataTypes.JSON,
comment: "资本运作移交",
},
qzlyzzyj: {
type: DataTypes.JSON,
comment: "期中履约终止移交",
},
qmyj: {
type: DataTypes.JSON,
comment: "期满移交",
},
projectId: {
type: DataTypes.INTEGER,
comment: "所属项目ID",
},
del: {
type: DataTypes.INTEGER,
defaultValue: 0,
comment: "0 正常 1 删除"
},
createdAt: {
type: DataTypes.DATE,
defaultValue: new Date(),
get() {
const rawValue = this.getDataValue('createdAt');
return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
}
},
updatedAt: { // 同样处理 updatedAt
type: DataTypes.DATE,
defaultValue: new Date(),
get() {
const rawValue = this.getDataValue('updatedAt');
return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
}
}
}, {
tableName: 'jt_th_yjgl', // 指定表名(如果与模型名不同)
timestamps: true, // 是否自动添加 createdAt 和 updatedAt 字段(覆盖全局设置)
});
// 同步模型到数据库(创建表)
ThYjgl.sync({
force: false,
// force: true ,//会删除已存在表并重新创建
// alter: true
})
.then(() => {
console.log('ThYjgl 表同步成功');
});
module.exports = ThYjgl;
\ No newline at end of file
const { DataTypes } = require('sequelize');
const sequelize = require('../index');
const moment = require('moment');
/**
* 投中管理- 建设期投资回收
*/
const ThYyqtzhs = sequelize.define('ThYyqtzhs', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
projectName: {
type: DataTypes.STRING,
comment: "项目名称",
},
projectId: {
type: DataTypes.INTEGER,
comment: "所属项目ID",
},
del: {
type: DataTypes.INTEGER,
defaultValue: 0,
comment: "0 正常 1 删除"
},
createdAt: {
type: DataTypes.DATE,
defaultValue: new Date(),
get() {
const rawValue = this.getDataValue('createdAt');
return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
}
},
updatedAt: { // 同样处理 updatedAt
type: DataTypes.DATE,
defaultValue: new Date(),
get() {
const rawValue = this.getDataValue('updatedAt');
return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
}
}
}, {
tableName: 'jt_th_yyqtzhs', // 指定表名(如果与模型名不同)
timestamps: true, // 是否自动添加 createdAt 和 updatedAt 字段(覆盖全局设置)
});
// 同步模型到数据库(创建表)
ThYyqtzhs.sync({
// force: false,
// force: true ,//会删除已存在表并重新创建
alter: true
})
.then(() => {
console.log('ThYyqtzhs 表同步成功');
});
module.exports = ThYyqtzhs;
\ No newline at end of file
const { DataTypes } = require('sequelize');
const sequelize = require('../index');
const moment = require('moment');
/**
* 投中管理- 建设期投资回收关联表
*/
const ThYyqtzhszb = sequelize.define('ThYyqtzhszb', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
year: {
type: DataTypes.DATE,
comment: "年份",
},
month: {
type: DataTypes.INTEGER,
comment: "月份",
},
xh: {
type: DataTypes.STRING,
comment: "序号",
},
ndtzhsmb: {
type: DataTypes.DECIMAL(20, 2),
comment: "年度投资回收目标"
},
dyhs: {
type: DataTypes.DECIMAL(20, 2),
comment: "当月回收"
},
dyljhs: {
type: DataTypes.DECIMAL(20, 2),
comment: "当月累计回收"
},
ndjhwcl: {
type: DataTypes.DECIMAL(5, 2),
comment: "年度计划完成率 %"
},
bz: {
type: DataTypes.TEXT,
comment: "备注",
},
groupBy: {
type: DataTypes.INTEGER,
comment: "分组"
},
projectId: {
type: DataTypes.INTEGER,
comment: "所属项目ID",
},
del: {
type: DataTypes.INTEGER,
defaultValue: 0,
comment: "0 正常 1 删除"
},
createdAt: {
type: DataTypes.DATE,
defaultValue: new Date(),
get() {
const rawValue = this.getDataValue('createdAt');
return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
}
},
updatedAt: { // 同样处理 updatedAt
type: DataTypes.DATE,
defaultValue: new Date(),
get() {
const rawValue = this.getDataValue('updatedAt');
return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
}
}
}, {
tableName: 'jt_th_yyqtzhszb', // 指定表名(如果与模型名不同)
timestamps: true, // 是否自动添加 createdAt 和 updatedAt 字段(覆盖全局设置)
});
// 同步模型到数据库(创建表)
ThYyqtzhszb.sync({
// force: false,
// force: true ,//会删除已存在表并重新创建
alter: true
})
.then(() => {
console.log('ThYyqtzhszb 表同步成功');
});
module.exports = ThYyqtzhszb;
\ No newline at end of file
const { DataTypes } = require('sequelize');
const sequelize = require('../index');
const moment = require('moment');
//投中管理- 建设期投资检查
const ThYyqtzjc = sequelize.define('ThYyqtzjc', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
projectName: {
type: DataTypes.STRING,
comment: "项目名称",
},
jcztz: {
type: DataTypes.DECIMAL(20, 2),
comment: "决策总投资 一次填报锁定"
},
zbjnbsyl: {
type: DataTypes.DECIMAL(5, 2),
comment: "资本金内部收益率(%) 一次填报锁定"
},
ycztz: {
type: DataTypes.DECIMAL(20, 2),
comment: "预测总投资"
},
qrztz: {
type: DataTypes.DECIMAL(20, 2),
comment: "确认总投资"
},
// zbjnbsyl: { // 重复了 应该是文档有错误
// type: DataTypes.DECIMAL(5, 2),
// comment: "资本金内部收益率"
// },
projectId: {
type: DataTypes.INTEGER,
comment: "所属项目ID",
},
del: {
type: DataTypes.INTEGER,
defaultValue: 0,
comment: "0 正常 1 删除"
},
createdAt: {
type: DataTypes.DATE,
defaultValue: new Date(),
get() {
const rawValue = this.getDataValue('createdAt');
return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
}
},
updatedAt: { // 同样处理 updatedAt
type: DataTypes.DATE,
defaultValue: new Date(),
get() {
const rawValue = this.getDataValue('updatedAt');
return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
}
}
}, {
tableName: 'jt_th_yyqtzjc', // 指定表名(如果与模型名不同)
timestamps: true, // 是否自动添加 createdAt 和 updatedAt 字段(覆盖全局设置)
});
// 同步模型到数据库(创建表)
ThYyqtzjc.sync({
force: false,
// force: true ,//会删除已存在表并重新创建
// alter: true
})
.then(() => {
console.log('ThYyqtzjc 表同步成功');
});
module.exports = ThYyqtzjc;
\ No newline at end of file
const { DataTypes } = require('sequelize');
const sequelize = require('../index');
const moment = require('moment');
//投中管理- 建设期投资检查 ---投资(成本)分析会资料
const ThYyqtzjcTzfx = sequelize.define('ThYyqtzjcTzfx', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
jd: {
type: DataTypes.STRING,
comment: "季度",
},
ycztz: {
type: DataTypes.DECIMAL(20, 2),
comment: "当期预测总投资"
},
zbjnbsyl: {
type: DataTypes.DECIMAL(5, 2),
comment: "当期资本金内部收益率"
},
tzcbfxhzl: {
type: DataTypes.JSON,
comment: "投资(成本)分析会资料"
},
projectId: {
type: DataTypes.INTEGER,
comment: "所属项目ID",
},
del: {
type: DataTypes.INTEGER,
defaultValue: 0,
comment: "0 正常 1 删除"
},
createdAt: {
type: DataTypes.DATE,
defaultValue: new Date(),
get() {
const rawValue = this.getDataValue('createdAt');
return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
}
},
updatedAt: { // 同样处理 updatedAt
type: DataTypes.DATE,
defaultValue: new Date(),
get() {
const rawValue = this.getDataValue('updatedAt');
return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
}
}
}, {
tableName: 'jt_th_yyqtzjcTzfx', // 指定表名(如果与模型名不同)
timestamps: true, // 是否自动添加 createdAt 和 updatedAt 字段(覆盖全局设置)
});
// 同步模型到数据库(创建表)
ThYyqtzjcTzfx.sync({
force: false,
// force: true ,//会删除已存在表并重新创建
// alter: true
})
.then(() => {
console.log('ThYyqtzjcTzfx 表同步成功');
});
module.exports = ThYyqtzjcTzfx;
\ No newline at end of file
const { DataTypes } = require('sequelize');
const sequelize = require('../index');
const moment = require('moment');
//投中管理- 建设期投资检查 ---日常检查 对投资目标偏差每半年进行一次系统盘点,上传分析材料
const ThYyqtzjcZxjc = sequelize.define('ThYyqtzjcZxjc', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
zxjcfl: {
type: DataTypes.INTEGER,
comment: "专项检查分类 1 能建投资检查、2 葛洲坝集团投资检查、3 公司投资检查、4 其他投资检查"
},
kssj: {
type: DataTypes.DATE,
comment: "开始时间",
get() {
const rawValue = this.getDataValue('kssj');
return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
}
},
jssj: {
type: DataTypes.DATE,
comment: "结束时间",
get() {
const rawValue = this.getDataValue('jssj');
return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
}
},
fjcl: {
type: DataTypes.JSON,
comment: "附件材料"
},
projectId: {
type: DataTypes.INTEGER,
comment: "所属项目ID",
},
del: {
type: DataTypes.INTEGER,
defaultValue: 0,
comment: "0 正常 1 删除"
},
createdAt: {
type: DataTypes.DATE,
defaultValue: new Date(),
get() {
const rawValue = this.getDataValue('createdAt');
return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
}
},
updatedAt: { // 同样处理 updatedAt
type: DataTypes.DATE,
defaultValue: new Date(),
get() {
const rawValue = this.getDataValue('updatedAt');
return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
}
}
}, {
tableName: 'jt_th_yyqtzjcZxjc', // 指定表名(如果与模型名不同)
timestamps: true, // 是否自动添加 createdAt 和 updatedAt 字段(覆盖全局设置)
});
// 同步模型到数据库(创建表)
ThYyqtzjcZxjc.sync({
// force: false,
// force: true ,//会删除已存在表并重新创建
alter: true
})
.then(() => {
console.log('ThYyqtzjcZxjc 表同步成功');
});
module.exports = ThYyqtzjcZxjc;
\ No newline at end of file
const { DataTypes } = require('sequelize');
const sequelize = require('../index');
const moment = require('moment');
//投中管理- 建设期投资检查 ---日常检查 对投资目标偏差每半年进行一次系统盘点,上传分析材料
const ThYyqtzjcrcjc = sequelize.define('ThYyqtzjcrcjc', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
kssj: {
type: DataTypes.DATE,
comment: "开始时间",
get() {
const rawValue = this.getDataValue('kssj');
return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
}
},
jssj: {
type: DataTypes.DATE,
comment: "结束时间",
get() {
const rawValue = this.getDataValue('jssj');
return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
}
},
pdnrsm: {
type: DataTypes.TEXT,
comment: "盘点内容说明"
},
fxcl: {
type: DataTypes.JSON,
comment: "分析材料"
},
projectId: {
type: DataTypes.INTEGER,
comment: "所属项目ID",
},
del: {
type: DataTypes.INTEGER,
defaultValue: 0,
comment: "0 正常 1 删除"
},
createdAt: {
type: DataTypes.DATE,
defaultValue: new Date(),
get() {
const rawValue = this.getDataValue('createdAt');
return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
}
},
updatedAt: { // 同样处理 updatedAt
type: DataTypes.DATE,
defaultValue: new Date(),
get() {
const rawValue = this.getDataValue('updatedAt');
return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
}
}
}, {
tableName: 'jt_th_yyqtzjcrcjc', // 指定表名(如果与模型名不同)
timestamps: true, // 是否自动添加 createdAt 和 updatedAt 字段(覆盖全局设置)
});
// 同步模型到数据库(创建表)
ThYyqtzjcrcjc.sync({
// force: false,
// force: true ,//会删除已存在表并重新创建
alter: true
})
.then(() => {
console.log('ThYyqtzjcrcjc 表同步成功');
});
module.exports = ThYyqtzjcrcjc;
\ No newline at end of file
......@@ -67,9 +67,9 @@ const TzJsqtzjc = sequelize.define('TzJsqtzjc', {
// 同步模型到数据库(创建表)
TzJsqtzjc.sync({
force: false,
// force: false,
// force: true ,//会删除已存在表并重新创建
// alter: true
alter: true
})
.then(() => {
console.log('TzJsqtzjc 表同步成功');
......
......@@ -5,6 +5,7 @@ const router = express.Router();
const projectController = require('../controller/projectController');
const projectTzController = require('../controller/projectTzController');
const projectThController = require('../controller/projectThController');
/**
* 项目相关
......@@ -92,4 +93,30 @@ router.post('/getXmtcList', projectTzController.getXmtcList);
router.post('/getXmtcInfo', projectTzController.getXmtcInfo);
/**
* 投后
*/
//运营期投资回收
router.post('/createYyqtzhs', projectThController.createYyqtzhs);
router.post('/updateYyqtzhs', projectThController.updateYyqtzhs);
router.post('/getYyqtzhsList', projectThController.getYyqtzhsList);
router.post('/getYyqtzhsInfo', projectThController.getYyqtzhsInfo);
// 运营期投资检查
router.post('/createYyqtzjc', projectThController.createYyqtzjc);
router.post('/updateYyqtzjc', projectThController.updateYyqtzjc);
router.post('/getYyqtzjcList', projectThController.getYyqtzjcList);
router.post('/getYyqtzjcInfo', projectThController.getYyqtzjcInfo);
//投资后评价
router.post('/createTzhpj', projectThController.createTzhpj);
router.post('/updateTzhpj', projectThController.updateTzhpj);
router.post('/getTzhpjList', projectThController.getTzhpjList);
router.post('/getTzhpjInfo', projectThController.getTzhpjInfo);
//移交管理
router.post('/createYjgl', projectThController.createYjgl);
router.post('/updateYjgl', projectThController.updateYjgl);
router.post('/getYjglList', projectThController.getYjglList);
router.post('/getYjglInfo', projectThController.getYjglInfo);
module.exports = router;
\ No newline at end of file
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