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

This commit is contained in:
zhangchenbiao
2024-03-29 19:59:23 +08:00
26 changed files with 832 additions and 40 deletions

View File

@@ -2,9 +2,12 @@ package com.cool.store.service;
import com.cool.store.context.LoginUserInfo;
import com.cool.store.request.AddTagsRequest;
import com.cool.store.request.ChangeInvestmentRequest;
import com.cool.store.request.LineListRequest;
import com.cool.store.request.PublicLineListRequest;
import com.cool.store.vo.LineInfoVO;
import com.cool.store.vo.LineListVO;
import com.cool.store.vo.PublicLineListVO;
import com.github.pagehelper.PageInfo;
/**
@@ -32,6 +35,14 @@ public interface LineService {
PageInfo<LineListVO> getLineList(LineListRequest lineListRequest, LoginUserInfo loginUserInfo,Boolean teamFlag);
/**
* 公海线索
* @param publicLineListRequest
* @param loginUserInfo
* @return
*/
PageInfo<PublicLineListVO> getPublicLineList(PublicLineListRequest publicLineListRequest, LoginUserInfo loginUserInfo);
/**
* 添加标签
* @param userInfo
@@ -40,4 +51,13 @@ public interface LineService {
*/
Boolean addTags(LoginUserInfo userInfo, AddTagsRequest addTagsRequest);
/**
* 分配招商经理
* @param changeInvestmentRequest
* @param userInfo
* @return
*/
Boolean transferInvestmentManager(ChangeInvestmentRequest changeInvestmentRequest, LoginUserInfo userInfo,Boolean transferFlag);
}

View File

@@ -0,0 +1,26 @@
package com.cool.store.service;
import com.cool.store.dto.TransferLogDTO;
import com.cool.store.entity.LineInfoDO;
import com.cool.store.enums.OperationLogTypeEnum;
import com.github.pagehelper.PageInfo;
/**
* @Author suzhuhong
* @Date 2024/3/29 18:04
* @Version 1.0
*/
public interface TransferLogService {
/**
* 添加日志 操作日志类型
* @param lineInfoDO
* @param formUserId
* @param toUserId
* @param operationLogTypeEnum
*/
void addLog(LineInfoDO lineInfoDO, String formUserId, String toUserId, OperationLogTypeEnum operationLogTypeEnum);
PageInfo<TransferLogDTO> getTransferLogPage(Integer pageNum, Integer pageSize, Long lineId);
}

View File

