guoyujie
2 天以前 c4b9a339caff12e95f61c3d5dc950aafcc8c566c
north-glass-erp/src/main/java/com/example/erp/controller/sd/DeliveryController.java
@@ -1,8 +1,12 @@
package com.example.erp.controller.sd;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.example.erp.common.Constants;
import com.example.erp.common.Result;
import com.example.erp.dto.mm.FinishedOperateLogDTO;
import com.example.erp.dto.sd.DeliveryDetailDTO;
import com.example.erp.dto.sd.DeliveryDetailProductDTO;
import com.example.erp.entity.mm.FinishedGoodsInventory;
import com.example.erp.entity.sd.Delivery;
import com.example.erp.entity.sd.DeliveryDetail;
@@ -10,17 +14,21 @@
import com.example.erp.entity.sd.OrderDetail;
import com.example.erp.exception.ServiceException;
import com.example.erp.service.sd.DeliveryService;
import com.example.erp.tools.DownExcel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.time.LocalDate;
import java.util.List;
import java.util.Map;
@RestController
@Api(value="发货controller",tags={"发货操作接口"})
@RequestMapping("/Delivery")
@RequestMapping("/delivery")
public class DeliveryController {
    @Autowired
    DeliveryService deliveryService;
@@ -28,13 +36,31 @@
    /*发货订单查询*/
    @ApiOperation("发货订单查询接口")
    @SaCheckPermission("selectDelivery.search")
    @PostMapping("/getSelectShippingOrder/{pageNum}/{pageSize}/{selectDate}")
    public Result getSelectShippingOrder(@PathVariable Integer pageNum, @PathVariable Integer pageSize,@PathVariable List<String> selectDate, @RequestBody Delivery delivery){
        return Result.seccess(deliveryService.getSelectShippingOrder(pageNum,pageSize,selectDate,delivery));
    }
    /*发货报表查询*/
    @ApiOperation("发货报表查询接口")
    @SaCheckPermission("deliveryReport.search")
    @PostMapping("/getSelectDeliveryDetailReport/{pageNum}/{pageSize}/{selectDate}")
    public Result getSelectDeliveryDetailReport(@PathVariable Integer pageNum, @PathVariable Integer pageSize,@PathVariable List<String> selectDate, @RequestBody DeliveryDetail deliveryDetail){
        return Result.seccess(deliveryService.getSelectDeliveryDetailReport(pageNum,pageSize,selectDate,deliveryDetail));
    }
    /*发货报表查询*/
    @ApiOperation("发货产品分类报表查询接口")
    @SaCheckPermission("deliveryReport.search")
    @PostMapping("/getSelectDeliveryDetailProductReport/{pageNum}/{pageSize}/{selectDate}")
    public Result getSelectDeliveryDetailProductReport(@PathVariable Integer pageNum, @PathVariable Integer pageSize,@PathVariable List<String> selectDate, @RequestBody DeliveryDetail deliveryDetail){
        return Result.seccess(deliveryService.getSelectDeliveryDetailProductReport(pageNum,pageSize,selectDate,deliveryDetail));
    }
    /*发货订单明细查询*/
    @ApiOperation("发货编辑订单明细查询接口")
    @SaCheckPermission("createDelivery.search")
    @PostMapping("/getSelectShippingOrderDetail/{pageNum}/{pageSize}")
    public Result getSelectShippingOrderDetail(@PathVariable Integer pageNum, @PathVariable Integer pageSize,  @RequestBody OrderDetail orderDetail){
        return Result.seccess(deliveryService.getSelectShippingOrderDetail(pageNum,pageSize,orderDetail));
@@ -42,6 +68,7 @@
    /*库存可发货订单查询*/
    @ApiOperation("库存可发货订单查询接口接口")
    @SaCheckPermission("selectOrderList.search")
    @PostMapping("/getSelectOrderInventory/{pageNum}/{pageSize}/{selectDate}")
    public Result getSelectOrderInventory(@PathVariable Integer pageNum, @PathVariable Integer pageSize,@PathVariable List<String> selectDate, @RequestBody Order order){
        return Result.seccess(deliveryService.getSelectOrderInventory(pageNum,pageSize,selectDate,order));
@@ -49,43 +76,64 @@
    /*发货订单明细查询*/
    @ApiOperation("发货新增订单明细查询接口")
    @SaCheckPermission("createDelivery.search")
    @PostMapping("/getSelectShippingOrderDetails/{pageNum}/{pageSize}")
    public Result getSelectShippingOrderDetails(@PathVariable Integer pageNum, @PathVariable Integer pageSize, @RequestBody OrderDetail orderDetail){
        return Result.seccess(deliveryService.getSelectShippingOrderDetails(pageNum,pageSize,orderDetail));
    }
    @ApiOperation("发货新增接口")
    @SaCheckPermission("createDelivery.add")
    @PostMapping("/insertDelivery")
    public Result insertDelivery( @RequestBody Map<String,Object> object){
        if(deliveryService.insertDelivery(object)){
            return Result.seccess();
        }else {
            throw new ServiceException(Constants.Code_500,"发货失败");
        }
        return Result.seccess(deliveryService.insertDelivery(object));
    }
    @ApiOperation("发货审核修改接口")
    @SaCheckPermission("createDelivery.review")
    @PostMapping("/updateDeliveryToExamine")
    public Result updateDeliveryToExamine( @RequestBody Map<String,Object> object){
        if(deliveryService.updateDeliveryToExamine(object)){
            return Result.seccess();
        }else {
            throw new ServiceException(Constants.Code_500,"审核失败");
        }
        return Result.seccess(deliveryService.updateDeliveryToExamine(object));
    }
    @ApiOperation("发货删除接口")
    @SaCheckPermission("selectDelivery.delete")
    @PostMapping("/deleteDelivery")
    public Result deleteDelivery( @RequestBody Map<String,Object> object){
        if(deliveryService.deleteDelivery(object)){
            return Result.seccess();
        return Result.seccess(deliveryService.deleteDelivery(object));
    }
        }else {
            throw new ServiceException(Constants.Code_500,"删除失败");
    @ApiOperation("发货订单查询接口")
    @SaCheckPermission("selectDelivery.search")
    @PostMapping("/getSelectDeliveryPrinting")
    public Result getSelectDeliveryPrinting( @RequestBody Map<String,Object> object) throws IllegalAccessException {
        return Result.seccess(deliveryService.getSelectDeliveryPrinting(object));
    }
        }
    @ApiOperation("订单发货订单查询接口")
    @SaCheckPermission("selectDelivery.search")
    @PostMapping("/getSelectOrderPrinting/{selectedValues}")
    public Result getSelectOrderPrinting(@PathVariable List<String> selectedValues, @RequestBody OrderDetail orderDetail){
        return Result.seccess(deliveryService.getSelectOrderPrinting(orderDetail,selectedValues));
    }
    @ApiOperation("发货明细报表")
    @PostMapping("/exportDeliveryDetailReport")
    public void exportDeliveryDetailReport(HttpServletResponse response, @RequestBody List<LocalDate> dates) throws IOException, IllegalAccessException, InstantiationException {
        //参数:相应的数据,实体类信息,相应的方法(数据获取),生成的excel名字
        DownExcel.download(response, DeliveryDetailDTO.class, deliveryService.exportDeliveryDetailReport(dates),"orderReport");
    }
    @ApiOperation("发货明细产品分类报表")
    @PostMapping("/exportDeliveryDetailProductReport")
    public void exportDeliveryDetailProductReport(HttpServletResponse response, @RequestBody List<LocalDate> dates) throws IOException, IllegalAccessException, InstantiationException {
        //参数:相应的数据,实体类信息,相应的方法(数据获取),生成的excel名字
        DownExcel.download(response, DeliveryDetailProductDTO.class, deliveryService.exportDeliveryDetailProductReport(dates),"orderReport");
    }
    @ApiOperation("发货单打印计数")
    @PostMapping ("/updateDeliveryPrintNumber/{deliveryId}")
    public Result updateDeliveryPrintNumber(@PathVariable String deliveryId)  {
        return  Result.seccess(deliveryService.updateDeliveryPrintNumber(deliveryId));
    }