fix 开店管理根据意向区域查询
This commit is contained in:
@@ -174,4 +174,11 @@ public class HyOpenAreaInfoDAO {
|
||||
List<HyOpenAreaInfoDO> openAreaInfoList = selectByIds(wantShopAreaIds);
|
||||
return openAreaInfoList.stream().collect(Collectors.toMap(k->k.getId(), v->v, (k1, k2)->k1));
|
||||
}
|
||||
|
||||
public List<Long> getChildrenListByParentIds(List<Long> parentIds) {
|
||||
if (CollectionUtils.isEmpty(parentIds)) {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
return hyOpenAreaInfoMapper.getChildrenListByParentIds(parentIds);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,6 +61,8 @@ public interface HyOpenAreaInfoMapper {
|
||||
*/
|
||||
List<HyOpenAreaInfoDO> getChildrenList(@Param("parentId") Long parentId);
|
||||
|
||||
List<Long> getChildrenListByParentIds(@Param("parentIds") List<Long> parentIds);
|
||||
|
||||
Integer getChildrenCount(@Param("type") String type ,
|
||||
@Param("parentId") Long parentId);
|
||||
|
||||
|
||||
@@ -2,28 +2,29 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.cool.store.mapper.HyOpenAreaInfoMapper">
|
||||
<resultMap id="BaseResultMap" type="com.cool.store.entity.HyOpenAreaInfoDO">
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="parent_id" jdbcType="BIGINT" property="parentId" />
|
||||
<result column="area_name" jdbcType="VARCHAR" property="areaName" />
|
||||
<result column="area_path" jdbcType="VARCHAR" property="areaPath" />
|
||||
<result column="background_banner" jdbcType="VARCHAR" property="backgroundBanner" />
|
||||
<result column="detail_banner" jdbcType="VARCHAR" property="detailBanner" />
|
||||
<result column="area_status" jdbcType="VARCHAR" property="areaStatus" />
|
||||
<result column="deleted" jdbcType="TINYINT" property="deleted" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
<result column="update_user_id" jdbcType="VARCHAR" property="updateUserId" />
|
||||
<id column="id" jdbcType="BIGINT" property="id"/>
|
||||
<result column="parent_id" jdbcType="BIGINT" property="parentId"/>
|
||||
<result column="area_name" jdbcType="VARCHAR" property="areaName"/>
|
||||
<result column="area_path" jdbcType="VARCHAR" property="areaPath"/>
|
||||
<result column="background_banner" jdbcType="VARCHAR" property="backgroundBanner"/>
|
||||
<result column="detail_banner" jdbcType="VARCHAR" property="detailBanner"/>
|
||||
<result column="area_status" jdbcType="VARCHAR" property="areaStatus"/>
|
||||
<result column="deleted" jdbcType="TINYINT" property="deleted"/>
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
|
||||
<result column="update_user_id" jdbcType="VARCHAR" property="updateUserId"/>
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, parent_id, area_name, area_path, background_banner, detail_banner, area_status,
|
||||
deleted, create_time, update_time, update_user_id
|
||||
</sql>
|
||||
<select id="selectById" resultMap="BaseResultMap">
|
||||
<select id="selectById" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List"></include>
|
||||
from xfsg_open_area_info where id = #{id}
|
||||
</select>
|
||||
<insert id="insertSelective" parameterType="com.cool.store.entity.HyOpenAreaInfoDO" keyProperty="record.id" useGeneratedKeys="true">
|
||||
<insert id="insertSelective" parameterType="com.cool.store.entity.HyOpenAreaInfoDO" keyProperty="record.id"
|
||||
useGeneratedKeys="true">
|
||||
insert into xfsg_open_area_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="record.id != null">
|
||||
@@ -137,7 +138,6 @@
|
||||
</update>
|
||||
|
||||
|
||||
|
||||
<update id="batchUpdateById">
|
||||
update xfsg_open_area_info
|
||||
<set>
|
||||
@@ -164,7 +164,6 @@
|
||||
</update>
|
||||
|
||||
|
||||
|
||||
<update id="batchUpdateByParentId">
|
||||
update xfsg_open_area_info
|
||||
<set>
|
||||
@@ -207,7 +206,7 @@
|
||||
xfsg_open_area_info
|
||||
<where>
|
||||
<if test="keyword!=null and keyword!=''">
|
||||
and area_path like concat('%',#{keyword},'%')
|
||||
and area_path like concat('%',#{keyword},'%')
|
||||
</if>
|
||||
<if test="applyFlag!=null and applyFlag==true">
|
||||
and (area_status = 'open' or area_status = 'keyOpen')
|
||||
@@ -239,7 +238,6 @@
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<select id="getChildrenList" resultMap="BaseResultMap">
|
||||
select * from
|
||||
xfsg_open_area_info
|
||||
@@ -280,7 +278,9 @@
|
||||
</select>
|
||||
|
||||
<select id="getAllOpenArea" resultMap="BaseResultMap">
|
||||
select <include refid="Base_Column_List"/> from xfsg_open_area_info
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from xfsg_open_area_info
|
||||
</select>
|
||||
|
||||
<select id="filterLeafNode" resultType="long">
|
||||
@@ -289,7 +289,8 @@
|
||||
from
|
||||
xfsg_open_area_info
|
||||
where
|
||||
deleted = '0' and province_city_flag = '0' and id in <foreach collection="openAreaIds" item="openAreaId" separator="," open="(" close=")">#{openAreaId}</foreach>
|
||||
deleted = '0' and province_city_flag = '0' and id in
|
||||
<foreach collection="openAreaIds" item="openAreaId" separator="," open="(" close=")">#{openAreaId}</foreach>
|
||||
</select>
|
||||
<select id="getSonArea" resultType="com.cool.store.entity.HyOpenAreaInfoDO">
|
||||
SELECT
|
||||
@@ -297,15 +298,15 @@
|
||||
FROM xfsg_open_area_info
|
||||
WHERE parent_id = #{id}
|
||||
</select>
|
||||
<select id="getProvinceAllCode" resultMap="BaseResultMap">
|
||||
SELECT b.* FROM `xfsg_open_area_info` a inner join xfsg_open_area_info b on a.`id`=b.`parent_id`
|
||||
WHERE a.parent_id=#{id} ORDER BY b.id desc
|
||||
<select id="getProvinceAllCode" resultMap="BaseResultMap">
|
||||
SELECT b.* FROM `xfsg_open_area_info` a inner join xfsg_open_area_info b on a.`id`=b.`parent_id`
|
||||
WHERE a.parent_id=#{id} ORDER BY b.id desc
|
||||
</select>
|
||||
<select id="selectByAreaPath" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List"></include>
|
||||
FROM `xfsg_open_area_info`
|
||||
WHERE area_path= concat('/',#{areaPath},'/') and deleted=0 and province_city_flag=0
|
||||
WHERE area_path= concat('/',#{areaPath},'/') and deleted=0 and province_city_flag=0
|
||||
</select>
|
||||
|
||||
<select id="selectAllCity" resultMap="BaseResultMap">
|
||||
@@ -314,7 +315,15 @@
|
||||
FROM `xfsg_open_area_info`
|
||||
WHERE deleted=0 and province_city_flag = 1 and parent_id is not null
|
||||
</select>
|
||||
<select id="getChildrenListByParentIds" resultType="java.lang.Long">
|
||||
select id from xfsg_open_area_info where 1=1
|
||||
<if test="parentIds!=null and parentIds.size>0">
|
||||
parent_id in
|
||||
<foreach collection="parentIds" item="parentId" separator="," open="(" close=")">
|
||||
#{parentId}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -318,6 +318,13 @@
|
||||
<if test="request.shopStatus!=null">
|
||||
and a.shop_status = #{request.shopStatus}
|
||||
</if>
|
||||
<if test="request.wantShopAreaAllIds != null and request.wantShopAreaAllIds.size() > 0">
|
||||
and a.want_shop_area_id in
|
||||
<foreach collection="request.wantShopAreaAllIds" item="wantShopAreaId" index="index" open="(" separator=","
|
||||
close=")">
|
||||
#{wantShopAreaId}
|
||||
</foreach>
|
||||
</if>
|
||||
order by a.update_time desc
|
||||
</select>
|
||||
<select id="getShopListByRegion" resultType="com.cool.store.entity.ShopInfoDO">
|
||||
|
||||
@@ -24,7 +24,7 @@ public class BranchShopRequest extends PageBasicInfo{
|
||||
@ApiModelProperty("督导userId")
|
||||
private String investmentManagerUserId;
|
||||
@ApiModelProperty("意向开店区域")
|
||||
private Long wantShopAreaId;
|
||||
private List<Long> wantShopAreaId;
|
||||
@ApiModelProperty("加盟模式")
|
||||
private Integer joinMode;
|
||||
@ApiModelProperty("加盟品牌")
|
||||
@@ -37,5 +37,7 @@ public class BranchShopRequest extends PageBasicInfo{
|
||||
private Date openTimeEnd;
|
||||
@ApiModelProperty(value = "管辖区域",hidden = true)
|
||||
private List<String> authRegionIds;
|
||||
@ApiModelProperty(value="意向开店区域+子节点",hidden = true)
|
||||
private List<Long> wantShopAreaAllIds;
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import lombok.Data;
|
||||
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: WangShuo
|
||||
@@ -27,9 +28,9 @@ public class BranchShopResponse {
|
||||
@ApiModelProperty("所属大区")
|
||||
private String regionName;
|
||||
@ApiModelProperty("所属品牌")
|
||||
private String franchiseBrand;
|
||||
private List<Integer> franchiseBrand;
|
||||
@ApiModelProperty("加盟模式")
|
||||
private String joinMode;
|
||||
private Integer joinMode;
|
||||
@ApiModelProperty("意向开店区域")
|
||||
private String wantRegionName;
|
||||
@ApiModelProperty("计划开业时间")
|
||||
|
||||
@@ -183,8 +183,8 @@ public class ExportRealizeServiceImpl implements ExportRealizeService {
|
||||
dto.setShopName(response.getShopName());
|
||||
dto.setShopCode(response.getShopCode());
|
||||
dto.setRegionName(response.getRegionName());
|
||||
dto.setJoinMode(response.getJoinMode());
|
||||
dto.setFranchiseBrand(response.getFranchiseBrand());
|
||||
dto.setJoinMode(JoinModeEnum.getByCode(response.getJoinMode()));
|
||||
dto.setFranchiseBrand(FranchiseBrandEnum.getDescByCode(response.getFranchiseBrand().stream().map(Object::toString).collect(Collectors.joining(","))));
|
||||
dto.setInvestmentManager(response.getInvestmentManagerName());
|
||||
SignFranchiseDO signFranchiseDO = signFranchiseMap.get(response.getShopId());
|
||||
if (signFranchiseDO != null) {
|
||||
|
||||
@@ -358,6 +358,11 @@ public class ShopServiceImpl implements ShopService {
|
||||
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);
|
||||
@@ -384,8 +389,10 @@ public class ShopServiceImpl implements ShopService {
|
||||
response.setShopName(dto.getShopName());
|
||||
response.setShopCode(dto.getShopCode());
|
||||
response.setRegionName(regionNameMap.getOrDefault(dto.getRegionId(), ""));
|
||||
response.setFranchiseBrand(FranchiseBrandEnum.getDescByCode(dto.getFranchiseBrand()));
|
||||
response.setJoinMode(JoinModeEnum.getByCode(dto.getJoinMode()));
|
||||
response.setFranchiseBrand(Arrays.stream(dto.getFranchiseBrand().split(","))
|
||||
.map(Integer::parseInt)
|
||||
.collect(Collectors.toList()));
|
||||
response.setJoinMode(dto.getJoinMode());
|
||||
response.setWantRegionName(wantRegionMap.getOrDefault(dto.getWantShopAreaId(), ""));
|
||||
response.setPlanOpenTime(dto.getPlanOpenTime());
|
||||
ScheduleDTO scheduleDTO = scheduleMap.getOrDefault(dto.getId(), new ScheduleDTO());
|
||||
|
||||
Reference in New Issue
Block a user