补全优化订单相关接口。

This commit is contained in:
徐晨晨 2021-11-10 09:38:11 +08:00
parent 2d6beef4c3
commit f5ba07a9bc
5 changed files with 94 additions and 19 deletions

View File

@ -42,7 +42,7 @@ public class OrderInfoController extends BaseController {
} }
@PostMapping(value = "page") @PostMapping(value = "page")
@ApiOperation(value = "获取分页报警基础信息") @ApiOperation(value = "获取分页订单基础信息")
private R<PageVo<OrderInfoVo>> page(@Validated({PageGroup.class, Default.class}) @RequestBody OrderInfoBasePageParam orderBaseParam) { private R<PageVo<OrderInfoVo>> page(@Validated({PageGroup.class, Default.class}) @RequestBody OrderInfoBasePageParam orderBaseParam) {
return orderInfoService.page(orderBaseParam); return orderInfoService.page(orderBaseParam);
} }
@ -63,4 +63,11 @@ public class OrderInfoController extends BaseController {
private R<PageVo<OrderInfoTaskDetVo>> getTaskInfo(@Validated @RequestBody OrderInfoTaskDetParam orderInfoTaskDetParam) { private R<PageVo<OrderInfoTaskDetVo>> getTaskInfo(@Validated @RequestBody OrderInfoTaskDetParam orderInfoTaskDetParam) {
return orderInfoService.getTaskInfo(orderInfoTaskDetParam); return orderInfoService.getTaskInfo(orderInfoTaskDetParam);
} }
@GetMapping(value = "getTaskInfoByIdenCardNum")
@ApiOperation(value = "根据标识卡获取信息")
private R<OrderInfoVo> getTaskInfoByIdenCardNum(@Validated @RequestParam String idenCardNum) {
return orderInfoService.getTaskInfoByIdenCardNum(idenCardNum);
}
} }

View File

@ -53,4 +53,10 @@ public interface OrderInfoService {
* @return 结果 * @return 结果
*/ */
R<PageVo<OrderInfoTaskDetVo>> getTaskInfo(OrderInfoTaskDetParam orderInfoTaskDetParam); R<PageVo<OrderInfoTaskDetVo>> getTaskInfo(OrderInfoTaskDetParam orderInfoTaskDetParam);
/**
* 创建加工订单时查询订单信息
* @param idenCardNum 标识卡号
* @return 结果
*/
R<OrderInfoVo> getTaskInfoByIdenCardNum(String idenCardNum);
} }

View File

