| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361 |
- package oilsupplier
- import (
- "dashoo.cn/backend/api/business/oilsupplier/annualaudit"
- "dashoo.cn/backend/api/business/oilsupplier/infochange"
- "dashoo.cn/backend/api/business/oilsupplier/qualchange"
- "dashoo.cn/backend/api/business/oilsupplier/suppliercertappend"
- "encoding/json"
- // "fmt"
- "dashoo.cn/backend/api/business/oilsupplier/selectbusiness"
- "dashoo.cn/backend/api/business/oilsupplier/supplier"
- . "dashoo.cn/backend/api/controllers"
- "dashoo.cn/utils"
- )
- type SelectController struct {
- BaseController
- }
- type UpSearch struct {
- FullName string
- }
- type UpInfoSearch struct {
- FullName string
- SupplierTypeName string
- HeGe int
- BuHeGe int
- ZongShu int
- Reason string
- }
- // @Title 获取所有
- // @Description
- // @Success 200 {object}
- // @router /getcompanylist [post]
- func (this *SelectController) GetTList() {
- var model supplier.OilSupplierSelect
- var model1 supplier.RegCapitalRange //注册资金范围
- //var model2 supplier.NeedFileTypeStruct //资质结构体
- var jsonBlob = this.Ctx.Input.RequestBody
- json.Unmarshal(jsonBlob, &model)
- json.Unmarshal(jsonBlob, &model1)
- //json.Unmarshal(jsonBlob, &model2)
- // //获取分页信息
- page := this.GetPageInfoForm()
- where := " 1=1 "
- orderby := "a.Id"
- asc := true
- Order := this.GetString("Order")
- Prop := this.GetString("Prop")
- if Order != "" && Prop != "" {
- orderby = Prop
- if Order == "desc" {
- asc = false
- }
- }
- //准入证号
- if model.AccessCardNo != "" {
- where = where + " and b.AccessCardNo like '%" + model.AccessCardNo + "%'"
- }
- //企业名称
- if model.SupplierName != "" {
- where = where + " and a.SupplierName like '%" + model.SupplierName + "%'"
- }
- if model.OldSupplierName != "" {
- where = where + " and OldSupplierName like '%" + model.OldSupplierName + "%'"
- }
- //准入类别(基建,物资,技术服务)
- if model.SupplierTypeCode != "" {
- where = where + " and b.SupplierTypeCode = '" + model.SupplierTypeCode + "'"
- }
- //准入标识 1 准入 2 暂停 3取消
- if model.InFlag != "" {
- where = where + " and b.InFlag = '" + model.InFlag + "'"
- }
- //法人
- if model.LegalPerson != "" {
- where = where + " and a.LegalPerson like '%" + model.LegalPerson + "%'"
- }
- //联系人
- if model.ContactName != "" {
- where = where + " and a.ContactName like '%" + model.ContactName + "%'"
- }
- //统一社会信用代码
- if model.CommercialNo != "" {
- where = where + " and a.CommercialNo like '%" + model.CommercialNo + "%'"
- }
- //开户银行
- if model.DepositBank != "" {
- where = where + " and a.DepositBank like '%" + model.DepositBank + "%'"
- }
- //HSE审查
- if model.HseTraining != "" {
- where = where + " and a.HseTraining = '" + model.HseTraining + "'"
- }
- //公司类型
- if model.CompanyType != "" {
- where = where + " and a.CompanyType like '%" + model.CompanyType + "%'"
- }
- //成立时间
- SetupTime := this.GetString("SetupTime")
- if SetupTime != "" {
- where = where + " and a.SetupTime ='" + SetupTime + "'"
- }
- //注册资金范围
- if model1.RegCapital1 != "" {
- where = where + " and a.RegCapital >= '" + model1.RegCapital1 + "'"
- }
- if model1.RegCapital2 != "" {
- where = where + " and a.RegCapital <= '" + model1.RegCapital2 + "'"
- }
- //注册省份
- if model.Province != "" {
- where = where + " and a.Province = '" + model.Province + "'"
- }
- //注册市
- if model.City != "" {
- where = where + " and a.City = '" + model.City + "'"
- }
- //注册区
- if model.Street != "" {
- where = where + " and a.Street = '" + model.Street + "'"
- }
- //注册详细地址
- if model.Address != "" {
- where = where + " and a.Address like '%" + model.Address + "%'"
- }
- if model.LinkProvince != "" {
- where = where + " and a.LinkProvince = '" + model.LinkProvince + "'"
- }
- if model.LinkCity != "" {
- where = where + " and a.LinkCity = '" + model.LinkCity + "'"
- }
- if model.LinkStreet != "" {
- where = where + " and a.LinkStreet = '" + model.LinkStreet + "'"
- }
- if model.LinkAddress != "" {
- where = where + " and a.LinkAddress like '%" + model.LinkAddress + "%'"
- }
- //营业范围
- if model.BusinessScope != "" {
- where = where + " and a.BusinessScope like '%" + model.BusinessScope + "%'"
- }
- //包含资质
- //if model2.NeedFileType != nil && len(model2.NeedFileType) > 0 {
- // pararm := ""
- // for i := 0; i < len(model2.NeedFileType); i++ {
- //
- // pararm = pararm + "'" + model2.NeedFileType[i] + "',"
- //
- // }
- // fmt.Println(pararm[0 : len(pararm)-1])
- // where = where + " and d.NeedFileType in (" + pararm[0:len(pararm)-1] + ")"
- //}
- having:=""
- //准入范围
- if model.CerSubName!="" {
- having = " having CerSubName like '%"+model.CerSubName+"%' "
- }
- //资质
- if model.NeedFileType!="" {
- having = " having NeedFileType like '%"+model.NeedFileType+"%' "
- }
- if model.CerSubName!=""&& model.NeedFileType!=""{
- having = " having CerSubName like '%"+model.CerSubName+"%' and NeedFileType like '%"+model.NeedFileType+"%' "
- }
- svc := selectbusiness.GetSelectService(utils.DBE)
- var list []supplier.OilSupplierSelect
- total := svc.GetMyPagingEntitiesWithOrderBytbl(OilSupplierName, OilSupplierCertName, OilInfoChangeName,OilSupplierCert2FileName , page.CurrentPage, page.Size, orderby, asc, &list, where,having)
- var datainfo DataInfo
- datainfo.Items = list
- datainfo.CurrentItemCount = total
- datainfo.PageIndex = page.CurrentPage
- datainfo.ItemsPerPage = page.Size
- this.Data["json"] = &datainfo
- this.ServeJSON()
- }
- // @Title 获取所有
- // @Description
- // @Success 200 {object}
- // @router /up [post]
- func (this *SelectController) Up() {
- var model UpSearch
- var jsonBlob = this.Ctx.Input.RequestBody
- json.Unmarshal(jsonBlob, &model)
- // //获取分页信息
- page := this.GetPageInfoForm()
- where := ""
- asc := false
- Order := this.GetString("Order")
- Prop := this.GetString("Prop")
- if Order != "" && Prop != "" {
- if Order == "asc" {
- asc = true
- }
- }
- if model.FullName != "" {
- where = where + " and (select FullName from Base_Organize where Id = a.CommitComId) like '%" + model.FullName + "%'"
- }
- svc := selectbusiness.GetSelectService(utils.DBE)
- var list []UpInfoSearch
- total := svc.GetUp( OilSupplierCertName , page.CurrentPage, page.Size, Prop, asc, &list, where)
- var datainfo DataInfo
- datainfo.Items = list
- datainfo.CurrentItemCount = total
- datainfo.PageIndex = page.CurrentPage
- datainfo.ItemsPerPage = page.Size
- this.Data["json"] = &datainfo
- this.ServeJSON()
- }
- // @Title 获取所有资质名称
- // @Description
- // @Success 200 {object}
- // @router /getnftoptions [post]
- func (this *SelectController) GetNFTOptions() {
- svc := selectbusiness.GetSelectService(utils.DBE)
- var list []map[string]string
- sql := "select distinct(Name) from " + BaseTableHeader + ""
- list, _ = svc.DBE.QueryString(sql)
- var datainfo DataInfo
- datainfo.Items = list
- this.Data["json"] = &datainfo
- this.ServeJSON()
- }
- // @Title 流程查询准入
- // @Description
- // @Success 200 {object}
- // @router /getprocessauditlist [get]
- func (this *SelectController) GetProcessAuditList() {
- //获取分页信息
- page := this.GetPageInfoForm()
- where := " 1=1 "
- orderby := "Id"
- asc := false
- Order := this.GetString("Order")
- Prop := this.GetString("Prop")
- if Order != "" && Prop != "" {
- orderby = Prop
- if Order == "asc" {
- asc = true
- }
- }
- tabinx := this.GetString("tabinx")
- supplierTypeCode := this.GetString("SupplierTypeCode")
- supplierName := this.GetString("SupplierName")
- //企业用户必须加创建人条件
- if this.User.IsCompanyUser == 1 {
- where = where + " and b.CreateUserId = '" + this.User.Id + "'"
- }
- if supplierTypeCode != "" {
- where = where + " and b.SupplierTypeCode like '%" + supplierTypeCode + "%'"
- }
- if supplierName != "" {
- where = where + " and a.SupplierName like '%" + supplierName + "%'"
- }
- var total int64 = 0
- var datainfo DataInfo
- if tabinx == "0" {
- var list []supplier.OilSupplierView
- svc := supplier.GetOilSupplierService(utils.DBE)
- total = svc.GetMyPagingEntitiesWithOrderBytbl(OilSupplierName, OilSupplierCertName, page.CurrentPage, page.Size, orderby, asc, &list, where)
- datainfo.Items = list
- } else if tabinx == "1" {
- whereapp := "1=1"
- //企业用户必须加创建人条件
- if this.User.IsCompanyUser == 1 {
- whereapp = whereapp + " and CreateUserId = '" + this.User.Id + "'"
- }
- if supplierTypeCode != "" {
- whereapp = whereapp + " and AppendType like '%" + supplierTypeCode + "%'"
- }
- if supplierName != "" {
- whereapp = whereapp + " and SupplierName like '%" + supplierName + "%'"
- }
- var list []suppliercertappend.OilSupplierCertAppend
- svc := suppliercertappend.GetOilSupplierCertAppendService(utils.DBE)
- total = svc.GetPagingEntitiesWithOrderBytbl("", page.CurrentPage, page.Size, orderby, asc, &list, whereapp)
- datainfo.Items = list
- } else if tabinx == "2" {
- whereapp := "1=1"
- //企业用户必须加创建人条件
- if this.User.IsCompanyUser == 1 {
- whereapp = whereapp + " and CreateUserId = '" + this.User.Id + "'"
- }
- if supplierTypeCode != "" {
- whereapp = whereapp + " and SupplierTypeName like '%" + supplierTypeCode + "%'"
- }
- if supplierName != "" {
- whereapp = whereapp + " and SupplierName like '%" + supplierName + "%'"
- }
- var list []annualaudit.OilAnnualAudit
- svc := annualaudit.GetOilAnnualAuditService(utils.DBE)
- total = svc.GetPagingEntitiesWithOrderBytbl("", page.CurrentPage, page.Size, orderby, asc, &list, whereapp)
- datainfo.Items = list
- } else if tabinx == "3" {
- whereapp := "1=1"
- //企业用户必须加创建人条件
- if this.User.IsCompanyUser == 1 {
- whereapp = whereapp + " and CreateUserId = '" + this.User.Id + "'"
- }
- if supplierName != "" {
- whereapp = whereapp + " and SupplierName like '%" + supplierName + "%'"
- }
- var list []infochange.OilInfoChange
- svc := infochange.GetInfoChangeService(utils.DBE)
- total = svc.GetPagingEntitiesWithOrderBytbl("", page.CurrentPage, page.Size, orderby, asc, &list, whereapp)
- datainfo.Items = list
- } else if tabinx == "4" {
- whereapp := "1=1"
- //企业用户必须加创建人条件
- if this.User.IsCompanyUser == 1 {
- whereapp = whereapp + " and CreateUserId = '" + this.User.Id + "'"
- }
- if supplierName != "" {
- whereapp = whereapp + " and SupplierName like '%" + supplierName + "%'"
- }
- svc := qualchange.GetQualChangeService(utils.DBE)
- var list []qualchange.OilQualChangeMain
- total = svc.GetPagingEntitiesWithOrderBytbl("", page.CurrentPage, page.Size, orderby, asc, &list, whereapp)
- datainfo.Items = list
- }
- datainfo.CurrentItemCount = total
- datainfo.PageIndex = page.CurrentPage
- datainfo.ItemsPerPage = page.Size
- this.Data["json"] = &datainfo
- this.ServeJSON()
- }
|