作者 yangfu

修改 提交筛选结果

... ... @@ -25,7 +25,7 @@ func SiftingPool(header *protocol.RequestHeader, request *protocol.SiftingPoolRe
if request.Uid != 0 {
header.UserId = request.Uid
}
if rsp.Total, err = models.GetSiftingChance(header.UserId, request.SubmitStatus, protocol.Waiting, request.Offset(), request.PageSize, &ormItems); err != nil {
if rsp.Total, err = models.GetSiftingChance(header.UserId, request.SubmitStatus, protocol.None, request.Offset(), request.PageSize, &ormItems); err != nil {
if err == orm.ErrNoRows {
err = nil
return
... ... @@ -104,6 +104,10 @@ func SubmitChecks(header *protocol.RequestHeader, request *protocol.SubmitChecks
log.Error(err)
return
}
if _, result := CheckIsCommitAllCheck(request.ChanceId); result {
err = protocol.NewCustomMessage(1, "所有人均已提交,不允许修改自查内容")
return
}
if p, err = models.GetAuditorLatestAuditFlowProcess(request.ChanceId, header.UserId); err != nil {
log.Error(request.ChanceId, header.UserId, err)
if err == orm.ErrNoRows {
... ... @@ -173,6 +177,10 @@ func SubmitChecks(header *protocol.RequestHeader, request *protocol.SubmitChecks
}
func NewChanceCheckResult(c protocol.SelfCheck, chanceId int64, uid int64) *models.ChanceCheckResult {
//不是否的时候 不需要理由
if c.Answer != protocol.OptionNo {
c.Reason = ""
}
return &models.ChanceCheckResult{
Id: idgen.Next(),
ChanceId: chanceId,
... ... @@ -221,7 +229,8 @@ type chanceCheckResultTotal struct {
func collectChanceCheckResultData(checkResultData []*models.ChanceCheckResult) protocol.SelfChecks {
checkResultMap := map[int]*chanceCheckResultTotal{}
checkResultSlice := []*chanceCheckResultTotal{}
for _, resultData := range checkResultData {
for i := range checkResultData {
resultData := checkResultData[i]
answerYes := 0
answerNo := 0
answerAny := 0
... ... @@ -269,29 +278,36 @@ func collectChanceCheckResultData(checkResultData []*models.ChanceCheckResult) p
dd := protocol.SelfCheck{
CheckItem: checkResultSlice[i].CheckItem,
GroupId: checkResultSlice[i].GroupId,
ParentId: checkResultSlice[i].CheckPid,
Id: checkResultSlice[i].CheckId,
ParentId: checkResultSlice[i].CheckPid,
}
if checkResultSlice[i].AnswerYes > 0 {
if checkResultSlice[i].AnswerNo > 0 {
dd.Answer = protocol.OptionNo
} else if checkResultSlice[i].AnswerNo > 0 {
}
if checkResultSlice[i].AnswerYes > 0 && checkResultSlice[i].AnswerNo == 0 && checkResultSlice[i].AnswerAny == 0 {
dd.Answer = protocol.OptionYes
} else if checkResultSlice[i].AnswerAny > 0 {
}
if checkResultSlice[i].AnswerNo == 0 && checkResultSlice[i].AnswerAny > 0 {
dd.Answer = protocol.OptionNoCertain
}
selfCheckData = append(selfCheckData, dd)
for _, child := range checkResultSlice[i].Child {
for j := range checkResultSlice[i].Child {
child := checkResultSlice[i].Child[j]
dd := protocol.SelfCheck{
CheckItem: child.CheckItem,
GroupId: child.GroupId,
ParentId: checkResultSlice[i].CheckPid,
Id: checkResultSlice[i].CheckId,
Id: child.CheckId,
ParentId: child.CheckPid,
}
if child.AnswerYes > 0 {
dd.Answer = protocol.OptionYes
} else if child.AnswerNo > 0 {
if child.AnswerNo > 0 {
dd.Answer = protocol.OptionNo
} else if child.AnswerAny > 0 {
}
if child.AnswerYes > 0 && child.AnswerNo == 0 && child.AnswerAny == 0 {
dd.Answer = protocol.OptionYes
}
if child.AnswerNo == 0 && child.AnswerAny > 0 {
dd.Answer = protocol.OptionNoCertain
}
selfCheckData = append(selfCheckData, dd)
... ...