Search in sources :

Example 16 with EmployeeVO

use of com.netsteadfast.greenstep.vo.EmployeeVO in project bamboobsc by billchen198318.

the class PersonalReportExcelCommand 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 empId = (String) context.get("empId");
    String account = (String) context.get("account");
    String fullName = "";
    String jobTitle = "";
    String departmentName = "";
    String dateTypeName = "Year";
    if ("1".equals(dateType)) {
        dateTypeName = "In the first half";
    }
    if ("2".equals(dateType)) {
        dateTypeName = "In the second half";
    }
    EmployeeVO employee = new EmployeeVO();
    employee.setEmpId(empId);
    employee.setAccount(account);
    DefaultResult<EmployeeVO> result = this.employeeService.findByUK(employee);
    if (result.getValue() != null) {
        fullName = result.getValue().getEmpId() + " - " + result.getValue().getFullName();
        jobTitle = result.getValue().getEmpId() + " - " + result.getValue().getFullName();
        List<String> appendIds = this.organizationService.findForAppendOrganizationOids(result.getValue().getEmpId());
        List<String> appendNames = this.organizationService.findForAppendNames(appendIds);
        StringBuilder sb = new StringBuilder();
        for (int i = 0; appendNames != null && i < appendNames.size(); i++) {
            sb.append(appendNames.get(i)).append(Constants.ID_DELIMITER);
        }
        departmentName = sb.toString();
    }
    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);
    headRow.setHeight((short) 700);
    Cell titleCell1 = headRow.createCell(0);
    titleCell1.setCellValue("Job Title");
    titleCell1.setCellStyle(cellHeadStyle);
    Cell titleCell2 = headRow.createCell(1);
    titleCell2.setCellValue(jobTitle);
    titleCell2.setCellStyle(cellHeadStyle);
    Cell titleCell3 = headRow.createCell(2);
    titleCell3.setCellValue("Department");
    titleCell3.setCellStyle(cellHeadStyle);
    Cell titleCell4 = headRow.createCell(3);
    titleCell4.setCellValue(departmentName);
    titleCell4.setCellStyle(cellHeadStyle);
    Cell titleCell5 = headRow.createCell(4);
    titleCell5.setCellValue("name: " + fullName);
    titleCell5.setCellStyle(cellHeadStyle);
    Cell titleCell6 = headRow.createCell(5);
    titleCell6.setCellValue("Annual assessment: " + year);
    titleCell6.setCellStyle(cellHeadStyle);
    row++;
    headRow = sh.createRow(row);
    titleCell1 = headRow.createCell(0);
    titleCell1.setCellValue(BscReportPropertyUtils.getObjectiveTitle());
    titleCell1.setCellStyle(cellHeadStyle);
    titleCell2 = headRow.createCell(1);
    titleCell2.setCellValue(BscReportPropertyUtils.getKpiTitle());
    titleCell2.setCellStyle(cellHeadStyle);
    titleCell3 = headRow.createCell(2);
    titleCell3.setCellValue("Maximum\nTarget\nMinimum");
    titleCell3.setCellStyle(cellHeadStyle);
    titleCell4 = headRow.createCell(3);
    titleCell4.setCellValue("Weight");
    titleCell4.setCellStyle(cellHeadStyle);
    titleCell5 = headRow.createCell(4);
    titleCell5.setCellValue("Formula");
    titleCell5.setCellStyle(cellHeadStyle);
    titleCell6 = headRow.createCell(5);
    titleCell6.setCellValue("Score");
    titleCell6.setCellStyle(cellHeadStyle);
    row++;
    headRow = sh.createRow(row);
    headRow.setHeight((short) 1000);
    titleCell1 = headRow.createCell(0);
    titleCell1.setCellValue("Objective of Strategy");
    titleCell1.setCellStyle(cellHeadStyle);
    titleCell2 = headRow.createCell(1);
    titleCell2.setCellValue("KPI");
    titleCell2.setCellStyle(cellHeadStyle);
    titleCell3 = headRow.createCell(2);
    titleCell3.setCellValue("Target");
    titleCell3.setCellStyle(cellHeadStyle);
    titleCell4 = headRow.createCell(3);
    titleCell4.setCellValue("Weight");
    titleCell4.setCellStyle(cellHeadStyle);
    titleCell5 = headRow.createCell(4);
    titleCell5.setCellValue("Formula");
    titleCell5.setCellStyle(cellHeadStyle);
    XSSFCellStyle titleStyle = wb.createCellStyle();
    titleStyle.setFillForegroundColor(bgColor);
    titleStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    titleStyle.setFillForegroundColor(new XSSFColor(SimpleUtils.getColorRGB4POIColor("#F5F4F4")));
    titleStyle.setFont(cellHeadFont);
    titleStyle.setBorderBottom(BorderStyle.THIN);
    titleStyle.setBorderTop(BorderStyle.THIN);
    titleStyle.setBorderRight(BorderStyle.THIN);
    titleStyle.setBorderLeft(BorderStyle.THIN);
    titleStyle.setVerticalAlignment(VerticalAlignment.CENTER);
    titleStyle.setAlignment(HorizontalAlignment.CENTER);
    titleStyle.setWrapText(true);
    titleCell6 = headRow.createCell(5);
    titleCell6.setCellValue(dateTypeName);
    titleCell6.setCellStyle(titleStyle);
    for (int i = 0; i < 5; i++) {
        sh.addMergedRegion(new CellRangeAddress(row - 1, row, i, i));
    }
    return 5;
}
Also used : XSSFColor(org.apache.poi.xssf.usermodel.XSSFColor) EmployeeVO(com.netsteadfast.greenstep.vo.EmployeeVO) XSSFCellStyle(org.apache.poi.xssf.usermodel.XSSFCellStyle) XSSFFont(org.apache.poi.xssf.usermodel.XSSFFont) Row(org.apache.poi.ss.usermodel.Row) CellRangeAddress(org.apache.poi.ss.util.CellRangeAddress) Cell(org.apache.poi.ss.usermodel.Cell)

