12 changed files with 1471 additions and 0 deletions
@ -0,0 +1,729 @@ |
|||||
|
package departmentpc |
||||
|
|
||||
|
import ( |
||||
|
"encoding/json" |
||||
|
"fmt" |
||||
|
"key_performance_indicators/models/modelshr" |
||||
|
"key_performance_indicators/models/modelskpi" |
||||
|
"key_performance_indicators/overall" |
||||
|
"key_performance_indicators/overall/publicmethod" |
||||
|
"strconv" |
||||
|
"strings" |
||||
|
"time" |
||||
|
|
||||
|
"github.com/gin-gonic/gin" |
||||
|
) |
||||
|
|
||||
|
//部门级考核方案
|
||||
|
|
||||
|
/* |
||||
|
* |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2022-12-14 13:58:18 |
||||
|
@ 功能: 部门考核方案列表 |
||||
|
@ 参数 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 返回值 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 方法原型 |
||||
|
|
||||
|
# |
||||
|
*/ |
||||
|
func (a *ApiMethod) DepartmentProgramme(c *gin.Context) { |
||||
|
var receivedValue DepartPrograList |
||||
|
c.ShouldBindJSON(&receivedValue) |
||||
|
gormDb := overall.CONSTANT_DB_KPI.Where("`state` BETWEEN ? AND ?", 1, 2) |
||||
|
if receivedValue.OrgId != "" { |
||||
|
orgIdInt, _ := strconv.ParseInt(receivedValue.OrgId, 10, 64) |
||||
|
orgAllSunId := publicmethod.GetDepartmentSun(orgIdInt, []int64{}) |
||||
|
orgAllSunId = append(orgAllSunId, orgIdInt) |
||||
|
if len(orgAllSunId) > 0 { |
||||
|
gormDb = gormDb.Where("`department` IN ?", orgAllSunId) |
||||
|
} |
||||
|
} |
||||
|
if receivedValue.Year != "" { |
||||
|
gormDb = gormDb.Where("`yeares` = ?", receivedValue.Year) |
||||
|
} |
||||
|
if receivedValue.Version != "" { |
||||
|
gormDb = gormDb.Where("`key` LIKE ?", "%"+receivedValue.Version+"%") |
||||
|
} |
||||
|
var planVersionList []modelskpi.PlanVersio |
||||
|
err := gormDb.Order("`group` ASC").Order("`department` ASC").Order("`state` ASC").Order("`addtime` DESC").Find(&planVersionList).Error |
||||
|
if err != nil { |
||||
|
publicmethod.Result(105, err, c) |
||||
|
return |
||||
|
} |
||||
|
var sendList []SendDepartPrograList |
||||
|
for _, v := range planVersionList { |
||||
|
var sendCont SendDepartPrograList |
||||
|
sendCont.Id = v.Id //
|
||||
|
sendCont.Group = v.Group //集团ID"`
|
||||
|
sendCont.Department = v.Department //部门ID"`
|
||||
|
sendCont.Year = v.Year //年度"`
|
||||
|
sendCont.Versio = v.Versio //版本号"`
|
||||
|
sendCont.Key = v.Key //编码"`
|
||||
|
sendCont.State = v.State //状态(1:启用;2:禁用;3:删除)"`
|
||||
|
if v.State == 1 { |
||||
|
sendCont.States = true |
||||
|
} else { |
||||
|
sendCont.States = false |
||||
|
} |
||||
|
sendCont.AddTime = v.AddTime //创建时间"`
|
||||
|
sendCont.EiteTime = v.EiteTime //l修改时间"`
|
||||
|
// sendCont.Content = v.Content //版本内容"`
|
||||
|
json.Unmarshal([]byte(v.Content), &sendCont.VersionCont) |
||||
|
var companyCont modelshr.AdministrativeOrganization |
||||
|
companyCont.GetCont(map[string]interface{}{"`id`": v.Group}, "`name`") |
||||
|
sendCont.GroupName = companyCont.Name |
||||
|
var dempartCont modelshr.AdministrativeOrganization |
||||
|
dempartCont.GetCont(map[string]interface{}{"`id`": v.Department}, "`name`") |
||||
|
sendCont.DeaprtName = dempartCont.Name |
||||
|
sendCont.Time = publicmethod.UnixTimeToDay(v.AddTime, 11) |
||||
|
sendList = append(sendList, sendCont) |
||||
|
} |
||||
|
publicmethod.Result(0, sendList, c) |
||||
|
} |
||||
|
|
||||
|
/* |
||||
|
* |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2022-12-14 16:38:02 |
||||
|
@ 功能: 编辑部门方案状态 |
||||
|
@ 参数 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 返回值 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 方法原型 |
||||
|
|
||||
|
# |
||||
|
*/ |
||||
|
func (a *ApiMethod) EditDepartPrograState(c *gin.Context) { |
||||
|
var receivedValue publicmethod.PublicState |
||||
|
err := c.ShouldBindJSON(&receivedValue) |
||||
|
if err != nil { |
||||
|
publicmethod.Result(100, err, c) |
||||
|
return |
||||
|
} |
||||
|
if receivedValue.Id == "" { |
||||
|
publicmethod.Result(101, receivedValue, c) |
||||
|
return |
||||
|
} |
||||
|
if receivedValue.State == 0 { |
||||
|
receivedValue.State = 2 |
||||
|
} |
||||
|
if receivedValue.IsTrue == 0 { |
||||
|
receivedValue.IsTrue = 2 |
||||
|
} |
||||
|
//判断该方案是否存在
|
||||
|
var planVersionCont modelskpi.PlanVersio |
||||
|
err = planVersionCont.GetCont(map[string]interface{}{"`key`": receivedValue.Id}) |
||||
|
if err != nil { |
||||
|
publicmethod.Result(107, receivedValue, c) |
||||
|
return |
||||
|
} |
||||
|
//判断是否可执行操作
|
||||
|
if editDepartStateIsTrue(planVersionCont, receivedValue.State) { |
||||
|
msg := "要操作的方案还有未走完的审批流程!请不要进行此操作!" |
||||
|
if receivedValue.State == 1 { |
||||
|
msg = "当前激活的方案中还有未走完的审批流程!请不要进行此操作!" |
||||
|
} |
||||
|
publicmethod.Result(1, receivedValue, c, msg) |
||||
|
return |
||||
|
} |
||||
|
//根据操作不同执行相应函数
|
||||
|
editState := publicmethod.MapOut[string]() |
||||
|
editState["`state`"] = 2 |
||||
|
editState["`eitetime`"] = time.Now().Unix() |
||||
|
switch receivedValue.State { |
||||
|
case 1: |
||||
|
//执行启用操作
|
||||
|
//1、获取已经启用的方案西信息
|
||||
|
var planIsRun modelskpi.PlanVersio |
||||
|
err = planIsRun.GetCont(map[string]interface{}{"`group`": planVersionCont.Group, "`department`": planVersionCont.Department, "`state`": 1}, "`id`", "`key`") |
||||
|
if err == nil { |
||||
|
planIsRun.EiteCont(map[string]interface{}{"`id`": planIsRun.Id}, editState) |
||||
|
var qualEval modelskpi.QualitativeEvaluation |
||||
|
qualEval.EiteCont(map[string]interface{}{"`qe_qual_eval_id`": planIsRun.Key}, map[string]interface{}{"`qe_state`": 2, "`qe_eitetime`": time.Now().Unix()}) |
||||
|
} |
||||
|
err = planVersionCont.EiteCont(map[string]interface{}{"`id`": planVersionCont.Id}, map[string]interface{}{"`state`": 1, "`eitetime`": time.Now().Unix()}) |
||||
|
var qualEvalMain modelskpi.QualitativeEvaluation |
||||
|
qualEvalMain.EiteCont(map[string]interface{}{"`qe_qual_eval_id`": planVersionCont.Key}, map[string]interface{}{"`qe_state`": 1, "`qe_eitetime`": time.Now().Unix()}) |
||||
|
case 3: |
||||
|
if receivedValue.IsTrue == 1 { |
||||
|
var qualEval modelskpi.QualitativeEvaluation |
||||
|
qualEval.DelCont(map[string]interface{}{"`qe_qual_eval_id`": planVersionCont.Key}) |
||||
|
err = planVersionCont.DelCont(map[string]interface{}{"`id`": planVersionCont.Id}) |
||||
|
} else { |
||||
|
var qualEval modelskpi.QualitativeEvaluation |
||||
|
qualEval.EiteCont(map[string]interface{}{"`qe_qual_eval_id`": planVersionCont.Key}, map[string]interface{}{"`qe_state`": 3, "`qe_eitetime`": time.Now().Unix()}) |
||||
|
err = planVersionCont.EiteCont(map[string]interface{}{"`id`": planVersionCont.Id}, map[string]interface{}{"`state`": 3, "`eitetime`": time.Now().Unix()}) |
||||
|
} |
||||
|
default: |
||||
|
var qualEval modelskpi.QualitativeEvaluation |
||||
|
qualEval.EiteCont(map[string]interface{}{"`qe_qual_eval_id`": planVersionCont.Key}, map[string]interface{}{"`qe_state`": 2, "`qe_eitetime`": time.Now().Unix()}) |
||||
|
err = planVersionCont.EiteCont(map[string]interface{}{"`id`": planVersionCont.Id}, editState) |
||||
|
} |
||||
|
if err != nil { |
||||
|
publicmethod.Result(106, err, c) |
||||
|
return |
||||
|
} |
||||
|
publicmethod.Result(0, err, c) |
||||
|
} |
||||
|
|
||||
|
/* |
||||
|
* |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2022-12-14 16:48:55 |
||||
|
@ 功能: 判断是否可执行部门方案状态更改操作 |
||||
|
@ 参数 |
||||
|
|
||||
|
#planVersionCont 要操作的方案主体 |
||||
|
#state 状态1:启用;2:禁用;3:删除 |
||||
|
|
||||
|
@ 返回值 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 方法原型 |
||||
|
|
||||
|
# |
||||
|
*/ |
||||
|
func editDepartStateIsTrue(planVersionCont modelskpi.PlanVersio, state int) (isTrue bool) { |
||||
|
isTrue = false |
||||
|
//判断是否启用
|
||||
|
if state == 1 { |
||||
|
//1、判断同部门是否有已经启用的方案
|
||||
|
var planRuning modelskpi.PlanVersio |
||||
|
err := planRuning.GetCont(map[string]interface{}{"`group`": planVersionCont.Group, "`department`": planVersionCont.Department, "`state`": 1}, "`id`", "`key`") |
||||
|
if err != nil { |
||||
|
return |
||||
|
} |
||||
|
isTrue = SearchPlanVersion(planRuning.Key) |
||||
|
} else { |
||||
|
//执行非启用状态,判断该方案主体是否有政治执行的操作
|
||||
|
isTrue = SearchPlanVersion(planVersionCont.Key) |
||||
|
} |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
/* |
||||
|
* |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2022-12-14 16:54:44 |
||||
|
@ 功能: 查询方案正在执行的操作 |
||||
|
@ 参数 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 返回值 |
||||
|
|
||||
|
#isTrue true:存在正在执行的操作;false:不存在正在执行的操作 |
||||
|
|
||||
|
@ 方法原型 |
||||
|
|
||||
|
# |
||||
|
*/ |
||||
|
func SearchPlanVersion(key string) (isTrue bool) { |
||||
|
isTrue = false |
||||
|
//获取本方案中的所有内容
|
||||
|
var planContList []modelskpi.QualitativeEvaluation |
||||
|
err := overall.CONSTANT_DB_KPI.Model(&modelskpi.QualitativeEvaluation{}).Select("qe_id,qe_type").Where("`qe_state` = 1 AND `qe_qual_eval_id` = ?", key).Find(&planContList).Error |
||||
|
if err != nil { |
||||
|
return |
||||
|
} |
||||
|
//分别获取定性和定量的项目Id列表
|
||||
|
var dingXing []int64 |
||||
|
var dingLiang []int64 |
||||
|
for _, v := range planContList { |
||||
|
if v.Type == 1 { |
||||
|
if publicmethod.IsInTrue[int64](v.Id, dingXing) == false { |
||||
|
dingXing = append(dingXing, v.Id) |
||||
|
} |
||||
|
} else { |
||||
|
if publicmethod.IsInTrue[int64](v.Id, dingLiang) == false { |
||||
|
dingLiang = append(dingLiang, v.Id) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
var syncListCont judgePlanTask |
||||
|
syncSeting.Add(1) |
||||
|
go syncListCont.SearchDingXingPlan(dingXing) |
||||
|
syncSeting.Add(1) |
||||
|
go syncListCont.SearchDingLiangPlan(dingLiang) |
||||
|
syncSeting.Wait() |
||||
|
|
||||
|
readDingXingMap, readDingLiangMap := syncListCont.readPlanTaskData() |
||||
|
if len(readDingXingMap) > 0 || len(readDingLiangMap) > 0 { |
||||
|
isTrue = true |
||||
|
} |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
/* |
||||
|
* |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2022-12-14 17:24:37 |
||||
|
@ 功能: 判断方案中是否有正在执行的定性考核项 |
||||
|
@ 参数 |
||||
|
|
||||
|
#id 方案中定性考核项 |
||||
|
|
||||
|
@ 返回值 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 方法原型 |
||||
|
|
||||
|
#(j *judgePlanTask) SearchDingXingPlan(id []int64) |
||||
|
*/ |
||||
|
func (j *judgePlanTask) SearchDingXingPlan(id []int64) { |
||||
|
j.mutext.Lock() |
||||
|
defer j.mutext.Unlock() |
||||
|
if len(id) > 0 { |
||||
|
//获取该方案在执行中的数据
|
||||
|
var dingXingTask []bingFaOut |
||||
|
err := overall.CONSTANT_DB_KPI.Model(&modelskpi.ScoreFlow{}).Select("sf_id,sf_key,sf_evaluation_plan,ep_order_key,ep_state").Joins("left join evaluation_process on ep_order_key = sf_key").Where("`sf_evaluation_plan` IN ? AND ep_state IN (1,2)", id).Find(&dingXingTask).Error |
||||
|
if err == nil { |
||||
|
for _, v := range dingXingTask { |
||||
|
isIn := publicmethod.MapOut[string]() |
||||
|
isIn["id"] = v.Id |
||||
|
isIn["key"] = v.Key |
||||
|
isIn["state"] = v.State |
||||
|
j.dingXingTask = append(j.dingXingTask, isIn) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
syncSeting.Done() |
||||
|
} |
||||
|
|
||||
|
/* |
||||
|
* |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2022-12-15 08:34:42 |
||||
|
@ 功能: 判断方案中是否有正在执行的定量考核项 |
||||
|
@ 参数 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 返回值 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 方法原型 |
||||
|
|
||||
|
# |
||||
|
*/ |
||||
|
func (j *judgePlanTask) SearchDingLiangPlan(id []int64) { |
||||
|
j.mutext.Lock() |
||||
|
defer j.mutext.Unlock() |
||||
|
if len(id) > 0 { |
||||
|
//获取该方案在执行中的数据
|
||||
|
var stateIsTrue []bingFaOutDingLiang |
||||
|
err := overall.CONSTANT_DB_KPI.Model(&modelskpi.FlowLog{}).Select("fl_id,fl_key,fl_evaluation_id,fl_reply,ep_order_key,ep_state").Where("`fl_key` IN ? AND ep_state IN (1,2)", id).Joins("left join evaluation_process on ep_order_key = fl_key").Find(&stateIsTrue).Error |
||||
|
if err == nil { |
||||
|
for _, v := range stateIsTrue { |
||||
|
isIn := publicmethod.MapOut[string]() |
||||
|
isIn["id"] = v.Id |
||||
|
isIn["key"] = v.Key |
||||
|
isIn["state"] = v.State |
||||
|
j.dingLiangTask = append(j.dingLiangTask, isIn) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
syncSeting.Done() |
||||
|
} |
||||
|
|
||||
|
/* |
||||
|
* |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2022-12-15 10:49:36 |
||||
|
@ 功能: 添加方案 |
||||
|
@ 参数 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 返回值 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 方法原型 |
||||
|
|
||||
|
# |
||||
|
*/ |
||||
|
func (a *ApiMethod) CreateSchemeForDeparment(c *gin.Context) { |
||||
|
var receivedValue AddDutyNewContGroup |
||||
|
err := c.ShouldBindJSON(&receivedValue) |
||||
|
if err != nil { |
||||
|
publicmethod.Result(100, err, c) |
||||
|
return |
||||
|
} |
||||
|
if receivedValue.Group == "" { |
||||
|
publicmethod.Result(101, receivedValue, c) |
||||
|
return |
||||
|
} |
||||
|
if receivedValue.DepartmentId == "" { |
||||
|
publicmethod.Result(101, receivedValue, c) |
||||
|
return |
||||
|
} |
||||
|
if receivedValue.Year == "" { |
||||
|
publicmethod.Result(1, receivedValue, c, "请选择年份") |
||||
|
return |
||||
|
} |
||||
|
if len(receivedValue.Child) < 1 { |
||||
|
publicmethod.Result(1, receivedValue, c, "没有要添加的数据") |
||||
|
return |
||||
|
} |
||||
|
departId, _ := strconv.ParseInt(receivedValue.DepartmentId, 10, 64) //部门ID
|
||||
|
yearInt, _ := strconv.ParseInt(receivedValue.Year, 10, 64) //年
|
||||
|
//获取编号首字母
|
||||
|
groupId, groupErr := strconv.ParseInt(receivedValue.Group, 10, 64) //集团ID
|
||||
|
if groupErr != nil { |
||||
|
groupId = 0 |
||||
|
} |
||||
|
var groupCont modelshr.AdministrativeOrganization |
||||
|
groupCont.GetCont(map[string]interface{}{"`id`": groupId}, "`id`", "`name`", "`abbreviation`") |
||||
|
nameCont := groupCont.Abbreviation |
||||
|
if nameCont == "" { |
||||
|
nameCont = groupCont.Name |
||||
|
} |
||||
|
companyFirstWord := publicmethod.ChineseFirstWordCapitalize(nameCont) //公司首字母
|
||||
|
//判断当前部门是否已经有正启用得方案
|
||||
|
judgeState := 1 |
||||
|
var judgePlanState modelskpi.PlanVersio |
||||
|
err = judgePlanState.GetCont(map[string]interface{}{"`state`": 1, "`group`": groupId, "`department`": departId}, "`id`") |
||||
|
if err == nil { |
||||
|
judgeState = 2 |
||||
|
} |
||||
|
//判断年度是否存在版本
|
||||
|
var versioNum string //版本号
|
||||
|
var sumVerson float64 //已经存在得方案数量
|
||||
|
err = overall.CONSTANT_DB_KPI.Model(&modelskpi.PlanVersio{}).Select("`id`").Where("`group` = ? AND `yeares` = ?", groupId, yearInt).Pluck("COALESCE(COUNT(id), 0) as countid", &sumVerson).Error |
||||
|
if err != nil { |
||||
|
versioNum = "0001" |
||||
|
} else { |
||||
|
if sumVerson == 0 { |
||||
|
versioNum = "0001" |
||||
|
} else { |
||||
|
versioNum = fmt.Sprintf("%04v", sumVerson) |
||||
|
} |
||||
|
} |
||||
|
//统一编辑时间
|
||||
|
todyTime := time.Now().Unix() |
||||
|
//方案编号
|
||||
|
keyStr := fmt.Sprintf("%v%v%v", companyFirstWord, publicmethod.UnixTimeToDay(todyTime, 20), versioNum) |
||||
|
|
||||
|
//合成方案主数据
|
||||
|
var savePlanVersionCont modelskpi.PlanVersio |
||||
|
savePlanVersionCont.Group = groupId |
||||
|
savePlanVersionCont.Department = departId |
||||
|
savePlanVersionCont.Year = yearInt |
||||
|
savePlanVersionCont.Versio = versioNum |
||||
|
savePlanVersionCont.Key = keyStr |
||||
|
savePlanVersionCont.State = judgeState |
||||
|
savePlanVersionCont.AddTime = todyTime |
||||
|
savePlanVersionCont.EiteTime = todyTime |
||||
|
//组装方案结构体,转换json数据
|
||||
|
if len(receivedValue.Child) > 0 { |
||||
|
var planListCont []AddDutyNewCont |
||||
|
for _, v := range receivedValue.Child { |
||||
|
var planCont AddDutyNewCont |
||||
|
//第一层;纬度操作
|
||||
|
planCont.Id = v.Id |
||||
|
planCont.Name = v.Name |
||||
|
planCont.ZhiFraction = v.ZhiFraction |
||||
|
for _, cv := range v.Child { |
||||
|
//第二层;指标操作
|
||||
|
var targetCont EvaluPross |
||||
|
targetCont.Id = cv.Id //指标ID
|
||||
|
targetCont.Name = cv.Name //指标名称
|
||||
|
targetCont.Content = cv.Content //指标说明
|
||||
|
targetCont.Unit = cv.Unit //单位"`
|
||||
|
targetCont.ReferenceScore = cv.ReferenceScore //标准分值"`
|
||||
|
targetCont.State = cv.State // `json:"state"`
|
||||
|
targetCont.Status = cv.Status // 1:使用;2:禁用;3:观察
|
||||
|
targetCont.Score = cv.Score // `json:"state"`
|
||||
|
targetCont.QualEvalId = cv.QualEvalId // `json:"state"`
|
||||
|
//获取指标统计属性
|
||||
|
var getTarCont modelskpi.EvaluationTarget |
||||
|
err = getTarCont.GetCont(map[string]interface{}{"et_id": cv.Id}, "et_cycle,et_cycleattr") |
||||
|
if err == nil { |
||||
|
targetCont.Cycles = getTarCont.Cycles //1:班;2:天;3:周;4:月;5:季度;6:年"`
|
||||
|
targetCont.CycleAttres = getTarCont.CycleAttres //辅助计数"`
|
||||
|
} |
||||
|
planCont.Child = append(planCont.Child, targetCont) |
||||
|
} |
||||
|
planListCont = append(planListCont, planCont) |
||||
|
} |
||||
|
planJsonCont, planJsonErr := json.Marshal(planListCont) |
||||
|
if planJsonErr == nil { |
||||
|
savePlanVersionCont.Content = string(planJsonCont) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
//往考核方案中写入考核数据
|
||||
|
var qualEvalList []modelskpi.QualitativeEvaluation |
||||
|
//解析方案结构体
|
||||
|
for _, v := range receivedValue.Child { |
||||
|
//维度操作
|
||||
|
AddWeight(receivedValue.Group, v.Id, receivedValue.DepartmentId, "", int64(v.ZhiFraction), 1) //添加维度权重
|
||||
|
for _, cv := range v.Child { |
||||
|
//指标操作
|
||||
|
if cv.Status != 2 { //操作非禁用得指标
|
||||
|
//获取指标定义
|
||||
|
var targetInfo modelskpi.EvaluationTarget |
||||
|
err := targetInfo.GetCont(map[string]interface{}{"`et_id`": cv.Id}) |
||||
|
if err == nil { //判断指标是否存在
|
||||
|
//判断指标是定性还是定量
|
||||
|
if targetInfo.Type == 2 { |
||||
|
//定量指标
|
||||
|
AddWeight(receivedValue.Group, v.Id, receivedValue.DepartmentId, cv.Id, cv.ReferenceScore, 2) |
||||
|
var qualEvalContXing modelskpi.QualitativeEvaluation |
||||
|
qualEvalContXing.Dimension, _ = strconv.ParseInt(v.Id, 10, 64) |
||||
|
qualEvalContXing.Target, _ = strconv.ParseInt(cv.Id, 10, 64) //指标
|
||||
|
qualEvalContXing.Type = targetInfo.Type //类型
|
||||
|
qualEvalContXing.Unit = targetInfo.Uniteing //单位
|
||||
|
qualEvalContXing.ReferenceScore = cv.ReferenceScore //分值
|
||||
|
qualEvalContXing.State = judgeState //状态
|
||||
|
qualEvalContXing.Addtime = time.Now().Unix() |
||||
|
qualEvalContXing.Eitetime = time.Now().Unix() |
||||
|
qualEvalContXing.Group = groupId //集团
|
||||
|
qualEvalContXing.Cycles = targetInfo.Cycles //单位
|
||||
|
qualEvalContXing.CycleAttres = targetInfo.CycleAttres //辅助计数
|
||||
|
qualEvalContXing.AcceptEvaluation = departId //接受考核部门
|
||||
|
qualEvalContXing.Content = cv.Content //描述
|
||||
|
qualEvalContXing.Operator = targetInfo.Report //执行考核人
|
||||
|
qualEvalContXing.QualEvalId = keyStr |
||||
|
qualEvalContXing.Observer = cv.Status |
||||
|
var departAry []string |
||||
|
userKeyAry := strings.Split(targetInfo.Report, ",") |
||||
|
if len(userKeyAry) > 0 { |
||||
|
for _, u_v := range userKeyAry { |
||||
|
var userCont modelshr.PersonArchives |
||||
|
err = userCont.GetCont(map[string]interface{}{"`key`": u_v}, "`maindeparment`") |
||||
|
mainDepartStr := strconv.FormatInt(userCont.MainDeparment, 10) |
||||
|
if publicmethod.IsInTrue[string](mainDepartStr, departAry) == false { |
||||
|
departAry = append(departAry, mainDepartStr) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
qualEvalContXing.DepartmentId = strings.Join(departAry, ",") //处理关联部门
|
||||
|
|
||||
|
qualEvalList = append(qualEvalList, qualEvalContXing) |
||||
|
} else { |
||||
|
//定性指标
|
||||
|
AddWeight(receivedValue.Group, v.Id, receivedValue.DepartmentId, cv.Id, cv.ReferenceScore, 1) |
||||
|
//获取定性指标得关联关系
|
||||
|
var assessList []modelskpi.Assesstarget |
||||
|
err = overall.CONSTANT_DB_KPI.Model(&modelskpi.Assesstarget{}).Where("`state` = 1 AND `group` = ? AND `dimension` = ? AND `targetid` = ? AND FIND_IN_SET(?,`departmentmap`)", groupId, v.Id, cv.Id, departId).Find(&assessList).Error |
||||
|
if err == nil { |
||||
|
var sunTarget []int64 |
||||
|
for _, sv := range assessList { //遍历与此部门相关得子栏目
|
||||
|
if publicmethod.IsInTrue[int64](sv.Id, sunTarget) == false { //次子栏目未操作过
|
||||
|
//拆解指标详情
|
||||
|
var detailedList []DutyAssEssTarget |
||||
|
json.Unmarshal([]byte(sv.Content), &detailedList) |
||||
|
|
||||
|
sunTarget = append(sunTarget, sv.Id) |
||||
|
//获取指标细则列表
|
||||
|
var targetDetailsList []modelskpi.DetailedTarget |
||||
|
err = overall.CONSTANT_DB_KPI.Model(&modelskpi.DetailedTarget{}).Where("`dt_state` = 1 AND `dt_parentid` = ? AND `dt_parentid_sun` = ? AND (FIND_IN_SET(?,`dt_paretment`) OR `dt_paretment` = '')", cv.Id, sv.SunTargetId, departId).Find(&targetDetailsList).Error |
||||
|
fmt.Printf("获取指标细则列表-------->%v-------->%v-------->%v-------->%v\n", cv.Id, sv.Id, departId, len(targetDetailsList)) |
||||
|
if err == nil { |
||||
|
for _, tv := range targetDetailsList { //指标细则
|
||||
|
|
||||
|
//写入新的定性考核细则
|
||||
|
var saveData modelskpi.QualitativeEvaluation |
||||
|
saveData.Dimension = sv.Dimension //纬度
|
||||
|
saveData.Target = targetInfo.Id //指标
|
||||
|
saveData.Type = 1 //类型
|
||||
|
saveData.TargetSun = sv.SunTargetId //子栏目
|
||||
|
saveData.DetailedTarget = tv.Id //指标细则
|
||||
|
if tv.Company != "" { |
||||
|
saveData.Unit = tv.Company |
||||
|
} else { |
||||
|
saveData.Unit = targetInfo.Uniteing |
||||
|
} |
||||
|
saveData.ReferenceScore = 0 //分值
|
||||
|
saveData.MinScore = tv.MinScore //最低分
|
||||
|
saveData.MaxScore = tv.MaxScore //最高分
|
||||
|
|
||||
|
saveData.CensorType = tv.CensorType //检查方式
|
||||
|
saveData.CensorCont = tv.CensorCont //检查依据
|
||||
|
saveData.CensorRate = tv.CensorRate //检查频次
|
||||
|
saveData.State = judgeState //状态
|
||||
|
saveData.Addtime = time.Now().Unix() |
||||
|
saveData.Eitetime = time.Now().Unix() |
||||
|
saveData.Group = groupId //集团
|
||||
|
|
||||
|
if tv.Cycles > 0 { |
||||
|
saveData.Cycles = tv.Cycles //1:班;2:天;3:周;4:月;5:季度;6:年
|
||||
|
saveData.CycleAttres = tv.CycleAttres //辅助计数
|
||||
|
} else { |
||||
|
saveData.Cycles = targetInfo.Cycles //1:班;2:天;3:周;4:月;5:季度;6:年
|
||||
|
saveData.CycleAttres = targetInfo.CycleAttres //辅助计数
|
||||
|
} |
||||
|
saveData.AcceptEvaluation = departId //接受考核部门
|
||||
|
saveData.Content = tv.Content //描述
|
||||
|
reportStr := tv.Reportary |
||||
|
if tv.Reportary != "" { |
||||
|
saveData.Operator = tv.Reportary //执行考核人
|
||||
|
} else { |
||||
|
if len(detailedList) > 0 { |
||||
|
for _, dev := range detailedList { |
||||
|
if dev.Id == tv.Id { |
||||
|
saveData.Operator = strings.Join(dev.Operator, ",") //执行考核人 //执行考核人
|
||||
|
reportStr = strings.Join(dev.Operator, ",") |
||||
|
saveData.DepartmentId = strings.Join(dev.Department, ",") |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
var departAry []string |
||||
|
userKeyAry := strings.Split(reportStr, ",") |
||||
|
if len(userKeyAry) > 0 { |
||||
|
for _, u_v := range userKeyAry { |
||||
|
var userCont modelshr.PersonArchives |
||||
|
err = userCont.GetCont(map[string]interface{}{"`key`": u_v}, "`maindeparment`") |
||||
|
mainDepartStr := strconv.FormatInt(userCont.MainDeparment, 10) |
||||
|
if publicmethod.IsInTrue[string](mainDepartStr, departAry) == false { |
||||
|
departAry = append(departAry, mainDepartStr) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
saveData.DepartmentId = strings.Join(departAry, ",") //处理关联部门
|
||||
|
saveData.QualEvalId = keyStr |
||||
|
saveData.Observer = cv.Status |
||||
|
qualEvalList = append(qualEvalList, saveData) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
//判断是否有要写入得内容
|
||||
|
if len(qualEvalList) > 0 { |
||||
|
affairDb := overall.CONSTANT_DB_KPI.Begin() |
||||
|
addSysAdminContErr := affairDb.Create(&savePlanVersionCont).Error |
||||
|
addSysAdminAttrContErr := affairDb.Create(&qualEvalList).Error |
||||
|
if addSysAdminContErr == nil && addSysAdminAttrContErr == nil { |
||||
|
affairDbErr := affairDb.Commit().Error |
||||
|
if affairDbErr == nil { |
||||
|
publicmethod.Result(0, affairDbErr, c, "数据写入成功!") |
||||
|
return |
||||
|
} else { |
||||
|
publicmethod.Result(108, affairDbErr, c, "数据写入失败!") |
||||
|
return |
||||
|
} |
||||
|
} else { |
||||
|
affairDbErr := affairDb.Rollback().Error |
||||
|
publicmethod.Result(109, affairDbErr, c, "数据写入失败!") |
||||
|
return |
||||
|
} |
||||
|
} |
||||
|
publicmethod.Result(1, qualEvalList, c, "数据写入失败!") |
||||
|
} |
||||
|
|
||||
|
/* |
||||
|
* |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2022-12-15 13:42:54 |
||||
|
@ 功能: 写入权重操作 |
||||
|
@ 参数 |
||||
|
|
||||
|
#group 集团 |
||||
|
#dimension 维度 |
||||
|
#derpatment 部门 |
||||
|
#target 指标 |
||||
|
#class 1:定性考核;2:定量考核 |
||||
|
|
||||
|
@ 返回值 |
||||
|
|
||||
|
#isTrue |
||||
|
|
||||
|
@ 方法原型 |
||||
|
|
||||
|
# |
||||
|
*/ |
||||
|
func AddWeight(group, dimension, derpatment, target string, score, class int64) (isTrue bool) { |
||||
|
isTrue = false |
||||
|
//判断指标是否为空
|
||||
|
if target != "" { |
||||
|
var departSionWeightCont modelskpi.DepartmentDimensionWeight |
||||
|
err := departSionWeightCont.GetCont(map[string]interface{}{"`ddw_hierarchy`": 2, "`ddw_group`": group, "`ddw_derpatment`": derpatment, "`ddw_dimension`": dimension, "`ddw_target`": target, "`ddw_type`": class}, "`ddw_id`") |
||||
|
if err == nil { |
||||
|
//存在,进行更新
|
||||
|
editCont := publicmethod.MapOut[string]() |
||||
|
editCont["ddw_time"] = time.Now().Unix() |
||||
|
editCont["ddw_weight"] = score |
||||
|
err = departSionWeightCont.EiteCont(map[string]interface{}{"`ddw_id`": departSionWeightCont.Id}, editCont) |
||||
|
if err == nil { |
||||
|
isTrue = true |
||||
|
} |
||||
|
} else { |
||||
|
//不存在,进行新增
|
||||
|
var addCont modelskpi.DepartmentDimensionWeight |
||||
|
groupId, _ := strconv.ParseInt(group, 10, 64) |
||||
|
addCont.Group = groupId |
||||
|
derpatmentId, _ := strconv.ParseInt(derpatment, 10, 64) |
||||
|
addCont.DepartmentId = derpatmentId |
||||
|
dimensionId, _ := strconv.ParseInt(dimension, 10, 64) |
||||
|
addCont.Dimension = dimensionId |
||||
|
targetId, _ := strconv.ParseInt(target, 10, 64) |
||||
|
addCont.Target = targetId |
||||
|
addCont.Weight = score |
||||
|
addCont.Addtime = time.Now().Unix() |
||||
|
addCont.Type = class |
||||
|
addCont.Hierarchy = 2 |
||||
|
err = overall.CONSTANT_DB_KPI.Create(&addCont).Error |
||||
|
if err == nil { |
||||
|
isTrue = true |
||||
|
} |
||||
|
} |
||||
|
} else { |
||||
|
//写入纬度操作
|
||||
|
var departSionWeightCont modelskpi.DepartmentDimensionWeight |
||||
|
err := departSionWeightCont.GetCont(map[string]interface{}{"`ddw_hierarchy`": 1, "`ddw_group`": group, "`ddw_derpatment`": derpatment, "`ddw_dimension`": dimension}, "`ddw_id`") |
||||
|
if err == nil { |
||||
|
//存在,进行更新
|
||||
|
editCont := publicmethod.MapOut[string]() |
||||
|
editCont["ddw_time"] = time.Now().Unix() |
||||
|
editCont["ddw_weight"] = score |
||||
|
err = departSionWeightCont.EiteCont(map[string]interface{}{"`ddw_id`": departSionWeightCont.Id}, editCont) |
||||
|
if err == nil { |
||||
|
isTrue = true |
||||
|
} |
||||
|
} else { |
||||
|
//不存在,进行新增
|
||||
|
var addCont modelskpi.DepartmentDimensionWeight |
||||
|
groupId, _ := strconv.ParseInt(group, 10, 64) |
||||
|
addCont.Group = groupId |
||||
|
derpatmentId, _ := strconv.ParseInt(derpatment, 10, 64) |
||||
|
addCont.DepartmentId = derpatmentId |
||||
|
dimensionId, _ := strconv.ParseInt(dimension, 10, 64) |
||||
|
addCont.Dimension = dimensionId |
||||
|
addCont.Target = 0 |
||||
|
addCont.Weight = score |
||||
|
addCont.Addtime = time.Now().Unix() |
||||
|
addCont.Type = 1 |
||||
|
addCont.Hierarchy = 1 |
||||
|
err = overall.CONSTANT_DB_KPI.Create(&addCont).Error |
||||
|
if err == nil { |
||||
|
isTrue = true |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
return |
||||
|
} |
||||
@ -0,0 +1,64 @@ |
|||||
|
package modelskpi |
||||
|
|
||||
|
import ( |
||||
|
"key_performance_indicators/overall" |
||||
|
"strings" |
||||
|
) |
||||
|
|
||||
|
// 性质考核方案权重
|
||||
|
type DepartmentDimensionWeight struct { |
||||
|
Id int64 `json:"id" gorm:"primaryKey;column:ddw_id;type:bigint(20) unsigned;not null;comment:Id;index"` |
||||
|
Type int64 `json:"type" gorm:"column:ddw_type;type:bigint(20) unsigned;default:0;not null;comment:1:定性考核;2:定量考核"` |
||||
|
Group int64 `json:"group" gorm:"column:ddw_group;type:bigint(20) unsigned;default:0;not null;comment:归属集团"` |
||||
|
DepartmentId int64 `json:"parentid" gorm:"column:ddw_derpatment;type:bigint(20) unsigned;default:0;not null;comment:部门ID"` |
||||
|
Dimension int64 `json:"dimension" gorm:"column:ddw_dimension;type:bigint(20) unsigned;default:0;not null;comment:考核维度"` |
||||
|
Target int64 `json:"target" gorm:"column:ddw_target;type:bigint(20) unsigned;default:0;not null;comment:指标"` |
||||
|
Weight int64 `json:"weight" gorm:"column:ddw_weight;type:int(6) unsigned;default:0;not null;comment:权重"` |
||||
|
Addtime int64 `json:"addtime" gorm:"column:ddw_time;type:bigint(20) unsigned;default:0;not null;comment:添加时间"` |
||||
|
Hierarchy int64 `json:"hierarchy" gorm:"column:ddw_hierarchy;type:bigint(20) unsigned;default:0;not null;comment:维度;2:指标"` |
||||
|
} |
||||
|
|
||||
|
func (DepartmentDimensionWeight *DepartmentDimensionWeight) TableName() string { |
||||
|
return "department_dimension_weight" |
||||
|
} |
||||
|
|
||||
|
// 编辑内容
|
||||
|
func (cont *DepartmentDimensionWeight) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
||||
|
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 获取内容
|
||||
|
func (cont *DepartmentDimensionWeight) 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 *DepartmentDimensionWeight) CountCont(whereMap interface{}) (countId int64) { |
||||
|
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 读取全部信息
|
||||
|
func (cont *DepartmentDimensionWeight) ContMap(whereMap interface{}, field ...string) (countAry []DepartmentDimensionWeight, 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 *DepartmentDimensionWeight) DelCont(whereMap interface{}) (err error) { |
||||
|
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
||||
|
return |
||||
|
} |
||||
@ -0,0 +1,73 @@ |
|||||
|
package modelskpi |
||||
|
|
||||
|
import ( |
||||
|
"key_performance_indicators/overall" |
||||
|
"strings" |
||||
|
) |
||||
|
|
||||
|
// 流程步进器
|
||||
|
type EvaluationProcess struct { |
||||
|
Id int64 `json:"id" gorm:"primaryKey;column:ep_id;type:bigint(20) unsigned;not null"` |
||||
|
OrderKey int64 `json:"orderkey" gorm:"column:ep_order_key;type:bigint(20) unsigned;default:0;not null;comment:发起表单key"` |
||||
|
Step int `json:"step" gorm:"column:ep_step;type:int(7) unsigned;default:1;not null;comment:当前执行到第几部"` |
||||
|
Content string `json:"content" gorm:"column:ep_cont;type:longtext;comment:流程步进值"` |
||||
|
NextContent string `json:"nextcontent" gorm:"column:ep_next_cont;type:mediumtext;comment:下一步内容"` |
||||
|
Time int64 `json:"time" gorm:"column:ep_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
||||
|
State int `json:"state" gorm:"column:ep_state;type:int(2) unsigned;default:1;not null;comment:1:起草,2:审批中;3:通过;4:驳回"` |
||||
|
RoleGroup int64 `json:"rolegroup" gorm:"column:ep_role_group;type:bigint(20) unsigned;default:0;not null;comment:角色组"` |
||||
|
TypeClass int `json:"type" gorm:"column:ep_type;type:tinyint(1) unsigned;default:1;not null;comment:1、定性;2、定量"` |
||||
|
Participants string `json:"participants" gorm:"column:ep_participants;type:mediumtext;comment:参与人"` |
||||
|
StartTime int64 `json:"starttime" gorm:"column:ep_start_time;type:bigint(20) unsigned;default:0;not null;comment:流程开始时间"` |
||||
|
NextStep int `json:"nextstep" gorm:"column:ep_next_step;type:int(7) unsigned;default:1;not null;comment:下一步"` |
||||
|
NextExecutor string `json:"nextexecutor" gorm:"column:ep_next_executor;type:mediumtext;comment:下一步执行人"` |
||||
|
SetupDepartment int64 `json:"setupdepartment" gorm:"column:ep_setup_department;type:bigint(20) unsigned;default:0;not null;comment:发起部门"` |
||||
|
Dimension string `json:"dimension" gorm:"column:ep_dimension;type:mediumtext;comment:维度"` |
||||
|
Target string `json:"target" gorm:"column:ep_target;type:mediumtext;comment:指标"` |
||||
|
DetailedTarget string `json:"detailedtarget" gorm:"column:ep_detailedtarget;type:mediumtext;comment:指标细则"` |
||||
|
AcceptDepartment int64 `json:"acceptdepartment" gorm:"column:ep_accept_department;type:bigint(20) unsigned;default:0;not null;comment:接受考核部门"` |
||||
|
} |
||||
|
|
||||
|
func (EvaluationProcess *EvaluationProcess) TableName() string { |
||||
|
return "evaluation_process" |
||||
|
} |
||||
|
|
||||
|
// 编辑内容
|
||||
|
func (cont *EvaluationProcess) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
||||
|
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 获取内容
|
||||
|
func (cont *EvaluationProcess) 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 *EvaluationProcess) CountCont(whereMap interface{}) (countId int64) { |
||||
|
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 读取全部信息
|
||||
|
func (cont *EvaluationProcess) ContMap(whereMap interface{}, field ...string) (countAry []EvaluationProcess, 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 *EvaluationProcess) DelCont(whereMap interface{}) (err error) { |
||||
|
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
||||
|
return |
||||
|
} |
||||
@ -0,0 +1,76 @@ |
|||||
|
package modelskpi |
||||
|
|
||||
|
import ( |
||||
|
"key_performance_indicators/overall" |
||||
|
"strings" |
||||
|
) |
||||
|
|
||||
|
// 定量考核数据表
|
||||
|
type FlowLog struct { |
||||
|
Id int64 `json:"id" gorm:"primaryKey;column:fl_id;type:bigint(20) unsigned;not null;comment:Id;index"` |
||||
|
EvaluationPlan string `json:"evaluationplan" gorm:"column:fl_evaluation_id;type:mediumtext unsigned;default:0;not null;comment:考核方案项目ID"` |
||||
|
Score int64 `json:"score" gorm:"column:fl_data;type:bigint(20) unsigned;default:0;not null;comment:数据"` |
||||
|
Key int64 `json:"key" gorm:"column:fl_key;type:bigint(20) unsigned;default:0;not null;comment:识别标志"` |
||||
|
Content string `json:"content" gorm:"column:fl_content;type:mediumtext;comment:描述"` |
||||
|
Time int64 `json:"time" gorm:"column:fl_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
||||
|
EiteTime int64 `json:"eitetime" gorm:"column:fl_eite_time;type:bigint(20) unsigned;default:0;not null;comment:修改时间"` |
||||
|
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:测评集团"` |
||||
|
Year int64 `json:"year" gorm:"column:fl_year;type:int(7) unsigned;default:0;not null;comment:年分"` |
||||
|
Quarter int64 `json:"quarter" gorm:"column:fl_quarter;type:int(2) unsigned;default:0;not null;comment:季度"` |
||||
|
Month int64 `json:"month" gorm:"column:fl_month;type:int(2) unsigned;default:0;not null;comment:月"` |
||||
|
Week int64 `json:"week" gorm:"column:fl_week;type:int(5) unsigned;default:0;not null;comment:周"` |
||||
|
ToDay int64 `json:"today" gorm:"column:fl_day;type:int(5) unsigned;default:0;not null;comment:天"` |
||||
|
Enclosure 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:通过)"` |
||||
|
PlanVersion string `json:"planversion" gorm:"column:fl_planversion;type:varchar(255);comment:版本号"` |
||||
|
Baseline string `json:"baseline" gorm:"column:fl_baseline;type:longtext;comment:基准线 "` |
||||
|
} |
||||
|
|
||||
|
func (FlowLog *FlowLog) TableName() string { |
||||
|
return "flow_log" |
||||
|
} |
||||
|
|
||||
|
// 编辑内容
|
||||
|
func (cont *FlowLog) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
||||
|
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 获取内容
|
||||
|
func (cont *FlowLog) 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 *FlowLog) CountCont(whereMap interface{}) (countId int64) { |
||||
|
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 读取全部信息
|
||||
|
func (cont *FlowLog) ContMap(whereMap interface{}, field ...string) (countAry []FlowLog, 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 *FlowLog) DelCont(whereMap interface{}) (err error) { |
||||
|
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
||||
|
return |
||||
|
} |
||||
@ -0,0 +1,71 @@ |
|||||
|
package modelskpi |
||||
|
|
||||
|
import ( |
||||
|
"key_performance_indicators/overall" |
||||
|
"strings" |
||||
|
) |
||||
|
|
||||
|
// 定量考核数据流
|
||||
|
type FlowLogData 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"` |
||||
|
} |
||||
|
|
||||
|
func (FlowLogData *FlowLogData) TableName() string { |
||||
|
return "flow_log_data" |
||||
|
} |
||||
|
|
||||
|
// 编辑内容
|
||||
|
func (cont *FlowLogData) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
||||
|
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 获取内容
|
||||
|
func (cont *FlowLogData) 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 *FlowLogData) CountCont(whereMap interface{}) (countId int64) { |
||||
|
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 读取全部信息
|
||||
|
func (cont *FlowLogData) ContMap(whereMap interface{}, field ...string) (countAry []FlowLogData, 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 *FlowLogData) DelCont(whereMap interface{}) (err error) { |
||||
|
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
||||
|
return |
||||
|
} |
||||
@ -0,0 +1,65 @@ |
|||||
|
package modelskpi |
||||
|
|
||||
|
import ( |
||||
|
"key_performance_indicators/overall" |
||||
|
"strings" |
||||
|
) |
||||
|
|
||||
|
// 考核方案版本管理
|
||||
|
type PlanVersio struct { |
||||
|
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` |
||||
|
Group int64 `json:"group" gorm:"column:group;type:bigint(20) unsigned;default:0;not null;comment:集团ID"` |
||||
|
Department int64 `json:"department" gorm:"column:department;type:bigint(20) unsigned;default:0;comment:部门ID"` |
||||
|
Year int64 `json:"year" gorm:"column:yeares;type:int(5) unsigned;default:0;not null;comment:年度"` |
||||
|
Versio string `json:"versio" gorm:"column:versio;type:varchar(20) unsigned;default:0;not null;comment:版本号"` |
||||
|
Key string `json:"key" gorm:"column:key;type:varchar(200) unsigned;default:0;not null;comment:编码"` |
||||
|
State int `json:"state" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
||||
|
AddTime int64 `json:"addtime" gorm:"column:addtime;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
||||
|
EiteTime int64 `json:"eitetime" gorm:"column:eitetime;type:bigint(20) unsigned;default:0;not null;comment:修改时间"` |
||||
|
Content string `json:"content" gorm:"column:content;type:longtext;comment:版本内容"` |
||||
|
} |
||||
|
|
||||
|
func (PlanVersio *PlanVersio) TableName() string { |
||||
|
return "plan_versio" |
||||
|
} |
||||
|
|
||||
|
// 编辑内容
|
||||
|
func (cont *PlanVersio) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
||||
|
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 获取内容
|
||||
|
func (cont *PlanVersio) 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 *PlanVersio) CountCont(whereMap interface{}) (countId int64) { |
||||
|
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 读取全部信息
|
||||
|
func (cont *PlanVersio) ContMap(whereMap interface{}, field ...string) (countAry []PlanVersio, 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 *PlanVersio) DelCont(whereMap interface{}) (err error) { |
||||
|
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
||||
|
return |
||||
|
} |
||||
@ -0,0 +1,83 @@ |
|||||
|
package modelskpi |
||||
|
|
||||
|
import ( |
||||
|
"key_performance_indicators/overall" |
||||
|
"strings" |
||||
|
) |
||||
|
|
||||
|
// 部门方案
|
||||
|
// 性质考核方案明细
|
||||
|
type QualitativeEvaluation struct { |
||||
|
Id int64 `json:"id" gorm:"primaryKey;column:qe_id;type:bigint(20) unsigned;not null;comment:Id;index"` |
||||
|
Title string `json:"title" gorm:"column:qe_title;type:text;comment:考核名称"` |
||||
|
DepartmentId string `json:"parentid" gorm:"column:qe_department_id;type:text;comment:执行考核部门ID"` |
||||
|
Dimension int64 `json:"dimension" gorm:"column:qe_dimension;type:bigint(20) unsigned;default:0;not null;comment:考核维度"` |
||||
|
Target int64 `json:"target" gorm:"column:qe_target;type:bigint(20) unsigned;default:0;not null;comment:考核指标"` |
||||
|
TargetSun int64 `json:"targetsun" gorm:"column:qe_target_sun;type:bigint(20) unsigned;default:0;not null;comment:考核指标子栏目"` |
||||
|
DetailedTarget int64 `json:"detailedtarget" gorm:"column:qe_detailed_target;type:bigint(20) unsigned;default:0;not null;comment:考核细则"` |
||||
|
Type int `json:"type" gorm:"column:qe_type;type:int(1) unsigned;default:1;not null;comment:1:定性考核;2:定量考核"` |
||||
|
Weight int64 `json:"weight" gorm:"column:qe_weight;type:int(5) unsigned;default:0;not null;comment:权重"` |
||||
|
Unit string `json:"unit" gorm:"column:qe_unit;type:varchar(255);comment:单位"` |
||||
|
ReferenceScore int64 `json:"referencescore" gorm:"column:qe_reference_score;type:int(9) unsigned;default:0;not null;comment:标准分值"` |
||||
|
State int `json:"state" gorm:"column:qe_state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
||||
|
Addtime int64 `json:"addtime" gorm:"column:qe_addtime;type:bigint(20) unsigned;default:0;not null;comment:添加时间"` |
||||
|
Eitetime int64 `json:"eitetime" gorm:"column:qe_eitetime;type:bigint(20) unsigned;default:0;not null;comment:编辑时间"` |
||||
|
Group int64 `json:"group" gorm:"column:qe_group;type:bigint(20) unsigned;default:0;not null;comment:归属集团"` |
||||
|
QualEvalId string `json:"qualevalid" gorm:"column:qe_qual_eval_id;type:varchar(200) unsigned;default:0;not null;comment:性质考核方案"` |
||||
|
Cycles int `json:"cycle" gorm:"column:qe_cycle;type:tinyint(1) unsigned;default:1;not null;comment:1:班;2:天;3:周;4:月;5:季度;6:年"` |
||||
|
CycleAttres int `json:"cycleattr" gorm:"column:qe_cycleattr;type:int(9) unsigned;default:1;not null;comment:辅助计数"` |
||||
|
AcceptEvaluation int64 `json:"acceptevaluation" gorm:"column:qe_accept_evaluation;type:bigint(20) unsigned;default:0;not null;comment:接受考核部门"` |
||||
|
Operator string `json:"operator" gorm:"column:qe_operator;type:text;comment:执行人"` |
||||
|
Content string `json:"content" gorm:"column:qe_content;type:text;comment:补充说明"` |
||||
|
MinScore int64 `json:"minscore" gorm:"column:qe_min_score;type:bigint(20) unsigned;default:0;not null;comment:最小分*100保存"` |
||||
|
MaxScore int64 `json:"maxscore" gorm:"column:qe_max_score;type:bigint(20) unsigned;default:0;not null;comment:最大分*100保存"` |
||||
|
CensorType string `json:"censortype" gorm:"column:qe_censor_type;type:tinyint(1) unsigned;default:1;not null;comment:检查方式"` |
||||
|
CensorCont string `json:"censorcont" gorm:"column:qe_censor_cont;type:longtext;comment:检查依据"` |
||||
|
CensorRate int `json:"censorrate" gorm:"column:qe_censor_rate;type:int(5) unsigned;default:1;not null;comment:检查频次"` |
||||
|
Observer int `json:"observer" gorm:"column:observer;type:tinyint(1) unsigned;default:1;not null;comment:1:启用;2:禁用;3:观察"` |
||||
|
} |
||||
|
|
||||
|
func (QualitativeEvaluation *QualitativeEvaluation) TableName() string { |
||||
|
return "qualitative_evaluation" |
||||
|
} |
||||
|
|
||||
|
// 编辑内容
|
||||
|
func (cont *QualitativeEvaluation) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
||||
|
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 获取内容
|
||||
|
func (cont *QualitativeEvaluation) 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 *QualitativeEvaluation) CountCont(whereMap interface{}) (countId int64) { |
||||
|
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 读取全部信息
|
||||
|
func (cont *QualitativeEvaluation) ContMap(whereMap interface{}, field ...string) (countAry []QualitativeEvaluation, 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 *QualitativeEvaluation) DelCont(whereMap interface{}) (err error) { |
||||
|
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
||||
|
return |
||||
|
} |
||||
@ -0,0 +1,82 @@ |
|||||
|
package modelskpi |
||||
|
|
||||
|
import ( |
||||
|
"key_performance_indicators/overall" |
||||
|
"strings" |
||||
|
) |
||||
|
|
||||
|
// 分数流水
|
||||
|
type ScoreFlow struct { |
||||
|
Id int64 `json:"id" gorm:"primaryKey;column:sf_id;type:bigint(20) unsigned;not null;comment:Id"` |
||||
|
EvaluationPlan int64 `json:"evaluationplan" gorm:"column:sf_evaluation_plan;type:bigint(20) unsigned;default:0;not null;comment:考核方案项目ID"` |
||||
|
PlusReduceScore int `json:"plusreducescore" gorm:"column:sf_plus_reduce_score;type:tinyint(1) unsigned;default:1;not null;comment:1:加分;2:减分"` |
||||
|
Score int64 `json:"score" gorm:"column:sf_score;type:bigint(20) unsigned;default:0;not null;comment:分值(乘100录入)"` |
||||
|
Key int64 `json:"key" gorm:"column:sf_key;type:bigint(20) unsigned;default:0;not null;comment:识别标志"` |
||||
|
Reason string `json:"reason" gorm:"column:sf_reason;type:mediumtext;comment:操作原因"` |
||||
|
Content string `json:"content" gorm:"column:sf_content;type:mediumtext;comment:操作结构体"` |
||||
|
Time int64 `json:"time" gorm:"column:sf_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
||||
|
EiteTime int64 `json:"eitetime" gorm:"column:sf_eite_time;type:bigint(20) unsigned;default:0;not null;comment:修改时间"` |
||||
|
EvaluationDepartment int64 `json:"evaluationdepartment" gorm:"column:sf_evaluation_department;type:bigint(20) unsigned;default:0;not null;comment:测评部门"` |
||||
|
EvaluationUser int64 `json:"evaluationuser" gorm:"column:sf_evaluation_user;type:bigint(20) unsigned;default:0;not null;comment:测评人"` |
||||
|
EvaluationGroup int64 `json:"evaluationgroup" gorm:"column:sf_evaluation_group;type:bigint(20) unsigned;default:0;not null;comment:测评集团"` |
||||
|
Year int64 `json:"year" gorm:"column:sf_year;type:int(7) unsigned;default:0;not null;comment:年分"` |
||||
|
Quarter int64 `json:"quarter" gorm:"column:sf_quarter;type:int(2) unsigned;default:0;not null;comment:季度"` |
||||
|
Month int64 `json:"month" gorm:"column:sf_month;type:int(2) unsigned;default:0;not null;comment:月"` |
||||
|
Week int64 `json:"week" gorm:"column:sf_week;type:int(5) unsigned;default:0;not null;comment:周"` |
||||
|
Enclosure string `json:"enclosure" gorm:"column:sf_enclosure;type:longtext;comment:附件"` |
||||
|
DutyGroup int64 `json:"dutygroup" gorm:"column:sf_duty_group;type:bigint(20) unsigned;default:0;not null;comment:职责集团"` |
||||
|
DutyDepartment int64 `json:"dutydepartment" gorm:"column:sf_duty_department;type:bigint(20) unsigned;default:0;not null;comment:职责部门"` |
||||
|
Reply int `json:"reply" gorm:"column:sf_reply;type:int(2) unsigned;default:1;not null;comment:状态(0:删除;1:起草;2:审批;3:通过)"` |
||||
|
Rectification int `json:"rectification" gorm:"column:sf_rectification;type:tinyint(1) unsigned;default:1;not null;comment:1、需要整改;2:无需整改"` |
||||
|
HappenTime int64 `json:"happentime" gorm:"column:sf_happen_time;type:bigint(20) unsigned;default:0;not null;comment:发生时间"` |
||||
|
Count int `json:"count" gorm:"column:sf_count;type:int(5) unsigned;default:1;not null;comment:发生次数"` |
||||
|
CorrectionTime int64 `json:"correctiontime" gorm:"column:sf_correctiontime;type:bigint(20) unsigned;default:0;not null;comment:整改期限"` |
||||
|
PlanVersion string `json:"planversion" gorm:"column:sf_planversion;type:varchar(255);comment:版本号"` |
||||
|
TargetId int64 `json:"targetid" gorm:"column:sf_target_id;type:bigint(20) unsigned;default:0;not null;comment:指标ID"` |
||||
|
DetailedId int64 `json:"detailedid" gorm:"column:sf_detailed_id;type:bigint(20) unsigned;default:0;not null;comment:指标细则"` |
||||
|
} |
||||
|
|
||||
|
func (ScoreFlow *ScoreFlow) TableName() string { |
||||
|
return "score_flow" |
||||
|
} |
||||
|
|
||||
|
// 编辑内容
|
||||
|
func (cont *ScoreFlow) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
||||
|
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 获取内容
|
||||
|
func (cont *ScoreFlow) 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 *ScoreFlow) CountCont(whereMap interface{}) (countId int64) { |
||||
|
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 读取全部信息
|
||||
|
func (cont *ScoreFlow) ContMap(whereMap interface{}, field ...string) (countAry []ScoreFlow, 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 *ScoreFlow) DelCont(whereMap interface{}) (err error) { |
||||
|
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
||||
|
return |
||||
|
} |
||||
@ -0,0 +1,115 @@ |
|||||
|
{ |
||||
|
"code": 0, |
||||
|
"msg": "成功", |
||||
|
"data": { |
||||
|
"key": "f782e7cfdf4732fb296f16359590d6ad", |
||||
|
"token": "90ac4f9925233c10648987a25f2dc58de6c42f8c", |
||||
|
"usercont": { |
||||
|
"adminorg": 272, |
||||
|
"birthday": 882374400, |
||||
|
"company": 309, |
||||
|
"companyname": "山东恒信高科能源有限公司", |
||||
|
"constellationing": 9, |
||||
|
"currentresidence": "山东省宁阳县西关社区", |
||||
|
"deparment": "", |
||||
|
"email": "", |
||||
|
"emptype": 8, |
||||
|
"entrydate": 1637683200, |
||||
|
"gender": 1, |
||||
|
"globalroaming": "", |
||||
|
"health": 1, |
||||
|
"hireclass": 1, |
||||
|
"icon": "https://wework.qpic.cn/wwhead/duc2TvpEgSQgUKEe0Fda8oILw6YibaHehrEgmXCL4mfjzKKe7a2ibk8us04G5EXDPkWnMc67718jY/0", |
||||
|
"id": 80, |
||||
|
"idcardIssued": "", |
||||
|
"idcardaddress": "", |
||||
|
"idcardenddate": 0, |
||||
|
"idcardno": "370921199712182136", |
||||
|
"idcardstartdate": 0, |
||||
|
"internaltelephone": "", |
||||
|
"isadmin": 1, |
||||
|
"isdoubleworker": 1, |
||||
|
"isveterans": 1, |
||||
|
"jobclass": 6, |
||||
|
"jobid": 52, |
||||
|
"jobleve": 0, |
||||
|
"jobstartdate": 1596211200, |
||||
|
"key": 16384038535027389, |
||||
|
"maindeparment": 102, |
||||
|
"maindeparmentname": "企管部", |
||||
|
"maritalstatus": 1, |
||||
|
"mobilephone": "17853319013", |
||||
|
"myfolk": "汉族", |
||||
|
"name": "马飞", |
||||
|
"nativeplace": "山东省宁阳县西关社区", |
||||
|
"number": "301968", |
||||
|
"passportno": "", |
||||
|
"password": "1dc7402ad00756bd47cbb7a6f835c9bf", |
||||
|
"planformaldate": 1637683200, |
||||
|
"political_outlook": 1, |
||||
|
"position": 795, |
||||
|
"positionname": "科员", |
||||
|
"probationperiod": 0, |
||||
|
"role": "1", |
||||
|
"state": 1, |
||||
|
"sunmaindeparment": 272, |
||||
|
"teamid": 0, |
||||
|
"veteransnumber": "", |
||||
|
"wechat": "", |
||||
|
"workwechat": "Fei1893" |
||||
|
}, |
||||
|
"userinfo": { |
||||
|
"id": 80, |
||||
|
"number": "301968", |
||||
|
"name": "马飞", |
||||
|
"icon": "https://wework.qpic.cn/wwhead/duc2TvpEgSQgUKEe0Fda8oILw6YibaHehrEgmXCL4mfjzKKe7a2ibk8us04G5EXDPkWnMc67718jY/0", |
||||
|
"hireclass": 1, |
||||
|
"emptype": 8, |
||||
|
"company": 309, |
||||
|
"maindeparment": 102, |
||||
|
"sunmaindeparment": 272, |
||||
|
"deparment": "", |
||||
|
"adminorg": 272, |
||||
|
"teamid": 0, |
||||
|
"position": 795, |
||||
|
"jobclass": 6, |
||||
|
"jobid": 52, |
||||
|
"jobleve": 0, |
||||
|
"time": 1656984568, |
||||
|
"eitetime": 1656984568, |
||||
|
"wechat": "", |
||||
|
"workwechat": "Fei1893", |
||||
|
"state": 1, |
||||
|
"key": 16384038535027389, |
||||
|
"isadmin": 1, |
||||
|
"password": "1dc7402ad00756bd47cbb7a6f835c9bf", |
||||
|
"role": "1", |
||||
|
"idcardno": "370921199712182136", |
||||
|
"passportno": "", |
||||
|
"globalroaming": "", |
||||
|
"mobilephone": "17853319013", |
||||
|
"email": "", |
||||
|
"gender": 1, |
||||
|
"birthday": 882374400, |
||||
|
"myfolk": "汉族", |
||||
|
"nativeplace": "山东省宁阳县西关社区", |
||||
|
"idcardstartdate": 0, |
||||
|
"idcardenddate": 0, |
||||
|
"idcardaddress": "", |
||||
|
"idcardIssued": "", |
||||
|
"health": 1, |
||||
|
"maritalstatus": 1, |
||||
|
"internaltelephone": "", |
||||
|
"currentresidence": "山东省宁阳县西关社区", |
||||
|
"constellationing": 9, |
||||
|
"isdoubleworker": 1, |
||||
|
"isveterans": 1, |
||||
|
"veteransnumber": "", |
||||
|
"jobstartdate": 1596211200, |
||||
|
"entrydate": 1637683200, |
||||
|
"probationperiod": 0, |
||||
|
"planformaldate": 1637683200, |
||||
|
"politicaloutlook": 1 |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue