2
3

supplier.go 119 KB

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