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() }