Fx.crm

Fx.crm:和CRM操作相关的API

1. 产品

Fx.crm.getProduct()

返回值类型

ProductAPI

(1).参考ProductAPI

2. 线索

Fx.crm.getLeads()

返回值类型

LeadsAPI

(1).参考LeadsAPI

3. 客户

Fx.crm.getAccount()

返回值类型

AccountAPI

(1).参考AccountAPI

4. 通过公司名称模糊查询工商信息

Fx.crm.getEnterpriseByName(<String companyName>)

参数说明

参数 类型 说明
companyName String 公司名称

返回值类型

APIResult

返回值说明

List

Java举例

APIResult ret = Fx.crm.getEnterpriseByName("百度");
if (ret.isError()) {
    log.info(ret.message());
} else {
    log.info(ret.getData());
}

Groovy举例

def(Boolean error, List data, String errorMessage) = Fx.crm.getEnterpriseByName("百度")

5. 通过companyId查询工商信息

Fx.crm.getEnterpriseDetailById(<String companyId>)

参数说明

参数 类型 说明
companyId String

返回值类型

APIResult

返回值说明

Map

Java举例

APIResult ret = Fx.crm.getEnterpriseDetailById("1644990310");
if (ret.isError()) {
    log.info(ret.message());
} else {
    log.info(ret.getData());
}

Groovy举例

def(Boolean error, Map data, String errorMessage) = Fx.crm.getEnterpriseDetailById("1644990310")

参考类 com.fxiaoke.functions.api.ProductAPI

1. 产品上架下架

shelf(<String productId>, <int status>)

参数说明

参数 类型 说明
productId String 产品id
status int status = 1上架,status = 2 下架

返回值类型

APIResult

返回值说明

Map

Java举例

APIResult ret = Fx.crm.getProduct().shelf("e1e145095f8142c891802fa36fcbd4c6", 1); //上架产品
APIResult ret1 = Fx.crm.getProduct().shelf("e1e145095f8142c891802fa36fcbd4c6", 2); //下架产品

Groovy举例:

def (Boolean err,Map data,String errorMessage) = Fx.crm.product.shelf("e1e145095f8142c891802fa36fcbd4c6", 1) //上架产品
def (Boolean err,Map data,String errorMessage) = Fx.crm.product.shelf("e1e145095f8142c891802fa36fcbd4c6",2) //下架产品

2. 创建产品分类

createProductCategory(<String name>, <String categoryCode>, <String pid>)

参数说明

参数 类型 说明
name String 产品分类名称
categoryCode String 产品分类编码
pid String 父类产品Id

返回值类型

APIResult

返回值说明

Map

Java举例

APIResult ret = Fx.crm.getProduct().createProductCategory("产品分类名","产品分类编码",null);
APIResult ret1 = Fx.crm.getProduct().createProductCategory("产品分类名","产品分类编码","123");

Groovy举例:

def (Boolean err,Map data,String errorMessage) = Fx.crm.product.createProductCategory("产品分类名","产品分类编码",null)
def (Boolean err,Map data,String errorMessage) = Fx.crm.product.createProductCategory("产品分类名","产品分类编码","123")

3. 删除产品分类

deleteProductCategory(<String id>)

参数说明

参数 类型 说明
id String 产品分类id

返回值类型

APIResult

返回值说明

Map

Java举例

APIResult ret = Fx.crm.getProduct().deleteProductCategory("d23r23fc234143jhsuad");
if (ret.isError()) {
    log.info(ret.message());
} else {
    log.info(ret.getData());
}

Groovy举例:

def res = (((Fx.object.find("ProductCategoryObj",[["category_code":"111"]],  10,  0)[1]) as QueryResult).dataList[0] as Map)
def id = (res._id) as String
def (Boolean error,Map data,String errorMessage) = Fx.crm.product.deleteProductCategory(id)
log.info(data)

4. 修改产品分类

updateProductCategory(<String id>, <Map arg>)

参数说明

参数 类型 说明
id String 产品分类id
arg Map 更新产品分类内容

返回值类型

APIResult

返回值说明

Map

Java举例

Map<String, Object>map = Maps.newHashMap();
map.put("name", "111");
map.put("categoryCode", "222");
APIResult ret = Fx.crm.getProduct().updateProductCategory("d23r23fc234143", map);
if (ret.isError()) {
    log.info(ret.message());
} else {
    log.info(ret.getData());
}

Groovy举例:

def res = (((Fx.object.find("ProductCategoryObj",[["category_code":"111"]], 10, 0)[1]) as QueryResult).dataList[0] as Map)
def id = (res._id) as String
Map map = ["name":"111","categoryCode":"222"]
//修该产品分类
def (boolean err,Map dataList,String errorMessage) = Fx.crm.product.updateProductCategory(id,map)

