package com.engine.htsc.jjhtyfk.web;

import com.engine.common.util.ServiceUtil;
import com.engine.htsc.jjhtyfk.service.GetContractInfoService;
import com.engine.htsc.jjhtyfk.service.impl.GetContractInfoServiceImpl;
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;

/**
 * @Author Weaver.SongYuchen
 * @Date 2022-03-31
 * @Description 付款流程联动用印流程合同信息
 */
public class GetContractInfoAction {
    private GetContractInfoService getService() {
        return ServiceUtil.getService(GetContractInfoServiceImpl.class);
    }

    /**
     * 获取用印流程合同信息
     *
     * @param data
     * @return
     */
    @POST
    @Path("/getContractInfo")
    @Consumes(MediaType.APPLICATION_JSON)
    @Produces(MediaType.APPLICATION_JSON)
    public AjaxResult<Map<String, Object>> getContractInfo(Map<String, Object> data) {
        Map<String, Object> apidatas = new HashMap<>();
        BaseBean bb = new BaseBean();
        try {
            bb.writeLog("========================= getContractInfo Interfaces =========================");
            apidatas.putAll(getService().getContractInfo(data));
            apidatas.put("status", "1");
            return AjaxResult.ok(apidatas);
        } catch (Exception e) {
            e.printStackTrace();
            return AjaxResult.error(e.getMessage());
        }
    }
}
