1.设置session
HttpSession session = request.getSession();
2.将需要传输的数据放到key中
String key =mail+phone+subject+content+businessSystemName+range+level+yxj+type;
}
3.
if(null!=session.getAttribute(key)){
System.out.println("已经传输了同样的数据");
return;
}else{
session.setAttribute(key, "yes");
if(null!=SimpleCache.get(key)&&!"".equals(SimpleCache.get(key))){
System.out.println("缓存中已经传输了同样的数据");
return;
}else{
SimpleCache.put(key, "yes");
System.out.println("成功,下一步执行生成工单操作");
}
}
4 .SimpleCache
package com.creditease.itsm.service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
public class SimpleCache{
public static Map<String, Object> uidMap = new HashMap<String, Object>();
public static void put(String key,Object value){
uidMap.put(key, value);
}
public static Object get(String key){
return uidMap.get(key);
}
static{
}
public static void main(String[] args) {
Iterator<String> it = uidMap.keySet().iterator();
List<String[]> list = new ArrayList<String[]>();
while(it.hasNext()){
String key = it.next();
if(key.contains("param")){
list.add((String[]) uidMap.get(key));
}
}
}
}