|
|
@@ -0,0 +1,456 @@
|
|
|
+/*
|
|
|
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
|
|
|
+ *
|
|
|
+ * Redistribution and use in source and binary forms, with or without
|
|
|
+ * modification, are permitted provided that the following conditions are met:
|
|
|
+ *
|
|
|
+ * Redistributions of source code must retain the above copyright notice,
|
|
|
+ * this list of conditions and the following disclaimer.
|
|
|
+ * Redistributions in binary form must reproduce the above copyright
|
|
|
+ * notice, this list of conditions and the following disclaimer in the
|
|
|
+ * documentation and/or other materials provided with the distribution.
|
|
|
+ * Neither the name of the dreamlu.net developer nor the names of its
|
|
|
+ * contributors may be used to endorse or promote products derived from
|
|
|
+ * this software without specific prior written permission.
|
|
|
+ * Author: Chill 庄骞 (smallchill@163.com)
|
|
|
+ */
|
|
|
+package org.springblade.purchase.sales.dealer;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
+import com.trade.purchase.order.enums.OrderTypeEnum;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import io.swagger.annotations.ApiParam;
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
+import org.springblade.client.entity.CorpsDesc;
|
|
|
+import org.springblade.client.entity.FeesDesc;
|
|
|
+import org.springblade.client.entity.StorageDesc;
|
|
|
+import org.springblade.client.feign.ICorpsDescClient;
|
|
|
+import org.springblade.client.feign.IFeesDescClient;
|
|
|
+import org.springblade.client.feign.IStorageClient;
|
|
|
+import org.springblade.core.boot.ctrl.BladeController;
|
|
|
+import org.springblade.core.mp.support.Condition;
|
|
|
+import org.springblade.core.mp.support.Query;
|
|
|
+import org.springblade.core.secure.utils.AuthUtil;
|
|
|
+import org.springblade.core.secure.utils.SecureUtil;
|
|
|
+import org.springblade.core.tool.api.R;
|
|
|
+import org.springblade.core.tool.utils.Func;
|
|
|
+import org.springblade.core.tool.utils.StringUtil;
|
|
|
+import org.springblade.deliver.goods.entity.Delivery;
|
|
|
+import org.springblade.deliver.goods.feign.IDeliveryClient;
|
|
|
+import org.springblade.finance.feign.IFinanceClient;
|
|
|
+import org.springblade.finance.vojo.Acc;
|
|
|
+import org.springblade.purchase.sales.entity.Order;
|
|
|
+import org.springblade.purchase.sales.entity.OrderFees;
|
|
|
+import org.springblade.purchase.sales.entity.OrderItems;
|
|
|
+import org.springblade.purchase.sales.service.*;
|
|
|
+import org.springblade.purchase.sales.vo.OrderItemsVO;
|
|
|
+import org.springblade.purchase.sales.vo.OrderStatisticAnalysisVO;
|
|
|
+import org.springblade.purchase.sales.vo.OrderVO;
|
|
|
+import org.springblade.system.user.entity.User;
|
|
|
+import org.springblade.system.user.feign.IUserClient;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import javax.validation.Valid;
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 国内销售或采购订单表 控制器
|
|
|
+ *
|
|
|
+ * @author BladeX
|
|
|
+ * @since 2021-09-26
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@AllArgsConstructor
|
|
|
+@RequestMapping("/dealerOrder")
|
|
|
+@Api(value = "经销商销售订单", tags = "经销商销售订单")
|
|
|
+public class DealerOrderController extends BladeController {
|
|
|
+
|
|
|
+ private final IOrderService orderService;
|
|
|
+ private final IOrderItemsService orderItemsService;
|
|
|
+ private final IOrderFeesService orderFeesService;
|
|
|
+ private final IOrderFilesService orderFilesService;
|
|
|
+ private final IOrderFreightService orderFreightService;
|
|
|
+ private final IOrderModifyService orderModifyService;
|
|
|
+ private final IOrderPartsService orderPartsService;
|
|
|
+ private final ICorpsDescClient corpsDescClient;//获取客户信息
|
|
|
+ private final IUserClient userClient;//获取用户信息
|
|
|
+ private final IFeesDescClient feesDescClient;
|
|
|
+ private final IFinanceClient iFinanceClient;
|
|
|
+ private final IDeliveryClient deliveryClient;
|
|
|
+ private IStorageClient iStorageClient;//库区信息
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 详情
|
|
|
+ */
|
|
|
+ @GetMapping("/detail")
|
|
|
+ @ApiOperationSupport(order = 1)
|
|
|
+ @ApiOperation(value = "详情", notes = "传入order")
|
|
|
+ public R<Order> detail(Order order) {
|
|
|
+ order.setIsDeleted(0);
|
|
|
+ order.setTenantId(SecureUtil.getTenantId());
|
|
|
+ Order detail = orderService.getOrderMessage(order);
|
|
|
+ return R.data(detail);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 经销商销售或采购订单表
|
|
|
+ */
|
|
|
+ @GetMapping("/list")
|
|
|
+ @ApiOperationSupport(order = 2)
|
|
|
+ @ApiOperation(value = "分页", notes = "传入order")
|
|
|
+ public R<IPage<Order>> list(Order order, Query query) {
|
|
|
+ order.setIsDeleted(0);
|
|
|
+ order.setTenantId(SecureUtil.getTenantId());
|
|
|
+ order.setBillType(OrderTypeEnum.SALES.getType());
|
|
|
+ order.setTradeType(OrderTypeEnum.DEALER.getType());
|
|
|
+ IPage<Order> pages = orderService.page(Condition.getPage(query), Condition.getQueryWrapper(order));
|
|
|
+ return R.data(pages);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 自定义分页 销售或采购订单表
|
|
|
+ */
|
|
|
+ @GetMapping("/page")
|
|
|
+ @ApiOperationSupport(order = 3)
|
|
|
+ @ApiOperation(value = "分页", notes = "传入order")
|
|
|
+ public R<IPage<Order>> page(OrderVO order, Query query) {
|
|
|
+ LambdaQueryWrapper<Order> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ lambdaQueryWrapper.eq(Order::getTenantId, SecureUtil.getTenantId());//租户id
|
|
|
+ lambdaQueryWrapper.eq(Order::getIsDeleted, 0);//订单是否有效
|
|
|
+ lambdaQueryWrapper.eq(Order::getBillType, OrderTypeEnum.SALES.getType());//订单类型
|
|
|
+ lambdaQueryWrapper.eq(Order::getTradeType, OrderTypeEnum.DEALER.getType());//贸易类型
|
|
|
+ lambdaQueryWrapper.like(Func.isNotEmpty(order.getOrderNo()), Order::getOrderNo, order.getOrderNo());//订单号
|
|
|
+ lambdaQueryWrapper.like(Func.isNotEmpty(order.getCorpId()), Order::getCorpId, order.getCorpId());//客户id
|
|
|
+ lambdaQueryWrapper.ge(Func.isNotEmpty(order.getContractStartDate()), Order::getBusinesDate, order.getContractStartDate());//合同日期开始
|
|
|
+ lambdaQueryWrapper.le(Func.isNotEmpty(order.getContractEndDate()), Order::getBusinesDate, order.getContractEndDate());//合同日期结束
|
|
|
+ lambdaQueryWrapper.like(Func.isNotEmpty(order.getSrcOrderNo()), Order::getSrcOrderNo, order.getSrcOrderNo());//订单来源
|
|
|
+ lambdaQueryWrapper.like(Func.isNotEmpty(order.getShippingAddress()), Order::getShippingAddress, order.getShippingAddress());//发货地址
|
|
|
+ lambdaQueryWrapper.like(Func.isNotEmpty(order.getArrivalAddress()), Order::getArrivalAddress, order.getArrivalAddress());//到货地址
|
|
|
+ lambdaQueryWrapper.ge(Func.isNotEmpty(order.getActualDeliveryDateStart()), Order::getActualDeliveryDate, order.getActualDeliveryDateStart());//发货日期开始
|
|
|
+ lambdaQueryWrapper.le(Func.isNotEmpty(order.getActualDeliveryDateEnd()), Order::getActualDeliveryDate, order.getActualDeliveryDateEnd());//发货日期结束
|
|
|
+ lambdaQueryWrapper.ge(Func.isNotEmpty(order.getDeliveryStartDate()), Order::getRequiredDeliveryDate, order.getDeliveryStartDate());//要求发货日期开始
|
|
|
+ lambdaQueryWrapper.le(Func.isNotEmpty(order.getDeliveryEndDate()), Order::getRequiredDeliveryDate, order.getDeliveryEndDate());//要求发货日期结束
|
|
|
+ lambdaQueryWrapper.ge(Func.isNotEmpty(order.getArrivalDateStart()), Order::getRequiredArrivalDate, order.getArrivalDateStart());//要求到货日期开始
|
|
|
+ lambdaQueryWrapper.le(Func.isNotEmpty(order.getArrivalDateEnd()), Order::getRequiredArrivalDate, order.getArrivalDateEnd());//要求到货日期结束
|
|
|
+ lambdaQueryWrapper.like(Func.isNotEmpty(order.getOrderStatus()), Order::getOrderStatus, order.getOrderStatus());//单据状态
|
|
|
+ lambdaQueryWrapper.like(Func.isNotEmpty(order.getSysNo()), Order::getSysNo, order.getSysNo());//系统编号
|
|
|
+ lambdaQueryWrapper.eq(Func.isNotEmpty(order.getCreateUser()), Order::getCreateUser, order.getCreateUser());//制单人
|
|
|
+ lambdaQueryWrapper.ge(Func.isNotEmpty(order.getCreateTimeStart()), Order::getCreateTime, order.getCreateTimeStart());//制单日期开始
|
|
|
+ lambdaQueryWrapper.le(Func.isNotEmpty(order.getCreateTimeEnd()), Order::getCreateTime, order.getCreateTimeEnd());//制单日期结束
|
|
|
+ lambdaQueryWrapper.ge(Func.isNotEmpty(order.getDateValidityStart()), Order::getDateValidity, order.getDateValidityStart());//有效日期开始
|
|
|
+ lambdaQueryWrapper.le(Func.isNotEmpty(order.getDateValidityEnd()), Order::getDateValidity, order.getDateValidityEnd());//有效日期结束
|
|
|
+ lambdaQueryWrapper.ge(Func.isNotEmpty(order.getOrderStartDate()), Order::getBusinesDate, order.getOrderStartDate());//订单日期开始
|
|
|
+ lambdaQueryWrapper.le(Func.isNotEmpty(order.getOrderEndDate()), Order::getBusinesDate, order.getOrderEndDate());//订单日期结束
|
|
|
+ lambdaQueryWrapper.like(Func.isNotEmpty(order.getPortOfLoad()), Order::getPortOfLoad, order.getPortOfLoad());//装货港
|
|
|
+ lambdaQueryWrapper.like(Func.isNotEmpty(order.getPortOfDestination()), Order::getPortOfDestination, order.getPortOfDestination());//目的港
|
|
|
+ lambdaQueryWrapper.like(Func.isNotEmpty(order.getPlannedDeliveryStart()), Order::getPlannedDeliveryDate, order.getPlannedDeliveryStart());//计划交货开始
|
|
|
+ lambdaQueryWrapper.like(Func.isNotEmpty(order.getPlannedDeliveryEnd()), Order::getPlannedDeliveryDate, order.getPlannedDeliveryEnd());//计划交货结束
|
|
|
+ lambdaQueryWrapper.like(Func.isNotEmpty(order.getOrderRemark()), Order::getOrderRemark, order.getOrderRemark());//备注
|
|
|
+ lambdaQueryWrapper.orderByDesc(Order::getId);
|
|
|
+ IPage<Order> page = orderService.page(Condition.getPage(query), lambdaQueryWrapper);
|
|
|
+ if (CollectionUtils.isNotEmpty(page.getRecords())) {
|
|
|
+ page.getRecords().stream().forEach(item -> {
|
|
|
+ if (item.getCorpId() != null) {
|
|
|
+ R<CorpsDesc> corpMessage = corpsDescClient.getCorpMessage(item.getCorpId());//客户
|
|
|
+ if (corpMessage.isSuccess() && corpMessage.getData() != null) {
|
|
|
+ item.setCorpsName(corpMessage.getData().getCname());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (item.getBelongToCorpId() != null) {
|
|
|
+ R<CorpsDesc> corpMessage = corpsDescClient.getCorpMessage(item.getBelongToCorpId());//销售公司
|
|
|
+ if (corpMessage.isSuccess() && corpMessage.getData() != null) {
|
|
|
+ item.setBelongToCorpName(corpMessage.getData().getCname());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (item.getProductionPlant() != null) {
|
|
|
+ R<CorpsDesc> corpMessage = corpsDescClient.getCorpMessage(item.getProductionPlant());//销售公司
|
|
|
+ if (corpMessage.isSuccess() && corpMessage.getData() != null) {
|
|
|
+ item.setProductionPlantName(corpMessage.getData().getCname());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ R<User> user = userClient.userInfoById(item.getCreateUser());//制单人
|
|
|
+ if (user.isSuccess() && user.getData() != null) {
|
|
|
+ item.setCreateUserName(user.getData().getName());
|
|
|
+ }
|
|
|
+ //仓库信息
|
|
|
+ StorageDesc storageDesc = iStorageClient.findById(item.getStorageId());
|
|
|
+ if(storageDesc!=null)
|
|
|
+ {
|
|
|
+ item.setStorageName(storageDesc.getCname());
|
|
|
+ }
|
|
|
+ //获取订单明细
|
|
|
+ List<OrderItems> list = orderItemsService.list(new QueryWrapper<OrderItems>().eq("pid", item.getId()).eq("is_deleted", 0));
|
|
|
+ if (CollectionUtils.isNotEmpty(list)) {
|
|
|
+ item.setOrderQuantity(list.stream().map(OrderItems::getOrderQuantity).reduce(BigDecimal.ZERO, BigDecimal::add));//数量合计
|
|
|
+ item.setAmount(list.stream().map(OrderItems::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add));//销售金额
|
|
|
+ item.setPurchaseAmount(list.stream().map(OrderItems::getPurchaseAmount).reduce(BigDecimal.ZERO, BigDecimal::add));//采购金额
|
|
|
+ item.setActualQuantity(list.stream().map(OrderItems::getActualQuantity).reduce(BigDecimal.ZERO, BigDecimal::add));//发货数量
|
|
|
+ item.setActualWeight(list.stream().map(OrderItems::getActualWeight).reduce(BigDecimal.ZERO, BigDecimal::add));//已发重量(吨)
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return R.data(page);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增 销售或采购订单表
|
|
|
+ */
|
|
|
+ @PostMapping("/save")
|
|
|
+ @ApiOperationSupport(order = 4)
|
|
|
+ @ApiOperation(value = "新增", notes = "传入order")
|
|
|
+ public R save(@Valid @RequestBody Order order) {
|
|
|
+ return R.status(orderService.save(order));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改 销售或采购订单表
|
|
|
+ */
|
|
|
+ @PostMapping("/update")
|
|
|
+ @ApiOperationSupport(order = 5)
|
|
|
+ @ApiOperation(value = "修改", notes = "传入order")
|
|
|
+ public R update(@Valid @RequestBody Order order) {
|
|
|
+ if (order.getId() == null) {
|
|
|
+ throw new SecurityException("请选择要删除的数据");
|
|
|
+ }
|
|
|
+ //先查订单信息
|
|
|
+ Order orderMessage = orderService.getById(order.getId());
|
|
|
+ //是否生成采购单
|
|
|
+ LambdaQueryWrapper<Order> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ lambdaQueryWrapper.eq(Order::getSrcOrderNo, orderMessage.getSysNo());
|
|
|
+ lambdaQueryWrapper.eq(Order::getTradeType, OrderTypeEnum.DEALER.getType());
|
|
|
+ lambdaQueryWrapper.eq(Order::getIsDeleted, 0);
|
|
|
+ lambdaQueryWrapper.eq(Order::getBillType, OrderTypeEnum.PURCHASE.getType());
|
|
|
+ List<Order> orderList = orderService.list(lambdaQueryWrapper);
|
|
|
+ if (CollectionUtils.isNotEmpty(orderList)) {
|
|
|
+ throw new SecurityException("销售单已生成采购单不能删除");
|
|
|
+ }
|
|
|
+ //是否生成发货单
|
|
|
+ List<Delivery> list = deliveryClient.getOrderMessage(orderMessage.getSysNo(), OrderTypeEnum.DEALER.getType());
|
|
|
+ if (CollectionUtils.isNotEmpty(list)) {
|
|
|
+ throw new SecurityException("销售单已生成发货单不能删除");
|
|
|
+ }
|
|
|
+ //是否生成账单单
|
|
|
+ List<Acc> financeAcc = iFinanceClient.getFinanceAccList(orderMessage.getOrderNo(), OrderTypeEnum.DEALER.getType());
|
|
|
+ if (CollectionUtils.isNotEmpty(financeAcc)) {
|
|
|
+ throw new SecurityException("销售单已生成账单不能删除");
|
|
|
+ }
|
|
|
+ order.setIsDeleted(1);
|
|
|
+ orderService.updateById(order);
|
|
|
+ orderItemsService.updateByPid(order.getId());
|
|
|
+ orderFeesService.updateByPid(order.getId());
|
|
|
+ orderFilesService.updateByPid(order.getId());
|
|
|
+ orderFreightService.updateByPid(order.getId());
|
|
|
+ orderModifyService.updateByPid(order.getId());
|
|
|
+ orderPartsService.updateByPid(order.getId());
|
|
|
+ return R.success("操作成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增或修改 经销商销售或采购订单表
|
|
|
+ */
|
|
|
+ @PostMapping("/submit")
|
|
|
+ @ApiOperationSupport(order = 6)
|
|
|
+ @ApiOperation(value = "新增或修改", notes = "传入order")
|
|
|
+ public R submit(@Valid @RequestBody Order order) {
|
|
|
+ order.setBillType(OrderTypeEnum.SALES.getType());
|
|
|
+ order.setTradeType(OrderTypeEnum.DEALER.getType());
|
|
|
+ return orderService.saveOrderMessage(order);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除 销售或采购订单表
|
|
|
+ */
|
|
|
+ @PostMapping("/remove")
|
|
|
+ @ApiOperationSupport(order = 8)
|
|
|
+ @ApiOperation(value = "删除", notes = "传入ids")
|
|
|
+ public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
|
|
|
+ return R.status(orderService.removeByIds(Func.toLongList(ids)));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 经销商销售单生成发货单
|
|
|
+ *
|
|
|
+ * @param order
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping("/deliverGoods")
|
|
|
+ @ApiOperationSupport(order = 6)
|
|
|
+ @ApiOperation(value = "经销商销售单生成发货单", notes = "传入主订单id,明细ids")
|
|
|
+ public R deliverGoods(@Valid @RequestBody Order order) {
|
|
|
+ if (order.getId() == null) {
|
|
|
+ return R.fail(500, "参数缺失");
|
|
|
+ }
|
|
|
+ if (CollectionUtils.isEmpty(order.getOrderItemIds())) {
|
|
|
+ return R.fail(500, "请选择要发货的商品明细");
|
|
|
+ }
|
|
|
+ order.setBillType(OrderTypeEnum.SALES.getType());
|
|
|
+ order.setTradeType(OrderTypeEnum.DEALER.getType());
|
|
|
+ return R.data(orderService.deliverGoods(order));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 发货单获取订单明细
|
|
|
+ *
|
|
|
+ * @param query 分页参数
|
|
|
+ * @param orderNo 订单号或合同号
|
|
|
+ * @param corpId 客户id
|
|
|
+ * @param orderStartDate 时间开始时间
|
|
|
+ * @param orderEndDate 时间结束时间
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("/orderItemsList")
|
|
|
+ @ApiOperationSupport(order = 10)
|
|
|
+ @ApiOperation(value = "发货单获取订单明细", notes = "传入orderItems")
|
|
|
+ public R<IPage<OrderItemsVO>> orderItemsList(Query query,
|
|
|
+ @RequestParam(value = "orderNo", required = false) String orderNo,
|
|
|
+ @RequestParam(value = "corpId", required = false) Long corpId,
|
|
|
+ @RequestParam(value = "orderStartDate", required = false) String orderStartDate,
|
|
|
+ @RequestParam(value = "orderEndDate", required = false) String orderEndDate) {
|
|
|
+ String tradeType = OrderTypeEnum.DEALER.getType();
|
|
|
+ String billType = OrderTypeEnum.SALES.getType();
|
|
|
+ String tenantId = SecureUtil.getTenantId();
|
|
|
+ IPage<OrderItemsVO> pages = orderItemsService.orderItemsList(Condition.getPage(query), orderNo, corpId, orderStartDate, orderEndDate,
|
|
|
+ tradeType, billType, tenantId);
|
|
|
+ return R.data(pages);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 经销商销售单生成采购单
|
|
|
+ *
|
|
|
+ * @param order
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping("/createMarket")
|
|
|
+ @ApiOperationSupport(order = 9)
|
|
|
+ @ApiOperation(value = "经销商销售单生成采购单")
|
|
|
+ public R createMarket(@Valid @RequestBody Order order) {
|
|
|
+ if (order.getId() == null) {
|
|
|
+ return R.fail(500, "参数缺失");
|
|
|
+ }
|
|
|
+ order.setBillType(OrderTypeEnum.PURCHASE.getType());
|
|
|
+ order.setTradeType(OrderTypeEnum.DEALER.getType());
|
|
|
+ return R.data(orderService.createMarket(order));
|
|
|
+ }
|
|
|
+ @PostMapping("checkOrder")
|
|
|
+ public R checkOrder(@RequestBody Order order) {
|
|
|
+
|
|
|
+ orderService.checkOrder(order);
|
|
|
+ return R.data("操作成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 审核通过
|
|
|
+ */
|
|
|
+ @PostMapping("/passCheck")
|
|
|
+ @ApiOperationSupport(order = 8)
|
|
|
+ @ApiOperation(value = "Feign-审核通过", notes = "传入财务id")
|
|
|
+ public R passCheck(@ApiParam(value = "财务主表id", required = true) @RequestParam Long id) {
|
|
|
+ orderService.passCheck(id);
|
|
|
+ return R.success("操作成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 审核不通过
|
|
|
+ */
|
|
|
+ @PostMapping("/passCancel")
|
|
|
+ @ApiOperationSupport(order = 8)
|
|
|
+ @ApiOperation(value = "Feign-审核不通过", notes = "传入财务id")
|
|
|
+ public R passCancel(@ApiParam(value = "财务主表id", required = true) @RequestParam Long id) {
|
|
|
+ orderService.passCancel(id);
|
|
|
+ return R.success("操作成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 更换审批人
|
|
|
+ */
|
|
|
+ @GetMapping("/changeAuditUser")
|
|
|
+ @ApiOperationSupport(order = 8)
|
|
|
+ @ApiOperation(value = "Feign-更换审批人", notes = "传入财务id")
|
|
|
+ public R changeAuditUser(@ApiParam(value = "审批id", required = true) @RequestParam Long auditId,
|
|
|
+ @ApiParam(value = "更改的审批人id", required = true) @RequestParam String auditUserId) {
|
|
|
+ if (auditId == null || StringUtil.isBlank(auditUserId)) {
|
|
|
+ throw new SecurityException("参数异常,更改审批人失败");
|
|
|
+ }
|
|
|
+ orderService.changeAuditUser(auditId, auditUserId);
|
|
|
+ return R.success("操作成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 库存账查询锁定库存订单信息
|
|
|
+ */
|
|
|
+ @GetMapping("/ListMessage")
|
|
|
+ @ApiOperationSupport(order = 9)
|
|
|
+ @ApiOperation(value = "库存账查询锁定库存订单信息", notes = "传入order")
|
|
|
+ public R<IPage<OrderVO>> ListMessage(Query query, @RequestParam("itemId") Long itemId,
|
|
|
+ @RequestParam("corpId") Long corpId) {
|
|
|
+ IPage<OrderVO> pages = orderService.orderInventory(Condition.getPage(query), SecureUtil.getTenantId(), OrderTypeEnum.DEALER.getType(), OrderTypeEnum.SALES.getType(), itemId, corpId);
|
|
|
+ if (CollectionUtils.isNotEmpty(pages.getRecords())) {
|
|
|
+ pages.getRecords().stream().forEach(item -> {
|
|
|
+ R<CorpsDesc> corpMessage = corpsDescClient.getCorpMessage(item.getCorpId());
|
|
|
+ if (corpMessage.isSuccess() && corpMessage.getData() != null) {
|
|
|
+ item.setCorpsName(corpMessage.getData().getCname());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return R.data(pages);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 更改打印时间和打印次数
|
|
|
+ */
|
|
|
+ @GetMapping("/print")
|
|
|
+ @ApiOperationSupport(order = 11)
|
|
|
+ @ApiOperation(value = "更改打印时间和打印次数", notes = "传入order")
|
|
|
+ public R<Order> print(Order order) {
|
|
|
+ if (order.getId() == null){
|
|
|
+ throw new SecurityException("请选择要打印的单据");
|
|
|
+ }
|
|
|
+ Order service = orderService.getById(order.getId());
|
|
|
+ service.setPrintNumber(service.getPrintNumber() +1);
|
|
|
+ service.setPrintTime(new Date());
|
|
|
+ return R.status(orderService.updateById(service));
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 确认或取消订单
|
|
|
+ */
|
|
|
+ @GetMapping("/dealerSubmit")
|
|
|
+ @ApiOperationSupport(order = 12)
|
|
|
+ @ApiOperation(value = "确认或取消订单", notes = "传入order")
|
|
|
+ public R<Order> dealerSubmit(Order order) {
|
|
|
+ if (order.getDealer() != 1 && order.getDealer() != 2){
|
|
|
+ throw new SecurityException("缺少必要的参数");
|
|
|
+ }
|
|
|
+ if (order.getId() == null){
|
|
|
+ throw new SecurityException("缺少必要的参数");
|
|
|
+ }
|
|
|
+ return orderService.dealerSubmit(order);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 获取商品对应的批次号
|
|
|
+ */
|
|
|
+ @GetMapping("/lotNo")
|
|
|
+ @ApiOperationSupport(order = 13)
|
|
|
+ @ApiOperation(value = "获取商品对应的批次号", notes = "传入order")
|
|
|
+ public R<List<Map<String,Object>>> lotNo(@ApiParam(value = "itemId", required = true) @RequestParam Long itemId,
|
|
|
+ @ApiParam(value = "storageId", required = true) @RequestParam Long storageId,
|
|
|
+ @ApiParam(value = "tradeType", required = true) @RequestParam String tradeType) {
|
|
|
+ if (itemId == null || storageId == null || StringUtil.isBlank(tradeType)){
|
|
|
+ throw new SecurityException("缺少必要的参数");
|
|
|
+ }
|
|
|
+ return R.data(orderItemsService.lotNo(itemId,storageId,tradeType));
|
|
|
+ }
|
|
|
+
|
|
|
+}
|