From 8bc9ebe04c270134e64bcf7fd6ca30961a4ef95a Mon Sep 17 00:00:00 2001 From: zhangsiqi <2825463979@qq.com> Date: Thu, 25 Apr 2024 18:37:23 +0800 Subject: [PATCH] =?UTF-8?q?[update]=E9=94=80=E5=94=AE=E7=AE=A1=E7=90=86;?= =?UTF-8?q?=E9=94=80=E5=94=AE=E8=AE=A2=E5=8D=95=E5=88=92=E5=88=86=E8=A7=92?= =?UTF-8?q?=E8=89=B2=E6=9D=83=E9=99=90=EF=BC=8C=E6=9F=A5=E8=AF=A2=E5=AF=B9?= =?UTF-8?q?=E8=B1=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/SysSalesOrderController.java | 66 ++++++++++++++++--- .../templates/system/salesOrder/add.html | 2 + .../templates/system/salesOrder/edit.html | 18 ++--- 3 files changed, 68 insertions(+), 18 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSalesOrderController.java b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSalesOrderController.java index 60900492..fd3692fb 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSalesOrderController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSalesOrderController.java @@ -46,6 +46,7 @@ import javax.servlet.http.HttpSession; import java.io.IOException; import java.net.URLEncoder; import java.util.*; +import java.util.stream.Collectors; import static com.ruoyi.common.config.datasource.DynamicDataSourceContextHolder.log; @@ -100,16 +101,63 @@ public class SysSalesOrderController extends BaseController @ResponseBody public TableDataInfo list(SysSalesOrderVo sysSalesOrderVo) { - SysUser curUser = ShiroUtils.getSysUser(); - Long userId = curUser.getUserId(); - Set roleKeys = roleService.selectRoleKeys(userId); - // 业务员角色只能看到自己创建的数据 - if(roleKeys.contains("ywyRole")){ - sysSalesOrderVo.setApplyUser(curUser.getLoginName()); - } - startPage(); List list = sysSalesOrderService.selectSysSalesOrderList(sysSalesOrderVo); + try { + SysUser curUser = ShiroUtils.getSysUser(); + Long userId = curUser.getUserId(); + Set roleKeys = roleService.selectRoleKeys(userId); + List sysUserlist = sysUserService.selectRoleToUserList("ywy"); + if(roleKeys.contains("ywjlRole")){ + sysUserlist = sysUserlist.stream().filter(item -> { + return item.getDept().getDeptId() == curUser.getDeptId(); + }).collect(Collectors.toList()); + List 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 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); } @@ -398,7 +446,7 @@ public class SysSalesOrderController extends BaseController public AjaxResult complete(@PathVariable("taskId") String taskId,@RequestParam(value = "saveEntity", required = false) String saveEntity, @RequestParam(value = "salesOrderChildList", required = false) String salesOrderChildList, @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)); boolean saveEntityBoolean = BooleanUtils.toBoolean(saveEntity); if (saveEntityBoolean) { diff --git a/ruoyi-admin/src/main/resources/templates/system/salesOrder/add.html b/ruoyi-admin/src/main/resources/templates/system/salesOrder/add.html index 79ac644c..c56222ff 100644 --- a/ruoyi-admin/src/main/resources/templates/system/salesOrder/add.html +++ b/ruoyi-admin/src/main/resources/templates/system/salesOrder/add.html @@ -640,6 +640,8 @@ }); $("input[name='taxRate']").val(data.taxRate); $("input[name='confirmFax']").val(data.confirmTax); + $("select[name='customerContact']").val(data.customerContact).trigger('change'); + $("select[name='customerDelivery']").val(data.customerDelivery).trigger('change'); $("#commonCurrency_add").val(data.commonCurrency).trigger('change'); commonCurrency = $("#commonCurrency_add option:selected").val(); console.log("commonCurrency",commonCurrency); diff --git a/ruoyi-admin/src/main/resources/templates/system/salesOrder/edit.html b/ruoyi-admin/src/main/resources/templates/system/salesOrder/edit.html index 2a29bcc7..eefdefa5 100644 --- a/ruoyi-admin/src/main/resources/templates/system/salesOrder/edit.html +++ b/ruoyi-admin/src/main/resources/templates/system/salesOrder/edit.html @@ -96,13 +96,13 @@
- +
- +
@@ -175,7 +175,7 @@
@@ -191,23 +191,23 @@
- +
- +
- +
-
@@ -265,7 +265,7 @@
-