设备分类--型号数、设备数
型号列表--累计激活,在线率
This commit is contained in:
parent
70012d0746
commit
56f9e7a7d6
|
@ -1,6 +1,8 @@
|
|||
package com.ruoyi.device.domain;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
|
@ -13,6 +15,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
|
|||
* @date 2023-11-11
|
||||
*/
|
||||
@Data
|
||||
@TableName(value = "as_device")
|
||||
public class AsDevice extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.ruoyi.device.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import lombok.Data;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
@ -11,6 +12,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
|
|||
* @date 2023-11-11
|
||||
*/
|
||||
@Data
|
||||
@TableName(value = "as_device_classify")
|
||||
public class AsDeviceClassify extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
@ -25,10 +27,10 @@ public class AsDeviceClassify extends BaseEntity
|
|||
|
||||
/** 型号数 */
|
||||
@Excel(name = "型号数")
|
||||
private String modelNum;
|
||||
private Integer modelNum;
|
||||
|
||||
/** 设备数 */
|
||||
@Excel(name = "设备数")
|
||||
private String deviceNum;
|
||||
private Integer deviceNum;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.ruoyi.device.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
@ -11,6 +12,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
|
|||
* @date 2023-11-11
|
||||
*/
|
||||
@Data
|
||||
@TableName(value = "as_device_version")
|
||||
public class AsDeviceVersion extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.ruoyi.device.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
@ -11,6 +12,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
|
|||
* @date 2023-11-11
|
||||
*/
|
||||
@Data
|
||||
@TableName(value = "as_model")
|
||||
public class AsModel extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
@ -49,4 +51,12 @@ public class AsModel extends BaseEntity
|
|||
@Excel(name = "产品介绍")
|
||||
private String introduce;
|
||||
|
||||
/** 累计激活 */
|
||||
@Excel(name = "累计激活")
|
||||
private Integer activationNum;
|
||||
|
||||
/** 在线率 */
|
||||
@Excel(name = "在线率")
|
||||
private String onlineRate;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package com.ruoyi.device.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.device.domain.AsDeviceClassify;
|
||||
|
||||
/**
|
||||
|
@ -9,7 +11,7 @@ import com.ruoyi.device.domain.AsDeviceClassify;
|
|||
* @author qiuzhenzhao
|
||||
* @date 2023-11-11
|
||||
*/
|
||||
public interface AsDeviceClassifyMapper
|
||||
public interface AsDeviceClassifyMapper extends BaseMapper<AsDeviceClassify>
|
||||
{
|
||||
/**
|
||||
* 查询设备分类
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
package com.ruoyi.device.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.device.domain.AsDevice;
|
||||
import com.ruoyi.system.domain.SysStudent;
|
||||
|
||||
/**
|
||||
* 设备列表Mapper接口
|
||||
|
@ -9,7 +12,7 @@ import com.ruoyi.device.domain.AsDevice;
|
|||
* @author 邱贞招
|
||||
* @date 2023-11-11
|
||||
*/
|
||||
public interface AsDeviceMapper
|
||||
public interface AsDeviceMapper extends BaseMapper<AsDevice>
|
||||
{
|
||||
/**
|
||||
* 查询设备列表
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package com.ruoyi.device.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.device.domain.AsDeviceClassify;
|
||||
import com.ruoyi.device.domain.AsDeviceVersion;
|
||||
|
||||
/**
|
||||
|
@ -9,7 +12,7 @@ import com.ruoyi.device.domain.AsDeviceVersion;
|
|||
* @author qiuzhenzhao
|
||||
* @date 2023-11-11
|
||||
*/
|
||||
public interface AsDeviceVersionMapper
|
||||
public interface AsDeviceVersionMapper extends BaseMapper<AsDeviceVersion>
|
||||
{
|
||||
/**
|
||||
* 查询固件版本
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package com.ruoyi.device.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.device.domain.AsDeviceVersion;
|
||||
import com.ruoyi.device.domain.AsModel;
|
||||
|
||||
/**
|
||||
|
@ -9,7 +12,7 @@ import com.ruoyi.device.domain.AsModel;
|
|||
* @author qiuzhenzhao
|
||||
* @date 2023-11-11
|
||||
*/
|
||||
public interface AsModelMapper
|
||||
public interface AsModelMapper extends BaseMapper<AsModel>
|
||||
{
|
||||
/**
|
||||
* 查询型号列表
|
||||
|
|
|
@ -1,9 +1,15 @@
|
|||
package com.ruoyi.device.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.device.domain.AsDevice;
|
||||
import com.ruoyi.device.domain.AsModel;
|
||||
import com.ruoyi.device.mapper.AsDeviceMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.ruoyi.device.mapper.AsModelMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.device.mapper.AsDeviceClassifyMapper;
|
||||
import com.ruoyi.device.domain.AsDeviceClassify;
|
||||
|
@ -18,7 +24,7 @@ import javax.annotation.Resource;
|
|||
* @date 2023-11-11
|
||||
*/
|
||||
@Service
|
||||
public class AsDeviceClassifyServiceImpl implements IAsDeviceClassifyService
|
||||
public class AsDeviceClassifyServiceImpl extends ServiceImpl<AsDeviceClassifyMapper, AsDeviceClassify> implements IAsDeviceClassifyService
|
||||
{
|
||||
@Resource
|
||||
private AsDeviceClassifyMapper asDeviceClassifyMapper;
|
||||
|
@ -26,6 +32,9 @@ public class AsDeviceClassifyServiceImpl implements IAsDeviceClassifyService
|
|||
@Resource
|
||||
private AsDeviceMapper asDeviceMapper;
|
||||
|
||||
@Resource
|
||||
private AsModelMapper asModelMapper;
|
||||
|
||||
/**
|
||||
* 查询设备分类
|
||||
*
|
||||
|
@ -47,9 +56,21 @@ public class AsDeviceClassifyServiceImpl implements IAsDeviceClassifyService
|
|||
@Override
|
||||
public List<AsDeviceClassify> selectAsDeviceClassifyList(AsDeviceClassify asDeviceClassify)
|
||||
{
|
||||
//型号数,设备数
|
||||
// asDeviceMapper
|
||||
return asDeviceClassifyMapper.selectAsDeviceClassifyList(asDeviceClassify);
|
||||
List<AsDeviceClassify> deviceClassifies = asDeviceClassifyMapper.selectAsDeviceClassifyList(asDeviceClassify);
|
||||
QueryWrapper<AsDevice> queryWrapper = Wrappers.query();
|
||||
QueryWrapper<AsModel> modelWrapper = Wrappers.query();
|
||||
for (AsDeviceClassify deviceClassify : deviceClassifies) {
|
||||
//设备数
|
||||
queryWrapper.eq("classify_id",deviceClassify.getClassifyId());
|
||||
Integer deviceNum = asDeviceMapper.selectCount(queryWrapper);
|
||||
deviceClassify.setDeviceNum(deviceNum);
|
||||
|
||||
//型号数
|
||||
modelWrapper.eq("classify_id",deviceClassify.getClassifyId());
|
||||
Integer modelNum = asModelMapper.selectCount(modelWrapper);
|
||||
deviceClassify.setModelNum(modelNum);
|
||||
}
|
||||
return deviceClassifies;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package com.ruoyi.device.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -15,7 +17,7 @@ import com.ruoyi.device.service.IAsDeviceService;
|
|||
* @date 2023-11-11
|
||||
*/
|
||||
@Service
|
||||
public class AsDeviceServiceImpl implements IAsDeviceService
|
||||
public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> implements IAsDeviceService
|
||||
{
|
||||
@Autowired
|
||||
private AsDeviceMapper asDeviceMapper;
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
package com.ruoyi.device.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.device.domain.AsDeviceClassify;
|
||||
import com.ruoyi.device.mapper.AsDeviceClassifyMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.device.mapper.AsDeviceVersionMapper;
|
||||
|
@ -15,7 +19,7 @@ import com.ruoyi.device.service.IAsDeviceVersionService;
|
|||
* @date 2023-11-11
|
||||
*/
|
||||
@Service
|
||||
public class AsDeviceVersionServiceImpl implements IAsDeviceVersionService
|
||||
public class AsDeviceVersionServiceImpl extends ServiceImpl<AsDeviceVersionMapper, AsDeviceVersion> implements IAsDeviceVersionService
|
||||
{
|
||||
@Autowired
|
||||
private AsDeviceVersionMapper asDeviceVersionMapper;
|
||||
|
|
|
@ -1,13 +1,26 @@
|
|||
package com.ruoyi.device.service.impl;
|
||||
|
||||
import java.math.RoundingMode;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.device.domain.AsDevice;
|
||||
import com.ruoyi.device.domain.AsDeviceVersion;
|
||||
import com.ruoyi.device.mapper.AsDeviceMapper;
|
||||
import com.ruoyi.device.mapper.AsDeviceVersionMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.device.mapper.AsModelMapper;
|
||||
import com.ruoyi.device.domain.AsModel;
|
||||
import com.ruoyi.device.service.IAsModelService;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 型号列表Service业务层处理
|
||||
*
|
||||
|
@ -15,11 +28,14 @@ import com.ruoyi.device.service.IAsModelService;
|
|||
* @date 2023-11-11
|
||||
*/
|
||||
@Service
|
||||
public class AsModelServiceImpl implements IAsModelService
|
||||
public class AsModelServiceImpl extends ServiceImpl<AsModelMapper, AsModel> implements IAsModelService
|
||||
{
|
||||
@Autowired
|
||||
@Resource
|
||||
private AsModelMapper asModelMapper;
|
||||
|
||||
@Resource
|
||||
private AsDeviceMapper deviceMapper;
|
||||
|
||||
/**
|
||||
* 查询型号列表
|
||||
*
|
||||
|
@ -41,7 +57,30 @@ public class AsModelServiceImpl implements IAsModelService
|
|||
@Override
|
||||
public List<AsModel> selectAsModelList(AsModel asModel)
|
||||
{
|
||||
return asModelMapper.selectAsModelList(asModel);
|
||||
List<AsModel> models = asModelMapper.selectAsModelList(asModel);
|
||||
QueryWrapper<AsDevice> queryWrapper = Wrappers.query();
|
||||
for (AsModel model: models) {
|
||||
//累计激活 device表--activation_time激活时间不为null
|
||||
queryWrapper.isNotNull("activation_time").ne("activation_time","");
|
||||
Integer activationNum = deviceMapper.selectCount(queryWrapper);
|
||||
model.setActivationNum(activationNum);
|
||||
|
||||
//在线率 device表--online_status为1 在线数/总数
|
||||
QueryWrapper<AsDevice> queryWrapper2 = Wrappers.query();
|
||||
queryWrapper2.eq("online_status","1");
|
||||
Double onlineNum = deviceMapper.selectCount(queryWrapper2).doubleValue();
|
||||
|
||||
QueryWrapper<AsDevice> totalWrapper = Wrappers.query();
|
||||
Double totalNum = deviceMapper.selectCount(totalWrapper).doubleValue();
|
||||
double rate = onlineNum / totalNum;
|
||||
NumberFormat nf = NumberFormat.getPercentInstance();
|
||||
nf.setMinimumFractionDigits(2);//设置保留小数位
|
||||
nf.setRoundingMode(RoundingMode.HALF_UP); //设置舍入模式
|
||||
String onlineRate = nf.format(rate);
|
||||
model.setOnlineRate(onlineRate);
|
||||
}
|
||||
|
||||
return models;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue
Block a user