Merge remote-tracking branch 'origin/cc_20230520_partner' into cc_20230520_partner

# Conflicts:
#	coolstore-partner-dao/src/main/resources/mapper/HyPartnerUserInfoMapper.xml
#	coolstore-partner-model/src/main/java/com/cool/store/vo/PartnerLineInfoVO.java
#	coolstore-partner-service/src/main/java/com/cool/store/service/impl/HyPartnerLineInfoServiceImpl.java
This commit is contained in:
zhangchenbiao
2023-06-21 15:16:38 +08:00
17 changed files with 146 additions and 28 deletions

View File

@@ -57,6 +57,7 @@ public enum ErrorCodeEnum {
ZONE_NOT_EXIST(500004, "战区不存在!", null),
PARTNER_BASEINFO_NOT_EXIST(500005, "基本信息不存在!", null),
INTENT_INFO_NOT_EXIST(500006, "意向信息不存在!", null),
INTENT_AREA_NOT_BING_ZONE(500007, "意向区域没有绑定战区 分配招商经理失败!", null),
INTERVIEW_ENTER_FAIL(1021101, "进入面试间失败", null),
DINGDING_USER_NOT_EXIST(1021102, "用户钉钉信息不存在,无法发起资质审核!", null),

View File

@@ -52,13 +52,19 @@ public class HyIntendDevMappingDAO {
return hyIntendDevelopementMappingMapper.selectByMappingIdList(idList);
}
public List<ZoneCheckDTO> selectByOpenAreaMappingIdList(List<Long> idList){
public List<ZoneCheckDTO> selectByOpenAreaMappingIdList(List<Long> idList,String type){
if (CollectionUtils.isEmpty(idList)){
return new ArrayList<>();
}
return hyIntendDevelopementMappingMapper.selectByOpenAreaMappingIdList(idList);
return hyIntendDevelopementMappingMapper.selectByOpenAreaMappingIdList(idList,type);
}
public HyIntendDevelopementMappingDO selectByOpenAreaMappingId(Long id,String type){
if (id==null){
return null;
}
return hyIntendDevelopementMappingMapper.selectByOpenAreaMappingId(id,type);
}
public int batchInsert(List<HyIntendDevelopementMappingDO> recordList){
if (CollectionUtils.isEmpty(recordList)){

View File

@@ -42,6 +42,13 @@ public class HyIntendDevZoneInfoDAO {
return hyIntendDevZoneInfoMapper.selectById(id);
}
public List<HyIntendDevZoneInfoDO> selectByIds(List<Long> ids){
if (CollectionUtils.isEmpty(ids)){
return new ArrayList<>();
}
return hyIntendDevZoneInfoMapper.selectByIds(ids);
}
public List<HyIntendDevZoneInfoDO> getHyIntendDevZoneInfoList(String type){
if (StringUtils.isEmpty(type)){

View File

@@ -33,6 +33,9 @@ public interface HyIntendDevZoneInfoMapper {
*/
HyIntendDevZoneInfoDO selectById(@Param("id") Long id);
List<HyIntendDevZoneInfoDO> selectByIds(@Param("ids") List<Long> ids);
/**
* 查询战区列表
* @param type

View File

@@ -55,5 +55,11 @@ public interface HyIntendDevelopementMappingMapper {
*/
List<ZoneCheckDTO> selectByMappingIdList(@Param("mappingIdList") List<Long> mappingIdList);
List<ZoneCheckDTO> selectByOpenAreaMappingIdList(@Param("openAreaMappingIdList") List<Long> openAreaMappingIdList);
List<ZoneCheckDTO> selectByOpenAreaMappingIdList(@Param("openAreaMappingIdList") List<Long> openAreaMappingIdList,
@Param("type") String type);
HyIntendDevelopementMappingDO selectByOpenAreaMappingId(@Param("openAreaMappingId") Long openAreaMappingId,
@Param("type") String type);
}

View File

@@ -305,5 +305,9 @@
enterprise_user
where
deleted = 0 and <foreach collection="regionIds" separator="or" open="(" close=")" item="regionId"> user_region_ids like concat("%", #{regionId}, "%") </foreach>
ORDER BY
CASE WHEN jobnumber='' OR jobnumber IS NULL THEN 1 ELSE 0 END,
SUBSTR(jobnumber,1,1),
CAST(SUBSTR(jobnumber,2) AS UNSIGNED) ASC
</select>
</mapper>

View File

@@ -137,4 +137,18 @@
where
deleted = 0 and <foreach collection="regionIds" separator="or" open="(" close=")" item="regionId">associated_region_id like concat("%", #{regionId}, "%")</foreach>
</select>
<select id="selectByIds" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"></include>
from hy_intend_dev_zone_info
<where>
<if test="ids !=null and ids.size>0">
<foreach collection="ids" item="id" open="and id in (" close=")" separator=",">
#{id}
</foreach>
</if>
</where>
</select>
</mapper>

View File

@@ -135,9 +135,13 @@
<select id="selectByOpenAreaMappingIdList" resultType="com.cool.store.dto.partner.ZoneCheckDTO">
select
a.open_area_mapping_id as openAreaMappingId,
b.zone_name as zoneName
b.zone_name as zoneName,
b.id as zoneId
from hy_intend_developement_mapping a inner join hy_intend_dev_zone_info b on a.mapping_id = b.id
<where>
<if test="type!=null and type !=''">
and type = #{type}
</if>
<if test="openAreaMappingIdList!=null and openAreaMappingIdList.size>0">
<foreach collection="openAreaMappingIdList" open="and a.open_area_mapping_id in (" close=")" separator="," item="mappingId">
#{mappingId}
@@ -145,4 +149,18 @@
</if>
</where>
</select>
<select id="selectByOpenAreaMappingId" resultMap="BaseResultMap">
select
*
from hy_intend_developement_mapping a
<where>
<if test="type!=null and type !=''">
and a.type = #{type}
</if>
<if test="openAreaMappingId!=null">
and a.open_area_mapping_id = #{openAreaMappingId}
</if>
</where>
</select>
</mapper>

View File

@@ -43,10 +43,13 @@
select
<include refid="Base_Column_List"></include>
from hy_partner_user_info
where
<foreach collection="partnerIdList" open="partner_id in (" close=")" separator="," item="partnerId">
#{partnerId}
</foreach>
<where>
<if test="partnerIdList!=null and partnerIdList.size>0">
<foreach collection="partnerIdList" open="and partner_id in (" close=")" separator="," item="partnerId">
#{partnerId}
</foreach>
</if>
</where>
</select>
<insert id="insertSelective" keyColumn="id" keyProperty="record.id" useGeneratedKeys="true">

View File

@@ -12,6 +12,8 @@ public class ZoneCheckDTO {
private Long openAreaMappingId;
private Long zoneId;
private String areaName;
private String zoneName;

View File

@@ -62,9 +62,6 @@ public class PartnerLineInfoVO {
@ApiModelProperty("冷静期首次登录 是-true 否-false")
private Boolean coolingPeriodFirstLoginFlag;
@ApiModelProperty("加盟商用户ID")
private String partnerUserId;
@ApiModelProperty("加盟商用户名称")
private String partnerUserName;

View File

@@ -128,7 +128,7 @@ public interface HyPartnerLineInfoService {
* @param lineId
* @return
*/
Boolean assignFollowUser(Long lineId);
Boolean assignFollowUser(String partnerId);
/**
* 线索状态
@@ -138,6 +138,12 @@ public interface HyPartnerLineInfoService {
*/
Boolean getLineStatus(Long wantShopAreaId,Integer acceptAdjustType);
/**
* 查询跟进人
* @param partnerId
* @return
*/
String getAssignFollowUser(String partnerId,String type);

View File

@@ -217,6 +217,7 @@ public class HyPartnerIntentInfoServiceImpl implements HyPartnerIntentInfoServic
partnerIntentInfoVO.setOtherBand(hyPartnerIntentInfoDO.getOtherBand());
partnerIntentInfoVO.setStrength(hyPartnerIntentInfoDO.getStrength());
partnerIntentInfoVO.setNeedImprove(hyPartnerIntentInfoDO.getNeedImprove());
partnerIntentInfoVO.setWantShopInfo(hyPartnerIntentInfoDO.getWantShopInfo());
return partnerIntentInfoVO;
}

View File

@@ -8,10 +8,7 @@ import com.cool.store.constants.RedisConstant;
import com.cool.store.dao.*;
import com.cool.store.dto.buser.UserPositionAndUserScopeDTO;
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.entity.*;
import com.cool.store.enums.*;
import com.cool.store.exception.ServiceException;
import com.cool.store.request.CloseFollowRequest;
@@ -375,18 +372,15 @@ public class HyPartnerLineInfoServiceImpl implements HyPartnerLineInfoService {
}
@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());
public Boolean assignFollowUser(String partnerId) {
List<HyPartnerLineInfoDO> lineFollowHistoryList = hyPartnerLineInfoDAO.getLineFollowHistoryList(partnerId);
//当前加盟商线索
HyPartnerLineInfoDO HyPartnerLineInfo = hyPartnerLineInfoDAO.getByPartnerId(partnerId);
//如果是私海线索 不需要重新分配招商经理 或者跟进次数大于1
if (hyPartnerLineInfoDO.getLineStatus()==1||CollectionUtils.isEmpty(lineFollowHistoryList)){
if (HyPartnerLineInfo.getLineStatus()==1||CollectionUtils.isEmpty(lineFollowHistoryList)){
return Boolean.FALSE;
}
HyPartnerUserInfoDO hyPartnerUserInfoDO = hyPartnerUserInfoDAO.selectByPartnerId(hyPartnerLineInfoDO.getPartnerId());
HyPartnerUserInfoDO hyPartnerUserInfoDO = hyPartnerUserInfoDAO.selectByPartnerId(partnerId);
Boolean lineStatus = getLineStatus(Long.valueOf(hyPartnerUserInfoDO.getWantShopArea()), hyPartnerUserInfoDO.getAcceptAdjustType());
return lineStatus;
}
@@ -428,6 +422,51 @@ public class HyPartnerLineInfoServiceImpl implements HyPartnerLineInfoService {
return Boolean.FALSE;
}
@Resource
HyIntendDevMappingDAO hyIntendDevMappingDAO;
@Resource
HyIntendDevZoneInfoDAO hyIntendDevZoneInfoDAO;
@Override
public String getAssignFollowUser(String partnerId,String type) {
//查询意向区域
HyPartnerUserInfoDO hyPartnerUserInfoDO = hyPartnerUserInfoDAO.selectByPartnerId(partnerId);
//意向区域
String wantShopArea = hyPartnerUserInfoDO.getWantShopArea();
EnterpriseUserDO enterpriseUserDO = new EnterpriseUserDO();
// TODO: 2023/6/21 如果意向区域没有绑定战区 分配给谁
//查询意向区域绑定的组织架构
HyIntendDevelopementMappingDO hyIntendDevelopementMappingDO = hyIntendDevMappingDAO.selectByOpenAreaMappingId(Long.valueOf(wantShopArea),type);
if (hyIntendDevelopementMappingDO==null){
throw new ServiceException(ErrorCodeEnum.INTENT_AREA_NOT_BING_ZONE);
}
List<String> result = new ArrayList<>();
if (hyIntendDevelopementMappingDO!=null){
HyIntendDevZoneInfoDO hyIntendDevZoneInfoDO = hyIntendDevZoneInfoDAO.selectById(Long.valueOf(hyIntendDevelopementMappingDO.getMappingId()));
if (hyIntendDevZoneInfoDO!=null && StringUtil.isNotEmpty(hyIntendDevZoneInfoDO.getAssociatedRegionId())) {
List<String> list = JSONObject.parseArray(hyIntendDevZoneInfoDO.getAssociatedRegionId(), String.class);
result.addAll(list);
}
}
String userId = "";
List<EnterpriseUserDO> userListByRegionIds = enterpriseUserDAO.getUserListByRegionIds(result);
String zoneId = hyIntendDevelopementMappingDO.getMappingId();
HyIntendDevZoneInfoDO hyIntendDevZoneInfoDO = hyIntendDevZoneInfoDAO.selectById(Long.valueOf(zoneId));
if (CollectionUtils.isNotEmpty(userListByRegionIds)){
List<String> userIdList = userListByRegionIds.stream().map(EnterpriseUserDO::getUserId).collect(Collectors.toList());
int i = userIdList.indexOf(hyIntendDevZoneInfoDO.getLastAllotUserId());
if (i==(userListByRegionIds.size()-1)){
i = -1;
}
userId = userIdList.get(++i);
}
return userId;
}
/**
* convertPartnerBlackListDTOToVo
* @param partnerBlackListDTO

View File

@@ -107,9 +107,11 @@ public class PartnerUserInfoServiceImpl implements PartnerUserInfoService {
hyPartnerLineInfoDO.setPartnerId(hyPartnerUserInfoDO.getPartnerId());
hyPartnerLineInfoDO.setWorkflowStage(WorkflowStageEnum.INTENT.getCode());
hyPartnerLineInfoDO.setWorkflowStatus(WorkflowStatusEnum.INTENT_0.getCode());
Boolean flag = hyPartnerLineInfoService.getLineStatus(Long.valueOf(partnerUserInfoRequest.getWantShopArea()), partnerUserInfoRequest.getAcceptAdjustType());
Boolean flag = hyPartnerLineInfoService.assignFollowUser(hyPartnerLineInfoDO.getPartnerId());
hyPartnerLineInfoDO.setLineStatus(flag ? LineStatusEnum.PRIVATE_SEAS.getCode() : LineStatusEnum.PUBLIC_SEAS.getCode());
hyPartnerLineInfoDO.setInvestmentManager("ou_7a6a19ae800afde783b0ec2dabaabf95");
if (flag){
hyPartnerLineInfoDO.setInvestmentManager("ou_7a6a19ae800afde783b0ec2dabaabf95");
}
hyPartnerLineInfoDAO.insertSelective(hyPartnerLineInfoDO);
}
// 生成意向基本信息

View File

@@ -202,7 +202,7 @@ public class ZoneServiceImpl implements ZoneService {
throw new ServiceException(ErrorCodeEnum.PARAMS_REQUIRED);
}
//查询已经绑定战区的 意向区域
List<ZoneCheckDTO> list = hyIntendDevMappingDAO.selectByOpenAreaMappingIdList(intentAreaSettingRequest.getOpenAreaIdList());
List<ZoneCheckDTO> list = hyIntendDevMappingDAO.selectByOpenAreaMappingIdList(intentAreaSettingRequest.getOpenAreaIdList(),intentAreaSettingRequest.getType());
List<Long> openAreaIdList = list.stream().map(ZoneCheckDTO::getOpenAreaMappingId).collect(Collectors.toList());
List<HyOpenAreaInfoDO> hyOpenAreaInfoDOList = openAreaInfoDAO.selectByIds(openAreaIdList);
Map<Long, String> areaNameMap = hyOpenAreaInfoDOList.stream().collect(Collectors.toMap(HyOpenAreaInfoDO::getId, HyOpenAreaInfoDO::getAreaName));

View File

@@ -273,4 +273,13 @@ public class DeskController {
return ResponseResult.success(hyPartnerBaseInfoService.addTags(addTagsRequest));
}
@GetMapping(path = "/getAssignFollowUser")
@ApiImplicitParams({
@ApiImplicitParam(name = "partnerId", value = "partnerId", required = false),
})
public ResponseResult<String> getFollowHistory(@RequestParam(value = "partnerId",required = false)String partnerId,
@RequestParam(value = "type",required = false)String type){
return ResponseResult.success(hyPartnerLineInfoService.getAssignFollowUser(partnerId,type));
}
}