package evaluation import ( "encoding/json" "fmt" "strconv" "gin_server_admin/commonus" "gin_server_admin/global" "gin_server_admin/model/assessmentmodel" "gin_server_admin/model/common/response" "gin_server_admin/model/hrsystem" "github.com/gin-gonic/gin" ) func (e *EvaluationInterface) ExamineFlow(c *gin.Context) { isTrue, userCont := commonus.ClientIdentity() if isTrue != true { response.Result(1001, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c) return } var requestData getExamineFlow c.ShouldBindJSON(&requestData) if requestData.Id == "" { response.Result(101, requestData, "数据获取失败!", c) return } if requestData.IsCorrection == 0 { requestData.IsCorrection = 2 } var qualEvalInfo assessmentmodel.QualitativeEvaluation qualWhere := commonus.MapOut() qualWhere["`qe_id`"] = requestData.Id qualEvalInfoErr := qualEvalInfo.GetCont(qualWhere) if qualEvalInfoErr != nil { response.Result(102, qualEvalInfoErr, "未查询到数据!", c) return } var flowMap []commonus.FlowAllMap // wxkStr := userCont.Wechat //1、创建 var oneFlowInfo commonus.FlowAllMap oneFlowInfo.Step = 1 oneFlowInfo.NodeName = commonus.GetSetpName(1) oneFlowInfo.State = 2 oneFlowInfo.Class = 1 oneFlowInfo.UserList = append(oneFlowInfo.UserList, GetApproveUser(userCont.Wechat)) flowMap = append(flowMap, oneFlowInfo) if qualEvalInfo.Type == 1 { //定性 //2、创建人部门负责人审核 var twoFlowInfo commonus.FlowAllMap twoFlowInfo.Step = 2 twoFlowInfo.NodeName = commonus.GetSetpName(2) twoFlowInfo.State = 1 twoFlowInfo.Class = 1 // orgCont, _ := commonus.GetNewOrgCont(map[string]interface{}{"`id`": userCont.Deparment}, "id", "wechat_organization_id") // sendUserIsTrue, sendUserList := commonus.GetSendMsgUserAry(16182159043990656, orgCont.WechatOrganizationId) twoDepartId, _ := strconv.ParseInt(userCont.MainDeparment, 10, 64) sendUserIsTrue, sendUserList := commonus.GetSendMsgUserAry(16182159043990656, twoDepartId) // jsonStr, _ := json.Marshal(userCont) // fmt.Printf("创建流程图----->%v----->%v----->%v\n", string(jsonStr), twoDepartId, sendUserList) if sendUserIsTrue == true { for _, v := range sendUserList { twoFlowInfo.UserList = append(twoFlowInfo.UserList, GetApproveUser(v)) } } flowMap = append(flowMap, twoFlowInfo) if requestData.PlusReduction != 1 { //3、被考核部门内勤进行责任划分 var threeFlowInfo commonus.FlowAllMap threeFlowInfo.Step = 3 threeFlowInfo.NodeName = commonus.GetSetpName(3) threeFlowInfo.State = 1 threeFlowInfo.Class = 1 // threeorgCont, _ := commonus.GetNewOrgCont(map[string]interface{}{"`id`": qualEvalInfo.AcceptEvaluation}, "id", "wechat_organization_id") // sendUserIsTrueThree, sendUserListThree := commonus.GetSendMsgUserAry(16118387069540343, threeorgCont.WechatOrganizationId) sendUserIsTrueThree, sendUserListThree := commonus.GetSendMsgUserAry(16118387069540343, qualEvalInfo.AcceptEvaluation) jsonStr, _ := json.Marshal(qualEvalInfo) fmt.Printf("创建流程图----->%v----->%v----->%v\n", string(jsonStr), twoDepartId, sendUserList) if sendUserIsTrueThree == true { for _, v := range sendUserListThree { userCont := GetApproveUser(v) if userCont.Id != "" { threeFlowInfo.UserList = append(threeFlowInfo.UserList, userCont) } } } flowMap = append(flowMap, threeFlowInfo) //4、被考核部门负责人对责任划分确认 var fourFlowInfo commonus.FlowAllMap fourFlowInfo.Step = 4 fourFlowInfo.NodeName = commonus.GetSetpName(7) fourFlowInfo.State = 1 fourFlowInfo.Class = 1 // fourorgCont, _ := commonus.GetNewOrgCont(map[string]interface{}{"`id`": qualEvalInfo.AcceptEvaluation}, "id", "wechat_organization_id") // sendUserIsTrueFour, sendUserListFour := commonus.GetSendMsgUserAry(16182159043990656, fourorgCont.WechatOrganizationId) sendUserIsTrueFour, sendUserListFour := commonus.GetSendMsgUserAry(16182159043990656, qualEvalInfo.AcceptEvaluation) fmt.Printf("根据部门获取内勤数据*******3***********>%v------->%v------->%v\n", sendUserIsTrueFour, sendUserListFour, qualEvalInfo.AcceptEvaluation) if sendUserIsTrueFour == true { for _, v := range sendUserListFour { fourFlowInfo.UserList = append(fourFlowInfo.UserList, GetApproveUser(v)) } } flowMap = append(flowMap, fourFlowInfo) if requestData.IsCorrection == 1 { //5、整改人节点。由内勤指定 var fiveFlowInfo commonus.FlowAllMap fiveFlowInfo.Step = 5 fiveFlowInfo.NodeName = commonus.GetSetpName(4) fiveFlowInfo.State = 1 fiveFlowInfo.Class = 2 // fiveFlowInfo.UserList = GetFlowNodeManEs(flowID, class, 5,encFile) flowMap = append(flowMap, fiveFlowInfo) //6、被考核部门负责人对整改措施确认 var sixFlowInfo commonus.FlowAllMap sixFlowInfo.Step = 6 sixFlowInfo.NodeName = commonus.GetSetpName(7) sixFlowInfo.State = 1 sixFlowInfo.Class = 1 // sixorgCont, _ := commonus.GetNewOrgCont(map[string]interface{}{"`id`": qualEvalInfo.AcceptEvaluation}, "id", "wechat_organization_id") // sendUserIsTrueSix, sendUserListSix := commonus.GetSendMsgUserAry(16182159043990656, sixorgCont.WechatOrganizationId) sendUserIsTrueSix, sendUserListSix := commonus.GetSendMsgUserAry(16182159043990656, qualEvalInfo.AcceptEvaluation) fmt.Printf("根据部门获取内勤数据*******2***********>%v------->%v------->%v\n", sendUserIsTrue, sendUserList, qualEvalInfo.AcceptEvaluation) if sendUserIsTrueSix == true { for _, v := range sendUserListSix { sixFlowInfo.UserList = append(sixFlowInfo.UserList, GetApproveUser(v)) } } flowMap = append(flowMap, sixFlowInfo) //7、发起人验收 var serverFlowInfo commonus.FlowAllMap serverFlowInfo.Step = 7 serverFlowInfo.NodeName = commonus.GetSetpName(6) serverFlowInfo.State = 1 serverFlowInfo.Class = 1 serverFlowInfo.UserList = append(serverFlowInfo.UserList, GetApproveUser(userCont.Wechat)) flowMap = append(flowMap, serverFlowInfo) } else { //5、发起人验收 // var serverEsFlowInfo commonus.FlowAllMap // serverEsFlowInfo.Step = 5 // serverEsFlowInfo.NodeName = commonus.GetSetpName(5) // serverEsFlowInfo.State = 1 // serverEsFlowInfo.Class = 1 // serverEsFlowInfo.UserList = append(serverEsFlowInfo.UserList, GetApproveUser(userCont.Wechat)) // flowMap = append(flowMap, serverEsFlowInfo) } } } else { //定量 //审批结束 var twoFlowInfo commonus.FlowAllMap twoFlowInfo.Step = 2 twoFlowInfo.NodeName = commonus.GetSetpName(7) twoFlowInfo.State = 1 twoFlowInfo.Class = 1 // where := commonus.MapOut() // where["id"] = userCont.Deparment // orgCont, _ := commonus.GetNewOrgCont(where, "id", "wechat_organization_id") departId, _ := strconv.ParseInt(userCont.MainDeparment, 10, 64) sendUserIsTrue, sendUserList := commonus.GetSendMsgUserAry(16182159043990656, departId) fmt.Printf("根据部门获取内勤数据**********1********>%v------->%v------->%v\n", sendUserIsTrue, sendUserList, departId) if sendUserIsTrue == true { for _, v := range sendUserList { twoFlowInfo.UserList = append(twoFlowInfo.UserList, GetApproveUser(v)) } } flowMap = append(flowMap, twoFlowInfo) } // flowMap = append(flowMap, oneFlowInfo) response.Result(0, flowMap, "查询成功!", c) } // 获取人员信息 func GetApproveUser(key string) (returnUser commonus.UserListFlowAll) { // var userCont hrsystem.Personnel var userCont hrsystem.PersonArchives // qualWhere := commonus.MapOut() // qualWhere["`key`"] = key userErr := global.GVA_DB_HrDataBase.Where("`wechat` = ? OR `work_wechat` = ?", key, key).First(&userCont).Error if userErr == nil { returnUser.Id = strconv.FormatInt(userCont.Key, 10) returnUser.Name = userCont.Name returnUser.Icon = userCont.Icon returnUser.Group = userCont.Company where := commonus.MapOut() where["id"] = userCont.Company orgCont, _ := commonus.GetNewOrgCont(where, "id", "name") returnUser.GroupName = orgCont.Name // returnUser.DepartmentId, _ = strconv.ParseInt(userCont.Deparment, 10, 64) returnUser.DepartmentId = userCont.MainDeparment whereDepart := commonus.MapOut() whereDepart["id"] = userCont.MainDeparment orgContDepart, _ := commonus.GetNewOrgCont(whereDepart, "id", "name") returnUser.DepartmentName = orgContDepart.Name // returnUser.DepartmentName = userCont.DepartmentName returnUser.WorkshopId = userCont.Position var positionCont hrsystem.Position positionContErr := positionCont.GetCont(map[string]interface{}{"`id`": userCont.Position}, "`name`") if positionContErr == nil { returnUser.WorkshopName = positionCont.Name } returnUser.PostId = userCont.AdminOrg var postCont hrsystem.AdministrativeOrganization postContErr := postCont.GetCont(map[string]interface{}{"`id`": userCont.AdminOrg}, "`name`") if postContErr == nil { returnUser.PostName = postCont.Name } // returnUser.Tema = userCont.Tema // returnUser.TemaName = userCont.TemaName if userCont.Wechat != "" { returnUser.Wechat = userCont.Wechat } if userCont.WorkWechat != "" { returnUser.Wechat = userCont.WorkWechat } } return }