You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1346 lines
41 KiB
1346 lines
41 KiB
package customerform
|
|
|
|
import (
|
|
"appPlatform/models/customerForm"
|
|
"appPlatform/models/modelAppPlatform"
|
|
"appPlatform/models/modelshr"
|
|
"appPlatform/overall"
|
|
"appPlatform/overall/publicmethod"
|
|
"encoding/json"
|
|
"fmt"
|
|
"strconv"
|
|
"strings"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2024-07-08 15:41:37
|
|
@ 功能: 多视图数据处理
|
|
@ 参数
|
|
|
|
#
|
|
|
|
@ 返回值
|
|
|
|
#
|
|
|
|
@ 方法原型
|
|
|
|
#
|
|
*/
|
|
func (a *ApiMethod) MultiViewPAge(c *gin.Context) {
|
|
var requestData ViewListSearch
|
|
c.ShouldBindJSON(&requestData)
|
|
if requestData.FormId == "" {
|
|
publicmethod.Result(1, requestData, 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 formList []map[string]interface{}
|
|
sendListInfo := publicmethod.MapOut[string]()
|
|
var sendTimeList []interface{}
|
|
tableName := fmt.Sprintf("`%v` as f", formInfo.TableKey)
|
|
gormDb := overall.CONSTANT_DB_CustomerForm.Table(tableName).Select("f.*,t.status as taskStatus,t.runFlowId")
|
|
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)
|
|
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)
|
|
switch requestData.ViewClass.Class {
|
|
case "date":
|
|
gormDb = gormDb.Order("`id` DESC")
|
|
case "time":
|
|
if requestData.ViewClass.SortWord != "" {
|
|
if requestData.ViewClass.Sort == 1 {
|
|
gormDb = gormDb.Order(fmt.Sprintf("`%v` DESC", requestData.ViewClass.SortWord))
|
|
} else {
|
|
gormDb = gormDb.Order(fmt.Sprintf("`%v` ASC", requestData.ViewClass.SortWord))
|
|
}
|
|
} else {
|
|
if requestData.ViewClass.Sort == 1 {
|
|
gormDb = gormDb.Order("`id` DESC")
|
|
} else {
|
|
gormDb = gormDb.Order("`id` ASC")
|
|
}
|
|
}
|
|
case "gantt":
|
|
if requestData.ViewClass.SortWord != "" {
|
|
if requestData.ViewClass.Sort == 1 {
|
|
gormDb = gormDb.Order(fmt.Sprintf("`%v` DESC", requestData.ViewClass.SortWord))
|
|
} else {
|
|
gormDb = gormDb.Order(fmt.Sprintf("`%v` ASC", requestData.ViewClass.SortWord))
|
|
}
|
|
} else {
|
|
if requestData.ViewClass.Sort == 1 {
|
|
gormDb = gormDb.Order("`id` DESC")
|
|
} else {
|
|
gormDb = gormDb.Order("`id` ASC")
|
|
}
|
|
}
|
|
case "map":
|
|
if requestData.ViewClass.SortWord != "" {
|
|
if requestData.ViewClass.Sort == 1 {
|
|
gormDb = gormDb.Order(fmt.Sprintf("`%v` DESC", requestData.ViewClass.SortWord))
|
|
} else {
|
|
gormDb = gormDb.Order(fmt.Sprintf("`%v` ASC", requestData.ViewClass.SortWord))
|
|
}
|
|
} else {
|
|
if requestData.ViewClass.Sort == 1 {
|
|
gormDb = gormDb.Order("`id` DESC")
|
|
} else {
|
|
gormDb = gormDb.Order("`id` ASC")
|
|
}
|
|
}
|
|
default:
|
|
gormDb = gormDb.Order("`id` DESC")
|
|
}
|
|
err = gormDb.Find(&formList).Error
|
|
if err != nil && len(formList) < 1 {
|
|
publicmethod.Result(0, err, c)
|
|
return
|
|
}
|
|
// pageMyTola := len()
|
|
// fmt.Printf("列表数据解析---1->%v\n", formInfo.ListJson)
|
|
|
|
//获取任务状态
|
|
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"] = strconv.FormatInt(runFlowInfo.Id, 10)
|
|
formList[i]["runFlowId"] = strconv.FormatInt(runFlowInfo.Id, 10)
|
|
// 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 requestData.OlaData != "" {
|
|
var oldDataAry interface{}
|
|
err = json.Unmarshal([]byte(requestData.OlaData), &oldDataAry)
|
|
if err == nil {
|
|
if oldVal, ok := oldDataAry.([]interface{}); ok {
|
|
var oldList []map[string]interface{}
|
|
for _, v := range oldVal {
|
|
if mv, mvOk := v.(map[string]interface{}); mvOk {
|
|
if mvla, isOk := mv["class_type$unit"]; isOk {
|
|
timeInt, _ := publicmethod.StringToInt64(mvla)
|
|
if timeInt != 1 {
|
|
oldInfo := publicmethod.MapOut[string]()
|
|
for key, val := range mv {
|
|
if key != "class_type$unit" {
|
|
oldInfo[key] = val
|
|
}
|
|
if key == "creater_time" {
|
|
// creTime, _ := publicmethod.StringToInt64(mvla)
|
|
// oldInfo[key] =
|
|
if sVal, isTrue := val.(string); isTrue {
|
|
var creTimeAll publicmethod.DateTimeTotimes
|
|
creTimeAll.BaisStrToTime(sVal)
|
|
creTime, _ := publicmethod.StringToInt64(creTimeAll.AllTime)
|
|
oldInfo[key] = creTime
|
|
}
|
|
// fmt.Printf("formList----> %T----> %v\n", val, val)
|
|
}
|
|
if key == "edit_time" {
|
|
if sVal, isTrue := val.(string); isTrue {
|
|
var creTimeAll publicmethod.DateTimeTotimes
|
|
creTimeAll.BaisStrToTime(sVal)
|
|
creTime, _ := publicmethod.StringToInt64(creTimeAll.AllTime)
|
|
oldInfo[key] = creTime
|
|
}
|
|
}
|
|
}
|
|
oldList = append(oldList, oldInfo)
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
// fmt.Printf("mvla----> %T----> %v\n", oldList, oldList)
|
|
if len(oldList) > 0 {
|
|
oldList = append(oldList, formList...)
|
|
formList = oldList
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// fmt.Printf("formList----> %v----> %v\n", len(formList), formList)
|
|
if formInfo.ListJson != "" {
|
|
var listFieldsMap ListPageFields
|
|
err = json.Unmarshal([]byte(formInfo.ListJson), &listFieldsMap)
|
|
var formJsonCont CustomerFormMaster
|
|
if formInfo.MastesFormJson != "" {
|
|
json.Unmarshal([]byte(formInfo.MastesFormJson), &formJsonCont)
|
|
}
|
|
// fmt.Printf("列表数据解析---->%v\n", err)
|
|
if err == nil {
|
|
lik, formListAry, dayAry := listFieldsMap.TimeViewWordHandle(formList, requestData.ViewClass, formJsonCont)
|
|
// timeAry := publicmethod.MapOut[string]()
|
|
sendListInfo["listInfo"] = formListAry
|
|
sendListInfo["dayList"] = dayAry
|
|
sendListInfo["lik"] = lik
|
|
for _, lv := range lik {
|
|
if len(lv.List) > 0 {
|
|
for _, lvlv := range lv.List {
|
|
sendTimeList = append(sendTimeList, lvlv)
|
|
}
|
|
// sendTimeList = append(sendTimeList, lv)
|
|
}
|
|
}
|
|
|
|
// formList = appenlikd(formList, timeAry)
|
|
}
|
|
}
|
|
publicmethod.ResultList(0, requestData.Page, requestData.PageSize, total, int64(len(formList)), sendTimeList, c)
|
|
}
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2024-07-09 08:57:05
|
|
@ 功能: 时间轴视图数据输出
|
|
@ 参数
|
|
|
|
#
|
|
|
|
@ 返回值
|
|
|
|
#
|
|
|
|
@ 方法原型
|
|
|
|
#
|
|
*/
|
|
func (l *ListPageFields) TimeViewWordHandle(listData []map[string]interface{}, viewCalss ViewKeyType, formJsonCont CustomerFormMaster) ([]TimeFenGe, []map[string]interface{}, []string) {
|
|
|
|
// fmt.Printf("TimeViewWordHandle:%v------------>%v\n", len(listData), listData)
|
|
|
|
var sendList []map[string]interface{}
|
|
var dayAry []string
|
|
var lik []TimeFenGe
|
|
switch viewCalss.Class {
|
|
case "date":
|
|
|
|
case "time":
|
|
_, _, listTime := l.GainStartOrEndTime(listData, viewCalss)
|
|
lik = listTime
|
|
// startTime := int64(0)
|
|
// endTime := int64(0)
|
|
// sendInfo := publicmethod.MapOut[string]()
|
|
// for _, lv := range listData {
|
|
|
|
// for mi, mv := range lv {
|
|
// if mi == viewCalss.SortWord {
|
|
// mvInt, _ := publicmethod.StringToInt64(mv)
|
|
// if startTime == 0 && endTime == 0 {
|
|
// startTime = mvInt
|
|
// endTime = mvInt
|
|
// } else {
|
|
// if startTime <= mvInt {
|
|
// startTime = mvInt
|
|
// }
|
|
// if endTime >= mvInt {
|
|
// endTime = mvInt
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
|
|
// }
|
|
// jsondd, _ := json.Marshal(listTime)
|
|
// fmt.Printf("猎头结果:%v================%v================%v\n", len(listTime), string(jsondd), listTime)
|
|
for _, v := range listTime {
|
|
if len(v.List) > 0 {
|
|
info := publicmethod.MapOut[string]()
|
|
info[v.DateTime] = v.List
|
|
sendList = append(sendList, info)
|
|
dayAry = append(dayAry, v.DateTime)
|
|
// for _, lv := range v.List {
|
|
// sendList = append(sendList, lv)
|
|
// }
|
|
}
|
|
}
|
|
// sendList = listTime
|
|
case "gantt":
|
|
|
|
case "map":
|
|
|
|
default:
|
|
sendList = l.DevelopSpecificationsSend(listData, formJsonCont)
|
|
}
|
|
// fmt.Printf("获取起止时间--->%v---->%v\n", len(lik), lik)
|
|
return lik, sendList, dayAry
|
|
}
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2024-07-09 10:14:44
|
|
@ 功能: 获取起止时间
|
|
@ 参数
|
|
|
|
#
|
|
|
|
@ 返回值
|
|
|
|
#
|
|
|
|
@ 方法原型
|
|
|
|
#
|
|
*/
|
|
func (l *ListPageFields) GainStartOrEndTime(listData []map[string]interface{}, viewCalss ViewKeyType) (startTime, endTime int64, sendTime []TimeFenGe) {
|
|
for _, lv := range listData {
|
|
for mi, mv := range lv {
|
|
if mi == viewCalss.SortWord {
|
|
mvInt, _ := publicmethod.StringToInt64(mv)
|
|
if startTime == 0 && endTime == 0 {
|
|
startTime = mvInt
|
|
endTime = mvInt
|
|
} else {
|
|
if startTime <= mvInt {
|
|
startTime = mvInt
|
|
}
|
|
if endTime >= mvInt {
|
|
endTime = mvInt
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
tianShu, _ := publicmethod.DayBetweenDate(publicmethod.UnixTimeToDay(startTime, 14), publicmethod.UnixTimeToDay(endTime, 14))
|
|
// fmt.Printf("天数: %v\n", tianShu)
|
|
if viewCalss.Sort == 1 {
|
|
beginTime := publicmethod.TimeUnixToTime(startTime, "s")
|
|
for i := 0; i <= tianShu; i++ {
|
|
yesterday := beginTime.AddDate(0, 0, -i)
|
|
var timeInfo TimeFenGe
|
|
riqi := publicmethod.UnixTimeToDay(yesterday.Unix(), 14)
|
|
timeInfo.DateTime = riqi
|
|
timeInfo.WeekDay, _ = publicmethod.GetWeekday(riqi)
|
|
timeInfo.Day = publicmethod.UnixTimeToDay(yesterday.Unix(), 18)
|
|
timeInfo.Stor = i
|
|
timeInfo.TimeUnix = yesterday.Unix()
|
|
begin, end := publicmethod.TimeUnixDayStartAndEnd(yesterday.Unix())
|
|
timeInfo.StartAndEnd.Start = begin
|
|
timeInfo.StartAndEnd.End = end
|
|
listAry := l.DaBaoShuJu(viewCalss.SortWord, begin, end, listData)
|
|
if len(listAry) > 0 {
|
|
gd := make(map[string]interface{})
|
|
gd["dateTime"] = publicmethod.UnixTimeToDay(yesterday.Unix(), 40)
|
|
gd["weekDay"], _ = publicmethod.GetWeekday(riqi)
|
|
gd["day"] = publicmethod.UnixTimeToDay(yesterday.Unix(), 18)
|
|
gd["class_type$unit"] = 1
|
|
timeInfo.List = append(timeInfo.List, gd)
|
|
timeInfo.List = append(timeInfo.List, listAry...)
|
|
} else {
|
|
timeInfo.List = l.DaBaoShuJu(viewCalss.SortWord, begin, end, listData)
|
|
}
|
|
|
|
// DaBaoShuJu(riqi, viewCalss.SortWord, begin, end, listData)
|
|
sendTime = append(sendTime, timeInfo)
|
|
}
|
|
} else {
|
|
beginTime := publicmethod.TimeUnixToTime(endTime, "s")
|
|
for i := 0; i <= tianShu; i++ {
|
|
yesterday := beginTime.AddDate(0, 0, -i)
|
|
var timeInfo TimeFenGe
|
|
riqi := publicmethod.UnixTimeToDay(yesterday.Unix(), 14)
|
|
timeInfo.DateTime = riqi
|
|
timeInfo.WeekDay, _ = publicmethod.GetWeekday(riqi)
|
|
timeInfo.Day = publicmethod.UnixTimeToDay(yesterday.Unix(), 18)
|
|
timeInfo.Stor = i
|
|
timeInfo.TimeUnix = yesterday.Unix()
|
|
begin, end := publicmethod.TimeUnixDayStartAndEnd(yesterday.Unix())
|
|
timeInfo.StartAndEnd.Start = begin
|
|
timeInfo.StartAndEnd.End = end
|
|
listAry := l.DaBaoShuJu(viewCalss.SortWord, begin, end, listData)
|
|
if len(listAry) > 0 {
|
|
gd := make(map[string]interface{})
|
|
gd["dateTime"] = publicmethod.UnixTimeToDay(yesterday.Unix(), 40)
|
|
gd["weekDay"], _ = publicmethod.GetWeekday(riqi)
|
|
gd["day"] = publicmethod.UnixTimeToDay(yesterday.Unix(), 18)
|
|
gd["class_type$unit"] = 1
|
|
timeInfo.List = append(timeInfo.List, gd)
|
|
timeInfo.List = append(timeInfo.List, listAry...)
|
|
} else {
|
|
timeInfo.List = l.DaBaoShuJu(viewCalss.SortWord, begin, end, listData)
|
|
}
|
|
|
|
// DaBaoShuJu(riqi, viewCalss.SortWord, begin, end, listData)
|
|
sendTime = append(sendTime, timeInfo)
|
|
}
|
|
}
|
|
return
|
|
}
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2024-07-09 11:39:52
|
|
@ 功能: 打包数据
|
|
@ 参数
|
|
|
|
#
|
|
|
|
@ 返回值
|
|
|
|
#
|
|
|
|
@ 方法原型
|
|
|
|
#
|
|
*/
|
|
func (l *ListPageFields) DaBaoShuJu(sortWord string, startTime, endTime int64, listData []map[string]interface{}) (sendData []interface{}) {
|
|
// fmt.Printf("打包--->%v\n", sortWord)
|
|
sc := make([]interface{}, 0)
|
|
for _, v := range listData {
|
|
if mv, ok := v[sortWord]; ok {
|
|
// fmt.Printf("打包--1->%v->%T\n", mv, mv)
|
|
idInt, _ := publicmethod.StringToInt64(mv)
|
|
// fmt.Printf("打包--1->%v->%T->%v->%T\n", mv, mv, idInt, idInt)
|
|
if idInt >= startTime && idInt <= endTime {
|
|
v[sortWord] = publicmethod.UnixTimeToDay(idInt, 11)
|
|
v["class_type$unit"] = 2
|
|
for mi, mv := range v {
|
|
switch mi {
|
|
case "creater":
|
|
if sortWord != "creater" {
|
|
var myInfo modelshr.PersonArchives
|
|
myInfo.GetCont(map[string]interface{}{"`key`": mv}, "`name`")
|
|
v[mi] = myInfo.Name
|
|
}
|
|
|
|
case "creater_time":
|
|
if sortWord != "creater_time" {
|
|
timeInt, _ := publicmethod.StringToInt64(mv)
|
|
v[mi] = publicmethod.UnixTimeToDay(timeInt, 11)
|
|
}
|
|
case "edit_time":
|
|
if sortWord != "edit_time" {
|
|
timeInt, _ := publicmethod.StringToInt64(mv)
|
|
v[mi] = publicmethod.UnixTimeToDay(timeInt, 11)
|
|
}
|
|
default:
|
|
_, v[mi] = l.BaseTableAttrViewField(mi, mv, v)
|
|
// sendInfo[mi] = publicmethod.TypeToInterface(mv)
|
|
}
|
|
|
|
}
|
|
sc = append(sc, v)
|
|
// sendData = append(sendData, sc)
|
|
}
|
|
}
|
|
}
|
|
if len(sc) > 0 {
|
|
// sendVal := publicmethod.MapOut[string]()
|
|
// sendVal[riqi] = sc
|
|
sendData = sc
|
|
}
|
|
return
|
|
}
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2024-04-02 08:14:10
|
|
@ 功能: 按照制定列表字段输出(视图)
|
|
*/
|
|
func (l *ListPageFields) DevelopSpecificViewSend(listData []map[string]interface{}) []map[string]interface{} {
|
|
var sendList []map[string]interface{}
|
|
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
|
|
// myInfo.GetCont(map[string]interface{}{"`key`": mv}, "`name`")
|
|
// sendInfo["创建人"] = myInfo.Name
|
|
// case "creater_time":
|
|
// timeInt, _ := publicmethod.StringToInt64(mv)
|
|
// sendInfo["创建时间"] = publicmethod.UnixTimeToDay(timeInt, 27)
|
|
// case "edit_time":
|
|
// timeInt, _ := publicmethod.StringToInt64(mv)
|
|
// sendInfo["编辑时间"] = publicmethod.UnixTimeToDay(timeInt, 27)
|
|
// case "id":
|
|
// if idInt, ok := mv.(int64); ok {
|
|
// sendInfo["Id"] = strconv.FormatInt(idInt, 10)
|
|
// }
|
|
// idInt, _ := publicmethod.StringToInt64(mv)
|
|
// sendInfo["Id"] = idInt
|
|
// default:
|
|
// // sendInfo[mi] = l.BaseTableAttrField(mi, mv)
|
|
// key, val := l.BaseTableAttrViewField(mi, mv)
|
|
// if key != "" {
|
|
// sendInfo[key] = val
|
|
// }
|
|
|
|
// // sendInfo[mi] = publicmethod.TypeToInterface(mv)
|
|
// }
|
|
key, val := l.BaseTableAttrViewField(mi, mv, v)
|
|
if key != "" {
|
|
sendInfo[key] = val
|
|
}
|
|
}
|
|
// fmt.Printf("================================\n")
|
|
sendList = append(sendList, sendInfo)
|
|
}
|
|
return sendList
|
|
}
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2024-04-02 11:42:20
|
|
@ 功能: 根据字段显示格式处理数据(字段)
|
|
*/
|
|
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
|
|
}
|
|
keyStr := ""
|
|
for _, v := range l.TableData.Columns {
|
|
// fmt.Printf("根据字段显示格式处理数据(字段):%v====>%v\n", key, v.Id)
|
|
if v.Id == key {
|
|
// fmt.Printf("根据字段显示格式处理数据(字段):%v----------------->%v\n", v.Label, v.FieldClass)
|
|
switch v.FieldClass {
|
|
case "checkbox":
|
|
if val != nil {
|
|
var checkboxStrAry []interface{}
|
|
var checkboxAry []string
|
|
if valStr, ok := val.(string); ok {
|
|
err := json.Unmarshal([]byte(valStr), &checkboxStrAry)
|
|
if err == nil {
|
|
for _, v := range checkboxStrAry {
|
|
checkboxAry = append(checkboxAry, publicmethod.TypeToInterface(v))
|
|
}
|
|
}
|
|
}
|
|
|
|
if len(checkboxAry) > 0 {
|
|
var jieGuo []string
|
|
for _, ov := range v.Options {
|
|
intVal, _ := publicmethod.StringToInt64(ov.Value)
|
|
intValStr := strconv.FormatInt(intVal, 10)
|
|
if publicmethod.IsInTrue[string](intValStr, checkboxAry) {
|
|
jieGuo = append(jieGuo, ov.Label)
|
|
}
|
|
}
|
|
val = strings.Join(jieGuo, ",")
|
|
}
|
|
}
|
|
case "orgCentent":
|
|
var orgCont modelshr.AdministrativeOrganization
|
|
orgCont.GetCont(map[string]interface{}{"`id`": val}, "name")
|
|
return v.Label, orgCont.Name
|
|
case "baidumap":
|
|
var mapAry []string
|
|
if valStr, ok := val.(string); ok {
|
|
mapAry = strings.Split(valStr, "|*@*|")
|
|
}
|
|
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)
|
|
}
|
|
}
|
|
}
|
|
return keyStr, val
|
|
}
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2024-07-16 14:02:42
|
|
@ 功能: 根据日期获取数据
|
|
@ 参数
|
|
|
|
#
|
|
|
|
@ 返回值
|
|
|
|
#
|
|
|
|
@ 方法原型
|
|
|
|
#
|
|
*/
|
|
func (a *ApiMethod) GainCalendarList(c *gin.Context) {
|
|
var requestData CalendarSearch
|
|
c.ShouldBindJSON(&requestData)
|
|
|
|
if len(requestData.TimeAry) < 1 && len(requestData.TimeMonthAry) < 1 {
|
|
publicmethod.Result(1, requestData, c, "未知日期!无法获取字段!2")
|
|
return
|
|
}
|
|
if requestData.Search.FormId == "" {
|
|
publicmethod.Result(1, requestData, c, "未知表单!无法获取字段!")
|
|
return
|
|
}
|
|
if requestData.Search.Page == 0 {
|
|
requestData.Search.Page = 1
|
|
}
|
|
if requestData.Search.PageSize == 0 {
|
|
requestData.Search.Page = 20
|
|
}
|
|
|
|
var listField []SearchButtonInfo
|
|
json.Unmarshal([]byte(requestData.Search.SearchData), &listField)
|
|
context, _ := c.Get(overall.MyContJwt)
|
|
var userCont modelshr.ManCont
|
|
userCont.GetLoginCont(context) //当前操作人
|
|
|
|
var formInfo modelAppPlatform.CustomerFormView
|
|
err := formInfo.GetCont(map[string]interface{}{"`cfid`": requestData.Search.FormId, "`status`": 1}, "`tablekey`", "`table_structure`", "`mastesform`", "`mastesformjson`", "`listjson`", "`flowIsOpen`", "`flowkey`")
|
|
if err != nil {
|
|
publicmethod.Result(1, err, c, "未知表单!无法获取字段!")
|
|
return
|
|
}
|
|
var listFieldsMap ListPageFields
|
|
json.Unmarshal([]byte(formInfo.ListJson), &listFieldsMap)
|
|
var formJsonCont CustomerFormMaster
|
|
if formInfo.MastesFormJson != "" {
|
|
json.Unmarshal([]byte(formInfo.MastesFormJson), &formJsonCont)
|
|
}
|
|
if requestData.Types != 1 {
|
|
var listSynv CalendarList
|
|
for _, v := range requestData.TimeAry {
|
|
syncSeting.Add(1)
|
|
go listSynv.GetDayCont(v, formInfo.TableKey, userCont, requestData.Search, listField, listFieldsMap.View, formInfo.ListJson, formJsonCont)
|
|
}
|
|
syncSeting.Wait()
|
|
sendListArt := TimeHaveAry(requestData.TimeAry, listSynv.List)
|
|
if len(sendListArt) == 1 {
|
|
var onInfo TimeAryInfo
|
|
for _, v := range sendListArt {
|
|
onInfo = v
|
|
}
|
|
publicmethod.Result(0, onInfo, c)
|
|
return
|
|
}
|
|
publicmethod.Result(0, sendListArt, c)
|
|
} else {
|
|
var sendMonthList []interface{}
|
|
for _, v := range requestData.TimeMonthAry {
|
|
var listSynv CalendarList
|
|
for _, tv := range v {
|
|
syncSeting.Add(1)
|
|
go listSynv.GetDayCont(tv, formInfo.TableKey, userCont, requestData.Search, listField, listFieldsMap.View, formInfo.ListJson, formJsonCont)
|
|
}
|
|
syncSeting.Wait()
|
|
// sendListArt := TimeHaveAry(v, listSynv.List)
|
|
// fmt.Printf("每段结构---->%v\n=================================\n", sendListArt)
|
|
sendMonthList = append(sendMonthList, TimeHaveAry(v, listSynv.List))
|
|
}
|
|
|
|
publicmethod.Result(0, sendMonthList, c)
|
|
}
|
|
|
|
}
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2024-07-17 08:55:56
|
|
@ 功能: 结果与日期合并
|
|
@ 参数
|
|
|
|
#
|
|
|
|
@ 返回值
|
|
|
|
#
|
|
|
|
@ 方法原型
|
|
|
|
#
|
|
*/
|
|
func TimeHaveAry(dateList []TimeAryInfo, listDate []map[string]interface{}) []TimeAryInfo {
|
|
for ti, tv := range dateList {
|
|
fmt.Printf("测试类型--->%v=============>%v\n", ti, tv)
|
|
for _, v := range listDate {
|
|
for mi, mv := range v {
|
|
if tv.Date == mi {
|
|
fmt.Printf("测试类型--1->%v=============>%v\n", tv.Date, mi)
|
|
dateList[ti].List = mv
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return dateList
|
|
}
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2024-07-16 14:09:26
|
|
@ 功能: 按天获取数据
|
|
@ 参数
|
|
|
|
#day 日历单个日期参数
|
|
#tableName 要操作得数据表
|
|
#userCont 当前操作人
|
|
#Search 搜索条件
|
|
#listField 自定义表单查询条件
|
|
#viewCondition 视图设定
|
|
#listJson 字段处理
|
|
|
|
@ 返回值
|
|
|
|
#
|
|
|
|
@ 方法原型
|
|
|
|
#
|
|
*/
|
|
func (c *CalendarList) GetDayCont(day TimeAryInfo, tableName string, userCont modelshr.ManCont, Search FormPageListAttr, listField []SearchButtonInfo, viewCondition map[string]ViewInfo, listJson string, formJsonCont CustomerFormMaster) {
|
|
defer syncSeting.Done()
|
|
|
|
tableName = fmt.Sprintf("`%v` as f", tableName)
|
|
gormDb := overall.CONSTANT_DB_CustomerForm.Table(tableName).Select("f.*,t.status as taskStatus,t.runFlowId")
|
|
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)
|
|
gormDb = AnalysisSerachTermSqlIng(listField, gormDb)
|
|
|
|
if class, isOk := viewCondition["date"]; isOk {
|
|
if class.Status {
|
|
startTime, endTime := publicmethod.OenDayStartOrEndTime(day.Date, 1)
|
|
fmt.Printf("时间:day.Date=%v---->startTime=%v---->endTime=%v\n", day.Date, startTime, class.Form.StartTime)
|
|
if class.Form.StartTime != "" && class.Form.EndTime != "" {
|
|
whySql := fmt.Sprintf("f.`%v` BETWEEN %v AND %v OR f.`%v` BETWEEN %v AND %v", class.Form.StartTime, startTime, endTime, class.Form.EndTime, startTime, endTime)
|
|
gormDb = gormDb.Where(whySql)
|
|
fmt.Printf("语句1===》%v\n", whySql)
|
|
} else if class.Form.StartTime != "" && class.Form.EndTime == "" {
|
|
whySql := fmt.Sprintf("f.`%v` BETWEEN %v AND %v", class.Form.StartTime, startTime, endTime)
|
|
gormDb = gormDb.Where(whySql)
|
|
fmt.Printf("语句2===》%v\n", whySql)
|
|
} else if class.Form.StartTime == "" && class.Form.EndTime != "" {
|
|
whySql := fmt.Sprintf("f.`%v` BETWEEN %v AND %v", class.Form.EndTime, startTime, endTime)
|
|
gormDb = gormDb.Where(whySql)
|
|
fmt.Printf("语句3===》%v\n", whySql)
|
|
}
|
|
// startTimeInt, _ := publicmethod.StringToInt64(startTime)
|
|
// endTimeInt, _ := publicmethod.StringToInt64(endTime)
|
|
|
|
// if startTimeInt != 0 && endTimeInt != 0 {
|
|
// whySql := fmt.Sprintf("f.`%v` BETWEEN %v AND %v OR f.`%v` BETWEEN %v AND %v", class.Form.StartTime, startTime, endTime, class.Form.EndTime, startTime, endTime)
|
|
// gormDb = gormDb.Where(whySql)
|
|
// fmt.Printf("语句1===》%v\n", whySql)
|
|
// } else if startTimeInt != 0 && endTimeInt == 0 {
|
|
// whySql := fmt.Sprintf("f.`%v` BETWEEN %v AND %v", class.Form.StartTime, startTime, endTime)
|
|
// gormDb = gormDb.Where(whySql)
|
|
// fmt.Printf("语句2===》%v\n", whySql)
|
|
// } else if startTimeInt == 0 && endTimeInt != 0 {
|
|
// whySql := fmt.Sprintf("f.`%v` BETWEEN %v AND %v", class.Form.EndTime, startTime, endTime)
|
|
// gormDb = gormDb.Where(whySql)
|
|
// fmt.Printf("语句3===》%v\n", whySql)
|
|
// }
|
|
}
|
|
}
|
|
var formList []map[string]interface{}
|
|
err := gormDb.Order("`id` DESC").Find(&formList).Error
|
|
if listJson != "" {
|
|
var listFieldsMap ListPageFields
|
|
err = json.Unmarshal([]byte(listJson), &listFieldsMap)
|
|
if err == nil {
|
|
formList = listFieldsMap.DevelopSpecificationsSend(formList, formJsonCont)
|
|
}
|
|
|
|
}
|
|
if err == nil {
|
|
inDate := publicmethod.MapOut[string]()
|
|
inDate[day.Date] = formList
|
|
c.List = append(c.List, inDate)
|
|
// c.List = append(c.List, inDate)
|
|
// c.List = make(map[string]interface{})
|
|
// c.List[day.Date] = formList
|
|
}
|
|
}
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2024-07-16 15:53:51
|
|
@ 功能: 自定义表单查询条件
|
|
@ 参数
|
|
|
|
#
|
|
|
|
@ 返回值
|
|
|
|
#
|
|
|
|
@ 方法原型
|
|
|
|
#
|
|
*/
|
|
func AnalysisSerachTermSqlIng(why []SearchButtonInfo, gormDb *gorm.DB) *gorm.DB {
|
|
if len(why) < 1 {
|
|
return gormDb
|
|
}
|
|
for _, v := range why {
|
|
if v.Values != nil && 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:
|
|
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)
|
|
}
|
|
var formJsonCont CustomerFormMaster
|
|
if formInfo.MastesFormJson != "" {
|
|
json.Unmarshal([]byte(formInfo.MastesFormJson), &formJsonCont)
|
|
}
|
|
// 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, formJsonCont)
|
|
// 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, isTrue bool) {
|
|
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 {
|
|
isTrue = true
|
|
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 {
|
|
isTrue = true
|
|
// 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]
|
|
// }
|
|
// fmt.Printf("字段数组---12-->%v----->%v\n", isWrite, formField)
|
|
switch formField.Field {
|
|
case "_lableTitle":
|
|
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]
|
|
}
|
|
case "id":
|
|
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]
|
|
}
|
|
case "masters_key":
|
|
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]
|
|
}
|
|
case "creater":
|
|
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]
|
|
}
|
|
case "creater_time":
|
|
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]
|
|
}
|
|
case "edit_time":
|
|
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]
|
|
}
|
|
case "flow_id":
|
|
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]
|
|
}
|
|
case "states":
|
|
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]
|
|
}
|
|
case "flowIsOpen":
|
|
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]
|
|
}
|
|
default:
|
|
isTrue = false
|
|
// formKey := TableFormAttributeForm(v, jsonFieldList)
|
|
// if formKey.Field != "" {
|
|
// fieldList = append(fieldList, formKey)
|
|
// }
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
} else {
|
|
isTrue = true
|
|
// 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
|
|
}
|
|
|