| | |
| | | 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.service.ApiRemoteService; |
| | | import com.fzzy.api.service.PushService11; |
| | | import com.fzzy.api.view.repository.*; |
| | | import com.fzzy.otherview.sh2023.dto.ShApi2101; |
| | | import com.fzzy.push.sh2023.dto.SH2023Api2101; |
| | | import com.fzzy.push.sh2023.dto.SH2023Api2104; |
| | | 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; |
| | | |
| | | /** |
| | |
| | | private Api1211Rep api1211Rep; |
| | | @Autowired |
| | | private Api1212Rep api1212Rep; |
| | | @Autowired |
| | | private ApiInfoDataRep apiInfoDataRep; |
| | | |
| | | @Override |
| | | public String getProtocol() { |
| | |
| | | log.error("-----上海市平台2023版:未获取到合同信息,不推送-----"); |
| | | return; |
| | | } |
| | | |
| | | param.setInteId(SH2023Constant.SH_2023_API_CODE_1201); |
| | | //推送,数据为集合形式 |
| | | ResponseDto responseDto = apiRemoteService.pushData(param, list); |
| | | if (responseDto.getSuccess() == 0) { |
| | |
| | | log.error("-----上海市平台2023版:未获取到粮食入库信息,不推送-----"); |
| | | return; |
| | | } |
| | | |
| | | param.setInteId(SH2023Constant.SH_2023_API_CODE_1202); |
| | | //推送,数据为集合形式 |
| | | ResponseDto responseDto = apiRemoteService.pushData(param, list); |
| | | if (responseDto.getSuccess() == 0) { |
| | |
| | | log.error("-----上海市平台2023版:未获取到粮食入库检验信息,不推送-----"); |
| | | return; |
| | | } |
| | | |
| | | param.setInteId(SH2023Constant.SH_2023_API_CODE_1203); |
| | | //推送,数据为集合形式 |
| | | ResponseDto responseDto = apiRemoteService.pushData(param, list); |
| | | if (responseDto.getSuccess() == 0) { |
| | |
| | | log.error("-----上海市平台2023版:未获取到粮食入库结算信息,不推送-----"); |
| | | return; |
| | | } |
| | | |
| | | param.setInteId(SH2023Constant.SH_2023_API_CODE_1204); |
| | | //推送,数据为集合形式 |
| | | ResponseDto responseDto = apiRemoteService.pushData(param, list); |
| | | if (responseDto.getSuccess() == 0) { |
| | |
| | | log.error("-----上海市平台2023版:未获取到粮食出库信息,不推送-----"); |
| | | return; |
| | | } |
| | | |
| | | param.setInteId(SH2023Constant.SH_2023_API_CODE_1205); |
| | | //推送,数据为集合形式 |
| | | ResponseDto responseDto = apiRemoteService.pushData(param, list); |
| | | if (responseDto.getSuccess() == 0) { |
| | |
| | | log.error("-----上海市平台2023版:未获取到粮食出库结算信息,不推送-----"); |
| | | return; |
| | | } |
| | | |
| | | param.setInteId(SH2023Constant.SH_2023_API_CODE_1206); |
| | | //推送,数据为集合形式 |
| | | ResponseDto responseDto = apiRemoteService.pushData(param, list); |
| | | if (responseDto.getSuccess() == 0) { |
| | |
| | | * 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.setInteId(SH2023Constant.SH_2023_API_CODE_1207); |
| | | //推送,数据为集合形式 |
| | | ResponseDto responseDto = apiRemoteService.pushData(param, list); |
| | | if (responseDto.getSuccess() == 0) { |
| | | //推送成功,更新数据上传状态 |
| | | for (Api1207 data : list) { |
| | | if (Constant.CZBZ_I.equals(data.getCzbz())) { |
| | | |
| | | data.setCzbz(Constant.CZBZ_U); |
| | | //更新状态 |
| | | api1207Rep.save(data); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | * 1208 粮食库存 |
| | | */ |
| | | public void pushData1208(ApiRemoteService apiRemoteService, ApiParam param) { |
| | | //TODO |
| | | //获取粮食库存信息 |
| | | List<Api1208> list = api1208Rep.findPushDataByTime(param.getKqdm(), param.getStart(), param.getEnd()); |
| | | |
| | | if (null == list || list.isEmpty()) { |
| | | log.error("-----上海市平台2023版:未获取到粮食库存信息,不推送-----"); |
| | | return; |
| | | } |
| | | param.setInteId(SH2023Constant.SH_2023_API_CODE_1208); |
| | | //推送,数据为集合形式 |
| | | ResponseDto responseDto = apiRemoteService.pushData(param, list); |
| | | if (responseDto.getSuccess() == 0) { |
| | | //推送成功,更新数据上传状态 |
| | | for (Api1208 data : list) { |
| | | if (Constant.CZBZ_I.equals(data.getCzbz())) { |
| | | |
| | | data.setCzbz(Constant.CZBZ_U); |
| | | //更新状态 |
| | | api1208Rep.save(data); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | * 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.setInteId(SH2023Constant.SH_2023_API_CODE_1209); |
| | | //推送,数据为集合形式 |
| | | ResponseDto responseDto = apiRemoteService.pushData(param, list); |
| | | if (responseDto.getSuccess() == 0) { |
| | | //推送成功,更新数据上传状态 |
| | | for (Api1209 data : list) { |
| | | 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.setInteId(SH2023Constant.SH_2023_API_CODE_1210); |
| | | //推送,数据为集合形式 |
| | | ResponseDto responseDto = apiRemoteService.pushData(param, list); |
| | | if (responseDto.getSuccess() == 0) { |
| | | //推送成功,更新数据上传状态 |
| | | for (Api1210 data : list) { |
| | | if (Constant.CZBZ_I.equals(data.getCzbz())) { |
| | | |
| | | data.setCzbz(Constant.CZBZ_U); |
| | | //更新状态 |
| | | api1210Rep.save(data); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | * 1212 客户信息 |
| | | */ |
| | | public void pushData1212(ApiRemoteService apiRemoteService, ApiParam param) { |
| | | //TODO |
| | | //获取客户信息 |
| | | List<Api1212> list = api1212Rep.findPushDataByTime(param.getKqdm(), param.getStart(), param.getEnd()); |
| | | |
| | | if (null == list || list.isEmpty()) { |
| | | log.error("-----上海市平台2023版:未获取到客户信息,不推送-----"); |
| | | return; |
| | | } |
| | | 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())) { |
| | | |
| | | data.setCzbz(Constant.CZBZ_U); |
| | | //更新状态 |
| | | api1212Rep.save(data); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 2101 检斤单 |
| | | */ |
| | | public void pushData2101(ApiRemoteService apiRemoteService, ApiParam param) { |
| | | // todo |
| | | |
| | | //获取 检斤单信息 |
| | | 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); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | * 2104 市储驳运单 |
| | | */ |
| | | public void pushData2104(ApiRemoteService apiRemoteService, ApiParam param) { |
| | | //TODO |
| | | |
| | | //获取 检斤单信息 |
| | | List<ApiInfoData> items = apiInfoDataRep.getDataByInteId(SH2023Constant.SH_2023_API_CODE_2104); |
| | | |
| | | SH2023Api2104 shApi2104; |
| | | List<SH2023Api2104> list = new ArrayList<>(); |
| | | |
| | | param.setInteId(SH2023Constant.SH_2023_API_CODE_2104); |
| | | for (ApiInfoData infoData : items) { |
| | | shApi2104 = JSONObject.parseObject(infoData.getData(), SH2023Api2104.class); |
| | | shApi2104.setCzbz(infoData.getCzbz()); |
| | | shApi2104.setZhgxsh(infoData.getUpdateTime()); |
| | | list.add(shApi2104); |
| | | } |
| | | 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); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |