supplier.go 133 KB

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