diff --git a/api/authentication/signcode.go b/api/authentication/signcode.go index 0fe7c3b..056f96a 100644 --- a/api/authentication/signcode.go +++ b/api/authentication/signcode.go @@ -4,7 +4,6 @@ import ( "appPlatform/middleware/grocerystore" "appPlatform/overall" "appPlatform/overall/publicmethod" - "encoding/json" "fmt" "github.com/gin-gonic/gin" @@ -19,24 +18,24 @@ func (a *ApiMethod) SignCode(c *gin.Context) { return } - dataVal, err := publicmethod.ReceiveData(c) //接收数据处理 - if err != nil { - publicmethod.Result(100, err, c) - return - } - var requestData SignCodeStr - err = json.Unmarshal(dataVal, &requestData) - if err != nil { - publicmethod.Result(100, err, c) - return - } - + // dataVal, err := publicmethod.ReceiveData(c) //接收数据处理 + // if err != nil { + // publicmethod.Result(100, err, c) + // return + // } // var requestData SignCodeStr - // err := c.ShouldBindJSON(&requestData) + // err = json.Unmarshal(dataVal, &requestData) // if err != nil { // publicmethod.Result(100, err, c) // return // } + + var requestData SignCodeStr + err := c.ShouldBindJSON(&requestData) + if err != nil { + publicmethod.Result(100, err, c) + return + } if requestData.Code == "" { publicmethod.Result(1, err, c, "验证失败!未知识别符!") return @@ -44,9 +43,16 @@ func (a *ApiMethod) SignCode(c *gin.Context) { redisFileKey := fmt.Sprintf("ScanCode:Aut:IdentRec_%v_%v", overall.CONSTANT_CONFIG.RedisPrefixStr.Alias, requestData.Code) redisClient := grocerystore.RunRedis(overall.CONSTANT_REDIS4) userRedisToken, isTrue := redisClient.HashGetAll(redisFileKey) + if !isTrue { - publicmethod.Result(1, userRedisToken, c, "验证失败!不是授权用户!1") - return + + redisFileKey5 := fmt.Sprintf("ScanCode:Authentication:LoginApi_%v_%v", overall.CONSTANT_CONFIG.RedisPrefixStr.Alias, requestData.Code) + redisClient5 := grocerystore.RunRedis(overall.CONSTANT_REDIS5) + userRedisToken, isTrue = redisClient5.HashGetAll(redisFileKey5) + if !isTrue { + publicmethod.Result(1, userRedisToken, c, "验证失败!不是授权用户!1") + return + } } // sf := publicmethod.MapOut[string]() if userToken != userRedisToken["usertoken"] || userKey != userRedisToken["userkey"] { diff --git a/api/shiyan/maptostruct/shiyan.go b/api/shiyan/maptostruct/shiyan.go index 51a2f1c..afe76c9 100644 --- a/api/shiyan/maptostruct/shiyan.go +++ b/api/shiyan/maptostruct/shiyan.go @@ -945,18 +945,20 @@ func (a *ApiMethod) JiaoZhengTableWord(c *gin.Context) { func (a *ApiMethod) Sm4JiemiVal(c *gin.Context) { var requestData JimiToSm4 err := c.ShouldBindJSON(&requestData) + fmt.Printf("--1--------------->%v---------->%v\n\n", err, err) if requestData.AuthKey == "" { publicmethod.ResultNoJiami(100, err, c) return } + fmt.Printf("--2--------------->%v---------->%v\n\n", err, err) if requestData.Data == "" { publicmethod.ResultNoJiami(100, err, c) return } jimi, err := publicmethod.SM4DecryptNew(requestData.Data, requestData.AuthKey) - fmt.Printf("----------------->%v---------->%v\n\n", err, string(jimi)) - var sendMap map[string]interface{} + fmt.Printf("---2-------------->%v---------->%v\n\n", err, string(jimi)) + var sendMap interface{} err = json.Unmarshal(jimi, &sendMap) - fmt.Printf("----------------->%v--------->%v\n\n", err, sendMap) + fmt.Printf("----3------------->%v--------->%v\n\n", err, sendMap) publicmethod.ResultNoJiami(0, sendMap, c) } diff --git a/api/version1/customerApp/appControll.go b/api/version1/customerApp/appControll.go index 1ff6992..ed2ec36 100644 --- a/api/version1/customerApp/appControll.go +++ b/api/version1/customerApp/appControll.go @@ -1676,10 +1676,11 @@ func (a *ApiMethod) GainAppPageInfo(c *gin.Context) { publicmethod.Result(100, err, c) return } + // fmt.Printf("解析结果--------------->%v\n\n\n", string(dataVal)) var requestData publicmethod.PublicId err = json.Unmarshal(dataVal, &requestData) if err != nil { - publicmethod.Result(100, err, c) + publicmethod.Result(1001, err, c) return } diff --git a/api/version1/customerform/form.go b/api/version1/customerform/form.go index 01ddca5..451f4cb 100644 --- a/api/version1/customerform/form.go +++ b/api/version1/customerform/form.go @@ -1497,7 +1497,10 @@ func (a *ApiMethod) JudgeSubmitCancel(c *gin.Context) { snedAry := publicmethod.MapOut[string]() snedAry["buttonIsTrue"] = buttonIsTrue snedAry["formJsonCont"] = formJsonCont - publicmethod.Result(0, buttonIsTrue, c) + var snedMove SendOutBtn + snedMove.ButtonIsTrue = buttonIsTrue + snedMove.FormJsonCont = formJsonCont + publicmethod.Result(0, snedMove, c) } /* diff --git a/api/version1/customerform/type.go b/api/version1/customerform/type.go index 955d722..4bf13be 100644 --- a/api/version1/customerform/type.go +++ b/api/version1/customerform/type.go @@ -610,3 +610,9 @@ type KaPianField struct { CreaterTime string `json:"creater_time"` //创建时间 TableKey string `json:"tableKey"` //表单 } + +// 输出判断是否添加按钮 +type SendOutBtn struct { + ButtonIsTrue int `json:"buttonIsTrue"` + FormJsonCont CustomerFormMaster `json:"CustomerFormMaster"` +} diff --git a/api/version1/taskplatform/taskflowing/appTaskFlow.go b/api/version1/taskplatform/taskflowing/appTaskFlow.go index b40fbe3..88a31f1 100644 --- a/api/version1/taskplatform/taskflowing/appTaskFlow.go +++ b/api/version1/taskplatform/taskflowing/appTaskFlow.go @@ -159,8 +159,20 @@ func (a *ApiMethod) GainAppTaskList(c *gin.Context) { # */ func (a *ApiMethod) GainAppAllTaskList(c *gin.Context) { + dataVal, err := publicmethod.ReceiveData(c) //接收数据处理 + if err != nil { + publicmethod.Result(100, err, c) + return + } var requestData AppAllTaskSearch - c.ShouldBindJSON(&requestData) + err = json.Unmarshal(dataVal, &requestData) + // if err != nil { + // publicmethod.Result(100, err, c) + // return + // } + + // var requestData AppAllTaskSearch + // c.ShouldBindJSON(&requestData) if requestData.Id == "" { publicmethod.Result(100, requestData, c) return @@ -193,7 +205,7 @@ func (a *ApiMethod) GainAppAllTaskList(c *gin.Context) { } var idAry []int64 gormDb = publicmethod.PageTurningSettings(gormDb, requestData.Page, requestData.PageSize) - err := gormDb.Order("`id` desc").Find(&idAry).Error + err = gormDb.Order("`id` desc").Find(&idAry).Error var userList []SendTaskInfo if err != nil || len(idAry) < 1 { publicmethod.ResultList(0, requestData.Page, requestData.PageSize, total, int64(len(userList)), userList, c) @@ -212,6 +224,13 @@ func (a *ApiMethod) GainAppAllTaskList(c *gin.Context) { userList[i].TableKeyStr = strconv.FormatInt(userList[i].TableKey, 10) userList[i].AppKeyStr = strconv.FormatInt(userList[i].AppKey, 10) userList[i].CreaterInfo = GainSmaillUserInfo[int64](userList[i].Creater) + + if userList[i].FlowRunSing == 0 { + userList[i].FlowIsOpens = 0 + } else { + userList[i].FlowIsOpens = 1 + } + if userList[i].Types == 1 && userList[i].Status == 3 && userList[i].RunFlowId != 0 { var runFlowInfo customerForm.RunWorkflow runFlowInfo.GetCont(map[string]interface{}{"`id`": userList[i].RunFlowId}, "`current_step`", "`next_step`", "`creater`") diff --git a/api/version1/taskplatform/taskflowing/taskFlow.go b/api/version1/taskplatform/taskflowing/taskFlow.go index 55e7a45..249e3c8 100644 --- a/api/version1/taskplatform/taskflowing/taskFlow.go +++ b/api/version1/taskplatform/taskflowing/taskFlow.go @@ -313,10 +313,16 @@ func (a *ApiMethod) GainRunTaskFlow(c *gin.Context) { if runFlowInfo.Status != 3 { operational = false } + if runFlowInfo.NextStep > len(flowList) { + if !operational { + runFlowInfo.NextStep = 0 + } + } sendMap := publicmethod.MapOut[string]() sendMap["flowList"] = flowAry sendMap["operational"] = operational sendMap["current_step"] = runFlowInfo.CurrentStep + sendMap["next_step"] = runFlowInfo.NextStep publicmethod.Result(0, sendMap, c) } @@ -357,17 +363,22 @@ func CheckMakeCopy(uuid, runKey int64, state int, currepStep int, flowList []Run if flowList[i].Step == endStep { cureeNode = flowList[i] - switch flowList[i].ExamineMode { - case 1: - operational = ApprovalInSequence(flowList[i].Operator, userCont) - case 2: - operational = NotSignJointly(runKey, state, flowList[i].Operator, userCont) - case 3: - operational = NotSignJointly(runKey, state, flowList[i].Operator, userCont) - default: - for m := 0; m < len(flowList[i].Operator); m++ { - if flowList[i].Operator[m].Id == userKey { - operational = true + if flowList[i].Types == 2 { + operational = false + } else { + + switch flowList[i].ExamineMode { + case 1: + operational = ApprovalInSequence(flowList[i].Operator, userCont) + case 2: + operational = NotSignJointly(runKey, state, flowList[i].Operator, userCont) + case 3: + operational = NotSignJointly(runKey, state, flowList[i].Operator, userCont) + default: + for m := 0; m < len(flowList[i].Operator); m++ { + if flowList[i].Operator[m].Id == userKey { + operational = true + } } } } diff --git a/api/version1/taskplatform/taskflowing/types.go b/api/version1/taskplatform/taskflowing/types.go index 9ba1447..fc21618 100644 --- a/api/version1/taskplatform/taskflowing/types.go +++ b/api/version1/taskplatform/taskflowing/types.go @@ -376,6 +376,7 @@ type SendTaskInfo struct { IsRetract bool `json:"isRetract" gorm:"-"` RunFlowIdStr string `json:"runFlowIdStr" gorm:"-"` States int `json:"statesing" gorm:"-"` + FlowIsOpens int `json:"flowIsOpens" gorm:"-"` } // 发送范围表单字段选择 diff --git a/api/version1/taskplatform/taskmanagement/runWorkFlow.go b/api/version1/taskplatform/taskmanagement/runWorkFlow.go index c706a05..191c9f6 100644 --- a/api/version1/taskplatform/taskmanagement/runWorkFlow.go +++ b/api/version1/taskplatform/taskmanagement/runWorkFlow.go @@ -746,10 +746,16 @@ func (a *ApiMethod) GainRunTaskWorkflow(c *gin.Context) { if runFlowInfo.Status != 3 { operational = false } + if runFlowInfo.NextStep > len(flowList) { + if !operational { + runFlowInfo.NextStep = 0 + } + } sendMap := publicmethod.MapOut[string]() sendMap["flowList"] = flowAry sendMap["operational"] = operational sendMap["current_step"] = runFlowInfo.CurrentStep + sendMap["next_step"] = runFlowInfo.NextStep publicmethod.Result(0, sendMap, c) } @@ -789,23 +795,27 @@ func CheckMakeCopy(uuid, runKey int64, state int, currepStep int, flowList []Run for i := 0; i < len(flowList); i++ { //梳理抄送节点 fmt.Printf("解析步骤--->%v--->%v--->%v--->%v\n\n", i, flowList[i].Step, endStep, flowList[i].Step == endStep) if flowList[i].Step == endStep { - cureeNode = flowList[i] + if flowList[i].Types == 2 { + operational = false + } else { - switch flowList[i].ExamineMode { - case 1: - operational = ApprovalInSequence(flowList[i].Operator, userCont) - case 2: - operational = NotSignJointly(runKey, state, flowList[i].Operator, userCont) - case 3: - operational = NotSignJointly(runKey, state, flowList[i].Operator, userCont) - default: - for m := 0; m < len(flowList[i].Operator); m++ { - if flowList[i].Operator[m].Id == userKey { - operational = true + switch flowList[i].ExamineMode { + case 1: + operational = ApprovalInSequence(flowList[i].Operator, userCont) + case 2: + operational = NotSignJointly(runKey, state, flowList[i].Operator, userCont) + case 3: + operational = NotSignJointly(runKey, state, flowList[i].Operator, userCont) + default: + for m := 0; m < len(flowList[i].Operator); m++ { + if flowList[i].Operator[m].Id == userKey { + operational = true + } } } } + // fmt.Printf("解析步骤--->%v--->%v--->%v\n\n", i, cureeNode, flowList[i].Operator) fmt.Printf("currepStep:%v---->endStep:%v\n", flowList[i].ExamineMode, operational) } @@ -816,7 +826,7 @@ func CheckMakeCopy(uuid, runKey int64, state int, currepStep int, flowList []Run flowList[i].RunScope = 0 for j := 0; j < len(flowList[i].Operator); j++ { if flowList[i].Operator[j].Id == userKey { - if len(flowList[i].Operator[j].LogList) < 1 { + if len(flowList[i].Operator[j].LogList) < 0 { var logCont LogList logCont.State = 4 //状态 1、未操作;2、通过;3、驳回 logCont.TimeVal = publicmethod.UnixTimeToDay(time.Now().Unix(), 1) diff --git a/api/version1/workWechat/wechat.go b/api/version1/workWechat/wechat.go index 8dc5297..3b6f800 100644 --- a/api/version1/workWechat/wechat.go +++ b/api/version1/workWechat/wechat.go @@ -178,8 +178,8 @@ func (a *ApiMethod) LookOnePeopleArchives(c *gin.Context) { var orgList []string sendData.Purview, _, orgList, sendData.Level = user.GetUserPower("appsystem", surverManInfo.Position, roleList) - myPower := publicmethod.GetMyMenuPower(surverManInfo.Key, "135") - + myPower := publicmethod.GetMyMenuPowerNew(surverManInfo.Key, "135", 1) + sendData.Level = myPower.Scope fmt.Printf("人员信息--->Purview:%v--->orgList:%v--->Level:%v\n", sendData.Purview, orgList, sendData.Level) myPowerJson, _ := json.Marshal(myPower) diff --git a/models/modelshr/user_org.go b/models/modelshr/user_org.go new file mode 100644 index 0000000..8383587 --- /dev/null +++ b/models/modelshr/user_org.go @@ -0,0 +1,106 @@ +package modelshr + +import ( + "appPlatform/middleware/grocerystore" + "appPlatform/overall" + "encoding/json" + "fmt" + "strings" +) + +// 员工档案(主) +type UserOrgInfo struct { + Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:ID"` + Number string `json:"number" gorm:"column:number;type:varchar(30) unsigned;not null;comment:员工工号"` + Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:姓名"` + Icon string `json:"icon" gorm:"column:icon;type:varchar(255) unsigned;default:'';not null;comment:头像"` + HireClass int `json:"hireclass" gorm:"column:hire_class;type:tinyint(1) unsigned;default:1;not null;comment:雇佣类型(1:雇佣入职;2:再入职;)"` + EmpType int `json:"emptype" gorm:"column:emp_type;type:tinyint(1) unsigned;default:1;not null;comment:用工关系(1:临时工 , 2:编外人员 ;3:实习&实习生;4:试用员工;5:待分配;6:待岗;7:临时调入;8:正式员工;9:长期病假;10:停薪留职;11:退休;12:辞职;13:辞退;14:离职)"` + MainDeparment int64 `json:"maindeparment" gorm:"column:maindeparment;type:bigint(20) unsigned;default:0;not null;comment:主部门"` + Deparment string `json:"deparment" gorm:"column:deparment;type:text;comment:部门"` + AdminOrg int64 `json:"adminorg" gorm:"column:admin_org;type:bigint(20) unsigned;default:0;not null;comment:所属行政组织"` + TeamId int64 `json:"teamid" gorm:"column:teamid;type:bigint(20) unsigned;default:0;not null;comment:班组"` + JobClass int64 `json:"jobclass" gorm:"column:job_class;type:bigint(20) unsigned;default:2;not null;comment:职务分类"` + JobId int64 `json:"jobid" gorm:"column:job_id;type:bigint(20) unsigned;default:0;not null;comment:职务"` + JobLeve int64 `json:"jobleve" gorm:"column:job_leve;type:bigint(20) unsigned;default:0;not null;comment:职务等级"` + Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:写入时间"` + EiteTime int64 `json:"eitetime" gorm:"column:eite_time;type:bigint(20) unsigned;default:0;not null;comment:编辑时间"` + Wechat string `json:"wechat" gorm:"column:wechat;type:varchar(255) unsigned;default:'';not null;comment:微信UserId"` + WorkWechat string `json:"workwechat" gorm:"column:work_wechat;type:varchar(255) unsigned;default:'';not null;comment:企业微信UserId"` + State int `json:"state" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)` + Key int64 `json:"key" gorm:"column:key;type:bigint(50) unsigned;default:0;not null;comment:key"` + IsAdmin int `json:"isadmin" gorm:"column:is_admin;type:tinyint(1) unsigned;default:1;not null;comment:是否为管理员(1:不是;2:分公司;3:集团管理员;4:超级管` + Password string `json:"password" gorm:"column:password;type:varchar(255) unsigned;default:'';not null;comment:密码"` + Role string `json:"role" gorm:"column:role;type:longtext;comment:角色"` + EmpTypeName string `json:"emptypename" gorm:"column:emp_type_name;type:varchar(255) unsigned;default:'';not null;comment:用工关系中文"` + HireClassName string `json:"hireclassname" gorm:"column:hire_class_name;type:varchar(255) unsigned;default:'';not null;comment:雇佣类型中文"` + SunMainDeparment int64 `json:"sunmaindeparment" gorm:"column:sun_main_deparment;type:bigint(20) unsigned;default:0;not null;comment:二级主部门"` + Ruleid int64 `json:"ruleid" gorm:"column:ruleid;type:bigint(20) unsigned;default:0;not null;comment:轮询规则"` + IconPhoto string `json:"iconphoto" gorm:"column:icon_photo;type:longtext;default:'';not null;comment:照片"` + PersonInCharge int `json:"personincharge" gorm:"column:person_in_charge;type:tinyint(1) unsigned;default:1;not null;comment:负责人(1:是;2:否)` + ResponsibleDepartment string `json:"responsibledepartment" gorm:"column:responsible_department;type:longtext;default:'';not null;comment:负责的行政组织"` + ResponsibleDepartmentJson string `json:"responsibledepartmentjson" gorm:"column:responsible_department_json;type:longtext;default:'';not null;comment:负责的行政组织json"` + WorkSection int64 `json:"workSection" gorm:"column:work_section;type:bigint(20) unsigned;default:0;not null;comment:工段"` + IsShowTrue int64 `json:"isShowTrue" gorm:"column:is_show_true;type:int(5) unsigned;default:2;not null;comment:信息是否锁定` + ExcelTemplate int64 `json:"excelTemplate" gorm:"column:excel_template;type:bigint(20) unsigned;default:0;not null;comment:信息来源于哪个模板` + PositionCategory string `json:"positionCategory" gorm:"column:positionCategory;type:tinytext;comment:岗位序列"` + + Company int64 `json:"company" gorm:"primaryKey;column:company;type:bigint(20) unsigned;not null;comment:所属公司;"` + Orgid int64 `json:"orgid" gorm:"primaryKey;column:orgid;type:bigint(20) unsigned;not null;comment:行政组织ID;"` + Position int64 `json:"position" gorm:"primaryKey;column:position;type:bigint(20) unsigned;not null;comment:职位;"` + TeamsId int64 `json:"teamsId" gorm:"primaryKey;column:teamsId;type:bigint(20) unsigned;not null;comment:班组Id;"` + AssignType int `json:"assignType" gorm:"column:assignType;type:int(1) unsigned;default:50;not null;comment:1:主职;2:兼职"` +} + +func (cont *UserOrgInfo) TableName() string { + return "user_org" +} + +// 编辑员工档案 +func (cont *UserOrgInfo) EiteCont(whereMap interface{}, saveData interface{}) (err error) { + err = overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Updates(saveData).Error + fmt.Printf("编辑信息:---2--->%v\n", err) + err = overall.CONSTANT_DB_HrInside.Model(&cont).Where(whereMap).Updates(saveData).Error + fmt.Printf("编辑信息:---3--->%v\n", err) + return +} + +// 获取员工档案 +func (cont *UserOrgInfo) GetCont(whereMap interface{}, field ...string) (err error) { + gormDb := overall.CONSTANT_DB_HR.Model(&cont) + if len(field) > 0 { + fieldStr := strings.Join(field, ",") + gormDb = gormDb.Select(fieldStr) + } + gormDb = gormDb.Where(whereMap) + err = gormDb.First(&cont).Error + return +} + +// 根据ID获取行政组织内容 +func (cont *UserOrgInfo) RedisCont(key string, class int) (err error) { + redisFileKey := fmt.Sprintf("UserDossier:Info:%v_%v", key, overall.CONSTANT_CONFIG.RedisPrefixStr.Alias) + redisClient := grocerystore.RunRedis(overall.CONSTANT_REDIS4) //设定redis库 + isTrue, tokens := redisClient.Get(redisFileKey) + if isTrue && tokens != "" { + err = json.Unmarshal([]byte(tokens), &cont) + return + } else { + var jsonStr []byte + switch class { + case 1: + err = overall.CONSTANT_DB_HR.Model(&cont).Where("`number` = ?", key).First(&cont).Error + case 2: + err = overall.CONSTANT_DB_HR.Model(&cont).Where("`key` = ?", key).First(&cont).Error + default: + err = overall.CONSTANT_DB_HR.Model(&cont).Where("`id` = ?", key).First(&cont).Error + } + + if err == nil { + redisClient.SetRedisTime(0) + jsonStr, err = json.Marshal(cont) + redisClient.Set(redisFileKey, string(jsonStr)) + } + } + return +} diff --git a/models/modelshr/user_org_cont.go b/models/modelshr/user_org_cont.go new file mode 100644 index 0000000..7c5414a --- /dev/null +++ b/models/modelshr/user_org_cont.go @@ -0,0 +1,148 @@ +package modelshr + +import ( + "appPlatform/middleware/grocerystore" + "appPlatform/overall" + "encoding/json" + "fmt" + "strings" +) + +// 员工档案(主) +type UserOrgCont struct { + Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:ID"` + Number string `json:"number" gorm:"column:number;type:varchar(30) unsigned;not null;comment:员工工号"` + Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:姓名"` + Icon string `json:"icon" gorm:"column:icon;type:varchar(255) unsigned;default:'';not null;comment:头像"` + HireClass int `json:"hireclass" gorm:"column:hire_class;type:tinyint(1) unsigned;default:1;not null;comment:雇佣类型(1:雇佣入职;2:再入职;)"` + EmpType int `json:"emptype" gorm:"column:emp_type;type:tinyint(1) unsigned;default:1;not null;comment:用工关系(1:临时工 , 2:编外人员 ;3:实习&实习生;4:试用员工;5:待分配;6:待岗;7:临时调入;8:正式员工;9:长期病假;10:停薪留职;11:退休;12:辞职;13:辞退;14:离职)"` + MainDeparment int64 `json:"maindeparment" gorm:"column:maindeparment;type:bigint(20) unsigned;default:0;not null;comment:主部门"` + Deparment string `json:"deparment" gorm:"column:deparment;type:text;comment:部门"` + AdminOrg int64 `json:"adminorg" gorm:"column:admin_org;type:bigint(20) unsigned;default:0;not null;comment:所属行政组织"` + TeamId int64 `json:"teamid" gorm:"column:teamid;type:bigint(20) unsigned;default:0;not null;comment:班组"` + JobClass int64 `json:"jobclass" gorm:"column:job_class;type:bigint(20) unsigned;default:2;not null;comment:职务分类"` + JobId int64 `json:"jobid" gorm:"column:job_id;type:bigint(20) unsigned;default:0;not null;comment:职务"` + JobLeve int64 `json:"jobleve" gorm:"column:job_leve;type:bigint(20) unsigned;default:0;not null;comment:职务等级"` + Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:写入时间"` + EiteTime int64 `json:"eitetime" gorm:"column:eite_time;type:bigint(20) unsigned;default:0;not null;comment:编辑时间"` + Wechat string `json:"wechat" gorm:"column:wechat;type:varchar(255) unsigned;default:'';not null;comment:微信UserId"` + WorkWechat string `json:"workwechat" gorm:"column:work_wechat;type:varchar(255) unsigned;default:'';not null;comment:企业微信UserId"` + State int `json:"state" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)` + Key int64 `json:"key" gorm:"column:key;type:bigint(50) unsigned;default:0;not null;comment:key"` + IsAdmin int `json:"isadmin" gorm:"column:is_admin;type:tinyint(1) unsigned;default:1;not null;comment:是否为管理员(1:不是;2:分公司;3:集团管理员;4:超级管` + Password string `json:"password" gorm:"column:password;type:varchar(255) unsigned;default:'';not null;comment:密码"` + Role string `json:"role" gorm:"column:role;type:longtext;comment:角色"` + EmpTypeName string `json:"emptypename" gorm:"column:emp_type_name;type:varchar(255) unsigned;default:'';not null;comment:用工关系中文"` + HireClassName string `json:"hireclassname" gorm:"column:hire_class_name;type:varchar(255) unsigned;default:'';not null;comment:雇佣类型中文"` + SunMainDeparment int64 `json:"sunmaindeparment" gorm:"column:sun_main_deparment;type:bigint(20) unsigned;default:0;not null;comment:二级主部门"` + Ruleid int64 `json:"ruleid" gorm:"column:ruleid;type:bigint(20) unsigned;default:0;not null;comment:轮询规则"` + IconPhoto string `json:"iconphoto" gorm:"column:icon_photo;type:longtext;default:'';not null;comment:照片"` + PersonInCharge int `json:"personincharge" gorm:"column:person_in_charge;type:tinyint(1) unsigned;default:1;not null;comment:负责人(1:是;2:否)` + ResponsibleDepartment string `json:"responsibledepartment" gorm:"column:responsible_department;type:longtext;default:'';not null;comment:负责的行政组织"` + ResponsibleDepartmentJson string `json:"responsibledepartmentjson" gorm:"column:responsible_department_json;type:longtext;default:'';not null;comment:负责的行政组织json"` + WorkSection int64 `json:"workSection" gorm:"column:work_section;type:bigint(20) unsigned;default:0;not null;comment:工段"` + IsShowTrue int64 `json:"isShowTrue" gorm:"column:is_show_true;type:int(5) unsigned;default:2;not null;comment:信息是否锁定` + ExcelTemplate int64 `json:"excelTemplate" gorm:"column:excel_template;type:bigint(20) unsigned;default:0;not null;comment:信息来源于哪个模板` + PositionCategory string `json:"positionCategory" gorm:"column:positionCategory;type:tinytext;comment:岗位序列"` + + Idcardno string `json:"idcardno" gorm:"column:idcardno;type:varchar(50) unsigned;default:'';not null;comment:身份证号"` + Passportno string `json:"passportno" gorm:"column:passportno;type:varchar(50) unsigned;default:'';not null;comment:护照号码"` + Globalroaming string `json:"globalroaming" gorm:"column:globalroaming;type:varchar(50) unsigned;default:'';not null;comment:国际区号"` + Mobilephone string `json:"mobilephone" gorm:"column:mobilephone;type:varchar(50) unsigned;default:'';not null;comment:手机号码"` + Email string `json:"email" gorm:"column:email;type:varchar(255) unsigned;default:'';not null;comment:电子邮件"` + Gender int `json:"gender" gorm:"column:gender;type:tinyint(1) unsigned;default:1;not null;comment:性别(1:男性;2:女性;3:中性)"` + Birthday int64 `json:"birthday" gorm:"column:birthday;type:bigint(20) unsigned;default:0;not null;comment:birthday"` + Myfolk string `json:"myfolk" gorm:"column:myfolk;type:varchar(50) unsigned;default:'';not null;comment:民族"` + Nativeplace string `json:"nativeplace" gorm:"column:nativeplace;type:varchar(255) unsigned;default:'';not null;comment:籍贯"` + Idcardstartdate int64 `json:"idcardstartdate" gorm:"column:idcardstartdate;type:bigint(20) unsigned;default:0;not null;comment:身份证有效期开始"` + Idcardenddate int64 `json:"idcardenddate" gorm:"column:idcardenddate;type:bigint(20) unsigned;default:0;not null;comment:身份证有效期结束"` + Idcardaddress string `json:"idcardaddress" gorm:"column:idcardaddress;type:varchar(255) unsigned;default:'';not null;comment:身份证地址"` + IdcardIssued string `json:"idcardIssued" gorm:"column:idcardIssued;type:varchar(255) unsigned;default:'';not null;comment:身份证签发机关"` + Health int `json:"health" gorm:"column:health;type:tinyint(1) unsigned;default:1;not null;comment:健康状况(1:良好;2:一般;3:较弱,4:有生理缺陷;5:残废)"` + Maritalstatus int `json:"maritalstatus" gorm:"column:maritalstatus;type:tinyint(1) unsigned;default:1;not null;comment:婚姻状况(1:未婚;2:已婚;3:丧偶;4:离异)"` + Internaltelephone string `json:"internaltelephone" gorm:"column:internaltelephone;type:varchar(255) unsigned;default:'';not null;comment:内线电话"` + Currentresidence string `json:"currentresidence" gorm:"column:currentresidence;type:varchar(255) unsigned;default:'';not null;comment:现居住地址"` + Constellation int `json:"constellationing" gorm:"column:constellationing;type:tinyint(3) unsigned;comment:星座(1:白羊座;2:金牛座;3:双子座;4:巨蟹座;5:狮子座;6:处女座;7:天枰座;8:天蝎座;9:射手座;10:摩羯座;11:水瓶座;12:双鱼座)"` + Isdoubleworker int `json:"isdoubleworker" gorm:"column:isdoubleworker;type:tinyint(1) unsigned;default:1;comment:是否双职工(1:是;2:否)"` + Isveterans int `json:"isveterans" gorm:"column:isveterans;type:tinyint(1) unsigned;default:1;comment:是否为退役军人(1:是;2:否)"` + Veteransnumber string `json:"veteransnumber" gorm:"column:veteransnumber;type:varchar(255) unsigned;default:'';comment:退役证编号"` + Jobstartdate int64 `json:"jobstartdate" gorm:"column:jobstartdate;type:bigint(20) unsigned;default:0;comment:参加工作日期"` + Entrydate int64 `json:"entrydate" gorm:"column:entrydate;type:bigint(20) unsigned;default:0;comment:入职日期"` + Probationperiod int `json:"probationperiod" gorm:"column:probationperiod;type:int(5) unsigned;default:0;comment:试用期"` + Planformaldate int64 `json:"planformaldate" gorm:"column:planformaldate;type:bigint(20) unsigned;default:0;comment:预计转正日期"` + PoliticalOutlook int `json:"politicaloutlook" gorm:"column:political_outlook;type:tinyint(3) unsigned;default:1;comment:政治面貌(1:群众;2:无党派;3:台盟会员;4:九三社员;5:致公党员;6:农工党员;7:民进会员;8:民建会员;9:民盟盟员;10:民革会员,11:共青团员;12:预备党员;13:中共党员)"` + + MaritalstatusCn string `json:"maritalstatuscn" gorm:"column:maritalstatus_cn;type:varchar(50) unsigned;default:'';not null;comment:婚姻状况汉字说明"` + ConstellationingCn string `json:"constellationingcn" gorm:"column:constellationing_cn;type:varchar(50) unsigned;default:'';not null;comment:星座汉字说明"` + PoliticalOutlookCn string `json:"politicaloutlookcn" gorm:"column:political_outlook_cn;type:varchar(50) unsigned;default:'';not null;comment:政治面貌汉字说明"` + HealthCn string `json:"healthcn" gorm:"column:health_cn;type:varchar(50) unsigned;default:'';not null;comment:健康状况中文说明"` + NameUsedBefore string `json:"nameusedbefore" gorm:"column:name_used_before;type:varchar(255) unsigned;default:'';not null;comment:曾用名"` + 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:爱好"` + + DomicileType string `json:"domicileType" gorm:"column:domicile_type;type:varchar(100) unsigned;default:'';not null;comment:户籍类型"` + IdCardnoLongTerm int `json:"idCardnoLongTerm" gorm:"column:idCardnoLongTerm;type:int(1) unsigned;default:0;not null;comment:身份证是否长期有效(1:是;2:否)"` + MobileShortNumber string `json:"mobileShortNumber" gorm:"column:mobileShortNumber;type:varchar(50) unsigned;default:'';not null;comment:手机小号"` + Channel int `json:"channel" gorm:"column:channel;type:int(1) unsigned;default:0;not null;comment:入职渠道(1:社会招聘;2:校园招聘;3:内部推荐)"` + BloodType string `json:"bloodType" gorm:"column:bloodType;type:varchar(10) unsigned;default:'';not null;comment:血型"` + + Company int64 `json:"company" gorm:"primaryKey;column:company;type:bigint(20) unsigned;not null;comment:所属公司;"` + Orgid int64 `json:"orgid" gorm:"primaryKey;column:orgid;type:bigint(20) unsigned;not null;comment:行政组织ID;"` + Position int64 `json:"position" gorm:"primaryKey;column:position;type:bigint(20) unsigned;not null;comment:职位;"` + TeamsId int64 `json:"teamsId" gorm:"primaryKey;column:teamsId;type:bigint(20) unsigned;not null;comment:班组Id;"` + AssignType int `json:"assignType" gorm:"column:assignType;type:int(1) unsigned;default:50;not null;comment:1:主职;2:兼职"` +} + +func (cont *UserOrgCont) TableName() string { + return "user_org_cont" +} + +// 编辑员工档案 +func (cont *UserOrgCont) EiteCont(whereMap interface{}, saveData interface{}) (err error) { + err = overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Updates(saveData).Error + fmt.Printf("编辑信息:---2--->%v\n", err) + err = overall.CONSTANT_DB_HrInside.Model(&cont).Where(whereMap).Updates(saveData).Error + fmt.Printf("编辑信息:---3--->%v\n", err) + return +} + +// 获取员工档案 +func (cont *UserOrgCont) GetCont(whereMap interface{}, field ...string) (err error) { + gormDb := overall.CONSTANT_DB_HR.Model(&cont) + if len(field) > 0 { + fieldStr := strings.Join(field, ",") + gormDb = gormDb.Select(fieldStr) + } + gormDb = gormDb.Where(whereMap) + err = gormDb.First(&cont).Error + return +} + +// 根据ID获取行政组织内容 +func (cont *UserOrgCont) RedisCont(key string, class int) (err error) { + redisFileKey := fmt.Sprintf("UserDossier:Info:%v_%v", key, overall.CONSTANT_CONFIG.RedisPrefixStr.Alias) + redisClient := grocerystore.RunRedis(overall.CONSTANT_REDIS4) //设定redis库 + isTrue, tokens := redisClient.Get(redisFileKey) + if isTrue && tokens != "" { + err = json.Unmarshal([]byte(tokens), &cont) + return + } else { + var jsonStr []byte + switch class { + case 1: + err = overall.CONSTANT_DB_HR.Model(&cont).Where("`number` = ?", key).First(&cont).Error + case 2: + err = overall.CONSTANT_DB_HR.Model(&cont).Where("`key` = ?", key).First(&cont).Error + default: + err = overall.CONSTANT_DB_HR.Model(&cont).Where("`id` = ?", key).First(&cont).Error + } + + if err == nil { + redisClient.SetRedisTime(0) + jsonStr, err = json.Marshal(cont) + redisClient.Set(redisFileKey, string(jsonStr)) + } + } + return +} diff --git a/overall/publicmethod/formatOutput.go b/overall/publicmethod/formatOutput.go index 0a1dcdb..18b8290 100644 --- a/overall/publicmethod/formatOutput.go +++ b/overall/publicmethod/formatOutput.go @@ -281,13 +281,13 @@ func ReceiveData(c *gin.Context) ([]byte, error) { SM4Iv = Sm4token } - // fmt.Printf("\n\n接收参数解析------Sm4token-------->%v\n\n", Sm4token) + // fmt.Printf("\n\n接收参数解析------Sm4token-------->%v\n\n", SM4Iv) sm4Iv16 := ProcessString(SM4Iv, 16, "s") // fmt.Printf("\n\n接收参数解析------sm4Iv16-------->%v\n\n", sm4Iv16) // fmt.Printf("\n\n接收参数解析------dataCont.EncryptedFile-------->%v\n\n", dataCont.EncryptedFile) jieMi, err := SM4DecryptNew(dataCont.EncryptedFile, sm4Iv16) - // fmt.Printf("\n\n接收参数解析------err-------->%v\n\n", err) + fmt.Printf("\n\n接收参数解析------err-------->%v------->%v\n\n", err, string(jieMi)) if err != nil { return json.Marshal(val) } diff --git a/overall/publicmethod/powerRedis.go b/overall/publicmethod/powerRedis.go index e588ac6..d438192 100644 --- a/overall/publicmethod/powerRedis.go +++ b/overall/publicmethod/powerRedis.go @@ -29,19 +29,36 @@ func SetupPowerInfo(userKey int64, powerInfo string) { @ 时间: 2025-11-26 14:08:15 @ 功能: 获取权限 */ -func GetSystemPowerInfo(userKey int64) (powerInfo SendAllPower) { - redisFileKey := fmt.Sprintf("SystemPower:AllPower_%v_%v", overall.CONSTANT_CONFIG.RedisPrefixStr.Alias, userKey) - redisClient := grocerystore.RunRedis(overall.CONSTANT_REDIS4) - isTrue, powerStr := redisClient.Get(redisFileKey) - if isTrue { - json.Unmarshal([]byte(powerStr), &powerInfo) - } else { +func GetSystemPowerInfo(userKey int64, key ...int) (powerInfo SendAllPower) { + if len(key) > 0 { var myContInfo modelshr.ManCont myContInfo.GetCont(map[string]interface{}{"`key`": userKey}) AllPowerConfig, _ := GetMyPowerPusr("person", myContInfo.Role, myContInfo.Key, myContInfo.AdminOrg, myContInfo.Position) writeRedisData, _ := json.Marshal(AllPowerConfig) + // fmt.Printf("\n\n------------writeRedisData----------->%v\n\n", string(writeRedisData)) SetupPowerInfo(myContInfo.Key, string(writeRedisData)) + json.Unmarshal(writeRedisData, &powerInfo) + } else { + + redisFileKey := fmt.Sprintf("SystemPower:AllPower_%v_%v", overall.CONSTANT_CONFIG.RedisPrefixStr.Alias, userKey) + redisClient := grocerystore.RunRedis(overall.CONSTANT_REDIS4) + isTrue, powerStr := redisClient.Get(redisFileKey) + + // fmt.Printf("\n\n获取权限------GetSystemPowerInfo---------->%v\n\n\n\n", isTrue) + + if isTrue { + json.Unmarshal([]byte(powerStr), &powerInfo) + } else { + var myContInfo modelshr.ManCont + myContInfo.GetCont(map[string]interface{}{"`key`": userKey}) + AllPowerConfig, _ := GetMyPowerPusr("person", myContInfo.Role, myContInfo.Key, myContInfo.AdminOrg, myContInfo.Position) + + writeRedisData, _ := json.Marshal(AllPowerConfig) + // fmt.Printf("\n\n------------writeRedisData----------->%v\n\n", string(writeRedisData)) + SetupPowerInfo(myContInfo.Key, string(writeRedisData)) + json.Unmarshal(writeRedisData, &powerInfo) + } } return } @@ -61,6 +78,15 @@ func GetMyMenuPower(userKey int64, menuId string) (menuPower SystemInfoPower) { } return } +func GetMyMenuPowerNew(userKey int64, menuId string, key int) (menuPower SystemInfoPower) { + myPower := GetSystemPowerInfo(userKey, key) + for _, v := range myPower.SystemPower { + if v.AppId == menuId { + menuPower = v + } + } + return +} /* *