/// <summary> /// 根据服务码查询服务码详情,有用户信息 /// </summary> /// <param name="code"></param> /// <returns></returns> public static async Task <Tuple <List <ServiceCodeDetail>, int> > GetServiceCodeDetailByCode(string code) { var result = new List <ServiceCodeDetail>(); var totalCount = 0; if (!string.IsNullOrEmpty(code)) { var packageCodeDetails = GetBeautyServicePackageDetailCodesByCodes(new List <string>() { code }); var codeDetail = packageCodeDetails?.FirstOrDefault(); totalCount = codeDetail != null ? 1 : 0; if (codeDetail != null) { var codeDetails = await GetServiceCodeDetail(new List <string>() { code }); if (codeDetails != null && codeDetails.Any()) { User user = null; using (var client = new UserAccountClient()) { var accountResult = await client.GetUserByIdAsync(codeDetail.UserId); user = accountResult.Result; } foreach (var item in codeDetails) { item.Mobile = user?.MobileNumber; result.Add(item); } } } if (!result.Any()) { var bankRecords = BankMRManager.GetBankMRActivityCodeRecordByServiceCode(new List <string>() { code }); var bankMrServiceCodeDetails = await BankMRManager.SearchBankMRActivityCodeDetailByRecords(bankRecords); if (bankMrServiceCodeDetails != null && bankMrServiceCodeDetails.Any()) { result.AddRange(bankMrServiceCodeDetails); } } } return(Tuple.Create(result, totalCount)); }
public static async Task <int> SubmitZeroActivityApplicationAsync(ZeroActivityRequest requestModel) { try { var activityDetail = await FetchZeroActivityDetailAsync(requestModel.Period); if (activityDetail == null) { return(-2); } else if (activityDetail.StatusOfActivity != 1) { return(-3); } else if (activityDetail.PID == null || activityDetail.ProductName == null) { return(-4); } if (await DalZeroActivity.HasZeroActivityApplicationSubmittedAsync(requestModel.UserId, requestModel.Period)) { return(-1); } string userMobile = ""; using (var uClient = new UserAccountClient()) { var result = await uClient.GetUserByIdAsync(requestModel.UserId); if (result.Success && !string.IsNullOrWhiteSpace(result.Result?.MobileNumber) && result.Result.MobileNumber.Length <= 30) { userMobile = result.Result.MobileNumber; } } var count = await DalZeroActivity.SubmitZeroActivityApplicationAsync(requestModel, activityDetail, userMobile); if (count > 0) { var actionQueueDic = new Dictionary <string, string>(); actionQueueDic["UserId"] = requestModel.UserId.ToString("B"); actionQueueDic["ActionName"] = "12PublicTest"; TuhuNotification.SendNotification("notification.TaskActionQueue", actionQueueDic); using (var client = CacheHelper.CreateCacheClient(DefaultClientName)) { var existenceResult = await client.ExistsAsync(GlobalConstant.MyZeroApplyApplications + requestModel.UserId.ToString("B") + "/0/"); if (existenceResult.Success) { var removeResult = await client.RemoveAsync(GlobalConstant.MyZeroApplyApplications + requestModel.UserId.ToString("B") + "/0/"); if (!removeResult.Success) { Logger.Warn($"删除用户众测申请列表(申请中)缓存redis失败MyZeroApplyApplications:{GlobalConstant.MyZeroApplyApplications + requestModel.UserId.ToString("B") + "/0/"};Error:{removeResult.Message}", removeResult.Exception); } } } } return(count); } catch (Exception ex) { Logger.ErrorException("SubmitZeroActivityApplication逻辑进行中出现异常", ex); return(0); } }
private static async Task <SelectedTestReportDetail> HandleTestReportDetail(int commentId) { var testReport = await DalZeroActivity.FetchTestReportDetailAsync(commentId); if (testReport != null) { using (var uClient = new UserAccountClient()) { var result = await uClient.GetUserByIdAsync(testReport.UserId); if (result.Success && result.Result?.Profile != null) { if (!string.IsNullOrWhiteSpace(result.Result.Profile.HeadUrl)) { testReport.HeadImage = ImageHelper.GetImageUrl(result.Result.Profile.HeadUrl); } testReport.UserName = string.IsNullOrWhiteSpace(result.Result.Profile.UserName) ? result.Result.Profile.NickName : result.Result.Profile.UserName; testReport.Gender = Convert.ToInt32(result.Result.Profile.Gender); } } var structuredCommentAttrbute = new CommentExtenstionAttribute { CarTypeDes = string.Empty, InstallShop = string.Empty, TestEnvironment = new TestEnvironment { DriveSituation = string.Empty, Humidity = string.Empty, RoadSituation = string.Empty, WeatherSituation = string.Empty, Temperature = string.Empty }, TestUserInfo = new TestUserInfo { Cellphone = string.Empty, DriveDistance = string.Empty, DriveStyle = string.Empty, Name = string.Empty } }; if (testReport.TestReportExtenstionAttribute != null) { structuredCommentAttrbute.CarTypeDes = !string.IsNullOrWhiteSpace(testReport.TestReportExtenstionAttribute.CarTypeDes) ? testReport.TestReportExtenstionAttribute.CarTypeDes : string.Empty; structuredCommentAttrbute.CarID = testReport.TestReportExtenstionAttribute.CarID; structuredCommentAttrbute.InstallShopID = testReport.TestReportExtenstionAttribute.InstallShopID; structuredCommentAttrbute.OrderDatetime = testReport.TestReportExtenstionAttribute.OrderDatetime; structuredCommentAttrbute.InstallShop = !string.IsNullOrWhiteSpace(testReport.TestReportExtenstionAttribute.InstallShop) ? testReport.TestReportExtenstionAttribute.InstallShop : string.Empty; if (testReport.TestReportExtenstionAttribute.TestEnvironment != null) { structuredCommentAttrbute.TestEnvironment.DriveSituation = !string.IsNullOrWhiteSpace(testReport.TestReportExtenstionAttribute.TestEnvironment.DriveSituation) ? testReport.TestReportExtenstionAttribute.TestEnvironment.DriveSituation : string.Empty; structuredCommentAttrbute.TestEnvironment.Humidity = !string.IsNullOrWhiteSpace(testReport.TestReportExtenstionAttribute.TestEnvironment.Humidity) ? testReport.TestReportExtenstionAttribute.TestEnvironment.Humidity : string.Empty; structuredCommentAttrbute.TestEnvironment.RoadSituation = !string.IsNullOrWhiteSpace(testReport.TestReportExtenstionAttribute.TestEnvironment.RoadSituation) ? testReport.TestReportExtenstionAttribute.TestEnvironment.RoadSituation : string.Empty; structuredCommentAttrbute.TestEnvironment.WeatherSituation = !string.IsNullOrWhiteSpace(testReport.TestReportExtenstionAttribute.TestEnvironment.WeatherSituation) ? testReport.TestReportExtenstionAttribute.TestEnvironment.WeatherSituation : string.Empty; structuredCommentAttrbute.TestEnvironment.Temperature = !string.IsNullOrWhiteSpace(testReport.TestReportExtenstionAttribute.TestEnvironment.Temperature) ? testReport.TestReportExtenstionAttribute.TestEnvironment.Temperature : string.Empty; } if (testReport.TestReportExtenstionAttribute.TestUserInfo != null) { structuredCommentAttrbute.TestUserInfo.Age = testReport.TestReportExtenstionAttribute.TestUserInfo.Age; structuredCommentAttrbute.TestUserInfo.Cellphone = !string.IsNullOrWhiteSpace(testReport.TestReportExtenstionAttribute.TestUserInfo.Cellphone) ? testReport.TestReportExtenstionAttribute.TestUserInfo.Cellphone : string.Empty; structuredCommentAttrbute.TestUserInfo.DriveAge = testReport.TestReportExtenstionAttribute.TestUserInfo.DriveAge; structuredCommentAttrbute.TestUserInfo.DriveDistance = !string.IsNullOrWhiteSpace(testReport.TestReportExtenstionAttribute.TestUserInfo.DriveDistance) ? testReport.TestReportExtenstionAttribute.TestUserInfo.DriveDistance : string.Empty; structuredCommentAttrbute.TestUserInfo.DriveStyle = !string.IsNullOrWhiteSpace(testReport.TestReportExtenstionAttribute.TestUserInfo.DriveStyle) ? testReport.TestReportExtenstionAttribute.TestUserInfo.DriveStyle : string.Empty; structuredCommentAttrbute.TestUserInfo.Gender = testReport.TestReportExtenstionAttribute.TestUserInfo.Gender; structuredCommentAttrbute.TestUserInfo.Name = !string.IsNullOrWhiteSpace(testReport.TestReportExtenstionAttribute.TestUserInfo.Name) ? testReport.TestReportExtenstionAttribute.TestUserInfo.Name : string.Empty; } } testReport.TestReportExtenstionAttribute = structuredCommentAttrbute; return(testReport); } return(new SelectedTestReportDetail()); }