Commit 2c9c7a71 by lyy

Merge branch 'dev' of http://129.211.46.84:8800/platform/hp-smart into dev-sx

parents 7b878a56 b0cd033b
...@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject; ...@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baosight.eplat.be.dz.constants.BEDZConstants; import com.baosight.eplat.be.dz.constants.BEDZConstants;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation; import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.InventTypeEnum; import com.baosight.hpjx.common.InventTypeEnum;
import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.hpjx.core.security.UserSessionUtils; import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.util.DateUtils; import com.baosight.hpjx.util.DateUtils;
import com.baosight.hpjx.util.EiInfoUtils; import com.baosight.hpjx.util.EiInfoUtils;
...@@ -17,6 +18,7 @@ import com.baosight.iplat4j.core.service.impl.ServiceBase; ...@@ -17,6 +18,7 @@ import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.core.service.soa.XServiceManager; import com.baosight.iplat4j.core.service.soa.XServiceManager;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
import static com.baosight.eplat.be.dz.service.ServiceBEDZ04.PARAMS_KEY_STR; import static com.baosight.eplat.be.dz.service.ServiceBEDZ04.PARAMS_KEY_STR;
...@@ -259,7 +261,23 @@ public class ServiceHPBI003 extends ServiceBase { ...@@ -259,7 +261,23 @@ public class ServiceHPBI003 extends ServiceBase {
if (params.containsKey("date")){ if (params.containsKey("date")){
params.put("date", DateUtils.formatShort(params.get("date"))); params.put("date", DateUtils.formatShort(params.get("date")));
} }
return super.query(inInfo, "HPBI003.queryGX"); List<Map> listMap = DaoBase.getInstance().query("HPBI003.queryGX", params, 0,100);
Map<Object , List<Map>> mapList = listMap.stream().collect(Collectors.groupingBy(map -> map.get("groupName")));
List<Map> result = new ArrayList<>();
for (Object key: mapList.keySet()) {
Map<Object, Object> map = new HashMap<>();
List<Map> list1 = new ArrayList<>();
for (Map map1: mapList.get(key)) {
Map<String, Object> map2 = new HashMap<>();
map2.put("series", map1.get("series"));
map2.put("wt", map1.get("wt"));
list1.add(map2);
}
map.put(key, list1);
result.add(map);
}
inInfo.set("result", result);
return inInfo;
} }
/** /**
...@@ -298,7 +316,23 @@ public class ServiceHPBI003 extends ServiceBase { ...@@ -298,7 +316,23 @@ public class ServiceHPBI003 extends ServiceBase {
if (params.containsKey("date")){ if (params.containsKey("date")){
params.put("date", DateUtils.formatShort(params.get("date"))); params.put("date", DateUtils.formatShort(params.get("date")));
} }
return super.query(inInfo, "HPBI003.queryDayWts"); List<Map> result = new ArrayList<>();
List<Map> listMap = DaoBase.getInstance().query("HPBI003.queryDayWts", params, 0,100);
Map<Object , Map<Object,List<Map>>> mapList = listMap.stream().collect(Collectors.groupingBy(map -> map.get("date"),Collectors.groupingBy(map -> map.get("series"))));
for (Object key: mapList.keySet()) {
Map<Object, Object> map = new HashMap<>();
List<Map> list1 = new ArrayList<>();
Map<Object, List<Map>> listMap1 = mapList.get(key);
for (Object key1: listMap1.keySet()) {
Map<Object, Object> map2 = new HashMap<>();
map2.put(key1, listMap1.get(key1).stream().map(m -> m.get("wt")).collect(Collectors.toList()));
list1.add(map2);
}
map.put(key, list1);
result.add(map);
}
inInfo.set("result", result);
return inInfo;
} }
} }
...@@ -243,7 +243,7 @@ ...@@ -243,7 +243,7 @@
select select
SERIES as "series", SERIES as "series",
X as "groupName", X as "groupName",
VALUE as "wt" ROUND(VALUE, 2) as "wt"
from from
( (
select select
...@@ -483,12 +483,12 @@ ...@@ -483,12 +483,12 @@
select select
SERIES as "series", SERIES as "series",
X as "date", X as "date",
VALUE as "wt" ROUND(VALUE, 2) as "wt"
from from
( (
select select
a.GROUP_NAME as SERIES, a.GROUP_NAME as SERIES,
concat(substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 6 day), '-', ''), 5, 2), '/', substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 6 day), '-', ''), 7, 2)) as X, concat(substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 6 day), '-', ''), 5, 2), '', substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 6 day), '-', ''), 7, 2)) as X,
sum(ifnull(WEIGHT, 0)+ ifnull(WEIGHT_JH, 0))/ 2 as VALUE, sum(ifnull(WEIGHT, 0)+ ifnull(WEIGHT_JH, 0))/ 2 as VALUE,
replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 6 day), '-', '') as date, replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 6 day), '-', '') as date,
case case
...@@ -528,7 +528,7 @@ ...@@ -528,7 +528,7 @@
union all union all
select select
a.GROUP_NAME as SERIES, a.GROUP_NAME as SERIES,
concat(substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 5 day), '-', ''), 5, 2), '/', substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 5 day), '-', ''), 7, 2)) as X, concat(substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 5 day), '-', ''), 5, 2), '', substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 5 day), '-', ''), 7, 2)) as X,
sum(ifnull(WEIGHT, 0)+ ifnull(WEIGHT_JH, 0))/ 2 as VALUE , sum(ifnull(WEIGHT, 0)+ ifnull(WEIGHT_JH, 0))/ 2 as VALUE ,
replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 5 day), '-', '') as date, replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 5 day), '-', '') as date,
case case
...@@ -568,7 +568,7 @@ ...@@ -568,7 +568,7 @@
union all union all
select select
a.GROUP_NAME as SERIES, a.GROUP_NAME as SERIES,
concat(substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 4 day), '-', ''), 5, 2), '/', substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 4 day), '-', ''), 7, 2)) as X, concat(substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 4 day), '-', ''), 5, 2), '', substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 4 day), '-', ''), 7, 2)) as X,
sum(ifnull(WEIGHT, 0)+ ifnull(WEIGHT_JH, 0))/ 2 as VALUE , sum(ifnull(WEIGHT, 0)+ ifnull(WEIGHT_JH, 0))/ 2 as VALUE ,
replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 4 day), '-', '') as date, replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 4 day), '-', '') as date,
case case
...@@ -608,7 +608,7 @@ ...@@ -608,7 +608,7 @@
union all union all
select select
a.GROUP_NAME as SERIES, a.GROUP_NAME as SERIES,
concat(substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 3 day), '-', ''), 5, 2), '/', substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 3 day), '-', ''), 7, 2)) as X, concat(substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 3 day), '-', ''), 5, 2), '', substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 3 day), '-', ''), 7, 2)) as X,
sum(ifnull(WEIGHT, 0)+ ifnull(WEIGHT_JH, 0))/ 2 as VALUE , sum(ifnull(WEIGHT, 0)+ ifnull(WEIGHT_JH, 0))/ 2 as VALUE ,
replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 3 day), '-', '') as date, replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 3 day), '-', '') as date,
case case
...@@ -648,7 +648,7 @@ ...@@ -648,7 +648,7 @@
union all union all
select select
a.GROUP_NAME as SERIES, a.GROUP_NAME as SERIES,
concat(substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 2 day), '-', ''), 5, 2), '/', substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 2 day), '-', ''), 7, 2)) as X, concat(substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 2 day), '-', ''), 5, 2), '', substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 2 day), '-', ''), 7, 2)) as X,
sum(ifnull(WEIGHT, 0)+ ifnull(WEIGHT_JH, 0))/ 2 as VALUE , sum(ifnull(WEIGHT, 0)+ ifnull(WEIGHT_JH, 0))/ 2 as VALUE ,
replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 2 day), '-', '') as date, replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 2 day), '-', '') as date,
case case
...@@ -688,7 +688,7 @@ ...@@ -688,7 +688,7 @@
union all union all
select select
a.GROUP_NAME as SERIES, a.GROUP_NAME as SERIES,
concat(substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 1 day), '-', ''), 5, 2), '/', substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 1 day), '-', ''), 7, 2)) as X, concat(substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 1 day), '-', ''), 5, 2), '', substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 1 day), '-', ''), 7, 2)) as X,
sum(ifnull(WEIGHT, 0)+ ifnull(WEIGHT_JH, 0))/ 2 as VALUE , sum(ifnull(WEIGHT, 0)+ ifnull(WEIGHT_JH, 0))/ 2 as VALUE ,
replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 1 day), '-', '') as date, replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 1 day), '-', '') as date,
case case
...@@ -728,7 +728,7 @@ ...@@ -728,7 +728,7 @@
union all union all
select select
a.GROUP_NAME as SERIES, a.GROUP_NAME as SERIES,
concat(substring(#date#, 5, 2), '/', substring(#date#, 7, 2)) as X, concat(substring(#date#, 5, 2), '', substring(#date#, 7, 2)) as X,
sum(ifnull(WEIGHT, 0)+ ifnull(WEIGHT_JH, 0))/ 2 as VALUE , sum(ifnull(WEIGHT, 0)+ ifnull(WEIGHT_JH, 0))/ 2 as VALUE ,
#date# as date, #date# as date,
case case
...@@ -767,6 +767,6 @@ ...@@ -767,6 +767,6 @@
a.GROUP_NAME a.GROUP_NAME
) a ) a
order by order by
date, SORT asc date asc, SORT asc
</select> </select>
</sqlMap> </sqlMap>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment