Browse Source

后:安全管理平台对外接口

dubch 4 years ago
parent
commit
9d81814e45

+ 25 - 0
src/dashoo.cn/backend/api/business/oilsupplier/selectbusiness/selectservice.go

@@ -82,6 +82,31 @@ func (s *SelectService) GetMyPagingEntitiesWithOrderBytbl(supplierTableName, sup
 	return total
 }
 
+func (s *SelectService) GetMyPagingEntitiesWithOrderBytbl2(entitiesPtr interface{}, where string) {
+
+	var sql string
+	sql = `select a.Id,a.SupplierName,b.AccessCardNo, a.OldSupplierName, b.SupplierTypeCode,`
+	sql += `a.LegalPerson,a.RegCapital,a.Mobile,b.AuditDate,b.ApplyTime,b.EffectEndTime,b.InFlag,a.ContactName,a.CommercialNo, `
+	sql += `a.DepositBank,a.HseTraining,a.CompanyType,a.SetupTime,a.Address,a.Province,a.City,a.Street, `
+	sql += `a.LinkAddress,a.LinkProvince,a.LinkCity,a.LinkStreet,a.BusinessScope, `
+	sql += `b.InStyle, b.Id CertId, b.RecUnitName as CheckUnitName, b.Remark `
+	sql += `from OilSupplier a `
+	sql += `left join OilSupplierCert b on b.SupplierId = a.Id `
+	sql += `where ` + where
+	s.DBE.SQL(sql).Find(entitiesPtr)
+
+}
+
+func (s *SelectService) GetFileList(entitiesPtr interface{}, where string) {
+
+	var sql string
+	sql = `select FileName, EffectDate,FileUrl,OtherRemark `
+	sql += `from OilSupplierFile `
+	sql += `where ` + where
+	s.DBE.SQL(sql).Find(entitiesPtr)
+
+}
+
 func (s *SelectService) GetMyPagingEntitiesWithOrderBytblForExport(supplierTableName, supplierCertTableName, OilInfoChangeName, OilCorporateInfoName, OilSupplierCertSubName,
 	OilSupplierFileName string, pageIndex, itemsPerPage int64, orderby string, asc bool, entitiesPtr interface{}, where, having, CerSubName string, Ids string, NeedFileType string) (total int64) {
 

+ 25 - 0
src/dashoo.cn/backend/api/business/oilsupplier/supplier/oilsupplier.go

@@ -1,6 +1,8 @@
 package supplier
 
 import (
+	"dashoo.cn/backend/api/business/oilsupplier/suppliercertsub"
+	"dashoo.cn/backend/api/business/oilsupplier/supplierfile"
 	"time"
 )
 
@@ -440,6 +442,29 @@ type OilSupplierSelect struct {
 	Remark           string
 }
 
+type OilSupplierSelect2 struct {
+	Id               int //Oilsupplier表id
+	CertId           int
+	AccessCardNo     string    //准入证号
+	SupplierName     string    //企业名称
+	SupplierTypeCode string    //准入类别编号
+	Grade            string    //级别
+	OperType         string    //供应商类型
+	LegalPerson      string    //法定代表人姓名
+	Mobile           string    //移动电话
+	EffectEndTime    time.Time //有效期至
+	ContactName      string    //联系人姓名
+	CommercialNo     string    //统一社会信用代码
+	CompanyType      string    //公司类型
+	Address          string    //注册详细地址
+	Province         string    //注册省
+	City             string    //注册市
+	Street           string    //注册区
+	InStyle          string    //准入方式
+	FileList []supplierfile.OilSupplierFileSelect
+	SubList []suppliercertsub.OilSupplierCertSubSelect
+}
+
 type OilSupplierContrast struct {
 	Id               int //Oilsupplier表id
 	CertId           int

+ 9 - 0
src/dashoo.cn/backend/api/business/oilsupplier/suppliercertsub/oilsuppliercertsub.go

@@ -30,6 +30,15 @@ type OilSupplierCertSub struct {
 	IsQuestion           int       `xorm:"default 0 comment('问题状态,0正常,1有问题') INT(10)"`
 	LackFile             string    `xorm:"default 0 comment('缺少资质') VARCHAR(500)"`
 }
+
+type OilSupplierCertSubSelect struct {
+	GoodsLevel           string    `xorm:"not null default '' comment('级别')"`
+	IsManufacturer       int       `xorm:"not null comment('是否为供应商') INT(11)"`
+	Code                 string    `xorm:"not null default '' comment('分类编码') VARCHAR(8)"`
+	Name                 string    `xorm:"not null default '' comment('分类名称') VARCHAR(50)"`
+	CertSubStatus        string    `xorm:"null default '1' comment('1:正常2:不良记录暂停') VARCHAR(10)"`
+	Remark               string    `xorm:"comment('备注') VARCHAR(500)"`
+}
 type OilSupplierCertSub1 struct {
 	Id                   int       `xorm:"not null pk autoincr INT(10)"`
 	SupplierId           int       `xorm:"not null comment('供方基本信息表主键') INT(10)"`

+ 11 - 0
src/dashoo.cn/backend/api/business/oilsupplier/supplierfile/supplierfile.go

@@ -30,6 +30,17 @@ type OilSupplierFile struct {
 	ModifiedBy        string    `xorm:"VARCHAR(50)"`
 }
 
+type OilSupplierFileSelect struct {
+	EffectDate        time.Time `xorm:"DATETIME"`
+	FileUrl           string    `xorm:"VARCHAR(100)"`
+	FileList 		[]OilSupplierFileSelect1
+	OtherRemark       string    `xorm:"VARCHAR(500)"`
+}
+type OilSupplierFileSelect1 struct {
+	FileName          string    `xorm:"VARCHAR(50)"`
+	FileUrl           string    `xorm:"VARCHAR(100)"`
+}
+
 type Del_OilSupplierFile struct {
 	Id                int       `xorm:"not null pk autoincr INT(10)"`
 	SupplierId        int       `xorm:"INT(10)"`

+ 52 - 0
src/dashoo.cn/backend/api/controllers/oilsupplier/select.go

@@ -2,6 +2,7 @@ package oilsupplier
 
 import (
 	"archive/zip"
+	"dashoo.cn/backend/api/business/oilsupplier/suppliercertsub"
 	"encoding/json"
 	"fmt"
 	"github.com/tealeg/xlsx"
@@ -1547,3 +1548,54 @@ func (this *SelectController) GetTableHeaderList() {
 	this.ServeJSON()
 
 }
+
+// @Title 获取某个公司信息-安全管理平台-对外
+// @Description
+// @Success 200 {object}
+// @router /getSupplierInfo [get]
+func (this *SelectController) GetSupplierInfo() {
+	commercialNo := this.GetString("CommercialNo")
+	var errinfo ErrorInfo
+	if commercialNo == "" {
+		errinfo.Message = "操作失败!请求信息不完整"
+		errinfo.Code = -2
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+		return
+	}
+	where := "a.CommercialNo = '" + commercialNo + "'"
+
+	svc := selectbusiness.GetSelectService(utils.DBE)
+	var suppCertList []supplier.OilSupplierSelect2
+	svc.GetMyPagingEntitiesWithOrderBytbl2(&suppCertList, where)
+
+	for i,suppCert := range suppCertList {
+		var fileList []supplierfile.OilSupplierFileSelect
+		where1 := "SupplierId = " + strconv.Itoa(suppCert.Id) + " and SupplierTypeCode in ('000','" + suppCert.SupplierTypeCode + "')"
+		svc.GetFileList(&fileList, where1)
+		for ii,file := range fileList {
+			var fileList1 []supplierfile.OilSupplierFileSelect1
+			fileArr := strings.Split(file.FileUrl, "$")
+			for _,file1 := range fileArr {
+				var fileList2 supplierfile.OilSupplierFileSelect1
+				fileArr1 := strings.Split(file1, "|")
+				fileList2.FileUrl = fileArr1[0]
+				fileList2.FileName = fileArr1[1]
+				fileList1 = append(fileList1, fileList2)
+			}
+			fileList[ii].FileList = fileList1
+		}
+		suppCertList[i].FileList = fileList
+
+		var subList []suppliercertsub.OilSupplierCertSubSelect
+		where1 = "SupplierId = " + strconv.Itoa(suppCert.Id) + " and SupplierCertId = " + strconv.Itoa(suppCert.CertId)
+		svc.GetEntitysByWhere(OilSupplierCertSubName, where1, &subList)
+		suppCertList[i].SubList = subList
+	}
+
+	var datainfo DataInfo
+	datainfo.Items = suppCertList
+	this.Data["json"] = &datainfo
+	this.ServeJSON()
+
+}