Commit d6132963 by fudahua

离职继承fix

parent 7b8944a7
package com.gic.haoban.manage.api.dto;
import java.io.Serializable;
/**
* Created 2021/6/16.
*
* @author hua
*/
public class HandoverStaffFriendCountDTO implements Serializable {
private String staffId;
private Integer friendCount;
private Integer haobanFriendCount;
public Integer getHaobanFriendCount() {
return haobanFriendCount;
}
public void setHaobanFriendCount(Integer haobanFriendCount) {
this.haobanFriendCount = haobanFriendCount;
}
public String getStaffId() {
return staffId;
}
public void setStaffId(String staffId) {
this.staffId = staffId;
}
public Integer getFriendCount() {
return friendCount;
}
public void setFriendCount(Integer friendCount) {
this.friendCount = friendCount;
}
}
package com.gic.haoban.manage.service.dao.mapper; package com.gic.haoban.manage.service.dao.mapper;
import com.gic.haoban.manage.api.dto.HandoverStaffFriendCountDTO;
import com.gic.haoban.manage.service.entity.TabHandoverExternal; import com.gic.haoban.manage.service.entity.TabHandoverExternal;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -85,4 +86,13 @@ public interface HandoverExternalMapper { ...@@ -85,4 +86,13 @@ public interface HandoverExternalMapper {
/** /**
*/ */
int delNoTransferExternal(@Param("userIds") List<String> userIds, @Param("wxEnterpriseId") String wxEnterpriseId); int delNoTransferExternal(@Param("userIds") List<String> userIds, @Param("wxEnterpriseId") String wxEnterpriseId);
/**
* 查询待分配客户列表
*
* @param wxEnterpriseId
* @return
*/
List<HandoverStaffFriendCountDTO> listPreCountByStaffIds(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("staffIds") List<String> staffIds);
} }
\ No newline at end of file
...@@ -3,6 +3,7 @@ package com.gic.haoban.manage.service.service; ...@@ -3,6 +3,7 @@ package com.gic.haoban.manage.service.service;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
import com.gic.haoban.base.api.common.BasePageInfo; import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.manage.api.dto.HandoverExternalDTO; import com.gic.haoban.manage.api.dto.HandoverExternalDTO;
import com.gic.haoban.manage.api.dto.HandoverStaffFriendCountDTO;
import com.gic.haoban.manage.service.entity.TabHandoverExternal; import com.gic.haoban.manage.service.entity.TabHandoverExternal;
import com.gic.haoban.manage.service.entity.TabHandoverStaff; import com.gic.haoban.manage.service.entity.TabHandoverStaff;
import com.gic.haoban.manage.service.entity.TabHandoverTransfer; import com.gic.haoban.manage.service.entity.TabHandoverTransfer;
...@@ -112,4 +113,12 @@ public interface HandoverService { ...@@ -112,4 +113,12 @@ public interface HandoverService {
*/ */
public boolean dealResult(String wxEnterpriseId, String transferId, List<QywxTransferCustomerInfoDTO> list); public boolean dealResult(String wxEnterpriseId, String transferId, List<QywxTransferCustomerInfoDTO> list);
/**
* 还未分配的客户数量
*
* @param wxEnterpriseId
* @return
*/
public List<HandoverStaffFriendCountDTO> listFriendCountByWxStaffIds(String wxEnterpriseId, List<String> staffIds);
} }
...@@ -6,6 +6,7 @@ import com.gic.commons.util.ToolUtil; ...@@ -6,6 +6,7 @@ import com.gic.commons.util.ToolUtil;
import com.gic.haoban.base.api.common.BasePageInfo; import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.common.utils.PageUtil; import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.manage.api.dto.HandoverExternalDTO; import com.gic.haoban.manage.api.dto.HandoverExternalDTO;
import com.gic.haoban.manage.api.dto.HandoverStaffFriendCountDTO;
import com.gic.haoban.manage.service.config.Config; import com.gic.haoban.manage.service.config.Config;
import com.gic.haoban.manage.service.dao.mapper.*; import com.gic.haoban.manage.service.dao.mapper.*;
import com.gic.haoban.manage.service.entity.*; import com.gic.haoban.manage.service.entity.*;
...@@ -301,4 +302,10 @@ public class HandoverServiceImpl implements HandoverService { ...@@ -301,4 +302,10 @@ public class HandoverServiceImpl implements HandoverService {
}); });
return true; return true;
} }
@Override
public List<HandoverStaffFriendCountDTO> listFriendCountByWxStaffIds(String wxEnterpriseId, List<String> staffIds) {
List<HandoverStaffFriendCountDTO> ret = handoverExternalMapper.listPreCountByStaffIds(wxEnterpriseId, staffIds);
return ret;
}
} }
...@@ -161,12 +161,16 @@ public class HandoverOperationApiServiceImpl implements HandoverOperationApiServ ...@@ -161,12 +161,16 @@ public class HandoverOperationApiServiceImpl implements HandoverOperationApiServ
logger.info("不存在staff列表"); logger.info("不存在staff列表");
return null; return null;
} }
List<HandoverStaffFriendCountDTO> friendCountList = handoverService.listFriendCountByWxStaffIds(wxEnterpriseId, staffIds);
Map<String, HandoverStaffFriendCountDTO> staffFriendCountMap = friendCountList.stream().collect(Collectors.toMap(dto -> dto.getStaffId(), dto -> dto));
List<HandoverStaffInfoDTO> retList = EntityUtil.changeEntityListByJSON(HandoverStaffInfoDTO.class, tabHaobanStaffs); List<HandoverStaffInfoDTO> retList = EntityUtil.changeEntityListByJSON(HandoverStaffInfoDTO.class, tabHaobanStaffs);
retList.forEach(dto -> { retList.forEach(dto -> {
TabHandoverStaff handoverStaff = handoverStaffMap.get(dto.getStaffId()); HandoverStaffFriendCountDTO staffFriend = staffFriendCountMap.get(dto.getStaffId());
dto.setDimissionTime(handoverStaff.getDimissionTime()); TabHandoverStaff tabHandoverStaff = handoverStaffMap.get(dto.getStaffId());
dto.setFriendCount(handoverStaff.getFriendCount()); dto.setDimissionTime(tabHandoverStaff.getDimissionTime());
dto.setHaobanFriendCount(handoverStaff.getHaobanFriendCount()); dto.setFriendCount(staffFriend.getFriendCount());
dto.setHaobanFriendCount(staffFriend.getHaobanFriendCount());
}); });
return retList; return retList;
} }
......
...@@ -19,6 +19,12 @@ ...@@ -19,6 +19,12 @@
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
</resultMap> </resultMap>
<resultMap id="FiendCountResultMap" type="com.gic.haoban.manage.api.dto.HandoverStaffFriendCountDTO">
<result column="staff_id" jdbcType="VARCHAR" property="staffId"/>
<result column="friendCount" jdbcType="INTEGER" property="friendCount"/>
<result column="haobanFriendCount" jdbcType="INTEGER" property="haobanFriendCount"/>
</resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
handover_external_id, wx_enterprise_id, staff_id, user_id, external_user_id, external_user_name, relation_id, handover_external_id, wx_enterprise_id, staff_id, user_id, external_user_id, external_user_name, relation_id,
haoban_friend_flag, external_head_url, status_flag, handover_transfer_id, takeover_time, haoban_friend_flag, external_head_url, status_flag, handover_transfer_id, takeover_time,
...@@ -339,4 +345,19 @@ ...@@ -339,4 +345,19 @@
</if> </if>
and status_flag=1 and status_flag=1
</update> </update>
<select id="listPreCountByStaffIds" resultMap="FiendCountResultMap">
select
staff_id ,
COUNT(external_user_id) friendCount,
sum(haoban_friend_flag) haobanFriendCount
from tab_haoban_handover_external
where wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
and staff_id in
<foreach collection="staffIds" item="item" separator="," open="(" close=")">
#{item}
</foreach>
and status_flag=1
group by staff_id
</select>
</mapper> </mapper>
\ No newline at end of file
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