From e5563d727384f85dfff16d4b305a710f4e28e271 Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Mon, 22 Mar 2021 19:40:50 +0800
Subject: [PATCH] 包裹详情接口调用,在线设备接口修改

---
 blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/parcel/service/impl/ParcelServiceImpl.java |   89 +++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 82 insertions(+), 7 deletions(-)

diff --git a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/parcel/service/impl/ParcelServiceImpl.java b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/parcel/service/impl/ParcelServiceImpl.java
index d6bf3f5..ead9ef1 100644
--- a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/parcel/service/impl/ParcelServiceImpl.java
+++ b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/parcel/service/impl/ParcelServiceImpl.java
@@ -31,6 +31,12 @@
 	@Value("${PARCEL_URL}")
 	private String PARCEL_URL;
 
+	@Value("${PARCEL_PICTURE_URL}")
+	private String PARCEL_PICTURE_URL;
+
+	@Value("${PARCEL_DETAIL_RUL}")
+	private String PARCEL_DETAIL_RUL;
+
 
 
 	/**
@@ -44,7 +50,6 @@
 		if (null!=conditionVo.getStatus()) {
 			//获取数据
 			List<Object> objectList = getParcelData(conditionVo,PARCEL_CONTRABAND_URL,PARCEL_KEY,PARCEL_SECRET);
-			System.out.println("objectList = " + objectList);
 			Map<String,String> mapCode = new HashMap<>();
 			//遍历集合,存储所有的违禁包裹编码
 			for (Object object : objectList) {
@@ -53,6 +58,7 @@
 				//将所有的违禁包裹编码存起来
 				mapCode.put(objectMap.get("objCode").toString(),objectMap.get("objCode").toString());
 			}
+			System.out.println("mapCode = " + mapCode);
 			//遍历违禁编码map数据
 			List<Map<String,Object>> list = new ArrayList<>();
 			for (String value:mapCode.values()) {
@@ -139,6 +145,7 @@
 			//12.封装数据
 			list.add(listTime);
 			list.add(parcelList);
+			list.add(getKindServenDataList());
 			//13.返回
 			return list;
 		}
@@ -156,7 +163,7 @@
 	 */
 	private List<Object> getParcelData(ConditionVo conditionVo, String url, String key, String secret) {
 		//1.创建map对象,用于存储请求接口的秘钥
-		Map<String, String> map = new HashMap<>();
+		Map<String, Object> map = new HashMap<>();
 		String startDate = null;
 		String endDate = null;
 		//2.2查询本天的数据
@@ -189,6 +196,7 @@
 		String params = HttpClientUtils.httpPost(url, key, secret, map);
 		//5.数据转换
 		Map<String, Object> data = (Map<String, Object>) JSONObject.parse(params);
+		//System.out.println("data = " + data);
 		return JSON.parseArray(data.get("result").toString());
 	}
 
@@ -229,12 +237,21 @@
 	 */
 	@Override
 	public Map<String, Object> selectParcelData() {
+		HashMap<String, Object> map = new HashMap<>();
+		map.put("parcelData",getKindServenDataList());
+		return map;
+	}
+
+	/**
+	 * 获取危险违禁品7天内每天的数量集合
+	 * @return
+	 */
+	public List<Integer> getKindServenDataList(){
 		ConditionVo conditionVo = new ConditionVo();
 		conditionVo.setStatus(1);//近7天status 为 1
 		//获取数据
 		List<Object> objectList = getParcelData(conditionVo,PARCEL_CONTRABAND_URL,PARCEL_KEY,PARCEL_SECRET);
 		//遍历违禁编码map数据
-		HashMap<String, Object> map = new HashMap<>();
 		List<String> times = DateUtils.pastDay(new SimpleDateFormat("yyyy-MM-dd").format(new Date()));
 		List<Integer> list = new ArrayList<>();
 		for (String time:times) {
@@ -244,14 +261,72 @@
 				Map<String, Object> objectMap = (Map<String, Object>) object;//取出list里面的值转为map
 				//对比时间和objCode,危险品,刀具,枪支等
 				if (time.equals(objectMap.get("dateStr").toString()) ){
-					if (objectMap.get("objCode").toString().equals("gan")) {
-						count += Integer.parseInt(objectMap.get("objCount").toString());
-					}
+//					//枪支
+//					if (objectMap.get("objCode").toString().equals("gan")) {
+//						count += Integer.parseInt(objectMap.get("objCount").toString());
+//					}
+//					//刀具
+//					if (objectMap.get("objCode").toString().equals("knife")) {
+//						count += Integer.parseInt(objectMap.get("objCount").toString());
+//					}
+//					//爆炸物
+//					if (objectMap.get("objCode").toString().equals("boomExplosive")) {
+//						count += Integer.parseInt(objectMap.get("objCount").toString());
+//					}
+					//3-20 修改不筛选危险品,由第三方筛选好
+					count += Integer.parseInt(objectMap.get("objCount").toString());
 				}
 			}
 			list.add(count);
 		}
-		map.put("parcelData",list);
+		return list;
+	}
+
+	/**
+	 * 获取图片地址
+	 * @param imgUrl 图片Url
+	 * @return
+	 */
+	@Override
+	public Map<String, String> getParcelPic(String imgUrl) {
+		//截取图片imgKey信息
+		String[] imgKeys = imgUrl.split("=", imgUrl.length());
+		String imgKey = imgKeys[1];
+		//封装成map对象
+		HashMap<String, String> map = new HashMap<>();
+		map.put("imgKey",imgKey);
+		//执行http远程调用
+		String s = HttpClientUtils.doGetHeaderPictureBase64(PARCEL_PICTURE_URL, PARCEL_KEY, PARCEL_SECRET, map);
+		map.put("imgBase64",s);
 		return map;
 	}
+
+	/**
+	 * 获取包裹明细分页数据,远程调用api获取数据
+	 * @param conditionVo  请求参数对象
+	 * @return
+	 */
+	@Override
+	public Object getParcelDetailPage(ConditionVo conditionVo) {
+		HashMap<String, Object> map = new HashMap<>();
+		if (null!=conditionVo.getStartTime()){
+			map.put("startTime", conditionVo.getStartTime());
+		}
+		if (null!=conditionVo.getEndTime()){
+			map.put("endTime", conditionVo.getEndTime());
+		}
+		if (null!=conditionVo.getDecisioDiagramResult()){
+			map.put("decisioDiagramResult", conditionVo.getDecisioDiagramResult());
+		}
+		if (null!=conditionVo.getCurrentPage()){
+			map.put("currentPage", conditionVo.getCurrentPage());
+		}
+		if (null!=conditionVo.getPageSize()){
+			map.put("pageSize", conditionVo.getPageSize());
+		}
+		String params = HttpClientUtils.httpPost(PARCEL_DETAIL_RUL, PARCEL_KEY, PARCEL_SECRET, map);
+		Map<String, Object> data = (Map<String, Object>) JSONObject.parse(params);
+		//4.远程调用数据
+		return JSONObject.parse(data.get("result").toString());
+	}
 }

--
Gitblit v1.9.3