包头bug修复

This commit is contained in:
guoshengxiong 2025-04-14 19:35:26 +08:00
parent fae66d7b0c
commit 2580e777eb
4 changed files with 132 additions and 76 deletions

View File

@ -1,11 +1,18 @@
package com.zhgd.xmgl.modules.basicdata.controller; package com.zhgd.xmgl.modules.basicdata.controller;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.zhgd.jeecg.common.api.vo.Result; import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.mybatis.EntityMap; import com.zhgd.jeecg.common.mybatis.EntityMap;
import com.zhgd.xmgl.modules.basicdata.entity.BaseAuthority;
import com.zhgd.xmgl.modules.basicdata.entity.BaseMenu; import com.zhgd.xmgl.modules.basicdata.entity.BaseMenu;
import com.zhgd.xmgl.modules.basicdata.entity.BaseModule; import com.zhgd.xmgl.modules.basicdata.entity.BaseModule;
import com.zhgd.xmgl.modules.basicdata.entity.BaseRole;
import com.zhgd.xmgl.modules.basicdata.service.IBaseAuthorityService;
import com.zhgd.xmgl.modules.basicdata.service.IBaseMenuService; import com.zhgd.xmgl.modules.basicdata.service.IBaseMenuService;
import com.zhgd.xmgl.modules.basicdata.service.IBaseRoleService;
import com.zhgd.xmgl.util.MapBuilder;
import com.zhgd.xmgl.util.MessageUtil; import com.zhgd.xmgl.util.MessageUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
@ -14,10 +21,11 @@ import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.MapUtils; import org.apache.commons.collections.MapUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.*;
import java.util.Map; import java.util.stream.Collectors;
/** /**
@ -34,9 +42,16 @@ import java.util.Map;
public class BaseMenuController { public class BaseMenuController {
@Autowired @Autowired
private IBaseMenuService baseMenuService; private IBaseMenuService baseMenuService;
@Lazy
@Autowired
private IBaseAuthorityService baseAuthorityService;
@Lazy
@Autowired
private IBaseRoleService baseRoleService;
/** /**
* 分页列表查询 * 分页列表查询
*
* @return * @return
*/ */
@ApiOperation(value = "列表查询系统菜单信息", notes = "列表查询系统菜单信息", httpMethod = "POST") @ApiOperation(value = "列表查询系统菜单信息", notes = "列表查询系统菜单信息", httpMethod = "POST")
@ -44,7 +59,7 @@ public class BaseMenuController {
@ApiImplicitParam(name = "moduleId", value = "模块ID", paramType = "body", required = false, dataType = "String"), @ApiImplicitParam(name = "moduleId", value = "模块ID", paramType = "body", required = false, dataType = "String"),
}) })
@PostMapping(value = "/list") @PostMapping(value = "/list")
public Result<List<EntityMap>> selectBaseMenuList(@RequestBody Map<String,Object> map) { public Result<List<EntityMap>> selectBaseMenuList(@RequestBody Map<String, Object> map) {
return Result.success(baseMenuService.selectBaseMenuList(map)); return Result.success(baseMenuService.selectBaseMenuList(map));
} }
@ -53,12 +68,13 @@ public class BaseMenuController {
@ApiImplicitParam(name = "moduleId", value = "模块ID", paramType = "body", required = false, dataType = "String"), @ApiImplicitParam(name = "moduleId", value = "模块ID", paramType = "body", required = false, dataType = "String"),
}) })
@PostMapping(value = "/selectGroupList") @PostMapping(value = "/selectGroupList")
public Result<JSONArray> selectGroupList(@RequestBody Map<String,Object> map) { public Result<JSONArray> selectGroupList(@RequestBody Map<String, Object> map) {
return Result.success(baseMenuService.selectGroupList(map)); return Result.success(baseMenuService.selectGroupList(map));
} }
/** /**
* 添加 * 添加
*
* @param baseMenu * @param baseMenu
* @return * @return
*/ */
@ -71,10 +87,11 @@ public class BaseMenuController {
/** /**
* 编辑 * 编辑
*
* @param baseMenu * @param baseMenu
* @return * @return
*/ */
@ApiOperation(value = "编辑系统菜单信息", notes = "编辑系统菜单信息" , httpMethod="POST") @ApiOperation(value = "编辑系统菜单信息", notes = "编辑系统菜单信息", httpMethod = "POST")
@PostMapping(value = "/edit") @PostMapping(value = "/edit")
public Result<BaseMenu> edit(@RequestBody BaseMenu baseMenu) { public Result<BaseMenu> edit(@RequestBody BaseMenu baseMenu) {
baseMenuService.editBaseMenu(baseMenu); baseMenuService.editBaseMenu(baseMenu);
@ -83,20 +100,21 @@ public class BaseMenuController {
/** /**
* 通过id删除 * 通过id删除
*
* @param * @param
* @return * @return
*/ */
@ApiOperation(value = "删除系统菜单信息", notes = "删除系统菜单信息", httpMethod = "POST") @ApiOperation(value = "删除系统菜单信息", notes = "删除系统菜单信息", httpMethod = "POST")
@ApiImplicitParam(name = "menuId", value = "系统菜单ID", paramType = "body", required = true, dataType = "Integer") @ApiImplicitParam(name = "menuId", value = "系统菜单ID", paramType = "body", required = true, dataType = "Integer")
@PostMapping(value = "/delete") @PostMapping(value = "/delete")
public Result<BaseMenu> delete(@RequestBody Map<String,Object> map) { public Result<BaseMenu> delete(@RequestBody Map<String, Object> map) {
Result<BaseMenu> result = new Result<BaseMenu>(); Result<BaseMenu> result = new Result<BaseMenu>();
BaseMenu baseMenu = baseMenuService.getById(MapUtils.getString(map,"menuId")); BaseMenu baseMenu = baseMenuService.getById(MapUtils.getString(map, "menuId"));
if(baseMenu==null) { if (baseMenu == null) {
result.error500(MessageUtil.get("notFindErr")); result.error500(MessageUtil.get("notFindErr"));
}else { } else {
boolean ok = baseMenuService.removeById(MapUtils.getString(map,"menuId")); boolean ok = baseMenuService.removeById(MapUtils.getString(map, "menuId"));
if(ok) { if (ok) {
result.successMsg(MessageUtil.get("deleteSucess")); result.successMsg(MessageUtil.get("deleteSucess"));
} }
} }
@ -104,28 +122,28 @@ public class BaseMenuController {
return result; return result;
} }
/** /**
* 通过id查询 * 通过id查询
*
* @param * @param
* @return * @return
*/ */
@ApiOperation(value = "通过id查询系统菜单信息", notes = "通过id查询系统菜单信息", httpMethod = "POST") @ApiOperation(value = "通过id查询系统菜单信息", notes = "通过id查询系统菜单信息", httpMethod = "POST")
@ApiImplicitParam(name = "menuId", value = "系统菜单ID", paramType = "body", required = true, dataType = "Integer") @ApiImplicitParam(name = "menuId", value = "系统菜单ID", paramType = "body", required = true, dataType = "Integer")
@PostMapping(value = "/queryById") @PostMapping(value = "/queryById")
public Result<BaseMenu> queryById(@RequestBody Map<String,Object> map) { public Result<BaseMenu> queryById(@RequestBody Map<String, Object> map) {
Result<BaseMenu> result = new Result<BaseMenu>(); Result<BaseMenu> result = new Result<BaseMenu>();
BaseMenu baseMenu = baseMenuService.getById(MapUtils.getString(map,"menuId")); BaseMenu baseMenu = baseMenuService.getById(MapUtils.getString(map, "menuId"));
if(baseMenu==null) { if (baseMenu == null) {
result.error500(MessageUtil.get("notFindErr")); result.error500(MessageUtil.get("notFindErr"));
}else { } else {
result.setResult(baseMenu); result.setResult(baseMenu);
result.setSuccess(true); result.setSuccess(true);
} }
return result; return result;
} }
@ApiOperation(value = "查询项目默认的模块和菜单列表", notes = "查询项目默认的模块和菜单列表", httpMethod="POST") @ApiOperation(value = "查询项目默认的模块和菜单列表", notes = "查询项目默认的模块和菜单列表", httpMethod = "POST")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = true, dataType = "String"), @ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = true, dataType = "String"),
}) })
@ -134,7 +152,7 @@ public class BaseMenuController {
return Result.success(baseMenuService.getProjectModuleAndMenu(map)); return Result.success(baseMenuService.getProjectModuleAndMenu(map));
} }
@ApiOperation(value = "查询项目默认的菜单列表并根据模块分组", notes = "查询项目默认的菜单列表并根据模块分组", httpMethod="POST") @ApiOperation(value = "查询项目默认的菜单列表并根据模块分组", notes = "查询项目默认的菜单列表并根据模块分组", httpMethod = "POST")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = true, dataType = "String"), @ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = true, dataType = "String"),
@ApiImplicitParam(name = "moduleTypes", value = "模块类型多个用逗号分割1企业模块2项目后台模块3企业后台4项目看板", paramType = "body", required = false, dataType = "String"), @ApiImplicitParam(name = "moduleTypes", value = "模块类型多个用逗号分割1企业模块2项目后台模块3企业后台4项目看板", paramType = "body", required = false, dataType = "String"),
@ -144,10 +162,34 @@ public class BaseMenuController {
return Result.success(baseMenuService.getProjectModuleGroupMenuList(map)); return Result.success(baseMenuService.getProjectModuleGroupMenuList(map));
} }
@ApiOperation(value = "解决项目子账号的菜单按钮无法分配", notes = "解决项目子账号的菜单按钮无法分配", httpMethod="GET") @ApiOperation(value = "解决项目子账号的菜单按钮无法分配", notes = "解决项目子账号的菜单按钮无法分配", httpMethod = "GET")
@GetMapping(value = "/fixAuthDistribute") @GetMapping(value = "/fixAuthDistribute")
public Result fixAuthDistribute() { public Result fixAuthDistribute() {
baseMenuService.fixAuthDistribute(); baseMenuService.fixAuthDistribute();
return Result.ok(); return Result.ok();
} }
@ApiOperation(value = "所有账号都分配党建引领、阳光工程首页、用户中心、文档管理", notes = "所有账号都分配党建引领、阳光工程首页、用户中心、文档管理", httpMethod = "POST")
@PostMapping(value = "/grantFixedAuthority")
public Result grantFixedAuthority(@RequestBody Map<String, Object> map) {
List<BaseRole> roleList = baseRoleService.getProjectBaseRolePageList(new MapBuilder<String, Object>()
.put("projectSn", MapUtils.getString(map, "projectSn"))
.put("pageNo", 1)
.put("pageSize", -1)
.build()).getRecords();
List<String> authIds = Arrays.asList("149", "1857361972801216517", "1857361972801216518", "1857361972801216519", "1857361972801216520", "1857361972801216521", "1882030939467436033", "1877735641188544513", "1877344022396334082", "1828615037974118406", "1828615045519671300", "1828615045519671301", "1849007627789611009", "1828615036669689858", "1828615036669689859", "1828615036669689860");
for (BaseRole role : roleList) {
List<BaseAuthority> authorityList = baseAuthorityService.getRoleAuthorityList(new MapBuilder<String, Object>()
.put("roleId", role.getRoleId())
.build());
Set<String> aids = authorityList.stream().map(m -> Convert.toStr(m.getAuthorityId())).filter(Objects::nonNull).collect(Collectors.toSet());
aids.addAll(authIds);
baseAuthorityService.addAuthorityRole(new MapBuilder<String, Object>()
.put("roleId", role.getRoleId())
.put("authorityIds", StrUtil.join(",", aids))
.build());
}
return Result.ok();
}
} }

