|
|
@@ -8,13 +8,13 @@ import (
|
|
|
"dashoo.cn/utils"
|
|
|
"encoding/json"
|
|
|
"fmt"
|
|
|
+ . "github.com/linxGnu/goseaweedfs"
|
|
|
"github.com/tealeg/xlsx"
|
|
|
"log"
|
|
|
"os"
|
|
|
"strconv"
|
|
|
"strings"
|
|
|
"time"
|
|
|
- . "github.com/linxGnu/goseaweedfs"
|
|
|
)
|
|
|
|
|
|
type OilCatalogController struct {
|
|
|
@@ -29,12 +29,12 @@ func (this *OilCatalogController) GetEntityList() {
|
|
|
//获取分页信息
|
|
|
page := this.GetPageInfoForm()
|
|
|
where := " 1=1 "
|
|
|
- orderby := "Id"
|
|
|
+ orderBy := "Id"
|
|
|
asc := false
|
|
|
Order := this.GetString("Order")
|
|
|
Prop := this.GetString("Prop")
|
|
|
if Order != "" && Prop != "" {
|
|
|
- orderby = Prop
|
|
|
+ orderBy = Prop
|
|
|
if Order == "asc" {
|
|
|
asc = true
|
|
|
}
|
|
|
@@ -54,7 +54,7 @@ func (this *OilCatalogController) GetEntityList() {
|
|
|
where = where + " and CatalogType=" + catalogType
|
|
|
}
|
|
|
if CompanyName != "" {
|
|
|
- where = where + " and CompanyName like '%" + CompanyName +"%' "
|
|
|
+ where = where + " and CompanyName like '%" + CompanyName + "%' "
|
|
|
}
|
|
|
if Business != "" {
|
|
|
where = where + " and Business like '%" + Business + "%' "
|
|
|
@@ -75,7 +75,7 @@ func (this *OilCatalogController) GetEntityList() {
|
|
|
|
|
|
svc := oilcatalog.GetOilCatalogService(utils.DBE)
|
|
|
var list []oilcatalog.OilCatalog
|
|
|
- total := svc.GetPagingEntitiesWithOrderBytbl("", page.CurrentPage, page.Size, orderby, asc, &list, where)
|
|
|
+ total := svc.GetPagingEntitiesWithOrderBytbl("", page.CurrentPage, page.Size, orderBy, asc, &list, where)
|
|
|
var datainfo DataInfo
|
|
|
datainfo.Items = list
|
|
|
datainfo.CurrentItemCount = total
|
|
|
@@ -84,8 +84,6 @@ func (this *OilCatalogController) GetEntityList() {
|
|
|
this.Data["json"] = &datainfo
|
|
|
this.ServeJSON()
|
|
|
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
// @Title 添加
|
|
|
@@ -138,7 +136,7 @@ func (this *OilCatalogController) DeleteEntity() {
|
|
|
}
|
|
|
var model oilcatalog.OilCatalog
|
|
|
svc := oilcatalog.GetOilCatalogService(utils.DBE)
|
|
|
- err := svc.DeleteEntityById(Id,&model)
|
|
|
+ err := svc.DeleteEntityById(Id, &model)
|
|
|
if err == nil {
|
|
|
errinfo.Message = "删除成功"
|
|
|
errinfo.Code = 0
|
|
|
@@ -170,7 +168,7 @@ func (this *OilCatalogController) UpdateEntity() {
|
|
|
var model oilcatalog.OilCatalog
|
|
|
svc := oilcatalog.GetOilCatalogService(utils.DBE)
|
|
|
|
|
|
- var jsonBlob= this.Ctx.Input.RequestBody
|
|
|
+ var jsonBlob = this.Ctx.Input.RequestBody
|
|
|
json.Unmarshal(jsonBlob, &model)
|
|
|
model.ModifiedOn = time.Now()
|
|
|
model.ModifiedBy = this.User.Realname
|
|
|
@@ -183,7 +181,8 @@ func (this *OilCatalogController) UpdateEntity() {
|
|
|
"LegalPerson",
|
|
|
"RecordScope",
|
|
|
"IDCode",
|
|
|
-
|
|
|
+ "DutyDept",
|
|
|
+ "Dept",
|
|
|
"CatalogType",
|
|
|
"OrderNo",
|
|
|
"CompanyName",
|
|
|
@@ -220,28 +219,28 @@ func (this *OilCatalogController) ExportExcelAll() {
|
|
|
where := "CatalogType=" + CatalogType
|
|
|
svc.GetEntities(&list, where)
|
|
|
|
|
|
- filetitle := "大港油田" + CardTitle + "目录"
|
|
|
- showcolumnarr := "序号,企业名称,业务范围,有效期起,有效期止,备注"
|
|
|
+ fileTitle := "大港油田" + CardTitle + "目录"
|
|
|
+ showColumnArr := "序号,企业名称,业务范围,有效期起,有效期止,备注"
|
|
|
|
|
|
f := xlsx.NewFile()
|
|
|
- sheet, _ := f.AddSheet(filetitle)
|
|
|
- cellname := strings.Split(showcolumnarr, ",")
|
|
|
+ sheet, _ := f.AddSheet(fileTitle)
|
|
|
+ cellName := strings.Split(showColumnArr, ",")
|
|
|
row := sheet.AddRow()
|
|
|
- row.WriteSlice(&cellname, -1)
|
|
|
+ row.WriteSlice(&cellName, -1)
|
|
|
|
|
|
for idx, item := range list {
|
|
|
- datastring := strconv.Itoa(idx + 1) + "," + item.CompanyName + "," + item.Business + "," + utils.ToStr(item.ValidityFrom.Format("2006-01-02")) + "," +
|
|
|
- utils.ToStr(item.ValidityTo.Format("2006-01-02"))+ "," + item.Remark
|
|
|
- cellname := strings.Split(datastring, ",")
|
|
|
+ dataString := strconv.Itoa(idx+1) + "," + item.CompanyName + "," + svc.TrimSpaceForString(item.Business) + "," + utils.ToStr(item.ValidityFrom.Format("2006-01-02")) + "," +
|
|
|
+ utils.ToStr(item.ValidityTo.Format("2006-01-02")) + "," + item.Remark
|
|
|
+ cellName := strings.Split(dataString, ",")
|
|
|
row := sheet.AddRow()
|
|
|
- row.WriteSlice(&cellname, -1)
|
|
|
+ row.WriteSlice(&cellName, -1)
|
|
|
}
|
|
|
for c, cl := 0, len(sheet.Cols); c < cl; c++ {
|
|
|
sheet.Cols[c].Width = 20
|
|
|
}
|
|
|
dir := "static/file/excel/report/" + this.GetAccode()
|
|
|
SaveDirectory(dir)
|
|
|
- path := dir + "/" + utils.TimeFormat(time.Now(), "20060102") + filetitle + ".xlsx"
|
|
|
+ path := dir + "/" + utils.TimeFormat(time.Now(), "20060102") + fileTitle + ".xlsx"
|
|
|
f.Save(path)
|
|
|
var sw *Seaweed
|
|
|
var filer []string
|
|
|
@@ -282,7 +281,7 @@ func (this *OilCatalogController) ExportExcelIncome() {
|
|
|
row.WriteSlice(&cellname, -1)
|
|
|
|
|
|
for _, item := range list {
|
|
|
- datastring := item.CompanyName + "," + item.LegalPerson + "," + item.IDCode + "," + item.Address + "," + item.USCCode +
|
|
|
+ datastring := item.CompanyName + "," + item.LegalPerson + "," + item.IDCode + "," + item.Address + "," + item.USCCode +
|
|
|
"," + strconv.FormatFloat(item.RegCapital, 'f', 2, 64) + "," + item.RecordScope + "," + item.Remark
|
|
|
cellname := strings.Split(datastring, ",")
|
|
|
row := sheet.AddRow()
|
|
|
@@ -326,7 +325,6 @@ func (this *OilCatalogController) IsAccess() {
|
|
|
res = true
|
|
|
}
|
|
|
|
|
|
-
|
|
|
this.Data["json"] = res
|
|
|
this.ServeJSON()
|
|
|
}
|
|
|
@@ -349,7 +347,6 @@ func (this *OilCatalogController) ImportExcel() {
|
|
|
this.ServeJSON()
|
|
|
}
|
|
|
|
|
|
-
|
|
|
svc := oilcatalog.GetOilCatalogService(utils.DBE)
|
|
|
|
|
|
log.Printf("url:==" + url) // http://60.30.245.229//upfile/dc1/2,063156edd288
|
|
|
@@ -378,8 +375,8 @@ func (this *OilCatalogController) ImportExcel() {
|
|
|
ValidityFrom, err1 := time.Parse("2006-01-02", cells[3].Value)
|
|
|
ValidityTo, err2 := time.Parse("2006-01-02", cells[4].Value)
|
|
|
CompanyName := cells[1].Value
|
|
|
- Business := cells[2].Value
|
|
|
- Remark := cells[5].Value
|
|
|
+ Business := cells[2].Value
|
|
|
+ Remark := cells[5].Value
|
|
|
if err1 != nil || err2 != nil {
|
|
|
errLineNo = errLineNo + "," + strconv.Itoa(i)
|
|
|
continue
|
|
|
@@ -414,5 +411,4 @@ func (this *OilCatalogController) ImportExcel() {
|
|
|
this.ServeJSON()
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-}
|
|
|
+}
|