|
@@ -241,16 +241,34 @@ func (problemInfoApi *ProblemInfoApi) UpdateProblemInfoStatus(c *gin.Context) {
|
|
problemInfoNow.Status = problemInfo.Status
|
|
problemInfoNow.Status = problemInfo.Status
|
|
problemInfoNow.Audit = problemInfo.Audit
|
|
problemInfoNow.Audit = problemInfo.Audit
|
|
if problemInfo.Status == "Success" {
|
|
if problemInfo.Status == "Success" {
|
|
- if time.Now().Before(problemInfoNow.HandAt) {
|
|
|
|
|
|
+ if time.Now().Unix() > problemInfoNow.HandAt.Unix() {
|
|
//超时扣分
|
|
//超时扣分
|
|
- //todo 扣站点分数
|
|
|
|
-
|
|
|
|
- //todo 扣单位分数
|
|
|
|
- _, unit := unitService.GetUnit(uint(*problemInfo.UnitId))
|
|
|
|
- oldIntegral := *unit.UnitIntegral
|
|
|
|
- nowIntegral := oldIntegral - *problemInfoNow.Integral
|
|
|
|
- unit.UnitIntegral = &nowIntegral
|
|
|
|
- unitService.UpdateUnitA(unit)
|
|
|
|
|
|
+ probIds := strings.Split(problemInfoNow.Matter, "|")
|
|
|
|
+ //问题关联的部门
|
|
|
|
+ unitIds := strings.Split(problemInfoNow.Department, "|")
|
|
|
|
+ if err, probTypes := problemTypeService.GetProblemTypeIds(probIds); err == nil {
|
|
|
|
+ //扣部门分数
|
|
|
|
+ for _, unitId := range unitIds {
|
|
|
|
+ if unitId == "" {
|
|
|
|
+ continue
|
|
|
|
+ }
|
|
|
|
+ integral := 0
|
|
|
|
+ for _, probType := range probTypes {
|
|
|
|
+ if strings.Index(probType.UnitIds, unitId) != -1 {
|
|
|
|
+ integral = integral + *probType.Integral
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if integral != 0 {
|
|
|
|
+ id, _ := strconv.Atoi(unitId)
|
|
|
|
+ global.GVA_LOG.Error("id!", zap.Any("unitId", unitId), zap.Any("id", id))
|
|
|
|
+ _, unit := unitService.GetUnit(uint(id))
|
|
|
|
+ oldIntegral := *unit.UnitIntegral
|
|
|
|
+ nowIntegral := oldIntegral + integral
|
|
|
|
+ unit.UnitIntegral = &nowIntegral
|
|
|
|
+ unitService.UpdateUnitA(unit)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
temp := 0
|
|
temp := 0
|
|
problemInfo.Integral = &temp
|
|
problemInfo.Integral = &temp
|