View File

@ -1,5 +1,6 @@
package com.zhgd.xmgl.modules.basicdata.service.impl; package com.zhgd.xmgl.modules.basicdata.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhgd.xmgl.constant.Cts; import com.zhgd.xmgl.constant.Cts;
@ -10,14 +11,17 @@ import com.zhgd.xmgl.modules.basicdata.entity.BaseMenu;
import com.zhgd.xmgl.modules.basicdata.mapper.BaseAuthorityMapper; import com.zhgd.xmgl.modules.basicdata.mapper.BaseAuthorityMapper;
import com.zhgd.xmgl.modules.basicdata.mapper.BaseAuthorityRoleMapper; import com.zhgd.xmgl.modules.basicdata.mapper.BaseAuthorityRoleMapper;
import com.zhgd.xmgl.modules.basicdata.service.IBaseActionService; import com.zhgd.xmgl.modules.basicdata.service.IBaseActionService;
import com.zhgd.xmgl.modules.basicdata.service.IBaseAuthorityRoleService;
import com.zhgd.xmgl.modules.basicdata.service.IBaseAuthorityService; import com.zhgd.xmgl.modules.basicdata.service.IBaseAuthorityService;
import com.zhgd.xmgl.modules.basicdata.service.IBaseMenuService; import com.zhgd.xmgl.modules.basicdata.service.IBaseMenuService;
import org.apache.commons.collections.MapUtils; import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -32,6 +36,9 @@ import java.util.Map;
public class BaseAuthorityServiceImpl extends ServiceImpl<BaseAuthorityMapper, BaseAuthority> implements IBaseAuthorityService { public class BaseAuthorityServiceImpl extends ServiceImpl<BaseAuthorityMapper, BaseAuthority> implements IBaseAuthorityService {
public static final String MENU = "menu"; public static final String MENU = "menu";
public static final String ACTION = "action"; public static final String ACTION = "action";
@Lazy
@Autowired
IBaseAuthorityRoleService baseAuthorityRoleService;
@Autowired @Autowired
private BaseAuthorityRoleMapper baseAuthorityRoleMapper; private BaseAuthorityRoleMapper baseAuthorityRoleMapper;
@Autowired @Autowired
@ -44,7 +51,7 @@ public class BaseAuthorityServiceImpl extends ServiceImpl<BaseAuthorityMapper, B
@Override @Override
public BaseAuthority saveOrUpdateAuthority(Long resourceId, String resourceType) { public BaseAuthority saveOrUpdateAuthority(Long resourceId, String resourceType) {
QueryWrapper<BaseAuthority> queryWrapper = buildQueryWrapper(resourceId, resourceType); QueryWrapper<BaseAuthority> queryWrapper = buildQueryWrapper(resourceId, resourceType);
BaseAuthority baseAuthority =baseAuthorityMapper.selectOne(queryWrapper); BaseAuthority baseAuthority = baseAuthorityMapper.selectOne(queryWrapper);
if (baseAuthority == null) { if (baseAuthority == null) {
baseAuthority = new BaseAuthority(); baseAuthority = new BaseAuthority();
} }
@ -67,6 +74,7 @@ public class BaseAuthorityServiceImpl extends ServiceImpl<BaseAuthorityMapper, B
} }
return baseAuthority; return baseAuthority;
} }
/** /**
* 构建权限对象 * 构建权限对象
* *
@ -84,10 +92,11 @@ public class BaseAuthorityServiceImpl extends ServiceImpl<BaseAuthorityMapper, B
} }
return queryWrapper; return queryWrapper;
} }
@Override @Override
public void removeAuthority(Long resourceId, String resourceType) { public void removeAuthority(Long resourceId, String resourceType) {
QueryWrapper<BaseAuthority> queryWrapper = buildQueryWrapper(resourceId, resourceType); QueryWrapper<BaseAuthority> queryWrapper = buildQueryWrapper(resourceId, resourceType);
BaseAuthority authority =baseAuthorityMapper.selectOne(queryWrapper); BaseAuthority authority = baseAuthorityMapper.selectOne(queryWrapper);
if (authority != null && authority.getAuthorityId() != null) { if (authority != null && authority.getAuthorityId() != null) {
QueryWrapper<BaseAuthorityRole> roleQueryWrapper = new QueryWrapper(); QueryWrapper<BaseAuthorityRole> roleQueryWrapper = new QueryWrapper();
roleQueryWrapper.lambda().eq(BaseAuthorityRole::getAuthorityId, authority.getAuthorityId()); roleQueryWrapper.lambda().eq(BaseAuthorityRole::getAuthorityId, authority.getAuthorityId());
@ -112,17 +121,21 @@ public class BaseAuthorityServiceImpl extends ServiceImpl<BaseAuthorityMapper, B
roleQueryWrapper.lambda().eq(BaseAuthorityRole::getRoleId, roleId); roleQueryWrapper.lambda().eq(BaseAuthorityRole::getRoleId, roleId);
baseAuthorityRoleMapper.delete(roleQueryWrapper); baseAuthorityRoleMapper.delete(roleQueryWrapper);
BaseAuthorityRole authority = null; BaseAuthorityRole authority = null;
List<BaseAuthorityRole> addAuths = new ArrayList<>();
String authorityIds = MapUtils.getString(map, "authorityIds"); String authorityIds = MapUtils.getString(map, "authorityIds");
if (authorityIds != null && authorityIds.length() > 0) { if (authorityIds != null && authorityIds.length() > 0) {
for (String id : authorityIds.split(Cts.COMMA)) { for (String id : authorityIds.split(Cts.COMMA)) {
if(StringUtils.isNotEmpty(id)) { if (StringUtils.isNotEmpty(id)) {
authority = new BaseAuthorityRole(); authority = new BaseAuthorityRole();
authority.setAuthorityId(Long.valueOf(id)); authority.setAuthorityId(Long.valueOf(id));
authority.setRoleId(Long.valueOf(roleId)); authority.setRoleId(Long.valueOf(roleId));
// 批量添加授权 // 批量添加授权
baseAuthorityRoleMapper.insert(authority); addAuths.add(authority);
} }
} }
if (CollUtil.isNotEmpty(addAuths)) {
baseAuthorityRoleService.saveBatch(addAuths);
}
} }

View File

@ -72,7 +72,7 @@ public class ConcreteMonitorCurrentDataServiceImpl extends ServiceImpl<ConcreteM
String projectSn = dev.getProjectSn(); String projectSn = dev.getProjectSn();
if (concreteMonitorCurrentDataVo.getList().size() > 0) { if (concreteMonitorCurrentDataVo.getList().size() > 0) {
for (ConcreteMonitorCurrentData currentData : concreteMonitorCurrentDataVo.getList()) { for (ConcreteMonitorCurrentData currentData : concreteMonitorCurrentDataVo.getList()) {
if (NumberUtil.equals(currentData.getTemperature(), -100D)) { if (currentData.getTemperature() == null || NumberUtil.equals(currentData.getTemperature(), -100D)) {
//忽略数据-100这个是特殊数据有两种情况第一种就是没有插传感器第二种就是传感器损坏如果接收到-100这种数据就判定为空数据 //忽略数据-100这个是特殊数据有两种情况第一种就是没有插传感器第二种就是传感器损坏如果接收到-100这种数据就判定为空数据
continue; continue;
} }

View File

@ -648,6 +648,7 @@ public class WorkerInfoServiceImpl extends ServiceImpl<WorkerInfoMapper, WorkerI
} }
} }
workerInfoMapper.update(null, new LambdaUpdateWrapper<WorkerInfo>() workerInfoMapper.update(null, new LambdaUpdateWrapper<WorkerInfo>()
.set(WorkerInfo::getDepartmentId, workerInfo.getDepartmentId())
.set(WorkerInfo::getBranchId, workerInfo.getBranchId()) .set(WorkerInfo::getBranchId, workerInfo.getBranchId())
.set(WorkerInfo::getProjectGroup, workerInfo.getProjectGroup()) .set(WorkerInfo::getProjectGroup, workerInfo.getProjectGroup())
.eq(WorkerInfo::getId, workerInfo.getId()) .eq(WorkerInfo::getId, workerInfo.getId())