Search in sources :

Example 1 with SysIcon

use of com.cdeledu.model.system.SysIcon in project wechat by dllwh.

the class IconController method initIcon.

@RequestMapping(value = "initIcon")
@ResponseBody
public AjaxJson initIcon() {
    AjaxJson result = new AjaxJson();
    try {
        result.setMsg("数据初始化成功");
        Map<String, String> filePathMap = Maps.newConcurrentMap();
        ClassLoader baseUrl = Thread.currentThread().getContextClassLoader();
        filePathMap.put("bootstrap", baseUrl.getResource("bootstrapIconInfo/bootstrap.css").getPath());
        filePathMap.put("fontAwesome", baseUrl.getResource("bootstrapIconInfo/font-awesome.css").getPath());
        filePathMap.put("simpleLine", baseUrl.getResource("bootstrapIconInfo/simple-line-icons.css").getPath());
        List<Map<String, String>> resultList = BootstrapHelper.getBootstrapIconInfo(filePathMap);
        SysIcon sysIcon = null;
        for (Map<String, String> map : resultList) {
            try {
                sysIcon = new SysIcon();
                sysIcon.setDisplayName(map.get("displayName"));
                sysIcon.setSourceType(map.get("sourceType"));
                if (sysIconService.findOneForJdbc(sysIcon) != null) {
                    sysIcon.setClassName(map.get("className"));
                    sysIconService.insert(sysIcon);
                }
            } catch (Exception e) {
                continue;
            }
        }
    } catch (Exception e) {
        result.setMsg("数据初始化失败,原因" + e.getMessage());
        result.setSuccess(false);
    }
    return result;
}
Also used : SysIcon(com.cdeledu.model.system.SysIcon) AjaxJson(com.cdeledu.common.base.AjaxJson) Map(java.util.Map) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

AjaxJson (com.cdeledu.common.base.AjaxJson)1 SysIcon (com.cdeledu.model.system.SysIcon)1 Map (java.util.Map)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1