public ResponseResult AcceptProject(DelegateRequest requestFrom) { LogHelper.Error("调用接单API:" + requestFrom.ToJson(), null); var responseResult = new ResponseResult(); try { if (string.IsNullOrEmpty(requestFrom.bussinessId)) { throw new InvalidDataException("必填项不能为空"); } var project = JsonConvert.DeserializeObject <ProjectRequest>(requestFrom.bussinessForm); if (project == null) { throw new InvalidDataException("bussinessForm参数不能为空"); } project.BusinessId = requestFrom.bussinessId; var company = CompanyService.GetByCompanyId(project.CompanyId.HasValue?project.CompanyId.Value:0); if (company == null) { throw new InvalidDataException("评估机构参数错误,找不到所属评估机构"); } var resources = JsonConvert.DeserializeObject <IList <ProjectResourceRequest> >(requestFrom.files); var projectReturn = ProjectService.AcceptBusiness(project, resources); responseResult.Code = 0; responseResult.Message = "success"; responseResult.Data = new { ProjectNo = projectReturn.ProjectNo }; } catch (InvalidDataException ex) { responseResult.Code = 1; responseResult.Message = ex.Message; } catch (Exception ex) { responseResult.Code = 1; responseResult.Message = "bussinessForm,files参数为空或者格式不正确"; LogHelper.Error("调用接单API错误日志:", ex); } return(responseResult); }
public ResponseResult AcceptProject(DelegateRequest requestFrom) { LogHelper.Error("调用接单API:" + requestFrom.ToJson(), null); var responseResult = new ResponseResult(); try { if (string.IsNullOrEmpty(requestFrom.bussinessId)) { throw new InvalidDataException("必填项不能为空"); } var project = requestFrom.bussinessForm; if (project == null) { throw new InvalidDataException("bussinessForm参数不能为空"); } project.BusinessId = requestFrom.bussinessId; //if (!project.CompanyId.HasValue) //{ // throw new InvalidDataException("CompanyId参数不能为空"); //} IList <ProjectResourceRequest> resources = requestFrom.files; if (requestFrom.files == null) { resources = new List <ProjectResourceRequest>(); } var projectReturn = ProjectService.ReceiveProject(project, resources, requestFrom.bussinessForm.CompanyName); responseResult.Code = 0; responseResult.Message = "success"; responseResult.Data = new { ProjectNo = projectReturn.ProjectNo }; } catch (InvalidDataException ex) { responseResult.Code = 1; responseResult.Message = ex.Message; } catch (Exception ex) { responseResult.Code = 1; responseResult.Message = "bussinessForm,files参数为空或者格式不正确"; LogHelper.Error("调用接单API错误日志:", ex); } return(responseResult); }