Browse Source

修改审核接口

qin_1
超级管理员 4 years ago
parent
commit
af5d8eb39b
  1. 128
      gin_server_admin/api/index/assessment/assesshandle.go
  2. 25
      gin_server_admin/api/index/assessment/assesstype.go
  3. 9
      gin_server_admin/api/v1/examtestpage/healthreportstat.go
  4. 52
      gin_server_admin/commonus/publichaneld.go
  5. 9
      gin_server_admin/commonus/publicstruct.go
  6. 3
      gin_server_admin/commonus/weChatDateType.go
  7. 3
      gin_server_admin/commonus/wechatapp.go
  8. 2
      gin_server_admin/model/assessmentmodel/dutyclass.go
  9. 2
      gin_server_admin/model/locationing/reportAddress.go
  10. 1
      gin_server_admin/router/assessment/assessmentrouter.go
  11. 3
      gin_server_admin/utils/redishandel/myredis.go

128
gin_server_admin/api/index/assessment/assesshandle.go

@ -643,16 +643,21 @@ func (a *Assessment) DepartmentAssess(c *gin.Context) {
response.Result(105, err, "没有要考核的项目!", c)
return
}
var outCont departAssessOutType
var outContMap []departAssessOutType
// outMapList := []commonus.MapOut()
for _, val := range ContInfo {
var outCont departAssessOutType
outCont.Id = val.Id
outCont.Titles = val.Titles
outCont.Rescore = val.Rescore
outCont.IsTrue = JudgeResAssEssExam(val.Id, int64(requestData.DepartmentId), monthData)
outCont.OutID = strconv.FormatInt(val.Id, 10)
isTrue := JudgeResAssEssExam(val.Id, int64(requestData.DepartmentId), monthData)
outCont.IsTrue = isTrue
if isTrue == false {
outContMap = append(outContMap, outCont)
}
}
// JudgeResAssEssExam(val.DutyId, val.PartId, dataStr) .Where("(`dc_user_dump` = ? OR `dc_dump` = ?) AND `dc_state` = 1", userCont.Key, userCont.DepartmentId)
response.Result(0, outContMap, "查询成功!", c)
}
@ -760,6 +765,15 @@ func (a *Assessment) DepartmentAssessData(c *gin.Context) {
response.Result(115, reIndex, "考核项目加分大于参考分!请重新提交!", c)
return
}
if reData.DeductPoints > 0 && reData.DeductPointsText == "" {
response.Result(1114, reData.DutyId, "考核项目有扣分,必须填写扣分原因!", c)
return
}
if reData.ExtraPoints > 0 && reData.ExtraPointsText == "" {
response.Result(1115, reData.DutyId, "考核项目有加分,必须填写加分原因!", c)
return
}
}
var assessLog assessmentmodel.AssessmentLog //考核记录
// assessLog.Id = commonus.GetFileNumberEs()
@ -781,7 +795,7 @@ func (a *Assessment) DepartmentAssessData(c *gin.Context) {
response.Result(116, dutyCont.DutyId, "指定考核项目ID不正确!", c)
return
}
assIsTrue, assInfo := assessment.GetDutyInfoContAll(dutyId)
assIsTrue, assInfo := commonus.GetDutyContDepart(dutyId)
if assIsTrue != true {
response.Result(117, dutyCont.DutyId, "指定考核项目已禁止使用!", c)
return
@ -806,6 +820,8 @@ func (a *Assessment) DepartmentAssessData(c *gin.Context) {
dutyListCont.AddTime = time.Now().Unix()
dutyListCont.EiteTime = time.Now().Unix()
dutyListCont.State = 1
dutyListCont.DeductPointsText = dutyCont.DeductPointsText
dutyListCont.ExtraPointsText = dutyCont.ExtraPointsText
dutyListMap = append(dutyListMap, dutyListCont)
}
dutyList, dutyListErr := json.Marshal(dutyListMap)
@ -866,8 +882,10 @@ func (a *Assessment) LookDepartmentAssessInfo(c *gin.Context) {
response.Result(105, jsonErr, "审批详情异常,不可查看!请联系系统管理员排查故障!", c)
return
}
var lookSeeDutyContMap []LookSeeDutyCont
outList := commonus.MapOutint()
for index, val := range dutyListMap {
var lookSeeDutyCont LookSeeDutyCont
outInfo := commonus.MapOut()
outInfo["id"] = strconv.FormatInt(val.Id, 10)
outInfo["classID"] = strconv.FormatInt(val.ClassId, 10)
@ -878,21 +896,38 @@ func (a *Assessment) LookDepartmentAssessInfo(c *gin.Context) {
outInfo["score"] = strconv.FormatInt(val.Score, 10)
outInfo["departId"] = strconv.FormatInt(val.DepartId, 10)
outInfo["commentUser"] = strconv.FormatInt(val.CommentUser, 10)
dtyContErr, dtyCont := GetDutyInfoCont(val.DutyId)
lookSeeDutyCont.Id = strconv.FormatInt(val.Id, 10)
lookSeeDutyCont.ClassID = strconv.FormatInt(val.ClassId, 10)
lookSeeDutyCont.AssessId = strconv.FormatInt(val.AssessId, 10)
lookSeeDutyCont.DutyId = strconv.FormatInt(val.DutyId, 10)
lookSeeDutyCont.DeductPoints = strconv.FormatInt(val.DeductPoints, 10)
lookSeeDutyCont.ExtraPoints = strconv.FormatInt(val.ExtraPoints, 10)
lookSeeDutyCont.Score = strconv.FormatInt(val.Score, 10)
lookSeeDutyCont.DepartId = strconv.FormatInt(val.DepartId, 10)
lookSeeDutyCont.CommentUser = strconv.FormatInt(val.CommentUser, 10)
// dtyContErr, dtyCont := GetDutyInfoCont(val.DutyId)
dtyContErr, dtyCont := commonus.GetDutyContDepart(val.DutyId)
if dtyContErr == true {
outInfo["classTitle"] = dtyCont.ClassTitle
outInfo["assessTitle"] = dtyCont.AssessTitle
outInfo["dutyTitle"] = dtyCont.DutyTitle
outInfo["assessTitle"] = dtyCont.AssTitle
outInfo["dutyTitle"] = dtyCont.Title
lookSeeDutyCont.ClassTitle = dtyCont.ClassTitle
lookSeeDutyCont.AssessTitle = dtyCont.AssTitle
lookSeeDutyCont.DutyTitle = dtyCont.Title
} else {
outInfo["classTitle"] = ""
outInfo["assessTitle"] = ""
outInfo["dutyTitle"] = ""
}
outList[index] = outInfo
lookSeeDutyContMap = append(lookSeeDutyContMap, lookSeeDutyCont)
}
outContMap := commonus.MapOut()
outContMap["assessLog"] = assessLogCont
outContMap["dutyListMap"] = outList
outContMap["dutyListMap"] = lookSeeDutyContMap
response.Result(0, outContMap, "数据写入成功!", c)
}
@ -938,3 +973,82 @@ func (a *Assessment) LookOpenApprovalDataInfo(c *gin.Context) {
}
response.Result(0, jsonToOpenApprovalStruct, "查询成功!", c)
}
//查看本部门提交的和个人提交的审批
func (a *Assessment) LookPersonalOrDepartment(c *gin.Context) {
var requestData commonus.PageSetLimt
err := c.ShouldBindJSON(&requestData)
if err != nil {
// response.Result(101, err, "参数错误!请重新提交!", c)
// return
}
if requestData.PageSize == 0 {
requestData.PageSize = 20
}
if requestData.Page <= 0 {
requestData.Page = 1
}
offSetPage := commonus.CalculatePages(requestData.Page, requestData.PageSize)
isTrue, userInfo := commonus.ClientIdentity()
if isTrue != true {
response.Result(103, err, "您的身份令牌已经失效!请重新登录获取身份令牌!", c)
return
}
departmentID, departmentIDErr := strconv.ParseInt(userInfo.DepartmentId, 10, 64)
if departmentIDErr != nil {
response.Result(104, err, "参数错误!请重新提交!", c)
return
}
gormDb := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.AssessmentLog{})
maxErr, maxCont := commonus.GetPositionMaxWeight(departmentID)
// fmt.Printf("最大值:======>%v======>%v\n", maxErr, maxCont)
if maxErr == true {
postID, postIDErr := strconv.ParseInt(userInfo.PostId, 10, 64)
if postIDErr == nil {
if maxCont.Id == postID {
gormDb = gormDb.Where("`al_executor_depart` = ?", departmentID)
} else {
gormDb = gormDb.Where("`al_executor_user` = ?", userInfo.Key)
}
} else {
gormDb = gormDb.Where("`al_executor_user` = ?", userInfo.Key)
}
} else {
gormDb = gormDb.Where("`al_executor_user` = ?", userInfo.Key)
}
var total int64
totalErr := gormDb.Count(&total).Error
if totalErr != nil {
total = 0
}
var assessList []assessmentmodel.AssessmentLog
assessListerr := gormDb.Limit(requestData.PageSize).Offset(offSetPage).Order("al_id desc").Find(&assessList).Error
if assessListerr != nil {
response.Result(102, assessListerr, "数据获取失败!", c)
return
}
var personalOrDepartment []PersonalOrDepartment
for _, val := range assessList {
var personalOrDepartments PersonalOrDepartment
personalOrDepartments.Id = val.Id
personalOrDepartments.Title = val.Title
personalOrDepartments.Assdepart = val.Assdepart
personalOrDepartments.ExecutorUser = val.ExecutorUser
personalOrDepartments.ExecutorDepart = val.ExecutorDepart
personalOrDepartments.ExecutorTime = val.ExecutorTime
personalOrDepartments.OrderId = val.OrderId
personalOrDepartments.States = val.States
personalOrDepartments.AddTime = val.AddTime
personalOrDepartments.EiteTime = val.EiteTime
personalOrDepartments.DutyList = val.DutyList
bfIsTrue, bfCont := commonus.GetBranchFactory(int64(val.Assdepart))
if bfIsTrue == true {
personalOrDepartments.AssdepartTitle = bfCont.Name
}
personalOrDepartment = append(personalOrDepartment, personalOrDepartments)
}
countSum := len(personalOrDepartment)
printData := commonus.OutPutList(total, int64(countSum), requestData.Page, requestData.PageSize, personalOrDepartment)
response.Result(0, printData, "查询成功!", c)
}

