public async Task <ResponseMessage <bool> > ModifyComplementContract(UserInfo User, [FromBody] List <ContractComplementRequest> request, [FromRoute] string contract)
        {
            Logger.Trace($"用户{User?.UserName ?? ""}({User?.Id ?? ""})修改补充协议基础信息(PutBuildingBaseInfo):\r\n请求参数为:\r\n" + (request != null ? JsonHelper.ToJson(request) : ""));

            var response = new ResponseMessage <bool>();

            if (!ModelState.IsValid)
            {
                response.Code    = ResponseCodeDefines.ModelStateInvalid;
                response.Message = ModelState.GetAllErrors();
                return(response);
            }

            try
            {
                string strModifyGuid = Guid.NewGuid().ToString();

                GatewayInterface.Dto.ExamineSubmitRequest exarequest = new GatewayInterface.Dto.ExamineSubmitRequest();
                exarequest.ContentId      = contract;
                exarequest.ContentType    = "ContractCommit";
                exarequest.ContentName    = "ModifyComplement";
                exarequest.SubmitDefineId = strModifyGuid;
                exarequest.Source         = "";
                exarequest.CallbackUrl    = "";
                exarequest.Action         = "TEST"; /* exarequest.ContentType*/;
                exarequest.TaskName       = $"{User.UserName}修改合同补充协议{exarequest.ContentName}的动态{exarequest.ContentType}";

                GatewayInterface.Dto.UserInfo userinfo = new GatewayInterface.Dto.UserInfo()
                {
                    Id               = User.Id,
                    KeyWord          = User.KeyWord,
                    OrganizationId   = User.OrganizationId,
                    OrganizationName = User.OrganizationName,
                    UserName         = User.UserName
                };

                var examineInterface = ApplicationContext.Current.Provider.GetRequiredService <IExamineInterface>();
                var reponse          = await examineInterface.Submit(userinfo, exarequest);

                if (reponse.Code != ResponseCodeDefines.SuccessCode)
                {
                    response.Code    = ResponseCodeDefines.ServiceError;
                    response.Message = "向审核中心发起审核请求失败:" + reponse.Message;
                    return(response);
                }

                //写发送成功后的表
                response.Extension = await _contractInfoManager.ModifyComplementAsync(User, contract, strModifyGuid, "TEST", request, HttpContext.RequestAborted);

                response.Message = "addcomplement ok";
            }
            catch (Exception e)
            {
                response.Code    = ResponseCodeDefines.ServiceError;
                response.Message = e.ToString();
                Logger.Error($"用户{User?.UserName ?? ""}({User?.Id ?? ""})合同动态提交审核(UpdateRecordSubmit)报错:\r\n{e.ToString()},\r\n请求参数为:\r\n" + (request != null ? JsonHelper.ToJson(request) : ""));
            }

            return(response);
        }
Exemple #2
0
        public async Task <ResponseMessage <List <HumanInfoResponse1> > > CreateHumanInfo(UserInfo User, [FromBody] HumanInfoRequest humanInfoRequest)
        {
            var Response = new ResponseMessage <List <HumanInfoResponse1> >();

            try
            {
                string modifyid = Guid.NewGuid().ToString();

                GatewayInterface.Dto.ExamineSubmitRequest exarequest = new GatewayInterface.Dto.ExamineSubmitRequest();
                //exarequest.ContentId = condition.humaninfo.ID;
                exarequest.ContentType = "HumanCommit";
                //exarequest.ContentName = $"addhuman {condition.humaninfo.Name}";
                exarequest.SubmitDefineId = modifyid;
                exarequest.Source         = "";
                //exarequest.CallbackUrl = ApplicationContext.Current.UpdateExamineCallbackUrl;
                exarequest.Action   = "TEST" /*exarequest.ContentType*/;
                exarequest.TaskName = $"{User.UserName}提交入职请求{exarequest.ContentName}的动态{exarequest.ContentType}";;
                GatewayInterface.Dto.UserInfo userinfo = new GatewayInterface.Dto.UserInfo()
                {
                    Id               = User.Id,
                    KeyWord          = User.KeyWord,
                    OrganizationId   = User.OrganizationId,
                    OrganizationName = User.OrganizationName,
                    UserName         = User.UserName
                };

                var examineInterface = ApplicationContext.Current.Provider.GetRequiredService <IExamineInterface>();
                var reponse          = await examineInterface.Submit(userinfo, exarequest);

                if (reponse.Code != ResponseCodeDefines.SuccessCode)
                {
                    Response.Code    = ResponseCodeDefines.ServiceError;
                    Response.Message = "向审核中心发起审核请求失败:" + reponse.Message;
                    return(Response);
                }

                //if (condition.fileinfo != null)
                //{
                //    NameValueCollection nameValueCollection = new NameValueCollection();
                //    var nwf = CreateNwf(User, "humaninfo", condition.fileinfo);

                //    nameValueCollection.Add("appToken", "app:nwf");
                //    Logger.Info("nwf协议");
                //    string response2 = await _restClient.Post(ApplicationContext.Current.NWFUrl, nwf, "POST", nameValueCollection);
                //    Logger.Info("返回:\r\n{0}", response2);

                //    await _humanManage.CreateFileScopeAsync(User.Id, condition.humaninfo.ID, condition.fileinfo, HttpContext.RequestAborted);
                //}

                //await _humanManage.AddHuman(User, condition.humaninfo, modifyid, "TEST", HttpContext.RequestAborted);
                Response.Message = $"addhumaninfo sucess";
            }
            catch (Exception e)
            {
                Response.Code    = ResponseCodeDefines.ServiceError;
                Response.Message = "服务器错误:" + e.ToString();
                Logger.Error("error");
            }
            return(Response);
        }
