Browse Source

编辑新内容

v1_dev_2
超级管理员 3 years ago
parent
commit
1771ecce38
  1. 4
      api/base/loginVerify/login.go
  2. 85
      api/shiyan/maptostruct/department.go
  3. 1
      api/version1/departmentseting/departmentpc/departtarget.go
  4. 2
      api/version1/departmentseting/departmentpc/ding_xing.go
  5. 77
      api/version1/departmentseting/departmentpc/dingliang.go
  6. 16
      api/version1/jurisdiction/jurisdictionpc/appsystem.go
  7. 233
      api/version1/jurisdiction/jurisdictionpc/postpower.go
  8. 287
      api/version1/jurisdiction/jurisdictionpc/power.go
  9. 89
      api/version1/jurisdiction/jurisdictionpc/systemrole.go
  10. 13
      api/version1/jurisdiction/jurisdictionpc/type.go
  11. 4
      api/workflow/currency_recipe/general_method.go
  12. 1
      apirouter/apishiyan/maptostruct.go
  13. 6
      apirouter/v1/systempower/pc.go
  14. 1
      config/configDatabase/database.go
  15. 14
      config/configDatabase/database.yaml
  16. 7
      initialization/databaseinit/mysql.go
  17. 61
      models/modelAppPlatform/dict_type.go
  18. 63
      models/modelAppPlatform/dictionary.go
  19. 67
      models/modelAppPlatform/menus.go
  20. 1
      overall/appConfig.go
  21. 98
      overall/publicmethod/technique.go
  22. 9
      overall/publicmethod/type.go

4
api/base/loginVerify/login.go

@ -194,9 +194,9 @@ func (a *ApiMethod) ScanCodeLogin(c *gin.Context) {
sendKpiCont.UserInfo.Number = userCont.Number sendKpiCont.UserInfo.Number = userCont.Number
sendKpiCont.UserInfo.Password = userCont.Password sendKpiCont.UserInfo.Password = userCont.Password
sendDate, _ := json.Marshal(sendKpiCont) sendDate, _ := json.Marshal(sendKpiCont)
sdff := publicmethod.CurlPostJosn("http://120.224.6.6:39168/shiyan/write_token", sendDate) publicmethod.CurlPostJosn("http://120.224.6.6:39168/shiyan/write_token", sendDate)
fmt.Printf("redisMyContKey------Login----->%v\n", sdff) // fmt.Printf("redisMyContKey------Login----->%v\n", sdff)
publicmethod.Result(0, saveData, c) publicmethod.Result(0, saveData, c)
} }

85
api/shiyan/maptostruct/department.go

