|
@@ -34,12 +34,14 @@ func (c *CertificateController) List() {
|
|
|
page_z = conf.Page_size
|
|
|
}
|
|
|
|
|
|
- T_sn := c.GetString("T_sn")
|
|
|
+ //T_sn := c.GetString("T_sn")
|
|
|
+ T_Certificate_sn := c.GetString("T_Certificate_sn")
|
|
|
T_layout_no := c.GetString("T_layout_no")
|
|
|
Time_start := c.GetString("Time_start")
|
|
|
Time_end := c.GetString("Time_end")
|
|
|
T_release_time_sort, _ := c.GetInt("T_release_time_sort") // 1 升序 2 降序
|
|
|
T_failure_time_sort, _ := c.GetInt("T_failure_time_sort") // 1 升序 2 降序
|
|
|
+ T_layout_no_sort, _ := c.GetInt("T_layout_no_sort") // 1 升序 2 降序
|
|
|
|
|
|
if len(Time_start) > 0 && !lib.IsDateStr(Time_start) {
|
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "时间格式错误!"}
|
|
@@ -54,7 +56,7 @@ func (c *CertificateController) List() {
|
|
|
}
|
|
|
|
|
|
var cnt int
|
|
|
- List, cnt := Certificate.Read_Certificate_List(T_sn, T_layout_no, Time_start, Time_end, T_release_time_sort, T_failure_time_sort, page, page_z)
|
|
|
+ List, cnt := Certificate.Read_Certificate_List(T_Certificate_sn, T_layout_no, Time_start, Time_end, T_release_time_sort, T_failure_time_sort, T_layout_no_sort, page, page_z)
|
|
|
page_size := math.Ceil(float64(cnt) / float64(page_z))
|
|
|
r_jsons.List = List
|
|
|
r_jsons.Page = page
|
|
@@ -77,14 +79,14 @@ func (c *CertificateController) Get() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- T_sn := c.GetString("T_sn")
|
|
|
- if _, is := Certificate.Read_Certificate(T_sn); !is {
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "证书不存在!"}
|
|
|
+ T_layout_no := c.GetString("T_layout_no")
|
|
|
+ if _, is := Certificate.Read_Certificate(T_layout_no); !is {
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "布局编号不存在!"}
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- r, err := Certificate.Read_CertificatePdf_Newest(T_sn)
|
|
|
+ r, err := Certificate.Read_CertificatePdf_Newest(T_layout_no)
|
|
|
if err != nil {
|
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "查询失败!"}
|
|
|
c.ServeJSON()
|
|
@@ -111,14 +113,14 @@ func (c *CertificateController) Add() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- T_sn := c.GetString("T_sn")
|
|
|
+ T_layout_no := c.GetString("T_layout_no")
|
|
|
|
|
|
var_ := Certificate.Certificate{
|
|
|
- T_sn: T_sn,
|
|
|
- T_State: 1,
|
|
|
+ T_layout_no: T_layout_no,
|
|
|
+ T_State: 1,
|
|
|
}
|
|
|
|
|
|
- if _, is := Certificate.Read_Certificate(T_sn); is {
|
|
|
+ if _, is := Certificate.Read_Certificate(T_layout_no); is {
|
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "设备编号重复!"}
|
|
|
c.ServeJSON()
|
|
|
return
|
|
@@ -161,15 +163,15 @@ func (c *CertificateController) Edit() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- T_sn := c.GetString("T_sn")
|
|
|
+ T_layout_no := c.GetString("T_layout_no")
|
|
|
|
|
|
- if _, is = Certificate.Read_Certificate(T_sn); is && r.T_sn != T_sn {
|
|
|
+ if _, is = Certificate.Read_Certificate(T_layout_no); is && r.T_layout_no != T_layout_no {
|
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "设备编号重复!"}
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
|
- r.T_sn = T_sn
|
|
|
- is = Certificate.Update_Certificate(r, "T_sn")
|
|
|
+ r.T_layout_no = T_layout_no
|
|
|
+ is = Certificate.Update_Certificate(r, "T_layout_no")
|
|
|
if !is {
|
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "添加失败!"}
|
|
|
c.ServeJSON()
|
|
@@ -235,10 +237,11 @@ func (c *CertificateController) Pdf_List() {
|
|
|
page_z = conf.Page_size
|
|
|
}
|
|
|
|
|
|
- T_Certificate_sn := c.GetString("T_Certificate_sn")
|
|
|
+ //T_Certificate_sn := c.GetString("T_Certificate_sn")
|
|
|
+ T_layout_no := c.GetString("T_layout_no")
|
|
|
|
|
|
var cnt int64
|
|
|
- List, cnt := Certificate.Read_CertificatePdf_List(T_Certificate_sn, page, page_z)
|
|
|
+ List, cnt := Certificate.Read_CertificatePdf_List(T_layout_no, page, page_z)
|
|
|
page_size := math.Ceil(float64(cnt) / float64(page_z))
|
|
|
r_jsons.List = List
|
|
|
r_jsons.Page = page
|
|
@@ -261,10 +264,16 @@ func (c *CertificateController) Pdf_Add() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- T_Certificate_sn := c.GetString("T_Certificate_sn")
|
|
|
+ T_layout_no := c.GetString("T_layout_no") // 布局编号
|
|
|
+ T_Certificate_sn := c.GetString("T_Certificate_sn") // 证书编号
|
|
|
T_release_time := c.GetString("T_release_time")
|
|
|
T_failure_time := c.GetString("T_failure_time")
|
|
|
T_pdf := c.GetString("T_pdf")
|
|
|
+ if len(T_layout_no) == 0 {
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "布局编号不能为空"}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
if !lib.IsDateStr(T_release_time) {
|
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "时间格式错误!"}
|
|
@@ -279,6 +288,7 @@ func (c *CertificateController) Pdf_Add() {
|
|
|
}
|
|
|
|
|
|
var_ := Certificate.CertificatePdf{
|
|
|
+ T_layout_no: T_layout_no,
|
|
|
T_Certificate_sn: T_Certificate_sn,
|
|
|
T_release_time: T_release_time,
|
|
|
T_failure_time: T_failure_time,
|
|
@@ -287,7 +297,7 @@ func (c *CertificateController) Pdf_Add() {
|
|
|
}
|
|
|
|
|
|
if _, err := Certificate.Read_CertificatePdf(T_Certificate_sn, T_release_time, T_failure_time); err == nil {
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "重复添加!"}
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "证书编号重复!"}
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
@@ -352,6 +362,9 @@ func (c *CertificateController) Pdf_Up() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ if len(T_Certificate_sn) > 0 {
|
|
|
+ r.T_Certificate_sn = T_Certificate_sn
|
|
|
+ }
|
|
|
if len(T_release_time) > 0 {
|
|
|
r.T_release_time = T_release_time
|
|
|
}
|
|
@@ -361,7 +374,7 @@ func (c *CertificateController) Pdf_Up() {
|
|
|
if len(T_pdf) > 0 {
|
|
|
r.T_pdf = T_pdf
|
|
|
}
|
|
|
- if !Certificate.Update_CertificatePdf(r, "T_release_time", "T_failure_time", "T_pdf") {
|
|
|
+ if !Certificate.Update_CertificatePdf(r, "T_Certificate_sn", "T_release_time", "T_failure_time", "T_pdf") {
|
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "修改失败!"}
|
|
|
c.ServeJSON()
|
|
|
return
|