Commit e5a97e7d by 杨树贤

解决冲突

parents 9898f02a c3643f04
......@@ -38,7 +38,7 @@ class SetSupplierFollowUp extends Command
// $service->importSupplierGroup(true);
// $service->changeSupplierType();
// $service->generateYunxinAccount(true);
$service->dealYunxinAccountCreateTime();
$service->exportSupplierForUnionData();
// $service->makeSupplierSystemTagAbnormal();
}
}
......@@ -20,6 +20,14 @@ class AdminUserService
return $userInfoModel->where('userId', $adminId)->first();
}
public function getAdminUserListByCodeIds($codeIds = [])
{
$intraCodeModel = new IntracodeModel();
$userInfoModel = new UserInfoModel();
$adminIds = $intraCodeModel->whereIn('code_id', $codeIds)->pluck('admin_id');
return $userInfoModel->whereIn('userId', $adminIds)->get()->toArray();
}
public function getCodeIdByUserName($userName)
{
$userId = UserInfoModel::where('name', $userName)->value('userId');
......@@ -54,7 +62,7 @@ class AdminUserService
{
$userInfoModel = new UserInfoModel();
$count = $userInfoModel->leftJoin('lie_intracode', 'user_info.userId', '=', 'lie_intracode.admin_id')
->where('lie_intracode.code_id',$codeId)
->where('lie_intracode.code_id', $codeId)
->where('user_info.status', 4)->where('lie_intracode.code_id', '!=', '')->count();
return (bool)$count;
}
......
......@@ -5,6 +5,7 @@ namespace App\Http\Services;
//后台用户相关信息服务
use App\Http\Transformers\SupplierContactTransformer;
use App\Http\Transformers\SupplierTransformer;
use App\Model\DepartmentModel;
use App\Model\IntracodeModel;
use App\Model\LogModel;
use App\Model\RedisModel;
......@@ -461,6 +462,61 @@ class DataService
}
}
}
}
//导出供应商
public function exportSupplierForUnionData()
{
$suppliers = SupplierChannelModel::select([
'supplier_id',
'supplier_code',
'supplier_name',
'channel_uid',
'create_time',
])->where('is_type', 0)
->whereRaw('supplier_name NOT LIKE "%-1"')->get();
$excelData = [];
$header = [
'ID',
'原系统供应商名称',
'标准供应商名称',
'创建时间',
'采购',
'部门组别',
'所有采购',
];
foreach ($suppliers as $supplier) {
$firstChannelUserName = $firstChannelUserDepartmentName = $allChannelUserName = '';
$channelUids = $supplier['channel_uid'] ? explode(',', $supplier['channel_uid']) : [];
if ($channelUids) {
$channelUsers = (new AdminUserService())->getAdminUserListByCodeIds($channelUids);
if (!empty($channelUsers)) {
$firstChannelUser = $channelUsers[0];
$firstChannelUserDepartmentName = (new DepartmentModel())->where('department_id',
$firstChannelUser['department_id'])
->value('department_name');
$firstChannelUserName = $firstChannelUser['name'];
$allChannelUserName = implode(',', array_column($channelUsers, 'name'));
}
}
$itemData = [
$supplier['supplier_id'],
$supplier['supplier_name'],
'',
$supplier['create_time'] ? date('Y-m-d H:i:s', $supplier['create_time']) : '',
$firstChannelUserName,
$firstChannelUserDepartmentName,
$allChannelUserName,
];
$excelData[] = $itemData;
}
array_unshift($excelData, $header);
Excel::create('供应商导出', function ($excel) use ($excelData) {
$excel->sheet('sheet1', function ($sheet) use ($excelData) {
$sheet->fromArray($excelData);
});
})->export('csv');
}
}
......@@ -73,7 +73,7 @@ class SupplierAttachmentService
'create_uid' => request()->user->userId,
'create_time' => time(),
'create_name' => request()->user->name,
'description' => $attachmentData['description'][$key],
'description' => !empty($attachmentData['description'][$key]) ? $attachmentData['description'][$key] : ' ',
'type_name' => array_get(config('fixed.FileNameMapping'), $attachmentData['field_name'][$key]),
];
if (!empty($attachmentData['validity_period'][$key])) {
......
......@@ -500,6 +500,7 @@ class SupplierService
{
$model = new SupplierChannelModel();
$result = $model->where('supplier_id', $supplierId)->update([
'supplier_type' => 1,
'update_time' => time(),
'is_type' => $isType,
'status' => SupplierChannelModel::STATUS_PENDING,
......
......@@ -36,6 +36,10 @@ class SupplierValidator
} else {
$count = SupplierChannelModel::where('supplier_name', $validateData['supplier_name'])
->where('supplier_id', '!=', $supplierId)->count();
//特殊处理下一些已经重复的供应商,历史数据问题
if (in_array($supplierId, config('field.NeedSkipSupplierNameCheckIds'))) {
$count = 0;
}
}
if ($count) {
return "该供应商名称已经存在,请核验后再提交";
......@@ -235,6 +239,10 @@ class SupplierValidator
} else {
$count = SupplierChannelModel::where('supplier_name', $validateData['supplier_name'])
->where('supplier_id', '!=', $supplierId)->count();
//特殊处理下一些已经重复的供应商,历史数据问题
if (in_array($supplierId, config('field.NeedSkipSupplierNameCheckIds'))) {
$count = 0;
}
}
if ($count) {
$errorMessageList[] = "该供应商名称已经存在,请核验后再提交";
......
......@@ -177,5 +177,10 @@ return [
'原厂' => '原厂',
'分销平台' => '分销平台',
'代工厂' => '代工厂',
],
//需要跳过重复校验的供应商ID
'NeedSkipSupplierNameCheckIds' => [
195,
12263
]
];
\ No newline at end of file
......@@ -7,7 +7,7 @@
</head>
<style>
td {
height: 35px !important;
height: 32px !important;
}
/*.title-td {*/
......@@ -89,6 +89,30 @@
style="text-align: left;padding-left: 20px">{{$printData['tax_number']}}</td>
</tr>
<tr>
<td width="20%" colspan="1">注册资金</td>
<td width="80%" colspan="5"
style="text-align: left;padding-left: 20px">{{$printData['registered_capital']?$printData['registered_capital'].'万':''}}
</td>
</tr>
<tr>
<td width="20%" colspan="1">是否历史经营异常</td>
<td width="80%" colspan="5"
style="text-align: left;padding-left: 20px">
@if ($printData['is_business_abnormal']==1)
@elseif ($printData['is_business_abnormal']==-1)
@else
@endif
</td>
</tr>
<tr>
<td width="20%" colspan="1">供应商营业税号</td>
<td width="80%" colspan="5"
style="text-align: left;padding-left: 20px">{{$printData['tax_number']}}</td>
</tr>
<tr>
<td width="20%" colspan="1">供应商成立时间*</td>
<td width="80%" colspan="5"
style="text-align: left;padding-left: 20px">{{$printData['established_time']}}</td>
......@@ -114,11 +138,11 @@
</tr>
<tr>
<td width="20%" colspan="1">账期详情*</td>
{{-- <td width="20%" colspan="1"></td>--}}
{{-- <td width="20%" colspan="1"></td>--}}
<td width="80%" colspan="5">{{$printData['pay_type_name'] or ''}}</td>
{{-- style="text-align: left;padding-left: 20px">{{$printData['pay_type_name'] or ''}}</td>--}}
{{-- <td width="80%" colspan="5"--}}
{{-- style="text-align: left;padding-left: 20px"></td>--}}
{{-- style="text-align: left;padding-left: 20px">{{$printData['pay_type_name'] or ''}}</td>--}}
{{-- <td width="80%" colspan="5"--}}
{{-- style="text-align: left;padding-left: 20px"></td>--}}
</tr>
<tr>
<td width="20%" colspan="1">业务负责人</td>
......
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