Commit ca9476a3 by 刘鑫

temp:临时提供对外接口返回值

1 parent c11b787d
......@@ -101,7 +101,7 @@
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.7.5</version>
<version>5.8.22</version>
</dependency>
<dependency>
......
package com.dituhui.pea.order.controller;
import cn.hutool.core.date.LocalDateTimeUtil;
import com.dituhui.pea.common.BusinessException;
import cn.hutool.core.io.FileUtil;
import cn.hutool.json.JSONConfig;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.dituhui.pea.common.Result;
import com.dituhui.pea.order.common.jackson.JsonUtil;
import com.dituhui.pea.order.dto.OrganizationTreeDTO;
import com.dituhui.pea.order.dto.param.*;
import com.dituhui.pea.order.service.EngineerCalendarService;
import com.dituhui.pea.util.DateUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import lombok.RequiredArgsConstructor;
import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.time.LocalDate;
import java.time.Duration;
import java.time.Period;
import java.time.ZoneId;
import java.util.Date;
......@@ -31,6 +37,7 @@ import java.util.Date;
public class PeaApiController {
private final EngineerCalendarService engineerCalendarService;
private final ResourceLoader resourceLoader;
/**
......@@ -102,14 +109,14 @@ public class PeaApiController {
* @return 容量列表
*/
@PostMapping("/capacity/query")
public Result<CapacityQueryDTO.Result> capacityQuery(@Validated @RequestBody CapacityQueryDTO.Request reqDTO) {
public Result<CapacityQueryDTO.Result> capacityQuery(@Validated @RequestBody CapacityQueryDTO.Request reqDTO) throws IOException {
//查询日期起止参数限制为一月
CapacityQueryDTO.Result result = new CapacityQueryDTO.Result();
Resource resource = resourceLoader.getResource("classpath:/json/capacity.json");
String jsonStr = FileUtil.readString(resource.getFile(), StandardCharsets.UTF_8);
CapacityQueryDTO.Result result = JsonUtil.parse(jsonStr, CapacityQueryDTO.Result.class).get();
result.setParams(reqDTO);
return Result.success(result);
}
......@@ -130,10 +137,17 @@ public class PeaApiController {
@RequestParam("beginDate") Date beginDate,
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@RequestParam("endDate") Date endDate) {
@RequestParam("endDate") Date endDate) throws IOException {
Resource resource = resourceLoader.getResource("classpath:/json/capacity.json");
String jsonStr = FileUtil.readString(resource.getFile(), StandardCharsets.UTF_8);
CapacityQueryDTO.Result resultTemp = JsonUtil.parse(jsonStr, CapacityQueryDTO.Result.class).get();
return Result.success(new CapacityQueryDTO.PersonalResult());
CapacityQueryDTO.PersonalResult result = new CapacityQueryDTO.PersonalResult();
result.setDatas(resultTemp.getDatas());
result.setEngineerCode(engineerCode);
return Result.success(result);
}
......@@ -165,17 +179,23 @@ public class PeaApiController {
}
/**
* 6.2GET 预约单服务进度查询
*
* @param orderId 工单号码
* @return 工单进度信息
* @apiNote 查询预约单状态,返回指定技术员(主,副)信息、推荐上门时间。如果查询为服务当日,增加对应技术员准实时位置,距离公里数,预计到达时间等
*/
@GetMapping("/order/stage/query")
public Result<OrderDTO.StageResult> orderStage(@NotBlank @RequestParam("orderId") String orderId) {
/**
* 6.2GET 预约单服务进度查询
*
* @param orderId 工单号码
* @return 工单进度信息
* @apiNote 查询预约单状态,返回指定技术员(主,副)信息、推荐上门时间。如果查询为服务当日,增加对应技术员准实时位置,距离公里数,预计到达时间等
*/
@GetMapping("/order/stage/query")
public Result<OrderDTO.StageResult> orderStage(@NotBlank @RequestParam("orderId") String orderId) throws IOException {
Resource resource = resourceLoader.getResource("classpath:/json/stage.json");
String jsonStr = FileUtil.readString(resource.getFile(), StandardCharsets.UTF_8);
OrderDTO.StageResult stageResult = JsonUtil.parse(jsonStr, OrderDTO.StageResult.class).get();
stageResult.setOrderId(orderId);
return Result.success(new OrderDTO.StageResult());
return Result.success(stageResult);
}
/**
......
......@@ -148,14 +148,14 @@ public class CapacityQueryDTO {
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime beginTime;
private Date beginTime;
/**
* 截止时间 yyyy-MM-dd HH:mm:ss
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime endTime;
private Date endTime;
/**
* 容量状态 0不可约;1可约;
......
{
"groupId": "G100038",
"params": {
"beginDate": "2023-07-21",
"endDate": "2023-07-27",
"services": [{
"brand": "博世",
"productType": "多门冰箱",
"serviceType": "商场样机安装"}],
"location": {
"addressId":"21231231",
"latitude": 120.608463,
"longitude": 31.318442,
"name": "江苏省苏州市姑苏区蒋庙前",
"address": "江苏省苏州市姑苏区解放大街123号"
}
},
"takeTime": 720,
"datas": [
{
"date": "2023-07-21",
"segments": [
{
"maxDuration": 90,
"name": "全天",
"beginTime": "2023-07-21 08:00:00",
"endTime": "2023-07-21 17:59:59",
"status": 1,
"remain": 3500
},
{
"maxDuration": 45,
"name": "上午",
"beginTime": "2023-07-21 08:00:00",
"endTime": "2023-07-21 11:59:59",
"status": 1,
"remain": 2500
},
{
"maxDuration": 60,
"name": "下午",
"beginTime": "2023-07-21 13:00:00",
"endTime": "2023-07-21 17:59:59",
"status": 0,
"remain": 1000
},
{
"maxDuration": 60,
"name": "时间段",
"beginTime": "2023-07-21 13:00:00",
"endTime": "2023-07-21 15:00:00",
"status": 1,
"remain": 480
}
]
}
]
}
\ No newline at end of file
{
"orderId": "X10001",
"engineerCode": "E12005",
"engineerName": "祝枝山",
"engineerCodeAssist": "E12446",
"engineerNameAssist": "李晓阳",
"planVisitTime": "2023-07-27 12:00:00",
"realtimeInfo": {
"engineerLocation": {
"latitude": 31.349701,
"longitude": 120.675945,
"address": "江苏省苏州市苏州工业园区和顺路",
"name": "和顺大酒店"
},
"estimate": {
"distance": 2300,
"arriveTime": "2023-07-27 12:12:00"
}
}
}
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!