明树Git Lab

Commit 18cfbeab authored by zfp1's avatar zfp1

update

parent 4f1a372b
Pipeline #106092 passed with stage
in 3 seconds
......@@ -15,6 +15,8 @@ async function createYyqtzhs(req, res, next) {
if (!req.body.projectId) {
return res.sendError(errorMessage.paramsError);
}
let ret = await DB.ThTzYyqtzhs.create(req.body);
//处理财务指标
let flattenArr = [];
let yyqtzhss = req.body.yyqtzhss || [[]]; //二维数组 多次上报
......@@ -25,13 +27,13 @@ async function createYyqtzhs(req, res, next) {
let ei = element[i];
ei.groupBy = index;
ei.projectId = req.body.projectId;
ei.sourceId = ret.id;
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);
......@@ -44,9 +46,6 @@ async function getYyqtzhsInfo(req, res, next) {
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);
}
......@@ -54,7 +53,7 @@ async function getYyqtzhsInfo(req, res, next) {
if (!(tzhs && tzhs.id && tzhs.projectId)) {
return res.sendError(errorMessage.resourceNotFound);
}
let yyqtzhss = await DB.ThTzYyqtzhszb.findAll({ where: { projectId: tzhs.projectId }, raw: true });
let yyqtzhss = await DB.ThTzYyqtzhszb.findAll({ where: { projectId: tzhs.projectId, sourceId: req.body.id }, raw: true });
tzhs.yyqtzhss = _.values(_.groupBy(yyqtzhss, 'groupBy')) || [[]]
return res.sendData(tzhs);
} catch (error) {
......@@ -74,6 +73,7 @@ async function updateYyqtzhs(req, res, next) {
let ei = element[i];
ei.groupBy = index;
ei.projectId = req.body.projectId;
ei.sourceId = req.body.id;
if (!ei.id) {
if (!_.isEmpty(ei)) {
newtyyqtzhss.push(ei);
......@@ -83,7 +83,7 @@ async function updateYyqtzhs(req, res, next) {
}
}
}
await DB.ThTzYyqtzhszb.destroy({ where: { projectId: req.body.projectId, id: { [Op.notIn]: ids3 } } }); // 删除id不在传入id数组里面的(用户在界面删除的)
await DB.ThTzYyqtzhszb.destroy({ where: { projectId: req.body.projectId, sourceId: req.body.id, 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;
......@@ -134,32 +134,36 @@ async function createYyqtzjc(req, res, next) {
if (!req.body.projectId) {
return res.sendError(errorMessage.paramsError);
}
let ret = await DB.ThTzYyqtzjc.create(req.body);
//日常自查 投资(成本)分析会
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.sourceId = ret.id;
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 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.sourceId = ret.id;
element.fjcl = (element.fjcl || []).map(o => { return o && o.id || o });
newyyqtzjcZxjcs.push(element);
}
......@@ -167,9 +171,8 @@ async function createYyqtzjc(req, res, next) {
//创建
await DB.ThTzYyqtzjcTzfx.bulkCreate(yyqtzjcTzfxs);
await DB.ThTzYyqtzjcrcjc.bulkCreate(yyqtzjcrcjcs);
// 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);
......@@ -182,9 +185,6 @@ async function getYyqtzjcInfo(req, res, next) {
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);
}
......@@ -194,21 +194,21 @@ async function getYyqtzjcInfo(req, res, next) {
}
let newyyqtzjcTzfxs = [], newyyqtzjcrcjcs = [], newyyqtzjcZxjcs = [];
let yyqtzjcTzfxs = await DB.ThTzYyqtzjcTzfx.findAll({ where: { projectId: jsqtzjc.projectId }, raw: true });
let yyqtzjcTzfxs = await DB.ThTzYyqtzjcTzfx.findAll({ where: { projectId: jsqtzjc.projectId, sourceId: req.body.id }, 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 });
// let yyqtzjcrcjcs = await DB.ThTzYyqtzjcrcjc.findAll({ where: { projectId: jsqtzjc.projectId , sourceId: req.body.id}, 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, sourceId: req.body.id }, raw: true });
for (let index = 0; index < yyqtzjcZxjcs.length; index++) {
const element = yyqtzjcZxjcs[index];
// fileids.concat(element.fjcl || []);
......@@ -217,7 +217,7 @@ async function getYyqtzjcInfo(req, res, next) {
}
jsqtzjc.yyqtzjcTzfxs = newyyqtzjcTzfxs;
jsqtzjc.yyqtzjcrcjcs = newyyqtzjcrcjcs;
// jsqtzjc.yyqtzjcrcjcs = newyyqtzjcrcjcs;
jsqtzjc.yyqtzjcZxjcs = newyyqtzjcZxjcs;
return res.sendData(jsqtzjc);
......@@ -227,7 +227,7 @@ async function getYyqtzjcInfo(req, res, next) {
}
async function updateYyqtzjc(req, res, next) {
try {
if (!req.body.projectId) {
if (!req.body.id) {
return res.sendError(errorMessage.paramsError);
}
let yyqtzjcTzfxs = req.body.yyqtzjcTzfxs || [];
......@@ -235,6 +235,7 @@ async function updateYyqtzjc(req, res, next) {
for (let index = 0; index < yyqtzjcTzfxs.length; index++) {
let element = yyqtzjcTzfxs[index];
element.projectId = req.body.projectId;
element.sourceId = req.body.id;
element.tzcbfxhzl = (element.tzcbfxhzl || []).map(o => { return o && o.id || o });
if (element.id) {
ids.push(element.id);
......@@ -243,28 +244,28 @@ async function updateYyqtzjc(req, res, next) {
newArr.push(element);
}
}
await DB.ThTzYyqtzjcTzfx.destroy({ where: { projectId: req.body.projectId, id: { [Op.notIn]: ids } } }); // 删除id不在传入id数组里面的(用户在界面删除的)
await DB.ThTzYyqtzjcTzfx.destroy({ where: { projectId: req.body.projectId, sourceId: req.body.id, 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 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 || [];
......@@ -272,6 +273,7 @@ async function updateYyqtzjc(req, res, next) {
for (let index = 0; index < yyqtzjcZxjcs.length; index++) {
let element = yyqtzjcZxjcs[index];
element.projectId = req.body.projectId;
element.sourceId = req.body.id;
element.fjcl = (element.fjcl || []).map(o => { return o && o.id || o });
if (element.id) {
ids2.push(element.id);
......@@ -280,7 +282,7 @@ async function updateYyqtzjc(req, res, next) {
newArr2.push(element);
}
}
await DB.ThTzYyqtzjcZxjc.destroy({ where: { projectId: req.body.projectId, id: { [Op.notIn]: ids2 } } }); // 删除id不在传入id数组里面的(用户在界面删除的)
await DB.ThTzYyqtzjcZxjc.destroy({ where: { projectId: req.body.projectId, sourceId: req.body.id, 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;
......@@ -332,10 +334,12 @@ async function createTzhpj(req, res, next) {
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});
let ret = await DB.ThTzhpj.create(req.body);
let tzhpjwtzgs = (req.body.tzhpjwtzgs || []).map(o => { o.projectId = req.body.projectId; o.sourceId = ret.id; 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);
......@@ -351,6 +355,7 @@ async function updateTzhpj(req, res, next) {
for (let index = 0; index < tzhpjwtzgs.length; index++) {
let element = tzhpjwtzgs[index];
element.projectId = req.body.projectId;
element.sourceId = req.body.id;
if (element.id) {
ids1.push(element.id);
info1.push(element);
......@@ -358,7 +363,7 @@ async function updateTzhpj(req, res, next) {
newArr1.push(element);
}
}
await DB.ThTzhpjwtzg.destroy({ where: { projectId: req.body.projectId, id: { [Op.notIn]: ids1 } } }); // 删除id不在传入id数组里面的(用户在界面删除的)
await DB.ThTzhpjwtzg.destroy({ where: { projectId: req.body.projectId, sourceId: req.body.id, 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;
......@@ -406,9 +411,6 @@ async function getTzhpjInfo(req, res, next) {
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);
}
......@@ -427,7 +429,7 @@ async function getTzhpjInfo(req, res, next) {
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});
tzhpj.tzhpjwtzgs = await DB.ThTzhpjwtzg.findAll({ where: { projectId: tzhpj.projectId,sourceId: req.body.id }, raw: true });
return res.sendData(tzhpj);
} catch (error) {
next(error);
......@@ -439,9 +441,9 @@ async function getTzhpjInfo(req, res, next) {
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});
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) {
......@@ -451,11 +453,11 @@ async function createYjgl(req, res, next) {
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}});
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);
......@@ -464,7 +466,7 @@ async function updateYjgl(req, res, next) {
async function getYjglList(req, res, next) {
try {
let page = req.body.page || 1;
let page = req.body.page || 1;
let limit = req.body.pagesize || req.body.pageSize || 10;
let offset = (page - 1) * limit;
......@@ -496,7 +498,7 @@ async function getYjglList(req, res, next) {
async function getYjglInfo(req, res, next) {
try {
let search = {};
let search = {};
if (req.body.id) {
search.id = req.body.id;
}
......
......@@ -180,6 +180,23 @@ async function getTzmbzrsInfo(req, res, next) {
}
}
async function getProTzmbzrs(req, res, next) {
try {
if(!req.body.projectId) {
return res.sendError(errorMessage.paramsError);
}
let mbzrss = await DB.TzTzmbzrs.findAll({
where: {projectId: req.body.projectId, del: 0},
attributes: ['zrslx'],
raw: true
});
mbzrss = _.compact(mbzrss.map(o => {return o.zrslx}));
return res.sendData(mbzrss);
} catch (error) {
next(error);
}
}
async function createTzkz(req, res, next) {
try {
......@@ -992,10 +1009,11 @@ async function createXmtc(req, res, next) {
}
// 1. 文件
req.body.tcwj = (req.body.tcwj || []).map(o => { return o && o.id || o });
let tccwzbs = (req.body.tccwzbs || []).map(o => { o.projectId = req.body.projectId; return o; });
let ret = await DB.TzXmtc.create(req.body);
let tccwzbs = (req.body.tccwzbs || []).map(o => { o.projectId = req.body.projectId;o.sourceId = ret.id; return o; });
delete req.body.tccwzbs;
await DB.TzXmtcCwzb.bulkCreate(tccwzbs);
let ret = await DB.TzXmtc.create(req.body);
return res.sendData(ret);
} catch (error) {
next(error);
......@@ -1019,7 +1037,7 @@ async function getXmtcInfo(req, res, next) {
return res.sendError(errorMessage.resourceNotFound);
}
let tccwzbs = await DB.TzXmtcCwzb.findAll({
where: { projectId: xmtc.projectId },
where: { projectId: xmtc.projectId, sourceId: xmtc.id },
raw: true,
});
......@@ -1039,6 +1057,7 @@ async function updateXmtc(req, res, next) {
for (let index = 0; index < tccwzbs.length; index++) {
const element = tccwzbs[index];
element.projectId = req.body.projectId;
element.sourceId = req.body.id;
element.wj = (element.wj || []).map(o => { return o && o.id || o });
if (element.id) {
ids.push(element.id);
......@@ -1047,7 +1066,7 @@ async function updateXmtc(req, res, next) {
newArr.push(element);
}
}
await DB.TzXmtcCwzb.destroy({ where: { projectId: req.body.projectId, id: { [Op.notIn]: ids } } }); // 删除id不在传入id数组里面的(用户在界面删除的)
await DB.TzXmtcCwzb.destroy({ where: { projectId: req.body.projectId, sourceId: req.body.id, id: { [Op.notIn]: ids } } }); // 删除id不在传入id数组里面的(用户在界面删除的)
await DB.TzXmtcCwzb.bulkCreate(newArr);//创建新的 没有id的
await Promise.all(info.map(item => { return DB.TzXmtcCwzb.update(item, { where: { id: item.id } }) }));
delete req.body.tccwzbs;
......@@ -1097,6 +1116,7 @@ async function deleteTzmbzrsInfo(req, res, next) {
next(error);
}
}
async function deleteTzkz(req, res, next) {
try {
await DB.TzTzkz.update({ del: 1 }, { where: { id: req.body.id } });
......@@ -1174,4 +1194,5 @@ module.exports = {
deleteJsqtzhs,
deleteJsqtzjc,
deleteZdsxsp,
getProTzmbzrs,
}
\ No newline at end of file
......@@ -22,11 +22,50 @@ const ThTzhpj = sequelize.define('ThTzhpj', {
type: DataTypes.JSON,
comment: "后评价报告",
},
hpjsj: {
type: DataTypes.DATE,
get() {
const rawValue = this.getDataValue('hpjsj');
return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
}
},
hpjbgbzdw: {
type: DataTypes.STRING,
comment: "报告编制单位",
},
hpjpsdw: {
type: DataTypes.STRING,
comment: "评审单位",
},
hpjpjjg: {
type: DataTypes.TEXT,
comment: "后评价评价结果",
},
qsmzqpj: {
type: DataTypes.JSON,
comment: "全生命周期评价",
},
qsmsj: {
type: DataTypes.DATE,
get() {
const rawValue = this.getDataValue('qsmsj');
return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
}
},
qsmbgbzdw: {
type: DataTypes.STRING,
comment: "全生命报告编制单位",
},
qsmpsdw: {
type: DataTypes.STRING,
comment: "全生命评审单位",
},
qsmpjjg: {
type: DataTypes.TEXT,
comment: "全生命评价结果",
},
projectId: {
type: DataTypes.INTEGER,
comment: "所属项目ID",
......@@ -59,9 +98,9 @@ const ThTzhpj = sequelize.define('ThTzhpj', {
// 同步模型到数据库(创建表)
ThTzhpj.sync({
force: false,
// force: false,
// force: true ,//会删除已存在表并重新创建
// alter: true
alter: true
})
.then(() => {
console.log('ThTzhpj 表同步成功');
......
......@@ -41,7 +41,10 @@ const ThTzhpjwtzg = sequelize.define('ThTzhpjwtzg', {
type: DataTypes.INTEGER,
comment: "是否关闭",
},
sourceId: {
type: DataTypes.INTEGER,
comment: "所属投资控制主表id"
},
projectId: {
type: DataTypes.INTEGER,
comment: "所属项目ID",
......@@ -74,9 +77,9 @@ const ThTzhpjwtzg = sequelize.define('ThTzhpjwtzg', {
// 同步模型到数据库(创建表)
ThTzhpjwtzg.sync({
force: false,
// force: false,
// force: true ,//会删除已存在表并重新创建
// alter: true
alter: true
})
.then(() => {
console.log('ThTzhpjwtzg 表同步成功');
......
......@@ -48,7 +48,10 @@ const ThYyqtzhszb = sequelize.define('ThYyqtzhszb', {
type: DataTypes.INTEGER,
comment: "分组"
},
sourceId: {
type: DataTypes.INTEGER,
comment: "所属投资控制主表id"
},
projectId: {
type: DataTypes.INTEGER,
comment: "所属项目ID",
......
......@@ -28,7 +28,10 @@ const ThYyqtzjcTzfx = sequelize.define('ThYyqtzjcTzfx', {
type: DataTypes.JSON,
comment: "投资(成本)分析会资料"
},
sourceId: {
type: DataTypes.INTEGER,
comment: "所属投资控制主表id"
},
projectId: {
type: DataTypes.INTEGER,
comment: "所属项目ID",
......
......@@ -38,7 +38,10 @@ const ThYyqtzjcZxjc = sequelize.define('ThYyqtzjcZxjc', {
comment: "附件材料"
},
sourceId: {
type: DataTypes.INTEGER,
comment: "所属投资控制主表id"
},
projectId: {
type: DataTypes.INTEGER,
comment: "所属项目ID",
......
const { DataTypes } = require('sequelize');
const sequelize = require('../index');
const moment = require('moment');
// 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: "分析材料"
},
// //投中管理- 建设期投资检查 ---日常检查 对投资目标偏差每半年进行一次系统盘点,上传分析材料
// 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 字段(覆盖全局设置)
});
// 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 表同步成功');
});
// // 同步模型到数据库(创建表)
// ThYyqtzjcrcjc.sync({
// // force: false,
// // force: true ,//会删除已存在表并重新创建
// alter: true
// })
// .then(() => {
// console.log('ThYyqtzjcrcjc 表同步成功');
// });
module.exports = ThYyqtzjcrcjc;
\ No newline at end of file
// module.exports = ThYyqtzjcrcjc;
\ No newline at end of file
......@@ -20,7 +20,10 @@ const TzXmtcCwzb = sequelize.define('TzXmtcCwzb', {
comment: "指标数值",
},
sourceId: {
type: DataTypes.INTEGER,
comment: "所属投资控制主表id"
},
projectId: {
type: DataTypes.INTEGER,
comment: "所属项目ID",
......
......@@ -53,14 +53,16 @@ router.post('/getProFlowRecord', projectController.getProFlowRecord)
* 投中管理
*/
//目标责任书
//2.1 目标责任书
router.post('/createTzmbzrs', projectTzController.createTzmbzrs);
router.post('/updateTzmbzrs', projectTzController.updateTzmbzrs);
router.post('/getTzmbzrsList', projectTzController.getTzmbzrsList);
router.post('/getTzmbzrsInfo', projectTzController.getTzmbzrsInfo);
router.post('/deleteTzmbzrs', projectTzController.deleteTzmbzrsInfo);
//投资控制
router.post('/getProTzmbzrs', projectTzController.getProTzmbzrs);
//2.2 投资控制
router.post('/createTzkz', projectTzController.createTzkz);
router.post('/updateTzkz', projectTzController.updateTzkz);
......@@ -68,27 +70,27 @@ router.post('/deleteTzkz', projectTzController.deleteTzkz);
router.post('/getTzkzList', projectTzController.getTzkzList);
router.post('/getTzkzInfo', projectTzController.getTzkzInfo);
//重大风险防控
//2.3 重大风险防控
router.post('/createZdfx', projectTzController.createZdfx);
router.post('/updateZdfx', projectTzController.updateZdfx);
router.post('/deleteZdfx', projectTzController.deleteZdfx);
router.post('/getZdfxList', projectTzController.getZdfxList);
router.post('/getZdfxInfo', projectTzController.getZdfxInfo);
//建设期投资回收
//2.4 建设期投资回收
router.post('/createJsqtzhs', projectTzController.createJsqtzhs);
router.post('/updateJsqtzhs', projectTzController.updateJsqtzhs);
router.post('/deleteJsqtzhs', projectTzController.deleteJsqtzhs);
router.post('/getJsqtzhsList', projectTzController.getJsqtzhsList);
router.post('/getJsqtzhsInfo', projectTzController.getJsqtzhsInfo);
//建设期投资检查
//2.5 建设期投资检查
router.post('/createJsqtzjc', projectTzController.createJsqtzjc);
router.post('/updateJsqtzjc', projectTzController.updateJsqtzjc);
router.post('/deleteJsqtzjc', projectTzController.deleteJsqtzjc);
router.post('/getJsqtzjcList', projectTzController.getJsqtzjcList);
router.post('/getJsqtzjcInfo', projectTzController.getJsqtzjcInfo);
//重大事项审批
//2.6 重大事项审批
router.post('/createZdsxsp', projectTzController.createZdsxsp);
router.post('/updateZdsxsp', projectTzController.updateZdsxsp);
router.post('/deleteZdsxsp', projectTzController.deleteZdsxsp);
......@@ -96,7 +98,7 @@ router.post('/getZdsxspList', projectTzController.getZdsxspList);
router.post('/getZdsxspInfo', projectTzController.getZdsxspInfo);
//项目退出-------以下sourceId待改
//2.8 项目退出-------以下sourceId待改
router.post('/createXmtc', projectTzController.createXmtc);
router.post('/updateXmtc', projectTzController.updateXmtc);
router.post('/getXmtcList', projectTzController.getXmtcList);
......@@ -107,24 +109,24 @@ 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);
// 运营期投资检查
//3.2 运营期投资检查 参考建设期投资检查
router.post('/createYyqtzjc', projectThController.createYyqtzjc);
router.post('/updateYyqtzjc', projectThController.updateYyqtzjc);
router.post('/getYyqtzjcList', projectThController.getYyqtzjcList);
router.post('/getYyqtzjcInfo', projectThController.getYyqtzjcInfo);
//投资后评价
//3.3 投资后评价
router.post('/createTzhpj', projectThController.createTzhpj);
router.post('/updateTzhpj', projectThController.updateTzhpj);
router.post('/getTzhpjList', projectThController.getTzhpjList);
router.post('/getTzhpjInfo', projectThController.getTzhpjInfo);
//移交管理
//3.4 移交管理
router.post('/createYjgl', projectThController.createYjgl);
router.post('/updateYjgl', projectThController.updateYjgl);
router.post('/getYjglList', projectThController.getYjglList);
......
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