KPI绩效考核系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

733 lines
22 KiB

package postweb
import (
"encoding/json"
"fmt"
"key_performance_indicators/middleware/wechatapp/wechatcallback"
"key_performance_indicators/models/modelshr"
"key_performance_indicators/models/modelskpi"
"key_performance_indicators/overall"
"key_performance_indicators/overall/publicmethod"
"strconv"
"github.com/gin-gonic/gin"
)
// 岗位审批记录
func (a *ApiMethod) GetPostFlowLog(c *gin.Context) {
var receivedValue postFlowLog
c.ShouldBindJSON(&receivedValue)
if receivedValue.Page == 0 {
receivedValue.Page = 1
}
if receivedValue.PageSize == 0 {
receivedValue.PageSize = 20
}
//获取登录人信息
context, _ := publicmethod.LoginMyCont(c)
gormDb := overall.CONSTANT_DB_KPI.Model(&modelskpi.AppNewFlowLog{})
switch context.IsAdmin {
case 2:
case 3:
case 4:
default:
gormDb = gormDb.Where("FIND_IN_SET(?,`participants`)", context.Key)
gormDb = gormDb.Where("`department_id` = ?", context.MainDeparment)
}
var flowLogList []modelskpi.AppNewFlowLog
if receivedValue.Title != "" {
gormDb = gormDb.Where("`pt_title` LIKE ? OR `pst_title` LIKE ? OR `ptd_title` LIKE ?", "%"+receivedValue.Title+"%", "%"+receivedValue.Title+"%", "%"+receivedValue.Title+"%")
}
if receivedValue.OrgId != 0 {
gormDb = gormDb.Where("`org_id` = ?", receivedValue.OrgId)
}
if receivedValue.PostId != 0 {
gormDb = gormDb.Where("`post_id` = ?", receivedValue.PostId)
}
if receivedValue.DayTime != "" {
startTime, endTime := publicmethod.GetAppointMonthStarAndEndTime(receivedValue.DayTime)
gormDb = gormDb.Where("`start_time` BETWEEN ? AND ?", startTime, endTime)
}
if receivedValue.Years != 0 {
if receivedValue.Month != 0 {
timeDay := fmt.Sprintf("%v-%v-01", receivedValue.Years, receivedValue.Month)
if receivedValue.Month <= 9 {
timeDay = fmt.Sprintf("%v-0%v-01", receivedValue.Years, receivedValue.Month)
}
startTime, endTime := publicmethod.GetAppointMonthStarAndEndTimeEs(timeDay)
gormDb = gormDb.Where("start_time BETWEEN ? AND ?", startTime, endTime)
} else {
startTime, _ := publicmethod.DateToTimeStamp(fmt.Sprintf("%v-01-01 00:00:00", receivedValue.Years))
endTime, _ := publicmethod.DateToTimeStamp(fmt.Sprintf("%v-12-31 23:59:59", receivedValue.Years))
gormDb = gormDb.Where("start_time BETWEEN ? AND ?", startTime, endTime)
}
}
if receivedValue.State != 0 {
gormDb = gormDb.Where("`state` = ?", receivedValue.State)
} else {
gormDb = gormDb.Where("`state` BETWEEN ? AND ?", 1, 5)
}
if receivedValue.ApprovalState == 1 {
gormDb = gormDb.Where("NOT FIND_IN_SET(?,`next_executor`)", context.Key)
}
if receivedValue.ApprovalState == 2 {
gormDb = gormDb.Where("FIND_IN_SET(?,`next_executor`)", context.Key)
}
gormDb = publicmethod.PageTurningSettings(gormDb, receivedValue.Page, receivedValue.PageSize)
err := gormDb.Order("`state` ASC").Order("`id` DESC").Find(&flowLogList).Error
var total int64
totalErr := gormDb.Count(&total).Error
if totalErr != nil {
total = 0
}
if err != nil || len(flowLogList) < 1 {
publicmethod.Result(107, err, c)
return
}
var sendData []SendPostFlowLog
for _, v := range flowLogList {
var sendCont SendPostFlowLog
sendCont.OrderId = strconv.FormatInt(v.OrderId, 10) //订单Key
titleStr := v.PtTitle
if v.PstTitle != "" {
titleStr = v.PstTitle
}
if v.PtdTitle != "" {
titleStr = v.PtdTitle
}
sendCont.Title = titleStr //标题
switch v.State {
case 1:
sendCont.Result = "起草" //审批结果
sendCont.Statetype = 1 //审批状态
case 2:
sendCont.Result = "审批中"
sendCont.Statetype = 0
case 3:
sendCont.Result = "驳回"
sendCont.Statetype = 4
case 4:
sendCont.Result = "归档"
sendCont.Statetype = 3
case 5:
sendCont.Result = "废弃"
sendCont.Statetype = 3
case 6:
sendCont.Result = "删除"
sendCont.Statetype = 3
default:
sendCont.Result = "审批中"
sendCont.Statetype = 0
}
cyclesVal := v.PtCycle
cycleAttresVal := v.PtCycleattr
if v.PtdCycles != 0 {
cyclesVal = v.PtdCycles
}
if v.PtdCycleAttres != 0 {
cycleAttresVal = v.PtdCycleAttres
}
sendCont.Cycles = cyclesVal //1:班;2:天;3:周;4:月;5:季度;6:年"`
sendCont.CycleAttres = cycleAttresVal //辅助计数"`
sendCont.Year = v.Year //年分"`
sendCont.Quarter = v.Quarter //季度"`
sendCont.Month = v.Month //月"`
sendCont.Week = v.Week //周"`
if v.NextStep == 0 {
sendCont.Node = "归档"
} else {
//获取流程节点
_, flowCont, _ := wechatcallback.GetOneNodeCont(v.WorkFlow, v.Step)
sendCont.Node = flowCont.NodeName //当前节点
}
sendCont.Class = v.Class
sendCont.MonthDays = publicmethod.UnixTimeToDay(v.StartTime, 22) //提报日期
sendData = append(sendData, sendCont)
}
publicmethod.ResultList(0, receivedValue.Page, receivedValue.PageSize, total, int64(len(sendData)), sendData, c)
}
/*
*
@ 作者: 秦东
@ 时间: 2022-10-27 16:43:56
@ 功能:获取审批流详情
@ 参数
#
@ 返回值
#
*/
func (a *ApiMethod) LookFlowMap(c *gin.Context) {
var receivedValue LookFlowInfo
err := c.ShouldBindJSON(&receivedValue)
if err != nil {
publicmethod.Result(100, err, c)
return
}
if receivedValue.Id == "" {
publicmethod.Result(101, receivedValue, c)
return
}
if receivedValue.Class == 0 {
receivedValue.Class = 1
}
//获取登录人信息
context, _ := publicmethod.LoginMyCont(c)
//获取审批流相关内容
var getFlowCont GetFlowLogCont
syncSeting.Add(1)
go getFlowCont.ReadMainFlowLog(receivedValue.Id) //获取审批主表
if receivedValue.Class == 1 {
//定性
syncSeting.Add(1)
go getFlowCont.ReadNatureFlowLog(receivedValue.Id) //获取审批主表
syncSeting.Wait()
mainFlowLog, natureFlowList, _ := getFlowCont.readDataLock() //读取线程通道数据
var sendDataCont SendPostDingXing
sendDataCont.OrderId = strconv.FormatInt(mainFlowLog.OrderId, 10)
sendDataCont.Title = GetNatureFlowTitle(mainFlowLog.Executor, mainFlowLog.DepartmentId, mainFlowLog.PostId, mainFlowLog.PersonLiable, mainFlowLog.Target, mainFlowLog.HappenTime, 1)
sendDataCont.FlowMapAll, _, _ = wechatcallback.GetOneNodeCont(mainFlowLog.WorkFlow, mainFlowLog.Step)
for _, v := range natureFlowList {
sendDataCont.List = append(sendDataCont.List, AnalysisDingXing(v))
}
sendDataCont.Isset = 1
var zhiXingRen []string
//判断当前人是否要审批
if mainFlowLog.NextStep > 1 {
if mainFlowLog.NextExecutor != "" {
err = json.Unmarshal([]byte(mainFlowLog.NextExecutor), &zhiXingRen)
if err == nil {
dangQianRen := strconv.FormatInt(context.Key, 10)
if publicmethod.IsInTrue[string](dangQianRen, zhiXingRen) == true {
sendDataCont.Isset = 2
}
}
}
}
//获取步进值
var oacl modelskpi.OpenApprovalChangeLog
clickStep, stepErr := oacl.GetMAx(mainFlowLog.OrderId, zhiXingRen)
if stepErr != nil {
sendDataCont.Stepper = 1
} else {
sendDataCont.Stepper = clickStep + 1
}
if mainFlowLog.EnclosureFormat != "" {
json.Unmarshal([]byte(mainFlowLog.EnclosureFormat), &sendDataCont.Enclosure)
}
publicmethod.Result(0, sendDataCont, c) //输出
} else {
//定量
syncSeting.Add(1)
go getFlowCont.ReadMeterMainFlowLog(receivedValue.Id) //获取审批主表
syncSeting.Wait()
mainFlowLog, _, meterFlowList := getFlowCont.readDataLock() //读取线程通道数据
var sendDataCont SendPostDingLiang
sendDataCont.OrderId = strconv.FormatInt(mainFlowLog.OrderId, 10)
sendDataCont.Title = GetNatureFlowTitle(mainFlowLog.Executor, mainFlowLog.DepartmentId, mainFlowLog.PostId, mainFlowLog.PersonLiable, mainFlowLog.Target, mainFlowLog.HappenTime, 2)
sendDataCont.FlowMapAll, _, _ = wechatcallback.GetOneNodeCont(mainFlowLog.WorkFlow, mainFlowLog.Step)
sendDataCont.Isset = 1
//判断当前人是否要审批
var zhiXingRen []string
if mainFlowLog.NextStep > 1 {
if mainFlowLog.NextExecutor != "" {
err = json.Unmarshal([]byte(mainFlowLog.NextExecutor), &zhiXingRen)
if err == nil {
dangQianRen := strconv.FormatInt(context.Key, 10)
if publicmethod.IsInTrue[string](dangQianRen, zhiXingRen) == true {
sendDataCont.Isset = 2
}
}
}
}
//获取步进值
var oacl modelskpi.OpenApprovalChangeLog
clickStep, stepErr := oacl.GetMAx(mainFlowLog.OrderId, zhiXingRen)
if stepErr != nil {
sendDataCont.Stepper = 1
} else {
sendDataCont.Stepper = clickStep + 1
}
if mainFlowLog.EnclosureFormat != "" {
json.Unmarshal([]byte(mainFlowLog.EnclosureFormat), &sendDataCont.Enclosure)
}
for _, v := range meterFlowList {
sendDataCont.List = append(sendDataCont.List, AnalysisDingLiang(v))
}
publicmethod.Result(0, sendDataCont, c) //输出
}
}
/*
*
@ 作者: 秦东
@ 时间: 2022-10-28 14:37:27
@ 功能: 解析定量输出结构体
@ 参数
#
@ 返回值
#
*/
func AnalysisDingLiang(natureCont modelskpi.PostMeteringFlow) (sendData DingLiangList) {
//获取指标
var targetCont modelskpi.PostTarget
targetCont.GetCont(map[string]interface{}{"`id`": natureCont.Target}, "`title`")
sendData.Title = targetCont.Title
sendData.Target = targetCont.Title
sendData.Content = natureCont.Reason
//解析考核基准线
var jinZhunXian baseLineType
err := json.Unmarshal([]byte(natureCont.Baseline), &jinZhunXian)
if err == nil {
sendData.ZeroPrize = publicmethod.DecimalEs(jinZhunXian.Zeroprize, 2) //零奖值
sendData.AllPrize = publicmethod.DecimalEs(jinZhunXian.Allprize, 2) //全奖值
sendData.CappingVal = jinZhunXian.Capping //封顶值
}
var shemeCont modelskpi.QualitativeEvaluationScheme
err = shemeCont.GetCont(map[string]interface{}{"`id`": natureCont.ShemeId})
//获取指标分
var departDimPostWeight modelskpi.DepartDimePostWeight
where := publicmethod.MapOut[string]()
where["`orgid`"] = shemeCont.OrgId
where["`postid`"] = shemeCont.PostId
where["`dimension`"] = shemeCont.DimensionId
where["`hierarchy`"] = 1
where["`is_quote`"] = shemeCont.Source
where["`target`"] = shemeCont.TargetId
departDimPostWeight.GetCont(where, "`weight`")
sendData.Weight = departDimPostWeight.Weight / 100
sendData.Score = natureCont.Score
sendData.Achievement, sendData.Actual = GetAchieAndActual(natureCont.Score, departDimPostWeight.Weight, sendData.ZeroPrize, sendData.AllPrize, sendData.CappingVal)
fmt.Printf("jinZhunXian----->%v\n", jinZhunXian)
return
}
/*
*
@ 作者: 秦东
@ 时间: 2022-10-28 15:09:33
@ 功能: 计算达成率及得分
@ 参数
#score 实际分
#weight 指标权重
#zeroprize 零奖值
#allprize 全奖值
#cappingval 封顶值
@ 返回值
#achievement 达成率
#actual 得分
*/
func GetAchieAndActual(score, weight, zeroprize, allprize, cappingval float64) (achievement, actual float64) {
if zeroprize == 0 && allprize == 0 { //当全奖值与零奖值都为空时
if score != 0 { //判断实际值是否不为0
actual = weight
achievement = 100
}
} else {
if allprize > zeroprize { //当全奖值大于零奖值时 正向计算
if score <= zeroprize { //实际数值小于零奖值时达成率与得分都为零
actual = 0
achievement = 0
} else {
chuShu := score - zeroprize
beiChushu := allprize - zeroprize
if beiChushu != 0 { //判断除数不能为零
daChengLv := chuShu / beiChushu
achievement = publicmethod.DecimalEs(daChengLv, 3)
if daChengLv*100 >= cappingval { //达成率大于等于封顶值
if cappingval > 0 {
deFen := (weight / 100) * (cappingval / 100)
actual = publicmethod.DecimalEs(deFen, 2)
} else {
actual = weight
}
} else {
deFen := (weight / 100) * (daChengLv / 100)
actual = publicmethod.DecimalEs(deFen, 2)
}
} else {
actual = 0
achievement = 0
}
}
} else { //如果全奖值小于零奖值 执行一下操作
if score >= zeroprize { //实际结算值大于零奖值 那么达成率和实际得分都是0
actual = 0
achievement = 0
} else {
chuShu := score - zeroprize
beiChushu := allprize - zeroprize
if beiChushu != 0 { //判断除数不能为零
daChengLv := chuShu / beiChushu
achievement = publicmethod.DecimalEs(daChengLv, 3)
if daChengLv < 0 {
actual = 0
achievement = 0
} else {
if daChengLv*100 >= cappingval { //达成率大于等于封顶值
if cappingval > 0 {
deFen := (weight / 100) * (cappingval / 100)
actual = publicmethod.DecimalEs(deFen, 2)
} else {
actual = weight
}
} else {
deFen := (weight / 100) * (daChengLv / 100)
actual = publicmethod.DecimalEs(deFen, 2)
}
}
} else {
actual = 0
achievement = 0
}
}
}
}
return
}
/*
*
@ 作者: 秦东
@ 时间: 2022-10-28 11:06:45
@ 功能: 解析定性输出结构体
@ 参数
#natureCont 定性考核数据
@ 返回值
#sendData 展示数据
*/
func AnalysisDingXing(natureCont modelskpi.PostNatureFlow) (sendData DingXingList) {
var dimCont modelskpi.DutyClass
dimCont.GetCont(map[string]interface{}{"`id`": natureCont.Dimension}, "`title`")
//获取指标
var targetCont modelskpi.PostTarget
targetCont.GetCont(map[string]interface{}{"`id`": natureCont.Target}, "`title`")
//获取指标子栏目
var sunTargetCont modelskpi.PostSonTarget
sunTargetCont.GetCont(map[string]interface{}{"`id`": natureCont.SonTarget}, "`title`")
var detailsCont modelskpi.PostTargetDetails
detailsCont.GetCont(map[string]interface{}{"`id`": natureCont.Detailed}, "`title`", "`min_score`", "`max_score`", "`maxmoney`", "`minmoney`", "`punishmode`", "`company`")
sendData.Dimension = dimCont.Title //维度
sendData.Target = targetCont.Title //考核指标
sendData.Targetsun = sunTargetCont.Title //考核项目
sendData.Detailedtargent = detailsCont.Title //考核内容
var scoreStr string
if detailsCont.MinScore != 0 {
if detailsCont.MaxScore != 0 {
scoreStr = fmt.Sprintf("%v-%v%v", publicmethod.DecimalEs(float64(detailsCont.MinScore)/100, 2), publicmethod.DecimalEs(float64(detailsCont.MaxScore/100), 2), detailsCont.Company)
} else {
scoreStr = fmt.Sprintf("%v%v", publicmethod.DecimalEs(float64(detailsCont.MinScore/100), 2), detailsCont.Company)
}
} else {
if detailsCont.MaxScore != 0 {
scoreStr = fmt.Sprintf("%v%v", publicmethod.DecimalEs(float64(detailsCont.MaxScore/100), 2), detailsCont.Company)
}
}
sendData.Standard = scoreStr //考核标准(分)
var moneyStr string
if detailsCont.Minmoney != 0 {
if detailsCont.Maxmoney != 0 {
moneyStr = fmt.Sprintf("%v-%v元", publicmethod.DecimalEs(float64(detailsCont.Minmoney/100), 2), publicmethod.DecimalEs(float64(detailsCont.Maxmoney/100), 2))
} else {
moneyStr = fmt.Sprintf("%v元", publicmethod.DecimalEs(float64(detailsCont.Minmoney/100), 2))
}
} else {
if detailsCont.Maxmoney != 0 {
moneyStr = fmt.Sprintf("%v元", publicmethod.DecimalEs(float64(detailsCont.Maxmoney/100), 2))
}
}
sendData.StandardMoney = moneyStr //考核标准(钱)
addOrDec := "扣除"
if natureCont.AddOrDecrease == 1 {
addOrDec = "奖励"
}
sendData.Lanmuname = addOrDec //奖励OR扣除
sendData.ScoreVal = publicmethod.DecimalEs(natureCont.Score/100, 2) * float64(natureCont.HappenCount) //奖励或扣除的分数
sendData.MoneyVal = publicmethod.DecimalEs(natureCont.Money/100, 2) * float64(natureCont.HappenCountMoney) //奖励或扣除的钱
sendData.Reason = natureCont.Reason //考核原因
sendData.Unit = detailsCont.Company
return
}
/*
*
@ 作者: 秦东
@ 时间: 2022-10-28 10:44:57
@ 功能: 获取定性审批标题
@ 参数
#executor 执行人
#orgId 被执行人行政组织
#postId 被执行人岗位
#personLiable 被执行人KEY
#target 指标
#class 1定性,2:定量
@ 返回值
#
*/
func GetNatureFlowTitle(executor, orgId, postId, personLiable, target, happenTime int64, class int) (title string) {
//获取执行人
var exeUser modelshr.PersonArchives
exeUser.GetCont(map[string]interface{}{"`key`": executor}, "`name`")
//获取被执行人信息
var perUserCont modelshr.PersonArchives
perUserCont.GetCont(map[string]interface{}{"`key`": personLiable}, "`name`")
var orgCont modelshr.AdministrativeOrganization
orgCont.GetCont(map[string]interface{}{"`id`": orgId}, "`name`")
var postCont modelshr.Position
postCont.GetCont(map[string]interface{}{"`id`": postId}, "`name`")
//获取指标
var targetCont modelskpi.PostTarget
targetCont.GetCont(map[string]interface{}{"`id`": target}, "`title`")
timeStr := publicmethod.UnixTimeToDay(happenTime, 14)
if class != 1 {
timeStr = publicmethod.UnixTimeToDay(happenTime, 15)
}
title = fmt.Sprintf("%v提交\n%v%v%v\n%v考核数据", exeUser.Name, orgCont.Name, postCont.Name, perUserCont.Name, timeStr)
return
}
/*
*
@ 作者: 秦东
@ 时间: 2022-10-27 17:03:13
@ 功能: 读取审批流主表
@ 参数
#orderId 订单ID
@ 返回值
#
*/
func (g *GetFlowLogCont) ReadMainFlowLog(orderId string) {
g.mutext.Lock()
defer g.mutext.Unlock()
var flowLogCont modelskpi.PostWorkflowOrders
err := flowLogCont.GetCont(map[string]interface{}{`order_id`: orderId})
if err == nil {
g.FlowCont = flowLogCont
}
syncSeting.Done()
}
/*
*
@ 作者: 秦东
@ 时间: 2022-10-28 08:10:31
@ 功能: 定性考核数据
@ 参数
#orderId 订单ID
@ 返回值
#
*/
func (g *GetFlowLogCont) ReadNatureFlowLog(orderId string) {
g.mutext.Lock()
defer g.mutext.Unlock()
var flowLogCont []modelskpi.PostNatureFlow
err := overall.CONSTANT_DB_KPI.Model(&modelskpi.PostNatureFlow{}).Where("`order_id` = ?", orderId).Find(&flowLogCont).Error
if err == nil {
g.NatureFlow = flowLogCont
}
syncSeting.Done()
}
/*
*
@ 作者: 秦东
@ 时间: 2022-10-28 08:10:31
@ 功能: 定量考核数据
@ 参数
#orderId 订单ID
@ 返回值
#
*/
func (g *GetFlowLogCont) ReadMeterMainFlowLog(orderId string) {
g.mutext.Lock()
defer g.mutext.Unlock()
var flowLogCont []modelskpi.PostMeteringFlow
err := overall.CONSTANT_DB_KPI.Model(&modelskpi.PostMeteringFlow{}).Where("`order_id` = ?", orderId).Find(&flowLogCont).Error
if err == nil {
g.MeterFlow = flowLogCont
}
syncSeting.Done()
}
/*
*
@ 作者: 秦东
@ 时间: 2022-10-27 16:43:56
@ 功能:获取审批流详情-->整改措施专用(岗位)
@ 参数
#
@ 返回值
#
*/
func (a *ApiMethod) LookFlowMapCorra(c *gin.Context) {
var receivedValue LookFlowInfoCorra
err := c.ShouldBindJSON(&receivedValue)
if err != nil {
publicmethod.Result(100, err, c)
return
}
if receivedValue.Id == "" {
publicmethod.Result(101, receivedValue, c)
return
}
if receivedValue.Class == 0 {
receivedValue.Class = 1
}
//获取登录人信息
context, _ := publicmethod.LoginMyCont(c)
//获取审批流相关内容
var getFlowCont GetFlowLogCont
syncSeting.Add(1)
go getFlowCont.ReadMainFlowLog(receivedValue.Id) //获取审批主表
if receivedValue.Class == 1 {
//定性
syncSeting.Add(1)
go getFlowCont.ReadNatureFlowLog(receivedValue.Id) //获取审批主表
syncSeting.Wait()
mainFlowLog, natureFlowList, _ := getFlowCont.readDataLock() //读取线程通道数据
var sendDataCont SendPostDingXing
sendDataCont.OrderId = strconv.FormatInt(mainFlowLog.OrderId, 10)
sendDataCont.Title = GetNatureFlowTitle(mainFlowLog.Executor, mainFlowLog.DepartmentId, mainFlowLog.PostId, mainFlowLog.PersonLiable, mainFlowLog.Target, mainFlowLog.HappenTime, 1)
sendDataCont.FlowMapAll, _, _ = wechatcallback.GetOneNodeCont(mainFlowLog.WorkFlow, mainFlowLog.Step)
for _, v := range natureFlowList {
sendDataCont.List = append(sendDataCont.List, AnalysisDingXing(v))
}
sendDataCont.Isset = 1
var zhiXingRen []string
//判断当前人是否要审批
if mainFlowLog.NextStep > 1 {
if mainFlowLog.NextExecutor != "" {
err = json.Unmarshal([]byte(mainFlowLog.NextExecutor), &zhiXingRen)
if err == nil {
dangQianRen := strconv.FormatInt(context.Key, 10)
if publicmethod.IsInTrue[string](dangQianRen, zhiXingRen) == true {
// sendDataCont.Isset = 2
}
}
}
}
//获取挂号信息
//判断此号码是否可以使用
var setUpRegister modelskpi.Register
err := setUpRegister.GetCont(map[string]interface{}{"`number`": receivedValue.Num}, "`state`", "`id`")
if err != nil {
sendDataCont.Isset = 2
}
if setUpRegister.State != 1 {
sendDataCont.Isset = 2
}
//获取步进值
var oacl modelskpi.OpenApprovalChangeLog
clickStep, stepErr := oacl.GetMAx(mainFlowLog.OrderId, zhiXingRen)
if stepErr != nil {
sendDataCont.Stepper = 1
} else {
sendDataCont.Stepper = clickStep + 1
}
if mainFlowLog.EnclosureFormat != "" {
json.Unmarshal([]byte(mainFlowLog.EnclosureFormat), &sendDataCont.Enclosure)
}
publicmethod.Result(0, sendDataCont, c) //输出
} else {
//定量
syncSeting.Add(1)
go getFlowCont.ReadMeterMainFlowLog(receivedValue.Id) //获取审批主表
syncSeting.Wait()
mainFlowLog, _, meterFlowList := getFlowCont.readDataLock() //读取线程通道数据
var sendDataCont SendPostDingLiang
sendDataCont.OrderId = strconv.FormatInt(mainFlowLog.OrderId, 10)
sendDataCont.Title = GetNatureFlowTitle(mainFlowLog.Executor, mainFlowLog.DepartmentId, mainFlowLog.PostId, mainFlowLog.PersonLiable, mainFlowLog.Target, mainFlowLog.HappenTime, 2)
sendDataCont.FlowMapAll, _, _ = wechatcallback.GetOneNodeCont(mainFlowLog.WorkFlow, mainFlowLog.Step)
sendDataCont.Isset = 1
//判断当前人是否要审批
var zhiXingRen []string
if mainFlowLog.NextStep > 1 {
if mainFlowLog.NextExecutor != "" {
err = json.Unmarshal([]byte(mainFlowLog.NextExecutor), &zhiXingRen)
if err == nil {
dangQianRen := strconv.FormatInt(context.Key, 10)
if publicmethod.IsInTrue[string](dangQianRen, zhiXingRen) == true {
// sendDataCont.Isset = 2
}
}
}
}
//获取挂号信息
//判断此号码是否可以使用
var setUpRegister modelskpi.Register
err := setUpRegister.GetCont(map[string]interface{}{"`number`": receivedValue.Num}, "`state`", "`id`")
if err != nil {
sendDataCont.Isset = 2
}
if setUpRegister.State != 1 {
sendDataCont.Isset = 2
}
//获取步进值
var oacl modelskpi.OpenApprovalChangeLog
clickStep, stepErr := oacl.GetMAx(mainFlowLog.OrderId, zhiXingRen)
if stepErr != nil {
sendDataCont.Stepper = 1
} else {
sendDataCont.Stepper = clickStep + 1
}
if mainFlowLog.EnclosureFormat != "" {
json.Unmarshal([]byte(mainFlowLog.EnclosureFormat), &sendDataCont.Enclosure)
}
for _, v := range meterFlowList {
sendDataCont.List = append(sendDataCont.List, AnalysisDingLiang(v))
}
publicmethod.Result(0, sendDataCont, c) //输出
}
}