diff --git a/gin_server_admin/api/admin/dutyassess/assesstype.go b/gin_server_admin/api/admin/dutyassess/assesstype.go index e77e4ae..814229f 100644 --- a/gin_server_admin/api/admin/dutyassess/assesstype.go +++ b/gin_server_admin/api/admin/dutyassess/assesstype.go @@ -96,3 +96,105 @@ type OutQuantitativeConfig struct { TargetTitle string `json:"targettitle"` //指标 DetailedTargetTitle string `json:"detailedtargenttitle"` //指标明细 } + +//输出定性指标列表 +type DutySelectList struct { + assessmentmodel.EvaluationTarget + DepartmentList []string +} + +//考核方案细则列表输出 +type TargetContOutCont struct { + Id string `json:"id"` + Type int `json:"type"` + Group string `json:"group"` + GroupNAme string `json:"groupname"` + DepartmentId string `json:"parentid"` + DepartmentName string `json:"parentname"` + Dimension string `json:"dimension"` + DimensionName string `json:"dimensionname"` + DimensionWeight int64 `json:"dimensionweight"` //维度权重 + Target string `json:"target"` + TargetName string `json:"targetname"` + TargetWeight int64 `json:"targetweight"` //指标权重 + TargetSun string `json:"targetsun"` + TargetSunName string `json:"targetsunname"` + DetailedTarget string `json:"detailedtarget"` + DetailedTargetName string `json:"detailedtargetname"` + Content string `json:"content"` //指标说明 + Unit string `json:"unit"` //单位"` + ReferenceScore int64 `json:"referencescore"` //标准分值"` + Cycles int `json:"cycle"` //1:班;2:天;3:周;4:月;5:季度;6:年"` + CycleAttres int `json:"cycleattr"` //辅助计数"` + State int `json:"state"` + UserList []string `json:"userlist"` //执行人列表 + UserListAry []QualEvalArrt `json:"userlistary"` //执行人列表 +} + +//定性考核列表输出 +type QualEvalArrt struct { + Id string `json:"id"` + Name string `json:"name"` +} + +//输出定性考核列表 +type OutDutyList struct { + Id string `json:"id"` + Target string `json:"target"` //指标ID + TargetName string `json:"targetname"` //指标名称 + Dimension string `json:"dimension"` //维度ID + DimensionName string `json:"dimensionname"` //维度名称 + Content string `json:"content"` //指标说明 + Unit string `json:"unit"` //单位"` + ReferenceScore int64 `json:"referencescore"` //标准分值"` + Cycles int `json:"cycle"` //1:班;2:天;3:周;4:月;5:季度;6:年"` + CycleAttres int `json:"cycleattr"` //辅助计数"` + State int `json:"state"` + DepartmentId []int64 `json:"departmentid"` + DepartmentAry []DepartmentAryType `json:"departmentmap"` +} +type DepartmentAryType struct { + Parentid string `json:"parentid"` + Parentname string `json:"parentname"` +} + +//根据指标ID获取相关信息 +type TargetFormId struct { + OutDutyList + SunTargetList []SunTargetListType `json:"sunlist"` + Reportmap []string `json:"reportmap"` +} +type SunTargetListType struct { + DetailedTargetType + DetailedTarget []DetailedTargetType `json:"detailedtarget"` +} +type DetailedTargetType struct { + Id string `json:"Id"` + Title string `json:"Title"` + UserList []string `json:"userlist"` //执行人列表 + UserListAry []QualEvalArrt `json:"userlistary"` //执行人列表 +} + +//获取定性指标->指标细则修改回显 +type OutTargetCont struct { + Id string `json:"id"` + SunTargerId string `json:"suntargetid"` + SunTargetName string `json:"suntargetname"` + SunTargerList []QualEvalArrt `json:"suntargetlist"` + DetailedTargetId string `json:"detailedtargetid"` + DetailedTargetName string `json:"detailedtargetname"` + DetailedTargetContent string `json:"detailedtargetcontent"` + Operator []string `json:"operator"` + OperatorAry []QualEvalArrt `json:"operatormap"` +} + +//获取定性指标->指标细则修改回显修改或新增 +type GetEiteTargetCont struct { + Id string `json:"id"` + Class int `json:"class"` //1、新增;2、修改 + SunTargerId string `json:"suntargetid"` + SunTargetName string `json:"suntargetname"` + DetailedTargetName string `json:"detailedtargetname"` + DetailedTargetContent string `json:"detailedtargetcontent"` + Operator []string `json:"operator"` +} diff --git a/gin_server_admin/api/admin/dutyassess/dutyhandle.go b/gin_server_admin/api/admin/dutyassess/dutyhandle.go new file mode 100644 index 0000000..32aac14 --- /dev/null +++ b/gin_server_admin/api/admin/dutyassess/dutyhandle.go @@ -0,0 +1,427 @@ +package dutyassess + +import ( + "strconv" + "strings" + "time" + + "github.com/flipped-aurora/gin-vue-admin/server/commonus" + "github.com/flipped-aurora/gin-vue-admin/server/global" + "github.com/flipped-aurora/gin-vue-admin/server/model/assessmentmodel" + "github.com/flipped-aurora/gin-vue-admin/server/model/common/response" + "github.com/gin-gonic/gin" +) + +//获取定性考核指标列表(下拉列表) +func (d *DutyAssessApi) SelectDutyList(c *gin.Context) { + var evalTargetList []assessmentmodel.EvaluationTarget + err := global.GVA_DB_Performanceappraisal.Where("`et_type` = 1 AND `et_state` = 1").Find(&evalTargetList).Error + if err != nil { + response.Result(101, err, "没有数据!", c) + return + } + var listAry []DutySelectList + for _, v := range evalTargetList { + var cont DutySelectList + cont.Id = v.Id + + cont.Title = v.Title + cont.Type = v.Type + cont.State = v.State + cont.AddTime = v.AddTime + cont.Share = v.Share + cont.RelevantDepartments = v.RelevantDepartments + cont.Dimension = v.Dimension + cont.Key = v.Key + cont.Report = v.Report + cont.Uniteing = v.Uniteing + cont.Cycles = v.Cycles + cont.CycleAttres = v.CycleAttres + cont.VisibleRange = v.VisibleRange + cont.VisibleRangeGroup = v.VisibleRangeGroup + cont.DepartmentList = strings.Split(v.RelevantDepartments, ",") + listAry = append(listAry, cont) + } + response.Result(0, listAry, "查询完成!", c) +} + +//定性考核列表(部门方案用的) +func (d *DutyAssessApi) DutyDepartmentList(c *gin.Context) { + var requestData getDepartAssObtains + err := c.ShouldBindJSON(&requestData) + if err != nil { + // response.Result(101, err, "参数错误!请重新提交!", c) + // return + } + var targetId []int64 + gormDb := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_target") + if requestData.DepartID != "" { + gormDb = gormDb.Where("`qe_accept_evaluation` = ?", requestData.DepartID) + } + gormDb = gormDb.Where("`qe_state` = 1 AND `qe_type` = 1") + listTargetErr := gormDb.Group("qe_target").Find(&targetId).Error + if listTargetErr != nil { + response.Result(101, listTargetErr, "没有数据!", c) + return + } + var targetList []OutDutyList + for _, v := range targetId { + var targetCont OutDutyList + targetCont.Id = strconv.FormatInt(v, 10) + tarCont, _ := commonus.GetTargetInfo(v) + + targetCont.Target = strconv.FormatInt(v, 10) //指标ID + targetCont.TargetName = tarCont.Title //指标名称 + targetCont.Dimension = strconv.FormatInt(tarCont.Dimension, 10) //维度ID + dutyClassCont, dutyClassErr := commonus.GetDutyClassInfo(tarCont.Dimension) + if dutyClassErr == true { + targetCont.DimensionName = dutyClassCont.Title //维度名称 + } + targetCont.Content = "" //指标说明 + targetCont.Unit = tarCont.Uniteing //单位"` + targetCont.ReferenceScore = 0 //标准分值"` + targetCont.Cycles = tarCont.Cycles //1:班;2:天;3:周;4:月;5:季度;6:年"` + targetCont.CycleAttres = tarCont.CycleAttres //辅助计数"` + targetCont.State = 1 + targetCont.DepartmentId, targetCont.DepartmentAry = GetDutyFangAnDepart(v, 1) + + targetList = append(targetList, targetCont) + } + // var qualitativeEvaluationAry []assessmentmodel.QualitativeEvaluation + response.Result(0, targetList, "查询完成!", c) +} + +//获取方案中的所有所有相关部们 +func GetDutyFangAnDepart(dutyId int64, class int) (departId []int64, departAry []DepartmentAryType) { + err := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_accept_evaluation").Where("`qe_state` = 1 AND `qe_target` = ? AND `qe_type` = ?", dutyId, class).Group("qe_accept_evaluation").Find(&departId).Error + if err != nil { + return + } + + for _, v := range departId { + deparConErr, deparConCont := commonus.GetBranchFactory(v) + if deparConErr == true { + var departcont DepartmentAryType + departcont.Parentname = deparConCont.Name + departcont.Parentid = strconv.FormatInt(v, 10) + departAry = append(departAry, departcont) + } + } + return +} + +//根据指标ID获取列表信息 +func (d *DutyAssessApi) IdToTargetSunList(c *gin.Context) { + var requestData commonus.SetIds + err := c.ShouldBindJSON(&requestData) + if err != nil { + response.Result(101, err, "数据获取失败!", c) + return + } + if requestData.Id == 0 && requestData.OutId == "" { + response.Result(102, err, "参数错误!请重新提交!", c) + return + } + if requestData.OutId != "" { + idInt, inIntErr := strconv.ParseInt(requestData.OutId, 10, 64) + if inIntErr == nil { + requestData.Id = idInt + } + } + tarCont, isTrue := commonus.GetTargetInfo(requestData.Id) + if isTrue != true { + response.Result(103, err, "数据获取失败!", c) + return + } + var targetCont TargetFormId + targetCont.Id = strconv.FormatInt(requestData.Id, 10) + targetCont.Target = strconv.FormatInt(requestData.Id, 10) //指标ID + targetCont.TargetName = tarCont.Title //指标名称 + targetCont.Dimension = strconv.FormatInt(tarCont.Dimension, 10) //维度ID + dutyClassCont, dutyClassErr := commonus.GetDutyClassInfo(tarCont.Dimension) + if dutyClassErr == true { + targetCont.DimensionName = dutyClassCont.Title //维度名称 + } + targetCont.Content = "" //指标说明 + targetCont.Unit = tarCont.Uniteing //单位"` + targetCont.ReferenceScore = 0 //标准分值"` + targetCont.Cycles = tarCont.Cycles //1:班;2:天;3:周;4:月;5:季度;6:年"` + targetCont.CycleAttres = tarCont.CycleAttres //辅助计数"` + targetCont.State = 1 + targetCont.DepartmentId, targetCont.DepartmentAry = GetDutyFangAnDepart(requestData.Id, 1) + targetCont.SunTargetList = GetSunTargetList(requestData.Id, tarCont.Dimension, targetCont.DepartmentId) + targetCont.Reportmap = strings.Split(tarCont.Report, ",") + + // for _, vv := range jieguo { + // targetCont.SunTargetList = append(targetCont.SunTargetList, vv) + // } + // targetCont.SunTargetList = jieguo + // jsonstr, _ := json.Marshal(targetCont) + // fmt.Printf("+++++++++>%v----->\n", string(jsonstr)) + response.Result(0, targetCont, "查询完成!", c) +} + +//获取子指标和指标详情 +func GetSunTargetList(targetId, demID int64, parAryId []int64) (cont []SunTargetListType) { + var qualTargetCont []assessmentmodel.QualitativeTarget + err := global.GVA_DB_Performanceappraisal.Where("`q_state` = 1 AND `q_parent_id` = ?", targetId).Find(&qualTargetCont).Error + if err != nil { + return + } + // fmt.Printf("%v\n", qualTargetCont) + for _, v := range qualTargetCont { + var sunCont SunTargetListType + sunCont.Id = strconv.FormatInt(v.Id, 10) + sunCont.Title = v.Title + sunCont.DetailedTarget = GetDetailTrager(targetId, v.Id, demID, parAryId) + // fmt.Printf("-->%v-->%v\n", v.Id, v.Title) + cont = append(cont, sunCont) + } + // fmt.Printf("=========>%v\n", cont) + return +} + +//获取指标详情 +func GetDetailTrager(targetId, detId, demID int64, parAryId []int64) (cont []DetailedTargetType) { + var qualTargetCont []assessmentmodel.DetailedTarget + err := global.GVA_DB_Performanceappraisal.Where("`dt_state` = 1 AND `dt_parentid` = ? AND `dt_parentid_sun` = ?", targetId, detId).Find(&qualTargetCont).Error + if err != nil { + return + } + for _, v := range qualTargetCont { + var sunCont DetailedTargetType + sunCont.Id = strconv.FormatInt(v.Id, 10) + sunCont.Title = v.Title + sunCont.UserList, sunCont.UserListAry = GetOperator(demID, targetId, detId, v.Id, parAryId) + cont = append(cont, sunCont) + } + return +} + +//获取执行人 +func GetOperator(dimID, tarId, sunTarId, detaId int64, parAryId []int64) (UserList []string, UserListAry []QualEvalArrt) { + var qualEval []assessmentmodel.QualitativeEvaluation + err := global.GVA_DB_Performanceappraisal.Where("`qe_state` = 1 AND `qe_dimension` = ? AND `qe_target` = ? AND `qe_target_sun` = ? AND `qe_detailed_target` = ? AND `qe_accept_evaluation` IN ?", dimID, tarId, sunTarId, detaId, parAryId).Find(&qualEval).Error + if err != nil { + return + } + + for _, v := range qualEval { + if v.Operator != "" { + usAry := strings.Split(v.Operator, ",") + if len(usAry) > 0 { + for _, vv := range usAry { + + if commonus.IsItTrueString(vv, UserList) == false { + UserList = append(UserList, vv) + usCont, usErr := commonus.GetUserInfoPublic([]string{"worker_man.wm_number", "worker_man_data.wmd_name"}, map[string]interface{}{"wm_key": vv}) + if usErr == true { + var userCont QualEvalArrt + userCont.Id = vv + userCont.Name = usCont.Name + UserListAry = append(UserListAry, userCont) + } + } + } + } + } + } + return +} + +//获取定性指标->指标细则修改回显 +func (d *DutyAssessApi) GetDetailedTargetCallBack(c *gin.Context) { + var requestData commonus.SetIds + err := c.ShouldBindJSON(&requestData) + if err != nil { + response.Result(101, err, "数据获取失败!", c) + return + } + if requestData.Id == 0 && requestData.OutId == "" { + response.Result(102, err, "参数错误!请重新提交!", c) + return + } + if requestData.OutId != "" { + idInt, inIntErr := strconv.ParseInt(requestData.OutId, 10, 64) + if inIntErr == nil { + requestData.Id = idInt + } + } + var cont assessmentmodel.QualitativeEvaluation + errErr := global.GVA_DB_Performanceappraisal.Where("`qe_id` = ?", requestData.Id).Find(&cont).Error + if errErr != nil { + response.Result(103, err, "没有获取到数据!", c) + return + } + //输出格式 + var content OutTargetCont + content.Id = strconv.FormatInt(requestData.Id, 10) + //获取子栏目信息 + sunTargetCont, _ := commonus.GetQualitativeTargetInfo(cont.TargetSun) + content.SunTargerId = strconv.FormatInt(sunTargetCont.Id, 10) + content.SunTargetName = sunTargetCont.Title + //获取指标细则信息 + detaileInfo, _ := commonus.GetDetailedTargetInfo(cont.DetailedTarget) + content.DetailedTargetId = strconv.FormatInt(detaileInfo.Id, 10) + content.DetailedTargetName = detaileInfo.Title + content.DetailedTargetContent = detaileInfo.Content + shenPiRen := strings.Split(cont.Operator, ",") + content.Operator = shenPiRen + for _, v := range shenPiRen { + usCont, usErr := commonus.GetUserInfoPublic([]string{"worker_man.wm_number", "worker_man_data.wmd_name"}, map[string]interface{}{"wm_key": v}) + if usErr == true { + var userCont QualEvalArrt + userCont.Id = v + userCont.Name = usCont.Name + content.OperatorAry = append(content.OperatorAry, userCont) + } + } + //获取所有子栏目 + var qualTar []assessmentmodel.QualitativeTarget + quaTarErr := global.GVA_DB_Performanceappraisal.Where("`q_parent_id` = ?", cont.Target).Find(&qualTar).Error + if quaTarErr == nil { + for _, s_v := range qualTar { + var sunTarCont QualEvalArrt + sunTarCont.Id = strconv.FormatInt(s_v.Id, 10) + sunTarCont.Name = s_v.Title + content.SunTargerList = append(content.SunTargerList, sunTarCont) + } + } + response.Result(0, content, "获取成功!", c) +} + +//获取定性指标->指标细则修改回显 +func (d *DutyAssessApi) EiteDetailedTargetCallBack(c *gin.Context) { + var requestData GetEiteTargetCont + err := c.ShouldBindJSON(&requestData) + if err != nil { + response.Result(101, err, "数据获取失败!", c) + return + } + if requestData.Id == "" { + response.Result(102, err, "参数错误!请重新提交!", c) + return + } + var cont assessmentmodel.QualitativeEvaluation + errErr := global.GVA_DB_Performanceappraisal.Where("`qe_id` = ?", requestData.Id).Find(&cont).Error + if errErr != nil { + response.Result(103, err, "未能获取到数据!", c) + return + } + isTrue := false + if requestData.Class != 1 { + isTrue = NewEiteData(requestData, cont) + } else { + isTrue = NewAddData(requestData, cont) + } + if isTrue == false { + response.Result(104, err, "数据处理失败", c) + return + } + response.Result(0, err, "数据处理成功", c) +} + +//新增 +func NewAddData(getData GetEiteTargetCont, oldData assessmentmodel.QualitativeEvaluation) (isTrue bool) { + isTrue = false + var detailedTargetInfo assessmentmodel.DetailedTarget + detailedTargetInfo.Title = getData.DetailedTargetName + detailedTargetInfo.Content = getData.DetailedTargetContent + detailedTargetInfo.ParentId = oldData.Target + detailedTargetInfo.ParentIdSun = oldData.TargetSun + detailedTargetInfo.State = 1 + detailedTargetInfo.AddTime = time.Now().Unix() + addErr := global.GVA_DB_Performanceappraisal.Create(&detailedTargetInfo).Error + if addErr != nil { + return + } + var saveData assessmentmodel.QualitativeEvaluation + saveData.Title = oldData.Title + saveData.DepartmentId = oldData.DepartmentId + saveData.Dimension = oldData.Dimension + saveData.Target = oldData.Target + saveData.TargetSun = oldData.TargetSun + saveData.DetailedTarget = detailedTargetInfo.Id + saveData.Type = oldData.Type + saveData.Weight = oldData.Weight + saveData.Unit = oldData.Unit + saveData.ReferenceScore = oldData.ReferenceScore + saveData.State = oldData.State + saveData.Addtime = time.Now().Unix() + saveData.Eitetime = time.Now().Unix() + saveData.Group = oldData.Group + saveData.QualEvalId = oldData.QualEvalId + saveData.Cycles = oldData.Cycles + saveData.CycleAttres = oldData.CycleAttres + saveData.AcceptEvaluation = oldData.AcceptEvaluation + saveData.Operator = oldData.Operator + saveData.Content = oldData.Content + addErrQE := global.GVA_DB_Performanceappraisal.Create(&saveData).Error + if addErrQE != nil { + return + } + isTrue = true + return +} + +//修改 +func NewEiteData(getData GetEiteTargetCont, oldData assessmentmodel.QualitativeEvaluation) (isTrue bool) { + isTrue = false + eiteDetailedInfo := commonus.MapOut() + eiteDetailedInfo["dt_time"] = time.Now().Unix() + if getData.DetailedTargetName != "" { + eiteDetailedInfo["dt_title"] = getData.DetailedTargetName + } + if getData.DetailedTargetContent != "" { + eiteDetailedInfo["dt_content"] = getData.DetailedTargetContent + } + eiteDetaInfoErr := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.DetailedTarget{}).Where("`dt_id` = ?", oldData.DetailedTarget).Updates(&eiteDetailedInfo).Error + if eiteDetaInfoErr != nil { + return + } + if len(getData.Operator) > 0 { + eiteQualEvlInfo := commonus.MapOut() + eiteQualEvlInfo["qe_eitetime"] = time.Now().Unix() + eiteQualEvlInfo["qe_operator"] = strings.Join(getData.Operator, ",") + eiteQualEvlInfo["qe_department_id"] = strings.Join(commonus.GetDepartmentByUserBast(getData.Operator), ",") + eiteDetaQuaInfoErr := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Where("`qe_id` = ?", oldData.Id).Updates(&eiteQualEvlInfo).Error + if eiteDetaQuaInfoErr != nil { + return + } + } + isTrue = true + return +} + +//修改子栏目名称 +func (d *DutyAssessApi) EiteSunTargetName(c *gin.Context) { + var requestData QualEvalArrt + err := c.ShouldBindJSON(&requestData) + if err != nil { + response.Result(101, err, "数据获取失败!", c) + return + } + if requestData.Id == "" { + response.Result(102, err, "参数错误!请重新提交!", c) + return + } + if requestData.Name == "" { + response.Result(103, err, "参数错误!请重新提交!", c) + return + } + var oldId int64 + errCont := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeTarget{}).Select("q_id").Where("`q_id` = ?", requestData.Id).First(&oldId).Error + if errCont != nil { + response.Result(104, err, "没有该数据!", c) + return + } + eiteCont := commonus.MapOut() + eiteCont["q_time"] = time.Now().Unix() + eiteCont["q_title"] = requestData.Name + errEiteCont := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeTarget{}).Where("`q_id` = ?", requestData.Id).Updates(&eiteCont).Error + if errEiteCont != nil { + response.Result(105, err, "修改失败!", c) + return + } + response.Result(0, err, "数据处理成功", c) +} diff --git a/gin_server_admin/api/index/evaluation/evaluation.go b/gin_server_admin/api/index/evaluation/evaluation.go index 1be7e04..e4c3005 100644 --- a/gin_server_admin/api/index/evaluation/evaluation.go +++ b/gin_server_admin/api/index/evaluation/evaluation.go @@ -195,7 +195,8 @@ func (e *EvaluationInterface) AdditionAndSubtractionScore(c *gin.Context) { return } - commonus.StepAddData(keyNumber, 0, 2, 1, userCont.Key) + commonus.StepAddData(keyNumber, 0, 2, 1, 1, 1, 1, userCont.Key) + // /* // @flowID 流程ID // @userKey 操作人key @@ -916,7 +917,9 @@ func (e *EvaluationInterface) AddFlowRationLog(c *gin.Context) { // response.Result(0, sendUserList, "未指定相关部门处理人!未能向相关人员发送考核项目!请手动发起!", c) // return } - UpEvaluationProcessApproval(keyNumber, 16182159043990656, keyNumber, 1, userCont.Key) + // UpEvaluationProcessApproval(keyNumber, 16182159043990656, keyNumber, 1, userCont.Key) + + commonus.StepAddData(keyNumber, 16182159043990656, 2, 7, 2, 1, 1, userCont.Key) mainTitle := fmt.Sprintf("%v数据表", commonus.TimeStampToDate(operationTime, 10)) mainTitleDesc := "" @@ -975,6 +978,7 @@ func (e *EvaluationInterface) LookDutkScoreFlow(c *gin.Context) { requestData.Id = idInt } } + var titleVal string = "" fmt.Printf("1-------------------->\n") var addScore assessmentmodel.ScoreFlow gerErr := global.GVA_DB_Performanceappraisal.Where("`sf_key` = ?", requestData.Id).Find(&addScore).Error @@ -1000,12 +1004,14 @@ func (e *EvaluationInterface) LookDutkScoreFlow(c *gin.Context) { dimInfo, dimInfoErr := commonus.GetDutyClassInfo(qualEvalCont.Dimension) if dimInfoErr == true { dutyCecorFlowInfo.Dimension = dimInfo.Title + titleVal = dimInfo.Title } } if qualEvalCont.Target != 0 { target, targetErr := commonus.GetTargetInfo(qualEvalCont.Target) if targetErr == true { dutyCecorFlowInfo.Target = target.Title + titleVal = target.Title } } @@ -1013,6 +1019,7 @@ func (e *EvaluationInterface) LookDutkScoreFlow(c *gin.Context) { tarsun, tarsunErr := commonus.GetQualitativeTargetInfo(qualEvalCont.TargetSun) if tarsunErr == true { dutyCecorFlowInfo.TargetSun = tarsun.Title + titleVal = tarsun.Title } } if qualEvalCont.DetailedTarget != 0 { @@ -1020,6 +1027,7 @@ func (e *EvaluationInterface) LookDutkScoreFlow(c *gin.Context) { if detaTarErr == true { dutyCecorFlowInfo.DetailedTarget = detaTar.Title dutyCecorFlowInfo.Content = detaTar.Content + titleVal = detaTar.Title } } fmt.Printf("7-------------------->%v\n", requestData.Id) @@ -1149,7 +1157,14 @@ func (e *EvaluationInterface) LookDutkScoreFlow(c *gin.Context) { } } } + //流程全面 + var flowAllMapList []commonus.FlowAllMap + jsonFlowErrers := json.Unmarshal([]byte(evalProInfo.NextContent), &flowAllMapList) + if jsonFlowErrers == nil { + dutyCecorFlowInfo.FlowMapAll = flowAllMapList + } } + dutyCecorFlowInfo.Title = titleVal response.Result(0, dutyCecorFlowInfo, "获取成功", c) } @@ -1196,6 +1211,7 @@ func (d *EvaluationInterface) LookRationkScoreFlow(c *gin.Context) { return } //流程查看 + var flowAllMapList []commonus.FlowAllMap var flowLogList []TechnologicalProcessType var evalProInfo assessmentmodel.EvaluationProcess gerEvalErr := global.GVA_DB_Performanceappraisal.Where("`ep_order_key` = ?", requestData.Id).Find(&evalProInfo).Error @@ -1261,13 +1277,24 @@ func (d *EvaluationInterface) LookRationkScoreFlow(c *gin.Context) { } } } + //流程图全面 + // flowAllMapList + if evalProInfo.NextContent != "" { + jsonFlowErr := json.Unmarshal([]byte(evalProInfo.NextContent), &flowAllMapList) + if jsonFlowErr == nil { + } + } } + outListMap := commonus.MapOut() outListMap["List"] = outList outListMap["flowLog"] = flowLogList + outListMap["flowall"] = flowAllMapList + outListMap["title"] = "" var flowLogInfo assessmentmodel.FlowLog getErrs := global.GVA_DB_Performanceappraisal.Where("`fl_key` = ?", requestData.Id).First(&flowLogInfo).Error if getErrs == nil { + titleStr := fmt.Sprintf("%v年%v月%v日数据上报", flowLogInfo.Year, flowLogInfo.Month, flowLogInfo.ToDay) gErr, groupInfo := commonus.GetGroupCont(flowLogInfo.DutyGroup) if gErr == true { outListMap["groupname"] = groupInfo.Name @@ -1278,10 +1305,11 @@ func (d *EvaluationInterface) LookRationkScoreFlow(c *gin.Context) { dErr, BranchInfo := commonus.GetBranchFactory(flowLogInfo.DutyDepartment) if dErr == true { outListMap["departmentname"] = BranchInfo.Name + titleStr = fmt.Sprintf("%v%v", BranchInfo.Name, titleStr) } else { outListMap["departmentname"] = "" } - + outListMap["title"] = titleStr } response.Result(0, outListMap, "查询成功", c) diff --git a/gin_server_admin/api/index/evaluation/flowsend.go b/gin_server_admin/api/index/evaluation/flowsend.go index 7ce1448..94dea4a 100644 --- a/gin_server_admin/api/index/evaluation/flowsend.go +++ b/gin_server_admin/api/index/evaluation/flowsend.go @@ -182,7 +182,7 @@ func (e *EvaluationInterface) PlusOrMinusPoints(c *gin.Context) { cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", keyNumber) if myIsTrue != 1 { //写入当前流程步骤 - commonus.StepAddData(keyNumber, 0, 3, 1, userCont.Key) + commonus.StepAddData(keyNumber, 0, 3, 1, 1, 1, 1, userCont.Key) //申请人也是部门负责人 //给相关部门内勤发送消息。确定相关责任人 sendUserIsTrue, sendUserList := commonus.GetSendMsgUser(16118387069540343, programme.AcceptEvaluation) //获取对应部门内勤 @@ -198,7 +198,7 @@ func (e *EvaluationInterface) PlusOrMinusPoints(c *gin.Context) { } else { //写入当前流程步骤 - commonus.StepAddData(keyNumber, 16182159043990656, 2, 1, userCont.Key) + commonus.StepAddData(keyNumber, 16182159043990656, 2, 1, 1, 1, 1, userCont.Key) //申请人不是是部门负责人 给本部门负责人发送审批 //获取发起人部门负责人 departmentIdInts, _ := strconv.ParseInt(userCont.DepartmentId, 10, 64) @@ -267,7 +267,7 @@ func (e *EvaluationInterface) PersonInCharge(c *gin.Context) { } } //写入审批流程 - commonus.StepAddData(orderId, 0, 4, 3, userCont.Key) + commonus.StepAddData(orderId, 0, 4, 3, 1, 1, 3, userCont.Key) var scoreFlowInfo assessmentmodel.ScoreFlow judegFlowErr := global.GVA_DB_Performanceappraisal.Where("`sf_key` = ?", orderId).First(&scoreFlowInfo).Error if judegFlowErr != nil { @@ -288,9 +288,13 @@ func (e *EvaluationInterface) PersonInCharge(c *gin.Context) { return } + //同一订单下,删除原有的,再从新分配。 + global.GVA_DB_Performanceappraisal.Where("df_sf_id = ?", orderId).Delete(&assessmentmodel.DivisionResponsibilities{}) + var reason string //引用文本描述 var saveDataAry []assessmentmodel.DivisionResponsibilities var userKeyAry []int64 + var userKeyMainAry []int64 var MainResponsiblePerson MainResponsiblePersonType var teamIsTrue int = 1 for _, v := range requestData.UserList { @@ -333,7 +337,9 @@ func (e *EvaluationInterface) PersonInCharge(c *gin.Context) { saveDataCont.Group = userConting.Group saveDataCont.Department = userConting.DepartmentId saveDataCont.Tema = userConting.Tema - userKeyAry = append(userKeyAry, userConting.Key) + if v.Type != 3 { + userKeyAry = append(userKeyAry, userConting.Key) + } var zeren string switch v.Type { case 1: @@ -343,6 +349,7 @@ func (e *EvaluationInterface) PersonInCharge(c *gin.Context) { MainResponsiblePerson.Department = userConting.DepartmentId MainResponsiblePerson.WorkshopId = userConting.WorkshopId MainResponsiblePerson.Tema = userConting.Tema + userKeyMainAry = append(userKeyMainAry, userConting.Key) case 2: zeren = "互保责任人" case 3: @@ -444,6 +451,8 @@ func (e *EvaluationInterface) PersonInCharge(c *gin.Context) { response.Result(108, writeDataErr, "数据写入失败", c) return } + //审批节点写入责任人 + commonus.WriteFlowMainSet(orderId, userKeyMainAry) flowSaveData := commonus.MapOut() flowSaveData["sf_reply"] = 2 flowSaveData["sf_eite_time"] = time.Now().Unix() @@ -568,7 +577,7 @@ func (e *EvaluationInterface) RectificationMeasures(c *gin.Context) { return } //写入流程步骤 - commonus.StepAddData(orderidval, 0, 6, 4, userCont.Key) + commonus.StepAddData(orderidval, 0, 6, 4, 1, 1, 5, userCont.Key) /* 向本部门负责人发送审批 */ @@ -645,3 +654,5 @@ func (e *EvaluationInterface) RectificationMeasures(c *gin.Context) { response.Result(0, outData, "数据写入成功", c) } + +// diff --git a/gin_server_admin/api/index/evaluation/lookquantita.go b/gin_server_admin/api/index/evaluation/lookquantita.go index 349f851..73411b7 100644 --- a/gin_server_admin/api/index/evaluation/lookquantita.go +++ b/gin_server_admin/api/index/evaluation/lookquantita.go @@ -1,6 +1,10 @@ package evaluation import ( + "encoding/json" + "fmt" + "strconv" + "github.com/flipped-aurora/gin-vue-admin/server/commonus" "github.com/flipped-aurora/gin-vue-admin/server/global" "github.com/flipped-aurora/gin-vue-admin/server/model/assessmentmodel" @@ -98,3 +102,106 @@ func (e *EvaluationInterface) LookQuantitativeConfig(c *gin.Context) { } response.Result(0, outList, "获取成功!", c) } + +//查看审批流程 +func (e *EvaluationInterface) SeeFlowLog(c *gin.Context) { + isTrue, userCont := commonus.ClientIdentity() + if isTrue != true { + response.Result(101, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c) + return + } + var requestData FlowLogType + c.ShouldBindJSON(&requestData) + + if requestData.PageSize == 0 { + requestData.PageSize = 20 + } + if requestData.Page <= 0 { + requestData.Page = 1 + } + offSetPage := commonus.CalculatePages(requestData.Page, requestData.PageSize) + + var evalProContList []assessmentmodel.EvaluationProcess + gormDb := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.EvaluationProcess{}).Where("FIND_IN_SET(?,`ep_participants`)", userCont.Key) + if requestData.State != 0 { + gormDb = gormDb.Where("ep_state = ?", requestData.State) + } + /* + 获取总共有多少记录 + */ + var total int64 + totalErr := gormDb.Count(&total).Error + if totalErr != nil { + total = 0 + } + //获取记录数据 + evaErr := gormDb.Order("ep_id ASC").Limit(requestData.PageSize).Offset(offSetPage).Find(&evalProContList).Error + if evaErr != nil { + response.Result(104, evaErr, "数据获取失败!", 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 + if v.TypeClass == 1 { + //获取考核项目关联项目 + targettitle, detailedRulesTitle, _, _, scoreFlowCont, dutyTarDetErr := commonus.GetDutyAssociatedItems(orderId) + if dutyTarDetErr == true { + if detailedRulesTitle != "" { + flowLogListCont.Title = fmt.Sprintf("%v", detailedRulesTitle) + } else { + flowLogListCont.Title = fmt.Sprintf("%v", targettitle) + } + addUser, addUserErr := commonus.GetWorkUser(strconv.FormatInt(scoreFlowCont.EvaluationUser, 10)) + if addUserErr == true { + flowLogListCont.FounDer = addUser.Name + } + } + } else { + flowLogInfo, flowLogErr := commonus.GetFlowLog(orderId) + if flowLogErr == true { + 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 2: + flowLogListCont.Result = "审批通过" + flowLogListCont.Condition = "已结束" + case 3: + 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) +} diff --git a/gin_server_admin/api/index/evaluation/type.go b/gin_server_admin/api/index/evaluation/type.go index 332945b..ef8a828 100644 --- a/gin_server_admin/api/index/evaluation/type.go +++ b/gin_server_admin/api/index/evaluation/type.go @@ -1,6 +1,9 @@ package evaluation -import "github.com/flipped-aurora/gin-vue-admin/server/model/assessmentmodel" +import ( + "github.com/flipped-aurora/gin-vue-admin/server/commonus" + "github.com/flipped-aurora/gin-vue-admin/server/model/assessmentmodel" +) type EvaluationInterface struct{} @@ -116,17 +119,19 @@ type GetRationFlowLog struct { //定性指标流程展示 type DutyCecorFlow struct { - OrderId string `json:"orderid"` //审批流标识 - Dimension string `json:"dimension"` //维度 - Target string `json:"target"` //指标 - TargetSun string `json:"targetsun"` //子指标 - DetailedTarget string `json:"detailedtargent"` //指标明细 - Content string `json:"content"` //指标说明 - Reason string `json:"reason"` //操作原因 - ReasonInfo string `json:"reasoninfo"` // - DivisionResponsibility []DivisiosibilityType `json:"divresbil"` //责任划分 - RectifMeasures []RectifMeasures `json:"rectifmeasures"` //整改措施 - TechnologicalProcess []TechnologicalProcessType `technologicalprocess` //流程 + Title string `json:"title"` //审批流标识 + OrderId string `json:"orderid"` //审批流标识 + Dimension string `json:"dimension"` //维度 + Target string `json:"target"` //指标 + TargetSun string `json:"targetsun"` //子指标 + DetailedTarget string `json:"detailedtargent"` //指标明细 + Content string `json:"content"` //指标说明 + Reason string `json:"reason"` //操作原因 + ReasonInfo string `json:"reasoninfo"` // + DivisionResponsibility []DivisiosibilityType `json:"divresbil"` //责任划分 + RectifMeasures []RectifMeasures `json:"rectifmeasures"` //整改措施 + TechnologicalProcess []TechnologicalProcessType `json:"technologicalprocess"` //流程 + FlowMapAll []commonus.FlowAllMap `json:"flowmapall"` //流程全貌 } //审批流 @@ -204,3 +209,21 @@ type MainResponsiblePersonType struct { Tema int64 `json:"tema"` Weight int64 `json:"weight"` } + +//流程记录 +type FlowLogType struct { + commonus.PageSetLimt + State int `json:"state"` //状态 +} + +//流程记录输出 +type FlowLogListOut struct { + OutId string `json:"outid"` //id + Title string `json:"tittle"` //流程名 + Node string `json:"node"` //当前节点 + CurrentPeo string `json:"currentpeo"` //当前负责人 + FounDer string `json:"founder"` //创建人 + Condition string `json:"condition"` //审批状态 + Result string `json:"result"` //审批结果 + Class int `json:"class"` //1、定性;2、定量 +} diff --git a/gin_server_admin/api/v1/assessment/department_target.go b/gin_server_admin/api/v1/assessment/department_target.go index 33f046a..1d5fed8 100644 --- a/gin_server_admin/api/v1/assessment/department_target.go +++ b/gin_server_admin/api/v1/assessment/department_target.go @@ -105,6 +105,9 @@ func (d *DutyHandle) DepartmentTaskList(c *gin.Context) { if requestData.Group != "" { gormDb = gormDb.Where("`qe_group` = ?", requestData.Group) } + // if requestData.DepartmentId != "" { + // gormDb = gormDb.Where("`qe_accept_evaluation` = ?", requestData.DepartmentId) + // } if requestData.DepartmentId != "" { gormDb = gormDb.Where("`qe_accept_evaluation` = ?", requestData.DepartmentId) } @@ -118,6 +121,7 @@ func (d *DutyHandle) DepartmentTaskList(c *gin.Context) { if requestData.TargetSun != "" { gormDb = gormDb.Where("`qe_target_sun` = ?", requestData.TargetSun) } + gormDb = gormDb.Where("`qe_state` = 1") listTargetErr := gormDb.Order("qe_group asc,qe_accept_evaluation asc,qe_dimension asc,qe_type asc,qe_target asc,qe_target_sun asc").Find(&qualitativeEvaluationAry).Error if listTargetErr != nil || len(qualitativeEvaluationAry) < 1 { @@ -762,7 +766,7 @@ func (d *DutyHandle) AddDepartmentDutyInfo(c *gin.Context) { } else { fmt.Printf("judge----------------6-----1------>%v\n", v_s) var qualEvalId []int64 - judgeQualEvalErr := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id").Where("`qe_group` = ? AND FIND_IN_SET(%v,`qe_department_id`) AND `qe_dimension` = ? AND `qe_target` = ?", groupId, departId, v.Id, v_s.Id).Find(&qualEvalId).Error + judgeQualEvalErr := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id").Where("`qe_group` = ? AND FIND_IN_SET(?,`qe_department_id`) AND `qe_dimension` = ? AND `qe_target` = ?", groupId, departId, v.Id, v_s.Id).Find(&qualEvalId).Error if judgeQualEvalErr == nil { if len(qualEvalId) > 0 { eiteIdAry = append(eiteIdAry, 2) diff --git a/gin_server_admin/api/v1/assessment/dutyhandle.go b/gin_server_admin/api/v1/assessment/dutyhandle.go index a0d692d..8b97a00 100644 --- a/gin_server_admin/api/v1/assessment/dutyhandle.go +++ b/gin_server_admin/api/v1/assessment/dutyhandle.go @@ -37,6 +37,8 @@ func (d *DutyHandle) DutyClassList(c *gin.Context) { whereMap := commonus.MapOut() if requestData.State != 0 { whereMap["state"] = requestData.State + } else { + whereMap["state"] = 1 } var dutyClassAry []assessmentmodel.DutyClass if requestData.Title != "" { diff --git a/gin_server_admin/api/v1/assessment/dutytype.go b/gin_server_admin/api/v1/assessment/dutytype.go index bd4c867..47d39d2 100644 --- a/gin_server_admin/api/v1/assessment/dutytype.go +++ b/gin_server_admin/api/v1/assessment/dutytype.go @@ -279,6 +279,7 @@ type listTarget struct { RelevantDepartments []string `json:"relevantdepartments"` //相关部门 VisibleRangeGroup []string `json:"visiblerangegroup"` //可见范围(集团) VisibleRangeDepart []string `json:"visiblerangedepart"` //可见范围(分厂) + Dimension string `json:"dimension"` //维度 (待定是否使用) } //添加指标 @@ -316,6 +317,7 @@ type outTargetAttr struct { //详细内容输出 type outTargetInfo struct { assessmentmodel.EvaluationTarget + GroupMap []string `json:"group"` DimensionIdStr string `json:"dimensionidstr"` RelevantDepartmentMap []string `json:"relevantdepartmentsmap"` ReportMap []string `json:"reportmap"` diff --git a/gin_server_admin/api/v1/assessment/newassessment.go b/gin_server_admin/api/v1/assessment/newassessment.go index 535ac69..18b06ab 100644 --- a/gin_server_admin/api/v1/assessment/newassessment.go +++ b/gin_server_admin/api/v1/assessment/newassessment.go @@ -1,7 +1,6 @@ package assessment import ( - "encoding/json" "fmt" "strconv" "strings" @@ -20,8 +19,8 @@ func (d *dataLockStatistics) AddCardAssEss(deparmentId string, addData AddQualEv sunTargetCont, sunTargetErr := judgeColumn(addData.Target, addData.TargetSun, addData.TargetSunTitle) if sunTargetErr != true { } - jsonCont, _ := json.Marshal(sunTargetCont) - fmt.Printf("jsonKKKK----------------->%v\n", string(jsonCont)) + // jsonCont, _ := json.Marshal(sunTargetCont) + // fmt.Printf("jsonKKKK----------------->%v\n", string(jsonCont)) groupInt, groupIntErr := strconv.ParseInt(addData.Group, 10, 64) if groupIntErr != nil { groupInt = 1 @@ -51,9 +50,12 @@ func (d *dataLockStatistics) AddCardAssEss(deparmentId string, addData AddQualEv } addDepartDimension(addData.Group, strconv.FormatInt(dimensionInt, 10), addData.Dimension, 1) - + var jiBuQi int = 0 var saveDataAry []assessmentmodel.QualitativeEvaluation for _, v := range addData.EvaluationList { + + wheAry := commonus.MapOut() + var saveData assessmentmodel.QualitativeEvaluation saveData.Group = groupInt @@ -68,6 +70,13 @@ func (d *dataLockStatistics) AddCardAssEss(deparmentId string, addData AddQualEv saveData.Target = targetInt saveData.TargetSun = sunTargetCont.Id + + wheAry["qe_dimension"] = dimensionInt + wheAry["qe_target"] = targetInt + wheAry["qe_target_sun"] = sunTargetCont.Id + wheAry["qe_group"] = groupInt + wheAry["qe_type"] = addData.Type + // targetSunInt, targetSunIntErr := strconv.ParseInt(addData.TargetSun, 10, 64) // if targetSunIntErr == nil { // saveData.TargetSun = targetSunInt @@ -75,6 +84,7 @@ func (d *dataLockStatistics) AddCardAssEss(deparmentId string, addData AddQualEv explainCont, explainErr := judgeDetails(addData.Target, v.Title, v.Content, v.DetailedTarget, sunTargetCont.Id) if explainErr == true { saveData.DetailedTarget = explainCont.Id + wheAry["qe_detailed_target"] = explainCont.Id } // detailedTargetInt, detailedTargetIntErr := strconv.ParseInt(v.DetailedTarget, 10, 64) // if detailedTargetIntErr == nil { @@ -92,10 +102,28 @@ func (d *dataLockStatistics) AddCardAssEss(deparmentId string, addData AddQualEv if departmentIdInt != 0 { saveData.AcceptEvaluation = departmentIdInt + wheAry["qe_accept_evaluation"] = departmentIdInt } saveData.Operator = strings.Join(v.Operator, ",") saveData.DepartmentId = strings.Join(GetDepartmentByUserBast(v.Operator), ",") - saveDataAry = append(saveDataAry, saveData) + + //判断该项目是否存在! + judgeIsSet := global.GVA_DB_Performanceappraisal.Where(wheAry).First(&saveData).Error + + if judgeIsSet == nil { + jiBuQi++ + eiteData := commonus.MapOut() + eiteData["qe_unit"] = v.Unit + eiteData["qe_reference_score"] = v.ReferenceScore + eiteData["qe_eitetime"] = time.Now().Unix() + eiteData["qe_cycle"] = v.Cycles + eiteData["qe_cycleattr"] = v.CycleAttres + eiteData["qe_content"] = v.Content + global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Where("qe_id = ?", saveData.Id).Updates(&eiteData) + } else { + saveDataAry = append(saveDataAry, saveData) + } + msg := commonus.MapOut() msg["msg"] = saveData d.dataMap = append(d.dataMap, msg) @@ -107,15 +135,18 @@ func (d *dataLockStatistics) AddCardAssEss(deparmentId string, addData AddQualEv msg["data"] = saveDataAry msg["msg"] = fmt.Sprintf("《%v》考核维度录入失败!请重新处理此方案", addData.Dimension) d.dataErrMap = append(d.dataErrMap, msg) - } else { - - commonus.AddDimenTargetWeight(int64(addData.Type), groupInt, departmentIdInt, dimensionInt, targetInt) } } + commonus.AddDimenTargetWeight(int64(addData.Type), groupInt, departmentIdInt, dimensionInt, targetInt) syncProcess.Done() } //判断该子栏目是否存在 +/* +@ascription 指标ID +@columId 子指标ID +@title 指标名称 +*/ func judgeColumn(ascription, columId, title string) (content assessmentmodel.QualitativeTarget, isTrue bool) { isTrue = false if columId != "" { diff --git a/gin_server_admin/api/v1/assessment/ration_evaluation.go b/gin_server_admin/api/v1/assessment/ration_evaluation.go index 5506526..31709a6 100644 --- a/gin_server_admin/api/v1/assessment/ration_evaluation.go +++ b/gin_server_admin/api/v1/assessment/ration_evaluation.go @@ -65,6 +65,12 @@ func (d *DutyHandle) AddRation(c *gin.Context) { } //关联集团部门考核维度 +/* +@groupID 集团 +@departId 部门 +@dimensionId 维度 +@key 1:定性考核;2:定量考核 +*/ func addDepartDimension(groupID, departId, dimensionId string, key int64) { judgeMap := commonus.MapOut() judgeErr := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.DepartmentDimension{}).Select("dd_id").Where("`dd_group` = ? AND `dd_department` = ? AND `dd_dimension` = ?", groupID, departId, dimensionId).First(&judgeMap).Error diff --git a/gin_server_admin/api/v1/assessment/target.go b/gin_server_admin/api/v1/assessment/target.go index c7109fc..adf61f7 100644 --- a/gin_server_admin/api/v1/assessment/target.go +++ b/gin_server_admin/api/v1/assessment/target.go @@ -41,6 +41,9 @@ func (d *DutyHandle) GetTargetList(c *gin.Context) { if requestData.Share != 0 { gormDb = gormDb.Where("`et_share` = ?", requestData.Share) } + if requestData.Dimension != "" { + gormDb = gormDb.Where("`et_dimension` = ?", requestData.Dimension) + } if requestData.Title != "" { gormDb = gormDb.Where("(`et_title` LIKE ?)", "%"+requestData.Title+"%") } @@ -338,6 +341,7 @@ func (d *DutyHandle) GetTarget(c *gin.Context) { } if systemEvalCont.RelevantDepartments != "" { systemEvalCont.RelevantDepartmentMap = strings.Split(systemEvalCont.RelevantDepartments, ",") + systemEvalCont.GroupMap = commonus.GetDuboDepart(strings.Split(systemEvalCont.RelevantDepartments, ",")) } if systemEvalCont.Report != "" { systemEvalCont.ReportMap = strings.Split(systemEvalCont.Report, ",") @@ -384,6 +388,16 @@ func (d *DutyHandle) DelTarget(c *gin.Context) { if requestData.State == 0 { requestData.State = 1 } + //判断该指标是否已经被使用过 + // var qualitativeEvaluationAry []assessmentmodel.QualitativeEvaluation + var qeId int64 = 0 + judgeErrQe := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id").Where("`qe_state` IN (1,2) AND `qe_target` = ?", requestData.Id).Find(&qeId) + if judgeErrQe == nil { + if qeId != 0 { + response.Result(103, qeId, "该指标已经再考核方案中使用!请先解除使用关系,再进行删除操作!", c) + return + } + } saveData := commonus.MapOut() saveData["et_state"] = requestData.State saveData["et_time"] = time.Now().Unix() @@ -464,6 +478,8 @@ func (d *DutyHandle) EiteTarget(c *gin.Context) { return } saveData["et_relevant_departments"] = strings.Join(requestData.RelevantDepartments, ",") + } else { + saveData["et_relevant_departments"] = "" } } if requestData.Dimension != "" { diff --git a/gin_server_admin/api/v1/shiyan/shiyan.go b/gin_server_admin/api/v1/shiyan/shiyan.go index 46ca86d..fb283b0 100644 --- a/gin_server_admin/api/v1/shiyan/shiyan.go +++ b/gin_server_admin/api/v1/shiyan/shiyan.go @@ -13,6 +13,7 @@ import ( "github.com/flipped-aurora/gin-vue-admin/server/commonus" "github.com/flipped-aurora/gin-vue-admin/server/global" "github.com/flipped-aurora/gin-vue-admin/server/model/approvalprocess" + "github.com/flipped-aurora/gin-vue-admin/server/model/assessmentmodel" "github.com/flipped-aurora/gin-vue-admin/server/model/common/response" "github.com/flipped-aurora/gin-vue-admin/server/model/testpage" "github.com/flipped-aurora/gin-vue-admin/server/model/wechat" @@ -1298,3 +1299,45 @@ func (s *ShiyanApi) DateTime(c *gin.Context) { quer := commonus.ComputingTime(requestData.Time, requestData.Type) response.Result(0, quer, "查询成功", c) } + +//校正权重 +func (s *ShiyanApi) CorrectionWeight(c *gin.Context) { + var ddwList assessmentmodel.DepartmentDimensionWeight + err := global.GVA_DB_Performanceappraisal.Find(&ddwList) + if err != nil { + fmt.Println() + return + } +} + +//考核方案去重 +func (s *ShiyanApi) DeltDutyChongfu(c *gin.Context) { + var list []assessmentmodel.QualitativeEvaluation + err := global.GVA_DB_Performanceappraisal.Find(&list).Error + if err != nil { + response.Result(0, err, "没有数据", c) + return + } + for _, v := range list { + DelteGroup(v.Group, v.AcceptEvaluation, v.Dimension, v.Target, v.TargetSun, v.DetailedTarget, v.DepartmentId) + + } +} + +//执行去重删除操作 +func DelteGroup(group, depart, dime, target, suntar, detaid int64, runDepart string) { + var countId []int64 + err := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id").Where("`qe_group` = ? AND `qe_accept_evaluation` = ? AND `qe_dimension` = ? AND `qe_target` = ? AND `qe_target_sun` = ? AND `qe_detailed_target` = ? AND `qe_department_id` = ?", group, depart, dime, target, suntar, detaid, runDepart).Find(&countId).Error + if err != nil { + return + } + if len(countId) < 2 { + return + } + for i, v := range countId { + if i != 0 { + fmt.Printf("%v\n", v) + global.GVA_DB_Performanceappraisal.Where("`qe_id` = ?", v).Delete(&assessmentmodel.QualitativeEvaluation{}) + } + } +} diff --git a/gin_server_admin/api/wechatapp/callback/apphandle.go b/gin_server_admin/api/wechatapp/callback/apphandle.go index b561ad8..8e4fa5b 100644 --- a/gin_server_admin/api/wechatapp/callback/apphandle.go +++ b/gin_server_admin/api/wechatapp/callback/apphandle.go @@ -180,7 +180,7 @@ func (c *CallBackData) DecryptMessage(cs *gin.Context) (echoMsg string) { } // fmt.Printf("yyyyyyyy------------->%v\n", string(jsonStr)) if msgContent.Event != "LOCATION" { - global.GVA_DB_WechatCallBack.Create(&callbackLog) + // global.GVA_DB_WechatCallBack.Create(&callbackLog) } return } diff --git a/gin_server_admin/api/wechatapp/callback/rationcallback.go b/gin_server_admin/api/wechatapp/callback/rationcallback.go index 9833890..2b9ce36 100644 --- a/gin_server_admin/api/wechatapp/callback/rationcallback.go +++ b/gin_server_admin/api/wechatapp/callback/rationcallback.go @@ -6,7 +6,6 @@ import ( "strings" "time" - evals "github.com/flipped-aurora/gin-vue-admin/server/api/index/evaluation" "github.com/flipped-aurora/gin-vue-admin/server/api/wechatapp/sendmessage" "github.com/flipped-aurora/gin-vue-admin/server/commonus" "github.com/flipped-aurora/gin-vue-admin/server/global" @@ -49,9 +48,10 @@ func (t *TemplateCardPush) ButtonTemplateCallBackHandleRation(orderId, clickEnte } if clickEnter == "1" { userKeyStr := strconv.FormatInt(userContInfo.Key, 10) - evals.UpEvaluationProcessApproval(scoreFlowInfo.Key, 16182159043990656, 0, 2, userKeyStr) + // evals.UpEvaluationProcessApproval(scoreFlowInfo.Key, 16182159043990656, 0, 2, userKeyStr) + commonus.StepAddData(scoreFlowInfo.Key, 16182159043990656, 3, 7, 2, 2, 2, userKeyStr) saveData := commonus.MapOut() - saveData["fl_reply"] = 2 + saveData["fl_reply"] = 3 saveData["fl_eite_time"] = time.Now().Unix() EiteDutiesInfoes(scoreFlowInfo.Key, saveData) @@ -112,7 +112,8 @@ func (t *TemplateCardPush) ButtonTemplateCallBackHandleRation(orderId, clickEnte fmt.Printf("2、更新发送信息返回:%v-----------%v----------->%v-----\n", string(callbakcMsg), isTrueCall, callBackCont) } else { userKeyStr := strconv.FormatInt(userContInfo.Key, 10) - evals.UpEvaluationProcessApproval(scoreFlowInfo.Key, 16182159043990656, 0, 2, userKeyStr) + // evals.UpEvaluationProcessApproval(scoreFlowInfo.Key, 16182159043990656, 0, 2, userKeyStr) + commonus.StepAddData(scoreFlowInfo.Key, 16182159043990656, 1, 7, 2, 3, 2, userKeyStr) saveData := commonus.MapOut() saveData["fl_reply"] = 2 saveData["fl_eite_time"] = time.Now().Unix() diff --git a/gin_server_admin/api/wechatapp/callback/updatehandle.go b/gin_server_admin/api/wechatapp/callback/updatehandle.go index af8a5bd..e4beb64 100644 --- a/gin_server_admin/api/wechatapp/callback/updatehandle.go +++ b/gin_server_admin/api/wechatapp/callback/updatehandle.go @@ -26,21 +26,24 @@ func templateEventPush(eventMsg []byte) { fmt.Printf("button======>%v\n", msgContent.EventKey) buttonClick := strings.Split(msgContent.EventKey, "_") + buttonLen := len(buttonClick) + fmt.Printf("Step------ButtionAry------->%v=====>%v\n", buttonClick, buttonLen) + if buttonLen >= 3 { + for i, v := range buttonClick { - if len(buttonClick) >= 3 { - // for i, v := range buttonClick { - - // fmt.Printf("%v====================>%v==================>%v\n", i, v, buttonClick[1]) - // } + fmt.Printf("%v====================>%v==================>%v\n", i, v, buttonClick[1]) + } switch buttonClick[0] { case "duty": //数据考核审批工作 - // fmt.Printf("@@@@\n") + fmt.Printf("@@@@\n") // msgContent.ButtonTemplateCallBackHandle(buttonClick[1], buttonClick[2]) msgContent.ButtonTemplateCallBackHandleBackups(buttonClick[1], buttonClick[2]) case "ration": msgContent.ButtonTemplateCallBackHandleRation(buttonClick[1], buttonClick[2]) default: } + } else { + fmt.Printf("Step------Buttion------->%v\n", buttonClick) } jsonStr, _ := json.Marshal(msgContent) @@ -72,47 +75,55 @@ func sendErrMsg(userKey, orderId, title, cont, DepartmentName, Name, cardJumpUrl @clickEnter 1:同意;2:驳回 */ func (t *TemplateCardPush) ButtonTemplateCallBackHandleBackups(orderId, clickEnter string) { + fmt.Printf("Step------Begin------->\n") //1、获取点击人信息 userContInfoIstrue, userContInfo := commonus.GetUesrContForWechatID(t.FromUsername) if userContInfoIstrue != true { + fmt.Printf("Step------1------->\n") cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderId) jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v", orderId) - sendErrMsg(t.FromUsername, orderId, "此审批流程已经关闭!请联系发起人!", "此审批流程已经关闭!请联系发起人!", userContInfo.DepartmentName, userContInfo.Name, cardJumpUrl, jumpUrl) + sendErrMsg(t.FromUsername, orderId, "此审批流程已经关闭!请联系发起人!", "此审批流程已经关闭!请联系发起人!1", userContInfo.DepartmentName, userContInfo.Name, cardJumpUrl, jumpUrl) return } //2、获取审批单信息 var scoreFlowInfo assessmentmodel.ScoreFlow judegFlowErr := global.GVA_DB_Performanceappraisal.Where("`sf_key` = ?", orderId).First(&scoreFlowInfo).Error if judegFlowErr != nil { + fmt.Printf("Step------2------->%v------>%v\n", orderId, judegFlowErr) cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderId) jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v", orderId) - sendErrMsg(t.FromUsername, orderId, "此审批流程已经关闭!请联系发起人!", "此审批流程已经关闭!请联系发起人!", userContInfo.DepartmentName, userContInfo.Name, cardJumpUrl, jumpUrl) + sendErrMsg(t.FromUsername, orderId, "此审批流程已经关闭!请联系发起人!", "此审批流程已经关闭!请联系发起人!2", userContInfo.DepartmentName, userContInfo.Name, cardJumpUrl, jumpUrl) return } //3、获取审批流程 var evalProc assessmentmodel.EvaluationProcess judgeErr := global.GVA_DB_Performanceappraisal.Where("`ep_order_key` = ?", orderId).First(&evalProc).Error if judgeErr != nil { + fmt.Printf("Step------3------->\n") cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderId) jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v", orderId) - sendErrMsg(t.FromUsername, orderId, "此审批流程已经关闭!请联系发起人!", "此审批流程已经关闭!请联系发起人!", userContInfo.DepartmentName, userContInfo.Name, cardJumpUrl, jumpUrl) + sendErrMsg(t.FromUsername, orderId, "此审批流程已经关闭!请联系发起人!", "此审批流程已经关闭!请联系发起人!3", userContInfo.DepartmentName, userContInfo.Name, cardJumpUrl, jumpUrl) return } + fmt.Printf("Step------3----1--->\n") //解析审批流 var flowLog []evals.FlowStep jsonFlowErr := json.Unmarshal([]byte(evalProc.Content), &flowLog) setpLen := len(flowLog) if jsonFlowErr != nil || setpLen < 1 { + fmt.Printf("Step------4------->\n") cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderId) jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v", orderId) - sendErrMsg(t.FromUsername, orderId, "此审批流程已经关闭!请联系发起人!", "此审批流程已经关闭!请联系发起人!", userContInfo.DepartmentName, userContInfo.Name, cardJumpUrl, jumpUrl) + sendErrMsg(t.FromUsername, orderId, "此审批流程已经关闭!请联系发起人!", "此审批流程已经关闭!请联系发起人!4", userContInfo.DepartmentName, userContInfo.Name, cardJumpUrl, jumpUrl) return } + //得到当前步进值 currentSetp := setpLen - 1 if currentSetp < 0 { currentSetp = 0 } + fmt.Printf("Step------4---1---->%v\n", flowLog[currentSetp].NextStep) //判断通过还是驳回 if clickEnter == "1" { //同意 @@ -120,7 +131,7 @@ func (t *TemplateCardPush) ButtonTemplateCallBackHandleBackups(orderId, clickEnt switch flowLog[currentSetp].NextStep { case 1: orderIdInt, _ := strconv.ParseInt(orderId, 10, 64) - commonus.StepAddData(orderIdInt, 0, 1, 1, strconv.FormatInt(userContInfo.Key, 10)) + commonus.StepAddData(orderIdInt, 0, 1, 1, 1, 1, 1, strconv.FormatInt(userContInfo.Key, 10)) //发起人 taskId := strconv.FormatInt(commonus.GetFileNumberEs(), 10) evaluationPlanStr := strconv.FormatInt(scoreFlowInfo.EvaluationPlan, 10) @@ -138,7 +149,7 @@ func (t *TemplateCardPush) ButtonTemplateCallBackHandleBackups(orderId, clickEnt case 2: //发起人部门负责人 orderIdInt, _ := strconv.ParseInt(orderId, 10, 64) - commonus.StepAddData(orderIdInt, 16182159043990656, 3, 2, strconv.FormatInt(userContInfo.Key, 10)) + commonus.StepAddData(orderIdInt, 16182159043990656, 3, 2, 1, 1, 2, strconv.FormatInt(userContInfo.Key, 10)) //获取发起人部门负责人 sendUserIsTrue, sendUserList := commonus.GetSendMsgUserAry(16182159043990656, userContInfo.DepartmentId) //获取发起人部门负责人 if sendUserIsTrue == true { @@ -157,6 +168,7 @@ func (t *TemplateCardPush) ButtonTemplateCallBackHandleBackups(orderId, clickEnt //1、获取责任部门内勤信息 officWorkUserIsTrue, officWorkUserList := commonus.GetSendMsgUser(16118387069540343, scoreFlowInfo.DutyDepartment) //获取对应部门内勤 if officWorkUserIsTrue != true { + fmt.Printf("Step------5------->\n") cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderId) jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v", orderId) sendErrMsg(t.FromUsername, orderId, "此审批流程已经关闭!请联系发起人!", "此审批流程已经关闭!请联系发起人!", userContInfo.DepartmentName, userContInfo.Name, cardJumpUrl, jumpUrl) @@ -166,6 +178,7 @@ func (t *TemplateCardPush) ButtonTemplateCallBackHandleBackups(orderId, clickEnt var programme assessmentmodel.QualitativeEvaluation judgeProgramme := global.GVA_DB_Performanceappraisal.Where("`qe_id` = ?", scoreFlowInfo.EvaluationPlan).First(&programme).Error if judgeProgramme != nil { + fmt.Printf("Step------6------->\n") cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderId) jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v", orderId) sendErrMsg(t.FromUsername, orderId, "此审批流程已经关闭!请联系发起人!", "此审批流程已经关闭!请联系发起人!", userContInfo.DepartmentName, userContInfo.Name, cardJumpUrl, jumpUrl) @@ -225,7 +238,7 @@ func (t *TemplateCardPush) ButtonTemplateCallBackHandleBackups(orderId, clickEnt //是否需要整改 if scoreFlowInfo.Rectification == 1 { //需要整改 - commonus.StepAddData(orderIdInt, 16182159043990656, 5, 7, strconv.FormatInt(userContInfo.Key, 10)) + //获取主要责任人 var personLiable []string teamBility, teamErr := commonus.GetDivisionOfResponsibility(orderId, 1) @@ -240,6 +253,8 @@ func (t *TemplateCardPush) ButtonTemplateCallBackHandleBackups(orderId, clickEnt fmt.Printf("发送整改通知!没有主要负责人%v\n", teamBility) } sendUserList := strings.Join(personLiable, "|") + + fmt.Printf("Setp-------6----------->%v----------->%v\n", sendUserList, personLiable) //获取考核项目关联项目 targettitle, detailedRulesTitle, detailedRulesInfo, unit, flowContent, _ := commonus.GetDutyAssociatedItems(orderId) //一级文本处理 @@ -272,9 +287,10 @@ func (t *TemplateCardPush) ButtonTemplateCallBackHandleBackups(orderId, clickEnt sourceDesc := "整改通知" var sendTextMsg sendmessage.TextNoticeTemplateMedium sendTextMsg.SendMsgTextShare(sendUserList, taskId, title, desc, quoteAreaTitle, quoteAreaContent, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, cardJumpUrl, jumpUrl, jumpUrlTitle, sourceDesc) + commonus.StepAddData(orderIdInt, 16182159043990656, 5, 7, 1, 1, 4, strconv.FormatInt(userContInfo.Key, 10)) } else { //不需要整改 - commonus.StepAddData(orderIdInt, 16182159043990656, 7, 7, strconv.FormatInt(userContInfo.Key, 10)) + //获取发起人信息 var sendUser string = "" faQiRen, _ := commonus.GetWorkUser(strconv.FormatInt(scoreFlowInfo.EvaluationUser, 10)) @@ -338,13 +354,14 @@ func (t *TemplateCardPush) ButtonTemplateCallBackHandleBackups(orderId, clickEnt buttonMap = append(buttonMap, buttonCont) var sendTextMsg sendmessage.ButtonNoticeTemplateMedium sendTextMsg.SendButtonShare(sendUser, taskId, "验收", title, desc, subtitle, reason, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, cardJumpUrl, buttonMap) + commonus.StepAddData(orderIdInt, 16182159043990656, 7, 7, 1, 1, 4, strconv.FormatInt(userContInfo.Key, 10)) } case 5: //主要责任人整改 case 6: //责任部门审批(部门负责人) orderIdInt, _ := strconv.ParseInt(orderId, 10, 64) //流程Key - commonus.StepAddData(orderIdInt, 16182159043990656, 7, 7, strconv.FormatInt(userContInfo.Key, 10)) + commonus.StepAddData(orderIdInt, 16182159043990656, 7, 7, 1, 1, 6, strconv.FormatInt(userContInfo.Key, 10)) sendButtonIsTrue, sendButtonList := commonus.GetSendMsgUserAry(16182159043990656, userContInfo.DepartmentId) //获取发起人部门负责人 if sendButtonIsTrue == true { buttonClickNAmeOtherEs := fmt.Sprintf("%v%v", userContInfo.Name, "已批准") @@ -445,6 +462,7 @@ func (t *TemplateCardPush) ButtonTemplateCallBackHandleBackups(orderId, clickEnt sendUserAry = append(sendUserAry, dutyOff_v) } } + commonus.StepAddData(scoreFlowInfo.Id, 0, 0, 1, 1, 2, 7, strconv.FormatInt(userContInfo.Key, 10)) sendMsgToUserList := strings.Join(sendUserAry, "|") taskId := strconv.FormatInt(commonus.GetFileNumberEs(), 10) @@ -503,7 +521,7 @@ func (t *TemplateCardPush) ButtonTemplateCallBackHandleBackups(orderId, clickEnt case 2: //发起人部门负责人 orderIdInt, _ := strconv.ParseInt(orderId, 10, 64) //流程Key - commonus.StepAddData(orderIdInt, 16182159043990656, 1, 2, strconv.FormatInt(userContInfo.Key, 10)) + commonus.StepAddData(orderIdInt, 16182159043990656, 1, 2, 1, 3, 2, strconv.FormatInt(userContInfo.Key, 10)) sendButtonIsTrue, sendButtonList := commonus.GetSendMsgUserAry(16182159043990656, userContInfo.DepartmentId) //获取发起人部门负责人 if sendButtonIsTrue == true { buttonClickNAmeOtherEs := fmt.Sprintf("%v%v", userContInfo.Name, "已驳回") @@ -563,7 +581,7 @@ func (t *TemplateCardPush) ButtonTemplateCallBackHandleBackups(orderId, clickEnt } //退回到本部门内勤 orderIdInt, _ := strconv.ParseInt(orderId, 10, 64) //流程Key - commonus.StepAddData(orderIdInt, 16182159043990656, 3, 7, strconv.FormatInt(userContInfo.Key, 10)) + commonus.StepAddData(orderIdInt, 16182159043990656, 3, 7, 1, 3, 4, strconv.FormatInt(userContInfo.Key, 10)) //1、获取本部门内勤 _, butCallBackUser := commonus.GetSendMsgUser(16118387069540343, userContInfo.DepartmentId) //获取对应部门内勤(高科) //获取考核项目关联项目 @@ -618,7 +636,7 @@ func (t *TemplateCardPush) ButtonTemplateCallBackHandleBackups(orderId, clickEnt } //退回到主要责任人 orderIdInt, _ := strconv.ParseInt(orderId, 10, 64) //流程Key - commonus.StepAddData(orderIdInt, 16182159043990656, 5, 7, strconv.FormatInt(userContInfo.Key, 10)) + commonus.StepAddData(orderIdInt, 16182159043990656, 5, 7, 1, 3, 6, strconv.FormatInt(userContInfo.Key, 10)) //获取主要责任人 var personLiable []string teamBility, teamErr := commonus.GetDivisionOfResponsibility(orderId, 1) @@ -688,7 +706,7 @@ func (t *TemplateCardPush) ButtonTemplateCallBackHandleBackups(orderId, clickEnt //是否需要整改 if scoreFlowInfo.Rectification == 1 { //存在整改 - commonus.StepAddData(orderIdInt, 0, 5, 5, strconv.FormatInt(userContInfo.Key, 10)) + commonus.StepAddData(orderIdInt, 0, 5, 5, 1, 3, 7, strconv.FormatInt(userContInfo.Key, 10)) //获取主要责任人 var personLiable []string teamBility, teamErr := commonus.GetDivisionOfResponsibility(orderId, 1) @@ -752,7 +770,7 @@ func (t *TemplateCardPush) ButtonTemplateCallBackHandleBackups(orderId, clickEnt sendTextMsg.SendMsgTextShare(sendUserList, taskId, title, desc, mainTitleDesc, reason, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, cardJumpUrl, jumpUrl, jumpUrlTitle, sourceDesc) } else { //不需要整改 - commonus.StepAddData(orderIdInt, 0, 3, 5, strconv.FormatInt(userContInfo.Key, 10)) + commonus.StepAddData(orderIdInt, 0, 3, 5, 1, 3, 7, strconv.FormatInt(userContInfo.Key, 10)) //2.3、获取职责部门内勤 _, dutyOffUserList := commonus.GetSendMsgUserAry(16118387069540343, scoreFlowInfo.DutyDepartment) //获取职责部门内勤 //获取考核项目关联项目 diff --git a/gin_server_admin/commonus/publichaneld.go b/gin_server_admin/commonus/publichaneld.go index 3504373..3ed6f73 100644 --- a/gin_server_admin/commonus/publichaneld.go +++ b/gin_server_admin/commonus/publichaneld.go @@ -1046,7 +1046,7 @@ func AddDimenTargetWeight(setType, group, departmentID, dimensionId, targetId in var weightSum int64 = 0 // fmt.Printf("1-----@---2------->%v\n", targetId) if targetId != 0 { - weghtErr := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Where("`qe_group` = ? AND `qe_accept_evaluation` = ? AND `qe_dimension` = ? AND `qe_target` = ?", group, departmentID, dimensionId, targetId).Pluck("COALESCE(SUM(qe_reference_score), 0) as qe_reference_score", &weightSum).Error + weghtErr := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Where("`qe_state` = 1 AND `qe_group` = ? AND `qe_accept_evaluation` = ? AND `qe_dimension` = ? AND `qe_target` = ?", group, departmentID, dimensionId, targetId).Pluck("COALESCE(SUM(qe_reference_score), 0) as qe_reference_score", &weightSum).Error // msg = fmt.Sprintf("1-----@---1------->%v\n", weightSum) if weghtErr == nil { @@ -1097,7 +1097,7 @@ func AddDimensionWeight(setType, group, departmentID, dimensionId int64) { var weightSum int64 = 0 fmt.Printf("1-------@-------->%v\n", departmentID) if dimensionId != 0 { - weghtErr := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Where("`qe_group` = ? AND `qe_accept_evaluation` = ? AND `qe_dimension` = ?", group, departmentID, dimensionId).Pluck("COALESCE(SUM(qe_reference_score), 0) as qe_reference_score", &weightSum).Error + weghtErr := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Where("`qe_state` = 1 AND `qe_group` = ? AND `qe_accept_evaluation` = ? AND `qe_dimension` = ?", group, departmentID, dimensionId).Pluck("COALESCE(SUM(qe_reference_score), 0) as qe_reference_score", &weightSum).Error if weghtErr == nil { var ddwCont assessmentmodel.DepartmentDimensionWeight judgeTrue := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.DepartmentDimensionWeight{}).Select("ddw_id").Where("`ddw_hierarchy` = 1 AND `ddw_group` = ? AND `ddw_derpatment` = ? AND `ddw_dimension` = ?", group, departmentID, dimensionId).First(&ddwCont).Error @@ -1357,6 +1357,25 @@ func GetWorkUser(key string) (userCont testpage.PersonalDetails, isTrue bool) { if userErr == nil { isTrue = true } + iconUrl := "" + if userCont.Icon == "" { + if userCont.WechatId != "" { + wechatInfo, wechatErr := GetWorkWechatDuiZhao(userCont.WechatId) + if wechatErr == true { + iconUrl = wechatInfo.Avatar + userCont.Icon = iconUrl + } + } + if userCont.WorkWechatId != "" { + if iconUrl == "" { + wechatWorkInfo, wechatWorkErr := GetWorkWechatDuiZhao(userCont.WorkWechatId) + if wechatWorkErr == true { + iconUrl = wechatWorkInfo.Avatar + userCont.Icon = iconUrl + } + } + } + } return } @@ -1405,10 +1424,16 @@ func GetWorkWechatDuiZhao(openid string) (userInfoStruct wechat.WechatUsers, isT @userKey 操作人key @roleGroupId 角色组Id @stepName 步骤名称 +@typeclass 1、定性;2、定量 +@state 状态 @stepInt 当前是第几部 +@recStrat 是否改正 @nextStep 下一步 */ -func StepAddData(flowID, roleGroupId int64, nextStep, stepName int, userKey string) { +func StepAddData(flowID, roleGroupId int64, nextStep, stepName, typeclass, state, stepInt int, userKey string) { + if state < 1 { + state = 1 + } var evalProCont assessmentmodel.EvaluationProcess judgeErr := global.GVA_DB_Performanceappraisal.Where("`ep_order_key` = ?", flowID).First(&evalProCont).Error var flowStepAryMap []FlowStep @@ -1423,6 +1448,20 @@ func StepAddData(flowID, roleGroupId int64, nextStep, stepName int, userKey stri flowSteping.ClickName = userKey //操作人 flowSteping.AddTime = time.Now().Unix() //添加时间 flowStepAryMap = append(flowStepAryMap, flowSteping) + + evalProCont.OrderKey = flowID + evalProCont.Step = 1 + evalProCont.State = state + evalProCont.TypeClass = typeclass + evalProCont.Time = time.Now().Unix() + evalProCont.RoleGroup = roleGroupId + flowStepJson, flowStepErr := json.Marshal(flowStepAryMap) + if flowStepErr == nil { + evalProCont.Content = string(flowStepJson) + } + evalProCont.Participants = userKey + evalProCont.NextContent = IntegrationFlowAll(flowID, typeclass) + global.GVA_DB_Performanceappraisal.Create(&evalProCont) } else { var flowStepAry []FlowStep var flowStepArys []FlowStep @@ -1452,10 +1491,403 @@ func StepAddData(flowID, roleGroupId int64, nextStep, stepName int, userKey stri if flowStepErr == nil { saveData["ep_cont"] = string(flowStepJson) } + saveData["ep_participants"] = fmt.Sprintf("%v,%v", evalProCont.Participants, userKey) + saveData["ep_state"] = state + saveData["ep_next_cont"] = InsetFlowLog(state, stepInt, userKey, evalProCont.NextContent) EiteDutiesInfoes(evalProCont.Id, saveData) } } +//流程操作解析 +/* +@state 状态 +@stepInt 当前是第几部 +@recStrat 是否改正 +@userKey 操作人key +@flowMapStr 流程图字符串 +*/ +func InsetFlowLog(state, stepInt int, userKey, flowMapStr string) (flowAllMap string) { + var flowMap []FlowAllMap + jsonErr := json.Unmarshal([]byte(flowMapStr), flowMap) + if jsonErr != nil { + flowAllMap = flowMapStr + return + } + var eiteFlowMap []FlowAllMap + for _, v := range flowMap { + var eiteFlowInfo FlowAllMap + eiteFlowInfo.Step = v.Step + eiteFlowInfo.NodeName = v.NodeName + if v.Step < stepInt { + eiteFlowInfo.State = 2 + } else if v.Step == stepInt { + eiteFlowInfo.State = v.State + } else { + eiteFlowInfo.State = 1 + } + + eiteFlowInfo.Class = v.Class + if v.Step == stepInt { + var userClickAry []UserListFlowAll + for _, u_v := range v.UserList { + var userClick UserListFlowAll + userClick.Id = u_v.Id + userClick.Name = u_v.Name + userClick.Icon = u_v.Icon + userClick.Wechat = u_v.Wechat + userClick.Group = u_v.Group + userClick.GroupName = u_v.GroupName + userClick.DepartmentId = u_v.DepartmentId + userClick.DepartmentName = u_v.DepartmentName + userClick.WorkshopId = u_v.WorkshopId + userClick.WorkshopName = u_v.WorkshopName + userClick.PostId = u_v.PostId + userClick.PostName = u_v.PostName + userClick.Tema = u_v.Tema + userClick.TemaName = u_v.TemaName + userClick.Wechat = u_v.Wechat + if u_v.Id == userKey { + var logListMap LogList + logListMap.State = state + logListMap.TimeVal = GetToDayAll() + userClick.LogList = append(userClick.LogList, logListMap) + } + + userClickAry = append(userClickAry, userClick) + } + eiteFlowInfo.UserList = userClickAry + } else { + eiteFlowInfo.UserList = v.UserList + } + eiteFlowMap = append(eiteFlowMap, eiteFlowInfo) + } + jsonStr, jsonErrSet := json.Marshal(eiteFlowMap) + if jsonErrSet == nil { + flowAllMap = string(jsonStr) + } + return +} + +//写入责任分配节点人员信息 +func WriteFlowMainSet(orderId int64, userKey []int64) { + if len(userKey) < 1 { + return + } + var evalProCont assessmentmodel.EvaluationProcess + judgeErr := global.GVA_DB_Performanceappraisal.Where("`ep_order_key` = ?", orderId).First(&evalProCont).Error + if judgeErr != nil { + return + } + flowAllMapOldStr := evalProCont.NextContent + var flowMap []FlowAllMap + jsonErr := json.Unmarshal([]byte(evalProCont.NextContent), flowMap) + if jsonErr != nil { + return + } + var eiteFlowMap []FlowAllMap + for _, v := range flowMap { + var eiteFlowInfo FlowAllMap + eiteFlowInfo.Step = v.Step + eiteFlowInfo.NodeName = v.NodeName + eiteFlowInfo.State = v.State + eiteFlowInfo.Class = v.Class + if v.Step == 5 { + var userClickAry []UserListFlowAll + for _, u_v := range userKey { + _, userCont := GetUesrContForWechatID(strconv.FormatInt(u_v, 10)) + var returnUser UserListFlowAll + returnUser.Id = strconv.FormatInt(userCont.Key, 10) + returnUser.Name = userCont.Name + returnUser.Icon = userCont.Icon + returnUser.Group = userCont.Group + _, groupCont := GetGroupCont(userCont.Group) + returnUser.GroupName = groupCont.Name + returnUser.DepartmentId = userCont.DepartmentId + returnUser.DepartmentName = userCont.DepartmentName + returnUser.WorkshopId = userCont.WorkshopId + returnUser.WorkshopName = userCont.WorkshopName + returnUser.PostId = userCont.PostId + returnUser.PostName = userCont.PostName + returnUser.Tema = userCont.Tema + returnUser.TemaName = userCont.TemaName + + returnUser.Wechat = userCont.WechatId + + userClickAry = append(userClickAry, returnUser) + } + eiteFlowInfo.UserList = userClickAry + } else { + eiteFlowInfo.UserList = v.UserList + } + eiteFlowMap = append(eiteFlowMap, eiteFlowInfo) + } + jsonStr, jsonErrSet := json.Marshal(eiteFlowMap) + + if jsonErrSet == nil { + flowAllMapOldStr = string(jsonStr) + } + saveEiteData := MapOut() + saveEiteData["ep_time"] = time.Now().Unix() + saveEiteData["ep_next_cont"] = flowAllMapOldStr + EiteDutiesInfoes(evalProCont.Id, saveEiteData) +} + +//组合流程图全面 +/* +@class 流程类型 +*/ +func IntegrationFlowAll(flowID int64, class int) (flowAllMap string) { + var flowMap []FlowAllMap + //1、创建 + var oneFlowInfo FlowAllMap + oneFlowInfo.Step = 1 + oneFlowInfo.NodeName = GetSetpName(1) + oneFlowInfo.State = 2 + oneFlowInfo.Class = 1 + oneFlowInfo.UserList = GetFlowNodeMan(flowID, class, 1) + flowMap = append(flowMap, oneFlowInfo) + if class == 1 { + + var scoreFlowCont assessmentmodel.ScoreFlow + flowLogErr := global.GVA_DB_Performanceappraisal.Where("sf_key = ?", flowID).First(&scoreFlowCont).Error + if flowLogErr == nil { + //2、创建人部门负责人审核 + var twoFlowInfo FlowAllMap + twoFlowInfo.Step = 2 + twoFlowInfo.NodeName = GetSetpName(2) + twoFlowInfo.State = 1 + twoFlowInfo.Class = 1 + twoFlowInfo.UserList = GetFlowNodeMan(flowID, class, 3) + flowMap = append(flowMap, twoFlowInfo) + //3、被考核部门内勤进行责任划分 + var threeFlowInfo FlowAllMap + threeFlowInfo.Step = 3 + threeFlowInfo.NodeName = GetSetpName(3) + threeFlowInfo.State = 1 + threeFlowInfo.Class = 1 + threeFlowInfo.UserList = GetFlowNodeMan(flowID, class, 4) + flowMap = append(flowMap, threeFlowInfo) + //4、被考核部门负责人对责任划分确认 + var fourFlowInfo FlowAllMap + fourFlowInfo.Step = 4 + fourFlowInfo.NodeName = GetSetpName(7) + fourFlowInfo.State = 1 + fourFlowInfo.Class = 1 + fourFlowInfo.UserList = GetFlowNodeMan(flowID, class, 5) + flowMap = append(flowMap, fourFlowInfo) + if scoreFlowCont.Rectification == 1 { + //5、整改人节点。由内勤指定 + var fiveFlowInfo FlowAllMap + fiveFlowInfo.Step = 5 + fiveFlowInfo.NodeName = GetSetpName(4) + fiveFlowInfo.State = 1 + fiveFlowInfo.Class = 2 + // fiveFlowInfo.UserList = GetFlowNodeMan(flowID, class, 5) + flowMap = append(flowMap, fiveFlowInfo) + //6、被考核部门负责人对整改措施确认 + var sixFlowInfo FlowAllMap + sixFlowInfo.Step = 6 + sixFlowInfo.NodeName = GetSetpName(7) + sixFlowInfo.State = 1 + sixFlowInfo.Class = 1 + sixFlowInfo.UserList = GetFlowNodeMan(flowID, class, 5) + flowMap = append(flowMap, sixFlowInfo) + //7、发起人验收 + var serverFlowInfo FlowAllMap + serverFlowInfo.Step = 7 + serverFlowInfo.NodeName = GetSetpName(5) + serverFlowInfo.State = 1 + serverFlowInfo.Class = 1 + serverFlowInfo.UserList = GetFlowNodeMan(flowID, class, 1) + flowMap = append(flowMap, serverFlowInfo) + } else { + //5、发起人验收 + var serverEsFlowInfo FlowAllMap + serverEsFlowInfo.Step = 5 + serverEsFlowInfo.NodeName = GetSetpName(5) + serverEsFlowInfo.State = 1 + serverEsFlowInfo.Class = 1 + serverEsFlowInfo.UserList = GetFlowNodeMan(flowID, class, 1) + flowMap = append(flowMap, serverEsFlowInfo) + } + + } + + } else { + //定量 + //1、创建 + var twoFlowInfo FlowAllMap + twoFlowInfo.Step = 2 + twoFlowInfo.NodeName = GetSetpName(7) + twoFlowInfo.State = 1 + twoFlowInfo.Class = 1 + twoFlowInfo.UserList = GetFlowNodeMan(flowID, class, 5) + flowMap = append(flowMap, twoFlowInfo) + } + flowAllMapByte, eer := json.Marshal(flowMap) + if eer == nil { + flowAllMap = string(flowAllMapByte) + } + return +} + +//获取节点操作人 +/* +@flowID 流程ID +@class 1、定性;2、定量 +@style 1、测评人;2,测评人部门内勤;3、测评人部门负责人;4、被测评部门内勤;5、被测评部门负责人 +*/ +func GetFlowNodeMan(flowID int64, class, style int) (manInfo []UserListFlowAll) { + var goDu FlowNodePeopleInfo + if class == 1 { + var scoreFlowCont assessmentmodel.ScoreFlow + flowLogErr := global.GVA_DB_Performanceappraisal.Where("sf_key = ?", flowID).First(&scoreFlowCont).Error + if flowLogErr == nil { + goDu.EvalCont.Group = scoreFlowCont.EvaluationGroup + goDu.EvalCont.DepartmentId = scoreFlowCont.EvaluationDepartment + goDu.EvalCont.Id = strconv.FormatInt(scoreFlowCont.EvaluationUser, 10) + + goDu.DutyCont.Group = scoreFlowCont.DutyGroup + goDu.DutyCont.DepartmentId = scoreFlowCont.DutyDepartment + } + } else { + var flowCont assessmentmodel.FlowLog + flowLogErrs := global.GVA_DB_Performanceappraisal.Where("fl_key = ?", flowID).First(&flowCont).Error + if flowLogErrs == nil { + goDu.EvalCont.Group = flowCont.EvaluationGroup + goDu.EvalCont.DepartmentId = flowCont.EvaluationDepartment + goDu.EvalCont.Id = strconv.FormatInt(flowCont.EvaluationUser, 10) + + goDu.DutyCont.Group = flowCont.DutyGroup + goDu.DutyCont.DepartmentId = flowCont.DutyDepartment + } + } + //1、测评人;2,测评人部门内勤;3、测评人部门负责人;4、被测评部门内勤;5、被测评部门负责人 + switch style { + case 2: + sendUserIsTrue, sendUserList := GetSendMsgUserAry(16118387069540343, goDu.EvalCont.DepartmentId) + if sendUserIsTrue == true { + for _, v := range sendUserList { + _, userCont := GetUesrContForWechatID(v) + var returnUser UserListFlowAll + returnUser.Id = strconv.FormatInt(userCont.Key, 10) + returnUser.Name = userCont.Name + returnUser.Icon = userCont.Icon + returnUser.Group = userCont.Group + _, groupCont := GetGroupCont(userCont.Group) + returnUser.GroupName = groupCont.Name + returnUser.DepartmentId = userCont.DepartmentId + returnUser.DepartmentName = userCont.DepartmentName + returnUser.WorkshopId = userCont.WorkshopId + returnUser.WorkshopName = userCont.WorkshopName + returnUser.PostId = userCont.PostId + returnUser.PostName = userCont.PostName + returnUser.Tema = userCont.Tema + returnUser.TemaName = userCont.TemaName + returnUser.Wechat = userCont.WechatId + manInfo = append(manInfo, returnUser) + } + } + case 3: + sendUserIsTrue, sendUserList := GetSendMsgUserAry(16182159043990656, goDu.EvalCont.DepartmentId) + if sendUserIsTrue == true { + for _, v := range sendUserList { + _, userCont := GetUesrContForWechatID(v) + var returnUser UserListFlowAll + returnUser.Id = strconv.FormatInt(userCont.Key, 10) + returnUser.Name = userCont.Name + returnUser.Icon = userCont.Icon + returnUser.Group = userCont.Group + _, groupCont := GetGroupCont(userCont.Group) + returnUser.GroupName = groupCont.Name + returnUser.DepartmentId = userCont.DepartmentId + returnUser.DepartmentName = userCont.DepartmentName + returnUser.WorkshopId = userCont.WorkshopId + returnUser.WorkshopName = userCont.WorkshopName + returnUser.PostId = userCont.PostId + returnUser.PostName = userCont.PostName + returnUser.Tema = userCont.Tema + returnUser.TemaName = userCont.TemaName + returnUser.Wechat = userCont.WechatId + manInfo = append(manInfo, returnUser) + } + } + case 4: + sendUserIsTrue, sendUserList := GetSendMsgUserAry(16118387069540343, goDu.DutyCont.DepartmentId) + if sendUserIsTrue == true { + for _, v := range sendUserList { + _, userCont := GetUesrContForWechatID(v) + var returnUser UserListFlowAll + returnUser.Id = strconv.FormatInt(userCont.Key, 10) + returnUser.Name = userCont.Name + returnUser.Icon = userCont.Icon + returnUser.Group = userCont.Group + _, groupCont := GetGroupCont(userCont.Group) + returnUser.GroupName = groupCont.Name + returnUser.DepartmentId = userCont.DepartmentId + returnUser.DepartmentName = userCont.DepartmentName + returnUser.WorkshopId = userCont.WorkshopId + returnUser.WorkshopName = userCont.WorkshopName + returnUser.PostId = userCont.PostId + returnUser.PostName = userCont.PostName + returnUser.Tema = userCont.Tema + returnUser.TemaName = userCont.TemaName + returnUser.Wechat = userCont.WechatId + manInfo = append(manInfo, returnUser) + } + } + case 5: + sendUserIsTrue, sendUserList := GetSendMsgUserAry(16182159043990656, goDu.DutyCont.DepartmentId) + if sendUserIsTrue == true { + for _, v := range sendUserList { + _, userCont := GetUesrContForWechatID(v) + var returnUser UserListFlowAll + returnUser.Id = strconv.FormatInt(userCont.Key, 10) + returnUser.Name = userCont.Name + returnUser.Icon = userCont.Icon + returnUser.Group = userCont.Group + _, groupCont := GetGroupCont(userCont.Group) + returnUser.GroupName = groupCont.Name + returnUser.DepartmentId = userCont.DepartmentId + returnUser.DepartmentName = userCont.DepartmentName + returnUser.WorkshopId = userCont.WorkshopId + returnUser.WorkshopName = userCont.WorkshopName + returnUser.PostId = userCont.PostId + returnUser.PostName = userCont.PostName + returnUser.Tema = userCont.Tema + returnUser.TemaName = userCont.TemaName + returnUser.Wechat = userCont.WechatId + manInfo = append(manInfo, returnUser) + } + } + default: + var returnUser UserListFlowAll + userCont, _ := GetWorkUser(goDu.EvalCont.Id) + returnUser.Id = goDu.EvalCont.Id + returnUser.Name = userCont.Name + returnUser.Icon = userCont.Icon + returnUser.Group = userCont.Group + _, groupCont := GetGroupCont(userCont.Group) + returnUser.GroupName = groupCont.Name + returnUser.DepartmentId = userCont.DepartmentId + _, bfInfo := GetBranchFactory(userCont.DepartmentId) + returnUser.DepartmentName = bfInfo.Name + returnUser.WorkshopId = userCont.WorkshopId + _, wsInfo := GetWorkShopSection(userCont.WorkshopId) + returnUser.WorkshopName = wsInfo.Name + returnUser.PostId = userCont.PostId + _, posCont := GetPosition(userCont.PostId) + returnUser.PostName = posCont.Name + returnUser.Tema = userCont.Tema + _, temCont := GetTeaming(userCont.Tema) + returnUser.TemaName = temCont.Name + returnUser.Wechat = userCont.WechatId + manInfo = append(manInfo, returnUser) + } + + return +} + //编辑流程步进器 func EiteDutiesInfoes(saveId int64, saveData map[string]interface{}) (isTrue bool, infoErr error) { isTrue = false @@ -1561,15 +1993,28 @@ func GetDivisionOfResponsibility(orderId string, class int) (contList []map[stri } cont["weight"] = v.Weight cont["userkey"] = v.UserKey + //获取人员信息 + userCont, userContErr := GetWorkUser(strconv.FormatInt(v.UserKey, 10)) + cont["wechatid"] = "" if v.UserName != "" { cont["username"] = v.UserName + if userContErr == true { + if userCont.WechatId != "" { + cont["wechatid"] = userCont.WechatId + } + if userCont.WorkWechatId != "" { + cont["wechatid"] = userCont.WorkWechatId + } + } } else { - //获取人员信息 - userCont, userContErr := GetWorkUser(strconv.FormatInt(v.UserKey, 10)) if userContErr == true { cont["username"] = userCont.Name - } else { - cont["username"] = v.UserName + if userCont.WechatId != "" { + cont["wechatid"] = userCont.WechatId + } + if userCont.WorkWechatId != "" { + cont["wechatid"] = userCont.WorkWechatId + } } } cont["groupid"] = v.Group @@ -1624,15 +2069,28 @@ func GetDivisionOfResponsibility(orderId string, class int) (contList []map[stri } cont["weight"] = v.Weight cont["userkey"] = v.UserKey + //获取人员信息 + userCont, userContErr := GetWorkUser(strconv.FormatInt(v.UserKey, 10)) + cont["wechatid"] = "" if v.UserName != "" { cont["username"] = v.UserName + if userContErr == true { + if userCont.WechatId != "" { + cont["wechatid"] = userCont.WechatId + } + if userCont.WorkWechatId != "" { + cont["wechatid"] = userCont.WorkWechatId + } + } } else { - //获取人员信息 - userCont, userContErr := GetWorkUser(strconv.FormatInt(v.UserKey, 10)) if userContErr == true { cont["username"] = userCont.Name - } else { - cont["username"] = v.UserName + if userCont.WechatId != "" { + cont["wechatid"] = userCont.WechatId + } + if userCont.WorkWechatId != "" { + cont["wechatid"] = userCont.WorkWechatId + } } } cont["groupid"] = v.Group @@ -1737,3 +2195,58 @@ func GetDivisionOfResponsibility(orderId string, class int) (contList []map[stri } return } + +//判断是否存在 +func IsItTrue(id int64, idAry []int64) (isTrue bool) { + isTrue = false + for _, v := range idAry { + if v == id { + return true + } + } + return +} + +func IsItTrueString(id string, idAry []string) (isTrue bool) { + isTrue = false + for _, v := range idAry { + if v == id { + return true + } + } + return +} + +//获取多部门归属集团 +func GetDuboDepart(departAry []string) (group []string) { + for _, v := range departAry { + departID, _ := strconv.ParseInt(v, 10, 64) + isTrue, bfInfo := GetBranchFactory(departID) + if isTrue == true { + bfGetID := strconv.FormatInt(bfInfo.Group, 10) + if IsItTrueString(bfGetID, group) == false { + group = append(group, bfGetID) + } + } + } + return +} + +//批量获取相关人员部门id +func GetDepartmentByUserBast(userKey []string) (userDepartmentId []string) { + if len(userKey) < 1 { + return + } + var usDepartId []int64 + usDepartErr := global.GVA_DB_Master.Model(&testpage.WorkMan{}).Select("wm_bf_id").Where("`wm_key` IN ?", userKey).Group("wm_bf_id").Find(&usDepartId).Error + if usDepartErr != nil { + return + } + if len(usDepartId) < 1 { + return + } + for _, v := range usDepartId { + userDepartmentId = append(userDepartmentId, strconv.FormatInt(v, 10)) + } + return +} diff --git a/gin_server_admin/commonus/publicstruct.go b/gin_server_admin/commonus/publicstruct.go index 676f8f0..3fcfc24 100644 --- a/gin_server_admin/commonus/publicstruct.go +++ b/gin_server_admin/commonus/publicstruct.go @@ -85,3 +85,43 @@ type FlowStep struct { StepName string `json:"stepname"` //步骤名称 NextStep int `json:"nextstep"` //下一步 1:内勤;2:部门负责人:3:整改;4:整改后部门负责;5:归档起草人 } + +//流程全貌 +type FlowAllMap struct { + Step int `json:"step"` //步伐 + NodeName string `json:"nodename"` //节点名称 + State int `json:"state"` //状态 1、不点亮;2、点亮 + Class int `json:"class"` //节点类型 1、普通节点;2、运行中指定节点 + UserList []UserListFlowAll `json:"userlist"` //节点操作人 +} + +//节点操作人 +type UserListFlowAll struct { + Id string `json:"id"` //操作人ID + Name string `json:"name"` //操作人姓名 + Icon string `json:"icon"` //操作人头像 + Wechat string `json:"wechat"` //微信Openid + Group int64 `json:"group"` //集团公司 + GroupName string `json:"groupname"` //分厂名称 + DepartmentId int64 `json:"departmentid"` //分厂Id + DepartmentName string `json:"departmentname"` //分厂名称 + WorkshopId int64 `json:"workshopid"` //工段Id + WorkshopName string `json:"workshopname"` //工段名称 + PostId int64 `json:"postid"` //职务Id + PostName string `json:"postname"` //职务名称 + Tema int64 `json:"tema"` //班组Id + TemaName string `json:"temaname"` //班组名称 + LogList []LogList `json:"log"` //操作记录 +} + +//节点操作人操作记录 +type LogList struct { + State int `json:"state"` //状态 1、未操作;2、通过;3、驳回 + TimeVal string `json:"time"` +} + +//流程操作节点操作人信息 +type FlowNodePeopleInfo struct { + EvalCont UserListFlowAll `json:"evalcont"` + DutyCont UserListFlowAll `json:"dutycont"` +} diff --git a/gin_server_admin/commonus/timeSub.go b/gin_server_admin/commonus/timeSub.go index df97a52..890ec0f 100644 --- a/gin_server_admin/commonus/timeSub.go +++ b/gin_server_admin/commonus/timeSub.go @@ -96,6 +96,11 @@ func GetToDay() (yesterday string) { yesTime := now.AddDate(0, 0, 0).Format("2006-01-02") // 获取昨天的时间 return yesTime } +func GetToDayAll() (yesterday string) { + now := time.Now() + yesTime := now.AddDate(0, 0, 0).Format("2006-01-02 15:04:05") // 获取昨天的时间 + return yesTime +} /* 获取昨天时间 diff --git a/gin_server_admin/model/assessmentmodel/performance_appraisal.go b/gin_server_admin/model/assessmentmodel/performance_appraisal.go index dba6c7e..2b78d72 100644 --- a/gin_server_admin/model/assessmentmodel/performance_appraisal.go +++ b/gin_server_admin/model/assessmentmodel/performance_appraisal.go @@ -55,14 +55,16 @@ func (DivisionResponsibilities *DivisionResponsibilities) TableName() string { //流程步进器 type EvaluationProcess struct { - Id int64 `json:"id" gorm:"primaryKey;column:ep_id;type:bigint(20) unsigned;not null"` - OrderKey int64 `json:"orderkey" gorm:"column:ep_order_key;type:bigint(20) unsigned;default:0;not null;comment:发起表单key"` - Step int `json:"step" gorm:"column:ep_step;type:int(7) unsigned;default:1;not null;comment:当前执行到第几部"` - Content string `json:"content" gorm:"column:ep_cont;type:longtext;comment:流程步进值"` - NextContent string `json:"nextcontent" gorm:"column:ep_next_cont;type:mediumtext;comment:下一步内容"` - Time int64 `json:"time" gorm:"column:ep_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` - State int `json:"state" gorm:"column:ep_state;type:int(2) unsigned;default:1;not null;comment:状态(1:正常,2:禁用;3:废弃;4:删除)"` - RoleGroup int64 `json:"rolegroup" gorm:"column:ep_role_group;type:bigint(20) unsigned;default:0;not null;comment:角色组"` + Id int64 `json:"id" gorm:"primaryKey;column:ep_id;type:bigint(20) unsigned;not null"` + OrderKey int64 `json:"orderkey" gorm:"column:ep_order_key;type:bigint(20) unsigned;default:0;not null;comment:发起表单key"` + Step int `json:"step" gorm:"column:ep_step;type:int(7) unsigned;default:1;not null;comment:当前执行到第几部"` + Content string `json:"content" gorm:"column:ep_cont;type:longtext;comment:流程步进值"` + NextContent string `json:"nextcontent" gorm:"column:ep_next_cont;type:mediumtext;comment:下一步内容"` + Time int64 `json:"time" gorm:"column:ep_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` + State int `json:"state" gorm:"column:ep_state;type:int(2) unsigned;default:1;not null;comment:1:审批,2:通过;3:驳回;"` + RoleGroup int64 `json:"rolegroup" gorm:"column:ep_role_group;type:bigint(20) unsigned;default:0;not null;comment:角色组"` + TypeClass int `json:"type" gorm:"column:ep_type;type:tinyint(1) unsigned;default:1;not null;comment:1、定性;2、定量"` + Participants string `json:"participants" gorm:"column:ep_participants;type:mediumtext;comment:参与人"` } func (EvaluationProcess *EvaluationProcess) TableName() string { diff --git a/gin_server_admin/router/assessment/assessmentrouter.go b/gin_server_admin/router/assessment/assessmentrouter.go index 7adb848..87dc90a 100644 --- a/gin_server_admin/router/assessment/assessmentrouter.go +++ b/gin_server_admin/router/assessment/assessmentrouter.go @@ -189,7 +189,9 @@ func (s *AssessmentRouter) InitEvaluationRouter(Router *gin.RouterGroup) { dutyIndexCodeRouter.POST("additionandsubtractionscore", authorityIndexApi.AdditionAndSubtractionScore) // 加减分 dutyIndexCodeRouter.POST("plusorminuspoints", authorityIndexApi.PlusOrMinusPoints) // 加减分NEW dutyIndexCodeRouter.POST("adddivisionresponsibility", authorityIndexApi.AddDivisionResponsibility) // 划分责任人 + dutyIndexCodeRouter.POST("rersonincharge", authorityIndexApi.PersonInCharge) // 划分责任人NEW dutyIndexCodeRouter.POST("addcorrectivemeasures", authorityIndexApi.AddCorrectiveMeasures) //添加整改措施 + dutyIndexCodeRouter.POST("rectificationmeasures", authorityIndexApi.RectificationMeasures) //添加整改措施NEW dutyIndexCodeRouter.POST("qualitativeevalration", authorityIndexApi.QualitativeEvalRation) // 定量考核列表 dutyIndexCodeRouter.POST("addflowrationlog", authorityIndexApi.AddFlowRationLog) // 添加定量考核列表 @@ -198,5 +200,7 @@ func (s *AssessmentRouter) InitEvaluationRouter(Router *gin.RouterGroup) { dutyIndexCodeRouter.POST("lookrationkscoreflow", authorityIndexApi.LookRationkScoreFlow) // 查看定量考核审批列表 dutyIndexCodeRouter.POST("lookquantitativeconfig", authorityIndexApi.LookQuantitativeConfig) // 查看定量考核目标设定 + + dutyIndexCodeRouter.POST("seeflowlog", authorityIndexApi.SeeFlowLog) // 流程列表 } } diff --git a/gin_server_admin/router/shiyan/sys_shiyan.go b/gin_server_admin/router/shiyan/sys_shiyan.go index 967e841..29ddf11 100644 --- a/gin_server_admin/router/shiyan/sys_shiyan.go +++ b/gin_server_admin/router/shiyan/sys_shiyan.go @@ -28,5 +28,7 @@ func (s *ShiyanRouter) InitShiyanRouter(Router *gin.RouterGroup) { shiyanCodeRouter.POST("/getrequestoperation", authorityApi.GetRequestOperation) shiyanCodeRouter.POST("/datetime", authorityApi.DateTime) //测试时间 + + shiyanCodeRouter.GET("deltdutychongfu", authorityApi.DeltDutyChongfu) //方案去重 } } diff --git a/gin_server_admin/router/systemadmin/dutyassess.go b/gin_server_admin/router/systemadmin/dutyassess.go index 2478820..1beae3f 100644 --- a/gin_server_admin/router/systemadmin/dutyassess.go +++ b/gin_server_admin/router/systemadmin/dutyassess.go @@ -19,5 +19,12 @@ func (a *AdminRouter) InitStaffRouter(Router *gin.RouterGroup) { adminRouter.POST("getdepartevaluate", authorityApi.GetDepartEvaluate) //获取部门考核列表 adminRouter.POST("getdepartmentassesslist", authorityApi.GetDepartmentAssessList) //获取考核列表 adminRouter.POST("lookquantitativeconfig", authorityApi.LookQuantitativeConfig) // 查看定量考核目标设定 + + adminRouter.POST("selectdutylist", authorityApi.SelectDutyList) //获取定性考核列表用于下拉列表 + adminRouter.POST("dutydepartmentlist", authorityApi.DutyDepartmentList) //获取定性考核列表用于列表展示 + adminRouter.POST("idtotargetsunlist", authorityApi.IdToTargetSunList) //根据指标ID获取列表信息 + adminRouter.POST("getdetailedtargetcallback", authorityApi.GetDetailedTargetCallBack) //获取定性指标->指标细则修改回显 + adminRouter.POST("eitedetailedtargetcallback", authorityApi.EiteDetailedTargetCallBack) //获取定性指标->指标细则修改回显与新增 + adminRouter.POST("eitesuntargetname", authorityApi.EiteSunTargetName) //修改子栏目名称 } }