Kaynağa Gözat

【后台】+【应收对账单】+【导出Ecxel】

git-svn-id: svn+ssh://10.10.101.21/source/platform/platform-b2b@2671 f3bf4e98-0cf0-11e4-a00c-a99a8b9d557d
aof 10 yıl önce
ebeveyn
işleme
30ad26a69a

+ 34 - 0
src/main/java/com/uas/platform/b2b/controller/SaleApCheckController.java

@@ -1,12 +1,14 @@
 package com.uas.platform.b2b.controller;
 
 
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Sort.Direction;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.ModelMap;
 import org.springframework.util.CollectionUtils;
@@ -16,6 +18,7 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.servlet.ModelAndView;
 
 import com.uas.platform.b2b.model.ErpProdIODetail;
 import com.uas.platform.b2b.model.PurchaseApCheck;
@@ -24,6 +27,7 @@ import com.uas.platform.b2b.model.Vendor;
 import com.uas.platform.b2b.service.ErpProdIODetailService;
 import com.uas.platform.b2b.service.PurchaseApCheckService;
 import com.uas.platform.b2b.service.UserService;
+import com.uas.platform.b2b.support.JxlsExcelView;
 import com.uas.platform.b2b.support.SystemSession;
 import com.uas.platform.b2b.support.UsageBufferedLogger;
 import com.uas.platform.core.exception.IllegalOperatorException;
@@ -168,4 +172,34 @@ public class SaleApCheckController {
 		return purchaseApCheckService.findAllByPageInfo(info, keyword, filter);
 	}
 	
+	
+	/**
+	 * 全部导出
+	 * 
+	 * @param params
+	 * @return
+	 */
+	@RequestMapping(value = "/xls", method = RequestMethod.GET)
+	public ModelAndView export() {
+		List<Long> distributes = null;
+		//判断当前用户是否被客户分配
+		if (!userService.IsNotadmin()) {
+			List<Vendor> vendors = userService.findChooseVendor(SystemSession.getUser().getUserUU());
+			distributes = new ArrayList<Long>();
+			if(!CollectionUtils.isEmpty(vendors)) {
+				for(Vendor v : vendors) {
+					distributes.add(v.getMyEnUU());
+				}
+			} else {
+				return null;
+			}
+		}
+		ModelAndView modelAndView = new ModelAndView();
+		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy年MM月dd日");
+		modelAndView.addObject("dateFormat", dateFormat);
+		modelAndView.addObject("data",erpProdIODetailService.findAllApChecks(distributes));
+		modelAndView.setView(new JxlsExcelView("classpath:jxls-tpl/fa/faApCheck", "客户应收对账单"));
+		logger.log("客户应收对账单", "导出Excel列表", "导出全部Excel列表");
+		return modelAndView;
+	}
 }	

+ 28 - 0
src/main/java/com/uas/platform/b2b/model/ErpProdIODetail.java

@@ -115,6 +115,34 @@ public class ErpProdIODetail implements Serializable{
 	 * 应付供应商名称
 	 */
 	private String receiveName; 
+	
+	/**
+	 * 金额
+	 */
+	private Double money;
+	
+	/**
+	 * 本次对账金额
+	 */
+	private Double nowMoney;
+	
+	public Double getMoney() {
+		this.money = (this.qty == null ? 0: this.qty) * (this.orderPrice == null ? 0:this.orderPrice);
+		return this.money;
+	}
+
+	public void setMoney(Double money) {
+		this.money = money;
+	}
+
+	public Double getNowMoney() {
+		this.nowMoney = (this.thisCheckQty == null ? 0: this.thisCheckQty) * (this.orderPrice == null ? 0:this.orderPrice);
+		return this.nowMoney;
+	}
+
+	public void setNowMoney(Double nowMoney) {
+		this.nowMoney = nowMoney;
+	}
 
 	public Double getRate() {
 		return rate;

+ 1 - 1
src/main/java/com/uas/platform/b2b/service/impl/ErpProdIODetailServiceImpl.java

@@ -24,7 +24,7 @@ public class ErpProdIODetailServiceImpl implements ErpProdIODetailService{
 		String sql = "select p.pi_inoutno inOutNo,p.pd_detno detno ,p.pi_class piClass, p.pd_ordercode orderCode, p.pd_orderdetno  orderDetno,"
 				+ " p.pd_prodcode  prodCode, p.pd_qty  qty, p.pi_date piDate, p.pd_orderprice  orderPrice, p.pi_currency currency, p.pd_taxrate taxrate, p.pd_ycheckqty yCheckQty,"
 				+ " p.pd_thischeckqty thisCheckQty, p.custuu custUu, p.custname custName, p.enuu enUu, p.sourceid sourceId, p.pi_sourcetable sourceTable, p.pi_rate rate, p.pi_receivecode receiveCode,"
-				+ " p.pi_receivename receiveName from erp$prodiodetail p where enuu = ?";
+				+ " p.pi_receivename receiveName from erp$prodiodetail p where enuu = ? order by pi_date desc";
 		Object[] args = new Object[] {enUu};
 		if (!CollectionUtils.isEmpty(filter)) {
 			String[] str = new String[filter.size()];