Commit 6a5cf8ce by guojuxing

gic运营平台部门职位字段添加

parent c5f8b23d
......@@ -185,10 +185,18 @@ public class WmStoreSyncController {
"非" + MallModeEnum.SMART_RETAIL.getMsg() + "不能同步门店");
}
if (headStoreId == null) {
return RestResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "总店参数为空");
}
if (isBranch == null) {
isBranch = false;
}
if (getHasSyncStore(wmMallStoreId).contains(headStoreId.toString())) {
return RestResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "总店重复同步");
}
Integer enterpriseId = UserDetailUtils.getUserDetail().getEnterpriseId();
//查询总店
ServiceResponse<StoreDTO> storeResponse = storeApiService.getStoreById(enterpriseId, headStoreId);
......@@ -1007,4 +1015,13 @@ public class WmStoreSyncController {
}
return null;
}
private Set<String> getHasSyncStore(Integer wmMallStoreId) {
ServiceResponse<List<WmStoreSyncLogDTO>> hasSyncStoreListResult = wmStoreSyncLogApiService.getStoreList(null, wmMallStoreId);
if (hasSyncStoreListResult.isSuccess()) {
return new HashSet<>(hasSyncStoreListResult.getResult()
.stream().map(e -> e.getStoreId().toString()).collect(Collectors.toList()));
}
return new HashSet<>(1);
}
}
package com.gic.operation.web.controller;
import java.util.*;
import java.util.stream.Collectors;
import com.gic.auth.dto.MenuAuthDepartDTO;
import com.gic.auth.qo.MenuOperationItemListQO;
import com.gic.open.api.dto.ServePropDTO;
import com.gic.open.api.service.ServeApiService;
import com.gic.operation.web.vo.MenuOperationItemListVO;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.LogManager;
......@@ -16,19 +12,25 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.auth.constant.*;
import com.gic.auth.dto.MenuAuthDepartDTO;
import com.gic.auth.dto.MenuDTO;
import com.gic.auth.dto.MenuItemDTO;
import com.gic.auth.qo.AuthItemSaveQO;
import com.gic.auth.qo.MenuListQO;
import com.gic.auth.qo.MenuOperationItemListQO;
import com.gic.auth.service.MenuApiService;
import com.gic.auth.service.MenuItemApiService;
import com.gic.commons.util.CollectionUtil;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.enterprise.response.EnterpriseRestResponse;
import com.gic.enterprise.utils.ResultControllerUtils;
import com.gic.open.api.service.ServeApiService;
import com.gic.operation.web.vo.MenuDetailVO;
import com.gic.operation.web.vo.MenuOperationItemListVO;
import com.gic.operation.web.vo.MenuOperationItemVO;
@RestController
......@@ -143,13 +145,25 @@ public class MenuController {
long serviceAfter = System.currentTimeMillis();
LOGGER.info("menuApiService.listMenuTree权限菜单服务调用时间:{}", serviceAfter - serviceBefore);
if (result.isSuccess()) {
if (StringUtils.isBlank(params.getSearch())) {
List<Map<String, Object>> resultInfo = changeListToTree(MenuLevelConstants.FIRST_LEVEL_PARENT_ID,
result.getResult());
LOGGER.info("changeListToTree权限菜单数据递归时间:{}", System.currentTimeMillis() - serviceAfter);
return RestResponse.success(resultInfo);
} else {
return RestResponse.success(addAuthItemSignAndChildrenSignToList(result.getResult()));
List<MenuDTO> menuList = result.getResult();
if (CollectionUtils.isNotEmpty(menuList)) {
//设置部门数据,列表需要展示
Map<String, List<MenuAuthDepartDTO>> authDepartMap = getAuthDepartMap(menuList
.stream()
.map(e -> e.getMenuCode())
.collect(Collectors.toList()));
menuList = menuList
.stream()
.map(e -> e.setMenuAuthDepartList(authDepartMap.get(e.getMenuCode())))
.collect(Collectors.toList());
if (StringUtils.isBlank(params.getSearch())) {
List<Map<String, Object>> resultInfo = changeListToTree(MenuLevelConstants.FIRST_LEVEL_PARENT_ID,
menuList);
LOGGER.info("changeListToTree权限菜单数据递归时间:{}", System.currentTimeMillis() - serviceAfter);
return RestResponse.success(resultInfo);
} else {
return RestResponse.success(addAuthItemSignAndChildrenSignToList(menuList));
}
}
}
return EnterpriseRestResponse.failure(result);
......@@ -292,7 +306,24 @@ public class MenuController {
@RequestMapping("/list-auth-item-all")
public RestResponse updateAuthItemAll(MenuOperationItemListQO params) {
return ResultControllerUtils.commonPageResult(menuApiService.pageMenuOperationItem(params),
ServiceResponse<Page<MenuDTO>> result = menuApiService.pageMenuOperationItem(params);
if (result.isSuccess()) {
Page<MenuDTO> page = result.getResult();
if (page != null) {
List<MenuDTO> menuList = page.getResult();
if (CollectionUtils.isNotEmpty(menuList)) {
Map<String, List<MenuAuthDepartDTO>> authDepartMap = getAuthDepartMap(menuList
.stream()
.map(e -> e.getMenuCode())
.collect(Collectors.toList()));
page.setResult(menuList
.stream()
.map(e -> e.setMenuAuthDepartList(authDepartMap.get(e.getMenuCode())))
.collect(Collectors.toList()));
}
}
}
return ResultControllerUtils.commonPageResult(result,
MenuOperationItemListVO.class);
}
......@@ -348,6 +379,9 @@ public class MenuController {
data.put("parentCode", menuDTO.getParentCode());
data.put("parentId", menuDTO.getParentId());
data.put("menuVersionName", menuDTO.getMenuVersionName());
data.put("authType", menuDTO.getAuthType());
data.put("authTypeJson", menuDTO.getMenuAuthDepartList());
if (menuDTO.getLevel().intValue() == MenuLevelConstants.FIRST_LEVEL) {
data.put("seq", j + 1);
}
......@@ -421,6 +455,8 @@ public class MenuController {
data.put("children", childrenMap.contains(menuDTO.getMenuId().toString()));
//是否有权限项
data.put("hasAuthItem", authItemMap.contains(menuDTO.getMenuId().toString()));
data.put("authType", menuDTO.getAuthType());
data.put("authTypeJson", menuDTO.getMenuAuthDepartList());
result.add(data);
}
}
......@@ -474,4 +510,16 @@ public class MenuController {
menuDTO.setMenuAuthDepartList(JSON.parseArray(authDepartJson, MenuAuthDepartDTO.class));
}
}
private Map<String, List<MenuAuthDepartDTO>> getAuthDepartMap(List<String> menuCodeList) {
//设置部门数据,列表需要展示
ServiceResponse<List<MenuAuthDepartDTO>> authDepartResult = menuApiService
.listAllAuthDepart(menuCodeList);
if (authDepartResult.isSuccess()) {
List<MenuAuthDepartDTO> authDepartList = authDepartResult.getResult();
Map<String, List<MenuAuthDepartDTO>> authDepartMap = CollectionUtil.group(authDepartList, "menuCode");
return authDepartMap;
}
return new HashMap<>(2);
}
}
package com.gic.operation.web.vo;
import com.gic.auth.dto.MenuAuthDepartDTO;
import java.io.Serializable;
import java.util.List;
/**
* 操作项列表
* @ClassName: MenuOperationItemListVO

......@@ -36,6 +40,16 @@ public class MenuOperationItemListVO implements Serializable{
*/
private Integer adminOnlySign;
/**
* 1:管理员权限集 2:商户级超管及达摩侧人员 3:仅达摩侧人员
*/
private Integer authType;
/**
* 部门职位
*/
private List<MenuAuthDepartDTO> menuAuthDepartList;
public Integer getMenuId() {
return menuId;
}
......@@ -91,4 +105,22 @@ public class MenuOperationItemListVO implements Serializable{
public void setAdminOnlySign(Integer adminOnlySign) {
this.adminOnlySign = adminOnlySign;
}
public Integer getAuthType() {
return authType;
}
public MenuOperationItemListVO setAuthType(Integer authType) {
this.authType = authType;
return this;
}
public List<MenuAuthDepartDTO> getMenuAuthDepartList() {
return menuAuthDepartList;
}
public MenuOperationItemListVO setMenuAuthDepartList(List<MenuAuthDepartDTO> menuAuthDepartList) {
this.menuAuthDepartList = menuAuthDepartList;
return this;
}
}
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