25
gin_server_admin/api/index/assessment/assesstype.go

@ -184,6 +184,7 @@ type departAssessOutType struct {
UserDumps int64 `json:"userDumps" gorm:"column:dc_user_dump;type:bigint(20) unsigned;default:0;not null;comment:考核人执行人"`
Dumps int64 `json:"dumps" gorm:"column:dc_dump;type:bigint(20) unsigned;default:0;not null;comment:考核执行部门"`
IsTrue bool `json:"istrue"`
OutID string `json:"outid"`
}
//以部门为单位提报数据
@ -203,6 +204,8 @@ type DutyListType struct {
DeductPoints int `json:"deductpoints"` //扣分
ExtraPoints int `json:"extrapoints"` //加分
ReferenceScore int `json:"referencescore"` //参考分
DeductPointsText string `json:"deductpointstext"` //扣分
ExtraPointsText string `json:"extrapointstext"` //加分
}
//查看提交审批的详细内容
@ -263,3 +266,25 @@ type NotifyNodeType struct {
ItemImage string `json:"ItemImage"`
ItemUserId string `json:"ItemUserId"`
}
//查看本部门提交的和个人提交的审批
type PersonalOrDepartment struct {
assessmentmodel.AssessmentLog
AssdepartTitle string `json:"assdeparttitle"` //被考核部门
}
//查看审批考核详细
type LookSeeDutyCont struct {
Id string `json:"id"`
ClassID string `json:"classID"`
AssessId string `json:"assessId"`
DutyId string `json:"dutyId"`
DeductPoints string `json:"deductPoints"`
ExtraPoints string `json:"extraPoints"`
Score string `json:"score"`
DepartId string `json:"departId"`
CommentUser string `json:"commentUser"`
ClassTitle string `json:"classTitle"`
AssessTitle string `json:"assessTitle"`
DutyTitle string `json:"dutyTitle"`
}

9
gin_server_admin/api/v1/examtestpage/healthreportstat.go

@ -395,12 +395,19 @@ func (d *dataLockStatistics) getUserAnswerList(jobid, tadayTime, calCulTime stri
writeInfoUser.Userid = v.Userid
writeInfoUser.AddTime = time.Now().Unix()
writeInfoUser.Address = v_sun.Text
writeInfoUser.ItineraryCardType = v_sun.ItineraryCardType
writeInfoUser.HighRiskArea = v_sun.HighRiskArea
AdmDivMap["itinerary_card_type"] = v_sun.ItineraryCardType
AdmDivMap["high_risk_area"] = v_sun.HighRiskArea
AdmDivMap["riskLevel"] = 0
writeInfoUser.RiskLevel = 0
writeInfoUser.CalCulTime = commonus.DateToTimeStamp(calCulTime)
// fmt.Printf("时间值-----》%v @@@@@@@@@@@@@@@@@@@@ %v", calCulTime, commonus.DateToTimeStamp(calCulTime))
// fmt.Printf("时间值-----》%v @@@@@@@@@@@@@@@@@@@@ %v\n\n", v_sun.ItineraryCardType, v_sun)
AdmDiv.Userid = v.Userid
AdmDiv.Province = countSplit[0] + "省"

52
gin_server_admin/commonus/publichaneld.go

@ -10,6 +10,7 @@ import (
"time"
"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/location"
"github.com/flipped-aurora/gin-vue-admin/server/model/systemuser"
"github.com/flipped-aurora/gin-vue-admin/server/model/testpage"
@ -900,4 +901,53 @@ func GetTeaming(id int64) (isTrue bool, content testpage.Teaming) {
return
}
//
//获取职务最大权重ID
func GetPositionMaxWeight(departmentID int64) (isTrue bool, content testpage.Position) {
isTrue = false
selectData := MapOut()
err := global.GVA_DB_Master.Model(&testpage.Position{}).Select("MAX(ps_weight) AS weight").Where("ps_bf_id = ?", departmentID).First(&selectData).Error
if err != nil {
return
}
conErr := global.GVA_DB_Master.Where("ps_bf_id = ? AND ps_weight = ?", departmentID, selectData["weight"]).First(&content).Error
if conErr == nil {
isTrue = true
}
return
}
//获取职责内容
func GetDutyContDepart(id int64) (isTrue bool, dutyAssClass DutyAssClass) {
isTrue = false
var dutyCont assessmentmodel.DepartDuty
err := global.GVA_DB_Performanceappraisal.Where("de_id = ?", id).First(&dutyCont).Error
if err != nil {
return
}
if dutyCont.State != 1 {
return
}
var dutyConts assessmentmodel.DutyContent
errCont := global.GVA_DB_Performanceappraisal.Where("dc_id = ?", dutyCont.DutyId).First(&dutyConts).Error
if errCont != nil {
return
}
if dutyConts.State != 1 {
return
}
dutyAssClass.Title = dutyConts.Title
dutyAssClass.ClassId = dutyCont.ClassId
dutyAssClass.AssessId = dutyCont.AssessId
var dutyClass assessmentmodel.DutyClass
errClass := global.GVA_DB_Performanceappraisal.Where("id = ?", dutyCont.ClassId).First(&dutyClass).Error
if errClass == nil {
dutyAssClass.ClassTitle = dutyClass.Title
}
var dutyassess assessmentmodel.AssessMentitems
errAss := global.GVA_DB_Performanceappraisal.Where("ai_id = ?", dutyCont.AssessId).First(&dutyassess).Error
if errAss == nil {
dutyAssClass.AssTitle = dutyassess.Title
}
isTrue = true
return
}

9
gin_server_admin/commonus/publicstruct.go

@ -53,3 +53,12 @@ type PublicUserCont struct {
Icon string `json:"icon"` //照片"`
NickName string `json:"nickName"` //昵称"`
}
//具体职责项与考核项目,类别
type DutyAssClass struct {
Title string `json:"title"` //具体职责
ClassId int64 `json:"partId"` //考核类别
ClassTitle string `json:"asstitle"` //考核类名称
AssessId int64 `json:"assessId"` //考核项目
AssTitle string `json:"asstitle"` //考核项目名称
}

3
gin_server_admin/commonus/weChatDateType.go

@ -155,6 +155,9 @@ type ReportValuesStruct struct {
Text string `json:"text"`
MultiChoice []int `json:"multi_choice"`
Fileid []string `json:"fileid"`
Url string `json:"url"`
ItineraryCardType int `json:"itinerary_card_type"`
HighRiskArea string `json:"high_risk_area"`
}
//行政区域

3
gin_server_admin/commonus/wechatapp.go

@ -32,6 +32,7 @@ func GetWechatTokenType(types string) (tokenInfo string, redisClient *redishande
// fmt.Printf("token=====>%v***************%v------------------%v\n", redisPrefix, global.GVA_CONFIG.RedisPrefix.Alias, global.GVA_REDIS)
// return
isTrue, tokenInfo = redisClient.Get(redisPrefix + global.GVA_CONFIG.RedisPrefix.Alias)
// fmt.Printf("token=====>%v***************%v------------------%v\n", isTrue, companyId, secretStr)
if isTrue == true {
return
} else {
@ -580,7 +581,7 @@ func GetUserWriteAnswer(jobid, date string, page int, pageSize int64) (btyDate [
}
addDePartMent := CurlPostJosn(getWechatApiUrl, sendJsonData)
btyDate = addDePartMent
// fmt.Printf("结果---->%v\n", string(addDePartMent))
// fmt.Printf("结果---->%v\n", string(sendJsonData))
var reportAnswerJson ReportAnswerResult
err = json.Unmarshal(addDePartMent, &reportAnswerJson)
r = &reportAnswerJson

2
gin_server_admin/model/assessmentmodel/dutyclass.go

@ -113,6 +113,8 @@ type Departscores struct {
AddTime int64 `json:"addTime" gorm:"column:s_add_time;type:bigint(20) unsigned;default:0;not null;comment:添加时间"`
EiteTime int64 `json:"eiteTime" gorm:"column:s_eite_time;type:bigint(20) unsigned;default:0;not null;comment:编辑时间"`
State int `json:"state" gorm:"column:s_state;type:tinyint(1) unsigned;default:1;not null;comment:状态"`
DeductPointsText string `json:"deductPoints" gorm:"column:s_deduct_text;type:text;comment:扣分说明"`
ExtraPointsText string `json:"extraPoints" gorm:"column:s_extra_text;type:text;comment:加分说明"`
}
func (Departscores *Departscores) TableName() string {

2
gin_server_admin/model/locationing/reportAddress.go

@ -18,6 +18,8 @@ type ReportAddress struct {
GroupName string `json:"groupName" gorm:"column:group_name;type:varchar(255);comment:集团名称"` //'集团名称',
GroupId int64 `json:"groupId" gorm:"column:group_id;type:bigint(20) unsigned;default:1;not null;comment:集团id"` //'集团id',
RiskLevel int `json:"riskLevel" gorm:"column:risk_level;type:int(3) unsigned;default:0;not null;comment:风险等级"` //'风险等级',
ItineraryCardType int `json:"itinerary_card_type" gorm:"column:itinerary_card_type;type:int(2) unsigned;default:0;not null;comment:行程卡类型,仅行程卡类型的问题会返回该字段,0:行程码状态识别失败、1:绿码、2:红码、3:黄码、4:橙码、5:未识别出行程卡"`
HighRiskArea string `json:"high_risk_area" gorm:"column:high_risk_area;type:text unsigned;default:0;not null;comment:高风险行程信息,仅行程卡类型的问题会返回该字段"`
}
func (ReportAddress *ReportAddress) TableName() string {

1
gin_server_admin/router/assessment/assessmentrouter.go

@ -62,6 +62,7 @@ func (s *AssessmentRouter) InitDutyHandelRouter(Router *gin.RouterGroup) {
dutyIndexCodeRouter.POST("getdeparttimeassess", authorityIndexApi.GetDepartTimeAssess) //根据部门和时间获取考核详情
dutyIndexCodeRouter.POST("departmentassess", authorityIndexApi.DepartmentAssess) //根据部门和时间获取考核详情
dutyIndexCodeRouter.POST("departmentassessdata", authorityIndexApi.DepartmentAssessData) //根据部门和时间写入全部考核项分值
dutyIndexCodeRouter.POST("lookpersonalordepartment", authorityIndexApi.LookPersonalOrDepartment) //查看本部门提交的和个人提交的审批
dutyIndexCodeRouter.POST("lookopenapprovaldatainfo", authorityIndexApi.LookOpenApprovalDataInfo) //查询审批状态
}

3
gin_server_admin/utils/redishandel/myredis.go

@ -2,7 +2,6 @@ package redishandel
import (
"context"
"fmt"
"time"
"github.com/flipped-aurora/gin-vue-admin/server/global"
@ -118,7 +117,7 @@ func (r *RedisStoreType) HashSet(hashName, hashKey, hashVal string) bool {
func (r *RedisStoreType) HashMsetAdd(hashName string, hashVal map[string]interface{}) bool {
// rdb := RedisInit()
err := r.RedisDb.HMSet(r.Context, r.PreKey+hashName, hashVal).Err()
fmt.Printf("错误sss=========》%v=====2====》%v\n", err, hashVal)
// fmt.Printf("错误sss=========》%v=====2====》%v\n", err, hashVal)
// err := rdb.HMSet(ctx, "userfg", hashVal).Err()
if err != nil {
return false

Loading…
Cancel
Save