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
6f3412a1
Commit
6f3412a1
authored
Jun 28, 2020
by
sxy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 统计 分组 年月日
parent
0739419f
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
202 additions
and
135 deletions
+202
-135
ic-deliver/app/base/api/impl/bizDeliver/bizChance.js
+13
-10
ic-deliver/app/base/api/impl/bizDeliver/deliver.js
+16
-13
ic-deliver/app/base/controller/impl/bizchance/bizoptCtl.js
+57
-51
ic-deliver/app/base/controller/impl/bizchance/deliverybillCtl.js
+19
-10
ic-deliver/app/base/db/impl/bizchance/bizoptDao.js
+7
-7
ic-deliver/app/base/service/impl/bizchance/bizoptSve.js
+55
-44
ic-deliver/app/base/service/impl/bizchance/deliverybillSve.js
+0
-0
ic-deliver/app/base/service/impl/bizchance/schemeSve.js
+1
-0
ic-deliver/app/base/utils/dateClient.js
+34
-0
No files found.
ic-deliver/app/base/api/impl/bizDeliver/bizChance.js
View file @
6f3412a1
...
...
@@ -4,7 +4,8 @@ var settings = require("../../../../config/settings");
class
BizChanceAPI
extends
APIBase
{
constructor
()
{
super
();
this
.
bizChanceS
=
system
.
getObject
(
"service.bizchance.bizoptSve"
)
this
.
bizChanceS
=
system
.
getObject
(
"service.bizchance.bizoptSve"
);
this
.
dateUtil
=
system
.
getObject
(
"util.dateClient"
);
}
/**
* 按照服务商进行分组统计
...
...
@@ -13,9 +14,10 @@ class BizChanceAPI extends APIBase {
* @param {*} req
*/
async
statBizChanceCountBySp
(
p
,
q
,
req
){
let
bizStatus
=
p
.
bizStatus
let
rtn
=
await
this
.
bizChanceS
.
statBizChanceCountBySp
(
bizStatus
)
async
statBizChanceCountBySp
(
p
,
q
,
req
)
{
let
bizStatus
=
p
.
bizStatus
let
betweenTime
=
this
.
dateUtil
.
betweenTime
(
p
.
dateType
);
let
rtn
=
await
this
.
bizChanceS
.
statBizChanceCountBySp
(
bizStatus
,
betweenTime
)
return
system
.
getResult
(
rtn
)
}
...
...
@@ -27,12 +29,13 @@ class BizChanceAPI extends APIBase {
* @param {*} q
* @param {*} req
*/
async
statBizChance
(
p
,
q
,
req
){
let
companyId
=
p
.
company_id
let
userid
=
p
.
userid
let
username
=
p
.
username
let
opath
=
p
.
opath
let
rtn
=
await
this
.
bizChanceS
.
statBizChance
(
companyId
,
opath
,
username
,
userid
)
async
statBizChance
(
p
,
q
,
req
)
{
let
companyId
=
p
.
company_id
let
userid
=
p
.
userid
let
username
=
p
.
username
let
opath
=
p
.
opath
let
betweenTime
=
this
.
dateUtil
.
betweenTime
(
p
.
dateType
);
let
rtn
=
await
this
.
bizChanceS
.
statBizChance
(
companyId
,
opath
,
username
,
userid
,
betweenTime
);
return
system
.
getResult
(
rtn
)
}
classDesc
()
{
...
...
ic-deliver/app/base/api/impl/bizDeliver/deliver.js
View file @
6f3412a1
...
...
@@ -4,16 +4,18 @@ var settings = require("../../../../config/settings");
class
BizDeliverAPI
extends
APIBase
{
constructor
()
{
super
();
this
.
bizDeliveryS
=
system
.
getObject
(
"service.bizchance.deliverybillSve"
)
this
.
bizDeliveryS
=
system
.
getObject
(
"service.bizchance.deliverybillSve"
)
this
.
dateUtil
=
system
.
getObject
(
"util.dateClient"
);
}
async
statBizDeliveryCountBySp
(
p
,
q
,
req
){
let
bizStatus
=
p
.
bizStatus
let
rtn
=
await
this
.
bizDeliveryS
.
statBizDeliveryCountBySp
(
bizStatus
)
async
statBizDeliveryCountBySp
(
p
,
q
,
req
)
{
let
bizStatus
=
p
.
bizStatus
;
let
betweenTime
=
this
.
dateUtil
.
betweenTime
(
p
.
dateType
);
let
rtn
=
await
this
.
bizDeliveryS
.
statBizDeliveryCountBySp
(
bizStatus
,
betweenTime
)
return
system
.
getResult
(
rtn
)
}
async
statBizDeliverySettleAmountBySp
(
p
,
q
,
req
)
{
let
bizStatus
=
p
.
bizStatus
let
rtn
=
await
this
.
bizDeliveryS
.
statBizDeliverySettleAmountBySp
(
bizStatus
)
async
statBizDeliverySettleAmountBySp
(
p
,
q
,
req
)
{
let
bizStatus
=
p
.
bizStatus
let
rtn
=
await
this
.
bizDeliveryS
.
statBizDeliverySettleAmountBySp
(
bizStatus
)
return
system
.
getResult
(
rtn
)
}
/**
...
...
@@ -24,12 +26,13 @@ class BizDeliverAPI extends APIBase {
* @param {*} q
* @param {*} req
*/
async
statBizDelivery
(
p
,
q
,
req
){
let
companyId
=
p
.
company_id
let
userid
=
p
.
userid
let
username
=
p
.
username
let
opath
=
p
.
opath
let
rtn
=
await
this
.
bizDeliveryS
.
statBizDelivery
(
companyId
,
opath
,
username
,
userid
)
async
statBizDelivery
(
p
,
q
,
req
)
{
let
companyId
=
p
.
company_id
let
userid
=
p
.
userid
let
username
=
p
.
username
let
opath
=
p
.
opath
let
betweenTime
=
this
.
dateUtil
.
betweenTime
(
p
.
dateType
);
let
rtn
=
await
this
.
bizDeliveryS
.
statBizDelivery
(
companyId
,
opath
,
username
,
userid
,
betweenTime
)
return
system
.
getResult
(
rtn
)
}
classDesc
()
{
...
...
ic-deliver/app/base/controller/impl/bizchance/bizoptCtl.js
View file @
6f3412a1
...
...
@@ -12,6 +12,7 @@ class BizOptCtl extends CtlBase {
this
.
logService
=
system
.
getObject
(
"service.bizchance.statuslogSve"
);
this
.
receiveUrl
=
"http://192.168.1.140:4011/api/receive/entService/springBoard"
;
this
.
queueUrl
=
"http://192.168.1.128:4018/api/queueAction/producer/springBoard"
;
this
.
dateUtil
=
system
.
getObject
(
"util.dateClient"
);
}
/*根据用户id获取商机信息,分页获取*/
...
...
@@ -19,7 +20,13 @@ class BizOptCtl extends CtlBase {
try
{
//TODO 根据业务员id获取该业务员所有列表
//设置查询条件
console
.
log
(
"pobj--"
,
pobj
)
console
.
log
(
"pobj--"
,
pobj
)
if
(
pobj
.
search
&&
pobj
.
search
.
dateType
)
{
if
(
pobj
.
search
.
dateType
!==
'全部'
)
{
pobj
.
search
.
created_at
=
this
.
dateUtil
.
betweenTime
(
pobj
.
search
.
dateType
);
}
delete
pobj
.
search
.
dateType
}
const
rs
=
await
this
.
service
.
findAndCountAll
(
pobj
);
let
rarr
=
[];
let
results
=
rs
.
results
.
rows
;
...
...
@@ -48,29 +55,28 @@ class BizOptCtl extends CtlBase {
}
/*根据商机编号获取商机详情*/
async
findInfoByDemandCode
(
mobj
,
qobj
,
req
)
{
async
findInfoByDemandCode
(
mobj
,
qobj
,
req
)
{
var
pobj
=
mobj
.
d
;
if
(
pobj
.
businessMode
&&
pobj
.
businessMode
!=
'undefined'
)
{
try
{
if
(
pobj
.
businessMode
&&
pobj
.
businessMode
!=
'undefined'
)
{
try
{
var
rs
=
await
this
.
service
.
findInfoByDemandCode
(
pobj
);
var
ms
=
await
this
.
schemeService
.
findInfoByDemandCode
(
pobj
);
var
rarr
=
{}
if
(
rs
){
var
statusInfo
=
{
"currentStatus"
:
rs
.
business_status
};
//商机状态
if
(
rs
)
{
var
statusInfo
=
{
"currentStatus"
:
rs
.
business_status
};
//商机状态
var
businessInfo
=
{};
businessInfo
.
businessMode
=
rs
.
demand_code
;
//商机编号
businessInfo
.
channelSource
=
appconfig
.
pdict
.
source
[
rs
.
source_name
];
///渠道来源
// businessInfo.businessType = rs.business_type;//商机类型代码
businessInfo
.
businessType
=
appconfig
.
pdict
.
businessType
[
rs
.
business_type
];
//商机类型名称
// businessInfo.serviceArea = rs.service_address;//服务地区
if
(
businessInfo
.
businessName
==
"云上园区注册"
){
if
(
businessInfo
.
businessName
==
"云上园区注册"
)
{
businessInfo
.
serviceArea
=
appconfig
.
pdict
.
registeredParkDict
[
rs
.
service_address
];
//服务地区名称
}
else
{
else
{
businessInfo
.
serviceArea
=
appconfig
.
pdict
.
registeredAreaDict
[
rs
.
service_address
];
//服务地区名称
}
if
(
businessInfo
.
businessName
==
"注册地址"
){
if
(
businessInfo
.
businessName
==
"注册地址"
)
{
businessInfo
.
registeredAddress
=
appconfig
.
pdict
.
registeredAreaDict
[
rs
.
service_address
];
//注册地址名称
}
businessInfo
.
statusReason
=
rs
.
close_reason
;
//商机关闭原因
...
...
@@ -81,14 +87,14 @@ class BizOptCtl extends CtlBase {
rarr
.
statusInfo
=
statusInfo
;
rarr
.
businessInfo
=
businessInfo
;
}
if
(
ms
){
if
(
ms
)
{
var
planInfo
=
ms
.
scheme_info
;
planInfo
.
schemeNumber
=
ms
.
scheme_number
;
planInfo
.
currentStatus
=
ms
.
scheme_status
;
if
(
ms
.
scheme_status
&&
ms
.
scheme_status
==
"isReject"
)
{
if
(
ms
.
scheme_status
&&
ms
.
scheme_status
==
"isReject"
)
{
planInfo
.
currentStatus
=
"已退回"
;
}
else
{
else
{
planInfo
.
currentStatus
=
ms
.
scheme_status
;
}
planInfo
.
statusReason
=
ms
.
reject_reason
;
...
...
@@ -96,103 +102,103 @@ class BizOptCtl extends CtlBase {
}
return
system
.
getResult
(
rarr
);
}
catch
(
error
)
{
catch
(
error
)
{
console
.
log
(
"eeeeeeeeeeeeeeeeeeeeee"
);
console
.
log
(
error
);
return
system
.
getResultError
(
error
);
}
}
else
{
else
{
return
system
.
getResultError
(
"参数错误!"
);
}
}
/*根据商机编号更新商机状态*/
async
updateStatusByDemandCode
(
mobj
,
qobj
,
req
)
{
async
updateStatusByDemandCode
(
mobj
,
qobj
,
req
)
{
var
pobj
=
mobj
.
d
;
if
(
pobj
.
businessMode
&&
pobj
.
businessMode
!=
'undefined'
&&
pobj
.
currentStatus
&&
pobj
.
currentStatus
!=
'undefined'
){
try
{
if
(
pobj
.
businessMode
&&
pobj
.
businessMode
!=
'undefined'
&&
pobj
.
currentStatus
&&
pobj
.
currentStatus
!=
'undefined'
)
{
try
{
await
this
.
service
.
updateStatusByDemandCode
(
pobj
);
await
this
.
schemeService
.
updateStatusByDemandCode
(
pobj
);
//同时更新方案的状态
var
res
=
this
.
service
.
findInfoByDemandCode
(
pobj
);
if
(
res
&&
res
!=
'undefined'
){
if
(
res
&&
res
!=
'undefined'
)
{
var
logInfo
=
{
"flowType"
:
"BIZ"
,
"flowId"
:
res
.
id
,
"statusCode"
:
pobj
.
currentStatus
,
"statusReason"
:
res
.
close_reason
,
"clerkName"
:
res
.
salesman_name
,
"clerkId"
:
res
.
salesman_id
"flowType"
:
"BIZ"
,
"flowId"
:
res
.
id
,
"statusCode"
:
pobj
.
currentStatus
,
"statusReason"
:
res
.
close_reason
,
"clerkName"
:
res
.
salesman_name
,
"clerkId"
:
res
.
salesman_id
}
await
this
.
logService
.
insertInfo
(
logInfo
);
//插入状态日至表
}
if
(
pobj
.
currentStatus
==
"isClosed"
){
//关闭需求时调用
if
(
pobj
.
currentStatus
==
"isClosed"
)
{
//关闭需求时调用
var
rc
=
system
.
getObject
(
"util.execClient"
);
var
requrl
=
this
.
queueUrl
;
var
params
=
{
"actionType"
:
"produceData"
,
"actionBody"
:{
"pushUrl"
:
this
.
receiveUrl
,
"actionType"
:
"closeNeed"
,
"identifyCode"
:
"ic-manage"
,
"messageBody"
:{
"actionType"
:
"produceData"
,
"actionBody"
:
{
"pushUrl"
:
this
.
receiveUrl
,
"actionType"
:
"closeNeed"
,
"identifyCode"
:
"ic-manage"
,
"messageBody"
:
{
"needNum"
:
pobj
.
businessMode
,
"note"
:
pobj
.
statusReason
"note"
:
pobj
.
statusReason
}
}
}
var
rtn
=
await
rc
.
execPost
(
params
,
requrl
);
var
j
=
JSON
.
parse
(
rtn
.
stdout
);
if
(
j
.
status
==
1
){
if
(
j
.
status
==
1
)
{
return
system
.
getResult
(
"操作成功!"
);
}
else
{
else
{
return
system
.
getResultError
(
"更新方案状态出错!"
);
}
}
}
catch
(
error
){
catch
(
error
)
{
return
system
.
getResultError
(
error
);
}
}
else
{
else
{
return
system
.
getResultError
(
"参数错误!"
);
}
}
/*插入数据信息 */
async
insertInfo
(
nobj
,
qobj
,
req
)
{
async
insertInfo
(
nobj
,
qobj
,
req
)
{
var
pobj
=
nobj
.
d
;
if
(
pobj
.
businessMode
&&
pobj
.
businessMode
!=
'undefined'
&&
pobj
.
businessType
&&
pobj
.
businessType
!=
'undefined'
){
try
{
if
(
pobj
.
businessMode
&&
pobj
.
businessMode
!=
'undefined'
&&
pobj
.
businessType
&&
pobj
.
businessType
!=
'undefined'
)
{
try
{
pobj
.
currentStatus
=
"beforeSubmission"
;
//加上当前状态为待提交方案
pobj
.
channelSource
=
"tencentCloud"
;
//目前渠道只有腾讯
pobj
.
sourceNumber
=
"1111111"
;
pobj
.
businessType
=
appconfig
.
pdict
.
dyDict
[
pobj
.
businessType
];
var
buInfo
=
await
this
.
service
.
insertInfo
(
pobj
);
var
logInfo
=
{
"flowType"
:
"BIZ"
,
"flowId"
:
buInfo
.
id
,
"statusCode"
:
pobj
.
currentStatus
,
"clerkName"
:
pobj
.
clerkName
,
"clerkId"
:
pobj
.
salesmanId
"flowType"
:
"BIZ"
,
"flowId"
:
buInfo
.
id
,
"statusCode"
:
pobj
.
currentStatus
,
"clerkName"
:
pobj
.
clerkName
,
"clerkId"
:
pobj
.
salesmanId
}
await
this
.
logService
.
insertInfo
(
logInfo
);
//插入状态日至表
return
{
"status"
:
1
,
//1代表成功,否则失败
"message"
:
"操作成功"
,
"data"
:
""
,
"requestId"
:
""
"status"
:
1
,
//1代表成功,否则失败
"message"
:
"操作成功"
,
"data"
:
""
,
"requestId"
:
""
};
}
catch
(
error
)
{
catch
(
error
)
{
console
.
log
(
"TTTTTTTTTTTTTTTTTTTTTTT"
);
console
.
log
(
error
);
return
system
.
getResultError
(
error
);
}
}
else
{
else
{
return
system
.
getResultError
(
"参数错误!"
);
}
}
...
...
ic-deliver/app/base/controller/impl/bizchance/deliverybillCtl.js
View file @
6f3412a1
...
...
@@ -15,12 +15,20 @@ class DeliverybillCtl extends CtlBase {
this
.
receiveUrl
=
"http://192.168.1.140:4011/api/receive/entService/springBoard"
;
this
.
queueUrl
=
"http://192.168.1.128:4018/api/queueAction/producer/springBoard"
;
this
.
wdyUrl
=
"http://192.168.1.113:4011/api/action/order/springBoard"
;
this
.
dateUtil
=
system
.
getObject
(
"util.dateClient"
);
}
/*根据用户id获取商机信息,分页获取*/
async
findAndCountAll
(
pobj
,
qobj
,
req
)
{
try
{
//TODO 根据业务员id获取该业务员所有交付单列表
if
(
pobj
.
search
&&
pobj
.
search
.
dateType
)
{
if
(
pobj
.
search
.
dateType
!==
'全部'
)
{
pobj
.
search
.
created_at
=
this
.
dateUtil
.
betweenTime
(
pobj
.
search
.
dateType
);
}
delete
pobj
.
search
.
dateType
}
const
rs
=
await
this
.
service
.
findAndCountAll
(
pobj
);
let
rarr
=
[];
let
results
=
rs
.
results
.
rows
;
...
...
@@ -51,7 +59,7 @@ class DeliverybillCtl extends CtlBase {
}
else
if
(
robj
.
businessName
==
'云上园区注册'
)
{
robj
.
registeredType
=
element
.
delivery_info
.
registeredType
;
//园区注册时,根据该值跳界面
if
(
robj
.
baseInfo
.
isWhether
==
"yes"
||
robj
.
baseInfo
.
financial
==
"yes"
)
{
//如果有刻章需求或者是财税服务
if
(
robj
.
baseInfo
.
isWhether
==
"yes"
||
robj
.
baseInfo
.
financial
==
"yes"
)
{
//如果有刻章需求或者是财税服务
robj
.
relatedProducts
=
'有'
;
}
else
{
...
...
@@ -74,6 +82,7 @@ class DeliverybillCtl extends CtlBase {
rs
.
results
.
rows
=
rarr
;
return
system
.
getResult
(
rs
);
}
catch
(
error
)
{
console
.
log
(
error
)
return
system
.
getResultError
(
error
);
}
}
...
...
@@ -184,9 +193,9 @@ class DeliverybillCtl extends CtlBase {
rarr
.
baseInfo
.
startTime
=
rs
.
delivery_info
.
startTime
;
//开始计费时间
}
if
(
rs
.
delivery_info
.
buyDuration
&&
rs
.
delivery_info
.
buyDuration
!=
'undefined'
&&
rarr
.
baseInfo
.
startTime
&&
rarr
.
baseInfo
.
startTime
!=
'undefined'
)
{
console
.
log
(
"ddddddddddd____________________________"
+
rarr
.
baseInfo
.
startTime
);
console
.
log
(
"ddddddddddd____________________________"
+
rarr
.
baseInfo
.
startTime
);
var
d
=
new
Date
(
rarr
.
baseInfo
.
startTime
);
console
.
log
(
"ddddddddddd____________________________"
+
d
);
console
.
log
(
"ddddddddddd____________________________"
+
d
);
rarr
.
baseInfo
.
endTime
=
this
.
oneYearPast
(
d
,
1
);
//到期时间
var
ss
=
moment
();
rarr
.
baseInfo
.
surplusDuration
=
this
.
diffDays
(
ss
,
rarr
.
baseInfo
.
endTime
);
//剩余时长
...
...
@@ -227,8 +236,8 @@ class DeliverybillCtl extends CtlBase {
async
updatestartTimeByDeliverCode
(
mobj
,
qobj
,
red
)
{
//根据交付单编号更新开始计费时间
var
pobj
=
mobj
.
d
;
if
(
pobj
.
deliverNumber
&&
pobj
.
deliverNumber
!=
'undefined'
&&
pobj
.
baseInfo
.
startTime
&&
pobj
.
baseInfo
.
startTime
!=
'undefined'
){
try
{
if
(
pobj
.
deliverNumber
&&
pobj
.
deliverNumber
!=
'undefined'
&&
pobj
.
baseInfo
.
startTime
&&
pobj
.
baseInfo
.
startTime
!=
'undefined'
)
{
try
{
var
rs
=
await
this
.
service
.
findInfoByDeliverCode
(
pobj
)
//先得到交付单详情
if
(
rs
&&
rs
!=
'undefined'
)
{
rs
.
delivery_info
.
startTime
=
pobj
.
baseInfo
.
startTime
;
...
...
@@ -289,11 +298,11 @@ class DeliverybillCtl extends CtlBase {
return
system
.
getResultError
(
"数据不存在!"
);
}
}
catch
(
error
)
{
catch
(
error
)
{
return
system
.
getResultError
(
error
);
}
}
else
{
else
{
return
system
.
getResultError
(
"参数错误!"
);
}
}
...
...
@@ -324,7 +333,7 @@ class DeliverybillCtl extends CtlBase {
var
j
=
JSON
.
parse
(
rtn
.
stdout
);
var
j1status
=
1
;
if
(
pobj
.
deliverStatus
==
"closed"
){
//退款
if
(
pobj
.
deliverStatus
==
"closed"
)
{
//退款
params
=
{
"actionType"
:
"produceData"
,
"actionBody"
:
{
...
...
@@ -781,7 +790,7 @@ class DeliverybillCtl extends CtlBase {
//time时间n年后的的前一天
oneYearPast
(
time
,
n
)
{
//var time=new Date();
try
{
try
{
var
year
=
time
.
getFullYear
()
+
n
;
var
d
=
time
.
setFullYear
(
year
);
var
date
=
time
.
getDate
(
d
)
-
1
;
...
...
@@ -796,7 +805,7 @@ class DeliverybillCtl extends CtlBase {
//计算俩日期相差多少天
diffDays
(
time1
,
time2
)
{
try
{
try
{
var
m1
=
moment
(
time1
);
var
m2
=
moment
(
time2
);
return
m2
.
diff
(
m1
,
'day'
);
...
...
ic-deliver/app/base/db/impl/bizchance/bizoptDao.js
View file @
6f3412a1
...
...
@@ -15,7 +15,7 @@ class BizoptDao extends Dao {
qw
[
"facilitator_id"
]
=
Number
(
qobj
.
company_id
)
// 为空说明是管理员,不需设置组织结构过滤
if
(
qobj
.
opath
&&
qobj
.
opath
!=
""
)
{
qw
[
"salesman_opcode"
]
=
{
[
this
.
db
.
Op
.
like
]:
'%qobj.opath%'
}
qw
[
"salesman_opcode"
]
=
{
[
this
.
db
.
Op
.
like
]:
'%qobj.opath%'
}
}
//不是来自平台前端查询
if
(
qobj
.
bizpath
&&
qobj
.
bizpath
.
indexOf
(
"pmx"
)
<
0
)
{
...
...
@@ -45,7 +45,7 @@ class BizoptDao extends Dao {
if
(
qobj
.
statusReason
&&
qobj
.
statusReason
!=
'undefined'
)
{
setobj
[
"close_reason"
]
=
qobj
.
statusReason
;
}
else
{
else
{
setobj
[
"close_reason"
]
=
""
;
}
var
whereobj
=
{
"demand_code"
:
qobj
.
businessMode
};
...
...
@@ -58,7 +58,7 @@ class BizoptDao extends Dao {
"demand_code"
:
qobj
.
businessMode
,
"business_type"
:
qobj
.
businessType
,
"business_status"
:
qobj
.
currentStatus
,
"business_info"
:{}
"business_info"
:
{}
};
if
(
qobj
.
channelSource
&&
qobj
.
channelSource
!=
'undefined'
)
{
obj
.
source_name
=
qobj
.
channelSource
;
...
...
@@ -81,16 +81,16 @@ class BizoptDao extends Dao {
if
(
qobj
.
contactsPhone
&&
qobj
.
contactsPhone
!=
'undefined'
)
{
obj
.
business_info
.
contactsPhone
=
qobj
.
contactsPhone
;
}
if
(
qobj
.
serviceName
&&
qobj
.
serviceName
!=
'undefined'
){
if
(
qobj
.
serviceName
&&
qobj
.
serviceName
!=
'undefined'
)
{
obj
.
business_info
.
serviceName
=
qobj
.
serviceName
;
}
if
(
qobj
.
businessName
&&
qobj
.
businessName
!=
'undefined'
){
if
(
qobj
.
businessName
&&
qobj
.
businessName
!=
'undefined'
)
{
obj
.
business_info
.
businessName
=
qobj
.
businessName
;
}
if
(
qobj
.
UserName
&&
qobj
.
UserName
!=
'undefined'
){
if
(
qobj
.
UserName
&&
qobj
.
UserName
!=
'undefined'
)
{
obj
.
business_info
.
userName
=
qobj
.
UserNames
;
}
if
(
qobj
.
companyName
&&
qobj
.
companyName
!=
'undefined'
){
if
(
qobj
.
companyName
&&
qobj
.
companyName
!=
'undefined'
)
{
obj
.
business_info
.
companyName
=
qobj
.
companyName
;
}
if
(
qobj
.
servicerCode
&&
qobj
.
servicerCode
!=
'undefined'
)
{
...
...
ic-deliver/app/base/service/impl/bizchance/bizoptSve.js
View file @
6f3412a1
...
...
@@ -6,18 +6,21 @@ class BizOptService extends ServiceBase {
constructor
()
{
super
(
"bizchance"
,
ServiceBase
.
getDaoName
(
BizOptService
));
}
async
statBizChanceCountBySp
(
bizStatus
)
{
let
params
=
{}
params
.
group
=
{
byFields
:
[
'facilitator_name'
],
actionType
:
'count'
,
aggField
:
'id'
,
aliasField
:
' as chanceCount'
,
tblName
:
'bussiness_opportunity'
,
where
:
bizStatus
!=
""
?
`where business_status='
${
bizStatus
}
'`
:
''
,
having
:
''
,
async
statBizChanceCountBySp
(
bizStatus
,
betweenTime
)
{
let
params
=
{}
params
.
group
=
{
byFields
:
[
'facilitator_name'
],
actionType
:
'count'
,
aggField
:
'id'
,
aliasField
:
' as chanceCount'
,
tblName
:
'bussiness_opportunity'
,
where
:
bizStatus
!=
""
?
`where business_status='
${
bizStatus
}
'`
:
''
,
having
:
''
,
}
let
s
=
await
this
.
dao
.
statGroupBy
(
params
,
null
)
if
(
betweenTime
.
length
>
0
)
{
params
.
group
.
where
=
`
${
params
.
group
.
where
}
${
params
.
group
.
where
?
'AND'
:
"WHERE"
}
(created_at BETWEEN '
${
betweenTime
[
0
]}
' AND '
${
betweenTime
[
1
]}
')`
}
let
s
=
await
this
.
dao
.
statGroupBy
(
params
,
null
)
return
s
}
/**
...
...
@@ -27,38 +30,46 @@ class BizOptService extends ServiceBase {
* @param {*} username
* @param {*} userid
*/
async
statBizChance
(
companyId
,
opath
,
username
,
userid
){
async
statBizChance
(
companyId
,
opath
,
username
,
userid
,
betweenTime
)
{
// 时间 筛选
let
andWhere
=
[];
if
(
betweenTime
.
length
>
0
)
{
andWhere
.
push
({
"created_at"
:
{
[
this
.
db
.
Op
.
between
]:
betweenTime
}
})
}
//如果当前登录人是平台,返回所有商机
let
waittoHandledCount
=
0
let
handlingCount
=
0
let
finishedCount
=
0
let
closedCount
=
0
if
(
companyId
==
1
)
{
waittoHandledCount
=
await
this
.
dao
.
findCount
({
where
:{
business_status
:
'beforeSubmission'
}
})
handlingCount
=
await
this
.
dao
.
findCount
({
where
:{
business_status
:
'beforeConfirmation'
}
})
finishedCount
=
await
this
.
dao
.
findCount
({
where
:{
business_status
:
'isFinished'
}
})
closedCount
=
await
this
.
dao
.
findCount
({
where
:{
business_status
:
'isClosed'
}
})
}
else
{
let
opathstr
=
''
if
(
opath
)
{
opathstr
=
opath
waittoHandledCount
=
await
this
.
dao
.
findCount
({
where
:{
business_status
:
'beforeSubmission'
,
salesman_opcode
:{
[
this
.
db
.
Op
.
like
]:
`%
${
opathstr
}
%`
},
'facilitator_id'
:
companyId
}
})
handlingCount
=
await
this
.
dao
.
findCount
({
where
:{
business_status
:
'beforeConfirmation'
,
salesman_opcode
:{
[
this
.
db
.
Op
.
like
]:
`%
${
opathstr
}
%`
},
'facilitator_id'
:
companyId
}
})
finishedCount
=
await
this
.
dao
.
findCount
({
where
:{
business_status
:
'isFinished'
,
salesman_opcode
:{
[
this
.
db
.
Op
.
like
]:
`%
${
opathstr
}
%`
},
'facilitator_id'
:
companyId
}
})
closedCount
=
await
this
.
dao
.
findCount
({
where
:{
business_status
:
'isClosed'
,
salesman_opcode
:{[
this
.
db
.
Op
.
like
]:
`%
${
opathstr
}
%`
},
'facilitator_id'
:
companyId
}
})
}
else
{
waittoHandledCount
=
await
this
.
dao
.
findCount
({
where
:{
business_status
:
'beforeSubmission'
,
'facilitator_id'
:
companyId
}
})
handlingCount
=
await
this
.
dao
.
findCount
({
where
:{
business_status
:
'beforeConfirmation'
,
'facilitator_id'
:
companyId
}
})
finishedCount
=
await
this
.
dao
.
findCount
({
where
:{
business_status
:
'isFinished'
,
'facilitator_id'
:
companyId
}
})
closedCount
=
await
this
.
dao
.
findCount
({
where
:{
business_status
:
'isClosed'
,
'facilitator_id'
:
companyId
}
})
let
waittoHandledCount
=
0
let
handlingCount
=
0
let
finishedCount
=
0
let
closedCount
=
0
if
(
companyId
==
1
)
{
waittoHandledCount
=
await
this
.
dao
.
findCount
({
where
:
{
business_status
:
'beforeSubmission'
,
[
this
.
db
.
Op
.
and
]:
andWhere
}
})
handlingCount
=
await
this
.
dao
.
findCount
({
where
:
{
business_status
:
'beforeConfirmation'
,
[
this
.
db
.
Op
.
and
]:
andWhere
}
})
finishedCount
=
await
this
.
dao
.
findCount
({
where
:
{
business_status
:
'isFinished'
,
[
this
.
db
.
Op
.
and
]:
andWhere
}
})
closedCount
=
await
this
.
dao
.
findCount
({
where
:
{
business_status
:
'isClosed'
,
[
this
.
db
.
Op
.
and
]:
andWhere
}
})
}
else
{
let
opathstr
=
''
if
(
opath
)
{
opathstr
=
opath
waittoHandledCount
=
await
this
.
dao
.
findCount
({
where
:
{
business_status
:
'beforeSubmission'
,
salesman_opcode
:
{
[
this
.
db
.
Op
.
like
]:
`%
${
opathstr
}
%`
},
'facilitator_id'
:
companyId
,
[
this
.
db
.
Op
.
and
]:
andWhere
}
})
handlingCount
=
await
this
.
dao
.
findCount
({
where
:
{
business_status
:
'beforeConfirmation'
,
salesman_opcode
:
{
[
this
.
db
.
Op
.
like
]:
`%
${
opathstr
}
%`
},
'facilitator_id'
:
companyId
,
[
this
.
db
.
Op
.
and
]:
andWhere
}
})
finishedCount
=
await
this
.
dao
.
findCount
({
where
:
{
business_status
:
'isFinished'
,
salesman_opcode
:
{
[
this
.
db
.
Op
.
like
]:
`%
${
opathstr
}
%`
},
'facilitator_id'
:
companyId
,
[
this
.
db
.
Op
.
and
]:
andWhere
}
})
closedCount
=
await
this
.
dao
.
findCount
({
where
:
{
business_status
:
'isClosed'
,
salesman_opcode
:
{
[
this
.
db
.
Op
.
like
]:
`%
${
opathstr
}
%`
},
'facilitator_id'
:
companyId
,
[
this
.
db
.
Op
.
and
]:
andWhere
}
})
}
else
{
waittoHandledCount
=
await
this
.
dao
.
findCount
({
where
:
{
business_status
:
'beforeSubmission'
,
'facilitator_id'
:
companyId
,
[
this
.
db
.
Op
.
and
]:
andWhere
}
})
handlingCount
=
await
this
.
dao
.
findCount
({
where
:
{
business_status
:
'beforeConfirmation'
,
'facilitator_id'
:
companyId
,
[
this
.
db
.
Op
.
and
]:
andWhere
}
})
finishedCount
=
await
this
.
dao
.
findCount
({
where
:
{
business_status
:
'isFinished'
,
'facilitator_id'
:
companyId
},
[
this
.
db
.
Op
.
and
]:
andWhere
})
closedCount
=
await
this
.
dao
.
findCount
({
where
:
{
business_status
:
'isClosed'
,
'facilitator_id'
:
companyId
},
[
this
.
db
.
Op
.
and
]:
andWhere
})
}
}
//成单率
let
allChance
=
waittoHandledCount
+
handlingCount
+
finishedCount
+
closedCount
let
successRadio
=
Math
.
ceil
((
finishedCount
/
allChance
)
*
100
)
let
allChance
=
waittoHandledCount
+
handlingCount
+
finishedCount
+
closedCount
let
successRadio
=
Math
.
ceil
((
finishedCount
/
allChance
)
*
100
)
//如果当前登录人不是平台,那么需要按照opath查询
return
{
waittoHandledCount
:
waittoHandledCount
,
handlingCount
:
handlingCount
,
finishedCount
:
finishedCount
,
closedCount
:
closedCount
,
successRadio
:
successRadio
}
return
{
waittoHandledCount
:
waittoHandledCount
,
handlingCount
:
handlingCount
,
finishedCount
:
finishedCount
,
closedCount
:
closedCount
,
successRadio
:
successRadio
}
}
async
findAndCountAll
(
obj
)
{
var
self
=
this
;
...
...
@@ -67,23 +78,23 @@ class BizOptService extends ServiceBase {
}
/*根据商机编号获取商机详情*/
async
findInfoByDemandCode
(
qobj
){
async
findInfoByDemandCode
(
qobj
)
{
return
await
this
.
dao
.
findInfoByDemandCode
(
qobj
);
}
/* 根据商机编号更新商机状态 */
async
updateStatusByDemandCode
(
qobj
){
var
self
=
this
;
async
updateStatusByDemandCode
(
qobj
)
{
var
self
=
this
;
return
self
.
db
.
transaction
(
async
function
(
t
)
{
return
await
self
.
dao
.
updateStatusByDemandCode
(
qobj
,
t
);
return
await
self
.
dao
.
updateStatusByDemandCode
(
qobj
,
t
);
});
}
/*插入商机信息*/
async
insertInfo
(
qobj
){
var
self
=
this
;
async
insertInfo
(
qobj
)
{
var
self
=
this
;
return
self
.
db
.
transaction
(
async
function
(
t
)
{
return
await
self
.
dao
.
insertInfo
(
qobj
,
t
);
return
await
self
.
dao
.
insertInfo
(
qobj
,
t
);
});
}
...
...
ic-deliver/app/base/service/impl/bizchance/deliverybillSve.js
View file @
6f3412a1
This diff is collapsed.
Click to expand it.
ic-deliver/app/base/service/impl/bizchance/schemeSve.js
View file @
6f3412a1
...
...
@@ -14,6 +14,7 @@ class SchemeService extends ServiceBase {
async
findInfoByDemandCode
(
qobj
){
//根据方案编号获取方案详情
return
await
this
.
dao
.
findInfoByDemandCode
(
qobj
);
}
async
updateStatusByDemandCode
(
qobj
){
//根据商机编号号更新方案状态及原因
...
...
ic-deliver/app/base/utils/dateClient.js
0 → 100644
View file @
6f3412a1
const
moment
=
require
(
'moment'
);
class
DateClient
{
constructor
()
{
}
betweenDay
()
{
return
[
moment
().
startOf
(
'day'
).
format
(
'YYYY-MM-DD HH:mm:ss'
),
moment
().
endOf
(
'day'
).
format
(
'YYYY-MM-DD HH:mm:ss'
)]
}
betweenMonth
()
{
return
[
moment
().
startOf
(
'month'
).
format
(
'YYYY-MM-DD HH:mm:ss'
),
moment
().
endOf
(
'month'
).
format
(
'YYYY-MM-DD HH:mm:ss'
)]
}
betweenYear
()
{
return
[
moment
().
startOf
(
'year'
).
format
(
'YYYY-MM-DD HH:mm:ss'
),
moment
().
endOf
(
'year'
).
format
(
'YYYY-MM-DD HH:mm:ss'
)]
}
betweenTime
(
type
)
{
let
times
=
[];
switch
(
type
)
{
case
"日"
:
times
=
this
.
betweenDay
();
break
case
"月"
:
times
=
this
.
betweenMonth
();
break
case
"年"
:
times
=
this
.
betweenYear
();
break
case
"全部"
:
break
}
return
times
}
}
module
.
exports
=
DateClient
;
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