|
@@ -1,7 +1,10 @@
|
|
|
package com.ssj.sys.controller;
|
|
|
|
|
|
import com.ssj.bean.common.framework.core.domain.Response;
|
|
|
+import com.ssj.bean.sys.fx.domain.Device;
|
|
|
+import com.ssj.bean.sys.fx.domain.Merchant;
|
|
|
import com.ssj.bean.sys.imlibuser.TbClassTeacherTemp;
|
|
|
+import com.ssj.bean.sys.role.domain.Admin;
|
|
|
import com.ssj.bean.weixin.libmy.domain.LibVip;
|
|
|
import com.ssj.bean.weixin.order.domain.Order;
|
|
|
import com.ssj.bean.weixin.sales.domain.LibOrderDetails;
|
|
@@ -19,6 +22,9 @@ import com.ssj.service.weixin.sales.service.LibOrderDetailsService;
|
|
|
import com.ssj.service.weixin.sales.service.LibSalesPriceService;
|
|
|
import com.ssj.service.weixin.sales.service.LibStaffingService;
|
|
|
import com.ssj.service.weixin.sales.service.LibVipServiceService;
|
|
|
+import com.ssj.sys.util.thirdparty.excel.CustomizeToExcel;
|
|
|
+import com.ssj.sys.util.thirdparty.excel.ExcelColumn;
|
|
|
+import org.apache.commons.collections4.MapUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.poi.ss.usermodel.*;
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
@@ -32,7 +38,10 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
+import javax.servlet.ServletOutputStream;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.io.IOException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
|
|
@@ -387,6 +396,71 @@ public class SysOrderController extends BaseController {
|
|
|
return "sys/order/invoiceOrderList";
|
|
|
}
|
|
|
|
|
|
+ @RequestMapping(value = "/exportInvoiceOrder", method = RequestMethod.POST)
|
|
|
+ @ResponseBody
|
|
|
+ public void exportInvoiceOrder( HttpServletRequest request, HttpServletResponse response) {
|
|
|
+ ServletOutputStream os = null;
|
|
|
+ try {
|
|
|
+ String libName="小塾系统订单发票申请";
|
|
|
+ Map<String, Object> params = new HashMap<String, Object>();
|
|
|
+ params.put("beginDate", request.getParameter("beginDate")==null? DateHelper.format(DateHelper.getTheMonthFirstDay(), "yyyy-MM-dd"):request.getParameter("beginDate"));
|
|
|
+ params.put("endDate", request.getParameter("endDate")==null?DateHelper.format(new Date(), "yyyy-MM-dd"):request.getParameter("endDate"));
|
|
|
+ libName = libName.concat(params.get("beginDate").toString()).concat("_").concat(params.get("endDate").toString());
|
|
|
+ os = response.getOutputStream(); //获得输出流
|
|
|
+ response.reset(); //清空输出流
|
|
|
+ String fileName = new String(libName.getBytes("gb2312"), "ISO8859-1") +".xlsx";
|
|
|
+ response.setHeader("Content-disposition", "attachment; filename="+ fileName); //设定输出文件头
|
|
|
+ response.setContentType("application/vnd.ms-excel;charset=UTF-8");
|
|
|
+ response.setCharacterEncoding("utf-8");
|
|
|
+
|
|
|
+ params.put("libId", request.getParameter("libId")==null?"":request.getParameter("libId"));
|
|
|
+ params.put("order_no", request.getParameter("order_no")==null?"":request.getParameter("order_no"));
|
|
|
+
|
|
|
+ Page<Map<String, Object>> page= libOrderDetailsService.findForInvoicePageList(params, initPage(1,10000));
|
|
|
+
|
|
|
+ List<Map<String, Object>> list = page.getContent();
|
|
|
+ List<ExcelColumn> myColumns3 = new ArrayList<ExcelColumn>();
|
|
|
+
|
|
|
+ list.forEach(m->{
|
|
|
+ m.put("order_status", MapUtils.getIntValue(m,"order_status")==1?"已支付":MapUtils.getIntValue(m,"order_status")==2?"已退款":MapUtils.getIntValue(m,"order_status")==3?"财务手动":"其他");
|
|
|
+ m.put("type", MapUtils.getIntValue(m,"type")==1?"个人":"企业");
|
|
|
+ m.put("invoice_state",Objects.isNull(m.get("invoice_state"))?"未开票":MapUtils.getIntValue(m,"invoice_state")==1?"已开票":MapUtils.getIntValue(m,"invoice_state")==2?"申请中":"未开票");
|
|
|
+ });
|
|
|
+
|
|
|
+ myColumns3.add(new ExcelColumn("机构", "league_name", 20));
|
|
|
+ myColumns3.add(new ExcelColumn("订单编号", "order_no", 20));
|
|
|
+ myColumns3.add(new ExcelColumn("微信支付业务单号", "transaction_id", 20));
|
|
|
+ myColumns3.add(new ExcelColumn("产品明细", "details", 20));
|
|
|
+
|
|
|
+ myColumns3.add(new ExcelColumn("金额", "price", 20));
|
|
|
+ myColumns3.add(new ExcelColumn("支付时间", "zf_time", 20));
|
|
|
+ myColumns3.add(new ExcelColumn("订单状态", "order_status", 20));
|
|
|
+ myColumns3.add(new ExcelColumn("抬头类型", "type", 20));
|
|
|
+ myColumns3.add(new ExcelColumn("发票抬头", "invoice_title", 20));
|
|
|
+ myColumns3.add(new ExcelColumn("纳税人识别号", "taxpayer_id", 20));
|
|
|
+ myColumns3.add(new ExcelColumn("email", "email", 20));
|
|
|
+
|
|
|
+ myColumns3.add(new ExcelColumn("是否已开票", "invoice_state", 20));
|
|
|
+ myColumns3.add(new ExcelColumn("申请开票时间", "create_time", 20));
|
|
|
+
|
|
|
+ CustomizeToExcel.downFile(myColumns3, list, os);
|
|
|
+ }catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }catch (Exception e1){
|
|
|
+ e1.printStackTrace();
|
|
|
+ }finally{
|
|
|
+ if(os != null){
|
|
|
+ try {
|
|
|
+ os.flush();
|
|
|
+ os.close();
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@RequestMapping(value="/updateOrderInvoice",method=RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
public ResponseEntity updateOrderInvoice(HttpServletRequest request, Model model,String id){
|