|
|
|
@ -3,6 +3,7 @@ package org.springblade.plugin.homepage.service.impl; |
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.alibaba.nacos.shaded.com.google.gson.JsonObject; |
|
|
|
import com.alibaba.nacos.shaded.com.google.gson.JsonObject; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import liquibase.pro.packaged.E; |
|
|
|
import liquibase.pro.packaged.E; |
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
import org.apache.commons.lang.StringUtils; |
|
|
|
import org.apache.commons.lang.StringUtils; |
|
|
|
@ -23,6 +24,8 @@ import org.springblade.core.tool.utils.StringUtil; |
|
|
|
import org.springblade.plugin.homepage.enumutil.TaskTypeColorEnum; |
|
|
|
import org.springblade.plugin.homepage.enumutil.TaskTypeColorEnum; |
|
|
|
import org.springblade.plugin.homepage.enumutil.WorkingStatusEnum; |
|
|
|
import org.springblade.plugin.homepage.enumutil.WorkingStatusEnum; |
|
|
|
import org.springblade.plugin.homepage.service.IHomePageService; |
|
|
|
import org.springblade.plugin.homepage.service.IHomePageService; |
|
|
|
|
|
|
|
import org.springblade.plugin.operation.workorder.entity.WorkOrder; |
|
|
|
|
|
|
|
import org.springblade.plugin.operation.workorder.service.IWorkOrderService; |
|
|
|
import org.springblade.plugin.workflow.core.utils.WfTaskUtil; |
|
|
|
import org.springblade.plugin.workflow.core.utils.WfTaskUtil; |
|
|
|
import org.springblade.system.cache.DictBizCache; |
|
|
|
import org.springblade.system.cache.DictBizCache; |
|
|
|
import org.springblade.system.user.cache.UserCache; |
|
|
|
import org.springblade.system.user.cache.UserCache; |
|
|
|
@ -31,6 +34,7 @@ import org.springframework.scheduling.annotation.Async; |
|
|
|
import org.springframework.scheduling.annotation.AsyncResult; |
|
|
|
import org.springframework.scheduling.annotation.AsyncResult; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.time.Duration; |
|
|
|
import java.time.Duration; |
|
|
|
|
|
|
|
|
|
|
|
import java.time.LocalDate; |
|
|
|
import java.time.LocalDate; |
|
|
|
@ -49,8 +53,7 @@ public class HomePageServiceImpl implements IHomePageService { |
|
|
|
private final TaskService taskService; |
|
|
|
private final TaskService taskService; |
|
|
|
private final HistoryService historyService; |
|
|
|
private final HistoryService historyService; |
|
|
|
private final RuntimeService runtimeService; |
|
|
|
private final RuntimeService runtimeService; |
|
|
|
|
|
|
|
private final IWorkOrderService workOrderService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
@ -188,7 +191,14 @@ public class HomePageServiceImpl implements IHomePageService { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return new AsyncResult<>(expireNum); |
|
|
|
// 工单记录待实施
|
|
|
|
|
|
|
|
LambdaQueryWrapper<WorkOrder> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
|
|
|
wrapper.eq(WorkOrder::getMaintenanceCompany, AuthUtil.getUserId()); |
|
|
|
|
|
|
|
wrapper.eq(WorkOrder::getIsFinish, 0); |
|
|
|
|
|
|
|
wrapper.ge(WorkOrder::getExpectedCompletionTime, new Date()); |
|
|
|
|
|
|
|
int count = workOrderService.count(wrapper); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return new AsyncResult<>(expireNum + count); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -208,7 +218,14 @@ public class HomePageServiceImpl implements IHomePageService { |
|
|
|
; |
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
List<Task> listNeedDo = taskQuery.list(); |
|
|
|
List<Task> listNeedDo = taskQuery.list(); |
|
|
|
return new AsyncResult<>(listNeedDo.size()); |
|
|
|
|
|
|
|
|
|
|
|
// 工单记录待实施
|
|
|
|
|
|
|
|
LambdaQueryWrapper<WorkOrder> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
|
|
|
wrapper.eq(WorkOrder::getMaintenanceCompany, AuthUtil.getUserId()); |
|
|
|
|
|
|
|
wrapper.eq(WorkOrder::getIsFinish, 0); |
|
|
|
|
|
|
|
int count = workOrderService.count(wrapper); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return new AsyncResult<>(listNeedDo.size() + count); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Async |
|
|
|
@Async |
|
|
|
@ -242,7 +259,14 @@ public class HomePageServiceImpl implements IHomePageService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
return new AsyncResult<>(todayAddNum); |
|
|
|
|
|
|
|
|
|
|
|
LambdaQueryWrapper<WorkOrder> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
|
|
|
wrapper.eq(WorkOrder::getMaintenanceCompany, AuthUtil.getUserId()); |
|
|
|
|
|
|
|
wrapper.eq(WorkOrder::getIsFinish, 0); |
|
|
|
|
|
|
|
wrapper.between(WorkOrder::getCreateTime, startTime(), endTime()); |
|
|
|
|
|
|
|
int count = workOrderService.count(wrapper); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return new AsyncResult<>(todayAddNum + count); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Async |
|
|
|
@Async |
|
|
|
@ -273,11 +297,39 @@ public class HomePageServiceImpl implements IHomePageService { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return new AsyncResult<>(todayFinishNum); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LambdaQueryWrapper<WorkOrder> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
|
|
|
wrapper.eq(WorkOrder::getMaintenanceCompany, AuthUtil.getUserId()); |
|
|
|
|
|
|
|
wrapper.eq(WorkOrder::getIsFinish, 1); |
|
|
|
|
|
|
|
wrapper.between(WorkOrder::getFinishTime, startTime(), endTime()); |
|
|
|
|
|
|
|
int count = workOrderService.count(wrapper); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return new AsyncResult<>(todayFinishNum + count); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Date startTime() { |
|
|
|
|
|
|
|
Calendar todayStart = Calendar.getInstance(); |
|
|
|
|
|
|
|
todayStart.set(Calendar.SECOND, 0); |
|
|
|
|
|
|
|
todayStart.set(Calendar.MINUTE, 0); |
|
|
|
|
|
|
|
todayStart.set(Calendar.HOUR_OF_DAY, 0); |
|
|
|
|
|
|
|
todayStart.set(Calendar.MILLISECOND, 0); |
|
|
|
|
|
|
|
return todayStart.getTime(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Date endTime() { |
|
|
|
|
|
|
|
Calendar todayEnd = Calendar.getInstance(); |
|
|
|
|
|
|
|
todayEnd.set(Calendar.SECOND, 59); |
|
|
|
|
|
|
|
todayEnd.set(Calendar.MINUTE, 59); |
|
|
|
|
|
|
|
todayEnd.set(Calendar.HOUR_OF_DAY, 23); |
|
|
|
|
|
|
|
todayEnd.set(Calendar.MILLISECOND, 999); |
|
|
|
|
|
|
|
return todayEnd.getTime(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 近一年与当前用户所在部门相关的新增工单和完成工单数量,按照月份进行统计 |
|
|
|
* 近一年与当前用户所在部门相关的新增工单和完成工单数量,按照月份进行统计 |
|
|
|
|
|
|
|
* |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
@ -440,6 +492,7 @@ System.out.println("上一年1-" +DateUtil.plusYears(DateUtil.now(), -1)); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 流程状态统计 |
|
|
|
* 流程状态统计 |
|
|
|
|
|
|
|
* |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
|