Commit 4f933859 by 陶光胜

Merge branch 'developer' into 'master'

Developer

See merge request !11
parents 6c904cc9 25310e7b
...@@ -9,7 +9,7 @@ public interface Constants { ...@@ -9,7 +9,7 @@ public interface Constants {
// String STORE_BATCH_IMPORT_MQ_KEY = "tmpStoreBatchImportTaskMq4.0"; // String STORE_BATCH_IMPORT_MQ_KEY = "tmpStoreBatchImportTaskMq4.0";
Integer STORE_BATCH_IMPORT_TASK_TYPE = 6; Integer STORE_BATCH_IMPORT_TASK_TYPE = 6;
String dateformat = "YYYY-MM-dd HH:mm:ss"; String dateformat = "yyyy-MM-dd HH:mm:ss";
} }
package com.gic.auth.dto;
import java.io.Serializable;
import java.util.Date;
public class MenuAuthDepartDTO implements Serializable{
private static final long serialVersionUID = 4195293064485615589L;
/**
* ID
*/
private Integer menuDepartId;
/**
* 菜单code
*/
private String menuCode;
/**
* 部门code
*/
private String departCode;
/**
* 部门name
*/
private String departName;
/**
* 职位code
*/
private String positionCode;
/**
* 职位name
*/
private String positionName;
/**
* 1:有效 0:无效
*/
private Integer status;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
public Integer getMenuDepartId() {
return menuDepartId;
}
public MenuAuthDepartDTO setMenuDepartId(Integer menuDepartId) {
this.menuDepartId = menuDepartId;
return this;
}
public String getMenuCode() {
return menuCode;
}
public MenuAuthDepartDTO setMenuCode(String menuCode) {
this.menuCode = menuCode;
return this;
}
public String getDepartCode() {
return departCode;
}
public MenuAuthDepartDTO setDepartCode(String departCode) {
this.departCode = departCode;
return this;
}
public String getDepartName() {
return departName;
}
public MenuAuthDepartDTO setDepartName(String departName) {
this.departName = departName;
return this;
}
public String getPositionCode() {
return positionCode;
}
public MenuAuthDepartDTO setPositionCode(String positionCode) {
this.positionCode = positionCode;
return this;
}
public String getPositionName() {
return positionName;
}
public MenuAuthDepartDTO setPositionName(String positionName) {
this.positionName = positionName;
return this;
}
public Integer getStatus() {
return status;
}
public MenuAuthDepartDTO setStatus(Integer status) {
this.status = status;
return this;
}
public Date getCreateTime() {
return createTime;
}
public MenuAuthDepartDTO setCreateTime(Date createTime) {
this.createTime = createTime;
return this;
}
public Date getUpdateTime() {
return updateTime;
}
public MenuAuthDepartDTO setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
return this;
}
}
...@@ -168,6 +168,16 @@ public class MenuDTO implements Serializable { ...@@ -168,6 +168,16 @@ public class MenuDTO implements Serializable {
*/ */
private Integer adminOnlySign; private Integer adminOnlySign;
/**
* 1:管理员权限集 2:商户级超管及达摩侧人员 3:仅达摩侧人员
*/
private Integer authType;
/**
* 部门职位
*/
private List<MenuAuthDepartDTO> menuAuthDepartList;
public Integer getMenuId() { public Integer getMenuId() {
return menuId; return menuId;
} }
...@@ -327,4 +337,22 @@ public class MenuDTO implements Serializable { ...@@ -327,4 +337,22 @@ public class MenuDTO implements Serializable {
public void setAdminOnlySign(Integer adminOnlySign) { public void setAdminOnlySign(Integer adminOnlySign) {
this.adminOnlySign = adminOnlySign; this.adminOnlySign = adminOnlySign;
} }
public List<MenuAuthDepartDTO> getMenuAuthDepartList() {
return menuAuthDepartList;
}
public MenuDTO setMenuAuthDepartList(List<MenuAuthDepartDTO> menuAuthDepartList) {
this.menuAuthDepartList = menuAuthDepartList;
return this;
}
public Integer getAuthType() {
return authType;
}
public MenuDTO setAuthType(Integer authType) {
this.authType = authType;
return this;
}
} }
package com.gic.auth.qo; package com.gic.auth.qo;
import java.util.List;
/** /**
* 菜单权限树数据 * 菜单权限树数据
* @ClassName: MenuListQO
 * @ClassName: MenuListQO

...@@ -43,6 +45,11 @@ public class MenuListQO extends PageQO{ ...@@ -43,6 +45,11 @@ public class MenuListQO extends PageQO{
*/ */
private Integer menuId; private Integer menuId;
/**
* 1:管理员权限集 2:商户级超管及达摩侧人员 3:仅达摩侧人员
*/
private List<Integer> authTypeList;
public String getSearch() { public String getSearch() {
return search; return search;
} }
...@@ -106,4 +113,13 @@ public class MenuListQO extends PageQO{ ...@@ -106,4 +113,13 @@ public class MenuListQO extends PageQO{
public void setMenuId(Integer menuId) { public void setMenuId(Integer menuId) {
this.menuId = menuId; this.menuId = menuId;
} }
public List<Integer> getAuthTypeList() {
return authTypeList;
}
public MenuListQO setAuthTypeList(List<Integer> authTypeList) {
this.authTypeList = authTypeList;
return this;
}
} }
package com.gic.auth.qo;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import java.util.Set;
public class UserMenuQO implements Serializable{
private static final long serialVersionUID = 2570558155342976221L;
/**
* 商户ID
*/
private Integer enterpriseId;
/**
* 商户基础服务版本号
*/
private String baseVersionCode;
/**
* 登录用户ID
*/
private Integer userId;
/**
* 当前菜单ID,一般不用该参数
*/
private Integer currentMenu;
/**
* 应用ID,用于过滤应用菜单
*/
private String appId;
/**
* 登录运营人员所在的部门职位列表
* 元素:部门code-职位code,例如 D1-P1
*/
private Set<String> departPosition;
private boolean isGic;
/**
* 是否构建树结构
*/
private boolean isNeedTree;
/**
* 是否是达摩侧人员
*/
private boolean isOperationUser;
public Integer getEnterpriseId() {
return enterpriseId;
}
public UserMenuQO setEnterpriseId(Integer enterpriseId) {
this.enterpriseId = enterpriseId;
return this;
}
public String getBaseVersionCode() {
return baseVersionCode;
}
public UserMenuQO setBaseVersionCode(String baseVersionCode) {
this.baseVersionCode = baseVersionCode;
return this;
}
public Integer getUserId() {
return userId;
}
public UserMenuQO setUserId(Integer userId) {
this.userId = userId;
return this;
}
public Integer getCurrentMenu() {
return currentMenu;
}
public UserMenuQO setCurrentMenu(Integer currentMenu) {
this.currentMenu = currentMenu;
return this;
}
public String getAppId() {
return appId;
}
public UserMenuQO setAppId(String appId) {
this.appId = appId;
return this;
}
public Set<String> getDepartPosition() {
return departPosition;
}
public UserMenuQO setDepartPosition(Set<String> departPosition) {
this.departPosition = departPosition;
return this;
}
public boolean isGic() {
return isGic;
}
public UserMenuQO setGic(boolean gic) {
isGic = gic;
return this;
}
public boolean isNeedTree() {
return isNeedTree;
}
public UserMenuQO setNeedTree(boolean needTree) {
isNeedTree = needTree;
return this;
}
public boolean isOperationUser() {
return isOperationUser;
}
public UserMenuQO setOperationUser(boolean operationUser) {
isOperationUser = operationUser;
return this;
}
}
...@@ -3,10 +3,12 @@ package com.gic.auth.service; ...@@ -3,10 +3,12 @@ package com.gic.auth.service;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse; import com.gic.api.base.commons.ServiceResponse;
import com.gic.auth.dto.AuthItemListDTO; import com.gic.auth.dto.AuthItemListDTO;
import com.gic.auth.dto.MenuAuthDepartDTO;
import com.gic.auth.dto.MenuDTO; import com.gic.auth.dto.MenuDTO;
import com.gic.auth.qo.AuthItemSaveQO; import com.gic.auth.qo.AuthItemSaveQO;
import com.gic.auth.qo.MenuListQO; import com.gic.auth.qo.MenuListQO;
import com.gic.auth.qo.MenuOperationItemListQO; import com.gic.auth.qo.MenuOperationItemListQO;
import com.gic.auth.qo.UserMenuQO;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -64,6 +66,8 @@ public interface MenuApiService { ...@@ -64,6 +66,8 @@ public interface MenuApiService {
ServiceResponse<List<MenuDTO>> getUserMenuOfGic(Integer enterpriseId, Integer userId, Integer currentMenu, ServiceResponse<List<MenuDTO>> getUserMenuOfGic(Integer enterpriseId, Integer userId, Integer currentMenu,
String versionCode); String versionCode);
ServiceResponse<List<MenuDTO>> getUserMenuOfGic(UserMenuQO params);
/** /**
* 获取登陆用户的菜单(页面) * 获取登陆用户的菜单(页面)
* @Title: getUserMenuOfGicNotTree
 * @Title: getUserMenuOfGicNotTree

...@@ -168,6 +172,8 @@ public interface MenuApiService { ...@@ -168,6 +172,8 @@ public interface MenuApiService {

 */ 
 */
ServiceResponse<List<MenuDTO>> listMenuTree(MenuListQO params); ServiceResponse<List<MenuDTO>> listMenuTree(MenuListQO params);
ServiceResponse<List<MenuAuthDepartDTO>> listAllAuthDepart(List<String> menuCodeList);
/** /**
* 查询菜单树(页面&权限项) * 查询菜单树(页面&权限项)
* @Title: listMenuTreeForRole
 * @Title: listMenuTreeForRole

...@@ -388,4 +394,14 @@ public interface MenuApiService { ...@@ -388,4 +394,14 @@ public interface MenuApiService {
* @return com.gic.api.base.commons.ServiceResponse<com.gic.auth.dto.MenuDTO>
 * @return com.gic.api.base.commons.ServiceResponse<com.gic.auth.dto.MenuDTO>


*/ 
*/
ServiceResponse<MenuDTO> getMenuByMenuCode(String menuCode); ServiceResponse<MenuDTO> getMenuByMenuCode(String menuCode);
/**
* 同步测试菜单数据到生产
* @Title: syncProductMenu

* @Description:

* @author guojuxing
* @param menuCode
第一层级菜单code
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Void>


*/
ServiceResponse<Void> syncProductMenu(String menuCode);
} }
...@@ -32,6 +32,17 @@ public interface UserApiService { ...@@ -32,6 +32,17 @@ public interface UserApiService {
ServiceResponse<Integer> saveOperationUser(UserDTO userDTO); ServiceResponse<Integer> saveOperationUser(UserDTO userDTO);
/** /**
* 更新运营人员信息,,主要是名称修改
* @Title: updateOperationUser

* @Description:

* @author guojuxing
* @param userId
* @param userName
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Void>


*/
ServiceResponse<Void> updateOperationUser(Integer userId, String userName);
/**
* 新增超级用户 * 新增超级用户
* @Title: saveAdmin
 * @Title: saveAdmin

* @Description: * @Description:
......
package com.gic.auth.dao.mapper;
import com.gic.auth.dto.MenuAuthDepartDTO;
import com.gic.auth.entity.TabSysMenuAuthDepart;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface TabSysMenuAuthDepartMapper {
/**
* 根据主键删除
*
* @param menuDepartId 主键
* @return 更新条目数
*/
int deleteByPrimaryKey(Integer menuDepartId);
/**
* 插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int insert(TabSysMenuAuthDepart record);
/**
* 动态插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int insertSelective(TabSysMenuAuthDepart record);
/**
* 根据主键查询
*
* @param menuDepartId 主键
* @return 实体对象
*/
TabSysMenuAuthDepart selectByPrimaryKey(Integer menuDepartId);
/**
* 根据主键动态更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int updateByPrimaryKeySelective(TabSysMenuAuthDepart record);
/**
* 根据主键更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int updateByPrimaryKey(TabSysMenuAuthDepart record);
void saveFetch(@Param("list") List<MenuAuthDepartDTO> list);
void deleteByMenuCode(String menuCode);
List<TabSysMenuAuthDepart> listAuthDepartByMenuCode(String menuCode);
List<TabSysMenuAuthDepart> listAllAuthDepart(@Param("list") List<String> menuCodeList);
}
\ No newline at end of file
...@@ -112,4 +112,6 @@ public interface TabSysMenuItemMapper { ...@@ -112,4 +112,6 @@ public interface TabSysMenuItemMapper {
void deleteByMenuIdList(@Param("list") List<Integer> menuId); void deleteByMenuIdList(@Param("list") List<Integer> menuId);
void deleteByItemId(@Param("itemId") Integer itemId); void deleteByItemId(@Param("itemId") Integer itemId);
List<TabSysMenuItem> listByDev(Integer menuId);
} }
\ No newline at end of file
...@@ -211,4 +211,9 @@ public interface TabSysMenuMapper { ...@@ -211,4 +211,9 @@ public interface TabSysMenuMapper {
* @return void
 * @return void


*/ 
*/
void deleteNotInApp(@Param("list") List<String> projectList); void deleteNotInApp(@Param("list") List<String> projectList);
List<TabSysMenu> listMenuTemp(String project);
List<TabSysMenu> getAuthItemByDevMenuId(Integer menuId);
} }
\ No newline at end of file
...@@ -106,6 +106,11 @@ public class TabSysMenu { ...@@ -106,6 +106,11 @@ public class TabSysMenu {
*/ */
private Integer adminOnlySign; private Integer adminOnlySign;
/**
* 1:管理员权限集 2:商户级超管及达摩侧人员 3:仅达摩侧人员
*/
private Integer authType;
public Integer getMenuId() { public Integer getMenuId() {
return menuId; return menuId;
} }
...@@ -265,4 +270,13 @@ public class TabSysMenu { ...@@ -265,4 +270,13 @@ public class TabSysMenu {
public void setAdminOnlySign(Integer adminOnlySign) { public void setAdminOnlySign(Integer adminOnlySign) {
this.adminOnlySign = adminOnlySign; this.adminOnlySign = adminOnlySign;
} }
public Integer getAuthType() {
return authType;
}
public TabSysMenu setAuthType(Integer authType) {
this.authType = authType;
return this;
}
} }
\ No newline at end of file
package com.gic.auth.entity;
import java.util.Date;
/**
* tab_sys_menu_auth_depart
*/
public class TabSysMenuAuthDepart {
/**
* ID
*/
private Integer menuDepartId;
/**
* 菜单code
*/
private String menuCode;
/**
* 部门code
*/
private String departCode;
/**
* 部门name
*/
private String departName;
/**
* 职位code
*/
private String positionCode;
/**
* 职位name
*/
private String positionName;
/**
* 1:有效 0:无效
*/
private Integer status;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
public Integer getMenuDepartId() {
return menuDepartId;
}
public TabSysMenuAuthDepart setMenuDepartId(Integer menuDepartId) {
this.menuDepartId = menuDepartId;
return this;
}
public String getMenuCode() {
return menuCode;
}
public TabSysMenuAuthDepart setMenuCode(String menuCode) {
this.menuCode = menuCode;
return this;
}
public String getDepartCode() {
return departCode;
}
public TabSysMenuAuthDepart setDepartCode(String departCode) {
this.departCode = departCode;
return this;
}
public String getDepartName() {
return departName;
}
public TabSysMenuAuthDepart setDepartName(String departName) {
this.departName = departName;
return this;
}
public String getPositionCode() {
return positionCode;
}
public TabSysMenuAuthDepart setPositionCode(String positionCode) {
this.positionCode = positionCode;
return this;
}
public String getPositionName() {
return positionName;
}
public TabSysMenuAuthDepart setPositionName(String positionName) {
this.positionName = positionName;
return this;
}
public Integer getStatus() {
return status;
}
public TabSysMenuAuthDepart setStatus(Integer status) {
this.status = status;
return this;
}
public Date getCreateTime() {
return createTime;
}
public TabSysMenuAuthDepart setCreateTime(Date createTime) {
this.createTime = createTime;
return this;
}
public Date getUpdateTime() {
return updateTime;
}
public TabSysMenuAuthDepart setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
return this;
}
}
\ No newline at end of file
package com.gic.auth.service;
import com.gic.auth.dto.MenuAuthDepartDTO;
import com.gic.auth.entity.TabSysMenuAuthDepart;
import java.util.List;
public interface MenuAuthDepartService {
/**
* 批量新增部门职位
* @Title: saveFetch

* @Description:

* @author guojuxing
* @param list

* @return void


*/
void saveFetch(List<MenuAuthDepartDTO> list);
/**
* 查询菜单的所有部门职位
* @Title: listAuthDepartByMenuCode

* @Description:

* @author guojuxing
* @param menuCode

* @return java.util.List<com.gic.auth.entity.TabSysMenuAuthDepart>


*/
List<TabSysMenuAuthDepart> listAuthDepartByMenuCode(String menuCode);
List<TabSysMenuAuthDepart> listAllAuthDepart(List<String> menuCodeList);
}
...@@ -78,4 +78,12 @@ public interface MenuItemService { ...@@ -78,4 +78,12 @@ public interface MenuItemService {
List<AuthItemDTO> listAuthItemGroupByItemId(Integer itemId); List<AuthItemDTO> listAuthItemGroupByItemId(Integer itemId);
/**
* 查询测试环境表数据
* @param menuId
* @return
*/
List<TabSysMenuItem> listByDev(Integer menuId);
} }
...@@ -193,4 +193,27 @@ public interface MenuService { ...@@ -193,4 +193,27 @@ public interface MenuService {
* @return void
 * @return void


*/ 
*/
void deleteNotInApp(List<String> projectList); void deleteNotInApp(List<String> projectList);
/***********同步测试环境数据到生产************/
/**
* 查询临时菜单
* @Title: listMenuTemp

* @Description:

* @author guojuxing
* @param project

* @return java.util.List<com.gic.auth.entity.TabSysMenu>


*/
List<TabSysMenu> listMenuTemp(String project);
/**
* 查询生产表的最新ID
* @Title: getAuthItemByDevMenuId

* @Description:

* @author guojuxing
* @param menuId

* @return java.util.List<com.gic.auth.entity.TabSysMenu>


*/
List<TabSysMenu> getAuthItemByDevMenuId(Integer menuId);
} }
package com.gic.auth.service.impl;
import com.gic.auth.dao.mapper.TabSysMenuAuthDepartMapper;
import com.gic.auth.dto.MenuAuthDepartDTO;
import com.gic.auth.entity.TabSysMenuAuthDepart;
import com.gic.auth.service.MenuAuthDepartService;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service("menuAuthDepartService")
public class MenuAuthDepartServiceImpl implements MenuAuthDepartService{
@Autowired
private TabSysMenuAuthDepartMapper tabSysMenuAuthDepartMapper;
@Override
public void saveFetch(List<MenuAuthDepartDTO> list) {
if (CollectionUtils.isNotEmpty(list)) {
tabSysMenuAuthDepartMapper.deleteByMenuCode(list.get(0).getMenuCode());
tabSysMenuAuthDepartMapper.saveFetch(list);
}
}
@Override
public List<TabSysMenuAuthDepart> listAuthDepartByMenuCode(String menuCode) {
return tabSysMenuAuthDepartMapper.listAuthDepartByMenuCode(menuCode);
}
@Override
public List<TabSysMenuAuthDepart> listAllAuthDepart(List<String> menuCodeList) {
return tabSysMenuAuthDepartMapper.listAllAuthDepart(menuCodeList);
}
}
...@@ -64,4 +64,9 @@ public class MenuItemServiceImpl implements MenuItemService{ ...@@ -64,4 +64,9 @@ public class MenuItemServiceImpl implements MenuItemService{
public List<AuthItemDTO> listAuthItemGroupByItemId(Integer itemId) { public List<AuthItemDTO> listAuthItemGroupByItemId(Integer itemId) {
return tabSysMenuItemMapper.queryAuthItem(itemId); return tabSysMenuItemMapper.queryAuthItem(itemId);
} }
@Override
public List<TabSysMenuItem> listByDev(Integer menuId) {
return tabSysMenuItemMapper.listByDev(menuId);
}
} }
...@@ -191,6 +191,16 @@ public class MenuServiceImpl implements MenuService { ...@@ -191,6 +191,16 @@ public class MenuServiceImpl implements MenuService {
tabSysMenuMapper.deleteNotInApp(projectList); tabSysMenuMapper.deleteNotInApp(projectList);
} }
@Override
public List<TabSysMenu> listMenuTemp(String project) {
return tabSysMenuMapper.listMenuTemp(project);
}
@Override
public List<TabSysMenu> getAuthItemByDevMenuId(Integer menuId) {
return tabSysMenuMapper.getAuthItemByDevMenuId(menuId);
}
private void updateSort(Integer sort, Integer id) { private void updateSort(Integer sort, Integer id) {
TabSysMenu record = new TabSysMenu(); TabSysMenu record = new TabSysMenu();
record.setMenuId(id); record.setMenuId(id);
......
...@@ -3,7 +3,9 @@ package com.gic.auth.service.outer.impl; ...@@ -3,7 +3,9 @@ package com.gic.auth.service.outer.impl;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.gic.auth.entity.TabSysBusinessFrontRes; import com.gic.auth.entity.*;
import com.gic.auth.qo.UserMenuQO;
import com.gic.commons.util.CollectionUtil;
import com.gic.enterprise.dto.EnterpriseDTO; import com.gic.enterprise.dto.EnterpriseDTO;
import com.gic.enterprise.dto.EnterpriseResourceRelDTO; import com.gic.enterprise.dto.EnterpriseResourceRelDTO;
import com.gic.enterprise.service.EnterpriseApiService; import com.gic.enterprise.service.EnterpriseApiService;
...@@ -23,9 +25,6 @@ import com.gic.api.base.commons.Page; ...@@ -23,9 +25,6 @@ import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse; import com.gic.api.base.commons.ServiceResponse;
import com.gic.auth.constant.*; import com.gic.auth.constant.*;
import com.gic.auth.dto.*; import com.gic.auth.dto.*;
import com.gic.auth.entity.TabSysMenu;
import com.gic.auth.entity.TabSysMenuItem;
import com.gic.auth.entity.TabSysUser;
import com.gic.auth.qo.AuthItemSaveQO; import com.gic.auth.qo.AuthItemSaveQO;
import com.gic.auth.qo.MenuListQO; import com.gic.auth.qo.MenuListQO;
import com.gic.auth.qo.MenuOperationItemListQO; import com.gic.auth.qo.MenuOperationItemListQO;
...@@ -61,6 +60,8 @@ public class MenuApiServiceImpl implements MenuApiService { ...@@ -61,6 +60,8 @@ public class MenuApiServiceImpl implements MenuApiService {
private EnterpriseApiService enterpriseApiService; private EnterpriseApiService enterpriseApiService;
@Autowired @Autowired
private BusinessFrontResService businessFrontResService; private BusinessFrontResService businessFrontResService;
@Autowired
private MenuAuthDepartService menuAuthDepartService;
@Override @Override
public ServiceResponse<List<MenuDTO>> listByMenuIdList(List<Integer> menuIdList) { public ServiceResponse<List<MenuDTO>> listByMenuIdList(List<Integer> menuIdList) {
...@@ -137,13 +138,28 @@ public class MenuApiServiceImpl implements MenuApiService { ...@@ -137,13 +138,28 @@ public class MenuApiServiceImpl implements MenuApiService {
@Override @Override
public ServiceResponse<List<MenuDTO>> getUserMenuOfGic(Integer enterpriseId, Integer userId, Integer currentMenu, String versionCode) { public ServiceResponse<List<MenuDTO>> getUserMenuOfGic(Integer enterpriseId, Integer userId, Integer currentMenu, String versionCode) {
return getUserLoginMenu(enterpriseId, userId, currentMenu, true, versionCode, true); return getUserLoginMenu(new UserMenuQO()
.setEnterpriseId(enterpriseId)
.setUserId(userId)
.setGic(true)
.setBaseVersionCode(versionCode)
.setNeedTree(true));
}
@Override
public ServiceResponse<List<MenuDTO>> getUserMenuOfGic(UserMenuQO params) {
return getUserLoginMenu(params);
} }
@Override @Override
public ServiceResponse<List<MenuDTO>> getUserMenuOfGicNotTree(Integer enterpriseId, Integer userId, Integer currentMenu, public ServiceResponse<List<MenuDTO>> getUserMenuOfGicNotTree(Integer enterpriseId, Integer userId, Integer currentMenu,
String versionCode) { String versionCode) {
return getUserLoginMenu(enterpriseId, userId, currentMenu, true, versionCode, false); return getUserLoginMenu(new UserMenuQO()
.setEnterpriseId(enterpriseId)
.setUserId(userId)
.setGic(true)
.setBaseVersionCode(versionCode)
.setNeedTree(false));
} }
@Override @Override
...@@ -159,13 +175,23 @@ public class MenuApiServiceImpl implements MenuApiService { ...@@ -159,13 +175,23 @@ public class MenuApiServiceImpl implements MenuApiService {
@Override @Override
public ServiceResponse<List<MenuDTO>> getUserMenuOfApp(Integer enterpriseId, Integer userId, Integer currentMenu, public ServiceResponse<List<MenuDTO>> getUserMenuOfApp(Integer enterpriseId, Integer userId, Integer currentMenu,
String versionCode) { String versionCode) {
return getUserLoginMenu(enterpriseId, userId, currentMenu, false, versionCode, true); return getUserLoginMenu(new UserMenuQO()
.setEnterpriseId(enterpriseId)
.setUserId(userId)
.setGic(false)
.setAppId(versionCode)
.setNeedTree(true));
} }
@Override @Override
public ServiceResponse<List<MenuDTO>> getUserMenuOfAppNotTree(Integer enterpriseId, Integer userId, Integer currentMenu, public ServiceResponse<List<MenuDTO>> getUserMenuOfAppNotTree(Integer enterpriseId, Integer userId, Integer currentMenu,
String versionCode) { String versionCode) {
return getUserLoginMenu(enterpriseId, userId, currentMenu, false, versionCode, false); return getUserLoginMenu(new UserMenuQO()
.setEnterpriseId(enterpriseId)
.setUserId(userId)
.setGic(false)
.setAppId(versionCode)
.setNeedTree(false));
} }
@Override @Override
...@@ -214,6 +240,15 @@ public class MenuApiServiceImpl implements MenuApiService { ...@@ -214,6 +240,15 @@ public class MenuApiServiceImpl implements MenuApiService {
} }
@Override @Override
public ServiceResponse<List<MenuAuthDepartDTO>> listAllAuthDepart(List<String> menuCodeList) {
List<TabSysMenuAuthDepart> list = menuAuthDepartService.listAllAuthDepart(menuCodeList);
if (CollectionUtils.isNotEmpty(list)) {
return ServiceResponse.success(EntityUtil.changeEntityListNew(MenuAuthDepartDTO.class, list));
}
return ServiceResponse.success(new ArrayList<>());
}
@Override
public ServiceResponse<List<MenuDTO>> listMenuTreeForRole(String project, String versionCode) { public ServiceResponse<List<MenuDTO>> listMenuTreeForRole(String project, String versionCode) {
List<TabSysMenu> list = menuService.listMenuTree(project, versionCode); List<TabSysMenu> list = menuService.listMenuTree(project, versionCode);
if (CollectionUtils.isNotEmpty(list)) { if (CollectionUtils.isNotEmpty(list)) {
...@@ -339,7 +374,9 @@ public class MenuApiServiceImpl implements MenuApiService { ...@@ -339,7 +374,9 @@ public class MenuApiServiceImpl implements MenuApiService {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "code:" + menuDTO.getMenuCode() + "重复"); return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "code:" + menuDTO.getMenuCode() + "重复");
} }
setMenuAuthType(menuDTO);
menuService.updatePage(menuDTO); menuService.updatePage(menuDTO);
menuAuthDepartService.saveFetch(menuDTO.getMenuAuthDepartList());
//同时更新子集的父级code数据 //同时更新子集的父级code数据
menuService.updateParentCodeByParentId(menuDTO.getMenuId(), menuDTO.getMenuCode()); menuService.updateParentCodeByParentId(menuDTO.getMenuId(), menuDTO.getMenuCode());
...@@ -409,7 +446,14 @@ public class MenuApiServiceImpl implements MenuApiService { ...@@ -409,7 +446,14 @@ public class MenuApiServiceImpl implements MenuApiService {
if (record == null) { if (record == null) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "主键参数有误,查无数据"); return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "主键参数有误,查无数据");
} }
return ServiceResponse.success(EntityUtil.changeEntityNew(MenuDTO.class, record)); MenuDTO menuDTO = EntityUtil.changeEntityNew(MenuDTO.class, record);
if (record.getAuthType().intValue() != 1) {
//添加部门职位数据
List<TabSysMenuAuthDepart> list = menuAuthDepartService
.listAuthDepartByMenuCode(record.getMenuCode());
menuDTO.setMenuAuthDepartList(EntityUtil.changeEntityListNew(MenuAuthDepartDTO.class, list));
}
return ServiceResponse.success(menuDTO);
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
...@@ -562,6 +606,70 @@ public class MenuApiServiceImpl implements MenuApiService { ...@@ -562,6 +606,70 @@ public class MenuApiServiceImpl implements MenuApiService {
return ServiceResponse.success(EntityUtil.changeEntityNew(MenuDTO.class, record)); return ServiceResponse.success(EntityUtil.changeEntityNew(MenuDTO.class, record));
} }
@Override
public ServiceResponse<Void> syncProductMenu(String menuCode) {
TabSysMenu tabSysMenu = menuService.getMenuByMenuCode(menuCode);
if (tabSysMenu == null || tabSysMenu.getLevel() != 1) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "不存在或者不是应用对应的code");
}
String appId = tabSysMenu.getProject();
//临时表(测试环境的菜单数据)
List<TabSysMenu> devMenuList = menuService.listMenuTemp(appId);
if (CollectionUtils.isNotEmpty(devMenuList)) {
devMenuList.forEach(menu -> {
TabSysMenu temp = menuService.getMenuByMenuCode(menu.getMenuCode());
if (temp == null) {
//如果生产环境没有,则新增;如果有了,则不处理
int level = menu.getLevel();
if (level == 1) {
//如果是第一层级的,应用
//不处理
} else if (level == 2) {
//如果是第二层级,则父级code,进行修改
menu.setParentId(tabSysMenu.getMenuId());
menu.setParentCode(tabSysMenu.getMenuCode());
menu.setMenuVersion(tabSysMenu.getMenuVersion());
menu.setMenuVersionName(tabSysMenu.getMenuVersionName());
menuService.savePage(EntityUtil.changeEntityNew(MenuDTO.class, menu));
} else {
//其他层级,查询他的父级ID,根据父级code
TabSysMenu otherLevel = menuService.getMenuByMenuCode(menu.getParentCode());
menu.setParentId(otherLevel.getMenuId());
menu.setMenuVersion(tabSysMenu.getMenuVersion());
menu.setMenuVersionName(tabSysMenu.getMenuVersionName());
menuService.savePage(EntityUtil.changeEntityNew(MenuDTO.class, menu));
}
}
});
//处理完所有的菜单
devMenuList.forEach(item -> {
//权限项和操作项关联数据同步
if (item.getMenuType().intValue() == 1) {
List<TabSysMenu> itemList = menuService.getAuthItemByDevMenuId(item.getMenuId());
if (CollectionUtils.isNotEmpty(itemList)) {
TabSysMenu proMenu = menuService.getMenuByMenuCode(item.getMenuCode());
List<MenuItemDTO> itemDTOList = new ArrayList<>();
Date now = new Date();
itemList.forEach(tempItem -> {
MenuItemDTO menuItemDTO = new MenuItemDTO();
menuItemDTO.setItemId(tempItem.getMenuId());
menuItemDTO.setMenuId(proMenu.getMenuId());
menuItemDTO.setStatus(1);
menuItemDTO.setCreateTime(now);
menuItemDTO.setUpdateTime(now);
itemDTOList.add(menuItemDTO);
});
//delete
menuItemService.deleteByMenuId(proMenu.getMenuId());
//save
menuItemService.saveFetch(itemDTOList);
}
}
});
}
return ServiceResponse.success();
}
private ServiceResponse<Void> savePage(MenuDTO menuDTO, Class clazz) { private ServiceResponse<Void> savePage(MenuDTO menuDTO, Class clazz) {
ServiceResponse paramsValid = ValidParamsUtils.allCheckValidate(menuDTO, clazz); ServiceResponse paramsValid = ValidParamsUtils.allCheckValidate(menuDTO, clazz);
if (!paramsValid.isSuccess()) { if (!paramsValid.isSuccess()) {
...@@ -574,10 +682,36 @@ public class MenuApiServiceImpl implements MenuApiService { ...@@ -574,10 +682,36 @@ public class MenuApiServiceImpl implements MenuApiService {
setMenuVersion(menuDTO); setMenuVersion(menuDTO);
setNormalFieldValue(menuDTO); setNormalFieldValue(menuDTO);
setMenuAuthType(menuDTO);
menuService.savePage(menuDTO); menuService.savePage(menuDTO);
menuAuthDepartService.saveFetch(menuDTO.getMenuAuthDepartList());
return ServiceResponse.success(); return ServiceResponse.success();
} }
/**
* 奢姿权限适用字段数据
* @param menuDTO
* @return
*/
private void setMenuAuthType(MenuDTO menuDTO) {
Integer authType = menuDTO.getAuthType();
if (authType == null) {
authType = 1;
}
menuDTO.setAuthType(authType);
if (authType != 1) {
List<MenuAuthDepartDTO> list = menuDTO.getMenuAuthDepartList();
if (CollectionUtils.isNotEmpty(list)) {
Date now = new Date();
menuDTO.setMenuAuthDepartList(
list.stream().map(e -> e.setMenuCode(menuDTO.getMenuCode())
.setStatus(1)
.setCreateTime(now)
.setUpdateTime(now)).collect(Collectors.toList()));
}
}
}
private ServiceResponse<Integer> saveChildPage(MenuDTO menuDTO, Class clazz) { private ServiceResponse<Integer> saveChildPage(MenuDTO menuDTO, Class clazz) {
TabSysMenu record = menuService.getMenuById(menuDTO.getParentId()); TabSysMenu record = menuService.getMenuById(menuDTO.getParentId());
if (record == null) { if (record == null) {
...@@ -600,8 +734,10 @@ public class MenuApiServiceImpl implements MenuApiService { ...@@ -600,8 +734,10 @@ public class MenuApiServiceImpl implements MenuApiService {
} }
} }
setMenuVersion(menuDTO); setMenuVersion(menuDTO);
setMenuAuthType(menuDTO);
Integer menuId = menuService.savePage(menuDTO); Integer menuId = menuService.savePage(menuDTO);
menuAuthDepartService.saveFetch(menuDTO.getMenuAuthDepartList());
return ServiceResponse.success(menuId); return ServiceResponse.success(menuId);
} }
...@@ -649,7 +785,9 @@ public class MenuApiServiceImpl implements MenuApiService { ...@@ -649,7 +785,9 @@ public class MenuApiServiceImpl implements MenuApiService {
} }
} }
setMenuVersion(menuDTO); setMenuVersion(menuDTO);
setMenuAuthType(menuDTO);
menuService.updatePage(menuDTO); menuService.updatePage(menuDTO);
menuAuthDepartService.saveFetch(menuDTO.getMenuAuthDepartList());
//同时更新子集的父级code数据 //同时更新子集的父级code数据
menuService.updateParentCodeByParentId(menuDTO.getMenuId(), menuDTO.getMenuCode()); menuService.updateParentCodeByParentId(menuDTO.getMenuId(), menuDTO.getMenuCode());
...@@ -935,72 +1073,94 @@ public class MenuApiServiceImpl implements MenuApiService { ...@@ -935,72 +1073,94 @@ public class MenuApiServiceImpl implements MenuApiService {
* @Title: getUserLoginMenu
 * @Title: getUserLoginMenu

* @Description: * @Description:

 * @author guojuxing 
 * @author guojuxing
* @param enterpriseId * @param params
* @param userId
* @param currentMenu
* @param isGic
 是否是gic项目
* @param versionCode 如果是gic项目,则传的是基础服务版本,如果是应用,则传递的是应用ID
* @param isNeedTree 是否需要构建树结构
* @return com.gic.api.base.commons.ServiceResponse<java.util.List<com.gic.auth.dto.MenuDTO>>
 * @return com.gic.api.base.commons.ServiceResponse<java.util.List<com.gic.auth.dto.MenuDTO>>


 */ 
 */
private ServiceResponse<List<MenuDTO>> getUserLoginMenu(Integer enterpriseId, Integer userId, Integer currentMenu, boolean isGic, private ServiceResponse<List<MenuDTO>> getUserLoginMenu(UserMenuQO params) {
String versionCode, boolean isNeedTree) { boolean isNeedTree = params.isNeedTree();
//返回结果集定义声明
List<TabSysMenu> resultList;
boolean isGic = params.isGic();
//先查询登陆用户信息 //先查询登陆用户信息
TabSysUser tabSysUser = userService.getUserById(userId); TabSysUser tabSysUser = userService.getUserById(params.getUserId());
if (tabSysUser == null) { if (tabSysUser == null) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "用户不存在"); return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "用户不存在");
} }
//返回结果集定义声明
List<TabSysMenu> resultList;
if (isGic) { if (isGic) {
if (StringUtils.isBlank(versionCode)) { if (StringUtils.isBlank(params.getBaseVersionCode())) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "商户还没有订购基础服务"); return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "商户还没有订购基础服务");
} }
} }
if (tabSysUser.getSuperAdmin().intValue() == 1) { //是否是运维用户
//超级用户 params.setOperationUser(tabSysUser.getLoginType().intValue() != 0);
MenuListQO params = new MenuListQO();
params.setMenuType(MenuTypeEnum.PAGE.getCode()); //超级用户
if (isGic) { MenuListQO menuListParams = new MenuListQO();
params.setVersionCode(versionCode); menuListParams.setMenuType(MenuTypeEnum.PAGE.getCode());
params.setIsGIC(MenuProjectConstants.DEFAULT_PROJECT_CODE); if (isGic) {
} else { menuListParams.setVersionCode(params.getBaseVersionCode());
params.setProject(versionCode); menuListParams.setIsGIC(MenuProjectConstants.DEFAULT_PROJECT_CODE);
params.setIsGIC(MenuProjectConstants.APP_PROJECT_CODE);
}
resultList = this.menuService.listMenu(params);
} else { } else {
//用户拥有的菜单权限 menuListParams.setProject(params.getAppId());
List<TabSysMenu> menuList = getUserMenuList(userId); menuListParams.setIsGIC(MenuProjectConstants.APP_PROJECT_CODE);
List<Integer> menuIdList = new ArrayList<>(); }
for (TabSysMenu menu : menuList) {
//符合条件的菜单ID if (params.isOperationUser()) {
boolean isMapMenu; resultList = this.menuService.listMenu(menuListParams);
if (isGic) {
isMapMenu = menu.getMenuType().intValue() == MenuTypeEnum.PAGE.getCode() //todo 运营人员的部门职位;根据手机号查询运维人员的部门职位信息
&& menu.getProject().equals(MenuProjectConstants.DEFAULT_PROJECT); //如果是运营人员
} else { Set<String> departPosition = new HashSet<>(2);
isMapMenu = menu.getMenuType().intValue() == MenuTypeEnum.PAGE.getCode() //过滤运营人员的部门职位权限
&& menu.getProject().equals(versionCode); Map<String, List<TabSysMenuAuthDepart>> departMap = getAuthDepartMap(null);
resultList = resultList.stream().filter(e -> {
List<TabSysMenuAuthDepart> authList = departMap.get(e.getMenuCode());
if (authList == null) {
//如果是空的,说明是全部权限
return true;
}
//验证departPosition是否存在一个于authList中
if (authList.stream().anyMatch(auth -> departPosition.contains(auth.getDepartCode() + "-" + auth.getPositionCode()))) {
return true;
} }
if (isMapMenu) { return false;
menuIdList.add(menu.getMenuId()); }).collect(Collectors.toList());
} else {
if (tabSysUser.getSuperAdmin().intValue() == 1) {
//超级用户
//1:管理员权限集 2:商户级超管及达摩侧人员
menuListParams.setAuthTypeList(Arrays.asList(new Integer[]{1, 2}));
resultList = this.menuService.listMenu(menuListParams);
} else {
//用户拥有的菜单权限
List<TabSysMenu> menuList = getUserMenuList(params.getUserId());
List<Integer> menuIdList = new ArrayList<>();
for (TabSysMenu menu : menuList) {
//符合条件的菜单ID
boolean isMapMenu;
if (isGic) {
isMapMenu = menu.getMenuType().intValue() == MenuTypeEnum.PAGE.getCode()
&& menu.getProject().equals(MenuProjectConstants.DEFAULT_PROJECT);
} else {
isMapMenu = menu.getMenuType().intValue() == MenuTypeEnum.PAGE.getCode()
&& menu.getProject().equals(params.getAppId());
}
if (isMapMenu) {
menuIdList.add(menu.getMenuId());
}
} }
resultList = menuService.selectByIdsAndOrderBy(menuIdList, " order by sort");
} }
resultList = menuService.selectByIdsAndOrderBy(menuIdList, " order by sort");
}
int level = 1;
int parentId = 0;
if (currentMenu != null) {
TabSysMenu menu = this.menuService.getMenuById(currentMenu);
parentId = currentMenu;
level = menu.getLevel() + 1;
} }
Map<String, Object> resourcePage = getBusinessFrontRes(enterpriseId); Map<String, Object> resourcePage = getBusinessFrontRes(params.getEnterpriseId());
List<TabSysMenu> tempList = new ArrayList<>(); List<TabSysMenu> tempList = new ArrayList<>();
for (TabSysMenu menu : resultList) { for (TabSysMenu menu : resultList) {
if (resourcePage.containsKey(menu.getMenuCode())) { if (resourcePage.containsKey(menu.getMenuCode())) {
...@@ -1011,12 +1171,28 @@ public class MenuApiServiceImpl implements MenuApiService { ...@@ -1011,12 +1171,28 @@ public class MenuApiServiceImpl implements MenuApiService {
} }
if (isNeedTree) { if (isNeedTree) {
return ServiceResponse.success(this.treeMenu(tempList, level, parentId)); return ServiceResponse.success(this.treeMenu(tempList, 1, 0));
} else { } else {
return ServiceResponse.success(EntityUtil.changeEntityListNew(MenuDTO.class, tempList)); return ServiceResponse.success(EntityUtil.changeEntityListNew(MenuDTO.class, tempList));
} }
} }
/**
* 查询出所有的部门职位,用于过滤运营人员权限
* @param menuCodeList
* @return
*/
private Map<String, List<TabSysMenuAuthDepart>> getAuthDepartMap(List<String> menuCodeList) {
//设置部门数据,列表需要展示
List<TabSysMenuAuthDepart> authDepartList = menuAuthDepartService
.listAllAuthDepart(menuCodeList);
if (CollectionUtils.isNotEmpty(authDepartList)) {
Map<String, List<TabSysMenuAuthDepart>> authDepartMap = CollectionUtil.group(authDepartList, "menuCode");
return authDepartMap;
}
return new HashMap<>(2);
}
private ServiceResponse<List<MenuDTO>> getAppMenuPage(Integer enterpriseId, List<Integer> menuIdList, String appId) { private ServiceResponse<List<MenuDTO>> getAppMenuPage(Integer enterpriseId, List<Integer> menuIdList, String appId) {
//返回结果集定义声明 //返回结果集定义声明
List<TabSysMenu> resultList = menuService.selectByIdsAndOrderBy(menuIdList, " order by sort"); List<TabSysMenu> resultList = menuService.selectByIdsAndOrderBy(menuIdList, " order by sort");
......
...@@ -134,6 +134,15 @@ public class UserApiServiceImpl implements UserApiService { ...@@ -134,6 +134,15 @@ public class UserApiServiceImpl implements UserApiService {
} }
@Override @Override
public ServiceResponse<Void> updateOperationUser(Integer userId, String userName) {
UserDTO userDTO = new UserDTO();
userDTO.setUserId(userId);
userDTO.setUserName(userName);
userService.editUser(userDTO);
return ServiceResponse.success();
}
@Override
public ServiceResponse<Integer> saveAdmin(UserDTO userDTO) { public ServiceResponse<Integer> saveAdmin(UserDTO userDTO) {
//valid param //valid param
ServiceResponse paramResult = ValidUtil.allCheckValidate(userDTO, UserDTO.SaveUserValid.class); ServiceResponse paramResult = ValidUtil.allCheckValidate(userDTO, UserDTO.SaveUserValid.class);
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gic.auth.dao.mapper.TabSysMenuAuthDepartMapper">
<resultMap id="BaseResultMap" type="com.gic.auth.entity.TabSysMenuAuthDepart">
<id column="menu_depart_id" jdbcType="INTEGER" property="menuDepartId" />
<result column="menu_code" jdbcType="VARCHAR" property="menuCode" />
<result column="depart_code" jdbcType="VARCHAR" property="departCode" />
<result column="depart_name" jdbcType="VARCHAR" property="departName" />
<result column="position_code" jdbcType="VARCHAR" property="positionCode" />
<result column="position_name" jdbcType="VARCHAR" property="positionName" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
menu_depart_id, menu_code, depart_code, depart_name, position_code, position_name,
status, create_time, update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_sys_menu_auth_depart
where menu_depart_id = #{menuDepartId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tab_sys_menu_auth_depart
where menu_depart_id = #{menuDepartId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.gic.auth.entity.TabSysMenuAuthDepart">
insert into tab_sys_menu_auth_depart (menu_depart_id, menu_code, depart_code,
depart_name, position_code, position_name,
status, create_time, update_time
)
values (#{menuDepartId,jdbcType=INTEGER}, #{menuCode,jdbcType=VARCHAR}, #{departCode,jdbcType=VARCHAR},
#{departName,jdbcType=VARCHAR}, #{positionCode,jdbcType=VARCHAR}, #{positionName,jdbcType=VARCHAR},
#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" parameterType="com.gic.auth.entity.TabSysMenuAuthDepart">
insert into tab_sys_menu_auth_depart
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="menuDepartId != null">
menu_depart_id,
</if>
<if test="menuCode != null">
menu_code,
</if>
<if test="departCode != null">
depart_code,
</if>
<if test="departName != null">
depart_name,
</if>
<if test="positionCode != null">
position_code,
</if>
<if test="positionName != null">
position_name,
</if>
<if test="status != null">
status,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="menuDepartId != null">
#{menuDepartId,jdbcType=INTEGER},
</if>
<if test="menuCode != null">
#{menuCode,jdbcType=VARCHAR},
</if>
<if test="departCode != null">
#{departCode,jdbcType=VARCHAR},
</if>
<if test="departName != null">
#{departName,jdbcType=VARCHAR},
</if>
<if test="positionCode != null">
#{positionCode,jdbcType=VARCHAR},
</if>
<if test="positionName != null">
#{positionName,jdbcType=VARCHAR},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.auth.entity.TabSysMenuAuthDepart">
update tab_sys_menu_auth_depart
<set>
<if test="menuCode != null">
menu_code = #{menuCode,jdbcType=VARCHAR},
</if>
<if test="departCode != null">
depart_code = #{departCode,jdbcType=VARCHAR},
</if>
<if test="departName != null">
depart_name = #{departName,jdbcType=VARCHAR},
</if>
<if test="positionCode != null">
position_code = #{positionCode,jdbcType=VARCHAR},
</if>
<if test="positionName != null">
position_name = #{positionName,jdbcType=VARCHAR},
</if>
<if test="status != null">
status = #{status,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where menu_depart_id = #{menuDepartId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.auth.entity.TabSysMenuAuthDepart">
update tab_sys_menu_auth_depart
set menu_code = #{menuCode,jdbcType=VARCHAR},
depart_code = #{departCode,jdbcType=VARCHAR},
depart_name = #{departName,jdbcType=VARCHAR},
position_code = #{positionCode,jdbcType=VARCHAR},
position_name = #{positionName,jdbcType=VARCHAR},
status = #{status,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where menu_depart_id = #{menuDepartId,jdbcType=INTEGER}
</update>
<insert id="saveFetch" parameterType="java.util.List">
insert into tab_sys_menu_auth_depart (menu_depart_id, menu_code, depart_code,
depart_name, position_code, position_name,
status, create_time, update_time
)
values
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.menuDepartId},
#{item.menuCode},
#{item.departCode},
#{item.departName},
#{item.positionCode},
#{item.positionName},
#{item.status},
#{item.createTime},
#{item.updateTime}
)
</foreach>
</insert>
<update id="deleteByMenuCode">
update tab_sys_menu_auth_depart set status = 0
where status = 1
and menu_code = #{menuCode}
</update>
<select id="listAuthDepartByMenuCode" resultMap="BaseResultMap">
select <include refid="Base_Column_List"></include>
from tab_sys_menu_auth_depart
where menu_code = #{menuCode}
and status = 1
</select>
<select id="listAllAuthDepart" resultMap="BaseResultMap">
select <include refid="Base_Column_List"></include>
from tab_sys_menu_auth_depart
where status = 1
<if test="list != null and list.size() > 0">
and menu_code in
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
</mapper>
\ No newline at end of file
...@@ -185,4 +185,11 @@ ...@@ -185,4 +185,11 @@
and item_id = #{itemId} and item_id = #{itemId}
</if> </if>
</update> </update>
<select id="listByDev" resultMap="BaseResultMap">
select <include refid="Base_Column_List"></include>
from tab_sys_menu_item_dev
where status = 1
and menu_id = #{menuId}
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -22,11 +22,12 @@ ...@@ -22,11 +22,12 @@
<result column="menu_version_name" jdbcType="VARCHAR" property="menuVersionName" /> <result column="menu_version_name" jdbcType="VARCHAR" property="menuVersionName" />
<result column="project_url_for_web" jdbcType="VARCHAR" property="projectUrlForWeb" /> <result column="project_url_for_web" jdbcType="VARCHAR" property="projectUrlForWeb" />
<result column="admin_only_sign" jdbcType="INTEGER" property="adminOnlySign" /> <result column="admin_only_sign" jdbcType="INTEGER" property="adminOnlySign" />
<result column="auth_type" jdbcType="INTEGER" property="authType" />
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
menu_id, menu_name, project, menu_url, parent_id, target, icon_url, sort, status, menu_id, menu_name, project, menu_url, parent_id, target, icon_url, sort, status,
create_time, update_time, level, is_show, menu_code, parent_code, menu_version, menu_type, create_time, update_time, level, is_show, menu_code, parent_code, menu_version, menu_type,
menu_version_name, project_url_for_web, admin_only_sign menu_version_name, project_url_for_web, admin_only_sign, auth_type
</sql> </sql>
<sql id="tree_filter"> <sql id="tree_filter">
and menu_type != 2 and menu_type != 2
...@@ -57,14 +58,14 @@ ...@@ -57,14 +58,14 @@
create_time, update_time, level, create_time, update_time, level,
is_show, menu_code, parent_code, is_show, menu_code, parent_code,
menu_version, menu_type, menu_version_name, menu_version, menu_type, menu_version_name,
project_url_for_web, admin_only_sign) project_url_for_web, admin_only_sign, auth_type)
values (#{menuId,jdbcType=INTEGER}, #{menuName,jdbcType=VARCHAR}, #{project,jdbcType=VARCHAR}, values (#{menuId,jdbcType=INTEGER}, #{menuName,jdbcType=VARCHAR}, #{project,jdbcType=VARCHAR},
#{menuUrl,jdbcType=VARCHAR}, #{parentId,jdbcType=INTEGER}, #{target,jdbcType=INTEGER}, #{menuUrl,jdbcType=VARCHAR}, #{parentId,jdbcType=INTEGER}, #{target,jdbcType=INTEGER},
#{iconUrl,jdbcType=VARCHAR}, #{sort,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, #{iconUrl,jdbcType=VARCHAR}, #{sort,jdbcType=INTEGER}, #{status,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{level,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{level,jdbcType=INTEGER},
#{isShow,jdbcType=INTEGER}, #{menuCode,jdbcType=VARCHAR}, #{parentCode,jdbcType=VARCHAR}, #{isShow,jdbcType=INTEGER}, #{menuCode,jdbcType=VARCHAR}, #{parentCode,jdbcType=VARCHAR},
#{menuVersion,jdbcType=VARCHAR}, #{menuType,jdbcType=INTEGER}, #{menuVersionName,jdbcType=VARCHAR}, #{menuVersion,jdbcType=VARCHAR}, #{menuType,jdbcType=INTEGER}, #{menuVersionName,jdbcType=VARCHAR},
#{projectUrlForWeb,jdbcType=VARCHAR}, #{adminOnlySign,jdbcType=INTEGER}) #{projectUrlForWeb,jdbcType=VARCHAR}, #{adminOnlySign,jdbcType=INTEGER}, #{authType,jdbcType=INTEGER})
</insert> </insert>
<insert id="insertSelective" keyProperty="menuId" parameterType="com.gic.auth.entity.TabSysMenu" useGeneratedKeys="true"> <insert id="insertSelective" keyProperty="menuId" parameterType="com.gic.auth.entity.TabSysMenu" useGeneratedKeys="true">
insert into tab_sys_menu insert into tab_sys_menu
...@@ -129,6 +130,9 @@ ...@@ -129,6 +130,9 @@
<if test="adminOnlySign != null"> <if test="adminOnlySign != null">
admin_only_sign, admin_only_sign,
</if> </if>
<if test="authType != null">
auth_type,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="menuId != null"> <if test="menuId != null">
...@@ -191,6 +195,9 @@ ...@@ -191,6 +195,9 @@
<if test="adminOnlySign != null"> <if test="adminOnlySign != null">
#{adminOnlySign,jdbcType=INTEGER}, #{adminOnlySign,jdbcType=INTEGER},
</if> </if>
<if test="authType != null">
#{authType,jdbcType=INTEGER},
</if>
</trim> </trim>
</insert> </insert>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.auth.entity.TabSysMenu"> <update id="updateByPrimaryKeySelective" parameterType="com.gic.auth.entity.TabSysMenu">
...@@ -253,6 +260,9 @@ ...@@ -253,6 +260,9 @@
<if test="adminOnlySign != null"> <if test="adminOnlySign != null">
admin_only_sign = #{adminOnlySign,jdbcType=INTEGER}, admin_only_sign = #{adminOnlySign,jdbcType=INTEGER},
</if> </if>
<if test="authType != null">
auth_type = #{authType,jdbcType=INTEGER},
</if>
</set> </set>
where menu_id = #{menuId,jdbcType=INTEGER} where menu_id = #{menuId,jdbcType=INTEGER}
</update> </update>
...@@ -276,7 +286,8 @@ ...@@ -276,7 +286,8 @@
menu_type = #{menuType,jdbcType=INTEGER}, menu_type = #{menuType,jdbcType=INTEGER},
menu_version_name = #{menuVersionName,jdbcType=VARCHAR}, menu_version_name = #{menuVersionName,jdbcType=VARCHAR},
project_url_for_web = #{projectUrlForWeb,jdbcType=VARCHAR}, project_url_for_web = #{projectUrlForWeb,jdbcType=VARCHAR},
admin_only_sign = #{adminOnlySign,jdbcType=INTEGER} admin_only_sign = #{adminOnlySign,jdbcType=INTEGER},
auth_type = #{authType,jdbcType=INTEGER}
where menu_id = #{menuId,jdbcType=INTEGER} where menu_id = #{menuId,jdbcType=INTEGER}
</update> </update>
...@@ -312,6 +323,12 @@ ...@@ -312,6 +323,12 @@
<if test="versionCode != null and versionCode != '' "> <if test="versionCode != null and versionCode != '' ">
and menu_version like concat('%_', #{versionCode}, '_%' ) and menu_version like concat('%_', #{versionCode}, '_%' )
</if> </if>
<if test="authTypeList != null and authTypeList.size() > 0">
and auth_type in
<foreach close=")" collection="authTypeList" index="index" item="item" open="(" separator=",">
#{item}
</foreach>
</if>
order by level,sort order by level,sort
</select> </select>
...@@ -538,4 +555,37 @@ ...@@ -538,4 +555,37 @@
</foreach> </foreach>
</if> </if>
</update> </update>
<select id="listMenuTemp" resultMap="BaseResultMap">
select <include refid="Base_Column_List"></include>
from tab_sys_menu_dev
where status = 1
and project = #{project}
</select>
<select id="getAuthItemByDevMenuId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
FROM
tab_sys_menu
WHERE
status = 1
and menu_code IN (
SELECT
menu_code
FROM
tab_sys_menu_dev
WHERE
status = 1 and
menu_id IN (
SELECT
item_id
FROM
tab_sys_menu_item_dev
WHERE
menu_id = #{menuId}
and status = 1
)
)
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -115,6 +115,8 @@ ...@@ -115,6 +115,8 @@
<if test="search != null and search != '' "> <if test="search != null and search != '' ">
and ( a.role_name like concat('%', #{search}, '%') ) and ( a.role_name like concat('%', #{search}, '%') )
</if> </if>
order by a.create_time desc
</select> </select>
<update id="deleteByRoleId"> <update id="deleteByRoleId">
......
...@@ -6,7 +6,9 @@ import java.util.List; ...@@ -6,7 +6,9 @@ import java.util.List;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import com.gic.auth.dto.*;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -19,10 +21,6 @@ import com.gic.api.base.commons.Page; ...@@ -19,10 +21,6 @@ import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse; import com.gic.api.base.commons.ServiceResponse;
import com.gic.auth.constant.AccountGroupMemberTypeEnum; import com.gic.auth.constant.AccountGroupMemberTypeEnum;
import com.gic.auth.constant.SignConstants; import com.gic.auth.constant.SignConstants;
import com.gic.auth.dto.AccountGroupDTO;
import com.gic.auth.dto.AccountGroupMemberDTO;
import com.gic.auth.dto.CollaboratorListDTO;
import com.gic.auth.dto.UserListDTO;
import com.gic.auth.qo.CollaboratorListQO; import com.gic.auth.qo.CollaboratorListQO;
import com.gic.auth.qo.UserListQO; import com.gic.auth.qo.UserListQO;
import com.gic.auth.service.AccountGroupApiService; import com.gic.auth.service.AccountGroupApiService;
...@@ -162,8 +160,19 @@ public class AccountGroupController { ...@@ -162,8 +160,19 @@ public class AccountGroupController {
for (String str : accountGroupIdArr) { for (String str : accountGroupIdArr) {
accountGroupIdList.add(Integer.parseInt(str)); accountGroupIdList.add(Integer.parseInt(str));
} }
ServiceResponse<UserDTO> userResponse = userApiService.getUserByEnterpriseId(UserDetailUtils.getUserDetail().getEnterpriseId());
if (!userResponse.isSuccess()) {
return RestResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "超级管理员数据有误");
}
Integer adminUserId = userResponse.getResult().getUserId();
List<Integer> userIdList = new ArrayList<>(userIdArr.length); List<Integer> userIdList = new ArrayList<>(userIdArr.length);
for (String str : userIdArr) { for (String str : userIdArr) {
if (StringUtils.isBlank(str)) {
continue;
}
if (str.equals(adminUserId.toString())) {
return RestResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "超级管理员不能转移");
}
userIdList.add(Integer.parseInt(str)); userIdList.add(Integer.parseInt(str));
} }
Integer enterpriseId = UserDetailUtils.getUserDetail().getEnterpriseId(); Integer enterpriseId = UserDetailUtils.getUserDetail().getEnterpriseId();
......
package com.gic.auth.web.controller; package com.gic.auth.web.controller;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
import com.gic.auth.constant.MenuProjectConstants;
import com.gic.auth.web.utils.EnterpriseBasicAppUtils;
import com.gic.log.api.dto.LogSearchDTO;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse; import com.gic.api.base.commons.ServiceResponse;
import com.gic.auth.constant.MenuLevelConstants; import com.gic.auth.constant.MenuLevelConstants;
import com.gic.auth.constant.MenuTypeEnum;
import com.gic.auth.dto.MenuDTO; import com.gic.auth.dto.MenuDTO;
import com.gic.auth.dto.UserDTO; import com.gic.auth.dto.UserDTO;
import com.gic.auth.qo.MenuListQO; import com.gic.auth.qo.UserMenuQO;
import com.gic.auth.service.CollaboratorApiService; import com.gic.auth.service.CollaboratorApiService;
import com.gic.auth.service.MenuApiService; import com.gic.auth.service.MenuApiService;
import com.gic.auth.service.MenuItemApiService; import com.gic.auth.service.MenuItemApiService;
import com.gic.auth.service.UserApiService; import com.gic.auth.service.UserApiService;
import com.gic.auth.web.utils.EnterpriseBasicAppUtils;
import com.gic.auth.web.vo.LogListVO; import com.gic.auth.web.vo.LogListVO;
import com.gic.auth.web.vo.UserOperationItemAuthVO; import com.gic.auth.web.vo.UserOperationItemAuthVO;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
import com.gic.commons.webapi.reponse.RestResponse; import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.enterprise.ano.IgnoreLogin;
import com.gic.enterprise.qo.PageQO; import com.gic.enterprise.qo.PageQO;
import com.gic.enterprise.response.EnterpriseRestResponse; import com.gic.enterprise.response.EnterpriseRestResponse;
import com.gic.enterprise.utils.ResultControllerUtils; import com.gic.enterprise.utils.ResultControllerUtils;
import com.gic.enterprise.utils.UserDetail; import com.gic.enterprise.utils.UserDetail;
import com.gic.enterprise.utils.UserDetailUtils; import com.gic.enterprise.utils.UserDetailUtils;
import com.gic.log.api.dto.LogSearchDTO;
import com.gic.log.api.dto.SystemSetLogDTO; import com.gic.log.api.dto.SystemSetLogDTO;
import com.gic.log.api.service.LogApiService; import com.gic.log.api.service.LogApiService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@RestController @RestController
public class MenuController { public class MenuController {
...@@ -64,8 +62,9 @@ public class MenuController { ...@@ -64,8 +62,9 @@ public class MenuController {

*/ 
*/
@RequestMapping("login-user-menu") @RequestMapping("login-user-menu")
public RestResponse loginUserMenu(Integer currentMenu) { public RestResponse loginUserMenu(Integer currentMenu) {
Integer userId = UserDetailUtils.getUserDetail().getUserId(); UserDetail userDetail = UserDetailUtils.getUserDetail();
Integer enterpriseId = UserDetailUtils.getUserDetail().getEnterpriseId(); Integer userId = userDetail.getUserId();
Integer enterpriseId = userDetail.getEnterpriseId();
ServiceResponse<List<MenuDTO>> userMenu = this.menuApiService.getUserMenuOfGic(enterpriseId, userId, ServiceResponse<List<MenuDTO>> userMenu = this.menuApiService.getUserMenuOfGic(enterpriseId, userId,
currentMenu, UserDetailUtils.getUserDetail().getEnterpriseInfo().getVersionCode()); currentMenu, UserDetailUtils.getUserDetail().getEnterpriseInfo().getVersionCode());
if (userMenu.isSuccess()) { if (userMenu.isSuccess()) {
...@@ -110,6 +109,12 @@ public class MenuController { ...@@ -110,6 +109,12 @@ public class MenuController {
return RestResponse.success(getAppId(null, menuCode)); return RestResponse.success(getAppId(null, menuCode));
} }
@RequestMapping("sync-menu-to-pro")
@IgnoreLogin
public RestResponse syncMenuToPro(String menuCode) {
return RestResponse.success(menuApiService.syncProductMenu(menuCode));
}
@RequestMapping("login-collaborator-menu-of-app") @RequestMapping("login-collaborator-menu-of-app")
public RestResponse getCollaboratorMenu(String appId, String menuCode) { public RestResponse getCollaboratorMenu(String appId, String menuCode) {
LOGGER.info("查询登录用户的协作应用的菜单参数:{}-{}", appId, menuCode); LOGGER.info("查询登录用户的协作应用的菜单参数:{}-{}", appId, menuCode);
...@@ -188,7 +193,8 @@ public class MenuController { ...@@ -188,7 +193,8 @@ public class MenuController {
public RestResponse listMenuPageTree() { public RestResponse listMenuPageTree() {
UserDetail userDetail = UserDetailUtils.getUserDetail(); UserDetail userDetail = UserDetailUtils.getUserDetail();
//权限控制 //权限控制
ServiceResponse<List<MenuDTO>> result = menuApiService.getUserMenuOfGicNotTree(userDetail.getEnterpriseId(), ServiceResponse<List<MenuDTO>> result = menuApiService
.getUserMenuOfGicNotTree(userDetail.getEnterpriseId(),
userDetail.getUserId(), null, userDetail.getEnterpriseInfo().getVersionCode()); userDetail.getUserId(), null, userDetail.getEnterpriseInfo().getVersionCode());
if (result.isSuccess()) { if (result.isSuccess()) {
return RestResponse return RestResponse
...@@ -275,7 +281,7 @@ public class MenuController { ...@@ -275,7 +281,7 @@ public class MenuController {
} }
searchParam.setRelationIdList(relationIdList); searchParam.setRelationIdList(relationIdList);
} }
SimpleDateFormat sdf = new SimpleDateFormat("YYYY-MM-dd HH:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if (StringUtils.isNotBlank(startTime)) { if (StringUtils.isNotBlank(startTime)) {
startTime = startTime + " 00:00:00"; startTime = startTime + " 00:00:00";
searchParam.setLogTimeBegin(sdf.parse(startTime)); searchParam.setLogTimeBegin(sdf.parse(startTime));
......
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