Commit 90414dca by wangli

去掉order_timeline表,相关事件通过order_event表和order_info表字段取组合

1 parent a577d8c6
package com.dituhui.pea.order.dao;
import com.dituhui.pea.order.entity.OrderTimeline;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface OrderTimelineMPDao extends BaseMapper<OrderTimeline> {
}
package com.dituhui.pea.order.entity;
import lombok.Data;
import java.sql.Timestamp;
@Data
public class OrderTimeline {
private String orderId;
private String suborderId;
private String event;
private String happen;
private Integer status;
private Timestamp createTime;
private Timestamp updateTime;
}
package com.dituhui.pea.order.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.dituhui.pea.common.BusinessException;
import com.dituhui.pea.common.Result;
import com.dituhui.pea.order.common.ListUtils;
import com.dituhui.pea.order.common.TimeUtils;
import com.dituhui.pea.order.dao.*;
import com.dituhui.pea.order.dto.*;
......@@ -29,9 +27,6 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
private EngineerInfoDao engineerInfoDao;
@Autowired
private OrderTimelineMPDao orderTimelineMPDao;
@Autowired
private OrderEventDao orderEventDao;
@Autowired
......@@ -123,9 +118,6 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
// 获取工程师技能列表<engineerCode, skills>
Map<String, String> egSkill = this.getEngineerSkills(engineerCodes);
// 获取subOrder订单timeline
Map<String, List<OrderTimeline>> timelines = this.getOrderTimelines(orderId);
Comparator<OrderInfoEntity> dtDesc = Comparator.comparing(OrderInfoEntity::getDt).reversed();
List<OrderInfoEntity> results = orders.stream().sorted(dtDesc).collect(Collectors.toList());
......@@ -155,7 +147,7 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
item.setTitle(title);
item.setEngineerCode(o.getEngineerCode());
item.setExpectTime(TimeUtils.IsoLocalDateTime2String(o.getExpectTimeBegin()));
item.setTimelines(this.packOrderTimeline(timelines.getOrDefault(o.getSubId(), null)));
item.setTimelines(null); // TODO
item.setItems(this.packEngineerItems(eg, skill, groups.get(eg.getGroupId())));
items.add(item);
......@@ -241,23 +233,6 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
return map;
}
private Map<String, List<OrderTimeline>> getOrderTimelines(String orderId) {
// 获取订单时间线
LambdaQueryWrapper<OrderTimeline> lqw = new LambdaQueryWrapper<>();
lqw.eq(OrderTimeline::getOrderId, orderId);
List<OrderTimeline> timelines = orderTimelineMPDao.selectList(lqw);
// 根据subOrderId + happen字段排序
Comparator<OrderTimeline> sb = Comparator.comparing(OrderTimeline::getSuborderId, String.CASE_INSENSITIVE_ORDER);
Comparator<OrderTimeline> happen = Comparator.comparing(OrderTimeline::getHappen);
Comparator<OrderTimeline> comp = sb.thenComparing(happen);
List<OrderTimeline> results = timelines.stream().sorted(comp).collect(Collectors.toList());
// 根据subOrderId分组
return results.stream().collect(Collectors.groupingBy(OrderTimeline::getSuborderId));
}
private HashMap<String, String> queryAllSkills() {
HashMap<String, String> map = new HashMap<>();
List<SkillInfoEntity> records = skillInfoDao.findAll();
......@@ -358,25 +333,10 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
return dynamics;
}
private List<KV> packOrderTimeline(List<OrderTimeline> timelines) {
List<KV> items = new ArrayList<>();
if(ListUtils.isEmpty(timelines)){
return items;
}
for (OrderTimeline o : timelines) {
items.add(this.packTimeline(o.getEvent(), o.getHappen(), o.getStatus().toString()));
}
return items;
}
private KV packEngineer(String title, String value, String type) {
return this.PackKV(title, value, type, null, null);
}
private KV packTimeline(String title, String value, String status) {
return this.PackKV(title, value, null, status, null);
}
private KV packOrderItem(String title, String value) {
return this.PackKV(title, value, null, null, null);
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!