Commit ff67c891 by 杨林龙

完成Dubbo基本开发 yangll

1 parent e422a156
package cn.com.glsx.openplatform.service;
import java.util.Map;
public interface IceOpenApiService {
Map<String, Integer> getDataView(int userId);
}
......@@ -34,4 +34,8 @@ public interface PlatformDeviceMapper extends OreMapper<PlatformDevice> {
List<Map<String, Integer>> getDeviceAccessTrendList(@Param("statisticStartTime") Date statisticStartTime, @Param("statisticEndTime") Date statisticEndTime);
List<Map<String, Object>> getDeviceActivationStatistic(@Param("startTime") Date startTime, @Param("endTime") Date endTime, @Param("customerName") String customerName);
int getDeviceCountByCustomerId(@Param("customerId") int customerId);
int getacticveDeviceCountByCustomerId(@Param("customerId") int customerId);
}
\ No newline at end of file
......@@ -28,4 +28,8 @@ public interface PlatformUserMapper extends OreMapper<PlatformUser> {
List<Map<String, Object>> getUserActivityStatistic(@Param("startTime") Date startTime,
@Param("endTime") Date endTime, @Param("customerName") String customerName);
int getCustomerId(@Param("userId") int userId);
int getUserCountByCustomerId(@Param("customerId") int customerId);
}
package cn.com.glsx.openplatform.service;
import cn.com.glsx.openplatform.mapper.PlatformDeviceMapper;
import cn.com.glsx.openplatform.mapper.PlatformUserMapper;
import com.alibaba.dubbo.config.annotation.Service;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
@Service
public class IceOpenApiServiceImpl implements IceOpenApiService {
/**
* 日志
*/
private final static Logger LOGGER = LoggerFactory.getLogger(IceOpenApiServiceImpl.class);
@Resource
private PlatformDeviceMapper deviceMapper;
@Resource
private PlatformUserMapper userMapper;
@Override
public Map<String, Integer> getDataView(int userId) {
HashMap<String, Integer> hashMap = new HashMap<>();
int customerId = userMapper.getCustomerId(userId);
int deviceCount = deviceMapper.getDeviceCountByCustomerId(customerId);
int userCount = userMapper.getUserCountByCustomerId(customerId);
int acticveDeviceCount = deviceMapper.getacticveDeviceCountByCustomerId(customerId);
hashMap.put("deviceCount", deviceCount);
hashMap.put("userCount", userCount);
hashMap.put("acticveDeviceCount", acticveDeviceCount);
return hashMap;
}
}
......@@ -57,12 +57,14 @@
</select>
<select id="getApiCallTrendList" resultType="java.util.Map">
select
select * from
(select
date_format(create_time,'%Y-%m-%d') as createTime,
count(id) as num
from t_platform_api_call
where create_time >= #{statisticStartTime,jdbcType=TIMESTAMP}
and create_time &lt; #{statisticEndTime,jdbcType=TIMESTAMP}
group by createTime
group by createTime) a
order by a.createTime
</select>
</mapper>
\ No newline at end of file
......@@ -29,7 +29,8 @@
</select>
<select id="getAppDownloadStatistic" resultType="map">
select date_format(pad.create_time, '%Y-%m-%d') `time`,
select * from
(select date_format(pad.create_time, '%Y-%m-%d') `time`,
count(pad.create_time) `count`
from t_platform_app_download pad
left join t_platform_customer pc on pc.id = pad.customer_id
......@@ -40,6 +41,7 @@
and pc.customer_name = #{customerName,jdbcType=VARCHAR}
</if>
</where>
group by time
group by time) a
order by a.time
</select>
</mapper>
......@@ -86,17 +86,20 @@
</select>
<select id="getDeviceAccessTrendList" resultType="java.util.Map">
select
select * from
(select
date_format(activat_time,'%Y-%m-%d') as activatTime,
count(id) as num
from t_platform_device
where activat_time >= #{statisticStartTime,jdbcType=TIMESTAMP}
and activat_time &lt; #{statisticEndTime,jdbcType=TIMESTAMP}
group by activatTime
group by activatTime) a
order by a.activatTime
</select>
<select id="getDeviceActivationStatistic" resultType="map">
select date_format(pd.activat_time, '%Y-%m-%d') `time`,
select * from
(select date_format(pd.activat_time, '%Y-%m-%d') `time`,
count(pd.activat_time) `count`
from t_platform_device pd
left join t_platform_customer pc on pc.id = pd.customer_id
......@@ -107,7 +110,21 @@
and pc.customer_name = #{customerName,jdbcType=VARCHAR}
</if>
</where>
group by time
group by time) a
order by a.time
</select>
<select id="getDeviceCountByCustomerId" resultType="java.lang.Integer">
select count(1)
from t_platform_device
where customer_id = #{customerId,jdbcType=INTEGER}
</select>
<select id="getacticveDeviceCountByCustomerId" resultType="java.lang.Integer">
select count(1)
from t_platform_device
where status = 1
and customer_id = #{customerId,jdbcType=INTEGER}
</select>
</mapper>
......@@ -75,7 +75,8 @@
</select>
<select id="getUserActivityStatistic" resultType="map">
select date_format(pu.last_login_time, '%Y-%m-%d') `time`,
select * from
(select date_format(pu.last_login_time, '%Y-%m-%d') `time`,
count(pu.last_login_time) `count`
from t_platform_user pu
left join t_platform_customer pc on pc.id = pu.customer_id
......@@ -86,8 +87,20 @@
and pc.customer_name = #{customerName,jdbcType=VARCHAR}
</if>
</where>
group by time
group by time) a
order by a.time
</select>
<select id="getCustomerId" resultType="java.lang.Integer">
select customer_id
from t_platform_user
where id = #{userId,jdbcType=INTEGER}
</select>
<select id="getUserCountByCustomerId" resultType="java.lang.Integer">
select count(1)
from t_platform_user
where customer_id = #{customerId,jdbcType=INTEGER}
</select>
</mapper>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!