Merge branch 'master' into cc_20250211_v2.6

# Conflicts:
#	coolstore-partner-service/src/main/java/com/cool/store/service/impl/ShopServiceImpl.java
This commit is contained in:
shuo.wang
2025-02-14 16:18:00 +08:00
105 changed files with 3388 additions and 1274 deletions

View File

@@ -29,32 +29,6 @@ public interface DeskService {
*/
PageInfo<IntendPendingVO> intendPendingList(Integer pageNum, Integer pageSize,String userId);
/**
* 面试待处理
* @param pageNum
* @param pageSize
* @param userId
* @return
*/
PageInfo<InterviewPendingVO> interviewPendingList(Integer pageNum, Integer pageSize,String userId);
/**
* 一审面试待处理
* @param pageNum
* @param pageSize
* @param user
* @return
*/
PageInfo<InterviewPendingVO> firstInterviewPendingList(Integer pageNum, Integer pageSize, LoginUserInfo user);
/**
* 二审面试待处理
* @param pageNum
* @param pageSize
* @param user
* @return
*/
PageInfo<InterviewPendingVO> secondInterviewPendingList(Integer pageNum, Integer pageSize, LoginUserInfo user);
/**
* payStagePendingList
@@ -75,14 +49,6 @@ public interface DeskService {
*/
PageInfo<SigningPendingVO> signingPendingList(Integer pageNum, Integer pageSize, LoginUserInfo user);
/**
* storeExperiencePendingList
* @param pageNum
* @param pageSize
* @param user
* @return
*/
PageInfo<StoreExperiencePendingVO> storeExperiencePendingList(Integer pageNum, Integer pageSize, LoginUserInfo user);
/**
* convertToBaseInfoVO
@@ -110,14 +76,6 @@ public interface DeskService {
InvestmentCountDTO getInvestmentCount(LoginUserInfo user);
/**
* 系统建店待处理数据
* @param pageNum
* @param pageSize
* @param user
* @return
*/
PageInfo<PreparationCommonPendingVO> systemBuildStorePendingList(Integer pageNum, Integer pageSize, LoginUserInfo user);
/**
* 缴纳加盟费待处理数据
* @param pageNum
@@ -152,15 +110,14 @@ public interface DeskService {
* @return
*/
PageInfo<PreparationCommonPendingVO> openingAndOperationPlanPendingList(Integer pageNum, Integer pageSize, LoginUserInfo user);
/**
* 首批订货清单待处理数据
* 培训清单待处理数据
* @param pageNum
* @param pageSize
* @param user
* @return
*/
PageInfo<PreparationCommonPendingVO> firstOrderListPendingList(Integer pageNum, Integer pageSize, LoginUserInfo user);
PageInfo<PreparationCommonPendingVO> trainListPendingList(Integer pageNum, Integer pageSize, LoginUserInfo user);
/**
* 信发系统

View File

@@ -4,6 +4,7 @@ import com.cool.store.dto.Preparation.PreparationDTO;
import com.cool.store.entity.ImportTaskDO;
import com.cool.store.entity.LineInfoDO;
import com.cool.store.entity.PointInfoDO;
import com.cool.store.response.BranchShopResponse;
import java.util.List;
@@ -15,5 +16,6 @@ import java.util.List;
*/
public interface ExportRealizeService {
void preparationList( List<PreparationDTO> preparationDTOS,ImportTaskDO importTaskDO);
void branchShopList(List<BranchShopResponse> list,ImportTaskDO importTaskDO);
}

View File

@@ -10,5 +10,6 @@ import com.cool.store.request.*;
* @注释:
*/
public interface ExportService {
Integer preparationList(PreparationRequest request,LoginUserInfo loginUserInfo);
Long branchShopList(BranchShopRequest request,LoginUserInfo user);
}

View File

@@ -19,7 +19,7 @@ public interface LineFollowService {
* @param pageSize
* @return
*/
PageInfo<LineFollowLogVO> getFollowLogPage(Long lineId, Integer pageNum, Integer pageSize);
PageInfo<LineFollowLogVO> getFollowLogPage(Long lineId, Integer pageNum, Integer pageSize,Integer type);
/**
* 新增跟进日志

View File

@@ -5,6 +5,8 @@ import com.cool.store.request.*;
import com.cool.store.vo.*;
import com.github.pagehelper.PageInfo;
import java.util.List;
/**
* @Author suzhuhong
* @Date 2024/3/25 13:45
@@ -97,5 +99,7 @@ public interface LineService {
String getPayPicByLineId(Long lineId);
//增加查询资质审核的意向加盟商或正式加盟商搜索范围为全部
PageInfo<LineVO> getLines(LinesRequest request);
}

View File

@@ -4,6 +4,7 @@ import com.cool.store.request.*;
import com.cool.store.vo.LinePointBaseInfoVO;
import com.cool.store.vo.point.*;
import com.cool.store.vo.shop.RentInfoToDoVO;
import com.cool.store.vo.shop.ShopPointBaseInfoVO;
import com.github.pagehelper.PageInfo;
import java.util.List;
@@ -124,6 +125,8 @@ public interface PointService {
*/
PageInfo<LinePointBaseInfoVO> getLinePage(PointLinePageRequest request);
PageInfo<ShopPointBaseInfoVO> getShopPage(PointLinePageRequest request);
/**
* 获取单个加盟商信息
@@ -167,6 +170,13 @@ public interface PointService {
*/
List<PointRecommendPageVO> getLineRecommendPointList(Long lineId);
/**
* 获取门店推荐列表
* @param shopId
* @return
*/
List<PointRecommendPageVO> getShopRecommendPointList(Long shopId);
/**
* 获取我的可推荐铺位列表
* @param request
@@ -284,4 +294,11 @@ public interface PointService {
* @return
*/
PageInfo<RentInfoToDoVO> getRentContractToDoPage(String userId, Integer pageNumber, Integer pageSize);
/**
* 数据处理 V2.4
* @return
*/
Boolean linePointToShopPoint(Long lineId);
}

View File

@@ -7,6 +7,7 @@ import com.cool.store.vo.Preparation.PreparationScheduleVO;
import com.github.pagehelper.PageInfo;
import java.util.List;
import java.util.Map;
/**
* @Author suzhuhong
@@ -19,7 +20,7 @@ public interface PreparationService {
/**
* 开业进度列表
* @param preparationRequest
* @return
* @return //原先进度管理接口废弃使用branchShopList
*/
PageInfo<PreparationScheduleVO> getPreparationSchedule(PreparationRequest preparationRequest);
@@ -66,5 +67,13 @@ public interface PreparationService {
*/
Boolean decorationFlush(Long shopId);
//阶段完成奢shop_status=1已完成
void updateShopStatus(Long shopId);
/**
* 获取店铺状态
* @param shopIds
* @return
*/
Map<Long,Integer> getShopStatus(List<Long> shopIds);
}

View File

@@ -2,15 +2,13 @@ package com.cool.store.service;
import com.cool.store.entity.LineInfoDO;
import com.cool.store.entity.ShopInfoDO;
import com.cool.store.request.AddShopRequest;
import com.cool.store.request.DeleteShopRequest;
import com.cool.store.request.UpdateShopCodeRequest;
import com.cool.store.request.*;
import com.cool.store.response.BranchShopDetailResponse;
import com.cool.store.response.BranchShopResponse;
import com.cool.store.vo.shop.MiniShopPageVO;
import com.cool.store.vo.shop.RentInfoToDoVO;
import com.cool.store.vo.shop.ShopStageInfoVO;
import com.cool.store.vo.shop.StageShopCountVO;
import com.github.pagehelper.PageInfo;
import lombok.Data;
import java.util.List;
@@ -34,7 +32,7 @@ public interface ShopService {
* @param lineId
* @return
*/
List<MiniShopPageVO> getShopList(Long lineId);
List<MiniShopPageVO> getShopList(Long lineId,String userId);
/**
* 获取店铺阶段信息
@@ -70,5 +68,39 @@ public interface ShopService {
*/
ShopInfoDO getShopInfo(Long shopId);
Integer updateShopCode(UpdateShopCodeRequest request);
Integer updateShopCode(UpdateShopCodeRequest request,String userId);
/**
* 新建分店
*/
Long addBranchShop(AddBranchShopRequest request,String userId);
/**
* 开店详情/左边小窗
*/
BranchShopDetailResponse getBranchShopDetail(Long shopId);
/**
* 修改开店详情/左边小窗
*/
Integer updateBranchShopDetail(BranchShopDetailRequest request,String userId);
/**
* 修改门店招商专员/督导
*/
Integer updateShopInvestment(Long shopId,String updateUserId,String userId);
/**
* 门店结束跟进
* @param shopId
* @return
*/
Boolean shopClose(Long shopId);
/**
* 分店列表
*/
PageInfo<BranchShopResponse> getBranchShopList(BranchShopRequest request, String userId);
Boolean dataHandler(Long shopId);
}

View File

@@ -2,6 +2,7 @@ package com.cool.store.service;
import com.cool.store.dto.TransferLogDTO;
import com.cool.store.entity.LineInfoDO;
import com.cool.store.entity.ShopInfoDO;
import com.cool.store.enums.OperationLogTypeEnum;
import com.github.pagehelper.PageInfo;
@@ -14,13 +15,14 @@ public interface TransferLogService {
/**
* 添加日志 操作日志类型
* @param lineInfoDO
* @param id 线索ID 或者 门店ID 如果是线索ID 则表示线索转让记录 如果是门店ID 则表示门店转移记录
* @param partnerId
* @param formUserId
* @param toUserId
* @param operationLogTypeEnum
*/
void addLog(LineInfoDO lineInfoDO, String formUserId, String toUserId, OperationLogTypeEnum operationLogTypeEnum);
void addLog(Long id ,String partnerId, String formUserId, String toUserId, OperationLogTypeEnum operationLogTypeEnum);
PageInfo<TransferLogDTO> getTransferLogPage(Integer pageNum, Integer pageSize, Long lineId);
PageInfo<TransferLogDTO> getTransferLogPage(Integer pageNum, Integer pageSize, Long lineId,Integer lineShopType);
}

View File

@@ -124,6 +124,7 @@ public class ApplyLicenseServiceImpl implements ApplyLicenseService {
if (Constants.ONE_INTEGER.equals(request.getSubmitStatus()) && shopSubStageInfo.getShopSubStageStatus().equals(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_30.getShopSubStageStatus())) {
shopStageInfoDAO.updateShopStageAndAuditInfo(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_33, null);
preparationService.licenseCompleted(request.getShopId());
preparationService.updateShopStatus(request.getShopId());
}
return Boolean.TRUE;
}
@@ -155,6 +156,7 @@ public class ApplyLicenseServiceImpl implements ApplyLicenseService {
if (Constants.ONE_INTEGER.equals(request.getSubmitStatus()) && shopSubStageInfo.getShopSubStageStatus().equals(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_40.getShopSubStageStatus())) {
shopStageInfoDAO.updateShopStageAndAuditInfo(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_43, null);
preparationService.licenseCompleted(request.getShopId());
preparationService.updateShopStatus(request.getShopId());
}
return Boolean.TRUE;
}

View File

@@ -71,6 +71,7 @@ public class AuditOpeningOperationPlanImpl implements AuditOpeningOperationPlanS
}
shopStageInfoDAO.updateShopStageAndAuditInfo(request.getShopId(),
shopSubStageStatusEnum, auditId);
preparationService.updateShopStatus(request.getShopId());
if (flag){
preparationService.whetherToOpenForAcceptance(request.getShopId());
}

View File

