diff --git a/api/shiyan/数据结构收集/redis集群设置.txt b/api/shiyan/数据结构收集/redis集群设置.txt new file mode 100644 index 0000000..0405822 --- /dev/null +++ b/api/shiyan/数据结构收集/redis集群设置.txt @@ -0,0 +1,13 @@ +redis-cli -a 20030322 --cluster create --cluster-replicas 1 192.168.146.128:6379 192.168.146.129:6399 192.168.146.129:6379 192.168.146.130:6399 192.168.146.130:6379 192.168.146.128:6399 + + + +172.20.5.30 +172.20.5.31 +172.20.5.32 + +172.20.5.33 +172.20.5.34 +172.20.5.55 + +redis-cli -a Redis+brngJ3U19@8_Z2^7a --cluster create --cluster-replicas 1 172.20.5.34:6379 172.20.5.31:6379 172.20.5.33:6379 172.20.5.30:6379 172.20.5.32:6379 172.20.5.55:6379 \ No newline at end of file diff --git a/api/version1/publicapi/api.go b/api/version1/publicapi/api.go index ede725a..d674cf6 100644 --- a/api/version1/publicapi/api.go +++ b/api/version1/publicapi/api.go @@ -7,6 +7,7 @@ import ( "fmt" "strconv" "strings" + "time" "unicode" "github.com/gin-gonic/gin" @@ -200,3 +201,56 @@ func (a *ApiMethod) ChineseToPinyin(c *gin.Context) { str := pinyin.Slug(requestData.Title, pyObject) publicmethod.Result(0, str, c) } + +/* +* +@ 作者: 秦东 +@ 时间: 2023-11-02 10:35:14 +@ 功能: 生成一键登录地址 +@ 参数 + + # + +@ 返回值 + + # + +@ 方法原型 + + # +*/ +func (a *ApiMethod) CreateOneClickLogin(c *gin.Context) { + userKey := c.Request.Header.Get("user-key") + userToken := c.Request.Header.Get("user-token") + if userKey == "" || userToken == "" { + publicmethod.Result(1, userKey, c, "验证失败!未知识别符!") + return + } + sendMap := publicmethod.MapOut[string]() + var requestData SendUrl + err := c.ShouldBindJSON(&requestData) + if err != nil || requestData.UrlStr == "" { + publicmethod.Result(100, err, c) + return + } + timeVal := time.Now().UnixNano() / 1e6 + urlStr := fmt.Sprintf("/insensibleLogin?userkey=%v&usertoken=%v&time=%v", userKey, userToken, timeVal) + if !strings.HasPrefix(requestData.UrlStr, "https://") && !strings.HasPrefix(requestData.UrlStr, "http://") { + urlStr = fmt.Sprintf("http://%v%v", requestData.UrlStr, urlStr) + } else { + urlStr = fmt.Sprintf("%v%v", requestData.UrlStr, urlStr) + } + singStr := fmt.Sprintf("%v%v%v", userKey, userToken, timeVal) + var singCodeMd5 publicmethod.Md5Encryption + singCodeMd5.Md5EncryptionInit(singStr) + signCodeRedisKey := singCodeMd5.Md5EncryptionAlgorithm() + urlStr = fmt.Sprintf("%v&sing=%v", urlStr, signCodeRedisKey) + + sendMap["http"] = strings.HasPrefix(requestData.UrlStr, "http://") + sendMap["https"] = strings.HasPrefix(requestData.UrlStr, "https://") + sendMap["userKey"] = userKey + sendMap["userToken"] = userToken + sendMap["urlStr"] = urlStr + + publicmethod.Result(0, urlStr, c) +} diff --git a/api/version1/publicapi/type.go b/api/version1/publicapi/type.go index 62f6716..4bf016d 100644 --- a/api/version1/publicapi/type.go +++ b/api/version1/publicapi/type.go @@ -27,3 +27,8 @@ type HanziToPinyin struct { Types int `json:"types"` //转换风格 0:普通风格,不带声调(默认风格)。如: zhong guo;1:声调风格1,拼音声调在韵母第一个字母上。如: zhōng guó;2:声调风格2,即拼音声调在各个韵母之后,用数字 [1-4] 进行表示。如: zho1ng guo2;3:声母风格,只返回各个拼音的声母部分。如: zh g 。注意:不是所有的拼音都有声母;4:首字母风格,只返回拼音的首字母部分。如: z g;5: 韵母风格,只返回各个拼音的韵母部分,不带声调。如: ong uo;6:韵母风格1,带声调,声调在韵母第一个字母上。如: ōng uó;7:韵母风格2,带声调,声调在各个韵母之后,用数字 [1-4] 进行表示。如: o1ng uo2;8:声调风格3,即拼音声调在各个拼音之后,用数字 [1-4] 进行表示。如: zhong1 guo2;9:韵母风格3,带声调,声调在各个拼音之后,用数字 [1-4] 进行表示。如: ong1 uo2; Connector string `json:"connector"` // Join 所用的分隔符 } + +// 访问地址 +type SendUrl struct { + UrlStr string `json:"url"` +} diff --git a/api/version1/taskplatform/taskflow/flowType.go b/api/version1/taskplatform/taskflow/flowType.go index 384dc99..03c1b84 100644 --- a/api/version1/taskplatform/taskflow/flowType.go +++ b/api/version1/taskplatform/taskflow/flowType.go @@ -47,7 +47,7 @@ type NodePublicInfoES struct { //节点通用内容 type NodePublicInfo struct { NodePublicInfoES - Settype int `json:"settype"` // 审批人设置 1:指定成员; 2:主管;3:行政岗位; 4:发起人自选; 5:发起人自己;6:连续多级主管;7:指定前置审批为本节点设置审批人;8:表单字段 + Settype int `json:"settype"` // 审批人设置 1:指定成员; 2:主管;3:行政岗位; 4:发起人自选; 5:发起人自己;6:连续多级主管;7:指定前置审批为本节点设置审批人;8:表单字段;9:权限矩阵 SelectMode int `json:"selectMode"` //审批人数 1选一个人 2选多个人 SelectRange int `json:"selectRange"` //选择范围 1.全公司 2指定成员 2指定角色 DirectorLevel int `json:"directorLevel"` //审批终点 最高层主管数 @@ -112,3 +112,57 @@ type CustomFieldsInfo struct { RightOptType string `json:"rightoptType"` //OptType值为6时;右侧判定方法 RightVal string `json:"rightval"` //OptType值为6时;右侧值 } + +/** +@ 作者: 秦东 +@ 时间: 2023-11-01 09:12:18 +@ 功能: 流程执行体 +*/ +type RunFlow struct { + Step int `json:"step"` //步骤 + Types int `json:"type"` //0:发起节点;1:审批节点;2:抄送;3:执行节点 + NodeKey string `json:"nodeKey"` //节点识别符 + NodeName string `json:"nodeName"` //节点名称 + Status int `json:"status"` //1:未到达;2:已审批;3:已驳回;4:再次审批 + FromNode string `json:"fromnode"` //来至哪个节点 + ArriveNode string `json:"arrivenode"` //到哪个节点 + GoBackNode string `json:"gobacknode"` //驳回返回节点 + ExamineMode int `json:"examinemode"` //多人审批时采用的审批方式。0:无操作 1依次审批 2会签 3:非会签 + NoHanderAction int `json:"nohanderaction"` //审批人为空时 1自动审批通过/不允许发起 2转交给审核管理员 + CustomNode string `json:"customNode"` //由哪个节点指定本节点审批人 + JudgeList bool `json:"judgelist"` //是否可自己选中操作人 + Operator []OperatorList `json:"operator"` //操作人 +} + +//操作人 +type OperatorList struct { + Id string `json:"id"` //操作人ID + Types int `json:"type"` //1:人员;2:角色;3:行政组织 + Name string `json:"name"` //操作人姓名 + Number string `json:"number"` //操作人工号 + Icon string `json:"icon"` //操作人头像 + IconBase64 string `json:"iconbase64"` //操作人头像 + Wechat string `json:"wechat"` //微信Openid + DepartmentId int64 `json:"departmentid"` //分厂Id + DepartmentName string `json:"departmentname"` //分厂名称 + PostId int64 `json:"postid"` //职务Id + PostName string `json:"postname"` //职务名称 + Tema int64 `json:"tema"` //班组Id + TemaName string `json:"temaname"` //班组名称 + LogList []LogList `json:"log"` //操作记录 +} + +// 节点操作人操作记录 +type LogList struct { + State int `json:"state"` //状态 1、未操作;2、通过;3、驳回 + TimeVal string `json:"time"` + Cause string `json:"cause"` //审批意见 + Enclosure []EnclosureFormat `json:"enclosure"` //附件 +} + +// 附件格式 +type EnclosureFormat struct { + FileName string `json:"filename"` //附件名称 + FilePath string `json:"filepath"` //附件地址 + Type int `json:"type"` //附件类型 +} diff --git a/api/version1/taskplatform/taskflow/runflow.go b/api/version1/taskplatform/taskflow/runflow.go new file mode 100644 index 0000000..bca6d63 --- /dev/null +++ b/api/version1/taskplatform/taskflow/runflow.go @@ -0,0 +1,186 @@ +package taskflow + +import ( + "appPlatform/models/modelshr" + "appPlatform/overall" + "appPlatform/overall/publicmethod" + "strconv" +) + +/* +* +@ 作者: 秦东 +@ 时间: 2023-11-01 10:28:48 +@ 功能: 生成步进工作流 +@ 参数 + + # + +@ 返回值 + + # + +@ 方法原型 + + # +*/ +func (f *NodePublicInfo) GenerateFlow(creater publicmethod.AuthenticationPower) { + //寻找发起节点 + +} + +/* +* +@ 作者: 秦东 +@ 时间: 2023-11-01 10:52:35 +@ 功能: 无限极循环节点 +@ 参数 + + #step 步进值 + +@ 返回值 + + # + +@ 方法原型 + + # +*/ +func (n *NodePublicInfo) CircularParsing(step int) (nodeList []RunFlow) { + var nodeInfo RunFlow + nodeInfo.Step = step + nodeInfo.Types = n.Types + nodeInfo.NodeKey = n.NodeNumber + nodeInfo.NodeName = n.NodeName + nodeInfo.Status = 1 + nodeInfo.FromNode = n.FromNode + if n.SendBackNode == "" { + nodeInfo.GoBackNode = "beginnode" + } else { + nodeInfo.GoBackNode = n.SendBackNode + } + nodeInfo.ExamineMode = n.ExamineMode + nodeInfo.NoHanderAction = n.NoHanderAction + //判断节点类型 + //0:发起人;1:审批;2:抄送;3:执行人;4:条件;5:路由 + switch n.Types { + case 1, 3: + // 审批人设置 1:指定成员; 2:主管;3:行政岗位; 4:发起人自选; 5:发起人自己;6:连续多级主管;7:指定前置审批为本节点设置审批人;8:表单字段;9:权限矩阵 + switch n.Settype { + case 1: //指定成员 + nodeInfo.Operator = OperatorHandle(n.NodeUserList) + case 2: //主管 + case 3: //行政岗位 + case 4: //发起人自选 + case 5: //发起人自己 + case 6: //连续多级主管 + case 7: //指定前置审批为本节点设置审批人 + case 8: //表单字段 + case 9: //权限矩阵 + default: + } + + nodeList = append(nodeList, nodeInfo) + if n.ChildNode != nil { + nodeList = append(nodeList, n.ChildNode.CircularParsing(step+1)...) + } + case 2: + nodeInfo.Operator = OperatorHandle(n.NodeUserList) + nodeList = append(nodeList, nodeInfo) + if n.ChildNode != nil { + nodeList = append(nodeList, n.ChildNode.CircularParsing(step+1)...) + } + case 4: + case 5: + default: + } + return +} + +/* +* +@ 作者: 秦东 +@ 时间: 2023-11-01 16:16:33 +@ 功能: 处理操作人 +@ 参数 + + #userList 节点处理人 + +@ 返回值 + + #userAry 人员列表信息 + +@ 方法原型 + + # +*/ +func OperatorHandle(userList []NodeUserListInfo) (userAry []OperatorList) { + if len(userList) > 0 { + var userIdAry []int64 + for _, v := range userList { + switch v.Types { //1:人员;2:角色;3:行政组织 + case 1: + myKey, myErr := strconv.ParseInt(v.TargetId, 10, 64) + if myErr == nil { + userIdAry = append(userIdAry, myKey) + } + case 2: //角色 + var usIdList []int64 + overall.CONSTANT_DB_HR.Model(&modelshr.PersonArchives{}).Select("`key`").Where("FIND_IN_SET(?,`role`)", v.TargetId).Find(&usIdList) + if len(usIdList) > 0 { + userIdAry = append(userIdAry, usIdList...) + } + case 3: //行政组织 + myKey, myErr := strconv.ParseInt(v.TargetId, 10, 64) + if myErr == nil { + var sunOrg publicmethod.GetOrgAllParent + sunOrg.GetOrgSonAllId(myKey) + sunOrg.Id = append(sunOrg.Id, myKey) + var usIdList []int64 + overall.CONSTANT_DB_HR.Model(&modelshr.PersonArchives{}).Select("`key`").Where("`admin_org` IN ?", sunOrg.Id).Find(&usIdList) + if len(usIdList) > 0 { + userIdAry = append(userIdAry, usIdList...) + } + } + + default: + } + } + var userContMap []modelshr.PersonArchives + overall.CONSTANT_DB_HR.Model(&modelshr.PersonArchives{}).Where("`key` IN ?", userIdAry).Find(&userContMap) + for _, v := range userContMap { + var userCont OperatorList + userCont.Types = 1 //1:人员;2:角色;3:行政组织 + userCont.Name = v.Name //操作人姓名 + userCont.Number = v.Number //操作人工号 + userCont.Icon = v.Icon //操作人头像 + userCont.IconBase64 = v.IconPhoto //操作人头像 + userCont.Wechat = v.Wechat //微信Openid + if v.WorkWechat != "" { + userCont.Wechat = v.WorkWechat //微信Openid + } + _, companyId, _, _, _ := publicmethod.GetOrgStructurees(v.AdminOrg) + userCont.DepartmentId = companyId //分厂Id + if companyId != 0 { + var orgCont modelshr.AdministrativeOrganization + orgCont.GetCont(map[string]interface{}{"`id`": companyId}, "`name`") + userCont.DepartmentName = orgCont.Name //分厂名称 + } + //获取岗位 + if v.Position != 0 { + var postCont modelshr.Position + postCont.GetCont(map[string]interface{}{"`id`": v.Position}, "`name`") + userCont.PostId = v.Position //职务Id + userCont.PostName = postCont.Name //职务名称 + } + if v.TeamId != 0 { + var teamCont modelshr.TeamGroup + teamCont.GetCont(map[string]interface{}{"`id`": v.TeamId}, "`name`") + userCont.Tema = v.TeamId //班组Id + userCont.TemaName = teamCont.Name //班组名称 + } + userAry = append(userAry, userCont) + } + } + return +} diff --git a/apirouter/v1/public/router.go b/apirouter/v1/public/router.go index ff41fee..12701c9 100644 --- a/apirouter/v1/public/router.go +++ b/apirouter/v1/public/router.go @@ -18,5 +18,7 @@ func (a *ApiRouter) RouterGroupPc(router *gin.RouterGroup) { apiRouter.POST("send_number", methodBinding.SendNumber) //输出编号 apiRouter.POST("generate_sign_code", methodBinding.GenerateSignCode) //生成身份验证唯一识别符 apiRouter.POST("chinese_to_pinyin", methodBinding.ChineseToPinyin) //中文转拼音 + + apiRouter.POST("create_one_click_login", methodBinding.CreateOneClickLogin) //生成一键登录地址 } } diff --git a/models/flowlog/work_flow_log.go b/models/flowlog/work_flow_log.go index 4bc8150..176d78d 100644 --- a/models/flowlog/work_flow_log.go +++ b/models/flowlog/work_flow_log.go @@ -8,7 +8,7 @@ import ( // 工作流日志 type WorkFlowLog struct { Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` - FlowId int64 `json:"flow_id" gorm:"column:flow_id;type:bigint(20) unsigned;default:0;not null;comment:执行的流程"` + FlowId int64 `json:"flowId" gorm:"column:flow_id;type:bigint(20) unsigned;default:0;not null;comment:执行的流程"` Creater int64 `json:"creater" gorm:"column:creater;type:bigint(20) unsigned;default:0;not null;comment:操作人"` Status int `json:"status" gorm:"column:status;type:int(1) unsigned;default:1;not null;comment:状态:1、草稿;2:驳回;3:通过;4:归档;5:删除"` Content string `json:"content" gorm:"column:content;type:mediumtext;default:'';comment:审批意见"` diff --git a/models/modelAppPlatform/run_flow.go b/models/modelAppPlatform/run_flow.go index d34d8f0..51c4e72 100644 --- a/models/modelAppPlatform/run_flow.go +++ b/models/modelAppPlatform/run_flow.go @@ -8,16 +8,18 @@ import ( // 工作流执行主体 // 字典类型 type RunFlow struct { - Id int `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` - FlowKey int64 `json:"flow_key" gorm:"column:flow_key;type:bigint(20) unsigned;default:0;not null;comment:工作流主体"` - Version string `json:"version" gorm:"column:version;type:varchar(255);default:'';comment:使用得版本"` - - Creater int64 `json:"creater" gorm:"column:creater;type:bigint(20) unsigned;default:0;not null;comment:操作人"` - Status int `json:"status" gorm:"column:status;type:int(1) unsigned;default:1;not null;comment:状态:1、草稿;2:驳回;3:通过;4:归档;5:删除"` - Content string `json:"content" gorm:"column:content;type:mediumtext;default:'';comment:审批意见"` - Annex string `json:"annex" gorm:"column:annex;type:mediumtext;default:'';comment:附件"` - Time int64 `json:"time" gorm:"column: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:编辑时间"` + Id int `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` + FlowKey int64 `json:"flowKey" gorm:"column:flow_key;type:bigint(20) unsigned;default:0;not null;comment:工作流主体"` + Version string `json:"version" gorm:"column:version;type:varchar(255);default:'';comment:使用得版本"` + Status int `json:"status" gorm:"column:status;type:int(1) unsigned;default:1;not null;comment:状态:1、草稿;2:驳回;3:通过;4:归档;5:删除"` + FlowCont string `json:"flowcont" gorm:"column:flow_cont;type:longtext;comment:审批意见"` + Creater int64 `json:"creater" gorm:"column:creater;type:bigint(20) unsigned;default:0;not null;comment:流程发起人"` + CurrentStep int `json:"currentStep" gorm:"column:current_step;type:int(1) unsigned;default:1;not null;comment:当前节点"` + NextStep int `json:"nextStep" gorm:"column:next_step;type:int(1) unsigned;default:1;not null;comment:下一个节点。0:代表没有下一个节点。流程结束"` + NextExecutor string `json:"nextExecutor" gorm:"column:next_executor;type:mediumtext;default:'';comment:下一步执行人"` + Participants string `json:"participants" gorm:"column:participants;type:longtext;comment:参与人"` + StartTime int64 `json:"startTime" gorm:"column:start_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` + UpdateTime int64 `json:"update_time" gorm:"column:update_time;type:bigint(20) unsigned;default:0;not null;comment:编辑时间"` } func (RunFlow *RunFlow) TableName() string {