Browse Source

服务统计

develop
wangsixiang 7 months ago
parent
commit
749b844686
  1. 19
      zc-business/src/main/java/com/zc/business/controller/DcPublishManageController.java
  2. 9
      zc-business/src/main/java/com/zc/business/domain/DcPublishManage.java
  3. 6
      zc-business/src/main/java/com/zc/business/mapper/DcPublishManageMapper.java
  4. 7
      zc-business/src/main/java/com/zc/business/service/IDcPublishManageService.java
  5. 16
      zc-business/src/main/java/com/zc/business/service/impl/DcPublishManageServiceImpl.java
  6. 65
      zc-business/src/main/resources/mapper/business/DcPublishManageMapper.xml

19
zc-business/src/main/java/com/zc/business/controller/DcPublishManageController.java

@ -114,4 +114,23 @@ public class DcPublishManageController extends BaseController
{ {
return toAjax(dcPublishManageService.deleteDcPublishManageByIds(ids)); return toAjax(dcPublishManageService.deleteDcPublishManageByIds(ids));
} }
//统计服务,今日发布渠道分析
@PostMapping("/statisticsPublishManage")
public AjaxResult statisticsPublishManage()
{
return AjaxResult.success(dcPublishManageService.statisticsPublishManage());
}
//统计服务,今日发布事件类型分析
@PostMapping("/eventTypePublishManage")
public AjaxResult eventTypePublishManage()
{
return AjaxResult.success(dcPublishManageService.eventTypePublishManage());
}
//统计服务,今日发布趋势分析
@PostMapping("/trendsPublishManage")
public AjaxResult releaseTrendsPublishManage()
{
return AjaxResult.success(dcPublishManageService.releaseTrendsPublishManage());
}
} }

9
zc-business/src/main/java/com/zc/business/domain/DcPublishManage.java

@ -120,8 +120,7 @@ public class DcPublishManage extends BaseEntity
private Integer eventState; private Integer eventState;
//关联情报板id //关联情报板id
private Long logId; private Long logId;
//关联语音广告发布id
private Long voiceId;
public Long getLogId() { public Long getLogId() {
return logId; return logId;
@ -131,13 +130,7 @@ public class DcPublishManage extends BaseEntity
this.logId = logId; this.logId = logId;
} }
public Long getVoiceId() {
return voiceId;
}
public void setVoiceId(Long voiceId) {
this.voiceId = voiceId;
}
public Integer getEventState() { public Integer getEventState() {
return eventState; return eventState;

6
zc-business/src/main/java/com/zc/business/mapper/DcPublishManageMapper.java

@ -67,4 +67,10 @@ public interface DcPublishManageMapper
public DcPublishManage selectPublishManage(@Param("dataCategory")Integer dataCategory); public DcPublishManage selectPublishManage(@Param("dataCategory")Integer dataCategory);
//查询信息发布列表 //查询信息发布列表
public List<HashMap<String,Object>> selectDcPublishManageListMap(DcPublishManage dcPublishManage); public List<HashMap<String,Object>> selectDcPublishManageListMap(DcPublishManage dcPublishManage);
//统计今日发布渠道分析
public List<HashMap<String,Object>> statisticsPublishManage();
//统计今日发布事件类型分析
public List<HashMap<String,Object>> eventTypePublishManage();
//统计今日发布趋势分析
public List<HashMap<String,Object>> releaseTrendsPublishManage();
} }

7
zc-business/src/main/java/com/zc/business/service/IDcPublishManageService.java

@ -1,5 +1,6 @@
package com.zc.business.service; package com.zc.business.service;
import java.util.HashMap;
import java.util.List; import java.util.List;
import com.zc.business.domain.DcPublishManage; import com.zc.business.domain.DcPublishManage;
@ -59,4 +60,10 @@ public interface IDcPublishManageService
* @return 结果 * @return 结果
*/ */
int deleteDcPublishManageById(Long id); int deleteDcPublishManageById(Long id);
//统计今日发布渠道分析
public List<HashMap<String,Object>> statisticsPublishManage();
//统计今日发布事件类型分析
public List<HashMap<String,Object>> eventTypePublishManage();
//统计今日发布趋势分析
public List<HashMap<String,Object>> releaseTrendsPublishManage();
} }

16
zc-business/src/main/java/com/zc/business/service/impl/DcPublishManageServiceImpl.java

