Commit 4e436d02 by zhiwj

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

parents d6df0a47 09d292bb
package com.gic.store.dto;
import java.util.HashSet;
import java.util.Set;
public class StoreColumnSet {
private Set<Integer> storeType = new HashSet<>();
private Set<Integer> status = new HashSet<>();
private Set<Integer> ErpStatus = new HashSet<>();
private Set<Integer> storeGroupId = new HashSet<>();
private Set<Integer> region = new HashSet<>();
public Set<Integer> getStoreType() {
return storeType;
}
public void setStoreType(Set<Integer> storeType) {
this.storeType = storeType;
}
public Set<Integer> getStatus() {
return status;
}
public void setStatus(Set<Integer> status) {
this.status = status;
}
public Set<Integer> getErpStatus() {
return ErpStatus;
}
public void setErpStatus(Set<Integer> erpStatus) {
ErpStatus = erpStatus;
}
public Set<Integer> getStoreGroupId() {
return storeGroupId;
}
public void setStoreGroupId(Set<Integer> storeGroupId) {
this.storeGroupId = storeGroupId;
}
public Set<Integer> getRegion() {
return region;
}
public void setRegion(Set<Integer> region) {
this.region = region;
}
}
......@@ -2,6 +2,7 @@ package com.gic.store.service;
import java.util.List;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.store.dto.StoreGroupDTO;
......@@ -156,4 +157,22 @@ public interface StoreGroupApiService {
* @return
*/
ServiceResponse<List<StoreGroupDTO>> listStoreGroupByIds(List<Integer> storeGroupIdList, Integer enterpriseId);
/** @Description: 通过分组id查询分组
* @author taogs
* @Date 18:44 2019/8/12
* @Param
* @return
*/
ServiceResponse<List<StoreGroupDTO>> listStoreGroupByIds(List<Integer> storeGroupIdList, Integer enterpriseId, Integer level);
/** @Description: 分页查询分组
* @author taogs
* @Date 10:31 2020/7/15
* @Param
* @return
*/
ServiceResponse<Page<StoreGroupDTO>> pageStoreGroupByIds(List<Integer> storeGroupIdList, Integer enterpriseId,
Integer parentId, Integer pageSize, Integer pageNum);
}
......@@ -3,6 +3,7 @@ package com.gic.store.service;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.store.dto.StoreBrandDTO;
import com.gic.store.dto.StoreColumnSet;
import com.gic.store.dto.StoreDTO;
import com.gic.store.dto.StoreWidgetDTO;
......@@ -86,4 +87,7 @@ public interface StoreWidgetApiService {
* @return result true表示存在
*/
ServiceResponse existByStoreInfoId(Integer enterpriseId, Integer storeWidgetId, Integer storeInfoId);
ServiceResponse<StoreColumnSet> getStoreColumnSet(Integer enterpriseId, Integer storeWidgetId);
}
package com.gic.store.dao.mapper;
import com.gic.store.entity.TabStoreGroup;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -127,5 +128,11 @@ public interface TabStoreGroupMapper {
*/
TabStoreGroup selectUnGroupedStore(@Param("enterpriseId") Integer enterpriseId);
List<TabStoreGroup> listStoreGroupByIds(@Param("storeGroupIdList") List<Integer> storeGroupIdList, @Param("enterpriseId") Integer enterpriseId);
List<TabStoreGroup> listStoreGroupByIds(@Param("storeGroupIdList") List<Integer> storeGroupIdList,
@Param("enterpriseId") Integer enterpriseId,
@Param("level") Integer level);
Page<TabStoreGroup> pageStoreGroupByIds(@Param("storeGroupIdList") List<Integer> storeGroupIdList,
@Param("enterpriseId") Integer enterpriseId,
@Param("parentId") Integer parentId);
}
\ No newline at end of file
......@@ -4,6 +4,7 @@ import java.util.List;
import com.gic.store.dto.StoreGroupDTO;
import com.gic.store.entity.TabStoreGroup;
import com.github.pagehelper.Page;
/**
* 门店分组
......@@ -193,5 +194,7 @@ public interface StoreGroupService {

 */