@ -2,6 +2,16 @@ package com.mt.wms.empty.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mt.wms.basic.params.KilnInfoQueryParam;
import com.mt.wms.basic.params.LocationInfoQueryParam;
import com.mt.wms.basic.params.VehicleQueryParam;
import com.mt.wms.basic.service.KilnInfoService;
import com.mt.wms.basic.service.LocationInfoService;
import com.mt.wms.basic.service.VehicleService;
import com.mt.wms.basic.vo.KilnInfoVo;
import com.mt.wms.basic.vo.LocationInfoVo;
import com.mt.wms.basic.vo.VehicleVo;
import com.mt.wms.core.api.Assert;
import com.mt.wms.core.base.BaseService; import com.mt.wms.core.base.BaseService;
import com.mt.wms.core.dal.entity.OrderInfo; import com.mt.wms.core.dal.entity.OrderInfo;
import com.mt.wms.core.dal.service.OrderInfoServiceBiz; import com.mt.wms.core.dal.service.OrderInfoServiceBiz;
@ -14,7 +24,9 @@ import com.mt.wms.empty.params.OrderInfoBasePageParam;
import com.mt.wms.empty.params.OrderInfoPersonCreateParam; import com.mt.wms.empty.params.OrderInfoPersonCreateParam;
import com.mt.wms.empty.params.OrderInfoTaskDetParam; import com.mt.wms.empty.params.OrderInfoTaskDetParam;
import com.mt.wms.empty.service.CurrTaskDetService; import com.mt.wms.empty.service.CurrTaskDetService;
import com.mt.wms.empty.service.CurrTaskService;
import com.mt.wms.empty.service.OrderInfoService; import com.mt.wms.empty.service.OrderInfoService;
import com.mt.wms.empty.vo.CurrTaskVo;
import com.mt.wms.empty.vo.OrderInfoTaskDetVo; import com.mt.wms.empty.vo.OrderInfoTaskDetVo;
import com.mt.wms.empty.vo.OrderInfoVo; import com.mt.wms.empty.vo.OrderInfoVo;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
@ -23,6 +35,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/** /**
* xx服务实现类 * xx服务实现类
* *
@ -39,6 +55,16 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
@Autowired @Autowired
CurrTaskDetService currTaskDetService; CurrTaskDetService currTaskDetService;
@Autowired
CurrTaskService currTaskService;
@Autowired
KilnInfoService kilnInfoService;
@Autowired
VehicleService vehicleService;
@Autowired
LocationInfoService locationInfoService;
@Override @Override
@ -87,20 +113,52 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
/** /**
* todo 获取详细的拆分任务信息 * 获取详细的拆分任务信息
*/ */
@Override @Override
public R<PageVo<OrderInfoTaskDetVo>> getTaskInfo(OrderInfoTaskDetParam param) { public R<PageVo<OrderInfoTaskDetVo>> getTaskInfo(OrderInfoTaskDetParam param) {
//从任务详细中获取该标识卡和订单的所有订单 //从任务详细中获取该标识卡和订单的所有订单
PageVo<OrderInfoTaskDetVo> currOrderCurrTask = currTaskDetService.getCurrOrderCurrTask(param); PageVo<OrderInfoTaskDetVo> currOrderCurrTask = currTaskDetService.getCurrOrderCurrTask(param);
Assert.gtZero(currOrderCurrTask.getRecords().size(),"该订单暂无详细记录。");
//获取车辆信息 //获取车辆信息
//获取库位信息 R<List<VehicleVo>> vehicle = vehicleService.list(new VehicleQueryParam());
Map<Long, List<VehicleVo>> collect = vehicle.getData().stream().collect(Collectors.groupingBy(VehicleVo::getId));
//获取窑炉信息 //获取窑炉信息
R<List<KilnInfoVo>> kiln = kilnInfoService.list(new KilnInfoQueryParam());
Map<Long, List<KilnInfoVo>> collect2 = kiln.getData().stream().collect(Collectors.groupingBy(KilnInfoVo::getId));
currOrderCurrTask.getRecords().forEach(orderInfo -> currOrderCurrTask.getRecords().forEach(orderInfo ->
{ {
//获取对应的任务
CurrTaskVo currTask = currTaskService.getCurrTask(IdParam.builder().id(orderInfo.getCurrTaskId()).build());
orderInfo.setABeginTime(currTask.getABeginTime());
orderInfo.setAEndTime(currTask.getAEndTime());
orderInfo.setTaskType(currTask.getTaskType());
orderInfo.setStatus(currTask.getStatus());
orderInfo.setKilnId(currTask.getKilnId());
orderInfo.setStartPosition(currTask.getStartPosition());
orderInfo.setTargetPosition(currTask.getTargetPosition());
orderInfo.setVehicleId(currTask.getVehicleId());
//获取窑炉和车辆的名称信息
if (orderInfo.getKilnId() != null)
{
orderInfo.setKilnName(collect2.get(orderInfo.getKilnId()).get(0).getKilnName());
}
if (orderInfo.getVehicleId() != null)
{
orderInfo.setVehicleName(collect.get(orderInfo.getVehicleId()).get(0).getVehicleName());
}
} }
); );
return null; return successful(currOrderCurrTask);
}
@Override
public R<OrderInfoVo> getTaskInfoByIdenCardNum(String idenCardNum) {
QueryWrapper<OrderInfo> wrapper=new QueryWrapper<>();
wrapper.eq(OrderInfo.IDEN_CARD_NUM,idenCardNum).eq(OrderInfo.VALID,1).eq(OrderInfo.STATUS,0);
OrderInfo one = orderInfoService.getOne(wrapper);
OrderInfoVo build = OrderInfoVo.builder().build();
BeanUtils.copyProperties(one, build);
return successful(build);
} }
} }

View File

@ -34,6 +34,12 @@ public class OrderInfoTaskDetVo extends BaseVo implements PageVo.ConvertVo {
@ApiModelProperty(value = "任务编码") @ApiModelProperty(value = "任务编码")
private String taskCode; private String taskCode;
/**
* 任务编码, 查看任务编码规则
*/
@ApiModelProperty(value = "任务id")
private Long currTaskId;
/** /**
* 缓存前开始时间车辆开始执行 * 缓存前开始时间车辆开始执行
*/ */
@ -70,11 +76,23 @@ public class OrderInfoTaskDetVo extends BaseVo implements PageVo.ConvertVo {
@ApiModelProperty(value = "目标位置") @ApiModelProperty(value = "目标位置")
private String targetPosition; private String targetPosition;
/**
* 车辆id
*/
@ApiModelProperty(value = "车辆id")
private Long vehicleId;
/** /**
* 车辆名称 * 车辆名称
*/ */
@ApiModelProperty(value = "车辆名称") @ApiModelProperty(value = "车辆名称")
private String vehicleName; private String vehicleName;
/**
* 加工炉id
*/
@ApiModelProperty(value = "加工炉id")
private Long kilnId;
/** /**
* 加工炉名称 * 加工炉名称
*/ */

View File

@ -37,12 +37,6 @@ public class OrderInfoVo extends BaseVo implements PageVo.ConvertVo {
*/ */
@ApiModelProperty(value = "订单来源") @ApiModelProperty(value = "订单来源")
private Integer orderSource; private Integer orderSource;
/**
* 删除标志是否有效:1 可用 0不可用2停止
*/
@ApiModelProperty(value = "删除标志")
private Integer valid;
/** /**
* 添加时间每次修改记录要更新记录新增时间 * 添加时间每次修改记录要更新记录新增时间
*/ */
@ -66,14 +60,6 @@ public class OrderInfoVo extends BaseVo implements PageVo.ConvertVo {
*/ */
@ApiModelProperty(value = "修改时间") @ApiModelProperty(value = "修改时间")
private LocalDateTime updateTime; private LocalDateTime updateTime;
/**
* 版本号 默认为 1
*/
@ApiModelProperty(value = "版本号")
@Version
private String version;
/** /**
* 状态 0等待执行1执行中2执行完成3追加后完成追加后就按完成来算 * 状态 0等待执行1执行中2执行完成3追加后完成追加后就按完成来算
*/ */