@ -9,6 +9,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List; import java.util.List;
/** /**
@ -109,4 +110,19 @@ public class DcPublishManageServiceImpl implements IDcPublishManageService
{ {
return dcPublishManageMapper.deleteDcPublishManageById(id); return dcPublishManageMapper.deleteDcPublishManageById(id);
} }
//统计今日发布渠道分析
@Override
public List<HashMap<String,Object>> statisticsPublishManage() {
return dcPublishManageMapper.statisticsPublishManage();
}
//统计今日发布事件类型分析
@Override
public List<HashMap<String, Object>> eventTypePublishManage() {
return dcPublishManageMapper.eventTypePublishManage();
}
//统计今日发布趋势分析
@Override
public List<HashMap<String, Object>> releaseTrendsPublishManage() {
return dcPublishManageMapper.releaseTrendsPublishManage();
}
} }

65
zc-business/src/main/resources/mapper/business/DcPublishManageMapper.xml

@ -33,7 +33,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="facilityName" column="facility_name" /> <result property="facilityName" column="facility_name" />
<result property="eventState" column="event_state" /> <result property="eventState" column="event_state" />
<result property="logId" column="log_id" /> <result property="logId" column="log_id" />
<result property="voiceId" column="voice_id" />
</resultMap> </resultMap>
<sql id="selectDcPublishManageVo"> <sql id="selectDcPublishManageVo">
@ -62,6 +62,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectDcPublishManageList" parameterType="DcPublishManage" resultMap="DcPublishManageResult"> <select id="selectDcPublishManageList" parameterType="DcPublishManage" resultMap="DcPublishManageResult">
<include refid="selectDcPublishManageVo"/> <include refid="selectDcPublishManageVo"/>
<where> <where>
manage.event_id is not null
<if test="eventState != null"> and event.event_state = #{eventState}</if> <if test="eventState != null"> and event.event_state = #{eventState}</if>
<if test="eventType != null and eventType != ''"> and event.event_type = #{eventType}</if> <if test="eventType != null and eventType != ''"> and event.event_type = #{eventType}</if>
<if test="publishStatus != null and publishStatus != '' "> and manage.publish_status = #{publishStatus}</if> <if test="publishStatus != null and publishStatus != '' "> and manage.publish_status = #{publishStatus}</if>
@ -103,6 +104,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<insert id="insertDcPublishManage" parameterType="DcPublishManage" useGeneratedKeys="true" keyProperty="id"> <insert id="insertDcPublishManage" parameterType="DcPublishManage" useGeneratedKeys="true" keyProperty="id">
insert into dc_publish_manage insert into dc_publish_manage
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
@ -126,7 +128,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">update_time,</if> <if test="updateTime != null">update_time,</if>
<if test="createTime != null">create_time,</if> <if test="createTime != null">create_time,</if>
<if test="logId != null">log_id,</if> <if test="logId != null">log_id,</if>
<if test="voiceId != null">voice_id,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="eventId != null and eventId != ''">#{eventId},</if> <if test="eventId != null and eventId != ''">#{eventId},</if>
@ -149,7 +151,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">#{updateTime},</if> <if test="updateTime != null">#{updateTime},</if>
<if test="createTime != null">#{createTime},</if> <if test="createTime != null">#{createTime},</if>
<if test="logId != null">#{logId},</if> <if test="logId != null">#{logId},</if>
<if test="voiceId != null">#{voiceId},</if>
</trim> </trim>
</insert> </insert>
@ -176,7 +178,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">update_time = #{updateTime},</if> <if test="updateTime != null">update_time = #{updateTime},</if>
<if test="createTime != null">create_time = #{createTime},</if> <if test="createTime != null">create_time = #{createTime},</if>
<if test="logId != null">log_id = #{logId},</if> <if test="logId != null">log_id = #{logId},</if>
<if test="voiceId != null">voice_id = #{voiceId},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>
@ -191,4 +192,60 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id} #{id}
</foreach> </foreach>
</delete> </delete>
<select id="statisticsPublishManage" resultType="java.util.HashMap">
SELECT
p.publish_channels publishChannels,
COALESCE(SUM(CASE WHEN m.publish_channels = p.publish_channels THEN 1 ELSE 0 END), 0) AS number
FROM (
SELECT 1 AS publish_channels UNION ALL
SELECT 2 AS publish_channels UNION ALL
SELECT 3 AS publish_channels UNION ALL
SELECT 4 AS publish_channels UNION ALL
SELECT 5 AS publish_channels UNION ALL
SELECT 6 UNION ALL
SELECT 7
) AS p
LEFT JOIN dc_publish_manage AS m ON p.publish_channels = m.publish_channels
AND DATE(m.publish_time) = CURDATE()
GROUP BY p.publish_channels
ORDER BY p.publish_channels;
</select>
<select id="eventTypePublishManage" resultType="java.util.HashMap">
SELECT event.event_type AS eventType, COUNT(manage.event_id) AS number
FROM dc_event AS event
LEFT JOIN dc_publish_manage AS manage ON event.id = manage.event_id AND DATE(manage.publish_time) = CURDATE()
GROUP BY event.event_type
ORDER BY event.event_type;
</select>
<select id="releaseTrendsPublishManage" resultType="java.util.HashMap">
SELECT h.hour,
pc.publish_channels publishChannels,
COALESCE(m.number, 0) AS number
FROM (
SELECT 0 AS hour
UNION ALL
SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL
SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL
SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9 UNION ALL
SELECT 10 UNION ALL SELECT 11 UNION ALL SELECT 12 UNION ALL
SELECT 13 UNION ALL SELECT 14 UNION ALL SELECT 15 UNION ALL
SELECT 16 UNION ALL SELECT 17 UNION ALL SELECT 18 UNION ALL
SELECT 19 UNION ALL SELECT 20 UNION ALL SELECT 21 UNION ALL
SELECT 22 UNION ALL
SELECT 23
) AS h
CROSS JOIN (
SELECT 1 AS publish_channels
UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL
SELECT 5 UNION ALL SELECT 6 UNION ALL
SELECT 7
) AS pc
LEFT JOIN (
SELECT HOUR(publish_time) AS hour, publish_channels, COUNT(*)AS number
FROM dc_publish_manage
WHERE DATE(publish_time) = CURDATE()
GROUP BY HOUR(publish_time), publish_channels
) AS m ON h.hour = m.hour AND pc.publish_channels = m.publish_channels
ORDER BY h.hour, pc.publish_channels;
</select>
</mapper> </mapper>
Loading…
Cancel
Save