This commit is contained in:
高久奇 2021-12-07 18:52:18 +08:00
parent 345ca548dc
commit 85d1045648
10 changed files with 310 additions and 46 deletions

View File

@ -1,8 +1,7 @@
package com.nbclass.activity.controller; package com.nbclass.activity.controller;
import java.util.ArrayList; import java.text.Collator;
import java.util.Arrays; import java.util.*;
import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -14,6 +13,7 @@ import com.nbclass.activity.service.DataDictService;
import com.nbclass.exception.ParameterException; import com.nbclass.exception.ParameterException;
import com.nbclass.system.service.UserService; import com.nbclass.system.service.UserService;
import com.nbclass.util.JWTUtils; import com.nbclass.util.JWTUtils;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
@ -293,7 +293,7 @@ public class ContentController extends BaseController {
service.update(entity); service.update(entity);
if(entity.getApplicationId()!=null){ if(entity.getApplicationId()!=null){
//更新审核申请单状态 //更新审核申请单状态
service.updateApplicationStatus(entity.getApplicationId()); service.updateApplicationStatus(entity.getId(),entity.getApplicationId());
} }
desc="修改案例,案例类型:"+type+"案例ID"+entity.getId()+",案例标题:"+entity.getTitle(); desc="修改案例,案例类型:"+type+"案例ID"+entity.getId()+",案例标题:"+entity.getTitle();
}else{ }else{
@ -325,11 +325,11 @@ public class ContentController extends BaseController {
for (Long aLong : IdList) { for (Long aLong : IdList) {
//案例是否发布 //案例是否发布
Content editContent = service.getEditContent(aLong); Content editContent = service.getEditContent(aLong);
if(editContent.getRelease() != 5 && editContent.getRelease() !=3){ if(editContent.getStatus() != 5 && editContent.getStatus() !=3 || editContent.getStatus() == 2){
throw new ParameterException("案例已上线或审核中,无法删除!"); throw new ParameterException("案例已上线或审核中,无法删除!");
} }
if(editContent.getRelease() == 3){ if(editContent.getRelease() == 3){
service.deleteApplication(editContent.getApplicationId());
} }
} }
service.delete(IdList); service.delete(IdList);
@ -496,4 +496,32 @@ public class ContentController extends BaseController {
return Result.success(); return Result.success();
} }
/**
* 案例统计
* @param type
* @return
*/
@GetMapping("/getCensus")
@ResponseBody
public Result getCensus(Integer type){
//根据type获取统计信息 1本周统计 2本月统计 3本季度统计 4年度统计
List<Census> list = service.getCensus(type);
Long count = 0L;
for (Census census : list) {
count += census.getCount();
}
List<Integer> list2 = new ArrayList<>();
list.sort(Comparator.comparing(Census::getId));
for (int i = 0; i < list.size(); i++) {
if(list.get(i).getId() == 254 || list.get(i).getId() == 262 || list.get(i).getId() == 267){
list.remove(i);
}
list2.add(list.get(i).getCount());
}
Map<String,Object> map = new HashMap<>();
map.put("count",count);
map.put("list",list2);
return Result.success(map);
}
} }

View File

@ -1,6 +1,7 @@
package com.nbclass.activity.mapper; package com.nbclass.activity.mapper;
import java.util.List; import java.util.List;
import java.util.Map;
import com.nbclass.activity.model.*; import com.nbclass.activity.model.*;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -220,4 +221,10 @@ public interface ContentMapper extends MyMapper<Content> {
*/ */
Application getApplication(Long contentId); Application getApplication(Long contentId);
/**
* 本周统计案例数量
* @return
*/
List<Census> getCensus(Integer type);
} }

View File

@ -0,0 +1,12 @@
package com.nbclass.activity.model;
import lombok.Data;
@Data
public class Census {
private Integer id;
private Integer count;
}

View File

@ -1,6 +1,7 @@
package com.nbclass.activity.service; package com.nbclass.activity.service;
import java.util.List; import java.util.List;
import java.util.Map;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.nbclass.activity.model.*; import com.nbclass.activity.model.*;
@ -154,7 +155,7 @@ public interface ContentService {
* 更新审核申请单状态 * 更新审核申请单状态
* @param applicationId * @param applicationId
*/ */
void updateApplicationStatus(Long applicationId); void updateApplicationStatus(Long contentId,Long applicationId);
/** /**
* 获取审核列表 * 获取审核列表
@ -190,4 +191,5 @@ public interface ContentService {
*/ */
void deleteRelease(Long contentId); void deleteRelease(Long contentId);
List<Census> getCensus(Integer type);
} }

