DOC文件中法规对标系统完成
2016-08-06 14:23
204 查看
我们工程设计报告中,每个章节很多法律法规规程规范,如何快捷地核对这些文件的有效性,即法律的发布日期,执行日期,规范的编号和执行日期等。用这个系统就简单了。
考进去,输出的就是你想要的有效的编号了。
没想到大半天完成了这个系统。beego开发效率还是有点高啊。
考进去,输出的就是你想要的有效的编号了。
package controllers import ( "github.com/astaxie/beego" "github.com/astaxie/beego/logs" "github.com/tealeg/xlsx" "quick/models" "regexp" "strconv" "strings" "time" ) type LegislationController struct { beego.Controller } type Legislationmore struct { Id int64 Number string //`orm:"unique"` Title string //原法规名称 LibraryNumber string //规范有效版本库中的编号 LibraryTitle string Execute string //执行时间 } func (c *LegislationController) Index() { // c.Data["IsLegislation"] = true // c.TplName = "legislation.tpl" c.Data["IsLogin"] = checkAccount(c.Ctx) uname, _, _ := checkRoleread(c.Ctx) //login里的 // rolename, _ = strconv.Atoi(role) c.Data["Uname"] = uname legislations, err := models.GetAllLegislations() //这里传入空字符串 if err != nil { beego.Error(err.Error) } else { c.Data["Legislations"] = legislations c.Data["Length"] = len(legislations) //得到总记录数 } logs := logs.NewLogger(1000) logs.SetLogger("file", `{"filename":"log/test.log"}`) logs.EnableFuncCallDepth(true) logs.Info(c.Ctx.Input.IP()) logs.Close() } //搜索规范或者图集的名称或编号 func (c *LegislationController) Checklist() { //checklist用的是post方法 name := c.Input().Get("name") beego.Info(name) array := strings.Split(name, "\n") aa := make([]Legislationmore, len(array)) for i, v := range array { // beego.Info(v) //1、正则取到名称 reg := regexp.MustCompile(`[《].*[》]`) //(`^\\<.*\\>`) text2 := reg.FindAllString(v, -1) text3 := SubString(text2[0], 1, len([]rune(text2[0]))-2) //2、根据名称搜索标准版本库,取得名称和版本号 library, err := models.SearchLiabraryName(text3) if err != nil { beego.Error(err.Error) } text4 := strconv.Itoa(i + 1) Id1, _ := strconv.ParseInt(text4, 10, 64) aa[i].Id = Id1 if library != nil { //3、构造struct aa[i].LibraryNumber = library.LiNumber //规范有效版本库中的完整编号 aa[i].LibraryTitle = library.Title aa[i].Execute = library.Execute //执行日期 } else { // aa[i].Number = library.Number //`orm:"unique"` // aa[i].Title = text3 aa[i].LibraryNumber = "No LibraryNumber Match Find!" aa[i].LibraryTitle = text3 aa[i].Execute = "" } } c.Data["IsLegislation"] = true c.TplName = "legislation.tpl" c.Data["IsLogin"] = checkAccount(c.Ctx) uname, _, _ := checkRoleread(c.Ctx) //login里的 c.Data["Uname"] = uname c.Data["json"] = aa //这里必须要是c.Data["json"],其他c.Data["Data"]不行 c.ServeJSON() logs := logs.NewLogger(1000) logs.SetLogger("file", `{"filename":"log/test.log"}`) logs.EnableFuncCallDepth(true) logs.Info(c.Ctx.Input.IP() + " " + "SearchLegislationsName:" + name) logs.Close() }
//由法规名称精确搜索有效版本库 func SearchLiabraryName(Name string) (*Library, error) { o := orm.NewOrm() library := new(Library) qs := o.QueryTable("library") err := qs.Filter("title", Name).One(library) if err != nil { return nil, err } return library, err }
没想到大半天完成了这个系统。beego开发效率还是有点高啊。
相关文章推荐
- DOC文件中法律法规规程规范对标系统
- MPQ 文件系统完成
- 对照ArcGIS坐标系统文件(.prj)用Deskpro完成投影转换
- 最近刚为公司完成的一款监视的小工具软件!用DELPHI 7 写的,可以从后台监控系统﹑键盘﹑鼠标﹑屏幕以及文件与目录!有源码!
- 用HtmlUnit完成模拟普通用户登陆系统后,查询以及导出文件
- log4j通过配置文件配置即,即可完成系统报错想向指定邮箱发送提醒消息,网上的很多方法都又问题
- windows远程拷贝和解压大文件异常:系统资源不足无法完成请求的服务
- 使用HVR数据复制软件完成文件系统上文件的实时复制(即:文件系统的灾备)
- Windows Server 2003复制大文件出错:服务器资源系统资源不足,无法完成请求的服务
- 一行代码完成 调用系统相册 和 视频,语音库,选择图片,视频,和音频文件。在选择界面实现了录制视频和录制音频功能。 截图
- [导入]MPQ 文件系统完成
- 使用/etc/fstab完成文件系统的挂载
- 编写BinIoDemo.java的Java应用程序,程序完成的功能是:完成1.doc文件的复制,复制以后的文件的名称为自己的学号姓名.doc。
- jQuery上传文件到服务器,实现量上传及压缩包导入,支持Office文档、PDF、图像、音视频和图纸等各类型文件。上传完成后系统自动为图片、音、视频类文件增加摘要及缩略图
- 【Jsp】使用AjaxFileUploader与jspsmartupload完成不刷新的Ajax文件上传系统
- ckeditor+ckfinder 由于文件系统的限制,该请求不能完成
- 在线完成DOC等格式文档与PDF文件的相互转换
- 【Jsp】使用jspsmartupload完成简单的文件上传系统
- 使用jspsmartupload完成简单的文件上传系统
- 请问在C/S系统中如何设置配置文件