明树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
9b2d8967
Commit
9b2d8967
authored
Feb 02, 2026
by
zfp1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
669d51da
Pipeline
#106886
passed with stage
in 3 seconds
Changes
5
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
339 additions
and
263 deletions
+339
-263
projectThController.js
controller/projectThController.js
+40
-40
projectTzController.js
controller/projectTzController.js
+40
-40
thYyqtzhszb.js
db/model/jt/thYyqtzhszb.js
+92
-92
tzJsqtzhs.js
db/model/jt/tzJsqtzhs.js
+76
-0
tzJsqtzhszb.js
db/model/jt/tzJsqtzhszb.js
+91
-91
No files found.
controller/projectThController.js
View file @
9b2d8967
...
@@ -19,23 +19,23 @@ async function createYyqtzhs(req, res, next) {
...
@@ -19,23 +19,23 @@ async function createYyqtzhs(req, res, next) {
}
}
let
ret
=
await
DB
.
ThTzYyqtzhs
.
create
(
req
.
body
);
let
ret
=
await
DB
.
ThTzYyqtzhs
.
create
(
req
.
body
);
//处理财务指标
//
//
处理财务指标
let
flattenArr
=
[];
//
let flattenArr = [];
let
yyqtzhss
=
req
.
body
.
yyqtzhss
||
[[]];
//二维数组 多次上报
//
let yyqtzhss = req.body.yyqtzhss || [[]]; //二维数组 多次上报
delete
req
.
body
.
yyqtzhss
;
//
delete req.body.yyqtzhss;
for
(
let
index
=
0
;
index
<
yyqtzhss
.
length
;
index
++
)
{
//
for (let index = 0; index < yyqtzhss.length; index++) {
const
element
=
yyqtzhss
[
index
];
//
const element = yyqtzhss[index];
for
(
let
i
=
0
;
i
<
element
.
length
;
i
++
)
{
//
for (let i = 0; i < element.length; i++) {
let
ei
=
element
[
i
];
//
let ei = element[i];
ei
.
groupBy
=
index
;
//
ei.groupBy = index;
ei
.
projectId
=
req
.
body
.
projectId
;
//
ei.projectId = req.body.projectId;
ei
.
sourceId
=
ret
.
id
;
//
ei.sourceId = ret.id;
flattenArr
.
push
(
ei
);
//
flattenArr.push(ei);
}
//
}
}
//
}
delete
req
.
body
.
yyqtzhss
;
//
delete req.body.yyqtzhss;
await
DB
.
ThTzYyqtzhszb
.
bulkCreate
(
flattenArr
);
//
await DB.ThTzYyqtzhszb.bulkCreate(flattenArr);
return
res
.
sendData
(
ret
);
return
res
.
sendData
(
ret
);
}
catch
(
error
)
{
}
catch
(
error
)
{
next
(
error
);
next
(
error
);
...
@@ -55,8 +55,8 @@ async function getYyqtzhsInfo(req, res, next) {
...
@@ -55,8 +55,8 @@ async function getYyqtzhsInfo(req, res, next) {
if
(
!
(
tzhs
&&
tzhs
.
id
&&
tzhs
.
projectId
))
{
if
(
!
(
tzhs
&&
tzhs
.
id
&&
tzhs
.
projectId
))
{
return
res
.
sendError
(
errorMessage
.
resourceNotFound
);
return
res
.
sendError
(
errorMessage
.
resourceNotFound
);
}
}
let
yyqtzhss
=
await
DB
.
ThTzYyqtzhszb
.
findAll
({
where
:
{
projectId
:
tzhs
.
projectId
,
sourceId
:
req
.
body
.
id
},
raw
:
true
});
//
let yyqtzhss = await DB.ThTzYyqtzhszb.findAll({ where: { projectId: tzhs.projectId, sourceId: req.body.id }, raw: true });
tzhs
.
yyqtzhss
=
_
.
values
(
_
.
groupBy
(
yyqtzhss
,
'groupBy'
))
||
[[]]
//
tzhs.yyqtzhss = _.values(_.groupBy(yyqtzhss, 'groupBy')) || [[]]
return
res
.
sendData
(
tzhs
);
return
res
.
sendData
(
tzhs
);
}
catch
(
error
)
{
}
catch
(
error
)
{
next
(
error
);
next
(
error
);
...
@@ -67,28 +67,28 @@ async function updateYyqtzhs(req, res, next) {
...
@@ -67,28 +67,28 @@ async function updateYyqtzhs(req, res, next) {
if
(
!
req
.
body
.
projectId
)
{
if
(
!
req
.
body
.
projectId
)
{
return
res
.
sendError
(
errorMessage
.
paramsError
);
return
res
.
sendError
(
errorMessage
.
paramsError
);
}
}
let
yyqtzhss
=
req
.
body
.
yyqtzhss
||
[[]];
//二维数组 多次上报
//
let yyqtzhss = req.body.yyqtzhss || [[]]; //二维数组 多次上报
let
ids3
=
[],
infos3
=
[],
newtyyqtzhss
=
[];
//
let ids3 = [], infos3 = [], newtyyqtzhss = [];
for
(
let
index
=
0
;
index
<
yyqtzhss
.
length
;
index
++
)
{
//
for (let index = 0; index < yyqtzhss.length; index++) {
const
element
=
yyqtzhss
[
index
];
//
const element = yyqtzhss[index];
for
(
let
i
=
0
;
i
<
element
.
length
;
i
++
)
{
//
for (let i = 0; i < element.length; i++) {
let
ei
=
element
[
i
];
//
let ei = element[i];
ei
.
groupBy
=
index
;
//
ei.groupBy = index;
ei
.
projectId
=
req
.
body
.
projectId
;
//
ei.projectId = req.body.projectId;
ei
.
sourceId
=
req
.
body
.
id
;
//
ei.sourceId = req.body.id;
if
(
!
ei
.
id
)
{
//
if (!ei.id) {
if
(
!
_
.
isEmpty
(
ei
))
{
//
if (!_.isEmpty(ei)) {
newtyyqtzhss
.
push
(
ei
);
//
newtyyqtzhss.push(ei);
}
//
}
}
else
{
//
} else {
ids3
.
push
(
ei
.
id
);
infos3
.
push
(
ei
);
//
ids3.push(ei.id); infos3.push(ei);
}
//
}
}
//
}
}
//
}
await
DB
.
ThTzYyqtzhszb
.
destroy
({
where
:
{
projectId
:
req
.
body
.
projectId
,
sourceId
:
req
.
body
.
id
,
id
:
{
[
Op
.
notIn
]:
ids3
}
}
});
// 删除id不在传入id数组里面的(用户在界面删除的)
//
await DB.ThTzYyqtzhszb.destroy({ where: { projectId: req.body.projectId, sourceId: req.body.id, id: { [Op.notIn]: ids3 } } }); // 删除id不在传入id数组里面的(用户在界面删除的)
await
DB
.
ThTzYyqtzhszb
.
bulkCreate
(
newtyyqtzhss
);
//创建新的 没有id的
//
await DB.ThTzYyqtzhszb.bulkCreate(newtyyqtzhss);//创建新的 没有id的
await
Promise
.
all
(
infos3
.
map
(
item
=>
{
DB
.
ThTzYyqtzhszb
.
update
(
item
,
{
where
:
{
id
:
item
.
id
}
})
}));
//
await Promise.all(infos3.map(item => { DB.ThTzYyqtzhszb.update(item, { where: { id: item.id } }) }));
delete
req
.
body
.
yyqtzhss
;
//
delete req.body.yyqtzhss;
await
DB
.
ThTzYyqtzhs
.
update
(
req
.
body
,
{
where
:
{
id
:
req
.
body
.
id
}
});
await
DB
.
ThTzYyqtzhs
.
update
(
req
.
body
,
{
where
:
{
id
:
req
.
body
.
id
}
});
return
res
.
sendData
({});
return
res
.
sendData
({});
...
...
controller/projectTzController.js
View file @
9b2d8967
...
@@ -580,23 +580,23 @@ async function createJsqtzhs(req, res, next) {
...
@@ -580,23 +580,23 @@ async function createJsqtzhs(req, res, next) {
return
res
.
sendError
(
errorMessage
.
paramsError
);
return
res
.
sendError
(
errorMessage
.
paramsError
);
}
}
let
ret
=
await
DB
.
TzJsqtzhs
.
create
(
req
.
body
);
let
ret
=
await
DB
.
TzJsqtzhs
.
create
(
req
.
body
);
//处理财务指标
//
//
处理财务指标
let
flattenArr
=
[];
//
let flattenArr = [];
let
jsqtzhss
=
req
.
body
.
jsqtzhss
||
[[]];
//二维数组 多次上报
//
let jsqtzhss = req.body.jsqtzhss || [[]]; //二维数组 多次上报
delete
req
.
body
.
jsqtzhss
;
//
delete req.body.jsqtzhss;
for
(
let
index
=
0
;
index
<
jsqtzhss
.
length
;
index
++
)
{
//
for (let index = 0; index < jsqtzhss.length; index++) {
const
element
=
jsqtzhss
[
index
];
//
const element = jsqtzhss[index];
for
(
let
i
=
0
;
i
<
element
.
length
;
i
++
)
{
//
for (let i = 0; i < element.length; i++) {
let
ei
=
element
[
i
];
//
let ei = element[i];
ei
.
groupBy
=
index
;
//
ei.groupBy = index;
ei
.
projectId
=
req
.
body
.
projectId
;
//
ei.projectId = req.body.projectId;
ei
.
sourceId
=
ret
.
id
;
//
ei.sourceId = ret.id;
flattenArr
.
push
(
ei
);
//
flattenArr.push(ei);
}
//
}
}
//
}
delete
req
.
body
.
jsqtzhss
;
//
delete req.body.jsqtzhss;
await
DB
.
TzJsqtzhszb
.
bulkCreate
(
flattenArr
);
//
await DB.TzJsqtzhszb.bulkCreate(flattenArr);
return
res
.
sendData
(
ret
);
return
res
.
sendData
(
ret
);
}
catch
(
error
)
{
}
catch
(
error
)
{
next
(
error
);
next
(
error
);
...
@@ -616,8 +616,8 @@ async function getJsqtzhsInfo(req, res, next) {
...
@@ -616,8 +616,8 @@ async function getJsqtzhsInfo(req, res, next) {
if
(
!
(
tzhs
&&
tzhs
.
id
&&
tzhs
.
projectId
))
{
if
(
!
(
tzhs
&&
tzhs
.
id
&&
tzhs
.
projectId
))
{
return
res
.
sendError
(
errorMessage
.
resourceNotFound
);
return
res
.
sendError
(
errorMessage
.
resourceNotFound
);
}
}
let
jsqtzhss
=
await
DB
.
TzJsqtzhszb
.
findAll
({
where
:
{
projectId
:
tzhs
.
projectId
,
sourceId
:
tzhs
.
id
},
raw
:
true
});
//
let jsqtzhss = await DB.TzJsqtzhszb.findAll({ where: { projectId: tzhs.projectId, sourceId: tzhs.id }, raw: true });
tzhs
.
jsqtzhss
=
_
.
values
(
_
.
groupBy
(
jsqtzhss
,
'groupBy'
))
||
[[]]
//
tzhs.jsqtzhss = _.values(_.groupBy(jsqtzhss, 'groupBy')) || [[]]
return
res
.
sendData
(
tzhs
);
return
res
.
sendData
(
tzhs
);
}
catch
(
error
)
{
}
catch
(
error
)
{
next
(
error
);
next
(
error
);
...
@@ -632,28 +632,28 @@ async function updateJsqtzhs(req, res, next) {
...
@@ -632,28 +632,28 @@ async function updateJsqtzhs(req, res, next) {
if
(
!
(
tzhs
&&
tzhs
.
id
))
{
if
(
!
(
tzhs
&&
tzhs
.
id
))
{
return
res
.
sendError
(
errorMessage
.
resourceNotFound
)
return
res
.
sendError
(
errorMessage
.
resourceNotFound
)
}
}
let
jsqtzhss
=
req
.
body
.
jsqtzhss
||
[[]];
//二维数组 多次上报
//
let jsqtzhss = req.body.jsqtzhss || [[]]; //二维数组 多次上报
let
ids3
=
[],
infos3
=
[],
newtjsqtzhss
=
[];
//
let ids3 = [], infos3 = [], newtjsqtzhss = [];
for
(
let
index
=
0
;
index
<
jsqtzhss
.
length
;
index
++
)
{
//
for (let index = 0; index < jsqtzhss.length; index++) {
const
element
=
jsqtzhss
[
index
];
//
const element = jsqtzhss[index];
for
(
let
i
=
0
;
i
<
element
.
length
;
i
++
)
{
//
for (let i = 0; i < element.length; i++) {
let
ei
=
element
[
i
];
//
let ei = element[i];
ei
.
groupBy
=
index
;
//
ei.groupBy = index;
ei
.
projectId
=
req
.
body
.
projectId
;
//
ei.projectId = req.body.projectId;
ei
.
sourceId
=
tzhs
.
id
;
//
ei.sourceId = tzhs.id;
if
(
!
ei
.
id
)
{
//
if (!ei.id) {
if
(
!
_
.
isEmpty
(
ei
))
{
//
if (!_.isEmpty(ei)) {
newtjsqtzhss
.
push
(
ei
);
//
newtjsqtzhss.push(ei);
}
//
}
}
else
{
//
} else {
ids3
.
push
(
ei
.
id
);
infos3
.
push
(
ei
);
//
ids3.push(ei.id); infos3.push(ei);
}
//
}
}
//
}
}
//
}
await
DB
.
TzJsqtzhszb
.
destroy
({
where
:
{
projectId
:
req
.
body
.
projectId
,
sourceId
:
tzhs
.
id
,
id
:
{
[
Op
.
notIn
]:
ids3
}
}
});
// 删除id不在传入id数组里面的(用户在界面删除的)
//
await DB.TzJsqtzhszb.destroy({ where: { projectId: req.body.projectId, sourceId: tzhs.id, id: { [Op.notIn]: ids3 } } }); // 删除id不在传入id数组里面的(用户在界面删除的)
await
DB
.
TzJsqtzhszb
.
bulkCreate
(
newtjsqtzhss
);
//创建新的 没有id的
//
await DB.TzJsqtzhszb.bulkCreate(newtjsqtzhss);//创建新的 没有id的
await
Promise
.
all
(
infos3
.
map
(
item
=>
{
return
DB
.
TzJsqtzhszb
.
update
(
item
,
{
where
:
{
id
:
item
.
id
}
})
}));
//
await Promise.all(infos3.map(item => { return DB.TzJsqtzhszb.update(item, { where: { id: item.id } }) }));
delete
req
.
body
.
jsqtzhss
;
//
delete req.body.jsqtzhss;
await
DB
.
TzJsqtzhs
.
update
(
req
.
body
,
{
where
:
{
id
:
req
.
body
.
id
}
});
await
DB
.
TzJsqtzhs
.
update
(
req
.
body
,
{
where
:
{
id
:
req
.
body
.
id
}
});
return
res
.
sendData
({});
return
res
.
sendData
({});
...
...
db/model/jt/thYyqtzhszb.js
View file @
9b2d8967
const
{
DataTypes
}
=
require
(
'sequelize'
);
//
const { DataTypes } = require('sequelize');
const
sequelize
=
require
(
'../index'
);
//
const sequelize = require('../index');
const
moment
=
require
(
'moment'
);
//
const moment = require('moment');
/**
/
/ /
**
* /**
//
* /**
* 投后管理- 运营期投资回收关联表
//
* 投后管理- 运营期投资回收关联表
*/
//
*/
const
ThYyqtzhszb
=
sequelize
.
define
(
'ThYyqtzhszb'
,
{
//
const ThYyqtzhszb = sequelize.define('ThYyqtzhszb', {
id
:
{
//
id: {
type
:
DataTypes
.
INTEGER
,
//
type: DataTypes.INTEGER,
primaryKey
:
true
,
//
primaryKey: true,
autoIncrement
:
true
//
autoIncrement: true
},
//
},
year
:
{
//
year: {
type
:
DataTypes
.
DATE
,
//
type: DataTypes.DATE,
comment
:
"年份"
,
//
comment: "年份",
},
//
},
month
:
{
//
month: {
type
:
DataTypes
.
INTEGER
,
//
type: DataTypes.INTEGER,
comment
:
"月份"
,
//
comment: "月份",
},
//
},
xh
:
{
//
xh: {
type
:
DataTypes
.
STRING
,
//
type: DataTypes.STRING,
comment
:
"序号"
,
//
comment: "序号",
},
//
},
ndtzhsmb
:
{
//
ndtzhsmb: {
type
:
DataTypes
.
DECIMAL
(
20
,
2
),
//
type: DataTypes.DECIMAL(20, 2),
comment
:
"年度投资回收目标"
//
comment: "年度投资回收目标"
},
//
},
dyhs
:
{
//
dyhs: {
type
:
DataTypes
.
DECIMAL
(
20
,
2
),
//
type: DataTypes.DECIMAL(20, 2),
comment
:
"当月回收"
//
comment: "当月回收"
},
//
},
dyljhs
:
{
//
dyljhs: {
type
:
DataTypes
.
DECIMAL
(
20
,
2
),
//
type: DataTypes.DECIMAL(20, 2),
comment
:
"当月累计回收"
//
comment: "当月累计回收"
},
//
},
ndjhwcl
:
{
//
ndjhwcl: {
type
:
DataTypes
.
DECIMAL
(
5
,
2
),
//
type: DataTypes.DECIMAL(5, 2),
comment
:
"年度计划完成率 %"
//
comment: "年度计划完成率 %"
},
//
},
bz
:
{
//
bz: {
type
:
DataTypes
.
TEXT
,
//
type: DataTypes.TEXT,
comment
:
"备注"
,
//
comment: "备注",
},
//
},
groupBy
:
{
//
groupBy: {
type
:
DataTypes
.
INTEGER
,
//
type: DataTypes.INTEGER,
comment
:
"分组"
//
comment: "分组"
},
//
},
sourceId
:
{
//
sourceId: {
type
:
DataTypes
.
INTEGER
,
//
type: DataTypes.INTEGER,
comment
:
"所属投资控制主表id"
//
comment: "所属投资控制主表id"
},
//
},
projectId
:
{
//
projectId: {
type
:
DataTypes
.
INTEGER
,
//
type: DataTypes.INTEGER,
comment
:
"所属项目ID"
,
//
comment: "所属项目ID",
},
//
},
del
:
{
//
del: {
type
:
DataTypes
.
INTEGER
,
//
type: DataTypes.INTEGER,
defaultValue
:
0
,
//
defaultValue: 0,
comment
:
"0 正常 1 删除"
//
comment: "0 正常 1 删除"
},
//
},
createdAt
:
{
//
createdAt: {
type
:
DataTypes
.
DATE
,
//
type: DataTypes.DATE,
defaultValue
:
new
Date
(),
//
defaultValue: new Date(),
get
()
{
//
get() {
const
rawValue
=
this
.
getDataValue
(
'createdAt'
);
//
const rawValue = this.getDataValue('createdAt');
return
rawValue
?
moment
(
rawValue
).
format
(
'YYYY-MM-DD HH:mm:ss'
)
:
''
;
//
return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
}
//
}
},
//
},
updatedAt
:
{
// 同样处理 updatedAt
//
updatedAt: { // 同样处理 updatedAt
type
:
DataTypes
.
DATE
,
//
type: DataTypes.DATE,
defaultValue
:
new
Date
(),
//
defaultValue: new Date(),
get
()
{
//
get() {
const
rawValue
=
this
.
getDataValue
(
'updatedAt'
);
//
const rawValue = this.getDataValue('updatedAt');
return
rawValue
?
moment
(
rawValue
).
format
(
'YYYY-MM-DD HH:mm:ss'
)
:
''
;
//
return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
}
//
}
}
//
}
},
{
//
}, {
tableName
:
'jt_th_yyqtzhszb'
,
// 指定表名(如果与模型名不同)
//
tableName: 'jt_th_yyqtzhszb', // 指定表名(如果与模型名不同)
timestamps
:
true
,
// 是否自动添加 createdAt 和 updatedAt 字段(覆盖全局设置)
//
timestamps: true, // 是否自动添加 createdAt 和 updatedAt 字段(覆盖全局设置)
});
//
});
// 同步模型到数据库(创建表)
//
//
同步模型到数据库(创建表)
ThYyqtzhszb
.
sync
({
//
ThYyqtzhszb.sync({
// force: false,
//
// force: false,
// force: true ,//会删除已存在表并重新创建
//
// force: true ,//会删除已存在表并重新创建
alter
:
true
//
alter: true
})
//
})
.
then
(()
=>
{
//
.then(() => {
console
.
log
(
'ThYyqtzhszb 表同步成功'
);
//
console.log('ThYyqtzhszb 表同步成功');
});
//
});
module
.
exports
=
ThYyqtzhszb
;
// module.exports = ThYyqtzhszb;
\ No newline at end of file
\ No newline at end of file
db/model/jt/tzJsqtzhs.js
View file @
9b2d8967
...
@@ -11,10 +11,86 @@ const TzJsqtzhs = sequelize.define('TzJsqtzhs', {
...
@@ -11,10 +11,86 @@ const TzJsqtzhs = sequelize.define('TzJsqtzhs', {
primaryKey
:
true
,
primaryKey
:
true
,
autoIncrement
:
true
autoIncrement
:
true
},
},
//以下 项目信息里面取值
projectName
:
{
projectName
:
{
type
:
DataTypes
.
STRING
,
type
:
DataTypes
.
STRING
,
comment
:
"项目名称"
,
comment
:
"项目名称"
,
},
},
xmgsmc
:
{
type
:
DataTypes
.
STRING
,
comment
:
"项目公司名称"
,
},
tbdwmc
:
{
type
:
DataTypes
.
STRING
,
comment
:
"填报单位名称"
,
},
ssejqy
:
{
type
:
DataTypes
.
STRING
,
comment
:
"所属二级企业"
,
},
xmjd
:
{
type
:
DataTypes
.
STRING
,
comment
:
"项目阶段"
,
},
xmlx
:
{
type
:
DataTypes
.
STRING
,
comment
:
"项目类别 同等与 项目类型 xmlx"
,
},
tzms
:
{
type
:
DataTypes
.
STRING
,
comment
:
"投资模式分类"
,
},
tzhsfs
:
{
type
:
DataTypes
.
STRING
,
comment
:
"投资回收方式"
,
},
xnxmjd
:
{
type
:
DataTypes
.
STRING
,
comment
:
"下年项目阶段"
,
},
projectGdxxs
:
{
type
:
DataTypes
.
JSON
,
},
//以下 可能跟项目相关 有可能在项目里面取值,需要项目信息齐全并对应上
tzzejc
:
{
type
:
DataTypes
.
DECIMAL
(
20
,
8
),
allowNull
:
true
,
comment
:
"投资总额-决策值"
,
},
wfzbjczejc
:
{
type
:
DataTypes
.
DECIMAL
(
20
,
8
),
allowNull
:
true
,
comment
:
"我方资本金出资额-决策值"
,
},
tzzesj
:
{
type
:
DataTypes
.
DECIMAL
(
20
,
8
),
allowNull
:
true
,
comment
:
"投资总额-实际值"
,
},
wfzbjczesj
:
{
type
:
DataTypes
.
DECIMAL
(
20
,
8
),
allowNull
:
true
,
comment
:
"我方资本家出资额--实际值"
,
},
tzzejhz
:
{
type
:
DataTypes
.
DECIMAL
(
20
,
8
),
allowNull
:
true
,
comment
:
"投资总额-计划值"
,
},
//以下投资回收相关
bnwc
:
{
type
:
DataTypes
.
DECIMAL
(
20
,
8
),
allowNull
:
true
,
comment
:
"本年完成 投资回收决策目标值"
,
},
jzbnlj
:
{
type
:
DataTypes
.
DECIMAL
(
20
,
8
),
allowNull
:
true
,
comment
:
"截止本年累计"
,
},
xynwcs
:
{
type
:
DataTypes
.
DECIMAL
(
20
,
8
),
allowNull
:
true
,
comment
:
"下一年完成数"
,
},
bnjh
:
{
type
:
DataTypes
.
DECIMAL
(
20
,
8
),
allowNull
:
true
,
comment
:
"本年计划"
,
},
bnwcsjz
:
{
type
:
DataTypes
.
DECIMAL
(
20
,
8
),
allowNull
:
true
,
comment
:
"本年完成--投资回收实际值"
,
},
jzbnljsjz
:
{
type
:
DataTypes
.
DECIMAL
(
20
,
8
),
allowNull
:
true
,
comment
:
"截止本年累计--投资回收实际值"
,
},
sjyjhcysm
:
{
type
:
DataTypes
.
TEXT
,
comment
:
"实际与计划差异说明"
},
ljqs
:
{
type
:
DataTypes
.
DECIMAL
(
20
,
8
),
allowNull
:
true
,
comment
:
"累计欠收"
,
},
wcl
:
{
type
:
DataTypes
.
DECIMAL
(
5
,
2
),
allowNull
:
true
,
comment
:
"完成率"
,
},
czdzywt
:
{
type
:
DataTypes
.
TEXT
,
comment
:
"存在主要问题"
},
cqcsjgzkzqk
:
{
type
:
DataTypes
.
TEXT
,
comment
:
"采取措施及开展情况"
},
bz
:
{
type
:
DataTypes
.
TEXT
,
comment
:
"备注"
},
jhyjcmbcysm
:
{
type
:
DataTypes
.
TEXT
,
comment
:
"计划与决策目标值差异说明"
},
//截至月末累计应收
jzymljys
:
{
type
:
DataTypes
.
JSON
,
},
//截至月末累计实收
jzymljsh
:
{
type
:
DataTypes
.
JSON
,
},
tzhsjc
:
{
type
:
DataTypes
.
JSON
,},
tzhsjh
:
{
type
:
DataTypes
.
JSON
,},
...
...
db/model/jt/tzJsqtzhszb.js
View file @
9b2d8967
const
{
DataTypes
}
=
require
(
'sequelize'
);
//
const { DataTypes } = require('sequelize');
const
sequelize
=
require
(
'../index'
);
//
const sequelize = require('../index');
const
moment
=
require
(
'moment'
);
//
const moment = require('moment');
/**
/
/ /
**
* 投中管理- 建设期投资回收关联表
//
* 投中管理- 建设期投资回收关联表
*/
//
*/
const
TzJsqtzhszb
=
sequelize
.
define
(
'TzJsqtzhszb'
,
{
//
const TzJsqtzhszb = sequelize.define('TzJsqtzhszb', {
id
:
{
//
id: {
type
:
DataTypes
.
INTEGER
,
//
type: DataTypes.INTEGER,
primaryKey
:
true
,
//
primaryKey: true,
autoIncrement
:
true
//
autoIncrement: true
},
//
},
year
:
{
//
year: {
type
:
DataTypes
.
DATE
,
//
type: DataTypes.DATE,
comment
:
"年份"
,
//
comment: "年份",
},
//
},
month
:
{
//
month: {
type
:
DataTypes
.
INTEGER
,
//
type: DataTypes.INTEGER,
comment
:
"月份"
,
//
comment: "月份",
},
//
},
xh
:
{
//
xh: {
type
:
DataTypes
.
STRING
,
//
type: DataTypes.STRING,
comment
:
"序号"
,
//
comment: "序号",
},
//
},
ndtzhsmb
:
{
//
ndtzhsmb: {
type
:
DataTypes
.
DECIMAL
(
20
,
2
),
//
type: DataTypes.DECIMAL(20, 2),
comment
:
"年度投资回收目标"
//
comment: "年度投资回收目标"
},
//
},
dyhs
:
{
//
dyhs: {
type
:
DataTypes
.
DECIMAL
(
20
,
2
),
//
type: DataTypes.DECIMAL(20, 2),
comment
:
"当月回收"
//
comment: "当月回收"
},
//
},
dyljhs
:
{
//
dyljhs: {
type
:
DataTypes
.
DECIMAL
(
20
,
2
),
//
type: DataTypes.DECIMAL(20, 2),
comment
:
"当月累计回收"
//
comment: "当月累计回收"
},
//
},
ndjhwcl
:
{
//
ndjhwcl: {
type
:
DataTypes
.
DECIMAL
(
5
,
2
),
//
type: DataTypes.DECIMAL(5, 2),
comment
:
"年度计划完成率 %"
//
comment: "年度计划完成率 %"
},
//
},
bz
:
{
//
bz: {
type
:
DataTypes
.
TEXT
,
//
type: DataTypes.TEXT,
comment
:
"备注"
,
//
comment: "备注",
},
//
},
groupBy
:
{
//
groupBy: {
type
:
DataTypes
.
INTEGER
,
//
type: DataTypes.INTEGER,
comment
:
"分组"
//
comment: "分组"
},
//
},
sourceId
:
{
//
sourceId: {
type
:
DataTypes
.
INTEGER
,
//
type: DataTypes.INTEGER,
comment
:
"所属投资控制主表id"
//
comment: "所属投资控制主表id"
},
//
},
projectId
:
{
//
projectId: {
type
:
DataTypes
.
INTEGER
,
//
type: DataTypes.INTEGER,
comment
:
"所属项目ID"
,
//
comment: "所属项目ID",
},
//
},
del
:
{
//
del: {
type
:
DataTypes
.
INTEGER
,
//
type: DataTypes.INTEGER,
defaultValue
:
0
,
//
defaultValue: 0,
comment
:
"0 正常 1 删除"
//
comment: "0 正常 1 删除"
},
//
},
createdAt
:
{
//
createdAt: {
type
:
DataTypes
.
DATE
,
//
type: DataTypes.DATE,
defaultValue
:
new
Date
(),
//
defaultValue: new Date(),
get
()
{
//
get() {
const
rawValue
=
this
.
getDataValue
(
'createdAt'
);
//
const rawValue = this.getDataValue('createdAt');
return
rawValue
?
moment
(
rawValue
).
format
(
'YYYY-MM-DD HH:mm:ss'
)
:
''
;
//
return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
}
//
}
},
//
},
updatedAt
:
{
// 同样处理 updatedAt
//
updatedAt: { // 同样处理 updatedAt
type
:
DataTypes
.
DATE
,
//
type: DataTypes.DATE,
defaultValue
:
new
Date
(),
//
defaultValue: new Date(),
get
()
{
//
get() {
const
rawValue
=
this
.
getDataValue
(
'updatedAt'
);
//
const rawValue = this.getDataValue('updatedAt');
return
rawValue
?
moment
(
rawValue
).
format
(
'YYYY-MM-DD HH:mm:ss'
)
:
''
;
//
return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
}
//
}
}
//
}
},
{
//
}, {
tableName
:
'jt_tz_jsqtzhs'
,
// 指定表名(如果与模型名不同)
//
tableName: 'jt_tz_jsqtzhs', // 指定表名(如果与模型名不同)
timestamps
:
true
,
// 是否自动添加 createdAt 和 updatedAt 字段(覆盖全局设置)
//
timestamps: true, // 是否自动添加 createdAt 和 updatedAt 字段(覆盖全局设置)
});
//
});
// 同步模型到数据库(创建表)
//
//
同步模型到数据库(创建表)
TzJsqtzhszb
.
sync
({
//
TzJsqtzhszb.sync({
// force: false,
//
// force: false,
// force: true ,//会删除已存在表并重新创建
//
// force: true ,//会删除已存在表并重新创建
alter
:
true
//
alter: true
})
//
})
.
then
(()
=>
{
//
.then(() => {
console
.
log
(
'TzJsqtzhszb 表同步成功'
);
//
console.log('TzJsqtzhszb 表同步成功');
});
//
});
module
.
exports
=
TzJsqtzhszb
;
// module.exports = TzJsqtzhszb;
\ No newline at end of file
\ No newline at end of file
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