明树Git Lab

Commit 76caf0c3 authored by zfp1's avatar zfp1

1

parent 76206745
Pipeline #106734 passed with stage
in 3 seconds
// ---------------- 投资计划 RcTzjh ----------------
// 创建投资计划
async function createTzjh(req, res, next) {
try {
req.body.creator = req.user.id;
let ret = await DB.RcTzjh.create(req.body);
return res.sendData(ret);
} catch (error) {
next(error);
}
}
// 更新投资计划
async function updateTzjh(req, res, next) {
try {
if (!req.body.id) return res.sendError(errorMessage.paramsError);
let ret = await DB.RcTzjh.findOne({ where: { id: req.body.id }, raw: true });
if (!(ret && ret.id)) return res.sendError(errorMessage.resourceNotFound);
await DB.RcTzjh.update(req.body, { where: { id: req.body.id } });
return res.sendData({});
} catch (error) {
next(error);
}
}
// 获取单个投资计划
async function getTzjh(req, res, next) {
try {
if (!req.body.id) return res.sendError(errorMessage.paramsError);
let info = await DB.RcTzjh.findOne({ where: { id: req.body.id, del: 0 } });
if (!(info && info.id)) return res.sendError(errorMessage.resourceNotFound);
return res.sendData(info);
} catch (error) {
next(error);
}
}
// 获取投资计划列表
async function getTzjhList(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.projectName = { [Op.like]: `%${req.body.projectName}%` };
}
if (req.body.sbdw) {
where.sbdw = { [Op.like]: `%${req.body.sbdw}%` };
}
if (req.body.jhnf) {
where.jhnf = req.body.jhnf;
}
if (req.body.projectId) {
where.projectId = req.body.projectId;
}
search.where = where;
if (req.body.attributes && req.body.attributes.length) {
search.attributes = req.body.attributes;
}
let ret = await DB.RcTzjh.findAndCountAll(search);
return res.sendData(ret);
} catch (error) {
next(error);
}
}
// 删除投资计划
async function deleteTzjh(req, res, next) {
try {
await DB.RcTzjh.update({ del: 1 }, { where: { id: req.body.id } });
return res.sendData({});
} catch (error) {
next(error);
}
}
const errorMessage = require("../utils/errorMessage"); const errorMessage = require("../utils/errorMessage");
const _ = require("lodash"); const _ = require("lodash");
const { Op } = require('sequelize'); const { Op } = require('sequelize');
...@@ -150,6 +230,11 @@ async function getTzghList(req, res, next) { ...@@ -150,6 +230,11 @@ async function getTzghList(req, res, next) {
search.attributes = req.body.attributes; search.attributes = req.body.attributes;
} }
let ret = await DB.RcTzgh.findAndCountAll(search); let ret = await DB.RcTzgh.findAndCountAll(search);
const sxlbMap = await projectModule.getResourceInfoMapByKey('matterType');
ret.rows = ret.rows.map(row => {
row.itemType = sxlbMap[row.itemType] || row.itemType;
return row;
});
return res.sendData(ret); return res.sendData(ret);
} catch (error) { } catch (error) {
next(error); next(error);
...@@ -486,4 +571,10 @@ module.exports = { ...@@ -486,4 +571,10 @@ module.exports = {
getXxbs, getXxbs,
getXxbsList, getXxbsList,
deleteXxbs, deleteXxbs,
// 投资计划
createTzjh,
updateTzjh,
getTzjh,
getTzjhList,
deleteTzjh,
} }
\ No newline at end of file
...@@ -24,7 +24,7 @@ const Project = sequelize.define('Project', { ...@@ -24,7 +24,7 @@ const Project = sequelize.define('Project', {
}, },
}, },
projectLzType: { projectLzType: {
type: DataTypes.INTEGER, type: DataTypes.STRING,
comment: "项目流转状态: 状态1 - 待立项 状态 3 -- 立项审批中 5 已立项 7 -- 决策审批中", comment: "项目流转状态: 状态1 - 待立项 状态 3 -- 立项审批中 5 已立项 7 -- 决策审批中",
}, },
xmjd: { xmjd: {
......
const { DataTypes } = require('sequelize');
const sequelize = require('../index');
const moment = require('moment');
//投中管理- 投资规划
const RcTzjh = sequelize.define('RcTzjh', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
//项目表能找到的字段
projectName: { type: DataTypes.STRING, allowNull: true, comment: "项目名称", _mark: "lixiang" },
projectForeignName: { type: DataTypes.STRING, allowNull: true, comment: "项目外文名称", _mark: "lixiang" },
sbdw: { type: DataTypes.STRING, allowNull: true, comment: "申报单位" },
xmgsmc: { type: DataTypes.STRING, allowNull: true, comment: "项目公司名称/被投资企业名称" },
xmkgsjyj: { type: DataTypes.DATE, allowNull: true, comment: "项目开工时间(预计) 项目预计起始时间", _mark: "lixiang" },
xmjgsjyj: { type: DataTypes.DATE, allowNull: true, comment: "项目交工时间(预计) 项目预计完成时间", _mark: "lixiang" },
xmjd: {
type: DataTypes.STRING,
},
yynxn: { type: DataTypes.INTEGER, allowNull: true, comment: "运营年限(年)", _mark: "lixiang" },
projectLzType: {
type: DataTypes.STRING,
comment: "项目流转状态: 状态1 - 待立项 状态 3 -- 立项审批中 5 已立项 7 -- 决策审批中",
},
xmjsqy: { type: DataTypes.INTEGER, allowNull: true, comment: "项目建设期(月)", _mark: "lixiang" },
//找不到的, 新字段
ssejqy: { type: DataTypes.STRING, allowNull: true, comment: "所属二级企业" },
tbr: { type: DataTypes.STRING, comment: "填报人" },
tbrlxdh: { type: DataTypes.STRING, comment: "填报人联系电话" },
jchcx: { type: DataTypes.TEXT, comment: "建成后成效" },
sfgjzcqghzdxm: { type: DataTypes.STRING, comment: "是否国家中长期规划重大项目(A1)" },
sfgjygbmxddzdxm: { type: DataTypes.STRING, comment: "是否国家有关部门下达的重点项目(A2)" },
dgmsbgx: { type: DataTypes.STRING, comment: "大规模设备更新(A3)" },
zlxxxcybdgc: { type: DataTypes.STRING, comment: "战略性新兴产业百大工程(A4)" },
lryqcyhxhwlcyqhxddxm: { type: DataTypes.STRING, comment: "列入央企产业焕新和未来产业启航行动的项目(A5)" },
qlblzdxm: { type: DataTypes.STRING, comment: "强链补链重点项目(A6)" },
dyzdhzdxmmlmc: { type: DataTypes.STRING, comment: "对应重大或重点项目名录名称" },
zlxxxcyfl: { type: DataTypes.STRING, comment: "战略性新兴产业分类(如有,必填)" },
lrqyfzzlxxxcygzfadxm: { type: DataTypes.STRING, comment: "列入企业发展战略性新兴产业工作方案的项目(B1)" },
lsnykczybzxm: { type: DataTypes.STRING, comment: "粮食、能源、矿产资源保障项目(B2)" },
ctcygdh: { type: DataTypes.STRING, comment: "传统产业高端化、智能化、绿色化转型升级项目(B3)" },
zcqyfzdddxm: { type: DataTypes.STRING, comment: "支撑企业发展的重点项目(B4)" },
zzyjsgzxm: { type: DataTypes.STRING, comment: "制造业技术改造项目" },
dwbgltzxm: { type: DataTypes.STRING, comment: "对外并购类投资项目(C1)" },
tbjglxm: { type: DataTypes.STRING, comment: "特别监管类项目(C2)" },
jwtbgzlxm: { type: DataTypes.STRING, comment: "境外特别关注类项目(C3)" },
dwcglxtzxm: { type: DataTypes.STRING, comment: "对外参股类投资项目(C4)" },
fdctzxm: { type: DataTypes.STRING, comment: "房地产投资项目(C5)" },
ppptzxm: { type: DataTypes.STRING, comment: "PPP投资项目(C6)" },
lgxm: { type: DataTypes.STRING, comment: "两高”项目(C7)" },
fzytzxm: { type: DataTypes.STRING, comment: "非主业投资项目(D1)" },
zpjrjg: { type: DataTypes.STRING, comment: "持牌金融机构(D2)" },
ljrjg: { type: DataTypes.STRING, comment: "类金融机构(D3)" },
qtjrjg: { type: DataTypes.STRING, comment: "其他金融机构(D4)" },
jjjjjglgs: { type: DataTypes.STRING, comment: "基金及基金管理公司(D5)" },
cytzjj: { type: DataTypes.STRING, comment: "创业投资基金(D6)" },
zzflqk: { type: DataTypes.TEXT, comment: "最终分类情况" },
kyjcxx: {
type: DataTypes.JSON,
comment: "可研/决策信息 ( 单位: 万元 )"
},
jhnf: {
type: DataTypes.STRING(4),
comment: '计划年份'
},
xjXj: {
type: DataTypes.STRING,
comment: '新建/续建'
},
ndTzMb: {
type: DataTypes.STRING,
comment: '年度投资目标'
},
xmYjGq: {
type: DataTypes.STRING,
comment: '项目预计工期'
},
// 项目预计起始时间
// 项目预计完成时间
xmRzLdSjHyyjLdSj: {
type: DataTypes.DATE,
comment: '项目融资落地时间或预计落地时间'
},
yjSxZbjNbsyl: {
type: DataTypes.FLOAT(5, 2),
comment: '预计实现资本金内部收益率(%)'
},
xmTzZeXmJhZtzLx: {
type: DataTypes.STRING,
comment: '项目投资总额(全口径)-项目计划总投资类型'
},
jhLx: {
type: DataTypes.STRING,
comment: '计划类型'
},
dqJzJd: {
type: DataTypes.STRING,
comment: '当前进展阶段'
},
dqJzQk: {
type: DataTypes.STRING,
comment: '当前进展情况'
},
xmRzSfYjLd: {
type: DataTypes.STRING,
comment: '项目融资是否已经落地'
},
xmSjKgSj: {
type: DataTypes.DATE,
comment: '项目实际开工时间'
},
yqSxXg: {
type: DataTypes.TEXT,
comment: '预期实现效果'
},
nTzJqMbjyYjhCySm: {
type: DataTypes.TEXT,
comment: '2025年投资金额(全口径)目标(决算)与计划差异说明'
},
nJhTzMbjyYjhCySm: {
type: DataTypes.TEXT,
comment: '2025年计划投资目标(决算)与计划差异说明'
},
xmZyFxJzyFxYdcj: {
type: DataTypes.TEXT,
comment: '项目主要风险及主要风险应对举措'
},
xmndjh: { type: DataTypes.JSON, comment: "项目年度计划表格 ( 单位: 万元 )" },
zjfzBl: {
type: DataTypes.DECIMAL(5, 2),
comment: '资金支付比例(%)'
},
zqRz: {
type: DataTypes.DECIMAL(15, 2),
comment: '债权融资(万元)'
},
ndJhZe: {
type: DataTypes.DECIMAL(15, 2),
comment: '年度计划总额(万元)'
},
hkZtr: {
type: DataTypes.DECIMAL(15, 2),
comment: '回款再投入(万元)'
},
zbjPtF: {
type: DataTypes.DECIMAL(15, 2),
comment: '资本金-配套方(万元)'
},
qt: {
type: DataTypes.DECIMAL(15, 2),
comment: '其他(万元)'
},
zbjWbGd: {
type: DataTypes.DECIMAL(15, 2),
comment: '资本金-外部股东(万元)'
},
wfJzBdwCz: {
type: DataTypes.DECIMAL(15, 2),
comment: '我方仅指本单位出资(万元)'
},
cgdwczqkxz: {
type: DataTypes.JSON,
comment: "2026年参股单位出资情况修正 ( 单位: 万元 ) 赶时间 不参与检索暂时都丢一起"
},
projectId: {
type: DataTypes.INTEGER,
comment: "所属项目ID",
},
del: {
type: DataTypes.INTEGER,
defaultValue: 0,
comment: "0 正常 1 删除"
},
creator: {
type: DataTypes.INTEGER,
comment: "创建人"
},
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_rc_tzjh', // 指定表名(如果与模型名不同)
timestamps: true, // 是否自动添加 createdAt 和 updatedAt 字段(覆盖全局设置)
});
// 同步模型到数据库(创建表)
RcTzjh.sync({
// force: false,
// force: true ,//会删除已存在表并重新创建
alter: true
})
.then(() => {
console.log('RcTzjh 表同步成功');
});
module.exports = RcTzjh;
\ No newline at end of file
...@@ -20,6 +20,7 @@ router.post('/createProject', projectController.createProject); //创建项目 ...@@ -20,6 +20,7 @@ router.post('/createProject', projectController.createProject); //创建项目
router.post('/saveProjectPreLixiang', projectController.saveProjectPreLixiang); //保存项目 router.post('/saveProjectPreLixiang', projectController.saveProjectPreLixiang); //保存项目
router.post('/startLixiang', projectController.startLixiang);//发起立项审批----TODO:待完成与能建对接 router.post('/startLixiang', projectController.startLixiang);//发起立项审批----TODO:待完成与能建对接
router.post('/queryLixiangResult', projectController.queryLixiangResult); router.post('/queryLixiangResult', projectController.queryLixiangResult);
router.post('/approvalLixiang', projectController.approvalLixiang); router.post('/approvalLixiang', projectController.approvalLixiang);
...@@ -162,7 +163,11 @@ router.post('/deleteTzgh', projectRcController.deleteTzgh); ...@@ -162,7 +163,11 @@ router.post('/deleteTzgh', projectRcController.deleteTzgh);
// 4.3 投资计划 // 4.3 投资计划
router.post('/createTzjh', projectRcController.createTzjh);
router.post('/updateTzjh', projectRcController.updateTzjh);
router.post('/getTzjh', projectRcController.getTzjh);
router.post('/getTzjhList', projectRcController.getTzjhList);
router.post('/deleteTzjh', projectRcController.deleteTzjh);
//4.4 信息报送 //4.4 信息报送
......
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