Exemple #3
0
        public async Task <ResponseMessage <HumanInfoResponse> > SaveHumanInfo(UserInfo user, HumanInfoRequest humanInfoRequest, CancellationToken cancellationToken = default(CancellationToken))
        {
            ResponseMessage <HumanInfoResponse> response = new ResponseMessage <HumanInfoResponse>();

            if (user == null || humanInfoRequest == null)
            {
                throw new ArgumentNullException(nameof(UserInfo) + nameof(HumanInfoRequest));
            }
            //判断是否新增,则走审核流程
            if (!string.IsNullOrEmpty(humanInfoRequest.Id))
            {
                var result = await GetHumanInfoAsync(user, humanInfoRequest.Id);

                if (result?.Extension != null && (result.Extension?.ExamineStatus != ExamineStatusEnum.UnSubmit || result.Extension?.ExamineStatus != ExamineStatusEnum.Reject) && !result.Extension.IsDeleted)
                {
                    var gatwayurl = ApplicationContext.Current.AppGatewayUrl.EndsWith("/") ? ApplicationContext.Current.AppGatewayUrl.TrimEnd('/') : ApplicationContext.Current.AppGatewayUrl;
                    GatewayInterface.Dto.ExamineSubmitRequest examineSubmitRequest = new GatewayInterface.Dto.ExamineSubmitRequest();
                    examineSubmitRequest.ContentId       = !string.IsNullOrEmpty(humanInfoRequest.Id) ? humanInfoRequest.Id : "";
                    examineSubmitRequest.ContentType     = "HumanInfo";
                    examineSubmitRequest.ContentName     = humanInfoRequest.Name;
                    examineSubmitRequest.Content         = "新增员工人事信息";
                    examineSubmitRequest.Source          = user.FilialeName;
                    examineSubmitRequest.CallbackUrl     = gatwayurl + "/api/humaninfo/humaninfocallback";
                    examineSubmitRequest.StepCallbackUrl = gatwayurl + "/api/humaninfo/shoponsitestepcallback";
                    examineSubmitRequest.Action          = "HumanInfo";
                    examineSubmitRequest.TaskName        = $"新增员工人事信息:{humanInfoRequest.Name}";
                    examineSubmitRequest.Desc            = $"新增员工人事信息";

                    GatewayInterface.Dto.UserInfo userInfo = new GatewayInterface.Dto.UserInfo()
                    {
                        Id               = user.Id,
                        KeyWord          = user.KeyWord,
                        OrganizationId   = user.OrganizationId,
                        OrganizationName = user.OrganizationName,
                        UserName         = user.UserName
                    };
                    examineSubmitRequest.UserInfo = userInfo;

                    string tokenUrl         = $"{ApplicationContext.Current.AuthUrl}/connect/token";
                    string examineCenterUrl = $"{ApplicationContext.Current.ExamineCenterUrl}";
                    Logger.Info($"新增员工人事信息提交审核,\r\ntokenUrl:{tokenUrl ?? ""},\r\nexamineCenterUrl:{examineCenterUrl ?? ""},\r\nexamineSubmitRequest:" + (examineSubmitRequest != null ? JsonHelper.ToJson(examineSubmitRequest) : ""));
                    var tokenManager = new TokenManager(tokenUrl, ApplicationContext.Current.ClientID, ApplicationContext.Current.ClientSecret);
                    //var response2 = await tokenManager.Execute(async (token) =>
                    //{
                    //    return await _restClient.PostWithToken<ResponseMessage>(examineCenterUrl, examineSubmitRequest, token);
                    //});
                    //if (response2.Code != ResponseCodeDefines.SuccessCode)
                    //{
                    //    response.Code = ResponseCodeDefines.ServiceError;
                    //    response.Message = "向审核中心发起审核请求失败:" + response2.Message;
                    //    Logger.Info($"新增员工人事信息提交审核失败:" + response2.Message);
                    //    return response;
                    //}
                }
            }
            response.Extension = _mapper.Map <HumanInfoResponse>(await Store.SaveAsync(user, _mapper.Map <HumanInfo>(humanInfoRequest), cancellationToken));
            return(response);
        }
Exemple #4
0
        public async Task <ResponseMessage> LeaveHumanInfo(UserInfo User, [FromBody] LeaveInfoRequest condition)
        {
            var pagingResponse = new ResponseMessage();

            if (!ModelState.IsValid)
            {
                pagingResponse.Code = ResponseCodeDefines.ModelStateInvalid;
                Logger.Warn($"用户{User?.UserName ?? ""}({User?.Id ?? ""})人事离职条件(PostCustomerListSaleMan)模型验证失败:\r\n{pagingResponse.Message ?? ""},\r\n请求参数为:\r\n" + (condition != null ? JsonHelper.ToJson(condition) : ""));
                return(pagingResponse);
            }

            try
            {
                string modifyid = Guid.NewGuid().ToString();

                GatewayInterface.Dto.ExamineSubmitRequest exarequest = new GatewayInterface.Dto.ExamineSubmitRequest();
                exarequest.ContentId      = condition.ID;
                exarequest.ContentType    = "HumanCommit";
                exarequest.ContentName    = $"leavehuman {condition.IDCard}";
                exarequest.SubmitDefineId = modifyid;
                exarequest.Source         = "";
                //exarequest.CallbackUrl = ApplicationContext.Current.UpdateExamineCallbackUrl;
                exarequest.Action   = "TEST" /*exarequest.ContentType*/;
                exarequest.TaskName = $"{User.UserName}提交离职请求{exarequest.ContentName}的动态{exarequest.ContentType}";;
                GatewayInterface.Dto.UserInfo userinfo = new GatewayInterface.Dto.UserInfo()
                {
                    Id               = User.Id,
                    KeyWord          = User.KeyWord,
                    OrganizationId   = User.OrganizationId,
                    OrganizationName = User.OrganizationName,
                    UserName         = User.UserName
                };

                var examineInterface = ApplicationContext.Current.Provider.GetRequiredService <IExamineInterface>();
                var reponse          = await examineInterface.Submit(userinfo, exarequest);

                if (reponse.Code != ResponseCodeDefines.SuccessCode)
                {
                    pagingResponse.Code    = ResponseCodeDefines.ServiceError;
                    pagingResponse.Message = "向审核中心发起审核请求失败:" + reponse.Message;
                    return(pagingResponse);
                }

                await _humanManage.PreLeaveHuman(User, modifyid, condition, "TEST", HttpContext.RequestAborted);

                //await _humanManage.LeaveHuman(condition, HttpContext.RequestAborted);
            }
            catch (Exception e)
            {
                pagingResponse.Code    = ResponseCodeDefines.ServiceError;
                pagingResponse.Message = "服务器错误:" + e.ToString();
                Logger.Error($"用户{User?.UserName ?? ""}({User?.Id ?? ""})员工离职条件(PostCustomerListSaleMan)请求失败:\r\n{pagingResponse.Message ?? ""},\r\n请求参数为:\r\n" + (condition != null ? JsonHelper.ToJson(condition) : ""));
            }
            return(pagingResponse);
        }
Exemple #5
0
        public async Task <ResponseMessage> UpdateRecordSubmit(UserInfo user, [FromBody] UpdateRecordRequest updateRecordRequest)
        {
            Logger.Trace($"用户{user?.UserName ?? ""}({user?.Id ?? ""})热卖、加推、报备规则、佣金方案、楼栋批次、优惠政策审核提交接口(UpdateRecordSubmit)请求参数为:\r\n" + (updateRecordRequest != null ? JsonHelper.ToJson(updateRecordRequest) : ""));

            ResponseMessage response = new ResponseMessage();

            if (!ModelState.IsValid)
            {
                response.Code    = ResponseCodeDefines.ModelStateInvalid;
                response.Message = ModelState.GetAllErrors();
                return(response);
            }
            try
            {
                GatewayInterface.Dto.ExamineSubmitRequest examineSubmitRequest = new GatewayInterface.Dto.ExamineSubmitRequest();
                examineSubmitRequest.ContentId      = updateRecordRequest.ContentId;
                examineSubmitRequest.ContentType    = updateRecordRequest.ContentType;
                examineSubmitRequest.ContentName    = updateRecordRequest.ContentName;
                examineSubmitRequest.SubmitDefineId = updateRecordRequest.Id;
                examineSubmitRequest.Source         = "";
                examineSubmitRequest.CallbackUrl    = ApplicationContext.Current.UpdateExamineCallbackUrl;
                examineSubmitRequest.Action         = updateRecordRequest.ContentType;
                examineSubmitRequest.TaskName       = $"{user.UserName}提交楼盘{updateRecordRequest.ContentName}的动态{updateRecordRequest.ContentType}";
                examineSubmitRequest.Ext1           = updateRecordRequest.Ext1;
                examineSubmitRequest.Ext2           = updateRecordRequest.Ext2;
                GatewayInterface.Dto.UserInfo userInfo = new GatewayInterface.Dto.UserInfo()
                {
                    Id               = user.Id,
                    KeyWord          = user.KeyWord,
                    OrganizationId   = user.OrganizationId,
                    OrganizationName = user.OrganizationName,
                    UserName         = user.UserName
                };
                Logger.Info($"用户{user?.UserName ?? ""}({user?.Id ?? ""})房源动态提交审核(UpdateRecordSubmit)请求参数为:\r\n" + (examineSubmitRequest != null ? JsonHelper.ToJson(examineSubmitRequest) : ""));

                var _examineInterface = ApplicationContext.Current.Provider.GetRequiredService <IExamineInterface>();
                var response2         = await _examineInterface.Submit(userInfo, examineSubmitRequest);

                if (response2.Code != ResponseCodeDefines.SuccessCode)
                {
                    response.Code    = ResponseCodeDefines.ServiceError;
                    response.Message = "向审核中心发起审核请求失败:" + response2.Message;
                    Logger.Error($"用户{user?.UserName ?? ""}({user?.Id ?? ""})房源动态提交审核(UpdateRecordSubmit)报错:\r\n{response.Message ?? ""},\r\n请求参数为:\r\n" + (examineSubmitRequest != null ? JsonHelper.ToJson(examineSubmitRequest) : ""));
                    return(response);
                }
                await _updateRecordManager.CreateUpdateRecordAsync(user, updateRecordRequest, Models.ExamineStatusEnum.Auditing, HttpContext.RequestAborted);
            }
            catch (Exception e)
            {
                response.Code    = ResponseCodeDefines.ServiceError;
                response.Message = e.ToString();
                Logger.Error($"用户{user?.UserName ?? ""}({user?.Id ?? ""})房源动态提交审核(UpdateRecordSubmit)报错:\r\n{e.ToString()},\r\n请求参数为:\r\n" + (updateRecordRequest != null ? JsonHelper.ToJson(updateRecordRequest) : ""));
            }
            return(response);
        }
