package com.casic.PgInterface.rs;

import com.casic.PgInterface.construction.manager.PgConRemoveMsgManager;
import com.casic.PgInterface.construction.manager.PgConRequestMsgManager;
import com.casic.PgInterface.construction.manager.PgConWorkOrderManager;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import javax.ws.rs.FormParam;
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;

@Component
@Path("pgConWorkRs")
public class PgConWorkRs {

    @Resource
    private PgConRemoveMsgManager pgConRemoveMsgManager;

    @Resource
    private PgConRequestMsgManager pgConRequestMsgManager;

    @Resource
    private PgConWorkOrderManager pgConWorkOrderManager;

    /**
     * 获取施工记录信息
     */
    @POST
    @Path("getConWorkerOrder")
    @Produces(MediaType.APPLICATION_JSON)
    public Map<String, Object> getConWorkerOrder(@FormParam("taskCompany") String taskCompany,
                                            @FormParam("taskName") String taskName,
                                            @FormParam("taskPlace") String taskPlace,
                                            @FormParam("page") int page,
                                            @FormParam("rows") int rows) throws Exception {
        Map<String, Object> resultMap = new HashMap<>();
        String msg = "";
        try {
            resultMap = pgConWorkOrderManager.getPgConWorkOrderDtoList(taskCompany,taskName,taskPlace,page,rows);

        } catch (Exception e) {
            e.printStackTrace();
        }
        return resultMap;
    }

    /**
     * 获取施工请求信息
     */
    @POST
    @Path("getConRequestMsg")
    @Produces(MediaType.APPLICATION_JSON)
    public Map<String, Object> getConRequestMsg(@FormParam("buildCompany") String buildCompany,
                                                 @FormParam("project") String project,
                                                 @FormParam("page") int page,
                                                 @FormParam("rows") int rows) throws Exception {
        Map<String, Object> resultMap = new HashMap<>();
        String msg = "";
        try {
            resultMap = pgConRequestMsgManager.getPgConRequestMsgDtoList(buildCompany,project,page,rows);

        } catch (Exception e) {
            e.printStackTrace();
        }
        return resultMap;
    }

    /**
     * 获取施工删除信息
     */
    @POST
    @Path("getConRemoveMsg")
    @Produces(MediaType.APPLICATION_JSON)
    public Map<String, Object> getConRemoveMsg(@FormParam("buildCompany") String buildCompany,
                                                @FormParam("project") String project,
                                                @FormParam("page") int page,
                                                @FormParam("rows") int rows) throws Exception {
        Map<String, Object> resultMap = new HashMap<>();
        String msg = "";
        try {
            resultMap = pgConRemoveMsgManager.getPgConRemovetMsgDtoList(buildCompany,project,page,rows);

        } catch (Exception e) {
            e.printStackTrace();
        }
        return resultMap;
    }

}
