| | |
| | | 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.gd2022.dto.GdApi1023Dtl; |
| | | import com.fzzy.otherview.gd2022.dto.GdApi1023People; |
| | | import com.fzzy.otherview.gd2022.dto.GdApi1023Way; |
| | | import com.fzzy.push.gd2022.dto.Gd2022Api1023; |
| | | import com.fzzy.push.gd2022.ApiCodeConstant; |
| | | import com.fzzy.push.sh2023.SH2023Constant; |
| | | import com.fzzy.push.sh2023.dto.SH2023Api2103; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.apache.commons.lang.time.DateFormatUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | * @return |
| | | */ |
| | | @DataProvider |
| | | public void listData(Page<GdApi1023> page, ApiParam param) { |
| | | public void listData(Page<Gd2022Api1023> page, ApiParam param) { |
| | | |
| | | Pageable pageable = PageRequest.of(page.getPageNo() - 1, page.getPageSize(), Sort.Direction.DESC, "updateTime"); |
| | | |
| | |
| | | @Override |
| | | public Predicate toPredicate(Root<ApiInfoData> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder criteriaBuilder) { |
| | | List<Predicate> predicates = new ArrayList<>(); //所有的断言 |
| | | Predicate predicate = criteriaBuilder.equal(root.get("inteId"), ApiCodeConstant.API_1023); |
| | | Predicate predicate = criteriaBuilder.equal(root.get("inteId"), ApiCodeConstant.API_9201); |
| | | predicates.add(predicate); |
| | | if (null != param) { |
| | | if (StringUtils.isNotBlank(param.getKqdm())) { |
| | |
| | | }; |
| | | org.springframework.data.domain.Page<ApiInfoData> japPage = apiInfoDataRep.findAll(specification, pageable); |
| | | page.setEntityCount((int) japPage.getTotalElements()); |
| | | List<GdApi1023> list = new ArrayList<>(); |
| | | GdApi1023 gdApi1023; |
| | | List<Gd2022Api1023> list = new ArrayList<>(); |
| | | Gd2022Api1023 GD2022Api1023; |
| | | for (ApiInfoData infoData : japPage.getContent()) { |
| | | gdApi1023 = JSONObject.parseObject(infoData.getData(), GdApi1023.class); |
| | | list.add(gdApi1023); |
| | | GD2022Api1023 = JSONObject.parseObject(infoData.getData(), Gd2022Api1023.class); |
| | | list.add(GD2022Api1023); |
| | | } |
| | | page.setEntities(list); |
| | | |
| | |
| | | * gDApi1023PR#saveData |
| | | */ |
| | | @DataResolver |
| | | public void saveData(GdApi1023 data) { |
| | | public void saveData(Gd2022Api1023 data) { |
| | | ApiInfoData infoData; |
| | | List<ApiInfoData> apiInfoList = apiInfoDataRep.getDataByInteAndData(ApiCodeConstant.API_1023, data.getXzbm(), data.getKqdm()); |
| | | List<ApiInfoData> apiInfoList = apiInfoDataRep.getDataByInteAndData(ApiCodeConstant.API_1023, DateFormatUtils.format(data.getTbrq(), "yyyyMMdd") + data.getXzbm(), data.getKqdm()); |
| | | if (apiInfoList.size() != 0) { |
| | | infoData = apiInfoList.get(0); |
| | | infoData.setData(JSON.toJSONString(data)); |
| | |
| | | * gDApi1023PR#delData |
| | | */ |
| | | @Expose |
| | | public void delData(GdApi1023 data) { |
| | | List<ApiInfoData> apiInfoList = apiInfoDataRep.getDataByInteAndData(ApiCodeConstant.API_1023, data.getXzbm(), data.getKqdm()); |
| | | public void delData(Gd2022Api1023 data) { |
| | | List<ApiInfoData> apiInfoList = apiInfoDataRep.getDataByInteAndData(ApiCodeConstant.API_1023, DateFormatUtils.format(data.getTbrq(), "yyyyMMdd") + data.getXzbm(), data.getKqdm()); |
| | | apiInfoDataRep.deleteById(apiInfoList.get(0).getId()); |
| | | } |
| | | |
| | |
| | | * gDApi1023PR#delUpdate |
| | | */ |
| | | @Expose |
| | | public String delUpdate(GdApi1023 data) { |
| | | public String delUpdate(Gd2022Api1023 data) { |
| | | if (null == data) { |
| | | return "无数据执行"; |
| | | } |
| | | List<ApiInfoData> apiInfoList = apiInfoDataRep.getDataByInteAndData(ApiCodeConstant.API_1023, data.getXzbm(), data.getKqdm()); |
| | | List<ApiInfoData> apiInfoList = apiInfoDataRep.getDataByInteAndData(ApiCodeConstant.API_1023, DateFormatUtils.format(data.getTbrq(), "yyyyMMdd") + data.getXzbm(), data.getKqdm()); |
| | | data.setCzbz(Constant.CZBZ_D); |
| | | apiInfoDataRep.updateStatus(apiInfoList.get(0).getId(), JSON.toJSONString(data), Constant.CZBZ_D); |
| | | return null; |
| | |
| | | * @return |
| | | */ |
| | | @Expose |
| | | public String pushData(List<GdApi1023> items) { |
| | | public String pushData(List<Gd2022Api1023> items) { |
| | | ResponseDto responseDto; |
| | | String result = ""; |
| | | |
| | |
| | | } |
| | | |
| | | //封装参数 |
| | | ApiParam param = new ApiParam(apiConf, "21", ApiCodeConstant.API_1023); |
| | | ApiParam param = new ApiParam(apiConf, "21", ApiCodeConstant.API_9201); |
| | | |
| | | //获取实现接口 |
| | | ApiRemoteService apiService = apiPushManager.getApiRemoteService(param.getPushProtocol()); |
| | |
| | | return "系统没有当前推送协议配置,执行失败"; |
| | | } |
| | | |
| | | //推送,数据为集合形式 |
| | | responseDto = apiService.pushData(param, apiConf, items); |
| | | if (responseDto.getSuccess() == 0) { |
| | | //推送成功,更新数据上传状态 |
| | | |
| | | ApiInfoData infoData; |
| | | for (GdApi1023 data : items) { |
| | | List<ApiInfoData> apiInfoList = apiInfoDataRep.getDataByInteAndData(ApiCodeConstant.API_1023, data.getXzbm(), 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); |
| | | ApiInfoData infoData; |
| | | for (Gd2022Api1023 data : items) { |
| | | //推送,数据为集合形式 |
| | | responseDto = apiService.pushData(param, apiConf, data); |
| | | if (responseDto.getSuccess() == 0) { |
| | | if (Constant.CZBZ_I.equals(data.getCzbz())) { |
| | | //推送成功,更新数据上传状态 |
| | | List<ApiInfoData> apiInfoList = apiInfoDataRep.getDataByInteAndData(ApiCodeConstant.API_9201, DateFormatUtils.format(data.getTbrq(), "yyyyMMdd") + data.getXzbm(), 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); |
| | | } |
| | | } |
| | | result += responseDto.toString(); |
| | | } |