Commit 737eab7a by 杨树贤

Merge branch 'ysx-供应商-芯链账号列表-权限优化-20250902' into Dev

parents 4539a679 87e74ab2
...@@ -103,7 +103,7 @@ class ExternalApiController extends Controller ...@@ -103,7 +103,7 @@ class ExternalApiController extends Controller
if (empty($supplierId)) { if (empty($supplierId)) {
$this->externalResponse(-1, '供应商ID不能为空'); $this->externalResponse(-1, '供应商ID不能为空');
} }
$supplierAccount = SupplierAccountModel::where('supplier_id', $supplierId)->first(); $supplierAccount = SupplierAccountModel::where('supplier_id', $supplierId)->where('a_status', 1)->first();
if ($supplierAccount) { if ($supplierAccount) {
$this->externalResponse(0, 'ok', '有芯链账号'); $this->externalResponse(0, 'ok', '有芯链账号');
} }
......
...@@ -715,6 +715,10 @@ class SupplierApiController extends Controller ...@@ -715,6 +715,10 @@ class SupplierApiController extends Controller
//删除redis状态 //删除redis状态
$redis->hdel('supplier_status_before_disable', $supplierId); $redis->hdel('supplier_status_before_disable', $supplierId);
$logService = new LogService(); $logService = new LogService();
SupplierChannelModel::where('supplier_id', $supplierId)->update([
'disable_reason' => '',
'update_time' => time(),
]);
$logService->AddLog($supplierId, LogModel::UPDATE_OPERATE, '取消禁用', '取消禁用供应商'); $logService->AddLog($supplierId, LogModel::UPDATE_OPERATE, '取消禁用', '取消禁用供应商');
$this->response(0, '取消禁用成功'); $this->response(0, '取消禁用成功');
} else { } else {
......
...@@ -18,7 +18,7 @@ class SupplierAccountFilter ...@@ -18,7 +18,7 @@ class SupplierAccountFilter
$map = $request->all(); $map = $request->all();
$model = new SupplierAccountModel(); $model = new SupplierAccountModel();
$query = $model->with('supplier')->where('parent_id', 0)->orderBy('id', 'desc'); $query = $model->with('supplier')->where('parent_id', 0)->orderBy('id', 'desc');
$codeId = $request->user->codeId;
if (!checkPerm('ViewAllSupplierAccount')) { if (!checkPerm('ViewAllSupplierAccount')) {
if (checkPerm('ViewSubSupplierAccount')) { if (checkPerm('ViewSubSupplierAccount')) {
$departmentService = new DepartmentService(); $departmentService = new DepartmentService();
...@@ -27,11 +27,12 @@ class SupplierAccountFilter ...@@ -27,11 +27,12 @@ class SupplierAccountFilter
$adminUserService = new AdminUserService(); $adminUserService = new AdminUserService();
$subordinateCodeIds = $adminUserService->getCodeIdsByUserIds($subordinateUserIds); $subordinateCodeIds = $adminUserService->getCodeIdsByUserIds($subordinateUserIds);
$subordinateCodeIds = $subordinateCodeIds->toArray(); $subordinateCodeIds = $subordinateCodeIds->toArray();
$supplierIds = SupplierChannelModel::whereIn('yunxin_channel_uid', $subordinateCodeIds)->pluck('supplier_id')->toArray(); $likeSqlRaw = implode('|', $subordinateCodeIds);
$supplierIds = SupplierChannelModel::whereRaw(DB::raw("(channel_uid REGEXP '$likeSqlRaw')"))->pluck('supplier_id')->toArray();
$query->whereIn('supplier_id', $supplierIds); $query->whereIn('supplier_id', $supplierIds);
} else { } else {
//否则只能查看自己的 //否则只能查看自己的
$supplierIds = SupplierChannelModel::where('yunxin_channel_uid', $request->user->codeId)->pluck('supplier_id')->toArray(); $supplierIds = SupplierChannelModel::whereRaw(DB::raw("(yunxin_channel_uid REGEXP '$codeId')"))->pluck('supplier_id')->toArray();
$query->whereIn('supplier_id', $supplierIds); $query->whereIn('supplier_id', $supplierIds);
} }
} }
......
...@@ -223,7 +223,7 @@ class SupplierFilter ...@@ -223,7 +223,7 @@ class SupplierFilter
//搜索是否有供应商账号 //搜索是否有供应商账号
if (!empty($map['has_supplier_account'])) { if (!empty($map['has_supplier_account'])) {
$supplierIds = SupplierAccountModel::query()->pluck('supplier_id')->toArray(); $supplierIds = SupplierAccountModel::query()->where('a_status', 1)->pluck('supplier_id')->toArray();
$query->whereIn('supplier_id', $supplierIds); $query->whereIn('supplier_id', $supplierIds);
} }
......
...@@ -322,8 +322,8 @@ class SyncSupplierService ...@@ -322,8 +322,8 @@ class SyncSupplierService
//判断是否是同名多供应商,如果是的话,如果是之前已经禁用的,则直接跳过 //判断是否是同名多供应商,如果是的话,如果是之前已经禁用的,则直接跳过
if (count($suppliers) > 1) { if (count($suppliers) > 1) {
if ($supplier['status'] == SupplierChannelModel::STATUS_DISABLE && ($supplier['is_entity'] != SupplierChannelModel::IS_ENTITY_NEED_CONFIRM && $supplier['is_entity'] != SupplierChannelModel::IS_ENTITY_TRUE)) { if ($supplier['status'] == SupplierChannelModel::STATUS_DISABLE && ($supplier['is_entity'] != SupplierChannelModel::IS_ENTITY_NEED_CONFIRM && $supplier['is_entity'] != SupplierChannelModel::IS_ENTITY_TRUE)) {
Log::warning("检测到同名供应商并且属于禁用(实体名单不为待处理并且也不为实体名单)状态,跳过,供应商id为 : " . $supplier['supplier_id']); Log::warning("检测到同名供应商并且属于禁用(实体名单不为待处理并且也不为实体名单)状态,供应商id为 : " . $supplier['supplier_id']);
continue; // continue;
} }
} }
//判断是否是人工禁用的,是的话,也跳过 //判断是否是人工禁用的,是的话,也跳过
...@@ -332,6 +332,12 @@ class SyncSupplierService ...@@ -332,6 +332,12 @@ class SyncSupplierService
Log::warning("检测到供应商并且属于禁用(人工禁用)状态,跳过,供应商id为 : " . $supplier['supplier_id']); Log::warning("检测到供应商并且属于禁用(人工禁用)状态,跳过,供应商id为 : " . $supplier['supplier_id']);
continue; continue;
} }
if (strpos($supplier['disable_reason'], '人工禁用') !== false) {
Log::warning("检测到供应商并且属于禁用(人工禁用新)状态,跳过,供应商id为 : " . $supplier['supplier_id']);
continue;
}
$originIsEntity = $supplier['is_entity']; $originIsEntity = $supplier['is_entity'];
//$supplier = $supplier->toArray(); //$supplier = $supplier->toArray();
$supplierId = $supplier['supplier_id']; $supplierId = $supplier['supplier_id'];
...@@ -358,7 +364,8 @@ class SyncSupplierService ...@@ -358,7 +364,8 @@ class SyncSupplierService
$preStatus = SupplierChannelModel::STATUS_IN_REVIEW; $preStatus = SupplierChannelModel::STATUS_IN_REVIEW;
} }
//修改供应商的状态 //修改供应商的状态
SupplierChannelModel::where('supplier_id', $supplierId)->update([ SupplierChannelModel::where('supplier_id', $supplierId)
->update([
'is_entity' => $isEntityResult, 'is_entity' => $isEntityResult,
'update_time' => time(), 'update_time' => time(),
//这里的逻辑是,因为取消实体名单以后,如果之前的状态是黑名单的话,直接变成待提审 //这里的逻辑是,因为取消实体名单以后,如果之前的状态是黑名单的话,直接变成待提审
......
...@@ -188,7 +188,7 @@ ...@@ -188,7 +188,7 @@
align: 'center', align: 'center',
width: 120, width: 120,
templet: function (data) { templet: function (data) {
return data.yunxin_account ? '是' : '否'; return data.yunxin_account ? ( data.yunxin_account.a_status == 1?'是':'否') : '否';
} }
}, },
//通过芯链上传合同 //通过芯链上传合同
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment