加盟商详情,门店列表
This commit is contained in:
@@ -73,6 +73,13 @@ public class ShopInfoDAO {
|
||||
return shopInfoMapper.getShopList(lineId);
|
||||
}
|
||||
|
||||
public List<ShopInfoDO> getShopListByRegion(Long lineId,List<Long> regionIdList){
|
||||
if(Objects.isNull(lineId)){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return shopInfoMapper.getShopListByRegion(lineId,regionIdList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增门店信息
|
||||
* @param shopInfo
|
||||
|
||||
@@ -37,6 +37,8 @@ public interface ShopInfoMapper extends Mapper<ShopInfoDO> {
|
||||
*/
|
||||
List<ShopInfoDO> getShopList(@Param("lineId") Long lineId);
|
||||
|
||||
List<ShopInfoDO> getShopListByRegion(@Param("lineId") Long lineId,@Param("list") List<Long> regions);
|
||||
|
||||
/**
|
||||
* 店铺信息
|
||||
*
|
||||
|
||||
@@ -1,195 +1,204 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.cool.store.mapper.ShopInfoMapper">
|
||||
<resultMap id="BaseResultMap" type="com.cool.store.entity.ShopInfoDO">
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="region_id" jdbcType="BIGINT" property="regionId" />
|
||||
<result column="line_id" jdbcType="BIGINT" property="lineId" />
|
||||
<result column="partner_id" jdbcType="VARCHAR" property="partnerId" />
|
||||
<result column="point_id" jdbcType="BIGINT" property="pointId" />
|
||||
<result column="shop_name" jdbcType="VARCHAR" property="shopName" />
|
||||
<result column="shop_code" jdbcType="VARCHAR" property="shopCode" />
|
||||
<result column="store_num" jdbcType="VARCHAR" property="storeNum" />
|
||||
<result column="shop_manager_user_id" jdbcType="VARCHAR" property="shopManagerUserId" />
|
||||
<result column="supervisor_user_id" jdbcType="VARCHAR" property="supervisorUserId" />
|
||||
<result column="plan_open_time" jdbcType="TIMESTAMP" property="planOpenTime" />
|
||||
<result column="cur_progress" jdbcType="DECIMAL" property="curProgress" />
|
||||
<result column="shop_type" jdbcType="TINYINT" property="shopType" />
|
||||
<result column="shop_stage" jdbcType="TINYINT" property="shopStage" />
|
||||
<result column="deleted" jdbcType="BIT" property="deleted" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
<result column="join_mode" jdbcType="TINYINT" property="joinMode"/>
|
||||
<result column="detail_address" jdbcType="VARCHAR" property="detailAddress"/>
|
||||
<result column="franchise_brand" jdbcType="VARCHAR" property="franchiseBrand"/>
|
||||
<result column="development_manager" jdbcType="VARCHAR" property="developmentManager"/>
|
||||
<result column="want_shop_area_id" jdbcType="BIGINT" property="wantShopAreaId"/>
|
||||
<result column="investment_manager" jdbcType="VARCHAR" property="investmentManager"/>
|
||||
<result column="shop_status" jdbcType="TINYINT" property="shopStatus"/>
|
||||
<result column="create_user_id" jdbcType="VARCHAR" property="createUserId"/>
|
||||
<result column="update_user_id" jdbcType="VARCHAR" property="updateUserId"/>
|
||||
</resultMap>
|
||||
<resultMap id="BaseResultMap" type="com.cool.store.entity.ShopInfoDO">
|
||||
<id column="id" jdbcType="BIGINT" property="id"/>
|
||||
<result column="region_id" jdbcType="BIGINT" property="regionId"/>
|
||||
<result column="line_id" jdbcType="BIGINT" property="lineId"/>
|
||||
<result column="partner_id" jdbcType="VARCHAR" property="partnerId"/>
|
||||
<result column="point_id" jdbcType="BIGINT" property="pointId"/>
|
||||
<result column="shop_name" jdbcType="VARCHAR" property="shopName"/>
|
||||
<result column="shop_code" jdbcType="VARCHAR" property="shopCode"/>
|
||||
<result column="store_num" jdbcType="VARCHAR" property="storeNum"/>
|
||||
<result column="shop_manager_user_id" jdbcType="VARCHAR" property="shopManagerUserId"/>
|
||||
<result column="supervisor_user_id" jdbcType="VARCHAR" property="supervisorUserId"/>
|
||||
<result column="plan_open_time" jdbcType="TIMESTAMP" property="planOpenTime"/>
|
||||
<result column="cur_progress" jdbcType="DECIMAL" property="curProgress"/>
|
||||
<result column="shop_type" jdbcType="TINYINT" property="shopType"/>
|
||||
<result column="shop_stage" jdbcType="TINYINT" property="shopStage"/>
|
||||
<result column="deleted" jdbcType="BIT" property="deleted"/>
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
|
||||
<result column="join_mode" jdbcType="TINYINT" property="joinMode"/>
|
||||
<result column="detail_address" jdbcType="VARCHAR" property="detailAddress"/>
|
||||
<result column="franchise_brand" jdbcType="VARCHAR" property="franchiseBrand"/>
|
||||
<result column="development_manager" jdbcType="VARCHAR" property="developmentManager"/>
|
||||
<result column="want_shop_area_id" jdbcType="BIGINT" property="wantShopAreaId"/>
|
||||
<result column="investment_manager" jdbcType="VARCHAR" property="investmentManager"/>
|
||||
<result column="shop_status" jdbcType="TINYINT" property="shopStatus"/>
|
||||
<result column="create_user_id" jdbcType="VARCHAR" property="createUserId"/>
|
||||
<result column="update_user_id" jdbcType="VARCHAR" property="updateUserId"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="allColumn">
|
||||
id, region_id, line_id, partner_id, point_id, shop_name,
|
||||
<sql id="allColumn">
|
||||
id
|
||||
, region_id, line_id, partner_id, point_id, shop_name,
|
||||
shop_code, store_num, shop_manager_user_id, supervisor_user_id,
|
||||
plan_open_time, cur_progress, shop_type, shop_stage, deleted, create_time, update_time,
|
||||
join_mode,detail_address,franchise_brand,development_manager,want_shop_area_id,investment_manager,shop_status,create_user_id,update_user_id
|
||||
</sql>
|
||||
</sql>
|
||||
|
||||
<insert id="batchAddShop" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
|
||||
insert into xfsg_shop_info(region_id, line_id, partner_id, shop_name, store_num,supervisor_user_id) values
|
||||
<foreach collection="shopInfoList" item="shop" separator=",">
|
||||
(#{shop.regionId}, #{shop.lineId}, #{shop.partnerId}, #{shop.shopName}, #{shop.storeNum},#{shop.supervisorUserId})
|
||||
</foreach>
|
||||
</insert>
|
||||
<insert id="batchAddShop" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
|
||||
insert into xfsg_shop_info(region_id, line_id, partner_id, shop_name, store_num,supervisor_user_id) values
|
||||
<foreach collection="shopInfoList" item="shop" separator=",">
|
||||
(#{shop.regionId}, #{shop.lineId}, #{shop.partnerId}, #{shop.shopName},
|
||||
#{shop.storeNum},#{shop.supervisorUserId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<select id="getShopList" resultMap="BaseResultMap">
|
||||
select <include refid="allColumn"/> from xfsg_shop_info where line_id = #{lineId} and deleted= '0'
|
||||
</select>
|
||||
<select id="getShopList" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="allColumn"/>
|
||||
from xfsg_shop_info where line_id = #{lineId} and deleted= '0'
|
||||
</select>
|
||||
|
||||
<select id="getShopInfoByPointId" resultMap="BaseResultMap">
|
||||
select <include refid="allColumn"/> from xfsg_shop_info where point_id = #{pointId} and deleted= '0'
|
||||
</select>
|
||||
<select id="getShopInfoByPointId" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="allColumn"/>
|
||||
from xfsg_shop_info where point_id = #{pointId} and deleted= '0'
|
||||
</select>
|
||||
|
||||
<select id="getStageShopCount" resultType="com.cool.store.vo.shop.StageShopCountVO">
|
||||
select
|
||||
sum(if(shop_stage = 1, 1, 0)) as selectPointCount,
|
||||
sum(if(shop_stage = 2, 1, 0)) as buildShopCount,
|
||||
sum(if(shop_stage = 3, 1, 0)) as openShopCount
|
||||
from
|
||||
xfsg_shop_info
|
||||
where
|
||||
deleted = '0' and line_id = #{lineId}
|
||||
</select>
|
||||
<select id="getStageShopCount" resultType="com.cool.store.vo.shop.StageShopCountVO">
|
||||
select sum(if(shop_stage = 1, 1, 0)) as selectPointCount,
|
||||
sum(if(shop_stage = 2, 1, 0)) as buildShopCount,
|
||||
sum(if(shop_stage = 3, 1, 0)) as openShopCount
|
||||
from xfsg_shop_info
|
||||
where deleted = '0'
|
||||
and line_id = #{lineId}
|
||||
</select>
|
||||
|
||||
<update id="unbindPoint">
|
||||
update xfsg_shop_info set point_id = null where id = #{shopId}
|
||||
</update>
|
||||
<update id="unbindPoint">
|
||||
update xfsg_shop_info
|
||||
set point_id = null
|
||||
where id = #{shopId}
|
||||
</update>
|
||||
|
||||
<select id="getShopListByIds" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="allColumn"/>
|
||||
from
|
||||
xfsg_shop_info where id in
|
||||
<foreach collection="shopIds" item="shopId" separator="," open="(" close=")">
|
||||
#{shopId}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="queryStoreNumeListByid" resultType="com.cool.store.dto.openPreparation.OpenPlanShopInfoDTO">
|
||||
select id as shopId,store_num as storeNum
|
||||
from xfsg_shop_info
|
||||
where 1=1
|
||||
<if test="shopIdList != null and shopIdList.size >0">
|
||||
and id in
|
||||
<foreach collection="shopIdList" separator="," open="(" close=")" item="shopId">
|
||||
<select id="getShopListByIds" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="allColumn"/>
|
||||
from
|
||||
xfsg_shop_info where id in
|
||||
<foreach collection="shopIds" item="shopId" separator="," open="(" close=")">
|
||||
#{shopId}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
</select>
|
||||
|
||||
<select id="getSelectedShopNum" resultType="com.cool.store.dto.point.LineCountDTO">
|
||||
select
|
||||
line_id as lineId,
|
||||
count(1) as selectedShopNum
|
||||
from xfsg_shop_info
|
||||
where deleted = 0 and point_id > 0 and line_id in
|
||||
<foreach collection="lineIds" item="lineId" index="index" open="(" separator="," close=")">
|
||||
#{lineId}
|
||||
</foreach>
|
||||
group by line_id
|
||||
</select>
|
||||
|
||||
<select id="ListByCondition" resultType="com.cool.store.dto.Preparation.PreparationDTO">
|
||||
select
|
||||
a.id as id,
|
||||
a.line_id as lineId,
|
||||
a.shop_name as shopName,
|
||||
a.shop_code as shopCode,
|
||||
a.store_num as storeNum,
|
||||
a.shop_manager_user_id as shopManagerUserId,
|
||||
a.supervisor_user_id as supervisorUserId,
|
||||
a.region_id as regionId,
|
||||
b.username as username,
|
||||
b.mobile as mobile,
|
||||
b.investment_manager as investmentManager,
|
||||
DATE_ADD(b.create_time, INTERVAL 50 DAY) as planOpenTime,
|
||||
a.create_time as createTime
|
||||
from xfsg_shop_info a left join xfsg_line_info b on a.line_id = b.id
|
||||
where a.deleted = 0
|
||||
<if test="request.keyword != null and request.keyword != ''">
|
||||
and (b.username like concat('%', #{request.keyword}, '%') or b.mobile like concat('%', #{request.keyword}, '%'))
|
||||
</if>
|
||||
<if test="request.shopName!=null and request.shopName!=''">
|
||||
and a.shop_name like concat('%', #{request.shopName}, '%')
|
||||
</if>
|
||||
<if test="request.investmentUserId != null and request.investmentUserId != ''">
|
||||
and b.investment_manager = #{request.investmentUserId}
|
||||
</if>
|
||||
<if test="request.supervisorUserId != null and request.supervisorUserId != ''">
|
||||
and a.supervisor_user_id = #{request.supervisorUserId}
|
||||
</if>
|
||||
<if test="request.planOpenStartTime != null and request.planOpenStartTime != ''">
|
||||
and DATE_ADD(b.create_time, INTERVAL 50 DAY) >= #{request.planOpenStartTime}
|
||||
</if>
|
||||
<if test="request.planOpenEndTime != null and request.planOpenEndTime != ''">
|
||||
<![CDATA[and DATE_ADD(b.create_time, INTERVAL 50 DAY) <= #{request.planOpenEndTime}]]>
|
||||
</if>
|
||||
<if test="request.regionIds != null and request.regionIds.size() > 0">
|
||||
and a.region_id in
|
||||
<foreach collection="request.regionIds" item="regionId" index="index" open="(" separator="," close=")">
|
||||
#{regionId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="request.authRegionIds != null and request.authRegionIds.size() > 0">
|
||||
and a.region_id in
|
||||
<foreach collection="request.authRegionIds" item="regionId" index="index" open="(" separator="," close=")">
|
||||
#{regionId}
|
||||
</foreach>
|
||||
</if>
|
||||
order by a.update_time desc
|
||||
</select>
|
||||
<select id="getRegionIdByid" resultType="java.lang.Long">
|
||||
select r.parent_id
|
||||
from xfsg_shop_info xsi
|
||||
join region_${enterpriseId} r on r.id = xsi.region_id
|
||||
where xsi.id = #{shopId}
|
||||
</select>
|
||||
<select id="queryStoreNumeListByid" resultType="com.cool.store.dto.openPreparation.OpenPlanShopInfoDTO">
|
||||
select id as shopId,store_num as storeNum
|
||||
from xfsg_shop_info
|
||||
where 1=1
|
||||
<if test="shopIdList != null and shopIdList.size >0">
|
||||
and id in
|
||||
<foreach collection="shopIdList" separator="," open="(" close=")" item="shopId">
|
||||
#{shopId}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getSelectedShopNum" resultType="com.cool.store.dto.point.LineCountDTO">
|
||||
select
|
||||
line_id as lineId,
|
||||
count(1) as selectedShopNum
|
||||
from xfsg_shop_info
|
||||
where deleted = 0 and point_id > 0 and line_id in
|
||||
<foreach collection="lineIds" item="lineId" index="index" open="(" separator="," close=")">
|
||||
#{lineId}
|
||||
</foreach>
|
||||
group by line_id
|
||||
</select>
|
||||
|
||||
<select id="ListByCondition" resultType="com.cool.store.dto.Preparation.PreparationDTO">
|
||||
select
|
||||
a.id as id,
|
||||
a.line_id as lineId,
|
||||
a.shop_name as shopName,
|
||||
a.shop_code as shopCode,
|
||||
a.store_num as storeNum,
|
||||
a.shop_manager_user_id as shopManagerUserId,
|
||||
a.supervisor_user_id as supervisorUserId,
|
||||
a.region_id as regionId,
|
||||
b.username as username,
|
||||
b.mobile as mobile,
|
||||
b.investment_manager as investmentManager,
|
||||
DATE_ADD(b.create_time, INTERVAL 50 DAY) as planOpenTime,
|
||||
a.create_time as createTime
|
||||
from xfsg_shop_info a left join xfsg_line_info b on a.line_id = b.id
|
||||
where a.deleted = 0
|
||||
<if test="request.keyword != null and request.keyword != ''">
|
||||
and (b.username like concat('%', #{request.keyword}, '%') or b.mobile like concat('%', #{request.keyword},
|
||||
'%'))
|
||||
</if>
|
||||
<if test="request.shopName!=null and request.shopName!=''">
|
||||
and a.shop_name like concat('%', #{request.shopName}, '%')
|
||||
</if>
|
||||
<if test="request.investmentUserId != null and request.investmentUserId != ''">
|
||||
and b.investment_manager = #{request.investmentUserId}
|
||||
</if>
|
||||
<if test="request.supervisorUserId != null and request.supervisorUserId != ''">
|
||||
and a.supervisor_user_id = #{request.supervisorUserId}
|
||||
</if>
|
||||
<if test="request.planOpenStartTime != null and request.planOpenStartTime != ''">
|
||||
and DATE_ADD(b.create_time, INTERVAL 50 DAY) >= #{request.planOpenStartTime}
|
||||
</if>
|
||||
<if test="request.planOpenEndTime != null and request.planOpenEndTime != ''">
|
||||
<![CDATA[and DATE_ADD(b.create_time, INTERVAL 50 DAY) <= #{request.planOpenEndTime}]]>
|
||||
</if>
|
||||
<if test="request.regionIds != null and request.regionIds.size() > 0">
|
||||
and a.region_id in
|
||||
<foreach collection="request.regionIds" item="regionId" index="index" open="(" separator="," close=")">
|
||||
#{regionId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="request.authRegionIds != null and request.authRegionIds.size() > 0">
|
||||
and a.region_id in
|
||||
<foreach collection="request.authRegionIds" item="regionId" index="index" open="(" separator="," close=")">
|
||||
#{regionId}
|
||||
</foreach>
|
||||
</if>
|
||||
order by a.update_time desc
|
||||
</select>
|
||||
<select id="getRegionIdByid" resultType="java.lang.Long">
|
||||
select r.parent_id
|
||||
from xfsg_shop_info xsi
|
||||
join region_${enterpriseId} r on r.id = xsi.region_id
|
||||
where xsi.id = #{shopId}
|
||||
</select>
|
||||
<select id="selectByStoreNum" resultType="com.cool.store.entity.ShopInfoDO">
|
||||
select <include refid="allColumn"/>
|
||||
from xfsg_shop_info
|
||||
where store_num = #{storeNum}
|
||||
select
|
||||
<include refid="allColumn"/>
|
||||
from xfsg_shop_info
|
||||
where store_num = #{storeNum}
|
||||
</select>
|
||||
<select id="selectShopListByRegionId" resultType="com.cool.store.entity.ShopInfoDO">
|
||||
select
|
||||
xsi.id,xsi.line_id as lineId,xsi.region_id as regionId,xsi.shop_name as shopName,xsi.store_num as storeNum,xsi.shop_code as shopCode
|
||||
from xfsg_shop_info xsi
|
||||
left join xfsg_shop_stage_info xssi on xssi.shop_id = xsi.id
|
||||
where
|
||||
xsi.deleted = 0
|
||||
<if test="regionIds != null and regionIds.size() > 0">
|
||||
and xsi.region_id in
|
||||
<foreach collection="regionIds" item="regionId" index="index" open="(" separator="," close=")">
|
||||
#{regionId}
|
||||
</foreach>
|
||||
</if>
|
||||
AND xssi.shop_sub_stage_status != -100
|
||||
and xssi.shop_sub_stage = #{shopSubStage}
|
||||
<if test="subStageStatus != null and subStageStatus.size()>0">
|
||||
and xssi.shop_sub_stage_status in
|
||||
<foreach collection="subStageStatus" item="item" index="index" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="keyWord != null and keyWord != '' ">
|
||||
and xsi.shop_name Like concat("%",#{keyWord},"%") or xsi.store_num Like concat("%",#{keyWord},"%")
|
||||
</if>
|
||||
select
|
||||
xsi.id,xsi.line_id as lineId,xsi.region_id as regionId,xsi.shop_name as shopName,xsi.store_num as
|
||||
storeNum,xsi.shop_code as shopCode
|
||||
from xfsg_shop_info xsi
|
||||
left join xfsg_shop_stage_info xssi on xssi.shop_id = xsi.id
|
||||
where
|
||||
xsi.deleted = 0
|
||||
<if test="regionIds != null and regionIds.size() > 0">
|
||||
and xsi.region_id in
|
||||
<foreach collection="regionIds" item="regionId" index="index" open="(" separator="," close=")">
|
||||
#{regionId}
|
||||
</foreach>
|
||||
</if>
|
||||
AND xssi.shop_sub_stage_status != -100
|
||||
and xssi.shop_sub_stage = #{shopSubStage}
|
||||
<if test="subStageStatus != null and subStageStatus.size()>0">
|
||||
and xssi.shop_sub_stage_status in
|
||||
<foreach collection="subStageStatus" item="item" index="index" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="keyWord != null and keyWord != '' ">
|
||||
and xsi.shop_name Like concat("%",#{keyWord},"%") or xsi.store_num Like concat("%",#{keyWord},"%")
|
||||
</if>
|
||||
</select>
|
||||
<select id="platformBuildList" resultType="com.cool.store.response.PlatformBuildListResponse">
|
||||
select
|
||||
DISTINCT
|
||||
DISTINCT
|
||||
xsi.id as shopId,
|
||||
xsi.shop_name as shopName,
|
||||
xsi.shop_code as shopCode,
|
||||
@@ -225,90 +234,103 @@
|
||||
order by xsi.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectByIdOrSelectAll" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="allColumn"/>
|
||||
from
|
||||
xfsg_shop_info
|
||||
<where>
|
||||
<if test="shopId!=null">
|
||||
and id = #{shopId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="selectByIdOrSelectAll" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="allColumn"/>
|
||||
from
|
||||
xfsg_shop_info
|
||||
<where>
|
||||
<if test="shopId!=null">
|
||||
and id = #{shopId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getShopAndStoreList" resultType="com.cool.store.dto.LicenseSyncDTO">
|
||||
select
|
||||
a.id as shopId,
|
||||
a.shop_code as shopCode,
|
||||
b.store_id as storeId
|
||||
from
|
||||
xfsg_shop_info a
|
||||
left join store_${enterpriseId} b on a.shop_code = b.store_num
|
||||
where b.store_id is not null and a.id in
|
||||
<foreach collection="shopIds" item="shopId" separator="," open="(" close=")">
|
||||
#{shopId}
|
||||
</foreach>
|
||||
</select>
|
||||
<select id="ListByBranchShopRequest" resultType="com.cool.store.dto.Preparation.PreparationDTO">
|
||||
select
|
||||
a.id as id,
|
||||
a.line_id as lineId,
|
||||
a.shop_name as shopName,
|
||||
a.want_shop_area_id as wantShopAreaId,
|
||||
a.shop_code as shopCode,
|
||||
a.store_num as storeNum,
|
||||
a.shop_manager_user_id as shopManagerUserId,
|
||||
a.supervisor_user_id as supervisorUserId,
|
||||
a.region_id as regionId,
|
||||
b.username as username,
|
||||
b.mobile as mobile,
|
||||
a.investment_manager as investmentManager,
|
||||
DATE_ADD(b.create_time, INTERVAL 50 DAY) as planOpenTime,
|
||||
a.create_time as createTime,
|
||||
a.join_mode as joinMode,
|
||||
a.franchise_brand as franchiseBrand,
|
||||
a.shop_status as shopStatus
|
||||
from xfsg_shop_info a left join xfsg_line_info b on a.line_id = b.id
|
||||
where a.deleted = 0
|
||||
<if test="request.partnerKeyword != null and request.partnerKeyword != ''">
|
||||
and (b.username like concat('%', #{request.partnerKeyword}, '%') or b.mobile like concat('%', #{request.partnerKeyword}, '%'))
|
||||
</if>
|
||||
<if test="request.shopKeyword!=null and request.shopKeyword!=''">
|
||||
and (a.shop_name like concat('%',#{request.shopKeyword}, '%') or a.shop_code like concat('%', #{request.shopKeyword}, '%') )
|
||||
</if>
|
||||
<if test="request.regionIds != null and request.regionIds.size() > 0">
|
||||
and a.region_id in
|
||||
<foreach collection="request.regionIds" item="regionId" index="index" open="(" separator="," close=")">
|
||||
#{regionId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="request.authRegionIds != null and request.authRegionIds.size() > 0">
|
||||
and a.region_id in
|
||||
<foreach collection="request.authRegionIds" item="regionId" index="index" open="(" separator="," close=")">
|
||||
#{regionId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="request.investmentManagerUserId != null and request.investmentManagerUserId != ''">
|
||||
and a.investment_manager = #{request.investmentManagerUserId}
|
||||
</if>
|
||||
<if test="request.openTimeStart != null ">
|
||||
and DATE_ADD(a.create_time, INTERVAL 50 DAY) >= #{request.openTimeStart}
|
||||
</if>
|
||||
<if test="request.openTimeEnd != null ">
|
||||
<![CDATA[and DATE_ADD(a.create_time, INTERVAL 50 DAY) <= #{request.openTimeEnd}]]>
|
||||
</if>
|
||||
<if test="request.joinMode!=null">
|
||||
and a.join_mode = #{request.joinMode}
|
||||
</if>
|
||||
<if test="request.franchiseBrand!=null">
|
||||
and a.franchise_brand = #{request.franchiseBrand}
|
||||
</if>
|
||||
<if test="request.shopStatus!=null">
|
||||
and a.shop_status = #{request.shopStatus}
|
||||
</if>
|
||||
order by a.update_time desc
|
||||
</select>
|
||||
<select id="getShopAndStoreList" resultType="com.cool.store.dto.LicenseSyncDTO">
|
||||
select
|
||||
a.id as shopId,
|
||||
a.shop_code as shopCode,
|
||||
b.store_id as storeId
|
||||
from
|
||||
xfsg_shop_info a
|
||||
left join store_${enterpriseId} b on a.shop_code = b.store_num
|
||||
where b.store_id is not null and a.id in
|
||||
<foreach collection="shopIds" item="shopId" separator="," open="(" close=")">
|
||||
#{shopId}
|
||||
</foreach>
|
||||
</select>
|
||||
<select id="ListByBranchShopRequest" resultType="com.cool.store.dto.Preparation.PreparationDTO">
|
||||
select
|
||||
a.id as id,
|
||||
a.line_id as lineId,
|
||||
a.shop_name as shopName,
|
||||
a.want_shop_area_id as wantShopAreaId,
|
||||
a.shop_code as shopCode,
|
||||
a.store_num as storeNum,
|
||||
a.shop_manager_user_id as shopManagerUserId,
|
||||
a.supervisor_user_id as supervisorUserId,
|
||||
a.region_id as regionId,
|
||||
b.username as username,
|
||||
b.mobile as mobile,
|
||||
a.investment_manager as investmentManager,
|
||||
DATE_ADD(b.create_time, INTERVAL 50 DAY) as planOpenTime,
|
||||
a.create_time as createTime,
|
||||
a.join_mode as joinMode,
|
||||
a.franchise_brand as franchiseBrand,
|
||||
a.shop_status as shopStatus
|
||||
from xfsg_shop_info a left join xfsg_line_info b on a.line_id = b.id
|
||||
where a.deleted = 0
|
||||
<if test="request.partnerKeyword != null and request.partnerKeyword != ''">
|
||||
and (b.username like concat('%', #{request.partnerKeyword}, '%') or b.mobile like concat('%',
|
||||
#{request.partnerKeyword}, '%'))
|
||||
</if>
|
||||
<if test="request.shopKeyword!=null and request.shopKeyword!=''">
|
||||
and (a.shop_name like concat('%',#{request.shopKeyword}, '%') or a.shop_code like concat('%',
|
||||
#{request.shopKeyword}, '%') )
|
||||
</if>
|
||||
<if test="request.regionIds != null and request.regionIds.size() > 0">
|
||||
and a.region_id in
|
||||
<foreach collection="request.regionIds" item="regionId" index="index" open="(" separator="," close=")">
|
||||
#{regionId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="request.authRegionIds != null and request.authRegionIds.size() > 0">
|
||||
and a.region_id in
|
||||
<foreach collection="request.authRegionIds" item="regionId" index="index" open="(" separator="," close=")">
|
||||
#{regionId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="request.investmentManagerUserId != null and request.investmentManagerUserId != ''">
|
||||
and a.investment_manager = #{request.investmentManagerUserId}
|
||||
</if>
|
||||
<if test="request.openTimeStart != null ">
|
||||
and DATE_ADD(a.create_time, INTERVAL 50 DAY) >= #{request.openTimeStart}
|
||||
</if>
|
||||
<if test="request.openTimeEnd != null ">
|
||||
<![CDATA[and DATE_ADD(a.create_time, INTERVAL 50 DAY) <= #{request.openTimeEnd}]]>
|
||||
</if>
|
||||
<if test="request.joinMode!=null">
|
||||
and a.join_mode = #{request.joinMode}
|
||||
</if>
|
||||
<if test="request.franchiseBrand!=null">
|
||||
and a.franchise_brand = #{request.franchiseBrand}
|
||||
</if>
|
||||
<if test="request.shopStatus!=null">
|
||||
and a.shop_status = #{request.shopStatus}
|
||||
</if>
|
||||
order by a.update_time desc
|
||||
</select>
|
||||
<select id="getShopListByRegion" resultType="com.cool.store.entity.ShopInfoDO">
|
||||
select
|
||||
<include refid="allColumn"/>
|
||||
from xfsg_shop_info where line_id = #{lineId} and deleted= '0'
|
||||
<if test="list!=null and list.size>0">
|
||||
and region_id in
|
||||
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -187,7 +187,8 @@
|
||||
max(plan_complete_time) as planCompleteTime,
|
||||
count(1) as totalColumn,
|
||||
sum(if(is_terminated = 1, 1, 0)) as completionColumn
|
||||
from xfsg_shop_stage_info where shop_stage = 2
|
||||
from xfsg_shop_stage_info where shop_stage = 2
|
||||
and shop_sub_stage != 85
|
||||
<if test="shopIds != null and shopIds.size() > 0">
|
||||
and shop_id in
|
||||
<foreach collection="shopIds" item="shopId" index="index" open="(" separator="," close=")">
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
package com.cool.store.vo.shop;
|
||||
|
||||
import com.cool.store.dto.Preparation.ScheduleDTO;
|
||||
import com.cool.store.entity.EnterpriseUserDO;
|
||||
import com.cool.store.entity.ShopInfoDO;
|
||||
import com.cool.store.entity.ShopStageInfoDO;
|
||||
import com.cool.store.enums.FranchiseBrandEnum;
|
||||
import com.cool.store.enums.JoinModeEnum;
|
||||
import com.cool.store.enums.point.ShopSubStageStatusEnum;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
@@ -36,8 +40,28 @@ public class MiniShopPageVO {
|
||||
private Long regionId;
|
||||
@ApiModelProperty("门店所属区域name")
|
||||
private String regionName;
|
||||
@ApiModelProperty("督导name")
|
||||
private String investmentName;
|
||||
@ApiModelProperty("督导userId")
|
||||
private String investmentUserId;
|
||||
|
||||
public MiniShopPageVO(Long shopId, String shopName,String shopCode,Boolean flag,Long pointId,Long regionId,String regionName) {
|
||||
@ApiModelProperty("预估完成时间")
|
||||
private Date planCompletionTime;
|
||||
|
||||
@ApiModelProperty("总项数")
|
||||
private Integer totalColumn;
|
||||
|
||||
@ApiModelProperty("完成项")
|
||||
private Integer completionColumn;
|
||||
|
||||
@ApiModelProperty("所属品牌")
|
||||
private String franchiseBrand;
|
||||
@ApiModelProperty("加盟模式")
|
||||
private String joinMode;
|
||||
@ApiModelProperty("意向开店区域")
|
||||
private String wantRegionName;
|
||||
|
||||
public MiniShopPageVO(Long shopId, String shopName, String shopCode, Boolean flag, Long pointId, Long regionId, String regionName) {
|
||||
this.shopId = shopId;
|
||||
this.shopName = shopName;
|
||||
this.shopCode = shopCode;
|
||||
@@ -47,7 +71,7 @@ public class MiniShopPageVO {
|
||||
this.regionName = regionName;
|
||||
}
|
||||
|
||||
public static List<MiniShopPageVO> convertList(List<ShopInfoDO> shopInfoList, Map<Long, ShopStageInfoDO> stageMap, Map<Long, String> regionNameMap ) {
|
||||
public static List<MiniShopPageVO> convertList(List<ShopInfoDO> shopInfoList, Map<Long, ShopStageInfoDO> stageMap, Map<Long, String> regionNameMap, Map<Long, ScheduleDTO> scheduleMap, Map<Long, String> wantRegionMap, Map<String, EnterpriseUserDO> userInfoMap) {
|
||||
List<MiniShopPageVO> resultList = new ArrayList<>();
|
||||
for (ShopInfoDO shopInfo : shopInfoList) {
|
||||
ShopStageInfoDO stageInfoDO = stageMap.get(shopInfo.getId());
|
||||
@@ -57,10 +81,26 @@ public class MiniShopPageVO {
|
||||
flag = Boolean.TRUE;
|
||||
}
|
||||
}
|
||||
if(Objects.isNull(regionNameMap)){
|
||||
if (Objects.isNull(regionNameMap)) {
|
||||
regionNameMap = new HashMap<>();
|
||||
}
|
||||
resultList.add(new MiniShopPageVO(shopInfo.getId(), shopInfo.getShopName(),shopInfo.getShopCode(),flag,shopInfo.getPointId(),shopInfo.getRegionId(), regionNameMap.getOrDefault(shopInfo.getRegionId(),"")));
|
||||
MiniShopPageVO miniShopPageVO = new MiniShopPageVO(shopInfo.getId(), shopInfo.getShopName(), shopInfo.getShopCode(), flag, shopInfo.getPointId(), shopInfo.getRegionId(), regionNameMap.getOrDefault(shopInfo.getRegionId(), ""));
|
||||
miniShopPageVO.setInvestmentUserId(shopInfo.getInvestmentManager());
|
||||
if (userInfoMap!=null){
|
||||
miniShopPageVO.setInvestmentName(userInfoMap.getOrDefault(shopInfo.getInvestmentManager(),new EnterpriseUserDO()).getName());
|
||||
}
|
||||
if (scheduleMap != null) {
|
||||
miniShopPageVO.setTotalColumn(scheduleMap.getOrDefault(shopInfo.getId(),new ScheduleDTO()).getTotalColumn());
|
||||
miniShopPageVO.setCompletionColumn(scheduleMap.getOrDefault(shopInfo.getId(),new ScheduleDTO()).getCompletionColumn());
|
||||
miniShopPageVO.setPlanCompletionTime(scheduleMap.getOrDefault(shopInfo.getId(),new ScheduleDTO()).getPlanCompleteTime());
|
||||
}
|
||||
miniShopPageVO.setFranchiseBrand(FranchiseBrandEnum.getDescByCode(shopInfo.getFranchiseBrand()));
|
||||
miniShopPageVO.setJoinMode(JoinModeEnum.getByCode(shopInfo.getJoinMode()));
|
||||
if (Objects.nonNull(wantRegionMap)) {
|
||||
miniShopPageVO.setWantRegionName(wantRegionMap.get(shopInfo.getWantShopAreaId()));
|
||||
}
|
||||
resultList.add(miniShopPageVO);
|
||||
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ public interface ShopService {
|
||||
* @param lineId
|
||||
* @return
|
||||
*/
|
||||
List<MiniShopPageVO> getShopList(Long lineId);
|
||||
List<MiniShopPageVO> getShopList(Long lineId,String userId);
|
||||
|
||||
/**
|
||||
* 获取店铺阶段信息
|
||||
@@ -70,13 +70,25 @@ public interface ShopService {
|
||||
|
||||
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);
|
||||
/**
|
||||
* 分店列表
|
||||
*/
|
||||
PageInfo<BranchShopResponse> getBranchShopList(BranchShopRequest request, String userId);
|
||||
}
|
||||
|
||||
@@ -115,14 +115,26 @@ public class ShopServiceImpl implements ShopService {
|
||||
}
|
||||
|
||||
@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);
|
||||
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
|
||||
@@ -204,7 +216,7 @@ public class ShopServiceImpl implements ShopService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer updateShopCode(UpdateShopCodeRequest request,String userId) {
|
||||
public Integer updateShopCode(UpdateShopCodeRequest request, String userId) {
|
||||
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(request.getShopId());
|
||||
if (Objects.isNull(shopInfo)) {
|
||||
throw new ServiceException(ErrorCodeEnum.POINT_NOT_EXIST);
|
||||
@@ -298,7 +310,7 @@ public class ShopServiceImpl implements ShopService {
|
||||
public PageInfo<BranchShopResponse> getBranchShopList(BranchShopRequest request, String userId) {
|
||||
if (!sysRoleService.checkIsAdmin(userId)) {
|
||||
request.setAuthRegionIds(userAuthMappingService.getAuthRegionIdAndSubRegionIdByUserId(userId));
|
||||
if (CollectionUtils.isEmpty(request.getAuthRegionIds())){
|
||||
if (CollectionUtils.isEmpty(request.getAuthRegionIds())) {
|
||||
return new PageInfo<>();
|
||||
}
|
||||
}
|
||||
@@ -334,15 +346,15 @@ public class ShopServiceImpl implements ShopService {
|
||||
response.setMobile(dto.getMobile());
|
||||
response.setShopName(dto.getShopName());
|
||||
response.setShopCode(dto.getShopCode());
|
||||
response.setRegionName(regionNameMap.getOrDefault(dto.getRegionId(),""));
|
||||
response.setRegionName(regionNameMap.getOrDefault(dto.getRegionId(), ""));
|
||||
response.setFranchiseBrand(FranchiseBrandEnum.getDescByCode(dto.getFranchiseBrand()));
|
||||
response.setJoinMode(JoinModeEnum.getByCode(dto.getJoinMode()));
|
||||
response.setWantRegionName(wantRegionMap.getOrDefault(dto.getWantShopAreaId(),""));
|
||||
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.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());
|
||||
|
||||
@@ -40,7 +40,7 @@ public class PCShopController {
|
||||
@ApiOperation("获取店铺列表")
|
||||
@GetMapping("/getShopList")
|
||||
public ResponseResult<List<MiniShopPageVO>> getShopList(@RequestParam("lineId")Long lineId) {
|
||||
return ResponseResult.success(shopService.getShopList(lineId));
|
||||
return ResponseResult.success(shopService.getShopList(lineId,CurrentUserHolder.getUserId()));
|
||||
}
|
||||
|
||||
@ApiOperation("获取各个阶段店铺数量")
|
||||
|
||||
@@ -40,7 +40,7 @@ public class MiniShopController {
|
||||
@GetMapping("/getShopList")
|
||||
public ResponseResult<List<MiniShopPageVO>> getShopList() {
|
||||
Long lineId = PartnerUserHolder.getUser().getLineId();
|
||||
return ResponseResult.success(shopService.getShopList(lineId));
|
||||
return ResponseResult.success(shopService.getShopList(lineId,null));
|
||||
}
|
||||
|
||||
@ApiOperation("获取店铺的阶段信息")
|
||||
|
||||
Reference in New Issue
Block a user