|
@@ -1,6 +1,11 @@
|
|
|
package com.xt.jygl.sys.ctl;
|
|
|
|
|
|
+import java.io.BufferedInputStream;
|
|
|
+import java.io.FileInputStream;
|
|
|
+import java.io.IOException;
|
|
|
+import java.io.InputStream;
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.net.URLEncoder;
|
|
|
import java.sql.Timestamp;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Calendar;
|
|
@@ -14,7 +19,10 @@ import javax.persistence.criteria.CriteriaQuery;
|
|
|
import javax.persistence.criteria.Expression;
|
|
|
import javax.persistence.criteria.Predicate;
|
|
|
import javax.persistence.criteria.Root;
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
+import org.apache.poi.hssf.util.HSSFColor.GOLD;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.jpa.domain.Specification;
|
|
|
import org.springframework.stereotype.Controller;
|
|
@@ -22,6 +30,7 @@ import org.springframework.ui.Model;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
+import com.xt.jygl.accessory.entity.AccessoryEntity;
|
|
|
import com.xt.jygl.common.BaseWebCtl;
|
|
|
import com.xt.jygl.common.Constants;
|
|
|
import com.xt.jygl.common.GlobalData;
|
|
@@ -49,6 +58,7 @@ public class IndexCtl extends BaseWebCtl {
|
|
|
|
|
|
@RequestMapping(value = "/main")
|
|
|
public String main(Model model, String menuid) {
|
|
|
+ boolean isJyr = false;
|
|
|
|
|
|
// Map<String, Object> map = getXx(GlobalData.CITY_CODE,null,null);
|
|
|
//
|
|
@@ -80,9 +90,13 @@ public class IndexCtl extends BaseWebCtl {
|
|
|
}
|
|
|
model.addAttribute("list", list);
|
|
|
}
|
|
|
+ if(GlobalData.CITY_CODE.equals("90016")){
|
|
|
+ isJyr = isJyr();
|
|
|
+ }
|
|
|
model.addAttribute("menuid", menuid);
|
|
|
model.addAttribute("citycode", GlobalData.CITY_CODE);
|
|
|
model.addAttribute("cityname", GlobalData.CITY_NAME);
|
|
|
+ model.addAttribute("isJyr", isJyr);
|
|
|
return "index/indexmain";
|
|
|
}
|
|
|
|
|
@@ -265,20 +279,44 @@ public class IndexCtl extends BaseWebCtl {
|
|
|
}
|
|
|
return wr;
|
|
|
}
|
|
|
-
|
|
|
- @RequestMapping(value = "/getCityData")
|
|
|
- @ResponseBody
|
|
|
- public WebJsonResult getCityData(Model model) {
|
|
|
- WebJsonResult wr = success();
|
|
|
+
|
|
|
+
|
|
|
+ /*下载用户操作手册:
|
|
|
+ *市级: 经营人 2
|
|
|
+ 行政人员 1
|
|
|
+ *省级:行政人员 0
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/downloadUserOperationFile")
|
|
|
+ public WebJsonResult downloadUserOperationFile(String userId, HttpServletRequest request,HttpServletResponse response) {
|
|
|
+ // path是指欲下载的文件的路径。
|
|
|
+ String path = "";
|
|
|
+ String fileNameTemp = "";
|
|
|
+ if(userId.equals("0")){
|
|
|
+ path = GlobalData.SHENGJ_XZRY_CZSC;
|
|
|
+ }else if(userId.equals("1")){
|
|
|
+ path = GlobalData.SHIJ_XZRY_CZSC;
|
|
|
+ }else{
|
|
|
+ path = GlobalData.SHIJ_JYR_CZSC;
|
|
|
+ }
|
|
|
+ //从文件路径中获取文件名称
|
|
|
+ fileNameTemp = path.substring(path.lastIndexOf("/")+1, path.length());
|
|
|
try {
|
|
|
- Map<String, Object> map = getXx(GlobalData.CITY_CODE, null, null);
|
|
|
- wr.setAttrs(map);
|
|
|
- } catch (Exception e) {
|
|
|
- wr.setSuccess(false);
|
|
|
- wr.setMessage("操作失败!");
|
|
|
+ // 以流的形式下载文件。
|
|
|
+ InputStream fis = new BufferedInputStream(new FileInputStream(path));
|
|
|
+ byte[] buffer = new byte[fis.available()];
|
|
|
+ fis.read(buffer);
|
|
|
+ fis.close();
|
|
|
+ // 设置response的Header
|
|
|
+ response.setCharacterEncoding("utf-8");
|
|
|
+ response.setContentType("multipart/form-data");
|
|
|
+ String fileName = URLEncoder.encode(fileNameTemp, "UTF-8");
|
|
|
+ response.setHeader("Content-Disposition", "attachment;fileName=" + fileName);
|
|
|
+ response.getOutputStream().write(buffer);
|
|
|
+ } catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- return wr;
|
|
|
+ return null;
|
|
|
}
|
|
|
+
|
|
|
|
|
|
}
|