提交 f329c977 编写于 作者: ibizdev's avatar ibizdev

xignzi006 发布系统代码

上级 dfc9d5f0
......@@ -87,6 +87,35 @@ mock.onDelete(new RegExp(/^\/leads\/batch$/)).reply((config: any) => {
});
// Select
mock.onGet(new RegExp(/^\/campaigns\/([a-zA-Z0-9\-\;]{1,35})\/leads\/([a-zA-Z0-9\-\;]{1,35})\/select$/)).reply((config: any) => {
console.groupCollapsed("实体:lead 方法: 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> = ['campaignid','leadid'];
const matchArray:any = new RegExp(/^\/campaigns\/([a-zA-Z0-9\-\;]{1,35})\/leads\/([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.leadid, tempValue.leadid));
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(_items);
console.groupEnd();
console.groupEnd();
return [status, _items];
});
// Select
mock.onGet(new RegExp(/^\/leads\/([a-zA-Z0-9\-\;]{1,35})\/select$/)).reply((config: any) => {
console.groupCollapsed("实体:lead 方法: Select");
......@@ -114,6 +143,33 @@ mock.onGet(new RegExp(/^\/leads\/([a-zA-Z0-9\-\;]{1,35})\/select$/)).reply((conf
console.groupEnd();
return [status, _items];
});
// Update
mock.onPut(new RegExp(/^\/campaigns\/([a-zA-Z0-9\-\;]{1,35})\/leads\/([a-zA-Z0-9\-\;]{1,35})$/)).reply((config: any) => {
console.groupCollapsed("实体:lead 方法: 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> = ['campaignid','leadid'];
const matchArray:any = new RegExp(/^\/campaigns\/([a-zA-Z0-9\-\;]{1,35})\/leads\/([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(/^\/leads\/?([a-zA-Z0-9\-\;]{0,35})$/)).reply((config: any) => {
......@@ -153,6 +209,23 @@ mock.onPut(new RegExp(/^\/leads\/?([a-zA-Z0-9\-\;]{0,35})$/)).reply((config: any
return [status, data];
});
// GetDraft
mock.onGet(new RegExp(/^\/campaigns\/([a-zA-Z0-9\-\;]{1,35})\/leads\/getdraft$/)).reply((config: any) => {
console.groupCollapsed("实体:lead 方法: 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(/^\/leads\/getdraft$/)).reply((config: any) => {
console.groupCollapsed("实体:lead 方法: GetDraft");
......@@ -168,6 +241,33 @@ mock.onGet(new RegExp(/^\/leads\/getdraft$/)).reply((config: any) => {
console.groupEnd();
return [status, {}];
});
// CheckKey
mock.onPost(new RegExp(/^\/campaigns\/([a-zA-Z0-9\-\;]{1,35})\/leads\/([a-zA-Z0-9\-\;]{1,35})\/checkkey$/)).reply((config: any) => {
console.groupCollapsed("实体:lead 方法: 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> = ['campaignid','leadid'];
const matchArray:any = new RegExp(/^\/campaigns\/([a-zA-Z0-9\-\;]{1,35})\/leads\/([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(/^\/leads\/?([a-zA-Z0-9\-\;]{0,35})\/checkkey$/)).reply((config: any) => {
......@@ -206,6 +306,34 @@ mock.onPost(new RegExp(/^\/leads\/?([a-zA-Z0-9\-\;]{0,35})\/checkkey$/)).reply((
console.groupEnd();
return [status, data];
});
// Save
mock.onPost(new RegExp(/^\/campaigns\/([a-zA-Z0-9\-\;]{1,35})\/leads\/([a-zA-Z0-9\-\;]{1,35})\/save$/)).reply((config: any) => {
console.groupCollapsed("实体:lead 方法: 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> = ['campaignid','leadid'];
const matchArray:any = new RegExp(/^\/campaigns\/([a-zA-Z0-9\-\;]{1,35})\/leads\/([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(/^\/leads\/?([a-zA-Z0-9\-\;]{0,35})\/save$/)).reply((config: any) => {
......@@ -244,6 +372,33 @@ mock.onPost(new RegExp(/^\/leads\/?([a-zA-Z0-9\-\;]{0,35})\/save$/)).reply((conf
console.groupEnd();
return [status, data];
});
// Create
mock.onPost(new RegExp(/^\/campaigns\/([a-zA-Z0-9\-\;]{1,35})\/leads\/([a-zA-Z0-9\-\;]{1,35})$/)).reply((config: any) => {
console.groupCollapsed("实体:lead 方法: 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> = ['campaignid','leadid'];
const matchArray:any = new RegExp(/^\/campaigns\/([a-zA-Z0-9\-\;]{1,35})\/leads\/([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(/^\/leads\/?([a-zA-Z0-9\-\;]{0,35})$/)).reply((config: any) => {
......@@ -270,6 +425,52 @@ mock.onPost(new RegExp(/^\/leads\/?([a-zA-Z0-9\-\;]{0,35})$/)).reply((config: an
console.groupEnd();
return [status, mockDatas[0]];
});
// FetchDefault
mock.onGet(new RegExp(/^\/campaigns\/([a-zA-Z0-9\-\;]{1,35})\/leads\/fetchdefault$/)).reply((config: any) => {
console.groupCollapsed("实体:lead 方法: 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> = ['campaignid'];
let tempValue: any = {};
const matchArray:any = new RegExp(/^\/campaigns\/([a-zA-Z0-9\-\;]{1,35})\/leads\/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(/^\/leads\/fetchdefault$/)).reply((config: any) => {
......@@ -314,15 +515,57 @@ mock.onGet(new RegExp(/^\/leads\/fetchdefault(\?[\w-./?%&=,]*)*$/)).reply((confi
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(/^\/campaigns\/([a-zA-Z0-9\-\;]{1,35})\/leads\/([a-zA-Z0-9\-\;]{1,35})$/)).reply((config: any) => {
console.groupCollapsed("实体:lead 方法: 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> = ['campaignid','leadid'];
const matchArray:any = new RegExp(/^\/campaigns\/([a-zA-Z0-9\-\;]{1,35})\/leads\/([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.leadid, tempValue.leadid));
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(_items?_items:{});
console.groupEnd();
console.groupEnd();
return [status, _items?_items:{}];
});
// Get
mock.onGet(new RegExp(/^\/leads\/([a-zA-Z0-9\-\;]{1,35})$/)).reply((config: any) => {
console.groupCollapsed("实体:lead 方法: Get");
......@@ -351,6 +594,34 @@ mock.onGet(new RegExp(/^\/leads\/([a-zA-Z0-9\-\;]{1,35})$/)).reply((config: any)
return [status, _items?_items:{}];
});
// Remove
mock.onDelete(new RegExp(/^\/campaigns\/([a-zA-Z0-9\-\;]{1,35})\/leads\/([a-zA-Z0-9\-\;]{1,35})$/)).reply((config: any) => {
console.groupCollapsed("实体:lead 方法: 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> = ['campaignid','leadid'];
const matchArray:any = new RegExp(/^\/campaigns\/([a-zA-Z0-9\-\;]{1,35})\/leads\/([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.leadid, tempValue.leadid));
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(_items?_items:{});
console.groupEnd();
console.groupEnd();
return [status, _items?_items:{}];
});
// Remove
mock.onDelete(new RegExp(/^\/leads\/([a-zA-Z0-9\-\;]{1,35})$/)).reply((config: any) => {
console.groupCollapsed("实体:lead 方法: Remove");
......
......@@ -930,7 +930,12 @@ export default class LeadGridViewBase extends Vue {
if(args.length >0){
Object.assign(tempContext,args[0]);
}
const deResParameters: any[] = [];
let deResParameters: any[] = [];
if(tempContext.campaign && true){
deResParameters = [
{ pathName: 'campaigns', parameterName: 'campaign' },
]
}
const parameters: any[] = [
{ pathName: 'leads', parameterName: 'lead' },
{ pathName: 'editview', parameterName: 'editview' },
......@@ -964,7 +969,12 @@ export default class LeadGridViewBase extends Vue {
if(args.length >0){
Object.assign(tempContext,args[0]);
}
const deResParameters: any[] = [];
let deResParameters: any[] = [];
if(tempContext.campaign && true){
deResParameters = [
{ pathName: 'campaigns', parameterName: 'campaign' },
]
}
const parameters: any[] = [
{ pathName: 'leads', parameterName: 'lead' },
{ pathName: 'editview', parameterName: 'editview' },
......
......@@ -189,6 +189,21 @@ const router = new Router({
},
component: () => import('@pages/base/activity-pointer-edit-view/activity-pointer-edit-view.vue'),
},
{
path: 'campaigns/:campaign?/leads/:lead?/gridview/:gridview?',
meta: {
caption: 'entities.lead.views.gridview.title',
info:'',
parameters: [
{ pathName: 'central', parameterName: 'central' },
{ pathName: 'campaigns', parameterName: 'campaign' },
{ pathName: 'leads', parameterName: 'lead' },
{ pathName: 'gridview', parameterName: 'gridview' },
],
requireAuth: true,
},
component: () => import('@pages/sales/lead-grid-view/lead-grid-view.vue'),
},
{
path: 'leads/:lead?/gridview/:gridview?',
meta: {
......@@ -916,6 +931,21 @@ const router = new Router({
},
component: () => import('@pages/base/activity-pointer-by-parent-key/activity-pointer-by-parent-key.vue'),
},
{
path: 'campaigns/:campaign?/leads/:lead?/editview/:editview?',
meta: {
caption: 'entities.lead.views.editview.title',
info:'',
parameters: [
{ pathName: 'central', parameterName: 'central' },
{ pathName: 'campaigns', parameterName: 'campaign' },
{ pathName: 'leads', parameterName: 'lead' },
{ pathName: 'editview', parameterName: 'editview' },
],
requireAuth: true,
},
component: () => import('@pages/sales/lead-edit-view/lead-edit-view.vue'),
},
{
path: 'leads/:lead?/editview/:editview?',
meta: {
......@@ -1190,6 +1220,20 @@ const router = new Router({
},
component: () => import('@pages/marketing/campaign-info-campagin/campaign-info-campagin.vue'),
},
{
path: '/campaigns/:campaign?/leads/:lead?/gridview/:gridview?',
meta: {
caption: 'entities.lead.views.gridview.title',
info:'',
parameters: [
{ pathName: 'campaigns', parameterName: 'campaign' },
{ pathName: 'leads', parameterName: 'lead' },
{ pathName: 'gridview', parameterName: 'gridview' },
],
requireAuth: true,
},
component: () => import('@pages/sales/lead-grid-view/lead-grid-view.vue'),
},
{
path: '/leads/:lead?/gridview/:gridview?',
meta: {
......@@ -1255,6 +1299,20 @@ const router = new Router({
},
component: () => import('@pages/base/account-pickup-view/account-pickup-view.vue'),
},
{
path: '/campaigns/:campaign?/leads/:lead?/editview/:editview?',
meta: {
caption: 'entities.lead.views.editview.title',
info:'',
parameters: [
{ pathName: 'campaigns', parameterName: 'campaign' },
{ pathName: 'leads', parameterName: 'lead' },
{ pathName: 'editview', parameterName: 'editview' },
],
requireAuth: true,
},
component: () => import('@pages/sales/lead-edit-view/lead-edit-view.vue'),
},
{
path: '/leads/:lead?/editview/:editview?',
meta: {
......
......@@ -62,6 +62,21 @@ export default class CampaignServiceBase extends EntityService {
*/
public async Create(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {};
let leadsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_leads'),'undefined')){
leadsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_leads') as any);
if(leadsData && leadsData.length && leadsData.length > 0){
leadsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.leadid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.leads = leadsData;
Object.assign(data,masterData);
if(!data.srffrontuf || data.srffrontuf !== "1"){
data[this.APPDEKEY] = null;
......@@ -71,6 +86,7 @@ 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));
return res;
}
......@@ -85,8 +101,24 @@ export default class CampaignServiceBase extends EntityService {
*/
public async Save(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {};
let leadsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_leads'),'undefined')){
leadsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_leads') as any);
if(leadsData && leadsData.length && leadsData.length > 0){
leadsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.leadid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.leads = leadsData;
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));
return res;
}
......@@ -102,6 +134,7 @@ 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));
return res;
}
......@@ -116,8 +149,24 @@ export default class CampaignServiceBase extends EntityService {
*/
public async Update(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {};
let leadsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_leads'),'undefined')){
leadsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_leads') as any);
if(leadsData && leadsData.length && leadsData.length > 0){
leadsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.leadid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.leads = leadsData;
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));
return res;
}
......@@ -132,6 +181,7 @@ 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));
return res;
}
......
......@@ -48,6 +48,9 @@ export default class LeadServiceBase extends EntityService {
* @memberof LeadServiceBase
*/
public async Select(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.campaign && context.lead){
return Http.getInstance().get(`/campaigns/${context.campaign}/leads/${context.lead}/select`,isloading);
}
return Http.getInstance().get(`/leads/${context.lead}/select`,isloading);
}
......@@ -61,6 +64,9 @@ export default class LeadServiceBase extends EntityService {
* @memberof LeadServiceBase
*/
public async Update(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.campaign && context.lead){
return Http.getInstance().put(`/campaigns/${context.campaign}/leads/${context.lead}`,data,isloading);
}
let masterData:any = {};
Object.assign(data,masterData);
let res:any = await Http.getInstance().put(`/leads/${context.lead}`,data,isloading);
......@@ -77,6 +83,9 @@ export default class LeadServiceBase extends EntityService {
* @memberof LeadServiceBase
*/
public async GetDraft(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.campaign && true){
return Http.getInstance().get(`/campaigns/${context.campaign}/leads/getdraft`,isloading);
}
let res:any = await Http.getInstance().get(`/leads/getdraft`,isloading);
res.data.lead = data.lead;
return res;
......@@ -92,6 +101,9 @@ export default class LeadServiceBase extends EntityService {
* @memberof LeadServiceBase
*/
public async CheckKey(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.campaign && context.lead){
return Http.getInstance().post(`/campaigns/${context.campaign}/leads/${context.lead}/checkkey`,data,isloading);
}
return Http.getInstance().post(`/leads/${context.lead}/checkkey`,data,isloading);
}
......@@ -105,6 +117,9 @@ export default class LeadServiceBase extends EntityService {
* @memberof LeadServiceBase
*/
public async Get(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.campaign && context.lead){
return Http.getInstance().get(`/campaigns/${context.campaign}/leads/${context.lead}`,isloading);
}
let res:any = await Http.getInstance().get(`/leads/${context.lead}`,isloading);
return res;
......@@ -120,6 +135,9 @@ export default class LeadServiceBase extends EntityService {
* @memberof LeadServiceBase
*/
public async Save(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.campaign && context.lead){
return Http.getInstance().post(`/campaigns/${context.campaign}/leads/${context.lead}/save`,data,isloading);
}
let masterData:any = {};
Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/leads/${context.lead}/save`,data,isloading);
......@@ -136,6 +154,15 @@ export default class LeadServiceBase extends EntityService {
* @memberof LeadServiceBase
*/
public async Create(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.campaign && true){
if(!data.srffrontuf || data.srffrontuf !== "1"){
data[this.APPDEKEY] = null;
}
if(data.srffrontuf){
delete data.srffrontuf;
}
return Http.getInstance().post(`/campaigns/${context.campaign}/leads`,data,isloading);
}
let masterData:any = {};
Object.assign(data,masterData);
if(!data.srffrontuf || data.srffrontuf !== "1"){
......@@ -159,6 +186,9 @@ export default class LeadServiceBase extends EntityService {
* @memberof LeadServiceBase
*/
public async Remove(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.campaign && context.lead){
return Http.getInstance().delete(`/campaigns/${context.campaign}/leads/${context.lead}`,isloading);
}
return Http.getInstance().delete(`/leads/${context.lead}`,isloading);
}
......@@ -173,6 +203,10 @@ export default class LeadServiceBase extends EntityService {
* @memberof LeadServiceBase
*/
public async FetchDefault(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.campaign && true){
let tempData:any = JSON.parse(JSON.stringify(data));
return Http.getInstance().get(`/campaigns/${context.campaign}/leads/fetchdefault`,tempData,isloading);
}
let tempData:any = JSON.parse(JSON.stringify(data));
return Http.getInstance().get(`/leads/fetchdefault`,tempData,isloading);
}
......
......@@ -4480,7 +4480,7 @@
<!--输出实体[ACCOUNT]数据结构 -->
<changeSet author="a_LAB01_e85d8801c" id="tab-account-195-53">
<changeSet author="a_LAB01_e85d8801c" id="tab-account-202-53">
<createTable tableName="ACCOUNT">
<column name="ADDRESS1_PRIMARYCONTACTNAME" remarks="" type="VARCHAR(100)">
</column>
......@@ -7334,7 +7334,7 @@
<!--输出实体[CAMPAIGN]数据结构 -->
<changeSet author="a_LAB01_e85d8801c" id="tab-campaign-59-75">
<changeSet author="a_LAB01_e85d8801c" id="tab-campaign-72-75">
<createTable tableName="CAMPAIGN">
<column name="EXPECTEDRESPONSE" remarks="" type="INT">
</column>
......@@ -8212,7 +8212,7 @@
<!--输出实体[PRODUCT]数据结构 -->
<changeSet author="a_LAB01_e85d8801c" id="tab-product-9-86">
<changeSet author="a_LAB01_e85d8801c" id="tab-product-11-86">
<createTable tableName="PRODUCT">
<column name="VENDORID" remarks="" type="VARCHAR(100)">
</column>
......@@ -11076,31 +11076,31 @@
<addForeignKeyConstraint baseColumnNames="METRICID" baseTableName="GOAL" constraintName="DER1N_GOAL__METRIC__METRICID" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="METRICID" referencedTableName="METRIC" validate="true"/>
</changeSet>
<!--输出实体[ACCOUNT]外键关系 -->
<changeSet author="a_LAB01_e85d8801c" id="fk-account-195-246">
<changeSet author="a_LAB01_e85d8801c" id="fk-account-202-246">
<addForeignKeyConstraint baseColumnNames="PARENTACCOUNTID" baseTableName="ACCOUNT" constraintName="DER1N_ACCOUNT__ACCOUNT__PARENT" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="ACCOUNTID" referencedTableName="ACCOUNT" validate="true"/>
</changeSet>
<changeSet author="a_LAB01_e85d8801c" id="fk-account-195-247">
<changeSet author="a_LAB01_e85d8801c" id="fk-account-202-247">
<addForeignKeyConstraint baseColumnNames="PRIMARYCONTACTID" baseTableName="ACCOUNT" constraintName="DER1N_ACCOUNT__CONTACT__PRIMAR" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="CONTACTID" referencedTableName="CONTACT" validate="true"/>
</changeSet>
<changeSet author="a_LAB01_e85d8801c" id="fk-account-195-248">
<changeSet author="a_LAB01_e85d8801c" id="fk-account-202-248">
<addForeignKeyConstraint baseColumnNames="PREFERREDEQUIPMENTID" baseTableName="ACCOUNT" constraintName="DER1N_ACCOUNT__EQUIPMENT__PREF" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="EQUIPMENTID" referencedTableName="EQUIPMENT" validate="true"/>
</changeSet>
<changeSet author="a_LAB01_e85d8801c" id="fk-account-195-249">
<changeSet author="a_LAB01_e85d8801c" id="fk-account-202-249">
<addForeignKeyConstraint baseColumnNames="ORIGINATINGLEADID" baseTableName="ACCOUNT" constraintName="DER1N_ACCOUNT__LEAD__ORIGINATI" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="LEADID" referencedTableName="LEAD" validate="true"/>
</changeSet>
<changeSet author="a_LAB01_e85d8801c" id="fk-account-195-250">
<changeSet author="a_LAB01_e85d8801c" id="fk-account-202-250">
<addForeignKeyConstraint baseColumnNames="DEFAULTPRICELEVELID" baseTableName="ACCOUNT" constraintName="DER1N_ACCOUNT__PRICELEVEL__DEF" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="PRICELEVELID" referencedTableName="PRICELEVEL" validate="true"/>
</changeSet>
<changeSet author="a_LAB01_e85d8801c" id="fk-account-195-251">
<changeSet author="a_LAB01_e85d8801c" id="fk-account-202-251">
<addForeignKeyConstraint baseColumnNames="PREFERREDSERVICEID" baseTableName="ACCOUNT" constraintName="DER1N_ACCOUNT__SERVICE__PREFER" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="SERVICEID" referencedTableName="SERVICE" validate="true"/>
</changeSet>
<changeSet author="a_LAB01_e85d8801c" id="fk-account-195-252">
<changeSet author="a_LAB01_e85d8801c" id="fk-account-202-252">
<addForeignKeyConstraint baseColumnNames="SLAID" baseTableName="ACCOUNT" constraintName="DER1N_ACCOUNT__SLA__SLAID" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="SLAID" referencedTableName="SLA" validate="true"/>
</changeSet>
<changeSet author="a_LAB01_e85d8801c" id="fk-account-195-253">
<changeSet author="a_LAB01_e85d8801c" id="fk-account-202-253">
<addForeignKeyConstraint baseColumnNames="TERRITORYID" baseTableName="ACCOUNT" constraintName="DER1N_ACCOUNT__TERRITORY__TERR" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="TERRITORYID" referencedTableName="TERRITORY" validate="true"/>
</changeSet>
<changeSet author="a_LAB01_e85d8801c" id="fk-account-195-254">
<changeSet author="a_LAB01_e85d8801c" id="fk-account-202-254">
<addForeignKeyConstraint baseColumnNames="TRANSACTIONCURRENCYID" baseTableName="ACCOUNT" constraintName="DER1N_ACCOUNT__TRANSACTIONCURR" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="TRANSACTIONCURRENCYID" referencedTableName="TRANSACTIONCURRENCY" validate="true"/>
</changeSet>
<!--输出实体[KNOWLEDGEARTICLEVIEWS]外键关系 -->
......@@ -11281,10 +11281,10 @@
<addForeignKeyConstraint baseColumnNames="BASECURRENCYID" baseTableName="ORGANIZATION" constraintName="DER1N_ORGANIZATION__TRANSACTIO" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="TRANSACTIONCURRENCYID" referencedTableName="TRANSACTIONCURRENCY" validate="true"/>
</changeSet>
<!--输出实体[CAMPAIGN]外键关系 -->
<changeSet author="a_LAB01_e85d8801c" id="fk-campaign-59-311">
<changeSet author="a_LAB01_e85d8801c" id="fk-campaign-72-311">
<addForeignKeyConstraint baseColumnNames="PRICELISTID" baseTableName="CAMPAIGN" constraintName="DER1N_CAMPAIGN__PRICELEVEL__PR" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="PRICELEVELID" referencedTableName="PRICELEVEL" validate="true"/>
</changeSet>
<changeSet author="a_LAB01_e85d8801c" id="fk-campaign-59-312">
<changeSet author="a_LAB01_e85d8801c" id="fk-campaign-72-312">
<addForeignKeyConstraint baseColumnNames="TRANSACTIONCURRENCYID" baseTableName="CAMPAIGN" constraintName="DER1N_CAMPAIGN__TRANSACTIONCUR" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="TRANSACTIONCURRENCYID" referencedTableName="TRANSACTIONCURRENCY" validate="true"/>
</changeSet>
<!--输出实体[BOOKABLERESCHARACTERISTIC]外键关系 -->
......@@ -11361,22 +11361,22 @@
<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]外键关系 -->
<changeSet author="a_LAB01_e85d8801c" id="fk-product-9-338">
<changeSet author="a_LAB01_e85d8801c" id="fk-product-11-338">
<addForeignKeyConstraint baseColumnNames="PRICELEVELID" baseTableName="PRODUCT" constraintName="DER1N_PRODUCT__PRICELEVEL__PRI" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="PRICELEVELID" referencedTableName="PRICELEVEL" validate="true"/>
</changeSet>
<changeSet author="a_LAB01_e85d8801c" id="fk-product-9-339">
<changeSet author="a_LAB01_e85d8801c" id="fk-product-11-339">
<addForeignKeyConstraint baseColumnNames="PARENTPRODUCTID" baseTableName="PRODUCT" constraintName="DER1N_PRODUCT__PRODUCT__PARENT" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="PRODUCTID" referencedTableName="PRODUCT" validate="true"/>
</changeSet>
<changeSet author="a_LAB01_e85d8801c" id="fk-product-9-340">
<changeSet author="a_LAB01_e85d8801c" id="fk-product-11-340">
<addForeignKeyConstraint baseColumnNames="SUBJECTID" baseTableName="PRODUCT" constraintName="DER1N_PRODUCT__SUBJECT__SUBJEC" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="SUBJECTID" referencedTableName="SUBJECT" validate="true"/>
</changeSet>
<changeSet author="a_LAB01_e85d8801c" id="fk-product-9-341">
<changeSet author="a_LAB01_e85d8801c" id="fk-product-11-341">
<addForeignKeyConstraint baseColumnNames="TRANSACTIONCURRENCYID" baseTableName="PRODUCT" constraintName="DER1N_PRODUCT__TRANSACTIONCURR" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="TRANSACTIONCURRENCYID" referencedTableName="TRANSACTIONCURRENCY" validate="true"/>
</changeSet>
<changeSet author="a_LAB01_e85d8801c" id="fk-product-9-342">
<changeSet author="a_LAB01_e85d8801c" id="fk-product-11-342">
<addForeignKeyConstraint baseColumnNames="DEFAULTUOMSCHEDULEID" baseTableName="PRODUCT" constraintName="DER1N_PRODUCT__UOMSCHEDULE__DE" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="UOMSCHEDULEID" referencedTableName="UOMSCHEDULE" validate="true"/>
</changeSet>
<changeSet author="a_LAB01_e85d8801c" id="fk-product-9-343">
<changeSet author="a_LAB01_e85d8801c" id="fk-product-11-343">
<addForeignKeyConstraint baseColumnNames="DEFAULTUOMID" baseTableName="PRODUCT" constraintName="DER1N_PRODUCT__UOM__DEFAULTUOM" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="UOMID" referencedTableName="UOM" validate="true"/>
</changeSet>
<!--输出实体[CHARACTERISTIC]外键关系 -->
......
......@@ -158,5 +158,137 @@ public class LeadResource {
return ResponseEntity.status(HttpStatus.OK)
.body(new PageImpl(leadMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
}
@PreAuthorize("hasPermission(this.leadService.get(#lead_id),'iBizBusinessCentral-Lead-Update')")
@ApiOperation(value = "根据市场活动更新潜在顾客", tags = {"潜在顾客" }, notes = "根据市场活动更新潜在顾客")
@RequestMapping(method = RequestMethod.PUT, value = "/campaigns/{campaign_id}/leads/{lead_id}")
@Transactional
public ResponseEntity<LeadDTO> updateByCampaign(@PathVariable("campaign_id") String campaign_id, @PathVariable("lead_id") String lead_id, @RequestBody LeadDTO leaddto) {
Lead domain = leadMapping.toDomain(leaddto);
domain.setCampaignid(campaign_id);
domain.setLeadid(lead_id);
leadService.update(domain);
LeadDTO dto = leadMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission(this.leadService.getLeadByEntities(this.leadMapping.toDomain(#leaddtos)),'iBizBusinessCentral-Lead-Update')")
@ApiOperation(value = "根据市场活动批量更新潜在顾客", tags = {"潜在顾客" }, notes = "根据市场活动批量更新潜在顾客")
@RequestMapping(method = RequestMethod.PUT, value = "/campaigns/{campaign_id}/leads/batch")
public ResponseEntity<Boolean> updateBatchByCampaign(@PathVariable("campaign_id") String campaign_id, @RequestBody List<LeadDTO> leaddtos) {
List<Lead> domainlist=leadMapping.toDomain(leaddtos);
for(Lead domain:domainlist){
domain.setCampaignid(campaign_id);
}
leadService.updateBatch(domainlist);
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@ApiOperation(value = "根据市场活动获取潜在顾客草稿", tags = {"潜在顾客" }, notes = "根据市场活动获取潜在顾客草稿")
@RequestMapping(method = RequestMethod.GET, value = "/campaigns/{campaign_id}/leads/getdraft")
public ResponseEntity<LeadDTO> getDraftByCampaign(@PathVariable("campaign_id") String campaign_id) {
Lead domain = new Lead();
domain.setCampaignid(campaign_id);
return ResponseEntity.status(HttpStatus.OK).body(leadMapping.toDto(leadService.getDraft(domain)));
}
@ApiOperation(value = "根据市场活动检查潜在顾客", tags = {"潜在顾客" }, notes = "根据市场活动检查潜在顾客")
@RequestMapping(method = RequestMethod.POST, value = "/campaigns/{campaign_id}/leads/checkkey")
public ResponseEntity<Boolean> checkKeyByCampaign(@PathVariable("campaign_id") String campaign_id, @RequestBody LeadDTO leaddto) {
return ResponseEntity.status(HttpStatus.OK).body(leadService.checkKey(leadMapping.toDomain(leaddto)));
}
@PostAuthorize("hasPermission(this.leadMapping.toDomain(returnObject.body),'iBizBusinessCentral-Lead-Get')")
@ApiOperation(value = "根据市场活动获取潜在顾客", tags = {"潜在顾客" }, notes = "根据市场活动获取潜在顾客")
@RequestMapping(method = RequestMethod.GET, value = "/campaigns/{campaign_id}/leads/{lead_id}")
public ResponseEntity<LeadDTO> getByCampaign(@PathVariable("campaign_id") String campaign_id, @PathVariable("lead_id") String lead_id) {
Lead domain = leadService.get(lead_id);
LeadDTO dto = leadMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission(this.leadMapping.toDomain(#leaddto),'iBizBusinessCentral-Lead-Save')")
@ApiOperation(value = "根据市场活动保存潜在顾客", tags = {"潜在顾客" }, notes = "根据市场活动保存潜在顾客")
@RequestMapping(method = RequestMethod.POST, value = "/campaigns/{campaign_id}/leads/save")
public ResponseEntity<Boolean> saveByCampaign(@PathVariable("campaign_id") String campaign_id, @RequestBody LeadDTO leaddto) {
Lead domain = leadMapping.toDomain(leaddto);
domain.setCampaignid(campaign_id);
return ResponseEntity.status(HttpStatus.OK).body(leadService.save(domain));
}
@PreAuthorize("hasPermission(this.leadMapping.toDomain(#leaddtos),'iBizBusinessCentral-Lead-Save')")
@ApiOperation(value = "根据市场活动批量保存潜在顾客", tags = {"潜在顾客" }, notes = "根据市场活动批量保存潜在顾客")
@RequestMapping(method = RequestMethod.POST, value = "/campaigns/{campaign_id}/leads/savebatch")
public ResponseEntity<Boolean> saveBatchByCampaign(@PathVariable("campaign_id") String campaign_id, @RequestBody List<LeadDTO> leaddtos) {
List<Lead> domainlist=leadMapping.toDomain(leaddtos);
for(Lead domain:domainlist){
domain.setCampaignid(campaign_id);
}
leadService.saveBatch(domainlist);
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasPermission(this.leadMapping.toDomain(#leaddto),'iBizBusinessCentral-Lead-Create')")
@ApiOperation(value = "根据市场活动建立潜在顾客", tags = {"潜在顾客" }, notes = "根据市场活动建立潜在顾客")
@RequestMapping(method = RequestMethod.POST, value = "/campaigns/{campaign_id}/leads")
@Transactional
public ResponseEntity<LeadDTO> createByCampaign(@PathVariable("campaign_id") String campaign_id, @RequestBody LeadDTO leaddto) {
Lead domain = leadMapping.toDomain(leaddto);
domain.setCampaignid(campaign_id);
leadService.create(domain);
LeadDTO dto = leadMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission(this.leadMapping.toDomain(#leaddtos),'iBizBusinessCentral-Lead-Create')")
@ApiOperation(value = "根据市场活动批量建立潜在顾客", tags = {"潜在顾客" }, notes = "根据市场活动批量建立潜在顾客")
@RequestMapping(method = RequestMethod.POST, value = "/campaigns/{campaign_id}/leads/batch")
public ResponseEntity<Boolean> createBatchByCampaign(@PathVariable("campaign_id") String campaign_id, @RequestBody List<LeadDTO> leaddtos) {
List<Lead> domainlist=leadMapping.toDomain(leaddtos);
for(Lead domain:domainlist){
domain.setCampaignid(campaign_id);
}
leadService.createBatch(domainlist);
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasPermission(this.leadService.get(#lead_id),'iBizBusinessCentral-Lead-Remove')")
@ApiOperation(value = "根据市场活动删除潜在顾客", tags = {"潜在顾客" }, notes = "根据市场活动删除潜在顾客")
@RequestMapping(method = RequestMethod.DELETE, value = "/campaigns/{campaign_id}/leads/{lead_id}")
@Transactional
public ResponseEntity<Boolean> removeByCampaign(@PathVariable("campaign_id") String campaign_id, @PathVariable("lead_id") String lead_id) {
return ResponseEntity.status(HttpStatus.OK).body(leadService.remove(lead_id));
}
@PreAuthorize("hasPermission(this.leadService.getLeadByIds(#ids),'iBizBusinessCentral-Lead-Remove')")
@ApiOperation(value = "根据市场活动批量删除潜在顾客", tags = {"潜在顾客" }, notes = "根据市场活动批量删除潜在顾客")
@RequestMapping(method = RequestMethod.DELETE, value = "/campaigns/{campaign_id}/leads/batch")
public ResponseEntity<Boolean> removeBatchByCampaign(@RequestBody List<String> ids) {
leadService.removeBatch(ids);
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Lead-Default-all')")
@ApiOperation(value = "根据市场活动获取DEFAULT", tags = {"潜在顾客" } ,notes = "根据市场活动获取DEFAULT")
@RequestMapping(method= RequestMethod.GET , value="/campaigns/{campaign_id}/leads/fetchdefault")
public ResponseEntity<List<LeadDTO>> fetchLeadDefaultByCampaign(@PathVariable("campaign_id") String campaign_id,LeadSearchContext context) {
context.setN_campaignid_eq(campaign_id);
Page<Lead> domains = leadService.searchDefault(context) ;
List<LeadDTO> list = leadMapping.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-Lead-Default-all')")
@ApiOperation(value = "根据市场活动查询DEFAULT", tags = {"潜在顾客" } ,notes = "根据市场活动查询DEFAULT")
@RequestMapping(method= RequestMethod.POST , value="/campaigns/{campaign_id}/leads/searchdefault")
public ResponseEntity<Page<LeadDTO>> searchLeadDefaultByCampaign(@PathVariable("campaign_id") String campaign_id, @RequestBody LeadSearchContext context) {
context.setN_campaignid_eq(campaign_id);
Page<Lead> domains = leadService.searchDefault(context) ;
return ResponseEntity.status(HttpStatus.OK)
.body(new PageImpl(leadMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
}
}
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册