Browse Source

手机端首页接口

v1_dev_2
超级管理员 3 years ago
parent
commit
cc449056a2
  1. 87
      api/shiyan/maptostruct/department.go
  2. 4
      api/shiyan/maptostruct/type.go
  3. 10
      api/version1/departmentseting/departmentpc/dingliang.go
  4. 1614
      api/version1/departmentseting/departmentweb/department.go
  5. 209
      api/version1/departmentseting/departmentweb/type.go
  6. 46
      api/workflow/workflowengine/class.go
  7. 151
      api/workflow/workflowengine/flowhandle.go
  8. 3
      api/workflow/workflowengine/shiyan.go
  9. 2
      apirouter/apishiyan/maptostruct.go
  10. 10
      apirouter/v1/departmentseting/web.go
  11. 4
      apirouter/workflowrouter/flowrouter.go
  12. 4
      config/configDatabase/database.go
  13. 1
      models/modelshr/administrative_organization.go
  14. 201
      overall/publicmethod/technique.go
  15. 16
      overall/publicmethod/type.go

87
api/shiyan/maptostruct/department.go

@ -1,6 +1,7 @@
package maptostruct package maptostruct
import ( import (
"fmt"
"key_performance_indicators/models/modelshr" "key_performance_indicators/models/modelshr"
"key_performance_indicators/models/modelskpi" "key_performance_indicators/models/modelskpi"
"key_performance_indicators/overall" "key_performance_indicators/overall"
@ -273,26 +274,84 @@ func ChuLiTiBaoRenGuoDu(dimensionId, targetId, targetSunId, targetBylaws, postId
/* /*
* *
@ 作者: 秦东 @ 作者: 秦东
@ 时间: 2023-02-07 11:29:53 @ 时间: 2023-03-17 14:00:49
@ 功能: 处理指标提交人 @ 功能: 校正被考核部门
@ 参数 @ 参数
#dimensionId 纬度 #
#targetId 指标
#targetSunId 栏目
#targetBylaws 指标细则
#orgId 行政组织ID
#postId 岗位
#typeInt 类型1公司级2部门级
#manKey 提报人Key
#class 1定性考核2定量考核
#level 1指标2子目标3细则
@ 返回值 @ 返回值
#err #
@ 方法原型 @ 方法原型
#handTarReport(dimensionId, targetId, targetSunId, targetBylaws, postId int64, typeInt, class, level int, orgId, manKey string) (err error) #
*/ */
func (a *ApiMethod) XiangzhengBeikaoBumen(c *gin.Context) {
var receivedValue XiaoZengTime
err := c.ShouldBindJSON(&receivedValue)
if err != nil {
publicmethod.Result(100, err, c)
return
}
if receivedValue.DateTime == "" {
publicmethod.Result(100, err, c)
return
}
tayTime := time.Now().Unix()
currentYears := publicmethod.UnixTimeToDay(tayTime, 16)
currentMonths := publicmethod.UnixTimeToDay(tayTime, 17)
if receivedValue.DateTime != "" {
var dayTime publicmethod.DateTimeTotimes
dayTime.BaisStrToTime(receivedValue.DateTime)
if dayTime.Years != "" {
currentYears = dayTime.Years
}
if dayTime.Months != "" {
currentMonths = dayTime.Months
}
}
riQiStr := fmt.Sprintf("%v-%v", currentYears, currentMonths)
startTime, endTime := publicmethod.GetAppointMonthStarAndEndTime(riQiStr)
var evalProcess []modelskpi.EvaluationProcess
err = overall.CONSTANT_DB_KPI.Where("`ep_happen_time` BETWEEN ? AND ?", startTime, endTime).Find(&evalProcess).Error
if err != nil || len(evalProcess) < 1 {
publicmethod.Result(107, err, c)
return
}
for _, v := range evalProcess {
if v.TypeClass == 1 {
//定性
HuiGaiDingXing(v.OrderKey)
} else {
//定量
HuiGaiDingLiang(v.OrderKey)
}
}
publicmethod.Result(0, err, c)
}
// 回改定量考核部门
func HuiGaiDingLiang(key int64) {
var scoreFlowCont modelskpi.FlowLog
err := scoreFlowCont.GetCont(map[string]interface{}{"`fl_key`": key}, "`fl_duty_department`")
if err == nil {
if scoreFlowCont.DutyDepartment != 0 {
var evalProCont modelskpi.EvaluationProcess
evalProCont.EiteCont(map[string]interface{}{"`ep_order_key`": key}, map[string]interface{}{"`ep_accept_department`": scoreFlowCont.DutyDepartment})
}
}
}
// 回改定性考核部门
func HuiGaiDingXing(key int64) {
var scoreFlowCont modelskpi.ScoreFlow
err := scoreFlowCont.GetCont(map[string]interface{}{"`sf_key`": key}, "`sf_duty_department`")
if err == nil {
if scoreFlowCont.DutyDepartment != 0 {
var evalProCont modelskpi.EvaluationProcess
evalProCont.EiteCont(map[string]interface{}{"`ep_order_key`": key}, map[string]interface{}{"`ep_accept_department`": scoreFlowCont.DutyDepartment})
}
}
}

4
api/shiyan/maptostruct/type.go

@ -66,3 +66,7 @@ type hrUsernameAndPassword struct {
VerificationCode string `json:"verification_code"` VerificationCode string `json:"verification_code"`
publicmethod.PublicName publicmethod.PublicName
} }
type XiaoZengTime struct {
DateTime string `json"datetime"`
}

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

@ -113,17 +113,17 @@ func (a *ApiMethod) GetQuantitativeTasks(c *gin.Context) {
sendCont.DimensionWeight, sendCont.TargetWeight = getPlanVersionWeghit(v.QualEvalId, strconv.FormatInt(v.Dimension, 10), strconv.FormatInt(v.Target, 10)) sendCont.DimensionWeight, sendCont.TargetWeight = getPlanVersionWeghit(v.QualEvalId, strconv.FormatInt(v.Dimension, 10), strconv.FormatInt(v.Target, 10))
//获取目标设定 //获取目标设定
quanTitWhere := publicmethod.MapOut[string]() quanTitWhere := publicmethod.MapOut[string]()
quanTitWhere["company_id"] = v.Group // quanTitWhere["company_id"] = v.Group
quanTitWhere["department_id"] = v.AcceptEvaluation quanTitWhere["departmentid"] = v.AcceptEvaluation
quanTitWhere["dimension"] = v.Dimension // quanTitWhere["dimension"] = v.Dimension
quanTitWhere["target"] = v.Target quanTitWhere["target"] = v.Target
if v.DetailedTarget != 0 { if v.DetailedTarget != 0 {
quanTitWhere["detailed"] = v.DetailedTarget quanTitWhere["targetconfig"] = v.DetailedTarget
} }
quanTitWhere["year"] = publicmethod.UnixTimeToDay(time.Now().Unix(), 16) quanTitWhere["year"] = publicmethod.UnixTimeToDay(time.Now().Unix(), 16)
quanTitWhere["timecopy"] = AllZreoConfig(v.Cycles) quanTitWhere["timecopy"] = AllZreoConfig(v.Cycles)
//目标值设定 //目标值设定
var quanTitCont modelskpi.QuanPeopleConfig var quanTitCont modelskpi.QuantitativeConfig
quanTitCont.GetCont(quanTitWhere) quanTitCont.GetCont(quanTitWhere)
//全奖值、零奖值、封顶值 //全奖值、零奖值、封顶值
sendCont.ZeroPrize = strconv.FormatFloat(float64(quanTitCont.Zeroprize)/100, 'f', -1, 64) sendCont.ZeroPrize = strconv.FormatFloat(float64(quanTitCont.Zeroprize)/100, 'f', -1, 64)

1614
api/version1/departmentseting/departmentweb/department.go

File diff suppressed because it is too large

209
api/version1/departmentseting/departmentweb/type.go

@ -2,15 +2,224 @@ package departmentweb
import ( import (
"key_performance_indicators/overall/publicmethod" "key_performance_indicators/overall/publicmethod"
"sync"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
type ApiMethod struct{} type ApiMethod struct{}
// 协程设置
var SyncSeting = sync.WaitGroup{}
var SyncSetinges = sync.WaitGroup{}
// 获取综合统计数值
type GetDttsb struct {
Target []GetDttsbCont
Actuality []GetDttsbCont
CompletionRate []GetDttsbCont
AxisLeftMax float64
AxisLeftMin float64
AxisRightMax float64
AxisRightMin float64
mutext sync.RWMutex
}
type GetDttsbCont struct {
Val float64
Sort int
}
// 读取数据
func (g *GetDttsb) readPlanTaskData() ([]GetDttsbCont, []GetDttsbCont, []GetDttsbCont, float64, float64, float64, float64) {
g.mutext.RLock()
defer g.mutext.RUnlock()
return g.Target, g.Actuality, g.CompletionRate, g.AxisLeftMax, g.AxisLeftMin, g.AxisRightMax, g.AxisRightMin
}
// 部门考核WEB端入口 // 部门考核WEB端入口
func (a *ApiMethod) Index(c *gin.Context) { func (a *ApiMethod) Index(c *gin.Context) {
outputCont := publicmethod.MapOut[string]() outputCont := publicmethod.MapOut[string]()
outputCont["index"] = "部门考核WEB端入口" outputCont["index"] = "部门考核WEB端入口"
publicmethod.Result(0, outputCont, c) publicmethod.Result(0, outputCont, c)
} }
// 获取部门指标列表
type GetDepartTargetCont struct {
publicmethod.PublicId
Attribute int `json:"attribute"` //1:定性考核;2:定量考核
}
// 输出指标信息
type SendTargetCont struct {
publicmethod.PublicId
publicmethod.PublicName
}
// 根据部门、指标、年份统计每月的目标值、实际值、达成率
type BaseDepartTargetTime struct {
OrgId string `json:"orgid"` //行政组织
TargetId string `json:"targetid"` //指标ID
DateTime string `json:"datetime"` //时间
}
// 输出部门、指标、年份统计图目标值、实际值、达成率数据结构
type DrawEcharStatisticsCont struct {
Legend []string `json:"legend"` //项目名称
XAxisVal []string `json:"xaxis"` //X轴坐标值
YAxis []YaxisStruct `json:"yaxis"` //Y轴坐标值
Series []Seriescont `json:"series"` //图表数值
}
// Y轴属性
type YaxisStruct struct {
Type string `json:"type"` //坐标轴类型
publicmethod.PublicName //坐标轴名称。
Min float64 `json:"min"` //最小值
Max float64 `json:"max"` //最大值
FormAtter string `json:"formatter"` //单位
}
// 图表值
type Seriescont struct {
publicmethod.PublicName //名称
Type string `json:"type"` //图像类型
Tooltip string `json:"tooltip"` //单位
Data []float64 `json:"data"` //结果
}
// 定量流水全奖值、零奖值、封顶值
type FlowLogAllZreo struct {
Id string `json:"id"`
TargetId string `json:"targetid"` //指标ID`
Zeroprize float64 `json:"zeroprize"` //零奖值"`
Allprize float64 `json:"allprize"` //全奖值"`
Capping float64 `json:"capping"` //封顶值"`
}
// 根据部门、指标、年份统计历史同比每月的目标值、实际值、达成率
type BaseDepartTargetTimeYOY struct {
OrgId string `json:"orgid"` //行政组织
TargetId string `json:"targetid"` //指标ID
DateTime []int `json:"datetime"` //时间
}
// 输出历史同比数据
type SendYOYData struct {
XAxisVal []string `json:"xaxis"` //X轴坐标值
YAxis YaxisStruct `json:"yaxis"` //Y轴坐标值
Series []Seriescont `json:"series"` //图表数值
}
// 协程获取每个年份数据
// 获取综合统计数值
type GeteveryYearDttsb struct {
Target []HistorMonthData
AxisMax float64
AxisMin float64
mutext sync.RWMutex
}
// 历史同比记录
type HistorMonthData struct {
Months int
MonthStr string
MonthDataList []float64
}
// 读取数据
func (g *GeteveryYearDttsb) readPlanTaskData() ([]HistorMonthData, float64, float64) {
g.mutext.RLock()
defer g.mutext.RUnlock()
return g.Target, g.AxisMax, g.AxisMin
}
// 通过时间获取组织总分
type OrgSecrcFormTime struct {
OrgId string `json:"orgid"` //行政组织
DateTimes string `json:"datetimes"` //时间
}
// 根据时间查询行政组织总成绩协程设置
type SyncOrgTimeAllScore struct {
OrgScore []SyncOTASVal
AxisMax float64
AxisMin float64
mutext sync.RWMutex
}
type SyncOTASVal struct {
OrgId int64 //行政组织ID
Score float64 //分
Months int //月
}
// 读取数据
func (s *SyncOrgTimeAllScore) readPlanTaskData() ([]SyncOTASVal, float64, float64) {
s.mutext.RLock()
defer s.mutext.RUnlock()
return s.OrgScore, s.AxisMax, s.AxisMin
}
// 按时间输出行政组织总成
type SendTimeOfOrgSumScore struct {
XAxisVal []string `json:"xaxis"` //X轴坐标值
YAxis YaxisOrgAllScore `json:"yaxis"` //Y轴坐标值
Series []float64 `json:"series"` //图表数值
}
type YaxisOrgAllScore struct {
Min float64 `json:"min"` //最小值
Max float64 `json:"max"` //最大值
}
// 考核方案
type SchemeInfo struct {
publicmethod.PublicId
publicmethod.PublicName
DimensionScore float64 `json:"dimensionscore"` //维度分数
Child []SchemeTarget `json:"child"` //方案指标
}
// 方案指标
type SchemeTarget struct {
publicmethod.PublicId
publicmethod.PublicName
Content string `json:"content"` //指标说明
Unit string `json:"unit"` //单位"`
ReferenceScore int64 `json:"referencescore"` //标准分值"`
Cycles int `json:"cycle"` //1:班;2:天;3:周;4:月;5:季度;6:年"`
CycleAttres int `json:"cycleattr"` //辅助计数"`
State int `json:"state"`
Score int64 `json:"score"` //分数
QualEvalId string `json:"qeid"`
Status int `json:"status"` //1:启用;2:禁用;3:为观察指标
}
// 获取关键指标列表
type HingeTarget struct {
Id []string `json:"id"` //指标ID
OrgId []string `json:"orgid"` //行政组织
DateTime string `json:"datetime"` //时间
}
// 输出关键指标
type OutPutHingeTarget struct {
Id string `json:"id"`
Title string `json:"title"`
CharKey string `json:"CharKey"`
DataList []float64 `json:"datalist"`
XAxisVal []string `json:"xaxis"` //X轴坐标值
YAxis YaxisOrgAllScore `json:"yaxis"` //Y轴坐标值
}
// 获取行政组织月度成绩
type OrgMonthResult struct {
OrgId string `json:"orgid"` //行政组织
DateTime string `json:"datetime"` //时间
}
// 根据部门、指标、年份统计历史同比每月的目标值、实际值、达成率
type BaseDepartTimeYOY struct {
OrgId string `json:"orgid"` //行政组织
DateTime []int `json:"datetime"` //时间
}

46
api/workflow/workflowengine/class.go

@ -1,5 +1,7 @@
package workflowengine package workflowengine
import "key_performance_indicators/overall/publicmethod"
//当审批单同时满足以下条件时进入此流程 //当审批单同时满足以下条件时进入此流程
type ConditionListCont struct { type ConditionListCont struct {
ColumnID int `json:"columnId"` ColumnID int `json:"columnId"`
@ -27,11 +29,10 @@ type NodeUserListCont struct {
//通用字段 //通用字段
type PublicChildNode struct { type PublicChildNode struct {
NodeName string `json:"nodeName"` //节点名称 NodePublicStruct
Error bool `json:"error"` //当前审批是否通过校验 Error bool `json:"error"` //当前审批是否通过校验
Type int `json:"type"` // 0 发起人 1审批 2抄送 3条件 4路由
PriorityLevel int `json:"priorityLevel"` // 条件优先级 PriorityLevel int `json:"priorityLevel"` // 条件优先级
Settype int `json:"settype"` // 审批人设置 1指定成员 2主管 4发起人自选 5发起人自己 7连续多级主管 Settype int `json:"settype"` // 审批人设置 1指定成员 2主管 4发起人自选 5发起人自己 7连续多级主管 8:指定审批节点自选
SelectMode int `json:"selectMode"` //审批人数 1选一个人 2选多个人 SelectMode int `json:"selectMode"` //审批人数 1选一个人 2选多个人
SelectRange int `json:"selectRange"` //选择范围 1.全公司 2指定成员 2指定角色 SelectRange int `json:"selectRange"` //选择范围 1.全公司 2指定成员 2指定角色
DirectorLevel int `json:"directorLevel"` //审批终点 最高层主管数 DirectorLevel int `json:"directorLevel"` //审批终点 最高层主管数
@ -42,7 +43,16 @@ type PublicChildNode struct {
CcSelfSelectFlag int `json:"ccSelfSelectFlag"` //允许发起人自选抄送人 CcSelfSelectFlag int `json:"ccSelfSelectFlag"` //允许发起人自选抄送人
ConditionList []ConditionListCont `json:"conditionList"` //当审批单同时满足以下条件时进入此流程 ConditionList []ConditionListCont `json:"conditionList"` //当审批单同时满足以下条件时进入此流程
ChildNode *PublicChildNode `json:"childNode"` ChildNode *PublicChildNode `json:"childNode"`
ConditionNodes *[]PublicChildNode `json:"conditionNodes"` // ConditionNodes *[]PublicChildNode `json:"conditionNodes"` //条件节点
}
//基础结构
type NodePublicStruct struct {
NodeNumber string `json:"nodeNumber"` //节点编号
NodeName string `json:"nodeName"` //节点名称
Type int `json:"type"` // 0 发起人 1审批 2抄送 3条件 4路由
FromNode string `json:"fromNode"` //来源节点
GotoNode []string `json:"gotoNode"` //去向节点
} }
//工作流结构体 //工作流结构体
@ -53,3 +63,31 @@ type FlowStructIng struct {
FlowPermission []string `json:"flowPermission"` //发起人 FlowPermission []string `json:"flowPermission"` //发起人
NodeConfig PublicChildNode `json:"nodeConfig"` //流程结构体 NodeConfig PublicChildNode `json:"nodeConfig"` //流程结构体
} }
//输出全部节点信息
type outAllNodeCont struct {
AllCont []NodePublicStruct `json:"allcont"`
AllNumber []string `json:"allnumber"`
}
//判断上级操作节点
type JudgePrintNode struct {
publicmethod.PublicId
AllCont []NodePublicStruct `json:"allcont"`
}
//输出上级操作节点
type OutputPrintNode struct {
AllCont []NodePublicStruct `json:"allcont"`
Total int `json:"total"` //总数
}
//分支条件
type BranchingCondition struct {
ColumnId string `json:"columnId"` //条件id columnId == 0 为发起人
ShowType string `json:"showType"` //columnType == "String" && showType == "checkBox"为多选
ShowName string `json:"showName"` //名称
ColumnName string `json:"columnName"` //columnName 条件自定义字段
ColumnType string `json:"columnType"` //columnType == "Double"为区间
FixedDownBoxValue string `json:"fixedDownBoxValue"` //fixedDownBoxValue 匹配 columnType == "String" && showType == "checkBox"时子选项内容
}

151
api/workflow/workflowengine/flowhandle.go

@ -0,0 +1,151 @@
package workflowengine
import (
"key_performance_indicators/overall/publicmethod"
"github.com/gin-gonic/gin"
)
/*
*
@ 作者: 秦东
@ 时间: 2023-03-06 13:35:25
@ 功能: 判断是否显示指定审批节点自选选项及可选节点
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) JudgeOptionalNode(c *gin.Context) {
var receivedValue PublicChildNode
c.ShouldBindJSON(&receivedValue)
var alc outAllNodeCont
alc.sendAllNode(receivedValue)
publicmethod.Result(0, alc, c)
}
// 递归输出所有节点
func (o *outAllNodeCont) sendAllNode(val PublicChildNode) {
var cont NodePublicStruct
cont.NodeName = val.NodeName
cont.NodeNumber = val.NodeNumber
cont.Type = val.Type
cont.FromNode = val.FromNode
cont.GotoNode = val.GotoNode
if publicmethod.IsInTrue[string](val.NodeNumber, o.AllNumber) == false {
o.AllCont = append(o.AllCont, cont)
o.AllNumber = append(o.AllNumber, val.NodeNumber)
}
if val.ChildNode != nil {
o.sendAllNode(*val.ChildNode)
}
if val.ConditionNodes != nil && len(*val.ConditionNodes) > 0 {
for _, v := range *val.ConditionNodes {
o.sendAllNode(v)
}
}
}
/*
*
@ 作者: 秦东
@ 时间: 2023-03-06 14:53:49
@ 功能: 获取所有父级审批节点
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) GetAllParentNode(c *gin.Context) {
var receivedValue JudgePrintNode
err := c.ShouldBindJSON(&receivedValue)
if err != nil {
publicmethod.Result(100, err, c)
return
}
if receivedValue.Id == "" {
publicmethod.Result(101, err, c)
return
}
var sendCont OutputPrintNode
if len(receivedValue.AllCont) < 1 {
sendCont.Total = 0
publicmethod.Result(0, sendCont, c)
return
}
var outCont outAllNodeCont
outCont.SeekFromNodeCont(receivedValue.Id, receivedValue.AllCont)
sendCont.AllCont = outCont.AllCont
sendCont.Total = len(outCont.AllCont)
publicmethod.Result(0, sendCont, c)
}
/*
*
@ 作者: 秦东
@ 时间: 2023-03-07 08:35:59
@ 功能: 递归查找所有上级审批点
@ 参数
#parentNumber 来源节点编号
#allListCont 所有可操作节点
@ 返回值
#outAllNodeCont 结果集
@ 方法原型
#func (o *outAllNodeCont) SeekFromNodeCont(parentNumber string, allListCont []NodePublicStruct)
*/
func (o *outAllNodeCont) SeekFromNodeCont(parentNumber string, allListCont []NodePublicStruct) {
for _, v := range allListCont {
if v.NodeNumber == parentNumber {
if v.Type == 1 {
if publicmethod.IsInTrue[string](v.NodeNumber, o.AllNumber) == false {
o.AllCont = append(o.AllCont, v)
o.AllNumber = append(o.AllNumber, v.NodeNumber)
}
}
if v.FromNode != "" {
o.SeekFromNodeCont(v.FromNode, allListCont)
}
}
}
}
/*
*
@ 作者: 秦东
@ 时间: 2023-03-08 16:00:58
@ 功能: 判断条件
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) JudgingCondition(c *gin.Context) {
var sendListCont []BranchingCondition
publicmethod.Result(0, sendListCont, c)
}

3
api/workflow/workflowengine/shiyan.go

@ -2,6 +2,7 @@ package workflowengine
import ( import (
"key_performance_indicators/overall/publicmethod" "key_performance_indicators/overall/publicmethod"
"strconv"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -52,6 +53,8 @@ func (a *ApiMethod) ShiyanData(c *gin.Context) {
// }` // }`
var workFlowStruct FlowStructIng var workFlowStruct FlowStructIng
uuidInt := publicmethod.GetUUid(5)
workFlowStruct.NodeConfig.NodeNumber = strconv.FormatInt(uuidInt, 10)
workFlowStruct.NodeConfig.NodeName = "发起人" workFlowStruct.NodeConfig.NodeName = "发起人"
workFlowStruct.DirectorMaxLevel = 4 workFlowStruct.DirectorMaxLevel = 4
// err := json.Unmarshal([]byte(jsonStrSmaill), &workFlowStruct) // err := json.Unmarshal([]byte(jsonStrSmaill), &workFlowStruct)

2
apirouter/apishiyan/maptostruct.go

@ -29,5 +29,7 @@ func (a *ApiRouter) RouterGroup(router *gin.RouterGroup) {
apiRouter.POST("correcting_depart_man", methodBinding.CorrectingDepartAndMan) //验证指标关联部门与指标关联提报人数据 apiRouter.POST("correcting_depart_man", methodBinding.CorrectingDepartAndMan) //验证指标关联部门与指标关联提报人数据
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("xzbkhbm", methodBinding.XiangzhengBeikaoBumen) //验证部门指标细则关系对照
} }
} }

10
apirouter/v1/departmentseting/web.go

@ -15,5 +15,15 @@ func (a *ApiRouter) RouterGroupWeb(router *gin.RouterGroup) {
apiRouter.GET("", methodBinding.Index) //入口 apiRouter.GET("", methodBinding.Index) //入口
apiRouter.POST("", methodBinding.Index) //入口 apiRouter.POST("", methodBinding.Index) //入口
apiRouter.POST("target_list_for_department", methodBinding.TargetListForDepartment) //指标列表
apiRouter.POST("bdtts", methodBinding.BasisDepartTargetTimeStatistics) //根据部门、指标、年份统计每月的目标值、实际值、达成率
apiRouter.POST("bdttsyoy", methodBinding.BasisDepartTargetTimeStatisticsYOY) //历史同比根据部门、定量指标、年份统计每月的实际值
apiRouter.POST("totalscore_org_from_timesearch", methodBinding.TotalScoreOFOrgComesFromTimeSearch) //通过时间获取组织总分
apiRouter.POST("get_hinge_target", methodBinding.GetHingeTarget) //获取关键指标
apiRouter.POST("get_everyone_org_month_result", methodBinding.GetEveryOneOrgToMonthResult) //获取单一行政组织指定年度各月份成绩
apiRouter.POST("get_everyone_org_months_result", methodBinding.GetEveryOneOrgToMonthsResult) //获取单一行政组织多年度各月份成绩
apiRouter.POST("bdttsattryoy", methodBinding.BasisDepartAttrTargetTimeStatistics) //历史同比根据部门、定性指标、年份统计每月的实际值
} }
} }

4
apirouter/workflowrouter/flowrouter.go

@ -17,5 +17,9 @@ func (a *ApiRouter) RouterGroup(router *gin.RouterGroup) {
//实验用接口 //实验用接口
apiRouter.POST("shiyan_data", workFlow.ShiyanData) //入口 apiRouter.POST("shiyan_data", workFlow.ShiyanData) //入口
apiRouter.POST("judge_optional_node", workFlow.JudgeOptionalNode) //判断是否显示(指定审批节点自选)选项及可选节点
apiRouter.POST("get_all_parent_node", workFlow.GetAllParentNode) //获取所有父级审批节点
apiRouter.POST("judging_condition", workFlow.JudgingCondition) //判断条件
} }
} }

4
config/configDatabase/database.go

@ -45,7 +45,7 @@ type MasterMysqlSetUp struct {
func (m *MasterMysqlSetUp) SqlDsn() (dsnStr string) { func (m *MasterMysqlSetUp) SqlDsn() (dsnStr string) {
dsnStr = fmt.Sprintf("%v:%v@tcp(%v:%v)/%v?charset=%v", m.UserName, m.PassWord, m.UrlPath, m.Port, m.Name, m.Charset) dsnStr = fmt.Sprintf("%v:%v@tcp(%v:%v)/%v?charset=%v", m.UserName, m.PassWord, m.UrlPath, m.Port, m.Name, m.Charset)
if m.ParseTime == true { if m.ParseTime {
dsnStr = fmt.Sprintf("%v:%v@tcp(%v:%v)/%v?charset=%v&parseTime=%v&loc=%v", m.UserName, m.PassWord, m.UrlPath, m.Port, m.Name, m.Charset, m.ParseTime, m.Loc) dsnStr = fmt.Sprintf("%v:%v@tcp(%v:%v)/%v?charset=%v&parseTime=%v&loc=%v", m.UserName, m.PassWord, m.UrlPath, m.Port, m.Name, m.Charset, m.ParseTime, m.Loc)
} }
return return
@ -60,7 +60,7 @@ func (m *MasterMysqlSetUp) OpenSql() *gorm.DB {
DontSupportRenameColumn: true, // 用 `change` 重命名列,MySQL 8 之前的数据库和 MariaDB 不支持重命名列 DontSupportRenameColumn: true, // 用 `change` 重命名列,MySQL 8 之前的数据库和 MariaDB 不支持重命名列
SkipInitializeWithVersion: false, // 根据版本自动配置 SkipInitializeWithVersion: false, // 根据版本自动配置
} }
if m.GormLog == true { if m.GormLog {
if opDb, err := gorm.Open(mysql.New(sqlConfig), &gorm.Config{ if opDb, err := gorm.Open(mysql.New(sqlConfig), &gorm.Config{
Logger: logger.Default.LogMode(logger.Info), Logger: logger.Default.LogMode(logger.Info),
}); err != nil { }); err != nil {

1
models/modelshr/administrative_organization.go

@ -20,6 +20,7 @@ type AdministrativeOrganization struct {
Schoole int64 `json:"schoole" gorm:"column:schoole;type:bigint(20) unsigned;default:0;not null;comment:原知行学院对照码"` Schoole int64 `json:"schoole" gorm:"column:schoole;type:bigint(20) unsigned;default:0;not null;comment:原知行学院对照码"`
KingdeeId string `json:"kingdeeid" gorm:"column:kingdeeid;type:varchar(255) unsigned;default:'';comment:金蝶对照ID"` KingdeeId string `json:"kingdeeid" gorm:"column:kingdeeid;type:varchar(255) unsigned;default:'';comment:金蝶对照ID"`
IsPower int `json:"ispower" gorm:"column:ispower;type:int(1) unsigned;default:2;not null;comment:是否为实权部门"` IsPower int `json:"ispower" gorm:"column:ispower;type:int(1) unsigned;default:2;not null;comment:是否为实权部门"`
Sort int `json:"sort" gorm:"column:sort;type:int(6) unsigned;default:100;not null;comment:是否为实权部门"`
} }
func (AdministrativeOrganization *AdministrativeOrganization) TableName() string { func (AdministrativeOrganization *AdministrativeOrganization) TableName() string {

201
overall/publicmethod/technique.go

@ -898,7 +898,7 @@ func GetMinMainDutyDeparment(company string) (organization []modelshr.Administra
return return
} }
for _, v := range allOrg { for _, v := range allOrg {
sunOrgList, orgSunErr := getSunOrgList(v.Id) sunOrgList, orgSunErr := GetSunOrgList(v.Id)
if orgSunErr == nil && len(sunOrgList) > 0 { if orgSunErr == nil && len(sunOrgList) > 0 {
for _, sv := range sunOrgList { for _, sv := range sunOrgList {
organization = append(organization, sv) organization = append(organization, sv)
@ -911,7 +911,7 @@ func GetMinMainDutyDeparment(company string) (organization []modelshr.Administra
} }
// 获取下级行政组织是否有主行政部门 // 获取下级行政组织是否有主行政部门
func getSunOrgList(orgId int64) (orgList []modelshr.AdministrativeOrganization, ovErr error) { func GetSunOrgList(orgId int64) (orgList []modelshr.AdministrativeOrganization, ovErr error) {
ovErr = overall.CONSTANT_DB_HR.Where("state = 1").Where("ispower = 1 AND superior = ?", orgId).Find(&orgList).Error ovErr = overall.CONSTANT_DB_HR.Where("state = 1").Where("ispower = 1 AND superior = ?", orgId).Find(&orgList).Error
return return
} }
@ -1629,3 +1629,200 @@ func MergeStruct[T GenericityVariable](aryOen, aryTwo []T) (structAry []T) {
} }
return return
} }
// 根据字符串组合时间
/*
#dateTime 日期
*/
func (d *DateTimeTotimes) BaisStrToTime(dateTime string) {
timeStrAry := strings.Split(dateTime, "-")
switch len(timeStrAry) {
case 1:
dateTime = fmt.Sprintf("%v-01-01 12:00:00", dateTime)
case 2:
if len(timeStrAry[1]) < 2 {
dateTime = fmt.Sprintf("%v-0%v-01 12:00:00", timeStrAry[0], timeStrAry[1])
}
case 3:
monthStr := timeStrAry[1]
if len(timeStrAry[1]) < 2 {
monthStr = fmt.Sprintf("0%v", timeStrAry[1])
}
dayAry := strings.Split(timeStrAry[2], " ")
// fmt.Printf("dayAry:%v------>%v\n", dayAry, len(dayAry))
dayStr := dayAry[0]
if len(dayAry[0]) < 2 {
dayStr = fmt.Sprintf("0%v", dayAry[0])
}
if len(dayAry) > 1 {
// fmt.Printf("dayAry[1]:%v------>%v\n", dayAry[1], len(dayAry[1]))
if len(dayAry[1]) > 0 {
Hours := "00"
minutes := "00"
seconds := "00"
hisAry := strings.Split(dayAry[1], ":")
switch len(hisAry) {
case 1:
if len(hisAry[0]) < 2 {
Hours = fmt.Sprintf("0%v", hisAry[0])
} else {
Hours = hisAry[0]
}
case 2:
if len(hisAry[0]) < 2 {
Hours = fmt.Sprintf("0%v", hisAry[0])
} else {
Hours = hisAry[0]
}
if len(hisAry[1]) < 2 {
minutes = fmt.Sprintf("0%v", hisAry[1])
} else {
minutes = hisAry[1]
}
case 3:
if len(hisAry[0]) < 2 {
Hours = fmt.Sprintf("0%v", hisAry[0])
} else {
Hours = hisAry[0]
}
if len(hisAry[1]) < 2 {
minutes = fmt.Sprintf("0%v", hisAry[1])
} else {
minutes = hisAry[1]
}
if len(hisAry[2]) < 2 {
seconds = fmt.Sprintf("0%v", hisAry[2])
} else {
seconds = hisAry[2]
}
default:
}
dayStr = fmt.Sprintf("%v %v:%v:%v", dayStr, Hours, minutes, seconds)
}
}
// dayStr := timeStrAry[2]
// if len(timeStrAry[2]) < 2 {
// dayStr = fmt.Sprintf("0%v", timeStrAry[2])
// }
dateTime = fmt.Sprintf("%v-%v-%v", timeStrAry[0], monthStr, dayStr)
default:
}
// fmt.Printf("dateTime:%v---1--->%v\n", dateTime, len(dateTime))
orgTime, orgTimeErr := DateToTimeStamp(fmt.Sprintf("%v-01-01 12:00:00", dateTime))
if orgTimeErr {
d.AllTime = orgTime
d.Years = UnixTimeToDay(orgTime, 16)
d.Months = UnixTimeToDay(orgTime, 17)
d.Days = UnixTimeToDay(orgTime, 18)
d.Hours = UnixTimeToDay(orgTime, 7)
d.Minutes = UnixTimeToDay(orgTime, 9)
d.Second = UnixTimeToDay(orgTime, 10)
} else {
orgTime, orgTimeErr = DateToTimeStamp(fmt.Sprintf("%v-01 12:00:00", dateTime))
if orgTimeErr {
d.AllTime = orgTime
d.Years = UnixTimeToDay(orgTime, 16)
d.Months = UnixTimeToDay(orgTime, 17)
d.Days = UnixTimeToDay(orgTime, 18)
d.Hours = UnixTimeToDay(orgTime, 7)
d.Minutes = UnixTimeToDay(orgTime, 9)
d.Second = UnixTimeToDay(orgTime, 10)
} else {
orgTime, orgTimeErr = DateToTimeStamp(fmt.Sprintf("%v 12:00:00", dateTime))
if orgTimeErr {
d.AllTime = orgTime
d.Years = UnixTimeToDay(orgTime, 16)
d.Months = UnixTimeToDay(orgTime, 17)
d.Days = UnixTimeToDay(orgTime, 18)
d.Hours = UnixTimeToDay(orgTime, 7)
d.Minutes = UnixTimeToDay(orgTime, 9)
d.Second = UnixTimeToDay(orgTime, 10)
} else {
orgTime, orgTimeErr = DateToTimeStamp(fmt.Sprintf("%v:00:00", dateTime))
if orgTimeErr {
d.AllTime = orgTime
d.Years = UnixTimeToDay(orgTime, 16)
d.Months = UnixTimeToDay(orgTime, 17)
d.Days = UnixTimeToDay(orgTime, 18)
d.Hours = UnixTimeToDay(orgTime, 7)
d.Minutes = UnixTimeToDay(orgTime, 9)
d.Second = UnixTimeToDay(orgTime, 10)
} else {
orgTime, orgTimeErr = DateToTimeStamp(fmt.Sprintf("%v:00", dateTime))
if orgTimeErr {
d.AllTime = orgTime
d.Years = UnixTimeToDay(orgTime, 16)
d.Months = UnixTimeToDay(orgTime, 17)
d.Days = UnixTimeToDay(orgTime, 18)
d.Hours = UnixTimeToDay(orgTime, 7)
d.Minutes = UnixTimeToDay(orgTime, 9)
d.Second = UnixTimeToDay(orgTime, 10)
} else {
orgTime, orgTimeErr = DateToTimeStamp(dateTime)
if orgTimeErr {
d.AllTime = orgTime
d.Years = UnixTimeToDay(orgTime, 16)
d.Months = UnixTimeToDay(orgTime, 17)
d.Days = UnixTimeToDay(orgTime, 18)
d.Hours = UnixTimeToDay(orgTime, 7)
d.Minutes = UnixTimeToDay(orgTime, 9)
d.Second = UnixTimeToDay(orgTime, 10)
}
}
}
}
}
}
}
//统一图标计算最大值最小值方法
/*
maxVal 最大值
minVal 最小值
*/
func JudjeMaxOfMinVal(maxVal, minVal float64) (maxVals, minVals float64) {
if maxVal > 0 {
if minVal > 0 {
if maxVal < 10 {
if maxVal < 1 {
maxVal = math.Ceil(maxVal) + 0.1
minVals = math.Ceil(minVal) - 0.1
} else {
maxVal = math.Ceil(maxVal) + 1
minVals = math.Ceil(minVal) - 1
}
} else {
jianGe := math.Ceil((maxVal - minVal) / 5)
if jianGe <= 0 {
jianGe = 1
}
maxVals = math.Ceil(maxVal) + jianGe
minVals = math.Ceil(minVal) - jianGe
if minVals < 0 {
minVals = 0
}
}
} else {
jianGe := math.Ceil(maxVal / 5)
maxVals = math.Ceil(maxVal) + jianGe
}
} else {
if minVal > -1 {
minVals = minVal - 0.1
} else {
maxGuoDu := maxVal * -1
minGuoDu := minVal * -1
jianGe := math.Ceil((minGuoDu - maxGuoDu) / 5)
if jianGe > 0 {
minVals = minVal - jianGe
} else {
minVals = minVal - 1
}
}
}
// fmt.Printf("ge---1-->%v----->%v\n", maxVals, minVals)
return
}

16
overall/publicmethod/type.go

@ -10,6 +10,11 @@ type GenericityVariable interface {
int | int8 | int16 | int32 | int64 | float32 | float64 | string int | int8 | int16 | int32 | int64 | float32 | float64 | string
} }
// 数值泛型基础变量类型
type GenericityVariableNumber interface {
int | int8 | int16 | int32 | int64 | float32 | float64
}
// 格式化输出 // 格式化输出
type Reply struct { type Reply struct {
Code int `json:"code"` Code int `json:"code"`
@ -253,3 +258,14 @@ type EvaluPross struct {
QualEvalId string `json:"qeid"` QualEvalId string `json:"qeid"`
Status int `json:"status"` //1:使用;2:禁用;3:观察 Status int `json:"status"` //1:使用;2:禁用;3:观察
} }
// 时间转换
type DateTimeTotimes struct {
Years string `json:"years"`
Months string `json:"months"`
Days string `json:"days"`
Hours string `json:"hours"`
Minutes string `json:"minutes"`
Second string `json:"second"`
AllTime int64 `json:"alltime"`
}

Loading…
Cancel
Save