1. when information about logs should save by databse ,we should save by json;
Map map=new HashMap();
//getCrmIdUserName
map.put("userName", userName);
map.put("crmId", crmId);
map.put("description",userName+"调离"+storeName);
map.put("orgId", store);
peoStoreConfigurationLog log=new peoStoreConfigurationLog();
log.setMark(JSON.toJSONString(map));
2.
public List<LogInfo> logInfoList(Map map) throws ParseException {
List<LogInfo> logInfoList1=new ArrayList<LogInfo>();
List<LogInfo> logInfoList=null;
logInfoList=logInfoDao.logInfoList(map);
for(int i=0;i<logInfoList.size();i++){
LogInfo log=new LogInfo();
if(null!=logInfoList.get(i).getMark()&&!"".equals(logInfoList.get(i).getMark())){
String mark=logInfoList.get(i).getMark().toString();
Map<String,Object> mapMark=JSONObject.parseObject(mark);
StringBuilder sb=new StringBuilder();
for(Entry<String,Object> dds:mapMark.entrySet()){
sb.append(dds.getKey()+":"+dds.getValue()+"<br/>");
//System.out.print(dds.getKey()+":");
//System.out.println(dds.getValue());
}
log.setMark(sb.toString());
/* mark=mark.substring(1, mark.length()-1);
String[]markArray=mark.split(",");
for(int n=0;n<markArray.length;n++){
int index=markArray[n].indexOf("=");
String str=markArray[n].substring(index+1, markArray[n].length());//取出想要的在前台显示
if(n==1){
log.setDescription(str);
}
if(n==2){
log.setUserName(str);
}
if(n==3){
log.setCrmId(str);
}
}*/
if(null==logInfoList.get(i).getOperatorUserName()){
log.setOperatorUserName("");
}else{
log.setOperatorUserName(logInfoList.get(i).getOperatorUserName());
}
log.setOperatorCrmId(logInfoList.get(i).getOperatorCrmId());
SimpleDateFormat sdf1=new SimpleDateFormat("yyMMddHH");
SimpleDateFormat sdf0=new SimpleDateFormat("yyyy-MM-dd HH:00:00");
String currentDate=logInfoList.get(i).getCurrentDate();
log.setCurrentDate(sdf0.format(sdf1.parse(currentDate)));
log.setOperatorDescription(logInfoList.get(i).getOperatorDescription());
}
logInfoList1.add(log);
}
// TODO Auto-generated method stub
return logInfoList1;
}