|
|
|
|
@@ -0,0 +1,143 @@
|
|
|
|
|
package com.cool.store.service.impl;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
import com.cool.store.dao.HyOpenAreaInfoDAO;
|
|
|
|
|
import com.cool.store.dao.HyPartnerLabelDAO;
|
|
|
|
|
import com.cool.store.dao.LineInfoDAO;
|
|
|
|
|
import com.cool.store.dao.LineInterviewDAO;
|
|
|
|
|
import com.cool.store.entity.HyOpenAreaInfoDO;
|
|
|
|
|
import com.cool.store.entity.HyPartnerLabelDO;
|
|
|
|
|
import com.cool.store.entity.LineInfoDO;
|
|
|
|
|
import com.cool.store.entity.LineInterviewDO;
|
|
|
|
|
import com.cool.store.enums.InterviewTypeEnum;
|
|
|
|
|
import com.cool.store.enums.WorkflowSubStageStatusEnum;
|
|
|
|
|
import com.cool.store.mapper.LineInterviewMapper;
|
|
|
|
|
import com.cool.store.service.DeskService;
|
|
|
|
|
import com.cool.store.utils.StringUtil;
|
|
|
|
|
import com.cool.store.utils.poi.DateUtils;
|
|
|
|
|
import com.cool.store.vo.BaseInfoVO;
|
|
|
|
|
import com.cool.store.vo.LabelBaseInfoVO;
|
|
|
|
|
import com.cool.store.vo.desk.IntendPendingVO;
|
|
|
|
|
import com.cool.store.vo.desk.InterviewPendingVO;
|
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @Author suzhuhong
|
|
|
|
|
* @Date 2024/3/26 15:15
|
|
|
|
|
* @Version 1.0
|
|
|
|
|
*/
|
|
|
|
|
@Service
|
|
|
|
|
public class DeskServiceImpl implements DeskService {
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
LineInfoDAO lineInfoDAO;
|
|
|
|
|
@Resource
|
|
|
|
|
HyPartnerLabelDAO hyPartnerLabelDAO;
|
|
|
|
|
@Resource
|
|
|
|
|
HyOpenAreaInfoDAO hyOpenAreaInfoDAO;
|
|
|
|
|
@Resource
|
|
|
|
|
LineInterviewDAO lineInterviewDAO;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public PageInfo<IntendPendingVO> intendPendingList(Integer pageNum, Integer pageSize,String userId) {
|
|
|
|
|
PageHelper.startPage(pageNum, pageSize);
|
|
|
|
|
List<LineInfoDO> lineInfoDOS = lineInfoDAO.listByInvestmentManager(userId, WorkflowSubStageStatusEnum.INTENT_5.getCode());
|
|
|
|
|
PageInfo page = new PageInfo(lineInfoDOS);
|
|
|
|
|
Map<Long, HyPartnerLabelDO> userPortraitMap = this.getUserPortraitMap(lineInfoDOS);
|
|
|
|
|
List<Long> wantShopAreaIds = lineInfoDOS.stream().filter(lineInfoDO -> lineInfoDO.getWantShopAreaId() != null).map(LineInfoDO::getWantShopAreaId).collect(Collectors.toList());
|
|
|
|
|
List<HyOpenAreaInfoDO> hyOpenAreaInfoDOList = hyOpenAreaInfoDAO.selectByIds(wantShopAreaIds);
|
|
|
|
|
Map<Long, String> wantShopAreaMap = hyOpenAreaInfoDOList.stream().collect(Collectors.toMap(HyOpenAreaInfoDO::getId, HyOpenAreaInfoDO::getAreaName, (k1, k2) -> k1));
|
|
|
|
|
List<IntendPendingVO> list = new ArrayList<>();
|
|
|
|
|
lineInfoDOS.forEach(x->{
|
|
|
|
|
BaseInfoVO baseInfoVO = convertToBaseInfoVO(x, userPortraitMap, wantShopAreaMap);
|
|
|
|
|
IntendPendingVO intendPendingVO = new IntendPendingVO(baseInfoVO);
|
|
|
|
|
intendPendingVO.setJoinTime(new Date());
|
|
|
|
|
list.add(intendPendingVO);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
page.setList(list);
|
|
|
|
|
return page ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public PageInfo<InterviewPendingVO> interviewPendingList(Integer pageNum, Integer pageSize, String userId) {
|
|
|
|
|
PageHelper.startPage(pageNum, pageSize);
|
|
|
|
|
List<LineInfoDO> lineInfoDOS = lineInfoDAO.listByInvestmentManager(userId,WorkflowSubStageStatusEnum.INTENT_5.getCode());
|
|
|
|
|
PageInfo page = new PageInfo(lineInfoDOS);
|
|
|
|
|
Map<Long, HyPartnerLabelDO> userPortraitMap = this.getUserPortraitMap(lineInfoDOS);
|
|
|
|
|
List<Long> wantShopAreaIds = lineInfoDOS.stream().filter(lineInfoDO -> lineInfoDO.getWantShopAreaId() != null).map(LineInfoDO::getWantShopAreaId).collect(Collectors.toList());
|
|
|
|
|
List<HyOpenAreaInfoDO> hyOpenAreaInfoDOList = hyOpenAreaInfoDAO.selectByIds(wantShopAreaIds);
|
|
|
|
|
Map<Long, String> wantShopAreaMap = hyOpenAreaInfoDOList.stream().collect(Collectors.toMap(HyOpenAreaInfoDO::getId, HyOpenAreaInfoDO::getAreaName, (k1, k2) -> k1));
|
|
|
|
|
List<Long> lineIds = lineInfoDOS.stream().filter(lineInfoDO -> lineInfoDO.getId() != null).map(LineInfoDO::getId).collect(Collectors.toList());
|
|
|
|
|
List<LineInterviewDO> interviewByLindIds = lineInterviewDAO.getInterviewByLindIds(lineIds, InterviewTypeEnum.MEET);
|
|
|
|
|
Map<Long, LineInterviewDO> interviewDOMap = interviewByLindIds.stream().collect(Collectors.toMap(LineInterviewDO::getLineId, x -> x, (k1, k2) -> k1));
|
|
|
|
|
|
|
|
|
|
List<InterviewPendingVO> list = new ArrayList<>();
|
|
|
|
|
lineInfoDOS.forEach(x->{
|
|
|
|
|
BaseInfoVO baseInfoVO = convertToBaseInfoVO(x, userPortraitMap, wantShopAreaMap);
|
|
|
|
|
InterviewPendingVO interviewPendingVO = new InterviewPendingVO(baseInfoVO);
|
|
|
|
|
LineInterviewDO lineInterviewDO = interviewDOMap.get(x.getId());
|
|
|
|
|
if (lineInterviewDO != null){
|
|
|
|
|
interviewPendingVO.setStartTime(DateUtils.parseDateToStr(DateUtils.SPECIAL_DATE_START,lineInterviewDO.getStartTime()));
|
|
|
|
|
interviewPendingVO.setEndTime(DateUtils.parseDateToStr(DateUtils.SPECIAL_DATE_END,lineInterviewDO.getEndTime()));
|
|
|
|
|
}
|
|
|
|
|
list.add(interviewPendingVO);
|
|
|
|
|
});
|
|
|
|
|
page.setList(list);
|
|
|
|
|
return page;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* convertToBaseInfoVO
|
|
|
|
|
* @param lineInfoDO
|
|
|
|
|
* @param userPortraitMap
|
|
|
|
|
* @param wantShopAreaMap
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private BaseInfoVO convertToBaseInfoVO(LineInfoDO lineInfoDO, Map<Long, HyPartnerLabelDO> userPortraitMap, Map<Long,String> wantShopAreaMap){
|
|
|
|
|
BaseInfoVO baseInfoVO = new BaseInfoVO();
|
|
|
|
|
BeanUtil.copyProperties(lineInfoDO, baseInfoVO);
|
|
|
|
|
baseInfoVO.setLineId(lineInfoDO.getId());
|
|
|
|
|
String userPortrait = lineInfoDO.getUserPortrait();
|
|
|
|
|
List<LabelBaseInfoVO> labelBaseInfoList = new ArrayList<>();
|
|
|
|
|
if (StringUtil.isNotEmpty(userPortrait)){
|
|
|
|
|
Arrays.asList(userPortrait.split(",")).subList(1, userPortrait.split(",").length).forEach(x->{
|
|
|
|
|
LabelBaseInfoVO labelBaseInfoVO = new LabelBaseInfoVO();
|
|
|
|
|
HyPartnerLabelDO hyPartnerLabelDO = userPortraitMap.get(Long.valueOf(x));
|
|
|
|
|
if (hyPartnerLabelDO != null){
|
|
|
|
|
labelBaseInfoVO.setLabelId(userPortraitMap.getOrDefault(Long.valueOf(x), new HyPartnerLabelDO()).getId());
|
|
|
|
|
labelBaseInfoVO.setLabelName(userPortraitMap.getOrDefault(Long.valueOf(x),new HyPartnerLabelDO()).getLabelName());
|
|
|
|
|
labelBaseInfoList.add(labelBaseInfoVO);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
baseInfoVO.setUserPortraitList(labelBaseInfoList);
|
|
|
|
|
baseInfoVO.setWantShopAreaName(wantShopAreaMap.get(lineInfoDO.getWantShopAreaId()));
|
|
|
|
|
return baseInfoVO;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 用户画像MAP
|
|
|
|
|
* @param lineInfoDOList
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private Map<Long, HyPartnerLabelDO> getUserPortraitMap(List<LineInfoDO> lineInfoDOList){
|
|
|
|
|
List<Long> libelIds = new ArrayList<>();
|
|
|
|
|
lineInfoDOList.stream().forEach(x->{
|
|
|
|
|
if (StringUtil.isNotEmpty(x.getUserPortrait())){
|
|
|
|
|
List<String> list = Arrays.asList(x.getUserPortrait().split(",")).subList(1, x.getUserPortrait().split(",").length);
|
|
|
|
|
libelIds.addAll(list.stream().map(Long::valueOf).collect(Collectors.toList()));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
List<HyPartnerLabelDO> hyPartnerLabelDOS = hyPartnerLabelDAO.listByIds(libelIds);
|
|
|
|
|
return hyPartnerLabelDOS.stream().collect(Collectors.toMap(HyPartnerLabelDO::getId, x -> x));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|