CZT
2023-12-14 757ee5dc2ca4185d3c60db1e8c35d2e96e15c50c
src/main/java/com/fzzy/otherview/sh2023/pr/SHApi2101PR.java
@@ -17,8 +17,10 @@
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.whhpjl.WhjlConstant;
import com.fzzy.otherview.whhpjl.dto.WhjlApi1101;
import com.fzzy.push.gd2022.ApiCodeConstant;
import com.fzzy.push.sh2023.SH2023Constant;
import com.fzzy.push.sh2023.dto.SH2023Api2101;
import org.apache.commons.lang.StringUtils;
@@ -118,15 +120,22 @@
        if (null == data.getPch() || data.getPch() == "") {
            data.setPch(data.getHwdm() + DateFormatUtils.format(data.getJjrq(), "yyyy"));
        }
        ApiInfoData infoData = new ApiInfoData();
        infoData.setId(data.getJjdh());
        infoData.setKqdm(data.getKqdm());
        infoData.setInteId(SH2023Constant.SH_2023_API_CODE_2101);
        infoData.setUpdateTime(new Date());
        infoData.setDataId(data.getJjdh());
        infoData.setData(JSON.toJSONString(data));
        infoData.setCzbz(data.getCzbz());
        infoData.setRemarks("备注信息");
        ApiInfoData infoData;
        List<ApiInfoData> apiInfoList = apiInfoDataRep.getDataByInteAndData(SH2023Constant.SH_2023_API_CODE_2101, data.getJjdh(),data.getKqdm());
        if (apiInfoList.size() != 0) {
            infoData = apiInfoList.get(0);
            infoData.setData(JSON.toJSONString(data));
        } else {
            infoData = new ApiInfoData();
            infoData.setId(ContextUtil.getUUID());
            infoData.setKqdm(data.getKqdm());
            infoData.setInteId(SH2023Constant.SH_2023_API_CODE_2101);
            infoData.setUpdateTime(new Date());
            infoData.setDataId(data.getJjdh());
            infoData.setData(JSON.toJSONString(data));
            infoData.setCzbz(data.getCzbz());
            infoData.setRemarks("备注信息");
        }
        apiInfoDataRep.save(infoData);
    }
@@ -136,19 +145,21 @@
     */
    @Expose
    public void delData(SH2023Api2101 data) {
        apiInfoDataRep.deleteById(data.getJjdh());
        List<ApiInfoData> apiInfoList = apiInfoDataRep.getDataByInteAndData(SH2023Constant.SH_2023_API_CODE_2101, data.getJjdh(),data.getKqdm());
        apiInfoDataRep.deleteById(apiInfoList.get(0).getId());
    }
    /**
     * sHApi2101PR#delUpdate
     */
    @Expose
    public String delUpdate(SH2023Api2101 entity) {
        if (null == entity) {
    public String delUpdate(SH2023Api2101 data) {
        if (null == data) {
            return "无数据执行";
        }
        entity.setCzbz(Constant.CZBZ_D);
        apiInfoDataRep.updateStatus(entity.getJjdh(), JSON.toJSONString(entity), Constant.CZBZ_D);
        List<ApiInfoData> apiInfoList = apiInfoDataRep.getDataByInteAndData(SH2023Constant.SH_2023_API_CODE_2101, data.getJjdh(),data.getKqdm());
        data.setCzbz(Constant.CZBZ_D);
        apiInfoDataRep.updateStatus(apiInfoList.get(0).getId(), JSON.toJSONString(data), Constant.CZBZ_D);
        return null;
    }
@@ -160,7 +171,9 @@
        String kqdm = items.get(0).getKqdm();
        ApiConfs apiConf = apiCommonService.getConf(kqdm);
        if (null == apiConf) return "系统没有获取到当前库区配置信息,执行失败";
        if (null == apiConf) {
            return "系统没有获取到当前库区配置信息,执行失败";
        }
        //封装参数
        ApiParam param = new ApiParam(apiConf, "21", SH2023Constant.SH_2023_API_CODE_2101);
@@ -175,23 +188,16 @@
        responseDto = apiService.pushData(param, apiConf, items);
        if (responseDto.getSuccess() == 0) {
            //推送成功,更新数据上传状态
            ApiInfoData infoData;
            for (SH2023Api2101 data : items) {
                if (Constant.CZBZ_I.equals(data.getCzbz())) {
                    infoData = new ApiInfoData();
                    infoData.setId(data.getBizId());
                    infoData.setKqdm(data.getKqdm());
                    infoData.setInteType("21");
                    infoData.setInteId(SH2023Constant.SH_2023_API_CODE_2101);
                    infoData.setUpdateTime(new Date());
                    infoData.setDataId(data.getBizId());
                    //推送成功,更新数据上传状态
                    List<ApiInfoData> apiInfoList = apiInfoDataRep.getDataByInteAndData(SH2023Constant.SH_2023_API_CODE_2101, data.getJjdh(),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);
                }
            }