明树Git Lab

Commit f195e92c authored by zfp1's avatar zfp1

update

parent 5bd58252
Pipeline #105174 passed with stage
in 3 seconds
......@@ -224,7 +224,7 @@ async function updateTzkz(req, res, next) {
await Promise.all(infos3.map(item => { DB.TzTzkzTzekz.update(item, { where: { id: item.id } }) }));
delete req.body.tzkztzekzs;
await DB.TzTzkz.update(req.body, {where: {id: req.body.id}});
await DB.TzTzkz.update(req.body, { where: { id: req.body.id } });
return res.sendData();
} catch (error) {
next(error);
......@@ -265,7 +265,17 @@ async function getTzkzList(req, res, next) {
}
async function getTzkzInfo(req, res, next) {
try {
let tzkz = await DB.TzTzkz.findOne({ where: { id: req.body.id }, raw: true });
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 tzkz = await DB.TzTzkz.findOne({ where: search, raw: true });
if (!(tzkz && tzkz.id)) {
return res.sendError(errorMessage.resourceNotFound);
}
......@@ -305,6 +315,126 @@ async function getTzkzInfo(req, res, next) {
}
}
async function createZdfx(req, res, next) {
try {
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 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;
await DB.TzZdfxcwzb.bulkCreate(zdfxcwzbs);
await DB.TzZdfxcz.bulkCreate(zdfxczs);
await DB.TzZdfxqk.bulkCreate(zdfxqks);
let ret = await DB.TzZdfx.create(req.body);
return res.sendData(ret);
} catch (error) {
next(error);
}
}
async function getZdfxInfo(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 zdfx = await DB.TzZdfx.findOne({ where: search, raw: true });
if (!(zdfx && zdfx.id && zdfx.projectId)) {
return res.sendError(errorMessage.resourceNotFound);
}
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;
zdfx.zdfxczs = zdfxczs;
zdfx.zdfxqks = zdfxqks;
return res.sendData(zdfx);
} catch (error) {
next(error);
}
}
async function updateZdfx(req, res, next) {
try {
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 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 } }) }));
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 ret = await DB.TzZdfx.update(req.body, { where: { id: req.body.id } });
return res.sendData(ret);
} catch (error) {
next(error);
}
}
async function getZdfxList(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}%` } },
{ xmgsqc: { [Op.like]: `%${req.body.xmgsqc}%` } },
{ zsqy: { [Op.like]: `%${req.body.zsqy}%` } },
],
del: 0
}
}
search.where = where;
if (req.body.attributes && req.body.attributes.length) {
search.attributes = req.body.attributes;
}
let ret = await DB.TzZdfx.findAndCountAll(search);
return res.sendData(ret);
} catch (error) {
next(error);
}
}
module.exports = {
createTzmbzrs,
......@@ -315,4 +445,8 @@ module.exports = {
getTzkzInfo,
getTzkzList,
updateTzkz,
createZdfx,
updateZdfx,
getZdfxList,
getZdfxInfo,
}
\ No newline at end of file
......@@ -46,6 +46,12 @@ const TzTzkzJcpfyj = require("./model/jt/tzTzkzJcpfyj");
const TzTzkzTzekz = require("./model/jt/tzTzkzTzekz");
const TzTzkzCwpj = require("./model/jt/tzTzkzCwpj");
const TzTzkzTzsy = require('./model/jt/tzTzkzTzsy');
const TzZdfx = require("./model/jt/tzZdfx");
const TzZdfxcz = require("./model/jt/tzZdfxcz");
const TzZdfxcwzb = require("./model/jt/tzZdfxcwzb");
const TzZdfxqk = require("./model/jt/tzZdfxqk");
/**
* 业务表
*/
......@@ -93,6 +99,10 @@ global.DB = {
TzTzkzTzekz,
TzTzkzCwpj,
TzTzkzTzsy,
TzZdfx,
TzZdfxcz,
TzZdfxcwzb,
TzZdfxqk,
}
......
......@@ -130,7 +130,7 @@ const Project = sequelize.define('Project', {
// projectCode: { type: DataTypes.STRING, allowNull: true, comment: "项目编号", },
sbdw: { type: DataTypes.STRING, allowNull: true, comment: "申报单位", _mark: 'juece' }, //TODO:下拉选择公司名称,这个需要公司管理的数据
sbdwqygg: { type: DataTypes.INTEGER, allowNull: true, comment: "申报单位企业规格", _mark: 'juece', zjType: 'danxuan' },
xmztz: { type: DataTypes.DECIMAL(19, 8), allowNull: true, comment: "项目总投资", _mark: 'juece' },
xmztz: { type: DataTypes.DECIMAL(20, 8), allowNull: true, comment: "项目总投资", _mark: 'juece' },
// zsqy: { type: DataTypes.STRING, allowNull: true, comment: "直属企业", },
glzt: { type: DataTypes.STRING, allowNull: true, comment: "管理主体", _mark: 'juece', zjType: 'danxuan' },
// xmqy: { type: DataTypes.STRING, allowNull: true, comment: "项目区域", zjType: 'danxuan' },
......@@ -187,32 +187,32 @@ const Project = sequelize.define('Project', {
// sfjntbjgl: { type: DataTypes.INTEGER, allowNull: true, comment: "是否境内特别监管类" },
// sfydylyxgj: { type: DataTypes.INTEGER, allowNull: true, comment: "是否一带一路沿线国家" },
//建设规模(实物量指标)---立项表格
gsgllc: { type: DataTypes.DECIMAL(19, 8), allowNull: true, comment: "高速公路里程", _mark: 'juece' },
qtsfgllc: { type: DataTypes.DECIMAL(19, 8), allowNull: true, comment: "其他收费公路里程", _mark: 'juece' },
gsgllc: { type: DataTypes.DECIMAL(20, 8), allowNull: true, comment: "高速公路里程", _mark: 'juece' },
qtsfgllc: { type: DataTypes.DECIMAL(20, 8), allowNull: true, comment: "其他收费公路里程", _mark: 'juece' },
//政府审批(核准、备案)文件
sfyjzfsp: { type: DataTypes.INTEGER, allowNull: true, comment: "是否已经政府审批", _mark: 'juece', zjType: 'danxuan', zjKey: 'sf' }, //1是 2否
spdwmc: { type: DataTypes.STRING, allowNull: true, comment: "审批单位名称(全称)", _mark: 'juece', },
pwwh: { type: DataTypes.STRING, allowNull: true, comment: "批文文号", _mark: 'juece', },
// spjb: { type: DataTypes.STRING, allowNull: true, comment: "审批级别" }, //TODO:下拉
spje: { type: DataTypes.DECIMAL(19, 8), allowNull: true, comment: "审批金额(万元)", _mark: 'juece', },
spje: { type: DataTypes.DECIMAL(20, 8), allowNull: true, comment: "审批金额(万元)", _mark: 'juece', },
spsj: { type: DataTypes.DATE, allowNull: true, comment: "审批时间", _mark: 'juece', },
//股东信息 ---立项表格 --TODO:需要按照股东类型计算合计,再计算总合计
wfczrjcgbl: { type: DataTypes.STRING(500), allowNull: true, comment: "我方出资人及持股比例", _mark: 'juece', },
sjnjfsgdw: { type: DataTypes.STRING(500), allowNull: true, comment: "涉及能建方施工单位", _mark: 'juece', },
// 我方担保及股权融资情况
wffzdgqrzjewy: { type: DataTypes.DECIMAL(19, 8), allowNull: true, comment: "我方负责的股权融资金额(万元)", _mark: 'juece', },
rzcbgq: { type: DataTypes.DECIMAL(19, 8), allowNull: true, comment: "融资成本股权", _mark: 'juece', },
wffzdgqrzjewy: { type: DataTypes.DECIMAL(20, 8), allowNull: true, comment: "我方负责的股权融资金额(万元)", _mark: 'juece', },
rzcbgq: { type: DataTypes.DECIMAL(20, 8), allowNull: true, comment: "融资成本股权", _mark: 'juece', },
qxgq: { type: DataTypes.INTEGER, allowNull: true, comment: "期限股权", _mark: 'juece', },
dbje: { type: DataTypes.DECIMAL(19, 8), allowNull: true, comment: "担保金额", _mark: 'juece', },
dbje: { type: DataTypes.DECIMAL(20, 8), allowNull: true, comment: "担保金额", _mark: 'juece', },
//我方担保及债权融资情况
wffzdzqrzjewy: { type: DataTypes.DECIMAL(19, 8), allowNull: true, comment: "我方负责的债权融资金额(万元)", _mark: 'juece', },
rzcbzq: { type: DataTypes.DECIMAL(19, 8), allowNull: true, comment: "融资成本债权", _mark: 'juece', },
wffzdzqrzjewy: { type: DataTypes.DECIMAL(20, 8), allowNull: true, comment: "我方负责的债权融资金额(万元)", _mark: 'juece', },
rzcbzq: { type: DataTypes.DECIMAL(20, 8), allowNull: true, comment: "融资成本债权", _mark: 'juece', },
qxzq: { type: DataTypes.INTEGER, allowNull: true, comment: "期限债权", _mark: 'juece', },
yjldsjzq: { type: DataTypes.DECIMAL(19, 8), allowNull: true, comment: "预计落地时间债权", _mark: 'juece', },
yjldsjzq: { type: DataTypes.DECIMAL(20, 8), allowNull: true, comment: "预计落地时间债权", _mark: 'juece', },
//工程带动情况
ddgchte: { type: DataTypes.DECIMAL(19, 8), allowNull: true, comment: "带动工程合同额", _mark: 'juece', },
ddgchte: { type: DataTypes.DECIMAL(20, 8), allowNull: true, comment: "带动工程合同额", _mark: 'juece', },
tzddb: { type: DataTypes.DECIMAL(5, 2), allowNull: true, comment: "投资带动比", _mark: 'juece', },
gclrwy: { type: DataTypes.DECIMAL(19, 8), allowNull: true, comment: "工程利润(万元)", _mark: 'juece', },
gclrwy: { type: DataTypes.DECIMAL(20, 8), allowNull: true, comment: "工程利润(万元)", _mark: 'juece', },
gclrl: { type: DataTypes.DECIMAL(5, 2), allowNull: true, comment: "工程利润率(%)", _mark: 'juece', },
xmbyx: { type: DataTypes.TEXT, allowNull: true, comment: "项目必要性", _mark: 'juece', },
qtsm: { type: DataTypes.TEXT, allowNull: true, comment: "其他说明", _mark: 'juece', },
......@@ -251,40 +251,40 @@ const Project = sequelize.define('Project', {
// 财务指标 ---暂时搁置
//项目投资总额(全口径)
jaf: { type: DataTypes.DECIMAL(19, 8), allowNull: true, comment: "建安费" },
sbjgjgzf: { type: DataTypes.DECIMAL(19, 8), allowNull: true, comment: "设备及工具购置费" },
tdxgfy: { type: DataTypes.DECIMAL(19, 8), allowNull: true, comment: "土地相关费用" },
jsdwglf: { type: DataTypes.DECIMAL(19, 8), allowNull: true, comment: "建设单位管理费" },
qtjsxmglf: { type: DataTypes.DECIMAL(19, 8), allowNull: true, comment: "其他建设项目管理费" },
qtfy: { type: DataTypes.DECIMAL(19, 8), allowNull: true, comment: "其他费用" },
jsqlx: { type: DataTypes.DECIMAL(19, 8), allowNull: true, comment: "建设期利息" },
ybf: { type: DataTypes.DECIMAL(19, 8), allowNull: true, comment: "预备费" },
jaf: { type: DataTypes.DECIMAL(20, 8), allowNull: true, comment: "建安费" },
sbjgjgzf: { type: DataTypes.DECIMAL(20, 8), allowNull: true, comment: "设备及工具购置费" },
tdxgfy: { type: DataTypes.DECIMAL(20, 8), allowNull: true, comment: "土地相关费用" },
jsdwglf: { type: DataTypes.DECIMAL(20, 8), allowNull: true, comment: "建设单位管理费" },
qtjsxmglf: { type: DataTypes.DECIMAL(20, 8), allowNull: true, comment: "其他建设项目管理费" },
qtfy: { type: DataTypes.DECIMAL(20, 8), allowNull: true, comment: "其他费用" },
jsqlx: { type: DataTypes.DECIMAL(20, 8), allowNull: true, comment: "建设期利息" },
ybf: { type: DataTypes.DECIMAL(20, 8), allowNull: true, comment: "预备费" },
tzsypc: { type: DataTypes.DECIMAL(5, 2), allowNull: true, comment: "投资收益偏差" },
zrrz: { type: DataTypes.DECIMAL(5, 2), allowNull: true, comment: "责任融资" },
njfcze: { type: DataTypes.DECIMAL(19, 8), allowNull: true, comment: "能建方出资额" },
zbjed: { type: DataTypes.DECIMAL(19, 8), allowNull: true, comment: "资本金额度" },
dked: { type: DataTypes.DECIMAL(19, 8), allowNull: true, comment: "贷款额度" },
qzfbbxmwfdkdbe: { type: DataTypes.DECIMAL(19, 8), allowNull: true, comment: "其中:非并表项目我方贷款/担保额" },
njfsjcze: { type: DataTypes.DECIMAL(19, 8), allowNull: true, comment: "能建方实际出资额" },
njfcze: { type: DataTypes.DECIMAL(20, 8), allowNull: true, comment: "能建方出资额" },
zbjed: { type: DataTypes.DECIMAL(20, 8), allowNull: true, comment: "资本金额度" },
dked: { type: DataTypes.DECIMAL(20, 8), allowNull: true, comment: "贷款额度" },
qzfbbxmwfdkdbe: { type: DataTypes.DECIMAL(20, 8), allowNull: true, comment: "其中:非并表项目我方贷款/担保额" },
njfsjcze: { type: DataTypes.DECIMAL(20, 8), allowNull: true, comment: "能建方实际出资额" },
zbjbl: { type: DataTypes.DECIMAL(5, 2), allowNull: true, comment: "资本金比例" },
njszgbpfe: { type: DataTypes.DECIMAL(19, 8), allowNull: true, comment: "能建所占股比批复额" },
njszgbpfe: { type: DataTypes.DECIMAL(20, 8), allowNull: true, comment: "能建所占股比批复额" },
ddb: { type: DataTypes.DECIMAL(5, 2), allowNull: true, comment: "带动比" },
yjddb: { type: DataTypes.DECIMAL(5, 2), allowNull: true, comment: "预计带动比" },
zcbhtesghte: { type: DataTypes.DECIMAL(19, 8), allowNull: true, comment: "总承包合同额(施工合同额)" },
zcbhtesghte: { type: DataTypes.DECIMAL(20, 8), allowNull: true, comment: "总承包合同额(施工合同额)" },
//企业财务投资能力评价
qyzjzez: { type: DataTypes.DECIMAL(19, 8), allowNull: true, comment: "权益资金值(E值)" },
qyzjzez: { type: DataTypes.DECIMAL(20, 8), allowNull: true, comment: "权益资金值(E值)" },
zcfzl: { type: DataTypes.DECIMAL(5, 2), allowNull: true, comment: "资产负债率" },
jzcsyl: { type: DataTypes.DECIMAL(5, 2), allowNull: true, comment: "净资产收益率" },
lxbzbs: { type: DataTypes.STRING, allowNull: true, comment: "利息保障倍数" },
jyhdxjllje: { type: DataTypes.DECIMAL(19, 8), allowNull: true, comment: "经营活动现金流量净额" },
jzc: { type: DataTypes.DECIMAL(19, 8), allowNull: true, comment: "净资产" },
zzc: { type: DataTypes.DECIMAL(19, 8), allowNull: true, comment: "总资产" },
yysr: { type: DataTypes.DECIMAL(19, 8), allowNull: true, comment: "营业收入" },
sbdwjzc: { type: DataTypes.DECIMAL(19, 8), allowNull: true, comment: "申报单位净资产" },
sbdwjlr: { type: DataTypes.DECIMAL(19, 8), allowNull: true, comment: "申报单位净利润" },
sbdwhbzj: { type: DataTypes.DECIMAL(19, 8), allowNull: true, comment: "申报单位货币资金" },
jyhdxjllje: { type: DataTypes.DECIMAL(20, 8), allowNull: true, comment: "经营活动现金流量净额" },
jzc: { type: DataTypes.DECIMAL(20, 8), allowNull: true, comment: "净资产" },
zzc: { type: DataTypes.DECIMAL(20, 8), allowNull: true, comment: "总资产" },
yysr: { type: DataTypes.DECIMAL(20, 8), allowNull: true, comment: "营业收入" },
sbdwjzc: { type: DataTypes.DECIMAL(20, 8), allowNull: true, comment: "申报单位净资产" },
sbdwjlr: { type: DataTypes.DECIMAL(20, 8), allowNull: true, comment: "申报单位净利润" },
sbdwhbzj: { type: DataTypes.DECIMAL(20, 8), allowNull: true, comment: "申报单位货币资金" },
dxfzgm: { type: DataTypes.STRING, allowNull: true, comment: "带息负债规模" },
jlnsflxks: { type: DataTypes.INTEGER, allowNull: true, comment: "近两年是否连续亏损", _mark: 'juece', zjType: 'danxuan', zjKey: 'sf' },
// 项目可行性:项目投资现金流量表 项目资本金现金流量表 能建方现金流量表 利润表 投评报告及测算表
......
const { DataTypes } = require('sequelize');
const sequelize = require('../index');
const moment = require('moment');
//投中管理-重大风险防控
const TzZdfx = sequelize.define('TzZdfx', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
zsqy: {
type: DataTypes.STRING,
comment: "直属企业",
},
projectName: {
type: DataTypes.STRING,
comment: "项目名称",
},
xmgsqc: {
type: DataTypes.STRING,
comment: "项目公司全称",
},
jnw: { type: DataTypes.INTEGER, allowNull: true, comment: "境内/外", zjType: 'danxuan', _mark: "lixiang" },
sjnzjjw: { type: DataTypes.INTEGER, allowNull: true, comment: "省(境内)/洲际(境外)", zjType: 'danxuan', _mark: "lixiang" },
dsjngjjw: { type: DataTypes.INTEGER, allowNull: true, comment: "地市(境内)/国家(境外)", zjType: 'danxuan', _mark: "lixiang" },
tzbk: { type: DataTypes.INTEGER, allowNull: true, comment: "投资板块", zjType: 'danxuan', _mark: "lixiang" },
xmlx: { type: DataTypes.INTEGER, allowNull: true, comment: "项目类型 1控股/2参股/3平股", zjType: 'danxuan', },
bjtgb: {
type: DataTypes.DECIMAL(5, 2),
comment: "本集团股比(%)"
},
xmyjztz: {
type: DataTypes.DECIMAL(20, 2),
comment: "项目(预计)总投资"
},
ljwctz: {
type: DataTypes.DECIMAL(20, 2),
comment: "累计完成投资"
},
yjkgny: {
type: DataTypes.DATE,
get() {
const rawValue = this.getDataValue('yjkgny');
return rawValue ? moment(rawValue).format('YYYY-MM') : '';
}
},
yjwgny: {
type: DataTypes.DATE,
get() {
const rawValue = this.getDataValue('yjwgny');
return rawValue ? moment(rawValue).format('YYYY-MM') : '';
}
},
yyq: {
type: DataTypes.INTEGER,
comment: "运营期(年)",
},
xmjd: {
type: DataTypes.INTEGER,
comment: "项目阶段 1未开工/2未交割/3在建/4运营",
},
xmqzqyysr: {
type: DataTypes.DECIMAL(20, 2),
comment: "项目全周期-营业收入"
},
xmqzqlrze: {
type: DataTypes.DECIMAL(20, 2),
comment: "项目全周期-利润总额"
},
// 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: "项目当年利润总额"
// },
zrrlxfs: {
type: DataTypes.STRING,
comment: "责任人联系方式",
},
sfdqxz: {
type: DataTypes.INTEGER,
comment: "是否当期新增 1 是 2 否",
},
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_zdfx', // 指定表名(如果与模型名不同)
timestamps: true, // 是否自动添加 createdAt 和 updatedAt 字段(覆盖全局设置)
});
// 同步模型到数据库(创建表)
TzZdfx.sync({
// force: false,
// force: true ,//会删除已存在表并重新创建
alter: true
})
.then(() => {
console.log('TzZdfx 表同步成功');
});
module.exports = TzZdfx;
\ No newline at end of file
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: "项目当年利润总额"
},
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 表同步成功');
});
module.exports = TzZdfxcwzb;
\ No newline at end of file
const { DataTypes } = require('sequelize');
const sequelize = require('../index');
const moment = require('moment');
/**
* 投中管理- 风险处置
*/
const TzZdfxcz = sequelize.define('TzZdfxcz', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
nd: {
type: DataTypes.DATE,
comment: "财务指标时间-年度",
get() {
const rawValue = this.getDataValue('nd');
return rawValue ? moment(rawValue).format('YYYY-MM') : '';
}
},
mbfj: {
type: DataTypes.TEXT,
comment: "目标分解"
},
jzqk: {
type: DataTypes.TEXT,
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_zdfxcz', // 指定表名(如果与模型名不同)
timestamps: true, // 是否自动添加 createdAt 和 updatedAt 字段(覆盖全局设置)
});
// 同步模型到数据库(创建表)
TzZdfxcz.sync({
// force: false,
// force: true ,//会删除已存在表并重新创建
alter: true
})
.then(() => {
console.log('TzZdfxcz 表同步成功');
});
module.exports = TzZdfxcz;
\ No newline at end of file
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: "风险发现方式"
},
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 表同步成功');
});
module.exports = TzZdfxqk;
\ No newline at end of file
......@@ -61,6 +61,11 @@ router.post('/updateTzkz', projectTzController.updateTzkz);
router.post('/getTzkzList', projectTzController.getTzkzList);
router.post('/getTzkzInfo', projectTzController.getTzkzInfo);
//重大风险防控
router.post('/createZdfx', projectTzController.createZdfx);
router.post('/updateZdfx', projectTzController.updateZdfx);
router.post('/getZdfxList', projectTzController.getZdfxList);
router.post('/getZdfxInfo', projectTzController.getZdfxInfo);
......
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