Browse Source

定性考核步进器完成

v1_dev_2
超级管理员 3 years ago
parent
commit
ae60bbf89e
  1. 3
      api/version1/departmentseting/departmentpc/ding_xing.go
  2. 28
      api/version1/departmentseting/departmentpc/type.go
  3. 79
      api/version1/flowchart/entry.go
  4. 230
      api/version1/flowchart/myworkflow.go
  5. 1
      apirouter/v1/departmentseting/pc.go
  6. 77
      models/modelskpi/division_responsibilities.go
  7. 81
      models/modelskpi/duty_flow_data.go
  8. 7
      models/modelskpi/rectification_measures.go
  9. 2
      overall/publicmethod/formatOutput.go
  10. 103
      overall/publicmethod/technique.go

3
api/version1/departmentseting/departmentpc/ding_xing.go

@ -459,6 +459,9 @@ func (a *ApiMethod) SubmitQualityAssess(c *gin.Context) {
if scoreFlowErr == nil && evalProFlowErr == nil && flowLogContErr == nil { if scoreFlowErr == nil && evalProFlowErr == nil && flowLogContErr == nil {
addErr := gormDb.Commit().Error addErr := gormDb.Commit().Error
if addErr == nil { if addErr == nil {
if len(receivedValue.UploadFiles) > 0 {
EditFileHandel(uuid, "score_flow", receivedValue.UploadFiles)
}
publicmethod.Result(0, addErr, c) publicmethod.Result(0, addErr, c)
} else { } else {
addErr := gormDb.Rollback().Error addErr := gormDb.Rollback().Error

28
api/version1/departmentseting/departmentpc/type.go

@ -538,3 +538,31 @@ type UploadFilesCont struct {
Size string `json:"size"` //文件大小文字描述 Size string `json:"size"` //文件大小文字描述
Tag string `json:"tag"` //文件后缀 Tag string `json:"tag"` //文件后缀
} }
// 提交定量数据
type SubmitQuantTargetCont struct {
FlowworkId string `json:"flowworkid"` //流程编号
DepartmentId string `json:"departmentid"` //行政组织
PlanVersionNumber string `json:"planversionnumber"` //方案版本号
Time string `json:"time"` //提报时间
List []RationLogList `json:"list"` //提报数据列表
}
type RationLogList struct {
Id string `json:"id"`
Actual string `json:"actual"` //实际值
ScoringMethod int `json:"scoringmethod"` //计分方式(1:自动;2:手动)"`
ReachScore string `json:"reachscore"` //指标标准分
Unit string `json:"unit"` //单位
Target string `json:"target"` //指标
Targetname string `json:"targetname"` //指标名称
Reason string `json:"reason"` //原因
ReferenceScore int64 `json:"referencescore"` //标准分值"`
ZeroPrize string `json:"zeroprize"` //零奖值
AllPrize string `json:"allprize"` //全奖奖值
CappingVal float64 `json:"cappingcal"` //封顶值
TargetWeight int64 `json:"targetweight"` //权重
PlanVersionNumber string `json:"planversionnumber"` //版本号
Addtime string `json:"month"` //检查时间
Cycle int `json:"cycle"` //1:班;2:天;3:周;4:月;5:季度;6:年;7:半年
}

79
api/version1/flowchart/entry.go

@ -76,12 +76,14 @@ type OutPutWorkflowCont struct {
Attribute int `json:"attribute"` //属性:1:定性;2:定量 Attribute int `json:"attribute"` //属性:1:定性;2:定量
CreaterName string `json:"creatername"` //流程创始人"` CreaterName string `json:"creatername"` //流程创始人"`
DepartmentName string `json:"departmentname"` //接受考核部门名称 DepartmentName string `json:"departmentname"` //接受考核部门名称
DepartmentId int64 `json:"departmentid"` //接受考核部门Id
CreationDate string `json:"creationdate"` //发生日期"` CreationDate string `json:"creationdate"` //发生日期"`
ReportingDate string `json:"reportingdate"` //提报日期"` ReportingDate string `json:"reportingdate"` //提报日期"`
Actionable int `json:"actionable"` //本节点是否可操作(1:可操作;非1:不可操作) Actionable int `json:"actionable"` //本节点是否可操作(1:可操作;非1:不可操作)
OperateOtherNodes currency_recipe.NodeCont `json:"operateothernodes"` //允许操作的节点 OperateOtherNodes currency_recipe.NodeCont `json:"operateothernodes"` //允许操作的节点
SetExecutor int `json:"setexecutor"` //设置执行人 (1:可操作;非1:不可操作) SetExecutor int `json:"setexecutor"` //设置执行人 (1:可操作;非1:不可操作)
NodeStep int `json:"nodestep"` //当前步骤 NodeStep int `json:"nodestep"` //当前步骤
NextStep int `json:"nextstep"` //下一步
//定性部分 //定性部分
DingXingList []DingxingCont `json:"dingxinglist"` //定性指标 DingXingList []DingxingCont `json:"dingxinglist"` //定性指标
//定量部分 //定量部分
@ -89,6 +91,34 @@ type OutPutWorkflowCont struct {
//流程 //流程
WorkFlowList []currency_recipe.NodeCont `json:"workflowlist"` //流程步进树 WorkFlowList []currency_recipe.NodeCont `json:"workflowlist"` //流程步进树
WorkFlowListOld []OldWoekflow `json:"workflowlistold"` //流程步进树 WorkFlowListOld []OldWoekflow `json:"workflowlistold"` //流程步进树
//责任人
DivisionIsShow int `json:"divisionisshow"` //责任划分显示
DivisLoofOfEdit int `json:"divilookofedit"` //责任划分显示或编辑
DivisionList []DivisionListCont `json:"divisionlist"` //责任划分
//整改措施
RunType int `json:"runtype"` //是不是执行节点
MeasureIsShow int `json:"measureisshow"` //整改显示
MeasureList []MeasureCont `json:"measurelist"` //整改措施
}
// 责任划分
type DivisionListCont struct {
Type int `json:"type"` //类型
UserName string `json:"username"` //姓名
UserNumber string `json:"usernumber"` //工号
UserKey string `json:"userkey"` //识别符
Weight float64 `json:"weight"` //权重
}
// 整改措施
type MeasureCont struct {
UserName string `json:"username"` //姓名
UserNumber string `json:"usernumber"` //工号
UserKey string `json:"userkey"` //识别符
OrgNAme string `json:"orgname"` //行政组织
Cause string `json:"cause"` //整改内容
Enclosure []currency_recipe.EnclosureFormat `json:"enclosure"` //附件
Time string `json:"time"` //整改内容
} }
// 允许操作的节点 // 允许操作的节点
@ -104,6 +134,7 @@ type DingxingCont struct {
PlusMinusScore float64 `json:"plusminusscore"` //加减分 PlusMinusScore float64 `json:"plusminusscore"` //加减分
Cause string `json:"cause"` //原因 Cause string `json:"cause"` //原因
PlusReduction int `json:"plusreduction"` //加减分 1:减少;2:增加; PlusReduction int `json:"plusreduction"` //加减分 1:减少;2:增加;
Enclosure []UploadFilesCont `json:"enclosure"` //附件
} }
type DingLiangCont struct { type DingLiangCont struct {
Dimension string `json:"dimension"` //维度"` Dimension string `json:"dimension"` //维度"`
@ -164,9 +195,40 @@ type OldLog struct {
// 审批参数 // 审批参数
type ExamAndApp struct { type ExamAndApp struct {
publicmethod.PublicId //流程ID publicmethod.PublicId //流程ID
Step int `json:"step"` //步数
YesOrNo int `json:"yesorno"` //1:未操作,2:同意;3:驳回 YesOrNo int `json:"yesorno"` //1:未操作,2:同意;3:驳回
Cause string `json:"cause"` //意见 Cause string `json:"cause"` //意见
Enclosure []currency_recipe.EnclosureFormat `json:"enclosure"` //附件 Enclosure []currency_recipe.EnclosureFormat `json:"enclosure"` //附件
SetExecutor int `json:"setexecutor"` //划分责任人 1:划分;非1:不划分
ExecutorList []ExecutorCont `json:"executorlist"` //责任人列表
CorrectiveAction CorrectiveActionCont `json:"correctiveaction"` //整改措施
}
// 整改措施
type CorrectiveActionCont struct {
IsTrue int `json:"istrue"` //步数
Content string `json:"content"` //意见
Enclosure []UploadFilesCont `json:"filelist"` //附件
}
// 附件文件
type UploadFilesCont struct {
publicmethod.PublicName //文件名称
FileUrl string `json:"fileUrl"` //文件访问地址
PhysicsPath string `json:"physicspath"` //文件物理地址
Type int `json:"type"` //类型 1:图片;2:视频;3:office文档;4:压缩文件;5:其他文件
FileSize int64 `json:"fileSize"` //文件大小(单位:B)
Size string `json:"size"` //文件大小文字描述
Tag string `json:"tag"` //文件后缀
}
// 责任人内容
type ExecutorCont struct {
Type int `json:"type"` //责任类型(1、主要责任人;2、互保责任人;3、责任班组;4、责任班组长;5、主管;6、三大员;7、厂长;8、主任)
UserKey string `json:"userkey"` //责任人Key
UserName string `json:"username"` //责任人姓名
UserNumber string `json:"usernumber"` //责任人编号
Weight string `json:"weight"` //占责比重
} }
// 审批执行 // 审批执行
@ -182,5 +244,20 @@ type WorkFlowRuning struct {
NextStep int //下一步 NextStep int //下一步
NextNodeCont currency_recipe.NodeCont //下一节点 NextNodeCont currency_recipe.NodeCont //下一节点
NextExecutor []string //下一步执行人 NextExecutor []string //下一步执行人
RunNode currency_recipe.NodeCont RunNode currency_recipe.NodeCont //当前执行中的节点
DesignatedOperator DesignatedOperatorCont `json:"designatedoperator"` //指定操作人员
CorrectiveAction CorreActionCont `json:"correctiveaction"` //整改措施
}
// 整改措施
type CorreActionCont struct {
IsTrue int `json:"istrue"` //步数
Content string `json:"content"` //意见
Annex []currency_recipe.EnclosureFormat `json:"annex"` //附件(流程)
}
// 指定操作人员
type DesignatedOperatorCont struct {
IsTrue bool `json:"isTrue"`
UserList []currency_recipe.UserListFlowAll `json:"userlist"` //节点操作人
} }

230
api/version1/flowchart/myworkflow.go

@ -62,16 +62,17 @@ func (a *ApiMethod) GetApprovalRecord(c *gin.Context) {
} }
userIdentity := publicmethod.DetermineUserIdentity(myLoginCont.Key) userIdentity := publicmethod.DetermineUserIdentity(myLoginCont.Key)
switch userIdentity.Level { switch userIdentity.Level {
// case 1: case 1:
// gormDb = gormDb.Where("FIND_IN_SET(?,`ep_participants`)", myLoginCont.Key) gormDb = gormDb.Where("FIND_IN_SET(?,`ep_participants`)", myLoginCont.Key)
// case 2: case 2:
// gormDb = gormDb.Where("`ep_setup_department` IN ? OR `ep_accept_department` IN ?", userIdentity.OrgList) gormDb = gormDb.Where("`ep_setup_department` IN ? OR `ep_accept_department` IN ?", userIdentity.OrgList, userIdentity.OrgList)
// case 3: case 3:
// gormDb = gormDb.Where("`ep_clique` = ? ", userIdentity.Group) gormDb = gormDb.Where("`ep_clique` = ? ", userIdentity.Group)
// case 4: case 4:
// gormDb = gormDb.Where("`ep_setup_department` IN ? OR `ep_accept_department` IN ?", userIdentity.OrgList) gormDb = gormDb.Where("`ep_setup_department` IN ? OR `ep_accept_department` IN ?", userIdentity.OrgList, userIdentity.OrgList)
default: default:
} }
fmt.Printf("userIdentity------------>%v\n", userIdentity)
var total int64 var total int64
totalErr := gormDb.Count(&total).Error totalErr := gormDb.Count(&total).Error
if totalErr != nil { if totalErr != nil {
@ -135,7 +136,7 @@ func (a *ApiMethod) GetApprovalRecord(c *gin.Context) {
userNameCree = append(userNameCree, uv.Name) userNameCree = append(userNameCree, uv.Name)
} }
} }
sendCont.CurrentNodeMan = strings.Join(userNameCree, "") sendCont.CurrentNodeMan = strings.Join(userNameCree, ",")
} }
} }
} }
@ -154,7 +155,7 @@ func (a *ApiMethod) GetApprovalRecord(c *gin.Context) {
userNameCreeOld = append(userNameCreeOld, uvo.Name) userNameCreeOld = append(userNameCreeOld, uvo.Name)
} }
} }
sendCont.CurrentNodeMan = strings.Join(userNameCreeOld, "") sendCont.CurrentNodeMan = strings.Join(userNameCreeOld, ",")
} }
} }
} }
@ -207,17 +208,20 @@ func (a *ApiMethod) LookWorkFlowCont(c *gin.Context) {
sendCont.Id = strconv.FormatInt(evalProCont.Id, 10) sendCont.Id = strconv.FormatInt(evalProCont.Id, 10)
sendCont.FlowNumber = strconv.FormatInt(evalProCont.OrderKey, 10) sendCont.FlowNumber = strconv.FormatInt(evalProCont.OrderKey, 10)
sendCont.Attribute = evalProCont.TypeClass //1、定性;2、定量"` sendCont.Attribute = evalProCont.TypeClass //1、定性;2、定量"`
sendCont.NextStep = evalProCont.NextStep
if evalProCont.Creater != 0 { if evalProCont.Creater != 0 {
var creaCont modelshr.PersonArchives var creaCont modelshr.PersonArchives
creaCont.GetCont(map[string]interface{}{"`key`": evalProCont.Creater}, "`name`") creaCont.GetCont(map[string]interface{}{"`key`": evalProCont.Creater}, "`name`")
sendCont.CreaterName = creaCont.Name sendCont.CreaterName = creaCont.Name
} }
sendCont.DepartmentId = evalProCont.AcceptDepartment
var accOrgCont modelshr.AdministrativeOrganization var accOrgCont modelshr.AdministrativeOrganization
accOrgCont.GetCont(map[string]interface{}{"`id`": evalProCont.AcceptDepartment}, "`name`") accOrgCont.GetCont(map[string]interface{}{"`id`": evalProCont.AcceptDepartment}, "`name`")
sendCont.DepartmentName = accOrgCont.Name sendCont.DepartmentName = accOrgCont.Name
sendCont.CreationDate = publicmethod.UnixTimeToDay(evalProCont.HappenTime, 11) sendCont.CreationDate = publicmethod.UnixTimeToDay(evalProCont.HappenTime, 11)
sendCont.ReportingDate = publicmethod.UnixTimeToDay(evalProCont.Time, 11) sendCont.ReportingDate = publicmethod.UnixTimeToDay(evalProCont.Time, 11)
sendCont.IsOld = evalProCont.EpOld sendCont.IsOld = evalProCont.EpOld
nextRunType := 1
if evalProCont.EpOld == 2 { if evalProCont.EpOld == 2 {
json.Unmarshal([]byte(evalProCont.Content), &sendCont.WorkFlowList) json.Unmarshal([]byte(evalProCont.Content), &sendCont.WorkFlowList)
if evalProCont.NextStep != 0 && evalProCont.NextStep <= len(sendCont.WorkFlowList) { if evalProCont.NextStep != 0 && evalProCont.NextStep <= len(sendCont.WorkFlowList) {
@ -228,7 +232,8 @@ func (a *ApiMethod) LookWorkFlowCont(c *gin.Context) {
if evalProCont.State < 4 && evalProCont.NextContent != "" { if evalProCont.State < 4 && evalProCont.NextContent != "" {
var nextNodeCont currency_recipe.NodeCont var nextNodeCont currency_recipe.NodeCont
json.Unmarshal([]byte(evalProCont.NextContent), &nextNodeCont) json.Unmarshal([]byte(evalProCont.NextContent), &nextNodeCont)
// sendCont.RunType = nextNodeCont.Type
nextRunType = nextNodeCont.Type
//获取登录人信息 //获取登录人信息
myLoginCont, _ := publicmethod.LoginMyCont(c) myLoginCont, _ := publicmethod.LoginMyCont(c)
if len(nextNodeCont.UserList) > 0 { if len(nextNodeCont.UserList) > 0 {
@ -236,6 +241,7 @@ func (a *ApiMethod) LookWorkFlowCont(c *gin.Context) {
myKeyStr := strconv.FormatInt(myLoginCont.Key, 10) myKeyStr := strconv.FormatInt(myLoginCont.Key, 10)
if uv.Id == myKeyStr { if uv.Id == myKeyStr {
sendCont.Actionable = 1 sendCont.Actionable = 1
} }
} }
} }
@ -243,6 +249,7 @@ func (a *ApiMethod) LookWorkFlowCont(c *gin.Context) {
if len(sendCont.WorkFlowList) > 0 { if len(sendCont.WorkFlowList) > 0 {
for _, av := range sendCont.WorkFlowList { for _, av := range sendCont.WorkFlowList {
if av.CustomNode == nextNodeCont.NodeNumber { if av.CustomNode == nextNodeCont.NodeNumber {
sendCont.OperateOtherNodes = av sendCont.OperateOtherNodes = av
sendCont.SetExecutor = 1 sendCont.SetExecutor = 1
} }
@ -263,7 +270,7 @@ func (a *ApiMethod) LookWorkFlowCont(c *gin.Context) {
if evalProCont.TypeClass == 1 { if evalProCont.TypeClass == 1 {
var scoreFlowList []modelskpi.ScoreFlow var scoreFlowList []modelskpi.ScoreFlow
overall.CONSTANT_DB_KPI.Model(&modelskpi.ScoreFlow{}).Select("sf_evaluation_plan,sf_plus_reduce_score,sf_score,sf_reason,sf_count,sf_target_id,sf_detailed_id").Where("sf_key = ?", evalProCont.OrderKey).Find(&scoreFlowList) overall.CONSTANT_DB_KPI.Model(&modelskpi.ScoreFlow{}).Select("sf_evaluation_plan,sf_plus_reduce_score,sf_score,sf_reason,sf_count,sf_target_id,sf_detailed_id,sf_enclosure").Where("sf_key = ?", evalProCont.OrderKey).Find(&scoreFlowList)
if len(scoreFlowList) > 0 { if len(scoreFlowList) > 0 {
for _, v := range scoreFlowList { for _, v := range scoreFlowList {
var dingXingCong DingxingCont var dingXingCong DingxingCont
@ -305,7 +312,9 @@ func (a *ApiMethod) LookWorkFlowCont(c *gin.Context) {
} }
dingXingCong.Cause = v.Reason dingXingCong.Cause = v.Reason
dingXingCong.PlusReduction = v.PlusReduceScore dingXingCong.PlusReduction = v.PlusReduceScore
if v.Enclosure != "" {
json.Unmarshal([]byte(v.Enclosure), &dingXingCong.Enclosure)
}
sendCont.DingXingList = append(sendCont.DingXingList, dingXingCong) sendCont.DingXingList = append(sendCont.DingXingList, dingXingCong)
} }
} }
@ -366,6 +375,69 @@ func (a *ApiMethod) LookWorkFlowCont(c *gin.Context) {
} }
} }
//获取责任划分
var dutyListCont []modelskpi.DivisionResponsibilities
err = overall.CONSTANT_DB_KPI.Model(&modelskpi.DivisionResponsibilities{}).Select("df_type,df_user_name,df_user_key,df_weight,df_user_number").Where("df_sf_id = ?", evalProCont.OrderKey).Find(&dutyListCont).Error
if err == nil && len(dutyListCont) > 0 {
sendCont.DivisionIsShow = 1
for _, dlv := range dutyListCont {
var dutyCont DivisionListCont
dutyCont.Type = dlv.Type //类型
dutyCont.UserName = dlv.UserName //姓名
dutyCont.UserNumber = dlv.UserNumber //工号
dutyCont.UserKey = strconv.FormatInt(dlv.UserKey, 10) //识别码
dutyCont.Weight = publicmethod.DecimalEs(float64(dlv.Weight)/100, 2) //权重
sendCont.DivisionList = append(sendCont.DivisionList, dutyCont)
}
}
if sendCont.Actionable == 1 {
if sendCont.SetExecutor == 1 {
sendCont.DivisionIsShow = 1
sendCont.DivisLoofOfEdit = 1
} else {
sendCont.DivisLoofOfEdit = 2
}
if nextRunType == 3 {
sendCont.RunType = 1
} else {
sendCont.RunType = 2
}
} else {
sendCont.DivisLoofOfEdit = 2
sendCont.RunType = 2
}
// fmt.Printf("nextRunType------>%v\n", nextRunType)
//获取整改措施
var measureList []modelskpi.RectificationMeasures
err = overall.CONSTANT_DB_KPI.Model(&modelskpi.RectificationMeasures{}).Select("rm_user_key,rm_state,rm_time,rm_content,rm_files").Where("depart_post = 1 AND rm_order = ?", evalProCont.OrderKey).Find(&measureList).Error
if err == nil && len(measureList) > 0 {
sendCont.MeasureIsShow = 1
for _, mlv := range measureList {
var measUser modelshr.PersonArchives
measUser.GetCont(map[string]interface{}{"`key`": mlv.UserKey}, "`name`", "`number`", "`admin_org`")
var measCont MeasureCont
measCont.UserName = measUser.Name //姓名
measCont.UserNumber = measUser.Number //工号
measCont.UserKey = strconv.FormatInt(mlv.UserKey, 10) //识别符
var orgCont modelshr.AdministrativeOrganization
orgCont.GetCont(map[string]interface{}{"`id`": measUser.AdminOrg}, "`name`")
measCont.OrgNAme = orgCont.Name //行政组织
measCont.Cause = mlv.Content //整改内容
if mlv.Enclosure != "" {
hjsdj := json.Unmarshal([]byte(mlv.Enclosure), &measCont.Enclosure)
fmt.Printf("hjsdj----------->%+v\n", hjsdj)
}
measCont.Time = publicmethod.UnixTimeToDay(mlv.Time, 1) //整改内容
sendCont.MeasureList = append(sendCont.MeasureList, measCont)
}
} else {
if sendCont.RunType == 1 {
sendCont.MeasureIsShow = 1
}
}
publicmethod.Result(0, sendCont, c) publicmethod.Result(0, sendCont, c)
} }
@ -421,6 +493,11 @@ func (a *ApiMethod) ExamineAndApprove(c *gin.Context) {
publicmethod.Result(1, err, c, "流程已归档!不可进行审批!") publicmethod.Result(1, err, c, "流程已归档!不可进行审批!")
return return
} }
if evalProCont.NextStep != receivedValue.Step {
publicmethod.Result(1, err, c, "改节点已经被其他人操作!不可重复操作!")
return
}
if evalProCont.NextContent != "" { if evalProCont.NextContent != "" {
var nextNodeInfo currency_recipe.NodeCont var nextNodeInfo currency_recipe.NodeCont
jsonErr := json.Unmarshal([]byte(evalProCont.NextContent), &nextNodeInfo) jsonErr := json.Unmarshal([]byte(evalProCont.NextContent), &nextNodeInfo)
@ -438,6 +515,7 @@ func (a *ApiMethod) ExamineAndApprove(c *gin.Context) {
} }
} }
} }
var workFlowList []currency_recipe.NodeCont var workFlowList []currency_recipe.NodeCont
json.Unmarshal([]byte(evalProCont.Content), &workFlowList) json.Unmarshal([]byte(evalProCont.Content), &workFlowList)
var runWorkflow WorkFlowRuning var runWorkflow WorkFlowRuning
@ -448,6 +526,96 @@ func (a *ApiMethod) ExamineAndApprove(c *gin.Context) {
runWorkflow.YesOrNo = receivedValue.YesOrNo runWorkflow.YesOrNo = receivedValue.YesOrNo
runWorkflow.Cause = receivedValue.Cause runWorkflow.Cause = receivedValue.Cause
runWorkflow.Enclosure = receivedValue.Enclosure runWorkflow.Enclosure = receivedValue.Enclosure
//判断是否需要写入责任人
if receivedValue.SetExecutor == 1 {
if len(receivedValue.ExecutorList) > 0 {
//责任划分
var addDivisRespon []modelskpi.DivisionResponsibilities
for _, elv := range receivedValue.ExecutorList {
var userInfo modelshr.PersonArchives
userInfo.GetCont(map[string]interface{}{"key": elv.UserKey})
if elv.Type == 1 {
runWorkflow.DesignatedOperator.UserList = append(runWorkflow.DesignatedOperator.UserList, currency_recipe.SetOperator(userInfo))
}
var addDivCont modelskpi.DivisionResponsibilities
addDivCont.ScoreFlow = evalProCont.OrderKey //归属加减分关联值"`
addDivCont.Type = elv.Type //责任类型(1、主要责任人;2、互保责任人;3、责任班组;4、责任班组长;5、主管;6、三大员;7、厂长、主任)"`
addDivCont.UserName = userInfo.Name //责任人名"`
addDivCont.UserNumber = userInfo.Number //责任人工号"`
addDivCont.UserKey = userInfo.Key //责任人KEY"`
addDivCont.Department = userInfo.AdminOrg //责任人部门"`
addDivCont.Group = userInfo.Company //责任人集团"`
addDivCont.Tema = userInfo.TeamId //责任人班组"`
weightFloat64, _ := strconv.ParseFloat(elv.Weight, 64)
weightInt64, _ := strconv.ParseInt(strconv.FormatFloat(weightFloat64*100, 'f', -1, 64), 10, 64)
addDivCont.Weight = weightInt64 //比重"`*100
addDivCont.Time = time.Now().Unix() //创建时间"`
addDivCont.EiteTime = time.Now().Unix() //修改时间"`
addDivCont.DistributionUser = publicmethod.GetUUid(8) //分配任key"`
addDivCont.EvaluationDepartment = myLoginCont.MainDeparment //测评部门"`
addDivCont.EvaluationUser = myLoginCont.Key //测评人"`
addDivCont.EvaluationGroup = myLoginCont.Company //测评集团"`
addDivisRespon = append(addDivisRespon, addDivCont)
}
if len(runWorkflow.DesignatedOperator.UserList) > 0 {
runWorkflow.DesignatedOperator.IsTrue = true
} else {
runWorkflow.DesignatedOperator.IsTrue = false
}
if len(addDivisRespon) > 0 {
var delDivCont modelskpi.DivisionResponsibilities
delDivCont.DelCont(map[string]interface{}{"df_sf_id": evalProCont.OrderKey})
overall.CONSTANT_DB_KPI.Create(&addDivisRespon)
}
} else {
publicmethod.Result(1, err, c, "未划分责任人!请先划分责任人!")
return
}
}
//提交整改意见
if receivedValue.CorrectiveAction.IsTrue == 1 {
if receivedValue.CorrectiveAction.Content == "" {
publicmethod.Result(1, err, c, "请输入整改意见!")
return
} else {
runWorkflow.CorrectiveAction.IsTrue = 1
runWorkflow.CorrectiveAction.Content = receivedValue.CorrectiveAction.Content
var fileListCont []currency_recipe.EnclosureFormat
if len(receivedValue.CorrectiveAction.Enclosure) > 0 {
for _, ev := range receivedValue.CorrectiveAction.Enclosure {
var fileCont currency_recipe.EnclosureFormat
fileCont.FileName = ev.Name //附件名称
fileCont.FilePath = ev.FileUrl //附件地址
fileCont.Type = ev.Type //附件类型
fmt.Printf("副将---->%v\n---->%v\n", fileCont, ev)
runWorkflow.CorrectiveAction.Annex = append(runWorkflow.CorrectiveAction.Annex, fileCont)
fileListCont = append(fileListCont, fileCont)
}
}
var userInfo modelshr.PersonArchives
userInfo.GetCont(map[string]interface{}{"key": myLoginCont.Key})
var writeRectMeas modelskpi.RectificationMeasures
writeRectMeas.UserKey = userInfo.Key //整改人"`
writeRectMeas.Department = userInfo.AdminOrg //整改部门"`
writeRectMeas.Group = userInfo.Company //集团"`
writeRectMeas.OrderKey = evalProCont.OrderKey //订单ID"`
writeRectMeas.State = 2 //1:草果;2:审批中;3:不合格;4:合格"`
writeRectMeas.Time = time.Now().Unix() //创建时间"`
writeRectMeas.EiteTime = time.Now().Unix() //修改时间"`
writeRectMeas.Content = receivedValue.CorrectiveAction.Content //整改内容"`
if len(fileListCont) > 0 {
fileJson, _ := json.Marshal(fileListCont)
writeRectMeas.Enclosure = string(fileJson) //附件"`
}
writeRectMeas.DepartPost = 1 //1、部门;2:岗位"`
fmt.Printf("附件---->%v\n---->%v\n", fileListCont, writeRectMeas)
writeRectMeas.AddCont()
}
}
runWorkflow.ProcessOperation() runWorkflow.ProcessOperation()
editWorkflow := publicmethod.MapOut[string]() editWorkflow := publicmethod.MapOut[string]()
@ -479,7 +647,11 @@ func (a *ApiMethod) ExamineAndApprove(c *gin.Context) {
} else { } else {
editWorkflow["ep_state"] = receivedValue.YesOrNo editWorkflow["ep_state"] = receivedValue.YesOrNo
} }
if runWorkflow.NextStep == 0 {
editWorkflow["ep_step"] = len(runWorkflow.List)
} else {
editWorkflow["ep_step"] = runWorkflow.Step editWorkflow["ep_step"] = runWorkflow.Step
}
editWorkflow["ep_time"] = time.Now().Unix() editWorkflow["ep_time"] = time.Now().Unix()
var evalProContEdit modelskpi.EvaluationProcess var evalProContEdit modelskpi.EvaluationProcess
@ -530,6 +702,7 @@ func (w *WorkFlowRuning) ProcessOperation() {
} }
} }
if v.Step == w.Step { //当前节点 if v.Step == w.Step { //当前节点
w.AddNodeOperator(v.NodeNumber)
w.List[i].State = 2 //节点置已操作 w.List[i].State = 2 //节点置已操作
var atPresentWechat []string var atPresentWechat []string
var atPresent []string var atPresent []string
@ -559,6 +732,14 @@ func (w *WorkFlowRuning) ProcessOperation() {
w.NodeNot(total, v.GoBackNode) w.NodeNot(total, v.GoBackNode)
} }
} else { } else {
for ui, _ := range v.UserList {
var userCarrLog currency_recipe.LogList
userCarrLog.State = w.YesOrNo //状态 1、未操作;2、通过;3、驳回
userCarrLog.Cause = w.Cause
userCarrLog.TimeVal = publicmethod.UnixTimeToDay(time.Now().Unix(), 1)
userCarrLog.Enclosure = w.Enclosure //附件
w.List[i].UserList[ui].LogList = append(w.List[i].UserList[ui].LogList, userCarrLog)
}
//是抄送节点 //是抄送节点
w.ProcessOperation() w.ProcessOperation()
return return
@ -579,6 +760,16 @@ func (w *WorkFlowRuning) ProcessOperation() {
} }
} }
func (w *WorkFlowRuning) AddNodeOperator(nodeNumber string) {
if w.DesignatedOperator.IsTrue {
for i, v := range w.List {
if v.CustomNode == nodeNumber {
w.List[i].UserList = w.DesignatedOperator.UserList
}
}
}
}
/* /*
* *
@ 作者: 秦东 @ 作者: 秦东
@ -604,7 +795,12 @@ func (w *WorkFlowRuning) NodeNot(total int, nodeNumber string) {
for _, nv := range w.List { for _, nv := range w.List {
if nv.NodeNumber == nodeNumber { if nv.NodeNumber == nodeNumber {
w.NextStep = nv.Step w.NextStep = nv.Step
w.Step = nv.Step stepVal := nv.Step - 1
if stepVal < 1 {
w.Step = 1
} else {
w.Step = stepVal
}
break break
} }
} }
@ -653,10 +849,10 @@ func (w *WorkFlowRuning) NodeYes(total int) {
if writeLog { //参送节点直接发送信息 if writeLog { //参送节点直接发送信息
var userCarrLog currency_recipe.LogList var userCarrLog currency_recipe.LogList
userCarrLog.State = w.YesOrNo //状态 1、未操作;2、通过;3、驳回 userCarrLog.State = 2 //状态 1、未操作;2、通过;3、驳回
userCarrLog.Cause = w.Cause userCarrLog.Cause = ""
userCarrLog.TimeVal = publicmethod.UnixTimeToDay(time.Now().Unix(), 1) userCarrLog.TimeVal = publicmethod.UnixTimeToDay(time.Now().Unix(), 1)
userCarrLog.Enclosure = w.Enclosure //附件 // userCarrLog.Enclosure = w.Enclosure //附件
w.List[i].UserList[ni].LogList = append(w.List[i].UserList[ni].LogList, userCarrLog) w.List[i].UserList[ni].LogList = append(w.List[i].UserList[ni].LogList, userCarrLog)
} }
} }

1
apirouter/v1/departmentseting/pc.go

@ -74,5 +74,6 @@ func (a *ApiRouter) RouterGroupPc(router *gin.RouterGroup) {
apiRouter.POST("get_quality_tasks", methodBinding.GetQualityTasks) //获取定性考核任务列表 apiRouter.POST("get_quality_tasks", methodBinding.GetQualityTasks) //获取定性考核任务列表
apiRouter.POST("get_qualbylaws_tasks", methodBinding.GetQualityBylawsTasks) //相关提报人定性考核细则列表 apiRouter.POST("get_qualbylaws_tasks", methodBinding.GetQualityBylawsTasks) //相关提报人定性考核细则列表
apiRouter.POST("submit_quality_assess", methodBinding.SubmitQualityAssess) //提交定性考核 apiRouter.POST("submit_quality_assess", methodBinding.SubmitQualityAssess) //提交定性考核
apiRouter.POST("submit_quantify_target", methodBinding.SubmitQuantifyTarget) //提交定量考核
} }
} }

77
models/modelskpi/division_responsibilities.go

@ -0,0 +1,77 @@
package modelskpi
import (
"key_performance_indicators/overall"
"strings"
)
// 划分责任 division_responsibilities
type DivisionResponsibilities struct {
Id int64 `json:"id" gorm:"primaryKey;column:df_id;type:bigint(20) unsigned;not null"`
ScoreFlow int64 `json:"scoreflow" gorm:"column:df_sf_id;type:bigint(20) unsigned;default:0;not null;comment:归属加减分关联值"`
Type int `json:"type" gorm:"column:df_type;type:tinyint(1) unsigned;default:1;not null;comment:责任类型(1、主要责任人;2、互保责任人;3、责任班组;4、责任班组长;5、主管;6、三大员;7、厂长、主任)"`
UserName string `json:"username" gorm:"column:df_user_name;type:varchar(100);comment:责任人名"`
UserNumber string `json:"usernumber" gorm:"column:df_user_number;type:varchar(100);comment:责任人工号"`
UserKey int64 `json:"userkey" gorm:"column:df_user_key;type:bigint(20) unsigned;default:0;not null;comment:责任人KEY"`
Department int64 `json:"department" gorm:"column:df_department_id;type:bigint(20) unsigned;default:0;not null;comment:责任人部门"`
Group int64 `json:"group" gorm:"column:df_group;type:bigint(20) unsigned;default:0;not null;comment:责任人集团"`
Tema int64 `json:"tema" gorm:"column:df_tema;type:bigint(20) unsigned;default:0;not null;comment:责任人班组"`
Weight int64 `json:"weight" gorm:"column:df_weight;type:int(7) unsigned;default:0;not null;comment:比重"`
Time int64 `json:"time" gorm:"column:df_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"`
EiteTime int64 `json:"eitetime" gorm:"column:df_eite_time;type:bigint(20) unsigned;default:0;not null;comment:修改时间"`
DistributionUser int64 `json:"distributionuser" gorm:"column:df_distribution_user;type:bigint(20) unsigned;default:0;not null;comment:分配任key"`
EvaluationDepartment int64 `json:"evaluationdepartment" gorm:"column:df_evaluation_department;type:bigint(20) unsigned;default:0;not null;comment:测评部门"`
EvaluationUser int64 `json:"evaluationuser" gorm:"column:df_evaluation_user;type:bigint(20) unsigned;default:0;not null;comment:测评人"`
EvaluationGroup int64 `json:"evaluationgroup" gorm:"column:df_evaluation_group;type:bigint(20) unsigned;default:0;not null;comment:测评集团"`
}
func (DivisionResponsibilities *DivisionResponsibilities) TableName() string {
return "division_responsibilities"
}
// 添加
func (cont *DivisionResponsibilities) AddCont() (err error) {
err = overall.CONSTANT_DB_KPI.Create(&cont).Error
return
}
// 编辑内容
func (cont *DivisionResponsibilities) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error
return
}
// 获取内容
func (cont *DivisionResponsibilities) 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 *DivisionResponsibilities) CountCont(whereMap interface{}) (countId int64) {
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId)
return
}
// 读取全部信息
func (cont *DivisionResponsibilities) ContMap(whereMap interface{}, field ...string) (countAry []DivisionResponsibilities, 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 *DivisionResponsibilities) DelCont(whereMap interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error
return
}

81
models/modelskpi/duty_flow_data.go

@ -0,0 +1,81 @@
package modelskpi
import (
"key_performance_indicators/overall"
"strings"
)
// 定量考核数据流
type DutyFlowData struct {
Id int64 `json:"id" gorm:"primaryKey;column:fld_id;type:bigint(20) unsigned;not null;comment:Id;index"`
EvaluationPlan int64 `json:"evaluationplan" gorm:"column:fld_evaluation_id;type:bigint(20) unsigned;default:0;not null;comment:考核方案项目ID"`
Key int64 `json:"key" gorm:"column:fld_flow_log;type:bigint(20) unsigned;default:0;not null;comment:识别标志"`
Score int64 `json:"score" gorm:"column:fld_score;type:bigint(20) unsigned;default:0;not null;comment:数据"`
Content string `json:"content" gorm:"column:fld_cont;type:mediumtext;comment:描述"`
Enclosure string `json:"enclosure" gorm:"column:fld_enclosure;type:longtext;comment:附件"`
Time int64 `json:"time" gorm:"column:fld_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"`
ScoringMethod int `json:"scoringmethod" gorm:"column:fld_scoring_method;type:int(1) unsigned;default:1;not null;comment:计分方式(1:自动;2:手动)"`
ScoringScore float64 `json:"scoringscore" gorm:"column:fld_scoring_score;type:bigint(20) unsigned;default:0;not null;comment:手动分"`
PlanVersion string `json:"planversion" gorm:"column:fld_planversion;type:varchar(255);comment:版本号"`
Year int64 `json:"year" gorm:"column:fld_year;type:int(7) unsigned;default:0;not null;comment:年分"`
Quarter int64 `json:"quarter" gorm:"column:fld_quarter;type:int(2) unsigned;default:0;not null;comment:季度"`
Month int64 `json:"month" gorm:"column:fld_month;type:int(2) unsigned;default:0;not null;comment:月"`
Week int64 `json:"week" gorm:"column:fld_week;type:int(5) unsigned;default:0;not null;comment:周"`
ToDay int64 `json:"today" gorm:"column:fld_day;type:int(5) unsigned;default:0;not null;comment:天"`
TargetId int64 `json:"targetid" gorm:"column:fld_target_id;type:bigint(20) unsigned;default:0;not null;comment:指标ID"`
EvaluationDepartment int64 `json:"evaluationdepartment" gorm:"column:fl_evaluation_department;type:bigint(20) unsigned;default:0;not null;comment:测评部门"`
EvaluationUser int64 `json:"evaluationuser" gorm:"column:fl_evaluation_user;type:bigint(20) unsigned;default:0;not null;comment:测评人"`
EvaluationGroup int64 `json:"evaluationgroup" gorm:"column:fl_evaluation_group;type:bigint(20) unsigned;default:0;not null;comment:测评集团"`
EnclosureFlow string `json:"enclosure" gorm:"column:fl_enclosure;type:longtext;comment:附件"`
DutyGroup int64 `json:"dutygroup" gorm:"column:fl_duty_group;type:bigint(20) unsigned;default:0;not null;comment:职责集团"`
DutyDepartment int64 `json:"dutydepartment" gorm:"column:fl_duty_department;type:bigint(20) unsigned;default:0;not null;comment:职责部门"`
Reply int `json:"reply" gorm:"column:fl_reply;type:int(2) unsigned;default:1;not null;comment:状态(0:删除;1:起草;2:审批;3:通过)"`
ContentFlow string `json:"content" gorm:"column:fl_content;type:mediumtext;comment:描述"`
Baseline string `json:"baseline" gorm:"column:fl_baseline;type:longtext;comment:基准线 "`
}
func (DutyFlowData *DutyFlowData) TableName() string {
return "duty_flow_data"
}
// 编辑内容
func (cont *DutyFlowData) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error
return
}
// 获取内容
func (cont *DutyFlowData) 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 *DutyFlowData) CountCont(whereMap interface{}) (countId int64) {
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId)
return
}
// 读取全部信息
func (cont *DutyFlowData) ContMap(whereMap interface{}, field ...string) (countAry []DutyFlowData, 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 *DutyFlowData) DelCont(whereMap interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error
return
}

7
models/modelskpi/rectification_measures.go

@ -17,12 +17,19 @@ type RectificationMeasures struct {
EiteTime int64 `json:"eitetime" gorm:"column:rm_eite_time;type:bigint(20) unsigned;default:0;not null;comment:修改时间"` EiteTime int64 `json:"eitetime" gorm:"column:rm_eite_time;type:bigint(20) unsigned;default:0;not null;comment:修改时间"`
Content string `json:"content" gorm:"column:rm_content;type:longtext;comment:整改内容"` Content string `json:"content" gorm:"column:rm_content;type:longtext;comment:整改内容"`
Enclosure string `json:"enclosure" gorm:"column:rm_files;type:longtext;comment:附件"` Enclosure string `json:"enclosure" gorm:"column:rm_files;type:longtext;comment:附件"`
DepartPost int `json:"departpost" gorm:"column:depart_post;type:int(1) unsigned;default:1;not null;comment:1、部门;2:岗位"`
} }
func (RectificationMeasures *RectificationMeasures) TableName() string { func (RectificationMeasures *RectificationMeasures) TableName() string {
return "rectification_measures" return "rectification_measures"
} }
// 添加
func (cont *RectificationMeasures) AddCont() (err error) {
err = overall.CONSTANT_DB_KPI.Create(&cont).Error
return
}
// 编辑内容 // 编辑内容
func (cont *RectificationMeasures) EiteCont(whereMap interface{}, saveData interface{}) (err error) { func (cont *RectificationMeasures) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error

2
overall/publicmethod/formatOutput.go

@ -192,9 +192,11 @@ func DetermineUserIdentity(userKey int64) (identity outShenFen) {
switch identity.Level { switch identity.Level {
case 2: case 2:
identity.Level = 2 identity.Level = 2
var sunOrg GetOrgAllParent var sunOrg GetOrgAllParent
sunOrg.GetOrgSonAllId(userCont.MainDeparment) sunOrg.GetOrgSonAllId(userCont.MainDeparment)
identity.OrgList = sunOrg.Id identity.OrgList = sunOrg.Id
identity.OrgList = append(identity.OrgList, userCont.MainDeparment)
case 3: case 3:
identity.Level = 3 identity.Level = 3
identity.Group = userCont.Company identity.Group = userCont.Company

103
overall/publicmethod/technique.go

@ -131,8 +131,11 @@ func UnixTimeToDay(timeStamp int64, timeType int) (dateStr string) {
datMonthFloat, datMonthFloatErr := strconv.ParseFloat(dayMonth, 10) datMonthFloat, datMonthFloatErr := strconv.ParseFloat(dayMonth, 10)
if datMonthFloatErr == nil { if datMonthFloatErr == nil {
dateStr = strconv.FormatFloat(math.Ceil(datMonthFloat/3), 'f', -1, 64) dateStr = strconv.FormatFloat(math.Ceil(datMonthFloat/3), 'f', -1, 64)
} else {
dateStr = "1"
} }
dateStr = "1" dateStr = "1"
// fmt.Printf("获取是电话卡-------------->%v------------>%v------------>%v\n", dateStr, datMonthFloat, datMonthFloatErr)
case 20: case 20:
timeTemplate = "20060102" timeTemplate = "20060102"
case 21: case 21:
@ -1752,79 +1755,81 @@ func (d *DateTimeTotimes) BaisStrToTime(dateTime string) {
default: default:
} }
// fmt.Printf("dateTime:%v---1--->%v\n", dateTime, len(dateTime)) fmt.Printf("dateTime:%v---1--->%v\n", dateTime, len(dateTime))
orgTime, orgTimeErr := DateToTimeStamp(fmt.Sprintf("%v-01-01 12:00:00", dateTime)) orgTime, orgTimeErr := DateToTimeStamp(fmt.Sprintf("%v-01-01 12:00:00", dateTime))
if orgTimeErr { if orgTimeErr {
d.AllTime = orgTime d.AllTime = orgTime
d.Years = UnixTimeToDay(orgTime, 16) d.Years = strconv.FormatInt(ComputingTime(orgTime, 1), 10)
d.Quarter = UnixTimeToDay(orgTime, 19) d.Quarter = strconv.FormatInt(ComputingTime(orgTime, 2), 10)
d.Months = UnixTimeToDay(orgTime, 17) d.Months = strconv.FormatInt(ComputingTime(orgTime, 3), 10)
d.Week = UnixTimeToDay(orgTime, 23) d.Week = strconv.FormatInt(ComputingTime(orgTime, 4), 10)
d.Days = UnixTimeToDay(orgTime, 18) d.Days = strconv.FormatInt(ComputingTime(orgTime, 5), 10)
d.Hours = UnixTimeToDay(orgTime, 7) d.Hours = strconv.FormatInt(ComputingTime(orgTime, 7), 10)
d.Minutes = UnixTimeToDay(orgTime, 9) d.Minutes = strconv.FormatInt(ComputingTime(orgTime, 8), 10)
d.Second = UnixTimeToDay(orgTime, 10) d.Second = strconv.FormatInt(ComputingTime(orgTime, 9), 10)
} else { } else {
orgTime, orgTimeErr = DateToTimeStamp(fmt.Sprintf("%v-01 12:00:00", dateTime)) orgTime, orgTimeErr = DateToTimeStamp(fmt.Sprintf("%v-01 12:00:00", dateTime))
if orgTimeErr { if orgTimeErr {
d.AllTime = orgTime d.AllTime = orgTime
d.Years = UnixTimeToDay(orgTime, 16) d.Years = strconv.FormatInt(ComputingTime(orgTime, 1), 10)
d.Quarter = UnixTimeToDay(orgTime, 19) d.Quarter = strconv.FormatInt(ComputingTime(orgTime, 2), 10)
d.Months = UnixTimeToDay(orgTime, 17) d.Months = strconv.FormatInt(ComputingTime(orgTime, 3), 10)
d.Week = UnixTimeToDay(orgTime, 23) d.Week = strconv.FormatInt(ComputingTime(orgTime, 4), 10)
d.Days = UnixTimeToDay(orgTime, 18) d.Days = strconv.FormatInt(ComputingTime(orgTime, 5), 10)
d.Hours = UnixTimeToDay(orgTime, 7) d.Hours = strconv.FormatInt(ComputingTime(orgTime, 7), 10)
d.Minutes = UnixTimeToDay(orgTime, 9) d.Minutes = strconv.FormatInt(ComputingTime(orgTime, 8), 10)
d.Second = UnixTimeToDay(orgTime, 10) d.Second = strconv.FormatInt(ComputingTime(orgTime, 9), 10)
fmt.Printf("dateTime:%v---2--->%v--->%v\n", orgTime, d.AllTime, d.Quarter)
} else { } else {
orgTime, orgTimeErr = DateToTimeStamp(fmt.Sprintf("%v 12:00:00", dateTime)) orgTime, orgTimeErr = DateToTimeStamp(fmt.Sprintf("%v 12:00:00", dateTime))
if orgTimeErr { if orgTimeErr {
d.AllTime = orgTime d.AllTime = orgTime
d.Years = UnixTimeToDay(orgTime, 16) d.Years = strconv.FormatInt(ComputingTime(orgTime, 1), 10)
d.Quarter = UnixTimeToDay(orgTime, 19) d.Quarter = strconv.FormatInt(ComputingTime(orgTime, 2), 10)
d.Months = UnixTimeToDay(orgTime, 17) d.Months = strconv.FormatInt(ComputingTime(orgTime, 3), 10)
d.Week = UnixTimeToDay(orgTime, 23) d.Week = strconv.FormatInt(ComputingTime(orgTime, 4), 10)
d.Days = UnixTimeToDay(orgTime, 18) d.Days = strconv.FormatInt(ComputingTime(orgTime, 5), 10)
d.Hours = UnixTimeToDay(orgTime, 7) d.Hours = strconv.FormatInt(ComputingTime(orgTime, 7), 10)
d.Minutes = UnixTimeToDay(orgTime, 9) d.Minutes = strconv.FormatInt(ComputingTime(orgTime, 8), 10)
d.Second = UnixTimeToDay(orgTime, 10) d.Second = strconv.FormatInt(ComputingTime(orgTime, 9), 10)
} else { } else {
orgTime, orgTimeErr = DateToTimeStamp(fmt.Sprintf("%v:00:00", dateTime)) orgTime, orgTimeErr = DateToTimeStamp(fmt.Sprintf("%v:00:00", dateTime))
if orgTimeErr { if orgTimeErr {
d.AllTime = orgTime d.AllTime = orgTime
d.Years = UnixTimeToDay(orgTime, 16) d.Years = strconv.FormatInt(ComputingTime(orgTime, 1), 10)
d.Quarter = UnixTimeToDay(orgTime, 19) d.Quarter = strconv.FormatInt(ComputingTime(orgTime, 2), 10)
d.Months = UnixTimeToDay(orgTime, 17) d.Months = strconv.FormatInt(ComputingTime(orgTime, 3), 10)
d.Week = UnixTimeToDay(orgTime, 23) d.Week = strconv.FormatInt(ComputingTime(orgTime, 4), 10)
d.Days = UnixTimeToDay(orgTime, 18) d.Days = strconv.FormatInt(ComputingTime(orgTime, 5), 10)
d.Hours = UnixTimeToDay(orgTime, 7) d.Hours = strconv.FormatInt(ComputingTime(orgTime, 7), 10)
d.Minutes = UnixTimeToDay(orgTime, 9) d.Minutes = strconv.FormatInt(ComputingTime(orgTime, 8), 10)
d.Second = UnixTimeToDay(orgTime, 10) d.Second = strconv.FormatInt(ComputingTime(orgTime, 9), 10)
} else { } else {
orgTime, orgTimeErr = DateToTimeStamp(fmt.Sprintf("%v:00", dateTime)) orgTime, orgTimeErr = DateToTimeStamp(fmt.Sprintf("%v:00", dateTime))
if orgTimeErr { if orgTimeErr {
d.AllTime = orgTime d.AllTime = orgTime
d.Years = UnixTimeToDay(orgTime, 16) d.Years = strconv.FormatInt(ComputingTime(orgTime, 1), 10)
d.Quarter = UnixTimeToDay(orgTime, 19) d.Quarter = strconv.FormatInt(ComputingTime(orgTime, 2), 10)
d.Months = UnixTimeToDay(orgTime, 17) d.Months = strconv.FormatInt(ComputingTime(orgTime, 3), 10)
d.Week = UnixTimeToDay(orgTime, 23) d.Week = strconv.FormatInt(ComputingTime(orgTime, 4), 10)
d.Days = UnixTimeToDay(orgTime, 18) d.Days = strconv.FormatInt(ComputingTime(orgTime, 5), 10)
d.Hours = UnixTimeToDay(orgTime, 7) d.Hours = strconv.FormatInt(ComputingTime(orgTime, 7), 10)
d.Minutes = UnixTimeToDay(orgTime, 9) d.Minutes = strconv.FormatInt(ComputingTime(orgTime, 8), 10)
d.Second = UnixTimeToDay(orgTime, 10) d.Second = strconv.FormatInt(ComputingTime(orgTime, 9), 10)
} else { } else {
orgTime, orgTimeErr = DateToTimeStamp(dateTime) orgTime, orgTimeErr = DateToTimeStamp(dateTime)
if orgTimeErr { if orgTimeErr {
d.AllTime = orgTime d.AllTime = orgTime
d.Years = UnixTimeToDay(orgTime, 16) d.Years = strconv.FormatInt(ComputingTime(orgTime, 1), 10)
d.Quarter = UnixTimeToDay(orgTime, 19) d.Quarter = strconv.FormatInt(ComputingTime(orgTime, 2), 10)
d.Months = UnixTimeToDay(orgTime, 17) d.Months = strconv.FormatInt(ComputingTime(orgTime, 3), 10)
d.Week = UnixTimeToDay(orgTime, 23) d.Week = strconv.FormatInt(ComputingTime(orgTime, 4), 10)
d.Days = UnixTimeToDay(orgTime, 18) d.Days = strconv.FormatInt(ComputingTime(orgTime, 5), 10)
d.Hours = UnixTimeToDay(orgTime, 7) d.Hours = strconv.FormatInt(ComputingTime(orgTime, 7), 10)
d.Minutes = UnixTimeToDay(orgTime, 9) d.Minutes = strconv.FormatInt(ComputingTime(orgTime, 8), 10)
d.Second = UnixTimeToDay(orgTime, 10) d.Second = strconv.FormatInt(ComputingTime(orgTime, 9), 10)
} }
} }
} }

Loading…
Cancel
Save