guoyujie
2 天以前 c4b9a339caff12e95f61c3d5dc950aafcc8c566c
north-glass-erp/src/main/java/com/example/erp/controller/sd/CustomerController.java
@@ -4,6 +4,9 @@
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.example.erp.common.Constants;
import com.example.erp.common.Result;
import com.example.erp.dto.sd.CustomerDTO;
import com.example.erp.dto.sd.DeliveryDetailDTO;
import com.example.erp.dto.sd.DeliveryDetailProductDTO;
import com.example.erp.entity.sd.Customer;
import com.example.erp.entity.sd.Delivery;
import com.example.erp.entity.sd.Order;
@@ -11,11 +14,15 @@
import com.example.erp.exception.ServiceException;
import com.example.erp.service.sd.CustomerService;
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;
@@ -36,31 +43,17 @@
    }
    @ApiOperation("客户新增修改接口")
    @SaCheckPermission("CreateCustomer.add")
    @SaCheckPermission("createCustomer.add")
    @PostMapping("/insertCustomer")
    public Result insertCustomer( @RequestBody Map<String,Object>  object){
        if(customerService.insertCustomer(object)){
            return Result.seccess();
        }else {
            throw new ServiceException(Constants.Code_500,"客户新增/修改失败");
        }
        return Result.seccess(customerService.insertCustomer(object));
    }
    @ApiOperation("客户删除接口")
    @SaCheckPermission("selectCustomer.delete")
    @PostMapping("/deleteCustomer")
    public Result deleteCustomer( @RequestBody Map<String,Object>  object){
        if(customerService.deleteCustomer(object)){
            return Result.seccess();
        }else {
            throw new ServiceException(Constants.Code_500,"客户删除失败");
        }
        return Result.seccess(customerService.deleteCustomer(object));
    }
    @ApiOperation("客户订单查询接口")
@@ -70,6 +63,18 @@
        return Result.seccess(customerService.getSelectCustomerOderDate(pageNum,pageSize,selectDate,orderDetail));
    }
    @ApiOperation("客户订单报表")
    @PostMapping("/exportSelectCustomerOderDate/{selectDate}")
    public void exportSelectCustomerOderDate(HttpServletResponse response, @PathVariable List<String> selectDate, @RequestBody OrderDetail orderDetail) throws IOException, IllegalAccessException, InstantiationException {
        DownExcel.download(response, CustomerDTO.class, customerService.exportSelectCustomerOderDate(selectDate,orderDetail),"orderReport");
    }
    @ApiOperation("客户发货报表")
    @PostMapping("/exportSelectCustomerDeliveryDate/{selectDate}")
    public void exportSelectCustomerDeliveryDate(HttpServletResponse response, @PathVariable List<String> selectDate, @RequestBody OrderDetail orderDetail) throws IOException, IllegalAccessException, InstantiationException {
        DownExcel.download(response, CustomerDTO.class, customerService.exportSelectCustomerDeliveryDate(selectDate,orderDetail),"deliveryReport");
    }