View File

@ -3,6 +3,7 @@ package com.nbclass.activity.service.impl;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.transaction.Transactional; import javax.transaction.Transactional;
@ -407,11 +408,13 @@ public class ContentServiceImpl implements ContentService {
@Override @Override
@Transactional @Transactional
public void updateApplicationStatus(Long applicationId) { public void updateApplicationStatus(Long contentId,Long applicationId) {
//更新审核申请单状态 //更新审核申请单状态
mapper.updateApplicationStatus(applicationId); mapper.updateApplicationStatus(applicationId);
//更新审核人状态 //更新审核人状态
mapper.updateCheckStatus(applicationId); mapper.updateCheckStatus(applicationId);
//更新案例状态(上架后重新申请)
mapper.updateContentRelease(contentId,1,2);
} }
@Override @Override
@ -466,5 +469,10 @@ public class ContentServiceImpl implements ContentService {
mapper.updateContentRelease(contentId,4,2); mapper.updateContentRelease(contentId,4,2);
} }
@Override
public List<Census> getCensus(Integer type) {
return mapper.getCensus(type);
}
} }

View File

@ -36,6 +36,7 @@
<result column="release" property="release"/> <result column="release" property="release"/>
<result column="status" property="status"/> <result column="status" property="status"/>
<result column="checkStatus" property="checkStatus"/> <result column="checkStatus" property="checkStatus"/>
<result column="applicationId" property="applicationId"/>
<!-- <association property="application" javaType="com.nbclass.activity.model.Application" column="id" select="getApplicationStatus">--> <!-- <association property="application" javaType="com.nbclass.activity.model.Application" column="id" select="getApplicationStatus">-->
@ -280,7 +281,11 @@
</select> </select>
<select id="getEditContent" resultMap="BaseResultMap2"> <select id="getEditContent" resultMap="BaseResultMap2">
select * from content where id = #{contentId} select
c.*,
a.id as applicationId,
IF(a.status=2,c.`release`,IFNULL(a.status,5)) as status
from content c left join application a on c.id = a.content_id where c.id = #{contentId}
</select> </select>
<insert id="saveApplication" useGeneratedKeys="true" keyProperty="id" keyColumn="id"> <insert id="saveApplication" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
@ -413,8 +418,14 @@
<update id="updateContentRelease"> <update id="updateContentRelease">
update content set update content set
<if test="release!=null and release == 1">
online_time = null,
</if>
<if test="release!=null and release == 2">
online_time = now(),
</if>
<if test="contentId!=null and release!=null and visibility!=null"> <if test="contentId!=null and release!=null and visibility!=null">
`release` = #{release},visibility = #{visibility},online_time = now() `release` = #{release},visibility = #{visibility}
</if> </if>
where id = #{contentId} where id = #{contentId}
</update> </update>
@ -431,4 +442,31 @@
select * from application where content_id = #{contentId} select * from application where content_id = #{contentId}
</select> </select>
<select id="getCensus" resultType="com.nbclass.activity.model.Census">
SELECT
DISTINCT item.id,
count(c.id) AS count
FROM
data_dict_item item
LEFT JOIN content_tags tags ON item.id = tags.tid
LEFT JOIN content c ON c.id = tags.cid
WHERE
item.dictid = 26
GROUP BY
item.id,c.id
<if test="type!=null and type==1">
and YEARWEEK( date_format(c.online_time, '%Y-%m-%d' ), 1 ) = YEARWEEK(now())
</if>
<if test="type!=null and type==2">
AND DATE_FORMAT( c.online_time, '%Y%m' ) = DATE_FORMAT( CURDATE( ), '%Y%m' )
</if>
<if test="type!=null and type==3">
AND QUARTER(c.online_time)=QUARTER(now())
</if>
<if test="type!=null and type==4">
AND YEAR(c.online_time)=YEAR(NOW())
</if>
</select>
</mapper> </mapper>

View File

