package com.engine.htsc.payment.web;

import com.engine.common.util.ServiceUtil;
import com.engine.htsc.payment.service.PaymentSyncService;
import com.engine.htsc.payment.service.impl.PaymentSyncServiceImpl;
import com.engine.htsc.trip.util.AjaxResult;

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;

public class PaymentSyncWeb {

  private PaymentSyncService getService() {
    return ServiceUtil.getService(PaymentSyncServiceImpl.class);
  }

  @POST
  @Path("/old/processPdfAndAllAppendix")
  @Consumes(MediaType.APPLICATION_JSON)
  @Produces(MediaType.APPLICATION_JSON)
  public AjaxResult<String> syncOld() {
    try {
      this.getService()
          .syncProcessPdfAndAllAppendix();
      return AjaxResult.ok("同步成功");
    } catch (Exception e) {
      return AjaxResult.error("catch error: " + e);
    }
  }
}
