Search in sources :

Example 6 with SysExprJobVO

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

the class SystemExpressionJobUtils method getExpressionJobForManualMode.

public static ExpressionJobObj getExpressionJobForManualMode(String expressionJobOid) throws ServiceException, Exception {
    if (StringUtils.isBlank(expressionJobOid)) {
        throw new Exception("error, expressionJobId is blank!");
    }
    @SuppressWarnings("unchecked") ISysExprJobService<SysExprJobVO, TbSysExprJob, String> sysExprJobService = (ISysExprJobService<SysExprJobVO, TbSysExprJob, String>) AppContext.getBean("core.service.SysExprJobService");
    @SuppressWarnings("unchecked") ISysExpressionService<SysExpressionVO, TbSysExpression, String> sysExpressionService = (ISysExpressionService<SysExpressionVO, TbSysExpression, String>) AppContext.getBean("core.service.SysExpressionService");
    SysExprJobVO exprJob = new SysExprJobVO();
    exprJob.setOid(expressionJobOid);
    DefaultResult<SysExprJobVO> exprJobResult = sysExprJobService.findObjectByOid(exprJob);
    if (exprJobResult.getValue() == null) {
        throw new ServiceException(exprJobResult.getSystemMessage().getValue());
    }
    exprJob = exprJobResult.getValue();
    SysExpressionVO expr = new SysExpressionVO();
    expr.setExprId(exprJob.getExprId());
    DefaultResult<SysExpressionVO> exprResult = sysExpressionService.findByUK(expr);
    if (exprResult.getValue() == null) {
        throw new ServiceException(exprResult.getSystemMessage().getValue());
    }
    expr = exprResult.getValue();
    ExpressionJobObj jobObj = new ExpressionJobObj();
    jobObj.setSysExprJob(exprJob);
    jobObj.setSysExprJobLog(new SysExprJobLogVO());
    jobObj.setSysExpression(expr);
    return jobObj;
}
Also used : SysExprJobVO(com.netsteadfast.greenstep.vo.SysExprJobVO) IOException(java.io.IOException) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysExprJobLogVO(com.netsteadfast.greenstep.vo.SysExprJobLogVO) ISysExpressionService(com.netsteadfast.greenstep.service.ISysExpressionService) TbSysExprJob(com.netsteadfast.greenstep.po.hbm.TbSysExprJob) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) TbSysExpression(com.netsteadfast.greenstep.po.hbm.TbSysExpression) ISysExprJobService(com.netsteadfast.greenstep.service.ISysExprJobService) ExpressionJobObj(com.netsteadfast.greenstep.model.ExpressionJobObj) SysExpressionVO(com.netsteadfast.greenstep.vo.SysExpressionVO)

Example 7 with SysExprJobVO

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

the class SystemExpressionJobUtils method initRunStatusFlag.

public static void initRunStatusFlag(String system) throws ServiceException, Exception {
    @SuppressWarnings("unchecked") ISysExprJobService<SysExprJobVO, TbSysExprJob, String> sysExprJobService = (ISysExprJobService<SysExprJobVO, TbSysExprJob, String>) AppContext.getBean("core.service.SysExprJobService");
    Map<String, Object> paramMap = new HashMap<String, Object>();
    paramMap.put("system", system);
    paramMap.put("runStatus", ExpressionJobConstants.RUNSTATUS_PROCESS_NOW);
    List<TbSysExprJob> exprJobList = sysExprJobService.findListByParams(paramMap);
    if (exprJobList == null || exprJobList.size() < 1) {
        return;
    }
    Date udate = new Date();
    String uuserid = "system";
    for (TbSysExprJob exprJob : exprJobList) {
        log.warn("ExpressionJob current RUN_STATUS is 'R' update to 'Y' , Id: " + exprJob.getId() + " , Name: " + exprJob.getName());
        exprJob.setRunStatus(ExpressionJobConstants.RUNSTATUS_SUCCESS);
        exprJob.setUdate(udate);
        exprJob.setUuserid(uuserid);
        sysExprJobService.update(exprJob);
    }
}
Also used : TbSysExprJob(com.netsteadfast.greenstep.po.hbm.TbSysExprJob) SysExprJobVO(com.netsteadfast.greenstep.vo.SysExprJobVO) HashMap(java.util.HashMap) ISysExprJobService(com.netsteadfast.greenstep.service.ISysExprJobService) Date(java.util.Date)

Example 8 with SysExprJobVO

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

the class SystemExpressionJobManagementAction method loadSysExprJobData.

