diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/OrderInfoHisController.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/OrderInfoHisController.java new file mode 100644 index 0000000..ac91c41 --- /dev/null +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/OrderInfoHisController.java @@ -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> page(@Validated({PageGroup.class, Default.class}) @RequestBody OrderInfoBasePageParam orderBaseParam) { + return orderInfoHisService.page(orderBaseParam); + } + + @PostMapping(value = "get") + @ApiOperation(value = "订单历史查看详情") + private R get(@Validated @RequestBody IdParam idParam) { + return orderInfoHisService.getOne(idParam); + } + + @PostMapping(value = "getTaskInfo") + @ApiOperation(value = "订单历史任务详情") + private R> getTaskInfo(@Validated @RequestBody OrderInfoTaskDetParam orderInfoTaskDetParam) { + return orderInfoHisService.getTaskInfo(orderInfoTaskDetParam); + } +} diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/TaskDetHisController.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/TaskDetHisController.java new file mode 100644 index 0000000..479b30d --- /dev/null +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/TaskDetHisController.java @@ -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; + +} diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/TaskHisController.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/TaskHisController.java new file mode 100644 index 0000000..02a66a1 --- /dev/null +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/TaskHisController.java @@ -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; +} diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/OrderInfoHisService.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/OrderInfoHisService.java new file mode 100644 index 0000000..7af657c --- /dev/null +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/OrderInfoHisService.java @@ -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 save(OrderInfo orderInfo); + + + /** + * 查询当前订单列表 + * + * @param orderInfoBasePageParam 查询参数 + * @return 分页结果集 + */ + R> page(OrderInfoBasePageParam orderInfoBasePageParam); + + /** + * 获取详细单条信息 + * + * @param idParam id主键 + * @return 结果 + */ + R getOne(IdParam idParam); + + /** + * 获取当前订单的详细任务信息 + * + * @param orderInfoTaskDetParam 标识卡号与订单号 + * @return 结果 + */ + R> getTaskInfo(OrderInfoTaskDetParam orderInfoTaskDetParam); +} diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/TaskDetHisService.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/TaskDetHisService.java new file mode 100644 index 0000000..56d100e --- /dev/null +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/TaskDetHisService.java @@ -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); + + /** + * 保存任务详情历史list + * + * @param param 任务详情历史 + * @return 结果 + */ + PageVo getHisOrderHisTask(OrderInfoTaskDetParam param); +} diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/TaskHisService.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/TaskHisService.java new file mode 100644 index 0000000..60e1160 --- /dev/null +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/TaskHisService.java @@ -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 save(TaskHis taskHis); + + /** + * 查询任务历史 + * + * @param id 任务历史 + * @return 结果 + */ + CurrTaskVo getById(IdParam id); +} diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/OrderInfoHisServiceImpl.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/OrderInfoHisServiceImpl.java new file mode 100644 index 0000000..d46851f --- /dev/null +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/OrderInfoHisServiceImpl.java @@ -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 save(OrderInfo orderInfo) { + OrderInfoHis orderInfoHis = new OrderInfoHis(); + BeanUtils.copyProperties(orderInfo, orderInfoHis); + //设置任务状态位完成 + orderInfoHis.setStatus(2); + orderInfoHisServiceBiz.save(orderInfoHis); + return null; + } + + @Override + public R> page(OrderInfoBasePageParam param) { + QueryWrapper 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 page = orderInfoHisServiceBiz.page(new Page<>(param.getCurrent(), param.getSize()), wrapper); + return successful(new PageVo<>(page, OrderInfoVo.class)); + } + + @Override + public R getOne(IdParam idParam) { + OrderInfoHis byId = orderInfoHisServiceBiz.getById(idParam.getId()); + OrderInfoVo build = OrderInfoVo.builder().build(); + BeanUtils.copyProperties(byId, build); + return successful(build); + } + + @Override + public R> getTaskInfo(OrderInfoTaskDetParam param) { + //从历史任务详细中获取该标识卡和订单的所有订单 + PageVo currOrderCurrTask = taskDetHisService.getHisOrderHisTask(param); + Assert.gtZero(currOrderCurrTask.getRecords().size(), "该订单暂无详细记录。"); + //获取车辆信息 + R> vehicle = vehicleService.list(new VehicleQueryParam()); + Map> collect = vehicle.getData().stream().collect(Collectors.groupingBy(VehicleVo::getId)); + //获取窑炉信息 + R> kiln = kilnInfoService.list(new KilnInfoQueryParam()); + Map> 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); + } +} diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/TaskDetHisServiceImpl.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/TaskDetHisServiceImpl.java new file mode 100644 index 0000000..616e9bb --- /dev/null +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/TaskDetHisServiceImpl.java @@ -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) { + taskDetHisServiceBiz.saveBatch(taskDetHis); + return null; + } + + @Override + public PageVo getHisOrderHisTask(OrderInfoTaskDetParam param) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq(CurrTaskDet.IDEN_CARD_NUM, param.getIdenCardNum()) + .eq(CurrTaskDet.ORDER_NO, param.getOrderNo()) + .eq(CurrTaskDet.VALID, 1); + Page page = taskDetHisServiceBiz.page(new Page<>(param.getCurrent(), param.getSize()), queryWrapper); + return new PageVo<>(page, OrderInfoTaskDetVo.class); + } +} diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/TaskHisServiceImpl.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/TaskHisServiceImpl.java new file mode 100644 index 0000000..7946368 --- /dev/null +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/TaskHisServiceImpl.java @@ -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 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; + } +}