|
|
|
@ -7,7 +7,6 @@ import ( |
|
|
|
"appPlatform/overall/publicmethod" |
|
|
|
"encoding/json" |
|
|
|
"fmt" |
|
|
|
"reflect" |
|
|
|
"strconv" |
|
|
|
"strings" |
|
|
|
"time" |
|
|
|
@ -42,17 +41,36 @@ func (a *ApiMethod) CustomerFormList(c *gin.Context) { |
|
|
|
if requestData.PageSize == 0 { |
|
|
|
requestData.PageSize = 15 |
|
|
|
} |
|
|
|
context, _ := c.Get(overall.MyContJwt) |
|
|
|
var userCont modelshr.ManCont |
|
|
|
userCont.GetLoginCont(context) |
|
|
|
// fmt.Printf("requestData---->%v---->%v\n", requestData, ersr)
|
|
|
|
// var formList []modelAppPlatform.CustomerForm
|
|
|
|
var formList []SendCustomerForm |
|
|
|
gormDb := overall.CONSTANT_DB_AppPlatform.Model(&modelAppPlatform.CustomerForm{}).Where("`states` BETWEEN ? AND ?", 1, 2) |
|
|
|
if requestData.GroupId == "100" { |
|
|
|
|
|
|
|
var oftenAppInfo modelAppPlatform.OftenApp |
|
|
|
oftenAppInfo.GetCont(map[string]interface{}{"`userKey`": userCont.Key}, "`appSignCode`") |
|
|
|
if oftenAppInfo.AppSignCode != "" { |
|
|
|
appId := strings.Split(oftenAppInfo.AppSignCode, ",") |
|
|
|
if len(appId) > 0 { |
|
|
|
gormDb = gormDb.Where("`signCode` IN ?", appId) |
|
|
|
} else { |
|
|
|
gormDb = gormDb.Where("`signCode` = ? AND `tablename` = ?", 110, "qindong") |
|
|
|
} |
|
|
|
} else { |
|
|
|
gormDb = gormDb.Where("`signCode` = ? AND `tablename` = ?", 110, "qindong") |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if requestData.KeyWords != "" { |
|
|
|
gormDb = gormDb.Where("`name` LIKE ? OR `tablename` LIKE ?", "%"+requestData.KeyWords+"%", "%"+requestData.KeyWords+"%") |
|
|
|
} |
|
|
|
if requestData.Classify != 0 { |
|
|
|
gormDb = gormDb.Where("`classify` = ?", requestData.Classify) |
|
|
|
} |
|
|
|
if requestData.GroupId != "" { |
|
|
|
if requestData.GroupId != "" && requestData.GroupId != "100" { |
|
|
|
gormDb = gormDb.Where("`groupid` = ?", requestData.GroupId) |
|
|
|
} |
|
|
|
var total int64 |
|
|
|
@ -70,25 +88,60 @@ func (a *ApiMethod) CustomerFormList(c *gin.Context) { |
|
|
|
for i, v := range formList { |
|
|
|
// var sendCont SendCustomerForm
|
|
|
|
// sendCont.IdStr = strconv.FormatInt(v.Id, 10)
|
|
|
|
userCont := HaveCustomerFormCreaterUs(v.TableNames) |
|
|
|
// sendCont.CreaterName = userCont.Name
|
|
|
|
userContEs := HaveCustomerFormCreaterUs(v.TableNames) |
|
|
|
// sendCont.CreaterName = userContEs.Name
|
|
|
|
// sendCont.CreaterTimeStr = publicmethod.UnixTimeToDay(v.CreaterTime, 1)
|
|
|
|
if v.FlowKey != 0 { |
|
|
|
// sendCont.FlowKeyStr = strconv.FormatInt(v.FlowKey, 10)
|
|
|
|
formList[i].FlowKeyStr = strconv.FormatInt(v.FlowKey, 10) |
|
|
|
} |
|
|
|
formList[i].IdStr = strconv.FormatInt(v.Id, 10) |
|
|
|
formList[i].CreaterName = userCont.Name |
|
|
|
formList[i].CreaterName = userContEs.Name |
|
|
|
formList[i].CreaterTimeStr = publicmethod.UnixTimeToDay(v.CreaterTime, 1) |
|
|
|
var versionInfo modelAppPlatform.CustomerFormVersion |
|
|
|
versionInfo.GetCont(map[string]interface{}{"`status`": 1, "`tablekey`": v.TableNames}, "`id`") |
|
|
|
formList[i].VersionId = strconv.FormatInt(versionInfo.Id, 10) |
|
|
|
formList[i].SignCodeStr = strconv.FormatInt(v.SignCode, 10) |
|
|
|
formList[i].IsOften = JudgeAppOften(userCont.Key, v.SignCode) |
|
|
|
if v.States == 1 { |
|
|
|
formList[i].IsOpen = true |
|
|
|
} else { |
|
|
|
formList[i].IsOpen = false |
|
|
|
} |
|
|
|
// sendList = append(sendList, sendCont)
|
|
|
|
} |
|
|
|
publicmethod.ResultList(0, requestData.Page, requestData.PageSize, total, int64(len(formList)), formList, c) |
|
|
|
} |
|
|
|
|
|
|
|
/* |
|
|
|
* |
|
|
|
@ 作者: 秦东 |
|
|
|
@ 时间: 2024-07-23 16:20:59 |
|
|
|
@ 功能: 判断App是不是经常使用 |
|
|
|
@ 参数 |
|
|
|
|
|
|
|
#userkey 当前人员 |
|
|
|
#appCode 应用识别 |
|
|
|
|
|
|
|
@ 返回值 |
|
|
|
|
|
|
|
# |
|
|
|
|
|
|
|
@ 方法原型 |
|
|
|
|
|
|
|
# |
|
|
|
*/ |
|
|
|
func JudgeAppOften(userkey, appCode int64) bool { |
|
|
|
var oftenAppInfo modelAppPlatform.OftenApp |
|
|
|
oftenAppInfo.GetCont(map[string]interface{}{"`userKey`": userkey}, "`appSignCode`") |
|
|
|
appId := strings.Split(oftenAppInfo.AppSignCode, ",") |
|
|
|
if len(appId) > 0 { |
|
|
|
appCodeStr := strconv.FormatInt(appCode, 10) |
|
|
|
return publicmethod.IsInTrue[string](appCodeStr, appId) |
|
|
|
} |
|
|
|
return false |
|
|
|
} |
|
|
|
|
|
|
|
/* |
|
|
|
* |
|
|
|
@ 作者: 秦东 |
|
|
|
@ -700,7 +753,7 @@ func (c *CustomerFormMaster) DisassembleForm() (relevance string, err error) { |
|
|
|
# |
|
|
|
*/ |
|
|
|
func CreateFormFiled(formName, formNotes string, isMasters bool, sqlList interface{}) { |
|
|
|
fmt.Printf("函数类型----%v---%T\n", reflect.TypeOf(sqlList), sqlList) |
|
|
|
// fmt.Printf("函数类型----%v---%T\n", reflect.TypeOf(sqlList), sqlList)
|
|
|
|
if sql, isOk := sqlList.([]string); isOk { |
|
|
|
|
|
|
|
for k, v := range sql { |
|
|
|
@ -717,10 +770,12 @@ func CreateFormFiled(formName, formNotes string, isMasters bool, sqlList interfa |
|
|
|
|
|
|
|
// 协程执行mysql语句
|
|
|
|
func CoroutineExecuteSql(k int, sql string) { |
|
|
|
// fmt.Printf("%v---------->%v\n", k, sql)
|
|
|
|
|
|
|
|
defer syncSeting.Done() |
|
|
|
overall.CONSTANT_DB_CustomerForm.Exec(sql) |
|
|
|
// err := overall.CONSTANT_DB_CustomerForm.Exec(sql).Error
|
|
|
|
// overall.CONSTANT_DB_CustomerForm.Raw(sql)
|
|
|
|
// fmt.Printf("协程执行mysql语句---:---%v---------->%v---------->%v\n", k, sql, err)
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@ -1294,3 +1349,93 @@ func PublicUnitJieXi(list []MasterStruct) (isSubmit, isCancel bool) { |
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/* |
|
|
|
* |
|
|
|
@ 作者: 秦东 |
|
|
|
@ 时间: 2024-07-23 16:33:50 |
|
|
|
@ 功能: 编辑常用自定义App |
|
|
|
@ 参数 |
|
|
|
|
|
|
|
# |
|
|
|
|
|
|
|
@ 返回值 |
|
|
|
|
|
|
|
# |
|
|
|
|
|
|
|
@ 方法原型 |
|
|
|
|
|
|
|
# |
|
|
|
*/ |
|
|
|
func (a *ApiMethod) SetOftenApp(c *gin.Context) { |
|
|
|
var requestData publicmethod.PublicId |
|
|
|
err := c.ShouldBindJSON(&requestData) |
|
|
|
if err != nil { |
|
|
|
publicmethod.Result(100, err, c) |
|
|
|
return |
|
|
|
} |
|
|
|
if requestData.Id == "" { |
|
|
|
publicmethod.Result(1, requestData.Id, c, "未知App!") |
|
|
|
return |
|
|
|
} |
|
|
|
context, _ := c.Get(overall.MyContJwt) |
|
|
|
var userCont modelshr.ManCont |
|
|
|
userCont.GetLoginCont(context) |
|
|
|
var oftenAppInfo modelAppPlatform.OftenApp |
|
|
|
err = oftenAppInfo.GetCont(map[string]interface{}{"`userKey`": userCont.Key}) |
|
|
|
if err != nil { |
|
|
|
oftenAppInfo.UserKey = userCont.Key //所有者"`
|
|
|
|
oftenAppInfo.Time = time.Now().Unix() //编辑时间"`
|
|
|
|
var signCode []string |
|
|
|
signCode = append(signCode, requestData.Id) |
|
|
|
oftenAppInfo.AppSignCode = strings.Join(signCode, ",") //节点名称"`
|
|
|
|
err = overall.CONSTANT_DB_AppPlatform.Create(&oftenAppInfo).Error |
|
|
|
if err != nil { |
|
|
|
publicmethod.Result(104, requestData.Id, c) |
|
|
|
return |
|
|
|
} |
|
|
|
} else { |
|
|
|
if oftenAppInfo.AppSignCode != "" { |
|
|
|
appId := strings.Split(oftenAppInfo.AppSignCode, ",") |
|
|
|
if len(appId) > 0 { |
|
|
|
editInfo := publicmethod.MapOut[string]() |
|
|
|
if publicmethod.IsInTrue[string](requestData.Id, appId) { |
|
|
|
var newAppid []string |
|
|
|
for _, v := range appId { |
|
|
|
if v != requestData.Id { |
|
|
|
newAppid = append(newAppid, v) |
|
|
|
} |
|
|
|
} |
|
|
|
editInfo["appSignCode"] = strings.Join(newAppid, ",") |
|
|
|
} else { |
|
|
|
appId = append(appId, requestData.Id) |
|
|
|
editInfo["appSignCode"] = strings.Join(appId, ",") |
|
|
|
} |
|
|
|
editInfo["time"] = time.Now().Unix() |
|
|
|
var editContApp modelAppPlatform.OftenApp |
|
|
|
err = editContApp.EiteCont(map[string]interface{}{"`id`": oftenAppInfo.Id}, editInfo) |
|
|
|
} else { |
|
|
|
editInfo := publicmethod.MapOut[string]() |
|
|
|
editInfo["time"] = time.Now().Unix() |
|
|
|
var signCode []string |
|
|
|
signCode = append(signCode, requestData.Id) |
|
|
|
editInfo["appSignCode"] = strings.Join(signCode, ",") //节点名称"`
|
|
|
|
var editContApp modelAppPlatform.OftenApp |
|
|
|
err = editContApp.EiteCont(map[string]interface{}{"`id`": oftenAppInfo.Id}, editInfo) |
|
|
|
} |
|
|
|
} else { |
|
|
|
editInfo := publicmethod.MapOut[string]() |
|
|
|
editInfo["time"] = time.Now().Unix() |
|
|
|
var signCode []string |
|
|
|
signCode = append(signCode, requestData.Id) |
|
|
|
editInfo["appSignCode"] = strings.Join(signCode, ",") //节点名称"`
|
|
|
|
var editContApp modelAppPlatform.OftenApp |
|
|
|
err = editContApp.EiteCont(map[string]interface{}{"`id`": oftenAppInfo.Id}, editInfo) |
|
|
|
} |
|
|
|
} |
|
|
|
if err != nil { |
|
|
|
publicmethod.Result(106, requestData.Id, c) |
|
|
|
return |
|
|
|
} |
|
|
|
publicmethod.Result(0, err, c) |
|
|
|
} |
|
|
|
|