|
@@ -22,6 +22,7 @@ import cn.com.ty.lift.business.project.service.ProjectService;
|
|
|
import cn.com.ty.lift.common.constants.CommonEnum;
|
|
|
import cn.com.ty.lift.common.utils.MapHelper;
|
|
|
import cn.com.xwy.boot.web.dto.RestResponse;
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.collection.IterUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
@@ -203,6 +204,8 @@ public class MaintenanceRecordService extends ServiceImpl<MaintenanceRecordMappe
|
|
|
if (ObjectUtil.isEmpty(plan)) return RestResponse.fail(MessageUtils.get("msg.maintenance.plan.not.exist"));
|
|
|
|
|
|
plan.setStatus(Integer.parseInt(CommonEnum.MaintenancePlanStatus.MAINTENANCE_DOING.getCode()));
|
|
|
+ plan.setType(record.getType());
|
|
|
+ plan.setCount(request.getPeriods());
|
|
|
boolean planResult = maintenancePlanService.updateById(plan);
|
|
|
if (!planResult) {
|
|
|
rollback();
|
|
@@ -310,6 +313,27 @@ public class MaintenanceRecordService extends ServiceImpl<MaintenanceRecordMappe
|
|
|
return response;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @param repairDiff 分钟数
|
|
|
+ * @return 时分
|
|
|
+ * @description 计算时长
|
|
|
+ * @date 2020/5/23 11:58 上午
|
|
|
+ */
|
|
|
+ public String getRepairDuration(int repairDiff) {
|
|
|
+ String time;
|
|
|
+ if (repairDiff == 60) {
|
|
|
+ int hours = repairDiff / 60;
|
|
|
+ time = hours + "小时";
|
|
|
+ } else if (repairDiff > 60) {
|
|
|
+ int hours = repairDiff / 60;
|
|
|
+ int minute = repairDiff % 60;
|
|
|
+ time = hours + "小时" + minute + "分钟";
|
|
|
+ } else {
|
|
|
+ time = repairDiff + "分钟";
|
|
|
+ }
|
|
|
+ return time;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 根据条件分页查询维保-日常保养
|
|
|
*
|
|
@@ -318,7 +342,15 @@ public class MaintenanceRecordService extends ServiceImpl<MaintenanceRecordMappe
|
|
|
* @author wcz
|
|
|
*/
|
|
|
public IPage<MtRecordResponse> pageRecordByCondition(MtRecordRequest request) {
|
|
|
- return baseMapper.pageRecordByCondition(request.getPage(), request);
|
|
|
+ IPage<MtRecordResponse> page = baseMapper.pageRecordByCondition(request.getPage(), request);
|
|
|
+ if (CollUtil.isNotEmpty(page.getRecords())) {
|
|
|
+ List<MtRecordResponse> records = page.getRecords();
|
|
|
+ for (MtRecordResponse mtRecord : records) {
|
|
|
+ String repairDuration = getRepairDuration(mtRecord.getRepairDiff());
|
|
|
+ mtRecord.setRepairDuration(repairDuration);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return page;
|
|
|
}
|
|
|
|
|
|
/**
|