Exemple #6
0
        public async Task <ResponseMessage <HumanPositionResponse> > CreateAsync(UserInfo user, HumanPositionRequest humanPositionRequest, CancellationToken cancellationToken = default(CancellationToken))
        {
            ResponseMessage <HumanPositionResponse> response = new ResponseMessage <HumanPositionResponse>();

            if (user == null)
            {
                throw new ArgumentNullException(nameof(user));
            }
            if (humanPositionRequest == null)
            {
                throw new ArgumentNullException(nameof(humanPositionRequest));
            }
            var org = await _permissionExpansionManager.GetOrganizationOfPermission(user.Id, "HumanPosition");

            if (org == null || org.Count == 0 || !org.Contains(humanPositionRequest.DepartmentId))
            {
                response.Code    = ResponseCodeDefines.NotAllow;
                response.Message = "没有权限";
                return(response);
            }
            if (string.IsNullOrEmpty(humanPositionRequest.Id))
            {
                humanPositionRequest.Id = Guid.NewGuid().ToString();
            }
            var gatwayurl = ApplicationContext.Current.AppGatewayUrl.EndsWith("/") ? ApplicationContext.Current.AppGatewayUrl.TrimEnd('/') : ApplicationContext.Current.AppGatewayUrl;

            GatewayInterface.Dto.ExamineSubmitRequest examineSubmitRequest = new GatewayInterface.Dto.ExamineSubmitRequest();
            examineSubmitRequest.ContentId       = humanPositionRequest.Id;
            examineSubmitRequest.ContentType     = "HumanPosition";
            examineSubmitRequest.ContentName     = humanPositionRequest.Name;
            examineSubmitRequest.Content         = "新增职位信息";
            examineSubmitRequest.Source          = user.FilialeName;
            examineSubmitRequest.SubmitDefineId  = humanPositionRequest.Id;
            examineSubmitRequest.CallbackUrl     = gatwayurl + "/api/humanposition/humanpositioncallback";
            examineSubmitRequest.StepCallbackUrl = gatwayurl + "/api/humanposition/humanpositionstepcallback";
            examineSubmitRequest.Action          = "HumanPosition";
            examineSubmitRequest.TaskName        = $"新增职位信息:{humanPositionRequest.Name}";
            examineSubmitRequest.Desc            = $"新增职位信息";

            GatewayInterface.Dto.UserInfo userInfo = new GatewayInterface.Dto.UserInfo()
            {
                Id               = user.Id,
                KeyWord          = user.KeyWord,
                OrganizationId   = user.OrganizationId,
                OrganizationName = user.OrganizationName,
                UserName         = user.UserName
            };
            examineSubmitRequest.UserInfo = userInfo;

            string tokenUrl         = $"{ApplicationContext.Current.AuthUrl}/connect/token";
            string examineCenterUrl = $"{ApplicationContext.Current.ExamineCenterUrl}";

            Logger.Info($"新增员工人事调动信息提交审核,\r\ntokenUrl:{tokenUrl ?? ""},\r\nexamineCenterUrl:{examineCenterUrl ?? ""},\r\nexamineSubmitRequest:" + (examineSubmitRequest != null ? JsonHelper.ToJson(examineSubmitRequest) : ""));
            var tokenManager = new TokenManager(tokenUrl, ApplicationContext.Current.ClientID, ApplicationContext.Current.ClientSecret);
            var response2    = await tokenManager.Execute(async (token) =>
            {
                return(await _restClient.PostWithToken <ResponseMessage>(examineCenterUrl, examineSubmitRequest, token));
            });

            if (response2.Code != ResponseCodeDefines.SuccessCode)
            {
                response.Code    = ResponseCodeDefines.ServiceError;
                response.Message = "向审核中心发起审核请求失败:" + response2.Message;
                Logger.Info($"新增职位信息提交审核失败:" + response2.Message);
                return(response);
            }

            response.Extension = _mapper.Map <HumanPositionResponse>(await Store.CreateAsync(user, _mapper.Map <HumanPosition>(humanPositionRequest), cancellationToken));
            return(response);
        }
        public async Task <ResponseMessage <bool> > AddContract(UserInfo User, [FromBody] ContractInfoRequest request)
        {
            Logger.Trace($"用户{User?.UserName ?? ""}({User?.Id ?? ""})保存合同基础信息(PutBuildingBaseInfo):\r\n请求参数为:\r\n" + (request != null ? JsonHelper.ToJson(request) : ""));

            if (User.Id == null)
            {
                {
                    User.Id             = "66df64cb-67c5-4645-904f-704ff92b3e81";
                    User.UserName       = "******";
                    User.KeyWord        = "";
                    User.OrganizationId = "270";
                    User.PhoneNumber    = "18122132334";
                };
            }

            var response = new ResponseMessage <bool>();

            if (!ModelState.IsValid)
            {
                response.Code    = ResponseCodeDefines.ModelStateInvalid;
                response.Message = ModelState.GetAllErrors();
                return(response);
            }

            try
            {
                GatewayInterface.Dto.ExamineSubmitRequest exarequest = new GatewayInterface.Dto.ExamineSubmitRequest();
                exarequest.ContentId      = request.ID;
                exarequest.ContentType    = "ContractCommit";
                exarequest.ContentName    = request.Name;
                exarequest.SubmitDefineId = Guid.NewGuid().ToString();
                exarequest.Source         = "";
                exarequest.CallbackUrl    = "";
                exarequest.Action         = "TEST" /*exarequest.ContentType*/;
                exarequest.TaskName       = $"{User.UserName}提交合同{exarequest.ContentName}的动态{exarequest.ContentType}";;
                GatewayInterface.Dto.UserInfo userinfo = new GatewayInterface.Dto.UserInfo()
                {
                    Id               = User.Id,
                    KeyWord          = User.KeyWord,
                    OrganizationId   = User.OrganizationId,
                    OrganizationName = User.OrganizationName,
                    UserName         = User.UserName
                };

                var examineInterface = ApplicationContext.Current.Provider.GetRequiredService <IExamineInterface>();
                var reponse          = await examineInterface.Submit(userinfo, exarequest);

                if (reponse.Code != ResponseCodeDefines.SuccessCode)
                {
                    response.Code    = ResponseCodeDefines.ServiceError;
                    response.Message = "向审核中心发起审核请求失败:" + reponse.Message;
                    return(response);
                }

                //写发送成功后的表
                await _contractInfoManager.CreateAsync(User, request, exarequest.SubmitDefineId, "TEST", HttpContext.RequestAborted);
            }
            catch (Exception e)
            {
                response.Code    = ResponseCodeDefines.ServiceError;
                response.Message = e.ToString();
                Logger.Error($"用户{User?.UserName ?? ""}({User?.Id ?? ""})合同动态提交审核(UpdateRecordSubmit)报错:\r\n{e.ToString()},\r\n请求参数为:\r\n" + (request != null ? JsonHelper.ToJson(request) : ""));
            }

            return(response);
        }
        public async Task <ResponseMessage <string> > ModifySimpleContract(UserInfo User, [FromBody] ContractContentInfoRequest request)
        {
            Logger.Trace($"用户{User?.UserName ?? ""}({User?.Id ?? ""})保存合同基础信息(PutBuildingBaseInfo):\r\n请求参数为:\r\n" + (request != null ? JsonHelper.ToJson(request) : ""));

            var response = new ResponseMessage <string>();

            if (!ModelState.IsValid)
            {
                response.Code    = ResponseCodeDefines.ModelStateInvalid;
                response.Message = ModelState.GetAllErrors();
                return(response);
            }

            try
            {
                //写发送成功后的表
                var guid = Guid.NewGuid().ToString();

                //审核提交
                GatewayInterface.Dto.ExamineSubmitRequest exarequest = new GatewayInterface.Dto.ExamineSubmitRequest();
                exarequest.ContentId      = request.BaseInfo.ID;
                exarequest.ContentType    = "ContractCommit";
                exarequest.ContentName    = "Modify";
                exarequest.SubmitDefineId = guid;
                exarequest.Source         = "";
                exarequest.CallbackUrl    = "";
                exarequest.Action         = "TEST" /*"TEST" exarequest.ContentType*/;
                exarequest.TaskName       = $"{User.UserName}修改合同{exarequest.ContentName}的动态{exarequest.ContentType}";

                GatewayInterface.Dto.UserInfo userinfo = new GatewayInterface.Dto.UserInfo()
                {
                    Id               = User.Id,
                    KeyWord          = User.KeyWord,
                    OrganizationId   = User.OrganizationId,
                    OrganizationName = User.OrganizationName,
                    UserName         = User.UserName
                };

                var examineInterface = ApplicationContext.Current.Provider.GetRequiredService <IExamineInterface>();
                var reponse          = await examineInterface.Submit(userinfo, exarequest);

                if (reponse.Code != ResponseCodeDefines.SuccessCode)
                {
                    response.Code    = ResponseCodeDefines.ServiceError;
                    response.Message = "向审核中心发起审核请求失败:" + reponse.Message;
                    return(response);
                }

                Logger.Trace($"{exarequest.ContentId}发生审核成功");
                request.BaseInfo.Num = string.IsNullOrEmpty(request.BaseInfo.Num) ? await _contractInfoManager.GetContractNum(request.BaseInfo.ID, HttpContext.RequestAborted) : request.BaseInfo.Num;

                await _contractInfoManager.ModifyContractBeforCheckAsync(User, request, guid, "TEST", HttpContext.RequestAborted);


                response.Extension = guid;
                response.Message   = "modify simple ok";
            }
            catch (Exception e)
            {
                response.Code    = ResponseCodeDefines.ServiceError;
                response.Message = e.ToString();
                Logger.Error($"用户{User?.UserName ?? ""}({User?.Id ?? ""})合同动态提交审核(UpdateRecordSubmit)报错:\r\n{e.ToString()},\r\n请求参数为:\r\n" + (request != null ? JsonHelper.ToJson(request) : ""));
            }

            return(response);
        }
        public async Task <ResponseMessage <ContractInfoResponse> > AddSimpleContract(UserInfo User, [FromBody] ContractContentInfoRequest request)
        {
            Logger.Trace($"用户{User?.UserName ?? ""}({User?.Id ?? ""})保存合同基础信息(PutBuildingBaseInfo):\r\n请求参数为:\r\n" + (request != null ? JsonHelper.ToJson(request) : ""));

            var response = new ResponseMessage <ContractInfoResponse>();

            if (!ModelState.IsValid)
            {
                response.Code    = ResponseCodeDefines.ModelStateInvalid;
                response.Message = ModelState.GetAllErrors();
                return(response);
            }

            try
            {
                //写发送成功后的表
                if (!string.IsNullOrEmpty(User.OrganizationId))
                {
                    var resp = await _restClient.Get <ResponseMessage <string> >($"http://localhost:5000/api/Organization/{User.OrganizationId}", null);

                    request.BaseInfo.CreateDepartment = resp.Extension;
                }

                string strModifyGuid = "";
                if (request.Modifyinfo != null && request.Modifyinfo.Count > 0)
                {
                    strModifyGuid = request.Modifyinfo.ElementAt(0).ID;
                }
                else
                {
                    strModifyGuid      = Guid.NewGuid().ToString();
                    request.Modifyinfo = new List <ContractModifyResponse>();
                    request.Modifyinfo.Add(new ContractModifyResponse {
                        ID = strModifyGuid
                    });
                }


                GatewayInterface.Dto.ExamineSubmitRequest exarequest = new GatewayInterface.Dto.ExamineSubmitRequest();
                exarequest.ContentId      = request.BaseInfo.ID;
                exarequest.ContentType    = "ContractCommit";
                exarequest.ContentName    = "AddContract";
                exarequest.SubmitDefineId = strModifyGuid;
                exarequest.Source         = "";
                exarequest.CallbackUrl    = "";
                exarequest.Action         = "TEST"; /* exarequest.ContentType*/;
                exarequest.TaskName       = $"{User.UserName}添加合同{exarequest.ContentName}的动态{exarequest.ContentType}";

                GatewayInterface.Dto.UserInfo userinfo = new GatewayInterface.Dto.UserInfo()
                {
                    Id               = User.Id,
                    KeyWord          = User.KeyWord,
                    OrganizationId   = User.OrganizationId,
                    OrganizationName = User.OrganizationName,
                    UserName         = User.UserName
                };

                var examineInterface = ApplicationContext.Current.Provider.GetRequiredService <IExamineInterface>();
                var reponse          = await examineInterface.Submit(userinfo, exarequest);

                if (reponse.Code != ResponseCodeDefines.SuccessCode)
                {
                    response.Code    = ResponseCodeDefines.ServiceError;
                    response.Message = "向审核中心发起审核请求失败:" + reponse.Message;
                    return(response);
                }
                request.BaseInfo.Num = await _contractInfoManager.GetContractNum(request.BaseInfo.ID, HttpContext.RequestAborted);

                response.Extension = await _contractInfoManager.AddContractAsync(User, strModifyGuid, request, "TEST", HttpContext.RequestAborted);

                response.Message = "add simple ok";
            }
            catch (Exception e)
            {
                response.Code    = ResponseCodeDefines.ServiceError;
                response.Message = e.ToString();
                Logger.Error($"用户{User?.UserName ?? ""}({User?.Id ?? ""})合同动态提交审核(UpdateRecordSubmit)报错:\r\n{e.ToString()},\r\n请求参数为:\r\n" + (request != null ? JsonHelper.ToJson(request) : ""));
            }

            return(response);
        }
