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
ac808f10
Commit
ac808f10
authored
Jun 11, 2020
by
sxy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 资质交付详情
parent
04e5c26e
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
371 additions
and
60 deletions
+371
-60
icp-deliver/app/base/api/api.base.js
+44
-47
icp-deliver/app/base/controller/ctl.base.js
+4
-4
icp-deliver/app/base/controller/impl/delivery/deliverCtl.js
+59
-4
icp-deliver/app/base/db/impl/common/connection.js
+4
-0
icp-deliver/app/base/db/impl/delivery/deliverDao.js
+20
-0
icp-deliver/app/base/db/impl/delivery/qualificationDao.js
+37
-0
icp-deliver/app/base/db/models/delivery/delivery_bill.js
+4
-1
icp-deliver/app/base/db/models/delivery/qualification_info.js
+81
-0
icp-deliver/app/base/service/impl/bizchance/bizoptSve.js
+2
-2
icp-deliver/app/base/service/impl/delivery/deliverSve.js
+116
-2
No files found.
icp-deliver/app/base/api/api.base.js
View file @
ac808f10
const
system
=
require
(
"../system"
);
const
system
=
require
(
"../system"
);
const
uuidv4
=
require
(
'uuid/v4'
);
const
uuidv4
=
require
(
'uuid/v4'
);
const
settings
=
require
(
"../../config/settings"
);
const
settings
=
require
(
"../../config/settings"
);
class
APIBase
{
class
APIBase
{
constructor
()
{
constructor
()
{
this
.
cacheManager
=
system
.
getObject
(
"db.common.cacheManager"
);
this
.
cacheManager
=
system
.
getObject
(
"db.common.cacheManager"
);
}
async
setContextParams
(
pobj
,
qobj
,
req
)
{
let
custtags
=
req
.
headers
[
"x-consumetag"
]
?
req
.
headers
[
"x-consumetag"
].
split
(
"|"
)
:
null
;
//当自由用户注册时,需要根据前端传来的companykey,查询出公司,给companyid赋值
req
.
xctx
=
{
appkey
:
req
.
headers
[
"xappkey"
],
//用于系统管理区分应用,比如角色
companyid
:
custtags
?
custtags
[
0
].
split
(
"_"
)[
1
]
:
null
,
password
:
custtags
?
custtags
[
1
].
split
(
"_"
)[
1
]
:
null
,
username
:
req
.
headers
[
"x-consumer-username"
],
credid
:
req
.
headers
[
"x-credential-identifier"
],
companykey
:
req
.
headers
[
"x-company-key"
],
//专用于自由用户注册,自由用户用于一定属于某个存在的公司
}
}
async
setContextParams
(
pobj
,
qobj
,
req
)
{
if
(
!
req
.
xctx
.
appkey
)
{
let
custtags
=
req
.
headers
[
"x-consumetag"
]?
req
.
headers
[
"x-consumetag"
].
split
(
"|"
):
null
;
return
[
-
200
,
"请求头缺少应用x-app-key"
]
//当自由用户注册时,需要根据前端传来的companykey,查询出公司,给companyid赋值
}
else
{
req
.
xctx
=
{
// let app = await this.cacheManager["AppCache"].cache(req.xctx.appkey);
appkey
:
req
.
headers
[
"xappkey"
],
//用于系统管理区分应用,比如角色
// req.xctx.appid = app.id;
companyid
:
custtags
?
custtags
[
0
].
split
(
"_"
)[
1
]:
null
,
// pobj.app_id = app.id;//传递参数对象里注入app_id
password
:
custtags
?
custtags
[
1
].
split
(
"_"
)[
1
]:
null
,
}
username
:
req
.
headers
[
"x-consumer-username"
],
//平台注册时,companyid,companykey都为空
credid
:
req
.
headers
[
"x-credential-identifier"
],
//自由注册时,companykey不能为空
companykey
:
req
.
headers
[
"x-company-key"
],
//专用于自由用户注册,自由用户用于一定属于某个存在的公司
// if(!req.xctx.companyid && !req.xctx.companykey){
}
// return [-200,"请求头缺少应用x-app-key"]
if
(
!
req
.
xctx
.
appkey
){
// }
return
[
-
200
,
"请求头缺少应用x-app-key"
]
}
else
{
if
(
req
.
xctx
.
companyid
)
{
//在请求传递数据对象注入公司id
let
app
=
await
this
.
cacheManager
[
"AppCache"
].
cache
(
req
.
xctx
.
appkey
);
pobj
.
company_id
=
req
.
xctx
.
companyid
;
req
.
xctx
.
appid
=
app
.
id
;
}
pobj
.
app_id
=
app
.
id
;
//传递参数对象里注入app_id
}
}
async
doexec
(
gname
,
methodname
,
pobj
,
query
,
req
)
{
//平台注册时,companyid,companykey都为空
try
{
//自由注册时,companykey不能为空
let
xarg
=
await
this
.
setContextParams
(
pobj
,
query
,
req
);
// if(!req.xctx.companyid && !req.xctx.companykey){
if
(
xarg
&&
xarg
[
0
]
<
0
)
{
// return [-200,"请求头缺少应用x-app-key"]
return
system
.
getResultFail
(...
xarg
);
// }
if
(
!
req
.
xctx
.
companyid
&&
req
.
xctx
.
companykey
){
let
comptmp
=
await
this
.
cacheManager
[
"CompanyCache"
].
cache
(
req
.
xctx
.
companykey
);
req
.
xctx
.
companyid
=
comptmp
.
id
;
}
if
(
req
.
xctx
.
companyid
){
//在请求传递数据对象注入公司id
pobj
.
company_id
=
req
.
xctx
.
companyid
;
}
}
}
async
doexec
(
gname
,
methodname
,
pobj
,
query
,
req
)
{
try
{
var
rtn
=
await
this
[
methodname
](
pobj
,
query
,
req
);
let
xarg
=
await
this
.
setContextParams
(
pobj
,
query
,
req
);
return
rtn
;
if
(
xarg
&&
xarg
[
0
]
<
0
){
}
catch
(
e
)
{
return
system
.
getResultFail
(...
xarg
);
console
.
log
(
e
.
stack
,
"api调用异常--error..................."
);
}
var
rtnerror
=
system
.
getResultFail
(
-
200
,
"出现异常,请联系管理员"
);
return
rtnerror
;
var
rtn
=
await
this
[
methodname
](
pobj
,
query
,
req
);
return
rtn
;
}
catch
(
e
)
{
console
.
log
(
e
.
stack
,
"api调用异常--error..................."
);
var
rtnerror
=
system
.
getResultFail
(
-
200
,
"出现异常,请联系管理员"
);
return
rtnerror
;
}
}
}
}
}
}
module
.
exports
=
APIBase
;
module
.
exports
=
APIBase
;
icp-deliver/app/base/controller/ctl.base.js
View file @
ac808f10
...
@@ -65,10 +65,10 @@ class CtlBase {
...
@@ -65,10 +65,10 @@ class CtlBase {
// if(!req.xctx.companyid && !req.xctx.companykey){
// if(!req.xctx.companyid && !req.xctx.companykey){
// return [-200,"请求头缺少应用x-app-key"]
// return [-200,"请求头缺少应用x-app-key"]
// }
// }
if
(
!
req
.
xctx
.
companyid
&&
req
.
xctx
.
fromcompanykey
&&
req
.
xctx
.
fromcompanykey
!=
"null"
)
{
// if (!req.xctx.companyid && req.xctx.fromcompanykey && req.xctx.fromcompanykey != "null" &&
) {
let
comptmp
=
await
this
.
cacheManager
[
"CompanyCache"
].
cache
(
req
.
xctx
.
fromcompanykey
);
//
let comptmp = await this.cacheManager["CompanyCache"].cache(req.xctx.fromcompanykey);
req
.
xctx
.
companyid
=
comptmp
.
id
;
//
req.xctx.companyid = comptmp.id;
}
//
}
if
(
req
.
xctx
.
companyid
)
{
//在请求传递数据对象注入公司id
if
(
req
.
xctx
.
companyid
)
{
//在请求传递数据对象注入公司id
pobj
.
company_id
=
req
.
xctx
.
companyid
;
pobj
.
company_id
=
req
.
xctx
.
companyid
;
}
}
...
...
icp-deliver/app/base/controller/impl/delivery/deliverCtl.js
View file @
ac808f10
...
@@ -8,6 +8,7 @@ class DeliverCtl extends CtlBase {
...
@@ -8,6 +8,7 @@ class DeliverCtl extends CtlBase {
constructor
()
{
constructor
()
{
super
(
"delivery"
,
CtlBase
.
getServiceName
(
DeliverCtl
));
super
(
"delivery"
,
CtlBase
.
getServiceName
(
DeliverCtl
));
}
}
async
findAndCountAll
(
pobj
,
qobj
,
req
)
{
async
findAndCountAll
(
pobj
,
qobj
,
req
)
{
//设置查询条件
//设置查询条件
const
rs
=
await
this
.
service
.
findAndCountAll
(
pobj
);
const
rs
=
await
this
.
service
.
findAndCountAll
(
pobj
);
...
@@ -23,13 +24,19 @@ class DeliverCtl extends CtlBase {
...
@@ -23,13 +24,19 @@ class DeliverCtl extends CtlBase {
rs
.
results
.
rows
=
result
;
rs
.
results
.
rows
=
result
;
return
system
.
getResult
(
rs
);
return
system
.
getResult
(
rs
);
}
}
// TODO: 交付单表关联材料表
async
findOneById
(
pobj
,
qobj
,
req
)
{
// 查询 详情
async
findInfo
(
pobj
,
qobj
,
req
)
{
if
(
!
pobj
.
id
)
{
if
(
!
pobj
.
id
)
{
return
system
.
getResult
(
null
,
"id can not be empty,100290"
);
return
system
.
getResult
(
null
,
"id can not be empty,100290"
);
}
}
const
rs
=
await
this
.
service
.
findOne
({
id
:
pobj
.
id
});
try
{
return
system
.
getResult
(
rs
);
const
rs
=
await
this
.
service
.
findInfo
(
pobj
);
return
system
.
getResult
(
rs
);
}
catch
(
err
)
{
return
system
.
getResult
(
null
,
err
.
message
)
}
}
}
async
temporarySave
(
pobj
,
qobj
,
req
)
{
async
temporarySave
(
pobj
,
qobj
,
req
)
{
...
@@ -66,7 +73,55 @@ class DeliverCtl extends CtlBase {
...
@@ -66,7 +73,55 @@ class DeliverCtl extends CtlBase {
return
system
.
getResult
(
null
,
err
.
message
)
return
system
.
getResult
(
null
,
err
.
message
)
}
}
}
async
changeDeliveryStatus
(
pobj
,
qobj
,
req
)
{
if
(
!
pobj
.
id
)
{
return
system
.
getResult
(
null
,
"deliver_id can not be empty,100290"
);
}
try
{
let
rs
=
await
this
.
service
.
changeDeliveryStatus
(
pobj
);
return
system
.
getResult
(
rs
);
}
catch
(
err
)
{
return
system
.
getResult
(
null
,
err
.
message
)
}
}
async
addQualification
(
pobj
,
qobj
,
req
)
{
if
(
!
pobj
.
deliver_id
)
{
return
system
.
getResult
(
null
,
"deliver_id can not be empty,100290"
);
}
try
{
let
rs
=
await
this
.
service
.
addQualification
(
pobj
);
return
system
.
getResult
(
rs
);
}
catch
(
err
)
{
return
system
.
getResult
(
null
,
err
.
message
)
}
}
async
closeDeliver
(
pobj
)
{
if
(
!
pobj
.
id
)
{
return
system
.
getResult
(
null
,
"id can not be empty,100290"
);
}
try
{
let
rs
=
await
this
.
service
.
closeDeliver
(
pobj
);
return
system
.
getResult
(
rs
);
}
catch
(
err
)
{
return
system
.
getResult
(
null
,
err
.
message
)
}
}
async
addMail
(
pobj
)
{
if
(
!
pobj
.
id
)
{
return
system
.
getResult
(
null
,
"id can not be empty,100290"
);
}
try
{
let
rs
=
await
this
.
service
.
addMail
(
pobj
);
return
system
.
getResult
(
rs
);
}
catch
(
err
)
{
return
system
.
getResult
(
null
,
err
.
message
)
}
}
}
}
}
module
.
exports
=
DeliverCtl
;
module
.
exports
=
DeliverCtl
;
icp-deliver/app/base/db/impl/common/connection.js
View file @
ac808f10
...
@@ -75,6 +75,10 @@ class DbFactory {
...
@@ -75,6 +75,10 @@ class DbFactory {
this
.
db
.
models
.
material
.
belongsTo
(
this
.
db
.
models
.
deliver
,
{
constraints
:
false
,
});
this
.
db
.
models
.
material
.
belongsTo
(
this
.
db
.
models
.
deliver
,
{
constraints
:
false
,
});
this
.
db
.
models
.
deliver
.
hasOne
(
this
.
db
.
models
.
material
,
{
constraints
:
false
,
});
this
.
db
.
models
.
deliver
.
hasOne
(
this
.
db
.
models
.
material
,
{
constraints
:
false
,
});
// 交付表 1:1 资质信息表
this
.
db
.
models
.
qualification
.
belongsTo
(
this
.
db
.
models
.
deliver
,
{
constraints
:
false
,
});
this
.
db
.
models
.
deliver
.
hasOne
(
this
.
db
.
models
.
qualification
,
{
constraints
:
false
,
});
}
}
//async getCon(){,用于使用替换table模型内字段数据使用
//async getCon(){,用于使用替换table模型内字段数据使用
...
...
icp-deliver/app/base/db/impl/delivery/deliverDao.js
View file @
ac808f10
...
@@ -24,5 +24,25 @@ class DeliverDao extends Dao {
...
@@ -24,5 +24,25 @@ class DeliverDao extends Dao {
}
}
return
qw
;
return
qw
;
}
}
async
findInfo
(
pobj
)
{
const
result
=
await
this
.
model
.
findOne
({
where
:
{
id
:
pobj
.
id
},
include
:
[
{
model
:
this
.
db
.
models
.
qualification
,
attributes
:
[
'id'
,
'certificateNumber'
,
'businessTypes'
,
'businessScope'
,
'serviceProject'
,
'startAt'
,
'endAt'
,
'file'
],
raw
:
false
},
{
model
:
this
.
db
.
models
.
material
,
raw
:
false
}
],
raw
:
false
});
return
result
;
}
}
}
module
.
exports
=
DeliverDao
;
module
.
exports
=
DeliverDao
;
icp-deliver/app/base/db/impl/delivery/qualificationDao.js
0 → 100644
View file @
ac808f10
const
system
=
require
(
"../../../system"
);
const
Dao
=
require
(
"../../dao.base"
);
const
url
=
require
(
"url"
);
class
QualificationDao
extends
Dao
{
constructor
()
{
super
(
Dao
.
getModelName
(
QualificationDao
));
}
async
createOrUpdate
(
pobj
,
t
)
{
const
qualificationData
=
await
this
.
findOne
({
deliver_id
:
pobj
.
deliver_id
});
let
result
=
{};
let
info
=
{
businessScope
:
pobj
.
businessScope
,
businessTypes
:
pobj
.
businessTypes
,
certificateNumber
:
pobj
.
certificateNumber
,
endAt
:
pobj
.
endAt
,
file
:
pobj
.
file
,
serviceProject
:
pobj
.
serviceProject
,
startAt
:
pobj
.
startAt
,
deliver_id
:
pobj
.
deliver_id
}
if
(
qualificationData
)
{
//更新
await
this
.
updateByWhere
(
info
,
{
deliver_id
:
pobj
.
deliver_id
},
t
);
result
=
{
id
:
qualificationData
.
id
}
}
else
{
// 创建
let
data
=
await
this
.
create
(
info
,
t
);
result
=
{
id
:
data
.
id
};
}
return
result
}
}
module
.
exports
=
QualificationDao
;
icp-deliver/app/base/db/models/delivery/delivery_bill.js
View file @
ac808f10
...
@@ -81,8 +81,11 @@ module.exports = (db, DataTypes) => {
...
@@ -81,8 +81,11 @@ module.exports = (db, DataTypes) => {
salesman_phone
:
{
// 业务员联系方式
salesman_phone
:
{
// 业务员联系方式
allowNull
:
true
,
allowNull
:
true
,
type
:
DataTypes
.
STRING
type
:
DataTypes
.
STRING
},
sku_code
:
{
allowNull
:
true
,
type
:
DataTypes
.
STRING
}
}
},
{
},
{
paranoid
:
false
,
//假的删除
paranoid
:
false
,
//假的删除
underscored
:
true
,
underscored
:
true
,
...
...
icp-deliver/app/base/db/models/delivery/qualification_info.js
0 → 100644
View file @
ac808f10
const
system
=
require
(
"../../../system"
);
const
settings
=
require
(
"../../../../config/settings"
);
const
appconfig
=
system
.
getSysConfig
();
/**
* 资质信息表
*/
module
.
exports
=
(
db
,
DataTypes
)
=>
{
return
db
.
define
(
"qualification"
,
{
certificateNumber
:
{
allowNull
:
false
,
type
:
DataTypes
.
STRING
},
businessTypes
:
{
allowNull
:
false
,
type
:
DataTypes
.
STRING
},
businessScope
:
{
allowNull
:
false
,
type
:
DataTypes
.
STRING
},
serviceProject
:
{
allowNull
:
false
,
type
:
DataTypes
.
STRING
},
startAt
:
{
allowNull
:
false
,
type
:
DataTypes
.
DATE
},
endAt
:
{
allowNull
:
false
,
type
:
DataTypes
.
DATE
},
file
:
{
allowNull
:
false
,
type
:
DataTypes
.
JSON
}
},
{
paranoid
:
false
,
//假的删除
underscored
:
true
,
version
:
true
,
freezeTableName
:
true
,
//freezeTableName: true,
// define the table's name
tableName
:
'qualification_info'
,
validate
:
{
},
indexes
:
[
// Create a unique index on email
// {
// unique: true,
// fields: ['email']
// },
//
// // Creates a gin index on data with the jsonb_path_ops operator
// {
// fields: ['data'],
// using: 'gin',
// operator: 'jsonb_path_ops'
// },
//
// // By default index name will be [table]_[fields]
// // Creates a multi column partial index
// {
// name: 'public_by_author',
// fields: ['author', 'status'],
// where: {
// status: 'public'
// }
// },
//
// // A BTREE index with a ordered field
// {
// name: 'title_index',
// method: 'BTREE',
// fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
// }
]
});
}
icp-deliver/app/base/service/impl/bizchance/bizoptSve.js
View file @
ac808f10
...
@@ -85,7 +85,7 @@ class BizoptService extends ServiceBase {
...
@@ -85,7 +85,7 @@ class BizoptService extends ServiceBase {
flow_type
:
system
.
FLOWCODE
.
BIZ
,
flow_type
:
system
.
FLOWCODE
.
BIZ
,
flow_id
:
pobj
.
bizId
,
flow_id
:
pobj
.
bizId
,
status_code
:
system
.
BUSSTATUS
.
CLOSED
status_code
:
system
.
BUSSTATUS
.
CLOSED
});
}
,
t
);
if
(
schemeResult
)
{
if
(
schemeResult
)
{
await
this
.
schemeDao
.
updateByWhere
({
await
this
.
schemeDao
.
updateByWhere
({
scheme_status
:
system
.
SCHEMESTATUS
.
CLOSED
scheme_status
:
system
.
SCHEMESTATUS
.
CLOSED
...
@@ -96,7 +96,7 @@ class BizoptService extends ServiceBase {
...
@@ -96,7 +96,7 @@ class BizoptService extends ServiceBase {
flow_type
:
system
.
FLOWCODE
.
SCHEME
,
flow_type
:
system
.
FLOWCODE
.
SCHEME
,
flow_id
:
schemeResult
.
id
,
flow_id
:
schemeResult
.
id
,
status_code
:
system
.
SCHEMESTATUS
.
CLOSED
status_code
:
system
.
SCHEMESTATUS
.
CLOSED
});
}
,
t
);
}
}
return
"success"
return
"success"
})
})
...
...
icp-deliver/app/base/service/impl/delivery/deliverSve.js
View file @
ac808f10
...
@@ -9,12 +9,13 @@ class DeliverService extends ServiceBase {
...
@@ -9,12 +9,13 @@ class DeliverService extends ServiceBase {
this
.
companyDao
=
system
.
getObject
(
"db.delivery.companyDao"
);
this
.
companyDao
=
system
.
getObject
(
"db.delivery.companyDao"
);
this
.
materialDao
=
system
.
getObject
(
"db.delivery.materialDao"
);
this
.
materialDao
=
system
.
getObject
(
"db.delivery.materialDao"
);
this
.
statuslogDao
=
system
.
getObject
(
"db.bizchance.statuslogDao"
);
this
.
statuslogDao
=
system
.
getObject
(
"db.bizchance.statuslogDao"
);
this
.
qualificationDao
=
system
.
getObject
(
"db.delivery.qualificationDao"
);
}
}
async
temporarySave
(
pobj
)
{
async
temporarySave
(
pobj
)
{
const
deliverData
=
await
this
.
dao
.
findOne
({
const
deliverData
=
await
this
.
dao
.
findOne
({
id
:
pobj
.
deliver_id
id
:
pobj
.
deliver_id
})
})
;
if
(
!
deliverData
)
{
if
(
!
deliverData
)
{
throw
new
Error
(
"没有关联的交付单"
);
throw
new
Error
(
"没有关联的交付单"
);
}
}
...
@@ -61,7 +62,7 @@ class DeliverService extends ServiceBase {
...
@@ -61,7 +62,7 @@ class DeliverService extends ServiceBase {
flow_type
:
system
.
FLOWCODE
.
DELIVERY
,
flow_type
:
system
.
FLOWCODE
.
DELIVERY
,
flow_id
:
pobj
.
deliver_id
,
flow_id
:
pobj
.
deliver_id
,
status_code
:
system
.
SERVERSESTATUS
.
SUBMITING
status_code
:
system
.
SERVERSESTATUS
.
SUBMITING
});
}
,
t
);
}
}
await
this
.
companyDao
.
createOrUpdate
({
await
this
.
companyDao
.
createOrUpdate
({
...
pobj
.
cache_info
.
proposerInfo
.
businessLicense
,
...
pobj
.
cache_info
.
proposerInfo
.
businessLicense
,
...
@@ -72,5 +73,118 @@ class DeliverService extends ServiceBase {
...
@@ -72,5 +73,118 @@ class DeliverService extends ServiceBase {
});
});
}
}
async
findInfo
(
pobj
)
{
/**
* 交付单表 关联 材料表(材料基本信息、邮寄信息) 、 资质信息表
*/
let
result
=
await
this
.
dao
.
findInfo
(
pobj
);
if
(
!
result
)
{
throw
new
Error
(
"交付单不可查看"
);
}
return
result
;
}
async
changeDeliveryStatus
(
pobj
)
{
/**
* 判断 交付单状态下能否更新
*/
const
deliverData
=
await
this
.
dao
.
findOne
({
id
:
pobj
.
id
});
if
(
!
deliverData
)
{
throw
new
Error
(
"没有此交付单"
);
}
if
(
!
[
system
.
SERVERSESTATUS
.
SUBMITING
,
system
.
SERVERSESTATUS
.
POSTING
].
includes
(
deliverData
.
delivery_status
))
{
throw
new
Error
(
"此状态下不可手动更新办理状态"
);
}
let
status
;
switch
(
deliverData
.
delivery_status
)
{
case
system
.
SERVERSESTATUS
.
SUBMITING
:
status
=
system
.
SERVERSESTATUS
.
DISPOSEING
break
case
system
.
SERVERSESTATUS
.
POSTING
:
status
=
system
.
SERVERSESTATUS
.
SUCCESS
break
}
await
this
.
dao
.
updateByWhere
({
delivery_status
:
status
},
{
id
:
pobj
.
id
})
this
.
statuslogDao
.
create
({
flow_type
:
system
.
FLOWCODE
.
DELIVERY
,
flow_id
:
pobj
.
id
,
status_code
:
status
});
return
"success"
}
async
addQualification
(
pobj
)
{
const
deliverData
=
await
this
.
dao
.
findOne
({
id
:
pobj
.
deliver_id
});
if
(
!
deliverData
)
{
throw
new
Error
(
"查不到交付单"
);
}
if
(
deliverData
.
delivery_status
!==
system
.
SERVERSESTATUS
.
DISPOSEING
)
{
throw
new
Error
(
"该交付单状态下不可提交"
);
}
let
result
=
await
this
.
qualificationDao
.
createOrUpdate
(
pobj
);
return
result
;
}
async
closeDeliver
(
pobj
)
{
const
deliverData
=
await
this
.
dao
.
findOne
({
id
:
pobj
.
id
});
if
(
!
deliverData
)
{
throw
new
Error
(
"查不到交付单"
);
}
if
(
!
[
system
.
SERVERSESTATUS
.
RECEIVED
,
system
.
SERVERSESTATUS
.
COLLECTING
].
includes
(
deliverData
.
delivery_status
))
{
throw
new
Error
(
"该交付单状态下不可提交"
);
}
await
this
.
dao
.
updateByWhere
({
delivery_status
:
system
.
SERVERSESTATUS
.
CLOSED
,
close_reason
:
pobj
.
close_reason
},
{
id
:
pobj
.
id
});
this
.
statuslogDao
.
create
({
flow_type
:
system
.
FLOWCODE
.
DELIVERY
,
flow_id
:
pobj
.
id
,
status_code
:
system
.
SERVERSESTATUS
.
CLOSED
});
return
"success"
}
async
addMail
(
pobj
)
{
let
result
=
await
this
.
dao
.
findInfo
(
pobj
);
if
(
!
result
)
{
throw
new
Error
(
"交付单不可查看"
);
}
if
(
result
.
qualification
)
{
throw
new
Error
(
"请先上传资质信息"
);
}
if
(
result
.
delivery_status
!==
system
.
SERVERSESTATUS
.
DISPOSEING
)
{
throw
new
Error
(
"该状态下不可填写邮寄信息"
);
}
const
{
material
:
{
proposerInfo
}
}
=
result
;
proposerInfo
.
recipientInfo
=
pobj
.
recipientInfo
;
return
this
.
db
.
transaction
(
async
(
t
)
=>
{
await
this
.
materialDao
.
updateByWhere
({
proposerInfo
},
{
id
:
material
.
id
},
t
)
});
/**
* 保存 邮寄信息
* 更改流转状态
*/
}
}
}
module
.
exports
=
DeliverService
;
module
.
exports
=
DeliverService
;
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