bug修复

This commit is contained in:
guo 2024-04-12 18:27:24 +08:00
parent d2a26b02ec
commit 5d1cf14e76
5 changed files with 42 additions and 17 deletions

View File

@ -187,6 +187,7 @@ public class BaseModuleController {
@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 = "userId", value = "用户id", paramType = "body", required = true, dataType = "String"),
}) })
@PostMapping(value = "/getModuleAndMenuList") @PostMapping(value = "/getModuleAndMenuList")
public Result<Map<String, Object>> getModuleAndMenuList(@ApiIgnore @RequestBody HashMap<String, Object> paramMap) { public Result<Map<String, Object>> getModuleAndMenuList(@ApiIgnore @RequestBody HashMap<String, Object> paramMap) {

View File

@ -59,6 +59,7 @@ public class OperationLogController {
@ApiImplicitParam(name = "operModul", value = "功能模块", paramType = "body", required = false, dataType = "String"), @ApiImplicitParam(name = "operModul", value = "功能模块", paramType = "body", required = false, dataType = "String"),
@ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "body", required = true, dataType = "Integer"), @ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "body", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "body", required = true, dataType = "Integer"), @ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "body", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "operUserId", value = "项目子账号传用户id", paramType = "body", required = true, dataType = "Integer"),
}) })
@PostMapping(value = "/list") @PostMapping(value = "/list")
public Result<IPage<OperationLog>> queryPageList(@RequestBody Map<String, Object> map) { public Result<IPage<OperationLog>> queryPageList(@RequestBody Map<String, Object> map) {

View File

@ -14,19 +14,19 @@
Left JOIN company cf ON cp.parent_id=cf.company_id Left JOIN company cf ON cp.parent_id=cf.company_id
<where> <where>
<if test="param.companyType == '1'.toString()"> <if test="param.companyType == '1'.toString()">
(cp.headquarters_sn=#{param.sn} OR pb.headquarters_sn=#{param.sn}) and (cp.headquarters_sn=#{param.sn} OR pb.headquarters_sn=#{param.sn})
</if> </if>
<if test="param.companyType == '2'.toString()"> <if test="param.companyType == '2'.toString()">
(b.sn=#{param.sn} OR f.company_sn=#{param.sn} or cf.company_sn=#{param.sn}) and (b.sn=#{param.sn} OR f.company_sn=#{param.sn} or cf.company_sn=#{param.sn})
</if> </if>
<if test="param.companyType == '3'.toString()"> <if test="param.companyType == '3'.toString()">
(b.sn=#{param.sn} OR pb.company_sn=#{param.sn}) and (b.sn=#{param.sn} OR pb.company_sn=#{param.sn})
</if> </if>
<if test="param.companyType == '4'.toString()"> <if test="param.companyType == '4'.toString()">
(b.sn=#{param.sn}) and (b.sn=#{param.sn})
</if> </if>
<if test="param.companyType == '5'.toString()"> <if test="param.companyType == '5'.toString()">
(b.sn=#{param.sn} OR py.company_sn=#{param.sn}) and (b.sn=#{param.sn} OR py.company_sn=#{param.sn})
</if> </if>
<if test="param.userName != null and param.userName != ''"> <if test="param.userName != null and param.userName != ''">
and b.real_name like CONCAT(CONCAT('%',#{param.userName}),'%') and b.real_name like CONCAT(CONCAT('%',#{param.userName}),'%')
@ -43,6 +43,9 @@
<if test="param.endTime != null and param.endTime != ''"> <if test="param.endTime != null and param.endTime != ''">
AND a.oper_create_time &lt;=CONCAT(DATE_FORMAT(#{param.endTime},'%Y-%m-%d'),' 23:59:59') AND a.oper_create_time &lt;=CONCAT(DATE_FORMAT(#{param.endTime},'%Y-%m-%d'),' 23:59:59')
</if> </if>
<if test="param.operUserId != null and param.operUserId != ''">
and b.user_id like CONCAT(CONCAT('%',#{param.operUserId}),'%')
</if>
</where> </where>
ORDER BY oper_create_time DESC ORDER BY oper_create_time DESC
</select> </select>

View File

@ -8,10 +8,12 @@ import com.zhgd.jeecg.common.execption.OpenAlertException;
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.CompanyConfig; import com.zhgd.xmgl.modules.basicdata.entity.CompanyConfig;
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
import com.zhgd.xmgl.modules.basicdata.entity.dto.ModuleListPageDto; import com.zhgd.xmgl.modules.basicdata.entity.dto.ModuleListPageDto;
import com.zhgd.xmgl.modules.basicdata.mapper.BaseMenuMapper; import com.zhgd.xmgl.modules.basicdata.mapper.BaseMenuMapper;
import com.zhgd.xmgl.modules.basicdata.mapper.BaseModuleMapper; import com.zhgd.xmgl.modules.basicdata.mapper.BaseModuleMapper;
import com.zhgd.xmgl.modules.basicdata.mapper.CompanyConfigMapper; import com.zhgd.xmgl.modules.basicdata.mapper.CompanyConfigMapper;
import com.zhgd.xmgl.modules.basicdata.mapper.SystemUserMapper;
import com.zhgd.xmgl.modules.basicdata.service.IBaseAuthorityService; import com.zhgd.xmgl.modules.basicdata.service.IBaseAuthorityService;
import com.zhgd.xmgl.modules.basicdata.service.IBaseModuleService; import com.zhgd.xmgl.modules.basicdata.service.IBaseModuleService;
import org.apache.commons.collections.MapUtils; import org.apache.commons.collections.MapUtils;
@ -22,6 +24,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -38,6 +41,8 @@ public class BaseModuleServiceImpl extends ServiceImpl<BaseModuleMapper, BaseMod
@Autowired @Autowired
private BaseMenuMapper baseMenuMapper; private BaseMenuMapper baseMenuMapper;
@Autowired @Autowired
private SystemUserMapper systemUserMapper;
@Autowired
private SystemUserServiceImpl systemUserService; private SystemUserServiceImpl systemUserService;
@Autowired @Autowired
private CompanyConfigMapper companyConfigMapper; private CompanyConfigMapper companyConfigMapper;
@ -115,11 +120,20 @@ public class BaseModuleServiceImpl extends ServiceImpl<BaseModuleMapper, BaseMod
public Map<String, Object> getModuleAndMenuList(HashMap<String, Object> paramMap) { public Map<String, Object> getModuleAndMenuList(HashMap<String, Object> paramMap) {
String projectSn = MapUtils.getString(paramMap, "projectSn"); String projectSn = MapUtils.getString(paramMap, "projectSn");
Integer moduleType = MapUtils.getInteger(paramMap, "moduleType"); Integer moduleType = MapUtils.getInteger(paramMap, "moduleType");
String userId = MapUtils.getString(paramMap, "userId");
SystemUser systemUser = systemUserMapper.selectById(userId);
if (systemUser == null) {
throw new OpenAlertException("账号不存在");
}
CompanyConfig companyConfig = companyConfigMapper.getCompanyConfigByProject(projectSn); CompanyConfig companyConfig = companyConfigMapper.getCompanyConfigByProject(projectSn);
if (companyConfig == null) { if (companyConfig == null) {
throw new OpenAlertException("企业配置不存在"); throw new OpenAlertException("企业配置不存在");
} }
Map<String, Object> menuAuthority = systemUserService.getUserAuthority(null, 5, projectSn, companyConfig.getHeadquartersSn(), companyConfig.getStyleType(), moduleType); if (Objects.equals(systemUser.getAccountType(), 10)) {
return menuAuthority; return systemUserService.getUserAuthority(null, 5, projectSn, companyConfig.getHeadquartersSn(), companyConfig.getStyleType(), moduleType);
} else if (Objects.equals(systemUser.getAccountType(), 5) || Objects.equals(systemUser.getAccountType(), 6)) {
return systemUserService.getUserAuthority(Long.valueOf(userId), systemUser.getAccountType(), projectSn, companyConfig.getHeadquartersSn(), companyConfig.getStyleType(), moduleType);
}
return null;
} }
} }

View File

@ -73,7 +73,7 @@ public class XzProjectOrgServiceImpl extends ServiceImpl<XzProjectOrgMapper, XzP
XzProjectOrg pOrg = xzProjectOrgMapper.selectOne(new LambdaQueryWrapper<XzProjectOrg>() XzProjectOrg pOrg = xzProjectOrgMapper.selectOne(new LambdaQueryWrapper<XzProjectOrg>()
.eq(XzProjectOrg::getId, xzProjectOrg.getParentId())); .eq(XzProjectOrg::getId, xzProjectOrg.getParentId()));
if (Objects.equals(pOrg.getStatus(), 1)) { if (Objects.equals(pOrg.getStatus(), 1)) {
throw new OpenAlertException("部门状态为停用,无法添加下级"); throw new OpenAlertException("父级部门状态为停用,无法添加下级");
} }
if (pOrg != null) { if (pOrg != null) {
xzProjectOrg.setAncestors(pOrg.getAncestors() + "," + pOrg.getId()); xzProjectOrg.setAncestors(pOrg.getAncestors() + "," + pOrg.getId());
@ -165,6 +165,12 @@ public class XzProjectOrgServiceImpl extends ServiceImpl<XzProjectOrgMapper, XzP
.filter(m -> m.getParentId() == 0) .filter(m -> m.getParentId() == 0)
.peek(m -> m.setChildren(getChildren(m, allList)))//peek执行类似map但操作之后的数据并不返回到Stream中 .peek(m -> m.setChildren(getChildren(m, allList)))//peek执行类似map但操作之后的数据并不返回到Stream中
.collect(Collectors.toList()); .collect(Collectors.toList());
treeList.sort((o1, o2) -> {
if (o1.getOrderNum() == null || o2.getOrderNum() == null) {
return 0;
}
return o1.getOrderNum().compareTo(o2.getOrderNum());
});
} }
return treeList; return treeList;
} }