Search in sources :

Example 11 with SysSite

use of com.publiccms.entities.sys.SysSite in project PublicCMS-preview by sanluan.

the class CmsDictionaryAdminController method save.

/**
 * @param entity
 * @param dictionaryParamters
 * @param request
 * @param session
 * @return view name
 */
@RequestMapping("save")
public String save(CmsDictionary entity, CmsDictionaryParamters dictionaryParamters, HttpServletRequest request, HttpSession session) {
    SysSite site = getSite(request);
    if (null != entity.getId()) {
        entity = service.update(entity.getId(), entity, ignoreProperties);
        dataService.update(entity.getId(), dictionaryParamters.getDataList());
        logOperateService.save(new LogOperate(site.getId(), getAdminFromSession(session).getId(), LogLoginService.CHANNEL_WEB_MANAGER, "update.cmsDictionary", RequestUtils.getIpAddress(request), CommonUtils.getDate(), JsonUtils.getString(entity)));
    } else {
        service.save(entity);
        dataService.save(entity.getId(), dictionaryParamters.getDataList());
        logOperateService.save(new LogOperate(site.getId(), getAdminFromSession(session).getId(), LogLoginService.CHANNEL_WEB_MANAGER, "save.cmsDictionary", RequestUtils.getIpAddress(request), CommonUtils.getDate(), JsonUtils.getString(entity)));
    }
    return TEMPLATE_DONE;
}
Also used : LogOperate(com.publiccms.entities.log.LogOperate) SysSite(com.publiccms.entities.sys.SysSite) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 12 with SysSite

use of com.publiccms.entities.sys.SysSite in project PublicCMS-preview by sanluan.

the class CmsDictionaryAdminController method delete.

/**
 * @param ids
 * @param request
 * @param session
 * @return view name
 */
@RequestMapping("delete")
public String delete(Long[] ids, HttpServletRequest request, HttpSession session) {
    SysSite site = getSite(request);
    if (CommonUtils.notEmpty(ids)) {
        service.delete(ids);
        logOperateService.save(new LogOperate(site.getId(), getAdminFromSession(session).getId(), LogLoginService.CHANNEL_WEB_MANAGER, "delete.cmsDictionary", RequestUtils.getIpAddress(request), CommonUtils.getDate(), StringUtils.join(ids, ',')));
    }
    return TEMPLATE_DONE;
}
Also used : LogOperate(com.publiccms.entities.log.LogOperate) SysSite(com.publiccms.entities.sys.SysSite) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 13 with SysSite

use of com.publiccms.entities.sys.SysSite in project PublicCMS-preview by sanluan.

the class CmsLotteryAdminController method save.

/**
 * @param entity
 * @param request
 * @param session
 * @param model
 * @return view name
 */
@RequestMapping("save")
public String save(CmsLottery entity, HttpServletRequest request, HttpSession session, ModelMap model) {
    SysSite site = getSite(request);
    if (null != entity.getId()) {
        CmsLottery oldEntity = service.getEntity(entity.getId());
        if (null == oldEntity || ControllerUtils.verifyNotEquals("siteId", site.getId(), oldEntity.getSiteId(), model)) {
            return TEMPLATE_ERROR;
        }
        entity = service.update(entity.getId(), entity, ignoreProperties);
        if (null != entity) {
            logOperateService.save(new LogOperate(site.getId(), getAdminFromSession(session).getId(), LogLoginService.CHANNEL_WEB_MANAGER, "update.lottery", RequestUtils.getIpAddress(request), CommonUtils.getDate(), JsonUtils.getString(entity)));
        }
    } else {
        entity.setSiteId(site.getId());
        service.save(entity);
        logOperateService.save(new LogOperate(site.getId(), getAdminFromSession(session).getId(), LogLoginService.CHANNEL_WEB_MANAGER, "save.lottery", RequestUtils.getIpAddress(request), CommonUtils.getDate(), JsonUtils.getString(entity)));
    }
    return TEMPLATE_DONE;
}
Also used : LogOperate(com.publiccms.entities.log.LogOperate) SysSite(com.publiccms.entities.sys.SysSite) CmsLottery(com.publiccms.entities.cms.CmsLottery) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 14 with SysSite

use of com.publiccms.entities.sys.SysSite in project PublicCMS-preview by sanluan.

the class CmsLotteryAdminController method delete.

/**
 * @param id
 * @param request
 * @param session
 * @param model
 * @return view name
 */
@RequestMapping("delete")
public String delete(Integer id, HttpServletRequest request, HttpSession session, ModelMap model) {
    SysSite site = getSite(request);
    CmsLottery entity = service.getEntity(id);
    if (null != entity) {
        if (ControllerUtils.verifyNotEquals("siteId", site.getId(), entity.getSiteId(), model)) {
            return TEMPLATE_ERROR;
        }
        service.delete(id);
        logOperateService.save(new LogOperate(site.getId(), getAdminFromSession(session).getId(), LogLoginService.CHANNEL_WEB_MANAGER, "delete.lottery", RequestUtils.getIpAddress(request), CommonUtils.getDate(), JsonUtils.getString(entity)));
    }
    return TEMPLATE_DONE;
}
Also used : LogOperate(com.publiccms.entities.log.LogOperate) SysSite(com.publiccms.entities.sys.SysSite) CmsLottery(com.publiccms.entities.cms.CmsLottery) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 15 with SysSite

use of com.publiccms.entities.sys.SysSite in project PublicCMS-preview by sanluan.

the class CmsPageAdminController method clearCache.

/**
 * @param path
 * @param request
 * @param session
 * @param model
 * @return view name
 */
@RequestMapping("clearCache")
public String clearCache(String path, HttpServletRequest request, HttpSession session, ModelMap model) {
    if (CommonUtils.notEmpty(path)) {
        SysSite site = getSite(request);
        templateCacheComponent.deleteCachedFile(SiteComponent.getFullFileName(site, path));
        logOperateService.save(new LogOperate(site.getId(), getAdminFromSession(session).getId(), LogLoginService.CHANNEL_WEB_MANAGER, "clear.pageCache", RequestUtils.getIpAddress(request), CommonUtils.getDate(), path));
    }
    return TEMPLATE_DONE;
}
Also used : LogOperate(com.publiccms.entities.log.LogOperate) SysSite(com.publiccms.entities.sys.SysSite) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

SysSite (com.publiccms.entities.sys.SysSite)175 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)135 LogOperate (com.publiccms.entities.log.LogOperate)117 IOException (java.io.IOException)33 SysUser (com.publiccms.entities.sys.SysUser)21 LinkedHashMap (java.util.LinkedHashMap)19 TemplateException (freemarker.template.TemplateException)15 File (java.io.File)14 CmsContent (com.publiccms.entities.cms.CmsContent)12 CmsCategory (com.publiccms.entities.cms.CmsCategory)11 MultipartFile (org.springframework.web.multipart.MultipartFile)10 SysTask (com.publiccms.entities.sys.SysTask)9 HashMap (java.util.HashMap)8 LogUpload (com.publiccms.entities.log.LogUpload)7 SysDept (com.publiccms.entities.sys.SysDept)7 SysUserToken (com.publiccms.entities.sys.SysUserToken)7 CmsPlaceMetadata (com.publiccms.views.pojo.entities.CmsPlaceMetadata)7 CmsPageMetadata (com.publiccms.views.pojo.entities.CmsPageMetadata)6 CmsPlace (com.publiccms.entities.cms.CmsPlace)5 SysDomain (com.publiccms.entities.sys.SysDomain)5