明树Git Lab
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
J
jt_backend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zengfanpei
jt_backend
Commits
37d30c98
Commit
37d30c98
authored
May 14, 2026
by
zfp1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
70349c89
Pipeline
#111308
passed with stage
in 3 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
134 additions
and
46 deletions
+134
-46
projectController.js
controller/projectController.js
+50
-9
project.js
db/model/jt/project.js
+18
-14
userModule.js
module/userModule.js
+65
-22
projectRouter.js
router/projectRouter.js
+1
-1
No files found.
controller/projectController.js
View file @
37d30c98
...
...
@@ -289,8 +289,11 @@ async function startLixiang(req, res, next) {
* 此处需要判断当前项目是从哪一个节点回来的,依次往下
* 1. 初审退回
* 2. 核准退回
* 3. 首次提交
* 3. 终审核退回
* 4. 首次提交
*
*/
req
.
body
.
projectLxTjUser
=
req
.
user
.
id
;
//立项提交人
if
(
req
.
body
.
projectLxjbrUser
)
{
//更新信息和状态
req
.
body
.
daibanUsers
=
[
req
.
body
.
projectLxjbrUser
];
...
...
@@ -333,15 +336,47 @@ async function startLixiang(req, res, next) {
projectCode
:
req
.
body
.
projectCode
,
});
return
res
.
sendData
(
ret
);
}
else
{
}
else
if
(
req
.
body
.
projectLxzsUser
)
{
// 如果没有走初审、核准但是又有终审用户,则是终审退回
req
.
body
.
daibanUsers
=
[
req
.
body
.
projectLxzsUser
];
let
ret
=
await
xiangmulixianggengxin
(
req
.
body
,
"4"
);
//状态 2 -- 立项核准中
// 记录流程节点操作
await
DB
.
FlowRecord
.
create
({
userId
:
req
.
user
.
id
,
actionName
:
'发起项目立项终审'
,
projectId
:
req
.
body
.
id
,
projectName
:
req
.
body
.
projectName
,
projectCode
:
req
.
body
.
projectCode
,
});
await
DB
.
Message
.
create
({
projectId
:
req
.
body
.
id
,
creator
:
req
.
user
.
id
,
receivers
:
approvers
.
map
(
o
=>
o
.
id
),
type
:
2
,
title
:
`项目【
${
req
.
body
.
projectName
}
】已发起立项终审,请尽快处理!`
,
content
:
`项目【
${
req
.
body
.
projectName
}
】已发起立项终审,请尽快处理!`
});
return
res
.
sendData
(
ret
);
}
else
{
// 项目公司所属单位员工发起,发送消息给项目单位部门长核准
let
approvers
=
await
userModule
.
getCompanyProjectApprover
(
req
.
user
.
id
);
if
(
!
(
approvers
&&
approvers
.
length
>
0
))
{
let
rett
=
await
userModule
.
getCompanyProjectApprover
(
req
.
user
.
id
);
if
(
!
(
_
.
isEmpty
(
rett
)
))
{
return
res
.
sendError
({
code
:
'60001'
,
message
:
'项目已保存,请联系管理员为本公司添加【项目立项核准】角色人员'
});
}
//更新信息和状态
req
.
body
.
daibanUsers
=
approvers
.
map
(
o
=>
o
.
id
);
let
ret
=
await
xiangmulixianggengxin
(
req
.
body
,
"2"
);
//状态 2 -- 立项核准中
let
ret
;
if
(
rett
.
type
==
1
)
{
//投管
ret
=
await
xiangmulixianggengxin
(
req
.
body
,
"4"
);
//状态 2 -- 立项核准中
}
else
{
//部门长
ret
=
await
xiangmulixianggengxin
(
req
.
body
,
"2"
);
//状态 2 -- 立项核准中
}
// 记录流程节点操作
await
DB
.
FlowRecord
.
create
({
userId
:
req
.
user
.
id
,
...
...
@@ -411,7 +446,7 @@ async function approvalLixiangByDepartHeader(req, res, next) {
}
else
{
//部门长核准不通过,更新项目信息和状态--退回到草稿
req
.
body
.
daibanUsers
=
[
body
.
project
Creato
r
];
req
.
body
.
daibanUsers
=
[
body
.
project
LxTjUse
r
];
ret
=
await
xiangmulixianggengxin
(
body
,
"1"
);
//记录操作
await
DB
.
FlowRecord
.
create
({
...
...
@@ -425,7 +460,7 @@ async function approvalLixiangByDepartHeader(req, res, next) {
await
DB
.
Message
.
create
({
projectId
:
body
.
id
,
creator
:
req
.
user
.
id
,
receivers
:
[
body
.
project
Creato
r
],
receivers
:
[
body
.
project
LxTjUse
r
],
type
:
6
,
title
:
`项目【
${
body
.
projectName
}
】未通过部门长核准,请检查后重新提交!`
,
content
:
req
.
body
.
approvalMessage
||
`项目【
${
body
.
projectName
}
】未通过部门长核准,请检查后重新提交!`
...
...
@@ -479,13 +514,13 @@ async function approvalLixiangByTouGuanJbr(req, res, next) {
}
else
{
//投管部经办人审批不通过,更新项目信息和状态--直接回到项目提交人
req
.
body
.
daibanUsers
=
[
body
.
project
Creato
r
];
req
.
body
.
daibanUsers
=
[
body
.
project
LxTjUse
r
];
ret
=
await
xiangmulixianggengxin
(
body
,
"1"
);
// 给项目提交人发消息
await
DB
.
Message
.
create
({
projectId
:
body
.
id
,
creator
:
req
.
user
.
id
,
receivers
:
[
body
.
project
Creato
r
],
receivers
:
[
body
.
project
LxTjUse
r
],
type
:
8
,
// 初审不通过消息
title
:
`项目【
${
body
.
projectName
}
】未通过投管部经办人审批,请检查后重新提交!`
,
content
:
req
.
body
.
approvalMessage
||
`项目【
${
body
.
projectName
}
】未通过投管部经办人审批,请检查后重新提交!`
...
...
@@ -1501,6 +1536,11 @@ async function approvalZaiJuece(req, res, next) {
}
}
async
function
getCompanyProjectApprover
(
req
,
res
,
next
)
{
let
ret
=
await
userModule
.
getCompanyProjectApprover
(
46
);
return
res
.
sendData
(
ret
);
}
module
.
exports
=
{
getProjectFields
,
createProject
,
...
...
@@ -1526,4 +1566,5 @@ module.exports = {
saveZaiJuece
,
startZaiJuece
,
approvalZaiJuece
,
getCompanyProjectApprover
,
}
\ No newline at end of file
db/model/jt/project.js
View file @
37d30c98
...
...
@@ -36,6 +36,10 @@ const Project = sequelize.define('Project', {
defaultValue
:
0
,
comment1
:
"0 正常 1 删除"
,
},
projectLxTjUser
:
{
type
:
DataTypes
.
INTEGER
,
comment
:
"立项提交人"
,
},
projectHzUser
:
{
type
:
DataTypes
.
INTEGER
,
comment
:
"项目核准人ID"
,
...
...
@@ -319,8 +323,8 @@ const Project = sequelize.define('Project', {
sbdwhbzj
:
{
type
:
DataTypes
.
DECIMAL
(
20
,
8
),
allowNull
:
true
,
comment
:
"申报单位货币资金"
},
dxfzgm
:
{
type
:
DataTypes
.
STRING
,
allowNull
:
true
,
comment
:
"带息负债规模"
},
jlnsflxks
:
{
type
:
DataTypes
.
STRING
,
allowNull
:
true
,
comment
:
"近两年是否连续亏损"
,
_mark
:
'juece'
,
zjType
:
'danxuan'
,
zjKey
:
'sf'
},
// 项目可行性:项目投资现金流量表 项目资本金现金流量表 能建方现金流量表 利润表 投评报告及测算表 excel表
tjjh
:
{
type
:
DataTypes
.
JSON
},
xmtzzjll
:
{
type
:
DataTypes
.
JSON
},
...
...
@@ -330,14 +334,14 @@ const Project = sequelize.define('Project', {
//再决策
jcspdw
:
{
type
:
DataTypes
.
STRING
,
allowNull
:
true
,
comment
:
"决策审批单位"
,
_mark
:
'juece'
,
zjType
:
'danxuan'
,
},
jcspdw
:
{
type
:
DataTypes
.
STRING
,
allowNull
:
true
,
comment
:
"决策审批单位"
,
_mark
:
'juece'
,
zjType
:
'danxuan'
,
},
yykssj
:
{
type
:
DataTypes
.
DATE
,
allowNull
:
true
,
comment
:
"运营开始时间"
,
_mark
:
"juece"
},
yyjssj
:
{
type
:
DataTypes
.
DATE
,
allowNull
:
true
,
comment
:
"运营结束时间"
,
_mark
:
"juece"
},
tzwcqk
:
{
type
:
DataTypes
.
TEXT
,
allowNull
:
true
,
comment
:
"投资完成情况"
,
_mark
:
"juece"
},
tzhsqk
:
{
type
:
DataTypes
.
TEXT
,
allowNull
:
true
,
comment
:
"投资回收情况"
,
_mark
:
"juece"
},
//申请报告
"projectIntro"
:
{
"projectIntro"
:
{
"name"
:
"顶部描述信息"
,
"type"
:
DataTypes
.
TEXT
,
},
...
...
@@ -363,7 +367,7 @@ const Project = sequelize.define('Project', {
},
"dwzj"
:
{
"name"
:
"单位造价"
,
"type"
:
DataTypes
.
DECIMAL
(
20
,
8
)
"type"
:
DataTypes
.
DECIMAL
(
20
,
8
)
},
"tzgc"
:
{
"name"
:
"投资构成"
,
...
...
@@ -424,11 +428,11 @@ const Project = sequelize.define('Project', {
},
"zbjbl"
:
{
"name"
:
"资金方案-资本金-比例"
,
"type"
:
DataTypes
.
DECIMAL
(
20
,
8
)
"type"
:
DataTypes
.
DECIMAL
(
20
,
8
)
},
"zbjje"
:
{
"name"
:
"资金方案-资本金-金额"
,
"type"
:
DataTypes
.
DECIMAL
(
20
,
8
)
"type"
:
DataTypes
.
DECIMAL
(
20
,
8
)
},
"zbjly"
:
{
"name"
:
"资金方案-资本金-来源"
,
...
...
@@ -436,11 +440,11 @@ const Project = sequelize.define('Project', {
},
"dkbl"
:
{
"name"
:
"资金方案-贷款-比例"
,
"type"
:
DataTypes
.
DECIMAL
(
20
,
8
)
"type"
:
DataTypes
.
DECIMAL
(
20
,
8
)
},
"dkbje"
:
{
"name"
:
"资金方案-贷款-金额"
,
"type"
:
DataTypes
.
DECIMAL
(
20
,
8
)
"type"
:
DataTypes
.
DECIMAL
(
20
,
8
)
},
"dkrzzt"
:
{
"name"
:
"资金方案-贷款-融资主体"
,
...
...
@@ -448,11 +452,11 @@ const Project = sequelize.define('Project', {
},
"dkqx"
:
{
"name"
:
"资金方案-贷款-期限"
,
"type"
:
DataTypes
.
DECIMAL
(
20
,
8
)
"type"
:
DataTypes
.
DECIMAL
(
20
,
8
)
},
"dkll"
:
{
"name"
:
"资金方案-贷款-利率"
,
"type"
:
DataTypes
.
DECIMAL
(
20
,
8
)
"type"
:
DataTypes
.
DECIMAL
(
20
,
8
)
},
"dkdbfa"
:
{
"name"
:
"资金方案-贷款-担保方案"
,
...
...
@@ -504,11 +508,11 @@ const Project = sequelize.define('Project', {
},
"qtzcwnbsyl"
:
{
"name"
:
"经济可行性-全投资财务内部收益率(税前)"
,
"type"
:
DataTypes
.
DECIMAL
(
20
,
8
)
"type"
:
DataTypes
.
DECIMAL
(
20
,
8
)
},
"zbjcwnbsyl"
:
{
"name"
:
"经济可行性-资本金财务内部收益率(税后)"
,
"type"
:
DataTypes
.
DECIMAL
(
20
,
8
)
"type"
:
DataTypes
.
DECIMAL
(
20
,
8
)
},
"jxjlhznf"
:
{
"name"
:
"经济可行性-净现金流回正年份"
,
...
...
@@ -524,7 +528,7 @@ const Project = sequelize.define('Project', {
},
"cwjxz"
:
{
"name"
:
"经济可行性-财务净现值(税前)"
,
"type"
:
DataTypes
.
DECIMAL
(
20
,
8
)
"type"
:
DataTypes
.
DECIMAL
(
20
,
8
)
},
"jxjlList"
:
{
"name"
:
"经济可行性-净现金流table"
,
...
...
module/userModule.js
View file @
37d30c98
...
...
@@ -47,7 +47,7 @@ async function setUserDepart(userId, departIds, departs) {
dbIds
.
push
(
element
.
id
);
if
(
!
departIds
.
includes
(
element
.
id
))
{
// 1. departIds里面没有 但是关系表里有的 需要删除
needDelIds
.
push
(
element
.
id
);
needDelIds
.
push
(
element
.
id
);
}
}
for
(
let
index
=
0
;
index
<
departIds
.
length
;
index
++
)
{
...
...
@@ -105,7 +105,7 @@ async function setUserPosition(userId, positionIds, positions) {
* @param {*} rolemenus 角色已有的菜单
*/
async
function
setRoleMenu
(
roleId
,
menuIds
,
rolemenus
)
{
menuIds
=
menuIds
.
map
(
o
=>
{
return
o
&&
o
.
id
||
o
});
menuIds
=
menuIds
.
map
(
o
=>
{
return
o
&&
o
.
id
||
o
});
let
needAddIds
=
[],
needDelIds
=
[],
dbMenuIds
=
[];
for
(
let
index
=
0
;
index
<
rolemenus
.
length
;
index
++
)
{
const
element
=
rolemenus
[
index
];
...
...
@@ -132,44 +132,87 @@ async function setRoleMenu(roleId, menuIds, rolemenus) {
async
function
getCompanyProjectApprover
(
userId
,
roleCode
)
{
roleCode
=
roleCode
||
"xmssdwbmz"
;
//暂时
roleCode
=
roleCode
||
"xmssdwbmz"
;
//暂时
let
users
=
[];
// 获取投管部正副职tgbzfz的用户列表
let
role
=
await
DB
.
Role
.
findOne
({
where
:
{
key
:
roleCode
},
raw
:
true
});
if
(
!
(
role
&&
role
.
id
))
{
return
[];
}
let
userIds
=
await
DB
.
UserRole
.
findAll
({
where
:
{
roleId
:
role
.
id
},
raw
:
true
});
userIds
=
(
userIds
||
[]).
map
(
o
=>
{
return
o
.
userId
});
let
userDepart
=
await
DB
.
UserDepart
.
findOne
({
where
:
{
userId
},
raw
:
true
});
if
(
!
(
userDepart
&&
userDepart
.
departId
))
{
return
{};
}
let
departId
=
userDepart
.
departId
;
let
curentDepart
=
await
DB
.
Depart
.
findOne
({
where
:
{
id
:
departId
},
raw
:
true
});
console
.
log
(
"curentDepart"
,
curentDepart
)
//部门信息
if
(
!
(
curentDepart
&&
curentDepart
.
id
))
{
return
{};
}
let
parentIds
=
curentDepart
.
parentIds
?
curentDepart
.
parentIds
.
split
(
","
)
:
[];
console
.
log
(
"parentIds"
,
parentIds
)
//部门父级信息
if
(
departId
==
41
||
parentIds
.
includes
(
41
)
||
parentIds
.
includes
(
'41'
))
{
//写死 投管部
users
=
await
getTouGuanZfzProjectApprover
(
userId
);
return
{
users
,
type
:
1
};
}
else
if
(
parentIds
.
includes
(
86
)
||
parentIds
.
includes
(
'86'
))
{
//项目公司
let
pidStr
=
""
;
if
(
curentDepart
.
parentId
==
86
)
{
//项目公司
pidStr
=
curentDepart
.
parentIds
+
curentDepart
.
id
;
// 为了查询currentDepart.id所有部门
}
else
{
// 项目公司下属部门
const
index
=
parentIds
.
indexOf
(
86
);
let
users
=
await
DB
.
User
.
findAll
({
where
:
{
id
:
{[
Op
.
in
]:
userIds
}
}
});
return
users
;
const
result
=
index
!==
-
1
?
parentIds
.
slice
(
0
,
index
+
1
)
:
parentIds
;
pidStr
=
result
.
join
(
","
);
}
console
.
log
(
"pidStr"
,
pidStr
)
//项目公司部门id字符串
let
departs
=
await
DB
.
Depart
.
findAll
({
where
:
{
parentIds
:
{
[
Op
.
like
]:
`%
${
pidStr
}
%`
}
},
raw
:
true
});
departs
.
push
(
curentDepart
);
//加上当前部门
console
.
log
(
"departs"
,
departs
)
//项目公司下属部门信息
let
departIds
=
departs
.
map
(
o
=>
{
return
o
.
id
});
let
userDeparts
=
await
DB
.
UserDepart
.
findAll
({
where
:
{
departId
:
{
[
Op
.
in
]:
departIds
}
},
raw
:
true
});
let
userIds
=
userDeparts
.
map
(
o
=>
{
return
o
.
userId
});
console
.
log
(
"userIds"
,
userIds
)
//部门用户信息
users
=
await
DB
.
User
.
findAll
({
where
:
{
id
:
{
[
Op
.
in
]:
userIds
}
},
include
:
[{
model
:
DB
.
Role
,
as
:
'roles'
,
where
:
{
del
:
0
,
key
:
roleCode
},
attributes
:
[
"id"
,
"name"
],
},]
});
return
{
users
,
type
:
1
};
}
}
async
function
getTouGuanJbrProjectApprover
(
userId
,
roleCode
)
{
roleCode
=
roleCode
||
"tgbjbr"
;
roleCode
=
roleCode
||
"tgbjbr"
;
// 获取投管部正副职tgbzfz的用户列表
let
role
=
await
DB
.
Role
.
findOne
({
where
:
{
key
:
roleCode
},
raw
:
true
});
if
(
!
(
role
&&
role
.
id
))
{
let
role
=
await
DB
.
Role
.
findOne
({
where
:
{
key
:
roleCode
},
raw
:
true
});
if
(
!
(
role
&&
role
.
id
))
{
return
[];
}
let
userIds
=
await
DB
.
UserRole
.
findAll
({
where
:
{
roleId
:
role
.
id
},
raw
:
true
});
userIds
=
(
userIds
||
[]).
map
(
o
=>
{
return
o
.
userId
});
let
userIds
=
await
DB
.
UserRole
.
findAll
({
where
:
{
roleId
:
role
.
id
},
raw
:
true
});
userIds
=
(
userIds
||
[]).
map
(
o
=>
{
return
o
.
userId
});
let
users
=
await
DB
.
User
.
findAll
({
where
:
{
id
:
{[
Op
.
in
]:
userIds
}
}
});
let
users
=
await
DB
.
User
.
findAll
({
where
:
{
id
:
{
[
Op
.
in
]:
userIds
}
}
});
return
users
;
}
async
function
getTouGuanZfzProjectApprover
(
userId
,
roleCode
)
{
roleCode
=
roleCode
||
"tgbzfz"
;
// 获取投管部正副职tgbzfz的用户列表
let
role
=
await
DB
.
Role
.
findOne
({
where
:
{
key
:
roleCode
},
raw
:
true
});
if
(
!
(
role
&&
role
.
id
))
{
let
role
=
await
DB
.
Role
.
findOne
({
where
:
{
key
:
roleCode
},
raw
:
true
});
if
(
!
(
role
&&
role
.
id
))
{
return
[];
}
let
userIds
=
await
DB
.
UserRole
.
findAll
({
where
:
{
roleId
:
role
.
id
},
raw
:
true
});
userIds
=
(
userIds
||
[]).
map
(
o
=>
{
return
o
.
userId
});
let
userIds
=
await
DB
.
UserRole
.
findAll
({
where
:
{
roleId
:
role
.
id
},
raw
:
true
});
userIds
=
(
userIds
||
[]).
map
(
o
=>
{
return
o
.
userId
});
let
users
=
await
DB
.
User
.
findAll
({
where
:
{
id
:
{[
Op
.
in
]:
userIds
}
}
});
let
users
=
await
DB
.
User
.
findAll
({
where
:
{
id
:
{
[
Op
.
in
]:
userIds
}
}
});
return
users
;
}
...
...
router/projectRouter.js
View file @
37d30c98
...
...
@@ -47,7 +47,7 @@ router.post('/listProject', projectController.listProject);
// router.post('/preJugProject', projectController.preJugProject); //初审
// router.post('/finalJugProject', projectController.finalJugProject); //终审 --暂时没有
// router.post('/getOwnProjects', projectController.getOwnProjects
);
router
.
post
(
'/getCompanyProjectApprover'
,
projectController
.
getCompanyProjectApprover
);
router
.
post
(
'/getProFlowRecord'
,
projectController
.
getProFlowRecord
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment