|
|
@@ -4,6 +4,7 @@ import (
|
|
|
"dashoo.cn/backend/api/business/oilsupplier/supplier"
|
|
|
"dashoo.cn/backend/api/business/oilsupplier/suppliercert"
|
|
|
"dashoo.cn/backend/api/business/oilsupplier/suppliercertsub"
|
|
|
+ "dashoo.cn/backend/api/business/oilsupplier/supplierdataentry"
|
|
|
"dashoo.cn/backend/api/business/oilsupplier/supplierfile"
|
|
|
"dashoo.cn/backend/api/business/oilsupplier/tableheader"
|
|
|
"encoding/json"
|
|
|
@@ -20,6 +21,7 @@ import (
|
|
|
|
|
|
"dashoo.cn/backend/api/business/items"
|
|
|
|
|
|
+ "dashoo.cn/backend/api/business/workflow"
|
|
|
"dashoo.cn/backend/api/business/baseUser"
|
|
|
"dashoo.cn/backend/api/business/oilsupplier/goodsaptitude"
|
|
|
. "dashoo.cn/backend/api/controllers"
|
|
|
@@ -33,6 +35,16 @@ type OilGoodsAptitudeController struct {
|
|
|
BaseController
|
|
|
}
|
|
|
|
|
|
+func structToMapDemo(obj interface{}) map[string]interface{} {
|
|
|
+ obj1 := reflect.TypeOf(obj)
|
|
|
+ obj2 := reflect.ValueOf(obj)
|
|
|
+ var data = make(map[string]interface{})
|
|
|
+ for i := 0; i < obj1.NumField(); i++ {
|
|
|
+ data[obj1.Field(i).Name] = obj2.Field(i).Interface()
|
|
|
+ }
|
|
|
+ return data
|
|
|
+}
|
|
|
+
|
|
|
// @Title 获取列表
|
|
|
// @Description get user by token
|
|
|
// @Success 200 {object} []goodsaptitude.OilGoodsAptitude
|
|
|
@@ -1243,7 +1255,6 @@ func (this *OilGoodsAptitudeController) ImportExcel() {
|
|
|
columnArr := strings.Split(Fstrs, ",")
|
|
|
|
|
|
defer func() {
|
|
|
- fmt.Println("=====================")
|
|
|
session.Close()
|
|
|
}()
|
|
|
|
|
|
@@ -2136,3 +2147,142 @@ func (this *OilGoodsAptitudeController) OilCompare() {
|
|
|
this.Data["json"] = &datainfo
|
|
|
this.ServeJSON()
|
|
|
}
|
|
|
+
|
|
|
+// @Title 导出数据到word,作为导出pdf的中间步骤
|
|
|
+// @Description 数据存入word
|
|
|
+// @Success 200 {object} controllers.Request
|
|
|
+// @router /exportpdf/:tbid/:typecode [post]
|
|
|
+func (this *OilGoodsAptitudeController) PdfExport() {
|
|
|
+ Id := this.Ctx.Input.Param(":tbid")
|
|
|
+ SupplierTypeCode := this.Ctx.Input.Param(":typecode")
|
|
|
+ var Url string
|
|
|
+ var fileName string
|
|
|
+ var model1 supplierdataentry.SupplierDataEntry
|
|
|
+ var model2 supplierdataentry.SupplierCertDataEntry
|
|
|
+
|
|
|
+ svc := supplierdataentry.GetSupplierDataEntryService(utils.DBE)
|
|
|
+ where1 := "1=1"
|
|
|
+ where1 += " AND Id = '" + Id + "'"
|
|
|
+ where2 := "SupplierId = '" + Id + "' and SupplierTypecode='"+ SupplierTypeCode +"'"
|
|
|
+ svc.GetEntityByWhere(OilSupplierName, where1, &model1)
|
|
|
+ svc.GetEntityByWhere(OilSupplierCertName, where2, &model2)
|
|
|
+
|
|
|
+ var tabledata []supplierdataentry.SupplierCertSubEntry
|
|
|
+ where3:="SupplierId = '" + Id + "' and SupplierTypecode='"+ SupplierTypeCode +"' and Type in ('1','3')"//准入状态的准入项
|
|
|
+ svc.GetEntitysByOrderbyWhere(TmpOilSupplierCertSubName, where3, "1", &tabledata)
|
|
|
+
|
|
|
+ datamap := structToMapDemo(model1.OilSupplier)
|
|
|
+ if model2.SupplierTypeCode == "01" {
|
|
|
+ Url = utils.Cfg.MustValue("workflow", "goodsPdfHost")
|
|
|
+ fileName = "待删除物资类准入范围.docx"
|
|
|
+ } else if model2.SupplierTypeCode == "02" {
|
|
|
+ Url = utils.Cfg.MustValue("workflow", "basisPdfHost")
|
|
|
+ fileName = "待删除基建类准入范围.docx"
|
|
|
+ datamap["TJInNotify"] = model1.TJInNotify
|
|
|
+ } else {
|
|
|
+ Url = utils.Cfg.MustValue("workflow", "techPdfHost")
|
|
|
+ fileName = "待删除技术服务类准入范围.docx"
|
|
|
+ }
|
|
|
+
|
|
|
+ //model1
|
|
|
+ datamap["SetupTime"] = model1.SetupTime.Format("2006年01月02日")
|
|
|
+ datamap["QualifCert"] = model1.QualifCert
|
|
|
+ datamap["QualifCertLevel"] = model1.QualifCertLevel
|
|
|
+ datamap["SpecIndustryCert"] = model1.SpecIndustryCert
|
|
|
+ datamap["MaunLicense"] = model1.MaunLicense
|
|
|
+ if model1.HseTraining == "1" {
|
|
|
+ datamap["HseTraining"] = "是"
|
|
|
+ } else {
|
|
|
+ datamap["HseTraining"] = "否"
|
|
|
+ }
|
|
|
+ if model1.OperType != "" {
|
|
|
+ if model1.OperType == "1" || model1.OperType == "制造商"{
|
|
|
+ datamap["OperType"] = "√制造商 □代理商 □贸易商"
|
|
|
+ }else if model1.OperType == "2" || model1.OperType == "代理商"{
|
|
|
+ datamap["OperType"] = "□制造商 √代理商 □贸易商"
|
|
|
+ }else if model1.OperType == "3" || model1.OperType == "代理商"{
|
|
|
+ datamap["OperType"] = "□制造商 □代理商 √贸易商"
|
|
|
+ }else {
|
|
|
+ datamap["OperType"] = "□制造商 □代理商 □贸易商"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if model1.SpecTypeCode != "" {
|
|
|
+ if model1.SpecTypeCode == "1"{
|
|
|
+ datamap["SpecTypeCode"] = "√一般外部 □多元企业"
|
|
|
+ }else if model1.SpecTypeCode == "2"{
|
|
|
+ datamap["SpecTypeCode"] = "□一般外部 √多元企业"
|
|
|
+ }else {
|
|
|
+ datamap["SpecTypeCode"] = "□一般外部 □多元企业"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if model1.Grade == "1"{
|
|
|
+ datamap["Grade"] = "一级"
|
|
|
+ }else if model1.SpecTypeCode == "2"{
|
|
|
+ datamap["Grade"] = "二级"
|
|
|
+ }
|
|
|
+ datamap["Fax"] = model1.Fax
|
|
|
+ datamap["CompanyTel"] = model1.CompanyTel
|
|
|
+ datamap["SupplierName"] = model1.SupplierName
|
|
|
+ datamap["Country"] = model1.Country
|
|
|
+ datamap["MaunAgent"] = model1.MaunAgent
|
|
|
+ datamap["SupplierCertificate"] = model1.SupplierCertificate
|
|
|
+ datamap["MgrUnit"] = model1.MgrUnit
|
|
|
+ datamap["CommercialNo"] = model1.CommercialNo
|
|
|
+ datamap["CountryTaxNo"] = model1.CountryTaxNo
|
|
|
+ datamap["OrganCode"] = model1.OrganCode
|
|
|
+ datamap["Address"] = model1.Address
|
|
|
+ datamap["ZipCode"] = model1.ZipCode
|
|
|
+ datamap["LinkAddress"] = model1.LinkAddress
|
|
|
+ datamap["LinkZipCode"] = model1.LinkZipCode
|
|
|
+ datamap["QualitySystemCert"] = model1.QualitySystemCert
|
|
|
+ datamap["ProductQualityCert"] = model1.ProductQualityCert
|
|
|
+ datamap["MaunLicense"] = model1.MaunLicense
|
|
|
+ datamap["LegalPerson"] = model1.LegalPerson
|
|
|
+ datamap["CompanyType"] = model1.CompanyType
|
|
|
+ datamap["ContactName"] = model1.ContactName
|
|
|
+ datamap["RegCapital"] = strconv.FormatFloat(model1.RegCapital,'f',2,64)+"万元"+model1.Currency
|
|
|
+ datamap["DepositBank"] = model1.DepositBank
|
|
|
+ datamap["BankAccount"] = model1.BankAccount
|
|
|
+ datamap["Mobile"] = model1.Mobile
|
|
|
+ datamap["EMail"] = model1.EMail
|
|
|
+ datamap["BankCreditRating"] = model1.BankCreditRating
|
|
|
+ datamap["BusinessScope"] = model1.BusinessScope
|
|
|
+ datamap["Telphone"] = model1.Telphone
|
|
|
+ datamap["AccessCardNo"] = model2.AccessCardNo
|
|
|
+ datamap["PrintYear"] = time.Now().Year()
|
|
|
+ datamap["PrintMonth"] = time.Now().Month()
|
|
|
+ datamap["PrintDay"] = time.Now().Day()
|
|
|
+
|
|
|
+ datamap["Name"] = ""
|
|
|
+
|
|
|
+ if len(tabledata) != 0 {
|
|
|
+ var Name string
|
|
|
+ Name = "\n待删除准入范围:"+ tabledata[0].Code
|
|
|
+ Name = Name + " " + tabledata[0].Name
|
|
|
+ var i int
|
|
|
+ for i = 1; i < len(tabledata); i++ {
|
|
|
+ Name += ";"
|
|
|
+ Name += tabledata[i].Code
|
|
|
+ Name = Name + " " + tabledata[i].Name
|
|
|
+ }
|
|
|
+ //if i == 100 {
|
|
|
+ // Name += "(准入范围未完全显示,请到系统查看详情)"
|
|
|
+ //}
|
|
|
+
|
|
|
+ datamap["Name"] =datamap["Name"].(string) + Name
|
|
|
+ } else {
|
|
|
+ datamap["Name"] =datamap["Name"].(string)
|
|
|
+ }
|
|
|
+
|
|
|
+ svcActiviti := workflow.GetActivitiService(utils.DBE)
|
|
|
+
|
|
|
+
|
|
|
+ retDocUrl := svcActiviti.FillWordTemplate(datamap, Url, fileName)
|
|
|
+ var datainfo ErrorDataInfo
|
|
|
+ datainfo.Code = 0
|
|
|
+ datainfo.Item = retDocUrl
|
|
|
+ datainfo.Message = "准备导出"
|
|
|
+ this.Data["json"] = &datainfo
|
|
|
+ this.ServeJSON()
|
|
|
+
|
|
|
+}
|