Search in sources :

Example 1 with SysVO

use of com.netsteadfast.greenstep.vo.SysVO in project bamboobsc by billchen198318.

the class ClearTempDataJobImpl method executeInternal.

@Override
protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
    if (ContextLoader.getCurrentWebApplicationContext() == null) {
        log.warn("ApplicationContext no completed, AppContext.getApplicationContext() == null");
        return;
    }
    log.info("begin....");
    try {
        /**
			 * document reference:
			 * com.netsteadfast.greenstep.support.CleanTempUploadForContextInitAndDestroy.java
			 */
        this.loginForBackgroundProgram();
        List<SysVO> systems = ApplicationSiteUtils.getSystems();
        if (systems == null || systems.size() < 1) {
            return;
        }
        for (SysVO sys : systems) {
            UploadSupportUtils.cleanTempUpload(sys.getSysId());
        }
        /**
			 * document reference:
			 * com.netsteadfast.greenstep.bsc.support.CleanJasperReportTempDataForContextInitAndDestroy.java
			 * 
			 */
        NamedParameterJdbcTemplate namedParameterJdbcTemplate = (NamedParameterJdbcTemplate) AppContext.getBean("namedParameterJdbcTemplate");
        Map<String, Object> paramMap = new HashMap<String, Object>();
        namedParameterJdbcTemplate.update("delete from bb_swot_report_mst", paramMap);
        namedParameterJdbcTemplate.update("delete from bb_swot_report_dtl", paramMap);
    } catch (ServiceException e) {
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        try {
            this.logoutForBackgroundProgram();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    log.info("end....");
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) NamedParameterJdbcTemplate(org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate) HashMap(java.util.HashMap) SysVO(com.netsteadfast.greenstep.vo.SysVO) JobExecutionException(org.quartz.JobExecutionException) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException)

Example 2 with SysVO

use of com.netsteadfast.greenstep.vo.SysVO in project bamboobsc by billchen198318.

the class ApplicationSiteUtils method configureHost.