@ -5,42 +5,204 @@
<title>Title</title> <title>Title</title>
</head> </head>
<body> <body>
<br/><br/><br/>
<!-- 为ECharts准备一个具备大小宽高的Dom --> <!-- 为ECharts准备一个具备大小宽高的Dom -->
<div id="main" style="width: 600px;height:400px;"></div> <div id="main" style="width: 1500px;height:800px;"></div><br/><br/><br/>
<div id="main2" style="width: 1500px;height:800px;"></div><br/><br/><br/>
<div id="main3" style="width: 1500px;height:800px;"></div><br/><br/><br/>
<div id="main4" style="width: 1500px;height:800px;"></div>
<script type="text/javascript"> <script type="text/javascript">
function getCensus(){
var count = [];
//初始化下拉框
$.getJSON("/cases/console/content/getCensus?type=1",function (data){
console.log(data)
// 基于准备好的dom初始化echarts实例 // 基于准备好的dom初始化echarts实例
var myChart = echarts.init(document.getElementById('main')); var myChart = echarts.init(document.getElementById('main'));
// 指定图表的配置项和数据 // 指定图表的配置项和数据
var option = { var option = {
title: { title: {
text: '本周案例上传' text: '本周案例上传数量:'+data.data.count
}, },
tooltip: {}, tooltip: {},
legend: { legend: {
data:['数量'] data:['周案例上传统计表']
}, },
xAxis: { xAxis: {
type: 'category', type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] data: ['信广龙广告-BD部', '信广龙广告-文案策划部', '信广龙广告-媒介部', '信广龙广告-活动部', '信广龙广告-客服项目部', '信广龙广告-创意视觉部', '信蜂互动',"信因视觉","上海知微-客服部",
"上海知微-视觉设计部","上海知微-视频部","上海知微-活动部","武汉初度-客户部","武汉初度-文案策划部","武汉初度-设计部","武汉初度-视频部","武汉初度-运营部"],
axisLabel: { interval: 0, rotate: 30 }
}, },
yAxis: { yAxis: {
type: 'value' type: 'value'
}, },
series: [ series: [
{ {
data: [120, 200, 150, 80, 70, 110, 130], name:'周案例上传统计表',
data: data.data.list,
type: 'bar', type: 'bar',
showBackground: true,
backgroundStyle: { backgroundStyle: {
color: 'rgba(180, 180, 180, 0.2)' color: 'rgba(180, 180, 180, 0.2)'
} },
barWidth : 30,//柱图宽度
} }
] ]
}; };
// 使用刚指定的配置项和数据显示图表。 // 使用刚指定的配置项和数据显示图表。
myChart.setOption(option); myChart.setOption(option);
});
}
function getCensus2(){
var count = [];
//初始化下拉框
$.getJSON("/cases/console/content/getCensus?type=2",function (data){
console.log(data)
// 基于准备好的dom初始化echarts实例
var myChart = echarts.init(document.getElementById('main2'));
// 指定图表的配置项和数据
var option = {
title: {
text: '本月案例上传数量:'+data.data.count
},
tooltip: {},
legend: {
data:['月案例上传统计表']
},
xAxis: {
type: 'category',
data: ['信广龙广告-BD部', '信广龙广告-文案策划部', '信广龙广告-媒介部', '信广龙广告-活动部', '信广龙广告-客服项目部', '信广龙广告-创意视觉部', '信蜂互动',"信因视觉","上海知微-客服部",
"上海知微-视觉设计部","上海知微-视频部","上海知微-活动部","武汉初度-客户部","武汉初度-文案策划部","武汉初度-设计部","武汉初度-视频部","武汉初度-运营部"],
axisLabel: { interval: 0, rotate: 30 }
},
yAxis: {
type: 'value'
},
series: [
{
name:'月案例上传统计表',
data: data.data.list,
type: 'bar',
backgroundStyle: {
color: 'rgba(180, 180, 180, 0.2)'
},
barWidth : 30,//柱图宽度
}
]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
});
}
function getCensus3(){
var count = [];
//初始化下拉框
$.getJSON("/cases/console/content/getCensus?type=3",function (data){
console.log(data)
// 基于准备好的dom初始化echarts实例
var myChart = echarts.init(document.getElementById('main3'));
// 指定图表的配置项和数据
var option = {
title: {
text: '本季度案例上传数量:'+data.data.count
},
tooltip: {},
legend: {
data:['季度案例上传统计表']
},
xAxis: {
type: 'category',
data: ['信广龙广告-BD部', '信广龙广告-文案策划部', '信广龙广告-媒介部', '信广龙广告-活动部', '信广龙广告-客服项目部', '信广龙广告-创意视觉部', '信蜂互动',"信因视觉","上海知微-客服部",
"上海知微-视觉设计部","上海知微-视频部","上海知微-活动部","武汉初度-客户部","武汉初度-文案策划部","武汉初度-设计部","武汉初度-视频部","武汉初度-运营部"],
axisLabel: { interval: 0, rotate: 30 }
},
yAxis: {
type: 'value'
},
series: [
{
name:'季度案例上传统计表',
data: data.data.list,
type: 'bar',
backgroundStyle: {
color: 'rgba(180, 180, 180, 0.2)'
},
barWidth : 30,//柱图宽度
}
]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
});
}
function getCensus4(){
var count = [];
//初始化下拉框
$.getJSON("/cases/console/content/getCensus?type=3",function (data){
console.log(data)
// 基于准备好的dom初始化echarts实例
var myChart = echarts.init(document.getElementById('main4'));
// 指定图表的配置项和数据
var option = {
title: {
text: '年度案例上传数量:'+data.data.count
},
tooltip: {},
legend: {
data:['年度案例上传统计表']
},
xAxis: {
type: 'category',
data: ['信广龙广告-BD部', '信广龙广告-文案策划部', '信广龙广告-媒介部', '信广龙广告-活动部', '信广龙广告-客服项目部', '信广龙广告-创意视觉部', '信蜂互动',"信因视觉","上海知微-客服部",
"上海知微-视觉设计部","上海知微-视频部","上海知微-活动部","武汉初度-客户部","武汉初度-文案策划部","武汉初度-设计部","武汉初度-视频部","武汉初度-运营部"],
axisLabel: { interval: 0, rotate: 30 }
},
yAxis: {
type: 'value'
},
series: [
{
name:'年度案例上传统计表',
data: data.data.list,
type: 'bar',
backgroundStyle: {
color: 'rgba(180, 180, 180, 0.2)'
},
barWidth : 30,//柱图宽度
}
]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
});
}
$(function (){
getCensus();
getCensus2();
getCensus3();
getCensus4();
});
</script> </script>
</body> </body>
</html> </html>

View File

@ -22,6 +22,7 @@
<label class="col-sm-2 control-label">状态:</label> <label class="col-sm-2 control-label">状态:</label>
<div class="col-sm-2"> <div class="col-sm-2">
<select id="applicationStatus" class="selectpicker" disabled="disabled"> <select id="applicationStatus" class="selectpicker" disabled="disabled">
<option value="">请选择</option>
</select> </select>
</div> </div>
<label class="col-sm-2 control-label">关联部门:</label> <label class="col-sm-2 control-label">关联部门:</label>
@ -35,7 +36,6 @@
<label class="col-sm-2 control-label">案例类型:</label> <label class="col-sm-2 control-label">案例类型:</label>
<div class="col-sm-2"> <div class="col-sm-2">
<select id="contentType18" name="tagLists" class="selectpicker"> <select id="contentType18" name="tagLists" class="selectpicker">
<option value="">请选择</option>
</select> </select>
</div> </div>
<label class="col-sm-2 control-label">案例用途:</label> <label class="col-sm-2 control-label">案例用途:</label>

View File

@ -217,7 +217,14 @@
{field: 'createtime', title: '创建时间', align : "center", width: "50"}, {field: 'createtime', title: '创建时间', align : "center", width: "50"},
{field: 'updatetime', title: '修改时间', align : "center", width: "50"}, {field: 'updatetime', title: '修改时间', align : "center", width: "50"},
{field: 'onlineTime', title: '上线时间', align : "center", width: "50"}, {field: 'onlineTime', title: '上线时间', align : "center", width: "50"},
{field: 'position', title: '关联部门', align : "center", width: "50"}, {field: 'position', title: '关联部门', align : "center", width: "50", formatter:function(value,row, index){
for(var i = 0; i < row.tagList.length;i++){
if(row.tagList[i].id === 26){
return row.tagList[i].tagName;
}
}
return "";
}},
{field: 'userName', title: '创建者', align : "center", width: "450"}, {field: 'userName', title: '创建者', align : "center", width: "450"},
/* {field: 'title', title: '标题', align : "left", width: "25%", formatter: function(value, row, index) { /* {field: 'title', title: '标题', align : "left", width: "25%", formatter: function(value, row, index) {
if(value!=null && $.trim(value)!='' && value.length>25){ if(value!=null && $.trim(value)!='' && value.length>25){

View File

@ -10,7 +10,7 @@
</section> </section>
<!-- Main content --> <!-- Main content -->
<section class="content"> <section class="content">
<div class="box box-default"> <!--<div class="box box-default">
<div class="box-header with-border"> <div class="box-header with-border">
<h3 class="box-title">功能开发中 ...</h3> <h3 class="box-title">功能开发中 ...</h3>
@ -38,6 +38,6 @@
</div> </div>
</div> </div>
</div> </div>-->
</section> </section>