WS
2023-09-07 99eb091857a72a0defd0a5bdd2185d1d2d8da573
src/main/java/com/fzzy/otherview/gd2022/pr/GDApi1023PR.java
@@ -7,13 +7,17 @@
import com.fzzy.api.service.ApiPushManager;
import com.fzzy.api.view.repository.ApiInfoDataRep;
import com.fzzy.otherview.gd2022.dto.GdApi1023;
import com.fzzy.otherview.gd2022.dto.GdApi1023Dtl;
import com.fzzy.otherview.gd2022.dto.GdApi1023People;
import com.fzzy.otherview.gd2022.dto.GdApi1023Way;
import com.fzzy.otherview.whhpjl.WhjlConstant;
import com.fzzy.otherview.whhpjl.dto.WhjlApi1101;
import com.fzzy.push.gd2022.ApiCodeConstant;
import org.apache.commons.lang.time.DateFormatUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
import java.util.*;
/**
 * 广东省接口-1023 熏蒸备案
@@ -21,7 +25,7 @@
 * @author czt
 * @date 2023/8/17
 */
@Component
@Component(value = "gDApi1023PR")
public class GDApi1023PR {
    @Autowired
@@ -32,28 +36,97 @@
    private ApiInfoDataRep apiInfoDataRep;
    /**
     * 获取列表信息
     * whjlApi1101PR#listData
     * 获取熏蒸备案主表信息
     * gDApi1023PR#listData
     *
     * @return
     */
    @DataProvider
    public List<GdApi1023> listData() {
        List<ApiInfoData> result = apiInfoDataRep.getDataByInteId(WhjlConstant.API_CODE_1101);
    public List<GdApi1023> listData(Map<String, Object> param) {
        List<ApiInfoData> result = apiInfoDataRep.getDataByInteId(ApiCodeConstant.API_1023);
        if(null == result ||result.isEmpty()){
            return null;
        }
        List<GdApi1023> list = new ArrayList<>();
        GdApi1023 gbApi1023;
        for (ApiInfoData infoData : result) {
//            GdApi1023 gdApi1023= JSONObject.parseObject(infoData.getData(), GdApi1023.class);
//            gdApi1023.setKqdm(infoData.getKqdm());
//            gdApi1023.setCzbz(infoData.getCzbz());
//            gdApi1023.setUpdateTime(infoData.getUpdateTime());
//            gdApi1023.setBizId(infoData.getDataId());
//            list.add(GdApi1023);
            GdApi1023 gdApi1023= JSONObject.parseObject(infoData.getData(), GdApi1023.class);
            list.add(gdApi1023);
        }
        return list;
    }
    /**
     * 获取熏蒸作业人员信息表
     * gDApi1023PR#peopleList
     *
     */
    @DataProvider
    public List<GdApi1023People> peopleList(Map<String, Object> param) throws Exception {
        String xzbm = (String) param.get("xzbm");
        String deptId = (String) param.get("deptId");
        String tbrq = DateFormatUtils.format((Date) param.get("tbrq"), "yyyyMMdd");
        String id = xzbm + deptId + tbrq;
        List<ApiInfoData> infoData = apiInfoDataRep.getDataByDataId(id);
        if(null == infoData || infoData.isEmpty()){
            return null;
        }
        GdApi1023 gdApi1023= JSONObject.parseObject(infoData.get(0).getData(), GdApi1023.class);
        if(null == gdApi1023){
            return null;
        }
        return gdApi1023.getPeoples();
    }
    /**
     * 获取熏蒸备案方式表表信息
     * gDApi1023PR#wayList
     *
     */
    @DataProvider
    public List<GdApi1023Way> wayList(Map<String, Object> param) throws Exception {
        String xzbm = (String) param.get("xzbm");
        String deptId = (String) param.get("deptId");
        String tbrq = DateFormatUtils.format((Date) param.get("tbrq"), "yyyyMMdd");
        String id = xzbm + deptId + tbrq;
        List<ApiInfoData> infoData = apiInfoDataRep.getDataByDataId(id);
        if(null == infoData || infoData.isEmpty()){
            return null;
        }
        GdApi1023 gdApi1023= JSONObject.parseObject(infoData.get(0).getData(), GdApi1023.class);
        if(null == gdApi1023){
            return null;
        }
        return gdApi1023.getWays();
    }
    /**
     * 实施熏蒸作业的储粮粮情明细表
     * gDApi1023PR#dtlList
     *
     */
    @DataProvider
    public List<GdApi1023Dtl> dtlList(Map<String, Object> param) throws Exception {
        String xzbm = (String) param.get("xzbm");
        String deptId = (String) param.get("deptId");
        String tbrq = DateFormatUtils.format((Date) param.get("tbrq"), "yyyyMMdd");
        String id = xzbm + deptId + tbrq;
        List<ApiInfoData> infoData = apiInfoDataRep.getDataByDataId(id);
        if(null == infoData || infoData.isEmpty()){
            return null;
        }
        GdApi1023 gdApi1023= JSONObject.parseObject(infoData.get(0).getData(), GdApi1023.class);
        if(null == gdApi1023){
            return null;
        }
        return gdApi1023.getDtls();
    }
}