Commit a9e76e49 by huangjinxin

fix:工单状态统计

1 parent e239a3eb
...@@ -11,6 +11,7 @@ import com.dituhui.pea.order.dto.OrderChangeListDTO; ...@@ -11,6 +11,7 @@ import com.dituhui.pea.order.dto.OrderChangeListDTO;
import com.dituhui.pea.order.dto.WorkbenchSummaryResp; import com.dituhui.pea.order.dto.WorkbenchSummaryResp;
import com.dituhui.pea.order.entity.OrderEventEntity; import com.dituhui.pea.order.entity.OrderEventEntity;
import com.dituhui.pea.order.entity.OrderInfoEntity; import com.dituhui.pea.order.entity.OrderInfoEntity;
import com.dituhui.pea.order.enums.AppointmentMethodEnum;
import com.dituhui.pea.order.enums.OrderFlowEnum; import com.dituhui.pea.order.enums.OrderFlowEnum;
import com.dituhui.pea.order.service.WorkbenchService; import com.dituhui.pea.order.service.WorkbenchService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -79,16 +80,26 @@ public class WorkbenchServiceImpl implements WorkbenchService { ...@@ -79,16 +80,26 @@ public class WorkbenchServiceImpl implements WorkbenchService {
return Result.success(rs); return Result.success(rs);
} }
/**
* 工作台工单状态统计
*
* @param levelType
* @param levelValue
* @param dt
* @return
*/
@Override @Override
public Result<?> getWorkbenchSummary(String levelType, String levelValue, LocalDate dt) { public Result<?> getWorkbenchSummary(String levelType, String levelValue, LocalDate dt) {
List<WorkbenchSummaryResp.ItemDTO> items = new ArrayList<>(); List<WorkbenchSummaryResp.ItemDTO> items = new ArrayList<>();
//处理工单分配状态 待人工处理 待自动处理 全部订单
HashMap<String, Long> methodSummary = this.transAppointmentMethod(this.queryCountByAppointmentMethod(levelType, levelValue, dt)); HashMap<String, Long> methodSummary = this.transAppointmentMethod(this.queryCountByAppointmentMethod(levelType, levelValue, dt));
WorkbenchSummaryResp.ItemDTO methodItem = new WorkbenchSummaryResp.ItemDTO(); WorkbenchSummaryResp.ItemDTO methodItem = new WorkbenchSummaryResp.ItemDTO();
methodItem.setType("order"); methodItem.setType("order");
methodItem.setRows(this.packValueAppointmentMethod(methodSummary)); methodItem.setRows(this.packValueAppointmentMethod(methodSummary));
items.add(methodItem); items.add(methodItem);
// 处理改约。取消。超时等状态
HashMap<String, Long> statusSummary = this.transOrderStatus(this.queryCountByOrderStatus(levelType, levelValue, dt)); HashMap<String, Long> statusSummary = this.transOrderStatus(this.queryCountByOrderStatus(levelType, levelValue, dt));
WorkbenchSummaryResp.ItemDTO statusItem = new WorkbenchSummaryResp.ItemDTO(); WorkbenchSummaryResp.ItemDTO statusItem = new WorkbenchSummaryResp.ItemDTO();
statusItem.setType("order"); statusItem.setType("order");
...@@ -99,7 +110,7 @@ public class WorkbenchServiceImpl implements WorkbenchService { ...@@ -99,7 +110,7 @@ public class WorkbenchServiceImpl implements WorkbenchService {
// - 已延误:已到开始时间,TARO没有反馈开始的工单. // - 已延误:已到开始时间,TARO没有反馈开始的工单.
valueDTOS.add(new WorkbenchSummaryResp.ValueDTO("已延误", queryDelayNum(levelType, levelValue, dt), null, "#FF3D44", "", new HashMap<>())); valueDTOS.add(new WorkbenchSummaryResp.ValueDTO("已延误", queryDelayNum(levelType, levelValue, dt), null, "#FF3D44", "", new HashMap<>()));
statusItem.setRows(valueDTOS); statusItem.setRows(valueDTOS);
// - 已超时:已到开始时间,TARO没有反馈开始的工单. // - 已超时:已过预计结束时间,TARO没有反馈开始的工单.
valueDTOS.add(new WorkbenchSummaryResp.ValueDTO("已超时", queryOvertimeNum(levelType, levelValue, dt), null, "#FF3D44", "", new HashMap<>())); valueDTOS.add(new WorkbenchSummaryResp.ValueDTO("已超时", queryOvertimeNum(levelType, levelValue, dt), null, "#FF3D44", "", new HashMap<>()));
statusItem.setRows(valueDTOS); statusItem.setRows(valueDTOS);
items.add(statusItem); items.add(statusItem);
...@@ -186,6 +197,14 @@ public class WorkbenchServiceImpl implements WorkbenchService { ...@@ -186,6 +197,14 @@ public class WorkbenchServiceImpl implements WorkbenchService {
return rescheduledNum; return rescheduledNum;
} }
/**
* 分组统计订单分配状态
*
* @param levelType
* @param levelValue
* @param dt
* @return
*/
private List<Map<String, Object>> queryCountByAppointmentMethod(String levelType, String levelValue, LocalDate dt) { private List<Map<String, Object>> queryCountByAppointmentMethod(String levelType, String levelValue, LocalDate dt) {
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder(); CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery<Object[]> criteriaQuery = criteriaBuilder.createQuery(Object[].class); CriteriaQuery<Object[]> criteriaQuery = criteriaBuilder.createQuery(Object[].class);
...@@ -278,6 +297,12 @@ public class WorkbenchServiceImpl implements WorkbenchService { ...@@ -278,6 +297,12 @@ public class WorkbenchServiceImpl implements WorkbenchService {
return mappedResults; return mappedResults;
} }
/**
* 组装分组数据
*
* @param results
* @return
*/
private HashMap<String, Long> transAppointmentMethod(List<Map<String, Object>> results) { private HashMap<String, Long> transAppointmentMethod(List<Map<String, Object>> results) {
HashMap<String, Long> map = new HashMap<>(); HashMap<String, Long> map = new HashMap<>();
...@@ -291,15 +316,15 @@ public class WorkbenchServiceImpl implements WorkbenchService { ...@@ -291,15 +316,15 @@ public class WorkbenchServiceImpl implements WorkbenchService {
total += count; total += count;
if (method.equals("MANUAL")) { if (method.equals(AppointmentMethodEnum.MANUAL.name())) {
manualTotal += count; manualTotal += count;
} else if (method.startsWith("AUTO_")) { } else if (method.startsWith("AUTO_")) {
autoTotal += count; autoTotal += count;
} }
if (method.equals("MANUAL") && status.equals("INIT")) { if (method.equals(AppointmentMethodEnum.MANUAL.name()) && status.equals(OrderFlowEnum.INIT.name())) {
map.put("manualDealing", count); map.put("manualDealing", count);
} else if (method.equals("AUTO_") && status.equals("INIT")) { } else if (method.startsWith("AUTO_") && status.equals(OrderFlowEnum.INIT.name())) {
map.put("autoDealing", count); map.put("autoDealing", count);
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!