| | |
| | | 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.push.impl.ComPushService11; |
| | | import com.fzzy.api.view.repository.*; |
| | | import com.fzzy.push.sh2023.dto.SH2023Api1311; |
| | | import com.fzzy.push.sh2023.dto.SH2023Api2103; |
| | | 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; |
| | | |
| | | /** |
| | | * 上海市平台2023版-基础数据上传 |
| | |
| | | |
| | | |
| | | @Autowired |
| | | private ComPushService11 pushService; |
| | | private SH2023ApiRemoteService apiRemoteService; |
| | | @Autowired |
| | | private Api1301Rep api1301Rep; |
| | | @Autowired |
| | | private Api1302Rep api1302Rep; |
| | | @Autowired |
| | | private Api1303Rep api1303Rep; |
| | | @Autowired |
| | | private Api1304Rep api1304Rep; |
| | | @Autowired |
| | | private Api1305Rep api1305Rep; |
| | | @Autowired |
| | | private Api1306Rep api1306Rep; |
| | | @Autowired |
| | | private Api1307Rep api1307Rep; |
| | | @Autowired |
| | | private Api1308Rep api1308Rep; |
| | | @Autowired |
| | | private Api1309Rep api1309Rep; |
| | | @Autowired |
| | | private Api1310Rep api1310Rep; |
| | | @Autowired |
| | | private ApiInfoDataRep apiInfoDataRep; |
| | | |
| | | @Override |
| | | public String getProtocol() { |
| | |
| | | |
| | | @Override |
| | | public void pushData(ApiParam param) { |
| | | log.info("------->>>>基础信息 接口模块上报开始"); |
| | | log.info("------->>>>粮库管理 接口模块上报开始"); |
| | | |
| | | //推送单位信息 |
| | | // this.pushData1301(apiRemoteService, param); |
| | | // this.pushData1302(apiRemoteService, param); |
| | | // this.pushData1303(apiRemoteService, param); |
| | | // this.pushData1304(apiRemoteService, param); |
| | | // this.pushData1305(apiRemoteService, param); |
| | | // this.pushData1306(apiRemoteService, param); |
| | | // this.pushData1307(apiRemoteService, param); |
| | | // this.pushData1308(apiRemoteService, param); |
| | | // this.pushData1309(apiRemoteService, param); |
| | | // this.pushData1310(apiRemoteService, param); |
| | | // this.pushData1311(apiRemoteService, param); |
| | | |
| | | log.info("------->>>>粮库管理 接口模块上报结束"); |
| | | } |
| | | |
| | | log.info("------->>>>基础信息 接口模块上报结束"); |
| | | /** |
| | | * 1301 安全管理 |
| | | */ |
| | | public void pushData1301(ApiRemoteService apiRemoteService, ApiParam param) { |
| | | //获取安全管理 |
| | | List<Api1301> list = api1301Rep.findPushDataByTime(param.getKqdm(), param.getStart(), param.getEnd()); |
| | | |
| | | if (null == list || list.isEmpty()) { |
| | | log.error("-----上海市平台2023版:未获取到安全管理,不推送-----"); |
| | | return; |
| | | } |
| | | param.setInteCategory(Constant.API_CATEGORY_13); |
| | | param.setInteId(SH2023Constant.SH_2023_API_CODE_1301); |
| | | |
| | | ResponseDto responseDto; |
| | | for (Api1301 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); |
| | | //更新状态 |
| | | api1301Rep.save(data); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 1302 温湿度检测 |
| | | */ |
| | | public void pushData1302(ApiRemoteService apiRemoteService, ApiParam param) { |
| | | //获取温湿度检测 |
| | | List<Api1302> list = api1302Rep.findPushDataByTime(param.getKqdm(), param.getStart(), param.getEnd()); |
| | | |
| | | if (null == list || list.isEmpty()) { |
| | | log.error("-----上海市平台2023版:未获取到温湿度检测,不推送-----"); |
| | | return; |
| | | } |
| | | param.setInteCategory(Constant.API_CATEGORY_13); |
| | | param.setInteId(SH2023Constant.SH_2023_API_CODE_1302); |
| | | |
| | | ResponseDto responseDto; |
| | | for (Api1302 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); |
| | | //更新状态 |
| | | api1302Rep.save(data); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 1303 害虫检测 |
| | | */ |
| | | public void pushData1303(ApiRemoteService apiRemoteService, ApiParam param) { |
| | | //获取害虫检测 |
| | | List<Api1303> list = api1303Rep.findPushDataByTime(param.getKqdm(), param.getStart(), param.getEnd()); |
| | | |
| | | if (null == list || list.isEmpty()) { |
| | | log.error("-----上海市平台2023版:未获取到害虫检测,不推送-----"); |
| | | return; |
| | | } |
| | | param.setInteCategory(Constant.API_CATEGORY_13); |
| | | param.setInteId(SH2023Constant.SH_2023_API_CODE_1303); |
| | | |
| | | ResponseDto responseDto; |
| | | for (Api1303 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); |
| | | //更新状态 |
| | | api1303Rep.save(data); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 1304 气体检测 |
| | | */ |
| | | public void pushData1304(ApiRemoteService apiRemoteService, ApiParam param) { |
| | | //获取气体检测 |
| | | List<Api1304> list = api1304Rep.findPushDataByTime(param.getKqdm(), param.getStart(), param.getEnd()); |
| | | |
| | | if (null == list || list.isEmpty()) { |
| | | log.error("-----上海市平台2023版:未获取到气体检测,不推送-----"); |
| | | return; |
| | | } |
| | | param.setInteCategory(Constant.API_CATEGORY_13); |
| | | param.setInteId(SH2023Constant.SH_2023_API_CODE_1304); |
| | | |
| | | ResponseDto responseDto; |
| | | for (Api1304 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); |
| | | //更新状态 |
| | | api1304Rep.save(data); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 1305 通风作业 |
| | | */ |
| | | public void pushData1305(ApiRemoteService apiRemoteService, ApiParam param) { |
| | | //获取通风作业 |
| | | List<Api1305> list = api1305Rep.findPushDataByTime(param.getKqdm(), param.getStart(), param.getEnd()); |
| | | |
| | | if (null == list || list.isEmpty()) { |
| | | log.error("-----上海市平台2023版:未获取到通风作业,不推送-----"); |
| | | return; |
| | | } |
| | | param.setInteCategory(Constant.API_CATEGORY_13); |
| | | param.setInteId(SH2023Constant.SH_2023_API_CODE_1305); |
| | | |
| | | ResponseDto responseDto; |
| | | for (Api1305 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); |
| | | //更新状态 |
| | | api1305Rep.save(data); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 1306 熏蒸作业 |
| | | */ |
| | | public void pushData1306(ApiRemoteService apiRemoteService, ApiParam param) { |
| | | //获取熏蒸作业 |
| | | List<Api1306> list = api1306Rep.findPushDataByTime(param.getKqdm(), param.getStart(), param.getEnd()); |
| | | |
| | | if (null == list || list.isEmpty()) { |
| | | log.error("-----上海市平台2023版:未获取到熏蒸作业,不推送-----"); |
| | | return; |
| | | } |
| | | param.setInteCategory(Constant.API_CATEGORY_13); |
| | | param.setInteId(SH2023Constant.SH_2023_API_CODE_1306); |
| | | |
| | | ResponseDto responseDto; |
| | | for (Api1306 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); |
| | | //更新状态 |
| | | api1306Rep.save(data); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 1307 仓内视频图像 |
| | | */ |
| | | public void pushData1307(ApiRemoteService apiRemoteService, ApiParam param) { |
| | | //获取仓内视频图像 |
| | | List<Api1307> list = api1307Rep.findPushDataByTime(param.getKqdm(), param.getStart(), param.getEnd()); |
| | | |
| | | if (null == list || list.isEmpty()) { |
| | | log.error("-----上海市平台2023版:未获取到仓内视频图像,不推送-----"); |
| | | return; |
| | | } |
| | | param.setInteCategory(Constant.API_CATEGORY_13); |
| | | param.setInteId(SH2023Constant.SH_2023_API_CODE_1307); |
| | | |
| | | ResponseDto responseDto; |
| | | for (Api1307 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); |
| | | //更新状态 |
| | | api1307Rep.save(data); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 1308 视频监控异常事件告警 |
| | | */ |
| | | public void pushData1308(ApiRemoteService apiRemoteService, ApiParam param) { |
| | | //TODO |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 1309 违规预警信息 |
| | | */ |
| | | public void pushData1309(ApiRemoteService apiRemoteService, ApiParam param) { |
| | | //TODO |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 1310 质检数据 |
| | | */ |
| | | public void pushData1310(ApiRemoteService apiRemoteService, ApiParam param) { |
| | | //获取质检数据 |
| | | List<Api1310> list = api1310Rep.findPushDataByTime(param.getKqdm(), param.getStart(), param.getEnd()); |
| | | |
| | | if (null == list || list.isEmpty()) { |
| | | log.error("-----上海市平台2023版:未获取到质检数据,不推送-----"); |
| | | return; |
| | | } |
| | | param.setInteCategory(Constant.API_CATEGORY_13); |
| | | param.setInteId(SH2023Constant.SH_2023_API_CODE_1310); |
| | | |
| | | ResponseDto responseDto; |
| | | for (Api1310 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); |
| | | //更新状态 |
| | | api1310Rep.save(data); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 1311 视频监控接口 |
| | | */ |
| | | public void pushData1311(ApiRemoteService apiRemoteService, ApiParam param) { |
| | | // 获取 视频监控接口数据 |
| | | List<ApiInfoData> items = apiInfoDataRep.getDataByInteId(SH2023Constant.SH_2023_API_CODE_1311); |
| | | |
| | | if (null == items || items.isEmpty()) { |
| | | log.error("-----上海市平台2023版:未获取到视频监控,不推送-----"); |
| | | return; |
| | | } |
| | | param.setInteCategory(Constant.API_CATEGORY_13); |
| | | param.setInteId(SH2023Constant.SH_2023_API_CODE_1311); |
| | | |
| | | SH2023Api1311 shApi1311; |
| | | ResponseDto responseDto; |
| | | for (ApiInfoData infoData : items) { |
| | | shApi1311 = JSONObject.parseObject(infoData.getData(), SH2023Api1311.class); |
| | | shApi1311.setZhgxsj(infoData.getUpdateTime()); |
| | | |
| | | param.setBizId(infoData.getDataId()); |
| | | responseDto = apiRemoteService.pushData(param, shApi1311); |
| | | if (responseDto.getSuccess() == 0) { |
| | | if (Constant.CZBZ_I.equals(infoData.getCzbz())) { |
| | | infoData.setCzbz(Constant.CZBZ_U); |
| | | apiInfoDataRep.save(infoData); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 2103 粮情设备配置 |
| | | */ |
| | | public void pushData2103(ApiRemoteService apiRemoteService, ApiParam param) { |
| | | |
| | | // 获取粮情设备配置数据 |
| | | List<ApiInfoData> items = apiInfoDataRep.getDataByInteId(SH2023Constant.SH_2023_API_CODE_2103); |
| | | |
| | | if (null == items || items.isEmpty()) { |
| | | log.error("-----上海市平台2023版:未获取到粮情设备配置,不推送-----"); |
| | | return; |
| | | } |
| | | param.setInteCategory(Constant.API_CATEGORY_13); |
| | | param.setInteId(SH2023Constant.SH_2023_API_CODE_2103); |
| | | |
| | | SH2023Api2103 shApi2103; |
| | | ResponseDto responseDto; |
| | | for (ApiInfoData infoData : items) { |
| | | shApi2103 = JSONObject.parseObject(infoData.getData(), SH2023Api2103.class); |
| | | shApi2103.setZhgxsj(infoData.getUpdateTime()); |
| | | param.setBizId(infoData.getDataId()); |
| | | responseDto = apiRemoteService.pushData(param, shApi2103); |
| | | if (responseDto.getSuccess() == 0) { |
| | | if (Constant.CZBZ_I.equals(infoData.getCzbz())) { |
| | | |
| | | infoData.setCzbz(Constant.CZBZ_U); |
| | | apiInfoDataRep.save(infoData); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |