فهرست منبع

git-svn-id: https://192.168.57.71/svn/jsgkj@1707 931142cf-59ea-a443-aa0e-51397b428577

ld_xuhx 8 سال پیش
والد
کامیت
9b694a8411

+ 18 - 0
gkjsjy/trunk/WebContent/WEB-INF/pages/index/indexmain.jsp

@@ -131,6 +131,13 @@
 					</table>
 						<!-- 列表 -->
 						
+					<!-- 下载用户操作手册:
+						市级:经营人,行政人员
+						省级:行政人员 -->
+					<div style="margin-bottom:0px;height: 35px;">
+						<a href='${app }/index/downloadUserOperationFile?userId=0'>操作手册下载</a>
+				     </div>
+						
 				</div>
 			<!-- 省级 -->
 			<div id="province" style="display:none;">
@@ -185,6 +192,17 @@
 			
 			<!-- 图表 -->
 			<div id="gridData" align="center" style="display: none;">
+				<div>
+					<c:choose>
+   						<c:when test="${isJyr}">  
+					       <a href='${app }/index/downloadUserOperationFile?userId=2'>操作手册下载</a>
+					    </c:when>
+					    <c:otherwise> 
+					 	   <a href='${app }/index/downloadUserOperationFile?userId=1'>操作手册下载</a>
+					    </c:otherwise>
+					</c:choose>
+					
+				</div>
 				<table class="main_table" style="width:90%;" cellpadding="0" cellspacing="0">
 					<tr>
 						<th width="3%">序号</th>

+ 25 - 0
gkjsjy/trunk/src/com/xt/jygl/common/GlobalData.java

@@ -46,6 +46,16 @@ public class GlobalData {
 	public static String WEIXIN_PORT = "";
 	public static String SECRET = "SPW4uWGVp7TvscIiNxnMzSilJXRe8yvftS1FCji1aDUDL-hdjMs5KopiVPqnQqLs";
 	public static String SJYH_URL = "";
+	
+	/*下载用户操作手册:
+		*市级: 经营人    SHIJ_JYR_CZSC
+			   行政人员 SHIJ_XZRY_CZSC
+		*省级:行政人员 SHENGJ_XZRY_CZSC
+	*/
+	public static String SHENGJ_XZRY_CZSC = "";
+	public static String SHIJ_XZRY_CZSC = "";
+	public static String SHIJ_JYR_CZSC = "";
+	
 
 	public static void init(ServletContext sc) {
 		String ftp_xk_user = sc.getInitParameter("ftp_xk_user");
@@ -178,5 +188,20 @@ public class GlobalData {
 		if (StringUtils.hasLength(prop)) {
 			SJYH_URL = prop;
 		}
+		prop = String.valueOf(p.get("shengj.xzry.czsc"));
+		if (StringUtils.hasLength(prop)) {
+			SHENGJ_XZRY_CZSC = prop;
+		}
+		
+		prop = String.valueOf(p.get("shij.xzry.czsc"));
+		if (StringUtils.hasLength(prop)) {
+			SHIJ_XZRY_CZSC = prop;
+		}
+		
+		prop = String.valueOf(p.get("shij.jyr.czsc"));
+		if (StringUtils.hasLength(prop)) {
+			SHIJ_JYR_CZSC = prop;
+		}
+		
 	}
 }

+ 49 - 11
gkjsjy/trunk/src/com/xt/jygl/sys/ctl/IndexCtl.java

@@ -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;
 	}
+		
 
 }