|
@@ -25,7 +25,9 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.time.LocalDate;
|
|
|
+import java.time.Month;
|
|
|
import java.time.temporal.ChronoUnit;
|
|
|
+import java.time.temporal.TemporalAdjusters;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -377,28 +379,35 @@ public class MaintenancePlanService extends ServiceImpl<MaintenancePlanMapper, M
|
|
|
/**
|
|
|
* @param mtCompanyId 公司id
|
|
|
* @param liftIdList 电梯id列表
|
|
|
+ * @param beginTime 开始时间
|
|
|
* @return List<LiftPrintResponse> 电梯维保计划列表
|
|
|
* @description 根据公司id和电梯id列表查询维保计划列表,并组装电梯列表数据
|
|
|
* @date 2020/3/2 4:39 下午
|
|
|
*/
|
|
|
- public List<LiftPrintResponse> getLiftMaintenancePlanList(Long mtCompanyId, List<Long> liftIdList) {
|
|
|
+ public List<LiftPrintResponse> getLiftMaintenancePlanList(Long mtCompanyId, List<Long> liftIdList, LocalDate beginTime) {
|
|
|
//根据电梯id列表查询电梯列表
|
|
|
List<LiftPrintResponse> liftList = liftService.queryLiftListByIdList(liftIdList);
|
|
|
|
|
|
+ LocalDate endTime = beginTime.with(TemporalAdjusters.lastDayOfMonth());
|
|
|
Map<String, Object> paramMap = new HashMap<>();
|
|
|
paramMap.put("mtCompanyId", mtCompanyId);
|
|
|
paramMap.put("liftIdList", liftIdList);
|
|
|
+ paramMap.put("beginTime", beginTime);
|
|
|
+ paramMap.put("endTime", endTime);
|
|
|
//根据电梯id、公司id查询维保计划列表
|
|
|
List<MaintenancePlan> planList = baseMapper.queryPlanListByIds(paramMap);
|
|
|
|
|
|
//组装电梯列表中的维保计划数据
|
|
|
for (LiftPrintResponse entry : liftList) {
|
|
|
- List<MaintenancePlan> plans = new ArrayList<>();
|
|
|
+ List<Map<String,Object>> plans = new ArrayList<>();
|
|
|
for (MaintenancePlan plan : planList) {
|
|
|
if (entry.getProjectId().equals(plan.getProjectId())
|
|
|
&& entry.getLiftId().equals(plan.getLiftId())
|
|
|
&& entry.getMtCompanyId().equals(plan.getMtCompanyId())){
|
|
|
- plans.add(plan);
|
|
|
+ Map<String,Object> map = new HashMap<>();
|
|
|
+ map.put("planDate",plan.getPlanDate());
|
|
|
+ map.put("type",plan.getType());
|
|
|
+ plans.add(map);
|
|
|
}
|
|
|
}
|
|
|
entry.setPlanList(plans);
|
|
@@ -420,7 +429,7 @@ public class MaintenancePlanService extends ServiceImpl<MaintenancePlanMapper, M
|
|
|
//根据项目id列表查询项目列表
|
|
|
List<MaintenancePlanPrintResponse> projectList = projectService.queryProjectListByIdList(projectIdList);
|
|
|
|
|
|
- List<LiftPrintResponse> liftList = getLiftMaintenancePlanList(request.getMtCompanyId(), liftIdList);
|
|
|
+ List<LiftPrintResponse> liftList = getLiftMaintenancePlanList(request.getMtCompanyId(), liftIdList, request.getBeginTime());
|
|
|
//组装项目列表中的电梯数据
|
|
|
for (MaintenancePlanPrintResponse project : projectList) {
|
|
|
List<LiftPrintResponse> liftPrintResponses = new ArrayList<>();
|
|
@@ -431,6 +440,7 @@ public class MaintenancePlanService extends ServiceImpl<MaintenancePlanMapper, M
|
|
|
}
|
|
|
}
|
|
|
project.setLiftList(liftPrintResponses);
|
|
|
+ project.setNum(project.getLiftList().size());
|
|
|
}
|
|
|
return projectList;
|
|
|
}
|