generated from root/miduo_server
添加參數
parent
7e58454a6f
commit
e129b5d745
|
@ -37,6 +37,7 @@ public class JsonUtil {
|
|||
public Gson getGson() {
|
||||
return gson;
|
||||
}
|
||||
|
||||
public HashMap<String, String> getParameterMap2(HttpServletRequest request) throws IOException {
|
||||
HashMap<String, String> map = new HashMap();
|
||||
Enumeration paramNames = request.getParameterNames();
|
||||
|
@ -45,7 +46,7 @@ public class JsonUtil {
|
|||
String[] paramValues = request.getParameterValues(paramName);
|
||||
String paramValue = paramValues[0];
|
||||
map.put(paramName, paramValue);
|
||||
LOGGER.info("parameter :"+paramName +"= {} " , paramValue);
|
||||
LOGGER.info("parameter :" + paramName + "= {} ", paramValue);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
@ -58,12 +59,12 @@ public class JsonUtil {
|
|||
String[] paramValues = request.getParameterValues(paramName);
|
||||
String paramValue = paramValues[0];
|
||||
String key = paramName;
|
||||
if(!StringUtils.checkIsEmpty(paramValue)){
|
||||
if (!StringUtils.checkIsEmpty(paramValue)) {
|
||||
key = paramName + "=" + paramValue;
|
||||
|
||||
}
|
||||
map.put(key, paramValue);
|
||||
LOGGER.info("parameter : {} " , key);
|
||||
LOGGER.info("parameter : {} ", key);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
@ -72,10 +73,7 @@ public class JsonUtil {
|
|||
HashMap<String, String> map = new HashMap();
|
||||
Enumeration paramNames = request.getParameterNames();
|
||||
while (paramNames.hasMoreElements()) {
|
||||
String paramName = (String) paramNames.nextElement();
|
||||
JSONObject data = new JSONObject(paramName);
|
||||
Set<String> strings = data.keySet();
|
||||
for (String string : strings) {
|
||||
String string = (String) paramNames.nextElement();
|
||||
LOGGER.info("getParameterMapYX param {}", string);
|
||||
string = string.replace("{", "");
|
||||
string = string.replace("}", "");
|
||||
|
@ -83,8 +81,10 @@ public class JsonUtil {
|
|||
String[] split = string.split(",");
|
||||
for (String s : split) {
|
||||
String[] split1 = s.split(":");
|
||||
map.put(split1[0].replace("\"", ""), split1[1].replace("\"", ""));
|
||||
}
|
||||
String key = split1[0].replace("\"", "");
|
||||
String value = split1[1].replace("\"", "");
|
||||
map.put(key, value);
|
||||
LOGGER.info("getParameterMapYX =================> key={} value={}", key, value);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
|
@ -119,23 +119,24 @@ public class JsonUtil {
|
|||
|
||||
/**
|
||||
* 获取日期前一天
|
||||
*
|
||||
* @param specifiedDay
|
||||
* @return
|
||||
*/
|
||||
public static String getSpecifiedDayBefore(String specifiedDay){
|
||||
public static String getSpecifiedDayBefore(String specifiedDay) {
|
||||
//SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Calendar c = Calendar.getInstance();
|
||||
Date date=null;
|
||||
Date date = null;
|
||||
try {
|
||||
date = new SimpleDateFormat("yy-MM-dd").parse(specifiedDay);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
c.setTime(date);
|
||||
int day=c.get(Calendar.DATE);
|
||||
c.set(Calendar.DATE,day-1);
|
||||
int day = c.get(Calendar.DATE);
|
||||
c.set(Calendar.DATE, day - 1);
|
||||
|
||||
String dayBefore=new SimpleDateFormat("yyyy-MM-dd").format(c.getTime());
|
||||
String dayBefore = new SimpleDateFormat("yyyy-MM-dd").format(c.getTime());
|
||||
return dayBefore;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue