Search in sources :

Example 91 with ServiceMethodAuthority

use of com.netsteadfast.greenstep.base.model.ServiceMethodAuthority in project bamboobsc by billchen198318.

the class PdcaLogicServiceImpl method confirmTask.

@ServiceMethodAuthority(type = { ServiceMethodType.SELECT, ServiceMethodType.UPDATE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public void confirmTask(String pdcaOid, String taskId, String confirm, String reason, String newChild) throws ServiceException, Exception {
    if (super.isBlank(pdcaOid) || super.isBlank(taskId) || super.isBlank(confirm)) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    PdcaVO pdca = this.findPdca(pdcaOid);
    String newDate = SimpleUtils.getStrYMD("");
    String type = "E";
    List<BusinessProcessManagementTaskVO> tasks = this.queryTaskByVariablePdcaOid(pdca.getOid());
    if (tasks != null && tasks.size() > 0) {
        type = tasks.get(0).getTask().getName().substring(0, 1);
    }
    Map<String, Object> flowDataMap = this.getProcessFlowParam(pdcaOid, type, newDate, super.getAccountId(), confirm, reason, newChild);
    this.completeTask(taskId, flowDataMap);
    /*
		if (YesNo.YES.equals(confirm)) { // 只有 confirm == Y 的, 才要寫入 bb_pdca_audit , 報表顯示時要用到
			this.createAudit(pdca, flowDataMap);
		}
		*/
    // 改為都要產生 bb_pdca_audit
    this.createAudit(pdca, flowDataMap);
    // 重新查是否還有task
    tasks = this.queryTaskByVariablePdcaOid(pdca.getOid());
    if (null != tasks && tasks.size() > 0) {
        return;
    }
    if (YesNo.YES.equals(confirm)) {
        pdca.setConfirmDate(newDate);
        pdca.setConfirmEmpId(this.findEmployeeDataByAccountId(super.getAccountId()).getEmpId());
        pdca.setConfirmFlag(YesNo.YES);
        this.pdcaService.updateObject(pdca);
    }
    if (YesNo.YES.equals(confirm) && YesNo.YES.equals(newChild)) {
        this.cloneNewProject(pdca);
    }
}
Also used : BusinessProcessManagementTaskVO(com.netsteadfast.greenstep.vo.BusinessProcessManagementTaskVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) PdcaVO(com.netsteadfast.greenstep.vo.PdcaVO) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 92 with ServiceMethodAuthority

use of com.netsteadfast.greenstep.base.model.ServiceMethodAuthority in project bamboobsc by billchen198318.

the class PdcaLogicServiceImpl method findProjectRelated.

@ServiceMethodAuthority(type = { ServiceMethodType.SELECT })
@Override
public PdcaProjectRelatedVO findProjectRelated(String pdcaOid) throws ServiceException, Exception {
    if (super.isBlank(pdcaOid)) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    PdcaVO pdca = this.findPdca(pdcaOid);
    PdcaProjectRelatedVO projectRelated = new PdcaProjectRelatedVO();
    projectRelated.setProject(pdca);
    this.findProjectRelatedParent(projectRelated, pdca);
    this.findProjectRelatedChild(projectRelated, pdca);
    return projectRelated;
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) PdcaProjectRelatedVO(com.netsteadfast.greenstep.bsc.vo.PdcaProjectRelatedVO) PdcaVO(com.netsteadfast.greenstep.vo.PdcaVO) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)

Example 93 with ServiceMethodAuthority

use of com.netsteadfast.greenstep.base.model.ServiceMethodAuthority in project bamboobsc by billchen198318.

the class DataQueryLogicServiceImpl method update.

@ServiceMethodAuthority(type = { ServiceMethodType.UPDATE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<DataQueryVO> update(String dataSourceConfOid, String dataQueryMapperOid, DataQueryVO dataQuery) throws ServiceException, Exception {
    if (super.isBlank(dataSourceConfOid) || super.isBlank(dataQueryMapperOid) || null == dataQuery || super.isBlank(dataQuery.getOid())) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    DataSourceConfVO conf = new DataSourceConfVO();
    conf.setOid(dataSourceConfOid);
    DefaultResult<DataSourceConfVO> confResult = dataSourceConfService.findObjectByOid(conf);
    if (confResult.getValue() == null) {
        throw new ServiceException(confResult.getSystemMessage().getValue());
    }
    conf = confResult.getValue();
    Map<String, Object> paramMap = new HashMap<String, Object>();
    paramMap.put("oid", dataQueryMapperOid);
    if (this.dataQueryMapperService.countByParams(paramMap) < 1) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.SEARCH_NO_DATA));
    }
    DefaultResult<DataQueryVO> oldResult = this.dataQueryService.findObjectByOid(dataQuery);
    if (oldResult.getValue() == null) {
        throw new ServiceException(oldResult.getSystemMessage().getValue());
    }
    if (oldResult.getValue().getName().equals(dataQuery.getName()) && !oldResult.getValue().getOid().equals(dataQuery.getOid())) {
        // 存在別筆資料但UK相同 , 所以不能 UPDATE
        throw new ServiceException("Please change another name!");
    }
    oldResult.getValue().setQueryExpression(null);
    // 先把BLOB 資料清掉
    this.dataQueryService.updateObject(oldResult.getValue());
    dataQuery.setConf(conf.getId());
    dataQuery.setMapperOid(dataQueryMapperOid);
    return this.dataQueryService.updateObject(dataQuery);
}
Also used : DataSourceConfVO(com.netsteadfast.greenstep.vo.DataSourceConfVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) HashMap(java.util.HashMap) DataQueryVO(com.netsteadfast.greenstep.vo.DataQueryVO) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 94 with ServiceMethodAuthority

