Commit e2ca3576 by wangli

重命名

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