supplier.go 72 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433
  1. package oilsupplier
  2. import (
  3. "dashoo.cn/backend/api/business/oilsupplier/suppliercertsub"
  4. "dashoo.cn/backend/api/business/register"
  5. "encoding/json"
  6. "fmt"
  7. "strconv"
  8. "strings"
  9. "time"
  10. "dashoo.cn/backend/api/business/auditsetting"
  11. "dashoo.cn/backend/api/business/organize"
  12. "dashoo.cn/business2/permission"
  13. "dashoo.cn/backend/api/business/workflow"
  14. "dashoo.cn/business2/areajson"
  15. "dashoo.cn/business2/items"
  16. "dashoo.cn/backend/api/business/baseUser"
  17. "dashoo.cn/backend/api/business/oilsupplier/supplier"
  18. "dashoo.cn/backend/api/business/oilsupplier/suppliercert"
  19. . "dashoo.cn/backend/api/controllers"
  20. "dashoo.cn/business2/userRole"
  21. "dashoo.cn/utils"
  22. "github.com/go-xorm/xorm"
  23. )
  24. type OilSupplierController struct {
  25. BaseController
  26. }
  27. // @Title 获取列表
  28. // @Description get user by token
  29. // @Success 200 {object} []supplier.OilSupplier
  30. // @router /list [get]
  31. func (this *OilSupplierController) GetEntityList() {
  32. //获取分页信息
  33. page := this.GetPageInfoForm()
  34. where := " 1=1 "
  35. orderby := "Id"
  36. asc := false
  37. Order := this.GetString("Order")
  38. Prop := this.GetString("Prop")
  39. if Order != "" && Prop != "" {
  40. orderby = Prop
  41. if Order == "asc" {
  42. asc = true
  43. }
  44. }
  45. Id := this.GetString("Id")
  46. SupplierName := this.GetString("SupplierName")
  47. OilCertificateNo := this.GetString("OilCertificateNo")
  48. Grade := this.GetString("Grade")
  49. MgrUnit := this.GetString("MgrUnit")
  50. OperType := this.GetString("OperType")
  51. Country := this.GetString("Country")
  52. MaunAgent := this.GetString("MaunAgent")
  53. ConstructTeam := this.GetString("ConstructTeam")
  54. CommercialNo := this.GetString("CommercialNo")
  55. OrganCode := this.GetString("OrganCode")
  56. CountryTaxNo := this.GetString("CountryTaxNo")
  57. LocalTaxNo := this.GetString("LocalTaxNo")
  58. Address := this.GetString("Address")
  59. Province := this.GetString("Province")
  60. City := this.GetString("City")
  61. Street := this.GetString("Street")
  62. HouseNo := this.GetString("HouseNo")
  63. ZipCode := this.GetString("ZipCode")
  64. QualitySystemCert := this.GetString("QualitySystemCert")
  65. ProductQualityCert := this.GetString("ProductQualityCert")
  66. MaunLicense := this.GetString("MaunLicense")
  67. QualifCert := this.GetString("QualifCert")
  68. QualifCertLevel := this.GetString("QualifCertLevel")
  69. SafetyLicense := this.GetString("SafetyLicense")
  70. TechServiceLic := this.GetString("TechServiceLic")
  71. TJInNotify := this.GetString("TJInNotify")
  72. SpecIndustryCert := this.GetString("SpecIndustryCert")
  73. LegalPerson := this.GetString("LegalPerson")
  74. CategoryCode := this.GetString("CategoryCode")
  75. CategoryName := this.GetString("CategoryName")
  76. RegCapital := this.GetString("RegCapital")
  77. Currency := this.GetString("Currency")
  78. ContactName := this.GetString("ContactName")
  79. CompanyType := this.GetString("CompanyType")
  80. SetupTime := this.GetString("SetupTime")
  81. DepositBank := this.GetString("DepositBank")
  82. BankAccount := this.GetString("BankAccount")
  83. EMail := this.GetString("EMail")
  84. BankCreditRating := this.GetString("BankCreditRating")
  85. Mobile := this.GetString("Mobile")
  86. Telphone := this.GetString("Telphone")
  87. Fax := this.GetString("Fax")
  88. CompanyTel := this.GetString("CompanyTel")
  89. QQ := this.GetString("QQ")
  90. CompanyUrl := this.GetString("CompanyUrl")
  91. SpecSupplier := this.GetString("SpecSupplier")
  92. SpecTypeCode := this.GetString("SpecTypeCode")
  93. SpecTypeName := this.GetString("SpecTypeName")
  94. Remark := this.GetString("Remark")
  95. IsDelete := this.GetString("IsDelete")
  96. CreateOn := this.GetString("CreateOn")
  97. CreateUserId := this.GetString("CreateUserId")
  98. CreateBy := this.GetString("CreateBy")
  99. ModifiedOn := this.GetString("ModifiedOn")
  100. ModifiedUserId := this.GetString("ModifiedUserId")
  101. ModifiedBy := this.GetString("ModifiedBy")
  102. if Id != "" {
  103. where = where + " and Id like '%" + Id + "%'"
  104. }
  105. if SupplierName != "" {
  106. where = where + " and SupplierName like '%" + SupplierName + "%'"
  107. }
  108. if OilCertificateNo != "" {
  109. where = where + " and OilCertificateNo like '%" + OilCertificateNo + "%'"
  110. }
  111. if Grade != "" {
  112. where = where + " and Grade like '%" + Grade + "%'"
  113. }
  114. if MgrUnit != "" {
  115. where = where + " and MgrUnit like '%" + MgrUnit + "%'"
  116. }
  117. if OperType != "" {
  118. where = where + " and OperType like '%" + OperType + "%'"
  119. }
  120. if Country != "" {
  121. where = where + " and Country like '%" + Country + "%'"
  122. }
  123. if MaunAgent != "" {
  124. where = where + " and MaunAgent like '%" + MaunAgent + "%'"
  125. }
  126. if ConstructTeam != "" {
  127. where = where + " and ConstructTeam like '%" + ConstructTeam + "%'"
  128. }
  129. if CommercialNo != "" {
  130. where = where + " and CommercialNo like '%" + CommercialNo + "%'"
  131. }
  132. if OrganCode != "" {
  133. where = where + " and OrganCode like '%" + OrganCode + "%'"
  134. }
  135. if CountryTaxNo != "" {
  136. where = where + " and CountryTaxNo like '%" + CountryTaxNo + "%'"
  137. }
  138. if LocalTaxNo != "" {
  139. where = where + " and LocalTaxNo like '%" + LocalTaxNo + "%'"
  140. }
  141. if Address != "" {
  142. where = where + " and Address like '%" + Address + "%'"
  143. }
  144. if Province != "" {
  145. where = where + " and Province like '%" + Province + "%'"
  146. }
  147. if City != "" {
  148. where = where + " and City like '%" + City + "%'"
  149. }
  150. if Street != "" {
  151. where = where + " and Street like '%" + Street + "%'"
  152. }
  153. if HouseNo != "" {
  154. where = where + " and HouseNo like '%" + HouseNo + "%'"
  155. }
  156. if ZipCode != "" {
  157. where = where + " and ZipCode like '%" + ZipCode + "%'"
  158. }
  159. if QualitySystemCert != "" {
  160. where = where + " and QualitySystemCert like '%" + QualitySystemCert + "%'"
  161. }
  162. if ProductQualityCert != "" {
  163. where = where + " and ProductQualityCert like '%" + ProductQualityCert + "%'"
  164. }
  165. if MaunLicense != "" {
  166. where = where + " and MaunLicense like '%" + MaunLicense + "%'"
  167. }
  168. if QualifCert != "" {
  169. where = where + " and QualifCert like '%" + QualifCert + "%'"
  170. }
  171. if QualifCertLevel != "" {
  172. where = where + " and QualifCertLevel like '%" + QualifCertLevel + "%'"
  173. }
  174. if SafetyLicense != "" {
  175. where = where + " and SafetyLicense like '%" + SafetyLicense + "%'"
  176. }
  177. if TechServiceLic != "" {
  178. where = where + " and TechServiceLic like '%" + TechServiceLic + "%'"
  179. }
  180. if TJInNotify != "" {
  181. where = where + " and TJInNotify like '%" + TJInNotify + "%'"
  182. }
  183. if SpecIndustryCert != "" {
  184. where = where + " and SpecIndustryCert like '%" + SpecIndustryCert + "%'"
  185. }
  186. if LegalPerson != "" {
  187. where = where + " and LegalPerson like '%" + LegalPerson + "%'"
  188. }
  189. if CategoryCode != "" {
  190. where = where + " and CategoryCode like '%" + CategoryCode + "%'"
  191. }
  192. if CategoryName != "" {
  193. where = where + " and CategoryName like '%" + CategoryName + "%'"
  194. }
  195. if RegCapital != "" {
  196. where = where + " and RegCapital like '%" + RegCapital + "%'"
  197. }
  198. if Currency != "" {
  199. where = where + " and Currency like '%" + Currency + "%'"
  200. }
  201. if ContactName != "" {
  202. where = where + " and ContactName like '%" + ContactName + "%'"
  203. }
  204. if CompanyType != "" {
  205. where = where + " and CompanyType like '%" + CompanyType + "%'"
  206. }
  207. if SetupTime != "" {
  208. where = where + " and SetupTime like '%" + SetupTime + "%'"
  209. }
  210. if DepositBank != "" {
  211. where = where + " and DepositBank like '%" + DepositBank + "%'"
  212. }
  213. if BankAccount != "" {
  214. where = where + " and BankAccount like '%" + BankAccount + "%'"
  215. }
  216. if EMail != "" {
  217. where = where + " and EMail like '%" + EMail + "%'"
  218. }
  219. if BankCreditRating != "" {
  220. where = where + " and BankCreditRating like '%" + BankCreditRating + "%'"
  221. }
  222. if Mobile != "" {
  223. where = where + " and Mobile like '%" + Mobile + "%'"
  224. }
  225. if Telphone != "" {
  226. where = where + " and Telphone like '%" + Telphone + "%'"
  227. }
  228. if Fax != "" {
  229. where = where + " and Fax like '%" + Fax + "%'"
  230. }
  231. if CompanyTel != "" {
  232. where = where + " and CompanyTel like '%" + CompanyTel + "%'"
  233. }
  234. if QQ != "" {
  235. where = where + " and QQ like '%" + QQ + "%'"
  236. }
  237. if CompanyUrl != "" {
  238. where = where + " and CompanyUrl like '%" + CompanyUrl + "%'"
  239. }
  240. if SpecSupplier != "" {
  241. where = where + " and SpecSupplier like '%" + SpecSupplier + "%'"
  242. }
  243. if SpecTypeCode != "" {
  244. where = where + " and SpecTypeCode like '%" + SpecTypeCode + "%'"
  245. }
  246. if SpecTypeName != "" {
  247. where = where + " and SpecTypeName like '%" + SpecTypeName + "%'"
  248. }
  249. if Remark != "" {
  250. where = where + " and Remark like '%" + Remark + "%'"
  251. }
  252. if IsDelete != "" {
  253. where = where + " and IsDelete like '%" + IsDelete + "%'"
  254. }
  255. if CreateUserId != "" {
  256. where = where + " and CreateUserId like '%" + CreateUserId + "%'"
  257. }
  258. if CreateBy != "" {
  259. where = where + " and CreateBy like '%" + CreateBy + "%'"
  260. }
  261. if ModifiedOn != "" {
  262. where = where + " and ModifiedOn like '%" + ModifiedOn + "%'"
  263. }
  264. if ModifiedUserId != "" {
  265. where = where + " and ModifiedUserId like '%" + ModifiedUserId + "%'"
  266. }
  267. if ModifiedBy != "" {
  268. where = where + " and ModifiedBy like '%" + ModifiedBy + "%'"
  269. }
  270. if CreateOn != "" {
  271. dates := strings.Split(CreateOn, ",")
  272. if len(dates) == 2 {
  273. minDate := dates[0]
  274. maxDate := dates[1]
  275. where = where + " and CreateOn>='" + minDate + "' and CreateOn<='" + maxDate + "'"
  276. }
  277. }
  278. //企业用户必须加创建人条件
  279. if this.User.IsCompanyUser == 1 {
  280. where = where + " and CreateUserId = '" + this.User.Id + "'"
  281. } else {
  282. //超级管理员和有查看所有数据权限的用户不加条件
  283. svcPerm := permission.GetPermissionService(utils.DBE)
  284. isauth := svcPerm.IsAuthorized(this.User.Id, "oil_supplier.marketAccess.AllRecord")
  285. if !svcPerm.IsAdmin(this.User.Id) && !isauth {
  286. where = where + " and CreateUserId = '" + this.User.Id + "'"
  287. }
  288. }
  289. svc := supplier.GetOilSupplierService(utils.DBE)
  290. var list []supplier.OilSupplier
  291. total := svc.GetPagingEntitiesWithOrderBytbl("", page.CurrentPage, page.Size, orderby, asc, &list, where)
  292. var datainfo DataInfo
  293. datainfo.Items = list
  294. datainfo.CurrentItemCount = total
  295. datainfo.PageIndex = page.CurrentPage
  296. datainfo.ItemsPerPage = page.Size
  297. this.Data["json"] = &datainfo
  298. this.ServeJSON()
  299. }
  300. // @Title 获取列表
  301. // @Description get user by token
  302. // @Success 200 {object} []supplier.OilSupplier
  303. // @router /certlist [get]
  304. func (this *OilSupplierController) GetJoinCertEntityList() {
  305. //获取分页信息
  306. page := this.GetPageInfoForm()
  307. where := " 1=1 "
  308. orderby := "Id"
  309. asc := false
  310. Order := this.GetString("Order")
  311. Prop := this.GetString("Prop")
  312. if Order != "" && Prop != "" {
  313. orderby = Prop
  314. if Order == "asc" {
  315. asc = true
  316. }
  317. }
  318. Id := this.GetString("Id")
  319. SupplierName := this.GetString("SupplierName")
  320. SupplierTypeName := this.GetString("SupplierTypeName")
  321. OilCertificateNo := this.GetString("OilCertificateNo")
  322. Grade := this.GetString("Grade")
  323. MgrUnit := this.GetString("MgrUnit")
  324. OperType := this.GetString("OperType")
  325. Country := this.GetString("Country")
  326. MaunAgent := this.GetString("MaunAgent")
  327. ConstructTeam := this.GetString("ConstructTeam")
  328. CommercialNo := this.GetString("CommercialNo")
  329. OrganCode := this.GetString("OrganCode")
  330. CountryTaxNo := this.GetString("CountryTaxNo")
  331. LocalTaxNo := this.GetString("LocalTaxNo")
  332. Address := this.GetString("Address")
  333. Province := this.GetString("Province")
  334. City := this.GetString("City")
  335. Street := this.GetString("Street")
  336. HouseNo := this.GetString("HouseNo")
  337. ZipCode := this.GetString("ZipCode")
  338. QualitySystemCert := this.GetString("QualitySystemCert")
  339. ProductQualityCert := this.GetString("ProductQualityCert")
  340. MaunLicense := this.GetString("MaunLicense")
  341. QualifCert := this.GetString("QualifCert")
  342. QualifCertLevel := this.GetString("QualifCertLevel")
  343. SafetyLicense := this.GetString("SafetyLicense")
  344. TechServiceLic := this.GetString("TechServiceLic")
  345. TJInNotify := this.GetString("TJInNotify")
  346. SpecIndustryCert := this.GetString("SpecIndustryCert")
  347. LegalPerson := this.GetString("LegalPerson")
  348. CategoryCode := this.GetString("CategoryCode")
  349. CategoryName := this.GetString("CategoryName")
  350. RegCapital := this.GetString("RegCapital")
  351. Currency := this.GetString("Currency")
  352. ContactName := this.GetString("ContactName")
  353. CompanyType := this.GetString("CompanyType")
  354. SetupTime := this.GetString("SetupTime")
  355. DepositBank := this.GetString("DepositBank")
  356. BankAccount := this.GetString("BankAccount")
  357. EMail := this.GetString("EMail")
  358. BankCreditRating := this.GetString("BankCreditRating")
  359. Mobile := this.GetString("Mobile")
  360. Telphone := this.GetString("Telphone")
  361. Fax := this.GetString("Fax")
  362. CompanyTel := this.GetString("CompanyTel")
  363. QQ := this.GetString("QQ")
  364. CompanyUrl := this.GetString("CompanyUrl")
  365. SpecSupplier := this.GetString("SpecSupplier")
  366. SpecTypeCode := this.GetString("SpecTypeCode")
  367. SpecTypeName := this.GetString("SpecTypeName")
  368. Remark := this.GetString("Remark")
  369. CreateOn := this.GetString("CreateOn")
  370. SupplierTypeCode := this.GetString("SupplierTypeCode")
  371. status := this.GetString("Status")
  372. if status != "" {
  373. where = where + " and b.Status='" + status + "'"
  374. }
  375. if Id != "" {
  376. where = where + " and a.Id like '%" + Id + "%'"
  377. }
  378. if SupplierName != "" {
  379. where = where + " and a.SupplierName like '%" + SupplierName + "%'"
  380. }
  381. if SupplierTypeName != "" {
  382. where = where + " and b.SupplierTypeName like '%" + SupplierTypeName + "%'"
  383. }
  384. if OilCertificateNo != "" {
  385. where = where + " and a.OilCertificateNo like '%" + OilCertificateNo + "%'"
  386. }
  387. if Grade != "" {
  388. where = where + " and a.Grade like '%" + Grade + "%'"
  389. }
  390. if MgrUnit != "" {
  391. where = where + " and a.MgrUnit like '%" + MgrUnit + "%'"
  392. }
  393. if OperType != "" {
  394. where = where + " and a.OperType like '%" + OperType + "%'"
  395. }
  396. if Country != "" {
  397. where = where + " and a.Country like '%" + Country + "%'"
  398. }
  399. if MaunAgent != "" {
  400. where = where + " and a.MaunAgent like '%" + MaunAgent + "%'"
  401. }
  402. if ConstructTeam != "" {
  403. where = where + " and a.ConstructTeam like '%" + ConstructTeam + "%'"
  404. }
  405. if CommercialNo != "" {
  406. where = where + " and a.CommercialNo like '%" + CommercialNo + "%'"
  407. }
  408. if OrganCode != "" {
  409. where = where + " and a.OrganCode like '%" + OrganCode + "%'"
  410. }
  411. if CountryTaxNo != "" {
  412. where = where + " and a.CountryTaxNo like '%" + CountryTaxNo + "%'"
  413. }
  414. if LocalTaxNo != "" {
  415. where = where + " and a.LocalTaxNo like '%" + LocalTaxNo + "%'"
  416. }
  417. if Address != "" {
  418. where = where + " and a.Address like '%" + Address + "%'"
  419. }
  420. if Province != "" {
  421. where = where + " and a.Province like '%" + Province + "%'"
  422. }
  423. if City != "" {
  424. where = where + " and a.City like '%" + City + "%'"
  425. }
  426. if Street != "" {
  427. where = where + " and a.Street like '%" + Street + "%'"
  428. }
  429. if HouseNo != "" {
  430. where = where + " and a.HouseNo like '%" + HouseNo + "%'"
  431. }
  432. if ZipCode != "" {
  433. where = where + " and a.ZipCode like '%" + ZipCode + "%'"
  434. }
  435. if QualitySystemCert != "" {
  436. where = where + " and a.QualitySystemCert like '%" + QualitySystemCert + "%'"
  437. }
  438. if ProductQualityCert != "" {
  439. where = where + " and a.ProductQualityCert like '%" + ProductQualityCert + "%'"
  440. }
  441. if MaunLicense != "" {
  442. where = where + " and a.MaunLicense like '%" + MaunLicense + "%'"
  443. }
  444. if QualifCert != "" {
  445. where = where + " and a.QualifCert like '%" + QualifCert + "%'"
  446. }
  447. if QualifCertLevel != "" {
  448. where = where + " and a.QualifCertLevel like '%" + QualifCertLevel + "%'"
  449. }
  450. if SafetyLicense != "" {
  451. where = where + " and a.SafetyLicense like '%" + SafetyLicense + "%'"
  452. }
  453. if TechServiceLic != "" {
  454. where = where + " and a.TechServiceLic like '%" + TechServiceLic + "%'"
  455. }
  456. if TJInNotify != "" {
  457. where = where + " and a.TJInNotify like '%" + TJInNotify + "%'"
  458. }
  459. if SpecIndustryCert != "" {
  460. where = where + " and a.SpecIndustryCert like '%" + SpecIndustryCert + "%'"
  461. }
  462. if LegalPerson != "" {
  463. where = where + " and a.LegalPerson like '%" + LegalPerson + "%'"
  464. }
  465. if CategoryCode != "" {
  466. where = where + " and a.CategoryCode like '%" + CategoryCode + "%'"
  467. }
  468. if CategoryName != "" {
  469. where = where + " and a.CategoryName like '%" + CategoryName + "%'"
  470. }
  471. if RegCapital != "" {
  472. where = where + " and a.RegCapital like '%" + RegCapital + "%'"
  473. }
  474. if Currency != "" {
  475. where = where + " and a.Currency like '%" + Currency + "%'"
  476. }
  477. if ContactName != "" {
  478. where = where + " and a.ContactName like '%" + ContactName + "%'"
  479. }
  480. if CompanyType != "" {
  481. where = where + " and a.CompanyType like '%" + CompanyType + "%'"
  482. }
  483. if SetupTime != "" {
  484. where = where + " and a.SetupTime like '%" + SetupTime + "%'"
  485. }
  486. if DepositBank != "" {
  487. where = where + " and a.DepositBank like '%" + DepositBank + "%'"
  488. }
  489. if BankAccount != "" {
  490. where = where + " and a.BankAccount like '%" + BankAccount + "%'"
  491. }
  492. if EMail != "" {
  493. where = where + " and a.EMail like '%" + EMail + "%'"
  494. }
  495. if BankCreditRating != "" {
  496. where = where + " and a.BankCreditRating like '%" + BankCreditRating + "%'"
  497. }
  498. if Mobile != "" {
  499. where = where + " and a.Mobile like '%" + Mobile + "%'"
  500. }
  501. if Telphone != "" {
  502. where = where + " and a.Telphone like '%" + Telphone + "%'"
  503. }
  504. if Fax != "" {
  505. where = where + " and a.Fax like '%" + Fax + "%'"
  506. }
  507. if CompanyTel != "" {
  508. where = where + " and a.CompanyTel like '%" + CompanyTel + "%'"
  509. }
  510. if QQ != "" {
  511. where = where + " and a.QQ like '%" + QQ + "%'"
  512. }
  513. if CompanyUrl != "" {
  514. where = where + " and a.CompanyUrl like '%" + CompanyUrl + "%'"
  515. }
  516. if SpecSupplier != "" {
  517. where = where + " and a.SpecSupplier like '%" + SpecSupplier + "%'"
  518. }
  519. if SpecTypeCode != "" {
  520. where = where + " and a.SpecTypeCode like '%" + SpecTypeCode + "%'"
  521. }
  522. if SpecTypeName != "" {
  523. where = where + " and a.SpecTypeName like '%" + SpecTypeName + "%'"
  524. }
  525. if Remark != "" {
  526. where = where + " and a.Remark like '%" + Remark + "%'"
  527. }
  528. if CreateOn != "" {
  529. dates := strings.Split(CreateOn, ",")
  530. if len(dates) == 2 {
  531. minDate := dates[0]
  532. maxDate := dates[1]
  533. where = where + " and a.CreateOn>='" + minDate + "' and a.CreateOn<='" + maxDate + "'"
  534. }
  535. }
  536. if SupplierTypeCode != "" {
  537. where = where + " and b.SupplierTypeCode = '" + SupplierTypeCode + "'"
  538. }
  539. //企业用户只看自己的数据记录
  540. /*parameterSvc := baseparameter.GetBaseparameterService(utils.DBE) //取出外部门ID
  541. extOrganizeId := parameterSvc.GetBaseparameterMessage("GFGL", "paramset", "ExtOrganizeId")
  542. if extOrganizeId == this.User.DepartmentId {
  543. where = where + " and a.CreateUserId = '" + this.User.Id + "'"
  544. }*/
  545. //企业用户必须加创建人条件
  546. if this.User.IsCompanyUser == 1 {
  547. where = where + " and a.CreateUserId = '" + this.User.Id + "'"
  548. } else {
  549. //超级管理员和有查看所有数据权限的用户不加条件
  550. svcPerm := permission.GetPermissionService(utils.DBE)
  551. isauth := svcPerm.IsAuthorized(this.User.Id, "oil_supplier.marketAccess.AllRecord")
  552. if !svcPerm.IsAdmin(this.User.Id) && !isauth {
  553. where = where + " and a.CreateUserId = '" + this.User.Id + "'"
  554. }
  555. }
  556. svc := supplier.GetOilSupplierService(utils.DBE)
  557. var list []supplier.OilSupplierView
  558. total := svc.GetMyPagingEntitiesWithOrderBytbl(OilSupplierName, OilSupplierCertName, page.CurrentPage, page.Size, orderby, asc, &list, where)
  559. var datainfo DataInfo
  560. datainfo.Items = list
  561. datainfo.CurrentItemCount = total
  562. datainfo.PageIndex = page.CurrentPage
  563. datainfo.ItemsPerPage = page.Size
  564. this.Data["json"] = &datainfo
  565. this.ServeJSON()
  566. }
  567. // @Title 获取集中评审列表
  568. // @Description get user by token
  569. // @Success 200 {object} []supplier.OilSupplier
  570. // @router /jzps_certlist [get]
  571. func (this *OilSupplierController) GetJZPSJoinCertEntityList() {
  572. //获取分页信息
  573. page := this.GetPageInfoForm()
  574. where := " 1=1 "
  575. orderby := "Id"
  576. asc := false
  577. Order := this.GetString("Order")
  578. Prop := this.GetString("Prop")
  579. if Order != "" && Prop != "" {
  580. orderby = Prop
  581. if Order == "asc" {
  582. asc = true
  583. }
  584. }
  585. Id := this.GetString("Id")
  586. SupplierName := this.GetString("SupplierName")
  587. OilCertificateNo := this.GetString("OilCertificateNo")
  588. Grade := this.GetString("Grade")
  589. MgrUnit := this.GetString("MgrUnit")
  590. OperType := this.GetString("OperType")
  591. Country := this.GetString("Country")
  592. MaunAgent := this.GetString("MaunAgent")
  593. ConstructTeam := this.GetString("ConstructTeam")
  594. CommercialNo := this.GetString("CommercialNo")
  595. OrganCode := this.GetString("OrganCode")
  596. CountryTaxNo := this.GetString("CountryTaxNo")
  597. LocalTaxNo := this.GetString("LocalTaxNo")
  598. Address := this.GetString("Address")
  599. Province := this.GetString("Province")
  600. City := this.GetString("City")
  601. Street := this.GetString("Street")
  602. HouseNo := this.GetString("HouseNo")
  603. ZipCode := this.GetString("ZipCode")
  604. QualitySystemCert := this.GetString("QualitySystemCert")
  605. ProductQualityCert := this.GetString("ProductQualityCert")
  606. MaunLicense := this.GetString("MaunLicense")
  607. QualifCert := this.GetString("QualifCert")
  608. QualifCertLevel := this.GetString("QualifCertLevel")
  609. SafetyLicense := this.GetString("SafetyLicense")
  610. TechServiceLic := this.GetString("TechServiceLic")
  611. TJInNotify := this.GetString("TJInNotify")
  612. SpecIndustryCert := this.GetString("SpecIndustryCert")
  613. LegalPerson := this.GetString("LegalPerson")
  614. CategoryCode := this.GetString("CategoryCode")
  615. CategoryName := this.GetString("CategoryName")
  616. RegCapital := this.GetString("RegCapital")
  617. Currency := this.GetString("Currency")
  618. ContactName := this.GetString("ContactName")
  619. CompanyType := this.GetString("CompanyType")
  620. SetupTime := this.GetString("SetupTime")
  621. DepositBank := this.GetString("DepositBank")
  622. BankAccount := this.GetString("BankAccount")
  623. EMail := this.GetString("EMail")
  624. BankCreditRating := this.GetString("BankCreditRating")
  625. Mobile := this.GetString("Mobile")
  626. Telphone := this.GetString("Telphone")
  627. Fax := this.GetString("Fax")
  628. CompanyTel := this.GetString("CompanyTel")
  629. QQ := this.GetString("QQ")
  630. CompanyUrl := this.GetString("CompanyUrl")
  631. SpecSupplier := this.GetString("SpecSupplier")
  632. SpecTypeCode := this.GetString("SpecTypeCode")
  633. SpecTypeName := this.GetString("SpecTypeName")
  634. Remark := this.GetString("Remark")
  635. CreateOn := this.GetString("CreateOn")
  636. SupplierTypeCode := this.GetString("SupplierTypeCode")
  637. SupplierTypeName := this.GetString("SupplierTypeName")
  638. status := this.GetString("Status")
  639. if status != "" {
  640. where = where + " and b.Status='" + status + "'"
  641. }
  642. if Id != "" {
  643. where = where + " and a.Id like '%" + Id + "%'"
  644. }
  645. if SupplierName != "" {
  646. where = where + " and a.SupplierName like '%" + SupplierName + "%'"
  647. }
  648. if OilCertificateNo != "" {
  649. where = where + " and a.OilCertificateNo like '%" + OilCertificateNo + "%'"
  650. }
  651. if Grade != "" {
  652. where = where + " and a.Grade like '%" + Grade + "%'"
  653. }
  654. if MgrUnit != "" {
  655. where = where + " and a.MgrUnit like '%" + MgrUnit + "%'"
  656. }
  657. if OperType != "" {
  658. where = where + " and a.OperType like '%" + OperType + "%'"
  659. }
  660. if Country != "" {
  661. where = where + " and a.Country like '%" + Country + "%'"
  662. }
  663. if MaunAgent != "" {
  664. where = where + " and a.MaunAgent like '%" + MaunAgent + "%'"
  665. }
  666. if ConstructTeam != "" {
  667. where = where + " and a.ConstructTeam like '%" + ConstructTeam + "%'"
  668. }
  669. if CommercialNo != "" {
  670. where = where + " and a.CommercialNo like '%" + CommercialNo + "%'"
  671. }
  672. if OrganCode != "" {
  673. where = where + " and a.OrganCode like '%" + OrganCode + "%'"
  674. }
  675. if CountryTaxNo != "" {
  676. where = where + " and a.CountryTaxNo like '%" + CountryTaxNo + "%'"
  677. }
  678. if LocalTaxNo != "" {
  679. where = where + " and a.LocalTaxNo like '%" + LocalTaxNo + "%'"
  680. }
  681. if Address != "" {
  682. where = where + " and a.Address like '%" + Address + "%'"
  683. }
  684. if Province != "" {
  685. where = where + " and a.Province like '%" + Province + "%'"
  686. }
  687. if City != "" {
  688. where = where + " and a.City like '%" + City + "%'"
  689. }
  690. if Street != "" {
  691. where = where + " and a.Street like '%" + Street + "%'"
  692. }
  693. if HouseNo != "" {
  694. where = where + " and a.HouseNo like '%" + HouseNo + "%'"
  695. }
  696. if ZipCode != "" {
  697. where = where + " and a.ZipCode like '%" + ZipCode + "%'"
  698. }
  699. if QualitySystemCert != "" {
  700. where = where + " and a.QualitySystemCert like '%" + QualitySystemCert + "%'"
  701. }
  702. if ProductQualityCert != "" {
  703. where = where + " and a.ProductQualityCert like '%" + ProductQualityCert + "%'"
  704. }
  705. if MaunLicense != "" {
  706. where = where + " and a.MaunLicense like '%" + MaunLicense + "%'"
  707. }
  708. if QualifCert != "" {
  709. where = where + " and a.QualifCert like '%" + QualifCert + "%'"
  710. }
  711. if QualifCertLevel != "" {
  712. where = where + " and a.QualifCertLevel like '%" + QualifCertLevel + "%'"
  713. }
  714. if SafetyLicense != "" {
  715. where = where + " and a.SafetyLicense like '%" + SafetyLicense + "%'"
  716. }
  717. if TechServiceLic != "" {
  718. where = where + " and a.TechServiceLic like '%" + TechServiceLic + "%'"
  719. }
  720. if TJInNotify != "" {
  721. where = where + " and a.TJInNotify like '%" + TJInNotify + "%'"
  722. }
  723. if SpecIndustryCert != "" {
  724. where = where + " and a.SpecIndustryCert like '%" + SpecIndustryCert + "%'"
  725. }
  726. if LegalPerson != "" {
  727. where = where + " and a.LegalPerson like '%" + LegalPerson + "%'"
  728. }
  729. if CategoryCode != "" {
  730. where = where + " and a.CategoryCode like '%" + CategoryCode + "%'"
  731. }
  732. if CategoryName != "" {
  733. where = where + " and a.CategoryName like '%" + CategoryName + "%'"
  734. }
  735. if RegCapital != "" {
  736. where = where + " and a.RegCapital like '%" + RegCapital + "%'"
  737. }
  738. if Currency != "" {
  739. where = where + " and a.Currency like '%" + Currency + "%'"
  740. }
  741. if ContactName != "" {
  742. where = where + " and a.ContactName like '%" + ContactName + "%'"
  743. }
  744. if CompanyType != "" {
  745. where = where + " and a.CompanyType like '%" + CompanyType + "%'"
  746. }
  747. if SetupTime != "" {
  748. where = where + " and a.SetupTime like '%" + SetupTime + "%'"
  749. }
  750. if DepositBank != "" {
  751. where = where + " and a.DepositBank like '%" + DepositBank + "%'"
  752. }
  753. if BankAccount != "" {
  754. where = where + " and a.BankAccount like '%" + BankAccount + "%'"
  755. }
  756. if EMail != "" {
  757. where = where + " and a.EMail like '%" + EMail + "%'"
  758. }
  759. if BankCreditRating != "" {
  760. where = where + " and a.BankCreditRating like '%" + BankCreditRating + "%'"
  761. }
  762. if Mobile != "" {
  763. where = where + " and a.Mobile like '%" + Mobile + "%'"
  764. }
  765. if Telphone != "" {
  766. where = where + " and a.Telphone like '%" + Telphone + "%'"
  767. }
  768. if Fax != "" {
  769. where = where + " and a.Fax like '%" + Fax + "%'"
  770. }
  771. if CompanyTel != "" {
  772. where = where + " and a.CompanyTel like '%" + CompanyTel + "%'"
  773. }
  774. if QQ != "" {
  775. where = where + " and a.QQ like '%" + QQ + "%'"
  776. }
  777. if CompanyUrl != "" {
  778. where = where + " and a.CompanyUrl like '%" + CompanyUrl + "%'"
  779. }
  780. if SpecSupplier != "" {
  781. where = where + " and a.SpecSupplier like '%" + SpecSupplier + "%'"
  782. }
  783. if SpecTypeCode != "" {
  784. where = where + " and a.SpecTypeCode like '%" + SpecTypeCode + "%'"
  785. }
  786. if SpecTypeName != "" {
  787. where = where + " and a.SpecTypeName like '%" + SpecTypeName + "%'"
  788. }
  789. if Remark != "" {
  790. where = where + " and a.Remark like '%" + Remark + "%'"
  791. }
  792. if CreateOn != "" {
  793. dates := strings.Split(CreateOn, ",")
  794. if len(dates) == 2 {
  795. minDate := dates[0]
  796. maxDate := dates[1]
  797. where = where + " and a.CreateOn>='" + minDate + "' and a.CreateOn<='" + maxDate + "'"
  798. }
  799. }
  800. if SupplierTypeCode != "" {
  801. where = where + " and b.SupplierTypeCode = '" + SupplierTypeCode + "'"
  802. }
  803. if SupplierTypeName != "" {
  804. where = where + " and b.SupplierTypeName = '" + SupplierTypeName + "'"
  805. }
  806. //企业用户必须加创建人条件
  807. if this.User.IsCompanyUser == 1 {
  808. where = where + " and a.CreateUserId = '" + this.User.Id + "'"
  809. } else {
  810. //超级管理员和有查看所有数据权限的用户不加条件
  811. svcPerm := permission.GetPermissionService(utils.DBE)
  812. isauth := svcPerm.IsAuthorized(this.User.Id, "oil_supplier.marketAccess.AllRecord")
  813. if !svcPerm.IsAdmin(this.User.Id) && !isauth {
  814. //根据工作流查找
  815. //集中评审相关人可看数据
  816. actisvc := workflow.GetActivitiService(utils.DBE)
  817. //找出待办任务===准入
  818. var certIdList string
  819. ids := actisvc.GetAllMyTasks(workflow.OIL_SUPPLIER_APPLY, this.User.Id)
  820. if len(strings.Trim(ids, ",")) > 0 {
  821. certIdList += strings.Trim(ids, ",")+ ","
  822. }
  823. ids = actisvc.GetAllMyTasks(workflow.OIL_FIRST_SUPPLIER_APPLY, this.User.Id)
  824. if len(strings.Trim(ids, ",")) > 0 {
  825. certIdList += strings.Trim(ids, ",")+ ","
  826. }
  827. ids = actisvc.GetAllMyTasks(workflow.OIL_SECOND_SUPPLIER_APPLY, this.User.Id)
  828. if len(strings.Trim(ids, ",")) > 0 {
  829. certIdList += strings.Trim(ids, ",")+ ","
  830. }
  831. ids = actisvc.GetAllMyTasks(workflow.OIL_ENUSER_SUPPLIER_APPLY, this.User.Id)
  832. if len(strings.Trim(ids, ",")) > 0 {
  833. certIdList += strings.Trim(ids, ",")+ ","
  834. }
  835. ids = actisvc.GetAllMyTasks(workflow.OIL_FIRST_ENUSER_SUPPLIER_APPLY, this.User.Id)
  836. if len(strings.Trim(ids, ",")) > 0 {
  837. certIdList += strings.Trim(ids, ",")+ ","
  838. }
  839. ids = actisvc.GetAllMyTasks(workflow.OIL_SECOND_ENUSER_SUPPLIER_APPLY, this.User.Id)
  840. if len(strings.Trim(ids, ",")) > 0 {
  841. certIdList += strings.Trim(ids, ",")+ ","
  842. }
  843. certIdList = strings.Trim(certIdList, ",")
  844. certIdarr := strings.Split(certIdList, ",")
  845. for i, item := range certIdarr {
  846. idx := strings.Index(item, "-")
  847. if idx >= 0 {
  848. certIdarr[i] = strings.Split(item, "-")[0]
  849. }
  850. }
  851. certIdList = strings.Join(certIdarr, ",")
  852. if certIdList != "" {
  853. where += " and ( b.Id in (" + certIdList + ")" + " or a.CreateUserId = '" + this.User.Id + "')"
  854. } else {
  855. where = where + " and a.CreateUserId = '" + this.User.Id + "'"
  856. }
  857. } else {
  858. //where = where + " and a.CreateUserId = '" + this.User.Id + "'"
  859. }
  860. }
  861. svc := supplier.GetOilSupplierService(utils.DBE)
  862. var list []supplier.OilSupplierView
  863. total := svc.GetMyPagingEntitiesWithOrderBytbl(OilSupplierName, OilSupplierCertName, page.CurrentPage, page.Size, orderby, asc, &list, where)
  864. var datainfo DataInfo
  865. datainfo.Items = list
  866. datainfo.CurrentItemCount = total
  867. datainfo.PageIndex = page.CurrentPage
  868. datainfo.ItemsPerPage = page.Size
  869. this.Data["json"] = &datainfo
  870. this.ServeJSON()
  871. }
  872. // @Title 企业入库列表
  873. // @Description get user by token
  874. // @Success 200 {object} []supplier.OilSupplier
  875. // @router /storelist [get]
  876. func (this *OilSupplierController) GetJoinStoreEntityList() {
  877. //获取分页信息
  878. page := this.GetPageInfoForm()
  879. where := " 1=1 "
  880. orderby := "Id"
  881. asc := false
  882. Order := this.GetString("Order")
  883. Prop := this.GetString("Prop")
  884. if Order != "" && Prop != "" {
  885. orderby = Prop
  886. if Order == "asc" {
  887. asc = true
  888. }
  889. }
  890. Id := this.GetString("Id")
  891. SupplierName := this.GetString("SupplierName")
  892. OilCertificateNo := this.GetString("OilCertificateNo")
  893. Grade := this.GetString("Grade")
  894. MgrUnit := this.GetString("MgrUnit")
  895. OperType := this.GetString("OperType")
  896. Country := this.GetString("Country")
  897. MaunAgent := this.GetString("MaunAgent")
  898. ConstructTeam := this.GetString("ConstructTeam")
  899. CommercialNo := this.GetString("CommercialNo")
  900. OrganCode := this.GetString("OrganCode")
  901. CountryTaxNo := this.GetString("CountryTaxNo")
  902. LocalTaxNo := this.GetString("LocalTaxNo")
  903. Address := this.GetString("Address")
  904. Province := this.GetString("Province")
  905. City := this.GetString("City")
  906. Street := this.GetString("Street")
  907. HouseNo := this.GetString("HouseNo")
  908. ZipCode := this.GetString("ZipCode")
  909. QualitySystemCert := this.GetString("QualitySystemCert")
  910. ProductQualityCert := this.GetString("ProductQualityCert")
  911. MaunLicense := this.GetString("MaunLicense")
  912. QualifCert := this.GetString("QualifCert")
  913. QualifCertLevel := this.GetString("QualifCertLevel")
  914. SafetyLicense := this.GetString("SafetyLicense")
  915. TechServiceLic := this.GetString("TechServiceLic")
  916. TJInNotify := this.GetString("TJInNotify")
  917. SpecIndustryCert := this.GetString("SpecIndustryCert")
  918. LegalPerson := this.GetString("LegalPerson")
  919. CategoryCode := this.GetString("CategoryCode")
  920. CategoryName := this.GetString("CategoryName")
  921. RegCapital := this.GetString("RegCapital")
  922. Currency := this.GetString("Currency")
  923. ContactName := this.GetString("ContactName")
  924. CompanyType := this.GetString("CompanyType")
  925. SetupTime := this.GetString("SetupTime")
  926. DepositBank := this.GetString("DepositBank")
  927. BankAccount := this.GetString("BankAccount")
  928. EMail := this.GetString("EMail")
  929. BankCreditRating := this.GetString("BankCreditRating")
  930. Mobile := this.GetString("Mobile")
  931. Telphone := this.GetString("Telphone")
  932. Fax := this.GetString("Fax")
  933. CompanyTel := this.GetString("CompanyTel")
  934. QQ := this.GetString("QQ")
  935. CompanyUrl := this.GetString("CompanyUrl")
  936. SpecSupplier := this.GetString("SpecSupplier")
  937. SpecTypeCode := this.GetString("SpecTypeCode")
  938. SpecTypeName := this.GetString("SpecTypeName")
  939. Remark := this.GetString("Remark")
  940. CreateOn := this.GetString("CreateOn")
  941. SupplierTypeCode := this.GetString("SupplierTypeCode")
  942. SupplierTypeName := this.GetString("SupplierTypeName")
  943. status := this.GetString("Status")
  944. if status != "" {
  945. where = where + " and b.Status='" + status + "'"
  946. }
  947. if Id != "" {
  948. where = where + " and a.Id like '%" + Id + "%'"
  949. }
  950. if SupplierName != "" {
  951. where = where + " and a.SupplierName like '%" + SupplierName + "%'"
  952. }
  953. if OilCertificateNo != "" {
  954. where = where + " and a.OilCertificateNo like '%" + OilCertificateNo + "%'"
  955. }
  956. if Grade != "" {
  957. where = where + " and a.Grade like '%" + Grade + "%'"
  958. }
  959. if MgrUnit != "" {
  960. where = where + " and a.MgrUnit like '%" + MgrUnit + "%'"
  961. }
  962. if OperType != "" {
  963. where = where + " and a.OperType like '%" + OperType + "%'"
  964. }
  965. if Country != "" {
  966. where = where + " and a.Country like '%" + Country + "%'"
  967. }
  968. if MaunAgent != "" {
  969. where = where + " and a.MaunAgent like '%" + MaunAgent + "%'"
  970. }
  971. if ConstructTeam != "" {
  972. where = where + " and a.ConstructTeam like '%" + ConstructTeam + "%'"
  973. }
  974. if CommercialNo != "" {
  975. where = where + " and a.CommercialNo like '%" + CommercialNo + "%'"
  976. }
  977. if OrganCode != "" {
  978. where = where + " and a.OrganCode like '%" + OrganCode + "%'"
  979. }
  980. if CountryTaxNo != "" {
  981. where = where + " and a.CountryTaxNo like '%" + CountryTaxNo + "%'"
  982. }
  983. if LocalTaxNo != "" {
  984. where = where + " and a.LocalTaxNo like '%" + LocalTaxNo + "%'"
  985. }
  986. if Address != "" {
  987. where = where + " and a.Address like '%" + Address + "%'"
  988. }
  989. if Province != "" {
  990. where = where + " and a.Province like '%" + Province + "%'"
  991. }
  992. if City != "" {
  993. where = where + " and a.City like '%" + City + "%'"
  994. }
  995. if Street != "" {
  996. where = where + " and a.Street like '%" + Street + "%'"
  997. }
  998. if HouseNo != "" {
  999. where = where + " and a.HouseNo like '%" + HouseNo + "%'"
  1000. }
  1001. if ZipCode != "" {
  1002. where = where + " and a.ZipCode like '%" + ZipCode + "%'"
  1003. }
  1004. if QualitySystemCert != "" {
  1005. where = where + " and a.QualitySystemCert like '%" + QualitySystemCert + "%'"
  1006. }
  1007. if ProductQualityCert != "" {
  1008. where = where + " and a.ProductQualityCert like '%" + ProductQualityCert + "%'"
  1009. }
  1010. if MaunLicense != "" {
  1011. where = where + " and a.MaunLicense like '%" + MaunLicense + "%'"
  1012. }
  1013. if QualifCert != "" {
  1014. where = where + " and a.QualifCert like '%" + QualifCert + "%'"
  1015. }
  1016. if QualifCertLevel != "" {
  1017. where = where + " and a.QualifCertLevel like '%" + QualifCertLevel + "%'"
  1018. }
  1019. if SafetyLicense != "" {
  1020. where = where + " and a.SafetyLicense like '%" + SafetyLicense + "%'"
  1021. }
  1022. if TechServiceLic != "" {
  1023. where = where + " and a.TechServiceLic like '%" + TechServiceLic + "%'"
  1024. }
  1025. if TJInNotify != "" {
  1026. where = where + " and a.TJInNotify like '%" + TJInNotify + "%'"
  1027. }
  1028. if SpecIndustryCert != "" {
  1029. where = where + " and a.SpecIndustryCert like '%" + SpecIndustryCert + "%'"
  1030. }
  1031. if LegalPerson != "" {
  1032. where = where + " and a.LegalPerson like '%" + LegalPerson + "%'"
  1033. }
  1034. if CategoryCode != "" {
  1035. where = where + " and a.CategoryCode like '%" + CategoryCode + "%'"
  1036. }
  1037. if CategoryName != "" {
  1038. where = where + " and a.CategoryName like '%" + CategoryName + "%'"
  1039. }
  1040. if RegCapital != "" {
  1041. where = where + " and a.RegCapital like '%" + RegCapital + "%'"
  1042. }
  1043. if Currency != "" {
  1044. where = where + " and a.Currency like '%" + Currency + "%'"
  1045. }
  1046. if ContactName != "" {
  1047. where = where + " and a.ContactName like '%" + ContactName + "%'"
  1048. }
  1049. if CompanyType != "" {
  1050. where = where + " and a.CompanyType like '%" + CompanyType + "%'"
  1051. }
  1052. if SetupTime != "" {
  1053. where = where + " and a.SetupTime like '%" + SetupTime + "%'"
  1054. }
  1055. if DepositBank != "" {
  1056. where = where + " and a.DepositBank like '%" + DepositBank + "%'"
  1057. }
  1058. if BankAccount != "" {
  1059. where = where + " and a.BankAccount like '%" + BankAccount + "%'"
  1060. }
  1061. if EMail != "" {
  1062. where = where + " and a.EMail like '%" + EMail + "%'"
  1063. }
  1064. if BankCreditRating != "" {
  1065. where = where + " and a.BankCreditRating like '%" + BankCreditRating + "%'"
  1066. }
  1067. if Mobile != "" {
  1068. where = where + " and a.Mobile like '%" + Mobile + "%'"
  1069. }
  1070. if Telphone != "" {
  1071. where = where + " and a.Telphone like '%" + Telphone + "%'"
  1072. }
  1073. if Fax != "" {
  1074. where = where + " and a.Fax like '%" + Fax + "%'"
  1075. }
  1076. if CompanyTel != "" {
  1077. where = where + " and a.CompanyTel like '%" + CompanyTel + "%'"
  1078. }
  1079. if QQ != "" {
  1080. where = where + " and a.QQ like '%" + QQ + "%'"
  1081. }
  1082. if CompanyUrl != "" {
  1083. where = where + " and a.CompanyUrl like '%" + CompanyUrl + "%'"
  1084. }
  1085. if SpecSupplier != "" {
  1086. where = where + " and a.SpecSupplier like '%" + SpecSupplier + "%'"
  1087. }
  1088. if SpecTypeCode != "" {
  1089. where = where + " and a.SpecTypeCode like '%" + SpecTypeCode + "%'"
  1090. }
  1091. if SpecTypeName != "" {
  1092. where = where + " and a.SpecTypeName like '%" + SpecTypeName + "%'"
  1093. }
  1094. if Remark != "" {
  1095. where = where + " and a.Remark like '%" + Remark + "%'"
  1096. }
  1097. if CreateOn != "" {
  1098. dates := strings.Split(CreateOn, ",")
  1099. if len(dates) == 2 {
  1100. minDate := dates[0]
  1101. maxDate := dates[1]
  1102. where = where + " and a.CreateOn>='" + minDate + "' and a.CreateOn<='" + maxDate + "'"
  1103. }
  1104. }
  1105. if SupplierTypeCode != "" {
  1106. where = where + " and b.SupplierTypeCode = '" + SupplierTypeCode + "'"
  1107. }
  1108. if SupplierTypeName != "" {
  1109. where = where + " and b.SupplierTypeName = '" + SupplierTypeName + "'"
  1110. }
  1111. //企业用户只看自己的数据记录
  1112. /*parameterSvc := baseparameter.GetBaseparameterService(utils.DBE) //取出外部门ID
  1113. extOrganizeId := parameterSvc.GetBaseparameterMessage("GFGL", "paramset", "ExtOrganizeId")
  1114. if extOrganizeId == this.User.DepartmentId {
  1115. where = where + " and a.CreateUserId = '" + this.User.Id + "'"
  1116. }*/
  1117. //企业用户必须加创建人条件
  1118. if this.User.IsCompanyUser == 1 {
  1119. where = where + " and a.CreateUserId = '" + this.User.Id + "'"
  1120. }
  1121. svc := supplier.GetOilSupplierService(utils.DBE)
  1122. var list []supplier.OilSupplierView
  1123. total := svc.GetMyPagingEntitiesWithOrderBytbl(OilSupplierName, OilSupplierCertName, page.CurrentPage, page.Size, orderby, asc, &list, where)
  1124. var datainfo DataInfo
  1125. datainfo.Items = list
  1126. datainfo.CurrentItemCount = total
  1127. datainfo.PageIndex = page.CurrentPage
  1128. datainfo.ItemsPerPage = page.Size
  1129. this.Data["json"] = &datainfo
  1130. this.ServeJSON()
  1131. }
  1132. // @Title 获取列表
  1133. // @Description get user by token
  1134. // @Success 200 {object} []supplier.OilSupplierView
  1135. // @router /mytasks [get]
  1136. func (this *OilSupplierController) GetMyTaskEntityList() {
  1137. //获取分页信息
  1138. page := this.GetPageInfoForm()
  1139. where := " 1=1 "
  1140. orderby := "Id"
  1141. asc := false
  1142. Order := this.GetString("Order")
  1143. //Statustype := this.GetString("Statustype")
  1144. //if Statustype != "" {
  1145. // where = " 1=1 and b.Status =" + Statustype
  1146. //}
  1147. where = where + " and b.Status>0"
  1148. Prop := this.GetString("Prop")
  1149. if Order != "" && Prop != "" {
  1150. orderby = Prop
  1151. if Order == "asc" {
  1152. asc = true
  1153. }
  1154. }
  1155. Id := this.GetString("Id")
  1156. SupplierName := this.GetString("SupplierName")
  1157. OilCertificateNo := this.GetString("OilCertificateNo")
  1158. Grade := this.GetString("Grade")
  1159. MgrUnit := this.GetString("MgrUnit")
  1160. OperType := this.GetString("OperType")
  1161. Country := this.GetString("Country")
  1162. MaunAgent := this.GetString("MaunAgent")
  1163. ConstructTeam := this.GetString("ConstructTeam")
  1164. CommercialNo := this.GetString("CommercialNo")
  1165. OrganCode := this.GetString("OrganCode")
  1166. CountryTaxNo := this.GetString("CountryTaxNo")
  1167. LocalTaxNo := this.GetString("LocalTaxNo")
  1168. Address := this.GetString("Address")
  1169. Province := this.GetString("Province")
  1170. City := this.GetString("City")
  1171. Street := this.GetString("Street")
  1172. HouseNo := this.GetString("HouseNo")
  1173. ZipCode := this.GetString("ZipCode")
  1174. QualitySystemCert := this.GetString("QualitySystemCert")
  1175. ProductQualityCert := this.GetString("ProductQualityCert")
  1176. MaunLicense := this.GetString("MaunLicense")
  1177. QualifCert := this.GetString("QualifCert")
  1178. QualifCertLevel := this.GetString("QualifCertLevel")
  1179. SafetyLicense := this.GetString("SafetyLicense")
  1180. TechServiceLic := this.GetString("TechServiceLic")
  1181. TJInNotify := this.GetString("TJInNotify")
  1182. SpecIndustryCert := this.GetString("SpecIndustryCert")
  1183. LegalPerson := this.GetString("LegalPerson")
  1184. CategoryCode := this.GetString("CategoryCode")
  1185. CategoryName := this.GetString("CategoryName")
  1186. RegCapital := this.GetString("RegCapital")
  1187. Currency := this.GetString("Currency")
  1188. ContactName := this.GetString("ContactName")
  1189. CompanyType := this.GetString("CompanyType")
  1190. SetupTime := this.GetString("SetupTime")
  1191. DepositBank := this.GetString("DepositBank")
  1192. BankAccount := this.GetString("BankAccount")
  1193. EMail := this.GetString("EMail")
  1194. BankCreditRating := this.GetString("BankCreditRating")
  1195. Mobile := this.GetString("Mobile")
  1196. Telphone := this.GetString("Telphone")
  1197. Fax := this.GetString("Fax")
  1198. CompanyTel := this.GetString("CompanyTel")
  1199. QQ := this.GetString("QQ")
  1200. CompanyUrl := this.GetString("CompanyUrl")
  1201. SpecSupplier := this.GetString("SpecSupplier")
  1202. SpecTypeCode := this.GetString("SpecTypeCode")
  1203. SpecTypeName := this.GetString("SpecTypeName")
  1204. Remark := this.GetString("Remark")
  1205. CreateOn := this.GetString("CreateOn")
  1206. SupplierTypeCode := this.GetString("SupplierTypeCode")
  1207. if Id != "" {
  1208. where = where + " and a.Id like '%" + Id + "%'"
  1209. }
  1210. if SupplierName != "" {
  1211. where = where + " and a.SupplierName like '%" + SupplierName + "%'"
  1212. }
  1213. if OilCertificateNo != "" {
  1214. where = where + " and a.OilCertificateNo like '%" + OilCertificateNo + "%'"
  1215. }
  1216. if Grade != "" {
  1217. where = where + " and a.Grade like '%" + Grade + "%'"
  1218. }
  1219. if MgrUnit != "" {
  1220. where = where + " and a.MgrUnit like '%" + MgrUnit + "%'"
  1221. }
  1222. if OperType != "" {
  1223. where = where + " and a.OperType like '%" + OperType + "%'"
  1224. }
  1225. if Country != "" {
  1226. where = where + " and a.Country like '%" + Country + "%'"
  1227. }
  1228. if MaunAgent != "" {
  1229. where = where + " and a.MaunAgent like '%" + MaunAgent + "%'"
  1230. }
  1231. if ConstructTeam != "" {
  1232. where = where + " and a.ConstructTeam like '%" + ConstructTeam + "%'"
  1233. }
  1234. if CommercialNo != "" {
  1235. where = where + " and a.CommercialNo like '%" + CommercialNo + "%'"
  1236. }
  1237. if OrganCode != "" {
  1238. where = where + " and a.OrganCode like '%" + OrganCode + "%'"
  1239. }
  1240. if CountryTaxNo != "" {
  1241. where = where + " and a.CountryTaxNo like '%" + CountryTaxNo + "%'"
  1242. }
  1243. if LocalTaxNo != "" {
  1244. where = where + " and a.LocalTaxNo like '%" + LocalTaxNo + "%'"
  1245. }
  1246. if Address != "" {
  1247. where = where + " and a.Address like '%" + Address + "%'"
  1248. }
  1249. if Province != "" {
  1250. where = where + " and a.Province like '%" + Province + "%'"
  1251. }
  1252. if City != "" {
  1253. where = where + " and a.City like '%" + City + "%'"
  1254. }
  1255. if Street != "" {
  1256. where = where + " and a.Street like '%" + Street + "%'"
  1257. }
  1258. if HouseNo != "" {
  1259. where = where + " and a.HouseNo like '%" + HouseNo + "%'"
  1260. }
  1261. if ZipCode != "" {
  1262. where = where + " and a.ZipCode like '%" + ZipCode + "%'"
  1263. }
  1264. if QualitySystemCert != "" {
  1265. where = where + " and a.QualitySystemCert like '%" + QualitySystemCert + "%'"
  1266. }
  1267. if ProductQualityCert != "" {
  1268. where = where + " and a.ProductQualityCert like '%" + ProductQualityCert + "%'"
  1269. }
  1270. if MaunLicense != "" {
  1271. where = where + " and a.MaunLicense like '%" + MaunLicense + "%'"
  1272. }
  1273. if QualifCert != "" {
  1274. where = where + " and a.QualifCert like '%" + QualifCert + "%'"
  1275. }
  1276. if QualifCertLevel != "" {
  1277. where = where + " and a.QualifCertLevel like '%" + QualifCertLevel + "%'"
  1278. }
  1279. if SafetyLicense != "" {
  1280. where = where + " and a.SafetyLicense like '%" + SafetyLicense + "%'"
  1281. }
  1282. if TechServiceLic != "" {
  1283. where = where + " and a.TechServiceLic like '%" + TechServiceLic + "%'"
  1284. }
  1285. if TJInNotify != "" {
  1286. where = where + " and a.TJInNotify like '%" + TJInNotify + "%'"
  1287. }
  1288. if SpecIndustryCert != "" {
  1289. where = where + " and a.SpecIndustryCert like '%" + SpecIndustryCert + "%'"
  1290. }
  1291. if LegalPerson != "" {
  1292. where = where + " and a.LegalPerson like '%" + LegalPerson + "%'"
  1293. }
  1294. if CategoryCode != "" {
  1295. where = where + " and a.CategoryCode like '%" + CategoryCode + "%'"
  1296. }
  1297. if CategoryName != "" {
  1298. where = where + " and a.CategoryName like '%" + CategoryName + "%'"
  1299. }
  1300. if RegCapital != "" {
  1301. where = where + " and a.RegCapital like '%" + RegCapital + "%'"
  1302. }
  1303. if Currency != "" {
  1304. where = where + " and a.Currency like '%" + Currency + "%'"
  1305. }
  1306. if ContactName != "" {
  1307. where = where + " and a.ContactName like '%" + ContactName + "%'"
  1308. }
  1309. if CompanyType != "" {
  1310. where = where + " and a.CompanyType like '%" + CompanyType + "%'"
  1311. }
  1312. if SetupTime != "" {
  1313. where = where + " and a.SetupTime like '%" + SetupTime + "%'"
  1314. }
  1315. if DepositBank != "" {
  1316. where = where + " and a.DepositBank like '%" + DepositBank + "%'"
  1317. }
  1318. if BankAccount != "" {
  1319. where = where + " and a.BankAccount like '%" + BankAccount + "%'"
  1320. }
  1321. if EMail != "" {
  1322. where = where + " and a.EMail like '%" + EMail + "%'"
  1323. }
  1324. if BankCreditRating != "" {
  1325. where = where + " and a.BankCreditRating like '%" + BankCreditRating + "%'"
  1326. }
  1327. if Mobile != "" {
  1328. where = where + " and a.Mobile like '%" + Mobile + "%'"
  1329. }
  1330. if Telphone != "" {
  1331. where = where + " and a.Telphone like '%" + Telphone + "%'"
  1332. }
  1333. if Fax != "" {
  1334. where = where + " and a.Fax like '%" + Fax + "%'"
  1335. }
  1336. if CompanyTel != "" {
  1337. where = where + " and a.CompanyTel like '%" + CompanyTel + "%'"
  1338. }
  1339. if QQ != "" {
  1340. where = where + " and a.QQ like '%" + QQ + "%'"
  1341. }
  1342. if CompanyUrl != "" {
  1343. where = where + " and a.CompanyUrl like '%" + CompanyUrl + "%'"
  1344. }
  1345. if SpecSupplier != "" {
  1346. where = where + " and a.SpecSupplier like '%" + SpecSupplier + "%'"
  1347. }
  1348. if SpecTypeCode != "" {
  1349. where = where + " and a.SpecTypeCode like '%" + SpecTypeCode + "%'"
  1350. }
  1351. if SpecTypeName != "" {
  1352. where = where + " and a.SpecTypeName like '%" + SpecTypeName + "%'"
  1353. }
  1354. if Remark != "" {
  1355. where = where + " and a.Remark like '%" + Remark + "%'"
  1356. }
  1357. if CreateOn != "" {
  1358. dates := strings.Split(CreateOn, ",")
  1359. if len(dates) == 2 {
  1360. minDate := dates[0]
  1361. maxDate := dates[1]
  1362. where = where + " and a.CreateOn>='" + minDate + "' and a.CreateOn<='" + maxDate + "'"
  1363. }
  1364. }
  1365. if SupplierTypeCode != "" {
  1366. where = where + " and b.SupplierTypeCode = '" + SupplierTypeCode + "'"
  1367. }
  1368. //找出待办任务
  1369. actisvc := workflow.GetActivitiService(utils.DBE)
  1370. var certIdList string
  1371. if actisvc.GetMyTasks(workflow.OIL_SUPPLIER_APPLY, this.User.Id) != "" {
  1372. certIdList = actisvc.GetMyTasks(workflow.OIL_SUPPLIER_APPLY, this.User.Id)
  1373. certIdList = certIdList + ","
  1374. }
  1375. if actisvc.GetMyTasks(workflow.OIL_FIRST_SUPPLIER_APPLY, this.User.Id) != "" {
  1376. certIdList = fmt.Sprintf("%s %s", certIdList, actisvc.GetMyTasks(workflow.OIL_FIRST_SUPPLIER_APPLY, this.User.Id))
  1377. certIdList = certIdList + ","
  1378. }
  1379. if actisvc.GetMyTasks(workflow.OIL_SECOND_SUPPLIER_APPLY, this.User.Id) != "" {
  1380. certIdList = fmt.Sprintf("%s %s", certIdList, actisvc.GetMyTasks(workflow.OIL_SECOND_SUPPLIER_APPLY, this.User.Id))
  1381. certIdList = certIdList + ","
  1382. }
  1383. if actisvc.GetMyTasks(workflow.OIL_ENUSER_SUPPLIER_APPLY, this.User.Id) != "" {
  1384. certIdList = fmt.Sprintf("%s %s", certIdList, actisvc.GetMyTasks(workflow.OIL_ENUSER_SUPPLIER_APPLY, this.User.Id))
  1385. certIdList = certIdList + ","
  1386. }
  1387. if actisvc.GetMyTasks(workflow.OIL_FIRST_ENUSER_SUPPLIER_APPLY, this.User.Id) != "" {
  1388. certIdList = fmt.Sprintf("%s %s", certIdList, actisvc.GetMyTasks(workflow.OIL_FIRST_ENUSER_SUPPLIER_APPLY, this.User.Id))
  1389. certIdList = certIdList + ","
  1390. }
  1391. if actisvc.GetMyTasks(workflow.OIL_SECOND_ENUSER_SUPPLIER_APPLY, this.User.Id) != "" {
  1392. certIdList = fmt.Sprintf("%s %s", certIdList, actisvc.GetMyTasks(workflow.OIL_SECOND_ENUSER_SUPPLIER_APPLY, this.User.Id))
  1393. }
  1394. certIdList = strings.Trim(certIdList, ",")
  1395. certIdarr := strings.Split(certIdList, ",")
  1396. for i, item := range certIdarr {
  1397. idx := strings.Index(item, "-")
  1398. if idx >= 0 {
  1399. certIdarr[i] = strings.Split(item, "-")[0]
  1400. }
  1401. }
  1402. certIdList = strings.Join(certIdarr, ",")
  1403. var list []supplier.OilSupplierView
  1404. svc := supplier.GetOilSupplierService(utils.DBE)
  1405. var total int64 = 0
  1406. if (certIdList != "") {
  1407. where += " and b.Id in (" + certIdList + ")"
  1408. total = svc.GetMyPagingEntitiesWithOrderBytbl(OilSupplierName, OilSupplierCertName, page.CurrentPage, page.Size, orderby, asc, &list, where)
  1409. }
  1410. //根据部门查询待办任务
  1411. var datainfo DataInfo
  1412. datainfo.Items = list
  1413. datainfo.CurrentItemCount = total
  1414. datainfo.PageIndex = page.CurrentPage
  1415. datainfo.ItemsPerPage = page.Size
  1416. this.Data["json"] = &datainfo
  1417. this.ServeJSON()
  1418. }
  1419. // @Title 获取字典列表
  1420. // @Description get user by token
  1421. // @Success 200 {object} map[string]interface{}
  1422. // @router /dictlist [get]
  1423. func (this *OilSupplierController) GetDictList() {
  1424. dictList := make(map[string]interface{})
  1425. dictSvc := items.GetItemsService(utils.DBE)
  1426. userSvc := baseUser.GetBaseUserService(utils.DBE)
  1427. areaJsonSvc := areajson.GetAreaJsonService(utils.DBE)
  1428. //customerSvc := svccustomer.GetCustomerService(utils.DBE)
  1429. dictList["UnitRelation"] = dictSvc.GetKeyValueItems("UnitRelation")
  1430. dictList["CompanyType"] = dictSvc.GetKeyValueItems("CompanyType")
  1431. dictList["InOptions"] = dictSvc.GetKeyValueItems("InOptions")
  1432. var userEntity userRole.Base_User
  1433. userSvc.GetEntityById(this.User.Id, &userEntity)
  1434. dictList["Supervisers"] = userSvc.GetUserListByDepartmentId(this.User.AccCode, userEntity.Departmentid)
  1435. dictList["GaodeMapChinaAreas"] = areaJsonSvc.GetGaodeMapChinaAreas()
  1436. dictList["CountryList"] = areaJsonSvc.GetCountryList()
  1437. //获取我创建的所有公司
  1438. var list []supplier.OilSupplier
  1439. if this.User.IsCompanyUser == 1 {
  1440. svcSupplier := supplier.GetOilSupplierService(utils.DBE)
  1441. supplierWhere := " CreateUserId = '" + this.User.Id + "'"
  1442. svcSupplier.GetEntitysByWhere(OilSupplierName, supplierWhere, &list)
  1443. dictList["CompanyNames"] = list
  1444. } else { //二级单位不用获取
  1445. dictList["CompanyNames"] = list
  1446. }
  1447. // 部门
  1448. orgsvc := organize.GetOrganizeService(utils.DBE)
  1449. dictList["Organizes"] = orgsvc.GetCollectionDetailviewlist("'" + this.User.AccCode + "'")
  1450. //var dictCustomer []svccustomer.Customer
  1451. //customerSvc.GetEntitysByWhere(this.User.AccCode + CustomerName, "", &dictCustomer)
  1452. //dictList["EntrustCorp"] = &dictCustomer
  1453. //获得有审核权限的人员
  1454. var users []userRole.Base_RoleList
  1455. var auditWorkflow auditsetting.Base_OilAuditSetting
  1456. rsvc := auditsetting.GetOilAuditSettingService(utils.DBE)
  1457. rsvc.GetAuditStepRoleEntity(OilAuditSettingName, this.User.DepartmentId, workflow.SECOND_TRIAL, &auditWorkflow)
  1458. users = rsvc.GetUserByRole(strconv.Itoa(auditWorkflow.RoleId), this.User.AccCode) //
  1459. dictList["Auditer"] = users
  1460. var datainfo DataInfo
  1461. datainfo.Items = dictList
  1462. this.Data["json"] = &datainfo
  1463. this.ServeJSON()
  1464. }
  1465. // @Title 获取字典列表By Status
  1466. // @Description get user by token
  1467. // @Success 200 {object} map[string]interface{}
  1468. // @router /dictlistbystatus/ [get]
  1469. func (this *OilSupplierController) GetDictListByStatus() {
  1470. //status := this.Ctx.Input.Param(":status")
  1471. status := this.GetString("status")
  1472. majorAduit := this.GetString("majorAduit")
  1473. dictList := make(map[string]interface{})
  1474. dictSvc := items.GetItemsService(utils.DBE)
  1475. userSvc := baseUser.GetBaseUserService(utils.DBE)
  1476. areaJsonSvc := areajson.GetAreaJsonService(utils.DBE)
  1477. orgsvc := organize.GetOrganizeService(utils.DBE)
  1478. svc := supplier.GetOilSupplierService(utils.DBE)
  1479. //customerSvc := svccustomer.GetCustomerService(utils.DBE)
  1480. dictList["ManagementUnit"] = dictSvc.GetKeyValueItems("ManagementUnit")
  1481. dictList["UnitRelation"] = dictSvc.GetKeyValueItems("UnitRelation")
  1482. dictList["CompanyType"] = dictSvc.GetKeyValueItems("CompanyType")
  1483. dictList["InOptions"] = dictSvc.GetKeyValueItems("InOptions")
  1484. dictList["OperType"] = dictSvc.GetKeyValueItems("OperType")
  1485. dictList["CurrencyType"] = dictSvc.GetKeyValueItems("CurrencyType")
  1486. var userEntity userRole.Base_User
  1487. userSvc.GetEntityById(this.User.Id, &userEntity)
  1488. dictList["Supervisers"] = userSvc.GetUserListByDepartmentId(this.User.AccCode, userEntity.Departmentid)
  1489. dictList["GaodeMapChinaAreas"] = areaJsonSvc.GetGaodeMapChinaAreas()
  1490. dictList["CountryList"] = areaJsonSvc.GetCountryList()
  1491. //获取专业审批处室部门
  1492. var preorglist []organize.Base_Organizetree
  1493. //paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
  1494. //topid := paramSvc.GetBaseparameterMessage("", "paramset", "HeadquartersID") // 总公司Id
  1495. ids := orgsvc.GetAllChildUnitById("0")
  1496. svc.GetProOrTreeList(ids, &preorglist)
  1497. dictList["ProOrgList"] = preorglist
  1498. //获取我创建的所有公司
  1499. var list []supplier.OilSupplier
  1500. if this.User.IsCompanyUser == 1 {
  1501. svcSupplier := supplier.GetOilSupplierService(utils.DBE)
  1502. supplierWhere := " CreateUserId = '" + this.User.Id + "'"
  1503. svcSupplier.GetEntitysByWhere(OilSupplierName, supplierWhere, &list)
  1504. dictList["CompanyNames"] = list
  1505. } else { //二级单位不用获取
  1506. dictList["CompanyNames"] = list
  1507. }
  1508. // 部门
  1509. dictList["Organizes"] = orgsvc.GetCollectionDetailviewlist("'" + this.User.AccCode + "'")
  1510. //var dictCustomer []svccustomer.Customer
  1511. //customerSvc.GetEntitysByWhere(this.User.AccCode + CustomerName, "", &dictCustomer)
  1512. //dictList["EntrustCorp"] = &dictCustomer
  1513. //获得有审核权限的人员
  1514. //var users []suppliercert.UserList
  1515. //rsvc := auditsetting.GetOilAuditSettingService(utils.DBE)
  1516. certSrv := suppliercert.GetOilSupplierCertService(utils.DBE)
  1517. var users []userRole.Base_RoleList
  1518. if status == suppliercert.FIRST_TRIAL_STATUS {
  1519. //rsvc.GetAuditStepRoleEntity(OilAuditSettingName, this.User.DepartmentId, workflow.SECOND_TRIAL, &auditWorkflow)
  1520. //users = rsvc.GetUserByRole(strconv.Itoa(auditWorkflow.RoleId), this.User.AccCode) //
  1521. //where := "OrganizeId=" + this.User.DepartmentId + " and AuditStepCode='" + workflow.SECOND_TRIAL + "'"
  1522. //rsvc.GetEntitysByWhere(OilAuditSettingName, where, &users)
  1523. certSrv.GetAuditUser(this.User.DepartmentId, workflow.SECOND_TRIAL, &users)
  1524. dictList["Auditer"] = users
  1525. } else if status == suppliercert.SECOND_TRIAL_STATUS {
  1526. //rsvc.GetAuditStepRoleEntity(OilAuditSettingName, this.User.DepartmentId, workflow.SECOND_TRIAL, &auditWorkflow)
  1527. } else if status == suppliercert.THIRD_TRIAL_STATUS {
  1528. //where := "OrganizeId=" + majorAduit + " and AuditStepCode='" + workflow.SECOND_TRIAL + "'"
  1529. //rsvc.GetEntitysByWhere(OilAuditSettingName, where, &users)
  1530. certSrv.GetAuditUser(majorAduit, workflow.SECOND_TRIAL, &users)
  1531. dictList["Auditer"] = users
  1532. } else if status == suppliercert.PROF_AUDIT_STATUS {
  1533. //where := "OrganizeId=" + this.User.DepartmentId + " and AuditStepCode='" + workflow.PROF_AUDIT + "'"
  1534. //rsvc.GetEntitysByWhere(OilAuditSettingName, where, &users)
  1535. certSrv.GetAuditUser(this.User.DepartmentId, workflow.PROF_AUDIT, &users)
  1536. dictList["Auditer"] = users
  1537. } else if status == suppliercert.CENT_AUDIT_STATUS {
  1538. }
  1539. // 获取当
  1540. var datainfo DataInfo
  1541. datainfo.Items = dictList
  1542. this.Data["json"] = &datainfo
  1543. this.ServeJSON()
  1544. }
  1545. // @Title 获取实体
  1546. // @Description 获取实体
  1547. // @Success 200 {object} supplier.OilSupplier
  1548. // @router /get/:id [get]
  1549. func (this *OilSupplierController) GetEntity() {
  1550. Id := this.Ctx.Input.Param(":id")
  1551. var model supplier.OilSupplier
  1552. svc := supplier.GetOilSupplierService(utils.DBE)
  1553. svc.GetEntityByIdBytbl(OilSupplierName, Id, &model)
  1554. this.Data["json"] = &model
  1555. this.ServeJSON()
  1556. }
  1557. // @Title 获取实体
  1558. // @Description 获取实体
  1559. // @Success 200 {object} supplier.OilSupplier
  1560. // @router /getandcert/:certId [get]
  1561. func (this *OilSupplierController) GetEntityAndCert() {
  1562. Id := this.Ctx.Input.Param(":certId")
  1563. var model supplier.OilSupplierView
  1564. //svc := supplier.GetOilSupplierService(utils.DBE)
  1565. //svc.GetEntityByIdBytbl(OilSupplierName, Id, &model)
  1566. var sql string
  1567. 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,
  1568. b.MiddleProfNum, b.NationalRegNum, b.NationalCertTotal, b.DesignerTotal, b.SkillerTotal, b.InStyle, b.WorkflowId, b.Status, b.ThirdAudit, b.BusinessKey, b.AuditIndex from ` + OilSupplierName + ` a `
  1569. sql += ` left join ` + OilSupplierCertName + " b on b.SupplierId = a.Id"
  1570. sql += ` where b.Id ='` + Id + `'`
  1571. utils.DBE.SQL(sql).Get(&model)
  1572. this.Data["json"] = &model
  1573. this.ServeJSON()
  1574. }
  1575. // @Title 获取实体
  1576. // @Description 获取实体
  1577. // @Success 200 {object} supplier.OilSupplier
  1578. // @router /getbyname [get]
  1579. func (this *OilSupplierController) GetEntityByName() {
  1580. name := this.GetString("name")
  1581. typecode := this.GetString("typecode")
  1582. svc := supplier.GetOilSupplierService(utils.DBE)
  1583. var model supplier.OilSupplierApply
  1584. var sql string
  1585. sql = `select a.*,b.InStyle,b.Status from ` + OilSupplierName + ` a `
  1586. sql += ` left join ` + OilSupplierCertName + ` b on b.SupplierId = a.Id and b.SupplierTypeCode='`+typecode+`'`
  1587. sql += ` where a.SupplierName ='` + name + `'`
  1588. utils.DBE.SQL(sql).Get(&model)
  1589. if model.SupplierName==""{
  1590. var model2 register.OilCorporateInfo
  1591. svc.GetEntityByWhere(OilCorporateInfoName, "SupplierName='" + name + "'", &model2)
  1592. model2.Remark=""
  1593. model2.Id=0
  1594. if model2.SupplierName==""{
  1595. this.ServeJSON()
  1596. }else{
  1597. this.Data["json"] = &model2
  1598. this.ServeJSON()
  1599. }
  1600. }
  1601. this.Data["json"] = &model
  1602. this.ServeJSON()
  1603. }
  1604. // @Title 添加
  1605. // @Description 新增
  1606. // @Success 200 {object} controllers.Request
  1607. // @router /add [post]
  1608. func (this *OilSupplierController) AddEntity() {
  1609. var model supplier.OilSupplier
  1610. var modelCert suppliercert.OilSupplierCert
  1611. var modelCertVM suppliercert.OilSupplierVM
  1612. var jsonBlob = this.Ctx.Input.RequestBody
  1613. json.Unmarshal(jsonBlob, &model)
  1614. json.Unmarshal(jsonBlob, &modelCertVM)
  1615. serviceCert := suppliercert.GetOilSupplierCertService(utils.DBE)
  1616. canApply := serviceCert.IsCanApplyByExtOrganizeUser(modelCertVM.SupplierTypeCode, this.User.DepartmentId, this.User.Id, this.User.IsCompanyUser)
  1617. var errinfo ErrorDataInfo
  1618. if !canApply {
  1619. errinfo.Message = "添加失败!供方用户只能申请一次"
  1620. errinfo.Code = -1
  1621. this.Data["json"] = &errinfo
  1622. this.ServeJSON()
  1623. return
  1624. }
  1625. var list []supplier.OilSupplierView
  1626. service := supplier.GetOilSupplierService(utils.DBE)
  1627. if model.Id <= 0 {
  1628. service.CheckRepeatApplyInfo(OilSupplierName, OilSupplierCertName, modelCertVM.SupplierTypeCode, model.SupplierName, model.CommercialNo, model.OrganCode, model.BankAccount, model.CompanyUrl, &list)
  1629. if len(list) > 0 {
  1630. errinfo.Message = "添加失败! 已存在相关企业的信息,不能重复申请"
  1631. errinfo.Code = -1
  1632. this.Data["json"] = &errinfo
  1633. this.ServeJSON()
  1634. return
  1635. }
  1636. } else {
  1637. service.CheckUpdateRepeatApplyInfo(OilSupplierName, OilSupplierCertName, modelCertVM.SupplierTypeCode, strconv.Itoa(model.Id), model.SupplierName, model.CommercialNo, model.OrganCode, model.BankAccount, model.CompanyUrl, &list)
  1638. if len(list) > 0 {
  1639. errinfo.Message = "添加失败! 已存在相关企业的信息,或与其他企业信息重复"
  1640. errinfo.Code = -1
  1641. this.Data["json"] = &errinfo
  1642. this.ServeJSON()
  1643. return
  1644. }
  1645. }
  1646. var session *xorm.Session
  1647. session = utils.DBE.NewSession()
  1648. svc := supplier.GetOilSupplierSession(session)
  1649. svcCert := suppliercert.GetOilSupplierCertSession(session)
  1650. model.CreateOn = time.Now()
  1651. model.CreateBy = this.User.Realname
  1652. model.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
  1653. //model.OrganizeId, _ = utils.StrTo(this.User.DepartmentId).Int()
  1654. defer session.Close()
  1655. err := session.Begin()
  1656. if model.Id <= 0 {
  1657. _, err = svc.InsertEntityBytbl(OilSupplierName, &model)
  1658. } else {
  1659. //判断基本信息是否可修改
  1660. updateCols := svc.GetUpdateCols(OilSupplierCertName, modelCertVM.SupplierTypeCode, model.Id)
  1661. err = svc.UpdateEntityBytbl(OilSupplierName, model.Id, &model, updateCols)
  1662. }
  1663. if err != nil {
  1664. session.Rollback()
  1665. }
  1666. modelCert.SupplierId = model.Id
  1667. modelCert.SupplierTypeCode = modelCertVM.SupplierTypeCode
  1668. modelCert.SupplierTypeName = modelCertVM.SupplierTypeName
  1669. modelCert.InStyle = modelCertVM.InStyle
  1670. modelCert.Step = 1 //企业信息保存完成
  1671. modelCert.CreateOn = time.Now()
  1672. modelCert.CreateBy = this.User.Realname
  1673. modelCert.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
  1674. _, err = svcCert.InsertEntityBytbl(OilSupplierCertName, &modelCert)
  1675. if err != nil {
  1676. session.Rollback()
  1677. }
  1678. // add Commit() after all actions
  1679. err = session.Commit()
  1680. if err == nil {
  1681. //新增
  1682. errinfo.Message = "添加成功!"
  1683. errinfo.Code = 0
  1684. errinfo.Item = strconv.Itoa(model.Id) + "_" + strconv.Itoa(modelCert.Id)
  1685. this.Data["json"] = &errinfo
  1686. this.ServeJSON()
  1687. } else {
  1688. errinfo.Message = "添加失败!" + utils.AlertProcess(err.Error())
  1689. errinfo.Code = -1
  1690. this.Data["json"] = &errinfo
  1691. this.ServeJSON()
  1692. }
  1693. }
  1694. // @Title 修改实体
  1695. // @Description 修改实体
  1696. // @Success 200 {object} controllers.Request
  1697. // @router /update/:id/:type [post]
  1698. func (this *OilSupplierController) UpdateEntity() {
  1699. id := this.Ctx.Input.Param(":id")
  1700. typeCode := this.Ctx.Input.Param(":type")
  1701. var errinfo ErrorInfo
  1702. if id == "" {
  1703. errinfo.Message = "操作失败!请求信息不完整"
  1704. errinfo.Code = -2
  1705. this.Data["json"] = &errinfo
  1706. this.ServeJSON()
  1707. return
  1708. }
  1709. var model supplier.OilSupplier
  1710. var jsonBlob = this.Ctx.Input.RequestBody
  1711. json.Unmarshal(jsonBlob, &model)
  1712. var list []supplier.OilSupplierView
  1713. service := supplier.GetOilSupplierService(utils.DBE)
  1714. service.CheckUpdateRepeatApplyInfo(OilSupplierName, OilSupplierCertName, typeCode, strconv.Itoa(model.Id), model.SupplierName, model.CommercialNo, model.OrganCode, model.BankAccount, model.CompanyUrl, &list)
  1715. if len(list) > 0 {
  1716. errinfo.Message = "修改失败! 已存在相关企业的信息,或与其他企业信息重复"
  1717. errinfo.Code = -1
  1718. this.Data["json"] = &errinfo
  1719. this.ServeJSON()
  1720. return
  1721. }
  1722. svc := supplier.GetOilSupplierService(utils.DBE)
  1723. model.ModifiedOn = time.Now()
  1724. model.ModifiedBy = this.User.Realname
  1725. model.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
  1726. //判断基本信息是否可修改
  1727. updateCols := svc.GetUpdateCols(OilSupplierCertName, typeCode, model.Id)
  1728. err := svc.UpdateEntityBytbl(OilSupplierName, id, &model, updateCols)
  1729. if err == nil {
  1730. errinfo.Message = "修改成功!"
  1731. errinfo.Code = 0
  1732. this.Data["json"] = &errinfo
  1733. this.ServeJSON()
  1734. } else {
  1735. errinfo.Message = "修改失败!" + utils.AlertProcess(err.Error())
  1736. errinfo.Code = -1
  1737. this.Data["json"] = &errinfo
  1738. this.ServeJSON()
  1739. }
  1740. }
  1741. // @Title 修改企业人员情况实体
  1742. // @Description 修改实体
  1743. // @Success 200 {object} controllers.Request
  1744. // @router /updatenumber/:id [post]
  1745. func (this *OilSupplierController) UpdateNumberEntity() {
  1746. idGroup := this.Ctx.Input.Param(":id")
  1747. //id := strings.Split(idGroup, "_")[0]
  1748. certId := strings.Split(idGroup, "_")[1]
  1749. var errinfo ErrorInfo
  1750. if certId == "" {
  1751. errinfo.Message = "操作失败!请求信息不完整"
  1752. errinfo.Code = -2
  1753. this.Data["json"] = &errinfo
  1754. this.ServeJSON()
  1755. return
  1756. }
  1757. var modelCert suppliercert.OilSupplierCert
  1758. svcCert := suppliercert.GetOilSupplierCertService(utils.DBE)
  1759. var jsonBlob = this.Ctx.Input.RequestBody
  1760. json.Unmarshal(jsonBlob, &modelCert)
  1761. modelCert.ModifiedOn = time.Now()
  1762. modelCert.ModifiedBy = this.User.Realname
  1763. modelCert.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
  1764. colcerts := []string{
  1765. "Id",
  1766. "InStyle",
  1767. "WorkerTotal",
  1768. "ContractNum ",
  1769. "UniversityNum",
  1770. "TechnicalNum",
  1771. "AboveProfNum",
  1772. "MiddleProfNum",
  1773. "NationalRegNum",
  1774. "NationalCertTotal",
  1775. "DesignerTotal",
  1776. "SkillerTotal",
  1777. "ModifiedOn",
  1778. "ModifiedUserId",
  1779. "ModifiedBy",
  1780. }
  1781. // if modelCert.Step <= 2 {
  1782. // modelCert.Step = 2 //完成企业基本信息
  1783. // colcerts = append(colcerts, "Step")
  1784. // }
  1785. err := svcCert.UpdateEntityBytbl(OilSupplierCertName, certId, &modelCert, colcerts)
  1786. if err == nil {
  1787. errinfo.Message = "保存成功!"
  1788. errinfo.Code = 0
  1789. this.Data["json"] = &errinfo
  1790. this.ServeJSON()
  1791. } else {
  1792. errinfo.Message = "保存失败!" + utils.AlertProcess(err.Error())
  1793. errinfo.Code = -1
  1794. this.Data["json"] = &errinfo
  1795. this.ServeJSON()
  1796. }
  1797. }
  1798. // @Title 删除单条信息
  1799. // @Description
  1800. // @Success 200 {object} ErrorInfo
  1801. // @Failure 403 :id 为空
  1802. // @router /delete/:Id [delete]
  1803. func (this *OilSupplierController) DeleteEntity() {
  1804. Id := this.Ctx.Input.Param(":Id")
  1805. var errinfo ErrorInfo
  1806. if Id == "" {
  1807. errinfo.Message = "操作失败!请求信息不完整"
  1808. errinfo.Code = -2
  1809. this.Data["json"] = &errinfo
  1810. this.ServeJSON()
  1811. return
  1812. }
  1813. var model supplier.OilSupplier
  1814. var entityempty supplier.OilSupplier
  1815. svc := supplier.GetOilSupplierService(utils.DBE)
  1816. opdesc := "删除-" + Id
  1817. err := svc.DeleteOperationAndWriteLogBytbl(OilSupplierName, BaseOperationLogName, Id, &model, &entityempty, utils.ToStr(this.User.Id), this.User.Username, opdesc, this.User.AccCode, "钻井日报")
  1818. if err == nil {
  1819. errinfo.Message = "删除成功"
  1820. errinfo.Code = 0
  1821. this.Data["json"] = &errinfo
  1822. this.ServeJSON()
  1823. } else {
  1824. errinfo.Message = "删除失败!" + utils.AlertProcess(err.Error())
  1825. errinfo.Code = -1
  1826. this.Data["json"] = &errinfo
  1827. this.ServeJSON()
  1828. }
  1829. }
  1830. // @Title 删除单条信息
  1831. // @Description
  1832. // @Success 200 {object} ErrorInfo
  1833. // @Failure 403 :id 为空
  1834. // @router /deleteall/:Id/:SupplierTypeCode [delete]
  1835. func (this *OilSupplierController) DeleteAllEntity() {
  1836. Id := this.Ctx.Input.Param(":Id")
  1837. SupplierTypeCode := this.Ctx.Input.Param(":SupplierTypeCode")
  1838. var errinfo ErrorInfo
  1839. if Id == "" {
  1840. errinfo.Message = "操作失败!请求信息不完整"
  1841. errinfo.Code = -2
  1842. this.Data["json"] = &errinfo
  1843. this.ServeJSON()
  1844. return
  1845. }
  1846. svc := supplier.GetOilSupplierService(utils.DBE)
  1847. err:=svc.DeleteEntityBytbl(OilSupplierCertName,"SupplierId="+Id+" and SupplierTypeCode='"+SupplierTypeCode+"'")
  1848. err =svc.DeleteEntityBytbl(OilSupplierCert2FileName,"SupplierId="+Id+" and SupplierTypeCode='"+SupplierTypeCode+"'")
  1849. err =svc.DeleteEntityBytbl(OilSupplierFileName,"SupplierId="+Id+" and SupplierTypeCode='"+SupplierTypeCode+"'")
  1850. var model1 suppliercertsub.OilSupplierCert2File
  1851. count1, _ := svc.GetCount(&model1, "SupplierId="+Id)
  1852. if count1==0{
  1853. err=svc.DeleteEntityBytbl(OilSupplierFileName,"SupplierId="+Id)
  1854. }
  1855. var model2 suppliercert.OilSupplierCert
  1856. count2, _ := svc.GetCount(&model2, "SupplierId="+Id)
  1857. if count2==0{
  1858. err=svc.DeleteEntityBytbl(OilSupplierName,"Id="+Id)
  1859. }
  1860. if err == nil {
  1861. errinfo.Message = "删除成功"
  1862. errinfo.Code = 0
  1863. this.Data["json"] = &errinfo
  1864. this.ServeJSON()
  1865. } else {
  1866. errinfo.Message = "删除失败!" + utils.AlertProcess(err.Error())
  1867. errinfo.Code = -1
  1868. this.Data["json"] = &errinfo
  1869. this.ServeJSON()
  1870. }
  1871. }
  1872. // @Title 判断是否可以申请准入
  1873. // @Description
  1874. // @Success 200 {string} Count
  1875. // @Failure 403 :id 为空
  1876. // @router /iscanapply/:type [get]
  1877. func (this *OilSupplierController) IsCanApply() {
  1878. Type := this.Ctx.Input.Param(":type")
  1879. var errinfo ErrorInfo
  1880. if Type == "" {
  1881. errinfo.Message = "操作失败!请求信息不完整"
  1882. errinfo.Code = -2
  1883. this.Data["json"] = &errinfo
  1884. this.ServeJSON()
  1885. return
  1886. }
  1887. svc := suppliercert.GetOilSupplierCertService(utils.DBE)
  1888. canApply := svc.IsCanApplyByExtOrganizeUser(Type, this.User.DepartmentId, this.User.Id, this.User.IsCompanyUser)
  1889. if canApply {
  1890. errinfo.Message = "无申请记录,可以申请"
  1891. errinfo.Code = 0
  1892. this.Data["json"] = &errinfo
  1893. this.ServeJSON()
  1894. } else {
  1895. errinfo.Message = "供方用户只能申请一次"
  1896. errinfo.Code = -1
  1897. this.Data["json"] = &errinfo
  1898. this.ServeJSON()
  1899. }
  1900. }
  1901. // @Title 判断是否可以修改供方企业信息
  1902. // @Description
  1903. // @Success 200 {string} Count
  1904. // @Failure 403 :id 为空
  1905. // @router /iscanupdatesupplier/:supplierid [get]
  1906. func (this *OilSupplierController) CanUpdateSupplier() {
  1907. supplierId := this.Ctx.Input.Param(":supplierid")
  1908. var errinfo ErrorInfo
  1909. if supplierId == "" {
  1910. errinfo.Message = "操作失败!请求信息不完整"
  1911. errinfo.Code = -2
  1912. this.Data["json"] = &errinfo
  1913. this.ServeJSON()
  1914. return
  1915. }
  1916. Id, _ := strconv.Atoi(supplierId)
  1917. svc := supplier.GetOilSupplierService(utils.DBE)
  1918. canUpdate := svc.CanUpdateSupplier(OilSupplierCertName, Id)
  1919. if canUpdate {
  1920. errinfo.Message = "可以修改"
  1921. errinfo.Code = 0
  1922. this.Data["json"] = &errinfo
  1923. this.ServeJSON()
  1924. } else {
  1925. errinfo.Message = "此供方已经提交准入申请,不可修改"
  1926. errinfo.Code = -1
  1927. this.Data["json"] = &errinfo
  1928. this.ServeJSON()
  1929. }
  1930. }
  1931. // @Title 获取二级审核人员
  1932. // @Description 获取二级审核人员
  1933. // @router /getauditerbydept/:deptId [get]
  1934. func (this *OilSupplierController) GetAuditerByDept() {
  1935. Id := this.Ctx.Input.Param(":deptId")
  1936. auditstepcode := this.GetString("auditstepcode")
  1937. svc := organize.GetOrganizeService(utils.DBE)
  1938. unitId := svc.GetMyUnitDepartmentId(Id)
  1939. //ids := svc.GetAllChildById(unitId)
  1940. //
  1941. //certSrv := suppliercert.GetOilSupplierCertService(utils.DBE)
  1942. //var users []userRole.Base_RoleList
  1943. //certSrv.GetAuditUser(ids, auditstepcode, &users)
  1944. var userlist []userRole.Base_User
  1945. var setting auditsetting.Base_OilAuditSetting
  1946. usvc := userRole.GetUserService(utils.DBE)
  1947. where := "AuditStepCode='" + auditstepcode + "'"
  1948. svc.GetEntity(&setting, where)
  1949. ids := usvc.GetUserIdsByRoleId(strconv.Itoa(setting.RoleId))
  1950. tempstr := strings.Join(ids, ",")
  1951. userIds := strings.Replace(tempstr, "uid_", "", -1)
  1952. userIds = strings.Trim(userIds, ",")
  1953. if userIds != "" {
  1954. where := "Id in (" + userIds + ")" + " and UnitId=" + unitId
  1955. svc.GetEntities(&userlist, where)
  1956. }
  1957. var datainfo ErrorDataInfo
  1958. datainfo.Item = userlist
  1959. this.Data["json"] = &datainfo
  1960. this.ServeJSON()
  1961. }
  1962. // @Title 获取二级初审人员
  1963. // @Description 获取二级初审人员
  1964. // @router /getfirauditerbydept/:deptId [get]
  1965. func (this *OilSupplierController) GetFirAuditerByDept() {
  1966. Id := this.Ctx.Input.Param(":deptId")
  1967. auditstepcode := this.GetString("auditstepcode")
  1968. var userlist []userRole.Base_User
  1969. var setting auditsetting.Base_OilAuditSetting
  1970. svc := userRole.GetUserService(utils.DBE)
  1971. where := "AuditStepCode='" + auditstepcode + "'"
  1972. svc.GetEntity(&setting, where)
  1973. ids := svc.GetUserIdsByRoleId(strconv.Itoa(setting.RoleId))
  1974. tempstr := strings.Join(ids, ",")
  1975. userIds := strings.Replace(tempstr, "uid_", "", -1)
  1976. userIds = strings.Trim(userIds, ",")
  1977. if userIds != "" {
  1978. where := "Id in (" + userIds + ")" + "and UnitId=" + Id
  1979. svc.GetEntities(&userlist, where)
  1980. }
  1981. //svc := organize.GetOrganizeService(utils.DBE)
  1982. //
  1983. //ids := svc.GetAllChildById(Id)
  1984. //
  1985. //certSrv := suppliercert.GetOilSupplierCertService(utils.DBE)
  1986. //var users []userRole.Base_RoleList
  1987. //certSrv.GetAuditUser(ids, auditstepcode, &users)
  1988. var datainfo ErrorDataInfo
  1989. datainfo.Item = userlist
  1990. this.Data["json"] = &datainfo
  1991. this.ServeJSON()
  1992. }
  1993. // @Title 获取二级复审人员根据初审人员
  1994. // @Description 获取二级复审人员根据初审人员
  1995. // @router /getauditerbyfirst/:firstId [get]
  1996. func (this *OilSupplierController) GetAuditerByFist() {
  1997. Id := this.Ctx.Input.Param(":firstId")
  1998. auditstepcode := this.GetString("auditstepcode")
  1999. certSrv := suppliercert.GetOilSupplierCertService(utils.DBE)
  2000. //orgSrv := organize.GetOrganizeService(utils.DBE)
  2001. var userentity userRole.Base_User
  2002. certSrv.GetEntityById(Id, &userentity)
  2003. var userlist []userRole.Base_User
  2004. var setting auditsetting.Base_OilAuditSetting
  2005. svc := userRole.GetUserService(utils.DBE)
  2006. where := "AuditStepCode='" + auditstepcode + "'"
  2007. svc.GetEntity(&setting, where)
  2008. ids := svc.GetUserIdsByRoleId(strconv.Itoa(setting.RoleId))
  2009. tempstr := strings.Join(ids, ",")
  2010. userIds := strings.Replace(tempstr, "uid_", "", -1)
  2011. userIds = strings.Trim(userIds, ",")
  2012. if userIds != "" {
  2013. where := "Id in (" + userIds + ")" + "and UnitId=" + strconv.Itoa(userentity.UnitId)
  2014. svc.GetEntities(&userlist, where)
  2015. }
  2016. //svc := organize.GetOrganizeService(utils.DBE)
  2017. //unitId := svc.GetMyUnitDepartmentId(userentity.Departmentid)
  2018. //ids := svc.GetAllChildById(unitId)
  2019. ////depId := strings.Split(userentity.Superior,",")
  2020. //var users []userRole.Base_RoleList
  2021. //certSrv.GetAuditUser(ids, auditstepcode, &users)
  2022. var datainfo ErrorDataInfo
  2023. datainfo.Item = userlist
  2024. this.Data["json"] = &datainfo
  2025. this.ServeJSON()
  2026. }
  2027. // @Title 获取二级初审人员(不需要验证登录)
  2028. // @Description 获取二级初审人员(不需要验证登录)
  2029. // @router /getauditerbydeptandnologin [get]
  2030. func (this *OilSupplierController) GetAuditerByDeptAndNoLogin() {
  2031. Id := this.GetString("deptId")
  2032. auditstepcode := this.GetString("auditstepcode")
  2033. var userlist []userRole.Base_User
  2034. var setting auditsetting.Base_OilAuditSetting
  2035. svc := userRole.GetUserService(utils.DBE)
  2036. where := "AuditStepCode='" + auditstepcode + "'"
  2037. svc.GetEntity(&setting, where)
  2038. ids := svc.GetUserIdsByRoleId(strconv.Itoa(setting.RoleId))
  2039. tempstr := strings.Join(ids, ",")
  2040. userIds := strings.Replace(tempstr, "uid_", "", -1)
  2041. userIds = strings.Trim(userIds, ",")
  2042. if userIds != "" {
  2043. where := "Id in (" + userIds + ")" + "and UnitId=" + Id
  2044. svc.GetEntities(&userlist, where)
  2045. }
  2046. //certSrv := suppliercert.GetOilSupplierCertService(utils.DBE)
  2047. //var users []userRole.Base_RoleList
  2048. //certSrv.GetAuditUser(Id, auditstepcode, &users)
  2049. // certSrv.GetAuditUserByNoLogin(Id, &users)
  2050. var datainfo ErrorDataInfo
  2051. datainfo.Item = userlist
  2052. this.Data["json"] = &datainfo
  2053. this.ServeJSON()
  2054. }