Search in sources :

Example 1 with SysMsgNoticeVO

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

the class SystemMessageNoticeLogicServiceImpl method update.

@ServiceMethodAuthority(type = { ServiceMethodType.UPDATE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<SysMsgNoticeVO> update(SysMsgNoticeVO notice, String accountOid) throws ServiceException, Exception {
    if (notice == null || super.isBlank(notice.getOid())) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    DefaultResult<SysMsgNoticeVO> oldResult = this.sysMsgNoticeService.findObjectByOid(notice);
    if (oldResult.getValue() == null) {
        throw new ServiceException(oldResult.getSystemMessage().getValue());
    }
    notice.setNoticeId(oldResult.getValue().getNoticeId());
    notice.setMsgId(oldResult.getValue().getMsgId());
    notice.setToAccount("*");
    if (!super.isNoSelectId(accountOid) && !"*".equals(accountOid)) {
        AccountVO account = new AccountVO();
        account.setOid(accountOid);
        DefaultResult<AccountVO> aResult = this.accountService.findObjectByOid(account);
        if (aResult.getValue() == null) {
            throw new ServiceException(aResult.getSystemMessage().getValue());
        }
        account = aResult.getValue();
        notice.setToAccount(account.getAccount());
    }
    if (super.defaultString(notice.getMessage()).length() > MAX_MESSAGE_LENGTH) {
        notice.setMessage(notice.getMessage().substring(0, MAX_MESSAGE_LENGTH));
    }
    return this.sysMsgNoticeService.updateObject(notice);
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) AccountVO(com.netsteadfast.greenstep.vo.AccountVO) SysMsgNoticeVO(com.netsteadfast.greenstep.vo.SysMsgNoticeVO) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 2 with SysMsgNoticeVO

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

the class SystemMessageNoticeSaveOrUpdateAction method delete.

private void delete() throws ControllerException, AuthorityException, ServiceException, Exception {
    SysMsgNoticeVO notice = new SysMsgNoticeVO();
    this.transformFields2ValueObject(notice, new String[] { "oid" });
    DefaultResult<Boolean> result = this.systemMessageNoticeLogicService.delete(notice);
    this.message = result.getSystemMessage().getValue();
    if (result.getValue() != null && result.getValue()) {
        this.success = IS_YES;
    }
}
Also used : SysMsgNoticeVO(com.netsteadfast.greenstep.vo.SysMsgNoticeVO)

Example 3 with SysMsgNoticeVO

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

the class SystemMessageNoticeSaveOrUpdateAction method update.

private void update() throws ControllerException, AuthorityException, ServiceException, Exception {
    this.checkFields();
    SysMsgNoticeVO notice = new SysMsgNoticeVO();
    this.getFields().put("date", this.getNoticeDate());
    this.getFields().put("time", this.getNoticeTime());
    this.transformFields2ValueObject(notice, new String[] { "oid", "noticeId", "title", "message", "date", "time" });
    notice.setIsGlobal(YesNo.NO);
    if ("true".equals(this.getFields().get("isGlobal"))) {
        notice.setIsGlobal(YesNo.YES);
    }
    DefaultResult<SysMsgNoticeVO> result = this.systemMessageNoticeLogicService.update(notice, this.getFields().get("toAccountOid"));
    this.message = result.getSystemMessage().getValue();
    if (result.getValue() != null) {
        this.success = IS_YES;
    }
}
Also used : SysMsgNoticeVO(com.netsteadfast.greenstep.vo.SysMsgNoticeVO)

Example 4 with SysMsgNoticeVO

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

the class SystemMessageNoticeManagementAction method loadSysMsgNoticeData.

private void loadSysMsgNoticeData() throws ServiceException, Exception {
    this.transformFields2ValueObject(this.sysMsgNotice, new String[] { "oid" });
    DefaultResult<SysMsgNoticeVO> result = this.sysMsgNoticeService.findObjectByOid(this.sysMsgNotice);
    if (result.getValue() == null) {
        throw new ServiceException(result.getSystemMessage().getValue());
    }
    this.sysMsgNotice = result.getValue();
    String[] dateTmp = sysMsgNotice.getDate().split(Constants.DATETIME_DELIMITER);
    this.date1 = dateTmp[0].substring(0, 4) + "-" + dateTmp[0].substring(4, 6) + "-" + dateTmp[0].substring(6, 8);
    this.date2 = dateTmp[1].substring(0, 4) + "-" + dateTmp[1].substring(4, 6) + "-" + dateTmp[1].substring(6, 8);
    String[] time = sysMsgNotice.getTime().split(Constants.DATETIME_DELIMITER);
    this.startHour = time[0].substring(0, 2);
    this.startMinutes = time[0].substring(2, 4);
    this.endHour = time[1].substring(0, 2);
    this.endMinutes = time[1].substring(2, 4);
    SysMsgNoticeConfigVO config = new SysMsgNoticeConfigVO();
    config.setMsgId(sysMsgNotice.getMsgId());
    DefaultResult<SysMsgNoticeConfigVO> configResult = this.sysMsgNoticeConfigService.findByUK(config);
    if (configResult.getValue() == null) {
        throw new ServiceException(configResult.getSystemMessage().getValue());
    }
    config = configResult.getValue();
    this.selectConfigOid = config.getOid();
    AccountVO account = new AccountVO();
    if (!"*".equals(sysMsgNotice.getToAccount())) {
        account.setAccount(sysMsgNotice.getToAccount());
        DefaultResult<AccountVO> aResult = this.accountService.findByUK(account);
        if (aResult.getValue() == null) {
            throw new ServiceException(aResult.getSystemMessage().getValue());
        }
        account = aResult.getValue();
        this.selectAccountOid = account.getOid();
    }
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysMsgNoticeConfigVO(com.netsteadfast.greenstep.vo.SysMsgNoticeConfigVO) AccountVO(com.netsteadfast.greenstep.vo.AccountVO) SysMsgNoticeVO(com.netsteadfast.greenstep.vo.SysMsgNoticeVO)

Example 5 with SysMsgNoticeVO

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

the class SystemMessageNoticeSaveOrUpdateAction method save.

private void save() throws ControllerException, AuthorityException, ServiceException, Exception {
    this.checkFields();
    SysMsgNoticeVO notice = new SysMsgNoticeVO();
    this.getFields().put("date", this.getNoticeDate());
    this.getFields().put("time", this.getNoticeTime());
    this.transformFields2ValueObject(notice, new String[] { "noticeId", "title", "message", "date", "time" });
    notice.setIsGlobal(YesNo.NO);
    if ("true".equals(this.getFields().get("isGlobal"))) {
        notice.setIsGlobal(YesNo.YES);
    }
    DefaultResult<SysMsgNoticeVO> result = this.systemMessageNoticeLogicService.create(notice, this.getFields().get("msgOid"), this.getFields().get("toAccountOid"));
    this.message = result.getSystemMessage().getValue();
    if (result.getValue() != null) {
        this.success = IS_YES;
    }
}
Also used : SysMsgNoticeVO(com.netsteadfast.greenstep.vo.SysMsgNoticeVO)

Aggregations

SysMsgNoticeVO (com.netsteadfast.greenstep.vo.SysMsgNoticeVO)5 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)2 AccountVO (com.netsteadfast.greenstep.vo.AccountVO)2 ServiceMethodAuthority (com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)1 SysMsgNoticeConfigVO (com.netsteadfast.greenstep.vo.SysMsgNoticeConfigVO)1 Transactional (org.springframework.transaction.annotation.Transactional)1