历史订单与历史任务,详细历史任务相关内容
This commit is contained in:
parent
87f91696e4
commit
be66083e5e
@ -0,0 +1,56 @@
|
||||
package com.mt.wms.empty.controller;
|
||||
|
||||
import com.mt.wms.core.base.BaseController;
|
||||
import com.mt.wms.core.constants.CommonConstant;
|
||||
import com.mt.wms.core.params.IdParam;
|
||||
import com.mt.wms.core.validator.groups.PageGroup;
|
||||
import com.mt.wms.core.vo.PageVo;
|
||||
import com.mt.wms.core.vo.R;
|
||||
import com.mt.wms.empty.params.OrderInfoBasePageParam;
|
||||
import com.mt.wms.empty.params.OrderInfoTaskDetParam;
|
||||
import com.mt.wms.empty.service.OrderInfoHisService;
|
||||
import com.mt.wms.empty.vo.OrderInfoTaskDetVo;
|
||||
import com.mt.wms.empty.vo.OrderInfoVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.validation.groups.Default;
|
||||
|
||||
/**
|
||||
* @author xcc
|
||||
* @date 2021年11月8日
|
||||
* @since 1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(CommonConstant.API_MODULE_BASE + "orderInfoHis")
|
||||
@Slf4j
|
||||
@Api(value = "订单历史", tags = "订单历史", hidden = false)
|
||||
public class OrderInfoHisController extends BaseController {
|
||||
@Autowired
|
||||
private OrderInfoHisService orderInfoHisService;
|
||||
|
||||
@PostMapping(value = "page")
|
||||
@ApiOperation(value = "获取分页订单基础信息")
|
||||
private R<PageVo<OrderInfoVo>> page(@Validated({PageGroup.class, Default.class}) @RequestBody OrderInfoBasePageParam orderBaseParam) {
|
||||
return orderInfoHisService.page(orderBaseParam);
|
||||
}
|
||||
|
||||
@PostMapping(value = "get")
|
||||
@ApiOperation(value = "订单历史查看详情")
|
||||
private R<OrderInfoVo> get(@Validated @RequestBody IdParam idParam) {
|
||||
return orderInfoHisService.getOne(idParam);
|
||||
}
|
||||
|
||||
@PostMapping(value = "getTaskInfo")
|
||||
@ApiOperation(value = "订单历史任务详情")
|
||||
private R<PageVo<OrderInfoTaskDetVo>> getTaskInfo(@Validated @RequestBody OrderInfoTaskDetParam orderInfoTaskDetParam) {
|
||||
return orderInfoHisService.getTaskInfo(orderInfoTaskDetParam);
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.mt.wms.empty.controller;
|
||||
|
||||
import com.mt.wms.core.base.BaseController;
|
||||
import com.mt.wms.core.constants.CommonConstant;
|
||||
import com.mt.wms.empty.service.CurrTaskDetService;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @author xcc
|
||||
* @date 2021年11月16日
|
||||
* @since 1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(CommonConstant.API_MODULE_BASE + "taskDetHis")
|
||||
@Slf4j
|
||||
@Api(value = "任务详情历史", tags = "任务详情历史管理", hidden = false)
|
||||
public class TaskDetHisController extends BaseController {
|
||||
@Autowired
|
||||
CurrTaskDetService currTaskDetService;
|
||||
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.mt.wms.empty.controller;
|
||||
|
||||
import com.mt.wms.core.base.BaseController;
|
||||
import com.mt.wms.core.constants.CommonConstant;
|
||||
import com.mt.wms.empty.service.CurrTaskService;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @author xcc
|
||||
* @date 2021年11月16日
|
||||
* @since 1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(CommonConstant.API_MODULE_BASE + "taskHis")
|
||||
@Slf4j
|
||||
@Api(value = "任务历史管理", tags = "任务历史管理", hidden = false)
|
||||
public class TaskHisController extends BaseController {
|
||||
@Autowired
|
||||
private CurrTaskService currTaskService;
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
package com.mt.wms.empty.service;
|
||||
|
||||
import com.mt.wms.core.dal.entity.OrderInfo;
|
||||
import com.mt.wms.core.params.IdParam;
|
||||
import com.mt.wms.core.vo.IdVo;
|
||||
import com.mt.wms.core.vo.PageVo;
|
||||
import com.mt.wms.core.vo.R;
|
||||
import com.mt.wms.empty.params.OrderInfoBasePageParam;
|
||||
import com.mt.wms.empty.params.OrderInfoTaskDetParam;
|
||||
import com.mt.wms.empty.vo.OrderInfoTaskDetVo;
|
||||
import com.mt.wms.empty.vo.OrderInfoVo;
|
||||
|
||||
/**
|
||||
* 订单历史相关服务
|
||||
*
|
||||
* @author xcc
|
||||
* @date 2021年11月16日
|
||||
* @since 1.0
|
||||
*/
|
||||
public interface OrderInfoHisService {
|
||||
/**
|
||||
* 保存历史订单信息
|
||||
*
|
||||
* @param orderInfo 订单详细
|
||||
* @return id
|
||||
*/
|
||||
R<IdVo> save(OrderInfo orderInfo);
|
||||
|
||||
|
||||
/**
|
||||
* 查询当前订单列表
|
||||
*
|
||||
* @param orderInfoBasePageParam 查询参数
|
||||
* @return 分页结果集
|
||||
*/
|
||||
R<PageVo<OrderInfoVo>> page(OrderInfoBasePageParam orderInfoBasePageParam);
|
||||
|
||||
/**
|
||||
* 获取详细单条信息
|
||||
*
|
||||
* @param idParam id主键
|
||||
* @return 结果
|
||||
*/
|
||||
R<OrderInfoVo> getOne(IdParam idParam);
|
||||
|
||||
/**
|
||||
* 获取当前订单的详细任务信息
|
||||
*
|
||||
* @param orderInfoTaskDetParam 标识卡号与订单号
|
||||
* @return 结果
|
||||
*/
|
||||
R<PageVo<OrderInfoTaskDetVo>> getTaskInfo(OrderInfoTaskDetParam orderInfoTaskDetParam);
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package com.mt.wms.empty.service;
|
||||
|
||||
import com.mt.wms.core.dal.entity.TaskDetHis;
|
||||
import com.mt.wms.core.vo.PageVo;
|
||||
import com.mt.wms.core.vo.R;
|
||||
import com.mt.wms.empty.params.OrderInfoTaskDetParam;
|
||||
import com.mt.wms.empty.vo.OrderInfoTaskDetVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 拆分任务相关服务
|
||||
*
|
||||
* @author xcc
|
||||
* @date 2021年11月8日
|
||||
* @since 1.0
|
||||
*/
|
||||
public interface TaskDetHisService {
|
||||
/**
|
||||
* 保存任务详情历史
|
||||
*
|
||||
* @param taskDetHis 任务详情历史
|
||||
* @return 结果
|
||||
*/
|
||||
R save(TaskDetHis taskDetHis);
|
||||
|
||||
/**
|
||||
* 保存任务详情历史list
|
||||
*
|
||||
* @param taskDetHis 任务详情历史
|
||||
* @return 结果
|
||||
*/
|
||||
R saveList(List<TaskDetHis> taskDetHis);
|
||||
|
||||
/**
|
||||
* 保存任务详情历史list
|
||||
*
|
||||
* @param param 任务详情历史
|
||||
* @return 结果
|
||||
*/
|
||||
PageVo<OrderInfoTaskDetVo> getHisOrderHisTask(OrderInfoTaskDetParam param);
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package com.mt.wms.empty.service;
|
||||
|
||||
import com.mt.wms.core.dal.entity.TaskHis;
|
||||
import com.mt.wms.core.params.IdParam;
|
||||
import com.mt.wms.core.vo.IdVo;
|
||||
import com.mt.wms.core.vo.R;
|
||||
import com.mt.wms.empty.vo.CurrTaskVo;
|
||||
|
||||
/**
|
||||
* 拆分任务相关服务
|
||||
*
|
||||
* @author xcc
|
||||
* @date 2021年11月8日
|
||||
* @since 1.0
|
||||
*/
|
||||
public interface TaskHisService {
|
||||
|
||||
/**
|
||||
* 保存任务历史
|
||||
*
|
||||
* @param taskHis 任务历史
|
||||
* @return 结果
|
||||
*/
|
||||
R<IdVo> save(TaskHis taskHis);
|
||||
|
||||
/**
|
||||
* 查询任务历史
|
||||
*
|
||||
* @param id 任务历史
|
||||
* @return 结果
|
||||
*/
|
||||
CurrTaskVo getById(IdParam id);
|
||||
}
|
@ -0,0 +1,129 @@
|
||||
package com.mt.wms.empty.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.mt.wms.basic.params.KilnInfoQueryParam;
|
||||
import com.mt.wms.basic.params.VehicleQueryParam;
|
||||
import com.mt.wms.basic.service.KilnInfoService;
|
||||
import com.mt.wms.basic.service.VehicleService;
|
||||
import com.mt.wms.basic.vo.KilnInfoVo;
|
||||
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.dal.entity.OrderInfo;
|
||||
import com.mt.wms.core.dal.entity.OrderInfoHis;
|
||||
import com.mt.wms.core.dal.service.OrderInfoHisServiceBiz;
|
||||
import com.mt.wms.core.params.IdParam;
|
||||
import com.mt.wms.core.vo.IdVo;
|
||||
import com.mt.wms.core.vo.PageVo;
|
||||
import com.mt.wms.core.vo.R;
|
||||
import com.mt.wms.empty.params.OrderInfoBasePageParam;
|
||||
import com.mt.wms.empty.params.OrderInfoTaskDetParam;
|
||||
import com.mt.wms.empty.service.OrderInfoHisService;
|
||||
import com.mt.wms.empty.service.TaskDetHisService;
|
||||
import com.mt.wms.empty.service.TaskHisService;
|
||||
import com.mt.wms.empty.vo.CurrTaskVo;
|
||||
import com.mt.wms.empty.vo.OrderInfoTaskDetVo;
|
||||
import com.mt.wms.empty.vo.OrderInfoVo;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* xx服务实现类
|
||||
*
|
||||
* @author xcc
|
||||
* @date 2021年11月8日
|
||||
* @since 1.0
|
||||
*/
|
||||
@Service
|
||||
@Transactional
|
||||
public class OrderInfoHisServiceImpl extends BaseService implements OrderInfoHisService {
|
||||
|
||||
@Autowired
|
||||
OrderInfoHisServiceBiz orderInfoHisServiceBiz;
|
||||
|
||||
@Autowired
|
||||
TaskDetHisService taskDetHisService;
|
||||
|
||||
@Autowired
|
||||
TaskHisService taskHisService;
|
||||
|
||||
@Autowired
|
||||
VehicleService vehicleService;
|
||||
|
||||
@Autowired
|
||||
KilnInfoService kilnInfoService;
|
||||
|
||||
@Override
|
||||
public R<IdVo> save(OrderInfo orderInfo) {
|
||||
OrderInfoHis orderInfoHis = new OrderInfoHis();
|
||||
BeanUtils.copyProperties(orderInfo, orderInfoHis);
|
||||
//设置任务状态位完成
|
||||
orderInfoHis.setStatus(2);
|
||||
orderInfoHisServiceBiz.save(orderInfoHis);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<PageVo<OrderInfoVo>> page(OrderInfoBasePageParam param) {
|
||||
QueryWrapper<OrderInfoHis> wrapper = new QueryWrapper<>();
|
||||
wrapper.like(StringUtils.isNotBlank(param.getIdenCardNum()), OrderInfo.IDEN_CARD_NUM, param.getIdenCardNum())
|
||||
.like(StringUtils.isNotBlank(param.getOrderNo()), OrderInfo.ORDER_NO, param.getOrderNo())
|
||||
.eq(OrderInfo.VALID, 1)
|
||||
.orderByDesc(OrderInfo.CREATE_TIME);
|
||||
Page<OrderInfoHis> page = orderInfoHisServiceBiz.page(new Page<>(param.getCurrent(), param.getSize()), wrapper);
|
||||
return successful(new PageVo<>(page, OrderInfoVo.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<OrderInfoVo> getOne(IdParam idParam) {
|
||||
OrderInfoHis byId = orderInfoHisServiceBiz.getById(idParam.getId());
|
||||
OrderInfoVo build = OrderInfoVo.builder().build();
|
||||
BeanUtils.copyProperties(byId, build);
|
||||
return successful(build);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<PageVo<OrderInfoTaskDetVo>> getTaskInfo(OrderInfoTaskDetParam param) {
|
||||
//从历史任务详细中获取该标识卡和订单的所有订单
|
||||
PageVo<OrderInfoTaskDetVo> currOrderCurrTask = taskDetHisService.getHisOrderHisTask(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 ->
|
||||
{
|
||||
//获取对应的任务
|
||||
CurrTaskVo currTask = taskHisService.getById(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 successful(currOrderCurrTask);
|
||||
}
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package com.mt.wms.empty.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.mt.wms.core.base.BaseService;
|
||||
import com.mt.wms.core.dal.entity.CurrTaskDet;
|
||||
import com.mt.wms.core.dal.entity.TaskDetHis;
|
||||
import com.mt.wms.core.dal.service.TaskDetHisServiceBiz;
|
||||
import com.mt.wms.core.vo.PageVo;
|
||||
import com.mt.wms.core.vo.R;
|
||||
import com.mt.wms.empty.params.OrderInfoTaskDetParam;
|
||||
import com.mt.wms.empty.service.TaskDetHisService;
|
||||
import com.mt.wms.empty.vo.OrderInfoTaskDetVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* xx服务实现类
|
||||
*
|
||||
* @author xcc
|
||||
* @date 2021年11月8日
|
||||
* @since 1.0
|
||||
*/
|
||||
@Service
|
||||
@Transactional
|
||||
public class TaskDetHisServiceImpl extends BaseService implements TaskDetHisService {
|
||||
|
||||
@Autowired
|
||||
TaskDetHisServiceBiz taskDetHisServiceBiz;
|
||||
|
||||
|
||||
@Override
|
||||
public R save(TaskDetHis taskDetHis) {
|
||||
taskDetHisServiceBiz.save(taskDetHis);
|
||||
return successful("操作成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public R saveList(List<TaskDetHis> taskDetHis) {
|
||||
taskDetHisServiceBiz.saveBatch(taskDetHis);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageVo<OrderInfoTaskDetVo> getHisOrderHisTask(OrderInfoTaskDetParam param) {
|
||||
QueryWrapper<TaskDetHis> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq(CurrTaskDet.IDEN_CARD_NUM, param.getIdenCardNum())
|
||||
.eq(CurrTaskDet.ORDER_NO, param.getOrderNo())
|
||||
.eq(CurrTaskDet.VALID, 1);
|
||||
Page<TaskDetHis> page = taskDetHisServiceBiz.page(new Page<>(param.getCurrent(), param.getSize()), queryWrapper);
|
||||
return new PageVo<>(page, OrderInfoTaskDetVo.class);
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package com.mt.wms.empty.service.impl;
|
||||
|
||||
import com.mt.wms.core.base.BaseService;
|
||||
import com.mt.wms.core.dal.entity.TaskHis;
|
||||
import com.mt.wms.core.dal.service.TaskHisServiceBiz;
|
||||
import com.mt.wms.core.params.IdParam;
|
||||
import com.mt.wms.core.vo.IdVo;
|
||||
import com.mt.wms.core.vo.R;
|
||||
import com.mt.wms.empty.service.TaskHisService;
|
||||
import com.mt.wms.empty.vo.CurrTaskVo;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* xx服务实现类
|
||||
*
|
||||
* @author xcc
|
||||
* @date 2021年11月8日
|
||||
* @since 1.0
|
||||
*/
|
||||
@Service
|
||||
@Transactional
|
||||
public class TaskHisServiceImpl extends BaseService implements TaskHisService {
|
||||
|
||||
@Autowired
|
||||
TaskHisServiceBiz taskHisService;
|
||||
|
||||
|
||||
@Override
|
||||
public R<IdVo> save(TaskHis taskHis) {
|
||||
taskHisService.save(taskHis);
|
||||
return successful(IdVo.builder().id(taskHis.getId()).build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public CurrTaskVo getById(IdParam id) {
|
||||
TaskHis byId = taskHisService.getById(id.getId());
|
||||
CurrTaskVo build = CurrTaskVo.builder().build();
|
||||
BeanUtils.copyProperties(byId, build);
|
||||
return build;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user