Prechádzať zdrojové kódy

月度工分汇总-运行时长分数添加

wanglt 4 mesiacov pred
rodič
commit
9bc5f28a4e

+ 26 - 2
ygtx-gxt/src/main/java/com/ygtx/gxt/service/impl/GxtMonthScoreServiceImpl.java

@@ -558,7 +558,19 @@ public class GxtMonthScoreServiceImpl implements IGxtMonthScoreService
             if (monthScore.getCoefficientScore().getStatus()!=null && monthScore.getCoefficientScore().getStatus()==1) {
                 // 不扣分
                 for (GxtUserScore item:userScores) {
-                    BigDecimal finalScore = (item.getMaintenanceTotalScore().multiply(numWork)).add(item.getRepairTotalScore().multiply(numRepair));
+                    GxtDeviceRuntimePerson deviceRuntimePerson = new GxtDeviceRuntimePerson();
+                    deviceRuntimePerson.setPersonId(item.getUserId());
+                    deviceRuntimePerson.setMonthPeriod(monthPeriod);
+                    List<GxtDeviceRuntimePerson> peopleScore = gxtDeviceRuntimePersonMapper.selectGxtDeviceRuntimePersonList(deviceRuntimePerson);
+                    BigDecimal runTimeScore = BigDecimal.ZERO;
+                    if (!peopleScore.isEmpty()) {
+                        for (GxtDeviceRuntimePerson person:peopleScore) {
+                            if (person.getScore()!=null) {
+                                runTimeScore = runTimeScore.add(person.getScore());
+                            }
+                        }
+                    }
+                    BigDecimal finalScore = (item.getMaintenanceTotalScore().add(runTimeScore).multiply(numWork)).add(item.getRepairTotalScore().multiply(numRepair));
                     if (item.getFinalScore().compareTo(finalScore)==0) {
                         break;
                     }
@@ -570,7 +582,19 @@ public class GxtMonthScoreServiceImpl implements IGxtMonthScoreService
             }else {
                 // 扣分
                 for (GxtUserScore item:userScores) {
-                    BigDecimal finalScore = (item.getMaintenanceTotalScore().multiply(numWork)).add(item.getRepairTotalScore().multiply(numRepair));
+                    GxtDeviceRuntimePerson deviceRuntimePerson = new GxtDeviceRuntimePerson();
+                    deviceRuntimePerson.setPersonId(item.getUserId());
+                    deviceRuntimePerson.setMonthPeriod(monthPeriod);
+                    List<GxtDeviceRuntimePerson> peopleScore = gxtDeviceRuntimePersonMapper.selectGxtDeviceRuntimePersonList(deviceRuntimePerson);
+                    BigDecimal runTimeScore = BigDecimal.ZERO;
+                    if (!peopleScore.isEmpty()) {
+                        for (GxtDeviceRuntimePerson person:peopleScore) {
+                            if (person.getScore()!=null) {
+                                runTimeScore = runTimeScore.add(person.getScore());
+                            }
+                        }
+                    }
+                    BigDecimal finalScore = (item.getMaintenanceTotalScore().add(runTimeScore).multiply(numWork)).add(item.getRepairTotalScore().multiply(numRepair));
                     finalScore = finalScore.subtract(groupDeduction);
                     if (item.getFinalScore().compareTo(finalScore)==0) {
                         break;