select.go 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699
  1. package oilsupplier
  2. import (
  3. "dashoo.cn/backend/api/business/oilsupplier/annualaudit"
  4. "dashoo.cn/backend/api/business/oilsupplier/infochange"
  5. "dashoo.cn/backend/api/business/oilsupplier/qualchange"
  6. "dashoo.cn/backend/api/business/oilsupplier/suppliercert"
  7. "dashoo.cn/backend/api/business/oilsupplier/suppliercertappend"
  8. "dashoo.cn/backend/api/business/oilsupplier/supplierfile"
  9. "dashoo.cn/backend/api/business/register"
  10. "encoding/json"
  11. "fmt"
  12. "sort"
  13. "strconv"
  14. "time"
  15. // "fmt"
  16. "dashoo.cn/backend/api/business/oilsupplier/selectbusiness"
  17. "dashoo.cn/backend/api/business/oilsupplier/supplier"
  18. . "dashoo.cn/backend/api/controllers"
  19. "dashoo.cn/utils"
  20. )
  21. type SelectController struct {
  22. BaseController
  23. }
  24. type UpSearch struct {
  25. FullName string
  26. }
  27. type UpInfoSearch struct {
  28. FullName string
  29. SupplierTypeName string
  30. HeGe int
  31. BuHeGe int
  32. ZongShu int
  33. Reason string
  34. }
  35. type Processinfo struct {
  36. Id int
  37. AccessCardNo string
  38. WorkflowId string
  39. ProcessKey string
  40. SupplierName string
  41. SupplierTypeCode string
  42. Status string
  43. Type string
  44. CreateOn time.Time
  45. AddinTime time.Time
  46. RecUnitName string
  47. ContactName string
  48. Mobile string
  49. }
  50. // @Title 获取所有
  51. // @Description
  52. // @Success 200 {object}
  53. // @router /getcompanylist [post]
  54. func (this *SelectController) GetTList() {
  55. var model supplier.OilSupplierSelect
  56. var model1 supplier.RegCapitalRange //注册资金范围
  57. //var model2 supplier.NeedFileTypeStruct //资质结构体
  58. var jsonBlob = this.Ctx.Input.RequestBody
  59. json.Unmarshal(jsonBlob, &model)
  60. json.Unmarshal(jsonBlob, &model1)
  61. //json.Unmarshal(jsonBlob, &model2)
  62. // //获取分页信息
  63. page := this.GetPageInfoForm()
  64. where := " 1=1 "
  65. orderby := "a.Id"
  66. asc := true
  67. Order := this.GetString("Order")
  68. Prop := this.GetString("Prop")
  69. if Order != "" && Prop != "" {
  70. orderby = Prop
  71. if Order == "desc" {
  72. asc = false
  73. }
  74. }
  75. //准入证号
  76. if model.AccessCardNo != "" {
  77. where = where + " and b.AccessCardNo like '%" + model.AccessCardNo + "%'"
  78. }
  79. //企业名称
  80. if model.SupplierName != "" {
  81. where = where + " and a.SupplierName like '%" + model.SupplierName + "%'"
  82. }
  83. if model.OldSupplierName != "" {
  84. where = where + " and OldSupplierName like '%" + model.OldSupplierName + "%'"
  85. }
  86. //准入类别(基建,物资,技术服务)
  87. if model.SupplierTypeCode != "" {
  88. where = where + " and b.SupplierTypeCode = '" + model.SupplierTypeCode + "'"
  89. }
  90. //准入标识 1 准入 2 暂停 3取消
  91. if model.InFlag != "" {
  92. where = where + " and b.InFlag = '" + model.InFlag + "'"
  93. }
  94. //法人
  95. if model.LegalPerson != "" {
  96. where = where + " and a.LegalPerson like '%" + model.LegalPerson + "%'"
  97. }
  98. //联系人
  99. if model.ContactName != "" {
  100. where = where + " and a.ContactName like '%" + model.ContactName + "%'"
  101. }
  102. //统一社会信用代码
  103. if model.CommercialNo != "" {
  104. where = where + " and a.CommercialNo like '%" + model.CommercialNo + "%'"
  105. }
  106. //开户银行
  107. if model.DepositBank != "" {
  108. where = where + " and a.DepositBank like '%" + model.DepositBank + "%'"
  109. }
  110. //HSE审查
  111. if model.HseTraining != "" {
  112. where = where + " and a.HseTraining = '" + model.HseTraining + "'"
  113. }
  114. //公司类型
  115. if model.CompanyType != "" {
  116. where = where + " and a.CompanyType like '%" + model.CompanyType + "%'"
  117. }
  118. //成立时间
  119. SetupTime := this.GetString("SetupTime")
  120. if SetupTime != "" {
  121. where = where + " and a.SetupTime ='" + SetupTime + "'"
  122. }
  123. //注册资金范围
  124. if model1.RegCapital1 != "" {
  125. where = where + " and a.RegCapital >= '" + model1.RegCapital1 + "'"
  126. }
  127. if model1.RegCapital2 != "" {
  128. where = where + " and a.RegCapital <= '" + model1.RegCapital2 + "'"
  129. }
  130. //注册省份
  131. if model.Province != "" {
  132. where = where + " and a.Province = '" + model.Province + "'"
  133. }
  134. //注册市
  135. if model.City != "" {
  136. where = where + " and a.City = '" + model.City + "'"
  137. }
  138. //注册区
  139. if model.Street != "" {
  140. where = where + " and a.Street = '" + model.Street + "'"
  141. }
  142. //注册详细地址
  143. if model.Address != "" {
  144. where = where + " and a.Address like '%" + model.Address + "%'"
  145. }
  146. if model.LinkProvince != "" {
  147. where = where + " and a.LinkProvince = '" + model.LinkProvince + "'"
  148. }
  149. if model.LinkCity != "" {
  150. where = where + " and a.LinkCity = '" + model.LinkCity + "'"
  151. }
  152. if model.LinkStreet != "" {
  153. where = where + " and a.LinkStreet = '" + model.LinkStreet + "'"
  154. }
  155. if model.LinkAddress != "" {
  156. where = where + " and a.LinkAddress like '%" + model.LinkAddress + "%'"
  157. }
  158. //营业范围
  159. if model.BusinessScope != "" {
  160. where = where + " and a.BusinessScope like '%" + model.BusinessScope + "%'"
  161. }
  162. a := model.InStyle
  163. fmt.Println(a)
  164. //准入方式
  165. if model.InStyle != "" {
  166. if model.InStyle == "0"{
  167. where = where + " and b.InStyle in ('2','3','4','5')"
  168. }else{
  169. where = where + " and b.InStyle ='" + model.InStyle + "'"
  170. }
  171. }
  172. //包含资质
  173. //if model2.NeedFileType != nil && len(model2.NeedFileType) > 0 {
  174. // pararm := ""
  175. // for i := 0; i < len(model2.NeedFileType); i++ {
  176. //
  177. // pararm = pararm + "'" + model2.NeedFileType[i] + "',"
  178. //
  179. // }
  180. // fmt.Println(pararm[0 : len(pararm)-1])
  181. // where = where + " and d.NeedFileType in (" + pararm[0:len(pararm)-1] + ")"
  182. //}
  183. having:=""
  184. //准入范围
  185. if model.CerSubName!="" {
  186. having = " having CerSubName like '%"+model.CerSubName+"%' "
  187. }
  188. //资质
  189. if model.NeedFileType!="" {
  190. having = " having NeedFileType like '%"+model.NeedFileType+"%' "
  191. }
  192. if model.CerSubName!=""&& model.NeedFileType!=""{
  193. having = " having CerSubName like '%"+model.CerSubName+"%' and NeedFileType like '%"+model.NeedFileType+"%' "
  194. }
  195. svc := selectbusiness.GetSelectService(utils.DBE)
  196. var list []supplier.OilSupplierSelect
  197. total := svc.GetMyPagingEntitiesWithOrderBytbl(OilSupplierName, OilSupplierCertName, OilInfoChangeName,OilSupplierCertSubName,OilSupplierFileName, page.CurrentPage, page.Size, orderby, asc, &list, where,having)
  198. var datainfo DataInfo
  199. datainfo.Items = list
  200. datainfo.CurrentItemCount = total
  201. datainfo.PageIndex = page.CurrentPage
  202. datainfo.ItemsPerPage = page.Size
  203. this.Data["json"] = &datainfo
  204. this.ServeJSON()
  205. }
  206. // @Title 获取所有
  207. // @Description
  208. // @Success 200 {object}
  209. // @router /up [post]
  210. func (this *SelectController) Up() {
  211. var model UpSearch
  212. var jsonBlob = this.Ctx.Input.RequestBody
  213. json.Unmarshal(jsonBlob, &model)
  214. // //获取分页信息
  215. page := this.GetPageInfoForm()
  216. where := ""
  217. asc := false
  218. Order := this.GetString("Order")
  219. Prop := this.GetString("Prop")
  220. if Order != "" && Prop != "" {
  221. if Order == "asc" {
  222. asc = true
  223. }
  224. }
  225. if model.FullName != "" {
  226. where = where + " and (select FullName from Base_Organize where Id = a.CommitComId) like '%" + model.FullName + "%'"
  227. }
  228. svc := selectbusiness.GetSelectService(utils.DBE)
  229. var list []UpInfoSearch
  230. total := svc.GetUp( OilSupplierCertName , page.CurrentPage, page.Size, Prop, asc, &list, where)
  231. var datainfo DataInfo
  232. datainfo.Items = list
  233. datainfo.CurrentItemCount = total
  234. datainfo.PageIndex = page.CurrentPage
  235. datainfo.ItemsPerPage = page.Size
  236. this.Data["json"] = &datainfo
  237. this.ServeJSON()
  238. }
  239. // @Title 获取所有资质名称
  240. // @Description
  241. // @Success 200 {object}
  242. // @router /getnftoptions [post]
  243. func (this *SelectController) GetNFTOptions() {
  244. svc := selectbusiness.GetSelectService(utils.DBE)
  245. var list []map[string]string
  246. sql := "select distinct(Name) from " + BaseTableHeader + ""
  247. list, _ = svc.DBE.QueryString(sql)
  248. var datainfo DataInfo
  249. datainfo.Items = list
  250. this.Data["json"] = &datainfo
  251. this.ServeJSON()
  252. }
  253. // @Title 流程查询准入
  254. // @Description
  255. // @Success 200 {object}
  256. // @router /getprocessauditlist [get]
  257. func (this *SelectController) GetProcessAuditList() {
  258. //获取分页信息
  259. page := this.GetPageInfoForm()
  260. where := " 1=1 "
  261. orderby := "Id"
  262. asc := false
  263. Order := this.GetString("Order")
  264. Prop := this.GetString("Prop")
  265. if Order != "" && Prop != "" {
  266. orderby = Prop
  267. if Order == "asc" {
  268. asc = true
  269. }
  270. }
  271. svc := supplier.GetOilSupplierService(utils.DBE)
  272. tabinx := this.GetString("tabinx")
  273. supplierTypeCode := this.GetString("SupplierTypeCode")
  274. supplierName := this.GetString("SupplierName")
  275. //企业用户必须加创建人条件
  276. var registerUser register.OilCorporateInfo
  277. sql := " UserName='" + this.User.Username + "'"
  278. svc.GetEntity(&registerUser,sql)
  279. var processinfolist []Processinfo
  280. if this.User.IsCompanyUser == 1 {
  281. where = where + " and (b.CreateUserId = '" + this.User.Id + "' or a.CommercialNo='"+registerUser.CommercialNo+"')"
  282. }
  283. if supplierTypeCode != "" {
  284. where = where + " and b.SupplierTypeCode like '%" + supplierTypeCode + "%'"
  285. }
  286. if supplierName != "" {
  287. where = where + " and a.SupplierName like '%" + supplierName + "%'"
  288. }
  289. var total int64 = 0
  290. var datainfo DataInfo
  291. if tabinx == "1" || tabinx == "0" {
  292. var list []Processinfo //[]supplier.OilSupplierView
  293. total = total + svc.GetProcessInfoWithOrderBytbl(OilSupplierName, OilSupplierCertName, page.CurrentPage, page.Size, "b.Id", asc, &list, where)
  294. processinfolist = append(processinfolist, list...)
  295. //datainfo.Items = processinfolist
  296. }
  297. if tabinx == "2" || tabinx == "0" {
  298. whereapp := "1=1"
  299. //企业用户必须加创建人条件
  300. if this.User.IsCompanyUser == 1 {
  301. whereapp = whereapp + " and a.CreateUserId = '" + this.User.Id + "'"
  302. }
  303. if supplierTypeCode != "" {
  304. whereapp = whereapp + " and a.AppendType like '%" + supplierTypeCode + "%'"
  305. }
  306. if supplierName != "" {
  307. whereapp = whereapp + " and a.SupplierName like '%" + supplierName + "%'"
  308. }
  309. var list []Processinfo//[]suppliercertappend.OilSupplierCertAppend
  310. svc := suppliercertappend.GetOilSupplierCertAppendService(utils.DBE)
  311. total = total + svc.GetProcessInfoWithOrderBytbl(OilSupplierCertAppendName, page.CurrentPage, page.Size, "a.Id", asc, &list, whereapp)
  312. processinfolist = append(processinfolist, list...)
  313. //datainfo.Items = processinfolist
  314. }
  315. if tabinx == "3" || tabinx == "0" {
  316. whereapp := "1=1"
  317. //企业用户必须加创建人条件
  318. if this.User.IsCompanyUser == 1 {
  319. whereapp = whereapp + " and CreateUserId = '" + this.User.Id + "'"
  320. }
  321. if supplierTypeCode != "" {
  322. whereapp = whereapp + " and SupplierTypeName like '%" + supplierTypeCode + "%'"
  323. }
  324. if supplierName != "" {
  325. whereapp = whereapp + " and SupplierName like '%" + supplierName + "%'"
  326. }
  327. var list []Processinfo//[]annualaudit.OilAnnualAudit
  328. svc := annualaudit.GetOilAnnualAuditService(utils.DBE)
  329. total = total + svc.GetProcessInfoWithOrderBytbl(OilAnnualAuditName, page.CurrentPage, page.Size, orderby, asc, &list, whereapp)
  330. processinfolist = append(processinfolist, list...)
  331. //datainfo.Items = processinfolist
  332. }
  333. if tabinx == "4" || tabinx == "0" {
  334. whereapp := "1=1"
  335. //企业用户必须加创建人条件
  336. if this.User.IsCompanyUser == 1 {
  337. whereapp = whereapp + " and CreateUserId = '" + this.User.Id + "'"
  338. }
  339. if supplierName != "" {
  340. whereapp = whereapp + " and SupplierName like '%" + supplierName + "%'"
  341. }
  342. var list []Processinfo//[]infochange.OilInfoChange
  343. svc := infochange.GetInfoChangeService(utils.DBE)
  344. total = total + svc.GetProcessInfoWithOrderBytbl(OilInfoChangeName, page.CurrentPage, page.Size, orderby, asc, &list, whereapp)
  345. processinfolist = append(processinfolist, list...)
  346. //datainfo.Items = processinfolist
  347. }
  348. if tabinx == "5" {
  349. whereapp := "1=1"
  350. //企业用户必须加创建人条件
  351. if this.User.IsCompanyUser == 1 {
  352. whereapp = whereapp + " and CreateUserId = '" + this.User.Id + "'"
  353. }
  354. if supplierName != "" {
  355. whereapp = whereapp + " and SupplierName like '%" + supplierName + "%'"
  356. }
  357. svc := qualchange.GetQualChangeService(utils.DBE)
  358. var list []qualchange.OilQualChangeMain
  359. total = svc.GetPagingEntitiesWithOrderBytbl("", page.CurrentPage, page.Size, orderby, asc, &list, whereapp)
  360. datainfo.Items = list
  361. }
  362. sort.Slice(processinfolist, func(i, j int) bool {
  363. return processinfolist[i].CreateOn.Unix() > processinfolist[j].CreateOn.Unix()
  364. })
  365. datainfo.Items = processinfolist
  366. datainfo.CurrentItemCount = total
  367. datainfo.PageIndex = page.CurrentPage
  368. datainfo.ItemsPerPage = page.Size
  369. this.Data["json"] = &datainfo
  370. this.ServeJSON()
  371. }
  372. // @Title 准入范围查询
  373. // @Description
  374. // @Success 200 {object}
  375. // @router /zrfwselect [get]
  376. func (this *SelectController) ZrfwSelect() {
  377. //获取分页信息
  378. page := this.GetPageInfoForm()
  379. limitCurrent:=(page.CurrentPage-1)*page.Size
  380. svc := selectbusiness.GetSelectService(utils.DBE)
  381. supplierTypeCode := this.GetString("SupplierTypeCode")
  382. certsub := this.GetString("certsub")
  383. //企业用户必须加创建人条件
  384. var registerUser register.OilCorporateInfo
  385. var company supplier.OilSupplier
  386. sql := " UserName='" + this.User.Username + "'"
  387. svc.GetEntity(&registerUser,sql)
  388. if this.User.IsCompanyUser == 1 {
  389. sql1:= " CreateUserId = '" + this.User.Id + "' or CommercialNo='"+registerUser.CommercialNo+"'"
  390. svc.GetEntity(&company,sql1)
  391. }
  392. where := ""
  393. if certsub != "" {
  394. where = " and (Code like '%" + certsub + "%' or Name like '%" + certsub + "%')"
  395. }
  396. if company.SupplierName!=""{
  397. sql2:="select distinct(Code),Name,SupplierId,CertSubStatus from OilSupplierCertSub where SupplierId='"+strconv.Itoa(company.Id)+"' and SupplierTypeCode='"+supplierTypeCode+"' " + where + " order by CertSubStatus desc,Code asc limit "+strconv.FormatInt(limitCurrent,10)+","+strconv.FormatInt(page.Size,10)+""
  398. result,_:=svc.DBE.QueryString(sql2)
  399. sql3:="select count(distinct(Code)) total from OilSupplierCertSub where SupplierId='"+strconv.Itoa(company.Id)+"' and SupplierTypeCode='"+supplierTypeCode+"'" + where
  400. result1,_:=svc.DBE.QueryString(sql3)
  401. total,_:= strconv.ParseInt(result1[0]["total"], 10, 64)
  402. var datainfo DataInfo
  403. datainfo.Items = result
  404. datainfo.CurrentItemCount = total
  405. datainfo.PageIndex = page.CurrentPage
  406. datainfo.ItemsPerPage = page.Size
  407. this.Data["json"] = &datainfo
  408. this.ServeJSON()
  409. }else{
  410. var datainfo DataInfo
  411. datainfo.Items = ""
  412. datainfo.PageIndex = page.CurrentPage
  413. datainfo.ItemsPerPage = page.Size
  414. this.Data["json"] = &datainfo
  415. this.ServeJSON()
  416. }
  417. }
  418. // @Title 获取所有
  419. // @Description
  420. // @Success 200 {object}
  421. // @router /getallbusinesslist [post]
  422. func (this *SelectController) GetAllBusinesList() {
  423. perject := this.GetString("Perject")
  424. accessCardNo := this.GetString("AccessCardNo")
  425. supplierTypeCode := this.GetString("SupplierTypeCode")
  426. supplierName := this.GetString("SupplierName")
  427. var list []selectbusiness.SelectBusiness
  428. // 准入
  429. if perject == "1" || perject == "" {
  430. where := "1=1 "
  431. if accessCardNo != "" {
  432. where = where + " and b.AccessCardNo='" + accessCardNo + "'"
  433. }
  434. if supplierTypeCode != "" {
  435. where = where + " and b.SupplierTypeCode='" + supplierTypeCode + "'"
  436. }
  437. if supplierName != "" {
  438. where =where + " and a.SupplierName like '%" + supplierName + "%'"
  439. }
  440. var zrlist []supplier.OilSupplierView
  441. zrsvc := supplier.GetOilSupplierService(utils.DBE)
  442. if this.User.IsCompanyUser == 1 {
  443. var registerUser register.OilCorporateInfo
  444. sql := " UserName='" + this.User.Username + "'"
  445. zrsvc.GetEntity(&registerUser,sql)
  446. where = where + " and (b.CreateUserId = '" + this.User.Id + "' or a.CommercialNo='" + registerUser.CommercialNo + "')"
  447. }
  448. zrwhere := where + " and b.Status='" + suppliercert.STORE_STATUS + "'"
  449. zrsvc.GetMyPagingEntitiesWithOrderBytbl(OilSupplierName, OilSupplierCertName, 1, 100, "b.Id", false , &zrlist, zrwhere)
  450. for _, item := range zrlist {
  451. var sele selectbusiness.SelectBusiness
  452. sele.SupplierName = item.SupplierName
  453. sele.CreateOn = item.CreateOn
  454. sele.AccessCardNo = item.AccessCardNo
  455. sele.TypeCode = item.SupplierTypeCode
  456. sele.TypeName = item.SupplierTypeName
  457. sele.Preject = "1"
  458. list = append(list, sele)
  459. }
  460. }
  461. // 增项
  462. if perject == "2" || perject == "" {
  463. where := "1=1 "
  464. if accessCardNo != "" {
  465. where = where + " and b.AccessCardNo='" + accessCardNo + "'"
  466. }
  467. if supplierTypeCode != "" {
  468. where = where + " and b.AppendType='" + supplierTypeCode + "'"
  469. }
  470. if supplierName != "" {
  471. where =where + " and a.SupplierName like '%" + supplierName + "%'"
  472. }
  473. var zxlist []suppliercertappend.OilSupplierCertAppend
  474. zxsvc := suppliercertappend.GetOilSupplierCertAppendService(utils.DBE)
  475. if this.User.IsCompanyUser == 1 {
  476. var registerUser register.OilCorporateInfo
  477. sql := " UserName='" + this.User.Username + "'"
  478. zxsvc.GetEntity(&registerUser,sql)
  479. where = where + " and (b.CreateUserId = '" + this.User.Id + "' or a.CommercialNo='" + registerUser.CommercialNo + "')"
  480. }
  481. zxwhere := where + " and b.Status='" + suppliercert.STORE_STATUS + "'"
  482. zxsvc.GetMyPagingEntitiesWithOrderBytbl(OilSupplierName, OilSupplierCertAppendName, 1, 100, "b.Id", false, &zxlist, zxwhere)
  483. for _, item := range zxlist {
  484. var sele selectbusiness.SelectBusiness
  485. sele.SupplierName = item.SupplierName
  486. sele.CreateOn = item.CreateOn
  487. sele.AccessCardNo = item.AccessCardNo
  488. sele.TypeCode = item.AppendType
  489. sele.TypeName = ""
  490. sele.Preject = "2"
  491. list = append(list, sele)
  492. }
  493. }
  494. // 年审
  495. if perject == "3" || perject == "" {
  496. where := "1=1 "
  497. if accessCardNo != "" {
  498. where = where + " and b.AccessCardNo='" + accessCardNo + "'"
  499. }
  500. if supplierTypeCode != "" {
  501. where = where + " and b.SupplierTypeName='" + supplierTypeCode + "'"
  502. }
  503. if supplierName != "" {
  504. where =where + " and a.SupplierName like '%" + supplierName + "%'"
  505. }
  506. var nslist []annualaudit.OilAnnualAudit
  507. nssvc := annualaudit.GetOilAnnualAuditService(utils.DBE)
  508. if this.User.IsCompanyUser == 1 {
  509. var registerUser register.OilCorporateInfo
  510. sql := " UserName='" + this.User.Username + "'"
  511. nssvc.GetEntity(&registerUser,sql)
  512. where = where + " and (b.CreateUserId = '" + this.User.Id + "' or a.CommercialNo='" + registerUser.CommercialNo + "')"
  513. }
  514. zswhere := where + " and b.Status='" + suppliercert.DRAFT_STATUS + "'"
  515. nssvc.GetMyPagingEntitiesWithOrderBytbl(OilSupplierName, OilAnnualAuditName,1, 100, "b.Id", false, &nslist, zswhere)
  516. for _, item := range nslist {
  517. var sele selectbusiness.SelectBusiness
  518. sele.SupplierName = item.SupplierName
  519. sele.CreateOn = item.CreateOn
  520. sele.AccessCardNo = item.AccessCardNo
  521. sele.TypeCode = item.SupplierTypeName
  522. sele.TypeName = ""
  523. sele.Preject = "3"
  524. list = append(list, sele)
  525. }
  526. }
  527. // 变更申请
  528. if perject == "4" || perject == "" {
  529. where := "1=1 "
  530. if accessCardNo != "" {
  531. where = where + " and b.AccessCardNo='" + accessCardNo + "'"
  532. }
  533. if supplierTypeCode != "" {
  534. where = where + " and b.SupplierTypeCode='" + supplierTypeCode + "'"
  535. }
  536. if supplierName != "" {
  537. where =where + " and a.SupplierName like '%" + supplierName + "%'"
  538. }
  539. var bglist []infochange.SuppModelInfo
  540. bgsvc := infochange.GetInfoChangeService(utils.DBE)
  541. if this.User.IsCompanyUser == 1 {
  542. var registerUser register.OilCorporateInfo
  543. sql := " UserName='" + this.User.Username + "'"
  544. bgsvc.GetEntity(&registerUser,sql)
  545. where = where + " and (b.CreateUserId = '" + this.User.Id + "' or a.CommercialNo='" + registerUser.CommercialNo + "')"
  546. }
  547. bgwhere := where + " and b.Status='" + suppliercert.DRAFT_STATUS + "'"
  548. bgsvc.GetSuppPagingEntitiesWithOrderBytbl(OilSupplierName, OilInfoChangeName, 1, 100, "b.Id", false, &bglist, bgwhere)
  549. for _, item := range bglist {
  550. var sele selectbusiness.SelectBusiness
  551. sele.SupplierName = item.SupplierName
  552. sele.CreateOn = item.CreateOn
  553. sele.AccessCardNo = ""
  554. sele.TypeCode = item.SupplierTypeCode
  555. sele.TypeName = item.SupplierTypeName
  556. sele.Preject = "4"
  557. list = append(list, sele)
  558. }
  559. }
  560. var datainfo DataInfo
  561. datainfo.Items = list
  562. this.Data["json"] = &datainfo
  563. this.ServeJSON()
  564. }
  565. // @Title 文件上传
  566. // @Description get user by tokenaddsubfile
  567. // @Success 200 {object} models.Userblood
  568. // @router /filelist [get]
  569. func (this *SelectController) FileList() {
  570. page := this.GetPageInfoForm()
  571. var list []supplierfile.OilSupplierFile
  572. svc := supplierfile.GetSupplierfileService(utils.DBE)
  573. where := " 1=1"
  574. orderby := "Id"
  575. asc := true
  576. Order := this.GetString("Order")
  577. Prop := this.GetString("Prop")
  578. subfilename := this.GetString("subfileName")
  579. supplierId := this.GetString("SupplierId")
  580. if Order != "" && Prop != "" {
  581. orderby = Prop
  582. if Order == "asc" {
  583. asc = true
  584. }
  585. }
  586. //企业用户必须加创建人条件
  587. var registerUser register.OilCorporateInfo
  588. var company supplier.OilSupplier
  589. sql := " UserName='" + this.User.Username + "'"
  590. svc.GetEntity(&registerUser,sql)
  591. sql1:= " CreateUserId = '" + this.User.Id + "' or CommercialNo='"+registerUser.CommercialNo+"'"
  592. svc.GetEntity(&company,sql1)
  593. if supplierId != "0" {
  594. where = where + " and SupplierId=" + supplierId
  595. } else {
  596. where = where + " and SupplierId=" + strconv.Itoa(company.Id)
  597. }
  598. if subfilename != "" {
  599. where = where + " and NeedFileType like '%" + subfilename + "%'"
  600. }
  601. total := svc.GetPagingEntitiesWithoutAccCode(page.CurrentPage, page.Size, orderby, asc, &list, where)
  602. var datainfo DataInfo
  603. datainfo.Items = list
  604. datainfo.CurrentItemCount = total
  605. this.Data["json"] = &datainfo
  606. this.ServeJSON()
  607. }