|
|
@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSON;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.kiisoo.ic.common.utils.WeixinApi;
|
|
|
|
import com.kiisoo.ic.common.utils.WeixinApi;
|
|
|
|
import com.kiisoo.ic.customer.CustomerService;
|
|
|
|
import com.kiisoo.ic.customer.CustomerService;
|
|
|
|
|
|
|
|
import com.kiisoo.ic.customer.bean.CustomerDTO;
|
|
|
|
|
|
|
|
import com.kiisoo.ic.customer.bean.CustomerModifyDTO;
|
|
|
|
import com.kiisoo.ic.customer.entity.OpCustomerEnterpriseWechat;
|
|
|
|
import com.kiisoo.ic.customer.entity.OpCustomerEnterpriseWechat;
|
|
|
|
import com.kiisoo.ic.customer.mapper.OpCustomerEnterpriseWechatDOMapper;
|
|
|
|
import com.kiisoo.ic.customer.mapper.OpCustomerEnterpriseWechatDOMapper;
|
|
|
|
import com.kiisoo.ic.customer.service.CustomerEnterpriseService;
|
|
|
|
import com.kiisoo.ic.customer.service.CustomerEnterpriseService;
|
|
|
@ -15,6 +17,7 @@ import com.kiisoo.ic.wx.entity.FollowUserTag;
|
|
|
|
import com.sun.org.apache.regexp.internal.RE;
|
|
|
|
import com.sun.org.apache.regexp.internal.RE;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.apache.xmlbeans.impl.xb.xsdschema.Public;
|
|
|
|
import org.apache.xmlbeans.impl.xb.xsdschema.Public;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@ -321,7 +324,7 @@ public class WxResponseService {
|
|
|
|
// 调用外部联系人详情接口 查看state字段
|
|
|
|
// 调用外部联系人详情接口 查看state字段
|
|
|
|
String res3 = WeixinApi.getExternalContactInfo(externalUserID);
|
|
|
|
String res3 = WeixinApi.getExternalContactInfo(externalUserID);
|
|
|
|
log.info(res3);
|
|
|
|
log.info(res3);
|
|
|
|
|
|
|
|
editExternalContact(res3);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case "add_external_contact":
|
|
|
|
case "add_external_contact":
|
|
|
|
// state字段需要企业成员验证添加后回调给到
|
|
|
|
// state字段需要企业成员验证添加后回调给到
|
|
|
@ -378,7 +381,12 @@ public class WxResponseService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void addExternalContact(String res){
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 解析企业微信返回的客户信息
|
|
|
|
|
|
|
|
* @param
|
|
|
|
|
|
|
|
* @return
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public OpCustomerEnterpriseWechat analyticCustomerEnterprise(String res){
|
|
|
|
JSONObject parseObject = JSON.parseObject(res);
|
|
|
|
JSONObject parseObject = JSON.parseObject(res);
|
|
|
|
//解析企业微信信息
|
|
|
|
//解析企业微信信息
|
|
|
|
OpCustomerEnterpriseWechat ocew = JSONObject.parseObject(parseObject.getString("external_contact"), OpCustomerEnterpriseWechat.class);
|
|
|
|
OpCustomerEnterpriseWechat ocew = JSONObject.parseObject(parseObject.getString("external_contact"), OpCustomerEnterpriseWechat.class);
|
|
|
@ -401,9 +409,43 @@ public class WxResponseService {
|
|
|
|
ocew.setTagsType(tags.get(0).getType());
|
|
|
|
ocew.setTagsType(tags.get(0).getType());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//调永东的添加客户接口
|
|
|
|
return ocew;
|
|
|
|
customerService.customerRelation(ocew.getUnionid(),ocew.getState());
|
|
|
|
}
|
|
|
|
//添加添加企业外部店铺客户表
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 添加客户
|
|
|
|
|
|
|
|
* @param res
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public void addExternalContact(String res){
|
|
|
|
|
|
|
|
OpCustomerEnterpriseWechat ocew = analyticCustomerEnterprise(res);
|
|
|
|
|
|
|
|
CustomerDTO customerDTO = new CustomerDTO();
|
|
|
|
|
|
|
|
customerDTO.setUniId(ocew.getUnionid());
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(ocew.getState())){
|
|
|
|
|
|
|
|
//解析state 店铺code-导购
|
|
|
|
|
|
|
|
String[] split = ocew.getState().split("-");
|
|
|
|
|
|
|
|
customerDTO.setShopCode(split[0]);
|
|
|
|
|
|
|
|
customerDTO.setStaffCode(split[1]);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
//调添加客户接口
|
|
|
|
|
|
|
|
long customerId = customerService.customerRelation(customerDTO);
|
|
|
|
|
|
|
|
ocew.setCustomerId(customerId);
|
|
|
|
|
|
|
|
//添加企业外部店铺客户表
|
|
|
|
customerEnterpriseService.addCustomerEnterprise(ocew);
|
|
|
|
customerEnterpriseService.addCustomerEnterprise(ocew);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 更新客户信息
|
|
|
|
|
|
|
|
* @param res
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public void editExternalContact(String res){
|
|
|
|
|
|
|
|
OpCustomerEnterpriseWechat ocew = analyticCustomerEnterprise(res);
|
|
|
|
|
|
|
|
CustomerModifyDTO customerModifyDTO= new CustomerModifyDTO();
|
|
|
|
|
|
|
|
customerModifyDTO.setUniId(ocew.getUnionid());
|
|
|
|
|
|
|
|
customerModifyDTO.setPhone(ocew.getRemarkMobiles());
|
|
|
|
|
|
|
|
customerModifyDTO.setName(ocew.getName());
|
|
|
|
|
|
|
|
//修改客户信息接口
|
|
|
|
|
|
|
|
customerService.customerVipRelation(customerModifyDTO);
|
|
|
|
|
|
|
|
//添加企业外部店铺客户表
|
|
|
|
|
|
|
|
customerEnterpriseService.editCustomerEnterprise(ocew);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|