|
@@ -6,10 +6,13 @@ import com.usky.common.security.utils.SecurityUtils;
|
|
|
import com.usky.common.core.bean.CommonPage;
|
|
|
import com.usky.common.mybatis.core.AbstractCrudService;
|
|
|
import com.usky.system.domain.SysMenu;
|
|
|
+import com.usky.system.domain.SysMobileMenu;
|
|
|
import com.usky.system.domain.SysPlatform;
|
|
|
import com.usky.system.domain.SysPlatformMenu;
|
|
|
+import com.usky.system.domain.SysMobilePlatformMenu;
|
|
|
import com.usky.system.mapper.SysMenuMapper;
|
|
|
import com.usky.system.mapper.SysPlatformMapper;
|
|
|
+import com.usky.system.service.SysMobilePlatformMenuService;
|
|
|
import com.usky.system.service.SysPlatformMenuService;
|
|
|
import com.usky.system.service.SysPlatformService;
|
|
|
import com.usky.system.service.vo.*;
|
|
@@ -38,6 +41,8 @@ public class SysPlatformServiceImpl extends AbstractCrudService<SysPlatformMappe
|
|
|
private SysMenuMapper menuMapper;
|
|
|
@Autowired
|
|
|
private SysPlatformMenuService sysPlatformMenuService;
|
|
|
+ @Autowired
|
|
|
+ private SysMobilePlatformMenuService sysMobilePlatformMenuService;
|
|
|
|
|
|
@Override
|
|
|
public List<SysPlatform> getPlatformBoxList() {
|
|
@@ -75,6 +80,18 @@ public class SysPlatformServiceImpl extends AbstractCrudService<SysPlatformMappe
|
|
|
return arr;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Long[] getMobilePlatformMenu(Long platformId) {
|
|
|
+ LambdaQueryWrapper<SysMobilePlatformMenu> queryWrapper = Wrappers.lambdaQuery();
|
|
|
+ queryWrapper.eq(SysMobilePlatformMenu::getPlatformId, platformId);
|
|
|
+ List<SysMobilePlatformMenu> menuList = sysMobilePlatformMenuService.list(queryWrapper);
|
|
|
+ Long[] arr = new Long[menuList.size()];
|
|
|
+ for (int i = 0; i < menuList.size(); i++) {
|
|
|
+ arr[i] = menuList.get(i).getMenuId().longValue();
|
|
|
+ }
|
|
|
+ return arr;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
@Transactional
|
|
@@ -90,9 +107,12 @@ public class SysPlatformServiceImpl extends AbstractCrudService<SysPlatformMappe
|
|
|
}else {
|
|
|
sysPlatform.setId(platformMenuVo.getPlatformId().intValue());
|
|
|
sysPlatform.setPlatformName(platformMenuVo.getPlatformName());
|
|
|
+ sysPlatform.setUpdateBy(SecurityUtils.getUsername());
|
|
|
+ sysPlatform.setUpdateTime(LocalDateTime.now());
|
|
|
this.updateById(sysPlatform);
|
|
|
}
|
|
|
|
|
|
+ List arr3 = new ArrayList();
|
|
|
Long[] arr = platformMenuVo.getMenuIds();
|
|
|
//菜单ID
|
|
|
List<SysMenu> menuIdList = baseMapper.getMenuIdListOne(arr, "F");
|
|
@@ -101,24 +121,38 @@ public class SysPlatformServiceImpl extends AbstractCrudService<SysPlatformMappe
|
|
|
arr1[i] = menuIdList.get(i).getParentId();
|
|
|
}
|
|
|
//目录ID
|
|
|
- List<SysMenu> menuIdListOne = baseMapper.getMenuIdListOne(arr1, "C");
|
|
|
- Long arr2[] = new Long[menuIdListOne.size()];
|
|
|
- for (int i = 0; i < menuIdListOne.size(); i++) {
|
|
|
- arr2[i] = menuIdListOne.get(i).getParentId();
|
|
|
- }
|
|
|
- List<SysMenu> menuIdListTwo = baseMapper.getMenuIdListOne(arr, "C");
|
|
|
- Long arr4[] = new Long[menuIdListTwo.size()];
|
|
|
- for (int i = 0; i < menuIdListTwo.size(); i++) {
|
|
|
- arr4[i] = menuIdListTwo.get(i).getParentId();
|
|
|
- }
|
|
|
+ if(arr1.length > 0){
|
|
|
+ List<SysMenu> menuIdListOne = baseMapper.getMenuIdListOne(arr1, "C");
|
|
|
+ Long arr2[] = new Long[menuIdListOne.size()];
|
|
|
+ for (int i = 0; i < menuIdListOne.size(); i++) {
|
|
|
+ arr2[i] = menuIdListOne.get(i).getParentId();
|
|
|
+ }
|
|
|
+ List<SysMenu> menuIdListTwo = baseMapper.getMenuIdListOne(arr, "C");
|
|
|
+ Long arr4[] = new Long[menuIdListTwo.size()];
|
|
|
+ for (int i = 0; i < menuIdListTwo.size(); i++) {
|
|
|
+ arr4[i] = menuIdListTwo.get(i).getParentId();
|
|
|
+ }
|
|
|
|
|
|
- Long[] arr5 = arrayMerge(arr1, arr2);
|
|
|
- Long[] arr6 = arrayMerge(arr5, arr4);
|
|
|
- Long[] arr7 = arrayMerge(arr6, arr);
|
|
|
- List arr3 = new ArrayList();
|
|
|
- for (int i = 0; i < arr7.length; i++) {
|
|
|
- if (!arr3.contains(arr7[i])) {
|
|
|
- arr3.add(arr7[i]);
|
|
|
+ Long[] arr5 = arrayMerge(arr1, arr2);
|
|
|
+ Long[] arr6 = arrayMerge(arr5, arr4);
|
|
|
+ Long[] arr7 = arrayMerge(arr6, arr);
|
|
|
+ for (int i = 0; i < arr7.length; i++) {
|
|
|
+ if (!arr3.contains(arr7[i])) {
|
|
|
+ arr3.add(arr7[i]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ List<SysMenu> menuIdListTwo = baseMapper.getMenuIdListOne(arr, "C");
|
|
|
+ Long arr4[] = new Long[menuIdListTwo.size()];
|
|
|
+ for (int i = 0; i < menuIdListTwo.size(); i++) {
|
|
|
+ arr4[i] = menuIdListTwo.get(i).getParentId();
|
|
|
+ }
|
|
|
+
|
|
|
+ Long[] arr7 = arrayMerge(arr4, arr);
|
|
|
+ for (int i = 0; i < arr7.length; i++) {
|
|
|
+ if (!arr3.contains(arr7[i])) {
|
|
|
+ arr3.add(arr7[i]);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
// 删除租户菜单关联
|
|
@@ -135,6 +169,81 @@ public class SysPlatformServiceImpl extends AbstractCrudService<SysPlatformMappe
|
|
|
|
|
|
}
|
|
|
|
|
|
+ @Transactional
|
|
|
+ public void updateMobilePlatformMenu(MobilePlatformMenuVO mobilePlatformMenuVO) {
|
|
|
+ SysPlatform sysPlatform = new SysPlatform();
|
|
|
+ if (mobilePlatformMenuVO.getPlatformId().intValue() == 0) {
|
|
|
+ sysPlatform.setPlatformName(mobilePlatformMenuVO.getPlatformName());
|
|
|
+ sysPlatform.setCreateBy(SecurityUtils.getUsername());
|
|
|
+ sysPlatform.setCreateTime(LocalDateTime.now());
|
|
|
+ this.save(sysPlatform);
|
|
|
+ Integer fid = sysPlatform.getId();
|
|
|
+ mobilePlatformMenuVO.setPlatformId(fid.longValue());
|
|
|
+ }else {
|
|
|
+ sysPlatform.setId(mobilePlatformMenuVO.getPlatformId().intValue());
|
|
|
+ sysPlatform.setPlatformName(mobilePlatformMenuVO.getPlatformName());
|
|
|
+ sysPlatform.setUpdateBy(SecurityUtils.getUsername());
|
|
|
+ sysPlatform.setUpdateTime(LocalDateTime.now());
|
|
|
+ this.updateById(sysPlatform);
|
|
|
+ }
|
|
|
+
|
|
|
+ List arr3 = new ArrayList();
|
|
|
+ Long[] arr = mobilePlatformMenuVO.getMenuIds();
|
|
|
+ //菜单ID
|
|
|
+ List<SysMobileMenu> menuIdList = baseMapper.getMobileMenuIdListOne(arr, "F");
|
|
|
+ Long arr1[] = new Long[menuIdList.size()];
|
|
|
+ for (int i = 0; i < menuIdList.size(); i++) {
|
|
|
+ arr1[i] = menuIdList.get(i).getParentId();
|
|
|
+ }
|
|
|
+ //目录ID
|
|
|
+ if(arr1.length > 0){
|
|
|
+ List<SysMobileMenu> menuIdListOne = baseMapper.getMobileMenuIdListOne(arr1, "C");
|
|
|
+ Long arr2[] = new Long[menuIdListOne.size()];
|
|
|
+ for (int i = 0; i < menuIdListOne.size(); i++) {
|
|
|
+ arr2[i] = menuIdListOne.get(i).getParentId();
|
|
|
+ }
|
|
|
+ List<SysMobileMenu> menuIdListTwo = baseMapper.getMobileMenuIdListOne(arr, "C");
|
|
|
+ Long arr4[] = new Long[menuIdListTwo.size()];
|
|
|
+ for (int i = 0; i < menuIdListTwo.size(); i++) {
|
|
|
+ arr4[i] = menuIdListTwo.get(i).getParentId();
|
|
|
+ }
|
|
|
+
|
|
|
+ Long[] arr5 = arrayMerge(arr1, arr2);
|
|
|
+ Long[] arr6 = arrayMerge(arr5, arr4);
|
|
|
+ Long[] arr7 = arrayMerge(arr6, arr);
|
|
|
+ for (int i = 0; i < arr7.length; i++) {
|
|
|
+ if (!arr3.contains(arr7[i])) {
|
|
|
+ arr3.add(arr7[i]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ List<SysMobileMenu> menuIdListTwo = baseMapper.getMobileMenuIdListOne(arr, "C");
|
|
|
+ Long arr4[] = new Long[menuIdListTwo.size()];
|
|
|
+ for (int i = 0; i < menuIdListTwo.size(); i++) {
|
|
|
+ arr4[i] = menuIdListTwo.get(i).getParentId();
|
|
|
+ }
|
|
|
+ Long[] arr7 = arrayMerge(arr4, arr);
|
|
|
+ for (int i = 0; i < arr7.length; i++) {
|
|
|
+ if (!arr3.contains(arr7[i])) {
|
|
|
+ arr3.add(arr7[i]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 删除租户菜单关联
|
|
|
+ baseMapper.deleteMobilePlatformMenuBy(mobilePlatformMenuVO.getPlatformId());
|
|
|
+ //新增菜单
|
|
|
+ if (arr3.size() > 0) {
|
|
|
+ for (int i = 0; i < arr3.size(); i++) {
|
|
|
+ SysMobilePlatformMenu sysMobilePlatformMenu = new SysMobilePlatformMenu();
|
|
|
+ sysMobilePlatformMenu.setMenuId(((Long) arr3.get(i)).intValue());
|
|
|
+ sysMobilePlatformMenu.setPlatformId(mobilePlatformMenuVO.getPlatformId().intValue());
|
|
|
+ sysMobilePlatformMenuService.save(sysMobilePlatformMenu);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
public Long[] arrayMerge(Long[] arr1, Long[] arr2) {
|
|
|
Long arr3[] = new Long[arr1.length + arr2.length];
|
|
|
for (int i = 0; i < arr1.length; i++) {
|