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
75c160a2
Commit
75c160a2
authored
Aug 27, 2020
by
钟占达
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
notifyServiceStatusChange
parent
05f5376d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
94 additions
and
7 deletions
+94
-7
tx-fi-tax/app/base/controller/impl/bizchance/deliverybillCtl.js
+94
-7
No files found.
tx-fi-tax/app/base/controller/impl/bizchance/deliverybillCtl.js
View file @
75c160a2
...
@@ -6,10 +6,16 @@ const CtlBase = require("../../ctl.base");
...
@@ -6,10 +6,16 @@ const CtlBase = require("../../ctl.base");
const
moment
=
require
(
'moment'
);
const
moment
=
require
(
'moment'
);
const
System
=
require
(
"../../../system"
);
const
System
=
require
(
"../../../system"
);
const
appconfig
=
system
.
getSysConfig
();
const
appconfig
=
system
.
getSysConfig
();
const
sha235
=
require
(
"sha256"
);
const
{
getResult
}
=
require
(
"../../../system"
);
class
DeliverybillCtl
extends
CtlBase
{
class
DeliverybillCtl
extends
CtlBase
{
constructor
()
{
constructor
()
{
super
(
"bizchance"
,
CtlBase
.
getServiceName
(
DeliverybillCtl
));
super
(
"bizchance"
,
CtlBase
.
getServiceName
(
DeliverybillCtl
));
this
.
logService
=
system
.
getObject
(
"service.bizchance.statuslogSve"
);
this
.
logService
=
system
.
getObject
(
"service.bizchance.statuslogSve"
);
// this.icUrl = setting.icUrl() + "/web/bizchance";
this
.
userService
=
system
.
getObject
(
"service.auth.userService"
);
this
.
msgService
=
system
.
getObject
(
"service.msg.msgSve"
);
this
.
cacheManager
=
system
.
getObject
(
"db.common.cacheManager"
);
}
}
/**
/**
...
@@ -214,16 +220,97 @@ class DeliverybillCtl extends CtlBase {
...
@@ -214,16 +220,97 @@ class DeliverybillCtl extends CtlBase {
return
system
.
getResult
(
null
,
err
.
message
)
return
system
.
getResult
(
null
,
err
.
message
)
}
}
}
}
async
notifyServiceStatusChange
(
pobj
,
qobj
,
req
)
{
let
ab
=
pobj
.
actionBody
;
if
(
!
ab
.
requestId
||
ab
.
requestId
==
"undefined"
)
{
return
system
.
getResultFail
(
-
1
,
"请求id不能为空"
);
}
if
(
!
ab
.
bizId
||
ab
.
bizId
==
"undefined"
)
{
return
system
.
getResultFail
(
-
1
,
"服务实例编号不能为空"
);
}
if
(
!
ab
.
status
||
ab
.
status
==
"undefined"
)
{
return
system
.
getResultFail
(
-
1
,
"服务状态不能为空"
);
}
try
{
let
cacheStr
=
sha235
(
JSON
.
stringify
(
ab
));
let
cacheInfo
=
await
this
.
cacheManager
[
"TxCache"
].
getCache
(
cacheStr
);
if
(
cacheInfo
&&
cacheInfo
!==
"undefined"
)
{
return
{
"status"
:
1
,
"msg"
:
"已处理成功"
,
"data"
:
cacheInfo
,
"requestId"
:
ab
.
requestId
,
};
}
else
{
// 变更服务状态
let
whereObj
=
{
biz_id
:
ab
.
bizId
};
let
rtn
=
await
this
.
service
.
findOne
(
whereObj
);
if
(
!
rtn
)
{
return
system
.
getResultFail
(
-
1
,
"未知服务信息"
);
}
let
deliveryInfo
=
{};
Object
.
assign
(
deliveryInfo
,
rtn
.
delivery_info
,
{
"serviceStartTime"
:
ab
.
serviceStartTime
,
"serviceEndTime"
:
ab
.
serviceEndTime
,
});
let
upObj
=
{
delivery_status
:
ab
.
status
,
delivery_info
:
deliveryInfo
,
};
await
rtn
.
update
(
upObj
,
{
where
:
whereObj
});
// 通知业务人员服务状态已变更
// TODO: 怎么获取业务人员
// let salesmanId = rtn.salesman_id;
// TODO: 通知信息格式
// 通知信息
// let msg = {
// "title": "",
// "content": "",
// "sender": "",
// "sender_id": 0,
// "msgType": "",
// "target": {
// },
// };
// await this.msgService.create(msg);
// 将变更结果插入到redis中
await
this
.
cacheManager
[
"TxCache"
].
cache
(
cacheStr
,
JSON
.
stringify
(
rtn
),
180
);
// console.log("================= test ==================\n")
return
{
"status"
:
1
,
"msg"
:
"处理成功"
,
"data"
:
rtn
,
"requestId"
:
ab
.
requestId
,
};
}
}
catch
(
err
)
{
return
system
.
getResultError
(
err
);
}
}
}
}
module
.
exports
=
DeliverybillCtl
;
module
.
exports
=
DeliverybillCtl
;
// var task = new DeliverybillCtl();
var
task
=
new
DeliverybillCtl
();
// var obj={
var
obj
=
{
// "deliverId":"1111111"
"requestId"
:
"1111111"
,
// }
"bizId"
:
2592748677
,
// task.deliverInfo(obj,{},{}).then(d=>{
"status"
:
"inservice"
,
// console.log(JSON.stringify(d));
"serviceStartTime"
:
"today"
,
// })
"serviceEndTime"
:
"tomorrow"
,
}
task
.
notifyServiceStatusChange
({
actionBody
:
obj
},{},{}).
then
(
d
=>
{
console
.
log
(
JSON
.
stringify
(
d
));
})
// (async () => {
// (async () => {
// var task = new DeliverybillCtl();
// var task = new DeliverybillCtl();
...
...
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