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
feb9a28e
Commit
feb9a28e
authored
Oct 18, 2020
by
兰国旗
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wangwen-test
parent
dd6028fb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
415 additions
and
19 deletions
+415
-19
center-order/app/base/api/impl/action/qcapi.js
+21
-4
center-order/app/base/service/impl/qcutils/aliyunqcSve.js
+394
-15
No files found.
center-order/app/base/api/impl/action/qcapi.js
View file @
feb9a28e
...
@@ -28,6 +28,7 @@ class QcAPI extends APIBase {
...
@@ -28,6 +28,7 @@ class QcAPI extends APIBase {
return
result
;
return
result
;
}
}
async
opActionProcess
(
pobj
,
action_type
,
req
)
{
async
opActionProcess
(
pobj
,
action_type
,
req
)
{
console
.
log
(
"pobj"
,
pobj
)
var
opResult
=
null
;
var
opResult
=
null
;
switch
(
action_type
)
{
switch
(
action_type
)
{
case
"receiveProgrammeNo"
:
//接收方案编号(方案推送至阿里后,接收保存方案信息)
case
"receiveProgrammeNo"
:
//接收方案编号(方案推送至阿里后,接收保存方案信息)
...
@@ -79,18 +80,34 @@ class QcAPI extends APIBase {
...
@@ -79,18 +80,34 @@ class QcAPI extends APIBase {
case
"receiveIcpConfirmUrl"
:
//前端关闭ICP需求及方案
case
"receiveIcpConfirmUrl"
:
//前端关闭ICP需求及方案
opResult
=
await
this
.
aliyunqcSve
.
receiveIcpConfirmUrl
(
pobj
);
opResult
=
await
this
.
aliyunqcSve
.
receiveIcpConfirmUrl
(
pobj
);
break
;
break
;
case
"serviceSubmitOption"
:
//服务商提交服务操作(文网文)2020-9-26
//-----------文网文-----------
case
"serviceSubmitOption"
:
//服务商提交服务操作
opResult
=
await
this
.
aliyunqcSve
.
serviceSubmitOption
(
pobj
);
opResult
=
await
this
.
aliyunqcSve
.
serviceSubmitOption
(
pobj
);
break
;
break
;
case
"submitWangwenSolution"
:
//提交方案
(文网文)2020-9-27
case
"submitWangwenSolution"
:
//提交方案
opResult
=
await
this
.
aliyunqcSve
.
submitWangwenSolution
(
pobj
);
opResult
=
await
this
.
aliyunqcSve
.
submitWangwenSolution
(
pobj
);
break
;
break
;
case
"closeNeed"
:
//关闭需求
(文网文)2020-9-28
case
"closeNeed"
:
//关闭需求
opResult
=
await
this
.
aliyunqcSve
.
closeNeed
(
pobj
);
opResult
=
await
this
.
aliyunqcSve
.
closeNeed
(
pobj
);
break
;
break
;
case
"recordLog"
:
//提交沟通记录
(文网文)2020-9-28
case
"recordLog"
:
//提交沟通记录
opResult
=
await
this
.
aliyunqcSve
.
recordLog
(
pobj
);
opResult
=
await
this
.
aliyunqcSve
.
recordLog
(
pobj
);
break
;
break
;
//-----------食品-----------
case
"foodServiceSubmitOption"
:
//服务商提交服务操作
opResult
=
await
this
.
aliyunqcSve
.
foodServiceSubmitOption
(
pobj
);
break
;
case
"submitFoodSolution"
:
//提交方案
opResult
=
await
this
.
aliyunqcSve
.
submitFoodSolution
(
pobj
);
break
;
case
"foodCloseNeed"
:
//关闭需求
opResult
=
await
this
.
aliyunqcSve
.
foodCloseNeed
(
pobj
);
break
;
case
"foodRecordLog"
:
//提交沟通记录
opResult
=
await
this
.
aliyunqcSve
.
foodRecordLog
(
pobj
);
break
;
default
:
default
:
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
break
;
break
;
...
...
center-order/app/base/service/impl/qcutils/aliyunqcSve.js
View file @
feb9a28e
...
@@ -1027,11 +1027,13 @@ class AliyunQcService {
...
@@ -1027,11 +1027,13 @@ class AliyunQcService {
return
system
.
getResultSuccess
(
new_ns
);
return
system
.
getResultSuccess
(
new_ns
);
}
}
// ---------------- 文网文 ----------------
/**
/**
* 服务商提交服务操作
* 服务商提交服务操作
* 服务商通知状态变更
* 服务商通知状态变更
* (交付系统调用)
* (交付系统调用)
* (文网文)
2020-9-26
* (文网文)
*/
*/
async
serviceSubmitOption
(
pobj
)
{
async
serviceSubmitOption
(
pobj
)
{
console
.
log
(
pobj
)
console
.
log
(
pobj
)
...
@@ -1040,19 +1042,18 @@ class AliyunQcService {
...
@@ -1040,19 +1042,18 @@ class AliyunQcService {
if
(
!
user
||
!
user
.
id
)
{
if
(
!
user
||
!
user
.
id
)
{
return
system
.
getResultFail
(
-
100
,
"未知用户"
);
return
system
.
getResultFail
(
-
100
,
"未知用户"
);
}
}
if
(
!
ab
.
channelNeed
No
)
{
if
(
!
ab
.
order
No
)
{
return
system
.
getResultFail
(
-
101
,
"
需求编
号不能为空"
);
return
system
.
getResultFail
(
-
101
,
"
订单
号不能为空"
);
}
}
if
(
!
ab
.
ApplicationStatus
)
{
if
(
!
ab
.
ApplicationStatus
)
{
return
system
.
getResultFail
(
-
102
,
"
通知
状态不能为空"
);
return
system
.
getResultFail
(
-
102
,
"
交付
状态不能为空"
);
}
}
if
(
!
ab
.
channelT
py
e
)
{
if
(
!
ab
.
channelT
yp
e
)
{
return
system
.
getResultFail
(
-
10
2
,
"渠道来源不能为空"
);
return
system
.
getResultFail
(
-
10
3
,
"渠道来源不能为空"
);
}
}
//获取方案信息
//获取方案信息
var
needsolutioninfo
=
await
this
.
needsolutionDao
.
model
.
findOne
({
var
needsolutioninfo
=
await
this
.
needsolutionDao
.
model
.
findOne
({
attributes
:
[
"id"
,
"status"
,
"solutionContent"
,
"needNo"
],
where
:
{
orderNo
:
ab
.
orderNo
},
raw
:
true
where
:
{
channelNeedNo
:
ab
.
channelNeedNo
},
raw
:
true
});
});
if
(
!
needsolutioninfo
||
!
needsolutioninfo
.
id
)
{
if
(
!
needsolutioninfo
||
!
needsolutioninfo
.
id
)
{
return
system
.
getResultFail
(
-
400
,
"未知方案"
);
return
system
.
getResultFail
(
-
400
,
"未知方案"
);
...
@@ -1177,8 +1178,9 @@ class AliyunQcService {
...
@@ -1177,8 +1178,9 @@ class AliyunQcService {
})
})
}
}
//提交方案
(文网文) 2020-9-27
//提交方案
async
submitWangwenSolution
(
pobj
)
{
async
submitWangwenSolution
(
pobj
)
{
console
.
log
(
'wangwen提交方案'
,
pobj
)
var
ab
=
pobj
.
actionBody
;
var
ab
=
pobj
.
actionBody
;
var
user
=
pobj
.
userInfo
;
var
user
=
pobj
.
userInfo
;
if
(
!
user
||
!
user
.
id
)
{
if
(
!
user
||
!
user
.
id
)
{
...
@@ -1316,7 +1318,7 @@ class AliyunQcService {
...
@@ -1316,7 +1318,7 @@ class AliyunQcService {
}
}
//关闭需求
(文网文) 2020-9-28
//关闭需求
async
closeNeed
(
pobj
)
{
async
closeNeed
(
pobj
)
{
var
ab
=
pobj
.
actionBody
;
var
ab
=
pobj
.
actionBody
;
var
app
=
pobj
.
appInfo
;
var
app
=
pobj
.
appInfo
;
...
@@ -1351,9 +1353,10 @@ class AliyunQcService {
...
@@ -1351,9 +1353,10 @@ class AliyunQcService {
//提交沟通记录
//提交沟通记录
async
recordLog
(
pobj
)
{
async
recordLog
(
pobj
)
{
// 查询需求沟通记录
// 查询需求沟通记录
//
2020 0820 lin
修改channel传过来的参数 为 note/needNo
// 修改channel传过来的参数 为 note/needNo
pobj
.
actionBody
.
Note
=
[
"noteTime"
,
moment
().
format
(
"YYYY-MM-DD HH:mm:ss"
),
"note"
,
pobj
.
actionBody
.
note
];
pobj
.
actionBody
.
Note
=
[
"noteTime"
,
moment
().
format
(
"YYYY-MM-DD HH:mm:ss"
),
"note"
,
pobj
.
actionBody
.
note
];
let
needRes
=
await
this
.
findOne
({
channelNeedNo
:
pobj
.
actionBody
.
needNo
});
let
needRes
=
await
this
.
needsolutionDao
.
findOne
({
channelNeedNo
:
pobj
.
actionBody
.
needNo
});
console
.
log
(
'needRes'
,
needRes
)
// 没有需求单直接返回
// 没有需求单直接返回
if
(
!
needRes
)
{
if
(
!
needRes
)
{
return
system
.
getResult
(
"没有这个需求单"
);
return
system
.
getResult
(
"没有这个需求单"
);
...
@@ -1366,7 +1369,8 @@ class AliyunQcService {
...
@@ -1366,7 +1369,8 @@ class AliyunQcService {
status
:
'ygj'
,
status
:
'ygj'
,
BizId
:
pobj
.
actionBody
.
needNo
BizId
:
pobj
.
actionBody
.
needNo
};
};
var
updateRes
=
await
this
.
customUpdate
(
sql
,
paramWhere
);
var
updateRes
=
await
this
.
orderinfoDao
.
customUpdate
(
sql
,
paramWhere
);
console
.
log
(
'updateRes'
,
updateRes
)
}
}
// 有需求单但没有沟通记录 直接set
// 有需求单但没有沟通记录 直接set
if
(
!
needRes
.
followContent
)
{
if
(
!
needRes
.
followContent
)
{
...
@@ -1375,7 +1379,7 @@ class AliyunQcService {
...
@@ -1375,7 +1379,7 @@ class AliyunQcService {
followContent
:
pobj
.
actionBody
.
Note
,
followContent
:
pobj
.
actionBody
.
Note
,
BizId
:
pobj
.
actionBody
.
needNo
BizId
:
pobj
.
actionBody
.
needNo
};
};
var
updateRes
=
await
this
.
customUpdate
(
sql
,
paramWhere
);
var
updateRes
=
await
this
.
orderinfoDao
.
customUpdate
(
sql
,
paramWhere
);
if
(
updateRes
[
1
])
{
if
(
updateRes
[
1
])
{
return
system
.
getResultSuccess
();
return
system
.
getResultSuccess
();
}
}
...
@@ -1388,7 +1392,8 @@ class AliyunQcService {
...
@@ -1388,7 +1392,8 @@ class AliyunQcService {
Note
:
pobj
.
actionBody
.
Note
,
Note
:
pobj
.
actionBody
.
Note
,
BizId
:
pobj
.
actionBody
.
needNo
BizId
:
pobj
.
actionBody
.
needNo
};
};
var
updateRes
=
await
this
.
customUpdate
(
sql
,
paramWhere
);
var
updateRes
=
await
this
.
orderinfoDao
.
customUpdate
(
sql
,
paramWhere
);
console
.
log
(
'updateRes'
,
updateRes
)
if
(
updateRes
[
1
])
{
if
(
updateRes
[
1
])
{
return
system
.
getResultSuccess
();
return
system
.
getResultSuccess
();
}
}
...
@@ -1396,5 +1401,379 @@ class AliyunQcService {
...
@@ -1396,5 +1401,379 @@ class AliyunQcService {
}
}
}
}
// ---------------- 食品 ----------------
/**
* 服务商提交服务操作
* 服务商通知状态变更
* (交付系统调用)
* (食品)
*/
async
foodServiceSubmitOption
(
pobj
)
{
console
.
log
(
pobj
)
var
ab
=
pobj
.
actionBody
;
var
user
=
pobj
.
userInfo
;
if
(
!
user
||
!
user
.
id
)
{
return
system
.
getResultFail
(
-
100
,
"未知用户"
);
}
if
(
!
ab
.
orderNo
)
{
return
system
.
getResultFail
(
-
101
,
"订单号不能为空"
);
}
if
(
!
ab
.
ApplicationStatus
)
{
return
system
.
getResultFail
(
-
102
,
"交付状态不能为空"
);
}
if
(
!
ab
.
channelType
)
{
return
system
.
getResultFail
(
-
102
,
"渠道来源不能为空"
);
}
//获取方案信息
var
needsolutioninfo
=
await
this
.
needsolutionDao
.
model
.
findOne
({
where
:
{
orderNo
:
ab
.
orderNo
},
raw
:
true
});
if
(
!
needsolutioninfo
||
!
needsolutioninfo
.
id
)
{
return
system
.
getResultFail
(
-
400
,
"未知方案"
);
}
if
(
!
needsolutioninfo
.
needNo
)
{
return
system
.
getResultFail
(
-
401
,
"方案需求信息有误"
);
}
var
solutionContent
=
needsolutioninfo
.
solutionContent
;
if
(
!
solutionContent
)
{
return
system
.
getResultFail
(
-
402
,
"方案交付信息有误"
);
}
// if (solutionContent.applicationStatus && solutionContent.applicationStatus > ab.ApplicationStatus) {
// return system.getResultFail(-403, "操作失败,交付流程未按顺序执行");
// }
// if (solutionContent.ApplicationStatus && solutionContent.ApplicationStatus == ab.ApplicationStatus) {
// return system.getResultFail(-405, "操作失败,该流程状态已提交,不能重复提交");
// }
//获取需求信息
var
needinfo
=
await
this
.
needinfoDao
.
model
.
findOne
({
where
:
{
needNo
:
needsolutioninfo
.
needNo
},
raw
:
true
});
if
(
!
needinfo
||
!
needinfo
.
id
)
{
return
system
.
getResultFail
(
-
201
,
"未知需求信息"
);
}
// if (needinfo.status == "ycd" || needinfo.status == "ygb") {
if
(
needinfo
.
status
==
"ygb"
)
{
return
system
.
getResultFail
(
-
202
,
"serviceProviderSubmitMateria"
+
needinfo
.
statusName
+
",不能执行此操作"
);
}
var
solutionFlowList
=
solutionContent
.
solutionFlowList
||
[];
if
(
ab
.
ApplicationStatus
==
601
)
{
//服务商提交资料
if
(
solutionContent
.
status
==
"USER_UPLOAD_PRODUCE"
||
solutionContent
.
status
==
"USER_REFUSE_PRODUCE"
)
{
solutionContent
.
ApplicationStatus
=
601
;
solutionFlowList
.
push
({
status
:
"PARTNER_SUBMIT_MATERIAL"
,
statusName
:
this
.
wangwenSolutionStatusReference
.
PARTNER_SUBMIT_MATERIAL
,
updated_at
:
new
Date
()
});
solutionContent
.
status
=
"PARTNER_SUBMIT_MATERIAL"
;
solutionContent
.
statusName
=
this
.
wangwenSolutionStatusReference
.
PARTNER_SUBMIT_MATERIAL
;
}
else
{
return
system
.
getResultFail
(
-
601
,
"交付流程错误,请先完成账户注册"
);
}
}
if
(
ab
.
ApplicationStatus
==
602
)
{
//完成账户注册
if
(
solutionContent
.
status
!=
"USER_CONFIRM_PRODUCE"
)
{
return
system
.
getResultFail
(
-
602
,
"交付流程错误,用户确认递交⽂件后才能执行此操作"
);
}
solutionFlowList
.
push
({
status
:
"CERT_ACCOUNT_REGISTERED"
,
statusName
:
this
.
wangwenSolutionStatusReference
.
CERT_ACCOUNT_REGISTERED
,
updated_at
:
new
Date
()
});
solutionContent
.
status
=
"CERT_ACCOUNT_REGISTERED"
;
solutionContent
.
statusName
=
this
.
wangwenSolutionStatusReference
.
CERT_ACCOUNT_REGISTERED
;
}
if
(
ab
.
ApplicationStatus
==
603
)
{
//服务商完成提交资料到⼯信部
if
(
solutionContent
.
status
!=
"CERT_ACCOUNT_REGISTERED"
)
{
return
system
.
getResultFail
(
-
603
,
"交付流程错误,请先完成资料递交"
);
}
solutionFlowList
.
push
({
status
:
"CERT_MATERIAL_SUBMITTED"
,
statusName
:
this
.
wangwenSolutionStatusReference
.
CERT_MATERIAL_SUBMITTED
,
updated_at
:
new
Date
()
});
solutionContent
.
status
=
"CERT_MATERIAL_SUBMITTED"
;
solutionContent
.
statusName
=
this
.
wangwenSolutionStatusReference
.
CERT_MATERIAL_SUBMITTED
;
}
if
(
ab
.
ApplicationStatus
==
604
)
{
//⼯商部已受理
if
(
solutionContent
.
status
!=
"CERT_MATERIAL_SUBMITTED"
)
{
return
system
.
getResultFail
(
-
604
,
"交付流程错误,请先完成资料递交"
);
}
solutionFlowList
.
push
({
status
:
"CERT_GXB_ACCEPT"
,
statusName
:
this
.
wangwenSolutionStatusReference
.
CERT_GXB_ACCEPT
,
updated_at
:
new
Date
()
});
solutionContent
.
status
=
"CERT_GXB_ACCEPT"
;
solutionContent
.
statusName
=
this
.
wangwenSolutionStatusReference
.
CERT_GXB_ACCEPT
;
}
if
(
ab
.
ApplicationStatus
==
605
)
{
//⼯商部不予受理
if
(
solutionContent
.
status
!=
"PARTNER_SUBMIT_MATERIAL"
)
{
return
system
.
getResultFail
(
-
605
,
"交付流程错误,请先完成资料递交"
);
}
solutionFlowList
.
push
({
status
:
"CERT_GXB_REFUSE"
,
statusName
:
this
.
wangwenSolutionStatusReference
.
CERT_GXB_REFUSE
,
updated_at
:
new
Date
()
});
solutionContent
.
status
=
"CERT_GXB_REFUSE"
;
needsolutioninfo
.
status
=
"ywc"
;
solutionContent
.
statusName
=
this
.
wangwenSolutionStatusReference
.
CERT_GXB_REFUSE
;
}
if
(
ab
.
ApplicationStatus
==
606
)
{
//⼯商部通过
if
(
solutionContent
.
status
!=
"CERT_GXB_ACCEPT"
)
{
return
system
.
getResultFail
(
-
606
,
"交付流程错误,⼯信部已受理后才能执行此操作"
);
}
solutionFlowList
.
push
({
status
:
"CERT_GXB_SUCCESS"
,
statusName
:
this
.
wangwenSolutionStatusReference
.
CERT_GXB_SUCCESS
,
updated_at
:
new
Date
()
});
needsolutioninfo
.
status
=
"ywc"
;
solutionContent
.
status
=
"CERT_GXB_SUCCESS"
;
solutionContent
.
statusName
=
this
.
wangwenSolutionStatusReference
.
CERT_GXB_SUCCESS
;
}
if
(
ab
.
ApplicationStatus
==
607
)
{
//⼯信部未通过
if
(
solutionContent
.
status
!=
"CERT_GXB_ACCEPT"
)
{
return
system
.
getResultFail
(
-
607
,
"交付流程错误,⼯信部已受理后才能执行此操作"
);
}
solutionFlowList
.
push
({
status
:
"CERT_GXB_FAIL"
,
statusName
:
this
.
wangwenSolutionStatusReference
.
CERT_GXB_FAIL
,
updated_at
:
new
Date
()
});
solutionContent
.
status
=
"CERT_GXB_FAIL"
;
needsolutioninfo
.
status
=
"ywc"
;
solutionContent
.
statusName
=
this
.
wangwenSolutionStatusReference
.
CERT_GXB_FAIL
;
}
solutionContent
.
solutionFlowList
=
solutionFlowList
;
var
applicationStatusList
=
solutionContent
.
applicationStatusList
||
[];
var
statusObj
=
{
"ApplicationStatus"
:
ab
.
ApplicationStatus
,
"ApplicationStatusName"
:
this
.
wangwenSolutionStatusReference
[
ab
.
ApplicationStatus
],
"created_at"
:
new
Date
()
};
applicationStatusList
.
push
(
statusObj
);
solutionContent
.
applicationStatusList
=
applicationStatusList
;
solutionContent
.
applicationStatus
=
ab
.
ApplicationStatus
;
needsolutioninfo
.
solutionContent
=
JSON
.
stringify
(
solutionContent
);
var
self
=
this
;
return
await
this
.
needsolutionDao
.
db
.
transaction
(
async
function
(
t
)
{
await
self
.
needsolutionDao
.
update
(
needsolutioninfo
,
t
);
statusObj
[
"BizId"
]
=
ab
.
BizId
;
return
system
.
getResultSuccess
(
statusObj
);
})
}
//提交方案
async
submitFoodSolution
(
pobj
)
{
console
.
log
(
'food提交方案'
,
pobj
)
var
ab
=
pobj
.
actionBody
;
var
user
=
pobj
.
userInfo
;
if
(
!
user
||
!
user
.
id
)
{
return
system
.
getResultFail
(
-
100
,
"未知用户"
);
}
ab
[
"createUserId"
]
=
user
.
id
;
if
(
!
ab
.
needNo
)
{
return
system
.
getResultFail
(
-
101
,
"渠道需求号不能为空"
);
}
if
(
!
ab
.
solutionContent
)
{
return
system
.
getResultFail
(
-
102
,
"方案信息有误"
);
}
//获取需求信息
var
needinfo
=
await
this
.
needinfoDao
.
model
.
findOne
({
where
:
{
channelNeedNo
:
ab
.
needNo
},
raw
:
true
});
if
(
!
needinfo
||
!
needinfo
.
id
)
{
return
system
.
getResultFail
(
-
201
,
"未知需求信息"
);
}
if
(
needinfo
.
status
==
"ycd"
||
needinfo
.
status
==
"ygb"
)
{
return
system
.
getResultFail
(
-
202
,
"该方案需求状态为"
+
needinfo
.
statusName
+
",不能创建方案"
);
}
var
bizType
=
needinfo
.
typeCode
;
//ab.solutionContent.bizType;//业务类型
ab
.
solutionContent
.
bizType
=
bizType
;
if
(
!
bizType
)
{
return
system
.
getResultFail
(
-
205
,
"方案类型错误"
);
}
// if (!bizType || !needinfo.typeCode || bizType != needinfo.typeCode) {
// return system.getResultFail(-205, "方案类型错误");
// }
if
(
!
needinfo
.
channelTypeCode
)
{
return
system
.
getResultFail
(
-
206
,
"渠道方案类型错误"
);
}
ab
.
solutionContent
.
typeCode
=
needinfo
.
typeCode
;
ab
.
solutionContent
.
typeName
=
needinfo
.
typeName
;
var
ns
=
await
this
.
needsolutionDao
.
model
.
findAll
({
where
:
{
channelNeedNo
:
ab
.
needNo
},
raw
:
true
,
order
:
[[
"id"
,
'asc'
]]
});
for
(
var
i
=
0
;
i
<
ns
.
length
;
i
++
)
{
var
fa
=
ns
[
i
];
if
(
fa
.
status
==
"dqr"
||
fa
.
status
==
"ywc"
)
{
return
system
.
getResultFail
(
-
207
,
"需求方案已存在,不能重复提交"
);
}
if
(
fa
.
status
==
"ybh"
)
{
ab
.
channelSolutionNo
=
fa
.
channelSolutionNo
;
}
if
(
fa
.
status
==
"yzf"
)
{
ab
.
channelSolutionNo
=
""
;
}
}
var
solution
=
ab
.
solutionContent
.
solution
;
if
(
!
solution
)
{
return
system
.
getResultFail
(
-
103
,
"方案交付信息有误"
);
}
if
(
needinfo
.
channelTypeCode
==
"esp.food"
)
{
//esp.food
ab
.
solutionContent
.
solution
.
IcpType
=
"food"
;
}
else
{
return
system
.
getResultFail
(
-
208
,
"需求业务类型有误"
);
}
if
(
!
solution
.
CompanyName
)
{
return
system
.
getResultFail
(
-
105
,
"企业名称不能为空"
);
}
if
(
!
solution
.
licenseType
)
{
return
system
.
getResultFail
(
-
106
,
"网文类型不能为空"
);
}
if
(
!
solution
.
actionType
)
{
return
system
.
getResultFail
(
-
106
,
"办理类型不能为空"
);
}
if
(
!
solution
.
companyLocation
)
{
return
system
.
getResultFail
(
-
107
,
"区域不能为空"
);
}
if
(
!
solution
.
solutionPrice
)
{
return
system
.
getResultFail
(
-
108
,
"办理价格不能为空"
);
}
else
{
solution
.
solutionPrice
=
solution
.
solutionPrice
/
100
;
}
var
solutionFlowList
=
ab
.
solutionContent
.
solutionFlowList
||
[];
solutionFlowList
.
push
({
status
:
"SOLUTION_SUBMIT"
,
statusName
:
this
.
wangwenSolutionStatusReference
.
SOLUTION_SUBMIT
,
updated_at
:
new
Date
()
});
ab
.
solutionContent
.
status
=
"SOLUTION_SUBMIT"
;
ab
.
solutionContent
.
statusName
=
this
.
wangwenSolutionStatusReference
.
SOLUTION_SUBMIT
;
ab
.
solutionContent
.
solutionFlowList
=
solutionFlowList
;
ab
[
"channelNeedNo"
]
=
needinfo
.
channelNeedNo
;
var
solutionNo
=
await
this
.
getBusUid
(
"ns"
);
ab
[
"solutionNo"
]
=
solutionNo
;
ab
[
"status"
]
=
"dqr"
;
var
customerInfo
=
{
//客户信息
"publishName"
:
needinfo
.
publishName
,
"publishMobile"
:
needinfo
.
publishMobile
};
var
salesmanInfo
=
{
//业务员信息
"salesmanName"
:
user
.
channel_username
,
"salesmanMobile"
:
user
.
mobile
,
"salesmanId"
:
user
.
id
,
"salesmanChannelId"
:
user
.
channel_userid
};
ab
.
solutionContent
[
"customerInfo"
]
=
customerInfo
;
ab
.
solutionContent
[
"salesmanInfo"
]
=
salesmanInfo
;
ab
.
solutionContent
=
JSON
.
stringify
(
ab
.
solutionContent
);
var
self
=
this
;
return
await
this
.
needsolutionDao
.
db
.
transaction
(
async
function
(
t
)
{
ab
[
"needNo"
]
=
needinfo
.
needNo
;
var
od
=
await
self
.
needsolutionDao
.
create
(
ab
,
t
);
if
(
od
&&
od
.
id
)
{
var
needObj
=
{
id
:
needinfo
.
id
};
if
(
!
needinfo
.
followManUserId
)
{
needObj
=
{
id
:
needinfo
.
id
,
followManUserId
:
user
.
id
,
//跟进人id
followManName
:
user
.
channel_username
,
//跟进人姓名
followManMobile
:
user
.
mobile
,
//跟进人手机号(合伙人)
followManOnlyCode
:
user
.
channel_userid
};
}
if
(
!
needinfo
.
followContent
)
{
var
followContent
=
[{
followDate
:
new
Date
(),
content
:
"food提交方案"
}];
followContent
=
JSON
.
stringify
(
followContent
);
needObj
[
"followContent"
]
=
followContent
;
}
await
self
.
needinfoDao
.
update
(
needObj
,
t
);
needinfo
=
await
self
.
needinfoDao
.
model
.
findOne
({
where
:
{
id
:
needinfo
.
id
},
raw
:
true
});
return
system
.
getResultSuccess
({
needinfo
:
needinfo
,
needsolution
:
od
});
}
else
{
return
system
.
getResultFail
(
-
302
,
"提交方案失败"
);
}
})
}
//关闭需求
async
foodCloseNeed
(
pobj
)
{
var
ab
=
pobj
.
actionBody
;
var
app
=
pobj
.
appInfo
;
if
(
!
app
||
!
app
.
uapp_id
)
{
return
system
.
getResultFail
(
-
100
,
"未知渠道"
);
}
if
(
!
ab
.
needNo
)
{
return
system
.
getResultFail
(
-
101
,
"需求编号不能为空"
);
}
if
(
!
ab
.
note
)
{
return
system
.
getResultFail
(
-
106
,
"关闭理由不能为空"
);
}
//获取需求信息
var
needinfo
=
await
this
.
needinfoDao
.
model
.
findOne
({
attributes
:
[
"id"
,
"status"
,
"statusName"
,
"needNo"
],
where
:
{
channelNeedNo
:
ab
.
needNo
},
raw
:
true
});
if
(
!
needinfo
||
!
needinfo
.
id
)
{
return
system
.
getResultFail
(
-
201
,
"未知需求信息"
);
}
if
(
needinfo
.
status
==
"ygb"
)
{
return
system
.
getResultFail
(
-
202
,
"该方案需求状态为"
+
needinfo
.
statusName
+
",不能执行此操作"
);
}
var
updateNeed
=
await
this
.
needinfoDao
.
update
(
needObj
);
//关闭需求
if
(
!
updateNeed
)
{
return
system
.
getResultFail
(
-
203
,
"关闭需求失败"
);
}
else
{
return
system
.
getResultSuccess
();
}
}
//提交沟通记录
async
foodRecordLog
(
pobj
)
{
// 查询需求沟通记录
// 修改channel传过来的参数 为 note/needNo
pobj
.
actionBody
.
Note
=
[
"noteTime"
,
moment
().
format
(
"YYYY-MM-DD HH:mm:ss"
),
"note"
,
pobj
.
actionBody
.
note
];
let
needRes
=
await
this
.
needsolutionDao
.
findOne
({
channelNeedNo
:
pobj
.
actionBody
.
needNo
});
console
.
log
(
'needRes'
,
needRes
)
// 没有需求单直接返回
if
(
!
needRes
)
{
return
system
.
getResult
(
"没有这个需求单"
);
}
// 如果未推送/以推送 修改为已跟进
if
(
needRes
.
status
==
"wts"
||
needRes
.
status
==
"yts"
)
{
var
sql
=
"update n_need_info set status=:status, statusName=:statusName where channelNeedNo=:BizId"
var
paramWhere
=
{
statusName
:
'已跟进'
,
status
:
'ygj'
,
BizId
:
pobj
.
actionBody
.
needNo
};
var
updateRes
=
await
this
.
orderinfoDao
.
customUpdate
(
sql
,
paramWhere
);
console
.
log
(
'updateRes'
,
updateRes
)
}
// 有需求单但没有沟通记录 直接set
if
(
!
needRes
.
followContent
)
{
var
sql
=
"update n_need_info set followContent=JSON_OBJECT(:followContent) where channelNeedNo=:BizId"
var
paramWhere
=
{
followContent
:
pobj
.
actionBody
.
Note
,
BizId
:
pobj
.
actionBody
.
needNo
};
var
updateRes
=
await
this
.
orderinfoDao
.
customUpdate
(
sql
,
paramWhere
);
if
(
updateRes
[
1
])
{
return
system
.
getResultSuccess
();
}
return
system
.
getResult
(
"添加记录失败"
);
// 有需求单有沟通记录 json_array_append
}
else
{
var
sql
=
"update n_need_info set followContent=json_array_append(followContent, '$', JSON_OBJECT(:Note)) where channelNeedNo=:BizId"
// var sql = "update n_need_info set followContent=json_array_append(followContent, '$', "+ "\"" + JSON.stringify(pobj.actionBody.Note) + "\""+") where channelNeedNo="+ "\"" +pobj.actionBody.BizId +"\"" +" "
var
paramWhere
=
{
Note
:
pobj
.
actionBody
.
Note
,
BizId
:
pobj
.
actionBody
.
needNo
};
var
updateRes
=
await
this
.
orderinfoDao
.
customUpdate
(
sql
,
paramWhere
);
console
.
log
(
'updateRes'
,
updateRes
)
if
(
updateRes
[
1
])
{
return
system
.
getResultSuccess
();
}
return
system
.
getResult
(
"添加记录失败"
);
}
}
}
}
module
.
exports
=
AliyunQcService
;
module
.
exports
=
AliyunQcService
;
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