use of com.netsteadfast.greenstep.vo.SysUploadVO in project bamboobsc by billchen198318.
the class CommonUploadFileAction method upload.
private void upload() throws ControllerException, AuthorityException, ServiceException, IOException, Exception {
if (this.getUpload() == null) {
throw new ControllerException(SysMessageUtil.get(GreenStepSysMsgConstants.UPLOAD_FILE_NO_SELECT));
}
if (StringUtils.isBlank(this.system) || StringUtils.isBlank(this.type) || !UploadTypes.check(this.type)) {
throw new ControllerException("System and type is required!");
}
String fileName = this.copy2UploadDir();
SysUploadVO uploadObj = new SysUploadVO();
uploadObj.setSystem(this.system);
uploadObj.setSubDir(UploadSupportUtils.getSubDir());
uploadObj.setType(this.type);
uploadObj.setFileName(fileName);
uploadObj.setShowName(this.uploadFileName);
if (uploadObj.getShowName().length() > 255) {
uploadObj.setShowName(uploadObj.getShowName().substring(0, 255));
}
uploadObj.setIsFile(this.isFile);
if (!YesNo.YES.equals(this.isFile)) {
uploadObj.setContent(FileUtils.readFileToByteArray(this.getUpload()));
}
DefaultResult<SysUploadVO> result = this.sysUploadService.saveObject(uploadObj);
this.message = result.getSystemMessage().getValue();
if (result.getValue() == null) {
return;
}
this.message = this.message + "upload file success!";
this.success = IS_YES;
this.uploadOid = result.getValue().getOid();
}
use of com.netsteadfast.greenstep.vo.SysUploadVO in project bamboobsc by billchen198318.
the class CommonUploadFileAction method loadNames.
private void loadNames() throws ControllerException, AuthorityException, ServiceException, IOException, Exception {
if (StringUtils.isBlank(this.uploadOid)) {
throw new ControllerException("Upload oid is required!");
}
DefaultResult<SysUploadVO> result = this.sysUploadService.findForNoByteContent(this.uploadOid);
if (result.getValue() == null) {
this.message = result.getSystemMessage().getValue();
return;
}
SysUploadVO uploadData = result.getValue();
this.fileName = super.defaultString(uploadData.getFileName()).trim();
this.showName = super.defaultString(uploadData.getShowName()).trim();
//this.showName = StringEscapeUtils.escapeEcmaScript( this.showName );
//this.showName = StringEscapeUtils.escapeHtml4( this.showName );
this.showName = this.showName.replaceAll("'", "’").replaceAll("\"", """).replaceAll("<", "<").replaceAll(">", ">");
this.success = IS_YES;
this.message = "load success!";
if (YesNo.YES.equals(uploadData.getIsFile())) {
@SuppressWarnings("unused") File dataFile = UploadSupportUtils.getRealFile(uploadData.getOid());
this.fileExist = YesNo.YES;
dataFile = null;
} else {
this.fileExist = YesNo.YES;
}
}
use of com.netsteadfast.greenstep.vo.SysUploadVO in project bamboobsc by billchen198318.
the class PdcaLogicServiceImpl method createItemDocuments.
private void createItemDocuments(PdcaItemVO pdcaItem) throws ServiceException, Exception {
if (pdcaItem.getUploadOids() == null || pdcaItem.getUploadOids().size() < 1) {
return;
}
for (String oid : pdcaItem.getUploadOids()) {
SysUploadVO upload = this.findUploadDataForNoByteContent(oid);
if (!(upload.getSystem().equals(Constants.getSystem()) && upload.getType().equals(UploadTypes.IS_TEMP))) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_ERRORS));
}
PdcaItemDocVO itemDoc = new PdcaItemDocVO();
itemDoc.setPdcaOid(pdcaItem.getPdcaOid());
itemDoc.setItemOid(pdcaItem.getOid());
itemDoc.setUploadOid(upload.getOid());
itemDoc.setViewMode(UploadSupportUtils.getViewMode(upload.getShowName()));
DefaultResult<PdcaItemDocVO> result = this.pdcaItemDocService.saveObject(itemDoc);
if (result.getValue() == null) {
throw new ServiceException(result.getSystemMessage().getValue());
}
UploadSupportUtils.updateType(oid, UploadTypes.IS_PDCA_DOCUMENT);
}
}
use of com.netsteadfast.greenstep.vo.SysUploadVO in project bamboobsc by billchen198318.
the class KpiManagementAction method loadKpiData.
private void loadKpiData() throws ServiceException, Exception {
this.transformFields2ValueObject(this.kpi, new String[] { "oid" });
DefaultResult<KpiVO> result = this.kpiService.findObjectByOid(this.kpi);
if (result.getValue() == null) {
throw new ServiceException(result.getSystemMessage().getValue());
}
this.kpi = result.getValue();
this.handlerSelectValueForEdit();
this.handlerKpiOrgaAndEmplForEdit();
Map<String, Object> paramMap = new HashMap<String, Object>();
paramMap.put("kpiId", this.kpi.getId());
this.kpiAttac = this.kpiAttacService.findListVOByParams(paramMap);
for (int i = 0; this.kpiAttac != null && i < this.kpiAttac.size(); i++) {
KpiAttacVO attac = this.kpiAttac.get(i);
attac.setShowName("unknown-" + attac.getUploadOid());
DefaultResult<SysUploadVO> upResult = this.sysUploadService.findForNoByteContent(attac.getUploadOid());
if (upResult.getValue() != null) {
attac.setShowName(upResult.getValue().getShowName());
}
}
}
use of com.netsteadfast.greenstep.vo.SysUploadVO in project bamboobsc by billchen198318.
the class PdcaManagementAction method loadPdcaData.
private void loadPdcaData() throws ServiceException, Exception {
// ------------------------------------------------------------------------------
// PDCA main
this.loadPdcaDataSimple("oid");
// ------------------------------------------------------------------------------
// ------------------------------------------------------------------------------
// measure frequency
this.measureFreq.setPdcaOid(pdca.getOid());
DefaultResult<PdcaMeasureFreqVO> measureFreqResult = this.pdcaMeasureFreqService.findByUK(measureFreq);
if (measureFreqResult.getValue() == null) {
throw new ServiceException(measureFreqResult.getSystemMessage().getValue());
}
this.measureFreq = measureFreqResult.getValue();
this.measureFreq.setEmployeeOid("");
if (!BscConstants.MEASURE_DATA_EMPLOYEE_FULL.equals(this.measureFreq.getEmpId()) && !StringUtils.isBlank(this.measureFreq.getEmpId())) {
EmployeeVO employee = BscBaseLogicServiceCommonSupport.findEmployeeDataByEmpId(this.employeeService, this.measureFreq.getEmpId());
this.measureFreq.setEmployeeOid(employee.getOid());
}
this.measureFreq.setOrganizationOid("");
if (!BscConstants.MEASURE_DATA_ORGANIZATION_FULL.equals(this.measureFreq.getOrgId()) && !StringUtils.isBlank(this.measureFreq.getOrgId())) {
OrganizationVO organization = new OrganizationVO();
organization.setOrgId(this.measureFreq.getOrgId());
DefaultResult<OrganizationVO> orgResult = this.organizationService.findByUK(organization);
if (orgResult.getValue() != null) {
this.measureFreq.setOrganizationOid(orgResult.getValue().getOid());
}
}
this.getFields().put("measureFreqStartDate", "");
this.getFields().put("measureFreqEndDate", "");
this.getFields().put("measureFreqStartYearDate", this.measureFreq.getStartDateTextBoxValue());
this.getFields().put("measureFreqEndYearDate", this.measureFreq.getEndDateTextBoxValue());
if (BscMeasureDataFrequency.FREQUENCY_DAY.equals(measureFreq.getFreq()) || BscMeasureDataFrequency.FREQUENCY_WEEK.equals(measureFreq.getFreq()) || BscMeasureDataFrequency.FREQUENCY_MONTH.equals(measureFreq.getFreq())) {
this.getFields().put("measureFreqStartDate", this.measureFreq.getStartDateTextBoxValue());
this.getFields().put("measureFreqEndDate", this.measureFreq.getEndDateTextBoxValue());
this.getFields().put("measureFreqStartYearDate", "");
this.getFields().put("measureFreqEndYearDate", "");
}
//1-DEPT,2-EMP,3-Both
this.getFields().put("measureFreqDataFor", "all");
if ("1".equals(this.measureFreq.getDataType())) {
this.getFields().put("measureFreqDataFor", "organization");
}
if ("2".equals(this.measureFreq.getDataType())) {
this.getFields().put("measureFreqDataFor", "employee");
}
// ------------------------------------------------------------------------------
// ------------------------------------------------------------------------------
// PDCA organization, Owner, KPIs, DOC
List<String> appendOrgaOidsPdcaOrga = this.organizationService.findForAppendOrganizationOidsByPdcaOrga(this.pdca.getOid());
List<String> appendOrgaNamesPdcaOrga = this.organizationService.findForAppendNames(appendOrgaOidsPdcaOrga);
this.getFields().put("appendOrgaOidsForPdcaOrga", this.joinAppend2String(appendOrgaOidsPdcaOrga));
this.getFields().put("appendOrgaNamesForPdcaOrga", this.joinAppend2String(appendOrgaNamesPdcaOrga));
List<String> appendEmplOidsPdcaOwner = this.employeeService.findForAppendEmployeeOidsByPdcaOwner(pdca.getOid());
List<String> appendEmplNamesPdcaOwner = this.employeeService.findForAppendNames(appendEmplOidsPdcaOwner);
this.getFields().put("appendOwnerOidsForPdcaOwner", this.joinAppend2String(appendEmplOidsPdcaOwner));
this.getFields().put("appendOwnerNamesForPdcaOwner", this.joinAppend2String(appendEmplNamesPdcaOwner));
List<String> appendKpiOidsPdcaKpis = this.kpiService.findForAppendOidsByPdcaKpis(pdca.getOid());
List<String> appendKpiNamesPdcaKpis = this.kpiService.findForAppendNames(appendKpiOidsPdcaKpis);
this.getFields().put("appendKpiOidsForPdcaKpis", this.joinAppend2String(appendKpiOidsPdcaKpis));
this.getFields().put("appendKpiNamesForPdcaKpis", this.joinAppend2String(appendKpiNamesPdcaKpis));
Map<String, Object> paramMap = new HashMap<String, Object>();
paramMap.put("pdcaOid", pdca.getOid());
this.pdcaDocs = this.pdcaDocService.findListVOByParams(paramMap);
for (int i = 0; this.pdcaDocs != null && i < this.pdcaDocs.size(); i++) {
PdcaDocVO pdcaDoc = this.pdcaDocs.get(i);
pdcaDoc.setShowName("unknown-" + pdcaDoc.getUploadOid());
DefaultResult<SysUploadVO> upResult = this.sysUploadService.findForNoByteContent(pdcaDoc.getUploadOid());
if (upResult.getValue() != null) {
pdcaDoc.setShowName(upResult.getValue().getShowName());
}
}
// ------------------------------------------------------------------------------
// ------------------------------------------------------------------------------
// PDCA Items
this.loadPdcaItemsData();
// ------------------------------------------------------------------------------
}
Aggregations