Commit 1568a3b6 by zhiwj

Merge branch 'developer' of http://115.159.76.241/base_platform_enterprise/gic-store into developer

parents 6b683819 7bc4d132
......@@ -65,6 +65,10 @@ public class StoreInfoDTO implements Serializable {
* 纬度
*/
private String latitude;
/**
* 距离
*/
private Double distance;
/**
* 溢出状态;默认为0,1标识溢出
......@@ -87,17 +91,8 @@ public class StoreInfoDTO implements Serializable {
* 门店类型
*/
private Integer storeType;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
private List<StoreBrandDTO> brandList;
private List<StorePhotoDTO> photoList;
private String delPhotos;
......@@ -357,4 +352,12 @@ public class StoreInfoDTO implements Serializable {
public void setIndexId(Long indexId) {
this.indexId = indexId;
}
public Double getDistance() {
return distance;
}
public void setDistance(Double distance) {
this.distance = distance;
}
}
......@@ -16,6 +16,10 @@ public class StoreSearchDBDTO implements Serializable {
private Integer storeId;
private Integer overflowStatus=0;
private Integer enterpriseId;
private Integer storeBrandId;
private String longitude = "0";
private String latitude = "0";
private String cityId;
private List<Integer> storeGroupIdList;
private List<Integer> regionIdList;
private List<Integer> storeIdList;
......@@ -184,4 +188,36 @@ public class StoreSearchDBDTO implements Serializable {
public void setErpStatusList(List<Integer> erpStatusList) {
this.erpStatusList = erpStatusList;
}
public Integer getStoreBrandId() {
return storeBrandId;
}
public void setStoreBrandId(Integer storeBrandId) {
this.storeBrandId = storeBrandId;
}
public String getLongitude() {
return longitude;
}
public void setLongitude(String longitude) {
this.longitude = longitude;
}
public String getLatitude() {
return latitude;
}
public void setLatitude(String latitude) {
this.latitude = latitude;
}
public String getCityId() {
return cityId;
}
public void setCityId(String cityId) {
this.cityId = cityId;
}
}
......@@ -90,4 +90,12 @@ public interface ProvincesApiService {
ServiceResponse<ProvinceDTO> getProvinceById(String provinceId);
ServiceResponse<String> getProvinceNameByAreaId(String aredId);
/** @Description: 热门城市
* @author taogs
* @Date 17:35 2019/12/4
* @Param
* @return
*/
ServiceResponse<List<CityDTO>> listHotCity(Integer enterpriseId, Integer brandId);
}
......@@ -213,4 +213,14 @@ public interface StoreApiService {
ServiceResponse<List<StoreDTO>> listStoreByStoreInfoId(Integer storeInfoId);
ServiceResponse<List<StoreDTO>> listStore(String search, Integer enterpriseId);
/** @Description: 附近门店
* @author taogs
* @Date 19:41 2019/12/4
* @Param
* @return
*/
ServiceResponse<Page<StoreDTO>> pageNearbyStore(Integer enterpriseId, String cityId, String longitude,
String latitude, Integer brandId, Integer pageNum, Integer pageSize);
}
......@@ -72,4 +72,7 @@ public interface TabStoreMapper {
@Param("toEnterpriseId") Integer toEnterpriseId);
List<Integer> listStoreInfoIdByStoreIds(@Param("ids") List<Integer> ids, @Param("enterpriseId") Integer enterpriseId);
List<String> listAllCityId(@Param("enterpriseId") Integer enterpriseId,
@Param("storeBrandId") Integer storeBrandId);
}
\ No newline at end of file
......@@ -100,4 +100,13 @@ public interface StoreService {
Integer getStoreIdByStoreInfoId(Integer enterpriseId, Integer storeInfoId);
String listStoreInfoIdByStoreIds(String storeIds, Integer enterpriseId);
/** @Description: 查询企业下所有城市id,门店数量从多到少排序
* @author taogs
* @Date 17:39 2019/12/4
* @Param
* @return
*/
List<String> listAllCityId(Integer enterpriseId, Integer storeBrandId);
}
......@@ -450,4 +450,9 @@ public class StoreServiceImpl implements StoreService {
return Optional.ofNullable(ids).orElse(Collections.emptyList()).stream().map(String::valueOf).reduce((x,y)-> x + GlobalInfo.FLAG_COMMA + y).orElse("");
}
@Override
public List<String> listAllCityId(Integer enterpriseId, Integer storeBrandId) {
return this.tabStoreMapper.listAllCityId(enterpriseId, storeBrandId);
}
}
......@@ -12,6 +12,7 @@ import com.gic.store.entity.TabCounty;
import com.gic.store.entity.TabProvince;
import com.gic.store.service.ProvincesApiService;
import com.gic.store.service.ProvincesService;
import com.gic.store.service.StoreService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -28,6 +29,8 @@ import java.util.stream.Collectors;
public class ProvincesApiServiceImpl implements ProvincesApiService {
@Autowired
private ProvincesService provincesService;
@Autowired
private StoreService storeService;
@Override
public ServiceResponse<List<ProvinceDTO>> selectAllProvince() {
......@@ -156,4 +159,19 @@ public class ProvincesApiServiceImpl implements ProvincesApiService {
}
return ServiceResponse.success(stringBuilder.toString());
}
@Override
public ServiceResponse<List<CityDTO>> listHotCity(Integer enterpriseId, Integer brandId) {
List<String> list = this.storeService.listAllCityId(enterpriseId, brandId);
ServiceResponse<List<CityDTO>> response = this.selectAllCity();
List<CityDTO> hotCityList = new ArrayList<>();
if(response.isSuccess()){
for(CityDTO dto : response.getResult()){
if(list.contains(dto.getCityId())){
hotCityList.add(dto);
}
}
}
return ServiceResponse.success(hotCityList);
}
}
......@@ -490,6 +490,20 @@ public class StoreApiServiceImpl implements StoreApiService {
}
@Override
public ServiceResponse<Page<StoreDTO>> pageNearbyStore(Integer enterpriseId, String cityId, String longitude,
String latitude, Integer brandId, Integer pageNum, Integer pageSize) {
StoreSearchDBDTO searchDBDTO = new StoreSearchDBDTO();
searchDBDTO.setEnterpriseId(enterpriseId);
searchDBDTO.setStoreBrandId(brandId);
searchDBDTO.setLongitude(longitude);
searchDBDTO.setLatitude(latitude);
searchDBDTO.setCityId(cityId);
com.github.pagehelper.Page<StoreDTO> page = this.storeService.listStore(searchDBDTO, pageNum, pageSize);
Page<StoreDTO> storeDTOPage = PageHelperUtils.changePageHelperToCurrentPage(page);
return ServiceResponse.success(storeDTOPage);
}
@Override
public ServiceResponse<StoreDTO> getStoreById(Integer enterpriseId, Integer storeId) {
String key = Constants.STORE_KEY + enterpriseId + ":" + storeId;
......
......@@ -32,6 +32,7 @@
<result column="store_group_id" jdbcType="INTEGER" property="storeGroupId" />
<result column="is_edit_store_group" jdbcType="INTEGER" property="isEditStoreGroup" />
<result column="from_enterprise_id" jdbcType="INTEGER" property="fromEnterpriseId" />
<result column="distance" jdbcType="DOUBLE" property="distance" />
</resultMap>
<sql id="Base_Column_List">
${alias}.store_info_id, ${alias}.store_name, ${alias}.store_code, ${alias}.region_id, ${alias}.conacts_phone, ${alias}.address,
......@@ -340,7 +341,8 @@
</include>,
<include refid="Base_Column_List2" >
<property name="alias" value="t2"/>
</include>
</include>,
((6378.137 * acos(cos(radians(#{store.latitude})) * cos(radians(latitude)) * cos(radians(longitude) - radians(#{store.longitude})) + sin(radians(#{store.latitude})) * sin(radians(latitude))))*1000) AS distance
from tab_store_info t1,tab_store t2 where t1.store_info_id = t2.store_info_id
<if test="store.search != null and store.search !=''">
and (t1.store_name like concat('%', #{store.search}, '%') or t1.store_code like concat('%', #{store.search}, '%'))
......@@ -378,6 +380,12 @@
<if test="store.enterpriseId != null">
and t2.enterprise_id = #{store.enterpriseId}
</if>
<if test="store.cityId != null and store.cityId != ''">
and t2.city_id= #{store.cityId}
</if>
<if test="store.storeBrandId != null">
and brand_ids like concat('%,', #{store.storeBrandId}, ',%')
</if>
<if test="store.storeGroupIdList != null and store.storeGroupIdList.size()>0">
and t2.store_group_id in
<foreach collection="store.storeGroupIdList" index="index" item="id" open="(" separator="," close=")">
......@@ -414,6 +422,7 @@
#{id}
</foreach>
</if>
order by distance asc
</select>
<update id="updateAllStoreStatus">
......
......@@ -196,4 +196,16 @@
</foreach>
</if>
</select>
<select id="listAllCityId" resultType="java.lang.String">
select city_id
from tab_store t1,tab_store_info t2
where t1.enterprise_id= #{enterpriseId}
and t1.store_info_id = t2.store_info_id
and t2.overflow_status = 0
<if test="storeBrandId != null and storeBrandId != 0">
and t2.brand_ids = #{storeBrandId}
</if>
group by city_id
ORDER BY count(1) desc
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment