开业筹备阶段5.5

This commit is contained in:
shuo.wang
2024-04-28 11:43:36 +08:00
parent 57eafeaf4f
commit fce9be8d92
7 changed files with 59 additions and 98 deletions

View File

@@ -1,8 +1,10 @@
package com.cool.store.dao;
import com.cool.store.dto.openPreparation.OpenPlanShopInfoDTO;
import com.cool.store.dto.openPreparation.OpeningOperationPlanDTO;
import com.cool.store.entity.OpeningOperationPlanDO;
import com.cool.store.mapper.OpeningOperationPlanMapper;
import com.cool.store.request.PlanListRequest;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
@@ -31,6 +33,15 @@ public class OpeningOperationPlanDAO {
return openingOperationPlanDO.getId();
}
/**
* @Auther: wangshuo
* @Date: 2024/4/24
* @description: 开业运营方案根据condition获取列表
*/
public List<OpenPlanShopInfoDTO>getOpenPlanShopListByCondition(PlanListRequest request ){
return openingOperationPlanMapper.getOpenPlanShopListByCondition(request);
}
public Integer updateResultType(Long shopId,Long auditId,Integer resultType){
return openingOperationPlanMapper.updateByShopId(shopId,auditId,resultType);
@@ -45,10 +56,5 @@ public class OpeningOperationPlanDAO {
return openingOperationPlanMapper.selectByShopId(shopId);
}
public Page<OpeningOperationPlanDTO> selectConditionPlanList(Date StartDate, Date EndDate, Integer resultType,
Integer pageNum,Integer pageSize){
PageHelper.startPage(pageNum,pageSize);
return openingOperationPlanMapper.selectPlanList( StartDate,EndDate,resultType);
}
}

View File

