use of com.netsteadfast.greenstep.vo.PdcaItemVO in project bamboobsc by billchen198318.
the class PdcaReportExcelCommand method createPdcaItem.
private int createPdcaItem(XSSFWorkbook wb, XSSFSheet sh, int row, XSSFCellStyle cellNormalStyle, List<PdcaItemVO> items, PdcaAuditVO audit) throws Exception {
XSSFColor fnColor = new XSSFColor(SimpleUtils.getColorRGB4POIColor("#000000"));
XSSFColor bgLabelColor = new XSSFColor(SimpleUtils.getColorRGB4POIColor("#F2F2F2"));
XSSFCellStyle cellLabelStyle = wb.createCellStyle();
cellLabelStyle.setFillForegroundColor(bgLabelColor);
cellLabelStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
XSSFFont cellLabelFont = wb.createFont();
cellLabelFont.setBold(true);
cellLabelFont.setColor(fnColor);
cellLabelStyle.setFont(cellLabelFont);
cellLabelStyle.setBorderBottom(BorderStyle.THIN);
cellLabelStyle.setBorderTop(BorderStyle.THIN);
cellLabelStyle.setBorderRight(BorderStyle.THIN);
cellLabelStyle.setBorderLeft(BorderStyle.THIN);
cellLabelStyle.setVerticalAlignment(VerticalAlignment.CENTER);
cellLabelStyle.setAlignment(HorizontalAlignment.CENTER);
cellLabelStyle.setWrapText(true);
Map<String, String> pdcaTypeMap = PdcaType.getDataMap(false);
for (PdcaItemVO item : items) {
Row labelRow = sh.createRow(row);
Cell labelCell_6_1 = labelRow.createCell(0);
labelCell_6_1.setCellValue(pdcaTypeMap.get(item.getType()));
labelCell_6_1.setCellStyle(cellLabelStyle);
Cell labelCell_6_2 = labelRow.createCell(1);
labelCell_6_2.setCellValue(item.getTitle() + (!StringUtils.isBlank(item.getDescription()) ? "\n\n" + item.getDescription() : ""));
labelCell_6_2.setCellStyle(cellNormalStyle);
Cell labelCell_6_3 = labelRow.createCell(2);
labelCell_6_3.setCellValue(item.getEmployeeAppendNames());
labelCell_6_3.setCellStyle(cellNormalStyle);
Cell labelCell_6_4 = labelRow.createCell(3);
labelCell_6_4.setCellValue(item.getStartDateDisplayValue() + " ~ " + item.getEndDateDisplayValue());
labelCell_6_4.setCellStyle(cellNormalStyle);
Cell labelCell_6_5 = labelRow.createCell(4);
labelCell_6_5.setCellValue((audit != null ? audit.getEmpId() : " "));
labelCell_6_5.setCellStyle(cellNormalStyle);
Cell labelCell_6_6 = labelRow.createCell(5);
labelCell_6_6.setCellValue((audit != null ? audit.getConfirmDateDisplayValue() : " "));
labelCell_6_6.setCellStyle(cellNormalStyle);
row++;
}
return row;
}
use of com.netsteadfast.greenstep.vo.PdcaItemVO in project bamboobsc by billchen198318.
the class LoadPdcaDataCommand method loadPdcaItems.
// 7. item detail
private void loadPdcaItems(PdcaVO pdca) throws ServiceException, Exception {
pdca.setItemPlan(new ArrayList<PdcaItemVO>());
pdca.setItemDo(new ArrayList<PdcaItemVO>());
pdca.setItemCheck(new ArrayList<PdcaItemVO>());
pdca.setItemAction(new ArrayList<PdcaItemVO>());
Map<String, Object> paramMap = new HashMap<String, Object>();
paramMap.put("pdcaOid", pdca.getOid());
List<BbPdcaItem> pdcaItems = this.pdcaItemService.findListByParams(paramMap);
for (BbPdcaItem pdcaItem : pdcaItems) {
PdcaItemVO item = new PdcaItemVO();
this.pdcaItemService.doMapper(pdcaItem, item, IPdcaItemService.MAPPER_ID_PO2VO);
// item owner
List<String> ownerNames = this.employeeService.findForAppendNames(this.employeeService.findForAppendEmployeeOidsByPdcaItemOwner(item.getPdcaOid(), item.getOid()));
item.setEmployeeAppendNames(StringUtils.join(ownerNames.toArray(), Constants.ID_DELIMITER) + Constants.ID_DELIMITER);
// item documents file
paramMap.put("itemOid", item.getOid());
List<PdcaItemDocVO> itemDocs = this.pdcaItemDocService.findListVOByParams(paramMap);
if (itemDocs != null && itemDocs.size() > 0) {
item.getDocs().addAll(itemDocs);
}
for (int i = 0; item.getDocs() != null && i < item.getDocs().size(); i++) {
PdcaItemDocVO doc = item.getDocs().get(i);
doc.setShowName(UploadSupportUtils.findUploadNoByteContent(doc.getUploadOid()).getShowName());
}
if (PdcaType.PLAN.equals(item.getType())) {
pdca.getItemPlan().add(item);
} else if (PdcaType.DO.equals(item.getType())) {
pdca.getItemDo().add(item);
} else if (PdcaType.CHECK.equals(item.getType())) {
pdca.getItemCheck().add(item);
} else {
pdca.getItemAction().add(item);
}
}
}
use of com.netsteadfast.greenstep.vo.PdcaItemVO in project bamboobsc by billchen198318.
the class PdcaLogicServiceImpl method createItems.
private void createItems(PdcaVO pdca, List<PdcaItemVO> items) throws ServiceException, Exception {
for (PdcaItemVO itemObj : items) {
itemObj.setPdcaOid(pdca.getOid());
this.setStringValueMaxLength(itemObj, "description", MAX_DESCRIPTION_LENGTH);
this.replaceSplit2Blank(itemObj, "startDate", "/");
this.replaceSplit2Blank(itemObj, "endDate", "/");
DefaultResult<PdcaItemVO> result = this.pdcaItemService.saveObject(itemObj);
if (result.getValue() == null) {
throw new ServiceException(result.getSystemMessage().getValue());
}
PdcaItemVO item = result.getValue();
item.setEmployeeOids(itemObj.getEmployeeOids());
item.setUploadOids(itemObj.getUploadOids());
this.createItemOwner(item);
this.createItemDocuments(item);
}
}
use of com.netsteadfast.greenstep.vo.PdcaItemVO 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.PdcaItemVO in project bamboobsc by billchen198318.
the class PdcaManagementAction method loadPdcaItemsData.
private void loadPdcaItemsData() throws ServiceException, Exception {
Map<String, Object> paramMap = new HashMap<String, Object>();
paramMap.put("pdcaOid", pdca.getOid());
this.pdcaItems = this.pdcaItemService.findListVOByParams(paramMap);
for (PdcaItemVO item : this.pdcaItems) {
List<String> appendEmplOidsPdcaItemOwner = this.employeeService.findForAppendEmployeeOidsByPdcaItemOwner(item.getPdcaOid(), item.getOid());
List<String> appendEmplNamesPdcaItemOwner = this.employeeService.findForAppendNames(appendEmplOidsPdcaItemOwner);
item.setEmployeeAppendOids(this.joinAppend2String(appendEmplOidsPdcaItemOwner));
item.setEmployeeAppendNames(this.joinAppend2String(appendEmplNamesPdcaItemOwner));
paramMap.put("itemOid", item.getOid());
List<PdcaItemDocVO> itemDocs = this.pdcaItemDocService.findListVOByParams(paramMap);
for (int i = 0; itemDocs != null && i < itemDocs.size(); i++) {
PdcaItemDocVO itemDoc = itemDocs.get(i);
itemDoc.setShowName("unknown-" + itemDoc.getUploadOid());
DefaultResult<SysUploadVO> upResult = this.sysUploadService.findForNoByteContent(itemDoc.getUploadOid());
if (upResult.getValue() != null) {
itemDoc.setShowName(upResult.getValue().getShowName());
}
item.getDocs().add(itemDoc);
}
}
}
Aggregations