diff --git a/api/shiyan/maptostruct/shiyan.go b/api/shiyan/maptostruct/shiyan.go index 5ccb047..31c2a16 100644 --- a/api/shiyan/maptostruct/shiyan.go +++ b/api/shiyan/maptostruct/shiyan.go @@ -415,3 +415,42 @@ func (a *ApiMethod) TestTable(c *gin.Context) { fmt.Printf("%v => %T\n", k, v) } } + +/* +* +@ 作者: 秦东 +@ 时间: 2023-10-17 16:42:55 +@ 功能: 加密实验 +@ 参数 + + # + +@ 返回值 + + # + +@ 方法原型 + + # +*/ +func (a *ApiMethod) JiaMiShiYan(c *gin.Context) { + // var requestData JiaMi + // err := c.ShouldBindQuery(&requestData) + // if err != nil { + // publicmethod.Result(100, err, c) + // return + // } + + singStr := fmt.Sprintf("%v%v%v", c.Query("userkey"), c.Query("usertoken"), c.Query("time")) + + var singCodeMd5 publicmethod.Md5Encryption + singCodeMd5.Md5EncryptionInit(singStr) + signCodeRedisKey := singCodeMd5.Md5EncryptionAlgorithm() + sendData := publicmethod.MapOut[string]() + sendData["signCodeRedisKey"] = signCodeRedisKey + sendData["userkey"] = c.Query("userkey") + sendData["usertoken"] = c.Query("usertoken") + sendData["time"] = c.Query("time") + sendData["singStr"] = singStr + publicmethod.Result(0, sendData, c) +} diff --git a/api/shiyan/maptostruct/type.go b/api/shiyan/maptostruct/type.go index 13910da..956adc3 100644 --- a/api/shiyan/maptostruct/type.go +++ b/api/shiyan/maptostruct/type.go @@ -106,3 +106,9 @@ type worker struct { in chan int done chan bool } + +type JiaMi struct { + UserKey string `json:"userkey"` + UserToken string `json:"usertoken"` + Time int64 `json:"time"` +} diff --git a/api/shiyan/数据结构收集/工作流审批.js b/api/shiyan/数据结构收集/工作流审批.js new file mode 100644 index 0000000..a72307d --- /dev/null +++ b/api/shiyan/数据结构收集/工作流审批.js @@ -0,0 +1,22 @@ +let shenpi = { + "nodeNumber": "d1f460e7970e404e8894028ec5a434af", + "nodeName": "部门负责人", + "error": false, + "type": 1, + "settype": 3, + "selectMode": 0, + "selectRange": 0, + "directorLevel": 1, + "examineMode": 1, + "noHanderAction": 2, + "examineEndDirectorLevel": 1, + "childNode": {}, + "nodeUserList": [], + "fromNode": "61183cb9a0f24c3e942d5c037c26fea8", + "gotoNode": [ + "64f360f608024c09a986ab98269a01cd" + ], + "sendBackNode": "beginnode", + "attribute": 1, + "customNode": "beginnode" +} \ No newline at end of file diff --git a/api/shiyan/数据结构收集/工作流执行人.js b/api/shiyan/数据结构收集/工作流执行人.js new file mode 100644 index 0000000..952e0c5 --- /dev/null +++ b/api/shiyan/数据结构收集/工作流执行人.js @@ -0,0 +1,22 @@ +let zhixingren = { + "nodeNumber": "64f360f608024c09a986ab98269a01cd", + "nodeName": "被考核人", + "error": false, + "type": 3, + "settype": 7, + "selectMode": 0, + "selectRange": 0, + "directorLevel": 1, + "examineMode": 1, + "noHanderAction": 2, + "examineEndDirectorLevel": 1, + "childNode":{}, + "nodeUserList": [], + "fromNode": "d1f460e7970e404e8894028ec5a434af", + "gotoNode": [ + "53ce9a28c951427589c7b32c3d5c0eda" + ], + "sendBackNode": "d1f460e7970e404e8894028ec5a434af", + "attribute": 1, + "customNode": "d1f460e7970e404e8894028ec5a434af" +} \ No newline at end of file diff --git a/api/shiyan/数据结构收集/工作流抄送.js b/api/shiyan/数据结构收集/工作流抄送.js new file mode 100644 index 0000000..d097c0e --- /dev/null +++ b/api/shiyan/数据结构收集/工作流抄送.js @@ -0,0 +1,14 @@ +let chaosong ={ + "nodeNumber": "7c4db5b388a8406082a9f6a8163ab5b3", + "nodeName": "抄送人", + "type": 2, + "ccSelfSelectFlag": 1, + "childNode": null, + "nodeUserList": [], + "fromNode": "1216c7a2c16d4b869fbcf832c224ff7c", + "gotoNode": [ + "" + ], + "error": false + +} \ No newline at end of file diff --git a/api/shiyan/数据结构收集/工作流条件.js b/api/shiyan/数据结构收集/工作流条件.js new file mode 100644 index 0000000..c98a1ce --- /dev/null +++ b/api/shiyan/数据结构收集/工作流条件.js @@ -0,0 +1,14 @@ +let tiaojian = { + "nodeNumber": "61183cb9a0f24c3e942d5c037c26fea8", + "nodeName": "条件1", + "error": false, + "type": 4, + "priorityLevel": 1, + "conditionList": [], + "nodeUserList": [], + "childNode": {}, + "fromNode": "1216c7a2c16d4b869fbcf832c224ff7c", + "gotoNode": [ + "d1f460e7970e404e8894028ec5a434af" + ] +} \ No newline at end of file diff --git a/api/shiyan/数据结构收集/工作流条件内容.js b/api/shiyan/数据结构收集/工作流条件内容.js new file mode 100644 index 0000000..17b4c63 --- /dev/null +++ b/api/shiyan/数据结构收集/工作流条件内容.js @@ -0,0 +1,123 @@ +let conditionList= [ + { + "id": 1, + "name": "申请人", + "factorid": "applicant", + "type": 1, + "isok": false, + "isCheckbox": true, + "options": [], + "answers": [], + "customFields": [], + "nodeUserList": [ + { + "type": 2, + "targetId": "1", + "name": "超级管理员" + }, + { + "type": 2, + "targetId": "3", + "name": "高管" + }, + { + "type": 1, + "targetId": "16048852977430055", + "name": "张延考", + "icon": "http://wework.qpic.cn/wwhead/duc2TvpEgSTPk74IwG7Bs3cMoS8QicE4cibhM9m5qKoavN85KpHxtBr8fhWZADzdDpCgwkIQPvBdY/0", + "iconToBase64": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAgAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAB4AGQDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDh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nyt1dxRybdwjLfMR7Dqa8w8Q+JJtYkKIvlW4bKr3PuaybmYyTzXFxIzycF5HOSSahA34aNgQehrpw+BhSd3qzlxGOnVVlogQfianyQVUdaFhZQCaIzumyf4R+td1uhxOZMR5a4HXvTF+Yk0Mc5xSr8q1dieZj8jpRVdpMGigd2VC26b6VOpwaKKESyR2ANIeVJNFFMRTKIVZm4QdTjk+wqKS6nEeY8Qxj7qqOfzoorNloSLUHCsl0hdGx8wGCPyxWpbmIRL9n2lR2B/nRRSjuOWwxROty7M4aFskDjj0FNV9rOe5NFFXFWIbuTJwnNBf5aKKsRUY5Yk0UUVBR//2Q==" + }, + { + "type": 1, + "targetId": "16048851807127870", + "name": "徐新平", + "icon": "https://wework.qpic.cn/wwhead/duc2TvpEgSTPk74IwG7Bs68Uo3iaQiaXgQ8dES36Cc4iaDtt9mKcRiaMzACXYEt1Usw797DIIcrzibSk/0", + "iconToBase64": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAgAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAB4AGQDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAA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bc0y+1NU5RaZki9kX/YzToz2rrSOdsd/GKTrIfUUp+9mm5xKaqxFyG4+SZWHHIqYk569KZOnmLjvTmPLH8qVrMGxr4HPUfWomGDn2qTGcE5zTSOQaZIxgQMnrTR0FOflsUnemUKBk06kB4pM4600xNDs44opvB5opiJUB+0O3UiMA/pT14NFFQih/VqYfv0UVRKHH71NdcnpRRUvcaE2kAUxugJ9D/SiikMjAzzW1o2kRXkDzTCRwGK4QgbcAHJ/MfrRRXBmlWdLDOUHZ6Hbl9OFTEKM1dElz4aczKYJEijcEqLhsEn0BA5zyR9D6ZMaeFr2R1Hn23JI++ew57UUV4kM0xKgtTsr4OkqrSWhBL4d1OKQqIA455VhjrjvRRRWkc5xDWy+7/gmH1On5n/2Q==" + }, + { + "type": 3, + "targetId": "102", + "name": "企管部" + }, + { + "type": 3, + "targetId": "104", + "name": "营销部" + } + ] + }, + { + "id": 2, + "name": "自定义字段", + "factorid": "customFields", + "type": 2, + "isok": false, + "isCheckbox": false, + "options": [], + "answers": [], + "customFields": [ + { + "wordfield": "one", + "optType": "1", + "leftval": "5" + }, + { + "wordfield": "qujian", + "optType": "6", + "leftval": "1", + "leftoptType": "1", + "rightoptType": "3", + "rightval": "10" + } + ] + }, + { + "id": 3, + "name": "单选框组(固定选项)", + "factorid": "dan1xuan3kuang1zu3gu4ding4xuan3xiang4", + "type": 3, + "isok": false, + "isCheckbox": false, + "options": [ + { + "label": "男", + "value": "1" + }, + { + "label": "女", + "value": "2" + } + ], + "answers": [ + "2" + ], + "customFields": [] + }, + { + "id": 4, + "name": "多选框组", + "factorid": "checkbox1695712007255", + "type": 3, + "isok": false, + "isCheckbox": true, + "options": [ + { + "label": "书", + "value": "1" + }, + { + "label": "笔", + "value": "2" + }, + { + "label": "墨", + "value": "3" + } + ], + "answers": [ + "2", + "3" + ], + "customFields": [] + } +] \ No newline at end of file diff --git a/api/shiyan/数据结构收集/工作流起点.js b/api/shiyan/数据结构收集/工作流起点.js new file mode 100644 index 0000000..871b3e2 --- /dev/null +++ b/api/shiyan/数据结构收集/工作流起点.js @@ -0,0 +1,28 @@ +let kjk={ + "nodeNumber": "178070847322345472", + "nodeName": "发起人", + "type": 0, + "fromNode": "", + "gotoNode": [ + "1216c7a2c16d4b869fbcf832c224ff7c" + ], + "attribute": "", + "error": false, + "priorityLevel": 0, + "settype": 0, + "selectMode": 0, + "selectRange": 0, + "directorLevel": 0, + "examineMode": 0, + "noHanderAction": 0, + "examineEndDirectorLevel": 0, + "nodeUserList": null, + "ccSelfSelectFlag": 0, + "conditionList": null, + "childNode":{}, + "conditionNodes": null, + "sendBackNode": "", + "databasecondition": null, + "customNode": "", + "executionaddress": "" +} \ No newline at end of file diff --git a/api/shiyan/数据结构收集/工作流路由.js b/api/shiyan/数据结构收集/工作流路由.js new file mode 100644 index 0000000..79a2c5a --- /dev/null +++ b/api/shiyan/数据结构收集/工作流路由.js @@ -0,0 +1,11 @@ +let route = { + "nodeNumber": "1216c7a2c16d4b869fbcf832c224ff7c", + "nodeName": "路由", + "type": 5, + "childNode": {}, + "fromNode": "178070847322345472", + "gotoNode": [ + "7c4db5b388a8406082a9f6a8163ab5b3" + ], + "conditionNodes": [] +} \ No newline at end of file diff --git a/api/version1/customerform/form.go b/api/version1/customerform/form.go index 86199d4..4dcdea1 100644 --- a/api/version1/customerform/form.go +++ b/api/version1/customerform/form.go @@ -42,7 +42,7 @@ func (a *ApiMethod) CustomerFormList(c *gin.Context) { } fmt.Printf("requestData---->%v---->%v\n", requestData, ersr) var formList []modelAppPlatform.CustomerForm - gormDb := overall.CONSTANT_DB_AppPlatform.Model(&modelAppPlatform.CustomerForm{}).Select("`id`,`name`,`tablename`,`classify`,`permit`,`states`,`creater_time`").Where("`states` BETWEEN ? AND ?", 1, 2) + gormDb := overall.CONSTANT_DB_AppPlatform.Model(&modelAppPlatform.CustomerForm{}).Select("`id`,`name`,`tablename`,`classify`,`permit`,`states`,`creater_time`,`flowkey`").Where("`states` BETWEEN ? AND ?", 1, 2) if requestData.KeyWords != "" { gormDb = gormDb.Where("`name` LIKE ? OR `tablename` LIKE ?", "%"+requestData.KeyWords+"%", "%"+requestData.KeyWords+"%") } @@ -71,6 +71,10 @@ func (a *ApiMethod) CustomerFormList(c *gin.Context) { userCont := HaveCustomerFormCreaterUs(v.TableNames) sendCont.CreaterName = userCont.Name sendCont.CreaterTime = publicmethod.UnixTimeToDay(v.CreaterTime, 1) + if v.FlowKey != 0 { + sendCont.FlowKey = strconv.FormatInt(v.FlowKey, 10) + } + sendList = append(sendList, sendCont) } publicmethod.ResultList(0, requestData.Page, requestData.PageSize, total, int64(len(sendList)), sendList, c) diff --git a/api/version1/customerform/type.go b/api/version1/customerform/type.go index 45611c1..ce0d124 100644 --- a/api/version1/customerform/type.go +++ b/api/version1/customerform/type.go @@ -187,6 +187,7 @@ type SendCustomerForm struct { Classify int `json:"classify"` CreaterName string `json:"creatername"` CreaterTime string `json:"creatertime"` + FlowKey string `json:"flowkey"` } // 输出自定义表格基础信息 diff --git a/api/version1/taskplatform/taskflow/flowType.go b/api/version1/taskplatform/taskflow/flowType.go new file mode 100644 index 0000000..163eda3 --- /dev/null +++ b/api/version1/taskplatform/taskflow/flowType.go @@ -0,0 +1,103 @@ +package taskflow + +import "appPlatform/overall/publicmethod" + +/** +@ 作者: 秦东 +@ 时间: 2023-10-26 09:34:29 +@ 功能: 工作流结构体 +*/ +type FlowMainBody struct { + TableId string `json:"tableId"` //工作流识别吗 + WorkFlowDef WorkFlowDefInfo `json:"workFlowDef"` //工作流主体属性 + DirectorMaxLevel int `json:"directorMaxLevel"` //审批主管最大层级 + FlowPermission []FlowPermissionInfo `json:"flowPermission"` //流程发起人 + NodeConfig NodePublicInfo `json:"nodeConfig"` //节点信息内容 +} + +//工作流主体属性 +type WorkFlowDefInfo struct { + FormKey string `json:"formKey"` //关联操作ID + publicmethod.PublicName //姓名 +} + +//人员;角色;行政组织;职务通用结构体 +type FlowPermissionInfo struct { + Types int `json:"type"` //1:人员;2:角色;3:行政组织;4:职务 + TargetId string `json:"targetId"` //相关内容识别符 + publicmethod.PublicName //相关内容名称 + Icon string `json:"icon"` //头像 + IconToBase64 string `json:"iconToBase64"` //头像Base64 +} +type NodePublicInfoES struct { + NodeNumber string `json:"nodeNumber"` //节点识别符 + NodeName string `json:"nodeName"` //节点名称 + Types int `json:"type"` //0:发起人;1:审批;2:抄送;3:执行人;4:条件;5:路由 + FromNode string `json:"fromNode"` //来源节点 + GotoNode []string `json:"gotoNode"` //流向节点 + PriorityLevel int `json:"priorityLevel"` // 条件优先级 + Attribute int `json:"attribute"` //属性 1:申请人为基线;2:目标人为基线 + Errors bool `json:"error"` //当前审批是否通过校验 + CcSelfSelectFlag int `json:"ccSelfSelectFlag"` //允许发起人自选抄送人(0:不允许;1:允许) + NodeUserList []NodeUserListInfo `json:"nodeUserList"` //操作人 + ConditionList []ConditionListInfo `json:"conditionList"` //判断条件主体 + ChildNode *NodePublicInfo `json:"childNode"` //子节点 +} + +//节点通用内容 +type NodePublicInfo struct { + NodePublicInfoES + Settype int `json:"settype"` // 审批人设置 1:指定成员; 2:主管;3:行政岗位; 4:发起人自选; 5:发起人自己;6:连续多级主管;7:指定前置审批为本节点设置审批人;8:表单字段 + SelectMode int `json:"selectMode"` //审批人数 1选一个人 2选多个人 + SelectRange int `json:"selectRange"` //选择范围 1.全公司 2指定成员 2指定角色 + DirectorLevel int `json:"directorLevel"` //审批终点 最高层主管数 + ExamineMode int `json:"examineMode"` //多人审批时采用的审批方式 1:依次审批; 2:会签;3:非会签 + NoHanderAction int `json:"noHanderAction"` //审批人为空时 1自动审批通过/不允许发起 2转交给审核管理员 + ExamineEndDirectorLevel int `json:"examineEndDirectorLevel"` //审批终点 第n层主管 + SendBackNode string `json:"sendBackNode"` //退回哪个节点 + CustomNode string `json:"customNode"` //指定前置审批为本节点设置审批人 + + ConditionNodes []NodePublicInfoES `json:"conditionNodes"` //判断条件,当节点是路由时有效 + Executionaddress string `json:"executionaddress"` //第三方执行地址 + + ChildNode *NodePublicInfo `json:"childNode"` //子节点 +} + +//节点执行人 +type NodeUserListInfo struct { + FlowPermissionInfo + publicmethod.CommonId[string] + publicmethod.PublicName + Options []OptionsInfo `json:"options"` //可选项(用于关联表单使用) + IsCheckbox bool `json:"isCheckbox"` //结果值多选 +} + +//可选项(用于关联表单使用) +type OptionsInfo struct { + Label string `json:"label"` //名称 + Value string `json:"value"` //值 +} + +//判断条件主体 +type ConditionListInfo struct { + publicmethod.CommonId[int] //条件顺序 + publicmethod.PublicName //条件名称 + Factorid string `json:"factorid"` //条件识别字段 + Types int `json:"type"` //条件类型:1:人员、行政组织、角色;2:自定义字段;3:关联表单字段; + Isok bool `json:"isok"` //页面渲染使用 + IsCheckbox bool `json:"isCheckbox"` //结果值多选 + Options []OptionsInfo `json:"options"` //可选项(用于关联表单使用) + Answers []string `json:"answers"` //可选项锚定值(用于关联表单使用) + CustomFields []CustomFieldsInfo `json:"customFields"` //自定义字段条件主体 + NodeUserList []FlowPermissionInfo `json:"nodeUserList"` //人员、行政组织、角色为条件主体 +} + +//自定义字段条件主体 +type CustomFieldsInfo struct { + Wordfield string `json:"wordfield"` //判断字段 + OptType string `json:"optType"` //判定方法(1:小于;2:大于;3:小于等于;4:等于;5:大于等于;6:介于两数之间;7:包含;8:不包含) + LeftVal string `json:"leftval"` //左侧值 + LeftOptType string `json:"leftoptType"` //OptType值为6时;左侧判定方法 + RightOptType string `json:"rightoptType"` //OptType值为6时;右侧判定方法 + RightVal string `json:"rightval"` //OptType值为6时;右侧值 +} diff --git a/api/version1/taskplatform/taskflow/flowengine.go b/api/version1/taskplatform/taskflow/flowengine.go new file mode 100644 index 0000000..37a5b01 --- /dev/null +++ b/api/version1/taskplatform/taskflow/flowengine.go @@ -0,0 +1,451 @@ +package taskflow + +import ( + "appPlatform/models/modelAppPlatform" + "appPlatform/overall" + "appPlatform/overall/publicmethod" + "encoding/json" + "fmt" + "strconv" + "strings" + "time" + + "github.com/gin-gonic/gin" +) + +/* +* +@ 作者: 秦东 +@ 时间: 2023-10-26 11:36:54 +@ 功能: 写入工作流 +@ 参数 + + # + +@ 返回值 + + # + +@ 方法原型 + + # +*/ +func (a *ApiMethod) SaveFlowCont(c *gin.Context) { + var requestData FlowMainBody + err := c.ShouldBindJSON(&requestData) + if err != nil { + publicmethod.Result(100, err, c) + return + } + if requestData.NodeConfig.NodeNumber == "" { + publicmethod.Result(1, err, c, "工作流数据错误!请检查后再提交") + return + } + uuid := publicmethod.GetUUid(1) + if requestData.TableId != "" { + requestData.TableId = strconv.FormatInt(publicmethod.GetUUid(1), 10) + uuid, _ = strconv.ParseInt(requestData.TableId, 10, 64) + } + if requestData.DirectorMaxLevel == 0 { + requestData.DirectorMaxLevel = 4 + } + publicTime := time.Now().Unix() + var worfFlowMain modelAppPlatform.WorkFlow //工作流主体 + worfFlowMain.Id = uuid + worfFlowMain.Name = requestData.WorkFlowDef.Name + worfFlowMain.Describe = fmt.Sprintf("%v关联工作流", requestData.WorkFlowDef.Name) + worfFlowMain.OpenWechat = 1 + worfFlowMain.State = 1 + if requestData.WorkFlowDef.FormKey != "" { + formKey, _ := strconv.ParseInt(requestData.WorkFlowDef.FormKey, 10, 64) + worfFlowMain.FormKey = formKey + } + worfFlowMain.Time = publicTime + var numVal int64 + var flowVersion modelAppPlatform.WorkFlowVersion + overall.CONSTANT_DB_AppPlatform.Model(&flowVersion).Where("`key` = ?", uuid).Count(&numVal) + flowVersion.Key = uuid + flowVersion.Version = strconv.FormatInt(numVal+1, 10) + var isVersionNum int64 + overall.CONSTANT_DB_AppPlatform.Model(&flowVersion).Where("`state` = 1 AND `key` = ?", uuid).Count(&isVersionNum) + flowVersion.State = 1 + if isVersionNum > 0 { + flowVersion.State = 2 + } + flowVersion.Time = publicTime + jsonCont, _ := json.Marshal(requestData) + flowVersion.Content = string(jsonCont) + var userList []string + var orgList []string + isFormWrite := false + if len(requestData.FlowPermission) > 0 { + for _, v := range requestData.FlowPermission { + if v.Types == 3 { + // orgId, _ := strconv.ParseInt(v.TargetId, 10, 64) + orgList = append(orgList, v.TargetId) + isFormWrite = true + } + if v.Types == 1 { + // userId, _ := strconv.ParseInt(v.TargetId, 10, 64) + userList = append(userList, v.TargetId) + isFormWrite = true + } + } + } + + if isFormWrite { + var customerForm modelAppPlatform.CustomerForm + err = customerForm.GetCont(map[string]interface{}{"`id`": requestData.WorkFlowDef.FormKey}, "`permitstr`", "`userpermit`") + if err == nil { + saveData := publicmethod.MapOut[string]() + if len(orgList) > 0 { + if customerForm.PermitStr != "" { + oldOrgList := strings.Split(customerForm.PermitStr, ",") + orgNew := publicmethod.MergeStruct(orgList, oldOrgList) + saveData["permitstr"] = strings.Join(orgNew, ",") + flowVersion.OrgPermit = strings.Join(orgNew, ",") + } + } else { + flowVersion.OrgPermit = customerForm.PermitStr + } + if len(userList) > 0 { + if customerForm.UserPermit != "" { + oldUserList := strings.Split(customerForm.UserPermit, ",") + userNew := publicmethod.MergeStruct(userList, oldUserList) + saveData["userpermit"] = strings.Join(userNew, ",") + flowVersion.UserPermit = strings.Join(userNew, ",") + } + } else { + flowVersion.UserPermit = customerForm.UserPermit + } + saveData["flowkey"] = uuid + if len(saveData) > 0 { + saveData["edit_time"] = time.Now().Unix() + customerForm.EiteCont(map[string]interface{}{"`id`": requestData.WorkFlowDef.FormKey}, saveData) + } + } + } + + sendMap := publicmethod.MapOut[string]() + writeDb := overall.CONSTANT_DB_AppPlatform.Begin() + flowErr := writeDb.Create(&worfFlowMain).Error + versionErr := writeDb.Create(&flowVersion).Error + sendMap["flowErr"] = flowErr + sendMap["versionErr"] = versionErr + if flowErr == nil && versionErr == nil { + writeDb.Commit() + + } else { + writeDb.Rollback() + publicmethod.Result(104, sendMap, c) + } + publicmethod.Result(0, sendMap, c) +} + +/* +* +@ 作者: 秦东 +@ 时间: 2023-10-27 10:25:00 +@ 功能: 获取工作流内容 +@ 参数 + + # + +@ 返回值 + + # + +@ 方法原型 + + # +*/ +func (a *ApiMethod) GainFlowInfo(c *gin.Context) { + var requestData publicmethod.CommonId[string] + err := c.ShouldBindJSON(&requestData) + if err != nil || requestData.Id == "" { + publicmethod.Result(100, err, c) + return + } + var flowVersionInfo modelAppPlatform.FlowVersion + err = flowVersionInfo.GetCont(map[string]interface{}{"`id`": requestData.Id}, "`content`") + if err != nil && flowVersionInfo.Content == "" { + publicmethod.Result(104, err, c) + return + } + var flowVersionCont FlowMainBody + err = json.Unmarshal([]byte(flowVersionInfo.Content), &flowVersionCont) + if err != nil { + publicmethod.Result(104, err, c) + return + } + publicmethod.Result(0, flowVersionCont, c) +} + +/* +* +@ 作者: 秦东 +@ 时间: 2023-10-27 14:41:00 +@ 功能: 编辑工作流 +@ 参数 + + # + +@ 返回值 + + # + +@ 方法原型 + + # +*/ +func (a *ApiMethod) EditFlowCont(c *gin.Context) { + var requestData EditFlowInfo + err := c.ShouldBindJSON(&requestData) + if err != nil || requestData.Id == "" { + publicmethod.Result(100, err, c) + return + } + why := publicmethod.MapOut[string]() + why["`id`"] = requestData.Id + var flowVersionInfo modelAppPlatform.FlowVersion + err = flowVersionInfo.GetCont(why) + if err != nil { + publicmethod.Result(107, err, c) + return + } + var userList []string + var orgList []string + isFormWrite := false + if len(requestData.FlowInfo.FlowPermission) > 0 { + for _, v := range requestData.FlowInfo.FlowPermission { + if v.Types == 3 { + // orgId, _ := strconv.ParseInt(v.TargetId, 10, 64) + orgList = append(orgList, v.TargetId) + isFormWrite = true + } + if v.Types == 1 { + // userId, _ := strconv.ParseInt(v.TargetId, 10, 64) + userList = append(userList, v.TargetId) + isFormWrite = true + } + } + } + editInfo := publicmethod.MapOut[string]() + jsonCont, _ := json.Marshal(requestData.FlowInfo) + editInfo["`content`"] = jsonCont + editInfo["`time`"] = time.Now().Unix() + if isFormWrite { + var customerForm modelAppPlatform.CustomerForm + err = customerForm.GetCont(map[string]interface{}{"`id`": flowVersionInfo.FormKey}, "`permitstr`", "`userpermit`") + if err == nil { + saveData := publicmethod.MapOut[string]() + if len(orgList) > 0 { + if customerForm.PermitStr != "" { + oldOrgList := strings.Split(customerForm.PermitStr, ",") + orgNew := publicmethod.MergeStruct(orgList, oldOrgList) + saveData["permitstr"] = strings.Join(orgNew, ",") + editInfo["orgpermit"] = strings.Join(orgNew, ",") + } + } else { + editInfo["orgpermit"] = customerForm.PermitStr + } + if len(userList) > 0 { + if customerForm.UserPermit != "" { + oldUserList := strings.Split(customerForm.UserPermit, ",") + userNew := publicmethod.MergeStruct(userList, oldUserList) + saveData["userpermit"] = strings.Join(userNew, ",") + editInfo["userpermit"] = strings.Join(userNew, ",") + } + } else { + editInfo["userpermit"] = customerForm.UserPermit + } + if len(saveData) > 0 { + saveData["edit_time"] = time.Now().Unix() + customerForm.EiteCont(map[string]interface{}{"`id`": flowVersionInfo.FormKey}, saveData) + } + } + } + err = flowVersionInfo.EiteCont(why, editInfo) + if err != nil { + publicmethod.Result(106, err, c) + return + } + publicmethod.Result(0, err, c) +} + +/* +* +@ 作者: 秦东 +@ 时间: 2023-10-27 15:54:31 +@ 功能: 另存为新版 +@ 参数 + + # + +@ 返回值 + + # + +@ 方法原型 + + # +*/ +func (a *ApiMethod) SaveNewFlow(c *gin.Context) { + var requestData EditFlowInfo + err := c.ShouldBindJSON(&requestData) + if err != nil || requestData.Id == "" { + publicmethod.Result(100, err, c) + return + } + why := publicmethod.MapOut[string]() + why["`id`"] = requestData.Id + var flowVersionInfo modelAppPlatform.FlowVersion + err = flowVersionInfo.GetCont(why) + if err != nil { + publicmethod.Result(107, err, c) + return + } + uuid := flowVersionInfo.Key + publicTime := time.Now().Unix() + var numVal int64 + var flowVersion modelAppPlatform.WorkFlowVersion + overall.CONSTANT_DB_AppPlatform.Model(&flowVersion).Where("`key` = ?", uuid).Count(&numVal) + flowVersion.Key = uuid + flowVersion.Version = strconv.FormatInt(numVal+1, 10) + var isVersionNum int64 + overall.CONSTANT_DB_AppPlatform.Model(&flowVersion).Where("`state` = 1 AND `key` = ?", uuid).Count(&isVersionNum) + flowVersion.State = 1 + if isVersionNum > 0 { + flowVersion.State = 2 + } + flowVersion.Time = publicTime + jsonCont, _ := json.Marshal(requestData.FlowInfo) + flowVersion.Content = string(jsonCont) + var userList []string + var orgList []string + isFormWrite := false + if len(requestData.FlowInfo.FlowPermission) > 0 { + for _, v := range requestData.FlowInfo.FlowPermission { + if v.Types == 3 { + // orgId, _ := strconv.ParseInt(v.TargetId, 10, 64) + orgList = append(orgList, v.TargetId) + isFormWrite = true + } + if v.Types == 1 { + // userId, _ := strconv.ParseInt(v.TargetId, 10, 64) + userList = append(userList, v.TargetId) + isFormWrite = true + } + } + } + + if isFormWrite { + var customerForm modelAppPlatform.CustomerForm + err = customerForm.GetCont(map[string]interface{}{"`id`": flowVersionInfo.FormKey}, "`permitstr`", "`userpermit`") + if err == nil { + saveData := publicmethod.MapOut[string]() + if len(orgList) > 0 { + if customerForm.PermitStr != "" { + oldOrgList := strings.Split(customerForm.PermitStr, ",") + orgNew := publicmethod.MergeStruct(orgList, oldOrgList) + saveData["permitstr"] = strings.Join(orgNew, ",") + flowVersion.OrgPermit = strings.Join(orgNew, ",") + } + } else { + flowVersion.OrgPermit = customerForm.PermitStr + } + if len(userList) > 0 { + if customerForm.UserPermit != "" { + oldUserList := strings.Split(customerForm.UserPermit, ",") + userNew := publicmethod.MergeStruct(userList, oldUserList) + saveData["userpermit"] = strings.Join(userNew, ",") + flowVersion.UserPermit = strings.Join(userNew, ",") + } + } else { + flowVersion.UserPermit = customerForm.UserPermit + } + saveData["flowkey"] = uuid + if len(saveData) > 0 { + saveData["edit_time"] = time.Now().Unix() + customerForm.EiteCont(map[string]interface{}{"`id`": flowVersionInfo.FormKey}, saveData) + } + } + } + err = flowVersion.InSetCont() + if err != nil { + publicmethod.Result(104, err, c) + return + } + publicmethod.Result(0, err, c) +} + +/* +* +@ 作者: 秦东 +@ 时间: 2023-10-27 16:33:54 +@ 功能: 启用&禁用 +@ 参数 + + # + +@ 返回值 + + # + +@ 方法原型 + + # +*/ +func (a *ApiMethod) SwitchFlowVersion(c *gin.Context) { + var requestData SwitchFlowStatus + err := c.ShouldBindJSON(&requestData) + if err != nil || requestData.Id == "" { + publicmethod.Result(100, err, c) + return + } + if requestData.Status == 0 { + requestData.Status = 2 + } + why := publicmethod.MapOut[string]() + why["`id`"] = requestData.Id + var flowVersionInfo modelAppPlatform.FlowVersion + err = flowVersionInfo.GetCont(why) + if err != nil { + publicmethod.Result(107, err, c) + return + } + publicTime := time.Now().Unix() + var flowVersionCont modelAppPlatform.WorkFlowVersion + saveVersion := publicmethod.MapOut[string]() + saveVersion["`state`"] = requestData.Status + saveVersion["`time`"] = publicTime + var isVersionNum int64 + overall.CONSTANT_DB_AppPlatform.Model(&flowVersionCont).Where("`state` = 1 AND `key` = ?", flowVersionInfo.Key).Count(&isVersionNum) + if requestData.Status == 1 { + if isVersionNum < 1 { + err = flowVersionCont.EiteCont(why, saveVersion) + if err == nil { + var flowInfo modelAppPlatform.WorkFlow + err = flowInfo.EiteCont(map[string]interface{}{"`id`": flowVersionInfo.Key}, map[string]interface{}{"`state`": requestData.Status, "`time`": publicTime}) + } + } else { + err = flowVersionCont.EiteCont(map[string]interface{}{"`key`": flowVersionInfo.Key}, map[string]interface{}{"`state`": 2, "`time`": publicTime}) + if err == nil { + err = flowVersionCont.EiteCont(why, saveVersion) + } + } + } else { + err = flowVersionCont.EiteCont(why, saveVersion) + if isVersionNum <= 1 { + if err == nil { + var flowInfo modelAppPlatform.WorkFlow + err = flowInfo.EiteCont(map[string]interface{}{"`id`": flowVersionInfo.Key}, map[string]interface{}{"`state`": requestData.Status, "`time`": publicTime}) + } + } + } + if err != nil { + publicmethod.Result(104, err, c) + return + } + publicmethod.Result(0, err, c) +} diff --git a/api/version1/taskplatform/taskflow/types.go b/api/version1/taskplatform/taskflow/types.go index 8cb1c08..d30c916 100644 --- a/api/version1/taskplatform/taskflow/types.go +++ b/api/version1/taskplatform/taskflow/types.go @@ -1,6 +1,7 @@ package taskflow import ( + "appPlatform/api/version1/customerform" "appPlatform/overall/publicmethod" "sync" @@ -34,3 +35,167 @@ func (a *ApiMethod) Index(c *gin.Context) { outputCont["index"] = "流程表单内容列表入口" publicmethod.Result(0, outputCont, c) } + +// 工作流结构体 +type FlowStructIng struct { + TableId string `json:"tableId"` //流程ID + WorkFlowDef publicmethod.PublicName `json:"workFlowDef"` //工作流程定义 + DirectorMaxLevel int `json:"directorMaxLevel"` //审批主管最大层级 + FlowPermission []FlowPermissionStruct `json:"flowPermission"` //发起人 + NodeConfig PublicChildNode `json:"nodeConfig"` //流程结构体 +} + +// 流程发起权限 +type FlowPermissionStruct struct { + Type string `json:"type"` // 1、人员 2、 3、行政组织 + TargetId string `json:"targetId"` //人员Key或行政组织ID + publicmethod.PublicName //人名或行政组织名称 + Icon string `json:"icon"` //人员头像URL + IconToBase64 string `json:"iconToBase64"` //人员头像 base64加密 +} + +// 基础结构 +type NodePublicStruct struct { + NodeNumber string `json:"nodeNumber"` //节点编号 + NodeName string `json:"nodeName"` //节点名称 + Type int `json:"type"` // 0 发起人 1审批 2抄送 3执行人 4路由 5条件 + FromNode string `json:"fromNode"` //来源节点 + GotoNode []string `json:"gotoNode"` //去向节点 + Attribute int `json:"attribute"` // 1:申请人为基线;2:目标人为基线 +} + +// 操作人 +type NodeUserListCont struct { + TargetID string `json:"targetId"` + Type string `json:"type"` // 1、人员 2、 3、行政组织,4: + Name string `json:"name"` + Icon string `json:"icon"` //人员头像URL + IconToBase64 string `json:"iconToBase64"` //人员头像 base64加密 +} + +// 当审批单同时满足以下条件时进入此流程 +type ConditionListCont struct { + ColumnID string `json:"columnId"` // + Type int `json:"type"` //1:发起人;2:关联数据表;3:自定义字段 + ConditionEn string `json:"conditionEn"` + ConditionCn string `json:"conditionCn"` + OptType string `json:"optType"` //["", "<", ">", "≤", "=", "≥"][optType] 计算符号 + Zdy1 string `json:"zdy1"` //左侧自定义内容 + Zdy2 string `json:"zdy2"` //右侧自定义内容 + Opt1 string `json:"opt1"` //左侧符号 < ≤ + Opt2 string `json:"opt2"` //右侧符号 < ≤ + ColumnDbname string `json:"columnDbname"` //条件字段名称 + ColumnType string `json:"columnType"` //条件字段类型 + ShowType string `json:"showType"` //checkBox多选 其他 + ShowName string `json:"showName"` //展示名 + FixedDownBoxValue string `json:"fixedDownBoxValue"` //多选数组 + DataBaseCondition []string `json:"databaseCondition"` //自定义数据库条件 + Condition []ConditionStruct `json:"condition"` //自定义字段 +} + +// 自定义条件字段 +type ConditionStruct struct { + WordField string `json:"wordfield"` //字段名称 + OptType string `json:"optType"` //["", "<", ">", "≤", "=", "≥","in","not in"][optType] 计算符号 1-8 + Factor FactorStruct `json:"factor"` //等式 +} + +// 等式 +type FactorStruct struct { + LeftOptType string `json:"leftoptType"` //左侧等式符号 + LeftVal string `json:"leftval"` //左侧等式值 + RightOptType string `json:"rightoptType"` //右侧等式符号 + RightVal string `json:"rightval"` //右侧等式值 +} + +// 关联数据库执行条件 +type DataBaseConditionStruct struct { + DataBaseName string `json:"databasename"` //数据库 + TableKey string `json:"tablekey"` //数据表 + WordList []WordListCont `json:"wordlist"` //规则列表 +} + +// 关联数据规则列表 +type WordListCont struct { + Key string `json:"key"` //字段 + Type string `json:"type"` //等式类行 1:小于;2:大于;3:小于等于;4:等于;5:大于等于;6:介于两数之间;in:包含;notin:不包含 + Comment string `json:"comment"` //字段描述 + Notation string `json:"notation"` //符号 + Equation EquationStruct `json:"equation"` //等式关系 +} + +// 等式关系 +type EquationStruct struct { + LeftNotation string `json:"leftnotation"` //左侧等式符号 + LetfVal string `json:"letfval"` //左侧等式值 + RightNotation string `json:"rightnotation"` //右侧等式符号 + RightVal string `json:"rightval"` //右侧等式符号 +} + +// 通用字段 +type PublicChildNode struct { + NodePublicStruct + Error bool `json:"error"` //当前审批是否通过校验 + PriorityLevel int `json:"priorityLevel"` // 条件优先级 + Settype int `json:"settype"` // 审批人设置 1指定成员 2主管 4发起人自选 5发起人自己 7连续多级主管 8:指定审批节点自选 + SelectMode int `json:"selectMode"` //审批人数 1选一个人 2选多个人 + SelectRange int `json:"selectRange"` //选择范围 1.全公司 2指定成员 2指定角色 + DirectorLevel int `json:"directorLevel"` //审批终点 最高层主管数 + ExamineMode int `json:"examineMode"` //多人审批时采用的审批方式 1依次审批 2会签 + NoHanderAction int `json:"noHanderAction"` //审批人为空时 1自动审批通过/不允许发起 2转交给审核管理员 + ExamineEndDirectorLevel int `json:"examineEndDirectorLevel"` //审批终点 第n层主管 + NodeUserList []NodeUserListCont `json:"nodeUserList"` //操作人 + CcSelfSelectFlag int `json:"ccSelfSelectFlag"` //允许发起人自选抄送人 + ConditionList []ConditionListCont `json:"conditionList"` //当审批单同时满足以下条件时进入此流程 + ChildNode *PublicChildNode `json:"childNode"` + ConditionNodes *[]PublicChildNode `json:"conditionNodes"` //条件节点 + SendBackNode string `json:"sendBackNode"` //退回到哪个节点 + DataBaseCondition []DataBaseConditionStruct `json:"databasecondition"` //关联数据库操作 + CustomNode string `json:"customNode"` //由哪个节点指定本节点审批人 + ExecutionAddress string `json:"executionaddress"` //执行节点跳转页面 +} + +// 输出流程版本 +type SendSmaileFlowVersion struct { + publicmethod.PublicId + Version string `json:"version"` + State int `json:"state"` + Key string `json:"key"` +} + +// 获取审批节点活条件节点表单条件 +type GainNodeFactor struct { + publicmethod.PublicId + Types int `json:"types"` +} + +// 输出作为条件得表单字段 +type SendFormNodeFactor struct { + publicmethod.PublicId + publicmethod.PublicName + Options []customerform.OptionsStruct `json:"options"` + IsCheckbox bool `json:"isCheckbox"` +} + +// 自定义表单结构 +type CustomerFormUnit struct { + MasterInfo []SunFormUnit +} + +type SunFormUnit struct { + UnitKey string + IsMaster bool + Info []customerform.MasterStruct +} + +// 编辑工作流 +type EditFlowInfo struct { + publicmethod.CommonId[string] + FlowInfo FlowMainBody `json:"flowinfo"` +} + +// 启用与禁用工作流版本 +type SwitchFlowStatus struct { + publicmethod.CommonId[string] + publicmethod.PublicStatus +} diff --git a/api/version1/taskplatform/taskflow/workflow.go b/api/version1/taskplatform/taskflow/workflow.go new file mode 100644 index 0000000..6335654 --- /dev/null +++ b/api/version1/taskplatform/taskflow/workflow.go @@ -0,0 +1,247 @@ +package taskflow + +import ( + "appPlatform/api/version1/customerform" + "appPlatform/models/modelAppPlatform" + "appPlatform/overall" + "appPlatform/overall/publicmethod" + "encoding/json" + "fmt" + "strconv" + + "github.com/gin-gonic/gin" +) + +/* +* +@ 作者: 秦东 +@ 时间: 2023-10-10 13:44:07 +@ 功能: 初始化工作流 +@ 参数 + + # + +@ 返回值 + + # + +@ 方法原型 + + # +*/ +func (a *ApiMethod) InitializeWorkFlow(c *gin.Context) { + var requestData publicmethod.PublicName + c.ShouldBindJSON(&requestData) + var workFlowStruct FlowStructIng + workFlowStruct.TableId = strconv.FormatInt(publicmethod.GetUUid(2), 10) + if requestData.Name != "" { + workFlowStruct.WorkFlowDef.Name = requestData.Name + } else { + workFlowStruct.WorkFlowDef.Name = "自定义工作流" + } + workFlowStruct.NodeConfig.NodeNumber = strconv.FormatInt(publicmethod.GetUUid(5), 10) + workFlowStruct.NodeConfig.NodeName = "发起人" + workFlowStruct.DirectorMaxLevel = 4 + workFlowStruct.NodeConfig.Attribute = 0 + // err := json.Unmarshal([]byte(jsonStrSmaill), &workFlowStruct) + outData := publicmethod.MapOut[string]() + outData["workFlowStruct"] = workFlowStruct + // outData["err"] = err + publicmethod.Result(0, workFlowStruct, c) +} + +/* +* +@ 作者: 秦东 +@ 时间: 2023-10-19 14:02:54 +@ 功能: 获取工作流版本列表 +@ 参数 + + # + +@ 返回值 + + # + +@ 方法原型 + + # +*/ +func (a *ApiMethod) GainFlowVersionList(c *gin.Context) { + var requestData publicmethod.CommonId[string] + err := c.ShouldBindJSON(&requestData) + if err != nil || requestData.Id == "" { + publicmethod.Result(10001, err, c) + return + } + var flowVersionList []modelAppPlatform.FlowVersion + err = overall.CONSTANT_DB_AppPlatform.Where("`state` IN ? AND `formkey` = ?", []int{1, 2}, requestData.Id).Find(&flowVersionList).Error + if err != nil || len(flowVersionList) < 1 { + publicmethod.Result(10001, err, c) + return + } + var sendList []SendSmaileFlowVersion + for _, v := range flowVersionList { + var sendCont SendSmaileFlowVersion + sendCont.Id = strconv.FormatInt(v.Id, 10) + sendCont.Version = v.Version + sendCont.State = v.State + sendCont.Key = strconv.FormatInt(v.Key, 10) + sendList = append(sendList, sendCont) + } + publicmethod.Result(0, sendList, c) +} + +/* +* +@ 作者: 秦东 +@ 时间: 2023-10-19 16:18:36 +@ 功能: 获取审批节点或条件节点 +@ 参数 + + # + +@ 返回值 + + # + +@ 方法原型 + + # +*/ +func (a *ApiMethod) GainNodeFactor(c *gin.Context) { + var requestData GainNodeFactor + err := c.ShouldBindJSON(&requestData) + if err != nil || requestData.Id == "" { + publicmethod.Result(100, err, c) + return + } + var customerFormCont modelAppPlatform.CustomerForm + err = customerFormCont.GetCont(map[string]interface{}{"`id`": requestData.Id}, "`tablename`") + if err != nil { + publicmethod.Result(106, err, c) + return + } + var customerFormVersionCont modelAppPlatform.CustomerFormVersion + err = customerFormVersionCont.GetCont(map[string]interface{}{"`tablekey`": customerFormCont.TableNames, "`status`": 1}, "`mastesformjson`") + if err != nil { + publicmethod.Result(106, err, c) + return + } + var sendList []SendFormNodeFactor + if customerFormVersionCont.MastesFormJson != "" { + var formJsonCont customerform.CustomerFormMaster + json.Unmarshal([]byte(customerFormVersionCont.MastesFormJson), &formJsonCont) + var unitList CustomerFormUnit + unitList.GetFormUnit(formJsonCont.Form.Name, formJsonCont.List, true) + + sendData := publicmethod.MapOut[string]() + // master, sunTable, jsonerr := taskmanagement.GainFormStruct(customerFormVersionCont.MastesFormJson) + // if jsonerr != nil { + // publicmethod.Result(104, err, c) + // return + // } + if len(unitList.MasterInfo) > 0 { + var masterUnit []customerform.MasterStruct + for _, v := range unitList.MasterInfo { + if v.IsMaster { + masterUnit = v.Info + } + } + for _, v := range masterUnit { + var sendCont SendFormNodeFactor + if requestData.Types == 1 && publicmethod.IsInTrue[string](v.Type, []string{"expand-user"}) { + sendCont.Id = v.Name + sendCont.Name = v.Name + if v.Item.Label != "" { + sendCont.Name = v.Item.Label + } + sendList = append(sendList, sendCont) + } else if requestData.Types != 1 && publicmethod.IsInTrue[string](v.Type, []string{"radio", "checkbox", "select", "switch"}) { + sendCont.Id = v.Name + sendCont.Name = v.Name + if v.Type == "switch" { + jsonstr, _ := json.Marshal(v.Control) + fmt.Printf("------>%v\n", string(jsonstr)) + var optInfoOne customerform.OptionsStruct + optInfoOne.Label = "是" + optInfoOne.Value = v.Control.ActiveValue + sendCont.Options = append(sendCont.Options, optInfoOne) + var optInfoTwo customerform.OptionsStruct + optInfoTwo.Label = "否" + optInfoTwo.Value = v.Control.InactiveValue + sendCont.Options = append(sendCont.Options, optInfoTwo) + } else { + sendCont.Options = v.Options + } + if v.Type == "checkbox" { + sendCont.IsCheckbox = true + } + + if v.Item.Label != "" { + sendCont.Name = v.Item.Label + } + sendList = append(sendList, sendCont) + } + } + } + // sendData["master"] = master + // sendData["sunTable"] = sunTable + sendData["sendList"] = sendList + sendData["unitList"] = unitList + publicmethod.Result(0, sendList, c) + } + // publicmethod.Result(0, sendList, c) +} + +// 获取表单组件 +func (f *CustomerFormUnit) GetFormUnit(tablename string, subUnitAry []customerform.MasterStruct, isMaster bool) { + if len(subUnitAry) > 0 { + var sqlAllAry []customerform.MasterStruct + for _, v := range subUnitAry { + switch v.Type { + case "flex", "table": + if len(v.List) > 0 { + f.GetFormUnit(v.Name, v.List, false) + } + case "grid", "tabs": + if len(v.Columns) > 0 { + for _, mv := range v.Columns { + f.GetFormUnit(tablename, mv.List, isMaster) + } + } + case "card", "div": + if len(v.List) > 0 { + f.GetFormUnit(tablename, v.List, isMaster) + } + default: + sqlAllAry = append(sqlAllAry, v) + + } + } + if len(sqlAllAry) > 0 { + if len(f.MasterInfo) > 0 { + isWrite := true + for sk, s := range f.MasterInfo { + if s.UnitKey == tablename { + f.MasterInfo[sk].Info = append(f.MasterInfo[sk].Info, sqlAllAry...) + isWrite = false + } + } + if isWrite { + var sunSqlInfo SunFormUnit + sunSqlInfo.UnitKey = tablename + sunSqlInfo.IsMaster = isMaster + sunSqlInfo.Info = sqlAllAry + f.MasterInfo = append(f.MasterInfo, sunSqlInfo) + } + } else { + var sunSqlInfo SunFormUnit + sunSqlInfo.UnitKey = tablename + sunSqlInfo.IsMaster = isMaster + sunSqlInfo.Info = sqlAllAry + f.MasterInfo = append(f.MasterInfo, sunSqlInfo) + } + } + } +} diff --git a/api/version1/taskplatform/taskmanagement/appform.go b/api/version1/taskplatform/taskmanagement/appform.go index be6916f..c0140e0 100644 --- a/api/version1/taskplatform/taskmanagement/appform.go +++ b/api/version1/taskplatform/taskmanagement/appform.go @@ -484,6 +484,7 @@ func (a *ApiMethod) CustomerFormEditData(c *gin.Context) { //判断是否 if len(sunFieldAry) > 0 { + // fmt.Printf("sunFieldAry:%v\n", sunFieldAry) //有子表 sunTypeAry := make(map[string]map[string]customerform.MasterStruct) for _, v := range formUnitCont.SunFormInfo { @@ -491,7 +492,9 @@ func (a *ApiMethod) CustomerFormEditData(c *gin.Context) { } err = EditWriteSunDatabase(uuid, userCont.Key, cureeTime, formCont.TableKey, masrWriteMap, sunFieldAry, sunTypeAry) } else { - err = overall.CONSTANT_DB_CustomerForm.Table(formCont.TableKey).Where("`masters_key` = ?", uuid).Updates(masterUnitList).Error + + err = overall.CONSTANT_DB_CustomerForm.Table(formCont.TableKey).Where("`masters_key` = ?", uuid).Updates(masrWriteMap).Error + // fmt.Printf("sunFieldAry2:%v----->%v\n", err, masrWriteMap) } if err != nil { @@ -755,12 +758,13 @@ func CustomerFormCallBackVal(val map[string]interface{}, valClass map[string]cus } else { sendVal = append(sendVal, v) } + if endKeyVal, ok := val[endField]; ok { if endVal, endOk := endKeyVal.(string); endOk { endValInt64, _ := strconv.ParseInt(endVal, 10, 64) sendVal = append(sendVal, endValInt64) } else { - sendVal = append(sendVal, endVal) + sendVal = append(sendVal, endKeyVal) } } convertVal[k] = sendVal @@ -787,30 +791,51 @@ func CustomerFormCallBackVal(val map[string]interface{}, valClass map[string]cus convertVal[k] = v } case "mediumtext", "longtext": - if valAry, ok := v.([]interface{}); ok { - if len(valAry) > 0 { - valStrJson, _ := json.Marshal(valAry) - convertVal[k] = string(valStrJson) - } else { - convertVal[k] = "" - } - } else { - if fielfInfoClass.ValIsAry { - if valStr, ok := v.(string); ok { - valStrAry := strings.Split(valStr, ",") - if len(valStrAry) > 0 { - valStrJson, _ := json.Marshal(valStrAry) - convertVal[k] = string(valStrJson) - } else { - convertVal[k] = "" - } + // jkjs, _ := json.Marshal(fielfInfoClass) + // fmt.Printf("%v:%v------>%T\n", k, string(jkjs), v) + if fielfInfoClass.ValIsAry && fielfInfoClass.UnitName != "upload" { + if valStr, ok := v.(string); ok { + if fielfInfoClass.UnitName != "expand-user" { + var zhiAry []interface{} + json.Unmarshal([]byte(valStr), &zhiAry) + convertVal[k] = zhiAry } else { - convertVal[k] = v + var zhiAry []string + json.Unmarshal([]byte(valStr), &zhiAry) + convertVal[k] = strings.Join(zhiAry, ",") } + } else { convertVal[k] = v } + + } else { + convertVal[k] = v } + // if valAry, ok := v.([]interface{}); ok { + // if len(valAry) > 0 { + // valStrJson, _ := json.Marshal(valAry) + // convertVal[k] = string(valStrJson) + // } else { + // convertVal[k] = "" + // } + // } else { + // if fielfInfoClass.ValIsAry { + // if valStr, ok := v.(string); ok { + // valStrAry := strings.Split(valStr, ",") + // if len(valStrAry) > 0 { + // valStrJson, _ := json.Marshal(valStrAry) + // convertVal[k] = string(valStrJson) + // } else { + // convertVal[k] = "" + // } + // } else { + // convertVal[k] = v + // } + // } else { + // convertVal[k] = v + // } + // } case "varchar": if valAry, ok := v.([]interface{}); ok { if len(valAry) > 0 { diff --git a/api/version1/taskplatform/taskmanagement/formcontrol.go b/api/version1/taskplatform/taskmanagement/formcontrol.go index a15ee0b..869a35c 100644 --- a/api/version1/taskplatform/taskmanagement/formcontrol.go +++ b/api/version1/taskplatform/taskmanagement/formcontrol.go @@ -499,6 +499,7 @@ func (a *ApiMethod) AddFormAddNewData(c *gin.Context) { publicmethod.Result(100, err, c) return } + if _, ok := mapData["formId"]; !ok { publicmethod.Result(1, err, c, "非法表单!不能提交数据!") return @@ -548,6 +549,7 @@ func (a *ApiMethod) AddFormAddNewData(c *gin.Context) { for _, v := range formUnitCont.MasterInfo { masterUnitList[v.Name] = v } + masrWriteMap := MakeFormMapData(uuid, userCont.Key, cureeTime, masterField, masterUnitList, 1) //任务列表 @@ -572,13 +574,16 @@ func (a *ApiMethod) AddFormAddNewData(c *gin.Context) { err = WriteSunDatabase(uuid, userCont.Key, cureeTime, formCont.TableKey, masrWriteMap, sunFieldAry, sunTypeAry) } else { // //无子表 - err = overall.CONSTANT_DB_CustomerForm.Table(formCont.TableKey).Create(masterUnitList).Error + err = overall.CONSTANT_DB_CustomerForm.Table(formCont.TableKey).Create(masrWriteMap).Error } if err != nil { publicmethod.Result(104, err, c) return } err = overall.CONSTANT_DB_AppPlatform.Create(&taskCont).Error + // for k, v := range masrWriteMap { + // fmt.Printf("%v----> %T\n", k, v) + // } sendData := publicmethod.MapOut[string]() sendData["uuid"] = uuid @@ -586,11 +591,12 @@ func (a *ApiMethod) AddFormAddNewData(c *gin.Context) { sendData["formUnitCont"] = formUnitCont sendData["masterField"] = masterField sendData["sunFieldAry"] = sunFieldAry + sendData["sunFieldAry_len"] = len(sunFieldAry) sendData["masrWriteMap"] = masrWriteMap sendData["sunFormName"] = sunFormName sendData["mapData"] = mapData - publicmethod.Result(0, err, c) + publicmethod.Result(0, sendData, c) } /* @@ -684,7 +690,7 @@ func MakeFormMapData(uuid, userKey, cureeTime int64, fieldVal map[string]interfa keyAndVal[k] = "" } } else { - if fielfInfoClass.ValIsAry { + if fielfInfoClass.ValIsAry && fielfInfoClass.UnitName != "upload" { if valStr, ok := v.(string); ok { valStrAry := strings.Split(valStr, ",") if len(valStrAry) > 0 { @@ -693,6 +699,13 @@ func MakeFormMapData(uuid, userKey, cureeTime int64, fieldVal map[string]interfa } else { keyAndVal[k] = "" } + } else if valAry, ok := v.([]interface{}); ok { + if len(valAry) > 0 { + valStrJson, _ := json.Marshal(valAry) + keyAndVal[k] = string(valStrJson) + } else { + keyAndVal[k] = "" + } } else { keyAndVal[k] = v } diff --git a/apirouter/apishiyan/maptostruct.go b/apirouter/apishiyan/maptostruct.go index 7785c60..4fb6767 100644 --- a/apirouter/apishiyan/maptostruct.go +++ b/apirouter/apishiyan/maptostruct.go @@ -29,5 +29,7 @@ func (a *ApiRouter) RouterGroup(router *gin.RouterGroup) { apiRouter.POST("hzzpy", methodBinding.HanZiZhuanPinYin) //汉字转拼音 apiRouter.POST("test_table", methodBinding.TestTable) //测试表格字段类型 + + apiRouter.GET("jia_mi", methodBinding.JiaMiShiYan) //加密实验 } } diff --git a/apirouter/v1/taskrouter/taskrouter.go b/apirouter/v1/taskrouter/taskrouter.go index 125cc20..ee017e1 100644 --- a/apirouter/v1/taskrouter/taskrouter.go +++ b/apirouter/v1/taskrouter/taskrouter.go @@ -31,5 +31,13 @@ func (a *ApiRouter) RouterGroupPc(router *gin.RouterGroup) { taskFlowApi.GET("", taskFlowRouter.Index) //入口 taskFlowApi.POST("", taskFlowRouter.Index) //入口 + taskFlowApi.POST("init_workflow", taskFlowRouter.InitializeWorkFlow) //初始化工作流 + taskFlowApi.POST("gain_flow_version_list", taskFlowRouter.GainFlowVersionList) //获取工作流版本列表 + taskFlowApi.POST("gain_node_factor", taskFlowRouter.GainNodeFactor) //获取审批节点或条件节点 + taskFlowApi.POST("save_flow_cont", taskFlowRouter.SaveFlowCont) //写入工作流 + taskFlowApi.POST("gain_flow_info", taskFlowRouter.GainFlowInfo) //获取工作流详细信息 + taskFlowApi.POST("edit_flow_cont", taskFlowRouter.EditFlowCont) //编辑工作流 + taskFlowApi.POST("save_new_flow", taskFlowRouter.SaveNewFlow) //另存为新版 + taskFlowApi.POST("switch_flow_version", taskFlowRouter.SwitchFlowVersion) //启用&禁用 } } diff --git a/models/modelAppPlatform/customer_form.go b/models/modelAppPlatform/customer_form.go index 16f7348..d3292bb 100644 --- a/models/modelAppPlatform/customer_form.go +++ b/models/modelAppPlatform/customer_form.go @@ -16,12 +16,9 @@ type CustomerForm struct { States int `json:"states" gorm:"column:states;type:int(1) unsigned;default:1;not null;comment:显示状态(1:启用;2:禁用,3:删除)"` CreaterTime int64 `json:"createrTime" gorm:"column:creater_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` EditTime int64 `json:"editTime" gorm:"column:edit_time;type:bigint(20) unsigned;default:0;not null;comment:编辑时间"` - - // MastesForm string `json:"mastesform" gorm:"column:mastesform;type:longtext;default:'';comment:表单结构"` - // MastesFormJson string `json:"mastesformjson" gorm:"column:mastesformjson;type:longtext;default:'';comment:表单结构json"` - // Creater int64 `json:"creater" gorm:"column:creater;type:bigint(20) unsigned;default:0;not null;comment:创建人"` - // TableStructure string `json:"table_structure" gorm:"column:table_structure;type:longtext;default:'';comment:字表结构"` - // Dict string `json:"dict" gorm:"column:dict;type:mediumtext;default:'';comment:字表结构"` + FlowKey int64 `json:"flowkey" gorm:"column:flowkey;type:bigint(20) unsigned;default:0;not null;comment:关联工作流"` + UserPermit string `json:"userpermit" gorm:"column:userpermit;type:mediumtext;default:'';comment:授权范围"` + PostPermit string `json:"postpermit" gorm:"column:postpermit;type:mediumtext;default:'';comment:授权范围"` } func (CustomerForm *CustomerForm) TableName() string { diff --git a/models/modelAppPlatform/flow_version.go b/models/modelAppPlatform/flow_version.go new file mode 100644 index 0000000..fd61a82 --- /dev/null +++ b/models/modelAppPlatform/flow_version.go @@ -0,0 +1,65 @@ +package modelAppPlatform + +import ( + "appPlatform/overall" + "strings" +) + +// 工作流版本 +type FlowVersion struct { + Id int64 `json:"id" gorm:"column:id;type:bigint(20) unsigned;not null;comment:Id"` + Content string `json:"content" gorm:"column:content;type:longtext ;comment:关联部门"` + Version string `json:"version" gorm:"column:version;type:varchar(255) ;default:'';comment:维度"` + Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:写入时间"` + State int `json:"state" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` + Key int64 `json:"key" gorm:"column:key;type:bigint(20) unsigned;default:0;not null;comment:标识符"` + Name string `json:"name" gorm:"column:name;type:varchar(255) ;default:'';comment:维度"` + Describe string `json:"describe" gorm:"column:describe;type:longtext ;comment:描述"` + OpenWechat int `json:"openwechat" gorm:"column:open_wechat;type:int(1) unsigned;default:1;not null;comment:是否开启企业微信通知及审批(1:无;2:开启通知;3:开启审批及通知)"` + FormKey int64 `json:"formkey" gorm:"column:formkey;type:bigint(20) unsigned;default:0;not null;comment:表单标识符"` +} + +func (FlowVersion *FlowVersion) TableName() string { + return "flow_version" +} + +// 编辑内容 +func (cont *FlowVersion) EiteCont(whereMap interface{}, saveData interface{}) (err error) { + err = overall.CONSTANT_DB_AppPlatform.Model(&cont).Where(whereMap).Updates(saveData).Error + return +} + +// 获取内容 +func (cont *FlowVersion) GetCont(whereMap interface{}, field ...string) (err error) { + gormDb := overall.CONSTANT_DB_AppPlatform.Model(&cont) + if len(field) > 0 { + fieldStr := strings.Join(field, ",") + gormDb = gormDb.Select(fieldStr) + } + gormDb = gormDb.Where(whereMap) + err = gormDb.First(&cont).Error + return +} + +// 根据条件获取总数 +func (cont *FlowVersion) CountCont(whereMap interface{}) (countId int64) { + overall.CONSTANT_DB_AppPlatform.Model(&cont).Where(whereMap).Count(&countId) + return +} + +// 读取全部信息 +func (cont *FlowVersion) ContMap(whereMap interface{}, field ...string) (countAry []FlowVersion, err error) { + gormDb := overall.CONSTANT_DB_AppPlatform.Model(&cont) + if len(field) > 0 { + fieldStr := strings.Join(field, ",") + gormDb = gormDb.Select(fieldStr) + } + err = gormDb.Where(whereMap).Find(&countAry).Error + return +} + +// 删除内容 +func (cont *FlowVersion) DelCont(whereMap interface{}) (err error) { + err = overall.CONSTANT_DB_AppPlatform.Where(whereMap).Delete(&cont).Error + return +} diff --git a/models/modelAppPlatform/work_flow.go b/models/modelAppPlatform/work_flow.go new file mode 100644 index 0000000..9130200 --- /dev/null +++ b/models/modelAppPlatform/work_flow.go @@ -0,0 +1,68 @@ +package modelAppPlatform + +import ( + "appPlatform/overall" + "strings" +) + +// 工作流 +type WorkFlow struct { + Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id"` + Name string `json:"name" gorm:"column:name;type:varchar(255) ;default:'';comment:维度"` + Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:写入时间"` + Describe string `json:"describe" gorm:"column:describe;type:longtext ;comment:描述"` + State int `json:"state" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` + OpenWechat int `json:"openwechat" gorm:"column:open_wechat;type:int(1) unsigned;default:1;not null;comment:是否开启企业微信通知及审批(1:无;2:开启通知;3:开启审批及通知)"` + FormKey int64 `json:"formkey" gorm:"column:formkey;type:bigint(20) unsigned;default:0;not null;comment:自定义表单ID"` +} + +func (WorkFlow *WorkFlow) TableName() string { + return "work_flow" +} + +// 写入内容 +func (cont *WorkFlow) InSetCont(whereMap interface{}, saveData interface{}) (err error) { + err = overall.CONSTANT_DB_AppPlatform.Create(cont).Error + return +} + +// 编辑内容 +func (cont *WorkFlow) EiteCont(whereMap interface{}, saveData interface{}) (err error) { + err = overall.CONSTANT_DB_AppPlatform.Model(&cont).Where(whereMap).Updates(saveData).Error + return +} + +// 获取内容 +func (cont *WorkFlow) GetCont(whereMap interface{}, field ...string) (err error) { + gormDb := overall.CONSTANT_DB_AppPlatform.Model(&cont) + if len(field) > 0 { + fieldStr := strings.Join(field, ",") + gormDb = gormDb.Select(fieldStr) + } + gormDb = gormDb.Where(whereMap) + err = gormDb.First(&cont).Error + return +} + +// 根据条件获取总数 +func (cont *WorkFlow) CountCont(whereMap interface{}) (countId int64) { + overall.CONSTANT_DB_AppPlatform.Model(&cont).Where(whereMap).Count(&countId) + return +} + +// 读取全部信息 +func (cont *WorkFlow) ContMap(whereMap interface{}, field ...string) (countAry []WorkFlow, err error) { + gormDb := overall.CONSTANT_DB_AppPlatform.Model(&cont) + if len(field) > 0 { + fieldStr := strings.Join(field, ",") + gormDb = gormDb.Select(fieldStr) + } + err = gormDb.Where(whereMap).Find(&countAry).Error + return +} + +// 删除内容 +func (cont *WorkFlow) DelCont(whereMap interface{}) (err error) { + err = overall.CONSTANT_DB_AppPlatform.Where(whereMap).Delete(&cont).Error + return +} diff --git a/models/modelAppPlatform/work_flow_version.go b/models/modelAppPlatform/work_flow_version.go new file mode 100644 index 0000000..097d28f --- /dev/null +++ b/models/modelAppPlatform/work_flow_version.go @@ -0,0 +1,71 @@ +package modelAppPlatform + +import ( + "appPlatform/overall" + "strings" +) + +// 工作流版本 +type WorkFlowVersion struct { + Id int64 `json:"id" gorm:"column:id;type:bigint(20) unsigned;not null;comment:Id"` + Content string `json:"content" gorm:"column:content;type:longtext ;comment:关联部门"` + Version string `json:"version" gorm:"column:version;type:varchar(255) ;default:'';comment:维度"` + Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:写入时间"` + State int `json:"state" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` + Key int64 `json:"key" gorm:"column:key;type:bigint(20) unsigned;default:0;not null;comment:标识符"` + UserPermit string `json:"userpermit" gorm:"column:userpermit;type:mediumtext;default:'';comment:授权范围"` + OrgPermit string `json:"orgpermit" gorm:"column:orgpermit;type:mediumtext;default:'';comment:授权范围"` + RolePermit string `json:"rolepermit" gorm:"column:rolepermit;type:mediumtext;default:'';comment:授权范围"` + PostPermit string `json:"postpermit" gorm:"column:postpermit;type:mediumtext;default:'';comment:授权范围"` +} + +func (WorkFlowVersion *WorkFlowVersion) TableName() string { + return "work_flow_version" +} + +// 写入内容 +func (cont *WorkFlowVersion) InSetCont() (err error) { + err = overall.CONSTANT_DB_AppPlatform.Create(cont).Error + return +} + +// 编辑内容 +func (cont *WorkFlowVersion) EiteCont(whereMap interface{}, saveData interface{}) (err error) { + err = overall.CONSTANT_DB_AppPlatform.Model(&cont).Where(whereMap).Updates(saveData).Error + return +} + +// 获取内容 +func (cont *WorkFlowVersion) GetCont(whereMap interface{}, field ...string) (err error) { + gormDb := overall.CONSTANT_DB_AppPlatform.Model(&cont) + if len(field) > 0 { + fieldStr := strings.Join(field, ",") + gormDb = gormDb.Select(fieldStr) + } + gormDb = gormDb.Where(whereMap) + err = gormDb.First(&cont).Error + return +} + +// 根据条件获取总数 +func (cont *WorkFlowVersion) CountCont(whereMap interface{}) (countId int64) { + overall.CONSTANT_DB_AppPlatform.Model(&cont).Where(whereMap).Count(&countId) + return +} + +// 读取全部信息 +func (cont *WorkFlowVersion) ContMap(whereMap interface{}, field ...string) (countAry []WorkFlowVersion, err error) { + gormDb := overall.CONSTANT_DB_AppPlatform.Model(&cont) + if len(field) > 0 { + fieldStr := strings.Join(field, ",") + gormDb = gormDb.Select(fieldStr) + } + err = gormDb.Where(whereMap).Find(&countAry).Error + return +} + +// 删除内容 +func (cont *WorkFlowVersion) DelCont(whereMap interface{}) (err error) { + err = overall.CONSTANT_DB_AppPlatform.Where(whereMap).Delete(&cont).Error + return +}