|
@@ -41,6 +41,7 @@ import com.platform.dao.vo.repair.RepairApplicationFormVO;
|
|
|
import com.platform.dao.vo.repair.RepairCheckVO;
|
|
|
import com.platform.dao.vo.repair.RepairFormVO;
|
|
|
import com.platform.dao.vo.report.RepairReport24VO;
|
|
|
+import com.platform.dao.vo.report.RepairReportMttr;
|
|
|
import com.platform.dao.vo.sb.SbInfoVO;
|
|
|
import com.platform.office.annotation.Excel;
|
|
|
import com.platform.service.base.impl.BaseServiceImpl;
|
|
@@ -685,11 +686,13 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
|
|
|
* 2:如果不是当前年份,则统计全年的
|
|
|
*
|
|
|
* @param repairApplicationFormDTO
|
|
|
- * @param searchYear
|
|
|
+ * @param searchYear 查询年份
|
|
|
+ * @param type 1:大于24的非计划性维修
|
|
|
+ * 2:所有类型维修,不限维修时间,包括计划性和非计划性,单不包括其他(如:布线等完善性维修)
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public List<RepairReport24VO> getMonthReportBig24(RepairApplicationFormDTO repairApplicationFormDTO, Integer searchYear) {
|
|
|
+ public List<RepairReport24VO> getMonthReportBig24(RepairApplicationFormDTO repairApplicationFormDTO, Integer searchYear, Integer type) {
|
|
|
LocalDate localDate = LocalDate.now();
|
|
|
int year = localDate.getYear();
|
|
|
|
|
@@ -707,7 +710,14 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
|
|
|
searchEndTime = DateUtils.getLastDayOfThisYear(searchYear);
|
|
|
}
|
|
|
// 选择非计划性的订单
|
|
|
- repairApplicationFormDTO.setCategory(RepairApplicationFormCategoryEnum.PLAN_NOT.getValue());
|
|
|
+ if(type == 1){
|
|
|
+ repairApplicationFormDTO.setCategory(RepairApplicationFormCategoryEnum.PLAN_NOT.getValue());
|
|
|
+ }else if(type == 2){
|
|
|
+ List<Integer> categoryList = new ArrayList<Integer>();
|
|
|
+ categoryList.add(RepairApplicationFormCategoryEnum.PLAN_NOT.getValue());
|
|
|
+ categoryList.add(RepairApplicationFormCategoryEnum.PLAN.getValue());
|
|
|
+ repairApplicationFormDTO.setCategoryList(categoryList);
|
|
|
+ }
|
|
|
repairApplicationFormDTO.setSearchStartTime(searchStartTime);
|
|
|
repairApplicationFormDTO.setSearchEndTime(searchEndTime);
|
|
|
List<RepairApplicationFormVO> list = mapper.selectPageList(repairApplicationFormDTO);
|
|
@@ -721,18 +731,91 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
|
|
|
if(repairApplicationForm.getDealMinutes() == null){
|
|
|
continue;
|
|
|
}
|
|
|
- double minites = repairApplicationForm.getDealMinutes();
|
|
|
- if(minites/60.0<24.0){
|
|
|
+ if(type == 1){
|
|
|
+ double minites = repairApplicationForm.getDealMinutes();
|
|
|
+ if(minites/60.0<24.0){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(repairApplicationForm.getApplyTime().isAfter(map.get("searchStartTimeMonth")) && repairApplicationForm.getApplyTime().isBefore(map.get("searchEndTimeMonth"))){
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ vo.setNum(i);
|
|
|
+ result.add(vo);
|
|
|
+ }
|
|
|
+ /* for(RepairReport24VO r: result){
|
|
|
+ System.out.println(r.toString());
|
|
|
+ }*/
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 1: 如果年份是当前年份,则统计到当前月份
|
|
|
+ * 2:如果不是当前年份,则统计全年的
|
|
|
+ *
|
|
|
+ * @param repairApplicationFormDTO
|
|
|
+ * @param searchYear 查询年份
|
|
|
+ * @param type 1:大于24的非计划性维修
|
|
|
+ * 2:所有类型维修,不限维修时间,包括计划性和非计划性,单不包括其他(如:布线等完善性维修)
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<RepairReportMttr> getMonthReportMtrr(RepairApplicationFormDTO repairApplicationFormDTO, Integer searchYear ) {
|
|
|
+ LocalDate localDate = LocalDate.now();
|
|
|
+ int year = localDate.getYear();
|
|
|
+
|
|
|
+ // 如2021-10-15号码,则month=10,需要计算到11月份,需要加1
|
|
|
+ int month = localDate.getMonthValue() + 1;
|
|
|
+ List<Map<String, LocalDateTime>> monthStartAndEndList = DateUtils.getMonthStartAndEndByYear(year, month);
|
|
|
+ LocalDateTime searchStartTime = null;
|
|
|
+ LocalDateTime searchEndTime = null;
|
|
|
+ // 当前年份只统计到当前月,历史年份统计全年
|
|
|
+ if(year == searchYear){
|
|
|
+ searchStartTime = DateUtils.getFirstDayOfThisYear(year);
|
|
|
+ searchEndTime = DateUtils.getLastDayOfMonth(month);
|
|
|
+ }else{
|
|
|
+ searchStartTime = DateUtils.getFirstDayOfThisYear(searchYear);
|
|
|
+ searchEndTime = DateUtils.getLastDayOfThisYear(searchYear);
|
|
|
+ }
|
|
|
+ // 选择非计划性的订单
|
|
|
+ List<Integer> categoryList = new ArrayList<Integer>();
|
|
|
+ categoryList.add(RepairApplicationFormCategoryEnum.PLAN_NOT.getValue());
|
|
|
+ categoryList.add(RepairApplicationFormCategoryEnum.PLAN.getValue());
|
|
|
+ repairApplicationFormDTO.setCategoryList(categoryList);
|
|
|
+
|
|
|
+ repairApplicationFormDTO.setSearchStartTime(searchStartTime);
|
|
|
+ repairApplicationFormDTO.setSearchEndTime(searchEndTime);
|
|
|
+ List<RepairApplicationFormVO> list = mapper.selectPageList(repairApplicationFormDTO);
|
|
|
+
|
|
|
+ List<RepairReportMttr> result = new ArrayList<RepairReportMttr>();
|
|
|
+ for(Map<String, LocalDateTime> map: monthStartAndEndList){
|
|
|
+ RepairReportMttr vo = new RepairReportMttr();
|
|
|
+ vo.setMonth(searchStartTime.getYear() + "-" + map.get("searchStartTimeMonth").getMonthValue() + "月");
|
|
|
+ double totalMinuties = 0.0;
|
|
|
+ double meanMinuties = 0.0;
|
|
|
+ int i = 0;
|
|
|
+ for(RepairApplicationFormVO repairApplicationForm: list){
|
|
|
+ if(repairApplicationForm.getDealMinutes() == null){
|
|
|
continue;
|
|
|
}
|
|
|
if(repairApplicationForm.getApplyTime().isAfter(map.get("searchStartTimeMonth")) && repairApplicationForm.getApplyTime().isBefore(map.get("searchEndTimeMonth"))){
|
|
|
i++;
|
|
|
+ totalMinuties = totalMinuties + repairApplicationForm.getDealMinutes();
|
|
|
}
|
|
|
}
|
|
|
+ if(totalMinuties == 0.0){
|
|
|
+ meanMinuties = 0.0;
|
|
|
+ }else{
|
|
|
+ totalMinuties = BigDecimalUtil.decimal(totalMinuties/60, 2);
|
|
|
+ meanMinuties = BigDecimalUtil.decimal(totalMinuties/i, 2);
|
|
|
+ }
|
|
|
+ vo.setTotalHours(totalMinuties);
|
|
|
+ vo.setMttr(meanMinuties);
|
|
|
vo.setNum(i);
|
|
|
result.add(vo);
|
|
|
}
|
|
|
- for(RepairReport24VO r: result){
|
|
|
+ for(RepairReportMttr r: result){
|
|
|
System.out.println(r.toString());
|
|
|
}
|
|
|
return result;
|