package com.engine.htsc.mall.rest;

import com.engine.common.util.ServiceUtil;
import com.engine.htsc.mall.impl.MallExpenseConfirmationServiceImpl;
import com.engine.htsc.mall.pojo.MallExoenseConfirmationRequest;
import com.engine.htsc.mall.service.MallExpenseConfirmationService;
import java.util.HashMap;
import java.util.Map;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import weaver.hrm.User;

public class MallExpenseConfirmationAction {
  private Log log = LogFactory.getLog(this.getClass());
  private MallExpenseConfirmationService getService(User user){
    return ServiceUtil.getService(MallExpenseConfirmationServiceImpl.class,user);
  }
  
  private MallExpenseConfirmationService getService(){
    return ServiceUtil.getService(MallExpenseConfirmationServiceImpl.class);
  }
  
  /**
   * 总部智能商旅付款自动构建OA流程
   * @param request
   * @return
   */
  @POST
  @Path("/createMallExpenseConfirmationWorkflow")
  @Produces({MediaType.APPLICATION_JSON})
  public Map<String,Object> createMallExpenseConfirmationWorkflow(MallExoenseConfirmationRequest request){
    Map<String, Object> apidatas = new HashMap<>();
    try {
      apidatas = this.getService().createMallExpenseConfirmationWorkflow(request);
      apidatas.put("code", 200);
      apidatas.put("message","接口调用成功");
    }catch (Exception e){
      e.printStackTrace();
      apidatas.put("code",-1);
      apidatas.put("message","接口调用失败");
      apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
      log.error("isPostion catch exception");
    }
    return apidatas;
  }
}
