明树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
6588ab91
Commit
6588ab91
authored
Dec 06, 2025
by
zfp1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
7912bdfb
Pipeline
#104235
passed with stage
in 4 seconds
Changes
7
Pipelines
1
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
198 additions
and
162 deletions
+198
-162
projectController.js
controller/projectController.js
+32
-2
templateController.js
controller/templateController.js
+101
-160
index.js
db/index.js
+5
-0
projectExcelData.js
db/model/jt/projectExcelData.js
+55
-0
projectTjjh_del.js
db/model/jt/projectTjjh_del.js
+0
-0
package.json
package.json
+1
-0
projectRouter.js
router/projectRouter.js
+4
-0
No files found.
controller/projectController.js
View file @
6588ab91
...
...
@@ -766,6 +766,35 @@ async function finalJugProject(req, res, next) {
}
}
async
function
getProjectCwpj
(
req
,
res
,
next
)
{
try
{
const
projectId
=
req
.
body
.
id
;
if
(
!
projectId
)
{
return
res
.
sendError
(
errorMessage
.
resourceNotFound
);
}
const
sql
=
`SELECT * FROM (
SELECT
*,
ROW_NUMBER() OVER (
PARTITION BY tampName
ORDER BY updatedAt DESC, id DESC
) AS row_num
FROM jt_project_excel_data
WHERE projectId = :projectId AND del = 0
) AS ranked
WHERE row_num = 1`
;
const
results
=
await
DB
.
sequelize
.
query
(
sql
,
{
replacements
:
{
projectId
},
type
:
sequelize
.
QueryTypes
.
SELECT
,
model
:
DB
.
ProjectExcelData
,
// 替换为实际模型
mapToModel
:
true
});
return
res
.
sendData
(
results
);
}
catch
(
error
)
{
next
(
error
);
}
}
async
function
getProjectInfo
(
req
,
res
,
next
)
{
try
{
if
(
!
req
.
body
.
id
)
{
...
...
@@ -834,8 +863,8 @@ async function listProject(req, res, next) {
projectLzTypes
=
[
5
,
7
,
8
,
9
];
break
;
}
if
(
req
.
body
.
menuType
)
{
where
.
projectLzType
=
{
[
Op
.
in
]:
projectLzTypes
}
if
(
req
.
body
.
menuType
)
{
where
.
projectLzType
=
{
[
Op
.
in
]:
projectLzTypes
}
}
console
.
log
(
projectLzTypes
)
search
.
where
=
where
;
...
...
@@ -999,4 +1028,5 @@ module.exports = {
saveProjectPreLixiang
,
queryLixiangResult
,
queryJueceResult
,
getProjectCwpj
,
}
\ No newline at end of file
controller/templateController.js
View file @
6588ab91
This diff is collapsed.
Click to expand it.
db/index.js
View file @
6588ab91
const
sequelize
=
require
(
'./model/index'
);
// 模型初始化
const
User
=
require
(
"./model/system/user"
);
const
Role
=
require
(
"./model/system/role"
);
...
...
@@ -31,6 +33,7 @@ const ProjectTzzjll = require("./model/jt/projectTzzjll");
const
ProjectTzzt
=
require
(
"./model/jt/projectTzzt"
);
const
ProjectXmtzze
=
require
(
"./model/jt/projectXmtzze"
);
const
ProjectLixiang
=
require
(
"./model/jt/projectLixiang"
);
const
ProjectExcelData
=
require
(
"./model/jt/projectExcelData"
);
/**
...
...
@@ -40,6 +43,7 @@ const ProjectLixiang = require("./model/jt/projectLixiang");
global
.
DB
=
{
sequelize
,
User
,
RequestLog
,
Role
,
...
...
@@ -69,6 +73,7 @@ global.DB = {
Message
,
FlowRecord
,
ProjectLixiang
,
ProjectExcelData
,
}
...
...
db/model/jt/projectExcelData.js
0 → 100644
View file @
6588ab91
const
{
DataTypes
}
=
require
(
'sequelize'
);
const
sequelize
=
require
(
'../index'
);
const
moment
=
require
(
'moment'
);
//投决计划---决策信息--财务评价--投决计划
const
ProjectExcelData
=
sequelize
.
define
(
'ProjectExcelData'
,
{
id
:
{
type
:
DataTypes
.
INTEGER
,
primaryKey
:
true
,
autoIncrement
:
true
},
tampName
:
{
type
:
DataTypes
.
STRING
,
allowNull
:
true
,
comment
:
"模板名称"
},
data
:
{
type
:
DataTypes
.
JSON
,
allowNull
:
true
,
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('createdAt');
// return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
// }
// }
},
{
tableName
:
'jt_project_excel_data'
,
// 指定表名(如果与模型名不同)
timestamps
:
true
,
// 是否自动添加 createdAt 和 updatedAt 字段(覆盖全局设置)
});
// 同步模型到数据库(创建表)
ProjectExcelData
.
sync
({
force
:
false
,
// force: true ,//会删除已存在表并重新创建
// alter: true
})
.
then
(()
=>
{
console
.
log
(
'ProjectExcelData 表同步成功'
);
});
module
.
exports
=
ProjectExcelData
;
\ No newline at end of file
db/model/jt/projectTjjh.js
→
db/model/jt/projectTjjh
_del
.js
View file @
6588ab91
File moved
package.json
View file @
6588ab91
...
...
@@ -24,6 +24,7 @@
"
exceljs
"
:
"
4.4.0
"
,
"
express
"
:
"
4.19.2
"
,
"
form-data
"
:
"
4.0.0
"
,
"
hyperformula
"
:
"
^3.1.0
"
,
"
ioredis
"
:
"
5.4.1
"
,
"
joi
"
:
"
17.13.1
"
,
"
lodash
"
:
"
4.17.21
"
,
...
...
router/projectRouter.js
View file @
6588ab91
...
...
@@ -25,6 +25,10 @@ router.post('/startJuece', projectController.startJuece); //发起决策
router
.
post
(
'/queryJueceResult'
,
projectController
.
queryJueceResult
);
//查询决策审批结果
// 财务评价
router
.
post
(
'/getProjectCwpj'
,
projectController
.
getProjectCwpj
);
router
.
post
(
'/getProjectInfo'
,
projectController
.
getProjectInfo
);
router
.
post
(
'/updateProject'
,
projectController
.
updateProject
);
...
...
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