大屏:出租装备分析
This commit is contained in:
parent
c7dde73e4f
commit
b517031534
|
|
@ -63,9 +63,12 @@ public class DevInfo extends BaseEntity {
|
|||
@ApiModelProperty(value = "设备数量")
|
||||
private Integer deviceCount;
|
||||
|
||||
@ApiModelProperty(value = "比例范围")
|
||||
@ApiModelProperty(value = "比率的范围,比如: x%-y%")
|
||||
private String ratioRange;
|
||||
|
||||
@ApiModelProperty(value = "比率,比如: 80%")
|
||||
private double ratio;
|
||||
|
||||
@ApiModelProperty(value = "单位")
|
||||
@NotBlank(message = "单位不能为空")
|
||||
private String unitName;
|
||||
|
|
|
|||
|
|
@ -213,5 +213,7 @@ public interface DevInfoMapper {
|
|||
int updateTotalDevLeaseDay();
|
||||
|
||||
List<DevInfo> getIdleDevRatio();
|
||||
|
||||
List<DevInfo> getLeaseCountByTypeName();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,6 +51,19 @@ public class LargeScreenController {
|
|||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@ApiOperation("出租装备分类占比")
|
||||
@GetMapping("/getLeaseCountByTypeName")
|
||||
public AjaxResult getLeaseCountByTypeName() {
|
||||
List<DevInfo> list = devInfoMapper.getLeaseCountByTypeName();
|
||||
Integer total = list.stream().mapToInt(DevInfo::getDeviceCount).sum();
|
||||
list.forEach(item -> {
|
||||
double ratio = total == 0 ? 0 : (double) item.getDeviceCount() / total;
|
||||
double ratioPercent = ratio * 100;
|
||||
item.setRatio(ratioPercent);
|
||||
});
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("订单数据")
|
||||
@GetMapping("/orderData")
|
||||
|
|
|
|||
|
|
@ -990,4 +990,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
ORDER BY
|
||||
ratio_range
|
||||
</select>
|
||||
|
||||
<select id="getLeaseCountByTypeName" resultType="com.bonus.material.device.domain.DevInfo">
|
||||
select mt3.type_name, count(1) as device_count
|
||||
from ma_order_details modd
|
||||
LEFT JOIN ma_dev_info mdi on modd.ma_id=mdi.ma_id
|
||||
LEFT JOIN ma_type mt4 on mt4.type_id=mdi.type_id
|
||||
LEFT JOIN ma_type mt3 on mt3.type_id=mt4.parent_id
|
||||
group by type_name
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue