|
@@ -3,13 +3,10 @@ package cn.com.ty.lift.business.maintenance.service;
|
|
|
import cn.com.ty.lift.business.framework.util.MessageUtils;
|
|
|
import cn.com.ty.lift.business.library.service.LiftService;
|
|
|
import cn.com.ty.lift.business.maintenance.dao.entity.model.request.*;
|
|
|
-import cn.com.ty.lift.business.maintenance.dao.entity.model.response.LiftPrintResponse;
|
|
|
-import cn.com.ty.lift.business.maintenance.dao.entity.model.response.MaintenancePlanPrintResponse;
|
|
|
-import cn.com.ty.lift.business.maintenance.dao.entity.model.response.MtPlanResponse;
|
|
|
+import cn.com.ty.lift.business.maintenance.dao.entity.model.response.*;
|
|
|
import cn.com.ty.lift.business.project.dao.entity.ProjectLiftRelevance;
|
|
|
import cn.com.ty.lift.business.project.service.ProjectLiftRelevanceService;
|
|
|
import cn.com.ty.lift.business.maintenance.dao.entity.MaintenancePlan;
|
|
|
-import cn.com.ty.lift.business.maintenance.dao.entity.model.response.MaintenancePlanResponse;
|
|
|
import cn.com.ty.lift.business.maintenance.dao.mapper.MaintenancePlanMapper;
|
|
|
import cn.com.ty.lift.business.project.dao.entity.Project;
|
|
|
import cn.com.ty.lift.business.project.service.ProjectService;
|
|
@@ -21,7 +18,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -29,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;
|
|
|
|
|
@@ -378,47 +376,60 @@ public class MaintenancePlanService extends ServiceImpl<MaintenancePlanMapper, M
|
|
|
utils.export(projectList, paramMap, request.getExportPath());
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
- * @param request 电梯列表
|
|
|
- * @return List<MaintenancePlanPrintResponse> 维保计划打印列表
|
|
|
- * @description 维保计划打印列表
|
|
|
- * @date 2020/2/13 3:39 下午
|
|
|
+ * @param mtCompanyId 公司id
|
|
|
+ * @param liftIdList 电梯id列表
|
|
|
+ * @param beginTime 开始时间
|
|
|
+ * @return List<LiftPrintResponse> 电梯维保计划列表
|
|
|
+ * @description 根据公司id和电梯id列表查询维保计划列表,并组装电梯列表数据
|
|
|
+ * @date 2020/3/2 4:39 下午
|
|
|
*/
|
|
|
- public List<MaintenancePlanPrintResponse> planPrint(MaintenancePlanPrintRequest request) {
|
|
|
- List<Long> liftIdList = request.getLiftList().stream().map(MaintenancePlan::getLiftId).collect(Collectors.toList());
|
|
|
+ public List<LiftPrintResponse> getLiftMaintenancePlanList(Long mtCompanyId, List<Long> liftIdList, LocalDate beginTime) {
|
|
|
//根据电梯id列表查询电梯列表
|
|
|
List<LiftPrintResponse> liftList = liftService.queryLiftListByIdList(liftIdList);
|
|
|
|
|
|
- //拼接查询维保计划的条件
|
|
|
- List<String> projectLiftList = new ArrayList<>();
|
|
|
- for (MaintenancePlan entry : request.getLiftList()) {
|
|
|
- String builder = entry.getProjectId() + "-" + entry.getLiftId();
|
|
|
- projectLiftList.add(builder);
|
|
|
- }
|
|
|
-
|
|
|
+ LocalDate endTime = beginTime.with(TemporalAdjusters.lastDayOfMonth());
|
|
|
Map<String, Object> paramMap = new HashMap<>();
|
|
|
- paramMap.put("mtCompanyId", request.getMtCompanyId());
|
|
|
- paramMap.put("projectLiftList", projectLiftList);
|
|
|
- //根据电梯id、项目id、公司id查询维保计划列表
|
|
|
+ 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);
|
|
|
}
|
|
|
+ return liftList;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param request 电梯列表
|
|
|
+ * @return List<MaintenancePlanPrintResponse> 维保计划打印列表
|
|
|
+ * @description 维保计划打印列表
|
|
|
+ * @date 2020/2/13 3:39 下午
|
|
|
+ */
|
|
|
+ public List<MaintenancePlanPrintResponse> planPrint(MaintenancePlanPrintRequest request) {
|
|
|
+ List<Long> liftIdList = request.getLiftList().stream().map(MaintenancePlan::getLiftId).collect(Collectors.toList());
|
|
|
+
|
|
|
List<Long> projectIdList = request.getLiftList().stream().map(MaintenancePlan::getProjectId).collect(Collectors.toList());
|
|
|
//根据项目id列表查询项目列表
|
|
|
List<MaintenancePlanPrintResponse> projectList = projectService.queryProjectListByIdList(projectIdList);
|
|
|
|
|
|
+ List<LiftPrintResponse> liftList = getLiftMaintenancePlanList(request.getMtCompanyId(), liftIdList, request.getBeginTime());
|
|
|
//组装项目列表中的电梯数据
|
|
|
for (MaintenancePlanPrintResponse project : projectList) {
|
|
|
List<LiftPrintResponse> liftPrintResponses = new ArrayList<>();
|
|
@@ -429,6 +440,7 @@ public class MaintenancePlanService extends ServiceImpl<MaintenancePlanMapper, M
|
|
|
}
|
|
|
}
|
|
|
project.setLiftList(liftPrintResponses);
|
|
|
+ project.setNum(project.getLiftList().size());
|
|
|
}
|
|
|
return projectList;
|
|
|
}
|