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);
}
}
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;
}
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);
}
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);
}
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);
}
Aggregations