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
aff47d81
Commit
aff47d81
authored
Nov 10, 2020
by
宋毅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tj
parent
3feac937
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
151 additions
and
147 deletions
+151
-147
center-channel/app/base/service/impl/utilsSve/utilsNeedSve.js
+19
-17
center-channel/app/base/service/impl/utilsSve/utilsNeedSve2.js
+132
-130
No files found.
center-channel/app/base/service/impl/utilsSve/utilsNeedSve.js
View file @
aff47d81
...
...
@@ -60,14 +60,15 @@ class UtilsNeedService extends AppServiceBase {
if
(
pobj
.
actionBody
.
description
&&
pobj
.
actionBody
.
description
.
indexOf
(
"备#"
)
<
0
)
{
pobj
.
actionBody
.
level
=
"A"
;
}
else
{
var
levelurl
=
"http://106.13.228.212:8000/recProbability"
;
var
levelresult
=
await
this
.
restPostUrl
({
intentionBizId
:
pobj
.
actionBody
.
intentionBizId
,
type
:
pobj
.
actionBody
.
type
,
note
:
pobj
.
actionBody
.
description
},
levelurl
);
if
(
levelresult
.
status
==
0
)
{
pobj
.
actionBody
.
level
=
levelresult
.
data
.
level
;
pobj
.
actionBody
.
probability
=
levelresult
.
data
.
per
;
}
else
{
pobj
.
actionBody
.
level
=
"C"
}
// var levelurl = "http://106.13.228.212:8000/recProbability";
// var levelresult = await this.restPostUrl({ intentionBizId: pobj.actionBody.intentionBizId, type: pobj.actionBody.type, note: pobj.actionBody.description }, levelurl);
// if (levelresult.status == 0) {
// pobj.actionBody.level = levelresult.data.level;
// pobj.actionBody.probability = levelresult.data.per;
// } else {
// pobj.actionBody.level = "C"
// }
pobj
.
actionBody
.
level
=
"C"
}
if
(
pobj
.
actionBody
.
phone
==
"17319425791"
)
{
...
...
@@ -106,7 +107,7 @@ class UtilsNeedService extends AppServiceBase {
}
var
self
=
this
;
pobj
.
actionType
=
"receiveIcpFeedback"
;
if
(
pobj
.
actionBody
&&
pobj
.
actionBody
.
intentionStatus
)
{
if
(
pobj
.
actionBody
&&
pobj
.
actionBody
.
intentionStatus
)
{
pobj
.
intentionStatus
=
pobj
.
actionBody
.
intentionStatus
;
}
var
rtn
=
await
this
.
execClient
.
execPost
(
pobj
,
url
);
...
...
@@ -1340,14 +1341,15 @@ class UtilsNeedService extends AppServiceBase {
if
(
pobj
.
actionBody
.
description
&&
pobj
.
actionBody
.
description
.
indexOf
(
"备#"
)
<
0
)
{
pobj
.
actionBody
.
level
=
"A"
;
}
else
{
var
levelurl
=
"http://106.13.228.212:8000/recProbability"
;
var
levelresult
=
await
this
.
restPostUrl
({
intentionBizId
:
pobj
.
actionBody
.
intentionBizId
,
type
:
pobj
.
actionBody
.
type
,
note
:
pobj
.
actionBody
.
description
},
levelurl
);
if
(
levelresult
.
status
==
0
)
{
pobj
.
actionBody
.
level
=
levelresult
.
data
.
level
;
pobj
.
actionBody
.
probability
=
levelresult
.
data
.
per
;
}
else
{
pobj
.
actionBody
.
level
=
"C"
}
// var levelurl = "http://106.13.228.212:8000/recProbability";
// var levelresult = await this.restPostUrl({ intentionBizId: pobj.actionBody.intentionBizId, type: pobj.actionBody.type, note: pobj.actionBody.description }, levelurl);
// if (levelresult.status == 0) {
// pobj.actionBody.level = levelresult.data.level;
// pobj.actionBody.probability = levelresult.data.per;
// } else {
// pobj.actionBody.level = "C"
// }
pobj
.
actionBody
.
level
=
"C"
}
if
(
pobj
.
actionBody
.
phone
==
"17319425791"
)
{
...
...
center-channel/app/base/service/impl/utilsSve/utilsNeedSve2.js
View file @
aff47d81
...
...
@@ -6,8 +6,8 @@ const { json } = require("sequelize");
const
{
getResult
,
getResultSuccess
}
=
require
(
"../../../system"
);
//区分渠道的uappid
const
uappId
=
{
'ali'
:
"18"
,
//(阿里icp、edi)
'baidu'
:
"44"
//(百度icp、edi)
'ali'
:
"18"
,
//(阿里icp、edi)
'baidu'
:
"44"
//(百度icp、edi)
}
//需求操作类----ali对接的需求
class
UtilsNeedService2
extends
AppServiceBase
{
...
...
@@ -35,7 +35,7 @@ class UtilsNeedService2 extends AppServiceBase {
* @param {*} actionBody
*/
async
submitNeed
(
pobj
,
actionBody
)
{
if
(
actionBody
.
type
==
"esp.wangwen"
||
actionBody
.
type
==
"esp.food"
)
{
if
(
actionBody
.
type
==
"esp.wangwen"
||
actionBody
.
type
==
"esp.food"
)
{
actionBody
.
area
=
this
.
wangwenAreaChange
(
actionBody
.
area
)
}
if
(
!
actionBody
.
intentionBizId
)
{
...
...
@@ -69,17 +69,18 @@ class UtilsNeedService2 extends AppServiceBase {
if
(
pobj
.
actionBody
.
description
&&
pobj
.
actionBody
.
description
.
indexOf
(
"备#"
)
<
0
)
{
pobj
.
actionBody
.
level
=
"A"
;
}
else
{
var
levelurl
=
"http://106.13.228.212:8000/recProbability"
;
var
levelresult
=
await
this
.
restPostUrl
({
intentionBizId
:
pobj
.
actionBody
.
intentionBizId
,
type
:
pobj
.
actionBody
.
type
,
note
:
pobj
.
actionBody
.
description
},
levelurl
);
if
(
levelresult
.
status
==
0
)
{
pobj
.
actionBody
.
level
=
levelresult
.
data
.
level
;
pobj
.
actionBody
.
probability
=
levelresult
.
data
.
per
;
}
else
{
pobj
.
actionBody
.
level
=
"C"
}
// var levelurl = "http://106.13.228.212:8000/recProbability";
// var levelresult = await this.restPostUrl({ intentionBizId: pobj.actionBody.intentionBizId, type: pobj.actionBody.type, note: pobj.actionBody.description }, levelurl);
// if (levelresult.status == 0) {
// pobj.actionBody.level = levelresult.data.level;
// pobj.actionBody.probability = levelresult.data.per;
// } else {
// pobj.actionBody.level = "C"
// }
pobj
.
actionBody
.
level
=
"C"
}
if
(
pobj
.
actionBody
.
phone
==
"17319425791"
)
{
if
(
pobj
.
actionBody
.
phone
==
"17319425791"
)
{
pobj
.
actionBody
.
level
=
"F"
;
}
...
...
@@ -259,8 +260,8 @@ class UtilsNeedService2 extends AppServiceBase {
* @param {*} actionBody
*/
async
needCloseIcp
(
pobj
,
actionBody
)
{
console
.
log
(
'guanbi icp xuqiu pobj+++'
,
pobj
)
if
(
actionBody
.
uapp_id
==
uappId
.
ali
)
{
console
.
log
(
'guanbi icp xuqiu pobj+++'
,
pobj
)
if
(
actionBody
.
uapp_id
==
uappId
.
ali
)
{
if
(
!
actionBody
.
channelNeedNo
)
{
return
system
.
getResult
(
null
,
"actionBody.channelNeedNo can not be empty,100395"
);
}
...
...
@@ -282,9 +283,9 @@ class UtilsNeedService2 extends AppServiceBase {
resultInfo
:
JSON
.
stringify
(
result
),
optitle
:
"abolishIcpProgrammeByNeed推送蜂擎获取的接口信息->aliBusiness2Delivery"
,
});
console
.
log
(
'result close'
,
result
)
console
.
log
(
'result close'
,
result
)
if
(
result
.
status
==
0
)
{
if
(
result
.
data
&&
result
.
data
.
orderNo
)
{
if
(
result
.
data
&&
result
.
data
.
orderNo
)
{
pobj
.
actionBody
.
orderNo
=
result
.
data
.
orderNo
;
var
orderrtn
=
await
self
.
utilsOrderSve
.
delOrder
(
pobj
,
pobj
.
actionBody
);
if
(
orderrtn
.
status
<
0
)
{
...
...
@@ -313,14 +314,14 @@ class UtilsNeedService2 extends AppServiceBase {
optitle
:
"updateChanceStatus推送蜂擎获取的接口信息->aliBusiness2Delivery"
,
});
// 推送ali
if
(
result
.
data
.
uapp_id
==
uappId
.
ali
)
{
if
(
result
.
data
.
uapp_id
==
uappId
.
ali
)
{
var
a
=
await
self
.
aliclient
.
reqbyget
({
action
:
"CloseIntention"
,
reqbody
:
{
BizId
:
actionBody
.
channelNeedNo
,
Note
:
actionBody
.
note
},
apiVersion
:
"2019-05-08"
});
}
// 推送baidu
if
(
result
.
data
.
uapp_id
==
uappId
.
baidu
)
{
var
a
=
await
self
.
baiduclient
.
baiduReqbyget
({
path
:
"/api/bla/provider/requirement/update"
,
reqbody
:
{
requirementId
:
actionBody
.
channelNeedNo
,
status
:
"CLOSED"
,
note
:
actionBody
.
note
}
});
}
console
.
log
(
"closed need a+++"
,
a
);
// 推送baidu
if
(
result
.
data
.
uapp_id
==
uappId
.
baidu
)
{
var
a
=
await
self
.
baiduclient
.
baiduReqbyget
({
path
:
"/api/bla/provider/requirement/update"
,
reqbody
:
{
requirementId
:
actionBody
.
channelNeedNo
,
status
:
"CLOSED"
,
note
:
actionBody
.
note
}
});
}
console
.
log
(
"closed need a+++"
,
a
);
self
.
utilsPushSve
.
aliBusiness2Fq
(
pobj
,
"pushCloseICPNeed"
);
return
system
.
getResultSuccess
();
}
else
{
...
...
@@ -380,7 +381,7 @@ class UtilsNeedService2 extends AppServiceBase {
}
actionBody
.
newuserOtherList
=
newuserOtherList
;
}
if
(
actionBody
.
isDirectBuy
===
"true"
&&
(
actionBody
.
status
==
1
||
actionBody
.
status
==
0
))
{
//已支付直购不调用
if
(
actionBody
.
isDirectBuy
===
"true"
&&
(
actionBody
.
status
==
1
||
actionBody
.
status
==
0
))
{
//已支付直购不调用
return
system
.
getResultSuccess
();
}
pobj
.
actionType
=
"receiveIcpStatusNotify"
;
...
...
@@ -391,7 +392,7 @@ class UtilsNeedService2 extends AppServiceBase {
actionBody
:
{
orderNo
:
rtn
.
data
.
orderNo
,
//pobj.actionBody.channelOrder.channelOrderNo,
needsolution
:
rtn
.
data
.
solutionContent
,
channelNeedNo
:
rtn
.
data
.
channelNeedNo
||
""
,
channelNeedNo
:
rtn
.
data
.
channelNeedNo
||
""
,
channelSolutionNo
:
rtn
.
data
.
channelSolutionNo
,
servicer
:
{
code
:
'gsb'
,
...
...
@@ -509,17 +510,17 @@ class UtilsNeedService2 extends AppServiceBase {
var
reqUrl
=
this
.
centerOrderUrl
+
"action/need/springBoard"
;
var
result
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
//2020-10-28 laolan start
if
(
result
&&
result
.
status
==
0
&&
result
.
data
)
{
if
(
result
.
data
==
uappId
.
aliConfirmResult
)
{
var
res
=
await
self
.
aliclient
.
reqbyget
({
action
:
"writeCommunicationLog"
,
reqbody
:
{
BizId
:
pobj
.
actionBody
.
intentionBizId
,
Note
:
pobj
.
actionBody
.
note
},
apiVersion
:
"2019-05-08"
});
console
.
log
(
"ali+res"
,
res
)
}
if
(
result
.
data
==
uappId
.
baidu
)
{
var
ress
=
await
self
.
baiduclient
.
baiduReqbyget
({
path
:
"/api/bla/provider/communication"
,
reqbody
:
{
requirementId
:
pobj
.
actionBody
.
intentionBizId
,
content
:
pobj
.
actionBody
.
note
}
});
console
.
log
(
"baidu+res"
,
ress
)
}
if
(
result
&&
result
.
status
==
0
&&
result
.
data
)
{
if
(
result
.
data
==
uappId
.
aliConfirmResult
)
{
var
res
=
await
self
.
aliclient
.
reqbyget
({
action
:
"writeCommunicationLog"
,
reqbody
:
{
BizId
:
pobj
.
actionBody
.
intentionBizId
,
Note
:
pobj
.
actionBody
.
note
},
apiVersion
:
"2019-05-08"
});
console
.
log
(
"ali+res"
,
res
)
}
if
(
result
.
data
==
uappId
.
baidu
)
{
var
ress
=
await
self
.
baiduclient
.
baiduReqbyget
({
path
:
"/api/bla/provider/communication"
,
reqbody
:
{
requirementId
:
pobj
.
actionBody
.
intentionBizId
,
content
:
pobj
.
actionBody
.
note
}
});
console
.
log
(
"baidu+res"
,
ress
)
}
}
//推送交付系统
var
reqParams
=
{
actionBody
:
{
...
...
@@ -553,9 +554,9 @@ class UtilsNeedService2 extends AppServiceBase {
//2020-10-28 laolan start
var
reqUrl
=
this
.
centerOrderUrl
+
"action/need/springBoard"
;
var
result
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
console
.
log
(
'jilu+++result++++'
,
result
)
if
(
result
&&
result
.
status
==
0
&&
result
.
data
&&
result
.
data
.
uapp_id
)
{
if
(
result
.
data
.
uapp_id
==
uappId
.
ali
)
{
console
.
log
(
'jilu+++result++++'
,
result
)
if
(
result
&&
result
.
status
==
0
&&
result
.
data
&&
result
.
data
.
uapp_id
)
{
if
(
result
.
data
.
uapp_id
==
uappId
.
ali
)
{
var
res
=
await
this
.
aliclient
.
reqbyget
({
action
:
"QueryExpertApplyCommunicationLogs"
,
reqbody
:
{
BeginTime
:
pobj
.
actionBody
.
BeginTime
?
pobj
.
actionBody
.
BeginTime
:
""
,
...
...
@@ -568,8 +569,8 @@ class UtilsNeedService2 extends AppServiceBase {
});
}
if
(
result
.
data
.
uapp_id
==
uappId
.
baidu
)
{
console
.
log
(
"bbbbb++"
,
pobj
)
if
(
result
.
data
.
uapp_id
==
uappId
.
baidu
)
{
console
.
log
(
"bbbbb++"
,
pobj
)
var
res
=
await
this
.
baiduclient
.
baiduReqbyget
({
path
:
"/api/bla/provider/communication/list"
,
reqbody
:
{
beginTime
:
pobj
.
actionBody
.
BeginTime
?
pobj
.
actionBody
.
BeginTime
:
""
,
...
...
@@ -577,10 +578,10 @@ class UtilsNeedService2 extends AppServiceBase {
requirementId
:
pobj
.
actionBody
.
intentionBizId
}
});
console
.
log
(
'xxcc+++'
,
res
)
console
.
log
(
'xxcc+++'
,
res
)
}
}
// 2020 0820 lin 新增 拉去有跟进信息的需求但 并 记录
// console.log(pobj.actionBody.intentionBizId,res.data.TotalItemNum)
// if(res.data.TotalItemNum > 0) {
...
...
@@ -630,10 +631,10 @@ class UtilsNeedService2 extends AppServiceBase {
* @param {*} actionBody
*/
async
queryIntentionList
(
pobj
,
actionBody
)
{
if
(
pobj
.
appInfo
.
uapp_id
=
uappId
.
ali
)
{
if
(
pobj
.
appInfo
.
uapp_id
=
uappId
.
ali
)
{
var
result
=
await
self
.
aliclient
.
reqbyget
({
action
:
"QueryIntentionList"
,
reqbody
:
actionBody
,
apiVersion
:
"2019-05-08"
});
}
if
(
pobj
.
appInfo
.
uapp_id
=
uappId
.
baidu
)
{
if
(
pobj
.
appInfo
.
uapp_id
=
uappId
.
baidu
)
{
var
result
=
await
self
.
baiduclient
.
baiduReqbyget
({
path
:
"api/bla/provider/requirement/list"
,
reqbody
:
actionBody
});
}
if
(
result
.
code
==
200
)
{
...
...
@@ -668,7 +669,7 @@ class UtilsNeedService2 extends AppServiceBase {
// if (!pobj.actionBody.userFeedBack) {
// return system.getResult(null, "actionBody.userFeedBack can not be empty,100494");
// }
console
.
log
(
'xxxqqqq+++chaxun+++'
,
pobj
)
console
.
log
(
'xxxqqqq+++chaxun+++'
,
pobj
)
pobj
.
actionBody
.
data
=
[];
await
this
.
queryByAli
(
pobj
,
1
);
pobj
.
actionType
=
"getUnCreated"
;
...
...
@@ -680,15 +681,15 @@ class UtilsNeedService2 extends AppServiceBase {
};
for
(
let
item
of
result
.
data
)
{
if
(
item
.
Type
==
1
&&
item
.
RegisterNumber
)
{
pobj
.
actionBody
.
intentionBizId
=
item
.
BizId
;
pobj
.
actionBody
.
mobile
=
item
.
Mobile
?
item
.
Mobile
:
""
;
//pobj.actionBody.Area = item.Area || "北京"
pobj
.
actionBody
.
area
=
'大陆地区 '
pobj
.
actionBody
.
intentionBizId
=
item
.
BizId
;
pobj
.
actionBody
.
mobile
=
item
.
Mobile
?
item
.
Mobile
:
""
;
//pobj.actionBody.Area = item.Area || "北京"
pobj
.
actionBody
.
area
=
'大陆地区 '
pobj
.
actionBody
.
userName
=
item
.
UserName
?
item
.
UserName
:
""
;
pobj
.
actionBody
.
description
=
item
.
RegisterNumber
pobj
.
notes
=
`
${
item
.
RegisterNumber
?
"RegisterNumber:"
+
item
.
RegisterNumber
:
""
}${
item
.
Classification
?
"Classification:"
+
item
.
Classification
:
""
}
`
;
let
res
=
await
this
.
submitNeed
(
JSON
.
parse
(
JSON
.
stringify
(
pobj
)),
{
intentionBizId
:
item
.
BizId
});
console
.
log
(
res
)
pobj
.
actionBody
.
description
=
item
.
RegisterNumber
pobj
.
notes
=
`
${
item
.
RegisterNumber
?
"RegisterNumber:"
+
item
.
RegisterNumber
:
""
}${
item
.
Classification
?
"Classification:"
+
item
.
Classification
:
""
}
`
;
let
res
=
await
this
.
submitNeed
(
JSON
.
parse
(
JSON
.
stringify
(
pobj
)),
{
intentionBizId
:
item
.
BizId
});
console
.
log
(
res
)
}
}
return
system
.
getResultSuccess
();
...
...
@@ -715,14 +716,14 @@ class UtilsNeedService2 extends AppServiceBase {
}
// 2020 0914 lin 新增 刷单一条龙服务
async
needBatchUpload
(
pobj
,
actionBody
)
{
var
BizIds
=
""
;
async
needBatchUpload
(
pobj
,
actionBody
)
{
var
BizIds
=
""
;
var
demands
=
[];
// 声明两个数组 用来走后四步用
var
npobj
=
[];
var
spobj
=
[];
// 遍历生成阿里需求 并把bizId 填充进数组
for
(
var
i
=
0
;
i
<
actionBody
.
demands
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
actionBody
.
demands
.
length
;
i
++
)
{
// 第一步
// 地区转换
var
area
=
this
.
areaChange
(
actionBody
.
demands
[
i
].
area
)
...
...
@@ -731,58 +732,58 @@ class UtilsNeedService2 extends AppServiceBase {
// 声明调用4.1需要的参数
var
obj
=
{
Mobile
:
actionBody
.
demands
[
i
].
contactMobile
,
// 手机号
UserName
:
actionBody
.
demands
[
i
].
contactName
,
// 用户名
Description
:
actionBody
.
demands
[
i
].
description
,
Area
:
area
,
BizType
:
bizType
,
Channel
:
"gsb"
,
Token
:
"gsb"
,
UserName
:
actionBody
.
demands
[
i
].
contactName
,
// 用户名
Description
:
actionBody
.
demands
[
i
].
description
,
Area
:
area
,
BizType
:
bizType
,
Channel
:
"gsb"
,
Token
:
"gsb"
,
}
// 4.1 提交阿里需求
// 2020 0924 lin 修改 reqbyget 为 reqbyLTget
var
aliResult
=
await
this
.
aliclient
.
reqbyLTget
({
action
:
"SubmitIcpIntention"
,
reqbody
:
obj
,
apiVersion
:
"2019-05-08"
});
console
.
log
(
"needBatchUpload-aliResult"
,
aliResult
)
console
.
log
(
"needBatchUpload-aliResult"
,
aliResult
)
// 整合前端需要的数据1
BizIds
+=
aliResult
.
data
.
BizId
+
","
;
npobj
.
push
({
"intentionBizId"
:
aliResult
.
data
.
BizId
,
"type"
:
this
.
bizTypeChange
(
actionBody
.
demands
[
i
].
type
),
"description"
:
actionBody
.
demands
[
i
].
description
,
"mobile"
:
actionBody
.
demands
[
i
].
contactMobile
"description"
:
actionBody
.
demands
[
i
].
description
,
"mobile"
:
actionBody
.
demands
[
i
].
contactMobile
})
spobj
.
push
({
"needNo"
:
aliResult
.
data
.
BizId
,
//渠道需求号
"solutionContent"
:{
"solutionContent"
:
{
// submitIcpProgramme需要的类型转换 ICP许可证 = icpsq/EDI许可证 = edisq
"bizType"
:
actionBody
.
demands
[
i
].
type
,
//产品类型 icpsq edisq
"solution"
:{
// "IcpType":1,//方案类型 不传默认1 1:icp 2: edi 参数无效
"CompanyName"
:
actionBody
.
demands
[
i
].
companyName
,
"CompanyAddress"
:
actionBody
.
demands
[
i
].
companyAddress
,
"Area"
:
actionBody
.
demands
[
i
].
area
+
"(渠道)"
,
"Note"
:
actionBody
.
demands
[
i
].
description
"bizType"
:
actionBody
.
demands
[
i
].
type
,
//产品类型 icpsq edisq
"solution"
:
{
// "IcpType":1,//方案类型 不传默认1 1:icp 2: edi 参数无效
"CompanyName"
:
actionBody
.
demands
[
i
].
companyName
,
"CompanyAddress"
:
actionBody
.
demands
[
i
].
companyAddress
,
"Area"
:
actionBody
.
demands
[
i
].
area
+
"(渠道)"
,
"Note"
:
actionBody
.
demands
[
i
].
description
}
}
})
if
(
aliResult
.
status
!=
0
)
{
if
(
aliResult
.
status
!=
0
)
{
// 统计失败次数
}
}
// 判断数据是否符合 执行后四步 的条件
if
(
npobj
.
length
!=
actionBody
.
demands
.
length
||
spobj
.
length
!=
actionBody
.
demands
.
length
)
{
return
system
.
getResultFail
(
-
5018
,
"提交阿里需求失败"
);
if
(
npobj
.
length
!=
actionBody
.
demands
.
length
||
spobj
.
length
!=
actionBody
.
demands
.
length
)
{
return
system
.
getResultFail
(
-
5018
,
"提交阿里需求失败"
);
}
// 睡3秒 意义:等待阿里异步分配成功。如果不等待则提交方案会失败 无法生成支付链接,需求状态错误
await
this
.
sleep
(
3000
)
// 遍历 执行后面步骤 创建企服需求单(提交方案需要)。提交方案。需求沟通提交
for
(
var
i
=
0
;
i
<
actionBody
.
demands
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
actionBody
.
demands
.
length
;
i
++
)
{
// 第二步
// 创建企服通需求单
var
objString1
=
JSON
.
stringify
(
pobj
);
var
obj1
=
JSON
.
parse
(
objString1
);
obj1
.
actionBody
=
npobj
[
i
];
var
opResult
=
await
this
.
submitNeed
(
obj1
,
obj1
.
actionBody
);
console
.
log
(
"needBatchUpload-opResult"
,
opResult
)
console
.
log
(
"needBatchUpload-opResult"
,
opResult
)
// 第三步
// 提交Icp注册方案
// 程序执行比异步分配需求快,所以写成两个循环
...
...
@@ -792,15 +793,15 @@ class UtilsNeedService2 extends AppServiceBase {
obj2
.
actionBody
=
spobj
[
i
];
var
subRes
=
await
this
.
qcCenterOrderSve
.
submitIcpProgramme
(
obj2
);
console
.
log
(
"----------------------------------start"
);
console
.
log
(
"needBatchUpload-res"
,
subRes
)
console
.
log
(
"needBatchUpload-res"
,
subRes
)
console
.
log
(
"----------------------------------end"
);
// 第四步
// 需求沟通记录接口
var
writeRes
=
await
this
.
writeCommunicationLog
({
actionBody
:{
intentionBizId
:
npobj
[
i
].
intentionBizId
,
note
:
"测试反馈"
}
});
console
.
log
(
"needBatchUpload-writeRes"
,
writeRes
)
var
writeRes
=
await
this
.
writeCommunicationLog
({
actionBody
:
{
intentionBizId
:
npobj
[
i
].
intentionBizId
,
note
:
"测试反馈"
}
});
console
.
log
(
"needBatchUpload-writeRes"
,
writeRes
)
// 整合前端需要的数据2
demands
.
push
({
uniqueCode
:
actionBody
.
demands
[
i
].
uniqueCode
,
uniqueCode
:
actionBody
.
demands
[
i
].
uniqueCode
,
demandCode
:
npobj
[
i
].
intentionBizId
})
}
...
...
@@ -808,16 +809,16 @@ class UtilsNeedService2 extends AppServiceBase {
// 首先切割掉BizId最后一位 是,
BizIds
=
BizIds
.
substr
(
0
,
BizIds
.
length
-
1
);
// 2020 0924 lin 修改 reqbyget 为 reqbyLTget
var
aliConfirmResult
=
await
this
.
aliclient
.
reqbyLTget
({
action
:
"ConfirmIcpIntention"
,
reqbody
:
{
BizIds
:
BizIds
},
apiVersion
:
"2019-05-08"
});
console
.
log
(
"needBatchUpload-aliConfirmResult"
,
aliConfirmResult
)
var
aliConfirmResult
=
await
this
.
aliclient
.
reqbyLTget
({
action
:
"ConfirmIcpIntention"
,
reqbody
:
{
BizIds
:
BizIds
},
apiVersion
:
"2019-05-08"
});
console
.
log
(
"needBatchUpload-aliConfirmResult"
,
aliConfirmResult
)
// 获取链接失败
if
(
aliConfirmResult
.
status
!=
0
)
{
return
system
.
getResultFail
(
-
5018
,
"confirmIcpIntention fail"
);
if
(
aliConfirmResult
.
status
!=
0
)
{
return
system
.
getResultFail
(
-
5018
,
"confirmIcpIntention fail"
);
}
var
res
=
{
paymentLink
:
aliConfirmResult
.
data
.
ConfirmUrl
,
batchNumber
:
actionBody
.
batchNumber
,
demands
:
demands
paymentLink
:
aliConfirmResult
.
data
.
ConfirmUrl
,
batchNumber
:
actionBody
.
batchNumber
,
demands
:
demands
}
// 2020 0916 lin 新增返回格式 成功status为1 因为queue判断成功请求的条件为status1
return
system
.
getResultRedisQueueSuccess
(
res
);
...
...
@@ -983,16 +984,16 @@ class UtilsNeedService2 extends AppServiceBase {
}
}
bizTypeChange
(
bizType
)
{
switch
(
bizType
)
{
case
"ICP许可证"
:
switch
(
bizType
)
{
case
"ICP许可证"
:
return
"5"
case
"EDI许可证"
:
return
"7"
}
}
needBizTypeChange
(
type
)
{
switch
(
type
)
{
case
"ICP许可证"
:
switch
(
type
)
{
case
"ICP许可证"
:
return
"icpsq"
case
"EDI许可证"
:
return
"edisq"
...
...
@@ -1033,11 +1034,11 @@ class UtilsNeedService2 extends AppServiceBase {
var
obj
=
{
"intentionBizId"
:
actionBody
.
intentionBizId
,
"type"
:
actionBody
.
type
,
"description"
:
actionBody
.
description
,
"mobile"
:
actionBody
.
mobile
"description"
:
actionBody
.
description
,
"mobile"
:
actionBody
.
mobile
}
var
res
=
await
this
.
submitNeed
(
pobj
,
obj
);
if
(
res
.
status
==
0
)
{
var
res
=
await
this
.
submitNeed
(
pobj
,
obj
);
if
(
res
.
status
==
0
)
{
return
system
.
getResultSuccess
(
res
.
data
);
}
return
system
.
getResult
(
null
,
res
)
...
...
@@ -1051,11 +1052,11 @@ class UtilsNeedService2 extends AppServiceBase {
async
needCloseAliEsp
(
pobj
,
actionBody
)
{
var
obj
=
{
"intentionBizId"
:
actionBody
.
intentionBizId
,
"mobile"
:
actionBody
.
mobile
"mobile"
:
actionBody
.
mobile
}
pobj
.
actionType
=
"needClose"
;
var
res
=
await
this
.
needClose
(
pobj
,
obj
);
if
(
res
.
status
==
0
)
{
var
res
=
await
this
.
needClose
(
pobj
,
obj
);
if
(
res
.
status
==
0
)
{
return
system
.
getResultSuccess
(
res
.
data
);
}
return
system
.
getResult
(
null
,
res
)
...
...
@@ -1093,14 +1094,14 @@ class UtilsNeedService2 extends AppServiceBase {
// }
// }
switch
(
actionBody
.
operationType
)
{
case
"USER_PAY_PRODUCE"
:
case
"USER_PAY_PRODUCE"
:
// 修改需求,方案 订单状态
// 第一步查处需求单 原因 询价/创建 需要商品数据 用户数据
pobj
.
actionBody
.
needNo
=
pobj
.
actionBody
.
intentionBizId
pobj
.
actionType
=
"getItemByChannelNeedNo"
;
var
url
=
this
.
centerOrderUrl
+
"action/need/springBoard"
;
var
needInfoResult
=
await
this
.
restPostUrl
(
pobj
,
url
);
if
(
needInfoResult
.
status
!=
0
)
{
if
(
needInfoResult
.
status
!=
0
)
{
return
system
.
getResult
(
null
,
"needInfo is empty"
);
}
// 第二部 询价
...
...
@@ -1131,7 +1132,7 @@ class UtilsNeedService2 extends AppServiceBase {
pobj
.
actionType
=
"getProductPrice"
;
var
url
=
settings
.
centerAppUrl
()
+
"action/opProduct/springBoard"
;
var
productPriceResult
=
await
this
.
restPostUrl
(
pobj
,
url
);
if
(
productPriceResult
.
status
!=
0
)
{
if
(
productPriceResult
.
status
!=
0
)
{
return
system
.
getResult
(
null
,
"productPrice is empty"
);
}
// 获取userpin 为什么在这里获取?原因:getWay获取不到手机号 再去调用其他接口浪费资源
...
...
@@ -1180,10 +1181,10 @@ class UtilsNeedService2 extends AppServiceBase {
// var reqUrl = this.centerOrderUrl + "action/order/springBoard";
// qobj.actionBody.channelOrder.orderStatus = 2;// 2作为orderinfo的orderStatus的值。含义为已付款
// var result = await this.restPostUrl(qobj, reqUrl);
pobj
.
actionBody
.
bizId
=
actionBody
.
bizId
,
pobj
.
actionBody
.
userName
=
needInfoResult
.
data
.
publishName
,
pobj
.
actionBody
.
mobile
=
needInfoResult
.
data
.
publishMobile
,
pobj
.
actionBody
.
orderNo
=
actionBody
.
bizId
;
pobj
.
actionBody
.
bizId
=
actionBody
.
bizId
,
pobj
.
actionBody
.
userName
=
needInfoResult
.
data
.
publishName
,
pobj
.
actionBody
.
mobile
=
needInfoResult
.
data
.
publishMobile
,
pobj
.
actionBody
.
orderNo
=
actionBody
.
bizId
;
pobj
.
actionBody
.
totalSum
=
productPriceResult
.
data
.
price
;
pobj
.
actionBody
.
orderPrice
=
productPriceResult
.
data
.
price
;
pobj
.
actionBody
.
payTotalSum
=
productPriceResult
.
data
.
price
;
...
...
@@ -1233,7 +1234,7 @@ class UtilsNeedService2 extends AppServiceBase {
orderPrice
:
Number
(
pobj
.
actionBody
.
orderPrice
/
100
),
phone
:
needInfoResult
.
data
.
publishMobile
,
needId
:
solutiondata
.
data
.
channelNeedNo
,
companyName
:
solutiondata
.
data
.
solutionContent
.
solution
.
CompanyName
||
''
//1
companyName
:
solutiondata
.
data
.
solutionContent
.
solution
.
CompanyName
||
''
//1
},
appInfo
:
pobj
.
appInfo
}
...
...
@@ -1256,13 +1257,13 @@ class UtilsNeedService2 extends AppServiceBase {
this
.
utilsPushSve
.
aliBusiness2Fq
(
fqobj
,
"pushOrderICPBusiness"
);
this
.
utilsPushSve
.
aliBusiness2Delivery
(
deliveryObj
,
"pushDeliveryOrder"
);
break
;
case
"USER_CONFIRM_PRODUCE"
:
case
"USER_CONFIRM_PRODUCE"
:
break
;
case
"USER_REFUSE_PRODUCE"
:
case
"USER_REFUSE_PRODUCE"
:
break
;
case
"ABC_CLOSE_PRODUCE"
:
case
"ABC_CLOSE_PRODUCE"
:
break
;
case
"USER_UPLOAD_PRODUCE"
:
case
"USER_UPLOAD_PRODUCE"
:
break
;
default
:
return
system
.
getResult
(
null
,
"operationType参数错误"
);
...
...
@@ -1271,23 +1272,23 @@ class UtilsNeedService2 extends AppServiceBase {
}
// 2020 0927 lin 新增 edi状态更新
async
ediNotify
(
pobj
,
actionBody
)
{
if
(
actionBody
.
operationType
==
"USER_UPLOAD_PRODUCE"
)
{
if
(
actionBody
.
extInfo
)
{
async
ediNotify
(
pobj
,
actionBody
)
{
if
(
actionBody
.
operationType
==
"USER_UPLOAD_PRODUCE"
)
{
if
(
actionBody
.
extInfo
)
{
// businessLicense:['business_license/12195411 61213057/1599115976393/p08xo9frgzj.png']
// idCardList:[' ["card/1219541161213057/1599115980036/s1nn3sozulo.png"] ']
// 注意idCardList 是二维数组 需要再转换一下 不知道为什么
var
extJson
=
JSON
.
parse
(
actionBody
.
extInfo
);
var
businessLicenseArr
=
[];
if
(
extJson
.
idCardList
)
{
if
(
extJson
.
idCardList
)
{
// 抽出数组
var
idCardListA
=
extJson
.
idCardList
;
var
idCardListArr
=
[];
for
(
var
i
=
0
;
i
<
idCardListA
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
idCardListA
.
length
;
i
++
)
{
idCardListArr
.
push
(
await
this
.
opDownFileInfo
(
idCardListA
[
i
]));
}
}
for
(
var
i
=
0
;
i
<
extJson
.
businessLicense
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
extJson
.
businessLicense
.
length
;
i
++
)
{
businessLicenseArr
.
push
(
await
this
.
opDownFileInfo
(
extJson
.
businessLicense
[
i
]));
}
actionBody
.
extInfo
=
{
...
...
@@ -1305,7 +1306,7 @@ class UtilsNeedService2 extends AppServiceBase {
pobj
.
actionType
=
"receiveEdiStatusNotify"
;
var
url
=
settings
.
centerOrderUrl
()
+
"action/ediApi/springBoard"
;
var
rtn
=
await
this
.
restPostUrl
(
pobj
,
url
);
if
(
rtn
.
status
)
{
if
(
rtn
.
status
)
{
return
rtn
;
}
// 只有上传材料才在这里推送,produceNoticeAliEsp不做关于材料上传的推送
...
...
@@ -1364,7 +1365,7 @@ class UtilsNeedService2 extends AppServiceBase {
// 待定
// solutionBizId
// note
if
(
actionBody
.
operateType
==
"INVALID"
)
{
if
(
actionBody
.
operateType
==
"INVALID"
)
{
var
url
=
settings
.
centerOrderUrl
()
+
"action/ediApi/springBoard"
;
var
rtn
=
await
this
.
restPostUrl
(
pobj
,
url
);
}
...
...
@@ -1378,7 +1379,7 @@ class UtilsNeedService2 extends AppServiceBase {
* @param {*} actionBody
*/
async
submitNeed2
(
pobj
,
actionBody
)
{
if
(
actionBody
.
type
==
"esp.wangwen"
||
actionBody
.
type
==
"esp.food"
)
{
if
(
actionBody
.
type
==
"esp.wangwen"
||
actionBody
.
type
==
"esp.food"
)
{
actionBody
.
area
=
this
.
wangwenAreaChange
(
actionBody
.
area
)
}
if
(
!
actionBody
.
intentionBizId
)
{
...
...
@@ -1410,17 +1411,18 @@ class UtilsNeedService2 extends AppServiceBase {
if
(
pobj
.
actionBody
.
description
&&
pobj
.
actionBody
.
description
.
indexOf
(
"备#"
)
<
0
)
{
pobj
.
actionBody
.
level
=
"A"
;
}
else
{
var
levelurl
=
"http://106.13.228.212:8000/recProbability"
;
var
levelresult
=
await
this
.
restPostUrl
({
intentionBizId
:
pobj
.
actionBody
.
intentionBizId
,
type
:
pobj
.
actionBody
.
type
,
note
:
pobj
.
actionBody
.
description
},
levelurl
);
if
(
levelresult
.
status
==
0
)
{
pobj
.
actionBody
.
level
=
levelresult
.
data
.
level
;
pobj
.
actionBody
.
probability
=
levelresult
.
data
.
per
;
}
else
{
pobj
.
actionBody
.
level
=
"C"
}
// var levelurl = "http://106.13.228.212:8000/recProbability";
// var levelresult = await this.restPostUrl({ intentionBizId: pobj.actionBody.intentionBizId, type: pobj.actionBody.type, note: pobj.actionBody.description }, levelurl);
// if (levelresult.status == 0) {
// pobj.actionBody.level = levelresult.data.level;
// pobj.actionBody.probability = levelresult.data.per;
// } else {
// pobj.actionBody.level = "C"
// }
pobj
.
actionBody
.
level
=
"C"
}
if
(
pobj
.
actionBody
.
phone
==
"17319425791"
)
{
if
(
pobj
.
actionBody
.
phone
==
"17319425791"
)
{
pobj
.
actionBody
.
level
=
"F"
;
}
...
...
@@ -1450,7 +1452,7 @@ class UtilsNeedService2 extends AppServiceBase {
async
icpNotifyNew
(
pobj
)
{
var
actionBody
=
pobj
.
actionBody
;
var
self
=
this
;
if
(
actionBody
.
isDirectBuy
&&
actionBody
.
isDirectBuy
==
1
)
{
if
(
actionBody
.
isDirectBuy
&&
actionBody
.
isDirectBuy
==
1
)
{
actionBody
.
bizId
=
actionBody
.
orderNo
}
if
(
!
actionBody
.
bizId
)
{
...
...
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