@@ -1,8 +1,13 @@
package com.cool.store.service.impl;
import com.cool.store.dao.BankDAO;
import com.cool.store.dao.LineInfoDAO;
import com.cool.store.entity.BankdocDO;
import com.cool.store.entity.BanktypeDO;
import com.cool.store.entity.LineInfoDO;
import com.cool.store.enums.LineStatusEnum;
import com.cool.store.enums.WorkflowSubStageEnum;
import com.cool.store.enums.WorkflowSubStageStatusEnum;
import com.cool.store.request.BranchBankPageRequest;
import com.cool.store.service.BankService;
import com.github.pagehelper.Page;
@@ -13,6 +18,7 @@ import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
@@ -21,10 +27,12 @@ import java.util.List;
*/
@Service
@Slf4j
public class BankServiceImpl implements BankService {
public class BankServiceImpl extends LineFlowService implements BankService {
@Autowired
private BankDAO bankDAO;
@Resource
LineInfoDAO lineInfoDAO;
@Override
public List<BanktypeDO> listBank() {
@@ -42,4 +50,31 @@ public class BankServiceImpl implements BankService {
PageInfo resultPage = new PageInfo(pageInfo);
return resultPage;
}
@Override
protected Boolean initStage(Long auditId, LineInfoDO lineInfo) {
return null;
}
@Override
protected Boolean auditPass(Long auditId, LineInfoDO lineInfo) {
WorkflowSubStageEnum workflowSubStageEnum = WorkflowSubStageEnum.getWorkflowSubStageEnum(lineInfo.getWorkflowSubStage());
WorkflowSubStageEnum nextStage = workflowSubStageEnum.getNextStage();
//更新线索阶段
lineInfoDAO.updateWorkflowStage(lineInfo.getId(), nextStage, nextStage.getInitStatus());
return Boolean.TRUE;
}
@Override
protected Boolean auditReject(Long auditId, LineInfoDO lineInfo) {
lineInfo.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.PAY_FAIL_55.getCode());
lineInfoDAO.updateLineInfo(lineInfo);
return Boolean.TRUE;
}
@Override
protected Boolean auditClose(Long auditId, LineInfoDO lineInfo) {
return Boolean.TRUE;
}
}

View File

@@ -1,11 +1,10 @@
package com.cool.store.service.impl;
import com.cool.store.dao.LineInfoDAO;
import com.cool.store.entity.LineInfoDO;
import com.cool.store.entity.MemberQuestionDO;
import com.cool.store.entity.SigningBaseInfoDO;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.enums.JoinTypeEnum;
import com.cool.store.enums.WorkflowSubStageStatusEnum;
import com.cool.store.enums.*;
import com.cool.store.exception.ServiceException;
import com.cool.store.mapper.IntentAgreementMapper;
import com.cool.store.mapper.JoinIntentionMapper;
@@ -26,7 +25,7 @@ import static com.cool.store.enums.ErrorCodeEnum.PARAMS_VALIDATE_ERROR;
@Service
@Slf4j
public class IntentAgreementServiceImpl implements IntentAgreementService {
public class IntentAgreementServiceImpl extends LineFlowService implements IntentAgreementService {
@Resource
@@ -38,6 +37,9 @@ public class IntentAgreementServiceImpl implements IntentAgreementService {
@Resource
JoinIntentionMapper joinIntentionMapper;
@Resource
LineInfoDAO lineInfoDAO;
@Override
@Transactional(rollbackFor = Exception.class)
@@ -78,4 +80,55 @@ public class IntentAgreementServiceImpl implements IntentAgreementService {
response.setType(byLineId.getJoinType());
return response;
}
@Override
protected Boolean initStage(Long auditId, LineInfoDO lineInfo) {
return null;
}
@Override
protected Boolean auditPass(Long auditId, LineInfoDO lineInfo) {
//校验是否是审核节点
if ((lineInfo.getWorkflowStage().equals(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_63.getCode()) ||
lineInfo.getWorkflowStage().equals(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_75.getCode()))){
throw new ServiceException(ErrorCodeEnum.NOT_APPROVE_NODE);
}
//待审核code 63 处理逻辑
if (lineInfo.getWorkflowStage().equals(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_63.getCode())){
lineInfo.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_70.getCode());
lineInfoDAO.updateLineInfo(lineInfo);
}
//待OA审核code 75 处理逻辑
if(lineInfo.getWorkflowStage().equals(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_75.getCode())){
WorkflowSubStageEnum workflowSubStageEnum = WorkflowSubStageEnum.getWorkflowSubStageEnum(lineInfo.getWorkflowSubStage());
WorkflowSubStageEnum nextStage = workflowSubStageEnum.getNextStage();
//更新线索阶段
lineInfoDAO.updateWorkflowStage(lineInfo.getId(), nextStage, nextStage.getInitStatus());
}
return Boolean.TRUE;
}
@Override
protected Boolean auditReject(Long auditId, LineInfoDO lineInfo) {
if ((lineInfo.getWorkflowStage().equals(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_63.getCode()) ||
lineInfo.getWorkflowStage().equals(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_75.getCode()))){
throw new ServiceException(ErrorCodeEnum.NOT_APPROVE_NODE);
}
//待审核code 63 处理逻辑
if (lineInfo.getWorkflowStage().equals(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_63.getCode())){
lineInfo.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_65.getCode());
lineInfoDAO.updateLineInfo(lineInfo);
}
//待OA审核code 75 处理逻辑
if(lineInfo.getWorkflowStage().equals(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_75.getCode())){
lineInfo.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_80.getCode());
lineInfoDAO.updateLineInfo(lineInfo);
}
return Boolean.TRUE;
}
@Override
protected Boolean auditClose(Long auditId, LineInfoDO lineInfo) {
return Boolean.TRUE;
}
}

View File

@@ -76,9 +76,8 @@ public class JoinIntentionServiceImpl extends LineFlowService implements JoinInt
protected Boolean auditPass(Long auditId, LineInfoDO lineInfo) {
WorkflowSubStageEnum workflowSubStageEnum = WorkflowSubStageEnum.getWorkflowSubStageEnum(lineInfo.getWorkflowSubStage());
WorkflowSubStageEnum nextStage = workflowSubStageEnum.getNextStage();
lineInfo.setWorkflowSubStage(nextStage.getCode());
lineInfo.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.INVITING_INTERVIEWS_10.getCode());
lineInfoDAO.updateLineInfo(lineInfo);
//更新线索阶段
lineInfoDAO.updateWorkflowStage(lineInfo.getId(), nextStage, nextStage.getInitStatus());
return Boolean.TRUE;
}
@@ -92,8 +91,6 @@ public class JoinIntentionServiceImpl extends LineFlowService implements JoinInt
@Override
protected Boolean auditClose(Long auditId, LineInfoDO lineInfo) {
lineInfo.setLineStatus(LineStatusEnum.PUBLIC_SEAS.getCode());
lineInfoDAO.updateLineInfo(lineInfo);
return Boolean.TRUE;
}

View File

@@ -5,26 +5,22 @@ import cn.hutool.core.date.DateUtil;
import com.cool.store.constants.CommonConstants;
import com.cool.store.context.LoginUserInfo;
import com.cool.store.dao.*;
import com.cool.store.entity.EnterpriseUserDO;
import com.cool.store.entity.HyOpenAreaInfoDO;
import com.cool.store.entity.HyPartnerLabelDO;
import com.cool.store.entity.LineInfoDO;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.enums.OperateTypeEnum;
import com.cool.store.enums.WorkflowStageEnum;
import com.cool.store.entity.*;
import com.cool.store.enums.*;
import com.cool.store.exception.ServiceException;
import com.cool.store.mapper.RegionMapper;
import com.cool.store.request.AddTagsRequest;
import com.cool.store.request.ChangeInvestmentRequest;
import com.cool.store.request.LineListRequest;
import com.cool.store.service.DeskService;
import com.cool.store.service.LineService;
import com.cool.store.service.RegionService;
import com.cool.store.request.PublicLineListRequest;
import com.cool.store.service.*;
import com.cool.store.utils.CoolDateUtils;
import com.cool.store.utils.StringUtil;
import com.cool.store.utils.poi.DateUtils;
import com.cool.store.vo.BaseInfoVO;
import com.cool.store.vo.LineInfoVO;
import com.cool.store.vo.LineListVO;
import com.cool.store.vo.PublicLineListVO;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.collections4.CollectionUtils;
@@ -57,6 +53,12 @@ public class LineServiceImpl implements LineService {
RegionService regionService;
@Resource
RegionDao regionDao;
@Resource
SysRoleService sysRoleService;
@Resource
UserAuthMappingService userAuthMappingService;
@Resource
TransferLogService transferLogService;
@Override
public LineInfoVO getLineInfo(Long lineId) {
@@ -94,18 +96,29 @@ public class LineServiceImpl implements LineService {
@Override
public PageInfo<LineListVO> getLineList(LineListRequest lineListRequest, LoginUserInfo loginUserInfo,Boolean teamFlag) {
//确定意向区域
List<Long> wantShopAreaIds = new ArrayList<>();
String userId = null;
if(!teamFlag){
userId = loginUserInfo.getUserId();
}
if (teamFlag && !sysRoleService.checkIsAdmin(loginUserInfo.getUserId())){
List<Long> list = userAuthMappingService.listWantShopAreaIdByUserId(loginUserInfo.getUserId());
if (CollectionUtils.isNotEmpty(list)){
wantShopAreaIds = list;
}else {
userId = loginUserInfo.getUserId();
}
}
PageHelper.startPage(lineListRequest.getPageNum(), lineListRequest.getPageSize());
List<LineInfoDO> lineInfoDOS = lineInfoDAO.lineList(lineListRequest, loginUserInfo.getUserId(), null);
List<LineInfoDO> lineInfoDOS = lineInfoDAO.lineList(lineListRequest, userId, wantShopAreaIds);
PageInfo page = new PageInfo(lineInfoDOS);
Map<Long, HyPartnerLabelDO> userPortraitMap = deskService.getUserPortraitMap(lineInfoDOS);
List<Long> wantShopAreaIds = lineInfoDOS.stream().filter(lineInfoDO -> lineInfoDO.getWantShopAreaId() != null).map(LineInfoDO::getWantShopAreaId).collect(Collectors.toList());
Map<Long, String> wantShopAreaMap = hyOpenAreaInfoDAO.selectNameMapByIds(wantShopAreaIds);
List<Long> wantShopAreaIdList = lineInfoDOS.stream().filter(lineInfoDO -> lineInfoDO.getWantShopAreaId() != null).map(LineInfoDO::getWantShopAreaId).collect(Collectors.toList());
Map<Long, String> wantShopAreaMap = hyOpenAreaInfoDAO.selectNameMapByIds(wantShopAreaIdList);
List<Integer> lineSourceIds = lineInfoDOS.stream().filter(lineInfoDO -> lineInfoDO.getLineSource() != null).map(LineInfoDO::getLineSource).collect(Collectors.toList());
Map<Integer, String> channelMapByIds = hyPartnerUserChannelDAO.getChannelMapByIds(lineSourceIds);
List<String> userIds = lineInfoDOS.stream().filter(lineInfoDO -> lineInfoDO.getInvestmentManager() != null).map(LineInfoDO::getInvestmentManager).collect(Collectors.toList());
userIds.addAll(lineInfoDOS.stream().filter(lineInfoDO -> lineInfoDO.getCreateUserId() != null).map(LineInfoDO::getCreateUserId).collect(Collectors.toList()));
userIds.addAll(lineInfoDOS.stream().filter(lineInfoDO -> lineInfoDO.getUpdateUserId() != null).map(LineInfoDO::getUpdateUserId).collect(Collectors.toList()));
Map<String, String> userNameMap = enterpriseUserDAO.getUserNameMap(userIds);
List<LineListVO> result = new ArrayList<>();
@@ -123,6 +136,37 @@ public class LineServiceImpl implements LineService {
return page;
}
@Override
public PageInfo<PublicLineListVO> getPublicLineList(PublicLineListRequest publicLineListRequest, LoginUserInfo loginUserInfo) {
PageHelper.startPage(publicLineListRequest.getPageNum(), publicLineListRequest.getPageSize());
List<LineInfoDO> lineInfoDOS = lineInfoDAO.publicLineList(publicLineListRequest);
PageInfo page = new PageInfo(lineInfoDOS);
Map<Long, HyPartnerLabelDO> userPortraitMap = deskService.getUserPortraitMap(lineInfoDOS);
List<Long> wantShopAreaIdList = lineInfoDOS.stream().filter(lineInfoDO -> lineInfoDO.getWantShopAreaId() != null).map(LineInfoDO::getWantShopAreaId).collect(Collectors.toList());
Map<Long, String> wantShopAreaMap = hyOpenAreaInfoDAO.selectNameMapByIds(wantShopAreaIdList);
List<Integer> lineSourceIds = lineInfoDOS.stream().filter(lineInfoDO -> lineInfoDO.getLineSource() != null).map(LineInfoDO::getLineSource).collect(Collectors.toList());
Map<Integer, String> channelMapByIds = hyPartnerUserChannelDAO.getChannelMapByIds(lineSourceIds);
List<String> userIds = lineInfoDOS.stream().filter(lineInfoDO -> lineInfoDO.getInvestmentManager() != null).map(LineInfoDO::getInvestmentManager).collect(Collectors.toList());
userIds.addAll(lineInfoDOS.stream().filter(lineInfoDO -> lineInfoDO.getCreateUserId() != null).map(LineInfoDO::getCreateUserId).collect(Collectors.toList()));
userIds.addAll(lineInfoDOS.stream().filter(lineInfoDO -> lineInfoDO.getDevelopmentManager() != null).map(LineInfoDO::getDevelopmentManager).collect(Collectors.toList()));
Map<String, String> userNameMap = enterpriseUserDAO.getUserNameMap(userIds);
List<PublicLineListVO> result = new ArrayList<>();
lineInfoDOS.forEach(x->{
BaseInfoVO baseInfoVO = deskService.convertToBaseInfoVO(x, userPortraitMap, wantShopAreaMap);
PublicLineListVO publicLineListVO = new PublicLineListVO(baseInfoVO);
publicLineListVO.setCreateTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, x.getCreateTime()));
publicLineListVO.setUpdateTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, x.getUpdateTime()));
publicLineListVO.setLineSourceName(channelMapByIds.get(x.getLineSource()));
publicLineListVO.setLastInvestmentManagerUserName(userNameMap.get(x.getInvestmentManager()));
publicLineListVO.setLastDevelopmentManagerUserName(userNameMap.get(x.getDevelopmentManager()));
publicLineListVO.setUpdateUserName(userNameMap.get(x.getUpdateUserId()));
result.add(publicLineListVO);
});
page.setList(result);
return page;
}
@Override
public Boolean addTags(LoginUserInfo user, AddTagsRequest addTagsRequest) {
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(addTagsRequest.getLineId());
@@ -136,4 +180,25 @@ public class LineServiceImpl implements LineService {
return Boolean.TRUE;
}
@Override
public Boolean transferInvestmentManager(ChangeInvestmentRequest changeInvestmentRequest, LoginUserInfo userInfo,Boolean transferFlag) {
//查询线索
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(changeInvestmentRequest.getLineId());
if (lineInfo==null){
throw new ServiceException(ErrorCodeEnum.LINE_ID_IS_NOT_EXIST);
}
if (lineInfo.getLineStatus().equals(LineStatusEnum.PUBLIC_SEAS.getCode())){
throw new ServiceException(ErrorCodeEnum.NOT_IN_PUBLIC_SEA);
}
//如果线索招商经理为空 直接分配 如果不为空 且线索在公海 说明线索被结束 需要重置ID 生成一条新的线索
lineInfo.setLineStatus(LineStatusEnum.PRIVATE_SEAS.getCode());
lineInfo.setInvestmentManager(changeInvestmentRequest.getInvestmentManagerId());
lineInfoDAO.updateLineInfo(lineInfo);
if (transferFlag){
//添加日志
transferLogService.addLog(lineInfo,userInfo.getUserId(),changeInvestmentRequest.getInvestmentManagerId(), OperationLogTypeEnum.TRANSFER_INVESTMENT_MANAGER);
}
return Boolean.TRUE;
}
}

