/// <summary> /// 获取列表,有分页的 /// </summary> /// <param name="confListForm"> /// /// @return </param> //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @RequestMapping(value = "/list", method = org.springframework.web.bind.annotation.RequestMethod.GET) @ResponseBody public com.baidu.dsp.common.vo.JsonObjectBase getConfigList(@Valid com.baidu.disconf.web.service.config.form.ConfListForm confListForm) public virtual JsonObjectBase getConfigList(ConfListForm confListForm) { LOG.info(confListForm.ToString()); // 设置排序方式 confListForm.Page.OrderBy = Columns.NAME; confListForm.Page.Order = PageOrderValidator.ASC; DaoPageResult<ConfListVo> configs = configMgr.getConfigList(confListForm, true, false); return buildListSuccess(configs); }
/// <summary> /// 批量下载配置文件 /// </summary> /// <param name="confListForm"> /// /// @return </param> //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @RequestMapping(value = "/downloadfilebatch", method = org.springframework.web.bind.annotation.RequestMethod.GET) public org.springframework.http.HttpEntity<byte[]> download2(@Valid com.baidu.disconf.web.service.config.form.ConfListForm confListForm) public virtual HttpEntity<sbyte[]> download2(ConfListForm confListForm) { LOG.info(confListForm.ToString()); // // get files // IList<File> fileList = configMgr.getDisconfFileList(confListForm); // // prefix // string prefixString = "APP" + confListForm.AppId + "_" + "ENV" + confListForm.EnvId + "_" + "VERSION" + confListForm.Version; HttpHeaders header = new HttpHeaders(); string targetFileString = ""; File targetFile = null; sbyte[] res = null; try { targetFileString = TarUtils.tarFiles("tmp", prefixString, fileList); targetFile = new File(targetFileString); res = IOUtils.toByteArray(new System.IO.FileStream(targetFile, System.IO.FileMode.Open, System.IO.FileAccess.Read)); } catch (Exception) { throw new DocumentNotFoundException(""); } header.set("Content-Disposition", "attachment; filename=" + targetFile.Name); header.ContentLength = res.Length; return new HttpEntity<sbyte[]>(res, header); }
/// <summary> /// 校验APP/ENV/VERSION 一致性 /// </summary> private void checkAppEnvVersionConfigConsistency(App app, Env env, string version) { string monitorInfo = "monitor " + app.Name + "\t" + env.Name + "\t" + version; LOG.info(monitorInfo); // // // ConfListForm confiConfListForm = new ConfListForm(); confiConfListForm.AppId = app.Id; confiConfListForm.EnvId = env.Id; confiConfListForm.Version = version; // // // DaoPageResult<ConfListVo> daoPageResult = configMgr.getConfigList(confiConfListForm, true, true); // 准备发送邮件通知 string toEmails = appMgr.getEmails(app.Id); IList<ConfListVo> confListVos = daoPageResult.Result; IList<string> errorList = new List<string>(); foreach (ConfListVo confListVo in confListVos) { if (confListVo.ErrorNum != 0) { IList<ZkDisconfDataItem> zkDisconfDataItems = confListVo.MachineList; foreach (ZkDisconfDataItem zkDisconfDataItem in zkDisconfDataItems) { if (zkDisconfDataItem.ErrorList.Count != 0) { string data = zkDisconfDataItem.ToString() + "<br/><br/><br/><br/><br/><br/>original:" + confListVo.Value; LOG.warn(data); errorList.Add(data + "<br/><br/><br/>"); } } } } if (errorList.Count != 0) { logMailBean.sendHtmlEmail(toEmails, " monitor ConfigConsistency ", monitorInfo + "<br/><br/><br/>" + errorList.ToString()); } }