Ver Fonte

退件语音

Zhouzhendong há 4 anos atrás
pai
commit
828f67fa66

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

@@ -68,12 +68,12 @@ class CreateOwnerReport extends Command
         $bills = OwnerBillReport::query()->where("counting_month","like",$year."-".$lastMonth."%")->get();
 
         //日均单量统计
-        $query = DB::raw("select  count(*) c,CUSTOMERID from DOC_ORDER_HEADER where SOSTATUS = '99' and EDITTIME >= to_date('".$year."-".$lastMonth."-01 00:00:00','yyyy-mm-dd hh24:mi:ss') and EDITTIME <= to_date('".$year."-".$lastMonth."-".$lastDay." 23:59:59','yyyy-mm-dd hh24:mi:ss') group by CUSTOMERID");
+        /*$query = DB::raw("select  count(*) c,CUSTOMERID from DOC_ORDER_HEADER where SOSTATUS = '99' and EDITTIME >= to_date('".$year."-".$lastMonth."-01 00:00:00','yyyy-mm-dd hh24:mi:ss') and EDITTIME <= to_date('".$year."-".$lastMonth."-".$lastDay." 23:59:59','yyyy-mm-dd hh24:mi:ss') group by CUSTOMERID");
         $orderStatistic = DB::connection("oracle")->select($query);
         $map = [];
         foreach ($orderStatistic as $item){
             $map[$item->customerid] = $item->c;
-        }
+        }*/
 
         //已存在的报表记录
         $reportMap = [];

+ 23 - 4
app/Http/Controllers/ReceiveRecordController.php

@@ -8,6 +8,7 @@ use App\Logistic;
 use App\ReceiveRecord;
 use App\Services\LogisticService;
 use App\Warehouse;
+use Firebase\JWT\ExpiredException;
 use Firebase\JWT\JWT;
 use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\QueryException;
@@ -86,8 +87,7 @@ class ReceiveRecordController extends Controller
         $jwtToken = app("UserService")->getJWTToken(Auth::user(),$privateKey);
         return view("rejected.record",compact("warehouses","jwtToken"));
     }
-
-    public function receive()
+    public function refreshToken()
     {
         $jwtToken = \request()->header("jwtToken");
         if (!$jwtToken)$this->error("非法请求");
@@ -96,8 +96,27 @@ class ReceiveRecordController extends Controller
         });
         $payload = JWT::decode($jwtToken, $publicKey, ['RS256']);
         $user = app("UserService")->getOrRefreshCache($payload->data->id,$payload->exp);
