|
@ -46,6 +46,7 @@ import javax.servlet.http.HttpSession; |
|
|
import java.io.IOException; |
|
|
import java.io.IOException; |
|
|
import java.net.URLEncoder; |
|
|
import java.net.URLEncoder; |
|
|
import java.util.*; |
|
|
import java.util.*; |
|
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
import static com.ruoyi.common.config.datasource.DynamicDataSourceContextHolder.log; |
|
|
import static com.ruoyi.common.config.datasource.DynamicDataSourceContextHolder.log; |
|
|
|
|
|
|
|
@ -100,16 +101,63 @@ public class SysSalesOrderController extends BaseController |
|
|
@ResponseBody |
|
|
@ResponseBody |
|
|
public TableDataInfo list(SysSalesOrderVo sysSalesOrderVo) |
|
|
public TableDataInfo list(SysSalesOrderVo sysSalesOrderVo) |
|
|
{ |
|
|
{ |
|
|
SysUser curUser = ShiroUtils.getSysUser(); |
|
|
|
|
|
Long userId = curUser.getUserId(); |
|
|
|
|
|
Set<String> roleKeys = roleService.selectRoleKeys(userId); |
|
|
|
|
|
// 业务员角色只能看到自己创建的数据
|
|
|
|
|
|
if(roleKeys.contains("ywyRole")){ |
|
|
|
|
|
sysSalesOrderVo.setApplyUser(curUser.getLoginName()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
startPage(); |
|
|
startPage(); |
|
|
List<SysSalesOrderVo> list = sysSalesOrderService.selectSysSalesOrderList(sysSalesOrderVo); |
|
|
List<SysSalesOrderVo> list = sysSalesOrderService.selectSysSalesOrderList(sysSalesOrderVo); |
|
|
|
|
|
try { |
|
|
|
|
|
SysUser curUser = ShiroUtils.getSysUser(); |
|
|
|
|
|
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); |
|
|
|
|
|
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("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()); |
|
|
|
|
|
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){ |
|
|
|
|
|
throw new NullPointerException("当前用户没有申请客户资料"); |
|
|
|
|
|
} |
|
|
return getDataTable(list); |
|
|
return getDataTable(list); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -398,7 +446,7 @@ public class SysSalesOrderController extends BaseController |
|
|
public AjaxResult complete(@PathVariable("taskId") String taskId,@RequestParam(value = "saveEntity", required = false) String saveEntity, |
|
|
public AjaxResult complete(@PathVariable("taskId") String taskId,@RequestParam(value = "saveEntity", required = false) String saveEntity, |
|
|
@RequestParam(value = "salesOrderChildList", required = false) String salesOrderChildList, |
|
|
@RequestParam(value = "salesOrderChildList", required = false) String salesOrderChildList, |
|
|
@ModelAttribute("preloadObj") SysSalesOrderVo sysSalesOrderVo,HttpServletRequest request){ |
|
|
@ModelAttribute("preloadObj") SysSalesOrderVo sysSalesOrderVo,HttpServletRequest request){ |
|
|
System.out.println("taskId = " + taskId + ", saveEntity = " + saveEntity + ", salesOrderChildList = " + salesOrderChildList + ", sysSalesOrderVo = " + sysSalesOrderVo + ", request = " + request); |
|
|
// System.out.println("taskId = " + taskId + ", saveEntity = " + saveEntity + ", salesOrderChildList = " + salesOrderChildList + ", sysSalesOrderVo = " + sysSalesOrderVo + ", request = " + request);
|
|
|
sysSalesOrderVo.setSysSalesOrderChildList(JSON.parseArray(salesOrderChildList, SysSalesOrderChild.class)); |
|
|
sysSalesOrderVo.setSysSalesOrderChildList(JSON.parseArray(salesOrderChildList, SysSalesOrderChild.class)); |
|
|
boolean saveEntityBoolean = BooleanUtils.toBoolean(saveEntity); |
|
|
boolean saveEntityBoolean = BooleanUtils.toBoolean(saveEntity); |
|
|
if (saveEntityBoolean) { |
|
|
if (saveEntityBoolean) { |
|
|