private void loadSysExprJobData() throws ServiceException, Exception {
    this.transformFields2ValueObject(this.sysExprJob, new String[] { "oid" });
    DefaultResult<SysExprJobVO> result = this.sysExprJobService.findObjectByOid(this.sysExprJob);
    if (result.getValue() == null) {
        throw new ServiceException(result.getSystemMessage().getValue());
    }
    this.sysExprJob = result.getValue();
    SysVO sys = new SysVO();
    sys.setSysId(this.sysExprJob.getSystem());
    DefaultResult<SysVO> sysResult = this.sysService.findByUK(sys);
    if (sysResult.getValue() == null) {
        throw new ServiceException(sysResult.getSystemMessage().getValue());
    }
    sys = sysResult.getValue();
    this.getFields().put("systemOid", sys.getOid());
    SysExpressionVO expression = new SysExpressionVO();
    expression.setExprId(this.sysExprJob.getExprId());
    DefaultResult<SysExpressionVO> expressionResult = this.sysExpressionService.findByUK(expression);
    if (expressionResult.getValue() == null) {
        throw new ServiceException(expressionResult.getSystemMessage().getValue());
    }
    expression = expressionResult.getValue();
    this.getFields().put("expressionOid", expression.getOid());
}
Also used : SysExprJobVO(com.netsteadfast.greenstep.vo.SysExprJobVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysVO(com.netsteadfast.greenstep.vo.SysVO) SysExpressionVO(com.netsteadfast.greenstep.vo.SysExpressionVO)

Example 9 with SysExprJobVO

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

the class SystemExpressionJobSaveOrUpdateAction method update.

private void update() throws ControllerException, AuthorityException, ServiceException, Exception {
    this.checkFields();
    SysExprJobVO sysExprJob = new SysExprJobVO();
    this.transformFields2ValueObject(sysExprJob, new String[] { "oid", "id", "name", "description", "runDayOfWeek", "runHour", "runMinute", "contactMode", "contact" });
    sysExprJob.setActive(YesNo.NO);
    if ("true".equals(this.getFields().get("active"))) {
        sysExprJob.setActive(YesNo.YES);
    }
    sysExprJob.setCheckFault(YesNo.NO);
    if ("true".equals(this.getFields().get("checkFault"))) {
        sysExprJob.setCheckFault(YesNo.YES);
    }
    DefaultResult<SysExprJobVO> result = this.systemExpressionLogicService.updateJob(sysExprJob, this.getFields().get("systemOid"), this.getFields().get("expressionOid"));
    this.message = result.getSystemMessage().getValue();
    if (result.getValue() != null) {
        this.success = IS_YES;
    }
}
Also used : SysExprJobVO(com.netsteadfast.greenstep.vo.SysExprJobVO)

Example 10 with SysExprJobVO

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

the class SystemExpressionJobSaveOrUpdateAction method save.

private void save() throws ControllerException, AuthorityException, ServiceException, Exception {
    this.checkFields();
    SysExprJobVO sysExprJob = new SysExprJobVO();
    this.transformFields2ValueObject(sysExprJob, new String[] { "id", "name", "description", "runDayOfWeek", "runHour", "runMinute", "contactMode", "contact" });
    sysExprJob.setActive(YesNo.NO);
    if ("true".equals(this.getFields().get("active"))) {
        sysExprJob.setActive(YesNo.YES);
    }
    sysExprJob.setCheckFault(YesNo.NO);
    if ("true".equals(this.getFields().get("checkFault"))) {
        sysExprJob.setCheckFault(YesNo.YES);
    }
    DefaultResult<SysExprJobVO> result = this.systemExpressionLogicService.createJob(sysExprJob, this.getFields().get("systemOid"), this.getFields().get("expressionOid"));
    this.message = result.getSystemMessage().getValue();
    if (result.getValue() != null) {
        this.success = IS_YES;
    }
}
Also used : SysExprJobVO(com.netsteadfast.greenstep.vo.SysExprJobVO)

Aggregations

SysExprJobVO (com.netsteadfast.greenstep.vo.SysExprJobVO)10 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)5 TbSysExprJob (com.netsteadfast.greenstep.po.hbm.TbSysExprJob)4 ISysExprJobService (com.netsteadfast.greenstep.service.ISysExprJobService)4 SysExprJobLogVO (com.netsteadfast.greenstep.vo.SysExprJobLogVO)4 SysExpressionVO (com.netsteadfast.greenstep.vo.SysExpressionVO)4 HashMap (java.util.HashMap)3 ExpressionJobObj (com.netsteadfast.greenstep.model.ExpressionJobObj)2 TbSysExpression (com.netsteadfast.greenstep.po.hbm.TbSysExpression)2 ISysExpressionService (com.netsteadfast.greenstep.service.ISysExpressionService)2 SysVO (com.netsteadfast.greenstep.vo.SysVO)2 Date (java.util.Date)2 ServiceMethodAuthority (com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)1 TbSysExprJobLog (com.netsteadfast.greenstep.po.hbm.TbSysExprJobLog)1 ISysExprJobLogService (com.netsteadfast.greenstep.service.ISysExprJobLogService)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 Transactional (org.springframework.transaction.annotation.Transactional)1