|
@ -80,25 +80,28 @@ public class AuthContextUtils { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public static BmsSupplier getCurrentSupplier(){ |
|
|
public static BmsSupplier getCurrentSupplier(){ |
|
|
|
|
|
String userId = AuthContextUtils.getSysUserId(); |
|
|
Long supplierId = AuthContextUtils.getSupplierId(); |
|
|
Long supplierId = AuthContextUtils.getSupplierId(); |
|
|
BmsSupplierService supplierService = SpringUtils.getBean(BmsSupplierService.class); |
|
|
BmsSupplierService supplierService = SpringUtils.getBean(BmsSupplierService.class); |
|
|
WxUserService wxUserService = SpringUtils.getBean(WxUserService.class); |
|
|
|
|
|
WxUser wxUser = wxUserService.getCurrentWxUser(); |
|
|
|
|
|
BmsSupplier supplier = supplierService.getById(supplierId); |
|
|
BmsSupplier supplier = supplierService.getById(supplierId); |
|
|
|
|
|
if(supplier==null){ |
|
|
|
|
|
Assert.throwEx(4106,"供应商无效或未授权"); |
|
|
|
|
|
} |
|
|
boolean isOther = false; |
|
|
boolean isOther = false; |
|
|
|
|
|
|
|
|
if(CollectionUtil.isNotEmpty(supplier.getOtherUserIds())){ |
|
|
if(CollectionUtil.isNotEmpty(supplier.getOtherUserIds())){ |
|
|
for (String otherUserId : supplier.getOtherUserIds()) { |
|
|
for (String otherUserId : supplier.getOtherUserIds()) { |
|
|
if(wxUser.getSysUserId().equals(otherUserId)){ |
|
|
if(userId.equals(otherUserId)){ |
|
|
isOther = true; |
|
|
isOther = true; |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if(isOther && !supplier.getUserId().equals(wxUser.getSysUserId())){ |
|
|
if(isOther && !supplier.getUserId().equals(userId)){ |
|
|
Assert.throwEx("供应商无效或未授权"); |
|
|
Assert.throwEx(4106,"供应商无效或未授权"); |
|
|
} |
|
|
} |
|
|
if(supplier.getStopFlag().equals(1)){ |
|
|
if(supplier.getStopFlag().equals(1)){ |
|
|
Assert.throwEx("供应商已停用"); |
|
|
Assert.throwEx(4106,"供应商已停用"); |
|
|
} |
|
|
} |
|
|
return supplier; |
|
|
return supplier; |
|
|
} |
|
|
} |
|
|