Commit 786e8a7e authored by 麻笑宇's avatar 麻笑宇

气瓶大屏统计增加

1.充装量、卸液量总数 2.区域气站对接率排名
parent 27afc1e1
......@@ -27,4 +27,10 @@ public interface CylinderStatisticsMapper {
* @return 办证数量
*/
Long countForCylinderCertNum(String orgCode);
Long countFillingVolumeCount(@Param("orgCode") String orgCode);
Long countDischargeVolumeCount(@Param("orgCode") String orgCode);
Long countEnterpriseUsed(@Param("orgCode") String orgCode);
}
......@@ -44,4 +44,34 @@
and a.equ_category_code = '2300'
and c.org_code like concat(#{orgCode},'%')
</select>
<select id="countFillingVolumeCount" resultType="java.lang.Long">
SELECT SUM
( T.filling_quantity )
FROM
tz_cylinder_filling_record T
INNER JOIN tz_base_enterprise_info E ON T.app_id = E.app_id
WHERE
E.supervise_org_code LIKE concat ( #{orgCode}, '%' )
</select>
<select id="countDischargeVolumeCount" resultType="java.lang.Long">
SELECT SUM
( T.offloading_volume )
FROM
tz_cylinder_offloading T
INNER JOIN tz_base_enterprise_info E ON T.app_id = E.app_id
WHERE
E.supervise_org_code LIKE concat ( #{orgCode}, '%' )
</select>
<select id="countEnterpriseUsed" resultType="java.lang.Long">
SELECT COUNT
( DISTINCT ( E.app_id ) )
FROM
tz_cylinder_filling_record
T INNER JOIN tz_base_enterprise_info E ON T.app_id = E.app_id
WHERE
E.supervise_org_code LIKE concat ( #{orgCode}, '%' )
</select>
</mapper>
......@@ -100,4 +100,11 @@ public class CylinderDPStatisticsController extends BaseController {
return ResponseHelper.buildResponse(dpStatisticsService.cylinderIssueMonthList(regionCode.toString()));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "区域气站对接率排名")
@PostMapping(value = "/stationRate")
public ResponseModel<List<Map<String, Object>>> stationRate(@RequestBody DPFilterParamDto dpFilterParamDto) {
return ResponseHelper.buildResponse(dpStatisticsService.stationRate(dpFilterParamDto));
}
}
......@@ -281,8 +281,14 @@ public class CylinderDPStatisticsServiceImpl {
result.put("jylqsbCount", this.countForCylinderTemporaryInspect(orgCode));
// 检验超期气瓶数
result.put("jycqsbCount", this.countForCylinderOverdueInspect(orgCode));
// 充气量
Long fillingVolumeCount = cylinderStatisticsMapper.countFillingVolumeCount(orgCode);
result.put("fillingVolumeCount", fillingVolumeCount == null ? 0L : fillingVolumeCount);
// 卸液量
Long dischargeVolumeCount = cylinderStatisticsMapper.countDischargeVolumeCount(orgCode);
result.put("dischargeVolumeCount", dischargeVolumeCount == null ? 0L : dischargeVolumeCount);
} else {
this.setDefaultValueIfNoData(result, "cylindersCount", "stationCount", "operatorCount", "liquefiedGasCount", "automotiveGasCount", "industrialGasCount", "useRegistrationQuantityCount", "jylqsbCount", "jycqsbCount");
this.setDefaultValueIfNoData(result, "cylindersCount", "stationCount", "operatorCount", "liquefiedGasCount", "automotiveGasCount", "industrialGasCount", "useRegistrationQuantityCount", "jylqsbCount", "jycqsbCount","fillingVolumeCount","dischargeVolumeCount");
}
return result;
}
......@@ -405,4 +411,34 @@ public class CylinderDPStatisticsServiceImpl {
String time = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM"));
return statisticsMapper.cylinderIssueMonthList(orgCode, time);
}
public List<Map<String, Object>> stationRate(DPFilterParamDto dpFilterParamDto) {
List<RegionModel> regionList = stCommonService.setRegionIfRootParent(dpFilterParamDto.getCityCode());
List<Map<String,Object>> returnList = regionList.parallelStream().map(r -> {
String orgCode = stCommonService.getAndSetOrgCode(r.getRegionCode().toString());
Map<String, Object> item = new HashMap<>();
item.put("regionCode", r.getRegionCode());
item.put("regionName", r.getRegionName());
getStationRate(orgCode, item);
return item;
}).collect(Collectors.toList());
Collections.sort(returnList, (o1, o2) -> ((Double)o2.get("stationRate")).compareTo((Double)o1.get("stationRate")));
return returnList;
}
private Map<String,Object> getStationRate(String orgCode,Map<String,Object> result){
// 气站总数
Long totalNum = cylinderStatisticsMapper.countEnterpriseNumForCylinder(orgCode);
// 已对接总数
Long count = cylinderStatisticsMapper.countEnterpriseUsed(orgCode);
if(totalNum != null && count != null){
result.put("stationRate",count.doubleValue()/totalNum.doubleValue());
}else{
result.put("stationRate",0.0);
}
result.put("totalNum",totalNum);
result.put("count",count);
return result;
}
}
\ 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