Browse Source

开票查询修改及导出

anderx 2 years ago
parent
commit
37df6631b4

+ 30 - 3
src/main/java/com/goafanti/common/mapper/TOrderInvoiceMapper.xml

@@ -366,12 +366,14 @@
 	</if>
   </select>
   <select id="financeOrderInvoiceList" resultType="com.goafanti.order.bo.TOrderInvoiceBo">
-    select a.id,a.unit_name as unitName,a.order_no as orderNo,c.name,b.project_status as projectStatus,a.amount,a.approval,
+    select a.id,a.unit_name as unitName,a.order_no as orderNo,c.name,b.project_status as projectStatus,a.amount,a.approval,b.contract_no contractNo,
     ifnull(d.sumAmount,0) as sumAmount, date_format(a.create_time,'%Y-%m-%d %H:%i:%S')as createTime ,a.status,b.process_status processStatus,
-    b.settlement_amount as settlementAmount, (b.total_amount-b.settlement_amount) as notAmount from t_order_invoice a
+    b.settlement_amount as settlementAmount, (b.total_amount-b.settlement_amount) as notAmount,tm.buyer_name userName
+    from t_order_invoice a
     left join t_order_new b on a.order_no=b.order_no left join admin c on b.salesman_id=c.id
     left join (select order_no,sum(amount)as  sumAmount from t_order_invoice where status =2 group by order_no) d
     on a.order_no=d.order_no left join department e on b.order_dep=e.id
+    left join t_order_mid tm on a.order_no =tm.order_no
     where b.delete_sign in (0,2)
     <if test="all ==0">
       and a.status in (1,2)
@@ -390,7 +392,19 @@
 	<if test="orderNo !=null">
 	and a.order_no = #{orderNo,jdbcType=VARCHAR}
 	</if>
