public IActionResult GetOrganInfo(OrgParam param) { var result = new ResponseModel(ResponseCode.Error, "查询失败!"); try { //实例化机构接口 var org = this.GetInstance <IOrgan>(); var model = this.Query <Organ>().Where("id", param.organid).GetModel(); //上级机构名称 var pName = "无"; if (model != null) { pName = model.级id == 0 ? pName : this.Query <Organ>().Where("id", model.级id).GetModel().称; } result.data = org.GetOrganDtoInfo(model, pName)?.Result; if (result.data != null) { result.code = (int)ResponseCode.Success; result.msg = "查询成功"; } } catch (Exception ex) { result.msg = "查询机构发生异常"; Logger.Instance.Error("查询机构异常", ex); } return(Json(result)); }
public IActionResult UpOrgPeopleState(OrgParam param) { var result = new ResponseModel(ResponseCode.Success, "修改机构人员状态成功!"); try { if (param.accountid == 0 || param.orgpersonid == 0) { result.code = (int)ResponseCode.Forbidden; result.msg = "缺少参数"; return(Json(result)); } //实例化机构接口 var org = this.GetInstance <IOrgPerson>(); var data = org.UpdateOrgPersonState(param.accountid, param.orgpersonid, param.state); if (data.Result.code == ResponseCode.Success.ToInt32()) { result.code = (int)ResponseCode.Success; result.msg = "操作成功"; } } catch (Exception ex) { LogError("修改机构人员状态操作失败", ex); result.code = (int)ResponseCode.Error; result.msg = "服务器内部异常"; } return(Json(result)); }
public async Task <Types.Org> FindById(string id, CancellationToken cancellationToken = default) { var param = new OrgParam(id); var res = await client.Request <OrgResponse>(param.CreateRequest(), cancellationToken); // TODO: buildTree(res) return(res.Result); }
public async Task <ApiJsonResultData> GetOrg([FromQuery] OrgParam param) { return(await new ApiJsonResultData(ModelState).RunWithTryAsync(async y => { var userBase = await GetUserBaseInfo(); var data = await _webServiceBasicService.GetOrg(userBase, param.Name); y.Data = "更新机构" + data + "条"; })); }
public IActionResult GetOrganListByPid(OrgParam model) { var resModel = new ResponseModel(ResponseCode.Error, "操作失败"); try { //实例化机构接口 var org = this.GetInstance <IOrgan>(); //分页查询机构列表 var orgList = org.GetOrganListByPid(model.pid)?.Result; return(Json(new ResponseModel(200, "ok", orgList))); } catch (Exception ex) { LogError("分页查询机构列表失败", ex); resModel.msg = "分页查询机构列表异常"; } return(Json(resModel)); }
public IActionResult GetOrganList(OrgParam model) { var resModel = new ResponseModel(ResponseCode.Error, "操作失败"); try { //实例化机构接口 var org = this.GetInstance <IOrgan>(); //分页查询机构列表 var orgList = org.GetOrganPageList(model.page_num, model.page_size, model.keyword)?.Result; return(Json(new ResponseModel(ResponseCode.Success, "查询成功!", orgList))); } catch (Exception ex) { LogError("分页查询机构列表失败", ex); resModel.msg = "分页查询机构列表异常"; } return(Json(resModel)); }
public IActionResult GetOrganPersonInfo(OrgParam param) { var result = new ResponseModel(ResponseCode.Error, "查询失败!"); try { //实例化机构接口 var org = this.GetInstance <IOrgPerson>(); var model = org.GetOrgPersonDtoInfo(param.orgpersonid)?.Result; result.data = model; if (result.data != null) { result.code = (int)ResponseCode.Success; result.msg = "查询成功"; } } catch (Exception ex) { result.msg = "查询机构人员发生异常"; Logger.Instance.Error("查询机构人员异常", ex); } return(Json(result)); }
public IActionResult DeleteOrgan(OrgParam model) { var resModel = new ResponseModel(ResponseCode.Error, "删除失败", false); try { //查询是否有下级机构 var findOrgList = this.Query <Organ>().Where("上级id", model.organid).Exists(); if (findOrgList) { resModel.msg = "该机构拥有下级机构,删除失败"; return(Json(resModel)); } //查询机构下是否有人员 var finOrgPersonList = this.Query <OrgPerson>().Where("机构id", model.organid).Exists(); if (finOrgPersonList) { resModel.msg = "该机构拥有人员,删除失败"; return(Json(resModel)); } var count = this.Delete <Organ>().Where("id", model.organid).Execute(); if (count > 0) { resModel.code = (int)ResponseCode.Success; resModel.data = true; resModel.msg = "删除成功"; } } catch (Exception ex) { LogError("删除机构", ex); resModel.msg = "操作异常"; } return(Json(resModel)); }
public IActionResult ResetPassword(OrgParam param) { var result = new ResponseModel(ResponseCode.Success, "重置成功!"); try { if (param.accountid == 0) { result.code = (int)ResponseCode.Forbidden; result.msg = "缺少参数"; return(Json(result)); } //通过机构人员id查询账户 Account account = new Account() { 密码 = Strings.StrToMD5("123456") }; var count = this.Update(account).Columns("密码").Where("id", param.accountid).Execute(); if (count > 0) { result.code = (int)ResponseCode.Success; } else { result.code = (int)ResponseCode.Error; result.msg = "重置失败"; } } catch (Exception ex) { LogError("重置人员密码操作失败", ex); result.code = (int)ResponseCode.Error; result.msg = "服务器内部异常"; } return(Json(result)); }