Commit c2cab714 by wenyang

潜在客户功能调整为手机号与微信号填一个即可保存(律家保潜在客户只有微信号无手机号)

parent 1aa37e73
......@@ -1577,6 +1577,11 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
@Override
public OwnOpportunityBasicInformationSaveResponseVO ownOpportunityBasicInformationSave(OwnOpportunityBasicInformationSaveRequestVO requestVO) {
OwnOpportunityBasicInformationSaveResponseVO resp = new OwnOpportunityBasicInformationSaveResponseVO();
if (CommonUtil.isNullOrBlank(requestVO.getMobileNo()) && CommonUtil.isNullOrBlank(requestVO.getWeChat())) {
CommonResult commonResult = new CommonResult(false, "手机号与微信号不能同时为空!");
resp.setCommonResult(commonResult);
return resp;
}
Long leadsAssignedId = requestVO.getLeadsAssignedId();
Long customerId = requestVO.getOpportunityId();
if (CommonUtil.isNullOrZero(leadsAssignedId)) {
......@@ -1592,7 +1597,7 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
//保存基础信息
saveCustomerInfo(customerId, requestVO);
//保存/激活新的标签
saveCustomerTag(customerId, requestVO.getOpportunityCustomerTags());
saveCustomerTag(customerId, requestVO.getOpportunityCustomerTags(),requestVO);
//更新预设值
saveLeadsAssigneds(requestVO);
resp.setLeadsAssignedId(requestVO.getLeadsAssignedId());
......@@ -1607,7 +1612,12 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
//当指派id为null时,认为是保存新的商机
//校验商机号码,手机号码对应的customer是否存在
String mobileNo = requestVO.getMobileNo();
AclCustomer aclCustomer = aclCustomerDALService.findByMobileNo(mobileNo);
AclCustomer aclCustomer = null;
if(CommonUtil.isNullOrBlank(mobileNo) && !CommonUtil.isNullOrBlank(requestVO.getWeChat())){
aclCustomer = aclCustomerDALService.findByWeChatNo(requestVO.getWeChat());
}else{
aclCustomer = aclCustomerDALService.findByMobileNo(mobileNo);
}
Long mdMkCampaignId = systemConfigService.getMdMkCampaignId("leadaddedbypractioner");
//判断是否通过手机号码找到客户
......@@ -1641,9 +1651,16 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
//帮其经行注册
aclCustomer = new AclCustomer();
aclCustomer.setRole(2);//1= Staff 2=Customer 3=Partner
if(CommonUtil.isNullOrBlank(mobileNo) && !CommonUtil.isNullOrBlank(requestVO.getWeChat())){
aclCustomer.setAccountId(createAccountId(requestVO.getWeChat(), "W_"));
aclCustomer.setLogin(requestVO.getWeChat());
aclCustomer.setMobileNo(mobileNo);
aclCustomer.setWechatNo(requestVO.getWeChat());
}else{
aclCustomer.setAccountId(createAccountId(mobileNo));
aclCustomer.setLogin(mobileNo);
aclCustomer.setMobileNo(mobileNo);
}
aclCustomer.setCusLevel(1);
aclCustomer.setName(requestVO.getName());
aclCustomer.setIsActive(1);
......@@ -1707,13 +1724,21 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
return new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000"));
}
private String createAccountId(String mobileNo) {
private String createAccountId(String mobileNo, String type) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
String sub = null;
if (mobileNo != null && !"".equals(mobileNo)) {
if(mobileNo.length() > 6){
sub = mobileNo.substring(mobileNo.length() - 6);
}else{
sub = mobileNo;
}
}
return "C_" + sub + "_" + sdf.format(new Date());
return type + sub + "_" + sdf.format(new Date());
}
private String createAccountId(String mobileNo) {
return createAccountId(mobileNo, "C_");
}
private void saveCustomerInfo(Long customerId, OwnOpportunityBasicInformationSaveRequestVO requestVO) {
......@@ -1745,7 +1770,17 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
mktLeadsAssignedsDALService.updateMktLeadsAssigneds(mktLeadsAssigneds);
}
private void saveCustomerTag(Long customerId, List<OpportunityCustomerTag> opportunityCustomerTags) {
private void saveCustomerTag(Long customerId, List<OpportunityCustomerTag> opportunityCustomerTags,OwnOpportunityBasicInformationSaveRequestVO requestVO) {
if(CommonUtil.isNullOrBlank(requestVO.getMobileNo()) && !CommonUtil.isNullOrBlank(requestVO.getWeChat())){
if(opportunityCustomerTags == null || opportunityCustomerTags.size() == 0){
String ljbWechatTag = mdCodeDALService.findCodeByType("LJB_Wechat_tag");
if (!Strings.isNullOrEmpty(ljbWechatTag)) {
OpportunityCustomerTag e = new OpportunityCustomerTag();
e.setTagId(Long.valueOf(ljbWechatTag));
opportunityCustomerTags.add(e);
}
}
}
//保存标签
//此人的原有标签全部至0
ObjectCollectionTagged tagged = new ObjectCollectionTagged();
......
......@@ -22,6 +22,8 @@ public interface AclCustomerMapper {
AclCustomer findByMobileNo(String mobileNo);
AclCustomer findByWeChatNo(String weChatNo);
List<AclCustomer> findByIds(@Param("customerIds") List<Long> customerIds);
List<AclCustomer> findByObj(AclCustomer aclCustomer);
......
......@@ -33,6 +33,8 @@ public interface AclCustomerDALService {
AclCustomer findByMobileNo(String mobileNo);
AclCustomer findByWeChatNo(String weChatNo);
List<AclCustomer> findByIds(List<Long> customerIds);
List<AclCustomer> findByObj(AclCustomer aclCustomer);
......
package com.yd.dal.service.customer.impl;
import com.yd.dal.entity.customer.AclCustomer;
import com.yd.dal.mapper.customer.AclCustomerMapper;
import com.yd.dal.service.customer.AclCustomerDALService;
import com.yd.util.deshandler.DESTypeHandler;
import org.springframework.stereotype.Service;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import com.yd.dal.entity.customer.AclCustomer;
import com.yd.dal.mapper.customer.AclCustomerMapper;
import com.yd.dal.service.customer.AclCustomerDALService;
@Service("aclCustomerDalService")
public class AclCustomerDALServiceImpl implements AclCustomerDALService {
......@@ -48,6 +45,11 @@ public class AclCustomerDALServiceImpl implements AclCustomerDALService {
}
@Override
public AclCustomer findByWeChatNo(String weChatNo) {
return aclCustomerMapper.findByWeChatNo(weChatNo);
}
@Override
public List<AclCustomer> findByIds(List<Long> customerIds) {
return aclCustomerMapper.findByIds(customerIds);
}
......
......@@ -772,6 +772,13 @@
where mobile_no = #{mobileNo,jdbcType=VARCHAR,typeHandler=com.yd.util.deshandler.DESTypeHandler}
and is_active=1
</select>
<select id="findByWeChatNo" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ag_acl_customer
where wechat_no = #{wechatNo,jdbcType=VARCHAR}
and is_active=1 order by id desc limit 0,1
</select>
<select id="findByIds" resultMap="BaseResultMap">
select
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment