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

xignzi006 发布系统代码

上级 dfc9d5f0
...@@ -930,7 +930,12 @@ export default class LeadGridViewBase extends Vue { ...@@ -930,7 +930,12 @@ export default class LeadGridViewBase extends Vue {
if(args.length >0){ if(args.length >0){
Object.assign(tempContext,args[0]); Object.assign(tempContext,args[0]);
} }
const deResParameters: any[] = []; let deResParameters: any[] = [];
if(tempContext.campaign && true){
deResParameters = [
{ pathName: 'campaigns', parameterName: 'campaign' },
]
}
const parameters: any[] = [ const parameters: any[] = [
{ pathName: 'leads', parameterName: 'lead' }, { pathName: 'leads', parameterName: 'lead' },
{ pathName: 'editview', parameterName: 'editview' }, { pathName: 'editview', parameterName: 'editview' },
...@@ -964,7 +969,12 @@ export default class LeadGridViewBase extends Vue { ...@@ -964,7 +969,12 @@ export default class LeadGridViewBase extends Vue {
if(args.length >0){ if(args.length >0){
Object.assign(tempContext,args[0]); Object.assign(tempContext,args[0]);
} }
const deResParameters: any[] = []; let deResParameters: any[] = [];
if(tempContext.campaign && true){
deResParameters = [
{ pathName: 'campaigns', parameterName: 'campaign' },
]
}
const parameters: any[] = [ const parameters: any[] = [
{ pathName: 'leads', parameterName: 'lead' }, { pathName: 'leads', parameterName: 'lead' },
{ pathName: 'editview', parameterName: 'editview' }, { pathName: 'editview', parameterName: 'editview' },
......
...@@ -189,6 +189,21 @@ const router = new Router({ ...@@ -189,6 +189,21 @@ const router = new Router({
}, },
component: () => import('@pages/base/activity-pointer-edit-view/activity-pointer-edit-view.vue'), 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?', path: 'leads/:lead?/gridview/:gridview?',
meta: { meta: {
...@@ -916,6 +931,21 @@ const router = new Router({ ...@@ -916,6 +931,21 @@ const router = new Router({
}, },
component: () => import('@pages/base/activity-pointer-by-parent-key/activity-pointer-by-parent-key.vue'), 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?', path: 'leads/:lead?/editview/:editview?',
meta: { meta: {
...@@ -1190,6 +1220,20 @@ const router = new Router({ ...@@ -1190,6 +1220,20 @@ const router = new Router({
}, },
component: () => import('@pages/marketing/campaign-info-campagin/campaign-info-campagin.vue'), 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?', path: '/leads/:lead?/gridview/:gridview?',
meta: { meta: {
...@@ -1255,6 +1299,20 @@ const router = new Router({ ...@@ -1255,6 +1299,20 @@ const router = new Router({
}, },
component: () => import('@pages/base/account-pickup-view/account-pickup-view.vue'), 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?', path: '/leads/:lead?/editview/:editview?',
meta: { meta: {
......
...@@ -62,6 +62,21 @@ export default class CampaignServiceBase extends EntityService { ...@@ -62,6 +62,21 @@ export default class CampaignServiceBase extends EntityService {
*/ */
public async Create(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async Create(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData: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); Object.assign(data,masterData);
if(!data.srffrontuf || data.srffrontuf !== "1"){ if(!data.srffrontuf || data.srffrontuf !== "1"){
data[this.APPDEKEY] = null; data[this.APPDEKEY] = null;
...@@ -71,6 +86,7 @@ export default class CampaignServiceBase extends EntityService { ...@@ -71,6 +86,7 @@ export default class CampaignServiceBase extends EntityService {
} }
let tempContext:any = JSON.parse(JSON.stringify(context)); let tempContext:any = JSON.parse(JSON.stringify(context));
let res:any = await Http.getInstance().post(`/campaigns`,data,isloading); let res:any = await Http.getInstance().post(`/campaigns`,data,isloading);
this.tempStorage.setItem(tempContext.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
return res; return res;
} }
...@@ -85,8 +101,24 @@ export default class CampaignServiceBase extends EntityService { ...@@ -85,8 +101,24 @@ export default class CampaignServiceBase extends EntityService {
*/ */
public async Save(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async Save(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData: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); Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/campaigns/${context.campaign}/save`,data,isloading); 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; return res;
} }
...@@ -102,6 +134,7 @@ export default class CampaignServiceBase extends EntityService { ...@@ -102,6 +134,7 @@ export default class CampaignServiceBase extends EntityService {
public async GetDraft(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async GetDraft(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().get(`/campaigns/getdraft`,isloading); let res:any = await Http.getInstance().get(`/campaigns/getdraft`,isloading);
res.data.campaign = data.campaign; res.data.campaign = data.campaign;
this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
return res; return res;
} }
...@@ -116,8 +149,24 @@ export default class CampaignServiceBase extends EntityService { ...@@ -116,8 +149,24 @@ export default class CampaignServiceBase extends EntityService {
*/ */
public async Update(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async Update(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData: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); Object.assign(data,masterData);
let res:any = await Http.getInstance().put(`/campaigns/${context.campaign}`,data,isloading); 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; return res;
} }
...@@ -132,6 +181,7 @@ export default class CampaignServiceBase extends EntityService { ...@@ -132,6 +181,7 @@ export default class CampaignServiceBase extends EntityService {
*/ */
public async Get(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async Get(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().get(`/campaigns/${context.campaign}`,isloading); let res:any = await Http.getInstance().get(`/campaigns/${context.campaign}`,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
return res; return res;
} }
......
...@@ -48,6 +48,9 @@ export default class LeadServiceBase extends EntityService { ...@@ -48,6 +48,9 @@ export default class LeadServiceBase extends EntityService {
* @memberof LeadServiceBase * @memberof LeadServiceBase
*/ */
public async Select(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { 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); return Http.getInstance().get(`/leads/${context.lead}/select`,isloading);
} }
...@@ -61,6 +64,9 @@ export default class LeadServiceBase extends EntityService { ...@@ -61,6 +64,9 @@ export default class LeadServiceBase extends EntityService {
* @memberof LeadServiceBase * @memberof LeadServiceBase
*/ */
public async Update(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { 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 = {}; let masterData:any = {};
Object.assign(data,masterData); Object.assign(data,masterData);
let res:any = await Http.getInstance().put(`/leads/${context.lead}`,data,isloading); let res:any = await Http.getInstance().put(`/leads/${context.lead}`,data,isloading);
...@@ -77,6 +83,9 @@ export default class LeadServiceBase extends EntityService { ...@@ -77,6 +83,9 @@ export default class LeadServiceBase extends EntityService {
* @memberof LeadServiceBase * @memberof LeadServiceBase
*/ */
public async GetDraft(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { 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); let res:any = await Http.getInstance().get(`/leads/getdraft`,isloading);
res.data.lead = data.lead; res.data.lead = data.lead;
return res; return res;
...@@ -92,6 +101,9 @@ export default class LeadServiceBase extends EntityService { ...@@ -92,6 +101,9 @@ export default class LeadServiceBase extends EntityService {
* @memberof LeadServiceBase * @memberof LeadServiceBase
*/ */
public async CheckKey(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { 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); return Http.getInstance().post(`/leads/${context.lead}/checkkey`,data,isloading);
} }
...@@ -105,6 +117,9 @@ export default class LeadServiceBase extends EntityService { ...@@ -105,6 +117,9 @@ export default class LeadServiceBase extends EntityService {
* @memberof LeadServiceBase * @memberof LeadServiceBase
*/ */
public async Get(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { 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); let res:any = await Http.getInstance().get(`/leads/${context.lead}`,isloading);
return res; return res;
...@@ -120,6 +135,9 @@ export default class LeadServiceBase extends EntityService { ...@@ -120,6 +135,9 @@ export default class LeadServiceBase extends EntityService {
* @memberof LeadServiceBase * @memberof LeadServiceBase
*/ */
public async Save(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { 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 = {}; let masterData:any = {};
Object.assign(data,masterData); Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/leads/${context.lead}/save`,data,isloading); let res:any = await Http.getInstance().post(`/leads/${context.lead}/save`,data,isloading);
...@@ -136,6 +154,15 @@ export default class LeadServiceBase extends EntityService { ...@@ -136,6 +154,15 @@ export default class LeadServiceBase extends EntityService {
* @memberof LeadServiceBase * @memberof LeadServiceBase
*/ */
public async Create(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { 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 = {}; let masterData:any = {};
Object.assign(data,masterData); Object.assign(data,masterData);
if(!data.srffrontuf || data.srffrontuf !== "1"){ if(!data.srffrontuf || data.srffrontuf !== "1"){
...@@ -159,6 +186,9 @@ export default class LeadServiceBase extends EntityService { ...@@ -159,6 +186,9 @@ export default class LeadServiceBase extends EntityService {
* @memberof LeadServiceBase * @memberof LeadServiceBase
*/ */
public async Remove(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { 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); return Http.getInstance().delete(`/leads/${context.lead}`,isloading);
} }
...@@ -173,6 +203,10 @@ export default class LeadServiceBase extends EntityService { ...@@ -173,6 +203,10 @@ export default class LeadServiceBase extends EntityService {
* @memberof LeadServiceBase * @memberof LeadServiceBase
*/ */
public async FetchDefault(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { 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)); let tempData:any = JSON.parse(JSON.stringify(data));
return Http.getInstance().get(`/leads/fetchdefault`,tempData,isloading); return Http.getInstance().get(`/leads/fetchdefault`,tempData,isloading);
} }
......
...@@ -158,5 +158,137 @@ public class LeadResource { ...@@ -158,5 +158,137 @@ public class LeadResource {
return ResponseEntity.status(HttpStatus.OK) return ResponseEntity.status(HttpStatus.OK)
.body(new PageImpl(leadMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements())); .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 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册