Commit e2ca3576 by wangli

重命名

1 parent b9067e24
...@@ -14,11 +14,12 @@ public class DispatchController { ...@@ -14,11 +14,12 @@ public class DispatchController {
private DispatchService dispatchService; private DispatchService dispatchService;
@GetMapping("/dispatch/order/list") @GetMapping("/dispatch/order/list")
public Result<?> getDispatchOrderList(@RequestParam String date, @RequestParam String groupId) { public Result<?> getDispatchOrderList(@RequestParam String levelType, @RequestParam("levelId") String levelIds,
@RequestParam String date, @RequestParam String groupTagId) {
// 获取派工台待派订单列表 // 获取派工台待派订单列表
Result<?> res = null; Result<?> res = null;
try { try {
res = dispatchService.getDispatchOrderList(date, groupId); res = dispatchService.getDispatchOrderList(levelType, levelIds, date, groupTagId);
}catch (BusinessException e) { }catch (BusinessException e) {
Result.failed(e.getMessage()); Result.failed(e.getMessage());
} }
...@@ -26,11 +27,11 @@ public class DispatchController { ...@@ -26,11 +27,11 @@ public class DispatchController {
} }
@GetMapping("/dispatch/engineer/order/list") @GetMapping("/dispatch/engineer/order/list")
public Result<?> getDispatchEngineerOrderList(@RequestParam String date) { public Result<?> getDispatchEngineerOrderList(@RequestParam String levelType, @RequestParam("levelId") String levelIds, @RequestParam String date) {
// 获取派工台工程师已派订单列表 // 获取派工台工程师已派订单列表
Result<?> res = null; Result<?> res = null;
try { try {
res = dispatchService.getDispatchEngineerOrderList(date); res = dispatchService.getDispatchEngineerOrderList(levelType, levelIds, date);
}catch (BusinessException e) { }catch (BusinessException e) {
Result.failed(e.getMessage()); Result.failed(e.getMessage());
} }
......
package com.alibaba.cloud.integration.order.controller; package com.alibaba.cloud.integration.order.controller;
import com.alibaba.cloud.integration.common.Result; import com.alibaba.cloud.integration.common.Result;
import com.alibaba.cloud.integration.order.dto.EnginnerTimelineReq; import com.alibaba.cloud.integration.order.service.EngineerTimelineService;
import com.alibaba.cloud.integration.order.service.EnginnerTimelineService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
...@@ -12,13 +11,13 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -12,13 +11,13 @@ import org.springframework.web.bind.annotation.RestController;
@RestController @RestController
@RequestMapping("/pea-order") @RequestMapping("/pea-order")
public class EnginnerTimelineController { public class EngineerTimelineController {
@Autowired @Autowired
private EnginnerTimelineService enginnerTimelineService; private EngineerTimelineService engineerTimelineService;
@GetMapping("/enginner/work/trace") @GetMapping("/engineer/work/trace")
public Result<?> GetEnginnerTimeline(@RequestParam EnginnerTimelineReq req) { public Result<?> GetEngineerTimeline(@RequestParam String engineerCode, String date) {
return enginnerTimelineService.GetEnginnerTimelines(req.getEnginnerCode(), req.getDate()); return engineerTimelineService.getEngineerTimelines(engineerCode, date);
} }
} }
...@@ -5,7 +5,7 @@ import org.springframework.web.bind.annotation.RequestParam; ...@@ -5,7 +5,7 @@ import org.springframework.web.bind.annotation.RequestParam;
public interface DispatchService { public interface DispatchService {
Result<?> getDispatchOrderList(String date, String groupId); Result<?> getDispatchOrderList(String levelType, String levelIds, String date, String groupTagId);
Result<?> getDispatchEngineerOrderList(String date); Result<?> getDispatchEngineerOrderList(String levelType, String levelIds, String date);
Result<?> dispatchOrderConfirm(String orderId, String engineerCode); Result<?> dispatchOrderConfirm(String orderId, String engineerCode);
} }
...@@ -2,6 +2,6 @@ package com.alibaba.cloud.integration.order.service; ...@@ -2,6 +2,6 @@ package com.alibaba.cloud.integration.order.service;
import com.alibaba.cloud.integration.common.Result; import com.alibaba.cloud.integration.common.Result;
public interface EnginnerTimelineService { public interface EngineerTimelineService {
Result<?> GetEnginnerTimelines(String engineerCode, String date); Result<?> getEngineerTimelines(String engineerCode, String date);
} }
...@@ -7,12 +7,12 @@ import org.springframework.stereotype.Service; ...@@ -7,12 +7,12 @@ import org.springframework.stereotype.Service;
@Service @Service
public class DispatchServiceImpl implements DispatchService { public class DispatchServiceImpl implements DispatchService {
@Override @Override
public Result<?> getDispatchOrderList(String date, String groupId) { public Result<?> getDispatchOrderList(String levelType, String levelIds, String date, String groupId) {
return null; return null;
} }
@Override @Override
public Result<?> getDispatchEngineerOrderList(String date) { public Result<?> getDispatchEngineerOrderList(String levelType, String levelIds, String date) {
return null; return null;
} }
......
...@@ -4,7 +4,7 @@ import com.alibaba.cloud.integration.common.Result; ...@@ -4,7 +4,7 @@ import com.alibaba.cloud.integration.common.Result;
import com.alibaba.cloud.integration.order.dao.*; import com.alibaba.cloud.integration.order.dao.*;
import com.alibaba.cloud.integration.order.dto.EnginnerTimelineResp; import com.alibaba.cloud.integration.order.dto.EnginnerTimelineResp;
import com.alibaba.cloud.integration.order.entity.*; import com.alibaba.cloud.integration.order.entity.*;
import com.alibaba.cloud.integration.order.service.EnginnerTimelineService; import com.alibaba.cloud.integration.order.service.EngineerTimelineService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -18,7 +18,7 @@ import java.util.stream.Stream; ...@@ -18,7 +18,7 @@ import java.util.stream.Stream;
@Service @Service
public class EnginnerTimelineServiceImpl implements EnginnerTimelineService { public class EngineerTimelineServiceImpl implements EngineerTimelineService {
@Autowired @Autowired
private EngineerTimelineMPDao engineerTimelineMPDao; private EngineerTimelineMPDao engineerTimelineMPDao;
...@@ -40,27 +40,27 @@ public class EnginnerTimelineServiceImpl implements EnginnerTimelineService { ...@@ -40,27 +40,27 @@ public class EnginnerTimelineServiceImpl implements EnginnerTimelineService {
@Transactional @Transactional
@Override @Override
public Result<?> GetEnginnerTimelines(String engineerCode, String date){ public Result<?> getEngineerTimelines(String engineerCode, String date){
// 工程师姓名 // 工程师姓名
String name = this.GetEnginnerName(engineerCode); String name = this.getEngineerName(engineerCode);
// 获取工程师已完成的timeline数据 // 获取工程师已完成的timeline数据
List<EngineerTimeline> timelines = this.EnginnerTimelines(engineerCode, date); List<EngineerTimeline> timelines = this.engineerTimelines(engineerCode, date);
// 获取工程师date日的订单数据 // 获取工程师date日的订单数据
List<OrderAppointment> orders = this.OrderAppointments(engineerCode, date); List<OrderAppointment> orders = this.orderAppointments(engineerCode, date);
// 获取客户地址 // 获取客户地址
List<String> orderIds = new ArrayList<>(); List<String> orderIds = new ArrayList<>();
for(OrderAppointment o: orders) { for(OrderAppointment o: orders) {
orderIds.add(o.getOrderId()); orderIds.add(o.getOrderId());
} }
HashMap<String, String> orderLocations = this.OrderRequestsLocation(orderIds); HashMap<String, String> orderLocations = this.orderRequestsLocation(orderIds);
// 获取配送站地址 // 获取配送站地址
String branchId = this.getEngineerBranchId(engineerCode); String branchId = this.getEngineerBranchId(engineerCode);
String warehouseLocation = this.getWarehouseLocation(branchId); String warehouseLocation = this.getWarehouseLocation(branchId);
List<EnginnerTimelineResp.DynamicItem> dynamics = this.PackItems(timelines, orders, orderLocations, warehouseLocation); List<EnginnerTimelineResp.DynamicItem> dynamics = this.packItems(timelines, orders, orderLocations, warehouseLocation);
EnginnerTimelineResp res = new EnginnerTimelineResp(); EnginnerTimelineResp res = new EnginnerTimelineResp();
res.setEngineerCode(engineerCode); res.setEngineerCode(engineerCode);
...@@ -69,14 +69,14 @@ public class EnginnerTimelineServiceImpl implements EnginnerTimelineService { ...@@ -69,14 +69,14 @@ public class EnginnerTimelineServiceImpl implements EnginnerTimelineService {
return Result.success(res); return Result.success(res);
} }
private String GetEnginnerName(String enginerrCode){ private String getEngineerName(String engineerCode){
LambdaQueryWrapper<EngineerInfo> lqw = new LambdaQueryWrapper<>(); LambdaQueryWrapper<EngineerInfo> lqw = new LambdaQueryWrapper<>();
lqw.eq(EngineerInfo::getEngineerCode, enginerrCode); lqw.eq(EngineerInfo::getEngineerCode, engineerCode);
EngineerInfo e = engineerInfoMPDao.selectOne(lqw); EngineerInfo e = engineerInfoMPDao.selectOne(lqw);
return e.getName(); return e.getName();
} }
private List<OrderAppointment> OrderAppointments(String engineerCode, String date){ private List<OrderAppointment> orderAppointments(String engineerCode, String date){
// 获取指派单列表 // 获取指派单列表
LambdaQueryWrapper<OrderAppointment> lqw = new LambdaQueryWrapper<>(); LambdaQueryWrapper<OrderAppointment> lqw = new LambdaQueryWrapper<>();
lqw.eq(OrderAppointment::getEngineerCode, engineerCode); lqw.eq(OrderAppointment::getEngineerCode, engineerCode);
...@@ -85,7 +85,7 @@ public class EnginnerTimelineServiceImpl implements EnginnerTimelineService { ...@@ -85,7 +85,7 @@ public class EnginnerTimelineServiceImpl implements EnginnerTimelineService {
return orderAppointmentMPDao.selectList(lqw); return orderAppointmentMPDao.selectList(lqw);
} }
private List<EngineerTimeline> EnginnerTimelines(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());
LambdaQueryWrapper<EngineerTimeline> lqw = new LambdaQueryWrapper<>(); LambdaQueryWrapper<EngineerTimeline> lqw = new LambdaQueryWrapper<>();
...@@ -96,7 +96,7 @@ public class EnginnerTimelineServiceImpl implements EnginnerTimelineService { ...@@ -96,7 +96,7 @@ public class EnginnerTimelineServiceImpl implements EnginnerTimelineService {
return engineerTimelineMPDao.selectList(lqw); return engineerTimelineMPDao.selectList(lqw);
} }
private HashMap<String, String> OrderRequestsLocation(List<String> orderIds) { private HashMap<String, String> orderRequestsLocation(List<String> orderIds) {
// 获取客户地址location // 获取客户地址location
HashMap<String, String> map = new HashMap<>(); HashMap<String, String> map = new HashMap<>();
...@@ -134,9 +134,9 @@ public class EnginnerTimelineServiceImpl implements EnginnerTimelineService { ...@@ -134,9 +134,9 @@ public class EnginnerTimelineServiceImpl implements EnginnerTimelineService {
} }
private List<EnginnerTimelineResp.DynamicItem> PackItems(List<EngineerTimeline> timelines, List<OrderAppointment> orders, HashMap<String, String> locations, String warehouseLocation) { private List<EnginnerTimelineResp.DynamicItem> packItems(List<EngineerTimeline> timelines, List<OrderAppointment> orders, HashMap<String, String> locations, String warehouseLocation) {
Integer index = 1; int index = 1;
String order_id, title, type, text, location; String order_id, title, type, text, location;
List<EnginnerTimelineResp.DynamicItem> items = new ArrayList<>(); List<EnginnerTimelineResp.DynamicItem> items = new ArrayList<>();
...@@ -144,12 +144,12 @@ public class EnginnerTimelineServiceImpl implements EnginnerTimelineService { ...@@ -144,12 +144,12 @@ public class EnginnerTimelineServiceImpl implements EnginnerTimelineService {
for (EngineerTimeline t: timelines){ for (EngineerTimeline t: timelines){
EnginnerTimelineResp.DynamicItem item = new EnginnerTimelineResp.DynamicItem(); EnginnerTimelineResp.DynamicItem item = new EnginnerTimelineResp.DynamicItem();
if (t.getEvent() == "分站取还配件") { if (t.getEvent().equals("分站取还配件")) {
title = t.getEvent(); title = t.getEvent();
text = "取"; text = "取";
type = "other"; type = "other";
location = warehouseLocation; location = warehouseLocation;
} else if (t.getEvent() == "加单") { } else if (t.getEvent().equals("加单")) {
title = t.getEvent(); title = t.getEvent();
text = "加"; text = "加";
type = "other"; type = "other";
...@@ -175,7 +175,7 @@ public class EnginnerTimelineServiceImpl implements EnginnerTimelineService { ...@@ -175,7 +175,7 @@ public class EnginnerTimelineServiceImpl implements EnginnerTimelineService {
for(OrderAppointment o: orders){ for(OrderAppointment o: orders){
order_id = o.getOrderId() + o.getSuborderId(); order_id = o.getOrderId() + o.getSuborderId();
if (s.equals(order_id)) { if (s.contains(order_id)) {
continue; continue;
} }
index += 1; index += 1;
...@@ -189,12 +189,11 @@ public class EnginnerTimelineServiceImpl implements EnginnerTimelineService { ...@@ -189,12 +189,11 @@ public class EnginnerTimelineServiceImpl implements EnginnerTimelineService {
items.add(item); items.add(item);
} }
// 根据items的time升序排序 // 根据items的time升序排序
items.stream().sorted(Comparator.comparing(EnginnerTimelineResp.DynamicItem::getTime)).collect(Collectors.toList()); return items.stream().sorted(Comparator.comparing(EnginnerTimelineResp.DynamicItem::getTime)).collect(Collectors.toList());
return items;
} }
private String Timestamp2Datetime(Timestamp t) { private String Timestamp2Datetime(Timestamp t) {
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-mm-dd HH:MM:SS"); DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
return df.format(t.toLocalDateTime()); return df.format(t.toLocalDateTime());
} }
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!