Search in sources :

Example 1 with IVisionService

use of com.netsteadfast.greenstep.bsc.service.IVisionService in project bamboobsc by billchen198318.

the class ApiWebServiceImpl method getScorecard2.

@WebMethod
@GET
@Path("/scorecard2/")
@Override
public BscApiServiceResponse getScorecard2(@WebParam(name = "visionId") @QueryParam("visionId") String visionId, @WebParam(name = "startDate") @QueryParam("startDate") String startDate, @WebParam(name = "endDate") @QueryParam("endDate") String endDate, @WebParam(name = "startYearDate") @QueryParam("startYearDate") String startYearDate, @WebParam(name = "endYearDate") @QueryParam("endYearDate") String endYearDate, @WebParam(name = "frequency") @QueryParam("frequency") String frequency, @WebParam(name = "dataFor") @QueryParam("dataFor") String dataFor, @WebParam(name = "measureDataOrganizationId") @QueryParam("measureDataOrganizationId") String measureDataOrganizationId, @WebParam(name = "measureDataEmployeeId") @QueryParam("measureDataEmployeeId") String measureDataEmployeeId, @WebParam(name = "contentFlag") @QueryParam("contentFlag") String contentFlag) throws Exception {
    HttpServletRequest request = null;
    if (this.getWebServiceContext() != null && this.getWebServiceContext().getMessageContext() != null) {
        request = (HttpServletRequest) this.getWebServiceContext().getMessageContext().get(MessageContext.SERVLET_REQUEST);
    }
    Subject subject = null;
    BscApiServiceResponse responseObj = new BscApiServiceResponse();
    responseObj.setSuccess(YesNo.NO);
    try {
        subject = WsAuthenticateUtils.login();
        @SuppressWarnings("unchecked") IVisionService<VisionVO, BbVision, String> visionService = (IVisionService<VisionVO, BbVision, String>) AppContext.getBean("bsc.service.VisionService");
        @SuppressWarnings("unchecked") IEmployeeService<EmployeeVO, BbEmployee, String> employeeService = (IEmployeeService<EmployeeVO, BbEmployee, String>) AppContext.getBean("bsc.service.EmployeeService");
        @SuppressWarnings("unchecked") IOrganizationService<OrganizationVO, BbOrganization, String> organizationService = (IOrganizationService<OrganizationVO, BbOrganization, String>) AppContext.getBean("bsc.service.OrganizationService");
        String visionOid = "";
        String measureDataOrganizationOid = "";
        String measureDataEmployeeOid = "";
        DefaultResult<VisionVO> visionResult = visionService.findForSimpleByVisId(visionId);
        if (visionResult.getValue() == null) {
            throw new Exception(visionResult.getSystemMessage().getValue());
        }
        visionOid = visionResult.getValue().getOid();
        if (StringUtils.isBlank(measureDataOrganizationId)) {
            measureDataOrganizationOid = BscBaseLogicServiceCommonSupport.findEmployeeDataByEmpId(employeeService, measureDataOrganizationId).getOid();
        }
        if (StringUtils.isBlank(measureDataEmployeeId)) {
            measureDataEmployeeOid = BscBaseLogicServiceCommonSupport.findOrganizationDataByUK(organizationService, measureDataEmployeeId).getOid();
        }
        this.processForScorecard(responseObj, request, visionOid, startDate, endDate, startYearDate, endYearDate, frequency, dataFor, measureDataOrganizationOid, measureDataEmployeeOid, contentFlag);
    } catch (Exception e) {
        responseObj.setMessage(e.getMessage());
    } finally {
        if (!YesNo.YES.equals(responseObj.getSuccess())) {
            responseObj.setMessage(SysMessageUtil.get(GreenStepSysMsgConstants.SEARCH_NO_DATA));
        }
        WsAuthenticateUtils.logout(subject);
    }
    subject = null;
    return responseObj;
}
Also used : IVisionService(com.netsteadfast.greenstep.bsc.service.IVisionService) IOrganizationService(com.netsteadfast.greenstep.bsc.service.IOrganizationService) BbVision(com.netsteadfast.greenstep.po.hbm.BbVision) OrganizationVO(com.netsteadfast.greenstep.vo.OrganizationVO) VisionVO(com.netsteadfast.greenstep.vo.VisionVO) Subject(org.apache.shiro.subject.Subject) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) HttpServletRequest(javax.servlet.http.HttpServletRequest) BbEmployee(com.netsteadfast.greenstep.po.hbm.BbEmployee) EmployeeVO(com.netsteadfast.greenstep.vo.EmployeeVO) BscApiServiceResponse(com.netsteadfast.greenstep.bsc.vo.BscApiServiceResponse) BbOrganization(com.netsteadfast.greenstep.po.hbm.BbOrganization) IEmployeeService(com.netsteadfast.greenstep.bsc.service.IEmployeeService) WebMethod(javax.jws.WebMethod) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET)

Aggregations

ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)1 IEmployeeService (com.netsteadfast.greenstep.bsc.service.IEmployeeService)1 IOrganizationService (com.netsteadfast.greenstep.bsc.service.IOrganizationService)1 IVisionService (com.netsteadfast.greenstep.bsc.service.IVisionService)1 BscApiServiceResponse (com.netsteadfast.greenstep.bsc.vo.BscApiServiceResponse)1 BbEmployee (com.netsteadfast.greenstep.po.hbm.BbEmployee)1 BbOrganization (com.netsteadfast.greenstep.po.hbm.BbOrganization)1 BbVision (com.netsteadfast.greenstep.po.hbm.BbVision)1 EmployeeVO (com.netsteadfast.greenstep.vo.EmployeeVO)1 OrganizationVO (com.netsteadfast.greenstep.vo.OrganizationVO)1 VisionVO (com.netsteadfast.greenstep.vo.VisionVO)1 WebMethod (javax.jws.WebMethod)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Subject (org.apache.shiro.subject.Subject)1