mirror of
https://gitee.com/xiangheng/x_admin.git
synced 2025-12-24 08:12:55 +08:00
审批流优化
This commit is contained in:
@@ -9,27 +9,25 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type FlowApplyHandler struct {
|
||||
Service IFlowApplyService
|
||||
}
|
||||
type FlowApplyHandler struct{}
|
||||
|
||||
// @Summary 申请流程列表
|
||||
// @Tags flow_apply-申请流程
|
||||
// @Produce json
|
||||
// @Param Token header string true "token"
|
||||
// @Param PageNo query int true "页码"
|
||||
// @Param PageSize query int true "每页数量"
|
||||
// @Param templateId query int false "模板"
|
||||
// @Param applyUserId query int false "申请人id"
|
||||
// @Param applyUserNickname query string false "申请人昵称"
|
||||
// @Param flowName query string false "流程名称"
|
||||
// @Param flowGroup query int false "流程分类"
|
||||
// @Param flowRemark query string false "流程描述"
|
||||
// @Param flowFormData query string false "表单配置"
|
||||
// @Param flowProcessData query string false "流程配置"
|
||||
// @Param status query int false "状态:0待提交,1审批中,2审批完成,3审批失败"
|
||||
// @Success 200 {object} []FlowApplyResp "成功"
|
||||
// @Failure 400 {object} string "请求错误"
|
||||
// @Param Token header string true "token"
|
||||
// @Param PageNo query int true "页码"
|
||||
// @Param PageSize query int true "每页数量"
|
||||
// @Param templateId query int false "模板"
|
||||
// @Param applyUserId query int false "申请人id"
|
||||
// @Param applyUserNickname query string false "申请人昵称"
|
||||
// @Param flowName query string false "流程名称"
|
||||
// @Param flowGroup query int false "流程分类"
|
||||
// @Param flowRemark query string false "流程描述"
|
||||
// @Param flowFormData query string false "表单配置"
|
||||
// @Param flowProcessData query string false "流程配置"
|
||||
// @Param status query int false "状态:0待提交,1审批中,2审批完成,3审批失败"
|
||||
// @Success 200 {object} []FlowApplyResp "成功"
|
||||
// @Failure 400 {object} string "请求错误"
|
||||
// @Router /api/flow_apply/list [get]
|
||||
func (hd FlowApplyHandler) List(c *gin.Context) {
|
||||
var page request.PageReq
|
||||
@@ -40,40 +38,40 @@ func (hd FlowApplyHandler) List(c *gin.Context) {
|
||||
if response.IsFailWithResp(c, util.VerifyUtil.VerifyQuery(c, &listReq)) {
|
||||
return
|
||||
}
|
||||
res, err := hd.Service.List(page, listReq)
|
||||
res, err := Service.List(page, listReq)
|
||||
response.CheckAndRespWithData(c, res, err)
|
||||
}
|
||||
|
||||
// @Summary 申请流程详情
|
||||
// @Tags flow_apply-申请流程
|
||||
// @Produce json
|
||||
// @Param Token header string true "token"
|
||||
// @Param Token header string true "token"
|
||||
// @Param id query int false ""
|
||||
// @Success 200 {object} FlowApplyResp "成功"
|
||||
// @Success 200 {object} FlowApplyResp "成功"
|
||||
// @Router /api/flow_apply/detail [get]
|
||||
func (hd FlowApplyHandler) Detail(c *gin.Context) {
|
||||
var detailReq FlowApplyDetailReq
|
||||
if response.IsFailWithResp(c, util.VerifyUtil.VerifyQuery(c, &detailReq)) {
|
||||
return
|
||||
}
|
||||
res, err := hd.Service.Detail(detailReq.Id)
|
||||
res, err := Service.Detail(detailReq.Id)
|
||||
response.CheckAndRespWithData(c, res, err)
|
||||
}
|
||||
|
||||
// @Summary 申请流程新增
|
||||
// @Tags flow_apply-申请流程
|
||||
// @Produce json
|
||||
// @Param Token header string true "token"
|
||||
// @Param templateId body int false "模板"
|
||||
// @Param applyUserId body int false "申请人id"
|
||||
// @Param applyUserNickname body string false "申请人昵称"
|
||||
// @Param flowName body string false "流程名称"
|
||||
// @Param flowGroup body int false "流程分类"
|
||||
// @Param flowRemark body string false "流程描述"
|
||||
// @Param Token header string true "token"
|
||||
// @Param templateId body int false "模板"
|
||||
// @Param applyUserId body int false "申请人id"
|
||||
// @Param applyUserNickname body string false "申请人昵称"
|
||||
// @Param flowName body string false "流程名称"
|
||||
// @Param flowGroup body int false "流程分类"
|
||||
// @Param flowRemark body string false "流程描述"
|
||||
// @Param flowFormData body string false "表单配置"
|
||||
// @Param flowProcessData body string false "流程配置"
|
||||
// @Param status body int false "状态:0待提交,1审批中,2审批完成,3审批失败"
|
||||
// @Success 200 {object} response.RespType "成功"
|
||||
// @Param status body int false "状态:0待提交,1审批中,2审批完成,3审批失败"
|
||||
// @Success 200 {object} response.RespType "成功"
|
||||
// @Router /api/flow_apply/add [post]
|
||||
func (hd FlowApplyHandler) Add(c *gin.Context) {
|
||||
var addReq FlowApplyAddReq
|
||||
@@ -86,44 +84,44 @@ func (hd FlowApplyHandler) Add(c *gin.Context) {
|
||||
addReq.ApplyUserNickname = Nickname
|
||||
addReq.ApplyUserId = int(AdminId)
|
||||
|
||||
response.CheckAndResp(c, hd.Service.Add(addReq))
|
||||
response.CheckAndResp(c, Service.Add(addReq))
|
||||
}
|
||||
|
||||
// @Summary 申请流程编辑
|
||||
// @Tags flow_apply-申请流程
|
||||
// @Produce json
|
||||
// @Param Token header string true "token"
|
||||
// @Param id body int false ""
|
||||
// @Param templateId body int false "模板"
|
||||
// @Param applyUserId body int false "申请人id"
|
||||
// @Param applyUserNickname body string false "申请人昵称"
|
||||
// @Param flowName body string false "流程名称"
|
||||
// @Param flowGroup body int false "流程分类"
|
||||
// @Param flowRemark body string false "流程描述"
|
||||
// @Param Token header string true "token"
|
||||
// @Param id body int false ""
|
||||
// @Param templateId body int false "模板"
|
||||
// @Param applyUserId body int false "申请人id"
|
||||
// @Param applyUserNickname body string false "申请人昵称"
|
||||
// @Param flowName body string false "流程名称"
|
||||
// @Param flowGroup body int false "流程分类"
|
||||
// @Param flowRemark body string false "流程描述"
|
||||
// @Param flowFormData body string false "表单配置"
|
||||
// @Param flowProcessData body string false "流程配置"
|
||||
// @Param status body int false "状态:0待提交,1审批中,2审批完成,3审批失败"
|
||||
// @Success 200 {object} response.RespType "成功"
|
||||
// @Param status body int false "状态:0待提交,1审批中,2审批完成,3审批失败"
|
||||
// @Success 200 {object} response.RespType "成功"
|
||||
// @Router /api/flow_apply/edit [post]
|
||||
func (hd FlowApplyHandler) Edit(c *gin.Context) {
|
||||
var editReq FlowApplyEditReq
|
||||
if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &editReq)) {
|
||||
return
|
||||
}
|
||||
response.CheckAndResp(c, hd.Service.Edit(editReq))
|
||||
response.CheckAndResp(c, Service.Edit(editReq))
|
||||
}
|
||||
|
||||
// @Summary 申请流程删除
|
||||
// @Tags flow_apply-申请流程
|
||||
// @Produce json
|
||||
// @Param Token header string true "token"
|
||||
// @Param id body int false ""
|
||||
// @Success 200 {object} response.RespType "成功"
|
||||
// @Param Token header string true "token"
|
||||
// @Param id body int false ""
|
||||
// @Success 200 {object} response.RespType "成功"
|
||||
// @Router /api/flow_apply/del [post]
|
||||
func (hd FlowApplyHandler) Del(c *gin.Context) {
|
||||
var delReq FlowApplyDelReq
|
||||
if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &delReq)) {
|
||||
return
|
||||
}
|
||||
response.CheckAndResp(c, hd.Service.Del(delReq.Id))
|
||||
response.CheckAndResp(c, Service.Del(delReq.Id))
|
||||
}
|
||||
|
||||
@@ -4,16 +4,17 @@ import "x_admin/core"
|
||||
|
||||
//FlowApplyListReq 申请流程列表参数
|
||||
type FlowApplyListReq struct {
|
||||
TemplateId int `form:"templateId"` // 模板
|
||||
ApplyUserId int `form:"applyUserId"` // 申请人id
|
||||
ApplyUserNickname string `form:"applyUserNickname"` // 申请人昵称
|
||||
FlowName string `form:"flowName"` // 流程名称
|
||||
FlowGroup int `form:"flowGroup"` // 流程分类
|
||||
FlowRemark string `form:"flowRemark"` // 流程描述
|
||||
FlowFormData string `form:"flowFormData"` // 表单配置
|
||||
FlowProcessData string `form:"flowProcessData"` // 流程配置
|
||||
FormValue string `form:"formValue"` // 表单值
|
||||
Status int `form:"status"` // 状态:0待提交,1审批中,2审批完成,3审批失败
|
||||
TemplateId int `form:"templateId"` // 模板
|
||||
ApplyUserId int `form:"applyUserId"` // 申请人id
|
||||
ApplyUserNickname string `form:"applyUserNickname"` // 申请人昵称
|
||||
FlowName string `form:"flowName"` // 流程名称
|
||||
FlowGroup int `form:"flowGroup"` // 流程分类
|
||||
FlowRemark string `form:"flowRemark"` // 流程描述
|
||||
FlowFormData string `form:"flowFormData"` // 表单配置
|
||||
FlowProcessData string `form:"flowProcessData"` // 流程配置
|
||||
FlowProcessDataList string `form:"flowProcessDataList"` // 流程配置list数据
|
||||
FormValue string `form:"formValue"` // 表单值
|
||||
Status int `form:"status"` // 状态:0待提交,1审批中,2审批完成,3审批失败
|
||||
}
|
||||
|
||||
//FlowApplyDetailReq 申请流程详情参数
|
||||
@@ -26,28 +27,30 @@ type FlowApplyAddReq struct {
|
||||
TemplateId int `form:"templateId"` // 模板
|
||||
ApplyUserId int `form:"applyUserId"` // 申请人id
|
||||
ApplyUserNickname string `form:"applyUserNickname"` // 申请人昵称
|
||||
FlowName string `form:"flowName"` // 流程名称
|
||||
FlowGroup int `form:"flowGroup"` // 流程分类
|
||||
FlowRemark string `form:"flowRemark"` // 流程描述
|
||||
FlowFormData string `form:"flowFormData"` // 表单配置
|
||||
FlowProcessData string `form:"flowProcessData"` // 流程配置
|
||||
FormValue string `form:"formValue"` // 表单值
|
||||
Status int `form:"status"` // 状态:0待提交,1审批中,2审批完成,3审批失败
|
||||
// FlowName string `form:"flowName"` // 流程名称
|
||||
// FlowGroup int `form:"flowGroup"` // 流程分类
|
||||
// FlowRemark string `form:"flowRemark"` // 流程描述
|
||||
// FlowFormData string `form:"flowFormData"` // 表单配置
|
||||
// FlowProcessData string `form:"flowProcessData"` // 流程配置
|
||||
// FlowProcessDataList string `form:"flowProcessDataList"` // 流程配置list数据
|
||||
FormValue string `form:"formValue"` // 表单值
|
||||
Status int `form:"status"` // 状态:0待提交,1审批中,2审批完成,3审批失败
|
||||
}
|
||||
|
||||
//FlowApplyEditReq 申请流程新增参数
|
||||
type FlowApplyEditReq struct {
|
||||
Id int `form:"id"` //
|
||||
TemplateId int `form:"templateId"` // 模板
|
||||
ApplyUserId int `form:"applyUserId"` // 申请人id
|
||||
ApplyUserNickname string `form:"applyUserNickname"` // 申请人昵称
|
||||
FlowName string `form:"flowName"` // 流程名称
|
||||
FlowGroup int `form:"flowGroup"` // 流程分类
|
||||
FlowRemark string `form:"flowRemark"` // 流程描述
|
||||
FlowFormData string `form:"flowFormData"` // 表单配置
|
||||
FlowProcessData string `form:"flowProcessData"` // 流程配置
|
||||
FormValue string `form:"formValue"` // 表单值
|
||||
Status int `form:"status"` // 状态:0待提交,1审批中,2审批完成,3审批失败
|
||||
Id int `form:"id"` //
|
||||
// TemplateId int `form:"templateId"` // 模板
|
||||
// ApplyUserId int `form:"applyUserId"` // 申请人id
|
||||
// ApplyUserNickname string `form:"applyUserNickname"` // 申请人昵称
|
||||
// FlowName string `form:"flowName"` // 流程名称
|
||||
// FlowGroup int `form:"flowGroup"` // 流程分类
|
||||
// FlowRemark string `form:"flowRemark"` // 流程描述
|
||||
// FlowFormData string `form:"flowFormData"` // 表单配置
|
||||
// FlowProcessData string `form:"flowProcessData"` // 流程配置
|
||||
// FlowProcessDataList string `form:"flowProcessDataList"` // 流程配置list数据
|
||||
FormValue string `form:"formValue"` // 表单值
|
||||
Status int `form:"status"` // 状态:0待提交,1审批中,2审批完成,3审批失败
|
||||
}
|
||||
|
||||
//FlowApplyDelReq 申请流程新增参数
|
||||
@@ -57,17 +60,18 @@ type FlowApplyDelReq struct {
|
||||
|
||||
//FlowApplyResp 申请流程返回信息
|
||||
type FlowApplyResp struct {
|
||||
Id int `json:"id" structs:"id"` //
|
||||
TemplateId int `json:"templateId" structs:"templateId"` // 模板
|
||||
ApplyUserId int `json:"applyUserId" structs:"applyUserId"` // 申请人id
|
||||
ApplyUserNickname string `json:"applyUserNickname" structs:"applyUserNickname"` // 申请人昵称
|
||||
FlowName string `json:"flowName" structs:"flowName"` // 流程名称
|
||||
FlowGroup int `json:"flowGroup" structs:"flowGroup"` // 流程分类
|
||||
FlowRemark string `json:"flowRemark" structs:"flowRemark"` // 流程描述
|
||||
FlowFormData string `json:"flowFormData" structs:"flowFormData"` // 表单配置
|
||||
FlowProcessData string `json:"flowProcessData" structs:"flowProcessData"` // 流程配置
|
||||
FormValue string `json:"formValue"` // 表单值
|
||||
Status int `json:"status" structs:"status"` // 状态:0待提交,1审批中,2审批完成,3审批失败
|
||||
UpdateTime core.TsTime `json:"updateTime" structs:"updateTime"` // 更新时间
|
||||
CreateTime core.TsTime `json:"createTime" structs:"createTime"` // 创建时间
|
||||
Id int `json:"id" structs:"id"` //
|
||||
TemplateId int `json:"templateId" structs:"templateId"` // 模板
|
||||
ApplyUserId int `json:"applyUserId" structs:"applyUserId"` // 申请人id
|
||||
ApplyUserNickname string `json:"applyUserNickname" structs:"applyUserNickname"` // 申请人昵称
|
||||
FlowName string `json:"flowName" structs:"flowName"` // 流程名称
|
||||
FlowGroup int `json:"flowGroup" structs:"flowGroup"` // 流程分类
|
||||
FlowRemark string `json:"flowRemark" structs:"flowRemark"` // 流程描述
|
||||
FlowFormData string `json:"flowFormData" structs:"flowFormData"` // 表单配置
|
||||
FlowProcessData string `json:"flowProcessData" structs:"flowProcessData"` // 流程配置
|
||||
FlowProcessDataList string `form:"flowProcessDataList"` // 流程配置list数据
|
||||
FormValue string `json:"formValue"` // 表单值
|
||||
Status int `json:"status" structs:"status"` // 状态:0待提交,1审批中,2审批完成,3审批失败
|
||||
UpdateTime core.TsTime `json:"updateTime" structs:"updateTime"` // 更新时间
|
||||
CreateTime core.TsTime `json:"createTime" structs:"createTime"` // 创建时间
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package flow_apply
|
||||
|
||||
import (
|
||||
"x_admin/admin/flow_template"
|
||||
"x_admin/core"
|
||||
"x_admin/core/request"
|
||||
"x_admin/core/response"
|
||||
"x_admin/model"
|
||||
@@ -16,8 +18,11 @@ type IFlowApplyService interface {
|
||||
Del(id int) (e error)
|
||||
}
|
||||
|
||||
var Service = NewFlowApplyService()
|
||||
|
||||
// NewFlowApplyService 初始化
|
||||
func NewFlowApplyService(db *gorm.DB) IFlowApplyService {
|
||||
func NewFlowApplyService() *flowApplyService {
|
||||
db := core.GetDB()
|
||||
return &flowApplyService{db: db}
|
||||
}
|
||||
|
||||
@@ -99,10 +104,20 @@ func (Service flowApplyService) Detail(id int) (res FlowApplyResp, e error) {
|
||||
// Add 申请流程新增
|
||||
func (Service flowApplyService) Add(addReq FlowApplyAddReq) (e error) {
|
||||
var obj model.FlowApply
|
||||
|
||||
var flow_template_resp, err = flow_template.Service.Detail(addReq.TemplateId)
|
||||
if e = response.CheckErrDBNotRecord(err, "模板不存在!"); e != nil {
|
||||
return
|
||||
}
|
||||
response.Copy(&obj, addReq)
|
||||
err := Service.db.Create(&obj).Error
|
||||
e = response.CheckErr(err, "Add Create err")
|
||||
obj.FlowName = flow_template_resp.FlowName
|
||||
obj.FlowGroup = flow_template_resp.FlowGroup
|
||||
obj.FlowRemark = flow_template_resp.FlowRemark
|
||||
obj.FlowFormData = flow_template_resp.FlowFormData
|
||||
obj.FlowProcessData = flow_template_resp.FlowProcessData
|
||||
obj.FlowProcessDataList = flow_template_resp.FlowProcessDataList
|
||||
|
||||
err = Service.db.Create(&obj).Error
|
||||
e = response.CheckErr(err, "添加失败")
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package admin
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"x_admin/core"
|
||||
"x_admin/middleware"
|
||||
"x_admin/admin/flow_apply"
|
||||
"x_admin/middleware"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
/**
|
||||
@@ -24,14 +24,10 @@ flow_apply:list
|
||||
flow_apply:detail
|
||||
*/
|
||||
|
||||
|
||||
// FlowApplyRoute(rg)
|
||||
func FlowApplyRoute(rg *gin.RouterGroup) {
|
||||
db := core.GetDB()
|
||||
|
||||
server := flow_apply.NewFlowApplyService(db)
|
||||
|
||||
handle := flow_apply.FlowApplyHandler{Service: server}
|
||||
handle := flow_apply.FlowApplyHandler{}
|
||||
|
||||
rg = rg.Group("/", middleware.TokenAuth())
|
||||
rg.GET("/flow_apply/list", handle.List)
|
||||
@@ -39,4 +35,5 @@ func FlowApplyRoute(rg *gin.RouterGroup) {
|
||||
rg.POST("/flow_apply/add", handle.Add)
|
||||
rg.POST("/flow_apply/edit", handle.Edit)
|
||||
rg.POST("/flow_apply/del", handle.Del)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,21 +15,21 @@ type FlowHistoryHandler struct {
|
||||
// @Summary 流程历史列表
|
||||
// @Tags flow_history-流程历史
|
||||
// @Produce json
|
||||
// @Param Token header string true "token"
|
||||
// @Param PageNo query int true "页码"
|
||||
// @Param PageSize query int true "每页数量"
|
||||
// @Param applyId query int false "申请id"
|
||||
// @Param templateId query int false "模板id"
|
||||
// @Param applyUserId query int false "申请人id"
|
||||
// @Param applyUserNickname query string false "申请人昵称"
|
||||
// @Param approverId query int false "审批人id"
|
||||
// @Param approverNickname query string false "审批用户昵称"
|
||||
// @Param nodeId query string false "节点"
|
||||
// @Param formValue query string false "表单值"
|
||||
// @Param passStatus query int false "通过状态:0待处理,1通过,2拒绝"
|
||||
// @Param passRemark query string false "通过备注"
|
||||
// @Success 200 {object} []FlowHistoryResp "成功"
|
||||
// @Failure 400 {object} string "请求错误"
|
||||
// @Param Token header string true "token"
|
||||
// @Param PageNo query int true "页码"
|
||||
// @Param PageSize query int true "每页数量"
|
||||
// @Param applyId query int false "申请id"
|
||||
// @Param templateId query int false "模板id"
|
||||
// @Param applyUserId query int false "申请人id"
|
||||
// @Param applyUserNickname query string false "申请人昵称"
|
||||
// @Param approverId query int false "审批人id"
|
||||
// @Param approverNickname query string false "审批用户昵称"
|
||||
// @Param nodeId query string false "节点"
|
||||
// @Param formValue query string false "表单值"
|
||||
// @Param passStatus query int false "通过状态:0待处理,1通过,2拒绝"
|
||||
// @Param passRemark query string false "通过备注"
|
||||
// @Success 200 {object} []FlowHistoryResp "成功"
|
||||
// @Failure 400 {object} string "请求错误"
|
||||
// @Router /api/flow_history/list [get]
|
||||
func (hd FlowHistoryHandler) List(c *gin.Context) {
|
||||
var page request.PageReq
|
||||
@@ -40,114 +40,132 @@ func (hd FlowHistoryHandler) List(c *gin.Context) {
|
||||
if response.IsFailWithResp(c, util.VerifyUtil.VerifyQuery(c, &listReq)) {
|
||||
return
|
||||
}
|
||||
res, err := hd.Service.List(page, listReq)
|
||||
res, err := Service.List(page, listReq)
|
||||
response.CheckAndRespWithData(c, res, err)
|
||||
}
|
||||
|
||||
// @Summary 流程历史列表-所有
|
||||
// @Tags flow_history-流程历史
|
||||
// @Produce json
|
||||
// @Success 200 {object} []FlowHistoryResp "成功"
|
||||
// @Router /api/flow_history/list [get]
|
||||
// @Summary 流程历史列表-所有
|
||||
// @Tags flow_history-流程历史
|
||||
// @Produce json
|
||||
// @Success 200 {object} []FlowHistoryResp "成功"
|
||||
// @Router /api/flow_history/list [get]
|
||||
func (hd FlowHistoryHandler) ListAll(c *gin.Context) {
|
||||
res, err := hd.Service.ListAll()
|
||||
res, err := Service.ListAll()
|
||||
response.CheckAndRespWithData(c, res, err)
|
||||
}
|
||||
|
||||
// @Summary 流程历史详情
|
||||
// @Tags flow_history-流程历史
|
||||
// @Produce json
|
||||
// @Param Token header string true "token"
|
||||
// @Param Token header string true "token"
|
||||
// @Param id query int false "历史id"
|
||||
// @Success 200 {object} FlowHistoryResp "成功"
|
||||
// @Success 200 {object} FlowHistoryResp "成功"
|
||||
// @Router /api/flow_history/detail [get]
|
||||
func (hd FlowHistoryHandler) Detail(c *gin.Context) {
|
||||
var detailReq FlowHistoryDetailReq
|
||||
if response.IsFailWithResp(c, util.VerifyUtil.VerifyQuery(c, &detailReq)) {
|
||||
return
|
||||
}
|
||||
res, err := hd.Service.Detail(detailReq.Id)
|
||||
res, err := Service.Detail(detailReq.Id)
|
||||
response.CheckAndRespWithData(c, res, err)
|
||||
}
|
||||
|
||||
// @Summary 流程历史新增
|
||||
// @Tags flow_history-流程历史
|
||||
// @Produce json
|
||||
// @Param Token header string true "token"
|
||||
// @Param applyId body int false "申请id"
|
||||
// @Param templateId body int false "模板id"
|
||||
// @Param applyUserId body int false "申请人id"
|
||||
// @Param applyUserNickname body string false "申请人昵称"
|
||||
// @Param approverId body int false "审批人id"
|
||||
// @Param approverNickname body string false "审批用户昵称"
|
||||
// @Param nodeId body string false "节点"
|
||||
// @Param formValue body string false "表单值"
|
||||
// @Param passStatus body int false "通过状态:0待处理,1通过,2拒绝"
|
||||
// @Param passRemark body string false "通过备注"
|
||||
// @Success 200 {object} response.RespType "成功"
|
||||
// @Param Token header string true "token"
|
||||
// @Param applyId body int false "申请id"
|
||||
// @Param templateId body int false "模板id"
|
||||
// @Param applyUserId body int false "申请人id"
|
||||
// @Param applyUserNickname body string false "申请人昵称"
|
||||
// @Param approverId body int false "审批人id"
|
||||
// @Param approverNickname body string false "审批用户昵称"
|
||||
// @Param nodeId body string false "节点"
|
||||
// @Param formValue body string false "表单值"
|
||||
// @Param passStatus body int false "通过状态:0待处理,1通过,2拒绝"
|
||||
// @Param passRemark body string false "通过备注"
|
||||
// @Success 200 {object} response.RespType "成功"
|
||||
// @Router /api/flow_history/add [post]
|
||||
func (hd FlowHistoryHandler) Add(c *gin.Context) {
|
||||
var addReq FlowHistoryAddReq
|
||||
if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &addReq)) {
|
||||
return
|
||||
}
|
||||
response.CheckAndResp(c, hd.Service.Add(addReq))
|
||||
response.CheckAndResp(c, Service.Add(addReq))
|
||||
}
|
||||
|
||||
// @Summary 流程历史编辑
|
||||
// @Tags flow_history-流程历史
|
||||
// @Produce json
|
||||
// @Param Token header string true "token"
|
||||
// @Param id body int false "历史id"
|
||||
// @Param applyId body int false "申请id"
|
||||
// @Param templateId body int false "模板id"
|
||||
// @Param applyUserId body int false "申请人id"
|
||||
// @Param applyUserNickname body string false "申请人昵称"
|
||||
// @Param approverId body int false "审批人id"
|
||||
// @Param approverNickname body string false "审批用户昵称"
|
||||
// @Param nodeId body string false "节点"
|
||||
// @Param formValue body string false "表单值"
|
||||
// @Param passStatus body int false "通过状态:0待处理,1通过,2拒绝"
|
||||
// @Param passRemark body string false "通过备注"
|
||||
// @Success 200 {object} response.RespType "成功"
|
||||
// @Param Token header string true "token"
|
||||
// @Param id body int false "历史id"
|
||||
// @Param applyId body int false "申请id"
|
||||
// @Param templateId body int false "模板id"
|
||||
// @Param applyUserId body int false "申请人id"
|
||||
// @Param applyUserNickname body string false "申请人昵称"
|
||||
// @Param approverId body int false "审批人id"
|
||||
// @Param approverNickname body string false "审批用户昵称"
|
||||
// @Param nodeId body string false "节点"
|
||||
// @Param formValue body string false "表单值"
|
||||
// @Param passStatus body int false "通过状态:0待处理,1通过,2拒绝"
|
||||
// @Param passRemark body string false "通过备注"
|
||||
// @Success 200 {object} response.RespType "成功"
|
||||
// @Router /api/flow_history/edit [post]
|
||||
func (hd FlowHistoryHandler) Edit(c *gin.Context) {
|
||||
var editReq FlowHistoryEditReq
|
||||
if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &editReq)) {
|
||||
return
|
||||
}
|
||||
response.CheckAndResp(c, hd.Service.Edit(editReq))
|
||||
response.CheckAndResp(c, Service.Edit(editReq))
|
||||
}
|
||||
|
||||
// @Summary 流程历史删除
|
||||
// @Tags flow_history-流程历史
|
||||
// @Produce json
|
||||
// @Param Token header string true "token"
|
||||
// @Param id body int false "历史id"
|
||||
// @Success 200 {object} response.RespType "成功"
|
||||
// @Param Token header string true "token"
|
||||
// @Param id body int false "历史id"
|
||||
// @Success 200 {object} response.RespType "成功"
|
||||
// @Router /api/flow_history/del [post]
|
||||
func (hd FlowHistoryHandler) Del(c *gin.Context) {
|
||||
var delReq FlowHistoryDelReq
|
||||
if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &delReq)) {
|
||||
return
|
||||
}
|
||||
response.CheckAndResp(c, hd.Service.Del(delReq.Id))
|
||||
}
|
||||
|
||||
type FlowTree struct {
|
||||
Id string `json:"id"`
|
||||
Pid string `json:"pid"`
|
||||
Type string `json:"type"`
|
||||
|
||||
User string `json:"user"`
|
||||
// FieldAuth map[string]int `json:"fieldAuth"`
|
||||
|
||||
Children *FlowTree
|
||||
response.CheckAndResp(c, Service.Del(delReq.Id))
|
||||
}
|
||||
|
||||
// 提交申请
|
||||
//
|
||||
// @Router /api/flow_apply/SubmitApply [post]
|
||||
func (hd FlowHistoryHandler) SubmitApply(c *gin.Context) {
|
||||
// 申请流程id,
|
||||
// var addReq FlowApplyAddReq
|
||||
// if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &addReq)) {
|
||||
// return
|
||||
// }
|
||||
|
||||
// var Nickname = config.AdminConfig.GetNickname(c)
|
||||
// var AdminId = config.AdminConfig.GetAdminId(c)
|
||||
// addReq.ApplyUserNickname = Nickname
|
||||
// addReq.ApplyUserId = int(AdminId)
|
||||
// 解析json
|
||||
// 查找开始节点
|
||||
// 查找开始的下一级节点
|
||||
// 下一个可能是网关,系统任务,用户任务,结束
|
||||
// 网关,系统任务节点处理后继续向下查找节点,网关只能有一个满足条件
|
||||
|
||||
}
|
||||
|
||||
// 获取下一个审批节点,中间可能存在系统任务节点和网关
|
||||
func (hd FlowHistoryHandler) NextNode(c *gin.Context) {
|
||||
var nextNode NextNodeReq
|
||||
if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &nextNode)) {
|
||||
return
|
||||
}
|
||||
|
||||
response.CheckAndResp(c, Service.GetNextNode(nextNode))
|
||||
|
||||
}
|
||||
|
||||
// 同意审批(当前nodeId)
|
||||
|
||||
|
||||
@@ -71,3 +71,18 @@ type FlowHistoryResp struct {
|
||||
UpdateTime core.TsTime `json:"updateTime" structs:"updateTime"` // 更新时间
|
||||
CreateTime core.TsTime `json:"createTime" structs:"createTime"` // 创建时间
|
||||
}
|
||||
|
||||
type NextNodeReq struct {
|
||||
ApplyId int `form:"applyId"` // 申请id
|
||||
NodeId string `form:"nodeId"` // 流程里的节点id
|
||||
}
|
||||
type FlowTree struct {
|
||||
Id string `json:"id"`
|
||||
Pid string `json:"pid"`
|
||||
Type string `json:"type"`
|
||||
|
||||
User string `json:"user"`
|
||||
// FieldAuth map[string]int `json:"fieldAuth"`
|
||||
|
||||
Children *FlowTree
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package flow_history
|
||||
|
||||
import (
|
||||
"x_admin/core"
|
||||
"x_admin/core/request"
|
||||
"x_admin/core/response"
|
||||
"x_admin/model"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
@@ -15,55 +17,60 @@ type IFlowHistoryService interface {
|
||||
Add(addReq FlowHistoryAddReq) (e error)
|
||||
Edit(editReq FlowHistoryEditReq) (e error)
|
||||
Del(id int) (e error)
|
||||
|
||||
GetNextNode(nextNode NextNodeReq) (e error)
|
||||
}
|
||||
|
||||
//NewFlowHistoryService 初始化
|
||||
func NewFlowHistoryService(db *gorm.DB) IFlowHistoryService {
|
||||
var Service = NewFlowHistoryService()
|
||||
|
||||
// NewFlowHistoryService 初始化
|
||||
func NewFlowHistoryService() IFlowHistoryService {
|
||||
db := core.GetDB()
|
||||
return &flowHistoryService{db: db}
|
||||
}
|
||||
|
||||
//flowHistoryService 流程历史服务实现类
|
||||
// flowHistoryService 流程历史服务实现类
|
||||
type flowHistoryService struct {
|
||||
db *gorm.DB
|
||||
}
|
||||
|
||||
//List 流程历史列表
|
||||
// List 流程历史列表
|
||||
func (Service flowHistoryService) List(page request.PageReq, listReq FlowHistoryListReq) (res response.PageResp, e error) {
|
||||
// 分页信息
|
||||
limit := page.PageSize
|
||||
offset := page.PageSize * (page.PageNo - 1)
|
||||
// 查询
|
||||
dbModel := Service.db.Model(&model.FlowHistory{})
|
||||
if listReq.ApplyId > 0 {
|
||||
dbModel = dbModel.Where("apply_id = ?", listReq.ApplyId)
|
||||
}
|
||||
if listReq.TemplateId > 0 {
|
||||
dbModel = dbModel.Where("template_id = ?", listReq.TemplateId)
|
||||
}
|
||||
if listReq.ApplyUserId > 0 {
|
||||
dbModel = dbModel.Where("apply_user_id = ?", listReq.ApplyUserId)
|
||||
}
|
||||
if listReq.ApplyId > 0 {
|
||||
dbModel = dbModel.Where("apply_id = ?", listReq.ApplyId)
|
||||
}
|
||||
if listReq.TemplateId > 0 {
|
||||
dbModel = dbModel.Where("template_id = ?", listReq.TemplateId)
|
||||
}
|
||||
if listReq.ApplyUserId > 0 {
|
||||
dbModel = dbModel.Where("apply_user_id = ?", listReq.ApplyUserId)
|
||||
}
|
||||
if listReq.ApplyUserNickname != "" {
|
||||
dbModel = dbModel.Where("apply_user_nickname like ?", "%"+listReq.ApplyUserNickname+"%")
|
||||
}
|
||||
if listReq.ApproverId > 0 {
|
||||
dbModel = dbModel.Where("approver_id = ?", listReq.ApproverId)
|
||||
}
|
||||
dbModel = dbModel.Where("apply_user_nickname like ?", "%"+listReq.ApplyUserNickname+"%")
|
||||
}
|
||||
if listReq.ApproverId > 0 {
|
||||
dbModel = dbModel.Where("approver_id = ?", listReq.ApproverId)
|
||||
}
|
||||
if listReq.ApproverNickname != "" {
|
||||
dbModel = dbModel.Where("approver_nickname like ?", "%"+listReq.ApproverNickname+"%")
|
||||
}
|
||||
if listReq.NodeId != "" {
|
||||
dbModel = dbModel.Where("node_id = ?", listReq.NodeId)
|
||||
}
|
||||
if listReq.FormValue != "" {
|
||||
dbModel = dbModel.Where("form_value = ?", listReq.FormValue)
|
||||
}
|
||||
if listReq.PassStatus > 0 {
|
||||
dbModel = dbModel.Where("pass_status = ?", listReq.PassStatus)
|
||||
}
|
||||
if listReq.PassRemark != "" {
|
||||
dbModel = dbModel.Where("pass_remark = ?", listReq.PassRemark)
|
||||
}
|
||||
dbModel = dbModel.Where("approver_nickname like ?", "%"+listReq.ApproverNickname+"%")
|
||||
}
|
||||
if listReq.NodeId != "" {
|
||||
dbModel = dbModel.Where("node_id = ?", listReq.NodeId)
|
||||
}
|
||||
if listReq.FormValue != "" {
|
||||
dbModel = dbModel.Where("form_value = ?", listReq.FormValue)
|
||||
}
|
||||
if listReq.PassStatus > 0 {
|
||||
dbModel = dbModel.Where("pass_status = ?", listReq.PassStatus)
|
||||
}
|
||||
if listReq.PassRemark != "" {
|
||||
dbModel = dbModel.Where("pass_remark = ?", listReq.PassRemark)
|
||||
}
|
||||
// 总数
|
||||
var count int64
|
||||
err := dbModel.Count(&count).Error
|
||||
@@ -85,10 +92,11 @@ func (Service flowHistoryService) List(page request.PageReq, listReq FlowHistory
|
||||
Lists: resps,
|
||||
}, nil
|
||||
}
|
||||
//ListAll 流程历史列表
|
||||
|
||||
// ListAll 流程历史列表
|
||||
func (Service flowHistoryService) ListAll() (res []FlowHistoryResp, e error) {
|
||||
var objs model.FlowHistory
|
||||
|
||||
|
||||
err := Service.db.Find(&objs).Error
|
||||
if e = response.CheckErr(err, "ListAll Find err"); e != nil {
|
||||
return
|
||||
@@ -97,7 +105,7 @@ func (Service flowHistoryService) ListAll() (res []FlowHistoryResp, e error) {
|
||||
return res, nil
|
||||
}
|
||||
|
||||
//Detail 流程历史详情
|
||||
// Detail 流程历史详情
|
||||
func (Service flowHistoryService) Detail(id int) (res FlowHistoryResp, e error) {
|
||||
var obj model.FlowHistory
|
||||
err := Service.db.Where("id = ?", id).Limit(1).First(&obj).Error
|
||||
@@ -111,7 +119,7 @@ func (Service flowHistoryService) Detail(id int) (res FlowHistoryResp, e error)
|
||||
return
|
||||
}
|
||||
|
||||
//Add 流程历史新增
|
||||
// Add 流程历史新增
|
||||
func (Service flowHistoryService) Add(addReq FlowHistoryAddReq) (e error) {
|
||||
var obj model.FlowHistory
|
||||
response.Copy(&obj, addReq)
|
||||
@@ -120,7 +128,7 @@ func (Service flowHistoryService) Add(addReq FlowHistoryAddReq) (e error) {
|
||||
return
|
||||
}
|
||||
|
||||
//Edit 流程历史编辑
|
||||
// Edit 流程历史编辑
|
||||
func (Service flowHistoryService) Edit(editReq FlowHistoryEditReq) (e error) {
|
||||
var obj model.FlowHistory
|
||||
err := Service.db.Where("id = ?", editReq.Id).Limit(1).First(&obj).Error
|
||||
@@ -138,7 +146,7 @@ func (Service flowHistoryService) Edit(editReq FlowHistoryEditReq) (e error) {
|
||||
return
|
||||
}
|
||||
|
||||
//Del 流程历史删除
|
||||
// Del 流程历史删除
|
||||
func (Service flowHistoryService) Del(id int) (e error) {
|
||||
var obj model.FlowHistory
|
||||
err := Service.db.Where("id = ?", id).Limit(1).First(&obj).Error
|
||||
@@ -149,8 +157,16 @@ func (Service flowHistoryService) Del(id int) (e error) {
|
||||
if e = response.CheckErr(err, "Del First err"); e != nil {
|
||||
return
|
||||
}
|
||||
// 删除
|
||||
err = Service.db.Delete(&obj).Error
|
||||
e = response.CheckErr(err, "Del Delete err")
|
||||
// 删除
|
||||
err = Service.db.Delete(&obj).Error
|
||||
e = response.CheckErr(err, "Del Delete err")
|
||||
return
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取下一个流程
|
||||
*/
|
||||
func (Service flowHistoryService) GetNextNode(nextNode NextNodeReq) (e error) {
|
||||
//
|
||||
return e
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package admin
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"x_admin/core"
|
||||
"x_admin/middleware"
|
||||
"x_admin/admin/flow_history"
|
||||
"x_admin/middleware"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
/**
|
||||
@@ -25,14 +25,10 @@ flow_history:listAll
|
||||
flow_history:detail
|
||||
*/
|
||||
|
||||
|
||||
// FlowHistoryRoute(rg)
|
||||
func FlowHistoryRoute(rg *gin.RouterGroup) {
|
||||
db := core.GetDB()
|
||||
|
||||
server := flow_history.NewFlowHistoryService(db)
|
||||
|
||||
handle := flow_history.FlowHistoryHandler{Service: server}
|
||||
handle := flow_history.FlowHistoryHandler{}
|
||||
|
||||
rg = rg.Group("/", middleware.TokenAuth())
|
||||
rg.GET("/flow_history/list", handle.List)
|
||||
@@ -41,4 +37,6 @@ func FlowHistoryRoute(rg *gin.RouterGroup) {
|
||||
rg.POST("/flow_history/add", handle.Add)
|
||||
rg.POST("/flow_history/edit", handle.Edit)
|
||||
rg.POST("/flow_history/del", handle.Del)
|
||||
}
|
||||
|
||||
rg.POST("/flow_history/next_node", handle.NextNode)
|
||||
}
|
||||
|
||||
@@ -8,23 +8,21 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type FlowTemplateHandler struct {
|
||||
Service IFlowTemplateService
|
||||
}
|
||||
type FlowTemplateHandler struct{}
|
||||
|
||||
// @Summary 流程模板列表
|
||||
// @Tags flow_template-流程模板
|
||||
// @Produce json
|
||||
// @Param Token header string true "token"
|
||||
// @Param PageNo query int true "页码"
|
||||
// @Param PageSize query int true "每页数量"
|
||||
// @Param Token header string true "token"
|
||||
// @Param PageNo query int true "页码"
|
||||
// @Param PageSize query int true "每页数量"
|
||||
// @Param flowName query string false "流程名称"
|
||||
// @Param flowGroup query int false "流程分类"
|
||||
// @Param flowGroup query int false "流程分类"
|
||||
// @Param flowRemark query string false "流程描述"
|
||||
// @Param flowFormData query string false "表单配置"
|
||||
// @Param flowProcessData query string false "流程配置"
|
||||
// @Success 200 {object} []FlowTemplateResp "成功"
|
||||
// @Failure 400 {object} string "请求错误"
|
||||
// @Param flowFormData query string false "表单配置"
|
||||
// @Param flowProcessData query string false "流程配置"
|
||||
// @Success 200 {object} []FlowTemplateResp "成功"
|
||||
// @Failure 400 {object} string "请求错误"
|
||||
// @Router /api/flow_template/list [get]
|
||||
func (hd FlowTemplateHandler) List(c *gin.Context) {
|
||||
var page request.PageReq
|
||||
@@ -35,7 +33,7 @@ func (hd FlowTemplateHandler) List(c *gin.Context) {
|
||||
if response.IsFailWithResp(c, util.VerifyUtil.VerifyQuery(c, &listReq)) {
|
||||
return
|
||||
}
|
||||
res, err := hd.Service.List(page, listReq)
|
||||
res, err := Service.List(page, listReq)
|
||||
response.CheckAndRespWithData(c, res, err)
|
||||
}
|
||||
|
||||
@@ -43,76 +41,76 @@ func (hd FlowTemplateHandler) List(c *gin.Context) {
|
||||
// @Tags flow_template-流程模板
|
||||
// @Router /api/flow_template/listAll [get]
|
||||
func (hd FlowTemplateHandler) ListAll(c *gin.Context) {
|
||||
res, err := hd.Service.ListAll()
|
||||
res, err := Service.ListAll()
|
||||
response.CheckAndRespWithData(c, res, err)
|
||||
}
|
||||
|
||||
// @Summary 流程模板详情
|
||||
// @Tags flow_template-流程模板
|
||||
// @Produce json
|
||||
// @Param Token header string true "token"
|
||||
// @Param id query int false ""
|
||||
// @Success 200 {object} FlowTemplateResp "成功"
|
||||
// @Param Token header string true "token"
|
||||
// @Param id query int false ""
|
||||
// @Success 200 {object} FlowTemplateResp "成功"
|
||||
// @Router /api/flow_template/detail [get]
|
||||
func (hd FlowTemplateHandler) Detail(c *gin.Context) {
|
||||
var detailReq FlowTemplateDetailReq
|
||||
if response.IsFailWithResp(c, util.VerifyUtil.VerifyQuery(c, &detailReq)) {
|
||||
return
|
||||
}
|
||||
res, err := hd.Service.Detail(detailReq.Id)
|
||||
res, err := Service.Detail(detailReq.Id)
|
||||
response.CheckAndRespWithData(c, res, err)
|
||||
}
|
||||
|
||||
// @Summary 流程模板新增
|
||||
// @Tags flow_template-流程模板
|
||||
// @Produce json
|
||||
// @Param Token header string true "token"
|
||||
// @Param Token header string true "token"
|
||||
// @Param flowName body string false "流程名称"
|
||||
// @Param flowGroup body int false "流程分类"
|
||||
// @Param flowGroup body int false "流程分类"
|
||||
// @Param flowRemark body string false "流程描述"
|
||||
// @Param flowFormData body string false "表单配置"
|
||||
// @Param flowProcessData body string false "流程配置"
|
||||
// @Success 200 {object} response.RespType "成功"
|
||||
// @Param flowFormData body string false "表单配置"
|
||||
// @Param flowProcessData body string false "流程配置"
|
||||
// @Success 200 {object} response.RespType "成功"
|
||||
// @Router /api/flow_template/add [post]
|
||||
func (hd FlowTemplateHandler) Add(c *gin.Context) {
|
||||
var addReq FlowTemplateAddReq
|
||||
if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &addReq)) {
|
||||
return
|
||||
}
|
||||
response.CheckAndResp(c, hd.Service.Add(addReq))
|
||||
response.CheckAndResp(c, Service.Add(addReq))
|
||||
}
|
||||
|
||||
// @Summary 流程模板编辑
|
||||
// @Tags flow_template-流程模板
|
||||
// @Produce json
|
||||
// @Param Token header string true "token"
|
||||
// @Param id body int false ""
|
||||
// @Param Token header string true "token"
|
||||
// @Param id body int false ""
|
||||
// @Param flowName body string false "流程名称"
|
||||
// @Param flowGroup body int false "流程分类"
|
||||
// @Param flowGroup body int false "流程分类"
|
||||
// @Param flowRemark body string false "流程描述"
|
||||
// @Param flowFormData body string false "表单配置"
|
||||
// @Param flowProcessData body string false "流程配置"
|
||||
// @Success 200 {object} response.RespType "成功"
|
||||
// @Param flowFormData body string false "表单配置"
|
||||
// @Param flowProcessData body string false "流程配置"
|
||||
// @Success 200 {object} response.RespType "成功"
|
||||
// @Router /api/flow_template/edit [post]
|
||||
func (hd FlowTemplateHandler) Edit(c *gin.Context) {
|
||||
var editReq FlowTemplateEditReq
|
||||
if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &editReq)) {
|
||||
return
|
||||
}
|
||||
response.CheckAndResp(c, hd.Service.Edit(editReq))
|
||||
response.CheckAndResp(c, Service.Edit(editReq))
|
||||
}
|
||||
|
||||
// @Summary 流程模板删除
|
||||
// @Tags flow_template-流程模板
|
||||
// @Produce json
|
||||
// @Param Token header string true "token"
|
||||
// @Param id body int false ""
|
||||
// @Success 200 {object} response.RespType "成功"
|
||||
// @Param Token header string true "token"
|
||||
// @Param id body int false ""
|
||||
// @Success 200 {object} response.RespType "成功"
|
||||
// @Router /api/flow_template/del [post]
|
||||
func (hd FlowTemplateHandler) Del(c *gin.Context) {
|
||||
var delReq FlowTemplateDelReq
|
||||
if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &delReq)) {
|
||||
return
|
||||
}
|
||||
response.CheckAndResp(c, hd.Service.Del(delReq.Id))
|
||||
response.CheckAndResp(c, Service.Del(delReq.Id))
|
||||
}
|
||||
|
||||
@@ -2,11 +2,12 @@ package flow_template
|
||||
|
||||
//FlowTemplateListReq 流程模板列表参数
|
||||
type FlowTemplateListReq struct {
|
||||
FlowName string `form:"flowName"` // 流程名称
|
||||
FlowGroup int `form:"flowGroup"` // 流程分类
|
||||
FlowRemark string `form:"flowRemark"` // 流程描述
|
||||
FlowFormData string `form:"flowFormData"` // 表单配置
|
||||
FlowProcessData string `form:"flowProcessData"` // 流程配置
|
||||
FlowName string `form:"flowName"` // 流程名称
|
||||
FlowGroup int `form:"flowGroup"` // 流程分类
|
||||
FlowRemark string `form:"flowRemark"` // 流程描述
|
||||
FlowFormData string `form:"flowFormData"` // 表单配置
|
||||
FlowProcessData string `form:"flowProcessData"` // 流程配置
|
||||
FlowProcessDataList string `form:"flowProcessDataList"` // 流程配置list数据
|
||||
}
|
||||
|
||||
//FlowTemplateDetailReq 流程模板详情参数
|
||||
@@ -16,22 +17,24 @@ type FlowTemplateDetailReq struct {
|
||||
|
||||
//FlowTemplateAddReq 流程模板新增参数
|
||||
type FlowTemplateAddReq struct {
|
||||
FlowName string `form:"flowName"` // 流程名称
|
||||
FlowGroup int `form:"flowGroup"` // 流程分类
|
||||
FlowRemark string `form:"flowRemark"` // 流程描述
|
||||
FlowFormData string `form:"flowFormData"` // 表单配置
|
||||
FlowProcessData string `form:"flowProcessData"` // 流程配置
|
||||
FlowName string `form:"flowName"` // 流程名称
|
||||
FlowGroup int `form:"flowGroup"` // 流程分类
|
||||
FlowRemark string `form:"flowRemark"` // 流程描述
|
||||
FlowFormData string `form:"flowFormData"` // 表单配置
|
||||
FlowProcessData string `form:"flowProcessData"` // 流程配置
|
||||
FlowProcessDataList string `form:"flowProcessDataList"` // 流程配置list数据
|
||||
|
||||
}
|
||||
|
||||
//FlowTemplateEditReq 流程模板新增参数
|
||||
type FlowTemplateEditReq struct {
|
||||
Id int `form:"id"` //
|
||||
FlowName string `form:"flowName"` // 流程名称
|
||||
FlowGroup int `form:"flowGroup"` // 流程分类
|
||||
FlowRemark string `form:"flowRemark"` // 流程描述
|
||||
FlowFormData string `form:"flowFormData"` // 表单配置
|
||||
FlowProcessData string `form:"flowProcessData"` // 流程配置
|
||||
Id int `form:"id"` //
|
||||
FlowName string `form:"flowName"` // 流程名称
|
||||
FlowGroup int `form:"flowGroup"` // 流程分类
|
||||
FlowRemark string `form:"flowRemark"` // 流程描述
|
||||
FlowFormData string `form:"flowFormData"` // 表单配置
|
||||
FlowProcessData string `form:"flowProcessData"` // 流程配置
|
||||
FlowProcessDataList string `form:"flowProcessDataList"` // 流程配置list数据
|
||||
|
||||
}
|
||||
|
||||
@@ -42,11 +45,11 @@ type FlowTemplateDelReq struct {
|
||||
|
||||
//FlowTemplateResp 流程模板返回信息
|
||||
type FlowTemplateResp struct {
|
||||
Id int `json:"id" structs:"id"` //
|
||||
FlowName string `json:"flowName" structs:"flowName"` // 流程名称
|
||||
FlowGroup int `json:"flowGroup" structs:"flowGroup"` // 流程分类
|
||||
FlowRemark string `json:"flowRemark" structs:"flowRemark"` // 流程描述
|
||||
FlowFormData string `json:"flowFormData" structs:"flowFormData"` // 表单配置
|
||||
FlowProcessData string `json:"flowProcessData" structs:"flowProcessData"` // 流程配置
|
||||
|
||||
Id int `json:"id" structs:"id"` //
|
||||
FlowName string `json:"flowName" structs:"flowName"` // 流程名称
|
||||
FlowGroup int `json:"flowGroup" structs:"flowGroup"` // 流程分类
|
||||
FlowRemark string `json:"flowRemark" structs:"flowRemark"` // 流程描述
|
||||
FlowFormData string `json:"flowFormData" structs:"flowFormData"` // 表单配置
|
||||
FlowProcessData string `json:"flowProcessData" structs:"flowProcessData"` // 流程配置
|
||||
FlowProcessDataList string `form:"flowProcessDataList"` // 流程配置list数据
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package flow_template
|
||||
|
||||
import (
|
||||
"x_admin/core"
|
||||
"x_admin/core/request"
|
||||
"x_admin/core/response"
|
||||
"x_admin/model"
|
||||
@@ -17,8 +18,11 @@ type IFlowTemplateService interface {
|
||||
Del(id int) (e error)
|
||||
}
|
||||
|
||||
var Service = NewFlowTemplateService()
|
||||
|
||||
// NewFlowTemplateService 初始化
|
||||
func NewFlowTemplateService(db *gorm.DB) IFlowTemplateService {
|
||||
func NewFlowTemplateService() *flowTemplateService {
|
||||
db := core.GetDB()
|
||||
return &flowTemplateService{db: db}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ package admin
|
||||
|
||||
import (
|
||||
"x_admin/admin/flow_template"
|
||||
"x_admin/core"
|
||||
"x_admin/middleware"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -28,11 +27,8 @@ flow_template:detail
|
||||
|
||||
// FlowTemplateRoute(rg)
|
||||
func FlowTemplateRoute(rg *gin.RouterGroup) {
|
||||
db := core.GetDB()
|
||||
|
||||
server := flow_template.NewFlowTemplateService(db)
|
||||
|
||||
handle := flow_template.FlowTemplateHandler{Service: server}
|
||||
handle := flow_template.FlowTemplateHandler{}
|
||||
|
||||
rg = rg.Group("/", middleware.TokenAuth())
|
||||
rg.GET("/flow_template/list", handle.List)
|
||||
|
||||
Reference in New Issue
Block a user