Browse Source

修改审批状态

v1_dev_2
超级管理员 3 years ago
parent
commit
87951fd2c9
  1. 10
      README.md
  2. 54
      api/version1/postseting/postpc/scheme.go
  3. 2
      api/version1/postseting/postpc/type.go
  4. 136
      api/version1/postseting/postweb/appflowlog.go
  5. 30
      api/version1/postseting/postweb/flowmap.go
  6. 42
      api/version1/postseting/postweb/postration.go
  7. 219
      api/version1/postseting/postweb/posttarget.go
  8. 64
      api/version1/postseting/postweb/type.go
  9. 5
      apirouter/v1/postseting/web.go
  10. 8
      middleware/wechatapp/wechatcallback/event_processing.go
  11. 119
      models/modelskpi/app_flow_log.go
  12. 95
      models/modelskpi/app_new_flow_log.go
  13. 58
      models/modelskpi/depart_dime_post_weight.go
  14. 86
      models/modelskpi/nature_flow_order.go
  15. 1
      models/modelskpi/post_nature_flow.go
  16. 8
      models/modelskpi/post_workflow_orders.go
  17. 49
      overall/publicmethod/technique.go

10
README.md

@ -411,3 +411,13 @@ CREATE TABLE `operator_is_true` (
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COMMENT='当前节点是否可操作'; ) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COMMENT='当前节点是否可操作';
``` ```
<span style="color:#D98719; font-size:20px;">
Time:2022-10-24 <br>
数据库增加 定性考核与流程关联视图 nature_flow_order
</span>
```
select `pf`.`id` AS `id`,`pf`.`order_id` AS `order_id`,`pf`.`add_or_decrease` AS `add_or_decrease`,`pf`.`score` AS `score`,`pf`.`money` AS `money`,`pf`.`reason` AS `reason`,`pf`.`sheme_id` AS `sheme_id`,`pf`.`sheme_version` AS `sheme_version`,`pf`.`dimension` AS `dimension`,`pf`.`target` AS `target`,`pf`.`son_target` AS `son_target`,`pf`.`detailed` AS `detailed`,`pf`.`year` AS `year`,`pf`.`quarter` AS `quarter`,`pf`.`month` AS `month`,`pf`.`week` AS `week`,`pf`.`person_liable` AS `person_liable`,`pf`.`company_id` AS `company_id`,`pf`.`department_id` AS `department_id`,`pf`.`org_id` AS `org_id`,`pf`.`post_id` AS `post_id`,`pf`.`executor` AS `executor`,`pf`.`executor_department` AS `executor_department`,`pf`.`rectification` AS `rectification`,`pf`.`correction_time` AS `correction_time`,`pf`.`happen_time` AS `happen_time`,`pf`.`happen_count` AS `happen_count`,`pf`.`time` AS `time`,`po`.`class` AS `class`,`po`.`state` AS `state`,`po`.`participants` AS `participants` from (`post_nature_flow` `pf` left join `post_workflow_orders` `po` on((`pf`.`order_id` = `po`.`order_id`)))
```

54
api/version1/postseting/postpc/scheme.go

