Commit 8efe9de5 by 王力

Merge branch 'dev_engineer_work_dynamics' into 'develop'

Dev engineer work dynamics

See merge request !229
2 parents cf781249 61500134
...@@ -16,7 +16,7 @@ public class EngineerTimelineController { ...@@ -16,7 +16,7 @@ public class EngineerTimelineController {
@Autowired @Autowired
private EngineerTimelineService engineerTimelineService; private EngineerTimelineService engineerTimelineService;
@GetMapping("/engineer/work/trace") @GetMapping("/engineer/work/dynamics")
public Result<?> GetEngineerTimeline(@RequestParam String engineerCode, String date) { public Result<?> GetEngineerTimeline(@RequestParam String engineerCode, String date) {
return engineerTimelineService.getEngineerTimelines(engineerCode, date); return engineerTimelineService.getEngineerTimelines(engineerCode, date);
} }
......
...@@ -12,6 +12,7 @@ import org.springframework.stereotype.Service; ...@@ -12,6 +12,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -43,13 +44,16 @@ public class EngineerTimelineServiceImpl implements EngineerTimelineService { ...@@ -43,13 +44,16 @@ public class EngineerTimelineServiceImpl implements EngineerTimelineService {
@Override @Override
public Result<?> getEngineerTimelines(String engineerCode, String date){ public Result<?> getEngineerTimelines(String engineerCode, String date){
// 工程师姓名 LocalDate localDate = TimeUtils.IsoDate2LocalDate(date);
String name = this.getEngineerName(engineerCode);
// 工程師信息
EngineerInfo engineerInfo = engineerInfoMPDao.getByEngineerCode(engineerCode);
// 获取工程师已完成的timeline数据 // 获取工程师已完成的timeline数据
List<EngineerTimeline> timelines = this.engineerTimelines(engineerCode, date); List<EngineerTimeline> timelines = this.engineerTimelines(engineerCode, date);
// 获取工程师date日的订单数据 // 获取工程师date日的订单数据
List<OrderAppointment> orders = this.orderAppointments(engineerCode, date); List<OrderAppointment> orders = orderAppointmentMPDao.selectByEngineerCodeAndDt(engineerCode, localDate);
// 获取客户地址 // 获取客户地址
List<String> orderIds = new ArrayList<>(); List<String> orderIds = new ArrayList<>();
for(OrderAppointment o: orders) { for(OrderAppointment o: orders) {
...@@ -65,27 +69,11 @@ public class EngineerTimelineServiceImpl implements EngineerTimelineService { ...@@ -65,27 +69,11 @@ public class EngineerTimelineServiceImpl implements EngineerTimelineService {
EnginnerTimelineResp res = new EnginnerTimelineResp(); EnginnerTimelineResp res = new EnginnerTimelineResp();
res.setEngineerCode(engineerCode); res.setEngineerCode(engineerCode);
res.setEngineerName(name); res.setEngineerName(engineerInfo.getName());
res.setDynamics(dynamics); res.setDynamics(dynamics);
return Result.success(res); return Result.success(res);
} }
private String getEngineerName(String engineerCode){
LambdaQueryWrapper<EngineerInfo> lqw = new LambdaQueryWrapper<>();
lqw.eq(EngineerInfo::getEngineerCode, engineerCode);
EngineerInfo e = engineerInfoMPDao.selectOne(lqw);
return e.getName();
}
private List<OrderAppointment> orderAppointments(String engineerCode, String date){
// 获取指派单列表
LambdaQueryWrapper<OrderAppointment> lqw = new LambdaQueryWrapper<>();
lqw.eq(OrderAppointment::getEngineerCode, engineerCode);
lqw.ge(OrderAppointment::getExpectStartTime, date + " 00:00:00");
lqw.le(OrderAppointment::getExpectStartTime, date + " 23:59:59");
return orderAppointmentMPDao.selectList(lqw);
}
private List<EngineerTimeline> engineerTimelines(String engineerCode, String date){ private List<EngineerTimeline> engineerTimelines(String engineerCode, String date){
// 获取工程师timeline // 获取工程师timeline
List<String> events = Stream.of("分站取还配件", "已出发", "加单").collect(Collectors.toList()); List<String> events = Stream.of("分站取还配件", "已出发", "加单").collect(Collectors.toList());
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!