use of com.netsteadfast.greenstep.vo.OrganizationVO 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.OrganizationVO in project bamboobsc by billchen198318.
the class OrganizationSaveOrUpdateAction method delete.
private void delete() throws ControllerException, AuthorityException, ServiceException, Exception {
OrganizationVO organization = new OrganizationVO();
this.transformFields2ValueObject(organization, new String[] { "oid" });
DefaultResult<Boolean> result = this.organizationLogicService.delete(organization);
this.message = result.getSystemMessage().getValue();
if (result.getValue() != null && result.getValue()) {
this.success = IS_YES;
}
}
use of com.netsteadfast.greenstep.vo.OrganizationVO in project bamboobsc by billchen198318.
the class OrganizationReportExcelCommand method createHead.
private int createHead(XSSFWorkbook wb, XSSFSheet sh, int row, VisionVO vision, Context context) throws Exception {
String dateType = (String) context.get("dateType");
String year = (String) context.get("startYearDate");
String orgId = (String) context.get("orgId");
String departmentName = "";
String dateTypeName = "Year";
if ("1".equals(dateType)) {
dateTypeName = "In the first half";
}
if ("2".equals(dateType)) {
dateTypeName = "In the second half";
}
OrganizationVO organization = new OrganizationVO();
organization.setOrgId(orgId);
DefaultResult<OrganizationVO> result = this.organizationService.findByUK(organization);
if (result.getValue() != null) {
organization = result.getValue();
departmentName = organization.getName();
}
Row headRow = sh.createRow(row);
headRow.setHeight((short) 700);
XSSFColor bgColor = new XSSFColor(SimpleUtils.getColorRGB4POIColor("#F2F2F2"));
XSSFColor fnColor = new XSSFColor(SimpleUtils.getColorRGB4POIColor("#000000"));
XSSFCellStyle cellHeadStyle = wb.createCellStyle();
cellHeadStyle.setFillForegroundColor(bgColor);
cellHeadStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
XSSFFont cellHeadFont = wb.createFont();
cellHeadFont.setBold(true);
cellHeadFont.setColor(fnColor);
cellHeadStyle.setFont(cellHeadFont);
cellHeadStyle.setBorderBottom(BorderStyle.THIN);
cellHeadStyle.setBorderTop(BorderStyle.THIN);
cellHeadStyle.setBorderRight(BorderStyle.THIN);
cellHeadStyle.setBorderLeft(BorderStyle.THIN);
cellHeadStyle.setVerticalAlignment(VerticalAlignment.CENTER);
cellHeadStyle.setAlignment(HorizontalAlignment.CENTER);
cellHeadStyle.setWrapText(true);
int cols = 6;
for (int i = 0; i < cols; i++) {
sh.setColumnWidth(i, 6000);
Cell headCell1 = headRow.createCell(i);
headCell1.setCellValue("Personal Balance SourceCard");
headCell1.setCellStyle(cellHeadStyle);
}
sh.addMergedRegion(new CellRangeAddress(row, row, 0, cols - 1));
row++;
headRow = sh.createRow(row);
for (int i = 0; i < cols; i++) {
sh.setColumnWidth(i, 6000);
Cell headCell1 = headRow.createCell(i);
headCell1.setCellValue(vision.getTitle());
headCell1.setCellStyle(cellHeadStyle);
}
sh.addMergedRegion(new CellRangeAddress(row, row, 0, cols - 1));
row++;
headRow = sh.createRow(row);
Cell titleCell1 = headRow.createCell(0);
titleCell1.setCellValue("Department");
titleCell1.setCellStyle(cellHeadStyle);
Cell titleCell2 = headRow.createCell(1);
titleCell2.setCellValue(departmentName);
titleCell2.setCellStyle(cellHeadStyle);
Cell titleCell3 = headRow.createCell(2);
titleCell3.setCellValue(departmentName);
titleCell3.setCellStyle(cellHeadStyle);
Cell titleCell4 = headRow.createCell(3);
titleCell4.setCellValue(departmentName);
titleCell4.setCellStyle(cellHeadStyle);
Cell titleCell5 = headRow.createCell(4);
titleCell5.setCellValue(departmentName);
titleCell5.setCellStyle(cellHeadStyle);
Cell titleCell6 = headRow.createCell(5);
titleCell6.setCellValue(year + " " + dateTypeName);
titleCell6.setCellStyle(cellHeadStyle);
sh.addMergedRegion(new CellRangeAddress(row, row, 1, cols - 2));
row++;
headRow = sh.createRow(row);
titleCell1 = headRow.createCell(0);
titleCell1.setCellValue(BscReportPropertyUtils.getPerspectiveTitle());
titleCell1.setCellStyle(cellHeadStyle);
titleCell2 = headRow.createCell(1);
titleCell2.setCellValue(BscReportPropertyUtils.getObjectiveTitle());
titleCell2.setCellStyle(cellHeadStyle);
titleCell3 = headRow.createCell(2);
titleCell3.setCellValue(BscReportPropertyUtils.getKpiTitle());
titleCell3.setCellStyle(cellHeadStyle);
titleCell4 = headRow.createCell(3);
titleCell4.setCellValue("Weight");
titleCell4.setCellStyle(cellHeadStyle);
titleCell5 = headRow.createCell(4);
titleCell5.setCellValue("Maximum\nTarget\nMinimum");
titleCell5.setCellStyle(cellHeadStyle);
titleCell6 = headRow.createCell(5);
titleCell6.setCellValue("Score");
titleCell6.setCellStyle(cellHeadStyle);
row = row + 1;
return row;
}
use of com.netsteadfast.greenstep.vo.OrganizationVO in project bamboobsc by billchen198318.
the class OrganizationReportPdfCommand method createHead.
private void createHead(PdfPTable table, VisionVO vision, Context context) throws Exception {
String bgColor = "#F2F2F2";
String fnColor = "#000000";
PdfPCell cell = new PdfPCell();
cell.addElement(new Phrase("Department Balance SourceCard", this.getFont(fnColor, true)));
this.setCellBackgroundColor(cell, bgColor);
cell.setColspan(MAX_COLSPAN);
table.addCell(cell);
cell = new PdfPCell();
cell.addElement(new Phrase(vision.getTitle(), this.getFont(fnColor, true)));
this.setCellBackgroundColor(cell, bgColor);
cell.setColspan(MAX_COLSPAN);
table.addCell(cell);
String dateType = (String) context.get("dateType");
String year = (String) context.get("startYearDate");
String orgId = (String) context.get("orgId");
String departmentName = "";
String dateTypeName = "Year";
if ("1".equals(dateType)) {
dateTypeName = "In the first half";
}
if ("2".equals(dateType)) {
dateTypeName = "In the second half";
}
OrganizationVO organization = new OrganizationVO();
organization.setOrgId(orgId);
DefaultResult<OrganizationVO> result = this.organizationService.findByUK(organization);
if (result.getValue() != null) {
organization = result.getValue();
departmentName = organization.getName();
}
cell = new PdfPCell();
cell.addElement(new Phrase("Department", this.getFont(fnColor, true)));
this.setCellBackgroundColor(cell, bgColor);
cell.setColspan(1);
table.addCell(cell);
cell = new PdfPCell();
cell.addElement(new Phrase(departmentName, this.getFont(fnColor, true)));
this.setCellBackgroundColor(cell, bgColor);
cell.setColspan(4);
table.addCell(cell);
cell = new PdfPCell();
cell.addElement(new Phrase(year + " " + dateTypeName, this.getFont(fnColor, true)));
this.setCellBackgroundColor(cell, bgColor);
cell.setColspan(1);
table.addCell(cell);
cell = new PdfPCell();
cell.addElement(new Phrase(BscReportPropertyUtils.getPerspectiveTitle(), this.getFont(fnColor, true)));
this.setCellBackgroundColor(cell, bgColor);
cell.setColspan(1);
table.addCell(cell);
cell = new PdfPCell();
cell.addElement(new Phrase(BscReportPropertyUtils.getObjectiveTitle(), this.getFont(fnColor, true)));
this.setCellBackgroundColor(cell, bgColor);
cell.setColspan(1);
table.addCell(cell);
cell = new PdfPCell();
cell.addElement(new Phrase(BscReportPropertyUtils.getKpiTitle(), this.getFont(fnColor, true)));
this.setCellBackgroundColor(cell, bgColor);
cell.setColspan(1);
table.addCell(cell);
cell = new PdfPCell();
cell.addElement(new Phrase("Weight", this.getFont(fnColor, true)));
this.setCellBackgroundColor(cell, bgColor);
cell.setColspan(1);
table.addCell(cell);
cell = new PdfPCell();
cell.addElement(new Phrase("Maximum\nTarget\nMinimum", this.getFont(fnColor, true)));
this.setCellBackgroundColor(cell, bgColor);
cell.setColspan(1);
table.addCell(cell);
cell = new PdfPCell();
cell.addElement(new Phrase("Score", this.getFont(fnColor, true)));
this.setCellBackgroundColor(cell, bgColor);
cell.setColspan(1);
table.addCell(cell);
}
use of com.netsteadfast.greenstep.vo.OrganizationVO in project bamboobsc by billchen198318.
the class KpiReportBodyCommand method fillHeadContent.
private void fillHeadContent(Context context, Map<String, Object> parameter) throws ServiceException, Exception {
String headContent = "";
String orgId = (String) context.get("orgId");
String empId = (String) context.get("empId");
String account = (String) context.get("account");
if (!BscConstants.MEASURE_DATA_ORGANIZATION_FULL.equals(orgId) && !StringUtils.isBlank(orgId)) {
OrganizationVO organization = new OrganizationVO();
organization.setOrgId(orgId);
DefaultResult<OrganizationVO> result = this.organizationService.findByUK(organization);
if (result.getValue() != null) {
organization = result.getValue();
headContent += Constants.HTML_BR + "Measure data for: " + organization.getOrgId() + " - " + organization.getName();
}
}
if (!BscConstants.MEASURE_DATA_EMPLOYEE_FULL.equals(empId) && !StringUtils.isBlank(empId) && !StringUtils.isBlank(account)) {
EmployeeVO employee = new EmployeeVO();
employee.setEmpId(empId);
employee.setAccount(account);
DefaultResult<EmployeeVO> result = this.employeeService.findByUK(employee);
if (result.getValue() != null) {
employee = result.getValue();
headContent += Constants.HTML_BR + "Measure data for: " + employee.getEmpId() + " - " + employee.getFullName();
if (!StringUtils.isBlank(employee.getJobTitle())) {
headContent += " ( " + employee.getJobTitle() + " ) ";
}
}
}
parameter.put("headContent", headContent);
}
Aggregations