package evaluation import ( "encoding/json" "fmt" "strconv" "strings" "gin_server_admin/commonus" "gin_server_admin/global" "gin_server_admin/model/assessmentmodel" "gin_server_admin/model/common/response" "github.com/gin-gonic/gin" ) // 查看定量考核目标设定 func (e *EvaluationInterface) LookQuantitativeConfig(c *gin.Context) { var requestData SelectQuantitativeConfig err := c.ShouldBindJSON(&requestData) if err != nil { response.Result(101, err, "数据获取失败!", c) return } var qualConfigList []assessmentmodel.QuantitativeConfig gormDb := global.GVA_DB_Performanceappraisal if requestData.GroupId != "" { gormDb = gormDb.Where("`group` = ?", requestData.GroupId) } if requestData.DepartmentID != "" { gormDb = gormDb.Where("`departmentid` = ?", requestData.DepartmentID) } if requestData.Dimension != "" { gormDb = gormDb.Where("`dimension` = ?", requestData.Dimension) } if requestData.Target != "" { gormDb = gormDb.Where("`target` = ?", requestData.Target) } if requestData.DetailedTarget != "" { gormDb = gormDb.Where("`targetconfig` = ?", requestData.DetailedTarget) } switch requestData.Type { case 1: gormDb = gormDb.Where("`type` = ?", requestData.Type) case 2: gormDb = gormDb.Where("`type` = ?", requestData.Type) if requestData.Class != 0 { gormDb = gormDb.Where("`timecopy` = ?", requestData.Class) } case 3: gormDb = gormDb.Where("`type` = ?", requestData.Type) if requestData.Class != 0 { gormDb = gormDb.Where("`timecopy` = ?", requestData.Class) } default: } if requestData.Year != 0 { gormDb = gormDb.Where("`year` = ?", requestData.Year) } if requestData.State != 0 { gormDb = gormDb.Where("`state` = ?", requestData.State) } // gormDb = gormDb.Order("group ASC,departmentid ASC,dimension ASC,target ASC,targetconfig ASC").Order("year DESC").Order("timecopy ASC,id ASC") gormDb = gormDb.Order("`group` ASC").Order("`departmentid` ASC").Order("`dimension` ASC").Order("`target` ASC").Order("`targetconfig` ASC").Order("`year` DESC").Order("`timecopy` ASC").Order("`id` ASC") contErr := gormDb.Find(&qualConfigList).Error if contErr != nil { response.Result(102, err, "没有数据!", c) return } var outList []OutQuantitativeConfig for _, v := range qualConfigList { var outCont OutQuantitativeConfig outCont.Id = v.Id outCont.DepartmentId = v.DepartmentId outCont.Group = v.Group outCont.Dimension = v.Dimension outCont.Target = v.Target outCont.TargetConfig = v.TargetConfig outCont.Type = v.Type outCont.Year = v.Year outCont.Timecopy = v.Timecopy outCont.Zeroprize = v.Zeroprize / 100 outCont.Allprize = v.Allprize / 100 outCont.Time = v.Time outCont.State = v.State where := commonus.MapOut() where["id"] = v.Group orgCont, _ := commonus.GetNewOrgCont(where, "id", "name") outCont.GroupTitle = orgCont.Name whereDepart := commonus.MapOut() whereDepart["id"] = v.DepartmentId orgContDepart, _ := commonus.GetNewOrgCont(whereDepart, "id", "name") outCont.DimensionTitle = orgContDepart.Name // gErr, groupInfo := commonus.GetGroupCont(v.Group) // if gErr == true { // outCont.GroupTitle = groupInfo.Name // } // dErr, departmentInfo := commonus.GetBranchFactory(v.DepartmentId) // if dErr == true { // outCont.DimensionTitle = departmentInfo.Name // } targetInfo, tErr := commonus.GetTargetInfo(v.Target) if tErr == true { outCont.TargetTitle = targetInfo.Title } dtargetInfo, dtErr := commonus.GetDetailedTargetInfo(v.TargetConfig) if dtErr == true { outCont.DetailedTargetTitle = dtargetInfo.Title } outList = append(outList, outCont) } response.Result(0, outList, "获取成功!", c) } // 查看审批流程 func (e *EvaluationInterface) SeeFlowLogOld(c *gin.Context) { isTrue, userCont := commonus.ClientIdentity() if isTrue != true { response.Result(1001, userCont, "您的身份令牌已经失效!请重新登录获取身份令牌!", c) return } var requestData FlowLogType c.ShouldBindJSON(&requestData) if requestData.PageSize == 0 { requestData.PageSize = 20 } if requestData.Page <= 0 { requestData.Page = 1 } if requestData.IsSet == 0 { requestData.IsSet = 1 } offSetPage := commonus.CalculatePages(requestData.Page, requestData.PageSize) // var evalProContList []assessmentmodel.EvaluationProcess var evalProContList []accPerFlowLog gormDb := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.EvaluationProcess{}) gormDb = gormDb.Select("evaluation_process.*,sf.sf_duty_department,sf.sf_evaluation_plan,fl.fl_evaluation_id,fl.fl_evaluation_department,qe.qe_dimension,qe.qe_target,qe.qe_detailed_target,dc.title,et.et_title,dt.dt_title,qe.qe_accept_evaluation") gormDb = gormDb.Joins(("left join score_flow as sf on sf.sf_key = evaluation_process.ep_order_key")) gormDb = gormDb.Joins(("left join flow_log as fl on fl.fl_key = evaluation_process.ep_order_key")) gormDb = gormDb.Joins(("left join qualitative_evaluation as qe on qe.qe_id = sf.sf_evaluation_plan OR qe.qe_id = fl.fl_evaluation_id")) gormDb = gormDb.Joins(("left join dutyclass as dc on dc.id = qe.qe_dimension")) gormDb = gormDb.Joins(("left join evaluationtarget as et on et.et_id = qe.qe_target")) gormDb = gormDb.Joins(("left join detailed_target as dt on dt.dt_id = qe.qe_detailed_target")) if requestData.Title != "" || requestData.Department != "" { if requestData.Title != "" { gormDb = gormDb.Where("dc.title LIKE ? OR et.et_title LIKE ? OR dt.dt_title LIKE ?", "%"+requestData.Title+"%", "%"+requestData.Title+"%", "%"+requestData.Title+"%") } if requestData.Department != "" { gormDb = gormDb.Where("sf.sf_duty_department = ? OR fl.fl_evaluation_department = ?", requestData.Department, requestData.Department) } } // gormDb = gormDb.Where("FIND_IN_SET(?,`ep_participants`)", userCont.Key) if requestData.IsSet == 1 { gormDb = gormDb.Where("FIND_IN_SET(?,`ep_participants`) OR NOT FIND_IN_SET(?,`ep_next_executor`)", userCont.Key, userCont.Key) } else { gormDb = gormDb.Where("FIND_IN_SET(?,`ep_next_executor`)", userCont.Key) } if requestData.State != 0 { gormDb = gormDb.Where("evaluation_process.ep_state = ?", requestData.State) } else { gormDb = gormDb.Where("evaluation_process.ep_state IN ?", []int{1, 2, 3}) } if requestData.Time != "" { startTime, endTime := commonus.GetAppointMonthStarAndEndTime(requestData.Time) gormDb = gormDb.Where("evaluation_process.ep_start_time BETWEEN ? AND ?", startTime, endTime) } if requestData.Class != 0 { gormDb = gormDb.Where("evaluation_process.ep_type = ?", requestData.Class) } /* 获取总共有多少记录 */ var total int64 totalErr := gormDb.Count(&total).Error if totalErr != nil { total = 0 } //获取记录数据 evaErr := gormDb.Order("ep_state ASC,ep_id DESC").Limit(requestData.PageSize).Offset(offSetPage).Find(&evalProContList).Error // evaErr := gormDb.Order("ep_id DESC").Limit(requestData.PageSize).Offset(offSetPage).Find(&evalProContList).Error if evaErr != nil { response.Result(104, evaErr, "数据获取失败!", c) return } // response.Result(104, evalProContList, "数据获取失败!", c) // return var flowLogListOut []FlowLogListOut for _, v := range evalProContList { var flowLogListCont FlowLogListOut orderId := strconv.FormatInt(v.OrderKey, 10) flowLogListCont.OutId = orderId flowLogListCont.Class = v.TypeClass flowLogListCont.MonthDays = commonus.TimeStampToDate(v.StartTime, 15) flowLogListCont.IsSet = 1 isSetUser := strings.Split(v.NextExecutor, ",") fmt.Printf("\n\nIsSet----1--%v--->%v\n\n", orderId, flowLogListCont.IsSet) if len(isSetUser) > 0 { fmt.Printf("\n\nIsSet----2--%v--->%v\n\n", orderId, flowLogListCont.IsSet) if commonus.IsItTrueString(userCont.Key, isSetUser) == true { flowLogListCont.IsSet = 2 fmt.Printf("\n\nIsSet---%v--3---->%v\n\n", orderId, flowLogListCont.IsSet) } } fmt.Printf("\n\nIsSet---4------%v----->%v\n\n", orderId, flowLogListCont.IsSet) fmt.Printf("TypeClass ---------%v\n", v.TypeClass) if v.TypeClass == 1 { //获取考核项目关联项目 targettitle, detailedRulesTitle, _, _, scoreFlowCont, qualEvalInfo, dutyTarDetErr := commonus.GetDutyAssociatedItems(orderId) if dutyTarDetErr == true { addUser, addUserErr := commonus.GetWorkUser(strconv.FormatInt(scoreFlowCont.EvaluationUser, 10)) if addUserErr == true { flowLogListCont.FounDer = addUser.Name } var departTitleName string flowLogListCont.Cycles = qualEvalInfo.Cycles flowLogListCont.CycleAttres = qualEvalInfo.CycleAttres if qualEvalInfo.AcceptEvaluation != 0 { whereDepart := commonus.MapOut() whereDepart["id"] = v.AcceptEvaluation orgContDer, orgContDerErr := commonus.GetNewOrgCont(whereDepart, "name") if orgContDerErr == nil { if departTitleName == "" { departTitleName = orgContDer.Name } else { departTitleName = fmt.Sprintf("%v、%v", departTitleName, orgContDer.Name) } flowLogListCont.ExecutiveDepartment = append(flowLogListCont.ExecutiveDepartment, orgContDer.Name) } } else { whereDepart := commonus.MapOut() whereDepart["id"] = v.AcceptEvaluation orgContDer, orgContDerErr := commonus.GetNewOrgCont(whereDepart, "name") fmt.Printf("whereDepart ---------->%v------->%v-------->%v-------->%v\n", v.TypeClass, whereDepart, orgContDerErr, orgContDer) if orgContDerErr == nil { if departTitleName == "" { departTitleName = orgContDer.Name } else { departTitleName = fmt.Sprintf("%v、%v", departTitleName, orgContDer.Name) } flowLogListCont.ExecutiveDepartment = append(flowLogListCont.ExecutiveDepartment, orgContDer.Name) } } if detailedRulesTitle != "" { flowLogListCont.Title = fmt.Sprintf("%v %v", departTitleName, detailedRulesTitle) } else { flowLogListCont.Title = fmt.Sprintf("%v %v", departTitleName, targettitle) } flowLogListCont.Year = scoreFlowCont.Year //`json:"year"` //年分"` flowLogListCont.Quarter = scoreFlowCont.Quarter //`json:"quarter"` //季度"` flowLogListCont.Month = scoreFlowCont.Month //`json:"month"` //月"` flowLogListCont.Week = scoreFlowCont.Week //`json:"week"` //周"` flowLogListCont.Days = commonus.ComputingTime(scoreFlowCont.HappenTime, 5) //`json:"days"` //天 } else { var departTitleName string whereDepart := commonus.MapOut() whereDepart["id"] = v.AcceptEvaluation orgContDer, orgContDerErr := commonus.GetNewOrgCont(whereDepart, "name") fmt.Printf("whereDepart ---------->%v------->%v-------->%v-------->%v\n", v.TypeClass, whereDepart, orgContDerErr, orgContDer) if orgContDerErr == nil { if departTitleName == "" { departTitleName = orgContDer.Name } else { departTitleName = fmt.Sprintf("%v、%v", departTitleName, orgContDer.Name) } flowLogListCont.ExecutiveDepartment = append(flowLogListCont.ExecutiveDepartment, orgContDer.Name) } } } else { flowLogInfo, flowLogErr := commonus.GetFlowLog(orderId) if flowLogErr == true { flowLogListCont.Year = flowLogInfo.Year //`json:"year"` //年分"` flowLogListCont.Quarter = flowLogInfo.Quarter //`json:"quarter"` //季度"` flowLogListCont.Month = flowLogInfo.Month //`json:"month"` //月"` flowLogListCont.Week = flowLogInfo.Week //`json:"week"` //周"` flowLogListCont.Days = flowLogInfo.ToDay //`json:"days"` //天 // fmt.Printf("Title---1-->%v\n", flowLogErr) var qualEvalInfo assessmentmodel.QualitativeEvaluation qualEvaTargetErr := qualEvalInfo.GetCont(map[string]interface{}{"qe_id": flowLogInfo.EvaluationPlan}, "qe_target", "qe_cycle", "qe_cycleattr", "qe_accept_evaluation") // fmt.Printf("Title---2-->%v\n", qualEvaTargetErr) if qualEvaTargetErr == nil { flowLogListCont.Cycles = qualEvalInfo.Cycles flowLogListCont.CycleAttres = qualEvalInfo.CycleAttres var departTitleName string if qualEvalInfo.AcceptEvaluation != 0 { whereDepart := commonus.MapOut() whereDepart["id"] = qualEvalInfo.AcceptEvaluation orgContDer, orgContDerErr := commonus.GetNewOrgCont(whereDepart, "name") if orgContDerErr == nil { if departTitleName == "" { departTitleName = orgContDer.Name } else { departTitleName = fmt.Sprintf("%v、%v", departTitleName, orgContDer.Name) } flowLogListCont.ExecutiveDepartment = append(flowLogListCont.ExecutiveDepartment, orgContDer.Name) } } var targetInfo assessmentmodel.EvaluationTarget targetInfoErr := targetInfo.GetCont(map[string]interface{}{"et_id": qualEvalInfo.Target}, "et_title") // fmt.Printf("Title---3-->%v\n", targetInfoErr) if targetInfoErr == nil { flowLogListCont.Title = fmt.Sprintf("%v %v", departTitleName, targetInfo.Title) // flowLogListCont.Title = fmt.Sprintf("%v %v-%v-%v数据上报", targetInfo.Title, flowLogInfo.Year, flowLogInfo.Month, flowLogInfo.ToDay) } else { // flowLogListCont.Title = fmt.Sprintf("%v-%v-%v数据上报", flowLogInfo.Year, flowLogInfo.Month, flowLogInfo.ToDay) flowLogListCont.Title = fmt.Sprintf("%v", departTitleName) } } else { flowLogListCont.Title = fmt.Sprintf("%v-%v-%v数据上报", flowLogInfo.Year, flowLogInfo.Month, flowLogInfo.ToDay) } addUser, addUserErr := commonus.GetWorkUser(strconv.FormatInt(flowLogInfo.EvaluationUser, 10)) if addUserErr == true { flowLogListCont.FounDer = addUser.Name } } } //解析审批流 var flowLog []FlowStep jsonFlowErr := json.Unmarshal([]byte(v.Content), &flowLog) setpLen := len(flowLog) if jsonFlowErr == nil { //得到当前步进值 currentSetp := setpLen - 1 if currentSetp < 0 { currentSetp = 0 } flowLogListCont.Node = flowLog[currentSetp].StepName addUser, addUserErr := commonus.GetWorkUser(flowLog[currentSetp].ClickName) if addUserErr == true { flowLogListCont.CurrentPeo = addUser.Name } } switch v.State { case 1: flowLogListCont.Result = "起草" flowLogListCont.Condition = "起草" case 2: flowLogListCont.Result = "审批中" flowLogListCont.Condition = "审批中" case 3: flowLogListCont.Result = "审批通过" flowLogListCont.Condition = "已结束" case 4: flowLogListCont.Result = "驳回" flowLogListCont.Condition = "审批中" default: flowLogListCont.Result = "审批中" flowLogListCont.Condition = "审批中" } flowLogListOut = append(flowLogListOut, flowLogListCont) } countSum := len(flowLogListOut) printData := commonus.OutPutList(total, int64(countSum), requestData.Page, requestData.PageSize, flowLogListOut) response.Result(0, printData, "查询成功!", c) } func (e *EvaluationInterface) SeeFlowLog(c *gin.Context) { isTrue, userCont := commonus.ClientIdentity() if isTrue != true { response.Result(1001, userCont, "您的身份令牌已经失效!请重新登录获取身份令牌!", c) return } var requestData FlowLogType c.ShouldBindJSON(&requestData) if requestData.PageSize == 0 { requestData.PageSize = 20 } if requestData.Page <= 0 { requestData.Page = 1 } if requestData.IsSet == 0 { requestData.IsSet = 1 } offSetPage := commonus.CalculatePages(requestData.Page, requestData.PageSize) // var evalProContList []assessmentmodel.EvaluationProcess var evalProContList []assessmentmodel.EvalProcess gormDb := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.EvalProcess{}) // gormDb = gormDb.Select("evaluation_process.*,sf.sf_duty_department,sf.sf_evaluation_plan,fl.fl_evaluation_id,fl.fl_evaluation_department,qe.qe_dimension,qe.qe_target,qe.qe_detailed_target,dc.title,et.et_title,dt.dt_title,qe.qe_accept_evaluation") // gormDb = gormDb.Joins(("left join score_flow as sf on sf.sf_key = evaluation_process.ep_order_key")) // gormDb = gormDb.Joins(("left join flow_log as fl on fl.fl_key = evaluation_process.ep_order_key")) // gormDb = gormDb.Joins(("left join qualitative_evaluation as qe on qe.qe_id = sf.sf_evaluation_plan OR qe.qe_id = fl.fl_evaluation_id")) // gormDb = gormDb.Joins(("left join dutyclass as dc on dc.id = qe.qe_dimension")) // gormDb = gormDb.Joins(("left join evaluationtarget as et on et.et_id = qe.qe_target")) // gormDb = gormDb.Joins(("left join detailed_target as dt on dt.dt_id = qe.qe_detailed_target")) if requestData.Title != "" || requestData.Department != "" { if requestData.Title != "" { gormDb = gormDb.Where("class_title LIKE ? OR et_title LIKE ? OR dt_title LIKE ?", "%"+requestData.Title+"%", "%"+requestData.Title+"%", "%"+requestData.Title+"%") } if requestData.Department != "" { // gormDb = gormDb.Where("sf_depart = ? OR fl_depart = ?", requestData.Department, requestData.Department) // gormDb = gormDb.Where("ep_setup_department = ? OR ep_accept_department = ?", requestData.Department, requestData.Department) gormDb = gormDb.Where("ep_accept_department = ? OR ep_setup_department = ?", requestData.Department, requestData.Department) } } //是否为管理员(1:不是;2:分公司;3:集团管理员;4:超级管 fmt.Printf("userCont.IsAdmin =============>%v\n", userCont.IsAdmin) switch userCont.IsAdmin { case "2": fmt.Printf("userCont.IsAdmin =====2========>%v\n", userCont.IsAdmin) case "3": fmt.Printf("userCont.IsAdmin ======3=======>%v\n", userCont.IsAdmin) case "4": fmt.Printf("userCont.IsAdmin =======4======>%v\n", userCont.IsAdmin) default: fmt.Printf("userCont.IsAdmin =======5======>%v\n", userCont.IsAdmin) gormDb = gormDb.Where("FIND_IN_SET(?,`ep_participants`)", userCont.Key) } // gormDb = gormDb.Where("FIND_IN_SET(?,`ep_participants`)", userCont.Key) if requestData.IsSet == 1 { gormDb = gormDb.Where("FIND_IN_SET(?,`ep_participants`) OR NOT FIND_IN_SET(?,`ep_next_executor`)", userCont.Key, userCont.Key) } else { gormDb = gormDb.Where("FIND_IN_SET(?,`ep_next_executor`)", userCont.Key) } if requestData.State != 0 { gormDb = gormDb.Where("ep_state = ?", requestData.State) } else { gormDb = gormDb.Where("ep_state IN ?", []int{1, 2, 3}) } if requestData.Time != "" { startTime, endTime := commonus.GetAppointMonthStarAndEndTime(requestData.Time) // gormDb = gormDb.Where("ep_start_time BETWEEN ? AND ?", startTime, endTime) gormDb = gormDb.Where("ep_happen_time BETWEEN ? AND ?", startTime, endTime) } if requestData.Years != 0 { if requestData.Month != 0 { timeDay := fmt.Sprintf("%v-%v-01", requestData.Years, requestData.Month) if requestData.Month <= 9 { timeDay = fmt.Sprintf("%v-0%v-01", requestData.Years, requestData.Month) } startTime, endTime := commonus.GetAppointMonthStarAndEndTimeEs(timeDay) gormDb = gormDb.Where("ep_happen_time BETWEEN ? AND ?", startTime, endTime) } else { startTime := commonus.DateToTimeStamp(fmt.Sprintf("%v-01-01 00:00:00", requestData.Years)) endTime := commonus.DateToTimeStamp(fmt.Sprintf("%v-12-31 23:59:59", requestData.Years)) gormDb = gormDb.Where("ep_happen_time BETWEEN ? AND ?", startTime, endTime) } } if requestData.Class != 0 { gormDb = gormDb.Where("ep_type = ?", requestData.Class) } /* 获取总共有多少记录 */ var total int64 totalErr := gormDb.Count(&total).Error if totalErr != nil { total = 0 } //获取记录数据 evaErr := gormDb.Order("ep_state ASC,ep_id DESC").Limit(requestData.PageSize).Offset(offSetPage).Find(&evalProContList).Error // evaErr := gormDb.Order("ep_id DESC").Limit(requestData.PageSize).Offset(offSetPage).Find(&evalProContList).Error if evaErr != nil { response.Result(104, evaErr, "数据获取失败!", c) return } // response.Result(104, evalProContList, "数据获取失败!", c) // return var flowLogListOut []FlowLogListOut for _, v := range evalProContList { var flowLogListCont FlowLogListOut orderId := strconv.FormatInt(v.OrderKey, 10) flowLogListCont.OutId = orderId flowLogListCont.Class = v.TypeClass flowLogListCont.MonthDays = commonus.TimeStampToDate(v.StartTime, 15) flowLogListCont.IsSet = 1 isSetUser := strings.Split(v.NextExecutor, ",") if len(isSetUser) > 0 { if commonus.IsItTrueString(userCont.Key, isSetUser) == true { flowLogListCont.IsSet = 2 } } // fmt.Printf("TypeClass ---------%v\n", v.TypeClass) if v.TypeClass == 1 { //获取考核项目关联项目 targettitle, detailedRulesTitle, _, _, scoreFlowCont, qualEvalInfo, dutyTarDetErr := commonus.GetDutyAssociatedItems(orderId) if dutyTarDetErr == true { addUser, addUserErr := commonus.GetWorkUser(strconv.FormatInt(scoreFlowCont.EvaluationUser, 10)) if addUserErr == true { flowLogListCont.FounDer = addUser.Name } var departTitleName string flowLogListCont.Cycles = qualEvalInfo.Cycles flowLogListCont.CycleAttres = qualEvalInfo.CycleAttres if qualEvalInfo.AcceptEvaluation != 0 { whereDepart := commonus.MapOut() whereDepart["id"] = qualEvalInfo.AcceptEvaluation orgContDer, orgContDerErr := commonus.GetNewOrgCont(whereDepart, "name") if orgContDerErr == nil { if departTitleName == "" { departTitleName = orgContDer.Name } else { departTitleName = fmt.Sprintf("%v、%v", departTitleName, orgContDer.Name) } flowLogListCont.ExecutiveDepartment = append(flowLogListCont.ExecutiveDepartment, orgContDer.Name) } } else { whereDepart := commonus.MapOut() whereDepart["id"] = v.AcceptDepartment orgContDer, orgContDerErr := commonus.GetNewOrgCont(whereDepart, "name") // fmt.Printf("whereDepart ---------->%v------->%v-------->%v-------->%v\n", v.TypeClass, whereDepart, orgContDerErr, orgContDer) if orgContDerErr == nil { if departTitleName == "" { departTitleName = orgContDer.Name } else { departTitleName = fmt.Sprintf("%v、%v", departTitleName, orgContDer.Name) } flowLogListCont.ExecutiveDepartment = append(flowLogListCont.ExecutiveDepartment, orgContDer.Name) } } // jsnnn, _ := json.Marshal(qualEvalInfo) // fmt.Printf("qualEvalInfo-------------->%v\n", string(jsnnn)) // BranchInfo, dErr := commonus.GetNewOrgCont(v.AcceptDepartment, "name") if detailedRulesTitle != "" { flowLogListCont.Title = fmt.Sprintf("%v %v", departTitleName, detailedRulesTitle) } else { flowLogListCont.Title = fmt.Sprintf("%v %v", departTitleName, targettitle) } flowLogListCont.Year = scoreFlowCont.Year //`json:"year"` //年分"` flowLogListCont.Quarter = scoreFlowCont.Quarter //`json:"quarter"` //季度"` flowLogListCont.Month = scoreFlowCont.Month //`json:"month"` //月"` flowLogListCont.Week = scoreFlowCont.Week //`json:"week"` //周"` flowLogListCont.Days = commonus.ComputingTime(scoreFlowCont.HappenTime, 5) //`json:"days"` //天 } else { var departTitleName string whereDepart := commonus.MapOut() whereDepart["id"] = v.AcceptDepartment orgContDer, orgContDerErr := commonus.GetNewOrgCont(whereDepart, "name") // fmt.Printf("whereDepart ---------->%v------->%v-------->%v-------->%v\n", v.TypeClass, whereDepart, orgContDerErr, orgContDer) if orgContDerErr == nil { if departTitleName == "" { departTitleName = orgContDer.Name } else { departTitleName = fmt.Sprintf("%v、%v", departTitleName, orgContDer.Name) } flowLogListCont.ExecutiveDepartment = append(flowLogListCont.ExecutiveDepartment, orgContDer.Name) } } } else { flowLogInfo, flowLogErr := commonus.GetFlowLog(orderId) if flowLogErr == true { flowLogListCont.Year = flowLogInfo.Year //`json:"year"` //年分"` flowLogListCont.Quarter = flowLogInfo.Quarter //`json:"quarter"` //季度"` flowLogListCont.Month = flowLogInfo.Month //`json:"month"` //月"` flowLogListCont.Week = flowLogInfo.Week //`json:"week"` //周"` flowLogListCont.Days = flowLogInfo.ToDay //`json:"days"` //天 // fmt.Printf("Title---1-->%v\n", flowLogErr) var qualEvalInfo assessmentmodel.QualitativeEvaluation qualEvaTargetErr := qualEvalInfo.GetCont(map[string]interface{}{"qe_id": flowLogInfo.EvaluationPlan}, "qe_target", "qe_cycle", "qe_cycleattr", "qe_accept_evaluation") // fmt.Printf("Title---2-->%v\n", qualEvaTargetErr) if qualEvaTargetErr == nil { flowLogListCont.Cycles = qualEvalInfo.Cycles flowLogListCont.CycleAttres = qualEvalInfo.CycleAttres var departTitleName string if qualEvalInfo.AcceptEvaluation != 0 { whereDepart := commonus.MapOut() whereDepart["id"] = qualEvalInfo.AcceptEvaluation orgContDer, orgContDerErr := commonus.GetNewOrgCont(whereDepart, "name") if orgContDerErr == nil { if departTitleName == "" { departTitleName = orgContDer.Name } else { departTitleName = fmt.Sprintf("%v、%v", departTitleName, orgContDer.Name) } flowLogListCont.ExecutiveDepartment = append(flowLogListCont.ExecutiveDepartment, orgContDer.Name) } } var targetInfo assessmentmodel.EvaluationTarget targetInfoErr := targetInfo.GetCont(map[string]interface{}{"et_id": qualEvalInfo.Target}, "et_title") // fmt.Printf("Title---3-->%v\n", targetInfoErr) if targetInfoErr == nil { flowLogListCont.Title = fmt.Sprintf("%v %v", departTitleName, targetInfo.Title) // flowLogListCont.Title = fmt.Sprintf("%v %v-%v-%v数据上报", targetInfo.Title, flowLogInfo.Year, flowLogInfo.Month, flowLogInfo.ToDay) } else { // flowLogListCont.Title = fmt.Sprintf("%v-%v-%v数据上报", flowLogInfo.Year, flowLogInfo.Month, flowLogInfo.ToDay) flowLogListCont.Title = fmt.Sprintf("%v", departTitleName) } } else { flowLogListCont.Title = fmt.Sprintf("%v-%v-%v数据上报", flowLogInfo.Year, flowLogInfo.Month, flowLogInfo.ToDay) } addUser, addUserErr := commonus.GetWorkUser(strconv.FormatInt(flowLogInfo.EvaluationUser, 10)) if addUserErr == true { flowLogListCont.FounDer = addUser.Name } } } //解析审批流 var flowLog []FlowStep jsonFlowErr := json.Unmarshal([]byte(v.Content), &flowLog) setpLen := len(flowLog) if jsonFlowErr == nil { //得到当前步进值 currentSetp := setpLen - 1 if currentSetp < 0 { currentSetp = 0 } flowLogListCont.Node = flowLog[currentSetp].StepName addUser, addUserErr := commonus.GetWorkUser(flowLog[currentSetp].ClickName) if addUserErr == true { flowLogListCont.CurrentPeo = addUser.Name } } switch v.State { case 1: flowLogListCont.Result = "起草" flowLogListCont.Condition = "起草" flowLogListCont.StateType = 1 case 2: flowLogListCont.Result = "审批中" flowLogListCont.Condition = "审批中" flowLogListCont.StateType = 2 case 3: flowLogListCont.Result = "审批通过" flowLogListCont.Condition = "已结束" flowLogListCont.StateType = 3 case 4: flowLogListCont.Result = "驳回" flowLogListCont.Condition = "审批中" flowLogListCont.StateType = 4 default: flowLogListCont.Result = "审批中" flowLogListCont.Condition = "审批中" flowLogListCont.StateType = 0 } flowLogListOut = append(flowLogListOut, flowLogListCont) } countSum := len(flowLogListOut) printData := commonus.OutPutList(total, int64(countSum), requestData.Page, requestData.PageSize, flowLogListOut) if countSum > 0 { response.Result(0, printData, "查询成功!", c) } else { response.Result(3000, printData, "没有数据", c) } }