-	<if test="name !=null">
+    <if test="contractNo != null">
+      and b.contract_no like concat('%',#{contractNo},'%')
+    </if>
+    <if test="userName != null">
+      and tm.buyer_name like concat('%',#{userName},'%')
+    </if>
+    <if test="invoiceType != null">
+      and a.status =#{invoiceType}
+    </if>
+    <if test="startTime != null and endTime != null">
+      and a.create_time BETWEEN #{startTime} and #{endTime}
+    </if>
+    <if test="name !=null">
 	and c.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
 	</if>
 	<if test="deps !=null">
@@ -422,6 +436,7 @@
 	left join t_order_new b on a.order_no=b.order_no
 	left join admin c on b.salesman_id=c.id
 	 left join department e on b.order_dep=e.id
+    left join t_order_mid tm on a.order_no =tm.order_no
     where b.delete_sign in (0,2)
     <if test="all ==0">
       and a.status in (1,2)
@@ -439,6 +454,18 @@
 	<if test="orderNo !=null">
 	and a.order_no = #{orderNo,jdbcType=VARCHAR}
 	</if>
+    <if test="contractNo != null">
+      and b.contract_no like concat('%',#{contractNo},'%')
+    </if>
+    <if test="userName != null">
+      and tm.buyer_name like concat('%',#{userName},'%')
+    </if>
+    <if test="invoiceType != null">
+      and a.status =#{invoiceType}
+    </if>
+    <if test="startTime != null and endTime != null">
+      and a.create_time BETWEEN #{startTime} and #{endTime}
+    </if>
 	<if test="name !=null">
 	and c.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
 	</if>

+ 0 - 8
src/main/java/com/goafanti/common/utils/excel/ExcelConstant.java

@@ -1,22 +1,14 @@
 package com.goafanti.common.utils.excel;
 
-import com.goafanti.order.enums.LiquidationNewState;
 
 public class ExcelConstant {
 
-	public static final String TaskStateStr="0=未分配,1=已分配,2=材料已启动,3=材料已完成,10=未定义";
 
-	public static final String NewProjectStatusStr="0=未启动,1=进行中,2=暂停(客户通知暂停),3=暂停(业务线通知暂停),"
-			+ "4=已提交,5=未推荐,6=已推荐,7=未拟公示,8=已拟公示,28=抽查未备案,9=已备案,10=已下证 ,11=退单(已申报),"
-			+ "12=退单(未申报),13=已答辩,14=未立项,15=已立项,16=前补助,17=后补助,18=立项已拨款,19=已完成/下证,20=已驳回,"
-			+ "21=第1年进行中,22=第1年服务完成,23=第2年进行中,24=第2年服务完成,25=第3年进行中,26=第3年服务完成,27=所有会员服务全部完成,99=未知";
 
 	public static final String chooseTypeStr = "0=第三方成本,1=催款节点,2=官费";
 
 	public static final String paymentStatusStr = "0=审核,1=待支付,2=驳回,3=已支付,4=已取消";
 
-	public static final String orderStatusStr = "0=待签单 ,1=签单待审,2=签单审核通过,3=签单审核拒绝,4=已结项,5=已驳回,6=退单中,7=已退单";
 
-	public static final String liquidationStatusStr = "0=首付待付清,1=尾款待付清,2=已付清,3=退款待确认,3=全部退款,10=INVALID";
 
 }

+ 50 - 2
src/main/java/com/goafanti/order/bo/InputOrderInvoiceBo.java

@@ -1,7 +1,5 @@
 package com.goafanti.order.bo;
 
-import java.util.List;
-
 public class InputOrderInvoiceBo {
 	private String deps;
 	private String orderNo;
@@ -10,6 +8,56 @@ public class InputOrderInvoiceBo {
 	private Integer approval;
 	private Integer status;
 	private Integer all;
+//合同编号,客户名称,开票状态,审核状态,按申请时间
+	private String contractNo;
+
+	private String userName;
+
+	private Integer invoiceType;
+
+	private String startTime;
+	private String endTime;
+
+
+	public String getContractNo() {
+		return contractNo;
+	}
+
+	public void setContractNo(String contractNo) {
+		this.contractNo = contractNo;
+	}
+
+	public String getUserName() {
+		return userName;
+	}
+
+	public void setUserName(String userName) {
+		this.userName = userName;
+	}
+
+	public Integer getInvoiceType() {
+		return invoiceType;
+	}
+
+	public void setInvoiceType(Integer invoiceType) {
+		this.invoiceType = invoiceType;
+	}
+
+	public String getStartTime() {
+		return startTime;
+	}
+
+	public void setStartTime(String startTime) {
+		this.startTime = startTime;
+	}
+
+	public String getEndTime() {
+		return endTime;
+	}
+
+	public void setEndTime(String endTime) {
+		this.endTime = endTime;
+	}
 
 	public Integer getAll() {
 		return all;

+ 38 - 16
src/main/java/com/goafanti/order/bo/TOrderInvoiceBo.java

@@ -1,32 +1,51 @@
 package com.goafanti.order.bo;
 
-import java.math.BigDecimal;
-
 import com.goafanti.common.utils.excel.Excel;
 
+import java.math.BigDecimal;
+
 
 public class TOrderInvoiceBo {
-	@Excel(name = "编号")
+	@Excel(name = "编号",width =6)
 	private Integer id;
+	@Excel(name = "客户名称")
+	private String userName;
+	@Excel(name = "开票单位名称")
 	private String unitName;
+	@Excel(name = "跟单人/签单人")
+	private String name;
 	@Excel(name = "订单编号")
-	private String orderno;
+	private String orderNo;
+	@Excel(name = "合同编号")
 	private String contractNo;
-	private String name;
+	@Excel(name = "项目状态",enumsName = "com.goafanti.order.enums.NewProjectStatus")
 	private Integer projectStatus;
 	private Integer processStatus;
-	private BigDecimal sumAmount;
-	@Excel(name = "开票金额(万元)")
+
+	@Excel(name = "开票金额(万元)",scale = 6)
 	private BigDecimal amount;
-	@Excel(name = "申请时间")
-	private String createTime;
-	@Excel(name = "开票状态",readConverterExp = "1=处理中,2通过")
+	@Excel(name = "开票状态",readConverterExp = "1=处理中,2=已完成,3=驳回")
 	private Integer status;
-	private BigDecimal notAmount;
+	@Excel(name = "特批状态",readConverterExp = "0=非特批,1=待审核,2=审核通过")
+	private Integer approval;
+	@Excel(name = "已开票(万元)",scale = 6)
+	private BigDecimal sumAmount;
+	@Excel(name = "已收款(万元)",scale = 6)
 	private BigDecimal settlementAmount;
+	@Excel(name = "未收款(万元)",scale = 6)
+	private BigDecimal notAmount;
+	@Excel(name = "申请时间")
+	private String createTime;
 	private String rejectReason;
 	private String examineName;
-	private Integer approval;
+
+	public String getUserName() {
+		return userName;
+	}
+
+	public void setUserName(String userName) {
+		this.userName = userName;
+	}
 
 	public String getExamineName() {
 		return examineName;
@@ -48,12 +67,15 @@ public class TOrderInvoiceBo {
 	public void setUnitName(String unitName) {
 		this.unitName = unitName;
 	}
-	public String getOrderno() {
-		return orderno;
+
+	public String getOrderNo() {
+		return orderNo;
 	}
-	public void setOrderno(String orderno) {
-		this.orderno = orderno;
+
+	public void setOrderNo(String orderNo) {
+		this.orderNo = orderNo;
 	}
+
 	public String getName() {
 		return name;
 	}

+ 5 - 9
src/main/java/com/goafanti/order/bo/TOrderTaskListBo.java

@@ -1,16 +1,12 @@
 package com.goafanti.order.bo;
 
-import java.math.BigDecimal;
-import java.util.Date;
-import java.util.List;
-
-
 import com.goafanti.common.enums.OfficialPatentType;
 import com.goafanti.common.utils.excel.Excel;
 import com.goafanti.common.utils.excel.Excel.ColumnType;
-import com.goafanti.common.utils.excel.ExcelConstant;
 import com.goafanti.core.shiro.token.TokenManager;
-import com.goafanti.patent.enums.PatentType;
+
+import java.math.BigDecimal;
+import java.util.List;
 
 public class TOrderTaskListBo {
 	@Excel(name = "项目编号")
@@ -39,9 +35,9 @@ public class TOrderTaskListBo {
 	private String taskDate;
 	@Excel(name = "数量(个)")
 	private Integer commodityQuantity;
-	@Excel(name = "任务状态",readConverterExp = ExcelConstant.TaskStateStr)
+	@Excel(name = "任务状态",enumsName = "com.goafanti.order.enums.TaskState")
 	private Integer taskStatus;
-	@Excel(name = "项目状态",readConverterExp = ExcelConstant.NewProjectStatusStr)
+	@Excel(name = "项目状态",enumsName = "com.goafanti.order.enums.NewProjectStatus")
 	private Integer projectStatus;
 	@Excel(name = "工时",cellType = ColumnType.NUMERIC)
 	private Double hours;

+ 26 - 9
src/main/java/com/goafanti/order/controller/OrderInvoiceApiController.java

@@ -1,22 +1,23 @@
 package com.goafanti.order.controller;
 
 
-
-
-import javax.servlet.http.HttpServletRequest;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
-
 import com.goafanti.common.bo.Result;
 import com.goafanti.common.constant.ErrorConstants;
 import com.goafanti.common.controller.CertifyApiController;
 import com.goafanti.common.model.TOrderInvoice;
 import com.goafanti.common.utils.StringUtils;
+import com.goafanti.common.utils.excel.NewExcelUtil;
 import com.goafanti.order.bo.InputOrderInvoiceBo;
+import com.goafanti.order.bo.TOrderInvoiceBo;
 import com.goafanti.order.service.OrderInvoiceService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.List;
 
 @RestController
 @RequestMapping(value = "/api/admin/orderInvoice")
@@ -24,6 +25,8 @@ public class OrderInvoiceApiController extends CertifyApiController {
 
 	@Autowired
 	private OrderInvoiceService		orderInvoiceService;
+	@Value(value = "${upload.path}")
+	private final String	uploadPath			= null;
 
 	/**
 	 * 创建发票申请
@@ -116,6 +119,20 @@ public class OrderInvoiceApiController extends CertifyApiController {
 		return res;
 	}
 
+	/**
+	 *  财务开票列表
+	 * @return
+	 */
+	@RequestMapping(value = "/financeOrderInvoiceList/export",method = RequestMethod.GET)
+	public Result financeOrderInvoiceListExport(InputOrderInvoiceBo o,Integer pageNo,Integer pageSize){
+		Result res = new Result();
+		NewExcelUtil<TOrderInvoiceBo> excelUtil=new NewExcelUtil<>(TOrderInvoiceBo.class);
+		List<TOrderInvoiceBo> list = (List<TOrderInvoiceBo>) orderInvoiceService.financeOrderInvoiceList(o, pageNo, 99999).getList();
+		String exportName=o.getType()==0?"省内开票查询列表":"省外开票查询列表";
+		res.data(excelUtil.exportExcel(list,exportName,uploadPath));
+		return res;
+	}
+
 
 
 	/**

+ 7 - 9
src/main/java/com/goafanti/order/controller/StatisticsApiController.java

@@ -2,16 +2,13 @@ package com.goafanti.order.controller;
 
 
 
-import java.io.IOException;
-import java.util.List;
-
-import javax.servlet.http.HttpServletResponse;
-
-import com.alibaba.fastjson.JSONObject;
+import com.goafanti.common.bo.Result;
+import com.goafanti.common.controller.CertifyApiController;
 import com.goafanti.common.utils.excel.NewExcelUtil;
 import com.goafanti.order.bo.*;
 import com.goafanti.order.bo.outStatistics.OutOrderSalesSourceAmount;
 import com.goafanti.order.service.OrderStatisticsService;
+import com.goafanti.order.service.ProjectStatisticsService;
 import com.goafanti.order.service.UserStaticticsService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -19,9 +16,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
-import com.goafanti.common.bo.Result;
-import com.goafanti.common.controller.CertifyApiController;
-import com.goafanti.order.service.ProjectStatisticsService;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.List;
 
 @RestController
 @RequestMapping(value = "/api/admin/statistis")
@@ -40,6 +37,7 @@ public class StatisticsApiController extends CertifyApiController {
 
 	/**
 	 * 	项目汇总列表
+	 * 	项目统计表点击弹出得详情列表
 	 */
 	@RequestMapping(value="/selectTaskList" ,method = RequestMethod.GET)
 	public Result selectTaskList(InputProjectStatistics ps){

+ 6 - 0
src/main/java/com/goafanti/order/service/impl/OrderInvoiceServiceImpl.java

@@ -212,6 +212,12 @@ public class OrderInvoiceServiceImpl extends BaseMybatisDao<TOrderInvoiceMapper>
 		if(StringUtils.isNotBlank(o.getName()))params.put("name", o.getName());
 		if(null!=o.getApproval())params.put("approval", o.getApproval());
 		if(null!=o.getStatus())params.put("status", o.getStatus());
+		if(null!=o.getContractNo())params.put("contractNo", o.getContractNo());
+		//这里不是客户得名称,而是开票的单位名称
+		if(null!=o.getUserName())params.put("userName", o.getUserName());
+		if(null!=o.getInvoiceType())params.put("invoiceType", o.getInvoiceType());
+		if(null!=o.getStartTime())params.put("startTime", o.getStartTime());
+		if(null!=o.getEndTime())params.put("endTime", o.getEndTime()+" 23:59:59");
 		return (Pagination<TOrderInvoiceBo>)findPage("financeOrderInvoiceList", "financeOrderInvoiceCount", params, pageNo, pageSize);
 
 	}

+ 15 - 40
src/main/java/com/goafanti/order/service/impl/OrderReceivablesServiceImpl.java

@@ -1,40 +1,12 @@
 package com.goafanti.order.service.impl;
 
-import java.math.BigDecimal;
-import java.util.*;
-
-import javax.annotation.Resource;
-
 import com.goafanti.admin.service.DepartmentService;
-import com.goafanti.common.model.*;
-import com.goafanti.order.bo.*;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.poi.ss.usermodel.Cell;
-import org.apache.poi.ss.usermodel.CellType;
-import org.apache.poi.ss.usermodel.Row;
-import org.apache.poi.ss.usermodel.Sheet;
-import org.apache.poi.ss.usermodel.Workbook;
-import org.apache.poi.ss.util.CellRangeAddress;
-import org.apache.poi.xssf.usermodel.XSSFCell;
-import org.apache.poi.xssf.usermodel.XSSFCellStyle;
-import org.apache.poi.xssf.usermodel.XSSFRow;
-import org.apache.poi.xssf.usermodel.XSSFSheet;
-import org.apache.poi.xssf.usermodel.XSSFWorkbook;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.web.multipart.MultipartFile;
-
 import com.goafanti.common.bo.Error;
 import com.goafanti.common.constant.AFTConstants;
-import com.goafanti.common.dao.TOrderBillNewMapper;
-import com.goafanti.common.dao.TOrderBonusMapper;
-import com.goafanti.common.dao.TOrderLogMapper;
-import com.goafanti.common.dao.TOrderMidMapper;
-import com.goafanti.common.dao.TOrderNewMapper;
-import com.goafanti.common.dao.TOrderTaskMapper;
-import com.goafanti.common.dao.TemporaryReceivablesMapper;
+import com.goafanti.common.dao.*;
 import com.goafanti.common.enums.OrderLogProcess;
 import com.goafanti.common.error.BusinessException;
+import com.goafanti.common.model.*;
 import com.goafanti.common.utils.DateUtils;
 import com.goafanti.common.utils.ExcelUtils;
 import com.goafanti.common.utils.ExportExcelUtil;
@@ -42,16 +14,19 @@ import com.goafanti.common.utils.LoggerUtils;
 import com.goafanti.core.mybatis.BaseMybatisDao;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.core.shiro.token.TokenManager;
-import com.goafanti.order.enums.ApprovalNewState;
-import com.goafanti.order.enums.BonusSubject;
-import com.goafanti.order.enums.LiquidationNewState;
-import com.goafanti.order.enums.ProcessStatus;
-import com.goafanti.order.enums.ReceivablesStatus;
-import com.goafanti.order.enums.TransactionSubject;
-import com.goafanti.order.service.FundManageOrderService;
-import com.goafanti.order.service.OrderBillService;
-import com.goafanti.order.service.OrderInvoiceService;
+import com.goafanti.order.bo.*;
+import com.goafanti.order.enums.*;
 import com.goafanti.order.service.OrderReceivablesService;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.xssf.usermodel.*;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.math.BigDecimal;
+import java.util.*;
 
 @Service
 public class OrderReceivablesServiceImpl extends BaseMybatisDao<TemporaryReceivablesMapper> implements OrderReceivablesService{
@@ -524,7 +499,7 @@ public class OrderReceivablesServiceImpl extends BaseMybatisDao<TemporaryReceiva
 					switch (comment[i]) {
 //					String[] comment = {"编号","订单编号","开票金额(万元)","申请时间","开票状态"};
 					case "编号": o = ob.getId().toString(); break;
-					case "订单编号": o = ob.getOrderno(); break;
+					case "订单编号": o = ob.getOrderNo(); break;
 					case "开票金额(万元)": o = ob.getAmount().toString(); break;
 					case "申请时间": o = ob.getCreateTime(); break;
 					case "开票状态":

+ 10 - 10
src/main/java/com/goafanti/organization/bo/outPaymentList.java

@@ -1,19 +1,19 @@
 package com.goafanti.organization.bo;
 
-import java.math.BigDecimal;
-
 import com.goafanti.common.utils.excel.Excel;
 import com.goafanti.common.utils.excel.ExcelConstant;
 
+import java.math.BigDecimal;
+
 public class outPaymentList {
-		
+
 		@Excel(name = "支付编号")
 		private Integer id;
 		@Excel(name = "项目编号")
 		private Integer tid;
 		@Excel(name = "项目名称")
 		private String pname;
-		@Excel(name = "项目状态",readConverterExp = ExcelConstant.NewProjectStatusStr)
+		@Excel(name = "项目状态",enumsName = "com.goafanti.order.enums.NewProjectStatus")
 		private Integer projectStatus;
 		@Excel(name = "分类名称")
 		private String cname;
@@ -49,10 +49,10 @@ public class outPaymentList {
 		private BigDecimal settlementAmount;
 		private String officialName;
 		private Integer processStatus;
-		
-		
-		
-		
+
+
+
+
 		public String getContractNo() {
 			return contractNo;
 		}
@@ -83,7 +83,7 @@ public class outPaymentList {
 		public void setCostAmount(String costAmount) {
 			this.costAmount = costAmount;
 		}
-		
+
 		public BigDecimal getPaymentAmount() {
 			return paymentAmount;
 		}
@@ -204,5 +204,5 @@ public class outPaymentList {
 		public void setProcessStatus(Integer processStatus) {
 			this.processStatus = processStatus;
 		}
-		
+
 }