Commit 21883f51 authored by wzp's avatar wzp

修改bug

parent c74324d4
......@@ -54,6 +54,6 @@ public interface TBoardStatisticMapper extends BaseMapper<TBoardStatistic> {
*/
Integer getInteractionTotal(TBoardSurvey survey);
List<Map> getInteractionFrequency(Page page,@Param("frequencyDate") String frequencyDate);
List<Map> getInteractionFrequency(Page page,@Param("frequencyDate") String frequencyDate,@Param("orgCode") String orgCode);
}
......@@ -69,5 +69,8 @@ public class TBoardPlayRank implements Serializable {
@TableField("play_date")
private String playDate;
@ApiModelProperty("机构编码")
private String organCode;
}
......@@ -55,6 +55,9 @@ public class TBoardPlayTrend implements Serializable {
@TableField("organ_id")
private Integer organId;
@ApiModelProperty("机构编码")
private String organCode;
......
......@@ -55,5 +55,7 @@ public class TBoardSurvey implements Serializable {
@ApiModelProperty("互动总量")
private Integer interactionCnt;
@ApiModelProperty("机构编码")
private String organCode;
}
......@@ -60,5 +60,8 @@ public class TDistrictBoardStatistic implements Serializable {
@TableField(exist = false)
private Integer boardCnt;
@ApiModelProperty("机构编码")
private String organCode;
}
......@@ -4,6 +4,7 @@ import cn.wisenergy.chnmuseum.party.model.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import org.apache.ibatis.annotations.Param;
import org.bytedeco.opencv.presets.opencv_core;
import java.util.List;
......@@ -61,8 +62,8 @@ public interface TBoardStatisticService extends IService<TBoardStatistic> {
* @param frequencyDate
* @return
*/
Page getInteractionFrequency(Page page,String frequencyDate);
Page getInteractionFrequency(Page page, String frequencyDate,String orgCode);
List getBoardProvincePlayTotalList(String organId);
List getBoardProvincePlayTotalList(String organId,String orgCode);
}
......@@ -128,13 +128,13 @@ public class TBoardStatisticServiceImpl extends ServiceImpl<TBoardStatisticMappe
}
@Override
public Page getInteractionFrequency(Page page,String frequencyDate){
page.setRecords(boardStatisticMapper.getInteractionFrequency(page,frequencyDate));
public Page getInteractionFrequency(Page page,String frequencyDate,String orgCode){
page.setRecords(boardStatisticMapper.getInteractionFrequency(page,frequencyDate,orgCode));
return page;
}
@Override
public List getBoardProvincePlayTotalList(String organId){
public List getBoardProvincePlayTotalList(String organId,String orgCode){
// 获取省份信息
QueryWrapper qw = new QueryWrapper();
qw.eq("type","P");
......@@ -146,6 +146,7 @@ public class TBoardStatisticServiceImpl extends ServiceImpl<TBoardStatisticMappe
String dateStr = DateUtil.getCurrentDate("yyyyMM");
survey.setStatisticDate(dateStr);
survey.setOrganId(organId);
survey.setOrganCode(orgCode);
List list = new ArrayList();
// 根据省份查询播放量
for(TArea prov : provlist){
......
......@@ -58,9 +58,14 @@ public class TBoardStatisticController extends BaseController {
@PostMapping("/getBoardSurvey")
// @RequiresAuthentication //@RequiresPermissions("t:board:statistic:survey")
@ApiOperation(value = "获取展板统计概况", notes = "获取展板统计概况")
// @MethodLog(operModule = OperModule.OVERVIEW, operType = OperType.SELECT)
public Map<String, Object> getBoardSurvey(TBoardSurvey survey) {
TUser user = null;
try {
user = getcurUser();
survey.setOrganCode(user.getOrgCode());
} catch (Exception e) {
survey.setOrganCode(null);
}
TBoardSurvey result = this.tBoardStatisticService.getBoardSurvey(survey);
return getResult(result);
......@@ -73,9 +78,14 @@ public class TBoardStatisticController extends BaseController {
@PostMapping("/getBoardRankPageList")
// @RequiresAuthentication //@RequiresPermissions("t:board:statistic:rankPage")
@ApiOperation(value = "获取展板播放排行", notes = "获取展板播放排行")
// @MethodLog(operModule = OperModule.OVERVIEW, operType = OperType.SELECT)
public Map<String, Object> getBoardRankPageList(TBoardPlayRank rank) {
TUser user = null;
try {
user = getcurUser();
rank.setOrganCode(user.getOrgCode());
} catch (Exception e) {
rank.setOrganCode(null);
}
Page<TBoardPlayRank> page = this.tBoardStatisticService.getBoardRankPageList(getPage(),rank);
for (TBoardPlayRank tBoardStatistic : page.getRecords()) {
......@@ -90,8 +100,14 @@ public class TBoardStatisticController extends BaseController {
@PostMapping("/getBoardTrendPageList")
// @RequiresAuthentication //@RequiresPermissions("t:board:statistic:trendPage")
@ApiOperation(value = "获取展板播放趋势", notes = "获取展板播放趋势")
// @MethodLog(operModule = OperModule.OVERVIEW, operType = OperType.SELECT)
public Map<String, Object> getBoardTrendPageList(TBoardPlayTrend trend) {
TUser user = null;
try {
user = getcurUser();
trend.setOrganCode(user.getOrgCode());
} catch (Exception e) {
trend.setOrganCode(null);
}
// 如果查询日志为空,则默认当月
if (StringUtils.isEmpty(trend.getPlayDate())){
trend.setPlayDate(DateUtil.getCurrentDate("yyyyMM"));
......@@ -120,8 +136,14 @@ public class TBoardStatisticController extends BaseController {
@PostMapping("/getBoardDistrictPageList")
// @RequiresAuthentication //@RequiresPermissions("t:board:statistic:districtPage")
@ApiOperation(value = "获取地区展板播统计", notes = "获取地区展板播统计")
// @MethodLog(operModule = OperModule.OVERVIEW, operType = OperType.SELECT)
public Map<String, Object> getBoardDistrictPageList(TDistrictBoardStatistic district) {
TUser user = null;
try {
user = getcurUser();
district.setOrganCode(user.getOrgCode());
} catch (Exception e) {
district.setOrganCode(null);
}
Page<TDistrictBoardStatistic> page = this.tBoardStatisticService.getBoardDistrictPageList(getPage(),district);
for (TDistrictBoardStatistic tBoardStatistic : page.getRecords()) {
......@@ -138,10 +160,15 @@ public class TBoardStatisticController extends BaseController {
@PostMapping("/getBoardProvincePlayTotalList")
// @RequiresAuthentication //@RequiresPermissions("t:board:statistic:provPlayList")
@ApiOperation(value = "获取省级展板播放统计", notes = "获取省级展板播放统计")
// @MethodLog(operModule = OperModule.OVERVIEW, operType = OperType.SELECT)
public Map<String, Object> getBoardProvincePlayTotalList(String organId) {
List list = this.tBoardStatisticService.getBoardProvincePlayTotalList(organId);
String orgCode;
try {
TUser user = getcurUser();
orgCode = user.getOrgCode();
} catch (Exception e) {
orgCode = null;
}
List list = this.tBoardStatisticService.getBoardProvincePlayTotalList(organId,orgCode);
return getResult(list);
}
......@@ -153,13 +180,19 @@ public class TBoardStatisticController extends BaseController {
@PostMapping("/getInteractionFrequencyPageList")
// @RequiresAuthentication //@RequiresPermissions("t:board:statistic:districtPage")
@ApiOperation(value = "获取互动频次统计信息", notes = "获取互动频次统计信息")
// @MethodLog(operModule = OperModule.OVERVIEW, operType = OperType.SELECT)
public Map<String, Object> getInteractionFrequencyPageList(String frequencyDate) {
String orgCode;
try {
TUser user = getcurUser();
orgCode = user.getOrgCode();
} catch (Exception e) {
orgCode = null;
}
if (StringUtils.isEmpty(frequencyDate)){
frequencyDate = DateUtil.getCurrentDate("yyyyMM");
}
Page page = this.tBoardStatisticService.getInteractionFrequency(getPage(),frequencyDate);
Page page = this.tBoardStatisticService.getInteractionFrequency(getPage(),frequencyDate,orgCode);
//
Map map = new HashMap();
List organList = new ArrayList<>();
......@@ -186,10 +219,17 @@ public class TBoardStatisticController extends BaseController {
@ApiImplicitParam(name = "_size", value = "返回条数", paramType = "query", dataType = "Integer")
})
@PostMapping("/getBoardPageList")
@RequiresAuthentication //@RequiresPermissions("t:board:statistic:Page")
// @RequiresAuthentication //@RequiresPermissions("t:board:statistic:Page")
@ApiOperation(value = "获取展板播放趋势", notes = "获取展板播放趋势")
// @MethodLog(operModule = OperModule.TEND, operType = OperType.SELECT)
public Map<String, Object> getBoardPageList(TBoardPlayTrend trend) {
TUser user = null;
try {
user = getcurUser();
trend.setOrganCode(user.getOrgCode());
} catch (Exception e) {
trend.setOrganCode(null);
}
// 如果查询日志为空,则默认当月
if (StringUtils.isEmpty(trend.getPlayDate())){
trend.setPlayDate(DateUtil.getCurrentDate("yyyyMM"));
......@@ -217,15 +257,22 @@ public class TBoardStatisticController extends BaseController {
@ApiImplicitParam(name = "frequencyDate", value = "互动统计时间 年:yyyy 月:yyyyMM,默认当月", paramType = "query", dataType = "String")
})
@PostMapping("/getInteractionPageList")
@RequiresAuthentication //@RequiresPermissions("t:interaction:statistic:districtPage")
// @RequiresAuthentication //@RequiresPermissions("t:interaction:statistic:districtPage")
@ApiOperation(value = "获取互动频次统计信息", notes = "获取互动频次统计信息")
// @MethodLog(operModule = OperModule.INTERACTION, operType = OperType.SELECT)
public Map<String, Object> getInteractionPageList(String frequencyDate) {
String orgCode;
try {
TUser user = getcurUser();
orgCode = user.getOrgCode();
} catch (Exception e) {
orgCode = null;
}
if (StringUtils.isEmpty(frequencyDate)){
frequencyDate = DateUtil.getCurrentDate("yyyyMM");
}
Page page = this.tBoardStatisticService.getInteractionFrequency(getPage(),frequencyDate);
Page page = this.tBoardStatisticService.getInteractionFrequency(getPage(),frequencyDate,orgCode);
//
Map map = new HashMap();
List organList = new ArrayList<>();
......
......@@ -41,74 +41,97 @@
<!-- 展板播放量统计 -->
<select id="getBoardRankPageList" parameterType="cn.wisenergy.chnmuseum.party.model.TBoardPlayRank" resultMap="rankMap">
SELECT board_id,board_name,sum(play_number) play_number from t_board_statistic
SELECT s.board_id,s.board_name,sum(s.play_number) play_number
from t_board_statistic s
left join t_organ o on o.id = s.organ_id
<where>
<if test="rank.playDate != null">
and play_date like concat( #{rank.playDate}, '%')
and s.play_date like concat( #{rank.playDate}, '%')
</if>
<if test="rank.organId != null">
and organ_id = #{rank.organId}
and s.organ_id = #{rank.organId}
</if>
<if test="rank.organCode != null">
and o.code LIKE concat(#{rank.organCode}, '%')
</if>
</where>
GROUP BY board_id,board_name
ORDER BY sum(play_number) desc
GROUP BY s.board_id,s.board_name
ORDER BY sum(s.play_number) desc
</select>
<!-- 播放趋势统计 -->
<select id="getBoardTrendPageList" parameterType="cn.wisenergy.chnmuseum.party.model.TBoardPlayTrend" resultMap="trendMap">
<if test="trend.playDate != null and trend.playDate.length() == 4">
SELECT sum(play_number) play_number,left(play_date,6) play_date from t_board_statistic
where left(play_date,4) = ${trend.playDate}
GROUP BY left(play_date,6)
ORDER BY left(play_date,6)
SELECT sum(s.play_number) play_number,left(s.play_date,6) play_date
from t_board_statistic s
left join t_organ o on o.id = s.organ_id
where left(s.play_date,4) = ${trend.playDate}
<if test="trend.organCode != null">
and o.code LIKE concat(#{trend.organCode}, '%')
</if>
GROUP BY left(s.play_date,6)
ORDER BY left(s.play_date,6)
</if>
<if test="trend.playDate != null and trend.playDate.length() == 6">
SELECT sum(play_number) play_number,play_date from t_board_statistic
where left(play_date,6) = ${trend.playDate}
GROUP BY play_date
ORDER BY play_date
SELECT sum(s.play_number) play_number,s.play_date
from t_board_statistic s
left join t_organ o on o.id = s.organ_id
where left(s.play_date,6) = ${trend.playDate}
<if test="trend.organCode != null">
and o.code LIKE concat(#{trend.organCode}, '%')
</if>
GROUP BY s.play_date
ORDER BY s.play_date
</if>
</select>
<!-- 地区展板播放统计 -->
<select id="getBoardDistrictPageList" resultMap="districtMap">
SELECT a.name area_name,sum(play_number) play_number,count(board_id) board_cnt from t_board_statistic s
SELECT a.name area_name,sum(s.play_number) play_number,count(s.board_id) board_cnt from t_board_statistic s
left join t_area a on s.area_id = a.id
left join t_organ o on o.id = s.organ_id
<where>
<if test="district.playDate != null and district.playDate.length() == 4">
left(play_date,4) = ${district.playDate}
left(s.play_date,4) = ${district.playDate}
</if>
<if test="district.playDate != null and district.playDate.length() == 6">
left(play_date,6) = ${district.playDate}
left(s.play_date,6) = ${district.playDate}
</if>
<if test="district.playDate != null and district.playDate.length() == 6">
play_date = ${district.playDate}
s.play_date = ${district.playDate}
</if>
<if test="district.organCode != null">
and o.code LIKE concat(#{district.organCode}, '%')
</if>
</where>
GROUP BY area_id
order by sum(play_number) desc,count(board_id) desc
GROUP BY s.area_id
order by sum(s.play_number) desc,count(board_id) desc
</select>
<!-- 获取展板播放总量 -->
<select id="getBoardPlayTotal" parameterType="cn.wisenergy.chnmuseum.party.model.TBoardSurvey" resultType="java.lang.Integer">
SELECT sum(play_number) play_number
SELECT sum(s.play_number) play_number
from t_board_statistic s
left join t_organ o on o.id = s.organ_id
<where>
<if test="statisticDate != null and statisticDate.length() == 4">
and left(play_date,4) = ${statisticDate}
and left(s.play_date,4) = ${statisticDate}
</if>
<if test="statisticDate != null and statisticDate.length() == 6">
and left(play_date,6) = ${statisticDate}
and left(s.play_date,6) = ${statisticDate}
</if>
<if test="statisticDate != null and statisticDate.length() == 8">
and play_date = ${statisticDate}
and s.play_date = ${statisticDate}
</if>
<if test="areaId != null">
and area_id like concat(#{areaId}, '%')
and s.area_id like concat(#{areaId}, '%')
</if>
<if test="organId != null">
and organ_id = #{organId}
and s.organ_id = #{organId}
</if>
<if test="organCode != null">
and o.code LIKE concat(#{organCode}, '%')
</if>
</where>
</select>
......@@ -117,20 +140,24 @@
<select id="getBoardTotal" resultType="java.lang.Integer">
SELECT count( a.board_id )
FROM
( SELECT board_id
( SELECT s.board_id
FROM t_board_statistic s
left join t_organ o on o.id = s.organ_id
<where>
<if test="statisticDate != null and statisticDate.length() == 4">
left(play_date,4) = ${statisticDate}
left(s.play_date,4) = ${statisticDate}
</if>
<if test="statisticDate != null and statisticDate.length() == 6">
left(play_date,6) = ${statisticDate}
left(s.play_date,6) = ${statisticDate}
</if>
<if test="statisticDate != null and statisticDate.length() == 8">
play_date = ${statisticDate}
s.play_date = ${statisticDate}
</if>
<if test="organCode != null">
and o.code LIKE concat(#{organCode}, '%')
</if>
</where>
GROUP BY board_id ) a
GROUP BY s.board_id ) a
</select>
<!-- 获取播放展板的机构总量 -->
......@@ -138,32 +165,40 @@
SELECT
count( a.organ_id )
FROM
( SELECT organ_id FROM t_board_statistic
( SELECT s.organ_id FROM t_board_statistic s
left join t_organ o on o.id = s.organ_id
<where>
<if test="statisticDate != null and statisticDate.length() == 4">
left(play_date,4) = ${statisticDate}
left(s.play_date,4) = ${statisticDate}
</if>
<if test="statisticDate != null and statisticDate.length() == 6">
left(play_date,6) = ${statisticDate}
left(s.play_date,6) = ${statisticDate}
</if>
<if test="statisticDate != null and statisticDate.length() == 8">
play_date = ${statisticDate}
s.play_date = ${statisticDate}
</if>
<if test="organCode != null">
and o.code LIKE concat(#{organCode}, '%')
</if>
</where>
GROUP BY organ_id ) a
GROUP BY s.organ_id ) a
</select>
<!-- 获取互动总量 -->
<select id="getInteractionTotal" resultType="java.lang.Integer">
select count(id) from t_interaction
select count(i.id) from t_interaction i
left join t_organ o on o.id = i.organ_id
<where>
<if test="statisticDate != null and statisticDate.length() == 4">
DATE_FORMAT(create_time,'%Y') = ${statisticDate}
DATE_FORMAT(i.create_time,'%Y') = ${statisticDate}
</if>
<if test="statisticDate != null and statisticDate.length() == 6">
DATE_FORMAT(create_time,'%Y%m') = ${statisticDate}
DATE_FORMAT(i.create_time,'%Y%m') = ${statisticDate}
</if>
<if test="statisticDate != null and statisticDate.length() == 8">
DATE_FORMAT(create_time,'%Y%m%d') = ${statisticDate}
DATE_FORMAT(i.create_time,'%Y%m%d') = ${statisticDate}
</if>
<if test="organCode != null">
and o.code LIKE concat(#{organCode}, '%')
</if>
</where>
</select>
......@@ -175,6 +210,9 @@
left join t_organ o on i.organ_id = o.id
<where>
DATE_FORMAT(i.create_time,'%Y') = ${frequencyDate}
<if test="orgCode != null">
and o.code LIKE concat(#{orgCode}, '%')
</if>
</where>
group by i.organ_id
</if>
......@@ -184,6 +222,9 @@
left join t_organ o on i.organ_id = o.id
<where>
DATE_FORMAT(i.create_time,'%Y%m') = ${frequencyDate}
<if test="orgCode != null">
and o.code LIKE concat(#{orgCode}, '%')
</if>
</where>
group by i.organ_id
</if>
......
......@@ -26,6 +26,7 @@
FROM t_interaction i
left join exhibition_board e on e.id = i.board_id
where i.organ_id =#{orgId}
order by i.create_time desc
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment