|
@@ -1,11 +1,13 @@
|
|
|
package cn.com.ty.lift.business.maintenance.service;
|
|
|
|
|
|
+import cn.com.ty.lift.business.maintenance.dao.entity.model.request.MaintenanceDetailRequest;
|
|
|
+import cn.com.ty.lift.business.maintenance.dao.entity.model.request.MaintenanceGenerateRequest;
|
|
|
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.MaintenancePlanRequest;
|
|
|
-import cn.com.ty.lift.business.maintenance.dao.entity.model.MaintenancePlanResponse;
|
|
|
-import cn.com.ty.lift.business.maintenance.dao.entity.model.UpdateMaintenancePlanReq;
|
|
|
+import cn.com.ty.lift.business.maintenance.dao.entity.model.request.MaintenancePlanRequest;
|
|
|
+import cn.com.ty.lift.business.maintenance.dao.entity.model.response.MaintenancePlanResponse;
|
|
|
+import cn.com.ty.lift.business.maintenance.dao.entity.model.request.MaintenanceModifyRequest;
|
|
|
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;
|
|
@@ -64,13 +66,27 @@ public class MaintenancePlanService extends ServiceImpl<MaintenancePlanMapper, M
|
|
|
return planMapper.findByCondition(page, request);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @param request 公司id,项目id,电梯id
|
|
|
+ * @return 1.成功, 0.失败, 消息描述
|
|
|
+ * @description 查询维保计划详情列表
|
|
|
+ * @date 2020/1/2 9:43 上午
|
|
|
+ */
|
|
|
+ public List<MaintenancePlan> detailList(MaintenanceDetailRequest request) {
|
|
|
+ Map<String, Object> paramMap = new HashMap<>(3);
|
|
|
+ paramMap.put("mt_company_id", request.getMtCompanyId());
|
|
|
+ paramMap.put("project_id", request.getProjectId());
|
|
|
+ paramMap.put("lift_id", request.getLiftId());
|
|
|
+ return planMapper.selectByMap(paramMap);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* @param request 电梯列表
|
|
|
* @return 是否成功
|
|
|
* @description 批量生成维保计划
|
|
|
* @date 2019/12/16 2:14 PM
|
|
|
*/
|
|
|
- public boolean insertBatch(MaintenancePlanRequest request) {
|
|
|
+ public boolean insertBatch(MaintenanceGenerateRequest request) {
|
|
|
List<MaintenancePlan> resultList = generatePlan(request);
|
|
|
return saveBatch(resultList, resultList.size());
|
|
|
}
|
|
@@ -85,8 +101,8 @@ public class MaintenancePlanService extends ServiceImpl<MaintenancePlanMapper, M
|
|
|
*/
|
|
|
public int calculatePeriods(Date beginTime, Date endTime, int interval) {
|
|
|
long result = DateUtil.betweenDay(beginTime, endTime, false);
|
|
|
- Double num = Math.floor(Double.valueOf(String.valueOf((result / interval))));
|
|
|
- return num.intValue();
|
|
|
+ double num = Math.floor(Double.parseDouble(String.valueOf((result / interval))));
|
|
|
+ return (int) num;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -95,7 +111,7 @@ public class MaintenancePlanService extends ServiceImpl<MaintenancePlanMapper, M
|
|
|
* @description 生成维保计划
|
|
|
* @date 2019/12/16 1:21 PM
|
|
|
*/
|
|
|
- public List<MaintenancePlan> generatePlan(MaintenancePlanRequest request) {
|
|
|
+ public List<MaintenancePlan> generatePlan(MaintenanceGenerateRequest request) {
|
|
|
List<MaintenancePlan> plans = request.getPlanList();
|
|
|
//返回维保计划列表
|
|
|
List<MaintenancePlan> planList = new ArrayList<>();
|
|
@@ -158,7 +174,7 @@ public class MaintenancePlanService extends ServiceImpl<MaintenancePlanMapper, M
|
|
|
* @description 修改维保计划
|
|
|
* @date 2019/12/16 5:25 PM
|
|
|
*/
|
|
|
- public boolean modifyPlan(UpdateMaintenancePlanReq request) {
|
|
|
+ public boolean modifyPlan(MaintenanceModifyRequest request) {
|
|
|
List<MaintenancePlan> resultList = new ArrayList<>();
|
|
|
//获取当前保养时间
|
|
|
Date currentTime = request.getCurrentTime();
|
|
@@ -167,8 +183,8 @@ public class MaintenancePlanService extends ServiceImpl<MaintenancePlanMapper, M
|
|
|
//获取偏移量
|
|
|
int result = DateUtil.compare(currentTime, updateTime);
|
|
|
//获取时间间隔
|
|
|
- Long interval = DateUtil.betweenDay(currentTime, updateTime, false);
|
|
|
- int offset = interval.intValue();
|
|
|
+ long interval = DateUtil.betweenDay(currentTime, updateTime, false);
|
|
|
+ int offset = (int) interval;
|
|
|
//获取当前时间后的维保计划id列表
|
|
|
List<MaintenancePlan> idList = planMapper.findIdList(request);
|
|
|
for (MaintenancePlan entry : idList) {
|
|
@@ -190,19 +206,19 @@ public class MaintenancePlanService extends ServiceImpl<MaintenancePlanMapper, M
|
|
|
* @description 批量清除维保计划
|
|
|
* @date 2019/12/28 2:00 PM
|
|
|
*/
|
|
|
- public boolean batchCleanPlan(List<Long> idList){
|
|
|
- return removeByIds(idList);
|
|
|
+ public boolean batchCleanPlan(List<Long> idList) {
|
|
|
+ return removeByIds(idList);
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* @param companyId 公司id
|
|
|
- * @param idList 电梯id列表
|
|
|
+ * @param idList 电梯id列表
|
|
|
* @return 是否成功
|
|
|
* @description 批量清除维保计划
|
|
|
* @date 2019/12/28 2:00 PM
|
|
|
*/
|
|
|
- public boolean removeMaintenancePlan(String companyId,List<Long> idList){
|
|
|
+ public boolean removeMaintenancePlan(String companyId, List<Long> idList) {
|
|
|
QueryWrapper<MaintenancePlan> queryWrapper = new QueryWrapper<>();
|
|
|
queryWrapper.eq("mt_company_id", companyId);
|
|
|
queryWrapper.in("lift_id", idList);
|
|
@@ -211,7 +227,7 @@ public class MaintenancePlanService extends ServiceImpl<MaintenancePlanMapper, M
|
|
|
|
|
|
/**
|
|
|
* @param mtCompanyId 公司id
|
|
|
- * @param liftId 电梯id
|
|
|
+ * @param liftId 电梯id
|
|
|
* @return 是否成功
|
|
|
* @description 清空维保计划
|
|
|
* @date 2019/12/21 3:39 PM
|