package com.engine.htsc.smsd.web;

import com.alibaba.fastjson.JSONObject;
import com.engine.common.util.ServiceUtil;
import com.engine.htsc.smsd.service.AddByLcbhService;
import com.engine.htsc.smsd.service.impl.AddByLcbhServiceImpl;
import weaver.general.Util;
import weaver.workflow.logging.Logger;
import weaver.workflow.logging.LoggerFactory;

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.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.HashMap;
import java.util.Map;

public class AddYfkDataAction {
    Logger logger = LoggerFactory.getLogger(AddYfkDataAction.class);

    private AddByLcbhService getService(){
        return ServiceUtil.getService(AddByLcbhServiceImpl.class);
    }

    /**
     * @Describe 根据用户输入的付款流程编号，查找对应的信息并存入建模表
     * @tableName uf_PrepayMageAccRep
     * */
    @GET
    @Path("addByLcbh")
    @Produces({MediaType.APPLICATION_JSON})
    public String addYfkDataByFklcbh(@Context HttpServletRequest request,
                                     @Context HttpServletResponse response){
        logger.info("================进入根据流程编号向预付款建模表写入数据的方法=====================");
        String lcbh = Util.null2String(request.getParameter("lcbh"));
        Map<String,Object> params = new HashMap<>();
        params.put("lcbh",lcbh);
        Map<String, Object> result = getService().addYfkDataByLcbh(params);
        return JSONObject.toJSONString(result);
    }

}
