!206 修复合作方bug

Merge pull request !206 from 德仔/develop
This commit is contained in:
德仔 2021-04-15 16:15:57 +08:00 committed by Gitee
commit 394524cbb3
4 changed files with 31 additions and 12 deletions

View File

@ -3,6 +3,7 @@ package com.stdiet.web.controller.custom;
import com.stdiet.common.annotation.Log; import com.stdiet.common.annotation.Log;
import com.stdiet.common.core.controller.BaseController; import com.stdiet.common.core.controller.BaseController;
import com.stdiet.common.core.domain.AjaxResult; 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.core.page.TableDataInfo;
import com.stdiet.common.enums.BusinessType; import com.stdiet.common.enums.BusinessType;
import com.stdiet.common.utils.SecurityUtils; 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.ISysCustomerPhysicalSignsService;
import com.stdiet.custom.service.ISysCustomerService; import com.stdiet.custom.service.ISysCustomerService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.SecurityConfig;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
@ -46,11 +47,16 @@ public class SysCustomerController extends BaseController {
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(SysCustomer sysCustomer) { public TableDataInfo list(SysCustomer sysCustomer) {
startPage(); startPage();
List<SysCustomer> list = new ArrayList<>();
if (SecurityUtils.getLoginUser().getUser().getRoles().get(0).getRoleKey().equals("partner")) {
String remark = SecurityUtils.getLoginUser().getUser().getRemark(); String remark = SecurityUtils.getLoginUser().getUser().getRemark();
if (StringUtils.isNotEmpty(remark) && remark.contains("|") && sysCustomer.getChannelId() == null) { if (StringUtils.isEmpty(remark)) {
return getDataTable(list);
} else if (remark.contains("|") && sysCustomer.getChannelId() == null) {
sysCustomer.setChannels(remark.split("\\|")); sysCustomer.setChannels(remark.split("\\|"));
} }
List<SysCustomer> list = sysCustomerService.selectSysCustomerList(sysCustomer); }
list = sysCustomerService.selectSysCustomerList(sysCustomer);
if (list != null && list.size() > 0) { if (list != null && list.size() > 0) {
for (SysCustomer sysCus : list) { for (SysCustomer sysCus : list) {
if (StringUtils.isNotEmpty(sysCus.getPhone())) { if (StringUtils.isNotEmpty(sysCus.getPhone())) {

View File

@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.net.URLDecoder; import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
@ -49,12 +50,17 @@ public class SysOrderController extends OrderBaseController {
public OrderTableDataInfo list(SysOrder sysOrder) { public OrderTableDataInfo list(SysOrder sysOrder) {
startPage(); startPage();
dealOrderType(sysOrder); dealOrderType(sysOrder);
List<SysOrder> list = new ArrayList<>();
if (SecurityUtils.getLoginUser().getUser().getRoles().get(0).getRoleKey().equals("partner")) {
String remark = SecurityUtils.getLoginUser().getUser().getRemark(); String remark = SecurityUtils.getLoginUser().getUser().getRemark();
if (StringUtils.isNotEmpty(remark) && remark.contains("|") && StringUtils.isEmpty(sysOrder.getAccount())) { if (StringUtils.isEmpty(remark)) {
return getOrderDataTable(list, new BigDecimal(0));
} else if (remark.contains("|") && StringUtils.isEmpty(sysOrder.getAccount())) {
sysOrder.setAccRange(remark.split("\\|")); sysOrder.setAccRange(remark.split("\\|"));
} }
}
List<SysOrder> list = sysOrderService.selectSysOrderList(sysOrder); list = sysOrderService.selectSysOrderList(sysOrder);
List<SysUser> userList = userService.selectAllUser(); List<SysUser> userList = userService.selectAllUser();
BigDecimal totalAmount = sysOrderService.selectAllOrderAmount(sysOrder); BigDecimal totalAmount = sysOrderService.selectAllOrderAmount(sysOrder);
if (totalAmount == null) { if (totalAmount == null) {

View File

@ -526,7 +526,7 @@ export default {
this.fansChannelOptions = response.data; this.fansChannelOptions = response.data;
}); });
this.getDicts("cus_account").then((response) => { this.getDicts("cus_account").then((response) => {
if (this.userRemark && this.userRemark.includes("|")) { if (this.isPartner) {
const accRange = this.userRemark.split("|"); const accRange = this.userRemark.split("|");
this.accountIdOptions = accRange.reduce((arr, accId) => { this.accountIdOptions = accRange.reduce((arr, accId) => {
const tarObj = response.data.find((obj) => obj.dictValue === accId); const tarObj = response.data.find((obj) => obj.dictValue === accId);
@ -542,6 +542,9 @@ export default {
this.getList(); this.getList();
}, },
computed: { computed: {
isPartner() {
return this.roles && this.roles.includes("partner");
},
...mapGetters([ ...mapGetters([
// //
"preSaleIdOptions", "preSaleIdOptions",
@ -553,6 +556,8 @@ export default {
"nutriAssisIdOptions", "nutriAssisIdOptions",
// //
"userRemark", "userRemark",
//
"roles",
]), ]),
}, },
methods: { methods: {

View File

@ -587,7 +587,7 @@ export default {
return this.device === "mobile"; return this.device === "mobile";
}, },
isPartner() { isPartner() {
return this.userRemark && this.userRemark.includes("|"); return this.roles && this.roles.includes("partner");
}, },
...mapGetters([ ...mapGetters([
// //
@ -611,6 +611,8 @@ export default {
// //
"userRemark", "userRemark",
// //
"roles",
//
"device", "device",
]), ]),
}, },
@ -620,7 +622,7 @@ export default {
this.payTypeIdOptions = response.data; this.payTypeIdOptions = response.data;
}); });
this.getDicts("cus_account").then((response) => { this.getDicts("cus_account").then((response) => {
if (this.userRemark && this.userRemark.includes("|")) { if (this.isPartner) {
const accRange = this.userRemark.split("|"); const accRange = this.userRemark.split("|");
this.accountIdOptions = accRange.reduce((arr, accId) => { this.accountIdOptions = accRange.reduce((arr, accId) => {
const tarObj = response.data.find((obj) => obj.dictValue === accId); const tarObj = response.data.find((obj) => obj.dictValue === accId);