分配规则
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
package com.cool.store.enums;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2023/6/19 19:48
|
||||
* @Version 1.0
|
||||
*/
|
||||
public enum AcceptAdjustTypeEnum {
|
||||
|
||||
NOT_ACCEPT(0,"不接受调剂"),
|
||||
NATIONAL_ADJUSTMENT(1,"全国调剂"),
|
||||
PROVINCIAL_ADJUSTMENT(2,"省内调剂"),
|
||||
LOCAL_ADJUSTMENT(3,"市区开放"),
|
||||
|
||||
|
||||
|
||||
|
||||
;
|
||||
|
||||
private Integer code;
|
||||
|
||||
private String message;
|
||||
|
||||
AcceptAdjustTypeEnum(Integer code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.cool.store.enums;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2023/6/19 19:44
|
||||
* @Version 1.0
|
||||
*/
|
||||
public enum AreaStatusEnum {
|
||||
|
||||
|
||||
OPEN("open","开放"),
|
||||
NOT_OPEN("notOpen","未开放"),
|
||||
SATURATED("saturated","已饱和"),
|
||||
KEY_OPEN("keyOpen","重点开放"),
|
||||
|
||||
|
||||
|
||||
;
|
||||
|
||||
private String code;
|
||||
|
||||
private String message;
|
||||
|
||||
AreaStatusEnum(String code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
}
|
||||
@@ -51,7 +51,7 @@ public enum ErrorCodeEnum {
|
||||
PARENT_NODE_NOT_EXIST(400002, "父节点不存在", null),
|
||||
|
||||
|
||||
LINE_ID_IS_NOT_EXIST(500001, "线索ID不存在!", null),
|
||||
LINE_ID_IS_NOT_EXIST(500001, "线索信息不存在!", null),
|
||||
WORK_FLOW_STAGE_PASS_ERROR(500002, "通过错误,非对应阶段!", null),
|
||||
PARTNER_USER_NOT_EXIST(500003, "加盟商用户信息不存在!", null),
|
||||
ZONE_NOT_EXIST(500004, "战区不存在!", null),
|
||||
|
||||
@@ -55,6 +55,13 @@ public class HyOpenAreaInfoDAO {
|
||||
return hyOpenAreaInfoMapper.getChildrenList(type,parentId);
|
||||
}
|
||||
|
||||
public Integer getChildrenCount(String type ,Long parentId){
|
||||
if (parentId==null){
|
||||
return 0;
|
||||
}
|
||||
return hyOpenAreaInfoMapper.getChildrenCount(type,parentId);
|
||||
}
|
||||
|
||||
|
||||
public int batchUpdateById(String backgroundBanner,String detailBanner,String areaStatus,String updateUserId,List<Long> ids){
|
||||
if (StringUtils.isEmpty(areaStatus)){
|
||||
@@ -77,4 +84,12 @@ public class HyOpenAreaInfoDAO {
|
||||
}
|
||||
return hyOpenAreaInfoMapper.selectByIds(ids);
|
||||
}
|
||||
|
||||
|
||||
public HyOpenAreaInfoDO selectById(Long id){
|
||||
if (id==null){
|
||||
return null;
|
||||
}
|
||||
return hyOpenAreaInfoMapper.selectById(id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.cool.store.dto.partner.ApplyReservationProvinceDTO;
|
||||
import com.cool.store.entity.HyOpenAreaInfoDO;
|
||||
import com.cool.store.entity.HyPartnerBaseInfoDO;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import io.swagger.models.auth.In;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
@@ -69,6 +70,9 @@ public interface HyOpenAreaInfoMapper {
|
||||
List<HyOpenAreaInfoDO> getChildrenList(@Param("type") String type ,
|
||||
@Param("parentId") Long parentId);
|
||||
|
||||
Integer getChildrenCount(@Param("type") String type ,
|
||||
@Param("parentId") Long parentId);
|
||||
|
||||
|
||||
/**
|
||||
* 更新城市昨天
|
||||
@@ -98,7 +102,7 @@ public interface HyOpenAreaInfoMapper {
|
||||
*/
|
||||
List<HyOpenAreaInfoDO> selectByIds(@Param("idList") List<Long> idList);
|
||||
|
||||
|
||||
HyOpenAreaInfoDO selectById(@Param("id") Long id);
|
||||
|
||||
|
||||
}
|
||||
@@ -18,6 +18,11 @@
|
||||
id, parent_id, area_name, area_path, background_banner, detail_banner, area_status,
|
||||
deleted, create_time, update_time, update_user_id
|
||||
</sql>
|
||||
<select id="selectById" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List"></include>
|
||||
from id = #{id}
|
||||
</select>
|
||||
<insert id="insertSelective" parameterType="com.cool.store.entity.HyOpenAreaInfoDO" keyProperty="record.id" useGeneratedKeys="true">
|
||||
insert into hy_open_area_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
@@ -242,6 +247,22 @@
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getChildrenCount" resultType="java.lang.Integer">
|
||||
select count(1) from
|
||||
hy_open_area_info
|
||||
<where>
|
||||
<if test="parentId!=null">
|
||||
and parent_id = #{parentId}
|
||||
</if>
|
||||
<if test="type!=null and type == 'apply'">
|
||||
and (area_status = 'open' or area_status = 'keyOpen')
|
||||
</if>
|
||||
<if test="type!=null and type == 'reservation'">
|
||||
and (area_status='notOpen' or area_status = 'saturated')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectByIds" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List"></include>
|
||||
|
||||
@@ -123,5 +123,14 @@ public interface HyPartnerLineInfoService {
|
||||
*/
|
||||
List<LineFollowHistoryVO> getLineFollowHistory(String partnerId);
|
||||
|
||||
/**
|
||||
* 是否分配跟进人
|
||||
* @param lineId
|
||||
* @return
|
||||
*/
|
||||
Boolean assignFollowUser(Long lineId);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -3,19 +3,15 @@ package com.cool.store.service.impl;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cool.store.constants.CommonConstants;
|
||||
import com.cool.store.constants.RedisConstant;
|
||||
import com.cool.store.dao.EnterpriseUserDAO;
|
||||
import com.cool.store.dao.HyPartnerLineInfoDAO;
|
||||
import com.cool.store.dao.HyPartnerUserInfoDAO;
|
||||
import com.cool.store.dao.UserRegionMappingDAO;
|
||||
import com.cool.store.dao.*;
|
||||
import com.cool.store.dto.partner.*;
|
||||
import com.cool.store.entity.EnterpriseUserDO;
|
||||
import com.cool.store.entity.HyOpenAreaInfoDO;
|
||||
import com.cool.store.entity.HyPartnerLineInfoDO;
|
||||
import com.cool.store.entity.HyPartnerUserInfoDO;
|
||||
import com.cool.store.enums.ErrorCodeEnum;
|
||||
import com.cool.store.enums.LineStatusEnum;
|
||||
import com.cool.store.enums.WorkflowStageEnum;
|
||||
import com.cool.store.enums.WorkflowStatusEnum;
|
||||
import com.cool.store.enums.*;
|
||||
import com.cool.store.exception.ServiceException;
|
||||
import com.cool.store.request.CloseFollowRequest;
|
||||
import com.cool.store.request.LineRequest;
|
||||
@@ -56,6 +52,8 @@ public class HyPartnerLineInfoServiceImpl implements HyPartnerLineInfoService {
|
||||
UserRegionMappingDAO userRegionMappingDAO;
|
||||
@Resource
|
||||
private RedisUtilPool redisUtilPool;
|
||||
@Resource
|
||||
HyOpenAreaInfoDAO hyOpenAreaInfoDAO;
|
||||
|
||||
@Override
|
||||
public StageCountVO selectStagePendingCount(String userId) {
|
||||
@@ -378,6 +376,46 @@ public class HyPartnerLineInfoServiceImpl implements HyPartnerLineInfoService {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean assignFollowUser(Long lineId) {
|
||||
HyPartnerLineInfoDO hyPartnerLineInfoDO = hyPartnerLineInfoDAO.selectByPrimaryKeySelective(lineId);
|
||||
if (hyPartnerLineInfoDO==null){
|
||||
throw new ServiceException(ErrorCodeEnum.LINE_ID_IS_NOT_EXIST);
|
||||
}
|
||||
List<HyPartnerLineInfoDO> lineFollowHistoryList = hyPartnerLineInfoDAO.getLineFollowHistoryList(hyPartnerLineInfoDO.getPartnerId());
|
||||
//如果是私海线索 不需要重新分配招商经理 或者跟进次数大于1
|
||||
if (hyPartnerLineInfoDO.getLineStatus()==1||CollectionUtils.isEmpty(lineFollowHistoryList)){
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
HyPartnerUserInfoDO hyPartnerUserInfoDO = hyPartnerUserInfoDAO.selectByPartnerId(hyPartnerLineInfoDO.getPartnerId());
|
||||
HyOpenAreaInfoDO hyOpenAreaInfoDO = hyOpenAreaInfoDAO.selectById(Long.valueOf(hyPartnerUserInfoDO.getWantShopArea()));
|
||||
if (AreaStatusEnum.OPEN.equals(hyOpenAreaInfoDO.getAreaStatus()) || AreaStatusEnum.KEY_OPEN.equals(hyOpenAreaInfoDO.getAreaStatus())){
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
if (AreaStatusEnum.NOT_OPEN.equals(hyOpenAreaInfoDO.getAreaStatus()) || AreaStatusEnum.SATURATED.equals(hyOpenAreaInfoDO.getAreaStatus())){
|
||||
if (AcceptAdjustTypeEnum.NOT_ACCEPT.getCode().equals(hyPartnerUserInfoDO.getAcceptAdjustType())){
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
//全国调剂 默认分配呗 有啥好说的
|
||||
if (AcceptAdjustTypeEnum.NATIONAL_ADJUSTMENT.getCode().equals(hyPartnerUserInfoDO.getAcceptAdjustType())){
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
//省内调剂 有重点或者开放的 分配
|
||||
if (AcceptAdjustTypeEnum.PROVINCIAL_ADJUSTMENT.getCode().equals(hyPartnerUserInfoDO.getAcceptAdjustType())){
|
||||
Integer apply = hyOpenAreaInfoDAO.getChildrenCount("apply", hyOpenAreaInfoDO.getId());
|
||||
if (apply>CommonConstants.ZERO){
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
//市内调剂 不分配
|
||||
if (AcceptAdjustTypeEnum.LOCAL_ADJUSTMENT.getCode().equals(hyPartnerUserInfoDO.getAcceptAdjustType())){
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
}
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* convertPartnerBlackListDTOToVo
|
||||
* @param partnerBlackListDTO
|
||||
|
||||
Reference in New Issue
Block a user