功能说明:新增一条商机
请求方式:POST(HTTPS)
请求地址:https://qwif.do1.com.cn/qwcgi/api/crm/business/insertBusinessInfo.do?token=token&corpId=corpId
{
"businessStage":"2",
"businessType":"12",
"chargePersonId":"wx_mr_zhao",
"clientId":"9a2fb91e1fef48b7a582a34968bd9925",
"contactIds":"1bb3eeb54e2844598189272adbfd6d35,874a21aa4a4f423da64cb0c8a20f72d4",
"content":"这是商机内容",
"customFields":[
{
"fieldId":"ad3383676ae1090cf39bdc9e6fa20676",
"fieldValue":"这是单行文本"
},
{
"fieldId":"c1bec3b07dfc8f7e350afc8da30e5cb1",
"fieldValue":"这是多行文本\n这是多行文本\n"
},
{
"fieldId":"6cae2f16cd2a67b2b4613b3719527a47",
"fieldValue":"1"
},
{
"fieldId":"21e7c172cc7a1bec704b793d5e739beb",
"fieldValue":"13312031200"
},
{
"fieldId":"4e4eb8cba8a0d9e72a085f2f36d861a0",
"fieldValue":"2019-12-03"
},
{
"fieldId":"73504817cff862f1748b2735a852fbfe",
"fieldValue":"100000"
},
{
"fieldId":"bf459fb4837c9a6b161ddac72dd7c836",
"fieldValue":"1000000.00"
},
{
"fieldId":"5c8fe1262515a435e6eb004f540d1c5f",
"fieldValue":"80%"
},
{
"fieldId":"80cf88634c7b0e27f6d5d42badecca1f",
"fieldValue":"必填自定义字段"
}
],
"estimatedDate":"2019-12-03",
"estimatedSale":"100000000.0",
"loseReasonId":"",
"partnersIds":"33ee9ac3dc194d8ba7341ffbc16208df,1ea6a30f40014f8eb363afdb857ce710",
"relativePersonsIds":"wx_miss_li,wx_mr_liu",
"submitType":"1",
"title":"这是商机标题",
"seniorFields":[
{
"fieldId":"fod9e4acf33e9147128fd085e7712a50e3",
"fieldName":"高级字段-单行文字",
"fieldValue":"这是高级字段单行类型字段"
},
{
"fieldId":"foab338de2db0b449fa46cf375e9d87e3f",
"fieldName":"高级字段-邮箱",
"fieldValue":"123456789@qq.com"
},
{
"fieldId":"fo57b9b1ae81ad492c879050330d5eb3d6",
"fieldName":"高级字段-数字",
"fieldValue":"233"
},
{
"fieldId":"fo498bd7a5a3574807a9010882b70c334f",
"fieldName":"高级字段-电话",
"fieldValue":"020 12031200"
},
{
"fieldId":"fo62e8daa9b10f41848a1e264f7de4819b",
"fieldName":"高级字段-手机",
"fieldValue":"13312031200"
},
{
"fieldId":"fo61fd1ef6f36d4e5084f9a331b3d65b91",
"fieldName":"高级字段-多行文字",
"fieldValue":"这是高级字段多行文字类型\n这是高级字段多行文字类型\n"
},
{
"fieldId":"fo645321f1c7b9415dba84974cc3f39202",
"fieldName":"高级字段-日期",
"fieldValue":"2019-12-03"
},
{
"fieldId":"fo54af86e5f2494bb38a4de1a9282d0ad6",
"fieldName":"高级字段-时间",
"fieldValue":"18:00"
},
{
"fieldId":"fob0adb4f6a7fe440782995cf6426f9ad3",
"fieldName":"高级字段-日期时间",
"fieldValue":"2019-11-11 11:11"
},
{
"fieldId":"fo3674959396384edc8817651605913ccc",
"fieldName":"高级字段-单项选择",
"fieldValue":"选项1"
},
{
"fieldId":"fod9e4acf33e9147128fd085e7712a50e3",
"fieldName":"高级字段-多项选择",
"fieldValue":"选项1,选项2"
},
{
"fieldId":"foe99290cf57f84bfc814b70909a93fc4b",
"fieldName":"高级字段-下拉框",
"fieldValue":"选项1"
},
{
"fieldId":"foe779eae3b38d436c8c72ded5324ba8b0",
"fieldName":"高级字段-评分",
"fieldValue":"3"
},
{
"fieldId":"fo9982aebbdd9b423383e7182fbd57740c",
"fieldName":"高级字段-地理位置",
"fieldValue":"广东省广州市天河区员村一横路3号"
},
{
"fieldId":"fo6b8fdde86ec4472a972ec2b71edd7efa",
"fieldName":"高级字段-省市区",
"fieldValue":"广东省:广州市:天河区"
},
{
"fieldId":"fo521f8244ba3e4d6785602d4aee23a07d",
"fieldName":"高级字段-计算式",
"fieldValue":"466"
},
{
"fieldId":"fobb841af1252547b788d9c93c2baf27c3",
"fieldName":"高级字段-两级下拉框",
"fieldValue":"选项1:二级选项2"
},
{
"fieldId":"foc95fc853e5984552a77dc582a68e8962",
"fieldName":"高级字段-通讯录成员",
"fieldValue":"zhangsan,lisi"
},
{
"fieldId":"foa19a6a39b6d3402a870fc7987ae40e13",
"fieldName":"高级字段-部门",
"fieldValue":"一级部门A->二级部门B,一级部门B->二级部门C->三级部门D"
}
]
}
// 自定义高级字段中的参数fieldName仅做展示用,实际调用不需要传。
businessInfo
| 参数 | 说明 | 类型 | 是否必填 | 备注 |
|---|---|---|---|---|
|
businessStage |
商机阶段 | String | 字段的isNecessary值为1是必填,0为非必填 |
填写获取商机字段接口返回choices中的选项值value 或者获取商机阶段接口返回的选项值value |
|
businessType |
商机类型 | String |
字段的isNecessary值为1是必填,0为非必填 |
填写获取商机字段接口返回choices中的选项值value
或者获取商机类型接口返回的选项值value |
|
chargePersonId |
负责人wxId |
String |
是 | 必须是存在于道一云通讯录中的账号;填写wxUserId;最多填写一个。 |
|
clientId |
所属客户Id |
String |
字段的isNecessary值为1是必填,0为非必填 |
最多填写一个 |
|
contactIds |
客户联系人Ids |
String |
字段的isNecessary值为1是必填,0为非必填 |
多个客户联系人用英文逗号分隔 |
|
content |
商机内容 |
String |
字段的isNecesary值为1是必填,0为非必填 |
|
|
customFields |
自定义字段数组 | JSON | 根据自定义字段是否有isNecessary值为1的字段判断 | 如果自定义字段存在isNecessary为1的字段,则填写对应自定义字段customField信息。 |
|
estimatedDate |
结算日期 |
String |
字段的isNecessary值为1是必填,0为非必填 |
格式:yyyy-MM-dd |
|
estimatedSale |
销售额 |
String |
字段的isNecessary值为1是必填,0为非必填 |
整数或浮点数 |
| loseReasonId | 输单原因ID | String |
字段的isNecessary值为1是必填,0为非必填 |
填写获取商机字段接口的输单原因字段的choices中的optionId |
|
partnersIds |
商机合作伙伴 |
String |
字段的isNecessary值为1是必填,0为非必填 |
多个商机合作伙伴用英文逗号隔开 |
|
relativePersonsIds |
相关负责人wxId |
String |
否 |
必须是存在于道一云通讯录中的账号;填写wxUserId;多个相关负责人,可用英文逗号隔开 |
|
submitType |
通知类型 |
String |
否 |
默认发送给负责人, 1:为发送新建消息给CRM联系人的相关人 |
|
title |
标题 |
String |
字段的isNecessary值为1是必填,0为非必填 |
|
| seniorFields | 自定义高级字段 | String | JSON |
|
customField
| 参数 | 类型 | 类型 | 是否必填 | 备注 |
|---|---|---|---|---|
|
fieldId |
自定义字段Id | String |
字段的isNecessary值为1是必填,0为非必填 |
填写从获取商机字段接口返回的对应的自定义字段ID |
|
fieldValue |
自定义字段值 |
String |
字段的isNecessary值为1是必填,0为非必填 |
Select类型数据填写对应choices的选项值value; Percent类型必须有百分号; Double类型必须精确到小数点后两位; DateTime类型只能是yyyy-MM-dd或者yyyy-MM-dd hh:mm:ss格式。 |
seniorField
| 参数 | 说明 | 类型 | 是否必填 | 备注 |
|---|---|---|---|---|
|
fieldId |
自定义高级字段ID |
String | 根据isNecessary填写 |
填写从获取客户字段接口返回的对应的自定义高级字段ID |
|
fieldValue |
fieldValue |
String |
根据isNecessary填写 |
各类型字段的填写根据下面的表格进行填写 |
自定义高级字段填写说明
| 类型 | 字段释义 | 填写说明 |
|---|---|---|
|
TextField |
单行文本 |
最多2000字符 |
|
NumberField |
数字 | 数字类型 |
|
EmailField |
邮箱 | 邮箱格式 |
|
TelephoneField |
电话 |
分隔用-或空格,国际电话加+ |
|
MobileField |
手机 |
手机格式 |
|
TextArea |
多行文本 |
最多2000字符 |
|
DateField |
日期 |
yy-MM-dd |
|
TimeField |
时间 |
hh:mm |
|
DateTimeField |
日期时间 |
yy-MM-dd hh:mm |
|
RadioButton |
单项选择 |
选项名,如:选项一 |
|
CheckBox |
多项选择 |
选项名,多个用英文逗号分隔。如:选项2,选项3 |
|
DropDown |
下拉框 |
选项名,如:选项一 |
|
RatingField |
评分 |
评分范围内的数字 |
|
GeoField |
地理位置 |
地理位置 |
|
CityField |
省市区 |
格式:xx省:xx市:xx区。英文冒号分隔 |
|
EquationField |
计算式 | 根据设置的计算规则填写 |
|
CascadeDropDown |
两级下拉框 |
填写获取字段接口返回结果里choices的某个选项的optionName。如:选项一:二级选项。 |
|
MEMBERCustomerField |
通讯录成员 |
通信录成员的wxUserId,多个成员英文逗号分隔 |
|
DEPTCustomerField |
部门 |
填写部门全称,层级用"->"链接,多个部门用英文逗号','分隔,如一级部门A->二级部门B,一级部门B->二级部门C->三级部门D |
// 创建请求参数
BusinessInfoReqVO vo = new BusinessInfoReqVO();
// 设置获取类型
vo.setBusinessStage("2");
vo.setBusinessType("12");
vo.setChargePersonId("wx_mr_zhao");
vo.setClientId("9a2fb91e1fef48b7a582a34968bd9925");
vo.setContactIds("1bb3eeb54e2844598189272adbfd6d35,874a21aa4a4f423da64cb0c8a20f72d4");
vo.setContent("这是商机内容");
vo.setEstimatedDate("2019-12-03");
vo.setEstimatedSale("100000000.0");
vo.setPartnersIds("33ee9ac3dc194d8ba7341ffbc16208df,1ea6a30f40014f8eb363afdb857ce710");
vo.setRelativePersonsIds("wx_miss_li,wx_mr_liu");
vo.setSubmitType("1");
vo.setTitle("这是商机标题");
// 设置每一个自定义字段
CrmCommonCustomFieldValueVO textField = new CrmCommonCustomFieldValueVO("ad3383676ae1090cf39bdc9e6fa20676", "这是单行文本");
CrmCommonCustomFieldValueVO textArea = new CrmCommonCustomFieldValueVO("c1bec3b07dfc8f7e350afc8da30e5cb1", "这是多行文本\\n这是多行文本\\n");
CrmCommonCustomFieldValueVO selectField = new CrmCommonCustomFieldValueVO("6cae2f16cd2a67b2b4613b3719527a47", "1");
CrmCommonCustomFieldValueVO phoneNumber = new CrmCommonCustomFieldValueVO("21e7c172cc7a1bec704b793d5e739beb", "13312031200");
CrmCommonCustomFieldValueVO dateTime = new CrmCommonCustomFieldValueVO("4e4eb8cba8a0d9e72a085f2f36d861a0", "2019-07-10 14:00:00");
CrmCommonCustomFieldValueVO intType = new CrmCommonCustomFieldValueVO("73504817cff862f1748b2735a852fbfe", "100000");
CrmCommonCustomFieldValueVO doubleType = new CrmCommonCustomFieldValueVO("bf459fb4837c9a6b161ddac72dd7c836", "1000000.00");
CrmCommonCustomFieldValueVO percentType = new CrmCommonCustomFieldValueVO("5c8fe1262515a435e6eb004f540d1c5f", "80%");
// 添加到list
List<CrmCommonCustomFieldValueVO> customFields = new ArrayList<CrmCommonCustomFieldValueVO>();
customFields.add(textField);
customFields.add(textArea);
customFields.add(selectField);
customFields.add(phoneNumber);
customFields.add(dateTime);
customFields.add(intType);
customFields.add(doubleType);
customFields.add(percentType);
vo.setCustomFields(customFields);
// 设置自定义高级字段
List<CrmSeniorFieldVO> seniorFields = new ArrayList<CrmSeniorFieldVO>();
// 单行文本
seniorFields.add(new CrmSeniorFieldVO("fod9e4acf33e9147128fd085e7712a50e3", "这是高级字段单行类型字段"));
// 邮箱
seniorFields.add(new CrmSeniorFieldVO("foab338de2db0b449fa46cf375e9d87e3f", "123456789@qq.com"));
// 数字
seniorFields.add(new CrmSeniorFieldVO("fo57b9b1ae81ad492c879050330d5eb3d6", "233"));
// 电话
seniorFields.add(new CrmSeniorFieldVO("fo498bd7a5a3574807a9010882b70c334f", "020 12031200"));
// 手机
seniorFields.add(new CrmSeniorFieldVO("fo62e8daa9b10f41848a1e264f7de4819b", "13312031200"));
// 多行文本
seniorFields.add(new CrmSeniorFieldVO("fo61fd1ef6f36d4e5084f9a331b3d65b91", "这是高级字段多行文字类型\\n这是高级字段多行文字类型\\n"));
// 日期
seniorFields.add(new CrmSeniorFieldVO("fo645321f1c7b9415dba84974cc3f39202", "2019-12-03"));
// 时间
seniorFields.add(new CrmSeniorFieldVO("fo54af86e5f2494bb38a4de1a9282d0ad6", "12:00"));
// 日期时间
seniorFields.add(new CrmSeniorFieldVO("fob0adb4f6a7fe440782995cf6426f9ad3", "2019-11-11 11:11"));
// 单项选择
seniorFields.add(new CrmSeniorFieldVO("fo3674959396384edc8817651605913ccc", "选项1"));
// 多项选择
seniorFields.add(new CrmSeniorFieldVO("fod9e4acf33e9147128fd085e7712a50e3", "选项1,选项2"));
// 下拉框
seniorFields.add(new CrmSeniorFieldVO("foe99290cf57f84bfc814b70909a93fc4b", "选项1"));
// 评分
seniorFields.add(new CrmSeniorFieldVO("foe779eae3b38d436c8c72ded5324ba8b0", "3"));
// 地理位置
seniorFields.add(new CrmSeniorFieldVO("fo9982aebbdd9b423383e7182fbd57740c", "广东省广州市天河区员村一横路3号"));
// 省市区
seniorFields.add(new CrmSeniorFieldVO("fo6b8fdde86ec4472a972ec2b71edd7efa", "广东省:广州市:天河区"));
// 计算式 (当前设置 高级字段-数字 * 2)
seniorFields.add(new CrmSeniorFieldVO("fo521f8244ba3e4d6785602d4aee23a07d", "466"));
// 二级选项
seniorFields.add(new CrmSeniorFieldVO("fobb841af1252547b788d9c93c2baf27c3", "选项1:二级选项2"));
// 通信录成员
seniorFields.add(new CrmSeniorFieldVO("foc95fc853e5984552a77dc582a68e8962", "zhangsan,lisi"));
// 部门
seniorFields.add(new CrmSeniorFieldVO("foa19a6a39b6d3402a870fc7987ae40e13", "一级部门A->二级部门B,一级部门B->二级部门C->三级部门D"));
vo.setSeniorFields(seniorFields);
System.out.println(JSONUtil.stringify(vo));
CrmApi api = QwSdkUtil.getInter(CrmApi.class);
// 调用接口
ApiCrmInsertBusinessResultVO businessInfo = api.insertBusinessInfo(QwSdkUtil.getCacheToken(), vo);
System.out.println(JSONUtil.stringify(businessInfo));
}
public static void updateBusinessInfo() {
// SDK update-business-info START
// 创建请求参数
BusinessInfoReqVO vo = new BusinessInfoReqVO();
vo.setId("9f18f306-f34c-4b42-bfc1-41a4bba7fa26");
// 设置获取类型
vo.setBusinessStage("2");
vo.setBusinessType("12");
vo.setChargePersonId("wx_mr_zhao");
vo.setClientId("9a2fb91e1fef48b7a582a34968bd9925");
vo.setContactIds("1bb3eeb54e2844598189272adbfd6d35,874a21aa4a4f423da64cb0c8a20f72d4");
vo.setContent("这是商机内容");
vo.setEstimatedDate("2019-12-03");
vo.setEstimatedSale("100000000.0");
vo.setPartnersIds("33ee9ac3dc194d8ba7341ffbc16208df,1ea6a30f40014f8eb363afdb857ce710");
vo.setRelativePersonsIds("wx_miss_li,wx_mr_liu");
vo.setSubmitType("1");
vo.setTitle("这是商机标题");
// 设置每一个自定义字段
CrmCommonCustomFieldValueVO textField = new CrmCommonCustomFieldValueVO("ad3383676ae1090cf39bdc9e6fa20676", "这是单行文本");
CrmCommonCustomFieldValueVO textArea = new CrmCommonCustomFieldValueVO("c1bec3b07dfc8f7e350afc8da30e5cb1", "这是多行文本\\n这是多行文本\\n");
CrmCommonCustomFieldValueVO selectField = new CrmCommonCustomFieldValueVO("6cae2f16cd2a67b2b4613b3719527a47", "1");
CrmCommonCustomFieldValueVO phoneNumber = new CrmCommonCustomFieldValueVO("21e7c172cc7a1bec704b793d5e739beb", "13312031200");
CrmCommonCustomFieldValueVO dateTime = new CrmCommonCustomFieldValueVO("4e4eb8cba8a0d9e72a085f2f36d861a0", "2019-07-10 14:00:00");
CrmCommonCustomFieldValueVO intType = new CrmCommonCustomFieldValueVO("73504817cff862f1748b2735a852fbfe", "100000");
CrmCommonCustomFieldValueVO doubleType = new CrmCommonCustomFieldValueVO("bf459fb4837c9a6b161ddac72dd7c836", "1000000.00");
CrmCommonCustomFieldValueVO percentType = new CrmCommonCustomFieldValueVO("5c8fe1262515a435e6eb004f540d1c5f", "80%");
// 添加到list
List<CrmCommonCustomFieldValueVO> customFields = new ArrayList<CrmCommonCustomFieldValueVO>();
customFields.add(textField);
customFields.add(textArea);
customFields.add(selectField);
customFields.add(phoneNumber);
customFields.add(dateTime);
customFields.add(intType);
customFields.add(doubleType);
customFields.add(percentType);
vo.setCustomFields(customFields);
// 设置自定义高级字段
List<CrmSeniorFieldVO> seniorFields = new ArrayList<CrmSeniorFieldVO>();
// 单行文本
seniorFields.add(new CrmSeniorFieldVO("fod9e4acf33e9147128fd085e7712a50e3", "这是高级字段单行类型字段"));
// 邮箱
seniorFields.add(new CrmSeniorFieldVO("foab338de2db0b449fa46cf375e9d87e3f", "123456789@qq.com"));
// 数字
seniorFields.add(new CrmSeniorFieldVO("fo57b9b1ae81ad492c879050330d5eb3d6", "233"));
// 电话
seniorFields.add(new CrmSeniorFieldVO("fo498bd7a5a3574807a9010882b70c334f", "020 12031200"));
// 手机
seniorFields.add(new CrmSeniorFieldVO("fo62e8daa9b10f41848a1e264f7de4819b", "13312031200"));
// 多行文本
seniorFields.add(new CrmSeniorFieldVO("fo61fd1ef6f36d4e5084f9a331b3d65b91", "这是高级字段多行文字类型\\n这是高级字段多行文字类型\\n"));
// 日期
seniorFields.add(new CrmSeniorFieldVO("fo645321f1c7b9415dba84974cc3f39202", "2019-12-03"));
// 时间
seniorFields.add(new CrmSeniorFieldVO("fo54af86e5f2494bb38a4de1a9282d0ad6", "12:00"));
// 日期时间
seniorFields.add(new CrmSeniorFieldVO("fob0adb4f6a7fe440782995cf6426f9ad3", "2019-11-11 11:11"));
// 单项选择
seniorFields.add(new CrmSeniorFieldVO("fo3674959396384edc8817651605913ccc", "选项1"));
// 多项选择
seniorFields.add(new CrmSeniorFieldVO("fod9e4acf33e9147128fd085e7712a50e3", "选项1,选项2"));
// 下拉框
seniorFields.add(new CrmSeniorFieldVO("foe99290cf57f84bfc814b70909a93fc4b", "选项1"));
// 评分
seniorFields.add(new CrmSeniorFieldVO("foe779eae3b38d436c8c72ded5324ba8b0", "3"));
// 地理位置
seniorFields.add(new CrmSeniorFieldVO("fo9982aebbdd9b423383e7182fbd57740c", "广东省广州市天河区员村一横路3号"));
// 省市区
seniorFields.add(new CrmSeniorFieldVO("fo6b8fdde86ec4472a972ec2b71edd7efa", "广东省:广州市:天河区"));
// 计算式 (当前设置 高级字段-数字 * 2)
seniorFields.add(new CrmSeniorFieldVO("fo521f8244ba3e4d6785602d4aee23a07d", "466"));
// 二级选项
seniorFields.add(new CrmSeniorFieldVO("fobb841af1252547b788d9c93c2baf27c3", "选项1:二级选项2"));
// 通信录成员
seniorFields.add(new CrmSeniorFieldVO("foc95fc853e5984552a77dc582a68e8962", "zhangsan,lisi"));
// 部门
seniorFields.add(new CrmSeniorFieldVO("foa19a6a39b6d3402a870fc7987ae40e13", "一级部门A->二级部门B,一级部门B->二级部门C->三级部门D"));
vo.setSeniorFields(seniorFields);
System.out.println(JSONUtil.stringify(vo));
CrmApi api = QwSdkUtil.getInter(CrmApi.class);
// 调用接口
api.updateBusinessInfo(QwSdkUtil.getCacheToken(), vo);
{
"code":"0",
"data":
{
"businessId":"9f18f306-f34c-4b42-bfc1-41a4bba7fa26"
},
"desc":"成功"
}
| 参数 | 说明 | 备注 |
|---|---|---|
| businessId | 新增商机的ID |
|