@ -272,6 +272,14 @@ func ChuLiTiBaoRenGuoDu(dimensionId, targetId, targetSunId, targetBylaws, postId
} }
} }
}
func ChuLiTiBaoRenGuoDuss(dimensionId, targetId, targetSunId, targetBylaws, postId int64, typeInt, class, level int, orgId string, manKey []string) {
if len(manKey) > 0 {
for _, v := range manKey {
handTarReport(dimensionId, targetId, targetSunId, targetBylaws, postId, typeInt, class, level, orgId, v)
}
}
} }
/* /*
@ -421,7 +429,7 @@ func (a *ApiMethod) XiaoZhengBumenBylaws(c *gin.Context) {
jbq := 0 jbq := 0
for i, v := range detasilCont { for i, v := range detasilCont {
if (i+1)%100 == 0 { if (i+1)%300 == 0 {
jbq++ jbq++
fenZhu = append(fenZhu, v) fenZhu = append(fenZhu, v)
fmt.Printf("满100分组---->%v---->%v---->%v---->%v\n", i, jbq, len(fenZhu), (i+1)%100) fmt.Printf("满100分组---->%v---->%v---->%v---->%v\n", i, jbq, len(fenZhu), (i+1)%100)
@ -441,7 +449,7 @@ func (a *ApiMethod) XiaoZhengBumenBylaws(c *gin.Context) {
fmt.Printf("还有剩余得---->%v---->%v\n", jbq, len(fenZhu)) fmt.Printf("还有剩余得---->%v---->%v\n", jbq, len(fenZhu))
} }
syncSetings.Wait() syncSetings.Wait()
publicmethod.Result(0, fenZhu, c) publicmethod.Result(0, jbq, c)
} }
/* /*
@ -504,3 +512,76 @@ func XiaoZhengCont(bylawsList []modelskpi.DetailedTarget) {
syncSeting.Wait() syncSeting.Wait()
} }
} }
/*
*
@ 作者: 秦东
@ 时间: 2023-05-15 08:19:52
@ 功能: 校正方案提报人
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) XiaoZhengFangAn(c *gin.Context) {
var shemeList []modelskpi.QualitativeEvaluation
err := overall.CONSTANT_DB_KPI.Where("qe_state = 1").Find(&shemeList).Error
if err != nil || len(shemeList) <= 0 {
publicmethod.Result(1, err, c, "没有数据")
return
}
var fenZhu []modelskpi.QualitativeEvaluation
jbq := 0
for i, v := range shemeList {
if (i+1)%1000 == 0 {
jbq++
fenZhu = append(fenZhu, v)
fmt.Printf("满1000分组---->%v---->%v---->%v---->%v\n", i, jbq, len(fenZhu), (i+1)%100)
syncSetings.Add(1)
go XiaoZhengSchemeData(fenZhu)
var newFenzu []modelskpi.QualitativeEvaluation
fenZhu = newFenzu
} else {
fenZhu = append(fenZhu, v)
}
}
if len(fenZhu) > 0 {
syncSetings.Add(1)
go XiaoZhengSchemeData(fenZhu)
jbq++
fmt.Printf("还有剩余得---->%v---->%v\n", jbq, len(fenZhu))
}
syncSetings.Wait()
publicmethod.Result(0, fenZhu, c)
}
// 校正方案数据
func XiaoZhengSchemeData(shemeList []modelskpi.QualitativeEvaluation) {
defer syncSetings.Done()
if len(shemeList) > 0 {
for _, v := range shemeList {
//获取指标内容
var tarCont modelskpi.EvaluationTarget
tarCont.GetCont(map[string]interface{}{"`et_id`": v.Target}, "`et_dimension`", "`et_type`", "`et_relevant_departments`", "`et_report`")
accDepart := strconv.FormatInt(v.AcceptEvaluation, 10)
handDepartmentTarget(tarCont.Dimension, v.Target, v.TargetSun, v.DetailedTarget, 0, 3, 1, v.Type, accDepart)
if v.Operator != "" {
reportList := strings.Split(v.Operator, ",") //关联提报人
// ChuLiTiBaoRenGuoDuss(tarCont.Dimension, v.Target, v.TargetSun, v.DetailedTarget, 0, 1, v.Type, 3, accDepart, reportList)
syncSeting.Add(1)
go ChuLiTiBaoRenGuoDu(tarCont.Dimension, v.Target, v.TargetSun, v.DetailedTarget, 0, 1, v.Type, 3, accDepart, reportList)
}
}
}
syncSeting.Wait()
}

1
api/version1/departmentseting/departmentpc/departtarget.go

@ -225,6 +225,7 @@ func DepartAndReportAboutTarget(dimensionId, targetId, targetSunId, targetBylaws
if typeLevel == 0 { if typeLevel == 0 {
typeLevel = 1 typeLevel = 1
} }
fmt.Printf("管理部门提报人---->\ndimensionId------->%v\ntargetId------->%v\ntargetSunId------->%v\ntargetBylaws------->%v\ndepartmentId------->%v\nmanKey------->%v\ntypeInt------->%v\nclass------->%v\ntypeLevel------->%v\n", dimensionId, targetId, targetSunId, targetBylaws, departmentId, manKey, typeInt, class, typeLevel)
//循环遍历部门 //循环遍历部门
for _, dv := range departmentId { for _, dv := range departmentId {
//将不属于该指标细则的部门至禁用 //将不属于该指标细则的部门至禁用

2
api/version1/departmentseting/departmentpc/ding_xing.go

@ -464,7 +464,9 @@ func (a *ApiMethod) SubmitQualityAssess(c *gin.Context) {
fmt.Printf("addErr--->%v\n", addErr) fmt.Printf("addErr--->%v\n", addErr)
if addErr == nil { if addErr == nil {
if len(receivedValue.UploadFiles) > 0 { if len(receivedValue.UploadFiles) > 0 {
SyncSetFiles.Add(1)
EditFileHandel(uuid, "score_flow", receivedValue.UploadFiles) EditFileHandel(uuid, "score_flow", receivedValue.UploadFiles)
SyncSetFiles.Wait()
} }
//下一个节点内容 //下一个节点内容
nextNodeStr := string(nextNodeJson) nextNodeStr := string(nextNodeJson)

77
api/version1/departmentseting/departmentpc/dingliang.go

@ -41,21 +41,46 @@ func (a *ApiMethod) GetQuantitativeTasks(c *gin.Context) {
//获取参数 //获取参数
var receivedValue GetQuanTasks var receivedValue GetQuanTasks
c.ShouldBindJSON(&receivedValue) c.ShouldBindJSON(&receivedValue)
var listCont []modelskpi.QualitativeEvaluation // var listCont []modelskpi.QualitativeEvaluation
gormDb := overall.CONSTANT_DB_KPI.Where("`qe_type` = 2 AND `qe_state` = 1 AND FIND_IN_SET(?,`qe_operator`)", myLoginCont.Key) // gormDb := overall.CONSTANT_DB_KPI.Where("`qe_type` = 2 AND `qe_state` = 1 AND FIND_IN_SET(?,`qe_operator`)", myLoginCont.Key)
// if receivedValue.OrgId != "" {
// gormDb = gormDb.Where("qe_accept_evaluation = ?", receivedValue.OrgId)
// }
// if receivedValue.Title != "" {
// gormDb = gormDb.Joins("LEFT JOIN evaluationtarget ON et_id = qe_target").Where("et_title LIKE ?", "%"+receivedValue.Title+"%")
// }
// gormDb := overall.CONSTANT_DB_KPI.Where("`qe_type` = 2 AND `qe_state` = 1 ")
// if receivedValue.OrgId != "" {
// gormDb = gormDb.Where("qe_accept_evaluation = ?", receivedValue.OrgId)
// }
// if receivedValue.Title != "" {
// gormDb = gormDb.Joins("LEFT JOIN evaluationtarget ON et_id = qe_target").Where("et_title LIKE ?", "%"+receivedValue.Title+"%")
// }
var qualEvaCont modelskpi.QualitativeEvaluationView
gormDb := overall.CONSTANT_DB_KPI.Table(fmt.Sprintf("%s qe", qualEvaCont.TableName())).Select("qe.`qe_accept_evaluation`,qe.`qe_target`,qe.`et_title`").Where("qe.`qe_type` = 2 AND qe.`qe_state` = 1 ")
gormDb = gormDb.Joins("JOIN target_report td ON qe.qe_target = td.target_id AND qe.qe_accept_evaluation = td.`department_id` AND td.target_bylaws = qe.`qe_detailed_target` AND td.`type` = 1 AND td.`post_id` = 0 AND td.state = 1 AND td.type_level = 1 AND td.`man_key` = ?", myLoginCont.Key)
if receivedValue.OrgId != "" { if receivedValue.OrgId != "" {
gormDb = gormDb.Where("qe_accept_evaluation = ?", receivedValue.OrgId) gormDb = gormDb.Where("`qe_accept_evaluation` = ?", receivedValue.OrgId)
} }
if receivedValue.Title != "" { if receivedValue.Title != "" {
gormDb = gormDb.Joins("LEFT JOIN evaluationtarget ON et_id = qe_target").Where("et_title LIKE ?", "%"+receivedValue.Title+"%") gormDb = gormDb.Where("et_title LIKE ?", "%"+receivedValue.Title+"%")
} }
err := gormDb.Order("qe_type ASC,qe_group ASC,qe_accept_evaluation ASC,qe_dimension ASC,qe_target ASC,qe_target_sun ASC,qe_detailed_target ASC").Find(&listCont).Error var qualEvaList []modelskpi.QualitativeEvaluationView
if err != nil || len(listCont) < 1 { err := gormDb.Order("qe_accept_evaluation ASC,qe_target ASC").Find(&qualEvaList).Error
publicmethod.Result(1, err, c, "您没有要参加的考核项目!")
// publicmethod.Result(1, qualEvaList, c, "您没有要参加的考核项目!")
// return
// err := gormDb.Order("qe_type ASC,qe_group ASC,qe_accept_evaluation ASC,qe_dimension ASC,qe_target ASC,qe_target_sun ASC,qe_detailed_target ASC").Find(&listCont).Error
if err != nil || len(qualEvaList) < 1 {
publicmethod.Result(1, qualEvaList, c, "您没有要参加的考核项目!")
return return
} }
var sendListCont []TargetContOutCont var sendListCont []TargetContOutCont
for _, v := range listCont { for _, vsss := range qualEvaList {
var v modelskpi.QualitativeEvaluation
v.GetCont(map[string]interface{}{"`qe_accept_evaluation`": vsss.AcceptEvaluation, "`qe_target`": vsss.Target, "`qe_state`": 1})
var sendCont TargetContOutCont var sendCont TargetContOutCont
sendCont.Id = strconv.FormatInt(v.Id, 10) sendCont.Id = strconv.FormatInt(v.Id, 10)
sendCont.Type = v.Type sendCont.Type = v.Type
@ -224,26 +249,26 @@ func (a *ApiMethod) GetQuantitativeTasks(c *gin.Context) {
sendCont.Reason = "" sendCont.Reason = ""
sendCont.DetailedTarget = strconv.FormatInt(v.DetailedTarget, 10) sendCont.DetailedTarget = strconv.FormatInt(v.DetailedTarget, 10)
switch v.Cycles { // switch v.Cycles {
case 5: // case 5:
banNian := []int64{3, 6, 9, 12} // banNian := []int64{3, 6, 9, 12}
if publicmethod.IsInTrue[int64](months, banNian) { // if publicmethod.IsInTrue[int64](months, banNian) {
sendListCont = append(sendListCont, sendCont) // sendListCont = append(sendListCont, sendCont)
} // }
case 6: // case 6:
if months == 12 { // if months == 12 {
sendListCont = append(sendListCont, sendCont) // sendListCont = append(sendListCont, sendCont)
} // }
case 7: // case 7:
banNian := []int64{6, 12} // banNian := []int64{6, 12}
if publicmethod.IsInTrue[int64](months, banNian) { // if publicmethod.IsInTrue[int64](months, banNian) {
sendListCont = append(sendListCont, sendCont) // sendListCont = append(sendListCont, sendCont)
} // }
default: // default:
// sendListCont = append(sendListCont, sendCont)
// }
sendListCont = append(sendListCont, sendCont) sendListCont = append(sendListCont, sendCont)
} }
}
publicmethod.Result(0, sendListCont, c) publicmethod.Result(0, sendListCont, c)
} }

16
api/version1/jurisdiction/jurisdictionpc/appsystem.go

@ -4,6 +4,7 @@ import (
"key_performance_indicators/models/modelssystempermission" "key_performance_indicators/models/modelssystempermission"
"key_performance_indicators/overall" "key_performance_indicators/overall"
"key_performance_indicators/overall/publicmethod" "key_performance_indicators/overall/publicmethod"
"strconv"
"time" "time"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
@ -85,7 +86,20 @@ func (a *ApiMethod) SystemList(c *gin.Context) {
publicmethod.Result(107, err, c) publicmethod.Result(107, err, c)
return return
} }
publicmethod.ResultList(0, receivedValue.Page, receivedValue.PageSize, total, int64(len(systemAry)), systemAry, c) var snedList []SendSystemList
for _, v := range systemAry {
var sendCont SendSystemList
sendCont.Id = v.Id //
sendCont.Title = v.Title //系统名称"`
sendCont.Coder = v.Coder //识别符"`
sendCont.State = v.State //状态(1:启用;2:禁用;3:删除)"`
sendCont.Time = v.Time //创建时间"`
sendCont.Sort = v.Sort //排序"`
sendCont.ApiUrl = v.ApiUrl //菜单访问权限列表"`
sendCont.Key = strconv.FormatInt(v.Id, 10)
snedList = append(snedList, sendCont)
}
publicmethod.ResultList(0, receivedValue.Page, receivedValue.PageSize, total, int64(len(snedList)), snedList, c)
} }
// 获取单一系统详情 // 获取单一系统详情

233
api/version1/jurisdiction/jurisdictionpc/postpower.go

@ -0,0 +1,233 @@
package jurisdictionpc
import (
"fmt"
"key_performance_indicators/models/modelshr"
"key_performance_indicators/models/modelssystempermission"
"key_performance_indicators/overall"
"key_performance_indicators/overall/publicmethod"
"strconv"
"strings"
"time"
"github.com/gin-gonic/gin"
)
/*
*
@ 作者: 秦东
@ 时间: 2023-05-29 13:06:32
@ 功能: 给指定岗位授权
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) GrantPostSystemPowers(c *gin.Context) {
var receivedValue editPowerStructNew
err := c.ShouldBindJSON(&receivedValue)
if err != nil {
publicmethod.Result(100, err, c)
return
}
if receivedValue.OrdId == "" || receivedValue.OrdId == "0" {
publicmethod.Result(1, receivedValue, c, "未知行政组织!不可进行配权")
return
}
if receivedValue.PostId == "" || receivedValue.PostId == "0" {
publicmethod.Result(1, receivedValue, c, "未知岗位!不可进行配权")
return
}
if receivedValue.SystemName == "" {
publicmethod.Result(1, receivedValue, c, "未知配权系统!不可进行配权")
return
}
if receivedValue.Level == 0 {
receivedValue.Level = 2
}
var orgIdList []int64
switch receivedValue.Level {
case 2: //本部门
orgIdInt, _ := strconv.ParseInt(receivedValue.OrdId, 10, 64)
_, _, departmentId, _, _ := publicmethod.GetOrgStructure(orgIdInt)
// orgIdList = publicmethod.GetDepartmentSun(departmentId, orgIdList)
var getSunOrg publicmethod.GetOrgAllSun
getSunOrg.GetOrgSun(departmentId)
orgIdList = getSunOrg.Id
orgIdList = append(orgIdList, departmentId)
case 3: //本分部
orgIdInt, _ := strconv.ParseInt(receivedValue.OrdId, 10, 64)
_, companyId, _, _, _ := publicmethod.GetOrgStructure(orgIdInt)
// orgIdList = publicmethod.GetDepartmentSun(companyId, orgIdList)
var getSunOrg publicmethod.GetOrgAllSun
getSunOrg.GetOrgSun(companyId)
orgIdList = getSunOrg.Id
orgIdList = append(orgIdList, companyId)
case 4: //指定行政组织
case 5: //所有
overall.CONSTANT_DB_HR.Model(&modelshr.AdministrativeOrganization{}).Select("`id`").Where("`state` = 1").Find(&orgIdList)
default: //本岗位
orgIdInt, _ := strconv.ParseInt(receivedValue.OrdId, 10, 64)
orgIdList = append(orgIdList, orgIdInt)
}
var orgIdListAry []string //行政组织
for _, v := range orgIdList {
orgIdListAry = append(orgIdListAry, strconv.FormatInt(v, 10))
}
orgIdListStr := strings.Join(orgIdListAry, ",")
addTime := time.Now().Unix()
var empowerCont modelssystempermission.Empower
err = empowerCont.GetCont(map[string]interface{}{"`ordid`": receivedValue.OrdId, "`post_id`": receivedValue.PostId, "`system`": receivedValue.SystemName}, "`id`")
if len(receivedValue.PowerList) > 0 {
var menuList []string //权限点位
var menuOperationList []string //操作点位
for _, v := range receivedValue.PowerList {
switch receivedValue.SystemName {
case "kpi":
if v.Attribute != 4 {
menuList = append(menuList, v.Key)
}
if v.Attribute == 4 {
menuOperationList = append(menuOperationList, v.Key)
}
case "cangchu":
menuList = append(menuList, v.Key)
default:
menuList = append(menuList, v.Key)
}
}
menuListStr := strings.Join(menuList, ",")
menuOperationListStr := strings.Join(menuOperationList, ",")
fmt.Printf("操作点位-------->%v-------->%v\n", menuOperationListStr, menuOperationList)
if err != nil {
ordIdInt64, _ := strconv.ParseInt(receivedValue.OrdId, 10, 64)
empowerCont.OrdId = ordIdInt64 //行政组织"`
postIdInt64, _ := strconv.ParseInt(receivedValue.PostId, 10, 64)
empowerCont.PostId = postIdInt64 //岗位ID"`
empowerCont.System = receivedValue.SystemName //系统"`
empowerCont.PointId = menuListStr //权限点位"`
empowerCont.State = 1 //状态(1:启用;2:禁用;3:删除)"`
empowerCont.Time = time.Now().Unix() //创建时间"`
empowerCont.Level = receivedValue.Level
empowerCont.Operation = menuOperationListStr
empowerCont.Organization = orgIdListStr
err = overall.CONSTANT_DB_System_Permission.Create(&empowerCont).Error
} else {
err = empowerCont.EiteCont(map[string]interface{}{"`id`": empowerCont.Id}, map[string]interface{}{"`point_id`": menuListStr, "`operation`": menuOperationListStr, "`level`": receivedValue.Level, "`time`": addTime, "`state`": 1, "`organization`": orgIdListStr})
if err != nil {
publicmethod.Result(1, err, c, "权限配置失败")
return
}
}
} else {
if err == nil {
err = empowerCont.EiteCont(map[string]interface{}{"`id`": empowerCont.Id}, map[string]interface{}{"`point_id`": "", "`operation`": "", "`level`": receivedValue.Level, "`time`": addTime, "`state`": 1, "`organization`": orgIdListStr})
if err != nil {
publicmethod.Result(1, err, c, "权限配置失败")
return
}
}
}
publicmethod.Result(0, err, c)
}
/*
*
@ 作者: 秦东
@ 时间: 2023-05-30 14:59:12
@ 功能:
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) GrantRoleSystemPowers(c *gin.Context) {
var receivedValue editRolePowerStructNew
err := c.ShouldBindJSON(&receivedValue)
if err != nil {
publicmethod.Result(100, err, c)
return
}
if receivedValue.RoleId == "" || receivedValue.RoleId == "0" {
publicmethod.Result(1, receivedValue, c, "未知角色!不可进行配权")
return
}
if receivedValue.SystemName == "" {
publicmethod.Result(1, receivedValue, c, "未知配权系统!不可进行配权")
return
}
if receivedValue.Level == 0 {
receivedValue.Level = 2
}
addTime := time.Now().Unix()
var empowerCont modelssystempermission.RoleEmpower
err = empowerCont.GetCont(map[string]interface{}{"`role_id`": receivedValue.RoleId, "`system`": receivedValue.SystemName}, "`id`")
if len(receivedValue.PowerList) < 1 {
if err == nil {
err = empowerCont.EiteCont(map[string]interface{}{"`id`": empowerCont.Id}, map[string]interface{}{"`point_id`": "", "`operation`": "", "`level`": receivedValue.Level, "`time`": addTime, "`state`": 1})
if err != nil {
publicmethod.Result(1, err, c, "权限配置失败")
return
}
}
} else {
var menuList []string //权限点位
var menuOperationList []string //操作点位
for _, v := range receivedValue.PowerList {
switch receivedValue.SystemName {
case "kpi":
if v.Attribute != 4 {
menuList = append(menuList, v.Key)
}
if v.Attribute == 4 {
menuOperationList = append(menuOperationList, v.Key)
}
case "cangchu":
menuList = append(menuList, v.Key)
default:
menuList = append(menuList, v.Key)
}
}
menuListStr := strings.Join(menuList, ",")
menuOperationListStr := strings.Join(menuOperationList, ",")
if err == nil {
err = empowerCont.EiteCont(map[string]interface{}{"`id`": empowerCont.Id}, map[string]interface{}{"`point_id`": menuListStr, "`operation`": menuOperationListStr, "`level`": receivedValue.Level, "`time`": addTime, "`state`": 1})
if err != nil {
publicmethod.Result(1, err, c, "权限配置失败")
return
}
} else {
roleIdInt, _ := strconv.ParseInt(receivedValue.RoleId, 10, 64)
empowerCont.RoleId = roleIdInt //行政组织"`
empowerCont.System = receivedValue.SystemName //系统"`
empowerCont.PointId = menuListStr //权限点位"`
empowerCont.State = 1 //状态(1:启用;2:禁用;3:删除)"`
empowerCont.Time = addTime //创建时间"`
empowerCont.Level = receivedValue.Level //授权范围等级(1:本部门;2:本分部;3:所有)"`
empowerCont.Operation = menuOperationListStr //操作点位
err = overall.CONSTANT_DB_System_Permission.Create(&empowerCont).Error
if err != nil {
publicmethod.Result(1, err, c, "权限配置失败")
return
}
}
}
publicmethod.Result(0, err, c)
}

287
api/version1/jurisdiction/jurisdictionpc/power.go

@ -3,6 +3,7 @@ package jurisdictionpc
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"key_performance_indicators/models/modelAppPlatform"
"key_performance_indicators/models/modelshr" "key_performance_indicators/models/modelshr"
"key_performance_indicators/models/modelsschool" "key_performance_indicators/models/modelsschool"
"key_performance_indicators/models/modelsstorage" "key_performance_indicators/models/modelsstorage"
@ -222,13 +223,14 @@ func kpiMenuThree(purview, operatIon []string) (menuThree []publicmethod.PowerTh
menSmaiCont.Name = menuList[i].Title menSmaiCont.Name = menuList[i].Title
menSmaiCont.ParentId = strconv.FormatInt(menuList[i].ParentId, 10) menSmaiCont.ParentId = strconv.FormatInt(menuList[i].ParentId, 10)
menSmaiCont.PathUrl = menuList[i].ApiUrl menSmaiCont.PathUrl = menuList[i].ApiUrl
menSmaiCont.Key = idStr
if len(purview) > 0 { if len(purview) > 0 {
if publicmethod.IsInTrue[string](idStr, purview) == true { if publicmethod.IsInTrue[string](idStr, purview) == true {
menSmaiCont.IsTrue = true menSmaiCont.IsTrue = true
// fmt.Printf("\n\npurview------>%v------>%v------>%v\n\n", idStr, purview, publicmethod.IsInTrue[string](idStr, purview)) // fmt.Printf("\n\npurview------>%v------>%v------>%v\n\n", idStr, purview, publicmethod.IsInTrue[string](idStr, purview))
} }
} }
menSmaiCont.Attribute = 1
menuSmaillList = append(menuSmaillList, menSmaiCont) menuSmaillList = append(menuSmaillList, menSmaiCont)
} }
menuThree = publicmethod.GetMenuThreePeiQuan(1, "0", menuSmaillList, operatIon) menuThree = publicmethod.GetMenuThreePeiQuan(1, "0", menuSmaillList, operatIon)
@ -272,7 +274,9 @@ func wmsMenuThree(purview, operatIon []string) (menuThree []publicmethod.PowerTh
menSmaiCont.IsTrue = true menSmaiCont.IsTrue = true
} }
} }
menSmaiCont.Key = idStr
menSmaiCont.Attribute = 1
menSmaiCont.MenuKey = fmt.Sprintf("m_%v", menuList[i].Id)
menuSmaillList = append(menuSmaillList, menSmaiCont) menuSmaillList = append(menuSmaillList, menSmaiCont)
} }
menuThree = publicmethod.GetMenuThrees(1, "0", menuSmaillList) menuThree = publicmethod.GetMenuThrees(1, "0", menuSmaillList)
@ -713,3 +717,282 @@ func (a *ApiMethod) EditRolePowerNew(c *gin.Context) {
publicmethod.Result(0, receivedValue, c) publicmethod.Result(0, receivedValue, c)
} }
/*
*
@ 作者: 秦东
@ 时间: 2023-05-27 08:19:37
@ 功能: 系统权限菜单
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) SystemAboutPowerMenu(c *gin.Context) {
var receivedValue GetSystemMenuPower
err := c.ShouldBindJSON(&receivedValue)
if err != nil {
publicmethod.Result(100, err, c)
return
}
if receivedValue.Name == "" {
publicmethod.Result(101, err, c)
return
}
var systemPower modelssystempermission.Appsystem
err = systemPower.GetCont(map[string]interface{}{"`coder`": receivedValue.Name})
if err != nil {
publicmethod.Result(105, err, c)
return
}
if systemPower.State == 2 {
publicmethod.Result(1, err, c, "该系统授权已经禁用!")
return
}
if systemPower.State == 3 {
publicmethod.Result(1, err, c, "该系统授权已经取消合作!")
return
}
var menuThree []publicmethod.PowerThree
// fmt.Printf("ApiUrl------>%v\n", receivedValue)
if systemPower.ApiUrl != "" {
//api入口不为空的情况下采用get访问方式接收数据
htmlByte := publicmethod.CurlGet(systemPower.ApiUrl)
// fmt.Printf("%v\n", string(htmlByte))
var jsonAry callBackUrlMenu
jsonErr := json.Unmarshal(htmlByte, &jsonAry)
if jsonErr != nil {
publicmethod.Result(1, jsonErr, c, "数据获取错误!")
return
}
if jsonAry.Code != 0 {
publicmethod.Result(1, jsonErr, c, jsonAry.Msg)
return
}
menuThree = jsonAry.Data
} else {
var pointInt []string
var operatIon []string
var systemEmpowerCont modelssystempermission.Empower
err = systemEmpowerCont.GetCont(map[string]interface{}{"`ordid`": receivedValue.OrdId, "`post_id`": receivedValue.PostId, "`system`": systemPower.Coder}, "`point_id`", `operation`)
if err == nil {
pointInt = strings.Split(systemEmpowerCont.PointId, ",")
operatIon = strings.Split(systemEmpowerCont.Operation, ",")
}
//api入口为空,采用系统内置获取授权菜单
switch systemPower.Coder {
case "cangchu":
menuThree = wmsMenuThree(pointInt, operatIon)
// fmt.Printf("ApiUrl----2-->%v\n", systemPower.ApiUrl)
case "kpi":
//获取绩效考核菜单树
menuThree = kpiPostMenuThree(pointInt, operatIon)
default:
menuThree = appSystemMenuThree(pointInt)
// fmt.Printf("ApiUrl---1--->%v\n", systemPower.ApiUrl)
}
}
publicmethod.Result(0, menuThree, c)
}
/*
*
@ 作者: 秦东
@ 时间: 2023-05-27 08:27:24
@ 功能: 新KPI授权树
@ 参数
#purview 菜单权限
#operatIon 附属权限
@ 返回值
#
@ 方法原型
#
*/
func kpiPostMenuThree(purview, operatIon []string) (menuThree []publicmethod.PowerThree) {
var menuList []modelsschool.SystemMenuSchool
err := overall.CONSTANT_DB_Master.Where("`m_steat` = 1").Order("`m_sort` ASC").Order("`m_sort` ASC").Order("`m_id` DESC").Find(&menuList).Error
lenSum := len(menuList)
if err != nil || lenSum < 1 {
return
}
var menusOperaList []publicmethod.MenuContList
for _, mv := range menuList {
idStr := strconv.FormatInt(mv.Id, 10)
var menuMenuCtion publicmethod.MenuContList
menuMenuCtion.Id = idStr
menuMenuCtion.Name = mv.Title
menuMenuCtion.ParentId = strconv.FormatInt(mv.ParentId, 10)
menuMenuCtion.PathUrl = mv.ApiUrl
if publicmethod.IsInTrue[string](idStr, purview) == true {
menuMenuCtion.IsTrue = true
}
menuMenuCtion.Key = idStr
menuMenuCtion.MenuKey = fmt.Sprintf("m_%v", mv.Id)
menuMenuCtion.Attribute = 1
menusOperaList = append(menusOperaList, menuMenuCtion)
}
var operList []modelsschool.MenuOperation
overall.CONSTANT_DB_Master.Order("menu_id asc").Find(&operList)
if len(operList) > 0 {
for _, v := range operList {
idStr := strconv.FormatInt(v.OperId, 10)
var menuOperaCtion publicmethod.MenuContList
menuOperaCtion.Id = idStr
menuOperaCtion.Name = v.OperTitle
menuOperaCtion.ParentId = strconv.FormatInt(v.MenuId, 10)
menuOperaCtion.PathUrl = ""
if publicmethod.IsInTrue[string](idStr, operatIon) == true {
menuOperaCtion.IsTrue = true
}
menuOperaCtion.Key = idStr
menuOperaCtion.MenuKey = fmt.Sprintf("o_%v_%v", v.MenuId, v.OperId)
menuOperaCtion.Attribute = 4
menusOperaList = append(menusOperaList, menuOperaCtion)
}
}
menuThree = publicmethod.KpiMenuOperaTree("0", menusOperaList)
return
}
/*
*
@ 作者: 秦东
@ 时间: 2023-05-27 10:30:36
@ 功能: 应用平台菜单
@ 参数
#purview 菜单权限
#operatIon 附属权限
@ 返回值
#
@ 方法原型
#
*/
func appSystemMenuThree(purview []string) (menuThree []publicmethod.PowerThree) {
var menusList []modelAppPlatform.Menus
err := overall.CONSTANT_DB_AppPlatform.Where("visible IN ?", []int{1, 2}).Find(&menusList).Error
if err != nil && len(menusList) < 1 {
return
}
var menusOperaList []publicmethod.MenuContList
for _, v := range menusList {
keyStr := strconv.FormatInt(v.Perm, 10)
idStr := strconv.Itoa(v.Id)
var menuOperaCtion publicmethod.MenuContList
menuOperaCtion.Id = idStr
menuOperaCtion.Key = keyStr
menuOperaCtion.Name = v.Name
menuOperaCtion.ParentId = strconv.Itoa(v.ParentId)
menuOperaCtion.PathUrl = ""
if publicmethod.IsInTrue[string](idStr, purview) == true {
menuOperaCtion.IsTrue = true
}
menuOperaCtion.MenuKey = fmt.Sprintf("m_%v", v.Perm)
menuOperaCtion.Attribute = v.Types
menusOperaList = append(menusOperaList, menuOperaCtion)
}
menuThree = publicmethod.KpiMenuOperaTree("0", menusOperaList)
return
}
/*
*
@ 作者: 秦东
@ 时间: 2023-05-30 14:32:09
@ 功能:系统权限菜单(角色)
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) SystemAboutPowerMenuRole(c *gin.Context) {
var receivedValue GetSystemRoleMenuPower
err := c.ShouldBindJSON(&receivedValue)
if err != nil {
publicmethod.Result(100, err, c)
return
}
if receivedValue.Name == "" {
publicmethod.Result(101, err, c)
return
}
var systemPower modelssystempermission.Appsystem
err = systemPower.GetCont(map[string]interface{}{"`coder`": receivedValue.Name})
if err != nil {
publicmethod.Result(105, err, c)
return
}
if systemPower.State == 2 {
publicmethod.Result(1, err, c, "该系统授权已经禁用!")
return
}
if systemPower.State == 3 {
publicmethod.Result(1, err, c, "该系统授权已经取消合作!")
return
}
var menuThree []publicmethod.PowerThree
if systemPower.ApiUrl != "" {
//api入口不为空的情况下采用get访问方式接收数据
htmlByte := publicmethod.CurlGet(systemPower.ApiUrl)
// fmt.Printf("%v\n", string(htmlByte))
var jsonAry callBackUrlMenu
jsonErr := json.Unmarshal(htmlByte, &jsonAry)
if jsonErr != nil {
publicmethod.Result(1, jsonErr, c, "数据获取错误!")
return
}
if jsonAry.Code != 0 {
publicmethod.Result(1, jsonErr, c, jsonAry.Msg)
return
}
menuThree = jsonAry.Data
} else {
var pointInt []string
var operatIon []string
var systemEmpowerCont modelssystempermission.RoleEmpower
err = systemEmpowerCont.GetCont(map[string]interface{}{"`role_id`": receivedValue.RoleId, "`system`": systemPower.Coder}, "`point_id`", `operation`)
if err == nil {
pointInt = strings.Split(systemEmpowerCont.PointId, ",")
operatIon = strings.Split(systemEmpowerCont.Operation, ",")
}
//api入口为空,采用系统内置获取授权菜单
switch systemPower.Coder {
case "cangchu":
menuThree = wmsMenuThree(pointInt, operatIon)
// fmt.Printf("ApiUrl----2-->%v\n", systemPower.ApiUrl)
case "kpi":
//获取绩效考核菜单树
menuThree = kpiPostMenuThree(pointInt, operatIon)
default:
menuThree = appSystemMenuThree(pointInt)
// fmt.Printf("ApiUrl---1--->%v\n", systemPower.ApiUrl)
}
}
publicmethod.Result(0, menuThree, c)
}

89
api/version1/jurisdiction/jurisdictionpc/systemrole.go

@ -223,6 +223,86 @@ func (a *ApiMethod) EditSystemRoleState(c *gin.Context) {
publicmethod.Result(0, err, c) publicmethod.Result(0, err, c)
} }
/*
*
@ 作者: 秦东
@ 时间: 2023-05-30 11:20:46
@ 功能: 批量编辑系统角色状态
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) EditSystemRoleStateBatch(c *gin.Context) {
var receivedValue BatchRoleStatus
err := c.ShouldBindJSON(&receivedValue)
if err != nil {
publicmethod.Result(100, err, c)
return
}
if len(receivedValue.Id) < 1 {
publicmethod.Result(101, receivedValue, c)
return
}
if receivedValue.State == 0 {
receivedValue.State = 2
}
if receivedValue.IsTrue == 0 {
receivedValue.IsTrue = 2
}
if receivedValue.State != 3 {
editCont := publicmethod.MapOut[string]()
editCont["`state`"] = receivedValue.State
editCont["`time`"] = time.Now().Unix()
err = overall.CONSTANT_DB_System_Permission.Model(&modelssystempermission.SystemRole{}).Where("id IN ?", receivedValue.Id).Updates(editCont).Error
} else {
if receivedValue.IsTrue != 1 {
editCont := publicmethod.MapOut[string]()
editCont["`state`"] = receivedValue.State
editCont["`time`"] = time.Now().Unix()
err = overall.CONSTANT_DB_System_Permission.Model(&modelssystempermission.SystemRole{}).Where("id IN ?", receivedValue.Id).Updates(editCont).Error
} else {
err = overall.CONSTANT_DB_System_Permission.Where("id IN ?", receivedValue.Id).Delete(&modelssystempermission.SystemRole{}).Error
if err == nil {
ClearOutUserRole(receivedValue.Id)
}
}
}
if err != nil {
publicmethod.Result(106, err, c)
return
}
publicmethod.Result(0, err, c)
}
// 清楚人员中已删除得角色信息
func ClearOutUserRole(roleId []string) {
if len(roleId) < 1 {
return
}
var manList []modelshr.PersonArchives
err := overall.CONSTANT_DB_HR.Model(&modelshr.PersonArchives{}).Select("`id`,`role`").Where("`role` != '' AND `role` is not null").Find(&manList).Error
if err != nil {
return
}
for _, v := range manList {
roleUserList := strings.Split(v.Role, ",")
if len(roleUserList) > 0 {
newRole := publicmethod.DelMergeStruct[string](roleUserList, roleId)
var editUSer modelshr.PersonArchives
editUSer.EiteCont(map[string]interface{}{"`id`": v.Id}, map[string]interface{}{"`role`": strings.Join(newRole, ","), "`eite_time`": time.Now().Unix()})
}
}
fmt.Printf("manList-->%v\n", len(manList))
}
/* /*
* *
@ 作者: 秦东 @ 作者: 秦东
@ -251,7 +331,7 @@ func (a *ApiMethod) RoleAboutPeopleList(c *gin.Context) {
return return
} }
gormDb := overall.CONSTANT_DB_HR.Model(&modelshr.PersonArchives{}).Select("`id`,`number`,`name`,`icon`,`company`,`maindeparment`,`admin_org`,`position`,`job_id`,`key`,`wechat`,`work_wechat`").Where("`state` = 1 AND FIND_IN_SET(?,`role`)", receivedValue.Id) gormDb := overall.CONSTANT_DB_HR.Model(&modelshr.PersonArchives{}).Select("`id`,`number`,`name`,`icon`,`company`,`maindeparment`,`admin_org`,`position`,`job_id`,`key`,`wechat`,`work_wechat`,`icon_photo`").Where("`state` = 1 AND FIND_IN_SET(?,`role`)", receivedValue.Id)
if receivedValue.Name != "" { if receivedValue.Name != "" {
gormDb = gormDb.Where("`name` LIKE ? OR `number` LIKE ?", "%"+receivedValue.Name+"%", "%"+receivedValue.Name+"%") gormDb = gormDb.Where("`name` LIKE ? OR `number` LIKE ?", "%"+receivedValue.Name+"%", "%"+receivedValue.Name+"%")
} }
@ -265,11 +345,11 @@ func (a *ApiMethod) RoleAboutPeopleList(c *gin.Context) {
err := gormDb.Find(&RoleManList).Error err := gormDb.Find(&RoleManList).Error
if err != nil { if err != nil {
publicmethod.Result(105, err, c) publicmethod.Result(1, err, c, "当前角色没有使用人")
return return
} }
if len(RoleManList) < 1 { if len(RoleManList) < 1 {
publicmethod.Result(105, RoleManList, c) publicmethod.Result(1, RoleManList, c, "当前角色没有使用人")
return return
} }
var sendData []SendSystemRoleAboutPeopleList var sendData []SendSystemRoleAboutPeopleList
@ -304,7 +384,8 @@ func (a *ApiMethod) RoleAboutPeopleList(c *gin.Context) {
} else { } else {
sendDataInfo.DepartMentTitle = fmt.Sprintf("%v/%v", comInfo.Name, deparInfo.Name) sendDataInfo.DepartMentTitle = fmt.Sprintf("%v/%v", comInfo.Name, deparInfo.Name)
} }
sendDataInfo.Icon = v.Icon
sendDataInfo.IconBase64 = v.IconPhoto
sendData = append(sendData, sendDataInfo) sendData = append(sendData, sendDataInfo)
} }
publicmethod.ResultList(0, receivedValue.Page, receivedValue.PageSize, total, int64(len(sendData)), sendData, c) publicmethod.ResultList(0, receivedValue.Page, receivedValue.PageSize, total, int64(len(sendData)), sendData, c)

13
api/version1/jurisdiction/jurisdictionpc/type.go

@ -223,3 +223,16 @@ type OutPutUnify struct {
modelshr.PositionUnify modelshr.PositionUnify
PositionListId []int64 `json:"positionListId` //关联岗位ID PositionListId []int64 `json:"positionListId` //关联岗位ID
} }
// 输出系统列表
type SendSystemList struct {
modelssystempermission.Appsystem
Key string `json:"key"` //
}
// 批量编辑角色状态
type BatchRoleStatus struct {
Id []string `json:"id"` //
State int `json:"state"`
IsTrue int `json:"istrue"` //1:强制删除;非1:软删除
}

4
api/workflow/currency_recipe/general_method.go

@ -156,7 +156,7 @@ func (w *WorkflowEngine) promoter() (nodeList []NodeCont, isTrue bool, msg strin
nodeCont.UserList = append(nodeCont.UserList, SetOperator(w.ApplicantCont)) nodeCont.UserList = append(nodeCont.UserList, SetOperator(w.ApplicantCont))
nodeList = append(nodeList, nodeCont) nodeList = append(nodeList, nodeCont)
// var childNode *PublicChildNode // var childNode *PublicChildNode
// fmt.Printf("nodeConfig.ChildNode-->%v\n", nodeConfig.ChildNode) fmt.Printf("nodeConfig.ChildNode-->%v\n", nodeConfig.ChildNode)
childNode := nodeConfig.ChildNode childNode := nodeConfig.ChildNode
acceptOrgId, _ := strconv.ParseInt(w.AcceptOrg, 10, 64) acceptOrgId, _ := strconv.ParseInt(w.AcceptOrg, 10, 64)
// nodeListCont, isTrues, msgs := childNode.AnalysisNode(w.Step, childNode.Attribute, w.StarNodeNumber, w.ApplicantCont, acceptOrgId) // nodeListCont, isTrues, msgs := childNode.AnalysisNode(w.Step, childNode.Attribute, w.StarNodeNumber, w.ApplicantCont, acceptOrgId)
@ -500,7 +500,7 @@ func (g *GainLeveDirector) GetPostBaseOrg(unifyPosId string, orgList []int64, my
var userInfoList []modelshr.PersonArchives var userInfoList []modelshr.PersonArchives
gormDb := overall.CONSTANT_DB_HR.Where("`position` = ? AND `admin_org` = ? AND `emp_type` BETWEEN ? AND ?", ovp.PositionId, ovp.OrgId, 1, 10) gormDb := overall.CONSTANT_DB_HR.Where("`position` = ? AND `admin_org` = ? AND `emp_type` BETWEEN ? AND ?", ovp.PositionId, ovp.OrgId, 1, 10)
if ovp.Weight >= 8 { if ovp.Weight >= 8 {
gormDb = gormDb.Where("`person_in_charge` = 1") gormDb = gormDb.Where("`person_in_charge` = 1 AND FIND_IN_SET(?,`responsible_department`)", myOrgId)
} }
err = gormDb.Find(&userInfoList).Error err = gormDb.Find(&userInfoList).Error
if err == nil && len(userInfoList) > 0 { if err == nil && len(userInfoList) > 0 {

1
apirouter/apishiyan/maptostruct.go

@ -30,6 +30,7 @@ func (a *ApiRouter) RouterGroup(router *gin.RouterGroup) {
apiRouter.POST("verif_depart_sontarget", methodBinding.VerifDepartSonTarget) //验证部门子栏目关联对照 apiRouter.POST("verif_depart_sontarget", methodBinding.VerifDepartSonTarget) //验证部门子栏目关联对照
apiRouter.POST("verif_depart_detasil", methodBinding.VerifDepartDetasil) //验证部门指标细则关系对照 apiRouter.POST("verif_depart_detasil", methodBinding.VerifDepartDetasil) //验证部门指标细则关系对照
apiRouter.POST("new_verif_depart_detasil", methodBinding.XiaoZhengBumenBylaws) //验证部门指标细则关系对照 apiRouter.POST("new_verif_depart_detasil", methodBinding.XiaoZhengBumenBylaws) //验证部门指标细则关系对照
apiRouter.POST("xiao_zheng_fangan", methodBinding.XiaoZhengFangAn) //验证部门方案指标细则关系对照
apiRouter.POST("xzbkhbm", methodBinding.XiangzhengBeikaoBumen) //验证部门指标细则关系对照 apiRouter.POST("xzbkhbm", methodBinding.XiangzhengBeikaoBumen) //验证部门指标细则关系对照

6
apirouter/v1/systempower/pc.go

@ -26,12 +26,15 @@ func (a *ApiRouter) RouterGroupPc(router *gin.RouterGroup) {
//相关系统菜单 //相关系统菜单
apiRouter.POST("system_about_menu", methodBinding.SystemAboutMenu) //系统菜单行政组织岗位 apiRouter.POST("system_about_menu", methodBinding.SystemAboutMenu) //系统菜单行政组织岗位
apiRouter.POST("system_about_role_menu", methodBinding.SystemRoleAboutMenu) //系统菜单角色 apiRouter.POST("system_about_role_menu", methodBinding.SystemRoleAboutMenu) //系统菜单角色
apiRouter.POST("system_about_power_menu", methodBinding.SystemAboutPowerMenu) //系统权限菜单(岗位)
apiRouter.POST("system_about_power_menurole", methodBinding.SystemAboutPowerMenuRole) //系统权限菜单(角色)
//角色 //角色
apiRouter.POST("add_system_role", methodBinding.AddSystemRole) //系统角色添加 apiRouter.POST("add_system_role", methodBinding.AddSystemRole) //系统角色添加
apiRouter.POST("edit_system_role", methodBinding.EditSystemRole) //系统角色编辑 apiRouter.POST("edit_system_role", methodBinding.EditSystemRole) //系统角色编辑
apiRouter.POST("system_role_list", methodBinding.SystemRoleList) //系统角色列表 apiRouter.POST("system_role_list", methodBinding.SystemRoleList) //系统角色列表
apiRouter.POST("edit_system_role_state", methodBinding.EditSystemRoleState) //系统角色状态 apiRouter.POST("edit_system_role_state", methodBinding.EditSystemRoleState) //系统角色状态
apiRouter.POST("edit_system_role_statebatch", methodBinding.EditSystemRoleStateBatch) //批量编辑系统角色状态
apiRouter.POST("role_about_people_list", methodBinding.RoleAboutPeopleList) //角色相关人员 apiRouter.POST("role_about_people_list", methodBinding.RoleAboutPeopleList) //角色相关人员
apiRouter.POST("batch_del_roleman", methodBinding.BatchDeletToRoleAboutMan) //批量删除角色关联人员 apiRouter.POST("batch_del_roleman", methodBinding.BatchDeletToRoleAboutMan) //批量删除角色关联人员
apiRouter.POST("add_role_user", methodBinding.AddRoleUser) //添加角色关联人员 apiRouter.POST("add_role_user", methodBinding.AddRoleUser) //添加角色关联人员
@ -41,5 +44,8 @@ func (a *ApiRouter) RouterGroupPc(router *gin.RouterGroup) {
apiRouter.POST("search_people", methodBinding.SearchPeople) //搜索人员 apiRouter.POST("search_people", methodBinding.SearchPeople) //搜索人员
apiRouter.POST("get_position_unify", methodBinding.GetPositionUnify) //获取统一岗位 apiRouter.POST("get_position_unify", methodBinding.GetPositionUnify) //获取统一岗位
apiRouter.POST("search_position_unify", methodBinding.SearchPositionUnify) //搜索统一岗位 apiRouter.POST("search_position_unify", methodBinding.SearchPositionUnify) //搜索统一岗位
//授权
apiRouter.POST("grant_post_system_powers", methodBinding.GrantPostSystemPowers) //给指定岗位授权
apiRouter.POST("grant_role_system_powers", methodBinding.GrantRoleSystemPowers) //给指角色位授权
} }
} }

1
config/configDatabase/database.go

@ -11,6 +11,7 @@ import (
type MysqlSetUp struct { type MysqlSetUp struct {
MasterMysql MasterMysqlSetUp `mapstructure:"master" json:"master" yaml:"master"` //主数据库 MasterMysql MasterMysqlSetUp `mapstructure:"master" json:"master" yaml:"master"` //主数据库
AppPlatformDatabase MasterMysqlSetUp `mapstructure:"appPlatformDatabase" json:"appPlatformDatabase" yaml:"appPlatformDatabase"` //应用平台
//其他数据库依次添加 //其他数据库依次添加
WechatMysql MasterMysqlSetUp `mapstructure:"wechat" json:"wechat" yaml:"wechat"` //微信数据库 WechatMysql MasterMysqlSetUp `mapstructure:"wechat" json:"wechat" yaml:"wechat"` //微信数据库
HrMysql MasterMysqlSetUp `mapstructure:"hrdatabase" json:"hrdatabase" yaml:"hrdatabase"` //HR数据库 HrMysql MasterMysqlSetUp `mapstructure:"hrdatabase" json:"hrdatabase" yaml:"hrdatabase"` //HR数据库

14
config/configDatabase/database.yaml

@ -234,3 +234,17 @@ storage:
max_idle_conns: 100 #最大空闲数量 max_idle_conns: 100 #最大空闲数量
max_open_conns: 1500 #最大打开数量 max_open_conns: 1500 #最大打开数量
gorm_log: true #是否开启gorm日志 gorm_log: true #是否开启gorm日志
#应用平台数据库
appPlatformDatabase:
url_path: '127.0.0.1' #数据库地址
port: 3306 #数据库端口
charset: 'utf8mb4' #数据库编码方式
parseTime: 'True' #是否自动转换时间
loc: 'Local' #时区
name: 'app_platform' #数据库名称
username: 'root' #数据库用户民
password: 'root' #数据库密码
max_idle_conns: 100 #最大空闲数量
max_open_conns: 1500 #最大打开数量
gorm_log: true #是否开启gorm日志

7
initialization/databaseinit/mysql.go

@ -16,6 +16,13 @@ func LoadDatabase() {
} else { } else {
fmt.Printf("%v数据库开启成功!\n", sqlConfig.MasterMysql.Name) fmt.Printf("%v数据库开启成功!\n", sqlConfig.MasterMysql.Name)
} }
//开启主数据库
overall.CONSTANT_DB_AppPlatform = sqlConfig.AppPlatformDatabase.OpenSql()
if overall.CONSTANT_DB_AppPlatform == nil {
fmt.Printf("%v数据库开启失败!\n", sqlConfig.AppPlatformDatabase.Name)
} else {
fmt.Printf("%v数据库开启成功!\n", sqlConfig.AppPlatformDatabase.Name)
}
//开启微信数据库 //开启微信数据库
overall.CONSTANT_DB_Wechat = sqlConfig.WechatMysql.OpenSql() overall.CONSTANT_DB_Wechat = sqlConfig.WechatMysql.OpenSql()
if overall.CONSTANT_DB_Master == nil { if overall.CONSTANT_DB_Master == nil {

61
models/modelAppPlatform/dict_type.go

@ -0,0 +1,61 @@
package modelAppPlatform
import (
"key_performance_indicators/overall"
"strings"
)
// 字典类型
type DictType struct {
Id int `json:"id" gorm:"primaryKey;column:id;type:int(5) unsigned;not null;comment:Id;index"`
Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:字典类型名称"`
Code int64 `json:"code" gorm:"column:code;type:bigint(20) unsigned;default:0;not null;comment:字典类型编码"`
Status int `json:"status" gorm:"column:status;type:int(1) unsigned;default:1;not null;comment:显示状态(1:显示;2:隐藏,3:删除)"`
Remark string `json:"remark" gorm:"column:remark;type:mediumtext;default:'';comment:字典类型描述"`
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"`
}
func (DictType *DictType) TableName() string {
return "dict_type"
}
// 编辑内容
func (cont *DictType) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_AppPlatform.Model(&cont).Where(whereMap).Updates(saveData).Error
return
}
// 获取内容
func (cont *DictType) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_AppPlatform.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 *DictType) CountCont(whereMap interface{}) (countId int64) {
overall.CONSTANT_DB_AppPlatform.Model(&cont).Where(whereMap).Count(&countId)
return
}
// 读取全部信息
func (cont *DictType) ContMap(whereMap interface{}, field ...string) (countAry []DictType, err error) {
gormDb := overall.CONSTANT_DB_AppPlatform.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
err = gormDb.Where(whereMap).Find(&countAry).Error
return
}
// 删除内容
func (cont *DictType) DelCont(whereMap interface{}) (err error) {
err = overall.CONSTANT_DB_AppPlatform.Where(whereMap).Delete(&cont).Error
return
}

63
models/modelAppPlatform/dictionary.go

@ -0,0 +1,63 @@
package modelAppPlatform
import (
"key_performance_indicators/overall"
"strings"
)
// 字典内容
type Dictionary struct {
Id int `json:"id" gorm:"primaryKey;column:id;type:int(5) unsigned;not null;comment:Id;index"`
Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:字典内容名称"`
TypeCode int64 `json:"typeCode" gorm:"column:typeCode;type:bigint(20) unsigned;default:0;not null;comment:字典类型编码"`
Code int64 `json:"code" gorm:"column:code;type:bigint(20) unsigned;default:0;not null;comment:字典内编码"`
Sort int `json:"sort" gorm:"column:sort;type:int(1) unsigned;default:50;not null;comment:排序(数字越小排名越靠前))"`
Status int `json:"status" gorm:"column:status;type:int(1) unsigned;default:1;not null;comment:显示状态(1:显示;2:隐藏,3:删除)"`
Remark string `json:"remark" gorm:"column:remark;type:mediumtext;default:'';comment:字典内描述"`
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"`
}
func (Dictionary *Dictionary) TableName() string {
return "dictionary"
}
// 编辑内容
func (cont *Dictionary) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_AppPlatform.Model(&cont).Where(whereMap).Updates(saveData).Error
return
}
// 获取内容
func (cont *Dictionary) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_AppPlatform.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 *Dictionary) CountCont(whereMap interface{}) (countId int64) {
overall.CONSTANT_DB_AppPlatform.Model(&cont).Where(whereMap).Count(&countId)
return
}
// 读取全部信息
func (cont *Dictionary) ContMap(whereMap interface{}, field ...string) (countAry []Dictionary, err error) {
gormDb := overall.CONSTANT_DB_AppPlatform.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
err = gormDb.Where(whereMap).Find(&countAry).Error
return
}
// 删除内容
func (cont *Dictionary) DelCont(whereMap interface{}) (err error) {
err = overall.CONSTANT_DB_AppPlatform.Where(whereMap).Delete(&cont).Error
return
}

67
models/modelAppPlatform/menus.go

@ -0,0 +1,67 @@
package modelAppPlatform
import (
"key_performance_indicators/overall"
"strings"
)
// 行政组织类型
type Menus struct {
Id int `json:"id" gorm:"primaryKey;column:id;type:int(5) unsigned;not null;comment:Id;index"`
Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:菜单名称"`
Types int `json:"type" gorm:"column:type;type:int(1) unsigned;default:1;not null;comment:菜单类型(1-菜单;2-目录;3-外链;4-按钮权限"`
Path string `json:"path" gorm:"column:path;type:varchar(255) ;default:'';comment:路由路径"`
Component string `json:"component" gorm:"column:component;type:varchar(255) ;default:'';comment:组件路径(vue页面完整路径,省略.vue后缀)"`
Perm int64 `json:"perm" gorm:"column:perm;type:bigint(20) unsigned;default:0;not null;comment:权限标识"`
Visible int `json:"visible" gorm:"column:visible;type:int(1) unsigned;default:1;not null;comment:显示状态(1:显示;2:隐藏,3:删除)"`
Sort int `json:"sort" gorm:"column:sort;type:int(1) unsigned;default:50;not null;comment:排序(数字越小排名越靠前))"`
Icon string `json:"icon" gorm:"column:icon;type:varchar(255) ;default:'';comment:菜单图标"`
Redirect string `json:"redirect" gorm:"column:redirect;type:varchar(255) ;default:'';comment:跳转路径"`
ParentId int `json:"parentId" gorm:"column:parentId;type:int(5) unsigned;default:0;not null;comment:父菜单ID"`
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"`
}
func (menus *Menus) TableName() string {
return "menus"
}
// 编辑内容
func (cont *Menus) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_AppPlatform.Model(&cont).Where(whereMap).Updates(saveData).Error
return
}
// 获取内容
func (cont *Menus) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_AppPlatform.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 *Menus) CountCont(whereMap interface{}) (countId int64) {
overall.CONSTANT_DB_AppPlatform.Model(&cont).Where(whereMap).Count(&countId)
return
}
// 读取全部信息
func (cont *Menus) ContMap(whereMap interface{}, field ...string) (countAry []Menus, err error) {
gormDb := overall.CONSTANT_DB_AppPlatform.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
err = gormDb.Where(whereMap).Find(&countAry).Error
return
}
// 删除内容
func (cont *Menus) DelCont(whereMap interface{}) (err error) {
err = overall.CONSTANT_DB_AppPlatform.Where(whereMap).Delete(&cont).Error
return
}

1
overall/appConfig.go

@ -25,6 +25,7 @@ var (
CONSTANT_CONFIG configApp.Server CONSTANT_CONFIG configApp.Server
// //
CONSTANT_DB_Master *gorm.DB //主数据库 CONSTANT_DB_Master *gorm.DB //主数据库
CONSTANT_DB_AppPlatform *gorm.DB //应用平台据库
CONSTANT_DB_Wechat *gorm.DB //微信数据库 CONSTANT_DB_Wechat *gorm.DB //微信数据库
CONSTANT_DB_HR *gorm.DB //HR数据库 CONSTANT_DB_HR *gorm.DB //HR数据库
CONSTANT_DB_FILE_BOOK *gorm.DB //文档属性数据库 CONSTANT_DB_FILE_BOOK *gorm.DB //文档属性数据库

98
overall/publicmethod/technique.go

@ -766,6 +766,20 @@ func GetDepartmentSun(superior int64, idary []int64) (orgIdAry []int64) {
return return
} }
func (g *GetOrgAllSun) GetOrgSun(superior int64) {
var id []int64
err := overall.CONSTANT_DB_HR.Model(&modelshr.AdministrativeOrganization{}).Select("`id`").Where("`state` = 1 AND `superior` = ?", superior).Find(&id).Error
if err != nil || len(id) < 1 {
return
}
for _, v := range id {
if !IsInTrue[int64](v, g.Id) {
g.Id = append(g.Id, v)
}
g.GetOrgSun(v)
}
}
// 获取集团或第一实权部门 // 获取集团或第一实权部门
func GetGroupOrDepartPower(parentId int64, departId ...int64) int64 { func GetGroupOrDepartPower(parentId int64, departId ...int64) int64 {
var orgCont modelshr.AdministrativeOrganization var orgCont modelshr.AdministrativeOrganization
@ -1033,6 +1047,9 @@ func GetMenuThrees(jurisd int, parentId string, threeData []MenuContList) []Powe
node.ParentId = v.ParentId node.ParentId = v.ParentId
node.Child = child node.Child = child
node.IsTrue = v.IsTrue node.IsTrue = v.IsTrue
node.Attribute = 1
node.Key = v.Key
node.MenuKey = v.MenuKey
// fmt.Printf("GetMenuThree-22222--%v--->%v\n", v.Id, node) // fmt.Printf("GetMenuThree-22222--%v--->%v\n", v.Id, node)
treeList = append(treeList, node) treeList = append(treeList, node)
} }
@ -1355,11 +1372,11 @@ func GetPostOfUsEmpowerCont(orgId, postId int64, systemName string) (sysPowerCon
#func GetNewAccredit(systemName, roleId string, userKey, orgId, postId int64) (roleName, pointId, operation string, level int) #func GetNewAccredit(systemName, roleId string, userKey, orgId, postId int64) (roleName, pointId, operation string, level int)
*/ */
func GetNewAccredit(systemName, roleId string, userKey, orgId, postId int64) (roleName, pointId, operation string, level int) { func GetNewAccredit(systemName, roleId string, userKey, orgId, postId int64) (roleName, pointId, operation string, level int) {
fmt.Printf("jsonStr---1--->%v---->%v---->%v---->%v---->%v\n", systemName, roleId, userKey, orgId, postId) // fmt.Printf("jsonStr---1--->%v---->%v---->%v---->%v---->%v\n", systemName, roleId, userKey, orgId, postId)
redisFileKey := fmt.Sprintf("Licence:PowerLoginApi_%v_%v_%v_%v", systemName, userKey, orgId, postId) redisFileKey := fmt.Sprintf("Licence:PowerLoginApi_%v_%v_%v_%v", systemName, userKey, orgId, postId)
redisClient := grocerystore.RunRedis(overall.CONSTANT_REDIS3) redisClient := grocerystore.RunRedis(overall.CONSTANT_REDIS3)
userRedisToken, isTrue := redisClient.HashGetAll(redisFileKey) userRedisToken, isTrue := redisClient.HashGetAll(redisFileKey)
fmt.Printf("jsonStr---2--->%v---->%v---->%v---->%v---->%v---->%v\n", systemName, roleId, userKey, orgId, postId, userRedisToken) // fmt.Printf("jsonStr---2--->%v---->%v---->%v---->%v---->%v---->%v\n", systemName, roleId, userKey, orgId, postId, userRedisToken)
if isTrue == false { if isTrue == false {
var pointIdAry []string var pointIdAry []string
@ -1368,20 +1385,22 @@ func GetNewAccredit(systemName, roleId string, userKey, orgId, postId int64) (ro
roleIdAry := strings.Split(roleId, ",") roleIdAry := strings.Split(roleId, ",")
var roleCont []modelssystempermission.SystemRole var roleCont []modelssystempermission.SystemRole
if len(roleIdAry) > 0 { if len(roleIdAry) > 0 {
var roleNewIdList []int64
//获取角色名称 //获取角色名称
err := overall.CONSTANT_DB_System_Permission.Model(&modelssystempermission.SystemRole{}).Select("`name`").Where("`id` IN ?", roleIdAry).Find(&roleCont).Error err := overall.CONSTANT_DB_System_Permission.Model(&modelssystempermission.SystemRole{}).Select("`id`,`name`").Where("`state` = 1 AND `id` IN ?", roleIdAry).Find(&roleCont).Error
if err == nil && len(roleCont) > 0 { if err == nil && len(roleCont) > 0 {
var roleNameAry []string var roleNameAry []string
for _, rnv := range roleCont { for _, rnv := range roleCont {
if IsInTrue[string](rnv.Name, roleNameAry) == false { if IsInTrue[string](rnv.Name, roleNameAry) == false {
roleNameAry = append(roleNameAry, rnv.Name) roleNameAry = append(roleNameAry, rnv.Name)
} }
roleNewIdList = append(roleNewIdList, rnv.Id)
} }
roleName = strings.Join(roleNameAry, "|") roleName = strings.Join(roleNameAry, "|")
} }
//获取配置的所有角色权限 //获取配置的所有角色权限
var roleEmpowerCont []modelssystempermission.RoleEmpower var roleEmpowerCont []modelssystempermission.RoleEmpower
err = overall.CONSTANT_DB_System_Permission.Model(&modelssystempermission.RoleEmpower{}).Select("`point_id`,`operation`,`level`").Where("`system` = ? AND `role_id` IN ?", systemName, roleIdAry).Find(&roleEmpowerCont).Error err = overall.CONSTANT_DB_System_Permission.Model(&modelssystempermission.RoleEmpower{}).Select("`point_id`,`operation`,`level`").Where("`system` = ? AND `role_id` IN ?", systemName, roleNewIdList).Find(&roleEmpowerCont).Error
if err == nil && len(roleEmpowerCont) > 0 { if err == nil && len(roleEmpowerCont) > 0 {
for _, rev := range roleEmpowerCont { for _, rev := range roleEmpowerCont {
menuList := strings.Split(rev.PointId, ",") menuList := strings.Split(rev.PointId, ",")
@ -1629,6 +1648,8 @@ func GetMenuThreePeiQuan(jurisd int, parentId string, threeData []MenuContList,
node.Name = v.Name node.Name = v.Name
node.ParentId = v.ParentId node.ParentId = v.ParentId
node.IsTrue = v.IsTrue node.IsTrue = v.IsTrue
node.Attribute = 1
node.Key = v.Key
isTrue, menuOper := MenuOperationPeiQuan(jurisd, v.Id, oper) isTrue, menuOper := MenuOperationPeiQuan(jurisd, v.Id, oper)
if isTrue == true { if isTrue == true {
node.MenuOperation = menuOper node.MenuOperation = menuOper
@ -1666,6 +1687,7 @@ func MenuOperationPeiQuan(jurisd int, menuId string, oper []string) (isTrue bool
if IsInTrue[string](idStr, oper) == true { if IsInTrue[string](idStr, oper) == true {
menSmaiCont.IsTrue = true menSmaiCont.IsTrue = true
} }
menSmaiCont.Attribute = 2
operation = append(operation, menSmaiCont) operation = append(operation, menSmaiCont)
} }
// fmt.Printf("ApiUrl---%v--->%v--->%v--->%v\n", menuId, isTrue, operErr, operList) // fmt.Printf("ApiUrl---%v--->%v--->%v--->%v\n", menuId, isTrue, operErr, operList)
@ -1708,6 +1730,32 @@ func MergeStruct[T GenericityVariable](aryOen, aryTwo []T) (structAry []T) {
return return
} }
/*
*
@ 作者: 秦东
@ 时间: 2023-05-30 13:05:44
@ 功能: 删除数组中指定元素
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func DelMergeStruct[T GenericityVariable](yuanKeyAry, delKeyAry []T) (structAry []T) {
for _, v := range yuanKeyAry {
if !IsInTrue[T](v, delKeyAry) {
structAry = append(structAry, v)
}
}
return
}
// 根据字符串组合时间 // 根据字符串组合时间
/* /*
#dateTime 日期 #dateTime 日期
@ -2133,3 +2181,45 @@ func StrNumberToInt64(val string, cheng float64) (valInt int64) {
valInt, _ = strconv.ParseInt(valStr, 10, 64) valInt, _ = strconv.ParseInt(valStr, 10, 64)
return return
} }
/*
*
@ 作者: 秦东
@ 时间: 2023-05-27 09:01:04
@ 功能: Kpi菜单权限树
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func KpiMenuOperaTree(parentId string, treeCont []MenuContList) (treeList []PowerThree) {
for _, v := range treeCont {
if v.ParentId == parentId {
var child []PowerThree
if v.Attribute != 4 {
child = KpiMenuOperaTree(v.Id, treeCont)
}
var node PowerThree
node.Id = v.Id
node.Name = v.Name
node.ParentId = v.ParentId
node.Child = child
node.IsTrue = v.IsTrue
node.PathUrl = v.PathUrl
node.Attribute = v.Attribute
node.Key = v.Key
node.MenuKey = v.MenuKey //识别标志
// fmt.Printf("GetMenuThree-22222--%v--->%v\n", v.Id, node)
treeList = append(treeList, node)
}
}
return
}

9
overall/publicmethod/type.go

@ -85,6 +85,9 @@ type MenuContList struct {
ParentId string `json:"parentid"` //上级 ParentId string `json:"parentid"` //上级
PathUrl string `json:"pathurl"` //访问路径 PathUrl string `json:"pathurl"` //访问路径
IsTrue bool `json:"istrue"` //是否已授权 true:授权,false:未授权 IsTrue bool `json:"istrue"` //是否已授权 true:授权,false:未授权
MenuKey string `json:"menukey"` //识别标志
Key string `json:"key"` //
Attribute int `json:"attribute"` //属性
} }
// 权限菜单树 // 权限菜单树
@ -142,6 +145,8 @@ type PostPeople struct {
DutiesId string `json:"dutiesid"` DutiesId string `json:"dutiesid"`
DutiesName string `json:"dutiesname"` DutiesName string `json:"dutiesname"`
Wechat string `json:"wechat"` Wechat string `json:"wechat"`
Icon string `json:"icon"`
IconBase64 string `json:"iconbase64"`
} }
// 权限分配详情分解 // 权限分配详情分解
@ -291,3 +296,7 @@ type WechatCallBack struct {
MsgId string `json:"msgid"` //消息id,用于撤回应用消息 MsgId string `json:"msgid"` //消息id,用于撤回应用消息
ResponseCode string `json:"response_code"` //仅消息类型为“按钮交互型”,“投票选择型”和“多项选择型”的模板卡片消息返回,应用可使用response_code调用更新模版卡片消息接口,72小时内有效,且只能使用一次 ResponseCode string `json:"response_code"` //仅消息类型为“按钮交互型”,“投票选择型”和“多项选择型”的模板卡片消息返回,应用可使用response_code调用更新模版卡片消息接口,72小时内有效,且只能使用一次
} }
type GetOrgAllSun struct {
Id []int64
}

Loading…
Cancel
Save