From 2c2b1ab406d3049a0e69fff01e3daade5cbe90ea Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Thu, 08 Apr 2021 19:59:26 +0800
Subject: [PATCH] 预警数量统计接口修改,新增按时间条件查询条件,违禁品统计接口修改
---
blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/parcel/service/impl/ParcelServiceImpl.java | 40 +++++++++++++++++++++++++++++-----------
1 files changed, 29 insertions(+), 11 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 d44455b..322d7c8 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
@@ -210,9 +210,7 @@
if (null!=conditionVo.getStartTime() && conditionVo.getStartTime()!=""
&& null != conditionVo.getEndTime() && conditionVo.getEndTime()!=""){
startDate = conditionVo.getStartTime().substring(0,10);
- System.out.println("startDate = " + startDate);
endDate = conditionVo.getEndTime().substring(0,10);
- System.out.println("endDate = " + endDate);
}
map.put("startDate", startDate);
map.put("endDate", endDate);
@@ -239,16 +237,26 @@
//获取包裹数据
List<Object> parcelData = getParcelData(conditionVo, PARCEL_URL, PARCEL_KEY, PARCEL_SECRET);
if (null!=parcelData) {
- //查询当天的包裹总数
- Integer dangerCount = null;
- Integer contrabandCount = null;
- conditionVo.setStatus(0);
- if (conditionVo.getStatus() == 0) {
+ //声明包裹和物品数量
+ Integer dangerCount = 0;
+ Integer contrabandCount = 0;
+ if (null!=conditionVo.getStartTime()){
for (Object object : parcelData) {
//取出list里面的值转为map
Map<String, Object> objectMap = (Map<String, Object>) object;
- dangerCount = Integer.parseInt(objectMap.get("dangerCount").toString()); //违禁包裹数量
- contrabandCount = Integer.parseInt(objectMap.get("contrabandCount").toString()); //违禁物品数量
+ dangerCount += Integer.parseInt(objectMap.get("dangerCount").toString()); //违禁包裹数量
+ contrabandCount += Integer.parseInt(objectMap.get("contrabandCount").toString()); //违禁物品数量
+ }
+ }else {
+ //查询当天的包裹总数
+ conditionVo.setStatus(0);
+ if (conditionVo.getStatus() == 0) {
+ for (Object object : parcelData) {
+ //取出list里面的值转为map
+ Map<String, Object> objectMap = (Map<String, Object>) object;
+ dangerCount = Integer.parseInt(objectMap.get("dangerCount").toString()); //违禁包裹数量
+ contrabandCount = Integer.parseInt(objectMap.get("contrabandCount").toString()); //违禁物品数量
+ }
}
}
//封装数据
@@ -276,14 +284,22 @@
* @return
*/
public List<Integer> getKindServenDataList(ConditionVo conditionVo){
- if (null==conditionVo){
+ if (null==conditionVo.getStartTime()){
conditionVo.setStatus(1);//近7天status 为 1
}
//获取数据
List<Object> objectList = getParcelData(conditionVo,PARCEL_CONTRABAND_URL,PARCEL_KEY,PARCEL_SECRET);
+ List<String> times = new ArrayList<>();
if (null!=objectList) {
//遍历违禁编码map数据
- List<String> times = DateUtils.pastDay(new SimpleDateFormat("yyyy-MM-dd").format(new Date()));
+ //获取时间
+ if (null!=conditionVo.getStatus()) {
+ times = DateUtils.pastDay(new SimpleDateFormat("yyyy-MM-dd").format(new Date()));
+ }
+ if (null!=conditionVo.getStartTime()){
+ times = DateUtils.getTimeOverOneDate(conditionVo.getStartTime(),conditionVo.getEndTime());
+ }
+
List<Integer> list = new ArrayList<>();
for (String time : times) {
Integer count = 0;
@@ -381,8 +397,10 @@
*/
@Override
public Object getParcelkindDetailPage(ConditionVo conditionVo) {
+ System.out.println("conditionVo = " + conditionVo);
//获取违禁品数据
String result = getParcelDataPageList(conditionVo, PARCEL_KIND_URL, PARCEL_KEY, PARCEL_SECRET).get("result").toString();
+ System.out.println("result = " + result);
if (null!=result) {
return JSONObject.parse(result);
}
--
Gitblit v1.9.3