Exemple #1
0
        public BasicResponseModel HandleEvent(string sessionId, string operate, ShipmentEventRequest request)
        {
            var response = new BasicResponseModel();

            if (!AllowOperates.Contains(operate))
            {
                response.Code    = ShipmentErrorCode.InvalidShipmentOperate;
                response.Message = "非法操作";
                return(response);
            }

            var alctResponse = shipmentAgent.HandleShipmentEvent(GetToken(sessionId).AccessToken, operate, request.ToALCTOperation());

            if (alctResponse == null)
            {
                response.Code    = ShipmentErrorCode.ShipmentOperationFailed;
                response.Message = "操作失败,请重试";
            }
            else if (alctResponse.Code == "1")
            {
                response.Code    = ShipmentErrorCode.ShipmentOperationFailed;
                response.Message = "操作失败,请重试";
            }
            else if (alctResponse.Code == "2")
            {
                response.Code    = ShipmentErrorCode.ShipmentOperationFailed;
                response.Message = "操作失败,请刷新后重试";
            }
            else if (alctResponse.Code == "0")
            {
                response.Code    = 0;
                response.Message = "操作成功";
            }
            return(response);
        }
Exemple #2
0
        public IActionResult ShipmentEvent([FromBody] ShipmentEventRequest request, string operate)
        {
            if (!CheckSessionId())
            {
                return(Unauthorized());
            }

            return(Ok(shipmentBusinessLogic.HandleEvent(GetSessionId(), operate, request)));
        }
Exemple #3
0
        public static ALCTShipmentOperation ToALCTOperation(this ShipmentEventRequest request)
        {
            if (request == null)
            {
                return(null);
            }

            return(new ALCTShipmentOperation()
            {
                ShipmentCode = request.ShipmentCode,
                BaiduLatitude = (decimal)(request.LatitudeValue ?? 0),
                BaiduLongitude = (decimal)(request.LongitudeValue ?? 0),
                Location = request.Location,
                operationTime = request.TraceDate
            });
        }