suppliercert.go 67 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100
  1. package oilsupplier
  2. import (
  3. "dashoo.cn/backend/api/business/audithistory"
  4. "dashoo.cn/backend/api/business/codecsequence"
  5. msg2 "dashoo.cn/backend/api/business/msg"
  6. "dashoo.cn/backend/api/business/oilsupplier/annualaudit"
  7. "dashoo.cn/backend/api/business/oilsupplier/infochange"
  8. "dashoo.cn/backend/api/business/oilsupplier/oilactivity"
  9. "dashoo.cn/backend/api/business/oilsupplier/oilcostmanage"
  10. "dashoo.cn/backend/api/business/oilsupplier/supplier"
  11. "dashoo.cn/backend/api/business/oilsupplier/supplierapplytime"
  12. "dashoo.cn/backend/api/business/oilsupplier/suppliercertappend"
  13. "dashoo.cn/backend/api/business/oilsupplier/suppliercertsub"
  14. "dashoo.cn/backend/api/business/oilsupplier/supplierfile"
  15. "dashoo.cn/backend/api/business/organize"
  16. "dashoo.cn/backend/api/business/paymentinfo"
  17. "dashoo.cn/business2/parameter"
  18. "encoding/json"
  19. "fmt"
  20. "strconv"
  21. "strings"
  22. "time"
  23. "dashoo.cn/backend/api/business/auditsetting"
  24. "dashoo.cn/backend/api/business/workflow"
  25. "dashoo.cn/backend/api/business/baseUser"
  26. "dashoo.cn/backend/api/business/oilsupplier/suppliercert"
  27. . "dashoo.cn/backend/api/controllers"
  28. "dashoo.cn/business2/userRole"
  29. "dashoo.cn/utils"
  30. )
  31. type OilSupplierCertController struct {
  32. BaseController
  33. }
  34. // @Title 获取列表
  35. // @Description get user by token
  36. // @Success 200 {object} []suppliercert.OilSupplierCert
  37. // @router /list [get]
  38. func (this *OilSupplierCertController) GetEntityList() {
  39. //获取分页信息
  40. page := this.GetPageInfoForm()
  41. where := " 1=1 "
  42. orderby := "Id"
  43. asc := false
  44. Order := this.GetString("Order")
  45. Prop := this.GetString("Prop")
  46. if Order != "" && Prop != "" {
  47. orderby = Prop
  48. if Order == "asc" {
  49. asc = true
  50. }
  51. }
  52. Id := this.GetString("Id")
  53. SupplierId := this.GetString("SupplierId")
  54. AccessCardNo := this.GetString("AccessCardNo")
  55. SupplierTypeCode := this.GetString("SupplierTypeCode")
  56. SupplierTypeName := this.GetString("SupplierTypeName")
  57. RecUnitReason := this.GetString("RecUnitReason")
  58. RecUnitPerson := this.GetString("RecUnitPerson")
  59. RecDate := this.GetString("RecDate")
  60. RecUnitId := this.GetString("RecUnitId")
  61. RecUnitName := this.GetString("RecUnitName")
  62. StatusA := this.GetString("StatusA")
  63. BackReason := this.GetString("BackReason")
  64. InFlag := this.GetString("InFlag")
  65. EffectStartTime := this.GetString("EffectStartTime")
  66. EffectEndTime := this.GetString("EffectEndTime")
  67. AuditProcessNote := this.GetString("AuditProcessNote")
  68. AuditDate := this.GetString("AuditDate")
  69. PayNotice := this.GetString("PayNotice")
  70. SupplierStatus := this.GetString("SupplierStatus")
  71. MgrType := this.GetString("MgrType")
  72. Type := this.GetString("Type")
  73. MgrUnit := this.GetString("MgrUnit")
  74. AddinTime := this.GetString("AddinTime")
  75. EffectTime := this.GetString("EffectTime")
  76. ApplyTime := this.GetString("ApplyTime")
  77. SupplierNo := this.GetString("SupplierNo")
  78. MDMFlag := this.GetString("MDMFlag")
  79. InternalFlag := this.GetString("InternalFlag")
  80. ImportFlag := this.GetString("ImportFlag")
  81. OutsideFlog := this.GetString("OutsideFlog")
  82. Remark := this.GetString("Remark")
  83. IsDelete := this.GetString("IsDelete")
  84. CreateOn := this.GetString("CreateOn")
  85. CreateUserId := this.GetString("CreateUserId")
  86. CreateBy := this.GetString("CreateBy")
  87. ModifiedOn := this.GetString("ModifiedOn")
  88. ModifiedUserId := this.GetString("ModifiedUserId")
  89. ModifiedBy := this.GetString("ModifiedBy")
  90. if Id != "" {
  91. where = where + " and Id like '%" + Id + "%'"
  92. }
  93. if SupplierId != "" {
  94. where = where + " and SupplierId like '%" + SupplierId + "%'"
  95. }
  96. if AccessCardNo != "" {
  97. where = where + " and AccessCardNo like '%" + AccessCardNo + "%'"
  98. }
  99. if SupplierTypeCode != "" {
  100. where = where + " and SupplierTypeCode like '%" + SupplierTypeCode + "%'"
  101. }
  102. if SupplierTypeName != "" {
  103. where = where + " and SupplierTypeName like '%" + SupplierTypeName + "%'"
  104. }
  105. if RecUnitReason != "" {
  106. where = where + " and RecUnitReason like '%" + RecUnitReason + "%'"
  107. }
  108. if RecUnitPerson != "" {
  109. where = where + " and RecUnitPerson like '%" + RecUnitPerson + "%'"
  110. }
  111. if RecDate != "" {
  112. where = where + " and RecDate like '%" + RecDate + "%'"
  113. }
  114. if RecUnitId != "" {
  115. where = where + " and RecUnitId like '%" + RecUnitId + "%'"
  116. }
  117. if RecUnitName != "" {
  118. where = where + " and RecUnitName like '%" + RecUnitName + "%'"
  119. }
  120. if StatusA != "" {
  121. where = where + " and StatusA like '%" + StatusA + "%'"
  122. }
  123. if BackReason != "" {
  124. where = where + " and BackReason like '%" + BackReason + "%'"
  125. }
  126. if InFlag != "" {
  127. where = where + " and InFlag like '%" + InFlag + "%'"
  128. }
  129. if EffectStartTime != "" {
  130. where = where + " and EffectStartTime like '%" + EffectStartTime + "%'"
  131. }
  132. if EffectEndTime != "" {
  133. where = where + " and EffectEndTime like '%" + EffectEndTime + "%'"
  134. }
  135. if AuditProcessNote != "" {
  136. where = where + " and AuditProcessNote like '%" + AuditProcessNote + "%'"
  137. }
  138. if AuditDate != "" {
  139. where = where + " and AuditDate like '%" + AuditDate + "%'"
  140. }
  141. if PayNotice != "" {
  142. where = where + " and PayNotice like '%" + PayNotice + "%'"
  143. }
  144. if SupplierStatus != "" {
  145. where = where + " and SupplierStatus like '%" + SupplierStatus + "%'"
  146. }
  147. if MgrType != "" {
  148. where = where + " and MgrType like '%" + MgrType + "%'"
  149. }
  150. if Type != "" {
  151. where = where + " and Type like '%" + Type + "%'"
  152. }
  153. if MgrUnit != "" {
  154. where = where + " and MgrUnit like '%" + MgrUnit + "%'"
  155. }
  156. if AddinTime != "" {
  157. where = where + " and AddinTime like '%" + AddinTime + "%'"
  158. }
  159. if EffectTime != "" {
  160. where = where + " and EffectTime like '%" + EffectTime + "%'"
  161. }
  162. if ApplyTime != "" {
  163. where = where + " and ApplyTime like '%" + ApplyTime + "%'"
  164. }
  165. if SupplierNo != "" {
  166. where = where + " and SupplierNo like '%" + SupplierNo + "%'"
  167. }
  168. if MDMFlag != "" {
  169. where = where + " and MDMFlag like '%" + MDMFlag + "%'"
  170. }
  171. if InternalFlag != "" {
  172. where = where + " and InternalFlag like '%" + InternalFlag + "%'"
  173. }
  174. if ImportFlag != "" {
  175. where = where + " and ImportFlag like '%" + ImportFlag + "%'"
  176. }
  177. if OutsideFlog != "" {
  178. where = where + " and OutsideFlog like '%" + OutsideFlog + "%'"
  179. }
  180. if Remark != "" {
  181. where = where + " and Remark like '%" + Remark + "%'"
  182. }
  183. if IsDelete != "" {
  184. where = where + " and IsDelete like '%" + IsDelete + "%'"
  185. }
  186. if CreateOn != "" {
  187. where = where + " and CreateOn like '%" + CreateOn + "%'"
  188. }
  189. if CreateUserId != "" {
  190. where = where + " and CreateUserId like '%" + CreateUserId + "%'"
  191. }
  192. if CreateBy != "" {
  193. where = where + " and CreateBy like '%" + CreateBy + "%'"
  194. }
  195. if ModifiedOn != "" {
  196. where = where + " and ModifiedOn like '%" + ModifiedOn + "%'"
  197. }
  198. if ModifiedUserId != "" {
  199. where = where + " and ModifiedUserId like '%" + ModifiedUserId + "%'"
  200. }
  201. if ModifiedBy != "" {
  202. where = where + " and ModifiedBy like '%" + ModifiedBy + "%'"
  203. }
  204. if CreateOn != "" {
  205. dates := strings.Split(CreateOn, ",")
  206. if len(dates) == 2 {
  207. minDate := dates[0]
  208. maxDate := dates[1]
  209. where = where + " and CreateOn>='" + minDate + "' and CreateOn<='" + maxDate + "'"
  210. }
  211. }
  212. svc := suppliercert.GetOilSupplierCertService(utils.DBE)
  213. var list []suppliercert.OilSupplierCert
  214. total := svc.GetPagingEntitiesWithOrderBytbl(this.User.AccCode, page.CurrentPage, page.Size, orderby, asc, &list, where)
  215. var datainfo DataInfo
  216. datainfo.Items = list
  217. datainfo.CurrentItemCount = total
  218. datainfo.PageIndex = page.CurrentPage
  219. datainfo.ItemsPerPage = page.Size
  220. this.Data["json"] = &datainfo
  221. this.ServeJSON()
  222. }
  223. // @Title 获取字典列表
  224. // @Description get user by token
  225. // @Success 200 {object} map[string]interface{}
  226. // @router /dictlist [get]
  227. func (this *OilSupplierCertController) GetDictList() {
  228. dictList := make(map[string]interface{})
  229. //dictSvc := items.GetItemsService(utils.DBE)
  230. userSvc := baseUser.GetBaseUserService(utils.DBE)
  231. //customerSvc := svccustomer.GetCustomerService(utils.DBE)
  232. //dictList["WellNo"] = dictSvc.GetKeyValueItems("WellNo", this.User.AccCode)
  233. var userEntity userRole.Base_User
  234. userSvc.GetEntityById(this.User.Id, &userEntity)
  235. dictList["Supervisers"] = userSvc.GetUserListByDepartmentId(this.User.AccCode, userEntity.Departmentid)
  236. //var dictCustomer []svccustomer.Customer
  237. //customerSvc.GetEntitysByWhere(this.User.AccCode + CustomerName, "", &dictCustomer)
  238. //dictList["EntrustCorp"] = &dictCustomer
  239. var datainfo DataInfo
  240. datainfo.Items = dictList
  241. this.Data["json"] = &datainfo
  242. this.ServeJSON()
  243. }
  244. // @Title 获取实体
  245. // @Description 获取实体
  246. // @Success 200 {object} suppliercert.OilSupplierCert
  247. // @router /get/:id [get]
  248. func (this *OilSupplierCertController) GetEntity() {
  249. Id := this.Ctx.Input.Param(":id")
  250. var model suppliercert.OilSupplierCert
  251. svc := suppliercert.GetOilSupplierCertService(utils.DBE)
  252. svc.GetEntityByIdBytbl(OilSupplierCertName, Id, &model)
  253. this.Data["json"] = &model
  254. this.ServeJSON()
  255. }
  256. // @Title 获取实体
  257. // @Description 获取实体
  258. // @Success 200 {object} suppliercert.OilSupplierCert
  259. // @router /getbycreatorandtype/:typecode [get]
  260. func (this *OilSupplierCertController) GetEntityByCreatorId() {
  261. creatorId := this.User.Id
  262. typeCode := this.Ctx.Input.Param(":typecode")
  263. var model suppliercert.OilSupplierCert
  264. svc := suppliercert.GetOilSupplierCertService(utils.DBE)
  265. where := " CreateUserId = '" + creatorId + "'"
  266. where += " and SupplierTypeCode = '" + typeCode + "'"
  267. svc.GetEntityByWhere(OilSupplierCertName, where, &model)
  268. this.Data["json"] = &model
  269. this.ServeJSON()
  270. }
  271. // @Title 添加
  272. // @Description 新增
  273. // @Success 200 {object} controllers.Request
  274. // @router /add [post]
  275. func (this *OilSupplierCertController) AddEntity() {
  276. var model suppliercert.OilSupplierCert
  277. var jsonBlob = this.Ctx.Input.RequestBody
  278. svc := suppliercert.GetOilSupplierCertService(utils.DBE)
  279. json.Unmarshal(jsonBlob, &model)
  280. model.CreateOn = time.Now()
  281. model.CreateBy = this.User.Realname
  282. model.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
  283. //model.OrganizeId, _ = utils.StrTo(this.User.DepartmentId).Int()
  284. _, err := svc.InsertEntityBytbl(OilSupplierCertName, &model)
  285. var errinfo ErrorDataInfo
  286. if err == nil {
  287. //新增
  288. errinfo.Message = "添加成功!"
  289. errinfo.Code = 0
  290. errinfo.Item = model.Id
  291. this.Data["json"] = &errinfo
  292. this.ServeJSON()
  293. } else {
  294. errinfo.Message = "添加失败!" + utils.AlertProcess(err.Error())
  295. errinfo.Code = -1
  296. this.Data["json"] = &errinfo
  297. this.ServeJSON()
  298. }
  299. }
  300. // @Title 修改实体
  301. // @Description 修改实体
  302. // @Success 200 {object} controllers.Request
  303. // @router /update/:id [post]
  304. func (this *OilSupplierCertController) UpdateEntity() {
  305. id := this.Ctx.Input.Param(":id")
  306. var errinfo ErrorInfo
  307. if id == "" {
  308. errinfo.Message = "操作失败!请求信息不完整"
  309. errinfo.Code = -2
  310. this.Data["json"] = &errinfo
  311. this.ServeJSON()
  312. return
  313. }
  314. var model suppliercert.OilSupplierCert
  315. svc := suppliercert.GetOilSupplierCertService(utils.DBE)
  316. var jsonBlob = this.Ctx.Input.RequestBody
  317. json.Unmarshal(jsonBlob, &model)
  318. model.ModifiedOn = time.Now()
  319. model.ModifiedBy = this.User.Realname
  320. model.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
  321. cols := []string{
  322. "Id",
  323. "SupplierId",
  324. "AccessCardNo",
  325. "SupplierTypeCode",
  326. "SupplierTypeName",
  327. "RecUnitReason",
  328. "RecUnitPerson",
  329. "RecDate",
  330. "RecUnitId",
  331. "RecUnitName",
  332. "Status",
  333. "BackReason",
  334. "InFlag",
  335. "EffectStartTime",
  336. "EffectEndTime",
  337. "AuditProcessNote",
  338. "AuditDate",
  339. "PayNotice",
  340. "SupplierStatus",
  341. "MgrType",
  342. "Type",
  343. "MgrUnit",
  344. "AddinTime",
  345. "EffectTime",
  346. "ApplyTime",
  347. "SupplierNo",
  348. "MDMFlag",
  349. "InternalFlag",
  350. "ImportFlag",
  351. "OutsideFlog",
  352. "Remark",
  353. "IsDelete",
  354. "CreateOn",
  355. "CreateUserId",
  356. "CreateBy",
  357. "ModifiedOn",
  358. "ModifiedUserId",
  359. "ModifiedBy",
  360. }
  361. err := svc.UpdateEntityBytbl(OilSupplierCertName, id, &model, cols)
  362. if err == nil {
  363. errinfo.Message = "修改成功!"
  364. errinfo.Code = 0
  365. this.Data["json"] = &errinfo
  366. this.ServeJSON()
  367. } else {
  368. errinfo.Message = "修改失败!" + utils.AlertProcess(err.Error())
  369. errinfo.Code = -1
  370. this.Data["json"] = &errinfo
  371. this.ServeJSON()
  372. }
  373. }
  374. // @Title 企业入库
  375. // @Description 企业入库
  376. // @Success 200 {object} controllers.Request
  377. // @router /updatestorage/:id [post]
  378. func (this *OilSupplierCertController) UpdateStorage() {
  379. id := this.Ctx.Input.Param(":id")
  380. status := this.GetString("Status")
  381. var errinfo ErrorInfo
  382. if id == "" {
  383. errinfo.Message = "操作失败!请求信息不完整"
  384. errinfo.Code = -2
  385. this.Data["json"] = &errinfo
  386. this.ServeJSON()
  387. return
  388. }
  389. var model suppliercert.OilSupplierCert
  390. svc := suppliercert.GetOilSupplierCertService(utils.DBE)
  391. //var jsonBlob = this.Ctx.Input.RequestBody
  392. //json.Unmarshal(jsonBlob, &model)
  393. var err error
  394. if status == suppliercert.NO_CENT_AUDIT_STATUS {
  395. model.Status = suppliercert.DRAFT_STATUS
  396. cols := []string{
  397. "Status",
  398. }
  399. err = svc.UpdateEntityBytbl(OilSupplierCertName, id, &model, cols)
  400. } else {
  401. var activity oilactivity.OilActivity
  402. where := "EntityId=" + id + " and ActType='" + oilactivity.STORAGE + "'"
  403. svc.GetEntity(&activity, where)
  404. svcActiviti := workflow.GetActivitiService(utils.DBE)
  405. var ActiComplete workflow.ActiCompleteVM
  406. ActiComplete.ProcessKey = activity.ProcessKey
  407. ActiComplete.BusinessKey = activity.BusinessKey
  408. ActiComplete.UserId = this.User.Id
  409. ActiComplete.Remarks = ""
  410. ActiComplete.Result = "1"
  411. receiveVal := svcActiviti.TaskComplete(ActiComplete)
  412. fmt.Println(receiveVal)
  413. model.Status = suppliercert.STORE_STATUS
  414. model.Step = 7
  415. model.StorageOn = time.Now()
  416. model.ApplyTime = time.Now().AddDate(1, 0, 0)
  417. model.InFlag = "1"
  418. model.ModifiedOn = time.Now()
  419. model.ModifiedBy = this.User.Realname
  420. model.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
  421. cols := []string{
  422. "Step",
  423. "Status",
  424. "ApplyTime",
  425. "InFlag",
  426. "StorageOn",
  427. "ModifiedOn",
  428. "ModifiedUserId",
  429. "ModifiedBy",
  430. }
  431. err = svc.UpdateEntityBytbl(OilSupplierCertName, id, &model, cols)
  432. }
  433. if err == nil {
  434. errinfo.Message = "提交成功!"
  435. errinfo.Code = 0
  436. this.Data["json"] = &errinfo
  437. this.ServeJSON()
  438. } else {
  439. errinfo.Message = "提交失败!" + utils.AlertProcess(err.Error())
  440. errinfo.Code = -1
  441. this.Data["json"] = &errinfo
  442. this.ServeJSON()
  443. }
  444. }
  445. // @Title 删除单条信息
  446. // @Description
  447. // @Success 200 {object} ErrorInfo
  448. // @Failure 403 :id 为空
  449. // @router /delete/:Id [delete]
  450. func (this *OilSupplierCertController) DeleteEntity() {
  451. Id := this.Ctx.Input.Param(":Id")
  452. var errinfo ErrorInfo
  453. if Id == "" {
  454. errinfo.Message = "操作失败!请求信息不完整"
  455. errinfo.Code = -2
  456. this.Data["json"] = &errinfo
  457. this.ServeJSON()
  458. return
  459. }
  460. var model suppliercert.OilSupplierCert
  461. var entityempty suppliercert.OilSupplierCert
  462. svc := suppliercert.GetOilSupplierCertService(utils.DBE)
  463. opdesc := "删除-" + Id
  464. err := svc.DeleteOperationAndWriteLogBytbl(OilSupplierCertName, BaseOperationLogName, Id, &model, &entityempty, utils.ToStr(this.User.Id), this.User.Username, opdesc, this.User.AccCode, "钻井日报")
  465. if err == nil {
  466. errinfo.Message = "删除成功"
  467. errinfo.Code = 0
  468. this.Data["json"] = &errinfo
  469. this.ServeJSON()
  470. } else {
  471. errinfo.Message = "删除失败!" + utils.AlertProcess(err.Error())
  472. errinfo.Code = -1
  473. this.Data["json"] = &errinfo
  474. this.ServeJSON()
  475. }
  476. }
  477. // @Title 提交审批
  478. // @Description 提交审批
  479. // @Success 200 {object} controllers.Request
  480. // @router /audit/:id [post]
  481. func (this *OilSupplierCertController) AuditEntity() {
  482. certId := this.Ctx.Input.Param(":id")
  483. firstAudit := this.GetString("FirstAuditName")
  484. AuditRemark := this.GetString("AuditRemark")
  485. secondAudit := this.GetString("SecondAudit")
  486. thirdAudit := this.GetString("ThirdAudit")
  487. typeCode := this.GetString("TypeCode")
  488. var setting auditsetting.Base_OilAuditSetting
  489. var userlist []userRole.Base_User
  490. usvc := userRole.GetUserService(utils.DBE)
  491. where := ""
  492. if this.User.IsCompanyUser == 1 {
  493. if typeCode == "01" {
  494. where = "AuditStepCode='" + workflow.SUB_OFFICE_WZ + "'"
  495. } else if typeCode == "02" {
  496. where = "AuditStepCode='" + workflow.SUB_OFFICE_JS + "'"
  497. } else if typeCode == "03" {
  498. where = "AuditStepCode='" + workflow.SUB_OFFICE_JF + "'"
  499. }
  500. usvc.GetEntity(&setting, where)
  501. ids := usvc.GetUserIdsByRoleId(strconv.Itoa(setting.RoleId))
  502. tempstr := strings.Join(ids, ",")
  503. uids := strings.Replace(tempstr, "uid_", "", -1)
  504. uids = strings.Trim(uids, ",")
  505. if uids != "" {
  506. where := "Id in (" + uids + ")" + " and UnitId=" + firstAudit
  507. usvc.GetEntities(&userlist, where)
  508. }
  509. userIds := ""
  510. for _, tmpUser := range userlist {
  511. userIds += strconv.Itoa(tmpUser.Id) + ","
  512. }
  513. firstAudit = strings.Trim(userIds, ",")
  514. }
  515. //取出审批列表
  516. certSrv := suppliercert.GetOilSupplierCertService(utils.DBE)
  517. var supplierCertEntity suppliercert.OilSupplierCert
  518. certSrv.GetEntityById(certId, &supplierCertEntity)
  519. //取出企业主表
  520. supplierSvc := supplier.GetOilSupplierService(utils.DBE)
  521. var supplierEntity supplier.OilSupplier
  522. supplierSvc.GetEntityById(supplierCertEntity.SupplierId, &supplierEntity)
  523. svc := organize.GetOrganizeService(utils.DBE)
  524. unitId := svc.GetMyUnitDepartmentId(this.User.DepartmentId)
  525. var errinfo ErrorDataInfo
  526. defer func() { //finally处理失败的异常
  527. if err := recover(); err != nil {
  528. errinfo.Message = "提交失败," + err.(string)
  529. errinfo.Code = -1
  530. this.Data["json"] = &errinfo
  531. this.ServeJSON()
  532. } else {
  533. //返回正确结果
  534. errinfo.Message = "审核提交成功"
  535. errinfo.Code = 0
  536. this.Data["json"] = &errinfo
  537. this.ServeJSON()
  538. }
  539. }()
  540. ////判断当前部门是否企业用户
  541. //result := "1"
  542. //if this.User.IsCompanyUser == 1 {
  543. // result = "0"
  544. //}
  545. svcActiviti := workflow.GetActivitiService(utils.DBE)
  546. ////获得有审核权限的人员
  547. //var users []userRole.Base_RoleList
  548. //var userIds string
  549. //var auditWorkflow auditsetting.Base_OilAuditSetting
  550. //rsvc := auditsetting.GetOilAuditSettingService(utils.DBE)
  551. //rsvc.GetAuditStepRoleEntity(OilAuditSettingName, firstAudit, workflow.FIRST_TRIAL, &auditWorkflow)
  552. //users = rsvc.GetUserByRole(strconv.Itoa(auditWorkflow.RoleId), this.User.AccCode) //
  553. processInstanceId := ""
  554. businessKey := ""
  555. result := strconv.Itoa(this.User.IsCompanyUser)
  556. if supplierCertEntity.WorkflowId == "0" || len(supplierCertEntity.WorkflowId) <= 0 {
  557. //启动工作流
  558. businessKey = certId + "-" + strconv.Itoa(supplierCertEntity.AuditIndex)
  559. // 1 评审准入 2 一级物资备案准入 3 二级物资备案准入 4 战略合作准入 5 内部多元准入 6 外部市场准入
  560. if supplierCertEntity.InStyle == "2" || supplierCertEntity.InStyle == "4" || supplierCertEntity.InStyle == "6" {
  561. processInstanceId = svcActiviti.StartProcess2(workflow.OIL_FIRST_ENUSER_SUPPLIER_APPLY, businessKey, this.User.Id, result, supplierCertEntity.SupplierTypeCode, supplierEntity.SupplierName)
  562. } else if supplierCertEntity.InStyle == "3" {
  563. processInstanceId = svcActiviti.StartProcess2(workflow.OIL_SECOND_ENUSER_SUPPLIER_APPLY, businessKey, this.User.Id, result, supplierCertEntity.SupplierTypeCode, supplierEntity.SupplierName)
  564. } else if supplierCertEntity.InStyle == "1" || supplierCertEntity.InStyle == "5" {
  565. processInstanceId = svcActiviti.StartProcess2(workflow.OIL_ENUSER_SUPPLIER_APPLY, businessKey, this.User.Id, result, supplierCertEntity.SupplierTypeCode, supplierEntity.SupplierName)
  566. }
  567. //if this.User.IsCompanyUser == 1 { // 企业用户
  568. // // 1 评审准入 2 一级物资备案准入 3 二级物资备案准入 4 战略合作准入 5 内部多元准入 6 外部市场准入
  569. // if supplierCertEntity.InStyle == "2" || supplierCertEntity.InStyle == "4" || supplierCertEntity.InStyle == "6" {
  570. // processInstanceId = svcActiviti.StartProcess(workflow.OIL_FIRST_ENUSER_SUPPLIER_APPLY, businessKey, this.User.Id)
  571. // } else if supplierCertEntity.InStyle == "3" {
  572. // processInstanceId = svcActiviti.StartProcess(workflow.OIL_SECOND_ENUSER_SUPPLIER_APPLY, businessKey, this.User.Id)
  573. // } else if supplierCertEntity.InStyle == "1" || supplierCertEntity.InStyle == "5" {
  574. // processInstanceId = svcActiviti.StartProcess(workflow.OIL_ENUSER_SUPPLIER_APPLY, businessKey, this.User.Id)
  575. // }
  576. //}else if this.User.IsCompanyUser == 0 {
  577. // //if supplierCertEntity.InStyle == "2" {
  578. // // processInstanceId = svcActiviti.StartProcess(workflow.OIL_FIRST_SUPPLIER_APPLY, businessKey, this.User.Id)
  579. // //} else if supplierCertEntity.InStyle == "3" {
  580. // // processInstanceId = svcActiviti.StartProcess(workflow.OIL_SECOND_SUPPLIER_APPLY, businessKey, this.User.Id)
  581. // //} else if supplierCertEntity.InStyle == "6" {
  582. // // processInstanceId = svcActiviti.StartProcess(workflow.OIL_FIRST_SUPPLIER_APPLY, businessKey, this.User.Id)
  583. // //} else {
  584. // // processInstanceId = svcActiviti.StartProcess(workflow.OIL_SUPPLIER_APPLY, businessKey, this.User.Id)
  585. // //}
  586. // if supplierCertEntity.InStyle == "2" || supplierCertEntity.InStyle == "4" || supplierCertEntity.InStyle == "6" {
  587. // processInstanceId = svcActiviti.StartProcess(workflow.OIL_FIRST_SUPPLIER_APPLY, businessKey, this.User.Id)
  588. // } else if supplierCertEntity.InStyle == "3" {
  589. // processInstanceId = svcActiviti.StartProcess(workflow.OIL_SECOND_SUPPLIER_APPLY, businessKey, this.User.Id)
  590. // } else if supplierCertEntity.InStyle == "1" || supplierCertEntity.InStyle == "5" {
  591. // processInstanceId = svcActiviti.StartProcess(workflow.OIL_ENUSER_SUPPLIER_APPLY, businessKey, this.User.Id)
  592. // }
  593. //}
  594. } else {
  595. processInstanceId = supplierCertEntity.WorkflowId
  596. }
  597. //processInstanceId,_ := certSrv.SubmitOrgAudit(certId, workflow.OIL_SUPPLIER_APPLY, workflow.FIRST_TRIAL, this.User.Id, result, "提交给二级单位初审", OilSupplierCertSubName, OilClassOrgSettingName, "", "")
  598. //for _, tmpUser := range users {
  599. // userIds += strconv.FormatInt(tmpUser.Id, 10) + ","
  600. //}
  601. //userIds = strings.Trim(userIds, ",")
  602. var ActiComplete workflow.ActiCompleteVM
  603. if supplierCertEntity.InStyle == "2" || supplierCertEntity.InStyle == "4" || supplierCertEntity.InStyle == "6" {
  604. ActiComplete.ProcessKey = workflow.OIL_FIRST_ENUSER_SUPPLIER_APPLY
  605. } else if supplierCertEntity.InStyle == "3" {
  606. ActiComplete.ProcessKey = workflow.OIL_SECOND_ENUSER_SUPPLIER_APPLY
  607. } else if supplierCertEntity.InStyle == "1" || supplierCertEntity.InStyle == "5" {
  608. ActiComplete.ProcessKey = workflow.OIL_ENUSER_SUPPLIER_APPLY
  609. }
  610. //if this.User.IsCompanyUser == 1 {
  611. // if supplierCertEntity.InStyle == "2" || supplierCertEntity.InStyle == "4" || supplierCertEntity.InStyle == "6" {
  612. // ActiComplete.ProcessKey = workflow.OIL_FIRST_ENUSER_SUPPLIER_APPLY
  613. // } else if supplierCertEntity.InStyle == "3" {
  614. // ActiComplete.ProcessKey = workflow.OIL_SECOND_ENUSER_SUPPLIER_APPLY
  615. // } else if supplierCertEntity.InStyle == "1" || supplierCertEntity.InStyle == "5" {
  616. // ActiComplete.ProcessKey = workflow.OIL_ENUSER_SUPPLIER_APPLY
  617. // }
  618. //}else if this.User.IsCompanyUser == 0 {
  619. // if supplierCertEntity.InStyle == "2" || supplierCertEntity.InStyle == "4" || supplierCertEntity.InStyle == "6" {
  620. // ActiComplete.ProcessKey = workflow.OIL_FIRST_SUPPLIER_APPLY
  621. // } else if supplierCertEntity.InStyle == "3" {
  622. // ActiComplete.ProcessKey = workflow.OIL_SECOND_SUPPLIER_APPLY
  623. // } else if supplierCertEntity.InStyle == "1" || supplierCertEntity.InStyle == "5" {
  624. // ActiComplete.ProcessKey = workflow.OIL_ENUSER_SUPPLIER_APPLY
  625. // }
  626. //}
  627. ActiComplete.BusinessKey = businessKey
  628. ActiComplete.UserNames = firstAudit
  629. ActiComplete.UserId = this.User.Id
  630. ActiComplete.Result = result
  631. ActiComplete.Remarks = AuditRemark
  632. ActiComplete.CallbackUrl = ""
  633. receiveVal := svcActiviti.TaskComplete(ActiComplete)
  634. if receiveVal == "true" {
  635. errinfo.Message = "提交成功!"
  636. errinfo.Code = 0
  637. this.Data["json"] = &errinfo
  638. this.ServeJSON()
  639. } else {
  640. errinfo.Message = "工作流异常,请联系管理员!"
  641. errinfo.Code = -1
  642. this.Data["json"] = &errinfo
  643. this.ServeJSON()
  644. return
  645. }
  646. fmt.Println("-----------processInstanceId------------")
  647. //记下workflowID(首次提交时才会记录,中间状态请忽略) 及审批状态
  648. supplierCertEntity.WorkflowId = processInstanceId
  649. if this.User.IsCompanyUser == 1 {
  650. supplierCertEntity.Status = suppliercert.FEN_TRIAL_STATUS //分办
  651. } else if this.User.IsCompanyUser == 0 {
  652. supplierCertEntity.Status = suppliercert.FIRST_TRIAL_STATUS //二级单位初审
  653. }
  654. supplierCertEntity.Step = 2
  655. supplierCertEntity.FirstAudit, _ = strconv.Atoi(firstAudit)
  656. supplierCertEntity.AuditIndex = supplierCertEntity.AuditIndex + 1
  657. supplierCertEntity.BusinessKey = ActiComplete.BusinessKey
  658. supplierCertEntity.SecondAudit, _ = strconv.Atoi(secondAudit)
  659. supplierCertEntity.ThirdAudit, _ = strconv.Atoi(thirdAudit)
  660. supplierCertEntity.ProcessKey = ActiComplete.ProcessKey
  661. supplierCertEntity.CommitComId = unitId
  662. cols := []string{
  663. "Id",
  664. "WorkflowId",
  665. "Status",
  666. "Step",
  667. "FirstAudit",
  668. "AuditIndex",
  669. "BusinessKey",
  670. "SecondAudit",
  671. "ThirdAudit",
  672. "ProcessKey",
  673. "CommitComId",
  674. }
  675. certSrv.UpdateEntityByIdCols(certId, supplierCertEntity, cols)
  676. //var model classorgsetting.OilClassOrgSetting
  677. //var jsonBlob = this.Ctx.Input.RequestBody
  678. //svc := suppliercert.GetOilSupplierCertService(utils.DBE)
  679. //
  680. //json.Unmarshal(jsonBlob, &model)
  681. //model.CreateOn = time.Now()
  682. //model.CreateBy = this.User.Realname
  683. //model.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
  684. ////model.OrganizeId, _ = utils.StrTo(this.User.DepartmentId).Int()
  685. //
  686. //svc.InsertEntityBytbl(OilSupplierCertName, &model)
  687. //fmt.Println(model)
  688. }
  689. // @Title 专业审批
  690. // @Description 准入初审提交审批
  691. // @Success 200 {object} controllers.Request
  692. // @router /admission/:id [post]
  693. func (this *OilSupplierCertController) AuditEntityadmission() {
  694. certId := this.Ctx.Input.Param(":id")
  695. var errinfo ErrorDataInfo
  696. defer func() { //finally处理失败的异常
  697. if err := recover(); err != nil {
  698. errinfo.Message = "提交失败," + err.(string)
  699. errinfo.Code = -1
  700. this.Data["json"] = &errinfo
  701. this.ServeJSON()
  702. } else {
  703. //返回正确结果
  704. errinfo.Message = "审核提交成功"
  705. errinfo.Code = 0
  706. this.Data["json"] = &errinfo
  707. this.ServeJSON()
  708. }
  709. }()
  710. //取出审批列表
  711. certSrv := suppliercert.GetOilSupplierCertService(utils.DBE)
  712. certSrv.SubmitOrgAudit(certId, workflow.OIL_ENUSER_SUPPLIER_APPLY, workflow.PROF_AUDIT, this.User.Id, "1", "提交给专业科室审核", OilSupplierCertSubName, OilClassOrgSettingName, "", "")
  713. //记下workflowID(首次提交时才会记录,中间状态请忽略) 及审批状态
  714. var supplierCertEntity suppliercert.OilSupplierCert
  715. certSrv.GetEntityById(certId, supplierCertEntity)
  716. supplierCertEntity.Status = suppliercert.PROF_AUDIT_STATUS //二级单位初审
  717. cols := []string{
  718. "Id",
  719. "Status",
  720. }
  721. certSrv.UpdateEntityByIdCols(certId, supplierCertEntity, cols)
  722. }
  723. // @Title 审批
  724. // @Description 审批
  725. // @Param body body suppliercert.OilSupplierCert
  726. // @Success 200 {object} controllers.Request
  727. // @router /auditEntityFir/:id [post]
  728. func (this *OilSupplierCertController) AuditEntityFir() {
  729. var dataother ShenHeModel
  730. certId := this.Ctx.Input.Param(":id")
  731. auditer := this.GetString("auditer")
  732. firstAudit := this.GetString("FirstAuditName")
  733. AuditRemark := this.GetString("AuditRemark")
  734. secondAudit := this.GetString("SecondAudit")
  735. thirdAudit := this.GetString("ThirdAudit")
  736. //majorDept := this.GetString("majorDept")
  737. //取出审批列表
  738. certSrv := suppliercert.GetOilSupplierCertService(utils.DBE)
  739. var supplierCertEntity suppliercert.OilSupplierCert
  740. var supplierEntity supplier.OilSupplier
  741. certSrv.GetEntityById(certId, &supplierCertEntity)
  742. wheresup := "Id=" + strconv.Itoa(supplierCertEntity.SupplierId)
  743. certSrv.GetEntity(&supplierEntity, wheresup)
  744. var jsonblob = this.Ctx.Input.RequestBody
  745. json.Unmarshal(jsonblob, &dataother)
  746. if AuditRemark != "" {
  747. dataother.AuditorRemark = AuditRemark
  748. }
  749. var errinfo ErrorDataInfo
  750. defer func() { //finally处理失败的异常
  751. if err := recover(); err != nil {
  752. errinfo.Message = "提交失败," + err.(string)
  753. errinfo.Code = -1
  754. this.Data["json"] = &errinfo
  755. this.ServeJSON()
  756. } else {
  757. //返回正确结果
  758. errinfo.Message = "审核提交成功"
  759. errinfo.Code = 0
  760. this.Data["json"] = &errinfo
  761. this.ServeJSON()
  762. }
  763. }()
  764. //remarks := ""
  765. step := 2
  766. status := ""
  767. backstatus := "0"
  768. var userIds string
  769. if supplierCertEntity.Status == suppliercert.FEN_TRIAL_STATUS {
  770. userIds = firstAudit
  771. status = suppliercert.FIRST_TRIAL_STATUS
  772. backstatus = suppliercert.NO_FEN_TRIAL_STATUS
  773. step = 2
  774. if dataother.SuccessStatus == 1 {
  775. supplierCertEntity.Step = 2
  776. supplierCertEntity.FirstAudit, _ = strconv.Atoi(firstAudit)
  777. supplierCertEntity.SecondAudit, _ = strconv.Atoi(secondAudit)
  778. supplierCertEntity.ThirdAudit, _ = strconv.Atoi(thirdAudit)
  779. cols := []string{
  780. "Id",
  781. "Step",
  782. "FirstAudit",
  783. "SecondAudit",
  784. "ThirdAudit",
  785. }
  786. certSrv.UpdateEntityByIdCols(certId, supplierCertEntity, cols)
  787. }
  788. }
  789. if supplierCertEntity.Status == suppliercert.FIRST_TRIAL_STATUS {
  790. userIds = utils.ToStr(supplierCertEntity.SecondAudit)
  791. status = suppliercert.SECOND_TRIAL_STATUS
  792. backstatus = suppliercert.NOPASS_STATUS
  793. step = 2
  794. //supplierCertEntity.ThirdAudit,_ = strconv.Atoi(majorDept)
  795. //cols := []string{
  796. // "ThirdAudit",
  797. //}
  798. //certSrv.UpdateEntityByIdCols(certId, supplierCertEntity, cols)
  799. } else if supplierCertEntity.Status == suppliercert.SECOND_TRIAL_STATUS {
  800. step = 2
  801. backstatus = suppliercert.NO_SECOND_TRIAL_STATUS
  802. svc := organize.GetOrganizeService(utils.DBE)
  803. unitId := svc.GetMyUnitDepartmentId(strconv.Itoa(supplierCertEntity.ThirdAudit))
  804. var userlist []userRole.Base_User
  805. var setting auditsetting.Base_OilAuditSetting
  806. usvc := userRole.GetUserService(utils.DBE)
  807. if supplierCertEntity.InStyle == "3" {
  808. status = suppliercert.THIRD_TRIAL_STATUS
  809. where := "AuditStepCode='" + workflow.PROF_RECE + "'"
  810. usvc.GetEntity(&setting, where)
  811. ids := usvc.GetUserIdsByRoleId(strconv.Itoa(setting.RoleId))
  812. tempstr := strings.Join(ids, ",")
  813. uids := strings.Replace(tempstr, "uid_", "", -1)
  814. uids = strings.Trim(uids, ",")
  815. if uids != "" {
  816. where := "Id in (" + uids + ")" + " and UnitId=" + strconv.Itoa(supplierCertEntity.ThirdAudit)
  817. usvc.GetEntities(&userlist, where)
  818. }
  819. } else if supplierCertEntity.InStyle == "2" || supplierCertEntity.InStyle == "4" || supplierCertEntity.InStyle == "6" {
  820. svcActiviti := workflow.GetActivitiService(utils.DBE)
  821. businessKey := strconv.Itoa(supplierCertEntity.Id)
  822. result := "1"
  823. userIds := ""
  824. var userlist []userRole.Base_User
  825. var setting auditsetting.Base_OilAuditSetting
  826. usvc := userRole.GetUserService(utils.DBE)
  827. where := "AuditStepCode='" + workflow.PROF_REGULATION + "'"
  828. certSrv.GetEntity(&setting, where)
  829. ids := usvc.GetUserIdsByRoleId(strconv.Itoa(setting.RoleId))
  830. tempstr := strings.Join(ids, ",")
  831. uids := strings.Replace(tempstr, "uid_", "", -1)
  832. uids = strings.Trim(uids, ",")
  833. paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
  834. topid := paramSvc.GetBaseparameterMessage("", "paramset", "CENT_AUDIT")
  835. if uids != "" {
  836. where := "Id in (" + uids + ")" + " and UnitId=" + topid
  837. paramSvc.GetEntities(&userlist, where)
  838. }
  839. for _, tmpUser := range userlist {
  840. userIds += strconv.Itoa(tmpUser.Id) + "," //strconv.FormatInt(tmpUser.Id, 10) + ","
  841. }
  842. userIds = strings.Trim(userIds, ",")
  843. processInstanceId := svcActiviti.StartProcess2(workflow.OIL_SUPPLIER_INSTORE, businessKey, userIds, result, supplierCertEntity.SupplierTypeCode, supplierEntity.SupplierName)
  844. //var ActiComplete workflow.ActiCompleteVM
  845. //ActiComplete.ProcessKey = workflow.OIL_SUPPLIER_INSTORE
  846. //ActiComplete.BusinessKey = businessKey
  847. //ActiComplete.UserNames = userIds
  848. //ActiComplete.UserId = this.User.Id
  849. //ActiComplete.Result = "1"
  850. //ActiComplete.Remarks = ""
  851. //ActiComplete.CallbackUrl = ""
  852. //
  853. //res := svcActiviti.TaskComplete(ActiComplete)
  854. //fmt.Println(res)
  855. var activity oilactivity.OilActivity
  856. activity.EntityId = supplierCertEntity.Id
  857. activity.ActType = oilactivity.STORAGE
  858. activity.WorkflowId = processInstanceId
  859. activity.BusinessKey = businessKey
  860. activity.ProcessKey = workflow.OIL_SUPPLIER_INSTORE
  861. activity.CreateOn = time.Now()
  862. certSrv.InsertEntityBytbl(OilActivityName, &activity)
  863. status = suppliercert.STOREING_STATUS
  864. step = 3
  865. } else {
  866. status = suppliercert.THIRD_TRIAL_STATUS
  867. where := "AuditStepCode='" + workflow.PROF_RECE + "'"
  868. svc.GetEntity(&setting, where)
  869. ids := usvc.GetUserIdsByRoleId(strconv.Itoa(setting.RoleId))
  870. tempstr := strings.Join(ids, ",")
  871. uids := strings.Replace(tempstr, "uid_", "", -1)
  872. uids = strings.Trim(uids, ",")
  873. if uids != "" {
  874. where := "Id in (" + uids + ")" + " and UnitId=" + unitId
  875. svc.GetEntities(&userlist, where)
  876. }
  877. }
  878. //var users []userRole.Base_RoleList
  879. //certSrv.GetAuditUser(strconv.Itoa(supplierCertEntity.ThirdAudit), workflow.PROF_RECE, &users)
  880. for _, tmpUser := range userlist {
  881. userIds += strconv.Itoa(tmpUser.Id) + "," //strconv.FormatInt(tmpUser.Id, 10) + ","
  882. }
  883. userIds = strings.Trim(userIds, ",")
  884. //step = 2
  885. //backstatus = suppliercert.NO_SECOND_TRIAL_STATUS
  886. } else if supplierCertEntity.Status == suppliercert.THIRD_TRIAL_STATUS {
  887. userIds = auditer
  888. status = suppliercert.PROF_AUDIT_STATUS
  889. step = 2
  890. backstatus = suppliercert.NO_THIRD_TRIAL_STATUS
  891. } else if supplierCertEntity.Status == suppliercert.PROF_AUDIT_STATUS {
  892. if supplierCertEntity.InStyle == "3" {
  893. userIds = auditer
  894. status = suppliercert.PAYING_AUDIT_STATUS
  895. step = 3
  896. backstatus = suppliercert.NO_CENT_AUDIT_STATUS
  897. } else {
  898. status = suppliercert.CENT_AUDIT_STATUS
  899. step = 2
  900. backstatus = suppliercert.NO_PROF_AUDIT_STATUS
  901. paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
  902. topid := paramSvc.GetBaseparameterMessage("", "paramset", "CENT_AUDIT")
  903. var userlist []userRole.Base_User
  904. var setting auditsetting.Base_OilAuditSetting
  905. usvc := userRole.GetUserService(utils.DBE)
  906. where := "AuditStepCode='" + workflow.PROF_REGULATION + "'"
  907. usvc.GetEntity(&setting, where)
  908. ids := usvc.GetUserIdsByRoleId(strconv.Itoa(setting.RoleId))
  909. tempstr := strings.Join(ids, ",")
  910. uids := strings.Replace(tempstr, "uid_", "", -1)
  911. uids = strings.Trim(uids, ",")
  912. if uids != "" {
  913. where := "Id in (" + uids + ")" + " and UnitId=" + topid
  914. usvc.GetEntities(&userlist, where)
  915. }
  916. for _, tmpUser := range userlist {
  917. userIds += strconv.Itoa(tmpUser.Id) + ","
  918. }
  919. userIds = strings.Trim(userIds, ",")
  920. }
  921. } else if supplierCertEntity.Status == suppliercert.CENT_AUDIT_STATUS {
  922. userIds = auditer
  923. status = suppliercert.PAYING_AUDIT_STATUS
  924. step = 3
  925. backstatus = suppliercert.NO_CENT_AUDIT_STATUS
  926. }
  927. svcActiviti := workflow.GetActivitiService(utils.DBE)
  928. var ActiComplete workflow.ActiCompleteVM
  929. ActiComplete.ProcessKey = supplierCertEntity.ProcessKey
  930. ActiComplete.BusinessKey = supplierCertEntity.BusinessKey
  931. ActiComplete.UserNames = userIds
  932. ActiComplete.UserId = this.User.Id
  933. ActiComplete.Remarks = dataother.AuditorRemark
  934. ActiComplete.CallbackUrl = ""
  935. if dataother.SuccessStatus == 1 {
  936. ActiComplete.Result = "1"
  937. receiveVal := svcActiviti.TaskComplete(ActiComplete)
  938. if receiveVal == "true" {
  939. if supplierCertEntity.Status == suppliercert.CENT_AUDIT_STATUS {
  940. if supplierCertEntity.InStyle == "1" {
  941. paysvc := paymentinfo.GetPaymentService(utils.DBE)
  942. var Amount float64
  943. asvc := oilcostmanage.GetOilCostManageService(utils.DBE)
  944. Amount = asvc.GetAmount("ZHUNRU", supplierCertEntity.SupplierTypeCode)
  945. var payinfo paymentinfo.OilPaymentInfo
  946. payinfo.SupplierId = supplierCertEntity.SupplierId
  947. payinfo.SrcId = supplierCertEntity.Id
  948. payinfo.SupplierCertId = supplierCertEntity.Id
  949. payinfo.USCCode = supplierEntity.CommercialNo
  950. payinfo.SupplierName = supplierEntity.SupplierName
  951. payinfo.PayType = "1"
  952. payinfo.Amount = strconv.FormatFloat(Amount, 'E', -1, 64)
  953. payinfo.IsPay = "0"
  954. payinfo.CreateUserId = supplierCertEntity.CreateUserId
  955. payinfo.CreateBy = supplierCertEntity.CreateBy
  956. payinfo.CreateOn = time.Now()
  957. wheresup := " SupplierCertId=" + strconv.Itoa(supplierCertEntity.Id)
  958. var sup []suppliercertsub.OilSupplierCertSub
  959. total := paysvc.GetPagingEntitiesWithOrder(1, 10, "Id", true, &sup, wheresup)
  960. if supplierCertEntity.SupplierTypeCode == "01" && total <= 50 {
  961. status = suppliercert.STOREING_STATUS
  962. svcActiviti := workflow.GetActivitiService(utils.DBE)
  963. businessKey := strconv.Itoa(supplierCertEntity.Id)
  964. result := "1"
  965. userIds := ""
  966. var userlist []userRole.Base_User
  967. var setting auditsetting.Base_OilAuditSetting
  968. usvc := userRole.GetUserService(utils.DBE)
  969. where := "AuditStepCode='" + workflow.PROF_REGULATION + "'"
  970. paysvc.GetEntity(&setting, where)
  971. ids := usvc.GetUserIdsByRoleId(strconv.Itoa(setting.RoleId))
  972. tempstr := strings.Join(ids, ",")
  973. uids := strings.Replace(tempstr, "uid_", "", -1)
  974. uids = strings.Trim(uids, ",")
  975. paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
  976. topid := paramSvc.GetBaseparameterMessage("", "paramset", "CENT_AUDIT")
  977. if uids != "" {
  978. where := "Id in (" + uids + ")" + " and UnitId=" + topid
  979. paramSvc.GetEntities(&userlist, where)
  980. }
  981. for _, tmpUser := range userlist {
  982. userIds += strconv.Itoa(tmpUser.Id) + "," //strconv.FormatInt(tmpUser.Id, 10) + ","
  983. }
  984. userIds = strings.Trim(userIds, ",")
  985. processInstanceId := svcActiviti.StartProcess2(workflow.OIL_SUPPLIER_INSTORE, businessKey, userIds, result, supplierCertEntity.SupplierTypeCode, supplierEntity.SupplierName)
  986. //var ActiComplete workflow.ActiCompleteVM
  987. //ActiComplete.ProcessKey = workflow.OIL_SUPPLIER_INSTORE
  988. //ActiComplete.BusinessKey = businessKey
  989. //ActiComplete.UserNames = userIds
  990. //ActiComplete.UserId = this.User.Id
  991. //ActiComplete.Result = "1"
  992. //ActiComplete.Remarks = ""
  993. //ActiComplete.CallbackUrl = ""
  994. //
  995. //res := svcActiviti.TaskComplete(ActiComplete)
  996. //fmt.Println(res)
  997. var activity oilactivity.OilActivity
  998. activity.EntityId = supplierCertEntity.Id
  999. activity.ActType = oilactivity.STORAGE
  1000. activity.WorkflowId = processInstanceId
  1001. activity.BusinessKey = businessKey
  1002. activity.ProcessKey = workflow.OIL_SUPPLIER_INSTORE
  1003. activity.CreateOn = time.Now()
  1004. paysvc.InsertEntityBytbl(OilActivityName, &activity)
  1005. } else {
  1006. paysvc.InsertEntity(&payinfo)
  1007. //发短信
  1008. toMobile := supplierEntity.Mobile
  1009. msg := "您的" + supplierCertEntity.SupplierTypeName + "准入审核通过,请及时确认交费信息!"
  1010. msgService := msg2.GetMsgService(utils.DBE)
  1011. msgService.HandleMsg(toMobile, msg, "3-1", supplierCertEntity.CreateBy, supplierEntity.ContactName, strconv.Itoa(supplierCertEntity.CreateUserId))
  1012. }
  1013. //paysvc.AddPaymentinfo(supplierCertEntity.SupplierId, supplierCertEntity.Id, Amount, "1")
  1014. supplierCertEntity.Status = status
  1015. supplierCertEntity.Step = step
  1016. cols := []string{
  1017. "Status",
  1018. "Step",
  1019. }
  1020. certSrv.UpdateEntityByIdCols(certId, supplierCertEntity, cols)
  1021. } else {
  1022. svcActiviti := workflow.GetActivitiService(utils.DBE)
  1023. businessKey := strconv.Itoa(supplierCertEntity.Id)
  1024. result := "1"
  1025. userIds := ""
  1026. var userlist []userRole.Base_User
  1027. var setting auditsetting.Base_OilAuditSetting
  1028. usvc := userRole.GetUserService(utils.DBE)
  1029. where := "AuditStepCode='" + workflow.PROF_REGULATION + "'"
  1030. certSrv.GetEntity(&setting, where)
  1031. ids := usvc.GetUserIdsByRoleId(strconv.Itoa(setting.RoleId))
  1032. tempstr := strings.Join(ids, ",")
  1033. uids := strings.Replace(tempstr, "uid_", "", -1)
  1034. uids = strings.Trim(uids, ",")
  1035. paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
  1036. topid := paramSvc.GetBaseparameterMessage("", "paramset", "CENT_AUDIT")
  1037. if uids != "" {
  1038. where := "Id in (" + uids + ")" + " and UnitId=" + topid
  1039. paramSvc.GetEntities(&userlist, where)
  1040. }
  1041. for _, tmpUser := range userlist {
  1042. userIds += strconv.Itoa(tmpUser.Id) + "," //strconv.FormatInt(tmpUser.Id, 10) + ","
  1043. }
  1044. userIds = strings.Trim(userIds, ",")
  1045. processInstanceId := svcActiviti.StartProcess2(workflow.OIL_SUPPLIER_INSTORE, businessKey, userIds, result, supplierCertEntity.SupplierTypeCode, supplierEntity.SupplierName)
  1046. //var ActiComplete workflow.ActiCompleteVM
  1047. //ActiComplete.ProcessKey = workflow.OIL_SUPPLIER_INSTORE
  1048. //ActiComplete.BusinessKey = businessKey
  1049. //ActiComplete.UserNames = userIds
  1050. //ActiComplete.UserId = this.User.Id
  1051. //ActiComplete.Result = "1"
  1052. //ActiComplete.Remarks = ""
  1053. //ActiComplete.CallbackUrl = ""
  1054. //
  1055. //res := svcActiviti.TaskComplete(ActiComplete)
  1056. //fmt.Println(res)
  1057. var activity oilactivity.OilActivity
  1058. activity.EntityId = supplierCertEntity.Id
  1059. activity.ActType = oilactivity.STORAGE
  1060. activity.WorkflowId = processInstanceId
  1061. activity.BusinessKey = businessKey
  1062. activity.ProcessKey = workflow.OIL_SUPPLIER_INSTORE
  1063. activity.CreateOn = time.Now()
  1064. certSrv.InsertEntityBytbl(OilActivityName, &activity)
  1065. supplierCertEntity.Status = suppliercert.STOREING_STATUS
  1066. supplierCertEntity.Step = step
  1067. cols := []string{
  1068. "Status",
  1069. "Step",
  1070. }
  1071. certSrv.UpdateEntityByIdCols(certId, supplierCertEntity, cols)
  1072. }
  1073. } else if supplierCertEntity.Status == suppliercert.PROF_AUDIT_STATUS && supplierCertEntity.InStyle == "3" {
  1074. //if supplierCertEntity.InStyle == "3" {
  1075. svcActiviti := workflow.GetActivitiService(utils.DBE)
  1076. businessKey := strconv.Itoa(supplierCertEntity.Id)
  1077. result := "1"
  1078. userIds := ""
  1079. var userlist []userRole.Base_User
  1080. var setting auditsetting.Base_OilAuditSetting
  1081. usvc := userRole.GetUserService(utils.DBE)
  1082. where := "AuditStepCode='" + workflow.PROF_REGULATION + "'"
  1083. certSrv.GetEntity(&setting, where)
  1084. ids := usvc.GetUserIdsByRoleId(strconv.Itoa(setting.RoleId))
  1085. tempstr := strings.Join(ids, ",")
  1086. uids := strings.Replace(tempstr, "uid_", "", -1)
  1087. uids = strings.Trim(uids, ",")
  1088. paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
  1089. topid := paramSvc.GetBaseparameterMessage("", "paramset", "CENT_AUDIT")
  1090. if uids != "" {
  1091. where := "Id in (" + uids + ")" + " and UnitId=" + topid
  1092. paramSvc.GetEntities(&userlist, where)
  1093. }
  1094. for _, tmpUser := range userlist {
  1095. userIds += strconv.Itoa(tmpUser.Id) + "," //strconv.FormatInt(tmpUser.Id, 10) + ","
  1096. }
  1097. userIds = strings.Trim(userIds, ",")
  1098. processInstanceId := svcActiviti.StartProcess2(workflow.OIL_SUPPLIER_INSTORE, businessKey, userIds, result, supplierCertEntity.SupplierTypeCode, supplierEntity.SupplierName)
  1099. //var ActiComplete workflow.ActiCompleteVM
  1100. //ActiComplete.ProcessKey = workflow.OIL_SUPPLIER_INSTORE
  1101. //ActiComplete.BusinessKey = businessKey
  1102. //ActiComplete.UserNames = userIds
  1103. //ActiComplete.UserId = this.User.Id
  1104. //ActiComplete.Result = "1"
  1105. //ActiComplete.Remarks = ""
  1106. //ActiComplete.CallbackUrl = ""
  1107. //
  1108. //res := svcActiviti.TaskComplete(ActiComplete)
  1109. //fmt.Println(res)
  1110. var activity oilactivity.OilActivity
  1111. activity.EntityId = supplierCertEntity.Id
  1112. activity.ActType = oilactivity.STORAGE
  1113. activity.WorkflowId = processInstanceId
  1114. activity.BusinessKey = businessKey
  1115. activity.ProcessKey = workflow.OIL_SUPPLIER_INSTORE
  1116. activity.CreateOn = time.Now()
  1117. certSrv.InsertEntityBytbl(OilActivityName, &activity)
  1118. supplierCertEntity.Status = suppliercert.STOREING_STATUS
  1119. supplierCertEntity.Step = 3
  1120. cols := []string{
  1121. "Status",
  1122. "Step",
  1123. }
  1124. certSrv.UpdateEntityByIdCols(certId, supplierCertEntity, cols)
  1125. } else {
  1126. supplierCertEntity.Status = status
  1127. supplierCertEntity.Step = step
  1128. cols := []string{
  1129. "Status",
  1130. "Step",
  1131. }
  1132. certSrv.UpdateEntityByIdCols(certId, supplierCertEntity, cols)
  1133. }
  1134. errinfo.Message = "提交成功!"
  1135. errinfo.Code = 0
  1136. this.Data["json"] = &errinfo
  1137. this.ServeJSON()
  1138. } else {
  1139. errinfo.Message = "工作流异常,请联系管理员!"
  1140. errinfo.Code = -1
  1141. this.Data["json"] = &errinfo
  1142. this.ServeJSON()
  1143. return
  1144. }
  1145. } else {
  1146. ActiComplete.Result = "0"
  1147. receiveVal := svcActiviti.TaskComplete(ActiComplete)
  1148. if receiveVal == "true" {
  1149. // 审批历史
  1150. var audithistoryentity audithistory.Base_AuditHistory
  1151. audithistoryentity.EntityId = supplierCertEntity.Id
  1152. audithistoryentity.WorkflowId = supplierCertEntity.WorkflowId
  1153. audithistoryentity.Process = ActiComplete.ProcessKey
  1154. audithistoryentity.BusinessKey = ActiComplete.BusinessKey
  1155. audithistoryentity.Type = supplierCertEntity.SupplierTypeCode
  1156. audithistoryentity.BackStep = supplierCertEntity.Status
  1157. audithistoryentity.Index = supplierCertEntity.AuditIndex
  1158. audithistoryentity.CreateOn = time.Now()
  1159. audithistoryentity.CreateBy = this.User.Realname
  1160. audithistoryentity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
  1161. certSrv.InsertEntity(audithistoryentity)
  1162. if supplierCertEntity.Status == suppliercert.CENT_AUDIT_STATUS {
  1163. supplierCertEntity.Status = suppliercert.NO_CENT_AUDIT_STATUS
  1164. supplierCertEntity.BackReason = dataother.AuditorRemark
  1165. cols := []string{
  1166. "BackReason",
  1167. }
  1168. certSrv.UpdateEntityByIdCols(certId, supplierCertEntity, cols)
  1169. } else {
  1170. supplierCertEntity.Status = backstatus
  1171. }
  1172. supplierCertEntity.Step = 1
  1173. supplierCertEntity.WorkflowId = ""
  1174. cols := []string{
  1175. "Status",
  1176. "Step",
  1177. "WorkflowId",
  1178. }
  1179. certSrv.UpdateEntityByIdCols(certId, supplierCertEntity, cols)
  1180. toMobile := supplierEntity.Mobile
  1181. msg := "您的" + supplierCertEntity.SupplierTypeName + "准入审核未通过,请及时查看!"
  1182. msgService := msg2.GetMsgService(utils.DBE)
  1183. msgService.HandleMsg(toMobile, msg, "4-1", supplierCertEntity.CreateBy, supplierEntity.ContactName, strconv.Itoa(supplierCertEntity.CreateUserId))
  1184. errinfo.Message = "提交成功!"
  1185. errinfo.Code = 0
  1186. this.Data["json"] = &errinfo
  1187. this.ServeJSON()
  1188. } else {
  1189. errinfo.Message = "工作流异常,请联系管理员!"
  1190. errinfo.Code = -1
  1191. this.Data["json"] = &errinfo
  1192. this.ServeJSON()
  1193. return
  1194. }
  1195. }
  1196. }
  1197. // @Title 审核
  1198. // @Description 审核
  1199. // @Success 200 {object} controllers.Request
  1200. // @router /auditcallback [get]
  1201. func (this *OilSupplierCertController) AuditCallback() {
  1202. id := this.GetString("Id")
  1203. status := this.GetString("status")
  1204. step := this.GetString("step")
  1205. var supplierCertEntity suppliercert.OilSupplierCert
  1206. svc := suppliercert.GetOilSupplierCertService(utils.DBE)
  1207. supplierCertEntity.Status = status
  1208. supplierCertEntity.Step, _ = strconv.Atoi(step)
  1209. cols := []string{
  1210. "Id",
  1211. "Status",
  1212. "step",
  1213. }
  1214. svc.UpdateEntityByIdCols(id, supplierCertEntity, cols)
  1215. fmt.Println(id, status, step)
  1216. }
  1217. // @Title 获取实体
  1218. // @Description 获取实体
  1219. // @Success 200 {object} controllers.Request
  1220. // @router /isaccess [get]
  1221. func (this *OilSupplierCertController) IsAccess() {
  1222. auditstepcode := this.GetString("auditstepcode")
  1223. processkey := this.GetString("processkey")
  1224. id := this.GetString("id")
  1225. //var users []userRole.Base_RoleList
  1226. //var auditWorkflow auditsetting.Base_OilAuditSetting
  1227. //rsvc := auditsetting.GetOilAuditSettingService(utils.DBE)
  1228. res := false
  1229. if auditstepcode == workflow.PROF_CONCENT { // 集中审批
  1230. //rsvc.GetAuditStepRoleEntity(OilAuditSettingName, this.User.DepartmentId, workflow.PROF_AUDIT, &auditWorkflow)
  1231. //users = rsvc.GetUserByRole("10000204", this.User.AccCode)
  1232. //for _, user := range users {
  1233. // if this.User.Id == strconv.Itoa(int(user.Id)) {
  1234. // res = true
  1235. // break
  1236. // }
  1237. //}
  1238. var setting auditsetting.Base_OilAuditSetting
  1239. svc := organize.GetOrganizeService(utils.DBE)
  1240. where := "AuditStepCode='" + auditstepcode + "'"
  1241. svc.GetEntity(&setting, where)
  1242. res = svc.UserInRoleById(this.User.Id, strconv.Itoa(setting.RoleId))
  1243. } else {
  1244. //var users []suppliercert.UserList
  1245. //where := "OrganizeId=" + this.User.DepartmentId + " and AuditStepCode='" + auditstepcode + "'"
  1246. //rsvc.GetEntitysByWhere(OilAuditSettingName,where, &users)
  1247. //rsvc.GetAuditStepRoleEntity(OilAuditSettingName, this.User.DepartmentId, auditstepcode, &auditWorkflow)
  1248. //users = rsvc.GetUserByRole(strconv.Itoa(auditWorkflow.RoleId), this.User.AccCode)
  1249. //var users []userRole.Base_RoleList
  1250. //certSrv := suppliercert.GetOilSupplierCertService(utils.DBE)
  1251. //certSrv.GetAuditUser(this.User.DepartmentId, auditstepcode, &users)
  1252. var setting auditsetting.Base_OilAuditSetting
  1253. svc := organize.GetOrganizeService(utils.DBE)
  1254. where := "AuditStepCode='" + auditstepcode + "'"
  1255. svc.GetEntity(&setting, where)
  1256. res = svc.UserInRoleById(this.User.Id, strconv.Itoa(setting.RoleId))
  1257. if res {
  1258. actisvc := workflow.GetActivitiService(utils.DBE)
  1259. ids := actisvc.GetMyTasks(processkey, this.User.Id)
  1260. res = strings.Contains(ids, id)
  1261. }
  1262. //for _, user := range users {
  1263. // if this.User.Id == strconv.Itoa(int(user.Id)) {
  1264. // res = true
  1265. // break
  1266. // }
  1267. //}
  1268. }
  1269. this.Data["json"] = res
  1270. this.ServeJSON()
  1271. }
  1272. // @Title 获取准入编码
  1273. // @Description 获取准入编码
  1274. // @Success 200 {object} controllers.Request
  1275. // @router /createaccesscardno/:type [get]
  1276. func (this *OilSupplierCertController) CreateAccessCardNo() {
  1277. Id := this.GetString("Id")
  1278. certId := this.GetString(("SupplierCertId"))
  1279. typeCode := this.Ctx.Input.Param(":type")
  1280. codecSvc := codecsequence.GetCodecSequenceService(utils.DBE)
  1281. var entitycert suppliercert.OilSupplierCert
  1282. var entity supplier.OilSupplier
  1283. //where := "Id = " + Id
  1284. //codecSvc.GetEntities(&model, "")
  1285. seqStr := ""
  1286. cols := []string{}
  1287. if (typeCode == "01") { // 物质
  1288. has := true
  1289. for has {
  1290. seqStr = codecSvc.GetWZAccessCardNo(this.User.AccCode)
  1291. where := "SupplierTypeCode='" + typeCode + "' and AccessCardNo='" + seqStr + "'"
  1292. has = codecSvc.GetEntity(&entitycert, where)
  1293. }
  1294. cols = []string{"WZAccessCardNo"}
  1295. entity.WZAccessCardNo = seqStr
  1296. } else if typeCode == "03" { //技术服务
  1297. has := true
  1298. for has {
  1299. seqStr = codecSvc.GetJFAccessCardNo(this.User.AccCode)
  1300. where := "SupplierTypeCode='" + typeCode + "' and AccessCardNo='" + seqStr + "'"
  1301. has = codecSvc.GetEntity(&entitycert, where)
  1302. }
  1303. cols = []string{"JFAccessCardNo"}
  1304. entity.JFAccessCardNo = seqStr
  1305. } else if typeCode == "02" { // 基建
  1306. has := true
  1307. for has {
  1308. seqStr = codecSvc.GetJSAccessCardNo(this.User.AccCode)
  1309. where := "SupplierTypeCode='" + typeCode + "' and AccessCardNo='" + seqStr + "'"
  1310. has = codecSvc.GetEntity(&entitycert, where)
  1311. }
  1312. cols = []string{"JSAccessCardNo"}
  1313. entity.JSAccessCardNo = seqStr
  1314. }
  1315. codecSvc.UpdateEntityByIdCols(Id, &entity, cols)
  1316. var cert suppliercert.OilSupplierCert
  1317. certcols := []string{"AccessCardNo"}
  1318. cert.AccessCardNo = seqStr
  1319. codecSvc.UpdateEntityByIdCols(certId, &cert, certcols)
  1320. this.Data["json"] = seqStr
  1321. this.ServeJSON()
  1322. }
  1323. // @Title 修改准入标识
  1324. // @Description 修改准入标识
  1325. // @Success 200 {object} controllers.Request
  1326. // @router /updatainflag/ [get]
  1327. func (this *OilSupplierCertController) UpdataInFlag() {
  1328. t := time.Now()
  1329. session := utils.DBE.NewSession()
  1330. var certentitys []suppliercert.OilSupplierCert
  1331. svc := suppliercert.GetOilSupplierCertSession(session)
  1332. defer func() {
  1333. session.Close()
  1334. }()
  1335. err := session.Begin()
  1336. svc.GetEntities(&certentitys, "InFlag!='3'")
  1337. currenttime := time.Now()
  1338. //.Format("2006-01-02")
  1339. for i := 0; i < len(certentitys); i++ {
  1340. if currenttime.After(certentitys[i].ApplyTime) && !currenttime.After(certentitys[i].ApplyTime.AddDate(1, 0, 0)) && certentitys[i].InFlag != "2" {
  1341. var certentity suppliercert.OilSupplierCert
  1342. certentity.InFlag = "2"
  1343. cols := []string{"InFlag"}
  1344. _, err = svc.UpdateEntityByIdCols(certentitys[i].Id, &certentity, cols)
  1345. if err != nil {
  1346. session.Rollback()
  1347. }
  1348. }
  1349. if currenttime.After(certentitys[i].ApplyTime.AddDate(1, 0, 0)) {
  1350. fmt.Println(time.Now().Format("2006-01-02"), certentitys[i].ApplyTime.AddDate(1, 0, 0).Format("2006-01-02"))
  1351. var certentity suppliercert.OilSupplierCert
  1352. certentity.InFlag = "3"
  1353. cols := []string{"InFlag"}
  1354. _, err = svc.UpdateEntityByIdCols(certentitys[i].Id, &certentity, cols)
  1355. if err != nil {
  1356. session.Rollback()
  1357. }
  1358. }
  1359. }
  1360. err = session.Commit()
  1361. fmt.Println(err)
  1362. elapsed := time.Since(t)
  1363. fmt.Println(elapsed, "更新准入标识")
  1364. }
  1365. // @Title 保存准入编码
  1366. // @Description 保存准入编码
  1367. // @Success 200 {object} controllers.Request
  1368. // @router /saveaccesscardno/:Id [get]
  1369. func (this *OilSupplierCertController) SaveAccessCardNo() {
  1370. id := this.Ctx.Input.Param(":Id")
  1371. certId := this.GetString(("SupplierCertId"))
  1372. typeCode := this.GetString("typeCode")
  1373. accessCardNo := this.GetString("AccessCardNo")
  1374. var model []suppliercert.OilSupplierCert
  1375. var supplier supplier.OilSupplier
  1376. svc := suppliercert.GetOilSupplierCertService(utils.DBE)
  1377. where := "AccessCardNo='" + accessCardNo + "'"
  1378. svc.GetEntities(&model, where)
  1379. supcols := []string{}
  1380. if model == nil || len(model) == 0 {
  1381. if (typeCode == "01") { // 物质
  1382. supplier.WZAccessCardNo = accessCardNo
  1383. supcols = []string{"WZAccessCardNo"}
  1384. } else if typeCode == "03" { //技术服务
  1385. supplier.JFAccessCardNo = accessCardNo
  1386. supcols = []string{"JFAccessCardNo"}
  1387. } else if typeCode == "02" { // 基建
  1388. supplier.JSAccessCardNo = accessCardNo
  1389. supcols = []string{"JSAccessCardNo"}
  1390. }
  1391. svc.UpdateEntityByIdCols(id, &supplier, supcols)
  1392. var cert suppliercert.OilSupplierCert
  1393. certcols := []string{"AccessCardNo"}
  1394. cert.AccessCardNo = accessCardNo
  1395. svc.UpdateEntityByIdCols(certId, &cert, certcols)
  1396. var errinfo ErrorDataInfo
  1397. errinfo.Message = "保存成功!"
  1398. errinfo.Code = 0
  1399. this.Data["json"] = &errinfo
  1400. this.ServeJSON()
  1401. } else {
  1402. var errinfo ErrorDataInfo
  1403. errinfo.Message = "准入编码已经存在!"
  1404. errinfo.Code = -1
  1405. this.Data["json"] = &errinfo
  1406. this.ServeJSON()
  1407. }
  1408. }
  1409. // @Title 快到期短信通知
  1410. // @Description 修改准入标识
  1411. // @Success 200 {object} controllers.Request
  1412. // @router /sendingSMS/ [get]
  1413. func (this *OilSupplierCertController) SendingSMS() {
  1414. t := time.Now()
  1415. svcsupp := supplier.GetOilSupplierService(utils.DBE)
  1416. var list []supplier.OilSupplierView
  1417. where := "b.InFlag = '1'"
  1418. svcsupp.GetMyPagingEntitiesWithOrderBytbl(OilSupplierName, OilSupplierCertName, 0, 0, "Id", true, &list, where)
  1419. currenttime := time.Now()
  1420. for _, item := range list {
  1421. if currenttime.AddDate(0, 3, 0).Format("2006-01-02") == (item.ApplyTime.Format("2006-01-02")) {
  1422. toMobile := item.Mobile
  1423. msg := "您的" + item.SupplierTypeName + "准入还有3个月到期"
  1424. msgService := msg2.GetMsgService(utils.DBE)
  1425. msgService.HandleMsg(toMobile, msg, "1-1", item.CreateBy, item.ContactName, strconv.Itoa(item.CreateUserId))
  1426. }
  1427. if currenttime.AddDate(0, 2, 0).Format("2006-01-02") == (item.ApplyTime.Format("2006-01-02")) {
  1428. toMobile := item.Mobile
  1429. msg := "您的" + item.SupplierTypeName + "准入还有2个月到期"
  1430. msgService := msg2.GetMsgService(utils.DBE)
  1431. msgService.HandleMsg(toMobile, msg, "1-1", item.CreateBy, item.ContactName, strconv.Itoa(item.CreateUserId))
  1432. }
  1433. if currenttime.AddDate(0, 1, 0).Format("2006-01-02") == (item.ApplyTime.Format("2006-01-02")) {
  1434. toMobile := item.Mobile
  1435. msg := "您的" + item.SupplierTypeName + "准入还有1个月到期"
  1436. msgService := msg2.GetMsgService(utils.DBE)
  1437. msgService.HandleMsg(toMobile, msg, "1-1", item.CreateBy, item.ContactName, strconv.Itoa(item.CreateUserId))
  1438. }
  1439. }
  1440. elapsed := time.Since(t)
  1441. fmt.Println(elapsed, "快到期提醒")
  1442. }
  1443. // @Title 资质快到期短信通知
  1444. // @Description
  1445. // @Success 200 {object} controllers.Request
  1446. // @router /sendingSMSSupplierFile/ [get]
  1447. func (this *OilSupplierCertController) SendingSMSSupplierFile() {
  1448. t := time.Now()
  1449. svcsupp := supplier.GetOilSupplierService(utils.DBE)
  1450. var expireFile []supplier.ExpireFile
  1451. where := " b.EffectDate LIKE '%" + time.Now().AddDate(0, 1, 0).Format("2006-01-02") + "%'"
  1452. err := svcsupp.GetExpireFile(OilSupplierName, OilSupplierFileName, &expireFile, where)
  1453. if err == nil {
  1454. for _, item := range expireFile {
  1455. toMobile := item.Mobile
  1456. msg := "您的" + item.ExpireAllFile + "还有1个月到期"
  1457. msgService := msg2.GetMsgService(utils.DBE)
  1458. msgService.HandleMsg(toMobile, msg, "1-1", item.CreateBy, item.ContactName, strconv.Itoa(item.CreateUserId))
  1459. }
  1460. }
  1461. elapsed := time.Since(t)
  1462. fmt.Println(elapsed, "资质到期提醒")
  1463. }
  1464. // @Title 资质
  1465. // @Description
  1466. // @Success 200 {object} controllers.Request
  1467. // @router /changeSupplierStatus/ [get]
  1468. func (this *OilSupplierCertController) ChangeSupplierStatus() {
  1469. svcsupp := supplier.GetOilSupplierService(utils.DBE)
  1470. var fileData []supplier.ExpireFile
  1471. where := " b.EffectDate LIKE '%" + time.Now().AddDate(0, 0, -1).Format("2006-01-02") + "%'"
  1472. svcsupp.GetExpireFile(OilSupplierName, OilSupplierFileName, &fileData, where)
  1473. for _, item := range fileData {
  1474. var sert suppliercert.OilSupplierCert
  1475. cols := []string{
  1476. "InFlag",
  1477. }
  1478. sert.InFlag = "2"
  1479. where := "SupplierId=" + strconv.Itoa(item.Id) + " AND b.InFlag = '1'"
  1480. svcsupp.UpdateEntityBywheretbl(OilSupplierCertName, &sert, cols, where)
  1481. }
  1482. }
  1483. // @Title 更新Inflag状态
  1484. // @Description 企业入库
  1485. // @Success 200 {object} controllers.Request
  1486. // @router /reinput/:id [post]
  1487. func (this *OilSupplierCertController) ReInput() {
  1488. id := this.Ctx.Input.Param(":id")
  1489. var errinfo ErrorInfo
  1490. if id == "" {
  1491. errinfo.Message = "操作失败!请求信息不完整"
  1492. errinfo.Code = -2
  1493. this.Data["json"] = &errinfo
  1494. this.ServeJSON()
  1495. return
  1496. }
  1497. session := utils.DBE.NewSession()
  1498. svc := suppliercert.GetOilSupplierCertSession(session)
  1499. defer func() {
  1500. session.Close()
  1501. }()
  1502. err := session.Begin()
  1503. var model []suppliercert.Del_OilSupplierCert
  1504. where := "SupplierId=" + id
  1505. var sql string
  1506. sql = "select * from " + OilSupplierCertName + " where " + where
  1507. utils.DBE.SQL(sql).Find(&model)
  1508. isdelsupplier := false
  1509. if model != nil && len(model) > 0 {
  1510. isdelsupplier = true
  1511. }
  1512. for _, item := range model {
  1513. if item.InFlag == "3" {
  1514. where := "Id=" + strconv.Itoa(item.Id)
  1515. err = svc.DeleteEntityBytbl(OilSupplierCertName, where)
  1516. if err != nil {
  1517. session.Rollback()
  1518. errinfo.Message = "提交失败!" + utils.AlertProcess(err.Error())
  1519. errinfo.Code = -1
  1520. this.Data["json"] = &errinfo
  1521. this.ServeJSON()
  1522. return
  1523. }
  1524. item.DeleteDate = time.Now()
  1525. _, err = svc.InsertEntityBytbl(DelOilSupplierCertName, &item)
  1526. if err != nil {
  1527. session.Rollback()
  1528. errinfo.Message = "提交失败!" + utils.AlertProcess(err.Error())
  1529. errinfo.Code = -1
  1530. this.Data["json"] = &errinfo
  1531. this.ServeJSON()
  1532. return
  1533. }
  1534. // 交费信息
  1535. var delpay []paymentinfo.Del_OilPaymentInfo
  1536. wherepay := "SupplierCertId=" + strconv.Itoa(model[0].Id)
  1537. var sqlpay string
  1538. sqlpay = "select * from " + OilPaymentInfoName + " where " + wherepay
  1539. utils.DBE.SQL(sqlpay).Find(&delpay)
  1540. err = svc.DeleteEntityBytbl(OilPaymentInfoName, wherepay)
  1541. if err != nil {
  1542. session.Rollback()
  1543. errinfo.Message = "提交失败!" + utils.AlertProcess(err.Error())
  1544. errinfo.Code = -1
  1545. this.Data["json"] = &errinfo
  1546. this.ServeJSON()
  1547. return
  1548. }
  1549. for idx, _ := range delpay {
  1550. delpay[idx].DeleteDate = time.Now()
  1551. }
  1552. _, err = svc.InsertEntityBytbl(DelOilPaymentInfoName, &delpay)
  1553. if err != nil {
  1554. session.Rollback()
  1555. errinfo.Message = "提交失败!" + utils.AlertProcess(err.Error())
  1556. errinfo.Code = -1
  1557. this.Data["json"] = &errinfo
  1558. this.ServeJSON()
  1559. return
  1560. }
  1561. // 删除增项记录
  1562. var modelapp []suppliercertappend.Del_OilSupplierCertAppend
  1563. whereapp := "SupplierCertId=" + strconv.Itoa(model[0].Id)
  1564. var sqlapp string
  1565. sqlapp = "select * from " + OilSupplierCertAppendName + " where " + whereapp
  1566. utils.DBE.SQL(sqlapp).Find(&modelapp)
  1567. err = svc.DeleteEntityBytbl(OilSupplierCertAppendName, whereapp)
  1568. if err != nil {
  1569. session.Rollback()
  1570. errinfo.Message = "提交失败!" + utils.AlertProcess(err.Error())
  1571. errinfo.Code = -1
  1572. this.Data["json"] = &errinfo
  1573. this.ServeJSON()
  1574. return
  1575. }
  1576. for idx, _ := range modelapp {
  1577. modelapp[idx].DeleteDate = time.Now()
  1578. }
  1579. _, err = svc.InsertEntityBytbl(DelOilSupplierCertAppendName, &modelapp)
  1580. if err != nil {
  1581. session.Rollback()
  1582. errinfo.Message = "提交失败!" + utils.AlertProcess(err.Error())
  1583. errinfo.Code = -1
  1584. this.Data["json"] = &errinfo
  1585. this.ServeJSON()
  1586. return
  1587. }
  1588. // 删除年审记录
  1589. var modelann []annualaudit.Del_OilAnnualAudit
  1590. whereann := "CerId=" + strconv.Itoa(model[0].Id)
  1591. var sqlann string
  1592. sqlann = "select * from " + OilAnnualAuditName + " where " + whereann
  1593. utils.DBE.SQL(sqlann).Find(&modelann)
  1594. err = svc.DeleteEntityBytbl(OilAnnualAuditName, whereann)
  1595. if err != nil {
  1596. session.Rollback()
  1597. errinfo.Message = "提交失败!" + utils.AlertProcess(err.Error())
  1598. errinfo.Code = -1
  1599. this.Data["json"] = &errinfo
  1600. this.ServeJSON()
  1601. return
  1602. }
  1603. for idx, _ := range modelann {
  1604. modelann[idx].DeleteDate = time.Now()
  1605. }
  1606. _, err = svc.InsertEntityBytbl(DelOilAnnualAuditName, &modelann)
  1607. if err != nil {
  1608. session.Rollback()
  1609. errinfo.Message = "提交失败!" + utils.AlertProcess(err.Error())
  1610. errinfo.Code = -1
  1611. this.Data["json"] = &errinfo
  1612. this.ServeJSON()
  1613. return
  1614. }
  1615. // 删除准入范围
  1616. var certsup []suppliercertsub.Del_OilSupplierCertSub
  1617. wheresup := "SupplierCertId=" + strconv.Itoa(model[0].Id)
  1618. var sqlsup string
  1619. sqlsup = "select * from " + OilSupplierCertSubName + " where " + wheresup
  1620. utils.DBE.SQL(sqlsup).Find(&certsup)
  1621. err = svc.DeleteEntityBytbl(OilSupplierCertSubName, wheresup)
  1622. if err != nil {
  1623. session.Rollback()
  1624. errinfo.Message = "提交失败!" + utils.AlertProcess(err.Error())
  1625. errinfo.Code = -1
  1626. this.Data["json"] = &errinfo
  1627. this.ServeJSON()
  1628. return
  1629. }
  1630. for idx, _ := range certsup {
  1631. certsup[idx].DeleteDate = time.Now()
  1632. }
  1633. _, err = svc.InsertEntityBytbl(DelOilSupplierCertSubName, &certsup)
  1634. if err != nil {
  1635. session.Rollback()
  1636. errinfo.Message = "提交失败!" + utils.AlertProcess(err.Error())
  1637. errinfo.Code = -1
  1638. this.Data["json"] = &errinfo
  1639. this.ServeJSON()
  1640. return
  1641. }
  1642. } else {
  1643. isdelsupplier = false
  1644. }
  1645. }
  1646. if isdelsupplier {
  1647. // 删除企业信息
  1648. var modelsupp supplier.Del_OilSupplier
  1649. where := "Id=" + strconv.Itoa(model[0].SupplierId)
  1650. var sql string
  1651. sql = "select * from " + OilSupplierName + " where " + where
  1652. utils.DBE.SQL(sql).Get(&modelsupp)
  1653. err = svc.DeleteEntityBytbl(OilSupplierName, where)
  1654. if err != nil {
  1655. session.Rollback()
  1656. errinfo.Message = "提交失败!" + utils.AlertProcess(err.Error())
  1657. errinfo.Code = -1
  1658. this.Data["json"] = &errinfo
  1659. this.ServeJSON()
  1660. return
  1661. }
  1662. modelsupp.DeleteDate = time.Now()
  1663. _, err = svc.InsertEntityBytbl(DelOilSupplierName, &modelsupp)
  1664. if err != nil {
  1665. session.Rollback()
  1666. errinfo.Message = "提交失败!" + utils.AlertProcess(err.Error())
  1667. errinfo.Code = -1
  1668. this.Data["json"] = &errinfo
  1669. this.ServeJSON()
  1670. return
  1671. }
  1672. // 删除企业资质
  1673. var delfile []supplierfile.Del_OilSupplierFile
  1674. wheref := "SupplierId=" + strconv.Itoa(model[0].SupplierId)
  1675. var sqlw string
  1676. sqlw = "select * from " + OilSupplierFileName + " where " + wheref
  1677. utils.DBE.SQL(sqlw).Find(&delfile)
  1678. err = svc.DeleteEntityBytbl(OilSupplierFileName, wheref)
  1679. if err != nil {
  1680. session.Rollback()
  1681. errinfo.Message = "提交失败!" + utils.AlertProcess(err.Error())
  1682. errinfo.Code = -1
  1683. this.Data["json"] = &errinfo
  1684. this.ServeJSON()
  1685. return
  1686. }
  1687. for idx, _ := range delfile {
  1688. delfile[idx].DeleteDate = time.Now()
  1689. }
  1690. _, err = svc.InsertEntityBytbl(DelOilSupplierFileName, &delfile)
  1691. if err != nil {
  1692. session.Rollback()
  1693. errinfo.Message = "提交失败!" + utils.AlertProcess(err.Error())
  1694. errinfo.Code = -1
  1695. this.Data["json"] = &errinfo
  1696. this.ServeJSON()
  1697. return
  1698. }
  1699. // 删除信息变更
  1700. var delinfo []infochange.Del_OilInfoChange
  1701. whereinfo := "SupplierId=" + strconv.Itoa(model[0].SupplierId)
  1702. var sqlinfo string
  1703. sqlinfo = "select * from " + OilInfoChangeName + " where " + whereinfo
  1704. utils.DBE.SQL(sqlinfo).Find(&delinfo)
  1705. err = svc.DeleteEntityBytbl(OilInfoChangeName, whereinfo)
  1706. if err != nil {
  1707. session.Rollback()
  1708. errinfo.Message = "提交失败!" + utils.AlertProcess(err.Error())
  1709. errinfo.Code = -1
  1710. this.Data["json"] = &errinfo
  1711. this.ServeJSON()
  1712. return
  1713. }
  1714. for idx, _ := range delinfo {
  1715. delinfo[idx].DeleteDate = time.Now()
  1716. }
  1717. _, err = svc.InsertEntityBytbl(DelOilInfoChangeName, &delinfo)
  1718. if err != nil {
  1719. session.Rollback()
  1720. errinfo.Message = "提交失败!" + utils.AlertProcess(err.Error())
  1721. errinfo.Code = -1
  1722. this.Data["json"] = &errinfo
  1723. this.ServeJSON()
  1724. return
  1725. }
  1726. }
  1727. err = session.Commit()
  1728. if err == nil {
  1729. errinfo.Message = "提交成功!"
  1730. errinfo.Code = 0
  1731. this.Data["json"] = &errinfo
  1732. this.ServeJSON()
  1733. } else {
  1734. errinfo.Message = "提交失败!" + utils.AlertProcess(err.Error())
  1735. errinfo.Code = -1
  1736. this.Data["json"] = &errinfo
  1737. this.ServeJSON()
  1738. }
  1739. }
  1740. // @Title 修改年审到期时间
  1741. // @Description 修改年审到期时间
  1742. // @Success 200 {object} controllers.Request
  1743. // @router /updataapplytime/:id [post]
  1744. func (this *OilSupplierCertController) UpdataApplyTime() {
  1745. session := utils.DBE.NewSession()
  1746. defer func() {
  1747. session.Close()
  1748. }()
  1749. id := this.Ctx.Input.Param(":id")
  1750. var errinfo ErrorInfo
  1751. if id == "" {
  1752. errinfo.Message = "操作失败!请求信息不完整"
  1753. errinfo.Code = -2
  1754. this.Data["json"] = &errinfo
  1755. this.ServeJSON()
  1756. return
  1757. }
  1758. var model supplierapplytime.OilSupplierApplyTime
  1759. svc := suppliercert.GetOilSupplierCertSession(session)
  1760. var jsonBlob = this.Ctx.Input.RequestBody
  1761. json.Unmarshal(jsonBlob, &model)
  1762. model.CreateOn = time.Now()
  1763. model.CreateBy = this.User.Realname
  1764. model.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
  1765. //model.OrganizeId, _ = utils.StrTo(this.User.DepartmentId).Int()
  1766. _, err := svc.InsertEntityBytbl(SupplierApplyTimeName, &model)
  1767. if err != nil {
  1768. session.Rollback()
  1769. errinfo.Message = "修改失败!" + utils.AlertProcess(err.Error())
  1770. errinfo.Code = -1
  1771. this.Data["json"] = &errinfo
  1772. this.ServeJSON()
  1773. return
  1774. }
  1775. var modelcert suppliercert.OilSupplierCert
  1776. modelcert.ApplyTime = model.AfterDate
  1777. if model.AfterDate.Unix() < time.Now().Unix() {
  1778. modelcert.InFlag = "2"
  1779. } else {
  1780. modelcert.InFlag = "1"
  1781. }
  1782. var cols = []string{
  1783. "ApplyTime",
  1784. "InFlag",
  1785. }
  1786. err = svc.UpdateEntityBytbl(OilSupplierCertName, id, &modelcert, cols)
  1787. if err != nil {
  1788. session.Rollback()
  1789. errinfo.Message = "修改失败!" + utils.AlertProcess(err.Error())
  1790. errinfo.Code = -1
  1791. this.Data["json"] = &errinfo
  1792. this.ServeJSON()
  1793. return
  1794. }
  1795. err = session.Commit()
  1796. if err == nil {
  1797. errinfo.Message = "修改成功!"
  1798. errinfo.Code = 0
  1799. this.Data["json"] = &errinfo
  1800. this.ServeJSON()
  1801. } else {
  1802. errinfo.Message = "修改失败!" + utils.AlertProcess(err.Error())
  1803. errinfo.Code = -1
  1804. this.Data["json"] = &errinfo
  1805. this.ServeJSON()
  1806. }
  1807. }
  1808. // @Title 获取列表
  1809. // @Description get user by token
  1810. // @Success 200 {object} []suppliercert.OilSupplierCert
  1811. // @router /getapplytimelist [get]
  1812. func (this *OilSupplierCertController) GetApplyTimeList() {
  1813. SupplierCertId := this.GetString("SupplierCertId")
  1814. var model []supplierapplytime.OilSupplierApplyTime
  1815. svc := suppliercert.GetOilSupplierCertService(utils.DBE)
  1816. where := "SupplierCertId = " + SupplierCertId
  1817. svc.GetEntities(&model, where)
  1818. var errinfo ErrorDataInfo
  1819. errinfo.Message = "修改成功!"
  1820. errinfo.Code = 0
  1821. errinfo.Item = model
  1822. this.Data["json"] = &model
  1823. this.ServeJSON()
  1824. }