From 8b2141437195c7ba97e0e84c366456eb41356ca3 Mon Sep 17 00:00:00 2001 From: huangdeliang Date: Thu, 15 Apr 2021 16:13:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=90=88=E4=BD=9C=E6=96=B9bu?= =?UTF-8?q?g?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/custom/SysCustomerController.java | 16 +++++++++++----- .../controller/custom/SysOrderController.java | 14 ++++++++++---- stdiet-ui/src/views/custom/customer/index.vue | 7 ++++++- stdiet-ui/src/views/custom/order/index.vue | 6 ++++-- 4 files changed, 31 insertions(+), 12 deletions(-) diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerController.java index 38508596e..a4660d826 100644 --- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerController.java +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerController.java @@ -3,6 +3,7 @@ package com.stdiet.web.controller.custom; import com.stdiet.common.annotation.Log; import com.stdiet.common.core.controller.BaseController; import com.stdiet.common.core.domain.AjaxResult; +import com.stdiet.common.core.domain.entity.SysUser; import com.stdiet.common.core.page.TableDataInfo; import com.stdiet.common.enums.BusinessType; import com.stdiet.common.utils.SecurityUtils; @@ -15,10 +16,10 @@ import com.stdiet.custom.service.ISysCustomerHealthyService; import com.stdiet.custom.service.ISysCustomerPhysicalSignsService; import com.stdiet.custom.service.ISysCustomerService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.access.SecurityConfig; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; +import java.util.ArrayList; import java.util.List; /** @@ -46,11 +47,16 @@ public class SysCustomerController extends BaseController { @GetMapping("/list") public TableDataInfo list(SysCustomer sysCustomer) { startPage(); - String remark = SecurityUtils.getLoginUser().getUser().getRemark(); - if (StringUtils.isNotEmpty(remark) && remark.contains("|") && sysCustomer.getChannelId() == null) { - sysCustomer.setChannels(remark.split("\\|")); + List list = new ArrayList<>(); + if (SecurityUtils.getLoginUser().getUser().getRoles().get(0).getRoleKey().equals("partner")) { + String remark = SecurityUtils.getLoginUser().getUser().getRemark(); + if (StringUtils.isEmpty(remark)) { + return getDataTable(list); + } else if (remark.contains("|") && sysCustomer.getChannelId() == null) { + sysCustomer.setChannels(remark.split("\\|")); + } } - List list = sysCustomerService.selectSysCustomerList(sysCustomer); + list = sysCustomerService.selectSysCustomerList(sysCustomer); if (list != null && list.size() > 0) { for (SysCustomer sysCus : list) { if (StringUtils.isNotEmpty(sysCus.getPhone())) { diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysOrderController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysOrderController.java index eb600ec82..c28140ea9 100644 --- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysOrderController.java +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysOrderController.java @@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.*; import java.math.BigDecimal; import java.net.URLDecoder; +import java.util.ArrayList; import java.util.List; /** @@ -49,12 +50,17 @@ public class SysOrderController extends OrderBaseController { public OrderTableDataInfo list(SysOrder sysOrder) { startPage(); dealOrderType(sysOrder); - String remark = SecurityUtils.getLoginUser().getUser().getRemark(); - if (StringUtils.isNotEmpty(remark) && remark.contains("|") && StringUtils.isEmpty(sysOrder.getAccount())) { - sysOrder.setAccRange(remark.split("\\|")); + List list = new ArrayList<>(); + if (SecurityUtils.getLoginUser().getUser().getRoles().get(0).getRoleKey().equals("partner")) { + String remark = SecurityUtils.getLoginUser().getUser().getRemark(); + if (StringUtils.isEmpty(remark)) { + return getOrderDataTable(list, new BigDecimal(0)); + } else if (remark.contains("|") && StringUtils.isEmpty(sysOrder.getAccount())) { + sysOrder.setAccRange(remark.split("\\|")); + } } - List list = sysOrderService.selectSysOrderList(sysOrder); + list = sysOrderService.selectSysOrderList(sysOrder); List userList = userService.selectAllUser(); BigDecimal totalAmount = sysOrderService.selectAllOrderAmount(sysOrder); if (totalAmount == null) { diff --git a/stdiet-ui/src/views/custom/customer/index.vue b/stdiet-ui/src/views/custom/customer/index.vue index 8a52153d7..a88be58b6 100644 --- a/stdiet-ui/src/views/custom/customer/index.vue +++ b/stdiet-ui/src/views/custom/customer/index.vue @@ -526,7 +526,7 @@ export default { this.fansChannelOptions = response.data; }); this.getDicts("cus_account").then((response) => { - if (this.userRemark && this.userRemark.includes("|")) { + if (this.isPartner) { const accRange = this.userRemark.split("|"); this.accountIdOptions = accRange.reduce((arr, accId) => { const tarObj = response.data.find((obj) => obj.dictValue === accId); @@ -542,6 +542,9 @@ export default { this.getList(); }, computed: { + isPartner() { + return this.roles && this.roles.includes("partner"); + }, ...mapGetters([ // 售前字典 "preSaleIdOptions", @@ -553,6 +556,8 @@ export default { "nutriAssisIdOptions", // "userRemark", + // + "roles", ]), }, methods: { diff --git a/stdiet-ui/src/views/custom/order/index.vue b/stdiet-ui/src/views/custom/order/index.vue index c6785c06c..16581d1f1 100644 --- a/stdiet-ui/src/views/custom/order/index.vue +++ b/stdiet-ui/src/views/custom/order/index.vue @@ -587,7 +587,7 @@ export default { return this.device === "mobile"; }, isPartner() { - return this.userRemark && this.userRemark.includes("|"); + return this.roles && this.roles.includes("partner"); }, ...mapGetters([ // 售前字典 @@ -611,6 +611,8 @@ export default { // "userRemark", // + "roles", + // "device", ]), }, @@ -620,7 +622,7 @@ export default { this.payTypeIdOptions = response.data; }); this.getDicts("cus_account").then((response) => { - if (this.userRemark && this.userRemark.includes("|")) { + if (this.isPartner) { const accRange = this.userRemark.split("|"); this.accountIdOptions = accRange.reduce((arr, accId) => { const tarObj = response.data.find((obj) => obj.dictValue === accId);