Exemple #10
0
        public async Task <ResponseMessage> UploadFiles(UserInfo user, [FromBody] FileUploadRequest fileInfoRequests, [FromQuery] string source, [FromRoute] string dest, [FromRoute] string contractId)
        {
            ResponseMessage response = new ResponseMessage();

            if (fileInfoRequests == null || ((fileInfoRequests.AddFileList == null && fileInfoRequests.AddFileList.Count == 0) && (fileInfoRequests.DeleteFileList == null && fileInfoRequests.DeleteFileList.Count == 0)))
            {
                response.Code    = ResponseCodeDefines.ArgumentNullError;
                response.Message = "请求参数错误";
                Logger.Warn($"用户{user?.UserName ?? ""}({user?.Id ?? ""})批量上传文件信息(UploadFiles)模型验证失败:\r\n{response.Message ?? ""},请求参数为:\r\n(source){source ?? ""},(dest){dest ?? ""},(contractId){contractId ?? ""}," + (fileInfoRequests != null ? JsonHelper.ToJson(fileInfoRequests) : ""));
                return(response);
            }
            var info = await _contractInfoManager.FindByIdAsync(contractId, HttpContext.RequestAborted);

            if (info == null)
            {
                response.Code    = ResponseCodeDefines.NotFound;
                response.Message = "合同不存在:" + contractId;
                Logger.Error($"合同文件上传失败:合同不存在,\r\n请求参数为:\r\n" + (fileInfoRequests != null ? JsonHelper.ToJson(fileInfoRequests) : ""));
                return(response);
            }


            List <FileInfo>         fileInfos = new List <FileInfo>();
            List <FileItemResponse> fileItems = new List <FileItemResponse>();

            fileInfos = await _fileScopeManager.FindByContractIdAsync(user.Id, contractId);

            if (fileInfoRequests.DeleteFileList != null && fileInfoRequests.DeleteFileList.Count > 0)
            {
                //删除信息此处只存待审核通过后一并删除
            }
            if (fileInfoRequests.AddFileList != null && fileInfoRequests.AddFileList.Count > 0)
            {
            }

            string strModifyGuid = Guid.NewGuid().ToString();

            try
            {
                if (fileInfoRequests.ModifyFileList != null && fileInfoRequests.ModifyFileList.Count > 0)
                {
                    await _fileScopeManager.UpdateFileExtInfo(fileInfoRequests.ModifyFileList, HttpContext.RequestAborted);
                }
                GatewayInterface.Dto.ExamineSubmitRequest exarequest = new GatewayInterface.Dto.ExamineSubmitRequest();
                exarequest.ContentId      = contractId;
                exarequest.ContentType    = "ContractCommit";
                exarequest.ContentName    = "UploadFiles";
                exarequest.SubmitDefineId = strModifyGuid;
                exarequest.Source         = "";
                exarequest.CallbackUrl    = "";
                exarequest.Action         = "TEST"; /* exarequest.ContentType*/;
                exarequest.TaskName       = $"{user.UserName}添加合同附件{exarequest.ContentName}的动态{exarequest.ContentType}";

                GatewayInterface.Dto.UserInfo userinfo = new GatewayInterface.Dto.UserInfo()
                {
                    Id               = user.Id,
                    KeyWord          = user.KeyWord,
                    OrganizationId   = user.OrganizationId,
                    OrganizationName = user.OrganizationName,
                    UserName         = user.UserName
                };

                var examineInterface = ApplicationContext.Current.Provider.GetRequiredService <IExamineInterface>();
                var reponse          = await examineInterface.Submit(userinfo, exarequest);

                if (reponse.Code != ResponseCodeDefines.SuccessCode)
                {
                    response.Code    = ResponseCodeDefines.ServiceError;
                    response.Message = "向审核中心发起审核请求失败:" + reponse.Message;
                    return(response);
                }

                response.Message = "发起审核成功";



                await _fileScopeManager.CreateModifyAsync(user, contractId, strModifyGuid, "TEST", JsonHelper.ToJson(fileInfoRequests.AddFileList),
                                                          null, JsonHelper.ToJson(user), dest, JsonHelper.ToJson(fileInfoRequests.DeleteFileList), HttpContext.RequestAborted);//添加修改历史

                response.Message = "添加附件修改成功";
            }
            catch (Exception e)
            {
                response.Code    = ResponseCodeDefines.ServiceError;
                response.Message = e.ToString();
                Logger.Error($"上传文件信息回调(FileCallback)模型验证失败:\r\n{e.ToString()},请求参数为:\r\n" + (fileInfoRequests != null ? JsonHelper.ToJson(fileInfoRequests) : ""));
            }


            return(response);
        }
        public async Task <ResponseMessage <CustomerDealResponse> > AddCustomerDealSubmit(UserInfo user, [FromQuery] string source, [FromBody] CustomerDealRequest customerDealRequest)
        {
            Logger.Trace($"用户{user?.UserName ?? ""}({user?.Id ?? ""})新增成交信息(CustomerRDealSubmit):\r\n请求参数为:\r\n(source){source ?? ""}\r\n" + (customerDealRequest != null ? JsonHelper.ToJson(customerDealRequest) : ""));

            var response = new ResponseMessage <CustomerDealResponse>();

            if (!ModelState.IsValid)
            {
                response.Code    = ResponseCodeDefines.ModelStateInvalid;
                response.Message = ModelState.GetAllErrors();
                Logger.Warn($"用户{user?.UserName ?? ""}({user?.Id ?? ""})新增成交信息(CustomerRDealSubmit)模型验证失败:\r\n{response.Message ?? ""},\r\n请求参数为:\r\n(source){source ?? ""}\r\n" + (customerDealRequest != null ? JsonHelper.ToJson(customerDealRequest) : ""));
                return(response);
            }
            try
            {
                string dealId = Guid.NewGuid().ToString();
                var    r      = await _customerDealManager.CustiomerDealSubmitAsync(user, dealId, customerDealRequest, HttpContext.RequestAborted);

                if (r == null)
                {
                    response         = new ResponseMessage <CustomerDealResponse>();
                    response.Code    = ResponseCodeDefines.PartialFailure;
                    response.Message = "保存信息失败,当前商铺已有成交信息";
                }
                else
                {
                    if (customerDealRequest.SellerType == SellerType.SinceSale)
                    {
                        GatewayInterface.Dto.ExamineSubmitRequest examineSubmitRequest = new GatewayInterface.Dto.ExamineSubmitRequest();
                        examineSubmitRequest.ContentId      = customerDealRequest.ShopId;
                        examineSubmitRequest.ContentType    = "CustomerDeal";
                        examineSubmitRequest.ContentName    = customerDealRequest.ShopName;
                        examineSubmitRequest.Content        = "";
                        examineSubmitRequest.SubmitDefineId = r.Extension.Id;
                        examineSubmitRequest.Source         = "";
                        examineSubmitRequest.CallbackUrl    = "通过http回调时再设置回调地址";
                        examineSubmitRequest.Action         = "CustomerDeal";
                        examineSubmitRequest.TaskName       = $"客户成交:{customerDealRequest.Customer}";
                        examineSubmitRequest.Desc           = $"客户成交";
                        examineSubmitRequest.Ext1           = customerDealRequest.BuildingName;
                        examineSubmitRequest.Ext7           = user.Id;
                        examineSubmitRequest.Ext8           = user.OrganizationId;

                        GatewayInterface.Dto.UserInfo userInfo = new GatewayInterface.Dto.UserInfo()
                        {
                            Id               = user.Id,
                            KeyWord          = user.KeyWord,
                            OrganizationId   = user.OrganizationId,
                            OrganizationName = user.OrganizationName,
                            UserName         = user.UserName
                        };

                        var _examineInterface = ApplicationContext.Current.Provider.GetRequiredService <IExamineInterface>();

                        if (await _customerDealManager.UpdateShopStatusAsync(user.Id, r.Extension.ProjectId, r.Extension.ShopId, "18"))
                        {
                            var response2 = await _examineInterface.Submit(userInfo, examineSubmitRequest);

                            if (response2.Code != ResponseCodeDefines.SuccessCode)
                            {
                                response.Code    = ResponseCodeDefines.ServiceError;
                                response.Message = "向审核中心发起审核请求失败:" + response2.Message;
                                return(response);
                            }
                        }
                        else
                        {
                            response.Code    = ResponseCodeDefines.NotAllow;
                            response.Message = "发生了意外的错误";
                            return(response);
                        }
                    }
                    else if (customerDealRequest.SellerType == SellerType.ThirdPartySale || customerDealRequest.SellerType == SellerType.Unknown)
                    {
                        await _customerDealManager.UpdateStatusDealAsync(user.Id, user.OrganizationId, r.Extension.Id);
                    }
                }
            }
            catch (Exception e)
            {
                response.Code    = ResponseCodeDefines.ServiceError;
                response.Message = "服务器错误:" + e.ToString();
                Logger.Error($"用户{user?.UserName ?? ""}({user?.Id ?? ""})新增成交信息(PostListCustomerReportByStatusDea)请求失败:\r\n{response.Message ?? ""},\r\n请求参数为:\r\n" + (customerDealRequest != null ? JsonHelper.ToJson(customerDealRequest) : ""));
            }
            return(response);
        }
        public async Task <ResponseMessage <CustomerDealResponse> > CustomerDealBackSellSubmit(UserInfo user, [FromRoute] string id)
        {
            Logger.Trace($"用户{user?.UserName ?? ""}({user?.Id ?? ""})新增退售信息(CustomerDealBackSellSubmit):\r\n请求参数为:\r\n(id){id ?? ""}");

            var response = new ResponseMessage <CustomerDealResponse>();

            if (string.IsNullOrEmpty(id))
            {
                response.Code    = ResponseCodeDefines.ModelStateInvalid;
                response.Message = "传入参数为空";
                Logger.Warn($"用户{user?.UserName ?? ""}({user?.Id ?? ""})新增退售信息(CustomerDealBackSellSubmit)模型验证失败:\r\n{response.Message ?? ""},\r\n请求参数为:\r\n(id){id ?? ""}");
                return(response);
            }
            try
            {
                var r = await _customerDealManager.FindByIdSimpleAsync(id, HttpContext.RequestAborted);

                if (r == null)
                {
                    response         = new ResponseMessage <CustomerDealResponse>();
                    response.Code    = ResponseCodeDefines.PartialFailure;
                    response.Message = "保存信息失败,当前商铺尚未找到成交信息";
                }
                else
                {
                    GatewayInterface.Dto.ExamineSubmitRequest examineSubmitRequest = new GatewayInterface.Dto.ExamineSubmitRequest();
                    examineSubmitRequest.ContentId      = r.ShopId;
                    examineSubmitRequest.ContentType    = "CustomerDealBackSell";
                    examineSubmitRequest.ContentName    = r.ShopName;
                    examineSubmitRequest.Content        = "";
                    examineSubmitRequest.SubmitDefineId = r.Id;
                    examineSubmitRequest.Source         = "";
                    examineSubmitRequest.CallbackUrl    = "通过http回调时再设置回调地址";
                    examineSubmitRequest.Action         = "CustomerDealBack";
                    examineSubmitRequest.TaskName       = $"客户成交:{r.Customer}";
                    examineSubmitRequest.Desc           = $"客户成交退售";
                    examineSubmitRequest.Ext1           = r.BuildingName;
                    examineSubmitRequest.Ext7           = user.Id;
                    examineSubmitRequest.Ext8           = user.OrganizationId;

                    GatewayInterface.Dto.UserInfo userInfo = new GatewayInterface.Dto.UserInfo()
                    {
                        Id               = user.Id,
                        KeyWord          = user.KeyWord,
                        OrganizationId   = user.OrganizationId,
                        OrganizationName = user.OrganizationName,
                        UserName         = user.UserName
                    };

                    var _examineInterface = ApplicationContext.Current.Provider.GetRequiredService <IExamineInterface>();

                    if (await _customerDealManager.UpdateShopStatusAsync(user.Id, r.ProjectId, r.ShopId, "35") && await _customerDealManager.UpdateStatusDealBackAsync(r.Id))
                    {
                        var response2 = await _examineInterface.Submit(userInfo, examineSubmitRequest);

                        if (response2.Code != ResponseCodeDefines.SuccessCode)
                        {
                            response.Code    = ResponseCodeDefines.ServiceError;
                            response.Message = "向审核中心发起审核请求失败:" + response2.Message;
                            return(response);
                        }
                    }
                    else
                    {
                        response.Code    = ResponseCodeDefines.NotAllow;
                        response.Message = "发生了意外的错误";
                        return(response);
                    }
                }
            }
            catch (Exception e)
            {
                response.Code    = ResponseCodeDefines.ServiceError;
                response.Message = "服务器错误:" + e.ToString();
                Logger.Error($"用户{user?.UserName ?? ""}({user?.Id ?? ""})新增退售信息(CustomerDealBackSellSubmit)请求失败:\r\n{response.Message ?? ""},\r\n请求参数为:\r\n(id){id ?? ""}");
            }
            return(response);
        }
        public async Task <ResponseMessage <Models.ExamineStatusEnum> > SubmitShops(UserInfo user, [FromRoute] string shopsId)
        {
            Logger.Trace($"用户{user?.UserName ?? ""}({user?.Id ?? ""})提交审核(SubmitShops):\r\n请求参数为:\r\n(shopsId){shopsId ?? ""}");

            ResponseMessage <Models.ExamineStatusEnum> response = new ResponseMessage <Models.ExamineStatusEnum>();

            if (!ModelState.IsValid)
            {
                response.Code    = ResponseCodeDefines.ModelStateInvalid;
                response.Message = ModelState.GetAllErrors();
                Logger.Warn($"用户{user?.UserName ?? ""}({user?.Id ?? ""})提交审核(SubmitShops)模型验证失败:\r\n{response.Message ?? ""},\r\n请求参数为:\r\n(shopsId){shopsId ?? ""}");
                return(response);
            }
            try
            {
                var shops = await _shopsManager.FindByIdAsync(user.Id, shopsId);

                if (shops == null)
                {
                    response.Code    = ResponseCodeDefines.NotFound;
                    response.Message = "提交审核的商铺不存在:" + shopsId;
                    return(response);
                }
                GatewayInterface.Dto.ExamineSubmitRequest examineSubmitRequest = new GatewayInterface.Dto.ExamineSubmitRequest();
                examineSubmitRequest.ContentId   = shopsId;
                examineSubmitRequest.ContentType = "shops";
                examineSubmitRequest.ContentName = shops.BasicInfo.Name;
                examineSubmitRequest.Source      = "";
                examineSubmitRequest.CallbackUrl = "使用http时再启用";
                if (await _permissionExpansionManager.HavePermission(user.Id, "ShopsCreateQuick"))
                {
                    examineSubmitRequest.Action = "ShopsExaminePass";
                }
                else
                {
                    examineSubmitRequest.Action = "ShopsExamine";
                }
                examineSubmitRequest.TaskName = user.UserName + "提交的商铺:" + shopsId;
                examineSubmitRequest.Ext1     = shops.BasicInfo.BuildingNo;     //楼栋
                examineSubmitRequest.Ext2     = shops.BasicInfo.FloorNo;        //楼层
                examineSubmitRequest.Ext3     = shops.BasicInfo.Number;         //商铺编号
                examineSubmitRequest.Ext4     = shops.Buildings.BasicInfo.Name; //楼盘名字

                GatewayInterface.Dto.UserInfo userInfo = new GatewayInterface.Dto.UserInfo()
                {
                    Id               = user.Id,
                    KeyWord          = user.KeyWord,
                    OrganizationId   = user.OrganizationId,
                    OrganizationName = user.OrganizationName,
                    UserName         = user.UserName
                };

                //Logger.Info("nwf协议:\r\n{0}", JsonHelper.ToJson(examineSubmitRequest));
                //string result = await _restClient.Post(ApplicationContext.Current.ExamineUrl, examineSubmitRequest, "POST", new NameValueCollection());
                //Logger.Info("返回:\r\n{0}", result);
                var _examineInterface = ApplicationContext.Current.Provider.GetRequiredService <IExamineInterface>();
                var response2         = await _examineInterface.Submit(userInfo, examineSubmitRequest);

                if (response2.Code != ResponseCodeDefines.SuccessCode)
                {
                    response.Code    = ResponseCodeDefines.ServiceError;
                    response.Message = "向审核中心发起审核请求失败:" + response2.Message;
                    return(response);
                }
                await _shopsManager.SubmitAsync(shopsId, Dto.ExamineStatusEnum.Auditing, HttpContext.RequestAborted);

                response.Extension = Models.ExamineStatusEnum.Auditing;
                //await _shopsManager.SubmitAsync(shopsId, Dto.ExamineStatusEnum.Approved, HttpContext.RequestAborted);
                //response.Extension = Models.ExamineStatusEnum.Approved;
            }
            catch (Exception e)
            {
                response.Code    = ResponseCodeDefines.ServiceError;
                response.Message = e.ToString();
                Logger.Warn($"用户{user?.UserName ?? ""}({user?.Id ?? ""})提交审核(SubmitShops)请求失败:\r\n{response.Message ?? ""},\r\n请求参数为:\r\n(shopsId){shopsId ?? ""}");
            }
            return(response);
        }
        public async Task <ResponseMessage <ExamineStatusEnum> > SubmitBuilding(UserInfo user, [FromRoute] string buildingId)
        {
            Logger.Trace($"用户{user?.UserName ?? ""}({user?.Id ?? ""})楼盘提交审核(SubmitBuilding):\r\n请求参数为:\r\n(buildingId){buildingId}");

            ResponseMessage <ExamineStatusEnum> response = new ResponseMessage <ExamineStatusEnum>();

            if (string.IsNullOrEmpty(buildingId))
            {
                response.Code    = ResponseCodeDefines.ModelStateInvalid;
                response.Message = "参数不能为空";
                Logger.Warn($"用户{user?.UserName ?? ""}({user?.Id ?? ""})楼盘提交审核(SubmitBuilding)模型验证失败:\r\n{response.Message ?? ""},\r\n请求参数为:\r\n(buildingId){buildingId}");
                return(response);
            }
            try
            {
                var building = await _buildingsManager.FindByIdAsync(user.Id, buildingId);

                if (building == null)
                {
                    response.Code    = ResponseCodeDefines.NotFound;
                    response.Message = "提交审核的楼盘不存在:" + buildingId;
                    Logger.Error($"用户{user?.UserName ?? ""}({user?.Id ?? ""})楼盘提交审核(SubmitBuilding)失败:提交审核的楼盘不存在,\r\n请求参数为:\r\n(buildingId){buildingId ?? ""}");
                    return(response);
                }
                GatewayInterface.Dto.ExamineSubmitRequest examineSubmitRequest = new GatewayInterface.Dto.ExamineSubmitRequest();
                examineSubmitRequest.ContentId   = buildingId;
                examineSubmitRequest.ContentType = "building";
                examineSubmitRequest.ContentName = building.BasicInfo.Name;
                examineSubmitRequest.Source      = "";
                examineSubmitRequest.CallbackUrl = ApplicationContext.Current.BuildingExamineCallbackUrl;
                if (await _permissionExpansionManager.HavePermission(user.Id, "BuildingCreateQuick"))
                {
                    examineSubmitRequest.Action = "BuildingExaminePass";
                }
                else
                {
                    examineSubmitRequest.Action = "BuildingExamine";
                }
                examineSubmitRequest.TaskName = user.UserName + "提交的楼盘:" + buildingId;
                examineSubmitRequest.Ext1     = building.BasicInfo.Name;
                examineSubmitRequest.Ext2     = building.BasicInfo.AreaFullName;

                GatewayInterface.Dto.UserInfo userInfo = new GatewayInterface.Dto.UserInfo()
                {
                    Id               = user.Id,
                    KeyWord          = user.KeyWord,
                    OrganizationId   = user.OrganizationId,
                    OrganizationName = user.OrganizationName,
                    UserName         = user.UserName
                };

                var _examineInterface = ApplicationContext.Current.Provider.GetRequiredService <IExamineInterface>();
                var response2         = await _examineInterface.Submit(userInfo, examineSubmitRequest);

                if (response2.Code != ResponseCodeDefines.SuccessCode)
                {
                    response.Code    = ResponseCodeDefines.ServiceError;
                    response.Message = "向审核中心发起审核请求失败:" + response2.Message;
                    Logger.Error($"用户{user?.UserName ?? ""}({user?.Id ?? ""})楼盘提交审核(SubmitBuilding)失败:\r\n向审核中心发起审核请求失败{response2.Message ?? ""},\r\n请求参数为:\r\n(buildingId){buildingId ?? ""}");
                    return(response);
                }
                await _buildingsManager.SubmitAsync(buildingId, Dto.ExamineStatusEnum.Auditing, HttpContext.RequestAborted);

                response.Extension = ExamineStatusEnum.Auditing;
            }
            catch (Exception e)
            {
                response.Code    = ResponseCodeDefines.ServiceError;
                response.Message = e.ToString();
                Logger.Error($"用户{user?.UserName ?? ""}({user?.Id ?? ""})楼盘提交审核(SubmitBuilding)报错:\r\n{e.ToString()},\r\n请求参数为:\r\n(buildingId){buildingId ?? ""}");
            }
            return(response);
        }
        public async Task <ResponseMessage> PutBuildingsOnSite(UserInfo user, [FromBody] BuildingsOnSiteRequest buildingsOnSiteRequest)
        {
            Logger.Trace($"用户{user?.UserName ?? ""}({user?.Id ?? ""})指派驻场(PutBuildingsOnSite):\r\n请求参数为:\r\n" + (buildingsOnSiteRequest != null ? JsonHelper.ToJson(buildingsOnSiteRequest) : ""));

            ResponseMessage response = new ResponseMessage();

            if (!ModelState.IsValid)
            {
                response.Code    = ResponseCodeDefines.ModelStateInvalid;
                response.Message = ModelState.GetAllErrors();
                Logger.Warn($"用户{user?.UserName ?? ""}({user?.Id ?? ""})指派驻场(PutBuildingsOnSite)模型验证失败:\r\n{response.Message ?? ""},\r\n请求参数为:\r\n" + (buildingsOnSiteRequest != null ? JsonHelper.ToJson(buildingsOnSiteRequest) : ""));
                return(response);
            }
            try
            {
                if (!await _permissionExpansionManager.HavePermission(user.Id, "APPOINT_SCENE"))
                {
                    response.Code    = ResponseCodeDefines.NotAllow;
                    response.Message = "权限不足";
                    Logger.Warn($"用户{user?.UserName ?? ""}({user?.Id ?? ""})指派驻场(PutBuildingsOnSite)失败:没有权限");
                    return(response);
                }
                else
                {
                    GatewayInterface.Dto.ExamineSubmitRequest examineSubmitRequest = new GatewayInterface.Dto.ExamineSubmitRequest();
                    examineSubmitRequest.ContentId   = buildingsOnSiteRequest.Id;
                    examineSubmitRequest.ContentType = "BuildingsOnSite";
                    examineSubmitRequest.ContentName = buildingsOnSiteRequest.Name;
                    examineSubmitRequest.Content     = JsonHelper.ToJson(buildingsOnSiteRequest);
                    examineSubmitRequest.Source      = "";
                    examineSubmitRequest.CallbackUrl = "通过http回调时再设置回调地址";
                    examineSubmitRequest.Action      = "BuildingsOnSite";
                    examineSubmitRequest.TaskName    = $"指派驻场:{buildingsOnSiteRequest.Name}";
                    examineSubmitRequest.Desc        = $"指派驻场{buildingsOnSiteRequest.ResidentUserName1},{buildingsOnSiteRequest.ResidentUserName2},{buildingsOnSiteRequest.ResidentUserName3}";
                    examineSubmitRequest.Ext1        = buildingsOnSiteRequest.ResidentUserName1;
                    examineSubmitRequest.Ext2        = buildingsOnSiteRequest.ResidentUserName2;
                    examineSubmitRequest.Ext3        = buildingsOnSiteRequest.ResidentUserName3;
                    examineSubmitRequest.Ext4        = buildingsOnSiteRequest.ResidentUserName4;

                    GatewayInterface.Dto.UserInfo userInfo = new GatewayInterface.Dto.UserInfo()
                    {
                        Id               = user.Id,
                        KeyWord          = user.KeyWord,
                        OrganizationId   = user.OrganizationId,
                        OrganizationName = user.OrganizationName,
                        UserName         = user.UserName
                    };

                    var _examineInterface = ApplicationContext.Current.Provider.GetRequiredService <IExamineInterface>();
                    var response2         = await _examineInterface.Submit(userInfo, examineSubmitRequest);

                    if (response2.Code != ResponseCodeDefines.SuccessCode)
                    {
                        response.Code    = ResponseCodeDefines.ServiceError;
                        response.Message = "向审核中心发起审核请求失败:" + response2.Message;
                        return(response);
                    }

                    //await _buildingsManager.SaveResidentUserAsync(user.Id, buildingsOnSiteRequest, HttpContext.RequestAborted);
                }
            }
            catch (Exception e)
            {
                response.Code    = ResponseCodeDefines.ServiceError;
                response.Message = e.ToString();
                Logger.Warn($"用户{user?.UserName ?? ""}({user?.Id ?? ""})指派驻场(PutBuildingsOnSite)报错:\r\n{e.ToString()},\r\n请求参数为:\r\n" + (buildingsOnSiteRequest != null ? JsonHelper.ToJson(buildingsOnSiteRequest) : ""));
            }
            return(response);
        }