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
e3954def
Commit
e3954def
authored
Mar 03, 2021
by
任晓松
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
13908b24
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
273 additions
and
10 deletions
+273
-10
center-order/app/base/api/impl/action/opNeed.js
+3
-0
center-order/app/base/api/impl/task/taskAction.js
+131
-10
center-order/app/base/db/impl/dbneed/needinfoDao.js
+46
-0
center-order/app/base/db/impl/dbneed/needinfofqDao.js
+35
-0
center-order/app/base/db/models/dbneed/needinfofq.js
+37
-0
center-order/app/base/service/impl/dbneed/opneedinfoSve.js
+21
-0
No files found.
center-order/app/base/api/impl/action/opNeed.js
View file @
e3954def
...
...
@@ -60,6 +60,9 @@ class IcAPI extends APIBase {
case
"getNeedComparisonList"
:
opResult
=
await
this
.
opNeedInfoSve
.
getNeedComparisonList
(
pobj
,
pobj
.
actionBody
);
break
;
case
"updateNeedPushStatus"
:
opResult
=
await
this
.
opNeedInfoSve
.
updateNeedPushStatus
(
pobj
.
actionBody
);
break
;
default
:
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
break
;
...
...
center-order/app/base/api/impl/task/taskAction.js
View file @
e3954def
...
...
@@ -6,18 +6,139 @@ class TaskAction extends APIBase {
super
();
this
.
orderinfoSve
=
system
.
getObject
(
"service.dbcorder.orderinfoSve"
);
}
/**
* 接口跳转-POST请求
* action_process 执行的流程
* action_type 执行的类型
* action_body 执行的参数
*/
async
taskNeed
(
pobj
,
qobj
,
req
)
{
if
(
!
pobj
.
actionType
)
{
return
system
.
getResult
(
null
,
"actionType参数不能为空"
);
* 同步蜂擎需求商机
* @returns {Promise<void>}
*/
async
taskNeed
()
{
//获取 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
;
}
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
);
}
}
var
result
=
await
this
.
opActionProcess
(
pobj
,
pobj
.
actionType
,
req
);
return
result
;
return
system
.
getResult
(
updateRet
)
}
}
...
...
center-order/app/base/db/impl/dbneed/needinfoDao.js
View file @
e3954def
const
system
=
require
(
"../../../system"
);
const
Dao
=
require
(
"../../dao.base"
);
const
{
Op
}
=
require
(
"sequelize"
);
class
NeedinfoDao
extends
Dao
{
constructor
()
{
super
(
Dao
.
getModelName
(
NeedinfoDao
));
...
...
@@ -72,5 +73,50 @@ class NeedinfoDao extends Dao {
raw
:
true
});
}
/**
* 根据ids 获取需求
* @param ids
* @returns {Promise<void>}
*/
async
getNeedsByIds
(
ids
){
let
needs
=
await
this
.
findAll
({
where
:
{
channelNeedNo
:
{
[
Op
.
in
]:
ids
}
}
})
return
needs
;
}
/**
* 批量更新
* @param needs
* @returns {Promise<Array<Model>|*>}
*/
async
bulkUpdate
(
needs
){
let
result
=
await
this
.
bulkCreate
(
needs
,{
fields
:[
"id"
,
"status"
,
"statusName"
]
,
updateOnDuplicate
:
[
"status"
,
"statusName"
]
});
return
result
;
}
/**
* 批量更新
* @param needs
* @returns {Promise<Array<Model>|*>}
*/
async
bulkUpdateStatus
(
status
,
statusName
,
ids
){
let
result
=
await
this
.
updateByWhere
({
status
:
status
,
statusName
:
statusName
},{
where
:
{
channelNeedNo
:{
[
Op
.
in
]:
ids
}
}
});
return
result
;
}
}
module
.
exports
=
NeedinfoDao
;
center-order/app/base/db/impl/dbneed/needinfofqDao.js
0 → 100644
View file @
e3954def
const
system
=
require
(
"../../../system"
);
const
Dao
=
require
(
"../../dao.base"
);
const
{
Op
}
=
require
(
"sequelize"
);
class
NeedinfofqDao
extends
Dao
{
constructor
()
{
super
(
Dao
.
getModelName
(
NeedinfofqDao
));
}
async
getAllNeeds
(){
let
fqNeeds
=
await
this
.
findAll
({
where
:
{
handleStatus
:
0
},
limit
:
300
})
return
fqNeeds
;
}
/**
* 批量更新
* @param needs
* @returns {Promise<Array<Model>|*>}
*/
async
bulkUpdate
(
ids
){
let
result
=
await
this
.
updateByWhere
({
handleStatus
:
1
},{
where
:
{
channelNeedNo
:{
[
Op
.
in
]:
ids
}
}
});
return
result
;
}
}
module
.
exports
=
NeedinfofqDao
;
center-order/app/base/db/models/dbneed/needinfofq.js
0 → 100644
View file @
e3954def
const
system
=
require
(
"../../../system"
);
const
settings
=
require
(
"../../../../config/settings"
);
const
uiconfig
=
system
.
getUiConfig2
(
settings
.
appKey
);
module
.
exports
=
(
db
,
DataTypes
)
=>
{
return
db
.
define
(
"needinfofq"
,
{
sourceCode
:
DataTypes
.
STRING
(
128
),
//来源code )idempotent_source
channelNeedNo
:
DataTypes
.
STRING
(
128
),
//渠道需求号(页面中列表中显示该需求号)
publishContent
:
DataTypes
.
STRING
,
//发布内容
publishMobile
:
DataTypes
.
STRING
,
//发布者手机号
followContent
:
DataTypes
.
JSON
,
//跟进内容
notes
:
DataTypes
.
STRING
,
//备注
disposeNotes
:
DataTypes
.
STRING
,
//处理的备注
statusName
:
DataTypes
.
STRING
,
status
:
DataTypes
.
INTEGER
,
city
:
DataTypes
.
STRING
(
50
),
// 城市
province
:
DataTypes
.
STRING
(
50
),
// 省份
typeCode
:
DataTypes
.
STRING
(
50
),
//产品类型编码',
typeName
:
DataTypes
.
STRING
(
50
),
//类型产品名称',
channelTypeCode
:
DataTypes
.
STRING
(
50
),
//渠道产品类型编码',
channelTypeName
:
DataTypes
.
STRING
(
255
),
//渠道产品类型名称',
handleStatus
:
DataTypes
.
INTEGER
//处理状态,0否,1是
},
{
paranoid
:
true
,
//假的删除
underscored
:
true
,
version
:
true
,
freezeTableName
:
true
,
//freezeTableName: true,
// define the table's name
tableName
:
'n_need_info_fq'
,
validate
:
{
},
indexes
:
[
]
});
}
center-order/app/base/service/impl/dbneed/opneedinfoSve.js
View file @
e3954def
...
...
@@ -373,6 +373,27 @@ class NeedinfoService extends ServiceBase {
}
return
system
.
getResult
(
data
);
}
/**
* 修改需求商机推送状态
* @param actionBody
* @returns {Promise<void>}
*/
async
updateNeedPushStatus
(
actionBody
)
{
let
channelNeedNo
=
actionBody
.
intentionBizId
;
let
setObj
=
{
status
:
'yts'
,
statusName
:
"已推送"
}
let
whereObj
=
{
where
:
{
channelNeedNo
:
channelNeedNo
}
}
if
(
channelNeedNo
)
{
this
.
dao
.
updateByWhere
(
setObj
,
whereObj
);
}
return
system
.
getResultSuccess
();
}
}
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