use of com.netsteadfast.greenstep.vo.PdcaMeasureFreqVO in project bamboobsc by billchen198318.
the class PdcaLogicServiceImpl method cloneNewProject.
private void cloneNewProject(PdcaVO parentPdca) throws ServiceException, Exception {
// 1. PDCA main
PdcaVO pdca = new PdcaVO();
this.pdcaService.copyProperties(parentPdca, pdca);
pdca.setOid(null);
pdca.setConfirmDate(null);
pdca.setConfirmEmpId(null);
pdca.setConfirmFlag(YesNo.NO);
pdca.setParentOid(parentPdca.getOid());
String lastTitle = "-(New)";
if ((pdca.getTitle() + lastTitle).length() <= 100) {
pdca.setTitle(pdca.getTitle() + lastTitle);
} else {
pdca.setTitle(pdca.getTitle().substring(pdca.getTitle().length() - lastTitle.length(), 100) + lastTitle);
}
// 2. PDCA measure-freq
PdcaMeasureFreqVO measureFreq = new PdcaMeasureFreqVO();
measureFreq.setPdcaOid(parentPdca.getOid());
DefaultResult<PdcaMeasureFreqVO> mfResult = this.pdcaMeasureFreqService.findByUK(measureFreq);
if (mfResult.getValue() == null) {
throw new ServiceException(mfResult.getSystemMessage().getValue());
}
measureFreq = mfResult.getValue();
measureFreq.setOid(null);
measureFreq.setPdcaOid(null);
Map<String, Object> paramMap = new HashMap<String, Object>();
paramMap.put("pdcaOid", parentPdca.getOid());
// 3. organizationOids
List<String> organizationOids = new ArrayList<String>();
List<BbPdcaOrga> pdcaOrgaList = this.pdcaOrgaService.findListByParams(paramMap);
for (BbPdcaOrga pdcaOrga : pdcaOrgaList) {
OrganizationVO organization = this.findOrganizationDataByUK(pdcaOrga.getOrgId());
organizationOids.add(organization.getOid());
}
// 4. employeeOids
List<String> employeeOids = new ArrayList<String>();
List<BbPdcaOwner> pdcaOwnerList = this.pdcaOwnerService.findListByParams(paramMap);
for (BbPdcaOwner pdcaOwner : pdcaOwnerList) {
EmployeeVO employee = this.findEmployeeDataByEmpId(pdcaOwner.getEmpId());
employeeOids.add(employee.getOid());
}
// 5. kpiOids
List<String> kpiOids = new ArrayList<String>();
List<BbPdcaKpis> pdcaKpisList = this.pdcaKpisService.findListByParams(paramMap);
for (BbPdcaKpis pdcaKpi : pdcaKpisList) {
KpiVO kpi = new KpiVO();
kpi.setId(pdcaKpi.getKpiId());
DefaultResult<KpiVO> kResult = this.kpiService.findByUK(kpi);
if (kResult.getValue() == null) {
throw new ServiceException(kResult.getSystemMessage().getValue());
}
kpi = kResult.getValue();
kpiOids.add(kpi.getOid());
}
// 6. attachment
List<String> attachment = new ArrayList<String>();
List<BbPdcaDoc> pdcaDocList = this.pdcaDocService.findListByParams(paramMap);
for (BbPdcaDoc pdcaDoc : pdcaDocList) {
DefaultResult<SysUploadVO> upResult = this.getSysUploadService().findForNoByteContent(pdcaDoc.getUploadOid());
if (upResult.getValue() == null) {
throw new ServiceException(upResult.getSystemMessage().getValue());
}
SysUploadVO upload = upResult.getValue();
File oldFile = UploadSupportUtils.getRealFile(pdcaDoc.getUploadOid());
attachment.add(UploadSupportUtils.create(Constants.getSystem(), UploadTypes.IS_TEMP, true, oldFile, upload.getShowName()));
}
// 7. items - PdcaItemVO
List<PdcaItemVO> items = new ArrayList<PdcaItemVO>();
List<BbPdcaItem> pdcaItems = this.pdcaItemService.findListByParams(paramMap);
for (BbPdcaItem pdcaItem : pdcaItems) {
PdcaItemVO itemObj = new PdcaItemVO();
this.pdcaItemService.doMapper(pdcaItem, itemObj, IPdcaItemService.MAPPER_ID_PO2VO);
items.add(itemObj);
}
// 8. item - owner
for (PdcaItemVO itemObj : items) {
itemObj.setEmployeeOids(new ArrayList<String>());
paramMap.put("itemOid", itemObj.getOid());
List<BbPdcaItemOwner> itemOwnerList = this.pdcaItemOwnerService.findListByParams(paramMap);
for (BbPdcaItemOwner itemOwner : itemOwnerList) {
itemObj.getEmployeeOids().add(this.findEmployeeDataByEmpId(itemOwner.getEmpId()).getOid());
}
}
// 9. item - attachment
for (PdcaItemVO itemObj : items) {
itemObj.setUploadOids(new ArrayList<String>());
paramMap.put("itemOid", itemObj.getOid());
List<BbPdcaItemDoc> itemDocList = this.pdcaItemDocService.findListByParams(paramMap);
for (BbPdcaItemDoc itemDoc : itemDocList) {
DefaultResult<SysUploadVO> upResult = this.getSysUploadService().findForNoByteContent(itemDoc.getUploadOid());
if (upResult.getValue() == null) {
throw new ServiceException(upResult.getSystemMessage().getValue());
}
SysUploadVO upload = upResult.getValue();
File oldFile = UploadSupportUtils.getRealFile(itemDoc.getUploadOid());
itemObj.getUploadOids().add(UploadSupportUtils.create(Constants.getSystem(), UploadTypes.IS_TEMP, true, oldFile, upload.getShowName()));
}
}
// clear item old OID, PDCA_OID
for (PdcaItemVO itemObj : items) {
itemObj.setOid(null);
itemObj.setPdcaOid(null);
}
this.create(pdca, measureFreq, organizationOids, employeeOids, kpiOids, attachment, items);
}
use of com.netsteadfast.greenstep.vo.PdcaMeasureFreqVO in project bamboobsc by billchen198318.
the class PdcaReportContentQueryAction method getBscReportContent.
private List<ChainResultObj> getBscReportContent(String chainId) throws ControllerException, AuthorityException, ServiceException, Exception {
List<ChainResultObj> results = new ArrayList<ChainResultObj>();
String pdcaOid = this.getFields().get("pdcaOid");
// 先找出 bb_pdca_kpis 的最上層 vision
List<String> visionOids = this.visionService.findForOidByPdcaOid(pdcaOid);
for (String visionOid : visionOids) {
PdcaMeasureFreqVO measureFreq = new PdcaMeasureFreqVO();
measureFreq.setPdcaOid(pdcaOid);
DefaultResult<PdcaMeasureFreqVO> mfResult = this.pdcaMeasureFreqService.findByUK(measureFreq);
if (mfResult.getValue() == null) {
throw new ServiceException(mfResult.getSystemMessage().getValue());
}
measureFreq = mfResult.getValue();
Context context = this.getBscReportChainContext(pdcaOid, visionOid, measureFreq);
SimpleChain chain = new SimpleChain();
ChainResultObj resultObj = chain.getResultFromResource(chainId, context);
results.add(resultObj);
}
return results;
}
use of com.netsteadfast.greenstep.vo.PdcaMeasureFreqVO in project bamboobsc by billchen198318.
the class PdcaSaveOrUpdateAction method saveOrUpdate.
private void saveOrUpdate(String type) throws ControllerException, AuthorityException, ServiceException, Exception {
this.checkFields();
List<PdcaItemVO> pdcaItems = this.getItemsData();
this.checkItems(pdcaItems);
PdcaVO pdca = new PdcaVO();
this.transformFields2ValueObject(pdca, new String[] { "title", "startDate", "endDate", "description" });
this.getFields().remove("measureFreq_date1");
this.getFields().remove("measureFreq_date2");
this.getFields().remove("measureFreq_dateType");
String frequency = this.getFields().get("measureFreq_frequency");
if (BscMeasureDataFrequency.FREQUENCY_DAY.equals(frequency) || BscMeasureDataFrequency.FREQUENCY_WEEK.equals(frequency) || BscMeasureDataFrequency.FREQUENCY_MONTH.equals(frequency)) {
this.getFields().put("measureFreq_date1", this.getFields().get("measureFreq_startDate"));
this.getFields().put("measureFreq_date2", this.getFields().get("measureFreq_endDate"));
} else {
this.getFields().put("measureFreq_date1", this.getFields().get("measureFreq_startYearDate"));
this.getFields().put("measureFreq_date2", this.getFields().get("measureFreq_endYearDate"));
}
String dataFor = this.getFields().get("measureFreq_dataFor");
this.getFields().put("measureFreq_dateType", "3");
if ("organization".equals(dataFor)) {
this.getFields().put("measureFreq_dateType", "1");
}
if ("employee".equals(dataFor)) {
this.getFields().put("measureFreq_dateType", "2");
}
PdcaMeasureFreqVO measureFreq = new PdcaMeasureFreqVO();
this.transformFields2ValueObject(measureFreq, new String[] { "freq", "dataType", "organizationOid", "employeeOid", "startDate", "endDate" }, new String[] { "measureFreq_frequency", "measureFreq_dateType", "measureFreq_measureDataOrganizationOid", "measureFreq_measureDataEmployeeOid", "measureFreq_date1", "measureFreq_date2" });
DefaultResult<PdcaVO> result = null;
if ("save".equals(type)) {
result = this.pdcaLogicService.create(pdca, measureFreq, this.transformAppendIds2List(this.getFields().get("orgaOids")), this.transformAppendIds2List(this.getFields().get("emplOids")), this.transformAppendIds2List(this.getFields().get("kpiOids")), this.getUploadOids(), pdcaItems);
} else {
pdca.setOid(this.getFields().get("oid"));
result = this.pdcaLogicService.update(pdca, measureFreq, this.transformAppendIds2List(this.getFields().get("orgaOids")), this.transformAppendIds2List(this.getFields().get("emplOids")), this.transformAppendIds2List(this.getFields().get("kpiOids")), this.getUploadOids(), pdcaItems);
}
this.message = result.getSystemMessage().getValue();
if (result.getValue() != null) {
this.success = IS_YES;
}
}
use of com.netsteadfast.greenstep.vo.PdcaMeasureFreqVO 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