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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations