CZT
2024-03-09 4c6b38c84b14e90bd0844046645c61796746696c
src/main/java/com/fzzy/push/sh2023/SH2023PushService12.java
@@ -1,21 +1,16 @@
package com.fzzy.push.sh2023;
import com.alibaba.fastjson.JSONObject;
import com.fzzy.api.Constant;
import com.fzzy.api.data.ApiParam;
import com.fzzy.api.data.PushProtocol;
import com.fzzy.api.dto.ResponseDto;
import com.fzzy.api.entity.*;
import com.fzzy.api.service.ApiRemoteService;
import com.fzzy.api.service.PushService11;
import com.fzzy.api.service.PushService12;
import com.fzzy.api.view.repository.*;
import com.fzzy.otherview.sh2023.dto.ShApi2101;
import com.fzzy.push.sh2023.dto.SH2023Api2101;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
/**
@@ -26,7 +21,7 @@
 */
@Slf4j
@Component
public class SH2023PushService12 implements PushService11 {
public class SH2023PushService12 implements PushService12 {
    @Autowired
@@ -67,31 +62,30 @@
    public void pushData(ApiParam param) {
        log.info("------->>>>粮食购销 接口模块上报开始");
        //推送合同信息
        this.pushData1201(apiRemoteService, param);
        //粮食入库信息
        this.pushData1202(apiRemoteService, param);
        //粮食入库检验信息
        this.pushData1203(apiRemoteService, param);
        //粮食入库结算信息
        this.pushData1204(apiRemoteService, param);
        //粮食出库信息
        this.pushData1205(apiRemoteService, param);
        //粮食出库结算信息
        this.pushData1206(apiRemoteService, param);
        //倒仓倒出
        this.pushData1207(apiRemoteService, param);
        //粮食库存
        this.pushData1208(apiRemoteService, param);
        //损溢单
        this.pushData1209(apiRemoteService, param);
        //粮食性质转变单
        this.pushData1210(apiRemoteService, param);
        //账面库存
        this.pushData1211(apiRemoteService, param);
        //客户信息
        this.pushData1212(apiRemoteService, param);
//        //推送合同信息
//        this.pushData1201(apiRemoteService, param);
//        //粮食入库信息
//        this.pushData1202(apiRemoteService, param);
//        //粮食入库检验信息
//        this.pushData1203(apiRemoteService, param);
//        //粮食入库结算信息
//        this.pushData1204(apiRemoteService, param);
//        //粮食出库信息
//        this.pushData1205(apiRemoteService, param);
//        //粮食出库结算信息
//        this.pushData1206(apiRemoteService, param);
//        //倒仓倒出
//        this.pushData1207(apiRemoteService, param);
//        //粮食库存
//        this.pushData1208(apiRemoteService, param);
//        //损溢单
//        this.pushData1209(apiRemoteService, param);
//        //粮食性质转变单
//        this.pushData1210(apiRemoteService, param);
//        //账面库存
//        this.pushData1211(apiRemoteService, param);
//        //客户信息
//        this.pushData1212(apiRemoteService, param);
        log.info("------->>>>粮食购销 接口模块上报结束");
    }
@@ -107,16 +101,16 @@
            log.error("-----上海市平台2023版:未获取到合同信息,不推送-----");
            return;
        }
        param.setInteCategory(Constant.API_CATEGORY_12);
        param.setInteId(SH2023Constant.SH_2023_API_CODE_1201);
        //推送,数据为集合形式
        ResponseDto responseDto = apiRemoteService.pushData(param, list);
        if (responseDto.getSuccess() == 0) {
            //推送成功,更新数据上传状态
            for (Api1201 data : list) {
                if (Constant.CZBZ_I.equals(data.getCzbz())) {
        ResponseDto responseDto;
        for (Api1201 data : list) {
            param.setBizId(data.getBizId());
            responseDto = apiRemoteService.pushData(param, data);
            if (responseDto.getSuccess() == 0) {
                if (Constant.CZBZ_I.equals(data.getCzbz())) {
                    data.setCzbz(Constant.CZBZ_U);
                    //更新状态
                    api1201Rep.save(data);
                }
            }
@@ -134,14 +128,15 @@
            log.error("-----上海市平台2023版:未获取到粮食入库信息,不推送-----");
            return;
        }
        param.setInteCategory(Constant.API_CATEGORY_12);
        param.setInteId(SH2023Constant.SH_2023_API_CODE_1202);
        //推送,数据为集合形式
        ResponseDto responseDto = apiRemoteService.pushData(param, list);
        if (responseDto.getSuccess() == 0) {
            //推送成功,更新数据上传状态
            for (Api1202 data : list) {
                if (Constant.CZBZ_I.equals(data.getCzbz())) {
        ResponseDto responseDto;
        for (Api1202 data : list) {
            param.setBizId(data.getBizId());
            responseDto = apiRemoteService.pushData(param, data);
            if (responseDto.getSuccess() == 0) {
                if (Constant.CZBZ_I.equals(data.getCzbz())) {
                    data.setCzbz(Constant.CZBZ_U);
                    //更新状态
                    api1202Rep.save(data);
@@ -161,14 +156,15 @@
            log.error("-----上海市平台2023版:未获取到粮食入库检验信息,不推送-----");
            return;
        }
        param.setInteCategory(Constant.API_CATEGORY_12);
        param.setInteId(SH2023Constant.SH_2023_API_CODE_1203);
        //推送,数据为集合形式
        ResponseDto responseDto = apiRemoteService.pushData(param, list);
        if (responseDto.getSuccess() == 0) {
            //推送成功,更新数据上传状态
            for (Api1203 data : list) {
                if (Constant.CZBZ_I.equals(data.getCzbz())) {
        ResponseDto responseDto;
        for (Api1203 data : list) {
            param.setBizId(data.getBizId());
            responseDto = apiRemoteService.pushData(param, data);
            if (responseDto.getSuccess() == 0) {
                if (Constant.CZBZ_I.equals(data.getCzbz())) {
                    data.setCzbz(Constant.CZBZ_U);
                    //更新状态
                    api1203Rep.save(data);
@@ -189,21 +185,21 @@
            log.error("-----上海市平台2023版:未获取到粮食入库结算信息,不推送-----");
            return;
        }
        param.setInteCategory(Constant.API_CATEGORY_12);
        param.setInteId(SH2023Constant.SH_2023_API_CODE_1204);
        //推送,数据为集合形式
        ResponseDto responseDto = apiRemoteService.pushData(param, list);
        if (responseDto.getSuccess() == 0) {
            //推送成功,更新数据上传状态
            for (Api1204 data : list) {
                if (Constant.CZBZ_I.equals(data.getCzbz())) {
        ResponseDto responseDto;
        for (Api1204 data : list) {
            param.setBizId(data.getBizId());
            responseDto = apiRemoteService.pushData(param, data);
            if (responseDto.getSuccess() == 0) {
                if (Constant.CZBZ_I.equals(data.getCzbz())) {
                    data.setCzbz(Constant.CZBZ_U);
                    //更新状态
                    api1204Rep.save(data);
                }
            }
        }
    }
    /**
@@ -217,14 +213,15 @@
            log.error("-----上海市平台2023版:未获取到粮食出库信息,不推送-----");
            return;
        }
        param.setInteCategory(Constant.API_CATEGORY_12);
        param.setInteId(SH2023Constant.SH_2023_API_CODE_1205);
        //推送,数据为集合形式
        ResponseDto responseDto = apiRemoteService.pushData(param, list);
        if (responseDto.getSuccess() == 0) {
            //推送成功,更新数据上传状态
            for (Api1205 data : list) {
                if (Constant.CZBZ_I.equals(data.getCzbz())) {
        ResponseDto responseDto;
        for (Api1205 data : list) {
            param.setBizId(data.getBizId());
            responseDto = apiRemoteService.pushData(param, data);
            if (responseDto.getSuccess() == 0) {
                if (Constant.CZBZ_I.equals(data.getCzbz())) {
                    data.setCzbz(Constant.CZBZ_U);
                    //更新状态
                    api1205Rep.save(data);
@@ -244,12 +241,13 @@
            log.error("-----上海市平台2023版:未获取到粮食出库结算信息,不推送-----");
            return;
        }
        param.setInteCategory(Constant.API_CATEGORY_12);
        param.setInteId(SH2023Constant.SH_2023_API_CODE_1206);
        //推送,数据为集合形式
        ResponseDto responseDto = apiRemoteService.pushData(param, list);
        if (responseDto.getSuccess() == 0) {
            //推送成功,更新数据上传状态
            for (Api1206 data : list) {
        ResponseDto responseDto;
        for (Api1206 data : list) {
            param.setBizId(data.getBizId());
            responseDto = apiRemoteService.pushData(param, data);
            if (responseDto.getSuccess() == 0) {
                if (Constant.CZBZ_I.equals(data.getCzbz())) {
                    data.setCzbz(Constant.CZBZ_U);
@@ -258,15 +256,34 @@
                }
            }
        }
    }
    /**
     * 1207 倒仓倒出
     */
    public void pushData1207(ApiRemoteService apiRemoteService, ApiParam param) {
        //TODO
        //获取倒仓信息
        List<Api1207> list = api1207Rep.findPushDataByTime(param.getKqdm(), param.getStart(), param.getEnd());
        if (null == list || list.isEmpty()) {
            log.error("-----上海市平台2023版:未获取到倒仓信息,不推送-----");
            return;
        }
        param.setInteCategory(Constant.API_CATEGORY_12);
        param.setInteId(SH2023Constant.SH_2023_API_CODE_1207);
        ResponseDto responseDto;
        for (Api1207 data : list) {
            param.setBizId(data.getBizId());
            responseDto = apiRemoteService.pushData(param, data);
            if (responseDto.getSuccess() == 0) {
                if (Constant.CZBZ_I.equals(data.getCzbz())) {
                    data.setCzbz(Constant.CZBZ_U);
                    //更新状态
                    api1207Rep.save(data);
                }
            }
        }
    }
    /**
@@ -280,12 +297,14 @@
            log.error("-----上海市平台2023版:未获取到粮食库存信息,不推送-----");
            return;
        }
        param.setInteCategory(Constant.API_CATEGORY_12);
        param.setInteId(SH2023Constant.SH_2023_API_CODE_1208);
        //推送,数据为集合形式
        ResponseDto responseDto = apiRemoteService.pushData(param, list);
        if (responseDto.getSuccess() == 0) {
            //推送成功,更新数据上传状态
            for (Api1208 data : list) {
        ResponseDto responseDto;
        for (Api1208 data : list) {
            param.setBizId(data.getBizId());
            responseDto = apiRemoteService.pushData(param, data);
            if (responseDto.getSuccess() == 0) {
                if (Constant.CZBZ_I.equals(data.getCzbz())) {
                    data.setCzbz(Constant.CZBZ_U);
@@ -294,23 +313,63 @@
                }
            }
        }
    }
    /**
     * 1209 损溢单
     */
    public void pushData1209(ApiRemoteService apiRemoteService, ApiParam param) {
        //TODO
        //获取损益单信息
        List<Api1209> list = api1209Rep.findPushDataByTime(param.getKqdm(), param.getStart(), param.getEnd());
        if (null == list || list.isEmpty()) {
            log.error("-----上海市平台2023版:未获取到粮食库存信息,不推送-----");
            return;
        }
        param.setInteCategory(Constant.API_CATEGORY_12);
        param.setInteId(SH2023Constant.SH_2023_API_CODE_1209);
        ResponseDto responseDto;
        for (Api1209 data : list) {
            param.setBizId(data.getBizId());
            responseDto = apiRemoteService.pushData(param, data);
            if (responseDto.getSuccess() == 0) {
                if (Constant.CZBZ_I.equals(data.getCzbz())) {
                    data.setCzbz(Constant.CZBZ_U);
                    //更新状态
                    api1209Rep.save(data);
                }
            }
        }
    }
    /**
     * 1210 粮食性质转变单
     */
    public void pushData1210(ApiRemoteService apiRemoteService, ApiParam param) {
        //TODO
        //粮食性质转变单
        List<Api1210> list = api1210Rep.findPushDataByTime(param.getKqdm(), param.getStart(), param.getEnd());
        if (null == list || list.isEmpty()) {
            log.error("-----上海市平台2023版:未获取到粮食库存信息,不推送-----");
            return;
        }
        param.setInteCategory(Constant.API_CATEGORY_12);
        param.setInteId(SH2023Constant.SH_2023_API_CODE_1210);
        ResponseDto responseDto;
        for (Api1210 data : list) {
            param.setBizId(data.getBizId());
            responseDto = apiRemoteService.pushData(param, data);
            if (responseDto.getSuccess() == 0) {
                if (Constant.CZBZ_I.equals(data.getCzbz())) {
                    data.setCzbz(Constant.CZBZ_U);
                    //更新状态
                    api1210Rep.save(data);
                }
            }
        }
    }
    /**
@@ -318,7 +377,29 @@
     */
    public void pushData1211(ApiRemoteService apiRemoteService, ApiParam param) {
        //TODO
        //粮食性质转变单
        List<Api1211> list = api1211Rep.findPushDataByTime(param.getKqdm(), param.getStart(), param.getEnd());
        if (null == list || list.isEmpty()) {
            log.error("-----上海市平台2023版:未获取到粮食库存信息,不推送-----");
            return;
        }
        param.setInteCategory(Constant.API_CATEGORY_12);
        param.setInteId(SH2023Constant.SH_2023_API_CODE_1210);
        ResponseDto responseDto;
        for (Api1211 data : list) {
            param.setBizId(data.getBizId());
            responseDto = apiRemoteService.pushData(param, data);
            if (responseDto.getSuccess() == 0) {
                if (Constant.CZBZ_I.equals(data.getCzbz())) {
                    data.setCzbz(Constant.CZBZ_U);
                    //更新状态
                    api1211Rep.save(data);
                }
            }
        }
    }
    /**
@@ -332,14 +413,15 @@
            log.error("-----上海市平台2023版:未获取到客户信息,不推送-----");
            return;
        }
        param.setInteCategory(Constant.API_CATEGORY_12);
        param.setInteId(SH2023Constant.SH_2023_API_CODE_1212);
        //推送,数据为集合形式
        ResponseDto responseDto = apiRemoteService.pushData(param, list);
        if (responseDto.getSuccess() == 0) {
            //推送成功,更新数据上传状态
            for (Api1212 data : list) {
                if (Constant.CZBZ_I.equals(data.getCzbz())) {
        ResponseDto responseDto;
        for (Api1212 data : list) {
            param.setBizId(data.getBizId());
            responseDto = apiRemoteService.pushData(param, data);
            if (responseDto.getSuccess() == 0) {
                if (Constant.CZBZ_I.equals(data.getCzbz())) {
                    data.setCzbz(Constant.CZBZ_U);
                    //更新状态
                    api1212Rep.save(data);
@@ -352,31 +434,27 @@
     * 2101 检斤单
     */
    public void pushData2101(ApiRemoteService apiRemoteService, ApiParam param) {
        //获取 检斤单信息
        List<ApiInfoData> items = apiInfoDataRep.getDataByInteId(SH2023Constant.SH_2023_API_CODE_2101);
        SH2023Api2101 shApi2101;
        List<SH2023Api2101> list = new ArrayList<>();
        param.setInteId(SH2023Constant.SH_2023_API_CODE_2101);
        for (ApiInfoData infoData : items) {
            shApi2101 = JSONObject.parseObject(infoData.getData(), SH2023Api2101.class);
            shApi2101.setCzbz(infoData.getCzbz());
            shApi2101.setZhgxsj(infoData.getUpdateTime());
            list.add(shApi2101);
        }
        ResponseDto responseDto = apiRemoteService.pushData(param, list);
        if (responseDto.getSuccess() == 0) {
            //推送成功,更新数据上传状态
            for (ApiInfoData data : items) {
                if (Constant.CZBZ_I.equals(data.getCzbz())) {
                    data.setCzbz(Constant.CZBZ_U);
                    apiInfoDataRep.save(data);
                }
            }
        }
//        List<ApiInfoData> items = apiInfoDataRep.getDataByInteId(SH2023Constant.SH_2023_API_CODE_2101);
//
//        param.setInteCategory(Constant.API_CATEGORY_12);
//        param.setInteId(SH2023Constant.SH_2023_API_CODE_2101);
//
//        ResponseDto responseDto;
//        SH2023Api2101 shApi2101;
//        for (ApiInfoData infoData : items) {
//            shApi2101 = JSONObject.parseObject(infoData.getData(), SH2023Api2101.class);
//            shApi2101.setCzbz(infoData.getCzbz());
//            shApi2101.setZhgxsj(infoData.getUpdateTime());
//            param.setBizId(infoData.getDataId());
//            responseDto = apiRemoteService.pushData(param, shApi2101);
//            if (responseDto.getSuccess() == 0) {
//                if (Constant.CZBZ_I.equals(infoData.getCzbz())) {
//                    infoData.setCzbz(Constant.CZBZ_U);
//                    apiInfoDataRep.save(infoData);
//                }
//            }
//        }
    }
    /**
@@ -391,7 +469,27 @@
     * 2104  市储驳运单
     */
    public void pushData2104(ApiRemoteService apiRemoteService, ApiParam param) {
        //TODO
        //获取 检斤单信息
//        List<ApiInfoData> items = apiInfoDataRep.getDataByInteId(SH2023Constant.SH_2023_API_CODE_2104);
//        param.setInteCategory(Constant.API_CATEGORY_12);
//        param.setInteId(SH2023Constant.SH_2023_API_CODE_2104);
//
//        ResponseDto responseDto;
//        SH2023Api2104 shApi2104;
//        for (ApiInfoData infoData : items) {
//            shApi2104 = JSONObject.parseObject(infoData.getData(), SH2023Api2104.class);
//            shApi2104.setCzbz(infoData.getCzbz());
//            shApi2104.setZhgxsj(infoData.getUpdateTime());
//
//            param.setBizId(infoData.getDataId());
//            responseDto = apiRemoteService.pushData(param, shApi2104);
//            if (responseDto.getSuccess() == 0) {
//                if (Constant.CZBZ_I.equals(infoData.getCzbz())) {
//                    infoData.setCzbz(Constant.CZBZ_U);
//                    apiInfoDataRep.save(infoData);
//                }
//            }
//        }
    }
}