Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
78d5d964
Commit
78d5d964
authored
Jun 17, 2020
by
蒋勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d
parent
eb9c296b
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
93 additions
and
17 deletions
+93
-17
ic-deliver/app/base/controller/impl/bizchance/deliverybillCtl.js
+3
-2
ic-deliver/app/base/controller/impl/bizchance/settlebillCtl.js
+17
-3
ic-deliver/app/base/db/impl/bizchance/deliverybillDao.js
+4
-1
ic-deliver/app/base/db/impl/common/connection.js
+2
-2
ic-deliver/app/base/db/models/delivery/settlebill.js
+15
-4
ic-deliver/app/base/service/impl/bizchance/deliverybillSve.js
+8
-5
ic-deliver/app/base/service/impl/bizchance/settlebillSve.js
+44
-0
No files found.
ic-deliver/app/base/controller/impl/bizchance/deliverybillCtl.js
View file @
78d5d964
...
...
@@ -33,7 +33,8 @@ class DeliverybillCtl extends CtlBase {
robj
.
baseInfo
=
element
.
delivery_info
;
//交付单详情
robj
.
payStatus
=
element
.
delivery_info
.
payStatus
;
//交付状态
robj
.
costPrice
=
element
.
cost_price
;
//成本
robj
.
settleStatus
=
element
.
settle_status
;
robj
.
settle_status
=
element
.
settle_status
;
robj
.
settlebill
=
element
.
settlebill
;
if
(
robj
.
businessName
==
'公司注册'
){
if
(
robj
.
baseInfo
.
isWhether
==
"是"
||
robj
.
baseInfo
.
isVirtual
==
"是"
){
//如果有刻章需求或者是虚拟地址
robj
.
relatedProducts
=
'有'
;
...
...
@@ -230,7 +231,7 @@ class DeliverybillCtl extends CtlBase {
async
settleApply
(
p
,
q
,
req
){
let
ids
=
p
.
ids
let
rtn
=
await
this
.
service
.
settleApply
(
ids
,
req
.
userid
,
req
.
username
)
let
rtn
=
await
this
.
service
.
settleApply
(
ids
,
p
.
userid
,
p
.
username
)
return
system
.
getResult
({})
}
/*根据商机编号插入交付单信息*/
...
...
ic-deliver/app/base/controller/impl/bizchance/settlebillCtl.js
View file @
78d5d964
...
...
@@ -7,10 +7,24 @@ const moment = require('moment');
const
appconfig
=
system
.
getSysConfig
();
class
SettleBillCtl
extends
CtlBase
{
constructor
()
{
super
(
"bizchance"
,
CtlBase
.
getServiceName
(
BizOptCtl
));
this
.
deliverService
=
system
.
getObject
(
"service.bizchance.deliverybillSve"
);
super
(
"bizchance"
,
CtlBase
.
getServiceName
(
SettleBillCtl
));
}
async
advice
(
p
,
q
,
req
){
let
sid
=
p
.
advice
.
settleId
let
msg
=
p
.
advice
.
memo
let
rtn
=
await
this
.
service
.
advice
(
sid
,
msg
)
return
system
.
getResult
(
rtn
)
}
async
auditPass
(
p
,
q
,
req
){
let
sid
=
p
.
pass
.
settleId
let
rtn
=
await
this
.
service
.
auditPass
(
sid
)
return
system
.
getResult
(
rtn
)
}
async
pay
(
p
,
q
,
req
){
let
sid
=
p
.
pay
.
settleId
let
rtn
=
await
this
.
service
.
pay
(
sid
)
return
system
.
getResult
(
rtn
)
}
}
module
.
exports
=
SettleBillCtl
;
ic-deliver/app/base/db/impl/bizchance/deliverybillDao.js
View file @
78d5d964
...
...
@@ -5,8 +5,11 @@ class DeliverybillDao extends Dao {
super
(
Dao
.
getModelName
(
DeliverybillDao
));
}
extraModelFilter
(
pobj
)
{
return
{
"key"
:
"include"
,
"value"
:{
model
:
this
.
db
.
models
.
settlebill
,
raw
:
true
,
attributes
:[
'memo'
]}};
}
extraWhere
(
qobj
,
qw
,
qc
)
{
//根据业务员id获取交付单信息的组装条件
qc
.
raw
=
true
;
//
qc.raw = true;
//检查查询的用户所属公司是否是平台运营公司-1,如果是则不添加公司查询条件, 不添加路径条件,返回所有数据
if
(
qobj
.
company_id
==
1
)
{
if
(
qobj
.
bizpath
&&
qobj
.
bizpath
!=
""
)
{
...
...
ic-deliver/app/base/db/impl/common/connection.js
View file @
78d5d964
...
...
@@ -67,9 +67,9 @@ class DbFactory {
this
.
db
.
models
.
scheme
.
belongsTo
(
this
.
db
.
models
.
bizopt
,
{
constraints
:
false
,
});
this
.
db
.
models
.
bizopt
.
hasOne
(
this
.
db
.
models
.
scheme
,
{
constraints
:
false
,
});
//交付单关联结算单
//交付单关联结算单
deliverybill
this
.
db
.
models
.
deliverybill
.
belongsTo
(
this
.
db
.
models
.
settlebill
,
{
constraints
:
false
,
});
this
.
db
.
models
.
settlebill
.
hasMany
(
this
.
db
.
models
.
deliverybill
,{
as
:
"dbs"
,
constraints
:
false
,});
}
//async getCon(){,用于使用替换table模型内字段数据使用
getCon
()
{
...
...
ic-deliver/app/base/db/models/delivery/settlebill.js
View file @
78d5d964
...
...
@@ -10,10 +10,9 @@ module.exports = (db, DataTypes) => {
allowNull
:
true
,
type
:
DataTypes
.
STRING
},
audit_status
:
{
// 审核状态
allowNull
:
false
,
type
:
DataTypes
.
STRING
,
defaultValue
:
'waittoaudit'
audited
:
{
// 审核状态
type
:
DataTypes
.
BOOLEAN
,
defaultValue
:
false
},
settle_amount
:
{
//结算金额
allowNull
:
true
,
...
...
@@ -22,6 +21,18 @@ module.exports = (db, DataTypes) => {
isPayed
:{
type
:
DataTypes
.
BOOLEAN
,
defaultValue
:
false
},
memo
:{
//结算建议
allowNull
:
true
,
type
:
DataTypes
.
STRING
,
},
creator_id
:{
allowNull
:
true
,
type
:
DataTypes
.
INTEGER
},
creator
:{
allowNull
:
true
,
type
:
DataTypes
.
STRING
,
}
},
{
paranoid
:
true
,
//真的删除
...
...
ic-deliver/app/base/service/impl/bizchance/deliverybillSve.js
View file @
78d5d964
...
...
@@ -10,19 +10,22 @@ class DeliverybillService extends ServiceBase {
var
self
=
this
return
this
.
db
.
transaction
(
async
function
(
t
){
//先按照ids查询出交付单的合计服务成本
let
settleAmount
=
await
self
.
dao
.
model
.
findSum
(
"cost_price"
,{
where
:{
id
:{[
self
.
db
.
Op
.
In
]:
ids
}},
transaction
:
t
})
let
settleAmount
=
await
self
.
dao
.
findSum
(
"cost_price"
,{
where
:{
id
:{[
self
.
db
.
Op
.
In
]:
ids
}},
transaction
:
t
})
settleAmount
=
isNaN
(
settleAmount
)?
0
:
settleAmount
let
settlecode
=
await
self
.
getBusUid
(
"JSD"
)
let
settleObj
=
{
code
:
settlecode
,
settle_amount
:
settleAmount
,
creator_id
:
uid
,
creator
:
uname
}
//生成结算单,结算单状态为待审核
let
newentity
=
await
self
.
db
.
models
.
settlebill
.
create
(
settleObj
,{
transaction
:
t
})
//然后按照ids更新交付单的状态为结算中,更新结算单的id到交付单表
await
self
.
updateByWhere
(
{
'settle_status'
:
'settling'
,
'settlebill_id'
:
newentity
.
id
},{
id
:{[
self
.
db
.
Op
.
In
]:
ids
}},
t
)
for
(
let
idstr
of
ids
)
{
let
up
=
await
self
.
dao
.
updateByWhere
({
settle_status
:
'settling'
,
settlebill_id
:
newentity
.
id
},
{
id
:
idstr
},
t
);
}
return
newentity
});
}
...
...
ic-deliver/app/base/service/impl/bizchance/settlebillSve.js
0 → 100644
View file @
78d5d964
const
system
=
require
(
"../../../system"
);
const
ServiceBase
=
require
(
"../../sve.base"
);
const
settings
=
require
(
"../../../../config/settings"
);
const
appconfig
=
system
.
getSysConfig
();
class
SettleBillService
extends
ServiceBase
{
constructor
()
{
super
(
"bizchance"
,
ServiceBase
.
getDaoName
(
SettleBillService
));
this
.
deliverbillDao
=
system
.
getObject
(
"db.bizchance.deliverybillDao"
)
}
async
advice
(
id
,
msg
){
var
self
=
this
return
this
.
db
.
transaction
(
async
function
(
t
){
//先按照ids查询出交付单的合计服务成本
let
st
=
await
self
.
dao
.
findById
(
id
,{
transaction
:
t
})
st
.
memo
=
msg
await
st
.
save
({
transaction
:
t
})
return
st
});
}
async
auditPass
(
settleId
){
var
self
=
this
return
this
.
db
.
transaction
(
async
function
(
t
){
//先按照ids查询出交付单的合计服务成本
let
st
=
await
self
.
dao
.
findById
(
settleId
,{
transaction
:
t
})
st
.
audited
=
true
await
st
.
save
({
transaction
:
t
})
return
st
});
}
async
pay
(
settleId
){
var
self
=
this
return
this
.
db
.
transaction
(
async
function
(
t
){
//先按照ids查询出交付单的合计服务成本
let
st
=
await
self
.
dao
.
findById
(
settleId
,{
transaction
:
t
})
st
.
isPayed
=
true
await
st
.
save
({
transaction
:
t
})
//改变所有交付单的结算settle_status settled ,
await
self
.
deliverbillDao
.
updateByWhere
({
settle_status
:
'settled'
},
{
settlebill_id
:
st
.
id
},
t
);
return
st
});
}
}
module
.
exports
=
SettleBillService
;
\ 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