czt
2024-08-01 a70bd1fd9fd10c3a8ae6cd83026be84b845ee0c9
src/main/java/com/fzzy/otherview/gd2022/pr/GDApi1023PR.java
@@ -16,13 +16,8 @@
import com.fzzy.api.service.ApiRemoteService;
import com.fzzy.api.utils.ContextUtil;
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.push.gd2022.dto.Gd2022Api1023;
import com.fzzy.push.gd2022.ApiCodeConstant;
import com.fzzy.push.sh2023.SH2023Constant;
import com.fzzy.push.sh2023.dto.SH2023Api2103;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.DateFormatUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -61,7 +56,7 @@
     * @return
     */
    @DataProvider
    public void listData(Page<GdApi1023> page, ApiParam param) {
    public void listData(Page<Gd2022Api1023> page, ApiParam param) {
        Pageable pageable = PageRequest.of(page.getPageNo() - 1, page.getPageSize(), Sort.Direction.DESC, "updateTime");
@@ -98,53 +93,23 @@
        };
        org.springframework.data.domain.Page<ApiInfoData> japPage = apiInfoDataRep.findAll(specification, pageable);
        page.setEntityCount((int) japPage.getTotalElements());
        List<GdApi1023> list = new ArrayList<>();
        GdApi1023 gdApi1023;
        List<Gd2022Api1023> list = new ArrayList<>();
        Gd2022Api1023 GD2022Api1023;
        for (ApiInfoData infoData : japPage.getContent()) {
            gdApi1023 = JSONObject.parseObject(infoData.getData(), GdApi1023.class);
            list.add(gdApi1023);
            GD2022Api1023 = JSONObject.parseObject(infoData.getData(), Gd2022Api1023.class);
            list.add(GD2022Api1023);
        }
        page.setEntities(list);
    }
    /**
     * 获取熏蒸作业人员信息表
     * gDApi1023PR#peopleList
     */
    @DataProvider
    public List<GdApi1023People> peopleList(String code) {
        return JSON.parseArray(code, GdApi1023People.class);
    }
    /**
     * 获取熏蒸备案方式表表信息
     * gDApi1023PR#wayList
     */
    @DataProvider
    public List<GdApi1023Way> wayList(String code) {
        return JSON.parseArray(code, GdApi1023Way.class);
    }
    /**
     * 实施熏蒸作业的储粮粮情明细表
     * gDApi1023PR#dtlList
     */
    @DataProvider
    public List<GdApi1023Dtl> dtlList(String code) {
        return JSON.parseArray(code, GdApi1023Dtl.class);
    }
    /**
     * gDApi1023PR#saveData
     */
    @DataResolver
    public void saveData(GdApi1023 data) {
        data.setDtlList(JSON.toJSONString(data.getDtls()));
        data.setWayList(JSON.toJSONString(data.getWays()));
        data.setPeopleList(JSON.toJSONString(data.getPeoples()));
    public void saveData(Gd2022Api1023 data) {
        ApiInfoData infoData;
        List<ApiInfoData> apiInfoList = apiInfoDataRep.getDataByInteAndData(ApiCodeConstant.API_1023, data.getXzbm(), data.getKqdm());
        List<ApiInfoData> apiInfoList = apiInfoDataRep.getDataByInteAndData(ApiCodeConstant.API_1023, DateFormatUtils.format(data.getTbrq(), "yyyyMMdd") +  data.getXzbm(), data.getKqdm());
        if (apiInfoList.size() != 0) {
            infoData = apiInfoList.get(0);
            infoData.setData(JSON.toJSONString(data));
@@ -166,8 +131,8 @@
     * gDApi1023PR#delData
     */
    @Expose
    public void delData(GdApi1023 data) {
        List<ApiInfoData> apiInfoList = apiInfoDataRep.getDataByInteAndData(ApiCodeConstant.API_1023, data.getXzbm(), data.getKqdm());
    public void delData(Gd2022Api1023 data) {
        List<ApiInfoData> apiInfoList = apiInfoDataRep.getDataByInteAndData(ApiCodeConstant.API_1023, DateFormatUtils.format(data.getTbrq(), "yyyyMMdd") +  data.getXzbm(), data.getKqdm());
        apiInfoDataRep.deleteById(apiInfoList.get(0).getId());
    }
@@ -175,11 +140,11 @@
     * gDApi1023PR#delUpdate
     */
    @Expose
    public String delUpdate(GdApi1023 data) {
    public String delUpdate(Gd2022Api1023 data) {
        if (null == data) {
            return "无数据执行";
        }
        List<ApiInfoData> apiInfoList = apiInfoDataRep.getDataByInteAndData(ApiCodeConstant.API_1023, data.getXzbm(), data.getKqdm());
        List<ApiInfoData> apiInfoList = apiInfoDataRep.getDataByInteAndData(ApiCodeConstant.API_1023, DateFormatUtils.format(data.getTbrq(), "yyyyMMdd") +  data.getXzbm(), data.getKqdm());
        data.setCzbz(Constant.CZBZ_D);
        apiInfoDataRep.updateStatus(apiInfoList.get(0).getId(), JSON.toJSONString(data), Constant.CZBZ_D);
        return null;
@@ -192,7 +157,7 @@
     * @return
     */
    @Expose
    public String pushData(List<GdApi1023> items) {
    public String pushData(List<Gd2022Api1023> items) {
        ResponseDto responseDto;
        String result = "";
@@ -212,20 +177,21 @@
            return "系统没有当前推送协议配置,执行失败";
        }
        //推送,数据为集合形式
        responseDto = apiService.pushData(param, apiConf, items);
        if (responseDto.getSuccess() == 0) {
            //推送成功,更新数据上传状态
            ApiInfoData infoData;
            for (GdApi1023 data : items) {
                List<ApiInfoData> apiInfoList = apiInfoDataRep.getDataByInteAndData(ApiCodeConstant.API_1023, data.getXzbm(), data.getKqdm());
                data.setCzbz(Constant.CZBZ_U);
                infoData = apiInfoList.get(0);
                infoData.setUpdateTime(new Date());
                infoData.setCzbz(Constant.CZBZ_U);
                infoData.setData(JSON.toJSONString(data));
                apiInfoDataRep.save(infoData);
        ApiInfoData infoData;
        for (Gd2022Api1023 data : items) {
            //推送,数据为集合形式
            responseDto = apiService.pushData(param, apiConf, data);
            if (responseDto.getSuccess() == 0) {
                if (Constant.CZBZ_I.equals(data.getCzbz())) {
                    //推送成功,更新数据上传状态
                    List<ApiInfoData> apiInfoList = apiInfoDataRep.getDataByInteAndData(ApiCodeConstant.API_1023, DateFormatUtils.format(data.getTbrq(), "yyyyMMdd") +  data.getXzbm(), data.getKqdm());
                    data.setCzbz(Constant.CZBZ_U);
                    infoData = apiInfoList.get(0);
                    infoData.setUpdateTime(new Date());
                    infoData.setCzbz(Constant.CZBZ_U);
                    infoData.setData(JSON.toJSONString(data));
                    apiInfoDataRep.save(infoData);
                }
            }
            result += responseDto.toString();
        }