初来乍到 请多关照

dev
jingwei.tao 2023-06-10 18:19:02 +08:00
parent cfe56ff505
commit da4fa0aaa9
3 changed files with 448 additions and 0 deletions

View File

@ -0,0 +1,61 @@
package aiyh.utils.ecologyutil.rightutil;
import aiyh.utils.Util;
import aiyh.utils.httpUtil.cushttpclasses.CusHttpServletRequest;
import aiyh.utils.httpUtil.cushttpclasses.CusHttpSession;
import com.alibaba.fastjson.JSONObject;
import com.engine.hrm.cmd.permissiontoadjust.ProcessDataCmd;
import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.Map;
/**
* ecology
*
*/
public class RightMoveUtil {
/**
*
* @param param
* @return
*/
public static JSONObject moveRight(JSONObject param){
JSONObject result = new JSONObject();
try{
Util.logStr("RightMoveUtil moveRight begin;param:[{}]", param.toJSONString());
Map<String, Object> params = new HashMap<>();
for(Object key : param.keySet()){
params.put(key.toString(),param.get(key));
}
HttpServletRequest request = new CusHttpServletRequest(){
@Override
public String getParameter(String s) {
return param.getString(s);
}
@Override
public HttpSession getSession(boolean b) {
HttpSession session = new CusHttpSession(){
@Override
public Object getAttribute(String s) {
return new User(1);
}
};
return session;
}
};
ProcessDataCmd cmd = new ProcessDataCmd(params,request,new User(1));
Map<String, Object> execute = cmd.execute(null);
result = new JSONObject(execute);
Util.logStr("RightMoveUtil moveRight end;result:[{}]", execute.toString());
return result;
}catch (Throwable e){
Util.logStr("RightMoveUtil moveRight error;message:[{}]", e.getMessage());
return result;
}
}
}

View File

@ -0,0 +1,274 @@
package aiyh.utils.httpUtil.cushttpclasses;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletInputStream;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.security.Principal;
import java.util.Enumeration;
import java.util.Locale;
import java.util.Map;
public class CusHttpServletRequest implements HttpServletRequest {
@Override
public String getMethod() {
return null;
}
@Override
public String getRequestURI() {
return null;
}
@Override
public StringBuffer getRequestURL() {
return null;
}
@Override
public String getContextPath() {
return null;
}
@Override
public String getServletPath() {
return null;
}
@Override
public String getPathInfo() {
return null;
}
@Override
public String getPathTranslated() {
return null;
}
@Override
public String getQueryString() {
return null;
}
@Override
public String getHeader(String s) {
return null;
}
@Override
public Enumeration getHeaders(String s) {
return null;
}
@Override
public Enumeration getHeaderNames() {
return null;
}
@Override
public int getIntHeader(String s) {
return 0;
}
@Override
public long getDateHeader(String s) {
return 0;
}
@Override
public Cookie[] getCookies() {
return new Cookie[0];
}
@Override
public HttpSession getSession(boolean b) {
return null;
}
@Override
public HttpSession getSession() {
return null;
}
@Override
public String getRequestedSessionId() {
return null;
}
@Override
public boolean isRequestedSessionIdValid() {
return false;
}
@Override
public boolean isRequestedSessionIdFromCookie() {
return false;
}
@Override
public boolean isRequestedSessionIdFromURL() {
return false;
}
@Override
public String getAuthType() {
return null;
}
@Override
public String getRemoteUser() {
return null;
}
@Override
public boolean isUserInRole(String s) {
return false;
}
@Override
public Principal getUserPrincipal() {
return null;
}
/**
* @deprecated
*/
@Override
public boolean isRequestedSessionIdFromUrl() {
return false;
}
@Override
public String getProtocol() {
return null;
}
@Override
public String getScheme() {
return null;
}
@Override
public String getServerName() {
return null;
}
@Override
public int getServerPort() {
return 0;
}
@Override
public String getRemoteAddr() {
return null;
}
@Override
public String getRemoteHost() {
return null;
}
@Override
public void setCharacterEncoding(String s) throws UnsupportedEncodingException {
}
@Override
public String getParameter(String s) {
return null;
}
@Override
public String[] getParameterValues(String s) {
return new String[0];
}
@Override
public Enumeration getParameterNames() {
return null;
}
@Override
public Map getParameterMap() {
return null;
}
@Override
public ServletInputStream getInputStream() throws IOException {
return null;
}
@Override
public BufferedReader getReader() throws IOException, IllegalStateException {
return null;
}
@Override
public String getCharacterEncoding() {
return null;
}
@Override
public int getContentLength() {
return 0;
}
@Override
public String getContentType() {
return null;
}
@Override
public Locale getLocale() {
return null;
}
@Override
public Enumeration getLocales() {
return null;
}
@Override
public boolean isSecure() {
return false;
}
@Override
public Object getAttribute(String s) {
return null;
}
@Override
public void setAttribute(String s, Object o) {
}
@Override
public Enumeration getAttributeNames() {
return null;
}
@Override
public void removeAttribute(String s) {
}
@Override
public RequestDispatcher getRequestDispatcher(String s) {
return null;
}
/**
* @param s
* @deprecated
*/
@Override
public String getRealPath(String s) {
return null;
}
}

View File

@ -0,0 +1,113 @@
package aiyh.utils.httpUtil.cushttpclasses;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionContext;
import java.util.Enumeration;
public class CusHttpSession implements HttpSession {
@Override
public String getId() {
return null;
}
@Override
public boolean isNew() {
return false;
}
@Override
public long getCreationTime() {
return 0;
}
@Override
public long getLastAccessedTime() {
return 0;
}
@Override
public void setMaxInactiveInterval(int i) {
}
@Override
public int getMaxInactiveInterval() {
return 0;
}
@Override
public Object getAttribute(String s) {
return null;
}
@Override
public Enumeration<String> getAttributeNames() {
return null;
}
@Override
public void setAttribute(String s, Object o) {
}
@Override
public void removeAttribute(String s) {
}
@Override
public void invalidate() {
}
/**
* @deprecated
*/
@Override
public HttpSessionContext getSessionContext() {
return null;
}
@Override
public ServletContext getServletContext() {
return null;
}
/**
* @param s
* @deprecated
*/
@Override
public Object getValue(String s) {
return null;
}
/**
* @deprecated
*/
@Override
public String[] getValueNames() {
return new String[0];
}
/**
* @param s
* @param o
* @deprecated
*/
@Override
public void putValue(String s, Object o) {
}
/**
* @param s
* @deprecated
*/
@Override
public void removeValue(String s) {
}
}