diff --git a/api/admin/dutyassess/planversio.go b/api/admin/dutyassess/planversio.go index c256e44..352485c 100644 --- a/api/admin/dutyassess/planversio.go +++ b/api/admin/dutyassess/planversio.go @@ -11,6 +11,7 @@ import ( "gin_server_admin/global" "gin_server_admin/model/assessmentmodel" "gin_server_admin/model/common/response" + "github.com/gin-gonic/gin" ) @@ -214,7 +215,7 @@ func (d *DutyAssessApi) AddDepartDutyVersio(c *gin.Context) { evalProsCont.Unit = pva_v.Unit //`json:"unit"` //单位"` evalProsCont.ReferenceScore = pva_v.ReferenceScore //`json:"referencescore"` //标准分值"` var zhiBiaoCont assessmentmodel.EvaluationTarget - evalTarContErr := zhiBiaoCont.GetCont(map[string]interface{}{"et_id": pva_v.Id}, "et_cycle,et_cycleattr") //获取指标内容 + evalTarContErr := zhiBiaoCont.GetCont(map[string]interface{}{"et_id": pva_v.Id, "et_state": 1}, "et_cycle,et_cycleattr") //获取指标内容 if evalTarContErr == nil { evalProsCont.Cycles = zhiBiaoCont.Cycles // `json:"cycle"` //1:班;2:天;3:周;4:月;5:季度;6:年"` evalProsCont.CycleAttres = zhiBiaoCont.CycleAttres // `json:"cycleattr"` //辅助计数"` @@ -295,7 +296,7 @@ func (d *DutyAssessApi) AddDepartDutyVersio(c *gin.Context) { commonus.AddWeight(requestData.Group, v.Id, requestData.DepartmentId, tar_v.Id, tar_v.ReferenceScore, 1) //获取部门关联考核指标项目 var assessTarList []assessmentmodel.Assesstarget - judgeARTErr := global.GVA_DB_Performanceappraisal.Where("`group` = ? AND `dimension` = ? AND `targetid` = ? AND FIND_IN_SET(?,`departmentmap`)", groupId, v.Id, tar_v.Id, departId).Find(&assessTarList).Error + judgeARTErr := global.GVA_DB_Performanceappraisal.Where("`state` = 1 AND `group` = ? AND `dimension` = ? AND `targetid` = ? AND FIND_IN_SET(?,`departmentmap`)", groupId, v.Id, tar_v.Id, departId).Find(&assessTarList).Error if judgeARTErr == nil { var guoDu []AddPartMentGuodu for _, ass_v := range assessTarList { @@ -314,7 +315,7 @@ func (d *DutyAssessApi) AddDepartDutyVersio(c *gin.Context) { if detailedListErr == nil { for _, det_v := range detailedList { var deparmentStr string - deErr := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.DetailedTarget{}).Select("`dt_paretment`").Where("`dt_id` = ? AND (FIND_IN_SET(?,`dt_paretment`) OR `dt_paretment` = '')", det_v.Id, departId).First(&deparmentStr).Error + deErr := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.DetailedTarget{}).Select("`dt_paretment`").Where("`dt_state` = 1 AND `dt_id` = ? AND (FIND_IN_SET(?,`dt_paretment`) OR `dt_paretment` = '')", det_v.Id, departId).First(&deparmentStr).Error if deErr == nil { if deparmentStr != "" { guoDuCont.DetailedTarget = det_v.Id diff --git a/api/admin/systemuser/systemmenu.go b/api/admin/systemuser/systemmenu.go index e9178b0..3c036a3 100644 --- a/api/admin/systemuser/systemmenu.go +++ b/api/admin/systemuser/systemmenu.go @@ -1,6 +1,7 @@ package systemuser import ( + "fmt" "sort" "strconv" "time" @@ -75,6 +76,7 @@ func MenuOperation(jurisd int, menuId int64) (isTrue bool, operation []systemuse // 获取左侧菜单栏 func (s *SysTemMenuApi) GetMenu(c *gin.Context) { + fmt.Printf("菜单-------->%v\n", global.Gva_Authority_Authentication_Subsidiary) var systemMenuList []systemuser.SystemMenu menuOperErr := global.GVA_DB_Master.Where("`m_steat` = ? AND m_id IN ?", 1, global.Gva_Authority_Authentication_Subsidiary).Order("m_sort asc").Order("m_id desc").Find(&systemMenuList).Error if menuOperErr != nil { diff --git a/api/admin/systemuser/userhandle.go b/api/admin/systemuser/userhandle.go index d562fdf..c36e54b 100644 --- a/api/admin/systemuser/userhandle.go +++ b/api/admin/systemuser/userhandle.go @@ -10,6 +10,7 @@ import ( "gin_server_admin/model/systemuser" "gin_server_admin/model/testpage" "gin_server_admin/model/wechat" + "github.com/gin-gonic/gin" ) @@ -171,6 +172,18 @@ func GetSysAdminLoginInfo(userName, userPwd string) (isTrue bool, sysAdminInfo a sysAdminInfo.MenuOper = adminRoleCont.MenuOper sysAdminInfo.Wand = adminRoleCont.Wand } + roleIdStr := strconv.FormatInt(userInfo.Role, 10) + roleName, pointId, operation, _ := commonus.GetNewAccredit("kpi", roleIdStr, 0, 0) + if roleName != "" { + sysAdminInfo.RoleName = roleName + } + if pointId != "" { + sysAdminInfo.MenuOper = pointId + } + if operation != "" { + sysAdminInfo.Jurisdiction = operation + } + sysAdminInfo.KeyStr = strconv.FormatInt(userInfo.Key, 10) isTrue = true return diff --git a/api/index/evaluation/assessment.go b/api/index/evaluation/assessment.go index 6219a9e..adecf6c 100644 --- a/api/index/evaluation/assessment.go +++ b/api/index/evaluation/assessment.go @@ -9,6 +9,7 @@ import ( "gin_server_admin/global" "gin_server_admin/model/assessmentmodel" "gin_server_admin/model/common/response" + "github.com/gin-gonic/gin" ) @@ -47,6 +48,14 @@ func (e *EvaluationInterface) NewQualitative(c *gin.Context) { todayVal := time.Now().Unix() yearVal := commonus.ComputingTime(todayVal, 1) monthVal := commonus.ComputingTime(todayVal, 3) + if requestData.Time != "" { + timeAllStr := fmt.Sprintf("%v-01 12:00:00", requestData.Time) + timeAllInt, isTrue := commonus.DateToTimeStampEs(timeAllStr) + if isTrue == true { + yearVal = commonus.ComputingTime(timeAllInt, 1) + monthVal = commonus.ComputingTime(timeAllInt, 3) + } + } var outContList []NewQualOutList for _, v := range qualEvaList { var outCont NewQualOutList @@ -68,7 +77,14 @@ func (e *EvaluationInterface) NewQualitative(c *gin.Context) { if len(qualId) > 0 { outCont.ExtraPoints, outCont.ScoreReduction = StatisticsMonthQual(qualId, v.Group, v.Department, yearVal, monthVal) } - + /* + @qualId 考核项目ID + @dutyGroup 被考核集团 + @dutyDepartment 被考核部门 + @years 年 + @months 月 + (qualId []int64, dutyGroup, dutyDepartment, years, months int64) (addSumScore, scoreReduction float64) + */ outCont.Dimension = v.Dimension dimensionCont, _ := commonus.GetDutyClassInfo(v.Dimension) outCont.DimensionName = dimensionCont.Title @@ -102,7 +118,7 @@ func (e *EvaluationInterface) NewGetQualDetailedTarget(c *gin.Context) { if requestData.Title != "" { gormDb = gormDb.Where("`dt_title` LIKE ?", "%"+requestData.Title+"%") } - errList := gormDb.Order("qe_group ASC,qe_accept_evaluation ASC,qe_dimension ASC,qe_target ASC,qe_detailed_target ASC").Find(&qualEvaList).Error + errList := gormDb.Order("qe_group ASC,qe_accept_evaluation ASC,qe_dimension ASC,qe_target ASC,qe_target_sun ASC,qe_detailed_target ASC").Find(&qualEvaList).Error if errList != nil || len(qualEvaList) < 1 { response.Result(102, isTrue, "您没有要参加的考核项目!", c) return @@ -234,6 +250,7 @@ func (e *EvaluationInterface) QualitativeEvalRationNew(c *gin.Context) { @dutyDepartment 被考核部门 @years 年 @months 月 +(qualId []int64, dutyGroup, dutyDepartment, years, months int64) (addSumScore, scoreReduction float64) */ func StatisticsMonthQual(qualId []int64, dutyGroup, dutyDepartment, years, months int64) (addSumScore, scoreReduction float64) { where := commonus.MapOut() diff --git a/api/index/evaluation/evaluation.go b/api/index/evaluation/evaluation.go index 9f05d1b..9cdd545 100644 --- a/api/index/evaluation/evaluation.go +++ b/api/index/evaluation/evaluation.go @@ -940,7 +940,7 @@ func (e *EvaluationInterface) QualitativeEvalRation(c *gin.Context) { if dividend == 0 { uotCont.Reach = "未设置目标值" } else { - uotCont.Reach = fmt.Sprintf("((实际值-零奖值)/(全奖值-零奖值))*指标权重") + uotCont.Reach = fmt.Sprintf("(实际值-零奖值)/(全奖值-零奖值)") // reachValue := ((divisor / 100) / (float64(dividend) / 100)) * 100 // if reachValue < 0 { // uotCont.Reach = "0%" diff --git a/api/index/evaluation/examineflow.go b/api/index/evaluation/examineflow.go index bfa4687..eff5b3d 100644 --- a/api/index/evaluation/examineflow.go +++ b/api/index/evaluation/examineflow.go @@ -1,6 +1,8 @@ package evaluation import ( + "encoding/json" + "fmt" "strconv" "gin_server_admin/commonus" @@ -8,6 +10,7 @@ import ( "gin_server_admin/model/assessmentmodel" "gin_server_admin/model/common/response" "gin_server_admin/model/hrsystem" + "github.com/gin-gonic/gin" ) @@ -58,8 +61,11 @@ func (e *EvaluationInterface) ExamineFlow(c *gin.Context) { 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.Deparment, 10, 64) + 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)) @@ -78,9 +84,17 @@ func (e *EvaluationInterface) ExamineFlow(c *gin.Context) { // 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 { - threeFlowInfo.UserList = append(threeFlowInfo.UserList, GetApproveUser(v)) + userCont := GetApproveUser(v) + if userCont.Id != "" { + threeFlowInfo.UserList = append(threeFlowInfo.UserList, userCont) + } + } } flowMap = append(flowMap, threeFlowInfo) @@ -94,6 +108,7 @@ func (e *EvaluationInterface) ExamineFlow(c *gin.Context) { // 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)) @@ -119,6 +134,7 @@ func (e *EvaluationInterface) ExamineFlow(c *gin.Context) { // 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)) @@ -157,8 +173,9 @@ func (e *EvaluationInterface) ExamineFlow(c *gin.Context) { // where := commonus.MapOut() // where["id"] = userCont.Deparment // orgCont, _ := commonus.GetNewOrgCont(where, "id", "wechat_organization_id") - departId, _ := strconv.ParseInt(userCont.Deparment, 10, 64) + 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)) diff --git a/api/index/evaluation/flowsend.go b/api/index/evaluation/flowsend.go index f984a98..a15ed94 100644 --- a/api/index/evaluation/flowsend.go +++ b/api/index/evaluation/flowsend.go @@ -13,6 +13,7 @@ import ( "gin_server_admin/model/assessmentmodel" "gin_server_admin/model/common/response" "gin_server_admin/model/hrsystem" + "github.com/gin-gonic/gin" ) @@ -246,7 +247,7 @@ func (e *EvaluationInterface) PlusOrMinusPoints(c *gin.Context) { if myIsTrue != 1 { //写入当前流程步骤 // commonus.StepAddData(keyNumber, 0, 3, 1, 1, 2, 1, userCont.Key) //原 - commonus.StepAddDataEs(keyNumber, 0, 3, 1, 1, 1, 1, userCont.Key, requestData.Enclosure) + commonus.StepAddDataEs(keyNumber, 0, 3, 1, 1, 1, 1, userCont.Key, requestData.Enclosure, timeOccurrence) //申请人也是部门负责人 //给相关部门内勤发送消息。确定相关责任人 sendUserIsTrue, sendUserList := commonus.GetSendMsgUser(16118387069540343, programme.AcceptEvaluation) //获取对应部门内勤 @@ -263,7 +264,7 @@ func (e *EvaluationInterface) PlusOrMinusPoints(c *gin.Context) { } else { //写入当前流程步骤 // commonus.StepAddData(keyNumber, 16182159043990656, 2, 1, 1, 2, 1, userCont.Key) //原 - commonus.StepAddDataEs(keyNumber, 16182159043990656, 2, 1, 1, 1, 1, userCont.Key, requestData.Enclosure) + commonus.StepAddDataEs(keyNumber, 16182159043990656, 2, 1, 1, 1, 1, userCont.Key, requestData.Enclosure, timeOccurrence) //申请人不是是部门负责人 给本部门负责人发送审批 //获取发起人部门负责人 departmentIdInts, _ := strconv.ParseInt(userCont.Deparment, 10, 64) @@ -293,7 +294,7 @@ func (e *EvaluationInterface) PlusOrMinusPoints(c *gin.Context) { response.Result(0, outData, "数据写入成功", c) } } else { - commonus.StepAddDataEs(keyNumber, 16182159043990656, 2, 7, 1, 1, 1, userCont.Key, requestData.Enclosure) + commonus.StepAddDataEs(keyNumber, 16182159043990656, 2, 7, 1, 1, 1, userCont.Key, requestData.Enclosure, timeOccurrence) //申请人不是是部门负责人 给本部门负责人发送审批 //获取发起人部门负责人 departmentIdInts, _ := strconv.ParseInt(userCont.Deparment, 10, 64) @@ -735,7 +736,7 @@ func (e *EvaluationInterface) RectificationMeasures(c *gin.Context) { registerCont.EiteCont(regWhere, saveRegData) //写入流程步骤 // commonus.StepAddData(orderidval, 0, 6, 4, 1, 2, 5, userCont.Key) //原 - commonus.StepAddDataEs(orderidval, 0, 6, 4, 1, 2, 5, userCont.Key, requestData.Enclosure) + commonus.StepAddDataEs(orderidval, 0, 6, 4, 1, 2, 5, userCont.Key, requestData.Enclosure, time.Now().Unix()) /* 向本部门负责人发送审批 */ diff --git a/api/index/evaluation/flowsendnew.go b/api/index/evaluation/flowsendnew.go index d71215f..fb25dc1 100644 --- a/api/index/evaluation/flowsendnew.go +++ b/api/index/evaluation/flowsendnew.go @@ -120,7 +120,7 @@ func (e *EvaluationInterface) PlusOrMinusPointsNewYuan(c *gin.Context) { timeOccurrence := commonus.DateToTimeStamp(requestData.Addtime) //发生时间 addScore.HappenTime = timeOccurrence // addScore.HappenTime = commonus.DateToTimeStamp(requestData.Addtime) //发生时间 - departmentId, departmentIdErr := strconv.ParseInt(userCont.Deparment, 10, 64) + departmentId, departmentIdErr := strconv.ParseInt(userCont.MainDeparment, 10, 64) if departmentIdErr == nil { addScore.EvaluationDepartment = departmentId //测评部门 } @@ -181,7 +181,7 @@ func (e *EvaluationInterface) PlusOrMinusPointsNewYuan(c *gin.Context) { //获取通知人信息 //1、获取发起人部门负责人 var officWorkUserList string - founderDepartId, _ := strconv.ParseInt(userCont.Deparment, 10, 64) + founderDepartId, _ := strconv.ParseInt(userCont.MainDeparment, 10, 64) sendUserIsTrue, sendUserList := commonus.GetSendMsgUserAry(16182159043990656, founderDepartId) //获取对应部门负责人 if sendUserIsTrue != true { response.Result(0, sendUserList, "未指定相关部门处理人!请确定部门负责人后,重新发起请求!", c) @@ -249,7 +249,7 @@ func (e *EvaluationInterface) PlusOrMinusPointsNewYuan(c *gin.Context) { quoteAreaTitle = fmt.Sprintf("考核减分:%v\n", scoreFloat64ToStringsss) if myIsTrue != 1 { //申请人也是部门负责人 - commonus.StepAddDataEs(keyNumber, 0, 2, 1, 1, 1, 1, userCont.Key, requestData.Enclosure) + commonus.StepAddDataEs(keyNumber, 0, 2, 1, 1, 1, 1, userCont.Key, requestData.Enclosure, timeOccurrence) userKeyInt, _ := strconv.ParseInt(userCont.Key, 10, 64) commonus.WriteReplyLog(keyNumber, programme.AcceptEvaluation, founderDepartId, userKeyInt, 1, commonus.GetSetpName(1), "") @@ -280,7 +280,7 @@ func (e *EvaluationInterface) PlusOrMinusPointsNewYuan(c *gin.Context) { global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.ScoreFlow{}).Where("`sf_key` = ?", keyNumber).Updates(&eiteScoreFlow) } else { //申请人不是是部门负责人 给本部门负责人发送审批 - commonus.StepAddDataEs(keyNumber, 16182159043990656, 2, 1, 1, 1, 1, userCont.Key, requestData.Enclosure) + commonus.StepAddDataEs(keyNumber, 16182159043990656, 2, 1, 1, 1, 1, userCont.Key, requestData.Enclosure, timeOccurrence) jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v&num=%v", keyNumber, strconv.FormatInt(registerNumber, 10)) jumpUrlTitle := "请前往处理" sourceDesc := "审核" @@ -306,7 +306,7 @@ func (e *EvaluationInterface) PlusOrMinusPointsNewYuan(c *gin.Context) { } else { //加分 quoteAreaTitle = fmt.Sprintf("考核加分:%v\n", scoreFloat64ToStringsss) - commonus.StepAddDataEs(keyNumber, 16182159043990656, 2, 7, 1, 1, 1, userCont.Key, requestData.Enclosure) + commonus.StepAddDataEs(keyNumber, 16182159043990656, 2, 7, 1, 1, 1, userCont.Key, requestData.Enclosure, timeOccurrence) jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v&num=%v", keyNumber, strconv.FormatInt(registerNumber, 10)) jumpUrlTitle := "请前往处理" sourceDesc := "审核" @@ -420,7 +420,7 @@ func (e *EvaluationInterface) PlusOrMinusPointsNew(c *gin.Context) { addScore.PlanVersion = requestData.PlanVersionNumber //分值转化 scoreStringToInt64 := commonus.GetDuyCycle(requestData.Score, 100) - + fmt.Printf("分值转化----------->%v------------->%v\n", requestData.Score, scoreStringToInt64) addScore.Score = scoreStringToInt64 //分值(乘100录入) addScore.Key = keyNumber //识别标志 addScore.Reason = requestData.Reason //操作原因 @@ -435,7 +435,7 @@ func (e *EvaluationInterface) PlusOrMinusPointsNew(c *gin.Context) { } addScore.HappenTime = timeOccurrence // addScore.HappenTime = commonus.DateToTimeStamp(requestData.Addtime) //发生时间 - departmentId, departmentIdErr := strconv.ParseInt(userCont.Deparment, 10, 64) + departmentId, departmentIdErr := strconv.ParseInt(userCont.MainDeparment, 10, 64) if departmentIdErr == nil { addScore.EvaluationDepartment = departmentId //测评部门 } @@ -490,7 +490,7 @@ func (e *EvaluationInterface) PlusOrMinusPointsNew(c *gin.Context) { registerCont.Time = time.Now().Unix() registerCont.AddCont() //审批卡片跳转链接 - // cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v&num=%v", keyNumber, strconv.FormatInt(registerNumber, 10)) + cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v&num=%v", keyNumber, strconv.FormatInt(registerNumber, 10)) // jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v&num=%v", keyNumber, strconv.FormatInt(registerNumber, 10)) // jumpUrlTitle := "请前往处理" @@ -498,76 +498,76 @@ func (e *EvaluationInterface) PlusOrMinusPointsNew(c *gin.Context) { //获取通知人信息 //1、获取发起人部门负责人 - // var officWorkUserList string - founderDepartId, _ := strconv.ParseInt(userCont.Deparment, 10, 64) - // sendUserIsTrue, sendUserList := commonus.GetSendMsgUserAry(16182159043990656, founderDepartId) //获取对应部门负责人 - // if sendUserIsTrue != true { - // response.Result(0, sendUserList, "未指定相关部门处理人!请确定部门负责人后,重新发起请求!", c) - // return - // } - - // for _, v := range sendUserList { - // if v == userCont.Wechat { - // myIsTrue = 2 - // } - // } + var officWorkUserList string + founderDepartId, _ := strconv.ParseInt(userCont.MainDeparment, 10, 64) + sendUserIsTrue, sendUserList := commonus.GetSendMsgUserAry(16182159043990656, founderDepartId) //获取对应部门负责人 + if sendUserIsTrue != true { + response.Result(0, sendUserList, "未指定相关部门处理人!请确定部门负责人后,重新发起请求!", c) + return + } + + for _, v := range sendUserList { + if v == userCont.Wechat { + myIsTrue = 2 + } + } // fmt.Printf("userCont.Wechat====>%v------------>myIsTrue:%v------------>sendUserList:%v\n", userCont.Wechat, myIsTrue, sendUserList) - // officWorkUserList = strings.Join(sendUserList, "|") - - // //确定标题 - // var title string = "" - // //一级标题副本内容 - // var desc string = "" - // detailedTargetCont, detailedTargetErr := commonus.GetDetailedTargetInfo(programme.DetailedTarget) //获取指标细则 - // if detailedTargetErr == true { - // tarInf, tarErr := commonus.GetTargetInfo(detailedTargetCont.ParentId) //获取指标信息 - // if tarErr == true { - // title = tarInf.Title //一级标题,建议不超过36个字 - // desc = detailedTargetCont.Title //一级标题辅助信息,建议不超过44个字 - // } else { - // title = detailedTargetCont.Title //一级标题,建议不超过36个字 - // } - // } else { - // tarInf, tarErr := commonus.GetTargetInfo(programme.Target) //获取指标信息 - // if tarErr == true { - // title = tarInf.Title //一级标题,建议不超过36个字 - // } else { - // title = strconv.FormatInt(programme.DetailedTarget, 10) //一级标题,建议不超过36个字 - // } - // } - // //执行原因 - // reason := fmt.Sprintf("原因:%v\n", requestData.Reason) - - // twoLevelKeyName := "" - // execDerpat, execDerpatErr := commonus.GetNewOrgCont(departmentId) - // if execDerpatErr == nil { - // twoLevelKeyName = execDerpat.Name - // } - // var twoLevelKeyValue string = "" - // var twoLevelUserId string = "" - // //获取操作人 - // if userCont.Wechat != "" { - // userWechatErr, userWechat := commonus.GetUesrContForWechatID(userCont.Wechat) - // if userWechatErr == true { - // twoLevelKeyValue = userWechat.Name - // twoLevelUserId = userCont.Wechat - // } - // } - // twoLevelTitle := "考核上报部门:" + officWorkUserList = strings.Join(sendUserList, "|") + + //确定标题 + var title string = "" + //一级标题副本内容 + var desc string = "" + detailedTargetCont, detailedTargetErr := commonus.GetDetailedTargetInfo(programme.DetailedTarget) //获取指标细则 + if detailedTargetErr == true { + tarInf, tarErr := commonus.GetTargetInfo(detailedTargetCont.ParentId) //获取指标信息 + if tarErr == true { + title = tarInf.Title //一级标题,建议不超过36个字 + desc = detailedTargetCont.Title //一级标题辅助信息,建议不超过44个字 + } else { + title = detailedTargetCont.Title //一级标题,建议不超过36个字 + } + } else { + tarInf, tarErr := commonus.GetTargetInfo(programme.Target) //获取指标信息 + if tarErr == true { + title = tarInf.Title //一级标题,建议不超过36个字 + } else { + title = strconv.FormatInt(programme.DetailedTarget, 10) //一级标题,建议不超过36个字 + } + } + //执行原因 + reason := fmt.Sprintf("原因:%v\n", requestData.Reason) + + twoLevelKeyName := "" + execDerpat, execDerpatErr := commonus.GetNewOrgCont(departmentId) + if execDerpatErr == nil { + twoLevelKeyName = execDerpat.Name + } + var twoLevelKeyValue string = "" + var twoLevelUserId string = "" + //获取操作人 + if userCont.Wechat != "" { + userWechatErr, userWechat := commonus.GetUesrContForWechatID(userCont.Wechat) + if userWechatErr == true { + twoLevelKeyValue = userWechat.Name + twoLevelUserId = userCont.Wechat + } + } + twoLevelTitle := "考核上报部门:" //分数 - // sendScore := scoreStringToInt64 * int64(countFrequency) - // sendScVal := float64(sendScore) / 100 - // scoreFloat64ToStringsss := strconv.FormatFloat(sendScVal, 'f', -1, 64) + sendScore := scoreStringToInt64 * int64(countFrequency) + sendScVal := float64(sendScore) / 100 + scoreFloat64ToStringsss := strconv.FormatFloat(sendScVal, 'f', -1, 64) outMap := commonus.MapOut() - // var quoteAreaTitle string //引用文献标题 + var quoteAreaTitle string //引用文献标题 if requestData.Type != 1 { //减分 - // quoteAreaTitle = fmt.Sprintf("考核减分:%v\n", scoreFloat64ToStringsss) + quoteAreaTitle = fmt.Sprintf("考核减分:%v\n", scoreFloat64ToStringsss) if myIsTrue != 1 { //申请人也是部门负责人 - commonus.StepAddDataEs(keyNumber, 0, 2, 1, 1, 1, 1, userCont.Key, requestData.Enclosure) + commonus.StepAddDataEs(keyNumber, 0, 2, 1, 1, 1, 1, userCont.Key, requestData.Enclosure, timeOccurrence) userKeyInt, _ := strconv.ParseInt(userCont.Key, 10, 64) commonus.WriteReplyLog(keyNumber, programme.AcceptEvaluation, founderDepartId, userKeyInt, 1, commonus.GetSetpName(1), "") @@ -576,20 +576,20 @@ func (e *EvaluationInterface) PlusOrMinusPointsNew(c *gin.Context) { commonus.WriteReplyLog(keyNumber, programme.AcceptEvaluation, founderDepartId, userKeyInt, 1, commonus.GetSetpName(2), "同意") - // sendUserIsTrue, sendUserList := commonus.GetSendMsgUser(16118387069540343, programme.AcceptEvaluation) //获取对应部门内勤 - // if sendUserIsTrue != true { - // response.Result(0, sendUserList, "未指定相关部门处理人!未能向相关人员发送考核项目!请手动发起!", c) - // return - // } - // jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v&num=%v", keyNumber, strconv.FormatInt(registerNumber, 10)) - // jumpUrlTitle := "请前往处理" - // sourceDesc := "责任划分" - // var sendTextMsg sendmessage.TextNoticeTemplateMedium - // callbakcMsg, isTrueCall, callBackCont := sendTextMsg.SendMsgTextShare(sendUserList, strconv.FormatInt(registerNumber, 10), title, desc, quoteAreaTitle, reason, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, cardJumpUrl, jumpUrl, jumpUrlTitle, sourceDesc) - // outMap["callbakcMsg"] = string(callbakcMsg) - // outMap["isTrueCall"] = isTrueCall - // outMap["callBackCont"] = callBackCont - // outMap["setval"] = 1 + sendUserIsTrue, sendUserList := commonus.GetSendMsgUser(16118387069540343, programme.AcceptEvaluation) //获取对应部门内勤 + if sendUserIsTrue != true { + response.Result(0, sendUserList, "未指定相关部门处理人!未能向相关人员发送考核项目!请手动发起!", c) + return + } + jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v&num=%v", keyNumber, strconv.FormatInt(registerNumber, 10)) + jumpUrlTitle := "请前往处理" + sourceDesc := "责任划分" + var sendTextMsg sendmessage.TextNoticeTemplateMedium + callbakcMsg, isTrueCall, callBackCont := sendTextMsg.SendMsgTextShare(sendUserList, strconv.FormatInt(registerNumber, 10), title, desc, quoteAreaTitle, reason, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, cardJumpUrl, jumpUrl, jumpUrlTitle, sourceDesc) + outMap["callbakcMsg"] = string(callbakcMsg) + outMap["isTrueCall"] = isTrueCall + outMap["callBackCont"] = callBackCont + outMap["setval"] = 1 //修改定性审批流状态 eiteScoreFlow := commonus.MapOut() @@ -602,16 +602,16 @@ func (e *EvaluationInterface) PlusOrMinusPointsNew(c *gin.Context) { global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.EvaluationProcess{}).Where("`ep_order_key` = ?", keyNumber).Updates(&evalProcSaveData) } else { //申请人不是是部门负责人 给本部门负责人发送审批 - commonus.StepAddDataEs(keyNumber, 16182159043990656, 2, 1, 1, 1, 1, userCont.Key, requestData.Enclosure) - // jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v&num=%v", keyNumber, strconv.FormatInt(registerNumber, 10)) - // jumpUrlTitle := "请前往处理" - // sourceDesc := "审核" - // var sendTextMsg sendmessage.TextNoticeTemplateMedium - // callbakcMsg, isTrueCall, callBackCont := sendTextMsg.SendMsgTextShare(officWorkUserList, strconv.FormatInt(registerNumber, 10), title, desc, quoteAreaTitle, reason, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, cardJumpUrl, jumpUrl, jumpUrlTitle, sourceDesc) - // outMap["callbakcMsg"] = string(callbakcMsg) - // outMap["isTrueCall"] = isTrueCall - // outMap["callBackCont"] = callBackCont - // outMap["setval"] = 2 + commonus.StepAddDataEs(keyNumber, 16182159043990656, 2, 1, 1, 1, 1, userCont.Key, requestData.Enclosure, timeOccurrence) + jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v&num=%v", keyNumber, strconv.FormatInt(registerNumber, 10)) + jumpUrlTitle := "请前往处理" + sourceDesc := "审核" + var sendTextMsg sendmessage.TextNoticeTemplateMedium + callbakcMsg, isTrueCall, callBackCont := sendTextMsg.SendMsgTextShare(officWorkUserList, strconv.FormatInt(registerNumber, 10), title, desc, quoteAreaTitle, reason, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, cardJumpUrl, jumpUrl, jumpUrlTitle, sourceDesc) + outMap["callbakcMsg"] = string(callbakcMsg) + outMap["isTrueCall"] = isTrueCall + outMap["callBackCont"] = callBackCont + outMap["setval"] = 2 userKeyInt, _ := strconv.ParseInt(userCont.Key, 10, 64) commonus.WriteReplyLog(keyNumber, programme.AcceptEvaluation, founderDepartId, userKeyInt, 1, commonus.GetSetpName(1), "") @@ -627,17 +627,17 @@ func (e *EvaluationInterface) PlusOrMinusPointsNew(c *gin.Context) { } } else { //加分 - // quoteAreaTitle = fmt.Sprintf("考核加分:%v\n", scoreFloat64ToStringsss) - commonus.StepAddDataEs(keyNumber, 16182159043990656, 2, 7, 1, 1, 1, userCont.Key, requestData.Enclosure) - // jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v&num=%v", keyNumber, strconv.FormatInt(registerNumber, 10)) - // jumpUrlTitle := "请前往处理" - // sourceDesc := "审核" - // var sendTextMsg sendmessage.TextNoticeTemplateMedium - // callbakcMsg, isTrueCall, callBackCont := sendTextMsg.SendMsgTextShare(officWorkUserList, strconv.FormatInt(registerNumber, 10), title, desc, quoteAreaTitle, reason, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, cardJumpUrl, jumpUrl, jumpUrlTitle, sourceDesc) - // outMap["callbakcMsg"] = string(callbakcMsg) - // outMap["isTrueCall"] = isTrueCall - // outMap["callBackCont"] = callBackCont - // outMap["setval"] = 3 + quoteAreaTitle = fmt.Sprintf("考核加分:%v\n", scoreFloat64ToStringsss) + commonus.StepAddDataEs(keyNumber, 16182159043990656, 2, 7, 1, 1, 1, userCont.Key, requestData.Enclosure, timeOccurrence) + jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v&num=%v", keyNumber, strconv.FormatInt(registerNumber, 10)) + jumpUrlTitle := "请前往处理" + sourceDesc := "审核" + var sendTextMsg sendmessage.TextNoticeTemplateMedium + callbakcMsg, isTrueCall, callBackCont := sendTextMsg.SendMsgTextShare(officWorkUserList, strconv.FormatInt(registerNumber, 10), title, desc, quoteAreaTitle, reason, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, cardJumpUrl, jumpUrl, jumpUrlTitle, sourceDesc) + outMap["callbakcMsg"] = string(callbakcMsg) + outMap["isTrueCall"] = isTrueCall + outMap["callBackCont"] = callBackCont + outMap["setval"] = 3 userKeyInt, _ := strconv.ParseInt(userCont.Key, 10, 64) commonus.WriteReplyLog(keyNumber, programme.AcceptEvaluation, founderDepartId, userKeyInt, 1, commonus.GetSetpName(1), "") diff --git a/api/index/evaluation/lookquantita.go b/api/index/evaluation/lookquantita.go index 759c9d9..5bd9bed 100644 --- a/api/index/evaluation/lookquantita.go +++ b/api/index/evaluation/lookquantita.go @@ -414,7 +414,8 @@ func (e *EvaluationInterface) SeeFlowLog(c *gin.Context) { } if requestData.Department != "" { // gormDb = gormDb.Where("sf_depart = ? OR fl_depart = ?", requestData.Department, requestData.Department) - gormDb = gormDb.Where("ep_setup_department = ? OR ep_accept_department = ?", requestData.Department, requestData.Department) + // gormDb = gormDb.Where("ep_setup_department = ? OR ep_accept_department = ?", requestData.Department, requestData.Department) + gormDb = gormDb.Where("ep_accept_department = ? OR ep_setup_department = ?", requestData.Department, requestData.Department) } } //是否为管理员(1:不是;2:分公司;3:集团管理员;4:超级管 @@ -445,7 +446,24 @@ func (e *EvaluationInterface) SeeFlowLog(c *gin.Context) { } if requestData.Time != "" { startTime, endTime := commonus.GetAppointMonthStarAndEndTime(requestData.Time) - gormDb = gormDb.Where("ep_start_time BETWEEN ? AND ?", startTime, endTime) + // gormDb = gormDb.Where("ep_start_time BETWEEN ? AND ?", startTime, endTime) + gormDb = gormDb.Where("ep_happen_time BETWEEN ? AND ?", startTime, endTime) + } + + if requestData.Years != 0 { + if requestData.Month != 0 { + timeDay := fmt.Sprintf("%v-%v-01", requestData.Years, requestData.Month) + if requestData.Month <= 9 { + timeDay = fmt.Sprintf("%v-0%v-01", requestData.Years, requestData.Month) + } + startTime, endTime := commonus.GetAppointMonthStarAndEndTimeEs(timeDay) + gormDb = gormDb.Where("ep_happen_time BETWEEN ? AND ?", startTime, endTime) + + } else { + startTime := commonus.DateToTimeStamp(fmt.Sprintf("%v-01-01 00:00:00", requestData.Years)) + endTime := commonus.DateToTimeStamp(fmt.Sprintf("%v-12-31 23:59:59", requestData.Years)) + gormDb = gormDb.Where("ep_happen_time BETWEEN ? AND ?", startTime, endTime) + } } if requestData.Class != 0 { diff --git a/api/index/evaluation/type.go b/api/index/evaluation/type.go index 33391a3..7fcad6d 100644 --- a/api/index/evaluation/type.go +++ b/api/index/evaluation/type.go @@ -281,6 +281,8 @@ type FlowLogType struct { Time string `json:"time"` //时间 IsSet int `json:"isset"` //未处理 1:已审核;2:未审核 Class int `json:"class"` //0:全部;1:定性;2:定量 + Years int `json:"years"` //年 + Month int `json:"month"` //月 } // 流程记录输出 @@ -312,6 +314,7 @@ type NewQualType struct { Group string `json:"group"` //集团 Department string `json:"department"` //部门 Title string `json:"tittle"` //指标名称 + Time string `json:"time"` //时间 } // 新型定性考核列表输出 diff --git a/api/index/statistics/newstatistics.go b/api/index/statistics/newstatistics.go index b465e11..6ace228 100644 --- a/api/index/statistics/newstatistics.go +++ b/api/index/statistics/newstatistics.go @@ -11,6 +11,7 @@ import ( "gin_server_admin/model/assessmentmodel" "gin_server_admin/model/common/response" "gin_server_admin/model/hrsystem" + "github.com/gin-gonic/gin" "gorm.io/gorm" ) @@ -62,22 +63,27 @@ func (t *tablePlanVersionStic) conditionStatisticsNew(group, department, dimensi var atScore float64 = 0 var lastEvalId int64 // var scoreSum float64 = 0 - + shouDongJiFen := 2 var shouDongFenzhi float64 = 0 var zhidongDongLiang float64 = 0 // var realScore float64 = 0 if len(fldList) > 0 { for _, v := range fldList { - fmt.Printf("Key----------------->%v\n", v.Key) + // fmt.Printf("Key----------------->%v\n", v.Key) if v.Key != 0 { lastEvalId = v.Key } + + // atScore = atScore + float64(v.Score) + zhidongDongLiang = zhidongDongLiang + float64(v.Score) + if v.ScoringMethod == 1 { atScore = atScore + float64(v.Score) - zhidongDongLiang = zhidongDongLiang + float64(v.Score) + // zhidongDongLiang = zhidongDongLiang + float64(v.Score) } else { atScore = atScore + float64(v.ScoringScore) shouDongFenzhi = shouDongFenzhi + float64(v.ScoringScore) + shouDongJiFen = 1 } // scoreSum = scoreSum + atScore // scoreSum = scoreSum + float64(v.Score) @@ -92,7 +98,7 @@ func (t *tablePlanVersionStic) conditionStatisticsNew(group, department, dimensi } } fmt.Printf("atScore--->%v\n", atScore) - tableScoreCont.ScoreVal = commonus.Decimal(atScore / 100) + tableScoreCont.ScoreVal = commonus.Decimal(zhidongDongLiang / 100) targetIdInt, _ := strconv.ParseInt(targetId, 10, 64) groupId, _ := strconv.ParseInt(group, 10, 64) departmentId, _ := strconv.ParseInt(department, 10, 64) @@ -101,13 +107,18 @@ func (t *tablePlanVersionStic) conditionStatisticsNew(group, department, dimensi // fmt.Printf("atScore--->%v------->mtScore--->%v---->zeroPrize--->%v---->allPrize--->%v---->cappingPrize--->%v---->typeClass---->%v\n", atScore, mtScore, zeroPrize, allPrize, cappingPrize, typeClass) - tableScoreCont.ActualScore, tableScoreCont.AllPrize, tableScoreCont.ZeroPrize, tableScoreCont.CappingVal, tableScoreCont.Achievement = commonus.CalculateScore(referenceScore, atScore, allPrize, zeroPrize, cappingPrize, typeClass) + tableScoreCont.ActualScore, tableScoreCont.AllPrize, tableScoreCont.ZeroPrize, tableScoreCont.CappingVal, tableScoreCont.Achievement = commonus.CalculateScore(referenceScore, zhidongDongLiang, allPrize, zeroPrize, cappingPrize, typeClass) // tableScoreCont.ActualScore, tableScoreCont.AllPrize, tableScoreCont.ZeroPrize, tableScoreCont.CappingVal, tableScoreCont.Achievement = commonus.CalculateScore(referenceScore, zhidongDongLiang, allPrize, zeroPrize, cappingPrize, typeClass) - // fmt.Printf("达成率--13-->%v-->%v-->%v-->%v-->%v\n", tableScoreCont.ActualScore, tableScoreCont.AllPrize, tableScoreCont.ZeroPrize, tableScoreCont.CappingVal, tableScoreCont.Achievement) + // fmt.Printf("达成率--13-->ActualScore:%v-->AllPrize:%v-->ZeroPrize:%v-->CappingVal:%v-->Achievement:%v-->referenceScore:%v-->zhidongDongLiang:%v-->shouDongFenzhi:%v------->shouDongJiFen:%v\n", tableScoreCont.ActualScore, tableScoreCont.AllPrize, tableScoreCont.ZeroPrize, tableScoreCont.CappingVal, tableScoreCont.Achievement, referenceScore, zhidongDongLiang, shouDongFenzhi, shouDongJiFen) if status == 3 { tableScoreCont.ActualScore = float64(referenceScore) } - tableScoreCont.ActualScore = commonus.DecimalEs(tableScoreCont.ActualScore+commonus.Decimal(shouDongFenzhi/100), 2) + if shouDongJiFen == 1 { + tableScoreCont.ActualScore = shouDongFenzhi / 100 + } + + // fmt.Printf("达成率--14-->ActualScore:%v-->AllPrize:%v-->ZeroPrize:%v-->CappingVal:%v-->Achievement:%v-->referenceScore:%v-->status:%v\n", tableScoreCont.ActualScore, tableScoreCont.AllPrize, tableScoreCont.ZeroPrize, tableScoreCont.CappingVal, tableScoreCont.Achievement, referenceScore, status) + // tableScoreCont.ActualScore = commonus.DecimalEs(tableScoreCont.ActualScore+commonus.Decimal(shouDongFenzhi/100), 2) // tableScoreCont.ActualScore = commonus.Decimal(mtScore / 100) t.TableScore = append(t.TableScore, tableScoreCont) syncProcessDepartTarget.Done() diff --git a/api/index/statistics/queryresults.go b/api/index/statistics/queryresults.go index be452bd..0523f5b 100644 --- a/api/index/statistics/queryresults.go +++ b/api/index/statistics/queryresults.go @@ -12,6 +12,7 @@ import ( "gin_server_admin/model/assessmentmodel" "gin_server_admin/model/common/response" "gin_server_admin/model/hrsystem" + "github.com/gin-gonic/gin" ) @@ -87,6 +88,7 @@ func (a *ApiGroup) Queryresults(c *gin.Context) { if len(monthTody) < 1 { monthTody = append(monthTody, 1) } + fmt.Printf("orgAry---------------------->%v\n", orgAry) /* 设定协程 遍历行政组织,并发计算 @@ -267,12 +269,14 @@ func (a *ApiGroup) Queryresults(c *gin.Context) { orgFen.J = append(orgFen.J, readv.J) orgFen.K = append(orgFen.K, readv.K) orgFen.L = append(orgFen.L, readv.L) - + // jsonStr, _ := json.Marshal(orgFen.A) + // fmt.Printf("orgFen------1---->%v\n", string(jsonStr)) echarsList.YLine = append(echarsList.YLine, cyLineAry_1) // echarsListOrg.YLine = append(echarsListOrg.YLine, cyLineAry_2) } - + // jsonStrwww, _ := json.Marshal(orgFen) + // fmt.Printf("orgFen---------->%v\n", string(jsonStrwww)) if jiBuQi > 0 { var pingJunFen TranscriptTableDateList pingJunFen.DepartmentId = "0" @@ -300,6 +304,8 @@ func (a *ApiGroup) Queryresults(c *gin.Context) { } else { monthInt = requestData.Month } + // fmt.Printf("monthInt---------->%v\n", monthInt) + for _, mvv := range monthInt { switch mvv { case 1: @@ -350,7 +356,7 @@ func (a *ApiGroup) Queryresults(c *gin.Context) { case 10: var cyLineAry_2 YlineData cyLineAry_2.Name = "10月" - cyLineAry_2.Data = orgFen.G + cyLineAry_2.Data = orgFen.J echarsListOrg.YLine = append(echarsListOrg.YLine, cyLineAry_2) case 11: var cyLineAry_2 YlineData @@ -517,7 +523,7 @@ func (t *TranscriptTableData) StaticticsDepartmentResult(group string, orgCont h // } // } // } - fmt.Printf("month---->%v\n", pingJunFen) + // fmt.Printf("month---->%v\n", pingJunFen) t.ScoreStatistics = append(t.ScoreStatistics, pingJunFen) } } @@ -547,6 +553,7 @@ func (c *countEveryDepartmentMonthScore) everyMonthCalculate(groupId, orgId, yea for _, sv := range v.Child { //指标 zhiBiaoScore = zhiBiaoScore + float64(sv.ReferenceScore) if sv.Status == 3 { + // fmt.Printf("sv.Id-------->%v------------》sv.Name----%v------------ReferenceScore---------->%v\n", sv.Id, sv.Name, sv.ReferenceScore) sumScore = sumScore + float64(sv.ReferenceScore) } else { if sv.Status == 1 && sv.Status != 3 { //判断指标是否启用并且不是观察指标 @@ -558,10 +565,12 @@ func (c *countEveryDepartmentMonthScore) everyMonthCalculate(groupId, orgId, yea if targetInfo.Type == 1 { //定性考核 countScore, _ := quantification.DingXingMonthSum(groupId, orgId, sv.ReferenceScore, year, month, sv.Id, sv.Cycles, sv.Status) sumScore = sumScore + countScore + // fmt.Printf("sv.Id-------->%v------------》sv.Name----%v--------------countScore-------->%v\n", sv.Id, sv.Name, countScore) } else { //定量考核 countScores, _ := quantification.DingLiangMonthSum(groupId, orgId, sv.ReferenceScore, year, month, sv.Id, sv.Cycles, sv.Status) sumScore = sumScore + countScores + // fmt.Printf("sv.Id-------->%v------------》sv.Name----%v------------countScores---------->%v\n", sv.Id, sv.Name, countScores) } // switch sv.Cycles { // case 5: //季度统计 @@ -579,6 +588,7 @@ func (c *countEveryDepartmentMonthScore) everyMonthCalculate(groupId, orgId, yea // } } } + } } var everyMonthScoreInfo everyDepartmentScore diff --git a/api/index/statistics/tablestatistics.go b/api/index/statistics/tablestatistics.go index 1de276b..2b31213 100644 --- a/api/index/statistics/tablestatistics.go +++ b/api/index/statistics/tablestatistics.go @@ -12,6 +12,7 @@ import ( "gin_server_admin/global" "gin_server_admin/model/assessmentmodel" "gin_server_admin/model/common/response" + "github.com/gin-gonic/gin" ) @@ -889,7 +890,7 @@ func (d *dataLockStatistics) planVersiconProcessV1(pvInfo assessmentmodel.PlanVe //进行维度操作 for _, pv := range planInfo { for _, pcv := range pv.Child { //指标列表 - // if pcv.Id == "4" { + // if pcv.Id == "6" { fmt.Printf("pcv.Id------------------->%v\n", pcv.Id) if pcv.Status != 2 { //忽略掉禁用的指标 var outCont TargetContOutCont diff --git a/api/reply/qual/divisionrectification.go b/api/reply/qual/divisionrectification.go index ad32f9b..784cbe6 100644 --- a/api/reply/qual/divisionrectification.go +++ b/api/reply/qual/divisionrectification.go @@ -13,6 +13,7 @@ import ( "gin_server_admin/model/assessmentmodel" "gin_server_admin/model/common/response" "gin_server_admin/model/hrsystem" + "github.com/gin-gonic/gin" ) @@ -465,7 +466,7 @@ func (a *ApiGroup) AmendMeasures(c *gin.Context) { } opinionCont := fmt.Sprintf("整改措施:%v", requestData.Content) //写入流程步骤 - commonus.StepAddDataEs(orderidval, 0, 6, 4, 1, 2, 5, userCont.Key, requestData.Enclosure) //更新审批流 + commonus.StepAddDataEs(orderidval, 0, 6, 4, 1, 2, 5, userCont.Key, requestData.Enclosure, time.Now().Unix()) //更新审批流 commonus.WriteReplyLog(orderidval, scoreFlowInfo.DutyDepartment, scoreFlowInfo.EvaluationDepartment, scoreFlowInfo.EvaluationUser, 1, commonus.GetSetpName(3), opinionCont) //写入审批流 sendUserIsTrue, sendUserList := commonus.GetSendMsgUser(16182159043990656, scoreFlowInfo.DutyDepartment) //获取对应部门负责人 diff --git a/api/reply/quan/ration.go b/api/reply/quan/ration.go index fd4680e..5d40241 100644 --- a/api/reply/quan/ration.go +++ b/api/reply/quan/ration.go @@ -414,7 +414,7 @@ func (a *ApiGroup) SendRationFlow(c *gin.Context) { // fmt.Printf("lastMonth-->%v-->lastMonthInt, -->%v-->lastMonthErr,-->%v--> operationTime-->%v-->flowLog----->%v\n", lastMonth, lastMonthInt, lastMonthErr, operationTime, flowLog) // return - + operationTime = timeOccurrence } else { lastMonth, _, _ := commonus.GetLastMonth() @@ -631,48 +631,49 @@ func (a *ApiGroup) SendRationFlow(c *gin.Context) { if affairDbErr == nil { commonus.StepAddData(keyNumber, 16182159043990656, 2, 7, 2, 2, 1, userCont.Key) commonus.WriteReplyLog(keyNumber, departIdInt, departmentId, userKey, 1, commonus.GetSetpName(1), "提交申请") + sendUserIsTrue, sendUserList := commonus.GetSendMsgUser(16182159043990656, departmentId) //获取对应部门负责人 // sendUserIsTrue, sendUserList := commonus.GetSendMsgUser(16182159043990656, departIdInt) //获取对应部门负责人 - // if sendUserIsTrue != true { - // response.Result(0, sendUserList, "未指定相关部门处理人!未能向相关人员发送考核项目!请手动发起!", c) - // return - // } - - // title := fmt.Sprintf("%v数据表", commonus.TimeStampToDate(operationTime, 10)) - // desc := "" - // mainTitleDesc := "数据详情:" - // //将步骤写入 判断该步骤是否已经操作 - // registerNumber := commonus.GetFileNumberEs() - // var registerContIng assessmentmodel.Register - // registerContIng.Number = registerNumber - // registerContIng.State = 1 - // registerContIng.Time = time.Now().Unix() - // registerContIng.AddCont() + if sendUserIsTrue != true { + response.Result(0, sendUserList, "未指定相关部门处理人!未能向相关人员发送考核项目!请手动发起!", c) + return + } + + title := fmt.Sprintf("%v数据表", commonus.TimeStampToDate(operationTime, 10)) + desc := "" + mainTitleDesc := "数据详情:" + //将步骤写入 判断该步骤是否已经操作 + registerNumber := commonus.GetFileNumberEs() + var registerContIng assessmentmodel.Register + registerContIng.Number = registerNumber + registerContIng.State = 1 + registerContIng.Time = time.Now().Unix() + registerContIng.AddCont() //审批卡片跳转链接 - // cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/quantitativeList?id=%v&num=%v", keyNumber, strconv.FormatInt(registerNumber, 10)) - // jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/quantitativeList?id=%v&num=%v", keyNumber, strconv.FormatInt(registerNumber, 10)) - - // jumpUrlTitle := "请前往处理" - // sourceDesc := "审批" - // twoLevelTitle := "审批信息:" - - // twoLevelKeyName := "" - // execDerpat, execDerpatErr := commonus.GetNewOrgCont(departmentId) - // if execDerpatErr == nil { - // twoLevelKeyName = execDerpat.Name - // } - // var twoLevelKeyValue string = "" - // var twoLevelUserId string = "" - // //获取操作人 - // if userCont.Wechat != "" { - // userWechatErr, userWechat := commonus.GetUesrContForWechatID(userCont.Wechat) - // if userWechatErr == true { - // twoLevelKeyValue = userWechat.Name - // twoLevelUserId = userCont.Wechat - // } - // } - - // var sendTextMsg sendmessage.TextNoticeTemplateMedium - // callbakcMsg, isTrueCall, callBackCont := sendTextMsg.SendMsgTextShare(sendUserList, strconv.FormatInt(registerNumber, 10), title, desc, mainTitleDesc, reason, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, cardJumpUrl, jumpUrl, jumpUrlTitle, sourceDesc) + cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/quantitativeList?id=%v&num=%v", keyNumber, strconv.FormatInt(registerNumber, 10)) + jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/quantitativeList?id=%v&num=%v", keyNumber, strconv.FormatInt(registerNumber, 10)) + + jumpUrlTitle := "请前往处理" + sourceDesc := "审批" + twoLevelTitle := "审批信息:" + + twoLevelKeyName := "" + execDerpat, execDerpatErr := commonus.GetNewOrgCont(map[string]interface{}{"`id`": departmentId}) + if execDerpatErr == nil { + twoLevelKeyName = execDerpat.Name + } + var twoLevelKeyValue string = "" + var twoLevelUserId string = "" + //获取操作人 + if userCont.Wechat != "" { + userWechatErr, userWechat := commonus.GetUesrContForWechatID(userCont.Wechat) + if userWechatErr == true { + twoLevelKeyValue = userWechat.Name + twoLevelUserId = userCont.Wechat + } + } + + var sendTextMsg sendmessage.TextNoticeTemplateMedium + callbakcMsg, isTrueCall, callBackCont := sendTextMsg.SendMsgTextShare(sendUserList, strconv.FormatInt(registerNumber, 10), title, desc, mainTitleDesc, reason, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, cardJumpUrl, jumpUrl, jumpUrlTitle, sourceDesc) //发送文本信息通用 /*SendMsgTextShare(sendUserList, taskId, title, desc, quoteAreaTitle, quoteAreaContent, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, cardJumpUrl, jumpUrl, jumpUrlTitle, sourceDesc string) (callbakcMsg []byte, isTrueCall bool, callBackCont string) @@ -698,14 +699,16 @@ func (a *ApiGroup) SendRationFlow(c *gin.Context) { global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.ScoreFlow{}).Where("`sf_key` = ?", keyNumber).Updates(&eiteScoreFlow) evalProcSaveData := commonus.MapOut() evalProcSaveData["ep_state"] = 2 + evalProcSaveData["ep_happen_time"] = operationTime evalProcSaveData["ep_time"] = time.Now().Unix() global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.EvaluationProcess{}).Where("`ep_order_key` = ?", keyNumber).Updates(&evalProcSaveData) outMap := commonus.MapOut() - // outMap["callbakcMsg"] = string(callbakcMsg) - // outMap["isTrueCall"] = isTrueCall - // outMap["callBackCont"] = callBackCont + outMap["callbakcMsg"] = string(callbakcMsg) + outMap["isTrueCall"] = isTrueCall + outMap["callBackCont"] = callBackCont outMap["setval"] = 1 + outMap["sendUserList"] = sendUserList response.Result(0, outMap, "数据提交成功!", c) } else { diff --git a/api/statistics/quantification/enter.go b/api/statistics/quantification/enter.go index 2badcef..7587318 100644 --- a/api/statistics/quantification/enter.go +++ b/api/statistics/quantification/enter.go @@ -6,6 +6,7 @@ import ( "gin_server_admin/commonus" "gin_server_admin/model/common/response" "gin_server_admin/model/hrsystem" + "github.com/gin-gonic/gin" ) @@ -195,6 +196,7 @@ type dingLiangKaoHe struct { Score float64 `json:"score"` //得分 MtOrAt int `json:"mtorat"` //手动还是自动 Cont string `json:"count"` //说明 + Nature int `json:"nature"` //性质 } // 定性记录列表 diff --git a/api/statistics/quantification/summary_details.go b/api/statistics/quantification/summary_details.go index f472109..713ab75 100644 --- a/api/statistics/quantification/summary_details.go +++ b/api/statistics/quantification/summary_details.go @@ -12,6 +12,7 @@ import ( "gin_server_admin/model/assessmentmodel" "gin_server_admin/model/common/response" "gin_server_admin/model/hrsystem" + "github.com/gin-gonic/gin" ) @@ -206,8 +207,13 @@ func DingLiangMonthSum(groupId, departmentId, weight, year, month int64, targetI if statues > 0 { status = statues } - + if v.TargetId == 12 { + fmt.Printf("Jiba------2------>%v\n", statues) + } if status != 3 { + if v.TargetId == 12 { + fmt.Printf("Jiba------3------>%v\n", v.ScoringMethod) + } if v.ScoringMethod == 1 { sumScore = sumScore + float64(v.Score) sumScoreGet, _, _, _, _ := analysisReward(targetId, v.Baseline, targetScore, float64(v.Score)) @@ -226,7 +232,19 @@ func DingLiangMonthSum(groupId, departmentId, weight, year, month int64, targetI sumScoreEs = sumScoreEs + sumScoreGet fmt.Printf("sumScoreEs--1--->%v\n", v.Score) } else { - sumScoreEs = sumScoreEs + (float64(v.ScoringScore) / 100) + scorSc := v.ScoringScore + switch cycle { + case 5: + if commonus.IsInTrue[int64](month, []int64{3, 6, 9, 12}) == false { + scorSc = targetScore * 100 + } + case 6: + if month != 12 { + scorSc = targetScore * 100 + } + default: + } + sumScoreEs = sumScoreEs + (float64(scorSc) / 100) // sumScoreGet, _, _, _, _ := analysisReward(targetId, v.Baseline, float64(weight), float64(v.ScoringScore)) // sumScoreEs = sumScoreEs + sumScoreGet fmt.Printf("sumScoreEs--2--->%v\n", sumScoreEs) @@ -234,7 +252,9 @@ func DingLiangMonthSum(groupId, departmentId, weight, year, month int64, targetI } else { sumScoreEs = sumScoreEs + targetScore } - + if v.TargetId == 12 { + fmt.Printf("Jiba------1------>%v\n", sumScoreEs) + } var extraDepartment hrsystem.AdministrativeOrganization minErr := extraDepartment.GetCont(map[string]interface{}{"id": v.EvaluationDepartment}, "name") // fmt.Printf("extraDepartment.Name-3---->%v\n", extraDepartment.Name) @@ -442,31 +462,19 @@ func (a *ApiGroup) SummaryDetailsLiangLog(c *gin.Context) { settlementScore = float64(v.Score) listCont.Score, listCont.Allprize, listCont.Zeroprize, listCont.Capping, listCont.CompletionRate = analysisReward(strconv.FormatInt(v.TargetId, 10), v.Baseline, targetScore, settlementScore) } else { - listCont.Actual = commonus.Decimal(float64(v.ScoringScore) / 100) + // listCont.Actual = commonus.Decimal(float64(v.ScoringScore) / 100) + listCont.Actual = commonus.Decimal(float64(v.Score) / 100) // settlementScore = float64(v.ScoringScore) _, listCont.Allprize, listCont.Zeroprize, listCont.Capping, listCont.CompletionRate = analysisReward(strconv.FormatInt(v.TargetId, 10), v.Baseline, targetScore, settlementScore) - listCont.Score = float64(v.ScoringScore) + listCont.Score = commonus.Decimal(float64(v.ScoringScore) / 100) } listCont.MtOrAt = v.ScoringMethod listCont.Cont = v.Content - //获取定量流水全奖、零奖、封顶值 - /* - @targetId 指标ID - @rewardCont 全奖、零奖、封顶值设置 - @targetScore 指标分值 - @settlementScore 计算分值 - 返回说明 - @scoreVal 计算得分 - @allPrize 全奖值 - @zeroPrize 零奖值 - @CappingVal 封顶值 - @achievement 达成率 - */ - // func analysisReward(targetId, rewardCont string, targetScore, settlementScore float64) (scoreVal, allPrize, zeroPrize, CappingVal, achievement float64) - + listCont.Nature = status if status == 3 { listCont.Score = targetScore } + switch cycle { case 5: if commonus.IsInTrue[int](requestData.Months, []int{3, 6, 9, 12}) == false { @@ -478,6 +486,9 @@ func (a *ApiGroup) SummaryDetailsLiangLog(c *gin.Context) { } default: } + // if v.TargetId == 12 { + // fmt.Printf("Jiba------------>%v\n", listCont) + // } listCont.Allprize = commonus.Decimal(listCont.Allprize) listCont.Zeroprize = commonus.Decimal(listCont.Zeroprize) listCont.Capping = commonus.Decimal(listCont.Capping) diff --git a/api/v1/custom/customhandle.go b/api/v1/custom/customhandle.go index f36ed92..c192301 100644 --- a/api/v1/custom/customhandle.go +++ b/api/v1/custom/customhandle.go @@ -4,6 +4,7 @@ import ( "encoding/json" "fmt" "strconv" + "strings" "gin_server_admin/api/admin/systemuser" "gin_server_admin/api/v1/staff" @@ -189,16 +190,20 @@ func (cu *CustomHandle) SystemLogin(c *gin.Context) { global.Gva_Authority_Authentication = surisdictionInt var menuOperStr []string var menuOperInts []int64 - jsonErrSun := json.Unmarshal([]byte(user.MenuOper), &menuOperStr) - if jsonErrSun == nil { - for _, menuOperVal := range menuOperStr { - menuOperInt, menuOperErr := strconv.ParseInt(menuOperVal, 10, 64) - if menuOperErr == nil { - menuOperInts = append(menuOperInts, menuOperInt) - } - + // jsonErrSun := json.Unmarshal([]byte(user.MenuOper), &menuOperStr) + menuOperStr = strings.Split(user.MenuOper, ",") + // if jsonErrSun == nil { + for _, menuOperVal := range menuOperStr { + menuOperInt, menuOperErr := strconv.ParseInt(menuOperVal, 10, 64) + if menuOperErr == nil { + menuOperInts = append(menuOperInts, menuOperInt) } + } + // } + + // fmt.Printf("菜单----JWT-110--->%v\n", menuOperInts) + global.Gva_Authority_Authentication_Subsidiary = menuOperInts saveData["Jurisdiction"] = global.Gva_Authority_Authentication saveData["MenuOper"] = global.Gva_Authority_Authentication_Subsidiary @@ -388,7 +393,7 @@ func (cu *CustomHandle) ScanCodeLogin(c *gin.Context) { global.GVA_ADMIN_USERKEY = userKeyCode global.GVA_SCANCODE_USERNUMBER = userAdmin.KeyStr - roleCont := getRole(userAdmin.Role) + // roleCont := getRole(userAdmin.Role) writeRedisData := map[string]interface{}{ "userkey": userKeyCode, @@ -396,14 +401,14 @@ func (cu *CustomHandle) ScanCodeLogin(c *gin.Context) { "usernumber": userAdmin.Name, "userpwd": userAdmin.PassWord, "usertoken": sha1Token, - "jurisdiction": roleCont.Jurisdiction, - "menuOper": roleCont.MenuOper, + "jurisdiction": userAdmin.Jurisdiction, + "menuOper": userAdmin.MenuOper, "wand": 118, } var surisdictionStr []string var surisdictionInt []int64 - jsonErr := json.Unmarshal([]byte(roleCont.Jurisdiction), &surisdictionStr) + jsonErr := json.Unmarshal([]byte(userAdmin.Jurisdiction), &surisdictionStr) if jsonErr == nil { for _, jurVal := range surisdictionStr { jurValInt, jurValErr := strconv.ParseInt(jurVal, 10, 64) @@ -418,18 +423,21 @@ func (cu *CustomHandle) ScanCodeLogin(c *gin.Context) { global.Gva_Authority_Authentication = surisdictionInt var menuOperStr []string var menuOperInts []int64 - jsonErrSun := json.Unmarshal([]byte(roleCont.MenuOper), &menuOperStr) - if jsonErrSun == nil { - for _, menuOperVal := range menuOperStr { - menuOperInt, menuOperErr := strconv.ParseInt(menuOperVal, 10, 64) - if menuOperErr == nil { - menuOperInts = append(menuOperInts, menuOperInt) - } - + // jsonErrSun := json.Unmarshal([]byte(userAdmin.MenuOper), &menuOperStr) + menuOperStr = strings.Split(userAdmin.MenuOper, ",") + // if jsonErrSun == nil { + for _, menuOperVal := range menuOperStr { + menuOperInt, menuOperErr := strconv.ParseInt(menuOperVal, 10, 64) + if menuOperErr == nil { + menuOperInts = append(menuOperInts, menuOperInt) } + } + // } global.Gva_Authority_Authentication_Subsidiary = menuOperInts + // fmt.Printf("菜单----JWT--112-->%v\n", menuOperInts) + redisFileKey := "ScanCode:Authentication:LoginApi_" + global.GVA_CONFIG.RedisPrefix.Alias + "_" + userKeyCode redisClient := redishandel.RunRedis() redisClient.SetRedisDb(5) @@ -502,16 +510,18 @@ func (cu *CustomHandle) ScanCodeLogin(c *gin.Context) { global.Gva_Authority_Authentication = surisdictionInt var menuOperStr []string var menuOperInts []int64 - jsonErrSun := json.Unmarshal([]byte(user.Menuoper), &menuOperStr) - if jsonErrSun == nil { - for _, menuOperVal := range menuOperStr { - menuOperInt, menuOperErr := strconv.ParseInt(menuOperVal, 10, 64) - if menuOperErr == nil { - menuOperInts = append(menuOperInts, menuOperInt) - } - + // jsonErrSun := json.Unmarshal([]byte(user.Menuoper), &menuOperStr) + menuOperStr = strings.Split(user.Menuoper, ",") + // if jsonErrSun == nil { + for _, menuOperVal := range menuOperStr { + menuOperInt, menuOperErr := strconv.ParseInt(menuOperVal, 10, 64) + if menuOperErr == nil { + menuOperInts = append(menuOperInts, menuOperInt) } + } + // } + // fmt.Printf("菜单----JWT--113-->%v\n", menuOperInts) global.Gva_Authority_Authentication_Subsidiary = menuOperInts redisFileKey := "ScanCode:Authentication:LoginApi_" + global.GVA_CONFIG.RedisPrefix.Alias + "_" + userKeyCode redisClient := redishandel.RunRedis() diff --git a/api/v1/positionkpi/posttarget.go b/api/v1/positionkpi/posttarget.go index ad41e22..8501c15 100644 --- a/api/v1/positionkpi/posttarget.go +++ b/api/v1/positionkpi/posttarget.go @@ -10,6 +10,7 @@ import ( "gin_server_admin/model/assessmentmodel" "gin_server_admin/model/common/response" "gin_server_admin/model/hrsystem" + "github.com/gin-gonic/gin" ) @@ -254,7 +255,7 @@ func (a *ApiMethod) PostTargetList(c *gin.Context) { requestData.PageSize = 20 } var postTargetListAry []outPostTargetList - gormDb := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.PostTarget{}) + gormDb := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.PostTarget{}).Where("`state` BETWEEN 1 AND 2") if requestData.Title != "" { gormDb = gormDb.Where("`title` LIKE ?", "%"+requestData.Title+"%") diff --git a/api/v1/staff/staffpeople.go b/api/v1/staff/staffpeople.go index 95703cd..e3f88f3 100644 --- a/api/v1/staff/staffpeople.go +++ b/api/v1/staff/staffpeople.go @@ -1,6 +1,7 @@ package staff import ( + "fmt" "strconv" "gin_server_admin/commonus" @@ -9,6 +10,7 @@ import ( "gin_server_admin/model/hrsystem" "gin_server_admin/model/systemuser" "gin_server_admin/model/testpage" + "github.com/gin-gonic/gin" ) @@ -266,9 +268,11 @@ func HrUserInfor(number, pwd string) (isTrue bool, usUpdate OutScanCodeUserInfo) usUpdate.Role = ueInfo.Role // `json:"role"` usUpdate.Icon = ueInfo.Icon // `json:"icon"` usUpdate.Wechat = wechatStr // `json:"wechat"` - menuStr, buttonStr := getRoleInt(ueInfo.Role) - usUpdate.Jurisdiction = buttonStr // `json:"jurisdiction"` - usUpdate.Menuoper = menuStr // `json:"menuoper"` + // menuStr, buttonStr := getRoleInt(ueInfo.Role) + fmt.Printf("获取的角色值--------->%v\n", ueInfo.Role) + roleName, pointId, operation, level := commonus.GetNewAccredit("kpi", ueInfo.Role, ueInfo.AdminOrg, ueInfo.Position) + usUpdate.Jurisdiction = operation // `json:"jurisdiction"` + usUpdate.Menuoper = pointId // `json:"menuoper"` oldGroup, _ := getOrgCont(strconv.FormatInt(ueInfo.Company, 10)) usUpdate.Oldgroup = oldGroup // `json:"oldgroup"` olddepart, _ := getOrgCont(strconv.FormatInt(ueInfo.MainDeparment, 10)) @@ -276,6 +280,8 @@ func HrUserInfor(number, pwd string) (isTrue bool, usUpdate OutScanCodeUserInfo) usUpdate.Key = strconv.FormatInt(ueInfo.Key, 10) usUpdate.State = ueInfo.State usUpdate.Password = ueInfo.Password + usUpdate.RoleName = roleName + usUpdate.Level = strconv.Itoa(level) return } func HrUserInforold(number, pwd string) (isTrue bool, usUpdate OutScanCodeUserInfo) { diff --git a/commonus/publichaneld.go b/commonus/publichaneld.go index 375d9b1..e7154f7 100644 --- a/commonus/publichaneld.go +++ b/commonus/publichaneld.go @@ -17,6 +17,7 @@ import ( "gin_server_admin/model/assessmentmodel" "gin_server_admin/model/hrsystem" "gin_server_admin/model/location" + "gin_server_admin/model/modelssystempermission" "gin_server_admin/model/systemuser" "gin_server_admin/model/testpage" "gin_server_admin/model/wechat" @@ -1682,7 +1683,7 @@ func GetOfficeWork(id, departmentId int64) (isTrue bool, roleUser []roleGroupBod if jsonErrs == nil { isTrue = true } - // fmt.Printf("%v------->%v------->%v\n", i, roleGroup, roleUser) + fmt.Printf("根据部门获取内勤数据******************>%v------->%v------->%v\n", i, roleGroup, roleUser) } } @@ -1725,7 +1726,7 @@ func GetSendMsgUserAry(id, departmentId int64) (isTrue bool, userStr []string) { // return // } // err, roleGroup, _ := GetOfficeWork(id, int64(departmentCont.WechatId)) - + fmt.Printf("获取企业微信信息接收人数组形态------------->%v-------->%v\n", id, departmentId) departWhere := MapOut() departWhere["id"] = departmentId departmentCont, errDepart := GetNewOrgCont(departWhere, "wechat_organization_id") @@ -1746,6 +1747,7 @@ func GetSendMsgUserAry(id, departmentId int64) (isTrue bool, userStr []string) { userStr = userList isTrue = true } + fmt.Printf("获取企业微信信息接收人数组形态--------1----->%v-------->%v\n", isTrue, userStr) return } @@ -2146,7 +2148,20 @@ func StepAddData(flowID, roleGroupId int64, nextStep, stepName, typeclass, state } } -func StepAddDataEs(flowID, roleGroupId int64, nextStep, stepName, typeclass, state, stepInt int, userKey string, encFile []EnclosureFormat) { +/* +@flowID 流程ID +@userKey 操作人key +@roleGroupId 角色组Id +@stepName 步骤名称 +@typeclass 1、定性;2、定量 +@state 状态 +@stepInt 当前是第几部 +@recStrat 是否改正 +@nextStep 下一步 +@encFile 附件 +@timeOccurrence 发生时间 +*/ +func StepAddDataEs(flowID, roleGroupId int64, nextStep, stepName, typeclass, state, stepInt int, userKey string, encFile []EnclosureFormat, timeOccurrence int64) { if state < 1 { state = 1 } @@ -2165,6 +2180,7 @@ func StepAddDataEs(flowID, roleGroupId int64, nextStep, stepName, typeclass, sta flowSteping.AddTime = time.Now().Unix() //添加时间 flowStepAryMap = append(flowStepAryMap, flowSteping) + evalProCont.HappenTime = timeOccurrence evalProCont.OrderKey = flowID evalProCont.Step = 1 evalProCont.State = state @@ -4083,9 +4099,12 @@ func GetSchemeFlowData(flowKwy, schemeID int64) (weightSum float64) { // 获取float字符串转化成Int64 func GetDuyCycle(scoreStr string, multiple int64) (scoreInt64 int64) { - coreFloat64, _ := strconv.ParseFloat(scoreStr, 64) //将字符串转换成float64 + coreFloat64, _ := strconv.ParseFloat(scoreStr, 64) //将字符串转换成float64 + fmt.Printf("分值转化-----1------>%v------------->%v\n", scoreStr, coreFloat64) scoreFloat64ToStr := strconv.FormatFloat(coreFloat64*float64(multiple), 'f', -1, 64) //将乘以系数后的数值转换成字符串 - scoreInt64, _ = strconv.ParseInt(scoreFloat64ToStr, 10, 64) //将字符串转换成int64 + fmt.Printf("分值转化-----2------>%v------------->%v\n", scoreFloat64ToStr, multiple) + scoreInt64, _ = strconv.ParseInt(scoreFloat64ToStr, 10, 64) //将字符串转换成int64 + fmt.Printf("分值转化-----3------>%v------------->%v\n", scoreFloat64ToStr, scoreInt64) return } @@ -4110,7 +4129,7 @@ func GetTimeIntervalDutyJudge(whereData interface{}, schemeID int64) (actual flo func JudegSunTarToDepart(sunId, departId int64) (isTrue bool) { isTrue = false var title string - judgeARTErr := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeTarget{}).Select("q_title").Where("`q_id` = ? AND FIND_IN_SET(?,`q_depart`)", sunId, departId).First(&title).Error + judgeARTErr := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeTarget{}).Select("q_title").Where("`q_state` = 1 AND `q_id` = ? AND FIND_IN_SET(?,`q_depart`)", sunId, departId).First(&title).Error if judgeARTErr == nil { isTrue = true } @@ -4325,7 +4344,9 @@ func CalculateScore(targetScore int64, resultval, allPrizes, zeroPrizes, Capping achievement = 100 scoreVal = float64(targetScore) if typeClass == 2 { - scoreVal = 0 + if resultval <= 0 { + scoreVal = 0 + } } achievementAll = 100 //fmt.Printf("达成率--11-->%v-->%v-->%v-->%v-->%v-->%v-->%v\n", targetScore, resultval, scoreVal, allPrize, zeroPrize, CappingVal, achievement) @@ -4453,3 +4474,106 @@ func DiGuiOrgSun(superior int64, idary []int64) (groupId []int64) { } return } + +/* +* +@ 作者: 秦东 +@ 时间: 2022-11-19 13:23:25 +@ 功能: 获取新授权 +@ 参数 + + #roleId 角色ID + #orgId 行政组织 + #postId 岗位 + #systemName 系统名称 + +@ 返回值 + + #roleName 角色名称 + #pointId 菜单权限 + #operation 操作权限 + #level 操作等级 + +@ 方法原型 + + # GetNewAccredit(systemName, roleId string, orgId, postId int64) (roleName, pointId, operation string, level int) +*/ +func GetNewAccredit(systemName, roleId string, orgId, postId int64) (roleName, pointId, operation string, level int) { + var pointIdAry []string + var operationAry []string + if roleId != "" { + roleIdAry := strings.Split(roleId, ",") + + if len(roleIdAry) > 0 { + //获取角色名称 + var roleCont []modelssystempermission.SystemRole + err := global.GVA_DB_System_Permission.Model(&modelssystempermission.SystemRole{}).Select("`name`").Where("`id` IN ?", roleIdAry).Find(&roleCont).Error + if err == nil && len(roleCont) > 0 { + var roleNameAry []string + for _, rnv := range roleCont { + if IsInTrue[string](rnv.Name, roleNameAry) == false { + roleNameAry = append(roleNameAry, rnv.Name) + } + } + roleName = strings.Join(roleNameAry, "|") + } + //获取配置的所有角色权限 + var roleEmpowerCont []modelssystempermission.RoleEmpower + err = global.GVA_DB_System_Permission.Model(&modelssystempermission.RoleEmpower{}).Select("`point_id`,`operation`,`level`").Where("`system` = ? AND `role_id` IN ?", systemName, roleIdAry).Find(&roleEmpowerCont).Error + if err == nil && len(roleEmpowerCont) > 0 { + for _, rev := range roleEmpowerCont { + menuList := strings.Split(rev.PointId, ",") + for _, mv := range menuList { //菜单权限 + if IsInTrue[string](mv, pointIdAry) == false { + pointIdAry = append(pointIdAry, mv) + } + } + operList := strings.Split(rev.Operation, ",") + for _, ov := range operList { //操作权限 + if IsInTrue[string](ov, operationAry) == false { + operationAry = append(operationAry, ov) + } + } + if level < rev.Level { + level = rev.Level //等级 + } + } + } + } + + } + + //获取行政组织授权 + if orgId > 0 && postId > 0 { + var orgEmpowerCont modelssystempermission.Empower + orgEmpowerCont.GetCont(map[string]interface{}{"`ordid`": orgId, "`post_id`": postId, "`system`": systemName}, "`point_id`", "`operation`", "`level`") + if len(pointIdAry) < 1 { //判断是否已经配过权限 + pointIdAry = strings.Split(orgEmpowerCont.PointId, ",") + } else { + guoduPoin := strings.Split(orgEmpowerCont.PointId, ",") + for _, pv := range guoduPoin { //合并权限 + if IsInTrue[string](pv, pointIdAry) == false { + pointIdAry = append(pointIdAry, pv) + } + } + + } + if len(operationAry) < 1 { //判断是否已经配过权限 + operationAry = strings.Split(orgEmpowerCont.Operation, ",") + } else { + guoduOper := strings.Split(orgEmpowerCont.Operation, ",") + for _, pv := range guoduOper { //合并权限 + if IsInTrue[string](pv, operationAry) == false { + operationAry = append(operationAry, pv) + } + } + + } + if level < orgEmpowerCont.Level { + level = orgEmpowerCont.Level + } + } + pointId = strings.Join(pointIdAry, ",") + operation = strings.Join(operationAry, ",") + return +} diff --git a/commonus/timeSub.go b/commonus/timeSub.go index 58645a2..0e911b4 100644 --- a/commonus/timeSub.go +++ b/commonus/timeSub.go @@ -7,7 +7,7 @@ import ( "time" ) -//时间相关处理类 +// 时间相关处理类 var ( timeLayoutMap = map[string]string{ "y": "2006", @@ -29,7 +29,8 @@ var ( } ) -/** +/* +* 获取本周周一的日期 */ func GetDateOfWeek() (weekMonday string) { @@ -45,7 +46,8 @@ func GetDateOfWeek() (weekMonday string) { return } -/** +/* +* 获取本周周日的日期 */ func GetLastWeekDate() (weekMonday string) { @@ -56,7 +58,8 @@ func GetLastWeekDate() (weekMonday string) { return } -/** +/* +* 获取上周的周一日期 */ func GetFirstWeekDate() (weekMonday string) { @@ -67,7 +70,8 @@ func GetFirstWeekDate() (weekMonday string) { return } -/** +/* +* 获取上周的周日日期 */ func GetFirstWeekLastDate() (weekMonday string) { @@ -78,7 +82,8 @@ func GetFirstWeekLastDate() (weekMonday string) { return } -/** +/* +* 获取指定日期的上周的周一日期 */ func GetFirstWeekDateSet(thisWeekMonday string) (weekMonday string) { @@ -184,7 +189,7 @@ func TimeStampToDate(timeStamp int64, timeType int) (dateStr string) { return } -//时间计算(年、季、月、周、日、时、分、秒) +// 时间计算(年、季、月、周、日、时、分、秒) func ComputingTime(timeStamp int64, timeType int) (timeDataInt int64) { var timeData string = "1" switch timeType { @@ -274,7 +279,7 @@ func GetDiffDaysBySecond(t1, t2 int64) int64 { return GetDiffDays(time1, time2) } -//获取时间段内每天的开始结束时间 +// 获取时间段内每天的开始结束时间 func StartAndEndTimeOREveryDay(startTime, endTime int64) []map[string]interface{} { tianshu := GetDiffDaysBySecond(endTime, startTime) var i int64 @@ -291,7 +296,7 @@ func StartAndEndTimeOREveryDay(startTime, endTime int64) []map[string]interface{ return timeMapAry } -//日期字符串转换成time格式 +// 日期字符串转换成time格式 func StringToTimeIng(unit, str string) (res time.Time) { loc, _ := time.LoadLocation("Local") // str := t.ToString() @@ -303,35 +308,35 @@ func StringToTimeIng(unit, str string) (res time.Time) { return } -//获取传入的时间所在月份的第一天,即某月第一天的0点。如传入time.Now(), 返回当前月份的第一天0点时间。 +// 获取传入的时间所在月份的第一天,即某月第一天的0点。如传入time.Now(), 返回当前月份的第一天0点时间。 func GetFirstDateOfMonth(d time.Time) time.Time { d = d.AddDate(0, 0, -d.Day()+1) return GetZeroTime(d) } -//获取传入的时间所在月份的第一天,即某月第一天的0点。如传入time.Now(), 返回当前月份的第一天0点时间戳。 +// 获取传入的时间所在月份的第一天,即某月第一天的0点。如传入time.Now(), 返回当前月份的第一天0点时间戳。 func GetFirstDateOfMonthStamp(d time.Time) (monthStartTimeShamp int64) { monthStartTimeShamp = GetFirstDateOfMonth(d).Unix() return } -//获取传入的时间所在月份的最后一天,即某月最后一天的0点。如传入time.Now(), 返回当前月份的最后一天0点时间。 +// 获取传入的时间所在月份的最后一天,即某月最后一天的0点。如传入time.Now(), 返回当前月份的最后一天0点时间。 func GetLastDateOfMonth(d time.Time) time.Time { return GetFirstDateOfMonth(d).AddDate(0, 1, -1) } -//获取传入的时间所在月份的最后一天,即某月最后一天的23点59分59秒。如传入time.Now(), 返回当前月份的最后一天23点59分59秒的时间戳。 +// 获取传入的时间所在月份的最后一天,即某月最后一天的23点59分59秒。如传入time.Now(), 返回当前月份的最后一天23点59分59秒的时间戳。 func GetLastDateMonthAll(d time.Time) (monthEndTimeShamp int64) { monthEndTimeShamp = GetLastDateOfMonth(d).Unix() + 86399 return } -//获取某一天的0点时间 +// 获取某一天的0点时间 func GetZeroTime(d time.Time) time.Time { return time.Date(d.Year(), d.Month(), d.Day(), 0, 0, 0, 0, d.Location()) } -//指定日期月起止时间戳 +// 指定日期月起止时间戳 func GetMonthStartOrEndTime(d time.Time) (monthStartTimgStamp, monthEndTimeStamp int64) { monthStartTimgStamp = GetFirstDateOfMonthStamp(d) monthEndTimeStamp = GetLastDateMonthAll(d) @@ -379,7 +384,7 @@ func WeekStartAdnEndTime(t time.Time) (strarTime, endTime int64, weekInt int) { return } -//计算指定日期周一 +// 计算指定日期周一 func SetDateWeekFirstTime(t time.Time) (weekInt string) { offset := int(time.Monday - t.Weekday()) if offset > 0 { @@ -417,7 +422,7 @@ func FirstWeekStartAdnEndTime(t time.Time) (strarTime, endTime int64, weekInt in return } -//获取指定时间当月第一周起止时间 +// 获取指定时间当月第一周起止时间 func GetSetUpDayTimeToMonthStartAndEndTime(monthStartTime int64) (strarTime, endTime int64) { t := time.Unix(monthStartTime, 0) fmt.Println(time.Unix(monthStartTime, 0)) @@ -474,7 +479,7 @@ func GetQuarterDay(t time.Time) (string, int, int64, int64) { return year, currentQuarter, quarterStartTime, quarterEndTime } -//获取指定时间的前N个月的起止时间 +// 获取指定时间的前N个月的起止时间 func AppointTimeFrontMonth(timeVal time.Time, diff int) (startTime, endTime int64) { diff = diff * -1 lastMonthFirstDay := timeVal.AddDate(0, diff, -timeVal.Day()+1) @@ -484,7 +489,7 @@ func AppointTimeFrontMonth(timeVal time.Time, diff int) (startTime, endTime int6 return } -//获取上月月份,起止时间 +// 获取上月月份,起止时间 func GetLastMonth() (yearMonth, startMonth, endMonth string) { dataTypeAll := "2006-01-02" dataType := "2006-01" @@ -497,7 +502,7 @@ func GetLastMonth() (yearMonth, startMonth, endMonth string) { return } -//获取指定月的起止时间 +// 获取指定月的起止时间 func GetAppointMonthStarAndEndTime(dayTime string) (startTime, endTime int64) { dataTypeAll := "2006-01-02" dayTime = fmt.Sprintf("%v-%v", dayTime, "01") @@ -510,9 +515,21 @@ func GetAppointMonthStarAndEndTime(dayTime string) (startTime, endTime int64) { return } -//获取指定月的起止时间 +// 获取指定月的起止时间 func GetAppointMonthStarAndEndTimeInt(monthStartTime int64) (monthStartTimgStamp, monthEndTimeStamp int64) { t := time.Unix(monthStartTime, 0) monthStartTimgStamp, monthEndTimeStamp = GetMonthStartOrEndTime(t) return } + +// 获取指定月的起止时间副本 +func GetAppointMonthStarAndEndTimeEs(dayTime string) (startTime, endTime int64) { + dataTypeAll := "2006-01-02" + firstToTime := StringToTimeIng("d", dayTime) + startTimeStr := fmt.Sprintf("%v 00:00:00", firstToTime.AddDate(0, 0, 0).Format(dataTypeAll)) + endTimeStr := fmt.Sprintf("%v 23:59:59", firstToTime.AddDate(0, 1, -1).Format(dataTypeAll)) + // startTime = dayTime + startTime, _ = DateToTimeStampEs(startTimeStr) + endTime, _ = DateToTimeStampEs(endTimeStr) + return +} diff --git a/config.yaml b/config.yaml index bfa4105..57e1e55 100644 --- a/config.yaml +++ b/config.yaml @@ -338,6 +338,18 @@ hrdatabasekingdee: log-mode: false log-zap: "" +#系统权限配置数据库 +systemPermission: + path: '127.0.0.1:3306' + config: 'charset=utf8mb4&parseTime=True&loc=Local' + db-name: 'system_empower' + username: 'root' + password: 'root' + max-idle-conns: 100 + max-open-conns: 1500 + log-mode: false + log-zap: "" + #企业微信相关设置 workwechatid: diff --git a/config/config.go b/config/config.go index 33d98d5..fcfc5ee 100644 --- a/config/config.go +++ b/config/config.go @@ -32,6 +32,7 @@ type Server struct { MysqlWechatCallBack Mysql `mapstructure:"mysqlWechatCallBack" json:"mysqlWechatCallBack" yaml:"mysqlWechatCallBack"` HrDataBase Mysql `mapstructure:"hrdatabase" json:"hrdatabase" yaml:"hrdatabase"` HrDataBaseKingDee Mysql `mapstructure:"hrdatabasekingdee" json:"hrdatabasekingdee" yaml:"hrdatabasekingdee"` + SystemPermission Mysql `mapstructure:"systemPermission" json:"systemPermission" yaml:"systemPermission"` // oss Local Local `mapstructure:"local" json:"local" yaml:"local"` diff --git a/gin_server_admin b/gin_server_admin index cb7ab48..9c5568c 100644 Binary files a/gin_server_admin and b/gin_server_admin differ diff --git a/global/global.go b/global/global.go index e1c341b..af11f11 100644 --- a/global/global.go +++ b/global/global.go @@ -2,6 +2,7 @@ package global import ( "gin_server_admin/utils/timer" + "github.com/songzhibin97/gkit/cache/local_cache" "golang.org/x/sync/singleflight" @@ -43,6 +44,7 @@ var ( GVA_DB_WechatCallBack *gorm.DB GVA_DB_HrDataBase *gorm.DB GVA_DB_HrKingDee *gorm.DB + GVA_DB_System_Permission *gorm.DB //企业微信专用redis GVA_REDIS_WeChat *redis.Client diff --git a/global/model.go b/global/model.go index 4422986..09ecdd4 100644 --- a/global/model.go +++ b/global/model.go @@ -33,4 +33,6 @@ type GAV_USER_CONT struct { Menuoper string `json:"menuoper"` Oldgroup string `json:"oldgroup"` Olddepartment string `json:"olddepartment"` + Level string `json:"level"` + RoleName string `json:"rolename"` } diff --git a/initialize/gorm.go b/initialize/gorm.go index d0bbd21..f7aa7e9 100644 --- a/initialize/gorm.go +++ b/initialize/gorm.go @@ -2,6 +2,7 @@ package initialize import ( "os" + "time" "gin_server_admin/global" "gin_server_admin/initialize/internal" @@ -162,6 +163,8 @@ func GormMysqlChange(setDataBaseName string) *gorm.DB { m = global.GVA_CONFIG.HrDataBase case "hrdatabasekingdee": m = global.GVA_CONFIG.HrDataBaseKingDee + case "systemPermission": + m = global.GVA_CONFIG.SystemPermission default: m = global.GVA_CONFIG.Mysql } @@ -186,6 +189,7 @@ func GormMysqlChange(setDataBaseName string) *gorm.DB { sqlDB, _ := db.DB() sqlDB.SetMaxIdleConns(m.MaxIdleConns) sqlDB.SetMaxOpenConns(m.MaxOpenConns) + sqlDB.SetConnMaxLifetime(5 * time.Minute) return db } } diff --git a/main.go b/main.go index edcae66..8156dbf 100644 --- a/main.go +++ b/main.go @@ -91,12 +91,17 @@ func main() { global.GVA_DB_HrDataBase = initialize.GormMysqlChange("hrdatabase") if global.GVA_DB_Performanceappraisal != nil { - fmt.Printf("%v==>hrdatabase\n", global.GVA_DB_HrDataBase) + fmt.Printf("%v==>数据库hrdatabase初始化成功\n", global.GVA_DB_HrDataBase) } global.GVA_DB_HrKingDee = initialize.GormMysqlChange("hrdatabasekingdee") if global.GVA_DB_Performanceappraisal != nil { - fmt.Printf("%v==>hrdatabase\n", global.GVA_DB_HrKingDee) + fmt.Printf("%v==>数据库HrKingDee初始化成功\n", global.GVA_DB_HrKingDee) + } + + global.GVA_DB_System_Permission = initialize.GormMysqlChange("systemPermission") + if global.GVA_DB_Performanceappraisal != nil { + fmt.Printf("%v==>数据库Permission初始化成功\n", global.GVA_DB_System_Permission) } scheduledtask.TimeTask() diff --git a/middleware/myjwt.go b/middleware/myjwt.go index acf15ac..217d8ff 100644 --- a/middleware/myjwt.go +++ b/middleware/myjwt.go @@ -4,6 +4,7 @@ import ( "encoding/json" "fmt" "strconv" + "strings" "gin_server_admin/commonus" "gin_server_admin/global" @@ -304,16 +305,18 @@ func ScanCodeLogin() gin.HandlerFunc { global.Gva_Authority_Authentication = surisdictionInt var menuOperStr []string var menuOperInts []int64 - jsonErrSun := json.Unmarshal([]byte(myCustomIdentify.MenuOper), &menuOperStr) - if jsonErrSun == nil { - for _, menuOperVal := range menuOperStr { - menuOperInt, menuOperErr := strconv.ParseInt(menuOperVal, 10, 64) - if menuOperErr == nil { - menuOperInts = append(menuOperInts, menuOperInt) - } - + // jsonErrSun := json.Unmarshal([]byte(myCustomIdentify.MenuOper), &menuOperStr) + menuOperStr = strings.Split(myCustomIdentify.MenuOper, ",") + // if jsonErrSun == nil { + for _, menuOperVal := range menuOperStr { + menuOperInt, menuOperErr := strconv.ParseInt(menuOperVal, 10, 64) + if menuOperErr == nil { + menuOperInts = append(menuOperInts, menuOperInt) } + } + // } + // fmt.Printf("菜单----JWT---->%v---->%v---->%v\n", menuOperInts, myCustomIdentify.MenuOper, menuOperStr) global.Gva_Authority_Authentication_Subsidiary = menuOperInts redisClient.SetRedisTime(10800) redisClient.HashMsetAdd(redisFileKey, writeRedisData) diff --git a/model/assessmentmodel/performance_appraisal.go b/model/assessmentmodel/performance_appraisal.go index ecda512..6823298 100644 --- a/model/assessmentmodel/performance_appraisal.go +++ b/model/assessmentmodel/performance_appraisal.go @@ -84,6 +84,7 @@ type EvaluationProcess struct { Target string `json:"target" gorm:"column:ep_target;type:mediumtext;comment:指标"` DetailedTarget string `json:"detailedtarget" gorm:"column:ep_detailedtarget;type:mediumtext;comment:指标细则"` AcceptDepartment int64 `json:"acceptdepartment" gorm:"column:ep_accept_department;type:bigint(20) unsigned;default:0;not null;comment:接受考核部门"` + HappenTime int64 `json:"happentime" gorm:"column:ep_happen_time;type:bigint(20) unsigned;default:0;not null;comment:发生时间"` } func (EvaluationProcess *EvaluationProcess) TableName() string { diff --git a/model/modelssystempermission/appsystem.go b/model/modelssystempermission/appsystem.go new file mode 100644 index 0000000..3c94c0c --- /dev/null +++ b/model/modelssystempermission/appsystem.go @@ -0,0 +1,62 @@ +package modelssystempermission + +import ( + "gin_server_admin/global" + "strings" +) + +// 应用系统 +type Appsystem struct { + Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` + Title string `json:"title" gorm:"column:title;type:varchar(255) ;comment:系统名称"` + Coder string `json:"coder" gorm:"column:coder;type:varchar(255) ;comment:识别符"` + State int `json:"state" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` + Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` + Sort int `json:"sort" gorm:"column:sort;type:int(5) unsigned;default:50;not null;comment:排序"` + ApiUrl string `json:"apiurl" gorm:"column:api_url;type:varchar(255) ;comment:菜单访问权限列表"` +} + +func (Appsystem *Appsystem) TableName() string { + return "appsystem" +} + +// 编辑内容 +func (cont *Appsystem) EiteCont(whereMap interface{}, saveData interface{}) (err error) { + err = global.GVA_DB_System_Permission.Model(&cont).Where(whereMap).Updates(saveData).Error + return +} + +// 获取内容 +func (cont *Appsystem) GetCont(whereMap interface{}, field ...string) (err error) { + gormDb := global.GVA_DB_System_Permission.Model(&cont) + if len(field) > 0 { + fieldStr := strings.Join(field, ",") + gormDb = gormDb.Select(fieldStr) + } + gormDb = gormDb.Where(whereMap) + err = gormDb.First(&cont).Error + return +} + +// 根据条件获取总数 +func (cont *Appsystem) CountCont(whereMap interface{}) (countId int64) { + global.GVA_DB_System_Permission.Model(&cont).Where(whereMap).Count(&countId) + return +} + +// 读取全部信息 +func (cont *Appsystem) ContMap(whereMap interface{}, field ...string) (countAry []Appsystem, err error) { + gormDb := global.GVA_DB_System_Permission.Model(&cont) + if len(field) > 0 { + fieldStr := strings.Join(field, ",") + gormDb = gormDb.Select(fieldStr) + } + err = gormDb.Where(whereMap).Find(&countAry).Error + return +} + +// 删除内容 +func (cont *Appsystem) DelCont(whereMap interface{}) (err error) { + err = global.GVA_DB_System_Permission.Where(whereMap).Delete(&cont).Error + return +} diff --git a/model/modelssystempermission/empower.go b/model/modelssystempermission/empower.go new file mode 100644 index 0000000..80c5bf1 --- /dev/null +++ b/model/modelssystempermission/empower.go @@ -0,0 +1,65 @@ +package modelssystempermission + +import ( + "gin_server_admin/global" + "strings" +) + +// 权限配置 +type Empower struct { + Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` + OrdId int64 `json:"ordid" gorm:"column:ordid;type:bigint(20) unsigned;default:0;not null;comment:行政组织"` + PostId int64 `json:"postid" gorm:"column:post_id;type:bigint(20) unsigned;default:0;not null;comment:岗位ID"` + System string `json:"system" gorm:"column:system;type:varchar(255) ;comment:系统"` + PointId string `json:"pointid" gorm:"column:point_id;type:longtext;comment:权限点位"` + State int `json:"state" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` + Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` + Level int `json:"level" gorm:"column:level;type:int(1) unsigned;default:1;not null;comment:授权范围等级(1:本部门;2:本分部;3:所有)"` + Organization string `json:"organization" gorm:"column:organization;type:longtext;comment:行政组织"` + Operation string `json:"operation" gorm:"column:operation;type:longtext;comment:操作点位"` +} + +func (Empower *Empower) TableName() string { + return "empower" +} + +// 编辑内容 +func (cont *Empower) EiteCont(whereMap interface{}, saveData interface{}) (err error) { + err = global.GVA_DB_System_Permission.Model(&cont).Where(whereMap).Updates(saveData).Error + return +} + +// 获取内容 +func (cont *Empower) GetCont(whereMap interface{}, field ...string) (err error) { + gormDb := global.GVA_DB_System_Permission.Model(&cont) + if len(field) > 0 { + fieldStr := strings.Join(field, ",") + gormDb = gormDb.Select(fieldStr) + } + gormDb = gormDb.Where(whereMap) + err = gormDb.First(&cont).Error + return +} + +// 根据条件获取总数 +func (cont *Empower) CountCont(whereMap interface{}) (countId int64) { + global.GVA_DB_System_Permission.Model(&cont).Where(whereMap).Count(&countId) + return +} + +// 读取全部信息 +func (cont *Empower) ContMap(whereMap interface{}, field ...string) (countAry []Empower, err error) { + gormDb := global.GVA_DB_System_Permission.Model(&cont) + if len(field) > 0 { + fieldStr := strings.Join(field, ",") + gormDb = gormDb.Select(fieldStr) + } + err = gormDb.Where(whereMap).Find(&countAry).Error + return +} + +// 删除内容 +func (cont *Empower) DelCont(whereMap interface{}) (err error) { + err = global.GVA_DB_System_Permission.Where(whereMap).Delete(&cont).Error + return +} diff --git a/model/modelssystempermission/role_empower.go b/model/modelssystempermission/role_empower.go new file mode 100644 index 0000000..7efd750 --- /dev/null +++ b/model/modelssystempermission/role_empower.go @@ -0,0 +1,63 @@ +package modelssystempermission + +import ( + "gin_server_admin/global" + "strings" +) + +// 权限配置 +type RoleEmpower struct { + Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` + RoleId int64 `json:"roleid" gorm:"column:role_id;type:bigint(20) unsigned;default:0;not null;comment:行政组织"` + System string `json:"system" gorm:"column:system;type:varchar(255) ;comment:系统"` + PointId string `json:"pointid" gorm:"column:point_id;type:longtext;comment:权限点位"` + Operation string `json:"operation" gorm:"column:operation;type:longtext;comment:操作点位"` + State int `json:"state" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` + Level int `json:"level" gorm:"column:level;type:int(1) unsigned;default:1;not null;comment:授权范围等级(1:本部门;2:本分部;3:所有)"` + Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` +} + +func (RoleEmpower *RoleEmpower) TableName() string { + return "role_empower" +} + +// 编辑内容 +func (cont *RoleEmpower) EiteCont(whereMap interface{}, saveData interface{}) (err error) { + err = global.GVA_DB_System_Permission.Model(&cont).Where(whereMap).Updates(saveData).Error + return +} + +// 获取内容 +func (cont *RoleEmpower) GetCont(whereMap interface{}, field ...string) (err error) { + gormDb := global.GVA_DB_System_Permission.Model(&cont) + if len(field) > 0 { + fieldStr := strings.Join(field, ",") + gormDb = gormDb.Select(fieldStr) + } + gormDb = gormDb.Where(whereMap) + err = gormDb.First(&cont).Error + return +} + +// 根据条件获取总数 +func (cont *RoleEmpower) CountCont(whereMap interface{}) (countId int64) { + global.GVA_DB_System_Permission.Model(&cont).Where(whereMap).Count(&countId) + return +} + +// 读取全部信息 +func (cont *RoleEmpower) ContMap(whereMap interface{}, field ...string) (countAry []RoleEmpower, err error) { + gormDb := global.GVA_DB_System_Permission.Model(&cont) + if len(field) > 0 { + fieldStr := strings.Join(field, ",") + gormDb = gormDb.Select(fieldStr) + } + err = gormDb.Where(whereMap).Find(&countAry).Error + return +} + +// 删除内容 +func (cont *RoleEmpower) DelCont(whereMap interface{}) (err error) { + err = global.GVA_DB_System_Permission.Where(whereMap).Delete(&cont).Error + return +} diff --git a/model/modelssystempermission/system_role.go b/model/modelssystempermission/system_role.go new file mode 100644 index 0000000..916691d --- /dev/null +++ b/model/modelssystempermission/system_role.go @@ -0,0 +1,60 @@ +package modelssystempermission + +import ( + "gin_server_admin/global" + "strings" +) + +// 系统角色表 +type SystemRole struct { + Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` + Name string `json:"name" gorm:"column:name;type:varchar(255) ;comment:系统名称"` + State int `json:"state" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` + Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` + Sort int `json:"sort" gorm:"column:sort;type:int(5) unsigned;default:50;not null;comment:排序"` +} + +func (SystemRole *SystemRole) TableName() string { + return "system_role" +} + +// 编辑内容 +func (cont *SystemRole) EiteCont(whereMap interface{}, saveData interface{}) (err error) { + err = global.GVA_DB_System_Permission.Model(&cont).Where(whereMap).Updates(saveData).Error + return +} + +// 获取内容 +func (cont *SystemRole) GetCont(whereMap interface{}, field ...string) (err error) { + gormDb := global.GVA_DB_System_Permission.Model(&cont) + if len(field) > 0 { + fieldStr := strings.Join(field, ",") + gormDb = gormDb.Select(fieldStr) + } + gormDb = gormDb.Where(whereMap) + err = gormDb.First(&cont).Error + return +} + +// 根据条件获取总数 +func (cont *SystemRole) CountCont(whereMap interface{}) (countId int64) { + global.GVA_DB_System_Permission.Model(&cont).Where(whereMap).Count(&countId) + return +} + +// 读取全部信息 +func (cont *SystemRole) ContMap(whereMap interface{}, field ...string) (countAry []SystemRole, err error) { + gormDb := global.GVA_DB_System_Permission.Model(&cont) + if len(field) > 0 { + fieldStr := strings.Join(field, ",") + gormDb = gormDb.Select(fieldStr) + } + err = gormDb.Where(whereMap).Find(&countAry).Error + return +} + +// 删除内容 +func (cont *SystemRole) DelCont(whereMap interface{}) (err error) { + err = global.GVA_DB_System_Permission.Where(whereMap).Delete(&cont).Error + return +} diff --git a/model/modelssystempermission/systemrole_empower.go b/model/modelssystempermission/systemrole_empower.go new file mode 100644 index 0000000..3341e30 --- /dev/null +++ b/model/modelssystempermission/systemrole_empower.go @@ -0,0 +1,65 @@ +package modelssystempermission + +import ( + "gin_server_admin/global" + "strings" +) + +// 角色权限 +type SystemroleEmpower struct { + Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` + RoleId int64 `json:"roleid" gorm:"column:role_id;type:bigint(20) unsigned;default:0;not null;comment:行政组织"` + System string `json:"system" gorm:"column:system;type:varchar(255) ;comment:系统"` + PointId string `json:"pointid" gorm:"column:point_id;type:longtext;comment:权限点位"` + Operation string `json:"operation" gorm:"column:operation;type:longtext;comment:操作点位"` + State int `json:"state" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` + Level int `json:"level" gorm:"column:level;type:int(1) unsigned;default:1;not null;comment:授权范围等级(1:本部门;2:本分部;3:所有)"` + Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` + Name string `json:"name" gorm:"column:name;type:varchar(255) ;comment:系统名称"` + Sort int `json:"sort" gorm:"column:sort;type:int(5) unsigned;default:50;not null;comment:排序"` +} + +func (SystemroleEmpower *SystemroleEmpower) TableName() string { + return "systemrole_empower" +} + +// 编辑内容 +func (cont *SystemroleEmpower) EiteCont(whereMap interface{}, saveData interface{}) (err error) { + err = global.GVA_DB_System_Permission.Model(&cont).Where(whereMap).Updates(saveData).Error + return +} + +// 获取内容 +func (cont *SystemroleEmpower) GetCont(whereMap interface{}, field ...string) (err error) { + gormDb := global.GVA_DB_System_Permission.Model(&cont) + if len(field) > 0 { + fieldStr := strings.Join(field, ",") + gormDb = gormDb.Select(fieldStr) + } + gormDb = gormDb.Where(whereMap) + err = gormDb.First(&cont).Error + return +} + +// 根据条件获取总数 +func (cont *SystemroleEmpower) CountCont(whereMap interface{}) (countId int64) { + global.GVA_DB_System_Permission.Model(&cont).Where(whereMap).Count(&countId) + return +} + +// 读取全部信息 +func (cont *SystemroleEmpower) ContMap(whereMap interface{}, field ...string) (countAry []SystemroleEmpower, err error) { + gormDb := global.GVA_DB_System_Permission.Model(&cont) + if len(field) > 0 { + fieldStr := strings.Join(field, ",") + gormDb = gormDb.Select(fieldStr) + } + err = gormDb.Where(whereMap).Find(&countAry).Error + return +} + +// 删除内容 +func (cont *SystemroleEmpower) DelCont(whereMap interface{}) (err error) { + err = global.GVA_DB_System_Permission.Where(whereMap).Delete(&cont).Error + return +}