Commit c3266f4a by Ren Ping

fix:排班结果工程师详情修改

1 parent 37029958
...@@ -17,43 +17,46 @@ import java.util.List; ...@@ -17,43 +17,46 @@ import java.util.List;
@RequestMapping("/pea-order") @RequestMapping("/pea-order")
public class ScheduleController { public class ScheduleController {
@Autowired @Autowired
private ScheduleService scheduleService; private ScheduleService scheduleService;
@GetMapping("/schedule/summary") @GetMapping("/schedule/summary")
public Result<?> getScheduleSummary(@RequestParam String date, @RequestParam String levelType, @RequestParam("levelValue") List<String> levelIds) { public Result<?> getScheduleSummary(@RequestParam String date, @RequestParam String levelType, @RequestParam("levelValue") List<String> levelIds) {
Result<?> res = null; Result<?> res = null;
LocalDate localDate = TimeUtils.IsoDate2LocalDate(date); LocalDate localDate = TimeUtils.IsoDate2LocalDate(date);
try { try {
res = scheduleService.getScheduleSummary(localDate, levelType, levelIds); res = scheduleService.getScheduleSummary(localDate, levelType, levelIds);
} catch (BusinessException e) { } catch (BusinessException e) {
return Result.failed(e.getMessage()); return Result.failed(e.getMessage());
} }
return res; return res;
} }
@GetMapping("/schedule/overview") @GetMapping("/schedule/overview")
public Result<?> getScheduleOverview(@RequestParam long page, @RequestParam long size, @RequestParam String date, public Result<?> getScheduleOverview(@RequestParam long page, @RequestParam long size, @RequestParam String date,
@RequestParam String levelType, @RequestParam("levelValue") List<String> levelIds) { @RequestParam String levelType, @RequestParam("levelValue") List<String> levelIds) {
Result<?> res = null; Result<?> res = null;
LocalDate localDate = TimeUtils.IsoDate2LocalDate(date); LocalDate localDate = TimeUtils.IsoDate2LocalDate(date);
try { try {
res = scheduleService.getScheduleOverview(page, size, localDate, levelType, levelIds); res = scheduleService.getScheduleOverview(page, size, localDate, levelType, levelIds);
} catch (BusinessException e) { } catch (BusinessException e) {
return Result.failed(e.getMessage()); return Result.failed(e.getMessage());
} }
return res; return res;
} }
@GetMapping("/schedule/engineer/overview") @GetMapping("/schedule/engineer/overview")
public Result<?> getScheduleEngineerOverview(@RequestParam String date, @RequestParam String engineerCode) { public Result<?> getScheduleEngineerOverview(@RequestParam String date,
Result<?> res = null; @RequestParam String engineerCode,
LocalDate localDate = TimeUtils.IsoDate2LocalDate(date); @RequestParam(required = false) String sort,
try { @RequestParam(required = false) String sortType) {
res = scheduleService.getScheduleEngineerOverview(localDate, engineerCode); Result<?> res = null;
} catch (BusinessException e) { LocalDate localDate = TimeUtils.IsoDate2LocalDate(date);
return Result.failed(e.getMessage()); try {
} res = scheduleService.getScheduleEngineerOverview(localDate, engineerCode, sort, sortType);
return res; } catch (BusinessException e) {
} return Result.failed(e.getMessage());
}
return res;
}
} }
package com.dituhui.pea.order.dao; package com.dituhui.pea.order.dao;
import com.dituhui.pea.order.entity.OrderInfoEntity; import com.dituhui.pea.order.entity.OrderInfoEntity;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.Query;
...@@ -26,7 +27,7 @@ public interface OrderInfoDao extends JpaRepository<OrderInfoEntity, Long>, JpaS ...@@ -26,7 +27,7 @@ public interface OrderInfoDao extends JpaRepository<OrderInfoEntity, Long>, JpaS
List<OrderInfoEntity> findAllByDtAndOrderIdIn(LocalDate dt, List<String> orderIds); List<OrderInfoEntity> findAllByDtAndOrderIdIn(LocalDate dt, List<String> orderIds);
List<OrderInfoEntity> findByEngineerCodeAndDtAndAppointmentStatusIn(String engineerCode, LocalDate dt, List<String> appointmentStatus); List<OrderInfoEntity> findByEngineerCodeAndDtAndAppointmentStatusIn(String engineerCode, LocalDate dt, List<String> appointmentStatus, Sort sort);
List<OrderInfoEntity> findByDtAndOrgTeamIdAndAppointmentStatusIn(LocalDate dt, String orgTeamId, List<String> appointmentStatus); List<OrderInfoEntity> findByDtAndOrgTeamIdAndAppointmentStatusIn(LocalDate dt, String orgTeamId, List<String> appointmentStatus);
......
...@@ -11,5 +11,5 @@ public interface ScheduleService { ...@@ -11,5 +11,5 @@ public interface ScheduleService {
Result<?> getScheduleOverview(long page, long size, LocalDate date, String levelType, List<String> levelIds); Result<?> getScheduleOverview(long page, long size, LocalDate date, String levelType, List<String> levelIds);
Result<?> getScheduleEngineerOverview(LocalDate date, String engineerCode); Result<?> getScheduleEngineerOverview(LocalDate date, String engineerCode, String sortColumn, String sortType);
} }
...@@ -89,7 +89,7 @@ public class EngineerTimelineServiceImpl implements EngineerTimelineService { ...@@ -89,7 +89,7 @@ public class EngineerTimelineServiceImpl implements EngineerTimelineService {
private List<OrderInfoEntity> selectEngineerOrders(String engineerCode, LocalDate dt){ private List<OrderInfoEntity> selectEngineerOrders(String engineerCode, LocalDate dt){
List<OrderInfoEntity> orders = orderInfoDao.findByEngineerCodeAndDtAndAppointmentStatusIn( List<OrderInfoEntity> orders = orderInfoDao.findByEngineerCodeAndDtAndAppointmentStatusIn(
engineerCode, dt, List.of(OrderFlowEnum.PRE.name(), OrderFlowEnum.CONFIRM.name())); engineerCode, dt, List.of(OrderFlowEnum.PRE.name(), OrderFlowEnum.CONFIRM.name()), null);
return orders.stream().filter(o -> !o.getOrderStatus().equals("CANCEL")).collect(Collectors.toList()); return orders.stream().filter(o -> !o.getOrderStatus().equals("CANCEL")).collect(Collectors.toList());
} }
......
...@@ -111,7 +111,7 @@ public class OrderAssignImpl implements OrderAssign { ...@@ -111,7 +111,7 @@ public class OrderAssignImpl implements OrderAssign {
// 获取已技术员已指派订单列表 // 获取已技术员已指派订单列表
List<OrderInfoEntity> orderAppointments = orderInfoDao.findByEngineerCodeAndDtAndAppointmentStatusIn( List<OrderInfoEntity> orderAppointments = orderInfoDao.findByEngineerCodeAndDtAndAppointmentStatusIn(
engineer.getEngineerCode(), order.getDt(), List.of(OrderFlowEnum.CONFIRM.name())); engineer.getEngineerCode(), order.getDt(), List.of(OrderFlowEnum.CONFIRM.name()), null);
// 获取订单tips // 获取订单tips
HashMap<String, List<LabelValueDTO>> orderTips = new HashMap<>(); HashMap<String, List<LabelValueDTO>> orderTips = new HashMap<>();
......
...@@ -3,6 +3,7 @@ package com.dituhui.pea.order.service.impl; ...@@ -3,6 +3,7 @@ package com.dituhui.pea.order.service.impl;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.LocalDateTimeUtil; import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dituhui.pea.common.BusinessException; import com.dituhui.pea.common.BusinessException;
import com.dituhui.pea.common.Result; import com.dituhui.pea.common.Result;
...@@ -19,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -19,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification; import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -165,7 +167,7 @@ public class ScheduleServiceImpl implements ScheduleService { ...@@ -165,7 +167,7 @@ public class ScheduleServiceImpl implements ScheduleService {
} }
@Override @Override
public Result<?> getScheduleEngineerOverview(LocalDate date, String engineerCode) throws BusinessException { public Result<?> getScheduleEngineerOverview(LocalDate date, String engineerCode, String sortColumn, String sortType) throws BusinessException {
// 获取技术员已排班概况 // 获取技术员已排班概况
EngineerInfoEntity engineer = engineerInfoDao.getByEngineerCode(engineerCode); EngineerInfoEntity engineer = engineerInfoDao.getByEngineerCode(engineerCode);
...@@ -175,8 +177,16 @@ public class ScheduleServiceImpl implements ScheduleService { ...@@ -175,8 +177,16 @@ public class ScheduleServiceImpl implements ScheduleService {
EngineerBusinessEntity engineerBusinessEntity = engineerBusinessDao.getByEngineerCode(engineerCode); EngineerBusinessEntity engineerBusinessEntity = engineerBusinessDao.getByEngineerCode(engineerCode);
List<LabelValueDTO> emptyTips = new ArrayList<>(); List<LabelValueDTO> emptyTips = new ArrayList<>();
if (!"orderId".equals(sortColumn)) {
sortColumn = "actualStartTime";
}
if (!"desc".equals(sortType)) {
sortType = "asc";
}
Sort sort = Sort.by(Sort.Direction.valueOf(sortType.toUpperCase()), sortColumn);
List<OrderInfoEntity> orderAppointments = orderInfoDao.findByEngineerCodeAndDtAndAppointmentStatusIn( List<OrderInfoEntity> orderAppointments = orderInfoDao.findByEngineerCodeAndDtAndAppointmentStatusIn(
engineerCode, date, List.of(OrderFlowEnum.PRE.name(), OrderFlowEnum.CONFIRM.name())); engineerCode, date, List.of(OrderFlowEnum.PRE.name(), OrderFlowEnum.CONFIRM.name()), sort);
List<TimeLineDTO> timelines = new ArrayList<>(); List<TimeLineDTO> timelines = new ArrayList<>();
int sumDistance = 0; int sumDistance = 0;
int sumElapsed = 0; int sumElapsed = 0;
...@@ -221,13 +231,13 @@ public class ScheduleServiceImpl implements ScheduleService { ...@@ -221,13 +231,13 @@ public class ScheduleServiceImpl implements ScheduleService {
} }
dynamics.setVehicleName(VehicleEnum.getNameByValue(engineer.getVehicle())); dynamics.setVehicleName(VehicleEnum.getNameByValue(engineer.getVehicle()));
List<String> orderIds = orderAppointments.stream().map(OrderInfoEntity::getOrderId).collect(Collectors.toList()); // List<String> orderIds = orderAppointments.stream().map(OrderInfoEntity::getOrderId).collect(Collectors.toList());
List<OrderInfoEntity> orderRequests = new ArrayList<>(); // List<OrderInfoEntity> orderRequests = new ArrayList<>();
if (orderIds != null && !orderIds.isEmpty()) { // if (orderIds != null && !orderIds.isEmpty()) {
orderRequests = orderInfoDao.findAllByDtAndOrderIdIn(date, orderIds); // orderRequests = orderInfoDao.findAllByDtAndOrderIdIn(date, orderIds);
} // }
List<ScheduleEngineerOverviewResp.Order> orders = new ArrayList<>(); List<ScheduleEngineerOverviewResp.Order> orders = new ArrayList<>();
for (OrderInfoEntity o : orderRequests) { for (OrderInfoEntity o : orderAppointments) {
ScheduleEngineerOverviewResp.Order item = new ScheduleEngineerOverviewResp.Order(); ScheduleEngineerOverviewResp.Order item = new ScheduleEngineerOverviewResp.Order();
item.setOrderId(o.getOrderId()); item.setOrderId(o.getOrderId());
item.setLocation(String.format("%s,%s", o.getX(), o.getY())); item.setLocation(String.format("%s,%s", o.getX(), o.getY()));
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!