Browse Source

小高薪

cqp 2 months ago
parent
commit
73d6d0c0f2
2 changed files with 22 additions and 0 deletions
  1. 11 0
      app/Service/ImportService.php
  2. 11 0
      config/excel/fee.php

+ 11 - 0
app/Service/ImportService.php

@@ -1201,6 +1201,7 @@ class ImportService extends Service
         $keys = array_column($table_config, 'key');
         $codeIdx = array_search('code', $keys);
         $parentIdx = array_search('parent_id', $keys);
+        $isOtherIdx = array_search('is_other', $keys);
 
         // 1. 获取基础数据
         list($dbFeeMap, $excelCodesMap) = $this->getFeeList($array, $user, $codeIdx);
@@ -1209,6 +1210,8 @@ class ImportService extends Service
         $update = [];
         $parent_code_map = [];
 
+        $is_other_map = array_flip(Fee::IS_OTHER);
+
         // 2. 建立 Excel 内部父子关系映射(用于环路追溯)
         $currentExcelMap = [];
         foreach ($array as $row) {
@@ -1231,6 +1234,14 @@ class ImportService extends Service
                 $update[$rowIndex] = $dbFeeMap[$valCode]['id'];
             }
 
+            // 其他费用
+            $is_other_text = $value[$isOtherIdx] ?? '';
+            if (!isset($is_other_map[$is_other_text])) {
+                $errors[] = "第{$displayLine}行:是否其他费用[{$is_other_text}]无效";
+            } else {
+                $array[$rowIndex][$isOtherIdx] = $is_other_map[$is_other_text];
+            }
+
             if ($valParentCode !== '') {
                 // --- A. 存在性校验 ---
                 // 这里会检查 006 是否在数据库,或者是否在本次 Excel 的其他行中

+ 11 - 0
config/excel/fee.php

@@ -24,6 +24,17 @@ return [
             'enums' => [],
             'comments' => '必填'
         ],
+        [
+            'key' =>'is_other',
+            'export' =>'is_other_title',
+            'value' => '是否其他费用',
+            'required' => true,
+            'is_main' => true,
+            'default' => \App\Model\Fee::IS_OTHER_ZERO,
+            'unique' => false,
+            'enums' => array_values(\App\Model\Fee::IS_OTHER),
+            'comments' => '必填'
+        ],
         [
             'key' =>'parent_id',
             'export' =>'parent_code',