use of com.netsteadfast.greenstep.base.model.ServiceMethodAuthority in project bamboobsc by billchen198318.

the class DataQueryLogicServiceImpl method create.

@ServiceMethodAuthority(type = { ServiceMethodType.INSERT })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<DataQueryVO> create(String dataSourceConfOid, String dataQueryMapperOid, DataQueryVO dataQuery) throws ServiceException, Exception {
    if (super.isNoSelectId(dataSourceConfOid) || super.isNoSelectId(dataQueryMapperOid) || null == dataQuery) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    DataSourceConfVO conf = new DataSourceConfVO();
    conf.setOid(dataSourceConfOid);
    DefaultResult<DataSourceConfVO> confResult = dataSourceConfService.findObjectByOid(conf);
    if (confResult.getValue() == null) {
        throw new ServiceException(confResult.getSystemMessage().getValue());
    }
    conf = confResult.getValue();
    Map<String, Object> paramMap = new HashMap<String, Object>();
    paramMap.put("oid", dataQueryMapperOid);
    if (this.dataQueryMapperService.countByParams(paramMap) < 1) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.SEARCH_NO_DATA));
    }
    dataQuery.setConf(conf.getId());
    dataQuery.setMapperOid(dataQueryMapperOid);
    return this.dataQueryService.saveObject(dataQuery);
}
Also used : DataSourceConfVO(com.netsteadfast.greenstep.vo.DataSourceConfVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) HashMap(java.util.HashMap) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 95 with ServiceMethodAuthority

use of com.netsteadfast.greenstep.base.model.ServiceMethodAuthority in project bamboobsc by billchen198318.

the class DataSourceLogicServiceImpl method createConf.

@ServiceMethodAuthority(type = { ServiceMethodType.INSERT })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<DataSourceConfVO> createConf(String driverOid, DataSourceConfVO dataSourceConf) throws ServiceException, Exception {
    if (super.isBlank(driverOid) || null == dataSourceConf) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    DataSourceDriverVO driver = new DataSourceDriverVO();
    driver.setOid(driverOid);
    DefaultResult<DataSourceDriverVO> dResult = this.dataSourceDriverService.findObjectByOid(driver);
    if (dResult.getValue() == null) {
        throw new ServiceException(dResult.getSystemMessage().getValue());
    }
    driver = dResult.getValue();
    dataSourceConf.setDriverId(driver.getId());
    if (super.defaultString(dataSourceConf.getJdbcUrl()).length() > MAX_JDBC_URL_LENGTH) {
        throw new ServiceException("jdbc-url Only allows " + String.valueOf(MAX_JDBC_URL_LENGTH) + " characters!");
    }
    if (null == dataSourceConf.getDescription()) {
        dataSourceConf.setDescription("");
    }
    this.setStringValueMaxLength(dataSourceConf, "description", MAX_DESCRIPTION_LENGTH);
    return this.dataSourceConfService.saveObject(dataSourceConf);
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) DataSourceDriverVO(com.netsteadfast.greenstep.vo.DataSourceDriverVO) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

ServiceMethodAuthority (com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)95 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)91 Transactional (org.springframework.transaction.annotation.Transactional)84 HashMap (java.util.HashMap)32 SystemMessage (com.netsteadfast.greenstep.base.model.SystemMessage)31 DefaultResult (com.netsteadfast.greenstep.base.model.DefaultResult)29 SysVO (com.netsteadfast.greenstep.vo.SysVO)13 LinkedHashMap (java.util.LinkedHashMap)13 Map (java.util.Map)12 AccountVO (com.netsteadfast.greenstep.vo.AccountVO)7 VisionVO (com.netsteadfast.greenstep.vo.VisionVO)7 BaseEntity (com.netsteadfast.greenstep.base.model.BaseEntity)6 EmployeeVO (com.netsteadfast.greenstep.vo.EmployeeVO)6 PerspectiveVO (com.netsteadfast.greenstep.vo.PerspectiveVO)6 IOException (java.io.IOException)6 BaseValueObj (com.netsteadfast.greenstep.base.model.BaseValueObj)5 RoleVO (com.netsteadfast.greenstep.vo.RoleVO)5 SysProgVO (com.netsteadfast.greenstep.vo.SysProgVO)5 UserRoleVO (com.netsteadfast.greenstep.vo.UserRoleVO)5 BbReportRoleView (com.netsteadfast.greenstep.po.hbm.BbReportRoleView)4