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
f599fc49
Commit
f599fc49
authored
Aug 19, 2020
by
王勇飞
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'tx-fi-tax' of gitlab.gongsibao.com:jiangyong/zhichan into tx-fi-tax
parents
2997c710
a0f35f12
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
169 additions
and
24 deletions
+169
-24
tx-fi-tax/app/base/controller/impl/bizchance/deliverybillCtl.js
+28
-0
tx-fi-tax/app/base/db/dao.base.js
+23
-20
tx-fi-tax/app/base/db/models/delivery/delivery_bill.js
+6
-3
tx-fi-tax/app/base/service/impl/bizchance/deliverybillSve.js
+112
-1
No files found.
tx-fi-tax/app/base/controller/impl/bizchance/deliverybillCtl.js
View file @
f599fc49
...
...
@@ -112,5 +112,32 @@ class DeliverybillCtl extends CtlBase {
return
system
.
getResult
(
null
,
err
.
message
)
}
}
/**
* 分配人
*/
async
distributionPerson
(
pobj
,
qobj
,
req
)
{
try
{
if
(
!
Array
.
isArray
(
pobj
.
numbers
)
&&
pobj
.
numbers
.
length
>
0
)
{
throw
new
Error
(
"numbers 为数组 且 不能为空"
);
}
if
(
!
pobj
.
nickName
)
{
throw
new
Error
(
"nickName 不能为空"
);
}
if
(
!
pobj
.
userId
)
{
throw
new
Error
(
"userId 不能为空"
);
}
if
(
!
pobj
.
opCode
)
{
throw
new
Error
(
"opCode 不能为空"
);
}
if
(
!
[
system
.
FLOWCODE
.
BIZ
,
system
.
FLOWCODE
.
DELIVERY
].
includes
(
pobj
.
type
))
{
throw
new
Error
(
"type 不合规"
);
}
const
rs
=
await
this
.
service
.
distributionPerson
(
pobj
);
return
system
.
getResult
(
rs
);
}
catch
(
err
)
{
return
system
.
getResult
(
null
,
err
.
message
)
}
}
}
module
.
exports
=
DeliverybillCtl
;
\ No newline at end of file
tx-fi-tax/app/base/db/dao.base.js
View file @
f599fc49
...
...
@@ -30,7 +30,7 @@ class Dao {
return
ClassObj
[
"name"
].
substring
(
0
,
ClassObj
[
"name"
].
lastIndexOf
(
"Dao"
)).
toLowerCase
()
}
async
refQuery
(
qobj
)
{
var
w
=
qobj
.
refwhere
?
qobj
.
refwhere
:
{};
var
w
=
qobj
.
refwhere
?
qobj
.
refwhere
:
{};
if
(
qobj
.
levelinfo
)
{
w
[
qobj
.
levelinfo
.
levelfield
]
=
qobj
.
levelinfo
.
level
;
}
...
...
@@ -38,8 +38,8 @@ class Dao {
w
[
qobj
.
parentinfo
.
parentfield
]
=
qobj
.
parentinfo
.
parentcode
;
}
//如果需要控制数据权限
if
(
qobj
.
datapriv
)
{
w
[
"id"
]
=
{
[
this
.
db
.
Op
.
in
]:
qobj
.
datapriv
};
if
(
qobj
.
datapriv
)
{
w
[
"id"
]
=
{
[
this
.
db
.
Op
.
in
]:
qobj
.
datapriv
};
}
if
(
qobj
.
likestr
)
{
w
[
qobj
.
fields
[
0
]]
=
{
[
this
.
db
.
Op
.
like
]:
"%"
+
qobj
.
likestr
+
"%"
};
...
...
@@ -64,13 +64,13 @@ class Dao {
async
delete
(
qobj
,
t
)
{
var
en
=
null
if
(
t
!=
null
&&
t
!=
'undefined'
)
{
en
=
await
this
.
model
.
findOne
({
where
:
{
id
:
qobj
.
id
},
transaction
:
t
});
en
=
await
this
.
model
.
findOne
({
where
:
{
id
:
qobj
.
id
},
transaction
:
t
});
if
(
en
!=
null
)
{
await
en
.
destroy
({
transaction
:
t
});
return
en
}
}
else
{
en
=
await
this
.
model
.
findOne
({
where
:
{
id
:
qobj
.
id
}
});
en
=
await
this
.
model
.
findOne
({
where
:
{
id
:
qobj
.
id
}
});
if
(
en
!=
null
)
{
return
en
.
destroy
();
}
...
...
@@ -202,16 +202,16 @@ class Dao {
}
async
updateByWhere
(
setObj
,
whereObj
,
t
)
{
let
inWhereObj
=
{}
let
inWhereObj
=
{}
if
(
t
&&
t
!=
'undefined'
)
{
if
(
whereObj
&&
whereObj
!=
'undefined'
)
{
inWhereObj
[
"where"
]
=
whereObj
;
inWhereObj
[
"where"
]
=
whereObj
;
inWhereObj
[
"transaction"
]
=
t
;
}
else
{
inWhereObj
[
"transaction"
]
=
t
;
}
}
else
{
inWhereObj
[
"where"
]
=
whereObj
;
}
else
{
inWhereObj
[
"where"
]
=
whereObj
;
}
return
this
.
model
.
update
(
setObj
,
inWhereObj
);
}
...
...
@@ -224,16 +224,16 @@ class Dao {
* p.group.aliasField=' as xxx'
* @param {*} p
*/
async
statGroupBy
(
p
,
paras
,
t
)
{
let
groupFields
=
p
.
group
.
byFields
.
join
(
","
)
let
aggField
=
p
.
group
.
aggField
?
p
.
group
.
aggField
:
''
let
tblName
=
p
.
group
.
tblName
?
p
.
group
.
tblName
:
''
let
where
=
p
.
group
.
where
?
p
.
group
.
where
:
''
let
having
=
p
.
group
.
having
?
p
.
group
.
having
:
''
let
aliasField
=
p
.
group
.
aliasField
?
p
.
group
.
aliasField
:
''
let
actionType
=
p
.
group
.
actionType
?
p
.
group
.
actionType
:
'count'
let
sql
=
`select
${
groupFields
}
,
${
actionType
}
(
${
aggField
}
)
${
aliasField
}
from
${
tblName
}
${
where
}
group by
${
groupFields
}
${
having
}
WITH ROLLUP`
return
this
.
customQuery
(
sql
,
paras
,
t
)
async
statGroupBy
(
p
,
paras
,
t
)
{
let
groupFields
=
p
.
group
.
byFields
.
join
(
","
)
let
aggField
=
p
.
group
.
aggField
?
p
.
group
.
aggField
:
''
let
tblName
=
p
.
group
.
tblName
?
p
.
group
.
tblName
:
''
let
where
=
p
.
group
.
where
?
p
.
group
.
where
:
''
let
having
=
p
.
group
.
having
?
p
.
group
.
having
:
''
let
aliasField
=
p
.
group
.
aliasField
?
p
.
group
.
aliasField
:
''
let
actionType
=
p
.
group
.
actionType
?
p
.
group
.
actionType
:
'count'
let
sql
=
`select
${
groupFields
}
,
${
actionType
}
(
${
aggField
}
)
${
aliasField
}
from
${
tblName
}
${
where
}
group by
${
groupFields
}
${
having
}
WITH ROLLUP`
return
this
.
customQuery
(
sql
,
paras
,
t
)
}
async
customQuery
(
sql
,
paras
,
t
)
{
...
...
@@ -275,7 +275,7 @@ class Dao {
if
(
includeObj
!=
null
&&
includeObj
.
length
>
0
)
{
tmpWhere
.
include
=
includeObj
;
tmpWhere
.
distinct
=
true
;
}
else
{
}
else
{
tmpWhere
.
raw
=
true
;
}
return
await
this
.
model
.
findAndCountAll
(
tmpWhere
);
...
...
@@ -286,5 +286,8 @@ class Dao {
async
findById
(
oid
)
{
return
this
.
model
.
findById
(
oid
);
}
async
findAll
(
obj
,
include
=
[])
{
return
this
.
model
.
findAll
({
"where"
:
obj
,
include
,
row
:
true
});
}
}
module
.
exports
=
Dao
;
tx-fi-tax/app/base/db/models/delivery/delivery_bill.js
View file @
f599fc49
...
...
@@ -63,7 +63,7 @@ module.exports = (db, DataTypes) => {
type
:
DataTypes
.
STRING
},
master_source_number
:{
//主订单号
allowNull
:
fals
e
,
allowNull
:
tru
e
,
type
:
DataTypes
.
STRING
},
settle_status
:
{
// 服务单流转状态
...
...
@@ -72,7 +72,7 @@ module.exports = (db, DataTypes) => {
defaultValue
:
'waittosettle'
},
selling_price
:
{
//售价
allowNull
:
fals
e
,
allowNull
:
tru
e
,
type
:
DataTypes
.
INTEGER
},
cost_price
:
{
//成本价
...
...
@@ -119,7 +119,10 @@ module.exports = (db, DataTypes) => {
allowNull
:
true
,
type
:
DataTypes
.
STRING
},
biz_id
:
{
// 财税服务示例id
allowNull
:
true
,
type
:
DataTypes
.
STRING
}
},
{
paranoid
:
false
,
//假的删除
underscored
:
true
,
...
...
tx-fi-tax/app/base/service/impl/bizchance/deliverybillSve.js
View file @
f599fc49
const
system
=
require
(
"../../../system"
);
const
ServiceBase
=
require
(
"../../sve.base"
);
const
settings
=
require
(
"../../../../config/settings"
);
const
System
=
require
(
"../../../system"
);
const
appconfig
=
system
.
getSysConfig
();
class
DeliverybillService
extends
ServiceBase
{
constructor
()
{
super
(
"bizchance"
,
ServiceBase
.
getDaoName
(
DeliverybillService
));
this
.
logService
=
system
.
getObject
(
"service.bizchance.statuslogSve"
);
this
.
fitaxschemeDao
=
system
.
getObject
(
"service.bizchance.fitaxschemeDao"
);
this
.
bizoptDao
=
system
.
getObject
(
"service.bizchance.bizoptDao"
);
this
.
operationrecordDao
=
system
.
getObject
(
"service.bizchance.operationrecordDao"
);
}
async
updateOrderStatus
(
pobj
)
{
...
...
@@ -124,5 +126,113 @@ class DeliverybillService extends ServiceBase {
}
return
result
}
async
distributionPerson
(
pobj
)
{
let
{
numbers
,
nickName
,
userId
,
opCode
,
phone
,
type
}
=
pobj
;
switch
(
type
)
{
case
System
.
FLOWCODE
.
DELIVERY
:
let
datas
=
await
this
.
dao
.
findAll
({
delivery_code
:
{
$in
:
numbers
}
});
if
(
datas
.
length
!==
numbers
.
length
)
{
throw
new
Error
(
"请检查单号是否正确"
);
}
await
this
.
dao
.
updateByWhere
({
salesman_id
:
userId
,
salesman_opcode
:
opCode
,
salesman_phone
:
phone
,
salesman_name
:
nickName
},
{
delivery_code
:
{
$in
:
numbers
}
});
// 插入 流转 记录
let
logs
=
[];
for
(
let
val
of
datas
)
{
logs
.
push
({
demand_code
:
val
.
delivery_code
,
operator
:
{
id
:
pobj
.
userid
,
username
:
pobj
.
username
},
operation_type
:
"distribution"
,
operation_details
:
{
isFirst
:
val
.
salesman_id
?
true
:
false
,
fromUserId
:
val
.
salesman_id
,
fromUserName
:
val
.
salesman_name
,
toUserId
:
userId
,
toUserName
:
nickName
},
order_type
:
System
.
FLOWCODE
.
DELIVERY
})
}
this
.
operationrecordDao
.
bulkCreate
(
logs
);
break
case
System
.
FLOWCODE
.
BIZ
:
let
datas
=
await
this
.
bizoptDao
.
findAll
({
demand_code
:
{
$in
:
numbers
}
});
if
(
datas
.
length
!==
datas
.
length
)
{
throw
new
Error
(
"请检查单号是否正确"
);
}
return
this
.
db
.
transaction
(
async
(
t
)
=>
{
// 更新 操作人
await
this
.
bizoptDao
.
updateByWhere
({
salesman_id
:
userId
,
salesman_opcode
:
opCode
,
salesman_phone
:
phone
,
salesman_name
:
nickName
},
{
demand_code
:
{
$in
:
numbers
}
},
t
);
// 更新 状态
await
this
.
bizoptDao
.
updateByWhere
({
business_status
:
"beforeFollowUp"
},
{
$and
:
[
{
demand_code
:
{
$in
:
numbers
}
},
{
business_status
:
"received"
}
]
},
t
);
// 插入 流转 记录
let
logs
=
[];
for
(
let
val
of
datas
)
{
logs
.
push
({
demand_code
:
val
.
demand_code
,
operator
:
{
id
:
pobj
.
userid
,
username
:
pobj
.
username
},
operation_type
:
"distribution"
,
operation_details
:
{
isFirst
:
val
.
salesman_id
?
true
:
false
,
fromUserId
:
val
.
salesman_id
,
fromUserName
:
val
.
salesman_name
,
toUserId
:
userId
,
toUserName
:
nickName
},
order_type
:
System
.
FLOWCODE
.
BIZ
})
}
this
.
operationrecordDao
.
bulkCreate
(
logs
);
return
"success"
});
break
}
return
"SUCCESS"
}
}
module
.
exports
=
DeliverybillService
;
\ 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