浏览代码

更新物料导出方法

git-svn-id: svn+ssh://10.10.101.21/source/platform/platform-b2b@8580 f3bf4e98-0cf0-11e4-a00c-a99a8b9d557d
hejq 9 年之前
父节点
当前提交
8349ac4783

+ 26 - 0
src/main/java/com/uas/platform/b2b/controller/ProductController.java

@@ -4,17 +4,23 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Sort.Direction;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.PathVariable;
 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.Product;
 import com.uas.platform.b2b.search.SearchService;
 import com.uas.platform.b2b.service.ProductService;
+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.logging.BufferedLoggerManager;
 import com.uas.platform.core.model.Constant;
+import com.uas.platform.core.model.PageInfo;
 import com.uas.platform.core.model.PageParams;
 import com.uas.search.b2b.model.SPage;
 import com.uas.search.b2b.model.Sort;
@@ -31,6 +37,8 @@ import com.uas.search.b2b.util.SearchConstants;
 @RequestMapping("/product")
 public class ProductController {
 
+	private final static UsageBufferedLogger logger = BufferedLoggerManager.getLogger(UsageBufferedLogger.class);
+
 	@Autowired
 	private SearchService searchService;
 
@@ -93,4 +101,22 @@ public class ProductController {
 	private void lockProduct(@PathVariable Long id) {
 		productService.lock(id);
 	}
+
+	/**
+	 * 导出Excel
+	 * 
+	 * @param params
+	 * @return
+	 */
+	@RequestMapping(value = "/xls", method = RequestMethod.GET)
+	public ModelAndView export(String keyword) {
+		PageInfo pageInfo = new PageInfo(1, JxlsExcelView.MAX_SIZE, 0);
+		pageInfo.sorting("id", Direction.DESC);
+		pageInfo.filter("enUU", SystemSession.getUser().getEnterprise().getUu());
+		ModelAndView modelAndView = new ModelAndView();
+		modelAndView.addObject("data", productService.findAllByPageInfo(pageInfo, keyword).getContent());
+		modelAndView.setView(new JxlsExcelView("classpath:jxls-tpl/baseInfo/baseInfo", "物料资料表"));
+		logger.log("物料资料", "导出Excel列表", "导出全部Excel列表");
+		return modelAndView;
+	}
 }

+ 3 - 11
src/main/webapp/resources/tpl/index/approvalFlow/prodList.html

@@ -138,7 +138,7 @@
     <div class="pub-com_head">
         <span>产品库</span>
         <div class="p-right">
-            <a href="product/baseInfo/xls?keyword={{keywordXls}}" target="_self" class="text-simple" title="导出Excel表格">导出</a>
+            <a href="product/xls?keyword={{keywordXls}}" target="_self" class="text-simple" title="导出Excel表格">导出</a>
             <a ui-sref="sale.newProdInfo">新增</a>
             <a ui-sref="sale.uploadByBatch" title="批量导入">批量导入</a>
         </div>
@@ -173,12 +173,6 @@
                 <th width="70">单位</th>
                 <th width ="90">操作</th>
             </tr>
-            <!--<tr class="sep-row">
-                <td colspan="5"></td>
-            </tr>
-            <tr class="sep-row">
-                <td colspan="5"></td>
-            </tr>-->
             </thead>
             <tbody ng-repeat="product in $data">
             <tr class="order-hd">
@@ -193,11 +187,9 @@
                 <td class="text-center" title="原厂型号" ng-bind="::product.cmpCode"></td>
                 <td class="text-center" title="单位" ng-bind="::product.unit"></td>
                 <td class="text-center">
-                	<!--<a ng-click="lock(product.id)" ng-if="::product.isSale==1">关闭</a>
-                	<a ng-click="unlock(product.id)" ng-if="::product.isSale!=1">开启</a>-->
                     <span class="checkbox" style="width: 100%;">
-                        <span class="off" title="已开启" ng-click="unlock(product.id)" ng-if="::product.isSale!=1"></span>
-                        <span class="" title="已关闭" ng-click="lock(product.id)" ng-if="::product.isSale==1"></span>
+                        <span class="" title="已关闭" ng-click="unlock(product.id)" ng-if="::product.isSale!=1"></span>
+                        <span class="off" title="已开启" ng-click="lock(product.id)" ng-if="::product.isSale==1"></span>
                     </span>
                 </td>
             </tr>