|
@@ -1,7 +1,8 @@
|
|
|
package cn.com.ty.lift.business.maintenance.service;
|
|
|
|
|
|
+import cn.com.ty.lift.business.library.dao.entity.ProjectLiftRelevance;
|
|
|
+import cn.com.ty.lift.business.library.service.ProjectLiftRelevanceService;
|
|
|
import cn.com.ty.lift.business.maintenance.dao.entity.MaintenancePlan;
|
|
|
-import cn.com.ty.lift.business.maintenance.dao.entity.model.BatchMaintenancePlanRequest;
|
|
|
import cn.com.ty.lift.business.maintenance.dao.entity.model.MaintenancePlanRequest;
|
|
|
import cn.com.ty.lift.business.maintenance.dao.entity.model.UpdateMaintenancePlanReq;
|
|
|
import cn.com.ty.lift.business.maintenance.dao.mapper.MaintenancePlanMapper;
|
|
@@ -32,6 +33,9 @@ public class MaintenancePlanService extends ServiceImpl<MaintenancePlanMapper, M
|
|
|
@Resource
|
|
|
private MaintenancePlanMapper planMapper;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private ProjectLiftRelevanceService projectLiftRelevanceService;
|
|
|
+
|
|
|
|
|
|
private Map<String, String> paramMap = new HashMap<String, String>() {{
|
|
|
put("projectCode", "项目编号");
|
|
@@ -83,12 +87,14 @@ public class MaintenancePlanService extends ServiceImpl<MaintenancePlanMapper, M
|
|
|
//保养类型 1.半月,2.季度,3.半年,4.全年
|
|
|
int[] maintenanceType = {1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 4};
|
|
|
int times = 0;
|
|
|
+ //获取从第几期开始
|
|
|
+ int periods = request.getPeriods();
|
|
|
+ //获取保养间隔
|
|
|
+ int interval = request.getInterval();
|
|
|
for (MaintenancePlan plan : plans) {
|
|
|
- //获取从第几期开始
|
|
|
- int periods = request.getPeriods();
|
|
|
- //获取保养间隔
|
|
|
- int interval = request.getInterval();
|
|
|
- Project project = projectService.detail(plan.getProjectId());
|
|
|
+ //获取项目id
|
|
|
+ Long projectId = plan.getProjectId();
|
|
|
+ Project project = projectService.detail(projectId);
|
|
|
if (project != null) {
|
|
|
Date beginTime = project.getStartDate();
|
|
|
Date endTime = project.getEndDate();
|
|
@@ -100,7 +106,7 @@ public class MaintenancePlanService extends ServiceImpl<MaintenancePlanMapper, M
|
|
|
//设置维保计划电梯ID,维保公司ID,项目ID,维保工ID,维保类型
|
|
|
entry.setLiftId(plan.getLiftId());
|
|
|
entry.setMtCompanyId(plan.getMtCompanyId());
|
|
|
- entry.setProjectId(plan.getProjectId());
|
|
|
+ entry.setProjectId(projectId);
|
|
|
entry.setWorkerId(plan.getWorkerId());
|
|
|
entry.setType(maintenanceType[periods - 1]);
|
|
|
if (i == 0) {
|
|
@@ -119,6 +125,13 @@ public class MaintenancePlanService extends ServiceImpl<MaintenancePlanMapper, M
|
|
|
planList.add(entry);
|
|
|
}
|
|
|
}
|
|
|
+ //更新项目电梯关联表中电梯的首保时间和保养间隔
|
|
|
+ List<ProjectLiftRelevance> entryList = request.getRelevanceList();
|
|
|
+ for (ProjectLiftRelevance entry : entryList) {
|
|
|
+ entry.setPlanInterval(interval);
|
|
|
+ entry.setFirstTime(request.getFirstTime());
|
|
|
+ }
|
|
|
+ projectLiftRelevanceService.updateBatchById(entryList);
|
|
|
return planList;
|
|
|
}
|
|
|
|
|
@@ -155,14 +168,17 @@ public class MaintenancePlanService extends ServiceImpl<MaintenancePlanMapper, M
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * @param request ids 维保计划id列表
|
|
|
+ * @param mtCompanyId 公司id
|
|
|
+ * @param liftId 电梯id
|
|
|
* @return 是否成功
|
|
|
* @description 清空维保计划
|
|
|
- * @date 2019/12/17 3:14 PM
|
|
|
+ * @date 2019/12/21 3:39 PM
|
|
|
*/
|
|
|
- public boolean deleteByIds(BatchMaintenancePlanRequest request) {
|
|
|
- log.info("批量清空维保计划");
|
|
|
- return removeByIds(request.getIds());
|
|
|
+ public boolean cleanPlan(String mtCompanyId, String liftId) {
|
|
|
+ Map<String, Object> columnMap = new HashMap<>(2);
|
|
|
+ columnMap.put("mt_company_id", mtCompanyId);
|
|
|
+ columnMap.put("lift_id", liftId);
|
|
|
+ return planMapper.deleteByMap(columnMap) > 0;
|
|
|
}
|
|
|
|
|
|
/**
|