public ResponseResult FinishRevaluation(string userKeyId, [FromBody] RevaluationBaseRequest request)
        {
            LogHelper.Error(string.Format("调用完成复估单API,userKeyId:{0},request:{1}", userKeyId, request.ToJson()), null);
            var responseResult = new ResponseResult();

            try
            {
                var user        = UserService.GetUserByKeyId(userKeyId);
                var revaluation = RevaluationService.GetByRevaluationNo(request.RevalutionNo, user.Id);
                RevaluationService.FinishRevaluation(revaluation.TId, user.Id);
                responseResult.Code    = 0;
                responseResult.Message = "success";
            }
            catch (ServiceException ex)
            {
                responseResult.Code    = 1;
                responseResult.Message = ex.Message;
            }
            catch (Exception ex)
            {
                responseResult.Code    = 1;
                responseResult.Message = "error";
                LogHelper.Error("调用完成复估单API错误日志:", ex);
            }
            return(responseResult);
        }
 public HttpResponseMessage ExportRevaluation(string userKeyId, string revalutionNo)
 {
     try
     {
         var user        = UserService.GetUserByKeyId(userKeyId);
         var revaluation = RevaluationService.GetByRevaluationNo(revalutionNo, user.Id);
         var bytes       = RevaluationService.ExportRevaluation(revaluation.TId, user.Id);
         HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK);
         response.Content = new StreamContent(new MemoryStream(bytes));
         response.Content.Headers.ContentType        = new MediaTypeHeaderValue("application/octet-stream");
         response.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment")
         {
             FileName = string.Format("复估单{0}_{1:yyyyMMddHHmmss}.xls", revalutionNo, DateTime.Now)
         };
         return(response);
     }
     catch (Exception ex)
     {
         return(new HttpResponseMessage(HttpStatusCode.NoContent));
     }
 }
        public ResponseResult GetRevaluationDetail(string userKeyId, string revaluationNo)
        {
            LogHelper.Error(string.Format("调用复估单详细信息API,userKeyId:{0},revaluationNo:{1}", userKeyId, revaluationNo), null);
            var responseResult = new ResponseResult();

            try
            {
                var user        = UserService.GetUserByKeyId(userKeyId);
                var revaluation = RevaluationService.GetByRevaluationNo(revaluationNo, user.Id);
                var items       = revaluation.RevaluationItems.Select(x => new
                {
                    x.TId,
                    x.BusinessId,
                    x.RevaluationId,
                    x.OperationOrganization,
                    x.BorrowerName,
                    x.CreditBalance,
                    x.FiveCategories,
                    x.ContractExpirationDate,
                    x.PropertyType,
                    x.PledgeAddress,
                    x.InitialEstimateValue,
                    x.InitialEstimateOrganization,
                    x.InitialEstimateTime,
                    x.CustomerAccountManager,
                    x.ContactNumber,
                    x.ProtocolNumber,
                    x.CustomerNumber,
                    x.ProjectNo,
                    x.RevaluationTime,
                    x.RevaluationValue,
                    x.ChangeDescription,
                    x.Remark,
                    x.RevaluationDifference,
                    x.RevaluationIncrease,
                    x.IsConsult,
                    x.IsCancelConsult,
                    x.IsApprove,
                    x.ConsultReply,
                    x.CreateTime
                }).ToList();

                responseResult.Code    = 0;
                responseResult.Message = "success";
                responseResult.Data    = new
                {
                    revaluation.TId,
                    revaluation.BusinessId,
                    revaluation.RevaluationNo,
                    revaluation.EvalType,
                    revaluation.RevaluationName,
                    revaluation.RevaluationStatus,
                    revaluation.CreateTime,
                    RevaluationItems = items
                };
            }
            catch (ServiceException ex)
            {
                responseResult.Code    = 1;
                responseResult.Message = ex.Message;
            }
            catch (Exception ex)
            {
                responseResult.Code    = 1;
                responseResult.Message = ex.Message;
                LogHelper.Error("调用公司复估单详细信息API错误日志:", ex);
            }
            return(responseResult);
        }