Commit 4c03761d by 墨竹

feat:小程序生成默认权限

parent 7a41a380
package com.gic.haoban.manage.api.enums.role;
/**
* 好办小程序角色
*
* @author mozhu
* @date 2022-09-14 10:51:26
*/
public enum RoleClerkTypeEnum {
//0:导购;1:店长;2:区经
CLERK(0, "导购"),
SHOP(1, "店长"),
MANAGE(2, "区经");
private Integer code;
private String desc;
RoleClerkTypeEnum(Integer code, String desc) {
this.code = code;
this.desc = desc;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
}
...@@ -237,4 +237,13 @@ public interface WxEnterpriseApiService { ...@@ -237,4 +237,13 @@ public interface WxEnterpriseApiService {
public String getEndDate(String enterpriseId) ; public String getEndDate(String enterpriseId) ;
/**
* 默认生成好办小程序权限
*
* @param wxEnterpriseId wx企业标识
* @author mozhu
* @date 2022-09-14 11:07:24
*/
void addHaobanRole(String wxEnterpriseId);
} }
...@@ -34,15 +34,13 @@ public interface HaobanRoleApiService { ...@@ -34,15 +34,13 @@ public interface HaobanRoleApiService {
/** /**
* 根据类型查询企业的菜单权限 * 根据类型查询企业的菜单权限
*
* @param enterpriseId 企业标识
* @param wxEnterpriseId wx企业标识 * @param wxEnterpriseId wx企业标识
* @param clerkType 职员类型 * @param clerkType 职员类型
* @return {@link ServiceResponse } * @return {@link ServiceResponse }
* @author mozhu * @author mozhu
* @date 2022-09-07 14:02:21 * @date 2022-09-07 14:02:21
*/ */
ServiceResponse getByEnterpriseIdAndClerkType(String enterpriseId,String wxEnterpriseId,Integer clerkType); ServiceResponse getByWxEnterpriseIdAndClerkType(String wxEnterpriseId, Integer clerkType);
/** /**
......
...@@ -46,17 +46,46 @@ public interface TabHaobanRoleMapper { ...@@ -46,17 +46,46 @@ public interface TabHaobanRoleMapper {
int update(TabHaobanRole tabHaobanRole); int update(TabHaobanRole tabHaobanRole);
/** /**
* 按角色删除id
*
* @param roleId 角色id
* @return int
* @author mozhu
* @date 2022-09-14 10:13:03
*/
int deleteByRoleId(Long roleId);
/**
* 根据类型查询企业的菜单权限 * 根据类型查询企业的菜单权限
* *
* @param enterpriseId 企业标识
* @param wxEnterpriseId wx企业标识 * @param wxEnterpriseId wx企业标识
* @param clerkType 职员类型 * @param clerkType 职员类型
* @return {@link List }<{@link TabHaobanRole }> * @return {@link List }<{@link TabHaobanRole }>
* @author mozhu * @author mozhu
* @date 2022-09-07 14:09:07 * @date 2022-09-07 14:09:07
*/ */
List<TabHaobanRole> getByEnterpriseIdAndClerkType(@Param("enterpriseId") String enterpriseId, List<TabHaobanRole> getByWxEnterpriseIdAndClerkType(@Param("wxEnterpriseId") String wxEnterpriseId,
@Param("wxEnterpriseId") String wxEnterpriseId, @Param("clerkType") Integer clerkType);
@Param("clerkType") Integer clerkType);
/**
* 根据wx企业id获取数量
*
* @param wxEnterpriseId wx企业标识
* @return int
* @author mozhu
* @date 2022-09-14 10:36:05
*/
int getCountByWxEnterpriseId(@Param("wxEnterpriseId") String wxEnterpriseId);
/**
* 根据wx企业id 删除
*
* @param wxEnterpriseId wx企业标识
* @return int
* @author mozhu
* @date 2022-09-14 10:17:21
*/
int deleteByWxEnterpriseId(String wxEnterpriseId);
} }
...@@ -74,5 +74,15 @@ public interface TabHaobanRoleMenuMapper { ...@@ -74,5 +74,15 @@ public interface TabHaobanRoleMenuMapper {
*/ */
List<String> getByWxEnterpriseIdAndRoleId(@Param("wxEnterpriseId") String wxEnterpriseId, List<String> getByWxEnterpriseIdAndRoleId(@Param("wxEnterpriseId") String wxEnterpriseId,
@Param("roleId") Long roleId); @Param("roleId") Long roleId);
/**
* 根据wx企业id 删除
*
* @param wxEnterpriseId wx企业标识
* @return boolean
* @author mozhu
* @date 2022-09-14 10:40:18
*/
boolean deleteByWxEnterpriseId(@Param("wxEnterpriseId") String wxEnterpriseId);
} }
package com.gic.haoban.manage.service.service.out.impl; package com.gic.haoban.manage.service.service.out.impl;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
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.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.ServiceResponse; import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.DateUtil; import com.gic.commons.util.DateUtil;
...@@ -26,37 +8,38 @@ import com.gic.enterprise.api.constant.EnterpriseServiceEnum; ...@@ -26,37 +8,38 @@ import com.gic.enterprise.api.constant.EnterpriseServiceEnum;
import com.gic.enterprise.api.dto.EnterpriseUsingPermissionDto; import com.gic.enterprise.api.dto.EnterpriseUsingPermissionDto;
import com.gic.enterprise.api.service.EnterpriseUseForbidService; import com.gic.enterprise.api.service.EnterpriseUseForbidService;
import com.gic.haoban.base.api.common.BasePageInfo; import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.base.api.common.pojo.dto.WebLoginDTO;
import com.gic.haoban.common.utils.PageUtil; import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.manage.api.dto.CommonMQDTO; import com.gic.haoban.manage.api.dto.*;
import com.gic.haoban.manage.api.dto.MiniprogramSettingDTO; import com.gic.haoban.manage.api.dto.qdto.role.HaobanRoleMenuQDTO;
import com.gic.haoban.manage.api.dto.QywxCorpInfoSimpleDTO; import com.gic.haoban.manage.api.dto.qdto.role.HaobanRoleQDTO;
import com.gic.haoban.manage.api.dto.SecretSettingDTO;
import com.gic.haoban.manage.api.dto.StaffPrivacyUseLogDTO;
import com.gic.haoban.manage.api.dto.WelcomeDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO;
import com.gic.haoban.manage.api.dto.YwWxEnterpriseDTO;
import com.gic.haoban.manage.api.enums.SecretTypeEnum; import com.gic.haoban.manage.api.enums.SecretTypeEnum;
import com.gic.haoban.manage.api.enums.role.RoleClerkTypeEnum;
import com.gic.haoban.manage.api.service.HaobanCommonMQApiService; import com.gic.haoban.manage.api.service.HaobanCommonMQApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseApiService; import com.gic.haoban.manage.api.service.WxEnterpriseApiService;
import com.gic.haoban.manage.api.service.role.HaobanRoleApiService;
import com.gic.haoban.manage.service.config.Config; import com.gic.haoban.manage.service.config.Config;
import com.gic.haoban.manage.service.dao.mapper.TabHaobanWelcomeMapper; import com.gic.haoban.manage.service.dao.mapper.TabHaobanWelcomeMapper;
import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseMapper; import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseMapper;
import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseRelatedMapper; import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseRelatedMapper;
import com.gic.haoban.manage.service.entity.TabHaobanWxApplication; import com.gic.haoban.manage.service.entity.*;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterpriseRelated;
import com.gic.haoban.manage.service.entity.TabMiniprogramSetting;
import com.gic.haoban.manage.service.entity.TabWelcome;
import com.gic.haoban.manage.service.pojo.bo.StaffPrivacyUseLogBO; import com.gic.haoban.manage.service.pojo.bo.StaffPrivacyUseLogBO;
import com.gic.haoban.manage.service.service.MiniprogramSettingService; import com.gic.haoban.manage.service.pojo.bo.role.HaobanRoleBO;
import com.gic.haoban.manage.service.service.SecretSettingService; import com.gic.haoban.manage.service.service.*;
import com.gic.haoban.manage.service.service.StaffPrivacyUseLogService; import com.gic.haoban.manage.service.service.role.HaobanRoleMenuService;
import com.gic.haoban.manage.service.service.WxApplicationService; import com.gic.haoban.manage.service.service.role.HaobanRoleService;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.wechat.api.service.qywx.QywxUserApiService; import com.gic.wechat.api.service.qywx.QywxUserApiService;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
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.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
@Service @Service
public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService { public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
...@@ -85,6 +68,13 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService { ...@@ -85,6 +68,13 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
private EnterpriseUseForbidService enterpriseUseForbidService; private EnterpriseUseForbidService enterpriseUseForbidService;
@Autowired @Autowired
private HaobanCommonMQApiService haobanCommonMQApiService ; private HaobanCommonMQApiService haobanCommonMQApiService ;
@Autowired
private HaobanRoleMenuService haobanRoleMenuService;
@Autowired
private HaobanRoleService haobanRoleService;
@Autowired
private HaobanRoleApiService haobanRoleApiService;
@Override @Override
public void callbackReviceEnterprise(QywxCorpInfoSimpleDTO dto) { public void callbackReviceEnterprise(QywxCorpInfoSimpleDTO dto) {
...@@ -132,6 +122,9 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService { ...@@ -132,6 +122,9 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
} }
wxDTO.setWxSecurityType(2); wxDTO.setWxSecurityType(2);
wxEnterpriseId = wxEnterpriseService.add(wxDTO); wxEnterpriseId = wxEnterpriseService.add(wxDTO);
//好办小程序插入权限
log.info("插入好办小程序权限:{}",wxEnterpriseId);
addHaobanRole(wxEnterpriseId);
} }
TabHaobanWxApplication haobanWxApplication = wxApplicationService.selectBySiteIdAndWxEnterpriseId(siteId, wxEnterpriseId); TabHaobanWxApplication haobanWxApplication = wxApplicationService.selectBySiteIdAndWxEnterpriseId(siteId, wxEnterpriseId);
if (haobanWxApplication == null) { if (haobanWxApplication == null) {
...@@ -192,6 +185,7 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService { ...@@ -192,6 +185,7 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
} }
agreeExternalUseridFlag(wxEnterpriseId, 1); agreeExternalUseridFlag(wxEnterpriseId, 1);
this.wxEnterpriseService.updateWxSecurityType(wxEnterpriseId); this.wxEnterpriseService.updateWxSecurityType(wxEnterpriseId);
log.info("企业微信授权处理完成"); log.info("企业微信授权处理完成");
} }
...@@ -525,4 +519,56 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService { ...@@ -525,4 +519,56 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
} }
return "好办服务已到期" ; return "好办服务已到期" ;
} }
@Override
public void addHaobanRole(String wxEnterpriseId) {
List<HaobanRoleBO> haobanRoleBOList = haobanRoleService.getByWxEnterpriseIdAndClerkType("-1", null);
HaobanRoleQDTO haobanRoleQDTO = new HaobanRoleQDTO();
HaobanRoleQDTO haobanRoleSystemQDTO = new HaobanRoleQDTO();
for (HaobanRoleBO haobanRoleBO : haobanRoleBOList) {
Long roleId = haobanRoleBO.getRoleId();
Integer clerkType = haobanRoleBO.getClerkType();
String roleName = haobanRoleBO.getRoleName();
int count = haobanRoleService.getCountByWxEnterpriseId(wxEnterpriseId);
//清除历史权限
if (count > 0) {
haobanRoleService.deleteByWxEnterpriseId(wxEnterpriseId);
haobanRoleMenuService.deleteByWxEnterpriseId(wxEnterpriseId);
}
haobanRoleQDTO.setRoleName(roleName);
haobanRoleSystemQDTO.setRoleName(roleName);
List<String> menuCodes = haobanRoleMenuService.getByWxEnterpriseIdAndRoleId("-1", roleId);
if (RoleClerkTypeEnum.CLERK.getCode().equals(clerkType)) {
HaobanRoleMenuQDTO clerkMenus = new HaobanRoleMenuQDTO();
clerkMenus.setClerkType(clerkType);
clerkMenus.setMenuCodes(menuCodes);
haobanRoleQDTO.setClerkMenus(clerkMenus);
haobanRoleSystemQDTO.setClerkMenus(clerkMenus);
} else if (RoleClerkTypeEnum.SHOP.getCode().equals(clerkType)) {
HaobanRoleMenuQDTO manegeClerkMenus = new HaobanRoleMenuQDTO();
manegeClerkMenus.setClerkType(clerkType);
manegeClerkMenus.setMenuCodes(menuCodes);
haobanRoleQDTO.setManegeClerkMenus(manegeClerkMenus);
haobanRoleSystemQDTO.setManegeClerkMenus(manegeClerkMenus);
}else if (RoleClerkTypeEnum.MANAGE.getCode().equals(clerkType)) {
HaobanRoleMenuQDTO managerMenus = new HaobanRoleMenuQDTO();
managerMenus.setClerkType(clerkType);
managerMenus.setMenuCodes(menuCodes);
haobanRoleQDTO.setManagerMenus(managerMenus);
haobanRoleSystemQDTO.setManagerMenus(managerMenus);
}
}
WebLoginDTO login = new WebLoginDTO();
login.setWxEnterpriseId(wxEnterpriseId);
login.setClerkId("-1");
login.setClerkName("系统");
//商户权限
haobanRoleApiService.add(haobanRoleQDTO, login);
//运维系统权限
haobanRoleApiService.add(haobanRoleSystemQDTO, login);
}
} }
...@@ -5,6 +5,7 @@ import com.gic.commons.util.UniqueIdUtils; ...@@ -5,6 +5,7 @@ import com.gic.commons.util.UniqueIdUtils;
import com.gic.haoban.base.api.common.pojo.dto.WebLoginDTO; import com.gic.haoban.base.api.common.pojo.dto.WebLoginDTO;
import com.gic.haoban.manage.api.dto.qdto.role.HaobanRoleMenuQDTO; import com.gic.haoban.manage.api.dto.qdto.role.HaobanRoleMenuQDTO;
import com.gic.haoban.manage.api.dto.qdto.role.HaobanRoleQDTO; import com.gic.haoban.manage.api.dto.qdto.role.HaobanRoleQDTO;
import com.gic.haoban.manage.api.enums.role.RoleClerkTypeEnum;
import com.gic.haoban.manage.api.service.role.HaobanRoleApiService; import com.gic.haoban.manage.api.service.role.HaobanRoleApiService;
import com.gic.haoban.manage.service.entity.role.TabHaobanRole; import com.gic.haoban.manage.service.entity.role.TabHaobanRole;
import com.gic.haoban.manage.service.entity.role.TabHaobanRoleMenu; import com.gic.haoban.manage.service.entity.role.TabHaobanRoleMenu;
...@@ -23,6 +24,7 @@ import java.util.List; ...@@ -23,6 +24,7 @@ import java.util.List;
@Service @Service
public class HaobanRoleApiServiceImpl implements HaobanRoleApiService { public class HaobanRoleApiServiceImpl implements HaobanRoleApiService {
private static final Logger logger = LogManager.getLogger(HaobanRoleApiServiceImpl.class); private static final Logger logger = LogManager.getLogger(HaobanRoleApiServiceImpl.class);
@Autowired @Autowired
...@@ -44,7 +46,7 @@ public class HaobanRoleApiServiceImpl implements HaobanRoleApiService { ...@@ -44,7 +46,7 @@ public class HaobanRoleApiServiceImpl implements HaobanRoleApiService {
Date now = new Date(); Date now = new Date();
//导购 //导购
if (clerkMenus != null) { if (clerkMenus != null) {
TabHaobanRole tabHaobanRole = getTabHaobanRole(haobanRoleQDTO, wxEnterpriseId, clerkId, clerkName, haobanRoles, 0); TabHaobanRole tabHaobanRole = getTabHaobanRole(haobanRoleQDTO, wxEnterpriseId, clerkId, clerkName, haobanRoles, RoleClerkTypeEnum.CLERK.getCode());
List<String> menuCodes = clerkMenus.getMenuCodes(); List<String> menuCodes = clerkMenus.getMenuCodes();
for (String menuCode : menuCodes) { for (String menuCode : menuCodes) {
getTabHaobanRoleMenu(wxEnterpriseId, tabHaobanRoleMenus, now, tabHaobanRole, menuCode); getTabHaobanRoleMenu(wxEnterpriseId, tabHaobanRoleMenus, now, tabHaobanRole, menuCode);
...@@ -53,7 +55,7 @@ public class HaobanRoleApiServiceImpl implements HaobanRoleApiService { ...@@ -53,7 +55,7 @@ public class HaobanRoleApiServiceImpl implements HaobanRoleApiService {
//店长 //店长
if (manegeClerkMenus != null) { if (manegeClerkMenus != null) {
TabHaobanRole tabHaobanRole = getTabHaobanRole(haobanRoleQDTO, wxEnterpriseId, clerkId, clerkName, haobanRoles, 1); TabHaobanRole tabHaobanRole = getTabHaobanRole(haobanRoleQDTO, wxEnterpriseId, clerkId, clerkName, haobanRoles, RoleClerkTypeEnum.SHOP.getCode());
List<String> menuCodes = manegeClerkMenus.getMenuCodes(); List<String> menuCodes = manegeClerkMenus.getMenuCodes();
for (String menuCode : menuCodes) { for (String menuCode : menuCodes) {
getTabHaobanRoleMenu(wxEnterpriseId, tabHaobanRoleMenus, now, tabHaobanRole, menuCode); getTabHaobanRoleMenu(wxEnterpriseId, tabHaobanRoleMenus, now, tabHaobanRole, menuCode);
...@@ -62,7 +64,7 @@ public class HaobanRoleApiServiceImpl implements HaobanRoleApiService { ...@@ -62,7 +64,7 @@ public class HaobanRoleApiServiceImpl implements HaobanRoleApiService {
//区经 //区经
if (managerMenus != null) { if (managerMenus != null) {
TabHaobanRole tabHaobanRole = getTabHaobanRole(haobanRoleQDTO, wxEnterpriseId, clerkId, clerkName, haobanRoles, 2); TabHaobanRole tabHaobanRole = getTabHaobanRole(haobanRoleQDTO, wxEnterpriseId, clerkId, clerkName, haobanRoles, RoleClerkTypeEnum.MANAGE.getCode());
List<String> menuCodes = managerMenus.getMenuCodes(); List<String> menuCodes = managerMenus.getMenuCodes();
for (String menuCode : menuCodes) { for (String menuCode : menuCodes) {
getTabHaobanRoleMenu(wxEnterpriseId, tabHaobanRoleMenus, now, tabHaobanRole, menuCode); getTabHaobanRoleMenu(wxEnterpriseId, tabHaobanRoleMenus, now, tabHaobanRole, menuCode);
...@@ -85,11 +87,11 @@ public class HaobanRoleApiServiceImpl implements HaobanRoleApiService { ...@@ -85,11 +87,11 @@ public class HaobanRoleApiServiceImpl implements HaobanRoleApiService {
tabHaobanRoleMenus.add(tabHaobanRoleMenu); tabHaobanRoleMenus.add(tabHaobanRoleMenu);
} }
private TabHaobanRole getTabHaobanRole(HaobanRoleQDTO haobanRoleQDTO, String wxEnterpriseId, String clerkId, String clerkName, List<TabHaobanRole> haobanRoles, int i) { private TabHaobanRole getTabHaobanRole(HaobanRoleQDTO haobanRoleQDTO, String wxEnterpriseId, String clerkId, String clerkName, List<TabHaobanRole> haobanRoles, int clerkType) {
TabHaobanRole tabHaobanRole = new TabHaobanRole(); TabHaobanRole tabHaobanRole = new TabHaobanRole();
tabHaobanRole.setRoleId(UniqueIdUtils.uniqueLong()); tabHaobanRole.setRoleId(UniqueIdUtils.uniqueLong());
tabHaobanRole.setRoleName(haobanRoleQDTO.getRoleName()); tabHaobanRole.setRoleName(haobanRoleQDTO.getRoleName());
tabHaobanRole.setClerkType(i); tabHaobanRole.setClerkType(clerkType);
tabHaobanRole.setWxEnterpriseId(wxEnterpriseId); tabHaobanRole.setWxEnterpriseId(wxEnterpriseId);
tabHaobanRole.setStatusFlag(1); tabHaobanRole.setStatusFlag(1);
tabHaobanRole.setCreatorId(clerkId); tabHaobanRole.setCreatorId(clerkId);
...@@ -158,8 +160,8 @@ public class HaobanRoleApiServiceImpl implements HaobanRoleApiService { ...@@ -158,8 +160,8 @@ public class HaobanRoleApiServiceImpl implements HaobanRoleApiService {
} }
@Override @Override
public ServiceResponse getByEnterpriseIdAndClerkType(String enterpriseId, String wxEnterpriseId, Integer clerkType) { public ServiceResponse getByWxEnterpriseIdAndClerkType(String wxEnterpriseId, Integer clerkType) {
List<HaobanRoleBO> haobanRoleBOList = haobanRoleService.getByEnterpriseIdAndClerkType(enterpriseId, wxEnterpriseId, clerkType); List<HaobanRoleBO> haobanRoleBOList = haobanRoleService.getByWxEnterpriseIdAndClerkType(wxEnterpriseId, clerkType);
return ServiceResponse.success(haobanRoleBOList); return ServiceResponse.success(haobanRoleBOList);
} }
......
...@@ -75,4 +75,14 @@ public interface HaobanRoleMenuService { ...@@ -75,4 +75,14 @@ public interface HaobanRoleMenuService {
* @date 2022-09-13 14:57:34 * @date 2022-09-13 14:57:34
*/ */
List<String> getByWxEnterpriseIdAndRoleId(String wxEnterpriseId, Long roleId); List<String> getByWxEnterpriseIdAndRoleId(String wxEnterpriseId, Long roleId);
/**
* 根据企业id删除权限
*
* @param wxEnterpriseId wx企业标识
* @return boolean
* @author mozhu
* @date 2022-09-14 10:39:43
*/
boolean deleteByWxEnterpriseId(String wxEnterpriseId);
} }
...@@ -53,19 +53,37 @@ public interface HaobanRoleService { ...@@ -53,19 +53,37 @@ public interface HaobanRoleService {
* @param roleId 主键 * @param roleId 主键
* @return 是否成功 * @return 是否成功
*/ */
boolean deleteById(Long roleId); boolean deleteByRoleId(Long roleId);
/**
* 删除企业权限
*
* @param wxEnterpriseId wx企业标识
* @return boolean
* @author mozhu
* @date 2022-09-14 10:16:19
*/
boolean deleteByWxEnterpriseId(String wxEnterpriseId);
/** /**
* 根据类型查询企业的菜单权限 * 根据类型查询企业的菜单权限
* *
* @param enterpriseId 企业标识
* @param wxEnterpriseId wx企业标识 * @param wxEnterpriseId wx企业标识
* @param clerkType 职员类型 * @param clerkType 职员类型
* @return {@link List }<{@link HaobanRoleBO }> * @return {@link List }<{@link HaobanRoleBO }>
* @author mozhu * @author mozhu
* @date 2022-09-07 14:08:19 * @date 2022-09-07 14:08:19
*/ */
List<HaobanRoleBO> getByEnterpriseIdAndClerkType(String enterpriseId, String wxEnterpriseId, Integer clerkType); List<HaobanRoleBO> getByWxEnterpriseIdAndClerkType(String wxEnterpriseId, Integer clerkType);
/**
* 查询wx企业id数量
*
* @param wxEnterpriseId wx企业标识
* @return int
* @author mozhu
* @date 2022-09-14 10:37:49
*/
int getCountByWxEnterpriseId(String wxEnterpriseId);
} }
...@@ -85,4 +85,9 @@ public class HaobanRoleMenuServiceImpl implements HaobanRoleMenuService { ...@@ -85,4 +85,9 @@ public class HaobanRoleMenuServiceImpl implements HaobanRoleMenuService {
public List<String> getByWxEnterpriseIdAndRoleId(String wxEnterpriseId, Long roleId) { public List<String> getByWxEnterpriseIdAndRoleId(String wxEnterpriseId, Long roleId) {
return tabHaobanRoleMenuMapper.getByWxEnterpriseIdAndRoleId(wxEnterpriseId,roleId); return tabHaobanRoleMenuMapper.getByWxEnterpriseIdAndRoleId(wxEnterpriseId,roleId);
} }
@Override
public boolean deleteByWxEnterpriseId(String wxEnterpriseId) {
return tabHaobanRoleMenuMapper.deleteByWxEnterpriseId(wxEnterpriseId);
}
} }
...@@ -76,14 +76,24 @@ public class HaobanRoleServiceImpl implements HaobanRoleService { ...@@ -76,14 +76,24 @@ public class HaobanRoleServiceImpl implements HaobanRoleService {
* @return 是否成功 * @return 是否成功
*/ */
@Override @Override
public boolean deleteById(Long roleId) { public boolean deleteByRoleId(Long roleId) {
return false; return tabHaobanRoleMapper.deleteByRoleId(roleId) > 0;
} }
@Override @Override
public List<HaobanRoleBO> getByEnterpriseIdAndClerkType(String enterpriseId, String wxEnterpriseId, Integer clerkType) { public boolean deleteByWxEnterpriseId(String wxEnterpriseId) {
List<TabHaobanRole> haobanRoles = tabHaobanRoleMapper.getByEnterpriseIdAndClerkType(enterpriseId, wxEnterpriseId, clerkType); return tabHaobanRoleMapper.deleteByWxEnterpriseId(wxEnterpriseId) > 0;
return EntityUtil.changeEntityListNew(HaobanRoleBO.class,haobanRoles); }
@Override
public List<HaobanRoleBO> getByWxEnterpriseIdAndClerkType(String wxEnterpriseId, Integer clerkType) {
List<TabHaobanRole> haobanRoles = tabHaobanRoleMapper.getByWxEnterpriseIdAndClerkType(wxEnterpriseId, clerkType);
return EntityUtil.changeEntityListNew(HaobanRoleBO.class, haobanRoles);
}
@Override
public int getCountByWxEnterpriseId(String wxEnterpriseId) {
return tabHaobanRoleMapper.getCountByWxEnterpriseId(wxEnterpriseId);
} }
} }
...@@ -85,15 +85,31 @@ ...@@ -85,15 +85,31 @@
where role_id = #{roleId} where role_id = #{roleId}
</update> </update>
<delete id="deleteByRoleId">
delete from tab_haoban_role where role_id = #{roleId}
</delete>
<select id="getByEnterpriseIdAndClerkType" resultMap="TabHaobanRoleMap"> <select id="getByWxEnterpriseIdAndClerkType" resultMap="TabHaobanRoleMap">
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from tab_haoban_role from tab_haoban_role
where wx_enterprise_id = #{wxEnterpriseId} where wx_enterprise_id = #{wxEnterpriseId}
and enterprise_id = #{enterpriseId} <if test="clerkType != null">
and clerk_type = #{clerkType} and clerk_type = #{clerkType}
</if>
</select> </select>
<select id="getCountByWxEnterpriseId" resultType="java.lang.Integer">
select
count(*)
from tab_haoban_role
where wx_enterprise_id = #{wxEnterpriseId}
</select>
<delete id="deleteByWxEnterpriseId">
delete from tab_haoban_role where wx_enterprise_id = #{wxEnterpriseId}
</delete>
</mapper> </mapper>
...@@ -84,5 +84,9 @@ ...@@ -84,5 +84,9 @@
where wx_enterprise_id = #{wxEnterpriseId} and role_id = #{roleId} where wx_enterprise_id = #{wxEnterpriseId} and role_id = #{roleId}
</select> </select>
<delete id="deleteByWxEnterpriseId">
delete from tab_haoban_role_menu where wx_enterprise_id = #{wxEnterpriseId}
</delete>
</mapper> </mapper>
...@@ -60,7 +60,7 @@ public class HaobanRoleController extends WebBaseController{ ...@@ -60,7 +60,7 @@ public class HaobanRoleController extends WebBaseController{
@RequestMapping(value = "/queryRoleByClerkType",method = RequestMethod.GET) @RequestMapping(value = "/queryRoleByClerkType",method = RequestMethod.GET)
private RestResponse queryRoleByClerkType(Integer clerkType) { private RestResponse queryRoleByClerkType(Integer clerkType) {
WebLoginDTO login = AuthWebRequestUtil.getLoginUser(); WebLoginDTO login = AuthWebRequestUtil.getLoginUser();
ServiceResponse serviceResponse = haobanRoleApiService.getByEnterpriseIdAndClerkType(login.getEnterpriseId(), login.getWxEnterpriseId(), clerkType); ServiceResponse serviceResponse = haobanRoleApiService.getByWxEnterpriseIdAndClerkType(login.getWxEnterpriseId(), clerkType);
return RestResponse.successResult(serviceResponse.getResult()); return RestResponse.successResult(serviceResponse.getResult());
} }
......
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