diff --git a/gin_server_admin/api/index/evaluation/evaluation.go b/gin_server_admin/api/index/evaluation/evaluation.go index 0bfef74..41568ec 100644 --- a/gin_server_admin/api/index/evaluation/evaluation.go +++ b/gin_server_admin/api/index/evaluation/evaluation.go @@ -1513,6 +1513,29 @@ func (e *EvaluationInterface) LookDutkScoreFlow(c *gin.Context) { // fmt.Printf("flowAllMapList----------->%v\n", dutyCecorFlowInfo.FlowMapAll) } + var flowLogList []assessmentmodel.AssessmentLogIng + + flowLogErr := global.GVA_DB_Performanceappraisal.Where("al_order_id = ?", requestData.Id).Order("al_id ASC").Find(&flowLogList).Error + if flowLogErr == nil { + + for flli, fllv := range flowLogList { + var flowListCont FlowContLog + if fllv.DutyList == "" && flli == 0 { + flowListCont.Content = "创建申请" + } else { + flowListCont.Content = fllv.DutyList + } + + flowListCont.TimeVal = commonus.TimeStampToDate(fllv.ExecutorTime, 6) + userFlowCont, _ := commonus.GetNewHrPeopleInfo(map[string]interface{}{"`key`": fllv.ExecutorUser}) + flowListCont.Name = userFlowCont.Name + flowListCont.Icon = userFlowCont.Icon + gorupCont, _ := commonus.GetNewOrgCont(map[string]interface{}{"`id`": fllv.ExecutorDepart}, "`name`") + flowListCont.DepartmentName = gorupCont.Name + dutyCecorFlowInfo.ApprovalRecord = append(dutyCecorFlowInfo.ApprovalRecord, flowListCont) + } + } + 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)) @@ -1733,6 +1756,33 @@ func (d *EvaluationInterface) LookRationkScoreFlow(c *gin.Context) { outListMap["title"] = titleStr } + var flowLogListes []assessmentmodel.AssessmentLogIng + + var approvalRecord []FlowContLog + + flowLogErr := global.GVA_DB_Performanceappraisal.Where("al_order_id = ?", requestData.Id).Order("al_id ASC").Find(&flowLogListes).Error + if flowLogErr == nil { + + for flli, fllv := range flowLogListes { + var flowListCont FlowContLog + if fllv.DutyList == "" && flli == 0 { + flowListCont.Content = "创建申请" + } else { + flowListCont.Content = fllv.DutyList + } + + flowListCont.TimeVal = commonus.TimeStampToDate(fllv.ExecutorTime, 6) + userFlowCont, _ := commonus.GetNewHrPeopleInfo(map[string]interface{}{"`key`": fllv.ExecutorUser}) + flowListCont.Name = userFlowCont.Name + flowListCont.Icon = userFlowCont.Icon + gorupCont, _ := commonus.GetNewOrgCont(map[string]interface{}{"`id`": fllv.ExecutorDepart}, "`name`") + flowListCont.DepartmentName = gorupCont.Name + approvalRecord = append(approvalRecord, flowListCont) + } + } + + outListMap["flowLogList"] = approvalRecord + 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 95012b7..550b8e0 100644 --- a/gin_server_admin/api/index/evaluation/flowsend.go +++ b/gin_server_admin/api/index/evaluation/flowsend.go @@ -12,6 +12,7 @@ import ( "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/flipped-aurora/gin-vue-admin/server/model/hrsystem" "github.com/gin-gonic/gin" ) @@ -807,15 +808,58 @@ func (e *EvaluationInterface) RectificationMeasures(c *gin.Context) { } //写入责任节点 -func WritePersonLiable(flowKey, userKey int64) { +func WritePersonLiable(flowKey, userKey []int64) { + var userAry []hrsystem.Personnel + userAryErr := global.GVA_DB_HrDataBase.Model(&hrsystem.Personnel{}).Where("`key` IN ?", userKey).Find(&userAry) + var userFlow []commonus.UserListFlowAll + if userAryErr == nil { + for _, uv := range userAry { + var usFlowInfo commonus.UserListFlowAll + + usFlowInfo.Id = strconv.FormatInt(uv.Key, 10) // `json:"id"` //操作人ID + usFlowInfo.Name = uv.Name // `json:"name"` //操作人姓名 + usFlowInfo.Icon = uv.Icon // `json:"icon"` //操作人头像 + usFlowInfo.Wechat = uv.Wechat + if uv.WorkWechat != "" { + usFlowInfo.Wechat = uv.WorkWechat // `json:"wechat"` //微信Openid + } + whereGroup := commonus.MapOut() + whereGroup["id"] = uv.Company + orgContGroup, _ := commonus.GetNewOrgCont(whereGroup, "name") + usFlowInfo.Group = uv.Company // `json:"group"` //集团公司 + usFlowInfo.GroupName = orgContGroup.Name // `json:"groupname"` //分厂名称 + departId, _ := strconv.ParseInt(uv.Deparment, 10, 64) + usFlowInfo.DepartmentId = departId // `json:"departmentid"` //分厂Id + whereDepart := commonus.MapOut() + whereDepart["id"] = uv.Deparment + orgContDepart, _ := commonus.GetNewOrgCont(whereDepart, "name") + usFlowInfo.DepartmentName = orgContDepart.Name // `json:"departmentname"` //分厂名称 + usFlowInfo.WorkshopId = uv.AdminOrg // `json:"workshopid"` //工段Id + wherePost := commonus.MapOut() + wherePost["id"] = uv.AdminOrg + orgContPost, _ := commonus.GetNewOrgCont(wherePost, "name") + usFlowInfo.WorkshopName = orgContPost.Name // `json:"workshopname"` //工段名称 + usFlowInfo.PostId = uv.Position // `json:"postid"` //职务Id + usFlowInfo.PostName = "" // `json:"postname"` //职务名称 + usFlowInfo.Tema = 1 // `json:"tema"` //班组Id + usFlowInfo.TemaName = "" // `json:"temaname"` //班组名称 + userFlow = append(userFlow, usFlowInfo) + } + + } //获取流程内容 var flowCont string err := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.EvaluationProcess{}).Select("`ep_next_cont`").Where("`ep_order_key` = ?", flowKey).First(&flowCont) if err == nil { - var twoFlowInfo commonus.FlowAllMap + var twoFlowInfo []commonus.FlowAllMap jsonErr := json.Unmarshal([]byte(flowCont), &twoFlowInfo) if jsonErr == nil { - + for i, v := range twoFlowInfo { + if v.Step == 5 { + twoFlowInfo[i].UserList = userFlow + } + } } + global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.EvaluationProcess{}).Where("`ep_order_key` = ?", flowKey).Updates(&twoFlowInfo) } } diff --git a/gin_server_admin/api/index/evaluation/lookquantita.go b/gin_server_admin/api/index/evaluation/lookquantita.go index 4eb6748..a8cc723 100644 --- a/gin_server_admin/api/index/evaluation/lookquantita.go +++ b/gin_server_admin/api/index/evaluation/lookquantita.go @@ -342,10 +342,16 @@ func (e *EvaluationInterface) SeeFlowLog(c *gin.Context) { } } switch v.State { + case 1: + flowLogListCont.Result = "起草" + flowLogListCont.Condition = "起草" case 2: + flowLogListCont.Result = "审批中" + flowLogListCont.Condition = "审批中" + case 3: flowLogListCont.Result = "审批通过" flowLogListCont.Condition = "已结束" - case 3: + case 4: flowLogListCont.Result = "驳回" flowLogListCont.Condition = "审批中" default: diff --git a/gin_server_admin/api/index/evaluation/type.go b/gin_server_admin/api/index/evaluation/type.go index 71c8e4a..76ee793 100644 --- a/gin_server_admin/api/index/evaluation/type.go +++ b/gin_server_admin/api/index/evaluation/type.go @@ -173,6 +173,17 @@ type DutyCecorFlow struct { LanMuName string `json:"lanmuname"` //前端栏目显示名称 Enclosure []EnclosureFormat `json:"enclosure"` //附件 IsSet int `json:"isset"` //是否已经审批 + ApprovalRecord []FlowContLog `json:"approvalrecord"` //审批记录 +} + +//审批操作 +type FlowContLog struct { + Name string `json:"name"` + Icon string `json:"icon"` //头像 + GroupName string `json:"groupname"` //集团 + DepartmentName string `json:"parentname"` //部门 + Content string `json:"content"` //审批意见 + TimeVal string `json:"timeval"` //操作时间 } //审批流 diff --git a/gin_server_admin/api/index/statistics/dataform.go b/gin_server_admin/api/index/statistics/dataform.go index 1926b74..379274e 100644 --- a/gin_server_admin/api/index/statistics/dataform.go +++ b/gin_server_admin/api/index/statistics/dataform.go @@ -625,10 +625,22 @@ func AuxiliaryCalculationSumMethod(where interface{}, scoringMethod int) (sumSco func SubjectiveAuxiliaryCalculationSumMethod(where interface{}) (sumScore float64, departmentAry []int64, departNameAry []string) { //加分 var addSumScore float64 = 0 - global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.ScoreFlow{}).Select("sf_score").Where(where).Where("sf_plus_reduce_score = 1").Pluck("COALESCE(SUM(sf_score), 0) as addrescore", &addSumScore) + // global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.ScoreFlow{}).Select("sf_score").Where(where).Where("sf_plus_reduce_score = 1").Pluck("COALESCE(SUM(sf_score), 0) as addrescore", &addSumScore) + var jiaFenAry []TongjiFenShu + global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.ScoreFlow{}).Select("sf_score").Where(where).Where("sf_plus_reduce_score = 1").Find(&jiaFenAry) + for _, jiav := range jiaFenAry { + addSumScore = addSumScore + (jiav.Score * jiav.Count) + } //加分 var scoreReduction float64 = 0 - global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.ScoreFlow{}).Select("sf_score").Where(where).Where("sf_plus_reduce_score = 2").Pluck("COALESCE(SUM(sf_score), 0) as redurescore", &scoreReduction) + // global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.ScoreFlow{}).Select("sf_score").Where(where).Where("sf_plus_reduce_score = 2").Pluck("COALESCE(SUM(sf_score), 0) as redurescore", &scoreReduction) + + var jianFenAry []TongjiFenShu + global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.ScoreFlow{}).Select("sf_score").Where(where).Where("sf_plus_reduce_score = 2").Find(&jianFenAry) + for _, jianv := range jianFenAry { + scoreReduction = scoreReduction + (jianv.Score * jianv.Count) + } + if addSumScore != 0 && scoreReduction != 0 { if addSumScore > scoreReduction { sumScore = addSumScore - scoreReduction diff --git a/gin_server_admin/api/index/statistics/enter.go b/gin_server_admin/api/index/statistics/enter.go index 9f2de50..4525743 100644 --- a/gin_server_admin/api/index/statistics/enter.go +++ b/gin_server_admin/api/index/statistics/enter.go @@ -189,3 +189,8 @@ type TableScoreList struct { ScoreList ExecutiveDepartment []string `json:"executivedepartment"` //执行部门 } + +type TongjiFenShu struct { + Score float64 `json:"score" gorm:"column:sf_score;type:bigint(20) unsigned;default:0;not null;comment:分值(乘100录入)"` + Count float64 `json:"count" gorm:"column:sf_count;type:int(5) unsigned;default:1;not null;comment:发生次数"` +} diff --git a/gin_server_admin/api/index/statistics/tablestatistics.go b/gin_server_admin/api/index/statistics/tablestatistics.go index 014edc5..c70e17c 100644 --- a/gin_server_admin/api/index/statistics/tablestatistics.go +++ b/gin_server_admin/api/index/statistics/tablestatistics.go @@ -553,6 +553,7 @@ func (t *tablePlanVersionStic) conditionStatistics(wherStr, group, department, d @class 指标类型 1、定性;2:定量 @referenceScore 指标权重 */ + func (t *tablePlanVersionStic) SubjectiveAuxiliaryCalculationSumMethod(wherStr string, i, status, class int, referenceScore int64) { t.mutext.Lock() defer t.mutext.Unlock() @@ -562,10 +563,25 @@ func (t *tablePlanVersionStic) SubjectiveAuxiliaryCalculationSumMethod(wherStr s var departmentAry []int64 //部门ID //加分 var addSumScore float64 = 0 - global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.ScoreFlow{}).Select("sf_score").Where(wherStr).Where("sf_plus_reduce_score = 1").Pluck("COALESCE(SUM(sf_score), 0) as addrescore", &addSumScore) - //加分 + + // global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.ScoreFlow{}).Select("sf_score").Where(wherStr).Where("sf_plus_reduce_score = 1").Pluck("COALESCE(SUM(sf_score), 0) as addrescore", &addSumScore) + + var jiaFenAry []TongjiFenShu + global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.ScoreFlow{}).Select("sf_score").Where(wherStr).Where("sf_plus_reduce_score = 1").Find(&jiaFenAry) + for _, jiav := range jiaFenAry { + addSumScore = addSumScore + (jiav.Score * jiav.Count) + } + + //减分 var scoreReduction float64 = 0 - global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.ScoreFlow{}).Select("sf_score").Where(wherStr).Where("sf_plus_reduce_score = 2").Pluck("COALESCE(SUM(sf_score), 0) as redurescore", &scoreReduction) + // global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.ScoreFlow{}).Select("sf_score").Where(wherStr).Where("sf_plus_reduce_score = 2").Pluck("COALESCE(SUM(sf_score), 0) as redurescore", &scoreReduction) + + var jianFenAry []TongjiFenShu + global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.ScoreFlow{}).Select("sf_score").Where(wherStr).Where("sf_plus_reduce_score = 2").Find(&jianFenAry) + for _, jianv := range jianFenAry { + scoreReduction = scoreReduction + (jianv.Score * jianv.Count) + } + if addSumScore != 0 && scoreReduction != 0 { if addSumScore > scoreReduction { sumScore = addSumScore - scoreReduction diff --git a/gin_server_admin/api/reply/qual/controller.go b/gin_server_admin/api/reply/qual/controller.go index 6c4d3f0..1f83ac8 100644 --- a/gin_server_admin/api/reply/qual/controller.go +++ b/gin_server_admin/api/reply/qual/controller.go @@ -94,7 +94,7 @@ func (a *ApiGroup) Operation(c *gin.Context) { var quoteAreaTitle string //引用文献标题 orderIdInt, _ := strconv.ParseInt(requestData.OrderId, 10, 64) //流程Key - // userKeyInt, _ := strconv.ParseInt(userCont.Key, 10, 64) //使用人KEY + userKeyInt, _ := strconv.ParseInt(userCont.Key, 10, 64) //使用人KEY sendScVal := float64(scoreFlowInfo.Score) / 100 scoreFloat64ToStringsss := strconv.FormatFloat(sendScVal, 'f', -1, 64) @@ -116,8 +116,8 @@ func (a *ApiGroup) Operation(c *gin.Context) { //申请 case 2: //申请人部门负责人 - commonus.StepAddData(orderIdInt, 16182159043990656, 1, 2, 1, 3, 2, userCont.Key) //审批步骤处理 - commonus.WriteReplyLog(orderIdInt, scoreFlowInfo.DutyDepartment, scoreFlowInfo.EvaluationDepartment, scoreFlowInfo.EvaluationUser, 3, commonus.GetSetpName(2), opinionCont) //写入审批流 + commonus.StepAddData(orderIdInt, 16182159043990656, 1, 2, 1, 3, 2, userCont.Key) //审批步骤处理 + commonus.WriteReplyLog(orderIdInt, scoreFlowInfo.DutyDepartment, founderDepartId, userKeyInt, 3, commonus.GetSetpName(2), opinionCont) //写入审批流 //修改定性审批流状态 eiteScoreFlow := commonus.MapOut() @@ -129,7 +129,7 @@ func (a *ApiGroup) Operation(c *gin.Context) { evalProcSaveData["ep_time"] = time.Now().Unix() global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.EvaluationProcess{}).Where("`ep_order_key` = ?", orderIdInt).Updates(&evalProcSaveData) - reason = fmt.Sprintf("原因:%v\n", opinionCont) + reason = fmt.Sprintf("审批意见:%v\n", opinionCont) //获取发起人信息 var sendUser string = "" @@ -192,7 +192,7 @@ func (a *ApiGroup) Operation(c *gin.Context) { //申请人部门负责人 commonus.StepAddData(orderIdInt, 16182159043990656, 3, 3, 1, 3, 4, userCont.Key) - commonus.WriteReplyLog(orderIdInt, scoreFlowInfo.DutyDepartment, scoreFlowInfo.EvaluationDepartment, scoreFlowInfo.EvaluationUser, 3, commonus.GetSetpName(3), opinionCont) //写入审批流 + commonus.WriteReplyLog(orderIdInt, scoreFlowInfo.DutyDepartment, founderDepartId, userKeyInt, 3, commonus.GetSetpName(3), opinionCont) //写入审批流 //修改定性审批流状态 eiteScoreFlow := commonus.MapOut() @@ -274,7 +274,7 @@ func (a *ApiGroup) Operation(c *gin.Context) { case 6: //接受考核部门负责人(整改确认) commonus.StepAddData(orderIdInt, 16182159043990656, 5, 5, 1, 3, 6, userCont.Key) - commonus.WriteReplyLog(orderIdInt, scoreFlowInfo.DutyDepartment, scoreFlowInfo.EvaluationDepartment, scoreFlowInfo.EvaluationUser, 3, commonus.GetSetpName(5), opinionCont) //写入审批流 + commonus.WriteReplyLog(orderIdInt, scoreFlowInfo.DutyDepartment, founderDepartId, userKeyInt, 3, commonus.GetSetpName(5), opinionCont) //写入审批流 //修改定性审批流状态 eiteScoreFlow := commonus.MapOut() @@ -360,7 +360,7 @@ func (a *ApiGroup) Operation(c *gin.Context) { opinionCont = requestData.Content } //执行原因 - reason := fmt.Sprintf("原因:%v\n", opinionCont) + reason := fmt.Sprintf("审批意见:%v\n", opinionCont) //同意 switch evalProcessInfo.NextStep { @@ -377,7 +377,7 @@ func (a *ApiGroup) Operation(c *gin.Context) { //加分 commonus.StepAddData(orderIdInt, 16182159043990656, 0, 2, 1, 2, 2, userCont.Key) //审批步骤处理 - commonus.WriteReplyLog(orderIdInt, scoreFlowInfo.DutyDepartment, scoreFlowInfo.EvaluationDepartment, scoreFlowInfo.EvaluationUser, 2, commonus.GetSetpName(2), opinionCont) //写入审批流 + commonus.WriteReplyLog(orderIdInt, scoreFlowInfo.DutyDepartment, founderDepartId, userKeyInt, 2, commonus.GetSetpName(2), opinionCont) //写入审批流 //修改定性审批流状态 eiteScoreFlow := commonus.MapOut() eiteScoreFlow["sf_eite_time"] = time.Now().Unix() @@ -386,8 +386,8 @@ func (a *ApiGroup) Operation(c *gin.Context) { } else { //减分 quoteAreaTitle = fmt.Sprintf("考核减分:%v\n", scoreFloat64ToStringsss) - commonus.StepAddData(orderIdInt, 16182159043990656, 3, 2, 1, 2, 2, userCont.Key) //审批步骤处理 - commonus.WriteReplyLog(orderIdInt, scoreFlowInfo.DutyDepartment, scoreFlowInfo.EvaluationDepartment, scoreFlowInfo.EvaluationUser, 1, commonus.GetSetpName(2), opinionCont) //写入审批流 + commonus.StepAddData(orderIdInt, 16182159043990656, 3, 2, 1, 2, 2, userCont.Key) //审批步骤处理 + commonus.WriteReplyLog(orderIdInt, scoreFlowInfo.DutyDepartment, founderDepartId, userKeyInt, 1, commonus.GetSetpName(2), opinionCont) //写入审批流 //修改定性审批流状态 eiteScoreFlow := commonus.MapOut() @@ -445,11 +445,16 @@ func (a *ApiGroup) Operation(c *gin.Context) { //接受考核部门内勤(责任划分) case 4: //接受考核部门负责人(责任划分确认) + if scoreFlowInfo.PlusReduceScore == 1 { + quoteAreaTitle = fmt.Sprintf("考核加分:%v\n", scoreFloat64ToStringsss) + } else { + quoteAreaTitle = fmt.Sprintf("考核减分:%v\n", scoreFloat64ToStringsss) + } //是否需要整改 if scoreFlowInfo.Rectification == 1 { //需要整改 commonus.StepAddData(orderIdInt, 16182159043990656, 5, 7, 1, 2, 4, userCont.Key) - commonus.WriteReplyLog(orderIdInt, scoreFlowInfo.DutyDepartment, scoreFlowInfo.EvaluationDepartment, scoreFlowInfo.EvaluationUser, 2, commonus.GetSetpName(7), opinionCont) //写入审批流 + commonus.WriteReplyLog(orderIdInt, scoreFlowInfo.DutyDepartment, founderDepartId, userKeyInt, 2, commonus.GetSetpName(7), opinionCont) //写入审批流 //修改定性审批流状态 eiteScoreFlow := commonus.MapOut() eiteScoreFlow["sf_eite_time"] = time.Now().Unix() @@ -516,7 +521,7 @@ func (a *ApiGroup) Operation(c *gin.Context) { } else { //不要整改 commonus.StepAddData(orderIdInt, 16182159043990656, 0, 2, 1, 2, 4, userCont.Key) - commonus.WriteReplyLog(orderIdInt, scoreFlowInfo.DutyDepartment, scoreFlowInfo.EvaluationDepartment, scoreFlowInfo.EvaluationUser, 2, commonus.GetSetpName(2), opinionCont) //写入审批流 + commonus.WriteReplyLog(orderIdInt, scoreFlowInfo.DutyDepartment, founderDepartId, userKeyInt, 2, commonus.GetSetpName(2), opinionCont) //写入审批流 //修改定性审批流状态 eiteScoreFlow := commonus.MapOut() eiteScoreFlow["sf_eite_time"] = time.Now().Unix() @@ -582,7 +587,7 @@ func (a *ApiGroup) Operation(c *gin.Context) { case 6: //接受考核部门负责人(整改确认) commonus.StepAddData(orderIdInt, 16182159043990656, 0, 7, 1, 2, 6, userCont.Key) - commonus.WriteReplyLog(orderIdInt, scoreFlowInfo.DutyDepartment, scoreFlowInfo.EvaluationDepartment, scoreFlowInfo.EvaluationUser, 2, commonus.GetSetpName(7), opinionCont) //写入审批流 + commonus.WriteReplyLog(orderIdInt, scoreFlowInfo.DutyDepartment, founderDepartId, userKeyInt, 2, commonus.GetSetpName(7), opinionCont) //写入审批流 //修改定性审批流状态 eiteScoreFlow := commonus.MapOut() diff --git a/gin_server_admin/api/reply/qual/divisionrectification.go b/gin_server_admin/api/reply/qual/divisionrectification.go index b970fe2..1a691dc 100644 --- a/gin_server_admin/api/reply/qual/divisionrectification.go +++ b/gin_server_admin/api/reply/qual/divisionrectification.go @@ -12,9 +12,11 @@ import ( "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/flipped-aurora/gin-vue-admin/server/model/hrsystem" "github.com/gin-gonic/gin" ) +//责任划分 func (a *ApiGroup) DivisionResponsibility(c *gin.Context) { isTrue, userCont := commonus.ClientIdentity() if isTrue != true { @@ -56,6 +58,7 @@ func (a *ApiGroup) DivisionResponsibility(c *gin.Context) { return } } + orderId, _ := strconv.ParseInt(requestData.OrderId, 10, 64) //将字符串转化成int64 var evalProcessInfo assessmentmodel.EvaluationProcess evalErr := global.GVA_DB_Performanceappraisal.Where("ep_order_key = ?", requestData.OrderId).First(&evalProcessInfo).Error @@ -127,6 +130,7 @@ func (a *ApiGroup) DivisionResponsibility(c *gin.Context) { if userGroupErr == nil { saveDataCont.EvaluationGroup = userGroup //测评人集团 } + if v.Type != 3 { userKeyLen := len(v.UserKey) if userKeyLen < 1 { @@ -138,9 +142,14 @@ func (a *ApiGroup) DivisionResponsibility(c *gin.Context) { weightInt64, _ := strconv.ParseInt(strconv.FormatFloat(weightInt, 'f', -1, 64), 10, 64) //不是班组选项 for _, ua_v := range v.UserKey { - userConting, userIsTrue := commonus.GetWorkUser(ua_v) + // userConting, userIsTrue := commonus.GetWorkUser(ua_v) + // if userIsTrue == true { + // } + + userConting, userIsTrue := commonus.GetNewHrPeopleInfo(map[string]interface{}{"key": ua_v}) if userIsTrue == true { } + saveDataCont.UserName = userConting.Name saveDataCont.Weight = weightInt64 saveDataCont.Time = time.Now().Unix() @@ -148,9 +157,10 @@ func (a *ApiGroup) DivisionResponsibility(c *gin.Context) { saveDataCont.DistributionUser = commonus.GetFileNumberEs() saveDataCont.UserKey = userConting.Key - saveDataCont.Group = userConting.Group - saveDataCont.Department = userConting.DepartmentId - saveDataCont.Tema = userConting.Tema + saveDataCont.Group = userConting.Company + demtId, _ := strconv.ParseInt(userConting.Deparment, 10, 64) + saveDataCont.Department = demtId + saveDataCont.Tema = 0 if v.Type != 3 { userKeyAry = append(userKeyAry, userConting.Key) } @@ -159,10 +169,11 @@ func (a *ApiGroup) DivisionResponsibility(c *gin.Context) { case 1: zeren = "主要责任人" MainResponsiblePerson.UserKey = userConting.Key - MainResponsiblePerson.Group = userConting.Group - MainResponsiblePerson.Department = userConting.DepartmentId - MainResponsiblePerson.WorkshopId = userConting.WorkshopId - MainResponsiblePerson.Tema = userConting.Tema + MainResponsiblePerson.Group = userConting.Company + MainResponsiblePerson.Department = demtId + MainResponsiblePerson.WorkshopId = userConting.AdminOrg + MainResponsiblePerson.Tema = 0 + // usKeyInt, _ := strconv.ParseInt(ua_v, 10, 64) userKeyMainAry = append(userKeyMainAry, userConting.Key) case 2: zeren = "互保责任人" @@ -257,6 +268,7 @@ func (a *ApiGroup) DivisionResponsibility(c *gin.Context) { } } } + if len(saveDataAry) < 1 { response.Result(107, saveDataAry, "请检查您提交的要考核人员名单是否正确!", c) return @@ -270,6 +282,9 @@ func (a *ApiGroup) DivisionResponsibility(c *gin.Context) { } registerCont.EiteCont(map[string]interface{}{"id": registerCont.Id}, map[string]interface{}{"state": 2, "`time`": time.Now().Unix()}) + WritePersonLiable(orderId, userKeyMainAry) + // response.Result(107, userKeyMainAry, "请检查您提交的要考核人员名单是否正确!", c) + // return //修改定性审批流状态 eiteScoreFlow := commonus.MapOut() eiteScoreFlow["sf_eite_time"] = time.Now().Unix() @@ -534,3 +549,74 @@ func (a *ApiGroup) AmendMeasures(c *gin.Context) { outMap["setval"] = 41 response.Result(0, outMap, "数据写入成功", c) } + +//写入责任节点 +func WritePersonLiable(flowKey int64, userKey []int64) { + var userAry []hrsystem.Personnel + userAryErr := global.GVA_DB_HrDataBase.Model(&hrsystem.Personnel{}).Where("`key` IN ?", userKey).Find(&userAry).Error + var userFlow []commonus.UserListFlowAll + // fmt.Printf("userAry---->%v\n", userAry) + if userAryErr == nil { + for _, uv := range userAry { + var usFlowInfo commonus.UserListFlowAll + + usFlowInfo.Id = strconv.FormatInt(uv.Key, 10) // `json:"id"` //操作人ID + usFlowInfo.Name = uv.Name // `json:"name"` //操作人姓名 + usFlowInfo.Icon = uv.Icon // `json:"icon"` //操作人头像 + usFlowInfo.Wechat = uv.Wechat + if uv.WorkWechat != "" { + usFlowInfo.Wechat = uv.WorkWechat // `json:"wechat"` //微信Openid + } + whereGroup := commonus.MapOut() + whereGroup["id"] = uv.Company + orgContGroup, _ := commonus.GetNewOrgCont(whereGroup, "name") + usFlowInfo.Group = uv.Company // `json:"group"` //集团公司 + usFlowInfo.GroupName = orgContGroup.Name // `json:"groupname"` //分厂名称 + departId, _ := strconv.ParseInt(uv.Deparment, 10, 64) + usFlowInfo.DepartmentId = departId // `json:"departmentid"` //分厂Id + whereDepart := commonus.MapOut() + whereDepart["id"] = uv.Deparment + orgContDepart, _ := commonus.GetNewOrgCont(whereDepart, "name") + usFlowInfo.DepartmentName = orgContDepart.Name // `json:"departmentname"` //分厂名称 + usFlowInfo.WorkshopId = uv.AdminOrg // `json:"workshopid"` //工段Id + wherePost := commonus.MapOut() + wherePost["id"] = uv.AdminOrg + orgContPost, _ := commonus.GetNewOrgCont(wherePost, "name") + usFlowInfo.WorkshopName = orgContPost.Name // `json:"workshopname"` //工段名称 + usFlowInfo.PostId = uv.Position // `json:"postid"` //职务Id + var zhiWuInfo hrsystem.Position + zhiWuInfo.GetCont(map[string]interface{}{"`id`": uv.Position}, "`name`") + usFlowInfo.PostName = zhiWuInfo.Name // `json:"postname"` //职务名称 + usFlowInfo.Tema = 1 // `json:"tema"` //班组Id + usFlowInfo.TemaName = "" // `json:"temaname"` //班组名称 + userFlow = append(userFlow, usFlowInfo) + } + + } + //获取流程内容 + var flowCont string + err := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.EvaluationProcess{}).Select("`ep_next_cont`").Where("`ep_order_key` = ?", flowKey).First(&flowCont).Error + // fmt.Printf("flowCont--------------->%v\n", flowCont) + if err == nil { + var twoFlowInfo []commonus.FlowAllMap + jsonErr := json.Unmarshal([]byte(flowCont), &twoFlowInfo) + + // fmt.Printf("jsonErr--------------->%v\n", jsonErr) + if jsonErr == nil { + for i, v := range twoFlowInfo { + if v.Step == 5 { + twoFlowInfo[i].UserList = userFlow + } + } + } + // fmt.Printf("userFlow--------------->%v\n", userFlow) + // fmt.Printf("twoFlowInfo--------------->%v\n", twoFlowInfo) + saveData := commonus.MapOut() + jsonShenPiCont, jsonShenPiErr := json.Marshal(twoFlowInfo) + if jsonShenPiErr == nil { + saveData["ep_next_cont"] = string(jsonShenPiCont) + global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.EvaluationProcess{}).Where("`ep_order_key` = ?", flowKey).Updates(&saveData) + } + + } +} diff --git a/gin_server_admin/api/reply/quan/controller.go b/gin_server_admin/api/reply/quan/controller.go new file mode 100644 index 0000000..afbc1d1 --- /dev/null +++ b/gin_server_admin/api/reply/quan/controller.go @@ -0,0 +1,173 @@ +package quan + +import ( + "fmt" + "strconv" + "strings" + "time" + + "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" + "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 (a *ApiGroup) Sanction(c *gin.Context) { + isTrue, userCont := commonus.ClientIdentity() + if isTrue != true { + response.Result(1001, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c) + return + } + founderDepartId, _ := strconv.ParseInt(userCont.Deparment, 10, 64) + founderUserKey, _ := strconv.ParseInt(userCont.Key, 10, 64) + + var requestData ApprovalParameters + err := c.ShouldBindJSON(&requestData) + if err != nil { + response.Result(101, err, "参数错误!请重新提交!", c) + return + } + if requestData.OrderId == "" { + response.Result(102, err, "参数错误!请重新提交!", c) + return + } + + var evalProcessInfo assessmentmodel.EvaluationProcess + evalErr := global.GVA_DB_Performanceappraisal.Where("ep_order_key = ?", requestData.OrderId).First(&evalProcessInfo).Error + if evalErr != nil { + response.Result(103, err, "审批流不存在!请检查您的数据!", c) + return + } + if evalProcessInfo.State == 3 || evalProcessInfo.NextStep <= 0 { + response.Result(104, err, "该流程已结束!不可进行操作!", c) + return + } + if evalProcessInfo.NextContent == "" { + response.Result(105, err, "对不起!您没有权限对此流程进行操作!", c) + return + } + nextReplyUserMap := strings.Split(evalProcessInfo.NextExecutor, ",") + // fmt.Printf("userCont.Key:%v\n", userCont.Key) + if commonus.IsItTrueString(userCont.Key, nextReplyUserMap) == false { + response.Result(106, nextReplyUserMap, "对不起!您没有权限对此流程进行操作!", c) + return + } + + orderIdInt, _ := strconv.ParseInt(requestData.OrderId, 10, 64) //流程Key + + var flowlogMap assessmentmodel.FlowLog + flmErr := global.GVA_DB_Performanceappraisal.Where("fl_key = ?", orderIdInt).First(&flowlogMap).Error + if flmErr != nil { + response.Result(103, err, "审批流不存在!请检查您的数据!", c) + return + } + + if requestData.YesOrNo != 1 { + //驳回 + opinionCont := "驳回" + if requestData.Content != "" { + opinionCont = requestData.Content + } + commonus.StepAddData(orderIdInt, 16182159043990656, 0, 2, 2, 2, 2, userCont.Key) //审批步骤处理 + commonus.WriteReplyLog(orderIdInt, flowlogMap.DutyDepartment, founderDepartId, founderUserKey, 3, commonus.GetSetpName(2), opinionCont) //写入审批流 + //修改定性审批流状态 + eiteScoreFlow := commonus.MapOut() + eiteScoreFlow["fl_eite_time"] = time.Now().Unix() + eiteScoreFlow["fl_reply"] = 4 + global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.FlowLog{}).Where("`fl_key` = ?", requestData.OrderId).Updates(&eiteScoreFlow) + + evalProcSaveData := commonus.MapOut() + evalProcSaveData["ep_state"] = 4 + evalProcSaveData["ep_time"] = time.Now().Unix() + global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.EvaluationProcess{}).Where("`ep_order_key` = ?", orderIdInt).Updates(&evalProcSaveData) + + //2.3、获取发起人信息 + var sendUser string = "" + // faQiRen, _ := commonus.GetWorkUser(strconv.FormatInt(scoreFlowInfo.EvaluationUser, 10)) + faQiRen, _ := commonus.GetNewHrPeopleInfo(map[string]interface{}{"`key`": flowlogMap.EvaluationUser}, "`wechat`", "`work_wechat`") + if faQiRen.Wechat != "" { + sendUser = faQiRen.Wechat + } + if faQiRen.WorkWechat != "" { + sendUser = faQiRen.WorkWechat + } + + registerNumber := commonus.GetFileNumberEs() + + title := fmt.Sprintf("%v-%v数据表", flowlogMap.Year, flowlogMap.Month) + desc := "" + mainTitleDesc := "数据详情:" + reason := "" + evalPlanIdAry := strings.Split(flowlogMap.EvaluationPlan, ",") + if len(evalPlanIdAry) > 0 { + var qeInfo []assessmentmodel.QualitativeEvaluation + judgeErr := global.GVA_DB_Performanceappraisal.Where("`qe_id` IN ?", evalPlanIdAry).First(&qeInfo).Error + if judgeErr == nil { + for _, qev := range qeInfo { + tarInfo, _ := commonus.GetTargetInfo(qev.Target) + reason = fmt.Sprintf("%\n%v :%v%v", reason, tarInfo.Title, flowlogMap.Score, qev.Unit) + } + } + } + + //审批卡片跳转链接 + cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v&num=%v", orderIdInt, strconv.FormatInt(registerNumber, 10)) + jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v&num=%v", orderIdInt, strconv.FormatInt(registerNumber, 10)) + + jumpUrlTitle := "请前往处理" + sourceDesc := "驳回" + twoLevelTitle := "审批信息:" + + twoLevelKeyName := "" + departmentId, _ := strconv.ParseInt(userCont.Deparment, 10, 64) + execDerpat, execDerpatErr := commonus.GetNewOrgCont(departmentId) + if execDerpatErr == nil { + twoLevelKeyName = execDerpat.Name + } + var twoLevelKeyValue string = "" + var twoLevelUserId string = "" + //获取操作人 + if userCont.Wechat != "" { + userWechatErr, userWechat := commonus.GetUesrContForWechatID(userCont.Wechat) + if userWechatErr == true { + twoLevelKeyValue = userWechat.Name + twoLevelUserId = userCont.Wechat + } + } + + var sendTextMsg sendmessage.TextNoticeTemplateMedium + callbakcMsg, isTrueCall, callBackCont := sendTextMsg.SendMsgTextShare(sendUser, strconv.FormatInt(registerNumber, 10), title, desc, mainTitleDesc, reason, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, cardJumpUrl, jumpUrl, jumpUrlTitle, sourceDesc) + + outMap := commonus.MapOut() + outMap["callbakcMsg"] = string(callbakcMsg) + outMap["isTrueCall"] = isTrueCall + outMap["callBackCont"] = callBackCont + outMap["setval"] = 1 + outMap["sendUser"] = sendUser + + response.Result(0, outMap, "数据提交成功!", c) + + } else { + //同意 + opinionCont := "同意" + if requestData.Content != "" { + opinionCont = requestData.Content + } + commonus.StepAddData(orderIdInt, 16182159043990656, 0, 2, 2, 2, 2, userCont.Key) //审批步骤处理 + commonus.WriteReplyLog(orderIdInt, flowlogMap.DutyDepartment, founderDepartId, founderUserKey, 2, commonus.GetSetpName(2), opinionCont) //写入审批流 + //修改定性审批流状态 + eiteScoreFlow := commonus.MapOut() + eiteScoreFlow["fl_eite_time"] = time.Now().Unix() + eiteScoreFlow["fl_reply"] = 3 + global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.FlowLog{}).Where("`fl_key` = ?", requestData.OrderId).Updates(&eiteScoreFlow) + response.Result(0, opinionCont, "数据提交成功!", c) + evalProcSaveData := commonus.MapOut() + evalProcSaveData["ep_state"] = 3 + evalProcSaveData["ep_time"] = time.Now().Unix() + global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.EvaluationProcess{}).Where("`ep_order_key` = ?", orderIdInt).Updates(&evalProcSaveData) + } + +} diff --git a/gin_server_admin/api/reply/quan/enter.go b/gin_server_admin/api/reply/quan/enter.go index ce685d1..8853f9e 100644 --- a/gin_server_admin/api/reply/quan/enter.go +++ b/gin_server_admin/api/reply/quan/enter.go @@ -15,3 +15,37 @@ func (a *ApiGroup) Index(c *gin.Context) { outPut := commonus.MapOut() response.Result(0, outPut, "定量审批端获取成功", c) } + +//添加定量考核 +type AddRationFlowLog struct { + GroupId string `json:"groupid"` + DepartmentID string `json:"departmentid"` + Addtime string `json:"time"` //检查时间 + PlanVersionNumber string `json:"planversionnumber"` //版本号 + List []RationLogList `json:"list"` +} + +type RationLogList struct { + Id string `json:"id"` + // Score int64 `json:"score` + Actual string `json:"actual` + Unit string `json:"unit` + TargetName string `json:"targetname"` //原因 + Reason string `json:"reason"` //原因 + Enclosure []string `json:"enclosure"` //附件 + ScoringMethod int `json:"scoringmethod"` //计分方式(1:自动;2:手动)"` + ScoringScore float64 `json:"scoringscore"` //手动分"` + // PlanVersionNumber string `json:"planversionnumber"` //版本号 +} + +//审批参数 +type ApprovalParameters struct { + OrderId string `json:"orderid"` //流程单KEY + YesOrNo int `json:"yesorno"` //1:同意;2:驳回 + Content string `json:"content"` //审批意见 +} + +type orderIdOrNumber struct { + OrderId string `json:"id"` //流程单KEY + Number string `json:"number"` //1:同意;2:驳回 +} diff --git a/gin_server_admin/api/reply/quan/ration.go b/gin_server_admin/api/reply/quan/ration.go new file mode 100644 index 0000000..30aa0d9 --- /dev/null +++ b/gin_server_admin/api/reply/quan/ration.go @@ -0,0 +1,332 @@ +package quan + +import ( + "encoding/json" + "fmt" + "strconv" + "strings" + "time" + + "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" + "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 (a *ApiGroup) SendRationFlow(c *gin.Context) { + isTrue, userCont := commonus.ClientIdentity() + if isTrue != true { + response.Result(1001, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c) + return + } + userKey, userKeyErr := strconv.ParseInt(userCont.Key, 10, 64) + if userKeyErr != nil { + response.Result(102, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c) + return + } + departmentId, departmentIdErr := strconv.ParseInt(userCont.Deparment, 10, 64) + if departmentIdErr != nil { + response.Result(103, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c) + return + } + userGroup, userGroupErr := strconv.ParseInt(userCont.Company, 10, 64) + if userGroupErr != nil { + response.Result(104, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c) + return + } + + todaying := commonus.ComputingTime(time.Now().Unix(), 5) + + if todaying > 10 { + // response.Result(1051, todaying, "不在可提交数据提时间期限内!不可提交数据。请每月10号前提交数据!。", c) + // return + } + + var requestData AddRationFlowLog + err := c.ShouldBindJSON(&requestData) + if err != nil { + response.Result(105, err, "数据获取失败!", c) + return + } + if requestData.GroupId == "" { + response.Result(106, err, "数据异常!", c) + return + } + if requestData.DepartmentID == "" { + response.Result(107, err, "数据异常!", c) + return + } + if len(requestData.List) < 1 { + response.Result(108, err, "没有要考核的项目", c) + return + } + + //判断是否已经添加的条件 + existenceProess := commonus.MapOut() + existenceProess["fl_planversion"] = requestData.PlanVersionNumber + + operationTime := time.Now().Unix() + keyNumber := commonus.GetFileNumberEs() + var flowLog assessmentmodel.FlowLog + + flowLog.Key = keyNumber + flowLog.Time = time.Now().Unix() + flowLog.EiteTime = time.Now().Unix() + flowLog.PlanVersion = requestData.PlanVersionNumber + if requestData.Addtime != "" { + timeOccurrence := commonus.DateToTimeStamp(requestData.Addtime) //发生时间 + flowLog.Year = commonus.ComputingTime(timeOccurrence, 1) + flowLog.Quarter = commonus.ComputingTime(timeOccurrence, 2) + flowLog.Month = commonus.ComputingTime(timeOccurrence, 3) + flowLog.Week = commonus.ComputingTime(timeOccurrence, 4) + flowLog.ToDay = commonus.ComputingTime(timeOccurrence, 5) + + existenceProess["fl_year"] = commonus.ComputingTime(timeOccurrence, 1) + existenceProess["fl_quarter"] = commonus.ComputingTime(timeOccurrence, 2) + existenceProess["fl_month"] = commonus.ComputingTime(timeOccurrence, 3) + existenceProess["fl_week"] = commonus.ComputingTime(timeOccurrence, 4) + existenceProess["fl_day"] = commonus.ComputingTime(timeOccurrence, 5) + + } else { + lastMonth, _, _ := commonus.GetLastMonth() + + lastMonthInt, lastMonthErr := commonus.DateToTimeStampEs(fmt.Sprintf("%v-10 12:00:00", lastMonth)) + if lastMonthErr == true { + operationTime = lastMonthInt + } + flowLog.Year = commonus.ComputingTime(operationTime, 1) + flowLog.Quarter = commonus.ComputingTime(operationTime, 2) + flowLog.Month = commonus.ComputingTime(operationTime, 3) + flowLog.Week = commonus.ComputingTime(operationTime, 4) + flowLog.ToDay = commonus.ComputingTime(operationTime, 5) + + existenceProess["fl_year"] = commonus.ComputingTime(operationTime, 1) + existenceProess["fl_quarter"] = commonus.ComputingTime(operationTime, 2) + existenceProess["fl_month"] = commonus.ComputingTime(operationTime, 3) + existenceProess["fl_week"] = commonus.ComputingTime(operationTime, 4) + existenceProess["fl_day"] = commonus.ComputingTime(operationTime, 5) + } + + flowLog.EvaluationDepartment = departmentId + flowLog.EvaluationUser = userKey + flowLog.EvaluationGroup = userGroup + + // existenceProess["fl_evaluation_department"] = departmentId + // existenceProess["fl_evaluation_user"] = userKey + // existenceProess["fl_evaluation_group"] = userGroup + + dutyGroup, dutyGroupErr := strconv.ParseInt(requestData.GroupId, 10, 64) + if dutyGroupErr == nil { + flowLog.DutyGroup = dutyGroup + existenceProess["fl_duty_group"] = dutyGroup + } + departIdInt, departIdIntErr := strconv.ParseInt(requestData.DepartmentID, 10, 64) + if departIdIntErr == nil { + flowLog.DutyDepartment = departIdInt + existenceProess["fl_duty_department"] = departIdInt + } + flowLog.Reply = 2 + var evaluationIdStr string + global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.FlowLog{}).Select("fl_evaluation_id").Where(existenceProess).First(&evaluationIdStr) + var evaluationIdStrAry []string + if evaluationIdStr != "" { + evaluationIdStrAry = strings.Split(evaluationIdStr, ",") + } + + var flowDataLogAry []assessmentmodel.FlowLogData + var reason string + var evaluationPlan []string //方案ID + var yiTianJianMingc []string + // jsonMapStr, _ := json.Marshal(requestData.List) + json.Marshal(requestData.List) + //fmt.Printf("OutJsonMap-----1------>%\n", string(jsonMapStr)) + for i, v := range requestData.List { + + if len(evaluationIdStrAry) > 0 { + if commonus.IsItTrueString(v.Id, evaluationIdStrAry) == false { + var flowDataLog assessmentmodel.FlowLogData + evaluationPlan = append(evaluationPlan, v.Id) + evaluationPlanid, evaluationPlanidErr := strconv.ParseInt(v.Id, 10, 64) + if evaluationPlanidErr == nil { + flowDataLog.EvaluationPlan = evaluationPlanid + } + flowDataLog.Key = keyNumber + flowDataLog.Score = commonus.GetDuyCycle(v.Actual, 100) + flowDataLog.Content = v.Reason + flowDataLog.Enclosure = strings.Join(v.Enclosure, ",") + if v.ScoringMethod == 2 { + flowDataLog.ScoringMethod = 2 + flowDataLog.ScoringScore = v.ScoringScore + } else { + flowDataLog.ScoringMethod = 1 + flowDataLog.ScoringScore = 0 + } + // flowDataLog.PlanVersion = v.PlanVersionNumber + flowDataLog.Time = time.Now().Unix() + targetInfo, targetInfoErr := commonus.GetQualitativeEvaluation(strconv.FormatInt(evaluationPlanid, 10)) + tarInfo, _ := commonus.GetTargetInfo(targetInfo.Target) + if i == 0 { + if targetInfoErr == true { + if v.Reason != "" { + reason = fmt.Sprintf("%v :%v%v\n备注:%v", tarInfo.Title, v.Actual, v.Unit, v.Reason) + } else { + reason = fmt.Sprintf("%v :%v%v", tarInfo.Title, v.Actual, v.Unit) + } + + } + } else { + if targetInfoErr == true { + if v.Reason != "" { + reason = fmt.Sprintf("%v\n%v :%v%v\n备注:%v", reason, tarInfo.Title, v.Actual, v.Unit, v.Reason) + } else { + reason = fmt.Sprintf("%v\n%v :%v%v", reason, tarInfo.Title, v.Actual, v.Unit) + } + + } + } + flowDataLogAry = append(flowDataLogAry, flowDataLog) + } else { + yiTianJianMingc = append(yiTianJianMingc, v.TargetName) + } + } else { + var flowDataLog assessmentmodel.FlowLogData + evaluationPlan = append(evaluationPlan, v.Id) + evaluationPlanid, evaluationPlanidErr := strconv.ParseInt(v.Id, 10, 64) + if evaluationPlanidErr == nil { + flowDataLog.EvaluationPlan = evaluationPlanid + } + flowDataLog.Key = keyNumber + flowDataLog.Score = commonus.GetDuyCycle(v.Actual, 100) + flowDataLog.Content = v.Reason + flowDataLog.Enclosure = strings.Join(v.Enclosure, ",") + if v.ScoringMethod == 2 { + flowDataLog.ScoringMethod = 2 + flowDataLog.ScoringScore = v.ScoringScore + } else { + flowDataLog.ScoringMethod = 1 + flowDataLog.ScoringScore = 0 + } + flowDataLog.PlanVersion = requestData.PlanVersionNumber + flowDataLog.Time = time.Now().Unix() + targetInfo, targetInfoErr := commonus.GetQualitativeEvaluation(strconv.FormatInt(evaluationPlanid, 10)) + tarInfo, _ := commonus.GetTargetInfo(targetInfo.Target) + if i == 0 { + if targetInfoErr == true { + if v.Reason != "" { + reason = fmt.Sprintf("%v :%v%v\n备注:%v", tarInfo.Title, v.Actual, v.Unit, v.Reason) + } else { + reason = fmt.Sprintf("%v :%v%v", tarInfo.Title, v.Actual, v.Unit) + } + + } + } else { + if targetInfoErr == true { + if v.Reason != "" { + reason = fmt.Sprintf("%v\n%v :%v%v\n备注:%v", reason, tarInfo.Title, v.Actual, v.Unit, v.Reason) + } else { + reason = fmt.Sprintf("%v\n%v :%v%v", reason, tarInfo.Title, v.Actual, v.Unit) + } + + } + } + flowDataLogAry = append(flowDataLogAry, flowDataLog) + } + + } + gromDb := global.GVA_DB_Performanceappraisal.Begin() + + flowLog.EvaluationPlan = strings.Join(evaluationPlan, ",") + if len(flowDataLogAry) <= 0 { + response.Result(0, yiTianJianMingc, "您的数据已经提交!请不要重复提交!", c) + return + } + addFlowLogErr := gromDb.Create(&flowLog).Error + addFlowLogDataErr := gromDb.Create(&flowDataLogAry).Error + if addFlowLogErr == nil && addFlowLogDataErr == nil { + affairDbErr := gromDb.Commit().Error + if affairDbErr == nil { + commonus.StepAddData(keyNumber, 16182159043990656, 2, 7, 2, 2, 1, userCont.Key) + commonus.WriteReplyLog(keyNumber, departIdInt, departmentId, userKey, 1, commonus.GetSetpName(1), "提交申请") + sendUserIsTrue, sendUserList := commonus.GetSendMsgUser(16182159043990656, departIdInt) //获取对应部门负责人 + if sendUserIsTrue != true { + response.Result(0, sendUserList, "未指定相关部门处理人!未能向相关人员发送考核项目!请手动发起!", c) + return + } + + title := fmt.Sprintf("%v数据表", commonus.TimeStampToDate(operationTime, 10)) + desc := "" + mainTitleDesc := "数据详情:" + //将步骤写入 判断该步骤是否已经操作 + registerNumber := commonus.GetFileNumberEs() + var registerContIng assessmentmodel.Register + registerContIng.Number = registerNumber + registerContIng.State = 1 + registerContIng.Time = time.Now().Unix() + registerContIng.AddCont() + //审批卡片跳转链接 + cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/quantitativeList?id=%v&num=%v", keyNumber, strconv.FormatInt(registerNumber, 10)) + jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/quantitativeList?id=%v&num=%v", keyNumber, strconv.FormatInt(registerNumber, 10)) + + jumpUrlTitle := "请前往处理" + sourceDesc := "审批" + twoLevelTitle := "审批信息:" + + twoLevelKeyName := "" + execDerpat, execDerpatErr := commonus.GetNewOrgCont(departmentId) + if execDerpatErr == nil { + twoLevelKeyName = execDerpat.Name + } + var twoLevelKeyValue string = "" + var twoLevelUserId string = "" + //获取操作人 + if userCont.Wechat != "" { + userWechatErr, userWechat := commonus.GetUesrContForWechatID(userCont.Wechat) + if userWechatErr == true { + twoLevelKeyValue = userWechat.Name + twoLevelUserId = userCont.Wechat + } + } + + var sendTextMsg sendmessage.TextNoticeTemplateMedium + callbakcMsg, isTrueCall, callBackCont := sendTextMsg.SendMsgTextShare(sendUserList, strconv.FormatInt(registerNumber, 10), title, desc, mainTitleDesc, reason, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, cardJumpUrl, jumpUrl, jumpUrlTitle, sourceDesc) + + //发送文本信息通用 + /*SendMsgTextShare(sendUserList, taskId, title, desc, quoteAreaTitle, quoteAreaContent, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, cardJumpUrl, jumpUrl, jumpUrlTitle, sourceDesc string) (callbakcMsg []byte, isTrueCall bool, callBackCont string) + @sendUserList 信息接收人 + @taskId 任务id,同一个应用任务id不能重复,只能由数字、字母和“_-@”组成,最长128字节,填了action_menu字段的话本字段必填 + @Title 一级标题,建议不超过36个字, + @Desc 标题辅助信息,建议不超过44个字 + @quoteAreaTitle 引用文献标题 + @quoteAreaContent 引用文献内容 + @twoLevelTitle 二级文本标题 + @twoLevelKeyName 二级标题,建议不超过5个字 + @twoLevelValue 二级文本,如果horizontal_content_list.type是2,该字段代表文件名称(要包含文件类型),建议不超过30个字, + @twoLevelUserId 成员详情的userid,horizontal_content_list.type是3时必填 + @cardJumpUrl 整体卡片跳转链接 + @jumpUrl 底部标题跳转链接 + @jumpUrlTitle 跳转链接文案 + @sourceDesc 左上角标题 + */ + + outMap := commonus.MapOut() + outMap["callbakcMsg"] = string(callbakcMsg) + outMap["isTrueCall"] = isTrueCall + outMap["callBackCont"] = callBackCont + outMap["setval"] = 1 + + response.Result(0, outMap, "数据提交成功!", c) + } else { + gromDb.Rollback() + response.Result(118, yiTianJianMingc, "数据提交失败!", c) + } + } else { + affairDbErr := gromDb.Rollback().Error + if affairDbErr == nil { + response.Result(119, yiTianJianMingc, "数据提交失败!", c) + } else { + response.Result(120, yiTianJianMingc, "数据提交失败!", c) + } + } +} diff --git a/gin_server_admin/api/v1/shiyan/shiyan.go b/gin_server_admin/api/v1/shiyan/shiyan.go index f6e8a66..b12d22d 100644 --- a/gin_server_admin/api/v1/shiyan/shiyan.go +++ b/gin_server_admin/api/v1/shiyan/shiyan.go @@ -35,9 +35,22 @@ func (a *ShiyanApi) AddBaseMenu(c *gin.Context) { // } // fmt.Printf("%v\n", answerMap) commonus.GetLastMonth() + // Fanxing[string]("123", []string{"ddf"}) response.Ok(c) } +type faxingType interface { +} + +// func Fanxing[T any](key T, keyAry []T) bool { +// for _, v := range keyAry { +// if v == key { +// return false +// } +// } +// return true +// } + //get请求获参 func (a *ShiyanApi) GetRequestOperation(c *gin.Context) { id := c.Query("id") diff --git a/gin_server_admin/api/wechatapp/callback/apphandle.go b/gin_server_admin/api/wechatapp/callback/apphandle.go index c87ecd3..573f01e 100644 --- a/gin_server_admin/api/wechatapp/callback/apphandle.go +++ b/gin_server_admin/api/wechatapp/callback/apphandle.go @@ -127,7 +127,7 @@ func (c *CallBackData) DecryptMessage(cs *gin.Context) (echoMsg string) { case "voice": //语音 case "video": //视频 case "location": //位置 - + GeographicalPosition(msg) case "link": //链接 /*事件格式类型*/ case "event": diff --git a/gin_server_admin/commonus/publichaneld.go b/gin_server_admin/commonus/publichaneld.go index 895b067..30438f8 100644 --- a/gin_server_admin/commonus/publichaneld.go +++ b/gin_server_admin/commonus/publichaneld.go @@ -1725,6 +1725,9 @@ func StepAddData(flowID, roleGroupId int64, nextStep, stepName, typeclass, state var flowStep FlowStep flowStep.Step = evalProCont.Step + 1 flowStep.StepName = GetSetpName(stepName) //步骤名称 + // if nextStep <= 0 { + // flowStep.StepName = GetSetpName(6) //步骤名称 + // } flowStep.Key = strconv.FormatInt(flowID, 10) flowStep.State = 2 flowStep.RoleGroup = roleGroupId @@ -1879,6 +1882,9 @@ func StepAddDataEs(flowID, roleGroupId int64, nextStep, stepName, typeclass, sta var flowStep FlowStep flowStep.Step = evalProCont.Step + 1 flowStep.StepName = GetSetpName(stepName) //步骤名称 + if nextStep <= 0 { + flowStep.StepName = GetSetpName(6) //步骤名称 + } flowStep.Key = strconv.FormatInt(flowID, 10) flowStep.State = 2 flowStep.RoleGroup = roleGroupId diff --git a/gin_server_admin/model/assessmentmodel/performance_appraisal.go b/gin_server_admin/model/assessmentmodel/performance_appraisal.go index ea8d049..64b3840 100644 --- a/gin_server_admin/model/assessmentmodel/performance_appraisal.go +++ b/gin_server_admin/model/assessmentmodel/performance_appraisal.go @@ -70,7 +70,7 @@ type EvaluationProcess struct { 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:驳回;"` + 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:角色组"` 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:参与人"` diff --git a/gin_server_admin/router/replyrouter/enter.go b/gin_server_admin/router/replyrouter/enter.go index 1b4a9af..33ad6f2 100644 --- a/gin_server_admin/router/replyrouter/enter.go +++ b/gin_server_admin/router/replyrouter/enter.go @@ -17,6 +17,9 @@ func (r *RouterGroup) InitShiyanRouter(Router *gin.RouterGroup) { quanRouter.GET("", quanApi.Index) //入口 quanRouter.GET("/", quanApi.Index) //入口 + quanRouter.POST("operation", quanApi.SendRationFlow) //提交定量审核 + quanRouter.POST("sanction", quanApi.Sanction) //定量审核通过或者驳回 + } qualRouter := Router.Group("qual") //定性 var qualApi = reply.ApiGroupApp.QualApiGroup