Search in sources :

Example 6 with PdcaItemVO

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

the class PdcaSaveOrUpdateAction method checkPdcaItemsType.

private boolean checkPdcaItemsType(List<PdcaItemVO> items) throws Exception {
    boolean pType = false;
    boolean dType = false;
    boolean cType = false;
    boolean aType = false;
    for (PdcaItemVO item : items) {
        if (PdcaType.PLAN.equals(item.getType())) {
            pType = true;
        }
        if (PdcaType.DO.equals(item.getType())) {
            dType = true;
        }
        if (PdcaType.CHECK.equals(item.getType())) {
            cType = true;
        }
        if (PdcaType.ACTION.equals(item.getType())) {
            aType = true;
        }
    }
    return (pType && dType && cType && aType);
}
Also used : PdcaItemVO(com.netsteadfast.greenstep.vo.PdcaItemVO)

Example 7 with PdcaItemVO

use of com.netsteadfast.greenstep.vo.PdcaItemVO 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;
    }
}
Also used : PdcaVO(com.netsteadfast.greenstep.vo.PdcaVO) PdcaItemVO(com.netsteadfast.greenstep.vo.PdcaItemVO) PdcaMeasureFreqVO(com.netsteadfast.greenstep.vo.PdcaMeasureFreqVO)

Example 8 with PdcaItemVO

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;
}
Also used : XSSFColor(org.apache.poi.xssf.usermodel.XSSFColor) XSSFCellStyle(org.apache.poi.xssf.usermodel.XSSFCellStyle) XSSFFont(org.apache.poi.xssf.usermodel.XSSFFont) Row(org.apache.poi.ss.usermodel.Row) PdcaItemVO(com.netsteadfast.greenstep.vo.PdcaItemVO) Cell(org.apache.poi.ss.usermodel.Cell)

Example 9 with PdcaItemVO

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);
        }
    }
}
Also used : PdcaItemDocVO(com.netsteadfast.greenstep.vo.PdcaItemDocVO) HashMap(java.util.HashMap) PdcaItemVO(com.netsteadfast.greenstep.vo.PdcaItemVO) BbPdcaItem(com.netsteadfast.greenstep.po.hbm.BbPdcaItem)

Example 10 with PdcaItemVO

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

the class LoadPdcaDataCommand method execute.

@SuppressWarnings("unchecked")
@Override
public boolean execute(Context context) throws Exception {
    pdcaService = (IPdcaService<PdcaVO, BbPdca, String>) AppContext.getBean("bsc.service.PdcaService");
    pdcaDocService = (IPdcaDocService<PdcaDocVO, BbPdcaDoc, String>) AppContext.getBean("bsc.service.PdcaDocService");
    pdcaItemService = (IPdcaItemService<PdcaItemVO, BbPdcaItem, String>) AppContext.getBean("bsc.service.PdcaItemService");
    pdcaItemDocService = (IPdcaItemDocService<PdcaItemDocVO, BbPdcaItemDoc, String>) AppContext.getBean("bsc.service.PdcaItemDocService");
    pdcaAuditService = (IPdcaAuditService<PdcaAuditVO, BbPdcaAudit, String>) AppContext.getBean("bsc.service.PdcaAuditService");
    employeeService = (IEmployeeService<EmployeeVO, BbEmployee, String>) AppContext.getBean("bsc.service.EmployeeService");
    organizationService = (IOrganizationService<OrganizationVO, BbOrganization, String>) AppContext.getBean("bsc.service.OrganizationService");
    kpiService = (IKpiService<KpiVO, BbKpi, String>) AppContext.getBean("bsc.service.KpiService");
    String pdcaOid = (String) context.get("pdcaOid");
    PdcaVO pdca = new PdcaVO();
    pdca.setOid(pdcaOid);
    DefaultResult<PdcaVO> result = pdcaService.findObjectByOid(pdca);
    if (result.getValue() == null) {
        this.setMessage(context, result.getSystemMessage().getValue());
    } else {
        pdca = result.getValue();
        this.loadDetail(pdca);
        this.loadPdcaItems(pdca);
        this.loadAudit(pdca);
        this.setResult(context, pdca);
        // Action 輸出可能會要用到
        context.put("pdca", pdca);
    }
    return false;
}
Also used : PdcaItemDocVO(com.netsteadfast.greenstep.vo.PdcaItemDocVO) PdcaDocVO(com.netsteadfast.greenstep.vo.PdcaDocVO) BbPdcaItemDoc(com.netsteadfast.greenstep.po.hbm.BbPdcaItemDoc) KpiVO(com.netsteadfast.greenstep.vo.KpiVO) BbPdcaDoc(com.netsteadfast.greenstep.po.hbm.BbPdcaDoc) OrganizationVO(com.netsteadfast.greenstep.vo.OrganizationVO) BbKpi(com.netsteadfast.greenstep.po.hbm.BbKpi) BbPdcaAudit(com.netsteadfast.greenstep.po.hbm.BbPdcaAudit) BbEmployee(com.netsteadfast.greenstep.po.hbm.BbEmployee) EmployeeVO(com.netsteadfast.greenstep.vo.EmployeeVO) BbOrganization(com.netsteadfast.greenstep.po.hbm.BbOrganization) PdcaVO(com.netsteadfast.greenstep.vo.PdcaVO) BbPdca(com.netsteadfast.greenstep.po.hbm.BbPdca) PdcaItemVO(com.netsteadfast.greenstep.vo.PdcaItemVO) BbPdcaItem(com.netsteadfast.greenstep.po.hbm.BbPdcaItem) PdcaAuditVO(com.netsteadfast.greenstep.vo.PdcaAuditVO)

Aggregations

PdcaItemVO (com.netsteadfast.greenstep.vo.PdcaItemVO)10 BbPdcaItem (com.netsteadfast.greenstep.po.hbm.BbPdcaItem)3 PdcaItemDocVO (com.netsteadfast.greenstep.vo.PdcaItemDocVO)3 PdcaVO (com.netsteadfast.greenstep.vo.PdcaVO)3 HashMap (java.util.HashMap)3 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)2 BbPdcaDoc (com.netsteadfast.greenstep.po.hbm.BbPdcaDoc)2 BbPdcaItemDoc (com.netsteadfast.greenstep.po.hbm.BbPdcaItemDoc)2 EmployeeVO (com.netsteadfast.greenstep.vo.EmployeeVO)2 KpiVO (com.netsteadfast.greenstep.vo.KpiVO)2 OrganizationVO (com.netsteadfast.greenstep.vo.OrganizationVO)2 PdcaMeasureFreqVO (com.netsteadfast.greenstep.vo.PdcaMeasureFreqVO)2 SysUploadVO (com.netsteadfast.greenstep.vo.SysUploadVO)2 ArrayList (java.util.ArrayList)2 BbEmployee (com.netsteadfast.greenstep.po.hbm.BbEmployee)1 BbKpi (com.netsteadfast.greenstep.po.hbm.BbKpi)1 BbOrganization (com.netsteadfast.greenstep.po.hbm.BbOrganization)1 BbPdca (com.netsteadfast.greenstep.po.hbm.BbPdca)1 BbPdcaAudit (com.netsteadfast.greenstep.po.hbm.BbPdcaAudit)1 BbPdcaItemOwner (com.netsteadfast.greenstep.po.hbm.BbPdcaItemOwner)1