ÎļþÃû´Ó src/main/java/com/fzzy/otherview/whhpjl/pr/WhjlApi1106PR.java ÐÞ¸Ä |
| | |
| | | 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.WhjlApi1106; |
| | | import com.fzzy.otherview.whhpjl.dto.WhjlApi1108; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * å»é´ä¿¡æ¯ |
| | | * è´§ä½ä¿¡æ¯ |
| | | * |
| | | * @Author:YAN |
| | | */ |
| | | @Component |
| | | public class WhjlApi1106PR { |
| | | public class WhjlApi1108PR { |
| | | |
| | | |
| | | @Autowired |
| | | private ApiCommonService apiCommonService; |
| | |
| | | |
| | | /** |
| | | * è·ååè¡¨ä¿¡æ¯ |
| | | * whjlApi1106PR#listData |
| | | * whjlApi1107PR#listData |
| | | * |
| | | * @return |
| | | */ |
| | | @DataProvider |
| | | public List<WhjlApi1106> listData() { |
| | | List<ApiInfoData> result = apiInfoDataRep.getDataByInteId(WhjlConstant.API_CODE_1106); |
| | | public List<WhjlApi1108> listData() { |
| | | List<ApiInfoData> result = apiInfoDataRep.getDataByInteId(WhjlConstant.API_CODE_1107); |
| | | if (null == result || result.isEmpty()) { |
| | | return null; |
| | | } |
| | | List<WhjlApi1106> list = new ArrayList<>(); |
| | | WhjlApi1106 whjlApi1106; |
| | | List<WhjlApi1108> list = new ArrayList<>(); |
| | | WhjlApi1108 whjlApi1107; |
| | | for (ApiInfoData infoData : result) { |
| | | whjlApi1106 = JSONObject.parseObject(infoData.getData(), WhjlApi1106.class); |
| | | whjlApi1106.setKqdm(infoData.getKqdm()); |
| | | whjlApi1106.setCzbz(infoData.getCzbz()); |
| | | whjlApi1106.setUpdateTime(infoData.getUpdateTime()); |
| | | whjlApi1106.setBizId(infoData.getDataId()); |
| | | list.add(whjlApi1106); |
| | | whjlApi1107 = JSONObject.parseObject(infoData.getData(), WhjlApi1108.class); |
| | | whjlApi1107.setKqdm(infoData.getKqdm()); |
| | | whjlApi1107.setCzbz(infoData.getCzbz()); |
| | | whjlApi1107.setUpdateTime(infoData.getUpdateTime()); |
| | | whjlApi1107.setBizId(infoData.getDataId()); |
| | | list.add(whjlApi1107); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * æ´æ°æä¿®æ¹ |
| | | * whjlApi1106PR#saveData |
| | | * whjlApi1107PR#saveData |
| | | * |
| | | * @param data |
| | | * @return |
| | | */ |
| | | @DataResolver |
| | | public void saveData(WhjlApi1106 data) { |
| | | public void saveData(WhjlApi1108 data) { |
| | | ApiInfoData infoData = new ApiInfoData(); |
| | | infoData.setId(data.getBizId()); |
| | | infoData.setKqdm(data.getKqdm()); |
| | | infoData.setInteType(WhjlConstant.API_CATEGORY_11); |
| | | infoData.setInteId(WhjlConstant.API_CODE_1106); |
| | | infoData.setInteId(WhjlConstant.API_CODE_1107); |
| | | infoData.setUpdateTime(new Date()); |
| | | infoData.setDataId(data.getBizId()); |
| | | infoData.setData(JSON.toJSONString(data)); |
| | |
| | | |
| | | /** |
| | | * å é¤ |
| | | * whjlApi1106PR#delData |
| | | * whjlApi1107PR#delData |
| | | * |
| | | * @param data |
| | | * @return |
| | | */ |
| | | @Expose |
| | | public String delData(WhjlApi1106 data) { |
| | | public String delData(WhjlApi1108 data) { |
| | | apiInfoDataRep.deleteById(data.getBizId()); |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * ä¸ä¼ |
| | | * whjlApi1106PR#pushData |
| | | * whjlApi1107PR#pushData |
| | | * |
| | | * @param items |
| | | * @return |
| | | */ |
| | | @Expose |
| | | public String pushData(List<WhjlApi1106> items) { |
| | | public String pushData(List<WhjlApi1108> items) { |
| | | |
| | | String result = ""; |
| | | |
| | |
| | | } |
| | | |
| | | //å°è£
åæ° |
| | | ApiParam param = new ApiParam(apiConf, WhjlConstant.API_CATEGORY_11, WhjlConstant.API_CODE_1106); |
| | | ApiParam param = new ApiParam(apiConf, WhjlConstant.API_CATEGORY_11, WhjlConstant.API_CODE_1107); |
| | | |
| | | //è·åå®ç°æ¥å£ |
| | | ApiRemoteService apiService = apiPushManager.getApiRemoteService(param.getPushProtocol()); |
| | |
| | | return "ç³»ç»æ²¡æå½åæ¨éåè®®é
ç½®ï¼æ§è¡å¤±è´¥"; |
| | | } |
| | | |
| | | ResponseDto responseDto; |
| | | //æ¨éï¼æ°æ®ä¸ºéåå½¢å¼ |
| | | |
| | | |
| | | //æ¨éæåï¼æ´æ°æ°æ®ä¸ä¼ ç¶æ |
| | | ApiInfoData infoData; |
| | | for (WhjlApi1106 data : items) { |
| | | ResponseDto responseDto; |
| | | for (WhjlApi1108 data : items) { |
| | | responseDto = apiService.pushData(param, apiConf, data); |
| | | if (responseDto.getSuccess() == 0) { |
| | | if (Constant.CZBZ_I.equals(data.getCzbz())) { |
| | |
| | | infoData.setId(data.getBizId()); |
| | | infoData.setKqdm(data.getKqdm()); |
| | | infoData.setInteType(WhjlConstant.API_CATEGORY_11); |
| | | infoData.setInteId(WhjlConstant.API_CODE_1106); |
| | | infoData.setInteId(WhjlConstant.API_CODE_1107); |
| | | infoData.setUpdateTime(new Date()); |
| | | infoData.setDataId(data.getBizId()); |
| | | |