use of com.publiccms.entities.sys.SysSite in project PublicCMS-preview by sanluan.
the class SysAppClientAdminController method enable.
/**
* @param id
* @param request
* @param session
* @param model
* @return view name
*/
@RequestMapping(value = "enable", method = RequestMethod.POST)
public String enable(Long id, HttpServletRequest request, HttpSession session, ModelMap model) {
SysAppClient entity = service.getEntity(id);
if (null != entity.getId()) {
SysSite site = getSite(request);
if (ControllerUtils.verifyNotEquals("siteId", site.getId(), entity.getId().getSiteId(), model)) {
return TEMPLATE_ERROR;
}
service.updateStatus(id, false);
logOperateService.save(new LogOperate(site.getId(), getAdminFromSession(session).getId(), LogLoginService.CHANNEL_WEB_MANAGER, "enable.appclient", RequestUtils.getIpAddress(request), CommonUtils.getDate(), JsonUtils.getString(entity)));
}
return TEMPLATE_DONE;
}
use of com.publiccms.entities.sys.SysSite in project PublicCMS-preview by sanluan.
the class ScheduledTask method init.
/**
* @param startDate
*/
public void init(Date startDate) {
if (null != scheduler) {
@SuppressWarnings("unchecked") List<SysTask> sysTaskList = (List<SysTask>) sysTaskService.getPage(null, null, startDate, null, null).getList();
for (SysTask sysTask : sysTaskList) {
SysSite site = siteService.getEntity(sysTask.getSiteId());
if (TASK_STATUS_ERROR == sysTask.getStatus()) {
sysTaskService.updateStatus(sysTask.getId(), TASK_STATUS_READY);
}
create(site, sysTask.getId(), sysTask.getCronExpression());
if (TASK_STATUS_PAUSE == sysTask.getStatus()) {
pause(site, sysTask.getId());
}
}
}
}
use of com.publiccms.entities.sys.SysSite in project PublicCMS-preview by sanluan.
the class PlaceController method check.
/**
* @param id
* @param returnUrl
* @param request
* @param session
* @param response
* @param model
* @return view name
*/
@RequestMapping("check")
public String check(Long id, String returnUrl, HttpServletRequest request, HttpSession session, HttpServletResponse response, ModelMap model) {
SysSite site = getSite(request);
if (CommonUtils.empty(returnUrl)) {
returnUrl = site.getDynamicPath();
}
CmsPlace entity = service.getEntity(id);
SysUser user = getUserFromSession(session);
String filePath = siteComponent.getWebTemplateFilePath(site, TemplateComponent.INCLUDE_DIRECTORY + entity.getPath());
CmsPlaceMetadata metadata = metadataComponent.getPlaceMetadata(filePath);
if (ControllerUtils.verifyCustom("manage", null == entity || null == user || CommonUtils.empty(metadata.getAdminIds()) || !ArrayUtils.contains(metadata.getAdminIds(), user.getId()), model) || ControllerUtils.verifyNotEquals("siteId", site.getId(), entity.getSiteId(), model)) {
return REDIRECT + returnUrl;
} else {
service.check(id);
logOperateService.save(new LogOperate(site.getId(), user.getId(), LogLoginService.CHANNEL_WEB, "check.place", RequestUtils.getIpAddress(request), CommonUtils.getDate(), id.toString()));
return REDIRECT + returnUrl;
}
}
use of com.publiccms.entities.sys.SysSite in project PublicCMS-preview by sanluan.
the class PlaceController method click.
/**
* @param id
* @param request
* @param response
* @return view name
*/
@RequestMapping("click")
public String click(Long id, HttpServletRequest request, HttpServletResponse response) {
SysSite site = getSite(request);
CmsPlaceStatistics placeStatistics = statisticsComponent.placeClicks(id);
if (null != placeStatistics && null != placeStatistics.getEntity() && site.getId() == placeStatistics.getEntity().getSiteId() && CommonUtils.notEmpty(placeStatistics.getEntity().getUrl())) {
return REDIRECT + placeStatistics.getEntity().getUrl();
} else {
return REDIRECT + site.getDynamicPath();
}
}
use of com.publiccms.entities.sys.SysSite in project PublicCMS-preview by sanluan.
the class PlaceController method redirect.
/**
* @param id
* @param request
* @param response
*/
@RequestMapping("redirect")
public void redirect(Long id, HttpServletRequest request, HttpServletResponse response) {
SysSite site = getSite(request);
CmsPlaceStatistics placeStatistics = statisticsComponent.placeClicks(id);
if (null != placeStatistics && null != placeStatistics.getEntity() && site.getId() == placeStatistics.getEntity().getSiteId() && CommonUtils.notEmpty(placeStatistics.getEntity().getUrl())) {
ControllerUtils.redirectPermanently(response, placeStatistics.getEntity().getUrl());
} else {
ControllerUtils.redirectPermanently(response, site.getDynamicPath());
}
}
Aggregations