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
4acbe409
Commit
4acbe409
authored
Jun 10, 2020
by
sxy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 交付单添加材料
parent
5f4ca675
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
515 additions
and
21 deletions
+515
-21
icp-deliver/app/base/controller/impl/bizchance/bizoptCtl.js
+1
-1
icp-deliver/app/base/controller/impl/delivery/deliverCtl.js
+72
-0
icp-deliver/app/base/controller/impl/delivery/deliverybillCtl.js
+0
-17
icp-deliver/app/base/db/impl/bizchance/bizoptDao.js
+1
-1
icp-deliver/app/base/db/impl/common/connection.js
+9
-0
icp-deliver/app/base/db/impl/delivery/cacheinfoDao.js
+31
-0
icp-deliver/app/base/db/impl/delivery/companyDao.js
+29
-0
icp-deliver/app/base/db/impl/delivery/deliverDao.js
+28
-0
icp-deliver/app/base/db/impl/delivery/materialDao.js
+37
-0
icp-deliver/app/base/db/models/delivery/cache_information.js
+57
-0
icp-deliver/app/base/db/models/delivery/company.js
+93
-0
icp-deliver/app/base/db/models/delivery/delivery_bill.js
+1
-1
icp-deliver/app/base/db/models/delivery/meterials_info.js
+73
-0
icp-deliver/app/base/service/impl/delivery/deliverSve.js
+76
-0
icp-deliver/app/base/system.js
+7
-1
No files found.
icp-deliver/app/base/controller/impl/bizchance/bizoptCtl.js
View file @
4acbe409
...
...
@@ -46,7 +46,7 @@ class BizOptCtl extends CtlBase {
await
this
.
service
.
closeBiz
({
bizId
:
pobj
.
bizId
,
close_reason
:
pobj
.
close_reason
});
return
system
.
getResultSuccess
();
}
catch
(
err
)
{
return
system
.
getResult
(
null
,
err
.
message
)
return
system
.
getResult
(
null
,
err
.
message
)
;
}
}
...
...
icp-deliver/app/base/controller/impl/delivery/deliverCtl.js
0 → 100644
View file @
4acbe409
var
system
=
require
(
"../../../system"
);
const
http
=
require
(
"http"
);
const
querystring
=
require
(
'querystring'
);
var
settings
=
require
(
"../../../../config/settings"
);
const
CtlBase
=
require
(
"../../ctl.base"
);
const
moment
=
require
(
"moment"
);
class
DeliverCtl
extends
CtlBase
{
constructor
()
{
super
(
"delivery"
,
CtlBase
.
getServiceName
(
DeliverCtl
));
}
async
findAndCountAll
(
pobj
,
qobj
,
req
)
{
//设置查询条件
const
rs
=
await
this
.
service
.
findAndCountAll
(
pobj
);
let
result
=
[];
for
(
let
val
of
rs
.
results
.
rows
)
{
val
.
company_name
=
val
.
delivery_info
.
company
;
val
.
customer_number
=
val
.
delivery_info
.
phone
;
val
.
customer_name
=
val
.
delivery_info
.
person
;
val
.
updated_at
=
moment
(
val
.
updated_at
).
format
(
'YYYY-MM-DD HH:mm:ss'
);
val
.
created_at
=
moment
(
val
.
created_at
).
format
(
'YYYY-MM-DD HH:mm:ss'
);
result
.
push
(
val
);
}
rs
.
results
.
rows
=
result
;
return
system
.
getResult
(
rs
);
}
// TODO: 交付单表关联材料表
async
findOneById
(
pobj
,
qobj
,
req
)
{
if
(
!
pobj
.
id
)
{
return
system
.
getResult
(
null
,
"id can not be empty,100290"
);
}
const
rs
=
await
this
.
service
.
findOne
({
id
:
pobj
.
id
});
return
system
.
getResult
(
rs
);
}
async
temporarySave
(
pobj
,
qobj
,
req
)
{
if
(
!
pobj
.
deliver_id
)
{
return
system
.
getResult
(
null
,
"deliver_id can not be empty,100290"
);
}
try
{
let
rs
=
await
this
.
service
.
temporarySave
(
pobj
);
return
system
.
getResult
(
rs
);
}
catch
(
err
)
{
return
system
.
getResult
(
null
,
err
.
message
)
}
}
async
findTemporary
(
pobj
,
qobj
,
req
)
{
if
(
!
pobj
.
deliver_id
)
{
return
system
.
getResult
(
null
,
"deliver_id can not be empty,100290"
);
}
const
rs
=
await
this
.
service
.
findTemporary
(
pobj
);
return
system
.
getResultSuccess
(
rs
);
}
// 提交材料
async
submitMaterials
(
pobj
,
qobj
,
req
)
{
//TODO:各种参数校验
if
(
!
pobj
.
deliver_id
)
{
return
system
.
getResult
(
null
,
"deliver_id can not be empty,100290"
);
}
try
{
let
rs
=
await
this
.
service
.
submitMaterials
(
pobj
);
return
system
.
getResult
(
rs
);
}
catch
(
err
)
{
return
system
.
getResult
(
null
,
err
.
message
)
}
}
}
module
.
exports
=
DeliverCtl
;
icp-deliver/app/base/controller/impl/delivery/deliverybillCtl.js
deleted
100644 → 0
View file @
5f4ca675
var
system
=
require
(
"../../../system"
);
const
http
=
require
(
"http"
);
const
querystring
=
require
(
'querystring'
);
var
settings
=
require
(
"../../../../config/settings"
);
const
CtlBase
=
require
(
"../../ctl.base"
);
const
moment
=
require
(
"moment"
);
class
DeliverybillCtl
extends
CtlBase
{
constructor
()
{
super
(
"delivery"
,
CtlBase
.
getServiceName
(
DeliverybillCtl
));
}
async
findAndCountAll
(
pobj
,
qobj
,
req
)
{
//设置查询条件
const
rs
=
await
this
.
service
.
findAndCountAll
(
pobj
);
return
system
.
getResult
(
rs
);
}
}
module
.
exports
=
DeliverybillCtl
;
icp-deliver/app/base/db/impl/bizchance/bizoptDao.js
View file @
4acbe409
...
...
@@ -16,7 +16,7 @@ class BizoptDao extends Dao {
[
this
.
db
.
Op
.
in
]:
[
system
.
BUSSTATUS
.
WAITINGSCHEME
,
system
.
BUSSTATUS
.
WAITINGCONFIRM
]
}
break
case
"businessManagement/all"
:
case
"
/
businessManagement/all"
:
break
}
qc
.
include
=
[
...
...
icp-deliver/app/base/db/impl/common/connection.js
View file @
4acbe409
...
...
@@ -67,6 +67,15 @@ class DbFactory {
this
.
db
.
models
.
scheme
.
belongsTo
(
this
.
db
.
models
.
bizopt
,
{
constraints
:
false
,
});
this
.
db
.
models
.
bizopt
.
hasOne
(
this
.
db
.
models
.
scheme
,
{
constraints
:
false
,
});
// 交付单表 1:1 临时材料表
this
.
db
.
models
.
cacheinfo
.
belongsTo
(
this
.
db
.
models
.
deliver
,
{
constraints
:
false
,
});
this
.
db
.
models
.
deliver
.
hasOne
(
this
.
db
.
models
.
cacheinfo
,
{
constraints
:
false
,
});
// 交付表 1:1 材料表
this
.
db
.
models
.
material
.
belongsTo
(
this
.
db
.
models
.
deliver
,
{
constraints
:
false
,
});
this
.
db
.
models
.
deliver
.
hasOne
(
this
.
db
.
models
.
material
,
{
constraints
:
false
,
});
}
//async getCon(){,用于使用替换table模型内字段数据使用
getCon
()
{
...
...
icp-deliver/app/base/db/impl/delivery/cacheinfoDao.js
0 → 100644
View file @
4acbe409
const
system
=
require
(
"../../../system"
);
const
Dao
=
require
(
"../../dao.base"
);
const
url
=
require
(
"url"
);
class
CacheinfoDao
extends
Dao
{
constructor
()
{
super
(
Dao
.
getModelName
(
CacheinfoDao
));
}
async
createOrUpdate
(
pobj
,
t
)
{
const
cacheinf
=
await
this
.
findOne
({
deliver_id
:
pobj
.
deliver_id
});
let
result
=
{};
if
(
cacheinf
)
{
//更新
await
this
.
updateByWhere
({
cache_info
:
pobj
.
cache_info
},
{
deliver_id
:
pobj
.
deliver_id
},
t
);
result
=
{
id
:
cacheinf
.
id
}
}
else
{
// 创建
let
data
=
await
this
.
create
(
pobj
,
t
);
result
=
{
id
:
data
.
id
};
}
return
result
}
}
module
.
exports
=
CacheinfoDao
;
icp-deliver/app/base/db/impl/delivery/companyDao.js
0 → 100644
View file @
4acbe409
const
system
=
require
(
"../../../system"
);
const
Dao
=
require
(
"../../dao.base"
);
const
url
=
require
(
"url"
);
class
CompanyDao
extends
Dao
{
constructor
()
{
super
(
Dao
.
getModelName
(
CompanyDao
));
}
async
createOrUpdate
(
pobj
,
t
)
{
const
companyData
=
await
this
.
findOne
({
enterpriseCode
:
pobj
.
enterpriseCode
});
let
result
=
{};
if
(
companyData
)
{
//更新
delete
pobj
.
firstBuyTime
await
this
.
updateByWhere
(
pobj
,
{
enterpriseCode
:
pobj
.
enterpriseCode
},
t
);
result
=
{
id
:
companyData
.
id
}
}
else
{
// 创建
let
data
=
await
this
.
create
(
pobj
,
t
);
result
=
{
id
:
data
.
id
};
}
return
result
}
}
module
.
exports
=
CompanyDao
;
icp-deliver/app/base/db/impl/delivery/deliverDao.js
0 → 100644
View file @
4acbe409
const
system
=
require
(
"../../../system"
);
const
Dao
=
require
(
"../../dao.base"
);
const
url
=
require
(
"url"
);
class
DeliverDao
extends
Dao
{
constructor
()
{
super
(
Dao
.
getModelName
(
DeliverDao
));
}
extraWhere
(
qobj
,
qw
,
qc
)
{
qc
.
raw
=
true
;
qc
.
where
.
product_code
=
qc
.
where
.
product_code
&&
[
system
.
SERVICECODE
.
EDI
,
system
.
SERVICECODE
.
ICP
].
includes
(
qc
.
where
.
product_code
)
?
qc
.
where
.
product_code
:
{
[
this
.
db
.
Op
.
in
]:
[
system
.
SERVICECODE
.
EDI
,
system
.
SERVICECODE
.
ICP
]
}
switch
(
qobj
.
bizpath
)
{
case
"/deliveryManagement/wait"
:
qc
.
where
.
delivery_status
=
qc
.
where
.
delivery_status
||
{
[
this
.
db
.
Op
.
in
]:
[
system
.
SERVERSESTATUS
.
RECEIVED
,
system
.
SERVERSESTATUS
.
COLLECTING
,
system
.
SERVERSESTATUS
.
SUBMITING
,
system
.
SERVERSESTATUS
.
DISPOSEING
]
}
break
case
"/deliveryManagement/all"
:
break
}
return
qw
;
}
}
module
.
exports
=
DeliverDao
;
icp-deliver/app/base/db/impl/delivery/materialDao.js
0 → 100644
View file @
4acbe409
const
system
=
require
(
"../../../system"
);
const
Dao
=
require
(
"../../dao.base"
);
const
url
=
require
(
"url"
);
class
MaterialDao
extends
Dao
{
constructor
()
{
super
(
Dao
.
getModelName
(
MaterialDao
));
}
async
createOrUpdate
(
pobj
,
t
)
{
const
materialData
=
await
this
.
findOne
({
deliver_id
:
pobj
.
deliver_id
});
let
result
=
{};
let
dataInfo
=
{
proposerInfo
:
pobj
.
cache_info
.
proposerInfo
,
shareholderData
:
pobj
.
cache_info
.
shareholderData
,
implementationPlanInfo
:
pobj
.
cache_info
.
implementationPlanInfo
,
safetyInfo
:
pobj
.
cache_info
.
safetyInfo
,
otherMaterialsInfo
:
pobj
.
cache_info
.
otherMaterialsInfo
,
deliver_id
:
pobj
.
deliver_id
}
if
(
materialData
)
{
//更新
await
this
.
updateByWhere
(
dataInfo
,
{
deliver_id
:
pobj
.
deliver_id
},
t
);
result
=
{
id
:
materialData
.
id
}
}
else
{
// 创建
let
data
=
await
this
.
create
(
dataInfo
,
t
);
result
=
{
id
:
data
.
id
};
}
return
result
}
}
module
.
exports
=
MaterialDao
;
icp-deliver/app/base/db/models/delivery/cache_information.js
0 → 100644
View file @
4acbe409
const
system
=
require
(
"../../../system"
);
const
settings
=
require
(
"../../../../config/settings"
);
const
appconfig
=
system
.
getSysConfig
();
/**
* 材料缓存表
*/
module
.
exports
=
(
db
,
DataTypes
)
=>
{
return
db
.
define
(
"cacheinfo"
,
{
cache_info
:
{
allowNull
:
false
,
type
:
DataTypes
.
JSON
},
},
{
paranoid
:
false
,
//假的删除
underscored
:
true
,
version
:
true
,
freezeTableName
:
true
,
//freezeTableName: true,
// define the table's name
tableName
:
'cache_information'
,
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/db/models/delivery/company.js
0 → 100644
View file @
4acbe409
const
system
=
require
(
"../../../system"
);
const
settings
=
require
(
"../../../../config/settings"
);
const
appconfig
=
system
.
getSysConfig
();
/**
* 公司主体表
*/
module
.
exports
=
(
db
,
DataTypes
)
=>
{
return
db
.
define
(
"company"
,
{
name
:
{
allowNull
:
false
,
type
:
DataTypes
.
STRING
},
enterpriseCode
:
{
allowNull
:
false
,
type
:
DataTypes
.
STRING
},
type
:
{
allowNull
:
false
,
type
:
DataTypes
.
STRING
},
createdAt
:
{
allowNull
:
false
,
type
:
DataTypes
.
DATE
},
legalRepresentative
:
{
allowNull
:
false
,
type
:
DataTypes
.
STRING
},
businessTerm
:
{
allowNull
:
false
,
type
:
DataTypes
.
STRING
},
registeredCapital
:
{
allowNull
:
false
,
type
:
DataTypes
.
STRING
},
address
:
{
allowNull
:
false
,
type
:
DataTypes
.
STRING
},
lastContactInfo
:
{
allowNull
:
false
,
type
:
DataTypes
.
JSON
},
firstBuyTime
:
{
allowNull
:
false
,
type
:
DataTypes
.
DATE
}
},
{
paranoid
:
false
,
//假的删除
underscored
:
true
,
version
:
true
,
freezeTableName
:
true
,
//freezeTableName: true,
// define the table's name
tableName
:
'company'
,
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/db/models/delivery/delivery_bill.js
View file @
4acbe409
...
...
@@ -5,7 +5,7 @@ const appconfig = system.getSysConfig();
* 交付单表
*/
module
.
exports
=
(
db
,
DataTypes
)
=>
{
return
db
.
define
(
"deliver
ybill
"
,
{
return
db
.
define
(
"deliver"
,
{
delivery_code
:
{
//交付单编号
allowNull
:
true
,
type
:
DataTypes
.
STRING
...
...
icp-deliver/app/base/db/models/delivery/meterials_info.js
0 → 100644
View file @
4acbe409
const
system
=
require
(
"../../../system"
);
const
settings
=
require
(
"../../../../config/settings"
);
const
appconfig
=
system
.
getSysConfig
();
/**
* 材料表
*/
module
.
exports
=
(
db
,
DataTypes
)
=>
{
return
db
.
define
(
"material"
,
{
proposerInfo
:
{
allowNull
:
false
,
type
:
DataTypes
.
JSON
},
shareholderData
:
{
allowNull
:
false
,
type
:
DataTypes
.
JSON
},
implementationPlanInfo
:
{
allowNull
:
false
,
type
:
DataTypes
.
JSON
},
safetyInfo
:
{
allowNull
:
false
,
type
:
DataTypes
.
JSON
},
otherMaterialsInfo
:
{
allowNull
:
false
,
type
:
DataTypes
.
JSON
}
},
{
paranoid
:
false
,
//假的删除
underscored
:
true
,
version
:
true
,
freezeTableName
:
true
,
//freezeTableName: true,
// define the table's name
tableName
:
'materials_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/delivery/deliverSve.js
0 → 100644
View file @
4acbe409
const
system
=
require
(
"../../../system"
);
const
ServiceBase
=
require
(
"../../sve.base"
);
const
settings
=
require
(
"../../../../config/settings"
);
const
moment
=
require
(
"moment"
);
class
DeliverService
extends
ServiceBase
{
constructor
()
{
super
(
"delivery"
,
ServiceBase
.
getDaoName
(
DeliverService
));
this
.
cacheinfoDao
=
system
.
getObject
(
"db.delivery.cacheinfoDao"
);
this
.
companyDao
=
system
.
getObject
(
"db.delivery.companyDao"
);
this
.
materialDao
=
system
.
getObject
(
"db.delivery.materialDao"
);
this
.
statuslogDao
=
system
.
getObject
(
"db.bizchance.statuslogDao"
);
}
async
temporarySave
(
pobj
)
{
const
deliverData
=
await
this
.
dao
.
findOne
({
id
:
pobj
.
deliver_id
})
if
(
!
deliverData
)
{
throw
new
Error
(
"没有关联的交付单"
);
}
let
result
=
await
this
.
cacheinfoDao
.
createOrUpdate
(
pobj
);
return
result
;
}
async
findTemporary
(
pobj
)
{
return
this
.
cacheinfoDao
.
findOne
({
deliver_id
:
pobj
.
deliver_id
});
}
async
submitMaterials
(
pobj
)
{
/**
* 1.此状态下是否可以提交材料
* 2.同步暂存数据表
* 3.存储到材料表
* 4.提取 公司主体信息 存储到公司表
* 5.TODO:公司表 与 交付单 表 关联
* 6.更改 交付单流转状态
* 7.推送到腾讯
*/
const
deliverData
=
await
this
.
dao
.
findOne
({
id
:
pobj
.
deliver_id
});
if
(
!
deliverData
||
!
[
system
.
SERVERSESTATUS
.
COLLECTING
,
system
.
SERVERSESTATUS
.
SUBMITING
,
system
.
SERVERSESTATUS
.
DISPOSEING
].
includes
(
deliverData
.
delivery_status
))
{
throw
new
Error
(
"此交付单不可提交材料"
);
}
return
this
.
db
.
transaction
(
async
(
t
)
=>
{
await
this
.
materialDao
.
createOrUpdate
(
pobj
,
t
);
await
this
.
cacheinfoDao
.
createOrUpdate
(
pobj
,
t
);
if
(
deliverData
.
delivery_status
===
system
.
SERVERSESTATUS
.
COLLECTING
)
{
await
this
.
dao
.
updateByWhere
({
delivery_status
:
system
.
SERVERSESTATUS
.
SUBMITING
},
{
id
:
pobj
.
deliver_id
},
t
);
this
.
statuslogDao
.
create
({
flow_type
:
system
.
FLOWCODE
.
DELIVERY
,
flow_id
:
pobj
.
deliver_id
,
status_code
:
system
.
SERVERSESTATUS
.
SUBMITING
});
}
await
this
.
companyDao
.
createOrUpdate
({
...
pobj
.
cache_info
.
proposerInfo
.
businessLicense
,
lastContactInfo
:
pobj
.
cache_info
.
proposerInfo
.
contactInfo
,
firstBuyTime
:
deliverData
.
created_at
},
t
);
return
"SUCCESS"
});
}
}
module
.
exports
=
DeliverService
;
icp-deliver/app/base/system.js
View file @
4acbe409
...
...
@@ -308,7 +308,13 @@ System.SCHEMESTATUS = {
// 服务单状态
System
.
SERVERSESTATUS
=
{
RECEIVED
:
"received"
,
//已接单
COLLECTING
:
"collecting"
,
//收集材料中
SUBMITING
:
"submiting"
,
//递交材料中
DISPOSEING
:
"disposeing"
,
//工信部处理中
POSTING
:
"posting"
,
//证书已邮寄
SUCCESS
:
"success"
,
//服务已完成
CLOSED
:
"closed"
//已关闭
}
/*
...
...
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