Browse Source

删除无效的代码

hejq 7 years ago
parent
commit
87ab874479

+ 1 - 1
src/main/java/com/uas/platform/b2bManage/controller/AccountController.java

@@ -44,7 +44,7 @@ public class AccountController extends BaseController {
 	 */
 	@RequestMapping(value = "/login", method = RequestMethod.POST)
 	public void login(String userName, String passWord, HttpServletRequest request) throws IllegalAccessException {
-        userService.login(userName, passWord, request);
+        userService.login(userName.trim(), passWord.trim(), request);
         useLogService.appendLog(UseType.LOGIN.code(), null, AgentUtils.getIp(request));
 	}
 

+ 0 - 78
src/main/java/com/uas/platform/b2bManage/controller/CommonController.java

@@ -1,78 +0,0 @@
-package com.uas.platform.b2bManage.controller;
-
-import com.alibaba.fastjson.JSON;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
-import org.springframework.ui.ModelMap;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.PrintWriter;
-
-/**
- * controller基础类
- * 
- * @author yingp
- *
- */
-public class CommonController {
-
-	protected static final String defultCharset = "UTF-8";
-
-	@Autowired
-	protected HttpServletRequest request;
-
-	@Autowired
-	protected HttpServletResponse response;
-
-	protected static ModelMap success() {
-		return new ModelMap("success", true);
-	}
-
-	protected static ModelMap success(Object data) {
-		return new ModelMap("success", true).addAttribute("content", data);
-	}
-
-	protected static ModelMap error(String errMsg) {
-		return new ModelMap("error", true).addAttribute("errMsg", errMsg);
-	}
-
-	protected static ModelMap error(String errCode, String errMsg) {
-		return new ModelMap("error", true).addAttribute("errCode", errCode).addAttribute("errMsg", errMsg);
-	}
-
-	/**
-	 * 输出json格式
-	 * 
-	 * @param obj
-	 * @throws IOException
-	 */
-	protected void printJson(Object obj) throws IOException {
-		response.setStatus(HttpStatus.FORBIDDEN.value());
-		response.addHeader("Content-Type", "application/json; charset=" + defultCharset);
-		PrintWriter printWriter = response.getWriter();
-		printWriter.append(JSON.toJSONString(obj));
-		printWriter.flush();
-		printWriter.close();
-	}
-
-	/**
-	 * 输出流
-	 * 
-	 * @param fileName
-	 *            文件名
-	 * @param bytes
-	 * @throws IOException
-	 */
-	protected ResponseEntity<byte[]> outputStream(String fileName, byte[] bytes) {
-		HttpHeaders headers = new HttpHeaders();
-		headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
-		headers.setContentDispositionFormData("attachment", fileName);
-		return new ResponseEntity<byte[]>(bytes, headers, HttpStatus.CREATED);
-	}
-
-}

+ 3 - 0
src/main/java/com/uas/platform/b2bManage/controller/EnterpriseCotroller.java

@@ -58,6 +58,9 @@ public class EnterpriseCotroller {
     @RequestMapping(value = "/list", method = RequestMethod.GET)
     public Page<EnterpriseBaseInfo> findByPageInfo(PageParams params, String keyword, HttpServletRequest request) {
         PageInfo info = new PageInfo(params);
+        if (!StringUtils.isEmpty(keyword)) {
+            keyword = keyword.trim();
+        }
         useLogService.appendLog(UseType.SEARCH.code(), keyword, AgentUtils.getIp(request));
         return baseInfoService.findEnterPageByKeyword(info, keyword);
     }

+ 0 - 99
src/main/java/com/uas/platform/b2bManage/core/util/HttpUtil.java

@@ -1,99 +0,0 @@
-package com.uas.platform.b2bManage.core.util;
-
-import org.apache.http.HttpResponse;
-import org.apache.http.client.methods.CloseableHttpResponse;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.entity.StringEntity;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.http.impl.client.HttpClients;
-import org.apache.http.protocol.HTTP;
-
-import java.io.*;
-
-/**
- * created by shicr on 2017/11/24
- **/
-public class HttpUtil {
-
-    /**
-     * 发送post请求
-     *
-     * @param postUrl
-     * @param formData
-     * @return
-     * @throws Exception
-     */
-    public static Response doPost(String postUrl, String formData,  int timeout) throws Exception {
-        CloseableHttpClient httpClient = HttpClients.createDefault();
-        HttpPost post = new HttpPost(postUrl);
-        StringEntity postingString = new StringEntity(formData, HTTP.UTF_8);
-        post.setEntity(postingString);
-        post.setHeader("Content-type", "application/json");
-        CloseableHttpResponse response = httpClient.execute(post);
-        return Response.getResponse(response);
-    }
-    public static class Response {
-        private int statusCode;
-        private String responseText;
-
-        public int getStatusCode() {
-            return statusCode;
-        }
-
-        public void setStatusCode(int statusCode) {
-            this.statusCode = statusCode;
-        }
-
-        public String getResponseText() {
-            return responseText;
-        }
-
-        public void setResponseText(String responseText) {
-            this.responseText = responseText;
-        }
-
-        public Response() {
-        }
-
-        public Response(boolean success, String content) {
-            super();
-            this.statusCode = success ? 200 : 404;
-            this.responseText = content;
-        }
-
-        public Response(HttpResponse response) throws IllegalStateException, IOException, Exception {
-            this.statusCode = response.getStatusLine().getStatusCode();
-            this.responseText = HttpUtil.read2String(response.getEntity().getContent());
-        }
-
-        public static Response getResponse(HttpResponse response) throws IllegalStateException, IOException, Exception {
-            if (response != null)
-                return new Response(response);
-            return null;
-        }
-    }
-
-    /**
-     * 将输入流转为字符串
-     *
-     * @param inStream
-     * @return
-     * @throws Exception
-     */
-    public static String read2String(InputStream inStream) throws Exception {
-        ByteArrayOutputStream outSteam = new ByteArrayOutputStream();
-        byte[] buffer = new byte[1024];
-        int len = 0;
-        while ((len = inStream.read(buffer)) != -1) {
-            outSteam.write(buffer, 0, len);
-        }
-        try {
-            outSteam.close();
-            inStream.close();
-        } catch (Exception e) {
-
-        }
-        return new String(outSteam.toByteArray(), "UTF-8");
-    }
-
-}

+ 0 - 78
src/main/java/com/uas/platform/b2bManage/core/util/PathUtils.java

@@ -1,78 +0,0 @@
-package com.uas.platform.b2bManage.core.util;
-
-import java.io.File;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-
-/**
- * 路径
- * 
- * @author yingp
- *
- */
-public class PathUtils {
-
-	private static String classPath;
-
-	private static String appPath;
-
-	private static String filePath;
-
-	/**
-	 * classes文件目录
-	 * 
-	 * @return
-	 */
-	public static String getClassPath() {
-		if (classPath == null)
-			setClassPath();
-		return classPath;
-	}
-
-	/**
-	 * 应用程序目录
-	 * 
-	 * @return
-	 */
-	public static String getAppPath() {
-		if (appPath == null)
-			setAppPath();
-		return appPath;
-	}
-
-	/**
-	 * 日志、附件文件等存放目录,与程序同级
-	 * 
-	 * @return
-	 */
-	public static String getFilePath() {
-		if (filePath == null)
-			setFilePath();
-		return filePath;
-	}
-
-	private static void setClassPath() {
-		Class<?> objClass = ContextUtils.getApplicationContext().getClass();
-		String strRealPath = objClass.getClassLoader().getResource("").getFile();
-		try {
-			strRealPath = URLDecoder.decode(strRealPath, "UTF-8");
-		} catch (UnsupportedEncodingException e) {
-			e.printStackTrace();
-		}
-		File objFile = new File(strRealPath);
-		classPath = objFile.getParent() + File.separator;
-		if (classPath.contains("/")) {
-			classPath = "/" + classPath;
-		}
-	}
-
-	private static void setAppPath() {
-		File file = new File(getClassPath());
-		appPath = file.getParent() + File.separator;
-	}
-
-	private static void setFilePath() {
-		File file = new File(getAppPath());
-		filePath = file.getParent() + File.separator;
-	}
-}