参考类 com.fxiaoke.functions.api.LeadsAPI

1. 线索转移

move(<String leadsId>, <String leadsPoolId>)

参数说明

参数 类型 说明
leadsId String 线索Id
leadsPoolId String 线索池Id

返回值类型

APIResult

返回值说明

String

Java举例

APIResult ret =  Fx.crm.getLeads().move("05f3f656feb9496abaa4cf50f1fa22ce", "85f454b044894f83a57e1bacfd2f1beb");
if (ret.isError()) {
    log.info(ret.message());
} else {
    log.info(ret.getData());
}

Groovy举例:

def (Boolean err,String data,String errorMessage) = Fx.crm.leads.move("05f3f656feb9496abaa4cf50f1fa22ce", "85f454b044894f83a57e1bacfd2f1beb")

2. 线索退回

giveBack(<String leadsId>, <String leadsPoolId>)

参数说明

参数 类型 说明
leadsId String 线索Id
leadsPoolId String 线索池Id

返回值类型

APIResult

返回值说明

String

Java举例

APIResult ret = Fx.crm.getLeads().giveBack("05f3f656feb9496abaa4cf50f1fa22ce", "85f454b044894f83a57e1bacfd2f1beb");
if (ret.isError()) {
    log.info(ret.message());
} else {
    log.info(ret.getData());
}

Groovy举例:

Fx.crm.leads.giveBack("05f3f656feb9496abaa4cf50f1fa22ce", "85f454b044894f83a57e1bacfd2f1beb")

3. 线索分配

allocate(<List accountIds>, <String leadsPoolId>, <String ownerId>)

参数说明

参数 类型 说明
accountIds List 线索Id列表
leadsPoolId String 线索池Id
ownerId String 用户id

返回值类型

APIResult

返回值说明

String

Java举例

APIResult ret = Fx.crm.getLeads().allocate(Lists.newArrayList("3ed01dcafbe4402d99d7a521aaa4e9c3"), "85f454b044894f83a57e1bacfd2f1beb", "1025");
if (ret.isError()) {
    log.info(ret.message());
} else {
    log.info(ret.getData());
}

Groovy举例:

Fx.crm.leads.allocate(["3ed01dcafbe4402d99d7a521aaa4e9c3"], "85f454b044894f83a57e1bacfd2f1beb", "1025")

4. 线索收回

takeBack(<List accountIds>, <String leadsPoolId>)

参数说明

参数 类型 说明
accountIds List 线索Id列表
leadsPoolId String 线索池Id

返回值类型

APIResult

返回值说明

String

Java举例

APIResult ret = Fx.crm.getLeads().takeBack(Lists.newArrayList("3ed01dcafbe4402d99d7a521aaa4e9c3"), "85f454b044894f83a57e1bacfd2f1beb");
if (ret.isError()) {
    log.info(ret.message());
} else {
    log.info(ret.getData());
}

Groovy举例:

Fx.crm.leads.takeBack(["3ed01dcafbe4402d99d7a521aaa4e9c3"], "85f454b044894f83a57e1bacfd2f1beb")

5. 线索一转三

transfer(<boolean combineCRMFeed>, <boolean putTeamMembersIntoCustomer>, <String leadsId>, <Map account>, <Map contact>, <Map newOpportunity>, <Map opportunity>)

参数说明

参数 类型 说明
combineCRMFeed boolean 销售线索的销售记录自动带入客户
putTeamMembersIntoCustomer boolean 销售线索的相关团队自动带入客户
leadsId String 销售线索的id
account Map 客户的Map , 如果存在_id 则关联旧客户,如果不存在id 则创建新客户
contact Map 转换成联系人的Map
newOpportunity Map 转换成商机2。0的数据
opportunity Map 转换成商机的数据

返回值类型

APIResult

Java举例

String leadsId = "05f3f656feb9496abaa4cf50f1fa22ce";
Map<String, Object>account = Maps.newHashMap();
account.put("object_describe_api_name", "AccountObj");
account.put("record_type", "default__c");
account.put("created_by", Lists.newArrayList("1109"));
account.put("name", "hello");

Map<String, Object>contact = Maps.newHashMap();
Map<String, Object>newOpportunity = Maps.newHashMap();
Map<String, Object>opportunity = Maps.newHashMap();

APIResult ret = Fx.crm.getLeads().transfer(true, true, leadsId, account, contact, newOpportunity, opportunity);
if (ret.isError()) {
    log.info(ret.message());
} else {
    log.info(ret.getData());
}

Groovy举例:

String leadsId = "05f3f656feb9496abaa4cf50f1fa22ce"
Map account = [
  "object_describe_api_name": "AccountObj",
  "record_type": "default__c",
  "created_by": [
    "1109"
  ],
  "name": "hello"
]
Map contact = [:]
Map newOpportunity = [:]
Map opportunity = [:]
def(boolean error, Object data, String msg) = Fx.crm.leads.transfer(true, true, leadsId, account, contact, newOpportunity, opportunity)
if (error) {
  log.info(data)
} else {
  log.info(msg)
}

参考类 com.fxiaoke.functions.api.AccountAPI

1. 客户转移公海

move(<String accountId>, <String highSeaId>)

参数说明

参数 类型 说明
accountId String 客户Id
highSeaId String 公海Id

返回值类型

APIResult

返回值说明

String

Java举例

APIResult ret = Fx.crm.getAccount().move("ad14bbbcede240a48dc2f65787a8763d","6c1a6a54617245fe90aae5a162eb191d");
if (ret.isError()) {
    log.info(ret.message());
} else {
    log.info(ret.getData());
}

Groovy举例:

Fx.crm.account.move("ad14bbbcede240a48dc2f65787a8763d","6c1a6a54617245fe90aae5a162eb191d")

2. 客户移除公海

remove(<String accountId>, <String highSeaId>, <String owner>)

参数说明

参数 类型 说明
accountId String 客户Id
highSeaId String 公海Id
owner String 负责人id

返回值类型

APIResult

返回值说明

String

Java举例

APIResult ret = Fx.crm.getAccount().remove("ad14bbbcede240a48dc2f65787a8763d","6c1a6a54617245fe90aae5a162eb191d","1000");
if (ret.isError()) {
    log.info(ret.message());
} else {
    log.info(ret.getData());
}

Groovy举例:

Fx.crm.account.remove("ad14bbbcede240a48dc2f65787a8763d","6c1a6a54617245fe90aae5a162eb191d","1000")

3. 客户退回公海

giveBack(<String accountId>, <String highSeaId>)

参数说明

参数 类型 说明
accountId String 客户Id
highSeaId String 公海Id

返回值类型

APIResult

返回值说明

String

Java举例

APIResult ret = Fx.crm.getAccount().giveBack("ad14bbbcede240a48dc2f65787a8763d","6c1a6a54617245fe90aae5a162eb191d");
if (ret.isError()) {
    log.info(ret.message());
} else {
    log.info(ret.getData());
}

Groovy举例:

Fx.crm.account.giveBack("ad14bbbcede240a48dc2f65787a8763d","6c1a6a54617245fe90aae5a162eb191d")

4. 客户领取

takeOut(<List accountIds>)

参数说明

参数 类型 说明
accountIds List 客户Id列表

返回值类型

APIResult

返回值说明

String

Java举例

APIResult ret = Fx.crm.getAccount().takeOut(Lists.newArrayList("ad14bbbcede240a48dc2f65787a8763d", "6c1a6a54617245fe90aae5a162eb191d"));
if (ret.isError()) {
    log.info(ret.message());
} else {
    log.info(ret.getData());
}

Groovy举例:

Fx.crm.account.takeOut(["ad14bbbcede240a48dc2f65787a8763d", "6c1a6a54617245fe90aae5a162eb191d"])

5. 客户分配

allocate(<List accountIds>, <String highSeaId>, <String ownerId>)

参数说明

参数 类型 说明
accountIds List 客户Id列表
highSeaId String 公海Id
ownerId String 用户Id

返回值类型

APIResult

返回值说明

String

Java举例

APIResult ret = Fx.crm.getAccount().allocate(Lists.newArrayList("cd097b120f584533b627c40239ece7d0"),"0ebc054e55254b8b89f09d7ac7602972","1025");
if (ret.isError()) {
    log.info(ret.message());
} else {
    log.info(ret.getData());
}

Groovy举例:

Fx.crm.account.allocate(["cd097b120f584533b627c40239ece7d0"],"0ebc054e55254b8b89f09d7ac7602972","1025")

6. 客户收回

takeBack(<List accountIds>, <String highSeaId>)

参数说明

参数 类型 说明
accountIds List 客户Id列表
highSeaId String 公海Id

返回值类型

APIResult

返回值说明

String

Java举例

APIResult ret = Fx.crm.getAccount().takeBack(Lists.newArrayList("cd097b120f584533b627c40239ece7d0"),"0ebc054e55254b8b89f09d7ac7602972");
if (ret.isError()) {
    log.info(ret.message());
} else {
    log.info(ret.getData());
}

Groovy举例:

Fx.crm.account.takeBack(["cd097b120f584533b627c40239ece7d0"],"0ebc054e55254b8b89f09d7ac7602972")

results matching ""

    No results matching ""