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
e66d70cf
Commit
e66d70cf
authored
Mar 04, 2021
by
任晓松
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
2ef8835a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
148 additions
and
133 deletions
+148
-133
center-order/app/base/api/impl/task/taskAction.js
+9
-132
center-order/app/base/db/impl/dbneed/needinfofqDao.js
+1
-0
center-order/app/base/service/impl/dbcorder/orderinfoSve.js
+1
-1
center-order/app/base/service/impl/dbneed/opneedinfoSve.js
+137
-0
No files found.
center-order/app/base/api/impl/task/taskAction.js
View file @
e66d70cf
...
@@ -5,140 +5,17 @@ class TaskAction extends APIBase {
...
@@ -5,140 +5,17 @@ class TaskAction extends APIBase {
constructor
()
{
constructor
()
{
super
();
super
();
this
.
orderinfoSve
=
system
.
getObject
(
"service.dbcorder.orderinfoSve"
);
this
.
orderinfoSve
=
system
.
getObject
(
"service.dbcorder.orderinfoSve"
);
this
.
opneedinfoSve
=
system
.
getObject
(
"service.dbneed.opneedinfoSve"
);
}
}
/**
/**
* 同步蜂擎需求商机
* 接口跳转-POST请求
* @returns {Promise<void>}
* action_process 执行的流程
*/
* action_type 执行的类型
async
taskNeed
()
{
* action_body 执行的参数
//获取 need_info_fq 未处理的需求
*/
let
fqNeeds
=
await
this
.
needinfofqDao
.
getAllNeeds
()
async
taskNeed
(
pobj
,
qobj
,
req
)
{
let
ids
=
[];
var
result
=
await
this
.
opneedinfoSve
.
syncNeedBusiness
();
let
needDict
=
{};
return
result
;
for
(
let
i
=
0
;
i
<
fqNeeds
.
length
;
i
++
)
{
ids
.
push
(
fqNeeds
[
i
].
channelNeedNo
);
needDict
[
fqNeeds
[
i
].
channelNeedNo
]
=
fqNeeds
[
i
].
status
;
}
//根据ids 获取企服通需求
let
needs
=
await
this
.
needinfoDao
.
getNeedsByIds
(
ids
);
let
setObj
=
[];
let
existIds
=
[];
let
ids1
=
[];
let
ids2
=
[];
let
ids3
=
[];
//已经存在的需求,更改状态
for
(
let
i
=
0
;
i
<
needs
.
length
;
i
++
){
let
need
=
needs
[
i
];
let
obj
=
{
id
:
need
.
id
,
}
if
(
needDict
[
need
.
channelNeedNo
]
==
1
){
obj
.
status
=
'ygj'
;
obj
.
statusName
=
'已跟进'
;
ids1
.
push
(
need
.
channelNeedNo
);
}
if
(
needDict
[
need
.
channelNeedNo
]
==
2
){
obj
.
status
=
'ygb'
;
obj
.
statusName
=
'已关闭'
;
ids2
.
push
(
need
.
channelNeedNo
);
}
if
(
needDict
[
need
.
channelNeedNo
]
==
3
){
obj
.
status
=
'ycd'
;
obj
.
statusName
=
'已成单'
;
ids3
.
push
(
need
.
channelNeedNo
);
}
setObj
.
push
(
obj
);
existIds
.
push
(
need
.
channelNeedNo
);
}
// 不存在的订单 添加到企服通
let
createObj
=
[];
let
setFqObj1
=
[];
let
setFqObj2
=
[];
for
(
let
i
=
0
;
i
<
fqNeeds
.
length
;
i
++
){
let
fqNeed
=
fqNeeds
[
i
];
if
(
!
existIds
.
includes
(
fqNeed
.
channelNeedNo
)){
let
obj
=
{
channelNeedNo
:
fqNeed
.
channelNeedNo
,
city
:
fqNeed
.
city
,
province
:
fqNeed
.
province
,
publishContent
:
fqNeed
.
publishContent
,
publishMobile
:
fqNeed
.
publishMobile
,
notes
:
fqNeed
.
notes
,
followContent
:
fqNeed
.
followContent
,
disposeNotes
:
fqNeed
.
disposeNotes
,
typeCode
:
fqNeed
.
typeCode
,
created_at
:
fqNeed
.
created_at
}
if
(
fqNeed
.
status
==
1
){
obj
.
status
=
'ygj'
;
obj
.
statusName
=
'已跟进'
;
}
if
(
fqNeed
.
status
==
2
){
obj
.
status
=
'ygb'
;
obj
.
statusName
=
'已关闭'
;
}
if
(
fqNeed
.
status
==
3
){
obj
.
status
=
'ycd'
;
obj
.
statusName
=
'已成单'
;
}
if
(
fqNeed
.
status
==
4
||
fqNeed
.
status
==
0
){
obj
.
status
=
'yts'
;
obj
.
statusName
=
'已推送'
;
}
if
([
'360_icp '
,
'360_edi'
,
'360_sbzc'
].
includes
(
fqNeed
.
sourceCode
)){
obj
.
uapp_id
=
50
;
}
if
([
'baidu_edi'
,
'baidu_gsreg'
,
'baidu_icp'
,
'baidu_radiotv'
,
'baidu_wangwen'
].
includes
(
fqNeed
.
sourceCode
)){
obj
.
uapp_id
=
44
;
}
if
([
'edi_ali'
,
'ic_ali'
,
'icp_ali'
,
'tm_ali'
,
'tmd_ali'
].
includes
(
fqNeed
.
sourceCode
)){
obj
.
uapp_id
=
18
;
}
if
([
'youke'
].
includes
(
fqNeed
.
sourceCode
)){
obj
.
uapp_id
=
40
;
}
if
([
'tm_jdyun'
].
includes
(
fqNeed
.
sourceCode
)){
obj
.
uapp_id
=
31
;
}
if
([
'tm_bw'
].
includes
(
fqNeed
.
sourceCode
)){
obj
.
uapp_id
=
35
;
}
if
([
'tm_1688'
].
includes
(
fqNeed
.
sourceCode
)){
obj
.
uapp_id
=
0
;
}
createObj
.
push
(
obj
);
setFqObj2
.
push
(
fqNeed
.
channelNeedNo
);
}
else
{
setFqObj1
.
push
(
fqNeed
.
channelNeedNo
);
}
}
//企服通 批量更新状态
let
updateRet
=
null
;
if
(
setObj
.
length
>
0
){
// updateRet = await this.needinfoDao.bulkUpdate(setObj);
if
(
ids1
.
length
>
0
){
updateRet
=
await
this
.
needinfoDao
.
bulkUpdateStatus
(
'ygj'
,
'已跟进'
,
ids1
);
}
if
(
ids2
.
length
>
0
){
updateRet
=
await
this
.
needinfoDao
.
bulkUpdateStatus
(
'ygb'
,
'已关闭'
,
ids2
);
}
if
(
ids3
.
length
>
0
){
updateRet
=
await
this
.
needinfoDao
.
bulkUpdateStatus
(
'ycd'
,
'已成单'
,
ids3
);
}
if
(
updateRet
.
length
>
0
){
updateRet
=
await
this
.
needinfofqDao
.
bulkUpdate
(
setFqObj1
);
}
}
//企服通 批量添加
if
(
createObj
.
length
>
0
){
updateRet
=
await
this
.
needinfoDao
.
bulkCreate
(
createObj
);
if
(
updateRet
.
length
>
0
){
updateRet
=
await
this
.
needinfofqDao
.
bulkUpdate
(
setFqObj2
);
}
}
return
system
.
getResult
(
updateRet
)
}
}
}
}
...
...
center-order/app/base/db/impl/dbneed/needinfofqDao.js
View file @
e66d70cf
...
@@ -11,6 +11,7 @@ class NeedinfofqDao extends Dao {
...
@@ -11,6 +11,7 @@ class NeedinfofqDao extends Dao {
where
:
{
where
:
{
handleStatus
:
0
handleStatus
:
0
},
},
order
:
[[
"id"
,
"desc"
]],
limit
:
300
limit
:
300
})
})
return
fqNeeds
;
return
fqNeeds
;
...
...
center-order/app/base/service/impl/dbcorder/orderinfoSve.js
View file @
e66d70cf
...
@@ -23,7 +23,7 @@ class OrderInfoService extends ServiceBase {
...
@@ -23,7 +23,7 @@ class OrderInfoService extends ServiceBase {
async
taskSyncOrderStatus
(){
async
taskSyncOrderStatus
(){
let
sql
=
"SELECT * FROM `c_order_info_fq` LIMIT 300"
;
let
sql
=
"SELECT * FROM `c_order_info_fq` LIMIT 300"
;
var
this
.
dao
.
customQuery
(
sql
);
var
result
=
await
this
.
customQuery
(
sql
);
}
}
//--------------------task--------------ednd---------------------
//--------------------task--------------ednd---------------------
...
...
center-order/app/base/service/impl/dbneed/opneedinfoSve.js
View file @
e66d70cf
...
@@ -10,6 +10,7 @@ class NeedinfoService extends ServiceBase {
...
@@ -10,6 +10,7 @@ class NeedinfoService extends ServiceBase {
this
.
needsolutionSve
=
system
.
getObject
(
"service.dbneed.needsolutionSve"
);
this
.
needsolutionSve
=
system
.
getObject
(
"service.dbneed.needsolutionSve"
);
this
.
needsolutionDao
=
system
.
getObject
(
"db.dbneed.needsolutionDao"
);
this
.
needsolutionDao
=
system
.
getObject
(
"db.dbneed.needsolutionDao"
);
this
.
needinfoDao
=
system
.
getObject
(
"db.dbneed.needinfoDao"
);
this
.
needinfoDao
=
system
.
getObject
(
"db.dbneed.needinfoDao"
);
this
.
needinfofqDao
=
system
.
getObject
(
"db.dbneed.needinfofqDao"
);
}
}
async
getItemByNeedNo
(
pobj
)
{
async
getItemByNeedNo
(
pobj
)
{
var
item
=
await
this
.
dao
.
getItemByNeedNo
(
pobj
.
actionBody
.
needNo
);
var
item
=
await
this
.
dao
.
getItemByNeedNo
(
pobj
.
actionBody
.
needNo
);
...
@@ -394,6 +395,142 @@ class NeedinfoService extends ServiceBase {
...
@@ -394,6 +395,142 @@ class NeedinfoService extends ServiceBase {
}
}
return
system
.
getResultSuccess
();
return
system
.
getResultSuccess
();
}
}
/**
* 同步蜂擎需求商机
* @returns {Promise<void>}
*/
async
syncNeedBusiness
()
{
//获取 need_info_fq 未处理的需求
let
fqNeeds
=
await
this
.
needinfofqDao
.
getAllNeeds
()
let
ids
=
[];
let
needDict
=
{};
for
(
let
i
=
0
;
i
<
fqNeeds
.
length
;
i
++
)
{
ids
.
push
(
fqNeeds
[
i
].
channelNeedNo
);
needDict
[
fqNeeds
[
i
].
channelNeedNo
]
=
fqNeeds
[
i
].
status
;
}
//根据ids 获取企服通需求
let
needs
=
await
this
.
needinfoDao
.
getNeedsByIds
(
ids
);
let
setObj
=
[];
let
existIds
=
[];
let
ids1
=
[];
let
ids2
=
[];
let
ids3
=
[];
//已经存在的需求,更改状态
for
(
let
i
=
0
;
i
<
needs
.
length
;
i
++
){
let
need
=
needs
[
i
];
let
obj
=
{
id
:
need
.
id
,
}
if
(
needDict
[
need
.
channelNeedNo
]
==
1
){
obj
.
status
=
'ygj'
;
obj
.
statusName
=
'已跟进'
;
ids1
.
push
(
need
.
channelNeedNo
);
}
if
(
needDict
[
need
.
channelNeedNo
]
==
2
){
obj
.
status
=
'ygb'
;
obj
.
statusName
=
'已关闭'
;
ids2
.
push
(
need
.
channelNeedNo
);
}
if
(
needDict
[
need
.
channelNeedNo
]
==
3
){
obj
.
status
=
'ycd'
;
obj
.
statusName
=
'已成单'
;
ids3
.
push
(
need
.
channelNeedNo
);
}
setObj
.
push
(
obj
);
existIds
.
push
(
need
.
channelNeedNo
);
}
// 不存在的订单 添加到企服通
let
createObj
=
[];
let
setFqObj1
=
[];
let
setFqObj2
=
[];
for
(
let
i
=
0
;
i
<
fqNeeds
.
length
;
i
++
){
let
fqNeed
=
fqNeeds
[
i
];
if
(
!
existIds
.
includes
(
fqNeed
.
channelNeedNo
)){
let
obj
=
{
channelNeedNo
:
fqNeed
.
channelNeedNo
,
city
:
fqNeed
.
city
,
province
:
fqNeed
.
province
,
publishContent
:
fqNeed
.
publishContent
,
publishMobile
:
fqNeed
.
publishMobile
,
notes
:
fqNeed
.
notes
,
followContent
:
fqNeed
.
followContent
,
disposeNotes
:
fqNeed
.
disposeNotes
,
typeCode
:
fqNeed
.
typeCode
,
created_at
:
fqNeed
.
created_at
}
if
(
fqNeed
.
status
==
1
){
obj
.
status
=
'ygj'
;
obj
.
statusName
=
'已跟进'
;
}
if
(
fqNeed
.
status
==
2
){
obj
.
status
=
'ygb'
;
obj
.
statusName
=
'已关闭'
;
}
if
(
fqNeed
.
status
==
3
){
obj
.
status
=
'ycd'
;
obj
.
statusName
=
'已成单'
;
}
if
(
fqNeed
.
status
==
4
||
fqNeed
.
status
==
0
){
obj
.
status
=
'yts'
;
obj
.
statusName
=
'已推送'
;
}
if
([
'360_icp '
,
'360_edi'
,
'360_sbzc'
].
includes
(
fqNeed
.
sourceCode
)){
obj
.
uapp_id
=
50
;
}
if
([
'baidu_edi'
,
'baidu_gsreg'
,
'baidu_icp'
,
'baidu_radiotv'
,
'baidu_wangwen'
].
includes
(
fqNeed
.
sourceCode
)){
obj
.
uapp_id
=
44
;
}
if
([
'edi_ali'
,
'ic_ali'
,
'icp_ali'
,
'tm_ali'
,
'tmd_ali'
].
includes
(
fqNeed
.
sourceCode
)){
obj
.
uapp_id
=
18
;
}
if
([
'youke'
].
includes
(
fqNeed
.
sourceCode
)){
obj
.
uapp_id
=
40
;
}
if
([
'tm_jdyun'
].
includes
(
fqNeed
.
sourceCode
)){
obj
.
uapp_id
=
31
;
}
if
([
'tm_bw'
].
includes
(
fqNeed
.
sourceCode
)){
obj
.
uapp_id
=
35
;
}
if
([
'tm_1688'
].
includes
(
fqNeed
.
sourceCode
)){
obj
.
uapp_id
=
0
;
}
if
(
!
setFqObj2
.
includes
(
fqNeed
.
channelNeedNo
)){
createObj
.
push
(
obj
);
setFqObj2
.
push
(
fqNeed
.
channelNeedNo
);
}
}
else
{
setFqObj1
.
push
(
fqNeed
.
channelNeedNo
);
}
}
//企服通 批量更新状态
let
updateRet
=
null
;
if
(
setObj
.
length
>
0
){
// updateRet = await this.needinfoDao.bulkUpdate(setObj);
if
(
ids1
.
length
>
0
){
updateRet
=
await
this
.
needinfoDao
.
bulkUpdateStatus
(
'ygj'
,
'已跟进'
,
ids1
);
}
if
(
ids2
.
length
>
0
){
updateRet
=
await
this
.
needinfoDao
.
bulkUpdateStatus
(
'ygb'
,
'已关闭'
,
ids2
);
}
if
(
ids3
.
length
>
0
){
updateRet
=
await
this
.
needinfoDao
.
bulkUpdateStatus
(
'ycd'
,
'已成单'
,
ids3
);
}
if
(
updateRet
.
length
>
0
){
updateRet
=
await
this
.
needinfofqDao
.
bulkUpdate
(
setFqObj1
);
}
}
//企服通 批量添加
if
(
createObj
.
length
>
0
){
updateRet
=
await
this
.
needinfoDao
.
bulkCreate
(
createObj
);
if
(
updateRet
.
length
>
0
){
updateRet
=
await
this
.
needinfofqDao
.
bulkUpdate
(
setFqObj2
);
}
}
return
system
.
getResult
(
updateRet
)
}
}
}
module
.
exports
=
NeedinfoService
;
module
.
exports
=
NeedinfoService
;
...
...
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