-        if (!$user)$this->error("登录过期");
-        Auth::setUser($user);
+
+        $privateKey = file_get_contents(base_path().'/private.pem');
+        $jwtToken = app("UserService")->getJWTToken($user,$privateKey);
+        $this->success($jwtToken);
+    }
+
+    public function receive()
+    {
+        $jwtToken = \request()->header("jwtToken");
+        if (!$jwtToken)$this->error("非法请求");
+        $publicKey = Cache::remember("TOKEN_PUBLIC_KEY",7200,function (){
+            return file_get_contents(base_path().'/public.pem');
+        });
+        try {
+            $payload = JWT::decode($jwtToken, $publicKey, ['RS256']);
+            $user = app("UserService")->getOrRefreshCache($payload->data->id,$payload->exp);
+            if (!$user)throw new ExpiredException();
+            Auth::setUser($user);
+        }catch (ExpiredException $e){
+            $this->error("认证过期,请保存当前失败记录刷新页面");
+        }
         $this->gate("退货管理-退件记录");
         $logisticNumber = \request("logisticNumber");
         $warehouse = \request("warehouse");

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

@@ -46,6 +46,7 @@ use App\OrderIssueProcessLog;
 use App\OrderPackage;
 use App\Owner;
 use App\OwnerAreaReport;
+use App\OwnerBillReport;
 use App\OwnerFeeDetail;
 use App\OwnerFeeDetailLogistic;
 use App\OwnerFeeExpress;
@@ -56,15 +57,18 @@ use App\OwnerFeeStorage;
 use App\OwnerPriceExpress;
 use App\OwnerPriceOperation;
 use App\OrderPackageCountingRecord;
+use App\OwnerReport;
 use App\ProcurementCheckSheet;
 use App\RejectedBill;
 use App\SeeLog;
 use App\Services\AuthorityService;
 use App\Services\BatchService;
 use App\Services\CacheShelfService;
+use App\Services\common\BatchUpdateService;
 use App\Services\ForeignHaiRoboticsService;
 use App\Services\ForeignZhenCangService;
 use App\Services\LogisticService;
+use App\Services\LogService;
 use App\Services\NotificationService;
 use App\Services\OracleDOCOrderHeaderService;
 use App\Services\OrderPackageCommoditiesService;
@@ -74,6 +78,7 @@ use App\Services\OrderService;
 use App\Services\OwnerFeeTotalService;
 use App\Services\OwnerLogisticFeeReportService;
 use App\Services\OwnerPriceOperationService;
+use App\Services\OwnerService;
 use App\Services\OwnerStoreFeeReportService;
 use App\Services\OwnerStoreOutFeeReportService;
 use App\Services\ReviewService;
@@ -98,6 +103,7 @@ use Carbon\Carbon;
 use Carbon\CarbonPeriod;
 use Decimal\Decimal;
 use Doctrine\DBAL\Exception;
+use Firebase\JWT\ExpiredException;
 use Firebase\JWT\JWT;
 use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Collection;
@@ -289,7 +295,6 @@ class TestController extends Controller
     private static $delayedHour = 48;
     public function test(Request $request)
     {
-
         echo 'Now memory_get_usage: ' . memory_get_usage() . '<br />';
         $t1 = microtime(true);
 // ... 执行代码 ...

+ 1 - 1
app/Services/RejectedBillService.php

@@ -392,7 +392,7 @@ class RejectedBillService
         if ($stores->count())return;
         $rejectedBill->loadMissing("items");
         $GLOBALS["FEE_INFO"] = [];
-        list($id,$money,$taxFee) = $service->matching($rejectedBill, Feature::MAPPING["rejected_bill"], $rejectedBill->id_owner, "入库",0);
+        list($id,$money,$taxFee) = $service->matching(substr($rejectedBill->updated_at,0,7),$rejectedBill, Feature::MAPPING["rejected_bill"], $rejectedBill->id_owner, "入库",0);
         app("OwnerFeeDetailService")->create([
             "owner_id" => $rejectedBill->id_owner,
             "worked_at" => $rejectedBill->updated_at,

+ 55 - 3
resources/views/rejected/record.blade.php

@@ -104,6 +104,8 @@
             selected:"",
             name:"",
             errorSum:0,
+            jwtToken:"{{$jwtToken}}",
+            voiceLoadSign:false,
         },
         mounted() {
             this.registerEvent();
@@ -124,8 +126,43 @@
                 }
                 return '当前存在失败数据未处理';
             };
+            setTimeout(()=>{
+                this.refreshToken();
+            },600800000);
         },
         methods:{
+            playAudio(src){
+                let audio = document.createElement('audio');
+                audio.src = src;
+                document.body.append(audio);
+                setTimeout(()=>{
+                    audio.play();
+                },10);
+                setTimeout(()=>{
+                    audio.remove();
+                },5000);
+            },
+            refreshToken(){
+                window.axios.post('{{url('record/refreshToken')}}',{},{
+                    headers: {
+                        "jwtToken" : this.jwtToken
+                    }
+                }).then(body=>{
+                    let res = body.data;
+                    if (!res.success){
+                        this.playAudio('storage/logonFailure.mp3');
+                        this.buildToast(false,"tokenFailure");
+                        return;
+                    }
+                    this.jwtToken = res.data;
+                    setTimeout(()=>{
+                        this.refreshToken();
+                    },600800000);
+                }).catch(err=>{
+                    this.playAudio('storage/networkError.mp3');
+                    this.buildToast(false,"tokenFailure");
+                });
+            },
             selectedWarehouse(warehouse){
                 this.selected = warehouse.id;
                 this.name = warehouse.name;
@@ -164,6 +201,19 @@
             },
             registerEvent(){
                 $(document).on('keypress', e=>{
+                    if (!this.voiceLoadSign){
+                        this.voiceLoadSign = true;
+                        let audio = document.createElement('audio');
+                        let audio1 = document.createElement('audio');
+                        audio.src = 'storage/logonFailure.mp3';
+                        audio1.src = 'storage/networkError.mp3';
+                        document.body.append(audio);
+                        document.body.append(audio1);
+                        setTimeout(()=>{
+                            audio.remove();
+                            audio1.remove();
+                        },10);
+                    }
                     if (e.keyCode===13){
                         if(this.logisticNumber==="")return;
                         this.submitRecord(this.logisticNumber,this.recordAt);
@@ -185,7 +235,7 @@
                             this.recordAt = yy+'-'+(mm<10 ? '0'+mm : mm)+'-'+(dd<10 ? '0'+dd : dd)+" "+(hh<10 ? '0'+hh : hh)+":"+(m<10 ? '0'+m : m)+":"+(ss<10 ? '0'+ss : ss);
                         }
                         this.logisticNumber += e.key;
-                    }else console.log(e.key);
+                    }
                 });
             },
             failRetry(){
@@ -193,7 +243,7 @@
                     if (!item.status){
                         window.axios.post('{{url('record')}}',{logisticNumber:item.logisticNumber,warehouse:this.selected},{
                             headers: {
-                                "jwtToken" : "{{$jwtToken}}"
+                                "jwtToken" : this.jwtToken
                             }
                         }).then(body=>{
                             let res = body.data;
@@ -209,6 +259,7 @@
                                 this.errorSum--;
                             }
                         }).catch(err=>{
+                            this.playAudio('storage/networkError.mp3');
                             this.buildToast(false,item.logisticNumber);
                         });
                     }
@@ -217,7 +268,7 @@
             submitRecord(logisticNumber,recordAt){
                 window.axios.post('{{url('record')}}',{logisticNumber:logisticNumber,warehouse:this.selected},{
                     headers: {
-                        "jwtToken" : "{{$jwtToken}}"
+                        "jwtToken" : this.jwtToken,
                     }
                 }).then(body=>{
                     let res = body.data;
@@ -236,6 +287,7 @@
                     if (!status)this.errorSum++;
                     this.sum++;
                 }).catch(err=>{
+                    this.playAudio('storage/networkError.mp3');
                     this.buildToast(false,logisticNumber);
                     this.data.unshift({
                         logisticNumber:logisticNumber,logistic:"未知",recordAt:recordAt,status:false

+ 1 - 0
routes/web.php

@@ -50,6 +50,7 @@ Route::get('personnel/checking-in/importAndExportQRCode','QRCodeController@impor
 Route::post('personnel/checking-in/refreshQRCode','QRCodeController@refreshQRCode');
 
 Route::post("record","ReceiveRecordController@receive");
+Route::post("record/refreshToken","ReceiveRecordController@refreshToken");
 Route::get("record",function (){return view("rejected.record");});