From b1b9d35cd9d0cdf9f6a5d596053ffedfb9bac4bb Mon Sep 17 00:00:00 2001 From: herenshan112 Date: Sat, 29 Oct 2022 16:03:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=8B=E6=9C=BA=E7=AB=AFV1.0=E5=BC=80?= =?UTF-8?q?=E5=8F=91=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/version1/entry.go | 4 +- api/version1/postseting/postweb/appflowlog.go | 602 +++++++++- api/version1/postseting/postweb/postration.go | 5 +- api/version1/postseting/postweb/posttarget.go | 22 +- api/version1/postseting/postweb/type.go | 87 +- api/version1/systemapproval/entry.go | 29 + api/version1/systemapproval/post_nature.go | 1022 +++++++++++++++++ apirouter/entry.go | 2 + apirouter/v1/approvalsystem/approval_route.go | 20 + apirouter/v1/approvalsystem/type.go | 4 + apirouter/v1/postseting/web.go | 5 +- config/configApp/server.go | 1 + initialization/route/initRoute.go | 3 + .../wechatcallback/event_processing.go | 52 +- middleware/wechatapp/wechatcallback/type.go | 2 +- middleware/wechatapp/wechatsendmsg/type.go | 2 +- models/modelskpi/open_approval_change_log.go | 17 + overall/publicmethod/type.go | 1 + 18 files changed, 1842 insertions(+), 38 deletions(-) create mode 100644 api/version1/systemapproval/entry.go create mode 100644 api/version1/systemapproval/post_nature.go create mode 100644 apirouter/v1/approvalsystem/approval_route.go create mode 100644 apirouter/v1/approvalsystem/type.go diff --git a/api/version1/entry.go b/api/version1/entry.go index 7db1163..cc8055b 100644 --- a/api/version1/entry.go +++ b/api/version1/entry.go @@ -10,6 +10,7 @@ import ( "key_performance_indicators/api/version1/jurisdiction/jurisdictionpc" "key_performance_indicators/api/version1/postseting/postpc" "key_performance_indicators/api/version1/postseting/postweb" + "key_performance_indicators/api/version1/systemapproval" ) type ApiEntry struct { @@ -21,7 +22,8 @@ type ApiEntry struct { BookImg bookimg.ApiMethod //图文信息管理 JurisdictionpcApi jurisdictionpc.ApiMethod //权限模块PC端 EmpowerApi empower.ApiMethod //系统授权 - WorkFlowChat flowchart.ApiMethod + WorkFlowChat flowchart.ApiMethod //工作流 + SystemAppExamine systemapproval.ApiMethod //系统审批处理 } var AppApiEntry = new(ApiEntry) diff --git a/api/version1/postseting/postweb/appflowlog.go b/api/version1/postseting/postweb/appflowlog.go index e13038c..0726682 100644 --- a/api/version1/postseting/postweb/appflowlog.go +++ b/api/version1/postseting/postweb/appflowlog.go @@ -1,7 +1,10 @@ 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" @@ -39,10 +42,10 @@ func (a *ApiMethod) GetPostFlowLog(c *gin.Context) { 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 != "" { + if receivedValue.OrgId != 0 { gormDb = gormDb.Where("`org_id` = ?", receivedValue.OrgId) } - if receivedValue.PostId != "" { + if receivedValue.PostId != 0 { gormDb = gormDb.Where("`post_id` = ?", receivedValue.PostId) } if receivedValue.DayTime != "" { @@ -60,8 +63,8 @@ func (a *ApiMethod) GetPostFlowLog(c *gin.Context) { if receivedValue.ApprovalState == 2 { gormDb = gormDb.Where("FIND_IN_SET(?,`next_executor`)", context.Key) } - - err := gormDb.Order("`id` DESC").Find(&flowLogList).Error + 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 { @@ -88,20 +91,20 @@ func (a *ApiMethod) GetPostFlowLog(c *gin.Context) { sendCont.Result = "起草" //审批结果 sendCont.Statetype = 1 //审批状态 case 2: - sendCont.Result = "驳回" - sendCont.Statetype = 4 - case 3: sendCont.Result = "审批中" sendCont.Statetype = 0 + case 3: + sendCont.Result = "驳回" + sendCont.Statetype = 4 case 4: sendCont.Result = "归档" - sendCont.Statetype = 1 + sendCont.Statetype = 3 case 5: sendCont.Result = "废弃" - sendCont.Statetype = 1 + sendCont.Statetype = 3 case 6: sendCont.Result = "删除" - sendCont.Statetype = 1 + sendCont.Statetype = 3 default: sendCont.Result = "审批中" sendCont.Statetype = 0 @@ -128,9 +131,586 @@ func (a *ApiMethod) GetPostFlowLog(c *gin.Context) { _, 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) //输出 + } + +} diff --git a/api/version1/postseting/postweb/postration.go b/api/version1/postseting/postweb/postration.go index 6e3e735..9b4edf6 100644 --- a/api/version1/postseting/postweb/postration.go +++ b/api/version1/postseting/postweb/postration.go @@ -419,7 +419,10 @@ func (a *ApiMethod) SubmitRationPostCont(c *gin.Context) { //卡片跳转地址 var cardActionContStr wechatsendmsg.CardActionCont cardActionContStr.Type = 1 - cardActionContStr.Url = fmt.Sprintf("http://new.hxgk.group/#/quantitativeList?id=%v", uuId) + + jumpUrl := fmt.Sprintf("%v/#/pages/approval/postdingliang?orderid=%v&class=%v", overall.CONSTANT_CONFIG.Appsetup.WebUrl, uuId, 2) + cardActionContStr.Url = jumpUrl + // cardActionContStr.Url = fmt.Sprintf("http://new.hxgk.group/#/quantitativeList?id=%v", uuId) var sendButtionMsg wechatsendmsg.SendButtonInteractionSimplify sendButtionMsg.Touser = strings.Join(sendUserList, "|") diff --git a/api/version1/postseting/postweb/posttarget.go b/api/version1/postseting/postweb/posttarget.go index 769c4f7..3fc6820 100644 --- a/api/version1/postseting/postweb/posttarget.go +++ b/api/version1/postseting/postweb/posttarget.go @@ -865,7 +865,10 @@ func (a *ApiMethod) SendUsNatureEvaluation(c *gin.Context) { //卡片跳转地址 var cardActionContStr wechatsendmsg.CardActionCont cardActionContStr.Type = 1 - cardActionContStr.Url = fmt.Sprintf("http://new.hxgk.group/#/quantitativeList?id=%v", uuId) + + jumpUrl := fmt.Sprintf("%v/#/pages/approval/postdingliang?orderid=%v&class=%v", overall.CONSTANT_CONFIG.Appsetup.WebUrl, uuId, 1) + cardActionContStr.Url = jumpUrl + // cardActionContStr.Url = fmt.Sprintf("http://new.hxgk.group/#/quantitativeList?id=%v", uuId) var sendButtionMsg wechatsendmsg.SendButtonInteractionSimplify sendButtionMsg.Touser = strings.Join(sendUserList, "|") @@ -1291,7 +1294,8 @@ func ApproveFlow(systemApp string, flowMap []publicmethod.FlowChartList, flowOne zeRenRenCont.GetCont(map[string]interface{}{"`key`": postNatuerFlowCont.Executor}, "`name`", "`number`") markDowmStr = fmt.Sprintf("%v\n> \n>提报人: %v(%v)", markDowmStr, zeRenRenCont.Name, zeRenRenCont.Number) - markDowmStr = fmt.Sprintf("%v\n>\n>[填写整改措施](http://new.hxgk.group/#/rectification?id=%v&num=%v)", markDowmStr, pwoContOld.OrderId, registerNum) + // markDowmStr = fmt.Sprintf("%v\n>\n>[填写整改措施](http://new.hxgk.group/#/rectification?id=%v&num=%v)", markDowmStr, pwoContOld.OrderId, registerNum) + markDowmStr = fmt.Sprintf("%v\n>\n>[填写整改措施](%v/#/pages/approval/corraction?id=%v&num=%v)", markDowmStr, overall.CONSTANT_CONFIG.Appsetup.WebUrl, pwoContOld.OrderId, registerNum) //发送同通信息 wechatcallback.SendNoticeMsg(sendToUserList, markDowmStr, systemApp) } else { //无需填写信息。继续发送 @@ -1409,7 +1413,7 @@ func ApproveFlow(systemApp string, flowMap []publicmethod.FlowChartList, flowOne twoTitleTextList = append(twoTitleTextList, twoTitleTextCont) } - wechatcallback.SendButtonCard(systemApp, postTarDeta.Title, postTarDetailsDeta.Title, sunTextCont, fv.NodeName, pwoContOld.OrderId, sendNextStep, sendToUserList, quoteAreaInfo, twoTitleTextList) + wechatcallback.SendButtonCard(systemApp, postTarDeta.Title, postTarDetailsDeta.Title, sunTextCont, fv.NodeName, pwoContOld.OrderId, sendNextStep, pwoContOld.Class, sendToUserList, quoteAreaInfo, twoTitleTextList) } } else { //定量操作 //定量操作 @@ -1458,9 +1462,13 @@ func ApproveFlow(systemApp string, flowMap []publicmethod.FlowChartList, flowOne twoTitleTextList = append(twoTitleTextList, twoTitleTextCont) } - wechatcallback.SendButtonCard(systemApp, postShemeCont.Title, postShemeCont.Content, "", fv.NodeName, pwoContOld.OrderId, sendNextStep, sendToUserList, quoteAreaInfo, twoTitleTextList) + wechatcallback.SendButtonCard(systemApp, postShemeCont.Title, postShemeCont.Content, "", fv.NodeName, pwoContOld.OrderId, sendNextStep, pwoContOld.Class, sendToUserList, quoteAreaInfo, twoTitleTextList) } } else { + jumpUrl := fmt.Sprintf("%v/#/pages/approval/postdingxin?orderid=%v&class=%v", overall.CONSTANT_CONFIG.Appsetup.WebUrl, pwoContOld.OrderId, pwoContOld.Class) + if pwoContOld.Class != 1 { + jumpUrl = fmt.Sprintf("%v/#/pages/approval/postdingliang?orderid=%v&class=%v", overall.CONSTANT_CONFIG.Appsetup.WebUrl, pwoContOld.OrderId, pwoContOld.Class) + } //抄送信息 markDowmStr := "审批通过-抄送" markDowmStr = fmt.Sprintf("%v\n>**事项详情** ", markDowmStr) @@ -1524,7 +1532,8 @@ func ApproveFlow(systemApp string, flowMap []publicmethod.FlowChartList, flowOne zeRenRenCont.GetCont(map[string]interface{}{"`key`": postNatuerFlowCont.PersonLiable}, "`name`", "`number`") markDowmStr = fmt.Sprintf("%v\n> \n>被考核人: %v(%v)", markDowmStr, zeRenRenCont.Name, zeRenRenCont.Number) markDowmStr = fmt.Sprintf("%v\n>发生时间: %v ", markDowmStr, publicmethod.UnixTimeToDay(postNatuerFlowCont.HappenTime, 1)) - markDowmStr = fmt.Sprintf("%v\n>\n>[查看审批详情](http://new.hxgk.group/#/quantitativeList?id=%v)", markDowmStr, pwoContOld.OrderId) + // markDowmStr = fmt.Sprintf("%v\n>\n>[查看审批详情](http://new.hxgk.group/#/quantitativeList?id=%v)", markDowmStr, pwoContOld.OrderId) + markDowmStr = fmt.Sprintf("%v\n>\n>[查看审批详情](%v)", markDowmStr, jumpUrl) } else { //定量操作 var postMeterFlowCont modelskpi.PostMeteringFlow @@ -1543,7 +1552,8 @@ func ApproveFlow(systemApp string, flowMap []publicmethod.FlowChartList, flowOne zeRenRenCont.GetCont(map[string]interface{}{"`key`": postMeterFlowCont.PersonLiable}, "`name`", "`number`") markDowmStr = fmt.Sprintf("%v\n> \n>被考核人: %v(%v)", markDowmStr, zeRenRenCont.Name, zeRenRenCont.Number) - markDowmStr = fmt.Sprintf("%v\n>\n>[查看审批详情](http://new.hxgk.group/#/quantitativeList?id=%v)", markDowmStr, pwoContOld.OrderId) + // markDowmStr = fmt.Sprintf("%v\n>\n>[查看审批详情](http://new.hxgk.group/#/quantitativeList?id=%v)", markDowmStr, pwoContOld.OrderId) + markDowmStr = fmt.Sprintf("%v\n>\n>[查看审批详情](%v)", markDowmStr, jumpUrl) } //发送抄送信息 wechatcallback.SendNoticeMsg(sendToUserList, markDowmStr, systemApp) diff --git a/api/version1/postseting/postweb/type.go b/api/version1/postseting/postweb/type.go index 2e2116c..2824364 100644 --- a/api/version1/postseting/postweb/type.go +++ b/api/version1/postseting/postweb/type.go @@ -12,6 +12,21 @@ type ApiMethod struct{} var syncSeting = sync.WaitGroup{} +// 获取审批详情 +type GetFlowLogCont struct { + FlowCont modelskpi.PostWorkflowOrders //审批工作流 + NatureFlow []modelskpi.PostNatureFlow //岗位定性考核流水 + MeterFlow []modelskpi.PostMeteringFlow //岗位定量考核流水 + mutext sync.RWMutex +} + +// 读审批记录详情文件锁数据 +func (g *GetFlowLogCont) readDataLock() (modelskpi.PostWorkflowOrders, []modelskpi.PostNatureFlow, []modelskpi.PostMeteringFlow) { + g.mutext.RLock() + defer g.mutext.RUnlock() + return g.FlowCont, g.NatureFlow, g.MeterFlow +} + // 岗位考核WEB端入口 func (a *ApiMethod) Index(c *gin.Context) { outputCont := publicmethod.MapOut[string]() @@ -214,7 +229,7 @@ type sendPostQuanCont struct { CompletionRate string `json:"completionRate"` //达成率 ZeroPrize float64 `json:"zeroprize"` //零奖值 AllPrize float64 `json:"allprize"` //全奖值 - CappingPrize float64 `json:"cappingprize"` //达成率 + CappingPrize float64 `json:"cappingprize"` //封顶值 Weight float64 `json:"weight"` //指标权重 ScoringMethod int `json:"scoringmethod"` //计分方式(1:自动;2:手动) } @@ -223,8 +238,8 @@ type sendPostQuanCont struct { type postFlowLog struct { publicmethod.PagesTurn Title string `json:"title"` //指标名 - OrgId string `json:"orgid"` //行政组织 - PostId string `json:"postid"` //岗位 + OrgId int64 `json:"orgid"` //行政组织 + PostId int64 `json:"postid"` //岗位 DayTime string `json:"daytime"` //时间 State int `json:"state"` //状态:0:全部;1:起草;2:审批中;3:通过;4:驳回 ApprovalState int `json:"approvalstate" ` //审批:0:全部;1:已处理;2:未处理 @@ -245,4 +260,70 @@ type SendPostFlowLog struct { Days int64 `json:"days"` //天 Node string `json:"node"` //当前节点 MonthDays string `json:"monthdays"` //提报日期 + Class int `json:"class"` //1、定性;2、定量 +} + +// 查看审批流详情 +type LookFlowInfo struct { + publicmethod.PublicId + Class int `json:"class"` //属性1、定性;2、定量 +} + +// 输出岗位定性 +type SendPostDingXing struct { + OrderId string `json:"orderid"` //订单编号 + Title string `json:"title"` //标题 + List []DingXingList `json:"list"` + FlowMapAll []publicmethod.FlowChartList `json:"flowmapall"` //流程图 + Isset int `json:"isset"` //本人是否需要审批 + Enclosure []publicmethod.EnclosureFormat `json:"enclosure"` //附件 + Stepper int `json:"stepper"` //步进器 +} + +// 定性考核 +type DingXingList struct { + Dimension string `json:"dimension"` //维度 + Target string `json:"target"` //考核指标 + Targetsun string `json:"targetsun"` //考核项目 + Detailedtargent string `json:"detailedtargent"` //考核内容 + Standard string `json:"standard"` //考核标准(分) + StandardMoney string `json:"standardmoney"` //考核标准(钱) + Lanmuname string `json:"lanmuname"` //奖励OR扣除 + ScoreVal float64 `json:"scoreval"` //奖励或扣除的分数 + MoneyVal float64 `json:"moneyval"` //奖励或扣除的钱 + Reason string `json:"reason"` //考核原因 + Unit string `json:"unit"` //单位 +} + +// 输出岗位定量 +type SendPostDingLiang struct { + OrderId string `json:"orderid"` //订单编号 + Title string `json:"title"` //标题 + List []DingLiangList `json:"list"` + FlowMapAll []publicmethod.FlowChartList `json:"flowmapall"` //流程图 + Isset int `json:"isset"` //本人是否需要审批 + Enclosure []publicmethod.EnclosureFormat `json:"enclosure"` //附件 + Stepper int `json:"stepper"` //步进器 +} + +// 岗位定量考核 +type DingLiangList struct { + Title string `json:"title"` //指标 + Target string `json:"target"` //考核指标 + ZeroPrize float64 `json:"zeroprize"` //零奖值 + AllPrize float64 `json:"allprize"` //全奖值 + CappingVal float64 `json:"cappingval"` //封顶值 + Weight float64 `json:"weight"` //权重分 + Score float64 `json:"score"` //实际值 + Achievement float64 `json:"achievement"` //达成率 + Actual float64 `json:"actual"` //指标得分 + Content string `json:"content"` //说明 + Unit string `json:"unit"` //说明 +} + +// 查看审批流详情 岗位整改措施专用 +type LookFlowInfoCorra struct { + publicmethod.PublicId + Class int `json:"class"` //属性1、定性;2、定量 + Num string `jsonL:"num"` //整改识别 } diff --git a/api/version1/systemapproval/entry.go b/api/version1/systemapproval/entry.go new file mode 100644 index 0000000..f56e111 --- /dev/null +++ b/api/version1/systemapproval/entry.go @@ -0,0 +1,29 @@ +package systemapproval + +import ( + "key_performance_indicators/overall/publicmethod" + "sync" + + "github.com/gin-gonic/gin" +) + +// 系统内部审批处理 +type ApiMethod struct{} + +// 协程设置 +var syncSeting = sync.WaitGroup{} + +// 系统内部审批处理 +func (a *ApiMethod) Index(c *gin.Context) { + outputCont := publicmethod.MapOut[string]() + outputCont["index"] = "系统内部审批处理入口" + publicmethod.Result(0, outputCont, c) +} + +// 审批参数 +type AppFlowData struct { + OrderId string `json:"orderid"` //订单ID + YesOrNo int `json:"yesorno"` //1:批准;2:驳回 + Content string `json:"content"` //审批意见 + Stepper int `json:"stepper"` //步进器 +} diff --git a/api/version1/systemapproval/post_nature.go b/api/version1/systemapproval/post_nature.go new file mode 100644 index 0000000..16c5da6 --- /dev/null +++ b/api/version1/systemapproval/post_nature.go @@ -0,0 +1,1022 @@ +package systemapproval + +import ( + "encoding/json" + "fmt" + "key_performance_indicators/api/version1/flowchart" + "key_performance_indicators/middleware/wechatapp/wechatcallback" + "key_performance_indicators/middleware/wechatapp/wechatsendmsg" + "key_performance_indicators/models/modelshr" + "key_performance_indicators/models/modelskpi" + "key_performance_indicators/overall" + "key_performance_indicators/overall/publicmethod" + "strconv" + "strings" + "time" + + "github.com/gin-gonic/gin" +) + +// 岗位审批 +func (a *ApiMethod) PostNatureAppFlow(c *gin.Context) { + var receivedValue AppFlowData + err := c.ShouldBindJSON(&receivedValue) + if err != nil { + publicmethod.Result(100, err, c) + return + } + if receivedValue.OrderId != "" { + publicmethod.Result(101, err, c) + return + } + if receivedValue.YesOrNo == 0 { + receivedValue.YesOrNo = 2 + } + if receivedValue.Stepper == 0 { + receivedValue.Stepper = 1 + } + //获取登录人信息 + context, err := publicmethod.LoginMyCont(c) + if err != nil { + publicmethod.Result(1, err, c, "您无权进行此操作!") + return + } + //获取订单信息 + var orderCont modelskpi.PostWorkflowOrders + err = orderCont.GetCont(map[string]interface{}{"`order_id`": receivedValue.OrderId}) + if err != nil { + publicmethod.Result(1, err, c, "该流程不存在!请检查数据!") + return + } + flowMap, flowCont, err := wechatcallback.GetOneNodeCont(orderCont.WorkFlow, orderCont.NextStep) + if err != nil { + publicmethod.Result(1, err, c, "该流程不存在!请检查数据!") + return + } + //获取当前审批人是否是本人 + nextExecutor := strings.Split(orderCont.NextExecutor, ",") + if len(nextExecutor) < 1 { + publicmethod.Result(1, err, c, "您不是审批人!请不要进行操作!") + return + } + contextKeyStr := strconv.FormatInt(context.Key, 10) + if publicmethod.IsInTrue[string](contextKeyStr, nextExecutor) == false { + publicmethod.Result(1, err, c, "您不是审批人!请不要进行操作!") + return + } + //判断节点是否可操作 + runIsTrue, responseCode := UpDataAppconueFlowLog(orderCont.OrderId, context.Key, receivedValue.Stepper, receivedValue.YesOrNo, orderCont.Class, flowCont) + if runIsTrue == 1 { + syncSeting.Add(1) + go EidtFlowLog(orderCont.OrderId, flowMap, contextKeyStr, receivedValue.Content, receivedValue.YesOrNo, orderCont.NextStep) //更改操作流程节点信息 + + var clickUserCont modelshr.PersonArchives + clickUserCont.GetCont(map[string]interface{}{"`id`": context.Id}) + clickEnter := strconv.Itoa(receivedValue.YesOrNo) + syncSeting.Add(1) + go UpdataOtherButtonTextXml("kpi", clickEnter, responseCode, clickUserCont, flowCont, 1) //更新按钮操作 + switch receivedValue.YesOrNo { + case 1: //同意 + syncSeting.Add(1) + go ApproveFlow("kpi", flowMap, flowCont, orderCont.NextStep, orderCont) + case 2: //驳回 + syncSeting.Add(1) + go RejectFlow("kpi", flowMap, flowCont, orderCont.NextStep, orderCont) + case 3: //撤回 + default: //未知操作 + } + } + syncSeting.Wait() + publicmethod.Result(0, err, c) +} + +/* +* +@ 作者: 秦东 +@ 时间: 2022-10-06 11:42:06 +@ 功能: 更改操作流程节点信息 +@ 参数 + + #pwoId 岗位审批工作流ID + #flowMap 流程结构体 + #operatorWechat 操作人 + #appIdea 操作意见 + #clickEnter 操作 + #step 执行的哪一步 + +func EidtFlowLog(pwoId int64, flowMap []publicmethod.FlowChartList, operatorWechat, appIdea string, clickEnter, step int) +@ 返回值 + + # +*/ +func EidtFlowLog(pwoId int64, flowMap []publicmethod.FlowChartList, operatorWechat, appIdea string, clickEnter, step int) { + defer syncSeting.Done() + // flowState := 3 //判断流程状态 + var newFlowMap []publicmethod.FlowChartList + for _, v := range flowMap { + var newFlowMapCont publicmethod.FlowChartList + + newFlowMapCont.Step = v.Step //步伐 + newFlowMapCont.NodeName = v.NodeName //节点名称 + newFlowMapCont.Class = v.Class //节点类型 1、普通节点;2、运行中指定节点 + newFlowMapCont.RunType = v.RunType //运行状态(1:开始;2:操作点;3:结束) + newFlowMapCont.NodeRelationship = v.NodeRelationship + if v.Step == step { //获取到当前执行的节点 + newFlowMapCont.State = 2 //状态 1、不点亮;2、点亮 + for _, uv := range v.UserList { //遍历审批人列表 + if uv.Wechat == operatorWechat { //当前操作人 + var logCont publicmethod.LogList + switch clickEnter { + case 1: + logCont.State = 2 + case 2: + logCont.State = 3 + default: + logCont.State = 1 + } + logCont.Content = appIdea + logCont.TimeVal = publicmethod.UnixTimeToDay(time.Now().Unix(), 1) + uv.LogList = append(uv.LogList, logCont) + } + newFlowMapCont.UserList = append(newFlowMapCont.UserList, uv) + } + } else { + newFlowMapCont.State = v.Class //状态 1、不点亮;2、点亮 + newFlowMapCont.UserList = v.UserList + } + + newFlowMap = append(newFlowMap, newFlowMapCont) + } + jsonStr, _ := json.Marshal(newFlowMap) + var pwoCont modelskpi.PostWorkflowOrders + pwoCont.EiteCont(map[string]interface{}{"`id`": pwoId}, map[string]interface{}{"`work_flow`": string(jsonStr), "`time`": time.Now().Unix()}) +} + +/* +* +@ 作者: 秦东 +@ 时间: 2022-10-29 10:24:33 +@ 功能: 更新审批记录 +@ 参数 + + #orderId 订单Key + #step 步进器 + #flowCont 审批节点 + #clickEnterInt 0:未操作;1:同意;2:驳回;3:撤回 + #clickUser 操作人 + #class 1:定性;2:定量 + #responseCode 更新卡片所需要消费的code,可通过发消息接口和回调接口返回值获取,一个code只能调用一次该接口,且只能在72小时内调用 + +UpDataAppconueFlowLog(orderId, clickUser int64, step, clickEnterInt, class int, flowCont publicmethod.FlowChartList) +@ 返回值 + + #runIsTrue 是否可继续操作 +*/ +func UpDataAppconueFlowLog(orderId, clickUser int64, step, clickEnterInt, class int, flowCont publicmethod.FlowChartList) (runIsTrue int, responseCode string) { + runIsTrue = 1 + //判断当前步进位是否已经被操作 + var operatorIsTreu modelskpi.OpenApprovalChangeLog + err := operatorIsTreu.GetCont(map[string]interface{}{"`orderid`": orderId, `stepper`: step}) + if err != nil { //无记录,可继续操作 + wechatcallback.UpdateLogNotChange(orderId) + runIsTrue = 1 + operatorIsTreu.Type = 2 + operatorIsTreu.Title = flowCont.NodeName + operatorIsTreu.Operator = clickUser + operatorIsTreu.OrderId = orderId + operatorIsTreu.OperatorTime = time.Now().Unix() + operatorIsTreu.Step = flowCont.Step + operatorIsTreu.OperatorType = 2 + operatorIsTreu.Msgid = "" + operatorIsTreu.ResponseCode = "" + operatorIsTreu.Stepper = step + operatorIsTreu.ChangeIsTrue = 2 + operatorIsTreu.YesOrNo = clickEnterInt + operatorIsTreu.Eiteyime = time.Now().Unix() + overall.CONSTANT_DB_KPI.Create(&operatorIsTreu) + } else { //有记录判断该节点是否可继续操作 + responseCode = operatorIsTreu.ResponseCode + if operatorIsTreu.ChangeIsTrue != 1 { //同级人员已经操作过不可继续操作 + runIsTrue = 2 + //获取操作人信息 + var carryPeopleOld modelshr.PersonArchives + carryPeopleOld.GetCont(map[string]interface{}{"`key`": operatorIsTreu.Operator}, "`number`", "`name`", "`wechat`", "`work_wechat`") + toUserName := "" + if clickUser != operatorIsTreu.Operator { //当前操作人不是已操作人 + //获取同节点其他操作人 + var otherPeopleWechat []string + operatorStr := strconv.FormatInt(operatorIsTreu.Operator, 10) + for _, v := range flowCont.UserList { + if operatorStr != v.Id { + if publicmethod.IsInTrue[string](v.Wechat, otherPeopleWechat) == false { + otherPeopleWechat = append(otherPeopleWechat, v.Wechat) + } + } + } + toUserName = strings.Join(otherPeopleWechat, "|") + } else { + toUserName = carryPeopleOld.Wechat + if carryPeopleOld.WorkWechat != "" { + toUserName = carryPeopleOld.WorkWechat + } + } + if toUserName != "" { + var sendMsgText wechatsendmsg.SendTextCard + sendMsgText.Touser = toUserName + sendMsgText.Msgtype = "textcard" + agentIdInt, _ := strconv.ParseInt(overall.CONSTANT_CONFIG.WechatKpi.Agentid, 10, 64) + sendMsgText.Agentid = agentIdInt + sendMsgText.EnableDuplicateCheck = 0 + sendMsgText.DuplicateCheckInterval = 1800 + sendMsgText.EnableIdTrans = 0 + sendMsgText.MsgBody.Title = "已审批" + sendMsgText.MsgBody.Description = fmt.Sprintf("此审批流程已被%v审批!请不要重复操作!", carryPeopleOld.Name) + + jumpUrl := fmt.Sprintf("%v/#/pages/approval/postdingxin?orderid=%v&class=%v", overall.CONSTANT_CONFIG.Appsetup.WebUrl, orderId, class) + if class != 1 { + jumpUrl = fmt.Sprintf("%v/#/pages/approval/postdingliang?orderid=%v&class=%v", overall.CONSTANT_CONFIG.Appsetup.WebUrl, orderId, class) + } + sendMsgText.MsgBody.URL = jumpUrl + sendMsgText.MsgBody.BtnTxt = "" + sendMsgText.SendMsg("kpi") + } + + } else { //有记录,没有人锁止操作,可继续操作 + runIsTrue = 1 + operatorIsTreu.EiteCont(map[string]interface{}{"`id`": operatorIsTreu.Id}, map[string]interface{}{"`change_is_true`": 2, "`operator`": clickUser, "`yesorno`": clickEnterInt, "eiteyime": time.Now().Unix()}) + } + } + return +} + +/* +* +@ 作者: 秦东 +@ 时间: 2022-10-06 15:13:59 +@ 功能: 更新审批节点审批文案 +@ 参数 + + #systemApp 系统 + #clickEnter 1:同意;2:驳回 + #responseCode 更新卡片所需要消费的code,可通过发消息接口和回调接口返回值获取,一个code只能调用一次该接口,且只能在72小时内调用 + #carryOutPeople 当前操作人信息 + #flowOneCont 当前审批节点信息 + #isAll 1:发送全部,2:发送其他 + +UpdataOtherButtonTextXml(systemApp, clickEnter, responseCode string, carryOutPeople modelshr.PersonArchives, flowOneCont publicmethod.FlowChartList, isAll int) +@ 返回值 + + # +*/ +func UpdataOtherButtonTextXml(systemApp, clickEnter, responseCode string, carryOutPeople modelshr.PersonArchives, flowOneCont publicmethod.FlowChartList, isAll int) { + defer syncSeting.Done() + var buttonClickNAme string + switch clickEnter { + case "1": + buttonClickNAme = fmt.Sprintf("%v已批准", carryOutPeople.Name) + case "3": + buttonClickNAme = fmt.Sprintf("%v已撤回", carryOutPeople.Name) + default: + buttonClickNAme = fmt.Sprintf("%v已驳回", carryOutPeople.Name) + } + // wechatOpenID := carryOutPeople.Wechat + var userOpenId []string + if len(flowOneCont.UserList) > 0 { + for _, v := range flowOneCont.UserList { + if isAll != 1 { + if v.Wechat != carryOutPeople.Wechat && v.Wechat != carryOutPeople.WorkWechat && publicmethod.IsInTrue[string](v.Wechat, userOpenId) == false { + userOpenId = append(userOpenId, v.Wechat) + } + } else { + if publicmethod.IsInTrue[string](v.Wechat, userOpenId) == false { + userOpenId = append(userOpenId, v.Wechat) + } + } + + } + } + // userOpenId = append(userOpenId, "KaiXinGuo") + if len(userOpenId) > 0 { + var sendMsgText wechatsendmsg.UpdateButtonNotClickable + sendMsgText.Userids = userOpenId + sendMsgText.Atall = 0 + agentIdInt, _ := strconv.ParseUint(overall.CONSTANT_CONFIG.WechatKpi.Agentid, 10, 32) + sendMsgText.Agentid = agentIdInt + sendMsgText.ResponseCode = responseCode + sendMsgText.Button.ReplaceName = buttonClickNAme + callBackCont, err := sendMsgText.UpdateButtonNotClick(systemApp) + // sendMsgText.UpdateButtonNotClick(systemApp) + fmt.Printf("10、更新发送信息返回:%v-----------%v----------->%v------》%v\n", callBackCont, err, sendMsgText, buttonClickNAme) + } else { + fmt.Printf("\n\n同级没有其他审批人:%v\n\n%v\n\n", carryOutPeople, flowOneCont) + } +} + +/* +* +@ 作者: 秦东 +@ 时间: 2022-10-08 11:20:38 +@ 功能: 同意 +@ 参数 + + #systemApp 系统 + #pwoCont 岗位审批工作流 + #flowMap 流程结构体 + #flowOneCont 当前节点构体 + #step 记录值 + #liangOrXing 属性1、定性;2、定量 + +ApproveFlow(systemApp string, flowMap []publicmethod.FlowChartList, flowOneCont publicmethod.FlowChartList, step int, pwoContOld modelskpi.PostWorkflowOrders) +@ 返回值 + + # +*/ +func ApproveFlow(systemApp string, flowMap []publicmethod.FlowChartList, flowOneCont publicmethod.FlowChartList, step int, pwoContOld modelskpi.PostWorkflowOrders) { + defer syncSeting.Done() + nextStep := 0 + flowState := 2 //判断流程状态 + switch flowOneCont.RunType { + case 1: + flowState = 2 + case 2: + flowState = 2 + case 3: + flowState = 4 + case 4: + flowState = 4 + default: + flowState = 1 + } + //判断下一个当前节点是否为最后一个节点 + if flowState == 4 { + nextStep = 0 + } else { + nextStep = flowOneCont.Step + 1 + } + //更新审批流状态 + var pwoCont modelskpi.PostWorkflowOrders + nextUserKey, _ := flowchart.GetNodeOperator(flowMap, nextStep) + nextUserKeyStr := strings.Join(nextUserKey, ",") + if nextStep == 0 { + nextUserKeyStr = "" + } + + flowParticipants := strings.Split(pwoContOld.Participants, ",") + for _, vuk := range nextUserKey { + if publicmethod.IsInTrue[string](vuk, flowParticipants) == false { + flowParticipants = append(flowParticipants, vuk) + } + } + flowParticipantStr := strings.Join(flowParticipants, ",") + + pwoCont.EiteCont(map[string]interface{}{"`order_id`": pwoContOld.OrderId}, map[string]interface{}{"`next_step`": nextStep, "`state`": flowState, "'next_executor'": nextUserKeyStr, "`participants`": flowParticipantStr, "`time`": time.Now().Unix()}) //改变审批流状态 + + //获取下一部操作 + for _, fv := range flowMap { + if fv.Step == flowOneCont.Step+1 { + var sendToUserList []string //获取发送人 + for _, fvu := range fv.UserList { + if publicmethod.IsInTrue[string](fvu.Wechat, sendToUserList) == false { + sendToUserList = append(sendToUserList, fvu.Wechat) + } + } + if len(sendToUserList) > 0 { //存在接收人执行以下操作 + var postTarDeta modelskpi.PostTarget + postTarDeta.GetCont(map[string]interface{}{"`id`": pwoContOld.Target}, "`title`") + if fv.Class < 3 { + sendNextStep := step + 1 + //发送按钮信息 + if pwoContOld.Class == 1 { //定性操作 + var postTarDetailsDeta modelskpi.PostTargetDetails + postTarDetailsDeta.GetCont(map[string]interface{}{"`id`": pwoContOld.Detailed}, "`title`", "`punishmode`", "`company`") + unitTitle := postTarDetailsDeta.Company + if unitTitle == "" { + unitTitle = postTarDeta.Unit + } + var postNatuerFlowCont modelskpi.PostNatureFlow + postNatuerFlowCont.GetCont(map[string]interface{}{"`order_id`": pwoContOld.OrderId}) + if fv.Class == 2 { //需要填写信息,发送相关信息 + //挂号 + registerNum := publicmethod.GetUUid(2) + var setUpRegister modelskpi.Register + setUpRegister.Number = registerNum + setUpRegister.State = 1 + setUpRegister.Time = time.Now().Unix() + setUpRegister.AddCont() + //抄送信息 + markDowmStr := "整改通知" + markDowmStr = fmt.Sprintf("%v\n>**事项详情** ", markDowmStr) + markDowmStr = fmt.Sprintf("%v\n>指标: %v", markDowmStr, postTarDeta.Title) + markDowmStr = fmt.Sprintf("%v\n>指标详情: %v", markDowmStr, postTarDetailsDeta.Title) + markDowmStr = fmt.Sprintf("%v\n>发生时间: %v ", markDowmStr, publicmethod.UnixTimeToDay(postNatuerFlowCont.HappenTime, 1)) + switch postTarDetailsDeta.Punishmode { + case 1: + if postNatuerFlowCont.Score != 0 { + scoreFloat := (float64(postNatuerFlowCont.Score) * float64(postNatuerFlowCont.HappenCount)) / 100 + if postNatuerFlowCont.AddOrDecrease == 1 { + //增加 + markDowmStr = fmt.Sprintf("%v\n>奖励: %v%v", markDowmStr, publicmethod.DecimalEs(scoreFloat, 2), postTarDetailsDeta.Company) + } else { + //减少 + markDowmStr = fmt.Sprintf("%v\n>减少: %v%v", markDowmStr, publicmethod.DecimalEs(scoreFloat, 2), postTarDetailsDeta.Company) + } + } + case 2: + if postNatuerFlowCont.Money != 0 { + moneyFloat := float64(postNatuerFlowCont.Money) / 100 + if postNatuerFlowCont.AddOrDecrease == 1 { + //增加 + markDowmStr = fmt.Sprintf("%v\n>奖励: %v元", markDowmStr, publicmethod.DecimalEs(moneyFloat, 2)) + } else { + //减少 + markDowmStr = fmt.Sprintf("%v\n>减少: %v元", markDowmStr, publicmethod.DecimalEs(moneyFloat, 2)) + } + } + default: + if postNatuerFlowCont.Score != 0 { + scoreFloat := (float64(postNatuerFlowCont.Score) * float64(postNatuerFlowCont.HappenCount)) / 100 + if postNatuerFlowCont.AddOrDecrease == 1 { + //增加 + markDowmStr = fmt.Sprintf("%v\n>增奖励: %v%v", markDowmStr, publicmethod.DecimalEs(scoreFloat, 2), postTarDetailsDeta.Company) + } else { + //减少 + markDowmStr = fmt.Sprintf("%v\n>减少: %v%v", markDowmStr, publicmethod.DecimalEs(scoreFloat, 2), postTarDetailsDeta.Company) + } + } + if postNatuerFlowCont.Money != 0 { + moneyFloat := float64(postNatuerFlowCont.Money) / 100 + if postNatuerFlowCont.AddOrDecrease == 1 { + //增加 + markDowmStr = fmt.Sprintf("%v\n>奖励: %v元", markDowmStr, publicmethod.DecimalEs(moneyFloat, 2)) + } else { + //减少 + markDowmStr = fmt.Sprintf("%v\n>减少: %v元", markDowmStr, publicmethod.DecimalEs(moneyFloat, 2)) + } + } + } + //获取提报人信息 + var zeRenRenCont modelshr.PersonArchives + zeRenRenCont.GetCont(map[string]interface{}{"`key`": postNatuerFlowCont.Executor}, "`name`", "`number`") + markDowmStr = fmt.Sprintf("%v\n> \n>提报人: %v(%v)", markDowmStr, zeRenRenCont.Name, zeRenRenCont.Number) + + markDowmStr = fmt.Sprintf("%v\n>\n>[填写整改措施](%v/#/pages/approval/corraction?id=%v&num=%v)", markDowmStr, overall.CONSTANT_CONFIG.Appsetup.WebUrl, pwoContOld.OrderId, registerNum) + //发送同通信息 + SendNoticeMsg(sendToUserList, markDowmStr, systemApp) + } else { //无需填写信息。继续发送 + //考核标准 + var sunTextCont string + var quoteTextCont string + switch postTarDetailsDeta.Punishmode { + case 2: + var moneyTitle string + if postNatuerFlowCont.AddOrDecrease == 1 { + moneyTitle = "现金奖励标准" + quoteTextCont = fmt.Sprintf("奖励现金:%v元", postNatuerFlowCont.Money) + } else { + moneyTitle = "现金罚款标准" + quoteTextCont = fmt.Sprintf("罚款现金:%v元", postNatuerFlowCont.Money) + } + var scoreStr string + if postTarDetailsDeta.Minmoney != 0 { + scoreStr = fmt.Sprintf("%v元-%v元", publicmethod.DecimalEs(float64(postTarDetailsDeta.Minmoney)/100, 2), publicmethod.DecimalEs(float64(postTarDetailsDeta.Maxmoney)/100, 2)) + } else { + scoreStr = fmt.Sprintf("%v元", publicmethod.DecimalEs(float64(postTarDetailsDeta.Maxmoney)/100, 2)) + } + sunTextCont = fmt.Sprintf("%v:%v", moneyTitle, scoreStr) + if postNatuerFlowCont.Reason != "" { + quoteTextCont = fmt.Sprintf("%v\n备注:%v", quoteTextCont, postNatuerFlowCont.Reason) + } + case 3: + var moneyTitle string + var scoreTitle string + if postNatuerFlowCont.AddOrDecrease == 1 { + moneyTitle = "现金奖励标准" + scoreTitle = "考核扣分标准" + quoteTextCont = fmt.Sprintf("考核加:%v%v\n奖励现金:%v元", postNatuerFlowCont.Score, unitTitle, postNatuerFlowCont.Money) + } else { + moneyTitle = "现金罚款标准" + scoreTitle = "考核加分标准" + quoteTextCont = fmt.Sprintf("考核扣:%v%v\n罚款现金:%v元", postNatuerFlowCont.Score, unitTitle, postNatuerFlowCont.Money) + } + var scoreStr string + + if postTarDetailsDeta.MinScore != 0 { + scoreStr = fmt.Sprintf("%v%v-%v%v", publicmethod.DecimalEs(float64(postTarDetailsDeta.MinScore)/100, 2), unitTitle, publicmethod.DecimalEs(float64(postTarDetailsDeta.MaxScore)/100, 2), unitTitle) + } else { + scoreStr = fmt.Sprintf("%v%v", publicmethod.DecimalEs(float64(postTarDetailsDeta.MaxScore)/100, 2), unitTitle) + } + sunTextCont = fmt.Sprintf("%v:%v", scoreTitle, scoreStr) + + if postTarDetailsDeta.Minmoney != 0 { + sunTextCont = fmt.Sprintf("%v\n%v:%v元-%v元", sunTextCont, moneyTitle, publicmethod.DecimalEs(float64(postTarDetailsDeta.Minmoney)/100, 2), publicmethod.DecimalEs(float64(postTarDetailsDeta.Maxmoney)/100, 2)) + } else { + sunTextCont = fmt.Sprintf("%v\n%v:%v元", sunTextCont, moneyTitle, publicmethod.DecimalEs(float64(postTarDetailsDeta.Maxmoney)/100, 2)) + } + + if postNatuerFlowCont.Reason != "" { + quoteTextCont = fmt.Sprintf("%v\n备注:%v", quoteTextCont, postNatuerFlowCont.Reason) + } + default: + + var scoreTitle string + if postNatuerFlowCont.AddOrDecrease == 1 { + scoreTitle = "考核加分标准" + quoteTextCont = fmt.Sprintf("考核加:%v%v", postNatuerFlowCont.Score, unitTitle) + } else { + scoreTitle = "考核扣分标准" + quoteTextCont = fmt.Sprintf("考核扣:%v%v", postNatuerFlowCont.Score, unitTitle) + } + var scoreStr string + if postTarDetailsDeta.MinScore != 0 { + scoreStr = fmt.Sprintf("%v%v-%v%v", publicmethod.DecimalEs(float64(postTarDetailsDeta.MinScore)/100, 2), unitTitle, publicmethod.DecimalEs(float64(postTarDetailsDeta.MaxScore)/100, 2), unitTitle) + } else { + scoreStr = fmt.Sprintf("%v%v", publicmethod.DecimalEs(float64(postTarDetailsDeta.MaxScore)/100, 2), unitTitle) + } + sunTextCont = fmt.Sprintf("%v:%v", scoreTitle, scoreStr) + + if postNatuerFlowCont.Reason != "" { + quoteTextCont = fmt.Sprintf("%v\n备注:%v", quoteTextCont, postNatuerFlowCont.Reason) + } + } + + var quoteAreaInfo wechatsendmsg.QuoteAreaCont + quoteAreaInfo.Type = 0 + quoteAreaInfo.Title = "考核明细" + quoteAreaInfo.QuoteText = quoteTextCont + + //二级标题+文本列表 + var twoTitleTextList []wechatsendmsg.HorizontalContentListInfo + var shenQingRen modelshr.PersonArchives + shenQingRen.GetCont(map[string]interface{}{"`key`": postNatuerFlowCont.Executor}, "`wechat`", "`work_wechat`") + if shenQingRen.Wechat != "" || shenQingRen.WorkWechat != "" { + wechatOpenId := shenQingRen.Wechat + if shenQingRen.WorkWechat != "" { + wechatOpenId = shenQingRen.WorkWechat + } + //发送人 + var horizontalContentLis3 wechatsendmsg.HorizontalContentListInfo + horizontalContentLis3.KeyName = "申请人:" + horizontalContentLis3.Value = "点击查看" + horizontalContentLis3.Type = 3 + horizontalContentLis3.Userid = wechatOpenId + twoTitleTextList = append(twoTitleTextList, horizontalContentLis3) + } + var beiKaoHeRen modelshr.PersonArchives + beiKaoHeRen.GetCont(map[string]interface{}{"`key`": postNatuerFlowCont.Executor}, "`wechat`", "`work_wechat`") + //被考核人 + if beiKaoHeRen.Wechat != "" || beiKaoHeRen.WorkWechat != "" { + weChatStrs := beiKaoHeRen.Wechat + if beiKaoHeRen.WorkWechat != "" { + weChatStrs = beiKaoHeRen.WorkWechat + } + var twoTitleTextCont wechatsendmsg.HorizontalContentListInfo + twoTitleTextCont.KeyName = "被考核人:" + twoTitleTextCont.Value = "点击查看" + twoTitleTextCont.Type = 3 + twoTitleTextCont.Userid = weChatStrs + twoTitleTextList = append(twoTitleTextList, twoTitleTextCont) + } + + SendButtonCard(systemApp, postTarDeta.Title, postTarDetailsDeta.Title, sunTextCont, fv.NodeName, pwoContOld.OrderId, pwoContOld.Class, sendNextStep, sendToUserList, quoteAreaInfo, twoTitleTextList) + } + } else { //定量操作 + //定量操作 + var postMeterFlowCont modelskpi.PostMeteringFlow + postMeterFlowCont.GetCont(map[string]interface{}{"`order_id`": pwoContOld.OrderId}) + //获取考核项目信息 + var postShemeCont modelskpi.QualitativeEvaluationScheme + postShemeCont.GetCont(map[string]interface{}{"`id`": postMeterFlowCont.ShemeId}) + + //引用文献 + var quoteAreaInfo wechatsendmsg.QuoteAreaCont + quoteAreaInfo.Type = 0 + quoteAreaInfo.Title = "数据详细" + quoteAreaInfo.QuoteText = fmt.Sprintf("数值:%v%v\n备注:%v", publicmethod.DecimalEs(postMeterFlowCont.Score, 2), postTarDeta.Unit, postMeterFlowCont.Reason) + + //二级标题+文本列表 + var twoTitleTextList []wechatsendmsg.HorizontalContentListInfo + var shenQingRen modelshr.PersonArchives + shenQingRen.GetCont(map[string]interface{}{"`key`": postMeterFlowCont.Executor}, "`wechat`", "`work_wechat`") + if shenQingRen.Wechat != "" || shenQingRen.WorkWechat != "" { + wechatOpenId := shenQingRen.Wechat + if shenQingRen.WorkWechat != "" { + wechatOpenId = shenQingRen.WorkWechat + } + //发送人 + var horizontalContentLis3 wechatsendmsg.HorizontalContentListInfo + horizontalContentLis3.KeyName = "申请人:" + horizontalContentLis3.Value = "点击查看" + horizontalContentLis3.Type = 3 + horizontalContentLis3.Userid = wechatOpenId + twoTitleTextList = append(twoTitleTextList, horizontalContentLis3) + } + var beiKaoHeRen modelshr.PersonArchives + beiKaoHeRen.GetCont(map[string]interface{}{"`key`": postMeterFlowCont.Executor}, "`wechat`", "`work_wechat`") + //被考核人 + if beiKaoHeRen.Wechat != "" || beiKaoHeRen.WorkWechat != "" { + weChatStrs := beiKaoHeRen.Wechat + if beiKaoHeRen.WorkWechat != "" { + weChatStrs = beiKaoHeRen.WorkWechat + } + var twoTitleTextCont wechatsendmsg.HorizontalContentListInfo + twoTitleTextCont.KeyName = "被考核人:" + twoTitleTextCont.Value = "点击查看" + twoTitleTextCont.Type = 3 + twoTitleTextCont.Userid = weChatStrs + twoTitleTextList = append(twoTitleTextList, twoTitleTextCont) + } + + SendButtonCard(systemApp, postShemeCont.Title, postShemeCont.Content, "", fv.NodeName, pwoContOld.OrderId, sendNextStep, pwoContOld.Class, sendToUserList, quoteAreaInfo, twoTitleTextList) + } + } else { + jumpUrl := fmt.Sprintf("%v/#/pages/approval/postdingxin?orderid=%v&class=%v", overall.CONSTANT_CONFIG.Appsetup.WebUrl, pwoContOld.OrderId, pwoContOld.Class) + if pwoContOld.Class != 1 { + jumpUrl = fmt.Sprintf("%v/#/pages/approval/postdingliang?orderid=%v&class=%v", overall.CONSTANT_CONFIG.Appsetup.WebUrl, pwoContOld.OrderId, pwoContOld.Class) + } + //抄送信息 + markDowmStr := "审批通过-抄送" + markDowmStr = fmt.Sprintf("%v\n>**事项详情** ", markDowmStr) + + markDowmStr = fmt.Sprintf("%v\n>指标: %v", markDowmStr, postTarDeta.Title) + if pwoContOld.Class == 1 { + //定性操作 + var postTarDetailsDeta modelskpi.PostTargetDetails + postTarDetailsDeta.GetCont(map[string]interface{}{"`id`": pwoContOld.Detailed}, "`title`", "`punishmode`", "`company`") + markDowmStr = fmt.Sprintf("%v\n>指标详情: %v", markDowmStr, postTarDetailsDeta.Title) + var postNatuerFlowCont modelskpi.PostNatureFlow + postNatuerFlowCont.GetCont(map[string]interface{}{"`order_id`": pwoContOld.OrderId}) + + switch postTarDetailsDeta.Punishmode { + case 1: + if postNatuerFlowCont.Score != 0 { + scoreFloat := (float64(postNatuerFlowCont.Score) * float64(postNatuerFlowCont.HappenCount)) / 100 + if postNatuerFlowCont.AddOrDecrease == 1 { + //增加 + markDowmStr = fmt.Sprintf("%v\n>奖励: %v%v", markDowmStr, publicmethod.DecimalEs(scoreFloat, 2), postTarDetailsDeta.Company) + } else { + //减少 + markDowmStr = fmt.Sprintf("%v\n>减少: %v%v", markDowmStr, publicmethod.DecimalEs(scoreFloat, 2), postTarDetailsDeta.Company) + } + } + case 2: + if postNatuerFlowCont.Money != 0 { + moneyFloat := float64(postNatuerFlowCont.Money) / 100 + if postNatuerFlowCont.AddOrDecrease == 1 { + //增加 + markDowmStr = fmt.Sprintf("%v\n>奖励: %v元", markDowmStr, publicmethod.DecimalEs(moneyFloat, 2)) + } else { + //减少 + markDowmStr = fmt.Sprintf("%v\n>减少: %v元", markDowmStr, publicmethod.DecimalEs(moneyFloat, 2)) + } + } + default: + if postNatuerFlowCont.Score != 0 { + scoreFloat := (float64(postNatuerFlowCont.Score) * float64(postNatuerFlowCont.HappenCount)) / 100 + if postNatuerFlowCont.AddOrDecrease == 1 { + //增加 + markDowmStr = fmt.Sprintf("%v\n>增奖励: %v%v", markDowmStr, publicmethod.DecimalEs(scoreFloat, 2), postTarDetailsDeta.Company) + } else { + //减少 + markDowmStr = fmt.Sprintf("%v\n>减少: %v%v", markDowmStr, publicmethod.DecimalEs(scoreFloat, 2), postTarDetailsDeta.Company) + } + } + if postNatuerFlowCont.Money != 0 { + moneyFloat := float64(postNatuerFlowCont.Money) / 100 + if postNatuerFlowCont.AddOrDecrease == 1 { + //增加 + markDowmStr = fmt.Sprintf("%v\n>奖励: %v元", markDowmStr, publicmethod.DecimalEs(moneyFloat, 2)) + } else { + //减少 + markDowmStr = fmt.Sprintf("%v\n>减少: %v元", markDowmStr, publicmethod.DecimalEs(moneyFloat, 2)) + } + } + } + //获取责任信息 + var zeRenRenCont modelshr.PersonArchives + zeRenRenCont.GetCont(map[string]interface{}{"`key`": postNatuerFlowCont.PersonLiable}, "`name`", "`number`") + markDowmStr = fmt.Sprintf("%v\n> \n>被考核人: %v(%v)", markDowmStr, zeRenRenCont.Name, zeRenRenCont.Number) + markDowmStr = fmt.Sprintf("%v\n>发生时间: %v ", markDowmStr, publicmethod.UnixTimeToDay(postNatuerFlowCont.HappenTime, 1)) + // markDowmStr = fmt.Sprintf("%v\n>\n>[查看审批详情](http://new.hxgk.group/#/quantitativeList?id=%v)", markDowmStr, pwoContOld.OrderId) + + markDowmStr = fmt.Sprintf("%v\n>\n>[查看审批详情](%v)", markDowmStr, jumpUrl) + } else { + //定量操作 + var postMeterFlowCont modelskpi.PostMeteringFlow + postMeterFlowCont.GetCont(map[string]interface{}{"`order_id`": pwoContOld.OrderId}) + markDowmStr = fmt.Sprintf("%v\n>%v年", markDowmStr, postMeterFlowCont.Year) + switch postTarDeta.Cycle { + case 5: + markDowmStr = fmt.Sprintf("%v\n>%v季度上报数值%v%v", markDowmStr, postMeterFlowCont.Quarter, publicmethod.DecimalEs(postMeterFlowCont.Score, 2), postTarDeta.Unit) + case 6: + markDowmStr = fmt.Sprintf("%v\n>上报数值%v%v", markDowmStr, publicmethod.DecimalEs(postMeterFlowCont.Score, 2), postTarDeta.Unit) + default: + markDowmStr = fmt.Sprintf("%v\n>%v月上报数值%v%v", markDowmStr, postMeterFlowCont.Month, publicmethod.DecimalEs(postMeterFlowCont.Score, 2), postTarDeta.Unit) + } + //获取责任信息 + var zeRenRenCont modelshr.PersonArchives + zeRenRenCont.GetCont(map[string]interface{}{"`key`": postMeterFlowCont.PersonLiable}, "`name`", "`number`") + markDowmStr = fmt.Sprintf("%v\n> \n>被考核人: %v(%v)", markDowmStr, zeRenRenCont.Name, zeRenRenCont.Number) + + // markDowmStr = fmt.Sprintf("%v\n>\n>[查看审批详情](http://new.hxgk.group/#/quantitativeList?id=%v)", markDowmStr, pwoContOld.OrderId) + markDowmStr = fmt.Sprintf("%v\n>\n>[查看审批详情](%v)", markDowmStr, jumpUrl) + } + //发送抄送信息 + SendNoticeMsg(sendToUserList, markDowmStr, systemApp) + } + } + + } + } +} + +/* +* +@ 作者: 秦东 +@ 时间: 2022-10-09 08:38:02 +@ 功能: 发送通知信息 +@ 参数 + + #sendToUserList 信息接收人 + #markDowmStr 消息主体 + #systemApp 系统 + +@ 返回值 + + # +*/ +func SendNoticeMsg(sendToUserList []string, markDowmStr, systemApp string) { + agentIdInt, _ := strconv.ParseInt(overall.CONSTANT_CONFIG.WechatKpi.Agentid, 10, 64) //应用AgentId + var sendCopyMsg wechatsendmsg.SendMarkDown + sendCopyMsg.Touser = strings.Join(sendToUserList, "|") + sendCopyMsg.Msgtype = "markdown" + sendCopyMsg.Agentid = agentIdInt + sendCopyMsg.EnableDuplicateCheck = 0 + sendCopyMsg.DuplicateCheckInterval = 1800 + sendCopyMsg.MsgBody.Content = markDowmStr + sendCopyMsg.SendMsg(systemApp) +} + +/* +* +@ 作者: 秦东 +@ 时间: 2022-10-09 09:19:54 +@ 功能: 发送按钮卡片 +@ 参数 + + #systemApp 系统 + #mainTitle 主标题 + #descInfo 主标题描述 + #sunTextCont 二级文本 + #sendTitle 头部信息 + #uuId 订单ID + #step 步进值 + #sendUserList 接收人 + #quoteAreaInfo 引用文献 + #twoTitleTextList 二级标题+文本列表 + #class 1、定性;2、定量 + +func SendButtonCard(systemApp, mainTitle, descInfo, sunTextCont, sendTitle string, uuId int64, step int, sendUserList []string, quoteAreaInfo wechatsendmsg.QuoteAreaCont, twoTitleTextList []wechatsendmsg.HorizontalContentListInfo) +@ 返回值 + + # +*/ +func SendButtonCard(systemApp, mainTitle, descInfo, sunTextCont, sendTitle string, uuId int64, step, class int, sendUserList []string, quoteAreaInfo wechatsendmsg.QuoteAreaCont, twoTitleTextList []wechatsendmsg.HorizontalContentListInfo) { + + //头部信息 + var sourceText wechatsendmsg.SourceText + sourceText.IconUrl = "https://docu.hxgk.group/images/2022_01/3f7a1120a559e9bee3991b85eb34d103.png" + sourceText.Desc = fmt.Sprintf("恒信高科-%v", sendTitle) + sourceText.DescColor = 1 + //按钮 + var buttonList []wechatsendmsg.ButtonListCont + var buttonList1 wechatsendmsg.ButtonListCont + buttonList1.Text = "批准" + buttonList1.Style = 1 + buttonList1.Key = fmt.Sprintf("KPI_post_%v_%v_%v", uuId, 1, step) + buttonList = append(buttonList, buttonList1) + var buttonList2 wechatsendmsg.ButtonListCont + buttonList2.Text = "驳回" + buttonList2.Style = 3 + buttonList2.Key = fmt.Sprintf("KPI_post_%v_%v_%v", uuId, 2, step) + buttonList = append(buttonList, buttonList2) + //卡片跳转地址 + var cardActionContStr wechatsendmsg.CardActionCont + cardActionContStr.Type = 1 + + jumpUrl := fmt.Sprintf("%v/#/pages/approval/postdingxin?orderid=%v&class=%v", overall.CONSTANT_CONFIG.Appsetup.WebUrl, uuId, class) + if class != 1 { + jumpUrl = fmt.Sprintf("%v/#/pages/approval/postdingliang?orderid=%v&class=%v", overall.CONSTANT_CONFIG.Appsetup.WebUrl, uuId, class) + } + cardActionContStr.Url = jumpUrl + // cardActionContStr.Url = fmt.Sprintf("%v/#/quantitativeList?id=%v", overall.CONSTANT_CONFIG.Appsetup.WebUrl, uuId) + + var sendButtionMsg wechatsendmsg.SendButtonInteractionSimplify + // sendButtionMsg.Touser = strings.Join(sendUserList, "|") + sendButtionMsg.Touser = "KaiXinGuo" //指定接收消息的成员,成员ID列表;特殊情况:指定为 + sendButtionMsg.Msgtype = "template_card" + agentIdInt, _ := strconv.ParseInt(overall.CONSTANT_CONFIG.WechatKpi.Agentid, 10, 64) + sendButtionMsg.Agentid = agentIdInt + sendButtionMsg.EnableDuplicateCheck = 0 + sendButtionMsg.DuplicateCheckInterval = 1800 + sendButtionMsg.EnableIdTrans = 0 + sendButtionMsg.TemplateCard.CardType = "button_interaction" + sendButtionMsg.TemplateCard.Source = sourceText + sendButtionMsg.TemplateCard.TaskId = fmt.Sprintf("KPI_%v_%v", uuId, step) + sendButtionMsg.TemplateCard.MainTitle.Title = mainTitle + + sendButtionMsg.TemplateCard.MainTitle.Desc = descInfo + sendButtionMsg.TemplateCard.QuoteArea = quoteAreaInfo + + sendButtionMsg.TemplateCard.SubTitleText = sunTextCont + sendButtionMsg.TemplateCard.ButtonList = buttonList + sendButtionMsg.TemplateCard.HorizontalContentList = twoTitleTextList + sendButtionMsg.TemplateCard.CardAction = cardActionContStr + // callData, err := sendButtionMsg.SendMsg(systemApp) + sendButtionMsg.SendMsg(systemApp) +} + +/* +* +@ 作者: 秦东 +@ 时间: 2022-10-11 08:10:43 +@ 功能: 驳回 +@ 参数 + + #systemApp 系统 + #pwoCont 岗位审批工作流 + #flowMap 流程结构体 + #flowOneCont 当前节点构体 + #step 记录值 + #liangOrXing 属性1、定性;2、定量 + + RejectFlow(systemApp string, flowMap []publicmethod.FlowChartList, flowOneCont publicmethod.FlowChartList, step int, pwoContOld modelskpi.PostWorkflowOrders) + +@ 返回值 + + # +*/ +func RejectFlow(systemApp string, flowMap []publicmethod.FlowChartList, flowOneCont publicmethod.FlowChartList, step int, pwoContOld modelskpi.PostWorkflowOrders) { + defer syncSeting.Done() + //获取要驳回到的节点 + if flowOneCont.NodeRelationship.RejectNode < 1 { + return + } + var clickUrlPath string + markDowmStr := "驳回" + flowState := 3 + rejectNode := GetRejectNode(flowMap, flowOneCont) + + var sendToUserList []string //获取发送人 + for _, fvu := range rejectNode.UserList { + if publicmethod.IsInTrue[string](fvu.Wechat, sendToUserList) == false { + sendToUserList = append(sendToUserList, fvu.Wechat) + } + } + + switch rejectNode.Class { + case 2: //发送整改信息 + //挂号 + registerNum := publicmethod.GetUUid(2) + var setUpRegister modelskpi.Register + setUpRegister.Number = registerNum + setUpRegister.State = 1 + setUpRegister.Time = time.Now().Unix() + setUpRegister.AddCont() + markDowmStr = fmt.Sprintf("您的整改措施被%v", markDowmStr) + clickUrlPath = fmt.Sprintf("%v\n>\n>[重新填写整改措施](%v/#/pages/approval/corraction?id=%v&num=%v)", markDowmStr, overall.CONSTANT_CONFIG.Appsetup.WebUrl, pwoContOld.OrderId, registerNum) + default: //发送驳回信息 + + jumpUrl := fmt.Sprintf("%v/#/pages/approval/postdingxin?orderid=%v&class=%v", overall.CONSTANT_CONFIG.Appsetup.WebUrl, pwoContOld.OrderId, pwoContOld.Class) + if pwoContOld.Class != 1 { + jumpUrl = fmt.Sprintf("%v/#/pages/approval/postdingliang?orderid=%v&class=%v", overall.CONSTANT_CONFIG.Appsetup.WebUrl, pwoContOld.OrderId, pwoContOld.Class) + } + + clickUrlPath = fmt.Sprintf("%v\n>\n>[查看审批详情](%v)", markDowmStr, jumpUrl) + } + var postTarDeta modelskpi.PostTarget + postTarDeta.GetCont(map[string]interface{}{"`id`": pwoContOld.Target}, "`title`") + markDowmStr = fmt.Sprintf("%v\n>**事项详情** ", markDowmStr) + markDowmStr = fmt.Sprintf("%v\n>指标: %v", markDowmStr, postTarDeta.Title) + if pwoContOld.Class == 1 { //定性操作 + var postTarDetailsDeta modelskpi.PostTargetDetails + postTarDetailsDeta.GetCont(map[string]interface{}{"`id`": pwoContOld.Detailed}, "`title`", "`punishmode`", "`company`") + + var postNatuerFlowCont modelskpi.PostNatureFlow + postNatuerFlowCont.GetCont(map[string]interface{}{"`order_id`": pwoContOld.OrderId}) + markDowmStr = fmt.Sprintf("%v\n>指标详情: %v", markDowmStr, postTarDetailsDeta.Title) + markDowmStr = fmt.Sprintf("%v\n>发生时间: %v ", markDowmStr, publicmethod.UnixTimeToDay(postNatuerFlowCont.HappenTime, 1)) + switch postTarDetailsDeta.Punishmode { + case 1: + if postNatuerFlowCont.Score != 0 { + scoreFloat := (float64(postNatuerFlowCont.Score) * float64(postNatuerFlowCont.HappenCount)) / 100 + if postNatuerFlowCont.AddOrDecrease == 1 { + //增加 + markDowmStr = fmt.Sprintf("%v\n>奖励: %v%v", markDowmStr, publicmethod.DecimalEs(scoreFloat, 2), postTarDetailsDeta.Company) + } else { + //减少 + markDowmStr = fmt.Sprintf("%v\n>减少: %v%v", markDowmStr, publicmethod.DecimalEs(scoreFloat, 2), postTarDetailsDeta.Company) + } + } + case 2: + if postNatuerFlowCont.Money != 0 { + moneyFloat := float64(postNatuerFlowCont.Money) / 100 + if postNatuerFlowCont.AddOrDecrease == 1 { + //增加 + markDowmStr = fmt.Sprintf("%v\n>奖励: %v元", markDowmStr, publicmethod.DecimalEs(moneyFloat, 2)) + } else { + //减少 + markDowmStr = fmt.Sprintf("%v\n>减少: %v元", markDowmStr, publicmethod.DecimalEs(moneyFloat, 2)) + } + } + default: + if postNatuerFlowCont.Score != 0 { + scoreFloat := (float64(postNatuerFlowCont.Score) * float64(postNatuerFlowCont.HappenCount)) / 100 + if postNatuerFlowCont.AddOrDecrease == 1 { + //增加 + markDowmStr = fmt.Sprintf("%v\n>增奖励: %v%v", markDowmStr, publicmethod.DecimalEs(scoreFloat, 2), postTarDetailsDeta.Company) + } else { + //减少 + markDowmStr = fmt.Sprintf("%v\n>减少: %v%v", markDowmStr, publicmethod.DecimalEs(scoreFloat, 2), postTarDetailsDeta.Company) + } + } + if postNatuerFlowCont.Money != 0 { + moneyFloat := float64(postNatuerFlowCont.Money) / 100 + if postNatuerFlowCont.AddOrDecrease == 1 { + //增加 + markDowmStr = fmt.Sprintf("%v\n>奖励: %v元", markDowmStr, publicmethod.DecimalEs(moneyFloat, 2)) + } else { + //减少 + markDowmStr = fmt.Sprintf("%v\n>减少: %v元", markDowmStr, publicmethod.DecimalEs(moneyFloat, 2)) + } + } + } + //获取提报人信息 + var zeRenRenCont modelshr.PersonArchives + zeRenRenCont.GetCont(map[string]interface{}{"`key`": postNatuerFlowCont.Executor}, "`name`", "`number`") + markDowmStr = fmt.Sprintf("%v\n> \n>提报人: %v(%v)", markDowmStr, zeRenRenCont.Name, zeRenRenCont.Number) + markDowmStr = fmt.Sprintf("%v\n> \n>%v", markDowmStr, clickUrlPath) + } else { + //定量操作 + var postMeterFlowCont modelskpi.PostMeteringFlow + postMeterFlowCont.GetCont(map[string]interface{}{"`order_id`": pwoContOld.OrderId}) + markDowmStr = fmt.Sprintf("%v\n>%v年", markDowmStr, postMeterFlowCont.Year) + switch postTarDeta.Cycle { + case 5: + markDowmStr = fmt.Sprintf("%v\n>%v季度上报数值%v%v", markDowmStr, postMeterFlowCont.Quarter, publicmethod.DecimalEs(postMeterFlowCont.Score, 2), postTarDeta.Unit) + case 6: + markDowmStr = fmt.Sprintf("%v\n>上报数值%v%v", markDowmStr, publicmethod.DecimalEs(postMeterFlowCont.Score, 2), postTarDeta.Unit) + default: + markDowmStr = fmt.Sprintf("%v\n>%v月上报数值%v%v", markDowmStr, postMeterFlowCont.Month, publicmethod.DecimalEs(postMeterFlowCont.Score, 2), postTarDeta.Unit) + } + //获取责任信息 + var zeRenRenCont modelshr.PersonArchives + zeRenRenCont.GetCont(map[string]interface{}{"`key`": postMeterFlowCont.PersonLiable}, "`name`", "`number`") + markDowmStr = fmt.Sprintf("%v\n> \n>被考核人: %v(%v)", markDowmStr, zeRenRenCont.Name, zeRenRenCont.Number) + } + + nextStep := rejectNode.Step + 1 + var pwoCont modelskpi.PostWorkflowOrders + nextUserKey, _ := flowchart.GetNodeOperator(flowMap, nextStep) + nextUserKeyStr := strings.Join(nextUserKey, ",") + if nextStep == 0 { + nextUserKeyStr = "" + } + + // pwoCont.EiteCont(map[string]interface{}{"`order_id`": pwoContOld.OrderId}, map[string]interface{}{"`next_step`": nextStep, "`state`": flowState, "'next_executor'": nextUserKeyStr, "`time`": time.Now().Unix()}) //改变审批流状态 + + flowParticipants := strings.Split(pwoContOld.Participants, ",") + for _, vuk := range nextUserKey { + if publicmethod.IsInTrue[string](vuk, flowParticipants) == false { + flowParticipants = append(flowParticipants, vuk) + } + } + flowParticipantStr := strings.Join(flowParticipants, ",") + + pwoCont.EiteCont(map[string]interface{}{"`order_id`": pwoContOld.OrderId}, map[string]interface{}{"`next_step`": nextStep, "`state`": flowState, "'next_executor'": nextUserKeyStr, "`participants`": flowParticipantStr, "`time`": time.Now().Unix()}) //改变审批流状态 + //发送同通信息 + SendNoticeMsg(sendToUserList, markDowmStr, systemApp) +} + +/* +* +@ 作者: 秦东 +@ 时间: 2022-10-11 08:56:06 +@ 功能: 获取要驳回到的节点 +@ 参数 + + # + +@ 返回值 + + # +*/ +func GetRejectNode(flowMap []publicmethod.FlowChartList, flowOneCont publicmethod.FlowChartList) (rejectFlowCont publicmethod.FlowChartList) { + if flowOneCont.NodeRelationship.RejectNode > 0 { + for _, v := range flowMap { + if v.Step == flowOneCont.NodeRelationship.RejectNode { + rejectFlowCont = v + } + } + } + return +} diff --git a/apirouter/entry.go b/apirouter/entry.go index ee086a9..075726d 100644 --- a/apirouter/entry.go +++ b/apirouter/entry.go @@ -3,6 +3,7 @@ package apirouter import ( "key_performance_indicators/apirouter/apishiyan" "key_performance_indicators/apirouter/empower" + "key_performance_indicators/apirouter/v1/approvalsystem" "key_performance_indicators/apirouter/v1/bookimg" "key_performance_indicators/apirouter/v1/departmentseting" "key_performance_indicators/apirouter/v1/empowerrouter" @@ -28,6 +29,7 @@ type RouterGroup struct { Empowerouter empowerrouter.ApiRouter WechatRouter wechaturl.ApiRouter WorkFlowRouter workflowchart.ApiRouter + ExamineSystemApp approvalsystem.ApiRouter } var RouterGroupEntry = new(RouterGroup) diff --git a/apirouter/v1/approvalsystem/approval_route.go b/apirouter/v1/approvalsystem/approval_route.go new file mode 100644 index 0000000..13bda63 --- /dev/null +++ b/apirouter/v1/approvalsystem/approval_route.go @@ -0,0 +1,20 @@ +package approvalsystem + +import ( + "key_performance_indicators/api/version1" + + "github.com/gin-gonic/gin" +) + +// 岗位考核审批路由 +func (a *ApiRouter) RouterGroup(router *gin.RouterGroup) { + apiRouter := router.Group("examine") + + var apiFunc = version1.AppApiEntry.SystemAppExamine + { + apiRouter.GET("", apiFunc.Index) //入口 + apiRouter.POST("", apiFunc.Index) //入口 + + apiRouter.POST("postnatureappflow", apiFunc.PostNatureAppFlow) //岗位定性审批 + } +} diff --git a/apirouter/v1/approvalsystem/type.go b/apirouter/v1/approvalsystem/type.go new file mode 100644 index 0000000..e4d15b5 --- /dev/null +++ b/apirouter/v1/approvalsystem/type.go @@ -0,0 +1,4 @@ +package approvalsystem + +//系统审批路由 +type ApiRouter struct{} diff --git a/apirouter/v1/postseting/web.go b/apirouter/v1/postseting/web.go index 1a5c1cc..58d4724 100644 --- a/apirouter/v1/postseting/web.go +++ b/apirouter/v1/postseting/web.go @@ -29,7 +29,8 @@ func (a *ApiRouter) RouterGroupWeb(router *gin.RouterGroup) { apiRouter.POST("getflowmap", methodBinding.GetFlowMap) //获取流程图 apiRouter.POST("get_quantification_cont", methodBinding.GetQuantificationCont) //获取定量指标相关内容 - apiRouter.POST("getpostflowlog", methodBinding.GetPostFlowLog) //岗位审批记录 - + apiRouter.POST("getpostflowlog", methodBinding.GetPostFlowLog) //岗位审批记录 + apiRouter.POST("lookflowmap", methodBinding.LookFlowMap) //获取审批流详情 + apiRouter.POST("lookflowmapcorra", methodBinding.LookFlowMapCorra) //获取审批流详情-->整改措施专用(岗位) } } diff --git a/config/configApp/server.go b/config/configApp/server.go index eebafa1..d3881f3 100644 --- a/config/configApp/server.go +++ b/config/configApp/server.go @@ -19,6 +19,7 @@ type appsetup struct { AppKey string `mapstructure:"appkey" json:"appkey" yaml:"appkey"` DefaultPassword string `mapstructure:"password" json:"password" yaml:"password"` PreFix string `mapstructure:"prefix" json:"prefix" yaml:"prefix"` + WebUrl string `mapstructure:"weburl" json:"weburl" yaml:"weburl"` } //日志配置 diff --git a/initialization/route/initRoute.go b/initialization/route/initRoute.go index a1e0c5f..04376ee 100644 --- a/initialization/route/initRoute.go +++ b/initialization/route/initRoute.go @@ -97,6 +97,9 @@ func InitialRouter() *gin.Engine { //工作流 workFlowApiRouter := apirouter.RouterGroupEntry.WorkFlowRouter workFlowApiRouter.RouterGroup(VerifyIdentityWeb) //工作流 + + systemApproval := apirouter.RouterGroupEntry.ExamineSystemApp + systemApproval.RouterGroup(VerifyIdentityWeb) //系统内审批 } //Token身份验证 VerifyIdentityToken := router.Group("") diff --git a/middleware/wechatapp/wechatcallback/event_processing.go b/middleware/wechatapp/wechatcallback/event_processing.go index 3f1b0bd..e0d82df 100644 --- a/middleware/wechatapp/wechatcallback/event_processing.go +++ b/middleware/wechatapp/wechatcallback/event_processing.go @@ -143,6 +143,12 @@ func (b *ButtonEventQuestion) PostTemolateCallBack(orderId, clickEnter, systemAp //1、判断当前流程状态 var flowCont modelskpi.PostWorkflowOrders err := flowCont.GetCont(map[string]interface{}{"`order_id`": orderId}) + + jumpUrl := fmt.Sprintf("%v/#/pages/approval/postdingxin?orderid=%v&class=%v", overall.CONSTANT_CONFIG.Appsetup.WebUrl, orderId, flowCont.Class) + if flowCont.Class != 1 { + jumpUrl = fmt.Sprintf("%v/#/pages/approval/postdingliang?orderid=%v&class=%v", overall.CONSTANT_CONFIG.Appsetup.WebUrl, orderId, flowCont.Class) + } + if err != nil { var sendMsgText wechatsendmsg.SendTextCard sendMsgText.Touser = b.FromUsername @@ -154,7 +160,7 @@ func (b *ButtonEventQuestion) PostTemolateCallBack(orderId, clickEnter, systemAp sendMsgText.EnableIdTrans = 0 sendMsgText.MsgBody.Title = "流程关闭" sendMsgText.MsgBody.Description = "此审批流程已经关闭!请联系发起人!" - jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v", orderId) + // jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v", orderId) sendMsgText.MsgBody.URL = jumpUrl sendMsgText.MsgBody.BtnTxt = "" sendMsgText.SendMsg(systemApp) @@ -169,7 +175,7 @@ func (b *ButtonEventQuestion) PostTemolateCallBack(orderId, clickEnter, systemAp sendMsgText.DuplicateCheckInterval = 1800 sendMsgText.EnableIdTrans = 0 - jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v", orderId) + // jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v", orderId) sendMsgText.MsgBody.URL = jumpUrl sendMsgText.MsgBody.BtnTxt = "查看详情" switch flowCont.State { @@ -244,7 +250,7 @@ func (b *ButtonEventQuestion) PostTemolateCallBack(orderId, clickEnter, systemAp sendMsgText.EnableIdTrans = 0 sendMsgText.MsgBody.Title = "已审批" sendMsgText.MsgBody.Description = fmt.Sprintf("此审批流程已被%v审批!请不要重复操作!", carryPeopleOld.Name) - jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v", orderId) + // jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v", orderId) sendMsgText.MsgBody.URL = jumpUrl sendMsgText.MsgBody.BtnTxt = "" sendMsgText.SendMsg(systemApp) @@ -326,9 +332,13 @@ func (U *updateButtonSync) RejectFlow(systemApp string, flowMap []publicmethod.F setUpRegister.Time = time.Now().Unix() setUpRegister.AddCont() markDowmStr = fmt.Sprintf("您的整改措施被%v", markDowmStr) - clickUrlPath = fmt.Sprintf("%v\n>\n>[重新填写整改措施](http://new.hxgk.group/#/rectification?id=%v&num=%v)", markDowmStr, pwoContOld.OrderId, registerNum) + clickUrlPath = fmt.Sprintf("%v\n>\n>[重新填写整改措施](%v/#/pages/approval/corraction?id=%v&num=%v)", markDowmStr, overall.CONSTANT_CONFIG.Appsetup.WebUrl, pwoContOld.OrderId, registerNum) default: //发送驳回信息 - clickUrlPath = fmt.Sprintf("%v\n>\n>[查看审批详情](http://new.hxgk.group/#/quantitativeList?id=%v)", markDowmStr, pwoContOld.OrderId) + jumpUrl := fmt.Sprintf("%v/#/pages/approval/postdingxin?orderid=%v&class=%v", overall.CONSTANT_CONFIG.Appsetup.WebUrl, pwoContOld.OrderId, pwoContOld.Class) + if pwoContOld.Class != 1 { + jumpUrl = fmt.Sprintf("%v/#/pages/approval/postdingliang?orderid=%v&class=%v", overall.CONSTANT_CONFIG.Appsetup.WebUrl, pwoContOld.OrderId, pwoContOld.Class) + } + clickUrlPath = fmt.Sprintf("%v\n>\n>[查看审批详情](%v)", markDowmStr, jumpUrl) } var postTarDeta modelskpi.PostTarget postTarDeta.GetCont(map[string]interface{}{"`id`": pwoContOld.Target}, "`title`") @@ -604,7 +614,8 @@ func (U *updateButtonSync) ApproveFlow(systemApp string, flowMap []publicmethod. zeRenRenCont.GetCont(map[string]interface{}{"`key`": postNatuerFlowCont.Executor}, "`name`", "`number`") markDowmStr = fmt.Sprintf("%v\n> \n>提报人: %v(%v)", markDowmStr, zeRenRenCont.Name, zeRenRenCont.Number) - markDowmStr = fmt.Sprintf("%v\n>\n>[填写整改措施](http://new.hxgk.group/#/rectification?id=%v&num=%v)", markDowmStr, pwoContOld.OrderId, registerNum) + // markDowmStr = fmt.Sprintf("%v\n>\n>[填写整改措施](http://new.hxgk.group/#/rectification?id=%v&num=%v)", markDowmStr, pwoContOld.OrderId, registerNum) + markDowmStr = fmt.Sprintf("%v\n>\n>[填写整改措施](%v/#/pages/approval/corraction?id=%v&num=%v)", markDowmStr, overall.CONSTANT_CONFIG.Appsetup.WebUrl, pwoContOld.OrderId, registerNum) //发送同通信息 SendNoticeMsg(sendToUserList, markDowmStr, systemApp) } else { //无需填写信息。继续发送 @@ -722,7 +733,7 @@ func (U *updateButtonSync) ApproveFlow(systemApp string, flowMap []publicmethod. twoTitleTextList = append(twoTitleTextList, twoTitleTextCont) } - SendButtonCard(systemApp, postTarDeta.Title, postTarDetailsDeta.Title, sunTextCont, fv.NodeName, pwoContOld.OrderId, sendNextStep, sendToUserList, quoteAreaInfo, twoTitleTextList) + SendButtonCard(systemApp, postTarDeta.Title, postTarDetailsDeta.Title, sunTextCont, fv.NodeName, pwoContOld.OrderId, sendNextStep, pwoContOld.Class, sendToUserList, quoteAreaInfo, twoTitleTextList) } } else { //定量操作 //定量操作 @@ -771,10 +782,15 @@ func (U *updateButtonSync) ApproveFlow(systemApp string, flowMap []publicmethod. twoTitleTextList = append(twoTitleTextList, twoTitleTextCont) } - SendButtonCard(systemApp, postShemeCont.Title, postShemeCont.Content, "", fv.NodeName, pwoContOld.OrderId, sendNextStep, sendToUserList, quoteAreaInfo, twoTitleTextList) + SendButtonCard(systemApp, postShemeCont.Title, postShemeCont.Content, "", fv.NodeName, pwoContOld.OrderId, sendNextStep, pwoContOld.Class, sendToUserList, quoteAreaInfo, twoTitleTextList) } } else { //抄送信息 + + jumpUrl := fmt.Sprintf("%v/#/pages/approval/postdingxin?orderid=%v&class=%v", overall.CONSTANT_CONFIG.Appsetup.WebUrl, pwoContOld.OrderId, pwoContOld.Class) + if pwoContOld.Class != 1 { + jumpUrl = fmt.Sprintf("%v/#/pages/approval/postdingliang?orderid=%v&class=%v", overall.CONSTANT_CONFIG.Appsetup.WebUrl, pwoContOld.OrderId, pwoContOld.Class) + } markDowmStr := "审批通过-抄送" markDowmStr = fmt.Sprintf("%v\n>**事项详情** ", markDowmStr) @@ -837,7 +853,11 @@ func (U *updateButtonSync) ApproveFlow(systemApp string, flowMap []publicmethod. zeRenRenCont.GetCont(map[string]interface{}{"`key`": postNatuerFlowCont.PersonLiable}, "`name`", "`number`") markDowmStr = fmt.Sprintf("%v\n> \n>被考核人: %v(%v)", markDowmStr, zeRenRenCont.Name, zeRenRenCont.Number) markDowmStr = fmt.Sprintf("%v\n>发生时间: %v ", markDowmStr, publicmethod.UnixTimeToDay(postNatuerFlowCont.HappenTime, 1)) - markDowmStr = fmt.Sprintf("%v\n>\n>[查看审批详情](http://new.hxgk.group/#/quantitativeList?id=%v)", markDowmStr, pwoContOld.OrderId) + + // markDowmStr = fmt.Sprintf("%v\n>\n>[查看审批详情](http://new.hxgk.group/#/quantitativeList?id=%v)", markDowmStr, pwoContOld.OrderId) + + markDowmStr = fmt.Sprintf("%v\n>\n>[查看审批详情](%v)", markDowmStr, jumpUrl) + } else { //定量操作 var postMeterFlowCont modelskpi.PostMeteringFlow @@ -856,7 +876,8 @@ func (U *updateButtonSync) ApproveFlow(systemApp string, flowMap []publicmethod. zeRenRenCont.GetCont(map[string]interface{}{"`key`": postMeterFlowCont.PersonLiable}, "`name`", "`number`") markDowmStr = fmt.Sprintf("%v\n> \n>被考核人: %v(%v)", markDowmStr, zeRenRenCont.Name, zeRenRenCont.Number) - markDowmStr = fmt.Sprintf("%v\n>\n>[查看审批详情](http://new.hxgk.group/#/quantitativeList?id=%v)", markDowmStr, pwoContOld.OrderId) + // markDowmStr = fmt.Sprintf("%v\n>\n>[查看审批详情](http://new.hxgk.group/#/quantitativeList?id=%v)", markDowmStr, pwoContOld.OrderId) + markDowmStr = fmt.Sprintf("%v\n>\n>[查看审批详情](%v)", markDowmStr, jumpUrl) } //发送抄送信息 SendNoticeMsg(sendToUserList, markDowmStr, systemApp) @@ -884,13 +905,14 @@ func (U *updateButtonSync) ApproveFlow(systemApp string, flowMap []publicmethod. #sendUserList 接收人 #quoteAreaInfo 引用文献 #twoTitleTextList 二级标题+文本列表 + #class 1、定性;2 、定量 func SendButtonCard(systemApp, mainTitle, descInfo, sunTextCont, sendTitle string, uuId int64, step int, sendUserList []string, quoteAreaInfo wechatsendmsg.QuoteAreaCont, twoTitleTextList []wechatsendmsg.HorizontalContentListInfo) @ 返回值 # */ -func SendButtonCard(systemApp, mainTitle, descInfo, sunTextCont, sendTitle string, uuId int64, step int, sendUserList []string, quoteAreaInfo wechatsendmsg.QuoteAreaCont, twoTitleTextList []wechatsendmsg.HorizontalContentListInfo) { +func SendButtonCard(systemApp, mainTitle, descInfo, sunTextCont, sendTitle string, uuId int64, step, class int, sendUserList []string, quoteAreaInfo wechatsendmsg.QuoteAreaCont, twoTitleTextList []wechatsendmsg.HorizontalContentListInfo) { //头部信息 var sourceText wechatsendmsg.SourceText @@ -912,7 +934,13 @@ func SendButtonCard(systemApp, mainTitle, descInfo, sunTextCont, sendTitle strin //卡片跳转地址 var cardActionContStr wechatsendmsg.CardActionCont cardActionContStr.Type = 1 - cardActionContStr.Url = fmt.Sprintf("http://new.hxgk.group/#/quantitativeList?id=%v", uuId) + + jumpUrl := fmt.Sprintf("%v/#/pages/approval/postdingxin?orderid=%v&class=%v", overall.CONSTANT_CONFIG.Appsetup.WebUrl, uuId, class) + if class != 1 { + jumpUrl = fmt.Sprintf("%v/#/pages/approval/postdingliang?orderid=%v&class=%v", overall.CONSTANT_CONFIG.Appsetup.WebUrl, uuId, class) + } + cardActionContStr.Url = jumpUrl + // cardActionContStr.Url = fmt.Sprintf("http://new.hxgk.group/#/quantitativeList?id=%v", uuId) var sendButtionMsg wechatsendmsg.SendButtonInteractionSimplify // sendButtionMsg.Touser = strings.Join(sendUserList, "|") diff --git a/middleware/wechatapp/wechatcallback/type.go b/middleware/wechatapp/wechatcallback/type.go index 1968820..b2cf08b 100644 --- a/middleware/wechatapp/wechatcallback/type.go +++ b/middleware/wechatapp/wechatcallback/type.go @@ -127,7 +127,7 @@ type ButtonEvent struct { TaskId string `xml:"TaskId" json:"TaskId"` CardType string `xml:"CardType" json:"CardType"` ResponseCode string `xml:"ResponseCode" json:"ResponseCode"` - Agentid uint32 `xml:"AgentID" json:"AgentID"` + Agentid uint64 `xml:"AgentID" json:"AgentID"` } //模板卡片事件推送 问题列表 diff --git a/middleware/wechatapp/wechatsendmsg/type.go b/middleware/wechatapp/wechatsendmsg/type.go index 012c95e..6c1b79e 100644 --- a/middleware/wechatapp/wechatsendmsg/type.go +++ b/middleware/wechatapp/wechatsendmsg/type.go @@ -124,7 +124,7 @@ type UpdateTemplateCardCurrency struct { Partyids []int `json:"partyids"` //企业的部门ID列表(最多支持100个) Tagids []int `json:"tagids"` //企业的标签ID列表(最多支持100个) Atall int `json:"atall"` //更新整个任务接收人员 - Agentid uint32 `json:"agentid"` //应用的agentid + Agentid uint64 `json:"agentid"` //应用的agentid ResponseCode string `json:"response_code"` } diff --git a/models/modelskpi/open_approval_change_log.go b/models/modelskpi/open_approval_change_log.go index 973e06d..6a39adc 100644 --- a/models/modelskpi/open_approval_change_log.go +++ b/models/modelskpi/open_approval_change_log.go @@ -73,3 +73,20 @@ func (cont *OpenApprovalChangeLog) AddCont() (err error) { err = overall.CONSTANT_DB_KPI.Create(&cont).Error return } + +// 获取最大数 +func (cont *OpenApprovalChangeLog) GetMAx(orderId int64, userKey []string) (maxData int, err error) { + if len(userKey) > 0 { + err = overall.CONSTANT_DB_KPI.Model(&OpenApprovalChangeLog{}).Select("`stepper`,`operatortype`,`change_is_true`").Where("`orderid` = ? AND `operator` IN ?", orderId, userKey).First(&cont).Error + if cont.ChangeIsTrue == 1 { + maxData = cont.Stepper + return + } else { + err = overall.CONSTANT_DB_KPI.Model(&OpenApprovalChangeLog{}).Select("MAX(`stepper`) AS maxstep").Where("`orderid` = ?", orderId).First(&maxData).Error + } + } else { + err = overall.CONSTANT_DB_KPI.Model(&OpenApprovalChangeLog{}).Select("MAX(`stepper`) AS maxstep").Where("`orderid` = ?", orderId).First(&maxData).Error + } + + return +} diff --git a/overall/publicmethod/type.go b/overall/publicmethod/type.go index 1c68dff..3076357 100644 --- a/overall/publicmethod/type.go +++ b/overall/publicmethod/type.go @@ -189,6 +189,7 @@ type UserListFlowAll struct { type LogList struct { State int `json:"state"` //状态 1、未操作;2、通过;3、驳回 TimeVal string `json:"time"` + Content string `json:"content"` //审批意见 Enclosure []EnclosureFormat `json:"enclosure"` //附件 }