修复freemarker 引

This commit is contained in:
zxm 2018-01-28 00:14:52 +08:00
parent fac2248652
commit 1dc525a894
2 changed files with 27 additions and 1 deletions

View File

@ -18,7 +18,7 @@ public class Md5Util {
* @param args * @param args
*/ */
public static void main(String[] args) { public static void main(String[] args) {
String str= getMD5("123456","ceship"); String str= getMD5("123456","tom");
System.out.println(str); System.out.println(str);
} }
} }

View File

@ -1,7 +1,11 @@
package com.len.util; package com.len.util;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @author zhuxiaomeng * @author zhuxiaomeng
@ -26,4 +30,26 @@ public class ReType implements Serializable{
this.count = count; this.count = count;
this.data = data; this.data = data;
} }
/**
* 动态添加属性 map 用法可以参考 activiti 模块中 com.len.JsonTest 测试类中用法
* @param count
* @param data
* @param map
* @param node 绑定节点字符串 这样可以更加灵活
* @return
*/
public static String jsonStrng(long count,List<?> data,Map<String, Map<String,Object>> map,String node){
JSONArray jsonArray=JSONArray.parseArray(JSON.toJSONString(data));
JSONObject object=new JSONObject();
for(int i=0;i<jsonArray.size();i++){
JSONObject jsonData = (JSONObject) jsonArray.get(i);
jsonData.putAll(map.get(jsonData.get(node)));
}
object.put("count",count);
object.put("data",jsonArray);
object.put("code",0);
object.put("msg","");
return object.toJSONString();
}
} }