Commit e4e81072 by tyfanchz

Merge remote-tracking branch 'origin/dev' into dev

2 parents 28690ac8 3bfba3bf
......@@ -3,5 +3,5 @@ package cn.com.glsx.openplatform.service;
import java.util.Map;
public interface IceOpenApiService {
Map<String, Integer> getDataView(int userId);
Map<String, Integer> getDataView(int userId, int deviceType);
}
......@@ -34,7 +34,7 @@ public interface PlatformDeviceMapper extends OreMapper<PlatformDevice> {
List<Map<String, Object>> getDeviceActivationStatistic(@Param("startTime") Date startTime, @Param("endTime") Date endTime, @Param("customerName") String customerName);
int getDeviceCountByCustomerId(@Param("customerId") int customerId);
int getDeviceCountByCustomerId(@Param("customerId") int customerId, @Param("deviceTypeStr") String deviceTypeStr);
int getacticveDeviceCountByCustomerId(@Param("customerId") int customerId);
int getacticveDeviceCountByCustomerId(@Param("customerId") int customerId, @Param("deviceTypeStr") String deviceTypeStr);
}
\ No newline at end of file
......@@ -24,12 +24,28 @@ public class IceOpenApiServiceImpl implements IceOpenApiService {
private PlatformUserMapper userMapper;
@Override
public Map<String, Integer> getDataView(int userId) {
public Map<String, Integer> getDataView(int userId, int deviceType) {
HashMap<String, Integer> hashMap = new HashMap<>();
String deviceTypeStr;
// 设备类型 1 模组 2 核心板 3 完整板
switch (deviceType) {
case 1:
deviceTypeStr = "模组";
break;
case 2:
deviceTypeStr = "核心板";
break;
case 3:
deviceTypeStr = "完整板";
break;
default:
deviceTypeStr = "";
}
int customerId = userMapper.getCustomerId(userId);
int deviceCount = deviceMapper.getDeviceCountByCustomerId(customerId);
int deviceCount = deviceMapper.getDeviceCountByCustomerId(customerId, deviceTypeStr);
int userCount = userMapper.getUserCountByCustomerId(customerId);
int acticveDeviceCount = deviceMapper.getacticveDeviceCountByCustomerId(customerId);
int acticveDeviceCount = deviceMapper.getacticveDeviceCountByCustomerId(customerId, deviceTypeStr);
hashMap.put("totaldevice", deviceCount);
hashMap.put("totalusers", userCount);
hashMap.put("onlinedevices", acticveDeviceCount);
......
......@@ -112,6 +112,9 @@
select count(1)
from t_platform_device
where customer_id = #{customerId,jdbcType=INTEGER}
<if test="deviceTypeStr != null and deviceTypeStr != ''">
and device_type = #{deviceTypeStr,jdbcType=VARCHAR}
</if>
</select>
<select id="getacticveDeviceCountByCustomerId" resultType="java.lang.Integer">
......@@ -119,5 +122,8 @@
from t_platform_device
where status = 1
and customer_id = #{customerId,jdbcType=INTEGER}
<if test="deviceTypeStr != null and deviceTypeStr != ''">
and device_type = #{deviceTypeStr,jdbcType=VARCHAR}
</if>
</select>
</mapper>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!