Commit 915fee62 by chamberone

Merge branch 'develop' of https://zhangguoping@gitlab.dituhui.com/bsh/project/pr…

…oject.git into develop
2 parents 3495104d 730790c9
......@@ -50,7 +50,7 @@ public class DispatchController {
// 派工台确认派单
Result<?> res = null;
try {
res = dispatchService.dispatchOrderConfirm(req.getEngineerCode(), req.getOrderIds());
res = dispatchService.dispatchOrderConfirm(req.getEngineerCode(), req.getDate(), req.getOrderIds());
}catch (BusinessException e){
return Result.failed(e.getMessage());
}
......
package com.dituhui.pea.order.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dituhui.pea.order.entity.OrderInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.time.LocalDate;
import java.util.List;
@Mapper
public interface OrderInfoMPDao extends BaseMapper<OrderInfo> {
@Select("select * from order_info where order_id=#{orderId} order by dt desc")
OrderInfo getByOrderId(String orderId);
@Select("select * from order_info where order_id=#{orderId} and dt=#{dt}")
OrderInfo getByOrderIdAndDt(String orderId, LocalDate dt);
@Select("select * from order_info where order_id=#{orderId}")
List<OrderInfo> selectByOrderId(String orderId);
@Select("<script> select * from order_request where dt=#{dt} and order_id in " +
"<foreach item='orderId' index='index' collection='orderIds' open='(' separator=',' close=')'>#{orderId}</foreach></script>")
List<OrderInfo> selectByDtAndOrderIds(@Param("dt") LocalDate dt, @Param("orderIds") List<String> orderIds);
@Select("select * from order_info where dt=#{dt} and engineerCode=#{engineerCode}")
List<OrderInfo> selectByEngineerCodeAndDt(String engineerCode, LocalDate dt);
@Select("select * from order_info where dt=#{dt} and engineerCode=#{engineerCode} and appointment_status=#{appointmentStatus}")
List<OrderInfo> selectByEngineerCodeAndDtAndAppointmentStatus(String engineerCode, LocalDate dt, String appointmentStatus);
}
......@@ -7,5 +7,6 @@ import java.util.List;
@Data
public class DispatchOrderConfirmReqDTO {
private String engineerCode;
private String date;
private List<String> orderIds;
}
package com.dituhui.pea.order.entity;
import lombok.Data;
import java.sql.Timestamp;
import java.time.LocalDate;
@Data
public class OrderInfo {
private Long id;
private String orderId;
private LocalDate dt;
private String subId;
private String name;
private String phone;
private String address;
private String x;
private String y;
private String province;
private String city;
private String county;
private String brand;
private String type;
private String skill;
private String applyNote;
private String faultDescribe;
private Timestamp expectTimeBegin;
private Timestamp expectTimeEnd;
private String expectTimeDesc;
private String source;
private String beanPriority;
private String beanTags;
private String beanStatus;
private String beanSubStatus;
private String areaId;
private String orgClusterId;
private String orgBranchId;
private String orgGroupId;
private String orgTeamId;
private Integer priority;
private String tags;
private String appointmentStatus;
private String appointmentMethod;
private String orderStatus;
private String serviceStatus;
private String engineerCode;
private String engineerName;
private String engineerPhone;
private String engineerCodeSub;
private Timestamp planStartTime;
private Timestamp planEndTime;
private Integer arriveElapsed;
private Integer arriveDistance;
private Timestamp actualStartTime;
private Timestamp actualEndTime;
private String description;
private Timestamp createTime;
private Timestamp updateTime;
}
\ No newline at end of file
......@@ -12,5 +12,5 @@ public interface DispatchService {
Result<?> getDispatchEngineerOrderList(DispatchEngineerOrderListReq reqDTO);
Result<?> dispatchOrderConfirm(String engineerCode, List<String> orderIds);
Result<?> dispatchOrderConfirm(String engineerCode, String date, List<String> orderIds);
}
......@@ -59,8 +59,8 @@ public class EngineerGanttServiceImpl implements EngineerGanttService {
EngineersGanttDTO.Slot slot = new EngineersGanttDTO.Slot();
// todo 需要根据订单时间和状态,采用expectXXXX或者actualXXXX
slot.setOrderId(e.getOrderId());
slot.setBtime(getHourMinute(e.getExpectTimeBegin()));
slot.setEtime(getHourMinute(e.getExpectTimeEnd()));
slot.setBtime(getHourMinute(e.getPlanStartTime()));
slot.setEtime(getHourMinute(e.getPlanEndTime()));
slot.setTooltip(getOrderTips(e.getOrderId()));
OrderSkillProjection orderSkill = orderInfoDao.getOrderSkillCaptionByOrderId(e.getOrderId());
if (orderSkill != null) {
......@@ -78,8 +78,8 @@ public class EngineerGanttServiceImpl implements EngineerGanttService {
if(e.getArriveElapsed() > 0) {
// 有在途,起止时间,分别是订单的开始时间减去在途时间、订单的开始时间
slot = new EngineersGanttDTO.Slot();
slot.setBtime(getHourMinute(e.getExpectTimeBegin(), -e.getArriveElapsed()));
slot.setEtime(getHourMinute(e.getExpectTimeBegin()));
slot.setBtime(getHourMinute(e.getPlanStartTime(), -e.getArriveElapsed()));
slot.setEtime(getHourMinute(e.getPlanStartTime()));
slot.setShapeSize("mini");
slot.setBgColor(getColor("ONWAY"));
slots.add(slot);
......
......@@ -30,10 +30,7 @@ import java.util.stream.Collectors;
public class OrderAssignImpl implements OrderAssign {
@Autowired
private OrderRequestMPDao orderRequestMPDao;
@Autowired
private OrderAppointmentMPDao orderAppointmentMPDao;
private OrderInfoMPDao orderInfoMPDao;
@Autowired
private EngineerInfoMPDao engineerInfoMPDao;
......@@ -63,7 +60,7 @@ public class OrderAssignImpl implements OrderAssign {
@Override
public Result<?> getOrderAssignRecommendEngineers(String orderId, String key, String distance, String recommend) {
// 服务单指派-推荐技术员列表
OrderRequest order = orderRequestMPDao.getByOrderId(orderId);
OrderInfo order = orderInfoMPDao.getByOrderId(orderId);
if (order == null) {
throw new BusinessException("订单不存在");
}
......@@ -84,13 +81,13 @@ public class OrderAssignImpl implements OrderAssign {
}
// 获取已技术员已指派订单列表
List<OrderAppointment> orderAppointments = orderAppointmentMPDao.selectByEngineerCodeAndDt(engineer.getEngineerCode(), order.getDt());
List<OrderInfo> orderAppointments = orderInfoMPDao.selectByEngineerCodeAndDtAndAppointmentStatus(engineer.getEngineerCode(), order.getDt(), "CONFIRM");
// 获取订单tips
HashMap<String, List<LabelValueDTO>> orderTips = new HashMap<>();
List<String> orderIds = orderAppointments.stream().map(OrderAppointment::getOrderId).collect(Collectors.toList());
List<String> orderIds = orderAppointments.stream().map(OrderInfo::getOrderId).collect(Collectors.toList());
if (!orderIds.isEmpty()) {
List<OrderRequest> orders = orderRequestMPDao.selectByOrderIds(orderIds);
List<OrderInfo> orders = orderInfoMPDao.selectByDtAndOrderIds(TimeUtils.IsoDate2LocalDate(date), orderIds);
orderTips = this.packOrderTips(orders);
}
......@@ -126,7 +123,8 @@ public class OrderAssignImpl implements OrderAssign {
@Override
public Result<?> orderAssign(String orderId, String engineerCode) throws BusinessException {
// 服务单指派-指派提交
OrderRequest order = orderRequestMPDao.getByOrderId(orderId);
OrderInfo order = orderInfoMPDao.getByOrderId(orderId);
if (order == null) {
throw new BusinessException("订单不存在");
}
......@@ -134,7 +132,7 @@ public class OrderAssignImpl implements OrderAssign {
EngineerInfo engineer = engineerInfoMPDao.getByEngineerCode(engineerCode);
boolean record = false;
OrderAppointment op = orderAppointmentMPDao.getByOrderIdAndDt(orderId, order.getDt());
OrderInfo op = orderInfoMPDao.getByOrderIdAndDt(orderId, order.getDt());
if (op != null) {
record = true;
}
......@@ -148,39 +146,17 @@ public class OrderAssignImpl implements OrderAssign {
if (!result.getCanAssign()) {
throw new BusinessException("指派失败, 未能找到合适的时间段, 请选择其他技术员");
}
Timestamp expectStartTime = Timestamp.valueOf(result.getStart());
Timestamp expectEndTime = Timestamp.valueOf(result.getEnd());
// 更新或插入指派单
if (!record) {
op = new OrderAppointment();
}
op.setOrderId(orderId);
op.setSuborderId(Long.toString(System.currentTimeMillis()));
op.setMainSub(1);
op.setEngineerCode(engineerCode);
op.setEngineerName(engineer.getName());
op.setEngineerAge(0);
op.setEngineerPhone(engineer.getPhone());
op.setIsWorkshop(0);
op.setDt(order.getDt());
op.setExpectStartTime(expectStartTime);
op.setExpectEndTime(expectEndTime);
op.setPreStatus("CONFIRM");
op.setStatus("ASSIGNED");
if (!record) {
orderAppointmentMPDao.insert(op);
} else {
orderAppointmentMPDao.updateById(op);
}
Timestamp planStartTime = Timestamp.valueOf(result.getStart());
Timestamp planEndTime = Timestamp.valueOf(result.getEnd());
// 更新order_request表状态
LambdaUpdateWrapper<OrderRequest> wrapper = new LambdaUpdateWrapper<>();
wrapper.set(OrderRequest::getAppointmentStatus, "ASSIGNED");
wrapper.set(OrderRequest::getAppointmentMethod, "MANUAL");
wrapper.eq(OrderRequest::getOrderId, orderId);
orderRequestMPDao.update(null, wrapper);
LambdaUpdateWrapper<OrderInfo> wrapper = new LambdaUpdateWrapper<>();
wrapper.set(OrderInfo::getAppointmentStatus, "CONFIRM");
wrapper.set(OrderInfo::getAppointmentMethod, "MANUAL");
wrapper.set(OrderInfo::getPlanStartTime, planStartTime);
wrapper.set(OrderInfo::getPlanEndTime, planEndTime);
wrapper.eq(OrderInfo::getOrderId, orderId);
orderInfoMPDao.update(null, wrapper);
// 工单变更登记
commonService.addOrderEvent(orderId, "", "PEA-WEB", "API", "工单指派", "工单指派", "");
......@@ -190,20 +166,16 @@ public class OrderAssignImpl implements OrderAssign {
@Override
public Result<?> orderRevokeAssign(String orderId) throws BusinessException {
OrderRequest order = orderRequestMPDao.getByOrderId(orderId);
// 放回工单池
OrderInfo order = orderInfoMPDao.getByOrderId(orderId);
if (order == null) {
throw new BusinessException("订单不存在");
}
// 更新order_request表为未指派
order.setAppointmentStatus("NOT_ASSIGNED");
orderRequestMPDao.updateById(order);
// 更新order_appointment表为未指派
LambdaUpdateWrapper<OrderAppointment> appWrapper = new LambdaUpdateWrapper<>();
appWrapper.set(OrderAppointment::getStatus, "NOT_ASSIGNED")
.eq(OrderAppointment::getOrderId, orderId).eq(OrderAppointment::getDt, order.getDt());
orderAppointmentMPDao.update(null, appWrapper);
order.setAppointmentStatus("INIT");
orderInfoMPDao.updateById(order);
// 登记事件
OrderEvent oe = new OrderEvent();
......@@ -225,7 +197,8 @@ public class OrderAssignImpl implements OrderAssign {
@Override
public Result<?> orderReschedule(String orderId, LocalDateTime expectBegin, LocalDateTime expectEnd, String expectDesc) throws BusinessException {
// 工单改约接口(当前同放回工单池处理)
OrderRequest order = orderRequestMPDao.getByOrderId(orderId);
OrderInfo order = orderInfoMPDao.getByOrderId(orderId);
if (order == null) {
throw new BusinessException("订单不存在");
}
......@@ -239,18 +212,12 @@ public class OrderAssignImpl implements OrderAssign {
LocalDate originDate = order.getDt(); // 改约前的日期
// 更新order_request表为未指派
order.setAppointmentStatus("NOT_ASSIGNED");
order.setAppointmentStatus("INIT");
order.setDt(expectBegin.toLocalDate());
order.setExpectTimeBegin(Timestamp.valueOf(expectBegin));
order.setExpectTimeEnd(Timestamp.valueOf(expectEnd));
order.setExpectTimeDesc(expectDesc);
orderRequestMPDao.updateById(order);
// 更新order_appointment表为未指派
LambdaUpdateWrapper<OrderAppointment> appWrapper = new LambdaUpdateWrapper<>();
appWrapper.set(OrderAppointment::getStatus, "RESCHEDULED")
.eq(OrderAppointment::getOrderId, orderId).eq(OrderAppointment::getDt, originDate);
orderAppointmentMPDao.update(null, appWrapper);
orderInfoMPDao.updateById(order);
// 登记事件
OrderEvent oe = new OrderEvent();
......@@ -269,7 +236,7 @@ public class OrderAssignImpl implements OrderAssign {
return Result.success(null);
}
private List<String> searchEngineerCodes(OrderRequest order, String distance, String key, String recommend) {
private List<String> searchEngineerCodes(OrderInfo order, String distance, String key, String recommend) {
Set<String> engineerCodes1 = this.searchEngineerByRecommend(order, recommend);
if (engineerCodes1.isEmpty()) {
log.info("recommend:{}筛选条件未找到技术员", recommend);
......@@ -316,7 +283,7 @@ public class OrderAssignImpl implements OrderAssign {
return new ArrayList<>(engineerCodes1);
}
private Set<String> searchEngineerByRecommend(OrderRequest order, String recommend) {
private Set<String> searchEngineerByRecommend(OrderInfo order, String recommend) {
if (StringUtils.isNotEmpty(recommend) && recommend.equals("team")) {
return orgTeamEngineerMPDao.selectByTeamId(order.getOrgTeamId()).stream().map(OrgTeamEngineer::getEngineerCode).collect(Collectors.toSet());
}
......@@ -355,18 +322,17 @@ public class OrderAssignImpl implements OrderAssign {
return engineerInfoMPDao.selectList(lqw).stream().map(EngineerInfo::getEngineerCode).collect(Collectors.toSet());
}
private List<TimeLineDTO> packTimelines(List<OrderAppointment> orders, HashMap<String, List<LabelValueDTO>> orderTips) {
private List<TimeLineDTO> packTimelines(List<OrderInfo> orders, HashMap<String, List<LabelValueDTO>> orderTips) {
List<LabelValueDTO> empty = new ArrayList<>();
List<TimeLineDTO> items = new ArrayList<>();
for (OrderAppointment order : orders) {
for (OrderInfo order : orders) {
TimeLineDTO item = new TimeLineDTO();
item.setOrderId(order.getOrderId());
item.setPreStatus(order.getPreStatus());
item.setAppointmentStatus(order.getStatus());
item.setStartTime(TimeUtils.IsoTimestamp2DateTime(order.getExpectStartTime()));
item.setEndTime(TimeUtils.IsoTimestamp2DateTime(order.getExpectEndTime()));
item.setAppointmentStatus(order.getAppointmentStatus());
item.setStartTime(TimeUtils.IsoTimestamp2DateTime(order.getPlanStartTime()));
item.setEndTime(TimeUtils.IsoTimestamp2DateTime(order.getPlanEndTime()));
item.setTips(orderTips.getOrDefault(order.getOrderId(), empty));
items.add(item);
......@@ -374,12 +340,12 @@ public class OrderAssignImpl implements OrderAssign {
return items;
}
private HashMap<String, List<LabelValueDTO>> packOrderTips(List<OrderRequest> orders) {
private HashMap<String, List<LabelValueDTO>> packOrderTips(List<OrderInfo> orders) {
return orders.stream().collect(Collectors.toMap(
OrderRequest::getOrderId, this::packOrderTip, (l1, l2) -> l1, HashMap::new));
OrderInfo::getOrderId, this::packOrderTip, (l1, l2) -> l1, HashMap::new));
}
private List<LabelValueDTO> packOrderTip(OrderRequest order) {
private List<LabelValueDTO> packOrderTip(OrderInfo order) {
// pack订单tips
List<LabelValueDTO> items = new ArrayList<>();
items.add(new LabelValueDTO("类型/品牌", String.format("%s %s %s", order.getSkill(), order.getType(), order.getBrand())));
......
......@@ -126,6 +126,9 @@ public class OrderCreateServiceImpl implements OrderCreateService {
entity.setExpectTimeBegin(LocalDateTimeUtil.parse(req.getExpectBegin(), PATTERN_DATETIME));
entity.setExpectTimeEnd(LocalDateTimeUtil.parse(req.getExpectEnd(), PATTERN_DATETIME));
entity.setExpectTimeDesc(req.getExpectDesc());
// 使用期望时间来初始化计划时间,后面在指派环节更新为真正的有效的计划时间
entity.setPlanStartTime(entity.getExpectTimeBegin());
entity.setPlanEndTime(entity.getExpectTimeEnd());
entity.setApplyNote(req.getDescription()); // order_request的description字段,仅仅用于内部备注,不对外
entity.setDt(LocalDateTimeUtil.parseDate(req.getExpectBegin().substring(0, 10), PATTERN_DATE));
entity.setSubId(newSubId(entity.getOrderId(), entity.getDt()));
......
......@@ -22,10 +22,7 @@ import java.util.stream.Collectors;
public class OrderServiceDetailImpl implements OrderServiceDetail {
@Autowired
private OrderRequestMPDao orderRequestMPDao;
@Autowired
private OrderAppointmentMPDao orderAppointmentMPDao;
private OrderInfoMPDao orderInfoMPDao;
@Autowired
private EngineerInfoMPDao engineerInfoMPDao;
......@@ -45,11 +42,12 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
@Autowired
private SkillInfoMPDao skillInfoMPDao;
@Transactional
@Override
public Result<?> getOrderServiceDetail(String orderId) {
OrderRequest order = orderRequestMPDao.getByOrderId(orderId);
OrderInfo order = orderInfoMPDao.getByOrderId(orderId);
List<KV> items = this.packOrderDetail(order);
......@@ -66,8 +64,8 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
res.setOrderId(orderId);
res.setRisk("");
res.setRiskDesc("");
res.setStatusDesc("打开");
res.setStatus(order.getStatus());
res.setStatusDesc("正常");
res.setStatus(order.getOrderStatus());
res.setAppointmentStatus(order.getAppointmentStatus());
res.setLocation(String.format("%s,%s", order.getX(), order.getY()));
res.setReschedulingParams(detail);
......@@ -94,52 +92,44 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
@Transactional
@Override
public Result<?> getOrderAppointmentList(String orderId) throws BusinessException{
public Result<?> getOrderAppointmentList(String orderId) throws BusinessException {
// 获取预约单里列表
OrderAppointmentListResp res = new OrderAppointmentListResp();
OrderRequest order = orderRequestMPDao.getByOrderId(orderId);
if(order == null){
throw new BusinessException("订单不存在");
}
LocalDate curDate = order.getDt();
// 查询预约单列表
List<OrderAppointment> appoints = orderAppointmentMPDao.selectByOrderId(orderId);
if (appoints.isEmpty()) {
List<OrderInfo> orders = orderInfoMPDao.selectByOrderId(orderId);
if (orders.isEmpty()) {
// 没有指派单列表,返回
res.setOrderId(orderId);
res.setOrders(new ArrayList<>());
return Result.success(res);
}
// 工程师ID列表
List<String> egCodes = appoints.stream().map(OrderAppointment::getEngineerCode).collect(Collectors.toList());
// 获取工程师基础信息列表
HashMap<String, EngineerInfo> egInfo = this.getEngineerInfos(egCodes);
Set<String> set = new HashSet<>();
orders.stream().map(OrderInfo::getEngineerCode).forEach(set::add);
orders.stream().map(OrderInfo::getEngineerCodeSub).forEach(set::add);
List<String> engineerCodes = new ArrayList<>(set);
HashMap<String, EngineerInfo> egInfo = this.getEngineerInfos(engineerCodes);
// 获取groupIds 和 group信息
List<String> groupIds = egInfo.values().stream().map(EngineerInfo::getGroupId).collect(Collectors.toList());
HashMap<String, OrgGroup> groups = this.queryOrgGroups(groupIds);
// 获取工程师技能列表<engineerCode, skills>
Map<String, String> egSkill = this.getEngineerSkills(egCodes);
Map<String, String> egSkill = this.getEngineerSkills(engineerCodes);
// 获取subOrder订单timeline
Map<String, List<OrderTimeline>> timelines = this.getOrderTimelines(orderId);
// 对指派单列表按照subOrderId降序排序, 获取排序的subOrderId列表, 然后根据subOrderId分组
Comparator<OrderAppointment> sbDesc = Comparator.comparing(OrderAppointment::getSuborderId, String.CASE_INSENSITIVE_ORDER).reversed();
List<OrderAppointment> results = appoints.stream().sorted(sbDesc).collect(Collectors.toList());
Comparator<OrderInfo> dtDesc = Comparator.comparing(OrderInfo::getDt).reversed();
List<OrderInfo> results = orders.stream().sorted(dtDesc).collect(Collectors.toList());
String lastSubOrderId = results.get(0).getSuborderId();
LocalDate lastDt = results.get(0).getDt();
List<OrderAppointmentListResp.OrderAppointment> items = new ArrayList<>();
for (OrderAppointment o : results) {
String subOrderId = o.getSuborderId();
for (OrderInfo o : results) {
EngineerInfo eg = egInfo.getOrDefault(o.getEngineerCode(), null);
String skill = egSkill.getOrDefault(o.getEngineerCode(), null);
......@@ -148,15 +138,15 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
// 获取title
String title = engineerName;
if (!lastSubOrderId.equals(subOrderId) || o.getDt().isBefore(curDate)) {
if (o.getDt().isBefore(lastDt)) {
title = String.format("%s_%s", engineerName, TimeUtils.IsoLocalDate2String(o.getDt()));
}
OrderAppointmentListResp.OrderAppointment item = new OrderAppointmentListResp.OrderAppointment();
item.setTitle(title);
item.setEngineerCode(o.getEngineerCode());
item.setExpectTime(TimeUtils.IsoTimestamp2DateTime(o.getExpectStartTime()));
item.setTimelines(this.packOrderTimeline(timelines.get(subOrderId)));
item.setExpectTime(TimeUtils.IsoTimestamp2DateTime(o.getExpectTimeBegin()));
item.setTimelines(this.packOrderTimeline(timelines.get(o.getSubId())));
item.setItems(this.packEngineerItems(eg, skill, groups.get(eg.getGroupId())));
items.add(item);
......@@ -173,7 +163,7 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
List<String> block = new ArrayList<>();
// 获取订单详情
OrderRequest order = orderRequestMPDao.getByOrderId(orderId);
OrderInfo order = orderInfoMPDao.getByOrderId(orderId);
OrderTeamBlockResp res = new OrderTeamBlockResp();
res.setOrderId(orderId);
......@@ -236,7 +226,6 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
Comparator<EngineerSkillGroup> cmp = Comparator.comparing(EngineerSkillGroup::getEngineerCode);
List<EngineerSkillGroup> sortedResults = rows.stream().sorted(cmp).collect(Collectors.toList());
// 根据engineerCode分组
Map<String, List<EngineerSkillGroup>> results = sortedResults.stream().collect(Collectors.groupingBy(EngineerSkillGroup::getEngineerCode));
......@@ -339,11 +328,11 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
return items;
}
private List<KV> packOrderDetail(OrderRequest order) {
private List<KV> packOrderDetail(OrderInfo order) {
List<KV> items = new ArrayList<>();
items.add(this.packOrderItem("客户姓名", order.getName()));
items.add(this.packOrderItem("客户电话", order.getPhone()));
items.add(this.packOrderItem("客户地址", String.format("%s%s%s",order.getCity(), order.getCounty(), order.getAddress())));
items.add(this.packOrderItem("客户地址", String.format("%s%s%s", order.getCity(), order.getCounty(), order.getAddress())));
items.add(this.packOrderItem("品牌", order.getBrand()));
items.add(this.packOrderItem("设备", order.getType()));
items.add(this.packOrderItem("服务", order.getSkill()));
......
......@@ -8,7 +8,7 @@ import com.dituhui.pea.order.dto.OrderChangeListDTO;
import com.dituhui.pea.order.dto.WorkbenchSummaryResp;
import com.dituhui.pea.order.entity.OrderEventEntity;
import com.dituhui.pea.order.entity.OrderInfoEntity;
import com.dituhui.pea.order.entity.OrderRequest;
import com.dituhui.pea.order.entity.OrderInfo;
import com.dituhui.pea.order.service.WorkbenchService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -28,7 +28,7 @@ public class WorkbenchServiceImpl implements WorkbenchService {
private OrderEventDao orderEventDao;
@Autowired
private OrderRequestMPDao orderRequestMPDao;
private OrderInfoMPDao orderInfoMPDao;
@Autowired
private OrderInfoDao orderInfoDao;
......@@ -89,27 +89,27 @@ public class WorkbenchServiceImpl implements WorkbenchService {
}
private List<Map<String, Object>> queryCountByAppointmentMethod(String levelType, String levelValue, LocalDate dt) {
QueryWrapper<OrderRequest> wrapper = new QueryWrapper<>();
QueryWrapper<OrderInfo> wrapper = new QueryWrapper<>();
wrapper.select("appointment_method, appointment_status, COUNT(*) as count")
.lambda()
.eq(OrderRequest::getDt, dt)
.eq(levelType.equals("cluster"), OrderRequest::getOrgClusterId, levelValue)
.eq(levelType.equals("branch"), OrderRequest::getOrgBranchId, levelValue)
.eq(levelType.equals("group"), OrderRequest::getOrgGroupId, levelValue)
.groupBy(OrderRequest::getAppointmentMethod, OrderRequest::getAppointmentStatus);
return orderRequestMPDao.selectMaps(wrapper);
.eq(OrderInfo::getDt, dt)
.eq(levelType.equals("cluster"), OrderInfo::getOrgClusterId, levelValue)
.eq(levelType.equals("branch"), OrderInfo::getOrgBranchId, levelValue)
.eq(levelType.equals("group"), OrderInfo::getOrgGroupId, levelValue)
.groupBy(OrderInfo::getAppointmentMethod, OrderInfo::getAppointmentStatus);
return orderInfoMPDao.selectMaps(wrapper);
}
private List<Map<String, Object>> queryCountByOrderStatus(String levelType, String levelValue, LocalDate dt) {
QueryWrapper<OrderRequest> wrapper = new QueryWrapper<>();
QueryWrapper<OrderInfo> wrapper = new QueryWrapper<>();
wrapper.select("appointment_status, COUNT(*) as count")
.lambda()
.eq(OrderRequest::getDt, dt)
.eq(levelType.equals("cluster"), OrderRequest::getOrgClusterId, levelValue)
.eq(levelType.equals("branch"), OrderRequest::getOrgBranchId, levelValue)
.eq(levelType.equals("group"), OrderRequest::getOrgGroupId, levelValue)
.groupBy(OrderRequest::getAppointmentStatus);
return orderRequestMPDao.selectMaps(wrapper);
.eq(OrderInfo::getDt, dt)
.eq(levelType.equals("cluster"), OrderInfo::getOrgClusterId, levelValue)
.eq(levelType.equals("branch"), OrderInfo::getOrgBranchId, levelValue)
.eq(levelType.equals("group"), OrderInfo::getOrgGroupId, levelValue)
.groupBy(OrderInfo::getAppointmentStatus);
return orderInfoMPDao.selectMaps(wrapper);
}
private HashMap<String, Long> transAppointmentMethod(List<Map<String, Object>> results) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!