Commit cfbd8b6b by wenyang

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

parent c2cab714
...@@ -1595,7 +1595,11 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service. ...@@ -1595,7 +1595,11 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
} }
//保存基础信息 //保存基础信息
saveCustomerInfo(customerId, requestVO); CommonResult commonResult = saveCustomerInfo(customerId, requestVO);
if (!commonResult.isSuccess()) {
resp.setCommonResult(commonResult);
return resp;
}
//保存/激活新的标签 //保存/激活新的标签
saveCustomerTag(customerId, requestVO.getOpportunityCustomerTags(),requestVO); saveCustomerTag(customerId, requestVO.getOpportunityCustomerTags(),requestVO);
//更新预设值 //更新预设值
...@@ -1741,9 +1745,33 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service. ...@@ -1741,9 +1745,33 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
return createAccountId(mobileNo, "C_"); return createAccountId(mobileNo, "C_");
} }
private void saveCustomerInfo(Long customerId, OwnOpportunityBasicInformationSaveRequestVO requestVO) { private CommonResult saveCustomerInfo(Long customerId, OwnOpportunityBasicInformationSaveRequestVO requestVO) {
CommonResult commonResult = new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000"));
AclCustomer customer = aclCustomerDALService.findById(customerId); AclCustomer customer = aclCustomerDALService.findById(customerId);
String mobileNo = customer.getMobileNo(); String mobileNo = requestVO.getMobileNo();
String weChat = requestVO.getWeChat();
Long leadsAssignedId = requestVO.getLeadsAssignedId();
if (!CommonUtil.isNullOrZero(leadsAssignedId)) {
AclCustomer aclCustomer = null;
//判断手机号是否有修改
if(!CommonUtil.isNullOrBlank(requestVO.getMobileNo()) && !requestVO.getMobileNo().equals(customer.getMobileNo())){
aclCustomer = aclCustomerDALService.findByMobileNo(requestVO.getMobileNo());
commonResult = checkMobileNoAndWechat(aclCustomer, customerId, requestVO);
if (!commonResult.isSuccess()) {
return commonResult;
}
}
//判断微信号是否有修改
if(!CommonUtil.isNullOrBlank(requestVO.getWeChat()) && !requestVO.getWeChat().equals(customer.getWechatNo())){
aclCustomer = aclCustomerDALService.findByWeChatNo(requestVO.getWeChat());
commonResult = checkMobileNoAndWechat(aclCustomer, customerId, requestVO);
if (!commonResult.isSuccess()) {
return commonResult;
}
}
}
String idNo = customer.getIdNo(); String idNo = customer.getIdNo();
customer.setMobileNo(mobileNo); customer.setMobileNo(mobileNo);
customer.setIdNo(idNo); customer.setIdNo(idNo);
...@@ -1752,11 +1780,46 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service. ...@@ -1752,11 +1780,46 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
customer.setGender(requestVO.getGender()); customer.setGender(requestVO.getGender());
customer.setAddress(requestVO.getAddress()); customer.setAddress(requestVO.getAddress());
customer.setAge(requestVO.getAge()); customer.setAge(requestVO.getAge());
customer.setWechatNo(requestVO.getWeChat()); customer.setWechatNo(weChat);
customer.setOtherContacts(requestVO.getOtherContacts()); customer.setOtherContacts(requestVO.getOtherContacts());
customer.setZodiacTypeId(requestVO.getZodiacTypeId()); customer.setZodiacTypeId(requestVO.getZodiacTypeId());
customer.setBloodTypeId(requestVO.getBloodTypeId()); customer.setBloodTypeId(requestVO.getBloodTypeId());
aclCustomerDALService.update(customer); aclCustomerDALService.update(customer);
return commonResult;
}
private CommonResult checkMobileNoAndWechat (AclCustomer aclCustomer, Long customerId, OwnOpportunityBasicInformationSaveRequestVO requestVO){
CommonResult commonResult = new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000"));
//判断是否通过手机号码找到客户
if (aclCustomer != null && aclCustomer.getId().longValue() != customerId.longValue()) {
MktLeadsAssigneds mktLeadsAssigneds = new MktLeadsAssigneds();
mktLeadsAssigneds.setCustomerId(aclCustomer.getId());
mktLeadsAssigneds.setIsActive(1);
List<MktLeadsAssigneds> mktLeadsAssignedsList = mktLeadsAssignedsDALService.findByMktLeadsAssigneds(mktLeadsAssigneds);
if (!mktLeadsAssignedsList.isEmpty()) {
MktLeadsAssignedTrack leadsAssignedTrack = mktLeadsAssignedTrackDALService.findByListNotesForCustomerId(aclCustomer.getId());
Long mdDropOptionId = leadsAssignedTrack.getMdDropOptionId();
//判断最后一条跟进状态是否为失败,是失败则无需判断经纪人id和之前是否一致
MdDropOptions mdDropOption = mdDropOptionsDALService.findById(mdDropOptionId);
if (!"refused".equalsIgnoreCase(mdDropOption.getDropOptionCode())) {
Long assignedPractitionerId = requestVO.getAssignedPractitionerId();
//获取最新track对应的leads
for (MktLeadsAssigneds item : mktLeadsAssignedsList) {
if (item.getId().equals(leadsAssignedTrack.getLeadsAssignedId())) {
//跳出错误
if (item.getAssignedPractitionerId().equals(assignedPractitionerId)) {
return new CommonResult(false, "该商机已存在");
} else {
return new CommonResult(false, ZHBErrorConfig.getErrorInfo("830014"));
}
}
}
}
}
}
return commonResult;
} }
private void saveLeadsAssigneds(OwnOpportunityBasicInformationSaveRequestVO requestVO) { private void saveLeadsAssigneds(OwnOpportunityBasicInformationSaveRequestVO requestVO) {
......
...@@ -16,5 +16,6 @@ public class OwnOpportunityInfo { ...@@ -16,5 +16,6 @@ public class OwnOpportunityInfo {
private Double scoreTotal; private Double scoreTotal;
private Long expertType;//0.经纪人指派 1.专家指派 private Long expertType;//0.经纪人指派 1.专家指派
private Long sfpMainId; private Long sfpMainId;
private String wechatNo;
} }
...@@ -770,7 +770,7 @@ ...@@ -770,7 +770,7 @@
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from ag_acl_customer from ag_acl_customer
where mobile_no = #{mobileNo,jdbcType=VARCHAR,typeHandler=com.yd.util.deshandler.DESTypeHandler} where mobile_no = #{mobileNo,jdbcType=VARCHAR,typeHandler=com.yd.util.deshandler.DESTypeHandler}
and is_active=1 and is_active=1 order by id desc limit 0,1
</select> </select>
<select id="findByWeChatNo" resultMap="BaseResultMap"> <select id="findByWeChatNo" resultMap="BaseResultMap">
select select
......
...@@ -1517,7 +1517,7 @@ ...@@ -1517,7 +1517,7 @@
<result column="scoreTotal" property="scoreTotal" /> <result column="scoreTotal" property="scoreTotal" />
<result column="expertType" property="expertType" /> <result column="expertType" property="expertType" />
<result column="sfpMainId" property="sfpMainId" /> <result column="sfpMainId" property="sfpMainId" />
<result column="wechatNo" property="wechatNo" />
</resultMap> </resultMap>
<select id="ownOpportunityQuery" resultMap="opportunityQuery"> <select id="ownOpportunityQuery" resultMap="opportunityQuery">
SELECT SELECT
...@@ -1533,7 +1533,8 @@ ...@@ -1533,7 +1533,8 @@
if(ass.id is null ,0,1) expertType , if(ass.id is null ,0,1) expertType ,
p.remark remark, p.remark remark,
p.appointment_record_id appointmentRecordId, p.appointment_record_id appointmentRecordId,
p.sfp_main_id sfpMainId p.sfp_main_id sfpMainId,
c.wechat_no wechatNo
FROM FROM
ag_mkt_leads_assigneds a ag_mkt_leads_assigneds a
left join ag_mkt_leads_expert_request r on r.customer_id = a.customer_id and r.is_active =1 left join ag_mkt_leads_expert_request r on r.customer_id = a.customer_id and r.is_active =1
......
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