导出信息更新

master
zcstatham 2 years ago
parent d3bc873bcf
commit c5609b21ab
  1. 5
      app/controller/Task.php
  2. 29
      extend/service/CarInfoHandle.php

@ -643,11 +643,12 @@ class Task extends BaseController
$sheet = $spreadsheetReader->getSheet(0); $sheet = $spreadsheetReader->getSheet(0);
$highestColumn = $sheet->getHighestColumn(); // e.g 'F' $highestColumn = $sheet->getHighestColumn(); // e.g 'F'
$title = $sheet->rangeToArray("A1:{$highestColumn}1")[0]; $title = $sheet->rangeToArray("A1:{$highestColumn}1")[0];
$tpl_title = ['车牌号','车主','品牌型号','发动机号','车架号','注册日期','上年承保公司','商业险到期日期','交强险到期日期','被保险人姓名','被保险人证件号'];
$tpl_title = ['车牌号', '车架号', '发动机号', '车主证件号码', '车主姓名', '被保人证件号', '被保人姓名', '投保人证件号', '投保人姓名', '品牌型号', '注册日期', '去年投保公司', '交强险到期时间', '商业险到期时间', '客户姓名', '客户电话1', '客户电话2', '客户类别', '地址信息', '客户备注1', '客户备注2', '用户姓名', '用户账号'];
if (count(array_diff($tpl_title, $title)) > 0) { if (count(array_diff($tpl_title, $title)) > 0) {
return false; return false;
} }
} }
return true; return true;
} }
} }

@ -387,16 +387,20 @@ class CarInfoHandle
$is_update_failed = 0; $is_update_failed = 0;
for ($row = 2; $row <= $highestRow; $row++) { for ($row = 2; $row <= $highestRow; $row++) {
$car_no = trim($worksheet->getCellByColumnAndRow(1, $row)->getValue()); $car_no = trim($worksheet->getCellByColumnAndRow(1, $row)->getValue());
$car_man = trim($worksheet->getCellByColumnAndRow(2, $row)->getValue()); $car_number = trim($worksheet->getCellByColumnAndRow(4, $row)->getValue());
$factory_model = trim($worksheet->getCellByColumnAndRow(3, $row)->getValue()); $car_man = trim($worksheet->getCellByColumnAndRow(5, $row)->getValue());
$engine_no = trim($worksheet->getCellByColumnAndRow(4, $row)->getValue()); $factory_model = trim($worksheet->getCellByColumnAndRow(10, $row)->getValue());
$car_frame_no = trim($worksheet->getCellByColumnAndRow(5, $row)->getValue()); $engine_no = trim($worksheet->getCellByColumnAndRow(3, $row)->getValue());
$register_date = trim($worksheet->getCellByColumnAndRow(6, $row)->getValue()); $car_frame_no = trim($worksheet->getCellByColumnAndRow(2, $row)->getValue());
$company = trim($worksheet->getCellByColumnAndRow(7, $row)->getValue()); $register_date = substr(trim($worksheet->getCellByColumnAndRow(11, $row)->getValue()), 0, 10);
$insurer1_date = trim($worksheet->getCellByColumnAndRow(8, $row)->getValue()); $company = trim($worksheet->getCellByColumnAndRow(12, $row)->getValue());
$insurer2_date = trim($worksheet->getCellByColumnAndRow(9, $row)->getValue()); $insurer1_date = substr(trim($worksheet->getCellByColumnAndRow(14, $row)->getValue()), 0, 10);
$id_man = trim($worksheet->getCellByColumnAndRow(10, $row)->getValue()); $insurer2_date = substr(trim($worksheet->getCellByColumnAndRow(13, $row)->getValue()), 0, 10);
$id_number = trim($worksheet->getCellByColumnAndRow(11, $row)->getValue()); $id_man = trim($worksheet->getCellByColumnAndRow(7, $row)->getValue());
$id_number = trim($worksheet->getCellByColumnAndRow(6, $row)->getValue());
$insured_man = trim($worksheet->getCellByColumnAndRow(9, $row)->getValue());
$insured_number = trim($worksheet->getCellByColumnAndRow(8, $row)->getValue());
if ($car_frame_no == '') { if ($car_frame_no == '') {
continue; continue;
} }
@ -407,6 +411,7 @@ class CarInfoHandle
} }
$car_info->car_no = $car_no != '' ? $car_no : $car_info->car_no; $car_info->car_no = $car_no != '' ? $car_no : $car_info->car_no;
$car_info->car_man = $car_info->car_man != '' ? $car_info->car_man : $car_man; $car_info->car_man = $car_info->car_man != '' ? $car_info->car_man : $car_man;
$car_info->car_number = $car_info->car_number != '' ? $car_info->car_number : $car_number;
$car_info->register_date = $register_date; $car_info->register_date = $register_date;
$car_info->factory_model = $factory_model; $car_info->factory_model = $factory_model;
//对比原信息是否包含待更新信息(删除星号) //对比原信息是否包含待更新信息(删除星号)
@ -423,6 +428,8 @@ class CarInfoHandle
$car_info->company = $company != '' ? $company : $car_info->company; $car_info->company = $company != '' ? $company : $car_info->company;
$car_info->id_man = $car_info->id_man != '' && startsWith($car_info->id_man, rtrim($id_man, '*')) ? $car_info->id_man : $id_man; $car_info->id_man = $car_info->id_man != '' && startsWith($car_info->id_man, rtrim($id_man, '*')) ? $car_info->id_man : $id_man;
$car_info->id_number = $car_info->id_number != '' && startsWith($car_info->id_number, rtrim($id_number, '*')) ? $car_info->id_number : $id_number; $car_info->id_number = $car_info->id_number != '' && startsWith($car_info->id_number, rtrim($id_number, '*')) ? $car_info->id_number : $id_number;
$car_info->insured_man = $car_info->insured_man != '' && startsWith($car_info->insured_man, rtrim($insured_man, '*')) ? $car_info->insured_man : $insured_man;
$car_info->insured_number = $car_info->insured_number != '' && startsWith($car_info->insured_number, rtrim($insured_number, '*')) ? $car_info->insured_number : $insured_number;
} }
$car_info->is_update_bhx = $id; $car_info->is_update_bhx = $id;
$car_info->is_export_failed = 0; $car_info->is_export_failed = 0;
@ -656,4 +663,4 @@ class CarInfoHandle
$export_log->create_timestamp = date('Y-m-d H:i:s'); $export_log->create_timestamp = date('Y-m-d H:i:s');
$export_log->save(); $export_log->save();
} }
} }

Loading…
Cancel
Save