|
@@ -1,12 +1,16 @@
|
|
|
package com.caimei.modules.product.web;
|
|
|
|
|
|
+import com.caimei.modules.common.utils.ExcelUtil;
|
|
|
import com.caimei.modules.order.entity.CmAuthorizedConsignment;
|
|
|
+import com.caimei.modules.order.entity.CmDiscernReceipt;
|
|
|
+import com.caimei.modules.order.utils.OrderUtil;
|
|
|
import com.caimei.modules.product.entity.SearchFrequency;
|
|
|
import com.caimei.modules.product.service.KeywordFrequencyService;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import com.thinkgem.jeesite.common.config.Global;
|
|
|
import com.thinkgem.jeesite.common.persistence.Page;
|
|
|
import com.thinkgem.jeesite.common.web.BaseController;
|
|
|
+import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.ui.Model;
|
|
@@ -19,7 +23,10 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.awt.*;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
@Controller
|
|
|
@RequestMapping(value = "${adminPath}/product/keywordFrequency")
|
|
@@ -130,6 +137,8 @@ public class KeywordFrequencyController extends BaseController {
|
|
|
searchFrequency.setTrueStatus(1);
|
|
|
searchFrequency.setFromSearch(6);//为管理员添加
|
|
|
searchFrequency.setPath("管理员添加");
|
|
|
+ Date date=new Date();
|
|
|
+ searchFrequency.setSearchTime(new java.sql.Date(date.getTime()));
|
|
|
if(null !=searchFrequency.getKeyId()){
|
|
|
searchFrequency.setId(searchFrequency.getKeyId().toString());
|
|
|
}
|
|
@@ -143,4 +152,55 @@ public class KeywordFrequencyController extends BaseController {
|
|
|
return "redirect:"+Global.getAdminPath()+"/product/keywordFrequency/getKeywordThesaurusInfo";
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出关键词
|
|
|
+ * @param ids
|
|
|
+ * @param redirectAttributes
|
|
|
+ * @param request
|
|
|
+ * @param response
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "export")
|
|
|
+ public void export(String ids, RedirectAttributes redirectAttributes, HttpServletRequest request, HttpServletResponse response) {
|
|
|
+ //获取订单数据
|
|
|
+ String fileName = "关键词列表.xls";
|
|
|
+ String template = Global.getConfig("export.template");
|
|
|
+ String templateFileName = template + "/keyword.xls";
|
|
|
+ try {
|
|
|
+ Map data = new HashMap<String, Object>();
|
|
|
+ List<SearchFrequency> list = keywordFrequencyService.export(ids);
|
|
|
+ data.put("list", list);
|
|
|
+// data.put("orderUtil", new OrderUtil());
|
|
|
+ new ExcelUtil().createExcel(templateFileName, data, fileName, response);
|
|
|
+ } catch (Exception e) {
|
|
|
+ addMessage(redirectAttributes, "关键词导出失败!" + e.getMessage());
|
|
|
+ logger.info(e.getMessage());
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 导出关键词
|
|
|
+ * @param ids
|
|
|
+ * @param redirectAttributes
|
|
|
+ * @param request
|
|
|
+ * @param response
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "exportThesaurus")
|
|
|
+ public void exportThesaurus(String ids, RedirectAttributes redirectAttributes, HttpServletRequest request, HttpServletResponse response) {
|
|
|
+ //获取订单数据
|
|
|
+ String fileName = "关键词列表.xls";
|
|
|
+ String template = Global.getConfig("export.template");
|
|
|
+ String templateFileName = template + "/thesaurus.xls";
|
|
|
+ try {
|
|
|
+ Map data = new HashMap<String, Object>();
|
|
|
+ List<SearchFrequency> list = keywordFrequencyService.export(ids);
|
|
|
+ data.put("list", list);
|
|
|
+// data.put("orderUtil", new OrderUtil());
|
|
|
+ new ExcelUtil().createExcel(templateFileName, data, fileName, response);
|
|
|
+ } catch (Exception e) {
|
|
|
+ addMessage(redirectAttributes, "关键词导出失败!" + e.getMessage());
|
|
|
+ logger.info(e.getMessage());
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|