@@ -617,6 +617,7 @@ public class DecorationServiceImpl implements DecorationService {
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean confirmDesign(DecorationDesignRequest request, LoginUserInfo user) {
//重复提交校验 3秒内不能重复提交
String lockKey = "confirmDesign:" + request.getShopId();
@@ -637,6 +638,7 @@ public class DecorationServiceImpl implements DecorationService {
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean confirmComplete(Long shopId, LoginUserInfo user) {
//判断施工阶段是否时施工中 施工中才能施工完成
ShopStageInfoDO shopStageInfoDO = shopStageInfoDAO.getByShopIdAndSubStage(shopId, ShopSubStageEnum.SHOP_STAGE_11.getShopSubStage());
@@ -681,6 +683,7 @@ public class DecorationServiceImpl implements DecorationService {
&& CommonConstants.ONE == partner.getResult()) {
//更新阶段状态验收完毕
shopStageInfoDAO.updateShopStageAndAuditInfo(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_123, null);
preparationService.updateShopStatus(request.getShopId());
} else {
//未通过至为待验收
shopStageInfoDAO.updateShopStageAndAuditInfo(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_121, null);

View File

@@ -8,6 +8,7 @@ import com.cool.store.dto.PendingCountDTO;
import com.cool.store.dto.DeskStageDTO;
import com.cool.store.dto.openPreparation.PlanLineDTO;
import com.cool.store.entity.*;
import com.cool.store.enums.UserRoleEnum;
import com.cool.store.enums.WorkflowSubStageStatusEnum;
import com.cool.store.enums.point.PayBusinessTypeEnum;
import com.cool.store.enums.point.ShopSubStageEnum;
@@ -104,98 +105,6 @@ public class DeskServiceImpl implements DeskService {
return page;
}
@Override
public PageInfo<InterviewPendingVO> interviewPendingList(Integer pageNum, Integer pageSize, String userId) {
// PageHelper.startPage(pageNum, pageSize);
// List<LineInfoDO> lineInfoDOS = lineInfoDAO.listByInvestmentManager(userId,Arrays.asList(WorkflowSubStageStatusEnum.INVITING_INTERVIEWS_20.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());
// Map<Long, String> wantShopAreaMap = hyOpenAreaInfoDAO.selectNameMapByIds(wantShopAreaIds);
// 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 new PageInfo<>();
}
@Override
public PageInfo<InterviewPendingVO> firstInterviewPendingList(Integer pageNum, Integer pageSize, LoginUserInfo userInfo) {
// PageHelper.startPage(pageNum, pageSize);
// List<LineInfoDO> lineInfoDOS = lineInfoDAO.listByInterview(userInfo.getUserId(),InterviewTypeEnum.INTERVIEW.getCode(),
// Arrays.asList(WorkflowSubStageStatusEnum.FIRST_INTERVIEWS_30.getCode(),WorkflowSubStageStatusEnum.FIRST_INTERVIEWS_35.getCode()),WorkflowSubStageStatusEnum.FIRST_INTERVIEWS_40.getCode(),null);
// 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());
// Map<Long, String> wantShopAreaMap = hyOpenAreaInfoDAO.selectNameMapByIds(wantShopAreaIds);
// List<Long> lineIds = lineInfoDOS.stream().filter(lineInfoDO -> lineInfoDO.getId() != null).map(LineInfoDO::getId).collect(Collectors.toList());
// List<LineInterviewDO> interviewByLindIds = lineInterviewDAO.getInterviewByLindIds(lineIds, InterviewTypeEnum.INTERVIEW);
// Map<Long, LineInterviewDO> interviewDOMap = interviewByLindIds.stream().collect(Collectors.toMap(LineInterviewDO::getLineId, x -> x, (k1, k2) -> k1));
// List<String> userIds = lineInfoDOS.stream().filter(lineInfoDO -> lineInfoDO.getFirstInterviewer() != null).map(LineInfoDO::getFirstInterviewer).collect(Collectors.toList());
// Map<String, EnterpriseUserDO> userInfoMap = enterpriseUserDAO.getUserInfoMap(userIds);
//
// 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()));
// interviewPendingVO.setInterviewer(userInfoMap.getOrDefault(x.getFirstInterviewer(),new EnterpriseUserDO()).getName());
// interviewPendingVO.setInterviewId(lineInterviewDO.getId());
// }
// list.add(interviewPendingVO);
// });
// page.setList(list);
return new PageInfo<>();
}
@Override
public PageInfo<InterviewPendingVO> secondInterviewPendingList(Integer pageNum, Integer pageSize, LoginUserInfo userInfo) {
// PageHelper.startPage(pageNum, pageSize);
// List<LineInfoDO> lineInfoDOS = lineInfoDAO.listByInterview(userInfo.getUserId(),InterviewTypeEnum.SECOND_INTERVIEW.getCode(),
// Arrays.asList(WorkflowSubStageStatusEnum.SECOND_INTERVIEWS_105.getCode(),WorkflowSubStageStatusEnum.SECOND_INTERVIEWS_110.getCode()), WorkflowSubStageStatusEnum.SECOND_INTERVIEWS_115.getCode(),null);
// 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());
// Map<Long, String> wantShopAreaMap = hyOpenAreaInfoDAO.selectNameMapByIds(wantShopAreaIds);
// List<Long> lineIds = lineInfoDOS.stream().filter(lineInfoDO -> lineInfoDO.getId() != null).map(LineInfoDO::getId).collect(Collectors.toList());
// List<LineInterviewDO> interviewByLindIds = lineInterviewDAO.getInterviewByLindIds(lineIds, InterviewTypeEnum.SECOND_INTERVIEW);
// Map<Long, LineInterviewDO> interviewDOMap = interviewByLindIds.stream().collect(Collectors.toMap(LineInterviewDO::getLineId, x -> x, (k1, k2) -> k1));
// List<String> userIds = lineInfoDOS.stream().filter(lineInfoDO -> lineInfoDO.getSecondInterviewer() != null).map(LineInfoDO::getSecondInterviewer).collect(Collectors.toList());
// Map<String, EnterpriseUserDO> userInfoMap = enterpriseUserDAO.getUserInfoMap(userIds);
//
//
// 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()));
// interviewPendingVO.setInterviewer(userInfoMap.getOrDefault(x.getSecondInterviewer(),new EnterpriseUserDO()).getName());
// interviewPendingVO.setInterviewId(lineInterviewDO.getId());
// }
// list.add(interviewPendingVO);
// });
// page.setList(list);
return new PageInfo<>();
}
@Override
public PageInfo<PayStagePendingVO> payStagePendingList(Integer pageNum, Integer pageSize, LoginUserInfo user) {
@@ -248,38 +157,6 @@ public class DeskServiceImpl implements DeskService {
return page;
}
@Override
public PageInfo<StoreExperiencePendingVO> storeExperiencePendingList(Integer pageNum, Integer pageSize, LoginUserInfo user) {
// PageHelper.startPage(pageNum, pageSize);
// List<LineInfoDO> lineInfoDOS = lineInfoDAO.listByInvestmentManager(user.getUserId(),
// Arrays.asList(WorkflowSubStageStatusEnum.STORE_EXPERIENCE_85.getCode(),
// WorkflowSubStageStatusEnum.STORE_EXPERIENCE_95.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());
// Map<Long, String> wantShopAreaMap = hyOpenAreaInfoDAO.selectNameMapByIds(wantShopAreaIds);
// List<Long> lineIds = lineInfoDOS.stream().filter(lineInfoDO -> lineInfoDO.getId() != null).map(LineInfoDO::getId).collect(Collectors.toList());
// Map<Long, LeaseBaseInfoDO> infoDOMap = new HashMap<>();
// if (CollectionUtils.isNotEmpty(lineIds)){
// List<LeaseBaseInfoDO> leaseBaseInfoDOS = trainingExperienceMapper.selectByLineIds(lineIds);
// infoDOMap = leaseBaseInfoDOS.stream().collect(Collectors.toMap(LeaseBaseInfoDO::getLineId, x -> x));
// }
// List<StoreExperiencePendingVO> list = new ArrayList<>();
// Map<Long, LeaseBaseInfoDO> finalInfoDOMap = infoDOMap;
// lineInfoDOS.forEach(x->{
// BaseInfoVO baseInfoVO = convertToBaseInfoVO(x, userPortraitMap, wantShopAreaMap);
// StoreExperiencePendingVO storeExperiencePendingVO = new StoreExperiencePendingVO(baseInfoVO);
// LeaseBaseInfoDO date = finalInfoDOMap.get(x.getId());
// if (date != null && date.getExperienceStartTime() != null && date.getExperienceEndTime() != null){
// storeExperiencePendingVO.setExperienceStartTime(DateUtils.parseDateToStr(DateUtils.SPECIAL_DATE_START_1,date.getExperienceStartTime()));
// storeExperiencePendingVO.setExperienceEndTime(DateUtils.parseDateToStr(DateUtils.SPECIAL_DATE_START_2,date.getExperienceEndTime()));
// }
// list.add(storeExperiencePendingVO);
// });
// page.setList(list);
return new PageInfo<>();
}
/**
* convertToBaseInfoVO
@@ -347,21 +224,56 @@ public class DeskServiceImpl implements DeskService {
}
@Override
public PageInfo<PreparationCommonPendingVO> systemBuildStorePendingList(Integer pageNum, Integer pageSize, LoginUserInfo user) {
return null;
}
@Override
public PageInfo<PreparationCommonPendingVO> payFranchiseFeesPendingList(Integer pageNum, Integer pageSize, LoginUserInfo user) {
return commonPendingVOPageInfo(pageNum, pageSize, user, ShopSubStageEnum.SHOP_STAGE_7,
Arrays.asList(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_70.getShopSubStageStatus(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_72.getShopSubStageStatus()), Boolean.FALSE);
List<Long> userRoleIds = enterpriseUserRoleMapper.getUserRoleIds(user.getUserId());
PageInfo<PreparationCommonPendingVO> pageInfo = new PageInfo<>();
if (CollectionUtils.isNotEmpty(userRoleIds)
&& (userRoleIds.contains(UserRoleEnum.SUPERVISION.getCode())
||userRoleIds.contains(UserRoleEnum.INVESTMENT_COMMISSIONER.getCode())
||userRoleIds.contains(UserRoleEnum.STRONG_INVESTMENT_COMMISSIONER.getCode()))){
pageInfo = commonPendingVOPageInfo(pageNum, pageSize, user, ShopSubStageEnum.SHOP_STAGE_7,
Collections.singletonList(SHOP_SUB_STAGE_STATUS_70.getShopSubStageStatus()), Boolean.FALSE);
}
if (CollectionUtils.isNotEmpty(userRoleIds)&& userRoleIds.contains(UserRoleEnum.BRANCH_OFFICE.getCode())){
pageInfo = commonPendingVOPageInfo(pageNum, pageSize, user, ShopSubStageEnum.SHOP_STAGE_7,
Collections.singletonList(SHOP_SUB_STAGE_STATUS_72.getShopSubStageStatus()), Boolean.TRUE);
}
List<PreparationCommonPendingVO> list = pageInfo.getList();
if (CollectionUtils.isEmpty(list)){
return pageInfo;
}
List<Long> shopIds = list.stream().map(PreparationCommonPendingVO::getShopId).collect(Collectors.toList());
Map<Long, LinePayDO> shopPayDoMap = linePayDAO.getLinePayByShopIds(shopIds, PayBusinessTypeEnum.FRANCHISE_FEE.getCode());
for (PreparationCommonPendingVO vo:list){
vo.setSubmitTime(DateUtils.parseDateToStr(DateUtils.SPECIAL_DATE_START, shopPayDoMap.getOrDefault(vo.getShopId(), new LinePayDO()).getCreateTime()));
}
pageInfo.setList(list);
return pageInfo;
}
@Override
public PageInfo<PreparationCommonPendingVO> signingOfFranchiseContractPendingList(Integer pageNum, Integer pageSize, LoginUserInfo user) {
return commonPendingVOPageInfo(pageNum, pageSize, user, ShopSubStageEnum.SHOP_STAGE_8,
PageInfo<PreparationCommonPendingVO> pageInfo = commonPendingVOPageInfo(pageNum, pageSize, user, ShopSubStageEnum.SHOP_STAGE_8,
Arrays.asList(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_80.getShopSubStageStatus(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_85.getShopSubStageStatus()), Boolean.TRUE);
List<PreparationCommonPendingVO> list = pageInfo.getList();
if (CollectionUtils.isEmpty(list)){
return pageInfo;
}
List<Long> shopIds = list.stream().map(PreparationCommonPendingVO::getShopId).collect(Collectors.toList());
Map<Long, List<DeskStageDTO>> deskStageMap = new HashMap<>();
List<ShopStageInfoDO> subStageList = shopStageInfoDAO.getSubStages(shopIds, ShopSubStageEnum.SHOP_STAGE_7.getShopSubStage());
doThing(deskStageMap, subStageList);
for (PreparationCommonPendingVO vo :list){
vo.setSubmitTime(deskStageMap.get(vo.getShopId()).get(0).getActualCompleteTime());
}
pageInfo.setList(list);
return pageInfo;
}
@Override
@@ -375,61 +287,183 @@ public class DeskServiceImpl implements DeskService {
return commonPendingVOPageInfo(pageNum, pageSize, user, ShopSubStageEnum.SHOP_STAGE_14, Arrays.asList(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_140.getShopSubStageStatus()), Boolean.FALSE);
}
@Override
public PageInfo<PreparationCommonPendingVO> firstOrderListPendingList(Integer pageNum, Integer pageSize, LoginUserInfo user) {
return null;
}
@Override
public PageInfo<PreparationCommonPendingVO> trainListPendingList(Integer pageNum, Integer pageSize, LoginUserInfo user) {
return commonPendingVOPageInfo(pageNum, pageSize, user, ShopSubStageEnum.SHOP_STAGE_5,
return commonPendingVOPageInfo(pageNum, pageSize, user, ShopSubStageEnum.SHOP_STAGE_5,
Collections.singletonList(SHOP_SUB_STAGE_STATUS_50.getShopSubStageStatus()), Boolean.TRUE);
}
@Override
public PageInfo<PreparationCommonPendingVO> xinFaListPendingList(Integer pageNum, Integer pageSize, LoginUserInfo user) {
return commonPendingVOPageInfo(pageNum, pageSize, null, ShopSubStageEnum.SHOP_STAGE_23,
PageInfo<PreparationCommonPendingVO> pageInfo = commonPendingVOPageInfo(pageNum, pageSize, null, ShopSubStageEnum.SHOP_STAGE_23,
Collections.singletonList(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_230.getShopSubStageStatus()), Boolean.FALSE);
List<PreparationCommonPendingVO> list = pageInfo.getList();
if (CollectionUtils.isEmpty(list)){
return pageInfo;
}
List<Long> shopIds = list.stream().map(PreparationCommonPendingVO::getShopId).collect(Collectors.toList());
Map<Long, List<DeskStageDTO>> deskStageMap = new HashMap<>();
List<ShopStageInfoDO> subStageList = shopStageInfoDAO.getSubStages(shopIds, ShopSubStageEnum.SHOP_STAGE_8.getShopSubStage());
doThing(deskStageMap, subStageList);
for (PreparationCommonPendingVO vo :list){
vo.setSubmitTime(deskStageMap.get(vo.getShopId()).get(0).getActualCompleteTime());
}
pageInfo.setList(list);
return pageInfo;
}
@Override
public PageInfo<PreparationCommonPendingVO> posListPendingList(Integer pageNum, Integer pageSize, LoginUserInfo user) {
return commonPendingVOPageInfo(pageNum, pageSize, null, ShopSubStageEnum.SHOP_STAGE_16,
PageInfo<PreparationCommonPendingVO> pageInfo = commonPendingVOPageInfo(pageNum, pageSize, null, ShopSubStageEnum.SHOP_STAGE_16,
Collections.singletonList(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_160.getShopSubStageStatus()), Boolean.FALSE);
List<PreparationCommonPendingVO> list = pageInfo.getList();
if (CollectionUtils.isEmpty(list)){
return pageInfo;
}
List<Long> shopIds = list.stream().map(PreparationCommonPendingVO::getShopId).collect(Collectors.toList());
Map<Long, List<DeskStageDTO>> deskStageMap = new HashMap<>();
List<ShopStageInfoDO> subStageList = shopStageInfoDAO.getSubStages(shopIds, ShopSubStageEnum.SHOP_STAGE_8.getShopSubStage());
doThing(deskStageMap, subStageList);
for (PreparationCommonPendingVO vo :list){
vo.setSubmitTime(deskStageMap.get(vo.getShopId()).get(0).getActualCompleteTime());
}
pageInfo.setList(list);
return pageInfo;
}
@Override
public PageInfo<PreparationCommonPendingVO> tentPassListPendingList(Integer pageNum, Integer pageSize, LoginUserInfo user) {
return commonPendingVOPageInfo(pageNum, pageSize, null, ShopSubStageEnum.SHOP_STAGE_24,
PageInfo<PreparationCommonPendingVO> pageInfo = commonPendingVOPageInfo(pageNum, pageSize, null, ShopSubStageEnum.SHOP_STAGE_24,
Collections.singletonList(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_240.getShopSubStageStatus()), Boolean.FALSE);
List<PreparationCommonPendingVO> list = pageInfo.getList();
if (CollectionUtils.isEmpty(list)){
return pageInfo;
}
List<Long> shopIds = list.stream().map(PreparationCommonPendingVO::getShopId).collect(Collectors.toList());
Map<Long, List<DeskStageDTO>> deskStageMap = new HashMap<>();
List<ShopStageInfoDO> subStageList = shopStageInfoDAO.getSubStages(shopIds, ShopSubStageEnum.SHOP_STAGE_8.getShopSubStage());
doThing(deskStageMap, subStageList);
for (PreparationCommonPendingVO vo :list){
vo.setSubmitTime(deskStageMap.get(vo.getShopId()).get(0).getActualCompleteTime());
}
pageInfo.setList(list);
return pageInfo;
}
@Override
public PageInfo<PreparationCommonPendingVO> orderSysPendingList(Integer pageNum, Integer pageSize, LoginUserInfo user) {
return commonPendingVOPageInfo(pageNum, pageSize, null, ShopSubStageEnum.SHOP_STAGE_17,
PageInfo<PreparationCommonPendingVO> pageInfo = commonPendingVOPageInfo(pageNum, pageSize, null, ShopSubStageEnum.SHOP_STAGE_17,
Collections.singletonList(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_170.getShopSubStageStatus()), Boolean.FALSE);
List<PreparationCommonPendingVO> list = pageInfo.getList();
if (CollectionUtils.isEmpty(list)){
return pageInfo;
}
List<Long> shopIds = list.stream().map(PreparationCommonPendingVO::getShopId).collect(Collectors.toList());
Map<Long, List<DeskStageDTO>> deskStageMap = new HashMap<>();
List<ShopStageInfoDO> subStageList = shopStageInfoDAO.getSubStages(shopIds, ShopSubStageEnum.SHOP_STAGE_8.getShopSubStage());
doThing(deskStageMap, subStageList);
for (PreparationCommonPendingVO vo :list){
vo.setSubmitTime(deskStageMap.get(vo.getShopId()).get(0).getActualCompleteTime());
}
pageInfo.setList(list);
return pageInfo;
}
@Override
public PageInfo<PreparationCommonPendingVO> designPendingList(Integer pageNum, Integer pageSize, LoginUserInfo user) {
return commonPendingVOPageInfo(pageNum, pageSize, user, ShopSubStageEnum.SHOP_STAGE_9,
Arrays.asList(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_90.getShopSubStageStatus()), Boolean.TRUE);
PageInfo<PreparationCommonPendingVO> pageInfo = commonPendingVOPageInfo(pageNum, pageSize, user, ShopSubStageEnum.SHOP_STAGE_9,
Arrays.asList(SHOP_SUB_STAGE_STATUS_90.getShopSubStageStatus()), Boolean.TRUE);
List<PreparationCommonPendingVO> list = pageInfo.getList();
if (CollectionUtils.isEmpty(list)){
return pageInfo;
}
List<Long> shopIds = list.stream().map(PreparationCommonPendingVO::getShopId).collect(Collectors.toList());
Map<Long, List<DeskStageDTO>> deskStageMap = new HashMap<>();
List<ShopStageInfoDO> subStageList = shopStageInfoDAO.getSubStages(shopIds, ShopSubStageEnum.SHOP_STAGE_8.getShopSubStage());
doThing(deskStageMap, subStageList);
for (PreparationCommonPendingVO vo :list){
vo.setSubmitTime(deskStageMap.get(vo.getShopId()).get(0).getActualCompleteTime());
}
pageInfo.setList(list);
return pageInfo;
}
@Override
public PageInfo<PreparationCommonPendingVO> constructionPendingList(Integer pageNum, Integer pageSize, LoginUserInfo user) {
return commonPendingVOPageInfo(pageNum, pageSize, user, ShopSubStageEnum.SHOP_STAGE_11,
PageInfo<PreparationCommonPendingVO> pageInfo =commonPendingVOPageInfo(pageNum, pageSize, user, ShopSubStageEnum.SHOP_STAGE_11,
Arrays.asList(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_110.getShopSubStageStatus(),
ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_111.getShopSubStageStatus()), Boolean.TRUE);
List<PreparationCommonPendingVO> list = pageInfo.getList();
if (CollectionUtils.isEmpty(list)){
return pageInfo;
}
List<Long> shopIds = list.stream().map(PreparationCommonPendingVO::getShopId).collect(Collectors.toList());
Map<Long, List<DeskStageDTO>> deskStageMap = new HashMap<>();
List<ShopStageInfoDO> subStageList = shopStageInfoDAO.getSubStages(shopIds, ShopSubStageEnum.SHOP_STAGE_8.getShopSubStage());
List<DecorationDesignInfoDO> decorationDesignInfos = decorationDesignInfoDAO.getByIds(shopIds);
doThing(deskStageMap, subStageList);
for (DecorationDesignInfoDO decorationDesignInfoDO : decorationDesignInfos) {
List<DeskStageDTO> deskStages = new ArrayList<>();
deskStages.addAll(deskStageMap.get(decorationDesignInfoDO.getShopId()));
if (CollectionUtils.isEmpty(deskStages)) {
DeskStageDTO dto = new DeskStageDTO();
dto.setActualCompleteTime(DateUtils.parseDateToStr(DateUtils.SPECIAL_DATE_START, decorationDesignInfoDO.getCreateTime()));
dto.setShopSubStageStatus(SHOP_SUB_STAGE_STATUS_111.getShopSubStageStatus());
deskStageMap.put(decorationDesignInfoDO.getShopId(), Collections.singletonList(dto));
} else {
DeskStageDTO dto = new DeskStageDTO();
dto.setActualCompleteTime(DateUtils.parseDateToStr(DateUtils.SPECIAL_DATE_START, decorationDesignInfoDO.getCreateTime()));
dto.setShopSubStageStatus(SHOP_SUB_STAGE_STATUS_111.getShopSubStageStatus());
deskStages.add(dto);
deskStageMap.put(decorationDesignInfoDO.getShopId(), deskStages);
}
}
for (PreparationCommonPendingVO vo :list){
for (DeskStageDTO deskStageDTO : deskStageMap.get(vo.getShopId())) {
if (vo.getSubStageStatus().equals(deskStageDTO.getShopSubStageStatus())) {
vo.setSubmitTime(deskStageDTO.getActualCompleteTime());
break;
}
}
}
pageInfo.setList(list);
return pageInfo;
}
@Override
public PageInfo<PreparationCommonPendingVO> fitmentPendingList(Integer pageNum, Integer pageSize, LoginUserInfo user) {
return commonPendingVOPageInfo(pageNum, pageSize, user, ShopSubStageEnum.SHOP_STAGE_12,
PageInfo<PreparationCommonPendingVO> pageInfo = commonPendingVOPageInfo(pageNum, pageSize, user, ShopSubStageEnum.SHOP_STAGE_12,
Collections.singletonList(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_122.getShopSubStageStatus()), Boolean.FALSE);
List<PreparationCommonPendingVO> list = pageInfo.getList();
if (CollectionUtils.isEmpty(list)){
return pageInfo;
}
List<Long> shopIds = list.stream().map(PreparationCommonPendingVO::getShopId).collect(Collectors.toList());
Map<Long, List<DeskStageDTO>> deskStageMap = new HashMap<>();
List<AcceptanceInfoDO> acceptanceInfoDOList = acceptanceInfoDAO.selectByShopIds(shopIds);
for (AcceptanceInfoDO acceptanceInfoDO : acceptanceInfoDOList) {
DeskStageDTO dto = new DeskStageDTO();
dto.setActualCompleteTime(DateUtils.parseDateToStr(DateUtils.SPECIAL_DATE_START, acceptanceInfoDO.getCreateTime()));
dto.setShopSubStageStatus(SHOP_SUB_STAGE_STATUS_122.getShopSubStageStatus());
deskStageMap.put(acceptanceInfoDO.getShopId(), Collections.singletonList(dto));
}
for (PreparationCommonPendingVO vo :list){
for (DeskStageDTO deskStageDTO : deskStageMap.get(vo.getShopId())) {
if (vo.getSubStageStatus().equals(deskStageDTO.getShopSubStageStatus())) {
vo.setSubmitTime(deskStageDTO.getActualCompleteTime());
break;
}
}
}
pageInfo.setList(list);
return pageInfo;
}
@Override
@@ -499,53 +533,7 @@ public class DeskServiceImpl implements DeskService {
Map<String, String> userNameMap = enterpriseUserDAO.getUserNameMap(developmentManagers);
Map<Long, String> regionNameMap = regionService.getBelongWarRegionNameMap(regionIds);
Map<Long, LinePayDO> shopPayDoMap = new HashMap<>(16);
if (ShopSubStageEnum.SHOP_STAGE_7.getShopSubStage().equals(shopSubStageEnum.getShopSubStage())) {
shopPayDoMap = linePayDAO.getLinePayByShopIds(shopIds, PayBusinessTypeEnum.FRANCHISE_FEE.getCode());
}
Map<Long, List<DeskStageDTO>> deskStageMap = new HashMap<>();
if (ShopSubStageEnum.SHOP_STAGE_16.getShopSubStage().equals(shopSubStageEnum.getShopSubStage())
|| ShopSubStageEnum.SHOP_STAGE_17.getShopSubStage().equals(shopSubStageEnum.getShopSubStage())
|| ShopSubStageEnum.SHOP_STAGE_9.getShopSubStage().equals(shopSubStageEnum.getShopSubStage())
|| ShopSubStageEnum.SHOP_STAGE_23.getShopSubStage().equals(shopSubStageEnum.getShopSubStage())
|| ShopSubStageEnum.SHOP_STAGE_24.getShopSubStage().equals(shopSubStageEnum.getShopSubStage()) ){
List<ShopStageInfoDO> subStageList = shopStageInfoDAO.getSubStages(shopIds, ShopSubStageEnum.SHOP_STAGE_8.getShopSubStage());
doThing(deskStageMap, subStageList);
} else if (ShopSubStageEnum.SHOP_STAGE_8.getShopSubStage().equals(shopSubStageEnum.getShopSubStage())) {
List<ShopStageInfoDO> subStageList = shopStageInfoDAO.getSubStages(shopIds, ShopSubStageEnum.SHOP_STAGE_7.getShopSubStage());
doThing(deskStageMap, subStageList);
} else if (ShopSubStageEnum.SHOP_STAGE_11.getShopSubStage().equals(shopSubStageEnum.getShopSubStage())) {
List<ShopStageInfoDO> subStageList = shopStageInfoDAO.getSubStages(shopIds, ShopSubStageEnum.SHOP_STAGE_8.getShopSubStage());
List<DecorationDesignInfoDO> decorationDesignInfos = decorationDesignInfoDAO.getByIds(shopIds);
doThing(deskStageMap, subStageList);
for (DecorationDesignInfoDO decorationDesignInfoDO : decorationDesignInfos) {
List<DeskStageDTO> deskStages = new ArrayList<>();
deskStages.addAll(deskStageMap.get(decorationDesignInfoDO.getShopId()));
if (CollectionUtils.isEmpty(deskStages)) {
DeskStageDTO dto = new DeskStageDTO();
dto.setActualCompleteTime(DateUtils.parseDateToStr(DateUtils.SPECIAL_DATE_START, decorationDesignInfoDO.getCreateTime()));
dto.setShopSubStageStatus(SHOP_SUB_STAGE_STATUS_111.getShopSubStageStatus());
deskStageMap.put(decorationDesignInfoDO.getShopId(), Collections.singletonList(dto));
} else {
DeskStageDTO dto = new DeskStageDTO();
dto.setActualCompleteTime(DateUtils.parseDateToStr(DateUtils.SPECIAL_DATE_START, decorationDesignInfoDO.getCreateTime()));
dto.setShopSubStageStatus(SHOP_SUB_STAGE_STATUS_111.getShopSubStageStatus());
deskStages.add(dto);
deskStageMap.put(decorationDesignInfoDO.getShopId(), deskStages);
}
}
} else if (ShopSubStageEnum.SHOP_STAGE_12.getShopSubStage().equals(shopSubStageEnum.getShopSubStage())) {
List<AcceptanceInfoDO> list = acceptanceInfoDAO.selectByShopIds(shopIds);
for (AcceptanceInfoDO acceptanceInfoDO : list) {
DeskStageDTO dto = new DeskStageDTO();
dto.setActualCompleteTime(DateUtils.parseDateToStr(DateUtils.SPECIAL_DATE_START, acceptanceInfoDO.getCreateTime()));
dto.setShopSubStageStatus(SHOP_SUB_STAGE_STATUS_122.getShopSubStageStatus());
deskStageMap.put(acceptanceInfoDO.getShopId(), Collections.singletonList(dto));
}
}
List<PreparationCommonPendingVO> list = new ArrayList<>();
Map<Long, LinePayDO> finalShopPayDoMap = shopPayDoMap;
specialShopStageInfo.forEach(x -> {
PreparationCommonPendingVO preparationCommonPendingVO = new PreparationCommonPendingVO();
preparationCommonPendingVO.setLineId(x.getLineId());
@@ -553,45 +541,15 @@ public class DeskServiceImpl implements DeskService {
ShopInfoDO shopInfoDO = shopInfoMap.getOrDefault(x.getShopId(), new ShopInfoDO());
if (shopInfoDO != null) {
PointInfoDO pointInfoDO = pointMap.get(shopInfoDO.getPointId());
if(pointInfoDO != null) {
if (pointInfoDO != null) {
preparationCommonPendingVO.setShopAddress(pointInfoDO.getAddress());
}
preparationCommonPendingVO.setShopCode(shopInfoDO.getShopCode());
}
preparationCommonPendingVO.setInvestmentManager(lineMap.getOrDefault(x.getLineId(),new PlanLineDTO()).getInvestmentManagerName());
preparationCommonPendingVO.setInvestmentManager(lineMap.getOrDefault(x.getLineId(), new PlanLineDTO()).getInvestmentManagerName());
preparationCommonPendingVO.setStage(x.getShopStage());
preparationCommonPendingVO.setSubStage(x.getShopSubStage());
preparationCommonPendingVO.setSubStageStatus(x.getShopSubStageStatus());
if (ShopSubStageEnum.SHOP_STAGE_7.getShopSubStage().equals(shopSubStageEnum.getShopSubStage())) {
preparationCommonPendingVO.setSubmitTime(DateUtils.parseDateToStr(DateUtils.SPECIAL_DATE_START, finalShopPayDoMap.getOrDefault(x.getShopId(), new LinePayDO()).getCreateTime()));
}
if (ShopSubStageEnum.SHOP_STAGE_8.getShopSubStage().equals(shopSubStageEnum.getShopSubStage())) {
preparationCommonPendingVO.setSubmitTime(deskStageMap.get(x.getShopId()).get(0).getActualCompleteTime());
}
if (ShopSubStageEnum.SHOP_STAGE_16.getShopSubStage().equals(shopSubStageEnum.getShopSubStage())
|| ShopSubStageEnum.SHOP_STAGE_17.getShopSubStage().equals(shopSubStageEnum.getShopSubStage())
|| ShopSubStageEnum.SHOP_STAGE_9.getShopSubStage().equals(shopSubStageEnum.getShopSubStage())
|| ShopSubStageEnum.SHOP_STAGE_23.getShopSubStage().equals(shopSubStageEnum.getShopSubStage())
|| ShopSubStageEnum.SHOP_STAGE_24.getShopSubStage().equals(shopSubStageEnum.getShopSubStage()) ){
preparationCommonPendingVO.setSubmitTime(deskStageMap.get(x.getShopId()).get(0).getActualCompleteTime());
}
if (ShopSubStageEnum.SHOP_STAGE_11.getShopSubStage().equals(shopSubStageEnum.getShopSubStage())) {
for (DeskStageDTO deskStageDTO : deskStageMap.get(x.getShopId())) {
if (x.getShopSubStageStatus().equals(deskStageDTO.getShopSubStageStatus())) {
preparationCommonPendingVO.setSubmitTime(deskStageDTO.getActualCompleteTime());
break;
}
}
}
if (ShopSubStageEnum.SHOP_STAGE_12.getShopSubStage().equals(shopSubStageEnum.getShopSubStage())) {
for (DeskStageDTO deskStageDTO : deskStageMap.get(x.getShopId())) {
if (x.getShopSubStageStatus().equals(deskStageDTO.getShopSubStageStatus())) {
preparationCommonPendingVO.setSubmitTime(deskStageDTO.getActualCompleteTime());
break;
}
}
}
preparationCommonPendingVO.setStoreName(shopInfoDO.getShopName());
PlanLineDTO planLineDTO = lineMap.getOrDefault(x.getLineId(), new PlanLineDTO());
preparationCommonPendingVO.setPartnerName(planLineDTO.getUsername());
@@ -657,7 +615,7 @@ public class DeskServiceImpl implements DeskService {
ShopInfoDO shopInfoDO = shopInfoMap.getOrDefault(x.getShopId(), new ShopInfoDO());
if (shopInfoDO != null) {
PointInfoDO pointInfoDO = pointMap.get(shopInfoDO.getPointId());
if(pointInfoDO != null) {
if (pointInfoDO != null) {
preparationCommonPendingVO.setShopAddress(pointInfoDO.getAddress());
}
preparationCommonPendingVO.setShopCode(shopInfoDO.getShopCode());

View File

@@ -5,6 +5,8 @@ import com.alibaba.fastjson.JSONObject;
import com.cool.store.constants.CommonConstants;
import com.cool.store.dao.*;
import com.cool.store.dto.ExportBranchShopDTO;
import com.cool.store.dto.FranchiseFeeDTO;
import com.cool.store.dto.Preparation.PreparationDTO;
import com.cool.store.dto.Preparation.ScheduleDTO;
import com.cool.store.dto.PreparationScheduleDTO;
@@ -13,10 +15,9 @@ import com.cool.store.entity.*;
import com.cool.store.enums.*;
import com.cool.store.enums.point.*;
import com.cool.store.exception.ServiceException;
import com.cool.store.mapper.ImportTaskMapper;
import com.cool.store.mapper.IntentAgreementMapper;
import com.cool.store.mapper.PointInfoMapper;
import com.cool.store.mapper.*;
import com.cool.store.request.InitiatingRequest;
import com.cool.store.response.BranchShopResponse;
import com.cool.store.service.*;
import com.cool.store.utils.RedisUtilPool;
import com.cool.store.utils.StringUtil;
@@ -27,20 +28,21 @@ import com.cool.store.utils.poi.StringUtils;
import io.swagger.annotations.ApiModelProperty;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigInteger;
import java.text.MessageFormat;
import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import static com.cool.store.utils.poi.DateUtils.YYYY_MM_DD;
import static com.cool.store.utils.poi.DateUtils.YYYY_MM_DD_HH_MM_SS;
import static com.cool.store.utils.poi.DateUtils.*;
/**
* @Author: WangShuo
@@ -52,7 +54,7 @@ import static com.cool.store.utils.poi.DateUtils.YYYY_MM_DD_HH_MM_SS;
@Slf4j
public class ExportRealizeServiceImpl implements ExportRealizeService {
@Resource
private PointInfoMapper pointInfoMapper;
private FranchiseFeeMapper franchiseFeeMapper;
@Resource
private ImportTaskMapper importTaskMapper;
@Autowired
@@ -62,7 +64,7 @@ public class ExportRealizeServiceImpl implements ExportRealizeService {
@Resource
EnterpriseUserDAO enterpriseUserDAO;
@Resource
SysRoleService sysRoleService;
SignFranchiseMapper signFranchiseMapper;
@Resource
UserAuthMappingService userAuthMappingService;
@Resource
@@ -91,59 +93,86 @@ public class ExportRealizeServiceImpl implements ExportRealizeService {
@Autowired
private RegionDao regionDao;
@Async
@Resource
private InvoicingDAO invoicingDAO;
@Override
public void preparationList(List<PreparationDTO> preparationDTOS, ImportTaskDO importTaskDO) {
@Async
public void branchShopList(List<BranchShopResponse> list, ImportTaskDO importTaskDO) {
Boolean flag = Boolean.TRUE;
String url = "";
try {
List<Long> shopIds = preparationDTOS.stream().map(PreparationDTO::getId).collect(Collectors.toList());
List<ScheduleDTO> scheduleList = shopStageInfoDAO.getScheduleList(shopIds);
List<ShopStageInfoDO> shopContractActualCompletionTime = shopStageInfoDAO.getShopContractActualCompletionTime(shopIds);
Map<Long, ScheduleDTO> scheduleDTOMap = scheduleList.stream().collect(Collectors.toMap(ScheduleDTO::getShopId, x -> x));
Map<Long, ShopStageInfoDO> shopStageInfoDOMap = shopContractActualCompletionTime.stream().collect(Collectors.toMap(ShopStageInfoDO::getShopId, x -> x));
List<Long> regionIds = preparationDTOS.stream().map(PreparationDTO::getRegionId).collect(Collectors.toList());
Map<Long, String> regionNameMap = regionService.getBelongWarRegionNameMap(regionIds);
Set<String> userIds = preparationDTOS.stream().filter(x -> StringUtils.isNotEmpty(x.getShopManagerUserId())).map(PreparationDTO::getShopManagerUserId).collect(Collectors.toSet());
userIds.addAll(preparationDTOS.stream().filter(x -> StringUtils.isNotEmpty(x.getInvestmentManager())).map(PreparationDTO::getInvestmentManager).collect(Collectors.toSet()));
userIds.addAll(preparationDTOS.stream().filter(x -> StringUtils.isNotEmpty(x.getSupervisorUserId())).map(PreparationDTO::getSupervisorUserId).collect(Collectors.toSet()));
Map<String, EnterpriseUserDO> userInfoMap = enterpriseUserDAO.getUserInfoMap(new ArrayList<>(userIds));
List<ShopStageInfoDO> openActivityActualCompletionTime = shopStageInfoDAO.getOpenActivityActualCompletionTime(shopIds);
Map<Long, ShopStageInfoDO> openActivityStageMap;
if (openActivityActualCompletionTime !=null){
openActivityStageMap = openActivityActualCompletionTime.stream().collect(Collectors.toMap(ShopStageInfoDO::getShopId, x -> x));
} else {
openActivityStageMap = new HashMap<>();
List<ExportBranchShopDTO> exportList = new ArrayList<>();
List<Long> shopIds = list.stream().map(BranchShopResponse::getShopId).collect(Collectors.toList());
List<SignFranchiseDO> signFranchises = signFranchiseMapper.selectByShopIds(shopIds);
List<FranchiseFeeDTO> franchiseFees = franchiseFeeMapper.getPayTimeByShopIds(shopIds);
Map<Long, Date> payTimeMap = franchiseFees.stream().filter(o -> o.getPayTime() != null)
.filter(o -> o.getShopId() != null)
.collect(Collectors.toMap(FranchiseFeeDTO::getShopId, FranchiseFeeDTO::getPayTime));
Map<Long, FranchiseFeeDTO> franchiseFeeDTOMap = franchiseFees.stream().filter(o -> o.getShopId() != null)
.collect(Collectors.toMap(FranchiseFeeDTO::getShopId, Function.identity()));
Map<Long, SignFranchiseDO> signFranchiseMap = new HashMap<>();
if (signFranchises != null) {
signFranchiseMap = signFranchises.stream().collect(Collectors.toMap(SignFranchiseDO::getShopId, Function.identity()));
}
List<PreparationScheduleDTO> result = new ArrayList<>();
preparationDTOS.forEach(x -> {
PreparationScheduleDTO dto1 = new PreparationScheduleDTO();
dto1.setMobile(x.getMobile());
dto1.setUsername(x.getUsername());
dto1.setShopName(x.getShopName());
dto1.setPlanOpenTime(DateUtils.parseDateToStr(YYYY_MM_DD_HH_MM_SS, x.getPlanOpenTime()));
dto1.setShopCode(x.getShopCode());
dto1.setSupervisionName(userInfoMap.getOrDefault(x.getSupervisorUserId(), new EnterpriseUserDO()).getName());
dto1.setInvestmentManagerName(userInfoMap.getOrDefault(x.getInvestmentManager(), new EnterpriseUserDO()).getName());
dto1.setRegionNodeName(regionNameMap.getOrDefault(x.getRegionId(), ""));
ScheduleDTO dto = scheduleDTOMap.getOrDefault(x.getId(), new ScheduleDTO());
dto1.setCurrentProgress(dto.getCompletionColumn().toString() + "/" + dto.getTotalColumn().toString());
if ( openActivityStageMap.containsKey(x.getId())) {
Date openActivity = DateUtils.strToDate(openActivityStageMap.get(x.getId()).getActualCompleteTime(), YYYY_MM_DD_HH_MM_SS);
long between = ChronoUnit.SECONDS.between( x.getCreateTime().toInstant(),openActivity.toInstant());
double days = (double) between / (24 * 60 * 60);
dto1.setDays(String.format("%.1f", days));
}else{
long between = ChronoUnit.SECONDS.between( x.getCreateTime().toInstant(),new Date().toInstant());
double days = (double) between / (24 * 60 * 60);
dto1.setDays(String.format("%.1f", days));
List<InvoicingDO> invoicingDOList = invoicingDAO.listByShopIds(shopIds);
Map<Long, InvoicingDO> InvoicingMap = new HashMap<>();
if (invoicingDOList != null) {
InvoicingMap = invoicingDOList.stream().collect(Collectors.toMap(InvoicingDO::getShopId, Function.identity()));
}
for (BranchShopResponse response : list) {
ExportBranchShopDTO dto = new ExportBranchShopDTO();
FranchiseFeeDTO franchiseFeeDTO = franchiseFeeDTOMap.get(response.getShopId());
if (ObjectUtils.isNotEmpty(franchiseFeeDTO)) {
dto.setFirstYearStartTime(DateUtils.parseDateToStr(SPECIAL_DATE_START_1, franchiseFeeDTO.getFirstYearStartTime()));
dto.setFirstYearEndTime(DateUtils.parseDateToStr(SPECIAL_DATE_START_1, franchiseFeeDTO.getFirstYearEndTime()));
String total = (new BigInteger(franchiseFeeDTO.getPerformanceBond()).add(new BigInteger(franchiseFeeDTO.getFirstYearFee()))
.add(new BigInteger(franchiseFeeDTO.getYearFranchiseFee())).add(new BigInteger(franchiseFeeDTO.getLoanMargin())).toString());
dto.setTotalAmountContributions(total);
dto.setFranchiseFeeBill(franchiseFeeDTO.getYearFranchiseFee());
dto.setLoanMargin(franchiseFeeDTO.getLoanMargin());
dto.setPerformanceBondBill(franchiseFeeDTO.getPerformanceBond());
}
result.add(dto1);
});
url = easyExcelUtil.exportExcel(PreparationScheduleDTO.class, result, null, FileTypeEnum.PREPARATION.getDesc() + DateUtils.parseDateToStr(DateUtils.SPECIAL_DATE_START_1, new Date()), FileTypeEnum.PREPARATION.getDesc() + DateUtils.parseDateToStr(DateUtils.SPECIAL_DATE_START_1, new Date()));
dto.setUserName(response.getUsername());
dto.setMobile(response.getMobile());
dto.setShopName(response.getShopName());
dto.setShopCode(response.getShopCode());
dto.setRegionName(response.getRegionName());
dto.setJoinMode(JoinModeEnum.getByCode(response.getJoinMode()));
dto.setFranchiseBrand(FranchiseBrandEnum.getDescByCode(response.getFranchiseBrand()));
dto.setInvestmentManager(response.getInvestmentManagerName());
SignFranchiseDO signFranchiseDO = signFranchiseMap.get(response.getShopId());
if (signFranchiseDO != null) {
dto.setContractCode(signFranchiseDO.getContractCode());
dto.setContractStartTime(DateUtils.parseDateToStr(SPECIAL_DATE_START_1, signFranchiseDO.getContractStartTime()));
dto.setContractEndTime(DateUtils.parseDateToStr(SPECIAL_DATE_START_1, signFranchiseDO.getContractEndTime()));
}
Date payTime = payTimeMap.get(response.getShopId());
if (Objects.nonNull(payTime)) {
dto.setFirstPayTime(DateUtils.parseDateToStr(SPECIAL_DATE_START_1, payTime));
}
InvoicingDO invoicingDO = InvoicingMap.get(response.getShopId());
if (invoicingDO != null) {
dto.setInvoicingTime(invoicingDO.getInvoiceDate());
dto.setFirstYearManagementFeeTax(toString(invoicingDO.getManagementFeeTax()));
dto.setFirstYearManagementFee(toString(invoicingDO.getManagementFee()));
dto.setFirstYearBrandingFeeTax(toString(invoicingDO.getBrandUsageFeeTax()));
dto.setFirstYearBrandingFee(toString(invoicingDO.getBrandUsageFee()));
dto.setFranchiseFeeTax(toString(invoicingDO.getFranchiseFeeTax()));
dto.setFranchiseFee(toString(invoicingDO.getFranchiseFee()));
dto.setDesignFeeTax(toString(invoicingDO.getDesignServiceFeeTax()));
dto.setDesignFee(toString(invoicingDO.getDesignServiceFee()));
}
dto.setCurrentProgress(response.getCompletionColumn() + "/" + response.getTotalColumn());
dto.setShopStatus(response.getShopStatus());
dto.setPlanOpenTime(DateUtils.parseDateToStr(SPECIAL_DATE_START_1, response.getPlanOpenTime()));
dto.setOpenDuration(response.getDays());
dto.setCurrency("");
exportList.add(dto);
}
url = easyExcelUtil.exportExcel(ExportBranchShopDTO.class, exportList, null, FileTypeEnum.BRANCH_SHOP_LIST.getDesc() + DateUtils.parseDateToStr(SPECIAL_DATE_START_1, new Date()), FileTypeEnum.BRANCH_SHOP_LIST.getDesc() + DateUtils.parseDateToStr(SPECIAL_DATE_START_1, new Date()));
} catch (Throwable e) {
flag = Boolean.FALSE;
log.error("fileUpload upload err, originFileName={}", FileTypeEnum.TEAM_LINE.getDesc(), e);
log.error("fileUpload upload err, originFileName={}", FileTypeEnum.BRANCH_SHOP_LIST.getDesc(), e);
throw new ServiceException(ErrorCodeEnum.INTERNAL_SERVER_ERROR);
} finally {
if (flag) {
@@ -154,6 +183,14 @@ public class ExportRealizeServiceImpl implements ExportRealizeService {
}
importTaskMapper.update(eid, importTaskDO);
}
}
private String toString(Object o) {
if (o == null) {
return "";
}
return o.toString();
}
}

View File

@@ -2,6 +2,7 @@ package com.cool.store.service.impl;
import com.cool.store.constants.CommonConstants;
import com.cool.store.context.CurrentUserHolder;
import com.cool.store.context.LoginUserInfo;
import com.cool.store.dao.HyOpenAreaInfoDAO;
import com.cool.store.dao.LineInfoDAO;
@@ -17,6 +18,7 @@ import com.cool.store.exception.ServiceException;
import com.cool.store.mapper.ImportTaskMapper;
import com.cool.store.mapper.PointInfoMapper;
import com.cool.store.request.*;
import com.cool.store.response.BranchShopResponse;
import com.cool.store.service.*;
import com.cool.store.utils.easyExcel.EasyExcelUtil;
import com.cool.store.utils.poi.DateUtils;
@@ -67,42 +69,37 @@ public class ExportServiceImpl implements ExportService {
private String eid;
@Autowired
private ShopInfoDAO shopInfoDAO;
@Autowired
private ShopService shopService;
@Override
public Integer preparationList(PreparationRequest request,LoginUserInfo loginUserInfo) {
if (!sysRoleService.checkIsAdmin(request.getCurUserId())) {
request.setAuthRegionIds(userAuthMappingService.getAuthRegionIdAndSubRegionIdByUserId(request.getCurUserId()));
}
if (CollectionUtils.isNotEmpty(request.getRegionIds())) {
if (request.getRegionIds().contains(CommonConstants.ROOT_DEPT_ID_STR)) {
request.setRegionIds(null);
} else {
request.setRegionIds(regionService.getSubRegionIdsByRegionIds(request.getRegionIds()));
}
}
//进度数据
List<PreparationDTO> preparationDTOS = shopInfoDAO.ListByCondition(request);
if (CollectionUtils.isEmpty(preparationDTOS)) {
throw new ServiceException(ErrorCodeEnum.NO_DATA);
}
List<PreparationDTO> result;
if (preparationDTOS.size()>CommonConstants.MAX_EXPORT_SIZE){
result= preparationDTOS.subList(0,CommonConstants.MAX_EXPORT_SIZE);
public Long branchShopList(BranchShopRequest request, LoginUserInfo user) {
request.setPageSize(CommonConstants.MAX_EXPORT_SIZE + 100);
request.setPageNum(CommonConstants.ONE);
PageInfo<BranchShopResponse> branchShopList = shopService.getBranchShopList(request, user.getUserId());
long total = branchShopList.getTotal();
List<BranchShopResponse> exportList = new ArrayList<>();
if (total == CommonConstants.ZERO) {
return CommonConstants.ZERO_LONG;
} else if (total > CommonConstants.MAX_EXPORT_SIZE) {
exportList.addAll(branchShopList.getList().subList(0, CommonConstants.MAX_EXPORT_SIZE));
}else {
result=preparationDTOS;
exportList.addAll(branchShopList.getList());
}
ImportTaskDO importTaskDO = new ImportTaskDO();
importTaskDO.setStatus(ImportStatusEnum.Ongoing.getCode());
importTaskDO.setFileName(FileTypeEnum.PREPARATION.getDesc()+DateUtils.parseDateToStr(DateUtils.SPECIAL_DATE_START_1,new Date()));
importTaskDO.setFileName(FileTypeEnum.BRANCH_SHOP_LIST.getDesc() + DateUtils.parseDateToStr(DateUtils.SPECIAL_DATE_START_1, new Date()));
importTaskDO.setIsImport(Boolean.FALSE);
importTaskDO.setFileType(FileTypeEnum.PREPARATION.getFileType());
importTaskDO.setCreateUserId(request.getCurUserId());
importTaskDO.setFileType(FileTypeEnum.BRANCH_SHOP_LIST.getFileType());
importTaskDO.setCreateUserId(user.getUserId());
importTaskDO.setCreateTime(new Date().getTime());
importTaskDO.setCreateName(loginUserInfo.getName());
importTaskDO.setCreateName(user.getName());
importTaskMapper.insert(eid, importTaskDO);
exportRealizeService.preparationList(result, importTaskDO);
return result.size();
exportRealizeService.branchShopList(branchShopList.getList(), importTaskDO);
return total;
}

View File

@@ -3,11 +3,11 @@ package com.cool.store.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.constants.CommonConstants;
import com.cool.store.context.LoginUserInfo;
import com.cool.store.dao.HyPartnerUserChannelDAO;
import com.cool.store.dao.LineInfoDAO;
import com.cool.store.dao.QualificationsInfoDAO;
import com.cool.store.dao.*;
import com.cool.store.entity.*;
import com.cool.store.enums.*;
import com.cool.store.enums.point.ShopSubStageEnum;
import com.cool.store.enums.point.ShopSubStageStatusEnum;
import com.cool.store.exception.ApiException;
import com.cool.store.exception.ServiceException;
import com.cool.store.mapper.*;
@@ -32,6 +32,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@Service
@@ -80,8 +81,10 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten
private ShopService shopService;
@Resource
QualificationsInfoDAO qualificationsInfoDAO;
@Resource
private ShopInfoDAO shopInfoDAO;
@Resource
private ShopStageInfoDAO shopStageInfoDAO;
@Override
@Transactional(rollbackFor = Exception.class)
public boolean submit(IntentAgreementSubmitRequest request) {
@@ -137,16 +140,22 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten
}
@Override
@Transactional(rollbackFor = Exception.class)
protected Boolean auditPass(Long auditId, LineInfoDO lineInfo, String userId) {
LineInfoDO updateLine = new LineInfoDO();
updateLine.setId(lineInfo.getId());
updateLine.setWorkflowStage(WorkflowStageEnum.STORE.getCode());
updateLine.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_125.getCode());
updateLine.setDevelopmentManager(lineInfo.getInvestmentManager());
updateLine.setUpdateUserId(userId);
lineInfoDAO.updateLineInfo(updateLine);
lineInfo.setId(lineInfo.getId());
lineInfo.setWorkflowStage(WorkflowStageEnum.STORE.getCode());
lineInfo.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_125.getCode());
lineInfo.setDevelopmentManager(lineInfo.getInvestmentManager());
lineInfo.setUpdateUserId(userId);
lineInfoDAO.updateLineInfo(lineInfo);
//初始化店铺
shopService.initShop(lineInfo);
// 批量获取线索下门店的选址未开始的数据
List<ShopStageInfoDO> stages = shopStageInfoDAO.getByLineIdAndSubStage(lineInfo.getId());
List<Long> shopIds = stages.stream().map(ShopStageInfoDO::getShopId).collect(Collectors.toList());
shopStageInfoDAO.batchUpdateByShopIdsAndSubStageStatus(shopIds,
Arrays.asList(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_10,
ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_50,ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_70));
return Boolean.TRUE;
}
@@ -191,6 +200,7 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean skipIntentAgreement(Long lineId,LoginUserInfo user) {
log.info("skipIntentAgreement lineId:{},操作人:{}",lineId,user.getName());
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(lineId);
@@ -200,15 +210,20 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten
if ( !WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_70.getCode().equals(lineInfo.getWorkflowSubStageStatus())) {
throw new ServiceException(ErrorCodeEnum.LINE_STATUS_NOT_ALLOW_OPERATE);
}
LineInfoDO updateLine = new LineInfoDO();
updateLine.setId(lineInfo.getId());
updateLine.setWorkflowStage(WorkflowStageEnum.STORE.getCode());
updateLine.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_125.getCode());
updateLine.setDevelopmentManager(lineInfo.getInvestmentManager());
updateLine.setUpdateUserId(user.getUserId());
lineInfoDAO.updateLineInfo(updateLine);
lineInfo.setWorkflowStage(WorkflowStageEnum.STORE.getCode());
lineInfo.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_125.getCode());
lineInfo.setDevelopmentManager(lineInfo.getInvestmentManager());
lineInfo.setUpdateUserId(user.getUserId());
lineInfoDAO.updateLineInfo(lineInfo);
//初始化店铺
shopService.initShop(lineInfo);
// 批量获取线索下门店的选址未开始的数据
List<ShopStageInfoDO> stages = shopStageInfoDAO.getByLineIdAndSubStage(lineInfo.getId());
List<Long> shopIds = stages.stream().map(ShopStageInfoDO::getShopId).collect(Collectors.toList());
shopStageInfoDAO.batchUpdateByShopIdsAndSubStageStatus(shopIds,
Arrays.asList(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_10,
ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_50,ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_70));
return Boolean.TRUE;
}

View File

@@ -57,6 +57,7 @@ public class InvoicingServiceImpl implements InvoicingService {
//新数据待提交时初始化 老数据已数据处理 阶段状态已完成 只做插入操作 无需初始化
if (shopSubStageInfo!=null&&ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_85_1.getShopSubStageStatus().equals(shopSubStageInfo.getShopSubStageStatus())){
shopStageInfoDAO.updateShopStageInfo(invoicingDTO.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_85_3);
preparationService.updateShopStatus(invoicingDTO.getShopId());
}
return Boolean.TRUE;
}

View File

@@ -2,9 +2,12 @@ package com.cool.store.service.impl;
import com.cool.store.dao.LineFollowLogDAO;
import com.cool.store.dao.LineInfoDAO;
import com.cool.store.dao.ShopInfoDAO;
import com.cool.store.entity.LineFollowLogDO;
import com.cool.store.entity.LineInfoDO;
import com.cool.store.entity.ShopInfoDO;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.enums.FollowLogTypeEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.request.LineFollowLogRequest;
import com.cool.store.service.LineFollowService;
@@ -30,10 +33,12 @@ public class LineFollowServiceImpl implements LineFollowService {
private LineFollowLogDAO lineFollowLogDAO;
@Resource
private LineInfoDAO lineInfoDAO;
@Resource
private ShopInfoDAO shopInfoDAO;
@Override
public PageInfo<LineFollowLogVO> getFollowLogPage(Long lineId, Integer pageNum, Integer pageSize) {
Page<LineFollowLogDO> followLogPage = lineFollowLogDAO.getFollowLogPage(lineId, pageNum, pageSize);
public PageInfo<LineFollowLogVO> getFollowLogPage(Long lineId, Integer pageNum, Integer pageSize,Integer type) {
Page<LineFollowLogDO> followLogPage = lineFollowLogDAO.getFollowLogPage(lineId, pageNum, pageSize,type);
PageInfo resultPage = new PageInfo(followLogPage);
List<LineFollowLogVO> resultList = LineFollowLogVO.convertList(followLogPage);
resultPage.setList(resultList);
@@ -42,10 +47,21 @@ public class LineFollowServiceImpl implements LineFollowService {
@Override
public Long addFollowLog(LineFollowLogRequest followLog, String operateUserId, String operateUsername) {
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(followLog.getLineId());
if(Objects.isNull(lineInfo)){
throw new ServiceException(ErrorCodeEnum.LINE_ID_IS_NOT_EXIST);
if (followLog.getType().equals(FollowLogTypeEnum.LINE.getCode())){
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(followLog.getLineId());
if(Objects.isNull(lineInfo)){
throw new ServiceException(ErrorCodeEnum.LINE_ID_IS_NOT_EXIST);
}
return lineFollowLogDAO.addFollowLog(lineInfo, operateUserId, operateUsername, followLog.getMessage(),followLog.getType());
}
return lineFollowLogDAO.addFollowLog(lineInfo, operateUserId, operateUsername, followLog.getMessage());
if (followLog.getType().equals(FollowLogTypeEnum.SHOP.getCode())){
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(followLog.getLineId());
if (Objects.isNull(shopInfo)){
throw new ServiceException(ErrorCodeEnum.SHOP_NOT_EXIST);
}
return lineFollowLogDAO.addFollowLogByShop(shopInfo,operateUserId,operateUsername, followLog.getMessage(),followLog.getType());
}
return null;
}
}

View File

@@ -41,6 +41,8 @@ import java.util.stream.Stream;
@Service
public class LineServiceImpl implements LineService {
@Resource
ShopInfoDAO shopInfoDAO;
@Resource
LineInfoDAO lineInfoDAO;
@Resource
@@ -98,11 +100,21 @@ public class LineServiceImpl implements LineService {
Map<Integer, String> channelMapByIds = hyPartnerUserChannelDAO.getChannelMapByIds(Arrays.asList(lineInfo.getLineSource()));
result.setLineSourceName(channelMapByIds.get(lineInfo.getLineSource()));
}
if (StringUtil.isNotEmpty(lineInfo.getInvestmentManager())){
EnterpriseUserDO user = enterpriseUserDAO.getUserInfoById(lineInfo.getInvestmentManager());
result.setInvestmentManagerName(user.getName());
result.setInvestmentManagerMobile(user.getMobile());
List<ShopInfoDO> shopInfoDOS = shopInfoDAO.selectInvestmentByLines(Collections.singletonList(lineInfo.getId()));
Set<String> userIds = shopInfoDOS.stream().map(ShopInfoDO::getInvestmentManager).collect(Collectors.toSet());
userIds.add(lineInfo.getInvestmentManager());
Map<String, String> userNameMap = enterpriseUserDAO.getUserNameMap(new ArrayList<>(userIds));
StringBuilder investmentManagerName = new StringBuilder();
for (String userId : userNameMap.keySet()){
investmentManagerName.append(userNameMap.get(userId)).append(",");
}
result.setInvestmentManagerName(investmentManagerName.toString().substring(0, investmentManagerName.length() - 1));
// if (StringUtil.isNotEmpty(lineInfo.getInvestmentManager())){
// EnterpriseUserDO user = enterpriseUserDAO.getUserInfoById(lineInfo.getInvestmentManager());
// result.setInvestmentManagerName(user.getName());
// result.setInvestmentManagerMobile(user.getMobile());
// }
if(lineInfo.getRegionId() != null && lineInfo.getRegionId() != 0){
Long bigRegionIdByAreaId = regionService.getBigRegionIdByAreaId(lineInfo.getWantShopAreaId());
Map<Long, String> regionNameMap = regionDao.getRegionNameMap(Arrays.asList(bigRegionIdByAreaId, lineInfo.getRegionId()));
@@ -246,19 +258,22 @@ public class LineServiceImpl implements LineService {
PageHelper.startPage(partnerRequest.getPageNum(), partnerRequest.getPageSize());
List<LineInfoDO> lineInfoDOS = lineInfoDAO.partnerList(partnerRequest,areaName, userId, regionId);
PageInfo page = new PageInfo(lineInfoDOS);
List<Long> lineIds = lineInfoDOS.stream().map(LineInfoDO::getId).collect(Collectors.toList());
List<ShopInfoDO> shopInfoDOS = shopInfoDAO.selectInvestmentByLines(lineIds);
Map<Long,Set<String>> investmentManagerIdMapByLineId = shopInfoDOS.stream().collect(Collectors.groupingBy(ShopInfoDO::getLineId, Collectors.mapping(ShopInfoDO::getInvestmentManager, Collectors.toSet())));
Set<String> investmentManagerIds =shopInfoDOS.stream().map(ShopInfoDO::getInvestmentManager).collect(Collectors.toSet());
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());
Set<String> userIds = new HashSet<>();
userIds.addAll(lineInfoDOS.stream().filter(lineInfoDO -> lineInfoDO.getInvestmentManager() != null).map(LineInfoDO::getInvestmentManager).collect(Collectors.toList()));
userIds.addAll(lineInfoDOS.stream().filter(lineInfoDO -> lineInfoDO.getDevelopmentManager() != null).map(LineInfoDO::getDevelopmentManager).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);
userIds.addAll(investmentManagerIds);
Map<String, String> userNameMap = enterpriseUserDAO.getUserNameMap(new ArrayList<>(userIds));
List<Long> lineIds = lineInfoDOS.stream().filter(lineInfoDO -> lineInfoDO.getId() != null).map(LineInfoDO::getId).collect(Collectors.toList());
List<SigningBaseInfoDO> signingBaseInfoDOS = intentAgreementMapper.selectByLineIds(lineIds);
Map<Long, Date> dateMap = signingBaseInfoDOS.stream().collect(Collectors.toMap(SigningBaseInfoDO::getLineId, SigningBaseInfoDO::getCreateTime));
@@ -275,12 +290,18 @@ public class LineServiceImpl implements LineService {
if (regionNameMap!=null){
partnerListVO.setRegionName(regionNameMap.get(x.getRegionId()));
}
StringBuilder investmentManagerUserName = new StringBuilder();
Set<String> userIdSet = investmentManagerIdMapByLineId.getOrDefault(x.getId(),new HashSet<>());
userIdSet.add(x.getInvestmentManager());
for (String s : userIdSet) {
investmentManagerUserName.append(userNameMap.get(s)).append(",");
}
partnerListVO.setUpdateTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, x.getUpdateTime()));
partnerListVO.setLineSourceName(channelMapByIds.get(x.getLineSource()));
partnerListVO.setJoinStatus(x.getJoinStatus());
partnerListVO.setJoinMode(x.getJoinMode());
partnerListVO.setPartnerNum(x.getPartnerNum());
partnerListVO.setInvestmentManagerUserName(userNameMap.get(x.getInvestmentManager()));
partnerListVO.setInvestmentManagerUserName(investmentManagerUserName.toString().substring(0, investmentManagerUserName.length()-1));
partnerListVO.setUpdateUserName(userNameMap.get(x.getUpdateUserId()));
partnerListVO.setDevelopmentManagerUserName(userNameMap.get(x.getDevelopmentManager()));
partnerListVO.setWantShopNum(x.getWantShopNum());
@@ -331,7 +352,7 @@ public class LineServiceImpl implements LineService {
if (lineInfo.getJoinStatus()!=0){
operationLogTypeEnum = OperationLogTypeEnum.TRANSFER_INVESTMENT_MANAGER_3;
}
transferLogService.addLog(lineInfo,userInfo.getUserId(),changeInvestmentRequest.getInvestmentManagerId(),operationLogTypeEnum);
transferLogService.addLog(lineInfo.getId(),lineInfo.getPartnerId(),userInfo.getUserId(),changeInvestmentRequest.getInvestmentManagerId(),operationLogTypeEnum);
}
return Boolean.TRUE;
}
@@ -435,8 +456,10 @@ public class LineServiceImpl implements LineService {
}
HyPartnerUserInfoDO hyPartnerUserInfoDO = hyPartnerUserInfoDAO.selectByMobile(addLineRequest.getMobile());
if (hyPartnerUserInfoDO!=null){
throw new ServiceException(ErrorCodeEnum.MOBILE_EXIST);
//校验
validateAndProcessLineInfo(addLineRequest.getMobile());
}
hyPartnerUserInfoDO = new HyPartnerUserInfoDO();
hyPartnerUserInfoDO.setMobile(addLineRequest.getMobile());
hyPartnerUserInfoDO.setUserChannelId(Integer.valueOf(UserChannelEnum.ADD.getCode()));
@@ -465,6 +488,55 @@ public class LineServiceImpl implements LineService {
return Boolean.TRUE;
}
/**
* 校验线索
* @param mobile
*/
public void validateAndProcessLineInfo(String mobile) {
LineInfoDO lineInfo = lineInfoDAO.getLineByMobile(mobile);
String investmentManager = getInvestmentManagerName(lineInfo);
String listName = determineListName(lineInfo);
throw new ServiceException(ErrorCodeEnum.MOBILE_EXIST, listName, investmentManager,DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, lineInfo.getCreateTime()));
}
/**
* 提取获取招商经理姓名的方法
* @param lineInfo
* @return
*/
private String getInvestmentManagerName(LineInfoDO lineInfo) {
if (lineInfo == null || StringUtils.isEmpty(lineInfo.getInvestmentManager())) {
return "-";
}
return enterpriseUserDAO.getUserName(lineInfo.getInvestmentManager());
}
/**
* 提取判断列表名称的逻辑
* @param lineInfo
* @return
*/
private String determineListName(LineInfoDO lineInfo) {
if (lineInfo == null) {
return "";
}
Integer lineStatus = lineInfo.getLineStatus();
if (LineStatusEnum.PUBLIC_SEAS.getCode().equals(lineStatus)) {
return StringUtils.isNotEmpty(lineInfo.getInvestmentManager()) ? "线索公海" : "待分配线索";
}
if (LineStatusEnum.PRIVATE_SEAS.getCode().equals(lineStatus)) {
return lineInfo.getJoinStatus() == 0 ? "线索管理" : "加盟商管理";
}
return "";
}
/**
* 获取招商经理id
* @param addLineRequest
@@ -497,6 +569,15 @@ public class LineServiceImpl implements LineService {
return regionQrcodeConfigDao.getPayPicByRegionId(bigRegionId);
}
@Override
public PageInfo<LineVO> getLines(LinesRequest request) {
PageHelper.startPage(request.getPageNum(), request.getPageSize());
List<LineVO> lines = lineInfoDAO.getLines(request.getKeyword());
PageInfo<LineVO> pageInfo = new PageInfo<>(lines);
return pageInfo;
}
/**
* 计算预期时间
* @param startTime

View File

@@ -143,6 +143,8 @@ public class OpenAcceptanceInfoServiceImpl implements OpenAcceptanceInfoService
ShopInfoDO shopInfoDO = new ShopInfoDO();
shopInfoDO.setId(shopAcceptanceRequest.getShopId());
shopInfoDO.setPlanOpenTime(shopAcceptanceRequest.getPlanOpenTime());
shopInfoDO.setUpdateTime(new Date());
shopInfoDO.setUpdateUserId(userId);
shopInfoDAO.updateShopInfo(shopInfoDO);
//开业验收完成
// shopStageInfoDAO.updateShopStageInfo(shopInfoDO.getId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_161);

View File

@@ -1,10 +1,12 @@
package com.cool.store.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.constants.CommonConstants;
import com.cool.store.dao.*;
import com.cool.store.dto.point.AuditNodeDTO;
import com.cool.store.dto.point.MiniPointPageDTO;
import com.cool.store.dto.point.ShopPointDTO;
import com.cool.store.entity.*;
import com.cool.store.enums.*;
import com.cool.store.enums.point.*;
@@ -18,6 +20,7 @@ import com.cool.store.vo.AuditInfoVO;
import com.cool.store.vo.LinePointBaseInfoVO;
import com.cool.store.vo.point.*;
import com.cool.store.vo.shop.RentInfoToDoVO;
import com.cool.store.vo.shop.ShopPointBaseInfoVO;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists;
@@ -25,6 +28,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -88,6 +92,8 @@ public class PointServiceImpl implements PointService {
private static final String AUDIT_SETTING_KEY = "audit_setting_key:{0}";
private static final String POINT_SELECT_KEY = "point_select_key:{0}:{1}";
@Autowired
private PreparationService preparationService;
@Override
@Transactional(rollbackFor = Exception.class)
@@ -191,7 +197,7 @@ public class PointServiceImpl implements PointService {
* 回退选址状态
* @return
*/
private void rollbackSelectPoint(Long shopId, Long pointId){
private void rollbackSelectPoint(Long shopId, Long pointId){
//店铺回退待带选址
shopInfoDAO.unbindPoint(shopId);
//铺位回退
@@ -201,7 +207,7 @@ public class PointServiceImpl implements PointService {
//租赁合同回到未开始
Integer result = shopStageInfoDAO.updateShopStageToNotStarted(shopId, ShopSubStageEnum.SHOP_STAGE_2);
if(result > CommonConstants.ZERO){
//删除租赁合同
//删除租赁合同
shopRentInfoDAO.deleteRentContractByShopId(shopId);
}
}
@@ -452,6 +458,27 @@ public class PointServiceImpl implements PointService {
return resultPage;
}
@Override
public PageInfo<ShopPointBaseInfoVO> getShopPage(PointLinePageRequest request) {
List<ShopPointDTO> listByDevelopmentManager = shopInfoDAO.getShopPointListByDevelopmentManager(request);
List<String> userPortraitList = listByDevelopmentManager.stream().filter(x -> StringUtils.isNotEmpty(x.getUserPortrait() )).map(ShopPointDTO::getUserPortrait).collect(Collectors.toList());
List<String> investmentManagerUserIds = listByDevelopmentManager.stream().filter(x -> StringUtils.isNotEmpty(x.getInvestmentManager() )).map(ShopPointDTO::getInvestmentManager).collect(Collectors.toList());
List<Long> shopIds = listByDevelopmentManager.stream().map(ShopPointDTO::getShopId).collect(Collectors.toList());
List<Long> wantShopAreaIds = listByDevelopmentManager.stream().map(ShopPointDTO::getWantShopAreaId).collect(Collectors.toList());
Map<Long, Integer> recommendShopNumMap = pointRecommendDAO.getShopPushPointNumMap(shopIds);
Map<Long, HyOpenAreaInfoDO> cityMap = hyOpenAreaInfoDAO.getCityMap(wantShopAreaIds);
Map<String, String> userNameMap = enterpriseUserDAO.getUserNameMap(investmentManagerUserIds);
Map<Long, String> userPortraitMap = labelService.getUserPortraitMap(userPortraitList);
List<Long> lineIds = listByDevelopmentManager.stream().map(ShopPointDTO::getLineId).collect(Collectors.toList());
Map<Long, String> partnerNameMap = lineInfoDAO.getUserNameMap(lineIds);
List<ShopPointBaseInfoVO> resultList = ShopPointBaseInfoVO.convertList(partnerNameMap,listByDevelopmentManager, userNameMap, userPortraitMap, cityMap, recommendShopNumMap);
PageInfo resultPage = new PageInfo(listByDevelopmentManager);
resultPage.setList(resultList);
return resultPage;
}
/**
* 获取单个加盟商信息
* @param lineId
@@ -550,6 +577,20 @@ public class PointServiceImpl implements PointService {
return PointRecommendPageVO.convertVO(recommendPointList, pointList, userNameMap, regionNameMap, canSubmitRentContractShopIds);
}
@Override
public List<PointRecommendPageVO> getShopRecommendPointList(Long shopId) {
List<PointRecommendDO> recommendPointList = pointRecommendDAO.getShopRecommendPointList(shopId);
List<Long> pointIds = recommendPointList.stream().map(PointRecommendDO::getPointId).distinct().collect(Collectors.toList());
List<PointInfoDO> pointList = pointInfoDAO.getPointListByIds(pointIds);
List<Long> regionIds = pointList.stream().map(PointInfoDO::getRegionId).distinct().collect(Collectors.toList());
List<String> developmentManagers = pointList.stream().map(PointInfoDO::getDevelopmentManager).distinct().collect(Collectors.toList());
List<Long> shopIds = pointList.stream().map(PointInfoDO::getShopId).distinct().collect(Collectors.toList());
List<Long> canSubmitRentContractShopIds = shopStageInfoDAO.getCanSubmitRentContractShopIds(shopIds);
Map<String, String> userNameMap = enterpriseUserDAO.getUserNameMap(developmentManagers);
Map<Long, String> regionNameMap = regionService.getBelongWarRegionNameMap(regionIds);
return PointRecommendPageVO.convertVO(recommendPointList, pointList, userNameMap, regionNameMap, canSubmitRentContractShopIds);
}
@Override
public PageInfo<PointPageVO> getRecommendPointList(RecommendPointPageRequest request) {
List<PointPageVO> resultList = new ArrayList();
@@ -580,7 +621,7 @@ public class PointServiceImpl implements PointService {
String pointNames = invalidList.stream().map(PointInfoDO::getPointName).collect(Collectors.joining(","));
throw new ServiceException(ErrorCodeEnum.ERROR_MESSAGE, pointNames + ",已失效");
}
List<PointRecommendDO> recommendPointList = pointRecommendDAO.getRecommendPointList(request.getLineId());
List<PointRecommendDO> recommendPointList = pointRecommendDAO.getShopRecommendPointList(request.getShopId());
if(CollectionUtils.isNotEmpty(recommendPointList)){
List<PointRecommendDO> recommendList = recommendPointList.stream().filter(o -> PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_1.getCode().equals(o.getStatus()) ||
PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_2.getCode().equals(o.getStatus()) ||
@@ -616,18 +657,17 @@ public class PointServiceImpl implements PointService {
List<PointRecommendDO> recommendList = recommendPointList.stream().filter(o -> PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_2.getCode().equals(o.getStatus()) ||
PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_3.getCode().equals(o.getStatus()) ||
PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_4.getCode().equals(o.getStatus()))
.filter(o->request.getLineIds().contains(o.getLineId())).collect(Collectors.toList());
.filter(o->request.getShopIds().contains(o.getShopId())).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(recommendList)){
throw new ServiceException(ErrorCodeEnum.ERROR_MESSAGE, "推送失败,铺位已被选");
}
List<Long> lineIds = recommendPointList.stream().filter(o -> PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_1.getCode().equals(o.getStatus())).filter(o->request.getLineIds().contains(o.getLineId())).map(PointRecommendDO::getLineId).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(lineIds)){
lineIds.retainAll(request.getLineIds());
if(CollectionUtils.isNotEmpty(lineIds)){
List<Long> shopIds = recommendPointList.stream()
.filter(o -> PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_1.getCode().equals(o.getStatus()))
.filter(o->request.getShopIds().contains(o.getShopId())).map(PointRecommendDO::getShopId).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(shopIds)){
throw new ServiceException(ErrorCodeEnum.ERROR_MESSAGE, "请勿重复推送");
}
}
}
List<PointRecommendDO> recommendList = request.convertList();
return pointRecommendDAO.addRecommendPoint(recommendList);
}
@@ -635,25 +675,19 @@ public class PointServiceImpl implements PointService {
@Override
@Transactional(rollbackFor = Exception.class)
public Integer turnLine(TurnLineRequest request) {
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(request.getLineId());
Long lineId = request.getLineId();
//更改线索中的拓展经理
LineInfoDO updateLineInfo = new LineInfoDO();
updateLineInfo.setId(lineId);
updateLineInfo.setDevelopmentManager(request.getDevelopmentManager());
lineInfoDAO.updateLineInfo(updateLineInfo);
//更新已被选择的铺位的拓展经理
pointInfoDAO.updateSelectedDevelopmentManager(lineId, request.getDevelopmentManager());
String wantShopName = hyOpenAreaInfoDAO.selectNameMapById(lineInfo.getWantShopAreaId());
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(request.getShopId());
Long shopId = request.getShopId();
//更改门店中的拓展经理
ShopInfoDO shopInfoDO = new ShopInfoDO();
shopInfoDO.setId(shopId);
shopInfoDO.setDevelopmentManager(request.getDevelopmentManager());
shopInfoDAO.updateShopInfo(shopInfoDO);
//更新已被选择的铺位的拓展经理
pointInfoDAO.updateSelectedDevelopmentManager(shopId, request.getDevelopmentManager());
Map<String, String> messageMap = new HashMap<>();
messageMap.put("lineId", String.valueOf(lineId));
messageMap.put("partnerUsername", lineInfo.getUsername());
messageMap.put("partnerMobile", lineInfo.getMobile());
messageMap.put("wantShopName", wantShopName);
commonService.sendMessage(Arrays.asList(request.getDevelopmentManager()), MessageEnum.MESSAGE_14, messageMap);
//删除未选择的推荐铺位
return pointRecommendDAO.turnLineUpdateRecommendStatus(lineId, request.getDevelopmentManager());
return pointRecommendDAO.turnLineUpdateRecommendStatus(shopId, request.getDevelopmentManager());
}
@Override
@@ -694,7 +728,7 @@ public class PointServiceImpl implements PointService {
if(Objects.nonNull(pointPage) && CollectionUtils.isNotEmpty(pointPage.getResult())){
List<Long> regionIds = pointPage.getResult().stream().map(MiniPointPageDTO::getRegionId).distinct().collect(Collectors.toList());
Map<Long, String> regionNameMap = regionService.getBelongWarRegionNameMap(regionIds);
resultList = MiniPointPageVO.convertVO(pointPage, regionNameMap, request.getLineId());
resultList = MiniPointPageVO.convertVO(pointPage, regionNameMap);
}
PageInfo resultPage = new PageInfo(pointPage);
resultPage.setList(resultList);
@@ -755,11 +789,10 @@ public class PointServiceImpl implements PointService {
updateStatusList.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_20);
Map<String, String> templateParam = new HashMap<>();
templateParam.put("pointName", pointInfo.getAddress());
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(request.getLineId());
}
updateStatusList.add(selectStatus);
shopStageInfoDAO.batchUpdateShopStageStatus(shopId, updateStatusList);
return pointRecommendDAO.updateStatusByPointIdAndLineId(pointId, lineId);
return pointRecommendDAO.updateStatusByPointIdAndLineId(pointId, shopId);
} catch (ServiceException e) {
throw e;
} finally {
@@ -769,7 +802,7 @@ public class PointServiceImpl implements PointService {
@Override
@Transactional(rollbackFor = Exception.class)
public Integer lineRejectPoint(RejectPointRequest request){
return pointRecommendDAO.rejectPoint(request.getLineId(), request.getPointId(), request.getReason());
return pointRecommendDAO.rejectPoint(request.getShopId(), request.getPointId(), request.getReason());
}
@@ -805,6 +838,7 @@ public class PointServiceImpl implements PointService {
shopInfoDAO.updateShopInfo(shopInfo);
PointRecommendDO pointRecommendDO = new PointRecommendDO();
pointRecommendDO.setLineId(lineId);
pointRecommendDO.setShopId(request.getShopId());
pointRecommendDO.setDevelopmentManager(lineInfo.getDevelopmentManager());
pointRecommendDO.setPointId(pointId);
pointRecommendDO.setStatus(PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_2.getCode());
@@ -885,6 +919,7 @@ public class PointServiceImpl implements PointService {
}
@Override
@Transactional(rollbackFor = Exception.class)
public Integer auditRentContract(AuditRentContractRequest request) {
Long shopId = request.getShopId();
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(request.getShopId());
@@ -933,7 +968,9 @@ public class PointServiceImpl implements PointService {
// commonService.sendMessage(Arrays.asList(lineInfo.getInvestmentManager()),MessageEnum.MESSAGE_16_1,requestMap);
// }
}
return shopStageInfoDAO.updateShopStageAndAuditInfo(shopId, subStageStatus, auditId);
shopStageInfoDAO.updateShopStageAndAuditInfo(shopId, subStageStatus, auditId);
return CommonConstants.ONE;
}
@Override
@@ -998,6 +1035,67 @@ public class PointServiceImpl implements PointService {
return resultPage;
}
@Override
@Transactional
public Boolean linePointToShopPoint(Long lineId) {
//查询所有的推荐 如果传入的lineId 则查询该线索的所有推荐
List<PointRecommendDO> allRecommendPointList = pointRecommendDAO.getAllRecommendPointList(lineId);
if (CollectionUtils.isEmpty(allRecommendPointList)){
return Boolean.TRUE;
}
List<PointRecommendDO> recommendList = new ArrayList<>();
List<PointRecommendDO> updateList = new ArrayList<>();
allRecommendPointList.forEach(recommend -> {
//如果是待选择
if(PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_1.getCode().equals(recommend.getStatus())||
PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_5.getCode().equals(recommend.getStatus())||
PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_6.getCode().equals(recommend.getStatus())){
//将单条加盟商数据 分配到各个门店商
Long tempLineId = recommend.getLineId();
List<ShopInfoDO> shopList = shopInfoDAO.getShopList(tempLineId);
for (ShopInfoDO shopInfoDO : shopList) {
PointRecommendDO tempPointRecommendDO = new PointRecommendDO();
BeanUtil.copyProperties(recommend,tempPointRecommendDO);
tempPointRecommendDO.setShopId(shopInfoDO.getId());
recommendList.add(tempPointRecommendDO);
}
}
//已选 已被他人选择
if(PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_2.getCode().equals(recommend.getStatus())){
//查询该加盟商选择的这个店
ShopInfoDO shopInfoByPointId = shopInfoDAO.getShopInfoByPointId(recommend.getLineId(), recommend.getPointId());
recommend.setShopId(shopInfoByPointId.getId());
updateList.add(recommend);
}
if(PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_3.getCode().equals(recommend.getStatus())){
List<PointRecommendDO> recommendPointListByPointId = pointRecommendDAO.getRecommendPointListByPointId(recommend.getPointId());
for (PointRecommendDO pointRecommendDO: recommendPointListByPointId) {
//表示当前门店已选址
if (pointRecommendDO.getLineId().equals(recommend.getLineId())){
continue;
}
List<ShopInfoDO> shopList = shopInfoDAO.getShopList(pointRecommendDO.getLineId());
for (ShopInfoDO shopInfoDO : shopList) {
PointRecommendDO tempPointRecommendDO = new PointRecommendDO();
BeanUtil.copyProperties(recommend,tempPointRecommendDO);
tempPointRecommendDO.setShopId(shopInfoDO.getId());
recommendList.add(tempPointRecommendDO);
}
}
}
});
if (CollectionUtils.isNotEmpty(updateList)){
pointRecommendDAO.batchUpdateShopId(updateList);
}
if (CollectionUtils.isNotEmpty(recommendList)){
log.info("linePointToShopPoint recommendList:{}", JSONObject.toJSONString(recommendList));
pointRecommendDAO.addRecommendPoint(recommendList);
}
return Boolean.TRUE;
}
public List<AuditNodeDTO> dealAuditNode(AuditSettingVO auditSetting, Long regionId, String developmentManager) {
List<String> roleIds = new ArrayList<>();
//审核人

View File

@@ -15,6 +15,7 @@ import com.cool.store.request.PostAndOrderRequest;
import com.cool.store.response.PosAndOrderResponse;
import com.cool.store.service.PosAndOrderInfoService;
import com.cool.store.mapper.PosAndOrderInfoMapper;
import com.cool.store.service.PreparationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -37,7 +38,8 @@ public class PosAndOrderInfoServiceImpl implements PosAndOrderInfoService {
private ShopStageInfoDAO shopStageInfoDAO;
@Autowired
private EnterpriseUserDAO enterpriseUserDAO;
@Autowired
private PreparationService preparationService;
@Override
@Transactional(rollbackFor = Exception.class)
public Integer submitOrUpdate(PostAndOrderRequest request, String user) {
@@ -55,6 +57,7 @@ public class PosAndOrderInfoServiceImpl implements PosAndOrderInfoService {
} else if (request.getType().equals(PosAndOrderEnum.TENT_PASS.getCode())) {
shopStageInfoDAO.updateShopStageInfo(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_245);
}
preparationService.updateShopStatus(request.getShopId());
return posAndOrderInfoDAO.insertSelective(posAndOrderInfo);
} else {
return posAndOrderInfoDAO.updateByShopIdSelective(posAndOrderInfo);

View File

@@ -13,6 +13,7 @@ import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.enums.MessageEnum;
import com.cool.store.enums.SMSMsgEnum;
import com.cool.store.enums.point.ShopStageEnum;
import com.cool.store.enums.point.ShopStatusEnum;
import com.cool.store.enums.point.ShopSubStageEnum;
import com.cool.store.enums.point.ShopSubStageStatusEnum;
import com.cool.store.exception.ServiceException;
@@ -94,8 +95,8 @@ public class PreparationServiceImpl implements PreparationService {
Map<Long, ShopStageInfoDO> shopStageInfoDOMap = shopContractActualCompletionTime.stream().collect(Collectors.toMap(ShopStageInfoDO::getShopId, x -> x));
List<ShopStageInfoDO> openActivityActualCompletionTime = shopStageInfoDAO.getOpenActivityActualCompletionTime(shopIds);
Map<Long, ShopStageInfoDO> openActivityStageMap;
if (openActivityActualCompletionTime !=null){
openActivityStageMap = openActivityActualCompletionTime.stream().collect(Collectors.toMap(ShopStageInfoDO::getShopId, x -> x));
if (openActivityActualCompletionTime != null) {
openActivityStageMap = openActivityActualCompletionTime.stream().collect(Collectors.toMap(ShopStageInfoDO::getShopId, x -> x));
} else {
openActivityStageMap = new HashMap<>();
}
@@ -118,7 +119,7 @@ public class PreparationServiceImpl implements PreparationService {
preparationScheduleVO.setPlanOpenTime(x.getPlanOpenTime());
preparationScheduleVO.setStoreNum(x.getStoreNum());
preparationScheduleVO.setShopCreateTime(x.getCreateTime());
if ( openActivityStageMap.containsKey(x.getId())) {
if (openActivityStageMap.containsKey(x.getId())) {
preparationScheduleVO.setOpeningActivityEndTime(DateUtils.strToDate(openActivityStageMap.get(x.getId()).getActualCompleteTime(), DateUtils.YYYY_MM_DD_HH_MM_SS));
}
preparationScheduleVO.setShopManagerUserName(userInfoMap.getOrDefault(x.getShopManagerUserId(), new EnterpriseUserDO()).getName());
@@ -194,7 +195,7 @@ public class PreparationServiceImpl implements PreparationService {
@Override
public PreparationProcessVO getPreparationProcess(Long shopId) {
PreparationProcessVO preparationProcess = shopStageInfoDAO.getPreparationProcess(shopId);
if (preparationProcess == null){
if (preparationProcess == null) {
return null;
}
preparationProcess.setTotalCount(10);
@@ -217,7 +218,7 @@ public class PreparationServiceImpl implements PreparationService {
list.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_90);
list.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_140);
list.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_150);
shopStageInfoDAO.batchUpdateShopStageStatus(shopId,list);
shopStageInfoDAO.batchUpdateShopStageStatus(shopId, list);
}
}
}
@@ -229,13 +230,13 @@ public class PreparationServiceImpl implements PreparationService {
Map<Integer, ShopStageInfoDO> shopStageInfoDOMap = shopStageInfo.stream().collect(Collectors.toMap(ShopStageInfoDO::getShopSubStage, data -> data));
Boolean flag3 = ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_153.getShopSubStageStatus().
equals(shopStageInfoDOMap.get(ShopSubStageEnum.SHOP_STAGE_15.getShopSubStage()).getShopSubStageStatus());
if (flag3){
if (flag3) {
List<ShopSubStageStatusEnum> list = new ArrayList<>();
list.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_160);
list.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_170);
list.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_230);
list.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_240);
shopStageInfoDAO.batchUpdateShopStageStatus(shopId,list);
shopStageInfoDAO.batchUpdateShopStageStatus(shopId, list);
}
}
}
@@ -253,7 +254,7 @@ public class PreparationServiceImpl implements PreparationService {
equals(shopStageInfoDOMap.get(ShopSubStageEnum.SHOP_STAGE_15.getShopSubStage()).getShopSubStageStatus());
//都完成了 初始化后续流程数据
if (flag1&&flag2&&flag3) {
if (flag1 && flag2 && flag3) {
//初始化后续流程数据s
List<ShopSubStageStatusEnum> list = new ArrayList<>();
list.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_180);
@@ -261,12 +262,12 @@ public class PreparationServiceImpl implements PreparationService {
list.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_200);
list.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_210);
list.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_220);
shopStageInfoDAO.batchUpdateShopStageStatus(shopId,list);
shopStageInfoDAO.batchUpdateShopStageStatus(shopId, list);
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(shopId);
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(shopInfo.getLineId());
Map<String, String> templateParam = new HashMap<>();
templateParam.put("shopName", shopInfo.getShopName());
commonService.sendSms(lineInfo.getMobile(), SMSMsgEnum.PLATFORM_BUILD_STORE,templateParam);
commonService.sendSms(lineInfo.getMobile(), SMSMsgEnum.PLATFORM_BUILD_STORE, templateParam);
}
}
}
@@ -281,5 +282,34 @@ public class PreparationServiceImpl implements PreparationService {
return Boolean.TRUE;
}
@Override
public void updateShopStatus(Long shopId) {
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(shopId);
if (shopInfo.getShopStatus().equals(ShopStatusEnum.ING.getCode())) {
ScheduleDTO scheduleAll = shopStageInfoDAO.getScheduleAll(shopId);
ShopInfoDO shopInfoDO = new ShopInfoDO();
if (scheduleAll.getTotalColumn().equals(scheduleAll.getCompletionColumn())) {
shopInfoDO.setShopStatus(ShopStatusEnum.DONE.getCode());
}
shopInfoDO.setUpdateTime(new Date());
shopInfoDO.setId(shopId);
shopInfoDAO.updateShopInfo(shopInfoDO);
}
}
@Override
public Map<Long, Integer> getShopStatus(List<Long> shopIds) {
List<ScheduleDTO> scheduleList = shopStageInfoDAO.getScheduleList(shopIds);
Map<Long, Integer> map = new HashMap<>();
scheduleList.forEach(x -> {
if (x.getTotalColumn().equals(x.getCompletionColumn())) {
map.put(x.getShopId(), ShopStatusEnum.DONE.getCode());
} else {
map.put(x.getShopId(), ShopStatusEnum.ING.getCode());
}
});
return map;
}
}

View File

@@ -1,29 +1,47 @@
package com.cool.store.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.constants.CommonConstants;
import com.cool.store.dao.*;
import com.cool.store.dto.Preparation.PreparationDTO;
import com.cool.store.dto.Preparation.ScheduleDTO;
import com.cool.store.dto.RegionNode;
import com.cool.store.dto.openPreparation.PlanLineDTO;
import com.cool.store.entity.*;
import com.cool.store.enums.*;
import com.cool.store.enums.point.*;
import com.cool.store.enums.point.ShopStatusEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.request.AddShopRequest;
import com.cool.store.request.DeleteShopRequest;
import com.cool.store.request.UpdateShopCodeRequest;
import com.cool.store.service.ShopService;
import com.cool.store.service.UserAuthMappingService;
import com.cool.store.mapper.RegionMapper;
import com.cool.store.request.*;
import com.cool.store.response.BranchShopDetailResponse;
import com.cool.store.response.BranchShopResponse;
import com.cool.store.service.*;
import com.cool.store.utils.NumberConverter;
import com.cool.store.utils.RandomEightCharCodeUtils;
import com.cool.store.utils.poi.DateUtils;
import com.cool.store.utils.poi.StringUtils;
import com.cool.store.vo.BaseInfoVO;
import com.cool.store.vo.shop.MiniShopPageVO;
import com.cool.store.vo.shop.ShopStageInfoVO;
import com.cool.store.vo.shop.StageShopCountVO;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.time.LocalDate;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import static com.cool.store.enums.ErrorCodeEnum.UPDATE_INVESTMENT_MANAGER_FAIL;
/**
* @author zhangchenbiao
* @FileName: ShopServiceImpl
@@ -31,8 +49,10 @@ import java.util.stream.Collectors;
* @date 2024-04-11 10:26
*/
@Service
@Slf4j
public class ShopServiceImpl implements ShopService {
@Resource
private SysRoleService sysRoleService;
@Resource
private ShopInfoDAO shopInfoDAO;
@Resource
@@ -51,17 +71,30 @@ public class ShopServiceImpl implements ShopService {
UserAuthMappingService userAuthMappingService;
@Autowired
private RegionDao regionDao;
@Autowired
private EnterpriseUserDAO enterpriseUserDAO;
@Resource
private HyOpenAreaInfoDAO hyOpenAreaInfoDAO;
@Autowired
private RegionMapper regionMapper;
@Autowired
private TransferLogService transferLogService;
@Resource
private RegionService regionService;
@Resource
PreparationService preparationService;
@Override
@Transactional(rollbackFor = Exception.class)
public Integer initShop(LineInfoDO lineInfo) {
if(Objects.isNull(lineInfo)){
if (Objects.isNull(lineInfo)) {
throw new ServiceException(ErrorCodeEnum.LINE_ID_IS_NOT_EXIST);
}
Integer wantShopNum = lineInfo.getWantShopNum();
List<ShopInfoDO> shopList = shopInfoDAO.getShopList(lineInfo.getId());
int shopSize = shopList.size();
if(shopSize >= wantShopNum){
if (shopSize >= wantShopNum) {
return 0;
}
List<ShopInfoDO> addShopList = new ArrayList<>();
@@ -71,9 +104,15 @@ public class ShopServiceImpl implements ShopService {
shopInfo.setLineId(lineInfo.getId());
shopInfo.setPartnerId(lineInfo.getPartnerId());
//初始化
shopInfo.setWantShopAreaId(lineInfo.getWantShopAreaId());
shopInfo.setDevelopmentManager(lineInfo.getDevelopmentManager());
shopInfo.setFranchiseBrand(lineInfo.getFranchiseBrand());
shopInfo.setJoinMode(lineInfo.getJoinMode());
shopInfo.setStoreNum(RandomEightCharCodeUtils.getCode());
shopInfo.setSupervisorUserId(lineInfo.getInvestmentManager());
shopInfo.setShopName("店铺" + NumberConverter.convertArabicToChinese(i + 1));
shopInfo.setCreateTime(new Date());
shopInfo.setInvestmentManager(lineInfo.getInvestmentManager());
addShopList.add(shopInfo);
}
shopInfoDAO.batchAddShop(addShopList);
@@ -86,27 +125,44 @@ public class ShopServiceImpl implements ShopService {
return result;
}
/**
* @Auther: wangshuo
* @Date: 2025/1/13
* @description: 当userId为空时表示为mini查看所有门店否则为pc查询的门店跟进管辖区域进行展示 二者都不关注门店状态
*/
@Override
public List<MiniShopPageVO> getShopList(Long lineId) {
List<ShopInfoDO> shopList = shopInfoDAO.getShopList(lineId);
public List<MiniShopPageVO> getShopList(Long lineId, String userId) {
List<Long> authRegions = new ArrayList<>();
if (StringUtils.isNotBlank(userId) && !sysRoleService.checkIsAdmin(userId)) {
for (String region : userAuthMappingService.getAuthRegionIdAndSubRegionIdByUserId(userId)) {
authRegions.add(Long.valueOf(region));
}
}
List<ShopInfoDO> shopList = shopInfoDAO.getShopListByRegion(lineId, authRegions, userId);
List<Long> shopIds = shopList.stream().map(ShopInfoDO::getId).collect(Collectors.toList());
List<Long> wantShopAreaIds = shopList.stream().map(ShopInfoDO::getWantShopAreaId).collect(Collectors.toList());
Map<Long, String> wantRegionMap = hyOpenAreaInfoDAO.selectNameMapByIds(wantShopAreaIds);
List<ScheduleDTO> scheduleList = shopStageInfoDAO.getScheduleList(shopIds);
Map<Long, ScheduleDTO> scheduleMap = scheduleList.stream().collect(Collectors.toMap(ScheduleDTO::getShopId, x -> x));
List<ShopStageInfoDO> subStageList = shopStageInfoDAO.getSubStageList(shopIds, ShopSubStageEnum.SHOP_STAGE_8.getShopSubStage());
Map<Long, ShopStageInfoDO> stageMap = subStageList.stream().collect(Collectors.toMap(ShopStageInfoDO::getShopId, Function.identity()));
List<Long> regionIds = shopList.stream().map(ShopInfoDO::getRegionId).collect(Collectors.toList());
Map<Long, String> regionNameMap = regionDao.getRegionNameMap(regionIds);
return MiniShopPageVO.convertList(shopList,stageMap,regionNameMap);
List<String> investmentManagerIds = shopList.stream().map(ShopInfoDO::getInvestmentManager).collect(Collectors.toList());
Map<String, EnterpriseUserDO> userInfoMap = enterpriseUserDAO.getUserInfoMap(investmentManagerIds);
return MiniShopPageVO.convertList(shopList, stageMap, regionNameMap, scheduleMap, wantRegionMap, userInfoMap);
}
@Override
public List<ShopStageInfoVO> getShopStageInfo(Long shopId, Integer shopStage) {
if(Objects.nonNull(shopStage)){
if (Objects.nonNull(shopStage)) {
ShopStageEnum shopStageEnum = ShopStageEnum.getShopStageEnum(shopStage);
if(Objects.isNull(shopStageEnum)){
if (Objects.isNull(shopStageEnum)) {
throw new ServiceException(ErrorCodeEnum.SHOP_STAGE_ERROR);
}
}
List<ShopStageInfoDO> shopStageInfo = shopStageInfoDAO.getShopStageInfo(shopId, shopStage);
List<Long> auditIds = shopStageInfo.stream().filter(o->Objects.nonNull(o.getAuditId())).map(ShopStageInfoDO::getAuditId).distinct().collect(Collectors.toList());
List<Long> auditIds = shopStageInfo.stream().filter(o -> Objects.nonNull(o.getAuditId())).map(ShopStageInfoDO::getAuditId).distinct().collect(Collectors.toList());
List<ShopAuditInfoDO> auditList = shopAuditInfoDAO.getAuditInfoList(auditIds);
return ShopStageInfoVO.convertList(shopStageInfo, auditList);
}
@@ -119,7 +175,7 @@ public class ShopServiceImpl implements ShopService {
@Override
public Integer deleteShop(DeleteShopRequest request) {
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(request.getShopId());
if(Objects.nonNull(shopInfo)){
if (Objects.nonNull(shopInfo)) {
//进入选址不允许删除操作
throw new ServiceException(ErrorCodeEnum.NOT_ALLOW_OPERATE);
}
@@ -127,9 +183,9 @@ public class ShopServiceImpl implements ShopService {
// if(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_33.getShopSubStageStatus().equals(shopSubStageInfo.getShopSubStageStatus())){
// throw new ServiceException(ErrorCodeEnum.NOT_ALLOW_OPERATE);
// }
if(Objects.nonNull(shopInfo.getPointId())){
if (Objects.nonNull(shopInfo.getPointId())) {
PointInfoDO pointInfo = pointInfoDAO.getPointInfoById(shopInfo.getPointId());
if(Objects.nonNull(pointInfo) && SelectStatusEnum.SELECT_STATUS_1.getCode().equals(pointInfo.getSelectStatus())){
if (Objects.nonNull(pointInfo) && SelectStatusEnum.SELECT_STATUS_1.getCode().equals(pointInfo.getSelectStatus())) {
pointInfoDAO.recyclePoint(pointInfo.getId());
}
pointRecommendDAO.updateRecommendStatus(shopInfo.getPointId(), PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_1, Arrays.asList(PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_5));
@@ -144,7 +200,7 @@ public class ShopServiceImpl implements ShopService {
@Transactional(rollbackFor = Exception.class)
public Long addShop(AddShopRequest request) {
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(request.getLineId());
if(Objects.isNull(lineInfo)){
if (Objects.isNull(lineInfo)) {
throw new ServiceException(ErrorCodeEnum.LINE_ID_IS_NOT_EXIST);
}
List<String> shopNameList = request.getShopNameList();
@@ -161,30 +217,267 @@ public class ShopServiceImpl implements ShopService {
addShop.setPartnerId(lineInfo.getPartnerId());
addShop.setShopName(shopName);
addShop.setSupervisorUserId(lineInfo.getInvestmentManager());
addShop.setInvestmentManager(lineInfo.getInvestmentManager());
addShop.setDevelopmentManager(lineInfo.getInvestmentManager());
addShopList.add(addShop);
}
shopInfoDAO.batchAddShop(addShopList);
List<Long> shopIds = addShopList.stream().map(ShopInfoDO::getId).collect(Collectors.toList());
shopStageInfoDAO.initShopStageInfo(lineInfo.getId(), shopIds);
shopStageInfoDAO.initShopStageInfo(lineInfo.getId(), shopIds, true);
return 1L;
}
@Override
public ShopInfoDO getShopInfo(Long shopId) {
return shopInfoDAO.getShopInfo(shopId);
return shopInfoDAO.getShopInfo(shopId);
}
@Override
public Integer updateShopCode(UpdateShopCodeRequest request) {
public Integer updateShopCode(UpdateShopCodeRequest request, String userId) {
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(request.getShopId());
if(Objects.isNull(shopInfo)){
if (Objects.isNull(shopInfo)) {
throw new ServiceException(ErrorCodeEnum.POINT_NOT_EXIST);
}
shopInfo.setShopCode(request.getShopCode());
shopInfo.setShopName(request.getShopName());
shopInfo.setUpdateTime(new Date());
shopInfo.setUpdateUserId(userId);
shopInfo.setRegionId(request.getRegionId());
return shopInfoDAO.updateShopInfo(shopInfo);
return shopInfoDAO.updateShopInfo(shopInfo);
}
@Override
@Transactional(rollbackFor = Exception.class)
public Long addBranchShop(AddBranchShopRequest request, String userId) {
if (StringUtils.isBlank(request.getInvestmentManagerUserId())) {
request.setInvestmentManagerUserId(userId);
}
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(request.getLineId());
if (lineInfo.getWorkflowSubStageStatus() < WorkflowSubStageStatusEnum.PAY_DEPOSIT_45.getCode()) {
throw new ServiceException(ErrorCodeEnum.LINE_STATUS_NOT_ALLOW_OPERATE);
}
ShopInfoDO shopInfoDO = request.toDO(request, lineInfo);
List<ShopInfoDO> shopList = shopInfoDAO.getShopList(lineInfo.getId());
if(StringUtils.isBlank(request.getShopName())){
if (CollectionUtils.isNotEmpty(shopList)) {
shopInfoDO.setShopName("店铺"+NumberConverter.convertArabicToChinese(lineInfo.getWantShopNum() + 1));
}else{
shopInfoDO.setShopName("店铺"+NumberConverter.convertArabicToChinese(lineInfo.getWantShopNum()));
}
}else{
shopInfoDO.setShopName(request.getShopName());
}
if (CollectionUtils.isNotEmpty(shopList)) {
lineInfo.setWantShopNum(lineInfo.getWantShopNum() + 1);
lineInfoDAO.updateLineInfo(lineInfo);
}
shopInfoDO.setCreateUserId(userId);
Long shopId = shopInfoDAO.addShopInfo(shopInfoDO);
if (lineInfo.getWorkflowSubStageStatus().equals(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_125.getCode())) {
shopStageInfoDAO.initShopStageInfo(request.getLineId(), Collections.singletonList(shopId), true);
} else {
shopStageInfoDAO.initShopStageInfo(request.getLineId(), Collections.singletonList(shopId), false);
}
return shopId;
}
@Override
public BranchShopDetailResponse getBranchShopDetail(Long shopId) {
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(shopId);
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(shopInfo.getLineId());
if (Objects.isNull(lineInfo)) {
throw new ServiceException(ErrorCodeEnum.LINE_ID_IS_NOT_EXIST);
}
EnterpriseUserDO invest = enterpriseUserDAO.getUserInfoById(shopInfo.getInvestmentManager());
List<ScheduleDTO> shopContractActualCompletionTime = shopStageInfoDAO.getScheduleList(Collections.singletonList(shopId));
RegionNode shopRegion = regionMapper.getRegionByRegionId(shopInfo.getRegionId().toString());
String wantShopArea = hyOpenAreaInfoDAO.selectNameMapById(shopInfo.getWantShopAreaId());
HyOpenAreaInfoDO hyOpenAreaInfoDO = hyOpenAreaInfoDAO.selectById(shopInfo.getWantShopAreaId());
BranchShopDetailResponse response = new BranchShopDetailResponse();
response.setUsername(lineInfo.getUsername());
response.setMobile(lineInfo.getMobile());
response.setShopId(shopId);
response.setShopName(shopInfo.getShopName());
response.setJoinMode(shopInfo.getJoinMode());
response.setShopCode(shopInfo.getShopCode());
response.setShopStatus(shopInfo.getShopStatus());
response.setFranchiseBrand(shopInfo.getFranchiseBrand());
if (CollectionUtils.isNotEmpty(shopContractActualCompletionTime)) {
ScheduleDTO scheduleDTO = shopContractActualCompletionTime.get(CommonConstants.ZERO);
response.setCompletionColumn(scheduleDTO.getCompletionColumn());
response.setTotalColumn(scheduleDTO.getTotalColumn());
response.setPlanCompletionTime(scheduleDTO.getPlanCompleteTime());
}
response.setInvestmentManagerId(shopInfo.getInvestmentManager());
response.setInvestmentManagerName(invest.getName());
response.setRegionId(shopInfo.getRegionId());
response.setWantRegionId(shopInfo.getWantShopAreaId());
response.setRegionName(shopRegion.getName());
response.setWantRegionName(wantShopArea);
response.setWantRegionParentId(hyOpenAreaInfoDO.getParentId());
response.setPointId(shopInfo.getPointId());
return response;
}
@Override
public Integer updateBranchShopDetail(BranchShopDetailRequest request, String userId) {
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(request.getShopId());
shopInfo.setUpdateUserId(userId);
shopInfo.setUpdateTime(new Date());
shopInfo.setShopCode(request.getShopCode());
shopInfo.setShopName(request.getShopName());
shopInfo.setWantShopAreaId(request.getWantShopAreaId());
shopInfo.setRegionId(request.getRegionId());
shopInfo.setJoinMode(request.getJoinMode());
shopInfo.setFranchiseBrand(request.getFranchiseBrand());
return shopInfoDAO.updateShopInfo(shopInfo);
}
@Override
@Transactional(rollbackFor = Exception.class)
public Integer updateShopInvestment(Long shopId, String updateUserId, String userId) {
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(shopId);
if (updateUserId.equals(shopInfo.getInvestmentManager())) {
throw new ServiceException(UPDATE_INVESTMENT_MANAGER_FAIL);
}
transferLogService.addLog(shopInfo.getId(), shopInfo.getPartnerId(), shopInfo.getInvestmentManager(), updateUserId, OperationLogTypeEnum.TRANSFER_INVESTMENT_MANAGER_4);
shopInfo.setUpdateTime(new Date());
shopInfo.setUpdateUserId(userId);
shopInfo.setInvestmentManager(updateUserId);
shopInfo.setDevelopmentManager(updateUserId);
shopInfo.setSupervisorUserId(updateUserId);
return shopInfoDAO.updateShopInfo(shopInfo);
}
@Override
public Boolean shopClose(Long shopId) {
log.info("shopClose shopId:{}", shopId);
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(shopId);
if (Objects.isNull(shopInfo)) {
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
}
//只有跟进中才能结束跟进
if (ShopStatusEnum.ING.getCode() != shopInfo.getShopStatus()) {
throw new ServiceException(ErrorCodeEnum.SHOP_STATUS_NOT_SUPPORT_HANDLER, ShopStatusEnum.getDesc(shopInfo.getShopStatus()));
}
shopInfo.setShopStatus(ShopStatusEnum.ABANDON.getCode());
shopInfoDAO.updateShopInfo(shopInfo);
return Boolean.TRUE;
}
@Override
public PageInfo<BranchShopResponse> getBranchShopList(BranchShopRequest request, String userId) {
if (request.getFlag().equals(CommonConstants.TWO)) {
if (!sysRoleService.checkIsAdmin(userId)) {
request.setAuthRegionIds(userAuthMappingService.getAuthRegionIdAndSubRegionIdByUserId(userId));
if (CollectionUtils.isEmpty(request.getAuthRegionIds())) {
return new PageInfo<>();
}
}
}
if (CollectionUtils.isNotEmpty(request.getRegionIds())) {
if (request.getRegionIds().contains(CommonConstants.ROOT_DEPT_ID_STR)) {
request.setRegionIds(null);
} else {
request.setRegionIds(regionService.getSubRegionIdsByRegionIds(request.getRegionIds()));
}
}
if (CollectionUtils.isNotEmpty(request.getWantShopAreaId())) {
List<Long> childrenListByParentIds = hyOpenAreaInfoDAO.getChildrenListByParentIds(request.getWantShopAreaId());
childrenListByParentIds.addAll(request.getWantShopAreaId());
request.setWantShopAreaAllIds(childrenListByParentIds);
}
PageHelper.startPage(request.getPageNum(), request.getPageSize());
List<BranchShopResponse> responses = new ArrayList<>();
List<PreparationDTO> preparations = shopInfoDAO.ListByBranchShopRequest(request,userId);
PageInfo pageInfo = new PageInfo<>(preparations);
if (CollectionUtils.isEmpty(preparations)) {
return new PageInfo<>();
}
List<Long> regionIds = preparations.stream().map(PreparationDTO::getRegionId).collect(Collectors.toList());
List<Long> wantShopAreaIds = preparations.stream().map(PreparationDTO::getWantShopAreaId).collect(Collectors.toList());
List<String> investmentManagerIds = preparations.stream().map(PreparationDTO::getInvestmentManager).collect(Collectors.toList());
List<Long> shopIds = preparations.stream().map(PreparationDTO::getId).collect(Collectors.toList());
List<ScheduleDTO> scheduleList = shopStageInfoDAO.getScheduleList(shopIds);
Map<Long, ScheduleDTO> scheduleMap = scheduleList.stream().collect(Collectors.toMap(ScheduleDTO::getShopId, x -> x));
Map<Long, String> regionNameMap = regionService.getBelongWarRegionNameMap(regionIds);
Map<String, EnterpriseUserDO> userInfoMap = enterpriseUserDAO.getUserInfoMap(investmentManagerIds);
Map<Long, String> wantRegionMap = hyOpenAreaInfoDAO.selectNameMapByIds(wantShopAreaIds);
List<ShopStageInfoDO> openActivityActualCompletionTime = shopStageInfoDAO.getOpenActivityActualCompletionTime(shopIds);
Map<Long, ShopStageInfoDO> openActivityStageMap = openActivityActualCompletionTime.stream().collect(Collectors.toMap(ShopStageInfoDO::getShopId, x -> x));
for (PreparationDTO dto : preparations) {
BranchShopResponse response = new BranchShopResponse();
response.setShopId(dto.getId());
response.setLineId(dto.getLineId());
response.setUsername(dto.getUsername());
response.setMobile(dto.getMobile());
response.setShopName(dto.getShopName());
response.setShopCode(dto.getShopCode());
response.setRegionName(regionNameMap.getOrDefault(dto.getRegionId(), ""));
response.setFranchiseBrand(dto.getFranchiseBrand());
response.setJoinMode(dto.getJoinMode());
response.setWantRegionName(wantRegionMap.getOrDefault(dto.getWantShopAreaId(), ""));
response.setPlanOpenTime(dto.getPlanOpenTime());
ScheduleDTO scheduleDTO = scheduleMap.getOrDefault(dto.getId(), new ScheduleDTO());
response.setTotalColumn(scheduleDTO.getTotalColumn());
response.setCompletionColumn(scheduleDTO.getCompletionColumn());
response.setOpeningActivityEndTime(DateUtils.strToDate(openActivityStageMap.getOrDefault(dto.getId(), new ShopStageInfoDO()).getActualCompleteTime(), DateUtils.YYYY_MM_DD_HH_MM_SS));
response.setInvestmentManagerName(userInfoMap.getOrDefault(dto.getInvestmentManager(), new EnterpriseUserDO()).getName());
response.setShopStatus(ShopStatusEnum.getDesc(dto.getShopStatus()));
response.setCreateTime(dto.getCreateTime());
response.setDays();
responses.add(response);
}
pageInfo.setList(responses);
return pageInfo;
}
/**
* 数据处理
* @param lineId
* @return
*/
@Override
public Boolean dataHandler(Long lineId) {
log.info("------dataHandle start-----");
boolean hasNext = true;
int pageNum = 1;
int pageSize = 50;
while (hasNext) {
PageHelper.startPage(pageNum, pageSize);
List<ShopInfoDO> shopInfoDOS = shopInfoDAO.selectAllDataOrByLineId(lineId);
if (CollectionUtils.isEmpty(shopInfoDOS)) {
log.info("------dataHandle end------");
return Boolean.TRUE;
}
Set<Long> lineIds = shopInfoDOS.stream().map(ShopInfoDO::getLineId).collect(Collectors.toSet());
List<LineInfoDO> lines = lineInfoDAO.getByLineIds(new ArrayList<>(lineIds));
//转为map
Map<Long, LineInfoDO> lineMap = lines.stream().collect(Collectors.toMap(LineInfoDO::getId, line -> line));
List<Long> shopIds = shopInfoDOS.stream().map(ShopInfoDO::getId).collect(Collectors.toList());
Map<Long, Integer> shopStatus = preparationService.getShopStatus(shopIds);
for (ShopInfoDO shopInfoDO : shopInfoDOS) {
LineInfoDO lineInfoDO = lineMap.get(shopInfoDO.getLineId());
if (lineInfoDO == null) {
continue;
}
shopInfoDO.setDevelopmentManager(lineInfoDO.getDevelopmentManager());
shopInfoDO.setShopStatus(shopStatus.get(shopInfoDO.getId()));
shopInfoDO.setJoinMode(lineInfoDO.getJoinMode());
shopInfoDO.setFranchiseBrand(lineInfoDO.getFranchiseBrand());
shopInfoDO.setInvestmentManager(lineInfoDO.getInvestmentManager());
shopInfoDO.setWantShopAreaId(lineInfoDO.getWantShopAreaId());
}
shopInfoDAO.batchUpdate(shopInfoDOS);
log.info("------shopInfoDOS:{}------", JSONObject.toJSONString(shopInfoDOS));
hasNext = shopInfoDOS.size() >= pageSize;
pageNum++;
}
return Boolean.TRUE;
}
}

View File

@@ -201,6 +201,7 @@ public class TempUserDetailServiceImpl implements TempUserDetailService {
shopStageInfoDAO.updateShopStageInfo(shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_51);
//状态结束
preparationService.whetherToOpenForAcceptance(shopId);
preparationService.updateShopStatus(shopId);
}
}

View File

@@ -3,6 +3,7 @@ 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.ShopInfoDO;
import com.cool.store.entity.TransferLogDO;
import com.cool.store.enums.OperationLogTypeEnum;
import com.cool.store.service.TransferLogService;
@@ -25,10 +26,10 @@ public class TransferLogServiceImpl implements TransferLogService {
private TransferLogDAO transferLogDAO;
@Override
public void addLog(LineInfoDO lineInfoDO, String formUserId, String toUserId, OperationLogTypeEnum operationLogTypeEnum) {
public void addLog(Long id ,String partnerId, String formUserId, String toUserId, OperationLogTypeEnum operationLogTypeEnum) {
TransferLogDO transferLogDO = new TransferLogDO();
transferLogDO.setLineId(lineInfoDO.getId());
transferLogDO.setPartnerId(lineInfoDO.getPartnerId());
transferLogDO.setLineId(id);
transferLogDO.setPartnerId(partnerId);
transferLogDO.setFromUserId(formUserId);
transferLogDO.setToUserId(toUserId);
transferLogDO.setType(operationLogTypeEnum.getCode());
@@ -38,10 +39,11 @@ public class TransferLogServiceImpl implements TransferLogService {
transferLogDAO.add(transferLogDO);
}
@Override
public PageInfo<TransferLogDTO> getTransferLogPage(Integer pageNum, Integer pageSize, Long lineId) {
public PageInfo<TransferLogDTO> getTransferLogPage(Integer pageNum, Integer pageSize, Long lineId,Integer lineShopType) {
PageHelper.startPage(pageNum, pageSize);
List<TransferLogDTO> transferLogList = transferLogDAO.getTransferLogList(lineId);
List<TransferLogDTO> transferLogList = transferLogDAO.getTransferLogList(lineId,lineShopType);
PageInfo<TransferLogDTO> transferLogDTOPageInfo = new PageInfo<>(transferLogList);
return transferLogDTOPageInfo;
}

View File

@@ -178,6 +178,9 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
* @return 解析后时间
*/
public static Date strToDate(String strDate, String pattern) {
if (StringUtils.isBlank(strDate)){
return null;
}
SimpleDateFormat formatter = new SimpleDateFormat(pattern);
ParsePosition pos = new ParsePosition(0);
return formatter.parse(strDate, pos);