select.go 21 KB

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