From 61e4846d0ec22325f572981ba174f958006ee3a2 Mon Sep 17 00:00:00 2001 From: herenshan112 Date: Mon, 15 May 2023 08:15:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=95=B0=E6=8D=AE=E7=A9=BF?= =?UTF-8?q?=E9=80=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/base/loginVerify/login.go | 44 ++++-- api/base/loginVerify/type.go | 15 ++ api/shiyan/maptostruct/department.go | 123 +++++++++++++++- api/shiyan/maptostruct/sendwechat.go | 29 ++++ .../departmentpc/ding_xing.go | 31 ++-- .../departmentpc/dingliang.go | 5 + api/version1/flowchart/myworkflow.go | 26 ++-- .../currency_recipe/general_method.go | 47 +++++- api/workflow/currency_recipe/type.go | 1 + api/workflow/workflowengine/workflowapi.go | 1 + api/workwechat/message.go | 138 +++++++++--------- apirouter/apishiyan/maptostruct.go | 9 +- config/configDatabase/database.yaml | 20 +-- identification/interceptor/identity.go | 2 +- overall/publicmethod/formatOutput.go | 2 +- 15 files changed, 357 insertions(+), 136 deletions(-) diff --git a/api/base/loginVerify/login.go b/api/base/loginVerify/login.go index c375a62..a39ca02 100644 --- a/api/base/loginVerify/login.go +++ b/api/base/loginVerify/login.go @@ -1,6 +1,7 @@ package loginVerify import ( + "encoding/json" "fmt" "key_performance_indicators/middleware/grocerystore" "key_performance_indicators/models/modelshr" @@ -105,18 +106,32 @@ func (a *ApiMethod) ScanCodeLogin(c *gin.Context) { redisClient := grocerystore.RunRedis(overall.CONSTANT_REDIS5) redisClient.SetRedisTime(10800) redisClient.HashMsetAdd(redisFileKey, writeRedisData) + + groupId, companyId, departmentId, sunDepartId, workShopId := publicmethod.GetOrgStructurees(userCont.AdminOrg) + + fmt.Printf("groupId----->%v\ncompanyId----->%v\ndepartmentId----->%v\nsunDepartId----->%v\nworkShopId----->%v\n", groupId, companyId, departmentId, sunDepartId, workShopId) + + var sunmaindeparment int64 + + if companyId != sunDepartId { + sunmaindeparment = sunDepartId + } + //缓存写入个人信息 redisMyContKey := fmt.Sprintf("ScanCode:Authentication:UserCont_%v_%v", overall.CONSTANT_CONFIG.RedisPrefixStr.Alias, userCont.Number) myCont := publicmethod.MapOut[string]() myCont["id"] = userCont.Id - myCont["number"] = userCont.Number //员工工号 - myCont["name"] = userCont.Name //姓名 - myCont["icon"] = userCont.Icon //头像 - myCont["hireclass"] = userCont.HireClass //雇佣类型(1:雇佣入职;2:再入职;) - myCont["emptype"] = userCont.EmpType //用工关系(1:临时工 , 2:编外人员 ;3:实习&实习生;4:试用员工;5:待分配;6:待岗;7:临时调入;8:正式员工;9:长期病假;10:停薪留职;11:退休;12:辞职;13:辞退;14:离职) - myCont["company"] = userCont.Company //入职公司 - myCont["maindeparment"] = userCont.MainDeparment //主部门 - myCont["sunmaindeparment"] = userCont.SunMainDeparment //二级主部门 + myCont["number"] = userCont.Number //员工工号 + myCont["name"] = userCont.Name //姓名 + myCont["icon"] = userCont.Icon //头像 + myCont["hireclass"] = userCont.HireClass //雇佣类型(1:雇佣入职;2:再入职;) + myCont["emptype"] = userCont.EmpType //用工关系(1:临时工 , 2:编外人员 ;3:实习&实习生;4:试用员工;5:待分配;6:待岗;7:临时调入;8:正式员工;9:长期病假;10:停薪留职;11:退休;12:辞职;13:辞退;14:离职) + myCont["company"] = userCont.Company //入职公司 + // myCont["maindeparment"] = userCont.MainDeparment //主部门 + // myCont["sunmaindeparment"] = userCont.SunMainDeparment //二级主部门 + myCont["maindeparment"] = companyId //主部门 + myCont["sunmaindeparment"] = sunmaindeparment //二级主部门 + myCont["deparment"] = userCont.Deparment //部门 myCont["adminorg"] = userCont.AdminOrg //所属行政组织 myCont["teamid"] = userCont.TeamId //班组 @@ -170,7 +185,18 @@ func (a *ApiMethod) ScanCodeLogin(c *gin.Context) { redisClient.HashMsetAdd(redisMyContKey, myCont) saveData["usercont"] = myCont - // fmt.Printf("redisMyContKey------Login----->%v\n", redisMyContKey) + + var sendKpiCont WriteIderCont + sendKpiCont.Openid = requestData.OpenId + sendKpiCont.Key = userKeyCode + sendKpiCont.Token = sha1Token + sendKpiCont.UserInfo.Key = strconv.FormatInt(userCont.Key, 10) + sendKpiCont.UserInfo.Number = userCont.Number + sendKpiCont.UserInfo.Password = userCont.Password + sendDate, _ := json.Marshal(sendKpiCont) + sdff := publicmethod.CurlPostJosn("http://120.224.6.6:39168/shiyan/write_token", sendDate) + + fmt.Printf("redisMyContKey------Login----->%v\n", sdff) publicmethod.Result(0, saveData, c) } diff --git a/api/base/loginVerify/type.go b/api/base/loginVerify/type.go index 2621851..b1a300d 100644 --- a/api/base/loginVerify/type.go +++ b/api/base/loginVerify/type.go @@ -47,3 +47,18 @@ type ExamConfig struct { Url string `json:"url"` State int `json:"state"` } + +// 写入身份认证 +type WriteIderCont struct { + Openid string `json:"openid"` + Key string `json:"key"` + Token string `json:"token"` + UserInfo UserInfoCont `json:"userinfo"` +} + +// 人员信息 +type UserInfoCont struct { + Number string `json:"number"` + Password string `json:"password"` + Key string `json:"key"` +} diff --git a/api/shiyan/maptostruct/department.go b/api/shiyan/maptostruct/department.go index 08337e3..3b36828 100644 --- a/api/shiyan/maptostruct/department.go +++ b/api/shiyan/maptostruct/department.go @@ -231,8 +231,8 @@ func (a *ApiMethod) VerifDepartDetasil(c *gin.Context) { } for _, v := range detasilCont { if v.Paretment != "" { //判断是否有关联部门 - orgIdStr := strings.Split(v.Paretment, ",") //转换程切片 - reportList := strings.Split(v.Reportary, ",") //转换程切片 + orgIdStr := strings.Split(v.Paretment, ",") //转换程切片部门 + reportList := strings.Split(v.Reportary, ",") //转换程切片人 if len(orgIdStr) > 0 { var tarCont modelskpi.EvaluationTarget tarCont.GetCont(map[string]interface{}{"`et_id`": v.ParentId}, "`et_dimension`", "`et_type`") @@ -266,8 +266,10 @@ func (a *ApiMethod) VerifDepartDetasil(c *gin.Context) { */ func ChuLiTiBaoRenGuoDu(dimensionId, targetId, targetSunId, targetBylaws, postId int64, typeInt, class, level int, orgId string, manKey []string) { defer syncSeting.Done() - for _, v := range manKey { - handTarReport(dimensionId, targetId, targetSunId, targetBylaws, postId, typeInt, class, level, orgId, v) + if len(manKey) > 0 { + for _, v := range manKey { + handTarReport(dimensionId, targetId, targetSunId, targetBylaws, postId, typeInt, class, level, orgId, v) + } } } @@ -389,3 +391,116 @@ func (a *ApiMethod) TestAndVerifyWorkflow(c *gin.Context) { } } + +/* +* +@ 作者: 秦东 +@ 时间: 2023-05-10 15:09:21 +@ 功能: 校正指标细则关联关系 +@ 参数 + + # + +@ 返回值 + + # + +@ 方法原型 + + # +*/ +func (a *ApiMethod) XiaoZhengBumenBylaws(c *gin.Context) { + var detasilCont []modelskpi.DetailedTarget + // err := overall.CONSTANT_DB_KPI.Where("`dt_id` = 806").Find(&detasilCont).Error + err := overall.CONSTANT_DB_KPI.Find(&detasilCont).Error + if err != nil || len(detasilCont) < 1 { + publicmethod.Result(1, err, c, "没有数据") + return + } + var fenZhu []modelskpi.DetailedTarget + jbq := 0 + for i, v := range detasilCont { + + if (i+1)%100 == 0 { + jbq++ + fenZhu = append(fenZhu, v) + fmt.Printf("满100分组---->%v---->%v---->%v---->%v\n", i, jbq, len(fenZhu), (i+1)%100) + syncSetings.Add(1) + go XiaoZhengCont(fenZhu) + var newFenzu []modelskpi.DetailedTarget + fenZhu = newFenzu + } else { + fenZhu = append(fenZhu, v) + } + + } + if len(fenZhu) > 0 { + syncSetings.Add(1) + go XiaoZhengCont(fenZhu) + jbq++ + fmt.Printf("还有剩余得---->%v---->%v\n", jbq, len(fenZhu)) + } + syncSetings.Wait() + publicmethod.Result(0, fenZhu, c) +} + +/* +* +@ 作者: 秦东 +@ 时间: 2023-05-10 15:15:38 +@ 功能: 部门细则校正操作 +@ 参数 + + # + +@ 返回值 + + # + +@ 方法原型 + + # +*/ +func XiaoZhengCont(bylawsList []modelskpi.DetailedTarget) { + defer syncSetings.Done() + if len(bylawsList) > 0 { + for _, v := range bylawsList { + //获取指标内容 + var tarCont modelskpi.EvaluationTarget + tarCont.GetCont(map[string]interface{}{"`et_id`": v.ParentId}, "`et_dimension`", "`et_type`", "`et_relevant_departments`", "`et_report`") + orgIdStr := strings.Split(v.Paretment, ",") //关联部门 + reportList := strings.Split(v.Reportary, ",") //关联提报人 + if v.Paretment != "" && v.Reportary != "" { + fmt.Printf("人员信息----1----》%v----》%v----》%v\n", reportList, v.Reportary, len(reportList)) + for _, ov := range orgIdStr { //循环处理栏目对照关系 + handDepartmentTarget(tarCont.Dimension, v.ParentId, v.ParentIdSun, v.Id, 0, 3, 1, tarCont.Type, ov) + if len(reportList) > 0 { + syncSeting.Add(1) + go ChuLiTiBaoRenGuoDu(tarCont.Dimension, v.ParentId, v.ParentIdSun, v.Id, 0, 1, tarCont.Type, 3, ov, reportList) + } + } + } + if v.Paretment != "" && v.Reportary == "" && tarCont.Report != "" { + reportDepartList := strings.Split(tarCont.Report, ",") //关联提报人 + fmt.Printf("人员信息----2----》%v\n", reportDepartList) + for _, ov := range orgIdStr { //循环处理栏目对照关系 + handDepartmentTarget(tarCont.Dimension, v.ParentId, v.ParentIdSun, v.Id, 0, 3, 1, tarCont.Type, ov) + syncSeting.Add(1) + go ChuLiTiBaoRenGuoDu(tarCont.Dimension, v.ParentId, v.ParentIdSun, v.Id, 0, 1, tarCont.Type, 3, ov, reportDepartList) + } + } + if v.Paretment == "" && v.Reportary != "" && tarCont.RelevantDepartments != "" { + orgDepartIdStr := strings.Split(tarCont.RelevantDepartments, ",") //关联部门 + fmt.Printf("人员信息----3----》%v\n", reportList) + for _, ov := range orgDepartIdStr { //循环处理栏目对照关系 + handDepartmentTarget(tarCont.Dimension, v.ParentId, v.ParentIdSun, v.Id, 0, 3, 1, tarCont.Type, ov) + if len(reportList) > 0 { + syncSeting.Add(1) + go ChuLiTiBaoRenGuoDu(tarCont.Dimension, v.ParentId, v.ParentIdSun, v.Id, 0, 1, tarCont.Type, 3, ov, reportList) + } + } + } + } + syncSeting.Wait() + } +} diff --git a/api/shiyan/maptostruct/sendwechat.go b/api/shiyan/maptostruct/sendwechat.go index 48d6138..920a70b 100644 --- a/api/shiyan/maptostruct/sendwechat.go +++ b/api/shiyan/maptostruct/sendwechat.go @@ -4,6 +4,7 @@ import ( "encoding/json" "fmt" "key_performance_indicators/api/workwechat" + "key_performance_indicators/middleware/grocerystore" "key_performance_indicators/models/modelshr" "key_performance_indicators/models/modelskpi" "key_performance_indicators/overall" @@ -402,3 +403,31 @@ func (a *ApiMethod) UpdateMiniCard(c *gin.Context) { publicmethod.Result(0, outPut, c) } + +/* +* +@ 作者: 秦东 +@ 时间: 2023-05-09 08:44:15 +@ 功能: 实验读取哈希 +@ 参数 + + # + +@ 返回值 + + # + +@ 方法原型 + + # +*/ +func (a *ApiMethod) GetHashGet(c *gin.Context) { + redisFileKey := fmt.Sprintf("ScanCode:Authentication:LoginApi_%v_%v", overall.CONSTANT_CONFIG.RedisPrefixStr.Alias, "e3bfa398fe9d0e1ab78a00ff59eff788") + redisClient := grocerystore.RunRedis(overall.CONSTANT_REDIS5) + userRedisToken, _ := redisClient.HashGetAll(redisFileKey) + _, userRedisTokens := redisClient.HashGet(redisFileKey, "usertoken") + outPut := publicmethod.MapOut[string]() + outPut["userRedisToken"] = userRedisToken + outPut["userRedisTokens"] = userRedisTokens + publicmethod.Result(0, outPut, c) +} diff --git a/api/version1/departmentseting/departmentpc/ding_xing.go b/api/version1/departmentseting/departmentpc/ding_xing.go index e6d429a..c513cc9 100644 --- a/api/version1/departmentseting/departmentpc/ding_xing.go +++ b/api/version1/departmentseting/departmentpc/ding_xing.go @@ -164,7 +164,7 @@ func (a *ApiMethod) GetQualityBylawsTasks(c *gin.Context) { myLoginCont, _ := publicmethod.LoginMyCont(c) var qualEvaCont modelskpi.QualitativeEvaluationView gormDb := overall.CONSTANT_DB_KPI.Table(fmt.Sprintf("%s qe", qualEvaCont.TableName())).Select("qe.qe_id,qe.qe_target_sun,qe.qe_detailed_target,qe.qe_content,qe.qe_censor_cont,qe.qe_min_score,qe.qe_max_score,qe.qe_unit").Where("qe.`qe_type` = 1 AND qe.`qe_state` = 1 AND qe.`qe_accept_evaluation` = ? AND qe.`qe_target` = ?", receivedValue.OrgId, receivedValue.TargetId) - gormDb = gormDb.Joins("JOIN target_report td ON qe.qe_target = td.target_id AND qe.qe_accept_evaluation = td.`department_id` AND td.target_bylaws = qe.`qe_detailed_target` AND td.`type` = 1 AND td.`post_id` = 0 AND td.state = 1 AND td.type_level = 3 AND td.`man_key` = ?", myLoginCont.Key) + gormDb = gormDb.Joins("JOIN target_report td ON qe.qe_target = td.target_id AND qe.qe_accept_evaluation = td.`department_id` AND td.target_bylaws = qe.`qe_detailed_target` AND td.`type` = 1 AND td.`post_id` = 0 AND td.state = 1 AND td.`man_key` = ?", myLoginCont.Key) if receivedValue.OrgId != "" { gormDb = gormDb.Where("`qe_accept_evaluation` = ?", receivedValue.OrgId) } @@ -461,6 +461,7 @@ func (a *ApiMethod) SubmitQualityAssess(c *gin.Context) { var workwechatErr error if scoreFlowErr == nil && evalProFlowErr == nil && flowLogContErr == nil { addErr := gormDb.Commit().Error + fmt.Printf("addErr--->%v\n", addErr) if addErr == nil { if len(receivedValue.UploadFiles) > 0 { EditFileHandel(uuid, "score_flow", receivedValue.UploadFiles) @@ -468,6 +469,7 @@ func (a *ApiMethod) SubmitQualityAssess(c *gin.Context) { //下一个节点内容 nextNodeStr := string(nextNodeJson) if nextNodeStr != "" { //判断下个节点是否为空 + fmt.Printf("nextNodeStr--->%v\n", nextNodeStr) if len(haveWorkflow.NextNodeCont.UserList) > 0 { //判断下个节点是够有审批人 var recipient []string var sendWechatUserKey []string @@ -504,6 +506,11 @@ func (a *ApiMethod) SubmitQualityAssess(c *gin.Context) { templateCard.Source.Desc = fmt.Sprintf("%v-%v", haveWorkflow.NextNodeCont.NodeName, nodeType) //任务id,同一个应用任务id不能重复,只能由数字、字母和“_-@”组成 templateCard.TaskId = fmt.Sprintf("kpi_ratify_%v", uuid) + templateCard.ActionMenu.Desc = "恒信高科" + var rightHand workwechat.ActionListCont + rightHand.Text = "恒信高科" + rightHand.Key = fmt.Sprintf("kpi_head_%v", publicmethod.GetUUid(7)) + templateCard.ActionMenu.ActionList = append(templateCard.ActionMenu.ActionList, rightHand) //主内容框 var dimeCont modelskpi.DutyClass dimeCont.GetCont(map[string]interface{}{"`id`": qualEvalCont.Dimension}, "`title`") @@ -567,29 +574,9 @@ func (a *ApiMethod) SubmitQualityAssess(c *gin.Context) { templateCard.CardAction.Url = jumpUrl sendMsg.TemplateCard = templateCard callbackMsg, err = sendMsg.InitMes().SendMessage() - + fmt.Printf("callbackMsg--->%v\n", string(callbackMsg)) workwechatErr = workwechat.WriteUpdateWechatTempmsg(callbackMsg, sendMsg, 1, uuid, sendWechatUserKey) - /* - * - @ 作者: 秦东 - @ 时间: 2023-04-24 08:22:22 - @ 功能: 写入企业微信模版信息发送回调 - @ 参数 - - #wechatCallBack 文本发送回调 - #sendMsg 发送文本信息 - #typeClass 类型(1:文本通知型;2:图文展示型;3:按钮交互型;4:投票选择型;5:多项选择型) - #ordeeId 审批记录Id - #enforcer 接收人 - - @ 返回值 - - #err - - @ 方法原型 - #func WriteUpdateWechatTempmsg(wechatCallBack []byte, sendMsg SentMiniMessage, typeClass int, ordeeId int64, enforcer []string) (err error) - */ } } } diff --git a/api/version1/departmentseting/departmentpc/dingliang.go b/api/version1/departmentseting/departmentpc/dingliang.go index 8881046..e29af72 100644 --- a/api/version1/departmentseting/departmentpc/dingliang.go +++ b/api/version1/departmentseting/departmentpc/dingliang.go @@ -769,6 +769,11 @@ func (a *ApiMethod) SubmitQuantifyTarget(c *gin.Context) { templateCard.Source.Desc = fmt.Sprintf("%v-%v", haveWorkflow.NextNodeCont.NodeName, nodeType) //任务id,同一个应用任务id不能重复,只能由数字、字母和“_-@”组成 templateCard.TaskId = fmt.Sprintf("kpi_ratify_%v", uuid) + templateCard.ActionMenu.Desc = "恒信高科" + var rightHand workwechat.ActionListCont + rightHand.Text = "恒信高科" + rightHand.Key = fmt.Sprintf("kpi_head_%v", publicmethod.GetUUid(7)) + templateCard.ActionMenu.ActionList = append(templateCard.ActionMenu.ActionList, rightHand) //主内容框 templateCard.MainTitle.Title = fmt.Sprintf("考核周期:%v", publicmethod.UnixTimeToDay(occurrenceTime, 15)) //引用文献样式 diff --git a/api/version1/flowchart/myworkflow.go b/api/version1/flowchart/myworkflow.go index 9ceab40..0b581e7 100644 --- a/api/version1/flowchart/myworkflow.go +++ b/api/version1/flowchart/myworkflow.go @@ -62,16 +62,18 @@ func (a *ApiMethod) GetApprovalRecord(c *gin.Context) { gormDb = gormDb.Where("target_title LIKE ? OR bylaws_title LIKE ?", "%"+receivedValue.Title+"%", "%"+receivedValue.Title+"%") } userIdentity := publicmethod.DetermineUserIdentity(myLoginCont.Key) - switch userIdentity.Level { - case 1: - gormDb = gormDb.Where("FIND_IN_SET(?,`ep_participants`)", myLoginCont.Key) - case 2: - gormDb = gormDb.Where("`ep_setup_department` IN ? OR `ep_accept_department` IN ?", userIdentity.OrgList, userIdentity.OrgList) - case 3: - gormDb = gormDb.Where("`ep_clique` = ? ", userIdentity.Group) - case 4: - gormDb = gormDb.Where("`ep_setup_department` IN ? OR `ep_accept_department` IN ?", userIdentity.OrgList, userIdentity.OrgList) - default: + if myLoginCont.Role != "1" { + switch userIdentity.Level { + case 1: + gormDb = gormDb.Where("FIND_IN_SET(?,`ep_participants`)", myLoginCont.Key) + case 2: + gormDb = gormDb.Where("`ep_setup_department` IN ? OR `ep_accept_department` IN ?", userIdentity.OrgList, userIdentity.OrgList) + case 3: + gormDb = gormDb.Where("`ep_clique` = ? ", userIdentity.Group) + case 4: + gormDb = gormDb.Where("`ep_setup_department` IN ? OR `ep_accept_department` IN ?", userIdentity.OrgList, userIdentity.OrgList) + default: + } } if receivedValue.OrgId != "" { @@ -92,8 +94,8 @@ func (a *ApiMethod) GetApprovalRecord(c *gin.Context) { gormDb = gormDb.Where("ep_happen_time BETWEEN ? AND ?", startTime, endTime) } } - - fmt.Printf("userIdentity------------>%v\n", userIdentity) + jsonStr, _ := json.Marshal(userIdentity) + fmt.Printf("userIdentity------------>%v\n", string(jsonStr)) var total int64 totalErr := gormDb.Count(&total).Error if totalErr != nil { diff --git a/api/workflow/currency_recipe/general_method.go b/api/workflow/currency_recipe/general_method.go index 9112c7d..df3c802 100644 --- a/api/workflow/currency_recipe/general_method.go +++ b/api/workflow/currency_recipe/general_method.go @@ -2,6 +2,7 @@ package currency_recipe import ( "encoding/json" + "fmt" "key_performance_indicators/models/modelshr" "key_performance_indicators/models/modelskpi" "key_performance_indicators/overall" @@ -430,12 +431,12 @@ func BaseOrgGainOperator(orgId int64, performAction []NodeUserListCont) (userLis if len(performAction) > 0 { //获取行政组织所有行政组织上级和下级 allOrg := publicmethod.HaveAllOrgRelation(orgId) - // fmt.Printf("获取行政组织所有行政组织上级和下级--->%v--->%v\n", allOrg, orgId) + fmt.Printf("获取行政组织所有行政组织上级和下级--->%v--->%v--->%v\n", allOrg, orgId, performAction) // postOftoOrg := make(map[string][]int64, 0) var gainDirector GainLeveDirector for _, v := range performAction { if v.Type == "position" { - gainDirector.GetPostBaseOrg(v.TargetID, allOrg) + gainDirector.GetPostBaseOrg(v.TargetID, allOrg, orgId) // postOftoOrg[v.TargetID] = GetPostBaseOrg(v.TargetID) } } @@ -449,14 +450,15 @@ func BaseOrgGainOperator(orgId int64, performAction []NodeUserListCont) (userLis /* #unifyPosId 统一职务名称ID #orgList 行政组织ID列表 +#myOrgId 任务行政组织 */ -func (g *GainLeveDirector) GetPostBaseOrg(unifyPosId string, orgList []int64) { +func (g *GainLeveDirector) GetPostBaseOrg(unifyPosId string, orgList []int64, myOrgId int64) { var positionInfo modelshr.PositionUnify err := positionInfo.GetCont(map[string]interface{}{"`id`": unifyPosId}, "`content`") if err != nil { return } - // fmt.Printf("获取职务关联得行政组织-2-->%v\n", positionInfo) + fmt.Printf("获取职务关联得行政组织-2-->%v-->%v-->%v\n", unifyPosId, positionInfo, myOrgId) var posIdStr []int64 err = json.Unmarshal([]byte(positionInfo.Content), &posIdStr) if err != nil { @@ -465,12 +467,15 @@ func (g *GainLeveDirector) GetPostBaseOrg(unifyPosId string, orgList []int64) { //获取相关职务数据 var posCont []modelshr.PostDutiesJob err = overall.CONSTANT_DB_HR.Model(&modelshr.PostDutiesJob{}).Select("`id`,`name`,`adm_org`,`weight`").Where("`id` IN ?", posIdStr).Find(&posCont).Error - // fmt.Printf("获取职务关联得行政组织-1-->%v\n", orgIdList) + fmt.Printf("获取职务关联得行政组织-1-->%v\n", posCont) if err != nil || len(posCont) < 1 { + fmt.Printf("获取职务关联得行政组织-1-11111->%v\n", err) return } + var orgIdList []int64 var orgPosId []JudgeOrgOfPosition + fmt.Printf("获取职务关联得行政组织-1-11112333111->%v\n", err) for _, v := range posCont { //组织岗位与行政组织关系 if !publicmethod.IsInTrue[int64](v.AdministrativeOrganization, orgIdList) { orgIdList = append(orgIdList, v.AdministrativeOrganization) @@ -484,9 +489,12 @@ func (g *GainLeveDirector) GetPostBaseOrg(unifyPosId string, orgList []int64) { } jieguo := publicmethod.Intersect[int64](orgList, orgIdList) //获取交集,判断是否有相关职位 - // fmt.Printf("获取交集,判断是否有相关职位-1-->%v-->%v-->%v-->%v\n", jieguo, orgList, orgIdList, orgPosId) + fmt.Printf("获取交集,判断是否有相关职位-1-->%v-->%v-->%v-->%v\n", jieguo, orgList, orgIdList, orgPosId) //获取相关岗位人员 + + var myIdList []int64 if len(jieguo) > 0 { + for _, ovp := range orgPosId { if publicmethod.IsInTrue[int64](ovp.OrgId, jieguo) { var userInfoList []modelshr.PersonArchives @@ -497,13 +505,40 @@ func (g *GainLeveDirector) GetPostBaseOrg(unifyPosId string, orgList []int64) { err = gormDb.Find(&userInfoList).Error if err == nil && len(userInfoList) > 0 { for _, usev := range userInfoList { + if !publicmethod.IsInTrue[int64](usev.Id, g.UserId) { + g.UserId = append(g.UserId, usev.Id) + myIdList = append(myIdList, usev.Id) + } g.UserList = append(g.UserList, usev) } } + jsonCont, _ := json.Marshal(userInfoList) + fmt.Printf("负责人列表--sssss->%v--->%v\n", g.UserId, string(jsonCont)) } } + } + //获取指定的负责范围 + // for _, ovpnew := range orgPosId { + // if publicmethod.IsInTrue[int64](ovpnew.OrgId, jieguo) { + var userInfoListEs []modelshr.PersonArchives + gormDb := overall.CONSTANT_DB_HR.Where("`position` IN ? AND `person_in_charge` = 1 AND FIND_IN_SET(?,`responsible_department`) AND `emp_type` BETWEEN ? AND ?", posIdStr, myOrgId, 1, 10) + err = gormDb.Find(&userInfoListEs).Error + if err == nil && len(userInfoListEs) > 0 { + for _, usev := range userInfoListEs { + fmt.Printf("负责人列表-1111-->%v--->%v--->%v\n", g.UserId, !publicmethod.IsInTrue[int64](usev.Id, g.UserId), myIdList) + if !publicmethod.IsInTrue[int64](usev.Id, g.UserId) { + fmt.Printf("负责人列表-1222--%v\n", usev.Id) + g.UserList = append(g.UserList, usev) + } + } + } + jsonCont, _ := json.Marshal(userInfoListEs) + fmt.Printf("负责人列表--->%v--->%v\n", g.UserId, string(jsonCont)) + // } + // } + } // 获取第几级主管 diff --git a/api/workflow/currency_recipe/type.go b/api/workflow/currency_recipe/type.go index 77b5c7b..52b6074 100644 --- a/api/workflow/currency_recipe/type.go +++ b/api/workflow/currency_recipe/type.go @@ -210,6 +210,7 @@ type GainLeveDirector struct { Step int `json:"step"` // Leve int `json:"leve"` UserList []modelshr.PersonArchives + UserId []int64 } // 判断事那个行政组织得相关岗位 diff --git a/api/workflow/workflowengine/workflowapi.go b/api/workflow/workflowengine/workflowapi.go index 1426928..5b16738 100644 --- a/api/workflow/workflowengine/workflowapi.go +++ b/api/workflow/workflowengine/workflowapi.go @@ -67,6 +67,7 @@ func (a *ApiMethod) GetWorkFlowFullView(c *gin.Context) { jieguo := workflowInfo.InitWorkflow(receivedValue.FlowWorkId, "", myKey, receivedValue.OrgId).SendData() // sjkdjk, _ := json.Marshal(receivedValue) // fmt.Printf("初始化条件---》%v/n", string(sjkdjk)) + // return if !jieguo.IsTrue { publicmethod.Result(1, jieguo, c, "未能获取到流程!") } else { diff --git a/api/workwechat/message.go b/api/workwechat/message.go index 15ab36a..70be6cc 100644 --- a/api/workwechat/message.go +++ b/api/workwechat/message.go @@ -194,84 +194,86 @@ func UpdateWechatMsgCont(typeClass, attribute int, orderkey int64, enforcer stri if orderkey == 0 || enforcer == "" { return } - var updateWechatCont modelskpi.UpdateWechatTempmsg - err = overall.CONSTANT_DB_KPI.Where("`type` = ? AND `orderkey` = ? AND FIND_IN_SET(?,`enforcer`)", typeClass, orderkey, enforcer).Find(&updateWechatCont).Error - if err != nil || updateWechatCont.Sendmsgcont == "" || updateWechatCont.ResponseCode == "" || updateWechatCont.State == 1 { + var updateWechatCont []modelskpi.UpdateWechatTempmsg + err = overall.CONSTANT_DB_KPI.Where("`sate` = 2 AND `type` = ? AND `orderkey` = ? AND FIND_IN_SET(?,`enforcer`)", typeClass, orderkey, enforcer).Find(&updateWechatCont).Error + if err != nil || len(updateWechatCont) < 1 { return } - - sendUpdateMsg := publicmethod.MapOut[string]() - var weChatMsgCont SentMiniMessage - json.Unmarshal([]byte(updateWechatCont.Sendmsgcont), &weChatMsgCont) - - templateCardCont := publicmethod.MapOut[string]() - templateCardCont["card_type"] = weChatMsgCont.TemplateCard.CardType - templateCardCont["source"] = weChatMsgCont.TemplateCard.Source - templateCardCont["main_title"] = weChatMsgCont.TemplateCard.MainTitle - templateCardCont["task_id"] = weChatMsgCont.TemplateCard.TaskId - templateCardCont["action_menu"] = weChatMsgCont.TemplateCard.ActionMenu - templateCardCont["quote_area"] = weChatMsgCont.TemplateCard.QuoteArea - templateCardCont["horizontal_content_list"] = weChatMsgCont.TemplateCard.HorizontalContentList - templateCardCont["card_action"] = weChatMsgCont.TemplateCard.CardAction - - var userCont modelshr.PersonArchives - userCont.GetCont(map[string]interface{}{"`key`": enforcer}, "`name`") - attributeTitle := "同意申请" - switch attribute { - case 2: - attributeTitle = "同意申请" - case 3: - attributeTitle = "驳回申请" - default: - attributeTitle = "操作申请" - } - titleStr := fmt.Sprintf("%v已%v,查看详情", userCont.Name, attributeTitle) - for i, v := range weChatMsgCont.TemplateCard.JumpList { - if v.Type == 1 { - weChatMsgCont.TemplateCard.JumpList[i].Title = titleStr + for _, uv := range updateWechatCont { + sendUpdateMsg := publicmethod.MapOut[string]() + var weChatMsgCont SentMiniMessage + json.Unmarshal([]byte(uv.Sendmsgcont), &weChatMsgCont) + + templateCardCont := publicmethod.MapOut[string]() + templateCardCont["card_type"] = weChatMsgCont.TemplateCard.CardType + templateCardCont["source"] = weChatMsgCont.TemplateCard.Source + templateCardCont["main_title"] = weChatMsgCont.TemplateCard.MainTitle + templateCardCont["task_id"] = weChatMsgCont.TemplateCard.TaskId + templateCardCont["action_menu"] = weChatMsgCont.TemplateCard.ActionMenu + templateCardCont["quote_area"] = weChatMsgCont.TemplateCard.QuoteArea + templateCardCont["horizontal_content_list"] = weChatMsgCont.TemplateCard.HorizontalContentList + templateCardCont["card_action"] = weChatMsgCont.TemplateCard.CardAction + + var userCont modelshr.PersonArchives + userCont.GetCont(map[string]interface{}{"`key`": enforcer}, "`name`") + attributeTitle := "同意申请" + switch attribute { + case 2: + attributeTitle = "同意申请" + case 3: + attributeTitle = "驳回申请" + default: + attributeTitle = "操作申请" } - } - templateCardCont["jump_list"] = weChatMsgCont.TemplateCard.JumpList + titleStr := fmt.Sprintf("%v已%v,查看详情", userCont.Name, attributeTitle) + for i, v := range weChatMsgCont.TemplateCard.JumpList { + if v.Type == 1 { + weChatMsgCont.TemplateCard.JumpList[i].Title = titleStr + } + } + templateCardCont["jump_list"] = weChatMsgCont.TemplateCard.JumpList - receiveMsgMan := strings.Split(updateWechatCont.Enforcer, ",") - if len(receiveMsgMan) < 1 { + receiveMsgMan := strings.Split(uv.Enforcer, ",") + if len(receiveMsgMan) < 1 { - return - } - var weCahtOpenId []string - for _, v := range receiveMsgMan { - var userContWechat modelshr.PersonArchives - userContWechat.GetCont(map[string]interface{}{"`key`": v}, "`wechat`", "`work_wechat`") - if userContWechat.Wechat != "" { - if !publicmethod.IsInTrue[string](userContWechat.Wechat, weCahtOpenId) { - weCahtOpenId = append(weCahtOpenId, userContWechat.Wechat) - } + return } - if userContWechat.WorkWechat != "" { - if !publicmethod.IsInTrue[string](userContWechat.WorkWechat, weCahtOpenId) { - weCahtOpenId = append(weCahtOpenId, userContWechat.WorkWechat) + var weCahtOpenId []string + for _, v := range receiveMsgMan { + var userContWechat modelshr.PersonArchives + userContWechat.GetCont(map[string]interface{}{"`key`": v}, "`wechat`", "`work_wechat`") + if userContWechat.Wechat != "" { + if !publicmethod.IsInTrue[string](userContWechat.Wechat, weCahtOpenId) { + weCahtOpenId = append(weCahtOpenId, userContWechat.Wechat) + } + } + if userContWechat.WorkWechat != "" { + if !publicmethod.IsInTrue[string](userContWechat.WorkWechat, weCahtOpenId) { + weCahtOpenId = append(weCahtOpenId, userContWechat.WorkWechat) + } } - } - } - if len(weCahtOpenId) < 1 { + } + if len(weCahtOpenId) < 1 { - return + return + } + sendUpdateMsg["userids"] = weCahtOpenId + sendUpdateMsg["agentid"] = weChatMsgCont.AgentId + sendUpdateMsg["response_code"] = uv.ResponseCode + sendUpdateMsg["enable_id_trans"] = 1 + sendUpdateMsg["template_card"] = templateCardCont + + UpDateCont, err = UpdateMessageMap(sendUpdateMsg) + if err != nil { + return + } + var editUpdateWechatCont modelskpi.UpdateWechatTempmsg + editCont := publicmethod.MapOut[string]() + editCont["`sate`"] = 1 + editCont["`time`"] = time.Now().Unix() + err = editUpdateWechatCont.EiteCont(map[string]interface{}{"`id`": uv.Id}, editCont) } - sendUpdateMsg["userids"] = weCahtOpenId - sendUpdateMsg["agentid"] = weChatMsgCont.AgentId - sendUpdateMsg["response_code"] = updateWechatCont.ResponseCode - sendUpdateMsg["enable_id_trans"] = 1 - sendUpdateMsg["template_card"] = templateCardCont - UpDateCont, err = UpdateMessageMap(sendUpdateMsg) - if err != nil { - return - } - var editUpdateWechatCont modelskpi.UpdateWechatTempmsg - editCont := publicmethod.MapOut[string]() - editCont["`sate`"] = 1 - editCont["`time`"] = time.Now().Unix() - err = editUpdateWechatCont.EiteCont(map[string]interface{}{"`id`": updateWechatCont.Id}, editCont) return } diff --git a/apirouter/apishiyan/maptostruct.go b/apirouter/apishiyan/maptostruct.go index 57dff64..46acc0b 100644 --- a/apirouter/apishiyan/maptostruct.go +++ b/apirouter/apishiyan/maptostruct.go @@ -26,9 +26,10 @@ func (a *ApiRouter) RouterGroup(router *gin.RouterGroup) { apiRouter.GET("evalproctime", methodBinding.EvalProcTime) //审批流规制发生时间 apiRouter.POST("evalproctime", methodBinding.EvalProcTime) //审批流规制发生时间 - apiRouter.POST("correcting_depart_man", methodBinding.CorrectingDepartAndMan) //验证指标关联部门与指标关联提报人数据 - apiRouter.POST("verif_depart_sontarget", methodBinding.VerifDepartSonTarget) //验证部门子栏目关联对照 - apiRouter.POST("verif_depart_detasil", methodBinding.VerifDepartDetasil) //验证部门指标细则关系对照 + apiRouter.POST("correcting_depart_man", methodBinding.CorrectingDepartAndMan) //验证指标关联部门与指标关联提报人数据 + apiRouter.POST("verif_depart_sontarget", methodBinding.VerifDepartSonTarget) //验证部门子栏目关联对照 + apiRouter.POST("verif_depart_detasil", methodBinding.VerifDepartDetasil) //验证部门指标细则关系对照 + apiRouter.POST("new_verif_depart_detasil", methodBinding.XiaoZhengBumenBylaws) //验证部门指标细则关系对照 apiRouter.POST("xzbkhbm", methodBinding.XiangzhengBeikaoBumen) //验证部门指标细则关系对照 @@ -42,5 +43,7 @@ func (a *ApiRouter) RouterGroup(router *gin.RouterGroup) { apiRouter.POST("send_message_mini", methodBinding.SendMessageMini) //发送文本信息迷你消息 apiRouter.POST("update_mini_card", methodBinding.UpdateMiniCard) //更新文本信息迷你消息 + + apiRouter.POST("get_hash_get", methodBinding.GetHashGet) //实验读取哈希 } } diff --git a/config/configDatabase/database.yaml b/config/configDatabase/database.yaml index efb81d9..927bd3f 100644 --- a/config/configDatabase/database.yaml +++ b/config/configDatabase/database.yaml @@ -28,17 +28,17 @@ wechat: gorm_log: false #是否开启gorm日志 #HR数据库 hrdatabase: - # url_path: '127.0.0.1' #数据库地址 - # port: 3306 #数据库端口 - # name: 'hr_new' #数据库名称 - # username: 'root' #数据库用户民 - # password: 'root' #数据库密码 - - url_path: '120.224.6.6' #数据库地址 - port: 6666 #数据库端口 + url_path: '127.0.0.1' #数据库地址 + port: 3306 #数据库端口 name: 'hr_new' #数据库名称 - username: 'hr_new' #数据库用户民 - password: 'AnknKiXiXaxNrw78' #数据库密码 + username: 'root' #数据库用户民 + password: 'root' #数据库密码 + + # url_path: '120.224.6.6' #数据库地址 + # port: 6666 #数据库端口 + # name: 'hr_new' #数据库名称 + # username: 'hr_new' #数据库用户民 + # password: 'AnknKiXiXaxNrw78' #数据库密码 charset: 'utf8mb4' #数据库编码方式 parseTime: 'True' #是否自动转换时间 diff --git a/identification/interceptor/identity.go b/identification/interceptor/identity.go index 8305274..c8fb2d0 100644 --- a/identification/interceptor/identity.go +++ b/identification/interceptor/identity.go @@ -28,7 +28,7 @@ func AuthenticateUser() gin.HandlerFunc { redisClient := grocerystore.RunRedis(overall.CONSTANT_REDIS5) userRedisToken, isTrue := redisClient.HashGetAll(redisFileKey) if isTrue == false { - response.FailWithDetailed(gin.H{"reload": false, "code": 301}, "未登录或非法访问", c) + response.FailWithDetailed(gin.H{"reload": false, "code": 301}, redisFileKey, c) c.Abort() return } diff --git a/overall/publicmethod/formatOutput.go b/overall/publicmethod/formatOutput.go index 6d1669a..589b7c6 100644 --- a/overall/publicmethod/formatOutput.go +++ b/overall/publicmethod/formatOutput.go @@ -182,7 +182,7 @@ func DetermineUserIdentity(userKey int64) (identity outShenFen) { overall.CONSTANT_DB_System_Permission.Where("`state` = 1 AND `system` = ? AND `id` IN ? ", "kpi", roleList).Find(&roleVerify) //岗位权限范围判定 var postVerify modelssystempermission.Empower - postVerify.GetCont(map[string]interface{}{"`id`": userCont.Position, "`state`": 1, "`system`": "kpi"}) + postVerify.GetCont(map[string]interface{}{"`post_id`": userCont.Position, "`state`": 1, "`system`": "kpi"}) if roleVerify.Level >= postVerify.Level { identity.Level = roleVerify.Level } else {