|
@@ -13,6 +13,7 @@ use App\Models\Manager\WashConfig\ViolationCompany as ViolationCompanyModel;
|
|
|
use App\Models\Manager\WashConfig\ViolationCompanyMember as ViolationCompanyMemberModel;
|
|
use App\Models\Manager\WashConfig\ViolationCompanyMember as ViolationCompanyMemberModel;
|
|
|
use App\Models\Manager\Personnel\EmployeePlatform as EmployeePlatformModel;
|
|
use App\Models\Manager\Personnel\EmployeePlatform as EmployeePlatformModel;
|
|
|
use App\Models\Manager\Process\LowPriceGoodsMember as LowPriceGoodsMemberModel;
|
|
use App\Models\Manager\Process\LowPriceGoodsMember as LowPriceGoodsMemberModel;
|
|
|
|
|
+use App\Models\Manager\Process\ViolationStoreMember as ViolationStoreMemberModel;
|
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -74,7 +75,7 @@ class CollectData extends Controller
|
|
|
* @version: 1.0
|
|
* @version: 1.0
|
|
|
* @date: 2026-05-18
|
|
* @date: 2026-05-18
|
|
|
*/
|
|
*/
|
|
|
- public function insert_low_product_responsible_person_info($product_data, $insert_product_data)
|
|
|
|
|
|
|
+ private function insert_low_product_responsible_person_info($product_data, $insert_product_data)
|
|
|
{
|
|
{
|
|
|
$LowPriceGoodsMemberModel = new LowPriceGoodsMemberModel();
|
|
$LowPriceGoodsMemberModel = new LowPriceGoodsMemberModel();
|
|
|
// $LowPriceGoodsModel->where('id', $product_data['id'])->update($update_data);
|
|
// $LowPriceGoodsModel->where('id', $product_data['id'])->update($update_data);
|
|
@@ -132,7 +133,7 @@ class CollectData extends Controller
|
|
|
* @version: 1.0
|
|
* @version: 1.0
|
|
|
* @date: 2026-05-18
|
|
* @date: 2026-05-18
|
|
|
*/
|
|
*/
|
|
|
- public function get_responsible_person_info($product_data)
|
|
|
|
|
|
|
+ private function get_responsible_person_info($product_data)
|
|
|
{
|
|
{
|
|
|
$EmployeeAreaModel = new EmployeeAreaModel();
|
|
$EmployeeAreaModel = new EmployeeAreaModel();
|
|
|
$EmployeePlatformModel = new EmployeePlatformModel();
|
|
$EmployeePlatformModel = new EmployeePlatformModel();
|
|
@@ -415,19 +416,63 @@ class CollectData extends Controller
|
|
|
DB::rollBack();
|
|
DB::rollBack();
|
|
|
return json_send(['code' => 'error', 'msg' => '执行失败', 'data' => $e->getMessage()]);
|
|
return json_send(['code' => 'error', 'msg' => '执行失败', 'data' => $e->getMessage()]);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 写入处理禁止商品-责任人信息
|
|
* 写入处理禁止商品-责任人信息
|
|
|
* @author: 唐远望
|
|
* @author: 唐远望
|
|
|
* @version: 1.0
|
|
* @version: 1.0
|
|
|
- * @date: 2026-05-18
|
|
|
|
|
|
|
+ * @date: 2026-05-19
|
|
|
*/
|
|
*/
|
|
|
- public function insert_violation_product_responsible_person_info($product_data, $insert_product_data)
|
|
|
|
|
|
|
+ private function insert_violation_product_responsible_person_info($product_data, $data)
|
|
|
{
|
|
{
|
|
|
-
|
|
|
|
|
|
|
+ $ViolationStoreMemberModel = new ViolationStoreMemberModel();
|
|
|
|
|
+ $ViolationStore_id = $product_data['id'];
|
|
|
|
|
+ $first_responsible_persons = $data['first_responsible_person'] != '' ? explode(',', $data['first_responsible_person']) : [];
|
|
|
|
|
+ $first_responsible_person_data = [];
|
|
|
|
|
+ if (count($first_responsible_persons) > 0) {
|
|
|
|
|
+ foreach ($first_responsible_persons as $key => $employee_id) {
|
|
|
|
|
+ //如果不是数字或者为空,则跳过
|
|
|
|
|
+ if ($employee_id == '' || is_null($employee_id) || !is_numeric($employee_id)) continue;
|
|
|
|
|
+ $first_responsible_person_data[] = [
|
|
|
|
|
+ 'violation_store_logid' => $ViolationStore_id,
|
|
|
|
|
+ 'employee_id' => $employee_id,
|
|
|
|
|
+ 'duty_type' => 1, //责任类型1=第一责任人,2=责任人,3=溯源责任人
|
|
|
|
|
+ ];
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ $ViolationStoreMemberModel->insert($first_responsible_person_data);
|
|
|
|
|
+ $responsible_persons = $data['responsible_person'] != '' ? explode(',', $data['responsible_person']) : [];
|
|
|
|
|
+ $responsible_person_data = [];
|
|
|
|
|
+ if (count($responsible_persons) > 0) {
|
|
|
|
|
+ foreach ($responsible_persons as $key => $employee_id) {
|
|
|
|
|
+ //如果不是数字或者为空,则跳过
|
|
|
|
|
+ if ($employee_id == '' || is_null($employee_id) || !is_numeric($employee_id)) continue;
|
|
|
|
|
+ $responsible_person_data[] = [
|
|
|
|
|
+ 'violation_store_logid' => $ViolationStore_id,
|
|
|
|
|
+ 'employee_id' => $employee_id,
|
|
|
|
|
+ 'duty_type' => 2, //责任类型1=第一责任人,2=责任人,3=溯源责任人
|
|
|
|
|
+ ];
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ $ViolationStoreMemberModel->insert($responsible_person_data);
|
|
|
|
|
+ $source_responsible_persons = $data['source_responsible_person'] != '' ? explode(',', $data['source_responsible_person']) : [];
|
|
|
|
|
+ $source_responsible_person_data = [];
|
|
|
|
|
+ if (count($source_responsible_persons) > 0) {
|
|
|
|
|
+ foreach ($source_responsible_persons as $key => $employee_id) {
|
|
|
|
|
+ //如果不是数字或者为空,则跳过
|
|
|
|
|
+ if ($employee_id == '' || is_null($employee_id) || !is_numeric($employee_id)) continue;
|
|
|
|
|
+ $source_responsible_person_data[] = [
|
|
|
|
|
+ 'violation_store_logid' => $ViolationStore_id,
|
|
|
|
|
+ 'employee_id' => $employee_id,
|
|
|
|
|
+ 'duty_type' => 3, //责任类型1=第一责任人,2=责任人,3=溯源责任人
|
|
|
|
|
+ ];
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ $ViolationStoreMemberModel->insert($source_responsible_person_data);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 违规店铺清洗数据回填
|
|
* 违规店铺清洗数据回填
|
|
|
* @author: 唐远望
|
|
* @author: 唐远望
|
|
@@ -438,22 +483,91 @@ class CollectData extends Controller
|
|
|
{
|
|
{
|
|
|
//获取非导入的低价商品清洗数据
|
|
//获取非导入的低价商品清洗数据
|
|
|
$map = [];
|
|
$map = [];
|
|
|
- $map[] = ['process_violation_store.source_id', '!=', '0'];
|
|
|
|
|
- $map[] = ['process_violation_store.collection_time', '==', '0'];
|
|
|
|
|
- $map[] = ['scrape_data.insert_time', '!=', 'null'];
|
|
|
|
|
- $limit = '10000';
|
|
|
|
|
- $result = $ViolationStoreModel->leftjoin('scrape_data', 'scrape_data.id', '=', 'process_violation_store.source_id')
|
|
|
|
|
- ->where($map)->select(['process_violation_store.id', 'scrape_data.insert_time as collect_collection_time'])
|
|
|
|
|
- ->orderByDesc('id')->paginate($limit)->toarray();
|
|
|
|
|
- if (!empty($result['data'])) {
|
|
|
|
|
- foreach ($result['data'] as $key => $value) {
|
|
|
|
|
- if (empty($value['collect_collection_time'])) {
|
|
|
|
|
- continue;
|
|
|
|
|
|
|
+ $map[] = ['merge_city_id', '!=', '0'];
|
|
|
|
|
+ $map[] = ['first_responsible_person', '=', ''];
|
|
|
|
|
+ $map[] = ['responsible_person', '=', ''];
|
|
|
|
|
+ $map[] = ['source_responsible_person', '=', ''];
|
|
|
|
|
+ $limit = '100';
|
|
|
|
|
+ DB::beginTransaction();
|
|
|
|
|
+ try {
|
|
|
|
|
+ $result = $ViolationStoreModel->where($map)->orderByDesc('id')->paginate($limit)->toarray();
|
|
|
|
|
+ if (!empty($result['data'])) {
|
|
|
|
|
+ foreach ($result['data'] as $key => $product_data) {
|
|
|
|
|
+ $specify_responsible_person = 0;
|
|
|
|
|
+ //获取指定人员信息
|
|
|
|
|
+ $insert_product_data = [];
|
|
|
|
|
+ if ($specify_responsible_person == 0) {
|
|
|
|
|
+ $product_data['qualification_number'] = $product_data['social_credit_code'];
|
|
|
|
|
+ $product_data['platform_id'] = $product_data['platform'];
|
|
|
|
|
+ $insert_product_data = $this->get_responsible_person_info($product_data);
|
|
|
|
|
+ }
|
|
|
|
|
+ $update_data = $insert_product_data;
|
|
|
|
|
+ if (!empty($update_data) && count($update_data) > 0) {
|
|
|
|
|
+ $ViolationStoreModel->where('id', $product_data['id'])->update($update_data);
|
|
|
|
|
+ $this->insert_violation_store_responsible_person_info($product_data, $insert_product_data);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- $update_data['collection_time'] = strtotime($value['collect_collection_time']);
|
|
|
|
|
- $ViolationStoreModel->where('id', $value['id'])->update($update_data);
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+ DB::commit();
|
|
|
|
|
+ return json_send(['code' => 'success', 'msg' => '执行成功', 'data' => count($result['data'])]);
|
|
|
|
|
+ // 成功处理...
|
|
|
|
|
+ } catch (\Exception $e) {
|
|
|
|
|
+ DB::rollBack();
|
|
|
|
|
+ return json_send(['code' => 'error', 'msg' => '执行失败', 'data' => $e->getMessage()]);
|
|
|
}
|
|
}
|
|
|
- return json_send(['code' => 'success', 'msg' => '执行成功', 'data' => count($result['data'])]);
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 写入处理违规店铺-责任人信息
|
|
|
|
|
+ * @author: 唐远望
|
|
|
|
|
+ * @version: 1.0
|
|
|
|
|
+ * @date: 2026-05-19
|
|
|
|
|
+ */
|
|
|
|
|
+ private function insert_violation_store_responsible_person_info($product_data, $data)
|
|
|
|
|
+ {
|
|
|
|
|
+ $ViolationStoreMemberModel = new ViolationStoreMemberModel();
|
|
|
|
|
+ $ViolationStore_id = $product_data['id'];
|
|
|
|
|
+ $first_responsible_persons = $data['first_responsible_person'] != '' ? explode(',', $data['first_responsible_person']) : [];
|
|
|
|
|
+ $first_responsible_person_data = [];
|
|
|
|
|
+ if (count($first_responsible_persons) > 0) {
|
|
|
|
|
+ foreach ($first_responsible_persons as $key => $employee_id) {
|
|
|
|
|
+ //如果不是数字或者为空,则跳过
|
|
|
|
|
+ if ($employee_id == '' || is_null($employee_id) || !is_numeric($employee_id)) continue;
|
|
|
|
|
+ $first_responsible_person_data[] = [
|
|
|
|
|
+ 'violation_store_logid' => $ViolationStore_id,
|
|
|
|
|
+ 'employee_id' => $employee_id,
|
|
|
|
|
+ 'duty_type' => 1, //责任类型1=第一责任人,2=责任人,3=溯源责任人
|
|
|
|
|
+ ];
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ $ViolationStoreMemberModel->insert($first_responsible_person_data);
|
|
|
|
|
+ $responsible_persons = $data['responsible_person'] != '' ? explode(',', $data['responsible_person']) : [];
|
|
|
|
|
+ $responsible_person_data = [];
|
|
|
|
|
+ if (count($responsible_persons) > 0) {
|
|
|
|
|
+ foreach ($responsible_persons as $key => $employee_id) {
|
|
|
|
|
+ //如果不是数字或者为空,则跳过
|
|
|
|
|
+ if ($employee_id == '' || is_null($employee_id) || !is_numeric($employee_id)) continue;
|
|
|
|
|
+ $responsible_person_data[] = [
|
|
|
|
|
+ 'violation_store_logid' => $ViolationStore_id,
|
|
|
|
|
+ 'employee_id' => $employee_id,
|
|
|
|
|
+ 'duty_type' => 2, //责任类型1=第一责任人,2=责任人,3=溯源责任人
|
|
|
|
|
+ ];
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ $ViolationStoreMemberModel->insert($responsible_person_data);
|
|
|
|
|
+ $source_responsible_persons = $data['source_responsible_person'] != '' ? explode(',', $data['source_responsible_person']) : [];
|
|
|
|
|
+ $source_responsible_person_data = [];
|
|
|
|
|
+ if (count($source_responsible_persons) > 0) {
|
|
|
|
|
+ foreach ($source_responsible_persons as $key => $employee_id) {
|
|
|
|
|
+ //如果不是数字或者为空,则跳过
|
|
|
|
|
+ if ($employee_id == '' || is_null($employee_id) || !is_numeric($employee_id)) continue;
|
|
|
|
|
+ $source_responsible_person_data[] = [
|
|
|
|
|
+ 'violation_store_logid' => $ViolationStore_id,
|
|
|
|
|
+ 'employee_id' => $employee_id,
|
|
|
|
|
+ 'duty_type' => 3, //责任类型1=第一责任人,2=责任人,3=溯源责任人
|
|
|
|
|
+ ];
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ $ViolationStoreMemberModel->insert($source_responsible_person_data);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|