|
|
@ -101,64 +101,33 @@ public class SysSalesOrderController extends BaseController |
|
|
|
@ResponseBody |
|
|
|
public TableDataInfo list(SysSalesOrderVo sysSalesOrderVo) |
|
|
|
{ |
|
|
|
startPage(); |
|
|
|
List<SysSalesOrderVo> list = sysSalesOrderService.selectSysSalesOrderList(sysSalesOrderVo); |
|
|
|
try { |
|
|
|
startPage(); |
|
|
|
List<SysSalesOrderVo> list = sysSalesOrderService.selectSysSalesOrderList(sysSalesOrderVo); |
|
|
|
SysUser curUser = ShiroUtils.getSysUser(); |
|
|
|
String loginName = ShiroUtils.getLoginName(); |
|
|
|
Long userId = curUser.getUserId(); |
|
|
|
Set<String> roleKeys = roleService.selectRoleKeys(userId); |
|
|
|
List<SysUser> sysUserlist = sysUserService.selectRoleToUserList("ywy"); |
|
|
|
if(roleKeys.contains("ywjlRole")){ |
|
|
|
sysUserlist = sysUserlist.stream().filter(item -> { |
|
|
|
return item.getDept().getDeptId() == curUser.getDeptId(); |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
List<SysUser> finalSysUserlist = sysUserlist; |
|
|
|
finalSysUserlist.add(curUser); |
|
|
|
List<SysUser> sysUserlist = sysUserService.selectRoleToUserList("ywyRole"); |
|
|
|
sysUserlist.add(curUser); |
|
|
|
if (roleKeys.contains("ywjlRole")) { |
|
|
|
List<SysUser> findUser = sysUserlist.stream().filter(item -> (item.getDeptId().equals(curUser.getDeptId()))).collect(Collectors.toList()); |
|
|
|
Set<String> user = findUser.stream().map(SysUser::getLoginName).collect(Collectors.toSet()); |
|
|
|
startPage(); |
|
|
|
list = list.stream().filter(item -> { |
|
|
|
for (SysUser sysUser : finalSysUserlist) { |
|
|
|
if (sysUser.getLoginName().equals(item.getApplyUser())) { |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
return false; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
|
|
return getDataTable(list); |
|
|
|
List<SysSalesOrderVo> list2 = list.stream().filter(item -> user.contains(item.getApplyUser())).collect(Collectors.toList()); |
|
|
|
return getDataTable(list2); |
|
|
|
} |
|
|
|
if(roleKeys.contains("ywzgRole")){ |
|
|
|
sysUserlist = sysUserlist.stream().filter(item -> { |
|
|
|
return item.getDept().getDeptId() == curUser.getDeptId(); |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
List<SysUser> finalSysUserlist = sysUserlist; |
|
|
|
finalSysUserlist.add(curUser); |
|
|
|
startPage(); |
|
|
|
list = list.stream().filter(item -> { |
|
|
|
for (SysUser sysUser : finalSysUserlist) { |
|
|
|
if (sysUser.getLoginName().equals(item.getApplyUser())) { |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
return false; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
return getDataTable(list); |
|
|
|
} |
|
|
|
// 业务员角色只能看到自己创建的数据
|
|
|
|
if(roleKeys.contains("ywyRole")){ |
|
|
|
sysSalesOrderVo.setApplyUser(curUser.getLoginName()); |
|
|
|
// 业务员角色只能看到自己创建的数据
|
|
|
|
if (roleKeys.contains("ywyRole")) { |
|
|
|
sysSalesOrderVo.setApplyUser(curUser.getUserName()); |
|
|
|
startPage(); |
|
|
|
list = sysSalesOrderService.selectSysSalesOrderList(sysSalesOrderVo); |
|
|
|
return getDataTable(list); |
|
|
|
} |
|
|
|
if(!roleKeys.contains("ywzjRole") && !roleKeys.contains("ywzjRole") && !roleKeys.contains("ywzjRole")){ |
|
|
|
sysSalesOrderVo.setApplyUser(curUser.getLoginName()); |
|
|
|
startPage(); |
|
|
|
list = sysSalesOrderService.selectSysSalesOrderList(sysSalesOrderVo); |
|
|
|
} |
|
|
|
}catch (NullPointerException e){ |
|
|
|
return getDataTable(list); |
|
|
|
}catch(NullPointerException e){ |
|
|
|
throw new NullPointerException("当前用户没有申请客户资料"); |
|
|
|
} |
|
|
|
return getDataTable(list); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|