Search in sources :

Example 71 with LogOperate

use of com.publiccms.entities.log.LogOperate in project PublicCMS-preview by sanluan.

the class SysDeptAdminController method save.

/**
 * @param entity
 * @param categoryIds
 * @param pages
 * @param request
 * @param session
 * @param model
 * @return view name
 */
@RequestMapping("save")
public String save(SysDept entity, Integer[] categoryIds, String[] pages, HttpServletRequest request, HttpSession session, ModelMap model) {
    SysSite site = getSite(request);
    if (null != entity.getId()) {
        SysDept 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.dept", RequestUtils.getIpAddress(request), CommonUtils.getDate(), JsonUtils.getString(entity)));
        }
        sysDeptCategoryService.updateDeptCategorys(entity.getId(), categoryIds);
        sysDeptPageService.updateDeptPages(entity.getId(), pages);
    } else {
        entity.setSiteId(site.getId());
        service.save(entity);
        logOperateService.save(new LogOperate(site.getId(), getAdminFromSession(session).getId(), LogLoginService.CHANNEL_WEB_MANAGER, "save.dept", RequestUtils.getIpAddress(request), CommonUtils.getDate(), JsonUtils.getString(entity)));
        if (CommonUtils.notEmpty(categoryIds)) {
            List<SysDeptCategory> list = new ArrayList<>();
            for (int categoryId : categoryIds) {
                list.add(new SysDeptCategory(new SysDeptCategoryId(entity.getId(), categoryId)));
            }
            sysDeptCategoryService.save(list);
        }
        if (CommonUtils.notEmpty(pages)) {
            List<SysDeptPage> list = new ArrayList<>();
            for (String page : pages) {
                list.add(new SysDeptPage(new SysDeptPageId(entity.getId(), page)));
            }
            sysDeptPageService.save(list);
        }
    }
    return TEMPLATE_DONE;
}
Also used : LogOperate(com.publiccms.entities.log.LogOperate) SysDept(com.publiccms.entities.sys.SysDept) SysDeptPage(com.publiccms.entities.sys.SysDeptPage) ArrayList(java.util.ArrayList) SysDeptCategoryId(com.publiccms.entities.sys.SysDeptCategoryId) StringUtils.arrayToCommaDelimitedString(org.springframework.util.StringUtils.arrayToCommaDelimitedString) SysDeptPageId(com.publiccms.entities.sys.SysDeptPageId) SysSite(com.publiccms.entities.sys.SysSite) SysDeptCategory(com.publiccms.entities.sys.SysDeptCategory) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 72 with LogOperate

use of com.publiccms.entities.log.LogOperate in project PublicCMS-preview by sanluan.

the class SysDomainAdminController method delete.

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

Example 73 with LogOperate

use of com.publiccms.entities.log.LogOperate in project PublicCMS-preview by sanluan.

the class SysDomainAdminController method saveConfig.

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

Example 74 with LogOperate

use of com.publiccms.entities.log.LogOperate in project PublicCMS-preview by sanluan.

the class SysModuleAdminController method delete.

/**
 * @param id
 * @param request
 * @param session
 * @param model
 * @return view name
 */
@SuppressWarnings("unchecked")
@RequestMapping("delete")
public String delete(Integer id, HttpServletRequest request, HttpSession session, ModelMap model) {
    SysSite site = getSite(request);
    if (ControllerUtils.verifyCustom("noright", !siteComponent.isMaster(site.getId()), model)) {
        return TEMPLATE_ERROR;
    }
    SysModule entity = service.getEntity(id);
    if (null != entity) {
        service.delete(id);
        List<SysRoleModule> roleModuleList = (List<SysRoleModule>) roleModuleService.getPage(null, id, null, null).getList();
        roleModuleService.deleteByModuleId(id);
        dealRoleAuthorized(roleModuleList);
        logOperateService.save(new LogOperate(getSite(request).getId(), getAdminFromSession(session).getId(), LogLoginService.CHANNEL_WEB_MANAGER, "delete.module", RequestUtils.getIpAddress(request), CommonUtils.getDate(), JsonUtils.getString(entity)));
    }
    return TEMPLATE_DONE;
}
Also used : SysModule(com.publiccms.entities.sys.SysModule) LogOperate(com.publiccms.entities.log.LogOperate) SysRoleModule(com.publiccms.entities.sys.SysRoleModule) List(java.util.List) SysSite(com.publiccms.entities.sys.SysSite) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 75 with LogOperate

use of com.publiccms.entities.log.LogOperate in project PublicCMS-preview by sanluan.

the class SysModuleAdminController method save.

/**
 * @param entity
 * @param request
 * @param session
 * @param model
 * @return view name
 */
@RequestMapping("save")
public String save(SysModule entity, HttpServletRequest request, HttpSession session, ModelMap model) {
    SysSite site = getSite(request);
    if (ControllerUtils.verifyCustom("noright", !siteComponent.isMaster(site.getId()), model)) {
        return TEMPLATE_ERROR;
    }
    if (null != entity.getId()) {
        entity = service.update(entity.getId(), entity, ignoreProperties);
        if (null != entity) {
            @SuppressWarnings("unchecked") List<SysRoleModule> roleModuleList = (List<SysRoleModule>) roleModuleService.getPage(null, entity.getId(), null, null).getList();
            dealRoleAuthorized(roleModuleList);
            logOperateService.save(new LogOperate(site.getId(), getAdminFromSession(session).getId(), LogLoginService.CHANNEL_WEB_MANAGER, "update.module", RequestUtils.getIpAddress(request), CommonUtils.getDate(), JsonUtils.getString(entity)));
        }
    } else {
        service.save(entity);
        logOperateService.save(new LogOperate(site.getId(), getAdminFromSession(session).getId(), LogLoginService.CHANNEL_WEB_MANAGER, "save.module", RequestUtils.getIpAddress(request), CommonUtils.getDate(), JsonUtils.getString(entity)));
    }
    return TEMPLATE_DONE;
}
Also used : LogOperate(com.publiccms.entities.log.LogOperate) SysRoleModule(com.publiccms.entities.sys.SysRoleModule) List(java.util.List) SysSite(com.publiccms.entities.sys.SysSite) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

LogOperate (com.publiccms.entities.log.LogOperate)117 SysSite (com.publiccms.entities.sys.SysSite)117 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)115 SysUser (com.publiccms.entities.sys.SysUser)15 IOException (java.io.IOException)13 CmsContent (com.publiccms.entities.cms.CmsContent)9 File (java.io.File)9 MultipartFile (org.springframework.web.multipart.MultipartFile)8 CmsCategory (com.publiccms.entities.cms.CmsCategory)7 TemplateException (freemarker.template.TemplateException)7 SysDept (com.publiccms.entities.sys.SysDept)6 SysTask (com.publiccms.entities.sys.SysTask)6 CmsPageMetadata (com.publiccms.views.pojo.entities.CmsPageMetadata)5 CmsPlaceMetadata (com.publiccms.views.pojo.entities.CmsPlaceMetadata)5 CmsPlace (com.publiccms.entities.cms.CmsPlace)4 CmsWord (com.publiccms.entities.cms.CmsWord)4 SysDomain (com.publiccms.entities.sys.SysDomain)4 SysRoleUser (com.publiccms.entities.sys.SysRoleUser)4 CmsModel (com.publiccms.views.pojo.entities.CmsModel)4 CmsCategoryType (com.publiccms.entities.cms.CmsCategoryType)3