Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
iBiz企业中心
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
iBiz企业套件
iBiz企业中心
提交
60d9e01e
提交
60d9e01e
编写于
6月 30, 2020
作者:
ibizdev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
xignzi006 发布系统代码
上级
b3737bd6
变更
48
隐藏空白字符变更
内嵌
并排
正在显示
48 个修改的文件
包含
5235 行增加
和
313 行删除
+5235
-313
competitor-sales-literature.ts
app_CRM/src/interface/entity/competitor-sales-literature.ts
+96
-0
en-US.ts
app_CRM/src/locale/lang/en-US.ts
+2
-0
zh-CN.ts
app_CRM/src/locale/lang/zh-CN.ts
+2
-0
competitor-sales-literature_en_US.ts
...tor-sales-literature/competitor-sales-literature_en_US.ts
+16
-0
competitor-sales-literature_zh_CN.ts
...tor-sales-literature/competitor-sales-literature_zh_CN.ts
+15
-0
competitor-sales-literatures.ts
...petitor-sales-literatures/competitor-sales-literatures.ts
+651
-0
opportunitys.ts
app_CRM/src/mock/entity/opportunitys/opportunitys.ts
+134
-0
product-sales-literatures.ts
...ty/product-sales-literatures/product-sales-literatures.ts
+271
-0
sales-literature-items.ts
...k/entity/sales-literature-items/sales-literature-items.ts
+271
-0
index.ts
app_CRM/src/mock/index.ts
+1
-0
campaign-service-base.ts
app_CRM/src/service/campaign/campaign-service-base.ts
+52
-52
competitor-sales-literature-service-base.ts
...es-literature/competitor-sales-literature-service-base.ts
+227
-0
competitor-sales-literature-service.ts
...r-sales-literature/competitor-sales-literature-service.ts
+25
-0
entity-service-register.ts
app_CRM/src/service/entity-service-register.ts
+1
-0
ibiz-list-service-base.ts
app_CRM/src/service/ibiz-list/ibiz-list-service-base.ts
+50
-50
opportunity-service-base.ts
app_CRM/src/service/opportunity/opportunity-service-base.ts
+216
-194
product-sales-literature-service-base.ts
...sales-literature/product-sales-literature-service-base.ts
+50
-0
sales-literature-item-service-base.ts
...les-literature-item/sales-literature-item-service-base.ts
+50
-0
sales-literature-service-base.ts
...service/sales-literature/sales-literature-service-base.ts
+150
-0
competitor-sales-literature-ui-service-base.ts
...literature/competitor-sales-literature-ui-service-base.ts
+210
-0
competitor-sales-literature-ui-service.ts
...ales-literature/competitor-sales-literature-ui-service.ts
+21
-0
ui-service-register.ts
app_CRM/src/uiservice/ui-service-register.ts
+1
-0
centeral-portal-db-dashboard.html
...ral-portal-db-dashboard/centeral-portal-db-dashboard.html
+27
-0
centeral-portal-db-dashboard.vue
...eral-portal-db-dashboard/centeral-portal-db-dashboard.vue
+2
-0
chart-001-chart-base.tsx
...gets/opportunity/chart-001-chart/chart-001-chart-base.tsx
+1112
-0
chart-001-chart-model.ts
...gets/opportunity/chart-001-chart/chart-001-chart-model.ts
+36
-0
chart-001-chart-service.ts
...ts/opportunity/chart-001-chart/chart-001-chart-service.ts
+72
-0
chart-001-chart.html
.../widgets/opportunity/chart-001-chart/chart-001-chart.html
+4
-0
chart-001-chart.less
.../widgets/opportunity/chart-001-chart/chart-001-chart.less
+14
-0
chart-001-chart.vue
...c/widgets/opportunity/chart-001-chart/chart-001-chart.vue
+22
-0
part-cht-001-portlet-base.tsx
...tunity/part-cht-001-portlet/part-cht-001-portlet-base.tsx
+156
-0
part-cht-001-portlet-model.ts
...tunity/part-cht-001-portlet/part-cht-001-portlet-model.ts
+355
-0
part-cht-001-portlet-service.ts
...nity/part-cht-001-portlet/part-cht-001-portlet-service.ts
+11
-0
part-cht-001-portlet.html
...pportunity/part-cht-001-portlet/part-cht-001-portlet.html
+21
-0
part-cht-001-portlet.vue
...opportunity/part-cht-001-portlet/part-cht-001-portlet.vue
+24
-0
application-crm-prod.yml
...ntral-app-crm/src/main/resources/application-crm-prod.yml
+4
-0
OpportunityMapper.java
.../businesscentral/core/sales/mapper/OpportunityMapper.java
+1
-0
IOpportunityService.java
...sinesscentral/core/sales/service/IOpportunityService.java
+1
-0
OpportunityServiceImpl.java
...ntral/core/sales/service/impl/OpportunityServiceImpl.java
+9
-0
h2_table.xml
...esscentral-core/src/main/resources/liquibase/h2_table.xml
+16
-16
OpportunityMapper.xml
.../resources/mapper/sales/opportunity/OpportunityMapper.xml
+14
-0
systemResource.json
...al-core/src/main/resources/permission/systemResource.json
+9
-1
CompetitorSalesLiteratureDTO.java
...scentral/centralapi/dto/CompetitorSalesLiteratureDTO.java
+167
-0
CompetitorSalesLiteratureMapping.java
.../centralapi/mapping/CompetitorSalesLiteratureMapping.java
+16
-0
CompetitorSalesLiteratureResource.java
...al/centralapi/rest/CompetitorSalesLiteratureResource.java
+297
-0
OpportunityResource.java
.../businesscentral/centralapi/rest/OpportunityResource.java
+67
-0
ProductSalesLiteratureResource.java
...ntral/centralapi/rest/ProductSalesLiteratureResource.java
+133
-0
SalesLiteratureItemResource.java
...scentral/centralapi/rest/SalesLiteratureItemResource.java
+133
-0
未找到文件。
app_CRM/src/interface/entity/competitor-sales-literature.ts
0 → 100644
浏览文件 @
60d9e01e
/**
* 竞争对手宣传资料
*
* @export
* @interface CompetitorSalesLiterature
*/
export
interface
CompetitorSalesLiterature
{
/**
* 建立时间
*
* @returns {*}
* @memberof CompetitorSalesLiterature
*/
createdate
?:
any
;
/**
* 建立人
*
* @returns {*}
* @memberof CompetitorSalesLiterature
*/
createman
?:
any
;
/**
* 关系标识
*
* @returns {*}
* @memberof CompetitorSalesLiterature
*/
relationshipsid
?:
any
;
/**
* 关系名称
*
* @returns {*}
* @memberof CompetitorSalesLiterature
*/
relationshipsname
?:
any
;
/**
* 关系类型
*
* @returns {*}
* @memberof CompetitorSalesLiterature
*/
relationshipstype
?:
any
;
/**
* 更新时间
*
* @returns {*}
* @memberof CompetitorSalesLiterature
*/
updatedate
?:
any
;
/**
* 更新人
*
* @returns {*}
* @memberof CompetitorSalesLiterature
*/
updateman
?:
any
;
/**
* 竞争对手
*
* @returns {*}
* @memberof CompetitorSalesLiterature
*/
entityid
?:
any
;
/**
* 销售宣传资料
*
* @returns {*}
* @memberof CompetitorSalesLiterature
*/
entity2id
?:
any
;
/**
* 竞争对手
*
* @returns {*}
* @memberof CompetitorSalesLiterature
*/
entityname
?:
any
;
/**
* 销售宣传资料
*
* @returns {*}
* @memberof CompetitorSalesLiterature
*/
entity2name
?:
any
;
}
\ No newline at end of file
app_CRM/src/locale/lang/en-US.ts
浏览文件 @
60d9e01e
...
...
@@ -30,6 +30,7 @@ import quote_en_US from '@locale/lanres/entities/quote/quote_en_US';
import
campaignactivity_en_US
from
'@locale/lanres/entities/campaign-activity/campaign-activity_en_US'
;
import
listlead_en_US
from
'@locale/lanres/entities/list-lead/list-lead_en_US'
;
import
opportunitycompetitor_en_US
from
'@locale/lanres/entities/opportunity-competitor/opportunity-competitor_en_US'
;
import
competitorsalesliterature_en_US
from
'@locale/lanres/entities/competitor-sales-literature/competitor-sales-literature_en_US'
;
import
salesliteratureitem_en_US
from
'@locale/lanres/entities/sales-literature-item/sales-literature-item_en_US'
;
import
contact_en_US
from
'@locale/lanres/entities/contact/contact_en_US'
;
import
product_en_US
from
'@locale/lanres/entities/product/product_en_US'
;
...
...
@@ -176,6 +177,7 @@ export default {
campaignactivity
:
campaignactivity_en_US
,
listlead
:
listlead_en_US
,
opportunitycompetitor
:
opportunitycompetitor_en_US
,
competitorsalesliterature
:
competitorsalesliterature_en_US
,
salesliteratureitem
:
salesliteratureitem_en_US
,
contact
:
contact_en_US
,
product
:
product_en_US
,
...
...
app_CRM/src/locale/lang/zh-CN.ts
浏览文件 @
60d9e01e
...
...
@@ -30,6 +30,7 @@ import quote_zh_CN from '@locale/lanres/entities/quote/quote_zh_CN';
import
campaignactivity_zh_CN
from
'@locale/lanres/entities/campaign-activity/campaign-activity_zh_CN'
;
import
listlead_zh_CN
from
'@locale/lanres/entities/list-lead/list-lead_zh_CN'
;
import
opportunitycompetitor_zh_CN
from
'@locale/lanres/entities/opportunity-competitor/opportunity-competitor_zh_CN'
;
import
competitorsalesliterature_zh_CN
from
'@locale/lanres/entities/competitor-sales-literature/competitor-sales-literature_zh_CN'
;
import
salesliteratureitem_zh_CN
from
'@locale/lanres/entities/sales-literature-item/sales-literature-item_zh_CN'
;
import
contact_zh_CN
from
'@locale/lanres/entities/contact/contact_zh_CN'
;
import
product_zh_CN
from
'@locale/lanres/entities/product/product_zh_CN'
;
...
...
@@ -176,6 +177,7 @@ export default {
campaignactivity
:
campaignactivity_zh_CN
,
listlead
:
listlead_zh_CN
,
opportunitycompetitor
:
opportunitycompetitor_zh_CN
,
competitorsalesliterature
:
competitorsalesliterature_zh_CN
,
salesliteratureitem
:
salesliteratureitem_zh_CN
,
contact
:
contact_zh_CN
,
product
:
product_zh_CN
,
...
...
app_CRM/src/locale/lanres/entities/competitor-sales-literature/competitor-sales-literature_en_US.ts
0 → 100644
浏览文件 @
60d9e01e
export
default
{
fields
:
{
createdate
:
"建立时间"
,
createman
:
"建立人"
,
relationshipsid
:
"关系标识"
,
relationshipsname
:
"关系名称"
,
relationshipstype
:
"关系类型"
,
updatedate
:
"更新时间"
,
updateman
:
"更新人"
,
entityid
:
"竞争对手"
,
entity2id
:
"销售宣传资料"
,
entityname
:
"竞争对手"
,
entity2name
:
"销售宣传资料"
,
},
};
app_CRM/src/locale/lanres/entities/competitor-sales-literature/competitor-sales-literature_zh_CN.ts
0 → 100644
浏览文件 @
60d9e01e
export
default
{
fields
:
{
createdate
:
"建立时间"
,
createman
:
"建立人"
,
relationshipsid
:
"关系标识"
,
relationshipsname
:
"关系名称"
,
relationshipstype
:
"关系类型"
,
updatedate
:
"更新时间"
,
updateman
:
"更新人"
,
entityid
:
"竞争对手"
,
entity2id
:
"销售宣传资料"
,
entityname
:
"竞争对手"
,
entity2name
:
"销售宣传资料"
,
},
};
\ No newline at end of file
app_CRM/src/mock/entity/competitor-sales-literatures/competitor-sales-literatures.ts
0 → 100644
浏览文件 @
60d9e01e
import
qs
from
'qs'
;
import
{
MockAdapter
}
from
'@/mock/mock-adapter'
;
const
mock
=
MockAdapter
.
getInstance
();
// 模拟数据
const
mockDatas
:
Array
<
any
>
=
[
];
//getwflink
mock
.
onGet
(
new
RegExp
(
/^
\/
wfcore
\/
ibizbusinesscentral-app-crm
\/
competitorsalesliteratures
\/[
a-zA-Z0-9
\-\;]
+
\/
usertasks
\/[
a-zA-Z0-9
\-\;]
+
\/
ways$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:competitorsalesliterature 方法: getwflink"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
console
.
groupEnd
();
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
{}];
}
return
[
status
,[
{
"sequenceFlowId"
:
"dfdsfdsfdsfdsfds"
,
"sequenceFlowName"
:
"同意"
,
"taskId"
:
"aaaaddddccccddddd"
,
"processDefinitionKey"
:
"support-workorders-approve-v1"
,
"processInstanceId"
:
"ddlfldldfldsfds"
,
"refViewKey"
:
""
},
{
"sequenceFlowId"
:
"ddssdfdfdfdfsfdf"
,
"sequenceFlowName"
:
"不同意"
,
"taskId"
:
"aaaaddddccccddddd"
,
"processDefinitionKey"
:
"support-workorders-approve-v1"
,
"processInstanceId"
:
"ddfdsldlfdlldsf"
,
"refViewKey"
:
"workorder_ltform_editview"
}
]];
});
// getwfstep
mock
.
onGet
(
new
RegExp
(
/^
\/
wfcore
\/
ibizbusinesscentral-app-crm
\/
competitorsalesliteratures
\/
process-definitions-nodes$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:competitorsalesliterature 方法: getwfstep"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
console
.
groupEnd
();
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
{}];
}
return
[
status
,
[
{
"userTaskId"
:
"sddfddfd-dfdf-fdfd-fdf-dfdfd"
,
"userTaskName"
:
"待审"
,
"cnt"
:
0
,
"processDefinitionKey"
:
"support-workorders-approve-v1"
,
"processDefinitionName"
:
"工单审批流程v1"
},
{
"userTaskId"
:
"sddfddfd-dfdf-fdfd-fdf-87927"
,
"userTaskName"
:
"待分配"
,
"cnt"
:
3
,
"processDefinitionKey"
:
"support-workorders-approve-v1"
,
"processDefinitionName"
:
"工单审批流程v1"
}
]];
});
// createBatch
mock
.
onPost
(
new
RegExp
(
/^
\/
competitorsalesliteratures
\/
batch$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:competitorsalesliterature 方法: createBatch"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
console
.
groupEnd
();
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
{}];
}
return
[
status
,
{}];
});
// updateBatch
mock
.
onPut
(
new
RegExp
(
/^
\/
competitorsalesliteratures
\/
batch$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:competitorsalesliterature 方法: updateBatch"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
console
.
groupEnd
();
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
{}];
}
return
[
status
,
{}];
});
// removeBatch
mock
.
onDelete
(
new
RegExp
(
/^
\/
competitorsalesliteratures
\/
batch$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:competitorsalesliterature 方法: removeBatch"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
console
.
groupEnd
();
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
{}];
}
return
[
status
,
{}];
});
// Select
mock
.
onGet
(
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
competitorsalesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
select$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:competitorsalesliterature 方法: Select"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'salesliteratureid'
,
'relationshipsid'
];
const
matchArray
:
any
=
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
competitorsalesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
select$/
).
exec
(
config
.
url
);
let
tempValue
:
any
=
{};
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
let
items
=
mockDatas
?
mockDatas
:
[];
let
_items
=
items
.
find
((
item
:
any
)
=>
Object
.
is
(
item
.
relationshipsid
,
tempValue
.
relationshipsid
));
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
(
_items
);
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
_items
];
});
// Select
mock
.
onGet
(
new
RegExp
(
/^
\/
competitorsalesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
select$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:competitorsalesliterature 方法: Select"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'relationshipsid'
];
const
matchArray
:
any
=
new
RegExp
(
/^
\/
competitorsalesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
select$/
).
exec
(
config
.
url
);
let
tempValue
:
any
=
{};
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
let
items
=
mockDatas
?
mockDatas
:
[];
let
_items
=
items
.
find
((
item
:
any
)
=>
Object
.
is
(
item
.
relationshipsid
,
tempValue
.
relationshipsid
));
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
(
_items
);
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
_items
];
});
// CheckKey
mock
.
onPost
(
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
competitorsalesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
checkkey$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:competitorsalesliterature 方法: CheckKey"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'salesliteratureid'
,
'relationshipsid'
];
const
matchArray
:
any
=
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
competitorsalesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
checkkey$/
).
exec
(
config
.
url
);
let
tempValue
:
any
=
{};
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
({});
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
{}];
});
// CheckKey
mock
.
onPost
(
new
RegExp
(
/^
\/
competitorsalesliteratures
\/?([
a-zA-Z0-9
\-\;]{0,35})\/
checkkey$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:competitorsalesliterature 方法: CheckKey"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'relationshipsid'
];
const
matchArray
:
any
=
new
RegExp
(
/^
\/
competitorsalesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
checkkey$/
).
exec
(
config
.
url
);
let
tempValue
:
any
=
{};
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
//let items = mockDatas ? mockDatas : [];
//let _items = items.find((item: any) => Object.is(item.relationshipsid, tempValue.relationshipsid));
let
data
=
JSON
.
parse
(
config
.
data
);
mockDatas
.
forEach
((
item
)
=>
{
if
(
item
[
'relationshipsid'
]
==
tempValue
[
'relationshipsid'
]
){
for
(
let
value
in
data
){
if
(
item
.
hasOwnProperty
(
value
)){
item
[
value
]
=
data
[
value
];
}
}
}
})
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
(
data
);
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
data
];
});
// Update
mock
.
onPut
(
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
competitorsalesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})
$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:competitorsalesliterature 方法: Update"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'salesliteratureid'
,
'relationshipsid'
];
const
matchArray
:
any
=
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
competitorsalesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})
$/
).
exec
(
config
.
url
);
let
tempValue
:
any
=
{};
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
({});
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
{}];
});
// Update
mock
.
onPut
(
new
RegExp
(
/^
\/
competitorsalesliteratures
\/?([
a-zA-Z0-9
\-\;]{0,35})
$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:competitorsalesliterature 方法: Update"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'relationshipsid'
];
const
matchArray
:
any
=
new
RegExp
(
/^
\/
competitorsalesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})
$/
).
exec
(
config
.
url
);
let
tempValue
:
any
=
{};
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
//let items = mockDatas ? mockDatas : [];
//let _items = items.find((item: any) => Object.is(item.relationshipsid, tempValue.relationshipsid));
let
data
=
JSON
.
parse
(
config
.
data
);
mockDatas
.
forEach
((
item
)
=>
{
if
(
item
[
'relationshipsid'
]
==
tempValue
[
'relationshipsid'
]
){
for
(
let
value
in
data
){
if
(
item
.
hasOwnProperty
(
value
)){
item
[
value
]
=
data
[
value
];
}
}
}
})
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
(
data
);
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
data
];
});
// Create
mock
.
onPost
(
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
competitorsalesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})
$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:competitorsalesliterature 方法: Create"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'salesliteratureid'
,
'relationshipsid'
];
const
matchArray
:
any
=
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
competitorsalesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})
$/
).
exec
(
config
.
url
);
let
tempValue
:
any
=
{};
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
({});
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
{}];
});
// Create
mock
.
onPost
(
new
RegExp
(
/^
\/
competitorsalesliteratures
\/?([
a-zA-Z0-9
\-\;]{0,35})
$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:competitorsalesliterature 方法: Create"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'relationshipsid'
];
const
matchArray
:
any
=
new
RegExp
(
/^
\/
competitorsalesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})
$/
).
exec
(
config
.
url
);
let
tempValue
:
any
=
{};
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
(
mockDatas
[
0
]);
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
mockDatas
[
0
]];
});
// Save
mock
.
onPost
(
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
competitorsalesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
save$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:competitorsalesliterature 方法: Save"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'salesliteratureid'
,
'relationshipsid'
];
const
matchArray
:
any
=
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
competitorsalesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
save$/
).
exec
(
config
.
url
);
let
tempValue
:
any
=
{};
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
({});
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
{}];
});
// Save
mock
.
onPost
(
new
RegExp
(
/^
\/
competitorsalesliteratures
\/?([
a-zA-Z0-9
\-\;]{0,35})\/
save$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:competitorsalesliterature 方法: Save"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'relationshipsid'
];
const
matchArray
:
any
=
new
RegExp
(
/^
\/
competitorsalesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
save$/
).
exec
(
config
.
url
);
let
tempValue
:
any
=
{};
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
//let items = mockDatas ? mockDatas : [];
//let _items = items.find((item: any) => Object.is(item.relationshipsid, tempValue.relationshipsid));
let
data
=
JSON
.
parse
(
config
.
data
);
mockDatas
.
forEach
((
item
)
=>
{
if
(
item
[
'relationshipsid'
]
==
tempValue
[
'relationshipsid'
]
){
for
(
let
value
in
data
){
if
(
item
.
hasOwnProperty
(
value
)){
item
[
value
]
=
data
[
value
];
}
}
}
})
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
(
data
);
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
data
];
});
// GetDraft
mock
.
onGet
(
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
competitorsalesliteratures
\/
getdraft$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:competitorsalesliterature 方法: GetDraft"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
// GetDraft
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
({});
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
{}];
});
// GetDraft
mock
.
onGet
(
new
RegExp
(
/^
\/
competitorsalesliteratures
\/
getdraft$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:competitorsalesliterature 方法: GetDraft"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
// GetDraft
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
({});
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
{}];
});
// FetchDefault
mock
.
onGet
(
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
competitorsalesliteratures
\/
fetchdefault$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:competitorsalesliterature 方法: FetchDefault"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'salesliteratureid'
];
let
tempValue
:
any
=
{};
const
matchArray
:
any
=
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
competitorsalesliteratures
\/
fetchdefault$/
).
exec
(
config
.
url
);
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
let
items
=
mockDatas
?
mockDatas
:
[];
if
(
items
.
length
>
0
&&
paramArray
.
length
>
0
)
{
paramArray
.
forEach
((
paramkey
:
any
)
=>
{
if
(
tempValue
[
paramkey
]
&&
tempValue
[
paramkey
].
indexOf
(
";"
)
>
0
)
{
let
keysGrounp
:
Array
<
any
>
=
tempValue
[
paramkey
].
split
(
new
RegExp
(
/
[\;]
/
));
let
tempArray
:
Array
<
any
>
=
[];
keysGrounp
.
forEach
((
singlekey
:
any
)
=>
{
let
_items
=
items
.
filter
((
item
:
any
)
=>
{
return
item
[
paramkey
]
==
singlekey
});
if
(
_items
.
length
>
0
){
tempArray
.
push
(...
_items
);
}
})
items
=
tempArray
;
}
else
{
items
=
items
.
filter
((
item
:
any
)
=>
{
return
item
[
paramkey
]
==
tempValue
[
paramkey
]
});
}
})
}
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
(
items
);
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
items
];
});
// FetchDefault
mock
.
onGet
(
new
RegExp
(
/^
\/
competitorsalesliteratures
\/
fetchdefault$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:competitorsalesliterature 方法: FetchDefault"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
(
mockDatas
);
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
mockDatas
?
mockDatas
:
[]];
});
// FetchDefault
mock
.
onGet
(
new
RegExp
(
/^
\/
competitorsalesliteratures
\/
fetchdefault
(\?[\w
-.
/
?%&=,
]
*
)
*$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:competitorsalesliterature 方法: FetchDefault"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
if
(
config
.
url
.
includes
(
'page'
)){
let
url
=
config
.
url
.
split
(
'?'
)[
1
];
let
params
=
qs
.
parse
(
url
);
Object
.
assign
(
config
,
params
);
}
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
let
total
=
mockDatas
.
length
;
let
records
:
Array
<
any
>
=
[];
if
(
!
config
.
page
||
!
config
.
size
){
records
=
mockDatas
;
}
else
{
if
((
config
.
page
-
1
)
*
config
.
size
<
total
){
records
=
mockDatas
.
slice
(
config
.
page
,
config
.
size
);
}
}
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
(
records
?
records
:
[]);
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
records
?
records
:
[]];
});
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// Get
mock
.
onGet
(
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
competitorsalesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})
$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:competitorsalesliterature 方法: Get"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'salesliteratureid'
,
'relationshipsid'
];
const
matchArray
:
any
=
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
competitorsalesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})
$/
).
exec
(
config
.
url
);
let
tempValue
:
any
=
{};
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
let
items
=
mockDatas
?
mockDatas
:
[];
let
_items
=
items
.
find
((
item
:
any
)
=>
Object
.
is
(
item
.
relationshipsid
,
tempValue
.
relationshipsid
));
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
(
_items
?
_items
:{});
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
_items
?
_items
:{}];
});
// Get
mock
.
onGet
(
new
RegExp
(
/^
\/
competitorsalesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})
$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:competitorsalesliterature 方法: Get"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'relationshipsid'
];
const
matchArray
:
any
=
new
RegExp
(
/^
\/
competitorsalesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})
$/
).
exec
(
config
.
url
);
let
tempValue
:
any
=
{};
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
let
items
=
mockDatas
?
mockDatas
:
[];
let
_items
=
items
.
find
((
item
:
any
)
=>
Object
.
is
(
item
.
relationshipsid
,
tempValue
.
relationshipsid
));
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
(
_items
?
_items
:{});
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
_items
?
_items
:{}];
});
// Remove
mock
.
onDelete
(
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
competitorsalesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})
$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:competitorsalesliterature 方法: Remove"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'salesliteratureid'
,
'relationshipsid'
];
const
matchArray
:
any
=
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
competitorsalesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})
$/
).
exec
(
config
.
url
);
let
tempValue
:
any
=
{};
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
let
items
=
mockDatas
?
mockDatas
:
[];
let
_items
=
items
.
find
((
item
:
any
)
=>
Object
.
is
(
item
.
relationshipsid
,
tempValue
.
relationshipsid
));
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
(
_items
?
_items
:{});
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
_items
?
_items
:{}];
});
// Remove
mock
.
onDelete
(
new
RegExp
(
/^
\/
competitorsalesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})
$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:competitorsalesliterature 方法: Remove"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'relationshipsid'
];
const
matchArray
:
any
=
new
RegExp
(
/^
\/
competitorsalesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})
$/
).
exec
(
config
.
url
);
let
tempValue
:
any
=
{};
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
let
items
=
mockDatas
?
mockDatas
:
[];
let
_items
=
items
.
find
((
item
:
any
)
=>
Object
.
is
(
item
.
relationshipsid
,
tempValue
.
relationshipsid
));
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
(
_items
?
_items
:{});
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
_items
?
_items
:{}];
});
app_CRM/src/mock/entity/opportunitys/opportunitys.ts
浏览文件 @
60d9e01e
...
...
@@ -768,6 +768,140 @@ mock.onPost(new RegExp(/^\/opportunities\/?([a-zA-Z0-9\-\;]{0,35})\/save$/)).rep
});
// FetchTop5
mock
.
onGet
(
new
RegExp
(
/^
\/
accounts
\/([
a-zA-Z0-9
\-\;]{1,35})\/
contacts
\/([
a-zA-Z0-9
\-\;]{1,35})\/
opportunities
\/
fetchtop5$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:opportunity 方法: FetchTop5"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'accountid'
,
'contactid'
];
let
tempValue
:
any
=
{};
const
matchArray
:
any
=
new
RegExp
(
/^
\/
accounts
\/([
a-zA-Z0-9
\-\;]{1,35})\/
contacts
\/([
a-zA-Z0-9
\-\;]{1,35})\/
opportunities
\/
fetchtop5$/
).
exec
(
config
.
url
);
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
let
items
=
mockDatas
?
mockDatas
:
[];
if
(
items
.
length
>
0
&&
paramArray
.
length
>
0
)
{
paramArray
.
forEach
((
paramkey
:
any
)
=>
{
if
(
tempValue
[
paramkey
]
&&
tempValue
[
paramkey
].
indexOf
(
";"
)
>
0
)
{
let
keysGrounp
:
Array
<
any
>
=
tempValue
[
paramkey
].
split
(
new
RegExp
(
/
[\;]
/
));
let
tempArray
:
Array
<
any
>
=
[];
keysGrounp
.
forEach
((
singlekey
:
any
)
=>
{
let
_items
=
items
.
filter
((
item
:
any
)
=>
{
return
item
[
paramkey
]
==
singlekey
});
if
(
_items
.
length
>
0
){
tempArray
.
push
(...
_items
);
}
})
items
=
tempArray
;
}
else
{
items
=
items
.
filter
((
item
:
any
)
=>
{
return
item
[
paramkey
]
==
tempValue
[
paramkey
]
});
}
})
}
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
(
items
);
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
items
];
});
// FetchTop5
mock
.
onGet
(
new
RegExp
(
/^
\/
contacts
\/([
a-zA-Z0-9
\-\;]{1,35})\/
opportunities
\/
fetchtop5$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:opportunity 方法: FetchTop5"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'contactid'
];
let
tempValue
:
any
=
{};
const
matchArray
:
any
=
new
RegExp
(
/^
\/
contacts
\/([
a-zA-Z0-9
\-\;]{1,35})\/
opportunities
\/
fetchtop5$/
).
exec
(
config
.
url
);
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
let
items
=
mockDatas
?
mockDatas
:
[];
if
(
items
.
length
>
0
&&
paramArray
.
length
>
0
)
{
paramArray
.
forEach
((
paramkey
:
any
)
=>
{
if
(
tempValue
[
paramkey
]
&&
tempValue
[
paramkey
].
indexOf
(
";"
)
>
0
)
{
let
keysGrounp
:
Array
<
any
>
=
tempValue
[
paramkey
].
split
(
new
RegExp
(
/
[\;]
/
));
let
tempArray
:
Array
<
any
>
=
[];
keysGrounp
.
forEach
((
singlekey
:
any
)
=>
{
let
_items
=
items
.
filter
((
item
:
any
)
=>
{
return
item
[
paramkey
]
==
singlekey
});
if
(
_items
.
length
>
0
){
tempArray
.
push
(...
_items
);
}
})
items
=
tempArray
;
}
else
{
items
=
items
.
filter
((
item
:
any
)
=>
{
return
item
[
paramkey
]
==
tempValue
[
paramkey
]
});
}
})
}
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
(
items
);
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
items
];
});
// FetchTop5
mock
.
onGet
(
new
RegExp
(
/^
\/
opportunities
\/
fetchtop5$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:opportunity 方法: FetchTop5"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
(
mockDatas
);
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
mockDatas
?
mockDatas
:
[]];
});
// FetchTop5
mock
.
onGet
(
new
RegExp
(
/^
\/
opportunities
\/
fetchtop5
(\?[\w
-.
/
?%&=,
]
*
)
*$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:opportunity 方法: FetchTop5"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
if
(
config
.
url
.
includes
(
'page'
)){
let
url
=
config
.
url
.
split
(
'?'
)[
1
];
let
params
=
qs
.
parse
(
url
);
Object
.
assign
(
config
,
params
);
}
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
let
total
=
mockDatas
.
length
;
let
records
:
Array
<
any
>
=
[];
if
(
!
config
.
page
||
!
config
.
size
){
records
=
mockDatas
;
}
else
{
if
((
config
.
page
-
1
)
*
config
.
size
<
total
){
records
=
mockDatas
.
slice
(
config
.
page
,
config
.
size
);
}
}
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
(
records
?
records
:
[]);
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
records
?
records
:
[]];
});
// FetchDefault
mock
.
onGet
(
new
RegExp
(
/^
\/
accounts
\/([
a-zA-Z0-9
\-\;]{1,35})\/
contacts
\/([
a-zA-Z0-9
\-\;]{1,35})\/
opportunities
\/
fetchdefault$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:opportunity 方法: FetchDefault"
);
...
...
app_CRM/src/mock/entity/product-sales-literatures/product-sales-literatures.ts
浏览文件 @
60d9e01e
...
...
@@ -87,6 +87,35 @@ mock.onDelete(new RegExp(/^\/productsalesliteratures\/batch$/)).reply((config: a
});
// Select
mock
.
onGet
(
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
productsalesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
select$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:productsalesliterature 方法: Select"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'salesliteratureid'
,
'relationshipsid'
];
const
matchArray
:
any
=
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
productsalesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
select$/
).
exec
(
config
.
url
);
let
tempValue
:
any
=
{};
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
let
items
=
mockDatas
?
mockDatas
:
[];
let
_items
=
items
.
find
((
item
:
any
)
=>
Object
.
is
(
item
.
relationshipsid
,
tempValue
.
relationshipsid
));
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
(
_items
);
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
_items
];
});
// Select
mock
.
onGet
(
new
RegExp
(
/^
\/
productsalesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
select$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:productsalesliterature 方法: Select"
);
...
...
@@ -114,6 +143,35 @@ mock.onGet(new RegExp(/^\/productsalesliteratures\/([a-zA-Z0-9\-\;]{1,35})\/sele
console
.
groupEnd
();
return
[
status
,
_items
];
});
// Update
mock
.
onPut
(
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
productsalesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})
$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:productsalesliterature 方法: Update"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'salesliteratureid'
,
'relationshipsid'
];
const
matchArray
:
any
=
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
productsalesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})
$/
).
exec
(
config
.
url
);
let
tempValue
:
any
=
{};
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
({});
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
{}];
});
// Update
mock
.
onPut
(
new
RegExp
(
/^
\/
productsalesliteratures
\/?([
a-zA-Z0-9
\-\;]{0,35})
$/
)).
reply
((
config
:
any
)
=>
{
...
...
@@ -152,6 +210,33 @@ mock.onPut(new RegExp(/^\/productsalesliteratures\/?([a-zA-Z0-9\-\;]{0,35})$/)).
console
.
groupEnd
();
return
[
status
,
data
];
});
// CheckKey
mock
.
onPost
(
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
productsalesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
checkkey$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:productsalesliterature 方法: CheckKey"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'salesliteratureid'
,
'relationshipsid'
];
const
matchArray
:
any
=
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
productsalesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
checkkey$/
).
exec
(
config
.
url
);
let
tempValue
:
any
=
{};
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
({});
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
{}];
});
// CheckKey
mock
.
onPost
(
new
RegExp
(
/^
\/
productsalesliteratures
\/?([
a-zA-Z0-9
\-\;]{0,35})\/
checkkey$/
)).
reply
((
config
:
any
)
=>
{
...
...
@@ -191,6 +276,23 @@ mock.onPost(new RegExp(/^\/productsalesliteratures\/?([a-zA-Z0-9\-\;]{0,35})\/ch
return
[
status
,
data
];
});
// GetDraft
mock
.
onGet
(
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
productsalesliteratures
\/
getdraft$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:productsalesliterature 方法: GetDraft"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
// GetDraft
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
({});
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
{}];
});
// GetDraft
mock
.
onGet
(
new
RegExp
(
/^
\/
productsalesliteratures
\/
getdraft$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:productsalesliterature 方法: GetDraft"
);
...
...
@@ -206,6 +308,33 @@ mock.onGet(new RegExp(/^\/productsalesliteratures\/getdraft$/)).reply((config: a
console
.
groupEnd
();
return
[
status
,
{}];
});
// Save
mock
.
onPost
(
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
productsalesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
save$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:productsalesliterature 方法: Save"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'salesliteratureid'
,
'relationshipsid'
];
const
matchArray
:
any
=
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
productsalesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
save$/
).
exec
(
config
.
url
);
let
tempValue
:
any
=
{};
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
({});
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
{}];
});
// Save
mock
.
onPost
(
new
RegExp
(
/^
\/
productsalesliteratures
\/?([
a-zA-Z0-9
\-\;]{0,35})\/
save$/
)).
reply
((
config
:
any
)
=>
{
...
...
@@ -244,6 +373,33 @@ mock.onPost(new RegExp(/^\/productsalesliteratures\/?([a-zA-Z0-9\-\;]{0,35})\/sa
console
.
groupEnd
();
return
[
status
,
data
];
});
// Create
mock
.
onPost
(
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
productsalesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})
$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:productsalesliterature 方法: Create"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'salesliteratureid'
,
'relationshipsid'
];
const
matchArray
:
any
=
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
productsalesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})
$/
).
exec
(
config
.
url
);
let
tempValue
:
any
=
{};
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
({});
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
{}];
});
// Create
mock
.
onPost
(
new
RegExp
(
/^
\/
productsalesliteratures
\/?([
a-zA-Z0-9
\-\;]{0,35})
$/
)).
reply
((
config
:
any
)
=>
{
...
...
@@ -270,6 +426,51 @@ mock.onPost(new RegExp(/^\/productsalesliteratures\/?([a-zA-Z0-9\-\;]{0,35})$/))
console
.
groupEnd
();
return
[
status
,
mockDatas
[
0
]];
});
// FetchDefault
mock
.
onGet
(
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
productsalesliteratures
\/
fetchdefault$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:productsalesliterature 方法: FetchDefault"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'salesliteratureid'
];
let
tempValue
:
any
=
{};
const
matchArray
:
any
=
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
productsalesliteratures
\/
fetchdefault$/
).
exec
(
config
.
url
);
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
let
items
=
mockDatas
?
mockDatas
:
[];
if
(
items
.
length
>
0
&&
paramArray
.
length
>
0
)
{
paramArray
.
forEach
((
paramkey
:
any
)
=>
{
if
(
tempValue
[
paramkey
]
&&
tempValue
[
paramkey
].
indexOf
(
";"
)
>
0
)
{
let
keysGrounp
:
Array
<
any
>
=
tempValue
[
paramkey
].
split
(
new
RegExp
(
/
[\;]
/
));
let
tempArray
:
Array
<
any
>
=
[];
keysGrounp
.
forEach
((
singlekey
:
any
)
=>
{
let
_items
=
items
.
filter
((
item
:
any
)
=>
{
return
item
[
paramkey
]
==
singlekey
});
if
(
_items
.
length
>
0
){
tempArray
.
push
(...
_items
);
}
})
items
=
tempArray
;
}
else
{
items
=
items
.
filter
((
item
:
any
)
=>
{
return
item
[
paramkey
]
==
tempValue
[
paramkey
]
});
}
})
}
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
(
items
);
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
items
];
});
// FetchDefault
mock
.
onGet
(
new
RegExp
(
/^
\/
productsalesliteratures
\/
fetchdefault$/
)).
reply
((
config
:
any
)
=>
{
...
...
@@ -314,15 +515,57 @@ mock.onGet(new RegExp(/^\/productsalesliteratures\/fetchdefault(\?[\w-./?%&=,]*)
console
.
groupEnd
();
return
[
status
,
records
?
records
:
[]];
});
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// Remove
mock
.
onDelete
(
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
productsalesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})
$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:productsalesliterature 方法: Remove"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'salesliteratureid'
,
'relationshipsid'
];
const
matchArray
:
any
=
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
productsalesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})
$/
).
exec
(
config
.
url
);
let
tempValue
:
any
=
{};
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
let
items
=
mockDatas
?
mockDatas
:
[];
let
_items
=
items
.
find
((
item
:
any
)
=>
Object
.
is
(
item
.
relationshipsid
,
tempValue
.
relationshipsid
));
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
(
_items
?
_items
:{});
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
_items
?
_items
:{}];
});
// Remove
mock
.
onDelete
(
new
RegExp
(
/^
\/
productsalesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})
$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:productsalesliterature 方法: Remove"
);
...
...
@@ -351,6 +594,34 @@ mock.onDelete(new RegExp(/^\/productsalesliteratures\/([a-zA-Z0-9\-\;]{1,35})$/)
return
[
status
,
_items
?
_items
:{}];
});
// Get
mock
.
onGet
(
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
productsalesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})
$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:productsalesliterature 方法: Get"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'salesliteratureid'
,
'relationshipsid'
];
const
matchArray
:
any
=
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
productsalesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})
$/
).
exec
(
config
.
url
);
let
tempValue
:
any
=
{};
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
let
items
=
mockDatas
?
mockDatas
:
[];
let
_items
=
items
.
find
((
item
:
any
)
=>
Object
.
is
(
item
.
relationshipsid
,
tempValue
.
relationshipsid
));
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
(
_items
?
_items
:{});
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
_items
?
_items
:{}];
});
// Get
mock
.
onGet
(
new
RegExp
(
/^
\/
productsalesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})
$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:productsalesliterature 方法: Get"
);
...
...
app_CRM/src/mock/entity/sales-literature-items/sales-literature-items.ts
浏览文件 @
60d9e01e
...
...
@@ -87,6 +87,35 @@ mock.onDelete(new RegExp(/^\/salesliteratureitems\/batch$/)).reply((config: any)
});
// Select
mock
.
onGet
(
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
salesliteratureitems
\/([
a-zA-Z0-9
\-\;]{1,35})\/
select$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:salesliteratureitem 方法: Select"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'salesliteratureid'
,
'salesliteratureitemid'
];
const
matchArray
:
any
=
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
salesliteratureitems
\/([
a-zA-Z0-9
\-\;]{1,35})\/
select$/
).
exec
(
config
.
url
);
let
tempValue
:
any
=
{};
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
let
items
=
mockDatas
?
mockDatas
:
[];
let
_items
=
items
.
find
((
item
:
any
)
=>
Object
.
is
(
item
.
salesliteratureitemid
,
tempValue
.
salesliteratureitemid
));
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
(
_items
);
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
_items
];
});
// Select
mock
.
onGet
(
new
RegExp
(
/^
\/
salesliteratureitems
\/([
a-zA-Z0-9
\-\;]{1,35})\/
select$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:salesliteratureitem 方法: Select"
);
...
...
@@ -114,6 +143,33 @@ mock.onGet(new RegExp(/^\/salesliteratureitems\/([a-zA-Z0-9\-\;]{1,35})\/select$
console
.
groupEnd
();
return
[
status
,
_items
];
});
// Save
mock
.
onPost
(
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
salesliteratureitems
\/([
a-zA-Z0-9
\-\;]{1,35})\/
save$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:salesliteratureitem 方法: Save"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'salesliteratureid'
,
'salesliteratureitemid'
];
const
matchArray
:
any
=
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
salesliteratureitems
\/([
a-zA-Z0-9
\-\;]{1,35})\/
save$/
).
exec
(
config
.
url
);
let
tempValue
:
any
=
{};
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
({});
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
{}];
});
// Save
mock
.
onPost
(
new
RegExp
(
/^
\/
salesliteratureitems
\/?([
a-zA-Z0-9
\-\;]{0,35})\/
save$/
)).
reply
((
config
:
any
)
=>
{
...
...
@@ -153,6 +209,24 @@ mock.onPost(new RegExp(/^\/salesliteratureitems\/?([a-zA-Z0-9\-\;]{0,35})\/save$
return
[
status
,
data
];
});
// GetDraft
mock
.
onGet
(
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
salesliteratureitems
\/
getdraft$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:salesliteratureitem 方法: GetDraft"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
// GetDraft
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
({});
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
{}];
});
// GetDraft
mock
.
onGet
(
new
RegExp
(
/^
\/
salesliteratureitems
\/
getdraft$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:salesliteratureitem 方法: GetDraft"
);
...
...
@@ -168,6 +242,34 @@ mock.onGet(new RegExp(/^\/salesliteratureitems\/getdraft$/)).reply((config: any)
console
.
groupEnd
();
return
[
status
,
{}];
});
// Update
mock
.
onPut
(
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
salesliteratureitems
\/([
a-zA-Z0-9
\-\;]{1,35})
$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:salesliteratureitem 方法: Update"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'salesliteratureid'
,
'salesliteratureitemid'
];
const
matchArray
:
any
=
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
salesliteratureitems
\/([
a-zA-Z0-9
\-\;]{1,35})
$/
).
exec
(
config
.
url
);
let
tempValue
:
any
=
{};
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
({});
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
{}];
});
// Update
mock
.
onPut
(
new
RegExp
(
/^
\/
salesliteratureitems
\/?([
a-zA-Z0-9
\-\;]{0,35})
$/
)).
reply
((
config
:
any
)
=>
{
...
...
@@ -206,6 +308,33 @@ mock.onPut(new RegExp(/^\/salesliteratureitems\/?([a-zA-Z0-9\-\;]{0,35})$/)).rep
console
.
groupEnd
();
return
[
status
,
data
];
});
// CheckKey
mock
.
onPost
(
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
salesliteratureitems
\/([
a-zA-Z0-9
\-\;]{1,35})\/
checkkey$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:salesliteratureitem 方法: CheckKey"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'salesliteratureid'
,
'salesliteratureitemid'
];
const
matchArray
:
any
=
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
salesliteratureitems
\/([
a-zA-Z0-9
\-\;]{1,35})\/
checkkey$/
).
exec
(
config
.
url
);
let
tempValue
:
any
=
{};
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
({});
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
{}];
});
// CheckKey
mock
.
onPost
(
new
RegExp
(
/^
\/
salesliteratureitems
\/?([
a-zA-Z0-9
\-\;]{0,35})\/
checkkey$/
)).
reply
((
config
:
any
)
=>
{
...
...
@@ -244,6 +373,33 @@ mock.onPost(new RegExp(/^\/salesliteratureitems\/?([a-zA-Z0-9\-\;]{0,35})\/check
console
.
groupEnd
();
return
[
status
,
data
];
});
// Create
mock
.
onPost
(
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
salesliteratureitems
\/([
a-zA-Z0-9
\-\;]{1,35})
$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:salesliteratureitem 方法: Create"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'salesliteratureid'
,
'salesliteratureitemid'
];
const
matchArray
:
any
=
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
salesliteratureitems
\/([
a-zA-Z0-9
\-\;]{1,35})
$/
).
exec
(
config
.
url
);
let
tempValue
:
any
=
{};
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
({});
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
{}];
});
// Create
mock
.
onPost
(
new
RegExp
(
/^
\/
salesliteratureitems
\/?([
a-zA-Z0-9
\-\;]{0,35})
$/
)).
reply
((
config
:
any
)
=>
{
...
...
@@ -270,6 +426,51 @@ mock.onPost(new RegExp(/^\/salesliteratureitems\/?([a-zA-Z0-9\-\;]{0,35})$/)).re
console
.
groupEnd
();
return
[
status
,
mockDatas
[
0
]];
});
// FetchDefault
mock
.
onGet
(
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
salesliteratureitems
\/
fetchdefault$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:salesliteratureitem 方法: FetchDefault"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'salesliteratureid'
];
let
tempValue
:
any
=
{};
const
matchArray
:
any
=
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
salesliteratureitems
\/
fetchdefault$/
).
exec
(
config
.
url
);
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
let
items
=
mockDatas
?
mockDatas
:
[];
if
(
items
.
length
>
0
&&
paramArray
.
length
>
0
)
{
paramArray
.
forEach
((
paramkey
:
any
)
=>
{
if
(
tempValue
[
paramkey
]
&&
tempValue
[
paramkey
].
indexOf
(
";"
)
>
0
)
{
let
keysGrounp
:
Array
<
any
>
=
tempValue
[
paramkey
].
split
(
new
RegExp
(
/
[\;]
/
));
let
tempArray
:
Array
<
any
>
=
[];
keysGrounp
.
forEach
((
singlekey
:
any
)
=>
{
let
_items
=
items
.
filter
((
item
:
any
)
=>
{
return
item
[
paramkey
]
==
singlekey
});
if
(
_items
.
length
>
0
){
tempArray
.
push
(...
_items
);
}
})
items
=
tempArray
;
}
else
{
items
=
items
.
filter
((
item
:
any
)
=>
{
return
item
[
paramkey
]
==
tempValue
[
paramkey
]
});
}
})
}
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
(
items
);
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
items
];
});
// FetchDefault
mock
.
onGet
(
new
RegExp
(
/^
\/
salesliteratureitems
\/
fetchdefault$/
)).
reply
((
config
:
any
)
=>
{
...
...
@@ -314,15 +515,57 @@ mock.onGet(new RegExp(/^\/salesliteratureitems\/fetchdefault(\?[\w-./?%&=,]*)*$/
console
.
groupEnd
();
return
[
status
,
records
?
records
:
[]];
});
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// Get
mock
.
onGet
(
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
salesliteratureitems
\/([
a-zA-Z0-9
\-\;]{1,35})
$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:salesliteratureitem 方法: Get"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'salesliteratureid'
,
'salesliteratureitemid'
];
const
matchArray
:
any
=
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
salesliteratureitems
\/([
a-zA-Z0-9
\-\;]{1,35})
$/
).
exec
(
config
.
url
);
let
tempValue
:
any
=
{};
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
let
items
=
mockDatas
?
mockDatas
:
[];
let
_items
=
items
.
find
((
item
:
any
)
=>
Object
.
is
(
item
.
salesliteratureitemid
,
tempValue
.
salesliteratureitemid
));
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
(
_items
?
_items
:{});
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
_items
?
_items
:{}];
});
// Get
mock
.
onGet
(
new
RegExp
(
/^
\/
salesliteratureitems
\/([
a-zA-Z0-9
\-\;]{1,35})
$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:salesliteratureitem 方法: Get"
);
...
...
@@ -351,6 +594,34 @@ mock.onGet(new RegExp(/^\/salesliteratureitems\/([a-zA-Z0-9\-\;]{1,35})$/)).repl
return
[
status
,
_items
?
_items
:{}];
});
// Remove
mock
.
onDelete
(
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
salesliteratureitems
\/([
a-zA-Z0-9
\-\;]{1,35})
$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:salesliteratureitem 方法: Remove"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'salesliteratureid'
,
'salesliteratureitemid'
];
const
matchArray
:
any
=
new
RegExp
(
/^
\/
salesliteratures
\/([
a-zA-Z0-9
\-\;]{1,35})\/
salesliteratureitems
\/([
a-zA-Z0-9
\-\;]{1,35})
$/
).
exec
(
config
.
url
);
let
tempValue
:
any
=
{};
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
let
items
=
mockDatas
?
mockDatas
:
[];
let
_items
=
items
.
find
((
item
:
any
)
=>
Object
.
is
(
item
.
salesliteratureitemid
,
tempValue
.
salesliteratureitemid
));
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
(
_items
?
_items
:{});
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
_items
?
_items
:{}];
});
// Remove
mock
.
onDelete
(
new
RegExp
(
/^
\/
salesliteratureitems
\/([
a-zA-Z0-9
\-\;]{1,35})
$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:salesliteratureitem 方法: Remove"
);
...
...
app_CRM/src/mock/index.ts
浏览文件 @
60d9e01e
...
...
@@ -39,6 +39,7 @@ import './entity/quotes/quotes';
import
'./entity/campaign-activitys/campaign-activitys'
;
import
'./entity/list-leads/list-leads'
;
import
'./entity/opportunity-competitors/opportunity-competitors'
;
import
'./entity/competitor-sales-literatures/competitor-sales-literatures'
;
import
'./entity/sales-literature-items/sales-literature-items'
;
import
'./entity/contacts/contacts'
;
import
'./entity/products/products'
;
...
...
app_CRM/src/service/campaign/campaign-service-base.ts
浏览文件 @
60d9e01e
...
...
@@ -62,21 +62,21 @@ export default class CampaignServiceBase extends EntityService {
*/
public
async
Create
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
let
masterData
:
any
=
{};
let
lead
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
lead
s'
),
'undefined'
)){
leadsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_lead
s'
)
as
any
);
if
(
leadsData
&&
leadsData
.
length
&&
lead
sData
.
length
>
0
){
lead
sData
.
forEach
((
item
:
any
)
=>
{
let
campaignlist
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
campaignlist
s'
),
'undefined'
)){
campaignlistsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_campaignlist
s'
)
as
any
);
if
(
campaignlistsData
&&
campaignlistsData
.
length
&&
campaignlist
sData
.
length
>
0
){
campaignlist
sData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
lead
id
=
null
;
item
.
relationships
id
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
leads
=
lead
sData
;
masterData
.
campaignlists
=
campaignlist
sData
;
let
campaigncampaignsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_campaigncampaigns'
),
'undefined'
)){
campaigncampaignsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_campaigncampaigns'
)
as
any
);
...
...
@@ -92,21 +92,21 @@ export default class CampaignServiceBase extends EntityService {
}
}
masterData
.
campaigncampaigns
=
campaigncampaignsData
;
let
campaignlist
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
campaignlist
s'
),
'undefined'
)){
campaignlistsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_campaignlist
s'
)
as
any
);
if
(
campaignlistsData
&&
campaignlistsData
.
length
&&
campaignlist
sData
.
length
>
0
){
campaignlist
sData
.
forEach
((
item
:
any
)
=>
{
let
lead
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
lead
s'
),
'undefined'
)){
leadsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_lead
s'
)
as
any
);
if
(
leadsData
&&
leadsData
.
length
&&
lead
sData
.
length
>
0
){
lead
sData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
relationships
id
=
null
;
item
.
lead
id
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
campaignlists
=
campaignlist
sData
;
masterData
.
leads
=
lead
sData
;
Object
.
assign
(
data
,
masterData
);
if
(
!
data
.
srffrontuf
||
data
.
srffrontuf
!==
"1"
){
data
[
this
.
APPDEKEY
]
=
null
;
...
...
@@ -116,9 +116,9 @@ export default class CampaignServiceBase extends EntityService {
}
let
tempContext
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
context
));
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/campaigns`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_leads'
,
JSON
.
stringify
(
res
.
data
.
leads
));
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_campaigncampaigns'
,
JSON
.
stringify
(
res
.
data
.
campaigncampaigns
));
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_campaignlists'
,
JSON
.
stringify
(
res
.
data
.
campaignlists
));
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_campaigncampaigns'
,
JSON
.
stringify
(
res
.
data
.
campaigncampaigns
));
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_leads'
,
JSON
.
stringify
(
res
.
data
.
leads
));
return
res
;
}
...
...
@@ -133,21 +133,21 @@ export default class CampaignServiceBase extends EntityService {
*/
public
async
Save
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
let
masterData
:
any
=
{};
let
lead
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
lead
s'
),
'undefined'
)){
leadsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_lead
s'
)
as
any
);
if
(
leadsData
&&
leadsData
.
length
&&
lead
sData
.
length
>
0
){
lead
sData
.
forEach
((
item
:
any
)
=>
{
let
campaignlist
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
campaignlist
s'
),
'undefined'
)){
campaignlistsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_campaignlist
s'
)
as
any
);
if
(
campaignlistsData
&&
campaignlistsData
.
length
&&
campaignlist
sData
.
length
>
0
){
campaignlist
sData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
lead
id
=
null
;
item
.
relationships
id
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
leads
=
lead
sData
;
masterData
.
campaignlists
=
campaignlist
sData
;
let
campaigncampaignsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_campaigncampaigns'
),
'undefined'
)){
campaigncampaignsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_campaigncampaigns'
)
as
any
);
...
...
@@ -163,26 +163,26 @@ export default class CampaignServiceBase extends EntityService {
}
}
masterData
.
campaigncampaigns
=
campaigncampaignsData
;
let
campaignlist
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
campaignlist
s'
),
'undefined'
)){
campaignlistsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_campaignlist
s'
)
as
any
);
if
(
campaignlistsData
&&
campaignlistsData
.
length
&&
campaignlist
sData
.
length
>
0
){
campaignlist
sData
.
forEach
((
item
:
any
)
=>
{
let
lead
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
lead
s'
),
'undefined'
)){
leadsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_lead
s'
)
as
any
);
if
(
leadsData
&&
leadsData
.
length
&&
lead
sData
.
length
>
0
){
lead
sData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
relationships
id
=
null
;
item
.
lead
id
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
campaignlists
=
campaignlist
sData
;
masterData
.
leads
=
lead
sData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/campaigns/
${
context
.
campaign
}
/save`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_leads'
,
JSON
.
stringify
(
res
.
data
.
leads
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_campaigncampaigns'
,
JSON
.
stringify
(
res
.
data
.
campaigncampaigns
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_campaignlists'
,
JSON
.
stringify
(
res
.
data
.
campaignlists
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_campaigncampaigns'
,
JSON
.
stringify
(
res
.
data
.
campaigncampaigns
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_leads'
,
JSON
.
stringify
(
res
.
data
.
leads
));
return
res
;
}
...
...
@@ -198,9 +198,9 @@ export default class CampaignServiceBase extends EntityService {
public
async
GetDraft
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
let
res
:
any
=
await
Http
.
getInstance
().
get
(
`/campaigns/getdraft`
,
isloading
);
res
.
data
.
campaign
=
data
.
campaign
;
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_leads'
,
JSON
.
stringify
(
res
.
data
.
leads
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_campaigncampaigns'
,
JSON
.
stringify
(
res
.
data
.
campaigncampaigns
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_campaignlists'
,
JSON
.
stringify
(
res
.
data
.
campaignlists
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_campaigncampaigns'
,
JSON
.
stringify
(
res
.
data
.
campaigncampaigns
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_leads'
,
JSON
.
stringify
(
res
.
data
.
leads
));
return
res
;
}
...
...
@@ -215,21 +215,21 @@ export default class CampaignServiceBase extends EntityService {
*/
public
async
Update
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
let
masterData
:
any
=
{};
let
lead
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
lead
s'
),
'undefined'
)){
leadsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_lead
s'
)
as
any
);
if
(
leadsData
&&
leadsData
.
length
&&
lead
sData
.
length
>
0
){
lead
sData
.
forEach
((
item
:
any
)
=>
{
let
campaignlist
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
campaignlist
s'
),
'undefined'
)){
campaignlistsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_campaignlist
s'
)
as
any
);
if
(
campaignlistsData
&&
campaignlistsData
.
length
&&
campaignlist
sData
.
length
>
0
){
campaignlist
sData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
lead
id
=
null
;
item
.
relationships
id
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
leads
=
lead
sData
;
masterData
.
campaignlists
=
campaignlist
sData
;
let
campaigncampaignsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_campaigncampaigns'
),
'undefined'
)){
campaigncampaignsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_campaigncampaigns'
)
as
any
);
...
...
@@ -245,26 +245,26 @@ export default class CampaignServiceBase extends EntityService {
}
}
masterData
.
campaigncampaigns
=
campaigncampaignsData
;
let
campaignlist
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
campaignlist
s'
),
'undefined'
)){
campaignlistsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_campaignlist
s'
)
as
any
);
if
(
campaignlistsData
&&
campaignlistsData
.
length
&&
campaignlist
sData
.
length
>
0
){
campaignlist
sData
.
forEach
((
item
:
any
)
=>
{
let
lead
sData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_
lead
s'
),
'undefined'
)){
leadsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_lead
s'
)
as
any
);
if
(
leadsData
&&
leadsData
.
length
&&
lead
sData
.
length
>
0
){
lead
sData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
relationships
id
=
null
;
item
.
lead
id
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
campaignlists
=
campaignlist
sData
;
masterData
.
leads
=
lead
sData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
put
(
`/campaigns/
${
context
.
campaign
}
`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_leads'
,
JSON
.
stringify
(
res
.
data
.
leads
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_campaigncampaigns'
,
JSON
.
stringify
(
res
.
data
.
campaigncampaigns
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_campaignlists'
,
JSON
.
stringify
(
res
.
data
.
campaignlists
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_campaigncampaigns'
,
JSON
.
stringify
(
res
.
data
.
campaigncampaigns
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_leads'
,
JSON
.
stringify
(
res
.
data
.
leads
));
return
res
;
}
...
...
@@ -279,9 +279,9 @@ export default class CampaignServiceBase extends EntityService {
*/
public
async
Get
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
let
res
:
any
=
await
Http
.
getInstance
().
get
(
`/campaigns/
${
context
.
campaign
}
`
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_leads'
,
JSON
.
stringify
(
res
.
data
.
leads
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_campaigncampaigns'
,
JSON
.
stringify
(
res
.
data
.
campaigncampaigns
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_campaignlists'
,
JSON
.
stringify
(
res
.
data
.
campaignlists
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_campaigncampaigns'
,
JSON
.
stringify
(
res
.
data
.
campaigncampaigns
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_leads'
,
JSON
.
stringify
(
res
.
data
.
leads
));
return
res
;
}
...
...
app_CRM/src/service/competitor-sales-literature/competitor-sales-literature-service-base.ts
0 → 100644
浏览文件 @
60d9e01e
import
{
Http
,
Util
}
from
'@/utils'
;
import
EntityService
from
'../entity-service'
;
/**
* 竞争对手宣传资料服务对象基类
*
* @export
* @class CompetitorSalesLiteratureServiceBase
* @extends {EntityServie}
*/
export
default
class
CompetitorSalesLiteratureServiceBase
extends
EntityService
{
/**
* Creates an instance of CompetitorSalesLiteratureServiceBase.
*
* @param {*} [opts={}]
* @memberof CompetitorSalesLiteratureServiceBase
*/
constructor
(
opts
:
any
=
{})
{
super
(
opts
);
}
/**
* 初始化基础数据
*
* @memberof CompetitorSalesLiteratureServiceBase
*/
public
initBasicData
(){
this
.
APPLYDEKEY
=
'competitorsalesliterature'
;
this
.
APPDEKEY
=
'relationshipsid'
;
this
.
APPDENAME
=
'competitorsalesliteratures'
;
this
.
APPDETEXT
=
'relationshipsname'
;
this
.
APPNAME
=
'crm'
;
this
.
SYSTEMNAME
=
'ibizbusinesscentral'
;
}
// 实体接口
/**
* Select接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof CompetitorSalesLiteratureServiceBase
*/
public
async
Select
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
salesliterature
&&
context
.
competitorsalesliterature
){
return
Http
.
getInstance
().
get
(
`/salesliteratures/
${
context
.
salesliterature
}
/competitorsalesliteratures/
${
context
.
competitorsalesliterature
}
/select`
,
isloading
);
}
return
Http
.
getInstance
().
get
(
`/competitorsalesliteratures/
${
context
.
competitorsalesliterature
}
/select`
,
isloading
);
}
/**
* CheckKey接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof CompetitorSalesLiteratureServiceBase
*/
public
async
CheckKey
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
salesliterature
&&
context
.
competitorsalesliterature
){
let
masterData
:
any
=
{};
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/salesliteratures/
${
context
.
salesliterature
}
/competitorsalesliteratures/
${
context
.
competitorsalesliterature
}
/checkkey`
,
data
,
isloading
);
return
res
;
}
return
Http
.
getInstance
().
post
(
`/competitorsalesliteratures/
${
context
.
competitorsalesliterature
}
/checkkey`
,
data
,
isloading
);
}
/**
* Update接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof CompetitorSalesLiteratureServiceBase
*/
public
async
Update
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
salesliterature
&&
context
.
competitorsalesliterature
){
let
masterData
:
any
=
{};
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
put
(
`/salesliteratures/
${
context
.
salesliterature
}
/competitorsalesliteratures/
${
context
.
competitorsalesliterature
}
`
,
data
,
isloading
);
return
res
;
}
let
masterData
:
any
=
{};
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
put
(
`/competitorsalesliteratures/
${
context
.
competitorsalesliterature
}
`
,
data
,
isloading
);
return
res
;
}
/**
* Get接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof CompetitorSalesLiteratureServiceBase
*/
public
async
Get
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
salesliterature
&&
context
.
competitorsalesliterature
){
let
res
:
any
=
await
Http
.
getInstance
().
get
(
`/salesliteratures/
${
context
.
salesliterature
}
/competitorsalesliteratures/
${
context
.
competitorsalesliterature
}
`
,
isloading
);
return
res
;
}
let
res
:
any
=
await
Http
.
getInstance
().
get
(
`/competitorsalesliteratures/
${
context
.
competitorsalesliterature
}
`
,
isloading
);
return
res
;
}
/**
* Remove接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof CompetitorSalesLiteratureServiceBase
*/
public
async
Remove
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
salesliterature
&&
context
.
competitorsalesliterature
){
return
Http
.
getInstance
().
delete
(
`/salesliteratures/
${
context
.
salesliterature
}
/competitorsalesliteratures/
${
context
.
competitorsalesliterature
}
`
,
isloading
);
}
return
Http
.
getInstance
().
delete
(
`/competitorsalesliteratures/
${
context
.
competitorsalesliterature
}
`
,
isloading
);
}
/**
* Create接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof CompetitorSalesLiteratureServiceBase
*/
public
async
Create
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
salesliterature
&&
true
){
let
masterData
:
any
=
{};
Object
.
assign
(
data
,
masterData
);
if
(
!
data
.
srffrontuf
||
data
.
srffrontuf
!==
"1"
){
data
[
this
.
APPDEKEY
]
=
null
;
}
if
(
data
.
srffrontuf
){
delete
data
.
srffrontuf
;
}
let
tempContext
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
context
));
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/salesliteratures/
${
context
.
salesliterature
}
/competitorsalesliteratures`
,
data
,
isloading
);
return
res
;
}
let
masterData
:
any
=
{};
Object
.
assign
(
data
,
masterData
);
if
(
!
data
.
srffrontuf
||
data
.
srffrontuf
!==
"1"
){
data
[
this
.
APPDEKEY
]
=
null
;
}
if
(
data
.
srffrontuf
){
delete
data
.
srffrontuf
;
}
let
tempContext
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
context
));
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/competitorsalesliteratures`
,
data
,
isloading
);
return
res
;
}
/**
* Save接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof CompetitorSalesLiteratureServiceBase
*/
public
async
Save
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
salesliterature
&&
context
.
competitorsalesliterature
){
let
masterData
:
any
=
{};
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/salesliteratures/
${
context
.
salesliterature
}
/competitorsalesliteratures/
${
context
.
competitorsalesliterature
}
/save`
,
data
,
isloading
);
return
res
;
}
let
masterData
:
any
=
{};
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/competitorsalesliteratures/
${
context
.
competitorsalesliterature
}
/save`
,
data
,
isloading
);
return
res
;
}
/**
* GetDraft接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof CompetitorSalesLiteratureServiceBase
*/
public
async
GetDraft
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
salesliterature
&&
true
){
let
res
:
any
=
await
Http
.
getInstance
().
get
(
`/salesliteratures/
${
context
.
salesliterature
}
/competitorsalesliteratures/getdraft`
,
isloading
);
res
.
data
.
competitorsalesliterature
=
data
.
competitorsalesliterature
;
return
res
;
}
let
res
:
any
=
await
Http
.
getInstance
().
get
(
`/competitorsalesliteratures/getdraft`
,
isloading
);
res
.
data
.
competitorsalesliterature
=
data
.
competitorsalesliterature
;
return
res
;
}
/**
* FetchDefault接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof CompetitorSalesLiteratureServiceBase
*/
public
async
FetchDefault
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
salesliterature
&&
true
){
let
tempData
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
data
));
return
Http
.
getInstance
().
get
(
`/salesliteratures/
${
context
.
salesliterature
}
/competitorsalesliteratures/fetchdefault`
,
tempData
,
isloading
);
}
let
tempData
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
data
));
return
Http
.
getInstance
().
get
(
`/competitorsalesliteratures/fetchdefault`
,
tempData
,
isloading
);
}
}
\ No newline at end of file
app_CRM/src/service/competitor-sales-literature/competitor-sales-literature-service.ts
0 → 100644
浏览文件 @
60d9e01e
import
{
Http
,
Util
}
from
'@/utils'
;
import
CompetitorSalesLiteratureServiceBase
from
'./competitor-sales-literature-service-base'
;
/**
* 竞争对手宣传资料服务对象
*
* @export
* @class CompetitorSalesLiteratureService
* @extends {CompetitorSalesLiteratureServiceBase}
*/
export
default
class
CompetitorSalesLiteratureService
extends
CompetitorSalesLiteratureServiceBase
{
/**
* Creates an instance of CompetitorSalesLiteratureService.
*
* @param {*} [opts={}]
* @memberof CompetitorSalesLiteratureService
*/
constructor
(
opts
:
any
=
{})
{
super
(
opts
);
}
}
\ No newline at end of file
app_CRM/src/service/entity-service-register.ts
浏览文件 @
60d9e01e
...
...
@@ -71,6 +71,7 @@ export class EntityServiceRegister {
this
.
allEntityService
.
set
(
'campaignactivity'
,
()
=>
import
(
'@/service/campaign-activity/campaign-activity-service'
));
this
.
allEntityService
.
set
(
'listlead'
,
()
=>
import
(
'@/service/list-lead/list-lead-service'
));
this
.
allEntityService
.
set
(
'opportunitycompetitor'
,
()
=>
import
(
'@/service/opportunity-competitor/opportunity-competitor-service'
));
this
.
allEntityService
.
set
(
'competitorsalesliterature'
,
()
=>
import
(
'@/service/competitor-sales-literature/competitor-sales-literature-service'
));
this
.
allEntityService
.
set
(
'salesliteratureitem'
,
()
=>
import
(
'@/service/sales-literature-item/sales-literature-item-service'
));
this
.
allEntityService
.
set
(
'contact'
,
()
=>
import
(
'@/service/contact/contact-service'
));
this
.
allEntityService
.
set
(
'product'
,
()
=>
import
(
'@/service/product/product-service'
));
...
...
app_CRM/src/service/ibiz-list/ibiz-list-service-base.ts
浏览文件 @
60d9e01e
...
...
@@ -62,21 +62,6 @@ export default class IBizListServiceBase extends EntityService {
*/
public
async
Save
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
let
masterData
:
any
=
{};
let
listaccountsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listaccounts'
),
'undefined'
)){
listaccountsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listaccounts'
)
as
any
);
if
(
listaccountsData
&&
listaccountsData
.
length
&&
listaccountsData
.
length
>
0
){
listaccountsData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
relationshipsid
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
listaccounts
=
listaccountsData
;
let
listleadsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listleads'
),
'undefined'
)){
listleadsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listleads'
)
as
any
);
...
...
@@ -122,12 +107,27 @@ export default class IBizListServiceBase extends EntityService {
}
}
masterData
.
listcontacts
=
listcontactsData
;
let
listaccountsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listaccounts'
),
'undefined'
)){
listaccountsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listaccounts'
)
as
any
);
if
(
listaccountsData
&&
listaccountsData
.
length
&&
listaccountsData
.
length
>
0
){
listaccountsData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
relationshipsid
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
listaccounts
=
listaccountsData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/ibizlists/
${
context
.
ibizlist
}
/save`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_listaccounts'
,
JSON
.
stringify
(
res
.
data
.
listaccounts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_listleads'
,
JSON
.
stringify
(
res
.
data
.
listleads
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_campaignlists'
,
JSON
.
stringify
(
res
.
data
.
campaignlists
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_listcontacts'
,
JSON
.
stringify
(
res
.
data
.
listcontacts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_listaccounts'
,
JSON
.
stringify
(
res
.
data
.
listaccounts
));
return
res
;
}
...
...
@@ -168,21 +168,6 @@ export default class IBizListServiceBase extends EntityService {
*/
public
async
Update
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
let
masterData
:
any
=
{};
let
listaccountsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listaccounts'
),
'undefined'
)){
listaccountsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listaccounts'
)
as
any
);
if
(
listaccountsData
&&
listaccountsData
.
length
&&
listaccountsData
.
length
>
0
){
listaccountsData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
relationshipsid
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
listaccounts
=
listaccountsData
;
let
listleadsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listleads'
),
'undefined'
)){
listleadsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listleads'
)
as
any
);
...
...
@@ -228,12 +213,27 @@ export default class IBizListServiceBase extends EntityService {
}
}
masterData
.
listcontacts
=
listcontactsData
;
let
listaccountsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listaccounts'
),
'undefined'
)){
listaccountsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listaccounts'
)
as
any
);
if
(
listaccountsData
&&
listaccountsData
.
length
&&
listaccountsData
.
length
>
0
){
listaccountsData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
relationshipsid
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
listaccounts
=
listaccountsData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
put
(
`/ibizlists/
${
context
.
ibizlist
}
`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_listaccounts'
,
JSON
.
stringify
(
res
.
data
.
listaccounts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_listleads'
,
JSON
.
stringify
(
res
.
data
.
listleads
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_campaignlists'
,
JSON
.
stringify
(
res
.
data
.
campaignlists
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_listcontacts'
,
JSON
.
stringify
(
res
.
data
.
listcontacts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_listaccounts'
,
JSON
.
stringify
(
res
.
data
.
listaccounts
));
return
res
;
}
...
...
@@ -248,21 +248,6 @@ export default class IBizListServiceBase extends EntityService {
*/
public
async
Create
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
let
masterData
:
any
=
{};
let
listaccountsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listaccounts'
),
'undefined'
)){
listaccountsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listaccounts'
)
as
any
);
if
(
listaccountsData
&&
listaccountsData
.
length
&&
listaccountsData
.
length
>
0
){
listaccountsData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
relationshipsid
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
listaccounts
=
listaccountsData
;
let
listleadsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listleads'
),
'undefined'
)){
listleadsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listleads'
)
as
any
);
...
...
@@ -308,6 +293,21 @@ export default class IBizListServiceBase extends EntityService {
}
}
masterData
.
listcontacts
=
listcontactsData
;
let
listaccountsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listaccounts'
),
'undefined'
)){
listaccountsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_listaccounts'
)
as
any
);
if
(
listaccountsData
&&
listaccountsData
.
length
&&
listaccountsData
.
length
>
0
){
listaccountsData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
relationshipsid
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
listaccounts
=
listaccountsData
;
Object
.
assign
(
data
,
masterData
);
if
(
!
data
.
srffrontuf
||
data
.
srffrontuf
!==
"1"
){
data
[
this
.
APPDEKEY
]
=
null
;
...
...
@@ -317,10 +317,10 @@ export default class IBizListServiceBase extends EntityService {
}
let
tempContext
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
context
));
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/ibizlists`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_listaccounts'
,
JSON
.
stringify
(
res
.
data
.
listaccounts
));
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_listleads'
,
JSON
.
stringify
(
res
.
data
.
listleads
));
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_campaignlists'
,
JSON
.
stringify
(
res
.
data
.
campaignlists
));
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_listcontacts'
,
JSON
.
stringify
(
res
.
data
.
listcontacts
));
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_listaccounts'
,
JSON
.
stringify
(
res
.
data
.
listaccounts
));
return
res
;
}
...
...
@@ -335,10 +335,10 @@ export default class IBizListServiceBase extends EntityService {
*/
public
async
Get
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
let
res
:
any
=
await
Http
.
getInstance
().
get
(
`/ibizlists/
${
context
.
ibizlist
}
`
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_listaccounts'
,
JSON
.
stringify
(
res
.
data
.
listaccounts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_listleads'
,
JSON
.
stringify
(
res
.
data
.
listleads
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_campaignlists'
,
JSON
.
stringify
(
res
.
data
.
campaignlists
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_listcontacts'
,
JSON
.
stringify
(
res
.
data
.
listcontacts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_listaccounts'
,
JSON
.
stringify
(
res
.
data
.
listaccounts
));
return
res
;
}
...
...
@@ -354,10 +354,10 @@ export default class IBizListServiceBase extends EntityService {
public
async
GetDraft
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
let
res
:
any
=
await
Http
.
getInstance
().
get
(
`/ibizlists/getdraft`
,
isloading
);
res
.
data
.
ibizlist
=
data
.
ibizlist
;
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_listaccounts'
,
JSON
.
stringify
(
res
.
data
.
listaccounts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_listleads'
,
JSON
.
stringify
(
res
.
data
.
listleads
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_campaignlists'
,
JSON
.
stringify
(
res
.
data
.
campaignlists
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_listcontacts'
,
JSON
.
stringify
(
res
.
data
.
listcontacts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_listaccounts'
,
JSON
.
stringify
(
res
.
data
.
listaccounts
));
return
res
;
}
...
...
app_CRM/src/service/opportunity/opportunity-service-base.ts
浏览文件 @
60d9e01e
...
...
@@ -69,21 +69,6 @@ export default class OpportunityServiceBase extends EntityService {
public
async
Win
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
account
&&
context
.
contact
&&
context
.
opportunity
){
let
masterData
:
any
=
{};
let
quotesData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_quotes'
),
'undefined'
)){
quotesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_quotes'
)
as
any
);
if
(
quotesData
&&
quotesData
.
length
&&
quotesData
.
length
>
0
){
quotesData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
quoteid
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
quotes
=
quotesData
;
let
opportunityproductsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
),
'undefined'
)){
opportunityproductsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
)
as
any
);
...
...
@@ -114,15 +99,6 @@ export default class OpportunityServiceBase extends EntityService {
}
}
masterData
.
opportunitycompetitors
=
opportunitycompetitorsData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/accounts/
${
context
.
account
}
/contacts/
${
context
.
contact
}
/opportunities/
${
context
.
opportunity
}
/win`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
return
res
;
}
if
(
context
.
contact
&&
context
.
opportunity
){
let
masterData
:
any
=
{};
let
quotesData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_quotes'
),
'undefined'
)){
quotesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_quotes'
)
as
any
);
...
...
@@ -138,6 +114,15 @@ export default class OpportunityServiceBase extends EntityService {
}
}
masterData
.
quotes
=
quotesData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/accounts/
${
context
.
account
}
/contacts/
${
context
.
contact
}
/opportunities/
${
context
.
opportunity
}
/win`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
return
res
;
}
if
(
context
.
contact
&&
context
.
opportunity
){
let
masterData
:
any
=
{};
let
opportunityproductsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
),
'undefined'
)){
opportunityproductsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
)
as
any
);
...
...
@@ -168,11 +153,26 @@ export default class OpportunityServiceBase extends EntityService {
}
}
masterData
.
opportunitycompetitors
=
opportunitycompetitorsData
;
let
quotesData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_quotes'
),
'undefined'
)){
quotesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_quotes'
)
as
any
);
if
(
quotesData
&&
quotesData
.
length
&&
quotesData
.
length
>
0
){
quotesData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
quoteid
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
quotes
=
quotesData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/contacts/
${
context
.
contact
}
/opportunities/
${
context
.
opportunity
}
/win`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
return
res
;
}
return
Http
.
getInstance
().
post
(
`/opportunities/
${
context
.
opportunity
}
/win`
,
data
,
isloading
);
...
...
@@ -190,21 +190,6 @@ export default class OpportunityServiceBase extends EntityService {
public
async
Lose
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
account
&&
context
.
contact
&&
context
.
opportunity
){
let
masterData
:
any
=
{};
let
quotesData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_quotes'
),
'undefined'
)){
quotesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_quotes'
)
as
any
);
if
(
quotesData
&&
quotesData
.
length
&&
quotesData
.
length
>
0
){
quotesData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
quoteid
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
quotes
=
quotesData
;
let
opportunityproductsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
),
'undefined'
)){
opportunityproductsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
)
as
any
);
...
...
@@ -235,15 +220,6 @@ export default class OpportunityServiceBase extends EntityService {
}
}
masterData
.
opportunitycompetitors
=
opportunitycompetitorsData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/accounts/
${
context
.
account
}
/contacts/
${
context
.
contact
}
/opportunities/
${
context
.
opportunity
}
/lose`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
return
res
;
}
if
(
context
.
contact
&&
context
.
opportunity
){
let
masterData
:
any
=
{};
let
quotesData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_quotes'
),
'undefined'
)){
quotesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_quotes'
)
as
any
);
...
...
@@ -259,6 +235,15 @@ export default class OpportunityServiceBase extends EntityService {
}
}
masterData
.
quotes
=
quotesData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/accounts/
${
context
.
account
}
/contacts/
${
context
.
contact
}
/opportunities/
${
context
.
opportunity
}
/lose`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
return
res
;
}
if
(
context
.
contact
&&
context
.
opportunity
){
let
masterData
:
any
=
{};
let
opportunityproductsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
),
'undefined'
)){
opportunityproductsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
)
as
any
);
...
...
@@ -289,11 +274,26 @@ export default class OpportunityServiceBase extends EntityService {
}
}
masterData
.
opportunitycompetitors
=
opportunitycompetitorsData
;
let
quotesData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_quotes'
),
'undefined'
)){
quotesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_quotes'
)
as
any
);
if
(
quotesData
&&
quotesData
.
length
&&
quotesData
.
length
>
0
){
quotesData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
quoteid
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
quotes
=
quotesData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/contacts/
${
context
.
contact
}
/opportunities/
${
context
.
opportunity
}
/lose`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
return
res
;
}
return
Http
.
getInstance
().
post
(
`/opportunities/
${
context
.
opportunity
}
/lose`
,
data
,
isloading
);
...
...
@@ -311,22 +311,22 @@ export default class OpportunityServiceBase extends EntityService {
public
async
Get
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
account
&&
context
.
contact
&&
context
.
opportunity
){
let
res
:
any
=
await
Http
.
getInstance
().
get
(
`/accounts/
${
context
.
account
}
/contacts/
${
context
.
contact
}
/opportunities/
${
context
.
opportunity
}
`
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
return
res
;
}
if
(
context
.
contact
&&
context
.
opportunity
){
let
res
:
any
=
await
Http
.
getInstance
().
get
(
`/contacts/
${
context
.
contact
}
/opportunities/
${
context
.
opportunity
}
`
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
return
res
;
}
let
res
:
any
=
await
Http
.
getInstance
().
get
(
`/opportunities/
${
context
.
opportunity
}
`
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
return
res
;
}
...
...
@@ -343,24 +343,24 @@ export default class OpportunityServiceBase extends EntityService {
if
(
context
.
account
&&
context
.
contact
&&
true
){
let
res
:
any
=
await
Http
.
getInstance
().
get
(
`/accounts/
${
context
.
account
}
/contacts/
${
context
.
contact
}
/opportunities/getdraft`
,
isloading
);
res
.
data
.
opportunity
=
data
.
opportunity
;
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
return
res
;
}
if
(
context
.
contact
&&
true
){
let
res
:
any
=
await
Http
.
getInstance
().
get
(
`/contacts/
${
context
.
contact
}
/opportunities/getdraft`
,
isloading
);
res
.
data
.
opportunity
=
data
.
opportunity
;
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
return
res
;
}
let
res
:
any
=
await
Http
.
getInstance
().
get
(
`/opportunities/getdraft`
,
isloading
);
res
.
data
.
opportunity
=
data
.
opportunity
;
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
return
res
;
}
...
...
@@ -376,21 +376,6 @@ export default class OpportunityServiceBase extends EntityService {
public
async
Create
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
account
&&
context
.
contact
&&
true
){
let
masterData
:
any
=
{};
let
quotesData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_quotes'
),
'undefined'
)){
quotesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_quotes'
)
as
any
);
if
(
quotesData
&&
quotesData
.
length
&&
quotesData
.
length
>
0
){
quotesData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
quoteid
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
quotes
=
quotesData
;
let
opportunityproductsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
),
'undefined'
)){
opportunityproductsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
)
as
any
);
...
...
@@ -421,22 +406,6 @@ export default class OpportunityServiceBase extends EntityService {
}
}
masterData
.
opportunitycompetitors
=
opportunitycompetitorsData
;
Object
.
assign
(
data
,
masterData
);
if
(
!
data
.
srffrontuf
||
data
.
srffrontuf
!==
"1"
){
data
[
this
.
APPDEKEY
]
=
null
;
}
if
(
data
.
srffrontuf
){
delete
data
.
srffrontuf
;
}
let
tempContext
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
context
));
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/accounts/
${
context
.
account
}
/contacts/
${
context
.
contact
}
/opportunities`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
return
res
;
}
if
(
context
.
contact
&&
true
){
let
masterData
:
any
=
{};
let
quotesData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_quotes'
),
'undefined'
)){
quotesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_quotes'
)
as
any
);
...
...
@@ -452,6 +421,22 @@ export default class OpportunityServiceBase extends EntityService {
}
}
masterData
.
quotes
=
quotesData
;
Object
.
assign
(
data
,
masterData
);
if
(
!
data
.
srffrontuf
||
data
.
srffrontuf
!==
"1"
){
data
[
this
.
APPDEKEY
]
=
null
;
}
if
(
data
.
srffrontuf
){
delete
data
.
srffrontuf
;
}
let
tempContext
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
context
));
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/accounts/
${
context
.
account
}
/contacts/
${
context
.
contact
}
/opportunities`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
return
res
;
}
if
(
context
.
contact
&&
true
){
let
masterData
:
any
=
{};
let
opportunityproductsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
),
'undefined'
)){
opportunityproductsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
)
as
any
);
...
...
@@ -482,21 +467,6 @@ export default class OpportunityServiceBase extends EntityService {
}
}
masterData
.
opportunitycompetitors
=
opportunitycompetitorsData
;
Object
.
assign
(
data
,
masterData
);
if
(
!
data
.
srffrontuf
||
data
.
srffrontuf
!==
"1"
){
data
[
this
.
APPDEKEY
]
=
null
;
}
if
(
data
.
srffrontuf
){
delete
data
.
srffrontuf
;
}
let
tempContext
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
context
));
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/contacts/
${
context
.
contact
}
/opportunities`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
return
res
;
}
let
masterData
:
any
=
{};
let
quotesData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_quotes'
),
'undefined'
)){
quotesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_quotes'
)
as
any
);
...
...
@@ -512,6 +482,21 @@ export default class OpportunityServiceBase extends EntityService {
}
}
masterData
.
quotes
=
quotesData
;
Object
.
assign
(
data
,
masterData
);
if
(
!
data
.
srffrontuf
||
data
.
srffrontuf
!==
"1"
){
data
[
this
.
APPDEKEY
]
=
null
;
}
if
(
data
.
srffrontuf
){
delete
data
.
srffrontuf
;
}
let
tempContext
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
context
));
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/contacts/
${
context
.
contact
}
/opportunities`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
return
res
;
}
let
masterData
:
any
=
{};
let
opportunityproductsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
),
'undefined'
)){
opportunityproductsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
)
as
any
);
...
...
@@ -542,6 +527,21 @@ export default class OpportunityServiceBase extends EntityService {
}
}
masterData
.
opportunitycompetitors
=
opportunitycompetitorsData
;
let
quotesData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_quotes'
),
'undefined'
)){
quotesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_quotes'
)
as
any
);
if
(
quotesData
&&
quotesData
.
length
&&
quotesData
.
length
>
0
){
quotesData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
quoteid
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
quotes
=
quotesData
;
Object
.
assign
(
data
,
masterData
);
if
(
!
data
.
srffrontuf
||
data
.
srffrontuf
!==
"1"
){
data
[
this
.
APPDEKEY
]
=
null
;
...
...
@@ -551,9 +551,9 @@ export default class OpportunityServiceBase extends EntityService {
}
let
tempContext
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
context
));
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/opportunities`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
return
res
;
}
...
...
@@ -588,21 +588,6 @@ export default class OpportunityServiceBase extends EntityService {
public
async
Update
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
account
&&
context
.
contact
&&
context
.
opportunity
){
let
masterData
:
any
=
{};
let
quotesData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_quotes'
),
'undefined'
)){
quotesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_quotes'
)
as
any
);
if
(
quotesData
&&
quotesData
.
length
&&
quotesData
.
length
>
0
){
quotesData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
quoteid
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
quotes
=
quotesData
;
let
opportunityproductsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
),
'undefined'
)){
opportunityproductsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
)
as
any
);
...
...
@@ -633,15 +618,6 @@ export default class OpportunityServiceBase extends EntityService {
}
}
masterData
.
opportunitycompetitors
=
opportunitycompetitorsData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
put
(
`/accounts/
${
context
.
account
}
/contacts/
${
context
.
contact
}
/opportunities/
${
context
.
opportunity
}
`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
return
res
;
}
if
(
context
.
contact
&&
context
.
opportunity
){
let
masterData
:
any
=
{};
let
quotesData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_quotes'
),
'undefined'
)){
quotesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_quotes'
)
as
any
);
...
...
@@ -657,6 +633,15 @@ export default class OpportunityServiceBase extends EntityService {
}
}
masterData
.
quotes
=
quotesData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
put
(
`/accounts/
${
context
.
account
}
/contacts/
${
context
.
contact
}
/opportunities/
${
context
.
opportunity
}
`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
return
res
;
}
if
(
context
.
contact
&&
context
.
opportunity
){
let
masterData
:
any
=
{};
let
opportunityproductsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
),
'undefined'
)){
opportunityproductsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
)
as
any
);
...
...
@@ -687,14 +672,6 @@ export default class OpportunityServiceBase extends EntityService {
}
}
masterData
.
opportunitycompetitors
=
opportunitycompetitorsData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
put
(
`/contacts/
${
context
.
contact
}
/opportunities/
${
context
.
opportunity
}
`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
return
res
;
}
let
masterData
:
any
=
{};
let
quotesData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_quotes'
),
'undefined'
)){
quotesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_quotes'
)
as
any
);
...
...
@@ -710,6 +687,14 @@ export default class OpportunityServiceBase extends EntityService {
}
}
masterData
.
quotes
=
quotesData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
put
(
`/contacts/
${
context
.
contact
}
/opportunities/
${
context
.
opportunity
}
`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
return
res
;
}
let
masterData
:
any
=
{};
let
opportunityproductsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
),
'undefined'
)){
opportunityproductsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
)
as
any
);
...
...
@@ -740,11 +725,26 @@ export default class OpportunityServiceBase extends EntityService {
}
}
masterData
.
opportunitycompetitors
=
opportunitycompetitorsData
;
let
quotesData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_quotes'
),
'undefined'
)){
quotesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_quotes'
)
as
any
);
if
(
quotesData
&&
quotesData
.
length
&&
quotesData
.
length
>
0
){
quotesData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
quoteid
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
quotes
=
quotesData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
put
(
`/opportunities/
${
context
.
opportunity
}
`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
return
res
;
}
...
...
@@ -760,21 +760,6 @@ export default class OpportunityServiceBase extends EntityService {
public
async
CheckKey
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
account
&&
context
.
contact
&&
context
.
opportunity
){
let
masterData
:
any
=
{};
let
quotesData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_quotes'
),
'undefined'
)){
quotesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_quotes'
)
as
any
);
if
(
quotesData
&&
quotesData
.
length
&&
quotesData
.
length
>
0
){
quotesData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
quoteid
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
quotes
=
quotesData
;
let
opportunityproductsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
),
'undefined'
)){
opportunityproductsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
)
as
any
);
...
...
@@ -805,15 +790,6 @@ export default class OpportunityServiceBase extends EntityService {
}
}
masterData
.
opportunitycompetitors
=
opportunitycompetitorsData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/accounts/
${
context
.
account
}
/contacts/
${
context
.
contact
}
/opportunities/
${
context
.
opportunity
}
/checkkey`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
return
res
;
}
if
(
context
.
contact
&&
context
.
opportunity
){
let
masterData
:
any
=
{};
let
quotesData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_quotes'
),
'undefined'
)){
quotesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_quotes'
)
as
any
);
...
...
@@ -829,6 +805,15 @@ export default class OpportunityServiceBase extends EntityService {
}
}
masterData
.
quotes
=
quotesData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/accounts/
${
context
.
account
}
/contacts/
${
context
.
contact
}
/opportunities/
${
context
.
opportunity
}
/checkkey`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
return
res
;
}
if
(
context
.
contact
&&
context
.
opportunity
){
let
masterData
:
any
=
{};
let
opportunityproductsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
),
'undefined'
)){
opportunityproductsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
)
as
any
);
...
...
@@ -859,11 +844,26 @@ export default class OpportunityServiceBase extends EntityService {
}
}
masterData
.
opportunitycompetitors
=
opportunitycompetitorsData
;
let
quotesData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_quotes'
),
'undefined'
)){
quotesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_quotes'
)
as
any
);
if
(
quotesData
&&
quotesData
.
length
&&
quotesData
.
length
>
0
){
quotesData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
quoteid
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
quotes
=
quotesData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/contacts/
${
context
.
contact
}
/opportunities/
${
context
.
opportunity
}
/checkkey`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
return
res
;
}
return
Http
.
getInstance
().
post
(
`/opportunities/
${
context
.
opportunity
}
/checkkey`
,
data
,
isloading
);
...
...
@@ -881,21 +881,6 @@ export default class OpportunityServiceBase extends EntityService {
public
async
Save
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
account
&&
context
.
contact
&&
context
.
opportunity
){
let
masterData
:
any
=
{};
let
quotesData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_quotes'
),
'undefined'
)){
quotesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_quotes'
)
as
any
);
if
(
quotesData
&&
quotesData
.
length
&&
quotesData
.
length
>
0
){
quotesData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
quoteid
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
quotes
=
quotesData
;
let
opportunityproductsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
),
'undefined'
)){
opportunityproductsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
)
as
any
);
...
...
@@ -926,15 +911,6 @@ export default class OpportunityServiceBase extends EntityService {
}
}
masterData
.
opportunitycompetitors
=
opportunitycompetitorsData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/accounts/
${
context
.
account
}
/contacts/
${
context
.
contact
}
/opportunities/
${
context
.
opportunity
}
/save`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
return
res
;
}
if
(
context
.
contact
&&
context
.
opportunity
){
let
masterData
:
any
=
{};
let
quotesData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_quotes'
),
'undefined'
)){
quotesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_quotes'
)
as
any
);
...
...
@@ -950,6 +926,15 @@ export default class OpportunityServiceBase extends EntityService {
}
}
masterData
.
quotes
=
quotesData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/accounts/
${
context
.
account
}
/contacts/
${
context
.
contact
}
/opportunities/
${
context
.
opportunity
}
/save`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
return
res
;
}
if
(
context
.
contact
&&
context
.
opportunity
){
let
masterData
:
any
=
{};
let
opportunityproductsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
),
'undefined'
)){
opportunityproductsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
)
as
any
);
...
...
@@ -980,14 +965,6 @@ export default class OpportunityServiceBase extends EntityService {
}
}
masterData
.
opportunitycompetitors
=
opportunitycompetitorsData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/contacts/
${
context
.
contact
}
/opportunities/
${
context
.
opportunity
}
/save`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
return
res
;
}
let
masterData
:
any
=
{};
let
quotesData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_quotes'
),
'undefined'
)){
quotesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_quotes'
)
as
any
);
...
...
@@ -1003,6 +980,14 @@ export default class OpportunityServiceBase extends EntityService {
}
}
masterData
.
quotes
=
quotesData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/contacts/
${
context
.
contact
}
/opportunities/
${
context
.
opportunity
}
/save`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
return
res
;
}
let
masterData
:
any
=
{};
let
opportunityproductsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
),
'undefined'
)){
opportunityproductsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
)
as
any
);
...
...
@@ -1033,14 +1018,51 @@ export default class OpportunityServiceBase extends EntityService {
}
}
masterData
.
opportunitycompetitors
=
opportunitycompetitorsData
;
let
quotesData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_quotes'
),
'undefined'
)){
quotesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_quotes'
)
as
any
);
if
(
quotesData
&&
quotesData
.
length
&&
quotesData
.
length
>
0
){
quotesData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
quoteid
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
quotes
=
quotesData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/opportunities/
${
context
.
opportunity
}
/save`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunityproducts'
,
JSON
.
stringify
(
res
.
data
.
opportunityproducts
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_opportunitycompetitors'
,
JSON
.
stringify
(
res
.
data
.
opportunitycompetitors
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_quotes'
,
JSON
.
stringify
(
res
.
data
.
quotes
));
return
res
;
}
/**
* FetchTop5接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof OpportunityServiceBase
*/
public
async
FetchTop5
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
account
&&
context
.
contact
&&
true
){
let
tempData
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
data
));
return
Http
.
getInstance
().
get
(
`/accounts/
${
context
.
account
}
/contacts/
${
context
.
contact
}
/opportunities/fetchtop5`
,
tempData
,
isloading
);
}
if
(
context
.
contact
&&
true
){
let
tempData
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
data
));
return
Http
.
getInstance
().
get
(
`/contacts/
${
context
.
contact
}
/opportunities/fetchtop5`
,
tempData
,
isloading
);
}
let
tempData
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
data
));
return
Http
.
getInstance
().
get
(
`/opportunities/fetchtop5`
,
tempData
,
isloading
);
}
/**
* FetchDefault接口方法
*
...
...
app_CRM/src/service/product-sales-literature/product-sales-literature-service-base.ts
浏览文件 @
60d9e01e
...
...
@@ -48,6 +48,9 @@ export default class ProductSalesLiteratureServiceBase extends EntityService {
* @memberof ProductSalesLiteratureServiceBase
*/
public
async
Select
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
salesliterature
&&
context
.
productsalesliterature
){
return
Http
.
getInstance
().
get
(
`/salesliteratures/
${
context
.
salesliterature
}
/productsalesliteratures/
${
context
.
productsalesliterature
}
/select`
,
isloading
);
}
return
Http
.
getInstance
().
get
(
`/productsalesliteratures/
${
context
.
productsalesliterature
}
/select`
,
isloading
);
}
...
...
@@ -61,6 +64,9 @@ export default class ProductSalesLiteratureServiceBase extends EntityService {
* @memberof ProductSalesLiteratureServiceBase
*/
public
async
Remove
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
salesliterature
&&
context
.
productsalesliterature
){
return
Http
.
getInstance
().
delete
(
`/salesliteratures/
${
context
.
salesliterature
}
/productsalesliteratures/
${
context
.
productsalesliterature
}
`
,
isloading
);
}
return
Http
.
getInstance
().
delete
(
`/productsalesliteratures/
${
context
.
productsalesliterature
}
`
,
isloading
);
}
...
...
@@ -74,6 +80,10 @@ export default class ProductSalesLiteratureServiceBase extends EntityService {
* @memberof ProductSalesLiteratureServiceBase
*/
public
async
Get
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
salesliterature
&&
context
.
productsalesliterature
){
let
res
:
any
=
await
Http
.
getInstance
().
get
(
`/salesliteratures/
${
context
.
salesliterature
}
/productsalesliteratures/
${
context
.
productsalesliterature
}
`
,
isloading
);
return
res
;
}
let
res
:
any
=
await
Http
.
getInstance
().
get
(
`/productsalesliteratures/
${
context
.
productsalesliterature
}
`
,
isloading
);
return
res
;
}
...
...
@@ -88,6 +98,12 @@ export default class ProductSalesLiteratureServiceBase extends EntityService {
* @memberof ProductSalesLiteratureServiceBase
*/
public
async
Update
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
salesliterature
&&
context
.
productsalesliterature
){
let
masterData
:
any
=
{};
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
put
(
`/salesliteratures/
${
context
.
salesliterature
}
/productsalesliteratures/
${
context
.
productsalesliterature
}
`
,
data
,
isloading
);
return
res
;
}
let
masterData
:
any
=
{};
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
put
(
`/productsalesliteratures/
${
context
.
productsalesliterature
}
`
,
data
,
isloading
);
...
...
@@ -104,6 +120,12 @@ export default class ProductSalesLiteratureServiceBase extends EntityService {
* @memberof ProductSalesLiteratureServiceBase
*/
public
async
CheckKey
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
salesliterature
&&
context
.
productsalesliterature
){
let
masterData
:
any
=
{};
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/salesliteratures/
${
context
.
salesliterature
}
/productsalesliteratures/
${
context
.
productsalesliterature
}
/checkkey`
,
data
,
isloading
);
return
res
;
}
return
Http
.
getInstance
().
post
(
`/productsalesliteratures/
${
context
.
productsalesliterature
}
/checkkey`
,
data
,
isloading
);
}
...
...
@@ -117,6 +139,11 @@ export default class ProductSalesLiteratureServiceBase extends EntityService {
* @memberof ProductSalesLiteratureServiceBase
*/
public
async
GetDraft
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
salesliterature
&&
true
){
let
res
:
any
=
await
Http
.
getInstance
().
get
(
`/salesliteratures/
${
context
.
salesliterature
}
/productsalesliteratures/getdraft`
,
isloading
);
res
.
data
.
productsalesliterature
=
data
.
productsalesliterature
;
return
res
;
}
let
res
:
any
=
await
Http
.
getInstance
().
get
(
`/productsalesliteratures/getdraft`
,
isloading
);
res
.
data
.
productsalesliterature
=
data
.
productsalesliterature
;
return
res
;
...
...
@@ -132,6 +159,12 @@ export default class ProductSalesLiteratureServiceBase extends EntityService {
* @memberof ProductSalesLiteratureServiceBase
*/
public
async
Save
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
salesliterature
&&
context
.
productsalesliterature
){
let
masterData
:
any
=
{};
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/salesliteratures/
${
context
.
salesliterature
}
/productsalesliteratures/
${
context
.
productsalesliterature
}
/save`
,
data
,
isloading
);
return
res
;
}
let
masterData
:
any
=
{};
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/productsalesliteratures/
${
context
.
productsalesliterature
}
/save`
,
data
,
isloading
);
...
...
@@ -148,6 +181,19 @@ export default class ProductSalesLiteratureServiceBase extends EntityService {
* @memberof ProductSalesLiteratureServiceBase
*/
public
async
Create
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
salesliterature
&&
true
){
let
masterData
:
any
=
{};
Object
.
assign
(
data
,
masterData
);
if
(
!
data
.
srffrontuf
||
data
.
srffrontuf
!==
"1"
){
data
[
this
.
APPDEKEY
]
=
null
;
}
if
(
data
.
srffrontuf
){
delete
data
.
srffrontuf
;
}
let
tempContext
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
context
));
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/salesliteratures/
${
context
.
salesliterature
}
/productsalesliteratures`
,
data
,
isloading
);
return
res
;
}
let
masterData
:
any
=
{};
Object
.
assign
(
data
,
masterData
);
if
(
!
data
.
srffrontuf
||
data
.
srffrontuf
!==
"1"
){
...
...
@@ -171,6 +217,10 @@ export default class ProductSalesLiteratureServiceBase extends EntityService {
* @memberof ProductSalesLiteratureServiceBase
*/
public
async
FetchDefault
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
salesliterature
&&
true
){
let
tempData
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
data
));
return
Http
.
getInstance
().
get
(
`/salesliteratures/
${
context
.
salesliterature
}
/productsalesliteratures/fetchdefault`
,
tempData
,
isloading
);
}
let
tempData
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
data
));
return
Http
.
getInstance
().
get
(
`/productsalesliteratures/fetchdefault`
,
tempData
,
isloading
);
}
...
...
app_CRM/src/service/sales-literature-item/sales-literature-item-service-base.ts
浏览文件 @
60d9e01e
...
...
@@ -48,6 +48,9 @@ export default class SalesLiteratureItemServiceBase extends EntityService {
* @memberof SalesLiteratureItemServiceBase
*/
public
async
Select
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
salesliterature
&&
context
.
salesliteratureitem
){
return
Http
.
getInstance
().
get
(
`/salesliteratures/
${
context
.
salesliterature
}
/salesliteratureitems/
${
context
.
salesliteratureitem
}
/select`
,
isloading
);
}
return
Http
.
getInstance
().
get
(
`/salesliteratureitems/
${
context
.
salesliteratureitem
}
/select`
,
isloading
);
}
...
...
@@ -61,6 +64,12 @@ export default class SalesLiteratureItemServiceBase extends EntityService {
* @memberof SalesLiteratureItemServiceBase
*/
public
async
Save
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
salesliterature
&&
context
.
salesliteratureitem
){
let
masterData
:
any
=
{};
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/salesliteratures/
${
context
.
salesliterature
}
/salesliteratureitems/
${
context
.
salesliteratureitem
}
/save`
,
data
,
isloading
);
return
res
;
}
let
masterData
:
any
=
{};
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/salesliteratureitems/
${
context
.
salesliteratureitem
}
/save`
,
data
,
isloading
);
...
...
@@ -77,6 +86,10 @@ export default class SalesLiteratureItemServiceBase extends EntityService {
* @memberof SalesLiteratureItemServiceBase
*/
public
async
Get
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
salesliterature
&&
context
.
salesliteratureitem
){
let
res
:
any
=
await
Http
.
getInstance
().
get
(
`/salesliteratures/
${
context
.
salesliterature
}
/salesliteratureitems/
${
context
.
salesliteratureitem
}
`
,
isloading
);
return
res
;
}
let
res
:
any
=
await
Http
.
getInstance
().
get
(
`/salesliteratureitems/
${
context
.
salesliteratureitem
}
`
,
isloading
);
return
res
;
}
...
...
@@ -91,6 +104,11 @@ export default class SalesLiteratureItemServiceBase extends EntityService {
* @memberof SalesLiteratureItemServiceBase
*/
public
async
GetDraft
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
salesliterature
&&
true
){
let
res
:
any
=
await
Http
.
getInstance
().
get
(
`/salesliteratures/
${
context
.
salesliterature
}
/salesliteratureitems/getdraft`
,
isloading
);
res
.
data
.
salesliteratureitem
=
data
.
salesliteratureitem
;
return
res
;
}
let
res
:
any
=
await
Http
.
getInstance
().
get
(
`/salesliteratureitems/getdraft`
,
isloading
);
res
.
data
.
salesliteratureitem
=
data
.
salesliteratureitem
;
return
res
;
...
...
@@ -106,6 +124,9 @@ export default class SalesLiteratureItemServiceBase extends EntityService {
* @memberof SalesLiteratureItemServiceBase
*/
public
async
Remove
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
salesliterature
&&
context
.
salesliteratureitem
){
return
Http
.
getInstance
().
delete
(
`/salesliteratures/
${
context
.
salesliterature
}
/salesliteratureitems/
${
context
.
salesliteratureitem
}
`
,
isloading
);
}
return
Http
.
getInstance
().
delete
(
`/salesliteratureitems/
${
context
.
salesliteratureitem
}
`
,
isloading
);
}
...
...
@@ -119,6 +140,12 @@ export default class SalesLiteratureItemServiceBase extends EntityService {
* @memberof SalesLiteratureItemServiceBase
*/
public
async
Update
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
salesliterature
&&
context
.
salesliteratureitem
){
let
masterData
:
any
=
{};
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
put
(
`/salesliteratures/
${
context
.
salesliterature
}
/salesliteratureitems/
${
context
.
salesliteratureitem
}
`
,
data
,
isloading
);
return
res
;
}
let
masterData
:
any
=
{};
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
put
(
`/salesliteratureitems/
${
context
.
salesliteratureitem
}
`
,
data
,
isloading
);
...
...
@@ -135,6 +162,12 @@ export default class SalesLiteratureItemServiceBase extends EntityService {
* @memberof SalesLiteratureItemServiceBase
*/
public
async
CheckKey
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
salesliterature
&&
context
.
salesliteratureitem
){
let
masterData
:
any
=
{};
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/salesliteratures/
${
context
.
salesliterature
}
/salesliteratureitems/
${
context
.
salesliteratureitem
}
/checkkey`
,
data
,
isloading
);
return
res
;
}
return
Http
.
getInstance
().
post
(
`/salesliteratureitems/
${
context
.
salesliteratureitem
}
/checkkey`
,
data
,
isloading
);
}
...
...
@@ -148,6 +181,19 @@ export default class SalesLiteratureItemServiceBase extends EntityService {
* @memberof SalesLiteratureItemServiceBase
*/
public
async
Create
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
salesliterature
&&
true
){
let
masterData
:
any
=
{};
Object
.
assign
(
data
,
masterData
);
if
(
!
data
.
srffrontuf
||
data
.
srffrontuf
!==
"1"
){
data
[
this
.
APPDEKEY
]
=
null
;
}
if
(
data
.
srffrontuf
){
delete
data
.
srffrontuf
;
}
let
tempContext
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
context
));
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/salesliteratures/
${
context
.
salesliterature
}
/salesliteratureitems`
,
data
,
isloading
);
return
res
;
}
let
masterData
:
any
=
{};
Object
.
assign
(
data
,
masterData
);
if
(
!
data
.
srffrontuf
||
data
.
srffrontuf
!==
"1"
){
...
...
@@ -171,6 +217,10 @@ export default class SalesLiteratureItemServiceBase extends EntityService {
* @memberof SalesLiteratureItemServiceBase
*/
public
async
FetchDefault
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
salesliterature
&&
true
){
let
tempData
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
data
));
return
Http
.
getInstance
().
get
(
`/salesliteratures/
${
context
.
salesliterature
}
/salesliteratureitems/fetchdefault`
,
tempData
,
isloading
);
}
let
tempData
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
data
));
return
Http
.
getInstance
().
get
(
`/salesliteratureitems/fetchdefault`
,
tempData
,
isloading
);
}
...
...
app_CRM/src/service/sales-literature/sales-literature-service-base.ts
浏览文件 @
60d9e01e
...
...
@@ -62,6 +62,9 @@ export default class SalesLiteratureServiceBase extends EntityService {
*/
public
async
Get
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
let
res
:
any
=
await
Http
.
getInstance
().
get
(
`/salesliteratures/
${
context
.
salesliterature
}
`
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_productsalesliteratures'
,
JSON
.
stringify
(
res
.
data
.
productsalesliteratures
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_competitorsalesliteratures'
,
JSON
.
stringify
(
res
.
data
.
competitorsalesliteratures
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_salesliteratureitems'
,
JSON
.
stringify
(
res
.
data
.
salesliteratureitems
));
return
res
;
}
...
...
@@ -76,8 +79,56 @@ export default class SalesLiteratureServiceBase extends EntityService {
*/
public
async
Save
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
let
masterData
:
any
=
{};
let
productsalesliteraturesData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_productsalesliteratures'
),
'undefined'
)){
productsalesliteraturesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_productsalesliteratures'
)
as
any
);
if
(
productsalesliteraturesData
&&
productsalesliteraturesData
.
length
&&
productsalesliteraturesData
.
length
>
0
){
productsalesliteraturesData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
relationshipsid
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
productsalesliteratures
=
productsalesliteraturesData
;
let
competitorsalesliteraturesData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_competitorsalesliteratures'
),
'undefined'
)){
competitorsalesliteraturesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_competitorsalesliteratures'
)
as
any
);
if
(
competitorsalesliteraturesData
&&
competitorsalesliteraturesData
.
length
&&
competitorsalesliteraturesData
.
length
>
0
){
competitorsalesliteraturesData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
relationshipsid
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
competitorsalesliteratures
=
competitorsalesliteraturesData
;
let
salesliteratureitemsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_salesliteratureitems'
),
'undefined'
)){
salesliteratureitemsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_salesliteratureitems'
)
as
any
);
if
(
salesliteratureitemsData
&&
salesliteratureitemsData
.
length
&&
salesliteratureitemsData
.
length
>
0
){
salesliteratureitemsData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
salesliteratureitemid
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
salesliteratureitems
=
salesliteratureitemsData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/salesliteratures/
${
context
.
salesliterature
}
/save`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_productsalesliteratures'
,
JSON
.
stringify
(
res
.
data
.
productsalesliteratures
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_competitorsalesliteratures'
,
JSON
.
stringify
(
res
.
data
.
competitorsalesliteratures
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_salesliteratureitems'
,
JSON
.
stringify
(
res
.
data
.
salesliteratureitems
));
return
res
;
}
...
...
@@ -92,6 +143,51 @@ export default class SalesLiteratureServiceBase extends EntityService {
*/
public
async
Create
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
let
masterData
:
any
=
{};
let
productsalesliteraturesData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_productsalesliteratures'
),
'undefined'
)){
productsalesliteraturesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_productsalesliteratures'
)
as
any
);
if
(
productsalesliteraturesData
&&
productsalesliteraturesData
.
length
&&
productsalesliteraturesData
.
length
>
0
){
productsalesliteraturesData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
relationshipsid
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
productsalesliteratures
=
productsalesliteraturesData
;
let
competitorsalesliteraturesData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_competitorsalesliteratures'
),
'undefined'
)){
competitorsalesliteraturesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_competitorsalesliteratures'
)
as
any
);
if
(
competitorsalesliteraturesData
&&
competitorsalesliteraturesData
.
length
&&
competitorsalesliteraturesData
.
length
>
0
){
competitorsalesliteraturesData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
relationshipsid
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
competitorsalesliteratures
=
competitorsalesliteraturesData
;
let
salesliteratureitemsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_salesliteratureitems'
),
'undefined'
)){
salesliteratureitemsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_salesliteratureitems'
)
as
any
);
if
(
salesliteratureitemsData
&&
salesliteratureitemsData
.
length
&&
salesliteratureitemsData
.
length
>
0
){
salesliteratureitemsData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
salesliteratureitemid
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
salesliteratureitems
=
salesliteratureitemsData
;
Object
.
assign
(
data
,
masterData
);
if
(
!
data
.
srffrontuf
||
data
.
srffrontuf
!==
"1"
){
data
[
this
.
APPDEKEY
]
=
null
;
...
...
@@ -101,6 +197,9 @@ export default class SalesLiteratureServiceBase extends EntityService {
}
let
tempContext
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
context
));
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/salesliteratures`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_productsalesliteratures'
,
JSON
.
stringify
(
res
.
data
.
productsalesliteratures
));
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_competitorsalesliteratures'
,
JSON
.
stringify
(
res
.
data
.
competitorsalesliteratures
));
this
.
tempStorage
.
setItem
(
tempContext
.
srfsessionkey
+
'_salesliteratureitems'
,
JSON
.
stringify
(
res
.
data
.
salesliteratureitems
));
return
res
;
}
...
...
@@ -141,8 +240,56 @@ export default class SalesLiteratureServiceBase extends EntityService {
*/
public
async
Update
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
let
masterData
:
any
=
{};
let
productsalesliteraturesData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_productsalesliteratures'
),
'undefined'
)){
productsalesliteraturesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_productsalesliteratures'
)
as
any
);
if
(
productsalesliteraturesData
&&
productsalesliteraturesData
.
length
&&
productsalesliteraturesData
.
length
>
0
){
productsalesliteraturesData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
relationshipsid
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
productsalesliteratures
=
productsalesliteraturesData
;
let
competitorsalesliteraturesData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_competitorsalesliteratures'
),
'undefined'
)){
competitorsalesliteraturesData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_competitorsalesliteratures'
)
as
any
);
if
(
competitorsalesliteraturesData
&&
competitorsalesliteraturesData
.
length
&&
competitorsalesliteraturesData
.
length
>
0
){
competitorsalesliteraturesData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
relationshipsid
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
competitorsalesliteratures
=
competitorsalesliteraturesData
;
let
salesliteratureitemsData
:
any
=
[];
if
(
!
Object
.
is
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_salesliteratureitems'
),
'undefined'
)){
salesliteratureitemsData
=
JSON
.
parse
(
this
.
tempStorage
.
getItem
(
context
.
srfsessionkey
+
'_salesliteratureitems'
)
as
any
);
if
(
salesliteratureitemsData
&&
salesliteratureitemsData
.
length
&&
salesliteratureitemsData
.
length
>
0
){
salesliteratureitemsData
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
srffrontuf
){
if
(
Object
.
is
(
item
.
srffrontuf
,
"0"
)){
item
.
salesliteratureitemid
=
null
;
}
delete
item
.
srffrontuf
;
}
});
}
}
masterData
.
salesliteratureitems
=
salesliteratureitemsData
;
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
put
(
`/salesliteratures/
${
context
.
salesliterature
}
`
,
data
,
isloading
);
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_productsalesliteratures'
,
JSON
.
stringify
(
res
.
data
.
productsalesliteratures
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_competitorsalesliteratures'
,
JSON
.
stringify
(
res
.
data
.
competitorsalesliteratures
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_salesliteratureitems'
,
JSON
.
stringify
(
res
.
data
.
salesliteratureitems
));
return
res
;
}
...
...
@@ -158,6 +305,9 @@ export default class SalesLiteratureServiceBase extends EntityService {
public
async
GetDraft
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
let
res
:
any
=
await
Http
.
getInstance
().
get
(
`/salesliteratures/getdraft`
,
isloading
);
res
.
data
.
salesliterature
=
data
.
salesliterature
;
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_productsalesliteratures'
,
JSON
.
stringify
(
res
.
data
.
productsalesliteratures
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_competitorsalesliteratures'
,
JSON
.
stringify
(
res
.
data
.
competitorsalesliteratures
));
this
.
tempStorage
.
setItem
(
context
.
srfsessionkey
+
'_salesliteratureitems'
,
JSON
.
stringify
(
res
.
data
.
salesliteratureitems
));
return
res
;
}
...
...
app_CRM/src/uiservice/competitor-sales-literature/competitor-sales-literature-ui-service-base.ts
0 → 100644
浏览文件 @
60d9e01e
import
{
Environment
}
from
'@/environments/environment'
;
import
{
UIActionTool
,
Util
}
from
'@/utils'
;
import
UIService
from
'../ui-service'
;
import
{
Subject
}
from
'rxjs'
;
import
CompetitorSalesLiteratureService
from
'@/service/competitor-sales-literature/competitor-sales-literature-service'
;
/**
* 竞争对手宣传资料UI服务对象基类
*
* @export
* @class CompetitorSalesLiteratureUIServiceBase
*/
export
default
class
CompetitorSalesLiteratureUIServiceBase
extends
UIService
{
/**
* 是否支持工作流
*
* @memberof CompetitorSalesLiteratureUIServiceBase
*/
public
isEnableWorkflow
:
boolean
=
false
;
/**
* 当前UI服务对应的数据服务对象
*
* @memberof CompetitorSalesLiteratureUIServiceBase
*/
public
dataService
:
CompetitorSalesLiteratureService
=
new
CompetitorSalesLiteratureService
();
/**
* 所有关联视图
*
* @memberof CompetitorSalesLiteratureUIServiceBase
*/
public
allViewMap
:
Map
<
string
,
Object
>
=
new
Map
();
/**
* 状态值
*
* @memberof CompetitorSalesLiteratureUIServiceBase
*/
public
stateValue
:
number
=
0
;
/**
* 状态属性
*
* @memberof CompetitorSalesLiteratureUIServiceBase
*/
public
stateField
:
string
=
""
;
/**
* 主状态属性集合
*
* @memberof CompetitorSalesLiteratureUIServiceBase
*/
public
mainStateFields
:
Array
<
any
>
=
[];
/**
* 主状态集合Map
*
* @memberof CompetitorSalesLiteratureUIServiceBase
*/
public
allDeMainStateMap
:
Map
<
string
,
string
>
=
new
Map
();
/**
* Creates an instance of CompetitorSalesLiteratureUIServiceBase.
*
* @param {*} [opts={}]
* @memberof CompetitorSalesLiteratureUIServiceBase
*/
constructor
(
opts
:
any
=
{})
{
super
(
opts
);
this
.
initViewMap
();
this
.
initDeMainStateMap
();
}
/**
* 初始化视图Map
*
* @memberof CompetitorSalesLiteratureUIServiceBase
*/
public
initViewMap
(){
}
/**
* 初始化主状态集合
*
* @memberof CompetitorSalesLiteratureUIServiceBase
*/
public
initDeMainStateMap
(){
}
/**
* 获取指定数据的重定向页面
*
* @param srfkey 数据主键
* @param isEnableWorkflow 重定向视图是否需要处理流程中的数据
* @memberof CompetitorSalesLiteratureUIServiceBase
*/
public
async
getRDAppView
(
srfkey
:
string
,
isEnableWorkflow
:
boolean
){
this
.
isEnableWorkflow
=
isEnableWorkflow
;
// 进行数据查询
let
result
:
any
=
await
this
.
dataService
.
Get
({
competitorsalesliterature
:
srfkey
});
const
curData
:
any
=
result
.
data
;
//判断当前数据模式,默认为true,todo
const
iRealDEModel
:
boolean
=
true
;
let
bDataInWF
:
boolean
=
false
;
let
bWFMode
:
any
=
false
;
// 计算数据模式
if
(
this
.
isEnableWorkflow
)
{
bDataInWF
=
await
this
.
dataService
.
testDataInWF
({
stateValue
:
this
.
stateValue
,
stateField
:
this
.
stateField
},
curData
);
if
(
bDataInWF
)
{
bDataInWF
=
true
;
bWFMode
=
await
this
.
dataService
.
testUserExistWorklist
(
null
,
curData
);
}
}
let
strPDTViewParam
:
string
=
await
this
.
getDESDDEViewPDTParam
(
curData
,
bDataInWF
,
bWFMode
);
//若不是当前数据模式,处理strPDTViewParam,todo
//查找视图
//返回视图
return
this
.
allViewMap
.
get
(
strPDTViewParam
);
}
/**
* 获取实际的数据类型
*
* @memberof CompetitorSalesLiteratureUIServiceBase
*/
public
getRealDEType
(
entity
:
any
){
}
/**
* 获取实体单数据实体视图预定义参数
*
* @param curData 当前数据
* @param bDataInWF 是否有数据在工作流中
* @param bWFMode 是否工作流模式
* @memberof CompetitorSalesLiteratureUIServiceBase
*/
public
async
getDESDDEViewPDTParam
(
curData
:
any
,
bDataInWF
:
boolean
,
bWFMode
:
boolean
){
let
strPDTParam
:
string
=
''
;
if
(
bDataInWF
)
{
// 判断数据是否在流程中
}
//多表单,todo
const
isEnableMultiForm
:
boolean
=
false
;
const
multiFormDEField
:
string
|
null
=
null
;
if
(
isEnableMultiForm
&&
multiFormDEField
)
{
const
objFormValue
:
string
=
curData
[
multiFormDEField
];
if
(
!
Environment
.
isAppMode
){
return
'MOBEDITVIEW'
+
objFormValue
;
}
return
'EDITVIEW'
+
objFormValue
;
}
if
(
!
Environment
.
isAppMode
){
if
(
this
.
getDEMainStateTag
(
curData
)){
return
`MOBEDITVIEW:MSTAG:
${
await
this
.
getDEMainStateTag
(
curData
)}
`
;
}
return
'MOBEDITVIEW:'
;
}
if
(
this
.
getDEMainStateTag
(
curData
)){
return
`EDITVIEW:MSTAG:
${
await
this
.
getDEMainStateTag
(
curData
)}
`
;
}
return
'EDITVIEW:'
;
}
/**
* 获取数据对象的主状态标识
*
* @param curData 当前数据
* @memberof CompetitorSalesLiteratureUIServiceBase
*/
public
async
getDEMainStateTag
(
curData
:
any
){
if
(
this
.
mainStateFields
.
length
===
0
)
return
null
;
this
.
mainStateFields
.
forEach
((
singleMainField
:
any
)
=>
{
if
(
!
(
singleMainField
in
curData
)){
console
.
error
(
`当前数据对象不包含属性singleMainField,可能会发生错误`
);
}
})
let
strTag
:
String
=
""
;
for
(
let
i
=
0
;
i
<=
1
;
i
++
)
{
let
strTag
:
string
=
(
curData
[
this
.
mainStateFields
[
0
]])?(
i
==
0
)
?
curData
[
this
.
mainStateFields
[
0
]]
:
""
:
""
;
if
(
this
.
mainStateFields
.
length
>=
2
)
{
for
(
let
j
=
0
;
j
<=
1
;
j
++
)
{
let
strTag2
:
string
=
(
curData
[
this
.
mainStateFields
[
1
]])?
`
${
strTag
}
__
${(
j
==
0
)
?
curData
[
this
.
mainStateFields
[
1
]]
:
""
}
`
:
strTag
;
if
(
this
.
mainStateFields
.
length
>=
3
)
{
for
(
let
k
=
0
;
k
<=
1
;
k
++
)
{
let
strTag3
:
string
=
(
curData
[
this
.
mainStateFields
[
2
]])?
`
${
strTag2
}
__
${(
k
==
0
)
?
curData
[
this
.
mainStateFields
[
2
]]
:
""
}
`
:
strTag2
;
// 判断是否存在
return
this
.
allDeMainStateMap
.
get
(
strTag3
);
}
}
else
{
return
this
.
allDeMainStateMap
.
get
(
strTag2
);
}
}
}
else
{
return
this
.
allDeMainStateMap
.
get
(
strTag
);
}
}
return
null
;
}
}
\ No newline at end of file
app_CRM/src/uiservice/competitor-sales-literature/competitor-sales-literature-ui-service.ts
0 → 100644
浏览文件 @
60d9e01e
import
CompetitorSalesLiteratureUIServiceBase
from
'./competitor-sales-literature-ui-service-base'
;
/**
* 竞争对手宣传资料UI服务对象
*
* @export
* @class CompetitorSalesLiteratureUIService
*/
export
default
class
CompetitorSalesLiteratureUIService
extends
CompetitorSalesLiteratureUIServiceBase
{
/**
* Creates an instance of CompetitorSalesLiteratureUIService.
*
* @param {*} [opts={}]
* @memberof CompetitorSalesLiteratureUIService
*/
constructor
(
opts
:
any
=
{})
{
super
(
opts
);
}
}
\ No newline at end of file
app_CRM/src/uiservice/ui-service-register.ts
浏览文件 @
60d9e01e
...
...
@@ -71,6 +71,7 @@ export class UIServiceRegister {
this
.
allUIService
.
set
(
'campaignactivity'
,
()
=>
import
(
'@/uiservice/campaign-activity/campaign-activity-ui-service'
));
this
.
allUIService
.
set
(
'listlead'
,
()
=>
import
(
'@/uiservice/list-lead/list-lead-ui-service'
));
this
.
allUIService
.
set
(
'opportunitycompetitor'
,
()
=>
import
(
'@/uiservice/opportunity-competitor/opportunity-competitor-ui-service'
));
this
.
allUIService
.
set
(
'competitorsalesliterature'
,
()
=>
import
(
'@/uiservice/competitor-sales-literature/competitor-sales-literature-ui-service'
));
this
.
allUIService
.
set
(
'salesliteratureitem'
,
()
=>
import
(
'@/uiservice/sales-literature-item/sales-literature-item-ui-service'
));
this
.
allUIService
.
set
(
'contact'
,
()
=>
import
(
'@/uiservice/contact/contact-ui-service'
));
this
.
allUIService
.
set
(
'product'
,
()
=>
import
(
'@/uiservice/product/product-ui-service'
));
...
...
app_CRM/src/widgets/app/centeral-portal-db-dashboard/centeral-portal-db-dashboard.html
浏览文件 @
60d9e01e
...
...
@@ -3,6 +3,33 @@
<app-build
@
handleClick=
"handleClick.apply(_self, arguments)"
></app-build>
</row>
<row
v-if=
"!isHasCustomized"
>
<i-col
:md=
"{ span: 24, offset: 0 }"
>
<card
class=
"portlet-card"
:bordered=
"false"
dis-hover
:padding=
"0"
>
<span>
<div
class=
'portlet-container db-container1 '
:style=
"{}"
>
<row>
<i-col
:md=
"{ span: 24, offset: 0 }"
>
<div
class=
"portlet-without-title"
>
<card
class=
"portlet-card"
:bordered=
"false"
dis-hover
:padding=
"0"
>
<span>
<view
_db_sysportlet1
:viewState=
"viewState"
:viewparams=
"viewparams"
:context=
"context"
:height=
"300"
name=
"db_sysportlet1"
ref=
'db_sysportlet1'
@
closeview=
"closeView($event)"
>
</view
_db_sysportlet1
>
</span>
</card>
</div>
</i-col>
</row>
</div>
</span>
</card>
</i-col>
</row>
<row
v-if=
"isHasCustomized"
style=
"width: 100%;min-height: calc(100% - 40px);"
>
<div
class=
"portlet-container"
style=
"position: relative;width:100%;"
>
...
...
app_CRM/src/widgets/app/centeral-portal-db-dashboard/centeral-portal-db-dashboard.vue
浏览文件 @
60d9e01e
...
...
@@ -3,6 +3,7 @@
import
{ Component } from 'vue-property-decorator';
import { VueLifeCycleProcessing } from '@/studio-core';
import { CenteralPortal_dbDashboardBase } from './centeral-portal-db-dashboard-base';
import view_db_sysportlet1 from '@widgets/opportunity/part-cht-001-portlet/part-cht-001-portlet.vue';
/**
...
...
@@ -14,6 +15,7 @@ import { CenteralPortal_dbDashboardBase } from './centeral-portal-db-dashboard-b
*/
@Component({
components: {
view_db_sysportlet1,
}
})
...
...
app_CRM/src/widgets/opportunity/chart-001-chart/chart-001-chart-base.tsx
0 → 100644
浏览文件 @
60d9e01e
import
{
Prop
,
Provide
,
Emit
,
Model
}
from
'vue-property-decorator'
;
import
{
Subject
,
Subscription
}
from
'rxjs'
;
import
{
Watch
,
MainControlBase
}
from
'@/studio-core'
;
import
OpportunityService
from
'@/service/opportunity/opportunity-service'
;
import
CHART_001Service
from
'./chart-001-chart-service'
;
import
echarts
from
'echarts'
;
import
moment
from
"moment"
;
import
CodeListService
from
"@service/app/codelist-service"
;
import
{
ChartDataSetField
,
ChartLineSeries
,
ChartFunnelSeries
,
ChartPieSeries
,
ChartBarSeries
,
ChartRadarSeries
}
from
'@/model/chart-detail'
;
/**
* db_sysportlet1_chart部件基类
*
* @export
* @class MainControlBase
* @extends {CHART_001ChartBase}
*/
export
class
CHART_001ChartBase
extends
MainControlBase
{
/**
* 建构部件服务对象
*
* @type {CHART_001Service}
* @memberof CHART_001ChartBase
*/
public
service
:
CHART_001Service
=
new
CHART_001Service
({
$store
:
this
.
$store
});
/**
* 实体服务对象
*
* @type {OpportunityService}
* @memberof CHART_001ChartBase
*/
public
appEntityService
:
OpportunityService
=
new
OpportunityService
({
$store
:
this
.
$store
});
/**
* 应用实体名称
*
* @protected
* @type {string}
* @memberof CHART_001ChartBase
*/
protected
appDeName
:
string
=
'opportunity'
;
/**
* 获取多项数据
*
* @returns {any[]}
* @memberof CHART_001
*/
public
getDatas
():
any
[]
{
return
[];
}
/**
* 获取单项树
*
* @returns {*}
* @memberof CHART_001
*/
public
getData
():
any
{
return
null
;
}
/**
* 显示处理提示
*
* @type {boolean}
* @memberof CHART_001
*/
@
Prop
({
default
:
true
})
public
showBusyIndicator
!
:
boolean
;
/**
* 部件行为--fetch
*
* @type {string}
* @memberof CHART_001
*/
@
Prop
()
public
fetchAction
!
:
string
;
/**
* Vue声明周期(组件初始化完毕)
*
* @memberof CHART_001
*/
public
created
()
{
this
.
afterCreated
();
}
/**
* 执行created后的逻辑
*
* @memberof CHART_001
*/
public
afterCreated
(){
if
(
this
.
viewState
)
{
this
.
viewStateEvent
=
this
.
viewState
.
subscribe
(({
tag
,
action
,
data
})
=>
{
if
(
!
Object
.
is
(
tag
,
this
.
name
))
{
return
;
}
if
(
Object
.
is
(
'load'
,
action
))
{
this
.
load
(
data
);
}
});
}
}
/**
* vue 生命周期
*
* @memberof CHART_001
*/
public
destroyed
()
{
this
.
afterDestroy
();
}
/**
* 执行destroyed后的逻辑
*
* @memberof CHART_001
*/
public
afterDestroy
()
{
if
(
this
.
viewStateEvent
)
{
this
.
viewStateEvent
.
unsubscribe
();
}
}
/**
* 是否无数据
*
* @public
* @type {boolean}
* @memberof Db_sysportlet1_chartBase
*/
public
isNoData
:
boolean
=
false
;
/**
* 图表div绑定的id
*
* @type {}
* @memberof Db_sysportlet1_chartBase
*/
public
chartId
:
string
=
this
.
$util
.
createUUID
();
/**
* echarts图表对象
*
* @type {}
* @memberof Db_sysportlet1_chartBase
*/
public
myChart
:
any
;
/**
* 代码表服务对象
*
* @type {CodeListService}
* @memberof Db_sysportlet1_chartBase
*/
public
codeListService
:
CodeListService
=
new
CodeListService
({
$store
:
this
.
$store
});
/**
* 序列模型
*
* @type {}
* @memberof Db_sysportlet1_chartBase
*/
public
seriesModel
:
any
=
{
bar
:
new
ChartBarSeries
({
name
:
'bar'
,
categorField
:
'parentaccountname'
,
valueField
:
'budgetamount'
,
seriesValues
:[],
seriesIndex
:
0
,
data
:[],
seriesMap
:{},
dataSetFields
:[
{
name
:
"parentaccountname"
,
codelist
:
null
,
isGroupField
:
true
,
groupMode
:
""
},
{
name
:
"budgetamount"
,
codelist
:
null
,
isGroupField
:
false
,
groupMode
:
""
}
],
ecxObject
:{
label
:{
show
:
true
,
position
:
'inside'
},
labelLine
:{
length
:
10
,
lineStyle
:
{
width
:
1
,
type
:
'solid'
}
},
itemStyle
:{
borderColor
:
'#fff'
,
borderWidth
:
1
},
emphasis
:{
label
:
{
fontSize
:
20
}
}
},
ecObject
:{
},
seriesTemp
:{
type
:
'bar'
,
},
baseOption
:{
},
seriesLayoutBy
:
"column"
})
};
/**
* 图表自定义参数集合
*
* @memberof Db_sysportlet1_chartBase
*/
public
chartUserParams
:
any
=
{
};
/**
* 图表基础动态模型
*
* @memberof Db_sysportlet1_chartBase
*/
public
chartBaseOPtion
:
any
=
{};
/**
* 初始化图表所需参数
*
* @type {}
* @memberof Db_sysportlet1_chartBase
*/
public
chartOption
:
any
=
{
title
:{
show
:
true
,
text
:
'重要商机'
,
subtext
:
''
},
legend
:{
show
:
true
},
grid
:[
{
}
],
xAxis
:
[
{
gridIndex
:
0
,
position
:
"bottom"
,
type
:
'numeric'
,
name
:
'金额'
,
}
],
yAxis
:[
{
gridIndex
:
0
,
position
:
"top"
,
type
:
'category'
,
name
:
'客户'
,
}
],
tooltip
:{
show
:
true
},
dataset
:[],
series
:[
{
id
:
'bar'
,
name
:
''
,
type
:
'bar'
,
xAxisIndex
:
0
,
yAxisIndex
:
0
,
datasetIndex
:
0
,
encode
:
{
x
:
[
'budgetamount'
],
y
:
[
'parentaccountname'
]
}}
]
};
/**
* 刷新
*
* @param {*} [opt={}]
* @memberof Db_sysportlet1_chartBase
*/
public
refresh
(
opt
:
any
=
{})
{
this
.
load
(
opt
);
}
/**
* 获取图表数据
*
* @returns {*}
* @memberof Db_sysportlet1_chartBase
*/
public
load
(
opt
?:
any
)
{
let
_this
=
this
;
const
arg
:
any
=
{
...
opt
};
const
parentdata
:
any
=
{};
this
.
$emit
(
'beforeload'
,
parentdata
);
Object
.
assign
(
arg
,
parentdata
);
Object
.
assign
(
arg
,{
viewparams
:
this
.
viewparams
,
page
:
0
,
size
:
1000
});
Object
.
assign
(
arg
,{
sort
:
'budgetamount,desc'
});
Object
.
assign
(
arg
,{
size
:
5
});
this
.
service
.
search
(
this
.
fetchAction
,
JSON
.
parse
(
JSON
.
stringify
(
this
.
context
)),
arg
,
this
.
showBusyIndicator
).
then
((
res
)
=>
{
if
(
res
)
{
this
.
transformToBasicChartSetData
(
res
.
data
,(
codelist
:
any
)
=>
{
_this
.
drawCharts
(
codelist
)});
}
}).
catch
((
error
)
=>
{
console
.
error
(
error
);
});
}
/**
* 绘制图表
*
* @returns {*}
* @memberof Db_sysportlet1_chartBase
*/
public
drawCharts
(
codelist
:
any
){
if
(
!
this
.
myChart
){
let
element
:
any
=
document
.
getElementById
(
this
.
chartId
);
this
.
myChart
=
echarts
.
init
(
element
);
}
let
_chartOption
=
this
.
handleChartOPtion
(
codelist
);
console
.
log
(
_chartOption
);
this
.
myChart
.
setOption
(
_chartOption
);
this
.
myChart
.
resize
();
}
/**
* 处理图表参数
*
* @memberof Db_sysportlet1_chartBase
*/
public
handleChartOPtion
(
allcodelist
:
any
){
let
_chartOption
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
chartOption
));
if
(
Object
.
keys
(
this
.
seriesModel
).
length
>
0
){
let
tempDataSourceMap
:
Map
<
string
,
any
>
=
new
Map
();
for
(
let
i
=
0
;
i
<
Object
.
keys
(
this
.
seriesModel
).
length
;
i
++
){
Object
.
values
(
this
.
seriesModel
).
forEach
((
seriesvalue
:
any
)
=>
{
if
(
seriesvalue
.
seriesIndex
===
i
){
tempDataSourceMap
.
set
(
seriesvalue
.
name
,
seriesvalue
.
data
);
}
})
}
if
(
tempDataSourceMap
.
size
>
0
){
tempDataSourceMap
.
forEach
((
item
:
any
)
=>
{
_chartOption
.
dataset
.
push
({
'source'
:
item
});
})
}
Object
.
keys
(
this
.
seriesModel
).
forEach
((
seriesName
:
string
)
=>
{
if
(
_chartOption
&&
_chartOption
.
series
.
length
>
0
){
_chartOption
.
series
.
forEach
((
item
:
any
)
=>
{
if
(
this
.
seriesModel
[
seriesName
].
ecxObject
&&
Object
.
is
(
seriesName
,
item
.
id
)){
item
=
this
.
$util
.
deepObjectMerge
(
item
,
this
.
seriesModel
[
seriesName
].
ecxObject
);
}
if
(
this
.
seriesModel
[
seriesName
].
baseOption
&&
Object
.
keys
(
this
.
seriesModel
[
seriesName
].
baseOption
).
length
>
0
&&
Object
.
is
(
seriesName
,
item
.
id
)){
item
=
this
.
$util
.
deepObjectMerge
(
item
,
this
.
seriesModel
[
seriesName
].
baseOption
);
}
if
(
this
.
seriesModel
[
seriesName
].
ecObject
&&
Object
.
is
(
seriesName
,
item
.
id
)){
item
=
this
.
$util
.
deepObjectMerge
(
item
,
this
.
seriesModel
[
seriesName
].
ecObject
);
}
})
}
//设置多序列
let
tempSeries
:
any
=
this
.
seriesModel
[
seriesName
];
// 非雷达图
if
(
tempSeries
&&
tempSeries
.
seriesIdField
&&
tempSeries
.
seriesValues
.
length
>
0
&&
!
Object
.
is
(
tempSeries
.
type
,
'radar'
)){
const
returnIndex
:
number
=
_chartOption
.
series
.
findIndex
((
item
:
any
)
=>
{
return
Object
.
is
(
item
.
id
,
seriesName
);
})
_chartOption
.
series
.
splice
(
returnIndex
,
1
);
let
tempSeriesArray
:
Array
<
any
>
=
[];
tempSeries
.
seriesValues
.
forEach
((
seriesvalueItem
:
any
)
=>
{
let
tempSeriesTemp
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
tempSeries
.
seriesTemp
));
Object
.
assign
(
tempSeriesTemp
,{
name
:
tempSeries
.
seriesMap
[
seriesvalueItem
],
datasetIndex
:
tempSeries
.
seriesIndex
,
encode
:{
x
:
tempSeries
.
categorField
,
y
:
`
${
seriesvalueItem
}
`
}});
_chartOption
.
series
.
push
(
tempSeriesTemp
);
})
}
})
}
if
(
Object
.
keys
(
this
.
chartBaseOPtion
).
length
>
0
){
Object
.
assign
(
_chartOption
,
this
.
chartBaseOPtion
);
}
if
(
Object
.
keys
(
this
.
chartUserParams
).
length
>
0
){
Object
.
assign
(
_chartOption
,
this
.
chartUserParams
);
}
return
_chartOption
;
}
/**
* 实体数据集转化为图表数据集
*
* 1.获取图表所有代码表值
* 2.查询集合映射图表数据集
* 3.补全图表数据集
* 4.图表数据集分组求和
* 5.排序图表数据集
*
* @param {*} data 实体数据集
* @param {Function} callback 回调
* @memberof Db_sysportlet1_chartBase
*/
public
async
transformToBasicChartSetData
(
data
:
any
,
callback
:
Function
){
if
(
!
data
||
!
Array
.
isArray
(
data
)
||
data
.
length
===
0
){
this
.
isNoData
=
true
;
return
;
}
this
.
isNoData
=
false
;
//获取代码表值
let
allCodeList
:
any
=
await
this
.
getChartAllCodeList
();
if
(
Object
.
values
(
this
.
seriesModel
).
length
>
0
){
Object
.
values
(
this
.
seriesModel
).
forEach
((
singleSeries
:
any
,
index
:
number
)
=>
{
// 值属性为srfcount设置{srfcount:1}到data
let
valueField
=
singleSeries
.
dataSetFields
.
find
((
datasetField
:
any
)
=>
{
return
datasetField
.
name
===
singleSeries
.
valueField
;
});
if
(
valueField
&&
valueField
.
name
&&
Object
.
is
(
valueField
.
name
,
"srfcount"
)){
data
.
forEach
((
singleData
:
any
)
=>
{
Object
.
assign
(
singleData
,{
srfcount
:
1
});
})
}
// 分组属性
let
groupField
=
singleSeries
.
dataSetFields
.
find
((
datasetField
:
any
)
=>
{
return
datasetField
.
name
===
singleSeries
.
categorField
;
});
let
tempChartSetData
:
Array
<
any
>
=
[];
let
tempSeriesValues
:
Map
<
string
,
any
>
=
new
Map
();
data
.
forEach
((
item
:
any
)
=>
{
let
tempChartSetDataItem
:
any
=
{};
// 序列属性不存在
if
(
!
singleSeries
.
seriesIdField
){
Object
.
assign
(
tempChartSetDataItem
,{
name
:
singleSeries
.
name
});
if
(
singleSeries
.
dataSetFields
&&
singleSeries
.
dataSetFields
.
length
>
0
){
singleSeries
.
dataSetFields
.
forEach
((
singleDataSetField
:
any
)
=>
{
this
.
handleSingleDataSetField
(
item
,
singleDataSetField
,
allCodeList
,
tempChartSetDataItem
,
groupField
);
})
}
}
else
{
// 序列属性存在时
// 序列代码表存在时,翻译tempSeriesValues的键值对
if
(
singleSeries
.
seriesCodeList
){
const
seriesCodeList
:
Map
<
string
,
any
>
=
allCodeList
.
get
(
singleSeries
.
seriesCodeList
.
tag
);
let
tempSeriesValueItem
=
tempSeriesValues
.
get
(
seriesCodeList
.
get
(
item
[
singleSeries
.
seriesIdField
]));
if
(
!
tempSeriesValueItem
){
tempSeriesValues
.
set
(
seriesCodeList
.
get
(
item
[
singleSeries
.
seriesIdField
]),
seriesCodeList
.
get
(
item
[
singleSeries
.
seriesIdField
]));
}
}
else
{
let
tempSeriesValueItem
=
tempSeriesValues
.
get
(
item
[
singleSeries
.
seriesIdField
]);
if
(
!
tempSeriesValueItem
){
tempSeriesValues
.
set
(
item
[
singleSeries
.
seriesIdField
],
item
[
singleSeries
.
seriesNameField
]);
}
}
Object
.
assign
(
tempChartSetDataItem
,{
name
:
item
[
singleSeries
.
seriesIdField
]});
if
(
singleSeries
.
dataSetFields
&&
singleSeries
.
dataSetFields
.
length
>
0
){
singleSeries
.
dataSetFields
.
forEach
((
singleDataSetField
:
any
)
=>
{
this
.
handleSingleDataSetField
(
item
,
singleDataSetField
,
allCodeList
,
tempChartSetDataItem
,
groupField
);
})
}
}
tempChartSetData
.
push
(
tempChartSetDataItem
);
})
// 补全数据集合
this
.
completeDataSet
(
tempChartSetData
,
singleSeries
,
allCodeList
);
// 序列代码表存在时,补全序列
if
(
singleSeries
.
seriesCodeList
){
const
seriesCodeList
:
Map
<
string
,
any
>
=
allCodeList
.
get
(
singleSeries
.
seriesCodeList
.
tag
);
tempSeriesValues
=
new
Map
();
seriesCodeList
.
forEach
((
item
:
any
)
=>
{
tempSeriesValues
.
set
(
item
,
item
);
})
}
singleSeries
.
seriesValues
=
[...
tempSeriesValues
.
keys
()];
let
tempSeriesMapObj
:
any
=
{};
tempSeriesValues
.
forEach
((
value
:
any
,
key
:
any
)
=>
{
tempSeriesMapObj
[
key
]
=
value
;
})
singleSeries
.
seriesMap
=
tempSeriesMapObj
;
let
callbackFunction
:
any
=
(
index
===
(
Object
.
values
(
this
.
seriesModel
).
length
-
1
))?
callback
:
null
;
this
.
transformToChartSeriesDataSet
(
tempChartSetData
,
singleSeries
,
callbackFunction
,
allCodeList
);
})
}
}
/**
* 构建图表序列数据集合
*
* 1.分组求和
* 2.排序求和数组
*
* @param {Array<any>} data 传入数据
* @param {Array<any>} item 单个序列
* @param {Array<any>} callback 回调
* @param {*} allCodeList 所有代码表
*
* @memberof Db_sysportlet1_chartBase
*/
public
transformToChartSeriesDataSet
(
data
:
any
,
item
:
any
,
callback
:
Function
,
allCodeList
:
any
):
any
{
if
(
item
.
seriesIdField
){
// 多序列
let
groupField
=
item
.
dataSetFields
.
filter
((
datasetField
:
any
)
=>
{
return
datasetField
.
name
===
item
.
categorField
;
});
let
tempGroupField
:
Array
<
any
>
=
groupField
.
map
((
item
:
any
)
=>
{
return
item
.
name
;
});
let
seriesField
=
item
.
dataSetFields
.
filter
((
datasetField
:
any
)
=>
{
return
datasetField
.
name
===
item
.
seriesIdField
;
});
let
tempSeriesField
:
Array
<
any
>
=
seriesField
.
map
((
item
:
any
)
=>
{
return
item
.
name
;
});
let
valueField
=
item
.
dataSetFields
.
filter
((
datasetField
:
any
)
=>
{
return
datasetField
.
name
===
item
.
valueField
;
});
let
tempValueField
:
Array
<
any
>
=
valueField
.
map
((
item
:
any
)
=>
{
return
item
.
name
;
});
item
.
data
=
this
.
groupAndAdd
(
tempGroupField
,
tempSeriesField
,
tempValueField
,
data
,
item
,
groupField
,
allCodeList
);
}
else
{
//单序列
let
groupField
=
item
.
dataSetFields
.
filter
((
datasetField
:
any
)
=>
{
return
datasetField
.
name
===
item
.
categorField
;
});
let
tempGroupField
:
Array
<
any
>
=
groupField
.
map
((
item
:
any
)
=>
{
return
item
.
name
;
})
let
valueField
=
item
.
dataSetFields
.
filter
((
datasetField
:
any
)
=>
{
return
datasetField
.
name
===
item
.
valueField
;
});
let
tempValueField
:
Array
<
any
>
=
valueField
.
map
((
item
:
any
)
=>
{
return
item
.
name
;
})
item
.
data
=
this
.
groupAndAdd
(
tempGroupField
,[],
tempValueField
,
data
,
item
,
groupField
,
allCodeList
);
}
if
(
callback
&&
callback
instanceof
Function
){
callback
(
allCodeList
);
}
}
/**
* 分组和求和
* @param {Array<any>} groupField 分组属性
* @param {Array<any>} groupField 值属性
* @param {Array<any>} data 传入数据
* @param {*} groupFieldModel 分组属性模型
* @param {*} allCodeList 所有代码表
*
* @memberof Db_sysportlet1_chartBase
*/
public
groupAndAdd
(
groupField
:
Array
<
any
>
,
seriesField
:
Array
<
any
>
,
valueField
:
Array
<
any
>
,
data
:
any
,
item
:
any
,
groupFieldModel
:
any
,
allCodeList
:
any
){
let
tempMap
:
Map
<
string
,
any
>
=
new
Map
();
let
groupMode
:
string
=
groupFieldModel
[
0
].
groupMode
;
let
groupKeyStr
:
string
=
""
;
data
.
forEach
((
item
:
any
)
=>
{
let
tempGroupField
:
string
=
groupField
[
0
];
groupKeyStr
=
item
[
tempGroupField
];
let
tempMapItem
:
any
=
tempMap
.
get
(
groupKeyStr
);
if
(
tempMapItem
){
tempMapItem
.
push
(
item
);
tempMap
.
set
(
groupKeyStr
,
tempMapItem
);
}
else
{
tempMap
.
set
(
groupKeyStr
,[
item
]);
}
})
// 处理多序列
if
(
seriesField
.
length
>
0
&&
tempMap
.
size
>
0
){
let
tempSeriesField
:
string
=
seriesField
[
0
];
tempMap
.
forEach
((
item
:
any
,
key
:
string
)
=>
{
let
tempItemMap
:
Map
<
string
,
any
>
=
new
Map
();
item
.
forEach
((
singleItem
:
any
)
=>
{
let
seriesValueArray
:
any
=
tempItemMap
.
get
(
singleItem
[
tempSeriesField
]);
if
(
seriesValueArray
){
seriesValueArray
.
push
(
singleItem
);
tempItemMap
.
set
(
singleItem
[
tempSeriesField
],
seriesValueArray
);
}
else
{
tempItemMap
.
set
(
singleItem
[
tempSeriesField
],[
singleItem
]);
}
})
tempMap
.
set
(
key
,
tempItemMap
);
});
}
let
returnArray
:
Array
<
any
>
=
[];
if
(
seriesField
.
length
==
0
){
//单序列
tempMap
.
forEach
((
tempItem
:
any
)
=>
{
if
(
tempItem
.
length
>
0
){
let
curObject
:
any
=
{};
let
valueResult
:
number
=
0
;
let
categorResult
:
any
;
tempItem
.
forEach
((
singleItem
:
any
)
=>
{
categorResult
=
singleItem
[
groupField
[
0
]];
valueResult
+=
singleItem
[
valueField
[
0
]];
})
Object
.
defineProperty
(
curObject
,
groupField
[
0
],
{
value
:
categorResult
,
writable
:
true
,
enumerable
:
true
,
configurable
:
true
});
Object
.
defineProperty
(
curObject
,
valueField
[
0
],
{
value
:
valueResult
,
writable
:
true
,
enumerable
:
true
,
configurable
:
true
});
returnArray
.
push
(
curObject
);
}
})
}
else
{
// 多序列
let
seriesValuesArray
:
Array
<
any
>
=
item
.
seriesValues
;
tempMap
.
forEach
((
groupItem
:
any
,
groupKey
:
string
)
=>
{
//求和
let
curObject
:
any
=
{};
Object
.
defineProperty
(
curObject
,
groupField
[
0
],
{
value
:
groupKey
,
writable
:
true
,
enumerable
:
true
,
configurable
:
true
});
seriesValuesArray
.
forEach
((
seriesValueItem
:
any
)
=>
{
Object
.
defineProperty
(
curObject
,
seriesValueItem
,
{
value
:
0
,
writable
:
true
,
enumerable
:
true
,
configurable
:
true
});
});
groupItem
.
forEach
((
seriesItem
:
any
,
seriesKey
:
string
)
=>
{
let
seriesNum
:
number
=
0
;
seriesItem
.
forEach
((
dataItem
:
any
)
=>
{
seriesNum
+=
dataItem
[
valueField
[
0
]];
})
curObject
[
seriesKey
]
=
seriesNum
;
})
returnArray
.
push
(
curObject
);
})
}
// 补全空白分类
if
(
returnArray
.
length
>
0
){
let
emptyText
=
(
groupFieldModel
[
0
]
&&
groupFieldModel
[
0
].
codeList
)?
groupFieldModel
[
0
].
codeList
.
emptytext
:
"未定义"
;
returnArray
.
forEach
((
item
:
any
)
=>
{
if
(
!
item
[
groupField
[
0
]]){
item
[
groupField
[
0
]]
=
emptyText
;
}
})
}
returnArray
=
this
.
sortReturnArray
(
returnArray
,
groupFieldModel
,
allCodeList
);
// 雷达图数据格式处理
if
(
Object
.
is
(
item
.
type
,
'radar'
)
&&
returnArray
.
length
>
0
){
let
tempReturnArray
:
Array
<
any
>
=
[];
let
seriesValues
:
Array
<
any
>
=
item
.
seriesValues
;
if
(
seriesValues
&&
seriesValues
.
length
>
0
){
seriesValues
.
forEach
((
singleSeriesName
:
any
)
=>
{
let
singleSeriesObj
:
any
=
{};
returnArray
.
forEach
((
item
:
any
)
=>
{
Object
.
assign
(
singleSeriesObj
,{[
item
[
groupField
[
0
]]]:
item
[
singleSeriesName
]});
})
Object
.
assign
(
singleSeriesObj
,{
type
:
singleSeriesName
});
tempReturnArray
.
push
(
singleSeriesObj
);
})
}
returnArray
=
tempReturnArray
;
}
console
.
log
(
JSON
.
stringify
(
returnArray
));
return
returnArray
;
}
/**
* 排序数组
*
* @param {Array<any>} arr 传入数组
* @param {*} groupField 分组属性
* @param {*} allCodeList 所有代码表
*
* @memberof Db_sysportlet1_chartBase
*/
public
sortReturnArray
(
arr
:
Array
<
any
>
,
groupField
:
any
,
allCodeList
:
any
){
let
returnArray
:
Array
<
any
>
=
[];
// todo
// 分组属性有代码表的情况(最后执行)
if
(
groupField
[
0
].
codelist
){
let
curCodeList
:
Map
<
number
,
any
>
=
allCodeList
.
get
(
groupField
[
0
].
codelist
.
tag
);
curCodeList
.
forEach
((
codelist
:
any
)
=>
{
arr
.
forEach
((
item
:
any
)
=>
{
if
(
Object
.
is
(
item
[
groupField
[
0
].
name
],
codelist
)){
returnArray
.
push
(
item
);
item
.
hasused
=
true
;
}
})
})
arr
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
if
(
!
item
.
hasused
){
returnArray
.
push
(
item
);
}
})
returnArray
.
forEach
((
item
:
any
)
=>
{
delete
item
.
hasused
;
})
}
else
{
// 分组为年份
if
(
Object
.
is
(
groupField
[
0
].
groupMode
,
"YEAR"
)){
returnArray
=
arr
.
sort
((
a
:
any
,
b
:
any
)
=>
{
return
Number
(
a
[
groupField
[
0
].
name
])
-
Number
(
b
[
groupField
[
0
].
name
]);
});
}
else
if
(
Object
.
is
(
groupField
[
0
].
groupMode
,
"QUARTER"
)){
returnArray
=
this
.
handleSortGroupData
(
arr
,
groupField
,
"季度"
);
}
else
if
(
Object
.
is
(
groupField
[
0
].
groupMode
,
"MONTH"
)){
returnArray
=
this
.
handleSortGroupData
(
arr
,
groupField
,
"月"
);
}
else
if
(
Object
.
is
(
groupField
[
0
].
groupMode
,
"YEARWEEK"
)){
returnArray
=
this
.
handleSortGroupData
(
arr
,
groupField
,
"周"
);
}
else
if
(
Object
.
is
(
groupField
[
0
].
groupMode
,
"DAY"
)){
returnArray
=
arr
.
sort
((
a
:
any
,
b
:
any
)
=>
{
return
moment
(
a
[
groupField
[
0
].
name
]).
unix
()
-
moment
(
b
[
groupField
[
0
].
name
]).
unix
();
});
}
else
{
let
groupFieldName
:
string
=
groupField
[
0
].
name
;
let
isConvert
:
boolean
=
true
;
arr
.
forEach
((
item
:
any
)
=>
{
if
(
isNaN
(
item
[
groupFieldName
])){
isConvert
=
false
;
}
})
if
(
isConvert
){
returnArray
=
arr
.
sort
((
a
:
any
,
b
:
any
)
=>
{
return
a
[
groupFieldName
]
-
b
[
groupFieldName
];
});
}
else
{
returnArray
=
arr
;
}
}
}
return
returnArray
;
}
/**
* 排序分组模式下的数据
*
* @param {Array<any>} arr 传入数据
* @param {Array<any>} groupField 分组属性
* @param {Array<any>} label label标签
*
* @memberof Db_sysportlet1_chartBase
*/
public
handleSortGroupData
(
arr
:
Array
<
any
>
,
groupField
:
any
,
label
:
string
){
arr
.
forEach
((
item
:
any
)
=>
{
let
sortFieldValue
:
Array
<
any
>
=
item
[
groupField
[
0
].
name
].
split
(
"-"
);
Object
.
assign
(
item
,{
sortField
:
Number
(
sortFieldValue
[
0
])
*
10000
+
Number
(
sortFieldValue
[
1
])});
item
[
groupField
[
0
].
name
]
=
sortFieldValue
[
0
]
+
"年"
+
sortFieldValue
[
1
]
+
label
;
})
arr
.
sort
((
a
:
any
,
b
:
any
)
=>
{
return
Number
(
a
.
sortField
)
-
Number
(
b
.
sortField
);
});
arr
.
forEach
((
item
:
any
)
=>
{
delete
item
.
sortField
;
})
return
arr
;
}
/**
* 补全数据集
*
* @param {Array<any>} data 传入数据
* @param {Array<any>} item 单个序列
* @param {Array<any>} allCodeList 所有的代码表
*
* @memberof Db_sysportlet1_chartBase
*/
public
completeDataSet
(
data
:
any
,
item
:
any
,
allCodeList
:
any
){
// 分组属性
let
groupField
=
item
.
dataSetFields
.
find
((
datasetField
:
any
)
=>
{
return
datasetField
.
name
===
item
.
categorField
;
});
if
(
Object
.
is
(
groupField
.
groupMode
,
""
)){
return
;
}
//分组模式为代码表(补值)
if
(
Object
.
is
(
groupField
.
groupMode
,
'CODELIST'
)){
this
.
completeCodeList
(
data
,
item
,
allCodeList
);
}
//分组模式为年/季度/月份(最大值,最小值,分组,补值)
if
(
Object
.
is
(
groupField
.
groupMode
,
"YEAR"
)
||
Object
.
is
(
groupField
.
groupMode
,
"QUARTER"
)
||
Object
.
is
(
groupField
.
groupMode
,
"MONTH"
)
||
Object
.
is
(
groupField
.
groupMode
,
"YEARWEEK"
)
||
Object
.
is
(
groupField
.
groupMode
,
"DAY"
)){
this
.
handleTimeData
(
data
,
item
,
allCodeList
,
groupField
);
}
}
/**
* 获取最大值最小值
*
* @param {Array<any>} tempTimeArray 传入数据
*
* @memberof Db_sysportlet1_chartBase
*/
public
getRangeData
(
tempTimeArray
:
Array
<
any
>
){
tempTimeArray
.
forEach
((
item
:
any
)
=>
{
let
tempParams
:
Array
<
any
>
=
item
.
_i
.
split
(
"-"
);
item
.
sortField
=
Number
(
tempParams
[
0
]
+
tempParams
[
1
]);
})
tempTimeArray
.
sort
((
a
:
any
,
b
:
any
)
=>
{
return
Number
(
a
.
sortField
)
-
Number
(
b
.
sortField
);
});
tempTimeArray
.
forEach
((
item
:
any
)
=>
{
delete
item
.
sortField
;
})
return
tempTimeArray
;
}
/**
* 补全时间类型数据集
*
* @param {Array<any>} data 传入数据
* @param {Array<any>} item 单个序列
* @param {Array<any>} allCodeList 所有的代码表
* @param {Array<any>} groupField 分组属性
*
* @memberof Db_sysportlet1_chartBase
*/
public
handleTimeData
(
data
:
any
,
item
:
any
,
allCodeList
:
any
,
groupField
:
any
){
let
valueField
=
item
.
dataSetFields
.
find
((
datasetField
:
any
)
=>
{
return
datasetField
.
name
===
item
.
valueField
;
});
let
groupMode
:
string
=
groupField
.
groupMode
;
// 排序数据,找到最大值、最小值
let
tempTimeArray
:
Array
<
any
>
=
[];
if
(
data
&&
data
.
length
>
0
){
data
.
forEach
((
dataItem
:
any
)
=>
{
// 判断时间类型是否为空,为空不处理
if
(
dataItem
[
groupField
.
name
]){
tempTimeArray
.
push
(
moment
(
dataItem
[
groupField
.
name
]));
}
})
}
let
maxTime
:
any
;
let
minTime
:
any
;
if
(
Object
.
is
(
groupMode
,
"YEAR"
)
||
Object
.
is
(
groupMode
,
"DAY"
)){
maxTime
=
moment
.
max
(
tempTimeArray
);
minTime
=
moment
.
min
(
tempTimeArray
);
}
if
(
Object
.
is
(
groupMode
,
"QUARTER"
)){
tempTimeArray
=
this
.
getRangeData
(
tempTimeArray
);
minTime
=
moment
().
year
((
tempTimeArray
[
0
].
_i
.
split
(
"-"
))[
0
]).
quarters
((
tempTimeArray
[
0
].
_i
.
split
(
"-"
))[
1
]);
maxTime
=
moment
().
year
((
tempTimeArray
[
tempTimeArray
.
length
-
1
].
_i
.
split
(
"-"
))[
0
]).
quarters
((
tempTimeArray
[
tempTimeArray
.
length
-
1
].
_i
.
split
(
"-"
))[
1
]);
}
if
(
Object
.
is
(
groupMode
,
"MONTH"
)){
tempTimeArray
=
this
.
getRangeData
(
tempTimeArray
);
minTime
=
moment
().
year
((
tempTimeArray
[
0
].
_i
.
split
(
"-"
))[
0
]).
month
((
tempTimeArray
[
0
].
_i
.
split
(
"-"
))[
1
]);
maxTime
=
moment
().
year
((
tempTimeArray
[
tempTimeArray
.
length
-
1
].
_i
.
split
(
"-"
))[
0
]).
month
((
tempTimeArray
[
tempTimeArray
.
length
-
1
].
_i
.
split
(
"-"
))[
1
]);
}
if
(
Object
.
is
(
groupMode
,
"YEARWEEK"
)){
tempTimeArray
=
this
.
getRangeData
(
tempTimeArray
);
minTime
=
moment
().
year
((
tempTimeArray
[
0
].
_i
.
split
(
"-"
))[
0
]).
week
((
tempTimeArray
[
0
].
_i
.
split
(
"-"
))[
1
]);
maxTime
=
moment
().
year
((
tempTimeArray
[
tempTimeArray
.
length
-
1
].
_i
.
split
(
"-"
))[
0
]).
week
((
tempTimeArray
[
tempTimeArray
.
length
-
1
].
_i
.
split
(
"-"
))[
1
]);
}
let
timeFragmentArray
:
Array
<
any
>
=
[];
let
tempGrounpData
:
Map
<
string
,
any
>
=
new
Map
();
// 时间分段
//groupMode为"YEAR"
if
(
Object
.
is
(
groupMode
,
"YEAR"
)){
let
curTime
:
any
=
minTime
;
while
(
curTime
){
if
(
curTime
.
isSameOrBefore
(
maxTime
)){
let
tempcurTime
:
any
=
curTime
.
clone
();
timeFragmentArray
.
push
(
tempcurTime
.
year
().
toString
());
curTime
=
tempcurTime
.
clone
().
add
(
1
,
'years'
);
}
else
{
curTime
=
null
;
}
}
}
//groupMode为"QUARTER"
if
(
Object
.
is
(
groupMode
,
"QUARTER"
)){
let
curTime
:
any
=
minTime
;
while
(
curTime
){
if
(
curTime
.
isSameOrBefore
(
maxTime
)){
let
tempcurTime
:
any
=
curTime
.
clone
();
timeFragmentArray
.
push
(
tempcurTime
.
year
().
toString
()
+
"-"
+
tempcurTime
.
quarter
().
toString
());
curTime
=
tempcurTime
.
clone
().
add
(
1
,
'quarters'
);
}
else
{
curTime
=
null
;
}
}
}
//groupMode为"MONTH"
if
(
Object
.
is
(
groupMode
,
"MONTH"
)){
let
curTime
:
any
=
minTime
;
while
(
curTime
){
if
(
curTime
.
isSameOrBefore
(
maxTime
)){
let
tempcurTime
:
any
=
curTime
.
clone
();
timeFragmentArray
.
push
(
tempcurTime
.
year
().
toString
()
+
"-"
+
tempcurTime
.
month
().
toString
());
curTime
=
tempcurTime
.
clone
().
add
(
1
,
'months'
);
}
else
{
curTime
=
null
;
}
}
}
//groupMode为"YEARWEEK"
if
(
Object
.
is
(
groupMode
,
"YEARWEEK"
)){
let
curTime
:
any
=
minTime
;
while
(
curTime
){
if
(
curTime
.
isSameOrBefore
(
maxTime
)){
let
tempcurTime
:
any
=
curTime
.
clone
();
timeFragmentArray
.
push
(
tempcurTime
.
year
().
toString
()
+
"-"
+
tempcurTime
.
week
().
toString
());
curTime
=
tempcurTime
.
clone
().
add
(
1
,
'weeks'
);
}
else
{
curTime
=
null
;
}
}
}
//groupMode为"DAY"
if
(
Object
.
is
(
groupMode
,
"DAY"
)){
let
curTime
:
any
=
minTime
;
while
(
curTime
){
if
(
curTime
.
isSameOrBefore
(
maxTime
)){
let
tempcurTime
:
any
=
curTime
.
clone
();
timeFragmentArray
.
push
(
tempcurTime
.
format
(
'YYYY-MM-DD'
));
curTime
=
tempcurTime
.
clone
().
add
(
1
,
'days'
);
}
else
{
curTime
=
null
;
}
}
}
data
.
forEach
((
item
:
any
)
=>
{
let
tempKeyStr
:
string
=
item
[
groupField
.
name
];
let
tempGrounpItem
:
any
=
tempGrounpData
.
get
(
tempKeyStr
);
if
(
!
tempGrounpItem
){
tempGrounpData
.
set
(
tempKeyStr
,
item
);
}
})
timeFragmentArray
.
forEach
((
timeFragment
:
any
)
=>
{
if
(
!
tempGrounpData
.
get
(
timeFragment
)){
let
copyTemp
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
data
[
0
]));
let
curObj
:
any
=
{};
curObj
[
groupField
.
name
]
=
timeFragment
;
curObj
[
valueField
.
name
]
=
0
;
Object
.
assign
(
copyTemp
,
curObj
);
data
.
push
(
copyTemp
);
}
})
}
/**
* 补全代码表
*
* @param {Array<any>} data 传入数据
* @param {Array<any>} item 单个序列
* @param {Array<any>} allCodeList 所有的代码表
*
* @memberof Db_sysportlet1_chartBase
*/
public
completeCodeList
(
data
:
any
,
item
:
any
,
allCodeList
:
any
){
let
groupField
=
item
.
dataSetFields
.
find
((
datasetField
:
any
)
=>
{
return
datasetField
.
name
===
item
.
categorField
;
});
if
(
!
groupField
.
codelist
){
return
;
}
let
valueField
=
item
.
dataSetFields
.
find
((
datasetField
:
any
)
=>
{
return
datasetField
.
name
===
item
.
valueField
;
});
let
curCodeList
:
Map
<
number
,
any
>
=
allCodeList
.
get
(
groupField
.
codelist
.
tag
);
// 对分类实现分组
let
tempGrounpData
:
Map
<
string
,
any
>
=
new
Map
();
data
.
forEach
((
item
:
any
)
=>
{
let
tempGrounpItem
:
any
=
tempGrounpData
.
get
(
item
[
groupField
.
name
+
'_srfvalue'
]);
if
(
!
tempGrounpItem
){
tempGrounpData
.
set
(
item
[
groupField
.
name
+
'_srfvalue'
],
item
);
}
})
if
(
curCodeList
.
size
!==
tempGrounpData
.
size
){
curCodeList
.
forEach
((
text
:
any
,
value
:
any
)
=>
{
if
(
!
tempGrounpData
.
get
(
value
)){
let
copyTemp
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
data
[
0
]));
let
curObj
:
any
=
{};
curObj
[
groupField
.
name
+
'_srfvalue'
]
=
value
;
curObj
[
groupField
.
name
]
=
text
;
curObj
[
valueField
.
name
]
=
0
;
Object
.
assign
(
copyTemp
,
curObj
);
data
.
push
(
copyTemp
);
}
})
}
}
/**
* 处理单个属性
*
* @param {*} input 输入值
* @param {*} field 属性值
* @param {*} allCodeList 所有代码表
* @param {*} result 结果值
*
* @memberof Db_sysportlet1_chartBase
*/
public
handleSingleDataSetField
(
input
:
any
,
field
:
any
,
allCodeList
:
any
,
result
:
any
,
groupField
:
any
){
let
tempFieldObj
:
any
=
{};
//存在代码表的情况(自动转化值)
if
(
field
.
codelist
){
//获取代码表
let
curCodeList
:
Map
<
number
,
any
>
=
allCodeList
.
get
(
field
.
codelist
.
tag
);
tempFieldObj
[
field
.
name
]
=
curCodeList
.
get
(
input
[
field
.
name
]);
tempFieldObj
[
field
.
name
+
'_srfvalue'
]
=
input
[
field
.
name
];
}
else
{
// 不存在代码表的情况
if
(
groupField
&&
Object
.
is
(
groupField
.
name
,
field
.
name
)){
if
(
Object
.
is
(
groupField
.
groupMode
,
"YEAR"
)
){
tempFieldObj
[
field
.
name
]
=
moment
(
input
[
field
.
name
]).
year
().
toString
();
}
else
if
(
Object
.
is
(
groupField
.
groupMode
,
"QUARTER"
)
){
tempFieldObj
[
field
.
name
]
=
moment
(
input
[
field
.
name
]).
year
().
toString
()
+
"-"
+
moment
(
input
[
field
.
name
]).
quarters
().
toString
();
}
else
if
(
Object
.
is
(
groupField
.
groupMode
,
"MONTH"
)
){
tempFieldObj
[
field
.
name
]
=
moment
(
input
[
field
.
name
]).
year
().
toString
()
+
"-"
+
moment
(
input
[
field
.
name
]).
month
().
toString
();
}
else
if
(
Object
.
is
(
groupField
.
groupMode
,
"YEARWEEK"
)
){
tempFieldObj
[
field
.
name
]
=
moment
(
input
[
field
.
name
]).
year
().
toString
()
+
"-"
+
moment
(
input
[
field
.
name
]).
week
().
toString
();
}
else
if
(
Object
.
is
(
groupField
.
groupMode
,
"DAY"
)
){
tempFieldObj
[
field
.
name
]
=
moment
(
input
[
field
.
name
]).
format
(
"YYYY-MM-DD"
);
}
else
{
tempFieldObj
[
field
.
name
]
=
input
[
field
.
name
];
}
}
else
{
tempFieldObj
[
field
.
name
]
=
input
[
field
.
name
]
}
}
Object
.
assign
(
result
,
tempFieldObj
);
}
/**
* 获取图表所需代码表
*
* @memberof Db_sysportlet1_chartBase
*/
public
getChartAllCodeList
():
Promise
<
any
>
{
return
new
Promise
((
resolve
:
any
,
reject
:
any
)
=>
{
let
codeListMap
:
Map
<
string
,
any
>
=
new
Map
();
if
(
Object
.
values
(
this
.
seriesModel
).
length
>
0
){
let
tempFlag
:
boolean
=
true
;
Object
.
values
(
this
.
seriesModel
).
forEach
((
singleSeries
:
any
)
=>
{
if
(
singleSeries
.
dataSetFields
&&
singleSeries
.
dataSetFields
.
length
>
0
){
let
promiseArray
:
Array
<
any
>
=
[];
let
promiseKeyArray
:
Array
<
any
>
=
[];
singleSeries
.
dataSetFields
.
forEach
((
singleDataSetField
:
any
,
index
:
any
)
=>
{
if
(
singleDataSetField
.
codelist
){
tempFlag
=
false
;
if
(
!
codeListMap
.
get
(
singleDataSetField
.
codelist
.
tag
)){
promiseArray
.
push
(
this
.
getCodeList
(
singleDataSetField
.
codelist
));
promiseKeyArray
.
push
(
singleDataSetField
.
codelist
.
tag
);
Promise
.
all
(
promiseArray
).
then
((
result
:
any
)
=>
{
if
(
result
&&
result
.
length
>
0
){
result
.
forEach
((
codeList
:
any
)
=>
{
let
tempCodeListMap
:
Map
<
number
,
any
>
=
new
Map
();
if
(
codeList
.
length
>
0
){
codeList
.
forEach
((
codeListItem
:
any
)
=>
{
tempCodeListMap
.
set
(
codeListItem
.
value
,
codeListItem
.
text
);
})
}
codeListMap
.
set
(
singleDataSetField
.
codelist
.
tag
,
tempCodeListMap
);
})
resolve
(
codeListMap
);
}
})
}
}
})
}
})
if
(
tempFlag
){
resolve
(
codeListMap
);}
}
else
{
resolve
(
codeListMap
);
}
})
}
/**
* 获取代码表
*
* @returns {Promise<any>}
* @memberof Db_sysportlet1_chartBase
*/
public
getCodeList
(
codeListObject
:
any
):
Promise
<
any
>
{
return
new
Promise
((
resolve
:
any
,
reject
:
any
)
=>
{
if
(
codeListObject
.
tag
&&
Object
.
is
(
codeListObject
.
type
,
"STATIC"
)){
const
codelist
=
this
.
$store
.
getters
.
getCodeList
(
codeListObject
.
tag
);
if
(
codelist
)
{
resolve
([...
JSON
.
parse
(
JSON
.
stringify
(
codelist
.
items
))]);
}
else
{
console
.
log
(
`----
${
codeListObject
.
tag
}
----代码表不存在`
);
}
}
else
if
(
codeListObject
.
tag
&&
Object
.
is
(
codeListObject
.
type
,
"DYNAMIC"
)){
this
.
codeListService
.
getItems
(
codeListObject
.
tag
).
then
((
res
:
any
)
=>
{
resolve
(
res
);
}).
catch
((
error
:
any
)
=>
{
console
.
log
(
`----
${
codeListObject
.
tag
}
----代码表不存在`
);
});
}
})
}
}
\ No newline at end of file
app_CRM/src/widgets/opportunity/chart-001-chart/chart-001-chart-model.ts
0 → 100644
浏览文件 @
60d9e01e
/**
* CHART_001 部件模型
*
* @export
* @class CHART_001Model
*/
export
default
class
CHART_001Model
{
/**
* 获取数据项集合
*
* @returns {any[]}
* @memberof CHART_001Db_sysportlet1_chartMode
*/
public
getDataItems
():
any
[]
{
return
[
{
name
:
'size'
,
prop
:
'size'
},
{
name
:
'query'
,
prop
:
'query'
},
{
name
:
'page'
,
prop
:
'page'
},
{
name
:
'sort'
,
prop
:
'sort'
}
]
}
}
\ No newline at end of file
app_CRM/src/widgets/opportunity/chart-001-chart/chart-001-chart-service.ts
0 → 100644
浏览文件 @
60d9e01e
import
{
Http
,
Util
,
Errorlog
}
from
'@/utils'
;
import
ControlService
from
'@/widgets/control-service'
;
import
OpportunityService
from
'@/service/opportunity/opportunity-service'
;
import
CHART_001Model
from
'./chart-001-chart-model'
;
/**
* CHART_001 部件服务对象
*
* @export
* @class CHART_001Service
*/
export
default
class
CHART_001Service
extends
ControlService
{
/**
* 商机服务对象
*
* @type {OpportunityService}
* @memberof CHART_001Service
*/
public
appEntityService
:
OpportunityService
=
new
OpportunityService
({
$store
:
this
.
getStore
()
});
/**
* 设置从数据模式
*
* @type {boolean}
* @memberof CHART_001Service
*/
public
setTempMode
(){
this
.
isTempMode
=
false
;
}
/**
* Creates an instance of CHART_001Service.
*
* @param {*} [opts={}]
* @memberof CHART_001Service
*/
constructor
(
opts
:
any
=
{})
{
super
(
opts
);
this
.
model
=
new
CHART_001Model
();
}
/**
* 查询数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof CHART_001Service
*/
@
Errorlog
public
search
(
action
:
string
,
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
const
{
data
:
Data
,
context
:
Context
}
=
this
.
handleRequestData
(
action
,
context
,
data
,
true
);
return
new
Promise
((
resolve
:
any
,
reject
:
any
)
=>
{
const
_appEntityService
:
any
=
this
.
appEntityService
;
let
result
:
Promise
<
any
>
;
if
(
_appEntityService
[
action
]
&&
_appEntityService
[
action
]
instanceof
Function
)
{
result
=
_appEntityService
[
action
](
Context
,
Data
,
isloading
);
}
else
{
result
=
_appEntityService
.
FetchDefault
(
Context
,
Data
,
isloading
);
}
result
.
then
((
response
)
=>
{
resolve
(
response
);
}).
catch
(
response
=>
{
reject
(
response
);
});
});
}
}
\ No newline at end of file
app_CRM/src/widgets/opportunity/chart-001-chart/chart-001-chart.html
0 → 100644
浏览文件 @
60d9e01e
<div
class=
"app-data-chart "
>
<div
v-if=
"isNoData"
class=
"chart-no-data"
><i
class=
"el-icon-data-analysis"
></i>
暂无数据
</div>
<div
v-else
class=
"app-charts"
:id=
"chartId"
style=
"height: 300px;padding: 6px 0;"
></div>
</div>
\ No newline at end of file
app_CRM/src/widgets/opportunity/chart-001-chart/chart-001-chart.less
0 → 100644
浏览文件 @
60d9e01e
.app-data-chart {
width: 100%;
height: 100%;
.chart-no-data{
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
i{
margin-right: 5px;
}
}
}
\ No newline at end of file
app_CRM/src/widgets/opportunity/chart-001-chart/chart-001-chart.vue
0 → 100644
浏览文件 @
60d9e01e
<
template
src=
"./chart-001-chart.html"
/>
<script
lang=
'tsx'
>
import
{ Component } from 'vue-property-decorator';
import { VueLifeCycleProcessing } from '@/studio-core';
import { CHART_001ChartBase } from './chart-001-chart-base';
/**
* db_sysportlet1_chart部件
*
* @export
* @class CHART_001Chart
* @extends {CHART_001ChartBase}
*/
@Component({
components: {
}
})
@VueLifeCycleProcessing()
export default class CHART_001Chart extends CHART_001ChartBase { }
</script>
app_CRM/src/widgets/opportunity/part-cht-001-portlet/part-cht-001-portlet-base.tsx
0 → 100644
浏览文件 @
60d9e01e
import
{
Prop
,
Provide
,
Emit
,
Model
}
from
'vue-property-decorator'
;
import
{
Subject
,
Subscription
}
from
'rxjs'
;
import
{
Watch
,
MainControlBase
}
from
'@/studio-core'
;
import
OpportunityService
from
'@/service/opportunity/opportunity-service'
;
import
PART_CHT_001Service
from
'./part-cht-001-portlet-service'
;
import
{
Environment
}
from
'@/environments/environment'
;
/**
* db_sysportlet1部件基类
*
* @export
* @class MainControlBase
* @extends {PART_CHT_001PortletBase}
*/
export
class
PART_CHT_001PortletBase
extends
MainControlBase
{
/**
* 建构部件服务对象
*
* @type {PART_CHT_001Service}
* @memberof PART_CHT_001PortletBase
*/
public
service
:
PART_CHT_001Service
=
new
PART_CHT_001Service
({
$store
:
this
.
$store
});
/**
* 实体服务对象
*
* @type {OpportunityService}
* @memberof PART_CHT_001PortletBase
*/
public
appEntityService
:
OpportunityService
=
new
OpportunityService
({
$store
:
this
.
$store
});
/**
* 应用实体名称
*
* @protected
* @type {string}
* @memberof PART_CHT_001PortletBase
*/
protected
appDeName
:
string
=
'opportunity'
;
/**
* 长度
*
* @type {number}
* @memberof PART_CHT_001
*/
@
Prop
()
public
height
?:
number
;
/**
* 宽度
*
* @type {number}
* @memberof PART_CHT_001
*/
@
Prop
()
public
width
?:
number
;
/**
* 是否自适应大小
*
* @returns {boolean}
* @memberof PART_CHT_001Base
*/
@
Prop
({
default
:
false
})
public
isAdaptiveSize
!
:
boolean
;
/**
* 获取多项数据
*
* @returns {any[]}
* @memberof PART_CHT_001Base
*/
public
getDatas
():
any
[]
{
return
[];
}
/**
* 获取单项树
*
* @returns {*}
* @memberof PART_CHT_001Base
*/
public
getData
():
any
{
return
{};
}
/**
* 获取高度
*
* @returns {any[]}
* @memberof PART_CHT_001Base
*/
get
getHeight
():
any
{
if
(
!
this
.
$util
.
isEmpty
(
this
.
height
)
&&
!
this
.
$util
.
isNumberNaN
(
this
.
height
)){
if
(
this
.
height
==
0
){
return
'auto'
;
}
else
{
return
this
.
height
+
'px'
;
}
}
else
{
return
'300px'
;
}
}
/**
* vue 生命周期
*
* @memberof PART_CHT_001Base
*/
public
created
()
{
this
.
afterCreated
();
}
/**
* 执行created后的逻辑
*
* @memberof PART_CHT_001Base
*/
public
afterCreated
(){
if
(
this
.
viewState
)
{
this
.
viewStateEvent
=
this
.
viewState
.
subscribe
(({
tag
,
action
,
data
})
=>
{
if
(
!
Object
.
is
(
tag
,
this
.
name
))
{
return
;
}
const
refs
:
any
=
this
.
$refs
;
Object
.
keys
(
refs
).
forEach
((
_name
:
string
)
=>
{
this
.
viewState
.
next
({
tag
:
_name
,
action
:
action
,
data
:
data
});
});
});
}
}
/**
* vue 生命周期
*
* @memberof PART_CHT_001Base
*/
public
destroyed
()
{
this
.
afterDestroy
();
}
/**
* 执行destroyed后的逻辑
*
* @memberof PART_CHT_001Base
*/
public
afterDestroy
()
{
if
(
this
.
viewStateEvent
)
{
this
.
viewStateEvent
.
unsubscribe
();
}
}
}
app_CRM/src/widgets/opportunity/part-cht-001-portlet/part-cht-001-portlet-model.ts
0 → 100644
浏览文件 @
60d9e01e
/**
* PART_CHT_001 部件模型
*
* @export
* @class PART_CHT_001Model
*/
export
default
class
PART_CHT_001Model
{
/**
* 获取数据项集合
*
* @returns {any[]}
* @memberof PART_CHT_001Model
*/
public
getDataItems
():
any
[]
{
return
[
{
name
:
'decisionmaker'
,
},
{
name
:
'totallineitemamount'
,
},
{
name
:
'processid'
,
},
{
name
:
'discountpercentage'
,
},
{
name
:
'pricingerrorcode'
,
},
{
name
:
'totalamount'
,
},
{
name
:
'totaltax_base'
,
},
{
name
:
'totaltax'
,
},
{
name
:
'updateman'
,
},
{
name
:
'estimatedvalue_base'
,
},
{
name
:
'presentfinalproposal'
,
},
{
name
:
'developproposal'
,
},
{
name
:
'opportunityratingcode'
,
},
{
name
:
'totalamount_base'
,
},
{
name
:
'totalamountlessfreight'
,
},
{
name
:
'description'
,
},
{
name
:
'identifycompetitors'
,
},
{
name
:
'updatedate'
,
},
{
name
:
'sendthankyounote'
,
},
{
name
:
'totaldiscountamount_base'
,
},
{
name
:
'totallineitemdiscountamount'
,
},
{
name
:
'purchaseprocess'
,
},
{
name
:
'traversedpath'
,
},
{
name
:
'captureproposalfeedback'
,
},
{
name
:
'finaldecisiondate'
,
},
{
name
:
'stepid'
,
},
{
name
:
'resolvefeedback'
,
},
{
name
:
'budgetamount_base'
,
},
{
name
:
'owneridyominame'
,
},
{
name
:
'pursuitdecision'
,
},
{
name
:
'revenuesystemcalculated'
,
},
{
name
:
'scheduleproposalmeeting'
,
},
{
name
:
'closeprobability'
,
},
{
name
:
'utcconversiontimezonecode'
,
},
{
name
:
'presentproposal'
,
},
{
name
:
'schedulefollowup_prospect'
,
},
{
name
:
'statuscode'
,
},
{
name
:
'actualclosedate'
,
},
{
name
:
'confirminterest'
,
},
{
name
:
'customerid'
,
},
{
name
:
'salesstage'
,
},
{
name
:
'opportunity'
,
prop
:
'opportunityid'
,
},
{
name
:
'onholdtime'
,
},
{
name
:
'qualificationcomments'
,
},
{
name
:
'accountidyominame'
,
},
{
name
:
'schedulefollowup_qualify'
,
},
{
name
:
'participatesinworkflow'
,
},
{
name
:
'exchangerate'
,
},
{
name
:
'stepname'
,
},
{
name
:
'customerneed'
,
},
{
name
:
'importsequencenumber'
,
},
{
name
:
'completeinternalreview'
,
},
{
name
:
'evaluatefit'
,
},
{
name
:
'salesstagecode'
,
},
{
name
:
'identifypursuitteam'
,
},
{
name
:
'contactidyominame'
,
},
{
name
:
'initialcommunication'
,
},
{
name
:
'versionnumber'
,
},
{
name
:
'freightamount_base'
,
},
{
name
:
'teamsfollowed'
,
},
{
name
:
'proposedsolution'
,
},
{
name
:
'filedebrief'
,
},
{
name
:
'budgetamount'
,
},
{
name
:
'budgetstatus'
,
},
{
name
:
'discountamount_base'
,
},
{
name
:
'completefinalproposal'
,
},
{
name
:
'discountamount'
,
},
{
name
:
'customeridyominame'
,
},
{
name
:
'need'
,
},
{
name
:
'stageid'
,
},
{
name
:
'freightamount'
,
},
{
name
:
'actualvalue'
,
},
{
name
:
'ibizprivate'
,
},
{
name
:
'timezoneruleversionnumber'
,
},
{
name
:
'createdate'
,
},
{
name
:
'prioritycode'
,
},
{
name
:
'totallineitemamount_base'
,
},
{
name
:
'estimatedclosedate'
,
},
{
name
:
'currentsituation'
,
},
{
name
:
'actualvalue_base'
,
},
{
name
:
'customerpainpoints'
,
},
{
name
:
'totaldiscountamount'
,
},
{
name
:
'opportunityname'
,
},
{
name
:
'owneridtype'
,
},
{
name
:
'identifycustomercontacts'
,
},
{
name
:
'timeline'
,
},
{
name
:
'lastonholdtime'
,
},
{
name
:
'totalamountlessfreight_base'
,
},
{
name
:
'estimatedvalue'
,
},
{
name
:
'emailaddress'
,
},
{
name
:
'statecode'
,
},
{
name
:
'purchasetimeframe'
,
},
{
name
:
'createman'
,
},
{
name
:
'quotecomments'
,
},
{
name
:
'customeridtype'
,
},
{
name
:
'overriddencreatedon'
,
},
{
name
:
'ownerid'
,
},
{
name
:
'slaname'
,
},
{
name
:
'parentcontactid'
,
},
{
name
:
'campaignid'
,
},
{
name
:
'transactioncurrencyid'
,
},
{
name
:
'parentaccountid'
,
},
{
name
:
'pricelevelid'
,
},
{
name
:
'originatingleadid'
,
},
{
name
:
'slaid'
,
},
{
name
:
'originatingleadname'
,
},
{
name
:
'parentaccountname'
,
},
{
name
:
'campaignname'
,
},
{
name
:
'parentcontactname'
,
},
{
name
:
'transactioncurrencyname'
,
},
{
name
:
'pricelevelname'
,
},
]
}
}
app_CRM/src/widgets/opportunity/part-cht-001-portlet/part-cht-001-portlet-service.ts
0 → 100644
浏览文件 @
60d9e01e
import
{
Http
}
from
'@/utils'
;
import
ControlService
from
'@/widgets/control-service'
;
/**
* PART_CHT_001 部件服务对象
*
* @export
* @class PART_CHT_001Service
*/
export
default
class
PART_CHT_001Service
extends
ControlService
{
}
app_CRM/src/widgets/opportunity/part-cht-001-portlet/part-cht-001-portlet.html
0 → 100644
浏览文件 @
60d9e01e
<div
class=
'portlet part-cht-001 '
:style=
"{'height': isAdaptiveSize ? 'calc(100% - 16px)' : getHeight,}"
>
<p
class=
'portlet-title'
>
<span>
商机
</span>
</p>
<div
class=
"portlet-with-title"
>
<!-- 测试 -->
<view
_db_sysportlet1_chart
:viewState=
"viewState"
:viewparams=
"viewparams"
:context=
"context"
fetchAction=
"FetchTop5"
:showBusyIndicator=
"true"
name=
"db_sysportlet1_chart"
ref=
'db_sysportlet1_chart'
@
closeview=
"closeView($event)"
>
</view
_db_sysportlet1_chart
>
</div>
</div>
app_CRM/src/widgets/opportunity/part-cht-001-portlet/part-cht-001-portlet.vue
0 → 100644
浏览文件 @
60d9e01e
<
template
src=
"./part-cht-001-portlet.html"
/>
<script
lang=
'tsx'
>
import
{ Component } from 'vue-property-decorator';
import { VueLifeCycleProcessing } from '@/studio-core';
import { PART_CHT_001PortletBase } from './part-cht-001-portlet-base';
import view_db_sysportlet1_chart from '@widgets/opportunity/chart-001-chart/chart-001-chart.vue';
/**
* db_sysportlet1部件
*
* @export
* @class PART_CHT_001Portlet
* @extends {PART_CHT_001PortletBase}
*/
@Component({
components: {
view_db_sysportlet1_chart,
}
})
@VueLifeCycleProcessing()
export default class PART_CHT_001Portlet extends PART_CHT_001PortletBase { }
</script>
businesscentral-app/businesscentral-app-crm/src/main/resources/application-crm-prod.yml
浏览文件 @
60d9e01e
...
...
@@ -135,6 +135,10 @@ zuul:
path
:
/opportunitycompetitors/**
serviceId
:
ibizbusinesscentral-centralapi
stripPrefix
:
false
competitorsalesliterature
:
path
:
/competitorsalesliteratures/**
serviceId
:
ibizbusinesscentral-centralapi
stripPrefix
:
false
salesliteratureitem
:
path
:
/salesliteratureitems/**
serviceId
:
ibizbusinesscentral-centralapi
...
...
businesscentral-core/src/main/java/cn/ibizlab/businesscentral/core/sales/mapper/OpportunityMapper.java
浏览文件 @
60d9e01e
...
...
@@ -19,6 +19,7 @@ import com.alibaba.fastjson.JSONObject;
public
interface
OpportunityMapper
extends
BaseMapper
<
Opportunity
>{
Page
<
Opportunity
>
searchTop5
(
IPage
page
,
@Param
(
"srf"
)
OpportunitySearchContext
context
,
@Param
(
"ew"
)
Wrapper
<
Opportunity
>
wrapper
)
;
Page
<
Opportunity
>
searchDefault
(
IPage
page
,
@Param
(
"srf"
)
OpportunitySearchContext
context
,
@Param
(
"ew"
)
Wrapper
<
Opportunity
>
wrapper
)
;
@Override
Opportunity
selectById
(
Serializable
id
);
...
...
businesscentral-core/src/main/java/cn/ibizlab/businesscentral/core/sales/service/IOpportunityService.java
浏览文件 @
60d9e01e
...
...
@@ -38,6 +38,7 @@ public interface IOpportunityService extends IService<Opportunity>{
boolean
checkKey
(
Opportunity
et
)
;
boolean
save
(
Opportunity
et
)
;
void
saveBatch
(
List
<
Opportunity
>
list
)
;
Page
<
Opportunity
>
searchTop5
(
OpportunitySearchContext
context
)
;
Page
<
Opportunity
>
searchDefault
(
OpportunitySearchContext
context
)
;
List
<
Opportunity
>
selectByParentaccountid
(
String
accountid
)
;
void
removeByParentaccountid
(
String
accountid
)
;
...
...
businesscentral-core/src/main/java/cn/ibizlab/businesscentral/core/sales/service/impl/OpportunityServiceImpl.java
浏览文件 @
60d9e01e
...
...
@@ -272,6 +272,15 @@ public class OpportunityServiceImpl extends ServiceImpl<OpportunityMapper, Oppor
}
/**
* 查询集合 Top5
*/
@Override
public
Page
<
Opportunity
>
searchTop5
(
OpportunitySearchContext
context
)
{
com
.
baomidou
.
mybatisplus
.
extension
.
plugins
.
pagination
.
Page
<
Opportunity
>
pages
=
baseMapper
.
searchTop5
(
context
.
getPages
(),
context
,
context
.
getSelectCond
());
return
new
PageImpl
<
Opportunity
>(
pages
.
getRecords
(),
context
.
getPageable
(),
pages
.
getTotal
());
}
/**
* 查询集合 DEFAULT
*/
...
...
businesscentral-core/src/main/resources/liquibase/h2_table.xml
浏览文件 @
60d9e01e
...
...
@@ -1290,7 +1290,7 @@
<!--输出实体[SALESLITERATUREITEM]数据结构 -->
<changeSet
author=
"a_LAB01_e85d8801c"
id=
"tab-salesliteratureitem-
3
-18"
>
<changeSet
author=
"a_LAB01_e85d8801c"
id=
"tab-salesliteratureitem-
7
-18"
>
<createTable
tableName=
"SALESLITERATUREITEM"
>
<column
name=
"AUTHORNAME"
remarks=
""
type=
"VARCHAR(500)"
>
</column>
...
...
@@ -6343,7 +6343,7 @@
<!--输出实体[SALESLITERATURE]数据结构 -->
<changeSet
author=
"a_LAB01_e85d8801c"
id=
"tab-salesliterature-1
6
-73"
>
<changeSet
author=
"a_LAB01_e85d8801c"
id=
"tab-salesliterature-1
7
-73"
>
<createTable
tableName=
"SALESLITERATURE"
>
<column
name=
"IMPORTSEQUENCENUMBER"
remarks=
""
type=
"INT"
>
</column>
...
...
@@ -8113,7 +8113,7 @@
<!--输出实体[COMPETITOR]数据结构 -->
<changeSet
author=
"a_LAB01_e85d8801c"
id=
"tab-competitor-3
6
-90"
>
<changeSet
author=
"a_LAB01_e85d8801c"
id=
"tab-competitor-3
7
-90"
>
<createTable
tableName=
"COMPETITOR"
>
<column
name=
"ENTITYIMAGE"
remarks=
""
type=
"VARCHAR(100)"
>
</column>
...
...
@@ -10434,7 +10434,7 @@
<!--输出实体[OPPORTUNITY]数据结构 -->
<changeSet
author=
"a_LAB01_e85d8801c"
id=
"tab-opportunity-1
07
-124"
>
<changeSet
author=
"a_LAB01_e85d8801c"
id=
"tab-opportunity-1
11
-124"
>
<createTable
tableName=
"OPPORTUNITY"
>
<column
name=
"DECISIONMAKER"
remarks=
""
type=
"INT"
>
</column>
...
...
@@ -10872,7 +10872,7 @@
</changeSet>
<!--输出实体[UOMSCHEDULE]外键关系 -->
<!--输出实体[SALESLITERATUREITEM]外键关系 -->
<changeSet
author=
"a_LAB01_e85d8801c"
id=
"fk-salesliteratureitem-
3
-156"
>
<changeSet
author=
"a_LAB01_e85d8801c"
id=
"fk-salesliteratureitem-
7
-156"
>
<addForeignKeyConstraint
baseColumnNames=
"SALESLITERATUREID"
baseTableName=
"SALESLITERATUREITEM"
constraintName=
"DER1N_SALESLITERATUREITEM__SAL"
deferrable=
"false"
initiallyDeferred=
"false"
onDelete=
"RESTRICT"
onUpdate=
"RESTRICT"
referencedColumnNames=
"SALESLITERATUREID"
referencedTableName=
"SALESLITERATURE"
validate=
"true"
/>
</changeSet>
<!--输出实体[PRODUCTPRICELEVEL]外键关系 -->
...
...
@@ -11335,10 +11335,10 @@
<addForeignKeyConstraint
baseColumnNames=
"TRANSACTIONCURRENCYID"
baseTableName=
"RATINGVALUE"
constraintName=
"DER1N_RATINGVALUE__TRANSACTION"
deferrable=
"false"
initiallyDeferred=
"false"
onDelete=
"RESTRICT"
onUpdate=
"RESTRICT"
referencedColumnNames=
"TRANSACTIONCURRENCYID"
referencedTableName=
"TRANSACTIONCURRENCY"
validate=
"true"
/>
</changeSet>
<!--输出实体[SALESLITERATURE]外键关系 -->
<changeSet
author=
"a_LAB01_e85d8801c"
id=
"fk-salesliterature-1
6
-311"
>
<changeSet
author=
"a_LAB01_e85d8801c"
id=
"fk-salesliterature-1
7
-311"
>
<addForeignKeyConstraint
baseColumnNames=
"SUBJECTID"
baseTableName=
"SALESLITERATURE"
constraintName=
"DER1N_SALESLITERATURE__SUBJECT"
deferrable=
"false"
initiallyDeferred=
"false"
onDelete=
"RESTRICT"
onUpdate=
"RESTRICT"
referencedColumnNames=
"SUBJECTID"
referencedTableName=
"SUBJECT"
validate=
"true"
/>
</changeSet>
<changeSet
author=
"a_LAB01_e85d8801c"
id=
"fk-salesliterature-1
6
-312"
>
<changeSet
author=
"a_LAB01_e85d8801c"
id=
"fk-salesliterature-1
7
-312"
>
<addForeignKeyConstraint
baseColumnNames=
"TRANSACTIONCURRENCYID"
baseTableName=
"SALESLITERATURE"
constraintName=
"DER1N_SALESLITERATURE__TRANSAC"
deferrable=
"false"
initiallyDeferred=
"false"
onDelete=
"RESTRICT"
onUpdate=
"RESTRICT"
referencedColumnNames=
"TRANSACTIONCURRENCYID"
referencedTableName=
"TRANSACTIONCURRENCY"
validate=
"true"
/>
</changeSet>
<!--输出实体[METRIC]外键关系 -->
...
...
@@ -11457,7 +11457,7 @@
<!--输出实体[CAMPAIGNLIST]外键关系 -->
<!--输出实体[LISTCONTACT]外键关系 -->
<!--输出实体[COMPETITOR]外键关系 -->
<changeSet
author=
"a_LAB01_e85d8801c"
id=
"fk-competitor-3
6
-350"
>
<changeSet
author=
"a_LAB01_e85d8801c"
id=
"fk-competitor-3
7
-350"
>
<addForeignKeyConstraint
baseColumnNames=
"TRANSACTIONCURRENCYID"
baseTableName=
"COMPETITOR"
constraintName=
"DER1N_COMPETITOR__TRANSACTIONC"
deferrable=
"false"
initiallyDeferred=
"false"
onDelete=
"RESTRICT"
onUpdate=
"RESTRICT"
referencedColumnNames=
"TRANSACTIONCURRENCYID"
referencedTableName=
"TRANSACTIONCURRENCY"
validate=
"true"
/>
</changeSet>
<!--输出实体[PRODUCT]外键关系 -->
...
...
@@ -11484,7 +11484,7 @@
<addForeignKeyConstraint
baseColumnNames=
"TRANSACTIONCURRENCYID"
baseTableName=
"CHARACTERISTIC"
constraintName=
"DER1N_CHARACTERISTIC__TRANSACT"
deferrable=
"false"
initiallyDeferred=
"false"
onDelete=
"RESTRICT"
onUpdate=
"RESTRICT"
referencedColumnNames=
"TRANSACTIONCURRENCYID"
referencedTableName=
"TRANSACTIONCURRENCY"
validate=
"true"
/>
</changeSet>
<!--输出实体[COMPETITORSALESLITERATURE]外键关系 -->
<changeSet
author=
"a_LAB01_e85d8801c"
id=
"fk-competitorsalesliterature-
9
-358"
>
<changeSet
author=
"a_LAB01_e85d8801c"
id=
"fk-competitorsalesliterature-
16
-358"
>
<addForeignKeyConstraint
baseColumnNames=
"ENTITYID"
baseTableName=
"RELATIONSHIPS"
constraintName=
"DER1N_COMPETITORSALESLITERATUR"
deferrable=
"false"
initiallyDeferred=
"false"
onDelete=
"RESTRICT"
onUpdate=
"RESTRICT"
referencedColumnNames=
"COMPETITORID"
referencedTableName=
"COMPETITOR"
validate=
"true"
/>
</changeSet>
<!--输出实体[RESOURCESPEC]外键关系 -->
...
...
@@ -11668,25 +11668,25 @@
<!--输出实体[RELATIONSHIPS]外键关系 -->
<!--输出实体[CONNECTIONROLE]外键关系 -->
<!--输出实体[OPPORTUNITY]外键关系 -->
<changeSet
author=
"a_LAB01_e85d8801c"
id=
"fk-opportunity-1
07
-414"
>
<changeSet
author=
"a_LAB01_e85d8801c"
id=
"fk-opportunity-1
11
-414"
>
<addForeignKeyConstraint
baseColumnNames=
"PARENTACCOUNTID"
baseTableName=
"OPPORTUNITY"
constraintName=
"DER1N_OPPORTUNITY__ACCOUNT__PA"
deferrable=
"false"
initiallyDeferred=
"false"
onDelete=
"RESTRICT"
onUpdate=
"RESTRICT"
referencedColumnNames=
"ACCOUNTID"
referencedTableName=
"ACCOUNT"
validate=
"true"
/>
</changeSet>
<changeSet
author=
"a_LAB01_e85d8801c"
id=
"fk-opportunity-1
07
-415"
>
<changeSet
author=
"a_LAB01_e85d8801c"
id=
"fk-opportunity-1
11
-415"
>
<addForeignKeyConstraint
baseColumnNames=
"CAMPAIGNID"
baseTableName=
"OPPORTUNITY"
constraintName=
"DER1N_OPPORTUNITY__CAMPAIGN__C"
deferrable=
"false"
initiallyDeferred=
"false"
onDelete=
"RESTRICT"
onUpdate=
"RESTRICT"
referencedColumnNames=
"CAMPAIGNID"
referencedTableName=
"CAMPAIGN"
validate=
"true"
/>
</changeSet>
<changeSet
author=
"a_LAB01_e85d8801c"
id=
"fk-opportunity-1
07
-416"
>
<changeSet
author=
"a_LAB01_e85d8801c"
id=
"fk-opportunity-1
11
-416"
>
<addForeignKeyConstraint
baseColumnNames=
"PARENTCONTACTID"
baseTableName=
"OPPORTUNITY"
constraintName=
"DER1N_OPPORTUNITY__CONTACT__PA"
deferrable=
"false"
initiallyDeferred=
"false"
onDelete=
"RESTRICT"
onUpdate=
"RESTRICT"
referencedColumnNames=
"CONTACTID"
referencedTableName=
"CONTACT"
validate=
"true"
/>
</changeSet>
<changeSet
author=
"a_LAB01_e85d8801c"
id=
"fk-opportunity-1
07
-417"
>
<changeSet
author=
"a_LAB01_e85d8801c"
id=
"fk-opportunity-1
11
-417"
>
<addForeignKeyConstraint
baseColumnNames=
"ORIGINATINGLEADID"
baseTableName=
"OPPORTUNITY"
constraintName=
"DER1N_OPPORTUNITY__LEAD__ORIGI"
deferrable=
"false"
initiallyDeferred=
"false"
onDelete=
"RESTRICT"
onUpdate=
"RESTRICT"
referencedColumnNames=
"LEADID"
referencedTableName=
"LEAD"
validate=
"true"
/>
</changeSet>
<changeSet
author=
"a_LAB01_e85d8801c"
id=
"fk-opportunity-1
07
-418"
>
<changeSet
author=
"a_LAB01_e85d8801c"
id=
"fk-opportunity-1
11
-418"
>
<addForeignKeyConstraint
baseColumnNames=
"PRICELEVELID"
baseTableName=
"OPPORTUNITY"
constraintName=
"DER1N_OPPORTUNITY__PRICELEVEL_"
deferrable=
"false"
initiallyDeferred=
"false"
onDelete=
"RESTRICT"
onUpdate=
"RESTRICT"
referencedColumnNames=
"PRICELEVELID"
referencedTableName=
"PRICELEVEL"
validate=
"true"
/>
</changeSet>
<changeSet
author=
"a_LAB01_e85d8801c"
id=
"fk-opportunity-1
07
-419"
>
<changeSet
author=
"a_LAB01_e85d8801c"
id=
"fk-opportunity-1
11
-419"
>
<addForeignKeyConstraint
baseColumnNames=
"SLAID"
baseTableName=
"OPPORTUNITY"
constraintName=
"DER1N_OPPORTUNITY__SLA__SLAID"
deferrable=
"false"
initiallyDeferred=
"false"
onDelete=
"RESTRICT"
onUpdate=
"RESTRICT"
referencedColumnNames=
"SLAID"
referencedTableName=
"SLA"
validate=
"true"
/>
</changeSet>
<changeSet
author=
"a_LAB01_e85d8801c"
id=
"fk-opportunity-1
07
-420"
>
<changeSet
author=
"a_LAB01_e85d8801c"
id=
"fk-opportunity-1
11
-420"
>
<addForeignKeyConstraint
baseColumnNames=
"TRANSACTIONCURRENCYID"
baseTableName=
"OPPORTUNITY"
constraintName=
"DER1N_OPPORTUNITY__TRANSACTION"
deferrable=
"false"
initiallyDeferred=
"false"
onDelete=
"RESTRICT"
onUpdate=
"RESTRICT"
referencedColumnNames=
"TRANSACTIONCURRENCYID"
referencedTableName=
"TRANSACTIONCURRENCY"
validate=
"true"
/>
</changeSet>
<!--输出实体[OPPORTUNITYCOMPETITOR]外键关系 -->
...
...
businesscentral-core/src/main/resources/mapper/sales/opportunity/OpportunityMapper.xml
浏览文件 @
60d9e01e
...
...
@@ -99,6 +99,15 @@
where transactioncurrencyid=#{transactioncurrencyid}
</select>
<!--数据集合[Top5]-->
<select
id=
"searchTop5"
parameterType=
"cn.ibizlab.businesscentral.core.sales.filter.OpportunitySearchContext"
resultMap=
"OpportunityResultMap"
>
select t1.* from (
<include
refid=
"Top5"
/>
)t1
<where><if
test=
"ew!=null and ew.sqlSegment!=null and !ew.emptyOfWhere"
>
${ew.sqlSegment}
</if></where>
<if
test=
"ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere"
>
${ew.sqlSegment}
</if>
</select>
<!--数据集合[Default]-->
<select
id=
"searchDefault"
parameterType=
"cn.ibizlab.businesscentral.core.sales.filter.OpportunitySearchContext"
resultMap=
"OpportunityResultMap"
>
select t1.* from (
...
...
@@ -113,6 +122,11 @@
<![CDATA[ SELECT t1.`ACCOUNTIDYOMINAME`, t1.`ACTUALCLOSEDATE`, t1.`ACTUALVALUE`, t1.`ACTUALVALUE_BASE`, t1.`BUDGETAMOUNT`, t1.`BUDGETAMOUNT_BASE`, t1.`BUDGETSTATUS`, t1.`CAMPAIGNID`, t1.`CAMPAIGNNAME`, t1.`CAPTUREPROPOSALFEEDBACK`, t1.`CLOSEPROBABILITY`, t1.`COMPLETEFINALPROPOSAL`, t1.`COMPLETEINTERNALREVIEW`, t1.`CONFIRMINTEREST`, t1.`CONTACTIDYOMINAME`, t1.`CREATEDATE`, t1.`CREATEMAN`, t1.`CURRENTSITUATION`, t1.`CUSTOMERID`, t1.`CUSTOMERIDTYPE`, t1.`CUSTOMERIDYOMINAME`, t1.`CUSTOMERNEED`, t1.`CUSTOMERPAINPOINTS`, t1.`DECISIONMAKER`, t1.`DESCRIPTION`, t1.`DEVELOPPROPOSAL`, t1.`DISCOUNTAMOUNT`, t1.`DISCOUNTAMOUNT_BASE`, t1.`DISCOUNTPERCENTAGE`, t1.`EMAILADDRESS`, t1.`ESTIMATEDCLOSEDATE`, t1.`ESTIMATEDVALUE`, t1.`ESTIMATEDVALUE_BASE`, t1.`EVALUATEFIT`, t1.`EXCHANGERATE`, t1.`FILEDEBRIEF`, t1.`FINALDECISIONDATE`, t1.`FREIGHTAMOUNT`, t1.`FREIGHTAMOUNT_BASE`, t1.`IDENTIFYCOMPETITORS`, t1.`IDENTIFYCUSTOMERCONTACTS`, t1.`IDENTIFYPURSUITTEAM`, t1.`IMPORTSEQUENCENUMBER`, t1.`INITIALCOMMUNICATION`, t1.`LASTONHOLDTIME`, t1.`NEED`, t1.`ONHOLDTIME`, t1.`OPPORTUNITYID`, t1.`OPPORTUNITYNAME`, t1.`OPPORTUNITYRATINGCODE`, t1.`ORIGINATINGLEADID`, t1.`ORIGINATINGLEADNAME`, t1.`OVERRIDDENCREATEDON`, t1.`OWNERID`, t1.`OWNERIDTYPE`, t1.`OWNERIDYOMINAME`, t1.`PARENTACCOUNTID`, t1.`PARENTACCOUNTNAME`, t1.`PARENTCONTACTID`, t1.`PARENTCONTACTNAME`, t1.`PARTICIPATESINWORKFLOW`, t1.`PRESENTFINALPROPOSAL`, t1.`PRESENTPROPOSAL`, t1.`PRICELEVELID`, t1.`PRICELEVELNAME`, t1.`PRICINGERRORCODE`, t1.`PRIORITYCODE`, t1.`PRIVATE`, t1.`PROCESSID`, t1.`PROPOSEDSOLUTION`, t1.`PURCHASEPROCESS`, t1.`PURCHASETIMEFRAME`, t1.`PURSUITDECISION`, t1.`QUALIFICATIONCOMMENTS`, t1.`QUOTECOMMENTS`, t1.`RESOLVEFEEDBACK`, t1.`REVENUESYSTEMCALCULATED`, t1.`SALESSTAGE`, t1.`SALESSTAGECODE`, t1.`SCHEDULEFOLLOWUP_PROSPECT`, t1.`SCHEDULEFOLLOWUP_QUALIFY`, t1.`SCHEDULEPROPOSALMEETING`, t1.`SENDTHANKYOUNOTE`, t1.`SLAID`, t1.`SLANAME`, t1.`STAGEID`, t1.`STATECODE`, t1.`STATUSCODE`, t1.`STEPID`, t1.`STEPNAME`, t1.`TEAMSFOLLOWED`, t1.`TIMELINE`, t1.`TIMEZONERULEVERSIONNUMBER`, t1.`TOTALAMOUNT`, t1.`TOTALAMOUNTLESSFREIGHT`, t1.`TOTALAMOUNTLESSFREIGHT_BASE`, t1.`TOTALAMOUNT_BASE`, t1.`TOTALDISCOUNTAMOUNT`, t1.`TOTALDISCOUNTAMOUNT_BASE`, t1.`TOTALLINEITEMAMOUNT`, t1.`TOTALLINEITEMAMOUNT_BASE`, t1.`TOTALLINEITEMDISCOUNTAMOUNT`, t1.`TOTALTAX`, t1.`TOTALTAX_BASE`, t1.`TRANSACTIONCURRENCYID`, t1.`TRANSACTIONCURRENCYNAME`, t1.`TRAVERSEDPATH`, t1.`UPDATEDATE`, t1.`UPDATEMAN`, t1.`UTCCONVERSIONTIMEZONECODE`, t1.`VERSIONNUMBER` FROM `OPPORTUNITY` t1
]]>
</sql>
<!--数据查询[Top5]-->
<sql
id=
"Top5"
databaseId=
"mysql"
>
<![CDATA[ SELECT t1.`ACCOUNTIDYOMINAME`, t1.`ACTUALCLOSEDATE`, t1.`ACTUALVALUE`, t1.`ACTUALVALUE_BASE`, t1.`BUDGETAMOUNT`, t1.`BUDGETAMOUNT_BASE`, t1.`BUDGETSTATUS`, t1.`CAMPAIGNID`, t1.`CAMPAIGNNAME`, t1.`CAPTUREPROPOSALFEEDBACK`, t1.`CLOSEPROBABILITY`, t1.`COMPLETEFINALPROPOSAL`, t1.`COMPLETEINTERNALREVIEW`, t1.`CONFIRMINTEREST`, t1.`CONTACTIDYOMINAME`, t1.`CREATEDATE`, t1.`CREATEMAN`, t1.`CURRENTSITUATION`, t1.`CUSTOMERID`, t1.`CUSTOMERIDTYPE`, t1.`CUSTOMERIDYOMINAME`, t1.`CUSTOMERNEED`, t1.`CUSTOMERPAINPOINTS`, t1.`DECISIONMAKER`, t1.`DESCRIPTION`, t1.`DEVELOPPROPOSAL`, t1.`DISCOUNTAMOUNT`, t1.`DISCOUNTAMOUNT_BASE`, t1.`DISCOUNTPERCENTAGE`, t1.`EMAILADDRESS`, t1.`ESTIMATEDCLOSEDATE`, t1.`ESTIMATEDVALUE`, t1.`ESTIMATEDVALUE_BASE`, t1.`EVALUATEFIT`, t1.`EXCHANGERATE`, t1.`FILEDEBRIEF`, t1.`FINALDECISIONDATE`, t1.`FREIGHTAMOUNT`, t1.`FREIGHTAMOUNT_BASE`, t1.`IDENTIFYCOMPETITORS`, t1.`IDENTIFYCUSTOMERCONTACTS`, t1.`IDENTIFYPURSUITTEAM`, t1.`IMPORTSEQUENCENUMBER`, t1.`INITIALCOMMUNICATION`, t1.`LASTONHOLDTIME`, t1.`NEED`, t1.`ONHOLDTIME`, t1.`OPPORTUNITYID`, t1.`OPPORTUNITYNAME`, t1.`OPPORTUNITYRATINGCODE`, t1.`ORIGINATINGLEADID`, t1.`ORIGINATINGLEADNAME`, t1.`OVERRIDDENCREATEDON`, t1.`OWNERID`, t1.`OWNERIDTYPE`, t1.`OWNERIDYOMINAME`, t1.`PARENTACCOUNTID`, t1.`PARENTACCOUNTNAME`, t1.`PARENTCONTACTID`, t1.`PARENTCONTACTNAME`, t1.`PARTICIPATESINWORKFLOW`, t1.`PRESENTFINALPROPOSAL`, t1.`PRESENTPROPOSAL`, t1.`PRICELEVELID`, t1.`PRICELEVELNAME`, t1.`PRICINGERRORCODE`, t1.`PRIORITYCODE`, t1.`PRIVATE`, t1.`PROCESSID`, t1.`PROPOSEDSOLUTION`, t1.`PURCHASEPROCESS`, t1.`PURCHASETIMEFRAME`, t1.`PURSUITDECISION`, t1.`QUALIFICATIONCOMMENTS`, t1.`QUOTECOMMENTS`, t1.`RESOLVEFEEDBACK`, t1.`REVENUESYSTEMCALCULATED`, t1.`SALESSTAGE`, t1.`SALESSTAGECODE`, t1.`SCHEDULEFOLLOWUP_PROSPECT`, t1.`SCHEDULEFOLLOWUP_QUALIFY`, t1.`SCHEDULEPROPOSALMEETING`, t1.`SENDTHANKYOUNOTE`, t1.`SLAID`, t1.`SLANAME`, t1.`STAGEID`, t1.`STATECODE`, t1.`STATUSCODE`, t1.`STEPID`, t1.`STEPNAME`, t1.`TEAMSFOLLOWED`, t1.`TIMELINE`, t1.`TIMEZONERULEVERSIONNUMBER`, t1.`TOTALAMOUNT`, t1.`TOTALAMOUNTLESSFREIGHT`, t1.`TOTALAMOUNTLESSFREIGHT_BASE`, t1.`TOTALAMOUNT_BASE`, t1.`TOTALDISCOUNTAMOUNT`, t1.`TOTALDISCOUNTAMOUNT_BASE`, t1.`TOTALLINEITEMAMOUNT`, t1.`TOTALLINEITEMAMOUNT_BASE`, t1.`TOTALLINEITEMDISCOUNTAMOUNT`, t1.`TOTALTAX`, t1.`TOTALTAX_BASE`, t1.`TRANSACTIONCURRENCYID`, t1.`TRANSACTIONCURRENCYNAME`, t1.`TRAVERSEDPATH`, t1.`UPDATEDATE`, t1.`UPDATEMAN`, t1.`UTCCONVERSIONTIMEZONECODE`, t1.`VERSIONNUMBER` FROM `OPPORTUNITY` t1
]]>
</sql>
<!--数据查询[View]-->
<sql
id=
"View"
databaseId=
"mysql"
>
<![CDATA[ SELECT t1.`ACCOUNTIDYOMINAME`, t1.`ACTUALCLOSEDATE`, t1.`ACTUALVALUE`, t1.`ACTUALVALUE_BASE`, t1.`BUDGETAMOUNT`, t1.`BUDGETAMOUNT_BASE`, t1.`BUDGETSTATUS`, t1.`CAMPAIGNID`, t1.`CAMPAIGNNAME`, t1.`CAPTUREPROPOSALFEEDBACK`, t1.`CLOSEPROBABILITY`, t1.`COMPLETEFINALPROPOSAL`, t1.`COMPLETEINTERNALREVIEW`, t1.`CONFIRMINTEREST`, t1.`CONTACTIDYOMINAME`, t1.`CREATEDATE`, t1.`CREATEMAN`, t1.`CURRENTSITUATION`, t1.`CUSTOMERID`, t1.`CUSTOMERIDTYPE`, t1.`CUSTOMERIDYOMINAME`, t1.`CUSTOMERNEED`, t1.`CUSTOMERPAINPOINTS`, t1.`DECISIONMAKER`, t1.`DESCRIPTION`, t1.`DEVELOPPROPOSAL`, t1.`DISCOUNTAMOUNT`, t1.`DISCOUNTAMOUNT_BASE`, t1.`DISCOUNTPERCENTAGE`, t1.`EMAILADDRESS`, t1.`ESTIMATEDCLOSEDATE`, t1.`ESTIMATEDVALUE`, t1.`ESTIMATEDVALUE_BASE`, t1.`EVALUATEFIT`, t1.`EXCHANGERATE`, t1.`FILEDEBRIEF`, t1.`FINALDECISIONDATE`, t1.`FREIGHTAMOUNT`, t1.`FREIGHTAMOUNT_BASE`, t1.`IDENTIFYCOMPETITORS`, t1.`IDENTIFYCUSTOMERCONTACTS`, t1.`IDENTIFYPURSUITTEAM`, t1.`IMPORTSEQUENCENUMBER`, t1.`INITIALCOMMUNICATION`, t1.`LASTONHOLDTIME`, t1.`NEED`, t1.`ONHOLDTIME`, t1.`OPPORTUNITYID`, t1.`OPPORTUNITYNAME`, t1.`OPPORTUNITYRATINGCODE`, t1.`ORIGINATINGLEADID`, t1.`ORIGINATINGLEADNAME`, t1.`OVERRIDDENCREATEDON`, t1.`OWNERID`, t1.`OWNERIDTYPE`, t1.`OWNERIDYOMINAME`, t1.`PARENTACCOUNTID`, t1.`PARENTACCOUNTNAME`, t1.`PARENTCONTACTID`, t1.`PARENTCONTACTNAME`, t1.`PARTICIPATESINWORKFLOW`, t1.`PRESENTFINALPROPOSAL`, t1.`PRESENTPROPOSAL`, t1.`PRICELEVELID`, t1.`PRICELEVELNAME`, t1.`PRICINGERRORCODE`, t1.`PRIORITYCODE`, t1.`PRIVATE`, t1.`PROCESSID`, t1.`PROPOSEDSOLUTION`, t1.`PURCHASEPROCESS`, t1.`PURCHASETIMEFRAME`, t1.`PURSUITDECISION`, t1.`QUALIFICATIONCOMMENTS`, t1.`QUOTECOMMENTS`, t1.`RESOLVEFEEDBACK`, t1.`REVENUESYSTEMCALCULATED`, t1.`SALESSTAGE`, t1.`SALESSTAGECODE`, t1.`SCHEDULEFOLLOWUP_PROSPECT`, t1.`SCHEDULEFOLLOWUP_QUALIFY`, t1.`SCHEDULEPROPOSALMEETING`, t1.`SENDTHANKYOUNOTE`, t1.`SLAID`, t1.`SLANAME`, t1.`STAGEID`, t1.`STATECODE`, t1.`STATUSCODE`, t1.`STEPID`, t1.`STEPNAME`, t1.`TEAMSFOLLOWED`, t1.`TIMELINE`, t1.`TIMEZONERULEVERSIONNUMBER`, t1.`TOTALAMOUNT`, t1.`TOTALAMOUNTLESSFREIGHT`, t1.`TOTALAMOUNTLESSFREIGHT_BASE`, t1.`TOTALAMOUNT_BASE`, t1.`TOTALDISCOUNTAMOUNT`, t1.`TOTALDISCOUNTAMOUNT_BASE`, t1.`TOTALLINEITEMAMOUNT`, t1.`TOTALLINEITEMAMOUNT_BASE`, t1.`TOTALLINEITEMDISCOUNTAMOUNT`, t1.`TOTALTAX`, t1.`TOTALTAX_BASE`, t1.`TRANSACTIONCURRENCYID`, t1.`TRANSACTIONCURRENCYNAME`, t1.`TRAVERSEDPATH`, t1.`UPDATEDATE`, t1.`UPDATEMAN`, t1.`UTCCONVERSIONTIMEZONECODE`, t1.`VERSIONNUMBER` FROM `OPPORTUNITY` t1
...
...
businesscentral-core/src/main/resources/permission/systemResource.json
浏览文件 @
60d9e01e
...
...
@@ -87,7 +87,7 @@
"dename"
:
"Opportunity"
,
"delogicname"
:
"商机"
,
"sysmoudle"
:{
"id"
:
"SALES"
,
"name"
:
"Sales"
},
"dedataset"
:[{
"id"
:
"Default"
,
"name"
:
"DEFAULT"
}],
"dedataset"
:[{
"id"
:
"
Top5"
,
"name"
:
"Top5"
},{
"id"
:
"
Default"
,
"name"
:
"DEFAULT"
}],
"deaction"
:[{
"id"
:
"Win"
,
"name"
:
"作为赢单"
,
"type"
:
"USERCUSTOM"
},{
"id"
:
"Lose"
,
"name"
:
"作为弃单"
,
"type"
:
"USERCUSTOM"
},{
"id"
:
"Get"
,
"name"
:
"Get"
,
"type"
:
"BUILTIN"
},{
"id"
:
"GetDraft"
,
"name"
:
"GetDraft"
,
"type"
:
"BUILTIN"
},{
"id"
:
"Create"
,
"name"
:
"Create"
,
"type"
:
"BUILTIN"
},{
"id"
:
"Remove"
,
"name"
:
"Remove"
,
"type"
:
"BUILTIN"
},{
"id"
:
"Update"
,
"name"
:
"Update"
,
"type"
:
"BUILTIN"
},{
"id"
:
"CheckKey"
,
"name"
:
"CheckKey"
,
"type"
:
"BUILTIN"
},{
"id"
:
"Save"
,
"name"
:
"Save"
,
"type"
:
"BUILTIN"
}],
"datascope"
:[{
"id"
:
"all"
,
"name"
:
"全部数据"
},
{
"id"
:
"createman"
,
"name"
:
"创建人"
}]
}
...
...
@@ -260,6 +260,14 @@
"datascope"
:[{
"id"
:
"all"
,
"name"
:
"全部数据"
},
{
"id"
:
"createman"
,
"name"
:
"创建人"
}]
}
,
{
"dename"
:
"CompetitorSalesLiterature"
,
"delogicname"
:
"竞争对手宣传资料"
,
"sysmoudle"
:{
"id"
:
"SALES"
,
"name"
:
"Sales"
},
"dedataset"
:[{
"id"
:
"Default"
,
"name"
:
"DEFAULT"
}],
"deaction"
:[{
"id"
:
"CheckKey"
,
"name"
:
"CheckKey"
,
"type"
:
"BUILTIN"
},{
"id"
:
"Update"
,
"name"
:
"Update"
,
"type"
:
"BUILTIN"
},{
"id"
:
"Get"
,
"name"
:
"Get"
,
"type"
:
"BUILTIN"
},{
"id"
:
"Remove"
,
"name"
:
"Remove"
,
"type"
:
"BUILTIN"
},{
"id"
:
"Create"
,
"name"
:
"Create"
,
"type"
:
"BUILTIN"
},{
"id"
:
"Save"
,
"name"
:
"Save"
,
"type"
:
"BUILTIN"
},{
"id"
:
"GetDraft"
,
"name"
:
"GetDraft"
,
"type"
:
"BUILTIN"
}],
"datascope"
:[{
"id"
:
"all"
,
"name"
:
"全部数据"
},
{
"id"
:
"createman"
,
"name"
:
"创建人"
}]
}
,
{
"dename"
:
"SalesLiteratureItem"
,
"delogicname"
:
"销售附件"
,
"sysmoudle"
:{
"id"
:
"SALES"
,
"name"
:
"Sales"
},
...
...
businesscentral-provider/businesscentral-provider-centralapi/src/main/java/cn/ibizlab/businesscentral/centralapi/dto/CompetitorSalesLiteratureDTO.java
0 → 100644
浏览文件 @
60d9e01e
package
cn
.
ibizlab
.
businesscentral
.
centralapi
.
dto
;
import
java.sql.Timestamp
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.math.BigInteger
;
import
java.util.Map
;
import
java.util.HashMap
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
cn.ibizlab.businesscentral.util.domain.DTOBase
;
import
lombok.Data
;
/**
* 服务DTO对象[CompetitorSalesLiteratureDTO]
*/
@Data
public
class
CompetitorSalesLiteratureDTO
extends
DTOBase
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 属性 [CREATEDATE]
*
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
locale
=
"zh"
,
timezone
=
"GMT+8"
)
@JSONField
(
name
=
"createdate"
,
format
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonProperty
(
"createdate"
)
private
Timestamp
createdate
;
/**
* 属性 [CREATEMAN]
*
*/
@JSONField
(
name
=
"createman"
)
@JsonProperty
(
"createman"
)
private
String
createman
;
/**
* 属性 [RELATIONSHIPSID]
*
*/
@JSONField
(
name
=
"relationshipsid"
)
@JsonProperty
(
"relationshipsid"
)
private
String
relationshipsid
;
/**
* 属性 [RELATIONSHIPSNAME]
*
*/
@JSONField
(
name
=
"relationshipsname"
)
@JsonProperty
(
"relationshipsname"
)
private
String
relationshipsname
;
/**
* 属性 [RELATIONSHIPSTYPE]
*
*/
@JSONField
(
name
=
"relationshipstype"
)
@JsonProperty
(
"relationshipstype"
)
private
String
relationshipstype
;
/**
* 属性 [UPDATEDATE]
*
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
locale
=
"zh"
,
timezone
=
"GMT+8"
)
@JSONField
(
name
=
"updatedate"
,
format
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonProperty
(
"updatedate"
)
private
Timestamp
updatedate
;
/**
* 属性 [UPDATEMAN]
*
*/
@JSONField
(
name
=
"updateman"
)
@JsonProperty
(
"updateman"
)
private
String
updateman
;
/**
* 属性 [ENTITYID]
*
*/
@JSONField
(
name
=
"entityid"
)
@JsonProperty
(
"entityid"
)
private
String
entityid
;
/**
* 属性 [ENTITY2ID]
*
*/
@JSONField
(
name
=
"entity2id"
)
@JsonProperty
(
"entity2id"
)
private
String
entity2id
;
/**
* 属性 [ENTITYNAME]
*
*/
@JSONField
(
name
=
"entityname"
)
@JsonProperty
(
"entityname"
)
private
String
entityname
;
/**
* 属性 [ENTITY2NAME]
*
*/
@JSONField
(
name
=
"entity2name"
)
@JsonProperty
(
"entity2name"
)
private
String
entity2name
;
/**
* 设置 [RELATIONSHIPSNAME]
*/
public
void
setRelationshipsname
(
String
relationshipsname
){
this
.
relationshipsname
=
relationshipsname
;
this
.
modify
(
"relationshipsname"
,
relationshipsname
);
}
/**
* 设置 [RELATIONSHIPSTYPE]
*/
public
void
setRelationshipstype
(
String
relationshipstype
){
this
.
relationshipstype
=
relationshipstype
;
this
.
modify
(
"relationshipstype"
,
relationshipstype
);
}
/**
* 设置 [ENTITYID]
*/
public
void
setEntityid
(
String
entityid
){
this
.
entityid
=
entityid
;
this
.
modify
(
"entityid"
,
entityid
);
}
/**
* 设置 [ENTITY2ID]
*/
public
void
setEntity2id
(
String
entity2id
){
this
.
entity2id
=
entity2id
;
this
.
modify
(
"entity2id"
,
entity2id
);
}
/**
* 设置 [ENTITYNAME]
*/
public
void
setEntityname
(
String
entityname
){
this
.
entityname
=
entityname
;
this
.
modify
(
"entityname"
,
entityname
);
}
/**
* 设置 [ENTITY2NAME]
*/
public
void
setEntity2name
(
String
entity2name
){
this
.
entity2name
=
entity2name
;
this
.
modify
(
"entity2name"
,
entity2name
);
}
}
businesscentral-provider/businesscentral-provider-centralapi/src/main/java/cn/ibizlab/businesscentral/centralapi/mapping/CompetitorSalesLiteratureMapping.java
0 → 100644
浏览文件 @
60d9e01e
package
cn
.
ibizlab
.
businesscentral
.
centralapi
.
mapping
;
import
org.mapstruct.*
;
import
cn.ibizlab.businesscentral.core.sales.domain.CompetitorSalesLiterature
;
import
cn.ibizlab.businesscentral.centralapi.dto.CompetitorSalesLiteratureDTO
;
import
cn.ibizlab.businesscentral.util.domain.MappingBase
;
import
org.mapstruct.factory.Mappers
;
@Mapper
(
componentModel
=
"spring"
,
uses
=
{},
nullValuePropertyMappingStrategy
=
NullValuePropertyMappingStrategy
.
IGNORE
,
nullValueCheckStrategy
=
NullValueCheckStrategy
.
ALWAYS
)
public
interface
CompetitorSalesLiteratureMapping
extends
MappingBase
<
CompetitorSalesLiteratureDTO
,
CompetitorSalesLiterature
>
{
}
businesscentral-provider/businesscentral-provider-centralapi/src/main/java/cn/ibizlab/businesscentral/centralapi/rest/CompetitorSalesLiteratureResource.java
0 → 100644
浏览文件 @
60d9e01e
package
cn
.
ibizlab
.
businesscentral
.
centralapi
.
rest
;
import
java.sql.Timestamp
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.math.BigInteger
;
import
java.util.HashMap
;
import
lombok.extern.slf4j.Slf4j
;
import
com.alibaba.fastjson.JSONObject
;
import
javax.servlet.ServletRequest
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cglib.beans.BeanCopier
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageImpl
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.util.StringUtils
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PostAuthorize
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiResponse
;
import
io.swagger.annotations.ApiResponses
;
import
cn.ibizlab.businesscentral.centralapi.dto.*
;
import
cn.ibizlab.businesscentral.centralapi.mapping.*
;
import
cn.ibizlab.businesscentral.core.sales.domain.CompetitorSalesLiterature
;
import
cn.ibizlab.businesscentral.core.sales.service.ICompetitorSalesLiteratureService
;
import
cn.ibizlab.businesscentral.core.sales.filter.CompetitorSalesLiteratureSearchContext
;
import
cn.ibizlab.businesscentral.util.annotation.VersionCheck
;
@Slf4j
@Api
(
tags
=
{
"竞争对手宣传资料"
})
@RestController
(
"CentralApi-competitorsalesliterature"
)
@RequestMapping
(
""
)
public
class
CompetitorSalesLiteratureResource
{
@Autowired
public
ICompetitorSalesLiteratureService
competitorsalesliteratureService
;
@Autowired
@Lazy
public
CompetitorSalesLiteratureMapping
competitorsalesliteratureMapping
;
@ApiOperation
(
value
=
"检查竞争对手宣传资料"
,
tags
=
{
"竞争对手宣传资料"
},
notes
=
"检查竞争对手宣传资料"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/competitorsalesliteratures/checkkey"
)
public
ResponseEntity
<
Boolean
>
checkKey
(
@RequestBody
CompetitorSalesLiteratureDTO
competitorsalesliteraturedto
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
competitorsalesliteratureService
.
checkKey
(
competitorsalesliteratureMapping
.
toDomain
(
competitorsalesliteraturedto
)));
}
@VersionCheck
(
entity
=
"competitorsalesliterature"
,
versionfield
=
"updatedate"
)
@PreAuthorize
(
"hasPermission(this.competitorsalesliteratureService.get(#competitorsalesliterature_id),'iBizBusinessCentral-CompetitorSalesLiterature-Update')"
)
@ApiOperation
(
value
=
"更新竞争对手宣传资料"
,
tags
=
{
"竞争对手宣传资料"
},
notes
=
"更新竞争对手宣传资料"
)
@RequestMapping
(
method
=
RequestMethod
.
PUT
,
value
=
"/competitorsalesliteratures/{competitorsalesliterature_id}"
)
@Transactional
public
ResponseEntity
<
CompetitorSalesLiteratureDTO
>
update
(
@PathVariable
(
"competitorsalesliterature_id"
)
String
competitorsalesliterature_id
,
@RequestBody
CompetitorSalesLiteratureDTO
competitorsalesliteraturedto
)
{
CompetitorSalesLiterature
domain
=
competitorsalesliteratureMapping
.
toDomain
(
competitorsalesliteraturedto
);
domain
.
setRelationshipsid
(
competitorsalesliterature_id
);
competitorsalesliteratureService
.
update
(
domain
);
CompetitorSalesLiteratureDTO
dto
=
competitorsalesliteratureMapping
.
toDto
(
domain
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dto
);
}
@PreAuthorize
(
"hasPermission(this.competitorsalesliteratureService.getCompetitorsalesliteratureByEntities(this.competitorsalesliteratureMapping.toDomain(#competitorsalesliteraturedtos)),'iBizBusinessCentral-CompetitorSalesLiterature-Update')"
)
@ApiOperation
(
value
=
"批量更新竞争对手宣传资料"
,
tags
=
{
"竞争对手宣传资料"
},
notes
=
"批量更新竞争对手宣传资料"
)
@RequestMapping
(
method
=
RequestMethod
.
PUT
,
value
=
"/competitorsalesliteratures/batch"
)
public
ResponseEntity
<
Boolean
>
updateBatch
(
@RequestBody
List
<
CompetitorSalesLiteratureDTO
>
competitorsalesliteraturedtos
)
{
competitorsalesliteratureService
.
updateBatch
(
competitorsalesliteratureMapping
.
toDomain
(
competitorsalesliteraturedtos
));
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
}
@PostAuthorize
(
"hasPermission(this.competitorsalesliteratureMapping.toDomain(returnObject.body),'iBizBusinessCentral-CompetitorSalesLiterature-Get')"
)
@ApiOperation
(
value
=
"获取竞争对手宣传资料"
,
tags
=
{
"竞争对手宣传资料"
},
notes
=
"获取竞争对手宣传资料"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/competitorsalesliteratures/{competitorsalesliterature_id}"
)
public
ResponseEntity
<
CompetitorSalesLiteratureDTO
>
get
(
@PathVariable
(
"competitorsalesliterature_id"
)
String
competitorsalesliterature_id
)
{
CompetitorSalesLiterature
domain
=
competitorsalesliteratureService
.
get
(
competitorsalesliterature_id
);
CompetitorSalesLiteratureDTO
dto
=
competitorsalesliteratureMapping
.
toDto
(
domain
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dto
);
}
@PreAuthorize
(
"hasPermission(this.competitorsalesliteratureService.get(#competitorsalesliterature_id),'iBizBusinessCentral-CompetitorSalesLiterature-Remove')"
)
@ApiOperation
(
value
=
"删除竞争对手宣传资料"
,
tags
=
{
"竞争对手宣传资料"
},
notes
=
"删除竞争对手宣传资料"
)
@RequestMapping
(
method
=
RequestMethod
.
DELETE
,
value
=
"/competitorsalesliteratures/{competitorsalesliterature_id}"
)
@Transactional
public
ResponseEntity
<
Boolean
>
remove
(
@PathVariable
(
"competitorsalesliterature_id"
)
String
competitorsalesliterature_id
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
competitorsalesliteratureService
.
remove
(
competitorsalesliterature_id
));
}
@PreAuthorize
(
"hasPermission(this.competitorsalesliteratureService.getCompetitorsalesliteratureByIds(#ids),'iBizBusinessCentral-CompetitorSalesLiterature-Remove')"
)
@ApiOperation
(
value
=
"批量删除竞争对手宣传资料"
,
tags
=
{
"竞争对手宣传资料"
},
notes
=
"批量删除竞争对手宣传资料"
)
@RequestMapping
(
method
=
RequestMethod
.
DELETE
,
value
=
"/competitorsalesliteratures/batch"
)
public
ResponseEntity
<
Boolean
>
removeBatch
(
@RequestBody
List
<
String
>
ids
)
{
competitorsalesliteratureService
.
removeBatch
(
ids
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
}
@PreAuthorize
(
"hasPermission(this.competitorsalesliteratureMapping.toDomain(#competitorsalesliteraturedto),'iBizBusinessCentral-CompetitorSalesLiterature-Create')"
)
@ApiOperation
(
value
=
"新建竞争对手宣传资料"
,
tags
=
{
"竞争对手宣传资料"
},
notes
=
"新建竞争对手宣传资料"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/competitorsalesliteratures"
)
@Transactional
public
ResponseEntity
<
CompetitorSalesLiteratureDTO
>
create
(
@RequestBody
CompetitorSalesLiteratureDTO
competitorsalesliteraturedto
)
{
CompetitorSalesLiterature
domain
=
competitorsalesliteratureMapping
.
toDomain
(
competitorsalesliteraturedto
);
competitorsalesliteratureService
.
create
(
domain
);
CompetitorSalesLiteratureDTO
dto
=
competitorsalesliteratureMapping
.
toDto
(
domain
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dto
);
}
@PreAuthorize
(
"hasPermission(this.competitorsalesliteratureMapping.toDomain(#competitorsalesliteraturedtos),'iBizBusinessCentral-CompetitorSalesLiterature-Create')"
)
@ApiOperation
(
value
=
"批量新建竞争对手宣传资料"
,
tags
=
{
"竞争对手宣传资料"
},
notes
=
"批量新建竞争对手宣传资料"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/competitorsalesliteratures/batch"
)
public
ResponseEntity
<
Boolean
>
createBatch
(
@RequestBody
List
<
CompetitorSalesLiteratureDTO
>
competitorsalesliteraturedtos
)
{
competitorsalesliteratureService
.
createBatch
(
competitorsalesliteratureMapping
.
toDomain
(
competitorsalesliteraturedtos
));
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
}
@PreAuthorize
(
"hasPermission(this.competitorsalesliteratureMapping.toDomain(#competitorsalesliteraturedto),'iBizBusinessCentral-CompetitorSalesLiterature-Save')"
)
@ApiOperation
(
value
=
"保存竞争对手宣传资料"
,
tags
=
{
"竞争对手宣传资料"
},
notes
=
"保存竞争对手宣传资料"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/competitorsalesliteratures/save"
)
public
ResponseEntity
<
Boolean
>
save
(
@RequestBody
CompetitorSalesLiteratureDTO
competitorsalesliteraturedto
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
competitorsalesliteratureService
.
save
(
competitorsalesliteratureMapping
.
toDomain
(
competitorsalesliteraturedto
)));
}
@PreAuthorize
(
"hasPermission(this.competitorsalesliteratureMapping.toDomain(#competitorsalesliteraturedtos),'iBizBusinessCentral-CompetitorSalesLiterature-Save')"
)
@ApiOperation
(
value
=
"批量保存竞争对手宣传资料"
,
tags
=
{
"竞争对手宣传资料"
},
notes
=
"批量保存竞争对手宣传资料"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/competitorsalesliteratures/savebatch"
)
public
ResponseEntity
<
Boolean
>
saveBatch
(
@RequestBody
List
<
CompetitorSalesLiteratureDTO
>
competitorsalesliteraturedtos
)
{
competitorsalesliteratureService
.
saveBatch
(
competitorsalesliteratureMapping
.
toDomain
(
competitorsalesliteraturedtos
));
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
}
@ApiOperation
(
value
=
"获取竞争对手宣传资料草稿"
,
tags
=
{
"竞争对手宣传资料"
},
notes
=
"获取竞争对手宣传资料草稿"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/competitorsalesliteratures/getdraft"
)
public
ResponseEntity
<
CompetitorSalesLiteratureDTO
>
getDraft
()
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
competitorsalesliteratureMapping
.
toDto
(
competitorsalesliteratureService
.
getDraft
(
new
CompetitorSalesLiterature
())));
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-CompetitorSalesLiterature-searchDefault-all')"
)
@ApiOperation
(
value
=
"获取DEFAULT"
,
tags
=
{
"竞争对手宣传资料"
}
,
notes
=
"获取DEFAULT"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/competitorsalesliteratures/fetchdefault"
)
public
ResponseEntity
<
List
<
CompetitorSalesLiteratureDTO
>>
fetchDefault
(
CompetitorSalesLiteratureSearchContext
context
)
{
Page
<
CompetitorSalesLiterature
>
domains
=
competitorsalesliteratureService
.
searchDefault
(
context
)
;
List
<
CompetitorSalesLiteratureDTO
>
list
=
competitorsalesliteratureMapping
.
toDto
(
domains
.
getContent
());
return
ResponseEntity
.
status
(
HttpStatus
.
OK
)
.
header
(
"x-page"
,
String
.
valueOf
(
context
.
getPageable
().
getPageNumber
()))
.
header
(
"x-per-page"
,
String
.
valueOf
(
context
.
getPageable
().
getPageSize
()))
.
header
(
"x-total"
,
String
.
valueOf
(
domains
.
getTotalElements
()))
.
body
(
list
);
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-CompetitorSalesLiterature-searchDefault-all')"
)
@ApiOperation
(
value
=
"查询DEFAULT"
,
tags
=
{
"竞争对手宣传资料"
}
,
notes
=
"查询DEFAULT"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/competitorsalesliteratures/searchdefault"
)
public
ResponseEntity
<
Page
<
CompetitorSalesLiteratureDTO
>>
searchDefault
(
@RequestBody
CompetitorSalesLiteratureSearchContext
context
)
{
Page
<
CompetitorSalesLiterature
>
domains
=
competitorsalesliteratureService
.
searchDefault
(
context
)
;
return
ResponseEntity
.
status
(
HttpStatus
.
OK
)
.
body
(
new
PageImpl
(
competitorsalesliteratureMapping
.
toDto
(
domains
.
getContent
()),
context
.
getPageable
(),
domains
.
getTotalElements
()));
}
@ApiOperation
(
value
=
"根据销售宣传资料检查竞争对手宣传资料"
,
tags
=
{
"竞争对手宣传资料"
},
notes
=
"根据销售宣传资料检查竞争对手宣传资料"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/salesliteratures/{salesliterature_id}/competitorsalesliteratures/checkkey"
)
public
ResponseEntity
<
Boolean
>
checkKeyBySalesLiterature
(
@PathVariable
(
"salesliterature_id"
)
String
salesliterature_id
,
@RequestBody
CompetitorSalesLiteratureDTO
competitorsalesliteraturedto
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
competitorsalesliteratureService
.
checkKey
(
competitorsalesliteratureMapping
.
toDomain
(
competitorsalesliteraturedto
)));
}
@VersionCheck
(
entity
=
"competitorsalesliterature"
,
versionfield
=
"updatedate"
)
@PreAuthorize
(
"hasPermission(this.competitorsalesliteratureService.get(#competitorsalesliterature_id),'iBizBusinessCentral-CompetitorSalesLiterature-Update')"
)
@ApiOperation
(
value
=
"根据销售宣传资料更新竞争对手宣传资料"
,
tags
=
{
"竞争对手宣传资料"
},
notes
=
"根据销售宣传资料更新竞争对手宣传资料"
)
@RequestMapping
(
method
=
RequestMethod
.
PUT
,
value
=
"/salesliteratures/{salesliterature_id}/competitorsalesliteratures/{competitorsalesliterature_id}"
)
@Transactional
public
ResponseEntity
<
CompetitorSalesLiteratureDTO
>
updateBySalesLiterature
(
@PathVariable
(
"salesliterature_id"
)
String
salesliterature_id
,
@PathVariable
(
"competitorsalesliterature_id"
)
String
competitorsalesliterature_id
,
@RequestBody
CompetitorSalesLiteratureDTO
competitorsalesliteraturedto
)
{
CompetitorSalesLiterature
domain
=
competitorsalesliteratureMapping
.
toDomain
(
competitorsalesliteraturedto
);
domain
.
setEntity2id
(
salesliterature_id
);
domain
.
setRelationshipsid
(
competitorsalesliterature_id
);
competitorsalesliteratureService
.
update
(
domain
);
CompetitorSalesLiteratureDTO
dto
=
competitorsalesliteratureMapping
.
toDto
(
domain
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dto
);
}
@PreAuthorize
(
"hasPermission(this.competitorsalesliteratureService.getCompetitorsalesliteratureByEntities(this.competitorsalesliteratureMapping.toDomain(#competitorsalesliteraturedtos)),'iBizBusinessCentral-CompetitorSalesLiterature-Update')"
)
@ApiOperation
(
value
=
"根据销售宣传资料批量更新竞争对手宣传资料"
,
tags
=
{
"竞争对手宣传资料"
},
notes
=
"根据销售宣传资料批量更新竞争对手宣传资料"
)
@RequestMapping
(
method
=
RequestMethod
.
PUT
,
value
=
"/salesliteratures/{salesliterature_id}/competitorsalesliteratures/batch"
)
public
ResponseEntity
<
Boolean
>
updateBatchBySalesLiterature
(
@PathVariable
(
"salesliterature_id"
)
String
salesliterature_id
,
@RequestBody
List
<
CompetitorSalesLiteratureDTO
>
competitorsalesliteraturedtos
)
{
List
<
CompetitorSalesLiterature
>
domainlist
=
competitorsalesliteratureMapping
.
toDomain
(
competitorsalesliteraturedtos
);
for
(
CompetitorSalesLiterature
domain:
domainlist
){
domain
.
setEntity2id
(
salesliterature_id
);
}
competitorsalesliteratureService
.
updateBatch
(
domainlist
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
}
@PostAuthorize
(
"hasPermission(this.competitorsalesliteratureMapping.toDomain(returnObject.body),'iBizBusinessCentral-CompetitorSalesLiterature-Get')"
)
@ApiOperation
(
value
=
"根据销售宣传资料获取竞争对手宣传资料"
,
tags
=
{
"竞争对手宣传资料"
},
notes
=
"根据销售宣传资料获取竞争对手宣传资料"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/salesliteratures/{salesliterature_id}/competitorsalesliteratures/{competitorsalesliterature_id}"
)
public
ResponseEntity
<
CompetitorSalesLiteratureDTO
>
getBySalesLiterature
(
@PathVariable
(
"salesliterature_id"
)
String
salesliterature_id
,
@PathVariable
(
"competitorsalesliterature_id"
)
String
competitorsalesliterature_id
)
{
CompetitorSalesLiterature
domain
=
competitorsalesliteratureService
.
get
(
competitorsalesliterature_id
);
CompetitorSalesLiteratureDTO
dto
=
competitorsalesliteratureMapping
.
toDto
(
domain
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dto
);
}
@PreAuthorize
(
"hasPermission(this.competitorsalesliteratureService.get(#competitorsalesliterature_id),'iBizBusinessCentral-CompetitorSalesLiterature-Remove')"
)
@ApiOperation
(
value
=
"根据销售宣传资料删除竞争对手宣传资料"
,
tags
=
{
"竞争对手宣传资料"
},
notes
=
"根据销售宣传资料删除竞争对手宣传资料"
)
@RequestMapping
(
method
=
RequestMethod
.
DELETE
,
value
=
"/salesliteratures/{salesliterature_id}/competitorsalesliteratures/{competitorsalesliterature_id}"
)
@Transactional
public
ResponseEntity
<
Boolean
>
removeBySalesLiterature
(
@PathVariable
(
"salesliterature_id"
)
String
salesliterature_id
,
@PathVariable
(
"competitorsalesliterature_id"
)
String
competitorsalesliterature_id
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
competitorsalesliteratureService
.
remove
(
competitorsalesliterature_id
));
}
@PreAuthorize
(
"hasPermission(this.competitorsalesliteratureService.getCompetitorsalesliteratureByIds(#ids),'iBizBusinessCentral-CompetitorSalesLiterature-Remove')"
)
@ApiOperation
(
value
=
"根据销售宣传资料批量删除竞争对手宣传资料"
,
tags
=
{
"竞争对手宣传资料"
},
notes
=
"根据销售宣传资料批量删除竞争对手宣传资料"
)
@RequestMapping
(
method
=
RequestMethod
.
DELETE
,
value
=
"/salesliteratures/{salesliterature_id}/competitorsalesliteratures/batch"
)
public
ResponseEntity
<
Boolean
>
removeBatchBySalesLiterature
(
@RequestBody
List
<
String
>
ids
)
{
competitorsalesliteratureService
.
removeBatch
(
ids
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
}
@PreAuthorize
(
"hasPermission(this.competitorsalesliteratureMapping.toDomain(#competitorsalesliteraturedto),'iBizBusinessCentral-CompetitorSalesLiterature-Create')"
)
@ApiOperation
(
value
=
"根据销售宣传资料建立竞争对手宣传资料"
,
tags
=
{
"竞争对手宣传资料"
},
notes
=
"根据销售宣传资料建立竞争对手宣传资料"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/salesliteratures/{salesliterature_id}/competitorsalesliteratures"
)
@Transactional
public
ResponseEntity
<
CompetitorSalesLiteratureDTO
>
createBySalesLiterature
(
@PathVariable
(
"salesliterature_id"
)
String
salesliterature_id
,
@RequestBody
CompetitorSalesLiteratureDTO
competitorsalesliteraturedto
)
{
CompetitorSalesLiterature
domain
=
competitorsalesliteratureMapping
.
toDomain
(
competitorsalesliteraturedto
);
domain
.
setEntity2id
(
salesliterature_id
);
competitorsalesliteratureService
.
create
(
domain
);
CompetitorSalesLiteratureDTO
dto
=
competitorsalesliteratureMapping
.
toDto
(
domain
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dto
);
}
@PreAuthorize
(
"hasPermission(this.competitorsalesliteratureMapping.toDomain(#competitorsalesliteraturedtos),'iBizBusinessCentral-CompetitorSalesLiterature-Create')"
)
@ApiOperation
(
value
=
"根据销售宣传资料批量建立竞争对手宣传资料"
,
tags
=
{
"竞争对手宣传资料"
},
notes
=
"根据销售宣传资料批量建立竞争对手宣传资料"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/salesliteratures/{salesliterature_id}/competitorsalesliteratures/batch"
)
public
ResponseEntity
<
Boolean
>
createBatchBySalesLiterature
(
@PathVariable
(
"salesliterature_id"
)
String
salesliterature_id
,
@RequestBody
List
<
CompetitorSalesLiteratureDTO
>
competitorsalesliteraturedtos
)
{
List
<
CompetitorSalesLiterature
>
domainlist
=
competitorsalesliteratureMapping
.
toDomain
(
competitorsalesliteraturedtos
);
for
(
CompetitorSalesLiterature
domain:
domainlist
){
domain
.
setEntity2id
(
salesliterature_id
);
}
competitorsalesliteratureService
.
createBatch
(
domainlist
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
}
@PreAuthorize
(
"hasPermission(this.competitorsalesliteratureMapping.toDomain(#competitorsalesliteraturedto),'iBizBusinessCentral-CompetitorSalesLiterature-Save')"
)
@ApiOperation
(
value
=
"根据销售宣传资料保存竞争对手宣传资料"
,
tags
=
{
"竞争对手宣传资料"
},
notes
=
"根据销售宣传资料保存竞争对手宣传资料"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/salesliteratures/{salesliterature_id}/competitorsalesliteratures/save"
)
public
ResponseEntity
<
Boolean
>
saveBySalesLiterature
(
@PathVariable
(
"salesliterature_id"
)
String
salesliterature_id
,
@RequestBody
CompetitorSalesLiteratureDTO
competitorsalesliteraturedto
)
{
CompetitorSalesLiterature
domain
=
competitorsalesliteratureMapping
.
toDomain
(
competitorsalesliteraturedto
);
domain
.
setEntity2id
(
salesliterature_id
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
competitorsalesliteratureService
.
save
(
domain
));
}
@PreAuthorize
(
"hasPermission(this.competitorsalesliteratureMapping.toDomain(#competitorsalesliteraturedtos),'iBizBusinessCentral-CompetitorSalesLiterature-Save')"
)
@ApiOperation
(
value
=
"根据销售宣传资料批量保存竞争对手宣传资料"
,
tags
=
{
"竞争对手宣传资料"
},
notes
=
"根据销售宣传资料批量保存竞争对手宣传资料"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/salesliteratures/{salesliterature_id}/competitorsalesliteratures/savebatch"
)
public
ResponseEntity
<
Boolean
>
saveBatchBySalesLiterature
(
@PathVariable
(
"salesliterature_id"
)
String
salesliterature_id
,
@RequestBody
List
<
CompetitorSalesLiteratureDTO
>
competitorsalesliteraturedtos
)
{
List
<
CompetitorSalesLiterature
>
domainlist
=
competitorsalesliteratureMapping
.
toDomain
(
competitorsalesliteraturedtos
);
for
(
CompetitorSalesLiterature
domain:
domainlist
){
domain
.
setEntity2id
(
salesliterature_id
);
}
competitorsalesliteratureService
.
saveBatch
(
domainlist
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
}
@ApiOperation
(
value
=
"根据销售宣传资料获取竞争对手宣传资料草稿"
,
tags
=
{
"竞争对手宣传资料"
},
notes
=
"根据销售宣传资料获取竞争对手宣传资料草稿"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/salesliteratures/{salesliterature_id}/competitorsalesliteratures/getdraft"
)
public
ResponseEntity
<
CompetitorSalesLiteratureDTO
>
getDraftBySalesLiterature
(
@PathVariable
(
"salesliterature_id"
)
String
salesliterature_id
)
{
CompetitorSalesLiterature
domain
=
new
CompetitorSalesLiterature
();
domain
.
setEntity2id
(
salesliterature_id
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
competitorsalesliteratureMapping
.
toDto
(
competitorsalesliteratureService
.
getDraft
(
domain
)));
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-CompetitorSalesLiterature-searchDefault-all')"
)
@ApiOperation
(
value
=
"根据销售宣传资料获取DEFAULT"
,
tags
=
{
"竞争对手宣传资料"
}
,
notes
=
"根据销售宣传资料获取DEFAULT"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/salesliteratures/{salesliterature_id}/competitorsalesliteratures/fetchdefault"
)
public
ResponseEntity
<
List
<
CompetitorSalesLiteratureDTO
>>
fetchCompetitorSalesLiteratureDefaultBySalesLiterature
(
@PathVariable
(
"salesliterature_id"
)
String
salesliterature_id
,
CompetitorSalesLiteratureSearchContext
context
)
{
context
.
setN_entity2id_eq
(
salesliterature_id
);
Page
<
CompetitorSalesLiterature
>
domains
=
competitorsalesliteratureService
.
searchDefault
(
context
)
;
List
<
CompetitorSalesLiteratureDTO
>
list
=
competitorsalesliteratureMapping
.
toDto
(
domains
.
getContent
());
return
ResponseEntity
.
status
(
HttpStatus
.
OK
)
.
header
(
"x-page"
,
String
.
valueOf
(
context
.
getPageable
().
getPageNumber
()))
.
header
(
"x-per-page"
,
String
.
valueOf
(
context
.
getPageable
().
getPageSize
()))
.
header
(
"x-total"
,
String
.
valueOf
(
domains
.
getTotalElements
()))
.
body
(
list
);
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-CompetitorSalesLiterature-searchDefault-all')"
)
@ApiOperation
(
value
=
"根据销售宣传资料查询DEFAULT"
,
tags
=
{
"竞争对手宣传资料"
}
,
notes
=
"根据销售宣传资料查询DEFAULT"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/salesliteratures/{salesliterature_id}/competitorsalesliteratures/searchdefault"
)
public
ResponseEntity
<
Page
<
CompetitorSalesLiteratureDTO
>>
searchCompetitorSalesLiteratureDefaultBySalesLiterature
(
@PathVariable
(
"salesliterature_id"
)
String
salesliterature_id
,
@RequestBody
CompetitorSalesLiteratureSearchContext
context
)
{
context
.
setN_entity2id_eq
(
salesliterature_id
);
Page
<
CompetitorSalesLiterature
>
domains
=
competitorsalesliteratureService
.
searchDefault
(
context
)
;
return
ResponseEntity
.
status
(
HttpStatus
.
OK
)
.
body
(
new
PageImpl
(
competitorsalesliteratureMapping
.
toDto
(
domains
.
getContent
()),
context
.
getPageable
(),
domains
.
getTotalElements
()));
}
}
businesscentral-provider/businesscentral-provider-centralapi/src/main/java/cn/ibizlab/businesscentral/centralapi/rest/OpportunityResource.java
浏览文件 @
60d9e01e
...
...
@@ -163,6 +163,27 @@ public class OpportunityResource {
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Opportunity-searchTop5-all')"
)
@ApiOperation
(
value
=
"获取Top5"
,
tags
=
{
"商机"
}
,
notes
=
"获取Top5"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/opportunities/fetchtop5"
)
public
ResponseEntity
<
List
<
OpportunityDTO
>>
fetchTop5
(
OpportunitySearchContext
context
)
{
Page
<
Opportunity
>
domains
=
opportunityService
.
searchTop5
(
context
)
;
List
<
OpportunityDTO
>
list
=
opportunityMapping
.
toDto
(
domains
.
getContent
());
return
ResponseEntity
.
status
(
HttpStatus
.
OK
)
.
header
(
"x-page"
,
String
.
valueOf
(
context
.
getPageable
().
getPageNumber
()))
.
header
(
"x-per-page"
,
String
.
valueOf
(
context
.
getPageable
().
getPageSize
()))
.
header
(
"x-total"
,
String
.
valueOf
(
domains
.
getTotalElements
()))
.
body
(
list
);
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Opportunity-searchTop5-all')"
)
@ApiOperation
(
value
=
"查询Top5"
,
tags
=
{
"商机"
}
,
notes
=
"查询Top5"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/opportunities/searchtop5"
)
public
ResponseEntity
<
Page
<
OpportunityDTO
>>
searchTop5
(
@RequestBody
OpportunitySearchContext
context
)
{
Page
<
Opportunity
>
domains
=
opportunityService
.
searchTop5
(
context
)
;
return
ResponseEntity
.
status
(
HttpStatus
.
OK
)
.
body
(
new
PageImpl
(
opportunityMapping
.
toDto
(
domains
.
getContent
()),
context
.
getPageable
(),
domains
.
getTotalElements
()));
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Opportunity-searchDefault-all')"
)
@ApiOperation
(
value
=
"获取DEFAULT"
,
tags
=
{
"商机"
}
,
notes
=
"获取DEFAULT"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/opportunities/fetchdefault"
)
...
...
@@ -318,6 +339,29 @@ public class OpportunityResource {
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Opportunity-searchTop5-all')"
)
@ApiOperation
(
value
=
"根据联系人获取Top5"
,
tags
=
{
"商机"
}
,
notes
=
"根据联系人获取Top5"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/contacts/{contact_id}/opportunities/fetchtop5"
)
public
ResponseEntity
<
List
<
OpportunityDTO
>>
fetchOpportunityTop5ByContact
(
@PathVariable
(
"contact_id"
)
String
contact_id
,
OpportunitySearchContext
context
)
{
context
.
setN_parentcontactid_eq
(
contact_id
);
Page
<
Opportunity
>
domains
=
opportunityService
.
searchTop5
(
context
)
;
List
<
OpportunityDTO
>
list
=
opportunityMapping
.
toDto
(
domains
.
getContent
());
return
ResponseEntity
.
status
(
HttpStatus
.
OK
)
.
header
(
"x-page"
,
String
.
valueOf
(
context
.
getPageable
().
getPageNumber
()))
.
header
(
"x-per-page"
,
String
.
valueOf
(
context
.
getPageable
().
getPageSize
()))
.
header
(
"x-total"
,
String
.
valueOf
(
domains
.
getTotalElements
()))
.
body
(
list
);
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Opportunity-searchTop5-all')"
)
@ApiOperation
(
value
=
"根据联系人查询Top5"
,
tags
=
{
"商机"
}
,
notes
=
"根据联系人查询Top5"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/contacts/{contact_id}/opportunities/searchtop5"
)
public
ResponseEntity
<
Page
<
OpportunityDTO
>>
searchOpportunityTop5ByContact
(
@PathVariable
(
"contact_id"
)
String
contact_id
,
@RequestBody
OpportunitySearchContext
context
)
{
context
.
setN_parentcontactid_eq
(
contact_id
);
Page
<
Opportunity
>
domains
=
opportunityService
.
searchTop5
(
context
)
;
return
ResponseEntity
.
status
(
HttpStatus
.
OK
)
.
body
(
new
PageImpl
(
opportunityMapping
.
toDto
(
domains
.
getContent
()),
context
.
getPageable
(),
domains
.
getTotalElements
()));
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Opportunity-searchDefault-all')"
)
@ApiOperation
(
value
=
"根据联系人获取DEFAULT"
,
tags
=
{
"商机"
}
,
notes
=
"根据联系人获取DEFAULT"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/contacts/{contact_id}/opportunities/fetchdefault"
)
...
...
@@ -475,6 +519,29 @@ public class OpportunityResource {
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Opportunity-searchTop5-all')"
)
@ApiOperation
(
value
=
"根据客户联系人获取Top5"
,
tags
=
{
"商机"
}
,
notes
=
"根据客户联系人获取Top5"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/accounts/{account_id}/contacts/{contact_id}/opportunities/fetchtop5"
)
public
ResponseEntity
<
List
<
OpportunityDTO
>>
fetchOpportunityTop5ByAccountContact
(
@PathVariable
(
"account_id"
)
String
account_id
,
@PathVariable
(
"contact_id"
)
String
contact_id
,
OpportunitySearchContext
context
)
{
context
.
setN_parentcontactid_eq
(
contact_id
);
Page
<
Opportunity
>
domains
=
opportunityService
.
searchTop5
(
context
)
;
List
<
OpportunityDTO
>
list
=
opportunityMapping
.
toDto
(
domains
.
getContent
());
return
ResponseEntity
.
status
(
HttpStatus
.
OK
)
.
header
(
"x-page"
,
String
.
valueOf
(
context
.
getPageable
().
getPageNumber
()))
.
header
(
"x-per-page"
,
String
.
valueOf
(
context
.
getPageable
().
getPageSize
()))
.
header
(
"x-total"
,
String
.
valueOf
(
domains
.
getTotalElements
()))
.
body
(
list
);
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Opportunity-searchTop5-all')"
)
@ApiOperation
(
value
=
"根据客户联系人查询Top5"
,
tags
=
{
"商机"
}
,
notes
=
"根据客户联系人查询Top5"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/accounts/{account_id}/contacts/{contact_id}/opportunities/searchtop5"
)
public
ResponseEntity
<
Page
<
OpportunityDTO
>>
searchOpportunityTop5ByAccountContact
(
@PathVariable
(
"account_id"
)
String
account_id
,
@PathVariable
(
"contact_id"
)
String
contact_id
,
@RequestBody
OpportunitySearchContext
context
)
{
context
.
setN_parentcontactid_eq
(
contact_id
);
Page
<
Opportunity
>
domains
=
opportunityService
.
searchTop5
(
context
)
;
return
ResponseEntity
.
status
(
HttpStatus
.
OK
)
.
body
(
new
PageImpl
(
opportunityMapping
.
toDto
(
domains
.
getContent
()),
context
.
getPageable
(),
domains
.
getTotalElements
()));
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Opportunity-searchDefault-all')"
)
@ApiOperation
(
value
=
"根据客户联系人获取DEFAULT"
,
tags
=
{
"商机"
}
,
notes
=
"根据客户联系人获取DEFAULT"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/accounts/{account_id}/contacts/{contact_id}/opportunities/fetchdefault"
)
...
...
businesscentral-provider/businesscentral-provider-centralapi/src/main/java/cn/ibizlab/businesscentral/centralapi/rest/ProductSalesLiteratureResource.java
浏览文件 @
60d9e01e
...
...
@@ -160,5 +160,138 @@ public class ProductSalesLiteratureResource {
return
ResponseEntity
.
status
(
HttpStatus
.
OK
)
.
body
(
new
PageImpl
(
productsalesliteratureMapping
.
toDto
(
domains
.
getContent
()),
context
.
getPageable
(),
domains
.
getTotalElements
()));
}
@PreAuthorize
(
"hasPermission(this.productsalesliteratureService.get(#productsalesliterature_id),'iBizBusinessCentral-ProductSalesLiterature-Remove')"
)
@ApiOperation
(
value
=
"根据销售宣传资料删除产品宣传资料"
,
tags
=
{
"产品宣传资料"
},
notes
=
"根据销售宣传资料删除产品宣传资料"
)
@RequestMapping
(
method
=
RequestMethod
.
DELETE
,
value
=
"/salesliteratures/{salesliterature_id}/productsalesliteratures/{productsalesliterature_id}"
)
@Transactional
public
ResponseEntity
<
Boolean
>
removeBySalesLiterature
(
@PathVariable
(
"salesliterature_id"
)
String
salesliterature_id
,
@PathVariable
(
"productsalesliterature_id"
)
String
productsalesliterature_id
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
productsalesliteratureService
.
remove
(
productsalesliterature_id
));
}
@PreAuthorize
(
"hasPermission(this.productsalesliteratureService.getProductsalesliteratureByIds(#ids),'iBizBusinessCentral-ProductSalesLiterature-Remove')"
)
@ApiOperation
(
value
=
"根据销售宣传资料批量删除产品宣传资料"
,
tags
=
{
"产品宣传资料"
},
notes
=
"根据销售宣传资料批量删除产品宣传资料"
)
@RequestMapping
(
method
=
RequestMethod
.
DELETE
,
value
=
"/salesliteratures/{salesliterature_id}/productsalesliteratures/batch"
)
public
ResponseEntity
<
Boolean
>
removeBatchBySalesLiterature
(
@RequestBody
List
<
String
>
ids
)
{
productsalesliteratureService
.
removeBatch
(
ids
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
}
@PostAuthorize
(
"hasPermission(this.productsalesliteratureMapping.toDomain(returnObject.body),'iBizBusinessCentral-ProductSalesLiterature-Get')"
)
@ApiOperation
(
value
=
"根据销售宣传资料获取产品宣传资料"
,
tags
=
{
"产品宣传资料"
},
notes
=
"根据销售宣传资料获取产品宣传资料"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/salesliteratures/{salesliterature_id}/productsalesliteratures/{productsalesliterature_id}"
)
public
ResponseEntity
<
ProductSalesLiteratureDTO
>
getBySalesLiterature
(
@PathVariable
(
"salesliterature_id"
)
String
salesliterature_id
,
@PathVariable
(
"productsalesliterature_id"
)
String
productsalesliterature_id
)
{
ProductSalesLiterature
domain
=
productsalesliteratureService
.
get
(
productsalesliterature_id
);
ProductSalesLiteratureDTO
dto
=
productsalesliteratureMapping
.
toDto
(
domain
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dto
);
}
@VersionCheck
(
entity
=
"productsalesliterature"
,
versionfield
=
"updatedate"
)
@PreAuthorize
(
"hasPermission(this.productsalesliteratureService.get(#productsalesliterature_id),'iBizBusinessCentral-ProductSalesLiterature-Update')"
)
@ApiOperation
(
value
=
"根据销售宣传资料更新产品宣传资料"
,
tags
=
{
"产品宣传资料"
},
notes
=
"根据销售宣传资料更新产品宣传资料"
)
@RequestMapping
(
method
=
RequestMethod
.
PUT
,
value
=
"/salesliteratures/{salesliterature_id}/productsalesliteratures/{productsalesliterature_id}"
)
@Transactional
public
ResponseEntity
<
ProductSalesLiteratureDTO
>
updateBySalesLiterature
(
@PathVariable
(
"salesliterature_id"
)
String
salesliterature_id
,
@PathVariable
(
"productsalesliterature_id"
)
String
productsalesliterature_id
,
@RequestBody
ProductSalesLiteratureDTO
productsalesliteraturedto
)
{
ProductSalesLiterature
domain
=
productsalesliteratureMapping
.
toDomain
(
productsalesliteraturedto
);
domain
.
setEntity2id
(
salesliterature_id
);
domain
.
setRelationshipsid
(
productsalesliterature_id
);
productsalesliteratureService
.
update
(
domain
);
ProductSalesLiteratureDTO
dto
=
productsalesliteratureMapping
.
toDto
(
domain
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dto
);
}
@PreAuthorize
(
"hasPermission(this.productsalesliteratureService.getProductsalesliteratureByEntities(this.productsalesliteratureMapping.toDomain(#productsalesliteraturedtos)),'iBizBusinessCentral-ProductSalesLiterature-Update')"
)
@ApiOperation
(
value
=
"根据销售宣传资料批量更新产品宣传资料"
,
tags
=
{
"产品宣传资料"
},
notes
=
"根据销售宣传资料批量更新产品宣传资料"
)
@RequestMapping
(
method
=
RequestMethod
.
PUT
,
value
=
"/salesliteratures/{salesliterature_id}/productsalesliteratures/batch"
)
public
ResponseEntity
<
Boolean
>
updateBatchBySalesLiterature
(
@PathVariable
(
"salesliterature_id"
)
String
salesliterature_id
,
@RequestBody
List
<
ProductSalesLiteratureDTO
>
productsalesliteraturedtos
)
{
List
<
ProductSalesLiterature
>
domainlist
=
productsalesliteratureMapping
.
toDomain
(
productsalesliteraturedtos
);
for
(
ProductSalesLiterature
domain:
domainlist
){
domain
.
setEntity2id
(
salesliterature_id
);
}
productsalesliteratureService
.
updateBatch
(
domainlist
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
}
@ApiOperation
(
value
=
"根据销售宣传资料检查产品宣传资料"
,
tags
=
{
"产品宣传资料"
},
notes
=
"根据销售宣传资料检查产品宣传资料"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/salesliteratures/{salesliterature_id}/productsalesliteratures/checkkey"
)
public
ResponseEntity
<
Boolean
>
checkKeyBySalesLiterature
(
@PathVariable
(
"salesliterature_id"
)
String
salesliterature_id
,
@RequestBody
ProductSalesLiteratureDTO
productsalesliteraturedto
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
productsalesliteratureService
.
checkKey
(
productsalesliteratureMapping
.
toDomain
(
productsalesliteraturedto
)));
}
@ApiOperation
(
value
=
"根据销售宣传资料获取产品宣传资料草稿"
,
tags
=
{
"产品宣传资料"
},
notes
=
"根据销售宣传资料获取产品宣传资料草稿"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/salesliteratures/{salesliterature_id}/productsalesliteratures/getdraft"
)
public
ResponseEntity
<
ProductSalesLiteratureDTO
>
getDraftBySalesLiterature
(
@PathVariable
(
"salesliterature_id"
)
String
salesliterature_id
)
{
ProductSalesLiterature
domain
=
new
ProductSalesLiterature
();
domain
.
setEntity2id
(
salesliterature_id
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
productsalesliteratureMapping
.
toDto
(
productsalesliteratureService
.
getDraft
(
domain
)));
}
@PreAuthorize
(
"hasPermission(this.productsalesliteratureMapping.toDomain(#productsalesliteraturedto),'iBizBusinessCentral-ProductSalesLiterature-Save')"
)
@ApiOperation
(
value
=
"根据销售宣传资料保存产品宣传资料"
,
tags
=
{
"产品宣传资料"
},
notes
=
"根据销售宣传资料保存产品宣传资料"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/salesliteratures/{salesliterature_id}/productsalesliteratures/save"
)
public
ResponseEntity
<
Boolean
>
saveBySalesLiterature
(
@PathVariable
(
"salesliterature_id"
)
String
salesliterature_id
,
@RequestBody
ProductSalesLiteratureDTO
productsalesliteraturedto
)
{
ProductSalesLiterature
domain
=
productsalesliteratureMapping
.
toDomain
(
productsalesliteraturedto
);
domain
.
setEntity2id
(
salesliterature_id
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
productsalesliteratureService
.
save
(
domain
));
}
@PreAuthorize
(
"hasPermission(this.productsalesliteratureMapping.toDomain(#productsalesliteraturedtos),'iBizBusinessCentral-ProductSalesLiterature-Save')"
)
@ApiOperation
(
value
=
"根据销售宣传资料批量保存产品宣传资料"
,
tags
=
{
"产品宣传资料"
},
notes
=
"根据销售宣传资料批量保存产品宣传资料"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/salesliteratures/{salesliterature_id}/productsalesliteratures/savebatch"
)
public
ResponseEntity
<
Boolean
>
saveBatchBySalesLiterature
(
@PathVariable
(
"salesliterature_id"
)
String
salesliterature_id
,
@RequestBody
List
<
ProductSalesLiteratureDTO
>
productsalesliteraturedtos
)
{
List
<
ProductSalesLiterature
>
domainlist
=
productsalesliteratureMapping
.
toDomain
(
productsalesliteraturedtos
);
for
(
ProductSalesLiterature
domain:
domainlist
){
domain
.
setEntity2id
(
salesliterature_id
);
}
productsalesliteratureService
.
saveBatch
(
domainlist
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
}
@PreAuthorize
(
"hasPermission(this.productsalesliteratureMapping.toDomain(#productsalesliteraturedto),'iBizBusinessCentral-ProductSalesLiterature-Create')"
)
@ApiOperation
(
value
=
"根据销售宣传资料建立产品宣传资料"
,
tags
=
{
"产品宣传资料"
},
notes
=
"根据销售宣传资料建立产品宣传资料"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/salesliteratures/{salesliterature_id}/productsalesliteratures"
)
@Transactional
public
ResponseEntity
<
ProductSalesLiteratureDTO
>
createBySalesLiterature
(
@PathVariable
(
"salesliterature_id"
)
String
salesliterature_id
,
@RequestBody
ProductSalesLiteratureDTO
productsalesliteraturedto
)
{
ProductSalesLiterature
domain
=
productsalesliteratureMapping
.
toDomain
(
productsalesliteraturedto
);
domain
.
setEntity2id
(
salesliterature_id
);
productsalesliteratureService
.
create
(
domain
);
ProductSalesLiteratureDTO
dto
=
productsalesliteratureMapping
.
toDto
(
domain
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dto
);
}
@PreAuthorize
(
"hasPermission(this.productsalesliteratureMapping.toDomain(#productsalesliteraturedtos),'iBizBusinessCentral-ProductSalesLiterature-Create')"
)
@ApiOperation
(
value
=
"根据销售宣传资料批量建立产品宣传资料"
,
tags
=
{
"产品宣传资料"
},
notes
=
"根据销售宣传资料批量建立产品宣传资料"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/salesliteratures/{salesliterature_id}/productsalesliteratures/batch"
)
public
ResponseEntity
<
Boolean
>
createBatchBySalesLiterature
(
@PathVariable
(
"salesliterature_id"
)
String
salesliterature_id
,
@RequestBody
List
<
ProductSalesLiteratureDTO
>
productsalesliteraturedtos
)
{
List
<
ProductSalesLiterature
>
domainlist
=
productsalesliteratureMapping
.
toDomain
(
productsalesliteraturedtos
);
for
(
ProductSalesLiterature
domain:
domainlist
){
domain
.
setEntity2id
(
salesliterature_id
);
}
productsalesliteratureService
.
createBatch
(
domainlist
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-ProductSalesLiterature-searchDefault-all')"
)
@ApiOperation
(
value
=
"根据销售宣传资料获取DEFAULT"
,
tags
=
{
"产品宣传资料"
}
,
notes
=
"根据销售宣传资料获取DEFAULT"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/salesliteratures/{salesliterature_id}/productsalesliteratures/fetchdefault"
)
public
ResponseEntity
<
List
<
ProductSalesLiteratureDTO
>>
fetchProductSalesLiteratureDefaultBySalesLiterature
(
@PathVariable
(
"salesliterature_id"
)
String
salesliterature_id
,
ProductSalesLiteratureSearchContext
context
)
{
context
.
setN_entity2id_eq
(
salesliterature_id
);
Page
<
ProductSalesLiterature
>
domains
=
productsalesliteratureService
.
searchDefault
(
context
)
;
List
<
ProductSalesLiteratureDTO
>
list
=
productsalesliteratureMapping
.
toDto
(
domains
.
getContent
());
return
ResponseEntity
.
status
(
HttpStatus
.
OK
)
.
header
(
"x-page"
,
String
.
valueOf
(
context
.
getPageable
().
getPageNumber
()))
.
header
(
"x-per-page"
,
String
.
valueOf
(
context
.
getPageable
().
getPageSize
()))
.
header
(
"x-total"
,
String
.
valueOf
(
domains
.
getTotalElements
()))
.
body
(
list
);
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-ProductSalesLiterature-searchDefault-all')"
)
@ApiOperation
(
value
=
"根据销售宣传资料查询DEFAULT"
,
tags
=
{
"产品宣传资料"
}
,
notes
=
"根据销售宣传资料查询DEFAULT"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/salesliteratures/{salesliterature_id}/productsalesliteratures/searchdefault"
)
public
ResponseEntity
<
Page
<
ProductSalesLiteratureDTO
>>
searchProductSalesLiteratureDefaultBySalesLiterature
(
@PathVariable
(
"salesliterature_id"
)
String
salesliterature_id
,
@RequestBody
ProductSalesLiteratureSearchContext
context
)
{
context
.
setN_entity2id_eq
(
salesliterature_id
);
Page
<
ProductSalesLiterature
>
domains
=
productsalesliteratureService
.
searchDefault
(
context
)
;
return
ResponseEntity
.
status
(
HttpStatus
.
OK
)
.
body
(
new
PageImpl
(
productsalesliteratureMapping
.
toDto
(
domains
.
getContent
()),
context
.
getPageable
(),
domains
.
getTotalElements
()));
}
}
businesscentral-provider/businesscentral-provider-centralapi/src/main/java/cn/ibizlab/businesscentral/centralapi/rest/SalesLiteratureItemResource.java
浏览文件 @
60d9e01e
...
...
@@ -160,5 +160,138 @@ public class SalesLiteratureItemResource {
return
ResponseEntity
.
status
(
HttpStatus
.
OK
)
.
body
(
new
PageImpl
(
salesliteratureitemMapping
.
toDto
(
domains
.
getContent
()),
context
.
getPageable
(),
domains
.
getTotalElements
()));
}
@PreAuthorize
(
"hasPermission(this.salesliteratureitemMapping.toDomain(#salesliteratureitemdto),'iBizBusinessCentral-SalesLiteratureItem-Save')"
)
@ApiOperation
(
value
=
"根据销售宣传资料保存销售附件"
,
tags
=
{
"销售附件"
},
notes
=
"根据销售宣传资料保存销售附件"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/salesliteratures/{salesliterature_id}/salesliteratureitems/save"
)
public
ResponseEntity
<
Boolean
>
saveBySalesLiterature
(
@PathVariable
(
"salesliterature_id"
)
String
salesliterature_id
,
@RequestBody
SalesLiteratureItemDTO
salesliteratureitemdto
)
{
SalesLiteratureItem
domain
=
salesliteratureitemMapping
.
toDomain
(
salesliteratureitemdto
);
domain
.
setSalesliteratureid
(
salesliterature_id
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
salesliteratureitemService
.
save
(
domain
));
}
@PreAuthorize
(
"hasPermission(this.salesliteratureitemMapping.toDomain(#salesliteratureitemdtos),'iBizBusinessCentral-SalesLiteratureItem-Save')"
)
@ApiOperation
(
value
=
"根据销售宣传资料批量保存销售附件"
,
tags
=
{
"销售附件"
},
notes
=
"根据销售宣传资料批量保存销售附件"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/salesliteratures/{salesliterature_id}/salesliteratureitems/savebatch"
)
public
ResponseEntity
<
Boolean
>
saveBatchBySalesLiterature
(
@PathVariable
(
"salesliterature_id"
)
String
salesliterature_id
,
@RequestBody
List
<
SalesLiteratureItemDTO
>
salesliteratureitemdtos
)
{
List
<
SalesLiteratureItem
>
domainlist
=
salesliteratureitemMapping
.
toDomain
(
salesliteratureitemdtos
);
for
(
SalesLiteratureItem
domain:
domainlist
){
domain
.
setSalesliteratureid
(
salesliterature_id
);
}
salesliteratureitemService
.
saveBatch
(
domainlist
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
}
@PostAuthorize
(
"hasPermission(this.salesliteratureitemMapping.toDomain(returnObject.body),'iBizBusinessCentral-SalesLiteratureItem-Get')"
)
@ApiOperation
(
value
=
"根据销售宣传资料获取销售附件"
,
tags
=
{
"销售附件"
},
notes
=
"根据销售宣传资料获取销售附件"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/salesliteratures/{salesliterature_id}/salesliteratureitems/{salesliteratureitem_id}"
)
public
ResponseEntity
<
SalesLiteratureItemDTO
>
getBySalesLiterature
(
@PathVariable
(
"salesliterature_id"
)
String
salesliterature_id
,
@PathVariable
(
"salesliteratureitem_id"
)
String
salesliteratureitem_id
)
{
SalesLiteratureItem
domain
=
salesliteratureitemService
.
get
(
salesliteratureitem_id
);
SalesLiteratureItemDTO
dto
=
salesliteratureitemMapping
.
toDto
(
domain
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dto
);
}
@ApiOperation
(
value
=
"根据销售宣传资料获取销售附件草稿"
,
tags
=
{
"销售附件"
},
notes
=
"根据销售宣传资料获取销售附件草稿"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/salesliteratures/{salesliterature_id}/salesliteratureitems/getdraft"
)
public
ResponseEntity
<
SalesLiteratureItemDTO
>
getDraftBySalesLiterature
(
@PathVariable
(
"salesliterature_id"
)
String
salesliterature_id
)
{
SalesLiteratureItem
domain
=
new
SalesLiteratureItem
();
domain
.
setSalesliteratureid
(
salesliterature_id
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
salesliteratureitemMapping
.
toDto
(
salesliteratureitemService
.
getDraft
(
domain
)));
}
@PreAuthorize
(
"hasPermission(this.salesliteratureitemService.get(#salesliteratureitem_id),'iBizBusinessCentral-SalesLiteratureItem-Remove')"
)
@ApiOperation
(
value
=
"根据销售宣传资料删除销售附件"
,
tags
=
{
"销售附件"
},
notes
=
"根据销售宣传资料删除销售附件"
)
@RequestMapping
(
method
=
RequestMethod
.
DELETE
,
value
=
"/salesliteratures/{salesliterature_id}/salesliteratureitems/{salesliteratureitem_id}"
)
@Transactional
public
ResponseEntity
<
Boolean
>
removeBySalesLiterature
(
@PathVariable
(
"salesliterature_id"
)
String
salesliterature_id
,
@PathVariable
(
"salesliteratureitem_id"
)
String
salesliteratureitem_id
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
salesliteratureitemService
.
remove
(
salesliteratureitem_id
));
}
@PreAuthorize
(
"hasPermission(this.salesliteratureitemService.getSalesliteratureitemByIds(#ids),'iBizBusinessCentral-SalesLiteratureItem-Remove')"
)
@ApiOperation
(
value
=
"根据销售宣传资料批量删除销售附件"
,
tags
=
{
"销售附件"
},
notes
=
"根据销售宣传资料批量删除销售附件"
)
@RequestMapping
(
method
=
RequestMethod
.
DELETE
,
value
=
"/salesliteratures/{salesliterature_id}/salesliteratureitems/batch"
)
public
ResponseEntity
<
Boolean
>
removeBatchBySalesLiterature
(
@RequestBody
List
<
String
>
ids
)
{
salesliteratureitemService
.
removeBatch
(
ids
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
}
@VersionCheck
(
entity
=
"salesliteratureitem"
,
versionfield
=
"updatedate"
)
@PreAuthorize
(
"hasPermission(this.salesliteratureitemService.get(#salesliteratureitem_id),'iBizBusinessCentral-SalesLiteratureItem-Update')"
)
@ApiOperation
(
value
=
"根据销售宣传资料更新销售附件"
,
tags
=
{
"销售附件"
},
notes
=
"根据销售宣传资料更新销售附件"
)
@RequestMapping
(
method
=
RequestMethod
.
PUT
,
value
=
"/salesliteratures/{salesliterature_id}/salesliteratureitems/{salesliteratureitem_id}"
)
@Transactional
public
ResponseEntity
<
SalesLiteratureItemDTO
>
updateBySalesLiterature
(
@PathVariable
(
"salesliterature_id"
)
String
salesliterature_id
,
@PathVariable
(
"salesliteratureitem_id"
)
String
salesliteratureitem_id
,
@RequestBody
SalesLiteratureItemDTO
salesliteratureitemdto
)
{
SalesLiteratureItem
domain
=
salesliteratureitemMapping
.
toDomain
(
salesliteratureitemdto
);
domain
.
setSalesliteratureid
(
salesliterature_id
);
domain
.
setSalesliteratureitemid
(
salesliteratureitem_id
);
salesliteratureitemService
.
update
(
domain
);
SalesLiteratureItemDTO
dto
=
salesliteratureitemMapping
.
toDto
(
domain
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dto
);
}
@PreAuthorize
(
"hasPermission(this.salesliteratureitemService.getSalesliteratureitemByEntities(this.salesliteratureitemMapping.toDomain(#salesliteratureitemdtos)),'iBizBusinessCentral-SalesLiteratureItem-Update')"
)
@ApiOperation
(
value
=
"根据销售宣传资料批量更新销售附件"
,
tags
=
{
"销售附件"
},
notes
=
"根据销售宣传资料批量更新销售附件"
)
@RequestMapping
(
method
=
RequestMethod
.
PUT
,
value
=
"/salesliteratures/{salesliterature_id}/salesliteratureitems/batch"
)
public
ResponseEntity
<
Boolean
>
updateBatchBySalesLiterature
(
@PathVariable
(
"salesliterature_id"
)
String
salesliterature_id
,
@RequestBody
List
<
SalesLiteratureItemDTO
>
salesliteratureitemdtos
)
{
List
<
SalesLiteratureItem
>
domainlist
=
salesliteratureitemMapping
.
toDomain
(
salesliteratureitemdtos
);
for
(
SalesLiteratureItem
domain:
domainlist
){
domain
.
setSalesliteratureid
(
salesliterature_id
);
}
salesliteratureitemService
.
updateBatch
(
domainlist
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
}
@ApiOperation
(
value
=
"根据销售宣传资料检查销售附件"
,
tags
=
{
"销售附件"
},
notes
=
"根据销售宣传资料检查销售附件"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/salesliteratures/{salesliterature_id}/salesliteratureitems/checkkey"
)
public
ResponseEntity
<
Boolean
>
checkKeyBySalesLiterature
(
@PathVariable
(
"salesliterature_id"
)
String
salesliterature_id
,
@RequestBody
SalesLiteratureItemDTO
salesliteratureitemdto
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
salesliteratureitemService
.
checkKey
(
salesliteratureitemMapping
.
toDomain
(
salesliteratureitemdto
)));
}
@PreAuthorize
(
"hasPermission(this.salesliteratureitemMapping.toDomain(#salesliteratureitemdto),'iBizBusinessCentral-SalesLiteratureItem-Create')"
)
@ApiOperation
(
value
=
"根据销售宣传资料建立销售附件"
,
tags
=
{
"销售附件"
},
notes
=
"根据销售宣传资料建立销售附件"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/salesliteratures/{salesliterature_id}/salesliteratureitems"
)
@Transactional
public
ResponseEntity
<
SalesLiteratureItemDTO
>
createBySalesLiterature
(
@PathVariable
(
"salesliterature_id"
)
String
salesliterature_id
,
@RequestBody
SalesLiteratureItemDTO
salesliteratureitemdto
)
{
SalesLiteratureItem
domain
=
salesliteratureitemMapping
.
toDomain
(
salesliteratureitemdto
);
domain
.
setSalesliteratureid
(
salesliterature_id
);
salesliteratureitemService
.
create
(
domain
);
SalesLiteratureItemDTO
dto
=
salesliteratureitemMapping
.
toDto
(
domain
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dto
);
}
@PreAuthorize
(
"hasPermission(this.salesliteratureitemMapping.toDomain(#salesliteratureitemdtos),'iBizBusinessCentral-SalesLiteratureItem-Create')"
)
@ApiOperation
(
value
=
"根据销售宣传资料批量建立销售附件"
,
tags
=
{
"销售附件"
},
notes
=
"根据销售宣传资料批量建立销售附件"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/salesliteratures/{salesliterature_id}/salesliteratureitems/batch"
)
public
ResponseEntity
<
Boolean
>
createBatchBySalesLiterature
(
@PathVariable
(
"salesliterature_id"
)
String
salesliterature_id
,
@RequestBody
List
<
SalesLiteratureItemDTO
>
salesliteratureitemdtos
)
{
List
<
SalesLiteratureItem
>
domainlist
=
salesliteratureitemMapping
.
toDomain
(
salesliteratureitemdtos
);
for
(
SalesLiteratureItem
domain:
domainlist
){
domain
.
setSalesliteratureid
(
salesliterature_id
);
}
salesliteratureitemService
.
createBatch
(
domainlist
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-SalesLiteratureItem-searchDefault-all')"
)
@ApiOperation
(
value
=
"根据销售宣传资料获取DEFAULT"
,
tags
=
{
"销售附件"
}
,
notes
=
"根据销售宣传资料获取DEFAULT"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/salesliteratures/{salesliterature_id}/salesliteratureitems/fetchdefault"
)
public
ResponseEntity
<
List
<
SalesLiteratureItemDTO
>>
fetchSalesLiteratureItemDefaultBySalesLiterature
(
@PathVariable
(
"salesliterature_id"
)
String
salesliterature_id
,
SalesLiteratureItemSearchContext
context
)
{
context
.
setN_salesliteratureid_eq
(
salesliterature_id
);
Page
<
SalesLiteratureItem
>
domains
=
salesliteratureitemService
.
searchDefault
(
context
)
;
List
<
SalesLiteratureItemDTO
>
list
=
salesliteratureitemMapping
.
toDto
(
domains
.
getContent
());
return
ResponseEntity
.
status
(
HttpStatus
.
OK
)
.
header
(
"x-page"
,
String
.
valueOf
(
context
.
getPageable
().
getPageNumber
()))
.
header
(
"x-per-page"
,
String
.
valueOf
(
context
.
getPageable
().
getPageSize
()))
.
header
(
"x-total"
,
String
.
valueOf
(
domains
.
getTotalElements
()))
.
body
(
list
);
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-SalesLiteratureItem-searchDefault-all')"
)
@ApiOperation
(
value
=
"根据销售宣传资料查询DEFAULT"
,
tags
=
{
"销售附件"
}
,
notes
=
"根据销售宣传资料查询DEFAULT"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/salesliteratures/{salesliterature_id}/salesliteratureitems/searchdefault"
)
public
ResponseEntity
<
Page
<
SalesLiteratureItemDTO
>>
searchSalesLiteratureItemDefaultBySalesLiterature
(
@PathVariable
(
"salesliterature_id"
)
String
salesliterature_id
,
@RequestBody
SalesLiteratureItemSearchContext
context
)
{
context
.
setN_salesliteratureid_eq
(
salesliterature_id
);
Page
<
SalesLiteratureItem
>
domains
=
salesliteratureitemService
.
searchDefault
(
context
)
;
return
ResponseEntity
.
status
(
HttpStatus
.
OK
)
.
body
(
new
PageImpl
(
salesliteratureitemMapping
.
toDto
(
domains
.
getContent
()),
context
.
getPageable
(),
domains
.
getTotalElements
()));
}
}
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录