Commit 07aa01cf by 刘鑫

DOC: 申请加单确认返回示例

1 parent a0a6cd3d
......@@ -18,6 +18,7 @@ import java.io.IOException;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.Date;
import java.util.List;
/**
* PEA 对外接口
......@@ -213,9 +214,10 @@ public class PeaApiController {
* @apiNote 技术员发起申请,根据技术员当前位置和空闲时间段,返回附近的n张尚未分配,且不需要备件的工单,技术员逐条顺序联系客户确认
*/
@PostMapping("/order/increase/query")
public Result<Order> orderIncrease(@Validated @RequestBody EngineerOrderParam requestParam) {
public Result<List<Order>> orderIncrease(@Validated @RequestBody EngineerOrderParam requestParam) {
return Result.success(new Order());
return Result.success(peaOuterAPIService.orderIncreaseQuery(requestParam.getEngineerCode(), requestParam.getLocation(),
requestParam.getIdleDuration()));
}
/**
......
......@@ -20,4 +20,6 @@ public interface OrderInfoDao extends JpaRepository<OrderInfoEntity, Long>, JpaS
List<OrderInfoEntity> findAllByDtAndOrderIdIn(LocalDate dt, List<String> orderIds);
List<OrderInfoEntity> findByEngineerCodeAndDtAndAppointmentStatusIn(String engineerCode, LocalDate dt, List<String> appointmentStatus);
List<OrderInfoEntity> findByDtAndOrgTeamIdAndAppointmentStatusIn(LocalDate dt, String orgTeamId, List<String> appointmentStatus);
OrderInfoEntity findTopBySkillAndAppointmentStatus(String skill, String status);
}
......@@ -42,12 +42,12 @@ public class Order {
/**
* 分类
*/
private String product_type;
private String productType;
/**
* 需要的技能
*/
private String service_type;
private String serviceType;
/**
* 预计需要服务的时长
......@@ -69,6 +69,8 @@ public class Order {
/**
* 客户期望上门最晚时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date expectTimeEnd;
/**
......
......@@ -2,6 +2,9 @@ package com.dituhui.pea.order.service;
import com.dituhui.pea.order.dto.param.EstimateDTO;
import com.dituhui.pea.order.dto.param.Location;
import com.dituhui.pea.order.dto.param.Order;
import java.util.List;
/**
* PEA 对外服务接口API 定义
......@@ -19,4 +22,14 @@ public interface PeaOuterAPIService {
*/
EstimateDTO.VisitResult estimateVisitService(String brand, String productType, String serviceType,
Location clientLocation);
/**
* 根据技术员当前位置和空闲时间段,返回附近的n张尚未分配,且不需要备件的工单,技术员逐条顺序联系客户确认
*
* @param engineerCode 工程师工号
* @param location 地址坐标信息
* @param idleDuration 空闲时长 至少空闲多久以上,单位:分钟
* @return 不需要的备件且符合条件的多个未分配工单
*/
List<Order> orderIncreaseQuery(String engineerCode, Location location, Integer idleDuration);
}
package com.dituhui.pea.order.service.impl;
import com.dituhui.pea.order.common.jackson.DateUtil;
import com.dituhui.pea.order.dao.OrderInfoDao;
import com.dituhui.pea.order.dao.OrgGroupDao;
import com.dituhui.pea.order.dto.param.EstimateDTO;
import com.dituhui.pea.order.dto.param.Location;
import com.dituhui.pea.order.dto.param.Order;
import com.dituhui.pea.order.entity.OrderInfoEntity;
import com.dituhui.pea.order.entity.OrgGroupEntity;
import com.dituhui.pea.order.service.PeaOuterAPIService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 对外接口实现
*/
......@@ -20,6 +26,7 @@ public class PeaOuterAPIServiceImpl implements PeaOuterAPIService {
* 分部数据访问层
*/
private final OrgGroupDao orgGroupDao;
private final OrderInfoDao orderInfoDao;
@Override
public EstimateDTO.VisitResult estimateVisitService(String brand, String productType, String serviceType, Location clientLocation) {
......@@ -43,4 +50,30 @@ public class PeaOuterAPIServiceImpl implements PeaOuterAPIService {
return visitResult;
}
@Override
public List<Order> orderIncreaseQuery(String engineerCode, Location location, Integer idleDuration) {
OrderInfoEntity sss = orderInfoDao.findTopBySkillAndAppointmentStatus("标准安装", "INIT");
Order order = new Order();
order.setOrderId(sss.getOrderId());
order.setName(sss.getName());
order.setPhone(sss.getPhone());
order.setBrand(sss.getBrand());
order.setProductType(sss.getType());
order.setFaultDescribe(sss.getFaultDescribe());
order.setExpectTimeBegin(DateUtil.toDate(sss.getExpectTimeBegin()));
order.setExpectTimeEnd(DateUtil.toDate(sss.getExpectTimeEnd()));
Location orderLocation = new Location();
orderLocation.setAddress(sss.getAddress());
orderLocation.setLongitude(Double.parseDouble(sss.getX()));
orderLocation.setLatitude(Double.parseDouble(sss.getY()));
order.setLocation(orderLocation);
return List.of(order);
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!