Example 17 with EmployeeVO

use of com.netsteadfast.greenstep.vo.EmployeeVO in project bamboobsc by billchen198318.

the class LoadPdcaDataCommand method getEmployeeNameNoThrow.

private String getEmployeeNameNoThrow(String empId) {
    String name = "";
    try {
        EmployeeVO employee = BscBaseLogicServiceCommonSupport.findEmployeeDataByEmpId(employeeService, empId);
        name = employee.getFullName();
    } catch (Exception e) {
        logger.warn("No find employee: " + empId);
    }
    if (StringUtils.isBlank(name)) {
        return empId;
    }
    return name;
}
Also used : EmployeeVO(com.netsteadfast.greenstep.vo.EmployeeVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException)

Example 18 with EmployeeVO

use of com.netsteadfast.greenstep.vo.EmployeeVO 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:&nbsp;" + organization.getOrgId() + "&nbsp;-&nbsp;" + 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:&nbsp;" + employee.getEmpId() + "&nbsp;-&nbsp;" + employee.getFullName();
            if (!StringUtils.isBlank(employee.getJobTitle())) {
                headContent += "&nbsp;(&nbsp;" + employee.getJobTitle() + "&nbsp;)&nbsp;";
            }
        }
    }
    parameter.put("headContent", headContent);
}
Also used : EmployeeVO(com.netsteadfast.greenstep.vo.EmployeeVO) OrganizationVO(com.netsteadfast.greenstep.vo.OrganizationVO)

Example 19 with EmployeeVO

use of com.netsteadfast.greenstep.vo.EmployeeVO in project bamboobsc by billchen198318.

the class DegreeFeedbackScoreCalculateUtils method getProjectScore.

