成功开店代码改造
This commit is contained in:
@@ -2,6 +2,7 @@ package com.cool.store.dao;
|
|||||||
|
|
||||||
import com.cool.store.entity.StoreDO;
|
import com.cool.store.entity.StoreDO;
|
||||||
import com.cool.store.mapper.StoreMapper;
|
import com.cool.store.mapper.StoreMapper;
|
||||||
|
import com.cool.store.response.MiniShopsResponse;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@@ -63,11 +64,11 @@ public class StoreDao {
|
|||||||
return storeMapper.listByMobile(mobile);
|
return storeMapper.listByMobile(mobile);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<StoreDO> getSubStoreByRegionIds(List<String> regionIdList) {
|
public List<MiniShopsResponse> getSubStoreByRegionIdsAndMobile(List<String> regionIdList, String mobile) {
|
||||||
if(CollectionUtils.isEmpty(regionIdList)) {
|
if(CollectionUtils.isEmpty(regionIdList)&&StringUtils.isBlank(mobile)) {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
return storeMapper.getSubStoreByRegionIds(regionIdList);
|
return storeMapper.getSubStoreByRegionIdsAndMobile(regionIdList,mobile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,11 @@ public class SysRoleDao {
|
|||||||
if(CollectionUtils.isEmpty(roleIds)) {
|
if(CollectionUtils.isEmpty(roleIds)) {
|
||||||
return Lists.newArrayList();
|
return Lists.newArrayList();
|
||||||
}
|
}
|
||||||
return sysRoleMapper.getRoleByRoleIds( roleIds);
|
List<SysRoleDO> roleByRoleIds = sysRoleMapper.getRoleByRoleIds(roleIds);
|
||||||
|
if(CollectionUtils.isEmpty(roleByRoleIds)) {
|
||||||
|
return Lists.newArrayList();
|
||||||
|
}
|
||||||
|
return roleByRoleIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.cool.store.mapper;
|
package com.cool.store.mapper;
|
||||||
|
|
||||||
import com.cool.store.entity.StoreDO;
|
import com.cool.store.entity.StoreDO;
|
||||||
|
import com.cool.store.response.MiniShopsResponse;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
@@ -31,7 +32,7 @@ public interface StoreMapper {
|
|||||||
*/
|
*/
|
||||||
List<StoreDO> listByMobile(@Param("mobile") String mobile);
|
List<StoreDO> listByMobile(@Param("mobile") String mobile);
|
||||||
|
|
||||||
List<StoreDO> getSubStoreByRegionIds(@Param("regionIdList") List<String> regionIdList);
|
List<MiniShopsResponse> getSubStoreByRegionIdsAndMobile(@Param("regionIdList") List<String> regionIdList, @Param("mobile") String mobile);
|
||||||
/**
|
/**
|
||||||
* 分页查询门店数据
|
* 分页查询门店数据
|
||||||
* @return
|
* @return
|
||||||
|
|||||||
@@ -90,15 +90,27 @@
|
|||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getSubStoreByRegionIds" resultMap="BaseResultMap">
|
<select id="getSubStoreByRegionIdsAndMobile" resultType="com.cool.store.response.MiniShopsResponse">
|
||||||
select *
|
select store_id as storeId, store_name as shopName, store_num as shopCode, store_address as detailAddress,
|
||||||
from store_${enterpriseId}
|
from store_${enterpriseId}
|
||||||
where is_delete = 'effective'
|
where is_delete = 'effective'
|
||||||
|
and (
|
||||||
<if test="regionIdList != null and regionIdList.size >0 ">
|
<if test="regionIdList != null and regionIdList.size >0 ">
|
||||||
<foreach collection="regionIdList" item="regionId" separator=" or " open="and (" close=" )">
|
<foreach collection="regionIdList" item="regionId" separator=" or " open=" (" close=" )">
|
||||||
region_path like concat('%/', #{regionId}, '/%')
|
region_path like concat('%/', #{regionId}, '/%')
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
|
<if test="mobile!=null and mobile !=''">
|
||||||
|
<choose>
|
||||||
|
<when test="regionIdList != null and regionIdList.size >0 ">
|
||||||
|
or `extend_field` like concat('%', #{mobile}, '%')
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
`extend_field` like concat('%', #{mobile}, '%')
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
</if>
|
||||||
|
)
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="list" resultMap="BaseResultMap">
|
<select id="list" resultMap="BaseResultMap">
|
||||||
|
|||||||
@@ -20,4 +20,5 @@ public class MiniShopsResponse {
|
|||||||
private String ylsCode;
|
private String ylsCode;
|
||||||
@ApiModelProperty("店铺详细地址")
|
@ApiModelProperty("店铺详细地址")
|
||||||
private String detailAddress;
|
private String detailAddress;
|
||||||
|
private String storeId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ public interface ShopService {
|
|||||||
|
|
||||||
Boolean dataHandler(Long shopId);
|
Boolean dataHandler(Long shopId);
|
||||||
|
|
||||||
List<MiniShopsResponse> getShopListSuccessOpen(Long lineId);
|
PageInfo<MiniShopsResponse> getShopListSuccessOpen(Long lineId,Integer pageNum,Integer pageSize,String storeName);
|
||||||
|
|
||||||
ShopResponse getShopNameAndCode(Long shopId,Long lineId);
|
ShopResponse getShopNameAndCode(Long shopId,Long lineId);
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,6 @@ public interface StoreService {
|
|||||||
*/
|
*/
|
||||||
PageInfo<StoreDTO> getStoreExtendFieldInfo(Integer pageSize,Integer pageNum);
|
PageInfo<StoreDTO> getStoreExtendFieldInfo(Integer pageSize,Integer pageNum);
|
||||||
|
|
||||||
List<StoreDO> getStoreListByMobile(String mobile);
|
PageInfo<MiniShopsResponse> getStoreListByMobile(String mobile,Integer pageNum,Integer pageSize,String storeName);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -600,26 +600,16 @@ public class ShopServiceImpl implements ShopService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<MiniShopsResponse> getShopListSuccessOpen(Long lineId) {
|
public PageInfo<MiniShopsResponse> getShopListSuccessOpen(Long lineId,Integer pageNum,Integer pageSize,String storeName) {
|
||||||
LineInfoDO lineInfoDO = lineInfoDAO.getLineInfo(lineId);
|
LineInfoDO lineInfoDO = lineInfoDAO.getLineInfo(lineId);
|
||||||
List<StoreDO> storeDOS = storeDao.listByMobile(lineInfoDO.getMobile());
|
PageInfo<MiniShopsResponse> storeListByMobile = storeService.getStoreListByMobile(lineInfoDO.getMobile(),pageNum,pageSize,storeName);
|
||||||
List<StoreDO> storeListByMobile = storeService.getStoreListByMobile(lineInfoDO.getMobile());
|
if (CollectionUtils.isEmpty(storeListByMobile.getList())){
|
||||||
if (CollectionUtils.isEmpty(storeDOS)&&CollectionUtils.isEmpty(storeListByMobile)){
|
return new PageInfo<>();
|
||||||
return new ArrayList<>();
|
|
||||||
}
|
}
|
||||||
storeDOS.addAll(storeListByMobile);
|
for (MiniShopsResponse response : storeListByMobile.getList()){
|
||||||
List<MiniShopsResponse> responses = new ArrayList<>();
|
response.setYlsCode("ZXA8_"+response.getShopCode());
|
||||||
for (StoreDO storeDO : storeDOS){
|
|
||||||
MiniShopsResponse response = new MiniShopsResponse();
|
|
||||||
response.setShopName(storeDO.getStoreName());
|
|
||||||
response.setShopCode(storeDO.getStoreNum());
|
|
||||||
response.setYlsCode("ZXA8_"+storeDO.getStoreNum());
|
|
||||||
response.setDetailAddress(storeDO.getStoreAddress());
|
|
||||||
responses.add(response);
|
|
||||||
}
|
}
|
||||||
//对shopCode 去重
|
return storeListByMobile;
|
||||||
responses = responses.stream().filter(x -> x.getShopCode() != null).distinct().collect(Collectors.toList());
|
|
||||||
return responses;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -27,10 +27,7 @@ import org.apache.commons.collections4.CollectionUtils;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.Arrays;
|
import java.util.*;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -72,31 +69,28 @@ public class StoreServiceImpl implements StoreService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<StoreDO> getStoreListByMobile(String mobile) {
|
public PageInfo<MiniShopsResponse> getStoreListByMobile(String mobile,Integer pageNum,Integer pageSize,String storeName) {
|
||||||
//根据手机号查询 标品userId
|
//根据手机号查询 标品userId
|
||||||
EnterpriseUserDO enterpriseUserDO = enterpriseUserDAO.selectByMobile(mobile);
|
EnterpriseUserDO enterpriseUserDO = enterpriseUserDAO.selectByMobile(mobile);
|
||||||
if (enterpriseUserDO == null){
|
if (enterpriseUserDO == null){
|
||||||
return Collections.emptyList();
|
return new PageInfo<>();
|
||||||
}
|
}
|
||||||
//获取用户职位
|
//获取用户职位
|
||||||
List<Long> userRoleIds = enterpriseUserRoleDao.getUserRoleIds(enterpriseUserDO.getUserId());
|
List<Long> userRoleIds = enterpriseUserRoleDao.getUserRoleIds(enterpriseUserDO.getUserId());
|
||||||
if (CollectionUtils.isEmpty(userRoleIds)){
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
//查询职位详情,筛选掉店外职位
|
//查询职位详情,筛选掉店外职位
|
||||||
List<SysRoleDO> roleIds = sysRoleDao.selectRoleByRoleIds(userRoleIds);
|
List<SysRoleDO> roleIds = sysRoleDao.selectRoleByRoleIds(userRoleIds);
|
||||||
List<SysRoleDO> sysRoleDOS = roleIds.stream().filter(role -> "store_inside".equals(role.getPositionType())).collect(Collectors.toList());
|
List<SysRoleDO> sysRoleDOS = roleIds.stream().filter(role -> "store_inside".equals(role.getPositionType())).collect(Collectors.toList());
|
||||||
if (CollectionUtils.isEmpty(sysRoleDOS)){
|
List<String> regionIds = new ArrayList<>();
|
||||||
return Collections.emptyList();
|
if (CollectionUtils.isNotEmpty(sysRoleDOS)){
|
||||||
}
|
|
||||||
//获取用户管辖门店
|
//获取用户管辖门店
|
||||||
List<UserAuthMappingDO> userAuthMapping = userAuthMappingService.listUserAuthMappingByUserId(enterpriseUserDO.getUserId());
|
List<UserAuthMappingDO> userAuthMapping = userAuthMappingService.listUserAuthMappingByUserId(enterpriseUserDO.getUserId());
|
||||||
if(CollectionUtils.isEmpty(userAuthMapping)){
|
if (CollectionUtils.isNotEmpty(userAuthMapping)){
|
||||||
return Collections.emptyList();
|
regionIds.addAll(userAuthMapping.stream().map(UserAuthMappingDO::getMappingId).collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
List<String> regionIds = userAuthMapping.stream().map(UserAuthMappingDO::getMappingId).collect(Collectors.toList());
|
}
|
||||||
List<StoreDO> list = storeDao.getSubStoreByRegionIds(regionIds);
|
PageHelper.startPage(pageNum,pageSize);
|
||||||
return list;
|
List<MiniShopsResponse> list = storeDao.getSubStoreByRegionIdsAndMobile(regionIds,mobile);
|
||||||
|
return new PageInfo<>(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -117,8 +117,12 @@ public class MiniShopController {
|
|||||||
}
|
}
|
||||||
@ApiOperation("成功开店的门店")
|
@ApiOperation("成功开店的门店")
|
||||||
@GetMapping("/getShopListSuccessOpen")
|
@GetMapping("/getShopListSuccessOpen")
|
||||||
public ResponseResult<List<MiniShopsResponse>> getShopListSuccessOpen(@RequestParam("lineId")Long lineId) {
|
public ResponseResult<PageInfo<MiniShopsResponse>> getShopListSuccessOpen(@RequestParam("lineId")Long lineId,
|
||||||
return ResponseResult.success(shopService.getShopListSuccessOpen(lineId));
|
@RequestParam(value = "pageSize",defaultValue = "10")Integer pageSize,
|
||||||
|
@RequestParam(value = "pageNum",defaultValue = "1")Integer pageNum,
|
||||||
|
@RequestParam(value = "storeName",required = false,defaultValue = "storeName") String storeName
|
||||||
|
) {
|
||||||
|
return ResponseResult.success(shopService.getShopListSuccessOpen(lineId,pageNum,pageSize,storeName));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("获取推荐铺位和我创建的")
|
@ApiOperation("获取推荐铺位和我创建的")
|
||||||
|
|||||||
Reference in New Issue
Block a user