|
@@ -20,6 +20,7 @@ import com.palmnest.model.User;
|
|
|
import com.palmnest.model.property.TbOrganization;
|
|
|
import com.palmnest.model.repair.RepairBill;
|
|
|
import com.palmnest.model.repair.RepairBillComment;
|
|
|
+import com.palmnest.model.repair.RepairReturnVisit;
|
|
|
import com.palmnest.service.ElementGroupManager;
|
|
|
import com.palmnest.service.dinner.service.OrderDinnerService;
|
|
|
import com.palmnest.service.repair.*;
|
|
@@ -59,6 +60,11 @@ public class RepairBillStatisticsManagerImpl implements RepairBillStatisticsMana
|
|
|
private OrganizationDao organizationDao;
|
|
|
@Autowired
|
|
|
private RepairBillCommentManager repairBillCommentManager;
|
|
|
+
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private RepairReturnVisitManager repairReturnVisitManager;
|
|
|
+
|
|
|
@Autowired
|
|
|
private UserRepairTypeManager userRepairTypeManager;
|
|
|
@Autowired
|
|
@@ -180,6 +186,8 @@ public class RepairBillStatisticsManagerImpl implements RepairBillStatisticsMana
|
|
|
Long billRepairType = repairBills.get(0).getRepairType();
|
|
|
|
|
|
int hours = 0;
|
|
|
+ int singleMinutes = 0; //抢单总分钟数
|
|
|
+ int completedMinutes = 0; //完成总分钟数
|
|
|
int commentTotal = 0; //总评价数
|
|
|
int allCommentStars = 0; //总评星数
|
|
|
|
|
@@ -236,9 +244,16 @@ public class RepairBillStatisticsManagerImpl implements RepairBillStatisticsMana
|
|
|
dto.setBillStatus8Total(dto.getBillStatus8Total() + 1);
|
|
|
//已完成的总耗时
|
|
|
hours += DateHelper.getHoursBetween(repairBill.getCreateTime(), repairBill.getEndTime());
|
|
|
+ completedMinutes += DateHelper.getMinutesBetween(repairBill.getCreateTime(), repairBill.getEndTime());
|
|
|
|
|
|
}
|
|
|
|
|
|
+ //已抢单-数量
|
|
|
+ if(null != dto.getSingleTime()){
|
|
|
+ dto.setBillSingleTotal(dto.getBillSingleTotal() + 1);
|
|
|
+ singleMinutes += DateHelper.getMinutesBetween(repairBill.getCreateTime(), repairBill.getSingleTime());
|
|
|
+ }
|
|
|
+
|
|
|
if (status == CodeConstants.UNAUDIT || status == CodeConstants.CANCEL) {
|
|
|
//已取消 包括已取消、审核未通过订单
|
|
|
dto.setBillStatus10Total(dto.getBillStatus10Total() + 1);
|
|
@@ -266,14 +281,57 @@ public class RepairBillStatisticsManagerImpl implements RepairBillStatisticsMana
|
|
|
|
|
|
//平均评星 总评星数/总评价单数
|
|
|
RepairBillComment repairBillComment = repairBillCommentManager.findBy(repairBill.getId());
|
|
|
+
|
|
|
+ RepairReturnVisit repairReturnVisit = repairReturnVisitManager.findBy(repairBill.getId());
|
|
|
+
|
|
|
+
|
|
|
+ int commentStar = 0 ; //评价星级
|
|
|
if (null != repairBillComment) {
|
|
|
+ //commentTotal++;
|
|
|
+ //allCommentStars += repairBillComment.getStar() == null ?
|
|
|
+ // 5 : repairBillComment.getStar().intValue(); //默认5星
|
|
|
+
|
|
|
+ commentStar = repairBillComment.getStar() == null ? 5 : repairBillComment.getStar().intValue();
|
|
|
+ }
|
|
|
+
|
|
|
+ int returnVisitStar = 0 ; //回访星级
|
|
|
+ if(null != repairReturnVisit){
|
|
|
+ returnVisitStar = repairReturnVisit.getStar() == null ? 5 : repairReturnVisit.getStar().intValue();
|
|
|
+ }
|
|
|
+
|
|
|
+ if(commentStar != 0 || returnVisitStar != 0){
|
|
|
commentTotal++;
|
|
|
- allCommentStars += repairBillComment.getStar() == null ?
|
|
|
- 5 : repairBillComment.getStar().intValue(); //默认5星
|
|
|
+
|
|
|
+ Integer returnStar = commentStar > returnVisitStar ? commentStar : returnVisitStar;
|
|
|
+ allCommentStars += returnStar; //工单星级
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
+ //平均接单耗时 -1
|
|
|
+ if(dto.getBillSingleTotal() > 0){
|
|
|
+
|
|
|
+ BigDecimal avgBillTime = new BigDecimal(dto.getBillSingleTotal()).divide(new BigDecimal(60))
|
|
|
+ .divide(new BigDecimal(singleMinutes),2, BigDecimal.ROUND_HALF_UP);
|
|
|
+
|
|
|
+ dto.setAvgBillTime(avgBillTime);
|
|
|
+ }else{
|
|
|
+ dto.setAvgBillTime(BigDecimal.ZERO);
|
|
|
+ }
|
|
|
+
|
|
|
+ //平均完成耗时 -2
|
|
|
+ if(dto.getBillStatus8Total() > 0){
|
|
|
+
|
|
|
+ BigDecimal avgCompleteTime =new BigDecimal(completedMinutes).
|
|
|
+ divide(new BigDecimal(dto.getBillStatus8Total()),2, BigDecimal.ROUND_HALF_UP);
|
|
|
+
|
|
|
+ dto.setAvgCompleteTime(avgCompleteTime);
|
|
|
+ }else{
|
|
|
+ dto.setAvgCompleteTime(BigDecimal.ZERO);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
//完成率 已完成/总工单 X 100
|
|
|
if (dto.getAllBillTotal() > 0) {
|
|
|
|