| | |
| | | import com.mzl.flower.service.system.CodeService; |
| | | import com.mzl.flower.service.system.WeChatService; |
| | | import com.mzl.flower.service.transport.TransportService; |
| | | import com.mzl.flower.utils.ExcelExportUtil; |
| | | import com.mzl.flower.utils.UUIDGenerator; |
| | | import com.wechat.pay.java.core.util.GsonUtil; |
| | | import io.micrometer.core.instrument.util.StringUtils; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.ObjectUtils; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.net.URLEncoder; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | |
| | | orderMapper.updateById(order); |
| | | } |
| | | |
| | | private List<OrderListExportDTO> getOrderExportListBase(OrderQueryDTO dto) { |
| | | dto.setStartDate(parseLocalDateTime(dto.getStartDateStr(), true)); |
| | | dto.setEndDate(parseLocalDateTime(dto.getEndDateStr(), false)); |
| | | dto.setCreateStartDate(parseLocalDateTime(dto.getCreateStartDateStr(), 17, 0, 0, -1)); |
| | | dto.setCreateEndDate(parseLocalDateTime(dto.getCreateEndDateStr(), 17, 0, 0, 0)); |
| | | List<OrderListExportDTO> ls = orderMapper.selectOrderExportList(dto); |
| | | return ls; |
| | | } |
| | | |
| | | public void exportOrderDetail(HttpServletResponse response, OrderQueryDTO dto) { |
| | | List<OrderListExportDTO> ls = getOrderExportListBase( dto); |
| | | String[] rowsName = new String[]{"序号","订单号", "用户账号", "收货人", "收货人电话", "收获地址", "订单金额" |
| | | , "底价", "订单状态", "下单时间", "合伙人", "库位", "特殊需求", "备注"}; |
| | | List<Object[]> dataList = new ArrayList<>(); |
| | | int sn = 1; |
| | | for (OrderListExportDTO o : ls) { |
| | | Object[] objs = new Object[rowsName.length]; |
| | | int a = 0; |
| | | objs[a++] = sn; |
| | | objs[a++] = o.getOrderNo(); |
| | | objs[a++] = o.getCreateName(); |
| | | objs[a++] = o.getCustomer(); |
| | | objs[a++] = o.getCustomerTel(); |
| | | objs[a++] = o.getCustomerAddress(); |
| | | objs[a++] = o.getTotalAmount(); |
| | | objs[a++] = o.getSupplierAmount(); |
| | | objs[a++] = o.getStatusBackendStr(); |
| | | objs[a++] = o.getCreateTime(); |
| | | objs[a++] = o.getPartnerName(); |
| | | objs[a++] = o.getWarehouseLocationCode(); |
| | | objs[a++] = o.getSpecialNeedsStr(); |
| | | objs[a++] = o.getRemarks(); |
| | | dataList.add(objs); |
| | | |
| | | sn++; |
| | | } |
| | | 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); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |