package com.engine.htsc.payment.web;

import com.engine.common.util.ServiceUtil;
import com.engine.htsc.payment.service.PurchasingMallService;
import com.engine.htsc.payment.service.impl.PurchasingMallServiceImpl;
import com.engine.htsc.trip.util.AjaxResult;
import weaver.general.BaseBean;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import java.util.HashMap;
import java.util.Map;

public class PurchasingMallWeb extends BaseBean {

  private PurchasingMallService getService() {
    return ServiceUtil.getService(PurchasingMallServiceImpl.class);
  }

  /**
   * 批量获取会计科目信息
   * @param yskm ,分隔的预算科目
   * @return ajax
   */
  @GET
  @Path("/getBatchKjkm")
  @Produces({MediaType.APPLICATION_JSON})
  public AjaxResult<Map<String, Map<String, String>>> getVirtualDept(
      @QueryParam("yskm") String yskm){
    try {
      Map<String, Map<String, String>> batchKj = getService().getBatchKj(yskm);
      return AjaxResult.ok(batchKj);
    }catch (Exception e){
      writeLog("getBatchKjkm catch error:" + e.getMessage());
      errorLog("getBatchKjkm catch error:" , e);
      return AjaxResult.error(e.getMessage());
    }
  }
}
