Parcourir la source

BUG修复:客户管理-账单生成任务
需求新增:make service新增参数provider与完成反馈

Zhouzhendong il y a 5 ans
Parent
commit
21a702b1a6

+ 1 - 1
app/Console/Commands/CreateOwnerBillReport.php

@@ -46,7 +46,7 @@ class CreateOwnerBillReport extends Command
             $year--;
             $lastMonth = '12';
         }else $lastMonth = ($month-1) < 10 ? "0".($month-1) : ($month-1);
-        $sql = "SELECT owner_id,SUM(work_fee)+SUM(logistic_fee) AS total FROM owner_fee_details WHERE worked_at LIKE ? AND (type = '发货' AND logistic_fee IS NOT NULL AND work_fee IS NOT NULL) OR (type <> '发货' AND work_fee IS NOT NULL)  GROUP BY owner_id";
+        $sql = "SELECT owner_id,SUM(work_fee)+SUM(logistic_fee) AS total FROM owner_fee_details WHERE worked_at LIKE ? AND ((type = '发货' AND logistic_fee IS NOT NULL AND work_fee IS NOT NULL) OR (type <> '发货' AND work_fee IS NOT NULL))  GROUP BY owner_id";
         $billDetails = DB::select(DB::raw($sql),[$year."-".$lastMonth."%"]);
 
         $areas = OwnerAreaReport::query()->with("ownerStoragePriceModel")->where("counting_month","like",$year."-".$lastMonth."%")->get();

+ 1 - 1
app/Console/Commands/CreateOwnerReport.php

@@ -88,7 +88,7 @@ class CreateOwnerReport extends Command
         //组装账单记录
         $billMap = [];
         foreach ($bills as $index => $bill){
-            $bill[$bill->owner_id."_".$bill->counting_month] = $index;
+            $billMap[$bill->owner_id."_".$bill->counting_month] = $bill->id;
         }
 
         //组装报表记录数据

+ 37 - 1
app/Console/Commands/MakeServiceCommand.php

@@ -11,7 +11,9 @@ class MakeServiceCommand extends Command
      *
      * @var string
      */
-    protected $signature = 'make:service {name : fileName}';
+    protected $signature = 'make:service 
+    {--provider : Register in the provider}  
+    {name : fileName}';
 
     /**
      * The console command description.
@@ -46,5 +48,39 @@ class MakeServiceCommand extends Command
                 '<?php '.PHP_EOL.PHP_EOL.'namespace App\Services; '.PHP_EOL.PHP_EOL.'Class '.$fileName.PHP_EOL.'{ '.PHP_EOL.PHP_EOL.PHP_EOL.'}');
         }
         else $this->error("ERROR: file exists;");
+        if ($this->option("provider")){
+            $path = base_path("app\\Providers\\AppServiceProvider.php");
+            $i = 0;
+            $fop = fopen($path,"r+");
+            $endLine = 0;
+            $startLine = 0;
+            while (!feof($fop)){
+                $i += 1;
+                $lineStr = fgets($fop);
+                if (strpos($lineStr,"app()->singleton"))$endLine = $i;
+                if (strpos($lineStr,"App\Services"))$startLine = $i;
+            };
+            fclose($fop);
+            $fop = fopen($path,"r+");
+            $i = 0;
+            $arr = [];
+            while (!feof($fop)){
+                $i += 1;
+                $lineStr = fgets($fop);
+                if ($i == $endLine){
+                    $lineStr = $lineStr."        app()->singleton('{$fileName}',{$fileName}::class);".PHP_EOL;
+                }
+                if ($i == $startLine){
+                    $lineStr = $lineStr."use App\Services\\$fileName;".PHP_EOL;
+                }
+                $arr[] = $lineStr;
+            };
+            fclose($fop);
+            unlink($path);
+            foreach ($arr as $value){
+                file_put_contents($path,$value,FILE_APPEND);
+            }
+        }
+        $this->info("File create success!");
     }
 }

+ 1 - 1
app/Http/Controllers/CustomerController.php

@@ -248,7 +248,7 @@ class CustomerController extends Controller
         foreach ($values as $column=>$value){
             if ($value && (!is_numeric($value) || $value<0))return ["success"=>false,'data'=>$column."非数字或小于0!"];
         }
-        $accounting_area = ((int)$values["area_on_tray"]*205) + ((int)$values["area_on_half_tray"]*1.8) + ((int)$values["area_on_flat"]*1.3);
+        $accounting_area = ((int)$values["area_on_tray"]*2.5) + ((int)$values["area_on_half_tray"]*1.8) + ((int)$values["area_on_flat"]*1.3);
         $values["accounting_area"] = $accounting_area;
         $row = app('OwnerAreaReportService')->update(["id"=>$request->id],$values);
         if ($row==1){

+ 1 - 2
app/Http/Controllers/TestController.php

@@ -107,8 +107,7 @@ class TestController extends Controller
     }
     public function zzd(Request $request)
     {
-        Storage::download("test.jpg");
-        return 123;
+        echo '\\';
     }
 
     public function zzd1()

+ 2 - 12
app/Providers/AppServiceProvider.php

@@ -3,8 +3,6 @@
 namespace App\Providers;
 
 use App\Http\Controllers\Controller;
-use App\Observers\OwnerObserver;
-use App\Owner;
 use App\Services\AuthorityService;
 use App\Services\BatchService;
 use App\Services\CacheService;
@@ -12,8 +10,6 @@ use App\Services\CommodityService;
 use App\Services\common\BatchUpdateService;
 use App\Services\CommodityBarcodeService;
 use App\Services\common\DataHandlerService;
-use App\Services\CustomerLogService;
-use App\Services\CustomerLogStatusService;
 use App\Services\CustomerService;
 use App\Services\DepositoryService;
 use App\Services\FeatureService;
@@ -107,7 +103,6 @@ class AppServiceProvider extends ServiceProvider
     public function boot()
     {
         $this->loadingService();
-        $this->loadEvent();
         //
         Schema::defaultStringLength(191);
         Queue::failing(function (JobFailed $event) {
@@ -200,13 +195,8 @@ class AppServiceProvider extends ServiceProvider
         app()->singleton('WarehouseService',WarehouseService::class);
         app()->singleton('WaybillFinancialService',WaybillFinancialService::class);
         app()->singleton('WeighExceptedService',WeighExceptedService::class);
-        app()->singleton('CustomerLogStatusService',CustomerLogStatusService::class);
-        app()->singleton('CustomerLogService',CustomerLogService::class);
-        app()->singleton('CustomerLogService',CustomerLogService::class);
-    }
 
-    private function loadEvent()
-    {
-        Owner::observe(OwnerObserver::class);
     }
+
+
 }

+ 1 - 1
app/Services/OwnerAreaReportService.php

@@ -90,7 +90,7 @@ Class OwnerAreaReportService
         if ($id)$query->where("id",$id);
         if ($ownerId)$query->where("owner_id",$ownerId);
         if ($countingMonth)$query->where("counting_month","like",$countingMonth."%");
-        return $query->update(["status","已完成"]);
+        return $query->update(["status"=>"已完成"]);
     }
 
 }

+ 1 - 1
app/Services/OwnerPriceOperationService.php

@@ -288,8 +288,8 @@ Class OwnerPriceOperationService
             $packages[$index][$amountColumn] -= $startNumber;
             return $packages;
         }else{
-            unset($packages[$index]);
             $startNumber -= $packages[$index][$amountColumn];
+            unset($packages[$index]);
             $this->settingCount($packages,$amountColumn,$startNumber);
         }
     }