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
b0da6c73
Commit
b0da6c73
authored
Aug 25, 2020
by
王勇飞
Browse files
Options
Browse Files
Download
Plain Diff
gyq
parents
a1db065d
4fdb1a83
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
137 additions
and
66 deletions
+137
-66
tx-fi-tax/app/base/controller/impl/bizchance/deliverybillCtl.js
+137
-66
No files found.
tx-fi-tax/app/base/controller/impl/bizchance/deliverybillCtl.js
View file @
b0da6c73
var
system
=
require
(
"../../../system"
);
const
http
=
require
(
"http"
);
const
querystring
=
require
(
'querystring'
);
const
sha235
=
require
(
"sha256"
);
var
settings
=
require
(
"../../../../config/settings"
);
const
CtlBase
=
require
(
"../../ctl.base"
);
const
moment
=
require
(
'moment'
);
...
...
@@ -142,93 +143,142 @@ class DeliverybillCtl extends CtlBase {
}
}
// 创建服务实例
async
insertInfo
(
p
obj
,
qobj
,
req
)
{
// 创建
融易算
服务实例
async
insertInfo
(
obj
,
qobj
,
req
)
{
try
{
var
pobj
=
obj
.
actionBody
.
messageBody
;
var
cachestr
=
sha235
(
JSON
.
stringify
(
pobj
));
var
cacheInfo
=
await
this
.
cacheManager
[
"TxCache"
].
getCache
(
cachestr
);
if
(
cacheInfo
&&
cacheInfo
!=
'undefined'
)
{
return
{
"status"
:
1
,
//1代表成功,否则失败
"status"
:
1
,
//1代表成功,否则失败
"msg"
:
"已处理成功!"
,
"data"
:
""
,
"requestId"
:
""
}
}
else
{
}
else
{
// 检验各项必传参数
if
(
pobj
.
acrequestId
&&
pobj
.
requestId
!=
'undefined'
&&
pobj
.
bizId
&&
pobj
.
bizId
!=
'undefined'
&&
pobj
.
contactsPhone
&&
pobj
.
contactsPhone
!=
'undefined'
&&
pobj
.
userId
&&
pobj
.
userId
!=
'undefined'
&&
pobj
.
orderId
&&
pobj
.
orderId
!=
'undefined'
&&
pobj
.
areaType
&&
pobj
.
areaType
!=
'undefined'
&&
pobj
.
area
&&
pobj
.
area
!=
'undefined'
&&
pobj
.
topOrgCode
&&
pobj
.
topOrgCode
!=
'undefined'
&&
pobj
.
taxpayerType
&&
pobj
.
taxpayerType
!=
'undefined'
&&
pobj
.
product_code
&&
pobj
.
product_code
!=
'undefined'
&&
pobj
.
product_name
&&
pobj
.
product_name
!=
'undefined'
&&
pobj
.
service_address
&&
pobj
.
service_address
!=
'undefined'
&&
pobj
.
delivery_status
&&
pobj
.
delivery_status
!=
'undefined'
&&
pobj
.
facilitator_id
&&
pobj
.
facilitator_id
!=
'undefined'
)
{
var
buInfo
=
await
this
.
service
.
insertInfo
(
pobj
);
if
(
buInfo
){
await
this
.
cacheManager
[
"TxCache"
].
cache
(
cachestr
,
JSON
.
stringify
({
cachestr
:
cachestr
}),
180
);
//插入redis缓存
return
{
"status"
:
1
,
//1代表成功,否则失败
"msg"
:
"处理成功!"
,
"data"
:
buInfo
,
"requestId"
:
""
}
}
else
{
return
system
.
getResultError
(
"参数错误!"
);
if
(
!
pobj
.
requestId
||
pobj
.
requestId
==
'undefined'
)
{
throw
new
Error
(
"requestId 不能为空"
);
}
if
(
!
pobj
.
bizId
||
pobj
.
bizId
==
'undefined'
)
{
throw
new
Error
(
"bizId 不能为空"
);
}
if
(
!
pobj
.
contactsPhone
||
pobj
.
contactsPhone
==
'undefined'
)
{
throw
new
Error
(
"contactsPhone 不能为空"
);
}
if
(
!
pobj
.
userId
||
pobj
.
userId
==
'undefined'
)
{
throw
new
Error
(
"userId 不能为空"
);
}
if
(
!
pobj
.
orderId
||
pobj
.
orderId
==
'undefined'
)
{
throw
new
Error
(
"orderId 不能为空"
);
}
if
(
!
pobj
.
areatype
||
pobj
.
areatype
==
'undefined'
)
{
throw
new
Error
(
"areatype 不能为空"
);
}
if
(
!
pobj
.
area
||
pobj
.
area
==
'undefined'
)
{
throw
new
Error
(
"area 不能为空"
);
}
if
(
!
pobj
.
topOrgCode
||
pobj
.
topOrgCode
==
'undefined'
)
{
throw
new
Error
(
"topOrgCode 不能为空"
);
}
if
(
!
pobj
.
taxpayerType
||
pobj
.
taxpayerType
==
'undefined'
)
{
throw
new
Error
(
"taxpayerType 不能为空"
);
}
if
(
!
pobj
.
product_code
||
pobj
.
product_code
==
'undefined'
)
{
throw
new
Error
(
"product_code 不能为空"
);
}
if
(
!
pobj
.
product_name
||
pobj
.
product_name
==
'undefined'
)
{
throw
new
Error
(
"product_name 不能为空"
);
}
if
(
!
pobj
.
service_address
||
pobj
.
service_address
==
'undefined'
)
{
throw
new
Error
(
"service_address 不能为空"
);
}
if
(
!
pobj
.
delivery_status
||
pobj
.
delivery_status
==
'undefined'
)
{
throw
new
Error
(
"delivery_status 不能为空"
);
}
if
(
!
pobj
.
facilitator_id
||
pobj
.
delivery_status
==
'undefined'
)
{
throw
new
Error
(
"delivery_status 不能为空"
);
}
var
buInfo
=
await
this
.
service
.
insertInfo
(
pobj
);
if
(
buInfo
)
{
await
this
.
cacheManager
[
"TxCache"
].
cache
(
cachestr
,
JSON
.
stringify
({
cachestr
:
cachestr
}),
180
);
//插入redis缓存
return
{
"status"
:
1
,
//1代表成功,否则失败
"msg"
:
"处理成功!"
,
"data"
:
buInfo
,
"requestId"
:
""
}
}
else
{
return
system
.
getResult
Error
(
"参数错误!"
);
return
system
.
getResult
Fail
(
buInfo
);
}
}
}
catch
(
err
or
)
{
return
system
.
getResult
Error
(
error
);
catch
(
err
)
{
return
system
.
getResult
(
null
,
err
.
message
)
}
}
async
updateServer
(
pobj
,
qobj
,
req
)
{
// 更新融易算服务实例
async
updateServer
(
obj
,
qobj
,
req
)
{
try
{
if
(
!
pobj
.
requestId
||
pobj
.
requestId
==
'undefined'
)
{
throw
new
Error
(
"requestId 不能为空"
);
}
if
(
!
pobj
.
bizId
||
pobj
.
bizId
==
'undefined'
)
{
throw
new
Error
(
"bizId 不能为空"
);
}
if
(
!
pobj
.
orderId
||
pobj
.
orderId
==
'undefined'
)
{
throw
new
Error
(
"orderId 不能为空"
);
}
if
(
!
pobj
.
topOrgCode
||
pobj
.
topOrgCode
==
'undefined'
)
{
throw
new
Error
(
"topOrgCode 不能为空"
);
}
if
(
!
pobj
.
companyName
||
pobj
.
companyName
==
'undefined'
)
{
throw
new
Error
(
"companyName 不能为空"
);
}
if
(
!
pobj
.
contactName
||
pobj
.
contactName
==
'undefined'
)
{
throw
new
Error
(
"contactName 不能为空"
);
}
if
(
!
pobj
.
companyBizType
||
pobj
.
companyBizType
==
'undefined'
)
{
throw
new
Error
(
"companyBizType 不能为空"
);
}
if
(
!
pobj
.
uscc
||
pobj
.
uscc
==
'undefined'
)
{
throw
new
Error
(
"uscc 不能为空"
);
var
pobj
=
obj
.
actionBody
.
messageBody
;
var
cachestr
=
sha235
(
JSON
.
stringify
(
pobj
));
var
cacheInfo
=
await
this
.
cacheManager
[
"TxCache"
].
getCache
(
cachestr
);
var
cacheInfo
;
if
(
cacheInfo
&&
cacheInfo
!=
'undefined'
)
{
return
{
"status"
:
1
,
//1代表成功,否则失败
"msg"
:
"已处理成功!"
,
"data"
:
""
,
"requestId"
:
""
}
}
else
{
if
(
!
pobj
.
requestId
||
pobj
.
requestId
==
'undefined'
)
{
throw
new
Error
(
"requestId 不能为空"
);
}
if
(
!
pobj
.
bizId
||
pobj
.
bizId
==
'undefined'
)
{
throw
new
Error
(
"bizId 不能为空"
);
}
if
(
!
pobj
.
orderId
||
pobj
.
orderId
==
'undefined'
)
{
throw
new
Error
(
"orderId 不能为空"
);
}
if
(
!
pobj
.
topOrgCode
||
pobj
.
topOrgCode
==
'undefined'
)
{
throw
new
Error
(
"topOrgCode 不能为空"
);
}
if
(
!
pobj
.
companyName
||
pobj
.
companyName
==
'undefined'
)
{
throw
new
Error
(
"companyName 不能为空"
);
}
if
(
!
pobj
.
contactName
||
pobj
.
contactName
==
'undefined'
)
{
throw
new
Error
(
"contactName 不能为空"
);
}
if
(
!
pobj
.
companyBizType
||
pobj
.
companyBizType
==
'undefined'
)
{
throw
new
Error
(
"companyBizType 不能为空"
);
}
if
(
!
pobj
.
uscc
||
pobj
.
uscc
==
'undefined'
)
{
throw
new
Error
(
"uscc 不能为空"
);
}
const
rs
=
await
this
.
service
.
updateServer
(
pobj
);
if
(
rs
)
{
await
this
.
cacheManager
[
"TxCache"
].
cache
(
cachestr
,
JSON
.
stringify
({
cachestr
:
cachestr
}),
180
);
//插入redis缓存
return
{
"status"
:
1
,
//1代表成功,否则失败
"msg"
:
"处理成功!"
,
"data"
:
rs
,
"requestId"
:
""
}
}
else
{
return
system
.
getResultFail
(
rs
);
}
}
const
rs
=
await
this
.
service
.
updateServer
(
pobj
);
return
system
.
getResult
(
rs
);
}
catch
(
err
)
{
}
catch
(
err
)
{
return
system
.
getResult
(
null
,
err
.
message
)
}
}
//根据bizId查询deliverybill表中的所有信息
async
getInfo
(
pobj
,
qobj
,
req
)
{
try
{
...
...
@@ -246,10 +296,31 @@ class DeliverybillCtl extends CtlBase {
module
.
exports
=
DeliverybillCtl
;
// var task = new DeliverybillCtl();
// var obj={
// "deliverId":"1111111"
// var obj = {
// "actionType": "produceData",
// "actionBody": {
// "pushUrl": "http://ic.com:8000/web/bizchance/deliverybillCtl",
// "actionType": "insertInfo",
// "identifyCode": "book-manage",
// "messageBody": {
// "requestId": "825da0a74432-738f-4bed-b48d-d51aa808",
// "bizId": "5892748825",
// "contactsPhone": "18510669321",
// "userId": "10973452443103825",
// "orderId": "341184456620496_book",
// "areatype": "city",
// "area": "100010",
// "topOrgCode": "rong_yi_suan",
// "taxpayerType": 1,
// "product_code": "bookkeeping",
// "product_name": "代账服务",
// "service_address": "110100",
// "delivery_status": "waituserconfirm",
// "facilitator_id": "10"
// }
// }
// }
// task.
deliverInfo(obj,{},{}).then(d=>
{
// task.
insertInfo(obj, {}, {}).then(d =>
{
// console.log(JSON.stringify(d));
// })
...
...
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