集团版--权限区域食堂档口树
This commit is contained in:
parent
324f56d922
commit
3bab462b7c
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.canteen.core.allocation.canteen.controller;
|
||||
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bonus.canteen.core.allocation.canteen.business.AllocCanteenBusiness;
|
||||
import com.bonus.canteen.core.allocation.canteen.dto.AllocMobileCanteenQueryDTO;
|
||||
|
|
@ -7,6 +8,7 @@ import com.bonus.canteen.core.allocation.canteen.dto.ModifyCanteenIfReserveDTO;
|
|||
import com.bonus.canteen.core.allocation.canteen.dto.ModifyCanteenStateDTO;
|
||||
import com.bonus.canteen.core.allocation.canteen.dto.ModifyStallIfReserveDTO;
|
||||
import com.bonus.canteen.core.allocation.canteen.model.*;
|
||||
import com.bonus.canteen.core.allocation.canteen.param.AllocAreaParam;
|
||||
import com.bonus.canteen.core.allocation.canteen.param.AllocCanteenNumParam;
|
||||
import com.bonus.canteen.core.allocation.canteen.param.AllocCanteenStallPageParam;
|
||||
import com.bonus.canteen.core.allocation.canteen.param.AllocCanteenStallParam;
|
||||
|
|
@ -76,6 +78,12 @@ public class AllocCanteenController {
|
|||
return AjaxResult.success(this.allocStallService.listReserveDate(bean));
|
||||
}
|
||||
|
||||
@ApiOperation("集团版--权限区域食堂档口树")
|
||||
@PostMapping({"/tenant-group-area/tree"})
|
||||
public List<Tree<Long>> getTenantGroupAreaTree(@RequestBody AllocAreaParam param) {
|
||||
return this.allocCanteenService.getTenantGroupCanteenTree(param);
|
||||
}
|
||||
|
||||
@ApiOperation("分页查询食堂列表")
|
||||
@PostMapping({"/page-canteen"})
|
||||
public Page<AllocCanteenVO> pageCanteen(@RequestBody AllocCanteenStallPageParam request) {
|
||||
|
|
|
|||
|
|
@ -71,5 +71,5 @@ public interface AllocCanteenMapper extends BaseMapper<AllocCanteen> {
|
|||
)
|
||||
List<AllocCanteenAuthVO> listAllAuthCanteen(@Param("canteenType") Integer canteenType, @Param("areaIdList") List<Long> areaIdList);
|
||||
|
||||
|
||||
List<Long> listCanteenIdByAreaIdList(@Param("areaIdList") List<Long> areaIdList);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,4 +106,6 @@ public interface AllocStallMapper extends BaseMapper<AllocStall> {
|
|||
List<AllocStallAuthVO> listAuthStall(@Param("canteenIdList") List<Long> canteenIdList);
|
||||
|
||||
List<CanteenStallVO> listStallByCanteenId(@Param("canteenId") Long canteenId);
|
||||
|
||||
List<Long> listStallIdByAreaIdList(@Param("areaIdList") List<Long> areaIdList);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,13 @@
|
|||
package com.bonus.canteen.core.allocation.canteen.service;
|
||||
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bonus.canteen.core.allocation.canteen.dto.AllocCanteenModifyDTO;
|
||||
import com.bonus.canteen.core.allocation.canteen.dto.MarketCanteenSaveDTO;
|
||||
import com.bonus.canteen.core.allocation.canteen.dto.ModifyCanteenIfReserveDTO;
|
||||
import com.bonus.canteen.core.allocation.canteen.model.AllocCanteen;
|
||||
import com.bonus.canteen.core.allocation.canteen.param.AllocAreaParam;
|
||||
import com.bonus.canteen.core.allocation.canteen.param.AllocCanteenStallPageParam;
|
||||
import com.bonus.canteen.core.allocation.canteen.param.AllocCanteenStallParam;
|
||||
import com.bonus.canteen.core.allocation.canteen.vo.AllocCanteenAuthVO;
|
||||
|
|
@ -26,6 +28,8 @@ public interface AllocCanteenService extends IService<AllocCanteen> {
|
|||
|
||||
AllocCanteen getAllocCanteenCache(Long canteenId);
|
||||
|
||||
List<Tree<Long>> getTenantGroupCanteenTree(AllocAreaParam param);
|
||||
|
||||
Page<AllocCanteenVO> pageCanteen(AllocCanteenStallPageParam param);
|
||||
|
||||
void checkCanteenNameExist(String canteenName, Long canteenId);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
package com.bonus.canteen.core.allocation.canteen.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
import cn.hutool.core.lang.tree.TreeNodeConfig;
|
||||
import cn.hutool.core.lang.tree.TreeUtil;
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
|
|
@ -12,18 +15,22 @@ import com.bonus.canteen.core.allocation.api.AllocPayMetadataApi;
|
|||
import com.bonus.canteen.core.allocation.canteen.dto.AllocCanteenModifyDTO;
|
||||
import com.bonus.canteen.core.allocation.canteen.dto.MarketCanteenSaveDTO;
|
||||
import com.bonus.canteen.core.allocation.canteen.dto.ModifyCanteenIfReserveDTO;
|
||||
import com.bonus.canteen.core.allocation.canteen.enums.AllocCanteenTreeTypeEnum;
|
||||
import com.bonus.canteen.core.allocation.canteen.mapper.AllocAreaMapper;
|
||||
import com.bonus.canteen.core.allocation.canteen.mapper.AllocCanteenMapper;
|
||||
import com.bonus.canteen.core.allocation.canteen.mapper.AllocStallMapper;
|
||||
import com.bonus.canteen.core.allocation.canteen.model.AllocCanteen;
|
||||
import com.bonus.canteen.core.allocation.canteen.model.AllocStall;
|
||||
import com.bonus.canteen.core.allocation.canteen.param.AllocAreaParam;
|
||||
import com.bonus.canteen.core.allocation.canteen.param.AllocCanteenStallPageParam;
|
||||
import com.bonus.canteen.core.allocation.canteen.param.AllocCanteenStallParam;
|
||||
import com.bonus.canteen.core.allocation.canteen.service.AllocAreaService;
|
||||
import com.bonus.canteen.core.allocation.canteen.service.AllocCanteenService;
|
||||
import com.bonus.canteen.core.allocation.canteen.vo.AllocCanteenAuthVO;
|
||||
import com.bonus.canteen.core.allocation.canteen.vo.AllocCanteenStallVO;
|
||||
import com.bonus.canteen.core.allocation.canteen.vo.AllocCanteenTreeVO;
|
||||
import com.bonus.canteen.core.allocation.canteen.vo.AllocCanteenVO;
|
||||
import com.bonus.canteen.core.auth.api.MgrAuthApi;
|
||||
import com.bonus.canteen.core.common.constant.LeMqConstant;
|
||||
import com.bonus.canteen.core.common.enums.AllocBusinessStateEnum;
|
||||
import com.bonus.canteen.core.common.enums.AllocCanteenTypeEnum;
|
||||
|
|
@ -35,6 +42,7 @@ import com.bonus.canteen.core.menu.vo.AppletReserveStallVO;
|
|||
import com.bonus.canteen.core.order.mq.MqUtil;
|
||||
import com.bonus.canteen.core.order.utils.LeNumUtil;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.houqin.constant.DelFlagEnum;
|
||||
import com.bonus.common.houqin.constant.LeConstants;
|
||||
import com.bonus.common.houqin.i18n.I18n;
|
||||
import com.bonus.common.houqin.utils.LeBeanUtil;
|
||||
|
|
@ -55,6 +63,9 @@ public class AllocCanteenServiceImpl extends ServiceImpl<AllocCanteenMapper, All
|
|||
private static final String CACHE_PREFIX = "yst:";
|
||||
private static final String CACHE_KEY = "alloc-canteen";
|
||||
private static final long CACHE_SECONDS = 3600L;
|
||||
@Autowired
|
||||
@Lazy
|
||||
private MgrAuthApi mgrAuthApi;
|
||||
@Resource
|
||||
@Lazy
|
||||
private AllocPayMetadataApi allocPayMetadataApi;
|
||||
|
|
@ -182,6 +193,65 @@ public class AllocCanteenServiceImpl extends ServiceImpl<AllocCanteenMapper, All
|
|||
return "yst:" + var10000 + ":alloc-canteen:" + canteenId;
|
||||
}
|
||||
|
||||
public List<Tree<Long>> getTenantGroupCanteenTree(AllocAreaParam param) {
|
||||
List<AllocCanteenTreeVO> systemCanteenList = this.mgrAuthApi.getTenantCanteen(LeConstants.COMMON_NO, DelFlagEnum.DEL_FALSE.key(), true);
|
||||
if (CollUtil.isNotEmpty(param.getDataSelectList())) {
|
||||
this.integrationGroupArea(param, systemCanteenList);
|
||||
}
|
||||
|
||||
TreeNodeConfig treeNodeConfig = new TreeNodeConfig();
|
||||
treeNodeConfig.setNameKey("treeName");
|
||||
treeNodeConfig.setWeightKey("treeType");
|
||||
return TreeUtil.build(systemCanteenList, LeConstants.DATA_DEFAULT_LONG, treeNodeConfig, (canteen, treeNode) -> {
|
||||
treeNode.setId(canteen.getId());
|
||||
treeNode.setName(canteen.getTreeName());
|
||||
treeNode.setParentId(canteen.getParentId());
|
||||
treeNode.putExtra("treeType", canteen.getTreeType());
|
||||
treeNode.putExtra("halfSelect", canteen.getHalfSelect());
|
||||
});
|
||||
}
|
||||
|
||||
private void integrationGroupArea(AllocAreaParam param, List<AllocCanteenTreeVO> systemCanteenList) {
|
||||
List<Long> queryAreaIdList = new ArrayList();
|
||||
List<Long> viewAreaIdList = new ArrayList();
|
||||
|
||||
AllocAreaParam.DataSelectDTO dataSelectDTO;
|
||||
for(Iterator var5 = param.getDataSelectList().iterator(); var5.hasNext(); viewAreaIdList.add(dataSelectDTO.getDataId())) {
|
||||
dataSelectDTO = (AllocAreaParam.DataSelectDTO)var5.next();
|
||||
if (LeConstants.COMMON_YES.equals(dataSelectDTO.getHalfSelect())) {
|
||||
queryAreaIdList.add(dataSelectDTO.getDataId());
|
||||
}
|
||||
}
|
||||
|
||||
List<Long> canteenIdList = ((AllocCanteenMapper)this.baseMapper).listCanteenIdByAreaIdList(queryAreaIdList);
|
||||
List<Long> stallIdList = this.allocStallMapper.listStallIdByAreaIdList(queryAreaIdList);
|
||||
Iterator<AllocCanteenTreeVO> it = systemCanteenList.iterator();
|
||||
|
||||
while(true) {
|
||||
while(it.hasNext()) {
|
||||
AllocCanteenTreeVO treeVO = (AllocCanteenTreeVO)it.next();
|
||||
if (AllocCanteenTreeTypeEnum.AREA.getKey().equals(treeVO.getTreeType()) && !viewAreaIdList.contains(treeVO.getId())) {
|
||||
it.remove();
|
||||
} else {
|
||||
this.filterCanteen(canteenIdList, stallIdList, it, treeVO);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private void filterCanteen(List<Long> canteenIdList, List<Long> stallIdList, Iterator<AllocCanteenTreeVO> it, AllocCanteenTreeVO treeVO) {
|
||||
if (AllocCanteenTreeTypeEnum.CANTEEN.getKey().equals(treeVO.getTreeType()) && (!CollUtil.isNotEmpty(canteenIdList) || !canteenIdList.contains(treeVO.getId()))) {
|
||||
it.remove();
|
||||
} else {
|
||||
if (AllocCanteenTreeTypeEnum.STALL.getKey().equals(treeVO.getTreeType()) && (!CollUtil.isNotEmpty(stallIdList) || !stallIdList.contains(treeVO.getId()))) {
|
||||
it.remove();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public Page<AllocCanteenVO> pageCanteen(AllocCanteenStallPageParam param) {
|
||||
param.setCanteenName(LeBeanUtil.fieldLikeHandle(param.getCanteenName()));
|
||||
param.setIfDel(LeConstants.COMMON_NO);
|
||||
|
|
|
|||
|
|
@ -109,4 +109,20 @@
|
|||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 通过区域id列表,查询未删除的全部食堂id列表 -->
|
||||
<select id="listCanteenIdByAreaIdList" resultType="java.lang.Long">
|
||||
SELECT
|
||||
t1.canteen_id
|
||||
FROM
|
||||
alloc_canteen t1
|
||||
WHERE
|
||||
t1.if_del = 2
|
||||
<if test="areaIdList != null and areaIdList.size() > 0">
|
||||
AND t1.area_id IN
|
||||
<foreach collection="areaIdList" item="areaId" separator="," open="(" close=")">
|
||||
#{areaId}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -244,4 +244,20 @@
|
|||
FROM alloc_stall
|
||||
WHERE canteen_id = #{canteenId}
|
||||
</select>
|
||||
|
||||
<!-- 通过区域id列表,查询未删除的全部档口id列表 -->
|
||||
<select id="listStallIdByAreaIdList" resultType="java.lang.Long">
|
||||
SELECT
|
||||
t1.stall_id
|
||||
FROM
|
||||
alloc_stall t1
|
||||
WHERE
|
||||
t1.if_del = 2
|
||||
<if test="areaIdList != null and areaIdList.size() > 0">
|
||||
AND t1.area_id IN
|
||||
<foreach collection="areaIdList" item="areaId" separator="," open="(" close=")">
|
||||
#{areaId}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue