package com.engine.htxc.tycgsqehy.web;

import com.alibaba.fastjson.JSONObject;
import com.engine.common.util.ServiceUtil;
import com.engine.htxc.tycgsq.service.impl.TycgsqServiceImpl;
import com.engine.htxc.tycgsqehy.common.CommonResult;
import com.engine.htxc.tycgsqehy.entity.TycgsqEntity;
import com.engine.htxc.tycgsqehy.service.TycgsqehyService;
import com.engine.htxc.tycgsqehy.service.impl.TycgsqehyServiceImpl;

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.Collections;
import java.util.List;

/**
 * @Title: ecology-9
 * @Company: 泛微软件
 * @author: K1810027
 * @version: 1.0
 * @CreateDate: 2022-09-14 15:17
 * @Description:
 * @ModifyLog:
 **/
public class TycgsqehyAction {
    private TycgsqehyService tycgsqehyService(){ return ServiceUtil.getService(TycgsqehyServiceImpl.class); }

    /**
     * 通过项目编号查询171的IT采购和125通用采购流程包含此项目编号的流程
     * @param request
     * @param response
     * @return
     */
    @GET
    @Path("/getRequestIdByXmbh")
    @Produces({MediaType.TEXT_PLAIN})
    public String getRequestIdByXmbh(@Context HttpServletRequest request, @Context HttpServletResponse response){
        String xmbh = request.getParameter("xmbh");
        List<TycgsqEntity> list = tycgsqehyService().getRequestIdByXmbh(xmbh);
        CommonResult commonResult = new CommonResult(list);

        return JSONObject.toJSONString(commonResult.ok());
    }
}
