21 changed files with 2017 additions and 203 deletions
@ -0,0 +1,100 @@ |
|||
package evaluation |
|||
|
|||
import ( |
|||
"github.com/flipped-aurora/gin-vue-admin/server/commonus" |
|||
"github.com/flipped-aurora/gin-vue-admin/server/global" |
|||
"github.com/flipped-aurora/gin-vue-admin/server/model/assessmentmodel" |
|||
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response" |
|||
"github.com/gin-gonic/gin" |
|||
) |
|||
|
|||
//查看定量考核目标设定
|
|||
func (e *EvaluationInterface) LookQuantitativeConfig(c *gin.Context) { |
|||
var requestData SelectQuantitativeConfig |
|||
err := c.ShouldBindJSON(&requestData) |
|||
if err != nil { |
|||
response.Result(101, err, "数据获取失败!", c) |
|||
return |
|||
} |
|||
var qualConfigList []assessmentmodel.QuantitativeConfig |
|||
gormDb := global.GVA_DB_Performanceappraisal |
|||
if requestData.GroupId != "" { |
|||
gormDb = gormDb.Where("`group` = ?", requestData.GroupId) |
|||
} |
|||
if requestData.DepartmentID != "" { |
|||
gormDb = gormDb.Where("`departmentid` = ?", requestData.DepartmentID) |
|||
} |
|||
if requestData.Dimension != "" { |
|||
gormDb = gormDb.Where("`dimension` = ?", requestData.Dimension) |
|||
} |
|||
if requestData.Target != "" { |
|||
gormDb = gormDb.Where("`target` = ?", requestData.Target) |
|||
} |
|||
if requestData.DetailedTarget != "" { |
|||
gormDb = gormDb.Where("`targetconfig` = ?", requestData.DetailedTarget) |
|||
} |
|||
switch requestData.Type { |
|||
case 1: |
|||
gormDb = gormDb.Where("`type` = ?", requestData.Type) |
|||
case 2: |
|||
gormDb = gormDb.Where("`type` = ?", requestData.Type) |
|||
if requestData.Class != 0 { |
|||
gormDb = gormDb.Where("`timecopy` = ?", requestData.Class) |
|||
} |
|||
case 3: |
|||
gormDb = gormDb.Where("`type` = ?", requestData.Type) |
|||
if requestData.Class != 0 { |
|||
gormDb = gormDb.Where("`timecopy` = ?", requestData.Class) |
|||
} |
|||
default: |
|||
} |
|||
if requestData.Year != 0 { |
|||
gormDb = gormDb.Where("`year` = ?", requestData.Year) |
|||
} |
|||
if requestData.State != 0 { |
|||
gormDb = gormDb.Where("`state` = ?", requestData.State) |
|||
} |
|||
// gormDb = gormDb.Order("group ASC,departmentid ASC,dimension ASC,target ASC,targetconfig ASC").Order("year DESC").Order("timecopy ASC,id ASC")
|
|||
gormDb = gormDb.Order("`group` ASC").Order("`departmentid` ASC").Order("`dimension` ASC").Order("`target` ASC").Order("`targetconfig` ASC").Order("`year` DESC").Order("`timecopy` ASC").Order("`id` ASC") |
|||
contErr := gormDb.Find(&qualConfigList).Error |
|||
if contErr != nil { |
|||
response.Result(102, err, "没有数据!", c) |
|||
return |
|||
} |
|||
var outList []OutQuantitativeConfig |
|||
for _, v := range qualConfigList { |
|||
var outCont OutQuantitativeConfig |
|||
outCont.Id = v.Id |
|||
outCont.DepartmentId = v.DepartmentId |
|||
outCont.Group = v.Group |
|||
outCont.Dimension = v.Dimension |
|||
outCont.Target = v.Target |
|||
outCont.TargetConfig = v.TargetConfig |
|||
outCont.Type = v.Type |
|||
outCont.Year = v.Year |
|||
outCont.Timecopy = v.Timecopy |
|||
outCont.Zeroprize = v.Zeroprize / 100 |
|||
outCont.Allprize = v.Allprize / 100 |
|||
outCont.Time = v.Time |
|||
outCont.State = v.State |
|||
|
|||
gErr, groupInfo := commonus.GetGroupCont(v.Group) |
|||
if gErr == true { |
|||
outCont.GroupTitle = groupInfo.Name |
|||
} |
|||
dErr, departmentInfo := commonus.GetBranchFactory(v.DepartmentId) |
|||
if dErr == true { |
|||
outCont.DimensionTitle = departmentInfo.Name |
|||
} |
|||
targetInfo, tErr := commonus.GetTargetInfo(v.Target) |
|||
if tErr == true { |
|||
outCont.TargetTitle = targetInfo.Title |
|||
} |
|||
dtargetInfo, dtErr := commonus.GetDetailedTargetInfo(v.TargetConfig) |
|||
if dtErr == true { |
|||
outCont.DetailedTargetTitle = dtargetInfo.Title |
|||
} |
|||
outList = append(outList, outCont) |
|||
} |
|||
response.Result(0, outList, "获取成功!", c) |
|||
} |
|||
@ -0,0 +1,253 @@ |
|||
package assessment |
|||
|
|||
import ( |
|||
"strconv" |
|||
"time" |
|||
|
|||
"github.com/flipped-aurora/gin-vue-admin/server/commonus" |
|||
"github.com/flipped-aurora/gin-vue-admin/server/global" |
|||
"github.com/flipped-aurora/gin-vue-admin/server/model/assessmentmodel" |
|||
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response" |
|||
"github.com/gin-gonic/gin" |
|||
) |
|||
|
|||
func (d *DutyHandle) SetEvaluationObjectives(c *gin.Context) { |
|||
var requestData SetEvaluationObjectives |
|||
err := c.ShouldBindJSON(&requestData) |
|||
if err != nil { |
|||
response.Result(101, err, "数据获取失败!", c) |
|||
return |
|||
} |
|||
if requestData.Year == 0 { |
|||
response.Result(102, err, "请填写年度", c) |
|||
return |
|||
} |
|||
if requestData.Group == 0 { |
|||
response.Result(102, err, "请选择归属集团", c) |
|||
return |
|||
} |
|||
if requestData.DepartMent == 0 { |
|||
response.Result(102, err, "请选择归属部门", c) |
|||
return |
|||
} |
|||
if requestData.Dimension == "" { |
|||
response.Result(102, err, "请选择归属维度", c) |
|||
return |
|||
} |
|||
if requestData.Target == "" { |
|||
response.Result(102, err, "请选择归属指标", c) |
|||
return |
|||
} |
|||
switch requestData.Cycle { |
|||
case 1: |
|||
if len(requestData.CycleAdded) != 1 { |
|||
response.Result(102, err, "年度只可填写一条!", c) |
|||
return |
|||
} |
|||
case 2: |
|||
if len(requestData.CycleAdded) > 4 { |
|||
response.Result(102, err, "季度最多只可填写四条!", c) |
|||
return |
|||
} |
|||
if len(requestData.CycleAdded) < 1 { |
|||
response.Result(102, err, "季度至少填写一条!", c) |
|||
return |
|||
} |
|||
case 3: |
|||
if len(requestData.CycleAdded) > 12 { |
|||
response.Result(102, err, "月度最多只可填写十二条!", c) |
|||
return |
|||
} |
|||
if len(requestData.CycleAdded) < 1 { |
|||
response.Result(102, err, "月度至少填写一条!", c) |
|||
return |
|||
} |
|||
default: |
|||
response.Result(102, err, "请选择周期", c) |
|||
return |
|||
} |
|||
var timecopy []int64 |
|||
gromDb := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QuantitativeConfig{}).Select("Timecopy").Where("`group` = ? AND `departmentid` = ? AND `dimension` = ? AND `target` = ? AND `year` = ? AND `type` = ?", requestData.Group, requestData.DepartMent, requestData.Dimension, requestData.Target, requestData.Year, requestData.Cycle) |
|||
if requestData.TargetDetails != "" { |
|||
gromDb = gromDb.Where("`targetconfig` = ?", requestData.TargetDetails) |
|||
} |
|||
judgeErr := gromDb.Find(&timecopy).Error |
|||
var saveData []assessmentmodel.QuantitativeConfig |
|||
var eiteAddData []int64 |
|||
for _, v := range requestData.CycleAdded { |
|||
if judgeErr != nil { |
|||
var saveDataCont assessmentmodel.QuantitativeConfig |
|||
saveDataCont.DepartmentId = requestData.DepartMent |
|||
saveDataCont.Group = requestData.Group |
|||
dimensionId, dimensionIdErr := strconv.ParseInt(requestData.Dimension, 10, 64) |
|||
if dimensionIdErr == nil { |
|||
saveDataCont.Dimension = dimensionId |
|||
} |
|||
|
|||
targetId, targetIdErr := strconv.ParseInt(requestData.Target, 10, 64) |
|||
if targetIdErr == nil { |
|||
saveDataCont.Target = targetId |
|||
} |
|||
|
|||
targetDetailsId, targetDetailsIdErr := strconv.ParseInt(requestData.TargetDetails, 10, 64) |
|||
if targetDetailsIdErr == nil { |
|||
saveDataCont.TargetConfig = targetDetailsId |
|||
} |
|||
saveDataCont.Type = int64(requestData.Cycle) |
|||
saveDataCont.Year = requestData.Year |
|||
saveDataCont.Timecopy = v.Id |
|||
if v.Zeroprize < 0 { |
|||
saveDataCont.Zeroprize = 0 |
|||
} else { |
|||
if v.Zeroprize > 100 { |
|||
saveDataCont.Zeroprize = 10000 |
|||
} else { |
|||
saveDataCont.Zeroprize = v.Zeroprize * 100 |
|||
} |
|||
} |
|||
if v.Allprize < 0 { |
|||
saveDataCont.Allprize = 0 |
|||
} else { |
|||
if v.Allprize > 100 { |
|||
saveDataCont.Allprize = 10000 |
|||
} else { |
|||
saveDataCont.Allprize = v.Allprize * 100 |
|||
} |
|||
} |
|||
saveDataCont.Time = time.Now().Unix() |
|||
saveDataCont.State = 1 |
|||
saveData = append(saveData, saveDataCont) |
|||
} else { |
|||
if len(timecopy) <= 0 { |
|||
var saveDataCont assessmentmodel.QuantitativeConfig |
|||
saveDataCont.DepartmentId = requestData.DepartMent |
|||
saveDataCont.Group = requestData.Group |
|||
dimensionId, dimensionIdErr := strconv.ParseInt(requestData.Dimension, 10, 64) |
|||
if dimensionIdErr == nil { |
|||
saveDataCont.Dimension = dimensionId |
|||
} |
|||
|
|||
targetId, targetIdErr := strconv.ParseInt(requestData.Target, 10, 64) |
|||
if targetIdErr == nil { |
|||
saveDataCont.Target = targetId |
|||
} |
|||
|
|||
targetDetailsId, targetDetailsIdErr := strconv.ParseInt(requestData.TargetDetails, 10, 64) |
|||
if targetDetailsIdErr == nil { |
|||
saveDataCont.TargetConfig = targetDetailsId |
|||
} |
|||
saveDataCont.Type = int64(requestData.Cycle) |
|||
saveDataCont.Year = requestData.Year |
|||
saveDataCont.Timecopy = v.Id |
|||
if v.Zeroprize < 0 { |
|||
saveDataCont.Zeroprize = 0 |
|||
} else { |
|||
if v.Zeroprize > 100 { |
|||
saveDataCont.Zeroprize = 10000 |
|||
} else { |
|||
saveDataCont.Zeroprize = v.Zeroprize * 100 |
|||
} |
|||
} |
|||
if v.Allprize < 0 { |
|||
saveDataCont.Allprize = 0 |
|||
} else { |
|||
if v.Allprize > 100 { |
|||
saveDataCont.Allprize = 10000 |
|||
} else { |
|||
saveDataCont.Allprize = v.Allprize * 100 |
|||
} |
|||
} |
|||
saveDataCont.Time = time.Now().Unix() |
|||
saveDataCont.State = 1 |
|||
saveData = append(saveData, saveDataCont) |
|||
} else { |
|||
for _, s_v := range timecopy { |
|||
if s_v != v.Id { |
|||
var saveDataCont assessmentmodel.QuantitativeConfig |
|||
saveDataCont.DepartmentId = requestData.DepartMent |
|||
saveDataCont.Group = requestData.Group |
|||
dimensionId, dimensionIdErr := strconv.ParseInt(requestData.Dimension, 10, 64) |
|||
if dimensionIdErr == nil { |
|||
saveDataCont.Dimension = dimensionId |
|||
} |
|||
|
|||
targetId, targetIdErr := strconv.ParseInt(requestData.Target, 10, 64) |
|||
if targetIdErr == nil { |
|||
saveDataCont.Target = targetId |
|||
} |
|||
|
|||
targetDetailsId, targetDetailsIdErr := strconv.ParseInt(requestData.TargetDetails, 10, 64) |
|||
if targetDetailsIdErr == nil { |
|||
saveDataCont.TargetConfig = targetDetailsId |
|||
} |
|||
saveDataCont.Type = int64(requestData.Cycle) |
|||
saveDataCont.Year = requestData.Year |
|||
saveDataCont.Timecopy = v.Id |
|||
if v.Zeroprize < 0 { |
|||
saveDataCont.Zeroprize = 0 |
|||
} else { |
|||
if v.Zeroprize > 100 { |
|||
saveDataCont.Zeroprize = 10000 |
|||
} else { |
|||
saveDataCont.Zeroprize = v.Zeroprize * 100 |
|||
} |
|||
} |
|||
if v.Allprize < 0 { |
|||
saveDataCont.Allprize = 0 |
|||
} else { |
|||
if v.Allprize > 100 { |
|||
saveDataCont.Allprize = 10000 |
|||
} else { |
|||
saveDataCont.Allprize = v.Allprize * 100 |
|||
} |
|||
} |
|||
saveDataCont.Time = time.Now().Unix() |
|||
saveDataCont.State = 1 |
|||
saveData = append(saveData, saveDataCont) |
|||
} else { |
|||
eiteDataMap := commonus.MapOut() |
|||
eiteDataMap["type"] = requestData.Cycle |
|||
eiteDataMap["timecopy"] = v.Id |
|||
if v.Zeroprize < 0 { |
|||
eiteDataMap["zeroprize"] = 0 |
|||
} else { |
|||
if v.Zeroprize > 100 { |
|||
eiteDataMap["zeroprize"] = 10000 |
|||
} else { |
|||
eiteDataMap["zeroprize"] = v.Zeroprize * 100 |
|||
} |
|||
} |
|||
if v.Allprize < 0 { |
|||
eiteDataMap["allprize"] = 0 |
|||
} else { |
|||
if v.Allprize > 100 { |
|||
eiteDataMap["allprize"] = 10000 |
|||
} else { |
|||
eiteDataMap["allprize"] = v.Allprize * 100 |
|||
} |
|||
} |
|||
eiteDataMap["time"] = time.Now().Unix() |
|||
gromDb := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QuantitativeConfig{}).Select("Timecopy").Where("`group` = ? AND `departmentid` = ? AND `dimension` = ? AND `target` = ? AND `year` = ? AND `type` = ?", requestData.Group, requestData.DepartMent, requestData.Dimension, requestData.Target, requestData.Year, requestData.Cycle) |
|||
if requestData.TargetDetails != "" { |
|||
gromDb = gromDb.Where("`targetconfig` = ?", requestData.TargetDetails) |
|||
} |
|||
gromDb.Updates(eiteDataMap) |
|||
eiteAddData = append(eiteAddData, 1) |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
if len(saveData) <= 0 && len(eiteAddData) <= 0 { |
|||
response.Result(102, err, "没有要添加的数据!", c) |
|||
return |
|||
} |
|||
if len(saveData) > 0 { |
|||
saveErr := global.GVA_DB_Performanceappraisal.Create(&saveData).Error |
|||
if saveErr != nil { |
|||
response.Result(102, err, "数据添加失败!", c) |
|||
return |
|||
} |
|||
} |
|||
response.Result(0, err, "数据处理完成!", c) |
|||
} |
|||
@ -0,0 +1,730 @@ |
|||
package assessment |
|||
|
|||
import ( |
|||
"fmt" |
|||
"strconv" |
|||
"strings" |
|||
"time" |
|||
|
|||
"github.com/flipped-aurora/gin-vue-admin/server/api/v1/archiveapi" |
|||
"github.com/flipped-aurora/gin-vue-admin/server/commonus" |
|||
"github.com/flipped-aurora/gin-vue-admin/server/global" |
|||
"github.com/flipped-aurora/gin-vue-admin/server/model/assessmentmodel" |
|||
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response" |
|||
"github.com/flipped-aurora/gin-vue-admin/server/model/testpage" |
|||
"github.com/gin-gonic/gin" |
|||
) |
|||
|
|||
//部门考核
|
|||
func (d *DutyHandle) DepartmentList(c *gin.Context) { |
|||
var requestData rationSelect |
|||
c.ShouldBindJSON(&requestData) |
|||
var groupId int64 = 3 |
|||
if requestData.Group != "" { |
|||
groupId, _ = strconv.ParseInt(requestData.Group, 10, 64) |
|||
} |
|||
var departList []deparMentModel |
|||
gromDb := global.GVA_DB_Master.Model(&testpage.BranchFactory{}).Select("bf_id", "bf_name", "bf_wechat_id").Where("`bf_set` = 1 AND `bf_group` = ?", groupId) |
|||
if requestData.DepartmentId != "" { |
|||
gromDb = gromDb.Where("`bf_id` = ?", requestData.DepartmentId) |
|||
} |
|||
departMentErr := gromDb.Find(&departList).Error |
|||
if departMentErr != nil || len(departList) < 1 { |
|||
response.Result(101, departMentErr, "没有数据!", c) |
|||
return |
|||
} |
|||
var departAryList []departmentDuty |
|||
for _, v := range departList { |
|||
var departCont departmentDuty |
|||
departCont.Id = strconv.FormatInt(v.Id, 10) |
|||
departCont.Name = v.Name |
|||
departCont.Child = getDepartDimension(groupId, v.Id) |
|||
departAryList = append(departAryList, departCont) |
|||
} |
|||
response.Result(0, departAryList, "数据获取成功!", c) |
|||
} |
|||
|
|||
//获取部门考核维度
|
|||
func getDepartDimension(groupId, departId int64) (dimensionAry []departmentDimension) { |
|||
var fileAry []int64 |
|||
dimErr := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.DepartmentDimension{}).Select("dd_dimension").Where("`dd_group` = ? AND `dd_department` = ?", groupId, departId).Group("dd_dimension").Find(&fileAry).Error |
|||
// fmt.Printf("1--------------->%v\n", dimErr)
|
|||
if dimErr == nil { |
|||
for _, v := range fileAry { |
|||
dimInfo, dimInfoErr := commonus.GetDutyClassInfo(v) |
|||
// fmt.Printf("2--------------->%v\n", dimInfo)
|
|||
if dimInfoErr == true { |
|||
var dimCont departmentDimension |
|||
dimCont.Id = strconv.FormatInt(v, 10) |
|||
dimCont.Name = dimInfo.Title |
|||
dimCont.Child = targetRationDepartList(groupId, departId, v) |
|||
dimensionAry = append(dimensionAry, dimCont) |
|||
} |
|||
} |
|||
|
|||
} |
|||
return |
|||
} |
|||
|
|||
//部门考核项目
|
|||
func targetRationDepartList(groupID, departmentID, dimension int64) (contentList []taskDetails) { |
|||
var fileTargetAry []assessmentmodel.QualitativeEvaluation |
|||
listTargetErr := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Where("`qe_group` = ? AND `qe_accept_evaluation` = ? AND `qe_dimension` = ?", groupID, departmentID, dimension).Find(&fileTargetAry).Error |
|||
if listTargetErr != nil { |
|||
return |
|||
} |
|||
for _, v := range fileTargetAry { |
|||
var content taskDetails |
|||
targetInfo, targetErr := commonus.GetTargetInfo(v.Target) |
|||
if targetErr == true { |
|||
content.Id = strconv.FormatInt(v.Target, 10) |
|||
content.Name = targetInfo.Title |
|||
content.QeId = strconv.FormatInt(v.Id, 10) |
|||
content.Unit = v.Unit |
|||
content.ReferenceScore = v.ReferenceScore |
|||
content.Cycles = v.Cycles |
|||
content.CycleAttres = v.CycleAttres |
|||
content.State = v.State |
|||
|
|||
contentList = append(contentList, content) |
|||
} |
|||
} |
|||
return |
|||
} |
|||
|
|||
//
|
|||
func (d *DutyHandle) DepartmentTaskList(c *gin.Context) { |
|||
var requestData DelQualitative |
|||
c.ShouldBindJSON(&requestData) |
|||
|
|||
var qualitativeEvaluationAry []assessmentmodel.QualitativeEvaluation |
|||
gormDb := global.GVA_DB_Performanceappraisal |
|||
if requestData.Type != 0 { |
|||
gormDb = gormDb.Where("`qe_type` = ?", requestData.Type) |
|||
} |
|||
if requestData.Group != "" { |
|||
gormDb = gormDb.Where("`qe_group` = ?", requestData.Group) |
|||
} |
|||
if requestData.DepartmentId != "" { |
|||
gormDb = gormDb.Where("`qe_accept_evaluation` = ?", requestData.DepartmentId) |
|||
} |
|||
|
|||
if requestData.Dimension != "" { |
|||
gormDb = gormDb.Where("`qe_dimension` = ?", requestData.Dimension) |
|||
} |
|||
if requestData.Target != "" { |
|||
gormDb = gormDb.Where("`qe_target` = ?", requestData.Target) |
|||
} |
|||
if requestData.TargetSun != "" { |
|||
gormDb = gormDb.Where("`qe_target_sun` = ?", requestData.TargetSun) |
|||
} |
|||
listTargetErr := gormDb.Order("qe_group asc,qe_accept_evaluation asc,qe_dimension asc,qe_type asc,qe_target asc,qe_target_sun asc").Find(&qualitativeEvaluationAry).Error |
|||
|
|||
if listTargetErr != nil || len(qualitativeEvaluationAry) < 1 { |
|||
response.Result(101, listTargetErr, "没有数据!", c) |
|||
return |
|||
} |
|||
var uotContAry []TargetContOutCont |
|||
for _, v := range qualitativeEvaluationAry { |
|||
var uotCont TargetContOutCont |
|||
uotCont.Id = strconv.FormatInt(v.Id, 10) |
|||
uotCont.Type = v.Type |
|||
uotCont.Group = strconv.FormatInt(v.Group, 10) |
|||
groupErr, groupCont := commonus.GetGroupCont(v.Group) |
|||
if groupErr == true { |
|||
uotCont.GroupNAme = groupCont.Name |
|||
} |
|||
uotCont.DepartmentId = strconv.FormatInt(v.AcceptEvaluation, 10) |
|||
deparConErr, deparConCont := commonus.GetBranchFactory(v.AcceptEvaluation) |
|||
if deparConErr == true { |
|||
uotCont.DepartmentName = deparConCont.Name |
|||
} |
|||
uotCont.Dimension = strconv.FormatInt(v.Dimension, 10) |
|||
dutyClassCont, dutyClassErr := commonus.GetDutyClassInfo(v.Dimension) |
|||
if dutyClassErr == true { |
|||
uotCont.DimensionName = dutyClassCont.Title |
|||
} |
|||
uotCont.DimensionWeight = commonus.GetDimesionTargetWeight(1, v.Group, v.AcceptEvaluation, v.Dimension, 0) |
|||
|
|||
uotCont.Target = strconv.FormatInt(v.Target, 10) |
|||
targetInfo, targetErr := commonus.GetTargetInfo(v.Target) |
|||
if targetErr == true { |
|||
uotCont.TargetName = targetInfo.Title |
|||
} |
|||
uotCont.TargetWeight = commonus.GetDimesionTargetWeight(1, v.Group, v.AcceptEvaluation, v.Dimension, v.Target) |
|||
uotCont.TargetSun = strconv.FormatInt(v.TargetSun, 10) |
|||
info, infoErr := commonus.GetQualitativeTargetInfo(v.TargetSun) |
|||
if infoErr == true { |
|||
uotCont.TargetSunName = info.Title |
|||
} |
|||
uotCont.DetailedTarget = strconv.FormatInt(v.DetailedTarget, 10) |
|||
dtCont, dtIsTrue := commonus.GetDetailedTargetInfo(v.DetailedTarget) |
|||
if dtIsTrue == true { |
|||
uotCont.DetailedTargetName = dtCont.Title |
|||
uotCont.Content = dtCont.Content |
|||
} |
|||
|
|||
uotCont.Unit = v.Unit |
|||
uotCont.ReferenceScore = v.ReferenceScore |
|||
uotCont.Cycles = v.Cycles |
|||
uotCont.CycleAttres = v.CycleAttres |
|||
uotCont.State = v.State |
|||
userAry := strings.Split(v.Operator, ",") |
|||
uotCont.UserList = userAry |
|||
for _, u_v := range userAry { |
|||
usCont, usErr := archiveapi.GetUserInfo([]string{"worker_man.wm_number", "worker_man_data.wmd_name"}, map[string]interface{}{"wm_key": u_v}) |
|||
if usErr == true { |
|||
var userCont QualEvalArrt |
|||
userCont.Id = u_v |
|||
userCont.Name = usCont.Name |
|||
uotCont.UserListAry = append(uotCont.UserListAry, userCont) |
|||
} |
|||
} |
|||
|
|||
uotCont.DetailedTarget = strconv.FormatInt(v.DetailedTarget, 10) |
|||
uotContAry = append(uotContAry, uotCont) |
|||
} |
|||
response.Result(0, uotContAry, "数据获取成功!", c) |
|||
} |
|||
|
|||
//获取方案考核细则内容
|
|||
func (d *DutyHandle) DetailsAssessmentScheme(c *gin.Context) { |
|||
var requestData commonus.SetIds |
|||
err := c.ShouldBindJSON(&requestData) |
|||
if err != nil { |
|||
response.Result(101, err, "数据获取失败!", c) |
|||
return |
|||
} |
|||
if requestData.Id == 0 && requestData.OutId == "" { |
|||
response.Result(102, err, "参数错误!请重新提交!", c) |
|||
return |
|||
} |
|||
if requestData.OutId != "" { |
|||
idInt, inIntErr := strconv.ParseInt(requestData.OutId, 10, 64) |
|||
if inIntErr == nil { |
|||
requestData.Id = idInt |
|||
} |
|||
} |
|||
|
|||
var systemBFCont assessmentmodel.QualitativeEvaluation |
|||
contErr := global.GVA_DB_Performanceappraisal.Where("`qe_id` = ?", requestData.Id).First(&systemBFCont).Error |
|||
if contErr != nil { |
|||
response.Result(102, err, "数据获取失败!", c) |
|||
return |
|||
} |
|||
var uotCont TargetContOutCont |
|||
uotCont.Id = strconv.FormatInt(systemBFCont.Id, 10) |
|||
uotCont.Type = systemBFCont.Type |
|||
uotCont.Group = strconv.FormatInt(systemBFCont.Group, 10) |
|||
groupErr, groupCont := commonus.GetGroupCont(systemBFCont.Group) |
|||
if groupErr == true { |
|||
uotCont.GroupNAme = groupCont.Name |
|||
} |
|||
uotCont.DepartmentId = strconv.FormatInt(systemBFCont.AcceptEvaluation, 10) |
|||
deparConErr, deparConCont := commonus.GetBranchFactory(systemBFCont.AcceptEvaluation) |
|||
if deparConErr == true { |
|||
uotCont.DepartmentName = deparConCont.Name |
|||
} |
|||
uotCont.Dimension = strconv.FormatInt(systemBFCont.Dimension, 10) |
|||
dutyClassCont, dutyClassErr := commonus.GetDutyClassInfo(systemBFCont.Dimension) |
|||
if dutyClassErr == true { |
|||
uotCont.DimensionName = dutyClassCont.Title |
|||
} |
|||
uotCont.Target = strconv.FormatInt(systemBFCont.Target, 10) |
|||
targetInfo, targetErr := commonus.GetTargetInfo(systemBFCont.Target) |
|||
if targetErr == true { |
|||
uotCont.TargetName = targetInfo.Title |
|||
} |
|||
uotCont.TargetSun = strconv.FormatInt(systemBFCont.TargetSun, 10) |
|||
info, infoErr := commonus.GetQualitativeTargetInfo(systemBFCont.TargetSun) |
|||
if infoErr == true { |
|||
uotCont.TargetSunName = info.Title |
|||
} |
|||
uotCont.DetailedTarget = strconv.FormatInt(systemBFCont.DetailedTarget, 10) |
|||
dtCont, dtIsTrue := commonus.GetDetailedTargetInfo(systemBFCont.DetailedTarget) |
|||
if dtIsTrue == true { |
|||
uotCont.DetailedTargetName = dtCont.Title |
|||
uotCont.Content = dtCont.Content |
|||
} |
|||
uotCont.Unit = systemBFCont.Unit |
|||
uotCont.ReferenceScore = systemBFCont.ReferenceScore |
|||
uotCont.Cycles = systemBFCont.Cycles |
|||
uotCont.CycleAttres = systemBFCont.CycleAttres |
|||
uotCont.State = systemBFCont.State |
|||
uotCont.UserList = strings.Split(systemBFCont.Operator, ",") |
|||
uotCont.DetailedTarget = strconv.FormatInt(systemBFCont.DetailedTarget, 10) |
|||
response.Result(0, uotCont, "数据获取成功!", c) |
|||
} |
|||
|
|||
//删除考核细则方案内容
|
|||
func (d *DutyHandle) DelDepartmentTaskList(c *gin.Context) { |
|||
var requestData commonus.SetIds |
|||
err := c.ShouldBindJSON(&requestData) |
|||
if err != nil { |
|||
response.Result(101, err, "数据获取失败!", c) |
|||
return |
|||
} |
|||
if requestData.Id == 0 && requestData.OutId == "" { |
|||
response.Result(102, err, "参数错误!请重新提交!", c) |
|||
return |
|||
} |
|||
if requestData.OutId != "" { |
|||
idInt, inIntErr := strconv.ParseInt(requestData.OutId, 10, 64) |
|||
if inIntErr == nil { |
|||
requestData.Id = idInt |
|||
} |
|||
} |
|||
var oldCont assessmentmodel.QualitativeEvaluation |
|||
getOldContErr := global.GVA_DB_Performanceappraisal.Where("qe_id = ?", requestData.Id).Find(&oldCont).Error |
|||
if getOldContErr != nil { |
|||
response.Result(102, err, "没有此数据", c) |
|||
return |
|||
} |
|||
roleErr := global.GVA_DB_Performanceappraisal.Where("qe_id = ?", requestData.Id).Delete(&assessmentmodel.QualitativeEvaluation{}).Error |
|||
if roleErr != nil { |
|||
response.Result(102, err, "删除失败!", c) |
|||
return |
|||
} else { |
|||
var judgeNum int64 |
|||
delGormDb := global.GVA_DB_Performanceappraisal |
|||
delGormDb = delGormDb.Model(&assessmentmodel.QualitativeEvaluation{}).Where("`qe_group` = ? AND `qe_accept_evaluation` = ? AND `qe_dimension` = ? AND `qe_type` = ?", oldCont.Group, oldCont.AcceptEvaluation, oldCont.Dimension, oldCont.Type) |
|||
if oldCont.Type == 1 { |
|||
delGormDb = delGormDb.Where("`qe_target` = ? AND `qe_target_sun` = ? ", oldCont.Target, oldCont.TargetSun) |
|||
} |
|||
judgeErr := delGormDb.Pluck("COALESCE(COUNT(qe_id), 0) as countid", &judgeNum).Error |
|||
if judgeErr == nil && judgeNum == 0 && oldCont.Type == 1 { |
|||
delDimErr := global.GVA_DB_Performanceappraisal.Where("`ddw_type` = 1 AND `ddw_hierarchy` = 2 AND `ddw_group` = ? AND `ddw_derpatment` = ? AND `ddw_dimension` = ? AND `ddw_target` = ?", oldCont.Group, oldCont.AcceptEvaluation, oldCont.Dimension, oldCont.Target).Delete(&assessmentmodel.DepartmentDimensionWeight{}).Error |
|||
if delDimErr == nil { |
|||
} |
|||
} |
|||
response.Result(0, err, "删除成功!", c) |
|||
} |
|||
} |
|||
|
|||
//修改考核方案单条考核细则
|
|||
func (d *DutyHandle) EiteOneQualitativeEvaluation(c *gin.Context) { |
|||
var requestData EiteOneQualEval |
|||
err := c.ShouldBindJSON(&requestData) |
|||
if err != nil { |
|||
response.Result(101, err, "数据获取失败!", c) |
|||
return |
|||
} |
|||
if requestData.Id == 0 && requestData.OutId == "" { |
|||
response.Result(102, err, "参数错误!请重新提交!", c) |
|||
return |
|||
} |
|||
if requestData.OutId != "" { |
|||
idInt, inIntErr := strconv.ParseInt(requestData.OutId, 10, 64) |
|||
if inIntErr == nil { |
|||
requestData.Id = idInt |
|||
} |
|||
} |
|||
saveData := commonus.MapOut() |
|||
saveData["qe_eitetime"] = time.Now().Unix() |
|||
if requestData.Unit != "" { |
|||
saveData["qe_unit"] = requestData.Unit |
|||
} |
|||
if requestData.ReferenceScore != 0 { |
|||
saveData["qe_reference_score"] = requestData.ReferenceScore |
|||
} |
|||
if requestData.Cycles != 0 { |
|||
saveData["qe_cycle"] = requestData.Cycles |
|||
} |
|||
if requestData.CycleAttres != 0 { |
|||
saveData["qe_cycleattr"] = requestData.CycleAttres |
|||
} |
|||
if requestData.State != 0 { |
|||
saveData["qe_state"] = requestData.State |
|||
} |
|||
if requestData.Content != "" { |
|||
saveData["qe_content"] = requestData.Content |
|||
} |
|||
if len(requestData.Operator) > 0 { |
|||
saveData["qe_operator"] = strings.Join(requestData.Operator, ",") |
|||
saveData["qe_department_id"] = strings.Join(GetDepartmentByUserBast(requestData.Operator), ",") |
|||
} |
|||
roleIsTrue, roleErr := eiteOneQuaEvaInfo(requestData.Id, saveData) |
|||
if roleIsTrue != true { |
|||
response.Result(106, roleErr, "编辑失败!", c) |
|||
} else { |
|||
response.Result(0, saveData, "编辑成功!", c) |
|||
} |
|||
} |
|||
|
|||
//编辑职务数据处理
|
|||
func eiteOneQuaEvaInfo(saveId int64, saveData map[string]interface{}) (isTrue bool, infoErr error) { |
|||
isTrue = false |
|||
infoErr = global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Where("`qe_id` = ?", saveId).Updates(saveData).Error |
|||
if infoErr != nil { |
|||
return |
|||
} |
|||
isTrue = true |
|||
return |
|||
} |
|||
|
|||
//获取定性考核指标对应的结构树
|
|||
func (d *DutyHandle) QualEvalTargetTree(c *gin.Context) { |
|||
var requestData QualEvalTargetTreeDies |
|||
err := c.ShouldBindJSON(&requestData) |
|||
if err != nil { |
|||
response.Result(101, err, "数据获取失败!", c) |
|||
return |
|||
} |
|||
if requestData.Group == "" { |
|||
response.Result(102, err, "数据获取失败!", c) |
|||
return |
|||
} |
|||
if requestData.DepartmentId == "" { |
|||
response.Result(103, err, "数据获取失败!", c) |
|||
return |
|||
} |
|||
if requestData.Dimension == "" { |
|||
response.Result(104, err, "数据获取失败!", c) |
|||
return |
|||
} |
|||
if requestData.Target == "" { |
|||
response.Result(105, err, "数据获取失败!", c) |
|||
return |
|||
} |
|||
|
|||
var qualitativeEvaluationAry []assessmentmodel.QualitativeEvaluation |
|||
gormDb := global.GVA_DB_Performanceappraisal |
|||
|
|||
gormDb = gormDb.Where("`qe_group` = ?", requestData.Group) |
|||
gormDb = gormDb.Where("`qe_accept_evaluation` = ?", requestData.DepartmentId) |
|||
gormDb = gormDb.Where("`qe_dimension` = ?", requestData.Dimension) |
|||
gormDb = gormDb.Where("`qe_target` = ?", requestData.Target) |
|||
listTargetErr := gormDb.Order("qe_type asc,qe_group asc,qe_accept_evaluation asc,qe_dimension asc,qe_target asc,qe_target_sun asc").Find(&qualitativeEvaluationAry).Error |
|||
|
|||
if listTargetErr != nil || len(qualitativeEvaluationAry) < 1 { |
|||
response.Result(101, listTargetErr, "没有数据!", c) |
|||
return |
|||
} |
|||
var uotContAry []TargetContOutCont |
|||
for _, v := range qualitativeEvaluationAry { |
|||
var uotCont TargetContOutCont |
|||
uotCont.Id = strconv.FormatInt(v.Id, 10) |
|||
uotCont.Type = v.Type |
|||
uotCont.Group = strconv.FormatInt(v.Group, 10) |
|||
groupErr, groupCont := commonus.GetGroupCont(v.Group) |
|||
if groupErr == true { |
|||
uotCont.GroupNAme = groupCont.Name |
|||
} |
|||
uotCont.DepartmentId = strconv.FormatInt(v.AcceptEvaluation, 10) |
|||
deparConErr, deparConCont := commonus.GetBranchFactory(v.AcceptEvaluation) |
|||
if deparConErr == true { |
|||
uotCont.DepartmentName = deparConCont.Name |
|||
} |
|||
uotCont.Dimension = strconv.FormatInt(v.Dimension, 10) |
|||
dutyClassCont, dutyClassErr := commonus.GetDutyClassInfo(v.Dimension) |
|||
if dutyClassErr == true { |
|||
uotCont.DimensionName = dutyClassCont.Title |
|||
} |
|||
uotCont.Target = strconv.FormatInt(v.Target, 10) |
|||
targetInfo, targetErr := commonus.GetTargetInfo(v.Target) |
|||
if targetErr == true { |
|||
uotCont.TargetName = targetInfo.Title |
|||
} |
|||
uotCont.TargetSun = strconv.FormatInt(v.TargetSun, 10) |
|||
info, infoErr := commonus.GetQualitativeTargetInfo(v.TargetSun) |
|||
if infoErr == true { |
|||
uotCont.TargetSunName = info.Title |
|||
} |
|||
uotCont.DetailedTarget = strconv.FormatInt(v.DetailedTarget, 10) |
|||
dtCont, dtIsTrue := commonus.GetDetailedTargetInfo(v.DetailedTarget) |
|||
if dtIsTrue == true { |
|||
uotCont.DetailedTargetName = dtCont.Title |
|||
uotCont.Content = dtCont.Content |
|||
} |
|||
uotCont.Unit = v.Unit |
|||
uotCont.ReferenceScore = v.ReferenceScore |
|||
uotCont.Cycles = v.Cycles |
|||
uotCont.CycleAttres = v.CycleAttres |
|||
uotCont.State = v.State |
|||
userAry := strings.Split(v.Operator, ",") |
|||
uotCont.UserList = userAry |
|||
for _, u_v := range userAry { |
|||
usCont, usErr := archiveapi.GetUserInfo([]string{"worker_man.wm_number", "worker_man_data.wmd_name"}, map[string]interface{}{"wm_key": u_v}) |
|||
if usErr == true { |
|||
var userCont QualEvalArrt |
|||
userCont.Id = u_v |
|||
userCont.Name = usCont.Name |
|||
uotCont.UserListAry = append(uotCont.UserListAry, userCont) |
|||
} |
|||
} |
|||
|
|||
uotCont.DetailedTarget = strconv.FormatInt(v.DetailedTarget, 10) |
|||
uotContAry = append(uotContAry, uotCont) |
|||
} |
|||
response.Result(0, uotContAry, "数据获取成功!", c) |
|||
} |
|||
|
|||
//部门考核(新)
|
|||
func (d *DutyHandle) DepartmentListNew(c *gin.Context) { |
|||
var requestData rationSelect |
|||
c.ShouldBindJSON(&requestData) |
|||
//获取维度列表
|
|||
var dutyClassAry []assessmentmodel.DutyClass |
|||
gromDb := global.GVA_DB_Performanceappraisal |
|||
gromDb = gromDb.Where("`state` = 1") |
|||
classErr := gromDb.Find(&dutyClassAry).Error |
|||
|
|||
if classErr != nil { |
|||
response.Result(0, classErr, "未获取到数据", c) |
|||
return |
|||
} |
|||
|
|||
var departAryList []departmentDutyNew |
|||
for _, v := range dutyClassAry { |
|||
childList := GetEvalTarget(v.Id, requestData.Group, requestData.DepartmentId) |
|||
if len(childList) > 0 { |
|||
var departCont departmentDutyNew |
|||
departCont.Id = strconv.FormatInt(v.Id, 10) |
|||
departCont.Name = v.Title |
|||
departCont.Child = GetEvalTarget(v.Id, requestData.Group, requestData.DepartmentId) |
|||
departAryList = append(departAryList, departCont) |
|||
} |
|||
} |
|||
response.Result(0, departAryList, "数据获取成功!", c) |
|||
} |
|||
|
|||
//获取考核指标
|
|||
func GetEvalTarget(dimId int64, group, departId string) (dimensionAry []taskDetailsLinkage) { |
|||
var contAry []assessmentmodel.EvaluationTarget |
|||
gormDb := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.EvaluationTarget{}).Where("et_state = 1 AND `et_dimension` = ?", dimId) |
|||
if departId != "" { |
|||
sqlOrStr := fmt.Sprintf("FIND_IN_SET(%v,`et_relevant_departments`)", departId) |
|||
sqlOrStr = fmt.Sprintf("`et_share` = 1 OR (`et_share` = 2 AND (%v))", sqlOrStr) |
|||
gormDb = gormDb.Where(sqlOrStr) |
|||
} |
|||
listErr := gormDb.Find(&contAry).Error |
|||
if listErr != nil { |
|||
return |
|||
} |
|||
for _, v := range contAry { |
|||
var dimCont taskDetailsLinkage |
|||
dimCont.Id = strconv.FormatInt(v.Id, 10) |
|||
dimCont.Name = v.Title |
|||
dimCont.Content = "" |
|||
scoreVal := GetDepartDimTargetScore(group, departId, dimId, v.Id) |
|||
dimCont.ReferenceScore = scoreVal |
|||
if scoreVal > 0 { |
|||
dimCont.IsTrue = 2 |
|||
} else { |
|||
dimCont.IsTrue = 1 |
|||
} |
|||
dimCont.Unit = v.Uniteing |
|||
dimCont.Cycles = v.Cycles |
|||
dimCont.CycleAttres = v.CycleAttres |
|||
dimensionAry = append(dimensionAry, dimCont) |
|||
} |
|||
return |
|||
} |
|||
|
|||
//计算该指定部门维度指标下的分值
|
|||
func GetDepartDimTargetScore(group, depert string, dimeid, targetid int64) (scoreAll int64) { |
|||
|
|||
err := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Where("`qe_group` = ? AND `qe_accept_evaluation` = ? AND `qe_dimension` = ? AND `qe_target` = ? AND qe_state = 1", group, depert, dimeid, targetid).Pluck("COALESCE(SUM(qe_reference_score), 0) as rescore", &scoreAll).Error |
|||
if err != nil { |
|||
scoreAll = 0 |
|||
} |
|||
return |
|||
} |
|||
|
|||
//部门添加考核方案NEw
|
|||
func (d *DutyHandle) AddDepartmentDutyInfo(c *gin.Context) { |
|||
var requestData AddDutyNewContGroup |
|||
err := c.ShouldBindJSON(&requestData) |
|||
if err != nil { |
|||
response.Result(101, err, "数据获取失败!", c) |
|||
return |
|||
} |
|||
if requestData.Group == "" { |
|||
response.Result(102, err, "数据获取失败!", c) |
|||
return |
|||
} |
|||
groupId, groupErr := strconv.ParseInt(requestData.Group, 10, 64) |
|||
if groupErr == nil { |
|||
groupId = 0 |
|||
} |
|||
if requestData.DepartmentId == "" { |
|||
response.Result(103, err, "数据获取失败!", c) |
|||
return |
|||
} |
|||
departId, departErr := strconv.ParseInt(requestData.DepartmentId, 10, 64) |
|||
if departErr != nil { |
|||
departId = 0 |
|||
} |
|||
if len(requestData.Child) < 0 { |
|||
response.Result(104, err, "没有要添加的数据", c) |
|||
return |
|||
} |
|||
var saveDataAry []assessmentmodel.QualitativeEvaluation |
|||
fmt.Printf("1----------------------------->\n") |
|||
for _, v := range requestData.Child { //维度
|
|||
for _, v_s := range v.Child { //指标
|
|||
if v_s.Status == 1 { |
|||
var saveData assessmentmodel.QualitativeEvaluation |
|||
//指标ID
|
|||
targetId, targetErr := strconv.ParseInt(v_s.Id, 10, 64) |
|||
if targetErr == nil { |
|||
fmt.Printf("2----------------------------->\n") |
|||
//获取指标内容
|
|||
evalTarCont, evalTarContErr := commonus.GetTargetInfo(targetId) |
|||
if evalTarContErr == true { |
|||
fmt.Printf("3----------------------------->\n") |
|||
if evalTarCont.Type == 2 { |
|||
fmt.Printf("4----------------------------->\n") |
|||
saveData.Target = targetId |
|||
saveData.Operator = evalTarCont.Report |
|||
if evalTarCont.Report != "" { |
|||
var departAry []string |
|||
userKeyAry := strings.Split(evalTarCont.Report, ",") |
|||
if len(userKeyAry) > 0 { |
|||
for _, u_v := range userKeyAry { |
|||
usCont, usErr := archiveapi.GetUserInfo([]string{"worker_man.wm_bf_id"}, map[string]interface{}{"wm_key": u_v}) |
|||
if usErr == true { |
|||
departAry = append(departAry, strconv.FormatInt(usCont.DepartmentId, 10)) |
|||
} |
|||
} |
|||
} |
|||
saveData.DepartmentId = strings.Join(departAry, ",") |
|||
} |
|||
//维度ID
|
|||
dimId, dimErr := strconv.ParseInt(v.Id, 10, 64) |
|||
if dimErr == nil { |
|||
saveData.Dimension = dimId |
|||
} |
|||
saveData.Type = evalTarCont.Type |
|||
saveData.Unit = v_s.Unit |
|||
saveData.ReferenceScore = v_s.ReferenceScore |
|||
saveData.State = 1 |
|||
saveData.Addtime = time.Now().Unix() |
|||
saveData.Eitetime = time.Now().Unix() |
|||
|
|||
saveData.Group = groupId //departId
|
|||
saveData.Cycles = v_s.Cycles |
|||
saveData.CycleAttres = v_s.CycleAttres |
|||
saveData.AcceptEvaluation = departId |
|||
saveData.Content = v_s.Content |
|||
saveDataAry = append(saveDataAry, saveData) |
|||
} else { |
|||
fmt.Printf("5----------------------------->\n") |
|||
//获取子栏目列表
|
|||
var sunTarget []assessmentmodel.QualitativeTarget |
|||
sunErr := global.GVA_DB_Performanceappraisal.Where("q_parent_id = ?", targetId).Find(&sunTarget).Error |
|||
if sunErr == nil && len(sunTarget) > 0 { |
|||
fmt.Printf("6----------------------------->\n") |
|||
for _, s_d_v := range sunTarget { |
|||
fmt.Printf("7----------------------------->\n") |
|||
var detaTarget []assessmentmodel.DetailedTarget |
|||
detaiErr := global.GVA_DB_Performanceappraisal.Where("dt_parentid = ? AND dt_parentid_sun = ?", targetId, s_d_v.Id).Find(&detaTarget).Error |
|||
if detaiErr == nil && len(detaTarget) > 0 { |
|||
fmt.Printf("8----------------------------->\n") |
|||
for _, s_t_v := range detaTarget { |
|||
fmt.Printf("9----------------------------->\n") |
|||
saveData.Target = targetId |
|||
saveData.Operator = evalTarCont.Report |
|||
if evalTarCont.Report != "" { |
|||
var departAry []string |
|||
userKeyAry := strings.Split(evalTarCont.Report, ",") |
|||
if len(userKeyAry) > 0 { |
|||
for _, u_v := range userKeyAry { |
|||
usCont, usErr := archiveapi.GetUserInfo([]string{"worker_man.wm_bf_id"}, map[string]interface{}{"wm_key": u_v}) |
|||
if usErr == true { |
|||
departAry = append(departAry, strconv.FormatInt(usCont.DepartmentId, 10)) |
|||
} |
|||
} |
|||
} |
|||
saveData.DepartmentId = strings.Join(departAry, ",") |
|||
} |
|||
//维度ID
|
|||
dimId, dimErr := strconv.ParseInt(v.Id, 10, 64) |
|||
if dimErr == nil { |
|||
saveData.Dimension = dimId |
|||
} |
|||
saveData.Type = evalTarCont.Type |
|||
saveData.DetailedTarget = s_t_v.Id |
|||
saveData.Unit = v_s.Unit |
|||
saveData.ReferenceScore = v_s.ReferenceScore |
|||
saveData.State = 1 |
|||
saveData.Addtime = time.Now().Unix() |
|||
saveData.Eitetime = time.Now().Unix() |
|||
|
|||
saveData.Group = groupId //departId
|
|||
saveData.Cycles = v_s.Cycles |
|||
saveData.CycleAttres = v_s.CycleAttres |
|||
saveData.AcceptEvaluation = departId |
|||
saveData.Content = v_s.Content |
|||
saveDataAry = append(saveDataAry, saveData) |
|||
} |
|||
} |
|||
} |
|||
} else { |
|||
fmt.Printf("10----------------------------->\n") |
|||
var detaTarget []assessmentmodel.DetailedTarget |
|||
detaiErr := global.GVA_DB_Performanceappraisal.Where("dt_parentid = ? AND dt_parentid_sun = 0", targetId).Find(&detaTarget).Error |
|||
if detaiErr == nil && len(detaTarget) > 0 { |
|||
fmt.Printf("12----------------------------->\n") |
|||
for _, s_t_v := range detaTarget { |
|||
fmt.Printf("13----------------------------->\n") |
|||
saveData.Target = targetId |
|||
saveData.Operator = evalTarCont.Report |
|||
if evalTarCont.Report != "" { |
|||
var departAry []string |
|||
userKeyAry := strings.Split(evalTarCont.Report, ",") |
|||
if len(userKeyAry) > 0 { |
|||
for _, u_v := range userKeyAry { |
|||
usCont, usErr := archiveapi.GetUserInfo([]string{"worker_man.wm_bf_id"}, map[string]interface{}{"wm_key": u_v}) |
|||
if usErr == true { |
|||
departAry = append(departAry, strconv.FormatInt(usCont.DepartmentId, 10)) |
|||
} |
|||
} |
|||
} |
|||
saveData.DepartmentId = strings.Join(departAry, ",") |
|||
} |
|||
//维度ID
|
|||
dimId, dimErr := strconv.ParseInt(v.Id, 10, 64) |
|||
if dimErr == nil { |
|||
saveData.Dimension = dimId |
|||
} |
|||
saveData.Type = evalTarCont.Type |
|||
saveData.DetailedTarget = s_t_v.Id |
|||
saveData.Unit = v_s.Unit |
|||
saveData.ReferenceScore = v_s.ReferenceScore |
|||
saveData.State = 1 |
|||
saveData.Addtime = time.Now().Unix() |
|||
saveData.Eitetime = time.Now().Unix() |
|||
|
|||
saveData.Group = groupId //departId
|
|||
saveData.Cycles = v_s.Cycles |
|||
saveData.CycleAttres = v_s.CycleAttres |
|||
saveData.AcceptEvaluation = departId |
|||
saveData.Content = v_s.Content |
|||
saveDataAry = append(saveDataAry, saveData) |
|||
} |
|||
|
|||
} |
|||
} |
|||
} |
|||
|
|||
} |
|||
} |
|||
|
|||
} |
|||
} |
|||
} |
|||
if len(saveDataAry) <= 0 { |
|||
response.Result(105, saveDataAry, "没有要添加的数据", c) |
|||
return |
|||
} |
|||
addErr := global.GVA_DB_Performanceappraisal.Create(&saveDataAry).Error |
|||
if addErr != nil { |
|||
response.Result(106, len(saveDataAry), "数据添加失败", c) |
|||
return |
|||
} |
|||
if departId != 0 { |
|||
|
|||
} |
|||
response.Result(0, saveDataAry, "数据添加成功", c) |
|||
} |
|||
Loading…
Reference in new issue