| | |
| | | import cn.gistack.sm.sjztmd.mapper.SjztMdMapper; |
| | | import cn.gistack.sm.sjztmd.service.*; |
| | | import cn.gistack.sm.sjztmd.word.service.ISjztmdService; |
| | | import cn.gistack.sm.sjztmd.word.vo.TbWordVO; |
| | | import cn.gistack.sm.sjztmd.word.vo.*; |
| | | import cn.gistack.sm.sjztods.constant.ZtApiUrlConstant; |
| | | import cn.gistack.sm.sjztods.constant.ZtConfigConstant; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.fastjson.parser.Feature; |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | |
| | | @AllArgsConstructor |
| | | @DS("zt") |
| | | public class SjztmdServiceImpl implements ISjztmdService { |
| | | |
| | | //总计 |
| | | private final String RIBAO_SHEET1_TOTAL_URL = "/services/1234567890ABCDEFGHIJKLMN/ribao_sheet1/api?small_start_stag=0&small_end_stag=2&mid_start_stag=0&mid_end_stag=2&big_start_stag=0&big_end_stag=2"; |
| | | //中大型水库 |
| | | private final String RIBAO_SHEET2_ZDX_URL = "/services/1234567890ABCDEFGHIJKLMN/ribao/sheet2_zdx/api?mid_start_stag=0&mid_end_stag=2&big_start_stag=0&big_end_stag=2"; |
| | | //超汛明细 |
| | | private final String RIBAO_SHEET3_OVER_STAG_LIST_URL = "/services/1234567890ABCDEFGHIJKLMN/ribao/sheet3_over_stag_list/api?small_start_stag=0&small_end_stag=2&mid_start_stag=0&mid_end_stag=2&big_start_stag=0&big_end_stag=2"; |
| | | //省直管 |
| | | private final String SZ_INFO = "/services/1234567890ABCDEFGHIJKLMN/ribao/shengzh_new_rz/api"; |
| | | |
| | | @Autowired |
| | | private RestTemplate restTemplate; |
| | | private final SjztMdMapper mapper; |
| | |
| | | return tbWordVO; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public List<TotalInfo> getTotalInfo(){ |
| | | JSONObject ztData = this.getZtData(null, RIBAO_SHEET1_TOTAL_URL); |
| | | JSONArray data = ztData.getJSONArray("data"); |
| | | List<TotalInfo> list = data.toJavaList(TotalInfo.class); |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public List<DzkInfo> getDzkInfo() { |
| | | JSONObject ztData = this.getZtData(null, RIBAO_SHEET2_ZDX_URL); |
| | | JSONArray data = ztData.getJSONArray("data"); |
| | | List<DzkInfo> list = data.toJavaList(DzkInfo.class); |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public List<OverDetail> getOverDetailInfo() { |
| | | JSONObject ztData = this.getZtData(null, RIBAO_SHEET3_OVER_STAG_LIST_URL); |
| | | JSONArray data = ztData.getJSONArray("data"); |
| | | List<OverDetail> list = data.toJavaList(OverDetail.class); |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public List<SzInfo> getSzInfo() { |
| | | JSONObject ztData = this.getZtData(null, SZ_INFO); |
| | | JSONArray data = ztData.getJSONArray("data"); |
| | | List<SzInfo> list = data.toJavaList(SzInfo.class); |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * 调用接口获取中台数据 |
| | | */ |
| | |
| | | try { |
| | | //有请求头,有参数请求 |
| | | ResponseEntity<String> responseEntity = |
| | | restTemplate.exchange(url + params, |
| | | restTemplate.exchange(url, |
| | | HttpMethod.GET, |
| | | formEntity, |
| | | String.class); |