@ -184,7 +184,7 @@ func (p *postDimeTarSync) GetPostTargent(position modelshr.Position, dutyClass m
@isQuote 1不是引用2引用部门 @isQuote 1不是引用2引用部门
getPostDimeTarWeight(orgid, postid, dimensionid, targetid int64, hierarchy, isQuote int) getPostDimeTarWeight(orgid, postid, dimensionid, targetid int64, hierarchy, isQuote int)
*/ */
func getPostDimeTarWeight(orgid, postid, dimensionid, targetid int64, hierarchy, isQuote int) int64 { func getPostDimeTarWeight(orgid, postid, dimensionid, targetid int64, hierarchy, isQuote int) float64 {
if hierarchy == 0 { if hierarchy == 0 {
hierarchy = 2 hierarchy = 2
} }
@ -463,6 +463,9 @@ func postSchemeTargetPost(versionNumber string, source, judgeState int, scheme [
var xizeXiecheng postShemeListCont var xizeXiecheng postShemeListCont
for _, v := range scheme { //解析维度 for _, v := range scheme { //解析维度
dimensionIdInt64, _ := strconv.ParseInt(v.Id, 10, 64) //转换维度ID dimensionIdInt64, _ := strconv.ParseInt(v.Id, 10, 64) //转换维度ID
syncSetingRun.Add(1)
go xieChengWeight(0, orgid, postid, dimensionIdInt64, 0, 1, 1, v.Score) //添加维度分值记录
if len(v.Child) > 0 { //判断是否有指标 if len(v.Child) > 0 { //判断是否有指标
for _, cv := range v.Child { //解析指标 for _, cv := range v.Child { //解析指标
targetIdInt64, _ := strconv.ParseInt(cv.Id, 10, 64) //转换指标ID targetIdInt64, _ := strconv.ParseInt(cv.Id, 10, 64) //转换指标ID
@ -474,6 +477,9 @@ func postSchemeTargetPost(versionNumber string, source, judgeState int, scheme [
if departPostTargetInfo.ScoringMethod != 0 { if departPostTargetInfo.ScoringMethod != 0 {
scoringMethod = departPostTargetInfo.ScoringMethod scoringMethod = departPostTargetInfo.ScoringMethod
} }
syncSetingRun.Add(1)
go xieChengWeight(int64(cv.Type), orgid, postid, dimensionIdInt64, targetIdInt64, 2, 1, cv.Score)
if cv.Type != 1 { //定量考核 if cv.Type != 1 { //定量考核
//判断该指标是否存在 //判断该指标是否存在
whereLian := publicmethod.MapOut[string]() whereLian := publicmethod.MapOut[string]()
@ -518,7 +524,6 @@ func postSchemeTargetPost(versionNumber string, source, judgeState int, scheme [
saveData.CensorType = "2" //检查方式(1:现场检查;2:资料检查;3:事件触发)"` saveData.CensorType = "2" //检查方式(1:现场检查;2:资料检查;3:事件触发)"`
saveData.Source = source //来源(1:岗位;2:部门引用)"` saveData.Source = source //来源(1:岗位;2:部门引用)"`
saveData.RunState = cv.State //运行状态(1:启用;2:禁用;3:观察) saveData.RunState = cv.State //运行状态(1:启用;2:禁用;3:观察)
saveNewData = append(saveNewData, saveData) saveNewData = append(saveNewData, saveData)
} }
@ -540,6 +545,7 @@ func postSchemeTargetPost(versionNumber string, source, judgeState int, scheme [
} }
} }
syncSetinges.Wait() syncSetinges.Wait()
syncSetingRun.Wait()
writeData := xizeXiecheng.readDataLock() writeData := xizeXiecheng.readDataLock()
if len(writeData) > 0 { if len(writeData) > 0 {
for _, wdv := range writeData { for _, wdv := range writeData {
@ -657,6 +663,9 @@ func postSchemeTarget(versionNumber string, source, judgeState int, scheme []sch
var saveNewData []modelskpi.QualitativeEvaluationScheme var saveNewData []modelskpi.QualitativeEvaluationScheme
for _, v := range scheme { //解析维度 for _, v := range scheme { //解析维度
dimensionIdInt64, _ := strconv.ParseInt(v.Id, 10, 64) //转换维度ID dimensionIdInt64, _ := strconv.ParseInt(v.Id, 10, 64) //转换维度ID
syncSetingRun.Add(1)
go xieChengWeight(0, orgid, postid, dimensionIdInt64, 0, 1, 2, v.Score) //添加维度分值记录
if len(v.Child) > 0 { //判断是否有指标 if len(v.Child) > 0 { //判断是否有指标
for _, cv := range v.Child { //解析指标 for _, cv := range v.Child { //解析指标
targetIdInt64, _ := strconv.ParseInt(cv.Id, 10, 64) //转换指标ID targetIdInt64, _ := strconv.ParseInt(cv.Id, 10, 64) //转换指标ID
@ -677,6 +686,8 @@ func postSchemeTarget(versionNumber string, source, judgeState int, scheme []sch
scoringMethod = departPostTargetInfo.ScoringMethod scoringMethod = departPostTargetInfo.ScoringMethod
} }
} }
syncSetingRun.Add(1)
go xieChengWeight(int64(cv.Type), orgid, postid, dimensionIdInt64, targetIdInt64, 2, 2, cv.Score)
if cv.Type != 1 { //定量考核 if cv.Type != 1 { //定量考核
//判断该指标是否存在 //判断该指标是否存在
whereLian := publicmethod.MapOut[string]() whereLian := publicmethod.MapOut[string]()
@ -835,6 +846,7 @@ func postSchemeTarget(versionNumber string, source, judgeState int, scheme []sch
overall.CONSTANT_DB_KPI.Create(&saveNewData) overall.CONSTANT_DB_KPI.Create(&saveNewData)
} }
syncSetinges.Wait() syncSetinges.Wait()
syncSetingRun.Wait()
} }
/* /*
@ -1219,3 +1231,41 @@ func editSchemeOther(schemeCont modelskpi.PositionPlanVersio, state int) {
} }
} }
/*
*
@ 作者: 秦东
@ 时间: 2022-10-25 15:04:05
@ 功能: 协程写入岗位维度或指标权重
@ 参数
#class 0维度1定性考核2定量考核"`
#orgid 行政组织"
#postid 岗位
#dimensionIdInt64 考核维度
#target 指标
#weight 权重
#hierarchy 1维度2指标
#quote 1不是引用2引用部门
xieChengWeight(class, orgid, postid, dimensionIdInt64, target, hierarchy, quote int64, weight float64)
syncSetingRun.Done()
@ 返回值
#
*/
func xieChengWeight(class, orgid, postid, dimensionIdInt64, target, hierarchy, quote int64, weight float64) {
defer syncSetingRun.Done()
var dimWeight modelskpi.DepartDimePostWeight
dimWeight.Type = class //1:定性考核;2:定量考核"`
dimWeight.Orgid = orgid //行政组织"`
dimWeight.Postid = postid //岗位"`
dimWeight.Dimension = dimensionIdInt64 //考核维度"`
dimWeight.Target = target //指标"`
dimWeight.Weight = weight //权重"`
dimWeight.Addtime = time.Now().Unix() //添加时间"`
dimWeight.Hierarchy = hierarchy //1:维度;2:指标"`
dimWeight.Quote = quote //1:不是引用;2:引用部门"`
dimWeight.WriteTargetWeight()
}

2
api/version1/postseting/postpc/type.go

@ -66,7 +66,7 @@ type postAboutTarget struct {
publicmethod.PublicId publicmethod.PublicId
publicmethod.PublicName //指标名称 publicmethod.PublicName //指标名称
Content string `json:"content"` //指标描述 Content string `json:"content"` //指标描述
StandardScore int64 `json:"standardscore"` //标准分 StandardScore float64 `json:"standardscore"` //标准分
Unit string `json:"unit"` //单位 Unit string `json:"unit"` //单位
IsTrue int `json:"istrue"` //是否允许修改 1:不允许;2:允许 IsTrue int `json:"istrue"` //是否允许修改 1:不允许;2:允许
State int `json:"state"` //状态 1:启用;2:禁用;3:观察 State int `json:"state"` //状态 1:启用;2:禁用;3:观察

136
api/version1/postseting/postweb/appflowlog.go

@ -0,0 +1,136 @@
package postweb
import (
"key_performance_indicators/middleware/wechatapp/wechatcallback"
"key_performance_indicators/models/modelskpi"
"key_performance_indicators/overall"
"key_performance_indicators/overall/publicmethod"
"strconv"
"github.com/gin-gonic/gin"
)
// 岗位审批记录
func (a *ApiMethod) GetPostFlowLog(c *gin.Context) {
var receivedValue postFlowLog
c.ShouldBindJSON(&receivedValue)
if receivedValue.Page == 0 {
receivedValue.Page = 1
}
if receivedValue.PageSize == 0 {
receivedValue.PageSize = 20
}
//获取登录人信息
context, _ := publicmethod.LoginMyCont(c)
gormDb := overall.CONSTANT_DB_KPI.Model(&modelskpi.AppNewFlowLog{})
switch context.IsAdmin {
case 2:
case 3:
case 4:
default:
gormDb = gormDb.Where("FIND_IN_SET(?,`participants`)", context.Key)
gormDb = gormDb.Where("`department_id` = ?", context.MainDeparment)
}
var flowLogList []modelskpi.AppNewFlowLog
if receivedValue.Title != "" {
gormDb = gormDb.Where("`pt_title` LIKE ? OR `pst_title` LIKE ? OR `ptd_title` LIKE ?", "%"+receivedValue.Title+"%", "%"+receivedValue.Title+"%", "%"+receivedValue.Title+"%")
}
if receivedValue.OrgId != "" {
gormDb = gormDb.Where("`org_id` = ?", receivedValue.OrgId)
}
if receivedValue.PostId != "" {
gormDb = gormDb.Where("`post_id` = ?", receivedValue.PostId)
}
if receivedValue.DayTime != "" {
startTime, endTime := publicmethod.GetAppointMonthStarAndEndTime(receivedValue.DayTime)
gormDb = gormDb.Where("`start_time` BETWEEN ? AND ?", startTime, endTime)
}
if receivedValue.State != 0 {
gormDb = gormDb.Where("`state` = ?", receivedValue.State)
} else {
gormDb = gormDb.Where("`state` BETWEEN ? AND ?", 1, 5)
}
if receivedValue.ApprovalState == 1 {
gormDb = gormDb.Where("NOT FIND_IN_SET(?,`next_executor`)", context.Key)
}
if receivedValue.ApprovalState == 2 {
gormDb = gormDb.Where("FIND_IN_SET(?,`next_executor`)", context.Key)
}
err := gormDb.Order("`id` DESC").Find(&flowLogList).Error
var total int64
totalErr := gormDb.Count(&total).Error
if totalErr != nil {
total = 0
}
if err != nil || len(flowLogList) < 1 {
publicmethod.Result(107, err, c)
return
}
var sendData []SendPostFlowLog
for _, v := range flowLogList {
var sendCont SendPostFlowLog
sendCont.OrderId = strconv.FormatInt(v.OrderId, 10) //订单Key
titleStr := v.PtTitle
if v.PstTitle != "" {
titleStr = v.PstTitle
}
if v.PtdTitle != "" {
titleStr = v.PtdTitle
}
sendCont.Title = titleStr //标题
switch v.State {
case 1:
sendCont.Result = "起草" //审批结果
sendCont.Statetype = 1 //审批状态
case 2:
sendCont.Result = "驳回"
sendCont.Statetype = 4
case 3:
sendCont.Result = "审批中"
sendCont.Statetype = 0
case 4:
sendCont.Result = "归档"
sendCont.Statetype = 1
case 5:
sendCont.Result = "废弃"
sendCont.Statetype = 1
case 6:
sendCont.Result = "删除"
sendCont.Statetype = 1
default:
sendCont.Result = "审批中"
sendCont.Statetype = 0
}
cyclesVal := v.PtCycle
cycleAttresVal := v.PtCycleattr
if v.PtdCycles != 0 {
cyclesVal = v.PtdCycles
}
if v.PtdCycleAttres != 0 {
cycleAttresVal = v.PtdCycleAttres
}
sendCont.Cycles = cyclesVal //1:班;2:天;3:周;4:月;5:季度;6:年"`
sendCont.CycleAttres = cycleAttresVal //辅助计数"`
sendCont.Year = v.Year //年分"`
sendCont.Quarter = v.Quarter //季度"`
sendCont.Month = v.Month //月"`
sendCont.Week = v.Week //周"`
if v.NextStep == 0 {
sendCont.Node = "归档"
} else {
//获取流程节点
_, flowCont, _ := wechatcallback.GetOneNodeCont(v.WorkFlow, v.Step)
sendCont.Node = flowCont.NodeName //当前节点
}
sendCont.MonthDays = publicmethod.UnixTimeToDay(v.StartTime, 22) //提报日期
sendData = append(sendData, sendCont)
}
publicmethod.ResultList(0, receivedValue.Page, receivedValue.PageSize, total, int64(len(sendData)), sendData, c)
}

30
api/version1/postseting/postweb/flowmap.go

@ -0,0 +1,30 @@
package postweb
import (
"key_performance_indicators/api/version1/flowchart"
"key_performance_indicators/overall/publicmethod"
"github.com/gin-gonic/gin"
)
// 生产流程图
func (a *ApiMethod) GetFlowMap(c *gin.Context) {
var receivedValue CreateFlow
c.ShouldBindJSON(&receivedValue)
//获取登录人信息
context, _ := publicmethod.LoginMyCont(c)
//生成工作流
wechatOpenId := context.Wechat
if context.WorkWechat != "" {
wechatOpenId = context.WorkWechat
}
var reviewFlowCont flowchart.ReviewFlow
reviewFlowCont.Id = receivedValue.Id
reviewFlowCont.IsCorrection = receivedValue.IsCorrection
reviewFlowCont.PlusReduction = receivedValue.PlusReduction
reviewFlowCont.PeopleList = append(reviewFlowCont.PeopleList, receivedValue.PersonLiable)
flowMap, _ := flowchart.SetUpWorkFlow(wechatOpenId, context.MainDeparment, reviewFlowCont, 1)
publicmethod.Result(0, flowMap, c)
}

42
api/version1/postseting/postweb/postration.go

@ -197,6 +197,7 @@ func (a *ApiMethod) SubmitRationPostCont(c *gin.Context) {
publicmethod.Result(107, err, c) publicmethod.Result(107, err, c)
return return
} }
//获取指标单位 //获取指标单位
var targetUnit modelskpi.PostTarget var targetUnit modelskpi.PostTarget
overall.CONSTANT_DB_KPI.Model(&modelskpi.PostTarget{}).Select("unit").Where(map[string]interface{}{"`id`": postShemeCont.TargetId}).First(&targetUnit) overall.CONSTANT_DB_KPI.Model(&modelskpi.PostTarget{}).Select("unit").Where(map[string]interface{}{"`id`": postShemeCont.TargetId}).First(&targetUnit)
@ -207,6 +208,28 @@ func (a *ApiMethod) SubmitRationPostCont(c *gin.Context) {
publicmethod.Result(107, err, c) publicmethod.Result(107, err, c)
return return
} }
yearVal := publicmethod.ComputingTime(currentTime, 1)
quarter := publicmethod.ComputingTime(currentTime, 2) //月"`
timecopy := publicmethod.ComputingTime(currentTime, 3) //月"`
week := publicmethod.ComputingTime(currentTime, 4) //月"`
//判断考核周期内时候已经提交过
var oldPostMeterFlowCont modelskpi.PostMeteringFlow
oldWhe := publicmethod.MapOut[string]()
oldWhe["`sheme_id`"] = receivedValue.Id
oldWhe["`person_liable`"] = userCont.Key
oldWhe["`org_id`"] = userCont.AdminOrg
oldWhe["`post_id`"] = userCont.Position
oldWhe["`year`"] = yearVal
oldWhe["`quarter`"] = quarter
oldWhe["`month`"] = timecopy
oldWhe["`week`"] = week
err = oldPostMeterFlowCont.GetCont(oldWhe, "`id`")
if err == nil {
publicmethod.Result(1, err, c, "您已经提报过该数据!请不要重复提报!")
return
}
//获取登录人信息 //获取登录人信息
context, _ := publicmethod.LoginMyCont(c) context, _ := publicmethod.LoginMyCont(c)
@ -276,17 +299,24 @@ func (a *ApiMethod) SubmitRationPostCont(c *gin.Context) {
flowCont.Detailed = postShemeCont.DetailsId //指标细则"` flowCont.Detailed = postShemeCont.DetailsId //指标细则"`
flowCont.Executor = context.Key //执行人"` flowCont.Executor = context.Key //执行人"`
flowCont.ExecutorDepartment = context.MainDeparment //执行人部门"` flowCont.ExecutorDepartment = context.MainDeparment //执行人部门"`
flowCont.State = 3 //流程状态 1:草稿;2:驳回;3:审批中;4:归档;5:废弃;6:删除"` flowCont.State = 2 //流程状态 1:草稿;2:审批中;3:驳回;4:归档;5:废弃;6:删除"`
flowCont.StartTime = addTime //流程开始时间"` flowCont.StartTime = addTime //流程开始时间"`
flowCont.Time = addTime //时间"` flowCont.Time = addTime //时间"`
flowCont.Participants = strings.Join(flowParticipants, ",") flowCont.Participants = strings.Join(flowParticipants, ",")
flowCont.Year = yearVal //年"`
flowCont.Quarter = quarter //季度"`
flowCont.Month = timecopy //月"`
flowCont.Week = week //周"`
flowCont.PersonLiable = userCont.Key
flowCont.HappenTime = currentTime //发生时间"`
if len(receivedValue.Enclosure) > 0 { if len(receivedValue.Enclosure) > 0 {
jsonFileList, _ := json.Marshal(receivedValue.Enclosure) jsonFileList, _ := json.Marshal(receivedValue.Enclosure)
flowCont.EnclosureFormat = string(jsonFileList) //附件"` flowCont.EnclosureFormat = string(jsonFileList) //附件"`
} }
yearVal := publicmethod.ComputingTime(currentTime, 1)
timecopy := publicmethod.ComputingTime(currentTime, 3) //月"`
var baseLine baseLineType var baseLine baseLineType
//获取指标的全奖、零奖、封顶值 //获取指标的全奖、零奖、封顶值
baseLine.Allprize, baseLine.Zeroprize, baseLine.Capping = GetPostTagetRewardSeting(postShemeCont.CompanyId, postShemeCont.OrgId, postShemeCont.PostId, postShemeCont.DimensionId, postShemeCont.TargetId, postShemeCont.DetailsId, yearVal, timecopy) baseLine.Allprize, baseLine.Zeroprize, baseLine.Capping = GetPostTagetRewardSeting(postShemeCont.CompanyId, postShemeCont.OrgId, postShemeCont.PostId, postShemeCont.DimensionId, postShemeCont.TargetId, postShemeCont.DetailsId, yearVal, timecopy)
@ -308,9 +338,9 @@ func (a *ApiMethod) SubmitRationPostCont(c *gin.Context) {
postMeterFlow.Score = receivedValue.Score * 100 //分值(*100保存)"` postMeterFlow.Score = receivedValue.Score * 100 //分值(*100保存)"`
postMeterFlow.Reason = receivedValue.Reason //这样操作的原因"` postMeterFlow.Reason = receivedValue.Reason //这样操作的原因"`
postMeterFlow.Year = yearVal //年"` postMeterFlow.Year = yearVal //年"`
postMeterFlow.Quarter = publicmethod.ComputingTime(currentTime, 2) //季度"` postMeterFlow.Quarter = quarter //季度"`
postMeterFlow.Month = publicmethod.ComputingTime(currentTime, 3) //月"` postMeterFlow.Month = timecopy //月"`
postMeterFlow.Week = publicmethod.ComputingTime(currentTime, 4) //周"` postMeterFlow.Week = week //周"`
postMeterFlow.PersonLiable = userCont.Key //责任人"` postMeterFlow.PersonLiable = userCont.Key //责任人"`
postMeterFlow.CompanyId = userCont.Company //公司"` postMeterFlow.CompanyId = userCont.Company //公司"`
postMeterFlow.DepartmentId = userCont.MainDeparment //部门"` postMeterFlow.DepartmentId = userCont.MainDeparment //部门"`

219
api/version1/postseting/postweb/posttarget.go

@ -89,7 +89,7 @@ func (a *ApiMethod) GetPostNature(c *gin.Context) {
} }
//获取被考核人基本信息 //获取被考核人基本信息
var userCont modelshr.PersonArchives var userCont modelshr.PersonArchives
err = userCont.GetCont(map[string]interface{}{"`key`": receivedValue.Id}, "`company`", "`maindeparment`", "`admin_org`", "`position`") err = userCont.GetCont(map[string]interface{}{"`key`": receivedValue.Id}, "`company`", "`maindeparment`", "`admin_org`", "`position`", "`key`")
if err != nil { if err != nil {
publicmethod.Result(107, err, c) publicmethod.Result(107, err, c)
return return
@ -104,6 +104,9 @@ func (a *ApiMethod) GetPostNature(c *gin.Context) {
publicmethod.Result(107, err, c) publicmethod.Result(107, err, c)
return return
} }
tdyTimne := time.Now().Unix()
yearInt := publicmethod.ComputingTime(tdyTimne, 1)
monthInt := publicmethod.ComputingTime(tdyTimne, 3) - 1
var targetId []int64 var targetId []int64
//获取指标内容 //获取指标内容
var outDataAry []outPostManTargetList var outDataAry []outPostManTargetList
@ -126,6 +129,9 @@ func (a *ApiMethod) GetPostNature(c *gin.Context) {
} }
outCont.UserKey = receivedValue.Id outCont.UserKey = receivedValue.Id
outCont.DimensionId = strconv.FormatInt(v.DimensionId, 10) outCont.DimensionId = strconv.FormatInt(v.DimensionId, 10)
outCont.Scorereduction, outCont.Extrapoints, outCont.Deduction, outCont.Reward = GetScoreMoney(userCont.Key, v.TargetId, yearInt, monthInt)
outDataAry = append(outDataAry, outCont) outDataAry = append(outDataAry, outCont)
targetId = append(targetId, v.TargetId) targetId = append(targetId, v.TargetId)
} }
@ -357,13 +363,25 @@ func (a *ApiMethod) GetPostDeimensoInfo(c *gin.Context) {
} }
if v.MinScore != 0 { if v.MinScore != 0 {
outCont.ScoreStr = fmt.Sprintf("%v-%v", publicmethod.DecimalEs(v.MinScore/100, 2), publicmethod.DecimalEs(v.MaxScore/100, 2)) outCont.ScoreStr = fmt.Sprintf("%v-%v", publicmethod.DecimalEs(v.MinScore/100, 2), publicmethod.DecimalEs(v.MaxScore/100, 2))
outCont.ScoreState = 2
} else { } else {
outCont.ScoreStr = fmt.Sprintf("%v", publicmethod.DecimalEs(v.MaxScore/100, 2)) outCont.ScoreStr = fmt.Sprintf("%v", publicmethod.DecimalEs(v.MaxScore/100, 2))
if v.MaxScore != 0 {
outCont.ScoreState = 1
} else {
outCont.ScoreState = 3
}
} }
if v.Minmoney != 0 { if v.Minmoney != 0 {
outCont.MoneyStr = fmt.Sprintf("%v-%v", publicmethod.DecimalEs(v.Minmoney/100, 2), publicmethod.DecimalEs(v.Maxmoney/100, 2)) outCont.MoneyStr = fmt.Sprintf("%v-%v", publicmethod.DecimalEs(v.Minmoney/100, 2), publicmethod.DecimalEs(v.Maxmoney/100, 2))
outCont.MoneyState = 2
} else { } else {
outCont.MoneyStr = fmt.Sprintf("%v", publicmethod.DecimalEs(v.Maxmoney/100, 2)) outCont.MoneyStr = fmt.Sprintf("%v", publicmethod.DecimalEs(v.Maxmoney/100, 2))
if v.Maxmoney != 0 {
outCont.MoneyState = 1
} else {
outCont.MoneyState = 3
}
} }
outCont.UserKey = receivedValue.UserKey outCont.UserKey = receivedValue.UserKey
outList = append(outList, outCont) outList = append(outList, outCont)
@ -557,6 +575,9 @@ func (a *ApiMethod) SendUsNatureEvaluation(c *gin.Context) {
if receivedValue.Count == 0 { if receivedValue.Count == 0 {
receivedValue.Count = 1 receivedValue.Count = 1
} }
if receivedValue.MoneyCount == 0 {
receivedValue.MoneyCount = 1
}
currentTime := time.Now().Unix() currentTime := time.Now().Unix()
if receivedValue.HappenTime != "" { if receivedValue.HappenTime != "" {
happTime, timeErr := publicmethod.DateToTimeStamp(receivedValue.HappenTime) happTime, timeErr := publicmethod.DateToTimeStamp(receivedValue.HappenTime)
@ -576,10 +597,16 @@ func (a *ApiMethod) SendUsNatureEvaluation(c *gin.Context) {
var corrTimeErr bool = false var corrTimeErr bool = false
correctionTime, corrTimeErr = publicmethod.DateToTimeStamp(receivedValue.CorrectionPeriod) correctionTime, corrTimeErr = publicmethod.DateToTimeStamp(receivedValue.CorrectionPeriod)
if corrTimeErr == false { if corrTimeErr == false {
publicmethod.Result(1, corrTimeErr, c, "请输入整改期限时间格式不对,谢谢!") publicmethod.Result(1, corrTimeErr, c, "您输入的整改期限时间格式不对,谢谢!")
return return
} }
} }
yearVal := publicmethod.ComputingTime(currentTime, 1)
quarter := publicmethod.ComputingTime(currentTime, 2) //月"`
timecopy := publicmethod.ComputingTime(currentTime, 3) //月"`
week := publicmethod.ComputingTime(currentTime, 4) //月"`
//获取登录人信息 //获取登录人信息
context, _ := publicmethod.LoginMyCont(c) context, _ := publicmethod.LoginMyCont(c)
@ -649,9 +676,18 @@ func (a *ApiMethod) SendUsNatureEvaluation(c *gin.Context) {
flowCont.Detailed = postShemeCont.DetailsId //指标细则"` flowCont.Detailed = postShemeCont.DetailsId //指标细则"`
flowCont.Executor = context.Key //执行人"` flowCont.Executor = context.Key //执行人"`
flowCont.ExecutorDepartment = context.MainDeparment //执行人部门"` flowCont.ExecutorDepartment = context.MainDeparment //执行人部门"`
flowCont.State = 3 //流程状态 1:草稿;2:驳回;3:审批中;4:归档;5:废弃;6:删除"` flowCont.State = 2 //流程状态 1:草稿;2:审批中;3:驳回;4:归档;5:废弃;6:删除"`
flowCont.StartTime = time.Now().Unix() //流程开始时间"` flowCont.StartTime = time.Now().Unix() //流程开始时间"`
flowCont.Time = time.Now().Unix() //时间"` flowCont.Time = time.Now().Unix() //时间"`
flowCont.Year = yearVal //年"`
flowCont.Quarter = quarter //季度"`
flowCont.Month = timecopy //月"`
flowCont.Week = week //周"`
flowCont.PersonLiable = userCont.Key
flowCont.HappenTime = currentTime //发生时间"`
flowCont.Participants = strings.Join(flowParticipants, ",") flowCont.Participants = strings.Join(flowParticipants, ",")
if len(receivedValue.Enclosure) > 0 { if len(receivedValue.Enclosure) > 0 {
jsonFileList, _ := json.Marshal(receivedValue.Enclosure) jsonFileList, _ := json.Marshal(receivedValue.Enclosure)
@ -671,10 +707,10 @@ func (a *ApiMethod) SendUsNatureEvaluation(c *gin.Context) {
postNatureFlowCont.Target = postShemeCont.TargetId //指标"` postNatureFlowCont.Target = postShemeCont.TargetId //指标"`
postNatureFlowCont.SonTarget = postShemeCont.SonTargetId //指标子栏目"` postNatureFlowCont.SonTarget = postShemeCont.SonTargetId //指标子栏目"`
postNatureFlowCont.Detailed = postShemeCont.DetailsId //指标细则"` postNatureFlowCont.Detailed = postShemeCont.DetailsId //指标细则"`
postNatureFlowCont.Year = publicmethod.ComputingTime(currentTime, 1) //年"` postNatureFlowCont.Year = yearVal //年"`
postNatureFlowCont.Quarter = publicmethod.ComputingTime(currentTime, 2) //季度"` postNatureFlowCont.Quarter = quarter //季度"`
postNatureFlowCont.Month = publicmethod.ComputingTime(currentTime, 3) //月"` postNatureFlowCont.Month = timecopy //月"`
postNatureFlowCont.Week = publicmethod.ComputingTime(currentTime, 4) //周"` postNatureFlowCont.Week = week //周"`
postNatureFlowCont.PersonLiable = userCont.Key //责任人"` postNatureFlowCont.PersonLiable = userCont.Key //责任人"`
postNatureFlowCont.CompanyId = userCont.Company //公司"` postNatureFlowCont.CompanyId = userCont.Company //公司"`
postNatureFlowCont.DepartmentId = userCont.MainDeparment //部门"` postNatureFlowCont.DepartmentId = userCont.MainDeparment //部门"`
@ -686,6 +722,7 @@ func (a *ApiMethod) SendUsNatureEvaluation(c *gin.Context) {
postNatureFlowCont.CorrectionTime = correctionTime //整改期限"` postNatureFlowCont.CorrectionTime = correctionTime //整改期限"`
postNatureFlowCont.HappenTime = currentTime //发生时间"` postNatureFlowCont.HappenTime = currentTime //发生时间"`
postNatureFlowCont.HappenCount = receivedValue.Count //发生次数"` postNatureFlowCont.HappenCount = receivedValue.Count //发生次数"`
postNatureFlowCont.HappenCountMoney = receivedValue.MoneyCount //发生次数(钱)
postNatureFlowCont.Time = time.Now().Unix() //时间"` postNatureFlowCont.Time = time.Now().Unix() //时间"`
// publicmethod.Result(1, postNatureFlowCont, c, msg) // publicmethod.Result(1, postNatureFlowCont, c, msg)
// return // return
@ -921,14 +958,19 @@ func judgeScoreOrMoneyIsTrue(scoreState int, score string, maxScore, minScore fl
} }
scoreInt64, _ = strconv.ParseFloat(score, 64) scoreInt64, _ = strconv.ParseFloat(score, 64)
scoreInt64 = scoreInt64 * 100 scoreInt64 = scoreInt64 * 100
if maxScore != 0 {
if scoreInt64 > maxScore { if scoreInt64 > maxScore {
msg = fmt.Sprintf("您提交的数值超过允许提交的最大值(最大值:%v)!", float64(maxScore)/100) msg = fmt.Sprintf("您提交的数值超过允许提交的最大值(最大值:%v)!", float64(maxScore)/100)
return return
} }
}
if minScore != 0 {
if scoreInt64 < minScore { if scoreInt64 < minScore {
msg = fmt.Sprintf("您提交的数值低于允许提交的最小值(最小值:%v)!", float64(minScore)/100) msg = fmt.Sprintf("您提交的数值低于允许提交的最小值(最小值:%v)!", float64(minScore)/100)
return return
} }
}
isTrue = true isTrue = true
case 1: case 1:
scoreInt64, _ = strconv.ParseFloat(score, 64) scoreInt64, _ = strconv.ParseFloat(score, 64)
@ -972,7 +1014,7 @@ func (a *ApiMethod) PostRectificationMeasures(c *gin.Context) {
publicmethod.Result(1, err, c, "不存在的审批整改项目!") publicmethod.Result(1, err, c, "不存在的审批整改项目!")
return return
} }
if pwoCont.State != 3 { if pwoCont.State != 2 {
publicmethod.Result(1, err, c, "此考核项目已经审批结束!请不要重复提交整改措施!") publicmethod.Result(1, err, c, "此考核项目已经审批结束!请不要重复提交整改措施!")
return return
} }
@ -1036,9 +1078,9 @@ func (a *ApiMethod) PostRectificationMeasures(c *gin.Context) {
flowState := 3 //判断流程状态 flowState := 3 //判断流程状态
switch flowOneCont.RunType { switch flowOneCont.RunType {
case 1: case 1:
flowState = 3 flowState = 2
case 2: case 2:
flowState = 3 flowState = 2
case 3: case 3:
flowState = 4 flowState = 4
case 4: case 4:
@ -1138,9 +1180,9 @@ func ApproveFlow(systemApp string, flowMap []publicmethod.FlowChartList, flowOne
flowState := 3 //判断流程状态 flowState := 3 //判断流程状态
switch flowOneCont.RunType { switch flowOneCont.RunType {
case 1: case 1:
flowState = 3 flowState = 2
case 2: case 2:
flowState = 3 flowState = 2
case 3: case 3:
flowState = 4 flowState = 4
case 4: case 4:
@ -1618,3 +1660,156 @@ func UpdateStateFlow(pwoId int64, nextStep, flowState int, flowMap []publicmetho
var pwoCont modelskpi.PostWorkflowOrders var pwoCont modelskpi.PostWorkflowOrders
pwoCont.EiteCont(map[string]interface{}{"`id`": pwoId}, map[string]interface{}{"`next_step`": nextStep, "`state`": flowState, "'next_executor'": nextUserKeyStr, "`participants`": flowUserKey, "`time`": time.Now().Unix()}) //改变审批流状态 pwoCont.EiteCont(map[string]interface{}{"`id`": pwoId}, map[string]interface{}{"`next_step`": nextStep, "`state`": flowState, "'next_executor'": nextUserKeyStr, "`participants`": flowUserKey, "`time`": time.Now().Unix()}) //改变审批流状态
} }
/*
*
@ 作者: 秦东
@ 时间: 2022-10-24 15:55:27
@ 功能: 计算扣分和扣款
@ 参数
#userKey 用户KEY
#targetId 指标ID
#year
#month
@ 返回值
#minusPoints 扣分
#bonusPoint 加分
#forfeit 罚款
#bonus 奖金
*/
func GetScoreMoney(userKey, targetId, year, month int64) (minusPoints, bonusPoint, forfeit, bonus float64) {
var natureFlowOrderList []modelskpi.NatureFlowOrder
err := overall.CONSTANT_DB_KPI.Model(&modelskpi.NatureFlowOrder{}).Where("`state` BETWEEN ? AND ?", 3, 4).Where("`person_liable` = ? AND `target` = ? AND `year` = ? AND `month` = ?", userKey, targetId, year, month).Find(&natureFlowOrderList).Error
if err != nil {
return
}
for _, v := range natureFlowOrderList {
if v.AddOrDecrease == 1 {
bonusPoint = bonusPoint + v.Score
bonus = bonus + v.Money
} else {
minusPoints = minusPoints + v.Score
forfeit = forfeit + v.Money
}
}
minusPoints = publicmethod.DecimalEs(minusPoints/100, 2)
bonusPoint = publicmethod.DecimalEs(bonusPoint/100, 2)
forfeit = publicmethod.DecimalEs(forfeit/100, 2)
bonus = publicmethod.DecimalEs(bonus/100, 2)
return
}
/*
*
@ 作者: 秦东
@ 时间: 2022-10-25 13:45:58
@ 功能: 获取定量考核详情
@ 参数
#
@ 返回值
#
*/
func (a *ApiMethod) GetQuantificationCont(c *gin.Context) {
var receivedValue GetPostQuanClass
err := c.ShouldBindJSON(&receivedValue)
if err != nil {
publicmethod.Result(100, err, c)
return
}
if receivedValue.Id == "" {
publicmethod.Result(101, receivedValue, c)
return
}
if receivedValue.OrgId == "" {
publicmethod.Result(101, receivedValue, c)
return
}
if receivedValue.PostId == "" {
publicmethod.Result(101, receivedValue, c)
return
}
tdyTime := time.Now().Unix()
if receivedValue.Time != "" {
tdyTimeInt, tadyErr := publicmethod.DateToTimeStamp(receivedValue.Time)
if tadyErr == true {
tdyTime = tdyTimeInt
}
}
yearTime := publicmethod.ComputingTime(tdyTime, 1)
month := publicmethod.ComputingTime(tdyTime, 3)
if receivedValue.Time == "" {
if month-1 <= 0 {
yearTime = yearTime - 1
month = 12
} else {
month = month - 1
}
}
var shemeCont modelskpi.QualitativeEvaluationScheme
err = shemeCont.GetCont(map[string]interface{}{"`id`": receivedValue.Id})
if err != nil {
publicmethod.Result(107, err, c)
return
}
//获取指标统计方式
var targetCont modelskpi.PostTarget
targetCont.GetCont(map[string]interface{}{"`id`": shemeCont.TargetId}, "`cycle`", "`cycleattr`")
//获取指标分
var departDimPostWeight modelskpi.DepartDimePostWeight
where := publicmethod.MapOut[string]()
where["`orgid`"] = shemeCont.OrgId
where["`postid`"] = shemeCont.PostId
where["`dimension`"] = shemeCont.DimensionId
where["`hierarchy`"] = 1
where["`is_quote`"] = shemeCont.Source
where["`target`"] = shemeCont.TargetId
departDimPostWeight.GetCont(where, "`weight`")
whereAry := publicmethod.MapOut[string]()
whereAry["`org_id`"] = receivedValue.OrgId
whereAry["`post_id`"] = receivedValue.PostId
whereAry["`dimension`"] = shemeCont.DimensionId
whereAry["`target`"] = shemeCont.TargetId
whereAry["`year`"] = yearTime
switch targetCont.Cycle {
case 5:
timeStr := fmt.Sprintf("%v-%v-01 12:00:00", yearTime, month)
if month <= 9 {
timeStr = fmt.Sprintf("%v-0%v-01 12:00:00", yearTime, month)
}
tdyTimeIntJi, tadyErrJi := publicmethod.DateToTimeStamp(timeStr)
var quarter int64
if tadyErrJi == true {
quarter = publicmethod.ComputingTime(tdyTimeIntJi, 2)
} else {
quarter = publicmethod.ComputingTime(tdyTime, 2)
}
whereAry["`timecopy`"] = quarter
case 6:
whereAry["`timecopy`"] = 1
default:
whereAry["`timecopy`"] = month
}
var outPutCont sendPostQuanCont
//获取岗位考核目标
var quanPostConfig modelskpi.QuanPostConfig
err = quanPostConfig.GetCont(whereAry, "`zeroprize`", `allprize`, `capping`)
if err == nil {
outPutCont.ZeroPrize = publicmethod.DecimalEs(quanPostConfig.Zeroprize/100, 2)
outPutCont.AllPrize = publicmethod.DecimalEs(quanPostConfig.Allprize/100, 2)
outPutCont.CappingPrize = quanPostConfig.CappingVal
}
outPutCont.Content = shemeCont.Content
outPutCont.CompletionRate = "((实际值-零奖值)/(全奖值-零奖值))*指标权重"
outPutCont.Weight = departDimPostWeight.Weight
outPutCont.ScoringMethod = shemeCont.ScoringMethod
publicmethod.Result(0, outPutCont, c)
}

64
api/version1/postseting/postweb/type.go

@ -32,6 +32,10 @@ type outPostManTargetList struct {
AddReduce int `json:"addreduce"` //1:减少;2:增加;3:无属性,现场确认加或减 AddReduce int `json:"addreduce"` //1:减少;2:增加;3:无属性,现场确认加或减
UserKey string `json:"userkey"` UserKey string `json:"userkey"`
DimensionId string `json:"dimensionid"` //维度 DimensionId string `json:"dimensionid"` //维度
Extrapoints float64 `json:"extrapoints"` //已加多少分
Scorereduction float64 `json:"scorereduction"` //已减多少分
Deduction float64 `json:"deduction"` //已扣款多少元
Reward float64 `json:"reward"` //已奖励多少元
} }
// 输出定量考核项目 // 输出定量考核项目
@ -63,6 +67,8 @@ type outNatureDimeCont struct {
MoneyStr string `json:"moneystr"` //现金 MoneyStr string `json:"moneystr"` //现金
UserKey string `json:"userkey"` UserKey string `json:"userkey"`
Unity string `json:"unity"` //单位 Unity string `json:"unity"` //单位
ScoreState int `json:"scorestate"` //1、定分;2、区间分;3、不定性分值
MoneyState int `json:"moneystate"` //1、定钱;2、区间钱;3、不定性钱
} }
// 岗位定性考核细致获取数据 // 岗位定性考核细致获取数据
@ -89,7 +95,8 @@ type outNatureDimePostCont struct {
type sendMyEvaluationData struct { type sendMyEvaluationData struct {
publicmethod.PublicId //考核项ID publicmethod.PublicId //考核项ID
UserKey string `json:"userkey"` //接受考核人key UserKey string `json:"userkey"` //接受考核人key
Count int `json:"count"` //计数 Count int `json:"count"` //计数(分)
MoneyCount int `json:"moneycount"` //计数器(钱)
HappenTime string `json:"happentime"` //发生时间. HappenTime string `json:"happentime"` //发生时间.
Reason string `json:"reason"` //操作原因 Reason string `json:"reason"` //操作原因
Rectification int `json:"rectification"` //是否需要整改 1、需要整改;2:无需整改 Rectification int `json:"rectification"` //是否需要整改 1、需要整改;2:无需整改
@ -184,3 +191,58 @@ type getSonTarList struct {
OrgId string `orgid` OrgId string `orgid`
PostId string `postid` PostId string `postid`
} }
// 生产流程图
type CreateFlow struct {
Id string `json:"id"` //考核项目ID
IsCorrection int `json:"iscorrection"` //是否整改
PlusReduction int `json:"plusreduction"` //加减分
PersonLiable string `json:"personLiable" ` //责任人
}
// 获得岗位定量考核详情
type GetPostQuanClass struct {
publicmethod.PublicId
OrgId string `json:"orgid"` //行政组织
PostId string `json:"postid"` //岗位
Time string `json:"time"` // 考核时间
}
// 输出岗位定量考核详情
type sendPostQuanCont struct {
Content string `json:"content"` //指标说明
CompletionRate string `json:"completionRate"` //达成率
ZeroPrize float64 `json:"zeroprize"` //零奖值
AllPrize float64 `json:"allprize"` //全奖值
CappingPrize float64 `json:"cappingprize"` //达成率
Weight float64 `json:"weight"` //指标权重
ScoringMethod int `json:"scoringmethod"` //计分方式(1:自动;2:手动)
}
// 岗位审批记录
type postFlowLog struct {
publicmethod.PagesTurn
Title string `json:"title"` //指标名
OrgId string `json:"orgid"` //行政组织
PostId string `json:"postid"` //岗位
DayTime string `json:"daytime"` //时间
State int `json:"state"` //状态:0:全部;1:起草;2:审批中;3:通过;4:驳回
ApprovalState int `json:"approvalstate" ` //审批:0:全部;1:已处理;2:未处理
}
// 输出岗位审批记录表
type SendPostFlowLog struct {
OrderId string `json:"orderid"` //订单Key
Title string `json:"title"` //标题
Result string `json:"result"` //审批结果
Statetype int `json:"statetype"` //审批状态
Cycles int `json:"cycle"` //1:班;2:天;3:周;4:月;5:季度;6:年"`
CycleAttres int `json:"cycleattr"` //辅助计数"`
Year int64 `json:"year"` //年分"`
Quarter int64 `json:"quarter"` //季度"`
Month int64 `json:"month"` //月"`
Week int64 `json:"week"` //周"`
Days int64 `json:"days"` //天
Node string `json:"node"` //当前节点
MonthDays string `json:"monthdays"` //提报日期
}

5
apirouter/v1/postseting/web.go

@ -26,5 +26,10 @@ func (a *ApiRouter) RouterGroupWeb(router *gin.RouterGroup) {
apiRouter.POST("submit_ration_post_cont", methodBinding.SubmitRationPostCont) //提交定量考核数据 apiRouter.POST("submit_ration_post_cont", methodBinding.SubmitRationPostCont) //提交定量考核数据
apiRouter.POST("post_rectification_measures", methodBinding.PostRectificationMeasures) //提交整改措施 apiRouter.POST("post_rectification_measures", methodBinding.PostRectificationMeasures) //提交整改措施
apiRouter.POST("getflowmap", methodBinding.GetFlowMap) //获取流程图
apiRouter.POST("get_quantification_cont", methodBinding.GetQuantificationCont) //获取定量指标相关内容
apiRouter.POST("getpostflowlog", methodBinding.GetPostFlowLog) //岗位审批记录
} }
} }

8
middleware/wechatapp/wechatcallback/event_processing.go

@ -306,7 +306,7 @@ func (U *updateButtonSync) RejectFlow(systemApp string, flowMap []publicmethod.F
} }
var clickUrlPath string var clickUrlPath string
markDowmStr := "驳回" markDowmStr := "驳回"
flowState := 2 flowState := 3
rejectNode := GetRejectNode(flowMap, flowOneCont) rejectNode := GetRejectNode(flowMap, flowOneCont)
var sendToUserList []string //获取发送人 var sendToUserList []string //获取发送人
@ -479,12 +479,12 @@ func GetRejectNode(flowMap []publicmethod.FlowChartList, flowOneCont publicmetho
func (U *updateButtonSync) ApproveFlow(systemApp string, flowMap []publicmethod.FlowChartList, flowOneCont publicmethod.FlowChartList, step int, pwoContOld modelskpi.PostWorkflowOrders) { func (U *updateButtonSync) ApproveFlow(systemApp string, flowMap []publicmethod.FlowChartList, flowOneCont publicmethod.FlowChartList, step int, pwoContOld modelskpi.PostWorkflowOrders) {
defer syncSeting.Done() defer syncSeting.Done()
nextStep := 0 nextStep := 0
flowState := 3 //判断流程状态 flowState := 2 //判断流程状态
switch flowOneCont.RunType { switch flowOneCont.RunType {
case 1: case 1:
flowState = 3 flowState = 2
case 2: case 2:
flowState = 3 flowState = 2
case 3: case 3:
flowState = 4 flowState = 4
case 4: case 4:

119
models/modelskpi/app_flow_log.go

@ -0,0 +1,119 @@
package modelskpi
import (
"key_performance_indicators/overall"
"strings"
)
// 审批记录 视图
// 岗位审批工作流
type AppFlowLog struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;autoIncrement;comment:ID"`
OrderId int64 `json:"orderid" gorm:"column:order_id;type:bigint(20) unsigned;default:0;not null;comment:审批单ID"`
Step int `json:"step" gorm:"column:step;type:int(5) unsigned;default:0;not null;comment:当前执行到第几步"`
NextStep int `json:"nextstep" gorm:"column:next_step;type:int(5) unsigned;default:0;not null;comment:下一步执行哪个步骤"`
NextExecutor string `json:"nextexecutor" gorm:"column:next_executor;type:longtext;comment:下一步执行人"`
CountStep int `json:"countstep" gorm:"column:count_step;type:int(5) unsigned;default:0;not null;comment:总共几步"`
WorkFlow string `json:"workflow" gorm:"column:work_flow;type:longtext;comment:工作流(审批json字符串)"`
CompanyId int64 `json:"companyid" gorm:"column:company_id;type:bigint(20) unsigned;default:0;not null;comment:公司"`
DepartmentId int64 `json:"departmentid" gorm:"column:department_id;type:bigint(20) unsigned;default:0;not null;comment:部门"`
OrgId int64 `json:"orgid" gorm:"column:org_id;type:bigint(20) unsigned;default:0;not null;comment:行政组织"`
PostId int64 `json:"postid" gorm:"column:post_id;type:bigint(20) unsigned;default:0;not null;comment:岗位"`
Class int `json:"class" gorm:"column:class;type:tinyint(1) unsigned;default:1;not null;comment:属性1、定性;2、定量"`
Dimension int64 `json:"dimension" gorm:"column:dimension;type:bigint(20) unsigned;default:0;not null;comment:维度"`
Target int64 `json:"target" gorm:"column:target;type:bigint(20) unsigned;default:0;not null;comment:指标"`
SonTarget int64 `json:"sontarget" gorm:"column:son_target;type:bigint(20) unsigned;default:0;not null;comment:指标子栏目"`
Detailed int64 `json:"detailed" gorm:"column:detailed;type:bigint(20) unsigned;default:0;not null;comment:指标细则"`
Executor int64 `json:"executor" gorm:"column:executor;type:bigint(20) unsigned;default:0;not null;comment:执行人"`
ExecutorDepartment int64 `json:"executordepartment" gorm:"column:executor_department;type:bigint(20) unsigned;default:0;not null;comment:执行人部门"`
State int `json:"state" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:流程状态 1:草稿;2:审批中;3:驳回;4:归档;5:废弃;6:删除"`
StartTime int64 `json:"starttime" gorm:"column:start_time;type:bigint(20) unsigned;default:0;not null;comment:流程开始时间"`
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:时间"`
EnclosureFormat string `json:"enclosureformat" gorm:"column:enclosure_format;type:longtext;comment:附件"`
Participants string `json:"participants" gorm:"column:participants;type:longtext;comment:流程参与人"`
Year int64 `json:"year" gorm:"column:year;type:int(7) unsigned;default:0;not null;comment:年"`
Quarter int64 `json:"quarter" gorm:"column:quarter;type:int(3) unsigned;default:0;not null;comment:季度"`
Month int64 `json:"month" gorm:"column:month;type:int(3) unsigned;default:0;not null;comment:月"`
Week int64 `json:"week" gorm:"column:week;type:int(3) unsigned;default:0;not null;comment:周"`
PersonLiable int64 `json:"personliable" gorm:"column:person_liable;type:bigint(20) unsigned;default:0;not null;comment:责任人"`
HappenTime int64 `json:"happentime" gorm:"column:happen_time;type:bigint(20) unsigned;default:0;not null;comment:发生时间"`
//post_target
PtTitle string `json:"pt_title" gorm:"column:pt_title;type:varchar(255) unsigned;default:'';not null;comment:指标标题"`
PtCycle int `json:"pt_cycle" gorm:"column:pt_cycle;type:int(1) unsigned;default:1;not null;comment:指标1:班;2:天;3:周;4:月;5:季度;6:年"`
PtCycleattr int `json:"pt_cycleattr" gorm:"column:pt_cycleattr;type:int(9) unsigned;default:1;not null;comment:指标辅助计数"`
//post_sun_target
PstTitle string `json:"pst_title" gorm:"column:pst_title;type:varchar(255) unsigned;default:'';not null;comment:子栏目标题"`
//post_target_details
PtdTitle string `json:"ptd_title" gorm:"column:ptd_title;type:text;comment:指标细则"`
PtdCycles int `json:"ptd_cycle" gorm:"column:ptd_cycle;type:tinyint(1) unsigned;default:1;not null;comment:指标细则1:班;2:天;3:周;4:月;5:季度;6:年"`
PtdCycleAttres int `json:"ptd_cycleattr" gorm:"column:ptd_cycleattr;type:int(9) unsigned;default:1;not null;comment:指标细则辅助计数"`
//post_metering_flow
PmfId int64 `json:"pmf_id" gorm:"primaryKey;column:pmf_id;type:bigint(20) unsigned;not null;autoIncrement;comment:ID"`
PmfShemeId int64 `json:"pmf_shem_id" gorm:"column:pmf_shem_id;type:bigint(20) unsigned;default:0;not null;comment:方案ID"`
PmfPersonLiable int64 `json:"pmf_person_liable" gorm:"column:pmf_person_liable;type:bigint(20) unsigned;default:0;not null;comment:责任人"`
PmfCompanyId int64 `json:"pmf_company_id" gorm:"column:pmf_company_id;type:bigint(20) unsigned;default:0;not null;comment:公司"`
PmfDepartmentId int64 `json:"pmf_department_id" gorm:"column:pmf_department_id;type:bigint(20) unsigned;default:0;not null;comment:部门"`
PmfOrgId int64 `json:"pmf_org_id" gorm:"column:pmf_org_id;type:bigint(20) unsigned;default:0;not null;comment:行政组织"`
PmfPostId int64 `json:"pmf_post_id" gorm:"column:pmf_post_id;type:bigint(20) unsigned;default:0;not null;comment:岗位"`
PmfExecutor int64 `json:"pmf_executor" gorm:"column:pmf_executor;type:bigint(20) unsigned;default:0;not null;comment:执行人"`
PmfExecutorDepartment int64 `json:"pmf_executor_depart" gorm:"column:pmf_executor_depart;type:bigint(20) unsigned;default:0;not null;comment:执行人部门"`
PmfHappenTime int64 `json:"pmf_happen_time" gorm:"column:pmf_happen_time;type:bigint(20) unsigned;default:0;not null;comment:发生时间"`
PmfTime int64 `json:"pmf_time" gorm:"column:pmf_time;type:bigint(20) unsigned;default:0;not null;comment:时间"`
//post_nature_flow
PnfId int64 `json:"pnf_id" gorm:"primaryKey;column:pnf_id;type:bigint(20) unsigned;not null;autoIncrement;comment:ID"`
PnfShemeId int64 `json:"pnf_sheme_id" gorm:"column:pnf_sheme_id;type:bigint(20) unsigned;default:0;not null;comment:方案ID"`
PnfPersonLiable int64 `json:"pnf_person_liable" gorm:"column:pnf_person_liable;type:bigint(20) unsigned;default:0;not null;comment:责任人"`
PnfCompanyId int64 `json:"pnf_company" gorm:"column:pnf_company;type:bigint(20) unsigned;default:0;not null;comment:公司"`
PnfDepartmentId int64 `json:"pnf_department_id" gorm:"column:pnf_department_id;type:bigint(20) unsigned;default:0;not null;comment:部门"`
PnfOrgId int64 `json:"pnf_org_id" gorm:"column:pnf_org_id;type:bigint(20) unsigned;default:0;not null;comment:行政组织"`
PnfPostId int64 `json:"pnf_post_id" gorm:"column:pnf_post_id;type:bigint(20) unsigned;default:0;not null;comment:岗位"`
PnfExecutor int64 `json:"pnf_executor" gorm:"column:pnf_executor;type:bigint(20) unsigned;default:0;not null;comment:执行人"`
PnfExecutorDepartment int64 `json:"pnf_executor_depart" gorm:"column:pnf_executor_depart;type:bigint(20) unsigned;default:0;not null;comment:执行人部门"`
PnfHappenTime int64 `json:"pnf_happen_time" gorm:"column:pnf_happen_time;type:bigint(20) unsigned;default:0;not null;comment:发生时间"`
PnfTime int64 `json:"pnf_time" gorm:"column:pnf_time;type:bigint(20) unsigned;default:0;not null;comment:时间"`
}
func (AppFlowLog *AppFlowLog) TableName() string {
return "app_flow_log"
}
// 编辑内容
func (cont *AppFlowLog) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error
return
}
// 获取内容
func (cont *AppFlowLog) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_KPI.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
gormDb = gormDb.Where(whereMap)
err = gormDb.First(&cont).Error
return
}
// 根据条件获取总数
func (cont *AppFlowLog) CountCont(whereMap interface{}) (countId int64) {
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId)
return
}
// 读取全部信息
func (cont *AppFlowLog) ContMap(whereMap interface{}, field ...string) (countAry []AppFlowLog, err error) {
gormDb := overall.CONSTANT_DB_KPI.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
err = gormDb.Where(whereMap).Find(&countAry).Error
return
}
// 删除内容
func (cont *AppFlowLog) DelCont(whereMap interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error
return
}

95
models/modelskpi/app_new_flow_log.go

@ -0,0 +1,95 @@
package modelskpi
import (
"key_performance_indicators/overall"
"strings"
)
// 岗位审批工作流查询视图
type AppNewFlowLog struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;autoIncrement;comment:ID"`
OrderId int64 `json:"orderid" gorm:"column:order_id;type:bigint(20) unsigned;default:0;not null;comment:审批单ID"`
Step int `json:"step" gorm:"column:step;type:int(5) unsigned;default:0;not null;comment:当前执行到第几步"`
NextStep int `json:"nextstep" gorm:"column:next_step;type:int(5) unsigned;default:0;not null;comment:下一步执行哪个步骤"`
NextExecutor string `json:"nextexecutor" gorm:"column:next_executor;type:longtext;comment:下一步执行人"`
CountStep int `json:"countstep" gorm:"column:count_step;type:int(5) unsigned;default:0;not null;comment:总共几步"`
WorkFlow string `json:"workflow" gorm:"column:work_flow;type:longtext;comment:工作流(审批json字符串)"`
CompanyId int64 `json:"companyid" gorm:"column:company_id;type:bigint(20) unsigned;default:0;not null;comment:公司"`
DepartmentId int64 `json:"departmentid" gorm:"column:department_id;type:bigint(20) unsigned;default:0;not null;comment:部门"`
OrgId int64 `json:"orgid" gorm:"column:org_id;type:bigint(20) unsigned;default:0;not null;comment:行政组织"`
PostId int64 `json:"postid" gorm:"column:post_id;type:bigint(20) unsigned;default:0;not null;comment:岗位"`
Class int `json:"class" gorm:"column:class;type:tinyint(1) unsigned;default:1;not null;comment:属性1、定性;2、定量"`
Dimension int64 `json:"dimension" gorm:"column:dimension;type:bigint(20) unsigned;default:0;not null;comment:维度"`
Target int64 `json:"target" gorm:"column:target;type:bigint(20) unsigned;default:0;not null;comment:指标"`
SonTarget int64 `json:"sontarget" gorm:"column:son_target;type:bigint(20) unsigned;default:0;not null;comment:指标子栏目"`
Detailed int64 `json:"detailed" gorm:"column:detailed;type:bigint(20) unsigned;default:0;not null;comment:指标细则"`
Executor int64 `json:"executor" gorm:"column:executor;type:bigint(20) unsigned;default:0;not null;comment:执行人"`
ExecutorDepartment int64 `json:"executordepartment" gorm:"column:executor_department;type:bigint(20) unsigned;default:0;not null;comment:执行人部门"`
State int `json:"state" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:流程状态 流程状态 1:草稿;2:审批中;3:驳回;4:归档;5:废弃;6:删除"`
StartTime int64 `json:"starttime" gorm:"column:start_time;type:bigint(20) unsigned;default:0;not null;comment:流程开始时间"`
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:时间"`
EnclosureFormat string `json:"enclosureformat" gorm:"column:enclosure_format;type:longtext;comment:附件"`
Participants string `json:"participants" gorm:"column:participants;type:longtext;comment:流程参与人"`
Year int64 `json:"year" gorm:"column:year;type:int(7) unsigned;default:0;not null;comment:年"`
Quarter int64 `json:"quarter" gorm:"column:quarter;type:int(3) unsigned;default:0;not null;comment:季度"`
Month int64 `json:"month" gorm:"column:month;type:int(3) unsigned;default:0;not null;comment:月"`
Week int64 `json:"week" gorm:"column:week;type:int(3) unsigned;default:0;not null;comment:周"`
PersonLiable int64 `json:"personliable" gorm:"column:person_liable;type:bigint(20) unsigned;default:0;not null;comment:责任人"`
HappenTime int64 `json:"happentime" gorm:"column:happen_time;type:bigint(20) unsigned;default:0;not null;comment:发生时间"`
//post_target
PtTitle string `json:"pt_title" gorm:"column:pt_title;type:varchar(255) unsigned;default:'';not null;comment:指标标题"`
PtCycle int `json:"pt_cycle" gorm:"column:pt_cycle;type:int(1) unsigned;default:1;not null;comment:指标1:班;2:天;3:周;4:月;5:季度;6:年"`
PtCycleattr int `json:"pt_cycleattr" gorm:"column:pt_cycleattr;type:int(9) unsigned;default:1;not null;comment:指标辅助计数"`
//post_sun_target
PstTitle string `json:"pst_title" gorm:"column:pst_title;type:varchar(255) unsigned;default:'';not null;comment:子栏目标题"`
//post_target_details
PtdTitle string `json:"ptd_title" gorm:"column:ptd_title;type:text;comment:指标细则"`
PtdCycles int `json:"ptd_cycle" gorm:"column:ptd_cycle;type:tinyint(1) unsigned;default:1;not null;comment:指标细则1:班;2:天;3:周;4:月;5:季度;6:年"`
PtdCycleAttres int `json:"ptd_cycleattr" gorm:"column:ptd_cycleattr;type:int(9) unsigned;default:1;not null;comment:指标细则辅助计数"`
}
func (AppNewFlowLog *AppNewFlowLog) TableName() string {
return "app_new_flow_log"
}
// 编辑内容
func (cont *AppNewFlowLog) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error
return
}
// 获取内容
func (cont *AppNewFlowLog) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_KPI.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
gormDb = gormDb.Where(whereMap)
err = gormDb.First(&cont).Error
return
}
// 根据条件获取总数
func (cont *AppNewFlowLog) CountCont(whereMap interface{}) (countId int64) {
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId)
return
}
// 读取全部信息
func (cont *AppNewFlowLog) ContMap(whereMap interface{}, field ...string) (countAry []AppNewFlowLog, err error) {
gormDb := overall.CONSTANT_DB_KPI.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
err = gormDb.Where(whereMap).Find(&countAry).Error
return
}
// 删除内容
func (cont *AppNewFlowLog) DelCont(whereMap interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error
return
}

58
models/modelskpi/depart_dime_post_weight.go

@ -2,10 +2,12 @@ package modelskpi
import ( import (
"key_performance_indicators/overall" "key_performance_indicators/overall"
"key_performance_indicators/overall/publicmethod"
"strings" "strings"
"time"
) )
// 部门考核指标权重 // 岗位考核指标权重
type DepartDimePostWeight struct { type DepartDimePostWeight struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"`
Type int64 `json:"type" gorm:"column:type;type:bigint(20) unsigned;default:0;not null;comment:1:定性考核;2:定量考核"` Type int64 `json:"type" gorm:"column:type;type:bigint(20) unsigned;default:0;not null;comment:1:定性考核;2:定量考核"`
@ -13,7 +15,7 @@ type DepartDimePostWeight struct {
Postid int64 `json:"postid" gorm:"column:postid;type:bigint(20) unsigned;default:0;not null;comment:岗位"` Postid int64 `json:"postid" gorm:"column:postid;type:bigint(20) unsigned;default:0;not null;comment:岗位"`
Dimension int64 `json:"dimension" gorm:"column:dimension;type:bigint(20) unsigned;default:0;not null;comment:考核维度"` Dimension int64 `json:"dimension" gorm:"column:dimension;type:bigint(20) unsigned;default:0;not null;comment:考核维度"`
Target int64 `json:"target" gorm:"column:target;type:bigint(20) unsigned;default:0;not null;comment:指标"` Target int64 `json:"target" gorm:"column:target;type:bigint(20) unsigned;default:0;not null;comment:指标"`
Weight int64 `json:"weight" gorm:"column:weight;type:int(6) unsigned;default:0;not null;comment:权重"` Weight float64 `json:"weight" gorm:"column:weight;type:int(6) unsigned;default:0;not null;comment:权重"`
Addtime int64 `json:"addtime" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:添加时间"` Addtime int64 `json:"addtime" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:添加时间"`
Hierarchy int64 `json:"hierarchy" gorm:"column:hierarchy;type:bigint(20) unsigned;default:0;not null;comment:维度;2:指标"` Hierarchy int64 `json:"hierarchy" gorm:"column:hierarchy;type:bigint(20) unsigned;default:0;not null;comment:维度;2:指标"`
Quote int64 `json:"quote" gorm:"column:is_quote;type:bigint(20) unsigned;default:0;not null;comment:1:不是引用;2:引用部门"` Quote int64 `json:"quote" gorm:"column:is_quote;type:bigint(20) unsigned;default:0;not null;comment:1:不是引用;2:引用部门"`
@ -63,3 +65,55 @@ func (cont *DepartDimePostWeight) DelCont(whereMap interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error
return return
} }
/**
@ 作者: 秦东
@ 时间: 2022-10-25 14:47:00
@ 功能:
@ 参数
#
@ 返回值
#
*/
// 写入岗位考核维度与指标权重
func (cont *DepartDimePostWeight) WriteTargetWeight() (err error) {
where := publicmethod.MapOut[string]()
where["`orgid`"] = cont.Orgid
where["`postid`"] = cont.Postid
where["`dimension`"] = cont.Dimension
where["`hierarchy`"] = cont.Hierarchy
where["`is_quote`"] = cont.Quote
if cont.Hierarchy == 1 {
var oldCont DepartDimePostWeight
err = oldCont.GetCont(where)
if err != nil {
err = overall.CONSTANT_DB_KPI.Create(&cont).Error
return
} else {
editWhe := publicmethod.MapOut[string]()
editWhe["`id`"] = oldCont.Id
saveAry := publicmethod.MapOut[string]()
saveAry["`weight`"] = cont.Weight
saveAry["`time`"] = time.Now().Unix()
err = oldCont.EiteCont(editWhe, saveAry)
return
}
} else {
where["`target`"] = cont.Target
var oldCont DepartDimePostWeight
err = oldCont.GetCont(where)
if err != nil {
err = overall.CONSTANT_DB_KPI.Create(&cont).Error
return
} else {
editWhe := publicmethod.MapOut[string]()
editWhe["`id`"] = oldCont.Id
saveAry := publicmethod.MapOut[string]()
saveAry["`weight`"] = cont.Weight
saveAry["`time`"] = time.Now().Unix()
err = oldCont.EiteCont(editWhe, saveAry)
return
}
}
return
}

86
models/modelskpi/nature_flow_order.go

@ -0,0 +1,86 @@
package modelskpi
import (
"key_performance_indicators/overall"
"strings"
)
// 定性考核流水
type NatureFlowOrder struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;autoIncrement;comment:ID"`
OrderId int64 `json:"orderid" gorm:"column:order_id;type:bigint(20) unsigned;default:0;not null;comment:审批单ID"`
AddOrDecrease int `json:"addordecrease" gorm:"column:add_or_decrease;type:tinyint(1) unsigned;default:1;not null;comment:增加或减少(1:增加;2:减少)"`
Score float64 `json:"score" gorm:"column:score;type:bigint(20) unsigned;default:0;not null;comment:分值(*100保存)"`
Money float64 `json:"money" gorm:"column:money;type:bigint(20) unsigned;default:0;not null;comment:钱(扣款或奖励)*100保存"`
Reason string `json:"reason" gorm:"column:reason;type:text;comment:这样操作的原因"`
ShemeId int64 `json:"shemeid" gorm:"column:sheme_id;type:bigint(20) unsigned;default:0;not null;comment:方案ID"`
ShemeVersion string `json:"shemeversion" gorm:"column:sheme_version;type:varchar(255) ;not null;comment:方案版本编号"`
Dimension int64 `json:"dimension" gorm:"column:dimension;type:bigint(20) unsigned;default:0;not null;comment:维度"`
Target int64 `json:"target" gorm:"column:target;type:bigint(20) unsigned;default:0;not null;comment:指标"`
SonTarget int64 `json:"sontarget" gorm:"column:son_target;type:bigint(20) unsigned;default:0;not null;comment:指标子栏目"`
Detailed int64 `json:"detailed" gorm:"column:detailed;type:bigint(20) unsigned;default:0;not null;comment:指标细则"`
Year int64 `json:"year" gorm:"column:year;type:int(7) unsigned;default:0;not null;comment:年"`
Quarter int64 `json:"quarter" gorm:"column:quarter;type:int(3) unsigned;default:0;not null;comment:季度"`
Month int64 `json:"month" gorm:"column:month;type:int(3) unsigned;default:0;not null;comment:月"`
Week int64 `json:"week" gorm:"column:week;type:int(3) unsigned;default:0;not null;comment:周"`
PersonLiable int64 `json:"personliable" gorm:"column:person_liable;type:bigint(20) unsigned;default:0;not null;comment:责任人"`
CompanyId int64 `json:"companyid" gorm:"column:company_id;type:bigint(20) unsigned;default:0;not null;comment:公司"`
DepartmentId int64 `json:"departmentid" gorm:"column:department_id;type:bigint(20) unsigned;default:0;not null;comment:部门"`
OrgId int64 `json:"orgid" gorm:"column:org_id;type:bigint(20) unsigned;default:0;not null;comment:行政组织"`
PostId int64 `json:"postid" gorm:"column:post_id;type:bigint(20) unsigned;default:0;not null;comment:岗位"`
Executor int64 `json:"executor" gorm:"column:executor;type:bigint(20) unsigned;default:0;not null;comment:执行人"`
ExecutorDepartment int64 `json:"executordepartment" gorm:"column:executor_department;type:bigint(20) unsigned;default:0;not null;comment:执行人部门"`
Rectification int `json:"rectification" gorm:"column:rectification;type:tinyint(1) unsigned;default:2;not null;comment:是否需要整改 1、需要整改;2:无需整改"`
CorrectionTime int64 `json:"correctiontime" gorm:"column:correction_time;type:bigint(20) unsigned;default:0;not null;comment:整改期限"`
HappenTime int64 `json:"happentime" gorm:"column:happen_time;type:bigint(20) unsigned;default:0;not null;comment:发生时间"`
HappenCount int `json:"happencount" gorm:"column:happen_count;type:int(7) unsigned;default:0;not null;comment:发生次数"`
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:时间"`
Class int `json:"class" gorm:"column:class;type:tinyint(1) unsigned;default:1;not null;comment:属性1、定性;2、定量"`
State int `json:"state" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:流程状态 1:草稿;2:驳回;3:审批中;4:归档;5:废弃;6:删除"`
Participants string `json:"participants" gorm:"column:participants;type:longtext;comment:流程参与人"`
}
func (NatureFlowOrder *NatureFlowOrder) TableName() string {
return "nature_flow_order"
}
// 编辑内容
func (cont *NatureFlowOrder) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error
return
}
// 获取内容
func (cont *NatureFlowOrder) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_KPI.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
gormDb = gormDb.Where(whereMap)
err = gormDb.First(&cont).Error
return
}
// 根据条件获取总数
func (cont *NatureFlowOrder) CountCont(whereMap interface{}) (countId int64) {
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId)
return
}
// 读取全部信息
func (cont *NatureFlowOrder) ContMap(whereMap interface{}, field ...string) (countAry []NatureFlowOrder, err error) {
gormDb := overall.CONSTANT_DB_KPI.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
err = gormDb.Where(whereMap).Find(&countAry).Error
return
}
// 删除内容
func (cont *NatureFlowOrder) DelCont(whereMap interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error
return
}

1
models/modelskpi/post_nature_flow.go

@ -34,6 +34,7 @@ type PostNatureFlow struct {
CorrectionTime int64 `json:"correctiontime" gorm:"column:correction_time;type:bigint(20) unsigned;default:0;not null;comment:整改期限"` CorrectionTime int64 `json:"correctiontime" gorm:"column:correction_time;type:bigint(20) unsigned;default:0;not null;comment:整改期限"`
HappenTime int64 `json:"happentime" gorm:"column:happen_time;type:bigint(20) unsigned;default:0;not null;comment:发生时间"` HappenTime int64 `json:"happentime" gorm:"column:happen_time;type:bigint(20) unsigned;default:0;not null;comment:发生时间"`
HappenCount int `json:"happencount" gorm:"column:happen_count;type:int(7) unsigned;default:0;not null;comment:发生次数"` HappenCount int `json:"happencount" gorm:"column:happen_count;type:int(7) unsigned;default:0;not null;comment:发生次数"`
HappenCountMoney int `json:"happencountmoney" gorm:"column:happen_count_money;type:int(7) unsigned;default:0;not null;comment:发生次数(钱)"`
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:时间"` Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:时间"`
} }

8
models/modelskpi/post_workflow_orders.go

@ -25,11 +25,17 @@ type PostWorkflowOrders struct {
Detailed int64 `json:"detailed" gorm:"column:detailed;type:bigint(20) unsigned;default:0;not null;comment:指标细则"` Detailed int64 `json:"detailed" gorm:"column:detailed;type:bigint(20) unsigned;default:0;not null;comment:指标细则"`
Executor int64 `json:"executor" gorm:"column:executor;type:bigint(20) unsigned;default:0;not null;comment:执行人"` Executor int64 `json:"executor" gorm:"column:executor;type:bigint(20) unsigned;default:0;not null;comment:执行人"`
ExecutorDepartment int64 `json:"executordepartment" gorm:"column:executor_department;type:bigint(20) unsigned;default:0;not null;comment:执行人部门"` ExecutorDepartment int64 `json:"executordepartment" gorm:"column:executor_department;type:bigint(20) unsigned;default:0;not null;comment:执行人部门"`
State int `json:"state" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:流程状态 1:草稿;2:驳回;3:审批中;4:归档;5:废弃;6:删除"` State int `json:"state" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:流程状态 流程状态 1:草稿;2:审批中;3:驳回;4:归档;5:废弃;6:删除"`
StartTime int64 `json:"starttime" gorm:"column:start_time;type:bigint(20) unsigned;default:0;not null;comment:流程开始时间"` StartTime int64 `json:"starttime" gorm:"column:start_time;type:bigint(20) unsigned;default:0;not null;comment:流程开始时间"`
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:时间"` Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:时间"`
EnclosureFormat string `json:"enclosureformat" gorm:"column:enclosure_format;type:longtext;comment:附件"` EnclosureFormat string `json:"enclosureformat" gorm:"column:enclosure_format;type:longtext;comment:附件"`
Participants string `json:"participants" gorm:"column:participants;type:longtext;comment:流程参与人"` Participants string `json:"participants" gorm:"column:participants;type:longtext;comment:流程参与人"`
Year int64 `json:"year" gorm:"column:year;type:int(7) unsigned;default:0;not null;comment:年"`
Quarter int64 `json:"quarter" gorm:"column:quarter;type:int(3) unsigned;default:0;not null;comment:季度"`
Month int64 `json:"month" gorm:"column:month;type:int(3) unsigned;default:0;not null;comment:月"`
Week int64 `json:"week" gorm:"column:week;type:int(3) unsigned;default:0;not null;comment:周"`
PersonLiable int64 `json:"personliable" gorm:"column:person_liable;type:bigint(20) unsigned;default:0;not null;comment:责任人"`
HappenTime int64 `json:"happentime" gorm:"column:happen_time;type:bigint(20) unsigned;default:0;not null;comment:发生时间"`
} }
func (PostWorkflowOrders *PostWorkflowOrders) TableName() string { func (PostWorkflowOrders *PostWorkflowOrders) TableName() string {

49
overall/publicmethod/technique.go

@ -29,6 +29,28 @@ import (
) )
// 全局函数处理 // 全局函数处理
// 时间相关处理类
var (
timeLayoutMap = map[string]string{
"y": "2006",
"m": "2006-01",
"d": "2006-01-02",
"h": "2006-01-02 15",
"i": "2006-01-02 15:04",
"s": "2006-01-02 15:04:05",
}
weekDay = map[string]int{
"Monday": 1,
"Tuesday": 2,
"Wednesday": 3,
"Thursday": 4,
"Friday": 5,
"Saturday": 6,
"Sunday": 7,
}
)
// 编号,纯数字 // 编号,纯数字
func TableNumber(class ...string) (number int64) { func TableNumber(class ...string) (number int64) {
result, _ := rand.Int(rand.Reader, big.NewInt(8999)) result, _ := rand.Int(rand.Reader, big.NewInt(8999))
@ -115,6 +137,8 @@ func UnixTimeToDay(timeStamp int64, timeType int) (dateStr string) {
timeTemplate = "20060102" timeTemplate = "20060102"
case 21: case 21:
timeTemplate = "200601" timeTemplate = "200601"
case 22:
timeTemplate = "01-02"
default: default:
timeTemplate = "2006-01-02 15:04:05" //常规类型 timeTemplate = "2006-01-02 15:04:05" //常规类型
} }
@ -1241,4 +1265,27 @@ func GetRefereeTeamWorkWechat(wechatTeamId, departmentId int64) (userStrList []s
return return
} }
//传教审批记录 // 获取指定月的起止时间
func GetAppointMonthStarAndEndTime(dayTime string) (startTime, endTime int64) {
dataTypeAll := "2006-01-02"
dayTime = fmt.Sprintf("%v-%v", dayTime, "01")
firstToTime := StringToTimeIng("d", dayTime)
startTimeStr := fmt.Sprintf("%v 00:00:00", firstToTime.AddDate(0, 0, 0).Format(dataTypeAll))
endTimeStr := fmt.Sprintf("%v 23:59:59", firstToTime.AddDate(0, 1, -1).Format(dataTypeAll))
// startTime = dayTime
startTime = DateToTimeStampOld(startTimeStr)
endTime = DateToTimeStampOld(endTimeStr)
return
}
// 日期字符串转换成time格式
func StringToTimeIng(unit, str string) (res time.Time) {
loc, _ := time.LoadLocation("Local")
// str := t.ToString()
layout, ok := timeLayoutMap[unit]
if !ok {
layout = timeLayoutMap["s"]
}
res, _ = time.ParseInLocation(layout, str, loc)
return
}

Loading…
Cancel
Save