change - 首页监控单元数量统计修改

main
wenjy 3 years ago
parent e12f665a83
commit 5262d2ad6f

@ -70,6 +70,7 @@ public class IndexController {
SysUser sysUser = ShiroUtils.getSysUser(); SysUser sysUser = ShiroUtils.getSysUser();
List<SysRole> sysRoles = iSysRoleService.selectRolesByUserId(sysUser.getUserId()); List<SysRole> sysRoles = iSysRoleService.selectRolesByUserId(sysUser.getUserId());
if(!ShiroUtils.getLoginName().equals("admin")){
for (SysRole sysRole : sysRoles) { for (SysRole sysRole : sysRoles) {
// //
BaseMonitorunitInfo baseMonitorunitInfo = new BaseMonitorunitInfo(); BaseMonitorunitInfo baseMonitorunitInfo = new BaseMonitorunitInfo();
@ -78,6 +79,11 @@ public class IndexController {
baseMonitorunitInfoService.selectBaseMonitorunitInfoDtoList(baseMonitorunitInfo); baseMonitorunitInfoService.selectBaseMonitorunitInfoDtoList(baseMonitorunitInfo);
baseMonitorunitInfoDtoList.addAll(baseMonitorunitInfoDtos); baseMonitorunitInfoDtoList.addAll(baseMonitorunitInfoDtos);
} }
}else{
List<BaseMonitorunitInfoDto> baseMonitorunitInfoDtos =
baseMonitorunitInfoService.selectBaseMonitorunitInfoDtoList(new BaseMonitorunitInfo());
baseMonitorunitInfoDtoList.addAll(baseMonitorunitInfoDtos);
}
baseMonitorunitTypes.forEach( baseMonitorunitTypes.forEach(
x -> { x -> {
@ -154,6 +160,8 @@ public class IndexController {
SysUser sysUser = ShiroUtils.getSysUser(); SysUser sysUser = ShiroUtils.getSysUser();
List<SysRole> sysRoles = iSysRoleService.selectRolesByUserId(sysUser.getUserId()); List<SysRole> sysRoles = iSysRoleService.selectRolesByUserId(sysUser.getUserId());
if(!ShiroUtils.getLoginName().equals("admin")){
for (SysRole sysRole : sysRoles) { for (SysRole sysRole : sysRoles) {
// //
BaseMonitorunitInfo baseMonitorunitInfo = new BaseMonitorunitInfo(); BaseMonitorunitInfo baseMonitorunitInfo = new BaseMonitorunitInfo();
@ -162,28 +170,42 @@ public class IndexController {
baseMonitorunitInfoService.selectBaseMonitorunitInfoDtoList(baseMonitorunitInfo); baseMonitorunitInfoService.selectBaseMonitorunitInfoDtoList(baseMonitorunitInfo);
baseMonitorunitInfoDtoList.addAll(baseMonitorunitInfoDtos); baseMonitorunitInfoDtoList.addAll(baseMonitorunitInfoDtos);
} }
baseMonitorunitTypes.forEach( }else {
x -> { List<BaseMonitorunitInfoDto> baseMonitorunitInfoDtos =
List<BaseMonitorunitInfoDto> collect = baseMonitorunitInfoService.selectBaseMonitorunitInfoDtoList(new BaseMonitorunitInfo());
baseMonitorunitInfoDtoList.addAll(baseMonitorunitInfoDtos);
}
for (BaseMonitorunitType baseMonitorunitType : baseMonitorunitTypes) {
List<BaseMonitorunitInfoDto> baseMonitorunitInfoDtoList1 =
baseMonitorunitInfoDtoList.stream() baseMonitorunitInfoDtoList.stream()
.filter( .filter(
y -> y ->!y.getParentId().isEmpty()&& y.getMonitorunitType().equals(baseMonitorunitType.getMonitorunittypeId()))
!y.getParentId().isEmpty()
&& y.getMonitorunitType().equals(x.getMonitorunittypeId()))
.collect(Collectors.toList());
List<BaseMonitorunitInfoDto> collect2 =
collect.stream()
.filter(z -> z.getMonitorunitStatus().equals(0))
.collect(Collectors.toList()); .collect(Collectors.toList());
if(baseMonitorunitInfoDtoList1.size() > 0){
/*List<BaseMonitorunitInfoDto> collect2 =
baseMonitorunitInfoDtoList1.stream().filter(z -> z.getMonitorunitStatus().equals(0L)).collect(Collectors.toList());*/
//List<Long> longList = baseMonitorunitInfoDtoList1.stream().filter(z -> z.getMonitorunitStatus().equals(0L)).map(BaseMonitorunitInfoDto::getMonitorunitStatus).collect(Collectors.toList());
data.add( data.add(
new ArrayList<String>() { new ArrayList<String>() {
{ {
this.add(x.getMonitorunittypeName()); this.add(baseMonitorunitType.getMonitorunittypeName());
this.add(collect.size() + ""); this.add(baseMonitorunitInfoDtoList1.size() + "");
this.add(collect2.size() + ""); this.add(0 + "");
} }
}); });
}else{
data.add(
new ArrayList<String>() {
{
this.add(baseMonitorunitType.getMonitorunittypeName());
this.add(0 + "");
this.add(0 + "");
}
}); });
}
}
return JSONArray.toJSONString(new ScrollTableDto(header, data)); return JSONArray.toJSONString(new ScrollTableDto(header, data));
} catch (Exception ex) { } catch (Exception ex) {

Loading…
Cancel
Save