@SuppressWarnings("unchecked")
public static void configureHost(String sysId, String logConfFileFullPath) {
    String logValue = FSUtils.readStr(logConfFileFullPath).trim();
    if (!StringUtils.isBlank(logValue) && UPDATE_HOST_ONLY_FIRST_ONE.equals(Constants.getApplicationSiteHostUpdateMode())) {
        // has before start log file, and UPDATE_HOST_ONLY_FIRST_ONE mode
        FSUtils.writeStr2(logConfFileFullPath, UPDATE_HOST_ONLY_FIRST_ONE);
        return;
    }
    ISysService<SysVO, TbSys, String> sysService = (ISysService<SysVO, TbSys, String>) AppContext.getBean("core.service.SysService");
    SysVO sys = new SysVO();
    sys.setSysId(sysId);
    try {
        DefaultResult<SysVO> result = sysService.findByUK(sys);
        if (result.getValue() == null) {
            System.out.println(result.getSystemMessage().getValue());
            return;
        }
        sys = result.getValue();
        // 2016-06-29 rem
        /*
			String port = "";
			String tmp[] = sys.getHost().split(":");
			if ( tmp!=null && tmp.length==2 ) {
				port = tmp[1];
			}
			*/
        // 2016-06-29 add
        String port = String.valueOf(HostUtils.getHttpPort());
        String hostAddress = HostUtils.getHostAddress();
        sys.setHost(hostAddress);
        if (!StringUtils.isBlank(port)) {
            sys.setHost(hostAddress + ":" + port);
        }
        sysService.updateObject(sys);
        if (UPDATE_HOST_ALWAYS.equals(Constants.getApplicationSiteHostUpdateMode())) {
            FSUtils.writeStr2(logConfFileFullPath, UPDATE_HOST_ALWAYS);
        } else {
            FSUtils.writeStr2(logConfFileFullPath, UPDATE_HOST_ONLY_FIRST_ONE);
        }
    } catch (ServiceException e) {
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : TbSys(com.netsteadfast.greenstep.po.hbm.TbSys) ISysService(com.netsteadfast.greenstep.service.ISysService) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysVO(com.netsteadfast.greenstep.vo.SysVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) JsonMappingException(com.fasterxml.jackson.databind.JsonMappingException) JsonParseException(com.fasterxml.jackson.core.JsonParseException)

Example 3 with SysVO

use of com.netsteadfast.greenstep.vo.SysVO in project bamboobsc by billchen198318.

the class ApplicationSiteUtils method getSystemsCheckCrossSiteWithTestConnection.

@SuppressWarnings("unchecked")
public static List<SysVO> getSystemsCheckCrossSiteWithTestConnection(HttpServletRequest request) {
    ISysService<SysVO, TbSys, String> sysService = (ISysService<SysVO, TbSys, String>) AppContext.getBean("core.service.SysService");
    List<SysVO> sysList = null;
    try {
        sysList = sysService.findListVOByParams(null);
        for (SysVO sys : sysList) {
            if (checkCrossSite(sys.getHost().toLowerCase(), request)) {
                sys.setCrossSiteFlag(YesNo.YES);
            } else {
                sys.setCrossSiteFlag(YesNo.NO);
            }
            if (checkTestConnection(sys.getHost(), sys.getContextPath(), request)) {
                sys.setTestFlag(YesNo.YES);
            } else {
                sys.setTestFlag(YesNo.NO);
            }
        }
    } catch (ServiceException e) {
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return sysList;
}
Also used : TbSys(com.netsteadfast.greenstep.po.hbm.TbSys) ISysService(com.netsteadfast.greenstep.service.ISysService) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysVO(com.netsteadfast.greenstep.vo.SysVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) JsonMappingException(com.fasterxml.jackson.databind.JsonMappingException) JsonParseException(com.fasterxml.jackson.core.JsonParseException)

Example 4 with SysVO

use of com.netsteadfast.greenstep.vo.SysVO in project bamboobsc by billchen198318.

the class SystemProgramLogicServiceImpl method create.

/**
	 * 產生 TB_SYS_PROG 資料
	 * 
	 * @param sys
	 * @param iconOid
	 * @return
	 * @throws ServiceException
	 * @throws Exception
	 */
@ServiceMethodAuthority(type = { ServiceMethodType.INSERT })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<SysProgVO> create(SysProgVO sysProg, String sysOid, String iconOid) throws ServiceException, Exception {
    SysVO sys = new SysVO();
    sys.setOid(sysOid);
    DefaultResult<SysVO> sysResult = this.sysService.findObjectByOid(sys);
    if (sysResult.getValue() == null) {
        throw new ServiceException(sysResult.getSystemMessage().getValue());
    }
    sys = sysResult.getValue();
    SysIconVO sysIcon = new SysIconVO();
    sysIcon.setOid(iconOid);
    DefaultResult<SysIconVO> iconResult = this.sysIconService.findObjectByOid(sysIcon);
    if (iconResult.getValue() == null) {
        throw new ServiceException(iconResult.getSystemMessage().getValue());
    }
    sysIcon = iconResult.getValue();
    sysProg.setProgSystem(sys.getSysId());
    sysProg.setIcon(sysIcon.getIconId());
    return this.sysProgService.saveObject(sysProg);
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysVO(com.netsteadfast.greenstep.vo.SysVO) SysIconVO(com.netsteadfast.greenstep.vo.SysIconVO) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 5 with SysVO

use of com.netsteadfast.greenstep.vo.SysVO in project bamboobsc by billchen198318.

the class SystemWebServiceConfigLogicServiceImpl method update.

@ServiceMethodAuthority(type = { ServiceMethodType.UPDATE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<SysWsConfigVO> update(SysWsConfigVO config, String systemOid) throws ServiceException, Exception {
    if (config == null || super.isBlank(config.getOid()) || super.isBlank(systemOid)) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    DefaultResult<SysWsConfigVO> oldResult = this.sysWsConfigService.findObjectByOid(config);
    if (oldResult.getValue() == null) {
        throw new ServiceException(oldResult.getSystemMessage().getValue());
    }
    SysVO sys = new SysVO();
    sys.setOid(systemOid);
    DefaultResult<SysVO> sResult = this.sysService.findObjectByOid(sys);
    if (sResult.getValue() == null) {
        throw new ServiceException(sResult.getSystemMessage().getValue());
    }
    sys = sResult.getValue();
    config.setWsId(oldResult.getValue().getWsId());
    config.setSystem(sys.getSysId());
    if (super.defaultString(config.getDescription()).length() > MAX_DESCRIPTION_LENGTH) {
        config.setDescription(config.getDescription().substring(0, MAX_DESCRIPTION_LENGTH));
    }
    return this.sysWsConfigService.updateObject(config);
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysWsConfigVO(com.netsteadfast.greenstep.vo.SysWsConfigVO) SysVO(com.netsteadfast.greenstep.vo.SysVO) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

SysVO (com.netsteadfast.greenstep.vo.SysVO)35 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)30 ServiceMethodAuthority (com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)13 Transactional (org.springframework.transaction.annotation.Transactional)13 JsonParseException (com.fasterxml.jackson.core.JsonParseException)7 JsonMappingException (com.fasterxml.jackson.databind.JsonMappingException)7 TbSys (com.netsteadfast.greenstep.po.hbm.TbSys)6 ISysService (com.netsteadfast.greenstep.service.ISysService)6 SysExpressionVO (com.netsteadfast.greenstep.vo.SysExpressionVO)3 HashMap (java.util.HashMap)3 SysCtxBeanVO (com.netsteadfast.greenstep.vo.SysCtxBeanVO)2 SysExprJobVO (com.netsteadfast.greenstep.vo.SysExprJobVO)2 SysIconVO (com.netsteadfast.greenstep.vo.SysIconVO)2 SysMsgNoticeConfigVO (com.netsteadfast.greenstep.vo.SysMsgNoticeConfigVO)2 SysTwitterVO (com.netsteadfast.greenstep.vo.SysTwitterVO)2 SysWsConfigVO (com.netsteadfast.greenstep.vo.SysWsConfigVO)2 TbSysIcon (com.netsteadfast.greenstep.po.hbm.TbSysIcon)1 SysBeanHelpVO (com.netsteadfast.greenstep.vo.SysBeanHelpVO)1 SysProgVO (com.netsteadfast.greenstep.vo.SysProgVO)1 Map (java.util.Map)1