supplier.go 117 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615
  1. package oilsupplier
  2. import (
  3. "dashoo.cn/backend/api/business/oilsupplier/annualaudit"
  4. BlackList "dashoo.cn/backend/api/business/oilsupplier/blacklist"
  5. "dashoo.cn/backend/api/business/oilsupplier/qualchange"
  6. "dashoo.cn/backend/api/business/oilsupplier/suppliercertappendsub"
  7. "dashoo.cn/backend/api/business/oilsupplier/suppliercertsub"
  8. "dashoo.cn/backend/api/business/oilsupplier/supplierfile"
  9. "dashoo.cn/backend/api/business/oilsupplier/supplierscenefile"
  10. "dashoo.cn/backend/api/business/oilsupplier/tableheader"
  11. "dashoo.cn/backend/api/business/register"
  12. "dashoo.cn/business3/parameter"
  13. "encoding/json"
  14. "fmt"
  15. . "github.com/linxGnu/goseaweedfs"
  16. "github.com/tealeg/xlsx"
  17. "log"
  18. "os"
  19. "strconv"
  20. "strings"
  21. "time"
  22. "dashoo.cn/backend/api/business/auditsetting"
  23. "dashoo.cn/backend/api/business/organize"
  24. "dashoo.cn/business2/permission"
  25. "dashoo.cn/backend/api/business/workflow"
  26. "dashoo.cn/business2/areajson"
  27. "dashoo.cn/business2/items"
  28. "dashoo.cn/backend/api/business/baseUser"
  29. "dashoo.cn/backend/api/business/oilsupplier/supplier"
  30. "dashoo.cn/backend/api/business/oilsupplier/suppliercert"
  31. . "dashoo.cn/backend/api/controllers"
  32. "dashoo.cn/business2/userRole"
  33. "dashoo.cn/utils"
  34. "github.com/go-xorm/xorm"
  35. )
  36. type OilSupplierController struct {
  37. BaseController
  38. }
  39. // @Title 获取列表
  40. // @Description get user by token
  41. // @Success 200 {object} []supplier.OilSupplier
  42. // @router /list [get]
  43. func (this *OilSupplierController) GetEntityList() {
  44. //获取分页信息
  45. page := this.GetPageInfoForm()
  46. where := " 1=1 "
  47. orderby := "Id"
  48. asc := false
  49. Order := this.GetString("Order")
  50. Prop := this.GetString("Prop")
  51. if Order != "" && Prop != "" {
  52. orderby = Prop
  53. if Order == "asc" {
  54. asc = true
  55. }
  56. }
  57. Id := this.GetString("Id")
  58. SupplierName := this.GetString("SupplierName")
  59. OilCertificateNo := this.GetString("OilCertificateNo")
  60. Grade := this.GetString("Grade")
  61. MgrUnit := this.GetString("MgrUnit")
  62. OperType := this.GetString("OperType")
  63. Country := this.GetString("Country")
  64. MaunAgent := this.GetString("MaunAgent")
  65. ConstructTeam := this.GetString("ConstructTeam")
  66. CommercialNo := this.GetString("CommercialNo")
  67. OrganCode := this.GetString("OrganCode")
  68. CountryTaxNo := this.GetString("CountryTaxNo")
  69. LocalTaxNo := this.GetString("LocalTaxNo")
  70. Address := this.GetString("Address")
  71. Province := this.GetString("Province")
  72. City := this.GetString("City")
  73. Street := this.GetString("Street")
  74. HouseNo := this.GetString("HouseNo")
  75. ZipCode := this.GetString("ZipCode")
  76. QualitySystemCert := this.GetString("QualitySystemCert")
  77. ProductQualityCert := this.GetString("ProductQualityCert")
  78. MaunLicense := this.GetString("MaunLicense")
  79. QualifCert := this.GetString("QualifCert")
  80. QualifCertLevel := this.GetString("QualifCertLevel")
  81. SafetyLicense := this.GetString("SafetyLicense")
  82. TechServiceLic := this.GetString("TechServiceLic")
  83. TJInNotify := this.GetString("TJInNotify")
  84. SpecIndustryCert := this.GetString("SpecIndustryCert")
  85. LegalPerson := this.GetString("LegalPerson")
  86. CategoryCode := this.GetString("CategoryCode")
  87. CategoryName := this.GetString("CategoryName")
  88. RegCapital := this.GetString("RegCapital")
  89. Currency := this.GetString("Currency")
  90. ContactName := this.GetString("ContactName")
  91. CompanyType := this.GetString("CompanyType")
  92. SetupTime := this.GetString("SetupTime")
  93. DepositBank := this.GetString("DepositBank")
  94. BankAccount := this.GetString("BankAccount")
  95. EMail := this.GetString("EMail")
  96. BankCreditRating := this.GetString("BankCreditRating")
  97. Mobile := this.GetString("Mobile")
  98. Telphone := this.GetString("Telphone")
  99. Fax := this.GetString("Fax")
  100. CompanyTel := this.GetString("CompanyTel")
  101. QQ := this.GetString("QQ")
  102. CompanyUrl := this.GetString("CompanyUrl")
  103. SpecSupplier := this.GetString("SpecSupplier")
  104. SpecTypeCode := this.GetString("SpecTypeCode")
  105. SpecTypeName := this.GetString("SpecTypeName")
  106. Remark := this.GetString("Remark")
  107. IsDelete := this.GetString("IsDelete")
  108. CreateOn := this.GetString("CreateOn")
  109. CreateUserId := this.GetString("CreateUserId")
  110. CreateBy := this.GetString("CreateBy")
  111. ModifiedOn := this.GetString("ModifiedOn")
  112. ModifiedUserId := this.GetString("ModifiedUserId")
  113. ModifiedBy := this.GetString("ModifiedBy")
  114. if Id != "" {
  115. where = where + " and Id like '%" + Id + "%'"
  116. }
  117. if SupplierName != "" {
  118. where = where + " and SupplierName like '%" + SupplierName + "%'"
  119. }
  120. if OilCertificateNo != "" {
  121. where = where + " and OilCertificateNo like '%" + OilCertificateNo + "%'"
  122. }
  123. if Grade != "" {
  124. where = where + " and Grade like '%" + Grade + "%'"
  125. }
  126. if MgrUnit != "" {
  127. where = where + " and MgrUnit like '%" + MgrUnit + "%'"
  128. }
  129. if OperType != "" {
  130. where = where + " and OperType like '%" + OperType + "%'"
  131. }
  132. if Country != "" {
  133. where = where + " and Country like '%" + Country + "%'"
  134. }
  135. if MaunAgent != "" {
  136. where = where + " and MaunAgent like '%" + MaunAgent + "%'"
  137. }
  138. if ConstructTeam != "" {
  139. where = where + " and ConstructTeam like '%" + ConstructTeam + "%'"
  140. }
  141. if CommercialNo != "" {
  142. where = where + " and CommercialNo like '%" + CommercialNo + "%'"
  143. }
  144. if OrganCode != "" {
  145. where = where + " and OrganCode like '%" + OrganCode + "%'"
  146. }
  147. if CountryTaxNo != "" {
  148. where = where + " and CountryTaxNo like '%" + CountryTaxNo + "%'"
  149. }
  150. if LocalTaxNo != "" {
  151. where = where + " and LocalTaxNo like '%" + LocalTaxNo + "%'"
  152. }
  153. if Address != "" {
  154. where = where + " and Address like '%" + Address + "%'"
  155. }
  156. if Province != "" {
  157. where = where + " and Province like '%" + Province + "%'"
  158. }
  159. if City != "" {
  160. where = where + " and City like '%" + City + "%'"
  161. }
  162. if Street != "" {
  163. where = where + " and Street like '%" + Street + "%'"
  164. }
  165. if HouseNo != "" {
  166. where = where + " and HouseNo like '%" + HouseNo + "%'"
  167. }
  168. if ZipCode != "" {
  169. where = where + " and ZipCode like '%" + ZipCode + "%'"
  170. }
  171. if QualitySystemCert != "" {
  172. where = where + " and QualitySystemCert like '%" + QualitySystemCert + "%'"
  173. }
  174. if ProductQualityCert != "" {
  175. where = where + " and ProductQualityCert like '%" + ProductQualityCert + "%'"
  176. }
  177. if MaunLicense != "" {
  178. where = where + " and MaunLicense like '%" + MaunLicense + "%'"
  179. }
  180. if QualifCert != "" {
  181. where = where + " and QualifCert like '%" + QualifCert + "%'"
  182. }
  183. if QualifCertLevel != "" {
  184. where = where + " and QualifCertLevel like '%" + QualifCertLevel + "%'"
  185. }
  186. if SafetyLicense != "" {
  187. where = where + " and SafetyLicense like '%" + SafetyLicense + "%'"
  188. }
  189. if TechServiceLic != "" {
  190. where = where + " and TechServiceLic like '%" + TechServiceLic + "%'"
  191. }
  192. if TJInNotify != "" {
  193. where = where + " and TJInNotify like '%" + TJInNotify + "%'"
  194. }
  195. if SpecIndustryCert != "" {
  196. where = where + " and SpecIndustryCert like '%" + SpecIndustryCert + "%'"
  197. }
  198. if LegalPerson != "" {
  199. where = where + " and LegalPerson like '%" + LegalPerson + "%'"
  200. }
  201. if CategoryCode != "" {
  202. where = where + " and CategoryCode like '%" + CategoryCode + "%'"
  203. }
  204. if CategoryName != "" {
  205. where = where + " and CategoryName like '%" + CategoryName + "%'"
  206. }
  207. if RegCapital != "" {
  208. where = where + " and RegCapital like '%" + RegCapital + "%'"
  209. }
  210. if Currency != "" {
  211. where = where + " and Currency like '%" + Currency + "%'"
  212. }
  213. if ContactName != "" {
  214. where = where + " and ContactName like '%" + ContactName + "%'"
  215. }
  216. if CompanyType != "" {
  217. where = where + " and CompanyType like '%" + CompanyType + "%'"
  218. }
  219. if SetupTime != "" {
  220. where = where + " and SetupTime like '%" + SetupTime + "%'"
  221. }
  222. if DepositBank != "" {
  223. where = where + " and DepositBank like '%" + DepositBank + "%'"
  224. }
  225. if BankAccount != "" {
  226. where = where + " and BankAccount like '%" + BankAccount + "%'"
  227. }
  228. if EMail != "" {
  229. where = where + " and EMail like '%" + EMail + "%'"
  230. }
  231. if BankCreditRating != "" {
  232. where = where + " and BankCreditRating like '%" + BankCreditRating + "%'"
  233. }
  234. if Mobile != "" {
  235. where = where + " and Mobile like '%" + Mobile + "%'"
  236. }
  237. if Telphone != "" {
  238. where = where + " and Telphone like '%" + Telphone + "%'"
  239. }
  240. if Fax != "" {
  241. where = where + " and Fax like '%" + Fax + "%'"
  242. }
  243. if CompanyTel != "" {
  244. where = where + " and CompanyTel like '%" + CompanyTel + "%'"
  245. }
  246. if QQ != "" {
  247. where = where + " and QQ like '%" + QQ + "%'"
  248. }
  249. if CompanyUrl != "" {
  250. where = where + " and CompanyUrl like '%" + CompanyUrl + "%'"
  251. }
  252. if SpecSupplier != "" {
  253. where = where + " and SpecSupplier like '%" + SpecSupplier + "%'"
  254. }
  255. if SpecTypeCode != "" {
  256. where = where + " and SpecTypeCode like '%" + SpecTypeCode + "%'"
  257. }
  258. if SpecTypeName != "" {
  259. where = where + " and SpecTypeName like '%" + SpecTypeName + "%'"
  260. }
  261. if Remark != "" {
  262. where = where + " and Remark like '%" + Remark + "%'"
  263. }
  264. if IsDelete != "" {
  265. where = where + " and IsDelete like '%" + IsDelete + "%'"
  266. }
  267. if CreateUserId != "" {
  268. where = where + " and CreateUserId like '%" + CreateUserId + "%'"
  269. }
  270. if CreateBy != "" {
  271. where = where + " and CreateBy like '%" + CreateBy + "%'"
  272. }
  273. if ModifiedOn != "" {
  274. where = where + " and ModifiedOn like '%" + ModifiedOn + "%'"
  275. }
  276. if ModifiedUserId != "" {
  277. where = where + " and ModifiedUserId like '%" + ModifiedUserId + "%'"
  278. }
  279. if ModifiedBy != "" {
  280. where = where + " and ModifiedBy like '%" + ModifiedBy + "%'"
  281. }
  282. if CreateOn != "" {
  283. dates := strings.Split(CreateOn, ",")
  284. if len(dates) == 2 {
  285. minDate := dates[0]
  286. maxDate := dates[1]
  287. where = where + " and CreateOn>='" + minDate + "' and CreateOn<='" + maxDate + "'"
  288. }
  289. }
  290. //企业用户必须加创建人条件
  291. if this.User.IsCompanyUser == 1 {
  292. where = where + " and CreateUserId = '" + this.User.Id + "'"
  293. } else {
  294. //超级管理员和有查看所有数据权限的用户不加条件
  295. svcPerm := permission.GetPermissionService(utils.DBE)
  296. isauth := svcPerm.IsAuthorized(this.User.Id, "oil_supplier.marketAccess.AllRecord")
  297. if !svcPerm.IsAdmin(this.User.Id) && !isauth {
  298. where = where + " and CreateUserId = '" + this.User.Id + "'"
  299. }
  300. }
  301. svc := supplier.GetOilSupplierService(utils.DBE)
  302. var list []supplier.OilSupplier
  303. total := svc.GetPagingEntitiesWithOrderBytbl("", page.CurrentPage, page.Size, orderby, asc, &list, where)
  304. var datainfo DataInfo
  305. datainfo.Items = list
  306. datainfo.CurrentItemCount = total
  307. datainfo.PageIndex = page.CurrentPage
  308. datainfo.ItemsPerPage = page.Size
  309. this.Data["json"] = &datainfo
  310. this.ServeJSON()
  311. }
  312. // @Title 获取列表
  313. // @Description get user by token
  314. // @Success 200 {object} []supplier.OilSupplier
  315. // @router /certlist [get]
  316. func (this *OilSupplierController) GetJoinCertEntityList() {
  317. //获取分页信息
  318. page := this.GetPageInfoForm()
  319. where := " 1=1 "
  320. orderby := "Id"
  321. asc := false
  322. Order := this.GetString("Order")
  323. Prop := this.GetString("Prop")
  324. if Order != "" && Prop != "" {
  325. orderby = Prop
  326. if Order == "asc" {
  327. asc = true
  328. }
  329. }
  330. SupplierName := this.GetString("SupplierName")
  331. SupplierTypeName := this.GetString("SupplierTypeName")
  332. CreateOn := this.GetString("CreateOn")
  333. SupplierTypeCode := this.GetString("SupplierTypeCode")
  334. OperType := this.GetString("OperType")
  335. SpecTypeCode := this.GetString("SpecTypeCode")
  336. Country := this.GetString("Country")
  337. InStyle := this.GetString("InStyle")
  338. MgrUnit := this.GetString("MgrUnit")
  339. PACNumber := this.GetString("PACNumber")
  340. CommercialNo := this.GetString("CommercialNo")
  341. Province := this.GetString("Province")
  342. City := this.GetString("City")
  343. Street := this.GetString("Street")
  344. Address := this.GetString("Address")
  345. LinkProvince := this.GetString("LinkProvince")
  346. LinkCity := this.GetString("LinkCity")
  347. LinkStreet := this.GetString("LinkStreet")
  348. LinkAddress := this.GetString("LinkAddress")
  349. LegalPerson := this.GetString("LegalPerson")
  350. ContactName := this.GetString("ContactName")
  351. CompanyType := this.GetString("CompanyType")
  352. SetupTime := this.GetString("SetupTime")
  353. RegCapital1 := this.GetString("RegCapital1")
  354. RegCapital2 := this.GetString("RegCapital2")
  355. BusinessScope := this.GetString("BusinessScope")
  356. //where = where + " and b.InFlag != '4'"
  357. if SupplierName != "" {
  358. where = where + " and a.SupplierName like '%" + SupplierName + "%'"
  359. }
  360. if SupplierTypeName != "" {
  361. where = where + " and b.SupplierTypeName like '%" + SupplierTypeName + "%'"
  362. }
  363. if CreateOn != "" {
  364. dates := strings.Split(CreateOn, ",")
  365. if len(dates) == 2 {
  366. minDate := dates[0]
  367. maxDate := dates[1]
  368. where = where + " and b.CreateOn>='" + minDate + "' and b.CreateOn<='" + maxDate + "'"
  369. }
  370. }
  371. if SupplierTypeCode != "" {
  372. where = where + " and b.SupplierTypeCode ='" + SupplierTypeCode + "'"
  373. }
  374. if OperType != "" {
  375. where = where + " and a.OperType like '%" + OperType + "%'"
  376. }
  377. if SpecTypeCode != "" {
  378. where = where + " and a.SpecTypeCode = '" + SpecTypeCode + "'"
  379. }
  380. if Country != "" {
  381. where = where + " and a.Country like '%" + Country + "%'"
  382. }
  383. if InStyle != "" {
  384. where = where + " and b.InStyle ='" + InStyle + "'"
  385. }
  386. if MgrUnit != "" {
  387. where = where + " and a.MgrUnit like '%" + MgrUnit + "%'"
  388. }
  389. if PACNumber != "" {
  390. where = where + " and a.PACNumber ='" + PACNumber + "'"
  391. }
  392. if CommercialNo != "" {
  393. where = where + " and a.CommercialNo ='" + CommercialNo + "'"
  394. }
  395. if Province != "" {
  396. where = where + " and a.Province ='" + Province + "'"
  397. }
  398. if City != "" {
  399. where = where + " and a.City ='" + City + "'"
  400. }
  401. if Street != "" {
  402. where = where + " and a.Street ='" + Street + "'"
  403. }
  404. if Address != "" {
  405. where = where + " and a.Address ='" + Address + "'"
  406. }
  407. if LinkProvince != "" {
  408. where = where + " and a.LinkProvince ='" + LinkProvince + "'"
  409. }
  410. if LinkCity != "" {
  411. where = where + " and a.LinkCity ='" + LinkCity + "'"
  412. }
  413. if LinkStreet != "" {
  414. where = where + " and a.LinkStreet ='" + LinkStreet + "'"
  415. }
  416. if LinkAddress != "" {
  417. where = where + " and a.LinkAddress ='" + LinkAddress + "'"
  418. }
  419. if LegalPerson != "" {
  420. where = where + " and a.LegalPerson ='" + LegalPerson + "'"
  421. }
  422. if ContactName != "" {
  423. where = where + " and a.ContactName ='" + ContactName + "'"
  424. }
  425. if CompanyType != "" {
  426. where = where + " and a.CompanyType like '%" + CompanyType + "%'"
  427. }
  428. if SetupTime != "" {
  429. where = where + " and a.SetupTime ='" + SetupTime + "'"
  430. }
  431. //注册资金范围
  432. if RegCapital1 != "" {
  433. where = where + " and a.RegCapital >= '" + RegCapital1 + "'"
  434. }
  435. if RegCapital2 != "" {
  436. where = where + " and a.RegCapital <= '" + RegCapital2 + "'"
  437. }
  438. if BusinessScope != "" {
  439. where = where + " and a.BusinessScope like '%" + BusinessScope + "%'"
  440. }
  441. //企业用户只看自己的数据记录
  442. /*parameterSvc := baseparameter.GetBaseparameterService(utils.DBE) //取出外部门ID
  443. extOrganizeId := parameterSvc.GetBaseparameterMessage("GFGL", "paramset", "ExtOrganizeId")
  444. if extOrganizeId == this.User.DepartmentId {
  445. where = where + " and a.CreateUserId = '" + this.User.Id + "'"
  446. }*/
  447. svc := supplier.GetOilSupplierService(utils.DBE)
  448. var registerUser register.OilCorporateInfo
  449. sql := " UserName='" + this.User.Username + "' and CheckStatus = 11"
  450. svc.GetEntity(&registerUser, sql)
  451. //企业用户必须加创建人条件
  452. if this.User.IsCompanyUser == 1 {
  453. where = where + " and (a.CreateUserId = '" + this.User.Id + "' or a.CommercialNo='" + registerUser.CommercialNo + "')"
  454. } else {
  455. //超级管理员和有查看所有数据权限的用户不加条件
  456. svcPerm := permission.GetPermissionService(utils.DBE)
  457. isauth := svcPerm.IsAuthorized(this.User.Id, "oil_supplier.marketAccess.AllRecord")
  458. if !svcPerm.IsAdmin(this.User.Id) && !isauth {
  459. where = where + " and b.CreateUserId = '" + this.User.Id + "'"
  460. }
  461. }
  462. var list []supplier.OilSupplierView
  463. total := svc.GetMyPagingEntitiesWithOrderBytbl(OilSupplierName, OilSupplierCertName, page.CurrentPage, page.Size, orderby, asc, &list, where)
  464. var datainfo DataInfo
  465. datainfo.Items = list
  466. datainfo.CurrentItemCount = total
  467. datainfo.PageIndex = page.CurrentPage
  468. datainfo.ItemsPerPage = page.Size
  469. this.Data["json"] = &datainfo
  470. this.ServeJSON()
  471. }
  472. // @Title 获取集中评审列表
  473. // @Description get user by token
  474. // @Success 200 {object} []supplier.OilSupplier
  475. // @router /jzps_certlist [get]
  476. func (this *OilSupplierController) GetJZPSJoinCertEntityList() {
  477. //获取分页信息
  478. page := this.GetPageInfoForm()
  479. where := " 1=1 "
  480. orderby := "Id"
  481. asc := false
  482. Order := this.GetString("Order")
  483. Prop := this.GetString("Prop")
  484. if Order != "" && Prop != "" {
  485. orderby = Prop
  486. if Order == "asc" {
  487. asc = true
  488. }
  489. }
  490. SupplierName := this.GetString("SupplierName")
  491. SupplierTypeName := this.GetString("SupplierTypeName")
  492. CreateOn := this.GetString("CreateOn")
  493. SupplierTypeCode := this.GetString("SupplierTypeCode")
  494. OperType := this.GetString("OperType")
  495. SpecTypeCode := this.GetString("SpecTypeCode")
  496. Country := this.GetString("Country")
  497. InStyle := this.GetString("InStyle")
  498. MgrUnit := this.GetString("MgrUnit")
  499. PACNumber := this.GetString("PACNumber")
  500. CommercialNo := this.GetString("CommercialNo")
  501. Province := this.GetString("Province")
  502. City := this.GetString("City")
  503. Street := this.GetString("Street")
  504. Address := this.GetString("Address")
  505. LinkProvince := this.GetString("LinkProvince")
  506. LinkCity := this.GetString("LinkCity")
  507. LinkStreet := this.GetString("LinkStreet")
  508. LinkAddress := this.GetString("LinkAddress")
  509. LegalPerson := this.GetString("LegalPerson")
  510. ContactName := this.GetString("ContactName")
  511. CompanyType := this.GetString("CompanyType")
  512. SetupTime := this.GetString("SetupTime")
  513. RegCapital1 := this.GetString("RegCapital1")
  514. RegCapital2 := this.GetString("RegCapital2")
  515. BusinessScope := this.GetString("BusinessScope")
  516. RecUnitName := this.GetString("RecUnitName")
  517. RecUnitId := this.GetString("RecUnitId")
  518. ThirdAudit := this.GetString("ThirdAudit")
  519. if SupplierName != "" {
  520. where = where + " and a.SupplierName like '%" + SupplierName + "%'"
  521. }
  522. if SupplierTypeName != "" {
  523. where = where + " and b.SupplierTypeName like '%" + SupplierTypeName + "%'"
  524. }
  525. if CreateOn != "" {
  526. dates := strings.Split(CreateOn, ",")
  527. if len(dates) == 2 {
  528. minDate := dates[0]
  529. maxDate := dates[1]
  530. where = where + " and b.CreateOn>='" + minDate + "' and b.CreateOn<='" + maxDate + "'"
  531. }
  532. }
  533. if SupplierTypeCode != "" {
  534. where = where + " and b.SupplierTypeCode ='" + SupplierTypeCode + "'"
  535. }
  536. if OperType != "" {
  537. where = where + " and a.OperType like '%" + OperType + "%'"
  538. }
  539. if SpecTypeCode != "" {
  540. where = where + " and a.SpecTypeCode = '" + SpecTypeCode + "'"
  541. }
  542. if Country != "" {
  543. where = where + " and a.Country like '%" + Country + "%'"
  544. }
  545. if InStyle != "" {
  546. where = where + " and b.InStyle ='" + InStyle + "'"
  547. }
  548. if MgrUnit != "" {
  549. where = where + " and a.MgrUnit like '%" + MgrUnit + "%'"
  550. }
  551. if PACNumber != "" {
  552. where = where + " and a.PACNumber ='" + PACNumber + "'"
  553. }
  554. if CommercialNo != "" {
  555. where = where + " and a.CommercialNo ='" + CommercialNo + "'"
  556. }
  557. if Province != "" {
  558. where = where + " and a.Province ='" + Province + "'"
  559. }
  560. if City != "" {
  561. where = where + " and a.City ='" + City + "'"
  562. }
  563. if Street != "" {
  564. where = where + " and a.Street ='" + Street + "'"
  565. }
  566. if Address != "" {
  567. where = where + " and a.Address ='" + Address + "'"
  568. }
  569. if LinkProvince != "" {
  570. where = where + " and a.LinkProvince ='" + LinkProvince + "'"
  571. }
  572. if LinkCity != "" {
  573. where = where + " and a.LinkCity ='" + LinkCity + "'"
  574. }
  575. if LinkStreet != "" {
  576. where = where + " and a.LinkStreet ='" + LinkStreet + "'"
  577. }
  578. if LinkAddress != "" {
  579. where = where + " and a.LinkAddress ='" + LinkAddress + "'"
  580. }
  581. if LegalPerson != "" {
  582. where = where + " and a.LegalPerson ='" + LegalPerson + "'"
  583. }
  584. if ContactName != "" {
  585. where = where + " and a.ContactName ='" + ContactName + "'"
  586. }
  587. if CompanyType != "" {
  588. where = where + " and a.CompanyType like '%" + CompanyType + "%'"
  589. }
  590. if SetupTime != "" {
  591. where = where + " and a.SetupTime ='" + SetupTime + "'"
  592. }
  593. //注册资金范围
  594. if RegCapital1 != "" {
  595. where = where + " and a.RegCapital >= '" + RegCapital1 + "'"
  596. }
  597. if RegCapital2 != "" {
  598. where = where + " and a.RegCapital <= '" + RegCapital2 + "'"
  599. }
  600. if BusinessScope != "" {
  601. where = where + " and a.BusinessScope like '%" + BusinessScope + "%'"
  602. }
  603. if RecUnitName != "" {
  604. where = where + " and b.RecUnitName like '%" + RecUnitName + "%'"
  605. }
  606. if RecUnitId != "" {
  607. where = where + " and b.RecUnitId = '" + RecUnitId + "' "
  608. }
  609. if ThirdAudit != "" {
  610. where = where + " and b.ThirdAudit = '" + ThirdAudit + "' "
  611. }
  612. status := this.GetString("Status")
  613. if status != "" {
  614. where = where + " and b.Status='" + status + "'"
  615. }
  616. //企业用户必须加创建人条件
  617. if this.User.IsCompanyUser == 1 {
  618. where = where + " and a.CreateUserId = '" + this.User.Id + "'"
  619. } else {
  620. //超级管理员和有查看所有数据权限的用户不加条件
  621. svcPerm := permission.GetPermissionService(utils.DBE)
  622. isauth := svcPerm.IsAuthorized(this.User.Id, "oil_supplier.marketAccess.AllRecord")
  623. if !svcPerm.IsAdmin(this.User.Id) && !isauth {
  624. //根据工作流查找
  625. //集中评审相关人可看数据
  626. actisvc := workflow.GetActivitiService(utils.DBE)
  627. //找出待办任务===准入
  628. var certIdList string
  629. ids := actisvc.GetAllMyTasks(workflow.OIL_ENUSER_SUPPLIER_APPLY, this.User.Id)
  630. if len(strings.Trim(ids, ",")) > 0 {
  631. certIdList += strings.Trim(ids, ",") + ","
  632. }
  633. certIdList = strings.Trim(certIdList, ",")
  634. certIdarr := strings.Split(certIdList, ",")
  635. for i, item := range certIdarr {
  636. idx := strings.Index(item, "-")
  637. if idx >= 0 {
  638. certIdarr[i] = strings.Split(item, "-")[0]
  639. }
  640. }
  641. certIdList = strings.Join(certIdarr, ",")
  642. if certIdList != "" {
  643. where += " and ( b.Id in (" + certIdList + ")" + " or a.CreateUserId = '" + this.User.Id + "')"
  644. } else {
  645. where = where + " and a.CreateUserId = '" + this.User.Id + "'"
  646. }
  647. }
  648. }
  649. svc := supplier.GetOilSupplierService(utils.DBE)
  650. var list []supplier.OilSupplierView1
  651. //total := svc.GetMyPagingEntitiesWithOrderBytbl(OilSupplierName, OilSupplierCertName, page.CurrentPage, page.Size, orderby, asc, &list, where)
  652. total := svc.GetMyPagingEntitiesWithOrderBytbl3(OilSupplierName, OilSupplierCertName, page.CurrentPage, page.Size, orderby, asc, &list, where)
  653. var datainfo DataInfo
  654. datainfo.Items = list
  655. datainfo.CurrentItemCount = total
  656. datainfo.PageIndex = page.CurrentPage
  657. datainfo.ItemsPerPage = page.Size
  658. this.Data["json"] = &datainfo
  659. this.ServeJSON()
  660. }
  661. // @Title 集中评审列表导出
  662. // @Description get user by token
  663. // @Success 200 {object} []supplier.OilSupplier
  664. // @router /jzpsListExport [get]
  665. func (this *OilSupplierController) JzpsListExport() {
  666. where := " 1=1 "
  667. SupplierName := this.GetString("SupplierName")
  668. SupplierTypeName := this.GetString("SupplierTypeName")
  669. CreateOn := this.GetString("CreateOn")
  670. SupplierTypeCode := this.GetString("SupplierTypeCode")
  671. OperType := this.GetString("OperType")
  672. SpecTypeCode := this.GetString("SpecTypeCode")
  673. Country := this.GetString("Country")
  674. InStyle := this.GetString("InStyle")
  675. MgrUnit := this.GetString("MgrUnit")
  676. PACNumber := this.GetString("PACNumber")
  677. CommercialNo := this.GetString("CommercialNo")
  678. Province := this.GetString("Province")
  679. City := this.GetString("City")
  680. Street := this.GetString("Street")
  681. Address := this.GetString("Address")
  682. LinkProvince := this.GetString("LinkProvince")
  683. LinkCity := this.GetString("LinkCity")
  684. LinkStreet := this.GetString("LinkStreet")
  685. LinkAddress := this.GetString("LinkAddress")
  686. LegalPerson := this.GetString("LegalPerson")
  687. ContactName := this.GetString("ContactName")
  688. CompanyType := this.GetString("CompanyType")
  689. SetupTime := this.GetString("SetupTime")
  690. RegCapital1 := this.GetString("RegCapital1")
  691. RegCapital2 := this.GetString("RegCapital2")
  692. BusinessScope := this.GetString("BusinessScope")
  693. RecUnitName := this.GetString("RecUnitName")
  694. RecUnitId := this.GetString("RecUnitId")
  695. ThirdAudit := this.GetString("ThirdAudit")
  696. if SupplierName != "" {
  697. where = where + " and a.SupplierName like '%" + SupplierName + "%'"
  698. }
  699. if SupplierTypeName != "" {
  700. where = where + " and b.SupplierTypeName like '%" + SupplierTypeName + "%'"
  701. }
  702. if CreateOn != "" {
  703. dates := strings.Split(CreateOn, ",")
  704. if len(dates) == 2 {
  705. minDate := dates[0]
  706. maxDate := dates[1]
  707. where = where + " and b.CreateOn>='" + minDate + "' and b.CreateOn<='" + maxDate + "'"
  708. }
  709. }
  710. if SupplierTypeCode != "" {
  711. where = where + " and b.SupplierTypeCode ='" + SupplierTypeCode + "'"
  712. }
  713. if OperType != "" {
  714. where = where + " and a.OperType like '%" + OperType + "%'"
  715. }
  716. if SpecTypeCode != "" {
  717. where = where + " and a.SpecTypeCode = '" + SpecTypeCode + "'"
  718. }
  719. if Country != "" {
  720. where = where + " and a.Country like '%" + Country + "%'"
  721. }
  722. if InStyle != "" {
  723. where = where + " and b.InStyle ='" + InStyle + "'"
  724. }
  725. if MgrUnit != "" {
  726. where = where + " and a.MgrUnit like '%" + MgrUnit + "%'"
  727. }
  728. if PACNumber != "" {
  729. where = where + " and a.PACNumber ='" + PACNumber + "'"
  730. }
  731. if CommercialNo != "" {
  732. where = where + " and a.CommercialNo ='" + CommercialNo + "'"
  733. }
  734. if Province != "" {
  735. where = where + " and a.Province ='" + Province + "'"
  736. }
  737. if City != "" {
  738. where = where + " and a.City ='" + City + "'"
  739. }
  740. if Street != "" {
  741. where = where + " and a.Street ='" + Street + "'"
  742. }
  743. if Address != "" {
  744. where = where + " and a.Address ='" + Address + "'"
  745. }
  746. if LinkProvince != "" {
  747. where = where + " and a.LinkProvince ='" + LinkProvince + "'"
  748. }
  749. if LinkCity != "" {
  750. where = where + " and a.LinkCity ='" + LinkCity + "'"
  751. }
  752. if LinkStreet != "" {
  753. where = where + " and a.LinkStreet ='" + LinkStreet + "'"
  754. }
  755. if LinkAddress != "" {
  756. where = where + " and a.LinkAddress ='" + LinkAddress + "'"
  757. }
  758. if LegalPerson != "" {
  759. where = where + " and a.LegalPerson ='" + LegalPerson + "'"
  760. }
  761. if ContactName != "" {
  762. where = where + " and a.ContactName ='" + ContactName + "'"
  763. }
  764. if CompanyType != "" {
  765. where = where + " and a.CompanyType like '%" + CompanyType + "%'"
  766. }
  767. if SetupTime != "" {
  768. where = where + " and a.SetupTime ='" + SetupTime + "'"
  769. }
  770. //注册资金范围
  771. if RegCapital1 != "" {
  772. where = where + " and a.RegCapital >= '" + RegCapital1 + "'"
  773. }
  774. if RegCapital2 != "" {
  775. where = where + " and a.RegCapital <= '" + RegCapital2 + "'"
  776. }
  777. if BusinessScope != "" {
  778. where = where + " and a.BusinessScope like '%" + BusinessScope + "%'"
  779. }
  780. if RecUnitName != "" {
  781. where = where + " and b.RecUnitName like '%" + RecUnitName + "%'"
  782. }
  783. if RecUnitId != "" {
  784. where = where + " and b.RecUnitId = '" + RecUnitId + "' "
  785. }
  786. if ThirdAudit != "" {
  787. where = where + " and b.ThirdAudit = '" + ThirdAudit + "' "
  788. }
  789. status := this.GetString("Status")
  790. if status != "" {
  791. where = where + " and b.Status='" + status + "'"
  792. }
  793. //企业用户必须加创建人条件
  794. if this.User.IsCompanyUser == 1 {
  795. where = where + " and a.CreateUserId = '" + this.User.Id + "'"
  796. } else {
  797. //超级管理员和有查看所有数据权限的用户不加条件
  798. svcPerm := permission.GetPermissionService(utils.DBE)
  799. isauth := svcPerm.IsAuthorized(this.User.Id, "oil_supplier.marketAccess.AllRecord")
  800. if !svcPerm.IsAdmin(this.User.Id) && !isauth {
  801. //根据工作流查找
  802. //集中评审相关人可看数据
  803. actisvc := workflow.GetActivitiService(utils.DBE)
  804. //找出待办任务===准入
  805. var certIdList string
  806. ids := actisvc.GetAllMyTasks(workflow.OIL_ENUSER_SUPPLIER_APPLY, this.User.Id)
  807. if len(strings.Trim(ids, ",")) > 0 {
  808. certIdList += strings.Trim(ids, ",") + ","
  809. }
  810. certIdList = strings.Trim(certIdList, ",")
  811. certIdarr := strings.Split(certIdList, ",")
  812. for i, item := range certIdarr {
  813. idx := strings.Index(item, "-")
  814. if idx >= 0 {
  815. certIdarr[i] = strings.Split(item, "-")[0]
  816. }
  817. }
  818. certIdList = strings.Join(certIdarr, ",")
  819. if certIdList != "" {
  820. where += " and ( b.Id in (" + certIdList + ")" + " or a.CreateUserId = '" + this.User.Id + "')"
  821. } else {
  822. where = where + " and a.CreateUserId = '" + this.User.Id + "'"
  823. }
  824. }
  825. }
  826. svc := supplier.GetOilSupplierService(utils.DBE)
  827. var list []supplier.OilSupplierExport
  828. svc.GetMyPagingEntitiesWithOrderBytblExport(OilSupplierName, OilSupplierCertName, &list, where)
  829. fileTitle := "集中评审"
  830. showColumnArr := "序号,审核状态,企业名称,准入类别,审核处室,推荐单位,法人,工商注册号,注册资本,币种,公司类型,成立时间,手机号,准入范围"
  831. f := xlsx.NewFile()
  832. sheet, _ := f.AddSheet(fileTitle)
  833. cellName := strings.Split(showColumnArr, ",")
  834. row := sheet.AddRow()
  835. row.WriteSlice(&cellName, -1)
  836. for idx, item := range list {
  837. var certSubList []suppliercertsub.OilSupplierCertSub
  838. svc.GetEntitysByWhere(OilSupplierCertSubName, "SupplierCertId = "+strconv.Itoa(item.CertId), &certSubList)
  839. subName := ""
  840. for _, certSub := range certSubList {
  841. subName += "," + certSub.Name
  842. }
  843. regCapital := strconv.FormatFloat(item.RegCapital, 'f', 2, 64)
  844. currency := "人民币"
  845. if item.Currency == "人民币元" {
  846. currency = "人民币"
  847. }
  848. if item.Currency == "JPY" {
  849. currency = "日元"
  850. }
  851. if item.Currency == "USD" {
  852. currency = "美元"
  853. }
  854. if item.Currency == "EUR" {
  855. currency = "欧元"
  856. }
  857. dataString := strconv.Itoa(idx+1) + "+待集中评审+" + item.SupplierName + "+" + item.SupplierTypeName + "+" + item.FullName + "+" + item.RecUnitName + "+" + item.LegalPerson + "+" + item.CommercialNo + "+" +
  858. regCapital + "+" + currency + "+" + item.CompanyType + "+" + utils.ToStr(item.SetupTime.Format("2006-01-02")) + "+" + item.Mobile + "+" + strings.TrimLeft(subName, ",")
  859. cellName := strings.Split(dataString, "+")
  860. row := sheet.AddRow()
  861. row.WriteSlice(&cellName, -1)
  862. }
  863. for c, cl := 0, len(sheet.Cols); c < cl; c++ {
  864. sheet.Cols[c].Width = 30
  865. }
  866. dir := "static/file/excel/report/" + this.GetAccode()
  867. SaveDirectory(dir)
  868. path := dir + "/" + utils.TimeFormat(time.Now(), "20060102") + fileTitle + ".xlsx"
  869. f.Save(path)
  870. var sw *Seaweed
  871. var filer []string
  872. if _filer := os.Getenv("GOSWFS_FILER_URL"); _filer != "" {
  873. filer = []string{_filer}
  874. }
  875. sw = NewSeaweed("http", utils.Cfg.MustValue("file", "upFileHost"), filer, 2*1024*1024, 5*time.Minute)
  876. _, _, fID, _ := sw.UploadFile(path, "", "")
  877. retDocUrl := utils.Cfg.MustValue("file", "downFileHost") + "/" + fID
  878. os.Remove(path)
  879. fmt.Println("==retDocWatermarkUrl==", retDocUrl)
  880. this.Data["json"] = retDocUrl
  881. this.ServeJSON()
  882. }
  883. // @Title 企业入库列表
  884. // @Description get user by token
  885. // @Success 200 {object} []supplier.OilSupplier
  886. // @router /storelist [get]
  887. func (this *OilSupplierController) GetJoinStoreEntityList() {
  888. //获取分页信息
  889. page := this.GetPageInfoForm()
  890. where := " 1=1 "
  891. orderby := "Id"
  892. asc := false
  893. Order := this.GetString("Order")
  894. Prop := this.GetString("Prop")
  895. if Order != "" && Prop != "" {
  896. orderby = Prop
  897. if Order == "asc" {
  898. asc = true
  899. }
  900. }
  901. SupplierName := this.GetString("SupplierName")
  902. Grade := this.GetString("Grade")
  903. SupplierTypeName := this.GetString("SupplierTypeName")
  904. CreateOn := this.GetString("CreateOn")
  905. SupplierTypeCode := this.GetString("SupplierTypeCode")
  906. OperType := this.GetString("OperType")
  907. SpecTypeCode := this.GetString("SpecTypeCode")
  908. Country := this.GetString("Country")
  909. InStyle := this.GetString("InStyle")
  910. MgrUnit := this.GetString("MgrUnit")
  911. PACNumber := this.GetString("PACNumber")
  912. CommercialNo := this.GetString("CommercialNo")
  913. Province := this.GetString("Province")
  914. City := this.GetString("City")
  915. Street := this.GetString("Street")
  916. Address := this.GetString("Address")
  917. LinkProvince := this.GetString("LinkProvince")
  918. LinkCity := this.GetString("LinkCity")
  919. LinkStreet := this.GetString("LinkStreet")
  920. LinkAddress := this.GetString("LinkAddress")
  921. LegalPerson := this.GetString("LegalPerson")
  922. ContactName := this.GetString("ContactName")
  923. CompanyType := this.GetString("CompanyType")
  924. SetupTime := this.GetString("SetupTime")
  925. RegCapital1 := this.GetString("RegCapital1")
  926. RegCapital2 := this.GetString("RegCapital2")
  927. BusinessScope := this.GetString("BusinessScope")
  928. Code := this.GetString("Code")
  929. InFlag := this.GetString("InFlag")
  930. if SupplierName != "" {
  931. where = where + " and a.SupplierName like '%" + SupplierName + "%'"
  932. }
  933. if Grade != "" {
  934. where = where + " and a.Grade = '" + Grade + "'"
  935. }
  936. if SupplierTypeName != "" {
  937. where = where + " and b.SupplierTypeName like '%" + SupplierTypeName + "%'"
  938. }
  939. if CreateOn != "" {
  940. dates := strings.Split(CreateOn, ",")
  941. if len(dates) == 2 {
  942. minDate := dates[0]
  943. maxDate := dates[1]
  944. where = where + " and b.CreateOn>='" + minDate + "' and b.CreateOn<='" + maxDate + "'"
  945. }
  946. }
  947. if SupplierTypeCode != "" {
  948. where = where + " and b.SupplierTypeCode ='" + SupplierTypeCode + "'"
  949. }
  950. if OperType != "" {
  951. where = where + " and a.OperType like '%" + OperType + "%'"
  952. }
  953. if SpecTypeCode != "" {
  954. where = where + " and a.SpecTypeCode = '" + SpecTypeCode + "'"
  955. }
  956. if Country != "" {
  957. where = where + " and a.Country like '%" + Country + "%'"
  958. }
  959. if InStyle != "" {
  960. where = where + " and b.InStyle ='" + InStyle + "'"
  961. }
  962. if MgrUnit != "" {
  963. where = where + " and a.MgrUnit like '%" + MgrUnit + "%'"
  964. }
  965. if PACNumber != "" {
  966. where = where + " and a.PACNumber ='" + PACNumber + "'"
  967. }
  968. if CommercialNo != "" {
  969. where = where + " and a.CommercialNo ='" + CommercialNo + "'"
  970. }
  971. if Province != "" {
  972. where = where + " and a.Province ='" + Province + "'"
  973. }
  974. if City != "" {
  975. where = where + " and a.City ='" + City + "'"
  976. }
  977. if Street != "" {
  978. where = where + " and a.Street ='" + Street + "'"
  979. }
  980. if Address != "" {
  981. where = where + " and a.Address ='" + Address + "'"
  982. }
  983. if LinkProvince != "" {
  984. where = where + " and a.LinkProvince ='" + LinkProvince + "'"
  985. }
  986. if LinkCity != "" {
  987. where = where + " and a.LinkCity ='" + LinkCity + "'"
  988. }
  989. if LinkStreet != "" {
  990. where = where + " and a.LinkStreet ='" + LinkStreet + "'"
  991. }
  992. if LinkAddress != "" {
  993. where = where + " and a.LinkAddress ='" + LinkAddress + "'"
  994. }
  995. if LegalPerson != "" {
  996. where = where + " and a.LegalPerson ='" + LegalPerson + "'"
  997. }
  998. if ContactName != "" {
  999. where = where + " and a.ContactName ='" + ContactName + "'"
  1000. }
  1001. if CompanyType != "" {
  1002. where = where + " and a.CompanyType like '%" + CompanyType + "%'"
  1003. }
  1004. if SetupTime != "" {
  1005. where = where + " and a.SetupTime ='" + SetupTime + "'"
  1006. }
  1007. //注册资金范围
  1008. if RegCapital1 != "" {
  1009. where = where + " and a.RegCapital >= '" + RegCapital1 + "'"
  1010. }
  1011. if RegCapital2 != "" {
  1012. where = where + " and a.RegCapital <= '" + RegCapital2 + "'"
  1013. }
  1014. if BusinessScope != "" {
  1015. where = where + " and a.BusinessScope like '%" + BusinessScope + "%'"
  1016. }
  1017. status := this.GetString("Status")
  1018. if status != "" {
  1019. where = where + " and b.Status='" + status + "'"
  1020. }
  1021. if InFlag != "" {
  1022. where = where + " and b.InFlag='" + InFlag + "'"
  1023. }
  1024. //企业用户只看自己的数据记录
  1025. /*parameterSvc := baseparameter.GetBaseparameterService(utils.DBE) //取出外部门ID
  1026. extOrganizeId := parameterSvc.GetBaseparameterMessage("GFGL", "paramset", "ExtOrganizeId")
  1027. if extOrganizeId == this.User.DepartmentId {
  1028. where = where + " and a.CreateUserId = '" + this.User.Id + "'"
  1029. }*/
  1030. //企业用户必须加创建人条件
  1031. if this.User.IsCompanyUser == 1 {
  1032. where = where + " and a.CreateUserId = '" + this.User.Id + "'"
  1033. }
  1034. svc := supplier.GetOilSupplierService(utils.DBE)
  1035. var list []supplier.OilSupplierView
  1036. var Ids supplier.OilCertIds
  1037. if Code != "" {
  1038. where1 := " SupplierTypeCode = '" + SupplierTypeCode + "' and Code like '" + Code + "%'"
  1039. svc.GetCertIds(&Ids, where1)
  1040. }
  1041. total := svc.GetMyPagingEntitiesWithOrderBytbl2(OilSupplierName, OilSupplierCertName, page.CurrentPage, page.Size, orderby, asc, &list, where, Code, Ids.Ids)
  1042. var datainfo DataInfo
  1043. datainfo.Items = list
  1044. datainfo.CurrentItemCount = total
  1045. datainfo.PageIndex = page.CurrentPage
  1046. datainfo.ItemsPerPage = page.Size
  1047. this.Data["json"] = &datainfo
  1048. this.ServeJSON()
  1049. }
  1050. // @Title 获取列表
  1051. // @Description get user by token
  1052. // @Success 200 {object} []supplier.OilSupplierView
  1053. // @router /mytasks [get]
  1054. func (this *OilSupplierController) GetMyTaskEntityList() {
  1055. //获取分页信息
  1056. page := this.GetPageInfoForm()
  1057. where := " 1=1 "
  1058. orderby := "Id"
  1059. asc := false
  1060. Order := this.GetString("Order")
  1061. //Statustype := this.GetString("Statustype")
  1062. //if Statustype != "" {
  1063. // where = " 1=1 and b.Status =" + Statustype
  1064. //}
  1065. where = where + " and b.Status>0"
  1066. Prop := this.GetString("Prop")
  1067. if Order != "" && Prop != "" {
  1068. orderby = Prop
  1069. if Order == "asc" {
  1070. asc = true
  1071. }
  1072. }
  1073. Id := this.GetString("Id")
  1074. SupplierName := this.GetString("SupplierName")
  1075. OilCertificateNo := this.GetString("OilCertificateNo")
  1076. Grade := this.GetString("Grade")
  1077. MgrUnit := this.GetString("MgrUnit")
  1078. OperType := this.GetString("OperType")
  1079. Country := this.GetString("Country")
  1080. MaunAgent := this.GetString("MaunAgent")
  1081. ConstructTeam := this.GetString("ConstructTeam")
  1082. CommercialNo := this.GetString("CommercialNo")
  1083. OrganCode := this.GetString("OrganCode")
  1084. CountryTaxNo := this.GetString("CountryTaxNo")
  1085. LocalTaxNo := this.GetString("LocalTaxNo")
  1086. Address := this.GetString("Address")
  1087. Province := this.GetString("Province")
  1088. City := this.GetString("City")
  1089. Street := this.GetString("Street")
  1090. HouseNo := this.GetString("HouseNo")
  1091. ZipCode := this.GetString("ZipCode")
  1092. QualitySystemCert := this.GetString("QualitySystemCert")
  1093. ProductQualityCert := this.GetString("ProductQualityCert")
  1094. MaunLicense := this.GetString("MaunLicense")
  1095. QualifCert := this.GetString("QualifCert")
  1096. QualifCertLevel := this.GetString("QualifCertLevel")
  1097. SafetyLicense := this.GetString("SafetyLicense")
  1098. TechServiceLic := this.GetString("TechServiceLic")
  1099. TJInNotify := this.GetString("TJInNotify")
  1100. SpecIndustryCert := this.GetString("SpecIndustryCert")
  1101. LegalPerson := this.GetString("LegalPerson")
  1102. CategoryCode := this.GetString("CategoryCode")
  1103. CategoryName := this.GetString("CategoryName")
  1104. RegCapital := this.GetString("RegCapital")
  1105. Currency := this.GetString("Currency")
  1106. ContactName := this.GetString("ContactName")
  1107. CompanyType := this.GetString("CompanyType")
  1108. SetupTime := this.GetString("SetupTime")
  1109. DepositBank := this.GetString("DepositBank")
  1110. BankAccount := this.GetString("BankAccount")
  1111. EMail := this.GetString("EMail")
  1112. BankCreditRating := this.GetString("BankCreditRating")
  1113. Mobile := this.GetString("Mobile")
  1114. Telphone := this.GetString("Telphone")
  1115. Fax := this.GetString("Fax")
  1116. CompanyTel := this.GetString("CompanyTel")
  1117. QQ := this.GetString("QQ")
  1118. CompanyUrl := this.GetString("CompanyUrl")
  1119. SpecSupplier := this.GetString("SpecSupplier")
  1120. SpecTypeCode := this.GetString("SpecTypeCode")
  1121. SpecTypeName := this.GetString("SpecTypeName")
  1122. Remark := this.GetString("Remark")
  1123. CreateOn := this.GetString("CreateOn")
  1124. SupplierTypeCode := this.GetString("SupplierTypeCode")
  1125. if Id != "" {
  1126. where = where + " and a.Id like '%" + Id + "%'"
  1127. }
  1128. if SupplierName != "" {
  1129. where = where + " and a.SupplierName like '%" + SupplierName + "%'"
  1130. }
  1131. if OilCertificateNo != "" {
  1132. where = where + " and a.OilCertificateNo like '%" + OilCertificateNo + "%'"
  1133. }
  1134. if Grade != "" {
  1135. where = where + " and a.Grade like '%" + Grade + "%'"
  1136. }
  1137. if MgrUnit != "" {
  1138. where = where + " and a.MgrUnit like '%" + MgrUnit + "%'"
  1139. }
  1140. if OperType != "" {
  1141. where = where + " and a.OperType like '%" + OperType + "%'"
  1142. }
  1143. if Country != "" {
  1144. where = where + " and a.Country like '%" + Country + "%'"
  1145. }
  1146. if MaunAgent != "" {
  1147. where = where + " and a.MaunAgent like '%" + MaunAgent + "%'"
  1148. }
  1149. if ConstructTeam != "" {
  1150. where = where + " and a.ConstructTeam like '%" + ConstructTeam + "%'"
  1151. }
  1152. if CommercialNo != "" {
  1153. where = where + " and a.CommercialNo like '%" + CommercialNo + "%'"
  1154. }
  1155. if OrganCode != "" {
  1156. where = where + " and a.OrganCode like '%" + OrganCode + "%'"
  1157. }
  1158. if CountryTaxNo != "" {
  1159. where = where + " and a.CountryTaxNo like '%" + CountryTaxNo + "%'"
  1160. }
  1161. if LocalTaxNo != "" {
  1162. where = where + " and a.LocalTaxNo like '%" + LocalTaxNo + "%'"
  1163. }
  1164. if Address != "" {
  1165. where = where + " and a.Address like '%" + Address + "%'"
  1166. }
  1167. if Province != "" {
  1168. where = where + " and a.Province like '%" + Province + "%'"
  1169. }
  1170. if City != "" {
  1171. where = where + " and a.City like '%" + City + "%'"
  1172. }
  1173. if Street != "" {
  1174. where = where + " and a.Street like '%" + Street + "%'"
  1175. }
  1176. if HouseNo != "" {
  1177. where = where + " and a.HouseNo like '%" + HouseNo + "%'"
  1178. }
  1179. if ZipCode != "" {
  1180. where = where + " and a.ZipCode like '%" + ZipCode + "%'"
  1181. }
  1182. if QualitySystemCert != "" {
  1183. where = where + " and a.QualitySystemCert like '%" + QualitySystemCert + "%'"
  1184. }
  1185. if ProductQualityCert != "" {
  1186. where = where + " and a.ProductQualityCert like '%" + ProductQualityCert + "%'"
  1187. }
  1188. if MaunLicense != "" {
  1189. where = where + " and a.MaunLicense like '%" + MaunLicense + "%'"
  1190. }
  1191. if QualifCert != "" {
  1192. where = where + " and a.QualifCert like '%" + QualifCert + "%'"
  1193. }
  1194. if QualifCertLevel != "" {
  1195. where = where + " and a.QualifCertLevel like '%" + QualifCertLevel + "%'"
  1196. }
  1197. if SafetyLicense != "" {
  1198. where = where + " and a.SafetyLicense like '%" + SafetyLicense + "%'"
  1199. }
  1200. if TechServiceLic != "" {
  1201. where = where + " and a.TechServiceLic like '%" + TechServiceLic + "%'"
  1202. }
  1203. if TJInNotify != "" {
  1204. where = where + " and a.TJInNotify like '%" + TJInNotify + "%'"
  1205. }
  1206. if SpecIndustryCert != "" {
  1207. where = where + " and a.SpecIndustryCert like '%" + SpecIndustryCert + "%'"
  1208. }
  1209. if LegalPerson != "" {
  1210. where = where + " and a.LegalPerson like '%" + LegalPerson + "%'"
  1211. }
  1212. if CategoryCode != "" {
  1213. where = where + " and a.CategoryCode like '%" + CategoryCode + "%'"
  1214. }
  1215. if CategoryName != "" {
  1216. where = where + " and a.CategoryName like '%" + CategoryName + "%'"
  1217. }
  1218. if RegCapital != "" {
  1219. where = where + " and a.RegCapital like '%" + RegCapital + "%'"
  1220. }
  1221. if Currency != "" {
  1222. where = where + " and a.Currency like '%" + Currency + "%'"
  1223. }
  1224. if ContactName != "" {
  1225. where = where + " and a.ContactName like '%" + ContactName + "%'"
  1226. }
  1227. if CompanyType != "" {
  1228. where = where + " and a.CompanyType like '%" + CompanyType + "%'"
  1229. }
  1230. if SetupTime != "" {
  1231. where = where + " and a.SetupTime like '%" + SetupTime + "%'"
  1232. }
  1233. if DepositBank != "" {
  1234. where = where + " and a.DepositBank like '%" + DepositBank + "%'"
  1235. }
  1236. if BankAccount != "" {
  1237. where = where + " and a.BankAccount like '%" + BankAccount + "%'"
  1238. }
  1239. if EMail != "" {
  1240. where = where + " and a.EMail like '%" + EMail + "%'"
  1241. }
  1242. if BankCreditRating != "" {
  1243. where = where + " and a.BankCreditRating like '%" + BankCreditRating + "%'"
  1244. }
  1245. if Mobile != "" {
  1246. where = where + " and a.Mobile like '%" + Mobile + "%'"
  1247. }
  1248. if Telphone != "" {
  1249. where = where + " and a.Telphone like '%" + Telphone + "%'"
  1250. }
  1251. if Fax != "" {
  1252. where = where + " and a.Fax like '%" + Fax + "%'"
  1253. }
  1254. if CompanyTel != "" {
  1255. where = where + " and a.CompanyTel like '%" + CompanyTel + "%'"
  1256. }
  1257. if QQ != "" {
  1258. where = where + " and a.QQ like '%" + QQ + "%'"
  1259. }
  1260. if CompanyUrl != "" {
  1261. where = where + " and a.CompanyUrl like '%" + CompanyUrl + "%'"
  1262. }
  1263. if SpecSupplier != "" {
  1264. where = where + " and a.SpecSupplier like '%" + SpecSupplier + "%'"
  1265. }
  1266. if SpecTypeCode != "" {
  1267. where = where + " and a.SpecTypeCode like '%" + SpecTypeCode + "%'"
  1268. }
  1269. if SpecTypeName != "" {
  1270. where = where + " and a.SpecTypeName like '%" + SpecTypeName + "%'"
  1271. }
  1272. if Remark != "" {
  1273. where = where + " and a.Remark like '%" + Remark + "%'"
  1274. }
  1275. if CreateOn != "" {
  1276. dates := strings.Split(CreateOn, ",")
  1277. if len(dates) == 2 {
  1278. minDate := dates[0]
  1279. maxDate := dates[1]
  1280. where = where + " and a.CreateOn>='" + minDate + "' and a.CreateOn<='" + maxDate + "'"
  1281. }
  1282. }
  1283. if SupplierTypeCode != "" {
  1284. where = where + " and b.SupplierTypeCode = '" + SupplierTypeCode + "'"
  1285. }
  1286. //找出待办任务
  1287. actisvc := workflow.GetActivitiService(utils.DBE)
  1288. var certIdList string
  1289. str := actisvc.GetMyTasks(workflow.OIL_ENUSER_SUPPLIER_APPLY, this.User.Id)
  1290. if str != "" {
  1291. certIdList = str
  1292. certIdList = certIdList + ","
  1293. }
  1294. certIdList = strings.Trim(certIdList, ",")
  1295. certIdarr := strings.Split(certIdList, ",")
  1296. for i, item := range certIdarr {
  1297. idx := strings.Index(item, "-")
  1298. if idx >= 0 {
  1299. certIdarr[i] = strings.Split(item, "-")[0]
  1300. }
  1301. }
  1302. certIdList = strings.Join(certIdarr, ",")
  1303. var list []supplier.OilSupplierView
  1304. svc := supplier.GetOilSupplierService(utils.DBE)
  1305. var total int64 = 0
  1306. if certIdList != "" {
  1307. where += " and b.Id in (" + certIdList + ")"
  1308. total = svc.GetMyPagingEntitiesWithOrderBytbl(OilSupplierName, OilSupplierCertName, page.CurrentPage, page.Size, orderby, asc, &list, where)
  1309. }
  1310. //根据部门查询待办任务
  1311. var datainfo DataInfo
  1312. datainfo.Items = list
  1313. datainfo.CurrentItemCount = total
  1314. datainfo.PageIndex = page.CurrentPage
  1315. datainfo.ItemsPerPage = page.Size
  1316. this.Data["json"] = &datainfo
  1317. this.ServeJSON()
  1318. }
  1319. // @Title 获取字典列表
  1320. // @Description get user by token
  1321. // @Success 200 {object} map[string]interface{}
  1322. // @router /dictlist [get]
  1323. func (this *OilSupplierController) GetDictList() {
  1324. dictList := make(map[string]interface{})
  1325. dictSvc := items.GetItemsService(utils.DBE)
  1326. userSvc := baseUser.GetBaseUserService(utils.DBE)
  1327. areaJsonSvc := areajson.GetAreaJsonService(utils.DBE)
  1328. //customerSvc := svccustomer.GetCustomerService(utils.DBE)
  1329. dictList["UnitRelation"] = dictSvc.GetKeyValueItems("UnitRelation")
  1330. dictList["CompanyType"] = dictSvc.GetKeyValueItems("CompanyType")
  1331. dictList["InOptions"] = dictSvc.GetKeyValueItems("InOptions")
  1332. dictList["OperType"] = dictSvc.GetKeyValueItems("OperType")
  1333. dictList["ManagementUnit"] = dictSvc.GetKeyValueItems("ManagementUnit")
  1334. var userEntity userRole.Base_User
  1335. userSvc.GetEntityById(this.User.Id, &userEntity)
  1336. dictList["Supervisers"] = userSvc.GetUserListByDepartmentId(this.User.AccCode, userEntity.Departmentid)
  1337. dictList["GaodeMapChinaAreas"] = areaJsonSvc.GetGaodeMapChinaAreas()
  1338. dictList["CountryList"] = areaJsonSvc.GetCountryList()
  1339. var ysname string
  1340. paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
  1341. ysname = paramSvc.GetBaseparameterMessage("", "paramset", "YaSuoBao")
  1342. dictList["YaSuoName"] = ysname
  1343. //获取我创建的所有公司
  1344. var list []supplier.OilSupplier
  1345. if this.User.IsCompanyUser == 1 {
  1346. svcSupplier := supplier.GetOilSupplierService(utils.DBE)
  1347. supplierWhere := " CreateUserId = '" + this.User.Id + "'"
  1348. svcSupplier.GetEntitysByWhere(OilSupplierName, supplierWhere, &list)
  1349. dictList["CompanyNames"] = list
  1350. } else { //二级单位不用获取
  1351. dictList["CompanyNames"] = list
  1352. }
  1353. // 部门
  1354. orgsvc := organize.GetOrganizeService(utils.DBE)
  1355. dictList["Organizes"] = orgsvc.GetCollectionDetailviewlist("'" + this.User.AccCode + "'")
  1356. //var dictCustomer []svccustomer.Customer
  1357. //customerSvc.GetEntitysByWhere(this.User.AccCode + CustomerName, "", &dictCustomer)
  1358. //dictList["EntrustCorp"] = &dictCustomer
  1359. //获得有审核权限的人员
  1360. var users []userRole.Base_RoleList
  1361. var auditWorkflow auditsetting.Base_OilAuditSetting
  1362. rsvc := auditsetting.GetOilAuditSettingService(utils.DBE)
  1363. rsvc.GetAuditStepRoleEntity(OilAuditSettingName, this.User.DepartmentId, workflow.SECOND_TRIAL, &auditWorkflow)
  1364. users = rsvc.GetUserByRole(strconv.Itoa(auditWorkflow.RoleId), this.User.AccCode) //
  1365. dictList["Auditer"] = users
  1366. // 所有专业处室
  1367. var allBusDeptList []organize.Base_Organize
  1368. //where = "Category='Unit' and ParentId in (100000001, 100000128)"
  1369. //00097005 直属机构 00265300 公司机关 00097004 机关附属机构
  1370. //where = "Category='Unit' and OuterPhone in (00097005,00265300,00097004)"
  1371. whereBus := "(Category='Unit' and ParentId in (100000009, 100000004))"
  1372. orgsvc.GetEntities(&allBusDeptList, whereBus)
  1373. dictList["AllBusDeptList"] = allBusDeptList
  1374. var datainfo DataInfo
  1375. datainfo.Items = dictList
  1376. this.Data["json"] = &datainfo
  1377. this.ServeJSON()
  1378. }
  1379. // @Title 获取字典列表By Status
  1380. // @Description get user by token
  1381. // @Success 200 {object} map[string]interface{}
  1382. // @router /dictlistbystatus/ [get]
  1383. func (this *OilSupplierController) GetDictListByStatus() {
  1384. //status := this.Ctx.Input.Param(":status")
  1385. status := this.GetString("status")
  1386. majorAduit := this.GetString("majorAduit")
  1387. addId := this.GetString("addId")
  1388. isTecContract := this.GetString("isTecContract")
  1389. dictList := make(map[string]interface{})
  1390. dictSvc := items.GetItemsService(utils.DBE)
  1391. userSvc := baseUser.GetBaseUserService(utils.DBE)
  1392. areaJsonSvc := areajson.GetAreaJsonService(utils.DBE)
  1393. orgsvc := organize.GetOrganizeService(utils.DBE)
  1394. svc := supplier.GetOilSupplierService(utils.DBE)
  1395. //customerSvc := svccustomer.GetCustomerService(utils.DBE)
  1396. dictList["ManagementUnit"] = dictSvc.GetKeyValueItems("ManagementUnit")
  1397. dictList["UnitRelation"] = dictSvc.GetKeyValueItems("UnitRelation")
  1398. dictList["CompanyType"] = dictSvc.GetKeyValueItems("CompanyType")
  1399. dictList["InOptions"] = dictSvc.GetKeyValueItems("InOptions")
  1400. dictList["OperType"] = dictSvc.GetKeyValueItems("OperType")
  1401. dictList["CurrencyType"] = dictSvc.GetKeyValueItems("CurrencyType")
  1402. var userEntity userRole.Base_User
  1403. userSvc.GetEntityById(this.User.Id, &userEntity)
  1404. dictList["Supervisers"] = userSvc.GetUserListByDepartmentId(this.User.AccCode, userEntity.Departmentid)
  1405. dictList["GaodeMapChinaAreas"] = areaJsonSvc.GetGaodeMapChinaAreas()
  1406. dictList["CountryList"] = areaJsonSvc.GetCountryList()
  1407. //获取专业审批处室部门
  1408. var preorglist []organize.Base_Organizetree
  1409. //paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
  1410. //topid := paramSvc.GetBaseparameterMessage("", "paramset", "HeadquartersID") // 总公司Id
  1411. ids := orgsvc.GetAllChildUnitById("0")
  1412. svc.GetProOrTreeList(ids, &preorglist)
  1413. dictList["ProOrgList"] = preorglist
  1414. var unitorglist []organize.Base_Organize
  1415. //where := "Category='Unit'and Id not in (100000004,100000003,100000002) "
  1416. //where := "Category='Unit'and Id not in (100000880,100000201) "
  1417. where := "Category='Unit'"
  1418. orgsvc.GetEntities(&unitorglist, where)
  1419. dictList["UnitOrgList"] = unitorglist
  1420. //获取我创建的所有公司
  1421. var list []supplier.OilSupplier
  1422. if this.User.IsCompanyUser == 1 {
  1423. svcSupplier := supplier.GetOilSupplierService(utils.DBE)
  1424. supplierWhere := " CreateUserId = '" + this.User.Id + "'"
  1425. svcSupplier.GetEntitysByWhere(OilSupplierName, supplierWhere, &list)
  1426. dictList["CompanyNames"] = list
  1427. } else { //二级单位不用获取
  1428. dictList["CompanyNames"] = list
  1429. }
  1430. // 部门
  1431. dictList["Organizes"] = orgsvc.GetCollectionDetailviewlist("'" + this.User.AccCode + "'")
  1432. //var dictCustomer []svccustomer.Customer
  1433. //customerSvc.GetEntitysByWhere(this.User.AccCode + CustomerName, "", &dictCustomer)
  1434. //dictList["EntrustCorp"] = &dictCustomer
  1435. //获得有审核权限的人员
  1436. //var users []suppliercert.UserList
  1437. //rsvc := auditsetting.GetOilAuditSettingService(utils.DBE)
  1438. certSrv := suppliercert.GetOilSupplierCertService(utils.DBE)
  1439. var users []userRole.Base_RoleList
  1440. if status == suppliercert.FIRST_TRIAL_STATUS {
  1441. //rsvc.GetAuditStepRoleEntity(OilAuditSettingName, this.User.DepartmentId, workflow.SECOND_TRIAL, &auditWorkflow)
  1442. //users = rsvc.GetUserByRole(strconv.Itoa(auditWorkflow.RoleId), this.User.AccCode) //
  1443. //where := "OrganizeId=" + this.User.DepartmentId + " and AuditStepCode='" + workflow.SECOND_TRIAL + "'"
  1444. //rsvc.GetEntitysByWhere(OilAuditSettingName, where, &users)
  1445. certSrv.GetAuditUser(this.User.DepartmentId, workflow.SECOND_TRIAL, &users)
  1446. dictList["Auditer"] = users
  1447. } else if status == suppliercert.SECOND_TRIAL_STATUS {
  1448. //rsvc.GetAuditStepRoleEntity(OilAuditSettingName, this.User.DepartmentId, workflow.SECOND_TRIAL, &auditWorkflow)
  1449. } else if status == suppliercert.THIRD_TRIAL_STATUS {
  1450. //where := "OrganizeId=" + majorAduit + " and AuditStepCode='" + workflow.SECOND_TRIAL + "'"
  1451. //rsvc.GetEntitysByWhere(OilAuditSettingName, where, &users)
  1452. certSrv.GetAuditUser(majorAduit, workflow.SECOND_TRIAL, &users)
  1453. dictList["Auditer"] = users
  1454. } else if status == suppliercert.PROF_AUDIT_STATUS {
  1455. //where := "OrganizeId=" + this.User.DepartmentId + " and AuditStepCode='" + workflow.PROF_AUDIT + "'"
  1456. //rsvc.GetEntitysByWhere(OilAuditSettingName, where, &users)
  1457. certSrv.GetAuditUser(this.User.DepartmentId, workflow.PROF_AUDIT, &users)
  1458. dictList["Auditer"] = users
  1459. } else if status == suppliercert.CENT_AUDIT_STATUS {
  1460. }
  1461. // 注册审批单位
  1462. var registermodel register.OilCorporateInfo
  1463. wherereg := "UserId=" + this.User.Id
  1464. svc.GetEntity(&registermodel, wherereg)
  1465. dictList["Register"] = registermodel
  1466. // 所有专业处室
  1467. var allunitorglist []organize.Base_Organize
  1468. //where = "Category='Unit' and ParentId in (100000001, 100000128)"
  1469. //00097005 直属机构 00265300 公司机关 00097004 机关附属机构
  1470. //where = "Category='Unit' and OuterPhone in (00097005,00265300,00097004)"
  1471. where = "(Category='Unit' and ParentId in (100000009, 100000004))"
  1472. if isTecContract == "1" {
  1473. where += " or Id = 100000656"
  1474. }
  1475. orgsvc.GetEntities(&allunitorglist, where)
  1476. dictList["Allunitorglist"] = allunitorglist
  1477. // 管理单位
  1478. var suppliermode supplier.OilSupplier
  1479. orgsvc.GetEntityById(addId, &suppliermode)
  1480. if suppliermode.MgrUnit == supplier.MGRUNIT {
  1481. dictList["MgrUnit"] = true
  1482. } else {
  1483. dictList["MgrUnit"] = false
  1484. }
  1485. //是否需要现场考察报告
  1486. paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
  1487. isInvestigate := paramSvc.GetBaseparameterMessage("GFGL1", "paramset", "isInvestigate")
  1488. dictList["isInvestigate"] = isInvestigate
  1489. var datainfo DataInfo
  1490. datainfo.Items = dictList
  1491. this.Data["json"] = &datainfo
  1492. this.ServeJSON()
  1493. }
  1494. // @Title 获取实体
  1495. // @Description 获取实体
  1496. // @Success 200 {object} supplier.OilSupplier
  1497. // @router /get/:id [get]
  1498. func (this *OilSupplierController) GetEntity() {
  1499. Id := this.Ctx.Input.Param(":id")
  1500. var model supplier.OilSupplier
  1501. svc := supplier.GetOilSupplierService(utils.DBE)
  1502. svc.GetEntityByIdBytbl(OilSupplierName, Id, &model)
  1503. this.Data["json"] = &model
  1504. this.ServeJSON()
  1505. }
  1506. // @Title 获取实体
  1507. // @Description 获取实体
  1508. // @Success 200 {object} supplier.OilSupplier
  1509. // @router /getandcert/:certId [get]
  1510. func (this *OilSupplierController) GetEntityAndCert() {
  1511. Id := this.Ctx.Input.Param(":certId")
  1512. var model supplier.OilSupplierView
  1513. //svc := supplier.GetOilSupplierService(utils.DBE)
  1514. //svc.GetEntityByIdBytbl(OilSupplierName, Id, &model)
  1515. var sql string
  1516. 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,
  1517. 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 `
  1518. sql += ` left join ` + OilSupplierCertName + " b on b.SupplierId = a.Id"
  1519. sql += ` where b.Id ='` + Id + `'`
  1520. utils.DBE.SQL(sql).Get(&model)
  1521. this.Data["json"] = &model
  1522. this.ServeJSON()
  1523. }
  1524. // @Title 获取实体
  1525. // @Description 获取实体
  1526. // @Success 200 {object} supplier.OilSupplier
  1527. // @router /getbyname [get]
  1528. func (this *OilSupplierController) GetEntityByName() {
  1529. name := this.GetString("name")
  1530. typecode := this.GetString("typecode")
  1531. svc := supplier.GetOilSupplierService(utils.DBE)
  1532. var model supplier.OilSupplierApply
  1533. var datainfo ErrorDataInfo
  1534. var sqlsus string
  1535. sqlsus = `select 1 from ` + OilSupplierName + ` a `
  1536. sqlsus += ` left join ` + OilSupplierCertName + ` b on b.SupplierId = a.Id`
  1537. sqlsus += ` where a.SupplierName ='` + name + `' and b.InFlag='2' and b.SupplierTypeCode='` + typecode + `'`
  1538. var tempMap []map[string]string
  1539. tempMap, _ = svc.DBE.QueryString(sqlsus)
  1540. if tempMap != nil && tempMap[0]["1"] != "" {
  1541. datainfo.Code = -1
  1542. this.Data["json"] = &datainfo
  1543. this.ServeJSON()
  1544. } else {
  1545. var sql string
  1546. sql = `select a.*,b.InStyle,b.Status from ` + OilSupplierName + ` a `
  1547. sql += ` left join ` + OilSupplierCertName + ` b on b.SupplierId = a.Id and b.SupplierTypeCode='` + typecode + `'`
  1548. sql += ` where a.SupplierName ='` + name + `'`
  1549. utils.DBE.SQL(sql).Get(&model)
  1550. if model.SupplierName == "" {
  1551. var model2 register.OilCorporateInfo
  1552. svc.GetEntityByWhere(OilCorporateInfoName, "SupplierName='"+name+"' and CheckStatus='11'", &model2)
  1553. model2.Remark = ""
  1554. model2.Id = 0
  1555. if model2.SupplierName == "" {
  1556. datainfo.Code = -2
  1557. this.Data["json"] = &datainfo
  1558. this.ServeJSON()
  1559. } else {
  1560. datainfo.Code = 0
  1561. datainfo.Item = model2
  1562. this.Data["json"] = &datainfo
  1563. this.ServeJSON()
  1564. }
  1565. } else {
  1566. datainfo.Code = 0
  1567. datainfo.Item = model
  1568. this.Data["json"] = &datainfo
  1569. this.ServeJSON()
  1570. }
  1571. }
  1572. }
  1573. // @Title 获取实体
  1574. // @Description 判断统一社会码
  1575. // @Success 200 {object} supplier.OilSupplier
  1576. // @router /getbycomminercialno/commercialNo [get]
  1577. func (this *OilSupplierController) GetEntityComminercialNo() {
  1578. commercialNo := this.Ctx.Input.Param(":commercialNo")
  1579. svc := supplier.GetOilSupplierService(utils.DBE)
  1580. var dataInfo ErrorDataInfo
  1581. var sqlSus string
  1582. sqlSus = "select Id from OilSupplier where CommercialNo= '" + commercialNo + "'"
  1583. var tempMap []map[string]string
  1584. tempMap, _ = svc.DBE.QueryString(sqlSus)
  1585. if tempMap != nil && tempMap[0]["Id"] != "" {
  1586. dataInfo.Code = 1
  1587. this.Data["json"] = &dataInfo
  1588. this.ServeJSON()
  1589. } else {
  1590. dataInfo.Code = 0
  1591. this.Data["json"] = &dataInfo
  1592. this.ServeJSON()
  1593. }
  1594. }
  1595. // @Title 添加
  1596. // @Description 新增
  1597. // @Success 200 {object} controllers.Request
  1598. // @router /add [post]
  1599. func (this *OilSupplierController) AddEntity() {
  1600. var model supplier.OilSupplier
  1601. var modelCert suppliercert.OilSupplierCert
  1602. var modelCertVM suppliercert.OilSupplierVM
  1603. var jsonBlob = this.Ctx.Input.RequestBody
  1604. json.Unmarshal(jsonBlob, &model)
  1605. json.Unmarshal(jsonBlob, &modelCertVM)
  1606. serviceCert := suppliercert.GetOilSupplierCertService(utils.DBE)
  1607. var registerUser register.OilCorporateInfo
  1608. sql := " UserName='" + this.User.Username + "' and CheckStatus = 11"
  1609. serviceCert.GetEntity(&registerUser, sql)
  1610. canApply := serviceCert.IsCanApplyByExtOrganizeUser(modelCertVM.SupplierTypeCode, registerUser.CommercialNo, this.User.Id, this.User.IsCompanyUser)
  1611. var errinfo ErrorDataInfo
  1612. if !canApply {
  1613. errinfo.Message = "添加失败!供方用户只能申请一次"
  1614. errinfo.Code = -1
  1615. this.Data["json"] = &errinfo
  1616. this.ServeJSON()
  1617. return
  1618. }
  1619. //判断在黑名单的不能申请准入
  1620. var black BlackList.BlackList
  1621. serviceCert.GetEntityByWhere("BlackList", "CommercialNo = '"+model.CommercialNo+"'", &black)
  1622. if black.Id > 0 {
  1623. errinfo.Message = "在黑名单内,不可申请"
  1624. errinfo.Code = -1
  1625. this.Data["json"] = &errinfo
  1626. this.ServeJSON()
  1627. return
  1628. }
  1629. var list []supplier.OilSupplierView
  1630. service := supplier.GetOilSupplierService(utils.DBE)
  1631. service.CheckRepeatApplyInfo(OilSupplierName, OilSupplierCertName, modelCertVM.SupplierTypeCode, model.SupplierName, model.CommercialNo, model.OrganCode, model.BankAccount, model.CompanyUrl, &list)
  1632. if len(list) > 0 {
  1633. errinfo.Message = "添加失败! 已存在相关企业的信息,不能重复申请"
  1634. errinfo.Code = -1
  1635. this.Data["json"] = &errinfo
  1636. this.ServeJSON()
  1637. return
  1638. }
  1639. //if model.Id <= 0 {
  1640. // service.CheckRepeatApplyInfo(OilSupplierName, OilSupplierCertName, modelCertVM.SupplierTypeCode, model.SupplierName, model.CommercialNo, model.OrganCode, model.BankAccount, model.CompanyUrl, &list)
  1641. // if len(list) > 0 {
  1642. // errinfo.Message = "添加失败! 已存在相关企业的信息,不能重复申请"
  1643. // errinfo.Code = -1
  1644. // this.Data["json"] = &errinfo
  1645. // this.ServeJSON()
  1646. // return
  1647. // }
  1648. //} else {
  1649. // service.CheckUpdateRepeatApplyInfo(OilSupplierName, OilSupplierCertName, modelCertVM.SupplierTypeCode, strconv.Itoa(model.Id), model.SupplierName, model.CommercialNo, model.OrganCode, model.BankAccount, model.CompanyUrl, &list)
  1650. // if len(list) > 0 {
  1651. // errinfo.Message = "添加失败! 已存在相关企业的信息,或与其他企业信息重复"
  1652. // errinfo.Code = -1
  1653. // this.Data["json"] = &errinfo
  1654. // this.ServeJSON()
  1655. // return
  1656. // }
  1657. //}
  1658. var session *xorm.Session
  1659. session = utils.DBE.NewSession()
  1660. svc := supplier.GetOilSupplierSession(session)
  1661. svcCert := suppliercert.GetOilSupplierCertSession(session)
  1662. model.CreateOn = time.Now()
  1663. model.CreateBy = this.User.Realname
  1664. model.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
  1665. //model.OrganizeId, _ = utils.StrTo(this.User.DepartmentId).Int()
  1666. defer session.Close()
  1667. err := session.Begin()
  1668. if model.Id <= 0 {
  1669. _, err = svc.InsertEntityBytbl(OilSupplierName, &model)
  1670. } else {
  1671. //判断基本信息是否可修改
  1672. updateCols := svc.GetUpdateCols(OilSupplierCertName, modelCertVM.SupplierTypeCode, model.Id)
  1673. err = svc.UpdateEntityBytbl(OilSupplierName, model.Id, &model, updateCols)
  1674. }
  1675. if err != nil {
  1676. session.Rollback()
  1677. }
  1678. modelCert.SupplierId = model.Id
  1679. modelCert.SupplierTypeCode = modelCertVM.SupplierTypeCode
  1680. modelCert.SupplierTypeName = modelCertVM.SupplierTypeName
  1681. modelCert.InStyle = modelCertVM.InStyle
  1682. if modelCert.InStyle == suppliercert.PINGSHEN {
  1683. modelCert.IsPay = 0
  1684. } else {
  1685. modelCert.IsPay = 2
  1686. }
  1687. modelCert.Step = 1 //企业信息保存完成
  1688. modelCert.CreateOn = time.Now()
  1689. modelCert.CreateBy = this.User.Realname
  1690. modelCert.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
  1691. // 保存推荐单位
  1692. if this.User.IsCompanyUser == 1 {
  1693. modelCert.RecUnitId = strconv.Itoa(registerUser.CheckUnitId)
  1694. modelCert.RecUnitName = registerUser.CheckUnitName
  1695. modelCert.RecUnitPerson = registerUser.ModifiedBy
  1696. } else {
  1697. modelCert.RecUnitId = strconv.Itoa(this.User.UnitId)
  1698. modelCert.RecUnitName = this.User.Unit
  1699. modelCert.RecUnitPerson = this.User.Realname
  1700. }
  1701. _, err = svcCert.InsertEntityBytbl(OilSupplierCertName, &modelCert)
  1702. if err != nil {
  1703. session.Rollback()
  1704. }
  1705. // add Commit() after all actions
  1706. err = session.Commit()
  1707. if err == nil {
  1708. //新增
  1709. errinfo.Message = "添加成功!"
  1710. errinfo.Code = 0
  1711. errinfo.Item = strconv.Itoa(model.Id) + "_" + strconv.Itoa(modelCert.Id)
  1712. this.Data["json"] = &errinfo
  1713. this.ServeJSON()
  1714. } else {
  1715. errinfo.Message = "添加失败!" + utils.AlertProcess(err.Error())
  1716. errinfo.Code = -1
  1717. this.Data["json"] = &errinfo
  1718. this.ServeJSON()
  1719. }
  1720. }
  1721. // @Title 准入修改实体
  1722. // @Description 修改实体
  1723. // @Success 200 {object} controllers.Request
  1724. // @router /update/:id/:type/:instyle [post]
  1725. func (this *OilSupplierController) UpdateEntity() {
  1726. id := this.Ctx.Input.Param(":id")
  1727. typeCode := this.Ctx.Input.Param(":type")
  1728. instyle := this.Ctx.Input.Param(":instyle")
  1729. var errinfo ErrorInfo
  1730. if id == "" {
  1731. errinfo.Message = "操作失败!请求信息不完整"
  1732. errinfo.Code = -2
  1733. this.Data["json"] = &errinfo
  1734. this.ServeJSON()
  1735. return
  1736. }
  1737. var model supplier.OilSupplier
  1738. var jsonBlob = this.Ctx.Input.RequestBody
  1739. json.Unmarshal(jsonBlob, &model)
  1740. var list []supplier.OilSupplierView
  1741. service := supplier.GetOilSupplierService(utils.DBE)
  1742. service.CheckUpdateRepeatApplyInfo(OilSupplierName, OilSupplierCertName, typeCode, strconv.Itoa(model.Id), model.SupplierName, model.CommercialNo, model.OrganCode, model.BankAccount, model.CompanyUrl, &list)
  1743. if len(list) > 0 {
  1744. errinfo.Message = "修改失败! 已存在相关企业的信息,或与其他企业信息重复"
  1745. errinfo.Code = -1
  1746. this.Data["json"] = &errinfo
  1747. this.ServeJSON()
  1748. return
  1749. }
  1750. svc := supplier.GetOilSupplierService(utils.DBE)
  1751. model.ModifiedOn = time.Now()
  1752. model.ModifiedBy = this.User.Realname
  1753. model.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
  1754. // 获取原本的工商注册号
  1755. var oldModel supplier.OilSupplier
  1756. svc.GetEntityById(model.Id, &oldModel)
  1757. if oldModel.SupplierName != model.SupplierName || oldModel.CommercialNo != model.CommercialNo {
  1758. cols := []string{"CommercialNo", "SupplierName"}
  1759. var info register.OilCorporateInfo
  1760. where1 := "CommercialNo = '" + oldModel.CommercialNo + "'"
  1761. svc.GetEntityByWhere(OilCorporateInfoName, where1, &info)
  1762. info.CommercialNo = model.CommercialNo
  1763. info.SupplierName = model.SupplierName
  1764. err1 := svc.UpdateEntityBywheretbl(OilCorporateInfoName, &info, cols, where1)
  1765. if err1 == nil {
  1766. var user userRole.Base_User
  1767. user.Realname = model.SupplierName
  1768. svc.UpdateEntityBywheretbl("Base_User", &user, []string{"Realname"}, "Id = "+strconv.Itoa(info.UserId))
  1769. }
  1770. }
  1771. svc1 := suppliercert.GetOilSupplierCertService(utils.DBE)
  1772. var cert suppliercert.OilSupplierCert
  1773. svc1.GetEntityByWhere(OilSupplierCertName, "SupplierId = "+id+" and SupplierTypeCode='"+typeCode+"'", &cert)
  1774. //对资质的检查
  1775. //svc1.IsSupplierCertCanSubmit(strconv.Itoa(model.Id), strconv.Itoa(cert.Id))
  1776. //判断基本信息是否可修改
  1777. updateCols := svc.GetUpdateCols(OilSupplierCertName, typeCode, model.Id)
  1778. err := svc.UpdateEntityBytbl(OilSupplierName, id, &model, updateCols)
  1779. //isPay := "0"
  1780. //if instyle == suppliercert.PINGSHEN {
  1781. // isPay = "0"
  1782. //} else {
  1783. // isPay = "2"
  1784. //}
  1785. if err == nil {
  1786. svc.DBE.Exec("update OilSupplierCert set InStyle='" + instyle + "' where SupplierId=" + id + " and SupplierTypeCode='" + typeCode + "'") // "', IsPay= " + isPay +
  1787. //一级变二级删除一级准入范围
  1788. if model.Grade == "2" {
  1789. svc.DeleteEntityBytbl(OilSupplierCertSubName, "SupplierTypeCode = '01' and GoodsLevel = '1' and SupplierId = "+id)
  1790. }
  1791. errinfo.Message = "修改成功!"
  1792. errinfo.Code = 0
  1793. this.Data["json"] = &errinfo
  1794. this.ServeJSON()
  1795. } else {
  1796. errinfo.Message = "修改失败!" + utils.AlertProcess(err.Error())
  1797. errinfo.Code = -1
  1798. this.Data["json"] = &errinfo
  1799. this.ServeJSON()
  1800. }
  1801. }
  1802. // @Title 已入库列表修改实体
  1803. // @Description 修改实体
  1804. // @Success 200 {object} controllers.Request
  1805. // @router /update1/:id/:type/:instyle/:certId [post]
  1806. func (this *OilSupplierController) UpdateEntity1() {
  1807. id := this.Ctx.Input.Param(":id")
  1808. typeCode := this.Ctx.Input.Param(":type")
  1809. instyle := this.Ctx.Input.Param(":instyle")
  1810. certId := this.Ctx.Input.Param(":certId")
  1811. var errinfo ErrorInfo
  1812. if id == "" {
  1813. errinfo.Message = "操作失败!请求信息不完整"
  1814. errinfo.Code = -2
  1815. this.Data["json"] = &errinfo
  1816. this.ServeJSON()
  1817. return
  1818. }
  1819. var model supplier.OilSupplier
  1820. var model1 supplier.OilSupplierView
  1821. var jsonBlob = this.Ctx.Input.RequestBody
  1822. json.Unmarshal(jsonBlob, &model)
  1823. json.Unmarshal(jsonBlob, &model1)
  1824. model1.Remark = model1.Remark1
  1825. var list []supplier.OilSupplierView
  1826. service := supplier.GetOilSupplierService(utils.DBE)
  1827. service.CheckUpdateRepeatApplyInfo(OilSupplierName, OilSupplierCertName, typeCode, strconv.Itoa(model.Id), model.SupplierName, model.CommercialNo, model.OrganCode, model.BankAccount, model.CompanyUrl, &list)
  1828. if len(list) > 0 {
  1829. errinfo.Message = "修改失败! 已存在相关企业的信息,或与其他企业信息重复"
  1830. errinfo.Code = -1
  1831. this.Data["json"] = &errinfo
  1832. this.ServeJSON()
  1833. return
  1834. }
  1835. svc := supplier.GetOilSupplierService(utils.DBE)
  1836. model.ModifiedOn = time.Now()
  1837. model.ModifiedBy = this.User.Realname
  1838. model.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
  1839. // 获取原本的工商注册号
  1840. var oldModel supplier.OilSupplier
  1841. svc.GetEntityById(model.Id, &oldModel)
  1842. if oldModel.SupplierName != model.SupplierName || oldModel.CommercialNo != model.CommercialNo {
  1843. cols := []string{"CommercialNo", "SupplierName"}
  1844. var info register.OilCorporateInfo
  1845. where1 := "CommercialNo = '" + oldModel.CommercialNo + "'"
  1846. svc.GetEntityByWhere(OilCorporateInfoName, where1, &info)
  1847. info.CommercialNo = model.CommercialNo
  1848. info.SupplierName = model.SupplierName
  1849. err1 := svc.UpdateEntityBywheretbl(OilCorporateInfoName, &info, cols, where1)
  1850. if err1 == nil {
  1851. var user userRole.Base_User
  1852. user.Realname = model.SupplierName
  1853. svc.UpdateEntityBywheretbl("Base_User", &user, []string{"Realname"}, "Id = "+strconv.Itoa(info.UserId))
  1854. }
  1855. }
  1856. svc1 := suppliercert.GetOilSupplierCertService(utils.DBE)
  1857. var cert suppliercert.OilSupplierCert
  1858. svc1.GetEntityByWhere(OilSupplierCertName, "SupplierId = "+id+" and SupplierTypeCode='"+typeCode+"'", &cert)
  1859. //对资质的检查
  1860. //svc1.IsSupplierCertCanSubmit(strconv.Itoa(model.Id), strconv.Itoa(cert.Id))
  1861. //判断基本信息是否可修改
  1862. updateCols := svc.GetUpdateCols(OilSupplierCertName, typeCode, model.Id)
  1863. err := svc.UpdateEntityBytbl(OilSupplierName, id, &model, updateCols)
  1864. //isPay := "0"
  1865. //if instyle == suppliercert.PINGSHEN {
  1866. // isPay = "0"
  1867. //} else {
  1868. // isPay = "2"
  1869. //}
  1870. if err == nil {
  1871. svc.UpdateEntityBytbl(OilSupplierCertName, certId, &model1, []string{"Remark"})
  1872. svc.DBE.Exec("update OilSupplierCert set InStyle='" + instyle + "' where SupplierId=" + id + " and SupplierTypeCode='" + typeCode + "'") // "', IsPay= " + isPay +
  1873. //一级变二级删除一级准入范围
  1874. if model.Grade == "2" {
  1875. svc.DeleteEntityBytbl(OilSupplierCertSubName, "SupplierTypeCode = '01' and GoodsLevel = '1' and SupplierId = "+id)
  1876. }
  1877. errinfo.Message = "修改成功!"
  1878. errinfo.Code = 0
  1879. this.Data["json"] = &errinfo
  1880. this.ServeJSON()
  1881. } else {
  1882. errinfo.Message = "修改失败!" + utils.AlertProcess(err.Error())
  1883. errinfo.Code = -1
  1884. this.Data["json"] = &errinfo
  1885. this.ServeJSON()
  1886. }
  1887. }
  1888. // @Title 修改企业人员情况实体
  1889. // @Description 修改实体
  1890. // @Success 200 {object} controllers.Request
  1891. // @router /updatenumber/:id [post]
  1892. func (this *OilSupplierController) UpdateNumberEntity() {
  1893. idGroup := this.Ctx.Input.Param(":id")
  1894. //id := strings.Split(idGroup, "_")[0]
  1895. certId := strings.Split(idGroup, "_")[1]
  1896. var errinfo ErrorInfo
  1897. if certId == "" {
  1898. errinfo.Message = "操作失败!请求信息不完整"
  1899. errinfo.Code = -2
  1900. this.Data["json"] = &errinfo
  1901. this.ServeJSON()
  1902. return
  1903. }
  1904. var modelCert suppliercert.OilSupplierCert
  1905. svcCert := suppliercert.GetOilSupplierCertService(utils.DBE)
  1906. var jsonBlob = this.Ctx.Input.RequestBody
  1907. json.Unmarshal(jsonBlob, &modelCert)
  1908. modelCert.ModifiedOn = time.Now()
  1909. modelCert.ModifiedBy = this.User.Realname
  1910. modelCert.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
  1911. colcerts := []string{
  1912. "Id",
  1913. "WorkerTotal",
  1914. "ContractNum ",
  1915. "UniversityNum",
  1916. "TechnicalNum",
  1917. "AboveProfNum",
  1918. "MiddleProfNum",
  1919. "NationalRegNum",
  1920. "NationalCertTotal",
  1921. "DesignerTotal",
  1922. "SkillerTotal",
  1923. "ModifiedOn",
  1924. "ModifiedUserId",
  1925. "ModifiedBy",
  1926. }
  1927. // if modelCert.Step <= 2 {
  1928. // modelCert.Step = 2 //完成企业基本信息
  1929. // colcerts = append(colcerts, "Step")
  1930. // }
  1931. err := svcCert.UpdateEntityBytbl(OilSupplierCertName, certId, &modelCert, colcerts)
  1932. if err == nil {
  1933. errinfo.Message = "保存成功!"
  1934. errinfo.Code = 0
  1935. this.Data["json"] = &errinfo
  1936. this.ServeJSON()
  1937. } else {
  1938. errinfo.Message = "保存失败!" + utils.AlertProcess(err.Error())
  1939. errinfo.Code = -1
  1940. this.Data["json"] = &errinfo
  1941. this.ServeJSON()
  1942. }
  1943. }
  1944. // @Title 删除单条信息
  1945. // @Description
  1946. // @Success 200 {object} ErrorInfo
  1947. // @Failure 403 :id 为空
  1948. // @router /delete/:Id [delete]
  1949. func (this *OilSupplierController) DeleteEntity() {
  1950. Id := this.Ctx.Input.Param(":Id")
  1951. var errinfo ErrorInfo
  1952. if Id == "" {
  1953. errinfo.Message = "操作失败!请求信息不完整"
  1954. errinfo.Code = -2
  1955. this.Data["json"] = &errinfo
  1956. this.ServeJSON()
  1957. return
  1958. }
  1959. var model supplier.OilSupplier
  1960. var entityempty supplier.OilSupplier
  1961. svc := supplier.GetOilSupplierService(utils.DBE)
  1962. opdesc := "删除-" + Id
  1963. err := svc.DeleteOperationAndWriteLogBytbl(OilSupplierName, BaseOperationLogName, Id, &model, &entityempty, utils.ToStr(this.User.Id), this.User.Username, opdesc, this.User.AccCode, "钻井日报")
  1964. if err == nil {
  1965. errinfo.Message = "删除成功"
  1966. errinfo.Code = 0
  1967. this.Data["json"] = &errinfo
  1968. this.ServeJSON()
  1969. } else {
  1970. errinfo.Message = "删除失败!" + utils.AlertProcess(err.Error())
  1971. errinfo.Code = -1
  1972. this.Data["json"] = &errinfo
  1973. this.ServeJSON()
  1974. }
  1975. }
  1976. // @Title 删除单条信息
  1977. // @Description
  1978. // @Success 200 {object} ErrorInfo
  1979. // @Failure 403 :id 为空
  1980. // @router /deleteall/:Id/:SupplierTypeCode [delete]
  1981. func (this *OilSupplierController) DeleteAllEntity() {
  1982. Id := this.Ctx.Input.Param(":Id")
  1983. SupplierTypeCode := this.Ctx.Input.Param(":SupplierTypeCode")
  1984. var errinfo ErrorInfo
  1985. if Id == "" {
  1986. errinfo.Message = "操作失败!请求信息不完整"
  1987. errinfo.Code = -2
  1988. this.Data["json"] = &errinfo
  1989. this.ServeJSON()
  1990. return
  1991. }
  1992. svc := supplier.GetOilSupplierService(utils.DBE)
  1993. deleteWhere := "SupplierId=" + Id + " and SupplierTypeCode='" + SupplierTypeCode + "'"
  1994. err := svc.DeleteEntityBytbl(OilSupplierCertSubName, deleteWhere)
  1995. err = svc.DeleteEntityBytbl(OilSupplierFileName, deleteWhere)
  1996. var modelList []suppliercert.OilSupplierCert
  1997. svc.GetEntityByWhere(OilSupplierCertName, deleteWhere, &modelList)
  1998. // 删除工作流
  1999. activitiService := workflow.GetActivitiService(utils.DBE)
  2000. var deleteProcessVM workflow.DeleteProcessVM
  2001. for _, supplierCertItem := range modelList {
  2002. // 按条件查询,正常情况下只有一条
  2003. if supplierCertItem.WorkflowId != "" && supplierCertItem.WorkflowId != "0" {
  2004. deleteProcessVM.ProcessInstanceId = supplierCertItem.WorkflowId
  2005. deleteProcessVM.DeleteReason = "审批未通过,删除"
  2006. activitiService.DeleteComplete(deleteProcessVM)
  2007. }
  2008. }
  2009. // 删除SupplierCert表
  2010. err = svc.DeleteEntityBytbl(OilSupplierCertName, deleteWhere)
  2011. /* var model2 suppliercert.OilSupplierCert
  2012. count2, _ := svc.GetCount(&model2, "SupplierId="+Id)
  2013. if count2 == 0 {
  2014. err = svc.DeleteEntityBytbl(OilSupplierName, "Id="+Id)
  2015. } */
  2016. if err == nil {
  2017. errinfo.Message = "删除成功"
  2018. errinfo.Code = 0
  2019. this.Data["json"] = &errinfo
  2020. this.ServeJSON()
  2021. } else {
  2022. errinfo.Message = "删除失败!" + utils.AlertProcess(err.Error())
  2023. errinfo.Code = -1
  2024. this.Data["json"] = &errinfo
  2025. this.ServeJSON()
  2026. }
  2027. }
  2028. // @Title 判断是否可以申请准入
  2029. // @Description
  2030. // @Success 200 {string} Count
  2031. // @Failure 403 :id 为空
  2032. // @router /iscanapply/:type [get]
  2033. func (this *OilSupplierController) IsCanApply() {
  2034. Type := this.Ctx.Input.Param(":type")
  2035. var errinfo ErrorInfo
  2036. if Type == "" {
  2037. errinfo.Message = "操作失败!请求信息不完整"
  2038. errinfo.Code = -2
  2039. this.Data["json"] = &errinfo
  2040. this.ServeJSON()
  2041. return
  2042. }
  2043. svc := suppliercert.GetOilSupplierCertService(utils.DBE)
  2044. var registerUser register.OilCorporateInfo
  2045. sql := " UserName='" + this.User.Username + "' and CheckStatus = 11"
  2046. svc.GetEntity(&registerUser, sql)
  2047. canApply := svc.IsCanApplyByExtOrganizeUser(Type, registerUser.CommercialNo, this.User.Id, this.User.IsCompanyUser)
  2048. if canApply {
  2049. //判断是否是暂停
  2050. if this.User.IsCompanyUser == 1 {
  2051. var tempMap []map[string]string
  2052. 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 + "'"
  2053. tempMap, _ = svc.DBE.QueryString(sql)
  2054. if tempMap != nil && tempMap[0]["1"] != "" {
  2055. errinfo.Message = "已暂停,不可申请"
  2056. errinfo.Code = -2
  2057. this.Data["json"] = &errinfo
  2058. this.ServeJSON()
  2059. } else {
  2060. errinfo.Message = "无申请记录,可以申请"
  2061. errinfo.Code = 0
  2062. this.Data["json"] = &errinfo
  2063. this.ServeJSON()
  2064. }
  2065. } else {
  2066. errinfo.Message = "无申请记录,可以申请"
  2067. errinfo.Code = 0
  2068. this.Data["json"] = &errinfo
  2069. this.ServeJSON()
  2070. }
  2071. } else {
  2072. errinfo.Message = "供方用户只能申请一次"
  2073. errinfo.Code = -1
  2074. this.Data["json"] = &errinfo
  2075. this.ServeJSON()
  2076. }
  2077. }
  2078. // @Title 判断是否可以修改供方企业信息
  2079. // @Description
  2080. // @Success 200 {string} Count
  2081. // @Failure 403 :id 为空
  2082. // @router /iscanupdatesupplier/:supplierid/:typecode [get]
  2083. func (this *OilSupplierController) CanUpdateSupplier() {
  2084. supplierId := this.Ctx.Input.Param(":supplierid")
  2085. typeCode := this.Ctx.Input.Param(":typecode")
  2086. var errinfo ErrorInfo
  2087. if supplierId == "" {
  2088. errinfo.Message = "操作失败!请求信息不完整"
  2089. errinfo.Code = -2
  2090. this.Data["json"] = &errinfo
  2091. this.ServeJSON()
  2092. return
  2093. }
  2094. Id, _ := strconv.Atoi(supplierId)
  2095. svc := supplier.GetOilSupplierService(utils.DBE)
  2096. canUpdate := svc.CanUpdateSupplier(OilSupplierCertName, Id, typeCode) // 区分物资类01 基建类02 服务类03
  2097. if canUpdate {
  2098. errinfo.Message = "可以修改"
  2099. errinfo.Code = 0
  2100. this.Data["json"] = &errinfo
  2101. this.ServeJSON()
  2102. } else {
  2103. errinfo.Message = "此供方已经提交准入申请,不可修改"
  2104. errinfo.Code = -1
  2105. this.Data["json"] = &errinfo
  2106. this.ServeJSON()
  2107. }
  2108. }
  2109. // @Title 获取二级审核人员
  2110. // @Description 获取二级审核人员
  2111. // @router /getauditerbydept/:deptId [get]
  2112. func (this *OilSupplierController) GetAuditerByDept() {
  2113. Id := this.Ctx.Input.Param(":deptId")
  2114. auditstepcode := this.GetString("auditstepcode")
  2115. svc := organize.GetOrganizeService(utils.DBE)
  2116. unitId := svc.GetMyUnitDepartmentId(Id)
  2117. //ids := svc.GetAllChildById(unitId)
  2118. //
  2119. //certSrv := suppliercert.GetOilSupplierCertService(utils.DBE)
  2120. //var users []userRole.Base_RoleList
  2121. //certSrv.GetAuditUser(ids, auditstepcode, &users)
  2122. var userlist []userRole.Base_User
  2123. var setting auditsetting.Base_OilAuditSetting
  2124. usvc := userRole.GetUserService(utils.DBE)
  2125. where := "AuditStepCode='" + auditstepcode + "'"
  2126. svc.GetEntity(&setting, where)
  2127. ids := usvc.GetUserIdsByRoleId(strconv.Itoa(setting.RoleId))
  2128. tempstr := strings.Join(ids, ",")
  2129. userIds := strings.Replace(tempstr, "uid_", "", -1)
  2130. userIds = strings.Trim(userIds, ",")
  2131. if userIds != "" {
  2132. where := "Id in (" + userIds + ")" + " and UnitId=" + unitId
  2133. svc.GetEntities(&userlist, where)
  2134. }
  2135. var datainfo ErrorDataInfo
  2136. datainfo.Item = userlist
  2137. this.Data["json"] = &datainfo
  2138. this.ServeJSON()
  2139. }
  2140. // @Title 获取二级初审人员
  2141. // @Description 获取二级初审人员
  2142. // @router /getfirauditerbydept/:deptId [get]
  2143. func (this *OilSupplierController) GetFirAuditerByDept() {
  2144. Id := this.Ctx.Input.Param(":deptId")
  2145. auditstepcode := this.GetString("auditstepcode")
  2146. var userlist []userRole.Base_User
  2147. var setting auditsetting.Base_OilAuditSetting
  2148. svc := userRole.GetUserService(utils.DBE)
  2149. where := "AuditStepCode='" + auditstepcode + "'"
  2150. svc.GetEntity(&setting, where)
  2151. svcdepartment := organize.GetOrganizeService(utils.DBE)
  2152. unitId := svcdepartment.GetMyUnitDepartmentId(this.User.DepartmentId)
  2153. alldep := svcdepartment.GetAllChildById(unitId)
  2154. ids := svc.GetUserIdsByRoleId(strconv.Itoa(setting.RoleId))
  2155. tempstr := strings.Join(ids, ",")
  2156. userIds := strings.Replace(tempstr, "uid_", "", -1)
  2157. userIds = strings.Trim(userIds, ",")
  2158. if userIds != "" {
  2159. // 企管法规处
  2160. if unitId == "100000650" {
  2161. where := "Id in (" + userIds + ")"
  2162. svc.GetEntities(&userlist, where)
  2163. } else {
  2164. where := "Id in (" + userIds + ")" + "and (UnitId=" + Id + " or Departmentid in (" + alldep + ")) "
  2165. svc.GetEntities(&userlist, where)
  2166. }
  2167. }
  2168. //svc := organize.GetOrganizeService(utils.DBE)
  2169. //
  2170. //ids := svc.GetAllChildById(Id)
  2171. //
  2172. //certSrv := suppliercert.GetOilSupplierCertService(utils.DBE)
  2173. //var users []userRole.Base_RoleList
  2174. //certSrv.GetAuditUser(ids, auditstepcode, &users)
  2175. var datainfo ErrorDataInfo
  2176. datainfo.Item = userlist
  2177. this.Data["json"] = &datainfo
  2178. this.ServeJSON()
  2179. }
  2180. // @Title 获取二级复审人员根据初审人员
  2181. // @Description 获取二级复审人员根据初审人员
  2182. // @router /getauditerbyfirst/:firstId [get]
  2183. func (this *OilSupplierController) GetAuditerByFist() {
  2184. Id := this.Ctx.Input.Param(":firstId")
  2185. auditstepcode := this.GetString("auditstepcode")
  2186. certSrv := suppliercert.GetOilSupplierCertService(utils.DBE)
  2187. //orgSrv := organize.GetOrganizeService(utils.DBE)
  2188. var userentity userRole.Base_User
  2189. certSrv.GetEntityById(Id, &userentity)
  2190. var userlist []userRole.Base_User
  2191. var setting auditsetting.Base_OilAuditSetting
  2192. svc := userRole.GetUserService(utils.DBE)
  2193. where := "AuditStepCode='" + auditstepcode + "'"
  2194. svc.GetEntity(&setting, where)
  2195. ids := svc.GetUserIdsByRoleId(strconv.Itoa(setting.RoleId))
  2196. tempstr := strings.Join(ids, ",")
  2197. userIds := strings.Replace(tempstr, "uid_", "", -1)
  2198. userIds = strings.Trim(userIds, ",")
  2199. if userIds != "" {
  2200. where := "Id in (" + userIds + ")" + "and UnitId=" + strconv.Itoa(userentity.UnitId)
  2201. svc.GetEntities(&userlist, where)
  2202. }
  2203. //svc := organize.GetOrganizeService(utils.DBE)
  2204. //unitId := svc.GetMyUnitDepartmentId(userentity.Departmentid)
  2205. //ids := svc.GetAllChildById(unitId)
  2206. ////depId := strings.Split(userentity.Superior,",")
  2207. //var users []userRole.Base_RoleList
  2208. //certSrv.GetAuditUser(ids, auditstepcode, &users)
  2209. var datainfo ErrorDataInfo
  2210. datainfo.Item = userlist
  2211. this.Data["json"] = &datainfo
  2212. this.ServeJSON()
  2213. }
  2214. // @Title 获取二级初审人员(不需要验证登录)
  2215. // @Description 获取二级初审人员(不需要验证登录)
  2216. // @router /getauditerbydeptandnologin [get]
  2217. func (this *OilSupplierController) GetAuditerByDeptAndNoLogin() {
  2218. Id := this.GetString("deptId")
  2219. auditstepcode := this.GetString("auditstepcode")
  2220. var userlist []userRole.Base_User
  2221. var setting auditsetting.Base_OilAuditSetting
  2222. svc := userRole.GetUserService(utils.DBE)
  2223. where := "AuditStepCode='" + auditstepcode + "'"
  2224. svc.GetEntity(&setting, where)
  2225. ids := svc.GetUserIdsByRoleId(strconv.Itoa(setting.RoleId))
  2226. tempstr := strings.Join(ids, ",")
  2227. userIds := strings.Replace(tempstr, "uid_", "", -1)
  2228. userIds = strings.Trim(userIds, ",")
  2229. if userIds != "" {
  2230. where := "Id in (" + userIds + ")" + "and UnitId=" + Id
  2231. svc.GetEntities(&userlist, where)
  2232. }
  2233. //certSrv := suppliercert.GetOilSupplierCertService(utils.DBE)
  2234. //var users []userRole.Base_RoleList
  2235. //certSrv.GetAuditUser(Id, auditstepcode, &users)
  2236. // certSrv.GetAuditUserByNoLogin(Id, &users)
  2237. var datainfo ErrorDataInfo
  2238. datainfo.Item = userlist
  2239. this.Data["json"] = &datainfo
  2240. this.ServeJSON()
  2241. }
  2242. // @Title
  2243. // @Description
  2244. // @router /getjurisdiction [get]
  2245. func (this *OilSupplierController) GetJurisdiction() {
  2246. svcPerm := permission.GetPermissionService(utils.DBE)
  2247. isauth := svcPerm.IsAuthorized(this.User.Id, "oil_delete")
  2248. var datainfo ErrorDataInfo
  2249. datainfo.Item = isauth
  2250. this.Data["json"] = &datainfo
  2251. this.ServeJSON()
  2252. }
  2253. // @Title 获取列表
  2254. // @Description get user by token
  2255. // @Success 200 {object} []supplier.OilSupplier
  2256. // @router /certlistinterface [get]
  2257. func (this *OilSupplierController) GetEntityListInterface() {
  2258. //获取分页信息
  2259. //page := this.GetPageInfoForm()
  2260. where := " 1=1 "
  2261. //orderby := "Id"
  2262. //asc := false
  2263. //Order := this.GetString("Order")
  2264. //Prop := this.GetString("Prop")
  2265. //if Order != "" && Prop != "" {
  2266. // orderby = Prop
  2267. // if Order == "asc" {
  2268. // asc = true
  2269. // }
  2270. //}
  2271. status := this.GetString("status")
  2272. if status == "1" {
  2273. where += "b.InStyle='1'"
  2274. } else if status == "2" {
  2275. where += "b.InStyle='4'"
  2276. } else if status == "3" {
  2277. where += "b.InStyle='5'"
  2278. } else if status == "4" {
  2279. where += "b.InStyle=''"
  2280. } else if status == "5" {
  2281. where += "b.InStyle=''"
  2282. }
  2283. svc := supplier.GetOilSupplierService(utils.DBE)
  2284. var interfaceData []supplier.InterfaceData
  2285. err := svc.GetInterfaceData(OilSupplierName, OilSupplierFileName, &interfaceData, where)
  2286. var errinfo ErrorDataInfo
  2287. if err == nil {
  2288. errinfo.Message = "成功!"
  2289. errinfo.Code = 0
  2290. errinfo.Item = &interfaceData
  2291. this.Data["json"] = &errinfo
  2292. this.ServeJSON()
  2293. } else {
  2294. errinfo.Message = "失败!"
  2295. errinfo.Code = -1
  2296. this.Data["json"] = &errinfo
  2297. this.ServeJSON()
  2298. }
  2299. }
  2300. // @Title 获取实体
  2301. // @Description 获取实体
  2302. // @Success 200 {object} supplier.OilSupplier
  2303. // @router /getentitybycommercialno/:commercialNo [get]
  2304. func (this *OilSupplierController) GetEntityByCommercialNo() {
  2305. commercialNo := this.Ctx.Input.Param(":commercialNo")
  2306. where := "CommercialNo = '" + commercialNo + "'"
  2307. var model supplier.OilSupplier
  2308. svc := supplier.GetOilSupplierService(utils.DBE)
  2309. svc.GetEntityByWhere(OilSupplierName, where, &model)
  2310. this.Data["json"] = &model
  2311. this.ServeJSON()
  2312. }
  2313. // @Title 更新文件上传
  2314. // @Description 更新文件上传
  2315. // @Param id path string true
  2316. // @Success 200 {object}
  2317. // @router /editsubfile/:id [put]
  2318. func (this *OilSupplierController) EditSubfile() {
  2319. id := this.Ctx.Input.Param(":id")
  2320. var errinfo ErrorInfo
  2321. if id == "" {
  2322. errinfo.Message = "操作失败!请求信息不完整"
  2323. errinfo.Code = -2
  2324. this.Data["json"] = &errinfo
  2325. this.ServeJSON()
  2326. return
  2327. }
  2328. var model supplierscenefile.OilSupplierSceneFile
  2329. var jsonblob = this.Ctx.Input.RequestBody
  2330. json.Unmarshal(jsonblob, &model)
  2331. svc := supplierscenefile.GetSupplierScenefileService(utils.DBE)
  2332. model.FileUrl = strings.Trim(model.FileUrl, "$")
  2333. model.FileName = strings.Trim(model.FileName, "$")
  2334. model.CreateOn = time.Now()
  2335. model.CreateBy = this.User.Realname
  2336. model.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
  2337. where := "SupplierId=" + id
  2338. svc.DeleteEntityBytbl(OilSupplierSceneFileName, where)
  2339. _, err := svc.InsertEntity(&model)
  2340. if err == nil {
  2341. errinfo.Message = "操作成功!"
  2342. errinfo.Code = 0
  2343. this.Data["json"] = &errinfo
  2344. this.ServeJSON()
  2345. } else {
  2346. errinfo.Message = "操作失败!" + utils.AlertProcess(err.Error())
  2347. errinfo.Code = -1
  2348. this.Data["json"] = &errinfo
  2349. this.ServeJSON()
  2350. }
  2351. }
  2352. // @Title 更新文件上传
  2353. // @Description 更新文件上传copy
  2354. // @Param id path string true
  2355. // @Success 200 {object}
  2356. // @router /editsubfilecopy/:id [put]
  2357. func (this *OilSupplierController) EditSubfileCopy() {
  2358. id := this.Ctx.Input.Param(":id")
  2359. var errinfo ErrorInfo
  2360. if id == "" {
  2361. errinfo.Message = "操作失败!请求信息不完整"
  2362. errinfo.Code = -2
  2363. this.Data["json"] = &errinfo
  2364. this.ServeJSON()
  2365. return
  2366. }
  2367. var model supplierscenefile.OilSupplierSceneFile
  2368. var jsonblob = this.Ctx.Input.RequestBody
  2369. json.Unmarshal(jsonblob, &model)
  2370. svc := supplierscenefile.GetSupplierScenefileService(utils.DBE)
  2371. model.FileUrl = strings.Trim(model.FileUrl, "$")
  2372. model.FileName = strings.Trim(model.FileName, "$")
  2373. model.CreateOn = time.Now()
  2374. model.CreateBy = this.User.Realname
  2375. model.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
  2376. _, err := svc.InsertEntity(&model)
  2377. if err == nil {
  2378. errinfo.Message = "操作成功!"
  2379. errinfo.Code = 0
  2380. this.Data["json"] = &errinfo
  2381. this.ServeJSON()
  2382. } else {
  2383. errinfo.Message = "操作失败!" + utils.AlertProcess(err.Error())
  2384. errinfo.Code = -1
  2385. this.Data["json"] = &errinfo
  2386. this.ServeJSON()
  2387. }
  2388. }
  2389. // @Title 删除单条信息
  2390. // @Description
  2391. // @Success 200 {object} ErrorInfo
  2392. // @Failure 403 :id 为空
  2393. // @router /editsubfiledelete/:Id [delete]
  2394. func (this *OilSupplierController) EditSubfileDelete() {
  2395. Id := this.Ctx.Input.Param(":Id")
  2396. var errinfo ErrorInfo
  2397. if Id == "" {
  2398. errinfo.Message = "操作失败!请求信息不完整"
  2399. errinfo.Code = -2
  2400. this.Data["json"] = &errinfo
  2401. this.ServeJSON()
  2402. return
  2403. }
  2404. var model supplierscenefile.OilSupplierSceneFile
  2405. var model1 supplierscenefile.OilSupplierSceneFile
  2406. svc := supplierscenefile.GetSupplierScenefileService(utils.DBE)
  2407. opdesc := "删除-" + Id
  2408. err := svc.DeleteOperationAndWriteLogBytbl(OilSupplierSceneFileName, BaseOperationLogName, Id, &model, &model1, utils.ToStr(this.User.Id), this.User.Username, opdesc, this.User.AccCode, "考察报告删除")
  2409. if err == nil {
  2410. errinfo.Message = "删除成功"
  2411. errinfo.Code = 0
  2412. this.Data["json"] = &errinfo
  2413. this.ServeJSON()
  2414. } else {
  2415. errinfo.Message = "删除失败!" + utils.AlertProcess(err.Error())
  2416. errinfo.Code = -1
  2417. this.Data["json"] = &errinfo
  2418. this.ServeJSON()
  2419. }
  2420. }
  2421. // @Title get 导入excel
  2422. // @Description get SampleType by token
  2423. // @Success 200 {object} sampletype.SampleType
  2424. // @router /importexcel [get]
  2425. func (this *OilSupplierController) ImportExcel() {
  2426. url := this.GetString("ExcelUrl")
  2427. var errorinfo ErrorInfo
  2428. if url == "" {
  2429. errorinfo.Code = -2
  2430. errorinfo.Message = "导入失败!"
  2431. this.Data["json"] = &errorinfo
  2432. this.ServeJSON()
  2433. }
  2434. svc := supplier.GetOilSupplierService(utils.DBE)
  2435. log.Printf("url:==" + url) // http://60.30.245.229//upfile/dc1/2,063156edd288
  2436. extranetIP := utils.Cfg.MustValue("server", "extranetIP")
  2437. localIP := utils.Cfg.MustValue("server", "localIP")
  2438. if strings.Index(url, extranetIP) >= 0 {
  2439. url = strings.Replace(url, extranetIP, localIP, 1)
  2440. }
  2441. _dir := utils.Cfg.MustValue("file", "tmplateDir") + "xlsx"
  2442. filename := strconv.Itoa(int(time.Now().Unix())) + ".xlsx"
  2443. url = strings.Replace(url, "60.30.245.229", "10.76.248.23", -1)
  2444. utils.DownloadFile(url, filename, _dir)
  2445. t := time.Now()
  2446. filePath := utils.Cfg.MustValue("file", "tmplateDir") + "xlsx/" + filename
  2447. xlFile, err := xlsx.OpenFile(filePath)
  2448. //excelFileName := "F:/物资类项目与资质对照表-2017.xlsx"
  2449. if err != nil {
  2450. fmt.Printf("open failed: %s\n", err)
  2451. }
  2452. var sheet = xlFile.Sheets[0]
  2453. var errLineNum string
  2454. for i := 1; i < len(sheet.Rows); i++ {
  2455. lineNo := strconv.Itoa(i + 1)
  2456. if len(sheet.Rows[i].Cells) != 0 {
  2457. this.OperationCell(svc, lineNo, sheet.Rows[i].Cells, &errLineNum)
  2458. }
  2459. }
  2460. os.Remove(filePath)
  2461. if errLineNum != "" {
  2462. errorinfo.Code = -1
  2463. errorinfo.Message = "导入失败!错误行号:" + errLineNum
  2464. this.Data["json"] = &errorinfo
  2465. this.ServeJSON()
  2466. } else {
  2467. elapsed := time.Since(t)
  2468. log.Println(elapsed)
  2469. errorinfo.Code = 0
  2470. errorinfo.Message = "导入成功!"
  2471. this.Data["json"] = &errorinfo
  2472. this.ServeJSON()
  2473. }
  2474. }
  2475. func (this *OilSupplierController) OperationCell(svc *supplier.OilSupplierService, lineNo string, cellsArr []*xlsx.Cell, errLineNum *string) {
  2476. defer func() {
  2477. if err := recover(); err != nil {
  2478. log.Println("err"+lineNo, err)
  2479. *errLineNum += lineNo + ","
  2480. }
  2481. }()
  2482. cells := cellsArr
  2483. supplierName := strings.TrimSpace(cells[0].Value)
  2484. oilCertificateNo := ""
  2485. if len(cells) >= 2 {
  2486. oilCertificateNo = strings.TrimSpace(cells[1].Value)
  2487. }
  2488. cols := []string{"PACNumber"}
  2489. var entity supplier.OilSupplier
  2490. entity.PACNumber = oilCertificateNo
  2491. where := "SupplierName='" + supplierName + "'"
  2492. err := svc.UpdateEntityBywheretbl(OilSupplierName, &entity, cols, where)
  2493. if err != nil {
  2494. panic(err)
  2495. }
  2496. }
  2497. // @Title 获取列表
  2498. // @Description get user by token
  2499. // @Success 200 {object} []supplier.OilSupplier
  2500. // @router /getscenefilelist [get]
  2501. func (this *OilSupplierController) GetSceneFileList() {
  2502. supplierId := this.GetString("SupplierId")
  2503. page := this.GetPageInfoForm()
  2504. orderby := "Id"
  2505. var model []supplierscenefile.OilSupplierSceneFile
  2506. svc := supplierscenefile.GetSupplierScenefileService(utils.DBE)
  2507. where := "SupplierId=" + supplierId
  2508. svc.GetPagingEntitiesWithOrderBytbl("", page.CurrentPage, page.Size, orderby, true, &model, where)
  2509. var errinfo ErrorDataInfo
  2510. errinfo.Item = model
  2511. errinfo.Code = 1
  2512. this.Data["json"] = &errinfo
  2513. this.ServeJSON()
  2514. }
  2515. // @Title 获取已使用的银行账号
  2516. // @Description
  2517. // @Success 200 {object} controllers.Request
  2518. // @router /getBankAccount [get]
  2519. func (this *OilSupplierController) GetBankAccountIsExist() {
  2520. bankAccount := this.GetString("bankAccount")
  2521. supplierId := this.GetString("supId")
  2522. sqlStr := "SELECT BankAccount FROM OilSupplier where BankAccount='" + bankAccount + "'"
  2523. if supplierId != "" {
  2524. sqlStr += " and Id !=" + supplierId
  2525. }
  2526. svc := supplier.GetOilSupplierService(utils.DBE)
  2527. list, _ := svc.DBE.QueryString(sqlStr)
  2528. var errorInfo ErrorDataInfo
  2529. if list != nil {
  2530. errorInfo.Item = true
  2531. this.Data["json"] = &errorInfo
  2532. this.ServeJSON()
  2533. } else {
  2534. errorInfo.Item = false
  2535. this.Data["json"] = &errorInfo
  2536. this.ServeJSON()
  2537. }
  2538. }
  2539. // @Title 获取已使用的统一社会信用代码
  2540. // @Description
  2541. // @Success 200 {object} controllers.Request
  2542. // @router /getCommercialNo [get]
  2543. func (this *OilSupplierController) GetCommercialNoIsExist() {
  2544. commercialNo := this.GetString("commercialNo")
  2545. supplierId := this.GetString("supId")
  2546. sqlStr := "SELECT CommercialNo FROM OilSupplier where CommercialNo='" + commercialNo + "'"
  2547. if supplierId != "" {
  2548. sqlStr += " and Id !=" + supplierId
  2549. }
  2550. svc := supplier.GetOilSupplierService(utils.DBE)
  2551. list, _ := svc.DBE.QueryString(sqlStr)
  2552. var errorInfo ErrorDataInfo
  2553. if list != nil {
  2554. errorInfo.Item = true
  2555. this.Data["json"] = &errorInfo
  2556. this.ServeJSON()
  2557. } else {
  2558. errorInfo.Item = false
  2559. this.Data["json"] = &errorInfo
  2560. this.ServeJSON()
  2561. }
  2562. }
  2563. // @Title 信息变更检查资质
  2564. // @Description
  2565. // @Success 200 {object} controllers.Request
  2566. // @router /checkSupplierFile [post]
  2567. func (this *OilSupplierController) CheckSupplierFile() {
  2568. var file supplierfile.File
  2569. var jsonBlob = this.Ctx.Input.RequestBody
  2570. json.Unmarshal(jsonBlob, &file)
  2571. //获取主表信息
  2572. var supplierEntity supplier.OilSupplier
  2573. var errinfo ErrorDataInfo
  2574. supplierService := supplier.GetOilSupplierService(utils.DBE)
  2575. supplierService.GetEntityById(file.SupplierId, &supplierEntity)
  2576. //获取准入信息表
  2577. var supplierCertEntity []suppliercert.OilSupplierCert
  2578. supplierService.GetEntitysByWhere("OilSupplierCert", "SupplierId = "+strconv.Itoa(file.SupplierId), &supplierCertEntity)
  2579. for _, cert := range supplierCertEntity {
  2580. //对准入范围的判断
  2581. var certSubList []suppliercertsub.OilSupplierCertSub
  2582. certsubService := suppliercertsub.GetOilSupplierCertSubService(utils.DBE)
  2583. certsubService.GetListByCertId(strconv.Itoa(cert.Id), &certSubList)
  2584. // 查询出已有哪些资质
  2585. var tableheaderList []qualchange.OilQualChangeDetail1
  2586. fileSql := "SELECT * from OilSupplierFile WHERE SupplierId = " + strconv.Itoa(file.SupplierId)
  2587. svcHeader := tableheader.GetTableHeaderService(utils.DBE)
  2588. svcHeader.DBE.SQL(fileSql).Find(&tableheaderList)
  2589. var companyHasHeaders string
  2590. for _, tableheader := range tableheaderList {
  2591. companyHasHeaders += tableheader.NeedFileType + ","
  2592. }
  2593. paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
  2594. filesvc := supplierfile.GetSupplierfileService(utils.DBE)
  2595. mergerCertSkipField := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MergerCertSkipFieldName")
  2596. idString := ""
  2597. idString1 := ""
  2598. for i := 0; i < len(certSubList); i = i + 1000 {
  2599. var ids suppliercertsub.Ids
  2600. certsubService.GetIds(strconv.Itoa(cert.Id), cert.SupplierTypeCode, &ids, 3, strconv.Itoa(i))
  2601. if ids.Id != "" {
  2602. idString += "," + ids.Id
  2603. } else {
  2604. break
  2605. }
  2606. }
  2607. var needList []supplierfile.FileList
  2608. var needList1 []supplierfile.FileList
  2609. if cert.SupplierTypeCode == "01" {
  2610. //需要的资质
  2611. needList = filesvc.GetGoodsNeedFileListNew(idString, "2")
  2612. if file.Type == 1 { //制造商
  2613. idString = ""
  2614. //如果是制造商,准入范围按照各项准入范围的类型判断
  2615. for i := 0; i < len(certSubList); i = i + 1000 {
  2616. var ids suppliercertsub.Ids
  2617. certsubService.GetIds(strconv.Itoa(cert.Id), cert.SupplierTypeCode, &ids, 1, strconv.Itoa(i))
  2618. if ids.Id != "" {
  2619. idString += "," + ids.Id
  2620. } else {
  2621. break
  2622. }
  2623. }
  2624. for i := 0; i < len(certSubList); i = i + 1000 {
  2625. var ids1 suppliercertsub.Ids
  2626. certsubService.GetIds(strconv.Itoa(cert.Id), cert.SupplierTypeCode, &ids1, 2, strconv.Itoa(i))
  2627. if ids1.Id != "" {
  2628. idString1 += "," + ids1.Id
  2629. } else {
  2630. break
  2631. }
  2632. }
  2633. needList = filesvc.GetGoodsNeedFileListNew(idString, "1")
  2634. needList1 = filesvc.GetGoodsNeedFileListNew(idString1, "2")
  2635. var needFile supplierfile.FileList
  2636. // 质量管理体系认证证书
  2637. CNPCrenkezhengshu := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "CNPCrenkezhengshu")
  2638. needFile.FileName = CNPCrenkezhengshu
  2639. needList = append(needList, needFile)
  2640. for _, need := range needList1 {
  2641. needList = append(needList, need)
  2642. }
  2643. }
  2644. } else if cert.SupplierTypeCode == "02" {
  2645. needList = filesvc.GetBasicNeedFileListNew(idString)
  2646. } else if cert.SupplierTypeCode == "03" {
  2647. needList = filesvc.GetTechNeedFileListNew(idString)
  2648. }
  2649. //if cert.InStyle == "4" {
  2650. // var needFile supplierfile.FileList
  2651. // //战略合作协议扫描件
  2652. // needFile.FileName = paramSvc.GetBaseparameterMessage("GFGL", "paramset", "CooperationFile")
  2653. // needList = append(needList, needFile)
  2654. //}
  2655. if cert.InStyle == "6" {
  2656. var needFile supplierfile.FileList
  2657. //招标准入需提供招标中标结果
  2658. needFile.FileName = paramSvc.GetBaseparameterMessage("GFGL", "paramset", "TheTender")
  2659. needList = append(needList, needFile)
  2660. }
  2661. for _, needHeader := range needList {
  2662. if (supplierEntity.CredentialFlag == "1" || supplierEntity.CredentialFlag == "2") &&
  2663. strings.Contains(mergerCertSkipField, needHeader.FileName+",") {
  2664. //三证合一或五证合一的证件,不需要验证了
  2665. continue
  2666. }
  2667. var fileist1 supplierfile.OilSupplierFile
  2668. where1 := " SupplierId = '" + strconv.Itoa(file.SupplierId) + "' and NeedFileType = '" + needHeader.FileName + "'"
  2669. filesvc.GetEntityByWhere("OilSupplierFile", where1, &fileist1)
  2670. var filelist2 qualchange.OilQualChangeDetail
  2671. where2 := " SupplierId = '" + strconv.Itoa(file.SupplierId) + "' and NeedFileType = '" + needHeader.FileName + "'"
  2672. svc2 := suppliercertappendsub.GetOilSupplierCertAppendSubService(utils.DBE)
  2673. svc2.GetEntityByWhere("OilQualChangeDetail", where2, &filelist2)
  2674. if !strings.Contains(companyHasHeaders, needHeader.FileName+",") {
  2675. errinfo.Message = "请上传!" + needHeader.FileName + "! 详情请点击检查资质按钮查看!"
  2676. errinfo.Code = 0
  2677. this.Data["json"] = &errinfo
  2678. this.ServeJSON()
  2679. return
  2680. } else {
  2681. if filelist2.FileName == "" && fileist1.FileName == "" {
  2682. //缺少的资质
  2683. errinfo.Message = "请上传!" + needHeader.FileName + "! 详情请点击检查资质按钮查看!"
  2684. errinfo.Code = 0
  2685. this.Data["json"] = &errinfo
  2686. this.ServeJSON()
  2687. return
  2688. }
  2689. }
  2690. }
  2691. }
  2692. errinfo.Code = 1
  2693. this.Data["json"] = &errinfo
  2694. this.ServeJSON()
  2695. }
  2696. // @Title 准入/增项/年审/已入库保存检查资质方法
  2697. // @Description
  2698. // @Success 200 {object} controllers.Request
  2699. // @router /checkSupplierFileNew [post]
  2700. func (this *OilSupplierController) CheckSupplierFileNew() {
  2701. var file supplierfile.CheckFile
  2702. var jsonBlob = this.Ctx.Input.RequestBody
  2703. json.Unmarshal(jsonBlob, &file)
  2704. //获取主表信息
  2705. var supplierEntity supplier.OilSupplier
  2706. var errinfo ErrorDataInfo
  2707. supplierService := supplier.GetOilSupplierService(utils.DBE)
  2708. supplierService.GetEntityById(file.SupplierId, &supplierEntity)
  2709. //获取准入信息表
  2710. var cert suppliercert.OilSupplierCert
  2711. supplierService.GetEntityByWhere("OilSupplierCert", "Id = "+file.CertId, &cert)
  2712. // 查询出已有哪些资质
  2713. var tableheaderList []qualchange.OilQualChangeDetail1
  2714. fileSql := "SELECT * from OilSupplierFile WHERE SupplierId = " + strconv.Itoa(file.SupplierId)
  2715. svcHeader := tableheader.GetTableHeaderService(utils.DBE)
  2716. svcHeader.DBE.SQL(fileSql).Find(&tableheaderList)
  2717. var companyHasHeaders string
  2718. for _, tableheader := range tableheaderList {
  2719. companyHasHeaders += tableheader.NeedFileType + ","
  2720. }
  2721. paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
  2722. filesvc := supplierfile.GetSupplierfileService(utils.DBE)
  2723. mergerCertSkipField := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MergerCertSkipFieldName")
  2724. var certSubList []suppliercertsub.OilSupplierCertSub
  2725. certsubService := suppliercertsub.GetOilSupplierCertSubService(utils.DBE)
  2726. certsubService.GetListByCertId(strconv.Itoa(cert.Id), &certSubList)
  2727. idString := ""
  2728. idString1 := ""
  2729. for i := 0; i < len(certSubList); i = i + 1000 {
  2730. var ids suppliercertsub.Ids
  2731. certsubService.GetIds(strconv.Itoa(cert.Id), cert.SupplierTypeCode, &ids, 3, strconv.Itoa(i))
  2732. if ids.Id != "" {
  2733. idString += "," + ids.Id
  2734. } else {
  2735. break
  2736. }
  2737. }
  2738. //certsubService.GetIds(strconv.Itoa(cert.Id), cert.SupplierTypeCode, &ids, 1)
  2739. //certsubService.GetIds(strconv.Itoa(cert.Id), cert.SupplierTypeCode, &ids1, 2)
  2740. var needList []supplierfile.FileList
  2741. var needList1 []supplierfile.FileList
  2742. if cert.SupplierTypeCode == "01" {
  2743. //需要的资质
  2744. total := certsubService.GetCountIsManufacturer(strconv.Itoa(cert.Id))
  2745. if file.Type == 2 && total > 0 {
  2746. errinfo.Message = "非制造商准入范围不能为制造商,请手动修改!"
  2747. errinfo.Code = 0
  2748. this.Data["json"] = &errinfo
  2749. this.ServeJSON()
  2750. return
  2751. }
  2752. gradeTotal := certsubService.GetCountGrade(strconv.Itoa(cert.Id))
  2753. if file.Grade == "2" && gradeTotal > 0 {
  2754. errinfo.Message = "二级供应商不能准入一级物资!"
  2755. errinfo.Code = 0
  2756. this.Data["json"] = &errinfo
  2757. this.ServeJSON()
  2758. return
  2759. }
  2760. needList = filesvc.GetGoodsNeedFileListNew(idString, "2")
  2761. if file.Type == 1 { //制造商
  2762. idString = ""
  2763. for i := 0; i < len(certSubList); i = i + 1000 {
  2764. var ids suppliercertsub.Ids
  2765. certsubService.GetIds(strconv.Itoa(cert.Id), cert.SupplierTypeCode, &ids, 1, strconv.Itoa(i))
  2766. if ids.Id != "" {
  2767. idString += "," + ids.Id
  2768. } else {
  2769. break
  2770. }
  2771. }
  2772. for i := 0; i < len(certSubList); i = i + 1000 {
  2773. var ids1 suppliercertsub.Ids
  2774. certsubService.GetIds(strconv.Itoa(cert.Id), cert.SupplierTypeCode, &ids1, 2, strconv.Itoa(i))
  2775. if ids1.Id != "" {
  2776. idString1 += "," + ids1.Id
  2777. } else {
  2778. break
  2779. }
  2780. }
  2781. needList = filesvc.GetGoodsNeedFileListNew(idString, "1")
  2782. needList1 = filesvc.GetGoodsNeedFileListNew(idString1, "2")
  2783. var needFile supplierfile.FileList
  2784. // 质量管理体系认证证书
  2785. CNPCrenkezhengshu := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "CNPCrenkezhengshu")
  2786. needFile.FileName = CNPCrenkezhengshu
  2787. needList = append(needList, needFile)
  2788. for _, need := range needList1 {
  2789. needList = append(needList, need)
  2790. }
  2791. }
  2792. } else if cert.SupplierTypeCode == "02" {
  2793. needList = filesvc.GetBasicNeedFileListNew(idString)
  2794. } else if cert.SupplierTypeCode == "03" {
  2795. needList = filesvc.GetTechNeedFileListNew(idString)
  2796. }
  2797. //2021-02-04企管法规处去掉这一限制
  2798. //if cert.InStyle == "4" {
  2799. // var needFile supplierfile.FileList
  2800. // //战略合作协议扫描件
  2801. // needFile.FileName = paramSvc.GetBaseparameterMessage("GFGL", "paramset", "CooperationFile")
  2802. // needList = append(needList, needFile)
  2803. //}
  2804. if cert.InStyle == "6" {
  2805. var needFile supplierfile.FileList
  2806. //招标准入需提供招标中标结果
  2807. needFile.FileName = paramSvc.GetBaseparameterMessage("GFGL", "paramset", "TheTender")
  2808. needList = append(needList, needFile)
  2809. }
  2810. for _, needHeader := range needList {
  2811. if (supplierEntity.CredentialFlag == "1" || supplierEntity.CredentialFlag == "2") &&
  2812. strings.Contains(mergerCertSkipField, needHeader.FileName+",") {
  2813. //三证合一或五证合一的证件,不需要验证了
  2814. continue
  2815. }
  2816. var fileist1 supplierfile.OilSupplierFile
  2817. where1 := " SupplierId = '" + strconv.Itoa(file.SupplierId) + "' and NeedFileType = '" + needHeader.FileName + "'"
  2818. filesvc.GetEntityByWhere("OilSupplierFile", where1, &fileist1)
  2819. if !strings.Contains(companyHasHeaders, needHeader.FileName+",") {
  2820. errinfo.Message = "请上传!" + needHeader.FileName + "! 详情请点击检查资质按钮查看!"
  2821. errinfo.Code = 0
  2822. this.Data["json"] = &errinfo
  2823. this.ServeJSON()
  2824. return
  2825. } else {
  2826. if file.Table == 3 {
  2827. var filelist2 annualaudit.OilAnnualChangeDetail
  2828. where2 := " SupplierId = '" + strconv.Itoa(file.SupplierId) + "' and NeedFileType = '" + needHeader.FileName + "'"
  2829. svc2 := suppliercertappendsub.GetOilSupplierCertAppendSubService(utils.DBE)
  2830. svc2.GetEntityByWhere("OilAnnualChangeDetail", where2, &filelist2)
  2831. if filelist2.FileName == "" && fileist1.FileName == "" {
  2832. //缺少的资质
  2833. errinfo.Message = "请上传!" + needHeader.FileName + "! 详情请点击检查资质按钮查看!"
  2834. errinfo.Code = 0
  2835. this.Data["json"] = &errinfo
  2836. this.ServeJSON()
  2837. return
  2838. }
  2839. }
  2840. if file.Table == 4 {
  2841. var filelist2 suppliercertappendsub.OilAppendChangeDetail
  2842. where2 := " SupplierId = '" + strconv.Itoa(file.SupplierId) + "' and NeedFileType = '" + needHeader.FileName + "'"
  2843. svc2 := suppliercertappendsub.GetOilSupplierCertAppendSubService(utils.DBE)
  2844. svc2.GetEntityByWhere("OilAppendChangeDetail", where2, &filelist2)
  2845. if filelist2.FileName == "" && fileist1.FileName == "" {
  2846. //缺少的资质
  2847. errinfo.Message = "请上传!" + needHeader.FileName + "! 详情请点击检查资质按钮查看!"
  2848. errinfo.Code = 0
  2849. this.Data["json"] = &errinfo
  2850. this.ServeJSON()
  2851. return
  2852. }
  2853. }
  2854. }
  2855. }
  2856. errinfo.Code = 1
  2857. this.Data["json"] = &errinfo
  2858. this.ServeJSON()
  2859. }
  2860. // @Title 检查缺资质
  2861. // @Description
  2862. // @Success 200 {object} controllers.Request
  2863. // @router /checkSupplierFileDelete [post]
  2864. func (this *OilSupplierController) CheckSupplierFileDelete() {
  2865. //获取主表信息
  2866. var supplierList []supplier.OilSupplier
  2867. var errinfo ErrorDataInfo
  2868. supplierService := supplier.GetOilSupplierService(utils.DBE)
  2869. supplierService.GetEntitysByWhere(OilSupplierName, "1=1", &supplierList)
  2870. //var total int64
  2871. //var total1 int64
  2872. for _, supplier := range supplierList {
  2873. var supplierCertEntity []suppliercert.OilSupplierCert
  2874. supplierService.GetEntitysByWhere("OilSupplierCert", "SupplierId = "+strconv.Itoa(supplier.Id), &supplierCertEntity)
  2875. for _, cert := range supplierCertEntity {
  2876. where2 := "("
  2877. where3 := "("
  2878. //对准入范围的判断
  2879. var certSubList []suppliercertsub.OilSupplierCertSub
  2880. certsubService := suppliercertsub.GetOilSupplierCertSubService(utils.DBE)
  2881. certsubService.GetListByCertId(strconv.Itoa(cert.Id), &certSubList)
  2882. // 查询出已有哪些资质
  2883. var tableheaderList []qualchange.OilQualChangeDetail1
  2884. fileSql := "SELECT * from OilSupplierFile WHERE SupplierId = " + strconv.Itoa(supplier.Id)
  2885. svcHeader := tableheader.GetTableHeaderService(utils.DBE)
  2886. svcHeader.DBE.SQL(fileSql).Find(&tableheaderList)
  2887. var companyHasHeaders string
  2888. for _, tableheader := range tableheaderList {
  2889. companyHasHeaders += tableheader.NeedFileType + ","
  2890. }
  2891. paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
  2892. filesvc := supplierfile.GetSupplierfileService(utils.DBE)
  2893. mergerCertSkipField := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MergerCertSkipFieldName")
  2894. idString := ""
  2895. idString1 := ""
  2896. for i := 0; i < len(certSubList); i = i + 1000 {
  2897. var ids suppliercertsub.Ids
  2898. certsubService.GetIds(strconv.Itoa(cert.Id), cert.SupplierTypeCode, &ids, 3, strconv.Itoa(i))
  2899. if ids.Id != "" {
  2900. idString += "," + ids.Id
  2901. } else {
  2902. break
  2903. }
  2904. }
  2905. var needList []supplierfile.FileList
  2906. var needList1 []supplierfile.FileList
  2907. if cert.SupplierTypeCode == "01" {
  2908. //需要的资质
  2909. needList1 = filesvc.GetGoodsNeedFileListNew(idString, "2")
  2910. if supplier.OperType == "制造商" { //制造商
  2911. //如果是制造商,准入范围按照各项准入范围的类型判断
  2912. // 制造
  2913. idString = ""
  2914. for i := 0; i < len(certSubList); i = i + 1000 {
  2915. var ids suppliercertsub.Ids
  2916. certsubService.GetIds(strconv.Itoa(cert.Id), cert.SupplierTypeCode, &ids, 1, strconv.Itoa(i))
  2917. if ids.Id != "" {
  2918. idString += "," + ids.Id
  2919. } else {
  2920. break
  2921. }
  2922. }
  2923. // 非制造
  2924. for i := 0; i < len(certSubList); i = i + 1000 {
  2925. var ids1 suppliercertsub.Ids
  2926. certsubService.GetIds(strconv.Itoa(cert.Id), cert.SupplierTypeCode, &ids1, 2, strconv.Itoa(i))
  2927. if ids1.Id != "" {
  2928. idString1 += "," + ids1.Id
  2929. } else {
  2930. break
  2931. }
  2932. }
  2933. needList = filesvc.GetGoodsNeedFileListNew(idString, "1")
  2934. needList1 = filesvc.GetGoodsNeedFileListNew(idString1, "2")
  2935. //for _, need := range needList1 {
  2936. // needList = append(needList, need)
  2937. //}
  2938. }
  2939. } else if cert.SupplierTypeCode == "02" {
  2940. needList = filesvc.GetBasicNeedFileListNew(idString)
  2941. } else if cert.SupplierTypeCode == "03" {
  2942. needList = filesvc.GetTechNeedFileListNew(idString)
  2943. }
  2944. needName := ""
  2945. for _, needHeader := range needList {
  2946. if (supplier.CredentialFlag == "1" || supplier.CredentialFlag == "2") &&
  2947. strings.Contains(mergerCertSkipField, needHeader.FileName+",") {
  2948. //三证合一或五证合一的证件,不需要验证了
  2949. continue
  2950. }
  2951. if cert.SupplierTypeCode == "02" && (needHeader.FileName == "安全资质审查" || needHeader.FileName == "培训考核") {
  2952. // 基建类
  2953. continue
  2954. }
  2955. if !strings.Contains(companyHasHeaders, needHeader.FileName+",") {
  2956. var header tableheader.BaseTableheader
  2957. where1 := "Name = '" + needHeader.FileName + "' and CategoryCode = '" + cert.SupplierTypeCode + "'"
  2958. if cert.SupplierTypeCode == "01" {
  2959. where1 += " and IsManuf != '2'"
  2960. }
  2961. supplierService.GetEntityByWhere(BaseTableHeader, where1, &header)
  2962. if header.Code != "" {
  2963. needName += header.Name + ","
  2964. if where2 == "(" {
  2965. where2 += header.Code + " = '1'"
  2966. } else {
  2967. where2 += " or " + header.Code + " = '1'"
  2968. }
  2969. } else {
  2970. fmt.Print("22222")
  2971. }
  2972. }
  2973. }
  2974. for _, needHeader := range needList1 {
  2975. if (supplier.CredentialFlag == "1" || supplier.CredentialFlag == "2") &&
  2976. strings.Contains(mergerCertSkipField, needHeader.FileName+",") {
  2977. //三证合一或五证合一的证件,不需要验证了
  2978. continue
  2979. }
  2980. if !strings.Contains(companyHasHeaders, needHeader.FileName+",") {
  2981. var header tableheader.BaseTableheader
  2982. where1 := "Name = '" + needHeader.FileName + "' and CategoryCode = '" + cert.SupplierTypeCode + "'"
  2983. if cert.SupplierTypeCode == "01" {
  2984. // 非制造商
  2985. where1 += " and IsManuf != '1'"
  2986. }
  2987. supplierService.GetEntityByWhere(BaseTableHeader, where1, &header)
  2988. if header.Code != "" {
  2989. needName += header.Name + ","
  2990. if where3 == "(" {
  2991. where3 += header.Code + " = '1'"
  2992. } else {
  2993. where3 += " or " + header.Code + " = '1'"
  2994. }
  2995. } else {
  2996. fmt.Print("11111")
  2997. }
  2998. }
  2999. }
  3000. if where2 == "(" && where3 == "(" {
  3001. continue
  3002. }
  3003. if cert.SupplierTypeCode != "01" && where2 == "(" {
  3004. continue
  3005. }
  3006. where2 += ") and a.SupplierId = " + strconv.Itoa(supplier.Id) + " and a.SupplierTypeCode = '" + cert.SupplierTypeCode + "'"
  3007. where3 += ") and a.SupplierId = " + strconv.Itoa(supplier.Id) + " and a.SupplierTypeCode = '" + cert.SupplierTypeCode + "'"
  3008. var certSub []suppliercertsub.OilSupplierCertSub
  3009. if cert.SupplierTypeCode == "01" {
  3010. if supplier.OperType == "制造商" {
  3011. where2 += " and IsManufacturer != 2"
  3012. where3 += " and IsManufacturer = 2"
  3013. supplierService.GetDeleteSub(OilGoodsAptitudeName, where2, &certSub)
  3014. supplierService.GetDeleteSub(OilGoodsAptitudeName, where3, &certSub)
  3015. } else {
  3016. supplierService.GetDeleteSub(OilGoodsAptitudeName, where3, &certSub)
  3017. }
  3018. } else if cert.SupplierTypeCode == "02" {
  3019. supplierService.GetDeleteSub(OilBasisBuildName, where2, &certSub)
  3020. } else {
  3021. supplierService.GetDeleteSub(OilTechnologyServiceName, where2, &certSub)
  3022. }
  3023. var supplierCert suppliercert.OilSupplierCert
  3024. supplierCert.BackRemark = needName
  3025. cols := []string{"BackRemark"}
  3026. supplierService.UpdateEntityBywheretbl(OilSupplierCertName, &supplierCert, cols, "Id = "+strconv.Itoa(cert.Id))
  3027. }
  3028. }
  3029. errinfo.Code = 1
  3030. this.Data["json"] = &errinfo
  3031. this.ServeJSON()
  3032. }
  3033. // @Title 检查缺资质列表
  3034. // @Description
  3035. // @Success 200 {object} controllers.Request
  3036. // @router /checkSupplierFileList [post]
  3037. func (this *OilSupplierController) CheckSupplierFileList() {
  3038. var file supplierfile.CheckFile
  3039. var jsonBlob = this.Ctx.Input.RequestBody
  3040. json.Unmarshal(jsonBlob, &file)
  3041. //获取主表信息
  3042. var supplierEntity supplier.OilSupplier
  3043. supplierService := supplier.GetOilSupplierService(utils.DBE)
  3044. supplierService.GetEntityById(file.SupplierId, &supplierEntity)
  3045. //获取准入信息表
  3046. var certList []suppliercert.OilSupplierCert
  3047. supplierService.GetEntitysByWhere("OilSupplierCert", "SupplierId = "+strconv.Itoa(file.SupplierId), &certList)
  3048. certsubService := suppliercertsub.GetOilSupplierCertSubService(utils.DBE)
  3049. // 查询出已有哪些资质
  3050. var tableheaderList []qualchange.OilQualChangeDetail1
  3051. fileSql := "SELECT * from OilSupplierFile WHERE SupplierId = " + strconv.Itoa(file.SupplierId)
  3052. svcHeader := tableheader.GetTableHeaderService(utils.DBE)
  3053. svcHeader.DBE.SQL(fileSql).Find(&tableheaderList)
  3054. var companyHasHeaders string
  3055. for _, tableheader := range tableheaderList {
  3056. companyHasHeaders += tableheader.NeedFileType + ","
  3057. }
  3058. paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
  3059. filesvc := supplierfile.GetSupplierfileService(utils.DBE)
  3060. mergerCertSkipField := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MergerCertSkipFieldName")
  3061. for _, cert := range certList {
  3062. if file.CertId != "0" && strconv.Itoa(cert.Id) != file.CertId {
  3063. continue
  3064. }
  3065. var certSubList2 suppliercertsub.OilSupplierCertSub
  3066. certSubList2.LackFile = ""
  3067. certSubList2.IsQuestion = 0
  3068. svcHeader.UpdateEntityBywheretbl(OilSupplierCertSubName, &certSubList2, []string{"LackFile", "IsQuestion"}, "IsQuestion = 2 and SupplierId = "+strconv.Itoa(supplierEntity.Id)+" and SupplierCertId = "+strconv.Itoa(cert.Id))
  3069. //对准入范围的判断
  3070. var certSubList []suppliercertsub.OilSupplierCertSub
  3071. certsubService.GetListByCertId(strconv.Itoa(cert.Id), &certSubList)
  3072. idString := ""
  3073. idString1 := ""
  3074. for i := 0; i < len(certSubList); i = i + 1000 {
  3075. var ids suppliercertsub.Ids
  3076. certsubService.GetIds(strconv.Itoa(cert.Id), cert.SupplierTypeCode, &ids, 3, strconv.Itoa(i))
  3077. if ids.Id != "" {
  3078. idString += "," + ids.Id
  3079. } else {
  3080. break
  3081. }
  3082. }
  3083. var needList []supplierfile.FileList
  3084. var needList1 []supplierfile.FileList
  3085. if cert.SupplierTypeCode == "01" {
  3086. //需要的资质
  3087. needList1 = filesvc.GetGoodsNeedFileListNew(idString, "2")
  3088. if file.Type == 1 { //制造商
  3089. //如果是制造商,准入范围按照各项准入范围的类型判断
  3090. // 制造
  3091. idString = ""
  3092. for i := 0; i < len(certSubList); i = i + 1000 {
  3093. var ids suppliercertsub.Ids
  3094. certsubService.GetIds(strconv.Itoa(cert.Id), cert.SupplierTypeCode, &ids, 1, strconv.Itoa(i))
  3095. if ids.Id != "" {
  3096. idString += "," + ids.Id
  3097. } else {
  3098. break
  3099. }
  3100. }
  3101. // 非制造
  3102. for i := 0; i < len(certSubList); i = i + 1000 {
  3103. var ids1 suppliercertsub.Ids
  3104. certsubService.GetIds(strconv.Itoa(cert.Id), cert.SupplierTypeCode, &ids1, 2, strconv.Itoa(i))
  3105. if ids1.Id != "" {
  3106. idString1 += "," + ids1.Id
  3107. } else {
  3108. break
  3109. }
  3110. }
  3111. needList = filesvc.GetGoodsNeedFileListNew(idString, "1")
  3112. needList1 = filesvc.GetGoodsNeedFileListNew(idString1, "2")
  3113. }
  3114. } else if cert.SupplierTypeCode == "02" {
  3115. needList = filesvc.GetBasicNeedFileListNew(idString)
  3116. } else if cert.SupplierTypeCode == "03" {
  3117. needList = filesvc.GetTechNeedFileListNew(idString)
  3118. }
  3119. for _, needHeader := range needList {
  3120. if (supplierEntity.CredentialFlag == "1" || supplierEntity.CredentialFlag == "2") &&
  3121. strings.Contains(mergerCertSkipField, needHeader.FileName+",") {
  3122. //三证合一或五证合一的证件,不需要验证了
  3123. continue
  3124. }
  3125. if !strings.Contains(companyHasHeaders, needHeader.FileName+",") {
  3126. var header tableheader.BaseTableheader
  3127. where1 := "Name = '" + needHeader.FileName + "' and CategoryCode = '" + cert.SupplierTypeCode + "'"
  3128. if cert.SupplierTypeCode == "01" {
  3129. where1 += " and IsManuf != '2'"
  3130. }
  3131. supplierService.GetEntityByWhere(BaseTableHeader, where1, &header)
  3132. if header.Code != "" {
  3133. where2 := header.Code + " = '1'"
  3134. where2 += " and a.SupplierId = " + strconv.Itoa(supplierEntity.Id) + " and a.SupplierTypeCode = '" + cert.SupplierTypeCode + "'"
  3135. var certSub []suppliercertsub.OilSupplierCertSub
  3136. if cert.SupplierTypeCode == "01" {
  3137. where2 += " and IsManufacturer != 2"
  3138. supplierService.GetDeleteSub2(OilGoodsAptitudeName, where2, &certSub, header.Name)
  3139. } else if cert.SupplierTypeCode == "02" {
  3140. supplierService.GetDeleteSub2(OilBasisBuildName, where2, &certSub, header.Name)
  3141. } else {
  3142. supplierService.GetDeleteSub2(OilTechnologyServiceName, where2, &certSub, header.Name)
  3143. }
  3144. } else {
  3145. fmt.Print("22222")
  3146. }
  3147. }
  3148. }
  3149. for _, needHeader := range needList1 {
  3150. // 非制造
  3151. if (supplierEntity.CredentialFlag == "1" || supplierEntity.CredentialFlag == "2") &&
  3152. strings.Contains(mergerCertSkipField, needHeader.FileName+",") {
  3153. //三证合一或五证合一的证件,不需要验证了
  3154. continue
  3155. }
  3156. if !strings.Contains(companyHasHeaders, needHeader.FileName+",") {
  3157. var header tableheader.BaseTableheader
  3158. where1 := "Name = '" + needHeader.FileName + "' and CategoryCode = '" + cert.SupplierTypeCode + "'"
  3159. if cert.SupplierTypeCode == "01" {
  3160. where1 += " and IsManuf != '1'"
  3161. }
  3162. supplierService.GetEntityByWhere(BaseTableHeader, where1, &header)
  3163. if header.Code != "" {
  3164. where2 := header.Code + " = '1'"
  3165. where2 += " and a.SupplierId = " + strconv.Itoa(supplierEntity.Id) + " and a.SupplierTypeCode = '" + cert.SupplierTypeCode + "'"
  3166. var certSub []suppliercertsub.OilSupplierCertSub
  3167. if file.Type == 1 {
  3168. where2 += " and IsManufacturer = 2"
  3169. }
  3170. supplierService.GetDeleteSub2(OilGoodsAptitudeName, where2, &certSub, header.Name)
  3171. } else {
  3172. fmt.Print("22222")
  3173. }
  3174. }
  3175. }
  3176. }
  3177. var certSubList1 []suppliercertsub.OilSupplierCertSub
  3178. var total int64
  3179. where3 := "IsQuestion = 2 and SupplierId = " + strconv.Itoa(supplierEntity.Id)
  3180. if file.FileName != "" {
  3181. where3 += " and LackFile like '%" + file.FileName + "%'"
  3182. }
  3183. if file.SubName != "" {
  3184. where3 += " and Name like '%" + file.SubName + "%'"
  3185. }
  3186. if file.CertId != "0" {
  3187. where3 += " and SupplierCertId = " + file.CertId
  3188. }
  3189. total = certsubService.GetPagingEntitiesWithOrderBytbl("", file.CurrentPage, file.Size, "Id", true, &certSubList1, where3)
  3190. var datainfo DataInfo
  3191. datainfo.CurrentItemCount = total
  3192. datainfo.PageIndex = file.CurrentPage
  3193. datainfo.ItemsPerPage = file.Size
  3194. datainfo.Items = certSubList1
  3195. this.Data["json"] = &datainfo
  3196. this.ServeJSON()
  3197. }
  3198. // @Title 对外-招投标系统
  3199. // @Description
  3200. // @Success 200 {object}
  3201. // @router /getSupplierList [post]
  3202. func (this *OilSupplierController) GetSupplierList() {
  3203. //获取分页信息
  3204. CurrentPage, _ := this.GetInt64("pageIndex", 1)
  3205. Size, _ := this.GetInt64("pageSize", 10)
  3206. where := " b.InFlag = 1 "
  3207. orderby := "Id"
  3208. asc := false
  3209. Order := this.GetString("Order")
  3210. Prop := this.GetString("Prop")
  3211. if Order != "" && Prop != "" {
  3212. orderby = Prop
  3213. if Order == "asc" {
  3214. asc = true
  3215. }
  3216. }
  3217. SupplierName := this.GetString("Keyword")
  3218. SupplierTypeName := this.GetString("SupplierTypeName")
  3219. SupplierTypeCode := this.GetString("accessCategoryCode")
  3220. if SupplierName != "" {
  3221. where = where + " and a.SupplierName like '%" + SupplierName + "%'"
  3222. }
  3223. if SupplierTypeName != "" {
  3224. where = where + " and b.SupplierTypeName like '%" + SupplierTypeName + "%'"
  3225. }
  3226. if SupplierTypeCode != "" {
  3227. where = where + " and b.SupplierTypeCode ='" + SupplierTypeCode + "'"
  3228. }
  3229. svc := supplier.GetOilSupplierService(utils.DBE)
  3230. var total int64
  3231. var list []supplier.CompanyList
  3232. total = svc.GetMyPagingEntitiesWithOrderBytbl4(OilSupplierName, OilSupplierCertName, CurrentPage, Size, orderby, asc, &list, where)
  3233. var datainfo DataInfo
  3234. datainfo.Items = list
  3235. datainfo.CurrentItemCount = total
  3236. datainfo.PageIndex = CurrentPage
  3237. datainfo.ItemsPerPage = Size
  3238. this.Data["json"] = &datainfo
  3239. this.ServeJSON()
  3240. }
  3241. // @Title 根据supplierId查certId
  3242. // @Description
  3243. // @Success 200 {object}
  3244. // @router /getSupplierCertId/:Id [get]
  3245. func (this *OilSupplierController) GetSupplierCertId() {
  3246. Id := this.Ctx.Input.Param(":Id")
  3247. var certList []suppliercert.OilSupplierCert
  3248. svc := supplier.GetOilSupplierService(utils.DBE)
  3249. svc.GetEntitysByWhere(OilSupplierCertName, "SupplierId = "+Id, &certList)
  3250. var datainfo DataInfo
  3251. datainfo.Items = certList
  3252. this.Data["json"] = &datainfo
  3253. this.ServeJSON()
  3254. }