明树Git Lab

Commit 55112b3b authored by zfp1's avatar zfp1

update

parent 2c8bedbc
......@@ -276,37 +276,12 @@ async function saveProjectPreLixiang(req, res, next) {
}
}
/**
* 主动查询立项结果、或者能建调用我方接口
*/
async function queryLixiangResult(req, res, next) {
try {
if (!req.body.id) {
return res.sendError(errorMessage.resourceNotFound)
}
//请求能建提供接口
let result = {success: true};
//成功
if(result.success) {
let proInfo = await projectModule.getProjectInfo(body);
//1. 更新项目状态
await DB.Project.update({projectLzType: 5}, {where: {id}});
}
} catch (error) {
next(error);
}
}
/**
* 发起立项
*/
async function startLixiang(req, res, next) {
try {
let body = req.body;
if (!body.id) {
if (!req.body.id) {
return res.sendError(errorMessage.resourceNotFound)
}
......@@ -314,11 +289,11 @@ async function startLixiang(req, res, next) {
await DB.FlowRecord.create({
userId: req.user.id,
actionName: '发起项目立项审批',
projectId: project.id,
projectId: req.body.id,
});
//更新信息和状态
let ret = await xiangmulixianggengxin(body, 3); //状态 3 -- 显示立项审批中
let ret = await xiangmulixianggengxin(req.body, 3); //状态 3 -- 显示立项审批中
return res.sendData(ret);
} catch (error) {
......@@ -326,6 +301,33 @@ async function startLixiang(req, res, next) {
}
}
/**
* 主动查询立项结果、或者能建调用我方接口
*/
async function queryLixiangResult(req, res, next) {
try {
if (!req.body.id) {
return res.sendError(errorMessage.resourceNotFound)
}
//请求能建提供接口
let result = {success: true};
//成功
if(result.success) {
let proInfo = await projectModule.getProjectInfo(req.body);
//1. 更新项目状态
await DB.Project.update({projectLzType: 5}, {where: {id: req.body.id}});
//2. 存储快照 关联关系太多 全部建立快照表工程过大,暂时存储形式
proInfo.projectLzType = 5;
await DB.ProjectLixiang.create({lixiang: proInfo, projectId: proInfo.id});
return res.sendData(proInfo);
} else {
return res.sendError(errorMessage.resourceNotFound); //暂时
}
} catch (error) {
next(error);
}
}
......@@ -751,7 +753,21 @@ async function getProjectInfo(req, res, next) {
return res.sendError(errorMessage.resourceNotFound);
}
let ret = await projectModule.getProjectInfo(req.body);
return res.sendData(ret);
let lixiang = await DB.ProjectLixiang.findOne({
order: [['createdAt', 'DESC']],
where: {projectId: req.body.id},
});
let obj ={};
if(lixiang && lixiang.id) {
obj.lixiang = lixiang.lixiang; //快照
//当项目状态 进入决策信息填报时候
if([].includes(ret && ret.projectLzType)) {
obj.juece = ret;
}
} else {
obj.lixiang = ret; //这里就只有立项 决策的数据一旦开始填报 证明一定有ProjectLixiang lixiang
}
return res.sendData(obj);
} catch (error) {
next(error);
}
......
......@@ -30,6 +30,7 @@ const ProjectSpyj = require("./model/jt/projectSpyj");
const ProjectTzzjll = require("./model/jt/projectTzzjll");
const ProjectTzzt = require("./model/jt/projectTzzt");
const ProjectXmtzze = require("./model/jt/projectXmtzze");
const ProjectLixiang = require("./model/jt/projectLixiang");
/**
......@@ -67,6 +68,7 @@ global.DB = {
ProjectXmtzze,
Message,
FlowRecord,
ProjectLixiang,
}
......
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