Commit c175609b by 张晓

Merge branch 'develop' of https://gitlab.dituhui.com/bsh/project/project into develop

2 parents ea6e08f9 e391a7df
...@@ -13,6 +13,7 @@ import com.dituhui.pea.order.dto.DispatchOrderListReq; ...@@ -13,6 +13,7 @@ import com.dituhui.pea.order.dto.DispatchOrderListReq;
import com.dituhui.pea.order.dto.DispatchOrderListResp; import com.dituhui.pea.order.dto.DispatchOrderListResp;
import com.dituhui.pea.order.entity.*; import com.dituhui.pea.order.entity.*;
import com.dituhui.pea.order.service.DispatchService; import com.dituhui.pea.order.service.DispatchService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -31,6 +32,7 @@ interface GroupTag { ...@@ -31,6 +32,7 @@ interface GroupTag {
} }
@Slf4j
@Service @Service
public class DispatchServiceImpl implements DispatchService { public class DispatchServiceImpl implements DispatchService {
...@@ -132,6 +134,7 @@ public class DispatchServiceImpl implements DispatchService { ...@@ -132,6 +134,7 @@ public class DispatchServiceImpl implements DispatchService {
List<EngineerInfo> engineers = this.queryEngineers(teamIds, reqDTO.getEngineerCodes(), reqDTO.getKey()); List<EngineerInfo> engineers = this.queryEngineers(teamIds, reqDTO.getEngineerCodes(), reqDTO.getKey());
if (engineers.isEmpty()) { if (engineers.isEmpty()) {
// 该group下没有技术员,返回空 // 该group下没有技术员,返回空
log.warn("没有找到技术员");
DispatchEngineerOrderListResp res = new DispatchEngineerOrderListResp(); DispatchEngineerOrderListResp res = new DispatchEngineerOrderListResp();
List<DispatchEngineerOrderListResp.EngineerInfo> egs = new ArrayList<>(); List<DispatchEngineerOrderListResp.EngineerInfo> egs = new ArrayList<>();
res.setEngineers(egs); res.setEngineers(egs);
...@@ -147,21 +150,6 @@ public class DispatchServiceImpl implements DispatchService { ...@@ -147,21 +150,6 @@ public class DispatchServiceImpl implements DispatchService {
// 获取技术员的容量 // 获取技术员的容量
HashMap<String, CapacityEngineerStat> engineerCap = this.queryCapacityEngineerStat(engineerCodes, reqDTO.getDate()); HashMap<String, CapacityEngineerStat> engineerCap = this.queryCapacityEngineerStat(engineerCodes, reqDTO.getDate());
// 获取订单ID
Set<String> orderIds = new HashSet<>();
for (String k : engineerOrders.keySet()) {
for (OrderInfo o : engineerOrders.get(k)) {
orderIds.add(o.getOrderId());
}
}
// 获取服务单/工单列表
Map<String, List<OrderInfo>> orders = new HashMap<>();
if (!orderIds.isEmpty()) {
orders = orderInfoMPDao.selectByDtAndOrderIds(date, new ArrayList<>(orderIds)).stream().collect(
Collectors.groupingBy(OrderInfo::getOrderId));
}
// 获取技术员已指派单列表 // 获取技术员已指派单列表
List<DispatchEngineerOrderListResp.EngineerInfo> egs = new ArrayList<>(); List<DispatchEngineerOrderListResp.EngineerInfo> egs = new ArrayList<>();
for (EngineerInfo e : engineers) { for (EngineerInfo e : engineers) {
...@@ -170,13 +158,7 @@ public class DispatchServiceImpl implements DispatchService { ...@@ -170,13 +158,7 @@ public class DispatchServiceImpl implements DispatchService {
// 技术员已指派的订单列表 // 技术员已指派的订单列表
List<OrderInfo> records = engineerOrders.getOrDefault(e.getEngineerCode(), new ArrayList<>()); List<OrderInfo> records = engineerOrders.getOrDefault(e.getEngineerCode(), new ArrayList<>());
for (OrderInfo r : records) { for (OrderInfo o : records) {
// 获取对应的工单信息
if (ListUtils.isEmpty(orders.get(r.getOrderId()))) {
continue;
}
OrderInfo o = orders.get(r.getOrderId()).get(0);
DispatchEngineerOrderListResp.OrderInfo item = new DispatchEngineerOrderListResp.OrderInfo(); DispatchEngineerOrderListResp.OrderInfo item = new DispatchEngineerOrderListResp.OrderInfo();
item.setOrderId(o.getOrderId()); item.setOrderId(o.getOrderId());
...@@ -207,15 +189,15 @@ public class DispatchServiceImpl implements DispatchService { ...@@ -207,15 +189,15 @@ public class DispatchServiceImpl implements DispatchService {
item.setName(o.getName()); item.setName(o.getName());
item.setPhone(o.getPhone()); item.setPhone(o.getPhone());
String time = TimeUtils.timestamp2DateTime(r.getPlanStartTime(), "HH:mm"); String time = TimeUtils.timestamp2DateTime(o.getPlanStartTime(), "HH:mm");
String timeSlot = this.parseTimeSlot(r.getPlanStartTime()); String timeSlot = this.parseTimeSlot(o.getPlanStartTime());
item.setExpectTimeDesc(String.format("%s/%s", time, timeSlot)); item.setExpectTimeDesc(String.format("%s/%s", time, timeSlot));
item.setSource(o.getSource()); item.setSource(o.getSource());
item.setAppointmentStatus(o.getAppointmentStatus()); item.setAppointmentStatus(o.getAppointmentStatus());
item.setAppointmentType(o.getAppointmentMethod()); item.setAppointmentType(o.getAppointmentMethod());
item.setOrderStatus(r.getOrderStatus()); // 预约单状态 item.setOrderStatus(o.getOrderStatus()); // 预约单状态
item.setOrderStatusDesc(r.getOrderStatus()); // 预约单状态描述, TODO item.setOrderStatusDesc(o.getOrderStatus()); // 预约单状态描述, TODO
item.setCreateTime(TimeUtils.IsoTimestamp2DateTime(o.getCreateTime())); item.setCreateTime(TimeUtils.IsoTimestamp2DateTime(o.getCreateTime()));
items.add(item); items.add(item);
...@@ -302,11 +284,11 @@ public class DispatchServiceImpl implements DispatchService { ...@@ -302,11 +284,11 @@ public class DispatchServiceImpl implements DispatchService {
private List<OrderInfo> queryOrders(DispatchOrderListReq reqDTO) { private List<OrderInfo> queryOrders(DispatchOrderListReq reqDTO) {
// 获取服务单列表 // 获取服务单列表
LambdaQueryWrapper<OrderInfo> lqw = new LambdaQueryWrapper<>(); LambdaQueryWrapper<OrderInfo> lqw = new LambdaQueryWrapper<>();
lqw.eq(OrderInfo::getAppointmentStatus, "NOT_ASSIGNED"); // 明确未派工订单 lqw.eq(OrderInfo::getDt, TimeUtils.IsoDate2LocalDate(reqDTO.getDate()));
lqw.eq(OrderInfo::getAppointmentStatus, "INIT"); // 明确未派工订单
lqw.eq(reqDTO.getLevelType().equals("cluster"), OrderInfo::getOrgClusterId, reqDTO.getLevelValue()); lqw.eq(reqDTO.getLevelType().equals("cluster"), OrderInfo::getOrgClusterId, reqDTO.getLevelValue());
lqw.eq(reqDTO.getLevelType().equals("branch"), OrderInfo::getOrgBranchId, reqDTO.getLevelValue()); lqw.eq(reqDTO.getLevelType().equals("branch"), OrderInfo::getOrgBranchId, reqDTO.getLevelValue());
lqw.eq(reqDTO.getLevelType().equals("group"), OrderInfo::getOrgGroupId, reqDTO.getLevelValue()); lqw.eq(reqDTO.getLevelType().equals("group"), OrderInfo::getOrgGroupId, reqDTO.getLevelValue());
lqw.eq(OrderInfo::getDt, TimeUtils.IsoDate2LocalDate(reqDTO.getDate()));
//筛选项 //筛选项
lqw.eq(StringUtils.isNotEmpty(reqDTO.getPhone()), OrderInfo::getPhone, reqDTO.getPhone()); lqw.eq(StringUtils.isNotEmpty(reqDTO.getPhone()), OrderInfo::getPhone, reqDTO.getPhone());
lqw.eq(StringUtils.isNotEmpty(reqDTO.getOrderId()), OrderInfo::getOrderId, reqDTO.getOrderId()); lqw.eq(StringUtils.isNotEmpty(reqDTO.getOrderId()), OrderInfo::getOrderId, reqDTO.getOrderId());
...@@ -362,6 +344,7 @@ public class DispatchServiceImpl implements DispatchService { ...@@ -362,6 +344,7 @@ public class DispatchServiceImpl implements DispatchService {
LambdaQueryWrapper<OrderInfo> lqw = new LambdaQueryWrapper<>(); LambdaQueryWrapper<OrderInfo> lqw = new LambdaQueryWrapper<>();
lqw.eq(OrderInfo::getDt, date); lqw.eq(OrderInfo::getDt, date);
lqw.in(OrderInfo::getAppointmentStatus, List.of("VIRTUAL", "PRE", "CONFIRM"));
lqw.in(OrderInfo::getEngineerCode, engineerCodes); lqw.in(OrderInfo::getEngineerCode, engineerCodes);
lqw.orderByAsc(OrderInfo::getEngineerCode); lqw.orderByAsc(OrderInfo::getEngineerCode);
......
...@@ -33,11 +33,11 @@ public class EngineerGanttServiceImpl implements EngineerGanttService { ...@@ -33,11 +33,11 @@ public class EngineerGanttServiceImpl implements EngineerGanttService {
@Autowired @Autowired
private EngineerBusinessDao engineerBusinessDao; private EngineerBusinessDao engineerBusinessDao;
private String getHourMinute(LocalDateTime time){ private String getHourMinute(LocalDateTime time) {
return this.getHourMinute(time, 0); return this.getHourMinute(time, 0);
} }
private String getHourMinute(LocalDateTime time, int deltaMinute){ private String getHourMinute(LocalDateTime time, int deltaMinute) {
return DateUtils.formatDateTime(time.plusMinutes(deltaMinute), "HH:mm"); return DateUtils.formatDateTime(time.plusMinutes(deltaMinute), "HH:mm");
} }
...@@ -54,48 +54,52 @@ public class EngineerGanttServiceImpl implements EngineerGanttService { ...@@ -54,48 +54,52 @@ public class EngineerGanttServiceImpl implements EngineerGanttService {
List<OrderInfoEntity> orders = orderInfoDao.findByDtAndEngineerCodeIn(reqDTO.getDate(), engineerCodes); List<OrderInfoEntity> orders = orderInfoDao.findByDtAndEngineerCodeIn(reqDTO.getDate(), engineerCodes);
HashMap<String, List<EngineersGanttDTO.Slot>> mapEngineers = new HashMap<>(); HashMap<String, List<EngineersGanttDTO.Slot>> mapEngineers = new HashMap<>();
for (OrderInfoEntity e : orders) { for (OrderInfoEntity order : orders) {
// 服务工单本体 // 服务工单本体
EngineersGanttDTO.Slot slot = new EngineersGanttDTO.Slot(); EngineersGanttDTO.Slot slot = new EngineersGanttDTO.Slot();
// todo 需要根据订单时间和状态,采用expectXXXX或者actualXXXX // todo 需要根据订单时间和状态,采用expectXXXX或者actualXXXX
slot.setOrderId(e.getOrderId()); slot.setOrderId(order.getOrderId());
if (checkOrderIsFinish(e.getServiceStatus())) { if (checkOrderIsFinish(order.getServiceStatus())) {
slot.setBtime(getHourMinute(e.getActualStartTime())); slot.setBtime(getHourMinute(order.getActualStartTime()));
slot.setEtime(getHourMinute(e.getActualEndTime())); slot.setEtime(getHourMinute(order.getActualEndTime()));
} else { } else {
slot.setBtime(getHourMinute(e.getPlanStartTime())); slot.setBtime(getHourMinute(order.getPlanStartTime()));
slot.setEtime(getHourMinute(e.getPlanEndTime())); slot.setEtime(getHourMinute(order.getPlanEndTime()));
} }
slot.setTooltip(getOrderTips(e.getOrderId())); slot.setTooltip(getOrderTips(order));
OrderSkillProjection orderSkill = orderInfoDao.getOrderSkillCaptionByOrderId(e.getOrderId()); OrderSkillProjection orderSkill = orderInfoDao.getOrderSkillCaptionByOrderId(order.getOrderId());
if (orderSkill != null) { if (orderSkill != null) {
slot.setText(orderSkill.getSkillCaption()); slot.setText(orderSkill.getSkillCaption());
} }
slot.setBgColor(e.getAppointmentStatus()); slot.setBgColor(order.getAppointmentStatus());
List<EngineersGanttDTO.Slot> slots = null; List<EngineersGanttDTO.Slot> slots = null;
if (mapEngineers.containsKey(e.getEngineerCode())) { if (mapEngineers.containsKey(order.getEngineerCode())) {
slots = mapEngineers.get(e.getEngineerCode()); slots = mapEngineers.get(order.getEngineerCode());
} else { } else {
slots = new ArrayList<>(); slots = new ArrayList<>();
} }
slot.setBgColor(getColor(e.getServiceStatus())); slot.setBgColor(getColor(order.getServiceStatus()));
if (!order.getAppointmentStatus().equals("CONFIRM")) {
slot.setBorderStyle("dashed"); // 未确认的指派,统一加上虚框
}
slots.add(slot); slots.add(slot);
if(e.getArriveElapsed() > 0) { if (order.getArriveElapsed() > 0) {
// 有在途,起止时间,分别是订单的开始时间减去在途时间、订单的开始时间 // 有在途,起止时间,分别是订单的开始时间减去在途时间、订单的开始时间
slot = new EngineersGanttDTO.Slot(); slot = new EngineersGanttDTO.Slot();
if (checkOrderIsFinish(e.getServiceStatus())) { if (checkOrderIsFinish(order.getServiceStatus())) {
slot.setBtime(getHourMinute(e.getActualStartTime(), -e.getArriveElapsed())); slot.setBtime(getHourMinute(order.getActualStartTime(), -order.getArriveElapsed()));
slot.setEtime(getHourMinute(e.getActualStartTime())); slot.setEtime(getHourMinute(order.getActualStartTime()));
} else { } else {
slot.setBtime(getHourMinute(e.getPlanStartTime(), -e.getArriveElapsed())); slot.setBtime(getHourMinute(order.getPlanStartTime(), -order.getArriveElapsed()));
slot.setEtime(getHourMinute(e.getPlanStartTime())); slot.setEtime(getHourMinute(order.getPlanStartTime()));
} }
slot.setShapeSize("mini"); slot.setShapeSize("mini");
slot.setBgColor(getColor("ONWAY")); slot.setBgColor(getColor("ONWAY"));
slot.setTooltip(getOnwayTips(order));
slots.add(slot); slots.add(slot);
} }
slots.sort(Comparator.comparing(EngineersGanttDTO.Slot::getBtime)); slots.sort(Comparator.comparing(EngineersGanttDTO.Slot::getBtime));
mapEngineers.put(e.getEngineerCode(), slots); mapEngineers.put(order.getEngineerCode(), slots);
} }
log.info("mapEngineers ===> {}", mapEngineers); log.info("mapEngineers ===> {}", mapEngineers);
List<EngineersGanttDTO.GanttChart> engineers = new ArrayList<>(); List<EngineersGanttDTO.GanttChart> engineers = new ArrayList<>();
...@@ -160,30 +164,50 @@ public class EngineerGanttServiceImpl implements EngineerGanttService { ...@@ -160,30 +164,50 @@ public class EngineerGanttServiceImpl implements EngineerGanttService {
} }
} }
private List<LabelValueDTO> getOrderTips(String orderId) { private List<LabelValueDTO> getOnwayTips(OrderInfoEntity order) {
// log.info("==> getOrderTips: orderId[{}]", orderId); // log.info("==> getOrderTips: orderId[{}]", orderId);
OrderInfoEntity order = orderInfoDao.getByOrderId(orderId); List<LabelValueDTO> tips = new ArrayList<>();
if (order == null) { tips.add(new LabelValueDTO().setLabel("工单号码").setValue(order.getOrderId()));
log.error("对应的订单不存在!{}", orderId); String btime = null;
return null; String etime = null;
if (checkOrderIsFinish(order.getServiceStatus())) {
btime = getHourMinute(order.getActualStartTime(), -order.getArriveElapsed());
etime = getHourMinute(order.getActualStartTime());
} else {
btime = getHourMinute(order.getPlanStartTime(), -order.getArriveElapsed());
etime = getHourMinute(order.getPlanStartTime());
}
tips.add(new LabelValueDTO().setLabel("在途路程").setValue(String.format("%s米", order.getArriveDistance())));
tips.add(new LabelValueDTO().setLabel("在途时间").setValue(String.format("%s-%s", btime, etime)));
tips.add(new LabelValueDTO().setLabel("在途耗时").setValue(String.format("%s分钟", order.getArriveElapsed())));
return tips;
} }
private List<LabelValueDTO> getOrderTips(OrderInfoEntity order) {
// log.info("==> getOrderTips: orderId[{}]", orderId);
List<LabelValueDTO> tips = new ArrayList<>(); List<LabelValueDTO> tips = new ArrayList<>();
tips.add(new LabelValueDTO().setLabel("工单号码").setValue(orderId)); tips.add(new LabelValueDTO().setLabel("工单号码").setValue(order.getOrderId()));
tips.add(new LabelValueDTO().setLabel("类型/品牌").setValue(String.format("%s %s", order.getBrand(), order.getType()))); tips.add(new LabelValueDTO().setLabel("品牌/类型/技能").setValue(String.format("%s/%s/%s", order.getBrand(), order.getType(), order.getSkill())));
tips.add(new LabelValueDTO().setLabel("电话/地址").setValue(String.format("%s %s\n %s", order.getName(), order.getPhone(), order.getAddress()))); tips.add(new LabelValueDTO().setLabel("电话/地址").setValue(String.format("%s %s\n %s", order.getName(), order.getPhone(), order.getAddress())));
tips.add(new LabelValueDTO().setLabel("标签").setValue(order.getTags()));
tips.add(new LabelValueDTO().setLabel("耗时").setValue(String.format("%s分钟", order.getTakeTime())));
tips.add(new LabelValueDTO().setLabel("期望时间").setValue(String.format("%s-%s",
DateUtils.formatDateTime(order.getExpectTimeBegin(), "HH:mm"), DateUtils.formatDateTime(order.getExpectTimeEnd(), "HH:mm"))));
tips.add(new LabelValueDTO().setLabel("计划时间").setValue(String.format("%s-%s",
DateUtils.formatDateTime(order.getPlanStartTime(), "HH:mm"), DateUtils.formatDateTime(order.getPlanEndTime(), "HH:mm"))));
if (StringUtils.isNotBlank(order.getApplyNote())) { if (StringUtils.isNotBlank(order.getApplyNote())) {
tips.add(new LabelValueDTO().setLabel("备注").setValue(order.getApplyNote())); tips.add(new LabelValueDTO().setLabel("备注").setValue(order.getApplyNote()));
} }
tips.add(new LabelValueDTO().setLabel("标签").setValue(order.getTags()));
return tips; return tips;
} }
private boolean checkOrderIsFinish(String serviceStatus){
private boolean checkOrderIsFinish(String serviceStatus) {
String[] array = {"FINISHED", "UNFINISHED"}; String[] array = {"FINISHED", "UNFINISHED"};
return Arrays.asList(array).contains(serviceStatus); return Arrays.asList(array).contains(serviceStatus);
} }
private String getColor(String colorType){ private String getColor(String colorType) {
String[][] bgColor = { String[][] bgColor = {
{"INIT", "#FFAA44"}, // 待定 {"INIT", "#FFAA44"}, // 待定
{"FINISHED", "#016FFF"}, //完成 {"FINISHED", "#016FFF"}, //完成
...@@ -196,7 +220,7 @@ public class EngineerGanttServiceImpl implements EngineerGanttService { ...@@ -196,7 +220,7 @@ public class EngineerGanttServiceImpl implements EngineerGanttService {
{"LEAVE", "#A8ABA9"}, //请假 {"LEAVE", "#A8ABA9"}, //请假
{"WAREHOUSE", "#EDEDED"}, //仓库准备 {"WAREHOUSE", "#EDEDED"}, //仓库准备
}; };
Map<String, String> bgColorMap = Arrays.stream(bgColor).collect(Collectors.toMap(pair -> pair[0], pair->pair[1])); Map<String, String> bgColorMap = Arrays.stream(bgColor).collect(Collectors.toMap(pair -> pair[0], pair -> pair[1]));
return bgColorMap.getOrDefault(colorType, "#016FFF"); return bgColorMap.getOrDefault(colorType, "#016FFF");
} }
} }
...@@ -92,10 +92,8 @@ public class ScheduleServiceImpl implements ScheduleService { ...@@ -92,10 +92,8 @@ public class ScheduleServiceImpl implements ScheduleService {
// 技术员指派单列表 // 技术员指派单列表
Map<String, List<OrderInfo>> engineerOrders = new HashMap<>(); Map<String, List<OrderInfo>> engineerOrders = new HashMap<>();
if (ListUtils.isNotEmpty(orders)) { if (ListUtils.isNotEmpty(orders)) {
List<String> orderRequestIds = orders.stream().map(OrderInfo::getOrderId).collect(Collectors.toList()); orders.sort(Comparator.comparing(OrderInfo::getEngineerCode));
List<OrderInfo> orderAppointments = orderInfoMPDao.selectByDtAndOrderIds(date, orderRequestIds); engineerOrders = orders.stream().collect(Collectors.groupingBy(OrderInfo::getEngineerCode));
orderAppointments.sort(Comparator.comparing(OrderInfo::getEngineerCode));
engineerOrders = orderAppointments.stream().collect(Collectors.groupingBy(OrderInfo::getEngineerCode));
} }
// 获取team技术员列表 // 获取team技术员列表
...@@ -106,21 +104,14 @@ public class ScheduleServiceImpl implements ScheduleService { ...@@ -106,21 +104,14 @@ public class ScheduleServiceImpl implements ScheduleService {
List<ScheduleOverviewResp.Item> children = new ArrayList<>(); List<ScheduleOverviewResp.Item> children = new ArrayList<>();
for (Map.Entry<String, List<EngineerInfo>> entry : engineers.entrySet()) { for (Map.Entry<String, List<EngineerInfo>> entry : engineers.entrySet()) {
ScheduleOverviewResp.Item child = new ScheduleOverviewResp.Item(); ScheduleOverviewResp.Item child = new ScheduleOverviewResp.Item();
//技术员信息 //技术员信息
String engineerCode = entry.getKey(); String engineerCode = entry.getKey();
EngineerInfo engineerInfo = entry.getValue().get(0); EngineerInfo engineerInfo = entry.getValue().get(0);
List<String> orderIds = engineerOrders.getOrDefault(engineerCode, new ArrayList<>()).stream().map(OrderInfo::getOrderId).collect(Collectors.toList()); // 获取技术员已经指派的订单列表
List<OrderInfo> orders2 = engineerOrders.getOrDefault(engineerCode, new ArrayList<>());
List<OrderInfo> orders2 = new ArrayList<>();
for (OrderInfo o : orders) {
if (orderIds.contains(o.getOrderId())) {
orders2.add(o);
}
}
child.setName(engineerInfo.getName()); child.setName(engineerInfo.getName());
child.setValue(engineerCode); child.setValue(engineerCode);
...@@ -258,7 +249,7 @@ public class ScheduleServiceImpl implements ScheduleService { ...@@ -258,7 +249,7 @@ public class ScheduleServiceImpl implements ScheduleService {
LambdaQueryWrapper<OrderInfo> lqw = new LambdaQueryWrapper<>(); LambdaQueryWrapper<OrderInfo> lqw = new LambdaQueryWrapper<>();
lqw.eq(OrderInfo::getDt, date); lqw.eq(OrderInfo::getDt, date);
lqw.in(OrderInfo::getOrgTeamId, teamId); lqw.in(OrderInfo::getOrgTeamId, teamId);
lqw.eq(OrderInfo::getAppointmentStatus, "CONFIRM"); lqw.in(OrderInfo::getAppointmentStatus, List.of("VIRTUAL", "PRE", "CONFIRM"));
return orderInfoMPDao.selectList(lqw); return orderInfoMPDao.selectList(lqw);
} }
......
...@@ -102,13 +102,13 @@ public class WorkbenchServiceImpl implements WorkbenchService { ...@@ -102,13 +102,13 @@ public class WorkbenchServiceImpl implements WorkbenchService {
private List<Map<String, Object>> queryCountByOrderStatus(String levelType, String levelValue, LocalDate dt) { private List<Map<String, Object>> queryCountByOrderStatus(String levelType, String levelValue, LocalDate dt) {
QueryWrapper<OrderInfo> wrapper = new QueryWrapper<>(); QueryWrapper<OrderInfo> wrapper = new QueryWrapper<>();
wrapper.select("appointment_status, COUNT(*) as count") wrapper.select("service_status, COUNT(*) as count")
.lambda() .lambda()
.eq(OrderInfo::getDt, dt) .eq(OrderInfo::getDt, dt)
.eq(levelType.equals("cluster"), OrderInfo::getOrgClusterId, levelValue) .eq(levelType.equals("cluster"), OrderInfo::getOrgClusterId, levelValue)
.eq(levelType.equals("branch"), OrderInfo::getOrgBranchId, levelValue) .eq(levelType.equals("branch"), OrderInfo::getOrgBranchId, levelValue)
.eq(levelType.equals("group"), OrderInfo::getOrgGroupId, levelValue) .eq(levelType.equals("group"), OrderInfo::getOrgGroupId, levelValue)
.groupBy(OrderInfo::getAppointmentStatus); .groupBy(OrderInfo::getServiceStatus);
return orderInfoMPDao.selectMaps(wrapper); return orderInfoMPDao.selectMaps(wrapper);
} }
...@@ -131,9 +131,9 @@ public class WorkbenchServiceImpl implements WorkbenchService { ...@@ -131,9 +131,9 @@ public class WorkbenchServiceImpl implements WorkbenchService {
autoTotal += count; autoTotal += count;
} }
if (method.equals("MANUAL") && status.equals("NOT_ASSIGNED")) { if (method.equals("MANUAL") && status.equals("INIT")) {
map.put("manualDealing", count); map.put("manualDealing", count);
} else if (method.equals("AUTO_") && status.equals("NOT_ASSIGNED")) { } else if (method.equals("AUTO_") && status.equals("INIT")) {
map.put("autoDealing", count); map.put("autoDealing", count);
} }
} }
...@@ -147,7 +147,7 @@ public class WorkbenchServiceImpl implements WorkbenchService { ...@@ -147,7 +147,7 @@ public class WorkbenchServiceImpl implements WorkbenchService {
HashMap<String, Long> map = new HashMap<>(); HashMap<String, Long> map = new HashMap<>();
for (Map<String, Object> result : results) { for (Map<String, Object> result : results) {
String status = (String) result.get("appointment_status"); String status = (String) result.get("service_status");
Long count = (long) result.get("count"); Long count = (long) result.get("count");
map.put(status, count); map.put(status, count);
} }
...@@ -164,7 +164,7 @@ public class WorkbenchServiceImpl implements WorkbenchService { ...@@ -164,7 +164,7 @@ public class WorkbenchServiceImpl implements WorkbenchService {
Long autoTotal = summary.getOrDefault("autoTotal", 0L); Long autoTotal = summary.getOrDefault("autoTotal", 0L);
Long total = summary.getOrDefault("total", 0L); Long total = summary.getOrDefault("total", 0L);
HashMap<String, List<String>> p = this.packParams("appointmentStatus", "NOT_ASSIGNED"); HashMap<String, List<String>> p = this.packParams("appointmentStatus", "INIT");
HashMap<String, List<String>> p1 = this.packParams("appointmentType", "MANUAL"); HashMap<String, List<String>> p1 = this.packParams("appointmentType", "MANUAL");
p1.putAll(p); p1.putAll(p);
...@@ -182,20 +182,19 @@ public class WorkbenchServiceImpl implements WorkbenchService { ...@@ -182,20 +182,19 @@ public class WorkbenchServiceImpl implements WorkbenchService {
List<WorkbenchSummaryResp.ValueDTO> items = new ArrayList<>(); List<WorkbenchSummaryResp.ValueDTO> items = new ArrayList<>();
String urlName = ""; // 不返回,前端就不跳转了 String urlName = ""; // 不返回,前端就不跳转了
Long assigned = summary.getOrDefault("ASSIGNED", 0L);
Long contacted = summary.getOrDefault("CONTACTED", 0L); Long assigned = summary.getOrDefault("INIT", 0L);
Long departed = summary.getOrDefault("DEPARTED", 0L); Long pending = summary.getOrDefault("PENDING", 0L);
Long dealing = assigned + contacted + departed; Long dealing = assigned + pending;
Long started = summary.getOrDefault("STARTED", 0L); Long started = summary.getOrDefault("STARTED", 0L);
Long cancel = summary.getOrDefault("CANCELED", 0L); Long finished = summary.getOrDefault("FINISHED", 0L) + summary.getOrDefault("UNFINISHED", 0L);
Long finished = summary.getOrDefault("FINISHED", 0L);
Long cancel = 0L;
HashMap<String, List<String>> p1 = this.packParams("appointmentStatus", "ASSIGNED", "CONTACTED", "DEPARTED"); HashMap<String, List<String>> p1 = this.packParams("appointmentStatus", "ASSIGNED", "CONTACTED", "DEPARTED");
items.add(new WorkbenchSummaryResp.ValueDTO("待上门", dealing.toString(), null, "#469967", urlName, p1)); items.add(new WorkbenchSummaryResp.ValueDTO("待上门", dealing.toString(), null, "#469967", urlName, p1));
HashMap<String, List<String>> p2 = this.packParams("appointmentStatus", "STARTED"); HashMap<String, List<String>> p2 = this.packParams("appointmentStatus", "STARTED");
items.add(new WorkbenchSummaryResp.ValueDTO("服务中", started.toString(), null, "#016FFF", urlName, p2)); items.add(new WorkbenchSummaryResp.ValueDTO("服务中", started.toString(), null, "#016FFF", urlName, p2));
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!