| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008 |
- package oilsupplier
- import (
- "dashoo.cn/backend/api/business/oilsupplier/suppliercertsub"
- "dashoo.cn/backend/api/business/register"
- "encoding/json"
- "fmt"
- "strconv"
- "strings"
- "time"
- "dashoo.cn/backend/api/business/auditsetting"
- "dashoo.cn/backend/api/business/organize"
- "dashoo.cn/business2/permission"
- "dashoo.cn/backend/api/business/workflow"
- "dashoo.cn/business2/areajson"
- "dashoo.cn/business2/items"
- "dashoo.cn/backend/api/business/baseUser"
- "dashoo.cn/backend/api/business/oilsupplier/supplier"
- "dashoo.cn/backend/api/business/oilsupplier/suppliercert"
- . "dashoo.cn/backend/api/controllers"
- "dashoo.cn/business2/userRole"
- "dashoo.cn/utils"
- "github.com/go-xorm/xorm"
- )
- type OilSupplierController struct {
- BaseController
- }
- // @Title 获取列表
- // @Description get user by token
- // @Success 200 {object} []supplier.OilSupplier
- // @router /list [get]
- func (this *OilSupplierController) GetEntityList() {
- //获取分页信息
- 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
- }
- }
- Id := this.GetString("Id")
- SupplierName := this.GetString("SupplierName")
- OilCertificateNo := this.GetString("OilCertificateNo")
- Grade := this.GetString("Grade")
- MgrUnit := this.GetString("MgrUnit")
- OperType := this.GetString("OperType")
- Country := this.GetString("Country")
- MaunAgent := this.GetString("MaunAgent")
- ConstructTeam := this.GetString("ConstructTeam")
- CommercialNo := this.GetString("CommercialNo")
- OrganCode := this.GetString("OrganCode")
- CountryTaxNo := this.GetString("CountryTaxNo")
- LocalTaxNo := this.GetString("LocalTaxNo")
- Address := this.GetString("Address")
- Province := this.GetString("Province")
- City := this.GetString("City")
- Street := this.GetString("Street")
- HouseNo := this.GetString("HouseNo")
- ZipCode := this.GetString("ZipCode")
- QualitySystemCert := this.GetString("QualitySystemCert")
- ProductQualityCert := this.GetString("ProductQualityCert")
- MaunLicense := this.GetString("MaunLicense")
- QualifCert := this.GetString("QualifCert")
- QualifCertLevel := this.GetString("QualifCertLevel")
- SafetyLicense := this.GetString("SafetyLicense")
- TechServiceLic := this.GetString("TechServiceLic")
- TJInNotify := this.GetString("TJInNotify")
- SpecIndustryCert := this.GetString("SpecIndustryCert")
- LegalPerson := this.GetString("LegalPerson")
- CategoryCode := this.GetString("CategoryCode")
- CategoryName := this.GetString("CategoryName")
- RegCapital := this.GetString("RegCapital")
- Currency := this.GetString("Currency")
- ContactName := this.GetString("ContactName")
- CompanyType := this.GetString("CompanyType")
- SetupTime := this.GetString("SetupTime")
- DepositBank := this.GetString("DepositBank")
- BankAccount := this.GetString("BankAccount")
- EMail := this.GetString("EMail")
- BankCreditRating := this.GetString("BankCreditRating")
- Mobile := this.GetString("Mobile")
- Telphone := this.GetString("Telphone")
- Fax := this.GetString("Fax")
- CompanyTel := this.GetString("CompanyTel")
- QQ := this.GetString("QQ")
- CompanyUrl := this.GetString("CompanyUrl")
- SpecSupplier := this.GetString("SpecSupplier")
- SpecTypeCode := this.GetString("SpecTypeCode")
- SpecTypeName := this.GetString("SpecTypeName")
- Remark := this.GetString("Remark")
- IsDelete := this.GetString("IsDelete")
- CreateOn := this.GetString("CreateOn")
- CreateUserId := this.GetString("CreateUserId")
- CreateBy := this.GetString("CreateBy")
- ModifiedOn := this.GetString("ModifiedOn")
- ModifiedUserId := this.GetString("ModifiedUserId")
- ModifiedBy := this.GetString("ModifiedBy")
- if Id != "" {
- where = where + " and Id like '%" + Id + "%'"
- }
- if SupplierName != "" {
- where = where + " and SupplierName like '%" + SupplierName + "%'"
- }
- if OilCertificateNo != "" {
- where = where + " and OilCertificateNo like '%" + OilCertificateNo + "%'"
- }
- if Grade != "" {
- where = where + " and Grade like '%" + Grade + "%'"
- }
- if MgrUnit != "" {
- where = where + " and MgrUnit like '%" + MgrUnit + "%'"
- }
- if OperType != "" {
- where = where + " and OperType like '%" + OperType + "%'"
- }
- if Country != "" {
- where = where + " and Country like '%" + Country + "%'"
- }
- if MaunAgent != "" {
- where = where + " and MaunAgent like '%" + MaunAgent + "%'"
- }
- if ConstructTeam != "" {
- where = where + " and ConstructTeam like '%" + ConstructTeam + "%'"
- }
- if CommercialNo != "" {
- where = where + " and CommercialNo like '%" + CommercialNo + "%'"
- }
- if OrganCode != "" {
- where = where + " and OrganCode like '%" + OrganCode + "%'"
- }
- if CountryTaxNo != "" {
- where = where + " and CountryTaxNo like '%" + CountryTaxNo + "%'"
- }
- if LocalTaxNo != "" {
- where = where + " and LocalTaxNo like '%" + LocalTaxNo + "%'"
- }
- if Address != "" {
- where = where + " and Address like '%" + Address + "%'"
- }
- if Province != "" {
- where = where + " and Province like '%" + Province + "%'"
- }
- if City != "" {
- where = where + " and City like '%" + City + "%'"
- }
- if Street != "" {
- where = where + " and Street like '%" + Street + "%'"
- }
- if HouseNo != "" {
- where = where + " and HouseNo like '%" + HouseNo + "%'"
- }
- if ZipCode != "" {
- where = where + " and ZipCode like '%" + ZipCode + "%'"
- }
- if QualitySystemCert != "" {
- where = where + " and QualitySystemCert like '%" + QualitySystemCert + "%'"
- }
- if ProductQualityCert != "" {
- where = where + " and ProductQualityCert like '%" + ProductQualityCert + "%'"
- }
- if MaunLicense != "" {
- where = where + " and MaunLicense like '%" + MaunLicense + "%'"
- }
- if QualifCert != "" {
- where = where + " and QualifCert like '%" + QualifCert + "%'"
- }
- if QualifCertLevel != "" {
- where = where + " and QualifCertLevel like '%" + QualifCertLevel + "%'"
- }
- if SafetyLicense != "" {
- where = where + " and SafetyLicense like '%" + SafetyLicense + "%'"
- }
- if TechServiceLic != "" {
- where = where + " and TechServiceLic like '%" + TechServiceLic + "%'"
- }
- if TJInNotify != "" {
- where = where + " and TJInNotify like '%" + TJInNotify + "%'"
- }
- if SpecIndustryCert != "" {
- where = where + " and SpecIndustryCert like '%" + SpecIndustryCert + "%'"
- }
- if LegalPerson != "" {
- where = where + " and LegalPerson like '%" + LegalPerson + "%'"
- }
- if CategoryCode != "" {
- where = where + " and CategoryCode like '%" + CategoryCode + "%'"
- }
- if CategoryName != "" {
- where = where + " and CategoryName like '%" + CategoryName + "%'"
- }
- if RegCapital != "" {
- where = where + " and RegCapital like '%" + RegCapital + "%'"
- }
- if Currency != "" {
- where = where + " and Currency like '%" + Currency + "%'"
- }
- if ContactName != "" {
- where = where + " and ContactName like '%" + ContactName + "%'"
- }
- if CompanyType != "" {
- where = where + " and CompanyType like '%" + CompanyType + "%'"
- }
- if SetupTime != "" {
- where = where + " and SetupTime like '%" + SetupTime + "%'"
- }
- if DepositBank != "" {
- where = where + " and DepositBank like '%" + DepositBank + "%'"
- }
- if BankAccount != "" {
- where = where + " and BankAccount like '%" + BankAccount + "%'"
- }
- if EMail != "" {
- where = where + " and EMail like '%" + EMail + "%'"
- }
- if BankCreditRating != "" {
- where = where + " and BankCreditRating like '%" + BankCreditRating + "%'"
- }
- if Mobile != "" {
- where = where + " and Mobile like '%" + Mobile + "%'"
- }
- if Telphone != "" {
- where = where + " and Telphone like '%" + Telphone + "%'"
- }
- if Fax != "" {
- where = where + " and Fax like '%" + Fax + "%'"
- }
- if CompanyTel != "" {
- where = where + " and CompanyTel like '%" + CompanyTel + "%'"
- }
- if QQ != "" {
- where = where + " and QQ like '%" + QQ + "%'"
- }
- if CompanyUrl != "" {
- where = where + " and CompanyUrl like '%" + CompanyUrl + "%'"
- }
- if SpecSupplier != "" {
- where = where + " and SpecSupplier like '%" + SpecSupplier + "%'"
- }
- if SpecTypeCode != "" {
- where = where + " and SpecTypeCode like '%" + SpecTypeCode + "%'"
- }
- if SpecTypeName != "" {
- where = where + " and SpecTypeName like '%" + SpecTypeName + "%'"
- }
- if Remark != "" {
- where = where + " and Remark like '%" + Remark + "%'"
- }
- if IsDelete != "" {
- where = where + " and IsDelete like '%" + IsDelete + "%'"
- }
- if CreateUserId != "" {
- where = where + " and CreateUserId like '%" + CreateUserId + "%'"
- }
- if CreateBy != "" {
- where = where + " and CreateBy like '%" + CreateBy + "%'"
- }
- if ModifiedOn != "" {
- where = where + " and ModifiedOn like '%" + ModifiedOn + "%'"
- }
- if ModifiedUserId != "" {
- where = where + " and ModifiedUserId like '%" + ModifiedUserId + "%'"
- }
- if ModifiedBy != "" {
- where = where + " and ModifiedBy like '%" + ModifiedBy + "%'"
- }
- if CreateOn != "" {
- dates := strings.Split(CreateOn, ",")
- if len(dates) == 2 {
- minDate := dates[0]
- maxDate := dates[1]
- where = where + " and CreateOn>='" + minDate + "' and CreateOn<='" + maxDate + "'"
- }
- }
- //企业用户必须加创建人条件
- if this.User.IsCompanyUser == 1 {
- where = where + " and 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 {
- where = where + " and CreateUserId = '" + this.User.Id + "'"
- }
- }
- svc := supplier.GetOilSupplierService(utils.DBE)
- var list []supplier.OilSupplier
- total := svc.GetPagingEntitiesWithOrderBytbl("", page.CurrentPage, page.Size, orderby, 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 get user by token
- // @Success 200 {object} []supplier.OilSupplier
- // @router /certlist [get]
- func (this *OilSupplierController) GetJoinCertEntityList() {
- //获取分页信息
- 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
- }
- }
- 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")
- 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 + "%'"
- }
- //企业用户只看自己的数据记录
- /*parameterSvc := baseparameter.GetBaseparameterService(utils.DBE) //取出外部门ID
- extOrganizeId := parameterSvc.GetBaseparameterMessage("GFGL", "paramset", "ExtOrganizeId")
- if extOrganizeId == this.User.DepartmentId {
- where = where + " and a.CreateUserId = '" + this.User.Id + "'"
- }*/
- svc := supplier.GetOilSupplierService(utils.DBE)
- var registerUser register.OilCorporateInfo
- sql := " UserName='" + this.User.Username + "'"
- svc.GetEntity(®isterUser,sql)
- //企业用户必须加创建人条件
- if this.User.IsCompanyUser == 1 {
- where = where + " and (a.CreateUserId = '" + this.User.Id + "' or a.CommercialNo='"+registerUser.CommercialNo+"')"
- } else {
- //超级管理员和有查看所有数据权限的用户不加条件
- svcPerm := permission.GetPermissionService(utils.DBE)
- isauth := svcPerm.IsAuthorized(this.User.Id, "oil_supplier.marketAccess.AllRecord")
- if !svcPerm.IsAdmin(this.User.Id) && !isauth {
- where = where + " and b.CreateUserId = '" + this.User.Id + "'"
- }
- }
- var list []supplier.OilSupplierView
- total := svc.GetMyPagingEntitiesWithOrderBytbl(OilSupplierName, OilSupplierCertName, page.CurrentPage, page.Size, orderby, 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 get user by token
- // @Success 200 {object} []supplier.OilSupplier
- // @router /jzps_certlist [get]
- func (this *OilSupplierController) GetJZPSJoinCertEntityList() {
- //获取分页信息
- 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
- }
- }
- 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")
- 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 + "%'"
- }
- 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_SUPPLIER_APPLY, this.User.Id)
- if len(strings.Trim(ids, ",")) > 0 {
- certIdList += strings.Trim(ids, ",")+ ","
- }
- ids = actisvc.GetAllMyTasks(workflow.OIL_FIRST_SUPPLIER_APPLY, this.User.Id)
- if len(strings.Trim(ids, ",")) > 0 {
- certIdList += strings.Trim(ids, ",")+ ","
- }
- ids = actisvc.GetAllMyTasks(workflow.OIL_SECOND_SUPPLIER_APPLY, this.User.Id)
- if len(strings.Trim(ids, ",")) > 0 {
- certIdList += strings.Trim(ids, ",")+ ","
- }
- ids = actisvc.GetAllMyTasks(workflow.OIL_ENUSER_SUPPLIER_APPLY, this.User.Id)
- if len(strings.Trim(ids, ",")) > 0 {
- certIdList += strings.Trim(ids, ",")+ ","
- }
- ids = actisvc.GetAllMyTasks(workflow.OIL_FIRST_ENUSER_SUPPLIER_APPLY, this.User.Id)
- if len(strings.Trim(ids, ",")) > 0 {
- certIdList += strings.Trim(ids, ",")+ ","
- }
- ids = actisvc.GetAllMyTasks(workflow.OIL_SECOND_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 + "'"
- }
- } else {
- //where = where + " and a.CreateUserId = '" + this.User.Id + "'"
- }
- }
- svc := supplier.GetOilSupplierService(utils.DBE)
- var list []supplier.OilSupplierView
- total := svc.GetMyPagingEntitiesWithOrderBytbl(OilSupplierName, OilSupplierCertName, page.CurrentPage, page.Size, orderby, 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 get user by token
- // @Success 200 {object} []supplier.OilSupplier
- // @router /storelist [get]
- func (this *OilSupplierController) GetJoinStoreEntityList() {
- //获取分页信息
- 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
- }
- }
- 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")
- 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 + "%'"
- }
- status := this.GetString("Status")
- if status != "" {
- where = where + " and b.Status='" + status + "'"
- }
- //企业用户只看自己的数据记录
- /*parameterSvc := baseparameter.GetBaseparameterService(utils.DBE) //取出外部门ID
- extOrganizeId := parameterSvc.GetBaseparameterMessage("GFGL", "paramset", "ExtOrganizeId")
- if extOrganizeId == this.User.DepartmentId {
- where = where + " and a.CreateUserId = '" + this.User.Id + "'"
- }*/
- //企业用户必须加创建人条件
- if this.User.IsCompanyUser == 1 {
- where = where + " and a.CreateUserId = '" + this.User.Id + "'"
- }
- svc := supplier.GetOilSupplierService(utils.DBE)
- var list []supplier.OilSupplierView
- total := svc.GetMyPagingEntitiesWithOrderBytbl(OilSupplierName, OilSupplierCertName, page.CurrentPage, page.Size, orderby, 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 get user by token
- // @Success 200 {object} []supplier.OilSupplierView
- // @router /mytasks [get]
- func (this *OilSupplierController) GetMyTaskEntityList() {
- //获取分页信息
- page := this.GetPageInfoForm()
- where := " 1=1 "
- orderby := "Id"
- asc := false
- Order := this.GetString("Order")
- //Statustype := this.GetString("Statustype")
- //if Statustype != "" {
- // where = " 1=1 and b.Status =" + Statustype
- //}
- where = where + " and b.Status>0"
- Prop := this.GetString("Prop")
- if Order != "" && Prop != "" {
- orderby = Prop
- if Order == "asc" {
- asc = true
- }
- }
- Id := this.GetString("Id")
- SupplierName := this.GetString("SupplierName")
- OilCertificateNo := this.GetString("OilCertificateNo")
- Grade := this.GetString("Grade")
- MgrUnit := this.GetString("MgrUnit")
- OperType := this.GetString("OperType")
- Country := this.GetString("Country")
- MaunAgent := this.GetString("MaunAgent")
- ConstructTeam := this.GetString("ConstructTeam")
- CommercialNo := this.GetString("CommercialNo")
- OrganCode := this.GetString("OrganCode")
- CountryTaxNo := this.GetString("CountryTaxNo")
- LocalTaxNo := this.GetString("LocalTaxNo")
- Address := this.GetString("Address")
- Province := this.GetString("Province")
- City := this.GetString("City")
- Street := this.GetString("Street")
- HouseNo := this.GetString("HouseNo")
- ZipCode := this.GetString("ZipCode")
- QualitySystemCert := this.GetString("QualitySystemCert")
- ProductQualityCert := this.GetString("ProductQualityCert")
- MaunLicense := this.GetString("MaunLicense")
- QualifCert := this.GetString("QualifCert")
- QualifCertLevel := this.GetString("QualifCertLevel")
- SafetyLicense := this.GetString("SafetyLicense")
- TechServiceLic := this.GetString("TechServiceLic")
- TJInNotify := this.GetString("TJInNotify")
- SpecIndustryCert := this.GetString("SpecIndustryCert")
- LegalPerson := this.GetString("LegalPerson")
- CategoryCode := this.GetString("CategoryCode")
- CategoryName := this.GetString("CategoryName")
- RegCapital := this.GetString("RegCapital")
- Currency := this.GetString("Currency")
- ContactName := this.GetString("ContactName")
- CompanyType := this.GetString("CompanyType")
- SetupTime := this.GetString("SetupTime")
- DepositBank := this.GetString("DepositBank")
- BankAccount := this.GetString("BankAccount")
- EMail := this.GetString("EMail")
- BankCreditRating := this.GetString("BankCreditRating")
- Mobile := this.GetString("Mobile")
- Telphone := this.GetString("Telphone")
- Fax := this.GetString("Fax")
- CompanyTel := this.GetString("CompanyTel")
- QQ := this.GetString("QQ")
- CompanyUrl := this.GetString("CompanyUrl")
- SpecSupplier := this.GetString("SpecSupplier")
- SpecTypeCode := this.GetString("SpecTypeCode")
- SpecTypeName := this.GetString("SpecTypeName")
- Remark := this.GetString("Remark")
- CreateOn := this.GetString("CreateOn")
- SupplierTypeCode := this.GetString("SupplierTypeCode")
- if Id != "" {
- where = where + " and a.Id like '%" + Id + "%'"
- }
- if SupplierName != "" {
- where = where + " and a.SupplierName like '%" + SupplierName + "%'"
- }
- if OilCertificateNo != "" {
- where = where + " and a.OilCertificateNo like '%" + OilCertificateNo + "%'"
- }
- if Grade != "" {
- where = where + " and a.Grade like '%" + Grade + "%'"
- }
- if MgrUnit != "" {
- where = where + " and a.MgrUnit like '%" + MgrUnit + "%'"
- }
- if OperType != "" {
- where = where + " and a.OperType like '%" + OperType + "%'"
- }
- if Country != "" {
- where = where + " and a.Country like '%" + Country + "%'"
- }
- if MaunAgent != "" {
- where = where + " and a.MaunAgent like '%" + MaunAgent + "%'"
- }
- if ConstructTeam != "" {
- where = where + " and a.ConstructTeam like '%" + ConstructTeam + "%'"
- }
- if CommercialNo != "" {
- where = where + " and a.CommercialNo like '%" + CommercialNo + "%'"
- }
- if OrganCode != "" {
- where = where + " and a.OrganCode like '%" + OrganCode + "%'"
- }
- if CountryTaxNo != "" {
- where = where + " and a.CountryTaxNo like '%" + CountryTaxNo + "%'"
- }
- if LocalTaxNo != "" {
- where = where + " and a.LocalTaxNo like '%" + LocalTaxNo + "%'"
- }
- if Address != "" {
- where = where + " and a.Address like '%" + Address + "%'"
- }
- if Province != "" {
- where = where + " and a.Province like '%" + Province + "%'"
- }
- if City != "" {
- where = where + " and a.City like '%" + City + "%'"
- }
- if Street != "" {
- where = where + " and a.Street like '%" + Street + "%'"
- }
- if HouseNo != "" {
- where = where + " and a.HouseNo like '%" + HouseNo + "%'"
- }
- if ZipCode != "" {
- where = where + " and a.ZipCode like '%" + ZipCode + "%'"
- }
- if QualitySystemCert != "" {
- where = where + " and a.QualitySystemCert like '%" + QualitySystemCert + "%'"
- }
- if ProductQualityCert != "" {
- where = where + " and a.ProductQualityCert like '%" + ProductQualityCert + "%'"
- }
- if MaunLicense != "" {
- where = where + " and a.MaunLicense like '%" + MaunLicense + "%'"
- }
- if QualifCert != "" {
- where = where + " and a.QualifCert like '%" + QualifCert + "%'"
- }
- if QualifCertLevel != "" {
- where = where + " and a.QualifCertLevel like '%" + QualifCertLevel + "%'"
- }
- if SafetyLicense != "" {
- where = where + " and a.SafetyLicense like '%" + SafetyLicense + "%'"
- }
- if TechServiceLic != "" {
- where = where + " and a.TechServiceLic like '%" + TechServiceLic + "%'"
- }
- if TJInNotify != "" {
- where = where + " and a.TJInNotify like '%" + TJInNotify + "%'"
- }
- if SpecIndustryCert != "" {
- where = where + " and a.SpecIndustryCert like '%" + SpecIndustryCert + "%'"
- }
- if LegalPerson != "" {
- where = where + " and a.LegalPerson like '%" + LegalPerson + "%'"
- }
- if CategoryCode != "" {
- where = where + " and a.CategoryCode like '%" + CategoryCode + "%'"
- }
- if CategoryName != "" {
- where = where + " and a.CategoryName like '%" + CategoryName + "%'"
- }
- if RegCapital != "" {
- where = where + " and a.RegCapital like '%" + RegCapital + "%'"
- }
- if Currency != "" {
- where = where + " and a.Currency like '%" + Currency + "%'"
- }
- if ContactName != "" {
- where = where + " and a.ContactName like '%" + ContactName + "%'"
- }
- if CompanyType != "" {
- where = where + " and a.CompanyType like '%" + CompanyType + "%'"
- }
- if SetupTime != "" {
- where = where + " and a.SetupTime like '%" + SetupTime + "%'"
- }
- if DepositBank != "" {
- where = where + " and a.DepositBank like '%" + DepositBank + "%'"
- }
- if BankAccount != "" {
- where = where + " and a.BankAccount like '%" + BankAccount + "%'"
- }
- if EMail != "" {
- where = where + " and a.EMail like '%" + EMail + "%'"
- }
- if BankCreditRating != "" {
- where = where + " and a.BankCreditRating like '%" + BankCreditRating + "%'"
- }
- if Mobile != "" {
- where = where + " and a.Mobile like '%" + Mobile + "%'"
- }
- if Telphone != "" {
- where = where + " and a.Telphone like '%" + Telphone + "%'"
- }
- if Fax != "" {
- where = where + " and a.Fax like '%" + Fax + "%'"
- }
- if CompanyTel != "" {
- where = where + " and a.CompanyTel like '%" + CompanyTel + "%'"
- }
- if QQ != "" {
- where = where + " and a.QQ like '%" + QQ + "%'"
- }
- if CompanyUrl != "" {
- where = where + " and a.CompanyUrl like '%" + CompanyUrl + "%'"
- }
- if SpecSupplier != "" {
- where = where + " and a.SpecSupplier like '%" + SpecSupplier + "%'"
- }
- if SpecTypeCode != "" {
- where = where + " and a.SpecTypeCode like '%" + SpecTypeCode + "%'"
- }
- if SpecTypeName != "" {
- where = where + " and a.SpecTypeName like '%" + SpecTypeName + "%'"
- }
- if Remark != "" {
- where = where + " and a.Remark like '%" + Remark + "%'"
- }
- if CreateOn != "" {
- dates := strings.Split(CreateOn, ",")
- if len(dates) == 2 {
- minDate := dates[0]
- maxDate := dates[1]
- where = where + " and a.CreateOn>='" + minDate + "' and a.CreateOn<='" + maxDate + "'"
- }
- }
- if SupplierTypeCode != "" {
- where = where + " and b.SupplierTypeCode = '" + SupplierTypeCode + "'"
- }
- //找出待办任务
- actisvc := workflow.GetActivitiService(utils.DBE)
- var certIdList string
- if actisvc.GetMyTasks(workflow.OIL_SUPPLIER_APPLY, this.User.Id) != "" {
- certIdList = actisvc.GetMyTasks(workflow.OIL_SUPPLIER_APPLY, this.User.Id)
- certIdList = certIdList + ","
- }
- if actisvc.GetMyTasks(workflow.OIL_FIRST_SUPPLIER_APPLY, this.User.Id) != "" {
- certIdList = fmt.Sprintf("%s %s", certIdList, actisvc.GetMyTasks(workflow.OIL_FIRST_SUPPLIER_APPLY, this.User.Id))
- certIdList = certIdList + ","
- }
- if actisvc.GetMyTasks(workflow.OIL_SECOND_SUPPLIER_APPLY, this.User.Id) != "" {
- certIdList = fmt.Sprintf("%s %s", certIdList, actisvc.GetMyTasks(workflow.OIL_SECOND_SUPPLIER_APPLY, this.User.Id))
- certIdList = certIdList + ","
- }
- if actisvc.GetMyTasks(workflow.OIL_ENUSER_SUPPLIER_APPLY, this.User.Id) != "" {
- certIdList = fmt.Sprintf("%s %s", certIdList, actisvc.GetMyTasks(workflow.OIL_ENUSER_SUPPLIER_APPLY, this.User.Id))
- certIdList = certIdList + ","
- }
- if actisvc.GetMyTasks(workflow.OIL_FIRST_ENUSER_SUPPLIER_APPLY, this.User.Id) != "" {
- certIdList = fmt.Sprintf("%s %s", certIdList, actisvc.GetMyTasks(workflow.OIL_FIRST_ENUSER_SUPPLIER_APPLY, this.User.Id))
- certIdList = certIdList + ","
- }
- if actisvc.GetMyTasks(workflow.OIL_SECOND_ENUSER_SUPPLIER_APPLY, this.User.Id) != "" {
- certIdList = fmt.Sprintf("%s %s", certIdList, actisvc.GetMyTasks(workflow.OIL_SECOND_ENUSER_SUPPLIER_APPLY, this.User.Id))
- }
- 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, ",")
- var list []supplier.OilSupplierView
- svc := supplier.GetOilSupplierService(utils.DBE)
- var total int64 = 0
- if (certIdList != "") {
- where += " and b.Id in (" + certIdList + ")"
- total = svc.GetMyPagingEntitiesWithOrderBytbl(OilSupplierName, OilSupplierCertName, page.CurrentPage, page.Size, orderby, 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 get user by token
- // @Success 200 {object} map[string]interface{}
- // @router /dictlist [get]
- func (this *OilSupplierController) GetDictList() {
- dictList := make(map[string]interface{})
- dictSvc := items.GetItemsService(utils.DBE)
- userSvc := baseUser.GetBaseUserService(utils.DBE)
- areaJsonSvc := areajson.GetAreaJsonService(utils.DBE)
- //customerSvc := svccustomer.GetCustomerService(utils.DBE)
- dictList["UnitRelation"] = dictSvc.GetKeyValueItems("UnitRelation")
- dictList["CompanyType"] = dictSvc.GetKeyValueItems("CompanyType")
- dictList["InOptions"] = dictSvc.GetKeyValueItems("InOptions")
- dictList["OperType"] = dictSvc.GetKeyValueItems("OperType")
- dictList["ManagementUnit"] = dictSvc.GetKeyValueItems("ManagementUnit")
- var userEntity userRole.Base_User
- userSvc.GetEntityById(this.User.Id, &userEntity)
- dictList["Supervisers"] = userSvc.GetUserListByDepartmentId(this.User.AccCode, userEntity.Departmentid)
- dictList["GaodeMapChinaAreas"] = areaJsonSvc.GetGaodeMapChinaAreas()
- dictList["CountryList"] = areaJsonSvc.GetCountryList()
- //获取我创建的所有公司
- var list []supplier.OilSupplier
- if this.User.IsCompanyUser == 1 {
- svcSupplier := supplier.GetOilSupplierService(utils.DBE)
- supplierWhere := " CreateUserId = '" + this.User.Id + "'"
- svcSupplier.GetEntitysByWhere(OilSupplierName, supplierWhere, &list)
- dictList["CompanyNames"] = list
- } else { //二级单位不用获取
- dictList["CompanyNames"] = list
- }
- // 部门
- orgsvc := organize.GetOrganizeService(utils.DBE)
- dictList["Organizes"] = orgsvc.GetCollectionDetailviewlist("'" + this.User.AccCode + "'")
- //var dictCustomer []svccustomer.Customer
- //customerSvc.GetEntitysByWhere(this.User.AccCode + CustomerName, "", &dictCustomer)
- //dictList["EntrustCorp"] = &dictCustomer
- //获得有审核权限的人员
- var users []userRole.Base_RoleList
- var auditWorkflow auditsetting.Base_OilAuditSetting
- rsvc := auditsetting.GetOilAuditSettingService(utils.DBE)
- rsvc.GetAuditStepRoleEntity(OilAuditSettingName, this.User.DepartmentId, workflow.SECOND_TRIAL, &auditWorkflow)
- users = rsvc.GetUserByRole(strconv.Itoa(auditWorkflow.RoleId), this.User.AccCode) //
- dictList["Auditer"] = users
- var datainfo DataInfo
- datainfo.Items = dictList
- this.Data["json"] = &datainfo
- this.ServeJSON()
- }
- // @Title 获取字典列表By Status
- // @Description get user by token
- // @Success 200 {object} map[string]interface{}
- // @router /dictlistbystatus/ [get]
- func (this *OilSupplierController) GetDictListByStatus() {
- //status := this.Ctx.Input.Param(":status")
- status := this.GetString("status")
- majorAduit := this.GetString("majorAduit")
- dictList := make(map[string]interface{})
- dictSvc := items.GetItemsService(utils.DBE)
- userSvc := baseUser.GetBaseUserService(utils.DBE)
- areaJsonSvc := areajson.GetAreaJsonService(utils.DBE)
- orgsvc := organize.GetOrganizeService(utils.DBE)
- svc := supplier.GetOilSupplierService(utils.DBE)
- //customerSvc := svccustomer.GetCustomerService(utils.DBE)
- dictList["ManagementUnit"] = dictSvc.GetKeyValueItems("ManagementUnit")
- dictList["UnitRelation"] = dictSvc.GetKeyValueItems("UnitRelation")
- dictList["CompanyType"] = dictSvc.GetKeyValueItems("CompanyType")
- dictList["InOptions"] = dictSvc.GetKeyValueItems("InOptions")
- dictList["OperType"] = dictSvc.GetKeyValueItems("OperType")
- dictList["CurrencyType"] = dictSvc.GetKeyValueItems("CurrencyType")
- var userEntity userRole.Base_User
- userSvc.GetEntityById(this.User.Id, &userEntity)
- dictList["Supervisers"] = userSvc.GetUserListByDepartmentId(this.User.AccCode, userEntity.Departmentid)
- dictList["GaodeMapChinaAreas"] = areaJsonSvc.GetGaodeMapChinaAreas()
- dictList["CountryList"] = areaJsonSvc.GetCountryList()
- //获取专业审批处室部门
- var preorglist []organize.Base_Organizetree
- //paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
- //topid := paramSvc.GetBaseparameterMessage("", "paramset", "HeadquartersID") // 总公司Id
- ids := orgsvc.GetAllChildUnitById("0")
- svc.GetProOrTreeList(ids, &preorglist)
- dictList["ProOrgList"] = preorglist
- var unitorglist []organize.Base_Organize
- where := "Category='Unit' and ParentId in (100000001,100000176) and Id not in (100000004,100000003,100000002) "
- orgsvc.GetEntities(&unitorglist, where)
- dictList["UnitOrgList"] = unitorglist
- //获取我创建的所有公司
- var list []supplier.OilSupplier
- if this.User.IsCompanyUser == 1 {
- svcSupplier := supplier.GetOilSupplierService(utils.DBE)
- supplierWhere := " CreateUserId = '" + this.User.Id + "'"
- svcSupplier.GetEntitysByWhere(OilSupplierName, supplierWhere, &list)
- dictList["CompanyNames"] = list
- } else { //二级单位不用获取
- dictList["CompanyNames"] = list
- }
- // 部门
- dictList["Organizes"] = orgsvc.GetCollectionDetailviewlist("'" + this.User.AccCode + "'")
- //var dictCustomer []svccustomer.Customer
- //customerSvc.GetEntitysByWhere(this.User.AccCode + CustomerName, "", &dictCustomer)
- //dictList["EntrustCorp"] = &dictCustomer
- //获得有审核权限的人员
- //var users []suppliercert.UserList
- //rsvc := auditsetting.GetOilAuditSettingService(utils.DBE)
- certSrv := suppliercert.GetOilSupplierCertService(utils.DBE)
- var users []userRole.Base_RoleList
- if status == suppliercert.FIRST_TRIAL_STATUS {
- //rsvc.GetAuditStepRoleEntity(OilAuditSettingName, this.User.DepartmentId, workflow.SECOND_TRIAL, &auditWorkflow)
- //users = rsvc.GetUserByRole(strconv.Itoa(auditWorkflow.RoleId), this.User.AccCode) //
- //where := "OrganizeId=" + this.User.DepartmentId + " and AuditStepCode='" + workflow.SECOND_TRIAL + "'"
- //rsvc.GetEntitysByWhere(OilAuditSettingName, where, &users)
- certSrv.GetAuditUser(this.User.DepartmentId, workflow.SECOND_TRIAL, &users)
- dictList["Auditer"] = users
- } else if status == suppliercert.SECOND_TRIAL_STATUS {
- //rsvc.GetAuditStepRoleEntity(OilAuditSettingName, this.User.DepartmentId, workflow.SECOND_TRIAL, &auditWorkflow)
- } else if status == suppliercert.THIRD_TRIAL_STATUS {
- //where := "OrganizeId=" + majorAduit + " and AuditStepCode='" + workflow.SECOND_TRIAL + "'"
- //rsvc.GetEntitysByWhere(OilAuditSettingName, where, &users)
- certSrv.GetAuditUser(majorAduit, workflow.SECOND_TRIAL, &users)
- dictList["Auditer"] = users
- } else if status == suppliercert.PROF_AUDIT_STATUS {
- //where := "OrganizeId=" + this.User.DepartmentId + " and AuditStepCode='" + workflow.PROF_AUDIT + "'"
- //rsvc.GetEntitysByWhere(OilAuditSettingName, where, &users)
- certSrv.GetAuditUser(this.User.DepartmentId, workflow.PROF_AUDIT, &users)
- dictList["Auditer"] = users
- } else if status == suppliercert.CENT_AUDIT_STATUS {
- }
- // 注册审批单位
- var registermodel register.OilCorporateInfo
- wherereg := "UserId=" + this.User.Id
- svc.GetEntity(®istermodel, wherereg)
- dictList["Register"] = registermodel
- // 所有二级单位
- var allunitorglist []organize.Base_Organize
- where = "Category='Unit'"
- orgsvc.GetEntities(&allunitorglist, where)
- dictList["Allunitorglist"] = allunitorglist
- var datainfo DataInfo
- datainfo.Items = dictList
- this.Data["json"] = &datainfo
- this.ServeJSON()
- }
- // @Title 获取实体
- // @Description 获取实体
- // @Success 200 {object} supplier.OilSupplier
- // @router /get/:id [get]
- func (this *OilSupplierController) GetEntity() {
- Id := this.Ctx.Input.Param(":id")
- var model supplier.OilSupplier
- svc := supplier.GetOilSupplierService(utils.DBE)
- svc.GetEntityByIdBytbl(OilSupplierName, Id, &model)
- this.Data["json"] = &model
- this.ServeJSON()
- }
- // @Title 获取实体
- // @Description 获取实体
- // @Success 200 {object} supplier.OilSupplier
- // @router /getandcert/:certId [get]
- func (this *OilSupplierController) GetEntityAndCert() {
- Id := this.Ctx.Input.Param(":certId")
- var model supplier.OilSupplierView
- //svc := supplier.GetOilSupplierService(utils.DBE)
- //svc.GetEntityByIdBytbl(OilSupplierName, Id, &model)
- var sql string
- sql = `select a.*, b.Id as CertId, b.AccessCardNo, b.SupplierTypeCode, b.SupplierTypeName, b.Step, b.WorkerTotal, b.ContractNum, b.UniversityNum, b.TechnicalNum, b.AboveProfNum,
- b.MiddleProfNum, b.NationalRegNum, b.NationalCertTotal, b.DesignerTotal, b.SkillerTotal, b.InStyle, b.WorkflowId, b.Status, b.ThirdAudit, b.BusinessKey, b.AuditIndex ,b.ProcessKey from ` + OilSupplierName + ` a `
- sql += ` left join ` + OilSupplierCertName + " b on b.SupplierId = a.Id"
- sql += ` where b.Id ='` + Id + `'`
- utils.DBE.SQL(sql).Get(&model)
- this.Data["json"] = &model
- this.ServeJSON()
- }
- // @Title 获取实体
- // @Description 获取实体
- // @Success 200 {object} supplier.OilSupplier
- // @router /getbyname [get]
- func (this *OilSupplierController) GetEntityByName() {
- name := this.GetString("name")
- typecode := this.GetString("typecode")
- svc := supplier.GetOilSupplierService(utils.DBE)
- var model supplier.OilSupplierApply
- var sql string
- sql = `select a.*,b.InStyle,b.Status from ` + OilSupplierName + ` a `
- sql += ` left join ` + OilSupplierCertName + ` b on b.SupplierId = a.Id and b.SupplierTypeCode='`+typecode+`'`
- sql += ` where a.SupplierName ='` + name + `'`
- utils.DBE.SQL(sql).Get(&model)
- if model.SupplierName==""{
- var model2 register.OilCorporateInfo
- svc.GetEntityByWhere(OilCorporateInfoName, "SupplierName='" + name + "'", &model2)
- model2.Remark=""
- model2.Id=0
- if model2.SupplierName==""{
- this.ServeJSON()
- }else{
- this.Data["json"] = &model2
- this.ServeJSON()
- }
- }
- this.Data["json"] = &model
- this.ServeJSON()
- }
- // @Title 添加
- // @Description 新增
- // @Success 200 {object} controllers.Request
- // @router /add [post]
- func (this *OilSupplierController) AddEntity() {
- var model supplier.OilSupplier
- var modelCert suppliercert.OilSupplierCert
- var modelCertVM suppliercert.OilSupplierVM
- var jsonBlob = this.Ctx.Input.RequestBody
- json.Unmarshal(jsonBlob, &model)
- json.Unmarshal(jsonBlob, &modelCertVM)
- serviceCert := suppliercert.GetOilSupplierCertService(utils.DBE)
- canApply := serviceCert.IsCanApplyByExtOrganizeUser(modelCertVM.SupplierTypeCode, this.User.DepartmentId, this.User.Id, this.User.IsCompanyUser)
- var errinfo ErrorDataInfo
- if !canApply {
- errinfo.Message = "添加失败!供方用户只能申请一次"
- errinfo.Code = -1
- this.Data["json"] = &errinfo
- this.ServeJSON()
- return
- }
- var list []supplier.OilSupplierView
- service := supplier.GetOilSupplierService(utils.DBE)
- service.CheckRepeatApplyInfo(OilSupplierName, OilSupplierCertName, modelCertVM.SupplierTypeCode, model.SupplierName, model.CommercialNo, model.OrganCode, model.BankAccount, model.CompanyUrl, &list)
- if len(list) > 0 {
- errinfo.Message = "添加失败! 已存在相关企业的信息,不能重复申请"
- errinfo.Code = -1
- this.Data["json"] = &errinfo
- this.ServeJSON()
- return
- }
- //if model.Id <= 0 {
- // service.CheckRepeatApplyInfo(OilSupplierName, OilSupplierCertName, modelCertVM.SupplierTypeCode, model.SupplierName, model.CommercialNo, model.OrganCode, model.BankAccount, model.CompanyUrl, &list)
- // if len(list) > 0 {
- // errinfo.Message = "添加失败! 已存在相关企业的信息,不能重复申请"
- // errinfo.Code = -1
- // this.Data["json"] = &errinfo
- // this.ServeJSON()
- // return
- // }
- //} else {
- // service.CheckUpdateRepeatApplyInfo(OilSupplierName, OilSupplierCertName, modelCertVM.SupplierTypeCode, strconv.Itoa(model.Id), model.SupplierName, model.CommercialNo, model.OrganCode, model.BankAccount, model.CompanyUrl, &list)
- // if len(list) > 0 {
- // errinfo.Message = "添加失败! 已存在相关企业的信息,或与其他企业信息重复"
- // errinfo.Code = -1
- // this.Data["json"] = &errinfo
- // this.ServeJSON()
- // return
- // }
- //}
- var session *xorm.Session
- session = utils.DBE.NewSession()
- svc := supplier.GetOilSupplierSession(session)
- svcCert := suppliercert.GetOilSupplierCertSession(session)
- model.CreateOn = time.Now()
- model.CreateBy = this.User.Realname
- model.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
- //model.OrganizeId, _ = utils.StrTo(this.User.DepartmentId).Int()
- defer session.Close()
- err := session.Begin()
- if model.Id <= 0 {
- _, err = svc.InsertEntityBytbl(OilSupplierName, &model)
- } else {
- //判断基本信息是否可修改
- updateCols := svc.GetUpdateCols(OilSupplierCertName, modelCertVM.SupplierTypeCode, model.Id)
- err = svc.UpdateEntityBytbl(OilSupplierName, model.Id, &model, updateCols)
- }
- if err != nil {
- session.Rollback()
- }
- modelCert.SupplierId = model.Id
- modelCert.SupplierTypeCode = modelCertVM.SupplierTypeCode
- modelCert.SupplierTypeName = modelCertVM.SupplierTypeName
- modelCert.InStyle = modelCertVM.InStyle
- modelCert.Step = 1 //企业信息保存完成
- modelCert.CreateOn = time.Now()
- modelCert.CreateBy = this.User.Realname
- modelCert.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
- _, err = svcCert.InsertEntityBytbl(OilSupplierCertName, &modelCert)
- if err != nil {
- session.Rollback()
- }
- // add Commit() after all actions
- err = session.Commit()
- if err == nil {
- //新增
- errinfo.Message = "添加成功!"
- errinfo.Code = 0
- errinfo.Item = strconv.Itoa(model.Id) + "_" + strconv.Itoa(modelCert.Id)
- this.Data["json"] = &errinfo
- this.ServeJSON()
- } else {
- errinfo.Message = "添加失败!" + utils.AlertProcess(err.Error())
- errinfo.Code = -1
- this.Data["json"] = &errinfo
- this.ServeJSON()
- }
- }
- // @Title 修改实体
- // @Description 修改实体
- // @Success 200 {object} controllers.Request
- // @router /update/:id/:type/:instyle [post]
- func (this *OilSupplierController) UpdateEntity() {
- id := this.Ctx.Input.Param(":id")
- typeCode := this.Ctx.Input.Param(":type")
- instyle := this.Ctx.Input.Param(":instyle")
- var errinfo ErrorInfo
- if id == "" {
- errinfo.Message = "操作失败!请求信息不完整"
- errinfo.Code = -2
- this.Data["json"] = &errinfo
- this.ServeJSON()
- return
- }
- var model supplier.OilSupplier
- var jsonBlob = this.Ctx.Input.RequestBody
- json.Unmarshal(jsonBlob, &model)
- var list []supplier.OilSupplierView
- service := supplier.GetOilSupplierService(utils.DBE)
- service.CheckUpdateRepeatApplyInfo(OilSupplierName, OilSupplierCertName, typeCode, strconv.Itoa(model.Id), model.SupplierName, model.CommercialNo, model.OrganCode, model.BankAccount, model.CompanyUrl, &list)
- if len(list) > 0 {
- errinfo.Message = "修改失败! 已存在相关企业的信息,或与其他企业信息重复"
- errinfo.Code = -1
- this.Data["json"] = &errinfo
- this.ServeJSON()
- return
- }
- svc := supplier.GetOilSupplierService(utils.DBE)
- model.ModifiedOn = time.Now()
- model.ModifiedBy = this.User.Realname
- model.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
- //判断基本信息是否可修改
- updateCols := svc.GetUpdateCols(OilSupplierCertName, typeCode, model.Id)
- err := svc.UpdateEntityBytbl(OilSupplierName, id, &model, updateCols)
- if err == nil {
- svc.DBE.Exec("update OilSupplierCert set Instyle="+instyle+" where SupplierId="+id+" and SupplierTypeCode="+typeCode+"")
- errinfo.Message = "修改成功!"
- errinfo.Code = 0
- this.Data["json"] = &errinfo
- this.ServeJSON()
- } else {
- errinfo.Message = "修改失败!" + utils.AlertProcess(err.Error())
- errinfo.Code = -1
- this.Data["json"] = &errinfo
- this.ServeJSON()
- }
- }
- // @Title 修改企业人员情况实体
- // @Description 修改实体
- // @Success 200 {object} controllers.Request
- // @router /updatenumber/:id [post]
- func (this *OilSupplierController) UpdateNumberEntity() {
- idGroup := this.Ctx.Input.Param(":id")
- //id := strings.Split(idGroup, "_")[0]
- certId := strings.Split(idGroup, "_")[1]
- var errinfo ErrorInfo
- if certId == "" {
- errinfo.Message = "操作失败!请求信息不完整"
- errinfo.Code = -2
- this.Data["json"] = &errinfo
- this.ServeJSON()
- return
- }
- var modelCert suppliercert.OilSupplierCert
- svcCert := suppliercert.GetOilSupplierCertService(utils.DBE)
- var jsonBlob = this.Ctx.Input.RequestBody
- json.Unmarshal(jsonBlob, &modelCert)
- modelCert.ModifiedOn = time.Now()
- modelCert.ModifiedBy = this.User.Realname
- modelCert.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
- colcerts := []string{
- "Id",
- "InStyle",
- "WorkerTotal",
- "ContractNum ",
- "UniversityNum",
- "TechnicalNum",
- "AboveProfNum",
- "MiddleProfNum",
- "NationalRegNum",
- "NationalCertTotal",
- "DesignerTotal",
- "SkillerTotal",
- "ModifiedOn",
- "ModifiedUserId",
- "ModifiedBy",
- }
- // if modelCert.Step <= 2 {
- // modelCert.Step = 2 //完成企业基本信息
- // colcerts = append(colcerts, "Step")
- // }
- err := svcCert.UpdateEntityBytbl(OilSupplierCertName, certId, &modelCert, colcerts)
- if err == nil {
- errinfo.Message = "保存成功!"
- errinfo.Code = 0
- this.Data["json"] = &errinfo
- this.ServeJSON()
- } else {
- errinfo.Message = "保存失败!" + utils.AlertProcess(err.Error())
- errinfo.Code = -1
- this.Data["json"] = &errinfo
- this.ServeJSON()
- }
- }
- // @Title 删除单条信息
- // @Description
- // @Success 200 {object} ErrorInfo
- // @Failure 403 :id 为空
- // @router /delete/:Id [delete]
- func (this *OilSupplierController) DeleteEntity() {
- Id := this.Ctx.Input.Param(":Id")
- var errinfo ErrorInfo
- if Id == "" {
- errinfo.Message = "操作失败!请求信息不完整"
- errinfo.Code = -2
- this.Data["json"] = &errinfo
- this.ServeJSON()
- return
- }
- var model supplier.OilSupplier
- var entityempty supplier.OilSupplier
- svc := supplier.GetOilSupplierService(utils.DBE)
- opdesc := "删除-" + Id
- err := svc.DeleteOperationAndWriteLogBytbl(OilSupplierName, BaseOperationLogName, Id, &model, &entityempty, utils.ToStr(this.User.Id), this.User.Username, opdesc, this.User.AccCode, "钻井日报")
- if err == nil {
- errinfo.Message = "删除成功"
- errinfo.Code = 0
- this.Data["json"] = &errinfo
- this.ServeJSON()
- } else {
- errinfo.Message = "删除失败!" + utils.AlertProcess(err.Error())
- errinfo.Code = -1
- this.Data["json"] = &errinfo
- this.ServeJSON()
- }
- }
- // @Title 删除单条信息
- // @Description
- // @Success 200 {object} ErrorInfo
- // @Failure 403 :id 为空
- // @router /deleteall/:Id/:SupplierTypeCode [delete]
- func (this *OilSupplierController) DeleteAllEntity() {
- Id := this.Ctx.Input.Param(":Id")
- SupplierTypeCode := this.Ctx.Input.Param(":SupplierTypeCode")
- var errinfo ErrorInfo
- if Id == "" {
- errinfo.Message = "操作失败!请求信息不完整"
- errinfo.Code = -2
- this.Data["json"] = &errinfo
- this.ServeJSON()
- return
- }
- svc := supplier.GetOilSupplierService(utils.DBE)
- err:=svc.DeleteEntityBytbl(OilSupplierCertName,"SupplierId="+Id+" and SupplierTypeCode='"+SupplierTypeCode+"'")
- err =svc.DeleteEntityBytbl(OilSupplierCert2FileName,"SupplierId="+Id+" and SupplierTypeCode='"+SupplierTypeCode+"'")
- err =svc.DeleteEntityBytbl(OilSupplierFileName,"SupplierId="+Id+" and SupplierTypeCode='"+SupplierTypeCode+"'")
- var model1 suppliercertsub.OilSupplierCert2File
- count1, _ := svc.GetCount(&model1, "SupplierId="+Id)
- if count1==0{
- err=svc.DeleteEntityBytbl(OilSupplierFileName,"SupplierId="+Id)
- }
- var model2 suppliercert.OilSupplierCert
- count2, _ := svc.GetCount(&model2, "SupplierId="+Id)
- if count2==0{
- err=svc.DeleteEntityBytbl(OilSupplierName,"Id="+Id)
- }
- if err == nil {
- errinfo.Message = "删除成功"
- errinfo.Code = 0
- this.Data["json"] = &errinfo
- this.ServeJSON()
- } else {
- errinfo.Message = "删除失败!" + utils.AlertProcess(err.Error())
- errinfo.Code = -1
- this.Data["json"] = &errinfo
- this.ServeJSON()
- }
- }
- // @Title 判断是否可以申请准入
- // @Description
- // @Success 200 {string} Count
- // @Failure 403 :id 为空
- // @router /iscanapply/:type [get]
- func (this *OilSupplierController) IsCanApply() {
- Type := this.Ctx.Input.Param(":type")
- var errinfo ErrorInfo
- if Type == "" {
- errinfo.Message = "操作失败!请求信息不完整"
- errinfo.Code = -2
- this.Data["json"] = &errinfo
- this.ServeJSON()
- return
- }
- svc := suppliercert.GetOilSupplierCertService(utils.DBE)
- var registerUser register.OilCorporateInfo
- sql := " UserName='" + this.User.Username + "'"
- svc.GetEntity(®isterUser,sql)
- canApply := svc.IsCanApplyByExtOrganizeUser(Type, registerUser.CommercialNo, this.User.Id, this.User.IsCompanyUser)
- if canApply {
- errinfo.Message = "无申请记录,可以申请"
- errinfo.Code = 0
- this.Data["json"] = &errinfo
- this.ServeJSON()
- } else {
- errinfo.Message = "供方用户只能申请一次"
- errinfo.Code = -1
- this.Data["json"] = &errinfo
- this.ServeJSON()
- }
- }
- // @Title 判断是否可以修改供方企业信息
- // @Description
- // @Success 200 {string} Count
- // @Failure 403 :id 为空
- // @router /iscanupdatesupplier/:supplierid [get]
- func (this *OilSupplierController) CanUpdateSupplier() {
- supplierId := this.Ctx.Input.Param(":supplierid")
- var errinfo ErrorInfo
- if supplierId == "" {
- errinfo.Message = "操作失败!请求信息不完整"
- errinfo.Code = -2
- this.Data["json"] = &errinfo
- this.ServeJSON()
- return
- }
- Id, _ := strconv.Atoi(supplierId)
- svc := supplier.GetOilSupplierService(utils.DBE)
- canUpdate := svc.CanUpdateSupplier(OilSupplierCertName, Id)
- if canUpdate {
- errinfo.Message = "可以修改"
- errinfo.Code = 0
- this.Data["json"] = &errinfo
- this.ServeJSON()
- } else {
- errinfo.Message = "此供方已经提交准入申请,不可修改"
- errinfo.Code = -1
- this.Data["json"] = &errinfo
- this.ServeJSON()
- }
- }
- // @Title 获取二级审核人员
- // @Description 获取二级审核人员
- // @router /getauditerbydept/:deptId [get]
- func (this *OilSupplierController) GetAuditerByDept() {
- Id := this.Ctx.Input.Param(":deptId")
- auditstepcode := this.GetString("auditstepcode")
- svc := organize.GetOrganizeService(utils.DBE)
- unitId := svc.GetMyUnitDepartmentId(Id)
- //ids := svc.GetAllChildById(unitId)
- //
- //certSrv := suppliercert.GetOilSupplierCertService(utils.DBE)
- //var users []userRole.Base_RoleList
- //certSrv.GetAuditUser(ids, auditstepcode, &users)
- var userlist []userRole.Base_User
- var setting auditsetting.Base_OilAuditSetting
- usvc := userRole.GetUserService(utils.DBE)
- where := "AuditStepCode='" + auditstepcode + "'"
- svc.GetEntity(&setting, where)
- ids := usvc.GetUserIdsByRoleId(strconv.Itoa(setting.RoleId))
- tempstr := strings.Join(ids, ",")
- userIds := strings.Replace(tempstr, "uid_", "", -1)
- userIds = strings.Trim(userIds, ",")
- if userIds != "" {
- where := "Id in (" + userIds + ")" + " and UnitId=" + unitId
- svc.GetEntities(&userlist, where)
- }
- var datainfo ErrorDataInfo
- datainfo.Item = userlist
- this.Data["json"] = &datainfo
- this.ServeJSON()
- }
- // @Title 获取二级初审人员
- // @Description 获取二级初审人员
- // @router /getfirauditerbydept/:deptId [get]
- func (this *OilSupplierController) GetFirAuditerByDept() {
- Id := this.Ctx.Input.Param(":deptId")
- auditstepcode := this.GetString("auditstepcode")
- var userlist []userRole.Base_User
- var setting auditsetting.Base_OilAuditSetting
- svc := userRole.GetUserService(utils.DBE)
- where := "AuditStepCode='" + auditstepcode + "'"
- svc.GetEntity(&setting, where)
- ids := svc.GetUserIdsByRoleId(strconv.Itoa(setting.RoleId))
- tempstr := strings.Join(ids, ",")
- userIds := strings.Replace(tempstr, "uid_", "", -1)
- userIds = strings.Trim(userIds, ",")
- if userIds != "" {
- where := "Id in (" + userIds + ")" + "and UnitId=" + Id
- svc.GetEntities(&userlist, where)
- }
- //svc := organize.GetOrganizeService(utils.DBE)
- //
- //ids := svc.GetAllChildById(Id)
- //
- //certSrv := suppliercert.GetOilSupplierCertService(utils.DBE)
- //var users []userRole.Base_RoleList
- //certSrv.GetAuditUser(ids, auditstepcode, &users)
- var datainfo ErrorDataInfo
- datainfo.Item = userlist
- this.Data["json"] = &datainfo
- this.ServeJSON()
- }
- // @Title 获取二级复审人员根据初审人员
- // @Description 获取二级复审人员根据初审人员
- // @router /getauditerbyfirst/:firstId [get]
- func (this *OilSupplierController) GetAuditerByFist() {
- Id := this.Ctx.Input.Param(":firstId")
- auditstepcode := this.GetString("auditstepcode")
- certSrv := suppliercert.GetOilSupplierCertService(utils.DBE)
- //orgSrv := organize.GetOrganizeService(utils.DBE)
- var userentity userRole.Base_User
- certSrv.GetEntityById(Id, &userentity)
- var userlist []userRole.Base_User
- var setting auditsetting.Base_OilAuditSetting
- svc := userRole.GetUserService(utils.DBE)
- where := "AuditStepCode='" + auditstepcode + "'"
- svc.GetEntity(&setting, where)
- ids := svc.GetUserIdsByRoleId(strconv.Itoa(setting.RoleId))
- tempstr := strings.Join(ids, ",")
- userIds := strings.Replace(tempstr, "uid_", "", -1)
- userIds = strings.Trim(userIds, ",")
- if userIds != "" {
- where := "Id in (" + userIds + ")" + "and UnitId=" + strconv.Itoa(userentity.UnitId)
- svc.GetEntities(&userlist, where)
- }
- //svc := organize.GetOrganizeService(utils.DBE)
- //unitId := svc.GetMyUnitDepartmentId(userentity.Departmentid)
- //ids := svc.GetAllChildById(unitId)
- ////depId := strings.Split(userentity.Superior,",")
- //var users []userRole.Base_RoleList
- //certSrv.GetAuditUser(ids, auditstepcode, &users)
- var datainfo ErrorDataInfo
- datainfo.Item = userlist
- this.Data["json"] = &datainfo
- this.ServeJSON()
- }
- // @Title 获取二级初审人员(不需要验证登录)
- // @Description 获取二级初审人员(不需要验证登录)
- // @router /getauditerbydeptandnologin [get]
- func (this *OilSupplierController) GetAuditerByDeptAndNoLogin() {
- Id := this.GetString("deptId")
- auditstepcode := this.GetString("auditstepcode")
- var userlist []userRole.Base_User
- var setting auditsetting.Base_OilAuditSetting
- svc := userRole.GetUserService(utils.DBE)
- where := "AuditStepCode='" + auditstepcode + "'"
- svc.GetEntity(&setting, where)
- ids := svc.GetUserIdsByRoleId(strconv.Itoa(setting.RoleId))
- tempstr := strings.Join(ids, ",")
- userIds := strings.Replace(tempstr, "uid_", "", -1)
- userIds = strings.Trim(userIds, ",")
- if userIds != "" {
- where := "Id in (" + userIds + ")" + "and UnitId=" + Id
- svc.GetEntities(&userlist, where)
- }
- //certSrv := suppliercert.GetOilSupplierCertService(utils.DBE)
- //var users []userRole.Base_RoleList
- //certSrv.GetAuditUser(Id, auditstepcode, &users)
- // certSrv.GetAuditUserByNoLogin(Id, &users)
- var datainfo ErrorDataInfo
- datainfo.Item = userlist
- this.Data["json"] = &datainfo
- this.ServeJSON()
- }
- // @Title
- // @Description
- // @router /getjurisdiction [get]
- func (this *OilSupplierController) GetJurisdiction() {
- svcPerm := permission.GetPermissionService(utils.DBE)
- isauth := svcPerm.IsAuthorized(this.User.Id, "oil_delete")
- var datainfo ErrorDataInfo
- datainfo.Item = isauth
- this.Data["json"] = &datainfo
- this.ServeJSON()
- }
|