TabStoreGroup selectAllStoreGroup(Integer enterpriseId);
List<TabStoreGroup> listStoreGroupByIds(List<Integer> storeGroupIdList, Integer enterpriseId);
List<TabStoreGroup> listStoreGroupByIds(List<Integer> storeGroupIdList, Integer enterpriseId, Integer level);
Page<TabStoreGroup> pageStoreGroupByIds(List<Integer> storeGroupIdList, Integer enterpriseId, Integer parentId);
}
......@@ -6,6 +6,7 @@ import com.gic.store.dao.mapper.TabStoreGroupMapper;
import com.gic.store.dto.StoreGroupDTO;
import com.gic.store.entity.TabStoreGroup;
import com.gic.store.service.StoreGroupService;
import com.github.pagehelper.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -159,8 +160,13 @@ public class StoreGroupServiceImpl implements StoreGroupService{
}
@Override
public List<TabStoreGroup> listStoreGroupByIds(List<Integer> storeGroupIdList, Integer enterpriseId) {
return this.tabStoreGroupMapper.listStoreGroupByIds(storeGroupIdList, enterpriseId);
public List<TabStoreGroup> listStoreGroupByIds(List<Integer> storeGroupIdList, Integer enterpriseId, Integer level) {
return this.tabStoreGroupMapper.listStoreGroupByIds(storeGroupIdList, enterpriseId, level);
}
@Override
public Page<TabStoreGroup> pageStoreGroupByIds(List<Integer> storeGroupIdList, Integer enterpriseId, Integer parentId){
return this.tabStoreGroupMapper.pageStoreGroupByIds(storeGroupIdList, enterpriseId, parentId);
}
}
......@@ -7,7 +7,10 @@ import java.util.Stack;
import java.util.concurrent.TimeUnit;
import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.Page;
import com.gic.commons.util.PageHelperUtils;
import com.gic.store.service.StoreApiService;
import com.github.pagehelper.PageHelper;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -351,10 +354,25 @@ public class StoreGroupApiServiceImpl implements StoreGroupApiService {
@Override
public ServiceResponse<List<StoreGroupDTO>> listStoreGroupByIds(List<Integer> storeGroupIdList, Integer enterpriseId) {
List<TabStoreGroup> list = this.storeGroupService.listStoreGroupByIds(storeGroupIdList, enterpriseId);
List<TabStoreGroup> list = this.storeGroupService.listStoreGroupByIds(storeGroupIdList, enterpriseId, null);
return ServiceResponse.success(EntityUtil.changeEntityListByJSON(StoreGroupDTO.class, list));
}
@Override
public ServiceResponse<List<StoreGroupDTO>> listStoreGroupByIds(List<Integer> storeGroupIdList, Integer enterpriseId, Integer level) {
List<TabStoreGroup> list = this.storeGroupService.listStoreGroupByIds(storeGroupIdList, enterpriseId, level);
return ServiceResponse.success(EntityUtil.changeEntityListByJSON(StoreGroupDTO.class, list));
}
@Override
public ServiceResponse<Page<StoreGroupDTO>> pageStoreGroupByIds(List<Integer> storeGroupIdList, Integer enterpriseId,
Integer parentId, Integer pageSize, Integer pageNum) {
PageHelper.startPage(pageNum, pageSize);
com.github.pagehelper.Page<TabStoreGroup> tabStoreGroups = this.storeGroupService.pageStoreGroupByIds(storeGroupIdList, enterpriseId, parentId);
Page<StoreGroupDTO> storeGroupDTOPage = PageHelperUtils.changePageHelperToCurrentPage(tabStoreGroups, StoreGroupDTO.class);
return ServiceResponse.success(storeGroupDTOPage);
}
/**
* 刷新缓存,删除缓存
* @param storeGroupId
......
......@@ -6,10 +6,7 @@ import com.gic.commons.util.EntityUtil;
import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.response.EnterpriseServiceResponse;
import com.gic.store.constant.StoreESFieldsEnum;
import com.gic.store.dto.StoreBrandDTO;
import com.gic.store.dto.StoreDTO;
import com.gic.store.dto.StoreSearchDTO;
import com.gic.store.dto.StoreWidgetDTO;
import com.gic.store.dto.*;
import com.gic.store.entity.TabStoreBrand;
import com.gic.store.service.StoreApiService;
import com.gic.store.service.StoreBrandService;
......@@ -232,6 +229,36 @@ public class StoreWidgetApiServiceImpl implements StoreWidgetApiService {
}
return ServiceResponse.success(false);
}
@Override
public ServiceResponse<StoreColumnSet> getStoreColumnSet(Integer enterpriseId, Integer storeWidgetId) {
StoreColumnSet storeColumnSet = new StoreColumnSet();
this.getStoreColumnSet(enterpriseId, storeWidgetId, 1, storeColumnSet);
return ServiceResponse.success(storeColumnSet);
}
private void getStoreColumnSet(Integer enterpriseId, Integer storeWidgetId, int pageNum, StoreColumnSet storeColumnSet){
ServiceResponse<Page<StoreDTO>> response = this.listStoreByStoreWidgetId(enterpriseId, storeWidgetId, pageNum, 10000);
if(response.isSuccess() && response.getResult() != null){
Page<StoreDTO> page = response.getResult();
List<StoreDTO> result = page.getResult();
if(CollectionUtils.isNotEmpty(result)){
for(StoreDTO storeDTO : result){
storeColumnSet.getErpStatus().add(storeDTO.getErpStatus());
storeColumnSet.getRegion().add(storeDTO.getRegionId());
storeColumnSet.getStatus().add(storeDTO.getStatus());
storeColumnSet.getStoreGroupId().addAll(storeDTO.getStoreGroupIdList());
storeColumnSet.getStoreType().add(storeDTO.getStoreType());
}
}
if(pageNum == 1 && page.getPages() > 1){
for(int i=2; i<= page.getPages(); i++){
this.getStoreColumnSet(enterpriseId, storeWidgetId, i, storeColumnSet);
}
}
}
}
private void getStoreId(Integer enterpriseId, Integer storeWidgetId, int pageNum, List<Integer> list){
ServiceResponse<Page<Integer>> response = this.listStoreIdByStoreWidgetId(enterpriseId, storeWidgetId, pageNum, 10000);
if(response.isSuccess() && response.getResult() != null){
......
......@@ -272,5 +272,23 @@
#{item}
</foreach>
</if>
<if test="level != null">
and group_level = #{level}
</if>
</select>
<select id="pageStoreGroupByIds" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from
tab_store_group where status = 1 and enterprise_id = #{enterpriseId}
<if test="null != storeGroupIdList and storeGroupIdList.size() > 0">
and store_group_id in
<foreach collection="storeGroupIdList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="parentId != null">
and parent_store_group_id = #{parentId}
</if>
</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