first commit
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
package com.linke.product;
|
||||
|
||||
import com.mhd.common.core.annotation.fieldsetvalue.CommonService;
|
||||
import com.mhd.common.core.annotation.fieldsetvalue.SetFeildValueAspect;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableDiscoveryClient
|
||||
@EnableFeignClients(basePackages = {"com.mhd","com.linke.product.infrastructure.feign"})
|
||||
@MapperScan("com.linke.product.domain.**.mapper")
|
||||
@Import({SetFeildValueAspect.class, CommonService.class})
|
||||
public class ProductApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ProductApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package com.linke.product.application.event.menu.publish;
|
||||
|
||||
import com.linke.product.infrastructure.util.mq.MenuChannel;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cloud.stream.annotation.EnableBinding;
|
||||
import org.springframework.messaging.support.MessageBuilder;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 消息发布
|
||||
*
|
||||
* 2022-12-21
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
@EnableBinding(value = { MenuChannel.class })
|
||||
@Service
|
||||
public class MenuPublish {
|
||||
|
||||
// 将MessageChannel的封装对象Source注入到这里使用
|
||||
@Autowired
|
||||
private MenuChannel source;
|
||||
|
||||
public void sendMessage(String content) {
|
||||
// 向mq中发送消息(并不是直接操作mq,应该操作的是spring cloud stream)
|
||||
// 使用通道向外发出消息(指的是Source里面的output通道)
|
||||
source.outputLog().send(MessageBuilder.withPayload(content).build());
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package com.linke.product.application.event.menu.subscribe;
|
||||
|
||||
import com.linke.product.infrastructure.util.mq.MenuChannel;
|
||||
import org.springframework.cloud.stream.annotation.EnableBinding;
|
||||
import org.springframework.cloud.stream.annotation.StreamListener;
|
||||
import org.springframework.messaging.Message;
|
||||
|
||||
/**
|
||||
* 消息接收
|
||||
*
|
||||
* 2022-12-1
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
@EnableBinding(value = { MenuChannel.class })
|
||||
public class MenuSubscribe {
|
||||
|
||||
// @Autowired
|
||||
// MenuApplicationService menuApplicationService;
|
||||
// @Autowired
|
||||
// private RedisService redisService;
|
||||
|
||||
@StreamListener(MenuChannel.INPUT_LOG)
|
||||
public void receiveMessages(Message<String> message) {
|
||||
// String content = message.getPayload();
|
||||
//删除菜单树缓存
|
||||
// redisService.deleteObject("menuTree");
|
||||
//重新写入缓存
|
||||
// menuApplicationService.selectTreeMenu();
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package com.linke.product.application.event.modules.publish;
|
||||
|
||||
import com.linke.product.infrastructure.util.mq.ModulesChannel;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cloud.stream.annotation.EnableBinding;
|
||||
import org.springframework.messaging.support.MessageBuilder;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 消息发布
|
||||
*
|
||||
* 2022-12-1
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
@EnableBinding(value = { ModulesChannel.class })
|
||||
@Service
|
||||
public class ModulesPublish {
|
||||
|
||||
// 将MessageChannel的封装对象Source注入到这里使用
|
||||
@Autowired
|
||||
private ModulesChannel source;
|
||||
|
||||
public void sendMessage(String content) {
|
||||
// 向mq中发送消息(并不是直接操作mq,应该操作的是spring cloud stream)
|
||||
// 使用通道向外发出消息(指的是Source里面的output通道)
|
||||
source.outputLog().send(MessageBuilder.withPayload(content).build());
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package com.linke.product.application.event.modules.subscribe;
|
||||
|
||||
import com.linke.product.infrastructure.util.mq.ModulesChannel;
|
||||
import org.springframework.cloud.stream.annotation.EnableBinding;
|
||||
import org.springframework.cloud.stream.annotation.StreamListener;
|
||||
import org.springframework.messaging.Message;
|
||||
|
||||
/**
|
||||
* 消息接收
|
||||
*
|
||||
* 2022-12-1
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
@EnableBinding(value = { ModulesChannel.class })
|
||||
public class ModulesSubscribe {
|
||||
|
||||
// @Autowired
|
||||
// SysModulesApplicationService sysModulesApplicationService;
|
||||
// @Autowired
|
||||
// private RedisService redisService;
|
||||
|
||||
@StreamListener(ModulesChannel.INPUT_LOG)
|
||||
public void receiveMessages(Message<String> message) {
|
||||
// String content = message.getPayload();
|
||||
//删除中台树缓存
|
||||
// redisService.deleteObject("modulesTree");
|
||||
// //重新写入缓存
|
||||
// sysModulesApplicationService.selectTreeModules();
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package com.linke.product.application.event.organization.publish;
|
||||
|
||||
import com.linke.product.infrastructure.util.mq.OrganizationChannel;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cloud.stream.annotation.EnableBinding;
|
||||
import org.springframework.messaging.support.MessageBuilder;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 消息发布
|
||||
*
|
||||
* 2022-11-22
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
@EnableBinding(value = { OrganizationChannel.class })
|
||||
@Service
|
||||
public class OrganizationPublish {
|
||||
|
||||
// 将MessageChannel的封装对象Source注入到这里使用
|
||||
@Autowired
|
||||
private OrganizationChannel source;
|
||||
|
||||
public void sendMessage(String content) {
|
||||
// 向mq中发送消息(并不是直接操作mq,应该操作的是spring cloud stream)
|
||||
// 使用通道向外发出消息(指的是Source里面的output通道)
|
||||
source.outputLog().send(MessageBuilder.withPayload(content).build());
|
||||
}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
package com.linke.product.application.event.organization.subscribe;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import org.springframework.cloud.stream.annotation.EnableBinding;
|
||||
import org.springframework.cloud.stream.annotation.StreamListener;
|
||||
import org.springframework.cloud.stream.messaging.Sink;
|
||||
import org.springframework.messaging.Message;
|
||||
|
||||
/**
|
||||
* 消息接收
|
||||
*
|
||||
* 2022-11-22
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
@EnableBinding(Sink.class)
|
||||
public class EmployeeSubscribe {
|
||||
|
||||
// @Autowired
|
||||
// private IOrganizationDutySvc iOrganizationDutySvc;
|
||||
|
||||
@StreamListener(Sink.INPUT)
|
||||
public void receiveMessages(Message<String> message) {
|
||||
String content = message.getPayload();
|
||||
JSONObject jsonObjects = JSONObject.parseObject(content);
|
||||
String employeeName = jsonObjects.getString("name");
|
||||
int employeeId = Integer.parseInt(jsonObjects.getString("id"));
|
||||
// OrganizationDuty organizationDuty = new OrganizationDuty();
|
||||
// organizationDuty.setEmployeeId(employeeId);
|
||||
// organizationDuty.setEmployeeName(employeeName);
|
||||
// iOrganizationDutySvc.updateOrganizationDuty(organizationDuty);
|
||||
}
|
||||
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
package com.linke.product.application.event.organization.subscribe;
|
||||
|
||||
import com.linke.product.application.service.organization.OrganizationApplicationService;
|
||||
import com.linke.product.infrastructure.util.mq.OrganizationChannel;
|
||||
import com.mhd.common.redis.service.RedisService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cloud.stream.annotation.EnableBinding;
|
||||
import org.springframework.cloud.stream.annotation.StreamListener;
|
||||
import org.springframework.messaging.Message;
|
||||
|
||||
/**
|
||||
* 消息接收
|
||||
*
|
||||
* 2022-11-25
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
@EnableBinding(value = { OrganizationChannel.class })
|
||||
public class OrganizationSubscribe {
|
||||
|
||||
@Autowired
|
||||
OrganizationApplicationService organizationASvc;
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
|
||||
@StreamListener(OrganizationChannel.INPUT_LOG)
|
||||
public void receiveMessages(Message<String> message) {
|
||||
// String content = message.getPayload();
|
||||
//删除组织树缓存
|
||||
redisService.deleteObject("organizationTree");
|
||||
//重新写入缓存
|
||||
// organizationASvc.selectTreeOrganization();
|
||||
}
|
||||
}
|
||||
+183
@@ -0,0 +1,183 @@
|
||||
package com.linke.product.application.service.appConfig;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.mhd.common.core.domain.po.AppConfigPO;
|
||||
import com.linke.product.domain.appConfig.repository.todo.AppConfigDO;
|
||||
import com.linke.product.domain.appConfig.service.AppConfigDomainService;
|
||||
import com.linke.product.domain.modules.repository.po.SysModulesPO;
|
||||
import com.linke.product.infrastructure.feign.SystemServiceFeigh;
|
||||
import com.linke.product.infrastructure.feign.UserServiceFeign;
|
||||
import com.linke.product.infrastructure.vo.SysDictDataVo;
|
||||
import com.mhd.common.core.domain.entity.R;
|
||||
import com.mhd.common.core.domain.po.RolePO;
|
||||
import com.mhd.common.core.enums.DictCode;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.utils.StringUtils;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 产品中台-app配置ApplicationService
|
||||
*
|
||||
* @author gen
|
||||
* @date 2023-10-07
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class AppConfigApplicationService {
|
||||
@Autowired
|
||||
private AppConfigDomainService appConfigDomainService;
|
||||
@Autowired
|
||||
private SystemServiceFeigh systemServiceFeign;
|
||||
@Autowired
|
||||
private UserServiceFeign userServiceFeign;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询产品中台-app配置列表
|
||||
*/
|
||||
|
||||
public List<AppConfigPO> queryList(AppConfigDO appConfigDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null){
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
if (topOrganizationId != null && topOrganizationId != 1){
|
||||
appConfigDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
}
|
||||
return appConfigDomainService.queryList(appConfigDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增产品中台-app配置
|
||||
*/
|
||||
public Boolean insert(AppConfigDO appConfigDO) {
|
||||
//翻译数据字典
|
||||
translateDataDict(appConfigDO);
|
||||
return appConfigDomainService.insert(appConfigDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改产品中台-app配置
|
||||
*/
|
||||
public Boolean update(AppConfigDO appConfigDO) {
|
||||
//翻译数据字典
|
||||
translateDataDict(appConfigDO);
|
||||
return appConfigDomainService.update(appConfigDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 翻译数据字典
|
||||
* @author ZhouGY
|
||||
* @date 2023/10/7 16:32
|
||||
* @param appConfigDO
|
||||
*/
|
||||
private void translateDataDict(AppConfigDO appConfigDO){
|
||||
//翻译APP范围
|
||||
if (StringUtils.isNotBlank(appConfigDO.getAppRangeCode())){
|
||||
String[] appRangeCodes = appConfigDO.getAppRangeCode().split(",");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < appRangeCodes.length; i++){
|
||||
List<SysDictDataVo> appRangeCodeTypeList = new ArrayList<>();
|
||||
//查询数据字典通知类型中的配置
|
||||
AjaxResult ajaxResult = systemServiceFeign.selectListByDictType(DictCode.APP_RANGE.getCode());
|
||||
if("200".equals(String.valueOf(ajaxResult.get("code")))){
|
||||
appRangeCodeTypeList = JSON.parseArray(JSONObject.toJSONString(ajaxResult.get("data")), SysDictDataVo.class);
|
||||
}
|
||||
Map<String, SysDictDataVo> stringSysDictDataVoMap = appRangeCodeTypeList.stream().collect(Collectors.toMap(SysDictDataVo::getDictValue, Function.identity()));
|
||||
SysDictDataVo sysDictDataVo = stringSysDictDataVoMap.get(appRangeCodes[i]);
|
||||
if (sysDictDataVo == null){
|
||||
log.error("APP范围类型代码【{}】有误", appRangeCodes[i]);
|
||||
throw new ServiceException("APP范围类型代码有误");
|
||||
}
|
||||
if (sb.length() > 0){
|
||||
sb.append("、");
|
||||
}
|
||||
sb.append(sysDictDataVo.getDictLabel());
|
||||
}
|
||||
appConfigDO.setAppRangeName(sb.toString());
|
||||
}
|
||||
|
||||
//翻译角色信息
|
||||
if (StringUtils.isNotBlank(appConfigDO.getAppRoleCode())){
|
||||
String[] roleCodes= appConfigDO.getAppRoleCode().split(",");
|
||||
StringBuilder id = new StringBuilder();
|
||||
StringBuilder name = new StringBuilder();
|
||||
for (int i = 0; i < roleCodes.length; i++){
|
||||
R<RolePO> rolePOR = userServiceFeign.getInfoByRoleCodeAndOrganizationId(roleCodes[i], appConfigDO.getOrganizationId());
|
||||
if (R.FAIL == rolePOR.getCode()) {
|
||||
throw new ServiceException(rolePOR.getMsg());
|
||||
}
|
||||
RolePO rolePO = rolePOR.getData();
|
||||
if (rolePO == null){
|
||||
log.error("APP角色类型代码【{}】有误", roleCodes[i]);
|
||||
throw new ServiceException("APP角色不存在或已删除");
|
||||
}
|
||||
if (id.length() > 0){
|
||||
id.append(",");
|
||||
}
|
||||
id.append(rolePO.getRoleId());
|
||||
if (name.length() > 0){
|
||||
name.append("、");
|
||||
}
|
||||
name.append(rolePO.getRoleName());
|
||||
}
|
||||
appConfigDO.setAppRoleId(id.toString());
|
||||
appConfigDO.setAppRoleName(name.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量删除产品中台-app配置
|
||||
*/
|
||||
public boolean delete(Long[] appIds) {
|
||||
return appConfigDomainService.delete(appIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取产品中台-app配置详细信息
|
||||
*/
|
||||
public AppConfigPO getInfo(Long appId)
|
||||
{
|
||||
return appConfigDomainService.getInfo(appId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 根据app包名获取app配置信息
|
||||
* @author ZhouGY
|
||||
* @date 2023/10/31 13:33
|
||||
* @param appPackage
|
||||
* @return AppConfigPO
|
||||
*/
|
||||
public AppConfigPO getAppConfigInfoByAppPackage(String appPackage, Long topOrganizationId) {
|
||||
return appConfigDomainService.getAppConfigInfoByAppPackage(appPackage, topOrganizationId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 查询一级组织绑定的中台,返回树状结构
|
||||
* @author ZhouGY
|
||||
* @date 2023/10/8 10:59
|
||||
* @param organizationId
|
||||
* @return List<SysModulesPO>
|
||||
*/
|
||||
public List<SysModulesPO> getModulesListByProduct(Long organizationId)
|
||||
{
|
||||
return appConfigDomainService.getModulesListByProduct(organizationId);
|
||||
}
|
||||
}
|
||||
+164
@@ -0,0 +1,164 @@
|
||||
package com.linke.product.application.service.appMenu;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.linke.product.application.service.common.CommonApplicationService;
|
||||
import com.linke.product.domain.appMenu.repository.po.AppMenuPO;
|
||||
import com.linke.product.domain.appMenu.repository.po.AppModulePO;
|
||||
import com.linke.product.domain.appMenu.repository.todo.AppMenuDO;
|
||||
import com.linke.product.domain.appMenu.service.AppMenuDomainService;
|
||||
import com.linke.product.domain.menu.repository.po.MenuPo;
|
||||
import com.linke.product.infrastructure.feign.UserServiceFeign;
|
||||
import com.mhd.common.core.domain.entity.R;
|
||||
import com.mhd.common.core.domain.po.UserConfigSwitchPo;
|
||||
import com.mhd.common.core.domain.po.UserRoleMenuPO;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.UserError;
|
||||
import com.mhd.common.core.utils.StringUtils;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.SystemServiceFeign;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.TreeSet;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 产品中台-app/菜单权限ApplicationService
|
||||
*
|
||||
* @author gen
|
||||
* @date 2023-10-07
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class AppMenuApplicationService {
|
||||
@Autowired
|
||||
private AppMenuDomainService appMenuDomainService;
|
||||
@Autowired
|
||||
private UserServiceFeign userServiceFeign;
|
||||
@Autowired
|
||||
private CommonApplicationService commonApplicationService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询产品中台-app/菜单权限列表
|
||||
*/
|
||||
|
||||
public List<AppMenuPO> queryList(AppMenuDO appMenuDO) {
|
||||
return appMenuDomainService.queryList(appMenuDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 加载指定app下的所选中台及app下所选的菜单
|
||||
* @author ZhouGY
|
||||
* @date 2023/10/9 13:36
|
||||
* @param appMenuDO
|
||||
* @return JSONObject
|
||||
*/
|
||||
public JSONObject findAppModuleAndMenuList(AppMenuDO appMenuDO) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
List<AppModulePO> appModulePOList = appMenuDomainService.queryModulesList(appMenuDO);
|
||||
List<AppModulePO> appModulePOS = appModulePOList.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(AppModulePO::getModulesId))), ArrayList::new));
|
||||
jsonObject.set("module", appModulePOS);
|
||||
List<AppMenuPO> appMenuPOList = appMenuDomainService.queryList(appMenuDO);
|
||||
jsonObject.set("menu", appMenuPOList);
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description app加载菜单按照app位置分组展示
|
||||
* @author ZhouGY
|
||||
* @date 2023/10/9 13:36
|
||||
* @param appMenuDO
|
||||
* @return List<MenuPo>
|
||||
*/
|
||||
public List<MenuPo> queryMenuListByApp(AppMenuDO appMenuDO) {
|
||||
if (StringUtils.isBlank(appMenuDO.getAppPackage()) || StringUtils.isBlank(appMenuDO.getAppLocationCode())){
|
||||
throw new ServiceException("app包名或app位置不能为空");
|
||||
}
|
||||
if (appMenuDO.getUserId() == null){
|
||||
appMenuDO.setUserId(SecurityUtils.getUserId());
|
||||
}
|
||||
if (appMenuDO.getTopOrganizationId() == null){
|
||||
appMenuDO.setTopOrganizationId(SecurityUtils.getLoginUser().getUserPo().getTopOrganizationId());
|
||||
}
|
||||
List<MenuPo> menuPos = appMenuDomainService.queryMenuListByApp(appMenuDO);
|
||||
//判断控制推广码是否显示
|
||||
if (menuPos != null){
|
||||
//获取配置判断是否开启推广码
|
||||
UserConfigSwitchPo userConfigSwitch = commonApplicationService.getUserConfigSwitch();
|
||||
//判断是否开启推广码并且当前登录人是否有司机的角色
|
||||
if (userConfigSwitch.getIsPromoCode() == null || userConfigSwitch.getIsPromoCode() != 1){
|
||||
menuPos = menuPos.stream().filter(item-> !"推广码".equals(item.getMenuName())).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
return menuPos;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 保存app/菜单权限
|
||||
*/
|
||||
public Boolean save(AppMenuDO appMenuDO) {
|
||||
|
||||
return appMenuDomainService.save(appMenuDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改产品中台-app/菜单权限
|
||||
*/
|
||||
public Boolean update(AppMenuDO appMenuDO) {
|
||||
return appMenuDomainService.update(appMenuDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除产品中台-app/菜单权限
|
||||
*/
|
||||
public boolean delete(Long[] appMenuIds) {
|
||||
return appMenuDomainService.delete(appMenuIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取产品中台-app/菜单权限详细信息
|
||||
*/
|
||||
public AppMenuPO getInfo(Long appMenuId)
|
||||
{
|
||||
return appMenuDomainService.getInfo(appMenuId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 查询指定app的菜单权限
|
||||
* @author ZhouGY
|
||||
* @date 2023/10/8 13:21
|
||||
* @param appMenuDO
|
||||
* @return List<AppMenuPO>
|
||||
*/
|
||||
public List<AppMenuPO> selectAppMenuList(AppMenuDO appMenuDO){
|
||||
return appMenuDomainService.queryList(appMenuDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @description 查询指定app的菜单 树状结构
|
||||
* @author ZhouGY
|
||||
* @date 2023/10/8 15:48
|
||||
* @param appMenuDO
|
||||
* @return List<MenuPo>
|
||||
*/
|
||||
public List<MenuPo> getAppMenuTree(AppMenuDO appMenuDO){
|
||||
List<Long> roleIdList = appMenuDomainService.getAppRoleIdList(appMenuDO);
|
||||
R<List<UserRoleMenuPO>> userRoleMenuPoListR = userServiceFeign.roleAppMenuListByRoleIds(roleIdList);
|
||||
if (R.FAIL == userRoleMenuPoListR.getCode()){
|
||||
throw new ServiceException(userRoleMenuPoListR.getMsg());
|
||||
}
|
||||
return appMenuDomainService.getAppMenuTree(appMenuDO, userRoleMenuPoListR.getData());
|
||||
}
|
||||
|
||||
}
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
package com.linke.product.application.service.appUserMenuSettings;
|
||||
|
||||
import cn.hutool.json.JSONArray;
|
||||
import com.linke.product.domain.appUserMenuSettings.repository.po.AppUserMenuSettingsPO;
|
||||
import com.linke.product.domain.appUserMenuSettings.repository.todo.AppUserMenuSettingsDO;
|
||||
import com.linke.product.domain.appUserMenuSettings.service.AppUserMenuSettingsDomainService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
/**
|
||||
* 用户中台-用户权限ApplicationService
|
||||
*
|
||||
* @author gen
|
||||
* @date 2023-10-10
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class AppUserMenuSettingsApplicationService {
|
||||
@Autowired
|
||||
private AppUserMenuSettingsDomainService appUserMenuSettingsDomainService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询用户中台-用户权限列表
|
||||
*/
|
||||
|
||||
public List<AppUserMenuSettingsPO> queryList(AppUserMenuSettingsDO appUserMenuSettingsDO) {
|
||||
return appUserMenuSettingsDomainService.queryList(appUserMenuSettingsDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 根据用户查询用户菜单个性化设置
|
||||
* @author ZhouGY
|
||||
* @date 2023/10/10 16:00
|
||||
* @param appUserMenuSettingsDO
|
||||
* @return JSONArray
|
||||
*/
|
||||
public JSONArray queryApplicationCenter(AppUserMenuSettingsDO appUserMenuSettingsDO) {
|
||||
return appUserMenuSettingsDomainService.queryApplicationCenter(appUserMenuSettingsDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增用户中台-用户权限
|
||||
*/
|
||||
public Boolean insert(AppUserMenuSettingsDO appUserMenuSettingsDO) {
|
||||
|
||||
return appUserMenuSettingsDomainService.insert(appUserMenuSettingsDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户中台-用户权限
|
||||
*/
|
||||
public Boolean update(AppUserMenuSettingsDO appUserMenuSettingsDO) {
|
||||
return appUserMenuSettingsDomainService.update(appUserMenuSettingsDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除用户中台-用户权限
|
||||
*/
|
||||
public boolean delete(Long[] aumsIds) {
|
||||
return appUserMenuSettingsDomainService.delete(aumsIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户中台-用户权限详细信息
|
||||
*/
|
||||
public AppUserMenuSettingsPO getInfo(Long aumsId)
|
||||
{
|
||||
return appUserMenuSettingsDomainService.getInfo(aumsId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
+150
@@ -0,0 +1,150 @@
|
||||
package com.linke.product.application.service.common;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.linke.product.domain.common.entity.DataPermission;
|
||||
import com.linke.product.domain.organization.service.OrganizationDomainService;
|
||||
import com.linke.product.infrastructure.feign.UserServiceFeign;
|
||||
import com.mhd.common.core.constant.CacheConstants;
|
||||
import com.mhd.common.core.domain.dto.UserDataPermissionQueryDTO;
|
||||
import com.mhd.common.core.domain.po.UserConfigSwitchPo;
|
||||
import com.mhd.common.core.domain.po.UserDataPermissionPO;
|
||||
import com.mhd.common.core.domain.po.UserPo;
|
||||
import com.mhd.common.core.enums.RoleEnum;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.redis.service.RedisService;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.SystemServiceFeign;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 公共 应用服务层
|
||||
* <p>
|
||||
* 本层可以综合应用各种业务间的组合
|
||||
* <p>
|
||||
* 2023-01-11
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class CommonApplicationService {
|
||||
|
||||
@Autowired
|
||||
private OrganizationDomainService iOrganizationSvc;
|
||||
|
||||
@Resource
|
||||
private UserServiceFeign userServiceFeign;
|
||||
|
||||
@Resource
|
||||
private RedisService redisService;
|
||||
|
||||
@Autowired
|
||||
private SystemServiceFeign systemServiceFeign;
|
||||
|
||||
/**
|
||||
* 判断当前登录人的数据权限
|
||||
*
|
||||
*/
|
||||
public DataPermission dataPermission(Long permissionMenuId) {
|
||||
DataPermission dataPermission = new DataPermission();
|
||||
//获取登录人信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
Long userId = new Long("19");
|
||||
Long organizationId = new Long("2");
|
||||
// if(1 == 1){
|
||||
if(loginUser.getUserPo() != null){
|
||||
userId = loginUser.getUserid();
|
||||
organizationId = loginUser.getUserPo().getOrganizationId();
|
||||
// UserPo userpo = new UserPo();
|
||||
// userpo.setRoleCode("plat_admin");
|
||||
// loginUser.setUserPo(userpo);
|
||||
//判断当前用户是否是超级管理员/租户管理员还是普通用户,如果是超级管理员则返回全部组织,租户管理员则返回租户所属组织的全部组织,普通用户需要判断数据权限
|
||||
if(RoleEnum.SUPER_ADMIN.getCode().equals(loginUser.getUserPo().getRoleCode())){
|
||||
//获取全部组织id
|
||||
List<Long> longs = iOrganizationSvc.selectAllOrganizationId();
|
||||
dataPermission.setOrganizationIdList(longs);
|
||||
//查询全部组织
|
||||
}else if(RoleEnum.PLAT_ADMIN.getCode().equals(loginUser.getUserPo().getRoleCode())) {
|
||||
//获取当前组织全部下级组织id
|
||||
List<Long> longs = iOrganizationSvc.selectOrganizationIdsByOrganizationId(organizationId);
|
||||
dataPermission.setOrganizationIdList(longs);
|
||||
}else {
|
||||
//获取当前用户数据权限
|
||||
UserDataPermissionQueryDTO userDataPermissionQueryDTO = new UserDataPermissionQueryDTO();
|
||||
userDataPermissionQueryDTO.setMenuId(permissionMenuId);
|
||||
userDataPermissionQueryDTO.setOrganizationId(organizationId);
|
||||
userDataPermissionQueryDTO.setUserId(userId);
|
||||
AjaxResult info = userServiceFeign.findUserDataPermission(userDataPermissionQueryDTO);
|
||||
if("200".equals(String.valueOf(info.get("code")))){
|
||||
UserDataPermissionPO userDataPermissionPO = JSONObject.parseObject(JSONObject.toJSONString(info.get("data")), UserDataPermissionPO.class);
|
||||
if(userDataPermissionPO.getUserDataOrganizationStatus() != null){
|
||||
//1表示可以查询当前组织及下级组织的数据,反之只能看到自己创建的数据
|
||||
if(userDataPermissionPO.getUserDataOrganizationStatus() == 1){
|
||||
//获取当前组织全部下级组织id
|
||||
List<Long> longs = iOrganizationSvc.selectOrganizationIdsByOrganizationId(organizationId);
|
||||
dataPermission.setOrganizationIdList(longs);
|
||||
}else {
|
||||
dataPermission.setCreateBy(userId);
|
||||
}
|
||||
}else {
|
||||
dataPermission.setCreateBy(userId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return dataPermission;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户所在组织的开关配置信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public UserConfigSwitchPo getUserConfigSwitch() {
|
||||
//获取登录人信息
|
||||
UserConfigSwitchPo userConfigSwitchPo;
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
UserPo userPo = loginUser.getUserPo();
|
||||
Long organizationId = userPo.getOrganizationId();
|
||||
userConfigSwitchPo = redisService.getCacheObject(CacheConstants.USER_COMFIG_SWITCH_KEY + organizationId);
|
||||
if (null == userConfigSwitchPo || userConfigSwitchPo.getUserConfigSwitchId() == null) {
|
||||
//查询数据库,并且存到redis中
|
||||
AjaxResult ajaxResult = systemServiceFeign.getUserConfigSwitchInfo();
|
||||
if ("200".equals(String.valueOf(ajaxResult.get("code")))) {
|
||||
userConfigSwitchPo = JSONObject.parseObject(JSONObject.toJSONString(ajaxResult.get("data")), UserConfigSwitchPo.class);
|
||||
if (null != userConfigSwitchPo) {
|
||||
//存入redis中
|
||||
redisService.setCacheObject(CacheConstants.USER_COMFIG_SWITCH_KEY + organizationId, userConfigSwitchPo);
|
||||
}
|
||||
}
|
||||
}
|
||||
return userConfigSwitchPo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取组织的开关配置信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public UserConfigSwitchPo getUserConfigSwitch(Long organizationId) {
|
||||
UserConfigSwitchPo userConfigSwitchPo = null;
|
||||
//查询数据库,并且存到redis中
|
||||
AjaxResult ajaxResult = systemServiceFeign.getUserConfigSwitchInfoByOrgId(organizationId);
|
||||
if ("200".equals(String.valueOf(ajaxResult.get("code")))) {
|
||||
userConfigSwitchPo = JSONObject.parseObject(JSONObject.toJSONString(ajaxResult.get("data")), UserConfigSwitchPo.class);
|
||||
}
|
||||
if (ObjectUtil.isNull(userConfigSwitchPo)) {
|
||||
throw new ServiceException("获取组织配置信息失败");
|
||||
}else {
|
||||
return userConfigSwitchPo;
|
||||
}
|
||||
}
|
||||
}
|
||||
+162
@@ -0,0 +1,162 @@
|
||||
package com.linke.product.application.service.commonFunctions;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.linke.product.application.service.menu.MenuApplicationService;
|
||||
import com.linke.product.domain.commonFunctions.entity.CommonFunctions;
|
||||
import com.linke.product.domain.commonFunctions.repository.po.CommonFunctionsPO;
|
||||
import com.linke.product.domain.commonFunctions.repository.todo.CommonFunctionsDO;
|
||||
import com.linke.product.domain.commonFunctions.service.CommonFunctionsDomainService;
|
||||
import com.linke.product.interfaces.dto.commonFunctions.CommonFunctionsDTO;
|
||||
import com.linke.product.interfaces.facade.menu.vo.NavigationVo;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.UserError;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* 常用功能菜单ApplicationService
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-08-30
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class CommonFunctionsApplicationService {
|
||||
@Autowired
|
||||
private CommonFunctionsDomainService commonFunctionsDomainService;
|
||||
@Autowired
|
||||
private MenuApplicationService menuApplicationService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询常用功能菜单列表
|
||||
*/
|
||||
|
||||
public List<CommonFunctionsPO> queryList(CommonFunctionsDO commonFunctionsDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null){
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
if (topOrganizationId != null && topOrganizationId != 1){
|
||||
commonFunctionsDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
commonFunctionsDO.setUserId(loginUser.getUserid());
|
||||
}
|
||||
List<CommonFunctionsPO> commonFunctionsPOList = commonFunctionsDomainService.queryList(commonFunctionsDO);
|
||||
if (commonFunctionsPOList.size()>0){
|
||||
//查询当前用户是否还有当前菜单权限,如果没有,则从数组中剔除掉
|
||||
List<NavigationVo> navigationVoList = menuApplicationService.getLastNavigation();
|
||||
//比较两个数组,将commonFunctionsPOList中的菜单id与navigationVoList中的菜单id进行比较,如果相同,则保留,否则剔除
|
||||
for (int i = 0; i < commonFunctionsPOList.size(); i++) {
|
||||
CommonFunctionsPO commonFunctionsPO = commonFunctionsPOList.get(i);
|
||||
Long menuId = commonFunctionsPO.getMenuId();
|
||||
boolean flag = false;
|
||||
for (NavigationVo navigationVo : navigationVoList) {
|
||||
if (menuId.equals(navigationVo.getId())) {
|
||||
commonFunctionsPO.setNavigationVo(navigationVo);
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!flag) {
|
||||
commonFunctionsPOList.remove(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
return commonFunctionsPOList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增常用功能菜单
|
||||
*/
|
||||
public Boolean insert(CommonFunctionsDO commonFunctionsDO) {
|
||||
//获取当前登录用户
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
//将现有常用功能菜单删除
|
||||
commonFunctionsDomainService.deleteByUserId();
|
||||
if(commonFunctionsDO.getMenuIdList().size()>0){
|
||||
//筛选出最后一级菜单
|
||||
List<Long> menuIdList = menuApplicationService.getLastMenuIdList(commonFunctionsDO.getMenuIdList());
|
||||
//批量保存常用功能菜单
|
||||
List<CommonFunctions> commonFunctions = new ArrayList<>();
|
||||
for (Long aLong : menuIdList) {
|
||||
CommonFunctions commonFunctions1 = new CommonFunctions();
|
||||
BeanUtils.copyProperties(commonFunctionsDO, commonFunctions1);
|
||||
commonFunctions1.setUserId(loginUser.getUserid());
|
||||
commonFunctions1.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||
commonFunctions1.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
commonFunctions1.setOrganizationName(loginUser.getUserPo().getOrganizationName());
|
||||
commonFunctions1.setMenuId(aLong);
|
||||
commonFunctions.add(commonFunctions1);
|
||||
}
|
||||
return commonFunctionsDomainService.insertBatch(commonFunctions);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改常用功能菜单
|
||||
*/
|
||||
@Transactional
|
||||
public Boolean update(CommonFunctionsDO commonFunctionsDO) {
|
||||
//获取当前登录用户
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
//筛选出最后一级菜单
|
||||
List<Long> menuIdList = menuApplicationService.getLastMenuIdList(commonFunctionsDO.getMenuIdList());
|
||||
//将现有常用功能菜单删除
|
||||
commonFunctionsDomainService.deleteByUserId();
|
||||
//批量保存常用功能菜单
|
||||
List<CommonFunctions> commonFunctions = new ArrayList<>();
|
||||
for (Long aLong : menuIdList) {
|
||||
CommonFunctions commonFunctions1 = new CommonFunctions();
|
||||
BeanUtils.copyProperties(commonFunctionsDO, commonFunctions1);
|
||||
commonFunctions1.setUserId(loginUser.getUserid());
|
||||
commonFunctions1.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||
commonFunctions1.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
commonFunctions1.setOrganizationName(loginUser.getUserPo().getOrganizationName());
|
||||
commonFunctions1.setMenuId(aLong);
|
||||
commonFunctions.add(commonFunctions1);
|
||||
}
|
||||
return commonFunctionsDomainService.insertBatch(commonFunctions);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除常用功能菜单
|
||||
*/
|
||||
public boolean delete(CommonFunctionsDTO commonFunctionsDTO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
Set<String> commonFunctionsIdSet = Stream.of(commonFunctionsDTO.getCommonFunctionsIds().split(",")).collect(Collectors.toSet());
|
||||
Long[] commonFunctionsIds = commonFunctionsIdSet.stream().map(Long::valueOf).toArray(Long[]::new);
|
||||
return commonFunctionsDomainService.delete(commonFunctionsIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取常用功能菜单详细信息
|
||||
*/
|
||||
public CommonFunctionsPO getInfo(Long commonFunctionsId)
|
||||
{
|
||||
return commonFunctionsDomainService.getInfo(commonFunctionsId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+120
@@ -0,0 +1,120 @@
|
||||
package com.linke.product.application.service.commonProblem;
|
||||
|
||||
import com.linke.product.domain.commonProblem.repository.po.CommonProblemAppPO;
|
||||
import com.linke.product.domain.commonProblem.repository.po.CommonProblemPO;
|
||||
import com.linke.product.domain.commonProblem.repository.todo.CommonProblemDO;
|
||||
import com.linke.product.domain.commonProblem.service.CommonProblemDomainService;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import com.mhd.ticket.interfaces.dto.CommonProblemDTO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* 常见问题ApplicationService
|
||||
*
|
||||
* @author gen
|
||||
* @date 2023-09-25
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class CommonProblemApplicationService {
|
||||
@Autowired
|
||||
private CommonProblemDomainService commonProblemDomainService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询常见问题列表
|
||||
*/
|
||||
|
||||
public List<CommonProblemPO> queryList(CommonProblemDO commonProblemDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null) {
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
if (topOrganizationId != null && topOrganizationId != 1) {
|
||||
commonProblemDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
}
|
||||
return commonProblemDomainService.queryList(commonProblemDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询常见问题列表-App
|
||||
*/
|
||||
public List<CommonProblemAppPO> queryListApp(CommonProblemDO commonProblemDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null) {
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
if (topOrganizationId != null && topOrganizationId != 1) {
|
||||
commonProblemDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
}
|
||||
return commonProblemDomainService.queryListApp(commonProblemDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增常见问题
|
||||
*/
|
||||
public Boolean insert(CommonProblemDO commonProblemDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null) {
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
|
||||
if (topOrganizationId != null && topOrganizationId != 1) {
|
||||
commonProblemDO.setTopOrganizationId(topOrganizationId);
|
||||
commonProblemDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||
commonProblemDO.setOrganizationName(loginUser.getOrganizationPo().getOrganizationName());
|
||||
}
|
||||
}
|
||||
return commonProblemDomainService.insert(commonProblemDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改常见问题
|
||||
*/
|
||||
public Boolean update(CommonProblemDO commonProblemDO) {
|
||||
return commonProblemDomainService.update(commonProblemDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除常见问题
|
||||
*/
|
||||
public boolean delete(CommonProblemDTO commonProblemDTO) {
|
||||
Set<String> commonProblemIds = Stream.of(commonProblemDTO.getCommonProblemIds().split(",")).collect(Collectors.toSet());
|
||||
return commonProblemDomainService.delete(commonProblemIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取常见问题详细信息
|
||||
*/
|
||||
public CommonProblemPO getInfo(Long commonProblemId) {
|
||||
return commonProblemDomainService.getInfo(commonProblemId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取常见问题详细信息
|
||||
*/
|
||||
public CommonProblemAppPO getInfoApp(Long commonProblemId) {
|
||||
return commonProblemDomainService.getInfoApp(commonProblemId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用状态变更
|
||||
*/
|
||||
public Boolean statusChange(CommonProblemDO commonProblemDO) {
|
||||
if (null == commonProblemDO.getCommonProblemId() || null == commonProblemDO.getStatus()) {
|
||||
throw new IllegalArgumentException("参数异常");
|
||||
}
|
||||
if (commonProblemDO.getStatus() > 2 || commonProblemDO.getStatus() < 0) {
|
||||
throw new IllegalArgumentException("参数异常");
|
||||
}
|
||||
return commonProblemDomainService.update(commonProblemDO);
|
||||
}
|
||||
}
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
package com.linke.product.application.service.commonWeb;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.linke.product.domain.commonWeb.repository.po.CommonWebPO;
|
||||
import com.linke.product.domain.commonWeb.repository.todo.CommonWebDO;
|
||||
import com.linke.product.domain.commonWeb.service.CommonWebDomainService;
|
||||
import com.linke.product.interfaces.dto.commonWeb.CommonWebDTO;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.UserError;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* 常用系统/网站ApplicationService
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-08-30
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class CommonWebApplicationService {
|
||||
@Autowired
|
||||
private CommonWebDomainService commonWebDomainService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询常用系统/网站列表
|
||||
*/
|
||||
|
||||
public List<CommonWebPO> queryList(CommonWebDO commonWebDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null){
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
if (topOrganizationId != null && topOrganizationId != 1){
|
||||
commonWebDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
commonWebDO.setUserId(loginUser.getUserid());
|
||||
}
|
||||
return commonWebDomainService.queryList(commonWebDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增常用系统/网站
|
||||
*/
|
||||
public Boolean insert(CommonWebDO commonWebDO) {
|
||||
//获取当前登录用户
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
commonWebDO.setUserId(loginUser.getUserid());
|
||||
commonWebDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||
commonWebDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
commonWebDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
|
||||
return commonWebDomainService.insert(commonWebDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改常用系统/网站
|
||||
*/
|
||||
public Boolean update(CommonWebDO commonWebDO) {
|
||||
return commonWebDomainService.update(commonWebDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除常用系统/网站
|
||||
*/
|
||||
public boolean delete(CommonWebDTO commonWebDTO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
Set<String> commonWebIdSet = Stream.of(commonWebDTO.getCommonWebIds().split(",")).collect(Collectors.toSet());
|
||||
Long[] commonWebIds = commonWebIdSet.stream().map(Long::valueOf).toArray(Long[]::new);
|
||||
return commonWebDomainService.delete(commonWebIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取常用系统/网站详细信息
|
||||
*/
|
||||
public CommonWebPO getInfo(Long commonWebId)
|
||||
{
|
||||
return commonWebDomainService.getInfo(commonWebId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+297
@@ -0,0 +1,297 @@
|
||||
package com.linke.product.application.service.customAuth;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.linke.product.domain.customAuth.entity.CustomAuth;
|
||||
import com.linke.product.domain.customAuth.entity.CustomAuthOrganization;
|
||||
import com.linke.product.domain.customAuth.service.CustomAuthDomainService;
|
||||
import com.linke.product.domain.customAuth.service.CustomAuthOrganizationDomainService;
|
||||
import com.linke.product.domain.menu.repository.po.MenuPo;
|
||||
import com.linke.product.domain.menu.service.MenuDomainService;
|
||||
import com.linke.product.domain.organization.repository.po.OrganizationPo;
|
||||
import com.linke.product.domain.organization.service.OrganizationDomainService;
|
||||
import com.linke.product.infrastructure.feign.UserServiceFeign;
|
||||
import com.mhd.common.core.domain.dto.CustomAuthDTO;
|
||||
import com.mhd.common.core.domain.dto.CustomDTO;
|
||||
import com.mhd.common.core.domain.po.CustomAuthRoleOrUserPO;
|
||||
import com.mhd.common.core.domain.po.UserPo;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 自定义权限 应用服务层
|
||||
*
|
||||
* 本层可以综合应用各种业务间的组合
|
||||
*
|
||||
* 2022-12-10
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
@Service
|
||||
public class CustomAuthApplicationService
|
||||
{
|
||||
@Autowired
|
||||
private CustomAuthDomainService customAuthDomainService;
|
||||
@Autowired
|
||||
private MenuDomainService menuDomainService;
|
||||
@Autowired
|
||||
private CustomAuthOrganizationDomainService customAuthTenantsDomainService;
|
||||
@Autowired
|
||||
private OrganizationDomainService organizationDomainService;
|
||||
@Autowired
|
||||
UserServiceFeign userServiceFeign;
|
||||
|
||||
/**
|
||||
* 查询自定义权限
|
||||
*
|
||||
* @param customAuthId 自定义权限主键
|
||||
* @return 自定义权限
|
||||
*/
|
||||
public CustomAuth selectCustomAuthByCustomAuthId(Long customAuthId)
|
||||
{
|
||||
return customAuthDomainService.selectCustomAuthByCustomAuthId(customAuthId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询自定义权限
|
||||
*
|
||||
* @param menuId 菜单id
|
||||
* @return 自定义权限
|
||||
*/
|
||||
public CustomAuth selectCustomAuthByCustomAuthMenuId(Long menuId){
|
||||
return customAuthDomainService.selectCustomAuthByCustomAuthMenuId(menuId);
|
||||
}
|
||||
/**
|
||||
* 查询自定义权限
|
||||
*
|
||||
* @param menuId 菜单id
|
||||
* @return 自定义权限
|
||||
*/
|
||||
public CustomAuth getResouceInfoByMenuId(Long menuId){
|
||||
MenuPo menuPo = menuDomainService.selectMenuById(menuId);
|
||||
return customAuthDomainService.selectCustomAuthByCustomAuthMenuId(menuPo.getSourceId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询自定义权限列表
|
||||
*
|
||||
* @param customAuth 自定义权限
|
||||
* @return 自定义权限
|
||||
*/
|
||||
public List<CustomAuth> selectCustomAuthList(CustomAuth customAuth)
|
||||
{
|
||||
return customAuthDomainService.selectCustomAuthList(customAuth);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增自定义权限
|
||||
*
|
||||
* @param customAuth 自定义权限
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertCustomAuth(CustomAuth customAuth)
|
||||
{
|
||||
return customAuthDomainService.insertCustomAuth(customAuth);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改自定义权限
|
||||
*
|
||||
* @param customAuth 自定义权限
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateCustomAuth(CustomAuth customAuth)
|
||||
{
|
||||
return customAuthDomainService.updateCustomAuth(customAuth);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据菜单id修改自定义权限
|
||||
*
|
||||
* @param customAuth 自定义权限
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateCustomAuthByMenuId(CustomAuth customAuth){
|
||||
return customAuthDomainService.updateCustomAuthByMenuId(customAuth);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除自定义权限
|
||||
*
|
||||
* @param customAuthIds 需要删除的自定义权限主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCustomAuthByCustomAuthIds(Long[] customAuthIds)
|
||||
{
|
||||
return customAuthDomainService.deleteCustomAuthByCustomAuthIds(customAuthIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除自定义权限信息
|
||||
*
|
||||
* @param customAuthId 自定义权限主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCustomAuthByCustomAuthId(Long customAuthId)
|
||||
{
|
||||
return customAuthDomainService.deleteCustomAuthByCustomAuthId(customAuthId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询组织自定义权限
|
||||
*
|
||||
* @param customAuthOrganization 实体
|
||||
* @return 列表信息
|
||||
*/
|
||||
public CustomAuthOrganization selectCustomAuthByOrganization(CustomAuthOrganization customAuthOrganization){
|
||||
return customAuthTenantsDomainService.selectCustomAuthByOrganization(customAuthOrganization);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改组织自定义权限
|
||||
*
|
||||
* @param customAuthOrganization 组织自定义权限
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateCustomAuthOrganization(CustomAuthOrganization customAuthOrganization){
|
||||
return customAuthTenantsDomainService.updateCustomAuthOrganization(customAuthOrganization);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增组织自定义权限
|
||||
*
|
||||
* @param customAuthOrganization 组织自定义权限
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertCustomAuthOrganization(CustomAuthOrganization customAuthOrganization){
|
||||
|
||||
return customAuthTenantsDomainService.insertCustomAuthOrganization(customAuthOrganization);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询租户自定义权限
|
||||
*
|
||||
* @param customAuthOrganization 组织id
|
||||
* @return 列表信息
|
||||
*/
|
||||
public CustomAuthOrganization selectCustomAuthByTenants(CustomAuthOrganization customAuthOrganization){
|
||||
return customAuthTenantsDomainService.selectCustomAuthByTenants(customAuthOrganization);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改租户自定义权限
|
||||
*
|
||||
* @param customAuthOrganization 组织自定义权限
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateCustomAuthTenants(CustomAuthOrganization customAuthOrganization){
|
||||
return customAuthTenantsDomainService.updateCustomAuthOrganization(customAuthOrganization);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增租户自定义权限
|
||||
*
|
||||
* @param customAuthOrganization 组织自定义权限
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertCustomAuthTenants(CustomAuthOrganization customAuthOrganization){
|
||||
return customAuthTenantsDomainService.insertCustomAuthOrganization(customAuthOrganization);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询父级组织菜单按钮
|
||||
* @param customDTO
|
||||
* @return
|
||||
*/
|
||||
public CustomAuthOrganization getInfoByParentOrganization(CustomDTO customDTO) {
|
||||
CustomAuthOrganization result = new CustomAuthOrganization();
|
||||
//查询上级组织
|
||||
Long organizationId = customDTO.getOrganizationId();
|
||||
OrganizationPo parentOrganization = organizationDomainService.getParentOrganizationById(organizationId);
|
||||
if (parentOrganization.getParentOrganizationId() == 0L){
|
||||
//一级组织,直接查询菜单按钮返回即可
|
||||
CustomAuth customAuth = customAuthDomainService.selectCustomAuthByCustomAuthMenuId(customDTO.getMenuId());
|
||||
BeanUtils.copyProperties(customAuth,result);
|
||||
}else {
|
||||
CustomAuthOrganization customAuthOrganization = new CustomAuthOrganization();
|
||||
customAuthOrganization.setMenuId(customDTO.getMenuId());
|
||||
customAuthOrganization.setOrganizationId(parentOrganization.getOrganizationId());
|
||||
//查询组织对应的菜单按钮
|
||||
List<CustomAuthOrganization> customAuthOrganizations = customAuthTenantsDomainService.selectCustomAuthByOrganizationId(customAuthOrganization);
|
||||
if (CollectionUtil.isNotEmpty(customAuthOrganizations)){
|
||||
result = customAuthOrganizations.get(0);
|
||||
}
|
||||
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询当前组织菜单按钮
|
||||
* @param customDTO
|
||||
* @return
|
||||
*/
|
||||
public CustomAuthOrganization getInfoByOrganization(CustomDTO customDTO) {
|
||||
CustomAuthOrganization result = new CustomAuthOrganization();
|
||||
CustomAuthOrganization customAuthOrganization = new CustomAuthOrganization();
|
||||
customAuthOrganization.setMenuId(customDTO.getMenuId());
|
||||
customAuthOrganization.setOrganizationId(customDTO.getOrganizationId());
|
||||
//查询组织对应的菜单按钮
|
||||
List<CustomAuthOrganization> customAuthOrganizations = customAuthTenantsDomainService.selectCustomAuthByOrganizationId(customAuthOrganization);
|
||||
if (CollectionUtil.isNotEmpty(customAuthOrganizations)){
|
||||
result = customAuthOrganizations.get(0);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public CustomAuth getLoginCustom(CustomDTO customDTO) {
|
||||
//获取当前登陆人
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
UserPo userPo = loginUser.getUserPo();
|
||||
CustomAuth customAuth = new CustomAuth();
|
||||
if (userPo != null){
|
||||
//用户账号类型:0.无状态1.普通账号2.组织账号3.一级账号
|
||||
Integer userAccountType = userPo.getUserAccountType();
|
||||
if (userAccountType != null){
|
||||
if (userAccountType == 3){
|
||||
customAuth = customAuthDomainService.selectCustomAuthByCustomAuthMenuId(customDTO.getMenuId());
|
||||
}else if (userAccountType == 2){
|
||||
CustomAuthOrganization customAuthOrganization = new CustomAuthOrganization();
|
||||
customAuthOrganization.setMenuId(customDTO.getMenuId());
|
||||
customAuthOrganization.setOrganizationId(userPo.getOrganizationId());
|
||||
List<CustomAuthOrganization> customAuthOrganizations = customAuthTenantsDomainService.selectCustomAuthByOrganizationId(customAuthOrganization);
|
||||
if (CollectionUtil.isNotEmpty(customAuthOrganizations)){
|
||||
|
||||
}
|
||||
}else {
|
||||
//查询角色和个人的菜单
|
||||
CustomAuthDTO customAuthDTO = new CustomAuthDTO();
|
||||
customAuthDTO.setUserId(userPo.getUserId());
|
||||
customAuthDTO.setMenuId(customDTO.getMenuId());
|
||||
AjaxResult<?> customAuthUser = userServiceFeign.getCustomAuthByUserId(customAuthDTO);
|
||||
if("200".equals(String.valueOf(customAuthUser.get("code")))){
|
||||
List<CustomAuthRoleOrUserPO> customAuthUserList = JSON.parseArray(JSONObject.toJSONString(customAuthUser.get("data")), CustomAuthRoleOrUserPO.class);
|
||||
if (CollectionUtil.isNotEmpty(customAuthUserList)){
|
||||
CustomAuthRoleOrUserPO customAuthRoleOrUserPO = customAuthUserList.get(0);
|
||||
BeanUtils.copyProperties(customAuthRoleOrUserPO,customAuth);
|
||||
}
|
||||
}
|
||||
}
|
||||
}else {
|
||||
throw new ServiceException("登录用户账号类型错误,请联系管理员查证数据库配置!");
|
||||
}
|
||||
}else {
|
||||
throw new ServiceException("获取当前登陆人失败!");
|
||||
}
|
||||
return customAuth;
|
||||
}
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
package com.linke.product.application.service.elasticJob;
|
||||
|
||||
import com.linke.product.domain.elasticJob.service.ElasticJobDomainService;
|
||||
import com.mhd.common.core.domain.ElasticJob;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 分布式调度任务 应用服务层
|
||||
*
|
||||
* 本层可以综合应用各种业务间的组合
|
||||
*
|
||||
* 2023-05-10
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
@Service
|
||||
public class ElasticJobApplicationService {
|
||||
|
||||
@Autowired
|
||||
private ElasticJobDomainService elasticJobDomainService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询定时任务集合
|
||||
*
|
||||
* @param applicationName 项目名
|
||||
* @return 项目列表信息
|
||||
*/
|
||||
public List<ElasticJob> selectList(String applicationName){
|
||||
return elasticJobDomainService.selectList(applicationName);
|
||||
}
|
||||
}
|
||||
+1076
File diff suppressed because it is too large
Load Diff
+164
@@ -0,0 +1,164 @@
|
||||
package com.linke.product.application.service.modules;
|
||||
|
||||
import com.linke.product.application.event.modules.publish.ModulesPublish;
|
||||
import com.linke.product.domain.modules.entity.ModulesMenu;
|
||||
import com.linke.product.domain.modules.entity.SysModules;
|
||||
import com.linke.product.domain.modules.service.ModulesMenuDomainService;
|
||||
import com.linke.product.domain.modules.service.SysModulesDomainService;
|
||||
import com.linke.product.interfaces.dto.modules.SysModulesDto;
|
||||
import com.linke.product.interfaces.facade.modules.vo.ModulesVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 模块 应用服务层
|
||||
*
|
||||
* 本层可以综合应用各种业务间的组合
|
||||
*
|
||||
* 2022-11-25
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
@Service
|
||||
public class SysModulesApplicationService {
|
||||
@Autowired
|
||||
private SysModulesDomainService iSysModulesSvc;
|
||||
@Autowired
|
||||
private ModulesMenuDomainService iModulesMenuSvc;
|
||||
@Autowired
|
||||
private ModulesPublish modulesPublish;
|
||||
|
||||
/**
|
||||
* 查询产品中台-模块
|
||||
*
|
||||
* @param modulesId 产品中台-模块主键
|
||||
* @return 产品中台-模块
|
||||
*/
|
||||
public SysModules selectSysModulesByModulesId(Long modulesId)
|
||||
{
|
||||
return iSysModulesSvc.selectSysModulesByModulesId(modulesId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询产品中台-模块列表
|
||||
*
|
||||
* @param sysModules 产品中台-模块
|
||||
* @return 产品中台-模块
|
||||
*/
|
||||
public List<SysModules> selectSysModulesList(SysModules sysModules)
|
||||
{
|
||||
return iSysModulesSvc.selectSysModulesList(sysModules);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询产品中台-模块列表(id和name)
|
||||
*
|
||||
* @return 产品中台-模块集合
|
||||
*/
|
||||
public List<Map<String,Object>> selectModulesList(Integer modulesClient){
|
||||
return iSysModulesSvc.selectModulesList(modulesClient);
|
||||
}
|
||||
|
||||
/**
|
||||
* 排序(增)
|
||||
*
|
||||
* @param modulesId id
|
||||
*/
|
||||
public void updateSortAdd(Long modulesId)
|
||||
{
|
||||
iSysModulesSvc.updateSortAdd(modulesId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 排序(减)
|
||||
*
|
||||
* @param modulesId id
|
||||
*/
|
||||
public void updateSortSubtract(Long modulesId)
|
||||
{
|
||||
iSysModulesSvc.updateSortSubtract(modulesId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增产品中台-模块
|
||||
*
|
||||
* @param sysModules 产品中台-模块
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSysModules(SysModules sysModules)
|
||||
{
|
||||
//变更中台树结构缓存消息发送
|
||||
// modulesPublish.sendMessage("修改中台树缓存");
|
||||
return iSysModulesSvc.insertSysModules(sysModules);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改产品中台-模块
|
||||
*
|
||||
* @param sysModules 产品中台-模块
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSysModules(SysModules sysModules)
|
||||
{
|
||||
//变更中台树结构缓存消息发送
|
||||
// modulesPublish.sendMessage("修改中台树缓存");
|
||||
return iSysModulesSvc.updateSysModules(sysModules);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除产品中台-模块
|
||||
*
|
||||
* @param modulesIds 需要删除的产品中台-模块主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysModulesByModulesIds(Long[] modulesIds)
|
||||
{
|
||||
//变更中台树结构缓存消息发送
|
||||
// modulesPublish.sendMessage("修改中台树缓存");
|
||||
return iSysModulesSvc.deleteSysModulesByModulesIds(modulesIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除产品中台-模块信息
|
||||
*
|
||||
* @param modulesId 产品中台-模块主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysModulesByModulesId(Long modulesId)
|
||||
{
|
||||
//变更中台树结构缓存消息发送
|
||||
// modulesPublish.sendMessage("修改中台树缓存");
|
||||
return iSysModulesSvc.deleteSysModulesByModulesId(modulesId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询菜单树形结构
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public List<ModulesVo> selectTreeModules(String modulesName, Integer modulesClient){
|
||||
return iSysModulesSvc.selectTreeModules(modulesName, modulesClient);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询模块菜单权限
|
||||
*
|
||||
* @param id 模块id
|
||||
* @return 列表信息
|
||||
*/
|
||||
public List<ModulesMenu> selectMenuListByModulesId(Long id){
|
||||
return iModulesMenuSvc.selectMenuListByModulesId(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改模块菜单权限
|
||||
*
|
||||
* @param sysModulesDto 模块菜单权限
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateModulesMenu(SysModulesDto sysModulesDto){
|
||||
return iModulesMenuSvc.updateModulesMenu(sysModulesDto);
|
||||
}
|
||||
}
|
||||
+637
@@ -0,0 +1,637 @@
|
||||
package com.linke.product.application.service.organization;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.linke.product.application.event.organization.publish.OrganizationPublish;
|
||||
import com.linke.product.domain.common.entity.DataPermission;
|
||||
import com.linke.product.domain.customAuth.service.CustomAuthDomainService;
|
||||
import com.linke.product.domain.customAuth.service.CustomAuthOrganizationDomainService;
|
||||
import com.linke.product.domain.menu.service.MenuDomainService;
|
||||
import com.linke.product.domain.organization.entity.Organization;
|
||||
import com.linke.product.domain.organization.entity.OrganizationMenu;
|
||||
import com.linke.product.domain.organization.repository.po.OrganizationPo;
|
||||
import com.linke.product.domain.organization.repository.todo.OrganizationCorrelationDO;
|
||||
import com.linke.product.domain.organization.service.OrganizationCorrelationDomainService;
|
||||
import com.linke.product.domain.organization.service.OrganizationMenuDomainService;
|
||||
import com.linke.product.domain.organization.service.OrganizationDomainService;
|
||||
import com.linke.product.domain.organization.service.OrganizationWlhyDomainService;
|
||||
import com.linke.product.domain.tenants.repository.po.SysTenantsPo;
|
||||
import com.linke.product.infrastructure.feign.SpecialServiceFeign;
|
||||
import com.linke.product.infrastructure.feign.UserServiceFeign;
|
||||
import com.linke.product.infrastructure.util.menu.MenuUtils;
|
||||
import com.linke.product.interfaces.dto.organization.OrganizationDto;
|
||||
import com.mhd.common.core.domain.po.MenuVo;
|
||||
import com.linke.product.interfaces.facade.organization.vo.OrganizationVo;
|
||||
import com.mhd.common.core.domain.dto.RoleDTO;
|
||||
import com.mhd.common.core.domain.dto.UserDTO;
|
||||
import com.mhd.common.core.domain.entity.R;
|
||||
import com.mhd.common.core.domain.po.BranchPo;
|
||||
import com.mhd.common.core.domain.po.RolePO;
|
||||
import com.mhd.common.core.domain.po.UserConfigSwitchPo;
|
||||
import com.mhd.common.core.domain.po.UserPo;
|
||||
import com.mhd.common.core.domain.po.thirdparty.EsginTemplateSealPo;
|
||||
import com.mhd.common.core.domain.po.thirdparty.OrganizeBeanPo;
|
||||
import com.mhd.common.core.domain.thirdparty.AddTemplateSealEnterpriseDTO;
|
||||
import com.mhd.common.core.domain.thirdparty.OrganizeBeanDTO;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.UserError;
|
||||
import com.mhd.common.core.feign.ThirdPartyServiceFeign;
|
||||
import com.mhd.common.core.utils.StringUtils;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.SystemServiceFeign;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 组织 应用服务层
|
||||
* <p>
|
||||
* 本层可以综合应用各种业务间的组合
|
||||
* <p>
|
||||
* 2022-11-21
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class OrganizationApplicationService {
|
||||
|
||||
@Autowired
|
||||
private OrganizationDomainService iOrganizationSvc;
|
||||
@Autowired
|
||||
private OrganizationWlhyDomainService organizationWlhyDomainService;
|
||||
@Autowired
|
||||
private OrganizationMenuDomainService iOrganizationMenuSvc;
|
||||
@Autowired
|
||||
private OrganizationPublish organizationPublish;
|
||||
@Autowired
|
||||
private MenuDomainService menuDomainService;
|
||||
@Autowired
|
||||
private OrganizationCorrelationDomainService organizationCorrelationDomainService;
|
||||
@Resource
|
||||
private UserServiceFeign userServiceFeign;
|
||||
@Resource
|
||||
private SpecialServiceFeign specialServiceFeign;
|
||||
@Autowired
|
||||
private CustomAuthOrganizationDomainService customAuthOrganizationDomainService;
|
||||
@Autowired
|
||||
private CustomAuthDomainService customAuthDomainService;
|
||||
@Autowired
|
||||
private SystemServiceFeign systemServiceFeigh;
|
||||
@Autowired
|
||||
private ThirdPartyServiceFeign thirdPartyServiceFeign;
|
||||
@Resource
|
||||
private MenuUtils menuUtils;
|
||||
|
||||
/**
|
||||
* 查询组织集合
|
||||
*
|
||||
* @param organizationPo 组织
|
||||
* @return 组织列表信息
|
||||
*/
|
||||
public List<OrganizationPo> selectOrganizationList(OrganizationPo organizationPo, DataPermission dataPermission) {
|
||||
if(dataPermission != null){
|
||||
if(dataPermission.getOrganizationIdList() != null && dataPermission.getOrganizationIdList().size() > 0){
|
||||
organizationPo.setOrganizationIdList(dataPermission.getOrganizationIdList());
|
||||
}
|
||||
if(dataPermission.getCreateBy() != null){
|
||||
organizationPo.setCreateBy(dataPermission.getCreateBy());
|
||||
}
|
||||
}
|
||||
if(organizationPo.getIsBranch() != null && organizationPo.getIsBranch() == 1){
|
||||
//获取当前用户所有角色下的菜单
|
||||
AjaxResult roleMenu = specialServiceFeign.selectBranchOrganizationIds();
|
||||
if("200".equals(String.valueOf(roleMenu.get("code")))){
|
||||
List<Long> longs = JSON.parseArray(JSONObject.toJSONString(roleMenu.get("data")), Long.class);
|
||||
organizationPo.setOrganizationIdNotList(longs);
|
||||
}
|
||||
}
|
||||
List<OrganizationPo> organizationPos = iOrganizationSvc.selectOrganizationList(organizationPo);
|
||||
if (CollectionUtil.isNotEmpty(organizationPos)) {
|
||||
List<Long> organizationIdList = organizationPos.stream().map(OrganizationPo::getOrganizationId).collect(Collectors.toList());
|
||||
RoleDTO roleDTO = new RoleDTO();
|
||||
roleDTO.setOrganizationIds(organizationIdList);
|
||||
R<List<RolePO>> result = userServiceFeign.roleListByOrganizationIds(roleDTO);
|
||||
if (R.SUCCESS != result.getCode()) {
|
||||
throw new ServiceException(result.getMsg());
|
||||
}
|
||||
List<RolePO> data = result.getData();
|
||||
Map<Long, List<RolePO>> roleMap = data.stream().collect(Collectors.groupingBy(RolePO::getOrganizationId));
|
||||
for (OrganizationPo po : organizationPos) {
|
||||
List<RolePO> rolePOS = roleMap.get(po.getOrganizationId());
|
||||
if (CollectionUtil.isNotEmpty(rolePOS)){
|
||||
List<String> codeList = rolePOS.stream().map(RolePO::getRoleCode).collect(Collectors.toList());
|
||||
po.setRoleCodeList(codeList);
|
||||
}
|
||||
}
|
||||
UserDTO userDTO = new UserDTO();
|
||||
userDTO.setOrganizationIdList(organizationIdList);
|
||||
R<List<UserPo>> listByOrganizationIdList = userServiceFeign.getListByOrganizationIdList(userDTO);
|
||||
if (R.SUCCESS != result.getCode()) {
|
||||
throw new ServiceException(listByOrganizationIdList.getMsg());
|
||||
}
|
||||
List<UserPo> userPoList = listByOrganizationIdList.getData();
|
||||
Map<Long, List<UserPo>> userMap = new HashMap<>();
|
||||
if(userPoList != null && userPoList.size()>0){
|
||||
userMap = userPoList.stream().collect(Collectors.groupingBy(UserPo::getOrganizationId));
|
||||
}
|
||||
for (OrganizationPo po : organizationPos) {
|
||||
po.setUserId(po.getPrincipalId());
|
||||
List<UserPo> userPos = userMap.get(po.getOrganizationId());
|
||||
if (userPos != null && !userPos.isEmpty()){
|
||||
po.setEmployeeNum(userPos.size());
|
||||
}
|
||||
}
|
||||
}
|
||||
return organizationPos;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询组织信息
|
||||
*
|
||||
* @param id 组织id
|
||||
* @return 组织信息
|
||||
*/
|
||||
public OrganizationPo selectOrganizationById(Long id) {
|
||||
return iOrganizationSvc.selectOrganizationById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增组织
|
||||
*
|
||||
* @param organization 组织信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional
|
||||
public boolean insertOrganization(Organization organization) {
|
||||
//获取当前登录人
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
OrganizationPo organizationPo1 = iOrganizationSvc.selectOrganizationById(organization.getParentOrganizationId());
|
||||
organization.setTenantsId(organizationPo1.getTenantsId());
|
||||
if (organizationPo1 != null){
|
||||
organization.setPlatefromType(organizationPo1.getPlatefromType());
|
||||
if (organizationPo1.getPlatefromType() != null && organizationPo1.getPlatefromType() == 1){
|
||||
organization.setPlatefromType(2);
|
||||
}
|
||||
}
|
||||
//变更组织树结构缓存消息发送
|
||||
// organizationPublish.sendMessage("修改组织树缓存");
|
||||
iOrganizationSvc.insertOrganization(organization);
|
||||
boolean flag = organizationWlhyDomainService.addOrganizationInfo(organization);
|
||||
if(!flag){
|
||||
throw new ServiceException("同步网货公司数据失败");
|
||||
}
|
||||
//判断当前登录角色 如果是票务服务平台自动绑定该组织
|
||||
Integer platefromType = loginUser.getOrganizationPo().getPlatefromType();
|
||||
if (platefromType == 1){
|
||||
//票务服务平台
|
||||
Long organizationId = loginUser.getOrganizationPo().getOrganizationId();
|
||||
OrganizationCorrelationDO organizationCorrelationDO = new OrganizationCorrelationDO();
|
||||
organizationCorrelationDO.setOrganizationId(organization.getOrganizationId());
|
||||
organizationCorrelationDO.setAssociationOrganizationId(organizationId);
|
||||
organizationCorrelationDomainService.insert(organizationCorrelationDO);
|
||||
}
|
||||
/**
|
||||
* 设置菜单权限
|
||||
* 1.查询父级菜单信息
|
||||
* 2.上级组织为一级组织将直接查询菜单表
|
||||
* 3.上级组织不是一级组织将查询权限菜单表
|
||||
*/
|
||||
/*List<Long> menuIdList = new ArrayList<>();
|
||||
if(organization.getParentOrganizationId() != null && organization.getParentOrganizationId() != 0L){
|
||||
List<OrganizationMenu> organizationMenus = new ArrayList<>();
|
||||
OrganizationPo organizationPo = iOrganizationSvc.selectOrganizationById(organization.getParentOrganizationId());
|
||||
if(organizationPo.getParentOrganizationId() == 0L){
|
||||
MenuPo menuPo = new MenuPo();
|
||||
menuPo.setTopOrganizationId(organizationPo.getOrganizationId());
|
||||
menuPo.setDelFlag(1);
|
||||
menuIdList = menuDomainService.getAllByTenantsId(organizationPo.getTenantsId());
|
||||
if (CollectionUtil.isNotEmpty(menuIdList)){
|
||||
menuIdList.forEach(e->{
|
||||
OrganizationMenu organizationMenu = new OrganizationMenu();
|
||||
organizationMenu.setMenuId(e);
|
||||
organizationMenu.setOrganizationId(organization.getOrganizationId());
|
||||
organizationMenu.setDelFlag(1);
|
||||
organizationMenu.setCreateBy(loginUser.getUserPo().getUserId());
|
||||
organizationMenu.setCreateByName(loginUser.getUserPo().getUserName());
|
||||
organizationMenu.setCreateTime(new Date());
|
||||
organizationMenus.add(organizationMenu);
|
||||
});
|
||||
}
|
||||
}else {
|
||||
List<OrganizationMenu> parentOrganizationMenus = iOrganizationMenuSvc.selectMenuListByOrganizationId(organizationPo.getOrganizationId());
|
||||
if (CollectionUtil.isNotEmpty(parentOrganizationMenus)){
|
||||
for (OrganizationMenu parentOrganizationMenu : parentOrganizationMenus) {
|
||||
parentOrganizationMenu.setOrganizationId(organization.getOrganizationId());
|
||||
parentOrganizationMenu.setOrganizationMenuId(null);
|
||||
parentOrganizationMenu.setCreateBy(loginUser.getUserPo().getUserId());
|
||||
parentOrganizationMenu.setCreateByName(loginUser.getUserPo().getUserName());
|
||||
parentOrganizationMenu.setCreateTime(new Date());
|
||||
organizationMenus.add(parentOrganizationMenu);
|
||||
menuIdList.add(parentOrganizationMenu.getMenuId());
|
||||
}
|
||||
}
|
||||
}
|
||||
iOrganizationMenuSvc.saveBatch(organizationMenus);
|
||||
}
|
||||
*//**
|
||||
* 按钮权限
|
||||
* 1.查出所有新增的菜单对应的按钮权限,给当前组织新增上去
|
||||
*//*
|
||||
List<CustomAuthOrganization> customAuthOrganizationList = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(menuIdList)){
|
||||
List<CustomAuth> customAuthList = customAuthDomainService.selectByMenuIds(menuIdList);
|
||||
if (CollectionUtil.isNotEmpty(menuIdList)){
|
||||
customAuthList.forEach(e->{
|
||||
CustomAuthOrganization customAuthOrganization = new CustomAuthOrganization();
|
||||
customAuthOrganization.setOrganizationId(organization.getOrganizationId());
|
||||
customAuthOrganization.setMenuId(e.getMenuId());
|
||||
customAuthOrganization.setButtonJson(e.getButtonJson());
|
||||
customAuthOrganization.setFormJson(e.getFormJson());
|
||||
customAuthOrganization.setTableJson(e.getTableJson());
|
||||
customAuthOrganization.setCreateBy(loginUserId);
|
||||
customAuthOrganization.setCreateByName(loginUserName);
|
||||
customAuthOrganization.setCreateTime(new Date());
|
||||
customAuthOrganizationList.add(customAuthOrganization);
|
||||
});
|
||||
}
|
||||
customAuthOrganizationDomainService.saveBatch(customAuthOrganizationList);
|
||||
}*/
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改组织信息
|
||||
*
|
||||
* @param organization 组织信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateOrganization(Organization organization) {
|
||||
//变更组织树结构缓存消息发送
|
||||
// organizationPublish.sendMessage("修改组织树缓存");
|
||||
|
||||
boolean flag = organizationWlhyDomainService.addOrganizationInfo(organization);
|
||||
if(!flag){
|
||||
throw new ServiceException("同步网货公司数据失败");
|
||||
}
|
||||
|
||||
return iOrganizationSvc.updateOrganization(organization);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除组织
|
||||
*
|
||||
* @param id 组织ID
|
||||
* @return 结果
|
||||
*/
|
||||
public Boolean deleteOrganizationById(Long id) {
|
||||
//变更组织树结构缓存消息发送
|
||||
// organizationPublish.sendMessage("修改组织树缓存");
|
||||
//查询网点数据是否存在或是停用
|
||||
AjaxResult info = specialServiceFeign.getBranchByOrganizationId(id);
|
||||
if(!"200".equals(String.valueOf(info.get("code")))){
|
||||
throw new ServiceException("获取网点失败");
|
||||
}
|
||||
BranchPo branchPo = JSONObject.parseObject(JSONObject.toJSONString(info.get("data")), BranchPo.class);
|
||||
if (branchPo != null && branchPo.getBranchId() != null){
|
||||
throw new ServiceException("存在网点数据未删除,请删除网点后重试");
|
||||
}
|
||||
|
||||
Organization organization = new Organization();
|
||||
organization.setOrganizationId(id);
|
||||
organization.setDelFlag(2);
|
||||
organizationWlhyDomainService.addOrganizationInfo(organization);
|
||||
|
||||
return iOrganizationSvc.updateById(organization);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除组织
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteOrganizationByIds(Long[] ids) {
|
||||
//变更组织树结构缓存消息发送
|
||||
// organizationPublish.sendMessage("修改组织树缓存");
|
||||
return iOrganizationSvc.deleteOrganizationByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询组织树形结构
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public List<OrganizationVo> selectTreeOrganization(DataPermission dataPermission) {
|
||||
return iOrganizationSvc.selectTreeOrganization(dataPermission);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询组织菜单权限
|
||||
*
|
||||
* @param id 组织id
|
||||
* @return 列表信息
|
||||
*/
|
||||
public List<OrganizationMenu> selectMenuListByOrganizationId(Long id) {
|
||||
List<OrganizationMenu> organizationMenus = iOrganizationMenuSvc.selectMenuListByOrganizationId(id);
|
||||
return menuUtils.packKeyByOrganizationMenu(organizationMenus, "02-");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询组织菜单权限
|
||||
* @param organizationDto
|
||||
* @return
|
||||
*/
|
||||
public List<OrganizationMenu> selectMenuListByOrganizationIdPost(OrganizationDto organizationDto) {
|
||||
List<OrganizationMenu> organizationMenus = iOrganizationMenuSvc.selectMenuListByOrganizationId(organizationDto.getOrganizationId());
|
||||
menuUtils.packKeyByOrganizationMenu(organizationMenus, "02-");
|
||||
List<MenuVo> menuVoList = organizationDto.getMenuVoList();
|
||||
|
||||
return menuUtils.matchingData(organizationMenus, menuVoList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询当前组织所有的组织id
|
||||
*
|
||||
* @param organizationId 组织id
|
||||
* @return 列表信息
|
||||
*/
|
||||
public List<Long> selectOrganizationIdsByOrganizationId(Long organizationId) {
|
||||
return iOrganizationSvc.selectOrganizationIdsByOrganizationId(organizationId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改组织菜单权限
|
||||
*
|
||||
* @param organizationDto 组织菜单权限
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateOrganizationMenu(OrganizationDto organizationDto) {
|
||||
if ((organizationDto.getOrganizationMenu() == null || organizationDto.getOrganizationMenu().length == 0)
|
||||
|| organizationDto.getIdKeyList() != null && !organizationDto.getIdKeyList().isEmpty()){
|
||||
menuUtils.removeKey(organizationDto);
|
||||
}
|
||||
return iOrganizationMenuSvc.updateOrganizationMenu(organizationDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归查询一级父组织id
|
||||
*
|
||||
* @param id 组织id
|
||||
* @return 组织信息
|
||||
*/
|
||||
public Long selectTopId(Long id) {
|
||||
return iOrganizationSvc.selectTopId(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 根据组织id获取所有的上级组织id
|
||||
* @author ZhouGY
|
||||
* @date 2023/11/7 9:14
|
||||
* @param id
|
||||
* @return List<Long>
|
||||
*/
|
||||
public List<Long> selectTopOrganizationList(Long id) {
|
||||
return iOrganizationSvc.selectTopOrganizationList(id);
|
||||
}
|
||||
|
||||
public SysTenantsPo selectTopIdByTenantsDomainName(String tenantsDomainName) {
|
||||
return iOrganizationSvc.selectTopIdByTenantsDomainName(tenantsDomainName);
|
||||
}
|
||||
public List<Long> selectAllOrganizationId() {
|
||||
return iOrganizationSvc.selectAllOrganizationId();
|
||||
}
|
||||
|
||||
public List<Long> getOrganizationIdsByOrganizationIds(List<Long> organizationIds) {
|
||||
List<Long> list = iOrganizationSvc.getCurrentAllOrganization(organizationIds, organizationIds);
|
||||
return list;
|
||||
}
|
||||
|
||||
public OrganizationPo getInfoForChildIdList(Long id) {
|
||||
OrganizationPo organizationPo = iOrganizationSvc.selectOrganizationById(id);
|
||||
List<Long> list = iOrganizationSvc.selectChildByOrganization(id);
|
||||
organizationPo.setOrganizationIdList(list);
|
||||
return organizationPo;
|
||||
}
|
||||
|
||||
public Boolean updatePrincipal(Organization organization) {
|
||||
return iOrganizationSvc.updateById(organization);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据当前节点的id查询所有的子节点信息及本节点信息
|
||||
* @param organizationId
|
||||
* @return
|
||||
*/
|
||||
public List<Long> selectAllOrganizationById(Long organizationId) {
|
||||
return iOrganizationSvc.selectAllOrganizationById(organizationId);
|
||||
}
|
||||
|
||||
public List<Long> editOrganizationMenu(OrganizationDto organizationDto) {
|
||||
//获取当前组织的所有菜单权限
|
||||
List<OrganizationMenu> organizationMenuList = iOrganizationMenuSvc.selectMenuListByOrganizationId(organizationDto.getOrganizationId());
|
||||
//不存在的才进行新增
|
||||
List<Long> organizationMenuIdList = organizationMenuList.stream().map(OrganizationMenu::getMenuId).collect(Collectors.toList());
|
||||
|
||||
|
||||
|
||||
//需要新增的菜单id(返回给角色添加使用)
|
||||
List<Long> availableMenuIdList = new ArrayList<>();
|
||||
//传递过来的所有需要新增的菜单
|
||||
List<Long> menuIdList = organizationDto.getMenuIdList();
|
||||
Long createBy = organizationDto.getCreateBy();
|
||||
String createByName = organizationDto.getCreateByName();
|
||||
Long parentOrganizationId = organizationDto.getParentOrganizationId();
|
||||
Long organizationId = organizationDto.getOrganizationId();
|
||||
List<OrganizationMenu> organizationMenus = new ArrayList<>();
|
||||
if(parentOrganizationId != null && parentOrganizationId != 0L && CollectionUtil.isNotEmpty(menuIdList)){
|
||||
//获取父级组织信息(一级组织拥有自己的菜单,非一级组织只拥有菜单权限)
|
||||
OrganizationPo organizationPo = iOrganizationSvc.selectOrganizationById(parentOrganizationId);
|
||||
if(organizationPo.getParentOrganizationId() == 0L){
|
||||
//获取一级组织对应的所有菜单
|
||||
List<Long> allByTenantsId = menuDomainService.getMenuIdByTenantsId(organizationPo.getTenantsId(),null);
|
||||
if (CollectionUtil.isNotEmpty(allByTenantsId)){
|
||||
for (Long aLong : menuIdList) {
|
||||
if (allByTenantsId.contains(aLong) && !organizationMenuIdList.contains(aLong)){
|
||||
//可用菜单集合
|
||||
availableMenuIdList.add(aLong);
|
||||
OrganizationMenu organizationMenu = new OrganizationMenu();
|
||||
organizationMenu.setMenuId(aLong);
|
||||
organizationMenu.setOrganizationId(organizationId);
|
||||
organizationMenu.setDelFlag(1);
|
||||
organizationMenu.setCreateBy(createBy);
|
||||
organizationMenu.setCreateByName(createByName);
|
||||
organizationMenu.setCreateTime(new Date());
|
||||
organizationMenus.add(organizationMenu);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}else {
|
||||
List<OrganizationMenu> parentOrganizationMenus = iOrganizationMenuSvc.selectMenuListByOrganizationId(organizationId);
|
||||
if (CollectionUtil.isNotEmpty(parentOrganizationMenus)){
|
||||
for (OrganizationMenu parentOrganizationMenu : parentOrganizationMenus) {
|
||||
if (menuIdList.add(parentOrganizationMenu.getMenuId())){
|
||||
//可用菜单集合
|
||||
availableMenuIdList.add(parentOrganizationMenu.getMenuId());
|
||||
parentOrganizationMenu.setOrganizationId(organizationId);
|
||||
parentOrganizationMenu.setOrganizationMenuId(null);
|
||||
parentOrganizationMenu.setCreateBy(createBy);
|
||||
parentOrganizationMenu.setCreateByName(createByName);
|
||||
parentOrganizationMenu.setCreateTime(new Date());
|
||||
organizationMenus.add(parentOrganizationMenu);
|
||||
menuIdList.add(parentOrganizationMenu.getMenuId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
iOrganizationMenuSvc.saveBatch(organizationMenus);
|
||||
return availableMenuIdList;
|
||||
}
|
||||
|
||||
public List<OrganizationPo> getTenantsList() {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser == null){
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
UserPo userPo = loginUser.getUserPo();
|
||||
String roleCode = userPo.getRoleCode();
|
||||
Long topOrganization = userPo.getTopOrganizationId();
|
||||
if (roleCode.contains("super_admin")){
|
||||
topOrganization = null;
|
||||
}
|
||||
return iOrganizationMenuSvc.getTenantsList(topOrganization);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据当前登陆人获取全部的组织
|
||||
* @return
|
||||
*/
|
||||
public List<OrganizationPo> getAllOrganizationByLoginUser() {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
List<Long> longs = iOrganizationSvc.selectAllOrganizationById(topOrganizationId);
|
||||
OrganizationPo organizationPo = new OrganizationPo();
|
||||
organizationPo.setOrganizationIdList(longs);
|
||||
List<OrganizationPo> organizationPos = iOrganizationSvc.selectOrganizationList(organizationPo);
|
||||
return organizationPos;
|
||||
}
|
||||
|
||||
public List<OrganizationPo> getByIdList(List<Long> organizationIdList) {
|
||||
OrganizationPo organizationPo = new OrganizationPo();
|
||||
organizationPo.setOrganizationIdList(organizationIdList);
|
||||
List<OrganizationPo> organizationPos = iOrganizationSvc.selectOrganizationList(organizationPo);
|
||||
return organizationPos;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建组织签章
|
||||
* @param organizationDto
|
||||
*/
|
||||
@Transactional
|
||||
public void createOrgSignature(OrganizationDto organizationDto) {
|
||||
// 获取开关配置,查询创建签章方式
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser == null){
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
UserConfigSwitchPo userConfigSwitchPo = null;
|
||||
//查询数据库,并且存到redis中
|
||||
AjaxResult ajaxResult = systemServiceFeigh.getUserConfigSwitchInfoByOrgId(loginUser.getUserPo().getOrganizationId());
|
||||
if ("200".equals(String.valueOf(ajaxResult.get("code")))) {
|
||||
userConfigSwitchPo = JSONObject.parseObject(JSONObject.toJSONString(ajaxResult.get("data")), UserConfigSwitchPo.class);
|
||||
}
|
||||
if (ObjectUtil.isNull(userConfigSwitchPo)) {
|
||||
throw new ServiceException("获取组织配置信息失败");
|
||||
}
|
||||
if(userConfigSwitchPo.getOcrDefault()==0){
|
||||
//E签宝
|
||||
createOrgSignatureEsign(organizationDto.getOrganizationId());
|
||||
}else {
|
||||
//TODO 其他方式
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* E签宝创建组织签章
|
||||
* @param organizationId
|
||||
*/
|
||||
private void createOrgSignatureEsign(Long organizationId) {
|
||||
OrganizationPo organizationPo = iOrganizationSvc.selectOrganizationById(organizationId);
|
||||
if(null == organizationPo){
|
||||
throw new ServiceException("组织信息未找到");
|
||||
}
|
||||
Organization organization = new Organization();
|
||||
organization.setOrganizationId(organizationPo.getOrganizationId());
|
||||
OrganizeBeanDTO organizeBeanDTO = new OrganizeBeanDTO();
|
||||
organizeBeanDTO.setName(organizationPo.getOrganizationName());
|
||||
organizeBeanDTO.setOrganType(0);//单位类型,默认0 枚举:(1)0-普通企业(2)1-社会团体(3)2-事业单位(4)3-民办非企业单位(5)4
|
||||
organizeBeanDTO.setUserType(2);//注册类型,默认1 (1)1-代理人注册 (2)2-法人注册
|
||||
organizeBeanDTO.setOrganCode(organizationPo.getSocialCreditCode());
|
||||
organizeBeanDTO.setLegalName(organizationPo.getLegalPerson());
|
||||
organizeBeanDTO.setLegalArea(0);
|
||||
organizeBeanDTO.setLegalIdNo(organizationPo.getLegalPersonIdNo());
|
||||
AjaxResult result1 = thirdPartyServiceFeign.addAccount(organizeBeanDTO);
|
||||
if (!"200".equals(result1.get("code").toString())) {
|
||||
throw new ServiceException("生成E签宝账户失败:"+ result1.get("msg"));
|
||||
}
|
||||
OrganizeBeanPo organizeBeanPo = JSON.parseObject(com.alibaba.fastjson2.JSONObject.toJSONString(result1.get("data")), OrganizeBeanPo.class);
|
||||
if(null == organizeBeanPo){
|
||||
throw new ServiceException("生成E签宝账户失败");
|
||||
}
|
||||
//如果没有生成签章则再次生成
|
||||
organization.setAccountId(organizeBeanPo.getAccountId());
|
||||
if(!StringUtils.isNotBlank(organizationPo.getTemplateSeal())){
|
||||
//生成电子签章
|
||||
AddTemplateSealEnterpriseDTO addTemplateSealEnterpriseDTO = new AddTemplateSealEnterpriseDTO();
|
||||
addTemplateSealEnterpriseDTO.setHText("合同专用章");
|
||||
addTemplateSealEnterpriseDTO.setAccountId(organizeBeanPo.getAccountId());
|
||||
AjaxResult ajaxResult = thirdPartyServiceFeign.addTemplateSealEnterprise(addTemplateSealEnterpriseDTO);
|
||||
if (!"200".equals(ajaxResult.get("code").toString())) {
|
||||
throw new ServiceException("生成E签宝签章失败");
|
||||
}
|
||||
EsginTemplateSealPo esginTemplateSealPo = JSON.parseObject(com.alibaba.fastjson2.JSONObject.toJSONString(ajaxResult.get("data")), EsginTemplateSealPo.class);
|
||||
if(null == esginTemplateSealPo){
|
||||
throw new ServiceException("生成E签宝签章失败");
|
||||
}
|
||||
String templateSeal = esginTemplateSealPo.getTemplateSeal();
|
||||
organization.setTemplateSeal(templateSeal);
|
||||
}
|
||||
//保存签章
|
||||
iOrganizationSvc.updateById(organization);
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> getAllOrganization() {
|
||||
//获取登录人信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
List<OrganizationPo> organizationPoList = iOrganizationSvc.getAllOrganization(topOrganizationId);
|
||||
if (null == organizationPoList || organizationPoList.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (OrganizationPo organizationPo : organizationPoList) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("organizationId", organizationPo.getOrganizationId());
|
||||
map.put("organizationName", organizationPo.getOrganizationName());
|
||||
list.add(map);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
package com.linke.product.application.service.organization;
|
||||
|
||||
import com.linke.product.domain.organization.repository.po.OrganizationCorrelationPO;
|
||||
import com.linke.product.domain.organization.repository.todo.OrganizationCorrelationDO;
|
||||
import com.linke.product.domain.organization.service.OrganizationCorrelationDomainService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
/**
|
||||
* 产品中台-组织关联关系ApplicationService
|
||||
*
|
||||
* @author gen
|
||||
* @date 2023-08-05
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class OrganizationCorrelationApplicationService {
|
||||
@Autowired
|
||||
private OrganizationCorrelationDomainService organizationCorrelationDomainService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询产品中台-组织关联关系列表
|
||||
*/
|
||||
|
||||
public List<OrganizationCorrelationPO> queryList(OrganizationCorrelationDO organizationCorrelationDO) {
|
||||
return organizationCorrelationDomainService.queryList(organizationCorrelationDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增产品中台-组织关联关系
|
||||
*/
|
||||
public Boolean insert(OrganizationCorrelationDO organizationCorrelationDO) {
|
||||
|
||||
return organizationCorrelationDomainService.insert(organizationCorrelationDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改产品中台-组织关联关系
|
||||
*/
|
||||
public Boolean update(OrganizationCorrelationDO organizationCorrelationDO) {
|
||||
return organizationCorrelationDomainService.update(organizationCorrelationDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除产品中台-组织关联关系
|
||||
*/
|
||||
public boolean delete(Long[] orgCorrelationIds) {
|
||||
return organizationCorrelationDomainService.delete(orgCorrelationIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取产品中台-组织关联关系详细信息
|
||||
*/
|
||||
public OrganizationCorrelationPO getInfo(Long orgCorrelationId)
|
||||
{
|
||||
return organizationCorrelationDomainService.getInfo(orgCorrelationId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据组织id获取该组织绑定关系列表
|
||||
*/
|
||||
public List<OrganizationCorrelationPO> findListByOrganizationId(Long organizationId)
|
||||
{
|
||||
return organizationCorrelationDomainService.findListByOrganizationId(organizationId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+157
@@ -0,0 +1,157 @@
|
||||
package com.linke.product.application.service.product;
|
||||
|
||||
import com.linke.product.domain.product.entity.ProductDetails;
|
||||
import com.linke.product.domain.product.entity.ProductMenu;
|
||||
import com.linke.product.domain.product.entity.SysProduct;
|
||||
import com.linke.product.domain.product.repository.po.SysProductPo;
|
||||
import com.linke.product.domain.product.service.ProductDetailsDomainService;
|
||||
import com.linke.product.domain.product.service.ProductMenuDomainService;
|
||||
import com.linke.product.domain.product.service.SysProductDomainService;
|
||||
import com.linke.product.interfaces.dto.product.SysProductDto;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 产品 应用服务层
|
||||
*
|
||||
* 本层可以综合应用各种业务间的组合
|
||||
*
|
||||
* 2022-11-26
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
@Service
|
||||
public class SysProductApplicationService {
|
||||
@Autowired
|
||||
private SysProductDomainService iSysProductSvc;
|
||||
@Autowired
|
||||
private ProductMenuDomainService iProductMenuSvc;
|
||||
@Autowired
|
||||
private ProductDetailsDomainService iProductDetailsSvc;
|
||||
|
||||
/**
|
||||
* 查询产品中台-产品
|
||||
*
|
||||
* @param productId 产品中台-产品主键
|
||||
* @return 产品中台-产品
|
||||
*/
|
||||
public SysProductPo selectSysProductByProductId(Long productId)
|
||||
{
|
||||
return iSysProductSvc.selectSysProductByProductId(productId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询产品中台-产品列表
|
||||
*
|
||||
* @param sysProductPo 产品中台-产品
|
||||
* @return 产品中台-产品
|
||||
*/
|
||||
public List<SysProductPo> selectSysProductList(SysProductPo sysProductPo)
|
||||
{
|
||||
return iSysProductSvc.selectSysProductList(sysProductPo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增产品中台-产品
|
||||
*
|
||||
* @param sysProduct 产品中台-产品
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSysProduct(SysProduct sysProduct)
|
||||
{
|
||||
return iSysProductSvc.insertSysProduct(sysProduct);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改产品中台-产品
|
||||
*
|
||||
* @param sysProduct 产品中台-产品
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSysProduct(SysProduct sysProduct)
|
||||
{
|
||||
return iSysProductSvc.updateSysProduct(sysProduct);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除产品中台-产品
|
||||
*
|
||||
* @param productIds 需要删除的产品中台-产品主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysProductByProductIds(Long[] productIds)
|
||||
{
|
||||
return iSysProductSvc.deleteSysProductByProductIds(productIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除产品中台-产品信息
|
||||
*
|
||||
* @param productId 产品中台-产品主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysProductByProductId(Long productId)
|
||||
{
|
||||
return iSysProductSvc.deleteSysProductByProductId(productId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询产品菜单权限
|
||||
*
|
||||
* @param id 产品id
|
||||
* @return 列表信息
|
||||
*/
|
||||
public List<ProductMenu> selectMenuListByProductId(Long id){
|
||||
return iProductMenuSvc.selectMenuListByProductId(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改产品菜单权限
|
||||
*
|
||||
* @param sysProductDto 产品菜单权限
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateProductMenu(SysProductDto sysProductDto){
|
||||
return iProductMenuSvc.updateProductMenu(sysProductDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询产品模块
|
||||
*
|
||||
* @param id 产品id
|
||||
* @param modulesClient 模块客户端类型
|
||||
* @return 列表信息
|
||||
*/
|
||||
public List<ProductDetails> selectDetailsListByProductId(Long id,Integer modulesClient){
|
||||
return iProductDetailsSvc.selectDetailsListByProductId(id, modulesClient);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改产品模块
|
||||
*
|
||||
* @param sysProductDto 产品模块
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateProductDetails(SysProductDto sysProductDto){
|
||||
return iProductDetailsSvc.updateProductDetails(sysProductDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 根据一级组织id获取产品列表
|
||||
* @author ZhouGY
|
||||
* @date 2023/12/22 9:16
|
||||
* @param topOrganizationId
|
||||
* @return List<SysProductPo>
|
||||
*/
|
||||
public List<SysProductPo> selectProductListByTopOrganizationId(Long topOrganizationId){
|
||||
return iSysProductSvc.selectProductListByTopOrganizationId(topOrganizationId);
|
||||
}
|
||||
|
||||
public List<Long> getProductIdList(List<Long> menuIdList) {
|
||||
return iSysProductSvc.getProductIdList(menuIdList);
|
||||
}
|
||||
}
|
||||
+304
@@ -0,0 +1,304 @@
|
||||
package com.linke.product.application.service.projectManagement;
|
||||
|
||||
import com.linke.product.domain.organization.repository.po.OrganizationPo;
|
||||
import com.linke.product.domain.organization.service.OrganizationDomainService;
|
||||
import com.linke.product.domain.projectManagement.entity.ProjectManagement;
|
||||
import com.linke.product.domain.projectManagement.entity.ProjectOrganization;
|
||||
import com.linke.product.infrastructure.feign.UserServiceFeign;
|
||||
import com.mhd.common.core.domain.entity.R;
|
||||
import com.mhd.common.core.domain.po.projectManagement.ProjectManagementPO;
|
||||
import com.linke.product.domain.projectManagement.repository.todo.ProjectManagementDO;
|
||||
import com.linke.product.domain.projectManagement.repository.todo.ProjectOrganizationDO;
|
||||
import com.linke.product.domain.projectManagement.service.ProjectManagementDomainService;
|
||||
import com.linke.product.domain.projectManagement.service.ProjectOrganizationDomainService;
|
||||
import com.mhd.common.core.domain.dto.ProjectUserDTO;
|
||||
import com.mhd.common.core.domain.po.projectManagement.ProjectUserPO;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.utils.PageUtils;
|
||||
import com.mhd.common.core.utils.StringUtils;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.sql.rowset.serial.SerialException;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 项目ApplicationService
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-02-02
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class ProjectManagementApplicationService {
|
||||
@Autowired
|
||||
private ProjectManagementDomainService projectManagementDomainService;
|
||||
@Resource
|
||||
private OrganizationDomainService organizationDomainService;
|
||||
@Autowired
|
||||
private ProjectOrganizationDomainService projectOrganizationDomainService;
|
||||
@Autowired
|
||||
private UserServiceFeign userServiceFeign;
|
||||
|
||||
/**
|
||||
* 分页查询项目列表
|
||||
*/
|
||||
|
||||
public List<ProjectManagementPO> queryList(ProjectManagementDO projectManagementDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null){
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
if (topOrganizationId != null && topOrganizationId != 1){
|
||||
projectManagementDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
}
|
||||
return projectManagementDomainService.queryList(projectManagementDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑项目
|
||||
*/
|
||||
public ProjectManagementDO edit(ProjectManagementDO projectManagementDO){
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
Long organizationId = loginUser.getUserPo().getOrganizationId();
|
||||
//编辑
|
||||
if (projectManagementDO.getProjectManagementId() != null){
|
||||
projectManagementDomainService.update(projectManagementDO);
|
||||
// projectOrganizationDomainService.deleteByProjectManageMentId(projectManagementDO.getProjectManagementId());
|
||||
}
|
||||
//新增
|
||||
else {
|
||||
projectManagementDO.setTopOrganizationId(topOrganizationId);
|
||||
projectManagementDO.setOrganizationId(organizationId);
|
||||
List<Long> longs = new ArrayList<>();
|
||||
//全部企业,根据当前登录人获取一级组织所有下级组织,包含一级组织
|
||||
if (projectManagementDO.getAffiliateCompanyStatus() != null && projectManagementDO.getAffiliateCompanyStatus() == 1){
|
||||
longs = organizationDomainService.selectAllOrganizationById(topOrganizationId);
|
||||
}else {
|
||||
if (projectManagementDO.getOrganizationIdList() == null || projectManagementDO.getOrganizationIdList().size() == 0){
|
||||
throw new ServiceException("部分关联至少选择一个企业!");
|
||||
}
|
||||
longs = projectManagementDO.getOrganizationIdList();
|
||||
}
|
||||
OrganizationPo organizationPo = new OrganizationPo();
|
||||
organizationPo.setOrganizationIdList(longs);
|
||||
List<OrganizationPo> organizationPos = organizationDomainService.selectOrganizationList(organizationPo);
|
||||
String name = organizationPos.stream().map(OrganizationPo::getOrganizationName).collect(Collectors.joining(","));
|
||||
if (StringUtils.isBlank(projectManagementDO.getAffiliateCompanyName())){
|
||||
projectManagementDO.setAffiliateCompanyName(name);
|
||||
}
|
||||
projectManagementDO = projectManagementDomainService.insert(projectManagementDO);
|
||||
List<ProjectOrganization> list = new ArrayList<>();
|
||||
for (OrganizationPo po : organizationPos) {
|
||||
ProjectOrganization projectOrganization = new ProjectOrganization();
|
||||
projectOrganization.setOrganizationId(po.getOrganizationId());
|
||||
projectOrganization.setOrganizationName(po.getOrganizationName());
|
||||
projectOrganization.setProjectManagementId(projectManagementDO.getProjectManagementId());
|
||||
list.add(projectOrganization);
|
||||
}
|
||||
projectOrganizationDomainService.saveBatchList(list);
|
||||
}
|
||||
return projectManagementDO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除项目
|
||||
*/
|
||||
public boolean delete(Long[] projectManagementIds) {
|
||||
return projectManagementDomainService.delete(projectManagementIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取项目详细信息
|
||||
*/
|
||||
public ProjectManagementPO getInfo(Long projectManagementId)
|
||||
{
|
||||
return projectManagementDomainService.getInfo(projectManagementId);
|
||||
}
|
||||
|
||||
|
||||
//获取关联企业
|
||||
public List<OrganizationPo> affiliateCompany(Long projectManagementId) {
|
||||
//获取当前项目绑定的组织并查询全部组织
|
||||
List<ProjectOrganization> projectOrganizationList = projectOrganizationDomainService.selectByProjectManagementId(projectManagementId);
|
||||
List<Long> collect = projectOrganizationList.stream().map(ProjectOrganization::getOrganizationId).collect(Collectors.toList());
|
||||
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
List<Long> longs = organizationDomainService.selectAllOrganizationById(topOrganizationId);
|
||||
OrganizationPo organizationPo = new OrganizationPo();
|
||||
organizationPo.setOrganizationIdList(longs);
|
||||
List<OrganizationPo> organizationPos = organizationDomainService.selectOrganizationList(organizationPo);
|
||||
organizationPos.forEach(e-> e.setIsBand(collect.contains(e.getOrganizationId()) ? 1 : 2));
|
||||
return organizationPos;
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定企业/解绑企业
|
||||
* @param projectOrganizationDO
|
||||
*/
|
||||
public void bindCompany(ProjectOrganizationDO projectOrganizationDO) {
|
||||
String organizationName = projectOrganizationDO.getOrganizationName();
|
||||
Long projectManagementId = projectOrganizationDO.getProjectManagementId();
|
||||
Integer isBand = projectOrganizationDO.getIsBand();
|
||||
|
||||
ProjectManagementPO info = projectManagementDomainService.getInfo(projectManagementId);
|
||||
String affiliateCompanyName = info.getAffiliateCompanyName();
|
||||
ProjectManagementDO projectManagement = new ProjectManagementDO();
|
||||
projectManagement.setProjectManagementId(projectManagementId);
|
||||
projectManagement.setUpdateTime(new Date());
|
||||
if (isBand != null && isBand == 1){
|
||||
//删除绑定关系
|
||||
projectOrganizationDomainService.deleteByProjectOrganization(projectOrganizationDO);
|
||||
//新增绑定关系
|
||||
projectOrganizationDomainService.insert(projectOrganizationDO);
|
||||
if (StringUtils.isNotBlank(affiliateCompanyName) &&
|
||||
!((!affiliateCompanyName.contains(",") && affiliateCompanyName.equals(organizationName)) ||
|
||||
affiliateCompanyName.contains(",") &&
|
||||
(affiliateCompanyName.contains(","+organizationName) || affiliateCompanyName.contains(organizationName + ",")))){
|
||||
projectManagement.setAffiliateCompanyName(affiliateCompanyName + "," + organizationName);
|
||||
}else if (StringUtils.isBlank(affiliateCompanyName)){
|
||||
projectManagement.setAffiliateCompanyName(organizationName);
|
||||
}
|
||||
}
|
||||
//取消绑定
|
||||
else {
|
||||
//删除绑定关系
|
||||
projectOrganizationDomainService.deleteByProjectOrganization(projectOrganizationDO);
|
||||
affiliateCompanyName = affiliateCompanyName.replace(organizationName, "");
|
||||
List<String> list = Arrays.asList(affiliateCompanyName.split(","));
|
||||
list = list.stream().filter(str -> !str.isEmpty()).collect(Collectors.toList());
|
||||
String collect = list.stream().collect(Collectors.joining(","));
|
||||
projectManagement.setAffiliateCompanyName(collect);
|
||||
}
|
||||
projectManagementDomainService.update(projectManagement);
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定子账户/解绑子账户
|
||||
* @param projectUserDTO
|
||||
*/
|
||||
public void bindAccount(ProjectUserDTO projectUserDTO) {
|
||||
Integer isBand = projectUserDTO.getIsBand();
|
||||
String userName = projectUserDTO.getUserName();
|
||||
Long projectManagementId = projectUserDTO.getProjectManagementId();
|
||||
|
||||
ProjectManagementPO info = projectManagementDomainService.getInfo(projectManagementId);
|
||||
String affiliateCompanyName = info.getAffiliateAccount();
|
||||
ProjectManagementDO projectManagement = new ProjectManagementDO();
|
||||
projectManagement.setProjectManagementId(projectManagementId);
|
||||
projectManagement.setUpdateTime(new Date());
|
||||
if (isBand != null && isBand == 1){
|
||||
if (StringUtils.isNotBlank(affiliateCompanyName) &&
|
||||
!((!affiliateCompanyName.contains(",") && affiliateCompanyName.equals(userName)) ||
|
||||
affiliateCompanyName.contains(",") &&
|
||||
(affiliateCompanyName.contains(","+userName) || affiliateCompanyName.contains(userName + ",")))){
|
||||
projectManagement.setAffiliateAccount(affiliateCompanyName + "," + userName);
|
||||
}else if (StringUtils.isBlank(affiliateCompanyName)){
|
||||
projectManagement.setAffiliateAccount(userName);
|
||||
}
|
||||
}
|
||||
//取消绑定
|
||||
else {
|
||||
affiliateCompanyName = affiliateCompanyName.replace(userName, "");
|
||||
List<String> list = Arrays.asList(affiliateCompanyName.split(","));
|
||||
list = list.stream().filter(str -> !str.isEmpty()).collect(Collectors.toList());
|
||||
String collect = list.stream().collect(Collectors.joining(","));
|
||||
projectManagement.setAffiliateAccount(collect);
|
||||
}
|
||||
projectManagementDomainService.update(projectManagement);
|
||||
}
|
||||
|
||||
public List<ProjectManagementPO> getAllProject(Long organizationId) {
|
||||
List<ProjectManagementPO> list = projectManagementDomainService.getAllProject(organizationId);
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户ID查询关联项目
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
public List<ProjectManagementPO> getProjectByUserId(Long userId) {
|
||||
List<Long> projectIdList = new ArrayList<>();
|
||||
R<List<ProjectUserPO>> projectByUserId = userServiceFeign.getProjectByUserId(userId);
|
||||
if (projectByUserId.getCode() == R.SUCCESS){
|
||||
List<ProjectUserPO> projectManagementPOList = projectByUserId.getData();
|
||||
projectIdList = projectManagementPOList.stream().map(ProjectUserPO::getProjectManagementId).collect(Collectors.toList());
|
||||
}
|
||||
ProjectManagementDO projectManagementDO = new ProjectManagementDO();
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null){
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
if (topOrganizationId != null && topOrganizationId != 1){
|
||||
projectManagementDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
}
|
||||
PageUtils.startPage();
|
||||
List<ProjectManagementPO> projectManagementPOS = projectManagementDomainService.queryList(projectManagementDO);
|
||||
if (!projectIdList.isEmpty()){
|
||||
List<Long> finalProjectIdList = projectIdList;
|
||||
projectManagementPOS.forEach(e->e.setIsBand(finalProjectIdList.contains(e.getProjectManagementId()) ? 1 : 2));
|
||||
}
|
||||
return projectManagementPOS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 子账户批量关联项目
|
||||
* @param projectUserDTOS
|
||||
*/
|
||||
public void bindAccountBatch(List<ProjectUserDTO> projectUserDTOS) {
|
||||
List<Long> projectManagementIdList = projectUserDTOS.stream().map(ProjectUserDTO::getProjectManagementId).collect(Collectors.toList());
|
||||
ProjectManagementDO projectManagementDO = new ProjectManagementDO();
|
||||
projectManagementDO.setProjectManagementIdList(projectManagementIdList);
|
||||
List<ProjectManagementPO> projectManagementPOS = projectManagementDomainService.queryList(projectManagementDO);
|
||||
Map<Long, ProjectManagementPO> projectManagementMap = projectManagementPOS.stream().collect(Collectors.toMap(ProjectManagementPO::getProjectManagementId, Function.identity(), (key1, key2) -> key2));
|
||||
List<ProjectManagement> projectManagementList = new ArrayList<>();
|
||||
for (ProjectUserDTO projectUserDTO : projectUserDTOS) {
|
||||
Integer isBand = projectUserDTO.getIsBand();
|
||||
String userName = projectUserDTO.getUserName();
|
||||
Long projectManagementId = projectUserDTO.getProjectManagementId();
|
||||
ProjectManagementPO info = projectManagementMap.get(projectManagementId);
|
||||
String affiliateCompanyName = info.getAffiliateAccount();
|
||||
ProjectManagement projectManagement = new ProjectManagement();
|
||||
projectManagement.setProjectManagementId(projectManagementId);
|
||||
projectManagement.setUpdateTime(new Date());
|
||||
if (isBand != null && isBand == 1){
|
||||
if (StringUtils.isNotBlank(affiliateCompanyName) &&
|
||||
!((!affiliateCompanyName.contains(",") && affiliateCompanyName.equals(userName)) ||
|
||||
affiliateCompanyName.contains(",") &&
|
||||
(affiliateCompanyName.contains(","+userName) || affiliateCompanyName.contains(userName + ",")))){
|
||||
projectManagement.setAffiliateAccount(affiliateCompanyName + "," + userName);
|
||||
}else if (StringUtils.isBlank(affiliateCompanyName)){
|
||||
projectManagement.setAffiliateAccount(userName);
|
||||
}
|
||||
}
|
||||
//取消绑定
|
||||
else {
|
||||
affiliateCompanyName = affiliateCompanyName.replace(userName, "");
|
||||
List<String> list = Arrays.asList(affiliateCompanyName.split(","));
|
||||
list = list.stream().filter(str -> !str.isEmpty()).collect(Collectors.toList());
|
||||
String collect = list.stream().collect(Collectors.joining(","));
|
||||
projectManagement.setAffiliateAccount(collect);
|
||||
}
|
||||
projectManagementList.add(projectManagement);
|
||||
}
|
||||
projectManagementDomainService.updateBatchById(projectManagementList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID查询项目信息
|
||||
* @param projectManagementId
|
||||
* @return
|
||||
*/
|
||||
public ProjectManagementPO getProjectById(Long projectManagementId) {
|
||||
return projectManagementDomainService.getInfo(projectManagementId);
|
||||
}
|
||||
}
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
package com.linke.product.application.service.projectManagement;
|
||||
|
||||
import com.mhd.common.core.domain.po.projectManagement.ProjectOrganizationPO;
|
||||
import com.linke.product.domain.projectManagement.repository.todo.ProjectOrganizationDO;
|
||||
import com.linke.product.domain.projectManagement.service.ProjectOrganizationDomainService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
/**
|
||||
* 项目-组织关联ApplicationService
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-02-02
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class ProjectOrganizationApplicationService {
|
||||
@Autowired
|
||||
private ProjectOrganizationDomainService projectOrganizationDomainService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询项目-组织关联列表
|
||||
*/
|
||||
|
||||
public List<ProjectOrganizationPO> queryList(ProjectOrganizationDO projectOrganizationDO) {
|
||||
return projectOrganizationDomainService.queryList(projectOrganizationDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增项目-组织关联
|
||||
*/
|
||||
public Boolean insert(ProjectOrganizationDO projectOrganizationDO) {
|
||||
|
||||
return projectOrganizationDomainService.insert(projectOrganizationDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改项目-组织关联
|
||||
*/
|
||||
public Boolean update(ProjectOrganizationDO projectOrganizationDO) {
|
||||
return projectOrganizationDomainService.update(projectOrganizationDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除项目-组织关联
|
||||
*/
|
||||
public boolean delete(Long[] projectOrganizationIds) {
|
||||
return projectOrganizationDomainService.delete(projectOrganizationIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取项目-组织关联详细信息
|
||||
*/
|
||||
public ProjectOrganizationPO getInfo(Long projectOrganizationId)
|
||||
{
|
||||
return projectOrganizationDomainService.getInfo(projectOrganizationId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+151
@@ -0,0 +1,151 @@
|
||||
package com.linke.product.application.service.sysInformationPlatform;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.linke.product.application.service.tenants.SysTenantsApplicationService;
|
||||
import com.linke.product.domain.organization.repository.po.OrganizationPo;
|
||||
import com.linke.product.domain.organization.service.OrganizationDomainService;
|
||||
import com.linke.product.domain.sysInformationPlatform.entity.SysInformationPlatform;
|
||||
import com.linke.product.domain.sysInformationPlatform.repository.po.SysInformationPlatformPo;
|
||||
import com.linke.product.domain.sysInformationPlatform.repository.todo.SysInformationPlatformDo;
|
||||
import com.linke.product.domain.sysInformationPlatform.service.SysInformationPlatformDomainService;
|
||||
import com.linke.product.domain.tenants.repository.po.SysTenantsPo;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 租户平台基本信息配置ApplicationService
|
||||
*
|
||||
* @author gen
|
||||
* @date 2023-09-26
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class SysInformationPlatformApplicationService {
|
||||
@Autowired
|
||||
private SysInformationPlatformDomainService sysInformationPlatformDomainService;
|
||||
@Resource
|
||||
private SysTenantsApplicationService sysTenantsApplicationService;
|
||||
@Resource
|
||||
private OrganizationDomainService organizationDomainService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询租户平台基本信息配置列表
|
||||
*/
|
||||
|
||||
public List<SysInformationPlatformPo> queryList(SysInformationPlatformDo sysInformationPlatformDo) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
return sysInformationPlatformDomainService.queryList(sysInformationPlatformDo);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增租户平台基本信息配置
|
||||
*/
|
||||
public Boolean insert(SysInformationPlatformDo sysInformationPlatformDo) {
|
||||
//获取当前登录用户租户信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if(null == loginUser){
|
||||
throw new ServiceException("未获取到登录用户信息");
|
||||
}
|
||||
OrganizationPo organizationPo = organizationDomainService.selectOrganizationById(loginUser.getUserPo().getOrganizationId());
|
||||
if(null == organizationPo){
|
||||
throw new ServiceException("未找到当前登录用户组织信息");
|
||||
}
|
||||
//查询租户信息
|
||||
SysTenantsPo sysTenantsPo = sysTenantsApplicationService.selectSysTenantsByTenantsId(organizationPo.getTenantsId());
|
||||
if(null == sysTenantsPo){
|
||||
throw new ServiceException("未找到当前登录用户租户信息");
|
||||
}
|
||||
sysInformationPlatformDo.setTenantsId(sysTenantsPo.getTenantsId());
|
||||
sysInformationPlatformDo.setTenantsName(sysTenantsPo.getTenantsName());
|
||||
return sysInformationPlatformDomainService.insert(sysInformationPlatformDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改租户平台基本信息配置
|
||||
*/
|
||||
public Boolean update(SysInformationPlatformDo sysInformationPlatformDo) {
|
||||
LambdaQueryWrapper<SysInformationPlatform> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SysInformationPlatform::getDelFlag,1);
|
||||
queryWrapper.eq(SysInformationPlatform::getInformationPlatformId,sysInformationPlatformDo.getInformationPlatformId());
|
||||
|
||||
SysInformationPlatform oldSysInformation = sysInformationPlatformDomainService.selectByLambda(queryWrapper);
|
||||
if(null == oldSysInformation){
|
||||
throw new ServiceException("当前租户配置的平台信息不存在");
|
||||
}
|
||||
sysInformationPlatformDo.setUpdateCount(oldSysInformation.getUpdateCount()+1);
|
||||
return sysInformationPlatformDomainService.update(sysInformationPlatformDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除租户平台基本信息配置
|
||||
*/
|
||||
public Boolean delete(Long[] informationPlatformIds) {
|
||||
return sysInformationPlatformDomainService.delete(informationPlatformIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取租户平台基本信息配置详细信息
|
||||
*/
|
||||
public SysInformationPlatformPo getInfo(Long informationPlatformId)
|
||||
{
|
||||
return sysInformationPlatformDomainService.getInfo(informationPlatformId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据id删除
|
||||
* @param sysInformationPlatformDo
|
||||
* @return
|
||||
*/
|
||||
public Boolean deleteById(SysInformationPlatformDo sysInformationPlatformDo) {
|
||||
if(sysInformationPlatformDo.getInformationPlatformId()==null){
|
||||
throw new ServiceException("配置信息id不能为空");
|
||||
}
|
||||
sysInformationPlatformDo.setDelFlag(2);
|
||||
return sysInformationPlatformDomainService.update(sysInformationPlatformDo);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取租户平台基本信息配置
|
||||
* @param path 域名
|
||||
* @return 平台配置信息
|
||||
*/
|
||||
public Map<String,String> getHomePlanFormInfo(String path) {
|
||||
Map<String,String> result = new HashMap<>();
|
||||
//PC登录页系统名图片
|
||||
result.put("loginSystemNameImg","");
|
||||
//PC内页系统名图片
|
||||
result.put("innerSystemNameImg","");
|
||||
//PC技术支持
|
||||
result.put("technicalSupport","");
|
||||
SysTenantsPo sysTenantsPo = sysTenantsApplicationService.selectSysTenantsByDomain(path);
|
||||
if(null == sysTenantsPo){
|
||||
throw new ServiceException("请填写正确域名");
|
||||
}
|
||||
LambdaQueryWrapper<SysInformationPlatform> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SysInformationPlatform::getInterfaceTabs,"PlatformInformation");
|
||||
List<SysInformationPlatform> sysInformationPlatformList = sysInformationPlatformDomainService.queryByLambda(queryWrapper);
|
||||
if(sysInformationPlatformList.size()>0){
|
||||
sysInformationPlatformList.stream().filter(item -> ObjectUtil.equal(item.getInterfaceTabsKey(), "loginSystemNameImg")).findAny().ifPresent(loginSystemNameImg -> result.put("loginSystemNameImg", loginSystemNameImg.getInterfaceTabsValue()));
|
||||
sysInformationPlatformList.stream().filter(item -> ObjectUtil.equal(item.getInterfaceTabsKey(), "innerSystemNameImg")).findAny().ifPresent(innerSystemNameImg -> result.put("innerSystemNameImg", innerSystemNameImg.getInterfaceTabsValue()));
|
||||
sysInformationPlatformList.stream().filter(item -> ObjectUtil.equal(item.getInterfaceTabsKey(), "technicalSupport")).findAny().ifPresent(technicalSupport -> result.put("technicalSupport", technicalSupport.getInterfaceTabsValue()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
+562
@@ -0,0 +1,562 @@
|
||||
package com.linke.product.application.service.tenants;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.linke.product.application.service.common.CommonApplicationService;
|
||||
import com.linke.product.domain.customAuth.entity.CustomAuth;
|
||||
import com.linke.product.domain.customAuth.service.CustomAuthDomainService;
|
||||
import com.linke.product.domain.menu.entity.Menu;
|
||||
import com.linke.product.domain.menu.repository.po.MenuPo;
|
||||
import com.linke.product.domain.menu.service.MenuDomainService;
|
||||
import com.linke.product.domain.organization.entity.Organization;
|
||||
import com.linke.product.domain.organization.service.OrganizationDomainService;
|
||||
import com.linke.product.domain.product.service.SysProductDomainService;
|
||||
import com.linke.product.domain.tenants.entity.SysTenants;
|
||||
import com.linke.product.domain.tenants.entity.TenantsDomainName;
|
||||
import com.linke.product.domain.tenants.entity.TenantsMenu;
|
||||
import com.linke.product.domain.tenants.entity.TenantsProduct;
|
||||
import com.linke.product.domain.tenants.repository.po.SysTenantsPo;
|
||||
import com.linke.product.domain.tenants.repository.po.TenantsDomainNamePo;
|
||||
import com.linke.product.domain.tenants.service.SysTenantsDomainService;
|
||||
import com.linke.product.domain.tenants.service.TenantsDomainNameDomainService;
|
||||
import com.linke.product.domain.tenants.service.TenantsMenuDomainService;
|
||||
import com.linke.product.domain.tenants.service.TenantsProductDomainService;
|
||||
import com.linke.product.infrastructure.feign.UserServiceFeign;
|
||||
import com.linke.product.interfaces.dto.tenants.SysTenantsDto;
|
||||
import com.mhd.common.core.domain.dto.SysTenantsDTO;
|
||||
import com.mhd.common.core.domain.po.UserConfigSwitchPo;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.utils.ListUtils;
|
||||
import com.mhd.common.core.utils.StringUtils;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import org.checkerframework.checker.units.qual.A;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 租户 应用服务层
|
||||
*
|
||||
* 本层可以综合应用各种业务间的组合
|
||||
*
|
||||
* 2022-12-2
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
@Service
|
||||
@RefreshScope
|
||||
public class SysTenantsApplicationService {
|
||||
private static final Logger log = LoggerFactory.getLogger(SysTenantsApplicationService.class);
|
||||
@Autowired
|
||||
private SysTenantsDomainService sysTenantsDomainService;
|
||||
@Autowired
|
||||
private TenantsProductDomainService tenantsProductDomainService;
|
||||
@Autowired
|
||||
private OrganizationDomainService organizationDomainService;
|
||||
@Autowired
|
||||
private TenantsMenuDomainService tenantsMenuDomainService;
|
||||
@Autowired
|
||||
private MenuDomainService menuDomainService;
|
||||
@Autowired
|
||||
private CustomAuthDomainService customAuthDomainService;
|
||||
@Resource
|
||||
private UserServiceFeign userServiceFeign;
|
||||
@Autowired
|
||||
private SysProductDomainService sysProductDomainService;
|
||||
@Autowired
|
||||
private TenantsDomainNameDomainService tenantsDomainNameDomainService;
|
||||
|
||||
@Autowired
|
||||
private CommonApplicationService commonApplicationService;
|
||||
@Autowired
|
||||
private UserUpmsDomainService userUpmsDomainService;
|
||||
|
||||
@Value("${openApi.orgId}")
|
||||
private Long organizationId;
|
||||
|
||||
/**
|
||||
* 查询产品中台-租户
|
||||
*
|
||||
* @param tenantsId 产品中台-租户主键
|
||||
* @return 产品中台-租户
|
||||
*/
|
||||
public SysTenantsPo selectSysTenantsByTenantsId(Long tenantsId) {
|
||||
return sysTenantsDomainService.selectSysTenantsByTenantsId(tenantsId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询产品中台-租户列表
|
||||
*
|
||||
* @param sysTenantsPo 产品中台-租户
|
||||
* @return 产品中台-租户
|
||||
*/
|
||||
public List<SysTenantsPo> selectSysTenantsList(SysTenantsPo sysTenantsPo) {
|
||||
return sysTenantsDomainService.selectSysTenantsList(sysTenantsPo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增产品中台-租户
|
||||
*
|
||||
* @param sysTenants 产品中台-租户
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional
|
||||
public int insertSysTenants(SysTenants sysTenants)
|
||||
{
|
||||
//获取当前登录人
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
//检查域名,是否重复
|
||||
checkUniqueness(sysTenants);
|
||||
//新增租户
|
||||
int i = sysTenantsDomainService.insertSysTenants(sysTenants);
|
||||
//新增组织
|
||||
Organization organization = new Organization();
|
||||
organization.setTenantsId(sysTenants.getTenantsId());
|
||||
organization.setParentOrganizationId(new Long("0"));
|
||||
organization.setOrganizationName(sysTenants.getTenantsName());
|
||||
organization.setOrganizationState(1);
|
||||
organization.setPlatefromType(sysTenants.getPlatefromType());
|
||||
organization.setCreateBy(loginUser.getUserid());
|
||||
organization.setCreateByName(loginUser.getUsername());
|
||||
organization.setCreateTime(DateUtil.date());
|
||||
organizationDomainService.insertOrganization(organization);
|
||||
//新增租户域名并设置成默认显示的
|
||||
TenantsDomainName tenantsDomainName = new TenantsDomainName();
|
||||
tenantsDomainName.setDomainName(sysTenants.getTenantsDomainName());
|
||||
tenantsDomainName.setShowFlag(2);
|
||||
tenantsDomainName.setTenantsId(sysTenants.getTenantsId());
|
||||
tenantsDomainName.setCreateBy(loginUser.getUserid());
|
||||
tenantsDomainName.setCreateByName(loginUser.getUsername());
|
||||
tenantsDomainName.setCreateTime(DateUtil.date());
|
||||
tenantsDomainNameDomainService.insert(tenantsDomainName);
|
||||
return i;
|
||||
}
|
||||
|
||||
public void checkUniqueness(SysTenants sysTenants) {
|
||||
TenantsDomainNamePo tenantsDomainNamePo = new TenantsDomainNamePo();
|
||||
tenantsDomainNamePo.setDomainName(sysTenants.getTenantsDomainName());
|
||||
tenantsDomainNamePo.setTenantsId(sysTenants.getTenantsId());
|
||||
List<TenantsDomainNamePo> list = tenantsDomainNameDomainService.checkUniqueness(tenantsDomainNamePo);
|
||||
if (CollectionUtil.isNotEmpty(list) && list.get(0) != null){
|
||||
throw new ServiceException("域名已存在");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改产品中台-租户
|
||||
*
|
||||
* @param sysTenants 产品中台-租户
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSysTenants(SysTenants sysTenants) {
|
||||
//获取当前登录人
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
|
||||
checkUniqueness(sysTenants);
|
||||
//无论域名有没有修改都进行修改一次
|
||||
TenantsDomainNamePo tenantsDomainNamePo = new TenantsDomainNamePo();
|
||||
tenantsDomainNamePo.setTenantsId(sysTenants.getTenantsId());
|
||||
tenantsDomainNamePo.setShowFlag(2);
|
||||
Long organizationId = organizationDomainService.selectOrganizationIdByTenants(sysTenants.getTenantsId());
|
||||
if (organizationId != null){
|
||||
//修改组织
|
||||
Organization organization = new Organization();
|
||||
organization.setOrganizationId(organizationId);
|
||||
organization.setPlatefromType(sysTenants.getPlatefromType());
|
||||
organizationDomainService.updateById(organization);
|
||||
}
|
||||
List<TenantsDomainNamePo> list = tenantsDomainNameDomainService.pageList(tenantsDomainNamePo);
|
||||
if (CollectionUtil.isNotEmpty(list)){
|
||||
TenantsDomainName tenantsDomainName = new TenantsDomainName();
|
||||
tenantsDomainName.setDomainName(sysTenants.getTenantsDomainName());
|
||||
tenantsDomainName.setShowFlag(2);
|
||||
if (list.get(0) != null){
|
||||
tenantsDomainName.setTenantsDomainNameId(list.get(0).getTenantsDomainNameId());
|
||||
tenantsDomainName.setUpdateTime(new Date());
|
||||
tenantsDomainName.setUpdateBy(loginUser.getUserid());
|
||||
tenantsDomainName.setUpdateByName(loginUser.getUsername());
|
||||
tenantsDomainNameDomainService.updateById(tenantsDomainName);
|
||||
}
|
||||
}else {
|
||||
TenantsDomainName tenantsDomainName = new TenantsDomainName();
|
||||
tenantsDomainName.setDomainName(sysTenants.getTenantsDomainName());
|
||||
tenantsDomainName.setTenantsId(sysTenants.getTenantsId());
|
||||
tenantsDomainName.setShowFlag(2);
|
||||
tenantsDomainName.setCreateTime(new Date());
|
||||
tenantsDomainName.setCreateBy(loginUser.getUserid());
|
||||
tenantsDomainName.setCreateByName(loginUser.getUsername());
|
||||
tenantsDomainNameDomainService.insert(tenantsDomainName);
|
||||
}
|
||||
int flag = sysTenantsDomainService.updateSysTenants(sysTenants);
|
||||
//租户同步商城系统
|
||||
SysTenantsPo sysTenantsPo = sysTenantsDomainService.selectSysTenantsByTenantsId(sysTenants.getTenantsId());
|
||||
SysTenants newSysTenants = new SysTenants();
|
||||
BeanUtils.copyProperties(sysTenantsPo,newSysTenants);
|
||||
userUpmsDomainService.szwlSyncTenant(newSysTenants);
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除产品中台-租户
|
||||
*
|
||||
* @param tenantsIds 需要删除的产品中台-租户主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysTenantsByTenantsIds(Long[] tenantsIds) {
|
||||
return sysTenantsDomainService.deleteSysTenantsByTenantsIds(tenantsIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除产品中台-租户信息
|
||||
*
|
||||
* @param tenantsId 产品中台-租户主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysTenantsByTenantsId(Long tenantsId) {
|
||||
return sysTenantsDomainService.deleteSysTenantsByTenantsId(tenantsId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询租户产品
|
||||
*
|
||||
* @param id 租户id
|
||||
* @return 列表信息
|
||||
*/
|
||||
public List<TenantsProduct> selectProductListByTenantsId(Long id) {
|
||||
return tenantsProductDomainService.selectProductListByTenantsId(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改租户产品
|
||||
*
|
||||
* @param sysTenantsDto 产品菜单权限
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional
|
||||
public int updateTenantsProduct(SysTenantsDto sysTenantsDto) {
|
||||
Long organizationId = sysTenantsDto.getOrganizationId();
|
||||
Long[] tenantsProduct = sysTenantsDto.getTenantsProduct();
|
||||
List<Long> productIdList = Arrays.asList(tenantsProduct);
|
||||
//未设置产品,逻辑删除所有的菜单
|
||||
if (CollectionUtil.isEmpty(productIdList)){
|
||||
menuDomainService.deleteByOrganizationId(organizationId);
|
||||
//逻辑删除所有的菜单
|
||||
tenantsProductDomainService.updateTenantsProduct(sysTenantsDto);
|
||||
return 1;
|
||||
}
|
||||
/**
|
||||
* 配置产品
|
||||
* 1.删除所有产品
|
||||
* 2.添加所有的产品
|
||||
*/
|
||||
tenantsProductDomainService.updateTenantsProduct(sysTenantsDto);
|
||||
//如果是一号租户,直接跳过配置菜单
|
||||
if (ObjectUtil.equal(organizationId, 1L)){
|
||||
return productIdList.size();
|
||||
}
|
||||
/**
|
||||
* 配置菜单
|
||||
* 1.查出所有已经存在的菜单
|
||||
* 2.查出所有产品对应的菜单
|
||||
* 3.取两个差集,已存在-所有=需要删除的菜单,所有-已存在=需要新增的菜单
|
||||
* 4.更新和新增菜单
|
||||
*/
|
||||
//租户菜单(包含已经逻辑删除的菜单)
|
||||
MenuPo menuPo = new MenuPo();
|
||||
menuPo.setTopOrganizationId(organizationId);
|
||||
List<Menu> tenantsMenuList = menuDomainService.selectListByOrganizationId(menuPo);
|
||||
Map<Long, Menu> tenantsMap = tenantsMenuList.stream().collect(Collectors.toMap(Menu::getSourceId,Function.identity(), (key1, key2) -> key2));
|
||||
List<Long> tenantsMenuIdList = tenantsMenuList.stream().map(Menu::getSourceId).collect(Collectors.toList());
|
||||
//原始菜单
|
||||
List<Menu> originalMenuList = menuDomainService.selectListByProductIdList(productIdList);
|
||||
Map<Long, Menu> originalMap = originalMenuList.stream().collect(Collectors.toMap(Menu::getMenuId,Function.identity(), (key1, key2) -> key2));
|
||||
List<Long> originalMenuIdList = originalMenuList.stream().map(Menu::getMenuId).collect(Collectors.toList());
|
||||
//需要新增的菜单集合
|
||||
List<Menu> addList = new ArrayList<>();
|
||||
//需要更新的菜单集合
|
||||
List<Menu> updateList = new ArrayList<>();
|
||||
|
||||
//需要新增的菜单(原始菜单id)
|
||||
List<Long> addIdList = ListUtils.getLongSubList(originalMenuIdList , tenantsMenuIdList);
|
||||
//需要逻辑删除的菜单(原始菜单id)
|
||||
List<Long> delIdList = ListUtils.getLongSubList(tenantsMenuIdList, originalMenuIdList);
|
||||
//可能需要恢复的菜单(原始菜单id)
|
||||
List<Long> recoverIdList = ListUtils.getLongSubList(tenantsMenuIdList, delIdList);
|
||||
//封装需要新增的菜单集合
|
||||
if (CollectionUtil.isNotEmpty(addIdList)){
|
||||
for (Long aLong : addIdList) {
|
||||
Menu menu = originalMap.get(aLong);
|
||||
menu.setSourceId(aLong);
|
||||
menu.setMenuId(null);
|
||||
menu.setCreateTime(new Date());
|
||||
menu.setUpdateTime(null);
|
||||
menu.setUpdateBy(null);
|
||||
menu.setUpdateByName("");
|
||||
menu.setTopOrganizationId(organizationId);
|
||||
addList.add(menu);
|
||||
}
|
||||
}
|
||||
|
||||
//需要逻辑删除的菜单集合
|
||||
if (CollectionUtil.isNotEmpty(delIdList)){
|
||||
for (Long aLong : delIdList) {
|
||||
Menu menu = tenantsMap.get(aLong);
|
||||
menu.setDelFlag(2);
|
||||
updateList.add(menu);
|
||||
}
|
||||
}
|
||||
//需要恢复的菜单集合
|
||||
if (CollectionUtil.isNotEmpty(recoverIdList)){
|
||||
for (Long aLong : recoverIdList) {
|
||||
Menu menu = tenantsMap.get(aLong);
|
||||
if (menu.getDelFlag() == 2){
|
||||
menu.setDelFlag(1);
|
||||
updateList.add(menu);
|
||||
}
|
||||
}
|
||||
}
|
||||
menuDomainService.saveBatchList(addList);
|
||||
|
||||
//租户菜单(包含已经逻辑删除的菜单)--避免之前已经存在的菜单没有查询出来
|
||||
MenuPo menuPo1 = new MenuPo();
|
||||
menuPo1.setTopOrganizationId(organizationId);
|
||||
List<Menu> tenantsMenuList1 = menuDomainService.selectListByOrganizationId(menuPo1);
|
||||
//重新组装菜单关联关系
|
||||
Map<Long, Menu> sourceMap = tenantsMenuList1.stream().collect(Collectors.toMap(Menu::getSourceId,Function.identity(), (key1, key2) -> key2));
|
||||
for (Menu entity : addList) {
|
||||
if (ObjectUtil.notEqual(entity.getParentMenuId(), 0L)){
|
||||
Menu menu = sourceMap.get(entity.getParentMenuId());
|
||||
if (menu != null){
|
||||
entity.setParentMenuId(menu.getMenuId());
|
||||
updateList.add(entity);
|
||||
}
|
||||
try {
|
||||
//重新配置级联关系
|
||||
if (StringUtils.isNotBlank(entity.getMenuLinkage())){
|
||||
String menuLinkage = entity.getMenuLinkage();
|
||||
String[] split = menuLinkage.split(",");
|
||||
String[] newMenuIds = new String[split.length];
|
||||
for (int i = 0; i < split.length; i++) {
|
||||
Menu menu1 = sourceMap.get(Long.parseLong(split[i]));
|
||||
if (menu1 != null){
|
||||
newMenuIds[i] = menu1.getMenuId().toString();
|
||||
}
|
||||
}
|
||||
String collect = Arrays.stream(newMenuIds).collect(Collectors.joining(","));
|
||||
entity.setMenuLinkage(collect);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.info("级联配置出错,菜单id为{},报错信息为{}",entity.getMenuId(),e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
menuDomainService.updateBatchList(updateList);
|
||||
|
||||
/**
|
||||
* 配置按钮
|
||||
* 1.取出所有新增的菜单按钮,来源菜单按钮
|
||||
* 2.将菜单按钮列表赋值新的菜单id
|
||||
* 3.批量新增
|
||||
*/
|
||||
List<CustomAuth> customAuthList = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(addIdList)){
|
||||
customAuthList = customAuthDomainService.selectByMenuIds(addIdList);
|
||||
}
|
||||
if(CollectionUtil.isNotEmpty(customAuthList)){
|
||||
Map<Long, Long> addMap = addList.stream().collect(Collectors.toMap(Menu::getSourceId, Menu::getMenuId, (key1, key2) -> key2));
|
||||
for (CustomAuth customAuth : customAuthList) {
|
||||
Long menuId = addMap.get(customAuth.getMenuId());
|
||||
customAuth.setCustomAuthId(null);
|
||||
customAuth.setMenuId(menuId);
|
||||
customAuth.setCreateTime(new Date());
|
||||
customAuth.setUpdateBy(null);
|
||||
customAuth.setUpdateByName("");
|
||||
customAuth.setUpdateTime(new Date());
|
||||
}
|
||||
customAuthDomainService.saveBatchList(customAuthList);
|
||||
}
|
||||
return productIdList.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询租户菜单
|
||||
*
|
||||
* @param id 租户id
|
||||
* @return 列表信息
|
||||
*/
|
||||
public List<TenantsMenu> selectMenuListByTenantsId(Long id) {
|
||||
List<TenantsMenu> tenantsMenus = new ArrayList<>();
|
||||
//获取租户PC菜单
|
||||
List<Menu> menuList = menuDomainService.getMenuByTenantsId(id, 1);
|
||||
List<Long> list = getLastMenuId(menuList);
|
||||
for (Long menuId : list) {
|
||||
TenantsMenu tenantsMenu = new TenantsMenu();
|
||||
tenantsMenu.setTenantsId(id);
|
||||
tenantsMenu.setMenuId(menuId);
|
||||
tenantsMenus.add(tenantsMenu);
|
||||
}
|
||||
tenantsMenus.forEach(e->e.setIdKey("02-"+e.getMenuId()));
|
||||
return tenantsMenus;
|
||||
}
|
||||
|
||||
private List<Long> getLastMenuId(List<Menu> menuList){
|
||||
List<Long> menuIdList = menuList.stream().map(Menu::getMenuId).collect(Collectors.toList());
|
||||
List<Long> parentIdList = menuList.stream().map(Menu::getParentMenuId).collect(Collectors.toList());
|
||||
List<Long> longSubList = ListUtils.getLongSubList(menuIdList, parentIdList);
|
||||
return longSubList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改租户菜单
|
||||
*
|
||||
* @param sysTenantsDto 产品菜单权限
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateTenantsMenu(SysTenantsDto sysTenantsDto) {
|
||||
|
||||
return tenantsMenuDomainService.updateTenantsMenu(sysTenantsDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有已过期的租户进行停用
|
||||
*/
|
||||
@Transactional
|
||||
public int getAllOut0fDate() {
|
||||
List<SysTenants> list = sysTenantsDomainService.getAllOut0fDate();
|
||||
list.forEach(e -> {
|
||||
e.setTenantsStatus(2);
|
||||
e.setUpdateTime(new Date());
|
||||
});
|
||||
sysTenantsDomainService.updateByBatchList(list);
|
||||
return list.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过租户id获取所有的域名
|
||||
* @param tenantsId
|
||||
* @return
|
||||
*/
|
||||
public List<TenantsDomainNamePo> getDomainNamesByTenantsId(Long tenantsId) {
|
||||
TenantsDomainNamePo tenantsDomainNamePo = new TenantsDomainNamePo();
|
||||
tenantsDomainNamePo.setTenantsId(tenantsId);
|
||||
List<TenantsDomainNamePo> list = tenantsDomainNameDomainService.pageList(tenantsDomainNamePo);
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 配置域名
|
||||
*/
|
||||
public int congfigDomainName(SysTenantsDto sysTenantsDto) {
|
||||
List<TenantsDomainName> domainNames = sysTenantsDto.getDomainNames();
|
||||
List<String> domainName = domainNames.stream().map(i -> i.getDomainName()).collect(Collectors.toList());
|
||||
//先校验
|
||||
if (CollectionUtil.isNotEmpty(domainNames)){
|
||||
TenantsDomainName tenantsDomainName = null;
|
||||
for (TenantsDomainName tenantsDomainName1 : domainNames) {
|
||||
if (tenantsDomainName1.getShowFlag() != null && tenantsDomainName1.getShowFlag() == 2){
|
||||
tenantsDomainName = tenantsDomainName1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (tenantsDomainName == null){
|
||||
throw new ServiceException("默认域名不允许删除");
|
||||
}
|
||||
List<TenantsDomainName> tenantsDomainNames = tenantsDomainNameDomainService.checkUnion(domainName, sysTenantsDto.getTenantsId());
|
||||
if (CollectionUtils.isNotEmpty(tenantsDomainNames) && tenantsDomainNames.get(0) != null){
|
||||
throw new ServiceException("域名"+tenantsDomainNames.get(0).getDomainName()+"已存在");
|
||||
}
|
||||
//根据租户id删除所有的域名
|
||||
tenantsDomainNameDomainService.deleteByTenantsId(sysTenantsDto.getTenantsId());
|
||||
domainNames.forEach( e-> e.setTenantsId(sysTenantsDto.getTenantsId()));
|
||||
//批量新增
|
||||
tenantsDomainNameDomainService.saveBatchList(domainNames);
|
||||
//更新租户信息
|
||||
SysTenants sysTenants = new SysTenants();
|
||||
sysTenants.setTenantsId(sysTenantsDto.getTenantsId());
|
||||
sysTenants.setTenantsDomainName(tenantsDomainName.getDomainName());
|
||||
sysTenantsDomainService.updateSysTenants(sysTenants);
|
||||
//设置域名
|
||||
}else {
|
||||
throw new ServiceException("域名配置为空");
|
||||
}
|
||||
return domainNames.size();
|
||||
}
|
||||
|
||||
public int updateUserAccount(SysTenantsDTO sysTenantsDTO) {
|
||||
//更新租户信息
|
||||
SysTenants sysTenants = new SysTenants();
|
||||
sysTenants.setTenantsId(sysTenantsDTO.getTenantsId());
|
||||
sysTenants.setUserId(sysTenantsDTO.getUserId());
|
||||
sysTenants.setUserAccount(sysTenantsDTO.getUserAccount());
|
||||
return sysTenantsDomainService.updateSysTenants(sysTenants);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据域名查询租户信息
|
||||
* @param path
|
||||
* @return
|
||||
*/
|
||||
public SysTenantsPo selectSysTenantsByDomain(String path) {
|
||||
if(StringUtils.isEmpty(path)){
|
||||
throw new ServiceException("域名不能为空");
|
||||
}
|
||||
SysTenantsPo result = new SysTenantsPo();
|
||||
SysTenantsPo sysTenantsPo = new SysTenantsPo();
|
||||
sysTenantsPo.setTenantsDomainName(path);
|
||||
List<SysTenantsPo> selectSysTenantsList = sysTenantsDomainService.selectSysTenantsList(sysTenantsPo);
|
||||
result = selectSysTenantsList.stream().findAny().orElse(null);
|
||||
return result;
|
||||
}
|
||||
|
||||
public SysTenantsPo getTenantsByDomainName(SysTenantsDto sysTenantsDto) {
|
||||
if (StringUtils.isNotBlank(sysTenantsDto.getTenantsDomainName())){
|
||||
SysTenantsPo tenants = sysTenantsDomainService.getTenantsByDomainName(sysTenantsDto);
|
||||
UserConfigSwitchPo configSwitch = commonApplicationService.getUserConfigSwitch(tenants.getOrganizationId());
|
||||
tenants.setIsVerifiedCode(configSwitch.getIsVerifiedCode());
|
||||
return tenants;
|
||||
}else {
|
||||
throw new ServiceException("域名有误,请查证后再试!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据组织id查询租户id
|
||||
* @param organizationId
|
||||
* @return
|
||||
*/
|
||||
public SysTenantsPo getTenantsByOrgan(Long organizationId) {
|
||||
return sysTenantsDomainService.getTenantsByOrgan(organizationId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 开放接口-获取配置的组织信息
|
||||
* @return
|
||||
*/
|
||||
public SysTenantsPo getTenantsInfoByOpen() {
|
||||
if (ObjectUtil.isNull(organizationId)) {
|
||||
throw new ServiceException("未配置组织ID");
|
||||
}
|
||||
|
||||
SysTenantsPo tenantsByOrgan = sysTenantsDomainService.getTenantsInfoByOpen(organizationId);
|
||||
if (ObjectUtil.isNull(tenantsByOrgan)){
|
||||
throw new ServiceException("组织信息未找到");
|
||||
}
|
||||
|
||||
return tenantsByOrgan;
|
||||
}
|
||||
}
|
||||
+113
@@ -0,0 +1,113 @@
|
||||
package com.linke.product.application.service.tenants;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.linke.product.domain.tenants.entity.SysTenants;
|
||||
import com.mhd.common.core.constant.CacheConstants;
|
||||
import com.mhd.common.core.domain.entity.OrgProductConfig;
|
||||
import com.mhd.common.core.domain.entity.R;
|
||||
import com.mhd.common.core.domain.po.OrganizationPo;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.UserError;
|
||||
import com.mhd.common.core.utils.StringUtils;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.redis.service.RedisService;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.MallServiceFeign;
|
||||
import com.mhd.system.api.UpmsServiceFeign;
|
||||
import com.mhd.system.api.domain.mall.SysTenant;
|
||||
import com.mhd.system.api.domain.mall.UserInfo;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
||||
/**
|
||||
* 用户商城同步处理
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class UserUpmsDomainService {
|
||||
|
||||
@Resource
|
||||
private RedisService redisService;
|
||||
@Resource
|
||||
private UpmsServiceFeign upmsServiceFeign;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 校验是否配置商城产品
|
||||
* @return true-开启,false-关闭
|
||||
*/
|
||||
private boolean checkSwitch() {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
String key = CacheConstants.ORG_PRODUCT_KEY + loginUser.getUserPo().getTopOrganizationId();
|
||||
OrgProductConfig orgProductConfig = redisService.getCacheObject(key);
|
||||
if(null == orgProductConfig) {
|
||||
return false;
|
||||
}
|
||||
//配置商城
|
||||
return orgProductConfig.getMallFlag() == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步租户相关字段
|
||||
* @param sysTenants 租户表实体
|
||||
* @return true-同步成功,false-同步失败
|
||||
*/
|
||||
public boolean szwlSyncTenant(SysTenants sysTenants) {
|
||||
if(null == sysTenants){
|
||||
throw new ServiceException("同步数据不能为空");
|
||||
}
|
||||
//检查是否开启商城
|
||||
boolean flag = checkSwitch();
|
||||
if(!flag){
|
||||
//如果未配置商城产品,返回跳过
|
||||
return true;
|
||||
}
|
||||
//定义传输实体 实体转换
|
||||
SysTenant sysTenant = syncTenantConvert(sysTenants);
|
||||
R sysTenantR = upmsServiceFeign.szwlSyncTenant(sysTenant, "Y");
|
||||
if (R.FAIL == sysTenantR.getCode()) {
|
||||
throw new ServiceException(sysTenantR.getMsg());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 封装租户实体
|
||||
* @param sysTenants
|
||||
* @return
|
||||
*/
|
||||
private SysTenant syncTenantConvert(SysTenants sysTenants) {
|
||||
SysTenant sysTenant = new SysTenant();
|
||||
sysTenant.setSzwlTenantId(sysTenants.getTenantsId().toString());
|
||||
sysTenant.setName(sysTenants.getTenantsSimpleName());
|
||||
sysTenant.setRemarks(sysTenants.getRemark());
|
||||
sysTenant.setPhone(sysTenants.getHotline());
|
||||
if(sysTenants.getDelFlag()==1){
|
||||
sysTenant.setDelFlag("0");
|
||||
}else {
|
||||
sysTenant.setDelFlag("-1");
|
||||
}
|
||||
if(sysTenants.getTenantsStatus() != null && sysTenants.getTenantsStatus() ==1){
|
||||
sysTenant.setStatus("0");
|
||||
}else {
|
||||
sysTenant.setStatus("9");
|
||||
}
|
||||
sysTenant.setLogo(sysTenants.getLogoUrlPc());
|
||||
sysTenant.setSort(1);
|
||||
sysTenant.setCode(String.valueOf(sysTenants.getTenantsId()));
|
||||
sysTenant.setType("1");
|
||||
return sysTenant;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.linke.product.domain.appConfig.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 产品中台-app配置对象 app_config
|
||||
*
|
||||
* @author gen
|
||||
* @date 2023-10-07
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class AppConfig extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("APP配置表ID")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long appId;
|
||||
|
||||
@ApiModelProperty("APP名称")
|
||||
@Excel(name = "APP名称")
|
||||
private String appName;
|
||||
|
||||
@ApiModelProperty("APP包名")
|
||||
@Excel(name = "APP包名")
|
||||
private String appPackage;
|
||||
|
||||
@ApiModelProperty("APP范围编码,多个,号隔开(数据字典)")
|
||||
@Excel(name = "APP范围编码,多个,号隔开")
|
||||
private String appRangeCode;
|
||||
|
||||
@ApiModelProperty("APP范围名称,多个、号区分")
|
||||
@Excel(name = "APP范围名称,多个、号区分")
|
||||
private String appRangeName;
|
||||
|
||||
@ApiModelProperty("APP角色Id,多个,号隔开(数据字典)")
|
||||
@Excel(name = "APP角色Id,多个,号隔开")
|
||||
private String appRoleId;
|
||||
|
||||
@ApiModelProperty("APP角色code,多个,号隔开(数据字典)")
|
||||
@Excel(name = "APP角色code,多个,号隔开")
|
||||
private String appRoleCode;
|
||||
|
||||
@ApiModelProperty("APP角色名称,多个、号区分")
|
||||
@Excel(name = "APP角色名称,多个、号区分")
|
||||
private String appRoleName;
|
||||
|
||||
@ApiModelProperty("APP图标")
|
||||
@Excel(name = "APP图标")
|
||||
private String appIcon;
|
||||
|
||||
@ApiModelProperty("APP描述")
|
||||
@Excel(name = "APP描述")
|
||||
private String appRemark;
|
||||
|
||||
@ApiModelProperty(name = "级联组织ID")
|
||||
@Excel(name = "级联组织ID")
|
||||
private String organizationLinkage;
|
||||
|
||||
@ApiModelProperty("组织表ID")
|
||||
@Excel(name = "组织表ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("组织名称")
|
||||
@Excel(name = "组织名称")
|
||||
private String organizationName;
|
||||
|
||||
@ApiModelProperty("一级组织id")
|
||||
@Excel(name = "一级组织id")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("app二维码")
|
||||
@Excel(name = "app二维码")
|
||||
private String appQrcode;
|
||||
|
||||
@ApiModelProperty("app使用帮助")
|
||||
@Excel(name = "app使用帮助")
|
||||
private String appUsingHelp;
|
||||
|
||||
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
package com.linke.product.domain.appConfig.repository.facade;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.linke.product.domain.appConfig.entity.AppConfig;
|
||||
import com.mhd.common.core.domain.po.AppConfigPO;
|
||||
import com.linke.product.domain.appConfig.repository.todo.AppConfigDO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 产品中台-app配置Service接口
|
||||
*
|
||||
* @author gen
|
||||
* @date 2023-10-07
|
||||
*/
|
||||
public interface IAppConfigService extends IService<AppConfig>
|
||||
{
|
||||
/**
|
||||
* 分页查询产品中台-app配置列表
|
||||
*/
|
||||
public List<AppConfigPO> queryList(AppConfigDO appConfigDO);
|
||||
|
||||
/**
|
||||
* 新增产品中台-app配置
|
||||
*/
|
||||
public Boolean insert(AppConfigDO appConfigDO);
|
||||
|
||||
/**
|
||||
* 修改产品中台-app配置
|
||||
*/
|
||||
public Boolean update(AppConfigDO appConfigDO);
|
||||
|
||||
/**
|
||||
* 批量删除产品中台-app配置
|
||||
*/
|
||||
public Boolean delete(Long[] appIds);
|
||||
|
||||
|
||||
/**
|
||||
* 查询产品中台-app配置
|
||||
*/
|
||||
public AppConfigPO getInfo(Long appId);
|
||||
|
||||
/**
|
||||
* @description 根据app包名获取app配置信息
|
||||
* @author ZhouGY
|
||||
* @date 2023/10/31 13:31
|
||||
* @param appPackage
|
||||
* @return AppConfigPO
|
||||
*/
|
||||
public AppConfigPO getAppConfigInfoByAppPackage(String appPackage, Long topOrganizationId);
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.linke.product.domain.appConfig.repository.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.linke.product.domain.appConfig.entity.AppConfig;
|
||||
import com.mhd.common.core.domain.po.AppConfigPO;
|
||||
import com.linke.product.domain.appConfig.repository.todo.AppConfigDO;
|
||||
|
||||
/**
|
||||
* 产品中台-app配置Mapper接口
|
||||
*
|
||||
* @author gen
|
||||
* @date 2023-10-07
|
||||
*/
|
||||
public interface AppConfigMapper extends BaseMapper<AppConfig>
|
||||
{
|
||||
/**
|
||||
* 查询产品中台-app配置列表
|
||||
*/
|
||||
public List<AppConfigPO> queryList(AppConfigDO appConfigDO);
|
||||
|
||||
}
|
||||
+118
@@ -0,0 +1,118 @@
|
||||
package com.linke.product.domain.appConfig.repository.persistence;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.linke.product.domain.appConfig.entity.AppConfig;
|
||||
import com.linke.product.domain.appConfig.repository.facade.IAppConfigService;
|
||||
import com.linke.product.domain.appConfig.repository.mapper.AppConfigMapper;
|
||||
import com.mhd.common.core.domain.po.AppConfigPO;
|
||||
import com.linke.product.domain.appConfig.repository.todo.AppConfigDO;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 产品中台-app配置Service业务层处理
|
||||
*
|
||||
* @author gen
|
||||
* @date 2023-10-07
|
||||
*/
|
||||
@Service
|
||||
public class AppConfigImpl extends ServiceImpl<AppConfigMapper, AppConfig> implements IAppConfigService{
|
||||
@Autowired
|
||||
private AppConfigMapper appConfigMapper;
|
||||
|
||||
/**
|
||||
* 查询产品中台-app配置列表
|
||||
*/
|
||||
@Override
|
||||
public List<AppConfigPO> queryList(AppConfigDO appConfigDO)
|
||||
{
|
||||
return appConfigMapper.queryList(appConfigDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增产品中台-app配置
|
||||
*/
|
||||
@Override
|
||||
public Boolean insert(AppConfigDO appConfigDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
AppConfig appConfig = new AppConfig();
|
||||
BeanUtils.copyProperties(appConfigDO,appConfig);
|
||||
appConfig.setCreateBy(loginUser.getUserid());
|
||||
appConfig.setCreateByName(loginUser.getUsername());
|
||||
appConfig.setCreateTime(new Date());
|
||||
appConfig.setUpdateBy(loginUser.getUserid());
|
||||
appConfig.setUpdateByName(loginUser.getUsername());
|
||||
appConfig.setUpdateTime(new Date());
|
||||
return this.save(appConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改产品中台-app配置
|
||||
*/
|
||||
@Override
|
||||
public Boolean update(AppConfigDO appConfigDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
AppConfig appConfig = new AppConfig();
|
||||
BeanUtils.copyProperties(appConfigDO,appConfig);
|
||||
appConfig.setUpdateBy(loginUser.getUserid());
|
||||
appConfig.setUpdateByName(loginUser.getUsername());
|
||||
appConfig.setUpdateTime(new Date());
|
||||
return this.updateById(appConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除产品中台-app配置
|
||||
*/
|
||||
@Override
|
||||
public Boolean delete(Long[] appIds ) {
|
||||
List<AppConfig> list = new ArrayList<>();
|
||||
for (Long id : appIds) {
|
||||
AppConfig appConfig = new AppConfig();
|
||||
appConfig.setAppId(id);
|
||||
appConfig.setDelFlag(2);
|
||||
list.add(appConfig);
|
||||
}
|
||||
return this.updateBatchById(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改产品中台-app配置
|
||||
*/
|
||||
@Override
|
||||
public AppConfigPO getInfo(Long appId) {
|
||||
AppConfig appConfig = this.getById(appId);
|
||||
AppConfigPO appConfigPO = new AppConfigPO();
|
||||
BeanUtils.copyProperties(appConfig,appConfigPO);
|
||||
return appConfigPO;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 根据app包名获取app配置信息
|
||||
* @author ZhouGY
|
||||
* @date 2023/10/31 13:33
|
||||
* @param appPackage
|
||||
* @return AppConfigPO
|
||||
*/
|
||||
@Override
|
||||
public AppConfigPO getAppConfigInfoByAppPackage(String appPackage,Long topOrganizationId) {
|
||||
AppConfig appConfig = baseMapper.selectOne(new QueryWrapper<AppConfig>().lambda()
|
||||
.eq(AppConfig::getAppPackage, appPackage)
|
||||
.eq(AppConfig::getTopOrganizationId, topOrganizationId)
|
||||
.eq(AppConfig::getDelFlag, 1));
|
||||
if (appConfig == null){
|
||||
throw new ServiceException("app配置信息不存在或已删除");
|
||||
}
|
||||
AppConfigPO appConfigPO = new AppConfigPO();
|
||||
BeanUtils.copyProperties(appConfig,appConfigPO);
|
||||
return appConfigPO;
|
||||
}
|
||||
}
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
package com.linke.product.domain.appConfig.repository.todo;
|
||||
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import lombok.Data;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 产品中台-app配置对象 app_config
|
||||
*
|
||||
* @author gen
|
||||
* @date 2023-10-07
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class AppConfigDO extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("APP配置表ID")
|
||||
private Long appId;
|
||||
|
||||
@ApiModelProperty("APP名称")
|
||||
@Excel(name = "APP名称")
|
||||
private String appName;
|
||||
|
||||
@ApiModelProperty("APP包名")
|
||||
@Excel(name = "APP包名")
|
||||
private String appPackage;
|
||||
|
||||
@ApiModelProperty("APP范围编码,多个,号隔开(数据字典)")
|
||||
@Excel(name = "APP范围编码,多个,号隔开")
|
||||
private String appRangeCode;
|
||||
|
||||
@ApiModelProperty("APP范围名称,多个、号区分")
|
||||
@Excel(name = "APP范围名称,多个、号区分")
|
||||
private String appRangeName;
|
||||
|
||||
@ApiModelProperty("APP角色Id,多个,号隔开(数据字典)")
|
||||
@Excel(name = "APP角色Id,多个,号隔开")
|
||||
private String appRoleId;
|
||||
|
||||
@ApiModelProperty("APP角色code,多个,号隔开(数据字典)")
|
||||
@Excel(name = "APP角色code,多个,号隔开")
|
||||
private String appRoleCode;
|
||||
|
||||
@ApiModelProperty("APP角色名称,多个、号区分")
|
||||
@Excel(name = "APP角色名称,多个、号区分")
|
||||
private String appRoleName;
|
||||
|
||||
@ApiModelProperty("APP图标")
|
||||
@Excel(name = "APP图标")
|
||||
private String appIcon;
|
||||
|
||||
@ApiModelProperty("APP描述")
|
||||
@Excel(name = "APP描述")
|
||||
private String appRemark;
|
||||
|
||||
@ApiModelProperty(name = "级联组织ID")
|
||||
@Excel(name = "级联组织ID")
|
||||
private String organizationLinkage;
|
||||
|
||||
@ApiModelProperty("组织表ID")
|
||||
@Excel(name = "组织表ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("组织名称")
|
||||
@Excel(name = "组织名称")
|
||||
private String organizationName;
|
||||
|
||||
@ApiModelProperty("一级组织id")
|
||||
@Excel(name = "一级组织id")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty(name = "组织ID集合")
|
||||
private List<Long> organizationIdList;
|
||||
|
||||
@ApiModelProperty(name = "权限菜单ID")
|
||||
private Long permissionMenuId;
|
||||
|
||||
@ApiModelProperty("app二维码")
|
||||
private String appQrcode;
|
||||
|
||||
@ApiModelProperty("app使用帮助")
|
||||
private String appUsingHelp;
|
||||
}
|
||||
+172
@@ -0,0 +1,172 @@
|
||||
package com.linke.product.domain.appConfig.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.linke.product.domain.appConfig.entity.AppConfig;
|
||||
import com.linke.product.domain.appConfig.repository.facade.IAppConfigService;
|
||||
import com.mhd.common.core.domain.po.AppConfigPO;
|
||||
import com.linke.product.domain.appConfig.repository.todo.AppConfigDO;
|
||||
import com.linke.product.domain.modules.repository.facade.SysModulesRepositoryInterface;
|
||||
import com.linke.product.domain.modules.repository.po.SysModulesPO;
|
||||
import com.linke.product.domain.organization.entity.Organization;
|
||||
import com.linke.product.domain.organization.repository.facade.OrganizationRepositoryInterface;
|
||||
import com.linke.product.domain.organization.repository.po.OrganizationPo;
|
||||
import com.linke.product.domain.product.entity.ProductDetails;
|
||||
import com.linke.product.domain.product.repository.facade.ProductDetailsRepositoryInterface;
|
||||
import com.linke.product.domain.tenants.entity.TenantsProduct;
|
||||
import com.linke.product.domain.tenants.repository.facade.TenantsProductRepositoryInterface;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 产品中台-app配置
|
||||
*
|
||||
* @author gen
|
||||
* @date 2023-10-07
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class AppConfigDomainService {
|
||||
|
||||
@Autowired
|
||||
private IAppConfigService appConfigService;
|
||||
@Autowired
|
||||
private OrganizationRepositoryInterface organizationRepositoryInterface;
|
||||
@Autowired
|
||||
private TenantsProductRepositoryInterface tenantsProductRepositoryInterface;
|
||||
@Autowired
|
||||
private ProductDetailsRepositoryInterface productDetailsRepositoryInterface;
|
||||
@Autowired
|
||||
private SysModulesRepositoryInterface sysModulesRepositoryInterface;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询产品中台-app配置列表
|
||||
*/
|
||||
public List<AppConfigPO> queryList(AppConfigDO appConfigDO) {
|
||||
return appConfigService.queryList(appConfigDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增产品中台-app配置
|
||||
*/
|
||||
public Boolean insert(AppConfigDO appConfigDO) {
|
||||
//公共参数赋值
|
||||
commonParams(appConfigDO);
|
||||
//包名唯一性校验
|
||||
int count = appConfigService.count(new QueryWrapper<AppConfig>().lambda()
|
||||
.eq(AppConfig::getAppPackage,appConfigDO.getAppPackage()).eq(AppConfig::getDelFlag, 1));
|
||||
if (count > 0){
|
||||
throw new ServiceException("APP包名不能重复,【" + appConfigDO.getAppPackage() + "】包名已存在");
|
||||
}
|
||||
return appConfigService.insert(appConfigDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改产品中台-app配置
|
||||
*/
|
||||
public Boolean update(AppConfigDO appConfigDO) {
|
||||
//公共参数赋值
|
||||
commonParams(appConfigDO);
|
||||
AppConfig appConfig = appConfigService.getOne(new QueryWrapper<AppConfig>().lambda()
|
||||
.eq(AppConfig::getAppId, appConfigDO.getAppId()).eq(AppConfig::getDelFlag, 1));
|
||||
if (appConfig == null){
|
||||
throw new ServiceException("APP配置信息不存在或已删除");
|
||||
}
|
||||
//包名唯一性校验
|
||||
int count = appConfigService.count(new QueryWrapper<AppConfig>().lambda()
|
||||
.eq(AppConfig::getAppPackage,appConfigDO.getAppPackage()).eq(AppConfig::getDelFlag, 1).ne(AppConfig::getAppId, appConfigDO.getAppId()));
|
||||
if (count > 0){
|
||||
throw new ServiceException("APP包名不能重复,【" + appConfigDO.getAppPackage() + "】包名已存在");
|
||||
}
|
||||
return appConfigService.update(appConfigDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @description 公共参数
|
||||
* @author ZhouGY
|
||||
* @date 2023/10/8 8:55
|
||||
* @param appConfigDO
|
||||
*/
|
||||
private void commonParams(AppConfigDO appConfigDO){
|
||||
Organization organization = organizationRepositoryInterface.getOne(new UpdateWrapper<Organization>().lambda()
|
||||
.eq(Organization::getDelFlag, 1)
|
||||
.eq(Organization::getOrganizationId, appConfigDO.getOrganizationId()));
|
||||
if (organization == null){
|
||||
throw new ServiceException("组织不存在或已删除");
|
||||
}
|
||||
appConfigDO.setOrganizationName(organization.getOrganizationName());
|
||||
OrganizationPo organizationPo = organizationRepositoryInterface.selectTopId(appConfigDO.getOrganizationId());
|
||||
appConfigDO.setTopOrganizationId(organizationPo.getOrganizationId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除产品中台-app配置
|
||||
*/
|
||||
public Boolean delete(Long[] appIds) {
|
||||
return appConfigService.delete(appIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取产品中台-app配置详细信息
|
||||
*/
|
||||
public AppConfigPO getInfo(Long appId)
|
||||
{
|
||||
return appConfigService.getInfo(appId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 根据app包名获取app配置信息
|
||||
* @author ZhouGY
|
||||
* @date 2023/10/31 13:33
|
||||
* @param appPackage
|
||||
* @return AppConfigPO
|
||||
*/
|
||||
public AppConfigPO getAppConfigInfoByAppPackage(String appPackage, Long topOrganizationId) {
|
||||
return appConfigService.getAppConfigInfoByAppPackage(appPackage, topOrganizationId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @description 查询一级组织绑定的中台,返回树状结构
|
||||
* @author ZhouGY
|
||||
* @date 2023/10/8 10:59
|
||||
* @param organizationId
|
||||
* @return List<SysModulesPO>
|
||||
*/
|
||||
public List<SysModulesPO> getModulesListByProduct(Long organizationId){
|
||||
//根据组织id查询出一级组织信息
|
||||
OrganizationPo organizationPo = organizationRepositoryInterface.selectTopId(organizationId);
|
||||
if (organizationPo == null){
|
||||
throw new ServiceException("租户信息不存在或已删除");
|
||||
}
|
||||
OrganizationPo organizationPoInfo = organizationRepositoryInterface.selectOrganizationById(organizationPo.getOrganizationId());
|
||||
//根据一级组织的租户id查询租户绑定的产品
|
||||
List<TenantsProduct> tenantsProductList = tenantsProductRepositoryInterface.selectProductListByTenantsId(organizationPoInfo.getTenantsId());
|
||||
//没有配置产品 直接返回空集合
|
||||
if (CollectionUtils.isEmpty(tenantsProductList)){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<Long> productIdList = tenantsProductList.stream().map(TenantsProduct::getProductId).collect(Collectors.toList());
|
||||
//根据产品id查询app客户端类型的中台 modulesClient 中台客户端类型0-无状态,1-PC,2-APP
|
||||
List<ProductDetails> productDetailsList = productDetailsRepositoryInterface.selectDetailsListByProductIds(productIdList, 2);
|
||||
//没有配置中台 直接返回空集合
|
||||
if (CollectionUtils.isEmpty(productDetailsList)){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<Long> modulesIdList = productDetailsList.stream().map(ProductDetails::getModulesId).collect(Collectors.toList());
|
||||
//根据模块id查询模块信息返回树状结构
|
||||
return sysModulesRepositoryInterface.findModulesTreeByModuleIds(modulesIdList);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.linke.product.domain.appMenu.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 产品中台-app/菜单权限对象 app_menu
|
||||
*
|
||||
* @author gen
|
||||
* @date 2023-10-07
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class AppMenu extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("APP/菜单权限表ID")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long appMenuId;
|
||||
|
||||
@ApiModelProperty("APP配置表ID")
|
||||
@Excel(name = "APP配置表ID")
|
||||
private Long appId;
|
||||
|
||||
@ApiModelProperty("菜单id")
|
||||
@Excel(name = "菜单id")
|
||||
private Long menuId;
|
||||
|
||||
|
||||
}
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
package com.linke.product.domain.appMenu.repository.facade;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.linke.product.domain.appMenu.entity.AppMenu;
|
||||
import com.linke.product.domain.appMenu.repository.po.AppMenuPO;
|
||||
import com.linke.product.domain.appMenu.repository.po.AppModulePO;
|
||||
import com.linke.product.domain.appMenu.repository.todo.AppMenuDO;
|
||||
import com.linke.product.domain.menu.repository.po.MenuPo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 产品中台-app/菜单权限Service接口
|
||||
*
|
||||
* @author gen
|
||||
* @date 2023-10-07
|
||||
*/
|
||||
public interface IAppMenuService extends IService<AppMenu>
|
||||
{
|
||||
/**
|
||||
* 分页查询产品中台-app/菜单权限列表
|
||||
*/
|
||||
public List<AppMenuPO> queryList(AppMenuDO appMenuDO);
|
||||
|
||||
/**
|
||||
* @description 查询app下的中台
|
||||
* @author ZhouGY
|
||||
* @date 2023/10/9 14:24
|
||||
* @param appMenuDO
|
||||
* @return List<AppModulePO>
|
||||
*/
|
||||
List<AppModulePO> queryModulesList(AppMenuDO appMenuDO);
|
||||
|
||||
/**
|
||||
* @description TODO
|
||||
* @author ZhouGY
|
||||
* @date 2023/10/9 14:24
|
||||
* @param appMenuDO
|
||||
* @return List<MenuPo>
|
||||
*/
|
||||
public List<MenuPo> queryMenuListByApp(AppMenuDO appMenuDO);
|
||||
|
||||
/**
|
||||
* 新增产品中台-app/菜单权限
|
||||
*/
|
||||
public Boolean insert(AppMenuDO appMenuDO);
|
||||
|
||||
/**
|
||||
* 修改产品中台-app/菜单权限
|
||||
*/
|
||||
public Boolean update(AppMenuDO appMenuDO);
|
||||
|
||||
/**
|
||||
* 批量删除产品中台-app/菜单权限
|
||||
*/
|
||||
public Boolean delete(Long[] appMenuIds);
|
||||
|
||||
|
||||
/**
|
||||
* 查询产品中台-app/菜单权限
|
||||
*/
|
||||
public AppMenuPO getInfo(Long appMenuId);
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
package com.linke.product.domain.appMenu.repository.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.linke.product.domain.appMenu.entity.AppMenu;
|
||||
import com.linke.product.domain.appMenu.repository.po.AppMenuPO;
|
||||
import com.linke.product.domain.appMenu.repository.po.AppModulePO;
|
||||
import com.linke.product.domain.appMenu.repository.todo.AppMenuDO;
|
||||
import com.linke.product.domain.menu.repository.po.MenuPo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
/**
|
||||
* 产品中台-app/菜单权限Mapper接口
|
||||
*
|
||||
* @author gen
|
||||
* @date 2023-10-07
|
||||
*/
|
||||
public interface AppMenuMapper extends BaseMapper<AppMenu>
|
||||
{
|
||||
/**
|
||||
* 查询产品中台-app/菜单权限列表
|
||||
*/
|
||||
public List<AppMenuPO> queryList(AppMenuDO appMenuDO);
|
||||
|
||||
/**
|
||||
* @description 查询app下的中台
|
||||
* @author ZhouGY
|
||||
* @date 2023/10/9 14:23
|
||||
* @param appMenuDO
|
||||
* @return List<AppModulePO>
|
||||
*/
|
||||
public List<AppModulePO> queryModulesList(AppMenuDO appMenuDO);
|
||||
|
||||
/**
|
||||
* @description 查询app下的菜单
|
||||
* @author ZhouGY
|
||||
* @date 2023/10/9 14:23
|
||||
* @param appMenuDO
|
||||
* @return List<MenuPo>
|
||||
*/
|
||||
public List<MenuPo> queryMenuListByApp(AppMenuDO appMenuDO);
|
||||
}
|
||||
+126
@@ -0,0 +1,126 @@
|
||||
package com.linke.product.domain.appMenu.repository.persistence;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.linke.product.domain.appMenu.entity.AppMenu;
|
||||
import com.linke.product.domain.appMenu.repository.facade.IAppMenuService;
|
||||
import com.linke.product.domain.appMenu.repository.mapper.AppMenuMapper;
|
||||
import com.linke.product.domain.appMenu.repository.po.AppMenuPO;
|
||||
import com.linke.product.domain.appMenu.repository.po.AppModulePO;
|
||||
import com.linke.product.domain.appMenu.repository.todo.AppMenuDO;
|
||||
import com.linke.product.domain.menu.repository.po.MenuPo;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 产品中台-app/菜单权限Service业务层处理
|
||||
*
|
||||
* @author gen
|
||||
* @date 2023-10-07
|
||||
*/
|
||||
@Service
|
||||
public class AppMenuImpl extends ServiceImpl<AppMenuMapper, AppMenu> implements IAppMenuService{
|
||||
@Autowired
|
||||
private AppMenuMapper appMenuMapper;
|
||||
|
||||
/**
|
||||
* 查询产品中台-app/菜单权限列表
|
||||
*/
|
||||
@Override
|
||||
public List<AppMenuPO> queryList(AppMenuDO appMenuDO)
|
||||
{
|
||||
return appMenuMapper.queryList(appMenuDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 查询app下的中台
|
||||
* @author ZhouGY
|
||||
* @date 2023/10/9 14:23
|
||||
* @param appMenuDO
|
||||
* @return List<AppModulePO>
|
||||
*/
|
||||
@Override
|
||||
public List<AppModulePO> queryModulesList(AppMenuDO appMenuDO)
|
||||
{
|
||||
return appMenuMapper.queryModulesList(appMenuDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 查询app下菜单
|
||||
* @author ZhouGY
|
||||
* @date 2023/10/9 14:23
|
||||
* @param appMenuDO
|
||||
* @return List<AppModulePO>
|
||||
*/
|
||||
@Override
|
||||
public List<MenuPo> queryMenuListByApp(AppMenuDO appMenuDO)
|
||||
{
|
||||
return appMenuMapper.queryMenuListByApp(appMenuDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增产品中台-app/菜单权限
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public Boolean insert(AppMenuDO appMenuDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
List<Long> menuIdList = appMenuDO.getMenuIdList();
|
||||
List<AppMenu> appMenuList = new ArrayList<>();
|
||||
Date date = new Date();
|
||||
for (Long menuId : menuIdList){
|
||||
AppMenu appMenu = new AppMenu();
|
||||
BeanUtils.copyProperties(appMenuDO,appMenu);
|
||||
appMenu.setMenuId(menuId);
|
||||
appMenu.setCreateBy(loginUser.getUserid());
|
||||
appMenu.setCreateByName(loginUser.getUsername());
|
||||
appMenu.setCreateTime(date);
|
||||
appMenuList.add(appMenu);
|
||||
}
|
||||
|
||||
return this.saveBatch(appMenuList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改产品中台-app/菜单权限
|
||||
*/
|
||||
@Override
|
||||
public Boolean update(AppMenuDO appMenuDO) {
|
||||
AppMenu appMenu = new AppMenu();
|
||||
BeanUtils.copyProperties(appMenuDO,appMenu);
|
||||
return this.updateById(appMenu);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除产品中台-app/菜单权限
|
||||
*/
|
||||
@Override
|
||||
public Boolean delete(Long[] appMenuIds ) {
|
||||
List<AppMenu> list = new ArrayList<>();
|
||||
for (Long id : appMenuIds) {
|
||||
AppMenu appMenu = new AppMenu();
|
||||
appMenu.setAppMenuId(id);
|
||||
appMenu.setDelFlag(2);
|
||||
list.add(appMenu);
|
||||
}
|
||||
return this.updateBatchById(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改产品中台-app/菜单权限
|
||||
*/
|
||||
@Override
|
||||
public AppMenuPO getInfo(Long appMenuId) {
|
||||
AppMenu appMenu = this.getById(appMenuId);
|
||||
AppMenuPO appMenuPO = new AppMenuPO();
|
||||
BeanUtils.copyProperties(appMenu,appMenuPO);
|
||||
return appMenuPO;
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package com.linke.product.domain.appMenu.repository.po;
|
||||
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import lombok.Data;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
|
||||
|
||||
/**
|
||||
* 产品中台-app/菜单权限对象 app_menu
|
||||
*
|
||||
* @author gen
|
||||
* @date 2023-10-07
|
||||
*/
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "产品中台-app/菜单权限对象", description = "产品中台-app/菜单权限响应对象")
|
||||
public class AppMenuPO extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("APP/菜单权限表ID")
|
||||
private Long appMenuId;
|
||||
|
||||
@ApiModelProperty("APP配置表ID")
|
||||
@Excel(name = "APP配置表ID")
|
||||
private Long appId;
|
||||
|
||||
@ApiModelProperty("菜单id")
|
||||
@Excel(name = "菜单id")
|
||||
private Long menuId;
|
||||
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package com.linke.product.domain.appMenu.repository.po;
|
||||
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 产品中台-app/菜单权限对象 app_menu
|
||||
*
|
||||
* @author gen
|
||||
* @date 2023-10-07
|
||||
*/
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "产品中台-app/菜单权限对象", description = "产品中台-app/菜单权限响应对象")
|
||||
public class AppModulePO extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("APP配置表ID")
|
||||
@Excel(name = "APP配置表ID")
|
||||
private Long appId;
|
||||
|
||||
@ApiModelProperty("中台id")
|
||||
@Excel(name = "中台id")
|
||||
private Long modulesId;
|
||||
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
package com.linke.product.domain.appMenu.repository.todo;
|
||||
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import lombok.Data;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 产品中台-app/菜单权限对象 app_menu
|
||||
*
|
||||
* @author gen
|
||||
* @date 2023-10-07
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class AppMenuDO extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("APP/菜单权限表ID")
|
||||
private Long appMenuId;
|
||||
|
||||
@ApiModelProperty("APP配置表ID")
|
||||
@Excel(name = "APP配置表ID")
|
||||
private Long appId;
|
||||
|
||||
@ApiModelProperty("中台id")
|
||||
@Excel(name = "中台id")
|
||||
private Long modulesId;
|
||||
|
||||
@ApiModelProperty("菜单id")
|
||||
@Excel(name = "菜单id")
|
||||
private Long menuId;
|
||||
|
||||
@ApiModelProperty("APP包名")
|
||||
@Excel(name = "APP包名")
|
||||
private String appPackage;
|
||||
|
||||
@ApiModelProperty(name = "app位置数据字典code")
|
||||
@Excel(name = "app位置数据字典code")
|
||||
private String appLocationCode;
|
||||
|
||||
@ApiModelProperty("菜单id集合")
|
||||
private List<Long> menuIdList;
|
||||
|
||||
@ApiModelProperty(name = "组织ID集合")
|
||||
private List<Long> organizationIdList;
|
||||
|
||||
@ApiModelProperty(name = "权限菜单ID")
|
||||
private Long permissionMenuId;
|
||||
|
||||
@ApiModelProperty("用户表ID")
|
||||
@Excel(name = "用户表ID")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty("一级组织ID")
|
||||
@Excel(name = "一级组织ID")
|
||||
private Long topOrganizationId;
|
||||
}
|
||||
+207
@@ -0,0 +1,207 @@
|
||||
package com.linke.product.domain.appMenu.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.linke.product.domain.appConfig.entity.AppConfig;
|
||||
import com.linke.product.domain.appConfig.repository.facade.IAppConfigService;
|
||||
import com.linke.product.domain.appMenu.entity.AppMenu;
|
||||
import com.linke.product.domain.appMenu.repository.facade.IAppMenuService;
|
||||
import com.linke.product.domain.appMenu.repository.po.AppMenuPO;
|
||||
import com.linke.product.domain.appMenu.repository.po.AppModulePO;
|
||||
import com.linke.product.domain.appMenu.repository.todo.AppMenuDO;
|
||||
import com.linke.product.domain.appUserMenuSettings.repository.facade.IAppUserMenuSettingsService;
|
||||
import com.linke.product.domain.appUserMenuSettings.repository.todo.AppUserMenuSettingsDO;
|
||||
import com.linke.product.domain.menu.repository.facade.MenuRepositoryInterface;
|
||||
import com.linke.product.domain.menu.repository.po.MenuPo;
|
||||
import com.linke.product.domain.modules.repository.facade.SysModulesRepositoryInterface;
|
||||
import com.linke.product.domain.modules.repository.po.SysModulesPO;
|
||||
import com.mhd.common.core.domain.po.UserRoleMenuPO;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 产品中台-app/菜单权限
|
||||
*
|
||||
* @author gen
|
||||
* @date 2023-10-07
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class AppMenuDomainService {
|
||||
|
||||
@Autowired
|
||||
private IAppMenuService appMenuService;
|
||||
@Autowired
|
||||
private IAppConfigService appConfigService;
|
||||
@Autowired
|
||||
private MenuRepositoryInterface menuRepositoryInterface;
|
||||
@Autowired
|
||||
private SysModulesRepositoryInterface sysModulesRepositoryInterface;
|
||||
@Autowired
|
||||
private IAppUserMenuSettingsService appUserMenuSettingsService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询产品中台-app/菜单权限列表
|
||||
*/
|
||||
public List<AppMenuPO> queryList(AppMenuDO appMenuDO) {
|
||||
return appMenuService.queryList(appMenuDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 查询app下的中台
|
||||
* @author ZhouGY
|
||||
* @date 2023/10/9 13:46
|
||||
* @param appMenuDO
|
||||
* @return List<AppModulePO>
|
||||
*/
|
||||
public List<AppModulePO> queryModulesList(AppMenuDO appMenuDO) {
|
||||
return appMenuService.queryModulesList(appMenuDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description app加载菜单按照app位置分组展示
|
||||
* @author ZhouGY
|
||||
* @date 2023/10/9 14:41
|
||||
* @param appMenuDO
|
||||
* @return List<MenuPo>
|
||||
*/
|
||||
public List<MenuPo> queryMenuListByApp(AppMenuDO appMenuDO) {
|
||||
AppUserMenuSettingsDO appUserMenuSettingsDO = new AppUserMenuSettingsDO();
|
||||
appUserMenuSettingsDO.setUserId(appMenuDO.getUserId());
|
||||
appUserMenuSettingsDO.setAppLocationCode(appMenuDO.getAppLocationCode());
|
||||
appUserMenuSettingsDO.setTopOrganizationId(appMenuDO.getTopOrganizationId());
|
||||
List<MenuPo> menuPoList = appUserMenuSettingsService.queryAppMenuListByUserId(appUserMenuSettingsDO);
|
||||
if (menuPoList.isEmpty()){
|
||||
menuPoList = appMenuService.queryMenuListByApp(appMenuDO);
|
||||
}
|
||||
return menuPoList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存app/菜单权限
|
||||
*/
|
||||
@Transactional
|
||||
public Boolean save(AppMenuDO appMenuDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
appMenuService.update(new UpdateWrapper<AppMenu>().lambda()
|
||||
.set(AppMenu::getDelFlag, 2)
|
||||
.set(AppMenu::getUpdateBy, loginUser.getUserid())
|
||||
.set(AppMenu::getUpdateByName, loginUser.getUsername())
|
||||
.set(AppMenu::getUpdateTime, new Date())
|
||||
.eq(AppMenu::getAppId, appMenuDO.getAppId())
|
||||
.eq(AppMenu::getDelFlag, 1));
|
||||
return appMenuService.insert(appMenuDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改产品中台-app/菜单权限
|
||||
*/
|
||||
public Boolean update(AppMenuDO appMenuDO) {
|
||||
return appMenuService.update(appMenuDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除产品中台-app/菜单权限
|
||||
*/
|
||||
public Boolean delete(Long[] appMenuIds) {
|
||||
return appMenuService.delete(appMenuIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取产品中台-app/菜单权限详细信息
|
||||
*/
|
||||
public AppMenuPO getInfo(Long appMenuId)
|
||||
{
|
||||
return appMenuService.getInfo(appMenuId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @description 根据指定app id获取app绑定角色下的菜单
|
||||
* @author ZhouGY
|
||||
* @date 2023/10/8 15:44
|
||||
* @param appMenuDO
|
||||
* @return List<Long>
|
||||
*/
|
||||
public List<Long> getAppRoleIdList(AppMenuDO appMenuDO){
|
||||
|
||||
AppConfig appConfig = appConfigService.getById(appMenuDO.getAppId());
|
||||
//查询指定角色下的菜单
|
||||
return Arrays.asList(appConfig.getAppRoleId().split(",")).stream().map(s -> Long.parseLong(s)).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取指定中台下的菜单,再根据角色下菜单取交集展示
|
||||
* @author ZhouGY
|
||||
* @date 2023/10/8 15:42
|
||||
* @param appMenuDO
|
||||
* @param userRoleMenuPOList
|
||||
* @return List<MenuPo>
|
||||
*/
|
||||
public List<MenuPo> getAppMenuTree(AppMenuDO appMenuDO, List<UserRoleMenuPO> userRoleMenuPOList){
|
||||
AppConfig appConfig = appConfigService.getById(appMenuDO.getAppId());
|
||||
if (appConfig == null){
|
||||
throw new ServiceException("app中台配置不存在或已删除");
|
||||
}
|
||||
//查询指定中台下的菜单(包含中台下所有的中台菜单)
|
||||
List<SysModulesPO> sysModulesPOList = sysModulesRepositoryInterface.findRecursionModulesByModuleId(appMenuDO.getModulesId());
|
||||
if (sysModulesPOList.isEmpty()){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<Long> moduleIdList = sysModulesPOList.stream().map(SysModulesPO::getModulesId).collect(Collectors.toList());
|
||||
MenuPo menu = new MenuPo();
|
||||
menu.setModuleIdList(moduleIdList);
|
||||
menu.setTopOrganizationId(appConfig.getOrganizationId());
|
||||
List<MenuPo> menuPosByModules = menuRepositoryInterface.selectMenuList(menu);
|
||||
if (menuPosByModules.isEmpty()){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
Map<Long,UserRoleMenuPO> modulesMenuMap = userRoleMenuPOList.stream().collect(Collectors.toMap(UserRoleMenuPO::getMenuId, Function.identity(), (key1, key2) -> key2));
|
||||
//删除不存在角色菜单下的中台菜单
|
||||
Iterator<MenuPo> iterator = menuPosByModules.iterator();
|
||||
while (iterator.hasNext()){
|
||||
MenuPo m = iterator.next();
|
||||
if (modulesMenuMap.get(m.getMenuId()) == null){
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
if (menuPosByModules.isEmpty()){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<MenuPo> menuPos = menuPosByModules.stream().filter(menuPo -> menuPo.getParentMenuId() == 0).collect(Collectors.toList());
|
||||
menuPos.forEach(menuPo -> menuPo.setChildrenList(getChildren(menuPo.getMenuId(), menuPosByModules)));
|
||||
return menuPos;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description TODO
|
||||
* @author ZhouGY
|
||||
* @date 2023/10/8 15:42
|
||||
* @param parentMenuId
|
||||
* @param menuPoList
|
||||
* @return List<MenuPo>
|
||||
*/
|
||||
private List<MenuPo> getChildren(Long parentMenuId, List<MenuPo> menuPoList){
|
||||
List<MenuPo> menuPos = menuPoList.stream().filter(menuPo -> parentMenuId.equals(menuPo.getParentMenuId())).collect(Collectors.toList());
|
||||
if (!CollectionUtils.isEmpty(menuPos)){
|
||||
menuPos.forEach(menuPo -> menuPo.setChildrenList(getChildren(menuPo.getMenuId(), menuPoList)));
|
||||
}
|
||||
return menuPos;
|
||||
}
|
||||
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package com.linke.product.domain.appUserMenuSettings.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 用户中台-用户权限对象 app_user_menu_settings
|
||||
*
|
||||
* @author gen
|
||||
* @date 2023-10-10
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class AppUserMenuSettings extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("用户个性化菜单表ID")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long aumsId;
|
||||
|
||||
@ApiModelProperty("用户表ID")
|
||||
@Excel(name = "用户表ID")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty("菜单表ID")
|
||||
@Excel(name = "菜单表ID")
|
||||
private Long menuId;
|
||||
|
||||
@ApiModelProperty("APP位置数据字典code")
|
||||
@Excel(name = "APP位置数据字典code")
|
||||
private String appLocationCode;
|
||||
|
||||
@ApiModelProperty("APP位置数据字典名称")
|
||||
@Excel(name = "APP位置数据字典名称")
|
||||
private String appLocationName;
|
||||
|
||||
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
package com.linke.product.domain.appUserMenuSettings.repository.facade;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.linke.product.domain.appUserMenuSettings.entity.AppUserMenuSettings;
|
||||
import com.linke.product.domain.appUserMenuSettings.repository.po.AppUserMenuSettingsPO;
|
||||
import com.linke.product.domain.appUserMenuSettings.repository.todo.AppUserMenuSettingsDO;
|
||||
import com.linke.product.domain.menu.repository.po.MenuPo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户中台-用户权限Service接口
|
||||
*
|
||||
* @author gen
|
||||
* @date 2023-10-10
|
||||
*/
|
||||
public interface IAppUserMenuSettingsService extends IService<AppUserMenuSettings>
|
||||
{
|
||||
/**
|
||||
* 分页查询用户中台-用户权限列表
|
||||
*/
|
||||
public List<AppUserMenuSettingsPO> queryList(AppUserMenuSettingsDO appUserMenuSettingsDO);
|
||||
|
||||
List<MenuPo> queryAppMenuListByUserId(AppUserMenuSettingsDO appUserMenuSettingsDO);
|
||||
|
||||
/**
|
||||
* 新增用户中台-用户权限
|
||||
*/
|
||||
public Boolean insert(AppUserMenuSettingsDO appUserMenuSettingsDO);
|
||||
|
||||
/**
|
||||
* 修改用户中台-用户权限
|
||||
*/
|
||||
public Boolean update(AppUserMenuSettingsDO appUserMenuSettingsDO);
|
||||
|
||||
/**
|
||||
* 批量删除用户中台-用户权限
|
||||
*/
|
||||
public Boolean delete(Long[] aumsIds);
|
||||
|
||||
|
||||
/**
|
||||
* 查询用户中台-用户权限
|
||||
*/
|
||||
public AppUserMenuSettingsPO getInfo(Long aumsId);
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package com.linke.product.domain.appUserMenuSettings.repository.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.linke.product.domain.appUserMenuSettings.entity.AppUserMenuSettings;
|
||||
import com.linke.product.domain.appUserMenuSettings.repository.po.AppUserMenuSettingsPO;
|
||||
import com.linke.product.domain.appUserMenuSettings.repository.todo.AppUserMenuSettingsDO;
|
||||
import com.linke.product.domain.menu.repository.po.MenuPo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
/**
|
||||
* 用户中台-用户权限Mapper接口
|
||||
*
|
||||
* @author gen
|
||||
* @date 2023-10-10
|
||||
*/
|
||||
public interface AppUserMenuSettingsMapper extends BaseMapper<AppUserMenuSettings>
|
||||
{
|
||||
/**
|
||||
* 查询用户中台-用户权限列表
|
||||
*/
|
||||
public List<AppUserMenuSettingsPO> queryList(AppUserMenuSettingsDO appUserMenuSettingsDO);
|
||||
|
||||
/**
|
||||
* @description 根据登录用户获取当前用户菜单个性化设置
|
||||
* @author ZhouGY
|
||||
* @date 2023/10/10 15:55
|
||||
* @param appUserMenuSettingsDO
|
||||
* @return List<AppUserMenuSettingsPO>
|
||||
*/
|
||||
public List<MenuPo> queryAppMenuListByUserId(AppUserMenuSettingsDO appUserMenuSettingsDO);
|
||||
|
||||
}
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
package com.linke.product.domain.appUserMenuSettings.repository.persistence;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.linke.product.domain.appUserMenuSettings.entity.AppUserMenuSettings;
|
||||
import com.linke.product.domain.appUserMenuSettings.repository.facade.IAppUserMenuSettingsService;
|
||||
import com.linke.product.domain.appUserMenuSettings.repository.mapper.AppUserMenuSettingsMapper;
|
||||
import com.linke.product.domain.appUserMenuSettings.repository.po.AppUserMenuSettingsPO;
|
||||
import com.linke.product.domain.appUserMenuSettings.repository.todo.AppUserMenuSettingsDO;
|
||||
import com.linke.product.domain.menu.repository.po.MenuPo;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户中台-用户权限Service业务层处理
|
||||
*
|
||||
* @author gen
|
||||
* @date 2023-10-10
|
||||
*/
|
||||
@Service
|
||||
public class AppUserMenuSettingsImpl extends ServiceImpl<AppUserMenuSettingsMapper, AppUserMenuSettings> implements IAppUserMenuSettingsService{
|
||||
@Autowired
|
||||
private AppUserMenuSettingsMapper appUserMenuSettingsMapper;
|
||||
|
||||
/**
|
||||
* 查询用户中台-用户权限列表
|
||||
*/
|
||||
@Override
|
||||
public List<AppUserMenuSettingsPO> queryList(AppUserMenuSettingsDO appUserMenuSettingsDO)
|
||||
{
|
||||
return appUserMenuSettingsMapper.queryList(appUserMenuSettingsDO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MenuPo> queryAppMenuListByUserId(AppUserMenuSettingsDO appUserMenuSettingsDO)
|
||||
{
|
||||
return appUserMenuSettingsMapper.queryAppMenuListByUserId(appUserMenuSettingsDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户中台-用户权限
|
||||
*/
|
||||
@Override
|
||||
public Boolean insert(AppUserMenuSettingsDO appUserMenuSettingsDO) {
|
||||
AppUserMenuSettings appUserMenuSettings = new AppUserMenuSettings();
|
||||
BeanUtils.copyProperties(appUserMenuSettingsDO,appUserMenuSettings);
|
||||
return this.save(appUserMenuSettings);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户中台-用户权限
|
||||
*/
|
||||
@Override
|
||||
public Boolean update(AppUserMenuSettingsDO appUserMenuSettingsDO) {
|
||||
AppUserMenuSettings appUserMenuSettings = new AppUserMenuSettings();
|
||||
BeanUtils.copyProperties(appUserMenuSettingsDO,appUserMenuSettings);
|
||||
return this.updateById(appUserMenuSettings);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除用户中台-用户权限
|
||||
*/
|
||||
@Override
|
||||
public Boolean delete(Long[] aumsIds ) {
|
||||
List<AppUserMenuSettings> list = new ArrayList<>();
|
||||
for (Long id : aumsIds) {
|
||||
AppUserMenuSettings appUserMenuSettings = new AppUserMenuSettings();
|
||||
appUserMenuSettings.setAumsId(id);
|
||||
appUserMenuSettings.setDelFlag(2);
|
||||
list.add(appUserMenuSettings);
|
||||
}
|
||||
return this.updateBatchById(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户中台-用户权限
|
||||
*/
|
||||
@Override
|
||||
public AppUserMenuSettingsPO getInfo(Long aumsId) {
|
||||
AppUserMenuSettings appUserMenuSettings = this.getById(aumsId);
|
||||
AppUserMenuSettingsPO appUserMenuSettingsPO = new AppUserMenuSettingsPO();
|
||||
BeanUtils.copyProperties(appUserMenuSettings,appUserMenuSettingsPO);
|
||||
return appUserMenuSettingsPO;
|
||||
}
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package com.linke.product.domain.appUserMenuSettings.repository.po;
|
||||
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import lombok.Data;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
|
||||
|
||||
/**
|
||||
* 用户中台-用户权限对象 app_user_menu_settings
|
||||
*
|
||||
* @author gen
|
||||
* @date 2023-10-10
|
||||
*/
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "用户中台-用户权限对象", description = "用户中台-用户权限响应对象")
|
||||
public class AppUserMenuSettingsPO extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("用户个性化菜单表ID")
|
||||
private Long aumsId;
|
||||
|
||||
@ApiModelProperty("用户表ID")
|
||||
@Excel(name = "用户表ID")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty("菜单表ID")
|
||||
@Excel(name = "菜单表ID")
|
||||
private Long menuId;
|
||||
|
||||
@ApiModelProperty("APP位置数据字典code")
|
||||
@Excel(name = "APP位置数据字典code")
|
||||
private String appLocationCode;
|
||||
|
||||
@ApiModelProperty("APP位置数据字典名称")
|
||||
@Excel(name = "APP位置数据字典名称")
|
||||
private String appLocationName;
|
||||
|
||||
|
||||
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
package com.linke.product.domain.appUserMenuSettings.repository.todo;
|
||||
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import lombok.Data;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 用户中台-用户权限对象 app_user_menu_settings
|
||||
*
|
||||
* @author gen
|
||||
* @date 2023-10-10
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class AppUserMenuSettingsDO extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("用户个性化菜单表ID")
|
||||
private Long aumsId;
|
||||
|
||||
@ApiModelProperty("用户表ID")
|
||||
@Excel(name = "用户表ID")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty("菜单表ID")
|
||||
@Excel(name = "菜单表ID")
|
||||
private Long menuId;
|
||||
|
||||
@ApiModelProperty("APP位置数据字典code")
|
||||
@Excel(name = "APP位置数据字典code")
|
||||
private String appLocationCode;
|
||||
|
||||
@ApiModelProperty("APP位置数据字典名称")
|
||||
@Excel(name = "APP位置数据字典名称")
|
||||
private String appLocationName;
|
||||
|
||||
@ApiModelProperty(name = "组织ID集合")
|
||||
private List<Long> organizationIdList;
|
||||
|
||||
@ApiModelProperty(name = "权限菜单ID")
|
||||
private Long permissionMenuId;
|
||||
|
||||
@ApiModelProperty("APP包名")
|
||||
private String appPackage;
|
||||
|
||||
@ApiModelProperty("一级组织ID")
|
||||
@Excel(name = "一级组织ID")
|
||||
private Long topOrganizationId;
|
||||
}
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
package com.linke.product.domain.appUserMenuSettings.service;
|
||||
|
||||
import cn.hutool.json.JSONArray;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.linke.product.domain.appMenu.repository.facade.IAppMenuService;
|
||||
import com.linke.product.domain.appMenu.repository.todo.AppMenuDO;
|
||||
import com.linke.product.domain.appUserMenuSettings.repository.facade.IAppUserMenuSettingsService;
|
||||
import com.linke.product.domain.appUserMenuSettings.repository.po.AppUserMenuSettingsPO;
|
||||
import com.linke.product.domain.appUserMenuSettings.repository.todo.AppUserMenuSettingsDO;
|
||||
import com.linke.product.domain.menu.repository.po.MenuPo;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 用户中台-用户权限
|
||||
*
|
||||
* @author gen
|
||||
* @date 2023-10-10
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class AppUserMenuSettingsDomainService {
|
||||
|
||||
@Autowired
|
||||
private IAppUserMenuSettingsService appUserMenuSettingsService;
|
||||
@Autowired
|
||||
private IAppMenuService appMenuService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询用户中台-用户权限列表
|
||||
*/
|
||||
public List<AppUserMenuSettingsPO> queryList(AppUserMenuSettingsDO appUserMenuSettingsDO) {
|
||||
return appUserMenuSettingsService.queryList(appUserMenuSettingsDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 根据用户查询用户菜单个性化设置
|
||||
* @author ZhouGY
|
||||
* @date 2023/10/10 15:35
|
||||
* @param appUserMenuSettingsDO
|
||||
* @return JSONArray
|
||||
*/
|
||||
public JSONArray queryApplicationCenter(AppUserMenuSettingsDO appUserMenuSettingsDO){
|
||||
if (appUserMenuSettingsDO.getTopOrganizationId() == null){
|
||||
appUserMenuSettingsDO.setTopOrganizationId(SecurityUtils.getLoginUser().getUserPo().getTopOrganizationId());
|
||||
}
|
||||
List<MenuPo> menuPoList = appUserMenuSettingsService.queryAppMenuListByUserId(appUserMenuSettingsDO);
|
||||
if (menuPoList.isEmpty()){
|
||||
AppMenuDO appMenuDO = new AppMenuDO();
|
||||
appMenuDO.setAppPackage(appUserMenuSettingsDO.getAppPackage());
|
||||
appMenuDO.setTopOrganizationId(appUserMenuSettingsDO.getTopOrganizationId());
|
||||
menuPoList = appMenuService.queryMenuListByApp(appMenuDO);
|
||||
}
|
||||
Map<String, List<MenuPo>> listMap = menuPoList.stream().collect(Collectors.groupingBy(MenuPo::getAppLocationCode));
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
for (Map.Entry<String, List<MenuPo>> entry : listMap.entrySet()) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
List<MenuPo> appUserMenuSettingsPOS = entry.getValue();
|
||||
jsonObject.set("appLocationCode",entry.getKey());
|
||||
jsonObject.set("appLocationName",appUserMenuSettingsPOS.get(0).getAppLocationName());
|
||||
jsonObject.set("items",appUserMenuSettingsPOS);
|
||||
jsonArray.add(jsonObject);
|
||||
}
|
||||
return jsonArray;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增用户中台-用户权限
|
||||
*/
|
||||
public Boolean insert(AppUserMenuSettingsDO appUserMenuSettingsDO) {
|
||||
|
||||
return appUserMenuSettingsService.insert(appUserMenuSettingsDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户中台-用户权限
|
||||
*/
|
||||
public Boolean update(AppUserMenuSettingsDO appUserMenuSettingsDO) {
|
||||
return appUserMenuSettingsService.update(appUserMenuSettingsDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除用户中台-用户权限
|
||||
*/
|
||||
public Boolean delete(Long[] aumsIds) {
|
||||
return appUserMenuSettingsService.delete(aumsIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户中台-用户权限详细信息
|
||||
*/
|
||||
public AppUserMenuSettingsPO getInfo(Long aumsId)
|
||||
{
|
||||
return appUserMenuSettingsService.getInfo(aumsId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.linke.product.domain.common.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据权限判断 po
|
||||
*
|
||||
* 2023-01-11
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
@Data
|
||||
public class DataPermission
|
||||
{
|
||||
@ApiModelProperty(value = "创建者")
|
||||
private Long createBy;
|
||||
@ApiModelProperty(name = "组织ID集合")
|
||||
private List<Long> organizationIdList;
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
package com.linke.product.domain.commonFunctions.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import java.math.BigDecimal;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
|
||||
/**
|
||||
* 常用功能菜单对象 common_functions
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-08-30
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class CommonFunctions extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("常用功能id")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long commonFunctionsId;
|
||||
|
||||
@ApiModelProperty("一级组织表ID")
|
||||
@Excel(name = "一级组织表ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("组织表ID")
|
||||
@Excel(name = "组织表ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("组织名称")
|
||||
@Excel(name = "组织名称")
|
||||
private String organizationName;
|
||||
|
||||
@ApiModelProperty("用户ID")
|
||||
@Excel(name = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty("菜单ID")
|
||||
@Excel(name = "菜单ID")
|
||||
private Long menuId;
|
||||
|
||||
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package com.linke.product.domain.commonFunctions.repository.facade;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.linke.product.domain.commonFunctions.entity.CommonFunctions;
|
||||
import com.linke.product.domain.commonFunctions.repository.po.CommonFunctionsPO;
|
||||
import com.linke.product.domain.commonFunctions.repository.todo.CommonFunctionsDO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 常用功能菜单Service接口
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-08-30
|
||||
*/
|
||||
public interface ICommonFunctionsService extends IService<CommonFunctions>
|
||||
{
|
||||
/**
|
||||
* 分页查询常用功能菜单列表
|
||||
*/
|
||||
public List<CommonFunctionsPO> queryList(CommonFunctionsDO commonFunctionsDO);
|
||||
|
||||
/**
|
||||
* 新增常用功能菜单
|
||||
*/
|
||||
public Boolean insert(CommonFunctionsDO commonFunctionsDO);
|
||||
|
||||
/**
|
||||
* 修改常用功能菜单
|
||||
*/
|
||||
public Boolean update(CommonFunctionsDO commonFunctionsDO);
|
||||
|
||||
/**
|
||||
* 批量删除常用功能菜单
|
||||
*/
|
||||
public Boolean delete(Long[] commonFunctionsIds);
|
||||
|
||||
|
||||
/**
|
||||
* 查询常用功能菜单
|
||||
*/
|
||||
public CommonFunctionsPO getInfo(Long commonFunctionsId);
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.linke.product.domain.commonFunctions.repository.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.linke.product.domain.commonFunctions.entity.CommonFunctions;
|
||||
import com.linke.product.domain.commonFunctions.repository.po.CommonFunctionsPO;
|
||||
import com.linke.product.domain.commonFunctions.repository.todo.CommonFunctionsDO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
/**
|
||||
* 常用功能菜单Mapper接口
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-08-30
|
||||
*/
|
||||
public interface CommonFunctionsMapper extends BaseMapper<CommonFunctions>
|
||||
{
|
||||
/**
|
||||
* 查询常用功能菜单列表
|
||||
*/
|
||||
public List<CommonFunctionsPO> queryList(@Param("commonFunctionsDO") CommonFunctionsDO commonFunctionsDO);
|
||||
|
||||
}
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
package com.linke.product.domain.commonFunctions.repository.persistence;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.linke.product.domain.commonFunctions.entity.CommonFunctions;
|
||||
import com.linke.product.domain.commonFunctions.repository.facade.ICommonFunctionsService;
|
||||
import com.linke.product.domain.commonFunctions.repository.mapper.CommonFunctionsMapper;
|
||||
import com.linke.product.domain.commonFunctions.repository.po.CommonFunctionsPO;
|
||||
import com.linke.product.domain.commonFunctions.repository.todo.CommonFunctionsDO;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 常用功能菜单Service业务层处理
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-08-30
|
||||
*/
|
||||
@Service
|
||||
public class CommonFunctionsImpl extends ServiceImpl<CommonFunctionsMapper, CommonFunctions> implements ICommonFunctionsService{
|
||||
@Autowired
|
||||
private CommonFunctionsMapper commonFunctionsMapper;
|
||||
|
||||
/**
|
||||
* 查询常用功能菜单列表
|
||||
*/
|
||||
@Override
|
||||
public List<CommonFunctionsPO> queryList(CommonFunctionsDO commonFunctionsDO)
|
||||
{
|
||||
return commonFunctionsMapper.queryList(commonFunctionsDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增常用功能菜单
|
||||
*/
|
||||
@Override
|
||||
public Boolean insert(CommonFunctionsDO commonFunctionsDO) {
|
||||
CommonFunctions commonFunctions = new CommonFunctions();
|
||||
BeanUtils.copyProperties(commonFunctionsDO,commonFunctions);
|
||||
return this.save(commonFunctions);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改常用功能菜单
|
||||
*/
|
||||
@Override
|
||||
public Boolean update(CommonFunctionsDO commonFunctionsDO) {
|
||||
CommonFunctions commonFunctions = new CommonFunctions();
|
||||
BeanUtils.copyProperties(commonFunctionsDO,commonFunctions);
|
||||
return this.updateById(commonFunctions);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除常用功能菜单
|
||||
*/
|
||||
@Override
|
||||
public Boolean delete(Long[] commonFunctionsIds ) {
|
||||
List<CommonFunctions> list = new ArrayList<>();
|
||||
for (Long id : commonFunctionsIds) {
|
||||
CommonFunctions commonFunctions = new CommonFunctions();
|
||||
commonFunctions.setCommonFunctionsId(id);
|
||||
commonFunctions.setDelFlag(2);
|
||||
list.add(commonFunctions);
|
||||
}
|
||||
return this.updateBatchById(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改常用功能菜单
|
||||
*/
|
||||
@Override
|
||||
public CommonFunctionsPO getInfo(Long commonFunctionsId) {
|
||||
CommonFunctions commonFunctions = this.getById(commonFunctionsId);
|
||||
CommonFunctionsPO commonFunctionsPO = new CommonFunctionsPO();
|
||||
BeanUtils.copyProperties(commonFunctions,commonFunctionsPO);
|
||||
return commonFunctionsPO;
|
||||
}
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
package com.linke.product.domain.commonFunctions.repository.po;
|
||||
|
||||
import com.linke.product.interfaces.facade.menu.vo.NavigationVo;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.math.BigDecimal;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
|
||||
|
||||
/**
|
||||
* 常用功能菜单对象 common_functions
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-08-30
|
||||
*/
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "常用功能菜单对象", description = "常用功能菜单响应对象")
|
||||
public class CommonFunctionsPO extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("常用功能id")
|
||||
private Long commonFunctionsId;
|
||||
|
||||
@ApiModelProperty("一级组织表ID")
|
||||
@Excel(name = "一级组织表ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("组织表ID")
|
||||
@Excel(name = "组织表ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("组织名称")
|
||||
@Excel(name = "组织名称")
|
||||
private String organizationName;
|
||||
|
||||
@ApiModelProperty("用户ID")
|
||||
@Excel(name = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty("菜单ID")
|
||||
@Excel(name = "菜单ID")
|
||||
private Long menuId;
|
||||
|
||||
@ApiModelProperty("菜单信息")
|
||||
@Excel(name = "菜单信息")
|
||||
private NavigationVo navigationVo;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
package com.linke.product.domain.commonFunctions.repository.todo;
|
||||
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import java.math.BigDecimal;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 常用功能菜单对象 common_functions
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-08-30
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class CommonFunctionsDO extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("常用功能id")
|
||||
private Long commonFunctionsId;
|
||||
|
||||
@ApiModelProperty("一级组织表ID")
|
||||
@Excel(name = "一级组织表ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("组织表ID")
|
||||
@Excel(name = "组织表ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("组织名称")
|
||||
@Excel(name = "组织名称")
|
||||
private String organizationName;
|
||||
|
||||
@ApiModelProperty("用户ID")
|
||||
@Excel(name = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty("菜单ID")
|
||||
@Excel(name = "菜单ID")
|
||||
private Long menuId;
|
||||
|
||||
@ApiModelProperty(name = "组织ID集合")
|
||||
private List<Long> organizationIdList;
|
||||
|
||||
@ApiModelProperty(name = "权限菜单ID")
|
||||
private Long permissionMenuId;
|
||||
|
||||
@ApiModelProperty("菜单ID集合")
|
||||
@Excel(name = "菜单ID集合")
|
||||
private List<Long> menuIdList;
|
||||
}
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
package com.linke.product.domain.commonFunctions.service;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.linke.product.domain.commonFunctions.entity.CommonFunctions;
|
||||
import com.linke.product.domain.commonFunctions.repository.facade.ICommonFunctionsService;
|
||||
import com.linke.product.domain.commonFunctions.repository.po.CommonFunctionsPO;
|
||||
import com.linke.product.domain.commonFunctions.repository.todo.CommonFunctionsDO;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.UserError;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
/**
|
||||
* 常用功能菜单
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-08-30
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class CommonFunctionsDomainService {
|
||||
|
||||
@Autowired
|
||||
private ICommonFunctionsService commonFunctionsService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询常用功能菜单列表
|
||||
*/
|
||||
public List<CommonFunctionsPO> queryList(CommonFunctionsDO commonFunctionsDO) {
|
||||
return commonFunctionsService.queryList(commonFunctionsDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增常用功能菜单
|
||||
*/
|
||||
public Boolean insert(CommonFunctionsDO commonFunctionsDO) {
|
||||
|
||||
return commonFunctionsService.insert(commonFunctionsDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改常用功能菜单
|
||||
*/
|
||||
public Boolean update(CommonFunctionsDO commonFunctionsDO) {
|
||||
return commonFunctionsService.update(commonFunctionsDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除常用功能菜单
|
||||
*/
|
||||
public Boolean delete(Long[] commonFunctionsIds) {
|
||||
return commonFunctionsService.delete(commonFunctionsIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取常用功能菜单详细信息
|
||||
*/
|
||||
public CommonFunctionsPO getInfo(Long commonFunctionsId)
|
||||
{
|
||||
return commonFunctionsService.getInfo(commonFunctionsId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量保存常用功能菜单
|
||||
* @param commonFunctions
|
||||
* @return
|
||||
*/
|
||||
public Boolean insertBatch(List<CommonFunctions> commonFunctions) {
|
||||
return commonFunctionsService.saveBatch(commonFunctions);
|
||||
}
|
||||
|
||||
public Boolean deleteByUserId() {
|
||||
//获取当前登录用户
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
LambdaQueryWrapper<CommonFunctions> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CommonFunctions::getUserId, loginUser.getUserid());
|
||||
return commonFunctionsService.remove(queryWrapper);
|
||||
}
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
package com.linke.product.domain.commonProblem.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 常见问题对象 common_problem
|
||||
*
|
||||
* @author gen
|
||||
* @date 2023-09-25
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class CommonProblem extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("表单ID")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long commonProblemId;
|
||||
|
||||
@ApiModelProperty("字典编码")
|
||||
@Excel(name = "字典编码")
|
||||
private String dictCode;
|
||||
|
||||
@ApiModelProperty("字典标签_类型名称")
|
||||
@Excel(name = "字典标签_类型名称")
|
||||
private String dictLabel;
|
||||
|
||||
@ApiModelProperty("标题")
|
||||
@Excel(name = "标题")
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty("内容")
|
||||
@Excel(name = "内容")
|
||||
private String content;
|
||||
|
||||
@ApiModelProperty("是否启用:0-无状态,1-启用,2-不启用")
|
||||
@Excel(name = "是否启用:0-无状态,1-启用,2-不启用")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty("一级组织表ID")
|
||||
@Excel(name = "一级组织表ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("组织表ID")
|
||||
@Excel(name = "组织表ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("组织名称")
|
||||
@Excel(name = "组织名称")
|
||||
private String organizationName;
|
||||
|
||||
|
||||
}
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
package com.linke.product.domain.commonProblem.repository.facade;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.linke.product.domain.commonProblem.entity.CommonProblem;
|
||||
import com.linke.product.domain.commonProblem.repository.po.CommonProblemAppPO;
|
||||
import com.linke.product.domain.commonProblem.repository.po.CommonProblemPO;
|
||||
import com.linke.product.domain.commonProblem.repository.todo.CommonProblemDO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 常见问题Service接口
|
||||
*
|
||||
* @author gen
|
||||
* @date 2023-09-25
|
||||
*/
|
||||
public interface ICommonProblemService extends IService<CommonProblem>
|
||||
{
|
||||
/**
|
||||
* 分页查询常见问题列表
|
||||
*/
|
||||
public List<CommonProblemPO> queryList(CommonProblemDO commonProblemDO);
|
||||
|
||||
/**
|
||||
* 分页查询常见问题列表-App
|
||||
*/
|
||||
public List<CommonProblemAppPO> queryListApp(CommonProblemDO commonProblemDO);
|
||||
|
||||
/**
|
||||
* 新增常见问题
|
||||
*/
|
||||
public Boolean insert(CommonProblemDO commonProblemDO);
|
||||
|
||||
/**
|
||||
* 修改常见问题
|
||||
*/
|
||||
public Boolean update(CommonProblemDO commonProblemDO);
|
||||
|
||||
/**
|
||||
* 批量删除常见问题
|
||||
*/
|
||||
public Boolean delete(Set<String> commonProblemIds);
|
||||
|
||||
|
||||
/**
|
||||
* 查询常见问题
|
||||
*/
|
||||
public CommonProblemPO getInfo(Long commonProblemId);
|
||||
|
||||
/**
|
||||
* 查询常见问题-App
|
||||
*/
|
||||
public CommonProblemAppPO getInfoApp(Long commonProblemId);
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package com.linke.product.domain.commonProblem.repository.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.linke.product.domain.commonProblem.entity.CommonProblem;
|
||||
import com.linke.product.domain.commonProblem.repository.po.CommonProblemAppPO;
|
||||
import com.linke.product.domain.commonProblem.repository.po.CommonProblemPO;
|
||||
import com.linke.product.domain.commonProblem.repository.todo.CommonProblemDO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
/**
|
||||
* 常见问题Mapper接口
|
||||
*
|
||||
* @author gen
|
||||
* @date 2023-09-25
|
||||
*/
|
||||
public interface CommonProblemMapper extends BaseMapper<CommonProblem>
|
||||
{
|
||||
/**
|
||||
* 查询常见问题列表
|
||||
*/
|
||||
public List<CommonProblemPO> queryList(CommonProblemDO commonProblemDO);
|
||||
|
||||
/**
|
||||
* 查询常见问题列表
|
||||
*/
|
||||
public List<CommonProblemAppPO> queryListApp(CommonProblemDO commonProblemDO);
|
||||
}
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
package com.linke.product.domain.commonProblem.repository.persistence;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.linke.product.domain.commonProblem.entity.CommonProblem;
|
||||
import com.linke.product.domain.commonProblem.repository.facade.ICommonProblemService;
|
||||
import com.linke.product.domain.commonProblem.repository.mapper.CommonProblemMapper;
|
||||
import com.linke.product.domain.commonProblem.repository.po.CommonProblemAppPO;
|
||||
import com.linke.product.domain.commonProblem.repository.po.CommonProblemPO;
|
||||
import com.linke.product.domain.commonProblem.repository.todo.CommonProblemDO;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 常见问题Service业务层处理
|
||||
*
|
||||
* @author gen
|
||||
* @date 2023-09-25
|
||||
*/
|
||||
@Service
|
||||
public class CommonProblemImpl extends ServiceImpl<CommonProblemMapper, CommonProblem> implements ICommonProblemService {
|
||||
@Autowired
|
||||
private CommonProblemMapper commonProblemMapper;
|
||||
|
||||
/**
|
||||
* 查询常见问题列表
|
||||
*/
|
||||
@Override
|
||||
public List<CommonProblemPO> queryList(CommonProblemDO commonProblemDO) {
|
||||
return commonProblemMapper.queryList(commonProblemDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询常见问题列表-App
|
||||
*/
|
||||
@Override
|
||||
public List<CommonProblemAppPO> queryListApp(CommonProblemDO commonProblemDO) {
|
||||
return commonProblemMapper.queryListApp(commonProblemDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增常见问题
|
||||
*/
|
||||
@Override
|
||||
public Boolean insert(CommonProblemDO commonProblemDO) {
|
||||
CommonProblem commonProblem = new CommonProblem();
|
||||
BeanUtils.copyProperties(commonProblemDO,commonProblem);
|
||||
return this.save(commonProblem);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改常见问题
|
||||
*/
|
||||
@Override
|
||||
public Boolean update(CommonProblemDO commonProblemDO) {
|
||||
CommonProblem commonProblem = new CommonProblem();
|
||||
BeanUtils.copyProperties(commonProblemDO,commonProblem);
|
||||
return this.updateById(commonProblem);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除常见问题
|
||||
*/
|
||||
@Override
|
||||
public Boolean delete(Set<String> commonProblemIds ) {
|
||||
List<CommonProblem> list = new ArrayList<>();
|
||||
for (String id : commonProblemIds) {
|
||||
CommonProblem commonProblem = new CommonProblem();
|
||||
commonProblem.setCommonProblemId(Long.valueOf(id));
|
||||
commonProblem.setDelFlag(2);
|
||||
list.add(commonProblem);
|
||||
}
|
||||
return this.updateBatchById(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改常见问题
|
||||
*/
|
||||
@Override
|
||||
public CommonProblemPO getInfo(Long commonProblemId) {
|
||||
CommonProblem commonProblem = this.getById(commonProblemId);
|
||||
CommonProblemPO commonProblemPO = new CommonProblemPO();
|
||||
BeanUtils.copyProperties(commonProblem,commonProblemPO);
|
||||
return commonProblemPO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改常见问题-App
|
||||
*/
|
||||
@Override
|
||||
public CommonProblemAppPO getInfoApp(Long commonProblemId) {
|
||||
CommonProblem commonProblem = this.getById(commonProblemId);
|
||||
CommonProblemAppPO commonProblemAppPO = new CommonProblemAppPO();
|
||||
BeanUtils.copyProperties(commonProblem, commonProblemAppPO);
|
||||
return commonProblemAppPO;
|
||||
}
|
||||
}
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
package com.linke.product.domain.commonProblem.repository.po;
|
||||
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 常见问题对象 common_problem
|
||||
*
|
||||
* @author gen
|
||||
* @date 2023-09-25
|
||||
*/
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "常见问题对象", description = "常见问题响应对象")
|
||||
public class CommonProblemAppPO extends BaseVOEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("表单ID")
|
||||
private Long commonProblemId = 0L;
|
||||
|
||||
@ApiModelProperty("字典编码")
|
||||
@Excel(name = "字典编码")
|
||||
private String dictCode = "";
|
||||
|
||||
@ApiModelProperty("字典标签_类型名称")
|
||||
@Excel(name = "字典标签_类型名称")
|
||||
private String dictLabel = "";
|
||||
|
||||
@ApiModelProperty("标题")
|
||||
@Excel(name = "标题")
|
||||
private String title = "";
|
||||
|
||||
@ApiModelProperty("内容")
|
||||
@Excel(name = "内容")
|
||||
private String content = "";
|
||||
|
||||
@ApiModelProperty("是否启用:0-无状态,1-启用,2-不启用")
|
||||
@Excel(name = "是否启用:0-无状态,1-启用,2-不启用")
|
||||
private Integer status = 0;
|
||||
|
||||
@ApiModelProperty("一级组织表ID")
|
||||
@Excel(name = "一级组织表ID")
|
||||
private Long topOrganizationId = 0L;
|
||||
|
||||
@ApiModelProperty("组织表ID")
|
||||
@Excel(name = "组织表ID")
|
||||
private Long organizationId = 0L;
|
||||
|
||||
@ApiModelProperty("组织名称")
|
||||
@Excel(name = "组织名称")
|
||||
private String organizationName = "";
|
||||
|
||||
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
package com.linke.product.domain.commonProblem.repository.po;
|
||||
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import lombok.Data;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
|
||||
|
||||
/**
|
||||
* 常见问题对象 common_problem
|
||||
*
|
||||
* @author gen
|
||||
* @date 2023-09-25
|
||||
*/
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "常见问题对象", description = "常见问题响应对象")
|
||||
public class CommonProblemPO extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("表单ID")
|
||||
private Long commonProblemId;
|
||||
|
||||
@ApiModelProperty("字典编码")
|
||||
@Excel(name = "字典编码")
|
||||
private Long dictCode;
|
||||
|
||||
@ApiModelProperty("字典标签_类型名称")
|
||||
@Excel(name = "字典标签_类型名称")
|
||||
private String dictLabel;
|
||||
|
||||
@ApiModelProperty("标题")
|
||||
@Excel(name = "标题")
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty("内容")
|
||||
@Excel(name = "内容")
|
||||
private String content;
|
||||
|
||||
@ApiModelProperty("是否启用:0-无状态,1-启用,2-不启用")
|
||||
@Excel(name = "是否启用:0-无状态,1-启用,2-不启用")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty("一级组织表ID")
|
||||
@Excel(name = "一级组织表ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("组织表ID")
|
||||
@Excel(name = "组织表ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("组织名称")
|
||||
@Excel(name = "组织名称")
|
||||
private String organizationName;
|
||||
|
||||
|
||||
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
package com.linke.product.domain.commonProblem.repository.todo;
|
||||
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import lombok.Data;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 常见问题对象 common_problem
|
||||
*
|
||||
* @author gen
|
||||
* @date 2023-09-25
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class CommonProblemDO extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("表单ID")
|
||||
private Long commonProblemId;
|
||||
|
||||
@ApiModelProperty("字典编码")
|
||||
@Excel(name = "字典编码")
|
||||
private String dictCode;
|
||||
|
||||
@ApiModelProperty("字典标签_类型名称")
|
||||
@Excel(name = "字典标签_类型名称")
|
||||
private String dictLabel;
|
||||
|
||||
@ApiModelProperty("标题")
|
||||
@Excel(name = "标题")
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty("内容")
|
||||
@Excel(name = "内容")
|
||||
private String content;
|
||||
|
||||
@ApiModelProperty("是否启用:0-无状态,1-启用,2-不启用")
|
||||
@Excel(name = "是否启用:0-无状态,1-启用,2-不启用")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty("一级组织表ID")
|
||||
@Excel(name = "一级组织表ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("组织表ID")
|
||||
@Excel(name = "组织表ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("组织名称")
|
||||
@Excel(name = "组织名称")
|
||||
private String organizationName;
|
||||
|
||||
@ApiModelProperty(name = "组织ID集合")
|
||||
private List<Long> organizationIdList;
|
||||
|
||||
@ApiModelProperty(name = "权限菜单ID")
|
||||
private Long permissionMenuId;
|
||||
}
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
package com.linke.product.domain.commonProblem.service;
|
||||
|
||||
import com.linke.product.domain.commonProblem.repository.facade.ICommonProblemService;
|
||||
import com.linke.product.domain.commonProblem.repository.po.CommonProblemAppPO;
|
||||
import com.linke.product.domain.commonProblem.repository.po.CommonProblemPO;
|
||||
import com.linke.product.domain.commonProblem.repository.todo.CommonProblemDO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 常见问题
|
||||
*
|
||||
* @author gen
|
||||
* @date 2023-09-25
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class CommonProblemDomainService {
|
||||
|
||||
@Autowired
|
||||
private ICommonProblemService commonProblemService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询常见问题列表
|
||||
*/
|
||||
public List<CommonProblemPO> queryList(CommonProblemDO commonProblemDO) {
|
||||
return commonProblemService.queryList(commonProblemDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询常见问题列表-App
|
||||
*/
|
||||
public List<CommonProblemAppPO> queryListApp(CommonProblemDO commonProblemDO) {
|
||||
return commonProblemService.queryListApp(commonProblemDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增常见问题
|
||||
*/
|
||||
public Boolean insert(CommonProblemDO commonProblemDO) {
|
||||
|
||||
return commonProblemService.insert(commonProblemDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改常见问题
|
||||
*/
|
||||
public Boolean update(CommonProblemDO commonProblemDO) {
|
||||
return commonProblemService.update(commonProblemDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除常见问题
|
||||
*/
|
||||
public Boolean delete(Set<String> commonProblemIds) {
|
||||
return commonProblemService.delete(commonProblemIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取常见问题详细信息
|
||||
*/
|
||||
public CommonProblemPO getInfo(Long commonProblemId)
|
||||
{
|
||||
return commonProblemService.getInfo(commonProblemId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取常见问题详细信息-App
|
||||
*/
|
||||
public CommonProblemAppPO getInfoApp(Long commonProblemId)
|
||||
{
|
||||
return commonProblemService.getInfoApp(commonProblemId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.linke.product.domain.commonWeb.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import java.math.BigDecimal;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
|
||||
/**
|
||||
* 常用系统/网站对象 common_web
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-08-30
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class CommonWeb extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("常用功能id")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long commonWebId;
|
||||
|
||||
@ApiModelProperty("一级组织表ID")
|
||||
@Excel(name = "一级组织表ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("组织表ID")
|
||||
@Excel(name = "组织表ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("组织名称")
|
||||
@Excel(name = "组织名称")
|
||||
private String organizationName;
|
||||
|
||||
@ApiModelProperty("用户ID")
|
||||
@Excel(name = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty("网站名称")
|
||||
@Excel(name = "网站名称", readConverterExp = "网站名称")
|
||||
private String webName;
|
||||
|
||||
@ApiModelProperty("网站图标")
|
||||
@Excel(name = "网站图标", readConverterExp = "网站图标")
|
||||
private String webIcon;
|
||||
|
||||
@ApiModelProperty("网站地址")
|
||||
@Excel(name = "网站地址", readConverterExp = "网站地址")
|
||||
private String webAddress;
|
||||
|
||||
@ApiModelProperty("排序")
|
||||
@Excel(name = "排序", readConverterExp = "排序")
|
||||
private Integer sort;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
@Excel(name = "备注", readConverterExp = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package com.linke.product.domain.commonWeb.repository.facade;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.linke.product.domain.commonWeb.entity.CommonWeb;
|
||||
import com.linke.product.domain.commonWeb.repository.po.CommonWebPO;
|
||||
import com.linke.product.domain.commonWeb.repository.todo.CommonWebDO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 常用系统/网站Service接口
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-08-30
|
||||
*/
|
||||
public interface ICommonWebService extends IService<CommonWeb>
|
||||
{
|
||||
/**
|
||||
* 分页查询常用系统/网站列表
|
||||
*/
|
||||
public List<CommonWebPO> queryList(CommonWebDO commonWebDO);
|
||||
|
||||
/**
|
||||
* 新增常用系统/网站
|
||||
*/
|
||||
public Boolean insert(CommonWebDO commonWebDO);
|
||||
|
||||
/**
|
||||
* 修改常用系统/网站
|
||||
*/
|
||||
public Boolean update(CommonWebDO commonWebDO);
|
||||
|
||||
/**
|
||||
* 批量删除常用系统/网站
|
||||
*/
|
||||
public Boolean delete(Long[] commonWebIds);
|
||||
|
||||
|
||||
/**
|
||||
* 查询常用系统/网站
|
||||
*/
|
||||
public CommonWebPO getInfo(Long commonWebId);
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.linke.product.domain.commonWeb.repository.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.linke.product.domain.commonWeb.entity.CommonWeb;
|
||||
import com.linke.product.domain.commonWeb.repository.po.CommonWebPO;
|
||||
import com.linke.product.domain.commonWeb.repository.todo.CommonWebDO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
/**
|
||||
* 常用系统/网站Mapper接口
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-08-30
|
||||
*/
|
||||
public interface CommonWebMapper extends BaseMapper<CommonWeb>
|
||||
{
|
||||
/**
|
||||
* 查询常用系统/网站列表
|
||||
*/
|
||||
public List<CommonWebPO> queryList(@Param("commonWebDO") CommonWebDO commonWebDO);
|
||||
|
||||
}
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
package com.linke.product.domain.commonWeb.repository.persistence;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.linke.product.domain.commonWeb.entity.CommonWeb;
|
||||
import com.linke.product.domain.commonWeb.repository.facade.ICommonWebService;
|
||||
import com.linke.product.domain.commonWeb.repository.mapper.CommonWebMapper;
|
||||
import com.linke.product.domain.commonWeb.repository.po.CommonWebPO;
|
||||
import com.linke.product.domain.commonWeb.repository.todo.CommonWebDO;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 常用系统/网站Service业务层处理
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-08-30
|
||||
*/
|
||||
@Service
|
||||
public class CommonWebImpl extends ServiceImpl<CommonWebMapper, CommonWeb> implements ICommonWebService{
|
||||
@Autowired
|
||||
private CommonWebMapper commonWebMapper;
|
||||
|
||||
/**
|
||||
* 查询常用系统/网站列表
|
||||
*/
|
||||
@Override
|
||||
public List<CommonWebPO> queryList(CommonWebDO commonWebDO)
|
||||
{
|
||||
return commonWebMapper.queryList(commonWebDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增常用系统/网站
|
||||
*/
|
||||
@Override
|
||||
public Boolean insert(CommonWebDO commonWebDO) {
|
||||
CommonWeb commonWeb = new CommonWeb();
|
||||
BeanUtils.copyProperties(commonWebDO,commonWeb);
|
||||
return this.save(commonWeb);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改常用系统/网站
|
||||
*/
|
||||
@Override
|
||||
public Boolean update(CommonWebDO commonWebDO) {
|
||||
CommonWeb commonWeb = new CommonWeb();
|
||||
BeanUtils.copyProperties(commonWebDO,commonWeb);
|
||||
return this.updateById(commonWeb);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除常用系统/网站
|
||||
*/
|
||||
@Override
|
||||
public Boolean delete(Long[] commonWebIds ) {
|
||||
List<CommonWeb> list = new ArrayList<>();
|
||||
for (Long id : commonWebIds) {
|
||||
CommonWeb commonWeb = new CommonWeb();
|
||||
commonWeb.setCommonWebId(id);
|
||||
commonWeb.setDelFlag(2);
|
||||
list.add(commonWeb);
|
||||
}
|
||||
return this.updateBatchById(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改常用系统/网站
|
||||
*/
|
||||
@Override
|
||||
public CommonWebPO getInfo(Long commonWebId) {
|
||||
CommonWeb commonWeb = this.getById(commonWebId);
|
||||
CommonWebPO commonWebPO = new CommonWebPO();
|
||||
BeanUtils.copyProperties(commonWeb,commonWebPO);
|
||||
return commonWebPO;
|
||||
}
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
package com.linke.product.domain.commonWeb.repository.po;
|
||||
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.math.BigDecimal;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
|
||||
|
||||
/**
|
||||
* 常用系统/网站对象 common_web
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-08-30
|
||||
*/
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "常用系统/网站对象", description = "常用系统/网站响应对象")
|
||||
public class CommonWebPO extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("常用功能id")
|
||||
private Long commonWebId;
|
||||
|
||||
@ApiModelProperty("一级组织表ID")
|
||||
@Excel(name = "一级组织表ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("组织表ID")
|
||||
@Excel(name = "组织表ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("组织名称")
|
||||
@Excel(name = "组织名称")
|
||||
private String organizationName;
|
||||
|
||||
@ApiModelProperty("用户ID")
|
||||
@Excel(name = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty("网站名称")
|
||||
@Excel(name = "网站名称", readConverterExp = "网站名称")
|
||||
private String webName;
|
||||
|
||||
@ApiModelProperty("网站图标")
|
||||
@Excel(name = "网站图标", readConverterExp = "网站图标")
|
||||
private String webIcon;
|
||||
|
||||
@ApiModelProperty("网站地址")
|
||||
@Excel(name = "网站地址", readConverterExp = "网站地址")
|
||||
private String webAddress;
|
||||
|
||||
@ApiModelProperty("排序")
|
||||
@Excel(name = "排序", readConverterExp = "排序")
|
||||
private Integer sort;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
@Excel(name = "备注", readConverterExp = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
package com.linke.product.domain.commonWeb.repository.todo;
|
||||
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import java.math.BigDecimal;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 常用系统/网站对象 common_web
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-08-30
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class CommonWebDO extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("常用功能id")
|
||||
private Long commonWebId;
|
||||
|
||||
@ApiModelProperty("一级组织表ID")
|
||||
@Excel(name = "一级组织表ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("组织表ID")
|
||||
@Excel(name = "组织表ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("组织名称")
|
||||
@Excel(name = "组织名称")
|
||||
private String organizationName;
|
||||
|
||||
@ApiModelProperty("用户ID")
|
||||
@Excel(name = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty("网站名称")
|
||||
@Excel(name = "网站名称", readConverterExp = "网站名称")
|
||||
private String webName;
|
||||
|
||||
@ApiModelProperty("网站图标")
|
||||
@Excel(name = "网站图标", readConverterExp = "网站图标")
|
||||
private String webIcon;
|
||||
|
||||
@ApiModelProperty("网站地址")
|
||||
@Excel(name = "网站地址", readConverterExp = "网站地址")
|
||||
private String webAddress;
|
||||
|
||||
@ApiModelProperty("排序")
|
||||
@Excel(name = "排序", readConverterExp = "排序")
|
||||
private Integer sort;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
@Excel(name = "备注", readConverterExp = "备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty(name = "组织ID集合")
|
||||
private List<Long> organizationIdList;
|
||||
|
||||
@ApiModelProperty(name = "权限菜单ID")
|
||||
private Long permissionMenuId;
|
||||
}
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
package com.linke.product.domain.commonWeb.service;
|
||||
|
||||
import com.linke.product.domain.commonWeb.repository.facade.ICommonWebService;
|
||||
import com.linke.product.domain.commonWeb.repository.po.CommonWebPO;
|
||||
import com.linke.product.domain.commonWeb.repository.todo.CommonWebDO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
/**
|
||||
* 常用系统/网站
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-08-30
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class CommonWebDomainService {
|
||||
|
||||
@Autowired
|
||||
private ICommonWebService commonWebService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询常用系统/网站列表
|
||||
*/
|
||||
public List<CommonWebPO> queryList(CommonWebDO commonWebDO) {
|
||||
return commonWebService.queryList(commonWebDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增常用系统/网站
|
||||
*/
|
||||
public Boolean insert(CommonWebDO commonWebDO) {
|
||||
|
||||
return commonWebService.insert(commonWebDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改常用系统/网站
|
||||
*/
|
||||
public Boolean update(CommonWebDO commonWebDO) {
|
||||
return commonWebService.update(commonWebDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除常用系统/网站
|
||||
*/
|
||||
public Boolean delete(Long[] commonWebIds) {
|
||||
return commonWebService.delete(commonWebIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取常用系统/网站详细信息
|
||||
*/
|
||||
public CommonWebPO getInfo(Long commonWebId)
|
||||
{
|
||||
return commonWebService.getInfo(commonWebId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.linke.product.domain.customAuth.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 自定义权限 实体
|
||||
*
|
||||
* 2022-12-10
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
@Data
|
||||
@TableName("custom_auth")
|
||||
public class CustomAuth extends BaseVOEntity implements Serializable
|
||||
{
|
||||
@ApiModelProperty(name = "自定义权限id")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long customAuthId;
|
||||
@ApiModelProperty(name = "菜单表ID")
|
||||
private Long menuId;
|
||||
@ApiModelProperty(name = "表格json")
|
||||
private String tableJson;
|
||||
@ApiModelProperty(name = "表单json")
|
||||
private String formJson;
|
||||
@ApiModelProperty(name = "按钮json")
|
||||
private String buttonJson;
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
package com.linke.product.domain.customAuth.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 组织自定义权限 实体
|
||||
*
|
||||
* 2022-12-10
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
@Data
|
||||
@TableName("custom_auth_organization")
|
||||
public class CustomAuthOrganization extends BaseVOEntity implements Serializable {
|
||||
|
||||
@ApiModelProperty(name = "组织自定义权限表id")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long customAuthOrganizationId;
|
||||
@ApiModelProperty(name = "组织id")
|
||||
private Long organizationId;
|
||||
@ApiModelProperty(name = "租户id")
|
||||
private Long tenantsId;
|
||||
@ApiModelProperty(name = "菜单id")
|
||||
private Long menuId;
|
||||
@ApiModelProperty(name = "表格json")
|
||||
private String tableJson;
|
||||
@ApiModelProperty(name = "表单json")
|
||||
private String formJson;
|
||||
@ApiModelProperty(name = "按钮json")
|
||||
private String buttonJson;
|
||||
}
|
||||
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
package com.linke.product.domain.customAuth.repository.facade;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.linke.product.domain.customAuth.entity.CustomAuthOrganization;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 组织自定义权限 业务层
|
||||
*
|
||||
* 2022-12-10
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
public interface CustomAuthOrganizationRepositoryInterface extends IService<CustomAuthOrganization> {
|
||||
|
||||
/**
|
||||
* 查询组织自定义权限
|
||||
*
|
||||
* @param customAuthOrganization 实体
|
||||
* @return 列表信息
|
||||
*/
|
||||
public CustomAuthOrganization selectCustomAuthByOrganization(CustomAuthOrganization customAuthOrganization);
|
||||
|
||||
/**
|
||||
* 查询组织自定义权限
|
||||
*
|
||||
* @param customAuthOrganization 实体
|
||||
* @return 列表信息
|
||||
*/
|
||||
public List<CustomAuthOrganization> selectCustomAuthByOrganizationId(CustomAuthOrganization customAuthOrganization);
|
||||
|
||||
/**
|
||||
* 查询租户自定义权限
|
||||
*
|
||||
* @param customAuthOrganization 实体
|
||||
* @return 列表信息
|
||||
*/
|
||||
public CustomAuthOrganization selectCustomAuthByTenants(CustomAuthOrganization customAuthOrganization);
|
||||
|
||||
/**
|
||||
* 修改组织自定义权限
|
||||
*
|
||||
* @param customAuthOrganization 组织自定义权限
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateCustomAuthOrganization(CustomAuthOrganization customAuthOrganization);
|
||||
|
||||
/**
|
||||
* 新增组织自定义权限
|
||||
*
|
||||
* @param customAuthOrganization 组织自定义权限
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertCustomAuthOrganization(CustomAuthOrganization customAuthOrganization);
|
||||
|
||||
/**
|
||||
* 批量删除组织自定义权限
|
||||
*
|
||||
* @param id 需要删除的数据主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCustomAuthOrganizationById(Long id);
|
||||
}
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
package com.linke.product.domain.customAuth.repository.facade;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.linke.product.domain.customAuth.entity.CustomAuth;
|
||||
|
||||
/**
|
||||
* 自定义 业务层
|
||||
*
|
||||
* 2022-12-10
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
public interface CustomAuthRepositoryInterface extends IService<CustomAuth>
|
||||
{
|
||||
/**
|
||||
* 查询自定义权限
|
||||
*
|
||||
* @param customAuthId 自定义权限主键
|
||||
* @return 自定义权限
|
||||
*/
|
||||
public CustomAuth selectCustomAuthByCustomAuthId(Long customAuthId);
|
||||
|
||||
/**
|
||||
* 查询自定义权限
|
||||
*
|
||||
* @param menuId 菜单id
|
||||
* @return 自定义权限
|
||||
*/
|
||||
public CustomAuth selectCustomAuthByCustomAuthMenuId(Long menuId);
|
||||
|
||||
/**
|
||||
* 查询自定义权限列表
|
||||
*
|
||||
* @param customAuth 自定义权限
|
||||
* @return 自定义权限集合
|
||||
*/
|
||||
public List<CustomAuth> selectCustomAuthList(CustomAuth customAuth);
|
||||
|
||||
/**
|
||||
* 新增自定义权限
|
||||
*
|
||||
* @param customAuth 自定义权限
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertCustomAuth(CustomAuth customAuth);
|
||||
|
||||
/**
|
||||
* 修改自定义权限
|
||||
*
|
||||
* @param customAuth 自定义权限
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateCustomAuth(CustomAuth customAuth);
|
||||
|
||||
/**
|
||||
* 根据菜单id修改自定义权限
|
||||
*
|
||||
* @param customAuth 自定义权限
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateCustomAuthByMenuId(CustomAuth customAuth);
|
||||
|
||||
/**
|
||||
* 批量删除自定义权限
|
||||
*
|
||||
* @param customAuthIds 需要删除的自定义权限主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCustomAuthByCustomAuthIds(Long[] customAuthIds);
|
||||
|
||||
/**
|
||||
* 删除自定义权限信息
|
||||
*
|
||||
* @param customAuthId 自定义权限主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCustomAuthByCustomAuthId(Long customAuthId);
|
||||
}
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
package com.linke.product.domain.customAuth.repository.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.linke.product.domain.customAuth.entity.CustomAuth;
|
||||
|
||||
/**
|
||||
* 自定义权限 数据层
|
||||
*
|
||||
* 2022-12-10
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
public interface CustomAuthMapper extends BaseMapper<CustomAuth>
|
||||
{
|
||||
/**
|
||||
* 查询自定义权限
|
||||
*
|
||||
* @param customAuthId 自定义权限主键
|
||||
* @return 自定义权限
|
||||
*/
|
||||
public CustomAuth selectCustomAuthByCustomAuthId(Long customAuthId);
|
||||
|
||||
/**
|
||||
* 查询自定义权限
|
||||
*
|
||||
* @param menuId 菜单id
|
||||
* @return 自定义权限
|
||||
*/
|
||||
public CustomAuth selectCustomAuthByCustomAuthMenuId(Long menuId);
|
||||
|
||||
/**
|
||||
* 查询自定义权限列表
|
||||
*
|
||||
* @param customAuth 自定义权限
|
||||
* @return 自定义权限集合
|
||||
*/
|
||||
public List<CustomAuth> selectCustomAuthList(CustomAuth customAuth);
|
||||
|
||||
/**
|
||||
* 新增自定义权限
|
||||
*
|
||||
* @param customAuth 自定义权限
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertCustomAuth(CustomAuth customAuth);
|
||||
|
||||
/**
|
||||
* 修改自定义权限
|
||||
*
|
||||
* @param customAuth 自定义权限
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateCustomAuth(CustomAuth customAuth);
|
||||
|
||||
/**
|
||||
* 根据菜单id修改自定义权限
|
||||
*
|
||||
* @param customAuth 自定义权限
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateCustomAuthByMenuId(CustomAuth customAuth);
|
||||
|
||||
/**
|
||||
* 删除自定义权限
|
||||
*
|
||||
* @param customAuthId 自定义权限主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCustomAuthByCustomAuthId(Long customAuthId);
|
||||
|
||||
/**
|
||||
* 批量删除自定义权限
|
||||
*
|
||||
* @param customAuthIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCustomAuthByCustomAuthIds(Long[] customAuthIds);
|
||||
}
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
package com.linke.product.domain.customAuth.repository.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.linke.product.domain.customAuth.entity.CustomAuthOrganization;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 组织自定义权限 数据层
|
||||
*
|
||||
* 2022-12-10
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
public interface CustomAuthOrganizationMapper extends BaseMapper<CustomAuthOrganization> {
|
||||
|
||||
/**
|
||||
* 查询组织自定义权限
|
||||
*
|
||||
* @param customAuthOrganization 实体
|
||||
* @return 列表信息
|
||||
*/
|
||||
public CustomAuthOrganization selectCustomAuthByOrganization(CustomAuthOrganization customAuthOrganization);
|
||||
|
||||
/**
|
||||
* 查询组织自定义权限
|
||||
*
|
||||
* @param customAuthOrganization 组织id
|
||||
* @return 列表信息
|
||||
*/
|
||||
public List<CustomAuthOrganization> selectCustomAuthByOrganizationId(CustomAuthOrganization customAuthOrganization);
|
||||
|
||||
/**
|
||||
* 查询租户自定义权限
|
||||
*
|
||||
* @param customAuthOrganization 实体
|
||||
* @return 列表信息
|
||||
*/
|
||||
public CustomAuthOrganization selectCustomAuthByTenants(CustomAuthOrganization customAuthOrganization);
|
||||
|
||||
/**
|
||||
* 修改组织自定义权限
|
||||
*
|
||||
* @param customAuthOrganization 组织自定义权限
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateCustomAuthOrganization(CustomAuthOrganization customAuthOrganization);
|
||||
|
||||
/**
|
||||
* 新增组织自定义权限
|
||||
*
|
||||
* @param customAuthOrganization 组织自定义权限
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertCustomAuthOrganization(CustomAuthOrganization customAuthOrganization);
|
||||
|
||||
/**
|
||||
* 批量删除组织自定义权限
|
||||
*
|
||||
* @param id 需要删除的数据主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCustomAuthOrganizationById(Long id);
|
||||
}
|
||||
+92
@@ -0,0 +1,92 @@
|
||||
package com.linke.product.domain.customAuth.repository.persistence;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.linke.product.domain.customAuth.entity.CustomAuthOrganization;
|
||||
import com.linke.product.domain.customAuth.repository.facade.CustomAuthOrganizationRepositoryInterface;
|
||||
import com.linke.product.domain.customAuth.repository.mapper.CustomAuthOrganizationMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 组织自定义权限 业务实现层
|
||||
*
|
||||
* 本层为核心业务层,不可掺杂其他业务
|
||||
*
|
||||
* 2022-12-10
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
@Service
|
||||
public class CustomAuthOrganizationRepositoryImpl extends ServiceImpl<CustomAuthOrganizationMapper,CustomAuthOrganization> implements CustomAuthOrganizationRepositoryInterface {
|
||||
|
||||
@Autowired
|
||||
private CustomAuthOrganizationMapper customAuthOrganizationMapper;
|
||||
|
||||
/**
|
||||
* 查询组织自定义权限
|
||||
*
|
||||
* @param customAuthOrganization 实体
|
||||
* @return 列表信息
|
||||
*/
|
||||
@Override
|
||||
public CustomAuthOrganization selectCustomAuthByOrganization(CustomAuthOrganization customAuthOrganization){
|
||||
return customAuthOrganizationMapper.selectCustomAuthByOrganization(customAuthOrganization);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询组织自定义权限
|
||||
*
|
||||
* @param customAuthOrganization 实体
|
||||
* @return 列表信息
|
||||
*/
|
||||
@Override
|
||||
public List<CustomAuthOrganization> selectCustomAuthByOrganizationId(CustomAuthOrganization customAuthOrganization){
|
||||
return customAuthOrganizationMapper.selectCustomAuthByOrganizationId(customAuthOrganization);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询租户自定义权限
|
||||
*
|
||||
* @param customAuthOrganization 实体
|
||||
* @return 列表信息
|
||||
*/
|
||||
@Override
|
||||
public CustomAuthOrganization selectCustomAuthByTenants(CustomAuthOrganization customAuthOrganization){
|
||||
return customAuthOrganizationMapper.selectCustomAuthByTenants(customAuthOrganization);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改组织自定义权限
|
||||
*
|
||||
* @param customAuthOrganization 组织自定义权限
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateCustomAuthOrganization(CustomAuthOrganization customAuthOrganization){
|
||||
return customAuthOrganizationMapper.updateById(customAuthOrganization);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增组织自定义权限
|
||||
*
|
||||
* @param customAuthOrganization 组织自定义权限
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertCustomAuthOrganization(CustomAuthOrganization customAuthOrganization){
|
||||
return customAuthOrganizationMapper.insert(customAuthOrganization);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除组织自定义权限
|
||||
*
|
||||
* @param id 需要删除的数据主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteCustomAuthOrganizationById(Long id){
|
||||
return customAuthOrganizationMapper.deleteCustomAuthOrganizationById(id);
|
||||
}
|
||||
}
|
||||
+127
@@ -0,0 +1,127 @@
|
||||
package com.linke.product.domain.customAuth.repository.persistence;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.linke.product.domain.customAuth.entity.CustomAuth;
|
||||
import com.linke.product.domain.customAuth.repository.facade.CustomAuthRepositoryInterface;
|
||||
import com.linke.product.domain.customAuth.repository.mapper.CustomAuthMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 自定义 业务实现层
|
||||
*
|
||||
* 本层为核心业务层,不可掺杂其他业务
|
||||
*
|
||||
* 2022-12-10
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
@Service
|
||||
public class CustomAuthRepositoryImpl extends ServiceImpl<CustomAuthMapper, CustomAuth> implements CustomAuthRepositoryInterface
|
||||
{
|
||||
@Autowired
|
||||
private CustomAuthMapper customAuthMapper;
|
||||
|
||||
/**
|
||||
* 查询自定义权限
|
||||
*
|
||||
* @param customAuthId 自定义权限主键
|
||||
* @return 自定义权限
|
||||
*/
|
||||
@Override
|
||||
public CustomAuth selectCustomAuthByCustomAuthId(Long customAuthId)
|
||||
{
|
||||
return customAuthMapper.selectCustomAuthByCustomAuthId(customAuthId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询自定义权限
|
||||
*
|
||||
* @param menuId 菜单id
|
||||
* @return 自定义权限
|
||||
*/
|
||||
@Override
|
||||
public CustomAuth selectCustomAuthByCustomAuthMenuId(Long menuId){
|
||||
return customAuthMapper.selectCustomAuthByCustomAuthMenuId(menuId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询自定义权限列表
|
||||
*
|
||||
* @param customAuth 自定义权限
|
||||
* @return 自定义权限
|
||||
*/
|
||||
@Override
|
||||
public List<CustomAuth> selectCustomAuthList(CustomAuth customAuth)
|
||||
{
|
||||
return customAuthMapper.selectCustomAuthList(customAuth);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增自定义权限
|
||||
*
|
||||
* @param customAuth 自定义权限
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertCustomAuth(CustomAuth customAuth)
|
||||
{
|
||||
return customAuthMapper.insert(customAuth);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改自定义权限
|
||||
*
|
||||
* @param customAuth 自定义权限
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateCustomAuth(CustomAuth customAuth)
|
||||
{
|
||||
return customAuthMapper.updateById(customAuth);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据菜单id修改自定义权限
|
||||
*
|
||||
* @param customAuth 自定义权限
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateCustomAuthByMenuId(CustomAuth customAuth){
|
||||
return customAuthMapper.updateCustomAuthByMenuId(customAuth);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除自定义权限
|
||||
*
|
||||
* @param customAuthIds 需要删除的自定义权限主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteCustomAuthByCustomAuthIds(Long[] customAuthIds)
|
||||
{
|
||||
return customAuthMapper.deleteCustomAuthByCustomAuthIds(customAuthIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除自定义权限信息
|
||||
*
|
||||
* @param customAuthId 自定义权限主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteCustomAuthByCustomAuthId(Long customAuthId)
|
||||
{
|
||||
return customAuthMapper.deleteCustomAuthByCustomAuthId(customAuthId);
|
||||
}
|
||||
|
||||
public List<CustomAuth> selectByMenuIds(List<Long> addIdList) {
|
||||
return customAuthMapper.selectList(new LambdaQueryWrapper<CustomAuth>()
|
||||
.eq(CustomAuth::getDelFlag, 1)
|
||||
.in(CustomAuth::getMenuId, addIdList));
|
||||
}
|
||||
}
|
||||
+126
@@ -0,0 +1,126 @@
|
||||
package com.linke.product.domain.customAuth.service;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.linke.product.domain.customAuth.entity.CustomAuth;
|
||||
import com.linke.product.domain.customAuth.repository.persistence.CustomAuthRepositoryImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 自定义权限 防腐层
|
||||
*
|
||||
* 本层为防腐层,业务逻辑可在本层完成
|
||||
*
|
||||
* 2022-12-10
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
@Service
|
||||
public class CustomAuthDomainService
|
||||
{
|
||||
@Autowired
|
||||
private CustomAuthRepositoryImpl customAuthRepositoryImpl;
|
||||
|
||||
/**
|
||||
* 查询自定义权限
|
||||
*
|
||||
* @param customAuthId 自定义权限主键
|
||||
* @return 自定义权限
|
||||
*/
|
||||
public CustomAuth selectCustomAuthByCustomAuthId(Long customAuthId)
|
||||
{
|
||||
return customAuthRepositoryImpl.selectCustomAuthByCustomAuthId(customAuthId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询自定义权限
|
||||
*
|
||||
* @param menuId 菜单id
|
||||
* @return 自定义权限
|
||||
*/
|
||||
public CustomAuth selectCustomAuthByCustomAuthMenuId(Long menuId){
|
||||
return customAuthRepositoryImpl.selectCustomAuthByCustomAuthMenuId(menuId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询自定义权限列表
|
||||
*
|
||||
* @param customAuth 自定义权限
|
||||
* @return 自定义权限
|
||||
*/
|
||||
public List<CustomAuth> selectCustomAuthList(CustomAuth customAuth)
|
||||
{
|
||||
return customAuthRepositoryImpl.selectCustomAuthList(customAuth);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增自定义权限
|
||||
*
|
||||
* @param customAuth 自定义权限
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertCustomAuth(CustomAuth customAuth)
|
||||
{
|
||||
CustomAuth customAuth1=customAuthRepositoryImpl.selectCustomAuthByCustomAuthMenuId(customAuth.getMenuId());
|
||||
if(ObjectUtil.isNotNull(customAuth1)){
|
||||
customAuth1.setDelFlag(2);
|
||||
updateCustomAuth(customAuth1);
|
||||
}
|
||||
return customAuthRepositoryImpl.insertCustomAuth(customAuth);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改自定义权限
|
||||
*
|
||||
* @param customAuth 自定义权限
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateCustomAuth(CustomAuth customAuth)
|
||||
{
|
||||
return customAuthRepositoryImpl.updateCustomAuth(customAuth);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据菜单id修改自定义权限
|
||||
*
|
||||
* @param customAuth 自定义权限
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateCustomAuthByMenuId(CustomAuth customAuth){
|
||||
return customAuthRepositoryImpl.updateCustomAuthByMenuId(customAuth);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除自定义权限
|
||||
*
|
||||
* @param customAuthIds 需要删除的自定义权限主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCustomAuthByCustomAuthIds(Long[] customAuthIds)
|
||||
{
|
||||
return customAuthRepositoryImpl.deleteCustomAuthByCustomAuthIds(customAuthIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除自定义权限信息
|
||||
*
|
||||
* @param customAuthId 自定义权限主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCustomAuthByCustomAuthId(Long customAuthId)
|
||||
{
|
||||
return customAuthRepositoryImpl.deleteCustomAuthByCustomAuthId(customAuthId);
|
||||
}
|
||||
|
||||
public List<CustomAuth> selectByMenuIds(List<Long> addIdList) {
|
||||
return customAuthRepositoryImpl.selectByMenuIds(addIdList);
|
||||
}
|
||||
|
||||
public void saveBatchList(List<CustomAuth> customAuthList) {
|
||||
customAuthRepositoryImpl.saveBatch(customAuthList);
|
||||
}
|
||||
}
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
package com.linke.product.domain.customAuth.service;
|
||||
|
||||
import com.linke.product.domain.customAuth.entity.CustomAuthOrganization;
|
||||
import com.linke.product.domain.customAuth.repository.persistence.CustomAuthOrganizationRepositoryImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 组织自定义权限 业务实现层
|
||||
*
|
||||
* 本层为核心业务层,不可掺杂其他业务
|
||||
*
|
||||
* 2022-12-10
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
@Service
|
||||
public class CustomAuthOrganizationDomainService {
|
||||
|
||||
@Autowired
|
||||
private CustomAuthOrganizationRepositoryImpl customAuthOrganizationRepositoryImpl;
|
||||
|
||||
/**
|
||||
* 查询组织自定义权限
|
||||
*
|
||||
* @param customAuthOrganization 实体
|
||||
* @return 列表信息
|
||||
*/
|
||||
public CustomAuthOrganization selectCustomAuthByOrganization(CustomAuthOrganization customAuthOrganization){
|
||||
return customAuthOrganizationRepositoryImpl.selectCustomAuthByOrganization(customAuthOrganization);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询组织自定义权限
|
||||
*
|
||||
* @param customAuthOrganization 实体
|
||||
* @return 列表信息
|
||||
*/
|
||||
public List<CustomAuthOrganization> selectCustomAuthByOrganizationId(CustomAuthOrganization customAuthOrganization){
|
||||
return customAuthOrganizationRepositoryImpl.selectCustomAuthByOrganizationId(customAuthOrganization);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询租户自定义权限
|
||||
*
|
||||
* @param customAuthOrganization 实体
|
||||
* @return 列表信息
|
||||
*/
|
||||
public CustomAuthOrganization selectCustomAuthByTenants(CustomAuthOrganization customAuthOrganization){
|
||||
return customAuthOrganizationRepositoryImpl.selectCustomAuthByTenants(customAuthOrganization);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改组织自定义权限
|
||||
*
|
||||
* @param customAuthOrganization 组织自定义权限
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateCustomAuthOrganization(CustomAuthOrganization customAuthOrganization){
|
||||
return customAuthOrganizationRepositoryImpl.updateCustomAuthOrganization(customAuthOrganization);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增组织自定义权限
|
||||
*
|
||||
* @param customAuthOrganization 组织自定义权限
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertCustomAuthOrganization(CustomAuthOrganization customAuthOrganization){
|
||||
return customAuthOrganizationRepositoryImpl.insertCustomAuthOrganization(customAuthOrganization);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除组织自定义权限
|
||||
*
|
||||
* @param id 需要删除的数据主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCustomAuthOrganizationById(Long id){
|
||||
return customAuthOrganizationRepositoryImpl.deleteCustomAuthOrganizationById(id);
|
||||
}
|
||||
|
||||
public void saveBatch(List<CustomAuthOrganization> customAuthOrganizationList) {
|
||||
customAuthOrganizationRepositoryImpl.saveBatch(customAuthOrganizationList);
|
||||
}
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package com.linke.product.domain.elasticJob.repository.facade;
|
||||
|
||||
import com.mhd.common.core.domain.ElasticJob;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 分布式调度任务 业务层
|
||||
*
|
||||
* 2023-05-10
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
public interface ElasticJobRepositoryInterface {
|
||||
|
||||
/**
|
||||
* 查询定时任务集合
|
||||
*
|
||||
* @param applicationName 项目名
|
||||
* @return 项目列表信息
|
||||
*/
|
||||
public List<ElasticJob> selectList(String applicationName);
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package com.linke.product.domain.elasticJob.repository.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mhd.common.core.domain.ElasticJob;
|
||||
|
||||
/**
|
||||
* 分布式调度任务 数据层
|
||||
*
|
||||
* 2023-05-10
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
public interface ElasticJobMapper extends BaseMapper<ElasticJob> {
|
||||
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
package com.linke.product.domain.elasticJob.repository.persistence;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.linke.product.domain.elasticJob.repository.facade.ElasticJobRepositoryInterface;
|
||||
import com.linke.product.domain.elasticJob.repository.mapper.ElasticJobMapper;
|
||||
import com.mhd.common.core.domain.ElasticJob;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 分布式调度任务 业务实现层
|
||||
*
|
||||
* 本层为核心业务层,不可掺杂其他业务
|
||||
*
|
||||
* 2023-05-10
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
@Service
|
||||
public class ElasticJobRepositoryImpl implements ElasticJobRepositoryInterface {
|
||||
|
||||
@Autowired
|
||||
private ElasticJobMapper easticJobMapper;
|
||||
|
||||
/**
|
||||
* 查询定时任务集合
|
||||
*
|
||||
* @param applicationName 项目名
|
||||
* @return 项目列表信息
|
||||
*/
|
||||
@Override
|
||||
public List<ElasticJob> selectList(String applicationName){
|
||||
QueryWrapper<ElasticJob> elasticJobQueryWrapper = new QueryWrapper<ElasticJob>();
|
||||
elasticJobQueryWrapper.eq("application_name",applicationName);
|
||||
return easticJobMapper.selectList(elasticJobQueryWrapper);
|
||||
}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
package com.linke.product.domain.elasticJob.service;
|
||||
|
||||
import com.linke.product.domain.elasticJob.repository.persistence.ElasticJobRepositoryImpl;
|
||||
import com.mhd.common.core.domain.ElasticJob;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 分布式调度任务 防腐层
|
||||
*
|
||||
* 本层为防腐层,业务逻辑可在本层完成
|
||||
*
|
||||
* 2023-05-10
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
@Service
|
||||
public class ElasticJobDomainService {
|
||||
|
||||
@Autowired
|
||||
private ElasticJobRepositoryImpl elasticJobRepositoryImpl;
|
||||
|
||||
/**
|
||||
* 查询定时任务集合
|
||||
*
|
||||
* @param applicationName 项目名
|
||||
* @return 项目列表信息
|
||||
*/
|
||||
public List<ElasticJob> selectList(String applicationName){
|
||||
return elasticJobRepositoryImpl.selectList(applicationName);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.linke.product.domain.menu.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import com.mhd.common.core.annotation.fieldsetvalue.NeedSetValue;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 菜单 实体
|
||||
*
|
||||
* 2022-11-18
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
@Data
|
||||
@TableName("sys_menu")
|
||||
public class Menu extends BaseVOEntity implements Serializable {
|
||||
|
||||
@ApiModelProperty(name = "菜单id")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long menuId;
|
||||
@ApiModelProperty(name = "父菜单表ID")
|
||||
private Long parentMenuId;
|
||||
@ApiModelProperty(name = "模块表ID")
|
||||
private Long modulesId;
|
||||
@ApiModelProperty(name = "产品表ID")
|
||||
private Long productId;
|
||||
@ApiModelProperty(name = "客户端:0-无状态,1-PC端,2-手机端")
|
||||
private Integer menuClient;
|
||||
@ApiModelProperty(name = "菜单类型:默认0-无状态,1-目录,2-菜单,3-按钮,4-字段")
|
||||
private Integer menuType;
|
||||
@ApiModelProperty(name = "菜单名称")
|
||||
private String menuName;
|
||||
@ApiModelProperty(name = "显示名称")
|
||||
private String menuShowName;
|
||||
@ApiModelProperty(name = "微服务路由")
|
||||
private String microServicePath;
|
||||
@ApiModelProperty(name = "菜单路径路由(访问的路由地址,如:`user`,如外网地址需内链访问则以`http(s)://`开头)")
|
||||
private String menuPath;
|
||||
@ApiModelProperty(name = "前端组件(访问的组件路径,如:`system/user/index`,默认在`views`目录下)")
|
||||
private String menuComponent;
|
||||
@ApiModelProperty(name = "默认跳转地址(访问的路由地址,如:`user`,如外网地址需内链访问则以`http(s)://`开头)")
|
||||
private String menuRedirectPath;
|
||||
@ApiModelProperty(name = "菜单图标")
|
||||
private String menuIcon;
|
||||
@ApiModelProperty(name = "菜单排序")
|
||||
private Integer menuSort;
|
||||
@NeedSetValue
|
||||
@ApiModelProperty(name = "菜单图片")
|
||||
private String menuAvatar;
|
||||
@ApiModelProperty(name = "app位置数据字典code")
|
||||
private String appLocationCode;
|
||||
@ApiModelProperty(name = "app位置数据字典名称")
|
||||
private String appLocationName;
|
||||
@ApiModelProperty(name = "是否路由菜单:0-无状态,1-是,2-否")
|
||||
private String menuHidden;
|
||||
@ApiModelProperty(name = "是否隐藏路由:0-无状态,1-显示,2-隐藏")
|
||||
private Integer menuVisible;
|
||||
@ApiModelProperty(name = "是否缓存:0-无状态,1-缓存,2-不缓存")
|
||||
private Integer menuCacheStatus;
|
||||
@ApiModelProperty(name = "是否聚合路由:0-无状态,1-是,2-否")
|
||||
private Integer menuAlwaysShow;
|
||||
@ApiModelProperty(name = "打开方式:0-无状态,1-内部,2-外部")
|
||||
private Integer menuInternalOrExternal;
|
||||
@ApiModelProperty(name = "菜单描述")
|
||||
private String menuRemark;
|
||||
@ApiModelProperty(name = "权限标识(按钮控制权限标识)")
|
||||
private String menuPerms;
|
||||
@ApiModelProperty(name = "级联字符")
|
||||
private String menuLinkage;
|
||||
@ApiModelProperty(name = "是否隐藏菜单:0-无状态,1-显示,2-隐藏")
|
||||
private Integer menuShow;
|
||||
@ApiModelProperty(name = "菜单id")
|
||||
private Long sourceId;
|
||||
@ApiModelProperty(name = "一级组织id")
|
||||
private Long topOrganizationId;
|
||||
@ApiModelProperty(name = "首页展示标记(1-是,2-否)")
|
||||
private Integer homeShowFlag;
|
||||
}
|
||||
|
||||
+153
@@ -0,0 +1,153 @@
|
||||
package com.linke.product.domain.menu.repository.facade;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.linke.product.domain.menu.entity.Menu;
|
||||
import com.linke.product.domain.menu.repository.po.MenuPo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 菜单 业务层
|
||||
*
|
||||
* 2022-11-18
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
public interface MenuRepositoryInterface extends IService<Menu> {
|
||||
|
||||
/**
|
||||
* 查询菜单集合
|
||||
*
|
||||
* @param menuPo 订单
|
||||
* @return 订单列表信息
|
||||
*/
|
||||
public List<MenuPo> selectMenuList(MenuPo menuPo);
|
||||
|
||||
public List<MenuPo> queryButtonlistById(MenuPo menuPo);
|
||||
|
||||
/**
|
||||
* 查询菜单树集合
|
||||
*
|
||||
* @return 订单列表信息
|
||||
*/
|
||||
public List<MenuPo> selectMenuTreeList(Menu menu);
|
||||
|
||||
/**
|
||||
* 查询菜单前端组件集合
|
||||
*
|
||||
* @return 组件信息
|
||||
*/
|
||||
public List<Map<String,String>> selectMenuComponent();
|
||||
|
||||
/**
|
||||
* 根据租户id查询菜单集合(分配的产品)
|
||||
*
|
||||
* @param tenantsId 租户id
|
||||
* @return 订单列表信息
|
||||
*/
|
||||
public List<MenuPo> selectMenuIdListByTenantsId(Long tenantsId, Integer menuShow);
|
||||
|
||||
/**
|
||||
* 根据租户id查询菜单集合(分配的菜单)
|
||||
*
|
||||
* @param tenantsId 租户id
|
||||
* @return 订单列表信息
|
||||
*/
|
||||
public List<MenuPo> selectMenuIdListByTenantsIdTwo(Long tenantsId);
|
||||
|
||||
/**
|
||||
* 根据组织id查询菜单集合
|
||||
*
|
||||
* @param organizationId 租户id
|
||||
* @return 订单列表信息
|
||||
*/
|
||||
public List<MenuPo> selectMenuIdListByOrganizationId(Long organizationId);
|
||||
|
||||
/**
|
||||
* 根据id查询菜单信息
|
||||
*
|
||||
* @param id 菜单id
|
||||
* @return 菜单信息
|
||||
*/
|
||||
public MenuPo selectMenuById(Long id);
|
||||
|
||||
/**
|
||||
* @description 根据菜单id集合查询菜单信息
|
||||
* @author ZhouGY
|
||||
* @date 2023/10/8 15:25
|
||||
* @param menuIds
|
||||
* @return List<MenuPo>
|
||||
*/
|
||||
public List<MenuPo> selectMenuListByIds(List<Long> menuIds);
|
||||
|
||||
/**
|
||||
* 新增菜单
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertMenu(Menu menu);
|
||||
|
||||
/**
|
||||
* 修改菜单信息
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateMenu(Menu menu);
|
||||
|
||||
/**
|
||||
* 删除菜单
|
||||
*
|
||||
* @param id 菜单ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMenuById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除菜单
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMenuByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*
|
||||
* @param list id集合
|
||||
* @return 结果
|
||||
*/
|
||||
public List<Long> selectModulesByMenuId(List<Long> list);
|
||||
|
||||
/**
|
||||
* 查询可用菜单
|
||||
*
|
||||
* @param list id集合
|
||||
* @return 结果
|
||||
*/
|
||||
public List<Long> selectUseMenuId(List<Long> list);
|
||||
|
||||
/**
|
||||
* 查询上级菜单
|
||||
*
|
||||
* @param list id集合
|
||||
* @return 结果
|
||||
*/
|
||||
public List<Long> selectParentMenuId(List<Long> list);
|
||||
|
||||
/**
|
||||
* 查询全部菜单
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public List<Long> selectAllMenuId(Long topOrganizationId);
|
||||
|
||||
/**
|
||||
* 根据一级组织查询所有的菜单列表
|
||||
* @param menuPo
|
||||
* @return
|
||||
*/
|
||||
public List<Menu> selectListByOrganizationId(MenuPo menuPo);
|
||||
}
|
||||
+157
@@ -0,0 +1,157 @@
|
||||
package com.linke.product.domain.menu.repository.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.linke.product.domain.customAuth.entity.CustomAuth;
|
||||
import com.linke.product.domain.menu.entity.Menu;
|
||||
import com.linke.product.domain.menu.repository.po.MenuPo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 菜单 数据层
|
||||
*
|
||||
* 2022-11-18
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
public interface MenuMapper extends BaseMapper<Menu> {
|
||||
|
||||
/**
|
||||
* 查询菜单集合
|
||||
*
|
||||
* @param menuPo 订单
|
||||
* @return 订单列表信息
|
||||
*/
|
||||
public List<MenuPo> selectMenuList(MenuPo menuPo);
|
||||
|
||||
public List<MenuPo> queryButtonlistById(MenuPo menuPo);
|
||||
|
||||
/**
|
||||
* 查询菜单树集合
|
||||
*
|
||||
* @return 订单列表信息
|
||||
*/
|
||||
public List<MenuPo> selectMenuTreeList(Menu menu);
|
||||
|
||||
/**
|
||||
* 查询菜单前端组件集合
|
||||
*
|
||||
* @return 组件信息
|
||||
*/
|
||||
public List<Map<String,String>> selectMenuComponent();
|
||||
|
||||
/**
|
||||
* 根据租户id查询菜单集合(分配的产品)
|
||||
*
|
||||
* @param tenantsId 租户id
|
||||
* @return 订单列表信息
|
||||
*/
|
||||
public List<MenuPo> selectMenuIdListByTenantsId(@Param("tenantsId") Long tenantsId,@Param("menuShow") Integer menuShow);
|
||||
|
||||
/**
|
||||
* 根据租户id查询菜单集合(分配的菜单)
|
||||
*
|
||||
* @param tenantsId 租户id
|
||||
* @return 订单列表信息
|
||||
*/
|
||||
public List<MenuPo> selectMenuIdListByTenantsIdTwo(Long tenantsId);
|
||||
|
||||
/**
|
||||
* 根据组织id查询菜单集合
|
||||
*
|
||||
* @param organizationId 租户id
|
||||
* @return 订单列表信息
|
||||
*/
|
||||
public List<MenuPo> selectMenuIdListByOrganizationId(Long organizationId);
|
||||
|
||||
/**
|
||||
* 根据id查询菜单信息
|
||||
*
|
||||
* @param id 菜单id
|
||||
* @return 菜单信息
|
||||
*/
|
||||
public MenuPo selectMenuById(Long id);
|
||||
|
||||
/**
|
||||
* @description 根据菜单id集合查询菜单信息
|
||||
* @author ZhouGY
|
||||
* @date 2023/10/8 15:25
|
||||
* @param menuIds
|
||||
* @return List<MenuPo>
|
||||
*/
|
||||
public List<MenuPo> selectMenuListByIds(@Param("menuIds") List<Long> menuIds);
|
||||
|
||||
/**
|
||||
* 新增菜单
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertMenu(Menu menu);
|
||||
|
||||
/**
|
||||
* 修改菜单信息
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateMenu(Menu menu);
|
||||
|
||||
/**
|
||||
* 删除菜单
|
||||
*
|
||||
* @param id 菜单ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMenuById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除菜单
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMenuByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*
|
||||
* @param list id集合
|
||||
* @return 结果
|
||||
*/
|
||||
public List<Long> selectModulesByMenuId(List<Long> list);
|
||||
|
||||
/**
|
||||
* 查询可用菜单
|
||||
*
|
||||
* @param list id集合
|
||||
* @return 结果
|
||||
*/
|
||||
public List<Long> selectUseMenuId(List<Long> list);
|
||||
|
||||
/**
|
||||
* 查询上级菜单
|
||||
*
|
||||
* @param list id集合
|
||||
* @return 结果
|
||||
*/
|
||||
public List<Long> selectParentMenuId(List<Long> list);
|
||||
|
||||
/**
|
||||
* 查询全部菜单
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public List<Long> selectAllMenuId(@Param("topOrganizationId") Long topOrganizationId);
|
||||
|
||||
List<Long> getMenuIdByTenantsId(@Param("tenantsId") Long tenantsId, @Param("menuShow") Integer menuShow);
|
||||
List<Menu> getMenuByTenantsId(@Param("tenantsId") Long tenantsId, @Param("menuShow") Integer menuShow);
|
||||
|
||||
List<Menu> selectListByProductIdList(@Param("list") List<Long> list);
|
||||
|
||||
@Select("SELECT * FROM `custom_auth` WHERE menu_id in (SELECT menu_id FROM sys_menu WHERE top_organization_id = #{organizationId})")
|
||||
List<CustomAuth> getCustomAuthByOrganizationId(@Param("organizationId") Long organizationId);
|
||||
}
|
||||
+297
@@ -0,0 +1,297 @@
|
||||
package com.linke.product.domain.menu.repository.persistence;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.linke.product.domain.customAuth.entity.CustomAuth;
|
||||
import com.linke.product.domain.menu.entity.Menu;
|
||||
import com.linke.product.domain.menu.repository.facade.MenuRepositoryInterface;
|
||||
import com.linke.product.domain.menu.repository.mapper.MenuMapper;
|
||||
import com.linke.product.domain.menu.repository.po.MenuPo;
|
||||
import com.mhd.common.core.domain.dto.RoleMenuDTO;
|
||||
import com.mhd.common.core.domain.po.UserPo;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 菜单 业务实现层
|
||||
*
|
||||
* 本层为核心业务层,不可掺杂其他业务
|
||||
*
|
||||
* 2022-11-18
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
@Service
|
||||
public class MenuRepositoryImpl extends ServiceImpl<MenuMapper,Menu> implements MenuRepositoryInterface {
|
||||
|
||||
@Autowired
|
||||
private MenuMapper menuMapper;
|
||||
|
||||
/**
|
||||
* 查询菜单集合
|
||||
*
|
||||
* @param menuPo 订单
|
||||
* @return 订单列表信息
|
||||
*/
|
||||
@Override
|
||||
public List<MenuPo> selectMenuList(MenuPo menuPo){
|
||||
return menuMapper.selectMenuList(menuPo);
|
||||
}
|
||||
@Override
|
||||
public List<MenuPo> queryButtonlistById(MenuPo menuPo){
|
||||
return menuMapper.queryButtonlistById(menuPo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询菜单树集合
|
||||
*
|
||||
* @return 订单列表信息
|
||||
*/
|
||||
@Override
|
||||
public List<MenuPo> selectMenuTreeList(Menu menu){
|
||||
return menuMapper.selectMenuTreeList(menu);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询菜单前端组件集合
|
||||
*
|
||||
* @return 组件信息
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String,String>> selectMenuComponent(){
|
||||
return menuMapper.selectMenuComponent();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据租户id查询菜单集合(分配的产品)
|
||||
*
|
||||
* @param tenantsId 租户id
|
||||
* @return 订单列表信息
|
||||
*/
|
||||
@Override
|
||||
public List<MenuPo> selectMenuIdListByTenantsId(Long tenantsId, Integer menuShow){
|
||||
return menuMapper.selectMenuIdListByTenantsId(tenantsId, menuShow);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据租户id查询菜单集合(分配的菜单)
|
||||
*
|
||||
* @param tenantsId 租户id
|
||||
* @return 订单列表信息
|
||||
*/
|
||||
@Override
|
||||
public List<MenuPo> selectMenuIdListByTenantsIdTwo(Long tenantsId){
|
||||
return menuMapper.selectMenuIdListByTenantsIdTwo(tenantsId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据组织id查询菜单集合
|
||||
*
|
||||
* @param organizationId 租户id
|
||||
* @return 订单列表信息
|
||||
*/
|
||||
@Override
|
||||
public List<MenuPo> selectMenuIdListByOrganizationId(Long organizationId){
|
||||
return menuMapper.selectMenuIdListByOrganizationId(organizationId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询菜单信息
|
||||
*
|
||||
* @param id 菜单id
|
||||
* @return 菜单信息
|
||||
*/
|
||||
@Override
|
||||
public MenuPo selectMenuById(Long id){
|
||||
return menuMapper.selectMenuById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 根据菜单id集合查询菜单信息
|
||||
* @author ZhouGY
|
||||
* @date 2023/10/8 15:25
|
||||
* @param menuIds
|
||||
* @return List<MenuPo>
|
||||
*/
|
||||
@Override
|
||||
public List<MenuPo> selectMenuListByIds(List<Long> menuIds){
|
||||
return menuMapper.selectMenuListByIds(menuIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增菜单
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertMenu(Menu menu){
|
||||
return menuMapper.insert(menu);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改菜单信息
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateMenu(Menu menu){
|
||||
return menuMapper.updateById(menu);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除菜单
|
||||
*
|
||||
* @param id 菜单ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteMenuById(Long id){
|
||||
return menuMapper.deleteMenuById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除菜单
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteMenuByIds(Long[] ids){
|
||||
return menuMapper.deleteMenuByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*
|
||||
* @param list id集合
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public List<Long> selectModulesByMenuId(List<Long> list){
|
||||
return menuMapper.selectModulesByMenuId(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询可用菜单
|
||||
*
|
||||
* @param list id集合
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public List<Long> selectUseMenuId(List<Long> list){
|
||||
return menuMapper.selectUseMenuId(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询上级菜单
|
||||
*
|
||||
* @param list id集合
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public List<Long> selectParentMenuId(List<Long> list){
|
||||
return menuMapper.selectParentMenuId(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询全部菜单
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public List<Long> selectAllMenuId(Long topOrganizationId){
|
||||
return menuMapper.selectAllMenuId(topOrganizationId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Menu> selectListByOrganizationId(MenuPo menuPo) {
|
||||
QueryWrapper<Menu> qw = new QueryWrapper<>();
|
||||
if (menuPo.getTopOrganizationId() != null){
|
||||
qw.eq("top_organization_id",menuPo.getTopOrganizationId());
|
||||
}
|
||||
if (menuPo.getDelFlag() != null){
|
||||
qw.eq("del_flag",menuPo.getDelFlag());
|
||||
}
|
||||
if (menuPo.getMenuShow() != null){
|
||||
qw.eq("menu_show",menuPo.getMenuShow());
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(menuPo.getMenuIdList())){
|
||||
qw.in("menu_id",menuPo.getMenuIdList());
|
||||
}
|
||||
if (menuPo.getMenuClient() != null){
|
||||
qw.eq("menu_client",menuPo.getMenuClient());
|
||||
}
|
||||
qw.ne("menu_type",3);
|
||||
return menuMapper.selectList(qw);
|
||||
}
|
||||
|
||||
public List<Menu> selectListByProductIdList(List<Long> productIdList) {
|
||||
return menuMapper.selectListByProductIdList(productIdList);
|
||||
}
|
||||
|
||||
public void deleteByOrganizationId(Long organizationId) {
|
||||
menuMapper.update(null,new LambdaUpdateWrapper<Menu>().set(Menu::getDelFlag, 2)
|
||||
.eq(Menu::getTopOrganizationId,organizationId)
|
||||
.eq(Menu::getMenuClient, 1));
|
||||
}
|
||||
|
||||
public List<CustomAuth> getCustomAuthByOrganizationId(Long organizationId) {
|
||||
return menuMapper.getCustomAuthByOrganizationId(organizationId);
|
||||
}
|
||||
|
||||
public List<MenuPo> getMenuBySourceId(RoleMenuDTO roleMenuDTO) {
|
||||
QueryWrapper<Menu> qw = new QueryWrapper<>();
|
||||
qw.eq("top_organization_id",roleMenuDTO.getOrganizationId());
|
||||
qw.in("source_id",roleMenuDTO.getSourceIdList());
|
||||
List<Menu> menus = menuMapper.selectList(qw);
|
||||
List<MenuPo> list = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(menus)){
|
||||
for (Menu menu : menus) {
|
||||
MenuPo menuPo = new MenuPo();
|
||||
BeanUtils.copyProperties(menu,menuPo);
|
||||
list.add(menuPo);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<MenuPo> getMenuByLogin() {
|
||||
//获取当前登陆人
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
UserPo userPo = loginUser.getUserPo();
|
||||
List<MenuPo> list = new ArrayList<>();
|
||||
if (userPo != null){
|
||||
List<Menu> menus = menuMapper.selectList(new LambdaQueryWrapper<Menu>()
|
||||
.eq(Menu::getTopOrganizationId, userPo.getTopOrganizationId())
|
||||
.isNotNull(Menu::getMenuRedirectPath)
|
||||
.eq(Menu::getDelFlag,1));
|
||||
if (CollectionUtil.isNotEmpty(menus)){
|
||||
for (Menu menu : menus) {
|
||||
MenuPo menuPo = new MenuPo();
|
||||
BeanUtils.copyProperties(menu,menuPo);
|
||||
list.add(menuPo);
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<Long> getMenuIdByTenantsId(Long tenantsId, Integer menuShow) {
|
||||
return menuMapper.getMenuIdByTenantsId(tenantsId, menuShow);
|
||||
}
|
||||
public List<Menu> getMenuByTenantsId(Long tenantsId, Integer menuShow) {
|
||||
return menuMapper.getMenuByTenantsId(tenantsId, menuShow);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
package com.linke.product.domain.menu.repository.po;
|
||||
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 菜单 数据库po
|
||||
*
|
||||
* 2022-11-18
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
@Data
|
||||
public class MenuPo extends BaseVOEntity implements Serializable {
|
||||
|
||||
@ApiModelProperty(name = "菜单id")
|
||||
private Long menuId;
|
||||
@ApiModelProperty(name = "菜单id集合")
|
||||
private List<Long> menuIdList;
|
||||
@ApiModelProperty(name = "父菜单表ID")
|
||||
private Long parentMenuId;
|
||||
@ApiModelProperty(name = "模块表ID")
|
||||
private Long modulesId;
|
||||
@ApiModelProperty(name = "模块名称")
|
||||
private String modulesName;
|
||||
@ApiModelProperty(name = "产品表ID")
|
||||
private Long productId;
|
||||
@ApiModelProperty(name = "客户端:0-无状态,1-PC端,2-手机端")
|
||||
private Integer menuClient;
|
||||
@ApiModelProperty(name = "菜单类型:默认0-无状态,1-目录,2-菜单,3-按钮,4-字段")
|
||||
private Integer menuType;
|
||||
@ApiModelProperty(name = "菜单名称")
|
||||
private String menuName;
|
||||
@ApiModelProperty(name = "显示名称")
|
||||
private String menuShowName;
|
||||
@ApiModelProperty(name = "微服务路由")
|
||||
private String microServicePath;
|
||||
@ApiModelProperty(name = "菜单路径路由(访问的路由地址,如:`user`,如外网地址需内链访问则以`http(s)://`开头)")
|
||||
private String menuPath;
|
||||
@ApiModelProperty(name = "前端组件(访问的组件路径,如:`system/user/index`,默认在`views`目录下)")
|
||||
private String menuComponent;
|
||||
@ApiModelProperty(name = "默认跳转地址(访问的路由地址,如:`user`,如外网地址需内链访问则以`http(s)://`开头)")
|
||||
private String menuRedirectPath;
|
||||
@ApiModelProperty(name = "菜单图标")
|
||||
private String menuIcon;
|
||||
@ApiModelProperty(name = "菜单排序")
|
||||
private Integer menuSort;
|
||||
@ApiModelProperty(name = "菜单图片")
|
||||
private String menuAvatar;
|
||||
@ApiModelProperty(name = "app位置数据字典code")
|
||||
private String appLocationCode;
|
||||
@ApiModelProperty(name = "app位置数据字典名称")
|
||||
private String appLocationName;
|
||||
@ApiModelProperty(name = "是否路由菜单:0-无状态,1-是,2-否")
|
||||
private String menuHidden;
|
||||
@ApiModelProperty(name = "是否隐藏路由:0-无状态,1-显示,2-隐藏")
|
||||
private Integer menuVisible;
|
||||
@ApiModelProperty(name = "是否缓存:0-无状态,1-缓存,2-不缓存")
|
||||
private Integer menuCacheStatus;
|
||||
@ApiModelProperty(name = "是否聚合路由:0-无状态,1-是,2-否")
|
||||
private Integer menuAlwaysShow;
|
||||
@ApiModelProperty(name = "打开方式:0-无状态,1-内部,2-外部")
|
||||
private Integer menuInternalOrExternal;
|
||||
@ApiModelProperty(name = "菜单描述")
|
||||
private String menuRemark;
|
||||
@ApiModelProperty(name = "权限标识(按钮控制权限标识)")
|
||||
private String menuPerms;
|
||||
@ApiModelProperty(name = "级联字符")
|
||||
private String menuLinkage;
|
||||
@ApiModelProperty(name = "是否隐藏菜单:0-无状态,1-显示,2-隐藏")
|
||||
private Integer menuShow;
|
||||
@ApiModelProperty(name = "菜单id")
|
||||
private Long sourceId;
|
||||
@ApiModelProperty(name = "一级组织ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty(name = "一级组织名称")
|
||||
private Long topOrganizationName;
|
||||
|
||||
@ApiModelProperty(name = "组织名称")
|
||||
private String organizationName;
|
||||
|
||||
@ApiModelProperty(name = "子集合")
|
||||
private List<MenuPo> childrenList;
|
||||
|
||||
@ApiModelProperty(name = "模块id集合")
|
||||
private List<Long> moduleIdList;
|
||||
@ApiModelProperty(name = "首页展示标记(1-是,2-否)")
|
||||
private Integer homeShowFlag;
|
||||
}
|
||||
|
||||
+824
@@ -0,0 +1,824 @@
|
||||
package com.linke.product.domain.menu.service;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.linke.product.domain.customAuth.entity.CustomAuth;
|
||||
import com.linke.product.domain.menu.entity.Menu;
|
||||
import com.linke.product.domain.menu.repository.persistence.MenuRepositoryImpl;
|
||||
import com.linke.product.domain.menu.repository.po.MenuPo;
|
||||
import com.mhd.common.core.domain.po.MenuVo;
|
||||
import com.linke.product.interfaces.facade.menu.vo.NavigationVo;
|
||||
import com.mhd.common.core.domain.dto.RoleMenuDTO;
|
||||
import com.mhd.common.core.domain.po.UserPo;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.UserError;
|
||||
import com.mhd.common.core.utils.bean.BeanUtils;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 菜单 防腐层
|
||||
*
|
||||
* 本层为防腐层,业务逻辑可在本层完成
|
||||
*
|
||||
* 2022-11-18
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
@Service
|
||||
public class MenuDomainService {
|
||||
|
||||
@Autowired
|
||||
private MenuRepositoryImpl menuRepositoryImpl;
|
||||
// @Autowired
|
||||
// private RedisService redisService;
|
||||
|
||||
/**
|
||||
* 查询菜单集合
|
||||
*
|
||||
* @param menuPo 订单
|
||||
* @return 订单列表信息
|
||||
*/
|
||||
public List<MenuPo> selectMenuList(MenuPo menuPo){
|
||||
return menuRepositoryImpl.selectMenuList(menuPo);
|
||||
}
|
||||
|
||||
|
||||
public List<MenuPo> queryButtonlistById(MenuPo menuPo){
|
||||
return menuRepositoryImpl.queryButtonlistById(menuPo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询菜单前端组件集合
|
||||
*
|
||||
* @return 组件信息
|
||||
*/
|
||||
public List<Map<String,String>> selectMenuComponent(){
|
||||
return menuRepositoryImpl.selectMenuComponent();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询菜单树集合
|
||||
*
|
||||
* @return 订单列表信息
|
||||
*/
|
||||
public List<MenuPo> selectMenuTreeList(Long modulesId){
|
||||
Menu menuEntity = new Menu();
|
||||
menuEntity.setModulesId(modulesId);
|
||||
return menuRepositoryImpl.selectMenuTreeList(menuEntity);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询菜单信息
|
||||
*
|
||||
* @param id 菜单id
|
||||
* @return 菜单信息
|
||||
*/
|
||||
public MenuPo selectMenuById(Long id){
|
||||
return menuRepositoryImpl.selectMenuById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增菜单
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertMenu(Menu menu){
|
||||
return menuRepositoryImpl.insertMenu(menu);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改菜单信息
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateMenu(Menu menu){
|
||||
return menuRepositoryImpl.updateMenu(menu);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除菜单
|
||||
*
|
||||
* @param id 菜单ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMenuById(Long id){
|
||||
return menuRepositoryImpl.deleteMenuById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除菜单
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMenuByIds(Long[] ids){
|
||||
return menuRepositoryImpl.deleteMenuByIds(ids);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据组织id查询菜单树形结构
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public List<MenuVo> selectMenuIdListByOrganizationId(Long organizationId){
|
||||
List<MenuVo> list = new ArrayList<>();
|
||||
//数据查询全部数据
|
||||
List<MenuPo> menuPoList = menuRepositoryImpl.selectMenuIdListByOrganizationId(organizationId);
|
||||
//避免只有下级菜单没有上级菜单造成菜单丢失
|
||||
if (CollectionUtil.isNotEmpty(menuPoList) && menuPoList.size() > 0){
|
||||
List<Long> allMenu1 = menuPoList.stream().map(MenuPo::getMenuId).collect(Collectors.toList());
|
||||
MenuPo menuPo = new MenuPo();
|
||||
List<Long> allMenu2 = menuPoList.stream().map(MenuPo::getParentMenuId).collect(Collectors.toList());
|
||||
allMenu1.addAll(allMenu2);
|
||||
menuPo.setMenuIdList(allMenu2);
|
||||
List<Menu> menus = menuRepositoryImpl.selectListByOrganizationId(menuPo);
|
||||
allMenu1 = getParentId(menus,allMenu1);
|
||||
if (CollectionUtil.isNotEmpty(allMenu1)){
|
||||
menuPoList = menuRepositoryImpl.selectMenuListByIds(allMenu1);
|
||||
}
|
||||
}
|
||||
|
||||
if (CollectionUtil.isNotEmpty(menuPoList)){
|
||||
Map<Long, List<MenuPo>> collect = menuPoList.stream().collect(Collectors.groupingBy(MenuPo::getParentMenuId));
|
||||
//封装树形结构
|
||||
list = getMenuVoList(list, collect);
|
||||
}
|
||||
//去除空值
|
||||
removeNullMenu(list);
|
||||
return list;
|
||||
}
|
||||
public List<Long> getParentId(List<Menu> menuList, List<Long> list){
|
||||
if (CollectionUtil.isNotEmpty(menuList) && menuList.size() > 0){
|
||||
MenuPo menuPo = new MenuPo();
|
||||
List<Long> allMenu = menuList.stream().map(Menu::getParentMenuId).collect(Collectors.toList());
|
||||
list.addAll(allMenu);
|
||||
list = list.stream().distinct().collect(Collectors.toList());
|
||||
menuPo.setMenuIdList(allMenu);
|
||||
List<Menu> menus = menuRepositoryImpl.selectListByOrganizationId(menuPo);
|
||||
if (menus != null && menus.size() >0){
|
||||
getParentId(menus,list);
|
||||
}else {
|
||||
return list;
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询全部菜单树形结构
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public List<MenuVo> selectMenuIdList(Menu param){
|
||||
//返回数据
|
||||
List<MenuVo> list = new ArrayList<>();
|
||||
//存储所有的菜单
|
||||
Map<String, MenuVo> menuTree = new HashMap<>();
|
||||
//数据查询全部数据
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
MenuPo menuPo = new MenuPo();
|
||||
if (param != null){
|
||||
menuPo.setMenuClient(param.getMenuClient());
|
||||
}
|
||||
if (loginUser != null){
|
||||
UserPo userPo = loginUser.getUserPo();
|
||||
if (userPo != null){
|
||||
menuPo.setTopOrganizationId(userPo.getTopOrganizationId());
|
||||
}
|
||||
}
|
||||
|
||||
List<MenuPo> menuPoList = menuRepositoryImpl.selectMenuList(menuPo);
|
||||
for (MenuPo item : menuPoList) {
|
||||
MenuVo MenuVo = new MenuVo();
|
||||
if (item.getMenuId() == null){
|
||||
System.out.println("走i这");
|
||||
}
|
||||
BeanUtils.copyProperties(item, MenuVo);
|
||||
//将所有菜单添加到 map 中
|
||||
menuTree.put(Long.toString(item.getMenuId()),MenuVo);
|
||||
}
|
||||
//将 menuPoList 置空,垃圾回收
|
||||
menuPoList = null;
|
||||
//遍历将本身放入父元素
|
||||
menuTree.entrySet().forEach(item -> {
|
||||
//获取到当前节点
|
||||
MenuVo menu = item.getValue();
|
||||
//根据当前节点查询去map获取父级节点
|
||||
MenuVo parentMenu = menuTree.get(Long.toString(menu.getParentMenuId()));
|
||||
//判断是否有父级节点
|
||||
// if (parentMenu != null){
|
||||
// //给父级节点添加当前子
|
||||
// if(parentMenu.getChildren() != null){
|
||||
// //为当前集合元素排序
|
||||
// if(parentMenu.getChildren().size() < menu.getMenuSort()){
|
||||
// for (int i = parentMenu.getChildren().size(); i < menu.getMenuSort()-1; i++) {
|
||||
// parentMenu.getChildren().add(i,new MenuVo());
|
||||
// }
|
||||
// parentMenu.getChildren().add(menu.getMenuSort()-1,menu);
|
||||
// }else {
|
||||
// parentMenu.getChildren().set(menu.getMenuSort()-1,menu);
|
||||
// }
|
||||
// //为当前集合元素排序
|
||||
//// List<MenuVo> MenuVos = pointMenuElement(parentMenu.getChildren(), menu.getMenuSort() - 1, menu);
|
||||
//// parentMenu.setChildren(MenuVos);
|
||||
// }else {
|
||||
// List<MenuVo> children = new ArrayList<>();
|
||||
// //初始化集合
|
||||
// for (int i = 0; i < menu.getMenuSort()-1; i++) {
|
||||
// children.add(i,new MenuVo());
|
||||
// }
|
||||
// children.add(menu.getMenuSort()-1,menu);
|
||||
// parentMenu.setChildren(children);
|
||||
// }
|
||||
// }
|
||||
//判断是否有父级节点
|
||||
if (parentMenu != null){
|
||||
//给父级节点添加当前子
|
||||
if(parentMenu.getChildren() != null){
|
||||
//为当前集合元素排序
|
||||
List<MenuVo> navigationVos = pointMenuElement(parentMenu.getChildren(), menu.getMenuSort() - 1, menu);
|
||||
parentMenu.setChildren(navigationVos);
|
||||
}else {
|
||||
List<MenuVo> children = new ArrayList<>();
|
||||
//初始化集合
|
||||
for (int i = 0; i < menu.getMenuSort()-1; i++) {
|
||||
children.add(i,new MenuVo());
|
||||
}
|
||||
children.add(menu.getMenuSort()-1,menu);
|
||||
parentMenu.setChildren(children);
|
||||
}
|
||||
}
|
||||
});
|
||||
//迭代取出父元素
|
||||
Iterator<Map.Entry<String, MenuVo>> it = menuTree.entrySet().iterator();
|
||||
while(it.hasNext()) {
|
||||
Map.Entry<String,MenuVo> entry=it.next();
|
||||
MenuVo value = entry.getValue();
|
||||
if(Long.toString(value.getParentMenuId()).equals("0")){
|
||||
// list.add(value);
|
||||
//为当前集合父元素排序
|
||||
list = parentMenuPointElementTwo(list, value.getMenuSort()-1, value);
|
||||
}
|
||||
}
|
||||
// for (int i = 0; i < list.size(); i++) {
|
||||
// if(list.get(i).getMenuId() == null){
|
||||
// list.remove(i);
|
||||
// }
|
||||
// }
|
||||
//去除空值
|
||||
removeNullMenu(list);
|
||||
//数据存入缓存
|
||||
// redisService.setCacheObject("menuTree", list, Constants.CAPTCHA_EXPIRATION, TimeUnit.DAYS);
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 封装菜单树形结构
|
||||
* @param menuVoList
|
||||
* @param collect
|
||||
* @return
|
||||
*/
|
||||
public List<MenuVo> getMenuVoList(List<MenuVo> menuVoList, Map<Long, List<MenuPo>> collect){
|
||||
if (CollectionUtil.isNotEmpty(menuVoList)){
|
||||
for (MenuVo menuVo : menuVoList) {
|
||||
List<MenuVo> menuVos = new ArrayList<>();
|
||||
List<MenuPo> menuList = collect.get(menuVo.getMenuId());
|
||||
if (CollectionUtil.isNotEmpty(menuList)){
|
||||
for (MenuPo menu : menuList) {
|
||||
MenuVo menuVo1 = new MenuVo();
|
||||
menuVo1.setMenuId(menu.getMenuId());
|
||||
menuVo1.setParentMenuId(menu.getParentMenuId());
|
||||
menuVo1.setMenuClient(menu.getMenuClient());
|
||||
menuVo1.setMenuType(menu.getMenuType());
|
||||
menuVo1.setMenuName(menu.getMenuName());
|
||||
menuVo1.setMenuShowName(menu.getMenuShowName());
|
||||
menuVo1.setMenuIcon(menu.getMenuIcon());
|
||||
menuVo1.setMenuSort(menu.getMenuSort());
|
||||
menuVo1.setMenuVisible(menu.getMenuVisible());
|
||||
menuVo1.setMenuRemark(menu.getMenuRemark());
|
||||
menuVo1.setMenuPerms(menu.getMenuPerms());
|
||||
menuVo1.setModulesId(menu.getModulesId());
|
||||
menuVos.add(menuVo1);
|
||||
}
|
||||
collect.remove(menuVo.getMenuId());
|
||||
}
|
||||
getMenuVoList(menuVos,collect);
|
||||
menuVo.setChildren(menuVos);
|
||||
}
|
||||
}else {
|
||||
//一级菜单
|
||||
List<MenuPo> menuList = collect.get(0L);
|
||||
if (CollectionUtil.isNotEmpty(menuList)){
|
||||
for (MenuPo menu : menuList) {
|
||||
MenuVo menuVo = new MenuVo();
|
||||
menuVo.setMenuId(menu.getMenuId());
|
||||
menuVo.setParentMenuId(menu.getParentMenuId());
|
||||
menuVo.setMenuClient(menu.getMenuClient());
|
||||
menuVo.setMenuType(menu.getMenuType());
|
||||
menuVo.setMenuName(menu.getMenuName());
|
||||
menuVo.setMenuShowName(menu.getMenuShowName());
|
||||
menuVo.setMenuIcon(menu.getMenuIcon());
|
||||
menuVo.setMenuSort(menu.getMenuSort());
|
||||
menuVo.setMenuVisible(menu.getMenuVisible());
|
||||
menuVo.setMenuRemark(menu.getMenuRemark());
|
||||
menuVo.setMenuPerms(menu.getMenuPerms());
|
||||
menuVo.setModulesId(menu.getModulesId());
|
||||
menuVoList.add(menuVo);
|
||||
}
|
||||
collect.remove(0L);
|
||||
}else {
|
||||
return menuVoList;
|
||||
}
|
||||
getMenuVoList(menuVoList,collect);
|
||||
}
|
||||
return menuVoList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据租户id查询菜单树形结构
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public List<MenuVo> selectMenuIdListByTenantsId(Long tenantsId, Integer menuShow){
|
||||
//返回数据
|
||||
List<MenuVo> list = new ArrayList<>();
|
||||
//数据查询全部数据
|
||||
List<MenuPo> menuPoList = menuRepositoryImpl.selectMenuIdListByTenantsId(tenantsId, menuShow);
|
||||
if (CollectionUtil.isNotEmpty(menuPoList)){
|
||||
Map<Long, List<MenuPo>> collect = menuPoList.stream().collect(Collectors.groupingBy(MenuPo::getParentMenuId));
|
||||
//封装树形结构
|
||||
list = getMenuVoList(list, collect);
|
||||
}
|
||||
removeNullMenu(list);
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询菜单树形结构
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public List<MenuVo> removeNullMenu(List<MenuVo> list){
|
||||
List<MenuVo> list1 = new ArrayList<>();
|
||||
for (MenuVo menuVo : list) {
|
||||
if (menuVo.getMenuId() == null){
|
||||
list1.add(menuVo);
|
||||
}
|
||||
}
|
||||
list.removeAll(list1);
|
||||
if(list.size() > 0){
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if(list.get(i).getMenuId() == null){
|
||||
list.remove(i);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if(list.get(i).getChildren() != null && list.get(i).getChildren().size() > 0){
|
||||
removeNullMenu(list.get(i).getChildren());
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询菜单树形结构
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public List<MenuVo> selectTreeMenu(Long modulesId, Long topOrganizationId){
|
||||
Menu menuEntity = new Menu();
|
||||
menuEntity.setModulesId(modulesId);
|
||||
menuEntity.setTopOrganizationId(topOrganizationId);
|
||||
//返回数据
|
||||
List<MenuVo> list = new ArrayList<>();
|
||||
//存储所有的菜单
|
||||
Map<String, MenuVo> menuTree = new HashMap<>();
|
||||
//数据查询全部数据
|
||||
List<MenuPo> menuPoList = menuRepositoryImpl.selectMenuTreeList(menuEntity);
|
||||
for (MenuPo item : menuPoList) {
|
||||
MenuVo MenuVo = new MenuVo();
|
||||
BeanUtils.copyProperties(item, MenuVo);
|
||||
//将所有菜单添加到 map 中
|
||||
menuTree.put(Long.toString(item.getMenuId()),MenuVo);
|
||||
}
|
||||
//将 menuPoList 置空,垃圾回收
|
||||
menuPoList = null;
|
||||
//遍历将本身放入父元素
|
||||
menuTree.entrySet().forEach(item -> {
|
||||
//获取到当前节点
|
||||
MenuVo menu = item.getValue();
|
||||
//根据当前节点查询去map获取父级节点
|
||||
MenuVo parentMenu = menuTree.get(Long.toString(menu.getParentMenuId()));
|
||||
//判断是否有父级节点
|
||||
if (parentMenu != null){
|
||||
//给父级节点添加当前子
|
||||
if(parentMenu.getChildren() != null){
|
||||
//为当前集合元素排序
|
||||
List<MenuVo> navigationVos = pointMenuElement(parentMenu.getChildren(), menu.getMenuSort() - 1, menu);
|
||||
parentMenu.setChildren(navigationVos);
|
||||
}else {
|
||||
List<MenuVo> children = new ArrayList<>();
|
||||
//初始化集合
|
||||
for (int i = 0; i < menu.getMenuSort()-1; i++) {
|
||||
children.add(i,new MenuVo());
|
||||
}
|
||||
children.add(menu.getMenuSort()-1,menu);
|
||||
parentMenu.setChildren(children);
|
||||
}
|
||||
}
|
||||
});
|
||||
//迭代取出父元素
|
||||
Iterator<Map.Entry<String, MenuVo>> it = menuTree.entrySet().iterator();
|
||||
while(it.hasNext()) {
|
||||
Map.Entry<String,MenuVo> entry=it.next();
|
||||
MenuVo value = entry.getValue();
|
||||
if(Long.toString(value.getParentMenuId()).equals("0")){
|
||||
// list.add(value);
|
||||
//为当前集合父元素排序
|
||||
list = parentMenuPointElement(list, value.getMenuSort()-1, value);
|
||||
}
|
||||
}
|
||||
// for (int i = 0; i < list.size(); i++) {
|
||||
// if(list.get(i).getMenuId() == null){
|
||||
// list.remove(i);
|
||||
// }
|
||||
// }
|
||||
//去除空值
|
||||
removeNullMenu(list);
|
||||
//数据存入缓存
|
||||
// redisService.setCacheObject("menuTree", list, Constants.CAPTCHA_EXPIRATION, TimeUnit.DAYS);
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前用户的菜单
|
||||
*
|
||||
* @param menus 菜单集合
|
||||
* @return 结果
|
||||
*/
|
||||
public List<MenuVo> getCurrentMenu(List<Long> menus){
|
||||
//数据查询全部菜单数据
|
||||
List<MenuPo> menuPoList = menuRepositoryImpl.selectMenuList(new MenuPo());
|
||||
//返回集合
|
||||
List<MenuVo> navigationVoList = new ArrayList<>();
|
||||
//得到本身的菜单集合
|
||||
Map<String, MenuVo> menuTree = new HashMap<>();
|
||||
for (MenuPo menuPo : menuPoList) {
|
||||
if(menus.contains(menuPo.getMenuId())){
|
||||
MenuVo menuVo = new MenuVo();
|
||||
menuVo.setMenuId(menuPo.getMenuId());
|
||||
menuVo.setParentMenuId(menuPo.getParentMenuId());
|
||||
menuVo.setModulesName(menuPo.getModulesName());
|
||||
menuVo.setMenuClient(menuPo.getMenuClient());
|
||||
menuVo.setMenuType(menuPo.getMenuType());
|
||||
menuVo.setMenuName(menuPo.getMenuName());
|
||||
menuVo.setMenuShowName(menuPo.getMenuShowName());
|
||||
menuVo.setMenuIcon(menuPo.getMenuIcon());
|
||||
menuVo.setMenuSort(menuPo.getMenuSort());
|
||||
menuVo.setMenuVisible(menuPo.getMenuVisible());
|
||||
menuVo.setMenuRemark(menuPo.getMenuRemark());
|
||||
menuVo.setMenuPerms(menuPo.getMenuPerms());
|
||||
//将所有菜单添加到 map 中
|
||||
menuTree.put(Long.toString(menuPo.getMenuId()),menuVo);
|
||||
}
|
||||
}
|
||||
//将 menuPoList 置空,垃圾回收
|
||||
menuPoList = null;
|
||||
//遍历将本身放入父元素
|
||||
menuTree.entrySet().forEach(item -> {
|
||||
//获取到当前节点
|
||||
MenuVo navigation = item.getValue();
|
||||
//根据当前节点查询去map获取父级节点
|
||||
MenuVo parentNavigation = menuTree.get(Long.toString(navigation.getParentMenuId()));
|
||||
//判断是否有父级节点
|
||||
if (parentNavigation != null){
|
||||
//给父级节点添加当前子
|
||||
if(parentNavigation.getChildren() != null){
|
||||
//为当前集合元素排序
|
||||
List<MenuVo> navigationVos = pointMenuElement(parentNavigation.getChildren(), navigation.getMenuSort() - 1, navigation);
|
||||
parentNavigation.setChildren(navigationVos);
|
||||
}else {
|
||||
List<MenuVo> children = new ArrayList<>();
|
||||
//初始化集合
|
||||
for (int i = 0; i < navigation.getMenuSort()-1; i++) {
|
||||
children.add(i,new MenuVo());
|
||||
}
|
||||
children.add(navigation.getMenuSort()-1,navigation);
|
||||
parentNavigation.setChildren(children);
|
||||
}
|
||||
}
|
||||
});
|
||||
//迭代取出父元素
|
||||
Iterator<Map.Entry<String, MenuVo>> it = menuTree.entrySet().iterator();
|
||||
while(it.hasNext()) {
|
||||
Map.Entry<String,MenuVo> entry=it.next();
|
||||
MenuVo value = entry.getValue();
|
||||
if(Long.toString(value.getParentMenuId()).equals("0")){
|
||||
// list.add(value);
|
||||
//为当前集合父元素排序
|
||||
navigationVoList = parentMenuPointElement(navigationVoList, value.getMenuSort()-1, value);
|
||||
}
|
||||
}
|
||||
// for (int i = 0; i < navigationVoList.size(); i++) {
|
||||
// if(navigationVoList.get(i).getMenuId() == null){
|
||||
// navigationVoList.remove(i);
|
||||
// }
|
||||
// }
|
||||
//去除空值
|
||||
removeNullMenu(navigationVoList);
|
||||
return navigationVoList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取四级导航栏树结构
|
||||
*
|
||||
* @param menus 菜单集合
|
||||
* @return 结果
|
||||
*/
|
||||
public List<NavigationVo> getNavigationMenu(List<Long> menus){
|
||||
//获取登录人信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
UserPo userPo = loginUser.getUserPo();
|
||||
Long topOrganizationId = userPo.getTopOrganizationId();
|
||||
MenuPo menuPo1 = new MenuPo();
|
||||
menuPo1.setTopOrganizationId(topOrganizationId);
|
||||
menuPo1.setMenuClient(1);
|
||||
menuPo1.setMenuIdList(menus);
|
||||
//数据查询全部菜单数据
|
||||
List<MenuPo> menuPoList = menuRepositoryImpl.selectMenuList(menuPo1);
|
||||
//返回集合
|
||||
List<NavigationVo> navigationVoList = new ArrayList<>();
|
||||
//得到本身的菜单集合
|
||||
Map<String, NavigationVo> menuTree = new HashMap<>();
|
||||
for (MenuPo menuPo : menuPoList) {
|
||||
if(menus.contains(menuPo.getMenuId())){
|
||||
NavigationVo navigationVo = new NavigationVo();
|
||||
navigationVo.setId(menuPo.getMenuId());
|
||||
navigationVo.setParentId(menuPo.getParentMenuId());
|
||||
navigationVo.setName(menuPo.getMenuShowName());
|
||||
navigationVo.setUrl(menuPo.getMenuPath());
|
||||
navigationVo.setMicroServicePath(menuPo.getMicroServicePath());
|
||||
navigationVo.setMenuInternalOrExternal(menuPo.getMenuInternalOrExternal());
|
||||
navigationVo.setIcon(menuPo.getMenuIcon());
|
||||
navigationVo.setModulesId(menuPo.getModulesId());
|
||||
navigationVo.setMenuSort(menuPo.getMenuSort());
|
||||
navigationVo.setMenuRedirectPath(menuPo.getMenuRedirectPath());
|
||||
navigationVo.setMenuComponent(menuPo.getMenuComponent());
|
||||
navigationVo.setHomeShowFlag(menuPo.getHomeShowFlag());
|
||||
//将所有菜单添加到 map 中
|
||||
menuTree.put(Long.toString(menuPo.getMenuId()),navigationVo);
|
||||
}
|
||||
}
|
||||
//将 menuPoList 置空,垃圾回收
|
||||
menuPoList = null;
|
||||
//遍历将本身放入父元素
|
||||
menuTree.entrySet().forEach(item -> {
|
||||
//获取到当前节点
|
||||
NavigationVo navigation = item.getValue();
|
||||
//根据当前节点查询去map获取父级节点
|
||||
NavigationVo parentNavigation = menuTree.get(Long.toString(navigation.getParentId()));
|
||||
//判断是否有父级节点
|
||||
if (parentNavigation != null){
|
||||
//给父级节点添加当前子
|
||||
if(parentNavigation.getChildren() != null){
|
||||
//为当前集合元素排序
|
||||
List<NavigationVo> navigationVos = pointElement(parentNavigation.getChildren(), navigation.getMenuSort() - 1, navigation);
|
||||
parentNavigation.setChildren(navigationVos);
|
||||
}else {
|
||||
List<NavigationVo> children = new ArrayList<>();
|
||||
//初始化集合
|
||||
for (int i = 0; i < navigation.getMenuSort()-1; i++) {
|
||||
children.add(i,new NavigationVo());
|
||||
}
|
||||
children.add(navigation.getMenuSort()-1,navigation);
|
||||
parentNavigation.setChildren(children);
|
||||
}
|
||||
}
|
||||
});
|
||||
//迭代取出父元素
|
||||
Iterator<Map.Entry<String, NavigationVo>> it = menuTree.entrySet().iterator();
|
||||
while(it.hasNext()) {
|
||||
Map.Entry<String,NavigationVo> entry=it.next();
|
||||
NavigationVo value = entry.getValue();
|
||||
if(Long.toString(value.getParentId()).equals("0")){
|
||||
navigationVoList.add(value);
|
||||
}
|
||||
}
|
||||
//去除空值
|
||||
removeNullNavigation(navigationVoList);
|
||||
return navigationVoList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询菜单树形结构
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public List<NavigationVo> removeNullNavigation(List<NavigationVo> navigationVoList){
|
||||
List<NavigationVo> newList = new ArrayList<>();
|
||||
navigationVoList.forEach(e->{
|
||||
if (e.getId() != null){
|
||||
List<NavigationVo> children = e.getChildren();
|
||||
if (CollectionUtil.isNotEmpty(children) && children.size() > 0){
|
||||
List<NavigationVo> list = removeNullNavigation(children);
|
||||
e.setChildren(list);
|
||||
}
|
||||
newList.add(e);
|
||||
}
|
||||
});
|
||||
return newList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断当前位置是否有元素,有则向后顺延一位
|
||||
* @param list
|
||||
* @param i
|
||||
* @return
|
||||
*/
|
||||
public List<NavigationVo> pointElement(List<NavigationVo> list, int i, NavigationVo navigationVo){
|
||||
int len = i+1-list.size();
|
||||
if(list.size() <= i){
|
||||
for (int k = 0; k < len; k++) {
|
||||
list.add(new NavigationVo());
|
||||
}
|
||||
}
|
||||
if(list.get(i).getId() == null){
|
||||
list.add(i,navigationVo);
|
||||
for (int j = 0; j < list.size(); j++) {
|
||||
if(list.get(j).getId() == null){
|
||||
list.remove(j);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}else{
|
||||
return pointElement(list, i+1,navigationVo);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 菜单判断当前位置是否有元素,有则向后顺延一位
|
||||
* @param list
|
||||
* @param i
|
||||
* @return
|
||||
*/
|
||||
public List<MenuVo> pointMenuElement(List<MenuVo> list, int i, MenuVo modules){
|
||||
int len = i+1-list.size();
|
||||
if(list.size() <= i){
|
||||
for (int k = 0; k < len; k++) {
|
||||
list.add(new MenuVo());
|
||||
}
|
||||
}
|
||||
if(list.get(i).getMenuId() == null){
|
||||
list.add(i,modules);
|
||||
for (int j = 0; j < list.size(); j++) {
|
||||
if(list.get(j).getMenuId() == null){
|
||||
list.remove(j);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}else{
|
||||
return pointMenuElement(list, i+1,modules);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 菜单父类判断当前位置是否有元素,有则向后顺延一位
|
||||
* @param list
|
||||
* @param i
|
||||
* @return
|
||||
*/
|
||||
public List<MenuVo> parentMenuPointElementTwo(List<MenuVo> list, int i, MenuVo modules){
|
||||
int len = i+1-list.size();
|
||||
if(list.size() <= i){
|
||||
for (int k = 0; k < len; k++) {
|
||||
list.add(new MenuVo());
|
||||
}
|
||||
}
|
||||
if(list.get(i).getMenuId() == null){
|
||||
list.add(i,modules);
|
||||
return list;
|
||||
}else{
|
||||
return parentMenuPointElementTwo(list, i+1,modules);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 菜单父类判断当前位置是否有元素,有则向后顺延一位
|
||||
* @param list
|
||||
* @param i
|
||||
* @return
|
||||
*/
|
||||
public List<MenuVo> parentMenuPointElement(List<MenuVo> list, int i, MenuVo modules){
|
||||
int len = i+1-list.size();
|
||||
if(list.size() <= i){
|
||||
for (int k = 0; k < len; k++) {
|
||||
list.add(new MenuVo());
|
||||
}
|
||||
}
|
||||
if(list.get(i).getMenuId() == null){
|
||||
list.add(i,modules);
|
||||
return list;
|
||||
}else{
|
||||
return parentMenuPointElement(list, i+1,modules);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*
|
||||
* @param list id集合
|
||||
* @return 结果
|
||||
*/
|
||||
public List<Long> selectModulesByMenuId(List<Long> list){
|
||||
return menuRepositoryImpl.selectModulesByMenuId(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询可用菜单
|
||||
*
|
||||
* @param list id集合
|
||||
* @return 结果
|
||||
*/
|
||||
public List<Long> selectUseMenuId(List<Long> list){
|
||||
return menuRepositoryImpl.selectUseMenuId(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询上级菜单
|
||||
*
|
||||
* @param list id集合
|
||||
* @return 结果
|
||||
*/
|
||||
public List<Long> selectParentMenuId(List<Long> list){
|
||||
return menuRepositoryImpl.selectParentMenuId(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询全部菜单
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public List<Long> selectAllMenuId(Long topOrganizationId){
|
||||
return menuRepositoryImpl.selectAllMenuId(topOrganizationId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据一级组织查询所有的菜单列表
|
||||
* @param menu
|
||||
* @return
|
||||
*/
|
||||
public List<Menu> selectListByOrganizationId(MenuPo menu) {
|
||||
return menuRepositoryImpl.selectListByOrganizationId(menu);
|
||||
}
|
||||
|
||||
public void saveBatchList(List<Menu> menuAddList) {
|
||||
menuRepositoryImpl.saveBatch(menuAddList);
|
||||
}
|
||||
|
||||
public void updateBatchList(List<Menu> updateList) {
|
||||
menuRepositoryImpl.updateBatchById(updateList);
|
||||
}
|
||||
|
||||
public List<Menu> selectListByProductIdList(List<Long> productIdList) {
|
||||
return menuRepositoryImpl.selectListByProductIdList(productIdList);
|
||||
}
|
||||
|
||||
public void deleteByOrganizationId(Long organizationId) {
|
||||
menuRepositoryImpl.deleteByOrganizationId(organizationId);
|
||||
}
|
||||
|
||||
public List<CustomAuth> getCustomAuthByOrganizationId(Long organizationId) {
|
||||
|
||||
List<CustomAuth> customAuthList = menuRepositoryImpl.getCustomAuthByOrganizationId(organizationId);
|
||||
return customAuthList;
|
||||
}
|
||||
public List<MenuPo> getMenuBySourceId(RoleMenuDTO roleMenuDTO) {
|
||||
return menuRepositoryImpl.getMenuBySourceId(roleMenuDTO);
|
||||
}
|
||||
|
||||
public List<MenuPo> getMenuByLogin() {
|
||||
return menuRepositoryImpl.getMenuByLogin();
|
||||
}
|
||||
|
||||
public List<Long> getMenuIdByTenantsId(Long tenantsId, Integer menuShow) {
|
||||
return menuRepositoryImpl.getMenuIdByTenantsId(tenantsId, menuShow);
|
||||
}
|
||||
public List<Menu> getMenuByTenantsId(Long tenantsId, Integer menuShow) {
|
||||
return menuRepositoryImpl.getMenuByTenantsId(tenantsId, menuShow);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.linke.product.domain.menu.service;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.linke.product.infrastructure.feign.UserServiceFeign;
|
||||
import com.mhd.common.core.domain.dto.UserMenuDTO;
|
||||
import com.mhd.common.core.domain.dto.UserRoleDTO;
|
||||
import com.mhd.common.core.domain.po.UserRoleMenuPO;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 用户中心微服务 防腐层
|
||||
*
|
||||
* 本层为防腐层,业务逻辑可在本层完成
|
||||
*
|
||||
* 2022-12-6
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
@Service
|
||||
public class UserFeignService {
|
||||
|
||||
@Autowired
|
||||
UserServiceFeign userServiceFeign;
|
||||
|
||||
/**
|
||||
* 查询用户所有菜单
|
||||
*
|
||||
* @return 订单列表信息
|
||||
*/
|
||||
public List<Long> selectMenuList(Long userId){
|
||||
List<Long> menus = new ArrayList<>();
|
||||
// Long userId = SecurityUtils.getLoginUser().getUserid();
|
||||
UserMenuDTO userMenuDTO = new UserMenuDTO();
|
||||
userMenuDTO.setCurrentUserId(userId);
|
||||
userMenuDTO.setType(2);
|
||||
UserRoleDTO userRoleDTO = new UserRoleDTO();
|
||||
userRoleDTO.setCurrentUserId(userId);
|
||||
//三方调用用户中心微服务获取当前用户的所有菜单
|
||||
AjaxResult userMenu = userServiceFeign.userMenuList(userMenuDTO);
|
||||
if("200".equals(String.valueOf(userMenu.get("code")))){
|
||||
List<UserRoleMenuPO> UserMenuPOList = JSON.parseArray(JSONObject.toJSONString(userMenu.get("data")), UserRoleMenuPO.class);
|
||||
if(UserMenuPOList != null && UserMenuPOList.size() > 0){
|
||||
for (UserRoleMenuPO userRoleMenuPO : UserMenuPOList) {
|
||||
menus.add(userRoleMenuPO.getMenuId());
|
||||
}
|
||||
}else {
|
||||
//三方调用用户中心微服务获取当前用户的所有角色
|
||||
AjaxResult userRole = userServiceFeign.userRoleMenuList(userRoleDTO);
|
||||
if("200".equals(String.valueOf(userRole.get("code")))){
|
||||
List<UserRoleMenuPO> userRolePOList = JSON.parseArray(JSONObject.toJSONString(userRole.get("data")), UserRoleMenuPO.class);
|
||||
if(userRolePOList != null && userRolePOList.size() > 0){
|
||||
for (UserRoleMenuPO userRoleMenuPO : userRolePOList) {
|
||||
menus.add(userRoleMenuPO.getMenuId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return menus;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户所属角色所有菜单
|
||||
*
|
||||
* @return 订单列表信息
|
||||
*/
|
||||
public List<Long> selectRoleMenuList(Long userId){
|
||||
List<Long> menus = new ArrayList<>();
|
||||
UserRoleDTO userRoleDTO = new UserRoleDTO();
|
||||
userRoleDTO.setCurrentUserId(userId);
|
||||
//三方调用用户中心微服务获取当前用户的所有角色
|
||||
AjaxResult userRole = userServiceFeign.userRoleMenuList(userRoleDTO);
|
||||
if("200".equals(String.valueOf(userRole.get("code")))){
|
||||
List<UserRoleMenuPO> userRolePOList = JSON.parseArray(JSONObject.toJSONString(userRole.get("data")), UserRoleMenuPO.class);
|
||||
if(userRolePOList != null && userRolePOList.size() > 0){
|
||||
for (UserRoleMenuPO userRoleMenuPO : userRolePOList) {
|
||||
menus.add(userRoleMenuPO.getMenuId());
|
||||
}
|
||||
}
|
||||
}
|
||||
return menus;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.linke.product.domain.modules.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 模块菜单权限 实体
|
||||
*
|
||||
* 2022-11-26
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
@Data
|
||||
@TableName("modules_menu")
|
||||
public class ModulesMenu extends BaseVOEntity implements Serializable {
|
||||
|
||||
@ApiModelProperty(name = "模块菜单权限id")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long modulesMenuId;
|
||||
@ApiModelProperty(name = "模块ID")
|
||||
private Long modulesId;
|
||||
@ApiModelProperty(name = "菜单ID")
|
||||
private Long menuId;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.linke.product.domain.modules.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 模块 实体
|
||||
*
|
||||
* 2022-11-25
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
@Data
|
||||
@TableName("sys_modules")
|
||||
public class SysModules extends BaseVOEntity implements Serializable
|
||||
{
|
||||
@ApiModelProperty(name = "模块id")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long modulesId;
|
||||
@ApiModelProperty(name = "父模块id")
|
||||
private Long parentModulesId;
|
||||
@ApiModelProperty(name = "模块名称")
|
||||
private String modulesName;
|
||||
@ApiModelProperty(name = "模块编号")
|
||||
private String modulesNumber;
|
||||
@ApiModelProperty(name = "模块描述")
|
||||
private String modulesRemark;
|
||||
@ApiModelProperty(name = "是否启用:0-无状态,1-启用,2-不启用")
|
||||
private Integer useStatus;
|
||||
@ApiModelProperty(name = "中台排序")
|
||||
private Integer modulesSort;
|
||||
@ApiModelProperty(name = "中台客户端类型0-无状态,1-PC,2-APP")
|
||||
private Integer modulesClient;
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
package com.linke.product.domain.modules.repository.facade;
|
||||
|
||||
import com.linke.product.domain.modules.entity.ModulesMenu;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 模块菜单权限 业务层
|
||||
*
|
||||
* 2022-11-26
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
public interface ModulesMenuRepositoryInterface {
|
||||
|
||||
/**
|
||||
* 查询模块菜单权限
|
||||
*
|
||||
* @param id 模块id
|
||||
* @return 列表信息
|
||||
*/
|
||||
public List<ModulesMenu> selectMenuListByModulesId(Long id);
|
||||
|
||||
/**
|
||||
* 批量新增模块菜单权限
|
||||
*
|
||||
* @param list 模块菜单权限集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchAddModulesMenu(List<ModulesMenu> list);
|
||||
|
||||
/**
|
||||
* 批量删除模块菜单权限
|
||||
*
|
||||
* @param id 需要删除的数据主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteModulesMenuById(Long id);
|
||||
}
|
||||
+128
@@ -0,0 +1,128 @@
|
||||
package com.linke.product.domain.modules.repository.facade;
|
||||
|
||||
import com.linke.product.domain.modules.entity.SysModules;
|
||||
import com.linke.product.domain.modules.repository.po.SysModulesPO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 模块 业务层
|
||||
*
|
||||
* 2022-11-25
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
public interface SysModulesRepositoryInterface
|
||||
{
|
||||
/**
|
||||
* 查询产品中台-模块
|
||||
*
|
||||
* @param modulesId 产品中台-模块主键
|
||||
* @return 产品中台-模块
|
||||
*/
|
||||
public SysModules selectSysModulesByModulesId(Long modulesId);
|
||||
|
||||
/**
|
||||
* 查询产品中台-模块列表
|
||||
*
|
||||
* @param sysModules 产品中台-模块
|
||||
* @return 产品中台-模块集合
|
||||
*/
|
||||
public List<SysModules> selectSysModulesList(SysModules sysModules);
|
||||
|
||||
/**
|
||||
* 查询产品中台-模块列表(排序)
|
||||
*
|
||||
* @return 产品中台-模块集合
|
||||
*/
|
||||
public List<SysModules> selectModulesTreeList(String modulesName, Integer modulesClient);
|
||||
|
||||
/**
|
||||
* 查询产品中台-模块列表(id和name)
|
||||
*
|
||||
* @return 产品中台-模块集合
|
||||
*/
|
||||
public List<Map<String,Object>> selectModulesList(Integer modulesClient);
|
||||
|
||||
/**
|
||||
* 顺序+1
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int sortAdd(Long parentModulesId, Integer modulesSort);
|
||||
|
||||
/**
|
||||
* 顺序-1
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int sortSubtract(Long parentModulesId, Integer modulesSort);
|
||||
|
||||
/**
|
||||
* 顺序+1
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int sortAddById(Long modulesId);
|
||||
|
||||
/**
|
||||
* 顺序-1
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int sortSubtractById(Long modulesId);
|
||||
|
||||
/**
|
||||
* 新增产品中台-模块
|
||||
*
|
||||
* @param sysModules 产品中台-模块
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSysModules(SysModules sysModules);
|
||||
|
||||
/**
|
||||
* 修改产品中台-模块
|
||||
*
|
||||
* @param sysModules 产品中台-模块
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSysModules(SysModules sysModules);
|
||||
|
||||
/**
|
||||
* 批量删除产品中台-模块
|
||||
*
|
||||
* @param modulesIds 需要删除的产品中台-模块主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysModulesByModulesIds(Long[] modulesIds);
|
||||
|
||||
/**
|
||||
* 删除产品中台-模块信息
|
||||
*
|
||||
* @param modulesId 产品中台-模块主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysModulesByModulesId(Long modulesId);
|
||||
|
||||
|
||||
/**
|
||||
* @description 根据模块id查询模块信息
|
||||
* @author ZhouGY
|
||||
* @date 2023/10/8 10:58
|
||||
* @param moduleIds
|
||||
* @return List<SysModulesPO>
|
||||
*/
|
||||
public List<SysModulesPO> findModulesByModuleIds(List<Long> moduleIds);
|
||||
|
||||
List<SysModulesPO> findRecursionModulesByModuleId(Long moduleId);
|
||||
|
||||
/**
|
||||
* @description 根据模块id查询模块信息返回树状结构
|
||||
* @author ZhouGY
|
||||
* @date 2023/10/8 10:58
|
||||
* @param moduleIds
|
||||
* @return List<SysModulesPO>
|
||||
*/
|
||||
public List<SysModulesPO> findModulesTreeByModuleIds(List<Long> moduleIds);
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
package com.linke.product.domain.modules.repository.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.linke.product.domain.modules.entity.ModulesMenu;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 模块菜单权限 数据层
|
||||
*
|
||||
* 2022-11-26
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
public interface ModulesMenuMapper extends BaseMapper<ModulesMenu> {
|
||||
|
||||
/**
|
||||
* 查询模块菜单权限
|
||||
*
|
||||
* @param id 模块id
|
||||
* @return 列表信息
|
||||
*/
|
||||
public List<ModulesMenu> selectMenuListByModulesId(Long id);
|
||||
|
||||
/**
|
||||
* 批量新增模块菜单权限
|
||||
*
|
||||
* @param list 模块菜单权限集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchAddModulesMenu(List<ModulesMenu> list);
|
||||
|
||||
/**
|
||||
* 批量删除模块菜单权限
|
||||
*
|
||||
* @param id 需要删除的数据主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteModulesMenuById(Long id);
|
||||
}
|
||||
+129
@@ -0,0 +1,129 @@
|
||||
package com.linke.product.domain.modules.repository.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.linke.product.domain.modules.entity.SysModules;
|
||||
import com.linke.product.domain.modules.repository.po.SysModulesPO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 模块 数据层
|
||||
*
|
||||
* 2022-11-25
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
public interface SysModulesMapper extends BaseMapper<SysModules>
|
||||
{
|
||||
/**
|
||||
* 查询产品中台-模块
|
||||
*
|
||||
* @param modulesId 产品中台-模块主键
|
||||
* @return 产品中台-模块
|
||||
*/
|
||||
public SysModules selectSysModulesByModulesId(Long modulesId);
|
||||
|
||||
/**
|
||||
* 查询产品中台-模块列表
|
||||
*
|
||||
* @param sysModules 产品中台-模块
|
||||
* @return 产品中台-模块集合
|
||||
*/
|
||||
public List<SysModules> selectSysModulesList(SysModules sysModules);
|
||||
|
||||
/**
|
||||
* 查询产品中台-模块列表(排序)
|
||||
*
|
||||
* @return 产品中台-模块集合
|
||||
*/
|
||||
public List<SysModules> selectModulesTreeList(@Param("modulesName") String modulesName, @Param("modulesClient") Integer modulesClient);
|
||||
|
||||
/**
|
||||
* 查询产品中台-模块列表(id和name)
|
||||
*
|
||||
* @return 产品中台-模块集合
|
||||
*/
|
||||
public List<Map<String,Object>> selectModulesList(@Param("modulesClient") Integer modulesClient);
|
||||
|
||||
/**
|
||||
* 顺序+1
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int sortAdd(@Param(value = "parentModulesId") Long parentModulesId,
|
||||
@Param(value = "modulesSort") Integer modulesSort);
|
||||
|
||||
/**
|
||||
* 顺序-1
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int sortSubtract(@Param(value = "parentModulesId") Long parentModulesId,
|
||||
@Param(value = "modulesSort") Integer modulesSort);
|
||||
|
||||
/**
|
||||
* 顺序+1
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int sortAddById(Long modulesId);
|
||||
|
||||
/**
|
||||
* 顺序-1
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int sortSubtractById(Long modulesId);
|
||||
|
||||
/**
|
||||
* 新增产品中台-模块
|
||||
*
|
||||
* @param sysModules 产品中台-模块
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSysModules(SysModules sysModules);
|
||||
|
||||
/**
|
||||
* 修改产品中台-模块
|
||||
*
|
||||
* @param sysModules 产品中台-模块
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSysModules(SysModules sysModules);
|
||||
|
||||
/**
|
||||
* 删除产品中台-模块
|
||||
*
|
||||
* @param modulesId 产品中台-模块主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysModulesByModulesId(Long modulesId);
|
||||
|
||||
/**
|
||||
* 批量删除产品中台-模块
|
||||
*
|
||||
* @param modulesIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysModulesByModulesIds(Long[] modulesIds);
|
||||
|
||||
/**
|
||||
* @description 根据中台id查询中台集合
|
||||
* @author ZhouGY
|
||||
* @date 2023/10/8 10:41
|
||||
* @param modulesIds
|
||||
* @return List<SysModulesPO>
|
||||
*/
|
||||
List<SysModulesPO> findModulesByModuleIds(@Param(value = "modulesIds") List<Long> modulesIds);
|
||||
|
||||
/**
|
||||
* @description 根据中台id查询
|
||||
* @author ZhouGY
|
||||
* @date 2023/10/9 9:03
|
||||
* @param modulesId
|
||||
* @return List<Long>
|
||||
*/
|
||||
List<SysModulesPO> findRecursionModulesByModuleId(@Param(value = "modulesId") Long modulesId);
|
||||
}
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
package com.linke.product.domain.modules.repository.persistence;
|
||||
|
||||
import com.linke.product.domain.modules.entity.ModulesMenu;
|
||||
import com.linke.product.domain.modules.repository.facade.ModulesMenuRepositoryInterface;
|
||||
import com.linke.product.domain.modules.repository.mapper.ModulesMenuMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 菜单菜单权限 业务实现层
|
||||
*
|
||||
* 本层为核心业务层,不可掺杂其他业务
|
||||
*
|
||||
* 2022-11-26
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
@Service
|
||||
public class ModulesMenuRepositoryImpl implements ModulesMenuRepositoryInterface {
|
||||
|
||||
@Autowired
|
||||
private ModulesMenuMapper modulesMenuMapper;
|
||||
|
||||
/**
|
||||
* 查询模块菜单权限
|
||||
*
|
||||
* @param id 模块id
|
||||
* @return 列表信息
|
||||
*/
|
||||
@Override
|
||||
public List<ModulesMenu> selectMenuListByModulesId(Long id){
|
||||
return modulesMenuMapper.selectMenuListByModulesId(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量新增模块菜单权限
|
||||
*
|
||||
* @param list 模块菜单权限集合
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int batchAddModulesMenu(List<ModulesMenu> list){
|
||||
return modulesMenuMapper.batchAddModulesMenu(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除模块菜单权限
|
||||
*
|
||||
* @param id 需要删除的数据主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteModulesMenuById(Long id){
|
||||
return modulesMenuMapper.deleteModulesMenuById(id);
|
||||
}
|
||||
}
|
||||
+219
@@ -0,0 +1,219 @@
|
||||
package com.linke.product.domain.modules.repository.persistence;
|
||||
|
||||
import com.linke.product.domain.modules.entity.SysModules;
|
||||
import com.linke.product.domain.modules.repository.facade.SysModulesRepositoryInterface;
|
||||
import com.linke.product.domain.modules.repository.mapper.SysModulesMapper;
|
||||
import com.linke.product.domain.modules.repository.po.SysModulesPO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 模块 业务实现层
|
||||
*
|
||||
* 本层为核心业务层,不可掺杂其他业务
|
||||
*
|
||||
* 2022-11-25
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
@Service
|
||||
public class SysModulesRepositoryImpl implements SysModulesRepositoryInterface
|
||||
{
|
||||
@Autowired
|
||||
private SysModulesMapper sysModulesMapper;
|
||||
|
||||
/**
|
||||
* 查询产品中台-模块
|
||||
*
|
||||
* @param modulesId 产品中台-模块主键
|
||||
* @return 产品中台-模块
|
||||
*/
|
||||
@Override
|
||||
public SysModules selectSysModulesByModulesId(Long modulesId)
|
||||
{
|
||||
return sysModulesMapper.selectSysModulesByModulesId(modulesId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询产品中台-模块列表
|
||||
*
|
||||
* @param sysModules 产品中台-模块
|
||||
* @return 产品中台-模块
|
||||
*/
|
||||
@Override
|
||||
public List<SysModules> selectSysModulesList(SysModules sysModules)
|
||||
{
|
||||
return sysModulesMapper.selectSysModulesList(sysModules);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询产品中台-模块列表(排序)
|
||||
*
|
||||
* @return 产品中台-模块集合
|
||||
*/
|
||||
@Override
|
||||
public List<SysModules> selectModulesTreeList(String modulesName, Integer modulesClient){
|
||||
return sysModulesMapper.selectModulesTreeList(modulesName, modulesClient);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询产品中台-模块列表(id和name)
|
||||
*
|
||||
* @return 产品中台-模块集合
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String,Object>> selectModulesList(Integer modulesClient){
|
||||
return sysModulesMapper.selectModulesList(modulesClient);
|
||||
}
|
||||
|
||||
/**
|
||||
* 顺序+1
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int sortAdd(Long parentModulesId, Integer modulesSort){
|
||||
return sysModulesMapper.sortAdd(parentModulesId,modulesSort);
|
||||
}
|
||||
|
||||
/**
|
||||
* 顺序-1
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int sortSubtract(Long parentModulesId, Integer modulesSort){
|
||||
return sysModulesMapper.sortSubtract(parentModulesId,modulesSort);
|
||||
}
|
||||
|
||||
/**
|
||||
* 顺序+1
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int sortAddById(Long modulesId){
|
||||
return sysModulesMapper.sortAddById(modulesId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 顺序-1
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int sortSubtractById(Long modulesId){
|
||||
return sysModulesMapper.sortSubtractById(modulesId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增产品中台-模块
|
||||
*
|
||||
* @param sysModules 产品中台-模块
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertSysModules(SysModules sysModules)
|
||||
{
|
||||
return sysModulesMapper.insert(sysModules);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改产品中台-模块
|
||||
*
|
||||
* @param sysModules 产品中台-模块
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateSysModules(SysModules sysModules)
|
||||
{
|
||||
return sysModulesMapper.updateById(sysModules);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除产品中台-模块
|
||||
*
|
||||
* @param modulesIds 需要删除的产品中台-模块主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysModulesByModulesIds(Long[] modulesIds)
|
||||
{
|
||||
return sysModulesMapper.deleteSysModulesByModulesIds(modulesIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除产品中台-模块信息
|
||||
*
|
||||
* @param modulesId 产品中台-模块主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysModulesByModulesId(Long modulesId)
|
||||
{
|
||||
return sysModulesMapper.deleteSysModulesByModulesId(modulesId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 根据中台查询中台集合
|
||||
* @author ZhouGY
|
||||
* @date 2023/10/8 11:06
|
||||
* @param moduleIds
|
||||
* @return List<SysModulesPO>
|
||||
*/
|
||||
@Override
|
||||
public List<SysModulesPO> findModulesByModuleIds(List<Long> moduleIds){
|
||||
return sysModulesMapper.findModulesByModuleIds(moduleIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 递归查询指定中台下所有的中台id 包含自己
|
||||
* @author ZhouGY
|
||||
* @date 2023/10/9 9:06
|
||||
* @param moduleId
|
||||
* @return List<SysModulesPO>
|
||||
*/
|
||||
@Override
|
||||
public List<SysModulesPO> findRecursionModulesByModuleId(Long moduleId){
|
||||
return sysModulesMapper.findRecursionModulesByModuleId(moduleId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 根据中台查询中台集合 返回树状结构
|
||||
* @author ZhouGY
|
||||
* @date 2023/10/8 11:06
|
||||
* @param moduleIds
|
||||
* @return List<SysModulesPO>
|
||||
*/
|
||||
@Override
|
||||
public List<SysModulesPO> findModulesTreeByModuleIds(List<Long> moduleIds){
|
||||
List<SysModulesPO> sysModulesPOList = sysModulesMapper.findModulesByModuleIds(moduleIds);
|
||||
//递归封装数据
|
||||
List<SysModulesPO> sysModulesPOS = sysModulesPOList.stream().filter(p -> p.getParentModulesId() == 0).collect(Collectors.toList());
|
||||
sysModulesPOS.forEach(sysModulesPO -> sysModulesPO.setChildrenList(getChildren(sysModulesPO.getModulesId(), sysModulesPOList)));
|
||||
return sysModulesPOS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 递归查询所有数据
|
||||
* @author ZhouGY
|
||||
* @date 2023/10/8 11:06
|
||||
* @param parentModulesId
|
||||
* @param sysModulesPOList
|
||||
* @return List<SysModulesPO>
|
||||
*/
|
||||
private List<SysModulesPO> getChildren(Long parentModulesId, List<SysModulesPO> sysModulesPOList){
|
||||
List<SysModulesPO> sysModulesPOS = sysModulesPOList.stream().filter(p -> parentModulesId.equals(p.getParentModulesId())).collect(Collectors.toList());
|
||||
if (!CollectionUtils.isEmpty(sysModulesPOS)){
|
||||
sysModulesPOS.forEach(sysModulesPO -> {
|
||||
sysModulesPO.setChildrenList(getChildren(sysModulesPO.getModulesId(),sysModulesPOList));
|
||||
});
|
||||
}
|
||||
return sysModulesPOS;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user