View File

@@ -1,11 +1,13 @@
package com.cool.store.service.impl;
import com.cool.store.dao.LineInfoDAO;
import com.cool.store.entity.LeaseBaseInfoDO;
import com.cool.store.entity.LineInfoDO;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.enums.ExperienceStatusEnum;
import com.cool.store.enums.WorkflowSubStageEnum;
import com.cool.store.enums.WorkflowSubStageStatusEnum;
import com.cool.store.enums.*;
import com.cool.store.exception.ServiceException;
import com.cool.store.mapper.LineInfoMapper;
import com.cool.store.mapper.TrainingExperienceMapper;
@@ -23,7 +25,7 @@ import static com.cool.store.enums.ErrorCodeEnum.INTERVIEW_LINE_ID_IS_NULL;
@Service
@Slf4j
public class TrainingExperienceServiceImpl implements TrainingExperienceService {
public class TrainingExperienceServiceImpl extends LineFlowService implements TrainingExperienceService {
@Resource
TrainingExperienceMapper trainingExperienceMapper;
@@ -31,6 +33,8 @@ public class TrainingExperienceServiceImpl implements TrainingExperienceService
@Resource
LineInfoMapper lineInfoMapper;
@Resource
LineInfoDAO lineInfoDAO;
@Override
@Transactional(rollbackFor = Exception.class)
public boolean distribution(TrainingExperienceDistributionRequest request) {
@@ -69,4 +73,29 @@ public class TrainingExperienceServiceImpl implements TrainingExperienceService
LeaseBaseInfoDO leaseBaseInfoDO = trainingExperienceMapper.selectByLineId(lineId);
return leaseBaseInfoDO;
}
@Override
protected Boolean initStage(Long auditId, LineInfoDO lineInfo) {
return null;
}
@Override
protected Boolean auditPass(Long auditId, LineInfoDO lineInfo) {
WorkflowSubStageEnum workflowSubStageEnum = WorkflowSubStageEnum.getWorkflowSubStageEnum(lineInfo.getWorkflowSubStage());
WorkflowSubStageEnum nextStage = workflowSubStageEnum.getNextStage();
//更新线索阶段
lineInfoDAO.updateWorkflowStage(lineInfo.getId(), nextStage, nextStage.getInitStatus());
return Boolean.TRUE;
}
@Override
protected Boolean auditReject(Long auditId, LineInfoDO lineInfo) {
return Boolean.TRUE;
}
@Override
protected Boolean auditClose(Long auditId, LineInfoDO lineInfo) {
return Boolean.TRUE;
}
}

View File

@@ -0,0 +1,46 @@
package com.cool.store.service.impl;
import com.cool.store.dao.TransferLogDAO;
import com.cool.store.dto.TransferLogDTO;
import com.cool.store.entity.LineInfoDO;
import com.cool.store.entity.TransferLogDO;
import com.cool.store.enums.OperationLogTypeEnum;
import com.cool.store.service.TransferLogService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* @Author suzhuhong
* @Date 2024/3/29 18:11
* @Version 1.0
*/
@Service
public class TransferLogServiceImpl implements TransferLogService {
@Resource
private TransferLogDAO transferLogDAO;
@Override
public void addLog(LineInfoDO lineInfoDO, String formUserId, String toUserId, OperationLogTypeEnum operationLogTypeEnum) {
TransferLogDO transferLogDO = new TransferLogDO();
transferLogDO.setLineId(lineInfoDO.getId());
transferLogDO.setPartnerId(lineInfoDO.getPartnerId());
transferLogDO.setFromUserId(formUserId);
transferLogDO.setToUserId(toUserId);
transferLogDO.setType(operationLogTypeEnum.getCode());
// 添加操作日志
transferLogDAO.add(transferLogDO);
}
@Override
public PageInfo<TransferLogDTO> getTransferLogPage(Integer pageNum, Integer pageSize, Long lineId) {
PageHelper.startPage(pageNum, pageSize);
List<TransferLogDTO> transferLogList = transferLogDAO.getTransferLogList(lineId);
PageInfo<TransferLogDTO> transferLogDTOPageInfo = new PageInfo<>(transferLogList);
return transferLogDTOPageInfo;
}
}