Commit 31259e12 authored by 刘林's avatar 刘林

Merge remote-tracking branch 'origin/develop_tzs_register_to_0715' into…

Merge remote-tracking branch 'origin/develop_tzs_register_to_0715' into develop_tzs_register_to_0715
parents 33b4c6b1 d6978261
......@@ -59,6 +59,16 @@ public class DPFilterParamForDetailDto {
private String companyName;
/**
* 维保单位名称
*/
private String maintenanceCompanyName;
/**
* 地市名称
*/
private String regionName;
/**
* 报警类型code
*/
private String typeCode;
......
package com.yeejoin.amos.boot.module.common.api.enums;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
public enum JYJCBusinessTypeEnum {
DQJY("DQJY","定期检验"),
SCJY("SCJY","首次检验"),
AZJDJY("AZJDJY","安装监督检验"),
GZJDJY("GZJDJY","改造监督检验"),
WXJDJY("WXJDJY","维修监督检验"),
DTJC("DTJC","电梯检测");
private JYJCBusinessTypeEnum(String code, String name){
this.code=code;
this.name=name;
}
private String code;
private String name;
public String getCode() {
return code;
}
public String getName() {
return name;
}
public static List<HashMap<String,Object>> getEnumList() {
List<HashMap<String, Object>> list = new ArrayList<>();
for (JYJCBusinessTypeEnum testEnum : EnumSet.allOf(JYJCBusinessTypeEnum.class)) {
HashMap<String, Object> map = new HashMap<>();
map.put("title",testEnum.name);
map.put("value",testEnum.code);
list.add(map);
}
return list;
}
}
......@@ -11,6 +11,7 @@ import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionApplicationMode
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
import java.util.Set;
......@@ -87,6 +88,12 @@ public interface JyjcInspectionApplicationMapper extends BaseMapper<JyjcInspecti
Long queryAllPendingAndFinishedCount(@Param("orgCode") String orgCode, @Param("dpFilterParamDto") DPFilterParamDto dpFilterParamDto);
Long queryAllFinishedCount(@Param("orgCode") String orgCode, @Param("dpFilterParamDto") DPFilterParamDto dpFilterParamDto);
Long countBizFinishedNumForDP(@Param("orgCode") String orgCode, @Param("dto") DPFilterParamDto dpFilterParamDto, @Param("businessType") String businessType);
Long countAllInFlowingForDPNoFinishedBizData(@Param("orgCode") String orgCode, @Param("dto") DPFilterParamDto dpFilterParamDto, @Param("businessType") String businessType);
Page<Map<String, Object>> getInspectDetailList(@Param("page") Page<Map<String, Object>> page, @Param("orgCode") String orgCode, @Param("dto") DPFilterParamDto filterParamDto, @Param("businessType") String businessType);
}
......@@ -335,4 +335,58 @@
and EXISTS (select 1 from tz_jyjc_inspection_result r where r.result_status='2' and a.application_no = r.application_no)
and date_ge(CAST(a.accept_date as date),#{dpFilterParamDto.beginDate}) and date_le(CAST(a.accept_date as date),#{dpFilterParamDto.endDate})
</select>
<select id="countBizFinishedNumForDP" resultType="java.lang.Long">
SELECT
count(1)
FROM
"tz_jyjc_inspection_application" a,
tz_base_enterprise_info b
where
a.inspection_unit_code= b.use_unit_code
and ((b.supervise_org_code != '50' and b.supervise_org_code LIKE CONCAT (#{orgCode}, '%')) or (b.supervise_org_code = '50' and b.office_region LIKE CONCAT ('%', #{dto.cityCode}, '%')))
and a.status = '6616'
and date_ge(CAST(a.accept_date as date),#{dto.beginDate})
and date_le(CAST(a.accept_date as date),#{dto.endDate})
<if test="businessType !=null and businessType !=''">
and a.inspection_type = #{businessType}
</if>
</select>
<select id="countAllInFlowingForDPNoFinishedBizData" resultType="java.lang.Long">
SELECT
count(1)
FROM
"tz_jyjc_inspection_application" a,
tz_base_enterprise_info b
where
a.inspection_unit_code= b.use_unit_code
and ((b.supervise_org_code != '50' and b.supervise_org_code LIKE CONCAT (#{orgCode}, '%')) or (b.supervise_org_code = '50' and b.office_region LIKE CONCAT ('%', #{dto.cityCode}, '%')))
and a.status != '6610' and a.status != '6615' and a.status != '6617' and a.status != '6616'
and date_ge(CAST(a.application_date as date),#{dto.beginDate})
and date_le(CAST(a.application_date as date),#{dto.endDate})
<if test="businessType !=null and businessType !=''">
and a.inspection_type = #{businessType}
</if>
</select>
<select id="getInspectDetailList" resultType="java.util.Map">
SELECT
a.sequence_nbr as sequenceNbr,application_unit_name as unitName,inspection_unit_name as receiveOrgName,application_date as createDate,accept_date as handleDate
FROM
"tz_jyjc_inspection_application" a,
tz_base_enterprise_info b
where
a.inspection_unit_code= b.use_unit_code
and ((b.supervise_org_code != '50' and b.supervise_org_code LIKE CONCAT (#{orgCode}, '%')) or (b.supervise_org_code = '50' and b.office_region LIKE CONCAT ('%', #{dto.cityCode}, '%')))
and a.status = '6616'
and date_ge(CAST(a.accept_date as date),#{dto.beginDate})
and date_le(CAST(a.accept_date as date),#{dto.endDate})
<if test="dto.companyName != null and dto.companyName != ''">
and application_unit_name like CONCAT('%', #{dto.companyName}, '%')
</if>
<if test="dto.superviseUnitName != null and dto.superviseUnitName != ''">
and inspection_unit_name like CONCAT('%', #{dto.superviseUnitName}, '%')
</if>
<if test="businessType !=null and businessType !=''">
and a.inspection_type = #{businessType}
</if>
</select>
</mapper>
......@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.dto.JyjcInspectionApplicationDto;
import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto;
import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamForDetailDto;
import com.yeejoin.amos.boot.module.jyjc.api.dto.InspectionTimelinesDto;
import com.yeejoin.amos.boot.module.jyjc.api.dto.PublicityInspectOrgInfoDto;
import com.yeejoin.amos.boot.module.statistcs.biz.service.impl.JYJCDPStatisticsServiceImpl;
......@@ -214,6 +215,28 @@ public class JYJCDPStatisticsController {
public ResponseModel<List<Map<String,Object>>> handleStatus() {
return ResponseHelper.buildResponse(statisticsService.handleStatus());
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/inspectApplication/getBusinessType")
@ApiOperation(httpMethod = "POST", value = "大屏检验检测下钻获取检验类型", notes = "大屏检验检测下钻获取检验类型")
public ResponseModel<List<Map<String, Object>>> getBusinessType(@RequestBody DPFilterParamForDetailDto dpFilterParamForDetailDto) {
return ResponseHelper.buildResponse(statisticsService.getBusinessType(dpFilterParamForDetailDto));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/inspectApplication/getInspectDetail")
@ApiOperation(httpMethod = "POST", value = "大屏检验检测下钻获取上部图表", notes = "大屏检验检测下钻获取上部图表")
public ResponseModel<Map<String, Object>> getInspectDetail(@RequestBody DPFilterParamForDetailDto dpFilterParamForDetailDto) {
return ResponseHelper.buildResponse(statisticsService.getInspectDetail(dpFilterParamForDetailDto));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/inspectApplication/getInspectDetailList")
@ApiOperation(httpMethod = "POST", value = "大屏检验检测下钻获取下部列表", notes = "大屏检验检测下钻获取下部列表")
public ResponseModel<Page<Map<String, Object>>> getInspectDetailList(@RequestBody DPFilterParamForDetailDto dpFilterParamForDetailDto) {
Page<Map<String, Object>> page = new Page<>(dpFilterParamForDetailDto.getCurrent(),dpFilterParamForDetailDto.getSize());
return ResponseHelper.buildResponse(statisticsService.getInspectDetailList(dpFilterParamForDetailDto, page));
}
}
......
package com.yeejoin.amos.boot.module.statistcs.biz.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto;
import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamForDetailDto;
import com.yeejoin.amos.boot.module.common.api.entity.AlertUseUnitStatistics;
import com.yeejoin.amos.boot.module.statistcs.biz.service.impl.YJDPStatisticsServiceImpl;
import com.yeejoin.amos.boot.module.statistics.api.dto.AlertUseUnitStatisticsDto;
import com.yeejoin.amos.boot.module.ymt.api.dto.AlertPaperInfoDto;
......@@ -20,9 +22,8 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
* 大屏统计controller
......@@ -193,4 +194,36 @@ public class YJDPStatisticsController {
public ResponseModel<IPage<Map<String, Object>>> alertRecordTableForDP(DPFilterParamForDetailDto recordFilterVo) {
return statisticsService.alertRecordTableForDP(recordFilterVo);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "月度困人故障高发使用单位-右上角更多-地市月度应急事件高发使用单位-侧边树",
notes = "月度困人故障高发使用单位-右上角更多-地市月度应急事件高发使用单位-侧边树")
@PostMapping("/alertUnitOption/dp")
public ResponseModel<Object> alertUnitOption() {
List<JSONObject> subList = Collections.singletonList(new JSONObject()
.fluentPut("value", "use")
.fluentPut("title", "使用单位"));
JSONObject jsonObject = new JSONObject()
.fluentPut("title", "企业类型")
.fluentPut("value", "all")
.fluentPut("children", subList);
return ResponseHelper.buildResponse(jsonObject);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "月度困人故障高发使用单位-右上角更多-地市月度应急事件高发使用单位-柱状图",
notes = "月度困人故障高发使用单位-右上角更多-地市月度应急事件高发使用单位-柱状图")
@PostMapping("/alertUnitBarChart/dp")
public ResponseModel<JSONObject> alertUnitBarChartForDP(@Validated @RequestBody DPFilterParamForDetailDto detailDto) {
return statisticsService.alertUnitBarChartForDP(detailDto);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "月度困人故障高发使用单位-右上角更多-地市月度应急事件高发使用单位-表格",
notes = "月度困人故障高发使用单位-右上角更多-地市月度应急事件高发使用单位-表格")
@PostMapping("/alertUseUnitTable/dp")
public ResponseModel<IPage<AlertUseUnitStatistics>> alertUseUnitTableForDP(@Validated @RequestBody DPFilterParamForDetailDto detailDto) {
return statisticsService.alertUseUnitTableForDP(detailDto);
}
}
......@@ -1574,7 +1574,7 @@ public class JGDPStatisticsServiceImpl {
itemResult.put("xdata", r.getRegionName());
List<Long> ydata = this.countBizFinishedNumForDetail(filterParamDto, dpFilterParamForDetailDto.getBusinessType());
BigDecimal finishedNum = BigDecimal.valueOf(ydata.stream().mapToLong(Long::longValue).sum());
List<Long> everyInFlow = countBizDataInFlowing(filterParamDto);
List<Long> everyInFlow = countBizDataInFlowingForDetail(filterParamDto, dpFilterParamForDetailDto.getBusinessType());
BigDecimal everyNum = BigDecimal.valueOf(everyInFlow.stream().mapToLong(Long::longValue).sum());
BigDecimal all = everyNum.add(finishedNum);
if (all.compareTo(BigDecimal.ZERO) > 0) {
......
......@@ -8,6 +8,8 @@ import com.yeejoin.amos.boot.biz.common.dto.CountDto;
import com.yeejoin.amos.boot.biz.common.dto.JyjcInspectionApplicationDto;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto;
import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamForDetailDto;
import com.yeejoin.amos.boot.module.common.api.enums.JYJCBusinessTypeEnum;
import com.yeejoin.amos.boot.module.jyjc.api.dto.InspectTimeCountDto;
import com.yeejoin.amos.boot.module.jyjc.api.dto.InspectionTimelinesDto;
import com.yeejoin.amos.boot.module.jyjc.api.dto.PublicityInspectOrgInfoDto;
......@@ -42,6 +44,8 @@ import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
......@@ -718,4 +722,110 @@ public class JYJCDPStatisticsServiceImpl {
result = result.stream().sorted(Comparator.comparing(map -> (Integer) map.get("code"))).collect(Collectors.toList());
return result;
}
public List<Map<String, Object>> getBusinessType(DPFilterParamForDetailDto dpFilterParamForDetailDto) {
List<HashMap<String, Object>> enumList = JYJCBusinessTypeEnum.getEnumList();
List<Map<String,Object>> result = new ArrayList<>();
Map<String,Object> map = new HashMap<>();
map.put("title","业务类型");
map.put("value","0");
map.put("children",enumList);
result.add(map);
return result;
}
public Map<String,Object> getInspectDetail(DPFilterParamForDetailDto dpFilterParamForDetailDto) {
//查询子区域
List<RegionModel> regionModels = stCommonService.setRegionIfRootParent(dpFilterParamForDetailDto.getCityCode());
List<Map<String, Object>> result = regionModels.parallelStream().map(r -> {
DPFilterParamDto filterParamDto = new DPFilterParamDto();
filterParamDto.setCityCode(r.getRegionCode().toString());
if (null != dpFilterParamForDetailDto.getTimeSearchOne()) {
filterParamDto.setBeginDate(dpFilterParamForDetailDto.getTimeSearchOne().getBeginDate());
filterParamDto.setEndDate(dpFilterParamForDetailDto.getTimeSearchOne().getEndDate());
}
Map<String, Object> itemResult = new HashMap<>();
itemResult.put("xdata", r.getRegionName());
Long ydata = this.countBizFinishedNumForDetail(filterParamDto, dpFilterParamForDetailDto.getBusinessType());
BigDecimal finishedNum = BigDecimal.valueOf(ydata);
Long everyInFlow = this.countBizDataInFlowingForDetail(filterParamDto,dpFilterParamForDetailDto.getBusinessType());
BigDecimal everyNum = BigDecimal.valueOf(everyInFlow);
BigDecimal all = everyNum.add(finishedNum);
if (all.compareTo(BigDecimal.ZERO) > 0) {
BigDecimal percent = finishedNum.divide(all, 2, RoundingMode.HALF_UP);
BigDecimal percentX100 = percent.multiply(new BigDecimal("100")).setScale(0, RoundingMode.HALF_UP);
itemResult.put("percentData", percentX100.toPlainString());
} else {
itemResult.put("percentData", "0");
}
itemResult.put("finishedNum", finishedNum);
return itemResult;
}).collect(Collectors.toList());
Map<String,Object> returnMap = new HashMap<>();
List<Map<String,Object>> legendData = new ArrayList<>();
for(int i = 0;i<2; i++){
Map<String,Object> map = new HashMap<>();
if(i == 0){
map.put("dataKey","finishedNum");
map.put("value","总数");
map.put("chartType","bar");
}else{
map.put("dataKey","percentData");
map.put("value","完结率");
map.put("chartType","line");
}
legendData.add(map);
}
returnMap.put("legendData",legendData);
List xdata = new ArrayList();
List finishedNum = new ArrayList();
List percentData = new ArrayList();
for(int i = 0;i<result.size();i++){
xdata.add(result.get(i).get("xdata"));
finishedNum.add(result.get(i).get("finishedNum"));
percentData.add(result.get(i).get("percentData"));
}
returnMap.put("xdata",xdata);
returnMap.put("finishedNum",finishedNum);
returnMap.put("percentData",percentData);
return returnMap;
}
private Long countBizFinishedNumForDetail(DPFilterParamDto dpFilterParamDto,String businessType) {
// 1.统计各业务办理量注意要和x轴顺序一致
String orgCode = stCommonService.getAndSetOrgCode(dpFilterParamDto.getCityCode());
// 省、市、区县为按照行政区划进行编码的,公司的code为行政区划编码
if (orgCode == null) {
return 0L;
}
return inspectionApplicationMapper.countBizFinishedNumForDP(orgCode, dpFilterParamDto,businessType);
}
private Long countBizDataInFlowingForDetail(DPFilterParamDto dpFilterParamDto,String businessType) {
String orgCode = stCommonService.getAndSetOrgCode(dpFilterParamDto.getCityCode());
if (orgCode == null) {
return 0L;
}
return inspectionApplicationMapper.countAllInFlowingForDPNoFinishedBizData(orgCode, dpFilterParamDto,businessType);
}
public Page<Map<String, Object>> getInspectDetailList(DPFilterParamForDetailDto dpFilterParamForDetailDto, Page<Map<String, Object>> page) {
String orgCode = stCommonService.getAndSetOrgCode(dpFilterParamForDetailDto.getCityCode());
DPFilterParamDto filterParamDto = new DPFilterParamDto();
filterParamDto.setCityCode(dpFilterParamForDetailDto.getCityCode());
filterParamDto.setCompanyName(dpFilterParamForDetailDto.getCompanyName());
filterParamDto.setSuperviseUnitName(dpFilterParamForDetailDto.getSuperviseUnitName());
if (null != dpFilterParamForDetailDto.getTimeSearchOne()) {
filterParamDto.setBeginDate(dpFilterParamForDetailDto.getTimeSearchOne().getBeginDate());
filterParamDto.setEndDate(dpFilterParamForDetailDto.getTimeSearchOne().getEndDate());
}
Page<Map<String, Object>> maps = inspectionApplicationMapper.getInspectDetailList(page, orgCode, filterParamDto, dpFilterParamForDetailDto.getBusinessType());
return maps;
}
}
......@@ -535,10 +535,82 @@ public class YJDPStatisticsServiceImpl {
public ResponseModel<IPage<Map<String, Object>>> alertRecordTableForDP(DPFilterParamForDetailDto recordFilterVo) {
String orgCode = stCommonService.getAndSetOrgCode(recordFilterVo.getCityCode());
if (orgCode == null) {
return ResponseHelper.buildResponse(new Page<>());
}
if (!ValidationUtil.isEmpty(recordFilterVo.getTreeValue())){
recordFilterVo.setAlertTypeCode(recordFilterVo.getTreeValue());
}
Page<Map<String, Object>> mapPage = alertStatisticsMapper.alertRecordForPage(new Page<>(recordFilterVo.getCurrent(), recordFilterVo.getSize()),recordFilterVo,orgCode);
return ResponseHelper.buildResponse(mapPage);
}
public ResponseModel<JSONObject> alertUnitBarChartForDP(DPFilterParamForDetailDto detailDto){
JSONObject res = new JSONObject();
JSONArray legendData = new JSONArray();
legendData.add(new JSONObject()
.fluentPut("dataKey", "alertUnitTotal")
.fluentPut("value", "故障高发企业总数")
.fluentPut("chartType", "bar"));
List<RegionModel> regionList = stCommonService.setRegionIfRootParentAndNoAccessIf3Level(ValidationUtil.isEmpty(detailDto.getCityCode()) ? "610000" : detailDto.getCityCode());
List<String> xData = regionList.stream()
.map(RegionModel::getRegionName)
.filter(regionName -> !"西咸新区".equals(regionName))
.collect(Collectors.toList());
List<? extends Number> alertUnitTotal = regionList.stream()
.map(region -> {
String orgCode = stCommonService.getAndSetOrgCode(String.valueOf(region.getRegionCode()));
if (ValidationUtil.isEmpty(orgCode)) {
return 0L;
}
return alertUseUnitStatisticsMapper.selectCount(new QueryWrapper<AlertUseUnitStatistics>().lambda()
.likeRight(AlertUseUnitStatistics::getSupervisoryUnitOrgCode, orgCode)
.isNotNull(AlertUseUnitStatistics::getUseUnitCode));
}).collect(Collectors.toList());
res.put("legendData", legendData);
res.put("xdata", xData);
res.put("alertUnitTotal", alertUnitTotal);
return ResponseHelper.buildResponse(res);
}
public ResponseModel<IPage<AlertUseUnitStatistics>> alertUseUnitTableForDP(DPFilterParamForDetailDto detailDto){
Page<AlertUseUnitStatistics> page = new Page<>();
page.setCurrent(detailDto.getCurrent());
page.setSize(detailDto.getSize());
String orgCode = stCommonService.getAndSetOrgCode(ValidationUtil.isEmpty(detailDto.getCityCode()) ? "610000" : detailDto.getCityCode());
if (orgCode == null) {
return ResponseHelper.buildResponse(page);
}
LambdaQueryWrapper<AlertUseUnitStatistics> lambda = new QueryWrapper<AlertUseUnitStatistics>().lambda();
lambda.isNotNull(AlertUseUnitStatistics::getUseUnitCode);
// 地市搜索
if (!ValidationUtil.isEmpty(detailDto.getRegionName())) {
List<RegionModel> regionList = stCommonService.setRegionIfRootParentAndNoAccessIf3Level(
ValidationUtil.isEmpty(detailDto.getCityCode()) ? "610000" : detailDto.getCityCode()
);
RegionModel matchedRegion = regionList.stream()
.filter(region -> detailDto.getRegionName().equals(region.getRegionName()))
.findFirst()
.orElseThrow(() -> new IllegalArgumentException("Region not found"));
String cityOrgCode = stCommonService.getAndSetOrgCode(String.valueOf(matchedRegion.getRegionCode()));
lambda.likeRight(AlertUseUnitStatistics::getSupervisoryUnitOrgCode, cityOrgCode);
}else {
lambda.likeRight(AlertUseUnitStatistics::getSupervisoryUnitOrgCode, orgCode);
}
// 使用单位
if (!ValidationUtil.isEmpty(detailDto.getCompanyName())){
lambda.like(AlertUseUnitStatistics::getUseUnit, detailDto.getCompanyName());
}
// 维保单位
if (!ValidationUtil.isEmpty(detailDto.getMaintenanceCompanyName())){
lambda.like(AlertUseUnitStatistics::getMaintenanceUnit, detailDto.getMaintenanceCompanyName());
}
IPage<AlertUseUnitStatistics> alertUseUnitStatistics = alertUseUnitStatisticsMapper.selectPage(page, lambda);
return ResponseHelper.buildResponse(alertUseUnitStatistics);
}
}
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