| | |
| | | import com.fzzy.push.sh2023.SH2023Constant; |
| | | import com.fzzy.push.sh2023.dto.SH2023Api1311; |
| | | import com.fzzy.push.sh2023.dto.SH2023Api2101; |
| | | import com.fzzy.push.sh2023.dto.SH2023ShareApi1311; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.apache.commons.lang.time.DateFormatUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.PageRequest; |
| | | import org.springframework.data.domain.Pageable; |
| | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 上海市接口-2101 检斤单 |
| | | * 上海市接口-1311 视频监控接口 |
| | | * |
| | | * @author czt |
| | | * @date 2023/8/17 |
| | |
| | | } |
| | | |
| | | //封装参数 |
| | | ApiParam param = new ApiParam(apiConf, "21", SH2023Constant.SH_2023_API_CODE_1311); |
| | | ApiParam param = new ApiParam(apiConf, "13", SH2023Constant.SH_2023_API_CODE_1311); |
| | | |
| | | //获取实现接口 |
| | | ApiRemoteService apiService = apiPushManager.getApiRemoteService(param.getPushProtocol()); |
| | |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 共享拉取数据 |
| | | * sHApi1311PR#pullData |
| | | * |
| | | * @return |
| | | */ |
| | | @Expose |
| | | public String pullData() { |
| | | |
| | | |
| | | //获取配置信息 |
| | | List<ApiConfs> apiConfs = apiCommonService.listCacheConf(); |
| | | if (null == apiConfs || apiConfs.isEmpty()) { |
| | | return "系统没有获取到库区配置信息,执行失败"; |
| | | } |
| | | |
| | | ApiRemoteService apiService; |
| | | ApiParam param; |
| | | ResponseDto responseDto; |
| | | ApiInfoData infoData; |
| | | String result = ""; |
| | | List<SH2023ShareApi1311> list; |
| | | SH2023Api1311 sh2023Api1311; |
| | | List<ApiInfoData> apiInfoDataList; |
| | | for (ApiConfs apiConf : apiConfs) { |
| | | apiService = apiPushManager.getApiRemoteService(apiConf.getPushProtocol()); |
| | | if (null == apiService) { |
| | | continue; |
| | | } |
| | | //封装参数 |
| | | param = new ApiParam(apiConf, "13", SH2023Constant.SH_2023_API_CODE_1311); |
| | | responseDto = apiService.pullData(param, apiConf); |
| | | |
| | | if (responseDto.getSuccess() == 0) { |
| | | list = JSONObject.parseArray(responseDto.getData(), SH2023ShareApi1311.class); |
| | | if(null != list && list.size() > 0){ |
| | | for (SH2023ShareApi1311 shareData : list) { |
| | | |
| | | apiInfoDataList = apiInfoDataRep.getDataByDataId(shareData.getSxtbh()); |
| | | if(null == apiInfoDataList || apiInfoDataList.isEmpty()){ |
| | | sh2023Api1311 = new SH2023Api1311(); |
| | | sh2023Api1311.setSpjksbid(shareData.getSxtbh()); |
| | | sh2023Api1311.setCzbz(Constant.CZBZ_I); |
| | | }else { |
| | | sh2023Api1311 = JSONObject.parseObject(apiInfoDataList.get(0).getData(), SH2023Api1311.class); |
| | | sh2023Api1311.setCzbz(apiInfoDataList.get(0).getCzbz()); |
| | | } |
| | | if(StringUtils.isNotEmpty(shareData.getHwdm())){ |
| | | sh2023Api1311.setHwdm(shareData.getHwdm()); |
| | | } |
| | | sh2023Api1311.setJksbmc(shareData.getTdmc()); |
| | | infoData = new ApiInfoData(); |
| | | infoData.setId(sh2023Api1311.getSpjksbid()); |
| | | infoData.setKqdm(apiConf.getKqdm()); |
| | | infoData.setInteType("13"); |
| | | infoData.setInteId(SH2023Constant.SH_2023_API_CODE_1311); |
| | | infoData.setUpdateTime(new Date()); |
| | | infoData.setDataId(sh2023Api1311.getSpjksbid()); |
| | | infoData.setData(JSON.toJSONString(sh2023Api1311)); |
| | | infoData.setCzbz(sh2023Api1311.getCzbz()); |
| | | apiInfoDataRep.save(infoData); |
| | | } |
| | | } |
| | | } |
| | | result += responseDto.toString(); |
| | | return result; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |