| | |
| | | import cn.dev33.satoken.annotation.SaCheckPermission; |
| | | import com.example.erp.common.Constants; |
| | | import com.example.erp.common.Result; |
| | | import com.example.erp.dto.sd.OrderDTO; |
| | | import com.example.erp.entity.sd.Order; |
| | | import com.example.erp.entity.sd.OrderDetail; |
| | | import com.example.erp.entity.sd.OrderGlassDetail; |
| | |
| | | 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.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | public void exportOrderReport(HttpServletResponse response, @RequestBody List<LocalDate> dates) throws IOException, IllegalAccessException, InstantiationException { |
| | | |
| | | //参数:相应的数据,实体类信息,相应的方法(数据获取),生成的excel名字 |
| | | DownExcel.download(response,Order.class, orderService.exportOrderReport(dates),"orderReport"); |
| | | DownExcel.download(response, OrderDTO.class, orderService.exportOrderReport(dates),"orderReport"); |
| | | } |
| | | } |
New file |
| | |
| | | package com.example.erp.dto.sd; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.example.erp.entity.sd.Order; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @Data |
| | | public class OrderDTO extends Order { |
| | | private Integer productId; |
| | | private String productName; |
| | | private Integer orderNumber; |
| | | private Double width; |
| | | private Double height; |
| | | private Long quantity; |
| | | private Integer bendRadius; |
| | | private Double grossArea; |
| | | private Double computeGrossArea; |
| | | private String shape; |
| | | private String edgingType; |
| | | private String remarks; |
| | | private Double perimeter; |
| | | private Double price; |
| | | private Long grossAmount; |
| | | private String levelOne; |
| | | private String levelTwo; |
| | | private String totalThickness; |
| | | } |
| | |
| | | private String otherRemarks; |
| | | private Double area; |
| | | private Long quantity; |
| | | private String perimeter; |
| | | private Double perimeter; |
| | | private String verifierId; |
| | | private String verifier; |
| | | private String creatorId; |
| | |
| | | package com.example.erp.entity.sd; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | |
| | | package com.example.erp.mapper.sd; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.example.erp.entity.sd.Order; |
| | | import com.example.erp.dto.sd.OrderDTO; |
| | | import com.example.erp.entity.sd.OrderDetail; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | |
| | | //type为了区别需不需要根据产品分类 |
| | | Map<String,Integer> getOrderReportTotal(Integer offset, Integer pageSize, String startDate, String endDate, OrderDetail orderDetail, String type); |
| | | |
| | | List<Order> exportOrderReport(List<LocalDate> dates); |
| | | List<OrderDTO> exportOrderReport(List<LocalDate> dates); |
| | | |
| | | List<OrderDetail> getOrderProductSummary(Integer offset, Integer pageSize, String startDate, String endDate, OrderDetail orderDetail); |
| | | |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.example.erp.common.Constants; |
| | | import com.example.erp.dto.sd.OrderDTO; |
| | | import com.example.erp.entity.sd.*; |
| | | import com.example.erp.entity.userInfo.SysError; |
| | | import com.example.erp.exception.ServiceException; |
| | |
| | | return map; |
| | | } |
| | | |
| | | public List<Order> exportOrderReport(List<LocalDate> dates) { |
| | | public List<OrderDTO> exportOrderReport(List<LocalDate> dates) { |
| | | return orderDetailMapper.exportOrderReport(dates); |
| | | } |
| | | |
| | |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="exportOrderReport"> |
| | | <select id="exportOrderReport" > |
| | | SELECT |
| | | *, |
| | | a.create_time as createTime, |
| | | d.type_name as levelOne, |
| | | e.type_name as levelTwo |
| | | d.type_name as level_one, |
| | | e.type_name as level_two |
| | | from order_detail as a |
| | | left join sd.`order` as b |
| | | on b.order_id = a.order_id |
| | |
| | | left join sd.basic_glass_type as e |
| | | on e.type_id = d.belong |
| | | where date(a.create_time)>=#{dates[0]} and date(a.create_time) <= #{dates[1]} |
| | | |
| | | </select> |
| | | |
| | | |