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
1f898bae
Commit
1f898bae
authored
Sep 28, 2020
by
linboxuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ali wangwen 2.3 produceNoticeAliEsp
parent
e09a889c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
228 additions
and
1 deletions
+228
-1
center-channel/app/base/api/impl/opreceive/edi.js
+10
-1
center-channel/app/base/service/impl/utilsSve/utilsNeedSve.js
+218
-0
No files found.
center-channel/app/base/api/impl/opreceive/edi.js
View file @
1f898bae
...
...
@@ -25,9 +25,18 @@ class edi extends APIBase {
async
opActionProcess
(
pobj
,
action_type
,
action_body
,
req
)
{
var
opResult
=
null
;
switch
(
action_type
)
{
case
"submitNeedAliEsp"
:
//支付回调
case
"submitNeedAliEsp"
:
opResult
=
await
this
.
utilsNeedSve
.
submitNeedAliEsp
(
pobj
,
pobj
.
actionBody
);
break
;
case
"needCloseAliEsp"
:
opResult
=
await
this
.
utilsNeedSve
.
needCloseAliEsp
(
pobj
,
pobj
.
actionBody
);
break
;
case
"produceNoticeAliEsp"
:
result
=
await
this
.
utilsNeedSve
.
ediNotify
(
pobj
,
pobj
.
actionBody
);
if
(
result
.
status
==
0
)
{
opResult
=
await
this
.
utilsNeedSve
.
produceNoticeAliEsp
(
pobj
,
pobj
.
actionBody
);
}
break
;
default
:
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
break
;
...
...
center-channel/app/base/service/impl/utilsSve/utilsNeedSve.js
View file @
1f898bae
...
...
@@ -3,6 +3,7 @@ var settings = require("../../../../config/settings");
const
AppServiceBase
=
require
(
"../../app.base"
);
const
fs
=
require
(
"fs"
);
const
{
json
}
=
require
(
"sequelize"
);
const
{
getResult
,
getResultSuccess
}
=
require
(
"../../../system"
);
//需求操作类----ali对接的需求
class
UtilsNeedService
extends
AppServiceBase
{
constructor
()
{
...
...
@@ -16,6 +17,7 @@ class UtilsNeedService extends AppServiceBase {
this
.
utilsneedSve
=
system
.
getObject
(
"service.common.gatewaypushlogSve"
);
this
.
qcCenterOrderSve
=
system
.
getObject
(
"service.common.qcCenterOrderSve"
);
this
.
opPushQueueUrl
=
settings
.
opPushQueueUrl
();
this
.
utilsAuthSve
=
system
.
getObject
(
"service.utilsSve.utilsAuthSve"
);
}
/**
...
...
@@ -882,12 +884,228 @@ class UtilsNeedService extends AppServiceBase {
"intentionBizId"
:
actionBody
.
intentionBizId
,
"mobile"
:
actionBody
.
mobile
}
pobj
.
actionType
=
"needClose"
;
var
res
=
await
this
.
needClose
(
pobj
,
obj
);
if
(
res
.
status
==
0
)
{
return
system
.
getResultSuccess
(
res
.
data
);
}
return
system
.
getResult
(
null
,
res
)
}
/**
* 2020 0926 lin 新增 阿里文网文 服务商侧提供接口2.2 关闭需求通知服务商
* @param {*} pobj
* @param {*} actionBody
*/
async
produceNoticeAliEsp
(
pobj
,
actionBody
)
{
// 如果状态为USER_UPLOAD_PRODUCE需要转换url
// 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) {
// // 抽出数组
// var idCardListA = JSON.parse(extJson.idCardList);
// var idCardListArr = [];
// for(var i = 0; i < idCardListA.lenght; i++) {
// idCardListArr.push(await this.opDownFileInfo(idCardListA[i]));
// }
// }
// for(var i = 0; i < extJson.businessLicense.lenght; i++) {
// businessLicenseArr.push(await this.opDownFileInfo(extJson.businessLicense[i]));
// }
// actionBody.extInfo = {
// businessLicenseArr,
// idCardListArr
// }
// }
// }
switch
(
actionBody
.
operationType
)
{
case
"USER_PAY_PRODUCE"
:
// 修改需求,方案 订单状态
// 走addOrder流程
// 第一步查处需求单 原因 询价/创建 需要商品数据 用户数据
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
)
{
return
system
.
getResult
(
null
,
"needInfo is empty"
);
}
// 第二部 询价
pobj
.
actionBody
.
city
=
needInfoResult
.
data
.
city
pobj
.
actionBody
.
channelItemCode
=
needInfoResult
.
data
.
channelTypeCode
pobj
.
actionBody
.
pathCode
=
"/zzfw/wangwen/"
// 写死 needInfo不支持
pobj
.
actionType
=
"getProductPrice"
;
var
url
=
settings
.
centerAppUrl
()
+
"action/opProduct/springBoard"
;
var
productPriceResult
=
await
this
.
restPostUrl
(
pobj
,
url
);
if
(
productPriceResult
.
status
!=
0
)
{
return
system
.
getResult
(
null
,
"productPrice is empty"
);
}
// 获取userpin 为什么在这里获取?原因:getWay获取不到手机号 再去调用其他接口浪费资源
pobj
.
actionType
=
"getLoginByUserName"
;
pobj
.
actionBody
.
channelUserId
=
needInfoResult
.
data
.
publishMobile
;
// 即:86_18512345678
pobj
.
actionBody
.
userName
=
needInfoResult
.
data
.
publishMobile
;
pobj
.
actionBody
.
mobile
=
needInfoResult
.
data
.
publishMobile
;
pobj
.
actionBody
.
userpin
=
pobj
.
actionBody
.
userpin
||
this
.
getUUID
();
var
tmpOpResult
=
await
this
.
utilsAuthSve
.
getLoginByUserName
(
pobj
,
pobj
.
actionBody
);
pobj
.
userInfo
=
tmpOpResult
.
data
// 第三步 走addOrder流程
var
pobjStr
=
JSON
.
stringify
(
pobj
);
var
qobj
=
JSON
.
parse
(
pobjStr
);
qobj
.
actionBody
=
{
"bizId"
:
actionBody
.
bizId
,
"userName"
:
needInfoResult
.
data
.
publishName
,
"mobile"
:
needInfoResult
.
data
.
publishMobile
,
"price"
:
qobj
.
Price
,
"channelItemCode"
:
needInfoResult
.
data
.
channelTypeCode
,
"payCode"
:
productPriceResult
.
data
.
payCode
,
"quantity"
:
1
,
"totalSum"
:
productPriceResult
.
data
.
price
,
"payTotalSum"
:
productPriceResult
.
data
.
Price
,
"channelOrder"
:{
"channelServiceNo"
:
actionBody
.
bizId
,
"channelOrderNo"
:
actionBody
.
bizId
}
}
qobj
.
actionType
=
"getProductDetail"
;
var
url
=
settings
.
centerAppUrl
()
+
"action/opProduct/springBoard"
;
var
productItemResult
=
await
this
.
restPostUrl
(
qobj
,
url
);
if
(
productItemResult
.
status
!=
0
)
{
return
productItemResult
;
}
qobj
.
actionBody
.
product_info
=
productItemResult
.
data
;
var
verifyResult
=
await
this
.
utilsOrderSve
.
isOrderVerify
(
qobj
,
qobj
.
actionBody
);
if
(
verifyResult
.
status
!=
0
)
{
return
verifyResult
;
}
qobj
.
actionType
=
"getProductInterface"
;
qobj
.
actionBody
.
product_id
=
qobj
.
actionBody
.
product_info
.
id
;
var
productItemInterfaceResult
=
await
this
.
restPostUrl
(
qobj
,
url
);
qobj
.
actionBody
.
product_info
.
interface_info
=
productItemInterfaceResult
.
data
;
qobj
.
actionType
=
"addOrder"
;
var
reqUrl
=
this
.
centerOrderUrl
+
"action/order/springBoard"
;
qobj
.
actionBody
.
channelOrder
.
orderStatus
=
2
;
// 2作为orderinfo的orderStatus的值。含义为已付款
var
result
=
await
this
.
restPostUrl
(
qobj
,
reqUrl
);
// 第四步 整合推送参数 并推送
var
fqobj
=
{
actionBody
:
{
area
:
pobj
.
actionBody
.
province
,
city
:
pobj
.
actionBody
.
province
,
regType
:
pobj
.
actionBody
.
regType
,
//1
orderNo
:
pobj
.
actionBody
.
channelOrder
.
channelOrderNo
,
orderPrice
:
Number
(
pobj
.
actionBody
.
orderPrice
/
100
),
phone
:
pobj
.
actionBody
.
publishMobile
,
needId
:
solutiondata
.
data
.
channelNeedNo
,
companyName
:
solutiondata
.
data
.
solutionContent
.
solution
.
CompanyName
||
''
//1
},
appInfo
:
pobj
.
appInfo
}
var
deliveryObj
=
{
actionBody
:
{
orderNo
:
orderrtn
.
data
.
orderNo
,
//pobj.actionBody.channelOrder.channelOrderNo,
needsolution
:
solutiondata
.
data
.
solutionContent
,
channelNeedNo
:
solutiondata
.
data
.
channelNeedNo
,
channelSolutionNo
:
solutiondata
.
data
.
channelSolutionNo
,
skuCode
:
data
.
data
.
payCode
,
servicer
:
{
code
:
'gsb'
,
name
:
'公司宝'
}
},
appInfo
:
pobj
.
appInfo
}
this
.
utilsPushSve
.
aliBusiness2Fq
(
fqobj
,
"pushOrderICPBusiness"
);
this
.
utilsPushSve
.
aliBusiness2Delivery
(
deliveryObj
,
"pushDeliveryOrder"
);
console
.
log
(
result
);
break
;
case
"USER_CONFIRM_PRODUCE"
:
break
;
case
"USER_REFUSE_PRODUCE"
:
break
;
case
"ABC_CLOSE_PRODUCE"
:
break
;
case
"USER_UPLOAD_PRODUCE"
:
break
;
default
:
return
system
.
getResult
(
null
,
"operationType参数错误"
);
}
return
getResultSuccess
(
result
);
}
// 2020 0927 lin 新增 edi状态更新
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
)
{
// 抽出数组
var
idCardListA
=
JSON
.
parse
(
extJson
.
idCardList
);
var
idCardListArr
=
[];
for
(
var
i
=
0
;
i
<
idCardListA
.
lenght
;
i
++
)
{
idCardListArr
.
push
(
await
this
.
opDownFileInfo
(
idCardListA
[
i
]));
}
}
for
(
var
i
=
0
;
i
<
extJson
.
businessLicense
.
lenght
;
i
++
)
{
businessLicenseArr
.
push
(
await
this
.
opDownFileInfo
(
extJson
.
businessLicense
[
i
]));
}
actionBody
.
extInfo
=
{
businessLicenseArr
,
idCardListArr
}
}
}
var
self
=
this
;
actionBody
.
BizId
=
actionBody
.
bizId
;
pobj
.
actionType
=
"receiveEdiStatusNotify"
;
var
url
=
settings
.
centerOrderUrl
()
+
"action/ediApi/springBoard"
;
var
rtn
=
await
this
.
restPostUrl
(
pobj
,
url
);
var
deliveryObj
=
{
actionBody
:
{
orderNo
:
rtn
.
data
.
orderNo
,
//pobj.actionBody.channelOrder.channelOrderNo,
needsolution
:
rtn
.
data
.
solutionContent
,
channelNeedNo
:
rtn
.
data
.
channelNeedNo
,
channelSolutionNo
:
rtn
.
data
.
channelSolutionNo
,
servicer
:
{
code
:
'gsb'
,
name
:
'公司宝'
}
},
appInfo
:
pobj
.
appInfo
}
this
.
utilsPushSve
.
aliBusiness2Delivery
(
deliveryObj
,
"pushDeliveryOrder"
);
if
(
rtn
.
status
==
0
&&
actionBody
.
status
!=
1
&&
actionBody
.
status
!=
2
&&
rtn
.
data
)
{
var
tmpObj
=
{
actionBody
:
{
orderNo
:
rtn
.
data
.
orderNo
,
channelNeedNo
:
rtn
.
data
.
channelNeedNo
,
needsolution
:
rtn
.
data
.
solutionContent
},
appInfo
:
pobj
.
appInfo
}
this
.
utilsPushSve
.
aliBusiness2Delivery
(
tmpObj
,
"pushDeliveryStatusNotify"
);
pobj
.
actionBody
.
orderNo
=
rtn
.
data
.
orderNo
;
if
(
actionBody
.
operationType
==
"ABC_CLOSE_PRODUCE"
)
{
var
orderrtn
=
await
self
.
utilsOrderSve
.
delOrder
(
pobj
,
pobj
.
actionBody
);
if
(
orderrtn
.
status
<
0
)
{
return
system
.
getResultFail
(
-
5022
,
"订单关闭失败"
);
}
tmpObj
.
actionBody
.
orderNo
=
rtn
.
data
.
channelSolutionNo
;
self
.
utilsPushSve
.
aliBusiness2Fq
(
tmpObj
,
"pushOrderICPClose"
);
}
}
//通知更新状态
return
rtn
;
}
}
module
.
exports
=
UtilsNeedService
;
...
...
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