Browse Source

一个小结

master
超级管理员 3 years ago
parent
commit
2c5f1d4ade
  1. 7
      api/admin/dutyassess/planversio.go
  2. 2
      api/admin/systemuser/systemmenu.go
  3. 13
      api/admin/systemuser/userhandle.go
  4. 21
      api/index/evaluation/assessment.go
  5. 2
      api/index/evaluation/evaluation.go
  6. 23
      api/index/evaluation/examineflow.go
  7. 9
      api/index/evaluation/flowsend.go
  8. 208
      api/index/evaluation/flowsendnew.go
  9. 22
      api/index/evaluation/lookquantita.go
  10. 3
      api/index/evaluation/type.go
  11. 25
      api/index/statistics/newstatistics.go
  12. 18
      api/index/statistics/queryresults.go
  13. 3
      api/index/statistics/tablestatistics.go
  14. 3
      api/reply/qual/divisionrectification.go
  15. 91
      api/reply/quan/ration.go
  16. 2
      api/statistics/quantification/enter.go
  17. 51
      api/statistics/quantification/summary_details.go
  18. 36
      api/v1/custom/customhandle.go
  19. 3
      api/v1/positionkpi/posttarget.go
  20. 12
      api/v1/staff/staffpeople.go
  21. 132
      commonus/publichaneld.go
  22. 59
      commonus/timeSub.go
  23. 12
      config.yaml
  24. 1
      config/config.go
  25. BIN
      gin_server_admin
  26. 2
      global/global.go
  27. 2
      global/model.go
  28. 4
      initialize/gorm.go
  29. 9
      main.go
  30. 9
      middleware/myjwt.go
  31. 1
      model/assessmentmodel/performance_appraisal.go
  32. 62
      model/modelssystempermission/appsystem.go
  33. 65
      model/modelssystempermission/empower.go
  34. 63
      model/modelssystempermission/role_empower.go
  35. 60
      model/modelssystempermission/system_role.go
  36. 65
      model/modelssystempermission/systemrole_empower.go

7
api/admin/dutyassess/planversio.go

@ -11,6 +11,7 @@ import (
"gin_server_admin/global" "gin_server_admin/global"
"gin_server_admin/model/assessmentmodel" "gin_server_admin/model/assessmentmodel"
"gin_server_admin/model/common/response" "gin_server_admin/model/common/response"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -214,7 +215,7 @@ func (d *DutyAssessApi) AddDepartDutyVersio(c *gin.Context) {
evalProsCont.Unit = pva_v.Unit //`json:"unit"` //单位"` evalProsCont.Unit = pva_v.Unit //`json:"unit"` //单位"`
evalProsCont.ReferenceScore = pva_v.ReferenceScore //`json:"referencescore"` //标准分值"` evalProsCont.ReferenceScore = pva_v.ReferenceScore //`json:"referencescore"` //标准分值"`
var zhiBiaoCont assessmentmodel.EvaluationTarget 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 { if evalTarContErr == nil {
evalProsCont.Cycles = zhiBiaoCont.Cycles // `json:"cycle"` //1:班;2:天;3:周;4:月;5:季度;6:年"` evalProsCont.Cycles = zhiBiaoCont.Cycles // `json:"cycle"` //1:班;2:天;3:周;4:月;5:季度;6:年"`
evalProsCont.CycleAttres = zhiBiaoCont.CycleAttres // `json:"cycleattr"` //辅助计数"` 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) commonus.AddWeight(requestData.Group, v.Id, requestData.DepartmentId, tar_v.Id, tar_v.ReferenceScore, 1)
//获取部门关联考核指标项目 //获取部门关联考核指标项目
var assessTarList []assessmentmodel.Assesstarget 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 { if judgeARTErr == nil {
var guoDu []AddPartMentGuodu var guoDu []AddPartMentGuodu
for _, ass_v := range assessTarList { for _, ass_v := range assessTarList {
@ -314,7 +315,7 @@ func (d *DutyAssessApi) AddDepartDutyVersio(c *gin.Context) {
if detailedListErr == nil { if detailedListErr == nil {
for _, det_v := range detailedList { for _, det_v := range detailedList {
var deparmentStr string 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 deErr == nil {
if deparmentStr != "" { if deparmentStr != "" {
guoDuCont.DetailedTarget = det_v.Id guoDuCont.DetailedTarget = det_v.Id

2
api/admin/systemuser/systemmenu.go

@ -1,6 +1,7 @@
package systemuser package systemuser
import ( import (
"fmt"
"sort" "sort"
"strconv" "strconv"
"time" "time"
@ -75,6 +76,7 @@ func MenuOperation(jurisd int, menuId int64) (isTrue bool, operation []systemuse
// 获取左侧菜单栏 // 获取左侧菜单栏
func (s *SysTemMenuApi) GetMenu(c *gin.Context) { func (s *SysTemMenuApi) GetMenu(c *gin.Context) {
fmt.Printf("菜单-------->%v\n", global.Gva_Authority_Authentication_Subsidiary)
var systemMenuList []systemuser.SystemMenu 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 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 { if menuOperErr != nil {

13
api/admin/systemuser/userhandle.go

@ -10,6 +10,7 @@ import (
"gin_server_admin/model/systemuser" "gin_server_admin/model/systemuser"
"gin_server_admin/model/testpage" "gin_server_admin/model/testpage"
"gin_server_admin/model/wechat" "gin_server_admin/model/wechat"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -171,6 +172,18 @@ func GetSysAdminLoginInfo(userName, userPwd string) (isTrue bool, sysAdminInfo a
sysAdminInfo.MenuOper = adminRoleCont.MenuOper sysAdminInfo.MenuOper = adminRoleCont.MenuOper
sysAdminInfo.Wand = adminRoleCont.Wand 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) sysAdminInfo.KeyStr = strconv.FormatInt(userInfo.Key, 10)
isTrue = true isTrue = true
return return

21
api/index/evaluation/assessment.go

@ -9,6 +9,7 @@ import (
"gin_server_admin/global" "gin_server_admin/global"
"gin_server_admin/model/assessmentmodel" "gin_server_admin/model/assessmentmodel"
"gin_server_admin/model/common/response" "gin_server_admin/model/common/response"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -47,6 +48,14 @@ func (e *EvaluationInterface) NewQualitative(c *gin.Context) {
todayVal := time.Now().Unix() todayVal := time.Now().Unix()
yearVal := commonus.ComputingTime(todayVal, 1) yearVal := commonus.ComputingTime(todayVal, 1)
monthVal := commonus.ComputingTime(todayVal, 3) 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 var outContList []NewQualOutList
for _, v := range qualEvaList { for _, v := range qualEvaList {
var outCont NewQualOutList var outCont NewQualOutList
@ -68,7 +77,14 @@ func (e *EvaluationInterface) NewQualitative(c *gin.Context) {
if len(qualId) > 0 { if len(qualId) > 0 {
outCont.ExtraPoints, outCont.ScoreReduction = StatisticsMonthQual(qualId, v.Group, v.Department, yearVal, monthVal) 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 outCont.Dimension = v.Dimension
dimensionCont, _ := commonus.GetDutyClassInfo(v.Dimension) dimensionCont, _ := commonus.GetDutyClassInfo(v.Dimension)
outCont.DimensionName = dimensionCont.Title outCont.DimensionName = dimensionCont.Title
@ -102,7 +118,7 @@ func (e *EvaluationInterface) NewGetQualDetailedTarget(c *gin.Context) {
if requestData.Title != "" { if requestData.Title != "" {
gormDb = gormDb.Where("`dt_title` LIKE ?", "%"+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 { if errList != nil || len(qualEvaList) < 1 {
response.Result(102, isTrue, "您没有要参加的考核项目!", c) response.Result(102, isTrue, "您没有要参加的考核项目!", c)
return return
@ -234,6 +250,7 @@ func (e *EvaluationInterface) QualitativeEvalRationNew(c *gin.Context) {
@dutyDepartment 被考核部门 @dutyDepartment 被考核部门
@years @years
@months @months
(qualId []int64, dutyGroup, dutyDepartment, years, months int64) (addSumScore, scoreReduction float64)
*/ */
func StatisticsMonthQual(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() where := commonus.MapOut()

2
api/index/evaluation/evaluation.go

@ -940,7 +940,7 @@ func (e *EvaluationInterface) QualitativeEvalRation(c *gin.Context) {
if dividend == 0 { if dividend == 0 {
uotCont.Reach = "未设置目标值" uotCont.Reach = "未设置目标值"
} else { } else {
uotCont.Reach = fmt.Sprintf("((实际值-零奖值)/(全奖值-零奖值))*指标权重") uotCont.Reach = fmt.Sprintf("(实际值-零奖值)/(全奖值-零奖值)")
// reachValue := ((divisor / 100) / (float64(dividend) / 100)) * 100 // reachValue := ((divisor / 100) / (float64(dividend) / 100)) * 100
// if reachValue < 0 { // if reachValue < 0 {
// uotCont.Reach = "0%" // uotCont.Reach = "0%"

23
api/index/evaluation/examineflow.go

@ -1,6 +1,8 @@
package evaluation package evaluation
import ( import (
"encoding/json"
"fmt"
"strconv" "strconv"
"gin_server_admin/commonus" "gin_server_admin/commonus"
@ -8,6 +10,7 @@ import (
"gin_server_admin/model/assessmentmodel" "gin_server_admin/model/assessmentmodel"
"gin_server_admin/model/common/response" "gin_server_admin/model/common/response"
"gin_server_admin/model/hrsystem" "gin_server_admin/model/hrsystem"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -58,8 +61,11 @@ func (e *EvaluationInterface) ExamineFlow(c *gin.Context) {
twoFlowInfo.Class = 1 twoFlowInfo.Class = 1
// orgCont, _ := commonus.GetNewOrgCont(map[string]interface{}{"`id`": userCont.Deparment}, "id", "wechat_organization_id") // orgCont, _ := commonus.GetNewOrgCont(map[string]interface{}{"`id`": userCont.Deparment}, "id", "wechat_organization_id")
// sendUserIsTrue, sendUserList := commonus.GetSendMsgUserAry(16182159043990656, orgCont.WechatOrganizationId) // 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) sendUserIsTrue, sendUserList := commonus.GetSendMsgUserAry(16182159043990656, twoDepartId)
// jsonStr, _ := json.Marshal(userCont)
// fmt.Printf("创建流程图----->%v----->%v----->%v\n", string(jsonStr), twoDepartId, sendUserList)
if sendUserIsTrue == true { if sendUserIsTrue == true {
for _, v := range sendUserList { for _, v := range sendUserList {
twoFlowInfo.UserList = append(twoFlowInfo.UserList, GetApproveUser(v)) 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") // 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, threeorgCont.WechatOrganizationId)
sendUserIsTrueThree, sendUserListThree := commonus.GetSendMsgUserAry(16118387069540343, qualEvalInfo.AcceptEvaluation) sendUserIsTrueThree, sendUserListThree := commonus.GetSendMsgUserAry(16118387069540343, qualEvalInfo.AcceptEvaluation)
jsonStr, _ := json.Marshal(qualEvalInfo)
fmt.Printf("创建流程图----->%v----->%v----->%v\n", string(jsonStr), twoDepartId, sendUserList)
if sendUserIsTrueThree == true { if sendUserIsTrueThree == true {
for _, v := range sendUserListThree { 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) 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") // 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, fourorgCont.WechatOrganizationId)
sendUserIsTrueFour, sendUserListFour := commonus.GetSendMsgUserAry(16182159043990656, qualEvalInfo.AcceptEvaluation) sendUserIsTrueFour, sendUserListFour := commonus.GetSendMsgUserAry(16182159043990656, qualEvalInfo.AcceptEvaluation)
fmt.Printf("根据部门获取内勤数据*******3***********>%v------->%v------->%v\n", sendUserIsTrueFour, sendUserListFour, qualEvalInfo.AcceptEvaluation)
if sendUserIsTrueFour == true { if sendUserIsTrueFour == true {
for _, v := range sendUserListFour { for _, v := range sendUserListFour {
fourFlowInfo.UserList = append(fourFlowInfo.UserList, GetApproveUser(v)) 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") // 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, sixorgCont.WechatOrganizationId)
sendUserIsTrueSix, sendUserListSix := commonus.GetSendMsgUserAry(16182159043990656, qualEvalInfo.AcceptEvaluation) sendUserIsTrueSix, sendUserListSix := commonus.GetSendMsgUserAry(16182159043990656, qualEvalInfo.AcceptEvaluation)
fmt.Printf("根据部门获取内勤数据*******2***********>%v------->%v------->%v\n", sendUserIsTrue, sendUserList, qualEvalInfo.AcceptEvaluation)
if sendUserIsTrueSix == true { if sendUserIsTrueSix == true {
for _, v := range sendUserListSix { for _, v := range sendUserListSix {
sixFlowInfo.UserList = append(sixFlowInfo.UserList, GetApproveUser(v)) sixFlowInfo.UserList = append(sixFlowInfo.UserList, GetApproveUser(v))
@ -157,8 +173,9 @@ func (e *EvaluationInterface) ExamineFlow(c *gin.Context) {
// where := commonus.MapOut() // where := commonus.MapOut()
// where["id"] = userCont.Deparment // where["id"] = userCont.Deparment
// orgCont, _ := commonus.GetNewOrgCont(where, "id", "wechat_organization_id") // 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) sendUserIsTrue, sendUserList := commonus.GetSendMsgUserAry(16182159043990656, departId)
fmt.Printf("根据部门获取内勤数据**********1********>%v------->%v------->%v\n", sendUserIsTrue, sendUserList, departId)
if sendUserIsTrue == true { if sendUserIsTrue == true {
for _, v := range sendUserList { for _, v := range sendUserList {
twoFlowInfo.UserList = append(twoFlowInfo.UserList, GetApproveUser(v)) twoFlowInfo.UserList = append(twoFlowInfo.UserList, GetApproveUser(v))

9
api/index/evaluation/flowsend.go

@ -13,6 +13,7 @@ import (
"gin_server_admin/model/assessmentmodel" "gin_server_admin/model/assessmentmodel"
"gin_server_admin/model/common/response" "gin_server_admin/model/common/response"
"gin_server_admin/model/hrsystem" "gin_server_admin/model/hrsystem"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -246,7 +247,7 @@ func (e *EvaluationInterface) PlusOrMinusPoints(c *gin.Context) {
if myIsTrue != 1 { if myIsTrue != 1 {
//写入当前流程步骤 //写入当前流程步骤
// commonus.StepAddData(keyNumber, 0, 3, 1, 1, 2, 1, userCont.Key) //原 // 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) //获取对应部门内勤 sendUserIsTrue, sendUserList := commonus.GetSendMsgUser(16118387069540343, programme.AcceptEvaluation) //获取对应部门内勤
@ -263,7 +264,7 @@ func (e *EvaluationInterface) PlusOrMinusPoints(c *gin.Context) {
} else { } else {
//写入当前流程步骤 //写入当前流程步骤
// commonus.StepAddData(keyNumber, 16182159043990656, 2, 1, 1, 2, 1, userCont.Key) //原 // 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) departmentIdInts, _ := strconv.ParseInt(userCont.Deparment, 10, 64)
@ -293,7 +294,7 @@ func (e *EvaluationInterface) PlusOrMinusPoints(c *gin.Context) {
response.Result(0, outData, "数据写入成功", c) response.Result(0, outData, "数据写入成功", c)
} }
} else { } 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) departmentIdInts, _ := strconv.ParseInt(userCont.Deparment, 10, 64)
@ -735,7 +736,7 @@ func (e *EvaluationInterface) RectificationMeasures(c *gin.Context) {
registerCont.EiteCont(regWhere, saveRegData) registerCont.EiteCont(regWhere, saveRegData)
//写入流程步骤 //写入流程步骤
// commonus.StepAddData(orderidval, 0, 6, 4, 1, 2, 5, userCont.Key) //原 // 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())
/* /*
向本部门负责人发送审批 向本部门负责人发送审批
*/ */

208
api/index/evaluation/flowsendnew.go

@ -120,7 +120,7 @@ func (e *EvaluationInterface) PlusOrMinusPointsNewYuan(c *gin.Context) {
timeOccurrence := commonus.DateToTimeStamp(requestData.Addtime) //发生时间 timeOccurrence := commonus.DateToTimeStamp(requestData.Addtime) //发生时间
addScore.HappenTime = timeOccurrence addScore.HappenTime = timeOccurrence
// addScore.HappenTime = commonus.DateToTimeStamp(requestData.Addtime) //发生时间 // 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 { if departmentIdErr == nil {
addScore.EvaluationDepartment = departmentId //测评部门 addScore.EvaluationDepartment = departmentId //测评部门
} }
@ -181,7 +181,7 @@ func (e *EvaluationInterface) PlusOrMinusPointsNewYuan(c *gin.Context) {
//获取通知人信息 //获取通知人信息
//1、获取发起人部门负责人 //1、获取发起人部门负责人
var officWorkUserList string var officWorkUserList string
founderDepartId, _ := strconv.ParseInt(userCont.Deparment, 10, 64) founderDepartId, _ := strconv.ParseInt(userCont.MainDeparment, 10, 64)
sendUserIsTrue, sendUserList := commonus.GetSendMsgUserAry(16182159043990656, founderDepartId) //获取对应部门负责人 sendUserIsTrue, sendUserList := commonus.GetSendMsgUserAry(16182159043990656, founderDepartId) //获取对应部门负责人
if sendUserIsTrue != true { if sendUserIsTrue != true {
response.Result(0, sendUserList, "未指定相关部门处理人!请确定部门负责人后,重新发起请求!", c) response.Result(0, sendUserList, "未指定相关部门处理人!请确定部门负责人后,重新发起请求!", c)
@ -249,7 +249,7 @@ func (e *EvaluationInterface) PlusOrMinusPointsNewYuan(c *gin.Context) {
quoteAreaTitle = fmt.Sprintf("考核减分:%v\n", scoreFloat64ToStringsss) quoteAreaTitle = fmt.Sprintf("考核减分:%v\n", scoreFloat64ToStringsss)
if myIsTrue != 1 { 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) userKeyInt, _ := strconv.ParseInt(userCont.Key, 10, 64)
commonus.WriteReplyLog(keyNumber, programme.AcceptEvaluation, founderDepartId, userKeyInt, 1, commonus.GetSetpName(1), "") 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) global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.ScoreFlow{}).Where("`sf_key` = ?", keyNumber).Updates(&eiteScoreFlow)
} else { } 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)) jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v&num=%v", keyNumber, strconv.FormatInt(registerNumber, 10))
jumpUrlTitle := "请前往处理" jumpUrlTitle := "请前往处理"
sourceDesc := "审核" sourceDesc := "审核"
@ -306,7 +306,7 @@ func (e *EvaluationInterface) PlusOrMinusPointsNewYuan(c *gin.Context) {
} else { } else {
//加分 //加分
quoteAreaTitle = fmt.Sprintf("考核加分:%v\n", scoreFloat64ToStringsss) 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)) jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v&num=%v", keyNumber, strconv.FormatInt(registerNumber, 10))
jumpUrlTitle := "请前往处理" jumpUrlTitle := "请前往处理"
sourceDesc := "审核" sourceDesc := "审核"
@ -420,7 +420,7 @@ func (e *EvaluationInterface) PlusOrMinusPointsNew(c *gin.Context) {
addScore.PlanVersion = requestData.PlanVersionNumber addScore.PlanVersion = requestData.PlanVersionNumber
//分值转化 //分值转化
scoreStringToInt64 := commonus.GetDuyCycle(requestData.Score, 100) scoreStringToInt64 := commonus.GetDuyCycle(requestData.Score, 100)
fmt.Printf("分值转化----------->%v------------->%v\n", requestData.Score, scoreStringToInt64)
addScore.Score = scoreStringToInt64 //分值(乘100录入) addScore.Score = scoreStringToInt64 //分值(乘100录入)
addScore.Key = keyNumber //识别标志 addScore.Key = keyNumber //识别标志
addScore.Reason = requestData.Reason //操作原因 addScore.Reason = requestData.Reason //操作原因
@ -435,7 +435,7 @@ func (e *EvaluationInterface) PlusOrMinusPointsNew(c *gin.Context) {
} }
addScore.HappenTime = timeOccurrence addScore.HappenTime = timeOccurrence
// addScore.HappenTime = commonus.DateToTimeStamp(requestData.Addtime) //发生时间 // 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 { if departmentIdErr == nil {
addScore.EvaluationDepartment = departmentId //测评部门 addScore.EvaluationDepartment = departmentId //测评部门
} }
@ -490,7 +490,7 @@ func (e *EvaluationInterface) PlusOrMinusPointsNew(c *gin.Context) {
registerCont.Time = time.Now().Unix() registerCont.Time = time.Now().Unix()
registerCont.AddCont() 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)) // jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v&num=%v", keyNumber, strconv.FormatInt(registerNumber, 10))
// jumpUrlTitle := "请前往处理" // jumpUrlTitle := "请前往处理"
@ -498,76 +498,76 @@ func (e *EvaluationInterface) PlusOrMinusPointsNew(c *gin.Context) {
//获取通知人信息 //获取通知人信息
//1、获取发起人部门负责人 //1、获取发起人部门负责人
// var officWorkUserList string var officWorkUserList string
founderDepartId, _ := strconv.ParseInt(userCont.Deparment, 10, 64) founderDepartId, _ := strconv.ParseInt(userCont.MainDeparment, 10, 64)
// sendUserIsTrue, sendUserList := commonus.GetSendMsgUserAry(16182159043990656, founderDepartId) //获取对应部门负责人 sendUserIsTrue, sendUserList := commonus.GetSendMsgUserAry(16182159043990656, founderDepartId) //获取对应部门负责人
// if sendUserIsTrue != true { if sendUserIsTrue != true {
// response.Result(0, sendUserList, "未指定相关部门处理人!请确定部门负责人后,重新发起请求!", c) response.Result(0, sendUserList, "未指定相关部门处理人!请确定部门负责人后,重新发起请求!", c)
// return return
// } }
// for _, v := range sendUserList { for _, v := range sendUserList {
// if v == userCont.Wechat { if v == userCont.Wechat {
// myIsTrue = 2 myIsTrue = 2
// } }
// } }
// fmt.Printf("userCont.Wechat====>%v------------>myIsTrue:%v------------>sendUserList:%v\n", userCont.Wechat, myIsTrue, sendUserList) // fmt.Printf("userCont.Wechat====>%v------------>myIsTrue:%v------------>sendUserList:%v\n", userCont.Wechat, myIsTrue, sendUserList)
// officWorkUserList = strings.Join(sendUserList, "|") officWorkUserList = strings.Join(sendUserList, "|")
// //确定标题 //确定标题
// var title string = "" var title string = ""
// //一级标题副本内容 //一级标题副本内容
// var desc string = "" var desc string = ""
// detailedTargetCont, detailedTargetErr := commonus.GetDetailedTargetInfo(programme.DetailedTarget) //获取指标细则 detailedTargetCont, detailedTargetErr := commonus.GetDetailedTargetInfo(programme.DetailedTarget) //获取指标细则
// if detailedTargetErr == true { if detailedTargetErr == true {
// tarInf, tarErr := commonus.GetTargetInfo(detailedTargetCont.ParentId) //获取指标信息 tarInf, tarErr := commonus.GetTargetInfo(detailedTargetCont.ParentId) //获取指标信息
// if tarErr == true { if tarErr == true {
// title = tarInf.Title //一级标题,建议不超过36个字 title = tarInf.Title //一级标题,建议不超过36个字
// desc = detailedTargetCont.Title //一级标题辅助信息,建议不超过44个字 desc = detailedTargetCont.Title //一级标题辅助信息,建议不超过44个字
// } else { } else {
// title = detailedTargetCont.Title //一级标题,建议不超过36个字 title = detailedTargetCont.Title //一级标题,建议不超过36个字
// } }
// } else { } else {
// tarInf, tarErr := commonus.GetTargetInfo(programme.Target) //获取指标信息 tarInf, tarErr := commonus.GetTargetInfo(programme.Target) //获取指标信息
// if tarErr == true { if tarErr == true {
// title = tarInf.Title //一级标题,建议不超过36个字 title = tarInf.Title //一级标题,建议不超过36个字
// } else { } else {
// title = strconv.FormatInt(programme.DetailedTarget, 10) //一级标题,建议不超过36个字 title = strconv.FormatInt(programme.DetailedTarget, 10) //一级标题,建议不超过36个字
// } }
// } }
// //执行原因 //执行原因
// reason := fmt.Sprintf("原因:%v\n", requestData.Reason) reason := fmt.Sprintf("原因:%v\n", requestData.Reason)
// twoLevelKeyName := "" twoLevelKeyName := ""
// execDerpat, execDerpatErr := commonus.GetNewOrgCont(departmentId) execDerpat, execDerpatErr := commonus.GetNewOrgCont(departmentId)
// if execDerpatErr == nil { if execDerpatErr == nil {
// twoLevelKeyName = execDerpat.Name twoLevelKeyName = execDerpat.Name
// } }
// var twoLevelKeyValue string = "" var twoLevelKeyValue string = ""
// var twoLevelUserId string = "" var twoLevelUserId string = ""
// //获取操作人 //获取操作人
// if userCont.Wechat != "" { if userCont.Wechat != "" {
// userWechatErr, userWechat := commonus.GetUesrContForWechatID(userCont.Wechat) userWechatErr, userWechat := commonus.GetUesrContForWechatID(userCont.Wechat)
// if userWechatErr == true { if userWechatErr == true {
// twoLevelKeyValue = userWechat.Name twoLevelKeyValue = userWechat.Name
// twoLevelUserId = userCont.Wechat twoLevelUserId = userCont.Wechat
// } }
// } }
// twoLevelTitle := "考核上报部门:" twoLevelTitle := "考核上报部门:"
//分数 //分数
// sendScore := scoreStringToInt64 * int64(countFrequency) sendScore := scoreStringToInt64 * int64(countFrequency)
// sendScVal := float64(sendScore) / 100 sendScVal := float64(sendScore) / 100
// scoreFloat64ToStringsss := strconv.FormatFloat(sendScVal, 'f', -1, 64) scoreFloat64ToStringsss := strconv.FormatFloat(sendScVal, 'f', -1, 64)
outMap := commonus.MapOut() outMap := commonus.MapOut()
// var quoteAreaTitle string //引用文献标题 var quoteAreaTitle string //引用文献标题
if requestData.Type != 1 { if requestData.Type != 1 {
//减分 //减分
// quoteAreaTitle = fmt.Sprintf("考核减分:%v\n", scoreFloat64ToStringsss) quoteAreaTitle = fmt.Sprintf("考核减分:%v\n", scoreFloat64ToStringsss)
if myIsTrue != 1 { 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) userKeyInt, _ := strconv.ParseInt(userCont.Key, 10, 64)
commonus.WriteReplyLog(keyNumber, programme.AcceptEvaluation, founderDepartId, userKeyInt, 1, commonus.GetSetpName(1), "") 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), "同意") commonus.WriteReplyLog(keyNumber, programme.AcceptEvaluation, founderDepartId, userKeyInt, 1, commonus.GetSetpName(2), "同意")
// sendUserIsTrue, sendUserList := commonus.GetSendMsgUser(16118387069540343, programme.AcceptEvaluation) //获取对应部门内勤 sendUserIsTrue, sendUserList := commonus.GetSendMsgUser(16118387069540343, programme.AcceptEvaluation) //获取对应部门内勤
// if sendUserIsTrue != true { if sendUserIsTrue != true {
// response.Result(0, sendUserList, "未指定相关部门处理人!未能向相关人员发送考核项目!请手动发起!", c) response.Result(0, sendUserList, "未指定相关部门处理人!未能向相关人员发送考核项目!请手动发起!", c)
// return return
// } }
// jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?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 := "请前往处理" jumpUrlTitle := "请前往处理"
// sourceDesc := "责任划分" sourceDesc := "责任划分"
// var sendTextMsg sendmessage.TextNoticeTemplateMedium 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) 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["callbakcMsg"] = string(callbakcMsg)
// outMap["isTrueCall"] = isTrueCall outMap["isTrueCall"] = isTrueCall
// outMap["callBackCont"] = callBackCont outMap["callBackCont"] = callBackCont
// outMap["setval"] = 1 outMap["setval"] = 1
//修改定性审批流状态 //修改定性审批流状态
eiteScoreFlow := commonus.MapOut() 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) global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.EvaluationProcess{}).Where("`ep_order_key` = ?", keyNumber).Updates(&evalProcSaveData)
} else { } 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)) jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v&num=%v", keyNumber, strconv.FormatInt(registerNumber, 10))
// jumpUrlTitle := "请前往处理" jumpUrlTitle := "请前往处理"
// sourceDesc := "审核" sourceDesc := "审核"
// var sendTextMsg sendmessage.TextNoticeTemplateMedium 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) 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["callbakcMsg"] = string(callbakcMsg)
// outMap["isTrueCall"] = isTrueCall outMap["isTrueCall"] = isTrueCall
// outMap["callBackCont"] = callBackCont outMap["callBackCont"] = callBackCont
// outMap["setval"] = 2 outMap["setval"] = 2
userKeyInt, _ := strconv.ParseInt(userCont.Key, 10, 64) userKeyInt, _ := strconv.ParseInt(userCont.Key, 10, 64)
commonus.WriteReplyLog(keyNumber, programme.AcceptEvaluation, founderDepartId, userKeyInt, 1, commonus.GetSetpName(1), "") commonus.WriteReplyLog(keyNumber, programme.AcceptEvaluation, founderDepartId, userKeyInt, 1, commonus.GetSetpName(1), "")
@ -627,17 +627,17 @@ func (e *EvaluationInterface) PlusOrMinusPointsNew(c *gin.Context) {
} }
} else { } else {
//加分 //加分
// quoteAreaTitle = fmt.Sprintf("考核加分:%v\n", scoreFloat64ToStringsss) 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)) jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v&num=%v", keyNumber, strconv.FormatInt(registerNumber, 10))
// jumpUrlTitle := "请前往处理" jumpUrlTitle := "请前往处理"
// sourceDesc := "审核" sourceDesc := "审核"
// var sendTextMsg sendmessage.TextNoticeTemplateMedium 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) 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["callbakcMsg"] = string(callbakcMsg)
// outMap["isTrueCall"] = isTrueCall outMap["isTrueCall"] = isTrueCall
// outMap["callBackCont"] = callBackCont outMap["callBackCont"] = callBackCont
// outMap["setval"] = 3 outMap["setval"] = 3
userKeyInt, _ := strconv.ParseInt(userCont.Key, 10, 64) userKeyInt, _ := strconv.ParseInt(userCont.Key, 10, 64)
commonus.WriteReplyLog(keyNumber, programme.AcceptEvaluation, founderDepartId, userKeyInt, 1, commonus.GetSetpName(1), "") commonus.WriteReplyLog(keyNumber, programme.AcceptEvaluation, founderDepartId, userKeyInt, 1, commonus.GetSetpName(1), "")

22
api/index/evaluation/lookquantita.go

@ -414,7 +414,8 @@ func (e *EvaluationInterface) SeeFlowLog(c *gin.Context) {
} }
if requestData.Department != "" { if requestData.Department != "" {
// gormDb = gormDb.Where("sf_depart = ? OR fl_depart = ?", requestData.Department, 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:超级管 //是否为管理员(1:不是;2:分公司;3:集团管理员;4:超级管
@ -445,7 +446,24 @@ func (e *EvaluationInterface) SeeFlowLog(c *gin.Context) {
} }
if requestData.Time != "" { if requestData.Time != "" {
startTime, endTime := commonus.GetAppointMonthStarAndEndTime(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 { if requestData.Class != 0 {

3
api/index/evaluation/type.go

@ -281,6 +281,8 @@ type FlowLogType struct {
Time string `json:"time"` //时间 Time string `json:"time"` //时间
IsSet int `json:"isset"` //未处理 1:已审核;2:未审核 IsSet int `json:"isset"` //未处理 1:已审核;2:未审核
Class int `json:"class"` //0:全部;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"` //集团 Group string `json:"group"` //集团
Department string `json:"department"` //部门 Department string `json:"department"` //部门
Title string `json:"tittle"` //指标名称 Title string `json:"tittle"` //指标名称
Time string `json:"time"` //时间
} }
// 新型定性考核列表输出 // 新型定性考核列表输出

25
api/index/statistics/newstatistics.go

@ -11,6 +11,7 @@ import (
"gin_server_admin/model/assessmentmodel" "gin_server_admin/model/assessmentmodel"
"gin_server_admin/model/common/response" "gin_server_admin/model/common/response"
"gin_server_admin/model/hrsystem" "gin_server_admin/model/hrsystem"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"gorm.io/gorm" "gorm.io/gorm"
) )
@ -62,22 +63,27 @@ func (t *tablePlanVersionStic) conditionStatisticsNew(group, department, dimensi
var atScore float64 = 0 var atScore float64 = 0
var lastEvalId int64 var lastEvalId int64
// var scoreSum float64 = 0 // var scoreSum float64 = 0
shouDongJiFen := 2
var shouDongFenzhi float64 = 0 var shouDongFenzhi float64 = 0
var zhidongDongLiang float64 = 0 var zhidongDongLiang float64 = 0
// var realScore float64 = 0 // var realScore float64 = 0
if len(fldList) > 0 { if len(fldList) > 0 {
for _, v := range fldList { for _, v := range fldList {
fmt.Printf("Key----------------->%v\n", v.Key) // fmt.Printf("Key----------------->%v\n", v.Key)
if v.Key != 0 { if v.Key != 0 {
lastEvalId = v.Key lastEvalId = v.Key
} }
// atScore = atScore + float64(v.Score)
zhidongDongLiang = zhidongDongLiang + float64(v.Score)
if v.ScoringMethod == 1 { if v.ScoringMethod == 1 {
atScore = atScore + float64(v.Score) atScore = atScore + float64(v.Score)
zhidongDongLiang = zhidongDongLiang + float64(v.Score) // zhidongDongLiang = zhidongDongLiang + float64(v.Score)
} else { } else {
atScore = atScore + float64(v.ScoringScore) atScore = atScore + float64(v.ScoringScore)
shouDongFenzhi = shouDongFenzhi + float64(v.ScoringScore) shouDongFenzhi = shouDongFenzhi + float64(v.ScoringScore)
shouDongJiFen = 1
} }
// scoreSum = scoreSum + atScore // scoreSum = scoreSum + atScore
// scoreSum = scoreSum + float64(v.Score) // scoreSum = scoreSum + float64(v.Score)
@ -92,7 +98,7 @@ func (t *tablePlanVersionStic) conditionStatisticsNew(group, department, dimensi
} }
} }
fmt.Printf("atScore--->%v\n", atScore) fmt.Printf("atScore--->%v\n", atScore)
tableScoreCont.ScoreVal = commonus.Decimal(atScore / 100) tableScoreCont.ScoreVal = commonus.Decimal(zhidongDongLiang / 100)
targetIdInt, _ := strconv.ParseInt(targetId, 10, 64) targetIdInt, _ := strconv.ParseInt(targetId, 10, 64)
groupId, _ := strconv.ParseInt(group, 10, 64) groupId, _ := strconv.ParseInt(group, 10, 64)
departmentId, _ := strconv.ParseInt(department, 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) // 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) // 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 { if status == 3 {
tableScoreCont.ActualScore = float64(referenceScore) 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) // tableScoreCont.ActualScore = commonus.Decimal(mtScore / 100)
t.TableScore = append(t.TableScore, tableScoreCont) t.TableScore = append(t.TableScore, tableScoreCont)
syncProcessDepartTarget.Done() syncProcessDepartTarget.Done()

18
api/index/statistics/queryresults.go

@ -12,6 +12,7 @@ import (
"gin_server_admin/model/assessmentmodel" "gin_server_admin/model/assessmentmodel"
"gin_server_admin/model/common/response" "gin_server_admin/model/common/response"
"gin_server_admin/model/hrsystem" "gin_server_admin/model/hrsystem"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -87,6 +88,7 @@ func (a *ApiGroup) Queryresults(c *gin.Context) {
if len(monthTody) < 1 { if len(monthTody) < 1 {
monthTody = append(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.J = append(orgFen.J, readv.J)
orgFen.K = append(orgFen.K, readv.K) orgFen.K = append(orgFen.K, readv.K)
orgFen.L = append(orgFen.L, readv.L) 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) echarsList.YLine = append(echarsList.YLine, cyLineAry_1)
// echarsListOrg.YLine = append(echarsListOrg.YLine, cyLineAry_2) // echarsListOrg.YLine = append(echarsListOrg.YLine, cyLineAry_2)
} }
// jsonStrwww, _ := json.Marshal(orgFen)
// fmt.Printf("orgFen---------->%v\n", string(jsonStrwww))
if jiBuQi > 0 { if jiBuQi > 0 {
var pingJunFen TranscriptTableDateList var pingJunFen TranscriptTableDateList
pingJunFen.DepartmentId = "0" pingJunFen.DepartmentId = "0"
@ -300,6 +304,8 @@ func (a *ApiGroup) Queryresults(c *gin.Context) {
} else { } else {
monthInt = requestData.Month monthInt = requestData.Month
} }
// fmt.Printf("monthInt---------->%v\n", monthInt)
for _, mvv := range monthInt { for _, mvv := range monthInt {
switch mvv { switch mvv {
case 1: case 1:
@ -350,7 +356,7 @@ func (a *ApiGroup) Queryresults(c *gin.Context) {
case 10: case 10:
var cyLineAry_2 YlineData var cyLineAry_2 YlineData
cyLineAry_2.Name = "10月" cyLineAry_2.Name = "10月"
cyLineAry_2.Data = orgFen.G cyLineAry_2.Data = orgFen.J
echarsListOrg.YLine = append(echarsListOrg.YLine, cyLineAry_2) echarsListOrg.YLine = append(echarsListOrg.YLine, cyLineAry_2)
case 11: case 11:
var cyLineAry_2 YlineData 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) t.ScoreStatistics = append(t.ScoreStatistics, pingJunFen)
} }
} }
@ -547,6 +553,7 @@ func (c *countEveryDepartmentMonthScore) everyMonthCalculate(groupId, orgId, yea
for _, sv := range v.Child { //指标 for _, sv := range v.Child { //指标
zhiBiaoScore = zhiBiaoScore + float64(sv.ReferenceScore) zhiBiaoScore = zhiBiaoScore + float64(sv.ReferenceScore)
if sv.Status == 3 { 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) sumScore = sumScore + float64(sv.ReferenceScore)
} else { } else {
if sv.Status == 1 && sv.Status != 3 { //判断指标是否启用并且不是观察指标 if sv.Status == 1 && sv.Status != 3 { //判断指标是否启用并且不是观察指标
@ -558,10 +565,12 @@ func (c *countEveryDepartmentMonthScore) everyMonthCalculate(groupId, orgId, yea
if targetInfo.Type == 1 { //定性考核 if targetInfo.Type == 1 { //定性考核
countScore, _ := quantification.DingXingMonthSum(groupId, orgId, sv.ReferenceScore, year, month, sv.Id, sv.Cycles, sv.Status) countScore, _ := quantification.DingXingMonthSum(groupId, orgId, sv.ReferenceScore, year, month, sv.Id, sv.Cycles, sv.Status)
sumScore = sumScore + countScore sumScore = sumScore + countScore
// fmt.Printf("sv.Id-------->%v------------》sv.Name----%v--------------countScore-------->%v\n", sv.Id, sv.Name, countScore)
} else { //定量考核 } else { //定量考核
countScores, _ := quantification.DingLiangMonthSum(groupId, orgId, sv.ReferenceScore, year, month, sv.Id, sv.Cycles, sv.Status) countScores, _ := quantification.DingLiangMonthSum(groupId, orgId, sv.ReferenceScore, year, month, sv.Id, sv.Cycles, sv.Status)
sumScore = sumScore + countScores sumScore = sumScore + countScores
// fmt.Printf("sv.Id-------->%v------------》sv.Name----%v------------countScores---------->%v\n", sv.Id, sv.Name, countScores)
} }
// switch sv.Cycles { // switch sv.Cycles {
// case 5: //季度统计 // case 5: //季度统计
@ -579,6 +588,7 @@ func (c *countEveryDepartmentMonthScore) everyMonthCalculate(groupId, orgId, yea
// } // }
} }
} }
} }
} }
var everyMonthScoreInfo everyDepartmentScore var everyMonthScoreInfo everyDepartmentScore

3
api/index/statistics/tablestatistics.go

@ -12,6 +12,7 @@ import (
"gin_server_admin/global" "gin_server_admin/global"
"gin_server_admin/model/assessmentmodel" "gin_server_admin/model/assessmentmodel"
"gin_server_admin/model/common/response" "gin_server_admin/model/common/response"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -889,7 +890,7 @@ func (d *dataLockStatistics) planVersiconProcessV1(pvInfo assessmentmodel.PlanVe
//进行维度操作 //进行维度操作
for _, pv := range planInfo { for _, pv := range planInfo {
for _, pcv := range pv.Child { //指标列表 for _, pcv := range pv.Child { //指标列表
// if pcv.Id == "4" { // if pcv.Id == "6" {
fmt.Printf("pcv.Id------------------->%v\n", pcv.Id) fmt.Printf("pcv.Id------------------->%v\n", pcv.Id)
if pcv.Status != 2 { //忽略掉禁用的指标 if pcv.Status != 2 { //忽略掉禁用的指标
var outCont TargetContOutCont var outCont TargetContOutCont

3
api/reply/qual/divisionrectification.go

@ -13,6 +13,7 @@ import (
"gin_server_admin/model/assessmentmodel" "gin_server_admin/model/assessmentmodel"
"gin_server_admin/model/common/response" "gin_server_admin/model/common/response"
"gin_server_admin/model/hrsystem" "gin_server_admin/model/hrsystem"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -465,7 +466,7 @@ func (a *ApiGroup) AmendMeasures(c *gin.Context) {
} }
opinionCont := fmt.Sprintf("整改措施:%v", requestData.Content) 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) //写入审批流 commonus.WriteReplyLog(orderidval, scoreFlowInfo.DutyDepartment, scoreFlowInfo.EvaluationDepartment, scoreFlowInfo.EvaluationUser, 1, commonus.GetSetpName(3), opinionCont) //写入审批流
sendUserIsTrue, sendUserList := commonus.GetSendMsgUser(16182159043990656, scoreFlowInfo.DutyDepartment) //获取对应部门负责人 sendUserIsTrue, sendUserList := commonus.GetSendMsgUser(16182159043990656, scoreFlowInfo.DutyDepartment) //获取对应部门负责人

91
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) // fmt.Printf("lastMonth-->%v-->lastMonthInt, -->%v-->lastMonthErr,-->%v--> operationTime-->%v-->flowLog----->%v\n", lastMonth, lastMonthInt, lastMonthErr, operationTime, flowLog)
// return // return
operationTime = timeOccurrence
} else { } else {
lastMonth, _, _ := commonus.GetLastMonth() lastMonth, _, _ := commonus.GetLastMonth()
@ -631,48 +631,49 @@ func (a *ApiGroup) SendRationFlow(c *gin.Context) {
if affairDbErr == nil { if affairDbErr == nil {
commonus.StepAddData(keyNumber, 16182159043990656, 2, 7, 2, 2, 1, userCont.Key) commonus.StepAddData(keyNumber, 16182159043990656, 2, 7, 2, 2, 1, userCont.Key)
commonus.WriteReplyLog(keyNumber, departIdInt, departmentId, userKey, 1, commonus.GetSetpName(1), "提交申请") commonus.WriteReplyLog(keyNumber, departIdInt, departmentId, userKey, 1, commonus.GetSetpName(1), "提交申请")
sendUserIsTrue, sendUserList := commonus.GetSendMsgUser(16182159043990656, departmentId) //获取对应部门负责人
// sendUserIsTrue, sendUserList := commonus.GetSendMsgUser(16182159043990656, departIdInt) //获取对应部门负责人 // sendUserIsTrue, sendUserList := commonus.GetSendMsgUser(16182159043990656, departIdInt) //获取对应部门负责人
// if sendUserIsTrue != true { if sendUserIsTrue != true {
// response.Result(0, sendUserList, "未指定相关部门处理人!未能向相关人员发送考核项目!请手动发起!", c) response.Result(0, sendUserList, "未指定相关部门处理人!未能向相关人员发送考核项目!请手动发起!", c)
// return return
// } }
// title := fmt.Sprintf("%v数据表", commonus.TimeStampToDate(operationTime, 10)) title := fmt.Sprintf("%v数据表", commonus.TimeStampToDate(operationTime, 10))
// desc := "" desc := ""
// mainTitleDesc := "数据详情:" mainTitleDesc := "数据详情:"
// //将步骤写入 判断该步骤是否已经操作 //将步骤写入 判断该步骤是否已经操作
// registerNumber := commonus.GetFileNumberEs() registerNumber := commonus.GetFileNumberEs()
// var registerContIng assessmentmodel.Register var registerContIng assessmentmodel.Register
// registerContIng.Number = registerNumber registerContIng.Number = registerNumber
// registerContIng.State = 1 registerContIng.State = 1
// registerContIng.Time = time.Now().Unix() registerContIng.Time = time.Now().Unix()
// registerContIng.AddCont() registerContIng.AddCont()
//审批卡片跳转链接 //审批卡片跳转链接
// cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/quantitativeList?id=%v&num=%v", keyNumber, strconv.FormatInt(registerNumber, 10)) 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)) jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/quantitativeList?id=%v&num=%v", keyNumber, strconv.FormatInt(registerNumber, 10))
// jumpUrlTitle := "请前往处理" jumpUrlTitle := "请前往处理"
// sourceDesc := "审批" sourceDesc := "审批"
// twoLevelTitle := "审批信息:" twoLevelTitle := "审批信息:"
// twoLevelKeyName := "" twoLevelKeyName := ""
// execDerpat, execDerpatErr := commonus.GetNewOrgCont(departmentId) execDerpat, execDerpatErr := commonus.GetNewOrgCont(map[string]interface{}{"`id`": departmentId})
// if execDerpatErr == nil { if execDerpatErr == nil {
// twoLevelKeyName = execDerpat.Name twoLevelKeyName = execDerpat.Name
// } }
// var twoLevelKeyValue string = "" var twoLevelKeyValue string = ""
// var twoLevelUserId string = "" var twoLevelUserId string = ""
// //获取操作人 //获取操作人
// if userCont.Wechat != "" { if userCont.Wechat != "" {
// userWechatErr, userWechat := commonus.GetUesrContForWechatID(userCont.Wechat) userWechatErr, userWechat := commonus.GetUesrContForWechatID(userCont.Wechat)
// if userWechatErr == true { if userWechatErr == true {
// twoLevelKeyValue = userWechat.Name twoLevelKeyValue = userWechat.Name
// twoLevelUserId = userCont.Wechat twoLevelUserId = userCont.Wechat
// } }
// } }
// var sendTextMsg sendmessage.TextNoticeTemplateMedium 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) 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) /*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) global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.ScoreFlow{}).Where("`sf_key` = ?", keyNumber).Updates(&eiteScoreFlow)
evalProcSaveData := commonus.MapOut() evalProcSaveData := commonus.MapOut()
evalProcSaveData["ep_state"] = 2 evalProcSaveData["ep_state"] = 2
evalProcSaveData["ep_happen_time"] = operationTime
evalProcSaveData["ep_time"] = time.Now().Unix() evalProcSaveData["ep_time"] = time.Now().Unix()
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.EvaluationProcess{}).Where("`ep_order_key` = ?", keyNumber).Updates(&evalProcSaveData) global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.EvaluationProcess{}).Where("`ep_order_key` = ?", keyNumber).Updates(&evalProcSaveData)
outMap := commonus.MapOut() outMap := commonus.MapOut()
// outMap["callbakcMsg"] = string(callbakcMsg) outMap["callbakcMsg"] = string(callbakcMsg)
// outMap["isTrueCall"] = isTrueCall outMap["isTrueCall"] = isTrueCall
// outMap["callBackCont"] = callBackCont outMap["callBackCont"] = callBackCont
outMap["setval"] = 1 outMap["setval"] = 1
outMap["sendUserList"] = sendUserList
response.Result(0, outMap, "数据提交成功!", c) response.Result(0, outMap, "数据提交成功!", c)
} else { } else {

2
api/statistics/quantification/enter.go

@ -6,6 +6,7 @@ import (
"gin_server_admin/commonus" "gin_server_admin/commonus"
"gin_server_admin/model/common/response" "gin_server_admin/model/common/response"
"gin_server_admin/model/hrsystem" "gin_server_admin/model/hrsystem"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -195,6 +196,7 @@ type dingLiangKaoHe struct {
Score float64 `json:"score"` //得分 Score float64 `json:"score"` //得分
MtOrAt int `json:"mtorat"` //手动还是自动 MtOrAt int `json:"mtorat"` //手动还是自动
Cont string `json:"count"` //说明 Cont string `json:"count"` //说明
Nature int `json:"nature"` //性质
} }
// 定性记录列表 // 定性记录列表

51
api/statistics/quantification/summary_details.go

@ -12,6 +12,7 @@ import (
"gin_server_admin/model/assessmentmodel" "gin_server_admin/model/assessmentmodel"
"gin_server_admin/model/common/response" "gin_server_admin/model/common/response"
"gin_server_admin/model/hrsystem" "gin_server_admin/model/hrsystem"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -206,8 +207,13 @@ func DingLiangMonthSum(groupId, departmentId, weight, year, month int64, targetI
if statues > 0 { if statues > 0 {
status = statues status = statues
} }
if v.TargetId == 12 {
fmt.Printf("Jiba------2------>%v\n", statues)
}
if status != 3 { if status != 3 {
if v.TargetId == 12 {
fmt.Printf("Jiba------3------>%v\n", v.ScoringMethod)
}
if v.ScoringMethod == 1 { if v.ScoringMethod == 1 {
sumScore = sumScore + float64(v.Score) sumScore = sumScore + float64(v.Score)
sumScoreGet, _, _, _, _ := analysisReward(targetId, v.Baseline, targetScore, 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 sumScoreEs = sumScoreEs + sumScoreGet
fmt.Printf("sumScoreEs--1--->%v\n", v.Score) fmt.Printf("sumScoreEs--1--->%v\n", v.Score)
} else { } 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)) // sumScoreGet, _, _, _, _ := analysisReward(targetId, v.Baseline, float64(weight), float64(v.ScoringScore))
// sumScoreEs = sumScoreEs + sumScoreGet // sumScoreEs = sumScoreEs + sumScoreGet
fmt.Printf("sumScoreEs--2--->%v\n", sumScoreEs) fmt.Printf("sumScoreEs--2--->%v\n", sumScoreEs)
@ -234,7 +252,9 @@ func DingLiangMonthSum(groupId, departmentId, weight, year, month int64, targetI
} else { } else {
sumScoreEs = sumScoreEs + targetScore sumScoreEs = sumScoreEs + targetScore
} }
if v.TargetId == 12 {
fmt.Printf("Jiba------1------>%v\n", sumScoreEs)
}
var extraDepartment hrsystem.AdministrativeOrganization var extraDepartment hrsystem.AdministrativeOrganization
minErr := extraDepartment.GetCont(map[string]interface{}{"id": v.EvaluationDepartment}, "name") minErr := extraDepartment.GetCont(map[string]interface{}{"id": v.EvaluationDepartment}, "name")
// fmt.Printf("extraDepartment.Name-3---->%v\n", extraDepartment.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) settlementScore = float64(v.Score)
listCont.Score, listCont.Allprize, listCont.Zeroprize, listCont.Capping, listCont.CompletionRate = analysisReward(strconv.FormatInt(v.TargetId, 10), v.Baseline, targetScore, settlementScore) listCont.Score, listCont.Allprize, listCont.Zeroprize, listCont.Capping, listCont.CompletionRate = analysisReward(strconv.FormatInt(v.TargetId, 10), v.Baseline, targetScore, settlementScore)
} else { } 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) // settlementScore = float64(v.ScoringScore)
_, listCont.Allprize, listCont.Zeroprize, listCont.Capping, listCont.CompletionRate = analysisReward(strconv.FormatInt(v.TargetId, 10), v.Baseline, targetScore, settlementScore) _, 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.MtOrAt = v.ScoringMethod
listCont.Cont = v.Content listCont.Cont = v.Content
//获取定量流水全奖、零奖、封顶值 listCont.Nature = status
/*
@targetId 指标ID
@rewardCont 全奖零奖封顶值设置
@targetScore 指标分值
@settlementScore 计算分值
返回说明
@scoreVal 计算得分
@allPrize 全奖值
@zeroPrize 零奖值
@CappingVal 封顶值
@achievement 达成率
*/
// func analysisReward(targetId, rewardCont string, targetScore, settlementScore float64) (scoreVal, allPrize, zeroPrize, CappingVal, achievement float64)
if status == 3 { if status == 3 {
listCont.Score = targetScore listCont.Score = targetScore
} }
switch cycle { switch cycle {
case 5: case 5:
if commonus.IsInTrue[int](requestData.Months, []int{3, 6, 9, 12}) == false { if commonus.IsInTrue[int](requestData.Months, []int{3, 6, 9, 12}) == false {
@ -478,6 +486,9 @@ func (a *ApiGroup) SummaryDetailsLiangLog(c *gin.Context) {
} }
default: default:
} }
// if v.TargetId == 12 {
// fmt.Printf("Jiba------------>%v\n", listCont)
// }
listCont.Allprize = commonus.Decimal(listCont.Allprize) listCont.Allprize = commonus.Decimal(listCont.Allprize)
listCont.Zeroprize = commonus.Decimal(listCont.Zeroprize) listCont.Zeroprize = commonus.Decimal(listCont.Zeroprize)
listCont.Capping = commonus.Decimal(listCont.Capping) listCont.Capping = commonus.Decimal(listCont.Capping)

36
api/v1/custom/customhandle.go

@ -4,6 +4,7 @@ import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"strconv" "strconv"
"strings"
"gin_server_admin/api/admin/systemuser" "gin_server_admin/api/admin/systemuser"
"gin_server_admin/api/v1/staff" "gin_server_admin/api/v1/staff"
@ -189,8 +190,9 @@ func (cu *CustomHandle) SystemLogin(c *gin.Context) {
global.Gva_Authority_Authentication = surisdictionInt global.Gva_Authority_Authentication = surisdictionInt
var menuOperStr []string var menuOperStr []string
var menuOperInts []int64 var menuOperInts []int64
jsonErrSun := json.Unmarshal([]byte(user.MenuOper), &menuOperStr) // jsonErrSun := json.Unmarshal([]byte(user.MenuOper), &menuOperStr)
if jsonErrSun == nil { menuOperStr = strings.Split(user.MenuOper, ",")
// if jsonErrSun == nil {
for _, menuOperVal := range menuOperStr { for _, menuOperVal := range menuOperStr {
menuOperInt, menuOperErr := strconv.ParseInt(menuOperVal, 10, 64) menuOperInt, menuOperErr := strconv.ParseInt(menuOperVal, 10, 64)
if menuOperErr == nil { if menuOperErr == nil {
@ -198,7 +200,10 @@ func (cu *CustomHandle) SystemLogin(c *gin.Context) {
} }
} }
} // }
// fmt.Printf("菜单----JWT-110--->%v\n", menuOperInts)
global.Gva_Authority_Authentication_Subsidiary = menuOperInts global.Gva_Authority_Authentication_Subsidiary = menuOperInts
saveData["Jurisdiction"] = global.Gva_Authority_Authentication saveData["Jurisdiction"] = global.Gva_Authority_Authentication
saveData["MenuOper"] = global.Gva_Authority_Authentication_Subsidiary 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_ADMIN_USERKEY = userKeyCode
global.GVA_SCANCODE_USERNUMBER = userAdmin.KeyStr global.GVA_SCANCODE_USERNUMBER = userAdmin.KeyStr
roleCont := getRole(userAdmin.Role) // roleCont := getRole(userAdmin.Role)
writeRedisData := map[string]interface{}{ writeRedisData := map[string]interface{}{
"userkey": userKeyCode, "userkey": userKeyCode,
@ -396,14 +401,14 @@ func (cu *CustomHandle) ScanCodeLogin(c *gin.Context) {
"usernumber": userAdmin.Name, "usernumber": userAdmin.Name,
"userpwd": userAdmin.PassWord, "userpwd": userAdmin.PassWord,
"usertoken": sha1Token, "usertoken": sha1Token,
"jurisdiction": roleCont.Jurisdiction, "jurisdiction": userAdmin.Jurisdiction,
"menuOper": roleCont.MenuOper, "menuOper": userAdmin.MenuOper,
"wand": 118, "wand": 118,
} }
var surisdictionStr []string var surisdictionStr []string
var surisdictionInt []int64 var surisdictionInt []int64
jsonErr := json.Unmarshal([]byte(roleCont.Jurisdiction), &surisdictionStr) jsonErr := json.Unmarshal([]byte(userAdmin.Jurisdiction), &surisdictionStr)
if jsonErr == nil { if jsonErr == nil {
for _, jurVal := range surisdictionStr { for _, jurVal := range surisdictionStr {
jurValInt, jurValErr := strconv.ParseInt(jurVal, 10, 64) jurValInt, jurValErr := strconv.ParseInt(jurVal, 10, 64)
@ -418,8 +423,9 @@ func (cu *CustomHandle) ScanCodeLogin(c *gin.Context) {
global.Gva_Authority_Authentication = surisdictionInt global.Gva_Authority_Authentication = surisdictionInt
var menuOperStr []string var menuOperStr []string
var menuOperInts []int64 var menuOperInts []int64
jsonErrSun := json.Unmarshal([]byte(roleCont.MenuOper), &menuOperStr) // jsonErrSun := json.Unmarshal([]byte(userAdmin.MenuOper), &menuOperStr)
if jsonErrSun == nil { menuOperStr = strings.Split(userAdmin.MenuOper, ",")
// if jsonErrSun == nil {
for _, menuOperVal := range menuOperStr { for _, menuOperVal := range menuOperStr {
menuOperInt, menuOperErr := strconv.ParseInt(menuOperVal, 10, 64) menuOperInt, menuOperErr := strconv.ParseInt(menuOperVal, 10, 64)
if menuOperErr == nil { if menuOperErr == nil {
@ -427,9 +433,11 @@ func (cu *CustomHandle) ScanCodeLogin(c *gin.Context) {
} }
} }
} // }
global.Gva_Authority_Authentication_Subsidiary = menuOperInts global.Gva_Authority_Authentication_Subsidiary = menuOperInts
// fmt.Printf("菜单----JWT--112-->%v\n", menuOperInts)
redisFileKey := "ScanCode:Authentication:LoginApi_" + global.GVA_CONFIG.RedisPrefix.Alias + "_" + userKeyCode redisFileKey := "ScanCode:Authentication:LoginApi_" + global.GVA_CONFIG.RedisPrefix.Alias + "_" + userKeyCode
redisClient := redishandel.RunRedis() redisClient := redishandel.RunRedis()
redisClient.SetRedisDb(5) redisClient.SetRedisDb(5)
@ -502,8 +510,9 @@ func (cu *CustomHandle) ScanCodeLogin(c *gin.Context) {
global.Gva_Authority_Authentication = surisdictionInt global.Gva_Authority_Authentication = surisdictionInt
var menuOperStr []string var menuOperStr []string
var menuOperInts []int64 var menuOperInts []int64
jsonErrSun := json.Unmarshal([]byte(user.Menuoper), &menuOperStr) // jsonErrSun := json.Unmarshal([]byte(user.Menuoper), &menuOperStr)
if jsonErrSun == nil { menuOperStr = strings.Split(user.Menuoper, ",")
// if jsonErrSun == nil {
for _, menuOperVal := range menuOperStr { for _, menuOperVal := range menuOperStr {
menuOperInt, menuOperErr := strconv.ParseInt(menuOperVal, 10, 64) menuOperInt, menuOperErr := strconv.ParseInt(menuOperVal, 10, 64)
if menuOperErr == nil { if menuOperErr == nil {
@ -511,7 +520,8 @@ func (cu *CustomHandle) ScanCodeLogin(c *gin.Context) {
} }
} }
} // }
// fmt.Printf("菜单----JWT--113-->%v\n", menuOperInts)
global.Gva_Authority_Authentication_Subsidiary = menuOperInts global.Gva_Authority_Authentication_Subsidiary = menuOperInts
redisFileKey := "ScanCode:Authentication:LoginApi_" + global.GVA_CONFIG.RedisPrefix.Alias + "_" + userKeyCode redisFileKey := "ScanCode:Authentication:LoginApi_" + global.GVA_CONFIG.RedisPrefix.Alias + "_" + userKeyCode
redisClient := redishandel.RunRedis() redisClient := redishandel.RunRedis()

3
api/v1/positionkpi/posttarget.go

@ -10,6 +10,7 @@ import (
"gin_server_admin/model/assessmentmodel" "gin_server_admin/model/assessmentmodel"
"gin_server_admin/model/common/response" "gin_server_admin/model/common/response"
"gin_server_admin/model/hrsystem" "gin_server_admin/model/hrsystem"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -254,7 +255,7 @@ func (a *ApiMethod) PostTargetList(c *gin.Context) {
requestData.PageSize = 20 requestData.PageSize = 20
} }
var postTargetListAry []outPostTargetList 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 != "" { if requestData.Title != "" {
gormDb = gormDb.Where("`title` LIKE ?", "%"+requestData.Title+"%") gormDb = gormDb.Where("`title` LIKE ?", "%"+requestData.Title+"%")

12
api/v1/staff/staffpeople.go

@ -1,6 +1,7 @@
package staff package staff
import ( import (
"fmt"
"strconv" "strconv"
"gin_server_admin/commonus" "gin_server_admin/commonus"
@ -9,6 +10,7 @@ import (
"gin_server_admin/model/hrsystem" "gin_server_admin/model/hrsystem"
"gin_server_admin/model/systemuser" "gin_server_admin/model/systemuser"
"gin_server_admin/model/testpage" "gin_server_admin/model/testpage"
"github.com/gin-gonic/gin" "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.Role = ueInfo.Role // `json:"role"`
usUpdate.Icon = ueInfo.Icon // `json:"icon"` usUpdate.Icon = ueInfo.Icon // `json:"icon"`
usUpdate.Wechat = wechatStr // `json:"wechat"` usUpdate.Wechat = wechatStr // `json:"wechat"`
menuStr, buttonStr := getRoleInt(ueInfo.Role) // menuStr, buttonStr := getRoleInt(ueInfo.Role)
usUpdate.Jurisdiction = buttonStr // `json:"jurisdiction"` fmt.Printf("获取的角色值--------->%v\n", ueInfo.Role)
usUpdate.Menuoper = menuStr // `json:"menuoper"` 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)) oldGroup, _ := getOrgCont(strconv.FormatInt(ueInfo.Company, 10))
usUpdate.Oldgroup = oldGroup // `json:"oldgroup"` usUpdate.Oldgroup = oldGroup // `json:"oldgroup"`
olddepart, _ := getOrgCont(strconv.FormatInt(ueInfo.MainDeparment, 10)) 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.Key = strconv.FormatInt(ueInfo.Key, 10)
usUpdate.State = ueInfo.State usUpdate.State = ueInfo.State
usUpdate.Password = ueInfo.Password usUpdate.Password = ueInfo.Password
usUpdate.RoleName = roleName
usUpdate.Level = strconv.Itoa(level)
return return
} }
func HrUserInforold(number, pwd string) (isTrue bool, usUpdate OutScanCodeUserInfo) { func HrUserInforold(number, pwd string) (isTrue bool, usUpdate OutScanCodeUserInfo) {

132
commonus/publichaneld.go

@ -17,6 +17,7 @@ import (
"gin_server_admin/model/assessmentmodel" "gin_server_admin/model/assessmentmodel"
"gin_server_admin/model/hrsystem" "gin_server_admin/model/hrsystem"
"gin_server_admin/model/location" "gin_server_admin/model/location"
"gin_server_admin/model/modelssystempermission"
"gin_server_admin/model/systemuser" "gin_server_admin/model/systemuser"
"gin_server_admin/model/testpage" "gin_server_admin/model/testpage"
"gin_server_admin/model/wechat" "gin_server_admin/model/wechat"
@ -1682,7 +1683,7 @@ func GetOfficeWork(id, departmentId int64) (isTrue bool, roleUser []roleGroupBod
if jsonErrs == nil { if jsonErrs == nil {
isTrue = true 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 // return
// } // }
// err, roleGroup, _ := GetOfficeWork(id, int64(departmentCont.WechatId)) // err, roleGroup, _ := GetOfficeWork(id, int64(departmentCont.WechatId))
fmt.Printf("获取企业微信信息接收人数组形态------------->%v-------->%v\n", id, departmentId)
departWhere := MapOut() departWhere := MapOut()
departWhere["id"] = departmentId departWhere["id"] = departmentId
departmentCont, errDepart := GetNewOrgCont(departWhere, "wechat_organization_id") departmentCont, errDepart := GetNewOrgCont(departWhere, "wechat_organization_id")
@ -1746,6 +1747,7 @@ func GetSendMsgUserAry(id, departmentId int64) (isTrue bool, userStr []string) {
userStr = userList userStr = userList
isTrue = true isTrue = true
} }
fmt.Printf("获取企业微信信息接收人数组形态--------1----->%v-------->%v\n", isTrue, userStr)
return 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 { if state < 1 {
state = 1 state = 1
} }
@ -2165,6 +2180,7 @@ func StepAddDataEs(flowID, roleGroupId int64, nextStep, stepName, typeclass, sta
flowSteping.AddTime = time.Now().Unix() //添加时间 flowSteping.AddTime = time.Now().Unix() //添加时间
flowStepAryMap = append(flowStepAryMap, flowSteping) flowStepAryMap = append(flowStepAryMap, flowSteping)
evalProCont.HappenTime = timeOccurrence
evalProCont.OrderKey = flowID evalProCont.OrderKey = flowID
evalProCont.Step = 1 evalProCont.Step = 1
evalProCont.State = state evalProCont.State = state
@ -4084,8 +4100,11 @@ func GetSchemeFlowData(flowKwy, schemeID int64) (weightSum float64) {
// 获取float字符串转化成Int64 // 获取float字符串转化成Int64
func GetDuyCycle(scoreStr string, multiple int64) (scoreInt64 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) //将乘以系数后的数值转换成字符串 scoreFloat64ToStr := strconv.FormatFloat(coreFloat64*float64(multiple), 'f', -1, 64) //将乘以系数后的数值转换成字符串
fmt.Printf("分值转化-----2------>%v------------->%v\n", scoreFloat64ToStr, multiple)
scoreInt64, _ = strconv.ParseInt(scoreFloat64ToStr, 10, 64) //将字符串转换成int64 scoreInt64, _ = strconv.ParseInt(scoreFloat64ToStr, 10, 64) //将字符串转换成int64
fmt.Printf("分值转化-----3------>%v------------->%v\n", scoreFloat64ToStr, scoreInt64)
return return
} }
@ -4110,7 +4129,7 @@ func GetTimeIntervalDutyJudge(whereData interface{}, schemeID int64) (actual flo
func JudegSunTarToDepart(sunId, departId int64) (isTrue bool) { func JudegSunTarToDepart(sunId, departId int64) (isTrue bool) {
isTrue = false isTrue = false
var title string 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 { if judgeARTErr == nil {
isTrue = true isTrue = true
} }
@ -4325,8 +4344,10 @@ func CalculateScore(targetScore int64, resultval, allPrizes, zeroPrizes, Capping
achievement = 100 achievement = 100
scoreVal = float64(targetScore) scoreVal = float64(targetScore)
if typeClass == 2 { if typeClass == 2 {
if resultval <= 0 {
scoreVal = 0 scoreVal = 0
} }
}
achievementAll = 100 achievementAll = 100
//fmt.Printf("达成率--11-->%v-->%v-->%v-->%v-->%v-->%v-->%v\n", targetScore, resultval, scoreVal, allPrize, zeroPrize, CappingVal, achievement) //fmt.Printf("达成率--11-->%v-->%v-->%v-->%v-->%v-->%v-->%v\n", targetScore, resultval, scoreVal, allPrize, zeroPrize, CappingVal, achievement)
} else { } else {
@ -4453,3 +4474,106 @@ func DiGuiOrgSun(superior int64, idary []int64) (groupId []int64) {
} }
return 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
}

59
commonus/timeSub.go

@ -7,7 +7,7 @@ import (
"time" "time"
) )
//时间相关处理类 // 时间相关处理类
var ( var (
timeLayoutMap = map[string]string{ timeLayoutMap = map[string]string{
"y": "2006", "y": "2006",
@ -29,7 +29,8 @@ var (
} }
) )
/** /*
*
获取本周周一的日期 获取本周周一的日期
*/ */
func GetDateOfWeek() (weekMonday string) { func GetDateOfWeek() (weekMonday string) {
@ -45,7 +46,8 @@ func GetDateOfWeek() (weekMonday string) {
return return
} }
/** /*
*
获取本周周日的日期 获取本周周日的日期
*/ */
func GetLastWeekDate() (weekMonday string) { func GetLastWeekDate() (weekMonday string) {
@ -56,7 +58,8 @@ func GetLastWeekDate() (weekMonday string) {
return return
} }
/** /*
*
获取上周的周一日期 获取上周的周一日期
*/ */
func GetFirstWeekDate() (weekMonday string) { func GetFirstWeekDate() (weekMonday string) {
@ -67,7 +70,8 @@ func GetFirstWeekDate() (weekMonday string) {
return return
} }
/** /*
*
获取上周的周日日期 获取上周的周日日期
*/ */
func GetFirstWeekLastDate() (weekMonday string) { func GetFirstWeekLastDate() (weekMonday string) {
@ -78,7 +82,8 @@ func GetFirstWeekLastDate() (weekMonday string) {
return return
} }
/** /*
*
获取指定日期的上周的周一日期 获取指定日期的上周的周一日期
*/ */
func GetFirstWeekDateSet(thisWeekMonday string) (weekMonday string) { func GetFirstWeekDateSet(thisWeekMonday string) (weekMonday string) {
@ -184,7 +189,7 @@ func TimeStampToDate(timeStamp int64, timeType int) (dateStr string) {
return return
} }
//时间计算(年、季、月、周、日、时、分、秒) // 时间计算(年、季、月、周、日、时、分、秒)
func ComputingTime(timeStamp int64, timeType int) (timeDataInt int64) { func ComputingTime(timeStamp int64, timeType int) (timeDataInt int64) {
var timeData string = "1" var timeData string = "1"
switch timeType { switch timeType {
@ -274,7 +279,7 @@ func GetDiffDaysBySecond(t1, t2 int64) int64 {
return GetDiffDays(time1, time2) return GetDiffDays(time1, time2)
} }
//获取时间段内每天的开始结束时间 // 获取时间段内每天的开始结束时间
func StartAndEndTimeOREveryDay(startTime, endTime int64) []map[string]interface{} { func StartAndEndTimeOREveryDay(startTime, endTime int64) []map[string]interface{} {
tianshu := GetDiffDaysBySecond(endTime, startTime) tianshu := GetDiffDaysBySecond(endTime, startTime)
var i int64 var i int64
@ -291,7 +296,7 @@ func StartAndEndTimeOREveryDay(startTime, endTime int64) []map[string]interface{
return timeMapAry return timeMapAry
} }
//日期字符串转换成time格式 // 日期字符串转换成time格式
func StringToTimeIng(unit, str string) (res time.Time) { func StringToTimeIng(unit, str string) (res time.Time) {
loc, _ := time.LoadLocation("Local") loc, _ := time.LoadLocation("Local")
// str := t.ToString() // str := t.ToString()
@ -303,35 +308,35 @@ func StringToTimeIng(unit, str string) (res time.Time) {
return return
} }
//获取传入的时间所在月份的第一天,即某月第一天的0点。如传入time.Now(), 返回当前月份的第一天0点时间。 // 获取传入的时间所在月份的第一天,即某月第一天的0点。如传入time.Now(), 返回当前月份的第一天0点时间。
func GetFirstDateOfMonth(d time.Time) time.Time { func GetFirstDateOfMonth(d time.Time) time.Time {
d = d.AddDate(0, 0, -d.Day()+1) d = d.AddDate(0, 0, -d.Day()+1)
return GetZeroTime(d) return GetZeroTime(d)
} }
//获取传入的时间所在月份的第一天,即某月第一天的0点。如传入time.Now(), 返回当前月份的第一天0点时间戳。 // 获取传入的时间所在月份的第一天,即某月第一天的0点。如传入time.Now(), 返回当前月份的第一天0点时间戳。
func GetFirstDateOfMonthStamp(d time.Time) (monthStartTimeShamp int64) { func GetFirstDateOfMonthStamp(d time.Time) (monthStartTimeShamp int64) {
monthStartTimeShamp = GetFirstDateOfMonth(d).Unix() monthStartTimeShamp = GetFirstDateOfMonth(d).Unix()
return return
} }
//获取传入的时间所在月份的最后一天,即某月最后一天的0点。如传入time.Now(), 返回当前月份的最后一天0点时间。 // 获取传入的时间所在月份的最后一天,即某月最后一天的0点。如传入time.Now(), 返回当前月份的最后一天0点时间。
func GetLastDateOfMonth(d time.Time) time.Time { func GetLastDateOfMonth(d time.Time) time.Time {
return GetFirstDateOfMonth(d).AddDate(0, 1, -1) 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) { func GetLastDateMonthAll(d time.Time) (monthEndTimeShamp int64) {
monthEndTimeShamp = GetLastDateOfMonth(d).Unix() + 86399 monthEndTimeShamp = GetLastDateOfMonth(d).Unix() + 86399
return return
} }
//获取某一天的0点时间 // 获取某一天的0点时间
func GetZeroTime(d time.Time) time.Time { func GetZeroTime(d time.Time) time.Time {
return time.Date(d.Year(), d.Month(), d.Day(), 0, 0, 0, 0, d.Location()) return time.Date(d.Year(), d.Month(), d.Day(), 0, 0, 0, 0, d.Location())
} }
//指定日期月起止时间戳 // 指定日期月起止时间戳
func GetMonthStartOrEndTime(d time.Time) (monthStartTimgStamp, monthEndTimeStamp int64) { func GetMonthStartOrEndTime(d time.Time) (monthStartTimgStamp, monthEndTimeStamp int64) {
monthStartTimgStamp = GetFirstDateOfMonthStamp(d) monthStartTimgStamp = GetFirstDateOfMonthStamp(d)
monthEndTimeStamp = GetLastDateMonthAll(d) monthEndTimeStamp = GetLastDateMonthAll(d)
@ -379,7 +384,7 @@ func WeekStartAdnEndTime(t time.Time) (strarTime, endTime int64, weekInt int) {
return return
} }
//计算指定日期周一 // 计算指定日期周一
func SetDateWeekFirstTime(t time.Time) (weekInt string) { func SetDateWeekFirstTime(t time.Time) (weekInt string) {
offset := int(time.Monday - t.Weekday()) offset := int(time.Monday - t.Weekday())
if offset > 0 { if offset > 0 {
@ -417,7 +422,7 @@ func FirstWeekStartAdnEndTime(t time.Time) (strarTime, endTime int64, weekInt in
return return
} }
//获取指定时间当月第一周起止时间 // 获取指定时间当月第一周起止时间
func GetSetUpDayTimeToMonthStartAndEndTime(monthStartTime int64) (strarTime, endTime int64) { func GetSetUpDayTimeToMonthStartAndEndTime(monthStartTime int64) (strarTime, endTime int64) {
t := time.Unix(monthStartTime, 0) t := time.Unix(monthStartTime, 0)
fmt.Println(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 return year, currentQuarter, quarterStartTime, quarterEndTime
} }
//获取指定时间的前N个月的起止时间 // 获取指定时间的前N个月的起止时间
func AppointTimeFrontMonth(timeVal time.Time, diff int) (startTime, endTime int64) { func AppointTimeFrontMonth(timeVal time.Time, diff int) (startTime, endTime int64) {
diff = diff * -1 diff = diff * -1
lastMonthFirstDay := timeVal.AddDate(0, diff, -timeVal.Day()+1) lastMonthFirstDay := timeVal.AddDate(0, diff, -timeVal.Day()+1)
@ -484,7 +489,7 @@ func AppointTimeFrontMonth(timeVal time.Time, diff int) (startTime, endTime int6
return return
} }
//获取上月月份,起止时间 // 获取上月月份,起止时间
func GetLastMonth() (yearMonth, startMonth, endMonth string) { func GetLastMonth() (yearMonth, startMonth, endMonth string) {
dataTypeAll := "2006-01-02" dataTypeAll := "2006-01-02"
dataType := "2006-01" dataType := "2006-01"
@ -497,7 +502,7 @@ func GetLastMonth() (yearMonth, startMonth, endMonth string) {
return return
} }
//获取指定月的起止时间 // 获取指定月的起止时间
func GetAppointMonthStarAndEndTime(dayTime string) (startTime, endTime int64) { func GetAppointMonthStarAndEndTime(dayTime string) (startTime, endTime int64) {
dataTypeAll := "2006-01-02" dataTypeAll := "2006-01-02"
dayTime = fmt.Sprintf("%v-%v", dayTime, "01") dayTime = fmt.Sprintf("%v-%v", dayTime, "01")
@ -510,9 +515,21 @@ func GetAppointMonthStarAndEndTime(dayTime string) (startTime, endTime int64) {
return return
} }
//获取指定月的起止时间 // 获取指定月的起止时间
func GetAppointMonthStarAndEndTimeInt(monthStartTime int64) (monthStartTimgStamp, monthEndTimeStamp int64) { func GetAppointMonthStarAndEndTimeInt(monthStartTime int64) (monthStartTimgStamp, monthEndTimeStamp int64) {
t := time.Unix(monthStartTime, 0) t := time.Unix(monthStartTime, 0)
monthStartTimgStamp, monthEndTimeStamp = GetMonthStartOrEndTime(t) monthStartTimgStamp, monthEndTimeStamp = GetMonthStartOrEndTime(t)
return 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
}

12
config.yaml

@ -338,6 +338,18 @@ hrdatabasekingdee:
log-mode: false log-mode: false
log-zap: "" 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: workwechatid:

1
config/config.go

@ -32,6 +32,7 @@ type Server struct {
MysqlWechatCallBack Mysql `mapstructure:"mysqlWechatCallBack" json:"mysqlWechatCallBack" yaml:"mysqlWechatCallBack"` MysqlWechatCallBack Mysql `mapstructure:"mysqlWechatCallBack" json:"mysqlWechatCallBack" yaml:"mysqlWechatCallBack"`
HrDataBase Mysql `mapstructure:"hrdatabase" json:"hrdatabase" yaml:"hrdatabase"` HrDataBase Mysql `mapstructure:"hrdatabase" json:"hrdatabase" yaml:"hrdatabase"`
HrDataBaseKingDee Mysql `mapstructure:"hrdatabasekingdee" json:"hrdatabasekingdee" yaml:"hrdatabasekingdee"` HrDataBaseKingDee Mysql `mapstructure:"hrdatabasekingdee" json:"hrdatabasekingdee" yaml:"hrdatabasekingdee"`
SystemPermission Mysql `mapstructure:"systemPermission" json:"systemPermission" yaml:"systemPermission"`
// oss // oss
Local Local `mapstructure:"local" json:"local" yaml:"local"` Local Local `mapstructure:"local" json:"local" yaml:"local"`

BIN
gin_server_admin

Binary file not shown.

2
global/global.go

@ -2,6 +2,7 @@ package global
import ( import (
"gin_server_admin/utils/timer" "gin_server_admin/utils/timer"
"github.com/songzhibin97/gkit/cache/local_cache" "github.com/songzhibin97/gkit/cache/local_cache"
"golang.org/x/sync/singleflight" "golang.org/x/sync/singleflight"
@ -43,6 +44,7 @@ var (
GVA_DB_WechatCallBack *gorm.DB GVA_DB_WechatCallBack *gorm.DB
GVA_DB_HrDataBase *gorm.DB GVA_DB_HrDataBase *gorm.DB
GVA_DB_HrKingDee *gorm.DB GVA_DB_HrKingDee *gorm.DB
GVA_DB_System_Permission *gorm.DB
//企业微信专用redis //企业微信专用redis
GVA_REDIS_WeChat *redis.Client GVA_REDIS_WeChat *redis.Client

2
global/model.go

@ -33,4 +33,6 @@ type GAV_USER_CONT struct {
Menuoper string `json:"menuoper"` Menuoper string `json:"menuoper"`
Oldgroup string `json:"oldgroup"` Oldgroup string `json:"oldgroup"`
Olddepartment string `json:"olddepartment"` Olddepartment string `json:"olddepartment"`
Level string `json:"level"`
RoleName string `json:"rolename"`
} }

4
initialize/gorm.go

@ -2,6 +2,7 @@ package initialize
import ( import (
"os" "os"
"time"
"gin_server_admin/global" "gin_server_admin/global"
"gin_server_admin/initialize/internal" "gin_server_admin/initialize/internal"
@ -162,6 +163,8 @@ func GormMysqlChange(setDataBaseName string) *gorm.DB {
m = global.GVA_CONFIG.HrDataBase m = global.GVA_CONFIG.HrDataBase
case "hrdatabasekingdee": case "hrdatabasekingdee":
m = global.GVA_CONFIG.HrDataBaseKingDee m = global.GVA_CONFIG.HrDataBaseKingDee
case "systemPermission":
m = global.GVA_CONFIG.SystemPermission
default: default:
m = global.GVA_CONFIG.Mysql m = global.GVA_CONFIG.Mysql
} }
@ -186,6 +189,7 @@ func GormMysqlChange(setDataBaseName string) *gorm.DB {
sqlDB, _ := db.DB() sqlDB, _ := db.DB()
sqlDB.SetMaxIdleConns(m.MaxIdleConns) sqlDB.SetMaxIdleConns(m.MaxIdleConns)
sqlDB.SetMaxOpenConns(m.MaxOpenConns) sqlDB.SetMaxOpenConns(m.MaxOpenConns)
sqlDB.SetConnMaxLifetime(5 * time.Minute)
return db return db
} }
} }

9
main.go

@ -91,12 +91,17 @@ func main() {
global.GVA_DB_HrDataBase = initialize.GormMysqlChange("hrdatabase") global.GVA_DB_HrDataBase = initialize.GormMysqlChange("hrdatabase")
if global.GVA_DB_Performanceappraisal != nil { 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") global.GVA_DB_HrKingDee = initialize.GormMysqlChange("hrdatabasekingdee")
if global.GVA_DB_Performanceappraisal != nil { 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() scheduledtask.TimeTask()

9
middleware/myjwt.go

@ -4,6 +4,7 @@ import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"strconv" "strconv"
"strings"
"gin_server_admin/commonus" "gin_server_admin/commonus"
"gin_server_admin/global" "gin_server_admin/global"
@ -304,8 +305,9 @@ func ScanCodeLogin() gin.HandlerFunc {
global.Gva_Authority_Authentication = surisdictionInt global.Gva_Authority_Authentication = surisdictionInt
var menuOperStr []string var menuOperStr []string
var menuOperInts []int64 var menuOperInts []int64
jsonErrSun := json.Unmarshal([]byte(myCustomIdentify.MenuOper), &menuOperStr) // jsonErrSun := json.Unmarshal([]byte(myCustomIdentify.MenuOper), &menuOperStr)
if jsonErrSun == nil { menuOperStr = strings.Split(myCustomIdentify.MenuOper, ",")
// if jsonErrSun == nil {
for _, menuOperVal := range menuOperStr { for _, menuOperVal := range menuOperStr {
menuOperInt, menuOperErr := strconv.ParseInt(menuOperVal, 10, 64) menuOperInt, menuOperErr := strconv.ParseInt(menuOperVal, 10, 64)
if menuOperErr == nil { if menuOperErr == nil {
@ -313,7 +315,8 @@ func ScanCodeLogin() gin.HandlerFunc {
} }
} }
} // }
// fmt.Printf("菜单----JWT---->%v---->%v---->%v\n", menuOperInts, myCustomIdentify.MenuOper, menuOperStr)
global.Gva_Authority_Authentication_Subsidiary = menuOperInts global.Gva_Authority_Authentication_Subsidiary = menuOperInts
redisClient.SetRedisTime(10800) redisClient.SetRedisTime(10800)
redisClient.HashMsetAdd(redisFileKey, writeRedisData) redisClient.HashMsetAdd(redisFileKey, writeRedisData)

1
model/assessmentmodel/performance_appraisal.go

@ -84,6 +84,7 @@ type EvaluationProcess struct {
Target string `json:"target" gorm:"column:ep_target;type:mediumtext;comment:指标"` Target string `json:"target" gorm:"column:ep_target;type:mediumtext;comment:指标"`
DetailedTarget string `json:"detailedtarget" gorm:"column:ep_detailedtarget;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:接受考核部门"` 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 { func (EvaluationProcess *EvaluationProcess) TableName() string {

62
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
}

65
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
}

63
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
}

60
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
}

65
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
}
Loading…
Cancel
Save