| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615 |
- package oilsupplier
- import (
- "dashoo.cn/backend/api/business/oilsupplier/annualaudit"
- BlackList "dashoo.cn/backend/api/business/oilsupplier/blacklist"
- "dashoo.cn/backend/api/business/oilsupplier/qualchange"
- "dashoo.cn/backend/api/business/oilsupplier/suppliercertappendsub"
- "dashoo.cn/backend/api/business/oilsupplier/suppliercertsub"
- "dashoo.cn/backend/api/business/oilsupplier/supplierfile"
- "dashoo.cn/backend/api/business/oilsupplier/supplierscenefile"
- "dashoo.cn/backend/api/business/oilsupplier/tableheader"
- "dashoo.cn/backend/api/business/register"
- "dashoo.cn/business3/parameter"
- "encoding/json"
- "fmt"
- . "github.com/linxGnu/goseaweedfs"
- "github.com/tealeg/xlsx"
- "log"
- "os"
- "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")
- //where = where + " and b.InFlag != '4'"
- 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 + "' and CheckStatus = 11"
- 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")
- RecUnitName := this.GetString("RecUnitName")
- RecUnitId := this.GetString("RecUnitId")
- ThirdAudit := this.GetString("ThirdAudit")
- 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 + "%'"
- }
- if RecUnitName != "" {
- where = where + " and b.RecUnitName like '%" + RecUnitName + "%'"
- }
- if RecUnitId != "" {
- where = where + " and b.RecUnitId = '" + RecUnitId + "' "
- }
- if ThirdAudit != "" {
- where = where + " and b.ThirdAudit = '" + ThirdAudit + "' "
- }
- 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_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 + "'"
- }
- }
- }
- svc := supplier.GetOilSupplierService(utils.DBE)
- var list []supplier.OilSupplierView1
- //total := svc.GetMyPagingEntitiesWithOrderBytbl(OilSupplierName, OilSupplierCertName, page.CurrentPage, page.Size, orderby, asc, &list, where)
- total := svc.GetMyPagingEntitiesWithOrderBytbl3(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 /jzpsListExport [get]
- func (this *OilSupplierController) JzpsListExport() {
- where := " 1=1 "
- 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")
- RecUnitName := this.GetString("RecUnitName")
- RecUnitId := this.GetString("RecUnitId")
- ThirdAudit := this.GetString("ThirdAudit")
- 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 + "%'"
- }
- if RecUnitName != "" {
- where = where + " and b.RecUnitName like '%" + RecUnitName + "%'"
- }
- if RecUnitId != "" {
- where = where + " and b.RecUnitId = '" + RecUnitId + "' "
- }
- if ThirdAudit != "" {
- where = where + " and b.ThirdAudit = '" + ThirdAudit + "' "
- }
- 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_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 + "'"
- }
- }
- }
- svc := supplier.GetOilSupplierService(utils.DBE)
- var list []supplier.OilSupplierExport
- svc.GetMyPagingEntitiesWithOrderBytblExport(OilSupplierName, OilSupplierCertName, &list, where)
- fileTitle := "集中评审"
- showColumnArr := "序号,审核状态,企业名称,准入类别,审核处室,推荐单位,法人,工商注册号,注册资本,币种,公司类型,成立时间,手机号,准入范围"
- f := xlsx.NewFile()
- sheet, _ := f.AddSheet(fileTitle)
- cellName := strings.Split(showColumnArr, ",")
- row := sheet.AddRow()
- row.WriteSlice(&cellName, -1)
- for idx, item := range list {
- var certSubList []suppliercertsub.OilSupplierCertSub
- svc.GetEntitysByWhere(OilSupplierCertSubName, "SupplierCertId = "+strconv.Itoa(item.CertId), &certSubList)
- subName := ""
- for _, certSub := range certSubList {
- subName += "," + certSub.Name
- }
- regCapital := strconv.FormatFloat(item.RegCapital, 'f', 2, 64)
- currency := "人民币"
- if item.Currency == "人民币元" {
- currency = "人民币"
- }
- if item.Currency == "JPY" {
- currency = "日元"
- }
- if item.Currency == "USD" {
- currency = "美元"
- }
- if item.Currency == "EUR" {
- currency = "欧元"
- }
- dataString := strconv.Itoa(idx+1) + "+待集中评审+" + item.SupplierName + "+" + item.SupplierTypeName + "+" + item.FullName + "+" + item.RecUnitName + "+" + item.LegalPerson + "+" + item.CommercialNo + "+" +
- regCapital + "+" + currency + "+" + item.CompanyType + "+" + utils.ToStr(item.SetupTime.Format("2006-01-02")) + "+" + item.Mobile + "+" + strings.TrimLeft(subName, ",")
- cellName := strings.Split(dataString, "+")
- row := sheet.AddRow()
- row.WriteSlice(&cellName, -1)
- }
- for c, cl := 0, len(sheet.Cols); c < cl; c++ {
- sheet.Cols[c].Width = 30
- }
- dir := "static/file/excel/report/" + this.GetAccode()
- SaveDirectory(dir)
- path := dir + "/" + utils.TimeFormat(time.Now(), "20060102") + fileTitle + ".xlsx"
- f.Save(path)
- var sw *Seaweed
- var filer []string
- if _filer := os.Getenv("GOSWFS_FILER_URL"); _filer != "" {
- filer = []string{_filer}
- }
- sw = NewSeaweed("http", utils.Cfg.MustValue("file", "upFileHost"), filer, 2*1024*1024, 5*time.Minute)
- _, _, fID, _ := sw.UploadFile(path, "", "")
- retDocUrl := utils.Cfg.MustValue("file", "downFileHost") + "/" + fID
- os.Remove(path)
- fmt.Println("==retDocWatermarkUrl==", retDocUrl)
- this.Data["json"] = retDocUrl
- 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")
- Grade := this.GetString("Grade")
- 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")
- Code := this.GetString("Code")
- InFlag := this.GetString("InFlag")
- if SupplierName != "" {
- where = where + " and a.SupplierName like '%" + SupplierName + "%'"
- }
- if Grade != "" {
- where = where + " and a.Grade = '" + Grade + "'"
- }
- 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 InFlag != "" {
- where = where + " and b.InFlag='" + InFlag + "'"
- }
- //企业用户只看自己的数据记录
- /*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
- var Ids supplier.OilCertIds
- if Code != "" {
- where1 := " SupplierTypeCode = '" + SupplierTypeCode + "' and Code like '" + Code + "%'"
- svc.GetCertIds(&Ids, where1)
- }
- total := svc.GetMyPagingEntitiesWithOrderBytbl2(OilSupplierName, OilSupplierCertName, page.CurrentPage, page.Size, orderby, asc, &list, where, Code, Ids.Ids)
- 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
- str := actisvc.GetMyTasks(workflow.OIL_ENUSER_SUPPLIER_APPLY, this.User.Id)
- if str != "" {
- certIdList = str
- certIdList = certIdList + ","
- }
- 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 ysname string
- paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
- ysname = paramSvc.GetBaseparameterMessage("", "paramset", "YaSuoBao")
- dictList["YaSuoName"] = ysname
- //获取我创建的所有公司
- 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 allBusDeptList []organize.Base_Organize
- //where = "Category='Unit' and ParentId in (100000001, 100000128)"
- //00097005 直属机构 00265300 公司机关 00097004 机关附属机构
- //where = "Category='Unit' and OuterPhone in (00097005,00265300,00097004)"
- whereBus := "(Category='Unit' and ParentId in (100000009, 100000004))"
- orgsvc.GetEntities(&allBusDeptList, whereBus)
- dictList["AllBusDeptList"] = allBusDeptList
- 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")
- addId := this.GetString("addId")
- isTecContract := this.GetString("isTecContract")
- 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 Id not in (100000004,100000003,100000002) "
- //where := "Category='Unit'and Id not in (100000880,100000201) "
- where := "Category='Unit'"
- 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' and ParentId in (100000001, 100000128)"
- //00097005 直属机构 00265300 公司机关 00097004 机关附属机构
- //where = "Category='Unit' and OuterPhone in (00097005,00265300,00097004)"
- where = "(Category='Unit' and ParentId in (100000009, 100000004))"
- if isTecContract == "1" {
- where += " or Id = 100000656"
- }
- orgsvc.GetEntities(&allunitorglist, where)
- dictList["Allunitorglist"] = allunitorglist
- // 管理单位
- var suppliermode supplier.OilSupplier
- orgsvc.GetEntityById(addId, &suppliermode)
- if suppliermode.MgrUnit == supplier.MGRUNIT {
- dictList["MgrUnit"] = true
- } else {
- dictList["MgrUnit"] = false
- }
- //是否需要现场考察报告
- paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
- isInvestigate := paramSvc.GetBaseparameterMessage("GFGL1", "paramset", "isInvestigate")
- dictList["isInvestigate"] = isInvestigate
- 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.InFlag, b.ApplyTime,
- b.MiddleProfNum, b.NationalRegNum, b.NationalCertTotal, b.DesignerTotal, b.SkillerTotal, b.InStyle, b.WorkflowId, b.Status, b.ThirdAudit, b.BusinessKey, b.AuditIndex ,b.ProcessKey, b.IsRestrict, a.Remark as Remark, b.Remark as Remark1 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 datainfo ErrorDataInfo
- var sqlsus string
- sqlsus = `select 1 from ` + OilSupplierName + ` a `
- sqlsus += ` left join ` + OilSupplierCertName + ` b on b.SupplierId = a.Id`
- sqlsus += ` where a.SupplierName ='` + name + `' and b.InFlag='2' and b.SupplierTypeCode='` + typecode + `'`
- var tempMap []map[string]string
- tempMap, _ = svc.DBE.QueryString(sqlsus)
- if tempMap != nil && tempMap[0]["1"] != "" {
- datainfo.Code = -1
- this.Data["json"] = &datainfo
- this.ServeJSON()
- } else {
- 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+"' and CheckStatus='11'", &model2)
- model2.Remark = ""
- model2.Id = 0
- if model2.SupplierName == "" {
- datainfo.Code = -2
- this.Data["json"] = &datainfo
- this.ServeJSON()
- } else {
- datainfo.Code = 0
- datainfo.Item = model2
- this.Data["json"] = &datainfo
- this.ServeJSON()
- }
- } else {
- datainfo.Code = 0
- datainfo.Item = model
- this.Data["json"] = &datainfo
- this.ServeJSON()
- }
- }
- }
- // @Title 获取实体
- // @Description 判断统一社会码
- // @Success 200 {object} supplier.OilSupplier
- // @router /getbycomminercialno/commercialNo [get]
- func (this *OilSupplierController) GetEntityComminercialNo() {
- commercialNo := this.Ctx.Input.Param(":commercialNo")
- svc := supplier.GetOilSupplierService(utils.DBE)
- var dataInfo ErrorDataInfo
- var sqlSus string
- sqlSus = "select Id from OilSupplier where CommercialNo= '" + commercialNo + "'"
- var tempMap []map[string]string
- tempMap, _ = svc.DBE.QueryString(sqlSus)
- if tempMap != nil && tempMap[0]["Id"] != "" {
- dataInfo.Code = 1
- this.Data["json"] = &dataInfo
- this.ServeJSON()
- } else {
- dataInfo.Code = 0
- this.Data["json"] = &dataInfo
- 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)
- var registerUser register.OilCorporateInfo
- sql := " UserName='" + this.User.Username + "' and CheckStatus = 11"
- serviceCert.GetEntity(®isterUser, sql)
- canApply := serviceCert.IsCanApplyByExtOrganizeUser(modelCertVM.SupplierTypeCode, registerUser.CommercialNo, this.User.Id, this.User.IsCompanyUser)
- var errinfo ErrorDataInfo
- if !canApply {
- errinfo.Message = "添加失败!供方用户只能申请一次"
- errinfo.Code = -1
- this.Data["json"] = &errinfo
- this.ServeJSON()
- return
- }
- //判断在黑名单的不能申请准入
- var black BlackList.BlackList
- serviceCert.GetEntityByWhere("BlackList", "CommercialNo = '"+model.CommercialNo+"'", &black)
- if black.Id > 0 {
- 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
- if modelCert.InStyle == suppliercert.PINGSHEN {
- modelCert.IsPay = 0
- } else {
- modelCert.IsPay = 2
- }
- modelCert.Step = 1 //企业信息保存完成
- modelCert.CreateOn = time.Now()
- modelCert.CreateBy = this.User.Realname
- modelCert.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
- // 保存推荐单位
- if this.User.IsCompanyUser == 1 {
- modelCert.RecUnitId = strconv.Itoa(registerUser.CheckUnitId)
- modelCert.RecUnitName = registerUser.CheckUnitName
- modelCert.RecUnitPerson = registerUser.ModifiedBy
- } else {
- modelCert.RecUnitId = strconv.Itoa(this.User.UnitId)
- modelCert.RecUnitName = this.User.Unit
- modelCert.RecUnitPerson = this.User.Realname
- }
- _, 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()
- // 获取原本的工商注册号
- var oldModel supplier.OilSupplier
- svc.GetEntityById(model.Id, &oldModel)
- if oldModel.SupplierName != model.SupplierName || oldModel.CommercialNo != model.CommercialNo {
- cols := []string{"CommercialNo", "SupplierName"}
- var info register.OilCorporateInfo
- where1 := "CommercialNo = '" + oldModel.CommercialNo + "'"
- svc.GetEntityByWhere(OilCorporateInfoName, where1, &info)
- info.CommercialNo = model.CommercialNo
- info.SupplierName = model.SupplierName
- err1 := svc.UpdateEntityBywheretbl(OilCorporateInfoName, &info, cols, where1)
- if err1 == nil {
- var user userRole.Base_User
- user.Realname = model.SupplierName
- svc.UpdateEntityBywheretbl("Base_User", &user, []string{"Realname"}, "Id = "+strconv.Itoa(info.UserId))
- }
- }
- svc1 := suppliercert.GetOilSupplierCertService(utils.DBE)
- var cert suppliercert.OilSupplierCert
- svc1.GetEntityByWhere(OilSupplierCertName, "SupplierId = "+id+" and SupplierTypeCode='"+typeCode+"'", &cert)
- //对资质的检查
- //svc1.IsSupplierCertCanSubmit(strconv.Itoa(model.Id), strconv.Itoa(cert.Id))
- //判断基本信息是否可修改
- updateCols := svc.GetUpdateCols(OilSupplierCertName, typeCode, model.Id)
- err := svc.UpdateEntityBytbl(OilSupplierName, id, &model, updateCols)
- //isPay := "0"
- //if instyle == suppliercert.PINGSHEN {
- // isPay = "0"
- //} else {
- // isPay = "2"
- //}
- if err == nil {
- svc.DBE.Exec("update OilSupplierCert set InStyle='" + instyle + "' where SupplierId=" + id + " and SupplierTypeCode='" + typeCode + "'") // "', IsPay= " + isPay +
- //一级变二级删除一级准入范围
- if model.Grade == "2" {
- svc.DeleteEntityBytbl(OilSupplierCertSubName, "SupplierTypeCode = '01' and GoodsLevel = '1' and SupplierId = "+id)
- }
- 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 /update1/:id/:type/:instyle/:certId [post]
- func (this *OilSupplierController) UpdateEntity1() {
- id := this.Ctx.Input.Param(":id")
- typeCode := this.Ctx.Input.Param(":type")
- instyle := this.Ctx.Input.Param(":instyle")
- certId := this.Ctx.Input.Param(":certId")
- var errinfo ErrorInfo
- if id == "" {
- errinfo.Message = "操作失败!请求信息不完整"
- errinfo.Code = -2
- this.Data["json"] = &errinfo
- this.ServeJSON()
- return
- }
- var model supplier.OilSupplier
- var model1 supplier.OilSupplierView
- var jsonBlob = this.Ctx.Input.RequestBody
- json.Unmarshal(jsonBlob, &model)
- json.Unmarshal(jsonBlob, &model1)
- model1.Remark = model1.Remark1
- 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()
- // 获取原本的工商注册号
- var oldModel supplier.OilSupplier
- svc.GetEntityById(model.Id, &oldModel)
- if oldModel.SupplierName != model.SupplierName || oldModel.CommercialNo != model.CommercialNo {
- cols := []string{"CommercialNo", "SupplierName"}
- var info register.OilCorporateInfo
- where1 := "CommercialNo = '" + oldModel.CommercialNo + "'"
- svc.GetEntityByWhere(OilCorporateInfoName, where1, &info)
- info.CommercialNo = model.CommercialNo
- info.SupplierName = model.SupplierName
- err1 := svc.UpdateEntityBywheretbl(OilCorporateInfoName, &info, cols, where1)
- if err1 == nil {
- var user userRole.Base_User
- user.Realname = model.SupplierName
- svc.UpdateEntityBywheretbl("Base_User", &user, []string{"Realname"}, "Id = "+strconv.Itoa(info.UserId))
- }
- }
- svc1 := suppliercert.GetOilSupplierCertService(utils.DBE)
- var cert suppliercert.OilSupplierCert
- svc1.GetEntityByWhere(OilSupplierCertName, "SupplierId = "+id+" and SupplierTypeCode='"+typeCode+"'", &cert)
- //对资质的检查
- //svc1.IsSupplierCertCanSubmit(strconv.Itoa(model.Id), strconv.Itoa(cert.Id))
- //判断基本信息是否可修改
- updateCols := svc.GetUpdateCols(OilSupplierCertName, typeCode, model.Id)
- err := svc.UpdateEntityBytbl(OilSupplierName, id, &model, updateCols)
- //isPay := "0"
- //if instyle == suppliercert.PINGSHEN {
- // isPay = "0"
- //} else {
- // isPay = "2"
- //}
- if err == nil {
- svc.UpdateEntityBytbl(OilSupplierCertName, certId, &model1, []string{"Remark"})
- svc.DBE.Exec("update OilSupplierCert set InStyle='" + instyle + "' where SupplierId=" + id + " and SupplierTypeCode='" + typeCode + "'") // "', IsPay= " + isPay +
- //一级变二级删除一级准入范围
- if model.Grade == "2" {
- svc.DeleteEntityBytbl(OilSupplierCertSubName, "SupplierTypeCode = '01' and GoodsLevel = '1' and SupplierId = "+id)
- }
- 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",
- "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)
- deleteWhere := "SupplierId=" + Id + " and SupplierTypeCode='" + SupplierTypeCode + "'"
- err := svc.DeleteEntityBytbl(OilSupplierCertSubName, deleteWhere)
- err = svc.DeleteEntityBytbl(OilSupplierFileName, deleteWhere)
- var modelList []suppliercert.OilSupplierCert
- svc.GetEntityByWhere(OilSupplierCertName, deleteWhere, &modelList)
- // 删除工作流
- activitiService := workflow.GetActivitiService(utils.DBE)
- var deleteProcessVM workflow.DeleteProcessVM
- for _, supplierCertItem := range modelList {
- // 按条件查询,正常情况下只有一条
- if supplierCertItem.WorkflowId != "" && supplierCertItem.WorkflowId != "0" {
- deleteProcessVM.ProcessInstanceId = supplierCertItem.WorkflowId
- deleteProcessVM.DeleteReason = "审批未通过,删除"
- activitiService.DeleteComplete(deleteProcessVM)
- }
- }
- // 删除SupplierCert表
- err = svc.DeleteEntityBytbl(OilSupplierCertName, deleteWhere)
- /* 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 + "' and CheckStatus = 11"
- svc.GetEntity(®isterUser, sql)
- canApply := svc.IsCanApplyByExtOrganizeUser(Type, registerUser.CommercialNo, this.User.Id, this.User.IsCompanyUser)
- if canApply {
- //判断是否是暂停
- if this.User.IsCompanyUser == 1 {
- var tempMap []map[string]string
- sql := "select 1 from OilSupplier a left join OilSupplierCert b on a.Id=b.SupplierId where (b.CreateUserId = '" + this.User.Id + "' or a.CommercialNo='" + registerUser.CommercialNo + "') and b.InFlag='2' and b.SupplierTypeCode='" + Type + "'"
- tempMap, _ = svc.DBE.QueryString(sql)
- if tempMap != nil && tempMap[0]["1"] != "" {
- errinfo.Message = "已暂停,不可申请"
- errinfo.Code = -2
- this.Data["json"] = &errinfo
- this.ServeJSON()
- } else {
- errinfo.Message = "无申请记录,可以申请"
- errinfo.Code = 0
- this.Data["json"] = &errinfo
- this.ServeJSON()
- }
- } else {
- 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/:typecode [get]
- func (this *OilSupplierController) CanUpdateSupplier() {
- supplierId := this.Ctx.Input.Param(":supplierid")
- typeCode := this.Ctx.Input.Param(":typecode")
- 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, typeCode) // 区分物资类01 基建类02 服务类03
- 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)
- svcdepartment := organize.GetOrganizeService(utils.DBE)
- unitId := svcdepartment.GetMyUnitDepartmentId(this.User.DepartmentId)
- alldep := svcdepartment.GetAllChildById(unitId)
- ids := svc.GetUserIdsByRoleId(strconv.Itoa(setting.RoleId))
- tempstr := strings.Join(ids, ",")
- userIds := strings.Replace(tempstr, "uid_", "", -1)
- userIds = strings.Trim(userIds, ",")
- if userIds != "" {
- // 企管法规处
- if unitId == "100000650" {
- where := "Id in (" + userIds + ")"
- svc.GetEntities(&userlist, where)
- } else {
- where := "Id in (" + userIds + ")" + "and (UnitId=" + Id + " or Departmentid in (" + alldep + ")) "
- 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()
- }
- // @Title 获取列表
- // @Description get user by token
- // @Success 200 {object} []supplier.OilSupplier
- // @router /certlistinterface [get]
- func (this *OilSupplierController) GetEntityListInterface() {
- //获取分页信息
- //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
- // }
- //}
- status := this.GetString("status")
- if status == "1" {
- where += "b.InStyle='1'"
- } else if status == "2" {
- where += "b.InStyle='4'"
- } else if status == "3" {
- where += "b.InStyle='5'"
- } else if status == "4" {
- where += "b.InStyle=''"
- } else if status == "5" {
- where += "b.InStyle=''"
- }
- svc := supplier.GetOilSupplierService(utils.DBE)
- var interfaceData []supplier.InterfaceData
- err := svc.GetInterfaceData(OilSupplierName, OilSupplierFileName, &interfaceData, where)
- var errinfo ErrorDataInfo
- if err == nil {
- errinfo.Message = "成功!"
- errinfo.Code = 0
- errinfo.Item = &interfaceData
- this.Data["json"] = &errinfo
- this.ServeJSON()
- } else {
- errinfo.Message = "失败!"
- errinfo.Code = -1
- this.Data["json"] = &errinfo
- this.ServeJSON()
- }
- }
- // @Title 获取实体
- // @Description 获取实体
- // @Success 200 {object} supplier.OilSupplier
- // @router /getentitybycommercialno/:commercialNo [get]
- func (this *OilSupplierController) GetEntityByCommercialNo() {
- commercialNo := this.Ctx.Input.Param(":commercialNo")
- where := "CommercialNo = '" + commercialNo + "'"
- var model supplier.OilSupplier
- svc := supplier.GetOilSupplierService(utils.DBE)
- svc.GetEntityByWhere(OilSupplierName, where, &model)
- this.Data["json"] = &model
- this.ServeJSON()
- }
- // @Title 更新文件上传
- // @Description 更新文件上传
- // @Param id path string true
- // @Success 200 {object}
- // @router /editsubfile/:id [put]
- func (this *OilSupplierController) EditSubfile() {
- 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 supplierscenefile.OilSupplierSceneFile
- var jsonblob = this.Ctx.Input.RequestBody
- json.Unmarshal(jsonblob, &model)
- svc := supplierscenefile.GetSupplierScenefileService(utils.DBE)
- model.FileUrl = strings.Trim(model.FileUrl, "$")
- model.FileName = strings.Trim(model.FileName, "$")
- model.CreateOn = time.Now()
- model.CreateBy = this.User.Realname
- model.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
- where := "SupplierId=" + id
- svc.DeleteEntityBytbl(OilSupplierSceneFileName, where)
- _, err := svc.InsertEntity(&model)
- 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 更新文件上传copy
- // @Param id path string true
- // @Success 200 {object}
- // @router /editsubfilecopy/:id [put]
- func (this *OilSupplierController) EditSubfileCopy() {
- 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 supplierscenefile.OilSupplierSceneFile
- var jsonblob = this.Ctx.Input.RequestBody
- json.Unmarshal(jsonblob, &model)
- svc := supplierscenefile.GetSupplierScenefileService(utils.DBE)
- model.FileUrl = strings.Trim(model.FileUrl, "$")
- model.FileName = strings.Trim(model.FileName, "$")
- model.CreateOn = time.Now()
- model.CreateBy = this.User.Realname
- model.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
- _, err := svc.InsertEntity(&model)
- 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 /editsubfiledelete/:Id [delete]
- func (this *OilSupplierController) EditSubfileDelete() {
- 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 supplierscenefile.OilSupplierSceneFile
- var model1 supplierscenefile.OilSupplierSceneFile
- svc := supplierscenefile.GetSupplierScenefileService(utils.DBE)
- opdesc := "删除-" + Id
- err := svc.DeleteOperationAndWriteLogBytbl(OilSupplierSceneFileName, BaseOperationLogName, Id, &model, &model1, 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 get 导入excel
- // @Description get SampleType by token
- // @Success 200 {object} sampletype.SampleType
- // @router /importexcel [get]
- func (this *OilSupplierController) ImportExcel() {
- url := this.GetString("ExcelUrl")
- var errorinfo ErrorInfo
- if url == "" {
- errorinfo.Code = -2
- errorinfo.Message = "导入失败!"
- this.Data["json"] = &errorinfo
- this.ServeJSON()
- }
- svc := supplier.GetOilSupplierService(utils.DBE)
- log.Printf("url:==" + url) // http://60.30.245.229//upfile/dc1/2,063156edd288
- extranetIP := utils.Cfg.MustValue("server", "extranetIP")
- localIP := utils.Cfg.MustValue("server", "localIP")
- if strings.Index(url, extranetIP) >= 0 {
- url = strings.Replace(url, extranetIP, localIP, 1)
- }
- _dir := utils.Cfg.MustValue("file", "tmplateDir") + "xlsx"
- filename := strconv.Itoa(int(time.Now().Unix())) + ".xlsx"
- url = strings.Replace(url, "60.30.245.229", "10.76.248.23", -1)
- utils.DownloadFile(url, filename, _dir)
- t := time.Now()
- filePath := utils.Cfg.MustValue("file", "tmplateDir") + "xlsx/" + filename
- xlFile, err := xlsx.OpenFile(filePath)
- //excelFileName := "F:/物资类项目与资质对照表-2017.xlsx"
- if err != nil {
- fmt.Printf("open failed: %s\n", err)
- }
- var sheet = xlFile.Sheets[0]
- var errLineNum string
- for i := 1; i < len(sheet.Rows); i++ {
- lineNo := strconv.Itoa(i + 1)
- if len(sheet.Rows[i].Cells) != 0 {
- this.OperationCell(svc, lineNo, sheet.Rows[i].Cells, &errLineNum)
- }
- }
- os.Remove(filePath)
- if errLineNum != "" {
- errorinfo.Code = -1
- errorinfo.Message = "导入失败!错误行号:" + errLineNum
- this.Data["json"] = &errorinfo
- this.ServeJSON()
- } else {
- elapsed := time.Since(t)
- log.Println(elapsed)
- errorinfo.Code = 0
- errorinfo.Message = "导入成功!"
- this.Data["json"] = &errorinfo
- this.ServeJSON()
- }
- }
- func (this *OilSupplierController) OperationCell(svc *supplier.OilSupplierService, lineNo string, cellsArr []*xlsx.Cell, errLineNum *string) {
- defer func() {
- if err := recover(); err != nil {
- log.Println("err"+lineNo, err)
- *errLineNum += lineNo + ","
- }
- }()
- cells := cellsArr
- supplierName := strings.TrimSpace(cells[0].Value)
- oilCertificateNo := ""
- if len(cells) >= 2 {
- oilCertificateNo = strings.TrimSpace(cells[1].Value)
- }
- cols := []string{"PACNumber"}
- var entity supplier.OilSupplier
- entity.PACNumber = oilCertificateNo
- where := "SupplierName='" + supplierName + "'"
- err := svc.UpdateEntityBywheretbl(OilSupplierName, &entity, cols, where)
- if err != nil {
- panic(err)
- }
- }
- // @Title 获取列表
- // @Description get user by token
- // @Success 200 {object} []supplier.OilSupplier
- // @router /getscenefilelist [get]
- func (this *OilSupplierController) GetSceneFileList() {
- supplierId := this.GetString("SupplierId")
- page := this.GetPageInfoForm()
- orderby := "Id"
- var model []supplierscenefile.OilSupplierSceneFile
- svc := supplierscenefile.GetSupplierScenefileService(utils.DBE)
- where := "SupplierId=" + supplierId
- svc.GetPagingEntitiesWithOrderBytbl("", page.CurrentPage, page.Size, orderby, true, &model, where)
- var errinfo ErrorDataInfo
- errinfo.Item = model
- errinfo.Code = 1
- this.Data["json"] = &errinfo
- this.ServeJSON()
- }
- // @Title 获取已使用的银行账号
- // @Description
- // @Success 200 {object} controllers.Request
- // @router /getBankAccount [get]
- func (this *OilSupplierController) GetBankAccountIsExist() {
- bankAccount := this.GetString("bankAccount")
- supplierId := this.GetString("supId")
- sqlStr := "SELECT BankAccount FROM OilSupplier where BankAccount='" + bankAccount + "'"
- if supplierId != "" {
- sqlStr += " and Id !=" + supplierId
- }
- svc := supplier.GetOilSupplierService(utils.DBE)
- list, _ := svc.DBE.QueryString(sqlStr)
- var errorInfo ErrorDataInfo
- if list != nil {
- errorInfo.Item = true
- this.Data["json"] = &errorInfo
- this.ServeJSON()
- } else {
- errorInfo.Item = false
- this.Data["json"] = &errorInfo
- this.ServeJSON()
- }
- }
- // @Title 获取已使用的统一社会信用代码
- // @Description
- // @Success 200 {object} controllers.Request
- // @router /getCommercialNo [get]
- func (this *OilSupplierController) GetCommercialNoIsExist() {
- commercialNo := this.GetString("commercialNo")
- supplierId := this.GetString("supId")
- sqlStr := "SELECT CommercialNo FROM OilSupplier where CommercialNo='" + commercialNo + "'"
- if supplierId != "" {
- sqlStr += " and Id !=" + supplierId
- }
- svc := supplier.GetOilSupplierService(utils.DBE)
- list, _ := svc.DBE.QueryString(sqlStr)
- var errorInfo ErrorDataInfo
- if list != nil {
- errorInfo.Item = true
- this.Data["json"] = &errorInfo
- this.ServeJSON()
- } else {
- errorInfo.Item = false
- this.Data["json"] = &errorInfo
- this.ServeJSON()
- }
- }
- // @Title 信息变更检查资质
- // @Description
- // @Success 200 {object} controllers.Request
- // @router /checkSupplierFile [post]
- func (this *OilSupplierController) CheckSupplierFile() {
- var file supplierfile.File
- var jsonBlob = this.Ctx.Input.RequestBody
- json.Unmarshal(jsonBlob, &file)
- //获取主表信息
- var supplierEntity supplier.OilSupplier
- var errinfo ErrorDataInfo
- supplierService := supplier.GetOilSupplierService(utils.DBE)
- supplierService.GetEntityById(file.SupplierId, &supplierEntity)
- //获取准入信息表
- var supplierCertEntity []suppliercert.OilSupplierCert
- supplierService.GetEntitysByWhere("OilSupplierCert", "SupplierId = "+strconv.Itoa(file.SupplierId), &supplierCertEntity)
- for _, cert := range supplierCertEntity {
- //对准入范围的判断
- var certSubList []suppliercertsub.OilSupplierCertSub
- certsubService := suppliercertsub.GetOilSupplierCertSubService(utils.DBE)
- certsubService.GetListByCertId(strconv.Itoa(cert.Id), &certSubList)
- // 查询出已有哪些资质
- var tableheaderList []qualchange.OilQualChangeDetail1
- fileSql := "SELECT * from OilSupplierFile WHERE SupplierId = " + strconv.Itoa(file.SupplierId)
- svcHeader := tableheader.GetTableHeaderService(utils.DBE)
- svcHeader.DBE.SQL(fileSql).Find(&tableheaderList)
- var companyHasHeaders string
- for _, tableheader := range tableheaderList {
- companyHasHeaders += tableheader.NeedFileType + ","
- }
- paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
- filesvc := supplierfile.GetSupplierfileService(utils.DBE)
- mergerCertSkipField := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MergerCertSkipFieldName")
- idString := ""
- idString1 := ""
- for i := 0; i < len(certSubList); i = i + 1000 {
- var ids suppliercertsub.Ids
- certsubService.GetIds(strconv.Itoa(cert.Id), cert.SupplierTypeCode, &ids, 3, strconv.Itoa(i))
- if ids.Id != "" {
- idString += "," + ids.Id
- } else {
- break
- }
- }
- var needList []supplierfile.FileList
- var needList1 []supplierfile.FileList
- if cert.SupplierTypeCode == "01" {
- //需要的资质
- needList = filesvc.GetGoodsNeedFileListNew(idString, "2")
- if file.Type == 1 { //制造商
- idString = ""
- //如果是制造商,准入范围按照各项准入范围的类型判断
- for i := 0; i < len(certSubList); i = i + 1000 {
- var ids suppliercertsub.Ids
- certsubService.GetIds(strconv.Itoa(cert.Id), cert.SupplierTypeCode, &ids, 1, strconv.Itoa(i))
- if ids.Id != "" {
- idString += "," + ids.Id
- } else {
- break
- }
- }
- for i := 0; i < len(certSubList); i = i + 1000 {
- var ids1 suppliercertsub.Ids
- certsubService.GetIds(strconv.Itoa(cert.Id), cert.SupplierTypeCode, &ids1, 2, strconv.Itoa(i))
- if ids1.Id != "" {
- idString1 += "," + ids1.Id
- } else {
- break
- }
- }
- needList = filesvc.GetGoodsNeedFileListNew(idString, "1")
- needList1 = filesvc.GetGoodsNeedFileListNew(idString1, "2")
- var needFile supplierfile.FileList
- // 质量管理体系认证证书
- CNPCrenkezhengshu := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "CNPCrenkezhengshu")
- needFile.FileName = CNPCrenkezhengshu
- needList = append(needList, needFile)
- for _, need := range needList1 {
- needList = append(needList, need)
- }
- }
- } else if cert.SupplierTypeCode == "02" {
- needList = filesvc.GetBasicNeedFileListNew(idString)
- } else if cert.SupplierTypeCode == "03" {
- needList = filesvc.GetTechNeedFileListNew(idString)
- }
- //if cert.InStyle == "4" {
- // var needFile supplierfile.FileList
- // //战略合作协议扫描件
- // needFile.FileName = paramSvc.GetBaseparameterMessage("GFGL", "paramset", "CooperationFile")
- // needList = append(needList, needFile)
- //}
- if cert.InStyle == "6" {
- var needFile supplierfile.FileList
- //招标准入需提供招标中标结果
- needFile.FileName = paramSvc.GetBaseparameterMessage("GFGL", "paramset", "TheTender")
- needList = append(needList, needFile)
- }
- for _, needHeader := range needList {
- if (supplierEntity.CredentialFlag == "1" || supplierEntity.CredentialFlag == "2") &&
- strings.Contains(mergerCertSkipField, needHeader.FileName+",") {
- //三证合一或五证合一的证件,不需要验证了
- continue
- }
- var fileist1 supplierfile.OilSupplierFile
- where1 := " SupplierId = '" + strconv.Itoa(file.SupplierId) + "' and NeedFileType = '" + needHeader.FileName + "'"
- filesvc.GetEntityByWhere("OilSupplierFile", where1, &fileist1)
- var filelist2 qualchange.OilQualChangeDetail
- where2 := " SupplierId = '" + strconv.Itoa(file.SupplierId) + "' and NeedFileType = '" + needHeader.FileName + "'"
- svc2 := suppliercertappendsub.GetOilSupplierCertAppendSubService(utils.DBE)
- svc2.GetEntityByWhere("OilQualChangeDetail", where2, &filelist2)
- if !strings.Contains(companyHasHeaders, needHeader.FileName+",") {
- errinfo.Message = "请上传!" + needHeader.FileName + "! 详情请点击检查资质按钮查看!"
- errinfo.Code = 0
- this.Data["json"] = &errinfo
- this.ServeJSON()
- return
- } else {
- if filelist2.FileName == "" && fileist1.FileName == "" {
- //缺少的资质
- errinfo.Message = "请上传!" + needHeader.FileName + "! 详情请点击检查资质按钮查看!"
- errinfo.Code = 0
- this.Data["json"] = &errinfo
- this.ServeJSON()
- return
- }
- }
- }
- }
- errinfo.Code = 1
- this.Data["json"] = &errinfo
- this.ServeJSON()
- }
- // @Title 准入/增项/年审/已入库保存检查资质方法
- // @Description
- // @Success 200 {object} controllers.Request
- // @router /checkSupplierFileNew [post]
- func (this *OilSupplierController) CheckSupplierFileNew() {
- var file supplierfile.CheckFile
- var jsonBlob = this.Ctx.Input.RequestBody
- json.Unmarshal(jsonBlob, &file)
- //获取主表信息
- var supplierEntity supplier.OilSupplier
- var errinfo ErrorDataInfo
- supplierService := supplier.GetOilSupplierService(utils.DBE)
- supplierService.GetEntityById(file.SupplierId, &supplierEntity)
- //获取准入信息表
- var cert suppliercert.OilSupplierCert
- supplierService.GetEntityByWhere("OilSupplierCert", "Id = "+file.CertId, &cert)
- // 查询出已有哪些资质
- var tableheaderList []qualchange.OilQualChangeDetail1
- fileSql := "SELECT * from OilSupplierFile WHERE SupplierId = " + strconv.Itoa(file.SupplierId)
- svcHeader := tableheader.GetTableHeaderService(utils.DBE)
- svcHeader.DBE.SQL(fileSql).Find(&tableheaderList)
- var companyHasHeaders string
- for _, tableheader := range tableheaderList {
- companyHasHeaders += tableheader.NeedFileType + ","
- }
- paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
- filesvc := supplierfile.GetSupplierfileService(utils.DBE)
- mergerCertSkipField := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MergerCertSkipFieldName")
- var certSubList []suppliercertsub.OilSupplierCertSub
- certsubService := suppliercertsub.GetOilSupplierCertSubService(utils.DBE)
- certsubService.GetListByCertId(strconv.Itoa(cert.Id), &certSubList)
- idString := ""
- idString1 := ""
- for i := 0; i < len(certSubList); i = i + 1000 {
- var ids suppliercertsub.Ids
- certsubService.GetIds(strconv.Itoa(cert.Id), cert.SupplierTypeCode, &ids, 3, strconv.Itoa(i))
- if ids.Id != "" {
- idString += "," + ids.Id
- } else {
- break
- }
- }
- //certsubService.GetIds(strconv.Itoa(cert.Id), cert.SupplierTypeCode, &ids, 1)
- //certsubService.GetIds(strconv.Itoa(cert.Id), cert.SupplierTypeCode, &ids1, 2)
- var needList []supplierfile.FileList
- var needList1 []supplierfile.FileList
- if cert.SupplierTypeCode == "01" {
- //需要的资质
- total := certsubService.GetCountIsManufacturer(strconv.Itoa(cert.Id))
- if file.Type == 2 && total > 0 {
- errinfo.Message = "非制造商准入范围不能为制造商,请手动修改!"
- errinfo.Code = 0
- this.Data["json"] = &errinfo
- this.ServeJSON()
- return
- }
- gradeTotal := certsubService.GetCountGrade(strconv.Itoa(cert.Id))
- if file.Grade == "2" && gradeTotal > 0 {
- errinfo.Message = "二级供应商不能准入一级物资!"
- errinfo.Code = 0
- this.Data["json"] = &errinfo
- this.ServeJSON()
- return
- }
- needList = filesvc.GetGoodsNeedFileListNew(idString, "2")
- if file.Type == 1 { //制造商
- idString = ""
- for i := 0; i < len(certSubList); i = i + 1000 {
- var ids suppliercertsub.Ids
- certsubService.GetIds(strconv.Itoa(cert.Id), cert.SupplierTypeCode, &ids, 1, strconv.Itoa(i))
- if ids.Id != "" {
- idString += "," + ids.Id
- } else {
- break
- }
- }
- for i := 0; i < len(certSubList); i = i + 1000 {
- var ids1 suppliercertsub.Ids
- certsubService.GetIds(strconv.Itoa(cert.Id), cert.SupplierTypeCode, &ids1, 2, strconv.Itoa(i))
- if ids1.Id != "" {
- idString1 += "," + ids1.Id
- } else {
- break
- }
- }
- needList = filesvc.GetGoodsNeedFileListNew(idString, "1")
- needList1 = filesvc.GetGoodsNeedFileListNew(idString1, "2")
- var needFile supplierfile.FileList
- // 质量管理体系认证证书
- CNPCrenkezhengshu := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "CNPCrenkezhengshu")
- needFile.FileName = CNPCrenkezhengshu
- needList = append(needList, needFile)
- for _, need := range needList1 {
- needList = append(needList, need)
- }
- }
- } else if cert.SupplierTypeCode == "02" {
- needList = filesvc.GetBasicNeedFileListNew(idString)
- } else if cert.SupplierTypeCode == "03" {
- needList = filesvc.GetTechNeedFileListNew(idString)
- }
- //2021-02-04企管法规处去掉这一限制
- //if cert.InStyle == "4" {
- // var needFile supplierfile.FileList
- // //战略合作协议扫描件
- // needFile.FileName = paramSvc.GetBaseparameterMessage("GFGL", "paramset", "CooperationFile")
- // needList = append(needList, needFile)
- //}
- if cert.InStyle == "6" {
- var needFile supplierfile.FileList
- //招标准入需提供招标中标结果
- needFile.FileName = paramSvc.GetBaseparameterMessage("GFGL", "paramset", "TheTender")
- needList = append(needList, needFile)
- }
- for _, needHeader := range needList {
- if (supplierEntity.CredentialFlag == "1" || supplierEntity.CredentialFlag == "2") &&
- strings.Contains(mergerCertSkipField, needHeader.FileName+",") {
- //三证合一或五证合一的证件,不需要验证了
- continue
- }
- var fileist1 supplierfile.OilSupplierFile
- where1 := " SupplierId = '" + strconv.Itoa(file.SupplierId) + "' and NeedFileType = '" + needHeader.FileName + "'"
- filesvc.GetEntityByWhere("OilSupplierFile", where1, &fileist1)
- if !strings.Contains(companyHasHeaders, needHeader.FileName+",") {
- errinfo.Message = "请上传!" + needHeader.FileName + "! 详情请点击检查资质按钮查看!"
- errinfo.Code = 0
- this.Data["json"] = &errinfo
- this.ServeJSON()
- return
- } else {
- if file.Table == 3 {
- var filelist2 annualaudit.OilAnnualChangeDetail
- where2 := " SupplierId = '" + strconv.Itoa(file.SupplierId) + "' and NeedFileType = '" + needHeader.FileName + "'"
- svc2 := suppliercertappendsub.GetOilSupplierCertAppendSubService(utils.DBE)
- svc2.GetEntityByWhere("OilAnnualChangeDetail", where2, &filelist2)
- if filelist2.FileName == "" && fileist1.FileName == "" {
- //缺少的资质
- errinfo.Message = "请上传!" + needHeader.FileName + "! 详情请点击检查资质按钮查看!"
- errinfo.Code = 0
- this.Data["json"] = &errinfo
- this.ServeJSON()
- return
- }
- }
- if file.Table == 4 {
- var filelist2 suppliercertappendsub.OilAppendChangeDetail
- where2 := " SupplierId = '" + strconv.Itoa(file.SupplierId) + "' and NeedFileType = '" + needHeader.FileName + "'"
- svc2 := suppliercertappendsub.GetOilSupplierCertAppendSubService(utils.DBE)
- svc2.GetEntityByWhere("OilAppendChangeDetail", where2, &filelist2)
- if filelist2.FileName == "" && fileist1.FileName == "" {
- //缺少的资质
- errinfo.Message = "请上传!" + needHeader.FileName + "! 详情请点击检查资质按钮查看!"
- errinfo.Code = 0
- this.Data["json"] = &errinfo
- this.ServeJSON()
- return
- }
- }
- }
- }
- errinfo.Code = 1
- this.Data["json"] = &errinfo
- this.ServeJSON()
- }
- // @Title 检查缺资质
- // @Description
- // @Success 200 {object} controllers.Request
- // @router /checkSupplierFileDelete [post]
- func (this *OilSupplierController) CheckSupplierFileDelete() {
- //获取主表信息
- var supplierList []supplier.OilSupplier
- var errinfo ErrorDataInfo
- supplierService := supplier.GetOilSupplierService(utils.DBE)
- supplierService.GetEntitysByWhere(OilSupplierName, "1=1", &supplierList)
- //var total int64
- //var total1 int64
- for _, supplier := range supplierList {
- var supplierCertEntity []suppliercert.OilSupplierCert
- supplierService.GetEntitysByWhere("OilSupplierCert", "SupplierId = "+strconv.Itoa(supplier.Id), &supplierCertEntity)
- for _, cert := range supplierCertEntity {
- where2 := "("
- where3 := "("
- //对准入范围的判断
- var certSubList []suppliercertsub.OilSupplierCertSub
- certsubService := suppliercertsub.GetOilSupplierCertSubService(utils.DBE)
- certsubService.GetListByCertId(strconv.Itoa(cert.Id), &certSubList)
- // 查询出已有哪些资质
- var tableheaderList []qualchange.OilQualChangeDetail1
- fileSql := "SELECT * from OilSupplierFile WHERE SupplierId = " + strconv.Itoa(supplier.Id)
- svcHeader := tableheader.GetTableHeaderService(utils.DBE)
- svcHeader.DBE.SQL(fileSql).Find(&tableheaderList)
- var companyHasHeaders string
- for _, tableheader := range tableheaderList {
- companyHasHeaders += tableheader.NeedFileType + ","
- }
- paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
- filesvc := supplierfile.GetSupplierfileService(utils.DBE)
- mergerCertSkipField := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MergerCertSkipFieldName")
- idString := ""
- idString1 := ""
- for i := 0; i < len(certSubList); i = i + 1000 {
- var ids suppliercertsub.Ids
- certsubService.GetIds(strconv.Itoa(cert.Id), cert.SupplierTypeCode, &ids, 3, strconv.Itoa(i))
- if ids.Id != "" {
- idString += "," + ids.Id
- } else {
- break
- }
- }
- var needList []supplierfile.FileList
- var needList1 []supplierfile.FileList
- if cert.SupplierTypeCode == "01" {
- //需要的资质
- needList1 = filesvc.GetGoodsNeedFileListNew(idString, "2")
- if supplier.OperType == "制造商" { //制造商
- //如果是制造商,准入范围按照各项准入范围的类型判断
- // 制造
- idString = ""
- for i := 0; i < len(certSubList); i = i + 1000 {
- var ids suppliercertsub.Ids
- certsubService.GetIds(strconv.Itoa(cert.Id), cert.SupplierTypeCode, &ids, 1, strconv.Itoa(i))
- if ids.Id != "" {
- idString += "," + ids.Id
- } else {
- break
- }
- }
- // 非制造
- for i := 0; i < len(certSubList); i = i + 1000 {
- var ids1 suppliercertsub.Ids
- certsubService.GetIds(strconv.Itoa(cert.Id), cert.SupplierTypeCode, &ids1, 2, strconv.Itoa(i))
- if ids1.Id != "" {
- idString1 += "," + ids1.Id
- } else {
- break
- }
- }
- needList = filesvc.GetGoodsNeedFileListNew(idString, "1")
- needList1 = filesvc.GetGoodsNeedFileListNew(idString1, "2")
- //for _, need := range needList1 {
- // needList = append(needList, need)
- //}
- }
- } else if cert.SupplierTypeCode == "02" {
- needList = filesvc.GetBasicNeedFileListNew(idString)
- } else if cert.SupplierTypeCode == "03" {
- needList = filesvc.GetTechNeedFileListNew(idString)
- }
- needName := ""
- for _, needHeader := range needList {
- if (supplier.CredentialFlag == "1" || supplier.CredentialFlag == "2") &&
- strings.Contains(mergerCertSkipField, needHeader.FileName+",") {
- //三证合一或五证合一的证件,不需要验证了
- continue
- }
- if cert.SupplierTypeCode == "02" && (needHeader.FileName == "安全资质审查" || needHeader.FileName == "培训考核") {
- // 基建类
- continue
- }
- if !strings.Contains(companyHasHeaders, needHeader.FileName+",") {
- var header tableheader.BaseTableheader
- where1 := "Name = '" + needHeader.FileName + "' and CategoryCode = '" + cert.SupplierTypeCode + "'"
- if cert.SupplierTypeCode == "01" {
- where1 += " and IsManuf != '2'"
- }
- supplierService.GetEntityByWhere(BaseTableHeader, where1, &header)
- if header.Code != "" {
- needName += header.Name + ","
- if where2 == "(" {
- where2 += header.Code + " = '1'"
- } else {
- where2 += " or " + header.Code + " = '1'"
- }
- } else {
- fmt.Print("22222")
- }
- }
- }
- for _, needHeader := range needList1 {
- if (supplier.CredentialFlag == "1" || supplier.CredentialFlag == "2") &&
- strings.Contains(mergerCertSkipField, needHeader.FileName+",") {
- //三证合一或五证合一的证件,不需要验证了
- continue
- }
- if !strings.Contains(companyHasHeaders, needHeader.FileName+",") {
- var header tableheader.BaseTableheader
- where1 := "Name = '" + needHeader.FileName + "' and CategoryCode = '" + cert.SupplierTypeCode + "'"
- if cert.SupplierTypeCode == "01" {
- // 非制造商
- where1 += " and IsManuf != '1'"
- }
- supplierService.GetEntityByWhere(BaseTableHeader, where1, &header)
- if header.Code != "" {
- needName += header.Name + ","
- if where3 == "(" {
- where3 += header.Code + " = '1'"
- } else {
- where3 += " or " + header.Code + " = '1'"
- }
- } else {
- fmt.Print("11111")
- }
- }
- }
- if where2 == "(" && where3 == "(" {
- continue
- }
- if cert.SupplierTypeCode != "01" && where2 == "(" {
- continue
- }
- where2 += ") and a.SupplierId = " + strconv.Itoa(supplier.Id) + " and a.SupplierTypeCode = '" + cert.SupplierTypeCode + "'"
- where3 += ") and a.SupplierId = " + strconv.Itoa(supplier.Id) + " and a.SupplierTypeCode = '" + cert.SupplierTypeCode + "'"
- var certSub []suppliercertsub.OilSupplierCertSub
- if cert.SupplierTypeCode == "01" {
- if supplier.OperType == "制造商" {
- where2 += " and IsManufacturer != 2"
- where3 += " and IsManufacturer = 2"
- supplierService.GetDeleteSub(OilGoodsAptitudeName, where2, &certSub)
- supplierService.GetDeleteSub(OilGoodsAptitudeName, where3, &certSub)
- } else {
- supplierService.GetDeleteSub(OilGoodsAptitudeName, where3, &certSub)
- }
- } else if cert.SupplierTypeCode == "02" {
- supplierService.GetDeleteSub(OilBasisBuildName, where2, &certSub)
- } else {
- supplierService.GetDeleteSub(OilTechnologyServiceName, where2, &certSub)
- }
- var supplierCert suppliercert.OilSupplierCert
- supplierCert.BackRemark = needName
- cols := []string{"BackRemark"}
- supplierService.UpdateEntityBywheretbl(OilSupplierCertName, &supplierCert, cols, "Id = "+strconv.Itoa(cert.Id))
- }
- }
- errinfo.Code = 1
- this.Data["json"] = &errinfo
- this.ServeJSON()
- }
- // @Title 检查缺资质列表
- // @Description
- // @Success 200 {object} controllers.Request
- // @router /checkSupplierFileList [post]
- func (this *OilSupplierController) CheckSupplierFileList() {
- var file supplierfile.CheckFile
- var jsonBlob = this.Ctx.Input.RequestBody
- json.Unmarshal(jsonBlob, &file)
- //获取主表信息
- var supplierEntity supplier.OilSupplier
- supplierService := supplier.GetOilSupplierService(utils.DBE)
- supplierService.GetEntityById(file.SupplierId, &supplierEntity)
- //获取准入信息表
- var certList []suppliercert.OilSupplierCert
- supplierService.GetEntitysByWhere("OilSupplierCert", "SupplierId = "+strconv.Itoa(file.SupplierId), &certList)
- certsubService := suppliercertsub.GetOilSupplierCertSubService(utils.DBE)
- // 查询出已有哪些资质
- var tableheaderList []qualchange.OilQualChangeDetail1
- fileSql := "SELECT * from OilSupplierFile WHERE SupplierId = " + strconv.Itoa(file.SupplierId)
- svcHeader := tableheader.GetTableHeaderService(utils.DBE)
- svcHeader.DBE.SQL(fileSql).Find(&tableheaderList)
- var companyHasHeaders string
- for _, tableheader := range tableheaderList {
- companyHasHeaders += tableheader.NeedFileType + ","
- }
- paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
- filesvc := supplierfile.GetSupplierfileService(utils.DBE)
- mergerCertSkipField := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MergerCertSkipFieldName")
- for _, cert := range certList {
- if file.CertId != "0" && strconv.Itoa(cert.Id) != file.CertId {
- continue
- }
- var certSubList2 suppliercertsub.OilSupplierCertSub
- certSubList2.LackFile = ""
- certSubList2.IsQuestion = 0
- svcHeader.UpdateEntityBywheretbl(OilSupplierCertSubName, &certSubList2, []string{"LackFile", "IsQuestion"}, "IsQuestion = 2 and SupplierId = "+strconv.Itoa(supplierEntity.Id)+" and SupplierCertId = "+strconv.Itoa(cert.Id))
- //对准入范围的判断
- var certSubList []suppliercertsub.OilSupplierCertSub
- certsubService.GetListByCertId(strconv.Itoa(cert.Id), &certSubList)
- idString := ""
- idString1 := ""
- for i := 0; i < len(certSubList); i = i + 1000 {
- var ids suppliercertsub.Ids
- certsubService.GetIds(strconv.Itoa(cert.Id), cert.SupplierTypeCode, &ids, 3, strconv.Itoa(i))
- if ids.Id != "" {
- idString += "," + ids.Id
- } else {
- break
- }
- }
- var needList []supplierfile.FileList
- var needList1 []supplierfile.FileList
- if cert.SupplierTypeCode == "01" {
- //需要的资质
- needList1 = filesvc.GetGoodsNeedFileListNew(idString, "2")
- if file.Type == 1 { //制造商
- //如果是制造商,准入范围按照各项准入范围的类型判断
- // 制造
- idString = ""
- for i := 0; i < len(certSubList); i = i + 1000 {
- var ids suppliercertsub.Ids
- certsubService.GetIds(strconv.Itoa(cert.Id), cert.SupplierTypeCode, &ids, 1, strconv.Itoa(i))
- if ids.Id != "" {
- idString += "," + ids.Id
- } else {
- break
- }
- }
- // 非制造
- for i := 0; i < len(certSubList); i = i + 1000 {
- var ids1 suppliercertsub.Ids
- certsubService.GetIds(strconv.Itoa(cert.Id), cert.SupplierTypeCode, &ids1, 2, strconv.Itoa(i))
- if ids1.Id != "" {
- idString1 += "," + ids1.Id
- } else {
- break
- }
- }
- needList = filesvc.GetGoodsNeedFileListNew(idString, "1")
- needList1 = filesvc.GetGoodsNeedFileListNew(idString1, "2")
- }
- } else if cert.SupplierTypeCode == "02" {
- needList = filesvc.GetBasicNeedFileListNew(idString)
- } else if cert.SupplierTypeCode == "03" {
- needList = filesvc.GetTechNeedFileListNew(idString)
- }
- for _, needHeader := range needList {
- if (supplierEntity.CredentialFlag == "1" || supplierEntity.CredentialFlag == "2") &&
- strings.Contains(mergerCertSkipField, needHeader.FileName+",") {
- //三证合一或五证合一的证件,不需要验证了
- continue
- }
- if !strings.Contains(companyHasHeaders, needHeader.FileName+",") {
- var header tableheader.BaseTableheader
- where1 := "Name = '" + needHeader.FileName + "' and CategoryCode = '" + cert.SupplierTypeCode + "'"
- if cert.SupplierTypeCode == "01" {
- where1 += " and IsManuf != '2'"
- }
- supplierService.GetEntityByWhere(BaseTableHeader, where1, &header)
- if header.Code != "" {
- where2 := header.Code + " = '1'"
- where2 += " and a.SupplierId = " + strconv.Itoa(supplierEntity.Id) + " and a.SupplierTypeCode = '" + cert.SupplierTypeCode + "'"
- var certSub []suppliercertsub.OilSupplierCertSub
- if cert.SupplierTypeCode == "01" {
- where2 += " and IsManufacturer != 2"
- supplierService.GetDeleteSub2(OilGoodsAptitudeName, where2, &certSub, header.Name)
- } else if cert.SupplierTypeCode == "02" {
- supplierService.GetDeleteSub2(OilBasisBuildName, where2, &certSub, header.Name)
- } else {
- supplierService.GetDeleteSub2(OilTechnologyServiceName, where2, &certSub, header.Name)
- }
- } else {
- fmt.Print("22222")
- }
- }
- }
- for _, needHeader := range needList1 {
- // 非制造
- if (supplierEntity.CredentialFlag == "1" || supplierEntity.CredentialFlag == "2") &&
- strings.Contains(mergerCertSkipField, needHeader.FileName+",") {
- //三证合一或五证合一的证件,不需要验证了
- continue
- }
- if !strings.Contains(companyHasHeaders, needHeader.FileName+",") {
- var header tableheader.BaseTableheader
- where1 := "Name = '" + needHeader.FileName + "' and CategoryCode = '" + cert.SupplierTypeCode + "'"
- if cert.SupplierTypeCode == "01" {
- where1 += " and IsManuf != '1'"
- }
- supplierService.GetEntityByWhere(BaseTableHeader, where1, &header)
- if header.Code != "" {
- where2 := header.Code + " = '1'"
- where2 += " and a.SupplierId = " + strconv.Itoa(supplierEntity.Id) + " and a.SupplierTypeCode = '" + cert.SupplierTypeCode + "'"
- var certSub []suppliercertsub.OilSupplierCertSub
- if file.Type == 1 {
- where2 += " and IsManufacturer = 2"
- }
- supplierService.GetDeleteSub2(OilGoodsAptitudeName, where2, &certSub, header.Name)
- } else {
- fmt.Print("22222")
- }
- }
- }
- }
- var certSubList1 []suppliercertsub.OilSupplierCertSub
- var total int64
- where3 := "IsQuestion = 2 and SupplierId = " + strconv.Itoa(supplierEntity.Id)
- if file.FileName != "" {
- where3 += " and LackFile like '%" + file.FileName + "%'"
- }
- if file.SubName != "" {
- where3 += " and Name like '%" + file.SubName + "%'"
- }
- if file.CertId != "0" {
- where3 += " and SupplierCertId = " + file.CertId
- }
- total = certsubService.GetPagingEntitiesWithOrderBytbl("", file.CurrentPage, file.Size, "Id", true, &certSubList1, where3)
- var datainfo DataInfo
- datainfo.CurrentItemCount = total
- datainfo.PageIndex = file.CurrentPage
- datainfo.ItemsPerPage = file.Size
- datainfo.Items = certSubList1
- this.Data["json"] = &datainfo
- this.ServeJSON()
- }
- // @Title 对外-招投标系统
- // @Description
- // @Success 200 {object}
- // @router /getSupplierList [post]
- func (this *OilSupplierController) GetSupplierList() {
- //获取分页信息
- CurrentPage, _ := this.GetInt64("pageIndex", 1)
- Size, _ := this.GetInt64("pageSize", 10)
- where := " b.InFlag = 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("Keyword")
- SupplierTypeName := this.GetString("SupplierTypeName")
- SupplierTypeCode := this.GetString("accessCategoryCode")
- if SupplierName != "" {
- where = where + " and a.SupplierName like '%" + SupplierName + "%'"
- }
- if SupplierTypeName != "" {
- where = where + " and b.SupplierTypeName like '%" + SupplierTypeName + "%'"
- }
- if SupplierTypeCode != "" {
- where = where + " and b.SupplierTypeCode ='" + SupplierTypeCode + "'"
- }
- svc := supplier.GetOilSupplierService(utils.DBE)
- var total int64
- var list []supplier.CompanyList
- total = svc.GetMyPagingEntitiesWithOrderBytbl4(OilSupplierName, OilSupplierCertName, CurrentPage, Size, orderby, asc, &list, where)
- var datainfo DataInfo
- datainfo.Items = list
- datainfo.CurrentItemCount = total
- datainfo.PageIndex = CurrentPage
- datainfo.ItemsPerPage = Size
- this.Data["json"] = &datainfo
- this.ServeJSON()
- }
- // @Title 根据supplierId查certId
- // @Description
- // @Success 200 {object}
- // @router /getSupplierCertId/:Id [get]
- func (this *OilSupplierController) GetSupplierCertId() {
- Id := this.Ctx.Input.Param(":Id")
- var certList []suppliercert.OilSupplierCert
- svc := supplier.GetOilSupplierService(utils.DBE)
- svc.GetEntitysByWhere(OilSupplierCertName, "SupplierId = "+Id, &certList)
- var datainfo DataInfo
- datainfo.Items = certList
- this.Data["json"] = &datainfo
- this.ServeJSON()
- }
|