@@ -138,16 +138,6 @@ public class ShopInfoDAO {
return shopInfoMapper.getShopListByIds(shopIds);
}
/**
* @Auther: wangshuo
* @Date: 2024/4/24
* @description: 开业运营方案根据shopname获取列表
*/
public List<OpenPlanShopInfoDTO>getOpenPlanShopListByShopName( PlanListRequest request ){
return shopInfoMapper.getOpenPlanShopListByShopName(request);
}
public Map<Long, Integer> getSelectedShopNumMap(List<Long> lineIds) {
if(CollectionUtils.isEmpty(lineIds)){
return Maps.newHashMap();

View File

@@ -1,7 +1,9 @@
package com.cool.store.mapper;
import com.cool.store.dto.openPreparation.OpenPlanShopInfoDTO;
import com.cool.store.dto.openPreparation.OpeningOperationPlanDTO;
import com.cool.store.entity.OpeningOperationPlanDO;
import com.cool.store.request.PlanListRequest;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;
@@ -13,9 +15,12 @@ public interface OpeningOperationPlanMapper extends Mapper<OpeningOperationPlanD
OpeningOperationPlanDO selectByShopId(@Param("shopId") Long shopId);
Page<OpeningOperationPlanDTO> selectPlanList(@Param("startDate") Date startDate,
@Param("endDate") Date endDate,
@Param("resultType") Integer resultType);
Integer updateByShopId(@Param("shopId") Long shopId, @Param("auditId") Long auditId, @Param("resultType") Integer resultType);
/**
* @Auther: wangshuo
* @Date: 2024/4/24
* @description: 开业运营方案根据shopname获取列表
*/
List<OpenPlanShopInfoDTO> getOpenPlanShopListByCondition(@Param("request") PlanListRequest request);
}

View File

@@ -66,12 +66,7 @@ public interface ShopInfoMapper extends Mapper<ShopInfoDO> {
* @return
*/
List<ShopInfoDO> getShopListByIds(@Param("shopIds")List<Long> shopIds);
/**
* @Auther: wangshuo
* @Date: 2024/4/24
* @description: 开业运营方案根据shopname获取列表
*/
List<OpenPlanShopInfoDTO> getOpenPlanShopListByShopName( @Param("request") PlanListRequest request);
/**
* @Auther: wangshuo
* @Date: 2024/4/25

View File

@@ -44,21 +44,34 @@
and
deleted = 0
</select>
<select id="selectPlanList" resultType="com.cool.store.dto.openPreparation.OpeningOperationPlanDTO">
SELECT shop_id AS shopId, submission_time AS submissionTime, result_type AS resultType,
audit_id as auditId
FROM xfsg_opening_operation_plan
<select id="getOpenPlanShopListByCondition"
resultType="com.cool.store.dto.openPreparation.OpenPlanShopInfoDTO">
select si.id as shopId, si.region_id AS regionId,si.line_id as lineId, si.shop_name as shopName,
si.shop_code as shopCode, si.shop_manager_user_id as shopManagerUserId,li.investment_manager AS investmentManagerId,
li.username as partnerName, li.mobile as mobile ,
op.submission_time AS submissionTime , op.result_type AS resultType
from xfsg_opening_operation_plan op
join xfsg_shop_info si on si.id = op.shop_id
join xfsg_line_info li on si.line_id = li.id
where 1=1
<if test="startDate != null">
and op.create_time >= #{startDate}
<if test="request.shopName != null and request.shopName != '' ">
AND si.shop_name like concat('%', #{request.shopName}, '%')
</if>
<if test="endDate != null">
AND op.create_time &lt;= #{endDate}
<if test="request.resultType != null and request.resultType != ''">
AND op.result_type = #{request.resultType}
</if>
<if test="resultType != null">
and op.result_type = #{resultType}
<if test="request.planStartDate != null and request.planStartDate != ''">
and op.create_time >= #{request.planStartDate}
</if>
<if test="request.planEndDate != null and request.planEndDate != ''">
AND op.create_time &lt;= #{request.planEndDate}
</if>
<if test="request.regionIds != null and request.regionIds.size() > 0">
and si.region_id in
<foreach collection="request.regionIds" item="regionId" index="index" open="(" separator="," close=")">
#{regionId}
</foreach>
</if>
</select>

View File

@@ -72,36 +72,7 @@
#{shopId}
</foreach>
</select>
<select id="getOpenPlanShopListByShopName" resultType="com.cool.store.dto.openPreparation.OpenPlanShopInfoDTO">
select si.id as shopId, si.region_id AS regionId,si.line_id as lineId, si.shop_name as shopName,
si.shop_code as shopCode, si.shop_manager_user_id as shopManagerUserId,li.investment_manager AS investmentManagerId,
li.username as partnerName, li.mobile as mobile ,
op.submission_time AS submissionTime , op.result_type AS resultType
from xfsg_shop_info si
join xfsg_line_info li on si.line_id = li.id
join xfsg_opening_operation_plan op on si.id = op.shop_id
where 1=1
<if test="request.shopName != null and request.shopName != '' ">
AND si.shop_name like concat('%', #{request.shopName}, '%')
</if>
<if test="request.resultType != null and request.resultType != ''">
AND op.result_type = #{request.resultType}
</if>
<if test="request.planStartDate != null and request.planStartDate != ''">
and op.create_time >= #{request.planStartDate}
</if>
<if test="request.planEndDate != null and request.planEndDate != ''">
AND op.create_time &lt;= #{request.planEndDate}
</if>
<if test="request.regionIds != null and request.regionIds.size() > 0">
and si.region_id in
<foreach collection="request.regionIds" item="regionId" index="index" open="(" separator="," close=")">
#{regionId}
</foreach>
</if>
</select>
<select id="queryShopIdListByStage" resultType="java.lang.Long">
select id
from xfsg_shop_info

View File

@@ -136,45 +136,26 @@ public class OpeningOperationPlanImpl implements OpeningOperationPlanService {
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()));
}
}
PageHelper.startPage(request.getPageNum(), request.getPageSize());
//去shop_info表查询店铺名字店铺code开店负责人id督导id区域idlineinfo 加盟商name手机号招商经理id,open_plan,提交时间,审核状态
List<OpenPlanShopInfoDTO> openPlanShopInfoDTOS = shopInfoDAO.getOpenPlanShopListByShopName(request);
List<OpenPlanShopInfoDTO> openPlanShopInfoDTOS = openingOperationPlanDAO.getOpenPlanShopListByCondition(request);
PageInfo pageInfo = new PageInfo<>(openPlanShopInfoDTOS);
//开店负责人id督导id,招商经理id
//开店负责人name
List<String> shopManagerUserIdList = openPlanShopInfoDTOS.stream()
Set<String> userIdset = openPlanShopInfoDTOS.stream()
.map(OpenPlanShopInfoDTO::getShopManagerUserId)
.collect(Collectors.toList());
List<UserNameDTO> shopManagerList = enterpriseUserDAO.getNameByUserId(shopManagerUserIdList);
log.info("getPlanListPage shopManagerList :{}", JSONObject.toJSONString(shopManagerList));
Map<String, UserNameDTO> voManagerMap = shopManagerList.stream()
.collect(Collectors.toMap(UserNameDTO::getUserId, vo -> vo));
log.info("getPlanListPage voManagerMap:{}", JSONObject.toJSONString(voManagerMap));
//督导name
List<String> supervisorUserIdList = openPlanShopInfoDTOS.stream()
.collect(Collectors.toSet());
userIdset.addAll(openPlanShopInfoDTOS.stream()
.map(OpenPlanShopInfoDTO::getSupervisorUserId)
.collect(Collectors.toList());
List<UserNameDTO> supervisorList = enterpriseUserDAO.getNameByUserId(supervisorUserIdList);
log.info("getPlanListPage supervisorList :{}", JSONObject.toJSONString(supervisorList));
Map<String, UserNameDTO> voSupervisorMap = supervisorList.stream()
.collect(Collectors.toMap(UserNameDTO::getUserId, vo -> vo));
log.info("getPlanListPage voSupervisorMap:{}", JSONObject.toJSONString(voSupervisorMap));
//招商经理name
List<String> investmentManagerIdList = openPlanShopInfoDTOS.stream()
.collect(Collectors.toSet()));
userIdset.addAll(openPlanShopInfoDTOS.stream()
.map(OpenPlanShopInfoDTO::getInvestmentManagerId)
.collect(Collectors.toList());
List<UserNameDTO> voInvestmentManagerList= enterpriseUserDAO.getNameByUserId(investmentManagerIdList);
log.info("getPlanListPage voInvestmentManagerList :{}", JSONObject.toJSONString(voInvestmentManagerList));
Map<String, UserNameDTO> voInvestmentManagerMap = voInvestmentManagerList.stream()
.collect(Collectors.toSet()));
List<String> userlist = new ArrayList<>();
userlist.addAll(userIdset);
List<UserNameDTO> nameByUserId = enterpriseUserDAO.getNameByUserId(userlist);
Map<String, UserNameDTO> vonameMap = nameByUserId.stream()
.collect(Collectors.toMap(UserNameDTO::getUserId, vo -> vo));
log.info("getPlanListPage voInvestmentManagerList:{}", JSONObject.toJSONString(voInvestmentManagerList));
log.info("getPlanListPage vonameMap:{}", JSONObject.toJSONString(vonameMap));
//region
List<Long> regionIds = openPlanShopInfoDTOS.stream().map(OpenPlanShopInfoDTO::getRegionId).collect(Collectors.toList());
Map<Long, String> regionNameMap = regionService.getBelongWarRegionNameMap(regionIds);
@@ -193,14 +174,14 @@ public class OpeningOperationPlanImpl implements OpeningOperationPlanService {
}
if (!StringUtils.isEmpty(x.getInvestmentManagerId())) {
openingOperationPlanListVO.setInvestmentManagerName
(voInvestmentManagerMap.get(x.getInvestmentManagerId()).getName());
(vonameMap.get(x.getInvestmentManagerId()).getName());
}
if (!StringUtils.isEmpty(x.getShopManagerUserId())) {
openingOperationPlanListVO.setShopManagerName
(voInvestmentManagerMap.get(x.getInvestmentManagerId()).getName());
(vonameMap.get(x.getInvestmentManagerId()).getName());
}
if (!StringUtils.isEmpty(x.getSupervisorUserId()))
{openingOperationPlanListVO.setSupervisorName(voSupervisorMap.get(x.getSupervisorUserId()).getName());}
{openingOperationPlanListVO.setSupervisorName(vonameMap.get(x.getSupervisorUserId()).getName());}
openingOperationPlanListVO.setSubmissionTime(x.getSubmissionTime());
openingOperationPlanListVO.setResultType(x.getResultType());
openingOperationPlanListVOList.add(openingOperationPlanListVO);