Cui Zhi Feng
2024-08-23 cadb3e2516207d2e24203c4e7139f085f3ea9bdd
售后列表导出
已修改5个文件
87 ■■■■■ 文件已修改
src/main/java/com/mzl/flower/dto/response/payment/OrderItemSalesNewDTO.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/mzl/flower/dto/response/payment/OrderItemSalesNewListDTO.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/mzl/flower/service/payment/OrderItemSalesService.java 64 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/mzl/flower/web/payment/SalesController.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/payment/OrderItemSalesMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/mzl/flower/dto/response/payment/OrderItemSalesNewDTO.java
@@ -4,6 +4,7 @@
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
@Data
@@ -33,4 +34,10 @@
    @ApiModelProperty(value = "物流扣款")
    private BigDecimal feePlatformTransport;
    @ApiModelProperty(value = "下单时间")
    private LocalDateTime orderTime;
    @ApiModelProperty(value = "审核时间")
    private LocalDateTime auditTime;
}
src/main/java/com/mzl/flower/dto/response/payment/OrderItemSalesNewListDTO.java
@@ -53,6 +53,12 @@
    @ApiModelProperty(value = "供应商名称")
    private String supplierName;
    @ApiModelProperty(value = "供应商价格")
    private BigDecimal supplierPrice;
    @ApiModelProperty(value = "合伙人加价")
    private BigDecimal markupPartner;
    @ApiModelProperty(value = "商品售价")
    private BigDecimal price;
src/main/java/com/mzl/flower/service/payment/OrderItemSalesService.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mzl.flower.base.interceptor.CodeDecorator;
import com.mzl.flower.component.SequenceNo;
import com.mzl.flower.config.exception.ValidationException;
import com.mzl.flower.config.security.SecurityUtils;
@@ -17,6 +18,7 @@
import com.mzl.flower.mapper.supplier.StationMapper;
import com.mzl.flower.service.BaseService;
import com.mzl.flower.service.system.CodeService;
import com.mzl.flower.utils.ExcelExportUtil;
import com.mzl.flower.utils.UUIDGenerator;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
@@ -24,7 +26,9 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.net.URLEncoder;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
@@ -56,6 +60,9 @@
    @Autowired
    private CodeService codeService;
    @Autowired
    private CodeDecorator codeDecorator;
    public String createSales(OrderItemSalesCreateDTO dto){
        Integer num = dto.getNum();
@@ -176,6 +183,60 @@
        return page;
    }
    public void exportSalesList(HttpServletResponse response, OrderItemSalesQueryDTO dto){
        dto.setOrderStartDate(parseLocalDateTime(dto.getOrderStartDateStr()));
        dto.setOrderEndDate(parseLocalDateTime(dto.getOrderEndDateStr()));
        dto.setSalesStartDate(parseLocalDateTime(dto.getSalesStartDateStr()));
        dto.setSalesEndDate(parseLocalDateTime(dto.getSalesEndDateStr()));
        List<OrderItemSalesNewListDTO> ls = orderItemSalesMapper.selectItemSalesList(null, dto);
        codeDecorator.decorate(ls);
        String[] rowsName = new String[]{"集货站", "商品名称", "商品单位", "商品颜色", "商品等级"
                , "商品分类", "收货人", "收货人手机号码", "收货地址", "商品数量", "供应商名称", "商品售价"
                , "总金额", "订单号", "售后单号", "标题", "申请数量", "理由", "实际退款", "审核结果"
                , "申请时间", "平台回复"};
        List<Object[]> dataList = new ArrayList<>();
        for (OrderItemSalesNewListDTO d : ls) {
            Object[] objs = new Object[rowsName.length];
            int a = 0;
            objs[a++] = d.getStationName();
            objs[a++] = d.getFlowerName();
            objs[a++] = d.getFlowerUnit();
            objs[a++] = d.getFlowerColor();
            objs[a++] = d.getFlowerLevelStr();
            objs[a++] = d.getFlowerCategory();
            objs[a++] = d.getCustomer();
            objs[a++] = d.getCustomerTel();
            objs[a++] = d.getCustomerAddress();
            objs[a++] = d.getFlowerNum();
            objs[a++] = d.getSupplierName();
            objs[a++] = d.getPrice();
            objs[a++] = d.getTotal();
            objs[a++] = d.getOrderNo();
            objs[a++] = d.getSalesNo();
            objs[a++] = d.getTitle();
            objs[a++] = d.getNum();
            objs[a++] = d.getReason();
            objs[a++] = d.getTotalFee();
            objs[a++] = d.getStatusStr();
            objs[a++] = format(d.getCreateTime(), "yyyy-MM-dd HH:mm:ss");
            objs[a++] = d.getRemarks();
            dataList.add(objs);
        }
        ExcelExportUtil excelExportUtil = new ExcelExportUtil("售后申请列表", rowsName, dataList, response);
        try {
            response.addHeader("filename", URLEncoder.encode("售后申请列表.xls", "UTF-8"));
            response.addHeader("Access-Control-Expose-Headers", "filename");
            excelExportUtil.export();
        } catch (Exception e) {
            log.error(e.getMessage(), e);
        }
    }
    public OrderItemSalesNewDTO getSalesInfo(String id){
        OrderItemSalesNewDTO rr = new OrderItemSalesNewDTO();
        OrderItemSales sl = orderItemSalesMapper.selectById(id);
@@ -195,6 +256,7 @@
        rr.setCustomerCity(o.getCustomerCity());
        rr.setCustomerRegion(o.getCustomerRegion());
        rr.setCustomerAddress(o.getCustomerAddress());
        rr.setOrderTime(o.getCreateTime());
        OrderItem oi = orderItemMapper.selectById(sl.getOrderItemId());
        rr.setFlowerName(oi.getFlowerName());
@@ -207,6 +269,8 @@
        rr.setSupplierName(oi.getSupplierName());
        rr.setPrice(oi.getPrice());
        rr.setTotal(oi.getTotal());
        rr.setSupplierPrice(oi.getSupplierPrice());
        rr.setMarkupPartner(oi.getMarkupPartner());
        Long stationId = oi.getStationId();
        if(stationId != null) {
src/main/java/com/mzl/flower/web/payment/SalesController.java
@@ -22,7 +22,9 @@
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
@RestController
@@ -51,6 +53,12 @@
        return returnData(R.SUCCESS.getCode(), salesService.selectSalesList(page, dto));
    }
    @GetMapping({"/list/export"})
    @ApiOperation(value = "售后列表导出")
    public void exportSales(HttpServletResponse response, OrderItemSalesQueryDTO dto){
        salesService.exportSalesList(response, dto);
    }
    @GetMapping("/list/view")
    @ApiOperation(value = "售后详情")
    @ApiImplicitParams({
src/main/resources/mapper/payment/OrderItemSalesMapper.xml
@@ -71,7 +71,7 @@
            , oi.flower_level, oi.flower_category, o.customer, o.customer_tel, o.customer_province, o.customer_city
            , o.customer_region, o.customer_address, oi.num flowerNum, oi.supplier_name, oi.price, oi.total
            , o.order_no, si.sales_no, si.title, si.num, si.reason, si.total_fee, si.status, si.create_time
            , si.remarks
            , si.remarks, oi.supplier_price, oi.markup_partner
        FROM t_order_item_sales si
        join t_order_item oi on oi.id = si.order_item_id
        join t_order o on si.order_id = o.id