diff --git a/gin_server_admin/api/admin/dutyassess/assesstype.go b/gin_server_admin/api/admin/dutyassess/assesstype.go index f2f5ea1..1f3d764 100644 --- a/gin_server_admin/api/admin/dutyassess/assesstype.go +++ b/gin_server_admin/api/admin/dutyassess/assesstype.go @@ -133,8 +133,11 @@ type TargetContOutCont struct { //定性考核列表输出 type QualEvalArrt struct { - Id string `json:"id"` - Name string `json:"name"` + Id string `json:"id"` + Name string `json:"name"` + GroupName string `json:"groupname"` + DepartmentName string `json:"departmentname"` + Icon string `json:"icon"` } //输出定性考核列表 @@ -160,6 +163,25 @@ type DepartmentAryType struct { Parentname string `json:"parentname"` } +//输出定性考核列表 +type OutDutyListes 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 []commonus.DepartmentAryType `json:"departmentmap"` + UserList []string `json:"userlist"` //执行人列表 + UserListAry []QualEvalArrt `json:"userlistary"` //执行人列表 +} + //根据指标ID获取相关信息 type TargetFormId struct { OutDutyList @@ -200,3 +222,41 @@ type GetEiteTargetCont struct { DetailedTargetContent string `json:"detailedtargetcontent"` Operator []string `json:"operator"` } + +//添加 定性考核指标关系指定 +type AddQualEval struct { + AcceptDepartmentId []string `json:"parentid"` //接受考核部门 + Dimension string `json:"dimension"` //考核维度 + Type int `json:"type"` //1:定性考核;2:定量考核 + Target string `json:"target"` //考核指标 + TargetSun string `json:"targetsun"` //考核指标子栏目 + TargetSunTitle string `json:"targetsuntitle"` //考核指标子栏目 + Group string `json:"group"` //归属集团 + EvaluationList []QualEvalSunList `json:"evaluationlist"` //测评详情 +} + +//定性考核内容 +type QualEvalSunList struct { + DetailedTarget string `json:"id"` //考核细则 + Title string `json:"title"` //指标说明 + 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"` //辅助计数 + DepartmentId string `json:"parentid"` //执行考核部门ID + Operator []string `json:"userlist"` //考核执行人 +} + +//添加 定性考核指标关系指定细则 +type DutyAssEssTarget struct { + Id int64 `json:"id"` + Operator []string `json:"operator"` //考核执行人 +} + +//查看定性指标详情列表 +type LookTargetContList struct { + Group string `json:"group"` //归属集团 + TargetId string `json:"targetid"` + Dimension string `json:"dimension"` //考核维度 +} diff --git a/gin_server_admin/api/admin/dutyassess/dutyhandle.go b/gin_server_admin/api/admin/dutyassess/dutyhandle.go index a4dd3fb..ca1f0b3 100644 --- a/gin_server_admin/api/admin/dutyassess/dutyhandle.go +++ b/gin_server_admin/api/admin/dutyassess/dutyhandle.go @@ -1,6 +1,7 @@ package dutyassess import ( + "encoding/json" "strconv" "strings" "time" @@ -437,3 +438,323 @@ func (d *DutyAssessApi) EiteSunTargetName(c *gin.Context) { } response.Result(0, err, "数据处理成功", c) } + +//删除定性考核指标 +func (d *DutyAssessApi) DelDutyTarget(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 + } + eiteCont := commonus.MapOut() + eiteCont["qe_eitetime"] = time.Now().Unix() + eiteCont["qe_state"] = 3 + errEiteCont := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Where("`qe_target` = ?", requestData.Id).Updates(&eiteCont).Error + if errEiteCont != nil { + response.Result(105, errEiteCont, "删除失败!", c) + return + } + response.Result(0, err, "数据处理成功", c) +} + +//删除子栏目及附属指标详情 +func (d *DutyAssessApi) DelSunTarDimeat(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 + } + var qualId int64 + errEiteQualGuiShuCont := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeTarget{}).Select("q_parent_id").Where("`q_id` = ?", requestData.Id).First(&qualId).Error + if errEiteQualGuiShuCont != nil { + response.Result(103, err, "参数错误!请重新提交!", c) + return + } + eiteCont := commonus.MapOut() + eiteCont["qe_eitetime"] = time.Now().Unix() + eiteCont["qe_state"] = 3 + errEiteCont := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Where("`qe_target_sun` = ?", requestData.Id).Updates(&eiteCont).Error + if errEiteCont != nil { + response.Result(105, errEiteCont, "删除失败!", c) + return + } + eiteQualTar := commonus.MapOut() + eiteQualTar["q_time"] = time.Now().Unix() + eiteQualTar["q_state"] = 3 + errEiteQualCont := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeTarget{}).Where("`q_id` = ?", requestData.Id).Updates(&eiteQualTar).Error + if errEiteQualCont == nil { + eiteQualTarDited := commonus.MapOut() + eiteQualTarDited["dt_time"] = time.Now().Unix() + eiteQualTarDited["dt_state"] = 3 + global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.DetailedTarget{}).Where("`dt_parentid` = ? AND `dt_parentid_sun` = ?", qualId, requestData.Id).Updates(&eiteQualTarDited) + } + + response.Result(0, err, "数据处理成功", c) +} + +//添加 定性考核指标关系指定 +func (d *DutyAssessApi) AddDutyRelation(c *gin.Context) { + var requestData AddQualEval + err := c.ShouldBindJSON(&requestData) + if err != nil { + response.Result(101, err, "数据获取失败!", c) + return + } + if requestData.Group == "" { + response.Result(102, err, "请选择归属集团", c) + return + } + if len(requestData.AcceptDepartmentId) <= 0 { + response.Result(103, err, "请选择接受考核的部门!", c) + return + } + // if requestData.Dimension == "" { + // response.Result(102, err, "请选择考核维度", c) + // return + // } + if requestData.Target == "" { + response.Result(104, err, "请选择考核指标", c) + return + } + if requestData.TargetSunTitle == "" { + response.Result(105, err, "请输入栏目名称!", c) + return + } + if len(requestData.EvaluationList) <= 0 { + response.Result(106, err, "请添加测评详情!", c) + return + } + + //获取子目标情况 + sunTargetCont, sunTargetErr := commonus.JudgeColumn(requestData.Target, requestData.TargetSun, requestData.TargetSunTitle) + if sunTargetErr != true { + } + //将集团Id转化成整型 + groupInt, groupIntErr := strconv.ParseInt(requestData.Group, 10, 64) + if groupIntErr != nil { + groupInt = 1 + } + //指标 + targetInt, targetIntErr := strconv.ParseInt(requestData.Target, 10, 64) + if targetIntErr != nil { + targetInt = 0 + } + //维度 + dimensionInt, departinIntErr := strconv.ParseInt(requestData.Dimension, 10, 64) + if departinIntErr != nil { + dimensionInt = 0 + } + if dimensionInt == 0 { + targetInfo, targetInfoErr := commonus.GetTargetInfo(targetInt) + if targetInfoErr == true { + dimensionInt = targetInfo.Dimension + } + } + //关联集团部门考核维度 + commonus.AddDepartDimension(requestData.Group, strconv.FormatInt(dimensionInt, 10), requestData.Dimension, 1) + + //原指标细则 + var oldId []int64 + global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.DetailedTarget{}).Select("`dt_id`").Where("`dt_state` = 1 AND `dt_parentid` = ? AND `dt_parentid_sun` = ?", requestData.Target, sunTargetCont.Id).Find(&oldId) + //遍历指标细则 + var targetContList []DutyAssEssTarget + var newAddId []int64 + for _, v := range requestData.EvaluationList { + detailedTargetInfo, dtiIsTrue := commonus.JudgeDetails(requestData.Target, v.Title, v.Content, v.DetailedTarget, sunTargetCont.Id) + if dtiIsTrue == true { + if detailedTargetInfo.Id != 0 { + newAddId = append(newAddId, detailedTargetInfo.Id) + var targetContInfo DutyAssEssTarget + targetContInfo.Id = detailedTargetInfo.Id + targetContInfo.Operator = v.Operator + targetContList = append(targetContList, targetContInfo) + } + } + } + + mergeMap := append(oldId, newAddId...) //合并两个数组 + var finalResultId []int64 //最终结果 + for _, m_v := range mergeMap { + if commonus.IsItTrue(m_v, finalResultId) != true { + finalResultId = append(finalResultId, m_v) + } + } + //组合写入数据 + for _, f_v := range finalResultId { + for _, t_v := range targetContList { + if f_v != t_v.Id { + var targetContInfos DutyAssEssTarget + targetContInfos.Id = f_v + targetContList = append(targetContList, targetContInfos) + } + } + } + //判断该集团指标子栏目是否存在 + var arTaegetInfo assessmentmodel.Assesstarget + judgeARTErr := global.GVA_DB_Performanceappraisal.Where("`group` = ? AND `dimension` = ? AND `targetid` = ? AND `suntargetid` = ?", groupInt, dimensionInt, targetInt, sunTargetCont.Id).First(&arTaegetInfo).Error + if judgeARTErr == nil { + if arTaegetInfo.Content != "" { + var tarList []DutyAssEssTarget + jsonErr := json.Unmarshal([]byte(arTaegetInfo.Content), &tarList) + if jsonErr == nil { + for _, tl_v := range tarList { + for _, tcl_v := range targetContList { + if tl_v.Id != tcl_v.Id { + targetContList = append(targetContList, tl_v) + } + } + } + } + } + eiteCont := commonus.MapOut() + eiteCont["departmentmap"] = strings.Join(requestData.AcceptDepartmentId, ",") + eiteCont["time"] = time.Now().Unix() + jsonStr, jsonMErr := json.Marshal(targetContList) + if jsonMErr == nil { + eiteCont["content"] = string(jsonStr) + } + eiteErr := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.Assesstarget{}).Where("`at_id` = ?", arTaegetInfo.Id).Updates(&eiteCont).Error + if eiteErr == nil { + response.Result(0, err, "处理成功!", c) + } else { + response.Result(107, err, "请添加测评详情!", c) + } + } else { + arTaegetInfo.Group = groupInt + arTaegetInfo.Departmentmap = strings.Join(requestData.AcceptDepartmentId, ",") + arTaegetInfo.TargetId = targetInt + arTaegetInfo.SunTargetId = sunTargetCont.Id + arTaegetInfo.Dimension = dimensionInt + jsonStr, jsonMErr := json.Marshal(targetContList) + if jsonMErr == nil { + arTaegetInfo.Content = string(jsonStr) + } + arTaegetInfo.Time = time.Now().Unix() + addErr := global.GVA_DB_Performanceappraisal.Create(&arTaegetInfo).Error + if addErr == nil { + response.Result(0, err, "处理成功!", c) + } else { + response.Result(107, err, "请添加测评详情!", c) + } + } +} + +//获取定性考核指标关系指定列表 +func (d *DutyAssessApi) GetDutyRelationList(c *gin.Context) { + var list []assessmentmodel.Assesstarget + err := global.GVA_DB_Performanceappraisal.Find(&list).Error + if err != nil { + response.Result(107, err, "没有信息", c) + return + } + var outList []OutDutyListes + for _, v := range list { + var outCont OutDutyListes + + outCont.Id = strconv.FormatInt(v.Id, 10) + //指标信息 + outCont.Target = strconv.FormatInt(v.TargetId, 10) + tarCont, _ := commonus.GetTargetInfo(v.TargetId) + outCont.TargetName = tarCont.Title + //维度信息 + dutyClassCont, _ := commonus.GetDutyClassInfo(tarCont.Dimension) + outCont.Dimension = strconv.FormatInt(tarCont.Dimension, 10) + outCont.DimensionName = dutyClassCont.Title + + outCont.Content = "" //指标说明 + outCont.Unit = tarCont.Uniteing //单位"` + outCont.ReferenceScore = 0 //标准分值"` + outCont.Cycles = tarCont.Cycles //1:班;2:天;3:周;4:月;5:季度;6:年"` + outCont.CycleAttres = tarCont.CycleAttres //辅助计数"` + outCont.State = 1 + + outCont.DepartmentId, outCont.DepartmentAry = commonus.GetBranchDepartAry(strings.Split(v.Departmentmap, ",")) + + shenPiRen := strings.Split(tarCont.Report, ",") + outCont.UserList = 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}) + // GetWorkUser + if usErr == true { + var userCont QualEvalArrt + userCont.Id = v + userCont.Name = usCont.Name + outCont.UserListAry = append(outCont.UserListAry, userCont) + } + } + + outList = append(outList, outCont) + } + response.Result(0, outList, "查询完成!", c) +} + +//查看定性考核项目详情 +func (d *DutyAssessApi) LookDutyTargetInfo(c *gin.Context) { + var requestData LookTargetContList + err := c.ShouldBindJSON(&requestData) + if err != nil { + response.Result(101, err, "数据获取失败!", c) + return + } + if requestData.Group == "" { + response.Result(102, err, "参数错误!无法获取数据", c) + return + } + if requestData.Dimension == "" { + response.Result(102, err, "参数错误!无法获取数据", c) + return + } + if requestData.TargetId == "" { + response.Result(102, err, "参数错误!无法获取数据", c) + return + } + var assessInfoList []assessmentmodel.Assesstarget + assErr := global.GVA_DB_Performanceappraisal.Where("`group` = ? AND `dimension` = ? AND `targetid` = ?", requestData.Group, requestData.Dimension, requestData.TargetId).Find(&assessInfoList).Error + if assErr != nil { + response.Result(102, assErr, "没有获取到数据!", c) + return + } + var uotContAry []TargetContOutCont + for _, v := range assessInfoList { + var uotCont TargetContOutCont + uotCont.Type = 1 + //集团 + uotCont.Group = requestData.Group + _, groupCont := commonus.GetGroupCont(v.Group) + uotCont.GroupNAme = groupCont.Name + //执行部门 + uotCont.DepartmentId = v.Departmentmap + _, departInfoAry := commonus.GetBranchDepartAry(strings.Split(v.Departmentmap, ",")) + var depNameMap []string + for _, sep_v := range departInfoAry { + depNameMap = append(depNameMap, sep_v.Parentname) + } + uotCont.DepartmentName = strings.Join(depNameMap, ",") + //维度 + uotCont.Dimension = strconv.FormatInt(v.Dimension, 10) + dutyClassCont, _ := commonus.GetDutyClassInfo(v.Dimension) + uotCont.DimensionName = dutyClassCont.Title + //指标 + uotCont.Target = requestData.TargetId + targetInfo, _ := commonus.GetTargetInfo(v.TargetId) + uotCont.TargetName = targetInfo.Title + //子栏目 + uotCont.TargetSun = strconv.FormatInt(v.SunTargetId, 10) + info, _ := commonus.GetQualitativeTargetInfo(v.SunTargetId) + uotCont.TargetSunName = info.Title + //拆解指标详情 + // detailedList := json.Unmarshal() + + uotContAry = append(uotContAry, uotCont) + } +} diff --git a/gin_server_admin/api/index/evaluation/evaluation.go b/gin_server_admin/api/index/evaluation/evaluation.go index e4c3005..678edc6 100644 --- a/gin_server_admin/api/index/evaluation/evaluation.go +++ b/gin_server_admin/api/index/evaluation/evaluation.go @@ -195,7 +195,7 @@ func (e *EvaluationInterface) AdditionAndSubtractionScore(c *gin.Context) { return } - commonus.StepAddData(keyNumber, 0, 2, 1, 1, 1, 1, userCont.Key) + commonus.StepAddData(keyNumber, 0, 2, 1, 1, 2, 1, userCont.Key) // /* // @flowID 流程ID @@ -919,7 +919,7 @@ func (e *EvaluationInterface) AddFlowRationLog(c *gin.Context) { } // UpEvaluationProcessApproval(keyNumber, 16182159043990656, keyNumber, 1, userCont.Key) - commonus.StepAddData(keyNumber, 16182159043990656, 2, 7, 2, 1, 1, userCont.Key) + commonus.StepAddData(keyNumber, 16182159043990656, 2, 7, 2, 2, 1, userCont.Key) mainTitle := fmt.Sprintf("%v数据表", commonus.TimeStampToDate(operationTime, 10)) mainTitleDesc := "" @@ -1019,7 +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 + // titleVal = tarsun.Title } } if qualEvalCont.DetailedTarget != 0 { @@ -1027,7 +1027,7 @@ func (e *EvaluationInterface) LookDutkScoreFlow(c *gin.Context) { if detaTarErr == true { dutyCecorFlowInfo.DetailedTarget = detaTar.Title dutyCecorFlowInfo.Content = detaTar.Content - titleVal = detaTar.Title + // titleVal = detaTar.Title } } fmt.Printf("7-------------------->%v\n", requestData.Id) @@ -1164,7 +1164,10 @@ func (e *EvaluationInterface) LookDutkScoreFlow(c *gin.Context) { dutyCecorFlowInfo.FlowMapAll = flowAllMapList } } - dutyCecorFlowInfo.Title = titleVal + + titlekUserInfo, _ := commonus.GetWorkUser(strconv.FormatInt(addScore.EvaluationUser, 10)) + // titleStr := fmt.Sprintf("%v提交%v考核数据 %v", titlekUserInfo.Name, titleVal, commonus.TimeStampToDate(addScore.HappenTime,6)) + dutyCecorFlowInfo.Title = fmt.Sprintf("%v提交%v考核数据 %v", titlekUserInfo.Name, titleVal, commonus.TimeStampToDate(addScore.HappenTime, 6)) response.Result(0, dutyCecorFlowInfo, "获取成功", c) } @@ -1294,7 +1297,8 @@ func (d *EvaluationInterface) LookRationkScoreFlow(c *gin.Context) { 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) + titlekUserInfo, _ := commonus.GetWorkUser(strconv.FormatInt(flowLogInfo.EvaluationUser, 10)) + titleStr := fmt.Sprintf("%v提交的%v年%v月%v日定量考核数据上报", titlekUserInfo.Name, flowLogInfo.Year, flowLogInfo.Month, flowLogInfo.ToDay) gErr, groupInfo := commonus.GetGroupCont(flowLogInfo.DutyGroup) if gErr == true { outListMap["groupname"] = groupInfo.Name diff --git a/gin_server_admin/api/index/evaluation/flowsend.go b/gin_server_admin/api/index/evaluation/flowsend.go index 94dea4a..a4df6fd 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, 1, 1, 1, userCont.Key) + commonus.StepAddData(keyNumber, 0, 3, 1, 1, 2, 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, 1, 1, 1, userCont.Key) + commonus.StepAddData(keyNumber, 16182159043990656, 2, 1, 1, 2, 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, 1, 1, 3, userCont.Key) + commonus.StepAddData(orderId, 0, 4, 3, 1, 2, 3, userCont.Key) var scoreFlowInfo assessmentmodel.ScoreFlow judegFlowErr := global.GVA_DB_Performanceappraisal.Where("`sf_key` = ?", orderId).First(&scoreFlowInfo).Error if judegFlowErr != nil { @@ -577,7 +577,7 @@ func (e *EvaluationInterface) RectificationMeasures(c *gin.Context) { return } //写入流程步骤 - commonus.StepAddData(orderidval, 0, 6, 4, 1, 1, 5, userCont.Key) + commonus.StepAddData(orderidval, 0, 6, 4, 1, 2, 5, userCont.Key) /* 向本部门负责人发送审批 */ diff --git a/gin_server_admin/api/v1/assessment/department_target.go b/gin_server_admin/api/v1/assessment/department_target.go index 1d5fed8..8816b18 100644 --- a/gin_server_admin/api/v1/assessment/department_target.go +++ b/gin_server_admin/api/v1/assessment/department_target.go @@ -471,7 +471,7 @@ func (d *DutyHandle) DepartmentListNew(c *gin.Context) { var dutyClassAry []assessmentmodel.DutyClass gromDb := global.GVA_DB_Performanceappraisal gromDb = gromDb.Where("`state` = 1") - classErr := gromDb.Find(&dutyClassAry).Error + classErr := gromDb.Order("sort ASC").Find(&dutyClassAry).Error if classErr != nil { response.Result(0, classErr, "未获取到数据", c) diff --git a/gin_server_admin/api/v1/shiyan/shiyan.go b/gin_server_admin/api/v1/shiyan/shiyan.go index 8687f3a..960039e 100644 --- a/gin_server_admin/api/v1/shiyan/shiyan.go +++ b/gin_server_admin/api/v1/shiyan/shiyan.go @@ -1383,3 +1383,33 @@ func (s *ShiyanApi) TextShiyan(c *gin.Context) { fmt.Printf("SimHashSimilar distance:%v\n", distance) // t.Logf("SimHashSimilar distance: %v", distance) } + +type jimishiyan struct { + KeyStr string `json:"key"` + Number string `json:"number"` + Password string `json:"password"` +} + +//加密实验 +func (s *ShiyanApi) JiaMi(c *gin.Context) { + + var user jimishiyan + _ = c.ShouldBindJSON(&user) + + userAgent := "250" + + var md5JiaMi commonus.Md5Encryption + md5JiaMi.Md5EncryptionInit(userAgent) + md5Token := md5JiaMi.Md5EncryptionAlgorithm() + + // response.Result(101, md5Token, "加密实验!", c) + + sha1Str := user.KeyStr + user.Number + user.Password + md5Token + sha1Token := commonus.Sha1Encryption(sha1Str) + + outMap := commonus.MapOut() + outMap["md5Token"] = md5Token + outMap["sha1Token"] = sha1Token + + response.Result(101, outMap, "sha1Token加密实验!", c) +} diff --git a/gin_server_admin/api/wechatapp/callback/apphandle.go b/gin_server_admin/api/wechatapp/callback/apphandle.go index 8e4fa5b..3f353b4 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 } @@ -238,10 +238,12 @@ func EventProcessing(event string, decryptMsg []byte, v *CallBackData, cs *gin.C } else { msg = "25000" } - synergeticProcess.Add(1) + // synergeticProcess.Add(1) go templateEventPush(decryptMsg) - defer synergeticProcess.Wait() - cs.String(200, msg) + // defer synergeticProcess.Wait() + go func() { + cs.String(200, msg) + }() case "template_card_menu_event": //通用模板卡片右上角菜单事件推送 default: diff --git a/gin_server_admin/api/wechatapp/callback/updatehandle.go b/gin_server_admin/api/wechatapp/callback/updatehandle.go index e4beb64..1f1c1d5 100644 --- a/gin_server_admin/api/wechatapp/callback/updatehandle.go +++ b/gin_server_admin/api/wechatapp/callback/updatehandle.go @@ -48,7 +48,7 @@ func templateEventPush(eventMsg []byte) { jsonStr, _ := json.Marshal(msgContent) fmt.Printf("jsonStr======>%v\n", string(jsonStr)) - defer synergeticProcess.Done() + // defer synergeticProcess.Done() // var updateButtonNotClickable commonus.UpdateButtonNotClickable // updateButtonNotClickable.Userids = append(updateButtonNotClickable.Userids, "KaiXinGuo") // updateButtonNotClickable.Atall = 0 @@ -131,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, 1, 1, 1, strconv.FormatInt(userContInfo.Key, 10)) + commonus.StepAddData(orderIdInt, 0, 1, 1, 1, 2, 1, strconv.FormatInt(userContInfo.Key, 10)) //发起人 taskId := strconv.FormatInt(commonus.GetFileNumberEs(), 10) evaluationPlanStr := strconv.FormatInt(scoreFlowInfo.EvaluationPlan, 10) @@ -149,7 +149,7 @@ func (t *TemplateCardPush) ButtonTemplateCallBackHandleBackups(orderId, clickEnt case 2: //发起人部门负责人 orderIdInt, _ := strconv.ParseInt(orderId, 10, 64) - commonus.StepAddData(orderIdInt, 16182159043990656, 3, 2, 1, 1, 2, strconv.FormatInt(userContInfo.Key, 10)) + commonus.StepAddData(orderIdInt, 16182159043990656, 3, 2, 1, 2, 2, strconv.FormatInt(userContInfo.Key, 10)) //获取发起人部门负责人 sendUserIsTrue, sendUserList := commonus.GetSendMsgUserAry(16182159043990656, userContInfo.DepartmentId) //获取发起人部门负责人 if sendUserIsTrue == true { @@ -287,7 +287,7 @@ 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)) + commonus.StepAddData(orderIdInt, 16182159043990656, 5, 7, 1, 2, 4, strconv.FormatInt(userContInfo.Key, 10)) } else { //不需要整改 @@ -354,14 +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)) + commonus.StepAddData(orderIdInt, 16182159043990656, 7, 7, 1, 2, 4, strconv.FormatInt(userContInfo.Key, 10)) } case 5: //主要责任人整改 case 6: //责任部门审批(部门负责人) orderIdInt, _ := strconv.ParseInt(orderId, 10, 64) //流程Key - commonus.StepAddData(orderIdInt, 16182159043990656, 7, 7, 1, 1, 6, strconv.FormatInt(userContInfo.Key, 10)) + commonus.StepAddData(orderIdInt, 16182159043990656, 7, 7, 1, 2, 6, strconv.FormatInt(userContInfo.Key, 10)) sendButtonIsTrue, sendButtonList := commonus.GetSendMsgUserAry(16182159043990656, userContInfo.DepartmentId) //获取发起人部门负责人 if sendButtonIsTrue == true { buttonClickNAmeOtherEs := fmt.Sprintf("%v%v", userContInfo.Name, "已批准") diff --git a/gin_server_admin/commonus/publichaneld.go b/gin_server_admin/commonus/publichaneld.go index 3ed6f73..b7617cc 100644 --- a/gin_server_admin/commonus/publichaneld.go +++ b/gin_server_admin/commonus/publichaneld.go @@ -1494,6 +1494,7 @@ func StepAddData(flowID, roleGroupId int64, nextStep, stepName, typeclass, state saveData["ep_participants"] = fmt.Sprintf("%v,%v", evalProCont.Participants, userKey) saveData["ep_state"] = state saveData["ep_next_cont"] = InsetFlowLog(state, stepInt, userKey, evalProCont.NextContent) + fmt.Printf("Flow---Map:--->%v\n", saveData) EiteDutiesInfoes(evalProCont.Id, saveData) } } @@ -1507,12 +1508,15 @@ func StepAddData(flowID, roleGroupId int64, nextStep, stepName, typeclass, state @flowMapStr 流程图字符串 */ func InsetFlowLog(state, stepInt int, userKey, flowMapStr string) (flowAllMap string) { + // fmt.Printf("Flow_log:--Begin-->%v-->%v\n", stepInt, flowMapStr) var flowMap []FlowAllMap - jsonErr := json.Unmarshal([]byte(flowMapStr), flowMap) + jsonErr := json.Unmarshal([]byte(flowMapStr), &flowMap) + // fmt.Printf("Flow_log:--Begin---Err---->%v\n", jsonErr) if jsonErr != nil { flowAllMap = flowMapStr return } + // fmt.Printf("Flow_log:--Begin-1->%v-->%v", stepInt, flowMapStr) var eiteFlowMap []FlowAllMap for _, v := range flowMap { var eiteFlowInfo FlowAllMap @@ -1527,6 +1531,9 @@ func InsetFlowLog(state, stepInt int, userKey, flowMapStr string) (flowAllMap st } eiteFlowInfo.Class = v.Class + + // fmt.Printf("Flow_log:--Step-->%v-->%v\n", v.Step, stepInt) + if v.Step == stepInt { var userClickAry []UserListFlowAll for _, u_v := range v.UserList { @@ -1546,6 +1553,8 @@ func InsetFlowLog(state, stepInt int, userKey, flowMapStr string) (flowAllMap st userClick.Tema = u_v.Tema userClick.TemaName = u_v.TemaName userClick.Wechat = u_v.Wechat + + // fmt.Printf("Flow_log:--UsekKey-->%v-->%v\n", u_v.Id, userKey) if u_v.Id == userKey { var logListMap LogList logListMap.State = state @@ -1562,6 +1571,9 @@ func InsetFlowLog(state, stepInt int, userKey, flowMapStr string) (flowAllMap st eiteFlowMap = append(eiteFlowMap, eiteFlowInfo) } jsonStr, jsonErrSet := json.Marshal(eiteFlowMap) + + // fmt.Printf("Flow_log:--jsonErr-->%v-->%v\n", jsonErrSet, string(jsonStr)) + if jsonErrSet == nil { flowAllMap = string(jsonStr) } @@ -1646,6 +1658,9 @@ func IntegrationFlowAll(flowID int64, class int) (flowAllMap string) { oneFlowInfo.Class = 1 oneFlowInfo.UserList = GetFlowNodeMan(flowID, class, 1) flowMap = append(flowMap, oneFlowInfo) + + // fmt.Print("Flow_log:-->%v") + if class == 1 { var scoreFlowCont assessmentmodel.ScoreFlow @@ -2250,3 +2265,131 @@ func GetDepartmentByUserBast(userKey []string) (userDepartmentId []string) { } return } + +//判断该子栏目是否存在 +/* +@ascription 指标ID +@columId 子指标ID +@title 指标名称 +*/ +func JudgeColumn(ascription, columId, title string) (content assessmentmodel.QualitativeTarget, isTrue bool) { + isTrue = false + if columId != "" { + judgeIdErr := global.GVA_DB_Performanceappraisal.Where("`q_id` = ?", columId).First(&content).Error + if judgeIdErr == nil { + isTrue = true + return + } + } + judgeErr := global.GVA_DB_Performanceappraisal.Where("`q_parent_id` = ? AND `q_title` = ?", ascription, title).First(&content).Error + if judgeErr == nil { + isTrue = true + return + } + ascriptionId, ascriptionErr := strconv.ParseInt(ascription, 10, 64) + if ascriptionErr != nil { + ascriptionId = 0 + } + saveColum := assessmentmodel.QualitativeTarget{Title: title, ParentId: ascriptionId, State: 1, AddTime: time.Now().Unix()} + addErr := global.GVA_DB_Performanceappraisal.Create(&saveColum).Error + if addErr != nil { + return + } + isTrue = true + content = saveColum + return +} + +//关联集团部门考核维度 +/* +@groupID 集团 +@departId 部门 +@dimensionId 维度 +@key 1:定性考核;2:定量考核 +*/ +func AddDepartDimension(groupID, departId, dimensionId string, key int64) { + judgeMap := 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 + if judgeErr != nil { + var saveData assessmentmodel.DepartmentDimension + saveData.Key = key + departIdVal, _ := strconv.ParseInt(departId, 10, 64) + saveData.DepartmentId = departIdVal + dimensionIdVal, _ := strconv.ParseInt(dimensionId, 10, 64) + saveData.Dimension = dimensionIdVal + groupIDVal, _ := strconv.ParseInt(groupID, 10, 64) + saveData.Group = groupIDVal + saveData.Addtime = time.Now().Unix() + insetErr := global.GVA_DB_Performanceappraisal.Create(&saveData).Error + if insetErr == nil { + } + } +} + +//判断考核细则是否存在 +/* +参数说明 +@ascription 归属指标栏目 +@title 指标细则 +@explain 指标说明' +@explainId 指标明细ID +@sunTargetId 子栏目 +*/ +func JudgeDetails(ascription, title, explain, explainId string, sunTargetId int64) (content assessmentmodel.DetailedTarget, isTrue bool) { + isTrue = false + if explainId != "" { + judgeIdErr := global.GVA_DB_Performanceappraisal.Where("`dt_id` = ?", explainId).First(&content).Error + if judgeIdErr == nil { + eiteCont := MapOut() + eiteCont["dt_title"] = title + eiteCont["dt_content"] = explain + eiteCont["dt_time"] = time.Now().Unix() + global.GVA_DB_Performanceappraisal.Model(&content).Where("`dt_id` = ?", explainId).Updates(&eiteCont) + // fmt.Printf("echo --------------1---------->%v\n", content) + isTrue = true + return + } + } + judgeErr := global.GVA_DB_Performanceappraisal.Where("`dt_parentid` = ? AND `dt_title` = ?", ascription, title).First(&content).Error + if judgeErr == nil { + isTrue = true + eiteCont := MapOut() + eiteCont["dt_content"] = explain + eiteCont["dt_time"] = time.Now().Unix() + global.GVA_DB_Performanceappraisal.Model(&content).Where("`dt_id` = ?", content.Id).Updates(&eiteCont) + // fmt.Printf("echo --------------2---------->%v\n", content) + return + } + ascriptionId, ascriptionErr := strconv.ParseInt(ascription, 10, 64) + if ascriptionErr != nil { + ascriptionId = 0 + } + saveColum := assessmentmodel.DetailedTarget{Title: title, Content: explain, ParentId: ascriptionId, ParentIdSun: sunTargetId, State: 1, AddTime: time.Now().Unix()} + addErr := global.GVA_DB_Performanceappraisal.Create(&saveColum).Error + if addErr != nil { + // fmt.Printf("echo --------------3---------->%v\n", saveColum.Id) + return + } + // fmt.Printf("echo --------------4---------->%v\n", saveColum.Id) + isTrue = true + content = saveColum + return +} + +func GetBranchDepartAry(departIdAry []string) (departId []int64, departAry []DepartmentAryType) { + for _, v := range departIdAry { + bfId, bfIdErr := strconv.ParseInt(v, 10, 64) + if bfIdErr == nil { + deparConErr, deparConCont := GetBranchFactory(bfId) + if deparConErr == true { + departId = append(departId, deparConCont.Id) + var departcont DepartmentAryType + departcont.Parentname = deparConCont.Name + departcont.Parentid = v + departAry = append(departAry, departcont) + } + } + + } + return +} diff --git a/gin_server_admin/commonus/publicstruct.go b/gin_server_admin/commonus/publicstruct.go index 3fcfc24..d8ccad4 100644 --- a/gin_server_admin/commonus/publicstruct.go +++ b/gin_server_admin/commonus/publicstruct.go @@ -125,3 +125,8 @@ type FlowNodePeopleInfo struct { EvalCont UserListFlowAll `json:"evalcont"` DutyCont UserListFlowAll `json:"dutycont"` } + +type DepartmentAryType struct { + Parentid string `json:"parentid"` + Parentname string `json:"parentname"` +} diff --git a/gin_server_admin/main.go b/gin_server_admin/main.go index c21f71b..0f15624 100644 --- a/gin_server_admin/main.go +++ b/gin_server_admin/main.go @@ -6,6 +6,7 @@ import ( "github.com/flipped-aurora/gin-vue-admin/server/core" "github.com/flipped-aurora/gin-vue-admin/server/global" "github.com/flipped-aurora/gin-vue-admin/server/initialize" + "github.com/flipped-aurora/gin-vue-admin/server/scheduledtask" ) //go:generate go env -w GO111MODULE=on @@ -88,6 +89,7 @@ func main() { fmt.Printf("%v==>数据库mysqlWechatCallBack初始化成功\n", global.GVA_DB_WechatCallBack) } + scheduledtask.TimeTask() // fmt.Printf("WEiXin------>%v===>%v----->%v----->%v\n", global.GVA_CONFIG.WorkWechatId, global.GVA_CONFIG.WorkWechatSchool, global.GVA_CONFIG.WorkWechatMailList, global.GVA_CONFIG.WorkHealthReport) // fmt.Printf("jkskd => %v===>%v----->%v\n", global.GVA_CONFIG.MyConfig.AppKey, global.GVA_CONFIG.MyConfig.Visit, global.GVA_CONFIG) // fmt.Printf("%v===>%v----->%v\n", global.GVA_CONFIG.WorkWechatIds, global.GVA_CONFIG.WorkWechatSchools, global.GVA_CONFIG.WorkWechatMailLists)MysqlHealthReportDate diff --git a/gin_server_admin/model/assessmentmodel/dutyclass.go b/gin_server_admin/model/assessmentmodel/dutyclass.go index 8188fd7..35eff3f 100644 --- a/gin_server_admin/model/assessmentmodel/dutyclass.go +++ b/gin_server_admin/model/assessmentmodel/dutyclass.go @@ -359,3 +359,20 @@ type QuantitativeConfig struct { func (QuantitativeConfig *QuantitativeConfig) TableName() string { return "quantitative_config" } + +//定性考核指标关系指定 +type Assesstarget struct { + Id int64 `json:"id" gorm:"primaryKey;column:at_id;type:bigint(20) unsigned;not null;comment:Id;index"` + Group int64 `json:"group" gorm:"column:group;type:bigint(20) unsigned;default:0;not null;comment:集团ID"` + Departmentmap string `json:"departmentmap" gorm:"column:departmentmap;type:mediumtext unsigned;default:0;comment:部门ID"` + TargetId int64 `json:"targetid" gorm:"column:targetid;type:bigint(20) unsigned;default:0;not null;comment:指标"` + SunTargetId int64 `json:"suntargetid" gorm:"column:suntargetid;type:bigint(20) unsigned;default:0;not null;comment:子栏目ID"` + Content string `json:"content" gorm:"column:content;type:longtext;comment:描述"` + Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` + State int `json:"state" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` + Dimension int64 `json:"dimension" gorm:"column:dimension;type:bigint(20) unsigned;default:0;not null;comment:维度"` +} + +func (Assesstarget *Assesstarget) TableName() string { + return "assesstarget" +} diff --git a/gin_server_admin/router/shiyan/sys_shiyan.go b/gin_server_admin/router/shiyan/sys_shiyan.go index c5ba923..a14e81b 100644 --- a/gin_server_admin/router/shiyan/sys_shiyan.go +++ b/gin_server_admin/router/shiyan/sys_shiyan.go @@ -32,5 +32,7 @@ func (s *ShiyanRouter) InitShiyanRouter(Router *gin.RouterGroup) { shiyanCodeRouter.GET("deltdutychongfu", authorityApi.DeltDutyChongfu) //方案去重 shiyanCodeRouter.POST("textshiyan", authorityApi.TextShiyan) //比对文本 + + shiyanCodeRouter.POST("jiami", authorityApi.JiaMi) //比对文本 } } diff --git a/gin_server_admin/router/systemadmin/dutyassess.go b/gin_server_admin/router/systemadmin/dutyassess.go index 1beae3f..9146e12 100644 --- a/gin_server_admin/router/systemadmin/dutyassess.go +++ b/gin_server_admin/router/systemadmin/dutyassess.go @@ -26,5 +26,10 @@ func (a *AdminRouter) InitStaffRouter(Router *gin.RouterGroup) { adminRouter.POST("getdetailedtargetcallback", authorityApi.GetDetailedTargetCallBack) //获取定性指标->指标细则修改回显 adminRouter.POST("eitedetailedtargetcallback", authorityApi.EiteDetailedTargetCallBack) //获取定性指标->指标细则修改回显与新增 adminRouter.POST("eitesuntargetname", authorityApi.EiteSunTargetName) //修改子栏目名称 + adminRouter.POST("deldutytarget", authorityApi.DelDutyTarget) //删除定性考核指标 + adminRouter.POST("delsuntardimeat", authorityApi.DelSunTarDimeat) //删除定性考核指标子栏目 + adminRouter.POST("adddutyrelation", authorityApi.AddDutyRelation) //添加 定性考核指标关系指定 + adminRouter.POST("getdutyrelationlist", authorityApi.GetDutyRelationList) //获取定性考核指标关系指定列表 } + } diff --git a/gin_server_admin/scheduledtask/time_task.go b/gin_server_admin/scheduledtask/time_task.go new file mode 100644 index 0000000..7237f67 --- /dev/null +++ b/gin_server_admin/scheduledtask/time_task.go @@ -0,0 +1,35 @@ +package scheduledtask + +import ( + "fmt" + "time" + + "github.com/robfig/cron/v3" +) + +/* +定时任务模块 +跟随任务一起启动,执行周期性任务操作 +*/ +func TimeTask() { + fmt.Println("------------准备启动定时任务--------------") + go func() { + c := cron.New(cron.WithSeconds()) //声明定时任务启动器 + + /* + 加载任务场景 + AddFunc("任务时间格式","执行的任务") + */ + c.AddFunc("0 */10 * * * *", func() { + fmt.Printf("执行定时任务------>%v\n", time.Now().UTC()) + }) //每3秒执行一个任务 + //启动 + c.Start() + //设定全部执行后,最后关闭定时任务 + defer c.Stop() + select {} + }() + + fmt.Printf("定时任务启动成功!TIME:%v\n", time.Now().UTC()) + +}