public async Task <ResponseMessage> UploadIcon(UserInfo User, [FromBody] string iconPath, [FromRoute] string dest, [FromRoute] string Id) { Logger.Trace($"用户{User?.UserName ?? ""}({User?.Id ?? ""})更新缩略图(UploadIcon):请求参数为:\r\n(iconPath){iconPath ?? ""},(dest){dest ?? ""},(Id){Id ?? ""}"); ResponseMessage response = new ResponseMessage(); if (string.IsNullOrEmpty(iconPath) || string.IsNullOrEmpty(dest) || string.IsNullOrEmpty(Id)) { response.Code = ResponseCodeDefines.ArgumentNullError; response.Message = "参数不能为空"; Logger.Error($"用户{User?.UserName ?? ""}({User?.Id ?? ""})更新缩略图(UploadIcon)参数验证错误:参数不能为空,请求参数为:\r\n(iconPath){iconPath ?? ""},(dest){dest ?? ""},(Id){Id ?? ""}"); return(response); } try { if (dest == "customer") { var customer = await _icustomerInfoManager.FindByIdAsync(User.Id, Id, HttpContext.RequestAborted); if (customer != null) { customer.HeadImg = iconPath; await _icustomerInfoManager.UpdateAsync(User.Id, _mapper.Map <CustomerInfoCreateRequest>(customer), HttpContext.RequestAborted); } } } catch (Exception e) { response.Code = ResponseCodeDefines.ServiceError; response.Message = e.ToString(); Logger.Error($"用户{User?.UserName ?? ""}({User?.Id ?? ""})更新缩略图(UploadIcon)报错:\r\n{e.ToString()},请求参数为:\r\n(iconPath){iconPath ?? ""},(dest){dest ?? ""},(Id){Id ?? ""}"); } return(response); }
public async Task <ResponseMessage <ExamineStatusEnum> > CustomerDealBackSellCallback([FromBody] ExamineResponse examineResponse) { Logger.Trace($"新增退售信息回调(CustomerDealBackSellCallback):\r\n请求参数为:\r\n" + (examineResponse != null ? JsonHelper.ToJson(examineResponse) : "")); var response = new ResponseMessage <ExamineStatusEnum>(); if (!ModelState.IsValid) { response.Code = ResponseCodeDefines.ModelStateInvalid; response.Message = ModelState.GetAllErrors(); Logger.Error($"新增退售信息回调(CustomerDealBackSellCallback)模型验证失败:\r\n{response.Message ?? ""},\r\n请求参数为:\r\n" + (examineResponse != null ? JsonHelper.ToJson(examineResponse) : "")); return(response); } try { var customerDeal = await _customerDealManager.FindByIdSimpleAsync(examineResponse.SubmitDefineId); if (customerDeal == null) { response.Code = ResponseCodeDefines.NotFound; response.Message = "成交信息不存在:" + examineResponse.SubmitDefineId; Logger.Error($"新增退售信息回调(CustomerDealBackSellCallback)失败:成交信息不存在,\r\n请求参数为:\r\n" + (examineResponse != null ? JsonHelper.ToJson(examineResponse) : "")); return(response); } if (examineResponse.ExamineStatus == ExamineStatus.Examined) { await _customerDealManager.UpdateStatusDealBackApprovedAsync(examineResponse.SubmitDefineId); response.Extension = ExamineStatusEnum.Approved; } else if (examineResponse.ExamineStatus == ExamineStatus.Reject) { await _customerDealManager.UpdateStatusDealBackRejectAsync(examineResponse.SubmitDefineId); response.Extension = ExamineStatusEnum.Reject; } if (response == null) { response.Code = ResponseCodeDefines.PartialFailure; response.Message = "保存信息失败"; } else { if (!string.IsNullOrEmpty(customerDeal.Salesman) && !string.IsNullOrEmpty(customerDeal.Customer)) { var customer = await _customerInfoManager.FindByIdAsync(customerDeal.Salesman, customerDeal.Customer); //发送通知消息 SendMessageRequest sendMessageRequest = new SendMessageRequest(); sendMessageRequest.MessageTypeCode = "CustomerDealBack"; MessageItem messageItem = new MessageItem(); messageItem.UserIds = new List <string> { customerDeal.Salesman }; messageItem.MessageTypeItems = new List <TypeItem> { new TypeItem { Key = "PHONE", Value = customer.MainPhone }, new TypeItem { Key = "NAME", Value = customer.CustomerName }, new TypeItem { Key = "BUILDINGNAME", Value = string.IsNullOrEmpty(customerDeal.BuildingName)?customerDeal.ShopName:"" }, new TypeItem { Key = "TIME", Value = DateTime.Now.ToString("MM-dd hh:mm") } }; sendMessageRequest.MessageList = new List <MessageItem> { messageItem }; try { MessageLogger.Info("发送通知消息协议:\r\n{0}", JsonHelper.ToJson(sendMessageRequest)); _restClient.Post(ApplicationContext.Current.MessageServerUrl, sendMessageRequest, "POST", new NameValueCollection()); } catch (Exception e) { MessageLogger.Error("发送通知消息出错:\r\n{0}", e.ToString()); } } } } catch (Exception e) { response.Code = ResponseCodeDefines.ServiceError; response.Message = "服务器错误:" + e.ToString(); Logger.Error($"新增退售信息回调(CustomerDealBackSellCallback)报错:\r\n{e.ToString()},\r\n请求参数为:\r\n" + examineResponse != null ? JsonHelper.ToJson(examineResponse) : ""); } return(response); }