Search in sources :

Example 1 with Briefing

use of com.topcom.cms.yuqing.domain.Briefing in project topcom-cloud by 545314690.

the class FreemarkerUtilsTest method savetoMongo.

@Test
public void savetoMongo() {
    for (int i = 0; i < 5; i++) {
        Briefing briefing = new Briefing();
        briefing.setAuthor("宋丽花" + i);
        briefing.setTitle("测试数据Title" + i);
        briefing.setAttachment("Attachment" + i);
        briefing.setCreateTime("2017年" + i + "月");
        briefing.setOutline(i + "这是一条非常重要的测试数据");
        briefing.setType(Briefing.BriefingType.WEEKLY);
        briefing.setUserId(10020121l + i);
        briefingManager.save(briefing);
    }
    for (int i = 0; i < 5; i++) {
        Briefing briefing = new Briefing();
        briefing.setAuthor("宋丽花" + i);
        briefing.setTitle("测试数据Title" + i);
        briefing.setAttachment("Attachment" + i);
        briefing.setCreateTime("2017年" + i + "月");
        briefing.setOutline(i + "这是一条非常重要的测试数据");
        briefing.setType(Briefing.BriefingType.SPECIAL);
        briefing.setUserId(10020121l + i);
        briefingManager.save(briefing);
    }
}
Also used : Briefing(com.topcom.cms.yuqing.domain.Briefing) Test(org.junit.Test)

Example 2 with Briefing

use of com.topcom.cms.yuqing.domain.Briefing in project topcom-cloud by 545314690.

the class FreemarkerUtil method main.

public static void main(String[] args) throws Exception {
    List<String> lines = Files.readAllLines(Paths.get("D:\\data\\briefing.json"));
    Object object = HttpUtil.doGet("http://192.168.0.12:8081/briefingJson", "");
    JSONObject jsonObject = JSONObject.fromObject(lines.get(0));
    Briefing briefing = (Briefing) JSONObject.toBean(jsonObject, Briefing.class);
    Map<String, Object> dataMap = new HashMap<>();
    dataMap.put("briefing", jsonObject);
    FreemarkerUtil.processTemplateIntoFile(dataMap, new File("E:/outFile002.doc"), "brietNew.ftl");
// Map<String, Object> dataMap = new HashMap<String, Object>();
// dataMap.put("title","安全生产舆情");
// dataMap.put("briefingType","月报");
// dataMap.put("subTitle","2017年第2期");
// dataMap.put("author","通信信息中心");
// dataMap.put("pubTime","2017年2月");
// dataMap.put("outline","事故发生少,没啥要说的,凑合着看吧!");
// List<Map<String,Object>> briefOneList = new ArrayList<>();
// for (int i=0;i<3;i++){
// Map<String, Object> briefOneMap = new HashMap<String, Object>();
// briefOneMap.put("title",i+"子标题");
// briefOneMap.put("description","一级标题美图");
// List<Map<String,Object>> brirfTwoList = new ArrayList<>();
// for (int j=0;j<5;j++){
// Map<String, Object> briefTwoMap = new HashMap<String, Object>();
// briefTwoMap.put("title","图"+i+"-"+j);
// briefTwoMap.put("img",img);
// briefTwoMap.put("description","图片"+j+"的描述,假装有描述");
// brirfTwoList.add(briefTwoMap);
// }
// briefOneMap.put("briefList",brirfTwoList);
// briefOneList.add(briefOneMap);
// }
// dataMap.put("briefList",briefOneList);
// 
// FreemarkerUtil.processTemplateIntoFile(dataMap, "E:/outFile001.doc", "brietNew.ftl");
}
Also used : JSONObject(net.sf.json.JSONObject) HashMap(java.util.HashMap) Briefing(com.topcom.cms.yuqing.domain.Briefing) JSONObject(net.sf.json.JSONObject)

Aggregations

Briefing (com.topcom.cms.yuqing.domain.Briefing)2 HashMap (java.util.HashMap)1 JSONObject (net.sf.json.JSONObject)1 Test (org.junit.Test)1