Browse Source

完结自定义表单

li_v1
超级管理员 2 years ago
parent
commit
d11f2f3029
  1. 25
      api/shiyan/maptostruct/shiyan.go
  2. 69
      api/version1/customerform/analysis_table.go
  3. 45
      api/version1/customerform/formTable.go
  4. 23
      api/version1/customerform/listField.go
  5. 202
      api/version1/dataCenter/hander.go
  6. 49
      api/version1/dataCenter/type.go
  7. 2
      api/version1/entry.go
  8. 388
      api/version1/taskplatform/taskflow/editformflow.go
  9. 19
      api/version1/taskplatform/taskflow/flowType.go
  10. 60
      api/version1/taskplatform/taskmanagement/appform.go
  11. 186
      api/version1/taskplatform/taskmanagement/flowNode.go
  12. 30
      api/version1/taskplatform/taskmanagement/flowType.go
  13. 10
      api/version1/taskplatform/taskmanagement/formcontrol.go
  14. 2169
      api/version1/taskplatform/taskmanagement/ruanTask.go
  15. 1551
      api/version1/taskplatform/taskmanagement/runWorkFlow.go
  16. 30
      api/version1/taskplatform/taskmanagement/types.go
  17. 3
      apirouter/apishiyan/maptostruct.go
  18. 2
      apirouter/entry.go
  19. 21
      apirouter/v1/dataCenterRouter/router.go
  20. 4
      apirouter/v1/dataCenterRouter/type.go
  21. 20
      apirouter/v1/taskrouter/taskrouter.go
  22. 1
      go.mod
  23. 7
      go.sum
  24. 3
      initialization/route/initRoute.go
  25. 76
      models/customerForm/runWorkflow.go
  26. 32
      models/customerForm/taskrecord.go
  27. 31
      models/modelAppPlatform/customer_form_version.go
  28. 54
      models/modelAppPlatform/customer_form_view.go
  29. 67
      models/modelAppPlatform/msgrule.go
  30. 2
      models/reviseform/edit_form_data_log.go
  31. 5
      overall/publicmethod/formatOutput.go
  32. 11
      overall/publicmethod/technique.go

25
api/shiyan/maptostruct/shiyan.go

@ -574,3 +574,28 @@ func (a *ApiMethod) GetAllOrgSun(c *gin.Context) {
sunOrg.GetOrgSun(requestData.Id)
publicmethod.Result(0, sunOrg.Id, c)
}
/*
*
@ 作者: 秦东
@ 时间: 2024-04-18 15:20:02
@ 功能: 获取数据中台的数据
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) GainDateCenter(c *gin.Context) {
url := "http://172.20.5.86/prod-api/database/app/datasource/page?pageNum=1&pageSize=10&databaseName=&dataType="
jisguo := publicmethod.CurlGet(url)
var sendDara map[string]interface{}
json.Unmarshal(jisguo, &sendDara)
publicmethod.Result(0, sendDara, c)
}

69
api/version1/customerform/analysis_table.go

@ -501,3 +501,72 @@ func SubUnitConvertSql(tablename string, subUnit MasterStruct) (sql string, sqlA
}
return
}
/*
*
@ 作者: 秦东
@ 时间: 2024-04-07 14:35:39
@ 功能: 解析自定义表单所有组件属性
*/
func (t *TableFormUnit) AnalysisTableFormUnitAttribute(tablename string, subUnitAry []MasterStruct) {
if len(subUnitAry) > 0 {
var unitContAry []UnitAttribute
for _, v := range subUnitAry {
wordClass := AnalysisFormUnitClass(v)
switch wordClass.UnitName {
case "flex", "table":
if len(v.List) > 0 {
t.AnalysisTableFormUnitAttribute(v.Name, v.List)
}
case "grid", "tabs":
if len(v.Columns) > 0 {
for _, mv := range v.Columns {
t.AnalysisTableFormUnitAttribute(tablename, mv.List)
}
}
case "card", "div":
if len(v.List) > 0 {
t.AnalysisTableFormUnitAttribute(tablename, v.List)
}
default:
var unitCont UnitAttribute
unitCont.Name = v.Item.Label //组件名称
unitCont.Key = v.Name //主键识别符
unitCont.Class = v.Type //组件分类
unitCont.ActiveValue = v.Control.ActiveValue //开关的开值
unitCont.InactiveValue = v.Control.InactiveValue //开关的关值
for _, v := range v.Options {
var optVal OptionsList
optVal.Label = v.Label
optVal.Value = v.Value
unitCont.Options = append(unitCont.Options, optVal) //附件判断值
}
unitContAry = append(unitContAry, unitCont)
// fmt.Printf("tablename:%v------>%v------>%v\n", tablename, v.Name, unitContAry)
}
}
if tablename != "" {
if len(t.SunFormInfo) > 0 {
isNew := true
for i, v := range t.SunFormInfo {
if _, ok := v[tablename]; ok {
isNew = false
t.SunFormInfo[i][tablename] = unitContAry
}
}
if isNew {
sonMapAry := make(map[string][]UnitAttribute)
sonMapAry[tablename] = unitContAry
t.SunFormInfo = append(t.SunFormInfo, sonMapAry)
}
} else {
sonMapAry := make(map[string][]UnitAttribute)
sonMapAry[tablename] = unitContAry
t.SunFormInfo = append(t.SunFormInfo, sonMapAry)
}
} else {
t.MasterInfo = append(t.MasterInfo, unitContAry...)
}
}
}

45
api/version1/customerform/formTable.go

@ -1,6 +1,7 @@
package customerform
import (
"appPlatform/models/customerForm"
"appPlatform/models/modelAppPlatform"
"appPlatform/models/modelshr"
"appPlatform/overall"
@ -1160,11 +1161,14 @@ func (a *ApiMethod) GainFormPageListCont(c *gin.Context) {
// why, err := AnalysisSerachTerm(requestData.SearchData)
// fmt.Printf("why---->%v\n", why)
var formList []map[string]interface{}
gormDb := overall.CONSTANT_DB_CustomerForm.Table(formInfo.TableKey)
// gormDb := overall.CONSTANT_DB_CustomerForm.Table(formInfo.TableKey).Where("`states` BETWEEN ? AND ?", 1, 2)
// gormDb := overall.CONSTANT_DB_CustomerForm.Table(formInfo.TableKey)
tableName := fmt.Sprintf("`%v` as f", formInfo.TableKey)
gormDb := overall.CONSTANT_DB_CustomerForm.Table(tableName).Select("f.*,t.status as taskStatus")
// if err == nil {
// gormDb = gormDb.Where(why)
// }
gormDb = gormDb.Joins("LEFT JOIN `taskrecord` as t ON f.masters_key = t.masters_key")
gormDb = gormDb.Where("`states` BETWEEN ? AND ?", 1, 2)
gormDb = AnalysisSerachTermSql(requestData.SearchData, gormDb)
var total int64
totalErr := gormDb.Count(&total).Error
@ -1185,13 +1189,44 @@ func (a *ApiMethod) GainFormPageListCont(c *gin.Context) {
if formInfo.ListJson != "" {
var listFieldsMap ListPageFields
err = json.Unmarshal([]byte(formInfo.ListJson), &listFieldsMap)
fmt.Printf("%T----------->%v----------->%v\n", listFieldsMap, err, listFieldsMap)
// fmt.Printf("%T----------->%v----------->%v\n", listFieldsMap, err, listFieldsMap)
if err == nil {
// fmt.Printf("%T----------->%v\n", listFieldsMap, listFieldsMap)
formList = listFieldsMap.DevelopSpecificationsSend(formList)
// formList = DevelopSpecificationsSend(formList, listFieldsMap)
}
}
context, _ := c.Get(overall.MyContJwt)
var userCont modelshr.ManCont
userCont.GetLoginCont(context) //当前操作人
//获取任务状态
for i, v := range formList {
formList[i]["isRetract"] = false
if mastrKey, ok := v["masters_key"]; ok {
// fmt.Printf("masters_key----------->%v\n", v["masters_key"])
var runFlowInfo customerForm.RunWorkflow
runFlowInfo.GetCont(map[string]interface{}{"`flow_key`": mastrKey}, "`current_step`", "`next_step`")
// fmt.Printf("runFlowInfo----------->%v--------->%v\n", runFlowInfo, v["taskStatus"])
if stateVal, ok := v["taskStatus"]; ok {
// fmt.Printf("NextStep----------->%T----------->%v--------->%v--------->%v\n", stateVal, stateVal, runFlowInfo.NextStep, runFlowInfo.CurrentStep)
if stauval, ok := stateVal.(string); ok {
if stauval == "3" && runFlowInfo.NextStep != 0 {
// fmt.Printf("IsRetract----------->%T----------->%v----------->%v\n", formList[i]["creater"], formList[i]["creater"], userCont.Name)
if runFlowInfo.CurrentStep == 1 {
if createrName, ok := formList[i]["creater"].(string); ok {
if createrName == userCont.Name {
formList[i]["isRetract"] = true
}
}
}
}
}
}
}
}
// publicmethod.Result(100, formList, c)
@ -1209,7 +1244,7 @@ func (l *ListPageFields) DevelopSpecificationsSend(listData []map[string]interfa
for _, v := range listData {
sendInfo := publicmethod.MapOut[string]()
for mi, mv := range v {
fmt.Printf("%v = %v\n", mi, mv)
// fmt.Printf("%v = %v\n", mi, mv)
switch mi {
case "creater":
var myInfo modelshr.PersonArchives
@ -1226,7 +1261,7 @@ func (l *ListPageFields) DevelopSpecificationsSend(listData []map[string]interfa
// sendInfo[mi] = publicmethod.TypeToInterface(mv)
}
}
fmt.Printf("================================\n")
// fmt.Printf("================================\n")
sendList = append(sendList, sendInfo)
}
return sendList

23
api/version1/customerform/listField.go

@ -48,3 +48,26 @@ type controlBtnInfo struct {
Size string `json:"size"`
Icon string `json:"icon"`
}
// 自定义表单组件基本属性
type UnitAttribute struct {
Name string `json:"name"` //组件名称
Key string `json:"key"` //主键识别符
Class string `json:"class"` //组件分类
ActiveValue string `json:"activeValue"` //开关的开值
InactiveValue string `json:"inactiveValue"` //开关的关值
Options []OptionsList `json:"options"` //附件判断值
}
type OptionsList struct {
Label string `json:"label"` //名称
Value string `json:"value"` //判定值
}
type TableFormUnit struct {
MasterInfo []UnitAttribute `json:"masterInfo"` //主表组件列表
SunFormInfo []map[string][]UnitAttribute `json:"sunFormInfo"` //子表
}
type SunFormInfoStruct struct {
SunFormInfo []map[string][]UnitAttribute `json:"sunFormInfo"` //子表
}

202
api/version1/dataCenter/hander.go

@ -0,0 +1,202 @@
package datacenter
import (
"appPlatform/overall/publicmethod"
"encoding/json"
"fmt"
"net/url"
"strings"
"github.com/gin-gonic/gin"
)
/*
*
@ 作者: 秦东
@ 时间: 2024-04-18 15:37:05
@ 功能: 通用地址
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) GaindataCenter(c *gin.Context) {
var requestData DataInfo
c.ShouldBindJSON(&requestData)
if requestData.Url == "" {
publicmethod.Result(1, requestData, c, "未知访问地址")
return
}
// publicmethod.Result(1, requestData, c, "未知访问地址")
// return
if requestData.Where != "" {
if requestData.Method == "GET" {
var whereAry []string
whyOne := strings.Split(requestData.Where, "&")
if len(whyOne) > 0 {
for _, v := range whyOne {
whyTwo := strings.Split(v, "=")
if len(whyTwo) == 2 {
whereAry = append(whereAry, fmt.Sprintf("%v=%v", whyTwo[0], url.QueryEscape(whyTwo[1])))
} else {
whereAry = append(whereAry, v)
}
}
}
getUrl := requestData.Url
if len(whereAry) > 0 {
getUrl = fmt.Sprintf("%v?%v", requestData.Url, strings.Join(whereAry, "&"))
}
// getUrl = url.QueryEscape(getUrl)
// fmt.Printf("%T--------->%v\n", getUrl, getUrl)
getData := publicmethod.CurlGet(getUrl)
var sendMap map[string]interface{}
json.Unmarshal(getData, &sendMap)
// fmt.Printf("%T--------->%v--------->%v\n", sendMap, sendMap, getUrl)
// publicmethod.Result(0, sendMap, c)
shenData := publicmethod.MapOut[string]()
if code, ok := sendMap["code"]; ok {
if codeIn, ok := code.(float64); ok {
if codeIn == 200 {
shenData["code"] = 0
} else {
shenData["code"] = codeIn
}
}
}
if msg, ok := sendMap["msg"]; ok {
shenData["msg"] = msg
}
if data, ok := sendMap["data"]; ok {
shenData["data"] = data
}
publicmethod.ResultInterface(sendMap, c)
return
} else {
getData := publicmethod.CurlPostJosn(requestData.Url, []byte(requestData.Where))
var sendMap map[string]interface{}
json.Unmarshal(getData, &sendMap)
publicmethod.ResultInterface(sendMap, c)
return
}
} else {
if requestData.Method == "GET" {
getUrl := fmt.Sprintf("%v", requestData.Url)
getData := publicmethod.CurlGet(getUrl)
var sendMap map[string]interface{}
json.Unmarshal(getData, &sendMap)
// publicmethod.Result(0, sendMap, c)
shenData := publicmethod.MapOut[string]()
if code, ok := sendMap["code"]; ok {
if codeIn, ok := code.(float64); ok {
if codeIn == 200 {
shenData["code"] = 0
} else {
shenData["code"] = codeIn
}
}
}
if msg, ok := sendMap["msg"]; ok {
shenData["msg"] = msg
}
if data, ok := sendMap["data"]; ok {
shenData["data"] = data
}
publicmethod.ResultInterface(sendMap, c)
return
} else {
getData := publicmethod.CurlPostJosn(requestData.Url, []byte(""))
var sendMap map[string]interface{}
json.Unmarshal(getData, &sendMap)
shenData := publicmethod.MapOut[string]()
if code, ok := sendMap["code"]; ok {
if codeIn, ok := code.(float64); ok {
if codeIn == 200 {
shenData["code"] = 0
} else {
shenData["code"] = codeIn
}
}
}
if msg, ok := sendMap["msg"]; ok {
shenData["msg"] = msg
}
publicmethod.ResultInterface(sendMap, c)
return
}
}
}
/*
*
@ 作者: 秦东
@ 时间: 2024-04-19 14:05:46
@ 功能: 数据中台POST提交数据
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) PostSaveData(c *gin.Context) {
var requestData DataInfoPost
c.ShouldBindJSON(&requestData)
if requestData.Url == "" {
publicmethod.Result(1, requestData, c, "未知访问地址")
return
}
dataJson, err := json.Marshal(requestData.DataInfo)
shenData := publicmethod.MapOut[string]()
if err != nil {
shenData["code"] = 10001
shenData["msg"] = err
publicmethod.ResultInterface(shenData, c)
return
}
callBackBtye := publicmethod.CurlPostJosn(requestData.Url, dataJson)
var sendMap map[string]interface{}
err = json.Unmarshal(callBackBtye, &sendMap)
if err != nil {
shenData["code"] = 10001
shenData["msg"] = err
publicmethod.ResultInterface(shenData, c)
return
}
if code, ok := sendMap["code"]; ok {
if codeIn, ok := code.(float64); ok {
if codeIn == 200 {
shenData["code"] = 0
} else {
shenData["code"] = codeIn
}
}
}
if msg, ok := sendMap["msg"]; ok {
shenData["msg"] = msg
}
if data, ok := sendMap["data"]; ok {
shenData["data"] = data
}
publicmethod.ResultInterface(shenData, c)
}

49
api/version1/dataCenter/type.go

@ -0,0 +1,49 @@
package datacenter
import (
"appPlatform/overall/publicmethod"
"sync"
"github.com/gin-gonic/gin"
)
// 协程设置
var syncSeting = sync.WaitGroup{}
type ApiMethod struct{}
/*
*
@ 作者: 秦东
@ 时间: 2024-04-18 15:28:20
@ 功能: 数据中台入口
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) Index(c *gin.Context) {
outputCont := publicmethod.MapOut[string]()
outputCont["index"] = "数据中台入口"
publicmethod.Result(0, outputCont, c)
}
// 接收参数
type DataInfo struct {
Url string `json:"url"`
Method string `json:"methodType"`
Where string `json:"where"`
}
// 接收POST请求
type DataInfoPost struct {
Url string `json:"url"`
DataInfo interface{} `json:"dataInfo"`
}

2
api/version1/entry.go

@ -2,6 +2,7 @@ package version1
import (
"appPlatform/api/version1/customerform"
datacenter "appPlatform/api/version1/dataCenter"
"appPlatform/api/version1/datamanagement/redisController"
"appPlatform/api/version1/dict"
"appPlatform/api/version1/grantpowers"
@ -30,6 +31,7 @@ type ApiEntry struct {
RedisManagApi redisController.ApiMethod
MathsApi matsformula.ApiMethod
WechatApi workWechat.ApiMethod //微信相关项目
DataCenterApi datacenter.ApiMethod //数据中台
}
var AppApiEntry = new(ApiEntry)

388
api/version1/taskplatform/taskflow/editformflow.go

@ -10,6 +10,7 @@ import (
"appPlatform/overall/publicmethod"
"encoding/json"
"fmt"
"sort"
"strconv"
"strings"
"time"
@ -591,3 +592,390 @@ func EditSunDatabase(uuid, creater, createrTime int64, masterTableName string, m
}
return
}
/*
*
@ 作者: 秦东
@ 时间: 2024-04-13 09:49:27
@ 功能: 获取流程可见范围
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) GainFlowLookSee(c *gin.Context) {
var requestData publicmethod.PublicId
err := c.ShouldBindJSON(&requestData)
if err != nil {
publicmethod.Result(100, err, c)
return
}
if requestData.Id == "" {
publicmethod.Result(1, err, c, "未知表单参数!请核对1后重新提交!")
return
}
var custView modelAppPlatform.CustomerFormView
err = custView.GetCont(map[string]interface{}{"`id`": requestData.Id})
if err != nil {
publicmethod.Result(1, err, c, "未知表单参数!请核对1后重新提交!")
return
}
var powList []LookPowerCont
if custView.FlowIsOpen == 1 && custView.Flowkey != 0 {
flowLookPower := GainWorkflowLookView(custView.Flowkey)
if len(flowLookPower) > 0 {
powList = append(powList, flowLookPower...)
}
}
if custView.AuthorizedOrg != "" {
orgIdAry := strings.Split(custView.AuthorizedOrg, ",")
if len(orgIdAry) > 0 {
var orgList []modelshr.AdministrativeOrganization
err = overall.CONSTANT_DB_HR.Model(&modelshr.AdministrativeOrganization{}).Select("`id`,`name`").Where("`state` = 1 AND `id` IN ?", orgIdAry).Find(&orgList).Error
if err == nil && len(orgList) > 0 {
for _, v := range orgList {
var lookCont LookPowerCont
lookCont.Types = 3 //1:人员;2:角色;3:行政组织;4:职务
lookCont.TargetId = strconv.FormatInt(v.Id, 10) //相关内容识别符
lookCont.Name = v.Name //相关内容名称
lookCont.Icon = "" //头像
lookCont.IconToBase64 = "" //头像Base64
powList = append(powList, lookCont)
}
}
}
}
if custView.AuthorizedPersonnel != "" {
userKeyAry := strings.Split(custView.AuthorizedPersonnel, ",")
if len(userKeyAry) > 0 {
var userList []modelshr.PersonArchives
err = overall.CONSTANT_DB_HR.Model(&modelshr.PersonArchives{}).Select("`id`,`name`,`icon`,`icon_photo`").Where("`emp_type` IN ? AND `id` IN ?", overall.EmployeeStatusIng, userKeyAry).Find(&userList).Error
if err == nil && len(userList) > 0 {
for _, v := range userList {
var lookCont LookPowerCont
lookCont.Types = 1 //1:人员;2:角色;3:行政组织;4:职务
lookCont.TargetId = strconv.FormatInt(v.Id, 10) //相关内容识别符
lookCont.Name = v.Name //相关内容名称
lookCont.Icon = v.Icon //头像
lookCont.IconToBase64 = v.IconPhoto //头像Base64
powList = append(powList, lookCont)
}
}
}
}
//数据去重
var isKey []string
var sendData []LookPowerCont
for _, v := range powList {
if !publicmethod.IsInTrue(v.TargetId, isKey) {
isKey = append(isKey, v.TargetId)
sendData = append(sendData, v)
}
}
sort.Slice(sendData, func(i, j int) bool {
return sendData[i].Types > sendData[j].Types
})
publicmethod.Result(0, sendData, c)
}
/*
*
@ 作者: 秦东
@ 时间: 2024-04-13 15:08:04
@ 功能: 获取流程可见范围
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func GainWorkflowLookView(flowKey int64) (lookPower []LookPowerCont) {
if flowKey == 0 {
return
}
var flowInfo modelAppPlatform.FlowVersion
err := flowInfo.GetCont(map[string]interface{}{"`key`": flowKey, "`state`": 1}, "`content`")
if err == nil && flowInfo.Content != "" {
var flowConter map[string]interface{}
err = json.Unmarshal([]byte(flowInfo.Content), &flowConter)
if err == nil {
if flowPermission, ok := flowConter["flowPermission"]; ok {
if powList, ok := flowPermission.([]interface{}); ok {
for _, v := range powList {
var lookPowCont LookPowerCont
if val, ok := v.(map[string]interface{}); ok {
if iconVal, ok := val["icon"].(string); ok {
lookPowCont.Icon = iconVal
}
if iconBaseVal, ok := val["iconToBase64"].(string); ok {
lookPowCont.IconToBase64 = iconBaseVal
}
if nameVal, ok := val["name"].(string); ok {
lookPowCont.Name = nameVal
}
if targetIdVal, ok := val["targetId"].(string); ok {
lookPowCont.TargetId = targetIdVal
}
if targetIdVal, ok := val["type"].(float64); ok {
lookPowCont.Types = targetIdVal
}
}
if lookPowCont.Types != 0 {
lookPower = append(lookPower, lookPowCont)
}
}
}
}
}
}
return
}
/*
*
@ 作者: 秦东
@ 时间: 2024-04-15 14:34:47
@ 功能: 编辑可见范围
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) EditLookPowerView(c *gin.Context) {
var requestData LookPowerEdit
err := c.ShouldBindJSON(&requestData)
if err != nil {
publicmethod.Result(100, err, c)
return
}
if requestData.Id == "" {
publicmethod.Result(1, err, c, "未知表单参数!请核对1后重新提交!")
return
}
var custView modelAppPlatform.CustomerFormView
err = custView.GetCont(map[string]interface{}{"`id`": requestData.Id})
if err != nil {
publicmethod.Result(1, err, c, "未知表单参数!请核对1后重新提交!")
return
}
// var powList []LookPowerCont
if custView.FlowIsOpen == 1 && custView.Flowkey != 0 {
EditFlowLookView(custView.Flowkey, requestData.ListData)
}
var roleList []string
var peopleList []string
var orgList []string
var postList []string
if len(requestData.ListData) > 0 {
for _, v := range requestData.ListData {
switch v.Types {
case 1:
peopleList = append(peopleList, v.TargetId)
case 2:
roleList = append(roleList, v.TargetId)
case 3:
orgList = append(orgList, v.TargetId)
case 4:
postList = append(postList, v.TargetId)
default:
}
}
}
saveDara := publicmethod.MapOut[string]()
if len(peopleList) > 0 {
saveDara["authorizedPersonnel"] = strings.Join(peopleList, ",")
} else {
saveDara["authorizedPersonnel"] = ""
}
if len(roleList) > 0 {
saveDara["authorizationRoles"] = strings.Join(roleList, ",")
} else {
saveDara["authorizationRoles"] = ""
}
if len(orgList) > 0 {
saveDara["authorizedOrg"] = strings.Join(orgList, ",")
} else {
saveDara["authorizedOrg"] = ""
}
if len(postList) > 0 {
saveDara["authorizedPosition"] = strings.Join(postList, ",")
} else {
saveDara["authorizedPosition"] = ""
}
if len(saveDara) > 0 {
saveDara["edit_time"] = time.Now().Unix()
}
err = custView.EiteCont(map[string]interface{}{"`id`": requestData.Id}, saveDara)
if err != nil {
publicmethod.Result(106, err, c)
return
}
publicmethod.Result(0, err, c)
}
/*
*
@ 作者: 秦东
@ 时间: 2024-04-15 14:58:23
@ 功能:
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func EditFlowLookView(flowKey int64, ListData []LookPowerCont) {
if flowKey == 0 {
return
}
var flowInfo modelAppPlatform.FlowVersion
err := flowInfo.GetCont(map[string]interface{}{"`key`": flowKey, "`state`": 1}, "`content`", "`id`")
if err == nil && flowInfo.Content != "" {
var flowConter map[string]interface{}
err = json.Unmarshal([]byte(flowInfo.Content), &flowConter)
if err == nil {
if _, ok := flowConter["flowPermission"]; ok {
flowConter["flowPermission"] = ListData
}
}
jsonView, errk := json.Marshal(flowConter)
fmt.Printf("errk==>%v\n jsonView==>%v\n", errk, string(jsonView))
saveCont := publicmethod.MapOut[string]()
saveCont["`content`"] = string(jsonView)
saveCont["`time`"] = time.Now().Unix()
var saveFlowVersion modelAppPlatform.WorkFlowVersion
saveFlowVersion.EiteCont(map[string]interface{}{"`id`": flowInfo.Id}, saveCont)
}
}
/*
*
@ 作者: 秦东
@ 时间: 2024-04-16 15:58:05
@ 功能: 编辑消息提醒
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) SetUpMsg(c *gin.Context) {
var requestData SetMsgInfo
err := c.ShouldBindJSON(&requestData)
if err != nil {
publicmethod.Result(100, err, c)
return
}
if requestData.Id == "" {
publicmethod.Result(1, err, c, "未知表单参数!请核对1后重新提交!")
return
}
var msgRuleInfo modelAppPlatform.MsgRule
err = msgRuleInfo.GetCont(map[string]interface{}{"`formKey`": requestData.Id})
context, _ := c.Get(overall.MyContJwt)
var userCont modelshr.ManCont
userCont.GetLoginCont(context) //当前操作人
formKeyInt, _ := strconv.ParseInt(requestData.Id, 10, 64)
timeVal := time.Now().Unix()
var editMsgRuleInfo modelAppPlatform.MsgRule
if err != nil { //不存在,就写入
editMsgRuleInfo.FlowKey = formKeyInt
editMsgRuleInfo.RuleCont = requestData.SetCont
editMsgRuleInfo.Creater = userCont.Key
editMsgRuleInfo.StartTime = timeVal
editMsgRuleInfo.UpdateTime = timeVal
err = editMsgRuleInfo.WriteCont()
} else {
saveData := publicmethod.MapOut[string]()
saveData["ruleCont"] = requestData.SetCont
saveData["creater"] = userCont.Key
saveData["edit_time"] = timeVal
err = editMsgRuleInfo.EiteCont(map[string]interface{}{"`id`": msgRuleInfo.Id}, saveData)
}
publicmethod.Result(0, err, c)
}
/*
*
@ 作者: 秦东
@ 时间: 2024-04-16 16:51:11
@ 功能: 获取消息设置
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) GainSetUpMsg(c *gin.Context) {
var requestData publicmethod.PublicId
err := c.ShouldBindJSON(&requestData)
if err != nil {
publicmethod.Result(100, err, c)
return
}
if requestData.Id == "" {
publicmethod.Result(1, err, c, "未知表单参数!请核对1后重新提交!")
return
}
var msgRuleInfo modelAppPlatform.MsgRule
err = msgRuleInfo.GetCont(map[string]interface{}{"`formKey`": requestData.Id})
if err != nil {
publicmethod.Result(10001, err, c)
return
}
sendMap := publicmethod.MapOut[string]()
sendMap["id"] = strconv.FormatInt(msgRuleInfo.Id, 10)
sendMap["formKey"] = strconv.FormatInt(msgRuleInfo.FlowKey, 10)
if msgRuleInfo.RuleCont != "" {
var ruleContMap map[string]interface{}
json.Unmarshal([]byte(msgRuleInfo.RuleCont), &ruleContMap)
sendMap["ruleCont"] = ruleContMap
} else {
sendMap["ruleCont"] = ""
}
sendMap["timeVal"] = publicmethod.UnixTimeToDay(msgRuleInfo.StartTime, 27)
publicmethod.Result(0, sendMap, c)
}

19
api/version1/taskplatform/taskflow/flowType.go

@ -217,3 +217,22 @@ type SearchUserCont struct {
Name string `json:"name"`
Department int64 `json:"department"`
}
type LookPowerCont struct {
Types float64 `json:"type"` //1:人员;2:角色;3:行政组织;4:职务
TargetId string `json:"targetId"` //相关内容识别符
publicmethod.PublicName //相关内容名称
Icon string `json:"icon"` //头像
IconToBase64 string `json:"iconToBase64"` //头像Base64
}
type LookPowerEdit struct {
publicmethod.PublicId
ListData []LookPowerCont `json:"listData"` //
}
//设置消息提醒
type SetMsgInfo struct {
publicmethod.PublicId
SetCont string `json:"setCont"` //提示主体
}

60
api/version1/taskplatform/taskmanagement/appform.go

@ -207,38 +207,42 @@ func (a *ApiMethod) GianTaskVersionCont(c *gin.Context) {
publicmethod.Result(107, err, c)
return
}
var versionCont modelAppPlatform.CustomerFormView
err = versionCont.GetCont(map[string]interface{}{"`id`": requestData.Id})
// var versionCont modelAppPlatform.CustomerFormView
// err = versionCont.GetCont(map[string]interface{}{"`id`": requestData.Id})
var sendInfo CallBackFormStruct
err = overall.CONSTANT_DB_AppPlatform.Where("`id` = ?", requestData.Id).Find(&sendInfo).Error
if err != nil {
publicmethod.Result(107, err, c)
return
}
var sendInfo CallBackFormStruct
sendInfo.Id = versionCont.Id
sendInfo.TableKey = versionCont.TableKey //表单标识符"`
sendInfo.Version = versionCont.Version //版本号"`
sendInfo.Status = versionCont.Status //显示状态(1:启用;2:禁用,3:删除)"`
sendInfo.MastesForm = versionCont.MastesForm //表单结构"`
sendInfo.MastesFormJson = versionCont.MastesFormJson //表单结构json"`
sendInfo.Creater = versionCont.Creater //创建人"`
sendInfo.CreaterTime = versionCont.CreaterTime //创建时间"`
sendInfo.EditTime = versionCont.EditTime //编辑时间"`
sendInfo.TableStructure = versionCont.TableStructure //字表结构"`
sendInfo.Dict = versionCont.Dict //字表结构"`
sendInfo.CfId = versionCont.CfId //
sendInfo.Name = versionCont.Name //表单名称"`
sendInfo.Classify = versionCont.Classify //分类1:表单;2:流程表单"`
sendInfo.Permit = versionCont.Permit //授权范围"`
sendInfo.PermitStr = versionCont.PermitStr //授权范围"`
sendInfo.Flowkey = versionCont.Flowkey //关联工作流"`
sendInfo.UserPermit = versionCont.UserPermit //可见人员"`
sendInfo.PostPermit = versionCont.PostPermit //可见角色"`
sendInfo.PowerStr = versionCont.PowerStr //权限结构"`
sendInfo.Groupid = versionCont.Groupid //分组Id"`
sendInfo.Icon = versionCont.Icon //图标"`
sendInfo.FlowIsOpen = versionCont.FlowIsOpen //是否开启工作流(1:启用;2:禁用)"`
sendInfo.FlowkeyStr = strconv.FormatInt(versionCont.Flowkey, 10)
sendInfo.CreaterStr = strconv.FormatInt(versionCont.Creater, 10)
// var sendInfo CallBackFormStruct
// sendInfo.Id = versionCont.Id
// sendInfo.TableKey = versionCont.TableKey //表单标识符"`
// sendInfo.Version = versionCont.Version //版本号"`
// sendInfo.Status = versionCont.Status //显示状态(1:启用;2:禁用,3:删除)"`
// sendInfo.MastesForm = versionCont.MastesForm //表单结构"`
// sendInfo.MastesFormJson = versionCont.MastesFormJson //表单结构json"`
// sendInfo.Creater = versionCont.Creater //创建人"`
// sendInfo.CreaterTime = versionCont.CreaterTime //创建时间"`
// sendInfo.EditTime = versionCont.EditTime //编辑时间"`
// sendInfo.TableStructure = versionCont.TableStructure //字表结构"`
// sendInfo.Dict = versionCont.Dict //字表结构"`
// sendInfo.CfId = versionCont.CfId //
// sendInfo.Name = versionCont.Name //表单名称"`
// sendInfo.Classify = versionCont.Classify //分类1:表单;2:流程表单"`
// sendInfo.Permit = versionCont.Permit //授权范围"`
// sendInfo.PermitStr = versionCont.PermitStr //授权范围"`
// sendInfo.Flowkey = versionCont.Flowkey //关联工作流"`
// sendInfo.UserPermit = versionCont.UserPermit //可见人员"`
// sendInfo.PostPermit = versionCont.PostPermit //可见角色"`
// sendInfo.PowerStr = versionCont.PowerStr //权限结构"`
// sendInfo.Groupid = versionCont.Groupid //分组Id"`
// sendInfo.Icon = versionCont.Icon //图标"`
// sendInfo.FlowIsOpen = versionCont.FlowIsOpen //是否开启工作流(1:启用;2:禁用)"`
sendInfo.FlowkeyStr = strconv.FormatInt(sendInfo.Flowkey, 10)
sendInfo.CreaterStr = strconv.FormatInt(sendInfo.Creater, 10)
sendInfo.IdStr = strconv.FormatInt(sendInfo.Id, 10)
publicmethod.Result(0, sendInfo, c)
}

186
api/version1/taskplatform/taskmanagement/flowNode.go

@ -0,0 +1,186 @@
package taskmanagement
import "appPlatform/overall/publicmethod"
/**
@ 作者: 秦东
@ 时间: 2024-04-09 10:56:48
@ 功能: 工作流结构主体
*/
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 NodePublicInfo struct {
NodePublicInfoES
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指定成员 3指定角色
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"` //子节点
Matrix MatrixInfo `json:"matrix"` //
}
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 NodeUserListInfo struct {
FlowPermissionInfo
publicmethod.CommonId[string]
publicmethod.PublicName
Options []OptionsInfo `json:"options"` //可选项(用于关联表单使用)
IsCheckbox bool `json:"isCheckbox"` //结果值多选
}
//人员;角色;行政组织;职务通用结构体
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 MatrixInfo struct {
MatrixId int64 `json:"matrixid"`
FactorId int64 `json:"factorid"`
OutcomeId int64 `json:"outcomeid"`
MatrixName string `json:"matrixName"`
FactorName string `json:"factorName"`
OutcomeName string `json:"outcomeName"`
}
//判断条件主体
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"` //可选项(用于关联表单使用)
Oneanswer string `json:"oneanswer"` //可选项锚定值(用于关联表单使用)
Answers []string `json:"answers"` //可选项锚定值(用于关联表单使用)
CustomFields []CustomFieldsInfo `json:"customFields"` //自定义字段条件主体
NodeUserList []FlowPermissionInfo `json:"nodeUserList"` //人员、行政组织、角色为条件主体
}
//可选项(用于关联表单使用)
type OptionsInfo struct {
Label string `json:"label"` //名称
Value string `json:"value"` //值
}
//自定义字段条件主体
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时;右侧值
}
//输出工作流相关操作
type SendFlowInfo struct {
Step int `json:"Step"` //当前执行第几步
NodeKey string `json:"nodeKey"` //当前节点标识
NextStep int `json:"nextStep"` //下一步执行第几步
FlowList []RunFlow `json:"flowList"` //流程主体
}
/**
@ 作者: 秦东
@ 时间: 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"` //操作人
PendPers []OperatorList `json:"pendpers"` //操作人ssss
RunType int `json:"runtype"` //运行时选择 0:禁闭;1:发起人自选,2:发起人自己,3:有选中得节点指定,4:抄送节点
RunScope int `json:"runscope"` //运行时选择范围 0:不可选,1:本公司;2:本部门;当RunType = 4时:1:自选;非1:不可自选
// Operational bool `json:"operational"` //是否可提交审批意见
}
//操作人
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"` //操作记录
NoEdit bool `json:"noedit"` //不可删除
Tel string `json:"tel"` //电话
CompanyName string `json:"companyName"` //公司
}
// 节点操作人操作记录
type LogList struct {
State int `json:"state"` //状态 1、未操作;2、通过;3、驳回;4、已查看
TimeVal string `json:"time"`
Cause string `json:"cause"` //审批意见
Enclosure []EnclosureFormat `json:"enclosure"` //附件
UID string `json:"uid"` //当前执行识别符
}
// 附件格式
type EnclosureFormat struct {
FileName string `json:"filename"` //附件名称
FilePath string `json:"filepath"` //附件地址
Type int `json:"type"` //附件类型
}

30
api/version1/taskplatform/taskmanagement/flowType.go

@ -0,0 +1,30 @@
package taskmanagement
import "appPlatform/overall/publicmethod"
// 启动流程
type StartWorkFlow struct {
publicmethod.PublicId
FlowList []RunFlow `json:"flowList"` //流程主体
State int `json:"state"` //状态状态:1、草稿;2:驳回;3:审批中;4:归档;5:删除
}
// 流程执行
type RunWorkFlow struct {
Step int //执行哪一步
NextStep int //下一步
TotalSteps int //总步数
FlowList []RunFlow //流程
Participant []string //参与人
NewFlowList []RunFlow //流程
Uuid int64 //
RunUid int64 //执行Uid
IsRun bool //是否结束执行
Msg string //执行说明
}
type SubmitAppResults struct {
publicmethod.PublicId
AgreeOrRefuse int `json:"agreeOrRefuse"` //1:同意;2:驳回
Suggest string `json:"suggest"` //审批意见
FlowList []RunFlow `json:"flowlist"` //执行流程
}

10
api/version1/taskplatform/taskmanagement/formcontrol.go

@ -210,6 +210,12 @@ func WriteSunDatabase(uuid, creater, createrTime int64, masterTableName string,
err = errors.New("表单数据提交失败!请重新提交")
publicmethod.WriteLog("e", "写入自定义表单", masterTableName, err)
}
} else {
gormDb := overall.CONSTANT_DB_CustomerForm
masterErr := gormDb.Table(masterTableName).Create(masterDataCont).Error
if masterErr != nil {
publicmethod.WriteLog("write", "写入自定义表单", masterTableName, masterErr)
}
}
} else {
//子表不存在时,写入主表数据
@ -768,7 +774,7 @@ func MakeFormMapData(uuid, userKey, cureeTime int64, fieldVal map[string]interfa
*
@ 作者: 秦东
@ 时间: 2024-04-03 09:40:31
@ 功能:
@ 功能:用户端自定义表单新增记录(列表新版)
@ 参数
#
@ -857,7 +863,7 @@ func (a *ApiMethod) AddCustomerForm(c *gin.Context) {
taskCont.Types = formCont.FlowIsOpen //类型(1:流程表单;2:普通表单)"`
taskCont.VersionId = formCont.Id //来源于哪个表单"`
taskCont.Status = 2
if formCont.FlowIsOpen == 2 {
if formCont.FlowIsOpen == 1 {
taskCont.Status = 3
taskCont.FlowKey = formCont.Flowkey
var flowInfo modelAppPlatform.FlowVersion

2169
api/version1/taskplatform/taskmanagement/ruanTask.go

File diff suppressed because it is too large

1551
api/version1/taskplatform/taskmanagement/runWorkFlow.go

File diff suppressed because it is too large

30
api/version1/taskplatform/taskmanagement/types.go

@ -78,4 +78,34 @@ type CallBackFormStruct struct {
modelAppPlatform.CustomerFormView
FlowkeyStr string `json:"flowkeystr" gorm:"-"`
CreaterStr string `json:"createrstr" gorm:"-"`
IdStr string `json:"idStr" gorm:"-"`
}
// 批量删除数据
type BatchDeleteClass struct {
Id []string `json:"id"`
IsTrue int `json:"isTrue"`
}
type NodelPeopleInfo struct {
FactorId string `json:"factorid"`
UserList string `json:"userList"`
}
// 主管层级
type ContinuousMultiLevelSupervisor struct {
MaxLevel int //最大级别
Continuity bool //是否连续主管
UserList []MultiLeveUserList //每级人员列表
}
type MultiLeveUserList struct {
Level int //第几级
UserList []OperatorList //操作人
}
type CreatFlowView struct {
publicmethod.PublicId
ConditionList []ConditionListInfo `json:"conditionList"` //判断条件主体
NodelPeople []NodelPeopleInfo `json:"nodelPeople"` //节点操作人
Step int `json:"step"` //当前执行第几步
OldFlow []RunFlow `json:"oldFlow"` //已生成的流程
}

3
apirouter/apishiyan/maptostruct.go

@ -36,7 +36,8 @@ func (a *ApiRouter) RouterGroup(router *gin.RouterGroup) {
apiRouter.POST("createFlowChart", methodBinding.CreateFlowChart) //实验流程图生成
apiRouter.POST("getAllOrgSun", methodBinding.GetAllOrgSun) //获取行政组织所有子类
apiRouter.POST("getAllOrgSun", methodBinding.GetAllOrgSun) //获取行政组织所有子类
apiRouter.POST("gainDateCenter", methodBinding.GainDateCenter) //获取行政组织所有子类
}
}

2
apirouter/entry.go

@ -4,6 +4,7 @@ import (
"appPlatform/apirouter/apishiyan"
"appPlatform/apirouter/authenticationroute"
"appPlatform/apirouter/v1/customerformrouter"
datacenterrouter "appPlatform/apirouter/v1/dataCenterRouter"
dictrouters "appPlatform/apirouter/v1/dict_routers"
"appPlatform/apirouter/v1/grantsystempower"
"appPlatform/apirouter/v1/mathsrouter"
@ -33,6 +34,7 @@ type RouterGroup struct {
RedisClassApiRouter redisRouter.ApiRouter
MathsRouter mathsrouter.ApiRouter
WorkWechatRouter workwechatrouter.ApiRouter
DataCenterRouter datacenterrouter.ApiRouter
}
var RouterGroupEntry = new(RouterGroup)

21
apirouter/v1/dataCenterRouter/router.go

@ -0,0 +1,21 @@
package datacenterrouter
import (
"appPlatform/api/version1"
"github.com/gin-gonic/gin"
)
// 权限矩阵PC端
func (a *ApiRouter) RouterGroupPc(router *gin.RouterGroup) {
apiRouter := router.Group("dataCenter")
//var methodBinding = version1.AppApiEntry.CustomerFormApi
dataApi := version1.AppApiEntry.DataCenterApi
{
apiRouter.GET("", dataApi.Index) //入口
apiRouter.POST("", dataApi.Index) //入口
apiRouter.POST("gaindataCenter", dataApi.GaindataCenter) //通用地址
apiRouter.POST("postSaveData", dataApi.PostSaveData) //数据中台POST提交数据
}
}

4
apirouter/v1/dataCenterRouter/type.go

@ -0,0 +1,4 @@
package datacenterrouter
//公共路由
type ApiRouter struct{}

20
apirouter/v1/taskrouter/taskrouter.go

@ -26,6 +26,22 @@ func (a *ApiRouter) RouterGroupPc(router *gin.RouterGroup) {
apiRouter.POST("add_form_data", taskManagementRouter.AddFormAddData) //用户端自定义表单新增记录
apiRouter.POST("add_form_newdata", taskManagementRouter.AddFormAddNewData) //用户端自定义表单新增记录(新版)
apiRouter.POST("add_customer_form", taskManagementRouter.AddCustomerForm) //用户端自定义表单新增记录(列表新版)
apiRouter.POST("gainTaskFormInfo", taskManagementRouter.GainTaskFormInfo) //获取任务表单内容
apiRouter.POST("softDeletion", taskManagementRouter.SoftDeletion) //删除任务数据
apiRouter.POST("editCustomerTable", taskManagementRouter.EditCustomerTable) //编辑任务
apiRouter.POST("gainEditDataLog", taskManagementRouter.GainEditDataLog) //获取修改记录
apiRouter.POST("echoTableFormPage", taskManagementRouter.EchoTableFormPage) //添加任务是回显表单数据,若有流程回显流程
apiRouter.POST("realTimeUpdateFlow", taskManagementRouter.RealTimeUpdateFlow) //根据表单数据实时更新流程
apiRouter.POST("startRunWorkFlow", taskManagementRouter.StartRunWorkFlow) //发起流程
apiRouter.POST("draftsInitiateApproval", taskManagementRouter.DraftsInitiateApproval) //根据表单数据实时更新流程
apiRouter.POST("gainRunTaskWorkflow", taskManagementRouter.GainRunTaskWorkflow) //获取正在执行得任务流程
apiRouter.POST("retractRunWorkFlow", taskManagementRouter.RetractRunWorkFlow) //撤回已申请的工作流
apiRouter.POST("afreshRunWorkflow", taskManagementRouter.AfreshRunWorkflow) //重新发起流程
apiRouter.POST("applyForTableFormData", taskManagementRouter.ApplyForTableFormData) //申请修改数据
apiRouter.POST("authorizeWorkflow", taskManagementRouter.AuthorizeWorkflow) //审批处理
}
taskFlowApi := router.Group("task_flow")
@ -63,5 +79,9 @@ func (a *ApiRouter) RouterGroupPc(router *gin.RouterGroup) {
taskFlowApi.POST("gainEditFormFlowInfo", taskFlowRouter.GainEditFormFlowInfo) //获取要修改的数据
taskFlowApi.POST("editFormLogData", taskFlowRouter.EditFormLogData) //申请修改数据
taskFlowApi.POST("gainFlowLookSee", taskFlowRouter.GainFlowLookSee) //获取流程可见范围
taskFlowApi.POST("editLookPowerView", taskFlowRouter.EditLookPowerView) //编辑可见范围
taskFlowApi.POST("setUpMsg", taskFlowRouter.SetUpMsg) //编辑消息提醒
taskFlowApi.POST("gainSetUpMsg", taskFlowRouter.GainSetUpMsg) //获取消息设置
}
}

1
go.mod

@ -7,7 +7,6 @@ require (
github.com/flipped-aurora/gin-vue-admin/server v0.0.0-20231212025023-e0a8e9370425
github.com/fsnotify/fsnotify v1.7.0
github.com/gin-gonic/gin v1.9.1
github.com/go-redis/redis/v8 v8.11.5
github.com/mitchellh/mapstructure v1.5.0
github.com/mozillazg/go-pinyin v0.20.0
github.com/redis/go-redis/v9 v9.3.0

7
go.sum

@ -33,8 +33,6 @@ github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJn
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
github.com/go-playground/validator/v10 v10.14.0 h1:vgvQWe3XCz3gIeFDm/HnTIbj6UGmg/+t63MyGU2n5js=
github.com/go-playground/validator/v10 v10.14.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI=
github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo=
github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrtU8EI=
github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
@ -72,9 +70,6 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/mozillazg/go-pinyin v0.20.0 h1:BtR3DsxpApHfKReaPO1fCqF4pThRwH9uwvXzm+GnMFQ=
github.com/mozillazg/go-pinyin v0.20.0/go.mod h1:iR4EnMMRXkfpFVV5FMi4FNB6wGq9NV6uDWbUuPhP4Yc=
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
github.com/onsi/gomega v1.18.1 h1:M1GfJqGRrBrrGGsbxzV5dqM2U2ApXefZCQpkukxYRLE=
github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4=
github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
@ -134,8 +129,6 @@ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogR
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

3
initialization/route/initRoute.go

@ -46,6 +46,9 @@ func InitialRouter() *gin.Engine {
{
wechatApiRouter.RouterGroupPc(appLoadRouterGroup)
}
//数据中台
dataCenterInit := apirouter.RouterGroupEntry.DataCenterRouter
dataCenterInit.RouterGroupPc(appLoadRouterGroup)
}
//验证身份接口 鉴权Url(主要应用端使用)

76
models/customerForm/runWorkflow.go

@ -0,0 +1,76 @@
package customerForm
import (
"appPlatform/overall"
"strings"
)
// 工作流执行主体
// 字典类型
type RunWorkflow struct {
Id int64 `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(4) unsigned;default:1;not null;comment:当前节点"`
NextStep int `json:"nextStep" gorm:"column:next_step;type:int(4) unsigned;default:0;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:编辑时间"`
VersionCont string `json:"versionCont" gorm:"column:version_cont;type:longtext;comment:版本流程内容"`
RunKey int64 `json:"runKey" gorm:"column:runKey;type:bigint(20) unsigned;default:0;not null;comment:当前执行识别符"`
}
func (RunWorkflow *RunWorkflow) TableName() string {
return "runWorkflow"
}
// 写入内容
func (cont *RunWorkflow) WriteCont() (err error) {
err = overall.CONSTANT_DB_CustomerForm.Create(&cont).Error
return
}
// 编辑内容
func (cont *RunWorkflow) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_CustomerForm.Model(&cont).Where(whereMap).Updates(saveData).Error
return
}
// 获取内容
func (cont *RunWorkflow) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_CustomerForm.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 *RunWorkflow) CountCont(whereMap interface{}) (countId int64) {
overall.CONSTANT_DB_CustomerForm.Model(&cont).Where(whereMap).Count(&countId)
return
}
// 读取全部信息
func (cont *RunWorkflow) ContMap(whereMap interface{}, field ...string) (countAry []RunWorkflow, err error) {
gormDb := overall.CONSTANT_DB_CustomerForm.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
err = gormDb.Where(whereMap).Find(&countAry).Error
return
}
// 删除内容
func (cont *RunWorkflow) DelCont(whereMap interface{}) (err error) {
err = overall.CONSTANT_DB_CustomerForm.Where(whereMap).Delete(&cont).Error
return
}

32
models/customerForm/taskrecord.go

@ -7,19 +7,25 @@ import (
// 自定义表单任务表
type TaskRecord struct {
Id int `json:"id" gorm:"primaryKey;column:id;type:int(5) unsigned;not null;comment:Id;index"`
Title string `json:"title" gorm:"column:title;type:varchar(255) unsigned;default:'';not null;comment:标题"`
Creater int64 `json:"creater" gorm:"column:creater;type:bigint(20) unsigned;default:0;not null;comment:创建人"`
CreaterTime int64 `json:"creater_time" 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:编辑时间"`
Types int `json:"types" gorm:"column:types;type:int(1) unsigned;default:1;not null;comment:类型(1:普通表单;2:流程表单)"`
VersionId int64 `json:"version_id" gorm:"column:version_id;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:删除)"`
MastersKey int64 `json:"masters_key" gorm:"column:masters_key;type:bigint(20) unsigned;default:0;not null;comment:主表标识"`
FlowKey int64 `json:"flow_key" gorm:"column:flow_key;type:bigint(20) unsigned;default:0;not null;comment:主表标识"`
FlowRunSing int64 `json:"flowRunSing" gorm:"column:flow_run_sing;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"`
Id int `json:"id" gorm:"primaryKey;column:id;type:int(5) unsigned;not null;comment:Id;index"`
Title string `json:"title" gorm:"column:title;type:varchar(255) unsigned;default:'';not null;comment:标题"`
Creater int64 `json:"creater" gorm:"column:creater;type:bigint(20) unsigned;default:0;not null;comment:创建人"`
CreaterTime int64 `json:"creater_time" 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:编辑时间"`
Types int `json:"types" gorm:"column:types;type:int(1) unsigned;default:1;not null;comment:类型(1:普通表单;2:流程表单)"`
VersionId int64 `json:"version_id" gorm:"column:version_id;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:删除)"`
MastersKey int64 `json:"masters_key" gorm:"column:masters_key;type:bigint(20) unsigned;default:0;not null;comment:主表标识"`
FlowKey int64 `json:"flow_key" gorm:"column:flow_key;type:bigint(20) unsigned;default:0;not null;comment:主表标识"`
FlowRunSing int64 `json:"flowRunSing" gorm:"column:flow_run_sing;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"`
Visibility int `json:"visibility" gorm:"column:visibility;type:int(1) unsigned;default:1;not null;comment:1、所有人;2、自定义"`
AuthorizationRoles string `json:"authorizationRoles" gorm:"column:authorizationRoles;type:mediumtext;comment:授权角色"`
AuthorizedPersonnel string `json:"authorizedPersonnel" gorm:"column:authorizedPersonnel;type:mediumtext;comment:授权人员"`
AuthorizedOrg string `json:"authorizedOrg" gorm:"column:authorizedOrg;type:mediumtext;comment:授权行政组织"`
AuthorizedPosition string `json:"authorizedPosition" gorm:"column:authorizedPosition;type:mediumtext;comment:授权职务"`
Participant string `json:"participant" gorm:"column:participant;type:longtext;default:'';comment:表单结构json"`
}
func (TaskRecord *TaskRecord) TableName() string {

31
models/modelAppPlatform/customer_form_version.go

@ -7,18 +7,25 @@ import (
// 自定义表单版本列表
type CustomerFormVersion struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:int(5) unsigned;not null;comment:Id;index"`
TableKey string `json:"tablekey" gorm:"column:tablekey;type:varchar(255) unsigned;default:'';not null;comment:表单标识符"`
Version int64 `json:"version" gorm:"column:version;type:int(5) unsigned;default:1;not null;comment:版本号"`
Status int `json:"status" gorm:"column:status;type:int(1) unsigned;default:1;not null;comment:显示状态(1:启用;2:禁用,3:删除)"`
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:创建人"`
CreaterTime 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:编辑时间"`
TableStructure string `json:"table_structure" gorm:"column:table_structure;type:longtext;default:'';comment:字表结构"`
Dict string `json:"dict" gorm:"column:dict;type:mediumtext;default:'';comment:字表结构"`
PowerStr string `json:"powerstr" gorm:"column:powerstr;type:longtext;default:'';comment:权限结构"`
Id int64 `json:"id" gorm:"primaryKey;column:id;type:int(5) unsigned;not null;comment:Id;index"`
TableKey string `json:"tablekey" gorm:"column:tablekey;type:varchar(255) unsigned;default:'';not null;comment:表单标识符"`
Version int64 `json:"version" gorm:"column:version;type:int(5) unsigned;default:1;not null;comment:版本号"`
Status int `json:"status" gorm:"column:status;type:int(1) unsigned;default:1;not null;comment:显示状态(1:启用;2:禁用,3:删除)"`
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:创建人"`
CreaterTime 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:编辑时间"`
FlowKey int64 `json:"flowkey" gorm:"column:flowkey;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:字表结构"`
PowerStr string `json:"powerstr" gorm:"column:powerstr;type:longtext;default:'';comment:权限结构"`
ListPage string `json:"listPage" gorm:"column:listPage;type:longtext;default:'';comment:列表结构"`
Visibility int `json:"visibility" gorm:"column:stavisibilitytus;type:int(1) unsigned;default:1;not null;comment:1、所有人,2、自定义"`
AuthorizationRoles string `json:"authorizationRoles" gorm:"column:authorizationRoles;type:mediumtext;default:'';comment:授权角色"`
AuthorizedPersonnel string `json:"authorizedPersonnel" gorm:"column:authorizedPersonnel;type:mediumtext;default:'';comment:授权人员"`
AuthorizedOrg string `json:"authorizedOrg" gorm:"column:authorizedOrg;type:mediumtext;default:'';comment:授权行政组织"`
AuthorizedPosition string `json:"authorizedPosition" gorm:"column:authorizedPosition;type:mediumtext;default:'';comment:授权职务"`
}
func (CustomerFormVersion *CustomerFormVersion) TableName() string {

54
models/modelAppPlatform/customer_form_view.go

@ -7,30 +7,36 @@ import (
// 自定义表单版本列表
type CustomerFormView struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:int(5) unsigned;not null;comment:Id;index"`
TableKey string `json:"tablekey" gorm:"column:tablekey;type:varchar(255) unsigned;default:'';not null;comment:表单标识符"`
Version int `json:"version" gorm:"column:version;type:int(5) unsigned;default:1;not null;comment:版本号"`
Status int `json:"status" gorm:"column:status;type:int(1) unsigned;default:1;not null;comment:显示状态(1:启用;2:禁用,3:删除)"`
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:创建人"`
CreaterTime 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:编辑时间"`
TableStructure string `json:"table_structure" gorm:"column:table_structure;type:longtext;default:'';comment:字表结构"`
Dict string `json:"dict" gorm:"column:dict;type:mediumtext;default:'';comment:字表结构"`
CfId int64 `json:"cfid" gorm:"column:cfid;type:int(5) unsigned;not null;comment:Id"`
Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:表单名称"`
Classify int `json:"classify" gorm:"column:classify;type:int(1) unsigned;default:1;not null;comment:分类1:表单;2:流程表单"`
Permit string `json:"permit" gorm:"column:permit;type:mediumtext;default:'';comment:授权范围"`
PermitStr string `json:"permitstr" gorm:"column:permitstr;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:可见角色"`
PowerStr string `json:"powerstr" gorm:"column:powerstr;type:longtext;default:'';comment:权限结构"`
Groupid int64 `json:"groupid" gorm:"column:groupid;type:bigint(20) unsigned;default:0;not null;comment:分组Id"`
Icon string `json:"icon" gorm:"column:icon;type:varchar(255);default:'';comment:图标"`
FlowIsOpen int `json:"flowIsOpen" gorm:"column:flowIsOpen;type:int(1) unsigned;default:2;not null;comment:是否开启工作流(1:启用;2:禁用)"`
ListJson string `json:"listjson" gorm:"column:listjson;type:longtext;default:'';comment:列表结构体"`
Id int64 `json:"id" gorm:"primaryKey;column:id;type:int(5) unsigned;not null;comment:Id;index"`
TableKey string `json:"tablekey" gorm:"column:tablekey;type:varchar(255) unsigned;default:'';not null;comment:表单标识符"`
Version int `json:"version" gorm:"column:version;type:int(5) unsigned;default:1;not null;comment:版本号"`
Status int `json:"status" gorm:"column:status;type:int(1) unsigned;default:1;not null;comment:显示状态(1:启用;2:禁用,3:删除)"`
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:创建人"`
CreaterTime 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:编辑时间"`
TableStructure string `json:"table_structure" gorm:"column:table_structure;type:longtext;default:'';comment:字表结构"`
Dict string `json:"dict" gorm:"column:dict;type:mediumtext;default:'';comment:字表结构"`
CfId int64 `json:"cfid" gorm:"column:cfid;type:int(5) unsigned;not null;comment:Id"`
Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:表单名称"`
Classify int `json:"classify" gorm:"column:classify;type:int(1) unsigned;default:1;not null;comment:分类1:表单;2:流程表单"`
Permit string `json:"permit" gorm:"column:permit;type:mediumtext;default:'';comment:授权范围"`
PermitStr string `json:"permitstr" gorm:"column:permitstr;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:可见角色"`
PowerStr string `json:"powerstr" gorm:"column:powerstr;type:longtext;default:'';comment:权限结构"`
Groupid int64 `json:"groupid" gorm:"column:groupid;type:bigint(20) unsigned;default:0;not null;comment:分组Id"`
Icon string `json:"icon" gorm:"column:icon;type:varchar(255);default:'';comment:图标"`
FlowIsOpen int `json:"flowIsOpen" gorm:"column:flowIsOpen;type:int(1) unsigned;default:2;not null;comment:是否开启工作流(1:启用;2:禁用)"`
ListJson string `json:"listjson" gorm:"column:listjson;type:longtext;default:'';comment:列表结构体"`
ListPage string `json:"listPage" gorm:"column:listPage;type:longtext;default:'';comment:列表结构"`
Visibility int `json:"visibility" gorm:"column:stavisibilitytus;type:int(1) unsigned;default:1;not null;comment:1、所有人,2、自定义"`
AuthorizationRoles string `json:"authorizationRoles" gorm:"column:authorizationRoles;type:mediumtext;default:'';comment:授权角色"`
AuthorizedPersonnel string `json:"authorizedPersonnel" gorm:"column:authorizedPersonnel;type:mediumtext;default:'';comment:授权人员"`
AuthorizedOrg string `json:"authorizedOrg" gorm:"column:authorizedOrg;type:mediumtext;default:'';comment:授权行政组织"`
AuthorizedPosition string `json:"authorizedPosition" gorm:"column:authorizedPosition;type:mediumtext;default:'';comment:授权职务"`
}
func (CustomerFormView *CustomerFormView) TableName() string {

67
models/modelAppPlatform/msgrule.go

@ -0,0 +1,67 @@
package modelAppPlatform
import (
"appPlatform/overall"
"strings"
)
// 自定义表单消息推送规则
type MsgRule struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"`
FlowKey int64 `json:"flowKey" gorm:"column:formKey;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:流程发起人"`
RuleCont string `json:"ruleCont" gorm:"column:ruleCont;type:mediumtext;default:'';comment:规则字符串"`
StartTime int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"`
UpdateTime int64 `json:"editTime" gorm:"column:edit_time;type:bigint(20) unsigned;default:0;not null;comment:编辑时间"`
}
func (MsgRule *MsgRule) TableName() string {
return "msgrule"
}
// 写入内容
func (cont *MsgRule) WriteCont() (err error) {
err = overall.CONSTANT_DB_AppPlatform.Create(&cont).Error
return
}
// 编辑内容
func (cont *MsgRule) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_AppPlatform.Model(&cont).Where(whereMap).Updates(saveData).Error
return
}
// 获取内容
func (cont *MsgRule) 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 *MsgRule) CountCont(whereMap interface{}) (countId int64) {
overall.CONSTANT_DB_AppPlatform.Model(&cont).Where(whereMap).Count(&countId)
return
}
// 读取全部信息
func (cont *MsgRule) ContMap(whereMap interface{}, field ...string) (countAry []MsgRule, 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 *MsgRule) DelCont(whereMap interface{}) (err error) {
err = overall.CONSTANT_DB_AppPlatform.Where(whereMap).Delete(&cont).Error
return
}

2
models/reviseform/edit_form_data_log.go

@ -17,6 +17,8 @@ type EditFormDataLog struct {
Explicate string `json:"explicate" gorm:"column:explicate;type:longtext;default:'';comment:说明"`
SunDataCont string `json:"sunDataCont" gorm:"column:sunDataCont;type:longtext;default:'';comment:子表数值"`
EditTime int64 `json:"editTime" gorm:"column:editTime;type:bigint(20) unsigned;default:0;not null;comment:创建时间"`
Executor int64 `json:"executor" gorm:"column:executor;type:bigint(20) unsigned;default:0;not null;comment:执行人"`
MastersKey int64 `json:"masters_key" gorm:"column:masters_key;type:bigint(20) unsigned;default:0;not null;comment:主表标识"`
}
func (EditFormDataLog *EditFormDataLog) TableName() string {

5
overall/publicmethod/formatOutput.go

@ -35,6 +35,11 @@ func Result(code int, data interface{}, c *gin.Context, msgAry ...string) {
c.JSON(http.StatusOK, Reply{code, msg, data}) //输出json格式数据
}
// 格式化输出
func ResultInterface(data interface{}, c *gin.Context) {
c.JSON(http.StatusOK, data) //输出json格式数据
}
//列表输出标准格式
/*
@total 总数

11
overall/publicmethod/technique.go

@ -2753,3 +2753,14 @@ func TypeToInterface(val interface{}) string {
return ""
}
}
/*
*
@ 作者: 秦东
@ 时间: 2024-04-07 08:26:39
@ 功能: 去除字段保留字
*/
func RemoveReservedWord(val string) bool {
reservedWord := []string{"id", "masters_key", "creater_time", "edit_time", "flow_id", "states", "flowIsOpen"}
return IsInTrue[string](val, reservedWord)
}

Loading…
Cancel
Save