明树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
f75f3111
Commit
f75f3111
authored
Dec 22, 2025
by
zfp1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
c40c19ee
Pipeline
#105031
passed with stage
in 5 seconds
Changes
8
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
121 additions
and
117 deletions
+121
-117
README.md
README.md
+0
-89
departController.js
controller/departController.js
+35
-17
roleController.js
controller/roleController.js
+13
-0
userController.js
controller/userController.js
+64
-5
package.json
package.json
+1
-0
index.js
router/index.js
+2
-6
userRouter.js
router/userRouter.js
+2
-0
errorMessage.js
utils/errorMessage.js
+4
-0
No files found.
README.md
View file @
f75f3111
mindmap
root((投资管理系统))
管理层功能
监控驾驶舱
► 投资指标可视化(数量/金额/完成率)
► 运营指标可视化(路段分布/交通量/收入成本)
► 安全告警实时监控
► 五年趋势分析图
项目库查询
► 阶段分类查询(开发/建设/运营)
► 商业模式过滤
► 产业类型检索
► 退出项目状态查询
项目阶段监管
► 执行建设监控(投运时点/建设期)
► 运营监控(月报生成/计划下发)
► 资产经营监控(处置流程跟踪)
风险预警管理
► 风险因素识别分析
► 风险模拟推演引擎
► 阈值告警机制
► 风险应对措施库
同业对标管理
数据治理中心
专业层功能
个人工作台
► 待办任务处理
► 重要事项提醒
► 督办消息管理
► 消息统计分析
投资决策管理
► 项目信息申报
► 可行性研究管理
► 竞标预审核
► 项目公司设立(工商/产权)
项目信息库
► 全周期档案管理
► 立项/合同信息库
► 投资评价数据池
► 合规性验证
计划管理
► 多维计划填报(投资/融资/进度)
► 计划变更控制
► 执行偏差分析
► 自动上报批复
建设实施管理
► 概预算控制
► 合同生命周期管理
► 进度甘特图监控
► 质量安全双体系
► 竣工结算管理
运营回收管理
► 机电设备台账
► 养护计划执行
► 收费成本联动
► 财务数据分析
还本付息管理
► 还款计划关联
► 利息计算引擎
► 实际还款记录
投资退出管理
► 资产处置流程
► 股权转让管理
► 历史项目追溯
报表统计中心
► 投资明细多维查询
► 自动报告生成(月/季/年)
► 数据上报配置器
► 经营分析仪表盘
风险预警模块
► 指标阈值配置
► 异常定位看板
综合管理
► 标准制度发布
► 督导任务分发
► 偏差/超期/风险三督导
系统集成
纵向集成
► 管理层-专业层数据通道
► 计划下达/执行上报
横向集成
► 财务系统对接(资金流)
► 统一门户单点登录
► 身份认证同步
外部对接
► 第三方支付网关
► 电子签章系统
\ No newline at end of file
controller/departController.js
View file @
f75f3111
...
...
@@ -85,17 +85,30 @@ async function treeDepart(req, res, next) {
}
/**
*
* 删除
菜单,则此菜单所有子菜单借删除
* 删除
部门
*/
async
function
deleteDepart
(
req
,
res
,
next
)
{
try
{
if
(
!
req
.
body
.
id
)
{
return
res
.
sendError
(
errorMessage
.
resourceNotFound
);
}
let
curNode
=
await
DB
.
Depart
.
findOne
({
where
:
{
id
:
req
.
body
.
id
}
});
let
curNode
=
await
DB
.
Depart
.
findOne
({
where
:
{
id
:
req
.
body
.
id
},
// include: [
// {model: DB.User, as: 'users', through: { attributes: [] } }
// ]
});
if
(
!
(
curNode
&&
curNode
.
id
))
{
return
res
.
sendError
(
errorMessage
.
resourceNotFound
);
}
//查验部门下是否有用户
let
depIds
=
curNode
.
parentIds
?
curNode
.
parentIds
.
split
(
','
)
:
[];
depIds
.
push
(
curNode
.
id
);
let
count
=
await
DB
.
UserDepart
.
count
({
where
:
{
departId
:
{[
Op
.
in
]:
depIds
}}});
if
(
count
&&
count
>
0
)
{
return
res
.
sendError
(
errorMessage
.
departHasUser
);
}
//删除所有的子部门
let
parStr
=
curNode
.
parentIds
?
`
${
curNode
.
parentIds
}
,
${
curNode
.
id
}
`
:
curNode
.
id
;
//拼接父字符串查找所有的子
const
ret
=
await
DB
.
Depart
.
update
(
{
del
:
1
},
...
...
@@ -107,6 +120,8 @@ async function deleteDepart(req, res, next) {
]
}
});
//删除所有部门下的用户绑定---不能删,删掉会导致部分用户没有部门
return
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
);
...
...
@@ -118,7 +133,10 @@ async function getDepart(req, res, next) {
if
(
!
req
.
body
.
id
)
{
return
res
.
sendError
(
errorMessage
.
resourceNotFound
);
}
const
ret
=
await
DB
.
Depart
.
findOne
({
where
:
{
id
:
req
.
body
.
id
},
raw
:
true
});
const
ret
=
await
DB
.
Depart
.
findOne
({
where
:
{
id
:
req
.
body
.
id
},
raw
:
true
,
});
return
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
);
...
...
@@ -133,19 +151,19 @@ async function getDepartUsers(req, res, next) {
let
offset
=
(
page
-
1
)
*
limit
;
let
search
=
{}
search
=
{
where
:
{
del
:
0
},
limit
,
offset
,
distinct
:
true
,
col
:
'id'
,
include
:
[
{
model
:
DB
.
Role
,
as
:
'roles'
,
through
:
{
attributes
:
[]
}
},
{
model
:
DB
.
Depart
,
as
:
'departs'
,
through
:
{
attributes
:
[]
}
},
{
model
:
DB
.
Position
,
as
:
'positions'
,
through
:
{
attributes
:
[]
}
}
]
};
where
:
{
del
:
0
},
limit
,
offset
,
distinct
:
true
,
col
:
'id'
,
include
:
[
{
model
:
DB
.
Role
,
as
:
'roles'
,
through
:
{
attributes
:
[]
}
},
{
model
:
DB
.
Depart
,
as
:
'departs'
,
through
:
{
attributes
:
[]
}
},
{
model
:
DB
.
Position
,
as
:
'positions'
,
through
:
{
attributes
:
[]
}
}
]
};
search
.
attributes
=
req
.
body
.
attributes
||
{
exclude
:
[
'password'
,
'salt'
]
};
if
(
!
req
.
body
.
departId
)
{
return
res
.
sendError
(
errorMessage
.
resourceNotFound
);
...
...
@@ -159,7 +177,7 @@ async function getDepartUsers(req, res, next) {
if
(
req
.
body
.
mobile
)
{
search
.
where
.
mobile
=
{
[
Op
.
like
]:
`%
${
req
.
body
.
mobile
}
%`
};
}
console
.
log
(
"search"
,
search
)
console
.
log
(
"search"
,
search
)
const
ret
=
await
DB
.
User
.
findAndCountAll
(
search
);
return
res
.
sendData
(
ret
);
}
catch
(
error
)
{
...
...
controller/roleController.js
View file @
f75f3111
...
...
@@ -59,7 +59,13 @@ async function deleteRole(req, res, next) {
if
(
!
req
.
body
.
id
)
{
return
res
.
sendError
(
errorMessage
.
resourceNotFound
);
}
// let urs = await DB.UserRole.findAll({where: {roleId: req.bodyshan.id}, raw: true});
// if(urs && urs.length > 0) {
// // res.sendError()
// }
const
ret
=
await
DB
.
Role
.
update
({
del
:
1
},
{
where
:
{
id
:
req
.
body
.
id
}
});
//删除用户角色绑定
await
DB
.
UserRole
.
destory
({
where
:
{
roleId
:
req
.
body
.
id
}});
return
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
);
...
...
@@ -104,6 +110,13 @@ async function getRole(req, res, next) {
// where: {del: 0},
attributes
:
[
"id"
],
through
:
{
attributes
:
[]
},
},
{
model
:
DB
.
User
,
as
:
'users'
,
// where: {del: 0},
attributes
:
[
"id"
],
through
:
{
attributes
:
[]
},
}
]
});
...
...
controller/userController.js
View file @
f75f3111
...
...
@@ -93,6 +93,59 @@ async function login(req, res, next) {
next
(
error
);
}
}
async
function
getUserRoleMenuList
(
req
,
res
,
next
)
{
try
{
let
id
=
req
.
user
.
id
;
let
user
=
await
DB
.
User
.
findOne
({
where
:
{
id
},
include
:
[{
model
:
DB
.
Role
,
as
:
'roles'
,
// where: { del: 0 },
attributes
:
[
"id"
,
"name"
],
through
:
{
attributes
:
[]
},
include
:
[{
model
:
DB
.
Menu
,
as
:
'menus'
,
// where: { del: 0 },
// attributes: ['id', 'name', 'parentId'],
through
:
{
attributes
:
[]
},
}]
},
// {
// model: DB.Depart,
// as: 'departs',
// // where: { del: 0 }, 当刚注册的用户 没有分配角色、部门时加上条件会查不到
// attributes: ["id", "name"],
// through: { attributes: [] },
// }
]
});
if
(
!
user
)
{
return
res
.
sendError
(
errorMessage
.
resourceNotFound
);
}
user
=
user
.
toJSON
();
//处理菜单
const
roles
=
user
.
roles
||
[];
let
newRoles
=
[],
menus
=
[];
for
(
let
index
=
0
;
index
<
roles
.
length
;
index
++
)
{
const
element
=
roles
[
index
];
menus
=
menus
.
concat
(
element
.
menus
);
delete
element
.
menus
;
newRoles
.
push
(
element
);
}
let
allMenus
=
await
DB
.
Menu
.
findAll
({
where
:
{
del
:
0
},
raw
:
true
});
let
newMenus
=
utils
.
buildTree
(
allMenus
);
return
res
.
sendData
({
menus
:
newMenus
,
roles
:
newRoles
,
});
}
catch
(
error
)
{
next
(
error
);
}
}
/**
...
...
@@ -278,18 +331,23 @@ async function listUser(req, res, next) {
async
function
deleteUser
(
req
,
res
,
next
)
{
try
{
const
body
=
req
.
body
;
let
search
=
{};
if
(
body
.
id
)
{
search
=
{
id
:
body
.
id
};
if
(
req
.
body
.
id
)
{
search
=
{
id
:
req
.
body
.
id
};
}
if
(
body
.
mobile
)
{
search
=
{
mobile
:
body
.
mobile
}
if
(
req
.
body
.
mobile
)
{
search
=
{
mobile
:
req
.
body
.
mobile
}
}
if
(
_
.
isEmpty
(
search
))
{
return
res
.
sendError
(
errorMessage
.
resourceNotFound
);
}
const
ret
=
await
DB
.
User
.
update
({
del
:
1
},
{
where
:
search
});
//删除标记
//删除用户与角色绑定
await
DB
.
UserRole
.
destory
({
where
:
{
userId
:
req
.
body
.
id
}});
//删除用户与部门绑定
await
DB
.
UserDepart
.
destory
({
where
:
{
userId
:
req
.
body
.
id
}});
//删除用户与岗位绑定
await
DB
.
UserPosition
.
destory
({
where
:
{
userId
:
req
.
body
.
id
}});
return
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
);
...
...
@@ -330,4 +388,5 @@ module.exports = {
deleteUser
,
setUserRole
,
logout
,
getUserRoleMenuList
,
}
\ No newline at end of file
package.json
View file @
f75f3111
...
...
@@ -29,6 +29,7 @@
"
joi
"
:
"
17.13.1
"
,
"
lodash
"
:
"
4.17.21
"
,
"
moment
"
:
"
2.30.1
"
,
"
mongodb
"
:
"
^7.0.0
"
,
"
morgan
"
:
"
1.10.0
"
,
"
multer
"
:
"
1.4.5-lts.1
"
,
"
mysql2
"
:
"
^3.15.3
"
,
...
...
router/index.js
View file @
f75f3111
...
...
@@ -2,12 +2,8 @@ const express = require('express');
const
router
=
express
.
Router
();
const
userRouter
=
require
(
"./userRouter"
);
const
fileRouter
=
require
(
"./fileRouter"
);
router
.
use
(
'/user'
,
userRouter
);
// 用户 角色 菜单
router
.
use
(
'/file'
,
fileRouter
);
// 文件上传下载
router
.
use
(
'/user'
,
require
(
"./userRouter"
));
// 用户 角色 菜单
router
.
use
(
'/file'
,
require
(
"./fileRouter"
));
// 文件上传下载
router
.
use
(
'/project'
,
require
(
'./projectRouter.js'
));
// 项目管理
...
...
router/userRouter.js
View file @
f75f3111
...
...
@@ -14,6 +14,8 @@ const positionController = require('../controller/positionController'); //职位
*/
router
.
post
(
'/regist'
,
userController
.
regist
);
router
.
post
(
'/login'
,
userController
.
login
);
router
.
post
(
'/getUserRoleMenuList'
,
userController
.
getUserRoleMenuList
);
router
.
post
(
'/manage/listUser'
,
userController
.
listUser
);
router
.
post
(
'/manage/createUser'
,
userController
.
createUser
);
router
.
post
(
'/manage/updateUser'
,
userController
.
updateUser
);
//更新 enable用户
...
...
utils/errorMessage.js
View file @
f75f3111
...
...
@@ -17,6 +17,10 @@ module.exports = {
code
:
40004
,
message
:
"参数错误"
},
departHasUser
:
{
code
:
40005
,
message
:
"该部门下有绑定用户,不能删除!"
},
databaseQueryError
:
{
...
...
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