|
|
@@ -11,6 +11,7 @@ import (
|
|
|
"dashoo.cn/backend/api/business/oilsupplier/tableheader"
|
|
|
"dashoo.cn/backend/api/business/register"
|
|
|
"dashoo.cn/business3/parameter"
|
|
|
+ . "github.com/linxGnu/goseaweedfs"
|
|
|
"encoding/json"
|
|
|
"fmt"
|
|
|
"github.com/tealeg/xlsx"
|
|
|
@@ -746,6 +747,243 @@ func (this *OilSupplierController) GetJZPSJoinCertEntityList() {
|
|
|
this.ServeJSON()
|
|
|
}
|
|
|
|
|
|
+// @Title 集中评审列表导出
|
|
|
+// @Description get user by token
|
|
|
+// @Success 200 {object} []supplier.OilSupplier
|
|
|
+// @router /jzpsListExport [get]
|
|
|
+func (this *OilSupplierController) JzpsListExport() {
|
|
|
+
|
|
|
+ where := " 1=1 "
|
|
|
+ SupplierName := this.GetString("SupplierName")
|
|
|
+ SupplierTypeName := this.GetString("SupplierTypeName")
|
|
|
+ CreateOn := this.GetString("CreateOn")
|
|
|
+ SupplierTypeCode := this.GetString("SupplierTypeCode")
|
|
|
+ OperType := this.GetString("OperType")
|
|
|
+ SpecTypeCode := this.GetString("SpecTypeCode")
|
|
|
+ Country := this.GetString("Country")
|
|
|
+ InStyle := this.GetString("InStyle")
|
|
|
+ MgrUnit := this.GetString("MgrUnit")
|
|
|
+ PACNumber := this.GetString("PACNumber")
|
|
|
+ CommercialNo := this.GetString("CommercialNo")
|
|
|
+ Province := this.GetString("Province")
|
|
|
+ City := this.GetString("City")
|
|
|
+ Street := this.GetString("Street")
|
|
|
+ Address := this.GetString("Address")
|
|
|
+ LinkProvince := this.GetString("LinkProvince")
|
|
|
+ LinkCity := this.GetString("LinkCity")
|
|
|
+ LinkStreet := this.GetString("LinkStreet")
|
|
|
+ LinkAddress := this.GetString("LinkAddress")
|
|
|
+ LegalPerson := this.GetString("LegalPerson")
|
|
|
+ ContactName := this.GetString("ContactName")
|
|
|
+ CompanyType := this.GetString("CompanyType")
|
|
|
+ SetupTime := this.GetString("SetupTime")
|
|
|
+ RegCapital1 := this.GetString("RegCapital1")
|
|
|
+ RegCapital2 := this.GetString("RegCapital2")
|
|
|
+ BusinessScope := this.GetString("BusinessScope")
|
|
|
+ RecUnitName := this.GetString("RecUnitName")
|
|
|
+ RecUnitId := this.GetString("RecUnitId")
|
|
|
+ ThirdAudit := this.GetString("ThirdAudit")
|
|
|
+
|
|
|
+ if SupplierName != "" {
|
|
|
+ where = where + " and a.SupplierName like '%" + SupplierName + "%'"
|
|
|
+ }
|
|
|
+ if SupplierTypeName != "" {
|
|
|
+ where = where + " and b.SupplierTypeName like '%" + SupplierTypeName + "%'"
|
|
|
+ }
|
|
|
+ if CreateOn != "" {
|
|
|
+ dates := strings.Split(CreateOn, ",")
|
|
|
+ if len(dates) == 2 {
|
|
|
+ minDate := dates[0]
|
|
|
+ maxDate := dates[1]
|
|
|
+ where = where + " and b.CreateOn>='" + minDate + "' and b.CreateOn<='" + maxDate + "'"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if SupplierTypeCode != "" {
|
|
|
+ where = where + " and b.SupplierTypeCode ='" + SupplierTypeCode + "'"
|
|
|
+ }
|
|
|
+ if OperType != "" {
|
|
|
+ where = where + " and a.OperType like '%" + OperType + "%'"
|
|
|
+ }
|
|
|
+ if SpecTypeCode != "" {
|
|
|
+ where = where + " and a.SpecTypeCode = '" + SpecTypeCode + "'"
|
|
|
+ }
|
|
|
+ if Country != "" {
|
|
|
+ where = where + " and a.Country like '%" + Country + "%'"
|
|
|
+ }
|
|
|
+ if InStyle != "" {
|
|
|
+ where = where + " and b.InStyle ='" + InStyle + "'"
|
|
|
+ }
|
|
|
+ if MgrUnit != "" {
|
|
|
+ where = where + " and a.MgrUnit like '%" + MgrUnit + "%'"
|
|
|
+ }
|
|
|
+ if PACNumber != "" {
|
|
|
+ where = where + " and a.PACNumber ='" + PACNumber + "'"
|
|
|
+ }
|
|
|
+ if CommercialNo != "" {
|
|
|
+ where = where + " and a.CommercialNo ='" + CommercialNo + "'"
|
|
|
+ }
|
|
|
+ if Province != "" {
|
|
|
+ where = where + " and a.Province ='" + Province + "'"
|
|
|
+ }
|
|
|
+ if City != "" {
|
|
|
+ where = where + " and a.City ='" + City + "'"
|
|
|
+ }
|
|
|
+ if Street != "" {
|
|
|
+ where = where + " and a.Street ='" + Street + "'"
|
|
|
+ }
|
|
|
+ if Address != "" {
|
|
|
+ where = where + " and a.Address ='" + Address + "'"
|
|
|
+ }
|
|
|
+ if LinkProvince != "" {
|
|
|
+ where = where + " and a.LinkProvince ='" + LinkProvince + "'"
|
|
|
+ }
|
|
|
+ if LinkCity != "" {
|
|
|
+ where = where + " and a.LinkCity ='" + LinkCity + "'"
|
|
|
+ }
|
|
|
+ if LinkStreet != "" {
|
|
|
+ where = where + " and a.LinkStreet ='" + LinkStreet + "'"
|
|
|
+ }
|
|
|
+ if LinkAddress != "" {
|
|
|
+ where = where + " and a.LinkAddress ='" + LinkAddress + "'"
|
|
|
+ }
|
|
|
+ if LegalPerson != "" {
|
|
|
+ where = where + " and a.LegalPerson ='" + LegalPerson + "'"
|
|
|
+ }
|
|
|
+ if ContactName != "" {
|
|
|
+ where = where + " and a.ContactName ='" + ContactName + "'"
|
|
|
+ }
|
|
|
+ if CompanyType != "" {
|
|
|
+ where = where + " and a.CompanyType like '%" + CompanyType + "%'"
|
|
|
+ }
|
|
|
+ if SetupTime != "" {
|
|
|
+ where = where + " and a.SetupTime ='" + SetupTime + "'"
|
|
|
+ }
|
|
|
+ //注册资金范围
|
|
|
+ if RegCapital1 != "" {
|
|
|
+ where = where + " and a.RegCapital >= '" + RegCapital1 + "'"
|
|
|
+ }
|
|
|
+ if RegCapital2 != "" {
|
|
|
+ where = where + " and a.RegCapital <= '" + RegCapital2 + "'"
|
|
|
+ }
|
|
|
+ if BusinessScope != "" {
|
|
|
+ where = where + " and a.BusinessScope like '%" + BusinessScope + "%'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if RecUnitName != "" {
|
|
|
+ where = where + " and b.RecUnitName like '%" + RecUnitName + "%'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if RecUnitId != "" {
|
|
|
+ where = where + " and b.RecUnitId = '" + RecUnitId + "' "
|
|
|
+ }
|
|
|
+
|
|
|
+ if ThirdAudit != "" {
|
|
|
+ where = where + " and b.ThirdAudit = '" + ThirdAudit + "' "
|
|
|
+ }
|
|
|
+
|
|
|
+ status := this.GetString("Status")
|
|
|
+ if status != "" {
|
|
|
+ where = where + " and b.Status='" + status + "'"
|
|
|
+ }
|
|
|
+
|
|
|
+ //企业用户必须加创建人条件
|
|
|
+ if this.User.IsCompanyUser == 1 {
|
|
|
+ where = where + " and a.CreateUserId = '" + this.User.Id + "'"
|
|
|
+ } else {
|
|
|
+ //超级管理员和有查看所有数据权限的用户不加条件
|
|
|
+ svcPerm := permission.GetPermissionService(utils.DBE)
|
|
|
+ isauth := svcPerm.IsAuthorized(this.User.Id, "oil_supplier.marketAccess.AllRecord")
|
|
|
+ if !svcPerm.IsAdmin(this.User.Id) && !isauth {
|
|
|
+ //根据工作流查找
|
|
|
+ //集中评审相关人可看数据
|
|
|
+ actisvc := workflow.GetActivitiService(utils.DBE)
|
|
|
+ //找出待办任务===准入
|
|
|
+ var certIdList string
|
|
|
+ ids := actisvc.GetAllMyTasks(workflow.OIL_ENUSER_SUPPLIER_APPLY, this.User.Id)
|
|
|
+ if len(strings.Trim(ids, ",")) > 0 {
|
|
|
+ certIdList += strings.Trim(ids, ",") + ","
|
|
|
+ }
|
|
|
+
|
|
|
+ certIdList = strings.Trim(certIdList, ",")
|
|
|
+ certIdarr := strings.Split(certIdList, ",")
|
|
|
+ for i, item := range certIdarr {
|
|
|
+ idx := strings.Index(item, "-")
|
|
|
+ if idx >= 0 {
|
|
|
+ certIdarr[i] = strings.Split(item, "-")[0]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ certIdList = strings.Join(certIdarr, ",")
|
|
|
+
|
|
|
+ if certIdList != "" {
|
|
|
+ where += " and ( b.Id in (" + certIdList + ")" + " or a.CreateUserId = '" + this.User.Id + "')"
|
|
|
+ } else {
|
|
|
+ where = where + " and a.CreateUserId = '" + this.User.Id + "'"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ svc := supplier.GetOilSupplierService(utils.DBE)
|
|
|
+ var list []supplier.OilSupplierExport
|
|
|
+ svc.GetMyPagingEntitiesWithOrderBytblExport(OilSupplierName, OilSupplierCertName, &list, where)
|
|
|
+
|
|
|
+ fileTitle := "集中评审"
|
|
|
+ showColumnArr := "序号,审核状态,审核处室,推荐单位,准入类别,企业名称,法人,工商注册号,注册资本,币种,公司类型,成立时间,手机号,准入范围"
|
|
|
+
|
|
|
+ f := xlsx.NewFile()
|
|
|
+ sheet, _ := f.AddSheet(fileTitle)
|
|
|
+ cellName := strings.Split(showColumnArr, ",")
|
|
|
+ row := sheet.AddRow()
|
|
|
+ row.WriteSlice(&cellName, -1)
|
|
|
+
|
|
|
+ for idx, item := range list {
|
|
|
+ var certSubList []suppliercertsub.OilSupplierCertSub
|
|
|
+ svc.GetEntitysByWhere(OilSupplierCertSubName, "SupplierCertId = " + strconv.Itoa(item.CertId), &certSubList)
|
|
|
+ subName := ""
|
|
|
+ for _,certSub := range certSubList{
|
|
|
+ subName += "," + certSub.Name
|
|
|
+ }
|
|
|
+ regCapital := strconv.FormatFloat(item.RegCapital, 'f', 2, 64)
|
|
|
+ currency := "人民币"
|
|
|
+ if item.Currency == "人民币元" {
|
|
|
+ currency = "人民币"
|
|
|
+ }
|
|
|
+ if item.Currency == "JPY" {
|
|
|
+ currency = "日元"
|
|
|
+ }
|
|
|
+ if item.Currency == "USD" {
|
|
|
+ currency = "美元"
|
|
|
+ }
|
|
|
+ if item.Currency == "EUR" {
|
|
|
+ currency = "欧元"
|
|
|
+ }
|
|
|
+ dataString := strconv.Itoa(idx+1) + "+待集中评审+" + item.FullName + "+" + item.RecUnitName + "+" + item.SupplierTypeName + "+" + item.SupplierName + "+" + item.LegalPerson + "+" + item.CommercialNo + "+" +
|
|
|
+ regCapital + "+" + currency + "+" + item.CompanyType + "+" + utils.ToStr(item.SetupTime.Format("2006-01-02")) + "+" + item.Mobile + "+" + strings.TrimLeft(subName, ",")
|
|
|
+ cellName := strings.Split(dataString, "+")
|
|
|
+ row := sheet.AddRow()
|
|
|
+ row.WriteSlice(&cellName, -1)
|
|
|
+ }
|
|
|
+ for c, cl := 0, len(sheet.Cols); c < cl; c++ {
|
|
|
+ sheet.Cols[c].Width = 30
|
|
|
+ }
|
|
|
+ dir := "static/file/excel/report/" + this.GetAccode()
|
|
|
+ SaveDirectory(dir)
|
|
|
+ path := dir + "/" + utils.TimeFormat(time.Now(), "20060102") + fileTitle + ".xlsx"
|
|
|
+ f.Save(path)
|
|
|
+ var sw *Seaweed
|
|
|
+ var filer []string
|
|
|
+ if _filer := os.Getenv("GOSWFS_FILER_URL"); _filer != "" {
|
|
|
+ filer = []string{_filer}
|
|
|
+ }
|
|
|
+ sw = NewSeaweed("http", utils.Cfg.MustValue("file", "upFileHost"), filer, 2*1024*1024, 5*time.Minute)
|
|
|
+ _, _, fID, _ := sw.UploadFile(path, "", "")
|
|
|
+
|
|
|
+ retDocUrl := utils.Cfg.MustValue("file", "downFileHost") + "/" + fID
|
|
|
+ os.Remove(path)
|
|
|
+ fmt.Println("==retDocWatermarkUrl==", retDocUrl)
|
|
|
+ this.Data["json"] = retDocUrl
|
|
|
+ this.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
// @Title 企业入库列表
|
|
|
// @Description get user by token
|
|
|
// @Success 200 {object} []supplier.OilSupplier
|