明树Git Lab

Commit 8c605504 authored by zfp1's avatar zfp1

update

parent 545cc561
Pipeline #106028 passed with stage
in 3 seconds
......@@ -382,19 +382,19 @@ async function createZdfx(req, res, next) {
if (!req.body.projectId) {
return res.sendError(errorMessage.paramsError);
}
//处理财务指标
let zdfxcwzbs = (req.body.zdfxcwzbs || []).map(o => { o.projectId = req.body.projectId; return o; });
delete req.body.zdfxcwzbs;
// //处理财务指标
// let zdfxcwzbs = (req.body.zdfxcwzbs || []).map(o => { o.projectId = req.body.projectId; return o; });
// delete req.body.zdfxcwzbs;
//处理风险处置
let zdfxczs = (req.body.zdfxczs || []).map(o => { o.projectId = req.body.projectId; return o; });
delete req.body.zdfxczs;
//处理风险情况
let zdfxqks = (req.body.zdfxqks || []).map(o => { o.projectId = req.body.projectId; return o; });
delete req.body.zdfxqks;
// // 处理风险情况
// let zdfxqks = (req.body.zdfxqks || []).map(o => { o.projectId = req.body.projectId; return o; });
// delete req.body.zdfxqks;
await DB.TzZdfxcwzb.bulkCreate(zdfxcwzbs);
// await DB.TzZdfxcwzb.bulkCreate(zdfxcwzbs);
await DB.TzZdfxcz.bulkCreate(zdfxczs);
await DB.TzZdfxqk.bulkCreate(zdfxqks);
// await DB.TzZdfxqk.bulkCreate(zdfxqks);
let ret = await DB.TzZdfx.create(req.body);
return res.sendData(ret);
} catch (error) {
......@@ -418,12 +418,12 @@ async function getZdfxInfo(req, res, next) {
if (!(zdfx && zdfx.id && zdfx.projectId)) {
return res.sendError(errorMessage.resourceNotFound);
}
let zdfxcwzbs = await DB.TzZdfxcwzb.findAll({ where: { projectId: zdfx.projectId }, raw: true });
// let zdfxcwzbs = await DB.TzZdfxcwzb.findAll({ where: { projectId: zdfx.projectId }, raw: true });
let zdfxczs = await DB.TzZdfxcz.findAll({ where: { projectId: zdfx.projectId }, raw: true });
let zdfxqks = await DB.TzZdfxqk.findAll({ where: { projectId: zdfx.projectId }, raw: true });
zdfx.zdfxcwzbs = zdfxcwzbs;
// let zdfxqks = await DB.TzZdfxqk.findAll({ where: { projectId: zdfx.projectId }, raw: true });
// zdfx.zdfxcwzbs = zdfxcwzbs;
zdfx.zdfxczs = zdfxczs;
zdfx.zdfxqks = zdfxqks;
// zdfx.zdfxqks = zdfxqks;
return res.sendData(zdfx);
} catch (error) {
next(error);
......@@ -434,27 +434,27 @@ async function updateZdfx(req, res, next) {
if (!req.body.projectId) {
return res.sendError(errorMessage.paramsError);
}
//处理财务指标
let ids = [], infos = [], newzdfxcwzbs = [];
req.body.zdfxcwzbs.map(o => { if (!o.id) { if (!_.isEmpty(o)) { o.projectId = req.body.projectId; newzdfxcwzbs.push(o); } } else { ids.push(o.id); infos.push(o); } return o });
await DB.TzZdfxcwzb.destroy({ where: { projectId: req.body.projectId, id: { [Op.notIn]: ids } } }); // 删除id不在传入id数组里面的(用户在界面删除的)
await DB.TzZdfxcwzb.bulkCreate(newzdfxcwzbs);//创建新的 没有id的
await Promise.all(infos.map(item => { DB.TzZdfxcwzb.update(item, { where: { id: item.id } }) }));
delete req.body.zdfxcwzbs;
// //处理财务指标
// let ids = [], infos = [], newzdfxcwzbs = [];
// req.body.zdfxcwzbs.map(o => { if (!o.id) { if (!_.isEmpty(o)) { o.projectId = req.body.projectId; newzdfxcwzbs.push(o); } } else { ids.push(o.id); infos.push(o); } return o });
// await DB.TzZdfxcwzb.destroy({ where: { projectId: req.body.projectId, id: { [Op.notIn]: ids } } }); // 删除id不在传入id数组里面的(用户在界面删除的)
// await DB.TzZdfxcwzb.bulkCreate(newzdfxcwzbs);//创建新的 没有id的
// await Promise.all(infos.map(item => { DB.TzZdfxcwzb.update(item, { where: { id: item.id } }) }));
// delete req.body.zdfxcwzbs;
//处理风险处置
let ids1 = [], infos1 = [], newzdfxczs = [];
req.body.zdfxczs.map(o => { if (!o.id) { if (!_.isEmpty(o)) { o.projectId = req.body.projectId; newzdfxczs.push(o); } } else { ids1.push(o.id); infos1.push(o); } return o });
await DB.TzZdfxcwzb.destroy({ where: { projectId: req.body.projectId, id: { [Op.notIn]: ids1 } } }); // 删除id不在传入id数组里面的(用户在界面删除的)
await DB.TzZdfxcwzb.bulkCreate(newzdfxczs);//创建新的 没有id的
await Promise.all(infos1.map(item => { DB.TzZdfxcwzb.update(item, { where: { id: item.id } }) }));
await DB.TzZdfxcz.destroy({ where: { projectId: req.body.projectId, id: { [Op.notIn]: ids1 } } }); // 删除id不在传入id数组里面的(用户在界面删除的)
await DB.TzZdfxcz.bulkCreate(newzdfxczs);//创建新的 没有id的
await Promise.all(infos1.map(item => { DB.TzZdfxcz.update(item, { where: { id: item.id } }) }));
delete req.body.zdfxczs;
//处理风险情况
let ids2 = [], infos2 = [], newzdfxqks = [];
req.body.zdfxqks.map(o => { if (!o.id) { if (!_.isEmpty(o)) { o.projectId = req.body.projectId; newzdfxqks.push(o); } } else { ids2.push(o.id); infos2.push(o); } return o });
await DB.TzZdfxcwzb.destroy({ where: { projectId: req.body.projectId, id: { [Op.notIn]: ids2 } } }); // 删除id不在传入id数组里面的(用户在界面删除的)
await DB.TzZdfxcwzb.bulkCreate(newzdfxqks);//创建新的 没有id的
await Promise.all(infos2.map(item => { DB.TzZdfxcwzb.update(item, { where: { id: item.id } }) }));
delete req.body.zdfxqks;
// //处理风险情况
// let ids2 = [], infos2 = [], newzdfxqks = [];
// req.body.zdfxqks.map(o => { if (!o.id) { if (!_.isEmpty(o)) { o.projectId = req.body.projectId; newzdfxqks.push(o); } } else { ids2.push(o.id); infos2.push(o); } return o });
// await DB.TzZdfxcwzb.destroy({ where: { projectId: req.body.projectId, id: { [Op.notIn]: ids2 } } }); // 删除id不在传入id数组里面的(用户在界面删除的)
// await DB.TzZdfxcwzb.bulkCreate(newzdfxqks);//创建新的 没有id的
// await Promise.all(infos2.map(item => { DB.TzZdfxcwzb.update(item, { where: { id: item.id } }) }));
// delete req.body.zdfxqks;
let ret = await DB.TzZdfx.update(req.body, { where: { id: req.body.id } });
return res.sendData(ret);
......
......@@ -23,7 +23,7 @@ const TzTzmbzrs = sequelize.define('TzTzmbzrs', {
comment: "项目地点",
},
zrslx: {
type: DataTypes.JSON,
type: DataTypes.STRING,
comment: "责任书类型 全生命周期投资目标责任书、建设投资目标责任书、运营期投资目标责任书、年度投资目标责任书文件",
},
xmkgrq: {
......
......@@ -34,14 +34,14 @@ const TzZdfx = sequelize.define('TzZdfx', {
type: DataTypes.DECIMAL(5, 2),
comment: "本集团股比(%)"
},
xmyjztz: {
type: DataTypes.DECIMAL(20, 2),
comment: "项目(预计)总投资"
},
ljwctz: {
type: DataTypes.DECIMAL(20, 2),
comment: "累计完成投资"
},
// xmyjztz: {
// type: DataTypes.DECIMAL(20, 2),
// comment: "项目(预计)总投资"
// },
// ljwctz: {
// type: DataTypes.DECIMAL(20, 2),
// comment: "累计完成投资"
// },
yjkgny: {
type: DataTypes.DATE,
......@@ -66,14 +66,14 @@ const TzZdfx = sequelize.define('TzZdfx', {
comment: "项目阶段 1未开工/2未交割/3在建/4运营",
},
xmqzqyysr: {
type: DataTypes.DECIMAL(20, 2),
comment: "项目全周期-营业收入"
},
xmqzqlrze: {
type: DataTypes.DECIMAL(20, 2),
comment: "项目全周期-利润总额"
},
// xmqzqyysr: {
// type: DataTypes.DECIMAL(20, 2),
// comment: "项目全周期-营业收入"
// },
// xmqzqlrze: {
// type: DataTypes.DECIMAL(20, 2),
// comment: "项目全周期-利润总额"
// },
// cwzbsj: {
// type: DataTypes.DATE,
// comment: "财务指标时间",
......
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 TzZdfxcwzb = sequelize.define('TzZdfxcwzb', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
cwzbsj: {
type: DataTypes.DATE,
comment: "财务指标时间-年度",
get() {
const rawValue = this.getDataValue('cwzbsj');
return rawValue ? moment(rawValue).format('YYYY-MM') : '';
}
},
xmljyysr: {
type: DataTypes.DECIMAL(20, 2),
comment: "项目累计营业收入"
},
xmljlrze: {
type: DataTypes.DECIMAL(20, 2),
comment: "项目累计利润总额"
},
xmdnyysr: {
type: DataTypes.DECIMAL(20, 2),
comment: "项目当年营业收入"
},
xmdnlrze: {
type: DataTypes.DECIMAL(20, 2),
comment: "项目当年利润总额"
},
// //投中管理- 年度 财务指标
// const TzZdfxcwzb = sequelize.define('TzZdfxcwzb', {
// id: {
// type: DataTypes.INTEGER,
// primaryKey: true,
// autoIncrement: true
// },
// cwzbsj: {
// type: DataTypes.DATE,
// comment: "财务指标时间-年度",
// get() {
// const rawValue = this.getDataValue('cwzbsj');
// return rawValue ? moment(rawValue).format('YYYY-MM') : '';
// }
// },
// xmljyysr: {
// type: DataTypes.DECIMAL(20, 2),
// comment: "项目累计营业收入"
// },
// xmljlrze: {
// type: DataTypes.DECIMAL(20, 2),
// comment: "项目累计利润总额"
// },
// xmdnyysr: {
// type: DataTypes.DECIMAL(20, 2),
// comment: "项目当年营业收入"
// },
// xmdnlrze: {
// type: DataTypes.DECIMAL(20, 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_tz_zdfxcwzb', // 指定表名(如果与模型名不同)
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_tz_zdfxcwzb', // 指定表名(如果与模型名不同)
// timestamps: true, // 是否自动添加 createdAt 和 updatedAt 字段(覆盖全局设置)
// });
// 同步模型到数据库(创建表)
TzZdfxcwzb.sync({
// force: false,
// force: true ,//会删除已存在表并重新创建
alter: true
})
.then(() => {
console.log('TzZdfxcwzb 表同步成功');
});
// // 同步模型到数据库(创建表)
// TzZdfxcwzb.sync({
// // force: false,
// // force: true ,//会删除已存在表并重新创建
// alter: true
// })
// .then(() => {
// console.log('TzZdfxcwzb 表同步成功');
// });
module.exports = TzZdfxcwzb;
\ No newline at end of file
// module.exports = TzZdfxcwzb;
\ No newline at end of file
......@@ -27,7 +27,46 @@ const TzZdfxcz = sequelize.define('TzZdfxcz', {
type: DataTypes.TEXT,
comment: "进展情况"
},
fxdj: {
type: DataTypes.STRING,
comment: "风险等级"
},
fxfl: {
type: DataTypes.STRING,
comment: "风险分类"
},
fxgk: {
type: DataTypes.TEXT,
comment: "风险概况"
},
kzcs: {
type: DataTypes.TEXT,
comment: "控制措施"
},
czjz: {
type: DataTypes.TEXT,
comment: "处置进展"
},
yjzgwcsj: {
type: DataTypes.DATE,
comment: "预计整改完成时间",
get() {
const rawValue = this.getDataValue('yjzgwcsj');
return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
}
},
fxsjje: {
type: DataTypes.DECIMAL(20, 2),
comment: "风险涉及金额"
},
cxgl: {
type: DataTypes.STRING,
comment: "出险概率"
},
fxfxfs: {
type: DataTypes.STRING,
comment: "风险发现方式"
},
projectId: {
type: DataTypes.INTEGER,
......
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 TzZdfxqk = sequelize.define('TzZdfxqk', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
fxdj: {
type: DataTypes.STRING,
comment: "风险等级"
},
fxfl: {
type: DataTypes.STRING,
comment: "风险分类"
},
fxgk: {
type: DataTypes.TEXT,
comment: "风险概况"
},
kzcs: {
type: DataTypes.TEXT,
comment: "控制措施"
},
czjz: {
type: DataTypes.TEXT,
comment: "处置进展"
},
yjzgwcsj: {
type: DataTypes.DATE,
comment: "预计整改完成时间",
get() {
const rawValue = this.getDataValue('yjzgwcsj');
return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
}
},
fxsjje: {
type: DataTypes.DECIMAL(20, 2),
comment: "风险涉及金额"
},
cxgl: {
type: DataTypes.STRING,
comment: "出险概率"
},
fxfxfs: {
type: DataTypes.STRING,
comment: "风险发现方式"
},
// //投中管理- 已发现或暴露的风险 ---风险情况
// const TzZdfxqk = sequelize.define('TzZdfxqk', {
// id: {
// type: DataTypes.INTEGER,
// primaryKey: true,
// autoIncrement: true
// },
// fxdj: {
// type: DataTypes.STRING,
// comment: "风险等级"
// },
// fxfl: {
// type: DataTypes.STRING,
// comment: "风险分类"
// },
// fxgk: {
// type: DataTypes.TEXT,
// comment: "风险概况"
// },
// kzcs: {
// type: DataTypes.TEXT,
// comment: "控制措施"
// },
// czjz: {
// type: DataTypes.TEXT,
// comment: "处置进展"
// },
// yjzgwcsj: {
// type: DataTypes.DATE,
// comment: "预计整改完成时间",
// get() {
// const rawValue = this.getDataValue('yjzgwcsj');
// return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
// }
// },
// fxsjje: {
// type: DataTypes.DECIMAL(20, 2),
// comment: "风险涉及金额"
// },
// cxgl: {
// type: DataTypes.STRING,
// comment: "出险概率"
// },
// fxfxfs: {
// 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_tz_zdfxqk', // 指定表名(如果与模型名不同)
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_tz_zdfxqk', // 指定表名(如果与模型名不同)
// timestamps: true, // 是否自动添加 createdAt 和 updatedAt 字段(覆盖全局设置)
// });
// 同步模型到数据库(创建表)
TzZdfxqk.sync({
// force: false,
// force: true ,//会删除已存在表并重新创建
alter: true
})
.then(() => {
console.log('TzZdfxqk 表同步成功');
});
// // 同步模型到数据库(创建表)
// TzZdfxqk.sync({
// // force: false,
// // force: true ,//会删除已存在表并重新创建
// alter: true
// })
// .then(() => {
// console.log('TzZdfxqk 表同步成功');
// });
module.exports = TzZdfxqk;
\ No newline at end of file
// module.exports = TzZdfxqk;
\ 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