明树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
5e8699d7
Commit
5e8699d7
authored
Mar 31, 2026
by
zfp1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
da1ba7a1
Pipeline
#109064
passed with stage
in 3 seconds
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
273 additions
and
3 deletions
+273
-3
projectQtController.js
controller/projectQtController.js
+85
-1
index.js
db/index.js
+3
-1
qtGdf.js
db/model/jt/qtGdf.js
+177
-0
projectRouter.js
router/projectRouter.js
+8
-1
No files found.
controller/projectQtController.js
View file @
5e8699d7
...
...
@@ -94,11 +94,95 @@ async function deleteCbgl(req, res, next) {
}
}
// 创建工抵房
async
function
createGdf
(
req
,
res
,
next
)
{
try
{
let
ret
=
await
DB
.
QtGdf
.
create
(
req
.
body
);
return
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
);
}
}
// 更新工抵房
async
function
updateGdf
(
req
,
res
,
next
)
{
try
{
if
(
!
req
.
body
.
id
)
return
res
.
sendError
(
errorMessage
.
paramsError
);
let
ret
=
await
DB
.
QtGdf
.
findOne
({
where
:
{
id
:
req
.
body
.
id
},
raw
:
true
});
if
(
!
(
ret
&&
ret
.
id
))
return
res
.
sendError
(
errorMessage
.
resourceNotFound
);
await
DB
.
QtGdf
.
update
(
req
.
body
,
{
where
:
{
id
:
req
.
body
.
id
}
});
return
res
.
sendData
({});
}
catch
(
error
)
{
next
(
error
);
}
}
// 获取单个工抵房
async
function
getGdf
(
req
,
res
,
next
)
{
try
{
if
(
!
req
.
body
.
id
)
return
res
.
sendError
(
errorMessage
.
paramsError
);
let
info
=
await
DB
.
QtGdf
.
findOne
({
where
:
{
id
:
req
.
body
.
id
,
del
:
0
},
raw
:
true
});
if
(
!
(
info
&&
info
.
id
))
return
res
.
sendError
(
errorMessage
.
resourceNotFound
);
return
res
.
sendData
(
info
);
}
catch
(
error
)
{
next
(
error
);
}
}
// 获取工抵房列表
async
function
getGdfList
(
req
,
res
,
next
)
{
try
{
let
page
=
req
.
body
.
page
||
1
;
let
limit
=
req
.
body
.
pagesize
||
req
.
body
.
pageSize
||
10
;
let
offset
=
(
page
-
1
)
*
limit
;
let
search
=
{};
search
.
order
=
[[
'id'
,
'DESC'
]];
search
.
limit
=
limit
;
search
.
offset
=
offset
;
let
where
=
{
del
:
0
};
if
(
req
.
body
.
projectName
)
{
where
.
projectName
=
{
[
Op
.
like
]:
`%
${
req
.
body
.
projectName
}
%`
};
}
if
(
req
.
body
.
registrationNo
)
{
where
.
registrationNo
=
{
[
Op
.
like
]:
`%
${
req
.
body
.
registrationNo
}
%`
};
}
if
(
req
.
body
.
contractNo
)
{
where
.
contractNo
=
{
[
Op
.
like
]:
`%
${
req
.
body
.
contractNo
}
%`
};
}
if
(
req
.
body
.
projectId
)
{
where
.
projectId
=
req
.
body
.
projectId
;
}
search
.
where
=
where
;
if
(
req
.
body
.
attributes
&&
req
.
body
.
attributes
.
length
)
{
search
.
attributes
=
req
.
body
.
attributes
;
}
let
ret
=
await
DB
.
QtGdf
.
findAndCountAll
(
search
);
return
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
);
}
}
// 删除工抵房(逻辑删除)
async
function
deleteGdf
(
req
,
res
,
next
)
{
try
{
await
DB
.
QtGdf
.
update
({
del
:
1
},
{
where
:
{
id
:
req
.
body
.
id
}
});
return
res
.
sendData
({});
}
catch
(
error
)
{
next
(
error
);
}
}
module
.
exports
=
{
createCbgl
,
updateCbgl
,
getCbgl
,
getCbglList
,
deleteCbgl
deleteCbgl
,
createGdf
,
updateGdf
,
getGdf
,
getGdfList
,
deleteGdf
};
db/index.js
View file @
5e8699d7
...
...
@@ -92,6 +92,7 @@ const RcXxhjs = require('./model/jt/rcXxhjs');
const
RcTzdagl
=
require
(
'./model/jt/rcTzdagl'
);
const
QtCbgl
=
require
(
'./model/jt/qtCbgl'
);
const
QtGdf
=
require
(
'./model/jt/qtGdf'
);
/**
* 业务表
*/
...
...
@@ -180,6 +181,7 @@ global.DB = {
RcXxhjs
,
RcTzdagl
,
QtCbgl
,
QtGdf
,
}
...
...
db/model/jt/qtGdf.js
0 → 100644
View file @
5e8699d7
const
{
DataTypes
}
=
require
(
'sequelize'
);
const
sequelize
=
require
(
'../index'
);
const
moment
=
require
(
'moment'
);
// 其他 - 工抵房
const
QtGdf
=
sequelize
.
define
(
'QtGdf'
,
{
id
:
{
type
:
DataTypes
.
INTEGER
,
primaryKey
:
true
,
autoIncrement
:
true
},
registrationNo
:
{
type
:
DataTypes
.
STRING
,
comment
:
"登记编号"
},
registrationDate
:
{
type
:
DataTypes
.
DATE
,
comment
:
"登记日期"
,
get
()
{
const
rawValue
=
this
.
getDataValue
(
'registrationDate'
);
return
rawValue
?
moment
(
rawValue
).
format
(
'YYYY-MM-DD'
)
:
''
;
}
},
projectName
:
{
type
:
DataTypes
.
STRING
,
comment
:
"项目名称"
},
deductionType
:
{
type
:
DataTypes
.
STRING
,
comment
:
"抵扣类型(工程款/材料款/其他)"
},
contractAmount
:
{
type
:
DataTypes
.
DECIMAL
(
19
,
2
),
comment
:
"合同金额"
},
deductionRate
:
{
type
:
DataTypes
.
DECIMAL
(
5
,
2
),
comment
:
"抵扣比例"
},
deductionAmount
:
{
type
:
DataTypes
.
DECIMAL
(
19
,
2
),
comment
:
"抵扣金额"
},
contractNo
:
{
type
:
DataTypes
.
STRING
,
comment
:
"合同编号"
},
contractScanFiles
:
{
type
:
DataTypes
.
JSON
,
defaultValue
:
[],
comment
:
"合同扫描件"
},
offsetSigningDate
:
{
type
:
DataTypes
.
DATE
,
comment
:
"工抵签订时间"
,
get
()
{
const
rawValue
=
this
.
getDataValue
(
'offsetSigningDate'
);
return
rawValue
?
moment
(
rawValue
).
format
(
'YYYY-MM-DD'
)
:
''
;
}
},
handlerName
:
{
type
:
DataTypes
.
STRING
,
comment
:
"经办人"
},
partyAName
:
{
type
:
DataTypes
.
STRING
,
comment
:
"甲方名称"
},
partyAContact
:
{
type
:
DataTypes
.
STRING
,
comment
:
"甲方联系人"
},
partyAPhone
:
{
type
:
DataTypes
.
STRING
,
comment
:
"甲方联系方式"
},
partyBName
:
{
type
:
DataTypes
.
STRING
,
comment
:
"乙方名称"
},
partyBContact
:
{
type
:
DataTypes
.
STRING
,
comment
:
"乙方联系人"
},
partyBPhone
:
{
type
:
DataTypes
.
STRING
,
comment
:
"乙方联系方式"
},
partyCName
:
{
type
:
DataTypes
.
STRING
,
comment
:
"丙方名称"
},
partyCContact
:
{
type
:
DataTypes
.
STRING
,
comment
:
"丙方联系人"
},
partyCPhone
:
{
type
:
DataTypes
.
STRING
,
comment
:
"丙方联系方式"
},
projectAddress
:
{
type
:
DataTypes
.
STRING
,
comment
:
"项目地址"
},
projectCompany
:
{
type
:
DataTypes
.
STRING
,
comment
:
"项目公司"
},
projectStatus
:
{
type
:
DataTypes
.
STRING
,
comment
:
"项目状态(在建/已竣工)"
},
buildingInfo
:
{
type
:
DataTypes
.
STRING
,
comment
:
"楼栋信息"
},
propertyType
:
{
type
:
DataTypes
.
STRING
,
comment
:
"房源类型(住宅/公寓/商铺/车位)"
},
buildingArea
:
{
type
:
DataTypes
.
DECIMAL
(
19
,
2
),
comment
:
"建筑面积(㎡)"
},
unitPrice
:
{
type
:
DataTypes
.
DECIMAL
(
19
,
2
),
comment
:
"单价(元/㎡)"
},
totalAmount
:
{
type
:
DataTypes
.
DECIMAL
(
19
,
2
),
comment
:
"总金额(元)"
},
attachments
:
{
type
:
DataTypes
.
JSON
,
defaultValue
:
[],
comment
:
"附件上传"
},
projectId
:
{
type
:
DataTypes
.
INTEGER
,
comment
:
"所属项目ID"
,
},
del
:
{
type
:
DataTypes
.
INTEGER
,
defaultValue
:
0
,
comment
:
"0 正常 1 删除"
},
createdAt
:
{
type
:
DataTypes
.
DATE
,
defaultValue
:
Date
.
now
,
get
()
{
const
rawValue
=
this
.
getDataValue
(
'createdAt'
);
return
rawValue
?
moment
(
rawValue
).
format
(
'YYYY-MM-DD HH:mm:ss'
)
:
''
;
}
},
updatedAt
:
{
type
:
DataTypes
.
DATE
,
defaultValue
:
Date
.
now
,
get
()
{
const
rawValue
=
this
.
getDataValue
(
'updatedAt'
);
return
rawValue
?
moment
(
rawValue
).
format
(
'YYYY-MM-DD HH:mm:ss'
)
:
''
;
}
}
},
{
tableName
:
'jt_qt_gdf'
,
timestamps
:
true
,
});
QtGdf
.
sync
({
// force: false,
// force: true ,//会删除已存在表并重新创建
alter
:
true
})
.
then
(()
=>
{
console
.
log
(
'QtGdf 表同步成功'
);
});
module
.
exports
=
QtGdf
;
router/projectRouter.js
View file @
5e8699d7
...
...
@@ -218,4 +218,11 @@ router.post('/getCbgl', projectQtController.getCbgl);
router
.
post
(
'/getCbglList'
,
projectQtController
.
getCbglList
);
router
.
post
(
'/deleteCbgl'
,
projectQtController
.
deleteCbgl
);
//5.2 工抵房
router
.
post
(
'/createGdf'
,
projectQtController
.
createGdf
);
router
.
post
(
'/updateGdf'
,
projectQtController
.
updateGdf
);
router
.
post
(
'/getGdf'
,
projectQtController
.
getGdf
);
router
.
post
(
'/getGdfList'
,
projectQtController
.
getGdfList
);
router
.
post
(
'/deleteGdf'
,
projectQtController
.
deleteGdf
);
module
.
exports
=
router
;
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