|
@@ -1,7 +1,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.project.dao.entity.ProjectLiftRelevance;
|
|
|
import cn.com.ty.lift.business.project.service.ProjectLiftRelevanceService;
|
|
@@ -42,6 +45,9 @@ public class MaintenancePlanService extends ServiceImpl<MaintenancePlanMapper, M
|
|
|
@Resource
|
|
|
private ProjectService projectService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private LiftService liftService;
|
|
|
+
|
|
|
@Resource
|
|
|
private ProjectLiftRelevanceService projectLiftRelevanceService;
|
|
|
|
|
@@ -373,6 +379,61 @@ 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 下午
|
|
|
+ */
|
|
|
+ public List<MaintenancePlanPrintResponse> planPrint(MaintenancePlanPrintRequest request) {
|
|
|
+ List<Long> liftIdList = request.getLiftList().stream().map(MaintenancePlan::getLiftId).collect(Collectors.toList());
|
|
|
+ //根据电梯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);
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, Object> paramMap = new HashMap<>();
|
|
|
+ paramMap.put("mtCompanyId", request.getMtCompanyId());
|
|
|
+ paramMap.put("projectLiftList", projectLiftList);
|
|
|
+ //根据电梯id、项目id、公司id查询维保计划列表
|
|
|
+ List<MaintenancePlan> planList = baseMapper.queryPlanListByIds(paramMap);
|
|
|
+
|
|
|
+ //组装电梯列表中的维保计划数据
|
|
|
+ for (LiftPrintResponse entry : liftList) {
|
|
|
+ List<MaintenancePlan> 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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ entry.setPlanList(plans);
|
|
|
+ }
|
|
|
+ List<Long> projectIdList = request.getLiftList().stream().map(MaintenancePlan::getProjectId).collect(Collectors.toList());
|
|
|
+ //根据项目id列表查询项目列表
|
|
|
+ List<MaintenancePlanPrintResponse> projectList = projectService.queryProjectListByIdList(projectIdList);
|
|
|
+
|
|
|
+ //组装项目列表中的电梯数据
|
|
|
+ for (MaintenancePlanPrintResponse project : projectList) {
|
|
|
+ List<LiftPrintResponse> liftPrintResponses = new ArrayList<>();
|
|
|
+ for (LiftPrintResponse lift : liftList) {
|
|
|
+ if (project.getProjectId().equals(lift.getProjectId())
|
|
|
+ && project.getMtCompanyId().equals(lift.getMtCompanyId())) {
|
|
|
+ liftPrintResponses.add(lift);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ project.setLiftList(liftPrintResponses);
|
|
|
+ }
|
|
|
+ return projectList;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 根据条件分页查询 维保计划-超期计划
|
|
|
* @author wcz
|