diff --git a/api/shiyan/maptostruct/shiyan.go b/api/shiyan/maptostruct/shiyan.go index f413d53..a2e4212 100644 --- a/api/shiyan/maptostruct/shiyan.go +++ b/api/shiyan/maptostruct/shiyan.go @@ -599,3 +599,126 @@ func (a *ApiMethod) GainDateCenter(c *gin.Context) { json.Unmarshal(jisguo, &sendDara) publicmethod.Result(0, sendDara, c) } + +func (a *ApiMethod) GainAppPageInfo(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(102, err, c) + return + } + // var appFormPage modelAppPlatform.CustomerFormView + // err = appFormPage.GetCont(map[string]interface{}{"`status`": 1, "`signCode`": requestData.Id}) + + var appFormMap map[string]interface{} + err = overall.CONSTANT_DB_AppPlatform.Model(&modelAppPlatform.CustomerFormView{}).Where("`status` = 1 AND `signCode` = ?", requestData.Id).Find(&appFormMap).Error + + if err != nil { + publicmethod.Result(105, err, c) + return + } + for i := range appFormMap { + if i == "listjson" { + var listjson map[string]interface{} + if listVal, isOk := appFormMap[i].(string); isOk { + json.Unmarshal([]byte(listVal), &listjson) + appFormMap[i] = listjson + } + } + if i == "mastesform" { + var mastesform map[string]interface{} + if mastesformVal, isOk := appFormMap[i].(string); isOk { + err = json.Unmarshal([]byte(mastesformVal), &mastesform) + fmt.Printf("err-->%v\n", err) + appFormMap[i] = mastesform + } + } + if i == "mastesformjson" { + var mastesforms map[string]interface{} + if mastesformvals, isOk := appFormMap[i].(string); isOk { + json.Unmarshal([]byte(mastesformvals), &mastesforms) + appFormMap[i] = mastesforms + } + } + if i == "powerstr" { + var powerstr []map[string]interface{} + if powerstrval, isOk := appFormMap[i].(string); isOk { + json.Unmarshal([]byte(powerstrval), &powerstr) + + appFormMap[i] = powerstr + } + } + } + sendData := publicmethod.MapOut[string]() + sendData["appFormMap"] = appFormMap + // sendData["appForm"] = appFormPage + // sendData["versionId"] = strconv.FormatInt(appFormPage.Id, 10) + // sendData["flowkey"] = strconv.FormatInt(appFormPage.Flowkey, 10) + // sendData["groupid"] = strconv.FormatInt(appFormPage.Groupid, 10) + // sendData["signCode"] = strconv.FormatInt(appFormPage.SignCode, 10) + + // if appFormPage.MastesForm == "" && appFormPage.MastesFormJson == "" { + // sendData["page"] = false + // } else { + // sendData["page"] = true + // } + // if appFormPage.ListJson == "" { + // sendData["pageList"] = false + // } else { + // sendData["pageList"] = true + // } + // sendData["appFlow"] = false + // if appFormPage.FlowIsOpen == 1 { + + // var appFormFlow modelAppPlatform.FlowVersion + // err = appFormFlow.GetCont(map[string]interface{}{"`state`": 1, "`key`": appFormPage.Flowkey}, "`content`") + // if err != nil { + // sendData["workFlow"] = "" + // } else { + // var flowInfor interface{} + // err = json.Unmarshal([]byte(appFormFlow.Content), &flowInfor) + // if err != nil { + // sendData["workFlow"] = "" + // } else { + // sendData["workFlow"] = flowInfor + // sendData["appFlow"] = true + // } + // } + + // } else { + // sendData["workFlow"] = "" + // } + // var fieldList []string + // if appFormPage.TableKey != "" { + // masterFieldAry, mastErr := customerform.ReadDatabaseForm(appFormPage.TableKey) + // if mastErr == nil { + // for _, v := range masterFieldAry { + // if !publicmethod.IsInTrue[string](v.Field, fieldList) { + // fieldList = append(fieldList, v.Field) + // } + // } + // } + // } + // if appFormPage.TableStructure != "" { + // var sunTable map[string]string + // err = json.Unmarshal([]byte(appFormPage.TableStructure), &sunTable) + // if err == nil { + // for _, v := range sunTable { + // sonFieldAry, sunErr := customerform.ReadDatabaseForm(v) + // if sunErr == nil { + // for _, v := range sonFieldAry { + // if !publicmethod.IsInTrue[string](v.Field, fieldList) { + // fieldList = append(fieldList, v.Field) + // } + // } + // } + // } + // } + // } + // sendData["formField"] = fieldList + publicmethod.Result(0, sendData, c) +} diff --git a/api/version1/customerApp/appControll.go b/api/version1/customerApp/appControll.go index 7aabfbe..7431f00 100644 --- a/api/version1/customerApp/appControll.go +++ b/api/version1/customerApp/appControll.go @@ -57,7 +57,7 @@ func (a *ApiMethod) CreateApp(c *gin.Context) { var formInfo modelAppPlatform.CustomerForm formInfo.Name = appName //表单名称"` formInfo.TableNames = appKey //创建表单名称"` - formInfo.Classify = 3 //分类1:表单;2:流程表单;3:应用"` + formInfo.Classify = 3 //分类1:表单;2:流程表单; 3: 应用; 4: 应用中的表单' formInfo.States = 1 //显示状态(1:启用;2:禁用,3:删除)"` formInfo.CreaterTime = createrTime //创建时间"` formInfo.EditTime = createrTime //编辑时间"` @@ -1138,7 +1138,7 @@ func (a *ApiMethod) EditAppPageInfo(c *gin.Context) { cureeTime := time.Now().Unix() mainData := publicmethod.MapOut[string]() mainData["`name`"] = formJsonCont.Form.FormName - mainData["`classify`"] = requestData.Classify + mainData["`classify`"] = requestData.Types mainData["`edit_time`"] = cureeTime if formJsonCont.Config.ImageUrl != "" { mainData["`icon`"] = formJsonCont.Config.ImageUrl @@ -1284,6 +1284,9 @@ func (a *ApiMethod) GainAppPageInfo(c *gin.Context) { publicmethod.Result(105, err, c) return } + + // publicmethod.Result(105, appFormPage, c) + // return sendData := publicmethod.MapOut[string]() sendData["appForm"] = appFormPage sendData["versionId"] = strconv.FormatInt(appFormPage.Id, 10) @@ -1943,3 +1946,65 @@ func (a *ApiMethod) SetCustomerFormState(c *gin.Context) { } publicmethod.Result(0, err, c) } + +/* +* +@ 作者: 秦东 +@ 时间: 2024-08-08 14:01:47 +@ 功能: 编辑APP菜单图标 +@ 参数 + + # + +@ 返回值 + + # + +@ 方法原型 + + # +*/ +func (a *ApiMethod) EditAppMenusIcon(c *gin.Context) { + var requestData EditAppMenuNAme + err := c.ShouldBindJSON(&requestData) + if err != nil { + publicmethod.Result(100, err, c) + return + } + if requestData.Id == "" { + publicmethod.Result(102, err, c) + return + } + if requestData.Label == "" { + publicmethod.Result(102, err, c) + return + } + var oldMenuInfo modelAppPlatform.Appmenus + err = oldMenuInfo.GetCont(map[string]interface{}{"`id`": requestData.Id}, "`id`", "`svg`", "`type`", `appkey`) + if err != nil { + publicmethod.Result(107, err, c) + return + } + saveMenu := publicmethod.MapOut[string]() + saveMenu["`svg`"] = requestData.Label + saveMenu["`edit_time`"] = time.Now().Unix() + err = oldMenuInfo.EiteCont(map[string]interface{}{"`id`": requestData.Id}, saveMenu) + if err != nil { + publicmethod.Result(106, err, c) + return + } + editForm := publicmethod.MapOut[string]() + var cusForm modelAppPlatform.CustomerForm + var newAppMenuJson []AppMenuTree + syncSeting.Add(1) + newAppMenuJson = GainAppMenuTree(oldMenuInfo.Appkey) + syncSeting.Wait() + menuTreeJson, _ := json.Marshal(newAppMenuJson) + editForm["listjson"] = string(menuTreeJson) + editForm["edit_time"] = time.Now().Unix() + cusForm.EiteCont(map[string]interface{}{"`signCode`": oldMenuInfo.Appkey}, editForm) + + // + + publicmethod.Result(0, err, c) +} diff --git a/api/version1/customerform/analysis_table.go b/api/version1/customerform/analysis_table.go index 955b77b..5591fc5 100644 --- a/api/version1/customerform/analysis_table.go +++ b/api/version1/customerform/analysis_table.go @@ -529,12 +529,30 @@ func (t *TableFormUnit) AnalysisTableFormUnitAttribute(tablename string, subUnit t.AnalysisTableFormUnitAttribute(tablename, v.List) } default: + t.Sort++ 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 //开关的关值 + unitCont.Sort = t.Sort + switch v.Type { + case "select": + unitCont.Auxiliary = v.Control.Multiple + case "datePicker": + unitCont.Auxiliary = v.Control.Type + case "upload": + unitCont.Auxiliary = v.Control.ListType + case "lowcodeCarsusel": + unitCont.CarsuselConfigArr = v.Control.CarsuselConfigArr + case "lowcodeImage": + unitCont.FilePath = v.Control.ImgUrl + case "videoUpAndPlay": + fmt.Printf("videoUpAndPlay----->%v\n", v.Control) + unitCont.VideoList = v.Control.VideoMsg + default: + } for _, v := range v.Options { var optVal OptionsList optVal.Label = v.Label diff --git a/api/version1/customerform/datatable.go b/api/version1/customerform/datatable.go index 23eaf75..8220c9d 100644 --- a/api/version1/customerform/datatable.go +++ b/api/version1/customerform/datatable.go @@ -207,7 +207,6 @@ func (a *ApiMethod) HaveFormTabelCont(c *gin.Context) { } var formJsonCont CustomerFormMaster err = json.Unmarshal([]byte(versionCont.MastesFormJson), &formJsonCont) - masterForm, sunForm := AnalyseFormTableJson(formJsonCont) formStruct, err := ReadDatabaseForm(requestData.Name) if err != nil { diff --git a/api/version1/customerform/formTable.go b/api/version1/customerform/formTable.go index 0c61b6a..753a3be 100644 --- a/api/version1/customerform/formTable.go +++ b/api/version1/customerform/formTable.go @@ -630,13 +630,19 @@ func (a *ApiMethod) GainTableField(c *gin.Context) { } masterTable, err := GainFormTableField(customerFormMaster.TableKey) - if err != nil { - publicmethod.Result(1, err, c, "未知表单!无法获取字段!") - return - } sendTableList := publicmethod.MapOut[string]() sendTableList["masterTableName"] = customerFormMaster.Name sendTableList["masterTable"] = masterTable + if err != nil { + if customerFormMaster.MastesForm != "" { + publicmethod.Result(0, sendTableList, c) + } else { + publicmethod.Result(1, err, c, "未知表单!无法获取字段!") + } + + return + } + if customerFormMaster.TableStructure != "" { //判断是否有主体子表单 var sunTable map[string]interface{} err = json.Unmarshal([]byte(customerFormMaster.TableStructure), &sunTable) @@ -683,17 +689,42 @@ func (a *ApiMethod) GainFormTableField(c *gin.Context) { return } var customerFormMaster modelAppPlatform.CustomerFormView - err = customerFormMaster.GetCont(map[string]interface{}{"`cfid`": requestData.Id, "`status`": 1}, "`tablekey`", "`table_structure`", "`mastesform`", "`mastesformjson`") + err = customerFormMaster.GetCont(map[string]interface{}{"`cfid`": requestData.Id, "`status`": 1}, "`tablekey`", "`table_structure`", "`mastesform`", "`mastesformjson`", "`listjson`") if err != nil { publicmethod.Result(1, err, c, "未知表单!无法获取字段!") return } - - masterTable, err := GainFormTableField(customerFormMaster.TableKey) + var masterTable []Result + var listFieldsMap ListPageFields + if customerFormMaster.ListJson != "" { + + json.Unmarshal([]byte(customerFormMaster.ListJson), &listFieldsMap) + fmt.Printf("判断结果%v", JhudgeIsTitle(listFieldsMap)) + if JhudgeIsTitle(listFieldsMap) { + var myKeyWord Result + myKeyWord.Field = "_lableTitle" + myKeyWord.Type = "varchar(255)" + myKeyWord.Attribute = "" + myKeyWord.Collation = "utf8mb4_bin" + myKeyWord.Null = "YES" + myKeyWord.Key = "" + myKeyWord.Default = "" + myKeyWord.Extra = "" + myKeyWord.Privileges = "select,insert,update,references" + myKeyWord.Comment = "标题" + myKeyWord.Pattern = "varchar" + myKeyWord.Classify = "" + masterTable = append(masterTable, myKeyWord) + } + } + masterTableAll, err := GainFormTableField(customerFormMaster.TableKey) + masterTable = append(masterTable, masterTableAll...) if err != nil { publicmethod.Result(1, err, c, "未知表单!无法获取字段!") return } + // jhjs, _ := json.Marshal(masterTable) + // fmt.Printf("jhjs--------------->\n%v\n", string(jhjs)) var unitCont map[string]interface{} json.Unmarshal([]byte(customerFormMaster.MastesFormJson), &unitCont) @@ -709,6 +740,7 @@ func (a *ApiMethod) GainFormTableField(c *gin.Context) { if len(formFieldAry.MasterInfo) > 0 { sendTableList["masterTable"] = TableFieldCompare(masterTable, formFieldAry.MasterInfo) } else { + sendTableList["masterTable"] = masterTable } @@ -739,16 +771,11 @@ func (a *ApiMethod) GainFormTableField(c *gin.Context) { publicmethod.Result(0, sendTableList, c) } -// 获取子表表单数据 -func GainSunFormTableField(tableName string, SunFormInfo []SunFormFieldInfoList) (fieldList []FormFieldInfo) { - return -} - /* * @ 作者: 秦东 -@ 时间: 2024-03-25 09:01:12 -@ 功能: 表单数据对照 +@ 时间: 2024-07-25 09:46:13 +@ 功能: 判断是否有标题 @ 参数 # @@ -761,116 +788,184 @@ func GainSunFormTableField(tableName string, SunFormInfo []SunFormFieldInfoList) # */ -func TableFieldCompare(tableFieldList []Result, jsonFieldList []FormFieldInfo) (fieldList []FormFieldInfo) { - if len(tableFieldList) > 0 { - if len(jsonFieldList) > 0 { - var writeTableField []string - for _, tv := range tableFieldList { - for _, jv := range jsonFieldList { - if tv.Field == jv.Id { - if !publicmethod.IsInTrue[string](tv.Field, writeTableField) { - writeTableField = append(writeTableField, tv.Field) - } - var fieldInfo FormFieldInfo - fieldInfo.Id = jv.Id - if tv.Comment == "" { - fieldInfo.Label = jv.Label - } else { - fieldInfo.Label = tv.Comment - } +func JhudgeIsTitle(listFieldsMap ListPageFields) bool { - fieldInfo.Field = tv.Field //field"` + if listView, isOk := listFieldsMap.View["list"]; isOk { + fmt.Printf("判断是否有标题--->%v--->%v\n", listView, len(listView.Form.Title)) + if len(listView.Form.Title) > 0 { + return true + } + } + return false +} - attFiled := strings.Split(tv.Type, " ") - fmt.Printf("attFiled---->%v=========>%v\n", tv.Type, attFiled) - if len(attFiled) > 0 { - fieldInfo.Types = attFiled[0] - } - if len(attFiled) >= 2 { - fieldInfo.Attribute = attFiled[1] - } +// 获取子表表单数据 +func GainSunFormTableField(tableName string, SunFormInfo []SunFormFieldInfoList) (fieldList []FormFieldInfo) { + return +} - patternInfo := strings.Split(tv.Type, "(") - if len(patternInfo) >= 1 { - fieldInfo.Pattern = patternInfo[0] - } +/* +* +@ 作者: 秦东 +@ 时间: 2024-03-25 09:01:12 +@ 功能: 表单数据对照 +@ 参数 - fieldInfo.FieldClass = jv.FieldClass //fieldClass"` - fieldInfo.ActiveValue = jv.ActiveValue //activeValue"` - fieldInfo.InactiveValue = jv.InactiveValue //inactiveValue"` - fieldInfo.Options = jv.Options //options"` - fieldInfo.Control = jv.Control //control"` - fieldInfo.Config = jv.Config //config"` - fieldList = append(fieldList, fieldInfo) - } - } - } - if len(writeTableField) > 0 { - for _, tv := range tableFieldList { - if !publicmethod.IsInTrue[string](tv.Field, writeTableField) { - var fieldInfo FormFieldInfo - fieldInfo.Id = tv.Field - if tv.Comment == "" { - fieldInfo.Label = tv.Field - } else { - fieldInfo.Label = tv.Comment - } + # - fieldInfo.Field = tv.Field //field"` +@ 返回值 - attFiled := strings.Split(tv.Type, " ") - if len(attFiled) > 0 { - fieldInfo.Types = attFiled[0] - } - if len(attFiled) >= 2 { - fieldInfo.Attribute = attFiled[1] + # - } - patternInfo := strings.Split(tv.Type, "(") - if len(patternInfo) >= 1 { - fieldInfo.Pattern = patternInfo[0] - } +@ 方法原型 - fieldInfo.FieldClass = tv.Field //fieldClass"` - // fieldInfo.ActiveValue = v. //activeValue"` - // fieldInfo.InactiveValue = v. //inactiveValue"` - // fieldInfo.Options = v. //options"` + # +*/ +func TableFieldCompare(tableFieldList []Result, jsonFieldList []FormFieldInfo) (fieldList []FormFieldInfo) { - fieldList = append(fieldList, fieldInfo) - } - } - for _, jv := range jsonFieldList { - if !publicmethod.IsInTrue[string](jv.Id, writeTableField) { - fieldList = append(fieldList, jv) - } - } - } - } else { - for _, v := range tableFieldList { - var fieldInfo FormFieldInfo - fieldInfo.Id = v.Field - fieldInfo.Label = v.Comment - fieldInfo.Field = v.Field //field"` + tableFieldListsdf, _ := json.Marshal(tableFieldList) + jsonFieldListsdf, _ := json.Marshal(jsonFieldList) + fmt.Printf("\n=====================================================\n") + fmt.Printf("tableFieldListsdf:%v\n", string(tableFieldListsdf)) + fmt.Printf("jsonFieldListsdf:%v\n", string(jsonFieldListsdf)) + fmt.Printf("\n=====================================================\n") + if len(tableFieldList) > 0 { + for _, v := range tableFieldList { + if v.Field == "_lableTitle" { + var titleInfo FormFieldInfo + titleInfo.Id = v.Field + titleInfo.Label = v.Comment + titleInfo.Field = v.Field attFiled := strings.Split(v.Type, " ") + // fmt.Printf("attFiled---->%v=========>%v\n", v.Type, attFiled) + if len(attFiled) > 0 { + titleInfo.Types = attFiled[0] + } if len(attFiled) >= 2 { - fieldInfo.Attribute = attFiled[1] - fieldInfo.Types = attFiled[0] - + titleInfo.Attribute = attFiled[1] } patternInfo := strings.Split(v.Type, "(") if len(patternInfo) >= 1 { - fieldInfo.Pattern = patternInfo[0] + titleInfo.Pattern = patternInfo[0] } - // fieldInfo.FieldClass = v. //fieldClass"` - // fieldInfo.ActiveValue = v. //activeValue"` - // fieldInfo.InactiveValue = v. //inactiveValue"` - // fieldInfo.Options = v. //options"` - - fieldList = append(fieldList, fieldInfo) + titleInfo.FieldClass = v.Field + titleInfo.ActiveValue = "" + titleInfo.InactiveValue = "" + fieldList = append(fieldList, titleInfo) + } else { + fieldList = append(fieldList, TableFormAttribute(v, jsonFieldList)) } } + // if len(jsonFieldList) > 0 { + // var writeTableField []string + // for _, tv := range tableFieldList { + // for _, jv := range jsonFieldList { + // if tv.Field == jv.Id { + // if !publicmethod.IsInTrue[string](tv.Field, writeTableField) { + // writeTableField = append(writeTableField, tv.Field) + // } + // var fieldInfo FormFieldInfo + // fieldInfo.Id = jv.Id + // if tv.Comment == "" { + // fieldInfo.Label = jv.Label + // } else { + // fieldInfo.Label = tv.Comment + // } + + // fieldInfo.Field = tv.Field //field"` + + // attFiled := strings.Split(tv.Type, " ") + // // fmt.Printf("attFiled---->%v=========>%v\n", tv.Type, jv.Auxiliary) + // if len(attFiled) > 0 { + // fieldInfo.Types = attFiled[0] + // } + // if len(attFiled) >= 2 { + // fieldInfo.Attribute = attFiled[1] + // } + + // patternInfo := strings.Split(tv.Type, "(") + // if len(patternInfo) >= 1 { + // fieldInfo.Pattern = patternInfo[0] + // } + // fieldInfo.Auxiliary = jv.Auxiliary + // fieldInfo.FieldClass = jv.FieldClass //fieldClass"` + // fieldInfo.ActiveValue = jv.ActiveValue //activeValue"` + // fieldInfo.InactiveValue = jv.InactiveValue //inactiveValue"` + // fieldInfo.Options = jv.Options //options"` + // fieldInfo.Control = jv.Control //control"` + // fieldInfo.Config = jv.Config //config"` + // fieldList = append(fieldList, fieldInfo) + // } + // } + // } + // if len(writeTableField) > 0 { + // for _, tv := range tableFieldList { + // if !publicmethod.IsInTrue[string](tv.Field, writeTableField) { + // var fieldInfo FormFieldInfo + // fieldInfo.Id = tv.Field + // if tv.Comment == "" { + // fieldInfo.Label = tv.Field + // } else { + // fieldInfo.Label = tv.Comment + // } + + // fieldInfo.Field = tv.Field //field"` + + // attFiled := strings.Split(tv.Type, " ") + // if len(attFiled) > 0 { + // fieldInfo.Types = attFiled[0] + // } + // if len(attFiled) >= 2 { + // fieldInfo.Attribute = attFiled[1] + + // } + // patternInfo := strings.Split(tv.Type, "(") + // if len(patternInfo) >= 1 { + // fieldInfo.Pattern = patternInfo[0] + // } + + // fieldInfo.FieldClass = tv.Field //fieldClass"` + // // fieldInfo.ActiveValue = v. //activeValue"` + // // fieldInfo.InactiveValue = v. //inactiveValue"` + // // fieldInfo.Options = v. //options"` + + // fieldList = append(fieldList, fieldInfo) + // } + // } + // for _, jv := range jsonFieldList { + // if !publicmethod.IsInTrue[string](jv.Id, writeTableField) { + // fieldList = append(fieldList, jv) + // } + // } + // } + // } else { + // for _, v := range tableFieldList { + // var fieldInfo FormFieldInfo + // fieldInfo.Id = v.Field + // fieldInfo.Label = v.Comment + // fieldInfo.Field = v.Field //field"` + + // attFiled := strings.Split(v.Type, " ") + // if len(attFiled) >= 2 { + // fieldInfo.Attribute = attFiled[1] + // fieldInfo.Types = attFiled[0] + + // } + + // patternInfo := strings.Split(v.Type, "(") + // if len(patternInfo) >= 1 { + // fieldInfo.Pattern = patternInfo[0] + // } + // // fieldInfo.FieldClass = v. //fieldClass"` + // // fieldInfo.ActiveValue = v. //activeValue"` + // // fieldInfo.InactiveValue = v. //inactiveValue"` + // // fieldInfo.Options = v. //options"` + + // fieldList = append(fieldList, fieldInfo) + // } + // } } else { fieldList = jsonFieldList } @@ -987,10 +1082,13 @@ func (f *FormJsonFieldInfo) AnalyzingFormJson(tableName string, unitList []inter if unitTypeStr, ok := unitType.(string); ok { unitInfo.FieldClass = unitTypeStr } - // fmt.Printf("unitList---->%T====>%v\n", listInfo["control"], listInfo["control"]) + // fmt.Printf("unitListt---->%v---->%T====>%v\n",unitType, listInfo["control"]) if controlVal, ok := listInfo["control"]; ok { // fmt.Printf("unitList--123-->%T====>%v\n", controlVal, controlVal) if controlMap, ok := controlVal.(map[string]interface{}); ok { + + // fmt.Printf("unitList--450-->%T====>%v\n", controlMap["type"], controlMap["type"]) + if activeVal, ok := controlMap["activeValue"]; ok { if activeValStr, ok := activeVal.(string); ok { unitInfo.ActiveValue = activeValStr @@ -1001,7 +1099,12 @@ func (f *FormJsonFieldInfo) AnalyzingFormJson(tableName string, unitList []inter unitInfo.InactiveValue = InactiveValStr } } - + if typeVal, ok := controlMap["type"]; ok { + if typeValStr, ok := typeVal.(string); ok { + unitInfo.Auxiliary = typeValStr + // fmt.Printf("unitList--450-->%T====>%v\n", typeValStr, typeValStr) + } + } // fmt.Printf("unitList--5656-->%T====>%v\n", controlMap["optionsValue3Formid"], controlMap["optionsValue3Formid"]) // fmt.Printf("unitList--7788-->%T====>%v\n", controlMap["optionsValue3Field"], controlMap["optionsValue3Field"]) @@ -1031,7 +1134,7 @@ func (f *FormJsonFieldInfo) AnalyzingFormJson(tableName string, unitList []inter if configVal, ok := listInfo["config"]; ok { if configMap, ok := configVal.(map[string]interface{}); ok { if configMApVal, ok := configMap["optionsType"]; ok { - fmt.Printf("optvMap---->%T====>%v\n", configMApVal, configMApVal) + // fmt.Printf("optvMap---->%T====>%v\n", configMApVal, configMApVal) if configMApValStr, ok := configMApVal.(float64); ok { unitInfo.Config.OptionsType = configMApValStr } @@ -1062,8 +1165,8 @@ func (f *FormJsonFieldInfo) AnalyzingFormJson(tableName string, unitList []inter } } fieldInfo = append(fieldInfo, unitInfo) - fmt.Printf("unitInfo--1->:%v\n", unitInfo) - fmt.Printf("fieldInfo-2->:%v\n", fieldInfo) + // fmt.Printf("unitInfo--1->:%v\n", unitInfo) + // fmt.Printf("fieldInfo-2->:%v\n", fieldInfo) } } } @@ -1273,27 +1376,31 @@ func (a *ApiMethod) GainFormPageListCont(c *gin.Context) { formList[i]["isRetract"] = false if mastrKey, ok := v["runFlowId"]; ok { // fmt.Printf("masters_key----------->%v\n", v["masters_key"]) - var runFlowInfo customerForm.RunWorkflow - runFlowInfo.GetCont(map[string]interface{}{"`id`": mastrKey}, "`id`", "`current_step`", "`next_step`") - formList[i]["runFlowInfo"] = runFlowInfo.Id - // 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 { - - if runFlowInfo.CurrentStep == 1 { - if createrName, ok := formList[i]["creater"].(string); ok { - if createrName == userCont.Name { - formList[i]["isRetract"] = true + mastrKeyInt, _ := publicmethod.StringToInt64(mastrKey) + if mastrKeyInt != 0 { + var runFlowInfo customerForm.RunWorkflow + runFlowInfo.GetCont(map[string]interface{}{"`id`": mastrKey}, "`id`", "`current_step`", "`next_step`") + formList[i]["runFlowInfo"] = runFlowInfo.Id + // 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 { + + if runFlowInfo.CurrentStep == 1 { + if createrName, ok := formList[i]["creater"].(string); ok { + if createrName == userCont.Name { + formList[i]["isRetract"] = true + } } - } + } } } - } + } } + } if mastrKeyVal, ok := v["masters_key"]; ok { // fmt.Printf("mastrKeyVal----------->%T----------->%v\n", mastrKeyVal, mastrKeyVal) @@ -1318,7 +1425,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) + switch mi { case "creater": var myInfo modelshr.PersonArchives @@ -1334,6 +1441,135 @@ func (l *ListPageFields) DevelopSpecificationsSend(listData []map[string]interfa sendInfo[mi] = l.BaseTableAttrField(mi, mv) // sendInfo[mi] = publicmethod.TypeToInterface(mv) } + for _, lv := range l.TableData.Columns { + if lv.FieldClass != "-" && lv.FieldClass != "_lableTitle" && lv.FieldClass != "__control" { + if lv.Id == mi { + + switch lv.FieldClass { + case "radio": + for _, ov := range lv.Options { + // fmt.Printf("%T = %v\n", mv, mv) + + radioId := publicmethod.TypeToInterface(mv) + if radioId == ov.Value { + sendInfo[mi] = ov.Label + } + + // if radioId, isOk := mv.(int64); isOk { + // radioIdStr := strconv.FormatInt(radioId, 10) + + // if radioIdStr == ov.Value { + // sendInfo[mi] = ov.Label + // } + // } + // if radioId, isOk := mv.(string); isOk { + // if radioId == ov.Value { + // sendInfo[mi] = ov.Label + // } + // } + } + case "datePicker": + var beginTime string + timeVal, _ := publicmethod.StringToInt64(mv) + // if isOk == nil { + // beginTime = timeVal + // sendInfo[mi] = publicmethod.UnixTimeToDay(timeVal/1000, 14) + // } + + switch lv.Auxiliary { + case "year": + sendInfo[mi] = publicmethod.UnixTimeToDay(timeVal/1000, 16) + case "month": + sendInfo[mi] = publicmethod.UnixTimeToDay(timeVal/1000, 15) + case "datetime": + sendInfo[mi] = publicmethod.UnixTimeToDay(timeVal/1000, 11) + case "week": + sendInfo[mi] = publicmethod.UnixTimeToDay(timeVal/1000, 41) + case "datetimerange": + beginTime = publicmethod.UnixTimeToDay(timeVal/1000, 11) + sendInfo[mi] = beginTime + endKey := fmt.Sprintf("%v_end", mi) + if v[endKey] != nil { + endTimeVal, _ := publicmethod.StringToInt64(v[endKey]) + sendInfo[mi] = fmt.Sprintf("%v - %v", beginTime, publicmethod.UnixTimeToDay(int64(endTimeVal)/1000, 11)) + } + case "daterange": + beginTime = publicmethod.UnixTimeToDay(timeVal/1000, 14) + sendInfo[mi] = beginTime + endKey := fmt.Sprintf("%v_end", mi) + if v[endKey] != nil { + endTimeVal, _ := publicmethod.StringToInt64(v[endKey]) + sendInfo[mi] = fmt.Sprintf("%v - %v", beginTime, publicmethod.UnixTimeToDay(int64(endTimeVal)/1000, 14)) + } + case "monthrange": + beginTime = publicmethod.UnixTimeToDay(timeVal/1000, 15) + sendInfo[mi] = beginTime + endKey := fmt.Sprintf("%v_end", mi) + if v[endKey] != nil { + endTimeVal, _ := publicmethod.StringToInt64(v[endKey]) + sendInfo[mi] = fmt.Sprintf("%v - %v", beginTime, publicmethod.UnixTimeToDay(int64(endTimeVal)/1000, 15)) + } + default: + beginTime = publicmethod.UnixTimeToDay(timeVal/1000, 14) + sendInfo[mi] = beginTime + endKey := fmt.Sprintf("%v_end", mi) + if v[endKey] != nil { + endTimeVal, _ := publicmethod.StringToInt64(v[endKey]) + sendInfo[mi] = fmt.Sprintf("%v - %v", beginTime, publicmethod.UnixTimeToDay(int64(endTimeVal)/1000, 14)) + } + } + case "timePicker": + if timeVal, isOk := mv.(int64); isOk { + sendInfo[mi] = publicmethod.UnixTimeToDay(timeVal/1000, 6) + } + case "deptOrg": + var orgCont modelshr.AdministrativeOrganization + orgCont.GetCont(map[string]interface{}{"`id`": mv}, "`name`") + sendInfo[mi] = orgCont.Name + case "owner": + var userInfo modelshr.PersonArchives + userInfo.GetCont(map[string]interface{}{"`key`": mv}, "`name`", "`number`") + sendInfo[mi] = fmt.Sprintf("%v(%v)", userInfo.Name, userInfo.Number) + case "expand-user": + var userAry []string + jsonStr := publicmethod.TypeToInterface(mv) + json.Unmarshal([]byte(jsonStr), &userAry) + sendInfo[mi] = strings.Join(userAry, " , ") + case "select": + var sendInfp []string + if mv != nil { + fmt.Printf("Step1:\n") + valStr := publicmethod.TypeToInterface(mv) + var valAry []int64 + json.Unmarshal([]byte(valStr), &valAry) + if len(valAry) > 0 { + for _, vv := range valAry { + for _, v := range lv.Options { + vvStr := strconv.FormatInt(vv, 10) + if v.Value == vvStr { + fmt.Printf("Step2:\n") + sendInfp = append(sendInfp, v.Label) + } + } + } + + } else { + fmt.Printf("Step3:\n") + for _, v := range lv.Options { + if v.Value == valStr { + fmt.Printf("Step4:\n") + sendInfp = append(sendInfp, v.Label) + } + } + } + sendInfo[mi] = strings.Join(sendInfp, " , ") + + } + default: + } + } + } + } } // fmt.Printf("================================\n") sendList = append(sendList, sendInfo) @@ -1389,6 +1625,38 @@ func (l *ListPageFields) BaseTableAttrField(key string, val interface{}) interfa if len(mapAry) > 0 { return mapAry[0] } + case "select": + var sendInfp []string + if val != nil { + + valStr := publicmethod.TypeToInterface(val) + var valAry []int64 + json.Unmarshal([]byte(valStr), &valAry) + if len(valAry) > 0 { + for _, vv := range valAry { + for _, v := range v.Options { + vvStr := strconv.FormatInt(vv, 10) + if v.Value == vvStr { + + sendInfp = append(sendInfp, v.Label) + } + } + } + + } else { + + for _, v := range v.Options { + if v.Value == valStr { + + sendInfp = append(sendInfp, v.Label) + } + } + } + selectVal := strings.Join(sendInfp, " , ") + + return selectVal + } + default: return publicmethod.TypeToInterface(val) } @@ -1445,17 +1713,96 @@ func AnalysisSerachTermSql(why string, gormDb *gorm.DB) *gorm.DB { } for _, v := range listField { if v.Values != nil && v.Values != "" && v.Values != "" { - switch v.Pattern { - case "int": - likeSql := fmt.Sprintf("f.`%v` = %v", v.Field, v.Values) - gormDb = gormDb.Where(likeSql) - case "bigint": - likeSql := fmt.Sprintf("f.`%v` = %v", v.Field, v.Values) - gormDb = gormDb.Where(likeSql) - default: - likeSql := fmt.Sprintf("f.%v LIKE %v%v%v", v.Field, "'%", v.Values, "%'") + if v.FieldClass == "datePicker" { + switch v.Auxiliary { + case "year": + mvInt, _ := publicmethod.StringToInt64(v.Values) + likeSql := fmt.Sprintf("f.`%v` = %v", v.Field, mvInt) + gormDb = gormDb.Where(likeSql) + case "month": + mvInt, _ := publicmethod.StringToInt64(v.Values) + likeSql := fmt.Sprintf("f.`%v` = %v", v.Field, mvInt) + gormDb = gormDb.Where(likeSql) + case "date": + mvInt, _ := publicmethod.StringToInt64(v.Values) + likeSql := fmt.Sprintf("f.`%v` = %v", v.Field, mvInt) + gormDb = gormDb.Where(likeSql) + case "datetime": + mvInt, _ := publicmethod.StringToInt64(v.Values) + likeSql := fmt.Sprintf("f.`%v` = %v", v.Field, mvInt) + gormDb = gormDb.Where(likeSql) + case "week": + mvInt, _ := publicmethod.StringToInt64(v.Values) + likeSql := fmt.Sprintf("f.`%v` = %v", v.Field, mvInt) + gormDb = gormDb.Where(likeSql) + case "datetimerange": + + if val, isOk := v.Values.([]interface{}); isOk { + if len(val) >= 2 { + starVal, _ := publicmethod.StringToInt64(val[0]) + endVal, _ := publicmethod.StringToInt64(val[len(val)-1]) + likeSql := fmt.Sprintf("f.`%v` >= %v AND f.`%v_end` <= %v", v.Field, starVal, v.Field, endVal) + gormDb = gormDb.Where(likeSql) + } + } + + // likeSql := fmt.Sprintf("f.`%v` >= %v AND f.`%v_end` <= %v", v.Field, v.Values, v.Field, v.Values) + // gormDb = gormDb.Where(likeSql) + case "daterange": + // likeSql := fmt.Sprintf("f.`%v` >= %v AND f.`%v_end` <= %v", v.Field, v.Values, v.Field, v.Values) + // gormDb = gormDb.Where(likeSql) + if val, isOk := v.Values.([]interface{}); isOk { + if len(val) >= 2 { + starVal, _ := publicmethod.StringToInt64(val[0]) + endVal, _ := publicmethod.StringToInt64(val[len(val)-1]) + likeSql := fmt.Sprintf("f.`%v` >= %v AND f.`%v_end` <= %v", v.Field, starVal, v.Field, endVal) + gormDb = gormDb.Where(likeSql) + } + } + case "monthrange": + // likeSql := fmt.Sprintf("f.`%v` >= %v AND f.`%v_end` <= %v", v.Field, v.Values, v.Field, v.Values) + // gormDb = gormDb.Where(likeSql) + if val, isOk := v.Values.([]interface{}); isOk { + if len(val) >= 2 { + starVal, _ := publicmethod.StringToInt64(val[0]) + endVal, _ := publicmethod.StringToInt64(val[len(val)-1]) + likeSql := fmt.Sprintf("f.`%v` >= %v AND f.`%v_end` <= %v", v.Field, starVal, v.Field, endVal) + gormDb = gormDb.Where(likeSql) + } + } + default: + } + } else if v.FieldClass == "timePicker" { + mvInt, _ := publicmethod.StringToInt64(v.Values) + likeSql := fmt.Sprintf("f.`%v` = %v", v.Field, mvInt) gormDb = gormDb.Where(likeSql) + } else if v.FieldClass == "_lableTitle" { + + } else { + isWrint := true + if val, isOk := v.Values.([]interface{}); isOk { + isWrint = false + if len(val) > 0 { + + likeSql := fmt.Sprintf("f.`%v` IN %v", v.Field, val) + gormDb = gormDb.Where(likeSql) + } + } + if isWrint { + switch v.Pattern { + case "int": + likeSql := fmt.Sprintf("f.`%v` = %v", v.Field, v.Values) + gormDb = gormDb.Where(likeSql) + case "bigint": + likeSql := fmt.Sprintf("f.`%v` = %v", v.Field, v.Values) + gormDb = gormDb.Where(likeSql) + default: + likeSql := fmt.Sprintf("f.%v LIKE %v%v%v", v.Field, "'%", v.Values, "%'") + gormDb = gormDb.Where(likeSql) + } + } } + } } return gormDb diff --git a/api/version1/customerform/formTableView.go b/api/version1/customerform/formTableView.go index 12969ef..53f3b54 100644 --- a/api/version1/customerform/formTableView.go +++ b/api/version1/customerform/formTableView.go @@ -353,7 +353,7 @@ func (l *ListPageFields) GainStartOrEndTime(listData []map[string]interface{}, v } tianShu, _ := publicmethod.DayBetweenDate(publicmethod.UnixTimeToDay(startTime, 14), publicmethod.UnixTimeToDay(endTime, 14)) - fmt.Printf("天数: %v\n", tianShu) + // fmt.Printf("天数: %v\n", tianShu) if viewCalss.Sort == 1 { beginTime := publicmethod.TimeUnixToTime(startTime, "s") for i := 0; i <= tianShu; i++ { @@ -466,7 +466,7 @@ func (l *ListPageFields) DaBaoShuJu(sortWord string, startTime, endTime int64, l v[mi] = publicmethod.UnixTimeToDay(timeInt, 11) } default: - _, v[mi] = l.BaseTableAttrViewField(mi, mv) + _, v[mi] = l.BaseTableAttrViewField(mi, mv, v) // sendInfo[mi] = publicmethod.TypeToInterface(mv) } @@ -522,7 +522,7 @@ func (l *ListPageFields) DevelopSpecificViewSend(listData []map[string]interface // // sendInfo[mi] = publicmethod.TypeToInterface(mv) // } - key, val := l.BaseTableAttrViewField(mi, mv) + key, val := l.BaseTableAttrViewField(mi, mv, v) if key != "" { sendInfo[key] = val } @@ -539,7 +539,7 @@ func (l *ListPageFields) DevelopSpecificViewSend(listData []map[string]interface @ 时间: 2024-04-02 11:42:20 @ 功能: 根据字段显示格式处理数据(字段) */ -func (l *ListPageFields) BaseTableAttrViewField(key string, val interface{}) (string, interface{}) { +func (l *ListPageFields) BaseTableAttrViewField(key string, val interface{}, listData map[string]interface{}) (string, interface{}) { // fmt.Printf("根据字段显示格式处理数据(字段):%v==1==>%v\n", key, len(l.TableData.Columns)) if len(l.TableData.Columns) < 0 { return "", val @@ -548,7 +548,7 @@ func (l *ListPageFields) BaseTableAttrViewField(key string, val interface{}) (st for _, v := range l.TableData.Columns { // fmt.Printf("根据字段显示格式处理数据(字段):%v====>%v\n", key, v.Id) if v.Id == key { - // fmt.Printf("根据字段显示格式处理数据(字段):%v\n", v.Label) + // fmt.Printf("根据字段显示格式处理数据(字段):%v----------------->%v\n", v.Label, v.FieldClass) switch v.FieldClass { case "checkbox": if val != nil { @@ -585,6 +585,104 @@ func (l *ListPageFields) BaseTableAttrViewField(key string, val interface{}) (st if len(mapAry) > 0 { return v.Label, mapAry[0] } + case "radio": + for _, ov := range v.Options { + // fmt.Printf("%T = %v\n", mv, mv) + radioId := publicmethod.TypeToInterface(val) + if radioId == ov.Value { + // sendInfo[mi] = ov.Label + return v.Label, ov.Label + } + // if radioId, isOk := val.(int64); isOk { + // radioIdStr := strconv.FormatInt(radioId, 10) + // if radioIdStr == ov.Value { + // // sendInfo[mi] = ov.Label + // return v.Label, ov.Label + // } + // } + // if radioId, isOk := val.(string); isOk { + // if radioId == ov.Value { + // // sendInfo[mi] = ov.Label + // return v.Label, ov.Label + // } + // } + } + case "timePicker": + if timeVal, isOk := val.(int64); isOk { + return v.Label, publicmethod.UnixTimeToDay(timeVal/1000, 6) + } + case "datePicker": + // var beginTime int64 + // if timeVal, isOk := val.(int64); isOk { + // beginTime = timeVal + // // return v.Label, publicmethod.UnixTimeToDay(timeVal/1000, 14) + // } + // endKey := fmt.Sprintf("%v_end", v.Field) + + // // fmt.Printf("v.Label===>%v =%v = %v=====>%v = %v\n", v, endKey, beginTime, v, listData[endKey]) + // if listData[endKey] != nil { + // // fmt.Printf("%T = %v\n", v[endKey], v[endKey]) + // if endTimeVal, isOk := listData[endKey].(uint64); isOk { + // return v.Label, fmt.Sprintf("%v - %v", publicmethod.UnixTimeToDay(beginTime/1000, 14), publicmethod.UnixTimeToDay(int64(endTimeVal)/1000, 14)) + // } + // } else { + // return v.Label, publicmethod.UnixTimeToDay(beginTime/1000, 14) + // } + var beginTime string + timeVal, _ := publicmethod.StringToInt64(val) + // if isOk == nil { + // beginTime = timeVal + // sendInfo[mi] = publicmethod.UnixTimeToDay(timeVal/1000, 14) + // } + + switch v.Auxiliary { + case "year": + return v.Label, publicmethod.UnixTimeToDay(timeVal/1000, 16) + case "month": + return v.Label, publicmethod.UnixTimeToDay(timeVal/1000, 15) + case "datetime": + return v.Label, publicmethod.UnixTimeToDay(timeVal/1000, 11) + case "week": + return v.Label, publicmethod.UnixTimeToDay(timeVal/1000, 41) + case "datetimerange": + beginTime = publicmethod.UnixTimeToDay(timeVal/1000, 11) + endKey := fmt.Sprintf("%v_end", v.Field) + if listData[endKey] != nil { + endTimeVal, _ := publicmethod.StringToInt64(listData[endKey]) + return v.Label, fmt.Sprintf("%v - %v", beginTime, publicmethod.UnixTimeToDay(int64(endTimeVal)/1000, 11)) + + } else { + return v.Label, beginTime + } + case "daterange": + beginTime = publicmethod.UnixTimeToDay(timeVal/1000, 14) + endKey := fmt.Sprintf("%v_end", v.Field) + if listData[endKey] != nil { + endTimeVal, _ := publicmethod.StringToInt64(listData[endKey]) + return v.Label, fmt.Sprintf("%v - %v", beginTime, publicmethod.UnixTimeToDay(int64(endTimeVal)/1000, 14)) + } else { + return v.Label, beginTime + } + case "monthrange": + beginTime = publicmethod.UnixTimeToDay(timeVal/1000, 15) + endKey := fmt.Sprintf("%v_end", v.Field) + if listData[endKey] != nil { + endTimeVal, _ := publicmethod.StringToInt64(listData[endKey]) + return v.Label, fmt.Sprintf("%v - %v", beginTime, publicmethod.UnixTimeToDay(int64(endTimeVal)/1000, 15)) + } else { + return v.Label, beginTime + } + default: + beginTime = publicmethod.UnixTimeToDay(timeVal/1000, 14) + endKey := fmt.Sprintf("%v_end", v.Field) + if listData[endKey] != nil { + endTimeVal, _ := publicmethod.StringToInt64(listData[endKey]) + return v.Label, fmt.Sprintf("%v - %v", beginTime, publicmethod.UnixTimeToDay(int64(endTimeVal)/1000, 14)) + } else { + return v.Label, beginTime + } + } + default: return v.Label, publicmethod.TypeToInterface(val) } @@ -810,10 +908,274 @@ func AnalysisSerachTermSqlIng(why []SearchButtonInfo, gormDb *gorm.DB) *gorm.DB likeSql := fmt.Sprintf("f.`%v` = %v", v.Field, v.Values) gormDb = gormDb.Where(likeSql) default: - likeSql := fmt.Sprintf("f.%v LIKE %v%v%v", v.Field, "'%", v.Values, "%'") - gormDb = gormDb.Where(likeSql) + if val, ok := v.Values.([]interface{}); ok { + if len(val) > 0 { + likeSql := fmt.Sprintf("f.%v IN %v", v.Field, val) + gormDb = gormDb.Where(likeSql) + } + } else { + likeSql := fmt.Sprintf("f.%v LIKE %v%v%v", v.Field, "'%", v.Values, "%'") + gormDb = gormDb.Where(likeSql) + } } } } return gormDb } + +/* +* +@ 作者: 秦东 +@ 时间: 2024-07-25 11:44:17 +@ 功能: 获取地图视图内容 +@ 参数 + + # + +@ 返回值 + + # + +@ 方法原型 + + # +*/ +func (a *ApiMethod) GainFormPageMapCont(c *gin.Context) { + var requestData FormPageListAttr + err := c.ShouldBindJSON(&requestData) + if err != nil { + publicmethod.Result(100, err, c) + return + } + if requestData.FormId == "" { + publicmethod.Result(1, err, c, "未知表单!无法获取字段!2") + return + } + if requestData.Page == 0 { + requestData.Page = 1 + } + if requestData.PageSize == 0 { + requestData.Page = 20 + } + context, _ := c.Get(overall.MyContJwt) + var userCont modelshr.ManCont + userCont.GetLoginCont(context) //当前操作人 + var formInfo modelAppPlatform.CustomerFormView + err = formInfo.GetCont(map[string]interface{}{"`cfid`": requestData.FormId, "`status`": 1}, "`tablekey`", "`table_structure`", "`mastesform`", "`mastesformjson`", "`listjson`", "`flowIsOpen`", "`flowkey`") + if err != nil { + publicmethod.Result(1, err, c, "未知表单!无法获取字段!") + return + } + var listFieldsMap ListPageFields + if formInfo.ListJson != "" { + json.Unmarshal([]byte(formInfo.ListJson), &listFieldsMap) + } + // why, err := AnalysisSerachTerm(requestData.SearchData) + // fmt.Printf("why---->%v\n", why) + var formList []map[string]interface{} + // 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,t.runFlowId") + // 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("f.`creater` = ? ", userCont.Key) + gormDb = gormDb.Where("f.`states` BETWEEN ? AND ?", 1, 2) + mapKey := "" + mapSort := "" + sortSet := 1 + if mapSetUp, isOk := listFieldsMap.View["map"]; isOk { + mapKey = mapSetUp.Form.MapWord + mapSort = mapSetUp.Form.SortWord + sortSet = mapSetUp.Form.Sort + if mapKey != "" { + sqlWher := fmt.Sprintf("f.`%v` IS NOT NULL AND f.`%v` <> ''", mapKey, mapKey) + gormDb = gormDb.Where(sqlWher) + } + } + + gormDb = AnalysisSerachTermSql(requestData.SearchData, gormDb) + var total int64 + totalErr := gormDb.Count(&total).Error + if totalErr != nil { + total = 0 + } + + gormDb = publicmethod.PageTurningSettings(gormDb, requestData.Page, requestData.PageSize) + if mapSort != "" { + if sortSet == 1 { + gormDb = gormDb.Order(fmt.Sprintf("f.`%v` DESC", mapSort)) + } else { + gormDb = gormDb.Order(fmt.Sprintf("f.`%v` ASC", mapSort)) + } + } + err = gormDb.Order("f.`id` DESC").Find(&formList).Error + if err != nil && len(formList) < 1 { + publicmethod.Result(0, err, c) + return + } + // for i, _ := range formList { + // // formList[i]["flowIsOpen"] = formInfo.FlowIsOpen + // formList[i]["flowkey"] = strconv.FormatInt(formInfo.Flowkey, 10) + // } + if formInfo.ListJson != "" { + var listFieldsMaps ListPageFields + err = json.Unmarshal([]byte(formInfo.ListJson), &listFieldsMaps) + // fmt.Printf("%T----------->%v----------->%v\n", listFieldsMaps, err, listFieldsMaps) + if err == nil { + // fmt.Printf("%T----------->%v\n", listFieldsMaps, listFieldsMaps) + formList = listFieldsMaps.DevelopSpecificationsSend(formList) + // formList = DevelopSpecificationsSend(formList, listFieldsMap) + } + + } + + //获取任务状态 + for i, v := range formList { + formList[i]["isRetract"] = false + if mastrKey, ok := v["runFlowId"]; ok { + // fmt.Printf("masters_key----------->%v\n", v["masters_key"]) + var runFlowInfo customerForm.RunWorkflow + runFlowInfo.GetCont(map[string]interface{}{"`id`": mastrKey}, "`id`", "`current_step`", "`next_step`") + formList[i]["runFlowInfo"] = runFlowInfo.Id + // 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 { + + if runFlowInfo.CurrentStep == 1 { + if createrName, ok := formList[i]["creater"].(string); ok { + if createrName == userCont.Name { + formList[i]["isRetract"] = true + } + } + + } + } + } + + } + } + if mastrKeyVal, ok := v["masters_key"]; ok { + // fmt.Printf("mastrKeyVal----------->%T----------->%v\n", mastrKeyVal, mastrKeyVal) + if mastrKeyUint64, ok := mastrKeyVal.(uint64); ok { + formList[i]["masters_key"] = strconv.FormatUint(mastrKeyUint64, 10) + } + } + if mapKey != "" { + if mapKeyVal, ok := v[mapKey]; ok { + // fmt.Printf("mapKeyVal----------->%T----------->%v\n", mapKeyVal, mapKeyVal) + if mapStr, isTrue := mapKeyVal.(string); isTrue { + if mapStr != "" { + //山东省泰安市宁阳县华丰镇山东恒信高科能源有限公司内|*@*|117.1499158954855,35.915716939805186 + oneVal := strings.Split(mapStr, "|*@*|") + if len(oneVal) > 0 { + formList[i]["_mapAddress"] = oneVal[0] + if len(oneVal) >= 2 { + latAndLong := strings.Split(oneVal[1], ",") + if len(latAndLong) >= 2 { + formList[i]["_latitude"] = latAndLong[0] + formList[i]["_longitude"] = latAndLong[1] + } + } + } + } + } + + } + } + + } + + // publicmethod.Result(100, formList, c) + publicmethod.ResultList(0, requestData.Page, requestData.PageSize, total, int64(len(formList)), formList, c) +} + +/* +* +@ 作者: 秦东 +@ 时间: 2024-08-02 10:02:25 +@ 功能: 表格字段挂载属性 +@ 参数 + + # + +@ 返回值 + + # + +@ 方法原型 + + # +*/ +func TableFormAttribute(formField Result, tableFieldList []FormFieldInfo) (fieldInfo FormFieldInfo) { + if len(tableFieldList) > 0 { + fieldAry := strings.Split(formField.Field, "_end") + // fmt.Printf("字段数组----->%v----->%v\n", len(fieldAry), fieldAry) + if len(fieldAry) >= 1 { + isWrite := true + for _, v := range tableFieldList { + if fieldAry[0] == v.Id { + isWrite = false + fieldInfo.Id = formField.Field + if formField.Comment == "" { + fieldInfo.Label = v.Label + } else { + fieldInfo.Label = formField.Comment + } + fieldInfo.Field = formField.Field + attFiled := strings.Split(formField.Type, " ") + if len(attFiled) > 0 { + fieldInfo.Types = attFiled[0] + } + if len(attFiled) >= 2 { + fieldInfo.Attribute = attFiled[1] + } + patternInfo := strings.Split(formField.Type, "(") + if len(patternInfo) >= 1 { + fieldInfo.Pattern = patternInfo[0] + } + fieldInfo.Auxiliary = v.Auxiliary + fieldInfo.FieldClass = v.FieldClass //fieldClass"` + fieldInfo.ActiveValue = v.ActiveValue //activeValue"` + fieldInfo.InactiveValue = v.InactiveValue //inactiveValue"` + fieldInfo.Options = v.Options //options"` + fieldInfo.Control = v.Control //control"` + fieldInfo.Config = v.Config //config"` + } + } + if isWrite { + fieldInfo.Id = formField.Field + fieldInfo.Label = formField.Comment + fieldInfo.Field = formField.Field //field"` + attFiled := strings.Split(formField.Type, " ") + if len(attFiled) >= 2 { + fieldInfo.Attribute = attFiled[1] + fieldInfo.Types = attFiled[0] + } + patternInfo := strings.Split(formField.Type, "(") + if len(patternInfo) >= 1 { + fieldInfo.Pattern = patternInfo[0] + } + } + } + } else { + // var fieldInfo FormFieldInfo + fieldInfo.Id = formField.Field + fieldInfo.Label = formField.Comment + fieldInfo.Field = formField.Field //field"` + attFiled := strings.Split(formField.Type, " ") + if len(attFiled) >= 2 { + fieldInfo.Attribute = attFiled[1] + fieldInfo.Types = attFiled[0] + } + patternInfo := strings.Split(formField.Type, "(") + if len(patternInfo) >= 1 { + fieldInfo.Pattern = patternInfo[0] + } + // fieldInfoAry = append(fieldInfoAry, fieldInfo) + } + return +} diff --git a/api/version1/customerform/listField.go b/api/version1/customerform/listField.go index 1e4708d..88e650d 100644 --- a/api/version1/customerform/listField.go +++ b/api/version1/customerform/listField.go @@ -26,12 +26,13 @@ type ViewInfo struct { Form FormInfo `json:"form"` } type FormInfo struct { - StartTime string `json:"startTime"` - EndTime string `json:"endTime"` - DayType int `json:"dayType"` - SortWord string `json:"sortWord"` - Sort int `json:"sort"` - MapWord string `json:"mapWord"` + StartTime string `json:"startTime"` + EndTime string `json:"endTime"` + DayType int `json:"dayType"` + SortWord string `json:"sortWord"` + Sort int `json:"sort"` + MapWord string `json:"mapWord"` + Title []string `json:"title"` } type FormApiInfor struct { Type string `json:"type"` @@ -65,12 +66,18 @@ type controlBtnInfo struct { // 自定义表单组件基本属性 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"` //附件判断值 + Name string `json:"name"` //组件名称 + Key string `json:"key"` //主键识别符 + Class string `json:"class"` //组件分类 + Auxiliary interface{} `json:"auxiliary"` //组件属性 + ActiveValue string `json:"activeValue"` //开关的开值 + InactiveValue string `json:"inactiveValue"` //开关的关值 + Options []OptionsList `json:"options"` //附件判断值 + Value interface{} `json:"value"` //判定值 + Sort int `json:"sort"` //排序 + FilePath string `json:"filePath"` // + CarsuselConfigArr []CarsuselConfigArrInfo `json:"carsuselConfigArr"` // + VideoList []VideoMsgInfo `json:"videoList"` // } type OptionsList struct { Label string `json:"label"` //名称 @@ -80,6 +87,7 @@ type OptionsList struct { type TableFormUnit struct { MasterInfo []UnitAttribute `json:"masterInfo"` //主表组件列表 SunFormInfo []map[string][]UnitAttribute `json:"sunFormInfo"` //子表 + Sort int `json:"sort"` //排序 } type SunFormInfoStruct struct { diff --git a/api/version1/customerform/type.go b/api/version1/customerform/type.go index 7a6d7b3..8089207 100644 --- a/api/version1/customerform/type.go +++ b/api/version1/customerform/type.go @@ -98,33 +98,67 @@ type rulesStruct struct { // 组件控制器 type ControlStruct struct { - Label string `json:"label"` - Type string `json:"type"` - Key string `json:"key"` - ModelValue interface{} `json:"modelValue"` - Placeholder string `json:"placeholder"` //占位内容 - Disabled bool `json:"disabled"` //是否禁用 - Rows int `json:"rows"` //行数(多行文本使用) - Direction string `json:"direction"` // - ContentPosition string `json:"contentPosition"` // - BorderStyle string `json:"borderStyle"` // - Height string `json:"height"` // - Width string `json:"width"` // - ImgUrl string `json:"imgUrl"` // - BlobUrl string `json:"blobUrl"` // - ActiveValue string `json:"activeValue"` // - InactiveValue string `json:"inactiveValue"` // - Max int `json:"max"` // - ColorFormat string `json:"colorFormat"` // - FormAt string `json:"format"` // - Data []string `json:"data"` // - RenderAfterExpand bool `json:"renderAfterExpand"` // - Multiple bool `json:"multiple"` // - Action string `json:"action"` // - ListType string `json:"listType"` // - Name string `json:"name"` // - AppendToBody bool `json:"appendToBody"` // - Clearable bool `json:"clearable"` // + Label string `json:"label"` + Type string `json:"type"` + Key string `json:"key"` + ModelValue interface{} `json:"modelValue"` + Placeholder string `json:"placeholder"` //占位内容 + Disabled bool `json:"disabled"` //是否禁用 + Rows int `json:"rows"` //行数(多行文本使用) + Direction string `json:"direction"` // + ContentPosition string `json:"contentPosition"` // + BorderStyle string `json:"borderStyle"` // + Height string `json:"height"` // + Width string `json:"width"` // + ImgUrl string `json:"imgUrl"` // + BlobUrl string `json:"blobUrl"` // + ActiveValue string `json:"activeValue"` // + InactiveValue string `json:"inactiveValue"` // + Max int `json:"max"` // + ColorFormat string `json:"colorFormat"` // + FormAt string `json:"format"` // + Data []string `json:"data"` // + RenderAfterExpand bool `json:"renderAfterExpand"` // + Multiple bool `json:"multiple"` // + Action string `json:"action"` // + ListType string `json:"listType"` // + Name string `json:"name"` // + AppendToBody bool `json:"appendToBody"` // + Clearable bool `json:"clearable"` // + CarsuselConfigArr []CarsuselConfigArrInfo `json:"carsuselConfigArr"` // + VideoMsg []VideoMsgInfo `json:"videoMsg"` // + Physicspath string `json:"physicspath"` // +} + +// 视频 +type VideoMsgInfo struct { + CreatedAt string `json:"CreatedAt"` + UpdatedAt string `json:"UpdatedAt"` + FileSize int64 `json:"fileSize"` + Id int64 `json:"id"` + Key string `json:"key"` + Name string `json:"name"` + Physicspath string `json:"physicspath"` + Size string `json:"size"` + Tag string `json:"tag"` + Types int `json:"type"` + Url string `json:"url"` + VideoReady bool `json:"videoReady"` + VideoHeight int `json:"videoHeight"` + VideoWidth int `json:"videoWidth"` + VideoAutoPlay bool `json:"videoAutoPlay"` + AttrId string `json:"attrId"` + Poster string `json:"poster"` + Loop bool `json:"loop"` +} + +// 轮播图 +type CarsuselConfigArrInfo struct { + UploadFlag bool `json:"uploadFlag"` + ImgId string `json:"imgId"` + ImgSort int `json:"imgSort"` + ImgUrl string `json:"imgUrl"` + Link string `json:"link"` } // 组件配置 @@ -262,6 +296,7 @@ type Result struct { Comment string `json:"comment"` Pattern string `json:"pattern"` Classify string `json:"classify"` + Auxiliary string `json:"auxiliary"` } // 自定义表单数据结构版本及表单输出 @@ -404,6 +439,7 @@ type FormFieldInfo struct { Attribute string `json:"attribute"` Pattern string `json:"pattern"` FieldClass string `json:"fieldClass"` + Auxiliary string `json:"auxiliary"` ActiveValue string `json:"activeValue"` InactiveValue string `json:"inactiveValue"` Config ConfigType `json:"config"` @@ -457,6 +493,7 @@ type SearchButtonInfo struct { Pattern string `json:"pattern"` FieldClass string `json:"fieldClass"` ActiveValue string `json:"activeValue"` + Auxiliary string `json:"auxiliary"` InactiveValue string `json:"inactiveValue"` Options []OptionsInfo `json:"options"` Config interface{} `json:"config"` diff --git a/api/version1/entry.go b/api/version1/entry.go index aa033e2..af6597d 100644 --- a/api/version1/entry.go +++ b/api/version1/entry.go @@ -15,6 +15,7 @@ import ( "appPlatform/api/version1/taskplatform/taskflow" "appPlatform/api/version1/taskplatform/taskmanagement" "appPlatform/api/version1/user" + webstocetmsg "appPlatform/api/version1/webStocetmsg" "appPlatform/api/version1/workWechat" ) @@ -31,10 +32,10 @@ type ApiEntry struct { NewsClassApi newsclass.ApiMethod //新闻类 RedisManagApi redisController.ApiMethod MathsApi matsformula.ApiMethod - WechatApi workWechat.ApiMethod //微信相关项目 - DataCenterApi datacenter.ApiMethod //数据中台 - CustomerAppApi customerApp.ApiMethod //自定App - + WechatApi workWechat.ApiMethod //微信相关项目 + DataCenterApi datacenter.ApiMethod //数据中台 + CustomerAppApi customerApp.ApiMethod //自定App + WebSocketApi webstocetmsg.ApiMethod //webSocket通讯相关 } var AppApiEntry = new(ApiEntry) diff --git a/api/version1/publicapi/api.go b/api/version1/publicapi/api.go index d711656..3cd3714 100644 --- a/api/version1/publicapi/api.go +++ b/api/version1/publicapi/api.go @@ -451,7 +451,7 @@ func (g *GainRulsNumner) GainUniqueNumber(uuid string) string { } // fmt.Printf("uuidAry-->%v\n", uuidAry) if len(uuidAry) > 0 { - uuid = strings.Join(uuidAry, "-") + uuid = strings.Join(uuidAry, "") redisClient := grocerystore.RunRedis(overall.CONSTANT_Cluster) redisKey := fmt.Sprintf("GetEncoding:AppPlatform:NumKey_Currency_%v", overall.CONSTANT_CONFIG.RedisPrefixStr.Alias) if g.TableKey != "" { diff --git a/api/version1/taskplatform/matsFormula/formula.go b/api/version1/taskplatform/matsFormula/formula.go index 0d4a8e8..2c605b4 100644 --- a/api/version1/taskplatform/matsFormula/formula.go +++ b/api/version1/taskplatform/matsFormula/formula.go @@ -137,7 +137,7 @@ func (a *ApiMethod) MathematicalCalculations(c *gin.Context) { var requestsData ReceiveMathsFornula err := c.ShouldBindJSON(&requestsData) if err != nil { - publicmethod.Result(1, err, c) + publicmethod.Result(10001, err, c) return } zhi := make(map[string]float64) @@ -182,32 +182,35 @@ func (a *ApiMethod) MathematicalCalculations(c *gin.Context) { */ func FieldToValue(formula string, formKeyVal map[string]interface{}, takingMethod, digit int) (runMaths float64) { for i, v := range formKeyVal { + // fmt.Printf("smai===>%v===>%v\n", i, v) if val, isOk := v.(string); isOk { if val == "" { val = "0" } - formula = strings.Replace(formula, i, val, -1) + formula = strings.Replace(formula, i, val, 1) + // fmt.Printf("smai===>%v===>%v===>%v\n", i, val, formula) } + // fmt.Printf("smai===>%v===>%v===>%v\n", i, v, formula) if val, isOk := v.(int); isOk { valStr := strconv.Itoa(val) - formula = strings.Replace(formula, i, valStr, -1) + formula = strings.Replace(formula, i, valStr, 1) } if val, isOk := v.(int64); isOk { valStr := strconv.FormatInt(val, 10) - formula = strings.Replace(formula, i, valStr, -1) + formula = strings.Replace(formula, i, valStr, 1) } if val, isOk := v.(float32); isOk { valStr := strconv.FormatFloat(float64(val), 'f', -1, 64) - formula = strings.Replace(formula, i, valStr, -1) + formula = strings.Replace(formula, i, valStr, 1) } if val, isOk := v.(float64); isOk { valStr := strconv.FormatFloat(val, 'f', -1, 64) - formula = strings.Replace(formula, i, valStr, -1) + formula = strings.Replace(formula, i, valStr, 1) } } - formula = strings.Replace(formula, ",", ",", -1) + formula = strings.Replace(formula, ",", ",", 1) smaillMathsStr := strings.ToLower(formula) - fmt.Printf("smaillMathsStr===>%v\n", smaillMathsStr) + // fmt.Printf("smaillMathsStr===>%v\n", smaillMathsStr) runMaths, err := AnalyticCalculation(smaillMathsStr, takingMethod, digit) if err != nil { runMaths = 0 diff --git a/api/version1/taskplatform/taskflow/flowType.go b/api/version1/taskplatform/taskflow/flowType.go index f16c95b..1a21140 100644 --- a/api/version1/taskplatform/taskflow/flowType.go +++ b/api/version1/taskplatform/taskflow/flowType.go @@ -63,6 +63,7 @@ type NodePublicInfo struct { ChildNode *NodePublicInfo `json:"childNode"` //子节点 Matrix MatrixInfo `json:"matrix"` // HelpTips string `json:"helpTips"` // + OrgList []int64 `json:"orgList"` //指定行政组织,由其负责人审批 } //矩阵信息 diff --git a/api/version1/taskplatform/taskflow/types.go b/api/version1/taskplatform/taskflow/types.go index 06c208d..9fe145d 100644 --- a/api/version1/taskplatform/taskflow/types.go +++ b/api/version1/taskplatform/taskflow/types.go @@ -155,6 +155,7 @@ type PublicChildNode struct { DataBaseCondition []DataBaseConditionStruct `json:"databasecondition"` //关联数据库操作 CustomNode string `json:"customNode"` //由哪个节点指定本节点审批人 ExecutionAddress string `json:"executionaddress"` //执行节点跳转页面 + OrgList []int64 `json:"orgList"` //指定行政组织,由其负责人审批 } // 输出流程版本 diff --git a/api/version1/taskplatform/taskflow/workflow.go b/api/version1/taskplatform/taskflow/workflow.go index 182466a..6584f58 100644 --- a/api/version1/taskplatform/taskflow/workflow.go +++ b/api/version1/taskplatform/taskflow/workflow.go @@ -48,6 +48,7 @@ func (a *ApiMethod) InitializeWorkFlow(c *gin.Context) { outData := publicmethod.MapOut[string]() outData["workFlowStruct"] = workFlowStruct // outData["err"] = err + fmt.Printf("初始化流程---》%v\n", requestData) publicmethod.Result(0, workFlowStruct, c) } diff --git a/api/version1/taskplatform/taskmanagement/flowNode.go b/api/version1/taskplatform/taskmanagement/flowNode.go index 5a86c71..37cb0c1 100644 --- a/api/version1/taskplatform/taskmanagement/flowNode.go +++ b/api/version1/taskplatform/taskmanagement/flowNode.go @@ -39,6 +39,7 @@ type NodePublicInfo struct { ChildNode *NodePublicInfo `json:"childNode"` //子节点 Matrix MatrixInfo `json:"matrix"` // + OrgList []int64 `json:"orgList"` //指定行政组织,由其负责人审批 HelpTips string `json:"helpTips"` //节点帮助说明 } diff --git a/api/version1/taskplatform/taskmanagement/ruanTask.go b/api/version1/taskplatform/taskmanagement/ruanTask.go index 4953cbe..12510a2 100644 --- a/api/version1/taskplatform/taskmanagement/ruanTask.go +++ b/api/version1/taskplatform/taskmanagement/ruanTask.go @@ -122,7 +122,7 @@ func GainOnlyOneCustomerFormLog(id, masterTableName, sunTableJson string, tableU sendData[i] = publicmethod.TypeToInterface(v) default: // sendData[i] = v - sendData[i] = ChuLiMasterTableData(i, v, tableUnitList.MasterInfo) + sendData[i] = ChuLiMasterTableData(i, v, tableUnitList.MasterInfo, sendData) } } @@ -157,7 +157,7 @@ func GainOnlyOneCustomerFormLog(id, masterTableName, sunTableJson string, tableU for _, tv := range tableUnitList.SunFormInfo { if sonUnitCont, ok := tv[v]; ok { isWrite = false - sunFormContent[si] = ChuLiMasterTableData(si, sv, sonUnitCont) + sunFormContent[si] = ChuLiMasterTableData(si, sv, sonUnitCont, tv) } } if isWrite { @@ -172,7 +172,7 @@ func GainOnlyOneCustomerFormLog(id, masterTableName, sunTableJson string, tableU } sunTableFormInfor = append(sunTableFormInfor, sunFormContent) } - fmt.Printf("sunTableFormInfor----->%v----->%T----->%v\n", v, sunTableFormInfor, sunTableFormInfor) + // fmt.Printf("sunTableFormInfor----->%v----->%T----->%v\n", v, sunTableFormInfor, sunTableFormInfor) if len(sunTableFormInfor) > 0 { sendData[v] = sunTableFormInfor } else { @@ -192,11 +192,12 @@ func GainOnlyOneCustomerFormLog(id, masterTableName, sunTableJson string, tableU @ 时间: 2024-04-08 09:35:44 @ 功能: 处理主表值 */ -func ChuLiMasterTableData(key string, val interface{}, unitCont []customerform.UnitAttribute) interface{} { +func ChuLiMasterTableData(key string, val interface{}, unitCont []customerform.UnitAttribute, tableFormInfo interface{}) interface{} { for _, uv := range unitCont { if uv.Key == key { acValInt, _ := strconv.Atoi(uv.ActiveValue) // InavalInt, _ := strconv.Atoi(uv.InactiveValue) + switch uv.Class { case "switch": // fmt.Printf("switch-->%T---->%v\n", val, val) @@ -282,6 +283,37 @@ func ChuLiMasterTableData(key string, val interface{}, unitCont []customerform.U json.Unmarshal([]byte(vStr), &cbVal) } return cbVal + case "datePicker": + if tableMap, isOk := tableFormInfo.(map[string]interface{}); isOk { + endKey := fmt.Sprintf("%v_end", key) + fmt.Printf("%v----->switch-->%T---->%v\n", endKey, tableMap[endKey], tableMap[endKey]) + + if tableMap[endKey] != nil { + return []interface{}{val, tableMap[endKey]} + } else { + return val + } + } + case "select": + if auxIsTeuw, isOk := uv.Auxiliary.(bool); isOk { + if auxIsTeuw { + var ary []interface{} + if valStr, isTrue := val.(string); isTrue { + json.Unmarshal([]byte(valStr), &ary) + return ary + } else { + return val + } + } else { + valInt, _ := publicmethod.StringToInt64(val) + return valInt + } + + } else { + valInt, _ := publicmethod.StringToInt64(val) + return valInt + } + fmt.Printf("%v----->switch-->%T---->%v\n", key, uv, uv) default: return val } @@ -416,12 +448,14 @@ func (a *ApiMethod) EditCustomerTable(c *gin.Context) { publicmethod.Result(100, err, c) return } + mapData := publicmethod.MapOut[string]() //初始化MAP err = json.Unmarshal(data, &mapData) //将json字符串转换成Map if err != nil { publicmethod.Result(100, err, c) return } + masterKey := "" if masterVal, ok := mapData["masters_key"]; !ok { publicmethod.Result(1, err, c, "非法表单!不能提交数据!") @@ -476,8 +510,9 @@ func (a *ApiMethod) EditCustomerTable(c *gin.Context) { switch valAry := v.(type) { case []interface{}: if len(valAry) > 0 { - valStrJson, _ := json.Marshal(valAry) - masterField[k] = string(valStrJson) + // valStrJson, _ := json.Marshal(valAry) + // masterField[k] = string(valStrJson) + masterField[k] = valAry } else { masterField[k] = "" } @@ -488,18 +523,30 @@ func (a *ApiMethod) EditCustomerTable(c *gin.Context) { sunFieldAry[k] = v } } + + var formJsonCont customerform.CustomerFormMaster + json.Unmarshal([]byte(taskInfo.MastesFormJson), &formJsonCont) + + var tableUnitList customerform.TableFormUnit + tableUnitList.AnalysisTableFormUnitAttribute("", formJsonCont.List) + // hjksdf := publicmethod.MapOut[string]() + // hjksdf["tableUnitList"] = tableUnitList + + // publicmethod.Result(106, hjksdf, c) + // return //获取当前操作人信息 context, _ := c.Get(overall.MyContJwt) var userCont modelshr.ManCont userCont.GetLoginCont(context) //当前操作人 cureeTime := time.Now().Unix() - masterOldData, err := MasterTableHandle(tableVersion.TableKey, userCont.Key, cureeTime, masterField) + masterOldData, err := MasterTableHandleNew(tableVersion.TableKey, userCont.Key, cureeTime, masterField, tableUnitList.MasterInfo) if err != nil { publicmethod.Result(106, err, c) return } - + // publicmethod.Result(106, masterOldData, c) + // return //自定义表单修改数据历史记录 var tableEditLog reviseform.EditFormDataLog masterKeyInt, _ := strconv.ParseInt(masterKey, 10, 64) @@ -541,6 +588,106 @@ func (a *ApiMethod) EditCustomerTable(c *gin.Context) { publicmethod.Result(0, sendInfo, c) } +/* +* +@ 作者: 秦东 +@ 时间: 2024-08-07 11:49:21 +@ 功能: 主表处理数据(新版) +@ 参数 + + # + +@ 返回值 + + # + +@ 方法原型 + + # +*/ +func MasterTableHandleNew(tableName string, creater, cureeTime int64, newsData map[string]interface{}, MasterInfo []customerform.UnitAttribute) (map[string]interface{}, error) { + var oldData map[string]interface{} + if len(newsData) > 0 { + var id interface{} + editData := publicmethod.MapOut[string]() + for i, v := range newsData { + + if i == "id" { + // if idStr, ok := v.(string); ok { + // id = idStr + // } else { + // id = idStr + // } + id = v + } + if !publicmethod.RemoveReservedWord(i) { + // fmt.Printf("i:%v---->t:%T---->v:%v\n", i, v, v) + + for _, mv := range MasterInfo { + if i == mv.Key { + fmt.Printf("mv:%v---->t:%v---->---->v:%v\n", i, mv.Class, mv.Auxiliary) + switch mv.Class { + case "datePicker": + auxVal := publicmethod.TypeToInterface(mv.Auxiliary) + if !publicmethod.RemoveReservedWordTime(auxVal) { + editData[i] = v + } else { + if valAry, isAry := v.([]interface{}); isAry { + if len(valAry) > 0 { + editData[i] = valAry[0] + endKey := fmt.Sprintf("%v_end", i) + editData[endKey] = valAry[len(valAry)-1] + } + } + } + case "checkbox": + valStrJson, _ := json.Marshal(v) + editData[i] = string(valStrJson) + case "select": + if auxVal, isAc := mv.Auxiliary.(bool); isAc { + if auxVal { + valStrJson, _ := json.Marshal(v) + editData[i] = string(valStrJson) + } else { + editData[i] = v + } + } else { + editData[i] = v + } + + default: + if valAry, isAry := v.([]interface{}); isAry { + + if len(valAry) > 0 { + valStrJson, _ := json.Marshal(valAry) + editData[i] = string(valStrJson) + } else { + editData[i] = "" + } + } else { + editData[i] = v + } + + } + } + + } + } + } + err := overall.CONSTANT_DB_CustomerForm.Table(tableName).Where("`id` = ?", id).Find(&oldData).Error + if err != nil { + return oldData, err + } + editData["`edit_time`"] = cureeTime + editData["`creater`"] = creater + editData["`states`"] = 1 + err = overall.CONSTANT_DB_CustomerForm.Table(tableName).Where("`id` = ?", id).Updates(&editData).Error + + return oldData, err + } + return oldData, nil +} + /* * @ 作者: 秦东 @@ -570,7 +717,7 @@ func SonTableHandle(masterKey string, creater, cureeTime int64, sunTableMap map[ return sunTableList, errors.New("没有子表数据") } for i, v := range sunTableMap { - fmt.Printf("sunTableMap--->%v--->%T--->%v\n", i, v, v) + // fmt.Printf("sunTableMap--->%v--->%T--->%v\n", i, v, v) if vMap, ok := v.([]interface{}); ok { sunTableList[i] = SonTableSaveData(i, masterKey, creater, cureeTime, vMap) } @@ -653,7 +800,7 @@ func MasterTableHandle(tableName string, creater, cureeTime int64, newsData map[ var id interface{} editData := publicmethod.MapOut[string]() for i, v := range newsData { - fmt.Printf("i:%v---->v:%v\n", i, v) + if i == "id" { // if idStr, ok := v.(string); ok { // id = idStr @@ -663,6 +810,7 @@ func MasterTableHandle(tableName string, creater, cureeTime int64, newsData map[ id = v } if !publicmethod.RemoveReservedWord(i) { + fmt.Printf("i:%v---->t:%T---->v:%v\n", i, v, v) editData[i] = v } } @@ -713,6 +861,7 @@ func (a *ApiMethod) GainEditDataLog(c *gin.Context) { err = overall.CONSTANT_DB_ReviseFormData.Model(&reviseform.EditFormDataLog{}).Where("`masters_key` = ?", requestData.Id).Order("`id` DESC").Find(&tableEditLog).Error if err != nil { publicmethod.Result(107, err, c) + return } sendData := publicmethod.MapOut[string]() @@ -775,7 +924,7 @@ func AnalysisSonLog(sonDataStr string, sonNameKey []map[string][]customerform.Un for si, sv := range v { // fmt.Printf("sonMap-2-->%T---------->%v---------->%v\n", sv, si, sv) if sonCont, ok := sonMap[si]; ok { - fmt.Printf("sonMap-5-->%T---------->%v---------->%v\n", sonCont, si, sonCont) + // fmt.Printf("sonMap-5-->%T---------->%v---------->%v\n", sonCont, si, sonCont) // for mi, mv := range sv { // fmt.Printf("sonMap-4-->%T---------->%v---------->%v\n", mv, mi, sonCont) // } @@ -907,7 +1056,7 @@ func AnalysisMsaterLog(dataStr string, nameKey []customerform.UnitAttribute) (se for _, uv := range nameKey { if i == uv.Key { - fmt.Printf("edit_time--->%T--->%v--->%v--->%v--->%v--->%T\n", uv.ActiveValue, i, uv.Key, uv, v, v) + // fmt.Printf("edit_time--->%T--->%v--->%v--->%v--->%v--->%T\n", uv.ActiveValue, i, uv.Key, uv, v, v) switch uv.Class { case "switch": switch vData := v.(type) { @@ -1226,6 +1375,10 @@ func (n *NodePublicInfo) CircularParsing(step int, creater modelshr.ManCont, org } else { nodeInfo.Operator = GainMatrixUserList(orgId, n.Matrix) } + case 10: //指定部门负责人 + if len(n.OrgList) > 0 { + nodeInfo.Operator = GainOrgManager(n.OrgList) + } default: } // jsonCont, _ := json.Marshal(nodeInfo) @@ -2155,7 +2308,7 @@ func (a *ApiMethod) RetractRunWorkFlow(c *gin.Context) { } operatorAry, _ := FindOperator(userKey, runFlowInfo.RunKey, 3, flowList[stepVal].Operator, "主动撤回") flowList[stepVal].Operator = operatorAry - fmt.Printf("operatorAry------------>%v\n", operatorAry) + // fmt.Printf("operatorAry------------>%v\n", operatorAry) saveFlowInfo["`flow_cont`"], _ = json.Marshal(flowList) FlowRunLog(runFlowInfo.Id, userCont.Key, 1, flowList[stepVal].NodeKey, "撤回申请", "") @@ -2174,3 +2327,32 @@ func (a *ApiMethod) RetractRunWorkFlow(c *gin.Context) { publicmethod.Result(0, err, c) } + +/* +* +@ 作者: 秦东 +@ 时间: 2024-08-09 10:54:20 +@ 功能: 获取行政组织负责人 +@ 参数 + + # + +person_in_charge +@ 返回值 + + # + +@ 方法原型 + + # +*/ +func GainOrgManager(orgId []int64) (UserList []OperatorList) { + var userInfoAry []modelshr.ManCont + overall.CONSTANT_DB_HR.Model(&modelshr.ManCont{}).Select("`key`,`name`,`number`,`icon`,`icon_photo`,`wechat`,`work_wechat`,`admin_org`,`position`,`teamid`,`mobilephone`,`company`").Where("`admin_org` IN ? AND `person_in_charge` = ?", orgId, 1).Find(&userInfoAry) + if len(userInfoAry) > 0 { + for _, uv := range userInfoAry { + UserList = append(UserList, TransformPublicUs(uv)) + } + } + return +} diff --git a/api/version1/taskplatform/taskmanagement/runTaskFlow.go b/api/version1/taskplatform/taskmanagement/runTaskFlow.go index 739154b..d7f2883 100644 --- a/api/version1/taskplatform/taskmanagement/runTaskFlow.go +++ b/api/version1/taskplatform/taskmanagement/runTaskFlow.go @@ -1,12 +1,15 @@ package taskmanagement import ( + "appPlatform/api/version1/customerform" "appPlatform/models/customerForm" "appPlatform/models/modelshr" + "appPlatform/models/reviseform" "appPlatform/overall" "appPlatform/overall/publicmethod" "encoding/json" "fmt" + "sort" "strconv" "strings" "time" @@ -188,7 +191,7 @@ func (r *RunWorkFlow) RunNodeHandle(userKey int64, AgreeToRefuse int, Suggest st return } userKeyStr := strconv.FormatInt(userKey, 10) //当前操作人识别符转字符类型 - fmt.Printf("执行节点处理--->%v------>%v\n", r.Step, r.NextStep) + // fmt.Printf("执行节点处理--->%v------>%v\n", r.Step, r.NextStep) //遍历流程判断当前要执行的步骤 for i := 0; i < r.TotalSteps; i++ { if r.FlowList[i].Step == r.Step { //获取当前操作节点 @@ -224,7 +227,7 @@ func (r *RunWorkFlow) RunNodeHandle(userKey int64, AgreeToRefuse int, Suggest st return } else { currentStep, nextStep := PaceStep(r.RunUid, r.Step, r.TotalSteps, r.FlowList[i]) - fmt.Printf("同意操作---->%v---->%v---->%v\n", currentStep, nextStep, r.FlowList[i].Types) + // fmt.Printf("同意操作---->%v---->%v---->%v\n", currentStep, nextStep, r.FlowList[i].Types) r.FlowList[i].Status = 2 operatorAry, nodeUser := FindOperator(userKeyStr, r.RunUid, 2, r.FlowList[i].Operator, Suggest) r.FlowList[i].Operator = operatorAry @@ -284,3 +287,603 @@ func (r *RunWorkFlow) RunNodeHandle(userKey int64, AgreeToRefuse int, Suggest st } } } + +/* +* +@ 作者: 秦东 +@ 时间: 2024-08-06 14:23:36 +@ 功能: 修改记录(新版) +@ 参数 + + # + +@ 返回值 + + # + +@ 方法原型 + + # +*/ +func (a *ApiMethod) GainEditDataNewLog(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(100, err, c) + return + } + var tableEditLog []reviseform.EditFormDataLog + err = overall.CONSTANT_DB_ReviseFormData.Model(&reviseform.EditFormDataLog{}).Where("`masters_key` = ?", requestData.Id).Order("`id` DESC").Find(&tableEditLog).Error + if err != nil { + publicmethod.Result(107, err, c) + return + } + sendData := publicmethod.MapOut[string]() + + var taskInfo customerForm.TaskRecord + taskInfo.GetCont(map[string]interface{}{"`masters_key": requestData.Id}) + //展开表单 + var formJsonCont customerform.CustomerFormMaster + json.Unmarshal([]byte(taskInfo.MastesFormJson), &formJsonCont) + + var tableUnitList customerform.TableFormUnit + tableUnitList.AnalysisTableFormUnitAttribute("", formJsonCont.List) + sendData["tableUnitList"] = formJsonCont.List + // publicmethod.Result(107, tableUnitList.MasterInfo, c) + // return + var sendList []EditTaskLog + for _, v := range tableEditLog { + // fmt.Println("====================================") + var sendInfo EditTaskLog + if v.DataCont != "" { + mastAry, creater, timeStr, _ := AnalysisMsaterNewLog(v.DataCont, tableUnitList.MasterInfo) + // if err != nil { + sendInfo.Creater = creater.Name + sendInfo.Time = timeStr + sendInfo.Masterdata = append(sendInfo.Masterdata, mastAry...) + // } + } + if v.SunDataCont != "" { + sendInfo.SunData, _ = AnalysisSonNewLog(v.SunDataCont, tableUnitList.SunFormInfo) + } + sendList = append(sendList, sendInfo) + // fmt.Println("====================================") + } + + publicmethod.Result(0, sendList, c) +} + +/* +* +@ 作者: 秦东 +@ 时间: 2024-08-06 16:56:55 +@ 功能: 解析子表新方法记录 +@ 参数 + + # + +@ 返回值 + + # + +@ 方法原型 + + # +*/ +func AnalysisSonNewLog(sonDataStr string, sonNameKey []map[string][]customerform.UnitAttribute) (SunData map[string][][]TaskLogInfo, err error) { + var sonMap map[string][]map[string]interface{} + err = json.Unmarshal([]byte(sonDataStr), &sonMap) + sonTableData := make(map[string][][]TaskLogInfo) + for _, v := range sonNameKey { + for si, sv := range v { + if sonCont, ok := sonMap[si]; ok { + // fmt.Printf("sonMap-5-->%T---------->%v---------->%v---------->%v\n", sonCont, si, sonCont, sv) + sonTableData[si] = sunContHandel(sonCont, sv) + } + } + } + SunData = sonTableData + return +} + +/* +* +@ 作者: 秦东 +@ 时间: 2024-08-07 08:25:53 +@ 功能: 处理子表单数据 +@ 参数 + + # + +@ 返回值 + + # + +@ 方法原型 + + # +*/ +func sunContHandel(sonMapAry []map[string]interface{}, nameKey []customerform.UnitAttribute) (infoList [][]TaskLogInfo) { + var taskInfoList [][]TaskLogInfo + for _, v := range sonMapAry { + // fmt.Printf("sonMap-5-->%T---------->%v\n", v, v) + var logAry []TaskLogInfo + for i, val := range v { + for _, uv := range nameKey { + if uv.Key == i { + var taskInfo TaskLogInfo + taskInfo.Label = uv.Name + taskInfo.Field = i + taskInfo.Auxiliary = uv.Auxiliary + // taskInfo.Value = vv + taskInfo.Types = uv.Class + taskInfo.Sort = uv.Sort + + switch i { + case "creater": + var createrInfo modelshr.ManCont + createrInfo.GetCont(map[string]interface{}{"`key`": val}, "`name`", "`number`") + taskInfo.Value = fmt.Sprintf("%v(%v)", createrInfo.Name, createrInfo.Number) + case "edit_time": + timeInt, _ := publicmethod.StringToInt64(val) + taskInfo.Value = publicmethod.UnixTimeToDay(timeInt, 27) + case "creater_time": + timeCreaInt, _ := publicmethod.StringToInt64(val) + taskInfo.Value = publicmethod.UnixTimeToDay(timeCreaInt, 27) + case "states": + statesVal, _ := publicmethod.StringToInt64(val) + switch statesVal { + case 3: + taskInfo.Value = "删除" + case 2: + taskInfo.Value = "禁用" + default: + taskInfo.Value = "启用" + } + default: + switch uv.Class { + case "digitpage": + digitpageInt := publicmethod.TypeToInterface(val) + if len(digitpageInt) > 16 { + taskInfo.Value = digitpageInt + } else { + taskInfo.Value, _ = publicmethod.StringToInt64(val) + } + case "radio": + for _, v := range uv.Options { + radioOptVal := publicmethod.TypeToInterface(val) + if v.Value == radioOptVal { + taskInfo.Value = v.Label + } + } + case "checkbox": + var valAry []interface{} + checkboxVal := publicmethod.TypeToInterface(val) + err := json.Unmarshal([]byte(checkboxVal), &valAry) + if err == nil { + var pickStr []string + for _, v := range valAry { + pickStr = append(pickStr, publicmethod.TypeToInterface(v)) + } + var valList []string + for _, v := range uv.Options { + if publicmethod.IsInTrue[string](v.Value, pickStr) { + valList = append(valList, v.Label) + } + } + taskInfo.Value = strings.Join(valList, ",") + } + case "select": + if auxVal, isOk := uv.Auxiliary.(bool); isOk { + if auxVal { + var valAry []interface{} + checkboxVal := publicmethod.TypeToInterface(val) + err := json.Unmarshal([]byte(checkboxVal), &valAry) + if err == nil { + var pickStr []string + for _, v := range valAry { + pickStr = append(pickStr, publicmethod.TypeToInterface(v)) + } + var valList []string + for _, v := range uv.Options { + if publicmethod.IsInTrue[string](v.Value, pickStr) { + valList = append(valList, v.Label) + } + } + taskInfo.Value = strings.Join(valList, ",") + } + } else { + for _, v := range uv.Options { + selectVal := publicmethod.TypeToInterface(val) + if v.Value == selectVal { + taskInfo.Value = v.Label + } + } + } + } else { + for _, v := range uv.Options { + selectVal := publicmethod.TypeToInterface(val) + if v.Value == selectVal { + taskInfo.Value = v.Label + } + } + } + case "datePicker": + + switch uv.Auxiliary { + case "year": + timeVal, _ := publicmethod.StringToInt64(val) + taskInfo.Value = publicmethod.UnixTimeToDay(timeVal/1000, 16) + case "month": + timeVal, _ := publicmethod.StringToInt64(val) + taskInfo.Value = publicmethod.UnixTimeToDay(timeVal/1000, 15) + case "datetime": + timeVal, _ := publicmethod.StringToInt64(val) + taskInfo.Value = publicmethod.UnixTimeToDay(timeVal/1000, 11) + case "week": + timeVal, _ := publicmethod.StringToInt64(val) + taskInfo.Value = publicmethod.UnixTimeToDay(timeVal/1000, 41) + case "datetimerange": + timeVal, _ := publicmethod.StringToInt64(val) + beginTime := publicmethod.UnixTimeToDay(timeVal/1000, 11) + taskInfo.Value = beginTime + endFile := fmt.Sprintf("%v_end", i) + if valTime, isTimeOk := v[endFile]; isTimeOk { + endTimeInt, _ := publicmethod.StringToInt64(valTime) + endTimeStr := publicmethod.UnixTimeToDay(endTimeInt/1000, 11) + taskInfo.Value = fmt.Sprintf("%v 至 %v", beginTime, endTimeStr) + } + case "daterange": + timeVal, _ := publicmethod.StringToInt64(val) + beginTime := publicmethod.UnixTimeToDay(timeVal/1000, 14) + taskInfo.Value = beginTime + endFile := fmt.Sprintf("%v_end", i) + if valTime, isTimeOk := v[endFile]; isTimeOk { + endTimeInt, _ := publicmethod.StringToInt64(valTime) + endTimeStr := publicmethod.UnixTimeToDay(endTimeInt/1000, 14) + taskInfo.Value = fmt.Sprintf("%v 至 %v", beginTime, endTimeStr) + } + case "monthrange": + timeVal, _ := publicmethod.StringToInt64(val) + beginTime := publicmethod.UnixTimeToDay(timeVal/1000, 15) + taskInfo.Value = beginTime + endFile := fmt.Sprintf("%v_end", i) + if valTime, isTimeOk := v[endFile]; isTimeOk { + endTimeInt, _ := publicmethod.StringToInt64(valTime) + endTimeStr := publicmethod.UnixTimeToDay(endTimeInt/1000, 15) + taskInfo.Value = fmt.Sprintf("%v 至 %v", beginTime, endTimeStr) + } + default: + timeVal, _ := publicmethod.StringToInt64(val) + beginTime := publicmethod.UnixTimeToDay(timeVal/1000, 14) + taskInfo.Value = beginTime + } + case "timePicker": + timeVal, _ := publicmethod.StringToInt64(val) + taskInfo.Value = publicmethod.UnixTimeToDay(timeVal/1000, 6) + case "expand-user": + valStr := publicmethod.TypeToInterface(val) + var peopleAry []string + json.Unmarshal([]byte(valStr), &peopleAry) + taskInfo.Value = strings.Join(peopleAry, ",") + case "orgCentent": + var orgCont modelshr.AdministrativeOrganization + orgCont.GetCont(map[string]interface{}{"`id`": val}, "`name`") + taskInfo.Value = orgCont.Name + case "deptOrg": + var orgCont modelshr.AdministrativeOrganization + orgCont.GetCont(map[string]interface{}{"`id`": val}, "`name`") + taskInfo.Value = orgCont.Name + case "owner": + var manInfo modelshr.ManCont + manInfo.GetCont(map[string]interface{}{"`key`": val}, "`name`", "`number`") + taskInfo.Value = fmt.Sprintf("%v(%v)", manInfo.Name, manInfo.Number) + case "lowcodeImage": + if val == nil { + taskInfo.Value = uv.FilePath + } else { + taskInfo.Value = val + } + case "lowcodeCarsusel": + if val == nil { + taskInfo.Value = uv.CarsuselConfigArr + } else { + taskInfo.Value = val + } + case "videoUpAndPlay": + if val == nil { + taskInfo.Value = uv.VideoList + } else { + taskInfo.Value = val + } + default: + taskInfo.Value = val + } + + } + + logAry = append(logAry, taskInfo) + } + + } + } + sort.Slice(logAry, func(i, j int) bool { + return logAry[i].Sort < logAry[j].Sort + }) + taskInfoList = append(taskInfoList, logAry) + } + infoList = taskInfoList + return +} + +/* +* +@ 作者: 秦东 +@ 时间: 2024-08-06 16:09:14 +@ 功能: 修改记录主表数据解析 +@ 参数 + + # + +@ 返回值 + + # + +@ 方法原型 + + # +*/ +func AnalysisMsaterNewLog(dataStr string, nameKey []customerform.UnitAttribute) (taskInfoAry []TaskLogInfo, createrInfo modelshr.ManCont, createrTime string, err error) { + if dataStr == "" || len(nameKey) < 1 { + return + } + var dataInfo map[string]interface{} + err = json.Unmarshal([]byte(dataStr), &dataInfo) + if err != nil { + return + } + for i, v := range dataInfo { + // fmt.Printf("%v:%v\n", i, v) + + switch i { + case "creater": + createrInfo.GetCont(map[string]interface{}{"`key`": v}) + case "edit_time": + timeInt, _ := publicmethod.StringToInt64(v) + createrTime = publicmethod.UnixTimeToDay(timeInt, 27) + default: + taskInfoAry = append(taskInfoAry, HistoryValueHand(i, v, nameKey, dataInfo)...) + // for _, uv := range nameKey { + // if i == uv.Key { + // var taskInfo TaskLogInfo + // taskInfo.Label = uv.Name + // taskInfo.Field = i + // taskInfo.Auxiliary = uv.Auxiliary + // taskInfo.Types = uv.Class + // taskInfo.Sort = uv.Sort + // taskInfo.Value = v + // taskInfoAry = append(taskInfoAry, taskInfo) + // } + // } + } + } + sort.Slice(taskInfoAry, func(i, j int) bool { + return taskInfoAry[i].Sort < taskInfoAry[j].Sort + }) + return +} + +/* +* +@ 作者: 秦东 +@ 时间: 2024-08-07 09:41:53 +@ 功能: 历史记录值处理 +*/ +func HistoryValueHand(field string, val interface{}, nameKey []customerform.UnitAttribute, dataInfo map[string]interface{}) (taskInfoAry []TaskLogInfo) { + for _, uv := range nameKey { + if field == uv.Key { + var taskInfo TaskLogInfo + taskInfo.Label = uv.Name + taskInfo.Field = field + taskInfo.Auxiliary = uv.Auxiliary + taskInfo.Types = uv.Class + taskInfo.Sort = uv.Sort + // fmt.Printf("key: %v, type: %T val:%v\n", field, val, val) + switch field { + case "creater": + var createrInfo modelshr.ManCont + createrInfo.GetCont(map[string]interface{}{"`key`": val}, "`name`", "`number`") + taskInfo.Value = fmt.Sprintf("%v(%v)", createrInfo.Name, createrInfo.Number) + case "edit_time": + timeInt, _ := publicmethod.StringToInt64(val) + taskInfo.Value = publicmethod.UnixTimeToDay(timeInt, 27) + case "creater_time": + timeCreaInt, _ := publicmethod.StringToInt64(val) + taskInfo.Value = publicmethod.UnixTimeToDay(timeCreaInt, 27) + case "states": + statesVal, _ := publicmethod.StringToInt64(val) + switch statesVal { + case 3: + taskInfo.Value = "删除" + case 2: + taskInfo.Value = "禁用" + default: + taskInfo.Value = "启用" + } + default: + switch uv.Class { + case "digitpage": + digitpageInt := publicmethod.TypeToInterface(val) + if len(digitpageInt) > 16 { + taskInfo.Value = digitpageInt + } else { + taskInfo.Value, _ = publicmethod.StringToInt64(val) + } + case "radio": + for _, v := range uv.Options { + radioOptVal := publicmethod.TypeToInterface(val) + if v.Value == radioOptVal { + taskInfo.Value = v.Label + } + } + case "checkbox": + var valAry []interface{} + checkboxVal := publicmethod.TypeToInterface(val) + err := json.Unmarshal([]byte(checkboxVal), &valAry) + if err == nil { + var pickStr []string + for _, v := range valAry { + pickStr = append(pickStr, publicmethod.TypeToInterface(v)) + } + var valList []string + for _, v := range uv.Options { + if publicmethod.IsInTrue[string](v.Value, pickStr) { + valList = append(valList, v.Label) + } + } + taskInfo.Value = strings.Join(valList, ",") + } + case "select": + if auxVal, isOk := uv.Auxiliary.(bool); isOk { + if auxVal { + var valAry []interface{} + checkboxVal := publicmethod.TypeToInterface(val) + err := json.Unmarshal([]byte(checkboxVal), &valAry) + if err == nil { + var pickStr []string + for _, v := range valAry { + pickStr = append(pickStr, publicmethod.TypeToInterface(v)) + } + var valList []string + for _, v := range uv.Options { + if publicmethod.IsInTrue[string](v.Value, pickStr) { + valList = append(valList, v.Label) + } + } + taskInfo.Value = strings.Join(valList, ",") + } + } else { + for _, v := range uv.Options { + selectVal := publicmethod.TypeToInterface(val) + if v.Value == selectVal { + taskInfo.Value = v.Label + } + } + } + } else { + for _, v := range uv.Options { + selectVal := publicmethod.TypeToInterface(val) + if v.Value == selectVal { + taskInfo.Value = v.Label + } + } + } + case "datePicker": + + switch uv.Auxiliary { + case "year": + timeVal, _ := publicmethod.StringToInt64(val) + taskInfo.Value = publicmethod.UnixTimeToDay(timeVal/1000, 16) + case "month": + timeVal, _ := publicmethod.StringToInt64(val) + taskInfo.Value = publicmethod.UnixTimeToDay(timeVal/1000, 15) + case "datetime": + timeVal, _ := publicmethod.StringToInt64(val) + taskInfo.Value = publicmethod.UnixTimeToDay(timeVal/1000, 11) + case "week": + timeVal, _ := publicmethod.StringToInt64(val) + taskInfo.Value = publicmethod.UnixTimeToDay(timeVal/1000, 41) + case "datetimerange": + timeVal, _ := publicmethod.StringToInt64(val) + beginTime := publicmethod.UnixTimeToDay(timeVal/1000, 11) + taskInfo.Value = beginTime + endFile := fmt.Sprintf("%v_end", field) + if valTime, isTimeOk := dataInfo[endFile]; isTimeOk { + endTimeInt, _ := publicmethod.StringToInt64(valTime) + endTimeStr := publicmethod.UnixTimeToDay(endTimeInt/1000, 11) + taskInfo.Value = fmt.Sprintf("%v 至 %v", beginTime, endTimeStr) + } + case "daterange": + timeVal, _ := publicmethod.StringToInt64(val) + beginTime := publicmethod.UnixTimeToDay(timeVal/1000, 14) + taskInfo.Value = beginTime + endFile := fmt.Sprintf("%v_end", field) + if valTime, isTimeOk := dataInfo[endFile]; isTimeOk { + endTimeInt, _ := publicmethod.StringToInt64(valTime) + endTimeStr := publicmethod.UnixTimeToDay(endTimeInt/1000, 14) + taskInfo.Value = fmt.Sprintf("%v 至 %v", beginTime, endTimeStr) + } + case "monthrange": + timeVal, _ := publicmethod.StringToInt64(val) + beginTime := publicmethod.UnixTimeToDay(timeVal/1000, 15) + taskInfo.Value = beginTime + endFile := fmt.Sprintf("%v_end", field) + if valTime, isTimeOk := dataInfo[endFile]; isTimeOk { + endTimeInt, _ := publicmethod.StringToInt64(valTime) + endTimeStr := publicmethod.UnixTimeToDay(endTimeInt/1000, 15) + taskInfo.Value = fmt.Sprintf("%v 至 %v", beginTime, endTimeStr) + } + default: + timeVal, _ := publicmethod.StringToInt64(val) + beginTime := publicmethod.UnixTimeToDay(timeVal/1000, 14) + taskInfo.Value = beginTime + // endKey := fmt.Sprintf("%v_end", field) + // if v[endKey] != nil { + // endTimeVal, _ := publicmethod.StringToInt64(v[endKey]) + // sendInfo[mi] = fmt.Sprintf("%v - %v", beginTime, publicmethod.UnixTimeToDay(int64(endTimeVal)/1000, 14)) + // } + } + case "timePicker": + timeVal, _ := publicmethod.StringToInt64(val) + taskInfo.Value = publicmethod.UnixTimeToDay(timeVal/1000, 6) + case "expand-user": + valStr := publicmethod.TypeToInterface(val) + var peopleAry []string + json.Unmarshal([]byte(valStr), &peopleAry) + taskInfo.Value = strings.Join(peopleAry, ",") + case "orgCentent": + var orgCont modelshr.AdministrativeOrganization + orgCont.GetCont(map[string]interface{}{"`id`": val}, "`name`") + taskInfo.Value = orgCont.Name + case "deptOrg": + var orgCont modelshr.AdministrativeOrganization + orgCont.GetCont(map[string]interface{}{"`id`": val}, "`name`") + taskInfo.Value = orgCont.Name + case "owner": + var manInfo modelshr.ManCont + manInfo.GetCont(map[string]interface{}{"`key`": val}, "`name`", "`number`") + taskInfo.Value = fmt.Sprintf("%v(%v)", manInfo.Name, manInfo.Number) + case "lowcodeImage": + if val == nil { + taskInfo.Value = uv.FilePath + } else { + taskInfo.Value = val + } + case "lowcodeCarsusel": + if val == nil { + taskInfo.Value = uv.CarsuselConfigArr + } else { + taskInfo.Value = val + } + case "videoUpAndPlay": + if val == nil { + taskInfo.Value = uv.VideoList + } else { + taskInfo.Value = val + } + // fmt.Printf("videoUpAndPlay--->key: %v, type: %T val:%v\n", field, val, val) + default: + taskInfo.Value = val + } + + } + + taskInfoAry = append(taskInfoAry, taskInfo) + } + } + return +} diff --git a/api/version1/taskplatform/taskmanagement/runWorkFlow.go b/api/version1/taskplatform/taskmanagement/runWorkFlow.go index 9d5a475..fbdbf48 100644 --- a/api/version1/taskplatform/taskmanagement/runWorkFlow.go +++ b/api/version1/taskplatform/taskmanagement/runWorkFlow.go @@ -1629,6 +1629,8 @@ func (a *ApiMethod) GainRunFlowStart(c *gin.Context) { publicmethod.Result(0, sendInfo, c) return } + // publicmethod.Result(0, flowCont, c) + // return context, _ := c.Get(overall.MyContJwt) var userCont modelshr.ManCont userCont.GetLoginCont(context) //获取当前操作人 diff --git a/api/version1/taskplatform/taskmanagement/types.go b/api/version1/taskplatform/taskmanagement/types.go index f97e380..8241434 100644 --- a/api/version1/taskplatform/taskmanagement/types.go +++ b/api/version1/taskplatform/taskmanagement/types.go @@ -109,3 +109,22 @@ type CreatFlowView struct { Step int `json:"step"` //当前执行第几步 OldFlow []RunFlow `json:"oldFlow"` //已生成的流程 } + +// 修改记录输出 +type EditTaskLog struct { + Creater string `json:"creater"` //创建人 + Explicate string `json:"explicate"` //说明 + Masterdata []TaskLogInfo `json:"masterdata"` //主表 + SunData map[string][][]TaskLogInfo `json:"sunData"` //主表 + Time string `json:"time"` //处理时间 +} + +// 记录格式 +type TaskLogInfo struct { + Label string `json:"label"` //标题名称 + Field string `json:"field"` //表字段 + Types string `json:"types"` //组件类型 + Auxiliary interface{} `json:"auxiliary"` //组件属性 + Value interface{} `json:"value"` //结果 + Sort int `json:"sort"` // +} diff --git a/api/version1/webStocetmsg/class.go b/api/version1/webStocetmsg/class.go new file mode 100644 index 0000000..64a27bd --- /dev/null +++ b/api/version1/webStocetmsg/class.go @@ -0,0 +1,22 @@ +package webstocetmsg + +import ( + "github.com/gorilla/websocket" +) + +type WebSocketClientBase struct { + ID string + Conn *websocket.Conn + LastHeartbeat int64 + BindUid string + JoinGroup []string +} + +type WebSocketUserBase struct { + Uid string + ClientID []string +} + +type WebSocketGroupBase struct { + ClientID []string +} diff --git a/api/version1/webStocetmsg/redis.go b/api/version1/webStocetmsg/redis.go new file mode 100644 index 0000000..a609004 --- /dev/null +++ b/api/version1/webStocetmsg/redis.go @@ -0,0 +1,42 @@ +package webstocetmsg + +import ( + "appPlatform/overall" + "context" + "fmt" + + "github.com/sirupsen/logrus" +) + +const ( + PublishKey = "websocket" +) + +// Publish 发布消息到redis +// channel是发布的目标信道 +// payload是要发布的消息内容 +func Publish(ctx context.Context, channel, payload string) (err error) { + // logrus.Debugf("[Redis] publish [%s]: %s", channel, payload) + err = overall.CONSTANT_REDIS4.Publish(ctx, channel, payload).Err() + if err != nil { + logrus.Errorf("[Redis] pulish error: %s", err.Error()) + return err + } + return +} + +// Subscribe 订阅redis消息 +// channel是订阅的目标信道 +func Subscribe(ctx context.Context, channel string) (string, error) { + // logrus.Debugf("[Redis] subscribe [%s]", channel) + sub := overall.CONSTANT_REDIS4.Subscribe(ctx, channel) + fmt.Printf("err--3->%T--2->%v\n", sub, sub) + msg, err := sub.ReceiveMessage(ctx) + fmt.Printf("err--3->%v--3->%v\n", err, msg) + if err != nil { + logrus.Errorf("[Redis] subscribe [%s]", channel) + return "", err + } + // logrus.Debugf("[Redis] subscribe [%s]: %s", channel, msg.String()) + return msg.Payload, err +} diff --git a/api/version1/webStocetmsg/redisWebsocket.go b/api/version1/webStocetmsg/redisWebsocket.go new file mode 100644 index 0000000..9180084 --- /dev/null +++ b/api/version1/webStocetmsg/redisWebsocket.go @@ -0,0 +1,49 @@ +package webstocetmsg + +import ( + "fmt" + "log" + "time" + + "github.com/gin-gonic/gin" + "github.com/gorilla/websocket" + "github.com/sirupsen/logrus" +) + +func (a *ApiMethod) WebsocketDemo(c *gin.Context) { + ws, err := upGraderes.Upgrade(c.Writer, c.Request, nil) + fmt.Printf("err--1->%v\n", err) + if err != nil { + return + } + defer func(ws *websocket.Conn) { + err = ws.Close() + if err != nil { + log.Fatalln(err) + } + }(ws) + MsgHandler(c, ws) +} + +func MsgHandler(c *gin.Context, ws *websocket.Conn) { + // fmt.Printf("err--2->%s\n", ws) + for { + + msg, err := Subscribe(c, PublishKey) + fmt.Printf("err--2->%v--2->%v\n", msg, err) + if err != nil { + logrus.Errorf("Subscribe error: %s", err.Error()) + fmt.Printf("Subscribe error: %s\n", err.Error()) + } + + tm := time.Now().Format("2006-01-02 15:04:05") + fmt.Printf("tm--->%v\n", tm) + m := fmt.Sprintf("[ws][%s]:%s", tm, msg) + err = ws.WriteMessage(1, []byte(m)) + fmt.Printf("m--->%v\n", m) + fmt.Printf("err--->%v\n", err) + if err != nil { + log.Fatalln(err) + } + } +} diff --git a/api/version1/webStocetmsg/redis_test.go b/api/version1/webStocetmsg/redis_test.go new file mode 100644 index 0000000..a608967 --- /dev/null +++ b/api/version1/webStocetmsg/redis_test.go @@ -0,0 +1,25 @@ +package webstocetmsg + +import ( + "context" + "testing" + "time" + + "github.com/sirupsen/logrus" +) + +var ctx context.Context + +func init() { + ctx = context.Background() +} + +// TestPublish 测试发布消息到redis +func TestPublish(t *testing.T) { + msg := "当前时间: " + time.Now().Format("15:04:05") + logrus.Debugf("[publish] msg: %s", msg) + err := Publish(ctx, PublishKey, msg) + if err != nil { + logrus.Errorf("publish error: %s", err.Error()) + } +} diff --git a/api/version1/webStocetmsg/type.go b/api/version1/webStocetmsg/type.go new file mode 100644 index 0000000..516f85f --- /dev/null +++ b/api/version1/webStocetmsg/type.go @@ -0,0 +1,42 @@ +package webstocetmsg + +import ( + "appPlatform/overall/publicmethod" + "sync" + + "github.com/gin-gonic/gin" + "github.com/gorilla/websocket" +) + +type ApiMethod struct{} + +// webstocet相关设定 +func (a *ApiMethod) Index(c *gin.Context) { + outputCont := publicmethod.MapOut[string]() + outputCont["index"] = "webstocet项目入口" + publicmethod.Result(0, outputCont, c) +} + +// Client 组件的作用,是当用户与消息服务中某个实例建立连接后,管理这个连接的信息 +type Client struct { + UUID string `json:"uuid"` //对连接进行唯一性的标识,通过此标识可以查找到连接信息 + UserID string `json:"userid` //用户 ID。 + Socket *websocket.Conn `json:"socket"` //连接对象。 + Send chan []byte `json:"send"` //消息数据 channel。 +} + +// ClientManager 组件相当于连接池,可以管理所有的终端连接,并提供注册、注销、续期功能 +type ClientManager struct { + sync.RWMutex + Clients map[string]*Client //是一个集合,用于存储创建的 Client 对象。 + Register chan *Client //注册的 channel。1:把连接注册到 Clients 中,并通过 key-value 加入 Client 集合中,key 是连接的唯一性标识 ,value 是连接本身;2:把连接的唯一性标识和用户的 ID 以及建立连接的 pod address 信息,存储到 redis 中 + Unregister chan *Client //注销的 channel.1:从 ClientManager 组件的 Clients 集合中移除连接对象;2:删除 redis 对应的缓存信息。 + Renewal chan *Client //续期的 channel,用于对 redis 的键续期 +} + +// Message 接收和发送消息体 +type Message struct { + Message string `json:"message"` + Content string `json:"Content"` + Recipient string `json:"Recipient"` +} diff --git a/api/version1/webStocetmsg/ws.go b/api/version1/webStocetmsg/ws.go new file mode 100644 index 0000000..ab7ce5c --- /dev/null +++ b/api/version1/webStocetmsg/ws.go @@ -0,0 +1,127 @@ +package webstocetmsg + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "net" + "net/http" + + "github.com/gin-gonic/gin" + "github.com/gorilla/websocket" +) + +var upGraderes = websocket.Upgrader{ + CheckOrigin: func(r *http.Request) bool { + return true + }, +} + +func (a *ApiMethod) Regist(c *gin.Context) { + conn, err := upGraderes.Upgrade(c.Writer, c.Request, nil) + if err != nil { + fmt.Println("websocket error:", err) + return + } + //得到客户的连接ip和端口 + fmt.Println("client connect:", conn.RemoteAddr()) + go a.Do(conn) +} + +func (a *ApiMethod) Do(conn *websocket.Conn) { + for { + //获取到前端发送过来的websocket消息 + contentType, message, err := conn.ReadMessage() + if err != nil { + //判断是不是超时 + if netErr, ok := err.(net.Error); ok { + if netErr.Timeout() { + fmt.Printf("ReadMessage timeout remote:%v\n", conn.RemoteAddr()) + + } + } + // 其他错误,如果是 1001 和 1000,就不打印日志 + if websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway, websocket.CloseNormalClosure) { + fmt.Println("其他错误") + } + + conn.Close() + //这边必须return,因为前端的链接可能某个时间段就断开链接了,要是没有return,会导致产生 repeated read on failed websocket connection报错,而且也可以防止内存泄露 + return + } + + fmt.Printf("contentType:%v\n", contentType) + fmt.Printf("message:%v\n", string(message)) + //写入ws + msg := []byte("我是server") + err = conn.WriteMessage(1, msg) + if err != nil { + fmt.Println("发生错误了") + fmt.Println(err.Error()) + } + } +} + +func (c *Client) SendOut(message *Message) error { + content, err := json.Marshal(message.Content) + if err != nil { + return err + } + c.Send <- content + return nil +} + +func (manager *ClientManager) Write(message *Message) error { + manager.RLock() + client, ok := manager.Clients[message.Recipient] + manager.RUnlock() + if !ok { + return errors.New("client miss [" + message.Recipient + "]") + } + return client.SendOut(message) +} + +/* +* +@ 作者: 秦东 +@ 时间: 2024-08-16 16:14:22 +@ 功能: Start 方法提供监听注册、注销以及续期的 channel,通过监听这些 channel 来管理创建的连接对象。当这些 channel 有数据时,执行对应的操作。 +@ 参数 + + # + +@ 返回值 + + # + +@ 方法原型 + + # +*/ +func (manager *ClientManager) Start(ctx context.Context) { + // for { + // select { + // case conn := <-manager.Register: + // manager.Lock() + // manager.Clients[conn.UUID] = conn + // manager.Unlock() + // _, err := manager.affair.Register(ctx, &RegisterReq{ + // UserID: conn.UserID, + // UUID: conn.UUID, + // IP: manager.IP, + // }) + // case conn := <-manager.Unregister: + // _, err := manager.affair.Unregister(ctx, &UnregisterReq{ + // UserID: conn.UserID, + // UUID: conn.UUID, + // }) + // conn.Socket.Close() + // close(conn.Send) + // delete(manager.Clients, conn.UUID) + // case conn := <-manager.Renewal: + // //... + // // Key renewal to redis + // } + // } +} diff --git a/api/version1/webStocetmsg/wsHandel.go b/api/version1/webStocetmsg/wsHandel.go new file mode 100644 index 0000000..14ef112 --- /dev/null +++ b/api/version1/webStocetmsg/wsHandel.go @@ -0,0 +1,71 @@ +package webstocetmsg + +import ( + "fmt" + + "github.com/gorilla/websocket" +) + +/* +* +@ 作者: 秦东 +@ 时间: 2024-08-16 15:57:05 +@ 功能: 读取消息.Read 方法比较简单,从终端接收请求消息后,消息实例通过 WebSocket 回应接收消息状态,并不返回请求结果。结果通过 Write 方法返回。 +@ 参数 + + # + +@ 返回值 + + # + +@ 方法原型 + + # +*/ +func (c *Client) Read(close, renewal chan *Client) { + defer func() { + close <- c + }() + for { + _, message, err := c.Socket.ReadMessage() + if err != nil { + fmt.Printf("错误信息(1):%v\n", err) + break + } + fmt.Printf("获取的消息:%v\n", message) + } +} + +/* +* +@ 作者: 秦东 +@ 时间: 2024-08-16 16:06:47 +@ 功能: Write 方法将请求结果返回给终端。Client 会监听 send channel,当 channel 有数据时,通过 socket 连接将消息发送给终端。 +@ 参数 + + # + +@ 返回值 + + # + +@ 方法原型 + + # +*/ +func (c *Client) Write(close chan *Client) { + for { + select { + case message, ok := <-c.Send: + if !ok { + fmt.Printf("错误信息(2):%v\n", ok) + return + } + c.Socket.WriteMessage(websocket.TextMessage, message) + default: + fmt.Printf("错误信息(3):%v\n", close) + return + } + } +} diff --git a/apirouter/apishiyan/maptostruct.go b/apirouter/apishiyan/maptostruct.go index 482c130..290666f 100644 --- a/apirouter/apishiyan/maptostruct.go +++ b/apirouter/apishiyan/maptostruct.go @@ -39,6 +39,8 @@ func (a *ApiRouter) RouterGroup(router *gin.RouterGroup) { apiRouter.POST("getAllOrgSun", methodBinding.GetAllOrgSun) //获取行政组织所有子类 apiRouter.POST("gainDateCenter", methodBinding.GainDateCenter) //获取行政组织所有子类 + apiRouter.POST("gainAppPageInfo", methodBinding.GainAppPageInfo) //获取行政组织所有子类 + } } func (a *ApiRouter) RouterGroupVerify(router *gin.RouterGroup) { diff --git a/apirouter/entry.go b/apirouter/entry.go index 1664fae..456d6e0 100644 --- a/apirouter/entry.go +++ b/apirouter/entry.go @@ -15,6 +15,7 @@ import ( "appPlatform/apirouter/v1/redisRouter" "appPlatform/apirouter/v1/taskrouter" userrouters "appPlatform/apirouter/v1/userRouters" + websocketrouter "appPlatform/apirouter/v1/webSocketRouter" workwechatrouter "appPlatform/apirouter/v1/workWechatRouter" ) @@ -35,6 +36,7 @@ type RouterGroup struct { MathsRouter mathsrouter.ApiRouter WorkWechatRouter workwechatrouter.ApiRouter DataCenterRouter datacenterrouter.ApiRouter + WebSocketRouters websocketrouter.ApiRouter } var RouterGroupEntry = new(RouterGroup) diff --git a/apirouter/v1/customerformrouter/router.go b/apirouter/v1/customerformrouter/router.go index b42a1e0..3cef294 100644 --- a/apirouter/v1/customerformrouter/router.go +++ b/apirouter/v1/customerformrouter/router.go @@ -58,6 +58,8 @@ func (a *ApiRouter) RouterGroupPc(router *gin.RouterGroup) { apiRouter.POST("setOftenApp", methodBinding.SetOftenApp) //编辑常用自定义App + apiRouter.POST("gainFormPageMapCont", methodBinding.GainFormPageMapCont) //获取表单地图翻页数据 + } appApiRouter := router.Group("app") @@ -88,5 +90,6 @@ func (a *ApiRouter) RouterGroupPc(router *gin.RouterGroup) { appApiRouter.POST("gianAppFormTable", methodAppHand.GianAppFormTable) //获取应用下属表单 appApiRouter.POST("setCustomerFormState", methodAppHand.SetCustomerFormState) //设置自定义表单状态 appApiRouter.POST("appJwtPower", methodAppHand.AppJwtPower) //鉴定当权人员是否有权限使用 + appApiRouter.POST("editAppMenusIcon", methodAppHand.EditAppMenusIcon) //编辑APP菜单图标 } } diff --git a/apirouter/v1/taskrouter/taskrouter.go b/apirouter/v1/taskrouter/taskrouter.go index 1ce998e..75b1893 100644 --- a/apirouter/v1/taskrouter/taskrouter.go +++ b/apirouter/v1/taskrouter/taskrouter.go @@ -32,6 +32,7 @@ func (a *ApiRouter) RouterGroupPc(router *gin.RouterGroup) { apiRouter.POST("softDeletion", taskManagementRouter.SoftDeletion) //删除任务数据 apiRouter.POST("editCustomerTable", taskManagementRouter.EditCustomerTable) //编辑任务 apiRouter.POST("gainEditDataLog", taskManagementRouter.GainEditDataLog) //获取修改记录 + apiRouter.POST("gainEditDataNewLog", taskManagementRouter.GainEditDataNewLog) //获取修改记录(新版) apiRouter.POST("echoTableFormPage", taskManagementRouter.EchoTableFormPage) //添加任务是回显表单数据,若有流程回显流程 apiRouter.POST("realTimeUpdateFlow", taskManagementRouter.RealTimeUpdateFlow) //根据表单数据实时更新流程 diff --git a/apirouter/v1/webSocketRouter/type.go b/apirouter/v1/webSocketRouter/type.go new file mode 100644 index 0000000..6af2b7c --- /dev/null +++ b/apirouter/v1/webSocketRouter/type.go @@ -0,0 +1,3 @@ +package websocketrouter + +type ApiRouter struct{} diff --git a/apirouter/v1/webSocketRouter/ws.go b/apirouter/v1/webSocketRouter/ws.go new file mode 100644 index 0000000..fa87e05 --- /dev/null +++ b/apirouter/v1/webSocketRouter/ws.go @@ -0,0 +1,28 @@ +package websocketrouter + +import ( + "appPlatform/api/version1" + + "github.com/gin-gonic/gin" +) + +// webSocket路由 +func (a *ApiRouter) RouterGroupPc(router *gin.RouterGroup) { + apiRouter := router.Group("ws") + + var webSocketRouterPath = version1.AppApiEntry.WebSocketApi + { + apiRouter.GET("", webSocketRouterPath.Index) //入口 + apiRouter.POST("", webSocketRouterPath.Index) //入口 + apiRouter.GET("/regist", webSocketRouterPath.Regist) //入口 + apiRouter.GET("/websocketDemo", webSocketRouterPath.WebsocketDemo) //入口 + } +} +func (a *ApiRouter) RouterGroupWs(router *gin.Engine) { + apiRouter := router.Group("wss") + + var webSocketRouterPath = version1.AppApiEntry.WebSocketApi + { + apiRouter.GET("/regist", webSocketRouterPath.Regist) //入口 + } +} diff --git a/go.mod b/go.mod index 0fde37a..663088f 100644 --- a/go.mod +++ b/go.mod @@ -7,11 +7,16 @@ 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/golang-module/carbon v1.7.3 + github.com/google/uuid v1.4.0 + github.com/gorilla/websocket v1.5.3 github.com/mitchellh/mapstructure v1.5.0 github.com/mozillazg/go-pinyin v0.20.0 github.com/redis/go-redis/v9 v9.3.0 github.com/robfig/cron/v3 v3.0.1 + github.com/sirupsen/logrus v1.9.3 github.com/spf13/viper v1.16.0 + gopkg.in/ini.v1 v1.67.0 gorm.io/driver/mysql v1.5.2 gorm.io/gorm v1.25.5 ) @@ -27,10 +32,14 @@ require ( github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-playground/validator/v10 v10.14.0 // indirect github.com/go-sql-driver/mysql v1.7.1 // indirect + github.com/gobuffalo/envy v1.7.0 // indirect + github.com/gobuffalo/packd v0.3.0 // indirect + github.com/gobuffalo/packr v1.30.1 // indirect github.com/goccy/go-json v0.10.2 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/jinzhu/inflection v1.0.0 // indirect github.com/jinzhu/now v1.1.5 // indirect + github.com/joho/godotenv v1.3.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/klauspost/cpuid/v2 v2.2.4 // indirect github.com/leodido/go-urn v1.2.4 // indirect @@ -39,6 +48,7 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/pelletier/go-toml/v2 v2.1.0 // indirect + github.com/rogpeppe/go-internal v1.11.0 // indirect github.com/spf13/afero v1.11.0 // indirect github.com/spf13/cast v1.6.0 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect @@ -48,11 +58,11 @@ require ( github.com/ugorji/go/codec v1.2.11 // indirect golang.org/x/arch v0.3.0 // indirect golang.org/x/crypto v0.16.0 // indirect + golang.org/x/mod v0.9.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect - gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index a1b9800..cfb55ae 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,5 @@ +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs= github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA= github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM= @@ -8,6 +10,10 @@ github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY= github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 h1:qSGYFH7+jGhDF8vLC+iwCD4WpbV1EBDSzWkJODFLams= github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -18,6 +24,7 @@ github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cu github.com/flipped-aurora/gin-vue-admin/server v0.0.0-20231212025023-e0a8e9370425 h1:XTvBOk+EFcon1fL8gzFRN2N7jGvc2QGZMqWF+evZT10= github.com/flipped-aurora/gin-vue-admin/server v0.0.0-20231212025023-e0a8e9370425/go.mod h1:zsseaaJleMl86IDc9evuQx6gJYfdG0kW67+MTVxwTAU= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU= @@ -36,31 +43,57 @@ github.com/go-playground/validator/v10 v10.14.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QX 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= +github.com/gobuffalo/envy v1.7.0 h1:GlXgaiBkmrYMHco6t4j7SacKO4XUjvh5pwXh0f4uxXU= +github.com/gobuffalo/envy v1.7.0/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI= +github.com/gobuffalo/logger v1.0.0/go.mod h1:2zbswyIUa45I+c+FLXuWl9zSWEiVuthsk8ze5s8JvPs= +github.com/gobuffalo/packd v0.3.0 h1:eMwymTkA1uXsqxS0Tpoop3Lc0u3kTfiMBE6nKtQU4g4= +github.com/gobuffalo/packd v0.3.0/go.mod h1:zC7QkmNkYVGKPw4tHpBQ+ml7W/3tIebgeo1b36chA3Q= +github.com/gobuffalo/packr v1.30.1 h1:hu1fuVR3fXEZR7rXNW3h8rqSML8EVAf6KNm0NKO/wKg= +github.com/gobuffalo/packr v1.30.1/go.mod h1:ljMyFO2EcrnzsHsN99cvbq055Y9OhRrIaviy289eRuk= +github.com/gobuffalo/packr/v2 v2.5.1/go.mod h1:8f9c96ITobJlPzI44jj+4tHnEKNt0xXWSVlXRN9X1Iw= github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= +github.com/golang-module/carbon v1.7.3 h1:p5mUZj7Tg62MblrkF7XEoxVPvhVs20N/kimqsZOQ+/U= +github.com/golang-module/carbon v1.7.3/go.mod h1:nUMnXq90Rv8a7h2+YOo2BGKS77Y0w/hMPm4/a8h19N8= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4= +github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= +github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ= github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= +github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc= +github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/karrick/godirwalk v1.10.12/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.2.4 h1:acbojRNwl3o09bUq+yDCtZFc1aiwaAAxtcn8YkZXnvk= github.com/klauspost/cpuid/v2 v2.2.4/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q= github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -70,6 +103,7 @@ 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/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= 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= @@ -78,18 +112,32 @@ github.com/redis/go-redis/v9 v9.3.0 h1:RiVDjmig62jIWp7Kk4XVLs0hzV6pI3PyTnnL0cnn0 github.com/redis/go-redis/v9 v9.3.0/go.mod h1:hdY0cQFCN4fnSYT6TkisLufl/4W5UIXyv0b/CLO2V2M= github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs= github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro= +github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= +github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= +github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= +github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/spf13/viper v1.16.0 h1:rGGH0XDZhdUOryiDWjmIvUSWpbNqisK8Wk0Vyefw8hc= github.com/spf13/viper v1.16.0/go.mod h1:yg78JgCJcbrQOvV9YLXgkLaZqUidkY9K+Dd1FofRzQg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= @@ -105,30 +153,51 @@ github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8 github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= +github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU= github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= golang.org/x/arch v0.3.0 h1:02VY4/ZcO/gBOH6PUaoiptASxtXU10jazRCP865E97k= golang.org/x/arch v0.3.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= +golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY= golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/mod v0.9.0 h1:KENHtAZL2y3NLMYZeHY9DW8HW8V+kQyJsY/V9JlKvCs= +golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190515120540-06a5c4944438/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/tools v0.0.0-20190624180213-70d37148ca0c/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= 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/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 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= diff --git a/initialization/route/initRoute.go b/initialization/route/initRoute.go index 27c4c3c..1c378c2 100644 --- a/initialization/route/initRoute.go +++ b/initialization/route/initRoute.go @@ -27,6 +27,11 @@ func InitialRouter() *gin.Engine { appLoadRouterGroup.POST("/", func(c *gin.Context) { c.JSON(0, "通讯成功!") }) + wevSocketApi := apirouter.RouterGroupEntry.WebSocketRouters + { + wevSocketApi.RouterGroupPc(appLoadRouterGroup) + // wevSocketApi.RouterGroupWs(appLoadRouterGroup) + } //实验路由 shiyanApi := apirouter.RouterGroupEntry.ShiyanApi diff --git a/models/modelshr/man_cont.go b/models/modelshr/man_cont.go index 4e71cae..c2a700b 100644 --- a/models/modelshr/man_cont.go +++ b/models/modelshr/man_cont.go @@ -62,6 +62,7 @@ type ManCont struct { CareerPlanning string `json:"career_planning" gorm:"column:career_planning;type:longtext;default:'';not null;comment:职业生涯规划"` HelpObtained string `json:"help_obtained" gorm:"column:help_obtained;type:longtext;default:'';not null;comment:个人期望从组织获得的帮助"` Hobby string `json:"hobby" gorm:"column:hobby;type:text;default:'';not null;comment:爱好"` + PersonInCharge int `json:"personInCharge" gorm:"column:person_in_charge;type:int(10) unsigned;default:1;comment:负责人(1:是;2:否)"` } func (ManCont *ManCont) TableName() string { diff --git a/overall/publicmethod/technique.go b/overall/publicmethod/technique.go index 02ebf7d..826f2ab 100644 --- a/overall/publicmethod/technique.go +++ b/overall/publicmethod/technique.go @@ -218,6 +218,11 @@ func UnixTimeToDay(timeStamp int64, timeType int) (dateStr string) { timeTemplate = "2" case 40: timeTemplate = "2006/01" + case 41: //当前年第几周 + timeDay := TimeUnixToTime(timeStamp, "s") + year, week := timeDay.ISOWeek() + dateStr = fmt.Sprintf("%v年第%v周", year, week) + return dateStr default: timeTemplate = "2006-01-02 15:04:05" //常规类型 } @@ -2848,3 +2853,14 @@ func RemoveReservedWord(val string) bool { reservedWord := []string{"id", "masters_key", "creater_time", "edit_time", "flow_id", "states", "flowIsOpen", "explicate"} return IsInTrue[string](val, reservedWord) } + +/* +* +@ 作者: 秦东 +@ 时间: 2024-04-07 08:26:39 +@ 功能: 去除字段保留字 +*/ +func RemoveReservedWordTime(val string) bool { + reservedWord := []string{"datetimerange", "daterange", "monthrange"} + return IsInTrue[string](val, reservedWord) +}