seal_approval.go 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695
  1. package seal
  2. import (
  3. "encoding/json"
  4. "github.com/rdlucklib/rdluck_tools/paging"
  5. "hongze/hz_crm_api/controllers"
  6. "hongze/hz_crm_api/models"
  7. "hongze/hz_crm_api/models/seal/request"
  8. "hongze/hz_crm_api/models/seal/response"
  9. "hongze/hz_crm_api/services/seal"
  10. "hongze/hz_crm_api/utils"
  11. "strings"
  12. )
  13. // 用印审批管理
  14. type SealApprovalController struct {
  15. controllers.BaseAuthController
  16. }
  17. // 用印审批列表-分页
  18. // @Title 用印审批列表
  19. // @Description 用印审批列表
  20. // @Param PageSize query int true "每页数据条数"
  21. // @Param CurrentIndex query int true "当前页页码,从1开始"
  22. // @Param ContractType query string false "合同类型 新签合同/续签合同/代付合同"
  23. // @Param Status query string false "用印状态 待审批/处理中/已审批/已驳回/已签回/已作废"
  24. // @Param SellerId query string false "所属销售ID,多个逗号拼接"
  25. // @Param StartTime query string false "提交开始时间"
  26. // @Param EndTime query string false "提交结束时间"
  27. // @Param Keyword query string false "搜索关键词(客户名称/社会信用码)"
  28. // @Success 200 {object} response.SealApprovalListResp
  29. // @router /getApprovalPageList [get]
  30. func (this *SealApprovalController) List() {
  31. br := new(models.BaseResponse).Init()
  32. defer func() {
  33. this.Data["json"] = br
  34. this.ServeJSON()
  35. }()
  36. sysUser := this.SysUser
  37. if sysUser == nil {
  38. br.Msg = "请登录"
  39. br.ErrMsg = "请登录,SysUser is Empty"
  40. br.Ret = 408
  41. return
  42. }
  43. // 分页
  44. pageSize, _ := this.GetInt("PageSize")
  45. currentIndex, _ := this.GetInt("CurrentIndex")
  46. var startSize int
  47. if pageSize <= 0 {
  48. pageSize = utils.PageSize20
  49. }
  50. if currentIndex <= 0 {
  51. currentIndex = 1
  52. }
  53. startSize = paging.StartIndex(currentIndex, pageSize)
  54. // 筛选条件
  55. condition := ""
  56. joinCondition := " AND a.curr_node_id = d.node_id" // contract_approval和contract_approval_record的join条件
  57. pars := make([]interface{}, 0)
  58. // 数据权限
  59. reqStatus := this.GetString("Status")
  60. if sysUser.RoleTypeCode == utils.ROLE_TYPE_CODE_ADMIN {
  61. // 超管
  62. condition += ` AND c.status != "已撤回" `
  63. if reqStatus != "" {
  64. if reqStatus == "待审批" {
  65. // 当前审批节点小于等于审批节点且状态为-待审批
  66. condition += ` AND (a.curr_node_id <= a.start_node_id AND c.status = "待审批") `
  67. joinCondition = ``
  68. } else if reqStatus == "处理中" {
  69. // 当前审批节点大于开始审批节点且状态为-待审批
  70. condition += ` AND (a.curr_node_id > a.start_node_id AND c.status = "待审批")`
  71. } else {
  72. condition += ` AND c.status = ?`
  73. pars = append(pars, reqStatus)
  74. }
  75. }
  76. } else if sysUser.RoleTypeCode == utils.ROLE_TYPE_CODE_COMPLIANCE {
  77. // 合规
  78. if reqStatus != "" {
  79. if reqStatus == "待审批" {
  80. condition += ` AND (d.approve_user_id = ? AND a.curr_node_id <= d.node_id AND d.node_type != "cc") AND c.status="待审批"`
  81. joinCondition = ``
  82. pars = append(pars, sysUser.AdminId)
  83. } else if reqStatus == "处理中" {
  84. condition += ` AND (d.approve_user_id = ? AND a.curr_node_id > d.node_id AND d.node_type != "cc") AND c.status="待审批"`
  85. joinCondition = " AND a.curr_node_id != d.node_id"
  86. pars = append(pars, sysUser.AdminId)
  87. } else if reqStatus == "已撤回" {
  88. condition += ` AND c.status = ? AND c.user_id = ?`
  89. pars = append(pars, reqStatus, sysUser.AdminId)
  90. } else {
  91. condition += ` AND c.status = ?`
  92. pars = append(pars, reqStatus)
  93. }
  94. } else {
  95. condition += ` AND (c.status = "已撤回" AND c.user_id = ? ) OR (c.status != "已撤回") AND (c.status != "待提交")`
  96. pars = append(pars, sysUser.AdminId)
  97. }
  98. } else {
  99. // 销售
  100. condition += ` AND (c.user_id = ? OR (d.approve_user_id = ? AND d.node_id <= a.curr_node_id) OR (d.approve_user_id = ? AND d.node_type = "cc") )`
  101. pars = append(pars, sysUser.AdminId, sysUser.AdminId, sysUser.AdminId)
  102. if reqStatus != "" {
  103. switch reqStatus {
  104. case "待审批":
  105. condition += ` AND c.status = "待审批" AND ( (((c.user_id = ? and a.start_node_id = a.curr_node_id) OR (d.approve_user_id = ? AND a.curr_node_id=d.node_id)) ) OR (d.approve_user_id = ? AND a.curr_node_id > d.node_id AND d.node_type="cc") )`
  106. joinCondition = ``
  107. pars = append(pars, sysUser.AdminId, sysUser.AdminId, sysUser.AdminId)
  108. case "处理中":
  109. condition += ` AND ((c.user_id = ? AND a.start_node_id != a.curr_node_id) OR (d.approve_user_id = ? AND a.curr_node_id > d.node_id AND d.node_type != "cc")) AND c.status="待审批" `
  110. joinCondition = " AND a.curr_node_id != d.node_id"
  111. pars = append(pars, sysUser.AdminId, sysUser.AdminId)
  112. case "已撤回":
  113. condition += ` AND (c.status = "已撤回" AND c.user_id = ? ) `
  114. pars = append(pars, sysUser.AdminId)
  115. case "已审批", "已驳回", "已签回", "已作废":
  116. joinCondition = ``
  117. condition += ` AND c.status = ?`
  118. pars = append(pars, reqStatus)
  119. }
  120. } else {
  121. joinCondition = ``
  122. condition += ` AND ((c.status = "已撤回" AND c.user_id = ? ) OR (c.status != "已撤回")) `
  123. pars = append(pars, sysUser.AdminId)
  124. }
  125. }
  126. // 合同类型
  127. reqContractType := this.GetString("ContractType")
  128. if reqContractType != "" {
  129. condition += ` AND c.service_type = ? `
  130. pars = append(pars, reqContractType)
  131. }
  132. // 所属销售-多个
  133. reqSellerId := this.GetString("SellerId")
  134. if reqSellerId != "" {
  135. condition += ` AND c.user_id IN (` + reqSellerId + `)`
  136. }
  137. // 提交时间
  138. reqStartTime := this.GetString("StartTime")
  139. reqEndTime := this.GetString("EndTime")
  140. if reqStartTime != "" && reqEndTime != "" {
  141. reqStartTime += " 00:00:00"
  142. reqEndTime += " 23:59:59"
  143. condition += ` AND c.create_time >= ? AND c.create_time <= ?`
  144. pars = append(pars, reqStartTime, reqEndTime)
  145. }
  146. // 客户名称-社会信用码
  147. reqKeyword := this.GetString("Keyword")
  148. if reqKeyword != "" {
  149. keywords := "%" + reqKeyword + "%"
  150. condition += ` AND (c.company_name LIKE ? OR c.use_company_name LIKE ? OR c.credit_code LIKE ?)`
  151. pars = append(pars, keywords, keywords, keywords)
  152. }
  153. // 列表
  154. listData, listTotal, err := seal.GetSealApprovalPageList(condition, joinCondition, pars, startSize, pageSize, sysUser)
  155. if err != nil {
  156. br.Msg = "审批列表获取失败!"
  157. br.ErrMsg = "审批列表获取失败!" + err.Error()
  158. return
  159. }
  160. page := paging.GetPaging(currentIndex, pageSize, listTotal)
  161. br.Ret = 200
  162. br.Success = true
  163. br.Msg = "获取成功"
  164. br.Data = response.SealApprovalListResp{
  165. Paging: page,
  166. List: listData,
  167. }
  168. }
  169. // 用印申请
  170. // @Title 用印申请
  171. // @Description 用印申请
  172. // @Param request body request.SealApprovalApplyReq true "type json string"
  173. // @Success 200 申请成功
  174. // @router /applySealApproval [post]
  175. func (this *SealApprovalController) Apply() {
  176. br := new(models.BaseResponse).Init()
  177. defer func() {
  178. this.Data["json"] = br
  179. this.ServeJSON()
  180. }()
  181. sysUser := this.SysUser
  182. if sysUser == nil {
  183. br.Msg = "请登录"
  184. br.ErrMsg = "请登录,SysUser is Empty"
  185. br.Ret = 408
  186. return
  187. }
  188. var req request.SealApprovalApplyReq
  189. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  190. if err != nil {
  191. br.Msg = "参数解析异常!"
  192. br.ErrMsg = "参数解析异常!Err:" + err.Error()
  193. return
  194. }
  195. reqVerify := utils.Rules{
  196. "Use": {utils.NotEmpty()},
  197. "CompanyName": {utils.NotEmpty()},
  198. "CreditCode": {utils.NotEmpty()},
  199. "ServiceType": {utils.NotEmpty()},
  200. "SealType": {utils.NotEmpty()},
  201. "FileUrls": {utils.NotEmpty()},
  202. }
  203. err = utils.Verify(req, reqVerify, utils.LANG_CN)
  204. if err != nil {
  205. br.Msg = "参数丢失!"
  206. br.ErrMsg = "参数丢失!Err:" + err.Error()
  207. return
  208. }
  209. // 申请用印
  210. err = seal.ApplySeal(this.SysUser, req)
  211. if err != nil {
  212. br.Msg = "申请用印失败!"
  213. br.ErrMsg = "申请用印失败!Err:" + err.Error()
  214. return
  215. }
  216. br.Ret = 200
  217. br.Success = true
  218. br.Msg = "申请用印成功"
  219. }
  220. // 编辑用印申请
  221. // @Title 编辑用印申请
  222. // @Description 编辑用印申请
  223. // @Param request body request.SealApprovalEditReq true "type json string"
  224. // @Success 200 操作成功
  225. // @router /editSealApproval [post]
  226. func (this *SealApprovalController) Edit() {
  227. br := new(models.BaseResponse).Init()
  228. defer func() {
  229. this.Data["json"] = br
  230. this.ServeJSON()
  231. }()
  232. sysUser := this.SysUser
  233. if sysUser == nil {
  234. br.Msg = "请登录"
  235. br.ErrMsg = "请登录,SysUser is Empty"
  236. br.Ret = 408
  237. return
  238. }
  239. var req request.SealApprovalEditReq
  240. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  241. if err != nil {
  242. br.Msg = "参数解析异常!"
  243. br.ErrMsg = "参数解析异常!Err:" + err.Error()
  244. return
  245. }
  246. if req.SealId <= 0 {
  247. br.Msg = "用印审批ID有误"
  248. br.ErrMsg = "用印审批ID有误"
  249. return
  250. }
  251. if req.Use == "" {
  252. br.Msg = "用印用途不能为空"
  253. br.ErrMsg = "用印用途不能为空"
  254. return
  255. }
  256. if req.CompanyName == "" {
  257. br.Msg = "客户名称不能为空"
  258. br.ErrMsg = "客户名称不能为空"
  259. return
  260. }
  261. if req.CreditCode == "" {
  262. br.Msg = "社会统一信用代码不能为空"
  263. br.ErrMsg = "社会统一信用代码不能为空"
  264. return
  265. }
  266. if req.ServiceType == "" {
  267. br.Msg = "合同类型不能为空"
  268. br.ErrMsg = "合同类型不能为空"
  269. return
  270. }
  271. if req.SealType == "" {
  272. br.Msg = "印章类型不能为空"
  273. br.ErrMsg = "印章类型不能为空"
  274. return
  275. }
  276. if len(req.FileUrls) == 0 {
  277. br.Msg = "合同附件不能为空"
  278. br.ErrMsg = "合同附件不能为空"
  279. return
  280. }
  281. // 编辑用印
  282. err = seal.EditApply(this.SysUser, req)
  283. if err != nil {
  284. br.Msg = "编辑用印申请失败!"
  285. br.ErrMsg = "编辑用印申请失败!Err:" + err.Error()
  286. return
  287. }
  288. br.Ret = 200
  289. br.Success = true
  290. br.Msg = "编辑用印申请成功"
  291. }
  292. // 审批角色编辑
  293. // @Title 审批角色编辑
  294. // @Description 审批角色编辑
  295. // @Param request body request.SealApprovalEditReq true "type json string"
  296. // @Success 200 操作成功
  297. // @router /verifierEditSealApproval [post]
  298. func (this *SealApprovalController) VerifierEdit() {
  299. br := new(models.BaseResponse).Init()
  300. defer func() {
  301. this.Data["json"] = br
  302. this.ServeJSON()
  303. }()
  304. sysUser := this.SysUser
  305. if sysUser == nil {
  306. br.Msg = "请登录"
  307. br.ErrMsg = "请登录,SysUser is Empty"
  308. br.Ret = 408
  309. return
  310. }
  311. var req request.SealApprovalEditReq
  312. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  313. if err != nil {
  314. br.Msg = "参数解析异常!"
  315. br.ErrMsg = "参数解析异常!Err:" + err.Error()
  316. return
  317. }
  318. if req.SealId <= 0 {
  319. br.Msg = "用印审批ID有误"
  320. br.ErrMsg = "用印审批ID有误"
  321. return
  322. }
  323. if req.Use == "" {
  324. br.Msg = "用印用途不能为空"
  325. br.ErrMsg = "用印用途不能为空"
  326. return
  327. }
  328. if req.CompanyName == "" {
  329. br.Msg = "客户名称不能为空"
  330. br.ErrMsg = "客户名称不能为空"
  331. return
  332. }
  333. if req.CreditCode == "" {
  334. br.Msg = "社会统一信用代码不能为空"
  335. br.ErrMsg = "社会统一信用代码不能为空"
  336. return
  337. }
  338. if req.ServiceType == "" {
  339. br.Msg = "合同类型不能为空"
  340. br.ErrMsg = "合同类型不能为空"
  341. return
  342. }
  343. if req.SealType == "" {
  344. br.Msg = "印章类型不能为空"
  345. br.ErrMsg = "印章类型不能为空"
  346. return
  347. }
  348. if len(req.FileUrls) == 0 {
  349. br.Msg = "合同附件不能为空"
  350. br.ErrMsg = "合同附件不能为空"
  351. return
  352. }
  353. // 审批者编辑
  354. err = seal.VerifierEditApply(this.SysUser, req)
  355. if err != nil {
  356. br.Msg = "编辑用印申请失败!"
  357. br.ErrMsg = "编辑用印申请失败!Err:" + err.Error()
  358. return
  359. }
  360. br.Ret = 200
  361. br.Success = true
  362. br.Msg = "编辑用印申请成功"
  363. }
  364. // 用印审批详情
  365. // @Title 用印审批详情
  366. // @Description 用印审批详情
  367. // @Param SealId query int false "用印审批ID"
  368. // @Success 200 {object} response.SealApprovalDetail
  369. // @router /getSealApprovalDetail [get]
  370. func (this *SealApprovalController) Detail() {
  371. br := new(models.BaseResponse).Init()
  372. defer func() {
  373. this.Data["json"] = br
  374. this.ServeJSON()
  375. }()
  376. sysUser := this.SysUser
  377. if sysUser == nil {
  378. br.Msg = "请登录"
  379. br.ErrMsg = "请登录,SysUser is Empty"
  380. br.Ret = 408
  381. return
  382. }
  383. sealId, _ := this.GetInt("SealId")
  384. sealInfo, flowNodeListResp, opButton, err := seal.GetSealApprovalDetail(sealId, sysUser)
  385. if err != nil {
  386. br.Msg = "获取用印详情失败"
  387. br.ErrMsg = "获取用印详情失败,Err:" + err.Error()
  388. return
  389. }
  390. br.Ret = 200
  391. br.Success = true
  392. br.Msg = "获取成功"
  393. br.Data = response.SealApprovalDetail{
  394. SealDetail: sealInfo,
  395. FlowNodeList: flowNodeListResp,
  396. OpButton: opButton,
  397. }
  398. }
  399. // 撤回用印申请
  400. // @Title 撤回用印申请
  401. // @Description 撤回用印申请
  402. // @Param request body request.SealApprovalCancelReq true "type json string"
  403. // @Success 200 操作成功
  404. // @router /cancelSealApproval [post]
  405. func (this *SealApprovalController) Cancel() {
  406. br := new(models.BaseResponse).Init()
  407. defer func() {
  408. this.Data["json"] = br
  409. this.ServeJSON()
  410. }()
  411. sysUser := this.SysUser
  412. if sysUser == nil {
  413. br.Msg = "请登录"
  414. br.ErrMsg = "请登录,SysUser is Empty"
  415. br.Ret = 408
  416. return
  417. }
  418. var req request.SealApprovalCancelReq
  419. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  420. if err != nil {
  421. br.Msg = "参数解析异常!"
  422. br.ErrMsg = "参数解析异常!Err:" + err.Error()
  423. return
  424. }
  425. if req.SealId <= 0 {
  426. br.Msg = "参数异常!"
  427. br.ErrMsg = "参数异常!"
  428. return
  429. }
  430. err = seal.CancelSealApproval(req.SealId, sysUser)
  431. if err != nil {
  432. br.Msg = "用印审批撤回失败"
  433. br.ErrMsg = "用印审批撤回失败,Err:" + err.Error()
  434. return
  435. }
  436. br.Ret = 200
  437. br.Success = true
  438. br.Msg = "操作成功"
  439. }
  440. // 删除用印申请
  441. // @Title 删除用印申请
  442. // @Description 删除用印申请
  443. // @Param request body request.SealApprovalDelReq true "type json string"
  444. // @Success 200 操作成功
  445. // @router /delSealApproval [post]
  446. func (this *SealApprovalController) Del() {
  447. br := new(models.BaseResponse).Init()
  448. defer func() {
  449. this.Data["json"] = br
  450. this.ServeJSON()
  451. }()
  452. sysUser := this.SysUser
  453. if sysUser == nil {
  454. br.Msg = "请登录"
  455. br.ErrMsg = "请登录,SysUser is Empty"
  456. br.Ret = 408
  457. return
  458. }
  459. var req request.SealApprovalDelReq
  460. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  461. if err != nil {
  462. br.Msg = "参数解析异常!"
  463. br.ErrMsg = "参数解析异常!Err:" + err.Error()
  464. return
  465. }
  466. if req.SealId <= 0 {
  467. br.Msg = "参数异常!"
  468. br.ErrMsg = "参数异常!"
  469. return
  470. }
  471. err = seal.DelSealApproval(req.SealId, sysUser)
  472. if err != nil {
  473. br.Msg = "用印申请删除失败"
  474. br.ErrMsg = "用印申请删除失败,Err:" + err.Error()
  475. return
  476. }
  477. br.Ret = 200
  478. br.Success = true
  479. br.Msg = "操作成功"
  480. }
  481. // 通过用印申请
  482. // @Title 通过用印申请
  483. // @Description 通过用印申请
  484. // @Param request body request.SealApplyApprovedReq true "type json string"
  485. // @Success 200 操作成功
  486. // @router /approvedSealApproval [post]
  487. func (this *SealApprovalController) Approved() {
  488. br := new(models.BaseResponse).Init()
  489. defer func() {
  490. this.Data["json"] = br
  491. this.ServeJSON()
  492. }()
  493. sysUser := this.SysUser
  494. if sysUser == nil {
  495. br.Msg = "请登录"
  496. br.ErrMsg = "请登录,SysUser is Empty"
  497. br.Ret = 408
  498. return
  499. }
  500. var req request.SealApplyApprovedReq
  501. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  502. if err != nil {
  503. br.Msg = "参数解析异常!"
  504. br.ErrMsg = "参数解析异常!Err:" + err.Error()
  505. return
  506. }
  507. if req.SealId <= 0 {
  508. br.Msg = "参数异常!"
  509. br.ErrMsg = "参数异常!"
  510. return
  511. }
  512. err = seal.ApprovedApproval(req.SealId, sysUser, req.Remark)
  513. if err != nil {
  514. br.Msg = "用印审批失败"
  515. br.ErrMsg = "用印审批失败,Err:" + err.Error()
  516. return
  517. }
  518. br.Ret = 200
  519. br.Success = true
  520. br.Msg = "操作成功"
  521. }
  522. // 驳回用印申请
  523. // @Title 驳回用印申请
  524. // @Description 驳回用印申请
  525. // @Param request body request.SealApplyRejectReq true "type json string"
  526. // @Success 200 操作成功
  527. // @router /rejectSealApproval [post]
  528. func (this *SealApprovalController) Reject() {
  529. br := new(models.BaseResponse).Init()
  530. defer func() {
  531. this.Data["json"] = br
  532. this.ServeJSON()
  533. }()
  534. sysUser := this.SysUser
  535. if sysUser == nil {
  536. br.Msg = "请登录"
  537. br.ErrMsg = "请登录,SysUser is Empty"
  538. br.Ret = 408
  539. return
  540. }
  541. var req request.SealApplyRejectReq
  542. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  543. if err != nil {
  544. br.Msg = "参数解析异常!"
  545. br.ErrMsg = "参数解析异常!Err:" + err.Error()
  546. return
  547. }
  548. if req.SealId <= 0 {
  549. br.Msg = "参数异常!"
  550. br.ErrMsg = "参数异常!"
  551. return
  552. }
  553. remark := strings.Trim(req.Remark, " ")
  554. if remark == "" {
  555. br.Msg = "请输入驳回理由"
  556. br.ErrMsg = "请输入驳回理由"
  557. return
  558. }
  559. err = seal.RejectApproval(req.SealId, sysUser, remark)
  560. if err != nil {
  561. br.Msg = "用印驳回失败"
  562. br.ErrMsg = "用印驳回失败,Err:" + err.Error()
  563. return
  564. }
  565. br.Ret = 200
  566. br.Success = true
  567. br.Msg = "操作成功"
  568. }
  569. // 作废用印申请
  570. // @Title 作废用印申请
  571. // @Description 作废用印申请
  572. // @Param request body request.SealApplyInvalidReq true "type json string"
  573. // @Success 200 操作成功
  574. // @router /invalidSealApproval [post]
  575. func (this *SealApprovalController) Invalid() {
  576. br := new(models.BaseResponse).Init()
  577. defer func() {
  578. this.Data["json"] = br
  579. this.ServeJSON()
  580. }()
  581. sysUser := this.SysUser
  582. if sysUser == nil {
  583. br.Msg = "请登录"
  584. br.ErrMsg = "请登录,SysUser is Empty"
  585. br.Ret = 408
  586. return
  587. }
  588. var req request.SealApprovalInvalidReq
  589. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  590. if err != nil {
  591. br.Msg = "参数解析异常!"
  592. br.ErrMsg = "参数解析异常!Err:" + err.Error()
  593. return
  594. }
  595. if req.SealId <= 0 {
  596. br.Msg = "参数异常!"
  597. br.ErrMsg = "参数异常!"
  598. return
  599. }
  600. err = seal.InvalidSealApproval(req.SealId, sysUser)
  601. if err != nil {
  602. br.Msg = "用印作废失败"
  603. br.ErrMsg = "用印作废失败,Err:" + err.Error()
  604. return
  605. }
  606. br.Ret = 200
  607. br.Success = true
  608. br.Msg = "操作成功"
  609. }
  610. // OperationList
  611. // @Title 用印操作日志列表
  612. // @Description 用印操作日志列表接口
  613. // @Param SealId query int true "用印申请ID"
  614. // @Success 200 {object} response.SealOperationListResp
  615. // @router /getOperationList [get]
  616. func (this *SealApprovalController) OperationList() {
  617. br := new(models.BaseResponse).Init()
  618. defer func() {
  619. this.Data["json"] = br
  620. this.ServeJSON()
  621. }()
  622. sysUser := this.SysUser
  623. if sysUser == nil {
  624. br.Msg = "请登录"
  625. br.ErrMsg = "请登录,SysUser is Empty"
  626. br.Ret = 408
  627. return
  628. }
  629. reqSealId, _ := this.GetInt("SealId", 0)
  630. if reqSealId <= 0 {
  631. br.Msg = "用印申请编号获取失败!"
  632. br.ErrMsg = "用印申请编号获取失败!"
  633. return
  634. }
  635. list, err := seal.GetSealOperationRecordList(reqSealId)
  636. if err != nil {
  637. br.Msg = "获取列表失败!"
  638. br.ErrMsg = "获取列表失败!"
  639. return
  640. }
  641. br.Ret = 200
  642. br.Msg = "获取成功"
  643. br.Success = true
  644. br.Data = response.SealOperationListResp{
  645. List: list,
  646. }
  647. }