Search in sources :

Example 71 with SysSite

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;
}
Also used : LogOperate(com.publiccms.entities.log.LogOperate) SysAppClient(com.publiccms.entities.sys.SysAppClient) SysSite(com.publiccms.entities.sys.SysSite) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 72 with SysSite

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());
            }
        }
    }
}
Also used : SysTask(com.publiccms.entities.sys.SysTask) List(java.util.List) SysSite(com.publiccms.entities.sys.SysSite)

Example 73 with SysSite

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;
    }
}
Also used : LogOperate(com.publiccms.entities.log.LogOperate) CmsPlace(com.publiccms.entities.cms.CmsPlace) SysUser(com.publiccms.entities.sys.SysUser) CmsPlaceMetadata(com.publiccms.views.pojo.entities.CmsPlaceMetadata) SysSite(com.publiccms.entities.sys.SysSite) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 74 with SysSite

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();
    }
}
Also used : CmsPlaceStatistics(com.publiccms.views.pojo.entities.CmsPlaceStatistics) SysSite(com.publiccms.entities.sys.SysSite) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 75 with SysSite

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());
    }
}
Also used : CmsPlaceStatistics(com.publiccms.views.pojo.entities.CmsPlaceStatistics) 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