public static DegreeFeedbackProjectVO getProjectScore(String projectOid, String ownerEmployeeOid) throws ServiceException, Exception {
    DegreeFeedbackProjectVO project = new DegreeFeedbackProjectVO();
    project.setOid(projectOid);
    DefaultResult<DegreeFeedbackProjectVO> projectResult = degreeFeedbackProjectService.findObjectByOid(project);
    if (projectResult.getValue() == null) {
        throw new ServiceException(projectResult.getSystemMessage().getValue());
    }
    project = projectResult.getValue();
    EmployeeVO employee = new EmployeeVO();
    employee.setOid(ownerEmployeeOid);
    DefaultResult<EmployeeVO> empResult = employeeService.findObjectByOid(employee);
    if (empResult.getValue() == null) {
        throw new ServiceException(empResult.getSystemMessage().getValue());
    }
    employee = empResult.getValue();
    List<DegreeFeedbackItemVO> items = getItemsScore(project, employee);
    if (items != null && items.size() > 0) {
        project.setEmployee(employee);
        project.setItems(items);
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("projectOid", project.getOid());
        Map<String, String> orderMap = new HashMap<String, String>();
        orderMap.put("value", "asc");
        List<BbDegreeFeedbackLevel> levels = degreeFeedbackLevelService.findListByParams(paramMap, null, orderMap);
        project.setLevels(wrapLevels(levels));
    }
    return project;
}
Also used : HashMap(java.util.HashMap) EmployeeVO(com.netsteadfast.greenstep.vo.EmployeeVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) DegreeFeedbackItemVO(com.netsteadfast.greenstep.vo.DegreeFeedbackItemVO) BbDegreeFeedbackLevel(com.netsteadfast.greenstep.po.hbm.BbDegreeFeedbackLevel) DegreeFeedbackProjectVO(com.netsteadfast.greenstep.vo.DegreeFeedbackProjectVO)

Example 20 with EmployeeVO

use of com.netsteadfast.greenstep.vo.EmployeeVO in project bamboobsc by billchen198318.

the class PerformanceScoreChainUtils method createOrUpdateMonitorItemScoreCurrentDateForEmployees.

public static void createOrUpdateMonitorItemScoreCurrentDateForEmployees(String frequency) throws ServiceException, Exception {
    Map<String, String> employeeMap = employeeService.findForMap(false);
    if (null == employeeMap || employeeMap.size() < 1) {
        return;
    }
    Map<String, Object> paramMap = new HashMap<String, Object>();
    for (Map.Entry<String, String> emp : employeeMap.entrySet()) {
        EmployeeVO employee = BscBaseLogicServiceCommonSupport.findEmployeeData(employeeService, emp.getKey());
        paramMap.put("empId", employee.getEmpId());
        if (kpiEmplService.countByParams(paramMap) < 1) {
            continue;
        }
        try {
            createOrUpdateMonitorItemScoreCurrentDate(frequency, "employee", "", employee.getOid());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
Also used : EmployeeVO(com.netsteadfast.greenstep.vo.EmployeeVO) HashMap(java.util.HashMap) HashMap(java.util.HashMap) Map(java.util.Map) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException)

Aggregations

EmployeeVO (com.netsteadfast.greenstep.vo.EmployeeVO)48 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)21 OrganizationVO (com.netsteadfast.greenstep.vo.OrganizationVO)15 HashMap (java.util.HashMap)13 ServiceMethodAuthority (com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)7 LinkedHashMap (java.util.LinkedHashMap)5 Transactional (org.springframework.transaction.annotation.Transactional)5 Map (java.util.Map)4 BbEmployee (com.netsteadfast.greenstep.po.hbm.BbEmployee)3 AccountVO (com.netsteadfast.greenstep.vo.AccountVO)3 KpiVO (com.netsteadfast.greenstep.vo.KpiVO)3 List (java.util.List)3 Context (org.apache.commons.chain.Context)3 ContextBase (org.apache.commons.chain.impl.ContextBase)3 DefaultResult (com.netsteadfast.greenstep.base.model.DefaultResult)2 SystemMessage (com.netsteadfast.greenstep.base.model.SystemMessage)2 BbOrganization (com.netsteadfast.greenstep.po.hbm.BbOrganization)2 BbPdcaDoc (com.netsteadfast.greenstep.po.hbm.BbPdcaDoc)2 BbPdcaItem (com.netsteadfast.greenstep.po.hbm.BbPdcaItem)2 BbPdcaItemDoc (com.netsteadfast.greenstep.po.hbm.BbPdcaItemDoc)2