单授权用户未填写线索信息不需要同步到ec中
This commit is contained in:
@@ -53,42 +53,25 @@
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="selectByHourDate" resultType="com.cool.store.entity.SyncEcCustomerDO" >
|
||||
SELECT
|
||||
a.id AS id,b.partner_id,
|
||||
a.username AS customername,
|
||||
a.mobile AS customermobile,
|
||||
d.`name` AS followname,
|
||||
d.mobile AS followmobile,b.line_status as lineStatus,
|
||||
c.channel_id AS channelId ,ifnull(tl_l.followCount,0) as followCount
|
||||
FROM
|
||||
hy_partner_user_info a
|
||||
LEFT JOIN hy_partner_line_info b ON a.partner_id = b.partner_id and b.deleted=0
|
||||
LEFT JOIN hy_partner_user_channel c ON a.user_channel_id = c.channel_id
|
||||
LEFT JOIN enterprise_user d ON b.investment_manager = d.user_id and d.deleted=0
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
partner_id,
|
||||
IFNULL( COUNT( 1 ), 0 ) AS followCount
|
||||
FROM
|
||||
hy_partner_line_info
|
||||
WHERE
|
||||
( deleted = 1 OR ( deleted = 0 AND line_status IN ( 0, 3 ) AND close_time IS NOT NULL ) )
|
||||
AND investment_manager IS NOT NULL
|
||||
GROUP BY
|
||||
partner_id ) tl_l on b.partner_id=tl_l.partner_id
|
||||
WHERE ( b.update_time BETWEEN #{selectTime} and #{now} or
|
||||
a.update_time BETWEEN #{selectTime} and #{now} ) and a.username is not null order by a.id Limit #{limit1},#{limit2}
|
||||
</select>
|
||||
<select id="selectByHourDateCount" resultType="java.lang.Integer">
|
||||
<select id="selectByHourDate" resultType="com.cool.store.entity.SyncEcCustomerDO" >
|
||||
SELECT
|
||||
count(*)
|
||||
a.id AS id,
|
||||
b.partner_id,
|
||||
b.username AS customername,
|
||||
b.mobile AS customermobile,
|
||||
d.`name` AS followname,
|
||||
d.mobile AS followmobile,
|
||||
a.line_status AS lineStatus,
|
||||
c.channel_id AS channelId,
|
||||
ifnull( tl_l.followCount, 0 ) AS followCount
|
||||
FROM
|
||||
hy_partner_user_info a
|
||||
LEFT JOIN hy_partner_line_info b ON a.partner_id = b.partner_id and b.deleted=0
|
||||
LEFT JOIN hy_partner_user_channel c ON a.user_channel_id = c.channel_id
|
||||
LEFT JOIN enterprise_user d ON b.investment_manager = d.user_id and d.deleted=0
|
||||
LEFT JOIN (
|
||||
hy_partner_line_info a
|
||||
LEFT JOIN hy_partner_user_info b ON a.partner_id = b.partner_id
|
||||
AND a.deleted = 0
|
||||
LEFT JOIN hy_partner_user_channel c ON b.user_channel_id = c.channel_id
|
||||
LEFT JOIN enterprise_user d ON a.investment_manager = d.user_id
|
||||
AND d.deleted = 0
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
partner_id,
|
||||
IFNULL( COUNT( 1 ), 0 ) AS followCount
|
||||
@@ -98,9 +81,35 @@
|
||||
( deleted = 1 OR ( deleted = 0 AND line_status IN ( 0, 3 ) AND close_time IS NOT NULL ) )
|
||||
AND investment_manager IS NOT NULL
|
||||
GROUP BY
|
||||
partner_id ) tl_l on b.partner_id=tl_l.partner_id
|
||||
partner_id
|
||||
) tl_l ON b.partner_id = tl_l.partner_id
|
||||
WHERE ( b.update_time BETWEEN #{selectTime} and #{now} or
|
||||
a.update_time BETWEEN #{selectTime} and #{now} ) and b.partner_id is not null order by a.id Limit #{limit1},#{limit2}
|
||||
</select>
|
||||
<select id="selectByHourDateCount" resultType="java.lang.Integer">
|
||||
SELECT
|
||||
count(*)
|
||||
FROM
|
||||
hy_partner_line_info a
|
||||
LEFT JOIN hy_partner_user_info b ON a.partner_id = b.partner_id
|
||||
AND a.deleted = 0
|
||||
LEFT JOIN hy_partner_user_channel c ON b.user_channel_id = c.channel_id
|
||||
LEFT JOIN enterprise_user d ON a.investment_manager = d.user_id
|
||||
AND d.deleted = 0
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
partner_id,
|
||||
IFNULL( COUNT( 1 ), 0 ) AS followCount
|
||||
FROM
|
||||
hy_partner_line_info
|
||||
WHERE
|
||||
( deleted = 1 OR ( deleted = 0 AND line_status IN ( 0, 3 ) AND close_time IS NOT NULL ) )
|
||||
AND investment_manager IS NOT NULL
|
||||
GROUP BY
|
||||
partner_id
|
||||
) tl_l ON b.partner_id = tl_l.partner_id
|
||||
WHERE (b.update_time BETWEEN #{selectTime} and #{now} or
|
||||
a.update_time BETWEEN #{selectTime} and #{now} ) and a.username is not null
|
||||
a.update_time BETWEEN #{selectTime} and #{now} ) and b.partner_id is not null
|
||||
</select>
|
||||
|
||||
<insert id="insertSelective" keyColumn="id" keyProperty="record.id" useGeneratedKeys="true">
|
||||
@@ -153,7 +162,7 @@
|
||||
</if>
|
||||
<if test="record.recommendPartnerMobile != null">
|
||||
recommend_partner_mobile,
|
||||
</if>
|
||||
</if>
|
||||
<if test="record.userChannelId!=null">
|
||||
user_channel_id,
|
||||
</if>
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.cool.store.dao.EnterpriseUserDAO;
|
||||
import com.cool.store.dao.HyPartnerBaseInfoDAO;
|
||||
import com.cool.store.dao.HyPartnerLineInfoDAO;
|
||||
import com.cool.store.dao.HyPartnerUserInfoDAO;
|
||||
import com.cool.store.dto.partner.LineCountDTO;
|
||||
import com.cool.store.entity.*;
|
||||
import com.cool.store.enums.LineStatusEnum;
|
||||
import com.cool.store.enums.WorkflowStageEnum;
|
||||
@@ -33,9 +34,11 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -174,25 +177,28 @@ public class EcSyncServiceImpl implements EcSyncService {
|
||||
hyPartnerLineInfoDAO.updateByPrimaryKeySelective(resultLine);
|
||||
}
|
||||
}else {
|
||||
EnterpriseUserDO enterpriseUser = enterpriseUserDAO.getUserInfoById(partnerLine.getInvestmentManager());
|
||||
enterpriseUser.setMobile(getNoWith86Number(enterpriseUser.getMobile()));
|
||||
//电话相同但是名字不同
|
||||
if (enterpriseUser.getMobile().equals(followUserMobile) && !enterpriseUser.getName().equals(followUserName)) {
|
||||
ChangeFollowUserRequest changeFollowUserRequest = new ChangeFollowUserRequest();
|
||||
ChangeFollowUserBo changeFollowUserBo = new ChangeFollowUserBo();
|
||||
changeFollowUserBo.setFollowUserId(customerInfoItem.getLastFollowUserId()).setCrmId(customerInfoItem.getCrmId())
|
||||
.setType(1).setUsername(enterpriseUser.getName()).setMobile(enterpriseUser.getMobile());
|
||||
changeFollowUserRequest.setParameter(changeFollowUserBo);
|
||||
ChangeFollowUserResponse changeFollowUserExec = ecClient.exec(baseUrl,changeFollowUserRequest);
|
||||
}
|
||||
//电话不同
|
||||
if (!enterpriseUser.getMobile().equals(followUserMobile)) {
|
||||
ChangeFollowUserRequest changeFollowUserRequest = new ChangeFollowUserRequest();
|
||||
ChangeFollowUserBo changeFollowUserBo = new ChangeFollowUserBo();
|
||||
changeFollowUserBo.setFollowUserId(customerInfoItem.getLastFollowUserId()).setCrmId(customerInfoItem.getCrmId())
|
||||
.setType(2).setUsername(enterpriseUser.getName()).setMobile(enterpriseUser.getMobile());
|
||||
changeFollowUserRequest.setParameter(changeFollowUserBo);
|
||||
ChangeFollowUserResponse changeFollowUserExec = ecClient.exec(baseUrl,changeFollowUserRequest);
|
||||
if (!getFollowLineStatus(partnerLine)) {
|
||||
//私海
|
||||
EnterpriseUserDO enterpriseUser = enterpriseUserDAO.getUserInfoById(partnerLine.getInvestmentManager());
|
||||
enterpriseUser.setMobile(getNoWith86Number(enterpriseUser.getMobile()));
|
||||
//电话相同但是名字不同
|
||||
if (enterpriseUser.getMobile().equals(followUserMobile) && !enterpriseUser.getName().equals(followUserName)) {
|
||||
ChangeFollowUserRequest changeFollowUserRequest = new ChangeFollowUserRequest();
|
||||
ChangeFollowUserBo changeFollowUserBo = new ChangeFollowUserBo();
|
||||
changeFollowUserBo.setFollowUserId(customerInfoItem.getLastFollowUserId()).setCrmId(customerInfoItem.getCrmId())
|
||||
.setType(1).setUsername(enterpriseUser.getName()).setMobile(enterpriseUser.getMobile());
|
||||
changeFollowUserRequest.setParameter(changeFollowUserBo);
|
||||
ChangeFollowUserResponse changeFollowUserExec = ecClient.exec(baseUrl, changeFollowUserRequest);
|
||||
}
|
||||
//电话不同
|
||||
if (!enterpriseUser.getMobile().equals(followUserMobile)) {
|
||||
ChangeFollowUserRequest changeFollowUserRequest = new ChangeFollowUserRequest();
|
||||
ChangeFollowUserBo changeFollowUserBo = new ChangeFollowUserBo();
|
||||
changeFollowUserBo.setFollowUserId(customerInfoItem.getLastFollowUserId()).setCrmId(customerInfoItem.getCrmId())
|
||||
.setType(2).setUsername(enterpriseUser.getName()).setMobile(enterpriseUser.getMobile());
|
||||
changeFollowUserRequest.setParameter(changeFollowUserBo);
|
||||
ChangeFollowUserResponse changeFollowUserExec = ecClient.exec(baseUrl, changeFollowUserRequest);
|
||||
}
|
||||
}
|
||||
}
|
||||
//base表
|
||||
@@ -223,12 +229,26 @@ public class EcSyncServiceImpl implements EcSyncService {
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
Integer a=null;
|
||||
System.out.println(a.equals("bb"));
|
||||
|
||||
/**
|
||||
*招商公海内跟进次数大于等于1的用户EC同步该用户进去公海,假若跟进次数为0的同步到EC跟进人就是唐佑玉
|
||||
* @param partnerLine
|
||||
* @return true为公海 false:私海
|
||||
*/
|
||||
public Boolean getFollowLineStatus(HyPartnerLineInfoDO partnerLine){
|
||||
if(partnerLine.getLineStatus()!=0){
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
ArrayList<String> list = new ArrayList<>();
|
||||
list.add(partnerLine.getPartnerId());
|
||||
List<LineCountDTO> followCountList = hyPartnerLineInfoDAO.getFollowCountList(list);
|
||||
if (!CollectionUtils.isEmpty(followCountList)) {
|
||||
return followCountList.get(0).getFollowCount()>0;
|
||||
}
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 得到不带86开头的号码
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user