Commit 183aebbb authored by 麻笑宇's avatar 麻笑宇

1.修改大屏气瓶较慢接口

parent 49aaef53
......@@ -51,7 +51,7 @@ public interface JgScrapCancelMapper extends BaseMapper<JgScrapCancel> {
List<EquipBizCountDto> queryScrappedDeviceStaticListData(DPFilterParamDto dpFilterParamDto);
Integer getScrappedDeviceCount(@Param("dpFilterParamDto") DPFilterParamDto dpFilterParamDto);
List<Map<String, Object>> getScrappedDeviceCount(@Param("dpFilterParamDto") DPFilterParamDto dpFilterParamDto);
List<CompanyEquipCountDto> queryForFlowingEquipList();
}
......@@ -95,7 +95,7 @@ public interface JgUseRegistrationMapper extends BaseMapper<JgUseRegistration> {
List<EquipBizCountDto> queryNewDeviceStaticListData(DPFilterParamDto dpFilterParamDto);
Integer getUseRegisterCount(@Param("dpFilterParamDto") DPFilterParamDto dpFilterParamDto);
List<Map<String,Object>> getUseRegisterCount(@Param("orgCode")String orgCode);
List<Map<String, Object>> getElevatorModeList(@Param("equIds") List<String> equIds);
......
......@@ -272,14 +272,12 @@
c.equ_category,
c.equ_define
</select>
<select id="getScrappedDeviceCount" resultType="java.lang.Integer">
<select id="getScrappedDeviceCount" resultType="java.util.Map">
select
count(1) as num
count(1) as num,c.time
from
(SELECT
ri.equ_list,
ri.equ_category,
ri.equ_define,
date_format(A.audit_pass_date , '%Y-%m') as time,
concat(u.PROVINCE,'#', u.CITY,'#', u.COUNTY) as areaCode
FROM
"tzs_jg_scrap_cancel_eq" ae,
......@@ -291,14 +289,13 @@
AND ri.EQU_CATEGORY = '2300'
and ae.equ_id = u."RECORD"
and u."RECORD" = ri."RECORD"
and (a.audit_pass_date between #{dpFilterParamDto.beginDate} and #{dpFilterParamDto.endDate})
and a.cancel_type ='1'
and a.audit_status='已完成'
) c
where
c.areaCode like concat('%',#{dpFilterParamDto.cityCode}, '%')
group by
c.equ_category
c.time
</select>
<select id="queryForFlowingEquipList" resultType="com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto">
......
......@@ -929,16 +929,12 @@
c.equ_category,
c.equ_define
</select>
<select id="getUseRegisterCount" resultType="java.lang.Integer">
SELECT COUNT(1) AS num
<select id="getUseRegisterCount" resultType="java.util.Map">
SELECT COUNT(1) AS num,C.time
FROM
(
SELECT
ri.equ_list,
ri.equ_category,
ri.equ_define,
A.audit_pass_date,
concat ( u.PROVINCE, '#', u.CITY, '#', u.COUNTY ) AS areaCode
date_format(A.audit_pass_date , '%Y-%m') as time
FROM
"tzs_jg_use_registration_eq" ae,
tzs_jg_use_registration A,
......@@ -949,14 +945,12 @@
AND ri.EQU_CATEGORY = '2300'
AND A.sequence_nbr = ae.equip_transfer_id
AND u."RECORD" = ri."RECORD"
and (a.audit_pass_date between #{dpFilterParamDto.beginDate} and #{dpFilterParamDto.endDate})
AND A.status = '已完成'
AND A.is_delete = 0
AND A.supervision_org_code LIKE concat (#{orgCode}, '%' )
) C
WHERE
C.areaCode LIKE concat ( '%', #{dpFilterParamDto.cityCode}, '%' )
GROUP BY
C.equ_category
C.time
</select>
<select id="getElevatorModeList" resultType="java.util.Map">
......
......@@ -508,19 +508,29 @@ public class JGDPStatisticsServiceImpl {
result.put("legendData", legendDataList);
LocalDate today = LocalDate.now();
List xDataList = new ArrayList();
List<Integer> newDeviceList = new ArrayList();
List<Integer> scrappedDeviceList = new ArrayList();
DateTimeFormatter sdf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
List<Object> newDeviceList = new ArrayList();
List<Object> scrappedDeviceList = new ArrayList();
DateTimeFormatter sdf = DateTimeFormatter.ofPattern("yyyy-MM");
String orgCode = stCommonService.getAndSetOrgCode(dpFilterParamDto.getCityCode());
List<Map<String,Object>> useRegisterCountList = useRegistrationMapper.getUseRegisterCount(orgCode);
List<Map<String,Object>> scrappedDeviceCountList = scrapCancelMapper.getScrappedDeviceCount(dpFilterParamDto);
Map<String,Object> useRegisterCount = new HashMap<>();
Map<String,Object> scrappedDeviceCount = new HashMap<>();
if(CollectionUtils.isNotEmpty(useRegisterCountList)) {
useRegisterCountList.forEach(item -> {
useRegisterCount.put(item.get("time") + "", item.get("num"));
});
}
if(CollectionUtils.isNotEmpty(scrappedDeviceCountList)) {
scrappedDeviceCountList.forEach(item -> {
scrappedDeviceCount.put(item.get("time") + "", item.get("num"));
});
}
for (int i = 2; i >= 0; i--) {
LocalDate firstDayOfPrevMonth = today.minusMonths(i).with(TemporalAdjusters.firstDayOfMonth());
LocalDate lastDayOfPrevMonth = today.minusMonths(i).with(TemporalAdjusters.lastDayOfMonth());
dpFilterParamDto.setBeginDate(LocalDateTime.of(firstDayOfPrevMonth, java.time.LocalTime.MIN).format(sdf));
dpFilterParamDto.setEndDate(LocalDateTime.of(lastDayOfPrevMonth, java.time.LocalTime.MAX).format(sdf));
Integer useRegisterCount = useRegistrationMapper.getUseRegisterCount(dpFilterParamDto);
Integer scrappedDeviceCount = scrapCancelMapper.getScrappedDeviceCount(dpFilterParamDto);
xDataList.add(firstDayOfPrevMonth.getMonthValue() + "月");
newDeviceList.add(null == useRegisterCount ? 0 : useRegisterCount);
scrappedDeviceList.add(null == scrappedDeviceCount ? 0 : scrappedDeviceCount);
today.minusMonths(i).format(sdf);
xDataList.add(today.minusMonths(i).format(sdf));
newDeviceList.add(null == useRegisterCount.get(today.minusMonths(i).format(sdf)) ? 0 : Integer.valueOf(useRegisterCount.get(today.minusMonths(i).format(sdf))+""));
scrappedDeviceList.add(null == scrappedDeviceCount.get(today.minusMonths(i).format(sdf)) ? 0 : Integer.valueOf(scrappedDeviceCount.get(today.minusMonths(i).format(sdf))+""));
}
result.put("xdata", xDataList);
result.put("newDevice", newDeviceList);
......
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