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