package com.engine.htsc.payment.web;

import com.engine.common.util.ServiceUtil;
import com.engine.htsc.payment.service.UnionPaymentService;
import com.engine.htsc.payment.service.impl.UnionPaymentServiceImpl;
import com.engine.htsc.trip.util.AjaxResult;
import weaver.general.BaseBean;

import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import java.util.HashMap;
import java.util.Map;

public class UnionPaymentAction extends BaseBean {

  private UnionPaymentService getService() {
    return ServiceUtil.getService(UnionPaymentServiceImpl.class);
  }

  @POST
  @Path("/getApprovalLinkByDept")
  @Consumes(MediaType.APPLICATION_JSON)
  @Produces(MediaType.APPLICATION_JSON)
  public AjaxResult<Map<String, Object>> getApprovalLink(HashMap<String, Object> params) {
    try {
      Map<String, Object> approvalLinkByDept = this.getService().getApprovalLinkByDept(params);
      return AjaxResult.ok(approvalLinkByDept);
    } catch (Exception e) {
      writeLog("catch error" + e);
      return AjaxResult.error("catch error:" + e.getMessage());
    }
  }
}
