| | |
| | | import com.bstek.dorado.annotation.Expose; |
| | | import com.fzzy.api.Constant; |
| | | import com.fzzy.api.data.ApiParam; |
| | | import com.fzzy.api.data.SyncProtocol; |
| | | import com.fzzy.api.dto.ResponseDto; |
| | | import com.fzzy.api.entity.ApiConfs; |
| | | import com.fzzy.api.entity.ApiInfoData; |
| | |
| | | import com.fzzy.api.service.ApiRemoteService; |
| | | import com.fzzy.api.view.repository.ApiInfoDataRep; |
| | | import com.fzzy.otherview.whhpjl.WhjlConstant; |
| | | import com.fzzy.otherview.whhpjl.dto.WhjlShareApi2002; |
| | | import com.fzzy.otherview.whhpjl.dto.WhjlShareApi2006; |
| | | import com.fzzy.otherview.whhpjl.dto.WhjlShareApi2006; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | |
| | | /** |
| | | * 获取列表信息 |
| | | * whjlShareApi2002PR#listData |
| | | * whjlShareApi2006PR#listData |
| | | * |
| | | * @return |
| | | */ |
| | | @DataProvider |
| | | public List<WhjlShareApi2002> listData() { |
| | | List<ApiInfoData> result = apiInfoDataRep.getDataByInteId(WhjlConstant.API_CODE_2002); |
| | | public List<WhjlShareApi2006> listData() { |
| | | List<ApiInfoData> result = apiInfoDataRep.getDataByInteId(WhjlConstant.API_CODE_2006); |
| | | if (null == result || result.isEmpty()) { |
| | | return null; |
| | | } |
| | | List<WhjlShareApi2002> list = new ArrayList<>(); |
| | | WhjlShareApi2002 whjlShareApiData; |
| | | List<WhjlShareApi2006> list = new ArrayList<>(); |
| | | WhjlShareApi2006 whjlShareApiData; |
| | | for (ApiInfoData infoData : result) { |
| | | whjlShareApiData = JSONObject.parseObject(infoData.getData(), WhjlShareApi2002.class); |
| | | whjlShareApiData = JSONObject.parseObject(infoData.getData(), WhjlShareApi2006.class); |
| | | whjlShareApiData.setKqdm(infoData.getKqdm()); |
| | | whjlShareApiData.setCzbz(infoData.getCzbz()); |
| | | whjlShareApiData.setUpdateTime(infoData.getUpdateTime()); |
| | |
| | | |
| | | /** |
| | | * 更新或修改 |
| | | * whjlShareApi2002PR#saveData |
| | | * whjlShareApi2006PR#saveData |
| | | * |
| | | * @param data |
| | | * @return |
| | | */ |
| | | @DataResolver |
| | | public void saveData(WhjlShareApi2002 data) { |
| | | public void saveData(WhjlShareApi2006 data) { |
| | | ApiInfoData infoData = new ApiInfoData(); |
| | | infoData.setId(data.getCpflbm()); |
| | | infoData.setId(data.getJlppbh()); |
| | | infoData.setKqdm(data.getKqdm()); |
| | | infoData.setInteType(WhjlConstant.API_CATEGORY_20); |
| | | infoData.setInteId(WhjlConstant.API_CODE_2002); |
| | | infoData.setInteId(WhjlConstant.API_CODE_2006); |
| | | infoData.setUpdateTime(new Date()); |
| | | infoData.setDataId(data.getCpflbm()); |
| | | infoData.setDataId(data.getJlppbh()); |
| | | infoData.setData(JSON.toJSONString(data)); |
| | | infoData.setCzbz(data.getCzbz()); |
| | | infoData.setRemarks("备注信息"); |
| | |
| | | |
| | | /** |
| | | * 删除 |
| | | * whjlShareApi2002PR#delData |
| | | * whjlShareApi2006PR#delData |
| | | * |
| | | * @param data |
| | | * @return |
| | | */ |
| | | @Expose |
| | | public String delData(WhjlShareApi2002 data) { |
| | | apiInfoDataRep.deleteById(data.getCpflbm()); |
| | | public String delData(WhjlShareApi2006 data) { |
| | | apiInfoDataRep.deleteById(data.getJlppbh()); |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 更新数据 |
| | | * whjlShareApi2002PR#pullData |
| | | * whjlShareApi2006PR#pullData |
| | | * |
| | | * @param items |
| | | * @return |
| | | */ |
| | | @Expose |
| | | public String pullData(List<WhjlShareApi2002> items) { |
| | | public String pullData(List<WhjlShareApi2006> items) { |
| | | |
| | | |
| | | //获取配置信息 |
| | |
| | | ResponseDto responseDto; |
| | | ApiInfoData infoData; |
| | | String result = ""; |
| | | List<WhjlShareApi2002> list; |
| | | List<WhjlShareApi2006> list; |
| | | for (ApiConfs apiConf : apiConfs) { |
| | | if(!apiConf.getSyncProtocol().equals(SyncProtocol.FZZY_V40_WHJL.getCode())){ |
| | | continue; |
| | | } |
| | | apiService = apiPushManager.getApiRemoteService(apiConf.getPushProtocol()); |
| | | if (null == apiService) { |
| | | continue; |
| | | } |
| | | //封装参数 |
| | | param = new ApiParam(apiConf, WhjlConstant.API_CATEGORY_20, WhjlConstant.API_CODE_2002); |
| | | param = new ApiParam(apiConf, WhjlConstant.API_CATEGORY_20, WhjlConstant.API_CODE_2006); |
| | | responseDto = apiService.pullData(param, apiConf); |
| | | |
| | | if (responseDto.getSuccess() == 0) { |
| | | list = JSONObject.parseArray(responseDto.getData(), WhjlShareApi2002.class); |
| | | list = JSONObject.parseArray(responseDto.getData(), WhjlShareApi2006.class); |
| | | if(null != list && list.size() > 0){ |
| | | for (WhjlShareApi2002 shareData : list) { |
| | | for (WhjlShareApi2006 shareData : list) { |
| | | shareData.setCzbz(Constant.CZBZ_U); |
| | | infoData = new ApiInfoData(); |
| | | infoData.setId(shareData.getCpflbm()); |
| | | infoData.setId(shareData.getJlppbh()); |
| | | infoData.setKqdm(apiConf.getKqdm()); |
| | | infoData.setInteType(WhjlConstant.API_CATEGORY_20); |
| | | infoData.setInteId(WhjlConstant.API_CODE_2002); |
| | | infoData.setInteId(WhjlConstant.API_CODE_2006); |
| | | infoData.setUpdateTime(new Date()); |
| | | infoData.setDataId(shareData.getCpflbm()); |
| | | infoData.setDataId(shareData.getJlppbh()); |
| | | infoData.setData(JSON.toJSONString(shareData)); |
| | | infoData.setCzbz(Constant.CZBZ_U); |
| | | apiInfoDataRep.save(infoData); |